@modern-js/monorepo-tools 2.15.0 → 2.16.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 (96) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/cjs/cli/build.js +10 -31
  3. package/dist/cjs/cli/buildWatch.js +11 -31
  4. package/dist/cjs/cli/clear.js +11 -31
  5. package/dist/cjs/cli/deploy.js +14 -36
  6. package/dist/cjs/cli/index.js +23 -22
  7. package/dist/cjs/cli/install.js +11 -31
  8. package/dist/cjs/cli/new.js +17 -37
  9. package/dist/cjs/commands/build.js +21 -46
  10. package/dist/cjs/commands/buildWatch.js +19 -36
  11. package/dist/cjs/commands/clear.js +17 -34
  12. package/dist/cjs/commands/deploy.js +25 -41
  13. package/dist/cjs/commands/index.js +22 -21
  14. package/dist/cjs/commands/install.js +19 -36
  15. package/dist/cjs/constants.js +13 -26
  16. package/dist/cjs/dag/create.js +16 -28
  17. package/dist/cjs/dag/edgeManager.js +24 -28
  18. package/dist/cjs/dag/index.js +11 -29
  19. package/dist/cjs/dag/operator.js +106 -123
  20. package/dist/cjs/dag/task.js +52 -63
  21. package/dist/cjs/dag/utils.js +52 -49
  22. package/dist/cjs/features/build/index.js +52 -68
  23. package/dist/cjs/features/clear/index.js +66 -47
  24. package/dist/cjs/features/deploy/index.js +126 -96
  25. package/dist/cjs/features/dev/cmds.js +10 -25
  26. package/dist/cjs/features/dev/createTask.js +93 -56
  27. package/dist/cjs/features/dev/index.js +43 -71
  28. package/dist/cjs/features/dev/watchProjectsState.js +89 -64
  29. package/dist/cjs/features/install/index.js +74 -63
  30. package/dist/cjs/hooks/index.js +9 -27
  31. package/dist/cjs/index.js +36 -53
  32. package/dist/cjs/locale/en.js +7 -25
  33. package/dist/cjs/locale/index.js +18 -28
  34. package/dist/cjs/locale/zh.js +7 -25
  35. package/dist/cjs/log/error.js +7 -25
  36. package/dist/cjs/log/multiTasksLog.js +42 -43
  37. package/dist/cjs/log/time.js +19 -29
  38. package/dist/cjs/log/utils.js +7 -25
  39. package/dist/cjs/package/index.js +28 -30
  40. package/dist/cjs/parse-config/index.js +61 -49
  41. package/dist/cjs/parse-config/monorepo.js +81 -67
  42. package/dist/cjs/projects/checkProjectChange.js +95 -73
  43. package/dist/cjs/projects/clearMemoryFiles.js +52 -44
  44. package/dist/cjs/projects/getProjects.js +38 -65
  45. package/dist/cjs/projects/getProjectsByPackagesConfig.js +93 -71
  46. package/dist/cjs/projects/getProjectsByWorkspaceFile.js +89 -85
  47. package/dist/cjs/type.js +4 -15
  48. package/dist/cjs/utils/install.js +69 -44
  49. package/dist/cjs/utils/types.js +4 -15
  50. package/dist/esm/cli/build.js +2 -8
  51. package/dist/esm/cli/buildWatch.js +4 -9
  52. package/dist/esm/cli/clear.js +4 -9
  53. package/dist/esm/cli/deploy.js +7 -14
  54. package/dist/esm/cli/install.js +4 -9
  55. package/dist/esm/cli/new.js +9 -14
  56. package/dist/esm/commands/build.js +7 -17
  57. package/dist/esm/commands/buildWatch.js +6 -8
  58. package/dist/esm/commands/clear.js +6 -8
  59. package/dist/esm/commands/deploy.js +10 -11
  60. package/dist/esm/commands/install.js +6 -8
  61. package/dist/esm/constants.js +2 -6
  62. package/dist/esm/dag/create.js +10 -7
  63. package/dist/esm/dag/edgeManager.js +17 -6
  64. package/dist/esm/dag/index.js +1 -4
  65. package/dist/esm/dag/operator.js +77 -74
  66. package/dist/esm/dag/task.js +39 -30
  67. package/dist/esm/dag/utils.js +39 -27
  68. package/dist/esm/features/build/index.js +22 -27
  69. package/dist/esm/features/clear/index.js +4 -6
  70. package/dist/esm/features/deploy/index.js +55 -50
  71. package/dist/esm/features/dev/cmds.js +4 -4
  72. package/dist/esm/features/dev/createTask.js +31 -15
  73. package/dist/esm/features/dev/index.js +19 -27
  74. package/dist/esm/features/dev/watchProjectsState.js +41 -31
  75. package/dist/esm/features/install/index.js +11 -15
  76. package/dist/esm/hooks/index.js +1 -4
  77. package/dist/esm/index.js +12 -11
  78. package/dist/esm/locale/en.js +1 -4
  79. package/dist/esm/locale/index.js +5 -5
  80. package/dist/esm/locale/zh.js +1 -4
  81. package/dist/esm/log/error.js +1 -4
  82. package/dist/esm/log/multiTasksLog.js +32 -18
  83. package/dist/esm/log/time.js +7 -8
  84. package/dist/esm/log/utils.js +1 -4
  85. package/dist/esm/package/index.js +21 -8
  86. package/dist/esm/parse-config/index.js +11 -14
  87. package/dist/esm/parse-config/monorepo.js +20 -27
  88. package/dist/esm/projects/checkProjectChange.js +19 -23
  89. package/dist/esm/projects/clearMemoryFiles.js +3 -13
  90. package/dist/esm/projects/getProjects.js +21 -45
  91. package/dist/esm/projects/getProjectsByPackagesConfig.js +29 -33
  92. package/dist/esm/projects/getProjectsByWorkspaceFile.js +21 -41
  93. package/dist/esm/type.js +1 -0
  94. package/dist/esm/utils/install.js +12 -8
  95. package/dist/esm/utils/types.js +1 -0
  96. package/package.json +16 -12
