Skip to content

Commit

Permalink
[v2] breaking: remove deprecated features (#820)
Browse files Browse the repository at this point in the history
* remove depreacated useProxy macro

* revert plugin-transform

* remove two more babel packages

* revert babel core

* remove proxyWithComputed

* remove addComputed

* remove devtools deprecated option
  • Loading branch information
dai-shi committed Nov 14, 2023
1 parent 615df9c commit 580dcde
Show file tree
Hide file tree
Showing 13 changed files with 68 additions and 1,063 deletions.
11 changes: 1 addition & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@
"build:vanilla_utils": "rollup -c --config-vanilla_utils",
"build:react": "rollup -c --config-react",
"build:react_utils": "rollup -c --config-react_utils",
"build:macro": "rollup -c --config-macro",
"build:macro_vite": "rollup -c --config-macro_vite",
"postbuild": "yarn patch-d-ts && yarn copy && yarn patch-macro-vite && yarn patch-old-ts && yarn patch-esm-ts",
"postbuild": "yarn patch-d-ts && yarn copy && yarn patch-old-ts && yarn patch-esm-ts",
"prettier": "prettier '*.{js,json,md}' '{src,tests,docs}/**/*.{ts,tsx,md,mdx}' --write",
"prettier:ci": "prettier '*.{js,json,md}' '{src,tests,docs}/**/*.{ts,tsx,md,mdx}' --list-different",
"eslint": "eslint --no-eslintrc --c .eslintrc.json --fix '*.{js,json,ts}' '{src,tests}/**/*.{ts,tsx}'",
Expand All @@ -75,7 +73,6 @@
"test:ci": "vitest",
"patch-d-ts": "node -e \"var {entries}=require('./rollup.config.js');require('shelljs').find('dist/**/*.d.ts').forEach(f=>{entries.forEach(({find,replacement})=>require('shelljs').sed('-i',new RegExp(' from \\''+find.source.slice(0,-1)+'\\';$'),' from \\''+replacement+'\\';',f));require('shelljs').sed('-i',/ from '(\\.[^']+)\\.ts';$/,' from \\'\\$1\\';',f)})\"",
"copy": "shx cp -r dist/src/* dist/esm && shx cp -r dist/src/* dist && shx rm -rf dist/{src,tests} && shx cp package.json readme.md LICENSE dist && json -I -f dist/package.json -e \"this.private=false; this.devDependencies=undefined; this.optionalDependencies=undefined; this.scripts=undefined; this.prettier=undefined;\"",
"patch-macro-vite": "shx cp dist/esm/macro/vite.d.ts dist/macro/",
"patch-old-ts": "shx touch dist/ts_version_4.5_and_above_is_required.d.ts",
"patch-esm-ts": "node -e \"require('shelljs').find('dist/esm/**/*.d.ts').forEach(f=>{var f2=f.replace(/\\.ts$/,'.mts');require('fs').renameSync(f,f2);require('shelljs').sed('-i',/ from '(\\.[^']+)';$/,' from \\'\\$1.mjs\\';',f2);require('shelljs').sed('-i',/^declare module '(\\.[^']+)'/,'declare module \\'\\$1.mjs\\'',f2)})\""
},
Expand Down Expand Up @@ -112,11 +109,9 @@
},
"devDependencies": {
"@babel/core": "^7.23.2",
"@babel/helper-module-imports": "^7.22.15",
"@babel/plugin-transform-react-jsx": "^7.22.15",
"@babel/plugin-transform-typescript": "^7.22.15",
"@babel/preset-env": "^7.23.2",
"@babel/types": "^7.23.0",
"@redux-devtools/extension": "^3.2.5",
"@rollup/plugin-alias": "^5.0.1",
"@rollup/plugin-babel": "^6.0.4",
Expand All @@ -125,17 +120,13 @@
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.5",
"@testing-library/react": "^14.0.0",
"@types/babel-plugin-macros": "^3.1.2",
"@types/jsdom": "^21.1.4",
"@types/react": "^18.2.34",
"@types/react-dom": "^18.2.14",
"@typescript-eslint/eslint-plugin": "^6.9.1",
"@typescript-eslint/parser": "^6.9.1",
"@vitest/coverage-v8": "0.33.0",
"@vitest/ui": "0.33.0",
"aslemammad-vite-plugin-macro": "^1.0.0",
"babel-plugin-macros": "^3.1.0",
"babel-plugin-tester": "10.1.0",
"concurrently": "^8.2.2",
"esbuild": "^0.19.5",
"eslint": "^8.52.0",
Expand Down
50 changes: 0 additions & 50 deletions src/macro.ts

This file was deleted.

73 changes: 0 additions & 73 deletions src/macro/vite.ts

This file was deleted.

2 changes: 0 additions & 2 deletions src/vanilla/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ export { subscribeKey } from './utils/subscribeKey.ts'
export { watch } from './utils/watch.ts'
export { devtools } from './utils/devtools.ts'
export { derive, underive, unstable_deriveSubscriptions } from 'derive-valtio'
export { addComputed_DEPRECATED as addComputed } from './utils/addComputed.ts'
export { proxyWithComputed_DEPRECATED as proxyWithComputed } from './utils/proxyWithComputed.ts'
export { deepClone } from './utils/deepClone.ts'
export { proxyWithHistory } from './utils/proxyWithHistory.ts'
export { proxySet } from './utils/proxySet.ts'
Expand Down
27 changes: 0 additions & 27 deletions src/vanilla/utils/addComputed.ts

This file was deleted.

23 changes: 2 additions & 21 deletions src/vanilla/utils/devtools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,6 @@ type Options = {
name?: string
} & Config

export function devtools<T extends object>(
proxyObject: T,
options?: Options,
): (() => void) | undefined

/**
* @deprecated Please use { name } option
*/
export function devtools<T extends object>(
proxyObject: T,
name?: string,
): (() => void) | undefined

/**
* devtools
*
Expand All @@ -47,14 +34,8 @@ export function devtools<T extends object>(
*/
export function devtools<T extends object>(
proxyObject: T,
options?: Options | string,
) {
if (typeof options === 'string') {
console.warn(
'string name option is deprecated, use { name }. https://github.com/pmndrs/valtio/pull/400',
)
options = { name: options }
}
options?: Options,
): (() => void) | undefined {
const { enabled, name = '', ...rest } = options || {}

let extension: (typeof window)['__REDUX_DEVTOOLS_EXTENSION__'] | false
Expand Down
48 changes: 0 additions & 48 deletions src/vanilla/utils/proxyWithComputed.ts

This file was deleted.

34 changes: 0 additions & 34 deletions tests/__snapshots__/macro-vite.test.ts.snap

This file was deleted.

Loading

0 comments on commit 580dcde

Please sign in to comment.