@modern-js/monorepo-tools 2.35.0 → 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.
Files changed (95) hide show
  1. package/dist/cjs/cli/build.js +26 -9
  2. package/dist/cjs/cli/buildWatch.js +26 -9
  3. package/dist/cjs/cli/clear.js +26 -9
  4. package/dist/cjs/cli/deploy.js +26 -9
  5. package/dist/cjs/cli/index.js +30 -9
  6. package/dist/cjs/cli/install.js +26 -9
  7. package/dist/cjs/cli/new.js +29 -12
  8. package/dist/cjs/commands/build.js +33 -16
  9. package/dist/cjs/commands/buildWatch.js +32 -15
  10. package/dist/cjs/commands/clear.js +30 -13
  11. package/dist/cjs/commands/deploy.js +34 -17
  12. package/dist/cjs/commands/index.js +28 -8
  13. package/dist/cjs/commands/install.js +32 -15
  14. package/dist/cjs/constants.js +25 -15
  15. package/dist/cjs/dag/create.js +25 -9
  16. package/dist/cjs/dag/edgeManager.js +26 -9
  17. package/dist/cjs/dag/index.js +28 -11
  18. package/dist/cjs/dag/operator.js +59 -34
  19. package/dist/cjs/dag/task.js +46 -20
  20. package/dist/cjs/dag/utils.js +33 -25
  21. package/dist/cjs/features/build/index.js +51 -32
  22. package/dist/cjs/features/clear/index.js +47 -28
  23. package/dist/cjs/features/deploy/index.js +66 -41
  24. package/dist/cjs/features/dev/cmds.js +24 -7
  25. package/dist/cjs/features/dev/createTask.js +50 -31
  26. package/dist/cjs/features/dev/index.js +47 -21
  27. package/dist/cjs/features/dev/watchProjectsState.js +43 -17
  28. package/dist/cjs/features/install/index.js +55 -29
  29. package/dist/cjs/hooks/index.js +26 -9
  30. package/dist/cjs/index.js +45 -35
  31. package/dist/cjs/locale/en.js +24 -7
  32. package/dist/cjs/locale/index.js +31 -21
  33. package/dist/cjs/locale/zh.js +24 -7
  34. package/dist/cjs/log/error.js +24 -7
  35. package/dist/cjs/log/multiTasksLog.js +33 -16
  36. package/dist/cjs/log/time.js +29 -20
  37. package/dist/cjs/log/utils.js +24 -7
  38. package/dist/cjs/package/index.js +28 -11
  39. package/dist/cjs/parse-config/index.js +39 -13
  40. package/dist/cjs/parse-config/monorepo.js +55 -39
  41. package/dist/cjs/projects/checkProjectChange.js +65 -50
  42. package/dist/cjs/projects/clearMemoryFiles.js +39 -13
  43. package/dist/cjs/projects/getProjects.js +37 -27
  44. package/dist/cjs/projects/getProjectsByPackagesConfig.js +51 -33
  45. package/dist/cjs/projects/getProjectsByWorkspaceFile.js +63 -44
  46. package/dist/cjs/type.js +15 -3
  47. package/dist/cjs/utils/install.js +43 -24
  48. package/dist/cjs/utils/types.js +15 -3
  49. package/dist/esm/cli/build.js +4 -1
  50. package/dist/esm/cli/buildWatch.js +4 -1
  51. package/dist/esm/cli/clear.js +4 -1
  52. package/dist/esm/cli/deploy.js +4 -1
  53. package/dist/esm/cli/install.js +4 -1
  54. package/dist/esm/cli/new.js +4 -1
  55. package/dist/esm/commands/build.js +4 -1
  56. package/dist/esm/commands/buildWatch.js +4 -1
  57. package/dist/esm/commands/clear.js +4 -1
  58. package/dist/esm/commands/deploy.js +4 -1
  59. package/dist/esm/commands/install.js +4 -1
  60. package/dist/esm/constants.js +6 -2
  61. package/dist/esm/dag/create.js +5 -3
  62. package/dist/esm/dag/edgeManager.js +4 -1
  63. package/dist/esm/dag/index.js +4 -1
  64. package/dist/esm/dag/operator.js +5 -3
  65. package/dist/esm/dag/task.js +4 -1
  66. package/dist/esm/dag/utils.js +10 -4
  67. package/dist/esm/features/build/index.js +6 -2
  68. package/dist/esm/features/clear/index.js +6 -2
  69. package/dist/esm/features/deploy/index.js +5 -3
  70. package/dist/esm/features/dev/cmds.js +4 -1
  71. package/dist/esm/features/dev/createTask.js +6 -2
  72. package/dist/esm/features/dev/index.js +4 -1
  73. package/dist/esm/features/dev/watchProjectsState.js +4 -1
  74. package/dist/esm/features/install/index.js +6 -3
  75. package/dist/esm/hooks/index.js +4 -1
  76. package/dist/esm/index.js +6 -2
  77. package/dist/esm/locale/en.js +4 -1
  78. package/dist/esm/locale/index.js +4 -1
  79. package/dist/esm/locale/zh.js +4 -1
  80. package/dist/esm/log/error.js +4 -1
  81. package/dist/esm/log/multiTasksLog.js +4 -1
  82. package/dist/esm/log/time.js +8 -3
  83. package/dist/esm/log/utils.js +4 -1
  84. package/dist/esm/package/index.js +4 -1
  85. package/dist/esm/parse-config/index.js +4 -1
  86. package/dist/esm/parse-config/monorepo.js +12 -5
  87. package/dist/esm/projects/checkProjectChange.js +12 -5
  88. package/dist/esm/projects/clearMemoryFiles.js +4 -1
  89. package/dist/esm/projects/getProjects.js +6 -2
  90. package/dist/esm/projects/getProjectsByPackagesConfig.js +6 -2
  91. package/dist/esm/projects/getProjectsByWorkspaceFile.js +10 -6
  92. package/dist/esm/type.js +0 -1
  93. package/dist/esm/utils/install.js +6 -2
  94. package/dist/esm/utils/types.js +0 -1
  95. package/package.json +11 -11