@@ -1,50 +1,58 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var clearMemoryFiles_exports = {};
29
- __export(clearMemoryFiles_exports, {
30
- clearProjectsMemoryFile: () => clearProjectsMemoryFile
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
31
4
  });
32
- module.exports = __toCommonJS(clearMemoryFiles_exports);
33
- var path = __toESM(require("path"));
34
- var import_node_core_library = require("@rushstack/node-core-library");
35
- var import_checkProjectChange = require("./checkProjectChange");
5
+ Object.defineProperty(exports, "clearProjectsMemoryFile", {
6
+ enumerable: true,
7
+ get: () => clearProjectsMemoryFile
8
+ });
9
+ const _path = /* @__PURE__ */ _interop_require_wildcard(require("path"));
10
+ const _nodecorelibrary = require("@rushstack/node-core-library");
11
+ const _checkProjectChange = require("./checkProjectChange");
12
+ function _getRequireWildcardCache(nodeInterop) {
13
+ if (typeof WeakMap !== "function")
14
+ return null;
15
+ var cacheBabelInterop = /* @__PURE__ */ new WeakMap();
16
+ var cacheNodeInterop = /* @__PURE__ */ new WeakMap();
17
+ return (_getRequireWildcardCache = function(nodeInterop2) {
18
+ return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
19
+ })(nodeInterop);
20
+ }
21
+ function _interop_require_wildcard(obj, nodeInterop) {
22
+ if (!nodeInterop && obj && obj.__esModule) {
23
+ return obj;
24
+ }
25
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
26
+ return {
27
+ default: obj
28
+ };
29
+ }
30
+ var cache = _getRequireWildcardCache(nodeInterop);
31
+ if (cache && cache.has(obj)) {
32
+ return cache.get(obj);
33
+ }
34
+ var newObj = {};
35
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
36
+ for (var key in obj) {
37
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
38
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
39
+ if (desc && (desc.get || desc.set)) {
40
+ Object.defineProperty(newObj, key, desc);
41
+ } else {
42
+ newObj[key] = obj[key];
43
+ }
44
+ }
45
+ }
46
+ newObj.default = obj;
47
+ if (cache) {
48
+ cache.set(obj, newObj);
49
+ }
50
+ return newObj;
51
+ }
36
52
  const clearProjectsMemoryFile = (projects) => {
37
53
  for (const project of projects) {
38
- const memoryFilePath = path.join(
39
- project.extra.path,
40
- import_checkProjectChange.PROJECT_MEMORY_PATH,
41
- import_checkProjectChange.PROJECT_CONTENT_FILE_NAME
42
- );
54
+ const memoryFilePath = _path.join(project.extra.path, _checkProjectChange.PROJECT_MEMORY_PATH, _checkProjectChange.PROJECT_CONTENT_FILE_NAME);
43
55
  console.info("remove", memoryFilePath);
44
- import_node_core_library.FileSystem.deleteFile(memoryFilePath);
56
+ _nodecorelibrary.FileSystem.deleteFile(memoryFilePath);
45
57
  }
46
58
  };
