@modern-js/monorepo-tools 2.35.1 → 2.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +24 -7
  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 +58 -32
  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 +65 -39
  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 +53 -27
  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 +59 -40
  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 +4 -1
  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 +4 -1
  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 +4 -1
  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 +4 -1
  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 +6 -2
  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,6 +1,6 @@
1
1
  import { MonorepoNewAction } from "@modern-js/new-action";
2
2
  import { i18n, localeKeys } from "../locale";
3
- export const newCli = (program, locale) => {
3
+ const newCli = (program, locale) => {
4
4
  program.command("new").usage("[options]").description(i18n.t(localeKeys.command.new.describe)).option("--config-file <configFile>", i18n.t(localeKeys.command.shared.config)).option("--lang <lang>", i18n.t(localeKeys.command.new.lang)).option("-c, --config <config>", i18n.t(localeKeys.command.new.config)).option("-p, --plugin <plugin>", i18n.t(localeKeys.command.new.plugin), (val, memo) => {
5
5
  memo.push(val);
6
6
  return memo;
@@ -11,3 +11,6 @@ export const newCli = (program, locale) => {
11
11
  });
12
12
  });
13
13
  };
14
+ export {
15
+ newCli
16
+ };
@@ -2,7 +2,7 @@ import { getMonorepoBaseData } from "../parse-config/monorepo";
2
2
  import { runBuildTask, runAllBuildTask } from "../features/build";
3
3
  import { getProjects } from "../projects/getProjects";
4
4
  import { initDAG } from "../dag";
