@modern-js/module-tools 1.6.3 → 1.15.0
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 +59 -0
- package/dist/js/modern/features/build/bundle/runRollup.js +1 -1
- package/dist/js/modern/hooks/index.js +5 -1
- package/dist/js/modern/index.js +16 -4
- package/dist/js/modern/utils/language.js +1 -1
- package/dist/js/node/features/build/bundle/runRollup.js +1 -1
- package/dist/js/node/hooks/index.js +8 -1
- package/dist/js/node/index.js +15 -4
- package/dist/js/node/utils/language.js +1 -1
- package/dist/types/hooks/index.d.ts +2 -0
- package/package.json +14 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,64 @@
|
|
|
1
1
|
# @modern-js/module-tools
|
|
2
2
|
|
|
3
|
+
## 1.15.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [8658a78]
|
|
8
|
+
- Updated dependencies [05d4a4f]
|
|
9
|
+
- Updated dependencies [ad05af9]
|
|
10
|
+
- Updated dependencies [5d53d1c]
|
|
11
|
+
- Updated dependencies [37cd159]
|
|
12
|
+
- @modern-js/utils@1.15.0
|
|
13
|
+
- @modern-js/new-action@1.15.0
|
|
14
|
+
- @modern-js/babel-preset-module@1.15.0
|
|
15
|
+
- @modern-js/core@1.15.0
|
|
16
|
+
- @modern-js/css-config@1.15.0
|
|
17
|
+
- @modern-js/plugin-changeset@1.15.0
|
|
18
|
+
- @modern-js/plugin-i18n@1.15.0
|
|
19
|
+
- @modern-js/plugin-jarvis@1.15.0
|
|
20
|
+
- @modern-js/babel-compiler@1.15.0
|
|
21
|
+
- @modern-js/style-compiler@1.15.0
|
|
22
|
+
- @modern-js/plugin@1.15.0
|
|
23
|
+
|
|
24
|
+
## 1.7.1
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- b2f90f8: feat: add addRuntimeExports hooks for module-tools
|
|
29
|
+
feat: 为 module-tools 添加 addRuntimeExports 钩子
|
|
30
|
+
|
|
31
|
+
## 1.7.0
|
|
32
|
+
|
|
33
|
+
### Minor Changes
|
|
34
|
+
|
|
35
|
+
- 33cebd2: chore(plugin-i18n): merge `@modern-js/i18n-cli-language-detector` to `@modern-js/plugin-i18n`
|
|
36
|
+
|
|
37
|
+
chore(plugin-i18n): 合并 `@modern-js/i18n-cli-language-detector` 包到 `@modern-js/plugin-i18n` 包作为子路径
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- 307ce36: fix: ignore cjs and mjs in d.ts bundle
|
|
42
|
+
|
|
43
|
+
fix: 对 d.ts 做 bundle 时忽略 cjs 和 mjs 资源
|
|
44
|
+
|
|
45
|
+
- f6681f2: feat: remove @modern-js/plugin-analyze plugin
|
|
46
|
+
feat: 移除 @modern-js/plugin-analyze 插件
|
|
47
|
+
- Updated dependencies [33cebd2]
|
|
48
|
+
- Updated dependencies [33cebd2]
|
|
49
|
+
- Updated dependencies [33cebd2]
|
|
50
|
+
- Updated dependencies [2e8ea92]
|
|
51
|
+
- Updated dependencies [74e74ee]
|
|
52
|
+
- Updated dependencies [33cebd2]
|
|
53
|
+
- @modern-js/core@1.13.0
|
|
54
|
+
- @modern-js/plugin-changeset@1.4.0
|
|
55
|
+
- @modern-js/plugin-i18n@1.3.0
|
|
56
|
+
- @modern-js/new-action@1.3.12
|
|
57
|
+
- @modern-js/babel-preset-module@1.4.0
|
|
58
|
+
- @modern-js/css-config@1.2.8
|
|
59
|
+
- @modern-js/plugin-jarvis@1.2.14
|
|
60
|
+
- @modern-js/utils@1.7.12
|
|
61
|
+
|
|
3
62
|
## 1.6.3
|
|
4
63
|
|
|
5
64
|
### Patch Changes
|
|
@@ -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";
|
|
@@ -12,15 +11,28 @@ export { defineConfig } from '@modern-js/core';
|
|
|
12
11
|
const isBuildMode = process.argv.slice(2)[0] === 'build';
|
|
13
12
|
export default (() => ({
|
|
14
13
|
name: '@modern-js/module-tools',
|
|
15
|
-
post: ['@modern-js/plugin-
|
|
14
|
+
post: ['@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/app-tools/src/analyze/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
|
},
|
|
@@ -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();
|
|
@@ -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");
|
|
@@ -54,15 +52,28 @@ const isBuildMode = process.argv.slice(2)[0] === 'build';
|
|
|
54
52
|
|
|
55
53
|
var _default = () => ({
|
|
56
54
|
name: '@modern-js/module-tools',
|
|
57
|
-
post: ['@modern-js/plugin-
|
|
55
|
+
post: ['@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/app-tools/src/analyze/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
|
},
|
|
@@ -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;
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.
|
|
14
|
+
"version": "1.15.0",
|
|
15
15
|
"bin": {
|
|
16
16
|
"modern": "./bin/modern.js"
|
|
17
17
|
},
|
|
@@ -54,19 +54,17 @@
|
|
|
54
54
|
"@babel/runtime": "^7.18.0",
|
|
55
55
|
"@babel/traverse": "^7.18.0",
|
|
56
56
|
"@babel/types": "^7.18.0",
|
|
57
|
-
"@modern-js/babel-compiler": "
|
|
58
|
-
"@modern-js/babel-preset-module": "
|
|
59
|
-
"@modern-js/core": "
|
|
60
|
-
"@modern-js/css-config": "
|
|
61
|
-
"@modern-js/
|
|
62
|
-
"@modern-js/
|
|
63
|
-
"@modern-js/plugin": "
|
|
64
|
-
"@modern-js/plugin-
|
|
65
|
-
"@modern-js/plugin-
|
|
66
|
-
"@modern-js/
|
|
67
|
-
"@modern-js/
|
|
68
|
-
"@modern-js/style-compiler": "^1.2.13",
|
|
69
|
-
"@modern-js/utils": "^1.7.12",
|
|
57
|
+
"@modern-js/babel-compiler": "1.15.0",
|
|
58
|
+
"@modern-js/babel-preset-module": "1.15.0",
|
|
59
|
+
"@modern-js/core": "1.15.0",
|
|
60
|
+
"@modern-js/css-config": "1.15.0",
|
|
61
|
+
"@modern-js/new-action": "1.15.0",
|
|
62
|
+
"@modern-js/plugin": "1.15.0",
|
|
63
|
+
"@modern-js/plugin-changeset": "1.15.0",
|
|
64
|
+
"@modern-js/plugin-i18n": "1.15.0",
|
|
65
|
+
"@modern-js/plugin-jarvis": "1.15.0",
|
|
66
|
+
"@modern-js/style-compiler": "1.15.0",
|
|
67
|
+
"@modern-js/utils": "1.15.0",
|
|
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",
|
|
@@ -80,8 +78,8 @@
|
|
|
80
78
|
"signal-exit": "^3.0.7"
|
|
81
79
|
},
|
|
82
80
|
"devDependencies": {
|
|
83
|
-
"@scripts/build": "
|
|
84
|
-
"@scripts/jest-config": "
|
|
81
|
+
"@scripts/build": "1.15.0",
|
|
82
|
+
"@scripts/jest-config": "1.15.0",
|
|
85
83
|
"@speedy-js/speedy-types": "0.13.2-alpha.3",
|
|
86
84
|
"@types/babel__core": "^7.1.15",
|
|
87
85
|
"@types/babel__generator": "^7.6.3",
|