@modern-js/core 1.2.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/dist/js/modern/cli.js +29 -0
- package/dist/js/modern/config/index.js +11 -5
- package/dist/js/modern/context.js +24 -16
- package/dist/js/modern/index.js +19 -10
- package/dist/js/modern/loadPlugins.js +16 -2
- package/dist/js/node/cli.js +35 -0
- package/dist/js/node/config/index.js +11 -5
- package/dist/js/node/context.js +24 -16
- package/dist/js/node/index.js +28 -37
- package/dist/js/node/loadPlugins.js +17 -1
- package/dist/types/cli.d.ts +1 -0
- package/dist/types/config/index.d.ts +14 -13
- package/dist/types/context.d.ts +6 -1
- package/dist/types/index.d.ts +13 -7
- package/dist/types/loadPlugins.d.ts +5 -0
- package/jest.config.js +8 -0
- package/modern.config.js +0 -7
- package/package.json +17 -10
- package/tests/btsm.test.ts +20 -0
- package/tests/config.test.ts +137 -0
- package/tests/context.test.ts +63 -0
- package/tests/fixtures/index-test/package.json +3 -0
- package/tests/index.test.ts +74 -0
- package/tests/loadEnv.test.ts +1 -1
- package/tests/loadPlugin.test.ts +36 -1
- package/tests/mergeConfig.test.ts +1 -1
- package/tests/repeatKeyWarning.test.ts +2 -2
- package/tests/schema.test.ts +1 -1
- package/tests/tsconfig.json +1 -3
- package/tests/utils.test.ts +8 -0
- package/tsconfig.json +1 -3
- package/src/config/defaults.ts +0 -101
- package/src/config/index.ts +0 -297
- package/src/config/mergeConfig.ts +0 -69
- package/src/config/schema/deploy.ts +0 -17
- package/src/config/schema/index.ts +0 -116
- package/src/config/schema/output.ts +0 -65
- package/src/config/schema/server.ts +0 -106
- package/src/config/schema/source.ts +0 -34
- package/src/config/schema/tools.ts +0 -15
- package/src/context.ts +0 -46
- package/src/index.ts +0 -277
- package/src/initWatcher.ts +0 -77
- package/src/loadEnv.ts +0 -23
- package/src/loadPlugins.ts +0 -91
- package/src/types.d.ts +0 -0
- package/src/utils/commander.ts +0 -22
- package/src/utils/repeatKeyWarning.ts +0 -29
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { UserConfig } from '../config';
|
|
2
|
-
import { traverseSchema } from '../config/schema';
|
|
3
|
-
|
|
4
|
-
export const deepGet = (obj: any, key: string) => {
|
|
5
|
-
for (const p of key.split('.')) {
|
|
6
|
-
// eslint-disable-next-line no-param-reassign
|
|
7
|
-
obj = obj ? obj[p] : undefined;
|
|
8
|
-
}
|
|
9
|
-
return obj;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const repeatKeyWarning = (
|
|
13
|
-
schema: any,
|
|
14
|
-
jsConfig: UserConfig,
|
|
15
|
-
pkgConfig: UserConfig,
|
|
16
|
-
) => {
|
|
17
|
-
const keys = traverseSchema(schema);
|
|
18
|
-
|
|
19
|
-
for (const key of keys) {
|
|
20
|
-
if (
|
|
21
|
-
deepGet(jsConfig, key) !== undefined &&
|
|
22
|
-
deepGet(pkgConfig, key) !== undefined
|
|
23
|
-
) {
|
|
24
|
-
throw new Error(
|
|
25
|
-
`The same configuration ${key} exists in modern.config.js and package.json.\n Please remove it from package.json.`,
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
};
|