@modern-js/utils 2.47.1 → 2.48.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.
@@ -0,0 +1,55 @@
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 action_exports = {};
20
+ __export(action_exports, {
21
+ newAction: () => newAction,
22
+ upgradeAction: () => upgradeAction
23
+ });
24
+ module.exports = __toCommonJS(action_exports);
25
+ var import_compiled = require("../compiled");
26
+ const newAction = async (config, solution) => {
27
+ var _process_env_MODERN_JS_VERSION;
28
+ await (0, import_compiled.execa)("npx", [
29
+ "--yes",
30
+ `@modern-js/new-action@${(_process_env_MODERN_JS_VERSION = process.env.MODERN_JS_VERSION) !== null && _process_env_MODERN_JS_VERSION !== void 0 ? _process_env_MODERN_JS_VERSION : "latest"}`,
31
+ `--config=${JSON.stringify(config)}`,
32
+ `--solution=${solution}`
33
+ ], {
34
+ stderr: "inherit",
35
+ stdout: "inherit",
36
+ stdin: "inherit"
37
+ });
38
+ };
39
+ const upgradeAction = async () => {
40
+ var _process_env_MODERN_JS_VERSION;
41
+ await (0, import_compiled.execa)("npx", [
42
+ "--yes",
43
+ `@modern-js/upgrade@${(_process_env_MODERN_JS_VERSION = process.env.MODERN_JS_VERSION) !== null && _process_env_MODERN_JS_VERSION !== void 0 ? _process_env_MODERN_JS_VERSION : "latest"}`,
44
+ ...process.argv.slice(2)
45
+ ], {
46
+ stdin: "inherit",
47
+ stdout: "inherit",
48
+ stderr: "inherit"
49
+ });
50
+ };
51
+ // Annotate the CommonJS export names for ESM import in node:
52
+ 0 && (module.exports = {
53
+ newAction,
54
+ upgradeAction
55
+ });
@@ -35,6 +35,7 @@ __reExport(cli_exports, require("./require"), module.exports);
35
35
  __reExport(cli_exports, require("./runtimeExports"), module.exports);
36
36
  __reExport(cli_exports, require("./watch"), module.exports);
37
37
  __reExport(cli_exports, require("./config"), module.exports);
38
+ __reExport(cli_exports, require("./action"), module.exports);
38
39
  // Annotate the CommonJS export names for ESM import in node:
39
40
  0 && (module.exports = {
40
41
  ...require("./constants"),
@@ -56,5 +57,6 @@ __reExport(cli_exports, require("./config"), module.exports);
56
57
  ...require("./require"),
57
58
  ...require("./runtimeExports"),
58
59
  ...require("./watch"),
59
- ...require("./config")
60
+ ...require("./config"),
61
+ ...require("./action")
60
62
  });
@@ -0,0 +1,68 @@
1
+ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
+ import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
3
+ import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
4
+ import { execa } from "../compiled";
5
+ var newAction = function() {
6
+ var _ref = _async_to_generator(function(config, solution) {
7
+ var _process_env_MODERN_JS_VERSION;
8
+ return _ts_generator(this, function(_state) {
9
+ switch (_state.label) {
10
+ case 0:
11
+ return [
12
+ 4,
13
+ execa("npx", [
14
+ "--yes",
15
+ "@modern-js/new-action@".concat((_process_env_MODERN_JS_VERSION = process.env.MODERN_JS_VERSION) !== null && _process_env_MODERN_JS_VERSION !== void 0 ? _process_env_MODERN_JS_VERSION : "latest"),
16
+ "--config=".concat(JSON.stringify(config)),
17
+ "--solution=".concat(solution)
18
+ ], {
19
+ stderr: "inherit",
20
+ stdout: "inherit",
21
+ stdin: "inherit"
22
+ })
23
+ ];
24
+ case 1:
25
+ _state.sent();
26
+ return [
27
+ 2
28
+ ];
29
+ }
30
+ });
31
+ });
32
+ return function newAction2(config, solution) {
33
+ return _ref.apply(this, arguments);
34
+ };
35
+ }();
36
+ var upgradeAction = function() {
37
+ var _ref = _async_to_generator(function() {
38
+ var _process_env_MODERN_JS_VERSION;
39
+ return _ts_generator(this, function(_state) {
40
+ switch (_state.label) {
41
+ case 0:
42
+ return [
43
+ 4,
44
+ execa("npx", [
45
+ "--yes",
46
+ "@modern-js/upgrade@".concat((_process_env_MODERN_JS_VERSION = process.env.MODERN_JS_VERSION) !== null && _process_env_MODERN_JS_VERSION !== void 0 ? _process_env_MODERN_JS_VERSION : "latest")
47
+ ].concat(_to_consumable_array(process.argv.slice(2))), {
48
+ stdin: "inherit",
49
+ stdout: "inherit",
50
+ stderr: "inherit"
51
+ })
52
+ ];
53
+ case 1:
54
+ _state.sent();
55
+ return [
56
+ 2
57
+ ];
58
+ }
59
+ });
60
+ });
61
+ return function upgradeAction2() {
62
+ return _ref.apply(this, arguments);
63
+ };
64
+ }();
65
+ export {
66
+ newAction,
67
+ upgradeAction
68
+ };
@@ -18,3 +18,4 @@ export * from "./require";
18
18
  export * from "./runtimeExports";
