@modern-js/core 1.13.0 → 1.13.3

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 CHANGED
@@ -1,5 +1,42 @@
1
1
  # @modern-js/core
2
2
 
3
+ ## 1.13.3
4
+
5
+ ### Patch Changes
6
+
7
+ - f4822c0: feat(app-tools): start and inspect command support specify config file
8
+
9
+ feat(app-tools): start 和 inspect 命令支持指定配置文件
10
+
11
+ - Updated dependencies [4f1889d]
12
+ - @modern-js/utils@1.8.1
13
+
14
+ ## 1.13.2
15
+
16
+ ### Patch Changes
17
+
18
+ - bfc1264: fix(core): should keep single function value after merge config
19
+
20
+ fix(core): 修复合并配置后,函数类型的配置项变成数组类型的问题
21
+
22
+ - 44e3bb1: feat: support response headers
23
+ feat: 支持设置响应头
24
+ - @modern-js/utils@1.8.0
25
+
26
+ ## 1.13.1
27
+
28
+ ### Patch Changes
29
+
30
+ - 9d60891: feat(webpack): support source.preEntry config
31
+
32
+ feat(webpack): 新增 source.preEntry 配置项
33
+
34
+ - 5876e63: fix: the SSG callback is called once for each baseUrl, when a user configures multiple baseUrl.
35
+ fix: 当用户配置了多个 baseUrl 时,将会为每个 baseUrl 调用一次 SSG 回调函数。
36
+ - Updated dependencies [4fc801f]
37
+ - Updated dependencies [c8614b8]
38
+ - @modern-js/utils@1.8.0
39
+
3
40
  ## 1.13.0
4
41
 
5
42
  ### Minor Changes
package/dist/bin.js CHANGED
@@ -23,7 +23,18 @@ const cliParams = (0, utils_1.minimist)(process.argv.slice(2));
23
23
  const runOptions = {
24
24
  version,
25
25
  };
26
- if (['dev', 'build', 'deploy'].includes(command) && cliParams.config) {
26
+ /**
27
+ * Commands that support specify config files
28
+ * Some commands can't support this feature, such as `new`
29
+ */
30
+ const SUPPORT_CONFIG_PARAM_COMMANDS = [
31
+ 'dev',
32
+ 'build',
33
+ 'deploy',
34
+ 'start',
35
+ 'inspect',
36
+ ];
37
+ if (SUPPORT_CONFIG_PARAM_COMMANDS.includes(command) && cliParams.config) {
27
38
  runOptions.configFile = cliParams.config;
28
39
  }
29
40
  _1.cli.run(process.argv.slice(2), runOptions);
@@ -22,11 +22,17 @@ const mergeConfig = (configs) => (0, lodash_1.mergeWith)({}, ...configs, (target
22
22
  return [...target, ...source];
23
23
  }
24
24
  else {
25
- return typeof source !== 'undefined' ? [...target, source] : target;
25
+ return source !== undefined ? [...target, source] : target;
26
26
  }
27
27
  }
28
- else if ((0, utils_1.isFunction)(source)) {
29
- return typeof target !== 'undefined' ? [target, source] : [source];
28
+ else if ((0, utils_1.isFunction)(target) || (0, utils_1.isFunction)(source)) {
29
+ if (source === undefined) {
30
+ return target;
31
+ }
32
+ if (target === undefined) {
33
+ return source;
34
+ }
35
+ return [target, source];
30
36
  }
31
37
  return undefined;
32
38
  });
@@ -39,6 +39,9 @@ export declare const patchSchema: (pluginSchemas: Array<PluginValidateSchema | P
39
39
  };
40
40
  };
41
41
  };
42
+ preEntry: {
43
+ type: string[];
44
+ };
42
45
  alias: {
43
46
  typeof: string[];
44
47
  };
@@ -337,6 +340,9 @@ export declare const patchSchema: (pluginSchemas: Array<PluginValidateSchema | P
337
340
  disableSpa: {
338
341
  type: string;
339
342
  };
343
+ resHeaders: {
344
+ type: string;
345
+ };
340
346
  };
341
347
  additionalProperties: boolean;
342
348
  };