47
- // Annotate the CommonJS export names for ESM import in node:
48
- 0 && (module.exports = {
49
- clearProjectsMemoryFile
50
- });
@@ -1,41 +1,35 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
6
  for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var getProjects_exports = {};
19
- __export(getProjects_exports, {
7
+ Object.defineProperty(target, name, {
8
+ enumerable: true,
9
+ get: all[name]
10
+ });
11
+ }
12
+ _export(exports, {
20
13
  getProjects: () => getProjects,
21
14
  syncGetProjects: () => syncGetProjects
22
15
  });
23
- module.exports = __toCommonJS(getProjects_exports);
24
- var import_error = require("../log/error");
25
- var import_monorepo = require("../parse-config/monorepo");
26
- var import_getProjectsByPackagesConfig = require("./getProjectsByPackagesConfig");
27
- var import_getProjectsByWorkspaceFile = require("./getProjectsByWorkspaceFile");
28
- var FindProjectsMode = /* @__PURE__ */ ((FindProjectsMode2) => {
16
+ const _error = require("../log/error");
17
+ const _monorepo = require("../parse-config/monorepo");
18
+ const _getProjectsByPackagesConfig = require("./getProjectsByPackagesConfig");
19
+ const _getProjectsByWorkspaceFile = require("./getProjectsByWorkspaceFile");
20
+ var FindProjectsMode;
21
+ (function(FindProjectsMode2) {
29
22
  FindProjectsMode2[FindProjectsMode2["Rough"] = 0] = "Rough";
30
23
  FindProjectsMode2[FindProjectsMode2["Precise"] = 1] = "Precise";
31
- return FindProjectsMode2;
32
- })(FindProjectsMode || {});
24
+ })(FindProjectsMode || (FindProjectsMode = {}));
33
25
  const getProjectsByProjectsConfig = (rootPath, configs = []) => {
34
26
  const subProjects = [];
35
27
  for (const config of configs) {
36
28
  subProjects.push({
37
29
  name: config.name,
38
- extra: { path: config.path },
30
+ extra: {
31
+ path: config.path
32
+ },
39
33
  // dagNodeEdge: 0,
40
34
  dependencyEdge: 0,
41
35
  dependentEdge: 0,
@@ -48,13 +42,9 @@ const getProjectsByProjectsConfig = (rootPath, configs = []) => {
48
42
  const getProjectsByPackagesMatch = async (rootPath, match, ignore) => {
49
43
  let projects = [];
50
44
  if (Array.isArray(match)) {
51
- projects = await (0, import_getProjectsByPackagesConfig.getProjectsByPackageConfig)(rootPath, match, ignore);
45
+ projects = await (0, _getProjectsByPackagesConfig.getProjectsByPackageConfig)(rootPath, match, ignore);
52
46
  } else {
53
- projects = await (0, import_getProjectsByWorkspaceFile.getProjectsByWorkspaceFile)(
54
- rootPath,
55
- match,
56
- ignore
57
- );
47
+ projects = await (0, _getProjectsByWorkspaceFile.getProjectsByWorkspaceFile)(rootPath, match, ignore);
58
48
  }
59
49
  const subProjects = [];
60
50
  for (const project of projects) {
@@ -76,13 +66,9 @@ const getProjectsByPackagesMatch = async (rootPath, match, ignore) => {
76
66
  const syncGetProjectsByPackagesMatch = (rootPath, match, ignore) => {
77
67
  let projects = [];
78
68
  if (Array.isArray(match)) {
79
- projects = (0, import_getProjectsByPackagesConfig.syncGetProjectsByPackageConfig)(rootPath, match, ignore);
69
+ projects = (0, _getProjectsByPackagesConfig.syncGetProjectsByPackageConfig)(rootPath, match, ignore);
80
70
  } else {
81
- projects = (0, import_getProjectsByWorkspaceFile.syncGetProjectsByWorkspaceFile)(
82
- rootPath,
83
- match,
84
- ignore
85
- );
71
+ projects = (0, _getProjectsByWorkspaceFile.syncGetProjectsByWorkspaceFile)(rootPath, match, ignore);
86
72
  }
87
73
  const subProjects = [];
88
74
  for (const project of projects) {
@@ -103,51 +89,38 @@ const syncGetProjectsByPackagesMatch = (rootPath, match, ignore) => {
103
89
  };
104
90
  const checkFindProjectsMode = (config) => {
105
91
  if (config.packagesMatchs && Array.isArray(config.packagesMatchs)) {
106
- return 0 /* Rough */;
92
+ return FindProjectsMode.Rough;
107
93
  }
108
94
  if (config.packagesMatchs && typeof config.packagesMatchs === "object" && (config.packagesMatchs.workspaceFile || config.packagesMatchs.enableAutoFinder)) {
109
- return 0 /* Rough */;
95
+ return FindProjectsMode.Rough;
110
96
  }
111
97
  if (config.projectsConfig && Array.isArray(config.projectsConfig)) {
112
- return 1 /* Precise */;
98
+ return FindProjectsMode.Precise;
113
99
  }
114
100
  if (config.projectsConfig && config.packagesMatchs) {
115
- (0, import_error.errorLog)("There can not be both `packagesMatchs` and `projectsConfig`");
101
+ (0, _error.errorLog)("There can not be both `packagesMatchs` and `projectsConfig`");
116
102
  }
117
- (0, import_error.errorLog)("No `packagesMatchs` and `projectsConfig` configurations found");
103
+ (0, _error.errorLog)("No `packagesMatchs` and `projectsConfig` configurations found");
118
104
  };
119
105
  const getProjects = async (config, currentDir = process.cwd()) => {
120
- const { rootPath } = (0, import_monorepo.getMonorepoBaseData)(currentDir);
106
+ const { rootPath } = (0, _monorepo.getMonorepoBaseData)(currentDir);
121
107
  const mode = checkFindProjectsMode(config);
122
108
  let projects = [];
123
- if (mode === 0 /* Rough */) {
124
- projects = await getProjectsByPackagesMatch(
125
- rootPath,
126
- config.packagesMatchs,
127
- config.packagesIgnoreMatchs || []
128
- );
129
- } else if (mode === 1 /* Precise */) {
109
+ if (mode === FindProjectsMode.Rough) {
110
+ projects = await getProjectsByPackagesMatch(rootPath, config.packagesMatchs, config.packagesIgnoreMatchs || []);
111
+ } else if (mode === FindProjectsMode.Precise) {
130
112
  projects = getProjectsByProjectsConfig(rootPath, config.projectsConfig);
131
113
  }
132
114
  return projects;
133
115
  };
134
116
  const syncGetProjects = (config, currentDir = process.cwd()) => {
135
- const { rootPath } = (0, import_monorepo.getMonorepoBaseData)(currentDir);
117
+ const { rootPath } = (0, _monorepo.getMonorepoBaseData)(currentDir);
136
118
  const mode = checkFindProjectsMode(config);
137
119
  let projects = [];
138
- if (mode === 0 /* Rough */) {
139
- projects = syncGetProjectsByPackagesMatch(
140
- rootPath,
141
- config.packagesMatchs,
142
- config.packagesIgnoreMatchs || []
143
- );
144
- } else if (mode === 1 /* Precise */) {
120
+ if (mode === FindProjectsMode.Rough) {
121
+ projects = syncGetProjectsByPackagesMatch(rootPath, config.packagesMatchs, config.packagesIgnoreMatchs || []);
122
+ } else if (mode === FindProjectsMode.Precise) {
145
123
  projects = getProjectsByProjectsConfig(rootPath, config.projectsConfig);
146
124
  }
147
125
  return projects;
148
126
  };
149
- // Annotate the CommonJS export names for ESM import in node:
150
- 0 && (module.exports = {
151
- getProjects,
152
- syncGetProjects
153
- });
@@ -1,43 +1,70 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
8
6
  for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var getProjectsByPackagesConfig_exports = {};
29
- __export(getProjectsByPackagesConfig_exports, {
7
+ Object.defineProperty(target, name, {
8
+ enumerable: true,
9
+ get: all[name]
10
+ });
11
+ }
12
+ _export(exports, {
30
13
  getProjectsByPackageConfig: () => getProjectsByPackageConfig,
31
14
  syncGetProjectsByPackageConfig: () => syncGetProjectsByPackageConfig
32
15
  });
33
- module.exports = __toCommonJS(getProjectsByPackagesConfig_exports);
34
- var path = __toESM(require("path"));
35
- var import_node_core_library = require("@rushstack/node-core-library");
36
- var import_utils = require("@modern-js/utils");
37
- var import_p_map = __toESM(require("p-map"));
38
- var import_error = require("../log/error");
39
- var import_package = require("../package");
40
- const normalize = (results) => results.map((fp) => path.normalize(fp));
16
+ const _path = /* @__PURE__ */ _interop_require_wildcard(require("path"));
17
+ const _nodecorelibrary = require("@rushstack/node-core-library");
18
+ const _utils = require("@modern-js/utils");
19
+ const _pmap = /* @__PURE__ */ _interop_require_default(require("p-map"));
20
+ const _error = require("../log/error");
21
+ const _package = require("../package");
22
+ function _interop_require_default(obj) {
23
+ return obj && obj.__esModule ? obj : {
24
+ default: obj
25
+ };
26
+ }
27
+ function _getRequireWildcardCache(nodeInterop) {
28
+ if (typeof WeakMap !== "function")
29
+ return null;
30
+ var cacheBabelInterop = /* @__PURE__ */ new WeakMap();
31
+ var cacheNodeInterop = /* @__PURE__ */ new WeakMap();
32
+ return (_getRequireWildcardCache = function(nodeInterop2) {
33
+ return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
34
+ })(nodeInterop);
35
+ }
36
+ function _interop_require_wildcard(obj, nodeInterop) {
37
+ if (!nodeInterop && obj && obj.__esModule) {
38
+ return obj;
39
+ }
40
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
41
+ return {
42
+ default: obj
43
+ };
44
+ }
45
+ var cache = _getRequireWildcardCache(nodeInterop);
46
+ if (cache && cache.has(obj)) {
47
+ return cache.get(obj);
48
+ }
49
+ var newObj = {};
50
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
51
+ for (var key in obj) {
52
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
53
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
54
+ if (desc && (desc.get || desc.set)) {
55
+ Object.defineProperty(newObj, key, desc);
56
+ } else {
57
+ newObj[key] = obj[key];
58
+ }
59
+ }
60
+ }
61
+ newObj.default = obj;
62
+ if (cache) {
63
+ cache.set(obj, newObj);
64
+ }
65
+ return newObj;
66
+ }
67
+ const normalize = (results) => results.map((fp) => _path.normalize(fp));
41
68
  const getGlobOpts = (rootPath, packageConfigs, ignore = []) => {
42
69
  const globOpts = {
43
70
  cwd: rootPath,
@@ -47,9 +74,7 @@ const getGlobOpts = (rootPath, packageConfigs, ignore = []) => {
47
74
  };
48
75
  if (packageConfigs.some((cfg) => cfg.includes("**"))) {
49
76
  if (packageConfigs.some((cfg) => cfg.includes("node_modules"))) {
50
- (0, import_error.errorLog)(
51
- "An explicit node_modules package path does not allow globstars (**)"
52
- );
77
+ (0, _error.errorLog)("An explicit node_modules package path does not allow globstars (**)");
53
78
  }
54
79
  globOpts.ignore = [
55
80
  // allow globs like "packages/**",
@@ -64,17 +89,18 @@ const getGlobOpts = (rootPath, packageConfigs, ignore = []) => {
64
89
  const makeFileFinder = (rootPath, packageConfigs, ignoreConfigs = []) => {
65
90
  const globOpts = getGlobOpts(rootPath, packageConfigs, ignoreConfigs);
66
91
  return async (fileName, fileMapper, customGlobOpts = {}) => {
67
- const options = { ...customGlobOpts, ...globOpts };
68
- const promise = (0, import_p_map.default)(
69
- Array.from(packageConfigs).sort(),
70
- async (globPath) => {
71
- let result = await (0, import_utils.globby)(path.posix.join(globPath, fileName), options);
72
- result = result.sort();
73
- result = normalize(result);
74
- return fileMapper(result);
75
- },
76
- { concurrency: packageConfigs.length || Infinity }
77
- );
92
+ const options = {
93
+ ...customGlobOpts,
94
+ ...globOpts
95
+ };
96
+ const promise = (0, _pmap.default)(Array.from(packageConfigs).sort(), async (globPath) => {
97
+ let result = await (0, _utils.globby)(_path.posix.join(globPath, fileName), options);
98
+ result = result.sort();
99
+ result = normalize(result);
100
+ return fileMapper(result);
101
+ }, {
102
+ concurrency: packageConfigs.length || Infinity
103
+ });
78
104
  const results = await promise;
79
105
  return results.reduce((acc, result) => acc.concat(result), []);
80
106
  };
@@ -83,24 +109,27 @@ const getProjectsByPackageConfig = async (rootPath, packagesConfig, ignoreConfig
83
109
  const finder = makeFileFinder(rootPath, packagesConfig, ignoreConfigs);
84
110
  const fileName = "package.json";
85
111
  const mapper = (packageConfigPath) => {
86
- const packageJsonLookup = new import_node_core_library.PackageJsonLookup({ loadExtraFields: true });
112
+ const packageJsonLookup = new _nodecorelibrary.PackageJsonLookup({
113
+ loadExtraFields: true
114
+ });
87
115
  const packageJson = packageJsonLookup.loadNodePackageJson(packageConfigPath);
88
- return new import_package.Package(packageJson, path.dirname(packageConfigPath), rootPath);
116
+ return new _package.Package(packageJson, _path.dirname(packageConfigPath), rootPath);
89
117
  };
90
- const projects = await finder(
91
- fileName,
92
- (filePaths) => (0, import_p_map.default)(filePaths, mapper, { concurrency: filePaths.length || Infinity }),
93
- {}
94
- );
118
+ const projects = await finder(fileName, (filePaths) => (0, _pmap.default)(filePaths, mapper, {
119
+ concurrency: filePaths.length || Infinity
120
+ }), {});
95
121
  return projects;
96
122
  };
97
123
  const makeSyncFileFinder = (rootPath, packageConfigs, ignoreConfigs = []) => {
98
124
  const globOpts = getGlobOpts(rootPath, packageConfigs, ignoreConfigs);
99
125
  return (fileName, fileMapper, customGlobOpts = {}) => {
100
126
  const results = [];
101
- const options = { ...customGlobOpts, ...globOpts };
127
+ const options = {
128
+ ...customGlobOpts,
129
+ ...globOpts
130
+ };
102
131
  for (const globPath of Array.from(packageConfigs).sort()) {
103
- let result = import_utils.globby.sync(path.posix.join(globPath, fileName), options);
132
+ let result = _utils.globby.sync(_path.posix.join(globPath, fileName), options);
104
133
  result = result.sort();
105
134
  result = normalize(result);
106
135
  results.push(fileMapper(result));
@@ -112,19 +141,12 @@ const syncGetProjectsByPackageConfig = (rootPath, packagesConfig, ignoreConfigs)
112
141
  const finder = makeSyncFileFinder(rootPath, packagesConfig, ignoreConfigs);
113
142
  const fileName = "package.json";
114
143
  const mapper = (packageConfigPath) => {
115
- const packageJsonLookup = new import_node_core_library.PackageJsonLookup({ loadExtraFields: true });
144
+ const packageJsonLookup = new _nodecorelibrary.PackageJsonLookup({
145
+ loadExtraFields: true
146
+ });
116
147
  const packageJson = packageJsonLookup.loadNodePackageJson(packageConfigPath);
117
- return new import_package.Package(packageJson, path.dirname(packageConfigPath), rootPath);
148
+ return new _package.Package(packageJson, _path.dirname(packageConfigPath), rootPath);
118
149
  };
119
- const projects = finder(
120
- fileName,
121
- (filePaths) => filePaths.map((filePath) => mapper(filePath)),
122
- {}
123
- );
150
+ const projects = finder(fileName, (filePaths) => filePaths.map((filePath) => mapper(filePath)), {});
124
151
  return projects;
125
152
  };
126
- // Annotate the CommonJS export names for ESM import in node:
127
- 0 && (module.exports = {
128
- getProjectsByPackageConfig,
129
- syncGetProjectsByPackageConfig
130
- });