@@ -1,21 +1,47 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "clearProjectsMemoryFile", {
6
- enumerable: true,
7
- get: function() {
8
- return clearProjectsMemoryFile;
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 clearMemoryFiles_exports = {};
30
+ __export(clearMemoryFiles_exports, {
31
+ clearProjectsMemoryFile: () => clearProjectsMemoryFile
10
32
  });
11
- const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
- const _path = /* @__PURE__ */ _interop_require_wildcard._(require("path"));
13
- const _nodecorelibrary = require("@rushstack/node-core-library");
14
- const _checkProjectChange = require("./checkProjectChange");
33
+ module.exports = __toCommonJS(clearMemoryFiles_exports);
34
+ var path = __toESM(require("path"));
35
+ var import_node_core_library = require("@rushstack/node-core-library");
36
+ var import_checkProjectChange = require("./checkProjectChange");
15
37
  const clearProjectsMemoryFile = (projects) => {
16
38
  for (const project of projects) {
17
- const memoryFilePath = _path.join(project.extra.path, _checkProjectChange.PROJECT_MEMORY_PATH, _checkProjectChange.PROJECT_CONTENT_FILE_NAME);
39
+ const memoryFilePath = path.join(project.extra.path, import_checkProjectChange.PROJECT_MEMORY_PATH, import_checkProjectChange.PROJECT_CONTENT_FILE_NAME);
18
40
  console.info("remove", memoryFilePath);
19
- _nodecorelibrary.FileSystem.deleteFile(memoryFilePath);
41
+ import_node_core_library.FileSystem.deleteFile(memoryFilePath);
20
42
  }
21
43
  };
44
+ // Annotate the CommonJS export names for ESM import in node:
45
+ 0 && (module.exports = {
46
+ clearProjectsMemoryFile
47
+ });
@@ -1,26 +1,31 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
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
- Object.defineProperty(target, name, {
8
- enumerable: true,
9
- get: all[name]
10
- });
11
- }
12
- _export(exports, {
13
- getProjects: function() {
14
- return getProjects;
15
- },
16
- syncGetProjects: function() {
17
- return syncGetProjects;
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 });
18
15
  }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var getProjects_exports = {};
20
+ __export(getProjects_exports, {
21
+ getProjects: () => getProjects,
22
+ syncGetProjects: () => syncGetProjects
19
23
  });
20
- const _error = require("../log/error");
21
- const _monorepo = require("../parse-config/monorepo");
22
- const _getProjectsByPackagesConfig = require("./getProjectsByPackagesConfig");
23
- const _getProjectsByWorkspaceFile = require("./getProjectsByWorkspaceFile");
24
+ module.exports = __toCommonJS(getProjects_exports);
25
+ var import_error = require("../log/error");
26
+ var import_monorepo = require("../parse-config/monorepo");
27
+ var import_getProjectsByPackagesConfig = require("./getProjectsByPackagesConfig");
28
+ var import_getProjectsByWorkspaceFile = require("./getProjectsByWorkspaceFile");
24
29
  var FindProjectsMode;
25
30
  (function(FindProjectsMode2) {
26
31
  FindProjectsMode2[FindProjectsMode2["Rough"] = 0] = "Rough";
@@ -46,9 +51,9 @@ const getProjectsByProjectsConfig = (rootPath, configs = []) => {
46
51
  const getProjectsByPackagesMatch = async (rootPath, match, ignore) => {
47
52
  let projects = [];
48
53
  if (Array.isArray(match)) {
49
- projects = await (0, _getProjectsByPackagesConfig.getProjectsByPackageConfig)(rootPath, match, ignore);
54
+ projects = await (0, import_getProjectsByPackagesConfig.getProjectsByPackageConfig)(rootPath, match, ignore);
50
55
  } else {
51
- projects = await (0, _getProjectsByWorkspaceFile.getProjectsByWorkspaceFile)(rootPath, match, ignore);
56
+ projects = await (0, import_getProjectsByWorkspaceFile.getProjectsByWorkspaceFile)(rootPath, match, ignore);
52
57
  }
53
58
  const subProjects = [];
54
59
  for (const project of projects) {
@@ -70,9 +75,9 @@ const getProjectsByPackagesMatch = async (rootPath, match, ignore) => {
70
75
  const syncGetProjectsByPackagesMatch = (rootPath, match, ignore) => {
71
76
  let projects = [];
72
77
  if (Array.isArray(match)) {
73
- projects = (0, _getProjectsByPackagesConfig.syncGetProjectsByPackageConfig)(rootPath, match, ignore);
78
+ projects = (0, import_getProjectsByPackagesConfig.syncGetProjectsByPackageConfig)(rootPath, match, ignore);
74
79
  } else {
75
- projects = (0, _getProjectsByWorkspaceFile.syncGetProjectsByWorkspaceFile)(rootPath, match, ignore);
80
+ projects = (0, import_getProjectsByWorkspaceFile.syncGetProjectsByWorkspaceFile)(rootPath, match, ignore);
76
81
  }
77
82
  const subProjects = [];
78
83
  for (const project of projects) {
@@ -102,12 +107,12 @@ const checkFindProjectsMode = (config) => {
102
107
  return FindProjectsMode.Precise;
103
108
  }
104
109
  if (config.projectsConfig && config.packagesMatchs) {
105
- (0, _error.errorLog)("There can not be both `packagesMatchs` and `projectsConfig`");
110
+ (0, import_error.errorLog)("There can not be both `packagesMatchs` and `projectsConfig`");
106
111
  }
107
- (0, _error.errorLog)("No `packagesMatchs` and `projectsConfig` configurations found");
112
+ (0, import_error.errorLog)("No `packagesMatchs` and `projectsConfig` configurations found");
108
113
  };
109
114
  const getProjects = async (config, currentDir = process.cwd()) => {
110
- const { rootPath } = (0, _monorepo.getMonorepoBaseData)(currentDir);
115
+ const { rootPath } = (0, import_monorepo.getMonorepoBaseData)(currentDir);
111
116
  const mode = checkFindProjectsMode(config);
112
117
  let projects = [];
113
118
  if (mode === FindProjectsMode.Rough) {
@@ -118,7 +123,7 @@ const getProjects = async (config, currentDir = process.cwd()) => {
118
123
  return projects;
119
124
  };
120
125
  const syncGetProjects = (config, currentDir = process.cwd()) => {
121
- const { rootPath } = (0, _monorepo.getMonorepoBaseData)(currentDir);
126
+ const { rootPath } = (0, import_monorepo.getMonorepoBaseData)(currentDir);
122
127
  const mode = checkFindProjectsMode(config);
123
128
  let projects = [];
124
129
  if (mode === FindProjectsMode.Rough) {
@@ -128,3 +133,8 @@ const syncGetProjects = (config, currentDir = process.cwd()) => {
128
133
  }
129
134
  return projects;
130
135
  };
136
+ // Annotate the CommonJS export names for ESM import in node:
137
+ 0 && (module.exports = {
138
+ getProjects,
139
+ syncGetProjects
140
+ });
@@ -1,31 +1,44 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
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
- Object.defineProperty(target, name, {
8
- enumerable: true,
9
- get: all[name]
10
- });
11
- }
12
- _export(exports, {
13
- getProjectsByPackageConfig: function() {
14
- return getProjectsByPackageConfig;
15
- },
16
- syncGetProjectsByPackageConfig: function() {
17
- return syncGetProjectsByPackageConfig;
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 });
18
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 getProjectsByPackagesConfig_exports = {};
30
+ __export(getProjectsByPackagesConfig_exports, {
31
+ getProjectsByPackageConfig: () => getProjectsByPackageConfig,
32
+ syncGetProjectsByPackageConfig: () => syncGetProjectsByPackageConfig
19
33
  });
20
- const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
21
- const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
22
- const _path = /* @__PURE__ */ _interop_require_wildcard._(require("path"));
23
- const _nodecorelibrary = require("@rushstack/node-core-library");
24
- const _utils = require("@modern-js/utils");
25
- const _pmap = /* @__PURE__ */ _interop_require_default._(require("p-map"));
26
- const _error = require("../log/error");
27
- const _package = require("../package");
28
- const normalize = (results) => results.map((fp) => _path.normalize(fp));
34
+ module.exports = __toCommonJS(getProjectsByPackagesConfig_exports);
35
+ var path = __toESM(require("path"));
36
+ var import_node_core_library = require("@rushstack/node-core-library");
37
+ var import_utils = require("@modern-js/utils");
38
+ var import_p_map = __toESM(require("p-map"));
39
+ var import_error = require("../log/error");
40
+ var import_package = require("../package");
41
+ const normalize = (results) => results.map((fp) => path.normalize(fp));
29
42
  const getGlobOpts = (rootPath, packageConfigs, ignore = []) => {
30
43
  const globOpts = {
31
44
  cwd: rootPath,
@@ -35,7 +48,7 @@ const getGlobOpts = (rootPath, packageConfigs, ignore = []) => {
35
48
  };
36
49
  if (packageConfigs.some((cfg) => cfg.includes("**"))) {
37
50
  if (packageConfigs.some((cfg) => cfg.includes("node_modules"))) {
38
- (0, _error.errorLog)("An explicit node_modules package path does not allow globstars (**)");
51
+ (0, import_error.errorLog)("An explicit node_modules package path does not allow globstars (**)");
39
52
  }
40
53
  globOpts.ignore = [
41
54
  // allow globs like "packages/**",
@@ -54,8 +67,8 @@ const makeFileFinder = (rootPath, packageConfigs, ignoreConfigs = []) => {
54
67
  ...customGlobOpts,
55
68
  ...globOpts
56
69
  };
57
- const promise = (0, _pmap.default)(Array.from(packageConfigs).sort(), async (globPath) => {
58
- let result = await (0, _utils.globby)(_path.posix.join(globPath, fileName), options);
70
+ const promise = (0, import_p_map.default)(Array.from(packageConfigs).sort(), async (globPath) => {
71
+ let result = await (0, import_utils.globby)(path.posix.join(globPath, fileName), options);
59
72
  result = result.sort();
60
73
  result = normalize(result);
61
74
  return fileMapper(result);
@@ -70,13 +83,13 @@ const getProjectsByPackageConfig = async (rootPath, packagesConfig, ignoreConfig
70
83
  const finder = makeFileFinder(rootPath, packagesConfig, ignoreConfigs);
71
84
  const fileName = "package.json";
72
85
  const mapper = (packageConfigPath) => {
73
- const packageJsonLookup = new _nodecorelibrary.PackageJsonLookup({
86
+ const packageJsonLookup = new import_node_core_library.PackageJsonLookup({
74
87
  loadExtraFields: true
75
88
  });
76
89
  const packageJson = packageJsonLookup.loadNodePackageJson(packageConfigPath);
77
- return new _package.Package(packageJson, _path.dirname(packageConfigPath), rootPath);
90
+ return new import_package.Package(packageJson, path.dirname(packageConfigPath), rootPath);
78
91
  };
79
- const projects = await finder(fileName, (filePaths) => (0, _pmap.default)(filePaths, mapper, {
92
+ const projects = await finder(fileName, (filePaths) => (0, import_p_map.default)(filePaths, mapper, {
80
93
  concurrency: filePaths.length || Infinity
81
94
  }), {});
82
95
  return projects;
@@ -90,7 +103,7 @@ const makeSyncFileFinder = (rootPath, packageConfigs, ignoreConfigs = []) => {
90
103
  ...globOpts
91
104
  };
92
105
  for (const globPath of Array.from(packageConfigs).sort()) {
93
- let result = _utils.globby.sync(_path.posix.join(globPath, fileName), options);
106
+ let result = import_utils.globby.sync(path.posix.join(globPath, fileName), options);
94
107
  result = result.sort();
95
108
  result = normalize(result);
96
109
  results.push(fileMapper(result));
@@ -102,12 +115,17 @@ const syncGetProjectsByPackageConfig = (rootPath, packagesConfig, ignoreConfigs)
102
115
  const finder = makeSyncFileFinder(rootPath, packagesConfig, ignoreConfigs);
103
116
  const fileName = "package.json";
104
117
  const mapper = (packageConfigPath) => {
105
- const packageJsonLookup = new _nodecorelibrary.PackageJsonLookup({
118
+ const packageJsonLookup = new import_node_core_library.PackageJsonLookup({
106
119
  loadExtraFields: true
107
120
  });
108
121
  const packageJson = packageJsonLookup.loadNodePackageJson(packageConfigPath);
109
- return new _package.Package(packageJson, _path.dirname(packageConfigPath), rootPath);
122
+ return new import_package.Package(packageJson, path.dirname(packageConfigPath), rootPath);
110
123
  };
111
124
  const projects = finder(fileName, (filePaths) => filePaths.map((filePath) => mapper(filePath)), {});
112
125
  return projects;
113
126
  };
127
+ // Annotate the CommonJS export names for ESM import in node:
128
+ 0 && (module.exports = {
129
+ getProjectsByPackageConfig,
130
+ syncGetProjectsByPackageConfig
131
+ });
@@ -1,29 +1,43 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
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
- Object.defineProperty(target, name, {
8
- enumerable: true,
9
- get: all[name]
10
- });
11
- }
12
- _export(exports, {
13
- getProjectsByWorkspaceFile: function() {
14
- return getProjectsByWorkspaceFile;
15
- },
16
- syncGetProjectsByWorkspaceFile: function() {
17
- return syncGetProjectsByWorkspaceFile;
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 });
18
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 getProjectsByWorkspaceFile_exports = {};
30
+ __export(getProjectsByWorkspaceFile_exports, {
31
+ getProjectsByWorkspaceFile: () => getProjectsByWorkspaceFile,
32
+ syncGetProjectsByWorkspaceFile: () => syncGetProjectsByWorkspaceFile
19
33
  });
20
- const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
21
- const _path = /* @__PURE__ */ _interop_require_wildcard._(require("path"));
22
- const _nodecorelibrary = require("@rushstack/node-core-library");
23
- const _utils = require("@modern-js/utils");
24
- const _monorepo = require("../parse-config/monorepo");
25
- const _constants = require("../constants");
26
- const _getProjectsByPackagesConfig = require("./getProjectsByPackagesConfig");
34
+ module.exports = __toCommonJS(getProjectsByWorkspaceFile_exports);
35
+ var path = __toESM(require("path"));
36
+ var import_node_core_library = require("@rushstack/node-core-library");
37
+ var import_utils = require("@modern-js/utils");
38
+ var import_monorepo = require("../parse-config/monorepo");
39
+ var import_constants = require("../constants");
40
+ var import_getProjectsByPackagesConfig = require("./getProjectsByPackagesConfig");
27
41
  const getProjectsByWorkspaceFile = async (rootPath, config, ignoreConfigs) => {
28
42
  var _config_workspaceFile;
29
43
  let { workspaceFile } = config;
@@ -31,23 +45,23 @@ const getProjectsByWorkspaceFile = async (rootPath, config, ignoreConfigs) => {
31
45
  throw new Error("Missing workspaceFile Key or workspaceFile is empty string");
32
46
  }
33
47
  if (config.enableAutoFinder) {
34
- workspaceFile = (0, _monorepo.getWorkspaceFile)(rootPath);
48
+ workspaceFile = (0, import_monorepo.getWorkspaceFile)(rootPath);
35
49
  }
36
50
  let packagesConfig = [];
37
- if (workspaceFile === _constants.WORKSPACE_FILE.PNPM) {
38
- const yamlString = await _nodecorelibrary.FileSystem.readFileAsync(_path.resolve("/", rootPath, workspaceFile)).then((data) => data.toString());
39
- const pnpmWorkspace = _utils.yaml.load(yamlString);
51
+ if (workspaceFile === import_constants.WORKSPACE_FILE.PNPM) {
52
+ const yamlString = await import_node_core_library.FileSystem.readFileAsync(path.resolve("/", rootPath, workspaceFile)).then((data) => data.toString());
53
+ const pnpmWorkspace = import_utils.yaml.load(yamlString);
40
54
  packagesConfig = pnpmWorkspace.packages || [];
41
- } else if (workspaceFile === _constants.WORKSPACE_FILE.YARN) {
42
- var _pkgJson_workspaces, _pkgJson;
43
- const pkgJson = _nodecorelibrary.JsonFile.load(_path.resolve(rootPath, workspaceFile));
44
- packagesConfig = ((_pkgJson = pkgJson) === null || _pkgJson === void 0 ? void 0 : (_pkgJson_workspaces = _pkgJson.workspaces) === null || _pkgJson_workspaces === void 0 ? void 0 : _pkgJson_workspaces.packages) || [];
45
- } else if (workspaceFile === _constants.WORKSPACE_FILE.LERNA) {
46
- const lernaJson = _nodecorelibrary.JsonFile.load(_path.resolve(rootPath, workspaceFile));
55
+ } else if (workspaceFile === import_constants.WORKSPACE_FILE.YARN) {
56
+ var _pkgJson_workspaces;
57
+ const pkgJson = import_node_core_library.JsonFile.load(path.resolve(rootPath, workspaceFile));
58
+ packagesConfig = (pkgJson === null || pkgJson === void 0 ? void 0 : (_pkgJson_workspaces = pkgJson.workspaces) === null || _pkgJson_workspaces === void 0 ? void 0 : _pkgJson_workspaces.packages) || [];
59
+ } else if (workspaceFile === import_constants.WORKSPACE_FILE.LERNA) {
60
+ const lernaJson = import_node_core_library.JsonFile.load(path.resolve(rootPath, workspaceFile));
47
61
  var _lernaJson_packages;
48
62
  packagesConfig = (_lernaJson_packages = lernaJson.packages) !== null && _lernaJson_packages !== void 0 ? _lernaJson_packages : [];
49
63
  }
50
- const projects = await (0, _getProjectsByPackagesConfig.getProjectsByPackageConfig)(rootPath, packagesConfig, ignoreConfigs);
64
+ const projects = await (0, import_getProjectsByPackagesConfig.getProjectsByPackageConfig)(rootPath, packagesConfig, ignoreConfigs);
51
65
  return projects;
52
66
  };
53
67
  const syncGetProjectsByWorkspaceFile = (rootPath, config, ignoreConfigs) => {
@@ -57,22 +71,27 @@ const syncGetProjectsByWorkspaceFile = (rootPath, config, ignoreConfigs) => {
57
71
  throw new Error("Missing workspaceFile Key or workspaceFile is empty string");
58
72
  }
59
73
  if (config.enableAutoFinder) {
60
- workspaceFile = (0, _monorepo.getWorkspaceFile)(rootPath);
74
+ workspaceFile = (0, import_monorepo.getWorkspaceFile)(rootPath);
61
75
  }
62
76
  let packagesConfig = [];
63
- if (workspaceFile === _constants.WORKSPACE_FILE.PNPM) {
64
- const yamlString = _utils.fs.readFileSync(_path.resolve("/", rootPath, workspaceFile), "utf-8");
65
- const pnpmWorkspace = _utils.yaml.load(yamlString);
77
+ if (workspaceFile === import_constants.WORKSPACE_FILE.PNPM) {
78
+ const yamlString = import_utils.fs.readFileSync(path.resolve("/", rootPath, workspaceFile), "utf-8");
79
+ const pnpmWorkspace = import_utils.yaml.load(yamlString);
66
80
  packagesConfig = pnpmWorkspace.packages || [];
67
- } else if (workspaceFile === _constants.WORKSPACE_FILE.YARN) {
68
- var _pkgJson_workspaces, _pkgJson;
69
- const pkgJson = _nodecorelibrary.JsonFile.load(_path.resolve(rootPath, workspaceFile));
70
- packagesConfig = ((_pkgJson = pkgJson) === null || _pkgJson === void 0 ? void 0 : (_pkgJson_workspaces = _pkgJson.workspaces) === null || _pkgJson_workspaces === void 0 ? void 0 : _pkgJson_workspaces.packages) || [];
71
- } else if (workspaceFile === _constants.WORKSPACE_FILE.LERNA) {
72
- const lernaJson = _nodecorelibrary.JsonFile.load(_path.resolve(rootPath, workspaceFile));
81
+ } else if (workspaceFile === import_constants.WORKSPACE_FILE.YARN) {
82
+ var _pkgJson_workspaces;
83
+ const pkgJson = import_node_core_library.JsonFile.load(path.resolve(rootPath, workspaceFile));
84
+ packagesConfig = (pkgJson === null || pkgJson === void 0 ? void 0 : (_pkgJson_workspaces = pkgJson.workspaces) === null || _pkgJson_workspaces === void 0 ? void 0 : _pkgJson_workspaces.packages) || [];
85
+ } else if (workspaceFile === import_constants.WORKSPACE_FILE.LERNA) {
86
+ const lernaJson = import_node_core_library.JsonFile.load(path.resolve(rootPath, workspaceFile));
73
87
  var _lernaJson_packages;
74
88
  packagesConfig = (_lernaJson_packages = lernaJson.packages) !== null && _lernaJson_packages !== void 0 ? _lernaJson_packages : [];
75
89
  }
76
- const projects = (0, _getProjectsByPackagesConfig.syncGetProjectsByPackageConfig)(rootPath, packagesConfig, ignoreConfigs);
90
+ const projects = (0, import_getProjectsByPackagesConfig.syncGetProjectsByPackageConfig)(rootPath, packagesConfig, ignoreConfigs);
77
91
  return projects;
78
92
  };
93
+ // Annotate the CommonJS export names for ESM import in node:
94
+ 0 && (module.exports = {
95
+ getProjectsByWorkspaceFile,
96
+ syncGetProjectsByWorkspaceFile
97
+ });
package/dist/cjs/type.js CHANGED
@@ -1,4 +1,16 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var type_exports = {};
16
+ module.exports = __toCommonJS(type_exports);
@@ -1,33 +1,47 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
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
- Object.defineProperty(target, name, {
8
- enumerable: true,
9
- get: all[name]
10
- });
11
- }
12
- _export(exports, {
13
- removeLockFile: function() {
14
- return removeLockFile;
15
- },
16
- installByPackageManager: function() {
17
- return installByPackageManager;
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 });
18
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 install_exports = {};
30
+ __export(install_exports, {
31
+ installByPackageManager: () => installByPackageManager,
32
+ removeLockFile: () => removeLockFile
19
33
  });
20
- const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
21
- const _path = /* @__PURE__ */ _interop_require_wildcard._(require("path"));
22
- const _utils = require("@modern-js/utils");
23
- const _constants = require("../constants");
34
+ module.exports = __toCommonJS(install_exports);
35
+ var path = __toESM(require("path"));
36
+ var import_utils = require("@modern-js/utils");
37
+ var import_constants = require("../constants");
24
38
  const removeLockFile = (rootPath, packageManager) => {
25
39
  if (packageManager === "pnpm") {
26
- _utils.fs.removeSync(_path.join(rootPath, _constants.LOCK_FILE.PNPM));
40
+ import_utils.fs.removeSync(path.join(rootPath, import_constants.LOCK_FILE.PNPM));
27
41
  } else if (packageManager === "yarn") {
28
- _utils.fs.removeSync(_path.join(rootPath, _constants.LOCK_FILE.YARN));
42
+ import_utils.fs.removeSync(path.join(rootPath, import_constants.LOCK_FILE.YARN));
29
43
  } else if (packageManager === "npm") {
30
- _utils.fs.removeSync(_path.join(rootPath, _constants.LOCK_FILE.NPM));
44
+ import_utils.fs.removeSync(path.join(rootPath, import_constants.LOCK_FILE.NPM));
31
45
  }
32
46
  };
33
47
  const installByPackageManager = async (packageManager, { rootPath, removeLock }) => {
@@ -35,17 +49,22 @@ const installByPackageManager = async (packageManager, { rootPath, removeLock })
35
49
  removeLockFile(rootPath, packageManager);
36
50
  }
37
51
  if (packageManager === "pnpm") {
38
- await (0, _utils.execa)("pnpm", [
52
+ await (0, import_utils.execa)("pnpm", [
39
53
  "install"
40
54
  ], {
41
55
  stdio: "inherit"
42
56
  });
43
57
  }
44
58
  if (packageManager === "yarn") {
45
- await (0, _utils.execa)("yarn", [
59
+ await (0, import_utils.execa)("yarn", [
46
60
  "install"
47
61
  ], {
48
62
  stdio: "inherit"
49
63
  });
50
64
  }
51
65
  };
66
+ // Annotate the CommonJS export names for ESM import in node:
67
+ 0 && (module.exports = {
68
+ installByPackageManager,
69
+ removeLockFile
70
+ });
@@ -1,4 +1,16 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var types_exports = {};
16
+ module.exports = __toCommonJS(types_exports);
@@ -1,6 +1,9 @@
1
1
  import { build } from "../commands";
2
- export const buildCli = (program, api) => {
2
+ const buildCli = (program, api) => {
3
3
  program.command("build [project]").usage("[options]").option("--no-self", "build without target project").option("-t, --dept", "build target project with project’s dependent").option("--no-deps", "build target project without project’s dependencies").option("--only-self", "build target project with nothing").option("-a, --all", "build target project with project’s dependencies and dependent").option("--content-hash", "build target project use content hash cache").option("--git-hash", "build target project use git hash cache").description("build target project").action(async (targetProjectName, option) => {
4
4
  await build(targetProjectName, option, api);
5
5
  });
6
6
  };
7
+ export {
8
+ buildCli
9
+ };
@@ -1,6 +1,9 @@
1
1
  import { buildWatch } from "../commands";
2
- export const buildWatchCli = (program, api) => {
2
+ const buildWatchCli = (program, api) => {
3
3
  program.command("build-watch [project]").usage("[options]").option("--only-self", "build target project with nothing").option("-i, --init", "init build beforebuild watch ").description("watch target project and target project’s dependencies").action(async (targetProjectName, option) => {
4
4
  await buildWatch(targetProjectName, option, api);
5
5
  });
6
6
  };
7
+ export {
8
+ buildWatchCli
9
+ };
@@ -1,6 +1,9 @@
1
1
  import { clear } from "../commands";
2
- export const clearCli = (program, api) => {
2
+ const clearCli = (program, api) => {
3
3
  program.command("clear [projects...]").usage("[options]").option("--remove-dirs [dirs...]", "remove dirs, default is node_modules").description("clear project dirs").action(async (targetProjectNames, option) => {
4
4
  await clear(targetProjectNames, option, api);
5
5
  });
6
6
  };
7
+ export {
8
+ clearCli
9
+ };
@@ -1,5 +1,5 @@
1
1
  import { deploy } from "../commands";
2
- export const deployCli = (program, api) => {
2
+ const deployCli = (program, api) => {
3
3
  program.command("deploy [project...]").usage("[options]").option("-p, --path [path]", "Specify the path of the output files", "output").description("deploy project").action(async (deployProjectNames, option) => {
4
4
  const ignoreMatchs = [
5
5
  "**/output/**"
@@ -7,3 +7,6 @@ export const deployCli = (program, api) => {
7
7
  await deploy(api, deployProjectNames, option, ignoreMatchs);
8
8
  });
9
9
  };
10
+ export {
11
+ deployCli
12
+ };