mirror of
https://github.com/pmndrs/zustand.git
synced 2025-12-08 19:45:52 +00:00
[v5] drop es5 (#2380)
This commit is contained in:
parent
77162b5ad7
commit
752b917c77
@ -108,15 +108,8 @@
|
||||
},
|
||||
"homepage": "https://github.com/pmndrs/zustand",
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.24.0",
|
||||
"@babel/plugin-external-helpers": "^7.23.3",
|
||||
"@babel/plugin-transform-react-jsx": "^7.23.4",
|
||||
"@babel/plugin-transform-runtime": "^7.24.0",
|
||||
"@babel/plugin-transform-typescript": "^7.23.6",
|
||||
"@babel/preset-env": "^7.24.0",
|
||||
"@redux-devtools/extension": "^3.3.0",
|
||||
"@rollup/plugin-alias": "^5.1.0",
|
||||
"@rollup/plugin-babel": "^6.0.4",
|
||||
"@rollup/plugin-node-resolve": "^15.2.3",
|
||||
"@rollup/plugin-replace": "^5.0.5",
|
||||
"@rollup/plugin-typescript": "^11.1.6",
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
const path = require('path')
|
||||
const alias = require('@rollup/plugin-alias')
|
||||
const babelPlugin = require('@rollup/plugin-babel')
|
||||
const resolve = require('@rollup/plugin-node-resolve')
|
||||
const replace = require('@rollup/plugin-replace')
|
||||
const typescript = require('@rollup/plugin-typescript')
|
||||
@ -19,24 +18,9 @@ function external(id) {
|
||||
return !id.startsWith('.') && !id.startsWith(root)
|
||||
}
|
||||
|
||||
function getBabelOptions(targets) {
|
||||
return {
|
||||
babelrc: false,
|
||||
ignore: ['./node_modules'],
|
||||
presets: [['@babel/preset-env', { loose: true, modules: false, targets }]],
|
||||
plugins: [
|
||||
['@babel/plugin-transform-react-jsx', { runtime: 'automatic' }],
|
||||
['@babel/plugin-transform-typescript', { isTSX: true }],
|
||||
],
|
||||
extensions,
|
||||
comments: false,
|
||||
babelHelpers: 'bundled',
|
||||
}
|
||||
}
|
||||
|
||||
function getEsbuild(env = 'development') {
|
||||
function getEsbuild(format) {
|
||||
return esbuild({
|
||||
minify: env === 'production',
|
||||
format,
|
||||
target: 'es2018',
|
||||
supported: { 'import-meta': true },
|
||||
tsconfig: path.resolve('./tsconfig.json'),
|
||||
@ -83,7 +67,7 @@ function createESMConfig(input, output) {
|
||||
delimiters: ['\\b', '\\b(?!(\\.|/))'],
|
||||
preventAssignment: true,
|
||||
}),
|
||||
getEsbuild(),
|
||||
getEsbuild('esm'),
|
||||
],
|
||||
}
|
||||
}
|
||||
@ -91,11 +75,7 @@ function createESMConfig(input, output) {
|
||||
function createCommonJSConfig(input, output) {
|
||||
return {
|
||||
input,
|
||||
output: {
|
||||
file: `${output}.js`,
|
||||
format: 'cjs',
|
||||
esModule: false,
|
||||
},
|
||||
output: { file: output, format: 'cjs' },
|
||||
external,
|
||||
plugins: [
|
||||
alias({ entries: entries.filter((e) => !e.find.test(input)) }),
|
||||
@ -105,7 +85,7 @@ function createCommonJSConfig(input, output) {
|
||||
delimiters: ['\\b', '\\b(?!(\\.|/))'],
|
||||
preventAssignment: true,
|
||||
}),
|
||||
babelPlugin(getBabelOptions({ ie: 11 })),
|
||||
getEsbuild('cjs'),
|
||||
],
|
||||
}
|
||||
}
|
||||
@ -119,8 +99,8 @@ module.exports = function (args) {
|
||||
}
|
||||
return [
|
||||
...(c === 'index' ? [createDeclarationConfig(`src/${c}.ts`, 'dist')] : []),
|
||||
createCommonJSConfig(`src/${c}.ts`, `dist/${c}`),
|
||||
createESMConfig(`src/${c}.ts`, `dist/esm/${c}.mjs`), // just for testing sed -e flag
|
||||
createCommonJSConfig(`src/${c}.ts`, `dist/${c}.js`),
|
||||
createESMConfig(`src/${c}.ts`, `dist/esm/${c}.mjs`),
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user