@modern-js/module-tools 1.5.4 → 1.5.7
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 +50 -0
- package/dist/js/modern/commands/build.js +4 -2
- package/dist/js/modern/features/build/build.js +34 -17
- package/dist/js/modern/utils/babel.js +2 -2
- package/dist/js/node/commands/build.js +4 -2
- package/dist/js/node/features/build/build.js +34 -17
- package/dist/js/node/utils/babel.js +1 -1
- package/dist/types/commands/build.d.ts +2 -1
- package/dist/types/types.d.ts +1 -0
- package/package.json +18 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,55 @@
|
|
|
1
1
|
# @modern-js/module-tools
|
|
2
2
|
|
|
3
|
+
## 1.5.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b7a1cea52: feat: support utils in tools.babel
|
|
8
|
+
- Updated dependencies [9377d2d9d]
|
|
9
|
+
- Updated dependencies [8e1cedd8a]
|
|
10
|
+
- Updated dependencies [8c9ad1749]
|
|
11
|
+
- Updated dependencies [b7a1cea52]
|
|
12
|
+
- Updated dependencies [1ac68424f]
|
|
13
|
+
- Updated dependencies [3dfee700c]
|
|
14
|
+
- @modern-js/core@1.12.0
|
|
15
|
+
- @modern-js/css-config@1.2.7
|
|
16
|
+
- @modern-js/style-compiler@1.2.10
|
|
17
|
+
- @modern-js/utils@1.7.7
|
|
18
|
+
- @modern-js/babel-preset-module@1.3.8
|
|
19
|
+
- @modern-js/plugin@1.3.7
|
|
20
|
+
- @modern-js/plugin-analyze@1.4.6
|
|
21
|
+
- @modern-js/plugin-changeset@1.2.8
|
|
22
|
+
|
|
23
|
+
## 1.5.6
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- a1198d509: feat: bump babel 7.18.0
|
|
28
|
+
- Updated dependencies [8d508c6ed]
|
|
29
|
+
- Updated dependencies [0eff2473c]
|
|
30
|
+
- Updated dependencies [a1198d509]
|
|
31
|
+
- Updated dependencies [f25d6a62e]
|
|
32
|
+
- Updated dependencies [a18926bbd]
|
|
33
|
+
- Updated dependencies [c7e38b4e6]
|
|
34
|
+
- Updated dependencies [8f7c0f898]
|
|
35
|
+
- @modern-js/core@1.11.2
|
|
36
|
+
- @modern-js/babel-preset-module@1.3.7
|
|
37
|
+
- @modern-js/i18n-cli-language-detector@1.2.4
|
|
38
|
+
- @modern-js/plugin-analyze@1.4.6
|
|
39
|
+
- @modern-js/plugin-changeset@1.2.8
|
|
40
|
+
- @modern-js/plugin-i18n@1.2.7
|
|
41
|
+
- @modern-js/new-action@1.3.10
|
|
42
|
+
- @modern-js/babel-compiler@1.2.6
|
|
43
|
+
- @modern-js/style-compiler@1.2.9
|
|
44
|
+
- @modern-js/plugin@1.3.6
|
|
45
|
+
- @modern-js/css-config@1.2.6
|
|
46
|
+
|
|
47
|
+
## 1.5.5
|
|
48
|
+
|
|
49
|
+
### Patch Changes
|
|
50
|
+
|
|
51
|
+
- d6e1e8917: support --style-only param
|
|
52
|
+
|
|
3
53
|
## 1.5.4
|
|
4
54
|
|
|
5
55
|
### Patch Changes
|
|
@@ -8,7 +8,8 @@ export const build = async (api, {
|
|
|
8
8
|
tsconfig: tsconfigName,
|
|
9
9
|
tsc,
|
|
10
10
|
clear: _clear = true,
|
|
11
|
-
platform
|
|
11
|
+
platform,
|
|
12
|
+
styleOnly
|
|
12
13
|
}) => {
|
|
13
14
|
const {
|
|
14
15
|
appDirectory
|
|
@@ -31,7 +32,8 @@ export const build = async (api, {
|
|
|
31
32
|
sourceDir: 'src',
|
|
32
33
|
tsconfigName,
|
|
33
34
|
enableTscCompiler,
|
|
34
|
-
clear: _clear
|
|
35
|
+
clear: _clear,
|
|
36
|
+
styleOnly
|
|
35
37
|
}, modernConfig);
|
|
36
38
|
process.on('SIGBREAK', () => {
|
|
37
39
|
console.info('exit');
|
|
@@ -8,7 +8,8 @@ const constants = Import.lazy('./constants', require);
|
|
|
8
8
|
export const buildSourceCode = async (api, config, _) => {
|
|
9
9
|
const {
|
|
10
10
|
sourceDir,
|
|
11
|
-
enableTscCompiler
|
|
11
|
+
enableTscCompiler,
|
|
12
|
+
styleOnly
|
|
12
13
|
} = config;
|
|
13
14
|
const {
|
|
14
15
|
appDirectory
|
|
@@ -29,20 +30,33 @@ export const buildSourceCode = async (api, config, _) => {
|
|
|
29
30
|
title: 'Copy Log:'
|
|
30
31
|
});
|
|
31
32
|
const initCodeMapper = utils.getCodeInitMapper(api, config);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
33
|
+
let taskMapper = [];
|
|
34
|
+
|
|
35
|
+
if (styleOnly) {
|
|
36
|
+
taskMapper = [{
|
|
37
|
+
logger: styleLog,
|
|
38
|
+
taskPath: require.resolve("../../tasks/build-style")
|
|
39
|
+
}, {
|
|
40
|
+
logger: copyLog,
|
|
41
|
+
taskPath: require.resolve("../../tasks/copy-assets")
|
|
42
|
+
}];
|
|
43
|
+
} else {
|
|
44
|
+
taskMapper = [...utils.getCodeMapper(api, {
|
|
45
|
+
logger: codeLog,
|
|
46
|
+
taskPath: require.resolve("../../tasks/build-source-code"),
|
|
47
|
+
config,
|
|
48
|
+
willCompilerDirOrFile: sourceDir,
|
|
49
|
+
initMapper: initCodeMapper,
|
|
50
|
+
srcRootDir
|
|
51
|
+
}), ...(enableTscCompiler ? utils.getDtsMapper(api, config, dtsLog) : []), {
|
|
52
|
+
logger: styleLog,
|
|
53
|
+
taskPath: require.resolve("../../tasks/build-style")
|
|
54
|
+
}, {
|
|
55
|
+
logger: copyLog,
|
|
56
|
+
taskPath: require.resolve("../../tasks/copy-assets")
|
|
57
|
+
}];
|
|
58
|
+
}
|
|
59
|
+
|
|
46
60
|
lm.showCompiling();
|
|
47
61
|
await pMap(taskMapper, async ({
|
|
48
62
|
logger,
|
|
@@ -88,8 +102,11 @@ export const buildSourceCode = async (api, config, _) => {
|
|
|
88
102
|
concurrency
|
|
89
103
|
});
|
|
90
104
|
lm.disappearCompiling();
|
|
91
|
-
|
|
92
|
-
|
|
105
|
+
|
|
106
|
+
if (!styleOnly) {
|
|
107
|
+
enableTscCompiler && console.info(dtsLog.value);
|
|
108
|
+
console.info(codeLog.value);
|
|
109
|
+
}
|
|
93
110
|
|
|
94
111
|
if (styleLog.hasMessages()) {
|
|
95
112
|
console.info(styleLog.value);
|
|
@@ -4,7 +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 { getBabelConfig } from '@modern-js/babel-preset-module';
|
|
7
|
+
import { getBabelConfig, applyUserBabelConfig } from '@modern-js/babel-preset-module';
|
|
8
8
|
import { applyOptionsChain, getAlias, isUseSSRBundle } from '@modern-js/utils';
|
|
9
9
|
export const getFinalAlias = (modernConfig, option) => {
|
|
10
10
|
const aliasConfig = getAlias(modernConfig.source.alias, option); // 排除内部别名,因为不需要处理
|
|
@@ -73,5 +73,5 @@ export const resolveBabelConfig = (appDirectory, modernConfig, option) => {
|
|
|
73
73
|
|
|
74
74
|
internalBabelConfig.compact = false;
|
|
75
75
|
const userBabelConfig = modernConfig.tools.babel;
|
|
76
|
-
return
|
|
76
|
+
return applyUserBabelConfig(internalBabelConfig, userBabelConfig);
|
|
77
77
|
};
|
|
@@ -24,7 +24,8 @@ const build = async (api, {
|
|
|
24
24
|
tsconfig: tsconfigName,
|
|
25
25
|
tsc,
|
|
26
26
|
clear: _clear = true,
|
|
27
|
-
platform
|
|
27
|
+
platform,
|
|
28
|
+
styleOnly
|
|
28
29
|
}) => {
|
|
29
30
|
const {
|
|
30
31
|
appDirectory
|
|
@@ -49,7 +50,8 @@ const build = async (api, {
|
|
|
49
50
|
sourceDir: 'src',
|
|
50
51
|
tsconfigName,
|
|
51
52
|
enableTscCompiler,
|
|
52
|
-
clear: _clear
|
|
53
|
+
clear: _clear,
|
|
54
|
+
styleOnly
|
|
53
55
|
}, modernConfig);
|
|
54
56
|
process.on('SIGBREAK', () => {
|
|
55
57
|
console.info('exit');
|
|
@@ -26,7 +26,8 @@ const constants = _utils.Import.lazy('./constants', require);
|
|
|
26
26
|
const buildSourceCode = async (api, config, _) => {
|
|
27
27
|
const {
|
|
28
28
|
sourceDir,
|
|
29
|
-
enableTscCompiler
|
|
29
|
+
enableTscCompiler,
|
|
30
|
+
styleOnly
|
|
30
31
|
} = config;
|
|
31
32
|
const {
|
|
32
33
|
appDirectory
|
|
@@ -47,20 +48,33 @@ const buildSourceCode = async (api, config, _) => {
|
|
|
47
48
|
title: 'Copy Log:'
|
|
48
49
|
});
|
|
49
50
|
const initCodeMapper = utils.getCodeInitMapper(api, config);
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
51
|
+
let taskMapper = [];
|
|
52
|
+
|
|
53
|
+
if (styleOnly) {
|
|
54
|
+
taskMapper = [{
|
|
55
|
+
logger: styleLog,
|
|
56
|
+
taskPath: require.resolve("../../tasks/build-style")
|
|
57
|
+
}, {
|
|
58
|
+
logger: copyLog,
|
|
59
|
+
taskPath: require.resolve("../../tasks/copy-assets")
|
|
60
|
+
}];
|
|
61
|
+
} else {
|
|
62
|
+
taskMapper = [...utils.getCodeMapper(api, {
|
|
63
|
+
logger: codeLog,
|
|
64
|
+
taskPath: require.resolve("../../tasks/build-source-code"),
|
|
65
|
+
config,
|
|
66
|
+
willCompilerDirOrFile: sourceDir,
|
|
67
|
+
initMapper: initCodeMapper,
|
|
68
|
+
srcRootDir
|
|
69
|
+
}), ...(enableTscCompiler ? utils.getDtsMapper(api, config, dtsLog) : []), {
|
|
70
|
+
logger: styleLog,
|
|
71
|
+
taskPath: require.resolve("../../tasks/build-style")
|
|
72
|
+
}, {
|
|
73
|
+
logger: copyLog,
|
|
74
|
+
taskPath: require.resolve("../../tasks/copy-assets")
|
|
75
|
+
}];
|
|
76
|
+
}
|
|
77
|
+
|
|
64
78
|
lm.showCompiling();
|
|
65
79
|
await pMap(taskMapper, async ({
|
|
66
80
|
logger,
|
|
@@ -106,8 +120,11 @@ const buildSourceCode = async (api, config, _) => {
|
|
|
106
120
|
concurrency
|
|
107
121
|
});
|
|
108
122
|
lm.disappearCompiling();
|
|
109
|
-
|
|
110
|
-
|
|
123
|
+
|
|
124
|
+
if (!styleOnly) {
|
|
125
|
+
enableTscCompiler && console.info(dtsLog.value);
|
|
126
|
+
console.info(codeLog.value);
|
|
127
|
+
}
|
|
111
128
|
|
|
112
129
|
if (styleLog.hasMessages()) {
|
|
113
130
|
console.info(styleLog.value);
|
|
@@ -85,7 +85,7 @@ const resolveBabelConfig = (appDirectory, modernConfig, option) => {
|
|
|
85
85
|
|
|
86
86
|
internalBabelConfig.compact = false;
|
|
87
87
|
const userBabelConfig = modernConfig.tools.babel;
|
|
88
|
-
return (0,
|
|
88
|
+
return (0, _babelPresetModule.applyUserBabelConfig)(internalBabelConfig, userBabelConfig);
|
|
89
89
|
};
|
|
90
90
|
|
|
91
91
|
exports.resolveBabelConfig = resolveBabelConfig;
|
package/dist/types/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.5.
|
|
14
|
+
"version": "1.5.7",
|
|
15
15
|
"bin": {
|
|
16
16
|
"modern": "./bin/modern.js"
|
|
17
17
|
},
|
|
@@ -49,23 +49,23 @@
|
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@babel/generator": "^7.
|
|
53
|
-
"@babel/parser": "^7.
|
|
54
|
-
"@babel/runtime": "^7",
|
|
55
|
-
"@babel/traverse": "^7.
|
|
56
|
-
"@babel/types": "^7.
|
|
57
|
-
"@modern-js/babel-compiler": "^1.2.
|
|
58
|
-
"@modern-js/babel-preset-module": "^1.3.
|
|
59
|
-
"@modern-js/core": "^1.
|
|
60
|
-
"@modern-js/css-config": "^1.2.
|
|
61
|
-
"@modern-js/i18n-cli-language-detector": "^1.2.
|
|
62
|
-
"@modern-js/new-action": "^1.3.
|
|
63
|
-
"@modern-js/plugin": "^1.3.
|
|
64
|
-
"@modern-js/plugin-analyze": "^1.4.
|
|
65
|
-
"@modern-js/plugin-changeset": "^1.2.
|
|
66
|
-
"@modern-js/plugin-i18n": "^1.2.
|
|
67
|
-
"@modern-js/style-compiler": "^1.2.
|
|
68
|
-
"@modern-js/utils": "^1.7.
|
|
52
|
+
"@babel/generator": "^7.18.0",
|
|
53
|
+
"@babel/parser": "^7.18.0",
|
|
54
|
+
"@babel/runtime": "^7.18.0",
|
|
55
|
+
"@babel/traverse": "^7.18.0",
|
|
56
|
+
"@babel/types": "^7.18.0",
|
|
57
|
+
"@modern-js/babel-compiler": "^1.2.6",
|
|
58
|
+
"@modern-js/babel-preset-module": "^1.3.8",
|
|
59
|
+
"@modern-js/core": "^1.12.0",
|
|
60
|
+
"@modern-js/css-config": "^1.2.7",
|
|
61
|
+
"@modern-js/i18n-cli-language-detector": "^1.2.4",
|
|
62
|
+
"@modern-js/new-action": "^1.3.10",
|
|
63
|
+
"@modern-js/plugin": "^1.3.7",
|
|
64
|
+
"@modern-js/plugin-analyze": "^1.4.6",
|
|
65
|
+
"@modern-js/plugin-changeset": "^1.2.8",
|
|
66
|
+
"@modern-js/plugin-i18n": "^1.2.7",
|
|
67
|
+
"@modern-js/style-compiler": "^1.2.10",
|
|
68
|
+
"@modern-js/utils": "^1.7.7",
|
|
69
69
|
"normalize-path": "^3.0.0",
|
|
70
70
|
"p-map": "^4",
|
|
71
71
|
"process.argv": "^0.6.0"
|