@modern-js/monorepo-tools 2.47.1 → 2.48.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/modern.js CHANGED
@@ -1,5 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ const { version } = require('../package.json');
4
+
5
+ if (!process.env.MODERN_JS_VERSION) {
6
+ process.env.MODERN_JS_VERSION = version;
7
+ }
8
+
3
9
  require('@modern-js/core/runBin').run({
4
- initialLog: `Modern.js Monorepo v${require('../package.json').version}`,
10
+ initialLog: `Modern.js Monorepo v${version}`,
5
11
  });
@@ -21,6 +21,7 @@ __reExport(cli_exports, require("./build"), module.exports);
21
21
  __reExport(cli_exports, require("./buildWatch"), module.exports);
22
22
  __reExport(cli_exports, require("./clear"), module.exports);
23
23
  __reExport(cli_exports, require("./install"), module.exports);
24
+ __reExport(cli_exports, require("./upgrade"), module.exports);
24
25
  // Annotate the CommonJS export names for ESM import in node:
25
26
  0 && (module.exports = {
26
27
  ...require("./new"),
@@ -28,5 +29,6 @@ __reExport(cli_exports, require("./install"), module.exports);
28
29
  ...require("./build"),
29
30
  ...require("./buildWatch"),
30
31
  ...require("./clear"),
31
- ...require("./install")
32
+ ...require("./install"),
33
+ ...require("./upgrade")
32
34
  });
@@ -21,17 +21,17 @@ __export(new_exports, {
21
21
  newCli: () => newCli
22
22
  });
23
23
  module.exports = __toCommonJS(new_exports);
24
- var import_new_action = require("@modern-js/new-action");
24
+ var import_utils = require("@modern-js/utils");
25
25
  var import_locale = require("../locale");
26
26
  const newCli = (program, locale) => {
27
27
  program.command("new").usage("[options]").description(import_locale.i18n.t(import_locale.localeKeys.command.new.describe)).option("--config-file <configFile>", import_locale.i18n.t(import_locale.localeKeys.command.shared.config)).option("--lang <lang>", import_locale.i18n.t(import_locale.localeKeys.command.new.lang)).option("-c, --config <config>", import_locale.i18n.t(import_locale.localeKeys.command.new.config)).option("-p, --plugin <plugin>", import_locale.i18n.t(import_locale.localeKeys.command.new.plugin), (val, memo) => {
28
28
  memo.push(val);
29
29
  return memo;
30
30
  }, []).option("-d, --debug", import_locale.i18n.t(import_locale.localeKeys.command.new.debug), false).option("--dist-tag <tag>", import_locale.i18n.t(import_locale.localeKeys.command.new.distTag)).option("--registry", import_locale.i18n.t(import_locale.localeKeys.command.new.registry)).option("--no-need-install", import_locale.i18n.t(import_locale.localeKeys.command.shared.noNeedInstall)).action(async (options) => {
31
- await (0, import_new_action.MonorepoNewAction)({
31
+ await (0, import_utils.newAction)({
32
32
  ...options,
33
33
  locale: options.lang || locale
34
- });
34
+ }, "monorepo");
35
35
  });
36
36
  };
37
37
  // Annotate the CommonJS export names for ESM import in node:
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var upgrade_exports = {};
20
+ __export(upgrade_exports, {
21
+ upgradeCli: () => upgradeCli
22
+ });
23
+ module.exports = __toCommonJS(upgrade_exports);
24
+ var import_utils = require("@modern-js/utils");
25
+ const upgradeCli = (program) => {
26
+ program.command("upgrade").allowUnknownOption().option("-h --help", "Show help").action(async () => {
27
+ await (0, import_utils.upgradeAction)();
28
+ });
29
+ };
30
+ // Annotate the CommonJS export names for ESM import in node:
31
+ 0 && (module.exports = {
32
+ upgradeCli
33
+ });
@@ -21,7 +21,6 @@ __export(edgeManager_exports, {
21
21
  EdgeManager: () => EdgeManager
22
22
  });
23
23
  module.exports = __toCommonJS(edgeManager_exports);