5
- export const build = async (targetProjectName, option, api) => {
5
+ const build = async (targetProjectName, option, api) => {
6
6
  const { appDirectory } = api.useAppContext();
7
7
  const { self = true, dept = false, deps = true, onlySelf = false, all = false, contentHash = false, gitHash = false } = option;
8
8
  const projects = await getProjects({
@@ -44,3 +44,6 @@ export const build = async (targetProjectName, option, api) => {
44
44
  }
45
45
  }
46
46
  };
47
+ export {
48
+ build
49
+ };
@@ -2,7 +2,7 @@ import { getMonorepoBaseData } from "../parse-config/monorepo";
2
2
  import { runBuildWatchTask } from "../features/dev";
3
3
  import { getProjects } from "../projects/getProjects";
4
4
  import { initDAG } from "../dag";
5
- export const buildWatch = async (targetProjectName, option, api) => {
5
+ const buildWatch = async (targetProjectName, option, api) => {
6
6
  const { appDirectory } = api.useAppContext();
7
7
  const { onlySelf = false, init = false } = option;
8
8
  const projects = await getProjects({
@@ -20,3 +20,6 @@ export const buildWatch = async (targetProjectName, option, api) => {
20
20
  needInit: init
21
21
  });
22
22
  };
23
+ export {
24
+ buildWatch
25
+ };
@@ -1,7 +1,7 @@
1
1
  import { getProjects } from "../projects/getProjects";
2
2
  import { getMonorepoBaseData } from "../parse-config/monorepo";
3
3
  import { runClearTask } from "../features/clear";
4
- export const clear = async (projectNames, option, api) => {
4
+ const clear = async (projectNames, option, api) => {
5
5
  const { removeDirs } = option;
6
6
  const { appDirectory } = api.useAppContext();
7
7
  const projects = await getProjects({
@@ -15,3 +15,6 @@ export const clear = async (projectNames, option, api) => {
15
15
  removeDirs
16
16
  });
17
17
  };
18
+ export {
19
+ clear
20
+ };
@@ -3,7 +3,7 @@ import { initDAG } from "../dag";
3
3
  import { getMonorepoBaseData } from "../parse-config/monorepo";
4
4
  import { getProjects } from "../projects/getProjects";
5
5
  import { deploy as runDeployTask } from "../features/deploy";
6
- export const deploy = async (api, deployProjectNames, option, ignoreMatchs = []) => {
6
+ const deploy = async (api, deployProjectNames, option, ignoreMatchs = []) => {
7
7
  const { deployPath = "output" } = option;
8
8
  const { appDirectory } = api.useAppContext();
9
9
  logger.info(`start deploy ${deployProjectNames.join(",")}`);
@@ -26,3 +26,6 @@ export const deploy = async (api, deployProjectNames, option, ignoreMatchs = [])
26
26
  deployProjectNames
27
27
  });
28
28
  };
29
+ export {
30
+ deploy
31
+ };
@@ -2,7 +2,7 @@ import { runInstallTask } from "../features/install";
2
2
  import { getMonorepoBaseData } from "../parse-config/monorepo";
3
3
  import { getProjects } from "../projects/getProjects";
4
4
  import { initDAG } from "../dag";
5
- export const install = async (projectNames = [], option, api) => {
5
+ const install = async (projectNames = [], option, api) => {
6
6
  const { appDirectory } = api.useAppContext();
7
7
  const { auto } = option;
8
8
  const projects = await getProjects({
@@ -19,3 +19,6 @@ export const install = async (projectNames = [], option, api) => {
19
19
  auto
20
20
  });
21
21
  };
22
+ export {
23
+ install
24
+ };
@@ -1,10 +1,14 @@
1
- export const WORKSPACE_FILE = {
1
+ const WORKSPACE_FILE = {
2
2
  LERNA: "lerna.json",
3
3
  YARN: "package.json",
4
4
  PNPM: "pnpm-workspace.yaml"
5
5
  };
6
- export const LOCK_FILE = {
6
+ const LOCK_FILE = {
7
7
  YARN: "yarn.lock",
8
8
  PNPM: "pnpm-lock.yaml",
9
9
  NPM: "package-lock.json"
10
10
  };
11
+ export {
12
+ LOCK_FILE,
13
+ WORKSPACE_FILE
14
+ };
@@ -25,7 +25,7 @@ const initProjectDependencyAndDependent = (project, projectsName, projectsMap) =
25
25
  });
26
26
  project.dependencyEdge = project.dependency.length;
27
27
  };
28
- export const create = (projects) => {
28
+ const create = (projects) => {
29
29
  const projectsName = [];
30
30
  const projectsMap = /* @__PURE__ */ new Map();
31
31
  for (const project of projects) {
@@ -40,3 +40,6 @@ export const create = (projects) => {
40
40
  projectList: projectsName
41
41
  };
42
42
  };
43
+ export {
44
+ create
45
+ };
@@ -1,5 +1,5 @@
1
1
  import { _ as _define_property } from "@swc/helpers/_/_define_property";
2
- export class EdgeManager {
2
+ class EdgeManager {
3
3
  reduceOneEdge(project) {
4
4
  if (!(project.name in this._dependencyEdgeHash)) {
5
5
  this._dependencyEdgeHash[project.name] = project.dependencyEdge;
@@ -26,3 +26,6 @@ export class EdgeManager {
26
26
  this._dependencyEdgeHash = {};
27
27
  }
28
28
  }
29
+ export {
30
+ EdgeManager
31
+ };
@@ -1,7 +1,10 @@
1
1
  import { create } from "./create";
2
2
  import { DagOperator } from "./operator";
3
- export const initDAG = (projects) => {
3
+ const initDAG = (projects) => {
4
4
  const { projectsMap } = create(projects);
5
5
  const operator = new DagOperator(projects, projectsMap);
6
6
  return operator;
7
7
  };
8
+ export {
9
+ initDAG
10
+ };
@@ -4,7 +4,7 @@ import { errorLog } from "../log/error";
4
4
  import { TaskRunner } from "./task";
5
5
  import { EdgeManager } from "./edgeManager";
6
6
  import { recursiveGetDependency, sortProjects } from "./utils";
7
- export class DagOperator {
7
+ class DagOperator {
8
8
  checkNodeDataExist(name) {
9
9
  return this._projectsMap.has(name);
10
10
  }
@@ -225,3 +225,6 @@ export class DagOperator {
225
225
  this._sortedProjects = [];
226
226
  }
227
227
  }
228
+ export {
229
+ DagOperator
230
+ };
@@ -1,7 +1,7 @@
1
1
  import { _ as _define_property } from "@swc/helpers/_/_define_property";
2
2
  import { EventEmitter } from "events";
3
3
  import pMap from "p-map";
4
- export class TaskRunner extends EventEmitter {
4
+ class TaskRunner extends EventEmitter {
5
5
  async run() {
6
6
  const tasks = this._tasks.splice(0, this._concurrency);
7
7
  this._usableConcurrency = this._concurrency - tasks.length;
@@ -50,3 +50,6 @@ export class TaskRunner extends EventEmitter {
50
50
  }
51
51
  _define_property(TaskRunner, "DefaultConcurrency", 10);
52
52
  _define_property(TaskRunner, "TASK_FINISH", "task-finish");
53
+ export {
54
+ TaskRunner
55
+ };
@@ -1,6 +1,6 @@
1
1
  import { errorLog } from "../log/error";
2
2
  import { EdgeManager } from "./edgeManager";
3
- export const calculateCriticalPaths = (project) => {
3
+ const calculateCriticalPaths = (project) => {
4
4
  var _project_dependent;
5
5
  if (project.criticalPathLength !== void 0) {
6
6
  return project.criticalPathLength;
@@ -42,7 +42,7 @@ const _recursiveGetDependencySkipCircleDeps = (node) => {
42
42
  }
43
43
  return allDeps;
44
44
  };
45
- export const recursiveGetDependency = (project, skipCircleProjects = false) => {
45
+ const recursiveGetDependency = (project, skipCircleProjects = false) => {
46
46
  if (skipCircleProjects) {
47
47
  return _recursiveGetDependencySkipCircleDeps(project);
48
48
  }
@@ -58,7 +58,7 @@ export const recursiveGetDependency = (project, skipCircleProjects = false) => {
58
58
  }
59
59
  return allDependency;
60
60
  };
61
- export const sortProjects = (projects) => {
61
+ const sortProjects = (projects) => {
62
62
  const sortedQueue = [];
63
63
  let readyIntoSortedQueue = [];
64
64
  let queue = [];
@@ -98,7 +98,7 @@ export const sortProjects = (projects) => {
98
98
  }
99
99
  return sortedQueue;
100
100
  };
101
- export const findCircle = (projects) => {
101
+ const findCircle = (projects) => {
102
102
  let result = projects.reduce((circleNodes, project) => {
103
103
  if (project.dependencyEdge > 0) {
104
104
  return [
@@ -114,3 +114,9 @@ export const findCircle = (projects) => {
114
114
  checkNode.dependencyEdge--;
115
115
  }
116
116
  };
117
+ export {
118
+ calculateCriticalPaths,
119
+ findCircle,
120
+ recursiveGetDependency,
121
+ sortProjects
122
+ };
@@ -60,7 +60,7 @@ const createTask = (config, taskCmds = defaultBuildCmds, taskLogger) => {
60
60
  const defaultBuildCmds = [
61
61
  "build"
62
62
  ];
63
- export const runBuildTask = async (projectName, operator, config, taskCmds = defaultBuildCmds) => {
63
+ const runBuildTask = async (projectName, operator, config, taskCmds = defaultBuildCmds) => {
64
64
  const { withSelf = true, onlySelf = false, disableWithDeps = false, withDept = false } = config;
65
65
  const taskLogger = new MultitasksLogger();
66
66
  const task = createTask(config, taskCmds, taskLogger);
@@ -85,8 +85,12 @@ export const runBuildTask = async (projectName, operator, config, taskCmds = def
85
85
  });
86
86
  }
87
87
  };
88
- export const runAllBuildTask = async (operator, config, taskCmds = defaultBuildCmds) => {
88
+ const runAllBuildTask = async (operator, config, taskCmds = defaultBuildCmds) => {
89
89
  const taskLogger = new MultitasksLogger();
90
90
  const task = createTask(config, taskCmds, taskLogger);
91
91
  await operator.traverseAllNodes(task);
92
92
  };
93
+ export {
94
+ runAllBuildTask,
95
+ runBuildTask
96
+ };
@@ -1,10 +1,10 @@
1
1
  import * as path from "path";
2
2
  import { logger } from "@modern-js/utils";
3
3
  import { FileSystem } from "@rushstack/node-core-library";
4
- export const defaultRemoveDirs = [
4
+ const defaultRemoveDirs = [
5
5
  "node_modules"
6
6
  ];
7
- export const runClearTask = (projectNames, projects, config) => {
7
+ const runClearTask = (projectNames, projects, config) => {
8
8
  const { removeDirs = defaultRemoveDirs, rootPath } = config;
9
9
  if (projectNames.length > 0) {
10
10
  projects.forEach((project) => {
@@ -31,3 +31,7 @@ export const runClearTask = (projectNames, projects, config) => {
31
31
  });
32
32
  }
33
33
  };
34
+ export {
35
+ defaultRemoveDirs,
36
+ runClearTask
37
+ };
@@ -129,7 +129,7 @@ const installDependency = async (deployDir, packageManager) => {
129
129
  };
130
130
  const excludeDirs = (filePath, dirs) => dirs.some((dir) => filePath.includes(dir));
131
131
  const defaultDeployPath = "output";
132
- export const deploy = async (deployProjectNames, operator, config) => {
132
+ const deploy = async (deployProjectNames, operator, config) => {
133
133
  const { rootPath, packageManager, deployPath = defaultDeployPath } = config;
134
134
  const realDeployPath = path.isAbsolute(deployPath) ? deployPath : path.join(rootPath, deployPath);
135
135
  FileSystem.deleteFolder(realDeployPath);
@@ -162,3 +162,6 @@ export const deploy = async (deployProjectNames, operator, config) => {
162
162
  generatorAndCopyRequiredFiles(rootPath, realDeployPath);
163
163
  logger.success(`Deploy success. The deploy dir is in '${rootPath}/output'`);
164
164
  };
165
+ export {
166
+ deploy
167
+ };
@@ -1,4 +1,7 @@
1
- export const defaultBuildWatchCmds = [
1
+ const defaultBuildWatchCmds = [
2
2
  "dev",
3
3
  "build"
4
4
  ];
5
+ export {
6
+ defaultBuildWatchCmds
7
+ };
@@ -21,7 +21,7 @@ const getFinalTaskCmds = (taskCmds, project) => {
21
21
  }
22
22
  return finalTaskCmds;
23
23
  };
24
- export const createDependenciesTask = (config, taskCmds = defaultBuildWatchCmds, taskLogger) => {
24
+ const createDependenciesTask = (config, taskCmds = defaultBuildWatchCmds, taskLogger) => {
25
25
  const { packageManager } = config;
26
26
  const timelogInstance = timeLog.initTimeLog();
27
27
  const task = async (project) => {
@@ -61,7 +61,7 @@ export const createDependenciesTask = (config, taskCmds = defaultBuildWatchCmds,
61
61
  };
62
62
  return task;
63
63
  };
64
- export const createDevTask = (config, taskCmds = defaultBuildWatchCmds, taskLogger) => {
64
+ const createDevTask = (config, taskCmds = defaultBuildWatchCmds, taskLogger) => {
65
65
  const { packageManager } = config;
66
66
  const task = async (project) => {
67
67
  const devCmds = [
@@ -97,3 +97,7 @@ export const createDevTask = (config, taskCmds = defaultBuildWatchCmds, taskLogg
97
97
  };
98
98
  return task;
99
99
  };
100
+ export {
101
+ createDependenciesTask,
102
+ createDevTask
103
+ };
@@ -14,7 +14,7 @@ const getIgnored = (config) => (watchFilePath) => {
14
14
  }
15
15
  return false;
16
16
  };
17
- export const runBuildWatchTask = async (projectName, operator, config, taskCmds = defaultBuildWatchCmds) => {
17
+ const runBuildWatchTask = async (projectName, operator, config, taskCmds = defaultBuildWatchCmds) => {
18
18
  const { needInit = true } = config;
19
19
  const taskLogger = new MultitasksLogger();
20
20
  const dependenciesTask = createDependenciesTask(config, taskCmds, taskLogger);
@@ -67,3 +67,6 @@ export const runBuildWatchTask = async (projectName, operator, config, taskCmds
67
67
  checkExist: true
68
68
  }));
69
69
  };
70
+ export {
71
+ runBuildWatchTask
72
+ };
@@ -1,7 +1,7 @@
1
1
  import { _ as _define_property } from "@swc/helpers/_/_define_property";
2
2
  import * as path from "path";
3
3
  import { globby } from "@modern-js/utils";
4
- export class WatchedProjectsState {
4
+ class WatchedProjectsState {
5
5
  _initState() {
6
6
  const globOption = {
7
7
  cwd: this._config.rootPath,
@@ -56,3 +56,6 @@ export class WatchedProjectsState {
56
56
  this._initState();
57
57
  }
58
58
  }
59
+ export {
60
+ WatchedProjectsState
61
+ };
@@ -30,7 +30,7 @@ const replaceWorkspaces = ({ rootPath, projectsInWorkspaces }) => {
30
30
  }
31
31
  return false;
32
32
  };
33
- export const runInstallTask = async (projectNames, operator, config) => {
33
+ const runInstallTask = async (projectNames, operator, config) => {
34
34
  const { rootPath, packageManager } = config;
35
35
  let projectsInWorkspaces = [];
36
36
  if (projectNames.length === 0) {
@@ -58,3 +58,6 @@ export const runInstallTask = async (projectNames, operator, config) => {
58
58
  restorWorkspace();
59
59
  }
60
60
  };
61
+ export {
62
+ runInstallTask
63
+ };
@@ -1,5 +1,8 @@
1
1
  import { createAsyncWorkflow } from "@modern-js/plugin";
2
2
  const afterMonorepoDeploy = createAsyncWorkflow();
3
- export const hooks = {
3
+ const hooks = {
4
4
  afterMonorepoDeploy
5
5
  };
6
+ export {
7
+ hooks
8
+ };
package/dist/esm/index.js CHANGED
@@ -7,7 +7,7 @@ import { newCli, deployCli, clearCli } from "./cli";
7
7
  import { hooks } from "./hooks";
8
8
  export * from "./projects/getProjects";
9
9
  const upgradeModel = Import.lazy("@modern-js/upgrade", require);
10
- export const monorepoTools = () => ({
10
+ const monorepoTools = () => ({
11
11
  name: "@modern-js/monorepo-tools",
12
12
  usePlugins: [
13
13
  changesetPlugin(),
@@ -37,4 +37,8 @@ export const monorepoTools = () => ({
37
37
  "@modern-js/plugin-changeset"
38
38
  ]
39
39
  });
40
- export default monorepoTools;
40
+ var src_default = monorepoTools;
41
+ export {
42
+ src_default as default,
43
+ monorepoTools
44
+ };
@@ -1,4 +1,4 @@
1
- export const EN_LOCALE = {
1
+ const EN_LOCALE = {
2
2
  command: {
3
3
  shared: {
4
4
  config: "specify the configuration file, which can be a relative or absolute path",
@@ -15,3 +15,6 @@ export const EN_LOCALE = {
15
15
  }
16
16
  }
17
17
  };
18
+ export {
19
+ EN_LOCALE
20
+ };
@@ -6,4 +6,7 @@ const localeKeys = i18n.init("en", {
6
6
  zh: ZH_LOCALE,
7
7
  en: EN_LOCALE
8
8
  });
9
- export { i18n, localeKeys };
9
+ export {
10
+ i18n,
11
+ localeKeys
12
+ };
@@ -1,4 +1,4 @@
1
- export const ZH_LOCALE = {
1
+ const ZH_LOCALE = {
2
2
  command: {
3
3
  shared: {
4
4
  config: "指定配置文件路径,可以为相对路径或绝对路径",
@@ -15,3 +15,6 @@ export const ZH_LOCALE = {
15
15
  }
16
16
  }
17
17
  };
18
+ export {
19
+ ZH_LOCALE
20
+ };
@@ -1,3 +1,6 @@
1
- export const errorLog = (...rest) => {
1
+ const errorLog = (...rest) => {
2
2
  throw new Error(rest.join("\n"));
3
3
  };
4
+ export {
5
+ errorLog
6
+ };
@@ -27,7 +27,7 @@ const createListenHandler = (name, config) => {
27
27
  stderr
28
28
  };
29
29
  };
30
- export class MultitasksLogger {
30
+ class MultitasksLogger {
31
31
  addLogProvider(name, config) {
32
32
  if (this._taskNameList.includes(name)) {
33
33
  var _this__taskStdoutListenerMap_get, _this__taskStderrListenerMap_get;
@@ -66,3 +66,6 @@ export class MultitasksLogger {
66
66
  this._taskLogConfigMap = /* @__PURE__ */ new Map();
67
67
  }
68
68
  }
69
+ export {
70
+ MultitasksLogger
71
+ };
@@ -1,12 +1,17 @@
1
1
  import { Signale } from "@modern-js/utils";
2
- export const initTimeLog = (option = {}) => new Signale({
2
+ const initTimeLog = (option = {}) => new Signale({
3
3
  interactive: true,
4
4
  scope: "time-log",
5
5
  ...option
6
6
  });
7
- export const startTime = (signaleInstance, prefix = "") => {
7
+ const startTime = (signaleInstance, prefix = "") => {
8
8
  signaleInstance.time(prefix);
9
9
  };
10
- export const endTime = (signaleInstance, prefix = "") => {
10
+ const endTime = (signaleInstance, prefix = "") => {
11
11
  signaleInstance.timeEnd(prefix);
12
12
  };
13
+ export {
14
+ endTime,
15
+ initTimeLog,
16
+ startTime
17
+ };
@@ -1,4 +1,4 @@
1
- export const formatLog = (log) => {
1
+ const formatLog = (log) => {
2
2
  const strs = log.split(/\r\n|\n\r|\r|\n/g);
3
3
  if (strs[0].trim() === "") {
4
4
  return `
@@ -6,3 +6,6 @@ ${strs.slice(1).filter((s) => Boolean(s)).join("\n")}`;
6
6
  }
7
7
  return strs.filter((s) => Boolean(s)).join("\n");
8
8
  };
9
+ export {
10
+ formatLog
11
+ };
@@ -1,5 +1,5 @@
1
1
  import { _ as _define_property } from "@swc/helpers/_/_define_property";
2
- export class Package {
2
+ class Package {
3
3
  get name() {
4
4
  return this.json.name;
5
5
  }
@@ -18,3 +18,6 @@ export class Package {
18
18
  this.json = packageJson;
19
19
  }
20
20
  }
21
+ export {
22
+ Package
23
+ };
@@ -2,7 +2,7 @@ import * as path from "path";
2
2
  import { JsonFile } from "@rushstack/node-core-library";
3
3
  import { getMonorepoBaseData } from "./monorepo";
4
4
  const defaultConfig = {};
5
- export const getFinalConfig = async (currentPath = process.cwd()) => {
5
+ const getFinalConfig = async (currentPath = process.cwd()) => {
6
6
  const monorepo = getMonorepoBaseData(currentPath);
7
7
  const userConfig = await JsonFile.loadAsync(path.resolve(monorepo.rootPath, "mono-config.json"));
8
8
  const config = {
@@ -14,3 +14,6 @@ export const getFinalConfig = async (currentPath = process.cwd()) => {
14
14
  config
15
15
  };
16
16
  };
17
+ export {
18
+ getFinalConfig
19
+ };
@@ -29,7 +29,7 @@ const isMonorepo = (monorepoRootPath) => {
29
29
  }
30
30
  return false;
31
31
  };
32
- export const findMonorepoRoot = (starFindPath) => {
32
+ const findMonorepoRoot = (starFindPath) => {
33
33
  let inMonorepo = false;
34
34
  let findPath = starFindPath;
35
35
  while (findPath !== "/") {
@@ -41,7 +41,7 @@ export const findMonorepoRoot = (starFindPath) => {
41
41
  }
42
42
  return inMonorepo ? findPath : void 0;
43
43
  };
44
- export const getWorkspaceFile = (startFindPath) => {
44
+ const getWorkspaceFile = (startFindPath) => {
45
45
  const rootPath = findMonorepoRoot(startFindPath);
46
46
  if (!rootPath) {
47
47
  throw new Error("[Auto Find Mode]: not find any monorepo workspace file, you can set `packagesMatchs.workspaceFile`");
@@ -56,7 +56,7 @@ export const getWorkspaceFile = (startFindPath) => {
56
56
  throw new Error("[Auto Find Mode]: not find any monorepo workspace file, you can set `packagesMatchs.workspaceFile`");
57
57
  }
58
58
  };
59
- export const packageManagerFlag = {
59
+ const packageManagerFlag = {
60
60
  pnpm: [
61
61
  WORKSPACE_FILE.PNPM,
62
62
  "pnpm-lock.yaml"
@@ -76,7 +76,7 @@ const useYarnPackageManager = (monorepoRootPath) => packageManagerFlag.yarn.some
76
76
  }
77
77
  return FileSystem.exists(path.join(monorepoRootPath, flag));
78
78
  });
79
- export const getPackageManager = (monorepoRootPath) => {
79
+ const getPackageManager = (monorepoRootPath) => {
80
80
  if (usePnpmPackageManager(monorepoRootPath)) {
81
81
  return "pnpm";
82
82
  } else if (useYarnPackageManager(monorepoRootPath)) {
@@ -84,7 +84,7 @@ export const getPackageManager = (monorepoRootPath) => {
84
84
  }
85
85
  return "npm";
86
86
  };
87
- export const getMonorepoBaseData = (root = process.cwd()) => {
87
+ const getMonorepoBaseData = (root = process.cwd()) => {
88
88
  const rootPath = findMonorepoRoot(root);
89
89
  if (!rootPath) {
90
90
  throw new Error("not find any monorepo, you can add lerna、pnpm or yarn workspace file");
@@ -94,3 +94,10 @@ export const getMonorepoBaseData = (root = process.cwd()) => {
94
94
  packageManager: getPackageManager(rootPath)
95
95
  };
96
96
  };
97
+ export {
98
+ findMonorepoRoot,
99
+ getMonorepoBaseData,
100
+ getPackageManager,
101
+ getWorkspaceFile,
102
+ packageManagerFlag
103
+ };
@@ -3,9 +3,9 @@ import { FileSystem, JsonFile, Sort } from "@rushstack/node-core-library";
3
3
  import { getGitHashForFiles } from "@rushstack/package-deps-hash";
4
4
  import { globby } from "@modern-js/utils";
5
5
  import md5 from "md5";
6
- export const PROJECT_CONTENT_FILE_NAME = "project-content.json";
7
- export const MONOREPO_GIT_FILE_NAME = "monorepo-git.json";
8
- export const PROJECT_MEMORY_PATH = ".project-memory";
6
+ const PROJECT_CONTENT_FILE_NAME = "project-content.json";
7
+ const MONOREPO_GIT_FILE_NAME = "monorepo-git.json";
8
+ const PROJECT_MEMORY_PATH = ".project-memory";
9
9
  const getProjectGitHash = async (project) => {
10
10
  const projectDir = project.extra.path;
11
11
  const globOption = {
@@ -29,7 +29,7 @@ const getProjectGitHash = async (project) => {
29
29
  });
30
30
  return md5(JsonFile.stringify(hashObject));
31
31
  };
32
- export const checkProjectChangeByGit = async (project, rootPath) => {
32
+ const checkProjectChangeByGit = async (project, rootPath) => {
33
33
  const monorepoGitMemory = path.join(rootPath, MONOREPO_GIT_FILE_NAME);
34
34
  const currentProjectHash = await getProjectGitHash(project);
35
35
  if (!FileSystem.exists(monorepoGitMemory)) {
@@ -68,7 +68,7 @@ const getProjectContentHashObjectForFiles = async (project) => {
68
68
  }
69
69
  return hashObject;
70
70
  };
71
- export const checkProjectChangeByContent = async (project) => {
71
+ const checkProjectChangeByContent = async (project) => {
72
72
  const projectDir = project.extra.path;
73
73
  const projectMemoryFolder = path.resolve(projectDir, ".project-memory");
74
74
  const projectJsonFile = path.join(projectMemoryFolder, PROJECT_CONTENT_FILE_NAME);
@@ -89,3 +89,10 @@ export const checkProjectChangeByContent = async (project) => {
89
89
  }
90
90
  return changed;
91
91
  };
92
+ export {
93
+ MONOREPO_GIT_FILE_NAME,
94
+ PROJECT_CONTENT_FILE_NAME,
95
+ PROJECT_MEMORY_PATH,
96
+ checkProjectChangeByContent,
97
+ checkProjectChangeByGit
98
+ };
@@ -1,10 +1,13 @@
1
1
  import * as path from "path";
2
2
  import { FileSystem } from "@rushstack/node-core-library";
3
3
  import { PROJECT_MEMORY_PATH, PROJECT_CONTENT_FILE_NAME } from "./checkProjectChange";
4
- export const clearProjectsMemoryFile = (projects) => {
4
+ const clearProjectsMemoryFile = (projects) => {
5
5
  for (const project of projects) {
6
6
  const memoryFilePath = path.join(project.extra.path, PROJECT_MEMORY_PATH, PROJECT_CONTENT_FILE_NAME);
7
7
  console.info("remove", memoryFilePath);
8
8
  FileSystem.deleteFile(memoryFilePath);
9
9
  }
10
10
  };
11
+ export {
12
+ clearProjectsMemoryFile
13
+ };