@modern-js/monorepo-tools 2.15.0 → 2.17.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 +38 -0
- package/dist/cjs/cli/build.js +10 -31
- package/dist/cjs/cli/buildWatch.js +11 -31
- package/dist/cjs/cli/clear.js +11 -31
- package/dist/cjs/cli/deploy.js +14 -36
- package/dist/cjs/cli/index.js +23 -22
- package/dist/cjs/cli/install.js +11 -31
- package/dist/cjs/cli/new.js +17 -37
- package/dist/cjs/commands/build.js +21 -46
- package/dist/cjs/commands/buildWatch.js +19 -36
- package/dist/cjs/commands/clear.js +17 -34
- package/dist/cjs/commands/deploy.js +25 -41
- package/dist/cjs/commands/index.js +22 -21
- package/dist/cjs/commands/install.js +19 -36
- package/dist/cjs/constants.js +13 -26
- package/dist/cjs/dag/create.js +16 -28
- package/dist/cjs/dag/edgeManager.js +24 -28
- package/dist/cjs/dag/index.js +11 -29
- package/dist/cjs/dag/operator.js +106 -123
- package/dist/cjs/dag/task.js +52 -63
- package/dist/cjs/dag/utils.js +52 -49
- package/dist/cjs/features/build/index.js +52 -68
- package/dist/cjs/features/clear/index.js +66 -47
- package/dist/cjs/features/deploy/index.js +126 -96
- package/dist/cjs/features/dev/cmds.js +10 -25
- package/dist/cjs/features/dev/createTask.js +93 -56
- package/dist/cjs/features/dev/index.js +43 -71
- package/dist/cjs/features/dev/watchProjectsState.js +89 -64
- package/dist/cjs/features/install/index.js +74 -63
- package/dist/cjs/hooks/index.js +9 -27
- package/dist/cjs/index.js +36 -53
- package/dist/cjs/locale/en.js +7 -25
- package/dist/cjs/locale/index.js +18 -28
- package/dist/cjs/locale/zh.js +7 -25
- package/dist/cjs/log/error.js +7 -25
- package/dist/cjs/log/multiTasksLog.js +42 -43
- package/dist/cjs/log/time.js +19 -29
- package/dist/cjs/log/utils.js +7 -25
- package/dist/cjs/package/index.js +28 -30
- package/dist/cjs/parse-config/index.js +61 -49
- package/dist/cjs/parse-config/monorepo.js +81 -67
- package/dist/cjs/projects/checkProjectChange.js +95 -73
- package/dist/cjs/projects/clearMemoryFiles.js +52 -44
- package/dist/cjs/projects/getProjects.js +38 -65
- package/dist/cjs/projects/getProjectsByPackagesConfig.js +93 -71
- package/dist/cjs/projects/getProjectsByWorkspaceFile.js +89 -85
- package/dist/cjs/type.js +4 -15
- package/dist/cjs/utils/install.js +69 -44
- package/dist/cjs/utils/types.js +4 -15
- package/dist/esm/cli/build.js +2 -8
- package/dist/esm/cli/buildWatch.js +4 -9
- package/dist/esm/cli/clear.js +4 -9
- package/dist/esm/cli/deploy.js +7 -14
- package/dist/esm/cli/install.js +4 -9
- package/dist/esm/cli/new.js +9 -14
- package/dist/esm/commands/build.js +7 -17
- package/dist/esm/commands/buildWatch.js +6 -8
- package/dist/esm/commands/clear.js +6 -8
- package/dist/esm/commands/deploy.js +10 -11
- package/dist/esm/commands/install.js +6 -8
- package/dist/esm/constants.js +2 -6
- package/dist/esm/dag/create.js +10 -7
- package/dist/esm/dag/edgeManager.js +17 -6
- package/dist/esm/dag/index.js +1 -4
- package/dist/esm/dag/operator.js +77 -74
- package/dist/esm/dag/task.js +39 -30
- package/dist/esm/dag/utils.js +39 -27
- package/dist/esm/features/build/index.js +22 -27
- package/dist/esm/features/clear/index.js +4 -6
- package/dist/esm/features/deploy/index.js +55 -50
- package/dist/esm/features/dev/cmds.js +4 -4
- package/dist/esm/features/dev/createTask.js +31 -15
- package/dist/esm/features/dev/index.js +19 -27
- package/dist/esm/features/dev/watchProjectsState.js +41 -31
- package/dist/esm/features/install/index.js +11 -15
- package/dist/esm/hooks/index.js +1 -4
- package/dist/esm/index.js +12 -11
- package/dist/esm/locale/en.js +1 -4
- package/dist/esm/locale/index.js +5 -5
- package/dist/esm/locale/zh.js +1 -4
- package/dist/esm/log/error.js +1 -4
- package/dist/esm/log/multiTasksLog.js +32 -18
- package/dist/esm/log/time.js +7 -8
- package/dist/esm/log/utils.js +1 -4
- package/dist/esm/package/index.js +21 -8
- package/dist/esm/parse-config/index.js +11 -14
- package/dist/esm/parse-config/monorepo.js +20 -27
- package/dist/esm/projects/checkProjectChange.js +19 -23
- package/dist/esm/projects/clearMemoryFiles.js +3 -13
- package/dist/esm/projects/getProjects.js +21 -45
- package/dist/esm/projects/getProjectsByPackagesConfig.js +29 -33
- package/dist/esm/projects/getProjectsByWorkspaceFile.js +21 -41
- package/dist/esm/type.js +1 -0
- package/dist/esm/utils/install.js +12 -8
- package/dist/esm/utils/types.js +1 -0
- package/package.json +16 -12
|
@@ -1,66 +1,78 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
var install_exports = {};
|
|
29
|
-
__export(install_exports, {
|
|
30
|
-
runInstallTask: () => runInstallTask
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "runInstallTask", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: () => runInstallTask
|
|
31
8
|
});
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
9
|
+
const _path = /* @__PURE__ */ _interop_require_wildcard(require("path"));
|
|
10
|
+
const _utils = require("@modern-js/utils");
|
|
11
|
+
const _nodecorelibrary = require("@rushstack/node-core-library");
|
|
12
|
+
const _constants = require("../../constants");
|
|
13
|
+
const _install = require("../../utils/install");
|
|
14
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
15
|
+
if (typeof WeakMap !== "function")
|
|
16
|
+
return null;
|
|
17
|
+
var cacheBabelInterop = /* @__PURE__ */ new WeakMap();
|
|
18
|
+
var cacheNodeInterop = /* @__PURE__ */ new WeakMap();
|
|
19
|
+
return (_getRequireWildcardCache = function(nodeInterop2) {
|
|
20
|
+
return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
|
|
21
|
+
})(nodeInterop);
|
|
22
|
+
}
|
|
23
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
24
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
25
|
+
return obj;
|
|
26
|
+
}
|
|
27
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
28
|
+
return {
|
|
29
|
+
default: obj
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
33
|
+
if (cache && cache.has(obj)) {
|
|
34
|
+
return cache.get(obj);
|
|
35
|
+
}
|
|
36
|
+
var newObj = {};
|
|
37
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
38
|
+
for (var key in obj) {
|
|
39
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
40
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
41
|
+
if (desc && (desc.get || desc.set)) {
|
|
42
|
+
Object.defineProperty(newObj, key, desc);
|
|
43
|
+
} else {
|
|
44
|
+
newObj[key] = obj[key];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
newObj.default = obj;
|
|
49
|
+
if (cache) {
|
|
50
|
+
cache.set(obj, newObj);
|
|
51
|
+
}
|
|
52
|
+
return newObj;
|
|
53
|
+
}
|
|
54
|
+
const replaceWorkspaces = ({ rootPath, projectsInWorkspaces }) => {
|
|
55
|
+
const pnpmWsFilePath = _path.join(rootPath, _constants.WORKSPACE_FILE.PNPM);
|
|
56
|
+
if (_utils.fs.existsSync(pnpmWsFilePath)) {
|
|
57
|
+
const pnpmWorkspace = _utils.fs.readFileSync(pnpmWsFilePath, "utf-8");
|
|
58
|
+
const originalPnpmWorkspaces = _utils.yaml.load(pnpmWorkspace);
|
|
59
|
+
_utils.fs.writeFileSync(pnpmWsFilePath, _utils.yaml.dump({
|
|
60
|
+
packages: projectsInWorkspaces
|
|
61
|
+
}));
|
|
51
62
|
return () => {
|
|
52
|
-
|
|
63
|
+
_utils.yaml.dump(originalPnpmWorkspaces);
|
|
53
64
|
};
|
|
54
65
|
}
|
|
55
|
-
const pkgFilePath =
|
|
56
|
-
if (
|
|
57
|
-
|
|
58
|
-
|
|
66
|
+
const pkgFilePath = _path.join(rootPath, _constants.WORKSPACE_FILE.YARN);
|
|
67
|
+
if (_utils.fs.existsSync(pkgFilePath)) {
|
|
68
|
+
var _pkg_workspaces;
|
|
69
|
+
const pkg = _nodecorelibrary.JsonFile.load(pkgFilePath);
|
|
70
|
+
if (pkg === null || pkg === void 0 ? void 0 : (_pkg_workspaces = pkg.workspaces) === null || _pkg_workspaces === void 0 ? void 0 : _pkg_workspaces.packages) {
|
|
59
71
|
const originalPkg = pkg;
|
|
60
72
|
pkg.workspaces.packages = projectsInWorkspaces;
|
|
61
|
-
|
|
73
|
+
_nodecorelibrary.JsonFile.save(pkg, pkgFilePath);
|
|
62
74
|
return () => {
|
|
63
|
-
|
|
75
|
+
_nodecorelibrary.JsonFile.save(originalPkg, pkgFilePath);
|
|
64
76
|
};
|
|
65
77
|
}
|
|
66
78
|
}
|
|
@@ -77,8 +89,8 @@ const runInstallTask = async (projectNames, operator, config) => {
|
|
|
77
89
|
const allDeps = operator.getNodeAllDependencyData(projectName);
|
|
78
90
|
projectsInWorkspaces = [
|
|
79
91
|
...projectsInWorkspaces,
|
|
80
|
-
|
|
81
|
-
...allDeps.map((p) =>
|
|
92
|
+
_path.relative(rootPath, operator.getNodeData(projectName).extra.path),
|
|
93
|
+
...allDeps.map((p) => _path.relative(rootPath, p.extra.path))
|
|
82
94
|
];
|
|
83
95
|
}
|
|
84
96
|
const noDupProjectList = Array.from(new Set(projectsInWorkspaces));
|
|
@@ -86,12 +98,11 @@ const runInstallTask = async (projectNames, operator, config) => {
|
|
|
86
98
|
rootPath,
|
|
87
99
|
projectsInWorkspaces: noDupProjectList
|
|
88
100
|
});
|
|
89
|
-
await (0,
|
|
101
|
+
await (0, _install.installByPackageManager)(packageManager, {
|
|
102
|
+
rootPath,
|
|
103
|
+
removeLock: true
|
|
104
|
+
});
|
|
90
105
|
if (restorWorkspace) {
|
|
91
106
|
restorWorkspace();
|
|
92
107
|
}
|
|
93
108
|
};
|
|
94
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
95
|
-
0 && (module.exports = {
|
|
96
|
-
runInstallTask
|
|
97
|
-
});
|
package/dist/cjs/hooks/index.js
CHANGED
|
@@ -1,31 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var hooks_exports = {};
|
|
19
|
-
__export(hooks_exports, {
|
|
20
|
-
hooks: () => hooks
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
21
4
|
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
5
|
+
Object.defineProperty(exports, "hooks", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: () => hooks
|
|
8
|
+
});
|
|
9
|
+
const _plugin = require("@modern-js/plugin");
|
|
10
|
+
const afterMonorepoDeploy = (0, _plugin.createAsyncWorkflow)();
|
|
25
11
|
const hooks = {
|
|
26
12
|
afterMonorepoDeploy
|
|
27
13
|
};
|
|
28
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
-
0 && (module.exports = {
|
|
30
|
-
hooks
|
|
31
|
-
});
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,63 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
var src_exports = {};
|
|
29
|
-
__export(src_exports, {
|
|
30
|
-
default: () => src_default
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
31
4
|
});
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
)
|
|
44
|
-
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: () => _default
|
|
8
|
+
});
|
|
9
|
+
const _pluginchangeset = /* @__PURE__ */ _interop_require_default(require("@modern-js/plugin-changeset"));
|
|
10
|
+
const _pluginlint = /* @__PURE__ */ _interop_require_default(require("@modern-js/plugin-lint"));
|
|
11
|
+
const _utils = require("@modern-js/utils");
|
|
12
|
+
const _languagedetector = require("@modern-js/plugin-i18n/language-detector");
|
|
13
|
+
const _locale = require("./locale");
|
|
14
|
+
const _cli = require("./cli");
|
|
15
|
+
const _hooks = require("./hooks");
|
|
16
|
+
function _interop_require_default(obj) {
|
|
17
|
+
return obj && obj.__esModule ? obj : {
|
|
18
|
+
default: obj
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const upgradeModel = _utils.Import.lazy("@modern-js/upgrade", require);
|
|
22
|
+
const _default = () => ({
|
|
45
23
|
name: "@modern-js/monorepo-tools",
|
|
46
|
-
usePlugins: [
|
|
47
|
-
|
|
24
|
+
usePlugins: [
|
|
25
|
+
(0, _pluginchangeset.default)(),
|
|
26
|
+
(0, _pluginlint.default)()
|
|
27
|
+
],
|
|
28
|
+
registerHook: _hooks.hooks,
|
|
48
29
|
setup: (api) => {
|
|
49
|
-
const locale = (0,
|
|
50
|
-
|
|
30
|
+
const locale = (0, _languagedetector.getLocaleLanguage)();
|
|
31
|
+
_locale.i18n.changeLanguage({
|
|
32
|
+
locale
|
|
33
|
+
});
|
|
51
34
|
return {
|
|
52
35
|
commands({ program }) {
|
|
53
|
-
(0,
|
|
54
|
-
(0,
|
|
55
|
-
(0,
|
|
36
|
+
(0, _cli.clearCli)(program, api);
|
|
37
|
+
(0, _cli.deployCli)(program, api);
|
|
38
|
+
(0, _cli.newCli)(program, locale);
|
|
56
39
|
upgradeModel.defineCommand(program.command("upgrade"));
|
|
57
40
|
}
|
|
58
41
|
};
|
|
59
42
|
},
|
|
60
|
-
post: [
|
|
43
|
+
post: [
|
|
44
|
+
"@modern-js/plugin-changeset"
|
|
45
|
+
]
|
|
61
46
|
});
|
|
62
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
63
|
-
0 && (module.exports = {});
|
package/dist/cjs/locale/en.js
CHANGED
|
@@ -1,25 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var en_exports = {};
|
|
19
|
-
__export(en_exports, {
|
|
20
|
-
EN_LOCALE: () => EN_LOCALE
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "EN_LOCALE", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: () => EN_LOCALE
|
|
21
8
|
});
|
|
22
|
-
module.exports = __toCommonJS(en_exports);
|
|
23
9
|
const EN_LOCALE = {
|
|
24
10
|
command: {
|
|
25
11
|
new: {
|
|
@@ -33,7 +19,3 @@ const EN_LOCALE = {
|
|
|
33
19
|
}
|
|
34
20
|
}
|
|
35
21
|
};
|
|
36
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
-
0 && (module.exports = {
|
|
38
|
-
EN_LOCALE
|
|
39
|
-
});
|
package/dist/cjs/locale/index.js
CHANGED
|
@@ -1,33 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
6
|
for (var name in all)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var locale_exports = {};
|
|
19
|
-
__export(locale_exports, {
|
|
7
|
+
Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name]
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
20
13
|
i18n: () => i18n,
|
|
21
14
|
localeKeys: () => localeKeys
|
|
22
15
|
});
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
0 && (module.exports = {
|
|
31
|
-
i18n,
|
|
32
|
-
localeKeys
|
|
16
|
+
const _plugini18n = require("@modern-js/plugin-i18n");
|
|
17
|
+
const _zh = require("./zh");
|
|
18
|
+
const _en = require("./en");
|
|
19
|
+
const i18n = new _plugini18n.I18n();
|
|
20
|
+
const localeKeys = i18n.init("en", {
|
|
21
|
+
zh: _zh.ZH_LOCALE,
|
|
22
|
+
en: _en.EN_LOCALE
|
|
33
23
|
});
|
package/dist/cjs/locale/zh.js
CHANGED
|
@@ -1,25 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var zh_exports = {};
|
|
19
|
-
__export(zh_exports, {
|
|
20
|
-
ZH_LOCALE: () => ZH_LOCALE
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "ZH_LOCALE", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: () => ZH_LOCALE
|
|
21
8
|
});
|
|
22
|
-
module.exports = __toCommonJS(zh_exports);
|
|
23
9
|
const ZH_LOCALE = {
|
|
24
10
|
command: {
|
|
25
11
|
new: {
|
|
@@ -33,7 +19,3 @@ const ZH_LOCALE = {
|
|
|
33
19
|
}
|
|
34
20
|
}
|
|
35
21
|
};
|
|
36
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
-
0 && (module.exports = {
|
|
38
|
-
ZH_LOCALE
|
|
39
|
-
});
|
package/dist/cjs/log/error.js
CHANGED
|
@@ -1,29 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var error_exports = {};
|
|
19
|
-
__export(error_exports, {
|
|
20
|
-
errorLog: () => errorLog
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "errorLog", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: () => errorLog
|
|
21
8
|
});
|
|
22
|
-
module.exports = __toCommonJS(error_exports);
|
|
23
9
|
const errorLog = (...rest) => {
|
|
24
10
|
throw new Error(rest.join("\n"));
|
|
25
11
|
};
|
|
26
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
27
|
-
0 && (module.exports = {
|
|
28
|
-
errorLog
|
|
29
|
-
});
|
|
@@ -1,27 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var multiTasksLog_exports = {};
|
|
19
|
-
__export(multiTasksLog_exports, {
|
|
20
|
-
MultitasksLogger: () => MultitasksLogger
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
21
4
|
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
5
|
+
Object.defineProperty(exports, "MultitasksLogger", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: () => MultitasksLogger
|
|
8
|
+
});
|
|
9
|
+
const _utils = require("@modern-js/utils");
|
|
10
|
+
const _utils1 = require("./utils");
|
|
11
|
+
function _define_property(obj, key, value) {
|
|
12
|
+
if (key in obj) {
|
|
13
|
+
Object.defineProperty(obj, key, {
|
|
14
|
+
value,
|
|
15
|
+
enumerable: true,
|
|
16
|
+
configurable: true,
|
|
17
|
+
writable: true
|
|
18
|
+
});
|
|
19
|
+
} else {
|
|
20
|
+
obj[key] = value;
|
|
21
|
+
}
|
|
22
|
+
return obj;
|
|
23
|
+
}
|
|
25
24
|
const createLogger = (name, config) => {
|
|
26
25
|
const options = {
|
|
27
26
|
scope: config.label ? config.label + name : name,
|
|
@@ -33,30 +32,27 @@ const createLogger = (name, config) => {
|
|
|
33
32
|
}
|
|
34
33
|
}
|
|
35
34
|
};
|
|
36
|
-
return new
|
|
35
|
+
return new _utils.Signale(options);
|
|
37
36
|
};
|
|
38
37
|
const createListenHandler = (name, config) => {
|
|
39
38
|
const logger = createLogger(name, config);
|
|
40
39
|
const stdout = (chunk) => {
|
|
41
|
-
logger.info((0,
|
|
40
|
+
logger.info((0, _utils1.formatLog)(chunk.toString()));
|
|
42
41
|
};
|
|
43
42
|
const stderr = (chunk) => {
|
|
44
43
|
logger.error(chunk.toString());
|
|
45
44
|
};
|
|
46
|
-
return {
|
|
45
|
+
return {
|
|
46
|
+
stdout,
|
|
47
|
+
stderr
|
|
48
|
+
};
|
|
47
49
|
};
|
|
48
50
|
class MultitasksLogger {
|
|
49
|
-
constructor() {
|
|
50
|
-
this._taskNameList = [];
|
|
51
|
-
this._taskStdoutListenerMap = /* @__PURE__ */ new Map();
|
|
52
|
-
this._taskStderrListenerMap = /* @__PURE__ */ new Map();
|
|
53
|
-
this._taskLogConfigMap = /* @__PURE__ */ new Map();
|
|
54
|
-
}
|
|
55
51
|
addLogProvider(name, config) {
|
|
56
|
-
var _a, _b;
|
|
57
52
|
if (this._taskNameList.includes(name)) {
|
|
58
|
-
|
|
59
|
-
(
|
|
53
|
+
var _this__taskStdoutListenerMap_get, _this__taskStderrListenerMap_get;
|
|
54
|
+
(_this__taskStdoutListenerMap_get = this._taskStdoutListenerMap.get(name)) === null || _this__taskStdoutListenerMap_get === void 0 ? void 0 : _this__taskStdoutListenerMap_get.removeAllListeners();
|
|
55
|
+
(_this__taskStderrListenerMap_get = this._taskStderrListenerMap.get(name)) === null || _this__taskStderrListenerMap_get === void 0 ? void 0 : _this__taskStderrListenerMap_get.removeAllListeners();
|
|
60
56
|
this._taskStdoutListenerMap.delete(name);
|
|
61
57
|
this._taskStderrListenerMap.delete(name);
|
|
62
58
|
}
|
|
@@ -67,10 +63,7 @@ class MultitasksLogger {
|
|
|
67
63
|
this.startListen(name);
|
|
68
64
|
}
|
|
69
65
|
startListen(taskName) {
|
|
70
|
-
const listenHandler = createListenHandler(
|
|
71
|
-
taskName,
|
|
72
|
-
this._taskLogConfigMap.get(taskName).logConfig
|
|
73
|
-
);
|
|
66
|
+
const listenHandler = createListenHandler(taskName, this._taskLogConfigMap.get(taskName).logConfig);
|
|
74
67
|
this._taskStdoutListenerMap.get(taskName).on("data", listenHandler.stdout);
|
|
75
68
|
this._taskStdoutListenerMap.get(taskName).on("error", listenHandler.stderr);
|
|
76
69
|
this._taskStderrListenerMap.get(taskName).on("data", listenHandler.stderr);
|
|
@@ -82,8 +75,14 @@ class MultitasksLogger {
|
|
|
82
75
|
}
|
|
83
76
|
finishListen() {
|
|
84
77
|
}
|
|
78
|
+
constructor() {
|
|
79
|
+
_define_property(this, "_taskNameList", void 0);
|
|
80
|
+
_define_property(this, "_taskStdoutListenerMap", void 0);
|
|
81
|
+
_define_property(this, "_taskStderrListenerMap", void 0);
|
|
82
|
+
_define_property(this, "_taskLogConfigMap", void 0);
|
|
83
|
+
this._taskNameList = [];
|
|
84
|
+
this._taskStdoutListenerMap = /* @__PURE__ */ new Map();
|
|
85
|
+
this._taskStderrListenerMap = /* @__PURE__ */ new Map();
|
|
86
|
+
this._taskLogConfigMap = /* @__PURE__ */ new Map();
|
|
87
|
+
}
|
|
85
88
|
}
|
|
86
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
87
|
-
0 && (module.exports = {
|
|
88
|
-
MultitasksLogger
|
|
89
|
-
});
|
package/dist/cjs/log/time.js
CHANGED
|
@@ -1,38 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
6
|
for (var name in all)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var time_exports = {};
|
|
19
|
-
__export(time_exports, {
|
|
20
|
-
endTime: () => endTime,
|
|
7
|
+
Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name]
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
21
13
|
initTimeLog: () => initTimeLog,
|
|
22
|
-
startTime: () => startTime
|
|
14
|
+
startTime: () => startTime,
|
|
15
|
+
endTime: () => endTime
|
|
16
|
+
});
|
|
17
|
+
const _utils = require("@modern-js/utils");
|
|
18
|
+
const initTimeLog = (option = {}) => new _utils.Signale({
|
|
19
|
+
interactive: true,
|
|
20
|
+
scope: "time-log",
|
|
21
|
+
...option
|
|
23
22
|
});
|
|
24
|
-
module.exports = __toCommonJS(time_exports);
|
|
25
|
-
var import_utils = require("@modern-js/utils");
|
|
26
|
-
const initTimeLog = (option = {}) => new import_utils.Signale({ interactive: true, scope: "time-log", ...option });
|
|
27
23
|
const startTime = (signaleInstance, prefix = "") => {
|
|
28
24
|
signaleInstance.time(prefix);
|
|
29
25
|
};
|
|
30
26
|
const endTime = (signaleInstance, prefix = "") => {
|
|
31
27
|
signaleInstance.timeEnd(prefix);
|
|
32
28
|
};
|
|
33
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
-
0 && (module.exports = {
|
|
35
|
-
endTime,
|
|
36
|
-
initTimeLog,
|
|
37
|
-
startTime
|
|
38
|
-
});
|