vite-plus 1.2.0 → 1.4.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 (94) hide show
  1. package/AGENTS.md +4 -0
  2. package/LICENSE +1 -849
  3. package/README.md +1 -1
  4. package/bin/vpx +9 -0
  5. package/binding/index.cjs +59 -54
  6. package/binding/index.d.cts +132 -2
  7. package/dist/{agent-KeDc6vmg.js → agent-D8oxxhVR.js} +7 -9
  8. package/dist/bin.js +27 -34
  9. package/dist/{cli-parse-DHE8NrBU.js → cli-parse-aeUeFDlC.js} +2 -3
  10. package/dist/command-TjS_6y9O.js +1 -0
  11. package/dist/{command-CguLh2KL.js → command-rY79K5NI.js} +40 -42
  12. package/dist/{comparison-CmVirWIW-DUGaiYqF.js → comparison-CmVirWIW-UlEf2maz.js} +1 -2
  13. package/dist/config/bin.js +8 -10
  14. package/dist/{constants-BW3g7VnD.js → constants-DRUnJ_Dz.js} +4 -6
  15. package/dist/create/bin.d.ts +4 -8
  16. package/dist/create/bin.js +64 -68
  17. package/dist/{define-config-CIlk9scU.js → define-config-ChwJcu5e.js} +6 -9
  18. package/dist/{define-config-Dq_23Eyr.cjs → define-config-Cv2P6NT2.cjs} +8 -13
  19. package/dist/{define-config-Bexdd6RZ.d.ts → define-config-rPhYIFSn.d.ts} +1 -11
  20. package/dist/define-config.cjs +1 -1
  21. package/dist/define-config.d.ts +1 -1
  22. package/dist/define-config.js +1 -1
  23. package/dist/{dist-Bi7ZEK3c.js → dist-Bs0SObNC.js} +77 -149
  24. package/dist/{dist-Cqz8OtiO.js → dist-CdkMvIiQ.js} +11 -5
  25. package/dist/dist-zDZV5eEc.js +3 -0
  26. package/dist/{documentation-DqcZSthV.js → documentation-cv_y0Auv.js} +1 -2
  27. package/dist/{editor-b1XUwt9v.js → editor-ClL78D8u.js} +1492 -4211
  28. package/dist/{help-BmKpeOP9.js → help-B03t_iQ4.js} +1 -2
  29. package/dist/hooks/bin.js +4 -5
  30. package/dist/{hooks-DhwsWb46.js → hooks-xRcJPc-O.js} +5 -4
  31. package/dist/index.cjs +2 -3
  32. package/dist/index.d.ts +1 -1
  33. package/dist/index.js +1 -1
  34. package/dist/{json-JP24qHUF.js → json-kl84kDyH.js} +9 -18
  35. package/dist/lint-plugins.cjs +1 -1
  36. package/dist/migration/bin.js +719 -184
  37. package/dist/migration/compat/worker.js +4 -6
  38. package/dist/{oxlint-plugin-config-Dx-ZY2MN.js → oxlint-plugin-config-BVpqYdcC.js} +3 -4
  39. package/dist/oxlint-plugin.d.ts +0 -2
  40. package/dist/oxlint-plugin.js +6 -7
  41. package/dist/{pack-BK38MLVZ.d.ts → pack-ARPFMefW.d.ts} +0 -2
  42. package/dist/pack-bin.d.ts +1 -3
  43. package/dist/pack-bin.js +3 -4
  44. package/dist/pack.d.ts +1 -1
  45. package/dist/{package-BP16iQby.js → package-DzsomcUD.js} +10 -95
  46. package/dist/{package-overrides-D1RcXSFl.js → package-overrides-Ci8GXouY.js} +5 -8
  47. package/dist/picomatch-DEUoj81q.js +1916 -0
  48. package/dist/{prompts-BGpQtC5z.js → prompts-GL1vj0wk.js} +113 -239
  49. package/dist/{protocol-D99W10Qi.js → protocol-CkNmY-Mr.js} +1 -2
  50. package/dist/{report-NhQk8VHb.js → report-DLHO30yZ.js} +2 -2
  51. package/dist/{resolve-vite-config-x47JetlI.js → resolve-vite-config-Dn5896A4.js} +9 -25
  52. package/dist/resolve-vite-config-QO6cC0SP.js +1 -0
  53. package/dist/{rolldown-runtime-CMFfr-1z.js → rolldown-runtime-DegdyBIC.js} +2 -3
  54. package/dist/script-esm-hooks.d.ts +8 -0
  55. package/dist/script-esm-hooks.js +24 -0
  56. package/dist/script-hooks-9Fof5UMY.js +176 -0
  57. package/dist/script-preload.cjs +468 -0
  58. package/dist/script-register.d.ts +1 -0
  59. package/dist/script-register.js +22 -0
  60. package/dist/script-watch.d.ts +1 -0
  61. package/dist/script-watch.js +1908 -0
  62. package/dist/staged/bin.js +81 -2011
  63. package/dist/sync-versions/bin.js +29 -50
  64. package/dist/sync-versions/bin.mjs +117 -224
  65. package/dist/{terminal-MKGAuy-p.js → terminal-BcuPUy-j.js} +1 -2
  66. package/dist/toolchain.js +36 -10
  67. package/dist/toolchain.json +36 -10
  68. package/dist/{tsconfig-C5PnJfW4.js → tsconfig-Do6MAG_f.js} +1 -1
  69. package/dist/{tsconfig-D2DzAQ_D.js → tsconfig-LE_mAwe_.js} +8 -10
  70. package/dist/version.d.ts +1 -3
  71. package/dist/version.js +5 -6
  72. package/dist/versions.js +5 -5
  73. package/dist/{vitest-ecosystem-BU0AqZq-.js → vitest-ecosystem-BeEYz-qF.js} +1 -2
  74. package/dist/{vitest-v5-entry-points-DthU1e_O.js → vitest-v5-entry-points-NyJsFeux.js} +1 -2
  75. package/dist/vpx-bin.d.ts +1 -0
  76. package/dist/vpx-bin.js +232 -0
  77. package/dist/vpx-script-EXgV5QOf.js +434 -0
  78. package/docs/config/run.md +4 -0
  79. package/docs/guide/check.md +1 -0
  80. package/docs/guide/ci.md +13 -3
  81. package/docs/guide/create.md +34 -0
  82. package/docs/guide/env.md +27 -13
  83. package/docs/guide/global-cli.md +52 -0
  84. package/docs/guide/local-cli.md +4 -4
  85. package/docs/guide/migrate-rules.md +48 -5
  86. package/docs/guide/migrate.md +6 -6
  87. package/docs/guide/package-management.md +19 -2
  88. package/docs/guide/test.md +1 -1
  89. package/docs/guide/vitest-v5.md +2 -2
  90. package/docs/guide/vpx.md +170 -9
  91. package/package.json +32 -29
  92. package/dist/command-DaRqSNpP.js +0 -1
  93. package/dist/dist-CBWGibx8.js +0 -3
  94. package/dist/resolve-vite-config-CGzlyhGr.js +0 -1
