@modern-js/monorepo-tools 2.4.0 → 2.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 +24 -0
- package/cli.js +1 -1
- package/dist/{js/node → cjs}/cli/build-watch.js +3 -23
- package/dist/{js/node → cjs}/cli/build.js +3 -23
- package/dist/{js/node → cjs}/cli/clear.js +3 -23
- package/dist/{js/node → cjs}/cli/deploy.js +3 -23
- package/dist/{js/node → cjs}/cli/index.js +0 -0
- package/dist/cjs/cli/install.js +34 -0
- package/dist/{js/node → cjs}/cli/new.js +3 -40
- package/dist/{js/node → cjs}/commands/build-watch.js +4 -24
- package/dist/{js/node → cjs}/commands/build.js +8 -41
- package/dist/{js/node → cjs}/commands/clear.js +3 -23
- package/dist/{js/node → cjs}/commands/deploy.js +4 -24
- package/dist/{js/node → cjs}/commands/index.js +0 -0
- package/dist/{js/node → cjs}/commands/install.js +4 -24
- package/dist/{js/node → cjs}/constants.js +0 -0
- package/dist/{js/node → cjs}/dag/create.js +5 -15
- package/dist/{js/node → cjs}/dag/edge-manager.js +0 -0
- package/dist/{js/node → cjs}/dag/index.js +0 -0
- package/dist/cjs/dag/operator.js +232 -0
- package/dist/{js/node → cjs}/dag/task.js +29 -53
- package/dist/{js/node → cjs}/dag/utils.js +0 -0
- package/dist/{js/node → cjs}/features/build/index.js +13 -33
- package/dist/{js/node → cjs}/features/clear/index.js +0 -0
- package/dist/{js/node → cjs}/features/deploy/index.js +10 -30
- package/dist/{js/node → cjs}/features/dev/cmds.js +0 -0
- package/dist/{js/node → cjs}/features/dev/create-task.js +6 -26
- package/dist/{js/node → cjs}/features/dev/index.js +14 -34
- package/dist/{js/node → cjs}/features/dev/watch-projects-state.js +3 -19
- package/dist/{js/node → cjs}/features/install/index.js +3 -23
- package/dist/{js/node → cjs}/hooks/index.js +0 -0
- package/dist/{js/node → cjs}/index.js +0 -0
- package/dist/{js/node → cjs}/locale/en.js +0 -0
- package/dist/{js/node → cjs}/locale/index.js +0 -0
- package/dist/{js/node → cjs}/locale/zh.js +0 -0
- package/dist/{js/node → cjs}/log/error.js +0 -0
- package/dist/{js/node → cjs}/log/multi-tasks-log.js +0 -0
- package/dist/{js/node → cjs}/log/time.js +1 -15
- package/dist/{js/node → cjs}/log/utils.js +0 -0
- package/dist/{js/node → cjs}/package/index.js +0 -0
- package/dist/{js/node → cjs}/parse-config/index.js +4 -38
- package/dist/{js/node → cjs}/parse-config/monorepo.js +0 -0
- package/dist/{js/node → cjs}/projects/check-project-change.js +12 -32
- package/dist/{js/node → cjs}/projects/clear-memory-files.js +0 -0
- package/dist/{js/node → cjs}/projects/get-projects-by-packages-config.js +11 -45
- package/dist/{js/node → cjs}/projects/get-projects-by-workspace-file.js +4 -24
- package/dist/{js/node → cjs}/projects/get-projects.js +15 -47
- package/dist/{js/node → cjs}/type.js +0 -0
- package/dist/{js/node → cjs}/utils/install.js +4 -24
- package/dist/{js/node → cjs}/utils/language.js +0 -0
- package/dist/{js/node → cjs}/utils/types.js +0 -0
- package/dist/esm/cli/build-watch.js +11 -0
- package/dist/esm/cli/build.js +12 -0
- package/dist/esm/cli/clear.js +11 -0
- package/dist/esm/cli/deploy.js +16 -0
- package/dist/{js/modern → esm}/cli/index.js +0 -0
- package/dist/esm/cli/install.js +11 -0
- package/dist/esm/cli/new.js +18 -0
- package/dist/esm/commands/build-watch.js +24 -0
- package/dist/esm/commands/build.js +55 -0
- package/dist/esm/commands/clear.js +19 -0
- package/dist/{js/modern → esm}/commands/deploy.js +4 -24
- package/dist/{js/modern → esm}/commands/index.js +0 -0
- package/dist/esm/commands/install.js +23 -0
- package/dist/{js/modern → esm}/constants.js +0 -0
- package/dist/{js/modern → esm}/dag/create.js +5 -17
- package/dist/{js/modern → esm}/dag/edge-manager.js +0 -0
- package/dist/{js/modern → esm}/dag/index.js +0 -0
- package/dist/esm/dag/operator.js +203 -0
- package/dist/esm/dag/task.js +55 -0
- package/dist/{js/modern → esm}/dag/utils.js +0 -0
- package/dist/{js/modern → esm}/features/build/index.js +13 -33
- package/dist/{js/modern → esm}/features/clear/index.js +0 -0
- package/dist/{js/modern → esm}/features/deploy/index.js +10 -30
- package/dist/{js/modern → esm}/features/dev/cmds.js +0 -0
- package/dist/{js/modern → esm}/features/dev/create-task.js +6 -26
- package/dist/{js/modern → esm}/features/dev/index.js +14 -34
- package/dist/{js/modern → esm}/features/dev/watch-projects-state.js +3 -21
- package/dist/{js/modern → esm}/features/install/index.js +3 -23
- package/dist/{js/modern → esm}/hooks/index.js +0 -0
- package/dist/{js/modern → esm}/index.js +0 -0
- package/dist/{js/modern → esm}/locale/en.js +0 -0
- package/dist/{js/modern → esm}/locale/index.js +0 -0
- package/dist/{js/modern → esm}/locale/zh.js +0 -0
- package/dist/{js/modern → esm}/log/error.js +0 -0
- package/dist/{js/modern → esm}/log/multi-tasks-log.js +0 -0
- package/dist/esm/log/time.js +13 -0
- package/dist/{js/modern → esm}/log/utils.js +0 -0
- package/dist/{js/modern → esm}/package/index.js +0 -0
- package/dist/esm/parse-config/index.js +15 -0
- package/dist/{js/modern → esm}/parse-config/monorepo.js +0 -0
- package/dist/{js/modern → esm}/projects/check-project-change.js +12 -32
- package/dist/{js/modern → esm}/projects/clear-memory-files.js +0 -0
- package/dist/{js/modern → esm}/projects/get-projects-by-packages-config.js +11 -47
- package/dist/{js/modern → esm}/projects/get-projects-by-workspace-file.js +4 -24
- package/dist/{js/modern → esm}/projects/get-projects.js +15 -49
- package/dist/{js/modern → esm}/type.js +0 -0
- package/dist/esm/utils/install.js +27 -0
- package/dist/{js/modern → esm}/utils/language.js +0 -0
- package/dist/{js/modern → esm}/utils/types.js +0 -0
- package/package.json +16 -16
- package/dist/js/modern/cli/build-watch.js +0 -31
- package/dist/js/modern/cli/build.js +0 -32
- package/dist/js/modern/cli/clear.js +0 -31
- package/dist/js/modern/cli/deploy.js +0 -36
- package/dist/js/modern/cli/install.js +0 -31
- package/dist/js/modern/cli/new.js +0 -57
- package/dist/js/modern/commands/build-watch.js +0 -44
- package/dist/js/modern/commands/build.js +0 -90
- package/dist/js/modern/commands/clear.js +0 -39
- package/dist/js/modern/commands/install.js +0 -43
- package/dist/js/modern/dag/operator.js +0 -251
- package/dist/js/modern/dag/task.js +0 -79
- package/dist/js/modern/log/time.js +0 -29
- package/dist/js/modern/parse-config/index.js +0 -51
- package/dist/js/modern/utils/install.js +0 -47
- package/dist/js/node/cli/install.js +0 -54
- package/dist/js/node/dag/operator.js +0 -278
|
@@ -21,26 +21,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
21
21
|
mod
|
|
22
22
|
));
|
|
23
23
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
-
var __async = (__this, __arguments, generator) => {
|
|
25
|
-
return new Promise((resolve, reject) => {
|
|
26
|
-
var fulfilled = (value) => {
|
|
27
|
-
try {
|
|
28
|
-
step(generator.next(value));
|
|
29
|
-
} catch (e) {
|
|
30
|
-
reject(e);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
var rejected = (value) => {
|
|
34
|
-
try {
|
|
35
|
-
step(generator.throw(value));
|
|
36
|
-
} catch (e) {
|
|
37
|
-
reject(e);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
41
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
24
|
var dev_exports = {};
|
|
45
25
|
__export(dev_exports, {
|
|
46
26
|
runBuildWatchTask: () => runBuildWatchTask
|
|
@@ -62,7 +42,7 @@ const getIgnored = (config) => (watchFilePath) => {
|
|
|
62
42
|
}
|
|
63
43
|
return false;
|
|
64
44
|
};
|
|
65
|
-
const runBuildWatchTask =
|
|
45
|
+
const runBuildWatchTask = async (projectName, operator, config, taskCmds = import_cmds.defaultBuildWatchCmds) => {
|
|
66
46
|
const { needInit = true } = config;
|
|
67
47
|
const taskLogger = new import_multi_tasks_log.MultitasksLogger();
|
|
68
48
|
const dependenciesTask = (0, import_create_task.createDependenciesTask)(config, taskCmds, taskLogger);
|
|
@@ -80,24 +60,24 @@ const runBuildWatchTask = (_0, _1, _2, ..._3) => __async(void 0, [_0, _1, _2, ..
|
|
|
80
60
|
});
|
|
81
61
|
watcher.add(watchedProjectState.getWatchedProjectsPath());
|
|
82
62
|
if (needInit) {
|
|
83
|
-
|
|
63
|
+
await operator.traverseDependenciesToProject(
|
|
84
64
|
projectName,
|
|
85
|
-
(currentProject) =>
|
|
86
|
-
|
|
87
|
-
}
|
|
65
|
+
async (currentProject) => {
|
|
66
|
+
await dependenciesTask(currentProject);
|
|
67
|
+
}
|
|
88
68
|
);
|
|
89
69
|
}
|
|
90
|
-
|
|
70
|
+
await new Promise((resolve) => {
|
|
91
71
|
console.info("start watch");
|
|
92
|
-
watcher.on("all", (eventName, changeFilePath) =>
|
|
72
|
+
watcher.on("all", async (eventName, changeFilePath) => {
|
|
93
73
|
if (eventName === "add") {
|
|
94
74
|
watchedProjectState.updateState();
|
|
95
75
|
}
|
|
96
76
|
const changedProject = watchedProjectState.getChangedProject(changeFilePath);
|
|
97
77
|
if (changedProject) {
|
|
98
|
-
|
|
78
|
+
await operator.traverseProjectToDependent(
|
|
99
79
|
changedProject.name,
|
|
100
|
-
(currentProject, _, earlyFinish) =>
|
|
80
|
+
async (currentProject, _, earlyFinish) => {
|
|
101
81
|
if (currentProject.name === projectName) {
|
|
102
82
|
earlyFinish();
|
|
103
83
|
return;
|
|
@@ -106,20 +86,20 @@ const runBuildWatchTask = (_0, _1, _2, ..._3) => __async(void 0, [_0, _1, _2, ..
|
|
|
106
86
|
currentProject.name
|
|
107
87
|
)) {
|
|
108
88
|
console.info("run build", currentProject.name);
|
|
109
|
-
|
|
89
|
+
await dependenciesTask(currentProject);
|
|
110
90
|
}
|
|
111
|
-
}
|
|
91
|
+
},
|
|
112
92
|
{ withSelf: true }
|
|
113
93
|
);
|
|
114
94
|
resolve(null);
|
|
115
95
|
} else {
|
|
116
96
|
console.info("changed is not in monorepo manager");
|
|
117
97
|
}
|
|
118
|
-
})
|
|
98
|
+
});
|
|
119
99
|
resolve(null);
|
|
120
100
|
});
|
|
121
|
-
|
|
122
|
-
}
|
|
101
|
+
await devTask(operator.getNodeData(projectName, { checkExist: true }));
|
|
102
|
+
};
|
|
123
103
|
// Annotate the CommonJS export names for ESM import in node:
|
|
124
104
|
0 && (module.exports = {
|
|
125
105
|
runBuildWatchTask
|
|
@@ -1,26 +1,9 @@
|
|
|
1
1
|
var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
9
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
-
var __spreadValues = (a, b) => {
|
|
13
|
-
for (var prop in b || (b = {}))
|
|
14
|
-
if (__hasOwnProp.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
if (__getOwnPropSymbols)
|
|
17
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
-
if (__propIsEnum.call(b, prop))
|
|
19
|
-
__defNormalProp(a, prop, b[prop]);
|
|
20
|
-
}
|
|
21
|
-
return a;
|
|
22
|
-
};
|
|
23
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
7
|
var __export = (target, all) => {
|
|
25
8
|
for (var name in all)
|
|
26
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -70,9 +53,10 @@ class WatchedProjectsState {
|
|
|
70
53
|
node.extra.path
|
|
71
54
|
);
|
|
72
55
|
}
|
|
73
|
-
return
|
|
56
|
+
return {
|
|
57
|
+
...ret,
|
|
74
58
|
[node.extra.path]: node
|
|
75
|
-
}
|
|
59
|
+
};
|
|
76
60
|
},
|
|
77
61
|
{}
|
|
78
62
|
);
|
|
@@ -21,26 +21,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
21
21
|
mod
|
|
22
22
|
));
|
|
23
23
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
-
var __async = (__this, __arguments, generator) => {
|
|
25
|
-
return new Promise((resolve, reject) => {
|
|
26
|
-
var fulfilled = (value) => {
|
|
27
|
-
try {
|
|
28
|
-
step(generator.next(value));
|
|
29
|
-
} catch (e) {
|
|
30
|
-
reject(e);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
var rejected = (value) => {
|
|
34
|
-
try {
|
|
35
|
-
step(generator.throw(value));
|
|
36
|
-
} catch (e) {
|
|
37
|
-
reject(e);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
41
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
24
|
var install_exports = {};
|
|
45
25
|
__export(install_exports, {
|
|
46
26
|
runInstallTask: () => runInstallTask
|
|
@@ -82,7 +62,7 @@ const replaceWorkspaces = ({
|
|
|
82
62
|
}
|
|
83
63
|
return false;
|
|
84
64
|
};
|
|
85
|
-
const runInstallTask = (projectNames, operator, config) =>
|
|
65
|
+
const runInstallTask = async (projectNames, operator, config) => {
|
|
86
66
|
const { rootPath, packageManager } = config;
|
|
87
67
|
let projectsInWorkspaces = [];
|
|
88
68
|
if (projectNames.length === 0) {
|
|
@@ -102,11 +82,11 @@ const runInstallTask = (projectNames, operator, config) => __async(void 0, null,
|
|
|
102
82
|
rootPath,
|
|
103
83
|
projectsInWorkspaces: noDupProjectList
|
|
104
84
|
});
|
|
105
|
-
|
|
85
|
+
await (0, import_install.installByPackageManager)(packageManager, { rootPath, removeLock: true });
|
|
106
86
|
if (restorWorkspace) {
|
|
107
87
|
restorWorkspace();
|
|
108
88
|
}
|
|
109
|
-
}
|
|
89
|
+
};
|
|
110
90
|
// Annotate the CommonJS export names for ESM import in node:
|
|
111
91
|
0 && (module.exports = {
|
|
112
92
|
runInstallTask
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,21 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
5
|
var __export = (target, all) => {
|
|
20
6
|
for (var name in all)
|
|
21
7
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -37,7 +23,7 @@ __export(time_exports, {
|
|
|
37
23
|
});
|
|
38
24
|
module.exports = __toCommonJS(time_exports);
|
|
39
25
|
var import_utils = require("@modern-js/utils");
|
|
40
|
-
const initTimeLog = (option = {}) => new import_utils.Signale(
|
|
26
|
+
const initTimeLog = (option = {}) => new import_utils.Signale({ interactive: true, scope: "time-log", ...option });
|
|
41
27
|
const startTime = (signaleInstance, prefix = "") => {
|
|
42
28
|
signaleInstance.time(prefix);
|
|
43
29
|
};
|
|
File without changes
|
|
File without changes
|
|
@@ -2,22 +2,8 @@ var __create = Object.create;
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
-
var __spreadValues = (a, b) => {
|
|
11
|
-
for (var prop in b || (b = {}))
|
|
12
|
-
if (__hasOwnProp.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
if (__getOwnPropSymbols)
|
|
15
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
-
if (__propIsEnum.call(b, prop))
|
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
|
18
|
-
}
|
|
19
|
-
return a;
|
|
20
|
-
};
|
|
21
7
|
var __export = (target, all) => {
|
|
22
8
|
for (var name in all)
|
|
23
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -35,26 +21,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
35
21
|
mod
|
|
36
22
|
));
|
|
37
23
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
|
-
var __async = (__this, __arguments, generator) => {
|
|
39
|
-
return new Promise((resolve, reject) => {
|
|
40
|
-
var fulfilled = (value) => {
|
|
41
|
-
try {
|
|
42
|
-
step(generator.next(value));
|
|
43
|
-
} catch (e) {
|
|
44
|
-
reject(e);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
var rejected = (value) => {
|
|
48
|
-
try {
|
|
49
|
-
step(generator.throw(value));
|
|
50
|
-
} catch (e) {
|
|
51
|
-
reject(e);
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
55
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
56
|
-
});
|
|
57
|
-
};
|
|
58
24
|
var parse_config_exports = {};
|
|
59
25
|
__export(parse_config_exports, {
|
|
60
26
|
getFinalConfig: () => getFinalConfig
|
|
@@ -64,14 +30,14 @@ var path = __toESM(require("path"));
|
|
|
64
30
|
var import_node_core_library = require("@rushstack/node-core-library");
|
|
65
31
|
var import_monorepo = require("./monorepo");
|
|
66
32
|
const defaultConfig = {};
|
|
67
|
-
const getFinalConfig =
|
|
33
|
+
const getFinalConfig = async (currentPath = process.cwd()) => {
|
|
68
34
|
const monorepo = (0, import_monorepo.getMonorepoBaseData)(currentPath);
|
|
69
|
-
const userConfig =
|
|
35
|
+
const userConfig = await import_node_core_library.JsonFile.loadAsync(
|
|
70
36
|
path.resolve(monorepo.rootPath, "mono-config.json")
|
|
71
37
|
);
|
|
72
|
-
const config =
|
|
38
|
+
const config = { ...defaultConfig, ...userConfig };
|
|
73
39
|
return { monorepo, config };
|
|
74
|
-
}
|
|
40
|
+
};
|
|
75
41
|
// Annotate the CommonJS export names for ESM import in node:
|
|
76
42
|
0 && (module.exports = {
|
|
77
43
|
getFinalConfig
|
|
File without changes
|
|
@@ -21,26 +21,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
21
21
|
mod
|
|
22
22
|
));
|
|
23
23
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
-
var __async = (__this, __arguments, generator) => {
|
|
25
|
-
return new Promise((resolve, reject) => {
|
|
26
|
-
var fulfilled = (value) => {
|
|
27
|
-
try {
|
|
28
|
-
step(generator.next(value));
|
|
29
|
-
} catch (e) {
|
|
30
|
-
reject(e);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
var rejected = (value) => {
|
|
34
|
-
try {
|
|
35
|
-
step(generator.throw(value));
|
|
36
|
-
} catch (e) {
|
|
37
|
-
reject(e);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
41
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
24
|
var check_project_change_exports = {};
|
|
45
25
|
__export(check_project_change_exports, {
|
|
46
26
|
MONOREPO_GIT_FILE_NAME: () => MONOREPO_GIT_FILE_NAME,
|
|
@@ -58,7 +38,7 @@ var import_md5 = __toESM(require("md5"));
|
|
|
58
38
|
const PROJECT_CONTENT_FILE_NAME = "project-content.json";
|
|
59
39
|
const MONOREPO_GIT_FILE_NAME = "monorepo-git.json";
|
|
60
40
|
const PROJECT_MEMORY_PATH = ".project-memory";
|
|
61
|
-
const getProjectGitHash = (project) =>
|
|
41
|
+
const getProjectGitHash = async (project) => {
|
|
62
42
|
const projectDir = project.extra.path;
|
|
63
43
|
const globOption = {
|
|
64
44
|
cwd: projectDir,
|
|
@@ -68,7 +48,7 @@ const getProjectGitHash = (project) => __async(void 0, null, function* () {
|
|
|
68
48
|
ignore: ["**/node_modules/**", ".project-memory/**", "dist/**"]
|
|
69
49
|
};
|
|
70
50
|
const globPattern = `${projectDir}/**`;
|
|
71
|
-
const files =
|
|
51
|
+
const files = await (0, import_utils.globby)(path.posix.join(globPattern), globOption);
|
|
72
52
|
const hashMap = (0, import_package_deps_hash.getGitHashForFiles)(files, projectDir);
|
|
73
53
|
const hashObject = {};
|
|
74
54
|
import_node_core_library.Sort.sortMapKeys(hashMap);
|
|
@@ -76,10 +56,10 @@ const getProjectGitHash = (project) => __async(void 0, null, function* () {
|
|
|
76
56
|
hashObject[key] = value;
|
|
77
57
|
});
|
|
78
58
|
return (0, import_md5.default)(import_node_core_library.JsonFile.stringify(hashObject));
|
|
79
|
-
}
|
|
80
|
-
const checkProjectChangeByGit = (project, rootPath) =>
|
|
59
|
+
};
|
|
60
|
+
const checkProjectChangeByGit = async (project, rootPath) => {
|
|
81
61
|
const monorepoGitMemory = path.join(rootPath, MONOREPO_GIT_FILE_NAME);
|
|
82
|
-
const currentProjectHash =
|
|
62
|
+
const currentProjectHash = await getProjectGitHash(project);
|
|
83
63
|
if (!import_node_core_library.FileSystem.exists(monorepoGitMemory)) {
|
|
84
64
|
import_node_core_library.FileSystem.writeFile(monorepoGitMemory, import_node_core_library.JsonFile.stringify({}), {
|
|
85
65
|
ensureFolderExists: true
|
|
@@ -96,8 +76,8 @@ const checkProjectChangeByGit = (project, rootPath) => __async(void 0, null, fun
|
|
|
96
76
|
);
|
|
97
77
|
}
|
|
98
78
|
return changed;
|
|
99
|
-
}
|
|
100
|
-
const getProjectContentHashObjectForFiles = (project) =>
|
|
79
|
+
};
|
|
80
|
+
const getProjectContentHashObjectForFiles = async (project) => {
|
|
101
81
|
const projectDir = project.extra.path;
|
|
102
82
|
const globOption = {
|
|
103
83
|
cwd: projectDir,
|
|
@@ -107,21 +87,21 @@ const getProjectContentHashObjectForFiles = (project) => __async(void 0, null, f
|
|
|
107
87
|
ignore: ["**/node_modules/**", ".project-memory/**", "**/dist/**"]
|
|
108
88
|
};
|
|
109
89
|
const globPattern = `${projectDir}/**`;
|
|
110
|
-
const files =
|
|
90
|
+
const files = await (0, import_utils.globby)(path.posix.join(globPattern), globOption);
|
|
111
91
|
const hashObject = {};
|
|
112
92
|
for (const file of files.sort()) {
|
|
113
93
|
hashObject[file] = (0, import_md5.default)(import_node_core_library.FileSystem.readFile(file));
|
|
114
94
|
}
|
|
115
95
|
return hashObject;
|
|
116
|
-
}
|
|
117
|
-
const checkProjectChangeByContent = (project) =>
|
|
96
|
+
};
|
|
97
|
+
const checkProjectChangeByContent = async (project) => {
|
|
118
98
|
const projectDir = project.extra.path;
|
|
119
99
|
const projectMemoryFolder = path.resolve(projectDir, ".project-memory");
|
|
120
100
|
const projectJsonFile = path.join(
|
|
121
101
|
projectMemoryFolder,
|
|
122
102
|
PROJECT_CONTENT_FILE_NAME
|
|
123
103
|
);
|
|
124
|
-
const currentHashObject =
|
|
104
|
+
const currentHashObject = await getProjectContentHashObjectForFiles(project);
|
|
125
105
|
const currentHashString = import_node_core_library.JsonFile.stringify(currentHashObject);
|
|
126
106
|
if (!import_node_core_library.FileSystem.exists(projectJsonFile)) {
|
|
127
107
|
import_node_core_library.FileSystem.writeFile(projectJsonFile, currentHashString, {
|
|
@@ -137,7 +117,7 @@ const checkProjectChangeByContent = (project) => __async(void 0, null, function*
|
|
|
137
117
|
});
|
|
138
118
|
}
|
|
139
119
|
return changed;
|
|
140
|
-
}
|
|
120
|
+
};
|
|
141
121
|
// Annotate the CommonJS export names for ESM import in node:
|
|
142
122
|
0 && (module.exports = {
|
|
143
123
|
MONOREPO_GIT_FILE_NAME,
|
|
File without changes
|
|
@@ -2,22 +2,8 @@ var __create = Object.create;
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
-
var __spreadValues = (a, b) => {
|
|
11
|
-
for (var prop in b || (b = {}))
|
|
12
|
-
if (__hasOwnProp.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
if (__getOwnPropSymbols)
|
|
15
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
-
if (__propIsEnum.call(b, prop))
|
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
|
18
|
-
}
|
|
19
|
-
return a;
|
|
20
|
-
};
|
|
21
7
|
var __export = (target, all) => {
|
|
22
8
|
for (var name in all)
|
|
23
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -35,26 +21,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
35
21
|
mod
|
|
36
22
|
));
|
|
37
23
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
|
-
var __async = (__this, __arguments, generator) => {
|
|
39
|
-
return new Promise((resolve, reject) => {
|
|
40
|
-
var fulfilled = (value) => {
|
|
41
|
-
try {
|
|
42
|
-
step(generator.next(value));
|
|
43
|
-
} catch (e) {
|
|
44
|
-
reject(e);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
var rejected = (value) => {
|
|
48
|
-
try {
|
|
49
|
-
step(generator.throw(value));
|
|
50
|
-
} catch (e) {
|
|
51
|
-
reject(e);
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
55
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
56
|
-
});
|
|
57
|
-
};
|
|
58
24
|
var get_projects_by_packages_config_exports = {};
|
|
59
25
|
__export(get_projects_by_packages_config_exports, {
|
|
60
26
|
getProjectsByPackageConfig: () => getProjectsByPackageConfig,
|
|
@@ -91,23 +57,23 @@ const getGlobOpts = (rootPath, packageConfigs, ignore = []) => {
|
|
|
91
57
|
};
|
|
92
58
|
const makeFileFinder = (rootPath, packageConfigs, ignoreConfigs = []) => {
|
|
93
59
|
const globOpts = getGlobOpts(rootPath, packageConfigs, ignoreConfigs);
|
|
94
|
-
return
|
|
95
|
-
const options =
|
|
60
|
+
return async (fileName, fileMapper, customGlobOpts = {}) => {
|
|
61
|
+
const options = { ...customGlobOpts, ...globOpts };
|
|
96
62
|
const promise = (0, import_p_map.default)(
|
|
97
63
|
Array.from(packageConfigs).sort(),
|
|
98
|
-
(globPath) =>
|
|
99
|
-
let result =
|
|
64
|
+
async (globPath) => {
|
|
65
|
+
let result = await (0, import_utils.globby)(path.posix.join(globPath, fileName), options);
|
|
100
66
|
result = result.sort();
|
|
101
67
|
result = normalize(result);
|
|
102
68
|
return fileMapper(result);
|
|
103
|
-
}
|
|
69
|
+
},
|
|
104
70
|
{ concurrency: packageConfigs.length || Infinity }
|
|
105
71
|
);
|
|
106
|
-
const results =
|
|
72
|
+
const results = await promise;
|
|
107
73
|
return results.reduce((acc, result) => acc.concat(result), []);
|
|
108
|
-
}
|
|
74
|
+
};
|
|
109
75
|
};
|
|
110
|
-
const getProjectsByPackageConfig = (rootPath, packagesConfig, ignoreConfigs) =>
|
|
76
|
+
const getProjectsByPackageConfig = async (rootPath, packagesConfig, ignoreConfigs) => {
|
|
111
77
|
const finder = makeFileFinder(rootPath, packagesConfig, ignoreConfigs);
|
|
112
78
|
const fileName = "package.json";
|
|
113
79
|
const mapper = (packageConfigPath) => {
|
|
@@ -115,18 +81,18 @@ const getProjectsByPackageConfig = (rootPath, packagesConfig, ignoreConfigs) =>
|
|
|
115
81
|
const packageJson = packageJsonLookup.loadNodePackageJson(packageConfigPath);
|
|
116
82
|
return new import_package.Package(packageJson, path.dirname(packageConfigPath), rootPath);
|
|
117
83
|
};
|
|
118
|
-
const projects =
|
|
84
|
+
const projects = await finder(
|
|
119
85
|
fileName,
|
|
120
86
|
(filePaths) => (0, import_p_map.default)(filePaths, mapper, { concurrency: filePaths.length || Infinity }),
|
|
121
87
|
{}
|
|
122
88
|
);
|
|
123
89
|
return projects;
|
|
124
|
-
}
|
|
90
|
+
};
|
|
125
91
|
const makeSyncFileFinder = (rootPath, packageConfigs, ignoreConfigs = []) => {
|
|
126
92
|
const globOpts = getGlobOpts(rootPath, packageConfigs, ignoreConfigs);
|
|
127
93
|
return (fileName, fileMapper, customGlobOpts = {}) => {
|
|
128
94
|
const results = [];
|
|
129
|
-
const options =
|
|
95
|
+
const options = { ...customGlobOpts, ...globOpts };
|
|
130
96
|
for (const globPath of Array.from(packageConfigs).sort()) {
|
|
131
97
|
let result = import_utils.globby.sync(path.posix.join(globPath, fileName), options);
|
|
132
98
|
result = result.sort();
|
|
@@ -21,26 +21,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
21
21
|
mod
|
|
22
22
|
));
|
|
23
23
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
-
var __async = (__this, __arguments, generator) => {
|
|
25
|
-
return new Promise((resolve, reject) => {
|
|
26
|
-
var fulfilled = (value) => {
|
|
27
|
-
try {
|
|
28
|
-
step(generator.next(value));
|
|
29
|
-
} catch (e) {
|
|
30
|
-
reject(e);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
var rejected = (value) => {
|
|
34
|
-
try {
|
|
35
|
-
step(generator.throw(value));
|
|
36
|
-
} catch (e) {
|
|
37
|
-
reject(e);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
41
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
24
|
var get_projects_by_workspace_file_exports = {};
|
|
45
25
|
__export(get_projects_by_workspace_file_exports, {
|
|
46
26
|
getProjectsByWorkspaceFile: () => getProjectsByWorkspaceFile,
|
|
@@ -53,7 +33,7 @@ var import_utils = require("@modern-js/utils");
|
|
|
53
33
|
var import_monorepo = require("../parse-config/monorepo");
|
|
54
34
|
var import_constants = require("../constants");
|
|
55
35
|
var import_get_projects_by_packages_config = require("./get-projects-by-packages-config");
|
|
56
|
-
const getProjectsByWorkspaceFile = (rootPath, config, ignoreConfigs) =>
|
|
36
|
+
const getProjectsByWorkspaceFile = async (rootPath, config, ignoreConfigs) => {
|
|
57
37
|
var _a, _b, _c;
|
|
58
38
|
let { workspaceFile } = config;
|
|
59
39
|
if (!config.enableAutoFinder && (!("workspaceFile" in config) || ((_a = config.workspaceFile) == null ? void 0 : _a.length) === 0)) {
|
|
@@ -66,7 +46,7 @@ const getProjectsByWorkspaceFile = (rootPath, config, ignoreConfigs) => __async(
|
|
|
66
46
|
}
|
|
67
47
|
let packagesConfig = [];
|
|
68
48
|
if (workspaceFile === import_constants.WORKSPACE_FILE.PNPM) {
|
|
69
|
-
const yamlString =
|
|
49
|
+
const yamlString = await import_node_core_library.FileSystem.readFileAsync(
|
|
70
50
|
path.resolve("/", rootPath, workspaceFile)
|
|
71
51
|
).then((data) => data.toString());
|
|
72
52
|
const pnpmWorkspace = import_utils.yaml.load(yamlString);
|
|
@@ -78,13 +58,13 @@ const getProjectsByWorkspaceFile = (rootPath, config, ignoreConfigs) => __async(
|
|
|
78
58
|
const lernaJson = import_node_core_library.JsonFile.load(path.resolve(rootPath, workspaceFile));
|
|
79
59
|
packagesConfig = (_c = lernaJson.packages) != null ? _c : [];
|
|
80
60
|
}
|
|
81
|
-
const projects =
|
|
61
|
+
const projects = await (0, import_get_projects_by_packages_config.getProjectsByPackageConfig)(
|
|
82
62
|
rootPath,
|
|
83
63
|
packagesConfig,
|
|
84
64
|
ignoreConfigs
|
|
85
65
|
);
|
|
86
66
|
return projects;
|
|
87
|
-
}
|
|
67
|
+
};
|
|
88
68
|
const syncGetProjectsByWorkspaceFile = (rootPath, config, ignoreConfigs) => {
|
|
89
69
|
var _a, _b, _c;
|
|
90
70
|
let { workspaceFile } = config;
|