@modern-js/utils 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 (118) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/FileSizeReporter.js +69 -92
  3. package/dist/cjs/alias.js +34 -58
  4. package/dist/cjs/analyzeProject.js +58 -41
  5. package/dist/cjs/applyOptionsChain.js +15 -42
  6. package/dist/cjs/babel.js +28 -39
  7. package/dist/cjs/chainId.js +7 -25
  8. package/dist/cjs/clearConsole.js +7 -25
  9. package/dist/cjs/commands.js +14 -29
  10. package/dist/cjs/compatRequire.js +22 -38
  11. package/dist/cjs/compiled.js +120 -139
  12. package/dist/cjs/constants.js +143 -98
  13. package/dist/cjs/debug.js +8 -26
  14. package/dist/cjs/emptyDir.js +10 -28
  15. package/dist/cjs/ensureAbsolutePath.js +13 -36
  16. package/dist/cjs/ensureArray.js +10 -26
  17. package/dist/cjs/findExists.js +14 -37
  18. package/dist/cjs/generateMetaTags.js +12 -31
  19. package/dist/cjs/getBrowserslist.js +20 -27
  20. package/dist/cjs/getCoreJsVersion.js +49 -37
  21. package/dist/cjs/getEntryOptions.js +14 -29
  22. package/dist/cjs/getPackageManager.js +23 -46
  23. package/dist/cjs/getPort.js +26 -61
  24. package/dist/cjs/getServerConfig.js +51 -43
  25. package/dist/cjs/getTargetDir.js +50 -38
  26. package/dist/cjs/import.js +16 -27
  27. package/dist/cjs/index.js +61 -60
  28. package/dist/cjs/is/index.js +53 -68
  29. package/dist/cjs/is/nodeEnv.js +13 -29
  30. package/dist/cjs/is/platform.js +13 -26
  31. package/dist/cjs/is/type.js +14 -33
  32. package/dist/cjs/logger.js +54 -50
  33. package/dist/cjs/monorepo.js +47 -78
  34. package/dist/cjs/nodeEnv.js +29 -31
  35. package/dist/cjs/path.js +42 -63
  36. package/dist/cjs/pathSerializer.js +43 -51
  37. package/dist/cjs/plugin.js +11 -29
  38. package/dist/cjs/prettyInstructions.js +35 -68
  39. package/dist/cjs/printBuildError.js +15 -37
  40. package/dist/cjs/react.js +18 -41
  41. package/dist/cjs/readTsConfig.js +21 -39
  42. package/dist/cjs/removeSlash.js +13 -27
  43. package/dist/cjs/resolve.js +25 -31
  44. package/dist/cjs/routes.js +23 -43
  45. package/dist/cjs/runtime/index.js +18 -17
  46. package/dist/cjs/runtime/parsed.js +8 -26
  47. package/dist/cjs/runtimeExports.js +31 -56
  48. package/dist/cjs/ssr.js +13 -26
  49. package/dist/cjs/storage.js +51 -41
  50. package/dist/cjs/testUtils.js +8 -29
  51. package/dist/cjs/types.js +4 -15
  52. package/dist/cjs/universal/constants.js +13 -26
  53. package/dist/cjs/universal/formatWebpack.js +16 -44
  54. package/dist/cjs/universal/nestedRoutes.js +94 -46
  55. package/dist/cjs/universal/pluginDagSort.js +58 -0
  56. package/dist/cjs/universal/remixRouter.js +18 -17
  57. package/dist/cjs/universal/serialize.js +16 -37
  58. package/dist/cjs/version.js +25 -41
  59. package/dist/cjs/wait.js +7 -25
  60. package/dist/cjs/watch.js +69 -43
  61. package/dist/esm/FileSizeReporter.js +40 -52
  62. package/dist/esm/alias.js +9 -19
  63. package/dist/esm/analyzeProject.js +3 -7
  64. package/dist/esm/applyOptionsChain.js +5 -17
  65. package/dist/esm/babel.js +6 -8
  66. package/dist/esm/chainId.js +1 -4
  67. package/dist/esm/clearConsole.js +1 -4
  68. package/dist/esm/commands.js +6 -12
  69. package/dist/esm/compatRequire.js +10 -17
  70. package/dist/esm/compiled.js +32 -76
  71. package/dist/esm/constants.js +143 -89
  72. package/dist/esm/debug.js +1 -4
  73. package/dist/esm/emptyDir.js +1 -4
  74. package/dist/esm/ensureAbsolutePath.js +1 -4
  75. package/dist/esm/ensureArray.js +4 -5
  76. package/dist/esm/findExists.js +1 -4
  77. package/dist/esm/generateMetaTags.js +6 -10
  78. package/dist/esm/getBrowserslist.js +8 -6
  79. package/dist/esm/getCoreJsVersion.js +1 -4
  80. package/dist/esm/getEntryOptions.js +5 -5
  81. package/dist/esm/getPackageManager.js +1 -4
  82. package/dist/esm/getPort.js +10 -25
  83. package/dist/esm/getServerConfig.js +2 -9
  84. package/dist/esm/getTargetDir.js +1 -4
  85. package/dist/esm/import.js +3 -4
  86. package/dist/esm/is/index.js +18 -30
  87. package/dist/esm/is/nodeEnv.js +5 -12
  88. package/dist/esm/is/platform.js +2 -6
  89. package/dist/esm/is/type.js +8 -18
  90. package/dist/esm/logger.js +37 -17
  91. package/dist/esm/monorepo.js +21 -38
  92. package/dist/esm/nodeEnv.js +18 -11
  93. package/dist/esm/path.js +16 -23
  94. package/dist/esm/pathSerializer.js +21 -21
  95. package/dist/esm/plugin.js +1 -4
  96. package/dist/esm/prettyInstructions.js +13 -32
  97. package/dist/esm/printBuildError.js +4 -11
  98. package/dist/esm/react.js +1 -4
  99. package/dist/esm/readTsConfig.js +2 -6
  100. package/dist/esm/removeSlash.js +3 -8
  101. package/dist/esm/resolve.js +14 -11
  102. package/dist/esm/routes.js +4 -10
  103. package/dist/esm/runtime/parsed.js +2 -5
  104. package/dist/esm/runtimeExports.js +17 -22
  105. package/dist/esm/ssr.js +1 -4
  106. package/dist/esm/storage.js +2 -6
  107. package/dist/esm/testUtils.js +2 -8
  108. package/dist/esm/types.js +1 -0
  109. package/dist/esm/universal/constants.js +2 -6
  110. package/dist/esm/universal/formatWebpack.js +10 -22
  111. package/dist/esm/universal/nestedRoutes.js +41 -27
  112. package/dist/esm/universal/pluginDagSort.js +50 -0
  113. package/dist/esm/universal/serialize.js +4 -5
  114. package/dist/esm/version.js +5 -7
  115. package/dist/esm/wait.js +1 -3
  116. package/dist/esm/watch.js +14 -9
  117. package/dist/types/universal/pluginDagSort.d.ts +1 -0
  118. package/package.json +17 -5