@@ -1,7 +1,7 @@
1
- import { n as addMigrationWarning, r as createMigrationReport } from "../../report-NhQk8VHb.js";
2
- import { t as ROLLDOWN_COMPAT_RESULT_PREFIX } from "../../protocol-D99W10Qi.js";
1
+ import { n as addMigrationWarning, r as createMigrationReport } from "../../report-DLHO30yZ.js";
2
+ import { t as ROLLDOWN_COMPAT_RESULT_PREFIX } from "../../protocol-CkNmY-Mr.js";
3
3
  import { writeSync } from "node:fs";
4
- //#region src/migration/compat/manual-chunks.ts
4
+ // src/migration/compat/manual-chunks.ts
5
5
  /**
6
6
  * Check for Rolldown-incompatible manualChunks config patterns.
7
7
  */
@@ -12,8 +12,7 @@ function checkManualChunksCompat(output, report) {
12
12
  break;
13
13
  }
14
14
  }
15
- //#endregion
16
- //#region src/migration/compat/worker.ts
15
+ // src/migration/compat/worker.ts
17
16
  async function main() {
18
17
  const rootDir = process.argv[2];
19
18
  if (!rootDir) return;
@@ -31,5 +30,4 @@ async function main() {
31
30
  } catch {}
32
31
  }
33
32
  main().then(() => process.exit(0), () => process.exit(0));
34
- //#endregion
35
33
  export {};
@@ -1,5 +1,5 @@
1
- import { u as VITE_PLUS_NAME } from "./constants-BW3g7VnD.js";
2
- //#region src/oxlint-plugin-config.ts
1
+ import { u as VITE_PLUS_NAME } from "./constants-DRUnJ_Dz.js";
2
+ // src/oxlint-plugin-config.ts
3
3
  const VITE_PLUS_OXLINT_PLUGIN_NAME = VITE_PLUS_NAME;