19
19
  export * from "./watch";
20
20
  export * from "./config";
21
+ export * from "./action";
@@ -0,0 +1,30 @@
1
+ import { execa } from "../compiled";
2
+ const newAction = async (config, solution) => {
3
+ var _process_env_MODERN_JS_VERSION;
4
+ await execa("npx", [
5
+ "--yes",
6
+ `@modern-js/new-action@${(_process_env_MODERN_JS_VERSION = process.env.MODERN_JS_VERSION) !== null && _process_env_MODERN_JS_VERSION !== void 0 ? _process_env_MODERN_JS_VERSION : "latest"}`,
7
+ `--config=${JSON.stringify(config)}`,
8
+ `--solution=${solution}`
9
+ ], {
10
+ stderr: "inherit",
11
+ stdout: "inherit",
12
+ stdin: "inherit"
13
+ });
14
+ };
15
+ const upgradeAction = async () => {
16
+ var _process_env_MODERN_JS_VERSION;
17
+ await execa("npx", [
18
+ "--yes",
19
+ `@modern-js/upgrade@${(_process_env_MODERN_JS_VERSION = process.env.MODERN_JS_VERSION) !== null && _process_env_MODERN_JS_VERSION !== void 0 ? _process_env_MODERN_JS_VERSION : "latest"}`,
20
+ ...process.argv.slice(2)
21
+ ], {
22
+ stdin: "inherit",
23
+ stdout: "inherit",
24
+ stderr: "inherit"
25
+ });
26
+ };
27
+ export {
28
+ newAction,
29
+ upgradeAction
30
+ };
@@ -18,3 +18,4 @@ export * from "./require";
18
18
  export * from "./runtimeExports";
19
19
  export * from "./watch";
20
20
  export * from "./config";
21
+ export * from "./action";
@@ -0,0 +1,2 @@
1
+ export declare const newAction: (config: Record<string, any>, solution: 'module' | 'mwa' | 'monorepo') => Promise<void>;
2
+ export declare const upgradeAction: () => Promise<void>;
@@ -18,3 +18,4 @@ export * from './require';
18
18
  export * from './runtimeExports';
19
19
  export * from './watch';
20
20
  export * from './config';
21
+ export * from './action';
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.0",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",
@@ -154,9 +154,9 @@
154
154
  "jest": "^29",
155
155
  "typescript": "^5",
156
156
  "webpack": "^5.89.0",
157
- "@modern-js/types": "2.47.1",
158
- "@scripts/build": "2.47.1",
159
- "@scripts/jest-config": "2.47.1"
157
+ "@modern-js/types": "2.48.0",
158
+ "@scripts/jest-config": "2.48.0",
159
+ "@scripts/build": "2.48.0"
160
160
  },
161
161
  "sideEffects": false,
162
162
  "scripts": {