@@ -1,68 +1,55 @@
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 monorepo_exports = {};
29
- __export(monorepo_exports, {
30
- findMonorepoRoot: () => findMonorepoRoot,
31
- getMonorepoPackages: () => getMonorepoPackages,
7
+ Object.defineProperty(target, name, {
8
+ enumerable: true,
9
+ get: all[name]
10
+ });
11
+ }
12
+ _export(exports, {
32
13
  isLerna: () => isLerna,
33
- isModernjsMonorepo: () => isModernjsMonorepo,
34
- isMonorepo: () => isMonorepo,
14
+ isYarnWorkspaces: () => isYarnWorkspaces,
35
15
  isPnpmWorkspaces: () => isPnpmWorkspaces,
36
- isYarnWorkspaces: () => isYarnWorkspaces
16
+ isMonorepo: () => isMonorepo,
17
+ isModernjsMonorepo: () => isModernjsMonorepo,
18
+ findMonorepoRoot: () => findMonorepoRoot,
19
+ getMonorepoPackages: () => getMonorepoPackages
37
20
  });
38
- module.exports = __toCommonJS(monorepo_exports);
39
- var import_fs = __toESM(require("fs"));
40
- var import_path = __toESM(require("path"));
41
- var import_compiled = require("./compiled");
21
+ const _fs = /* @__PURE__ */ _interop_require_default(require("fs"));
22
+ const _path = /* @__PURE__ */ _interop_require_default(require("path"));
23
+ const _compiled = require("./compiled");
24
+ function _interop_require_default(obj) {
25
+ return obj && obj.__esModule ? obj : {
26
+ default: obj
27
+ };
28
+ }
42
29
  const PACKAGE_MAX_DEPTH = 5;
43
30
  const WORKSPACE_FILES = {
44
31
  YARN: "package.json",
45
32
  PNPM: "pnpm-workspace.yaml",
46
33
  LERNA: "lerna.json"
47
34
  };
48
- const isLerna = (root) => import_fs.default.existsSync(import_path.default.join(root, WORKSPACE_FILES.LERNA));
35
+ const isLerna = (root) => _fs.default.existsSync(_path.default.join(root, WORKSPACE_FILES.LERNA));
49
36
  const isYarnWorkspaces = (root) => {
50
- var _a;
51
- const pkg = import_path.default.join(root, WORKSPACE_FILES.YARN);
52
- if (!import_fs.default.existsSync(pkg)) {
37
+ var _json_workspaces;
38
+ const pkg = _path.default.join(root, WORKSPACE_FILES.YARN);
39
+ if (!_fs.default.existsSync(pkg)) {
53
40
  return false;
54
41
  }
55
- const json = JSON.parse(import_fs.default.readFileSync(pkg, "utf8"));
56
- return Boolean((_a = json.workspaces) == null ? void 0 : _a.packages);
42
+ const json = JSON.parse(_fs.default.readFileSync(pkg, "utf8"));
43
+ return Boolean((_json_workspaces = json.workspaces) === null || _json_workspaces === void 0 ? void 0 : _json_workspaces.packages);
57
44
  };
58
- const isPnpmWorkspaces = (root) => import_fs.default.existsSync(import_path.default.join(root, WORKSPACE_FILES.PNPM));
45
+ const isPnpmWorkspaces = (root) => _fs.default.existsSync(_path.default.join(root, WORKSPACE_FILES.PNPM));
59
46
  const isMonorepo = (root) => isLerna(root) || isYarnWorkspaces(root) || isPnpmWorkspaces(root);
60
47
  const isModernjsMonorepo = (root) => {
61
- const pkgJsonPath = import_path.default.join(root, "package.json");
62
- if (!import_fs.default.existsSync(pkgJsonPath)) {
48
+ const pkgJsonPath = _path.default.join(root, "package.json");
49
+ if (!_fs.default.existsSync(pkgJsonPath)) {
63
50
  return false;
64
51
  }
65
- const json = JSON.parse(import_fs.default.readFileSync(pkgJsonPath, "utf8"));
52
+ const json = JSON.parse(_fs.default.readFileSync(pkgJsonPath, "utf8"));
66
53
  const deps = {
67
54
  ...json.dependencies || {},
68
55
  ...json.devDependencies || {}
@@ -76,51 +63,33 @@ const findMonorepoRoot = (appDirectory, maxDepth = PACKAGE_MAX_DEPTH) => {
76
63
  inMonorepo = true;
77
64
  break;
78
65
  }
79
- appDirectory = import_path.default.dirname(appDirectory);
66
+ appDirectory = _path.default.dirname(appDirectory);
80
67
  }
81
68
  return inMonorepo ? appDirectory : void 0;
82
69
  };
83
70
  const getMonorepoPackages = (root) => {
84
71
  let packages = [];
85
72
  if (isYarnWorkspaces(root)) {
86
- const json = JSON.parse(
87
- import_fs.default.readFileSync(import_path.default.join(root, "package.json"), "utf8")
88
- );
73
+ const json = JSON.parse(_fs.default.readFileSync(_path.default.join(root, "package.json"), "utf8"));
89
74
  ({ packages } = json.workspaces);
90
75
  } else if (isLerna(root)) {
91
- const json = JSON.parse(
92
- import_fs.default.readFileSync(import_path.default.resolve(root, "lerna.json"), "utf8")
93
- );
76
+ const json = JSON.parse(_fs.default.readFileSync(_path.default.resolve(root, "lerna.json"), "utf8"));
94
77
  ({ packages } = json);
95
78
  } else {
96
- ({ packages } = import_compiled.yaml.load(
97
- import_fs.default.readFileSync(import_path.default.join(root, WORKSPACE_FILES.PNPM), "utf8")
98
- ));
79
+ ({ packages } = _compiled.yaml.load(_fs.default.readFileSync(_path.default.join(root, WORKSPACE_FILES.PNPM), "utf8")));
99
80
  }
100
81
  if (packages) {
101
- return packages.map(
102
- (name) => (
103
- // The trailing / ensures only dirs are picked up
104
- import_compiled.glob.sync(import_path.default.join(root, `${name}/`), {
105
- ignore: ["**/node_modules/**"]
106
- })
107
- )
108
- ).reduce((acc, val) => acc.concat(val), []).filter((filepath) => import_fs.default.existsSync(import_path.default.resolve(filepath, "package.json"))).map((filepath) => ({
82
+ return packages.map((name) => (
83
+ // The trailing / ensures only dirs are picked up
84
+ _compiled.glob.sync(_path.default.join(root, `${name}/`), {
85
+ ignore: [
86
+ "**/node_modules/**"
87
+ ]
88
+ })
89
+ )).reduce((acc, val) => acc.concat(val), []).filter((filepath) => _fs.default.existsSync(_path.default.resolve(filepath, "package.json"))).map((filepath) => ({
109
90
  path: filepath,
110
- name: JSON.parse(
111
- import_fs.default.readFileSync(import_path.default.resolve(filepath, "package.json"), "utf8")
112
- ).name
91
+ name: JSON.parse(_fs.default.readFileSync(_path.default.resolve(filepath, "package.json"), "utf8")).name
113
92
  }));
114
93
  }
115
94
  return [];
116
95
  };
117
- // Annotate the CommonJS export names for ESM import in node:
118
- 0 && (module.exports = {
119
- findMonorepoRoot,
120
- getMonorepoPackages,
121
- isLerna,
122
- isModernjsMonorepo,
123
- isMonorepo,
124
- isPnpmWorkspaces,
125
- isYarnWorkspaces
126
- });
@@ -1,31 +1,27 @@
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 nodeEnv_exports = {};
19
- __export(nodeEnv_exports, {
7
+ Object.defineProperty(target, name, {
8
+ enumerable: true,
9
+ get: all[name]
10
+ });
11
+ }
12
+ _export(exports, {
20
13
  canUseNpm: () => canUseNpm,
21
- canUsePnpm: () => canUsePnpm,
22
- canUseYarn: () => canUseYarn
14
+ canUseYarn: () => canUseYarn,
15
+ canUsePnpm: () => canUsePnpm
23
16
  });
24
- module.exports = __toCommonJS(nodeEnv_exports);
25
- var import_compiled = require("./compiled");
17
+ const _compiled = require("./compiled");
26
18
  async function canUseNpm() {
27
19
  try {
28
- await (0, import_compiled.execa)("npm", ["--version"], { env: process.env });
20
+ await (0, _compiled.execa)("npm", [
21
+ "--version"
22
+ ], {
23
+ env: process.env
24
+ });
29
25
  return true;
30
26
  } catch (e) {
31
27
  return false;
@@ -33,7 +29,11 @@ async function canUseNpm() {
33
29
  }
34
30
  async function canUseYarn() {
35
31
  try {
36
- await (0, import_compiled.execa)("yarn", ["--version"], { env: process.env });
32
+ await (0, _compiled.execa)("yarn", [
33
+ "--version"
34
+ ], {
35
+ env: process.env
36
+ });
37
37
  return true;
38
38
  } catch (e) {
39
39
  return false;
@@ -41,15 +41,13 @@ async function canUseYarn() {
41
41
  }
42
42
  async function canUsePnpm() {
43
43
  try {
44
- await (0, import_compiled.execa)("pnpm", ["--version"], { env: process.env });
44
+ await (0, _compiled.execa)("pnpm", [
45
+ "--version"
46
+ ], {
47
+ env: process.env
48
+ });
45
49
  return true;
46
50
  } catch (e) {
47
51
  return false;
48
52
  }
49
53
  }
50
- // Annotate the CommonJS export names for ESM import in node:
51
- 0 && (module.exports = {
52
- canUseNpm,
53
- canUsePnpm,
54
- canUseYarn
55
- });
package/dist/cjs/path.js CHANGED
@@ -1,75 +1,67 @@
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 path_exports = {};
29
- __export(path_exports, {
30
- _joinPathParts: () => _joinPathParts,
31
- compilePathMatcherRegExp: () => compilePathMatcherRegExp,
32
- getRealTemporaryDirectory: () => getRealTemporaryDirectory,
33
- getTemplatePath: () => getTemplatePath,
7
+ Object.defineProperty(target, name, {
8
+ enumerable: true,
9
+ get: all[name]
10
+ });
11
+ }
12
+ _export(exports, {
34
13
  isPathString: () => isPathString,
35
14
  isRelativePath: () => isRelativePath,
36
15
  normalizeOutputPath: () => normalizeOutputPath,
37
16
  normalizeToPosixPath: () => normalizeToPosixPath,
38
- splitPathString: () => splitPathString,
39
- upwardPaths: () => upwardPaths
17
+ getTemplatePath: () => getTemplatePath,
18
+ compilePathMatcherRegExp: () => compilePathMatcherRegExp,
19
+ _joinPathParts: () => _joinPathParts,
20
+ upwardPaths: () => upwardPaths,
21
+ getRealTemporaryDirectory: () => getRealTemporaryDirectory,
22
+ splitPathString: () => splitPathString
40
23
  });
41
- module.exports = __toCommonJS(path_exports);
42
- var import_path = __toESM(require("path"));
43
- var import_os = __toESM(require("os"));
44
- var import_fs = __toESM(require("fs"));
45
- var import_compiled = require("./compiled");
46
- const isPathString = (test) => import_path.default.posix.basename(test) !== test || import_path.default.win32.basename(test) !== test;
24
+ const _path = /* @__PURE__ */ _interop_require_default(require("path"));
25
+ const _os = /* @__PURE__ */ _interop_require_default(require("os"));
26
+ const _fs = /* @__PURE__ */ _interop_require_default(require("fs"));
27
+ const _compiled = require("./compiled");
28
+ function _interop_require_default(obj) {
29
+ return obj && obj.__esModule ? obj : {
30
+ default: obj
31
+ };
32
+ }
33
+ const isPathString = (test) => _path.default.posix.basename(test) !== test || _path.default.win32.basename(test) !== test;
47
34
  const isRelativePath = (test) => /^\.\.?($|[\\/])/.test(test);
48
35
  const normalizeOutputPath = (s) => s.replace(/\\/g, "\\\\");
49
- const normalizeToPosixPath = (p) => import_compiled.upath.normalizeSafe(import_path.default.normalize(p || "")).replace(/^([a-zA-Z]+):/, (_2, m) => `/${m.toLowerCase()}`);
36
+ const normalizeToPosixPath = (p) => _compiled.upath.normalizeSafe(_path.default.normalize(p || "")).replace(/^([a-zA-Z]+):/, (_, m) => `/${m.toLowerCase()}`);
50
37
  const getTemplatePath = (prefix) => {
51
- const tmpRoot = import_fs.default.realpathSync(import_os.default.tmpdir());
52
- const parts = [tmpRoot];
38
+ const tmpRoot = _fs.default.realpathSync(_os.default.tmpdir());
39
+ const parts = [
40
+ tmpRoot
41
+ ];
53
42
  prefix && parts.push(prefix);
54
- parts.push((0, import_compiled.nanoid)());
55
- return import_path.default.resolve(...parts);
43
+ parts.push((0, _compiled.nanoid)());
44
+ return _path.default.resolve(...parts);
56
45
  };
57
46
  function compilePathMatcherRegExp(match) {
58
47
  if (typeof match !== "string") {
59
48
  return match;
60
49
  }
61
- const escaped = import_compiled.lodash.escapeRegExp(match);
50
+ const escaped = _compiled.lodash.escapeRegExp(match);
62
51
  return new RegExp(`(?<=\\W|^)${escaped}(?=\\W|$)`);
63
52
  }
64
- const _joinPathParts = (_part, i, parts) => (0, import_compiled.lodash)(parts).filter((part) => !["/", "\\"].includes(part)).tap((parts2) => parts2.unshift("")).slice(0, i + 2).join("/");
53
+ const _joinPathParts = (_part, i, parts) => (0, _compiled.lodash)(parts).filter((part) => ![
54
+ "/",
55
+ "\\"
56
+ ].includes(part)).tap((parts2) => parts2.unshift("")).slice(0, i + 2).join("/");
65
57
  function upwardPaths(start) {
66
- return (0, import_compiled.lodash)(start).split(/[/\\]/).filter(Boolean).map(_joinPathParts).reverse().push("/").value();
58
+ return (0, _compiled.lodash)(start).split(/[/\\]/).filter(Boolean).map(_joinPathParts).reverse().push("/").value();
67
59
  }
68
60
  function getRealTemporaryDirectory() {
69
61
  let ret = null;
70
62
  try {
71
- ret = import_os.default.tmpdir();
72
- ret = import_fs.default.realpathSync(ret);
63
+ ret = _os.default.tmpdir();
64
+ ret = _fs.default.realpathSync(ret);
73
65
  } catch {
74
66
  }
75
67
  return ret;
@@ -77,16 +69,3 @@ function getRealTemporaryDirectory() {
77
69
  function splitPathString(str) {
78
70
  return str.split(/[\\/]/);
79
71
  }
80
- // Annotate the CommonJS export names for ESM import in node:
81
- 0 && (module.exports = {
82
- _joinPathParts,
83
- compilePathMatcherRegExp,
84
- getRealTemporaryDirectory,
85
- getTemplatePath,
86
- isPathString,
87
- isRelativePath,
88
- normalizeOutputPath,
89
- normalizeToPosixPath,
90
- splitPathString,
91
- upwardPaths
92
- });
@@ -1,50 +1,40 @@
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 pathSerializer_exports = {};
29
- __export(pathSerializer_exports, {
30
- applyMatcherReplacement: () => applyMatcherReplacement,
7
+ Object.defineProperty(target, name, {
8
+ enumerable: true,
9
+ get: all[name]
10
+ });
11
+ }
12
+ _export(exports, {
13
+ matchUpwardPathsAsUnknown: () => matchUpwardPathsAsUnknown,
31
14
  applyPathMatcher: () => applyPathMatcher,
32
- createDefaultPathMatchers: () => createDefaultPathMatchers,
33
- matchUpwardPathsAsUnknown: () => matchUpwardPathsAsUnknown
15
+ applyMatcherReplacement: () => applyMatcherReplacement,
16
+ createDefaultPathMatchers: () => createDefaultPathMatchers
34
17
  });
35
- module.exports = __toCommonJS(pathSerializer_exports);
36
- var import_os = __toESM(require("os"));
37
- var import_lodash = __toESM(require("../compiled/lodash"));
38
- var import_path = require("./path");
39
- const matchUpwardPathsAsUnknown = (p) => (0, import_lodash.default)((0, import_path.upwardPaths)((0, import_path.normalizeToPosixPath)(p))).map((match) => ({ match, mark: "unknown" })).slice(1, -1).value();
18
+ const _os = /* @__PURE__ */ _interop_require_default(require("os"));
19
+ const _lodash = /* @__PURE__ */ _interop_require_default(require("../compiled/lodash"));
20
+ const _path = require("./path");
21
+ function _interop_require_default(obj) {
22
+ return obj && obj.__esModule ? obj : {
23
+ default: obj
24
+ };
25
+ }
26
+ const matchUpwardPathsAsUnknown = (p) => (0, _lodash.default)((0, _path.upwardPaths)((0, _path.normalizeToPosixPath)(p))).map((match) => ({
27
+ match,
28
+ mark: "unknown"
29
+ })).slice(1, -1).value();
40
30
  function applyPathMatcher(matcher, str, options = {}) {
41
- const regex = (0, import_path.compilePathMatcherRegExp)(matcher.match);
31
+ const regex = (0, _path.compilePathMatcherRegExp)(matcher.match);
42
32
  const replacer = (substring, ...args) => {
43
- if (options.minPartials && (0, import_path.splitPathString)(substring).length < options.minPartials) {
33
+ if (options.minPartials && (0, _path.splitPathString)(substring).length < options.minPartials) {
44
34
  return substring;
45
35
  }
46
36
  const ret = typeof matcher.mark === "string" ? matcher.mark : matcher.mark(substring, ...args);
47
- return `<${import_lodash.default.snakeCase(ret).toUpperCase()}>`;
37
+ return `<${_lodash.default.snakeCase(ret).toUpperCase()}>`;
48
38
  };
49
39
  return str.replace(regex, replacer);
50
40
  }
@@ -56,21 +46,23 @@ function applyMatcherReplacement(matchers, str, options = {}) {
56
46
  const createDefaultPathMatchers = (root) => {
57
47
  const ret = [
58
48
  {
59
- match: /(?<=\/)(\.pnpm\/.+?\/node_modules)(?=\/)/,
49
+ match: RegExp("(?<=\\/)(\\.pnpm\\/.+?\\/node_modules)(?=\\/)"),
60
50
  mark: "pnpmInner"
61
51
  }
62
52
  ];
63
- const tmpdir = (0, import_path.getRealTemporaryDirectory)();
64
- tmpdir && ret.push({ match: tmpdir, mark: "temp" });
65
- ret.push({ match: import_os.default.tmpdir(), mark: "temp" });
66
- ret.push({ match: import_os.default.homedir(), mark: "home" });
53
+ const tmpdir = (0, _path.getRealTemporaryDirectory)();
54
+ tmpdir && ret.push({
55
+ match: tmpdir,
56
+ mark: "temp"
57
+ });
58
+ ret.push({
59
+ match: _os.default.tmpdir(),
60
+ mark: "temp"
61
+ });
62
+ ret.push({
63
+ match: _os.default.homedir(),
64
+ mark: "home"
65
+ });
67
66
  ret.push(...matchUpwardPathsAsUnknown(root));
68
67
  return ret;
69
68
  };
70
- // Annotate the CommonJS export names for ESM import in node:
71
- 0 && (module.exports = {
72
- applyMatcherReplacement,
73
- applyPathMatcher,
74
- createDefaultPathMatchers,
75
- matchUpwardPathsAsUnknown
76
- });
@@ -1,35 +1,21 @@
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) => {
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 plugin_exports = {};
19
- __export(plugin_exports, {
20
- getInternalPlugins: () => getInternalPlugins
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
21
4
  });
22
- module.exports = __toCommonJS(plugin_exports);
23
- var import_constants = require("./constants");
24
- var import_is = require("./is");
25
- function getInternalPlugins(appDirectory, internalPlugins = import_constants.INTERNAL_CLI_PLUGINS) {
5
+ Object.defineProperty(exports, "getInternalPlugins", {
6
+ enumerable: true,
7
+ get: () => getInternalPlugins
8
+ });
9
+ const _constants = require("./constants");
10
+ const _is = require("./is");
11
+ function getInternalPlugins(appDirectory, internalPlugins = _constants.INTERNAL_CLI_PLUGINS) {
26
12
  return [
27
13
  ...Object.keys(internalPlugins).filter((name) => {
28
14
  const config = internalPlugins[name];
29
15
  if (typeof config !== "string" && config.forced === true) {
30
16
  return true;
31
17
  }
32
- return (0, import_is.isDepExists)(appDirectory, name);
18
+ return (0, _is.isDepExists)(appDirectory, name);
33
19
  }).map((name) => {
34
20
  const config = internalPlugins[name];
35
21
  if (typeof config !== "string") {
@@ -40,7 +26,3 @@ function getInternalPlugins(appDirectory, internalPlugins = import_constants.INT
40
26
  })
41
27
  ];
42
28
  }
43
- // Annotate the CommonJS export names for ESM import in node:
44
- 0 && (module.exports = {
45
- getInternalPlugins
46
- });