4
4
  const VITE_PLUS_OXLINT_PLUGIN_SPECIFIER = `${VITE_PLUS_NAME}/oxlint-plugin`;
5
5
  const PREFER_VITE_PLUS_IMPORTS_RULE_NAME = "prefer-vite-plus-imports";
@@ -33,5 +33,4 @@ function createDefaultVitePlusLintConfig(options) {
33
33
  };
34
34
  return config;
35
35
  }
36
- //#endregion
37
- export { ensureVitePlusImportRuleDefaults as i, VITE_PLUS_OXLINT_PLUGIN_NAME as n, createDefaultVitePlusLintConfig as r, PREFER_VITE_PLUS_IMPORTS_RULE_NAME as t };
36
+ export { ensureVitePlusImportRuleDefaults as a, createDefaultVitePlusLintConfig as i, PREFER_VITE_PLUS_IMPORTS_RULE_NAME as n, VITE_PLUS_OXLINT_PLUGIN_NAME as r, PREFER_VITE_PLUS_IMPORTS_RULE as t };
@@ -1,6 +1,4 @@
1
- //#region src/oxlint-plugin.d.ts
2
1
  declare function rewriteVitePlusImportSpecifier(specifier: string): string | null;
3
2
  export declare const preferVitePlusImportsRule: import("@oxlint/plugins").Rule;
4
3
  declare const plugin: import("@oxlint/plugins").Plugin;
5
- //#endregion
6
4
  export { plugin as default, rewriteVitePlusImportSpecifier };
@@ -1,10 +1,10 @@
1
- import { v as exports } from "./constants-BW3g7VnD.js";
2
- import { n as VITE_PLUS_OXLINT_PLUGIN_NAME, t as PREFER_VITE_PLUS_IMPORTS_RULE_NAME } from "./oxlint-plugin-config-Dx-ZY2MN.js";
3
- import { t as vitest_v5_entry_points_default } from "./vitest-v5-entry-points-DthU1e_O.js";
1
+ import { v as exports } from "./constants-DRUnJ_Dz.js";
2
+ import { n as PREFER_VITE_PLUS_IMPORTS_RULE_NAME, r as VITE_PLUS_OXLINT_PLUGIN_NAME } from "./oxlint-plugin-config-BVpqYdcC.js";
3
+ import { t as vitest_v5_entry_points_default } from "./vitest-v5-entry-points-NyJsFeux.js";
4
4
  import path from "node:path";
5
5
  import fs from "node:fs";
6
6
  import { definePlugin, defineRule } from "@oxlint/plugins";
