@modern-js/monorepo-tools 2.35.1 → 2.36.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/dist/cjs/cli/build.js +26 -9
- package/dist/cjs/cli/buildWatch.js +26 -9
- package/dist/cjs/cli/clear.js +26 -9
- package/dist/cjs/cli/deploy.js +26 -9
- package/dist/cjs/cli/index.js +30 -9
- package/dist/cjs/cli/install.js +26 -9
- package/dist/cjs/cli/new.js +29 -12
- package/dist/cjs/commands/build.js +33 -16
- package/dist/cjs/commands/buildWatch.js +32 -15
- package/dist/cjs/commands/clear.js +30 -13
- package/dist/cjs/commands/deploy.js +34 -17
- package/dist/cjs/commands/index.js +28 -8
- package/dist/cjs/commands/install.js +32 -15
- package/dist/cjs/constants.js +25 -15
- package/dist/cjs/dag/create.js +24 -7
- package/dist/cjs/dag/edgeManager.js +26 -9
- package/dist/cjs/dag/index.js +28 -11
- package/dist/cjs/dag/operator.js +58 -32
- package/dist/cjs/dag/task.js +46 -20
- package/dist/cjs/dag/utils.js +33 -25
- package/dist/cjs/features/build/index.js +51 -32
- package/dist/cjs/features/clear/index.js +47 -28
- package/dist/cjs/features/deploy/index.js +65 -39
- package/dist/cjs/features/dev/cmds.js +24 -7
- package/dist/cjs/features/dev/createTask.js +50 -31
- package/dist/cjs/features/dev/index.js +47 -21
- package/dist/cjs/features/dev/watchProjectsState.js +43 -17
- package/dist/cjs/features/install/index.js +53 -27
- package/dist/cjs/hooks/index.js +26 -9
- package/dist/cjs/index.js +45 -35
- package/dist/cjs/locale/en.js +24 -7
- package/dist/cjs/locale/index.js +31 -21
- package/dist/cjs/locale/zh.js +24 -7
- package/dist/cjs/log/error.js +24 -7
- package/dist/cjs/log/multiTasksLog.js +33 -16
- package/dist/cjs/log/time.js +29 -20
- package/dist/cjs/log/utils.js +24 -7
- package/dist/cjs/package/index.js +28 -11
- package/dist/cjs/parse-config/index.js +39 -13
- package/dist/cjs/parse-config/monorepo.js +55 -39
- package/dist/cjs/projects/checkProjectChange.js +65 -50
- package/dist/cjs/projects/clearMemoryFiles.js +39 -13
- package/dist/cjs/projects/getProjects.js +37 -27
- package/dist/cjs/projects/getProjectsByPackagesConfig.js +51 -33
- package/dist/cjs/projects/getProjectsByWorkspaceFile.js +59 -40
- package/dist/cjs/type.js +15 -3
- package/dist/cjs/utils/install.js +43 -24
- package/dist/cjs/utils/types.js +15 -3
- package/dist/esm/cli/build.js +4 -1
- package/dist/esm/cli/buildWatch.js +4 -1
- package/dist/esm/cli/clear.js +4 -1
- package/dist/esm/cli/deploy.js +4 -1
- package/dist/esm/cli/install.js +4 -1
- package/dist/esm/cli/new.js +4 -1
- package/dist/esm/commands/build.js +4 -1
- package/dist/esm/commands/buildWatch.js +4 -1
- package/dist/esm/commands/clear.js +4 -1
- package/dist/esm/commands/deploy.js +4 -1
- package/dist/esm/commands/install.js +4 -1
- package/dist/esm/constants.js +6 -2
- package/dist/esm/dag/create.js +4 -1
- package/dist/esm/dag/edgeManager.js +4 -1
- package/dist/esm/dag/index.js +4 -1
- package/dist/esm/dag/operator.js +4 -1
- package/dist/esm/dag/task.js +4 -1
- package/dist/esm/dag/utils.js +10 -4
- package/dist/esm/features/build/index.js +6 -2
- package/dist/esm/features/clear/index.js +6 -2
- package/dist/esm/features/deploy/index.js +4 -1
- package/dist/esm/features/dev/cmds.js +4 -1
- package/dist/esm/features/dev/createTask.js +6 -2
- package/dist/esm/features/dev/index.js +4 -1
- package/dist/esm/features/dev/watchProjectsState.js +4 -1
- package/dist/esm/features/install/index.js +4 -1
- package/dist/esm/hooks/index.js +4 -1
- package/dist/esm/index.js +6 -2
- package/dist/esm/locale/en.js +4 -1
- package/dist/esm/locale/index.js +4 -1
- package/dist/esm/locale/zh.js +4 -1
- package/dist/esm/log/error.js +4 -1
- package/dist/esm/log/multiTasksLog.js +4 -1
- package/dist/esm/log/time.js +8 -3
- package/dist/esm/log/utils.js +4 -1
- package/dist/esm/package/index.js +4 -1
- package/dist/esm/parse-config/index.js +4 -1
- package/dist/esm/parse-config/monorepo.js +12 -5
- package/dist/esm/projects/checkProjectChange.js +12 -5
- package/dist/esm/projects/clearMemoryFiles.js +4 -1
- package/dist/esm/projects/getProjects.js +6 -2
- package/dist/esm/projects/getProjectsByPackagesConfig.js +6 -2
- package/dist/esm/projects/getProjectsByWorkspaceFile.js +6 -2
- package/dist/esm/type.js +0 -1
- package/dist/esm/utils/install.js +6 -2
- package/dist/esm/utils/types.js +0 -1
- package/package.json +11 -11
|
@@ -1,16 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
9
15
|
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var multiTasksLog_exports = {};
|
|
20
|
+
__export(multiTasksLog_exports, {
|
|
21
|
+
MultitasksLogger: () => MultitasksLogger
|
|
10
22
|
});
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
23
|
+
module.exports = __toCommonJS(multiTasksLog_exports);
|
|
24
|
+
var import_define_property = require("@swc/helpers/_/_define_property");
|
|
25
|
+
var import_utils = require("@modern-js/utils");
|
|
26
|
+
var import_utils2 = require("./utils");
|
|
14
27
|
const createLogger = (name, config) => {
|
|
15
28
|
const options = {
|
|
16
29
|
scope: config.label ? config.label + name : name,
|
|
@@ -22,12 +35,12 @@ const createLogger = (name, config) => {
|
|
|
22
35
|
}
|
|
23
36
|
}
|
|
24
37
|
};
|
|
25
|
-
return new
|
|
38
|
+
return new import_utils.Signale(options);
|
|
26
39
|
};
|
|
27
40
|
const createListenHandler = (name, config) => {
|
|
28
41
|
const logger = createLogger(name, config);
|
|
29
42
|
const stdout = (chunk) => {
|
|
30
|
-
logger.info((0,
|
|
43
|
+
logger.info((0, import_utils2.formatLog)(chunk.toString()));
|
|
31
44
|
};
|
|
32
45
|
const stderr = (chunk) => {
|
|
33
46
|
logger.error(chunk.toString());
|
|
@@ -66,13 +79,17 @@ class MultitasksLogger {
|
|
|
66
79
|
finishListen() {
|
|
67
80
|
}
|
|
68
81
|
constructor() {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
82
|
+
(0, import_define_property._)(this, "_taskNameList", void 0);
|
|
83
|
+
(0, import_define_property._)(this, "_taskStdoutListenerMap", void 0);
|
|
84
|
+
(0, import_define_property._)(this, "_taskStderrListenerMap", void 0);
|
|
85
|
+
(0, import_define_property._)(this, "_taskLogConfigMap", void 0);
|
|
73
86
|
this._taskNameList = [];
|
|
74
87
|
this._taskStdoutListenerMap = /* @__PURE__ */ new Map();
|
|
75
88
|
this._taskStderrListenerMap = /* @__PURE__ */ new Map();
|
|
76
89
|
this._taskLogConfigMap = /* @__PURE__ */ new Map();
|
|
77
90
|
}
|
|
78
91
|
}
|
|
92
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
93
|
+
0 && (module.exports = {
|
|
94
|
+
MultitasksLogger
|
|
95
|
+
});
|
package/dist/cjs/log/time.js
CHANGED
|
@@ -1,27 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
6
7
|
for (var name in all)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return initTimeLog;
|
|
15
|
-
},
|
|
16
|
-
startTime: function() {
|
|
17
|
-
return startTime;
|
|
18
|
-
},
|
|
19
|
-
endTime: function() {
|
|
20
|
-
return endTime;
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
21
15
|
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var time_exports = {};
|
|
20
|
+
__export(time_exports, {
|
|
21
|
+
endTime: () => endTime,
|
|
22
|
+
initTimeLog: () => initTimeLog,
|
|
23
|
+
startTime: () => startTime
|
|
22
24
|
});
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
module.exports = __toCommonJS(time_exports);
|
|
26
|
+
var import_utils = require("@modern-js/utils");
|
|
27
|
+
const initTimeLog = (option = {}) => new import_utils.Signale({
|
|
25
28
|
interactive: true,
|
|
26
29
|
scope: "time-log",
|
|
27
30
|
...option
|
|
@@ -32,3 +35,9 @@ const startTime = (signaleInstance, prefix = "") => {
|
|
|
32
35
|
const endTime = (signaleInstance, prefix = "") => {
|
|
33
36
|
signaleInstance.timeEnd(prefix);
|
|
34
37
|
};
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
endTime,
|
|
41
|
+
initTimeLog,
|
|
42
|
+
startTime
|
|
43
|
+
});
|
package/dist/cjs/log/utils.js
CHANGED
|
@@ -1,13 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
9
15
|
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var utils_exports = {};
|
|
20
|
+
__export(utils_exports, {
|
|
21
|
+
formatLog: () => formatLog
|
|
10
22
|
});
|
|
23
|
+
module.exports = __toCommonJS(utils_exports);
|
|
11
24
|
const formatLog = (log) => {
|
|
12
25
|
const strs = log.split(/\r\n|\n\r|\r|\n/g);
|
|
13
26
|
if (strs[0].trim() === "") {
|
|
@@ -16,3 +29,7 @@ ${strs.slice(1).filter((s) => Boolean(s)).join("\n")}`;
|
|
|
16
29
|
}
|
|
17
30
|
return strs.filter((s) => Boolean(s)).join("\n");
|
|
18
31
|
};
|
|
32
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
33
|
+
0 && (module.exports = {
|
|
34
|
+
formatLog
|
|
35
|
+
});
|
|
@@ -1,14 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
9
15
|
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var package_exports = {};
|
|
20
|
+
__export(package_exports, {
|
|
21
|
+
Package: () => Package
|
|
10
22
|
});
|
|
11
|
-
|
|
23
|
+
module.exports = __toCommonJS(package_exports);
|
|
24
|
+
var import_define_property = require("@swc/helpers/_/_define_property");
|
|
12
25
|
class Package {
|
|
13
26
|
get name() {
|
|
14
27
|
return this.json.name;
|
|
@@ -20,11 +33,15 @@ class Package {
|
|
|
20
33
|
return this.json[key];
|
|
21
34
|
}
|
|
22
35
|
constructor(packageJson, packageConfigPath, rootPath) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
36
|
+
(0, import_define_property._)(this, "json", void 0);
|
|
37
|
+
(0, import_define_property._)(this, "configPath", void 0);
|
|
38
|
+
(0, import_define_property._)(this, "rootPath", void 0);
|
|
26
39
|
this.configPath = packageConfigPath;
|
|
27
40
|
this.rootPath = rootPath;
|
|
28
41
|
this.json = packageJson;
|
|
29
42
|
}
|
|
30
43
|
}
|
|
44
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
+
0 && (module.exports = {
|
|
46
|
+
Package
|
|
47
|
+
});
|
|
@@ -1,21 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
9
17
|
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var parse_config_exports = {};
|
|
30
|
+
__export(parse_config_exports, {
|
|
31
|
+
getFinalConfig: () => getFinalConfig
|
|
10
32
|
});
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
33
|
+
module.exports = __toCommonJS(parse_config_exports);
|
|
34
|
+
var path = __toESM(require("path"));
|
|
35
|
+
var import_node_core_library = require("@rushstack/node-core-library");
|
|
36
|
+
var import_monorepo = require("./monorepo");
|
|
15
37
|
const defaultConfig = {};
|
|
16
38
|
const getFinalConfig = async (currentPath = process.cwd()) => {
|
|
17
|
-
const monorepo = (0,
|
|
18
|
-
const userConfig = await
|
|
39
|
+
const monorepo = (0, import_monorepo.getMonorepoBaseData)(currentPath);
|
|
40
|
+
const userConfig = await import_node_core_library.JsonFile.loadAsync(path.resolve(monorepo.rootPath, "mono-config.json"));
|
|
19
41
|
const config = {
|
|
20
42
|
...defaultConfig,
|
|
21
43
|
...userConfig
|
|
@@ -25,3 +47,7 @@ const getFinalConfig = async (currentPath = process.cwd()) => {
|
|
|
25
47
|
config
|
|
26
48
|
};
|
|
27
49
|
};
|
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
+
0 && (module.exports = {
|
|
52
|
+
getFinalConfig
|
|
53
|
+
});
|
|
@@ -1,53 +1,61 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
6
9
|
for (var name in all)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return findMonorepoRoot;
|
|
15
|
-
},
|
|
16
|
-
getWorkspaceFile: function() {
|
|
17
|
-
return getWorkspaceFile;
|
|
18
|
-
},
|
|
19
|
-
packageManagerFlag: function() {
|
|
20
|
-
return packageManagerFlag;
|
|
21
|
-
},
|
|
22
|
-
getPackageManager: function() {
|
|
23
|
-
return getPackageManager;
|
|
24
|
-
},
|
|
25
|
-
getMonorepoBaseData: function() {
|
|
26
|
-
return getMonorepoBaseData;
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
27
17
|
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var monorepo_exports = {};
|
|
30
|
+
__export(monorepo_exports, {
|
|
31
|
+
findMonorepoRoot: () => findMonorepoRoot,
|
|
32
|
+
getMonorepoBaseData: () => getMonorepoBaseData,
|
|
33
|
+
getPackageManager: () => getPackageManager,
|
|
34
|
+
getWorkspaceFile: () => getWorkspaceFile,
|
|
35
|
+
packageManagerFlag: () => packageManagerFlag
|
|
28
36
|
});
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
37
|
+
module.exports = __toCommonJS(monorepo_exports);
|
|
38
|
+
var path = __toESM(require("path"));
|
|
39
|
+
var import_node_core_library = require("@rushstack/node-core-library");
|
|
40
|
+
var import_constants = require("../constants");
|
|
33
41
|
const useLerna = (monorepoRootPath) => {
|
|
34
|
-
if (
|
|
42
|
+
if (import_node_core_library.FileSystem.exists(path.join(monorepoRootPath, import_constants.WORKSPACE_FILE.LERNA))) {
|
|
35
43
|
return true;
|
|
36
44
|
}
|
|
37
45
|
return false;
|
|
38
46
|
};
|
|
39
47
|
const useYarnWorkspaces = (monorepoRootPath) => {
|
|
40
|
-
if (!
|
|
48
|
+
if (!import_node_core_library.FileSystem.exists(path.join(monorepoRootPath, import_constants.WORKSPACE_FILE.YARN))) {
|
|
41
49
|
return false;
|
|
42
50
|
}
|
|
43
|
-
const json =
|
|
51
|
+
const json = import_node_core_library.JsonFile.load(path.join(monorepoRootPath, import_constants.WORKSPACE_FILE.YARN));
|
|
44
52
|
if ("workspaces" in json && json.workspaces.packages) {
|
|
45
53
|
return true;
|
|
46
54
|
}
|
|
47
55
|
return false;
|
|
48
56
|
};
|
|
49
57
|
const usePnpmWorkspaces = (monorepoRootPath) => {
|
|
50
|
-
if (
|
|
58
|
+
if (import_node_core_library.FileSystem.exists(path.join(monorepoRootPath, import_constants.WORKSPACE_FILE.PNPM))) {
|
|
51
59
|
return true;
|
|
52
60
|
}
|
|
53
61
|
return false;
|
|
@@ -66,7 +74,7 @@ const findMonorepoRoot = (starFindPath) => {
|
|
|
66
74
|
inMonorepo = true;
|
|
67
75
|
break;
|
|
68
76
|
}
|
|
69
|
-
findPath =
|
|
77
|
+
findPath = path.dirname(findPath);
|
|
70
78
|
}
|
|
71
79
|
return inMonorepo ? findPath : void 0;
|
|
72
80
|
};
|
|
@@ -76,18 +84,18 @@ const getWorkspaceFile = (startFindPath) => {
|
|
|
76
84
|
throw new Error("[Auto Find Mode]: not find any monorepo workspace file, you can set `packagesMatchs.workspaceFile`");
|
|
77
85
|
}
|
|
78
86
|
if (usePnpmWorkspaces(rootPath)) {
|
|
79
|
-
return
|
|
87
|
+
return import_constants.WORKSPACE_FILE.PNPM;
|
|
80
88
|
} else if (useLerna(rootPath)) {
|
|
81
|
-
return
|
|
89
|
+
return import_constants.WORKSPACE_FILE.LERNA;
|
|
82
90
|
} else if (useYarnWorkspaces(rootPath)) {
|
|
83
|
-
return
|
|
91
|
+
return import_constants.WORKSPACE_FILE.YARN;
|
|
84
92
|
} else {
|
|
85
93
|
throw new Error("[Auto Find Mode]: not find any monorepo workspace file, you can set `packagesMatchs.workspaceFile`");
|
|
86
94
|
}
|
|
87
95
|
};
|
|
88
96
|
const packageManagerFlag = {
|
|
89
97
|
pnpm: [
|
|
90
|
-
|
|
98
|
+
import_constants.WORKSPACE_FILE.PNPM,
|
|
91
99
|
"pnpm-lock.yaml"
|
|
92
100
|
],
|
|
93
101
|
yarn: [
|
|
@@ -98,12 +106,12 @@ const packageManagerFlag = {
|
|
|
98
106
|
() => true
|
|
99
107
|
]
|
|
100
108
|
};
|
|
101
|
-
const usePnpmPackageManager = (monorepoRootPath) => packageManagerFlag.pnpm.some((flag) =>
|
|
109
|
+
const usePnpmPackageManager = (monorepoRootPath) => packageManagerFlag.pnpm.some((flag) => import_node_core_library.FileSystem.exists(path.join(monorepoRootPath, flag)));
|
|
102
110
|
const useYarnPackageManager = (monorepoRootPath) => packageManagerFlag.yarn.some((flag) => {
|
|
103
111
|
if (typeof flag === "function") {
|
|
104
112
|
return flag(monorepoRootPath);
|
|
105
113
|
}
|
|
106
|
-
return
|
|
114
|
+
return import_node_core_library.FileSystem.exists(path.join(monorepoRootPath, flag));
|
|
107
115
|
});
|
|
108
116
|
const getPackageManager = (monorepoRootPath) => {
|
|
109
117
|
if (usePnpmPackageManager(monorepoRootPath)) {
|
|
@@ -123,3 +131,11 @@ const getMonorepoBaseData = (root = process.cwd()) => {
|
|
|
123
131
|
packageManager: getPackageManager(rootPath)
|
|
124
132
|
};
|
|
125
133
|
};
|
|
134
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
135
|
+
0 && (module.exports = {
|
|
136
|
+
findMonorepoRoot,
|
|
137
|
+
getMonorepoBaseData,
|
|
138
|
+
getPackageManager,
|
|
139
|
+
getWorkspaceFile,
|
|
140
|
+
packageManagerFlag
|
|
141
|
+
});
|
|
@@ -1,38 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
6
9
|
for (var name in all)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return PROJECT_CONTENT_FILE_NAME;
|
|
15
|
-
},
|
|
16
|
-
MONOREPO_GIT_FILE_NAME: function() {
|
|
17
|
-
return MONOREPO_GIT_FILE_NAME;
|
|
18
|
-
},
|
|
19
|
-
PROJECT_MEMORY_PATH: function() {
|
|
20
|
-
return PROJECT_MEMORY_PATH;
|
|
21
|
-
},
|
|
22
|
-
checkProjectChangeByGit: function() {
|
|
23
|
-
return checkProjectChangeByGit;
|
|
24
|
-
},
|
|
25
|
-
checkProjectChangeByContent: function() {
|
|
26
|
-
return checkProjectChangeByContent;
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
27
17
|
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var checkProjectChange_exports = {};
|
|
30
|
+
__export(checkProjectChange_exports, {
|
|
31
|
+
MONOREPO_GIT_FILE_NAME: () => MONOREPO_GIT_FILE_NAME,
|
|
32
|
+
PROJECT_CONTENT_FILE_NAME: () => PROJECT_CONTENT_FILE_NAME,
|
|
33
|
+
PROJECT_MEMORY_PATH: () => PROJECT_MEMORY_PATH,
|
|
34
|
+
checkProjectChangeByContent: () => checkProjectChangeByContent,
|
|
35
|
+
checkProjectChangeByGit: () => checkProjectChangeByGit
|
|
28
36
|
});
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const _md5 = /* @__PURE__ */ _interop_require_default._(require("md5"));
|
|
37
|
+
module.exports = __toCommonJS(checkProjectChange_exports);
|
|
38
|
+
var path = __toESM(require("path"));
|
|
39
|
+
var import_node_core_library = require("@rushstack/node-core-library");
|
|
40
|
+
var import_package_deps_hash = require("@rushstack/package-deps-hash");
|
|
41
|
+
var import_utils = require("@modern-js/utils");
|
|
42
|
+
var import_md5 = __toESM(require("md5"));
|
|
36
43
|
const PROJECT_CONTENT_FILE_NAME = "project-content.json";
|
|
37
44
|
const MONOREPO_GIT_FILE_NAME = "monorepo-git.json";
|
|
38
45
|
const PROJECT_MEMORY_PATH = ".project-memory";
|
|
@@ -50,28 +57,28 @@ const getProjectGitHash = async (project) => {
|
|
|
50
57
|
]
|
|
51
58
|
};
|
|
52
59
|
const globPattern = `${projectDir}/**`;
|
|
53
|
-
const files = await (0,
|
|
54
|
-
const hashMap = (0,
|
|
60
|
+
const files = await (0, import_utils.globby)(path.posix.join(globPattern), globOption);
|
|
61
|
+
const hashMap = (0, import_package_deps_hash.getGitHashForFiles)(files, projectDir);
|
|
55
62
|
const hashObject = {};
|
|
56
|
-
|
|
63
|
+
import_node_core_library.Sort.sortMapKeys(hashMap);
|
|
57
64
|
hashMap.forEach((value, key) => {
|
|
58
65
|
hashObject[key] = value;
|
|
59
66
|
});
|
|
60
|
-
return (0,
|
|
67
|
+
return (0, import_md5.default)(import_node_core_library.JsonFile.stringify(hashObject));
|
|
61
68
|
};
|
|
62
69
|
const checkProjectChangeByGit = async (project, rootPath) => {
|
|
63
|
-
const monorepoGitMemory =
|
|
70
|
+
const monorepoGitMemory = path.join(rootPath, MONOREPO_GIT_FILE_NAME);
|
|
64
71
|
const currentProjectHash = await getProjectGitHash(project);
|
|
65
|
-
if (!
|
|
66
|
-
|
|
72
|
+
if (!import_node_core_library.FileSystem.exists(monorepoGitMemory)) {
|
|
73
|
+
import_node_core_library.FileSystem.writeFile(monorepoGitMemory, import_node_core_library.JsonFile.stringify({}), {
|
|
67
74
|
ensureFolderExists: true
|
|
68
75
|
});
|
|
69
76
|
}
|
|
70
|
-
const monorepoProjectHashJson =
|
|
77
|
+
const monorepoProjectHashJson = import_node_core_library.JsonFile.load(monorepoGitMemory);
|
|
71
78
|
const changed = monorepoProjectHashJson[project.name] !== currentProjectHash;
|
|
72
79
|
if (changed) {
|
|
73
80
|
monorepoProjectHashJson[project.name] = currentProjectHash;
|
|
74
|
-
|
|
81
|
+
import_node_core_library.FileSystem.writeFile(monorepoGitMemory, import_node_core_library.JsonFile.stringify(monorepoProjectHashJson), {
|
|
75
82
|
ensureFolderExists: true
|
|
76
83
|
});
|
|
77
84
|
}
|
|
@@ -91,31 +98,39 @@ const getProjectContentHashObjectForFiles = async (project) => {
|
|
|
91
98
|
]
|
|
92
99
|
};
|
|
93
100
|
const globPattern = `${projectDir}/**`;
|
|
94
|
-
const files = await (0,
|
|
101
|
+
const files = await (0, import_utils.globby)(path.posix.join(globPattern), globOption);
|
|
95
102
|
const hashObject = {};
|
|
96
103
|
for (const file of files.sort()) {
|
|
97
|
-
hashObject[file] = (0,
|
|
104
|
+
hashObject[file] = (0, import_md5.default)(import_node_core_library.FileSystem.readFile(file));
|
|
98
105
|
}
|
|
99
106
|
return hashObject;
|
|
100
107
|
};
|
|
101
108
|
const checkProjectChangeByContent = async (project) => {
|
|
102
109
|
const projectDir = project.extra.path;
|
|
103
|
-
const projectMemoryFolder =
|
|
104
|
-
const projectJsonFile =
|
|
110
|
+
const projectMemoryFolder = path.resolve(projectDir, ".project-memory");
|
|
111
|
+
const projectJsonFile = path.join(projectMemoryFolder, PROJECT_CONTENT_FILE_NAME);
|
|
105
112
|
const currentHashObject = await getProjectContentHashObjectForFiles(project);
|
|
106
|
-
const currentHashString =
|
|
107
|
-
if (!
|
|
108
|
-
|
|
113
|
+
const currentHashString = import_node_core_library.JsonFile.stringify(currentHashObject);
|
|
114
|
+
if (!import_node_core_library.FileSystem.exists(projectJsonFile)) {
|
|
115
|
+
import_node_core_library.FileSystem.writeFile(projectJsonFile, currentHashString, {
|
|
109
116
|
ensureFolderExists: true
|
|
110
117
|
});
|
|
111
118
|
return true;
|
|
112
119
|
}
|
|
113
|
-
const localHashObject =
|
|
114
|
-
const changed =
|
|
120
|
+
const localHashObject = import_node_core_library.JsonFile.load(projectJsonFile);
|
|
121
|
+
const changed = import_node_core_library.JsonFile.stringify(localHashObject) !== currentHashString;
|
|
115
122
|
if (changed) {
|
|
116
|
-
|
|
123
|
+
import_node_core_library.FileSystem.writeFile(projectJsonFile, currentHashString, {
|
|
117
124
|
ensureFolderExists: true
|
|
118
125
|
});
|
|
119
126
|
}
|
|
120
127
|
return changed;
|
|
121
128
|
};
|
|
129
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
130
|
+
0 && (module.exports = {
|
|
131
|
+
MONOREPO_GIT_FILE_NAME,
|
|
132
|
+
PROJECT_CONTENT_FILE_NAME,
|
|
133
|
+
PROJECT_MEMORY_PATH,
|
|
134
|
+
checkProjectChangeByContent,
|
|
135
|
+
checkProjectChangeByGit
|
|
136
|
+
});
|