Skip to content

Commit

Permalink
Merge pull request #3920 from andrewmcgivery/master
Browse files Browse the repository at this point in the history
  • Loading branch information
markerikson committed Apr 2, 2021
2 parents 1b446bc + 1cd8f07 commit 90bd92e
Show file tree
Hide file tree
Showing 10 changed files with 328 additions and 45 deletions.
19 changes: 19 additions & 0 deletions errors.json
@@ -0,0 +1,19 @@
{
"0": "It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function.",
"1": "Expected the enhancer to be a function.",
"2": "Expected the reducer to be a function.",
"3": "You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.",
"4": "Expected the listener to be a function.",
"5": "You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.",
"6": "You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.",
"7": "Actions must be plain objects. Use custom middleware for async actions.",
"8": "Actions may not have an undefined \"type\" property. Have you misspelled a constant?",
"9": "Reducers may not dispatch actions.",
"10": "Expected the nextReducer to be a function.",
"11": "Expected the observer to be an object.",
"12": "bindActionCreators expected an object or a function, instead received . Did you write \"import ActionCreators from\" instead of \"import * as ActionCreators from\"?",
"13": "Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.",
"14": "Reducer \"\" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.",
"15": "Reducer \"\" returned undefined when probed with a random type. Don't try to handle or other actions in \"redux/*\" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.",
"16": "Super expression must either be null or a function"
}
26 changes: 13 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -63,7 +63,7 @@
"@babel/preset-flow": "^7.9.0",
"@babel/preset-typescript": "^7.9.0",
"@babel/register": "^7.9.0",
"@rollup/plugin-babel": "^5.2.2",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-node-resolve": "^7.1.3",
"@rollup/plugin-replace": "^2.3.2",
"@types/jest": "^25.2.1",
Expand Down
67 changes: 37 additions & 30 deletions rollup.config.js
Expand Up @@ -14,12 +14,12 @@ const babelRuntimeVersion = pkg.dependencies['@babel/runtime'].replace(
''
)

const makeExternalPredicate = (externalArr) => {
const makeExternalPredicate = externalArr => {
if (externalArr.length === 0) {
return () => false
}
const pattern = new RegExp(`^(${externalArr.join('|')})($|/)`)
return (id) => pattern.test(id)
return id => pattern.test(id)
}

export default [
Expand All @@ -29,21 +29,22 @@ export default [
output: { file: 'lib/redux.js', format: 'cjs', indent: false },
external: makeExternalPredicate([
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {}),
...Object.keys(pkg.peerDependencies || {})
]),
plugins: [
nodeResolve({
extensions,
extensions
}),
typescript({ useTsconfigDeclarationDir: true }),
babel({
extensions,
plugins: [
['@babel/plugin-transform-runtime', { version: babelRuntimeVersion }],
['./scripts/mangleErrors.js', { minify: false }]
],
babelHelpers: 'runtime'
}),
],
})
]
},

// ES
Expand All @@ -52,24 +53,25 @@ export default [
output: { file: 'es/redux.js', format: 'es', indent: false },
external: makeExternalPredicate([
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {}),
...Object.keys(pkg.peerDependencies || {})
]),
plugins: [
nodeResolve({
extensions,
extensions
}),
typescript({ tsconfigOverride: noDeclarationFiles }),
babel({
extensions,
plugins: [
[
'@babel/plugin-transform-runtime',
{ version: babelRuntimeVersion, useESModules: true },
{ version: babelRuntimeVersion, useESModules: true }
],
['./scripts/mangleErrors.js', { minify: false }]
],
babelHelpers: 'runtime'
}),
],
})
]
},

// ES for Browsers
Expand All @@ -78,25 +80,27 @@ export default [
output: { file: 'es/redux.mjs', format: 'es', indent: false },
plugins: [
nodeResolve({
extensions,
extensions
}),
replace({
'process.env.NODE_ENV': JSON.stringify('production'),
'process.env.NODE_ENV': JSON.stringify('production')
}),
typescript({ tsconfigOverride: noDeclarationFiles }),
babel({
extensions,
exclude: 'node_modules/**',
plugins: [['./scripts/mangleErrors.js', { minify: true }]],
skipPreflightCheck: true
}),
terser({
compress: {
pure_getters: true,
unsafe: true,
unsafe_comps: true,
warnings: false,
},
}),
],
warnings: false
}
})
]
},

// UMD Development
Expand All @@ -106,21 +110,22 @@ export default [
file: 'dist/redux.js',
format: 'umd',
name: 'Redux',
indent: false,
indent: false
},
plugins: [
nodeResolve({
extensions,
extensions
}),
typescript({ tsconfigOverride: noDeclarationFiles }),
babel({
extensions,
exclude: 'node_modules/**',
plugins: [['./scripts/mangleErrors.js', { minify: false }]]
}),
replace({
'process.env.NODE_ENV': JSON.stringify('development'),
}),
],
'process.env.NODE_ENV': JSON.stringify('development')
})
]
},

// UMD Production
Expand All @@ -130,28 +135,30 @@ export default [
file: 'dist/redux.min.js',
format: 'umd',
name: 'Redux',
indent: false,
indent: false
},
plugins: [
nodeResolve({
extensions,
extensions
}),
typescript({ tsconfigOverride: noDeclarationFiles }),
babel({
extensions,
exclude: 'node_modules/**',
plugins: [['./scripts/mangleErrors.js', { minify: true }]],
skipPreflightCheck: true
}),
replace({
'process.env.NODE_ENV': JSON.stringify('production'),
'process.env.NODE_ENV': JSON.stringify('production')
}),
terser({
compress: {
pure_getters: true,
unsafe: true,
unsafe_comps: true,
warnings: false,
},
}),
],
},
warnings: false
}
})
]
}
]

0 comments on commit 90bd92e

Please sign in to comment.