@modern-js/module-tools 1.0.0-rc.2 → 1.0.0-rc.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 +114 -0
- package/README.md +1 -1
- package/dist/js/modern/features/dev/index.js +1 -1
- package/dist/js/modern/tasks/build-style.js +15 -2
- package/dist/js/modern/utils/babel.js +3 -1
- package/dist/js/modern/utils/copy.js +4 -2
- package/dist/js/node/commands/index.js +4 -4
- package/dist/js/node/features/build/constants.js +1 -1
- package/dist/js/node/features/build/logger/logText.js +1 -1
- package/dist/js/node/features/build/utils.js +1 -1
- package/dist/js/node/features/dev/index.js +2 -2
- package/dist/js/node/index.js +1 -1
- package/dist/js/node/tasks/build-source-code.js +1 -1
- package/dist/js/node/tasks/build-style.js +15 -2
- package/dist/js/node/utils/babel.js +3 -1
- package/dist/js/node/utils/copy.js +4 -2
- package/dist/js/node/utils/logger.js +1 -1
- package/dist/js/node/utils/tsconfig.js +1 -1
- package/dist/js/node/utils/tspaths-transform/utils.js +1 -1
- package/dist/js/node/utils/valide.js +1 -1
- package/package.json +22 -18
- package/src/features/dev/index.ts +1 -1
- package/src/tasks/build-style.ts +13 -4
- package/src/utils/babel.ts +4 -0
- package/src/utils/copy.ts +3 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# @modern-js/module-tools
|
|
2
|
+
|
|
3
|
+
## 1.0.0-rc.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 224f7fe: fix server route match
|
|
8
|
+
- 204c626: feat: initial
|
|
9
|
+
- Updated dependencies [224f7fe]
|
|
10
|
+
- Updated dependencies [204c626]
|
|
11
|
+
- @modern-js/babel-preset-module@1.0.0-rc.7
|
|
12
|
+
- @modern-js/core@1.0.0-rc.7
|
|
13
|
+
- @modern-js/css-config@1.0.0-rc.7
|
|
14
|
+
- @modern-js/i18n-cli-language-detector@1.0.0-rc.7
|
|
15
|
+
- @modern-js/plugin-analyze@1.0.0-rc.7
|
|
16
|
+
- @modern-js/plugin-changeset@1.0.0-rc.7
|
|
17
|
+
- @modern-js/plugin-fast-refresh@1.0.0-rc.7
|
|
18
|
+
- @modern-js/plugin-i18n@1.0.0-rc.7
|
|
19
|
+
- @modern-js/new-action@1.0.0-rc.7
|
|
20
|
+
- @modern-js/babel-compiler@1.0.0-rc.7
|
|
21
|
+
- @modern-js/style-compiler@1.0.0-rc.7
|
|
22
|
+
- @modern-js/module-tools-hooks@1.0.0-rc.7
|
|
23
|
+
- @modern-js/plugin@1.0.0-rc.7
|
|
24
|
+
- @modern-js/utils@1.0.0-rc.7
|
|
25
|
+
|
|
26
|
+
## 1.0.0-rc.6
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- 224f7fe: fix server route match
|
|
31
|
+
- 204c626: feat: initial
|
|
32
|
+
- Updated dependencies [224f7fe]
|
|
33
|
+
- Updated dependencies [204c626]
|
|
34
|
+
- @modern-js/babel-preset-module@1.0.0-rc.6
|
|
35
|
+
- @modern-js/core@1.0.0-rc.6
|
|
36
|
+
- @modern-js/css-config@1.0.0-rc.6
|
|
37
|
+
- @modern-js/i18n-cli-language-detector@1.0.0-rc.6
|
|
38
|
+
- @modern-js/plugin-analyze@1.0.0-rc.6
|
|
39
|
+
- @modern-js/plugin-changeset@1.0.0-rc.6
|
|
40
|
+
- @modern-js/plugin-fast-refresh@1.0.0-rc.6
|
|
41
|
+
- @modern-js/plugin-i18n@1.0.0-rc.6
|
|
42
|
+
- @modern-js/new-action@1.0.0-rc.6
|
|
43
|
+
- @modern-js/babel-compiler@1.0.0-rc.6
|
|
44
|
+
- @modern-js/style-compiler@1.0.0-rc.6
|
|
45
|
+
- @modern-js/module-tools-hooks@1.0.0-rc.6
|
|
46
|
+
- @modern-js/plugin@1.0.0-rc.6
|
|
47
|
+
- @modern-js/utils@1.0.0-rc.6
|
|
48
|
+
|
|
49
|
+
## 1.0.0-rc.5
|
|
50
|
+
|
|
51
|
+
### Patch Changes
|
|
52
|
+
|
|
53
|
+
- 224f7fe: fix server route match
|
|
54
|
+
- 204c626: feat: initial
|
|
55
|
+
- Updated dependencies [224f7fe]
|
|
56
|
+
- Updated dependencies [204c626]
|
|
57
|
+
- @modern-js/babel-preset-module@1.0.0-rc.5
|
|
58
|
+
- @modern-js/core@1.0.0-rc.5
|
|
59
|
+
- @modern-js/css-config@1.0.0-rc.5
|
|
60
|
+
- @modern-js/i18n-cli-language-detector@1.0.0-rc.5
|
|
61
|
+
- @modern-js/plugin-analyze@1.0.0-rc.5
|
|
62
|
+
- @modern-js/plugin-changeset@1.0.0-rc.5
|
|
63
|
+
- @modern-js/plugin-fast-refresh@1.0.0-rc.5
|
|
64
|
+
- @modern-js/plugin-i18n@1.0.0-rc.5
|
|
65
|
+
- @modern-js/new-action@1.0.0-rc.5
|
|
66
|
+
- @modern-js/babel-compiler@1.0.0-rc.5
|
|
67
|
+
- @modern-js/style-compiler@1.0.0-rc.5
|
|
68
|
+
- @modern-js/module-tools-hooks@1.0.0-rc.5
|
|
69
|
+
- @modern-js/plugin@1.0.0-rc.5
|
|
70
|
+
- @modern-js/utils@1.0.0-rc.5
|
|
71
|
+
|
|
72
|
+
## 1.0.0-rc.4
|
|
73
|
+
|
|
74
|
+
### Patch Changes
|
|
75
|
+
|
|
76
|
+
- fix server route match
|
|
77
|
+
- 204c626: feat: initial
|
|
78
|
+
- Updated dependencies [undefined]
|
|
79
|
+
- Updated dependencies [204c626]
|
|
80
|
+
- @modern-js/babel-preset-module@1.0.0-rc.4
|
|
81
|
+
- @modern-js/core@1.0.0-rc.4
|
|
82
|
+
- @modern-js/css-config@1.0.0-rc.4
|
|
83
|
+
- @modern-js/i18n-cli-language-detector@1.0.0-rc.4
|
|
84
|
+
- @modern-js/plugin-analyze@1.0.0-rc.4
|
|
85
|
+
- @modern-js/plugin-changeset@1.0.0-rc.4
|
|
86
|
+
- @modern-js/plugin-fast-refresh@1.0.0-rc.4
|
|
87
|
+
- @modern-js/plugin-i18n@1.0.0-rc.4
|
|
88
|
+
- @modern-js/new-action@1.0.0-rc.4
|
|
89
|
+
- @modern-js/babel-compiler@1.0.0-rc.4
|
|
90
|
+
- @modern-js/style-compiler@1.0.0-rc.4
|
|
91
|
+
- @modern-js/module-tools-hooks@1.0.0-rc.4
|
|
92
|
+
- @modern-js/plugin@1.0.0-rc.4
|
|
93
|
+
- @modern-js/utils@1.0.0-rc.4
|
|
94
|
+
|
|
95
|
+
## 1.0.0-rc.3
|
|
96
|
+
|
|
97
|
+
### Patch Changes
|
|
98
|
+
|
|
99
|
+
- feat: initial
|
|
100
|
+
- Updated dependencies [undefined]
|
|
101
|
+
- @modern-js/babel-preset-module@1.0.0-rc.3
|
|
102
|
+
- @modern-js/core@1.0.0-rc.3
|
|
103
|
+
- @modern-js/css-config@1.0.0-rc.3
|
|
104
|
+
- @modern-js/i18n-cli-language-detector@1.0.0-rc.3
|
|
105
|
+
- @modern-js/plugin-analyze@1.0.0-rc.3
|
|
106
|
+
- @modern-js/plugin-changeset@1.0.0-rc.3
|
|
107
|
+
- @modern-js/plugin-fast-refresh@1.0.0-rc.3
|
|
108
|
+
- @modern-js/plugin-i18n@1.0.0-rc.3
|
|
109
|
+
- @modern-js/new-action@1.0.0-rc.3
|
|
110
|
+
- @modern-js/babel-compiler@1.0.0-rc.3
|
|
111
|
+
- @modern-js/style-compiler@1.0.0-rc.3
|
|
112
|
+
- @modern-js/module-tools-hooks@1.0.0-rc.3
|
|
113
|
+
- @modern-js/plugin@1.0.0-rc.3
|
|
114
|
+
- @modern-js/utils@1.0.0-rc.3
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
<p align="center">
|
|
3
|
-
<a href="https://modernjs.dev" target="blank"><img src="https://lf3-static.bytednsdoc.com/obj/eden-cn/ylaelkeh7nuhfnuhf/modernjs.png" width="300" alt="Modern.js Logo" /></a>
|
|
3
|
+
<a href="https://modernjs.dev" target="blank"><img src="https://lf3-static.bytednsdoc.com/obj/eden-cn/ylaelkeh7nuhfnuhf/modernjs-cover.png" width="300" alt="Modern.js Logo" /></a>
|
|
4
4
|
</p>
|
|
5
5
|
|
|
6
6
|
<p align="center">现代 Web 工程体系</p>
|
|
@@ -34,7 +34,7 @@ export const devStorybook = async config => {
|
|
|
34
34
|
if (findStorybook) {
|
|
35
35
|
await findStorybook.runTask(config);
|
|
36
36
|
} else {
|
|
37
|
-
console.info(chalk.yellow('
|
|
37
|
+
console.info(chalk.yellow('No development features found.\nYou can use the `new` command to enable the development features')); // eslint-disable-next-line no-process-exit
|
|
38
38
|
|
|
39
39
|
process.exit(0);
|
|
40
40
|
}
|
|
@@ -76,15 +76,28 @@ const taskMain = async ({
|
|
|
76
76
|
modernConfig
|
|
77
77
|
}, // eslint-disable-next-line @typescript-eslint/require-await
|
|
78
78
|
{
|
|
79
|
-
onLast: async _ =>
|
|
79
|
+
onLast: async _ => undefined
|
|
80
80
|
});
|
|
81
81
|
const sassOption = await core.mountHook().moduleSassConfig({
|
|
82
82
|
modernConfig
|
|
83
83
|
}, // eslint-disable-next-line @typescript-eslint/require-await
|
|
84
84
|
{
|
|
85
|
-
onLast: async _ =>
|
|
85
|
+
onLast: async _ => undefined
|
|
86
|
+
});
|
|
87
|
+
const tailwindPlugin = await core.mountHook().moduleTailwindConfig({
|
|
88
|
+
modernConfig
|
|
89
|
+
}, // eslint-disable-next-line @typescript-eslint/require-await
|
|
90
|
+
{
|
|
91
|
+
onLast: async _ => undefined
|
|
86
92
|
});
|
|
87
93
|
const postcssOption = getPostcssOption(appDirectory, modernConfig);
|
|
94
|
+
|
|
95
|
+
if (tailwindPlugin) {
|
|
96
|
+
var _postcssOption$plugin;
|
|
97
|
+
|
|
98
|
+
(_postcssOption$plugin = postcssOption.plugins) === null || _postcssOption$plugin === void 0 ? void 0 : _postcssOption$plugin.push(tailwindPlugin);
|
|
99
|
+
}
|
|
100
|
+
|
|
88
101
|
const {
|
|
89
102
|
importStyle
|
|
90
103
|
} = modernConfig.output;
|
|
@@ -62,7 +62,9 @@ export const resolveBabelConfig = (appDirectory, modernConfig, option) => {
|
|
|
62
62
|
}, {
|
|
63
63
|
type: option.type,
|
|
64
64
|
syntax: option.syntax
|
|
65
|
-
});
|
|
65
|
+
}); // Preventing warning when files are too large
|
|
66
|
+
|
|
67
|
+
internalBabelConfig.compact = false;
|
|
66
68
|
const babelChain = getModuleBabelChain({
|
|
67
69
|
appDirectory,
|
|
68
70
|
enableReactPreset: true,
|
|
@@ -21,9 +21,11 @@ export const copyTask = async option => {
|
|
|
21
21
|
const {
|
|
22
22
|
output: {
|
|
23
23
|
copy,
|
|
24
|
-
path: outputPath = 'dist'
|
|
24
|
+
path: outputPath = 'dist',
|
|
25
|
+
jsPath = 'js'
|
|
25
26
|
}
|
|
26
27
|
} = modernConfig;
|
|
28
|
+
const copyDistDir = path.join(outputPath, jsPath);
|
|
27
29
|
|
|
28
30
|
if (!copy) {
|
|
29
31
|
return;
|
|
@@ -70,7 +72,7 @@ export const copyTask = async option => {
|
|
|
70
72
|
const relativeFrom = path.relative(context, item); // 如果 to 是目录,通过相对路径计算完整的产物路径;如果 to 是文件,直接作为最终产物路径
|
|
71
73
|
|
|
72
74
|
const fileName = isToDirectory ? path.join(to, relativeFrom) : to;
|
|
73
|
-
const finalToPath = path.resolve(
|
|
75
|
+
const finalToPath = path.resolve(copyDistDir, fileName);
|
|
74
76
|
fs.copySync(item, finalToPath);
|
|
75
77
|
});
|
|
76
78
|
}
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "
|
|
6
|
+
Object.defineProperty(exports, "build", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function () {
|
|
9
|
-
return
|
|
9
|
+
return _build.build;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
Object.defineProperty(exports, "
|
|
12
|
+
Object.defineProperty(exports, "dev", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function () {
|
|
15
|
-
return
|
|
15
|
+
return _dev.dev;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.runTscWatchTitle = exports.runTscTitle = exports.runStyleCompilerTitle = exports.runBabelCompilerTitle = exports.clearFlag = exports.PACKAGE_MODES = exports.DEFAULT_PACKAGE_MODE = void 0;
|
|
7
7
|
// Universal JS 的默认选择,三份构建产物,支持 Node.js,对现代浏览器有优化
|
|
8
8
|
const universalJs = [{
|
|
9
9
|
type: 'module',
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.logTemplate = exports.colors = exports.clearFlag = exports.LoggerText = void 0;
|
|
7
7
|
|
|
8
8
|
var _utils = require("@modern-js/utils");
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.logTemplate = exports.getDtsMapper = exports.getCodeMapper = exports.getCodeInitMapper = exports.TimeCounter = exports.LogStack = void 0;
|
|
7
7
|
|
|
8
8
|
var path = _interopRequireWildcard(require("path"));
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.showMenu = exports.devStorybook = void 0;
|
|
7
7
|
|
|
8
8
|
var _utils = require("@modern-js/utils");
|
|
9
9
|
|
|
@@ -51,7 +51,7 @@ const devStorybook = async config => {
|
|
|
51
51
|
if (findStorybook) {
|
|
52
52
|
await findStorybook.runTask(config);
|
|
53
53
|
} else {
|
|
54
|
-
console.info(_chalk.default.yellow('
|
|
54
|
+
console.info(_chalk.default.yellow('No development features found.\nYou can use the `new` command to enable the development features')); // eslint-disable-next-line no-process-exit
|
|
55
55
|
|
|
56
56
|
process.exit(0);
|
|
57
57
|
}
|
package/dist/js/node/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.initEnv = exports.
|
|
6
|
+
exports.initEnv = exports.getWillCompilerCode = exports.buildSourceCode = exports.Compiler = void 0;
|
|
7
7
|
|
|
8
8
|
var _utils = require("@modern-js/utils");
|
|
9
9
|
|
|
@@ -92,15 +92,28 @@ const taskMain = async ({
|
|
|
92
92
|
modernConfig
|
|
93
93
|
}, // eslint-disable-next-line @typescript-eslint/require-await
|
|
94
94
|
{
|
|
95
|
-
onLast: async _ =>
|
|
95
|
+
onLast: async _ => undefined
|
|
96
96
|
});
|
|
97
97
|
const sassOption = await core.mountHook().moduleSassConfig({
|
|
98
98
|
modernConfig
|
|
99
99
|
}, // eslint-disable-next-line @typescript-eslint/require-await
|
|
100
100
|
{
|
|
101
|
-
onLast: async _ =>
|
|
101
|
+
onLast: async _ => undefined
|
|
102
|
+
});
|
|
103
|
+
const tailwindPlugin = await core.mountHook().moduleTailwindConfig({
|
|
104
|
+
modernConfig
|
|
105
|
+
}, // eslint-disable-next-line @typescript-eslint/require-await
|
|
106
|
+
{
|
|
107
|
+
onLast: async _ => undefined
|
|
102
108
|
});
|
|
103
109
|
const postcssOption = getPostcssOption(appDirectory, modernConfig);
|
|
110
|
+
|
|
111
|
+
if (tailwindPlugin) {
|
|
112
|
+
var _postcssOption$plugin;
|
|
113
|
+
|
|
114
|
+
(_postcssOption$plugin = postcssOption.plugins) === null || _postcssOption$plugin === void 0 ? void 0 : _postcssOption$plugin.push(tailwindPlugin);
|
|
115
|
+
}
|
|
116
|
+
|
|
104
117
|
const {
|
|
105
118
|
importStyle
|
|
106
119
|
} = modernConfig.output;
|
|
@@ -74,7 +74,9 @@ const resolveBabelConfig = (appDirectory, modernConfig, option) => {
|
|
|
74
74
|
}, {
|
|
75
75
|
type: option.type,
|
|
76
76
|
syntax: option.syntax
|
|
77
|
-
});
|
|
77
|
+
}); // Preventing warning when files are too large
|
|
78
|
+
|
|
79
|
+
internalBabelConfig.compact = false;
|
|
78
80
|
const babelChain = (0, _babelPresetModule.getModuleBabelChain)({
|
|
79
81
|
appDirectory,
|
|
80
82
|
enableReactPreset: true,
|
|
@@ -37,9 +37,11 @@ const copyTask = async option => {
|
|
|
37
37
|
const {
|
|
38
38
|
output: {
|
|
39
39
|
copy,
|
|
40
|
-
path: outputPath = 'dist'
|
|
40
|
+
path: outputPath = 'dist',
|
|
41
|
+
jsPath = 'js'
|
|
41
42
|
}
|
|
42
43
|
} = modernConfig;
|
|
44
|
+
const copyDistDir = path.join(outputPath, jsPath);
|
|
43
45
|
|
|
44
46
|
if (!copy) {
|
|
45
47
|
return;
|
|
@@ -86,7 +88,7 @@ const copyTask = async option => {
|
|
|
86
88
|
const relativeFrom = path.relative(context, item); // 如果 to 是目录,通过相对路径计算完整的产物路径;如果 to 是文件,直接作为最终产物路径
|
|
87
89
|
|
|
88
90
|
const fileName = isToDirectory ? path.join(to, relativeFrom) : to;
|
|
89
|
-
const finalToPath = path.resolve(
|
|
91
|
+
const finalToPath = path.resolve(copyDistDir, fileName);
|
|
90
92
|
|
|
91
93
|
_utils.fs.copySync(item, finalToPath);
|
|
92
94
|
});
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.logTemplate = exports.clearFlag = exports.LoggerText = exports.LoggerManager = void 0;
|
|
7
7
|
|
|
8
8
|
var _events = _interopRequireDefault(require("events"));
|
|
9
9
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modern-js/module-tools",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.7",
|
|
4
4
|
"bin": {
|
|
5
5
|
"modern": "./bin/modern.js"
|
|
6
6
|
},
|
|
@@ -33,20 +33,20 @@
|
|
|
33
33
|
"@babel/runtime": "^7",
|
|
34
34
|
"@babel/traverse": "^7.15.0",
|
|
35
35
|
"@babel/types": "^7.15.0",
|
|
36
|
-
"@modern-js/babel-compiler": "^1.0.0-rc.
|
|
37
|
-
"@modern-js/babel-preset-module": "^1.0.0-rc.
|
|
38
|
-
"@modern-js/core": "^1.0.0-rc.
|
|
39
|
-
"@modern-js/css-config": "^1.0.0-rc.
|
|
40
|
-
"@modern-js/i18n-cli-language-detector": "^1.0.0-rc.
|
|
41
|
-
"@modern-js/module-tools-hooks": "^1.0.0-rc.
|
|
42
|
-
"@modern-js/new-action": "^1.0.0-rc.
|
|
43
|
-
"@modern-js/plugin": "^1.0.0-rc.
|
|
44
|
-
"@modern-js/plugin-analyze": "^1.0.0-rc.
|
|
45
|
-
"@modern-js/plugin-changeset": "^1.0.0-rc.
|
|
46
|
-
"@modern-js/plugin-fast-refresh": "^1.0.0-rc.
|
|
47
|
-
"@modern-js/plugin-i18n": "^1.0.0-rc.
|
|
48
|
-
"@modern-js/style-compiler": "^1.0.0-rc.
|
|
49
|
-
"@modern-js/utils": "^1.0.0-rc.
|
|
36
|
+
"@modern-js/babel-compiler": "^1.0.0-rc.7",
|
|
37
|
+
"@modern-js/babel-preset-module": "^1.0.0-rc.7",
|
|
38
|
+
"@modern-js/core": "^1.0.0-rc.7",
|
|
39
|
+
"@modern-js/css-config": "^1.0.0-rc.7",
|
|
40
|
+
"@modern-js/i18n-cli-language-detector": "^1.0.0-rc.7",
|
|
41
|
+
"@modern-js/module-tools-hooks": "^1.0.0-rc.7",
|
|
42
|
+
"@modern-js/new-action": "^1.0.0-rc.7",
|
|
43
|
+
"@modern-js/plugin": "^1.0.0-rc.7",
|
|
44
|
+
"@modern-js/plugin-analyze": "^1.0.0-rc.7",
|
|
45
|
+
"@modern-js/plugin-changeset": "^1.0.0-rc.7",
|
|
46
|
+
"@modern-js/plugin-fast-refresh": "^1.0.0-rc.7",
|
|
47
|
+
"@modern-js/plugin-i18n": "^1.0.0-rc.7",
|
|
48
|
+
"@modern-js/style-compiler": "^1.0.0-rc.7",
|
|
49
|
+
"@modern-js/utils": "^1.0.0-rc.7",
|
|
50
50
|
"chalk": "^4.1.2",
|
|
51
51
|
"chokidar": "^3.5.2",
|
|
52
52
|
"dotenv": "^10.0.0",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@babel/preset-typescript": "^7.15.0",
|
|
68
|
-
"@modern-js/babel-chain": "^1.0.0-rc.
|
|
68
|
+
"@modern-js/babel-chain": "^1.0.0-rc.7",
|
|
69
69
|
"@types/babel__core": "^7.1.15",
|
|
70
70
|
"@types/babel__generator": "^7.6.3",
|
|
71
71
|
"@types/babel__traverse": "^7.14.2",
|
|
@@ -78,8 +78,8 @@
|
|
|
78
78
|
"@types/signale": "^1.4.2",
|
|
79
79
|
"commander": "^8.1.0",
|
|
80
80
|
"typescript": "^4",
|
|
81
|
-
"@modern-js/plugin-testing": "^1.0.0-rc.
|
|
82
|
-
"@modern-js/module-tools": "^1.0.0-rc.
|
|
81
|
+
"@modern-js/plugin-testing": "^1.0.0-rc.7",
|
|
82
|
+
"@modern-js/module-tools": "^1.0.0-rc.7"
|
|
83
83
|
},
|
|
84
84
|
"sideEffects": false,
|
|
85
85
|
"modernConfig": {
|
|
@@ -87,6 +87,10 @@
|
|
|
87
87
|
"packageMode": "node-js"
|
|
88
88
|
}
|
|
89
89
|
},
|
|
90
|
+
"publishConfig": {
|
|
91
|
+
"registry": "https://registry.npmjs.org/",
|
|
92
|
+
"access": "public"
|
|
93
|
+
},
|
|
90
94
|
"scripts": {
|
|
91
95
|
"new": "modern new",
|
|
92
96
|
"build": "modern build",
|
|
@@ -53,7 +53,7 @@ export const devStorybook = async (config: IDevConfig) => {
|
|
|
53
53
|
} else {
|
|
54
54
|
console.info(
|
|
55
55
|
chalk.yellow(
|
|
56
|
-
'
|
|
56
|
+
'No development features found.\nYou can use the `new` command to enable the development features',
|
|
57
57
|
),
|
|
58
58
|
);
|
|
59
59
|
// eslint-disable-next-line no-process-exit
|
package/src/tasks/build-style.ts
CHANGED
|
@@ -100,17 +100,26 @@ const taskMain = async ({
|
|
|
100
100
|
} = modernConfig.output as ModuleToolsOutput;
|
|
101
101
|
const { appDirectory } = appContext;
|
|
102
102
|
|
|
103
|
-
const lessOption = await
|
|
103
|
+
const lessOption = await core.mountHook().moduleLessConfig(
|
|
104
104
|
{ modernConfig },
|
|
105
105
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
106
|
-
{ onLast: async (_: any) =>
|
|
106
|
+
{ onLast: async (_: any) => undefined },
|
|
107
107
|
);
|
|
108
|
-
const sassOption = await
|
|
108
|
+
const sassOption = await core.mountHook().moduleSassConfig(
|
|
109
109
|
{ modernConfig },
|
|
110
110
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
111
|
-
{ onLast: async (_: any) =>
|
|
111
|
+
{ onLast: async (_: any) => undefined },
|
|
112
|
+
);
|
|
113
|
+
const tailwindPlugin = await core.mountHook().moduleTailwindConfig(
|
|
114
|
+
{ modernConfig },
|
|
115
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
116
|
+
{ onLast: async (_: any) => undefined },
|
|
112
117
|
);
|
|
113
118
|
const postcssOption = getPostcssOption(appDirectory, modernConfig);
|
|
119
|
+
if (tailwindPlugin) {
|
|
120
|
+
postcssOption.plugins?.push(tailwindPlugin);
|
|
121
|
+
}
|
|
122
|
+
|
|
114
123
|
const { importStyle } = modernConfig.output as ModuleToolsOutput;
|
|
115
124
|
const existStylesDir = checkStylesDirExist({ appDirectory });
|
|
116
125
|
// 编译 styles 目录样式
|
package/src/utils/babel.ts
CHANGED
package/src/utils/copy.ts
CHANGED
|
@@ -17,8 +17,9 @@ export const copyTask = async (option: {
|
|
|
17
17
|
const { modernConfig, appContext } = option;
|
|
18
18
|
const { appDirectory } = appContext;
|
|
19
19
|
const {
|
|
20
|
-
output: { copy, path: outputPath = 'dist' },
|
|
20
|
+
output: { copy, path: outputPath = 'dist', jsPath = 'js' },
|
|
21
21
|
} = modernConfig;
|
|
22
|
+
const copyDistDir = path.join(outputPath, jsPath);
|
|
22
23
|
|
|
23
24
|
if (!copy) {
|
|
24
25
|
return;
|
|
@@ -60,7 +61,7 @@ export const copyTask = async (option: {
|
|
|
60
61
|
const relativeFrom = path.relative(context, item);
|
|
61
62
|
// 如果 to 是目录,通过相对路径计算完整的产物路径;如果 to 是文件,直接作为最终产物路径
|
|
62
63
|
const fileName = isToDirectory ? path.join(to, relativeFrom) : to;
|
|
63
|
-
const finalToPath = path.resolve(
|
|
64
|
+
const finalToPath = path.resolve(copyDistDir, fileName);
|
|
64
65
|
fs.copySync(item, finalToPath);
|
|
65
66
|
});
|
|
66
67
|
}
|