@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.
Files changed (49) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/js/modern/cli.js +29 -0
  3. package/dist/js/modern/config/index.js +11 -5
  4. package/dist/js/modern/context.js +24 -16
  5. package/dist/js/modern/index.js +19 -10
  6. package/dist/js/modern/loadPlugins.js +16 -2
  7. package/dist/js/node/cli.js +35 -0
  8. package/dist/js/node/config/index.js +11 -5
  9. package/dist/js/node/context.js +24 -16
  10. package/dist/js/node/index.js +28 -37
  11. package/dist/js/node/loadPlugins.js +17 -1
  12. package/dist/types/cli.d.ts +1 -0
  13. package/dist/types/config/index.d.ts +14 -13
  14. package/dist/types/context.d.ts +6 -1
  15. package/dist/types/index.d.ts +13 -7
  16. package/dist/types/loadPlugins.d.ts +5 -0
  17. package/jest.config.js +8 -0
  18. package/modern.config.js +0 -7
  19. package/package.json +17 -10
  20. package/tests/btsm.test.ts +20 -0
  21. package/tests/config.test.ts +137 -0
  22. package/tests/context.test.ts +63 -0
  23. package/tests/fixtures/index-test/package.json +3 -0
  24. package/tests/index.test.ts +74 -0
  25. package/tests/loadEnv.test.ts +1 -1
  26. package/tests/loadPlugin.test.ts +36 -1
  27. package/tests/mergeConfig.test.ts +1 -1
  28. package/tests/repeatKeyWarning.test.ts +2 -2
  29. package/tests/schema.test.ts +1 -1
  30. package/tests/tsconfig.json +1 -3
  31. package/tests/utils.test.ts +8 -0
  32. package/tsconfig.json +1 -3
  33. package/src/config/defaults.ts +0 -101
  34. package/src/config/index.ts +0 -297
  35. package/src/config/mergeConfig.ts +0 -69
  36. package/src/config/schema/deploy.ts +0 -17
  37. package/src/config/schema/index.ts +0 -116
  38. package/src/config/schema/output.ts +0 -65
  39. package/src/config/schema/server.ts +0 -106
  40. package/src/config/schema/source.ts +0 -34
  41. package/src/config/schema/tools.ts +0 -15
  42. package/src/context.ts +0 -46
  43. package/src/index.ts +0 -277
  44. package/src/initWatcher.ts +0 -77
  45. package/src/loadEnv.ts +0 -23
  46. package/src/loadPlugins.ts +0 -91
  47. package/src/types.d.ts +0 -0
  48. package/src/utils/commander.ts +0 -22
  49. 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
- };