24
- var import_define_property = require("@swc/helpers/_/_define_property");
25
24
  class EdgeManager {
26
25
  reduceOneEdge(project) {
27
26
  if (!(project.name in this._dependencyEdgeHash)) {
@@ -45,7 +44,6 @@ class EdgeManager {
45
44
  this._dependencyEdgeHash[project.name] = project.dependencyEdge;
46
45
  }
47
46
  constructor() {
48
- (0, import_define_property._)(this, "_dependencyEdgeHash", void 0);
49
47
  this._dependencyEdgeHash = {};
50
48
  }
51
49
  }
@@ -31,7 +31,6 @@ __export(operator_exports, {
31
31
  DagOperator: () => DagOperator
32
32
  });
33
33
  module.exports = __toCommonJS(operator_exports);
34
- var import_define_property = require("@swc/helpers/_/_define_property");
35
34
  var import_p_map = __toESM(require("p-map"));
36
35
  var import_error = require("../log/error");
37
36
  var import_task = require("./task");
@@ -246,13 +245,10 @@ class DagOperator {
246
245
  return searchProjects.filter((p) => preNodes.map((preP) => preP.name).includes(p.name));
247
246
  }
248
247
  constructor(projects, projectsMap) {
249
- (0, import_define_property._)(this, "_projects", void 0);
250
- (0, import_define_property._)(this, "_projectsMap", void 0);
251
- (0, import_define_property._)(this, "_sortedProjects", void 0);
252
- (0, import_define_property._)(this, "_createTask", (project, task) => async (stopTask = () => void 0) => {
248
+ this._createTask = (project, task) => async (stopTask = () => void 0) => {
253
249
  await task(project, project.dependency || [], () => stopTask());
254
250
  return project.name;
255
- });
251
+ };
256
252
  this._projects = projects;
257
253
  this._projectsMap = projectsMap;
258
254
  this._sortedProjects = [];
@@ -31,7 +31,6 @@ __export(task_exports, {
31
31
  TaskRunner: () => TaskRunner
32
32
  });
33
33
  module.exports = __toCommonJS(task_exports);
34
- var import_define_property = require("@swc/helpers/_/_define_property");
35
34
  var import_events = require("events");
36
35
  var import_p_map = __toESM(require("p-map"));
37
36
  class TaskRunner extends import_events.EventEmitter {
@@ -71,18 +70,14 @@ class TaskRunner extends import_events.EventEmitter {
71
70
  }
72
71
  constructor(tasks, { concurrency }) {
73
72
  super();
74
- (0, import_define_property._)(this, "_tasks", void 0);
75
- (0, import_define_property._)(this, "_concurrency", void 0);
76
- (0, import_define_property._)(this, "_usableConcurrency", void 0);
77
- (0, import_define_property._)(this, "_stopFlag", void 0);
78
73
  this._tasks = tasks;
79
74
  this._concurrency = concurrency || TaskRunner.DefaultConcurrency;
80
75
  this._usableConcurrency = this._concurrency;
81
76
  this._stopFlag = false;
82
77
  }
83
78
  }
84
- (0, import_define_property._)(TaskRunner, "DefaultConcurrency", 10);
85
- (0, import_define_property._)(TaskRunner, "TASK_FINISH", "task-finish");
79
+ TaskRunner.DefaultConcurrency = 10;
80
+ TaskRunner.TASK_FINISH = "task-finish";
86
81
  // Annotate the CommonJS export names for ESM import in node:
87
82
  0 && (module.exports = {
88
83
  TaskRunner
@@ -31,7 +31,6 @@ __export(watchProjectsState_exports, {
31
31
  WatchedProjectsState: () => WatchedProjectsState
32
32
  });
33
33
  module.exports = __toCommonJS(watchProjectsState_exports);
34
- var import_define_property = require("@swc/helpers/_/_define_property");
35
34
  var path = __toESM(require("path"));
36
35
  var import_utils = require("@modern-js/utils");
37
36
  class WatchedProjectsState {
@@ -78,10 +77,6 @@ class WatchedProjectsState {
78
77
  return Object.keys(this._watchProjects).map((projectPath) => this._watchProjects[projectPath].name);
79
78
  }
80
79
  constructor(fromNodes, config) {
81
- (0, import_define_property._)(this, "_config", void 0);
82
- (0, import_define_property._)(this, "_fromNodes", void 0);
83
- (0, import_define_property._)(this, "_watchProjects", void 0);
84
- (0, import_define_property._)(this, "_projectsFileMap", void 0);
85
80
  this._fromNodes = fromNodes;
86
81
  this._config = config;
87
82
  this._projectsFileMap = /* @__PURE__ */ new Map();
package/dist/cjs/index.js CHANGED
@@ -25,13 +25,11 @@ __export(src_exports, {
25
25
  module.exports = __toCommonJS(src_exports);
26
26
  var import_plugin_changeset = require("@modern-js/plugin-changeset");
27
27
  var import_plugin_lint = require("@modern-js/plugin-lint");
28
- var import_utils = require("@modern-js/utils");
29
28
  var import_language_detector = require("@modern-js/plugin-i18n/language-detector");
30
29
  var import_locale = require("./locale");
31
30
  var import_cli = require("./cli");
32
31
  var import_hooks = require("./hooks");
33
32
  __reExport(src_exports, require("./projects/getProjects"), module.exports);
34
- const upgradeModel = import_utils.Import.lazy("@modern-js/upgrade", require);
35
33
  const monorepoTools = () => ({
36
34
  name: "@modern-js/monorepo-tools",
37
35
  usePlugins: [
@@ -54,7 +52,7 @@ const monorepoTools = () => ({
54
52
  (0, import_cli.clearCli)(program, api);
55
53
  (0, import_cli.deployCli)(program, api);
56
54
  (0, import_cli.newCli)(program, locale);
57
- upgradeModel.defineCommand(program.command("upgrade").option("-c --config <config>", import_locale.i18n.t(import_locale.localeKeys.command.shared.config)).option("--no-need-install", import_locale.i18n.t(import_locale.localeKeys.command.shared.noNeedInstall)));
55
+ (0, import_cli.upgradeCli)(program);
58
56
  }
59
57
  };
60
58
  },
@@ -21,7 +21,6 @@ __export(multiTasksLog_exports, {
21
21
  MultitasksLogger: () => MultitasksLogger
22
22
  });
23
23
  module.exports = __toCommonJS(multiTasksLog_exports);
24
- var import_define_property = require("@swc/helpers/_/_define_property");
25
24
  var import_utils = require("@modern-js/utils");
26
25
  var import_utils2 = require("./utils");
27
26
  const createLogger = (name, config) => {
@@ -79,10 +78,6 @@ class MultitasksLogger {
79
78
  finishListen() {
80
79
  }
81
80
  constructor() {
82
- (0, import_define_property._)(this, "_taskNameList", void 0);
83
- (0, import_define_property._)(this, "_taskStdoutListenerMap", void 0);
84
- (0, import_define_property._)(this, "_taskStderrListenerMap", void 0);
85
- (0, import_define_property._)(this, "_taskLogConfigMap", void 0);
86
81
  this._taskNameList = [];
87
82
  this._taskStdoutListenerMap = /* @__PURE__ */ new Map();
88
83
  this._taskStderrListenerMap = /* @__PURE__ */ new Map();
@@ -21,7 +21,6 @@ __export(package_exports, {
21
21
  Package: () => Package
22
22
  });
23
23
  module.exports = __toCommonJS(package_exports);
24
- var import_define_property = require("@swc/helpers/_/_define_property");
25
24
  class Package {
26
25
  get name() {
27
26
  return this.json.name;
@@ -33,9 +32,6 @@ class Package {
33
32
  return this.json[key];
34
33
  }
35
34
  constructor(packageJson, packageConfigPath, rootPath) {
36
- (0, import_define_property._)(this, "json", void 0);
37
- (0, import_define_property._)(this, "configPath", void 0);
38
- (0, import_define_property._)(this, "rootPath", void 0);
39
35
  this.configPath = packageConfigPath;
40
36
  this.rootPath = rootPath;
41
37
  this.json = packageJson;
@@ -4,3 +4,4 @@ export * from "./build";
4
4
  export * from "./buildWatch";
5
5
  export * from "./clear";
6
6
  export * from "./install";
7
+ export * from "./upgrade";
@@ -1,14 +1,14 @@
1
- import { MonorepoNewAction } from "@modern-js/new-action";
1
+ import { newAction } from "@modern-js/utils";
2
2
  import { i18n, localeKeys } from "../locale";
3
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;
7
7
  }, []).option("-d, --debug", i18n.t(localeKeys.command.new.debug), false).option("--dist-tag <tag>", i18n.t(localeKeys.command.new.distTag)).option("--registry", i18n.t(localeKeys.command.new.registry)).option("--no-need-install", i18n.t(localeKeys.command.shared.noNeedInstall)).action(async (options) => {
8
- await MonorepoNewAction({
8
+ await newAction({
9
9
  ...options,
10
10
  locale: options.lang || locale
11
- });
11
+ }, "monorepo");
12
12
  });
13
13
  };
14
14
  export {
@@ -0,0 +1,9 @@
1
+ import { upgradeAction } from "@modern-js/utils";
2
+ const upgradeCli = (program) => {
3
+ program.command("upgrade").allowUnknownOption().option("-h --help", "Show help").action(async () => {
4
+ await upgradeAction();
5
+ });
6
+ };
7
+ export {
8
+ upgradeCli
9
+ };
@@ -1,4 +1,3 @@
1
- import { _ as _define_property } from "@swc/helpers/_/_define_property";
2
1
  class EdgeManager {
3
2
  reduceOneEdge(project) {
4
3
  if (!(project.name in this._dependencyEdgeHash)) {
@@ -22,7 +21,6 @@ class EdgeManager {
22
21
  this._dependencyEdgeHash[project.name] = project.dependencyEdge;
23
22
  }
24
23
  constructor() {
25
- _define_property(this, "_dependencyEdgeHash", void 0);
26
24
  this._dependencyEdgeHash = {};
27
25
  }
28
26
  }
@@ -1,4 +1,3 @@
1
- import { _ as _define_property } from "@swc/helpers/_/_define_property";
2
1
  import pMap from "p-map";
3
2
  import { errorLog } from "../log/error";
4
3
  import { TaskRunner } from "./task";
@@ -213,13 +212,10 @@ class DagOperator {
213
212
  return searchProjects.filter((p) => preNodes.map((preP) => preP.name).includes(p.name));
214
213
  }
215
214
  constructor(projects, projectsMap) {
216
- _define_property(this, "_projects", void 0);
217
- _define_property(this, "_projectsMap", void 0);
218
- _define_property(this, "_sortedProjects", void 0);
219
- _define_property(this, "_createTask", (project, task) => async (stopTask = () => void 0) => {
215
+ this._createTask = (project, task) => async (stopTask = () => void 0) => {
220
216
  await task(project, project.dependency || [], () => stopTask());
221
217
  return project.name;
222
- });
218
+ };
223
219
  this._projects = projects;
224
220
  this._projectsMap = projectsMap;
225
221
  this._sortedProjects = [];
@@ -1,4 +1,3 @@
1
- import { _ as _define_property } from "@swc/helpers/_/_define_property";
2
1
  import { EventEmitter } from "events";
3
2
  import pMap from "p-map";
4
3
  class TaskRunner extends EventEmitter {
@@ -38,18 +37,14 @@ class TaskRunner extends EventEmitter {
38
37
  }
39
38
  constructor(tasks, { concurrency }) {
40
39
  super();
41
- _define_property(this, "_tasks", void 0);
42
- _define_property(this, "_concurrency", void 0);
43
- _define_property(this, "_usableConcurrency", void 0);
44
- _define_property(this, "_stopFlag", void 0);
45
40
  this._tasks = tasks;
46
41
  this._concurrency = concurrency || TaskRunner.DefaultConcurrency;
47
42
  this._usableConcurrency = this._concurrency;
48
43
  this._stopFlag = false;
49
44
  }
50
45
  }
51
- _define_property(TaskRunner, "DefaultConcurrency", 10);
52
- _define_property(TaskRunner, "TASK_FINISH", "task-finish");
46
+ TaskRunner.DefaultConcurrency = 10;
47
+ TaskRunner.TASK_FINISH = "task-finish";
53
48
  export {
54
49
  TaskRunner
55
50
  };
@@ -1,4 +1,3 @@
1
- import { _ as _define_property } from "@swc/helpers/_/_define_property";
2
1
  import * as path from "path";
3
2
  import { globby } from "@modern-js/utils";
4
3
  class WatchedProjectsState {
@@ -45,10 +44,6 @@ class WatchedProjectsState {
45
44
  return Object.keys(this._watchProjects).map((projectPath) => this._watchProjects[projectPath].name);
46
45
  }
47
46
  constructor(fromNodes, config) {
48
- _define_property(this, "_config", void 0);
49
- _define_property(this, "_fromNodes", void 0);
50
- _define_property(this, "_watchProjects", void 0);
51
- _define_property(this, "_projectsFileMap", void 0);
52
47
  this._fromNodes = fromNodes;
53
48
  this._config = config;
54
49
  this._projectsFileMap = /* @__PURE__ */ new Map();
package/dist/esm/index.js CHANGED
@@ -1,12 +1,10 @@
1
1
  import { changesetPlugin } from "@modern-js/plugin-changeset";
2
2
  import { lintPlugin } from "@modern-js/plugin-lint";
3
- import { Import } from "@modern-js/utils";
4
3
  import { getLocaleLanguage } from "@modern-js/plugin-i18n/language-detector";
5
- import { i18n, localeKeys } from "./locale";
6
- import { newCli, deployCli, clearCli } from "./cli";
4
+ import { i18n } from "./locale";
5
+ import { newCli, deployCli, clearCli, upgradeCli } from "./cli";
7
6
  import { hooks } from "./hooks";
8
7
  export * from "./projects/getProjects";
9
- const upgradeModel = Import.lazy("@modern-js/upgrade", require);
10
8
  const monorepoTools = () => ({
11
9
  name: "@modern-js/monorepo-tools",
12
10
  usePlugins: [
@@ -29,7 +27,7 @@ const monorepoTools = () => ({
29
27
  clearCli(program, api);
30
28
  deployCli(program, api);
31
29
  newCli(program, locale);
32
- upgradeModel.defineCommand(program.command("upgrade").option("-c --config <config>", i18n.t(localeKeys.command.shared.config)).option("--no-need-install", i18n.t(localeKeys.command.shared.noNeedInstall)));
30
+ upgradeCli(program);
33
31
  }
34
32
  };
35
33
  },
@@ -1,4 +1,3 @@
1
- import { _ as _define_property } from "@swc/helpers/_/_define_property";
2
1
  import { Signale } from "@modern-js/utils";
3
2
  import { formatLog } from "./utils";
4
3
  const createLogger = (name, config) => {
@@ -56,10 +55,6 @@ class MultitasksLogger {
56
55
  finishListen() {
57
56
  }
58
57
  constructor() {
59
- _define_property(this, "_taskNameList", void 0);
60
- _define_property(this, "_taskStdoutListenerMap", void 0);
61
- _define_property(this, "_taskStderrListenerMap", void 0);
62
- _define_property(this, "_taskLogConfigMap", void 0);
63
58
  this._taskNameList = [];
64
59
  this._taskStdoutListenerMap = /* @__PURE__ */ new Map();
65
60
  this._taskStderrListenerMap = /* @__PURE__ */ new Map();
@@ -1,4 +1,3 @@
1
- import { _ as _define_property } from "@swc/helpers/_/_define_property";
2
1
  class Package {
3
2
  get name() {
4
3
  return this.json.name;
@@ -10,9 +9,6 @@ class Package {
10
9
  return this.json[key];
11
10
  }
12
11
  constructor(packageJson, packageConfigPath, rootPath) {
13
- _define_property(this, "json", void 0);
14
- _define_property(this, "configPath", void 0);
15
- _define_property(this, "rootPath", void 0);
16
12
  this.configPath = packageConfigPath;
17
13
  this.rootPath = rootPath;
18
14
  this.json = packageJson;
@@ -4,3 +4,4 @@ export * from './build';
4
4
  export * from './buildWatch';
5
5
  export * from './clear';
6
6
  export * from './install';
7
+ export * from './upgrade';
@@ -0,0 +1,2 @@
1
+ import type { Command } from '@modern-js/utils';
2
+ export declare const upgradeCli: (program: Command) => void;
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.47.1",
18
+ "version": "2.48.1",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",
@@ -43,14 +43,12 @@
43
43
  "md5": "^2.3.0",
44
44
  "p-map": "4.0.0",
45
45
  "@swc/helpers": "0.5.3",
46
- "@modern-js/core": "2.47.1",
47
- "@modern-js/upgrade": "2.47.1",
48
- "@modern-js/plugin": "2.47.1",
49
- "@modern-js/new-action": "2.47.1",
50
- "@modern-js/plugin-changeset": "2.47.1",
51
- "@modern-js/plugin-i18n": "2.47.1",
52
- "@modern-js/plugin-lint": "2.47.1",
53
- "@modern-js/utils": "2.47.1"
46
+ "@modern-js/core": "2.48.1",
47
+ "@modern-js/plugin-changeset": "2.48.1",
48
+ "@modern-js/plugin": "2.48.1",
49
+ "@modern-js/plugin-i18n": "2.48.1",
50
+ "@modern-js/utils": "2.48.1",
51
+ "@modern-js/plugin-lint": "2.48.1"
54
52
  },
55
53
  "devDependencies": {
56
54
  "@types/jest": "^29",
@@ -58,8 +56,8 @@
58
56
  "@types/node": "^14",
59
57
  "jest": "^29",
60
58
  "typescript": "^5",
61
- "@scripts/build": "2.47.1",
62
- "@scripts/jest-config": "2.47.1"
59
+ "@scripts/build": "2.48.1",
60
+ "@scripts/jest-config": "2.48.1"
63
61
  },
64
62
  "sideEffects": false,
65
63
  "publishConfig": {