@modern-js/module-tools 1.4.6 → 1.5.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 +30 -0
- package/dist/js/modern/commands/build.js +1 -2
- package/dist/js/modern/commands/dev.js +1 -2
- package/dist/js/modern/features/dev/index.js +1 -2
- package/dist/js/modern/tasks/generator-dts/index.js +2 -3
- package/dist/js/modern/utils/copy.js +1 -3
- package/dist/js/modern/utils/tsconfig.js +1 -2
- package/dist/js/node/commands/build.js +3 -3
- package/dist/js/node/commands/dev.js +3 -3
- package/dist/js/node/features/dev/index.js +1 -3
- package/dist/js/node/tasks/generator-dts/index.js +1 -3
- package/dist/js/node/utils/copy.js +2 -6
- package/dist/js/node/utils/tsconfig.js +1 -3
- package/package.json +7 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @modern-js/module-tools
|
|
2
2
|
|
|
3
|
+
## 1.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 0b26b93b: feat: prebundle all dependencies of @modern-js/core
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 592edabc: feat: prebundle url-join,mime-types,json5,fast-glob,globby,ora,inquirer
|
|
12
|
+
- 895fa0ff: chore: using "workspace:\*" in devDependencies
|
|
13
|
+
- Updated dependencies [2d155c4c]
|
|
14
|
+
- Updated dependencies [123e432d]
|
|
15
|
+
- Updated dependencies [e5a9b26d]
|
|
16
|
+
- Updated dependencies [0b26b93b]
|
|
17
|
+
- Updated dependencies [123e432d]
|
|
18
|
+
- Updated dependencies [f9f66ef9]
|
|
19
|
+
- Updated dependencies [592edabc]
|
|
20
|
+
- Updated dependencies [f9f66ef9]
|
|
21
|
+
- Updated dependencies [895fa0ff]
|
|
22
|
+
- Updated dependencies [3578913e]
|
|
23
|
+
- Updated dependencies [1c3beab3]
|
|
24
|
+
- @modern-js/utils@1.6.0
|
|
25
|
+
- @modern-js/core@1.9.0
|
|
26
|
+
- @modern-js/plugin-analyze@1.4.1
|
|
27
|
+
- @modern-js/new-action@1.3.7
|
|
28
|
+
- @modern-js/babel-preset-module@1.3.3
|
|
29
|
+
- @modern-js/css-config@1.2.4
|
|
30
|
+
- @modern-js/plugin-changeset@1.2.5
|
|
31
|
+
- @modern-js/plugin-fast-refresh@1.2.4
|
|
32
|
+
|
|
3
33
|
## 1.4.6
|
|
4
34
|
|
|
5
35
|
### Patch Changes
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as path from 'path';
|
|
2
|
-
import { fs, Import } from '@modern-js/utils';
|
|
2
|
+
import { fs, Import, dotenv } from '@modern-js/utils';
|
|
3
3
|
const tsConfigutils = Import.lazy('../utils/tsconfig', require);
|
|
4
4
|
const valid = Import.lazy('../utils/valide', require);
|
|
5
5
|
const buildFeature = Import.lazy('../features/build', require);
|
|
6
|
-
const dotenv = Import.lazy('dotenv', require);
|
|
7
6
|
export const build = async (api, {
|
|
8
7
|
watch: _watch = false,
|
|
9
8
|
tsconfig: tsconfigName,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as path from 'path';
|
|
2
|
-
import { Import } from '@modern-js/utils';
|
|
2
|
+
import { dotenv, Import } from '@modern-js/utils';
|
|
3
3
|
const devFeature = Import.lazy('../features/dev', require);
|
|
4
|
-
const dotenv = Import.lazy('dotenv', require);
|
|
5
4
|
const tsConfigutils = Import.lazy('../utils/tsconfig', require);
|
|
6
5
|
const valid = Import.lazy('../utils/valide', require);
|
|
7
6
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { chalk, Import } from '@modern-js/utils';
|
|
2
|
-
const inquirer = Import.lazy('inquirer', require);
|
|
1
|
+
import { chalk, Import, inquirer } from '@modern-js/utils';
|
|
3
2
|
const color = Import.lazy('../../utils/color', require);
|
|
4
3
|
export const showMenu = async (api, config) => {
|
|
5
4
|
const runners = api.useHookRunners();
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Import, execa, fs, isObject } from '@modern-js/utils';
|
|
1
|
+
import { Import, execa, fs, json5, isObject } from '@modern-js/utils';
|
|
2
2
|
import { getTscBinPath } from "./utils";
|
|
3
3
|
const core = Import.lazy('@modern-js/core', require);
|
|
4
|
-
const JSON5 = Import.lazy('json5', require);
|
|
5
4
|
const argv = Import.lazy('process.argv', require);
|
|
6
5
|
const utils = Import.lazy('./utils', require);
|
|
7
6
|
let removeTsconfigPath = '';
|
|
@@ -11,7 +10,7 @@ const getProjectTsconfig = tsconfigPath => {
|
|
|
11
10
|
return {};
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
return
|
|
13
|
+
return json5.parse(fs.readFileSync(tsconfigPath, 'utf-8'));
|
|
15
14
|
};
|
|
16
15
|
|
|
17
16
|
const resolveLog = (childProgress, {
|
|
@@ -5,9 +5,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
5
5
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
6
6
|
|
|
7
7
|
import * as path from 'path';
|
|
8
|
-
import { fs, Import } from '@modern-js/utils';
|
|
9
|
-
const globby = Import.lazy('globby', require);
|
|
10
|
-
const fastGlob = Import.lazy('fast-glob', require);
|
|
8
|
+
import { fs, Import, globby, fastGlob } from '@modern-js/utils';
|
|
11
9
|
const normalizePath = Import.lazy('normalize-path', require);
|
|
12
10
|
export const copyTask = async option => {
|
|
13
11
|
const {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { fs,
|
|
2
|
-
const json5 = Import.lazy('json5', require);
|
|
1
|
+
import { fs, json5 } from '@modern-js/utils';
|
|
3
2
|
export const readTsConfig = (tsconfigPath, noExistReturn = null) => {
|
|
4
3
|
// 如果不存在,则返回 noExistReturn
|
|
5
4
|
if (!fs.existsSync(tsconfigPath)) {
|
|
@@ -19,8 +19,6 @@ const valid = _utils.Import.lazy('../utils/valide', require);
|
|
|
19
19
|
|
|
20
20
|
const buildFeature = _utils.Import.lazy('../features/build', require);
|
|
21
21
|
|
|
22
|
-
const dotenv = _utils.Import.lazy('dotenv', require);
|
|
23
|
-
|
|
24
22
|
const build = async (api, {
|
|
25
23
|
watch: _watch = false,
|
|
26
24
|
tsconfig: tsconfigName,
|
|
@@ -33,7 +31,9 @@ const build = async (api, {
|
|
|
33
31
|
} = api.useAppContext();
|
|
34
32
|
const modernConfig = api.useResolvedConfigContext();
|
|
35
33
|
const tsconfigPath = path.join(appDirectory, tsconfigName);
|
|
36
|
-
|
|
34
|
+
|
|
35
|
+
_utils.dotenv.config();
|
|
36
|
+
|
|
37
37
|
const isTsProject = tsConfigutils.existTsConfigFile(tsconfigPath);
|
|
38
38
|
const enableTscCompiler = isTsProject && tsc && !modernConfig.output.disableTsChecker;
|
|
39
39
|
valid.valideBeforeTask({
|
|
@@ -15,8 +15,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
15
15
|
|
|
16
16
|
const devFeature = _utils.Import.lazy('../features/dev', require);
|
|
17
17
|
|
|
18
|
-
const dotenv = _utils.Import.lazy('dotenv', require);
|
|
19
|
-
|
|
20
18
|
const tsConfigutils = _utils.Import.lazy('../utils/tsconfig', require);
|
|
21
19
|
|
|
22
20
|
const valid = _utils.Import.lazy('../utils/valide', require);
|
|
@@ -33,7 +31,9 @@ const dev = async (api, option, subCmd = '') => {
|
|
|
33
31
|
appDirectory
|
|
34
32
|
} = appContext;
|
|
35
33
|
const tsconfigPath = path.join(appDirectory, tsconfigName);
|
|
36
|
-
|
|
34
|
+
|
|
35
|
+
_utils.dotenv.config();
|
|
36
|
+
|
|
37
37
|
valid.valideBeforeTask({
|
|
38
38
|
modernConfig,
|
|
39
39
|
tsconfigPath
|
|
@@ -7,8 +7,6 @@ exports.showMenu = exports.runSubCmd = exports.devStorybook = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _utils = require("@modern-js/utils");
|
|
9
9
|
|
|
10
|
-
const inquirer = _utils.Import.lazy('inquirer', require);
|
|
11
|
-
|
|
12
10
|
const color = _utils.Import.lazy('../../utils/color', require);
|
|
13
11
|
|
|
14
12
|
const showMenu = async (api, config) => {
|
|
@@ -24,7 +22,7 @@ const showMenu = async (api, config) => {
|
|
|
24
22
|
const menuMessage = color.devMenuTitle('Select the debug mode:');
|
|
25
23
|
const {
|
|
26
24
|
type
|
|
27
|
-
} = await inquirer.prompt([{
|
|
25
|
+
} = await _utils.inquirer.prompt([{
|
|
28
26
|
name: 'type',
|
|
29
27
|
message: menuMessage,
|
|
30
28
|
type: 'list',
|
|
@@ -6,8 +6,6 @@ var _utils2 = require("./utils");
|
|
|
6
6
|
|
|
7
7
|
const core = _utils.Import.lazy('@modern-js/core', require);
|
|
8
8
|
|
|
9
|
-
const JSON5 = _utils.Import.lazy('json5', require);
|
|
10
|
-
|
|
11
9
|
const argv = _utils.Import.lazy('process.argv', require);
|
|
12
10
|
|
|
13
11
|
const utils = _utils.Import.lazy('./utils', require);
|
|
@@ -19,7 +17,7 @@ const getProjectTsconfig = tsconfigPath => {
|
|
|
19
17
|
return {};
|
|
20
18
|
}
|
|
21
19
|
|
|
22
|
-
return
|
|
20
|
+
return _utils.json5.parse(_utils.fs.readFileSync(tsconfigPath, 'utf-8'));
|
|
23
21
|
};
|
|
24
22
|
|
|
25
23
|
const resolveLog = (childProgress, {
|
|
@@ -19,10 +19,6 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
19
19
|
|
|
20
20
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
21
21
|
|
|
22
|
-
const globby = _utils.Import.lazy('globby', require);
|
|
23
|
-
|
|
24
|
-
const fastGlob = _utils.Import.lazy('fast-glob', require);
|
|
25
|
-
|
|
26
22
|
const normalizePath = _utils.Import.lazy('normalize-path', require);
|
|
27
23
|
|
|
28
24
|
const copyTask = async option => {
|
|
@@ -73,9 +69,9 @@ const copyTask = async option => {
|
|
|
73
69
|
options = globOptions;
|
|
74
70
|
}
|
|
75
71
|
|
|
76
|
-
glob = path.isAbsolute(fromOrigin) ? fromOrigin : path.posix.join(fastGlob.escapePath(normalizePath(path.resolve(context))), fromOrigin); // 计算 glob,获取目标文件
|
|
72
|
+
glob = path.isAbsolute(fromOrigin) ? fromOrigin : path.posix.join(_utils.fastGlob.escapePath(normalizePath(path.resolve(context))), fromOrigin); // 计算 glob,获取目标文件
|
|
77
73
|
|
|
78
|
-
const paths = await globby(glob, options);
|
|
74
|
+
const paths = await (0, _utils.globby)(glob, options);
|
|
79
75
|
|
|
80
76
|
if (!paths.length) {
|
|
81
77
|
return;
|
|
@@ -7,8 +7,6 @@ exports.readTsConfig = exports.existTsConfigFile = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _utils = require("@modern-js/utils");
|
|
9
9
|
|
|
10
|
-
const json5 = _utils.Import.lazy('json5', require);
|
|
11
|
-
|
|
12
10
|
const readTsConfig = (tsconfigPath, noExistReturn = null) => {
|
|
13
11
|
// 如果不存在,则返回 noExistReturn
|
|
14
12
|
if (!_utils.fs.existsSync(tsconfigPath)) {
|
|
@@ -17,7 +15,7 @@ const readTsConfig = (tsconfigPath, noExistReturn = null) => {
|
|
|
17
15
|
|
|
18
16
|
const content = _utils.fs.readFileSync(tsconfigPath, 'utf-8');
|
|
19
17
|
|
|
20
|
-
return json5.parse(content);
|
|
18
|
+
return _utils.json5.parse(content);
|
|
21
19
|
};
|
|
22
20
|
|
|
23
21
|
exports.readTsConfig = readTsConfig;
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.
|
|
14
|
+
"version": "1.5.0",
|
|
15
15
|
"bin": {
|
|
16
16
|
"modern": "./bin/modern.js"
|
|
17
17
|
},
|
|
@@ -55,23 +55,18 @@
|
|
|
55
55
|
"@babel/traverse": "^7.15.0",
|
|
56
56
|
"@babel/types": "^7.17.0",
|
|
57
57
|
"@modern-js/babel-compiler": "^1.2.3",
|
|
58
|
-
"@modern-js/babel-preset-module": "^1.3.
|
|
59
|
-
"@modern-js/core": "^1.
|
|
58
|
+
"@modern-js/babel-preset-module": "^1.3.3",
|
|
59
|
+
"@modern-js/core": "^1.9.0",
|
|
60
60
|
"@modern-js/css-config": "^1.2.4",
|
|
61
61
|
"@modern-js/i18n-cli-language-detector": "^1.2.2",
|
|
62
|
-
"@modern-js/new-action": "^1.3.
|
|
62
|
+
"@modern-js/new-action": "^1.3.7",
|
|
63
63
|
"@modern-js/plugin": "^1.3.3",
|
|
64
|
-
"@modern-js/plugin-analyze": "^1.4.
|
|
64
|
+
"@modern-js/plugin-analyze": "^1.4.1",
|
|
65
65
|
"@modern-js/plugin-changeset": "^1.2.5",
|
|
66
66
|
"@modern-js/plugin-fast-refresh": "^1.2.4",
|
|
67
67
|
"@modern-js/plugin-i18n": "^1.2.4",
|
|
68
68
|
"@modern-js/style-compiler": "^1.2.4",
|
|
69
|
-
"@modern-js/utils": "^1.
|
|
70
|
-
"dotenv": "^10.0.0",
|
|
71
|
-
"fast-glob": "^3.2.5",
|
|
72
|
-
"globby": "^11",
|
|
73
|
-
"inquirer": "^8.1.5",
|
|
74
|
-
"json5": "^2.2.0",
|
|
69
|
+
"@modern-js/utils": "^1.6.0",
|
|
75
70
|
"normalize-path": "^3.0.0",
|
|
76
71
|
"p-map": "^4",
|
|
77
72
|
"process.argv": "^0.6.0",
|
|
@@ -79,14 +74,13 @@
|
|
|
79
74
|
},
|
|
80
75
|
"devDependencies": {
|
|
81
76
|
"@babel/preset-typescript": "^7.15.0",
|
|
82
|
-
"@modern-js/babel-chain": "
|
|
77
|
+
"@modern-js/babel-chain": "1.2.2",
|
|
83
78
|
"@scripts/build": "0.0.0",
|
|
84
79
|
"@scripts/jest-config": "0.0.0",
|
|
85
80
|
"@types/babel__core": "^7.1.15",
|
|
86
81
|
"@types/babel__generator": "^7.6.3",
|
|
87
82
|
"@types/babel__traverse": "^7.14.2",
|
|
88
83
|
"@types/glob": "^7.1.4",
|
|
89
|
-
"@types/inquirer": "^8.1.1",
|
|
90
84
|
"@types/jest": "^26",
|
|
91
85
|
"@types/node": "^14",
|
|
92
86
|
"@types/normalize-path": "^3.0.0",
|