@modern-js/module-tools 1.4.4 → 1.4.5
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 +25 -0
- package/dist/js/modern/features/build/build-platform.js +1 -2
- package/dist/js/modern/features/build/build-watch.js +1 -2
- package/dist/js/modern/features/build/build.js +2 -5
- package/dist/js/modern/features/dev/index.js +1 -2
- package/dist/js/modern/tasks/build-source-code.js +1 -2
- package/dist/js/modern/tasks/build-style.js +1 -2
- package/dist/js/modern/tasks/build-watch-style.js +2 -5
- package/dist/js/modern/tasks/copy-assets.js +1 -2
- package/dist/js/modern/tasks/generator-dts/index.js +1 -2
- package/dist/js/modern/tasks/generator-dts/utils.js +2 -3
- package/dist/js/modern/utils/copy.js +1 -2
- package/dist/js/modern/utils/logger.js +1 -2
- package/dist/js/node/features/build/build-platform.js +2 -3
- package/dist/js/node/features/build/build-watch.js +1 -3
- package/dist/js/node/features/build/build.js +1 -6
- package/dist/js/node/features/dev/index.js +2 -6
- package/dist/js/node/tasks/build-source-code.js +3 -3
- package/dist/js/node/tasks/build-style.js +1 -3
- package/dist/js/node/tasks/build-watch-style.js +2 -6
- package/dist/js/node/tasks/copy-assets.js +1 -3
- package/dist/js/node/tasks/generator-dts/index.js +1 -3
- package/dist/js/node/tasks/generator-dts/utils.js +4 -6
- package/dist/js/node/utils/copy.js +1 -2
- package/dist/js/node/utils/logger.js +5 -7
- package/dist/types/cli/build.d.ts +1 -1
- package/dist/types/cli/dev.d.ts +1 -1
- package/dist/types/cli/new.d.ts +1 -1
- package/dist/types/utils/babel.d.ts +1 -1
- package/package.json +7 -13
- package/tests/dev-cli.test.ts +1 -1
- package/tests/generator-dts.test.ts +0 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @modern-js/module-tools
|
|
2
2
|
|
|
3
|
+
## 1.4.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 07a4887e: feat: prebundle commander and signale to @modern-js/utils
|
|
8
|
+
- 17d0cc46: feat: prebundle lodash to @modern-js/utils/lodash
|
|
9
|
+
- Updated dependencies [60855eb2]
|
|
10
|
+
- Updated dependencies [046e58aa]
|
|
11
|
+
- Updated dependencies [ec1b7367]
|
|
12
|
+
- Updated dependencies [77ff9754]
|
|
13
|
+
- Updated dependencies [d2d1d6b2]
|
|
14
|
+
- Updated dependencies [07a4887e]
|
|
15
|
+
- Updated dependencies [ea2ae711]
|
|
16
|
+
- Updated dependencies [17d0cc46]
|
|
17
|
+
- Updated dependencies [d2d1d6b2]
|
|
18
|
+
- @modern-js/core@1.7.0
|
|
19
|
+
- @modern-js/plugin-analyze@1.3.6
|
|
20
|
+
- @modern-js/utils@1.4.0
|
|
21
|
+
- @modern-js/plugin-i18n@1.2.3
|
|
22
|
+
- @modern-js/new-action@1.3.5
|
|
23
|
+
- @modern-js/style-compiler@1.2.3
|
|
24
|
+
- @modern-js/css-config@1.2.3
|
|
25
|
+
- @modern-js/plugin-changeset@1.2.4
|
|
26
|
+
- @modern-js/plugin-fast-refresh@1.2.3
|
|
27
|
+
|
|
3
28
|
## 1.4.4
|
|
4
29
|
|
|
5
30
|
### Patch Changes
|
|
@@ -4,8 +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 { Import, chalk } from '@modern-js/utils';
|
|
8
|
-
const execa = Import.lazy('execa', require);
|
|
7
|
+
import { execa, Import, chalk } from '@modern-js/utils';
|
|
9
8
|
const lg = Import.lazy('./logger', require);
|
|
10
9
|
const pMap = Import.lazy('p-map', require);
|
|
11
10
|
export const buildPlatform = async (api, option) => {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as path from 'path';
|
|
2
2
|
import * as os from 'os';
|
|
3
|
-
import { Import } from '@modern-js/utils';
|
|
4
|
-
const execa = Import.lazy('execa', require);
|
|
3
|
+
import { execa, Import } from '@modern-js/utils';
|
|
5
4
|
const lg = Import.lazy('./logger', require);
|
|
6
5
|
const pMap = Import.lazy('p-map', require);
|
|
7
6
|
const utils = Import.lazy('./utils', require);
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
/* eslint-disable max-statements */
|
|
2
1
|
import * as path from 'path';
|
|
3
2
|
import * as os from 'os';
|
|
4
|
-
import { Import } from '@modern-js/utils';
|
|
3
|
+
import { execa, Import } from '@modern-js/utils';
|
|
5
4
|
const pMap = Import.lazy('p-map', require);
|
|
6
5
|
const utils = Import.lazy('./utils', require);
|
|
7
|
-
const execa = Import.lazy('execa', require);
|
|
8
6
|
const lg = Import.lazy('./logger', require);
|
|
9
7
|
const constants = Import.lazy('./constants', require);
|
|
10
8
|
export const buildSourceCode = async (api, config, _) => {
|
|
@@ -105,5 +103,4 @@ export const buildSourceCode = async (api, config, _) => {
|
|
|
105
103
|
// eslint-disable-next-line no-process-exit
|
|
106
104
|
process.exit(1);
|
|
107
105
|
}
|
|
108
|
-
};
|
|
109
|
-
/* eslint-enable max-statements */
|
|
106
|
+
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Import } from '@modern-js/utils';
|
|
2
|
-
import chalk from 'chalk';
|
|
1
|
+
import { chalk, Import } from '@modern-js/utils';
|
|
3
2
|
const inquirer = Import.lazy('inquirer', require);
|
|
4
3
|
const color = Import.lazy('../../utils/color', require);
|
|
5
4
|
export const showMenu = async (api, config) => {
|
|
@@ -4,10 +4,9 @@ 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 { Import, fs } from '@modern-js/utils';
|
|
7
|
+
import { Import, glob, fs } from '@modern-js/utils';
|
|
8
8
|
import { initEnv } from "../utils/init-env";
|
|
9
9
|
const babelCompiler = Import.lazy('@modern-js/babel-compiler', require);
|
|
10
|
-
const glob = Import.lazy('glob', require);
|
|
11
10
|
const argv = Import.lazy('process.argv', require);
|
|
12
11
|
const core = Import.lazy('@modern-js/core', require);
|
|
13
12
|
const bc = Import.lazy('../utils/babel', require);
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as path from 'path';
|
|
2
|
-
import { fs, Import } from '@modern-js/utils';
|
|
2
|
+
import { fs, glob, Import } from '@modern-js/utils';
|
|
3
3
|
const cssConfig = Import.lazy('@modern-js/css-config', require);
|
|
4
4
|
const core = Import.lazy('@modern-js/core', require);
|
|
5
5
|
const compiler = Import.lazy('@modern-js/style-compiler', require);
|
|
6
|
-
const glob = Import.lazy('glob', require);
|
|
7
6
|
const hooks = Import.lazy('../hooks', require);
|
|
8
7
|
const STYLE_DIRS = 'styles';
|
|
9
8
|
const SRC_STYLE_DIRS = 'src';
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
/* eslint-disable max-statements */
|
|
2
1
|
import * as path from 'path';
|
|
3
|
-
import { fs, watch, WatchChangeType, Import } from '@modern-js/utils';
|
|
2
|
+
import { fs, glob, watch, WatchChangeType, Import } from '@modern-js/utils';
|
|
4
3
|
const logger = Import.lazy('../features/build/logger', require);
|
|
5
4
|
const cssConfig = Import.lazy('@modern-js/css-config', require);
|
|
6
5
|
const hooks = Import.lazy('../hooks', require);
|
|
7
6
|
const core = Import.lazy('@modern-js/core', require);
|
|
8
7
|
const compiler = Import.lazy('@modern-js/style-compiler', require);
|
|
9
|
-
const glob = Import.lazy('glob', require);
|
|
10
8
|
const STYLE_DIRS = 'styles';
|
|
11
9
|
const SRC_STYLE_DIRS = 'src';
|
|
12
10
|
|
|
@@ -214,5 +212,4 @@ const taskMain = async ({
|
|
|
214
212
|
console.error(e);
|
|
215
213
|
}
|
|
216
214
|
});
|
|
217
|
-
})();
|
|
218
|
-
/* eslint-enable max-statements */
|
|
215
|
+
})();
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as path from 'path';
|
|
2
|
-
import { fs, watch, WatchChangeType, Import } from '@modern-js/utils';
|
|
2
|
+
import { fs, watch, glob, WatchChangeType, Import } from '@modern-js/utils';
|
|
3
3
|
const argv = Import.lazy('process.argv', require);
|
|
4
|
-
const glob = Import.lazy('glob', require);
|
|
5
4
|
const core = Import.lazy('@modern-js/core', require);
|
|
6
5
|
const copyUtils = Import.lazy('../utils/copy', require);
|
|
7
6
|
const STYLE_DIRS = 'styles';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Import, fs, isObject } from '@modern-js/utils';
|
|
1
|
+
import { Import, execa, fs, isObject } from '@modern-js/utils';
|
|
2
2
|
import { getTscBinPath } from "./utils";
|
|
3
3
|
const core = Import.lazy('@modern-js/core', require);
|
|
4
|
-
const execa = Import.lazy('execa', require);
|
|
5
4
|
const JSON5 = Import.lazy('json5', require);
|
|
6
5
|
const argv = Import.lazy('process.argv', require);
|
|
7
6
|
const utils = Import.lazy('./utils', require);
|
|
@@ -5,12 +5,11 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
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
7
|
import * as path from 'path';
|
|
8
|
-
import { Import, fs } from '@modern-js/utils';
|
|
9
|
-
|
|
8
|
+
import { Import, glob, fs } from '@modern-js/utils';
|
|
9
|
+
import { merge as deepMerge } from '@modern-js/utils/lodash';
|
|
10
10
|
const babel = Import.lazy('../../utils/babel', require);
|
|
11
11
|
const tsPathsTransform = Import.lazy('../../utils/tspaths-transform', require);
|
|
12
12
|
const constants = Import.lazy('../constants', require);
|
|
13
|
-
const deepMerge = Import.lazy('lodash.merge', require);
|
|
14
13
|
export const generatorTsConfig = (projectTsconfig, {
|
|
15
14
|
appDirectory,
|
|
16
15
|
distDir,
|
|
@@ -8,8 +8,7 @@ import * as path from 'path';
|
|
|
8
8
|
import { fs, Import } from '@modern-js/utils';
|
|
9
9
|
const globby = Import.lazy('globby', require);
|
|
10
10
|
const fastGlob = Import.lazy('fast-glob', require);
|
|
11
|
-
const normalizePath = Import.lazy('normalize-path', require);
|
|
12
|
-
|
|
11
|
+
const normalizePath = Import.lazy('normalize-path', require);
|
|
13
12
|
export const copyTask = async option => {
|
|
14
13
|
const {
|
|
15
14
|
modernConfig,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import EventEmitter from 'events';
|
|
2
|
-
import {
|
|
3
|
-
const chalk = Import.lazy('chalk', require);
|
|
2
|
+
import { chalk } from '@modern-js/utils';
|
|
4
3
|
export const clearFlag = '\x1Bc';
|
|
5
4
|
export const logTemplate = (title, messageStack, maxLength, {
|
|
6
5
|
noBottomBorder: _noBottomBorder = false,
|
|
@@ -13,8 +13,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
13
13
|
|
|
14
14
|
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; }
|
|
15
15
|
|
|
16
|
-
const execa = _utils.Import.lazy('execa', require);
|
|
17
|
-
|
|
18
16
|
const lg = _utils.Import.lazy('./logger', require);
|
|
19
17
|
|
|
20
18
|
const pMap = _utils.Import.lazy('p-map', require);
|
|
@@ -58,7 +56,7 @@ const buildPlatform = async (api, option) => {
|
|
|
58
56
|
params,
|
|
59
57
|
logger: _
|
|
60
58
|
}) => {
|
|
61
|
-
const childProcess = execa.node(taskPath, params, {
|
|
59
|
+
const childProcess = _utils.execa.node(taskPath, params, {
|
|
62
60
|
stdio: 'inherit',
|
|
63
61
|
all: true
|
|
64
62
|
}); // lm.addStdout(logger, childProcess.stdout, {
|
|
@@ -66,6 +64,7 @@ const buildPlatform = async (api, option) => {
|
|
|
66
64
|
// });
|
|
67
65
|
// lm.addStderr(logger, childProcess.stderr);
|
|
68
66
|
|
|
67
|
+
|
|
69
68
|
try {
|
|
70
69
|
await childProcess;
|
|
71
70
|
} catch (_unused) {
|
|
@@ -15,8 +15,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
15
15
|
|
|
16
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
17
|
|
|
18
|
-
const execa = _utils.Import.lazy('execa', require);
|
|
19
|
-
|
|
20
18
|
const lg = _utils.Import.lazy('./logger', require);
|
|
21
19
|
|
|
22
20
|
const pMap = _utils.Import.lazy('p-map', require);
|
|
@@ -75,7 +73,7 @@ const buildInWatchMode = async (api, config, _) => {
|
|
|
75
73
|
taskPath,
|
|
76
74
|
params
|
|
77
75
|
}) => {
|
|
78
|
-
const childProcess = execa.node(taskPath, params, {
|
|
76
|
+
const childProcess = _utils.execa.node(taskPath, params, {
|
|
79
77
|
stdio: 'pipe'
|
|
80
78
|
});
|
|
81
79
|
|
|
@@ -15,13 +15,10 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
15
15
|
|
|
16
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
17
|
|
|
18
|
-
/* eslint-disable max-statements */
|
|
19
18
|
const pMap = _utils.Import.lazy('p-map', require);
|
|
20
19
|
|
|
21
20
|
const utils = _utils.Import.lazy('./utils', require);
|
|
22
21
|
|
|
23
|
-
const execa = _utils.Import.lazy('execa', require);
|
|
24
|
-
|
|
25
22
|
const lg = _utils.Import.lazy('./logger', require);
|
|
26
23
|
|
|
27
24
|
const constants = _utils.Import.lazy('./constants', require);
|
|
@@ -70,7 +67,7 @@ const buildSourceCode = async (api, config, _) => {
|
|
|
70
67
|
taskPath,
|
|
71
68
|
params
|
|
72
69
|
}) => {
|
|
73
|
-
const childProcess = execa.node(taskPath, params, {
|
|
70
|
+
const childProcess = _utils.execa.node(taskPath, params, {
|
|
74
71
|
stdio: 'pipe'
|
|
75
72
|
});
|
|
76
73
|
|
|
@@ -125,7 +122,5 @@ const buildSourceCode = async (api, config, _) => {
|
|
|
125
122
|
process.exit(1);
|
|
126
123
|
}
|
|
127
124
|
};
|
|
128
|
-
/* eslint-enable max-statements */
|
|
129
|
-
|
|
130
125
|
|
|
131
126
|
exports.buildSourceCode = buildSourceCode;
|
|
@@ -7,10 +7,6 @@ exports.showMenu = exports.runSubCmd = exports.devStorybook = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _utils = require("@modern-js/utils");
|
|
9
9
|
|
|
10
|
-
var _chalk = _interopRequireDefault(require("chalk"));
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
10
|
const inquirer = _utils.Import.lazy('inquirer', require);
|
|
15
11
|
|
|
16
12
|
const color = _utils.Import.lazy('../../utils/color', require);
|
|
@@ -20,7 +16,7 @@ const showMenu = async (api, config) => {
|
|
|
20
16
|
const metas = await runners.moduleToolsMenu(undefined);
|
|
21
17
|
|
|
22
18
|
if (metas.length <= 0) {
|
|
23
|
-
console.info(
|
|
19
|
+
console.info(_utils.chalk.yellow('No runnable development features found.\nYou can use the `new` command to enable the development features')); // eslint-disable-next-line no-process-exit
|
|
24
20
|
|
|
25
21
|
process.exit(0);
|
|
26
22
|
}
|
|
@@ -51,7 +47,7 @@ const devStorybook = async (api, config) => {
|
|
|
51
47
|
if (findStorybook) {
|
|
52
48
|
await findStorybook.runTask(config);
|
|
53
49
|
} else {
|
|
54
|
-
console.info(
|
|
50
|
+
console.info(_utils.chalk.yellow('No development features found.\nYou can use the `new` command to enable the development features')); // eslint-disable-next-line no-process-exit
|
|
55
51
|
|
|
56
52
|
process.exit(0);
|
|
57
53
|
}
|
|
@@ -17,8 +17,6 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
17
17
|
|
|
18
18
|
const babelCompiler = _utils.Import.lazy('@modern-js/babel-compiler', require);
|
|
19
19
|
|
|
20
|
-
const glob = _utils.Import.lazy('glob', require);
|
|
21
|
-
|
|
22
20
|
const argv = _utils.Import.lazy('process.argv', require);
|
|
23
21
|
|
|
24
22
|
const core = _utils.Import.lazy('@modern-js/core', require);
|
|
@@ -79,10 +77,12 @@ const getWillCompilerCode = (srcDirOrFile, option) => {
|
|
|
79
77
|
|
|
80
78
|
const exts = getExts(isTsProject);
|
|
81
79
|
const globPattern = `${srcDirOrFile}/**/*{${exts.join(',')}}`;
|
|
82
|
-
|
|
80
|
+
|
|
81
|
+
const files = _utils.glob.sync(globPattern, {
|
|
83
82
|
ignore: [`${srcDirOrFile}/**/*.d.ts`],
|
|
84
83
|
absolute: true
|
|
85
84
|
});
|
|
85
|
+
|
|
86
86
|
return files;
|
|
87
87
|
};
|
|
88
88
|
|
|
@@ -14,8 +14,6 @@ const core = _utils.Import.lazy('@modern-js/core', require);
|
|
|
14
14
|
|
|
15
15
|
const compiler = _utils.Import.lazy('@modern-js/style-compiler', require);
|
|
16
16
|
|
|
17
|
-
const glob = _utils.Import.lazy('glob', require);
|
|
18
|
-
|
|
19
17
|
const hooks = _utils.Import.lazy('../hooks', require);
|
|
20
18
|
|
|
21
19
|
const STYLE_DIRS = 'styles';
|
|
@@ -61,7 +59,7 @@ const copyOriginStyleFiles = ({
|
|
|
61
59
|
targetDir,
|
|
62
60
|
outputDir
|
|
63
61
|
}) => {
|
|
64
|
-
const styleFiles = glob.sync(`${targetDir}/**/*.{css,sass,scss,less}`);
|
|
62
|
+
const styleFiles = _utils.glob.sync(`${targetDir}/**/*.{css,sass,scss,less}`);
|
|
65
63
|
|
|
66
64
|
if (styleFiles.length > 0) {
|
|
67
65
|
_utils.fs.ensureDirSync(outputDir);
|
|
@@ -8,7 +8,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
8
8
|
|
|
9
9
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
10
10
|
|
|
11
|
-
/* eslint-disable max-statements */
|
|
12
11
|
const logger = _utils.Import.lazy('../features/build/logger', require);
|
|
13
12
|
|
|
14
13
|
const cssConfig = _utils.Import.lazy('@modern-js/css-config', require);
|
|
@@ -19,8 +18,6 @@ const core = _utils.Import.lazy('@modern-js/core', require);
|
|
|
19
18
|
|
|
20
19
|
const compiler = _utils.Import.lazy('@modern-js/style-compiler', require);
|
|
21
20
|
|
|
22
|
-
const glob = _utils.Import.lazy('glob', require);
|
|
23
|
-
|
|
24
21
|
const STYLE_DIRS = 'styles';
|
|
25
22
|
const SRC_STYLE_DIRS = 'src';
|
|
26
23
|
|
|
@@ -60,7 +57,7 @@ const copyOriginStyleFiles = ({
|
|
|
60
57
|
targetDir,
|
|
61
58
|
outputDir
|
|
62
59
|
}) => {
|
|
63
|
-
const styleFiles = glob.sync(`${targetDir}/**/*.{css,sass,scss,less}`);
|
|
60
|
+
const styleFiles = _utils.glob.sync(`${targetDir}/**/*.{css,sass,scss,less}`);
|
|
64
61
|
|
|
65
62
|
if (styleFiles.length > 0) {
|
|
66
63
|
_utils.fs.ensureDirSync(outputDir);
|
|
@@ -232,5 +229,4 @@ const taskMain = async ({
|
|
|
232
229
|
console.error(e);
|
|
233
230
|
}
|
|
234
231
|
});
|
|
235
|
-
})();
|
|
236
|
-
/* eslint-enable max-statements */
|
|
232
|
+
})();
|
|
@@ -10,8 +10,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
10
10
|
|
|
11
11
|
const argv = _utils.Import.lazy('process.argv', require);
|
|
12
12
|
|
|
13
|
-
const glob = _utils.Import.lazy('glob', require);
|
|
14
|
-
|
|
15
13
|
const core = _utils.Import.lazy('@modern-js/core', require);
|
|
16
14
|
|
|
17
15
|
const copyUtils = _utils.Import.lazy('../utils/copy', require);
|
|
@@ -23,7 +21,7 @@ const copyAssets = ({
|
|
|
23
21
|
targetDir,
|
|
24
22
|
outputDir
|
|
25
23
|
}) => {
|
|
26
|
-
const assetsFiles = glob.sync(`${targetDir}/**/*.*`, {
|
|
24
|
+
const assetsFiles = _utils.glob.sync(`${targetDir}/**/*.*`, {
|
|
27
25
|
ignore: ['**/*.{js,jsx,ts,tsx,d.ts,scss,less,css,sass}']
|
|
28
26
|
});
|
|
29
27
|
|
|
@@ -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 execa = _utils.Import.lazy('execa', require);
|
|
10
|
-
|
|
11
9
|
const JSON5 = _utils.Import.lazy('json5', require);
|
|
12
10
|
|
|
13
11
|
const argv = _utils.Import.lazy('process.argv', require);
|
|
@@ -73,7 +71,7 @@ const generatorDts = async (_, config) => {
|
|
|
73
71
|
removeTsconfigPath = willDeleteTsconfigPath;
|
|
74
72
|
const tscBinFile = (0, _utils2.getTscBinPath)(appDirectory);
|
|
75
73
|
const watchParams = watch ? ['-w'] : [];
|
|
76
|
-
const childProgress = execa(tscBinFile, ['-p', willDeleteTsconfigPath, ...watchParams], {
|
|
74
|
+
const childProgress = (0, _utils.execa)(tscBinFile, ['-p', willDeleteTsconfigPath, ...watchParams], {
|
|
77
75
|
stdio: 'pipe',
|
|
78
76
|
cwd: appDirectory
|
|
79
77
|
});
|
|
@@ -9,6 +9,8 @@ var path = _interopRequireWildcard(require("path"));
|
|
|
9
9
|
|
|
10
10
|
var _utils = require("@modern-js/utils");
|
|
11
11
|
|
|
12
|
+
var _lodash = require("@modern-js/utils/lodash");
|
|
13
|
+
|
|
12
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
15
|
|
|
14
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -19,16 +21,12 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
19
21
|
|
|
20
22
|
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; }
|
|
21
23
|
|
|
22
|
-
const glob = _utils.Import.lazy('glob', require);
|
|
23
|
-
|
|
24
24
|
const babel = _utils.Import.lazy('../../utils/babel', require);
|
|
25
25
|
|
|
26
26
|
const tsPathsTransform = _utils.Import.lazy('../../utils/tspaths-transform', require);
|
|
27
27
|
|
|
28
28
|
const constants = _utils.Import.lazy('../constants', require);
|
|
29
29
|
|
|
30
|
-
const deepMerge = _utils.Import.lazy('lodash.merge', require);
|
|
31
|
-
|
|
32
30
|
const generatorTsConfig = (projectTsconfig, {
|
|
33
31
|
appDirectory,
|
|
34
32
|
distDir,
|
|
@@ -69,7 +67,7 @@ const generatorTsConfig = (projectTsconfig, {
|
|
|
69
67
|
|
|
70
68
|
_utils.fs.ensureFileSync(tempTsconfigPath);
|
|
71
69
|
|
|
72
|
-
_utils.fs.writeJSONSync(tempTsconfigPath,
|
|
70
|
+
_utils.fs.writeJSONSync(tempTsconfigPath, (0, _lodash.merge)(recommendOption, projectTsconfig, // 此处是必须要覆盖用户默认配置
|
|
73
71
|
resetConfig));
|
|
74
72
|
|
|
75
73
|
return tempTsconfigPath;
|
|
@@ -85,7 +83,7 @@ const resolveAlias = (modernConfig, config, watchFilenames = []) => {
|
|
|
85
83
|
'@': ['./src']
|
|
86
84
|
};
|
|
87
85
|
const dtsDistPath = `${config.distDir}/**/*.d.ts`;
|
|
88
|
-
const dtsFilenames = watchFilenames.length > 0 ? watchFilenames : glob.sync(dtsDistPath, {
|
|
86
|
+
const dtsFilenames = watchFilenames.length > 0 ? watchFilenames : _utils.glob.sync(dtsDistPath, {
|
|
89
87
|
absolute: true
|
|
90
88
|
});
|
|
91
89
|
const alias = babel.getFinalAlias(modernConfig, {
|
|
@@ -23,8 +23,7 @@ const globby = _utils.Import.lazy('globby', require);
|
|
|
23
23
|
|
|
24
24
|
const fastGlob = _utils.Import.lazy('fast-glob', require);
|
|
25
25
|
|
|
26
|
-
const normalizePath = _utils.Import.lazy('normalize-path', require);
|
|
27
|
-
|
|
26
|
+
const normalizePath = _utils.Import.lazy('normalize-path', require);
|
|
28
27
|
|
|
29
28
|
const copyTask = async option => {
|
|
30
29
|
const {
|
|
@@ -11,8 +11,6 @@ var _utils = require("@modern-js/utils");
|
|
|
11
11
|
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
|
|
14
|
-
const chalk = _utils.Import.lazy('chalk', require);
|
|
15
|
-
|
|
16
14
|
const clearFlag = '\x1Bc';
|
|
17
15
|
exports.clearFlag = clearFlag;
|
|
18
16
|
|
|
@@ -89,16 +87,16 @@ class LoggerManager extends _events.default {
|
|
|
89
87
|
error: true
|
|
90
88
|
},
|
|
91
89
|
colors = {
|
|
92
|
-
data: chalk.green,
|
|
93
|
-
error: chalk.red,
|
|
94
|
-
warning: chalk.yellow
|
|
90
|
+
data: _utils.chalk.green,
|
|
91
|
+
error: _utils.chalk.red,
|
|
92
|
+
warning: _utils.chalk.yellow
|
|
95
93
|
}
|
|
96
94
|
} = config;
|
|
97
95
|
|
|
98
96
|
if (event.data) {
|
|
99
97
|
stdout === null || stdout === void 0 ? void 0 : stdout.on('data', chunk => {
|
|
100
98
|
const data = chunk.toString();
|
|
101
|
-
const content = colors.data ? colors.data(data) : chalk.green(data);
|
|
99
|
+
const content = colors.data ? colors.data(data) : _utils.chalk.green(data);
|
|
102
100
|
loggerText.append(content);
|
|
103
101
|
this.emit('data');
|
|
104
102
|
});
|
|
@@ -107,7 +105,7 @@ class LoggerManager extends _events.default {
|
|
|
107
105
|
if (event.error) {
|
|
108
106
|
stdout === null || stdout === void 0 ? void 0 : stdout.on('error', error => {
|
|
109
107
|
const data = error.message;
|
|
110
|
-
const content = colors.error ? colors.error(data) : chalk.red(data);
|
|
108
|
+
const content = colors.error ? colors.error(data) : _utils.chalk.red(data);
|
|
111
109
|
loggerText.append(content);
|
|
112
110
|
this.emit('data');
|
|
113
111
|
});
|
package/dist/types/cli/dev.d.ts
CHANGED
package/dist/types/cli/new.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Command } from '@modern-js/utils';
|
|
2
2
|
export declare const newCli: (program: Command, locale?: string | undefined) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NormalizedConfig } from '@modern-js/core';
|
|
1
|
+
import type { NormalizedConfig } from '@modern-js/core';
|
|
2
2
|
import { IPackageModeValue } from '../types';
|
|
3
3
|
export declare const getFinalAlias: any;
|
|
4
4
|
export declare const resolveBabelConfig: (appDirectory: string, modernConfig: NormalizedConfig, option: Pick<IPackageModeValue, 'syntax' | 'type'> & {
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.4.
|
|
14
|
+
"version": "1.4.5",
|
|
15
15
|
"bin": {
|
|
16
16
|
"modern": "./bin/modern.js"
|
|
17
17
|
},
|
|
@@ -56,26 +56,22 @@
|
|
|
56
56
|
"@babel/types": "^7.17.0",
|
|
57
57
|
"@modern-js/babel-compiler": "^1.2.2",
|
|
58
58
|
"@modern-js/babel-preset-module": "^1.3.1",
|
|
59
|
-
"@modern-js/core": "^1.
|
|
59
|
+
"@modern-js/core": "^1.7.0",
|
|
60
60
|
"@modern-js/css-config": "^1.2.3",
|
|
61
61
|
"@modern-js/i18n-cli-language-detector": "^1.2.1",
|
|
62
|
-
"@modern-js/new-action": "^1.3.
|
|
62
|
+
"@modern-js/new-action": "^1.3.5",
|
|
63
63
|
"@modern-js/plugin": "^1.3.2",
|
|
64
|
-
"@modern-js/plugin-analyze": "^1.3.
|
|
64
|
+
"@modern-js/plugin-analyze": "^1.3.6",
|
|
65
65
|
"@modern-js/plugin-changeset": "^1.2.4",
|
|
66
66
|
"@modern-js/plugin-fast-refresh": "^1.2.3",
|
|
67
|
-
"@modern-js/plugin-i18n": "^1.2.
|
|
68
|
-
"@modern-js/style-compiler": "^1.2.
|
|
69
|
-
"@modern-js/utils": "^1.
|
|
70
|
-
"chalk": "^4.1.2",
|
|
67
|
+
"@modern-js/plugin-i18n": "^1.2.3",
|
|
68
|
+
"@modern-js/style-compiler": "^1.2.3",
|
|
69
|
+
"@modern-js/utils": "^1.4.0",
|
|
71
70
|
"dotenv": "^10.0.0",
|
|
72
|
-
"execa": "^5.1.1",
|
|
73
71
|
"fast-glob": "^3.2.5",
|
|
74
|
-
"glob": "^7.1.7",
|
|
75
72
|
"globby": "^11",
|
|
76
73
|
"inquirer": "^8.1.5",
|
|
77
74
|
"json5": "^2.2.0",
|
|
78
|
-
"lodash.merge": "^4.6.2",
|
|
79
75
|
"normalize-path": "^3.0.0",
|
|
80
76
|
"p-map": "^4",
|
|
81
77
|
"process.argv": "^0.6.0",
|
|
@@ -92,12 +88,10 @@
|
|
|
92
88
|
"@types/glob": "^7.1.4",
|
|
93
89
|
"@types/inquirer": "^8.1.1",
|
|
94
90
|
"@types/jest": "^26",
|
|
95
|
-
"@types/lodash.merge": "^4.6.6",
|
|
96
91
|
"@types/node": "^14",
|
|
97
92
|
"@types/normalize-path": "^3.0.0",
|
|
98
93
|
"@types/react": "^17",
|
|
99
94
|
"@types/react-dom": "^17",
|
|
100
|
-
"commander": "^8.1.0",
|
|
101
95
|
"jest": "^27",
|
|
102
96
|
"typescript": "^4"
|
|
103
97
|
},
|
package/tests/dev-cli.test.ts
CHANGED
|
@@ -9,17 +9,6 @@ jest.mock('@modern-js/core', () => ({
|
|
|
9
9
|
},
|
|
10
10
|
}));
|
|
11
11
|
jest.mock('process.argv', () => () => (o: any) => ({ ...o, tsCheck: false }));
|
|
12
|
-
jest.mock('execa', () => () => {
|
|
13
|
-
// eslint-disable-next-line prefer-promise-reject-errors
|
|
14
|
-
const fn = Promise.reject('error');
|
|
15
|
-
(fn as any).stdout = {
|
|
16
|
-
on: () => 0,
|
|
17
|
-
};
|
|
18
|
-
(fn as any).stderr = {
|
|
19
|
-
on: () => 0,
|
|
20
|
-
};
|
|
21
|
-
return fn;
|
|
22
|
-
});
|
|
23
12
|
jest.mock('../src/tasks/generator-dts/utils');
|
|
24
13
|
jest.mock('@modern-js/utils', () => {
|
|
25
14
|
const originalModule = jest.requireActual('@modern-js/utils');
|