@modern-js/module-tools 1.6.2 → 1.7.1
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 +55 -0
- package/dist/js/modern/features/build/bundle/runRollup.js +1 -1
- package/dist/js/modern/features/build/bundle/runSpeedy.js +2 -1
- package/dist/js/modern/features/build/normalize.js +1 -0
- package/dist/js/modern/hooks/index.js +5 -1
- package/dist/js/modern/index.js +15 -3
- package/dist/js/modern/schema/build-config.js +4 -2
- package/dist/js/modern/utils/language.js +1 -1
- package/dist/js/node/features/build/bundle/runRollup.js +1 -1
- package/dist/js/node/features/build/bundle/runSpeedy.js +2 -1
- package/dist/js/node/features/build/normalize.js +1 -0
- package/dist/js/node/hooks/index.js +8 -1
- package/dist/js/node/index.js +14 -3
- package/dist/js/node/schema/build-config.js +4 -2
- package/dist/js/node/utils/language.js +1 -1
- package/dist/types/hooks/index.d.ts +2 -0
- package/dist/types/schema/build-config.d.ts +2 -0
- package/dist/types/schema/index.d.ts +2 -0
- package/dist/types/schema/output.d.ts +2 -0
- package/package.json +10 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,60 @@
|
|
|
1
1
|
# @modern-js/module-tools
|
|
2
2
|
|
|
3
|
+
## 1.7.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b2f90f8: feat: add addRuntimeExports hooks for module-tools
|
|
8
|
+
feat: 为 module-tools 添加 addRuntimeExports 钩子
|
|
9
|
+
|
|
10
|
+
## 1.7.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- 33cebd2: chore(plugin-i18n): merge `@modern-js/i18n-cli-language-detector` to `@modern-js/plugin-i18n`
|
|
15
|
+
|
|
16
|
+
chore(plugin-i18n): 合并 `@modern-js/i18n-cli-language-detector` 包到 `@modern-js/plugin-i18n` 包作为子路径
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- 307ce36: fix: ignore cjs and mjs in d.ts bundle
|
|
21
|
+
|
|
22
|
+
fix: 对 d.ts 做 bundle 时忽略 cjs 和 mjs 资源
|
|
23
|
+
|
|
24
|
+
- f6681f2: feat: remove @modern-js/plugin-analyze plugin
|
|
25
|
+
feat: 移除 @modern-js/plugin-analyze 插件
|
|
26
|
+
- Updated dependencies [33cebd2]
|
|
27
|
+
- Updated dependencies [33cebd2]
|
|
28
|
+
- Updated dependencies [33cebd2]
|
|
29
|
+
- Updated dependencies [2e8ea92]
|
|
30
|
+
- Updated dependencies [74e74ee]
|
|
31
|
+
- Updated dependencies [33cebd2]
|
|
32
|
+
- @modern-js/core@1.13.0
|
|
33
|
+
- @modern-js/plugin-changeset@1.4.0
|
|
34
|
+
- @modern-js/plugin-i18n@1.3.0
|
|
35
|
+
- @modern-js/new-action@1.3.12
|
|
36
|
+
- @modern-js/babel-preset-module@1.4.0
|
|
37
|
+
- @modern-js/css-config@1.2.8
|
|
38
|
+
- @modern-js/plugin-jarvis@1.2.14
|
|
39
|
+
- @modern-js/utils@1.7.12
|
|
40
|
+
|
|
41
|
+
## 1.6.3
|
|
42
|
+
|
|
43
|
+
### Patch Changes
|
|
44
|
+
|
|
45
|
+
- eeb9273: Add `additionalProperties: false` to the schema of 'output.buildConfig'
|
|
46
|
+
|
|
47
|
+
为 'output.buildConfig' 的 schema 增加 `additionalProperties: false` 配置
|
|
48
|
+
|
|
49
|
+
- Updated dependencies [dc4676b]
|
|
50
|
+
- Updated dependencies [5b7a5a7]
|
|
51
|
+
- Updated dependencies [4a7f2a2]
|
|
52
|
+
- @modern-js/utils@1.7.12
|
|
53
|
+
- @modern-js/plugin@1.4.2
|
|
54
|
+
- @modern-js/css-config@1.2.8
|
|
55
|
+
- @modern-js/core@1.12.4
|
|
56
|
+
- @modern-js/plugin-analyze@1.4.7
|
|
57
|
+
|
|
3
58
|
## 1.6.2
|
|
4
59
|
|
|
5
60
|
### Patch Changes
|
|
@@ -132,7 +132,8 @@ export const runSpeedy = async (api, config) => {
|
|
|
132
132
|
};
|
|
133
133
|
|
|
134
134
|
const plugins = target === 'es5' ? [es5InputPlugin()] : [];
|
|
135
|
-
plugins.push(watchPlugin());
|
|
135
|
+
plugins.push(watchPlugin()); // TODO: add speedy plugin about react
|
|
136
|
+
|
|
136
137
|
const internalSpeedyConfig = {
|
|
137
138
|
command: 'build',
|
|
138
139
|
mode: 'production',
|
|
@@ -144,6 +144,7 @@ export const getFinalTsconfig = (config, buildFeatOption) => {
|
|
|
144
144
|
// Since tsconfig configuration has default values,
|
|
145
145
|
// compare the two to see if the user is configured with cli tsconfig
|
|
146
146
|
if (buildFeatOption.tsconfigName !== cliTsConfigDefaultValue) {
|
|
147
|
+
// TODO: transform tsconfig to absPath
|
|
147
148
|
return buildFeatOption.tsconfigName;
|
|
148
149
|
}
|
|
149
150
|
|
|
@@ -4,6 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
4
4
|
|
|
5
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
6
|
|
|
7
|
+
import { createAsyncWaterfall } from '@modern-js/plugin';
|
|
7
8
|
import { buildHooks, lifecycle as buildLifeCycle } from "./build";
|
|
8
9
|
import { devHooks, lifecycle as devLifeCycle } from "./dev";
|
|
9
10
|
export { buildLifeCycle, devLifeCycle };
|
|
@@ -11,4 +12,7 @@ export const lifecycle = () => {
|
|
|
11
12
|
devLifeCycle();
|
|
12
13
|
buildLifeCycle();
|
|
13
14
|
};
|
|
14
|
-
export const
|
|
15
|
+
export const addRuntimeExports = createAsyncWaterfall();
|
|
16
|
+
export const hooks = _objectSpread(_objectSpread(_objectSpread({}, buildHooks), devHooks), {}, {
|
|
17
|
+
addRuntimeExports
|
|
18
|
+
});
|
package/dist/js/modern/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Import } from '@modern-js/utils';
|
|
1
|
+
import { Import, fs } from '@modern-js/utils';
|
|
2
2
|
import ChangesetPlugin from '@modern-js/plugin-changeset';
|
|
3
|
-
import AnalyzePlugin from '@modern-js/plugin-analyze';
|
|
4
3
|
import LintPlugin from '@modern-js/plugin-jarvis';
|
|
5
4
|
import { hooks } from "./hooks";
|
|
6
5
|
export * from "./types";
|
|
@@ -14,13 +13,26 @@ export default (() => ({
|
|
|
14
13
|
name: '@modern-js/module-tools',
|
|
15
14
|
post: ['@modern-js/plugin-analyze', '@modern-js/plugin-changeset'],
|
|
16
15
|
registerHook: hooks,
|
|
17
|
-
usePlugins:
|
|
16
|
+
usePlugins: isBuildMode ? [] : [ChangesetPlugin(), LintPlugin()],
|
|
18
17
|
setup: api => {
|
|
19
18
|
const locale = lang.getLocaleLanguage();
|
|
20
19
|
local.i18n.changeLanguage({
|
|
21
20
|
locale
|
|
22
21
|
});
|
|
23
22
|
return {
|
|
23
|
+
// copy from @modern-js/plugin-analyze/src/index.ts
|
|
24
|
+
async prepare() {
|
|
25
|
+
const appContext = api.useAppContext();
|
|
26
|
+
const hookRunners = api.useHookRunners();
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
fs.emptydirSync(appContext.internalDirectory);
|
|
30
|
+
} catch (_unused) {// FIXME:
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
await hookRunners.addRuntimeExports();
|
|
34
|
+
},
|
|
35
|
+
|
|
24
36
|
validateSchema() {
|
|
25
37
|
return schema.addSchema();
|
|
26
38
|
},
|
|
@@ -95,12 +95,14 @@ export const buildSchema = [{
|
|
|
95
95
|
then: {
|
|
96
96
|
items: [{
|
|
97
97
|
type: 'object',
|
|
98
|
-
properties
|
|
98
|
+
properties,
|
|
99
|
+
additionalProperties: false
|
|
99
100
|
}]
|
|
100
101
|
},
|
|
101
102
|
else: {
|
|
102
103
|
type: 'object',
|
|
103
|
-
properties
|
|
104
|
+
properties,
|
|
105
|
+
additionalProperties: false
|
|
104
106
|
}
|
|
105
107
|
}
|
|
106
108
|
}, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Import } from '@modern-js/utils';
|
|
2
|
-
const i18n = Import.lazy('@modern-js/i18n
|
|
2
|
+
const i18n = Import.lazy('@modern-js/plugin-i18n/language-detector', require);
|
|
3
3
|
export function getLocaleLanguage() {
|
|
4
4
|
const detector = new i18n.I18CLILanguageDetector();
|
|
5
5
|
return detector.detect();
|
|
@@ -154,7 +154,8 @@ const runSpeedy = async (api, config) => {
|
|
|
154
154
|
};
|
|
155
155
|
|
|
156
156
|
const plugins = target === 'es5' ? [(0, _speedyPluginEs.es5InputPlugin)()] : [];
|
|
157
|
-
plugins.push(watchPlugin());
|
|
157
|
+
plugins.push(watchPlugin()); // TODO: add speedy plugin about react
|
|
158
|
+
|
|
158
159
|
const internalSpeedyConfig = {
|
|
159
160
|
command: 'build',
|
|
160
161
|
mode: 'production',
|
|
@@ -158,6 +158,7 @@ const getFinalTsconfig = (config, buildFeatOption) => {
|
|
|
158
158
|
// Since tsconfig configuration has default values,
|
|
159
159
|
// compare the two to see if the user is configured with cli tsconfig
|
|
160
160
|
if (buildFeatOption.tsconfigName !== _constants.cliTsConfigDefaultValue) {
|
|
161
|
+
// TODO: transform tsconfig to absPath
|
|
161
162
|
return buildFeatOption.tsconfigName;
|
|
162
163
|
}
|
|
163
164
|
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.addRuntimeExports = void 0;
|
|
6
7
|
Object.defineProperty(exports, "buildLifeCycle", {
|
|
7
8
|
enumerable: true,
|
|
8
9
|
get: function () {
|
|
@@ -17,6 +18,8 @@ Object.defineProperty(exports, "devLifeCycle", {
|
|
|
17
18
|
});
|
|
18
19
|
exports.lifecycle = exports.hooks = void 0;
|
|
19
20
|
|
|
21
|
+
var _plugin = require("@modern-js/plugin");
|
|
22
|
+
|
|
20
23
|
var _build = require("./build");
|
|
21
24
|
|
|
22
25
|
var _dev = require("./dev");
|
|
@@ -33,7 +36,11 @@ const lifecycle = () => {
|
|
|
33
36
|
};
|
|
34
37
|
|
|
35
38
|
exports.lifecycle = lifecycle;
|
|
39
|
+
const addRuntimeExports = (0, _plugin.createAsyncWaterfall)();
|
|
40
|
+
exports.addRuntimeExports = addRuntimeExports;
|
|
36
41
|
|
|
37
|
-
const hooks = _objectSpread(_objectSpread({}, _build.buildHooks), _dev.devHooks)
|
|
42
|
+
const hooks = _objectSpread(_objectSpread(_objectSpread({}, _build.buildHooks), _dev.devHooks), {}, {
|
|
43
|
+
addRuntimeExports
|
|
44
|
+
});
|
|
38
45
|
|
|
39
46
|
exports.hooks = hooks;
|
package/dist/js/node/index.js
CHANGED
|
@@ -18,8 +18,6 @@ var _utils = require("@modern-js/utils");
|
|
|
18
18
|
|
|
19
19
|
var _pluginChangeset = _interopRequireDefault(require("@modern-js/plugin-changeset"));
|
|
20
20
|
|
|
21
|
-
var _pluginAnalyze = _interopRequireDefault(require("@modern-js/plugin-analyze"));
|
|
22
|
-
|
|
23
21
|
var _pluginJarvis = _interopRequireDefault(require("@modern-js/plugin-jarvis"));
|
|
24
22
|
|
|
25
23
|
var _hooks = require("./hooks");
|
|
@@ -56,13 +54,26 @@ var _default = () => ({
|
|
|
56
54
|
name: '@modern-js/module-tools',
|
|
57
55
|
post: ['@modern-js/plugin-analyze', '@modern-js/plugin-changeset'],
|
|
58
56
|
registerHook: _hooks.hooks,
|
|
59
|
-
usePlugins:
|
|
57
|
+
usePlugins: isBuildMode ? [] : [(0, _pluginChangeset.default)(), (0, _pluginJarvis.default)()],
|
|
60
58
|
setup: api => {
|
|
61
59
|
const locale = lang.getLocaleLanguage();
|
|
62
60
|
local.i18n.changeLanguage({
|
|
63
61
|
locale
|
|
64
62
|
});
|
|
65
63
|
return {
|
|
64
|
+
// copy from @modern-js/plugin-analyze/src/index.ts
|
|
65
|
+
async prepare() {
|
|
66
|
+
const appContext = api.useAppContext();
|
|
67
|
+
const hookRunners = api.useHookRunners();
|
|
68
|
+
|
|
69
|
+
try {
|
|
70
|
+
_utils.fs.emptydirSync(appContext.internalDirectory);
|
|
71
|
+
} catch (_unused) {// FIXME:
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
await hookRunners.addRuntimeExports();
|
|
75
|
+
},
|
|
76
|
+
|
|
66
77
|
validateSchema() {
|
|
67
78
|
return schema.addSchema();
|
|
68
79
|
},
|
|
@@ -103,12 +103,14 @@ const buildSchema = [{
|
|
|
103
103
|
then: {
|
|
104
104
|
items: [{
|
|
105
105
|
type: 'object',
|
|
106
|
-
properties
|
|
106
|
+
properties,
|
|
107
|
+
additionalProperties: false
|
|
107
108
|
}]
|
|
108
109
|
},
|
|
109
110
|
else: {
|
|
110
111
|
type: 'object',
|
|
111
|
-
properties
|
|
112
|
+
properties,
|
|
113
|
+
additionalProperties: false
|
|
112
114
|
}
|
|
113
115
|
}
|
|
114
116
|
}, {
|
|
@@ -7,7 +7,7 @@ exports.getLocaleLanguage = getLocaleLanguage;
|
|
|
7
7
|
|
|
8
8
|
var _utils = require("@modern-js/utils");
|
|
9
9
|
|
|
10
|
-
const i18n = _utils.Import.lazy('@modern-js/i18n
|
|
10
|
+
const i18n = _utils.Import.lazy('@modern-js/plugin-i18n/language-detector', require);
|
|
11
11
|
|
|
12
12
|
function getLocaleLanguage() {
|
|
13
13
|
const detector = new i18n.I18CLILanguageDetector();
|
|
@@ -2,7 +2,9 @@ import { lifecycle as buildLifeCycle } from './build';
|
|
|
2
2
|
import { lifecycle as devLifeCycle } from './dev';
|
|
3
3
|
export { buildLifeCycle, devLifeCycle };
|
|
4
4
|
export declare const lifecycle: () => void;
|
|
5
|
+
export declare const addRuntimeExports: import("@modern-js/plugin").AsyncWaterfall<void>;
|
|
5
6
|
export declare const hooks: {
|
|
7
|
+
addRuntimeExports: import("@modern-js/plugin").AsyncWaterfall<void>;
|
|
6
8
|
moduleToolsMenu: import("@modern-js/plugin").ParallelWorkflow<undefined, {
|
|
7
9
|
name: string;
|
|
8
10
|
value: string;
|
|
@@ -94,6 +94,7 @@ export declare const buildSchema: ({
|
|
|
94
94
|
type: string;
|
|
95
95
|
};
|
|
96
96
|
};
|
|
97
|
+
additionalProperties: boolean;
|
|
97
98
|
}[];
|
|
98
99
|
};
|
|
99
100
|
else: {
|
|
@@ -183,6 +184,7 @@ export declare const buildSchema: ({
|
|
|
183
184
|
type: string;
|
|
184
185
|
};
|
|
185
186
|
};
|
|
187
|
+
additionalProperties: boolean;
|
|
186
188
|
};
|
|
187
189
|
enum?: undefined;
|
|
188
190
|
};
|
|
@@ -97,6 +97,7 @@ export declare const addSchema: () => ({
|
|
|
97
97
|
type: string;
|
|
98
98
|
};
|
|
99
99
|
};
|
|
100
|
+
additionalProperties: boolean;
|
|
100
101
|
}[];
|
|
101
102
|
};
|
|
102
103
|
else: {
|
|
@@ -186,6 +187,7 @@ export declare const addSchema: () => ({
|
|
|
186
187
|
type: string;
|
|
187
188
|
};
|
|
188
189
|
};
|
|
190
|
+
additionalProperties: boolean;
|
|
189
191
|
};
|
|
190
192
|
enum?: undefined;
|
|
191
193
|
};
|
|
@@ -92,6 +92,7 @@ export declare const outputSchema: ({
|
|
|
92
92
|
type: string;
|
|
93
93
|
};
|
|
94
94
|
};
|
|
95
|
+
additionalProperties: boolean;
|
|
95
96
|
}[];
|
|
96
97
|
};
|
|
97
98
|
else: {
|
|
@@ -181,6 +182,7 @@ export declare const outputSchema: ({
|
|
|
181
182
|
type: string;
|
|
182
183
|
};
|
|
183
184
|
};
|
|
185
|
+
additionalProperties: boolean;
|
|
184
186
|
};
|
|
185
187
|
enum?: undefined;
|
|
186
188
|
};
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.
|
|
14
|
+
"version": "1.7.1",
|
|
15
15
|
"bin": {
|
|
16
16
|
"modern": "./bin/modern.js"
|
|
17
17
|
},
|
|
@@ -55,18 +55,16 @@
|
|
|
55
55
|
"@babel/traverse": "^7.18.0",
|
|
56
56
|
"@babel/types": "^7.18.0",
|
|
57
57
|
"@modern-js/babel-compiler": "^1.2.6",
|
|
58
|
-
"@modern-js/babel-preset-module": "^1.
|
|
59
|
-
"@modern-js/core": "^1.
|
|
60
|
-
"@modern-js/css-config": "^1.2.
|
|
61
|
-
"@modern-js/
|
|
62
|
-
"@modern-js/
|
|
63
|
-
"@modern-js/plugin": "^1.4.0",
|
|
64
|
-
"@modern-js/plugin-
|
|
65
|
-
"@modern-js/plugin-changeset": "^1.3.1",
|
|
66
|
-
"@modern-js/plugin-i18n": "^1.2.7",
|
|
58
|
+
"@modern-js/babel-preset-module": "^1.4.0",
|
|
59
|
+
"@modern-js/core": "^1.13.0",
|
|
60
|
+
"@modern-js/css-config": "^1.2.8",
|
|
61
|
+
"@modern-js/new-action": "^1.3.12",
|
|
62
|
+
"@modern-js/plugin": "^1.4.2",
|
|
63
|
+
"@modern-js/plugin-changeset": "^1.4.0",
|
|
64
|
+
"@modern-js/plugin-i18n": "^1.3.0",
|
|
67
65
|
"@modern-js/plugin-jarvis": "^1.2.14",
|
|
68
|
-
"@modern-js/style-compiler": "^1.2.
|
|
69
|
-
"@modern-js/utils": "^1.7.
|
|
66
|
+
"@modern-js/style-compiler": "^1.2.13",
|
|
67
|
+
"@modern-js/utils": "^1.7.12",
|
|
70
68
|
"@rollup/plugin-json": "~4.1.0",
|
|
71
69
|
"@speedy-js/speedy-types": "0.13.2-alpha.3",
|
|
72
70
|
"@speedy-js/speedy-core": "0.13.2-alpha.3",
|