@@ -124,6 +124,9 @@ export declare const server: {
124
124
  disableSpa: {
125
125
  type: string;
126
126
  };
127
+ resHeaders: {
128
+ type: string;
129
+ };
127
130
  };
128
131
  additionalProperties: boolean;
129
132
  };
@@ -69,6 +69,7 @@ exports.server = {
69
69
  ],
70
70
  },
71
71
  disableSpa: { type: 'boolean' },
72
+ resHeaders: { type: 'object' },
72
73
  },
73
74
  additionalProperties: false,
74
75
  },
@@ -30,6 +30,9 @@ export declare const source: {
30
30
  };
31
31
  };
32
32
  };
33
+ preEntry: {
34
+ type: string[];
35
+ };
33
36
  alias: {
34
37
  typeof: string[];
35
38
  };
@@ -24,6 +24,7 @@ exports.source = {
24
24
  },
25
25
  },
26
26
  },
27
+ preEntry: { type: ['string', 'array'] },
27
28
  alias: { typeof: ['object', 'function'] },
28
29
  disableDefaultEntries: { type: 'boolean' },
29
30
  envVars: { type: 'array' },
@@ -29,6 +29,7 @@ export interface SourceConfig {
29
29
  enableFileSystemRoutes?: boolean;
30
30
  disableMount?: boolean;
31
31
  }>;
32
+ preEntry?: string | string[];
32
33
  disableDefaultEntries?: boolean;
33
34
  entriesDir?: string;
34
35
  configDir?: string;
@@ -102,8 +103,9 @@ export interface OutputConfig {
102
103
  }
103
104
  export interface ServerConfig {
104
105
  routes?: Record<string, string | string[] | {
105
- route: string | string[];
106
+ route?: string | string[];
106
107
  disableSpa?: boolean;
108
+ resHeaders?: Record<string, unknown>;
107
109
  }>;
108
110
  publicRoutes?: {
109
111
  [filepath: string]: string;
@@ -10,4 +10,6 @@ export declare type SSGSingleEntryOptions = boolean | {
10
10
  routes?: SSGRouteOptions[];
11
11
  };
12
12
  export declare type SSGMultiEntryOptions = Record<string, SSGSingleEntryOptions>;
13
- export declare type SSGConfig = boolean | SSGSingleEntryOptions | SSGMultiEntryOptions | ((entryName: string) => SSGSingleEntryOptions);
13
+ export declare type SSGConfig = boolean | SSGSingleEntryOptions | SSGMultiEntryOptions | ((entryName: string, payload: {
14
+ baseUrl?: string;
15
+ }) => SSGSingleEntryOptions);
package/package.json CHANGED
@@ -6,12 +6,11 @@
6
6
  "repository": "modern-js-dev/modern.js",
7
7
  "license": "MIT",
8
8
  "keywords": [
9
- "react",
10
9
  "framework",
11
10
  "modern",
12
11
  "modern.js"
13
12
  ],
14
- "version": "1.13.0",
13
+ "version": "1.13.3",
15
14
  "jsnext:source": "./src/index.ts",
16
15
  "types": "./dist/index.d.ts",
17
16
  "main": "./dist/index.js",
@@ -40,12 +39,12 @@
40
39
  },
41
40
  "dependencies": {
42
41
  "@modern-js/plugin": "^1.4.2",
43
- "@modern-js/utils": "^1.7.12",
42
+ "@modern-js/utils": "^1.8.1",
44
43
  "@modern-js/node-bundle-require": "^1.3.7"
45
44
  },
46
45
  "devDependencies": {
47
46
  "@jest/types": "^27.0.6",
48
- "@modern-js/types": "1.6.0",
47
+ "@modern-js/types": "1.6.2",
49
48
  "@scripts/build": "0.0.0",
50
49
  "@scripts/jest-config": "0.0.0",
51
50
  "@types/babel__code-frame": "^7.0.3",
@@ -53,8 +52,6 @@
53
52
  "@types/jest": "^27",
54
53
  "@types/less": "^3.0.3",
55
54
  "@types/node": "^14",
56
- "@types/react": "^17",
57
- "@types/react-dom": "^17",
58
55
  "autoprefixer": "^10.3.1",
59
56
  "btsm": "2.2.2",
60
57
  "jest": "^27",