7
- //#region src/vite-config-entry-basenames.json
7
+ // src/vite-config-entry-basenames.json
8
8
  var vite_config_entry_basenames_default = [
9
9
  "vite.config.ts",
10
10
  "vite.config.mts",
@@ -19,8 +19,7 @@ var vite_config_entry_basenames_default = [
19
19
  "vitest.config.mjs",
20
20
  "vitest.config.cjs"
21
21
  ];
22
- //#endregion
23
- //#region src/oxlint-plugin.ts
22
+ // src/oxlint-plugin.ts
24
23
  function isVitestFamilyDeclareModuleSpecifier(specifier) {
25
24
  return specifier === "vitest" || specifier.startsWith("vitest/") || specifier === "@vitest/browser" || specifier.startsWith("@vitest/browser/") || specifier.startsWith("@vitest/browser-");
26
25
  }
@@ -54,6 +53,7 @@ const OXLINT_CONFIG_SURFACE_EXPORTS = /* @__PURE__ */ new Set([
54
53
  ]);
55
54
  function rewriteVitePlusImportSpecifier(specifier) {
56
55
  if (specifier === "vite") return "vite-plus";
56
+ if (specifier === "vite/rolldown" || specifier.startsWith("vite/rolldown/")) return null;
57
57
  if (specifier.startsWith("vite/")) return `vite-plus/${specifier.slice(5)}`;
58
58
  if (specifier === "vitest/config") return "vite-plus";
59
59
  if (specifier === "vitest") return "vite-plus/test";
@@ -227,5 +227,4 @@ const plugin = definePlugin({
227
227
  meta: { name: VITE_PLUS_OXLINT_PLUGIN_NAME },
228
228
  rules: { [PREFER_VITE_PLUS_IMPORTS_RULE_NAME]: preferVitePlusImportsRule }
229
229
  });
230
- //#endregion
231
230
  export { plugin as default, preferVitePlusImportsRule, rewriteVitePlusImportSpecifier };
@@ -1,5 +1,4 @@
1
1
  import { UserConfig } from "vite/pack";
2
- //#region src/pack.d.ts
3
2
  interface PackUserConfig extends UserConfig {
4
3
  /**
5
4
  * When loading env variables from `envFile`, only include variables with these prefixes.
@@ -7,5 +6,4 @@ interface PackUserConfig extends UserConfig {
7
6
  */
8
7
  envPrefix?: string | string[];
9
8
  }
10
- //#endregion
11
9
  export { PackUserConfig as t };
@@ -1,3 +1 @@
1
- //#region src/pack-bin.d.ts
2
- export declare function runCLI(): Promise<void>;
3
- //#endregion
1
+ export declare function runCLI(): Promise<void>;
package/dist/pack-bin.js CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import { t as cac } from "./dist-Cqz8OtiO.js";
3
- import { o as resolveViteConfig } from "./resolve-vite-config-x47JetlI.js";
2
+ import { t as cac } from "./dist-CdkMvIiQ.js";
3
+ import { a as resolveViteConfig } from "./resolve-vite-config-Dn5896A4.js";
4
4
  import module from "node:module";
5
5
  import path from "node:path";
6
6
  import { buildWithConfigs, enableDebug, globalLogger, resolveUserConfig } from "vite/pack";
7
- //#region src/pack-bin.ts
7
+ // src/pack-bin.ts
8
8
  const RE_DTS = /\.d\.[cm]?ts$/;
9
9
  const EXTERNAL_DTS_PKG_RE = /^(?:postcss|lightningcss|vitest|@vitest\/[^/]+|vite-plus)(?:\/|$)/;
10
10
  /**
@@ -99,5 +99,4 @@ async function runCLI() {
99
99
  }
100
100
  if (module.enableCompileCache) module.enableCompileCache();
101
101
  await runCLI();
102
- //#endregion
103
102
  export { runCLI };
package/dist/pack.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { t as PackUserConfig } from "./pack-BK38MLVZ.js";
1
+ import { t as PackUserConfig } from "./pack-ARPFMefW.js";
2
2
  export * from "vite/pack";
3
3
  export { PackUserConfig };
@@ -1,63 +1,10 @@
1
- import "./constants-BW3g7VnD.js";
2
- import { i as readJsonFile } from "./json-JP24qHUF.js";
1
+ import "./constants-DRUnJ_Dz.js";
2
+ import { i as readJsonFile } from "./json-kl84kDyH.js";
3
3
  import { createRequire } from "node:module";
4
4
  import path from "node:path";
5
+ import { resolveNpmAuthorization, resolveNpmRegistry } from "../binding/index.js";
5
6
  import fs from "node:fs";
6
- import os from "node:os";
7
- //#region src/utils/npm-config.ts
8
- function expandNpmrcValue(raw) {
9
- let value = raw.trim();
10
- if (value.startsWith("\"") && value.endsWith("\"") || value.startsWith("'") && value.endsWith("'")) value = value.slice(1, -1);
11
- return value.replaceAll(/\$\{([A-Z0-9_]+)\}/gi, (_, name) => process.env[name] ?? "");
12
- }
13
- function parseNpmrc(contents, into) {
14
- for (const rawLine of contents.split(/\r?\n/)) {
15
- const line = rawLine.trim();
16
- if (!line || line.startsWith("#") || line.startsWith(";")) continue;
17
- const eq = line.indexOf("=");
18
- if (eq === -1) continue;
19
- const key = line.slice(0, eq).trim();
20
- const value = expandNpmrcValue(line.slice(eq + 1));
21
- if (key) into.set(key, value);
22
- }
23
- }
24
- function loadFileInto(filePath, config) {
25
- try {
26
- parseNpmrc(fs.readFileSync(filePath, "utf8"), config);
27
- } catch {}
28
- }
29
- /**
30
- * Rebuilt on every call so tests that mutate `process.env` mid-run see
31
- * fresh config. Each `vp create` hits this ≤4 times (registry + auth on
32
- * packument + auth on tarball), which is cheap enough vs. the network
33
- * work that a cache isn't worth the test-determinism cost.
34
- */
35
- function getNpmConfig() {
36
- const config = /* @__PURE__ */ new Map();
37
- const homeNpmrc = path.resolve(os.homedir(), ".npmrc");
38
- loadFileInto(homeNpmrc, config);
39
- const projectRcs = [];
40
- let dir = path.resolve(process.cwd());
41
- const seen = /* @__PURE__ */ new Set();
42
- while (dir && !seen.has(dir)) {
43
- seen.add(dir);
44
- const candidate = path.resolve(dir, ".npmrc");
45
- if (candidate !== homeNpmrc && fs.existsSync(candidate)) projectRcs.push(candidate);
46
- const parent = path.dirname(dir);
47
- if (parent === dir) break;
48
- dir = parent;
49
- }
50
- for (let i = projectRcs.length - 1; i >= 0; i -= 1) loadFileInto(projectRcs[i], config);
51
- for (const [envKey, envValue] of Object.entries(process.env)) {
52
- if (envValue === void 0) continue;
53
- if (envKey.startsWith("npm_config_")) config.set(envKey.slice(11), envValue);
54
- else if (envKey.startsWith("NPM_CONFIG_")) config.set(envKey.slice(11).toLowerCase(), envValue);
55
- }
56
- return config;
57
- }
58
- function normalizeRegistryUrl(url) {
59
- return url.replace(/\/+$/, "");
60
- }
7
+ // src/utils/npm-config.ts
61
8
  /**
62
9
  * Resolve the npm registry base URL for the given scope (or the default
63
10
  * registry when `scope` is omitted). Honors `@scope:registry=...` entries
@@ -65,45 +12,15 @@ function normalizeRegistryUrl(url) {
65
12
  * vars so private / mirrored registries work for org manifest fetches.
66
13
  */
67
14
  function getNpmRegistry(scope) {
68
- const config = getNpmConfig();
69
- if (scope) {
70
- const normalizedScope = scope.startsWith("@") ? scope : `@${scope}`;
71
- const scoped = config.get(`${normalizedScope}:registry`);
72
- if (scoped) return normalizeRegistryUrl(scoped);
73
- }
74
- return normalizeRegistryUrl(config.get("registry") || "https://registry.npmjs.org");
15
+ return resolveNpmRegistry(process.cwd(), scope?.replace(/^@/, ""));
75
16
  }
76
17
  /**
77
- * Build the `Authorization` header value for a registry URL by matching
78
- * the URL against `//host[/path]/:_authToken=...` / `:_auth=...` entries
79
- * in `.npmrc`. Returns `undefined` when no credential is configured.
18
+ * Build the `Authorization` header value for a registry URL from the
19
+ * matching `//host[/path]/:_authToken=...` / `:_auth=...` entries in
20
+ * `.npmrc`. Returns `undefined` when no credential is configured.
80
21
  */
81
22
  function getNpmAuthHeader(registryOrUrl) {
82
- let parsed;
83
- try {
84
- parsed = new URL(registryOrUrl);
85
- } catch {
86
- return;
87
- }
88
- const config = getNpmConfig();
89
- const segments = parsed.pathname.split("/").filter(Boolean);
90
- const candidates = [];
91
- for (let i = segments.length; i >= 0; i -= 1) {
92
- const subPath = i === 0 ? "/" : `/${segments.slice(0, i).join("/")}/`;
93
- candidates.push(`//${parsed.host}${subPath}`);
94
- }
95
- for (const prefix of candidates) {
96
- const token = config.get(`${prefix}:_authToken`);
97
- if (token) return `Bearer ${token}`;
98
- const basic = config.get(`${prefix}:_auth`);
99
- if (basic) return `Basic ${basic}`;
100
- const username = config.get(`${prefix}:username`);
101
- const passwordB64 = config.get(`${prefix}:_password`);
102
- if (username && passwordB64) {
103
- const password = Buffer.from(passwordB64, "base64").toString("utf8");
104
- return `Basic ${Buffer.from(`${username}:${password}`).toString("base64")}`;
105
- }
106
- }
23
+ return resolveNpmAuthorization(process.cwd(), registryOrUrl) ?? void 0;
107
24
  }
108
25
  /**
109
26
  * `fetch` wrapper for npm registry URLs that retries with an
@@ -132,8 +49,7 @@ async function fetchNpmResource(url, init) {
132
49
  signal: AbortSignal.timeout(timeoutMs)
133
50
  });
134
51
  }
135
- //#endregion
136
- //#region src/utils/package.ts
52
+ // src/utils/package.ts
137
53
  function getScopeFromPackageName(packageName) {
138
54
  if (packageName.startsWith("@")) return packageName.split("/")[0];
139
55
  return "";
@@ -243,5 +159,4 @@ async function checkNpmPackageExists(packageName) {
243
159
  return true;
244
160
  }
245
161
  }
246
- //#endregion
247
162
  export { hasVitePlusDependency as a, getNpmRegistry as c, hasPackageManagerDeclaration as i, detectPackageMetadata as n, readNearestPackageJson as o, getScopeFromPackageName as r, fetchNpmResource as s, checkNpmPackageExists as t };
@@ -1,5 +1,5 @@
1
- import { a as GREATER_LESS_THAN, b as safeRegex, c as LOOSE_PLAIN, d as XRANGE_PLAIN, f as XRANGE_PLAIN_LOOSE, g as formatComparableVersion, i as FULL_PLAIN, m as compareParsed, o as LONE_CARET, s as LONE_TILDE, t as BUILD, x as tryParse, y as parse } from "./comparison-CmVirWIW-DUGaiYqF.js";
2
- //#region ../../node_modules/.pnpm/verkit@0.5.0/node_modules/verkit/dist/set-BGFWKKE8.js
1
+ import { a as GREATER_LESS_THAN, b as safeRegex, c as LOOSE_PLAIN, d as XRANGE_PLAIN, f as XRANGE_PLAIN_LOOSE, g as formatComparableVersion, i as FULL_PLAIN, m as compareParsed, o as LONE_CARET, s as LONE_TILDE, t as BUILD, x as tryParse, y as parse } from "./comparison-CmVirWIW-UlEf2maz.js";
2
+ // ../../node_modules/.pnpm/verkit@0.5.0/node_modules/verkit/dist/set-BGFWKKE8.js
3
3
  const STRICT_COMPARATOR = safeRegex(String.raw`^${GREATER_LESS_THAN}\s*(${FULL_PLAIN})$|^$`);
4
4
  const LOOSE_COMPARATOR$1 = safeRegex(String.raw`^${GREATER_LESS_THAN}\s*(${LOOSE_PLAIN})$|^$`);
5
5
  function formatComparator(comparator) {
@@ -53,8 +53,7 @@ function parsedComparatorsIntersect(left, right, options = {}) {
53
53
  if (comparison < 0 && left.operator.startsWith(">") && right.operator.startsWith("<")) return true;
54
54
  return comparison > 0 && left.operator.startsWith("<") && right.operator.startsWith(">");
55
55
  }
56
- //#endregion
57
- //#region ../../node_modules/.pnpm/verkit@0.5.0/node_modules/verkit/dist/range-C5wjdo9a.js
56
+ // ../../node_modules/.pnpm/verkit@0.5.0/node_modules/verkit/dist/range-C5wjdo9a.js
58
57
  function formatRange(range) {
59
58
  return range.sets.map((set) => set.map(formatComparator).join(" ")).join("||");
60
59
  }
@@ -391,15 +390,14 @@ function isRangeSubset(subset, superset, options = {}) {
391
390
  }
392
391
  return true;
393
392
  }
394
- //#endregion
395
- //#region src/utils/package-overrides.ts
393
+ // src/utils/package-overrides.ts
396
394
  function extractOverrideTargetName(key) {
397
395
  let target = key.trim();
398
396
  for (let delimiter = target.search(/[^ |@]>/); delimiter !== -1; delimiter = target.search(/[^ |@]>/)) target = target.slice(delimiter + 2).trim();
399
397
  if (!target) return target;
400
398
  if (target.includes("/")) {
401
399
  const segments = target.split("/");
402
- const last = segments[segments.length - 1];
400
+ const last = segments.at(-1);
403
401
  const scope = segments[segments.length - 2];
404
402
  target = scope?.startsWith("@") ? `${scope}/${last}` : last;
405
403
  }
@@ -407,5 +405,4 @@ function extractOverrideTargetName(key) {
407
405
  const versionAt = target.indexOf("@", nameStart);
408
406
  return versionAt > 0 ? target.slice(0, versionAt) : target;
409
407
  }
410
- //#endregion
411
408
  export { rangeToComparators as a, normalizeRange as i, findMinimumForRange as n, rangesIntersect as o, isRangeSubset as r, satisfies as s, extractOverrideTargetName as t };