@voidzero-dev/vite-plus-core 0.1.15-alpha.0 → 0.1.15-alpha.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.
Files changed (35) hide show
  1. package/dist/rolldown/cli.mjs +6 -6
  2. package/dist/rolldown/config.mjs +2 -2
  3. package/dist/rolldown/experimental-index.mjs +8 -8
  4. package/dist/rolldown/index.mjs +4 -4
  5. package/dist/rolldown/parallel-plugin-worker.mjs +2 -2
  6. package/dist/rolldown/parse-ast-index.mjs +1 -1
  7. package/dist/rolldown/plugins-index.mjs +2 -2
  8. package/dist/rolldown/shared/{bindingify-input-options-DHK3MwUV.mjs → bindingify-input-options-BCAF6TcN.mjs} +4 -4
  9. package/dist/rolldown/shared/{constructors-BfnFojy3.mjs → constructors-D3ZqEbT5.mjs} +1 -1
  10. package/dist/rolldown/shared/{error-D8cGyrC7.mjs → error-BLhcSyeg.mjs} +1 -1
  11. package/dist/rolldown/shared/{load-config-DT77Jzbv.mjs → load-config-CFr1Adp9.mjs} +1 -1
  12. package/dist/rolldown/shared/{normalize-string-or-regex-BFB1QNW3.mjs → normalize-string-or-regex-CCT059Zu.mjs} +1 -1
  13. package/dist/rolldown/shared/{parse-CCDXnkPL.mjs → parse-tRtSyZ-b.mjs} +1 -1
  14. package/dist/rolldown/shared/{resolve-tsconfig-gxOviCVx.mjs → resolve-tsconfig-DJjTYbYr.mjs} +2 -2
  15. package/dist/rolldown/shared/{rolldown-DFpH3t7W.mjs → rolldown-BMLc9elZ.mjs} +1 -1
  16. package/dist/rolldown/shared/{rolldown-build-ZUNnA-sr.mjs → rolldown-build-CxsB9UaT.mjs} +4 -4
  17. package/dist/rolldown/shared/{watch-C4x8DFD_.mjs → watch-DJOwXDOi.mjs} +4 -4
  18. package/dist/rolldown/utils-index.mjs +2 -2
  19. package/dist/tsdown/build-D-zhBXEK-X12uvwLb.js +2 -0
  20. package/dist/tsdown/{build-CoLhkNXE-7EboM7qg.js → build-DpU0PBVv-CUY7qeWj.js} +355 -94
  21. package/dist/tsdown/{debug-C4FmgzkJ-PiSP_iWN.js → debug-C4FmgzkJ-A9B4RM_w.js} +2 -2
  22. package/dist/tsdown/{detect-DN3DXXYt-XnCR4Kxo.js → detect-DN3DXXYt-GIMDNpE1.js} +1 -1
  23. package/dist/tsdown/{dist-DUfkEqWP.js → dist-BkOM3Vdg.js} +13 -13
  24. package/dist/tsdown/{dist-CtF_Stv5.js → dist-dJp148cE.js} +3 -3
  25. package/dist/tsdown/index-types.d.ts +131 -131
  26. package/dist/tsdown/index.js +4 -4
  27. package/dist/tsdown/{main-CDlTYgDd.js → main-BgAbc3Rw.js} +3 -3
  28. package/dist/tsdown/npm_entry_picomatch.cjs +217 -9
  29. package/dist/tsdown/run.js +3 -3
  30. package/dist/vite/client/client.mjs +4 -4
  31. package/dist/vite/node/chunks/build2.js +1 -0
  32. package/dist/vite/node/chunks/node.js +218 -10
  33. package/package.json +10 -10
  34. package/dist/tsdown/build-dhDyu66J-DRVHWKha.js +0 -2
  35. /package/dist/rolldown/shared/{binding-ER32uZ22.mjs → binding-CkWPGrSM.mjs} +0 -0
@@ -1,5 +1,5 @@
1
1
  import { r as __toESM, t as __commonJSMin } from "./chunk-CSNpwdVU.js";
2
- import { C as resolveComma, E as toArray, S as promiseWithResolvers, T as slash, _ as debounce, a as createLogger, b as noop, c as globalLogger, d as bold, f as dim, g as yellow, h as underline, i as LogLevels, l as prettyFormat, m as red, n as z, o as generateColor, p as green, r as version, s as getNameLabel, t as R, u as blue, v as importWithError, w as resolveRegex, x as pkgExists, y as matchPattern } from "./main-CDlTYgDd.js";
2
+ import { C as resolveComma, E as toArray, S as promiseWithResolvers, T as slash, _ as debounce, a as createLogger, b as noop, c as globalLogger, d as bold, f as dim, g as yellow, h as underline, i as LogLevels, l as prettyFormat, m as red, n as z, o as generateColor, p as green, r as version, s as getNameLabel, t as R, u as blue, v as importWithError, w as resolveRegex, x as pkgExists, y as matchPattern } from "./main-BgAbc3Rw.js";
3
3
  import { t as createDebug } from "./node-B3Gdtau1.js";
4
4
  import { i as RE_JS, n as RE_DTS, o as RE_NODE_MODULES$1, t as RE_CSS } from "./filename-UU7z2A9Z.js";
5
5
  import module$1, { builtinModules, createRequire, isBuiltin } from "node:module";
@@ -17,11 +17,11 @@ import path$1, { basename, dirname as dirname$1, normalize as normalize$1, posix
17
17
  import { fileURLToPath as fileURLToPath$1 } from "url";
18
18
  import { createRequire as createRequire$1 } from "module";
19
19
  import { tmpdir } from "node:os";
20
- import re, { existsSync, readFileSync, writeFileSync } from "node:fs";
20
+ import fs$1, { existsSync, readFileSync, writeFileSync } from "node:fs";
21
21
  import { Buffer } from "node:buffer";
22
22
  import { brotliCompress, gzip } from "node:zlib";
23
23
  import { importGlobPlugin } from "@voidzero-dev/vite-plus-core/rolldown/experimental";
24
- //#region ../../node_modules/.pnpm/tsdown@0.21.4_@arethetypeswrong+core@0.18.2_@tsdown+css@0.21.4_@tsdown+exe@0.21.4_@type_f14dd4168fd2bd4ac31d1349e8200015/node_modules/tsdown/dist/fs-Dd6Htx2P.mjs
24
+ //#region ../../node_modules/.pnpm/tsdown@0.21.5_@arethetypeswrong+core@0.18.2_@tsdown+css@0.21.5_@tsdown+exe@0.21.5_@type_bddbe1807a7ea96241d07b33ef15a1ae/node_modules/tsdown/dist/fs-Dd6Htx2P.mjs
25
25
  function fsExists(path) {
26
26
  return access(path).then(() => true, () => false);
27
27
  }
@@ -64,7 +64,7 @@ function stripExtname(filePath) {
64
64
  return filePath.slice(0, -ext.length);
65
65
  }
66
66
  //#endregion
67
- //#region ../../node_modules/.pnpm/tsdown@0.21.4_@arethetypeswrong+core@0.18.2_@tsdown+css@0.21.4_@tsdown+exe@0.21.4_@type_f14dd4168fd2bd4ac31d1349e8200015/node_modules/tsdown/dist/format-DPVBd8E4.mjs
67
+ //#region ../../node_modules/.pnpm/tsdown@0.21.5_@arethetypeswrong+core@0.18.2_@tsdown+css@0.21.5_@tsdown+exe@0.21.5_@type_bddbe1807a7ea96241d07b33ef15a1ae/node_modules/tsdown/dist/format-CzYq8yvJ.mjs
68
68
  const shimFile = path.resolve(import.meta.dirname, "..", "esm-shims.js");
69
69
  function getShimsInject(format, platform) {
70
70
  if (format === "es" && platform === "node") return {
@@ -72,7 +72,7 @@ function getShimsInject(format, platform) {
72
72
  __filename: [shimFile, "__filename"]
73
73
  };
74
74
  }
75
- const debug$6 = createDebug("tsdown:dep");
75
+ const debug$6 = createDebug("tsdown:deps");
76
76
  function resolveDepsConfig(config, logger) {
77
77
  let { neverBundle, alwaysBundle, onlyBundle, skipNodeModulesBundle = false } = config.deps || {};
78
78
  if (config.external != null) {
@@ -115,39 +115,34 @@ function resolveDepsConfig(config, logger) {
115
115
  skipNodeModulesBundle
116
116
  };
117
117
  }
118
- async function parseBundledDep(moduleId) {
119
- const slashed = slash(moduleId);
120
- const lastNmIdx = slashed.lastIndexOf("/node_modules/");
121
- if (lastNmIdx === -1) return;
122
- const parts = slashed.slice(lastNmIdx + 14).split("/");
123
- let name;
124
- if (parts[0][0] === "@") name = `${parts[0]}/${parts[1]}`;
125
- else name = parts[0];
126
- const root = slashed.slice(0, lastNmIdx + 14 + name.length);
127
- try {
128
- const json = JSON.parse(await readFile(path.join(root, "package.json"), "utf8"));
129
- return {
130
- name,
131
- pkgName: json.name,
132
- version: json.version
133
- };
134
- } catch {}
135
- }
136
- function DepPlugin({ pkg, deps: { alwaysBundle, onlyBundle, skipNodeModulesBundle }, logger, nameLabel }, tsdownBundle) {
118
+ function DepsPlugin({ pkg, deps: { alwaysBundle, onlyBundle, skipNodeModulesBundle }, logger, nameLabel }, tsdownBundle) {
137
119
  const deps = pkg && Array.from(getProductionDeps(pkg));
138
120
  return {
139
- name: "tsdown:external",
121
+ name: "tsdown:deps",
140
122
  resolveId: {
141
123
  filter: [include(and(id(/^[^.]/), importerId(/./)))],
142
124
  async handler(id, importer, extraOptions) {
143
125
  if (extraOptions.isEntry) return;
144
- const shouldExternal = await externalStrategy(this, id, importer, extraOptions);
145
- const nodeBuiltinModule = isBuiltin(id);
126
+ const resolved = await this.resolve(id, importer, {
127
+ ...extraOptions,
128
+ skipSelf: true
129
+ });
130
+ let shouldExternal = await externalStrategy(id, importer, resolved);
131
+ if (Array.isArray(shouldExternal)) {
132
+ debug$6("custom resolved id for %o -> %o", id, shouldExternal[1]);
133
+ id = shouldExternal[1];
134
+ shouldExternal = shouldExternal[0];
135
+ }
136
+ const moduleSideEffects = isBuiltin(id) ? false : void 0;
146
137
  debug$6("shouldExternal: %o = %o", id, shouldExternal);
147
138
  if (shouldExternal === true || shouldExternal === "absolute") return {
148
139
  id,
149
140
  external: shouldExternal,
150
- moduleSideEffects: nodeBuiltinModule ? false : void 0
141
+ moduleSideEffects
142
+ };
143
+ if (resolved) return {
144
+ ...resolved,
145
+ moduleSideEffects
151
146
  };
152
147
  }
153
148
  },
@@ -159,7 +154,7 @@ function DepPlugin({ pkg, deps: { alwaysBundle, onlyBundle, skipNodeModulesBundl
159
154
  for (const chunk of Object.values(bundle)) {
160
155
  if (chunk.type === "asset") continue;
161
156
  for (const id of chunk.moduleIds) {
162
- const parsed = await parseBundledDep(id);
157
+ const parsed = await readBundledDepInfo(id);
163
158
  if (!parsed) continue;
164
159
  deps.add(parsed.name);
165
160
  if (!tsdownBundle.inlinedDeps.has(parsed.pkgName)) tsdownBundle.inlinedDeps.set(parsed.pkgName, /* @__PURE__ */ new Set());
@@ -180,29 +175,87 @@ function DepPlugin({ pkg, deps: { alwaysBundle, onlyBundle, skipNodeModulesBundl
180
175
  };
181
176
  /**
182
177
  * - `true`: always external
178
+ * - `[true, resolvedId]`: external with custom resolved ID
183
179
  * - `false`: skip, let other plugins handle it
184
180
  * - `'absolute'`: external as absolute path
185
181
  * - `'no-external'`: skip, but mark as non-external for inlineOnly check
186
182
  */
187
- async function externalStrategy(context, id, importer, extraOptions) {
183
+ async function externalStrategy(id, importer, resolved) {
188
184
  if (id === shimFile) return false;
189
185
  if (alwaysBundle?.(id, importer)) return "no-external";
190
- if (skipNodeModulesBundle) {
191
- const resolved = await context.resolve(id, importer, extraOptions);
192
- if (resolved && (resolved.external || RE_NODE_MODULES$1.test(resolved.id))) return true;
193
- }
186
+ if (skipNodeModulesBundle && resolved && (resolved.external || RE_NODE_MODULES$1.test(resolved.id))) return true;
194
187
  if (deps) {
195
- if (deps.includes(id) || deps.some((dep) => id.startsWith(`${dep}/`))) return true;
188
+ if (deps.includes(id) || deps.some((dep) => id.startsWith(`${dep}/`))) {
189
+ const resolvedDep = await resolveDepSubpath(id, resolved);
190
+ return resolvedDep ? [true, resolvedDep] : true;
191
+ }
196
192
  if (importer && RE_DTS.test(importer) && !id.startsWith("@types/")) {
197
- const typesName = `@types/${id.replace(/^@/, "").replaceAll("/", "__")}`;
198
- if (deps.includes(typesName)) return true;
193
+ const typesName = getTypesPackageName(id);
194
+ if (typesName && deps.includes(typesName)) return true;
199
195
  }
200
196
  }
201
197
  return false;
202
198
  }
203
199
  }
200
+ function parsePackageSpecifier(id) {
201
+ const [first, second] = id.split("/", 3);
202
+ const name = first[0] === "@" && second ? `${first}/${second}` : first;
203
+ return [name, id.slice(name.length)];
204
+ }
205
+ const NODE_MODULES = "/node_modules/";
206
+ function parseNodeModulesPath(id) {
207
+ const slashed = slash(id);
208
+ const lastNmIdx = slashed.lastIndexOf(NODE_MODULES);
209
+ if (lastNmIdx === -1) return;
210
+ const [name, subpath] = parsePackageSpecifier(slashed.slice(lastNmIdx + 14));
211
+ return [
212
+ name,
213
+ subpath,
214
+ slashed.slice(0, lastNmIdx + 14 + name.length)
215
+ ];
216
+ }
217
+ async function readBundledDepInfo(moduleId) {
218
+ const parsed = parseNodeModulesPath(moduleId);
219
+ if (!parsed) return;
220
+ const [name, , root] = parsed;
221
+ try {
222
+ const json = JSON.parse(await readFile(path.join(root, "package.json"), "utf8"));
223
+ return {
224
+ name,
225
+ pkgName: json.name,
226
+ version: json.version
227
+ };
228
+ } catch {}
229
+ }
230
+ function getTypesPackageName(id) {
231
+ const name = parsePackageSpecifier(id)[0];
232
+ if (!name) return;
233
+ return `@types/${name.replace(/^@/, "").replace("/", "__")}`;
234
+ }
235
+ async function resolveDepSubpath(id, resolved) {
236
+ if (!resolved?.packageJsonPath) return;
237
+ const parts = id.split("/");
238
+ if (parts[0][0] === "@") parts.shift();
239
+ if (parts.length === 1 || parts.at(-1).includes(".")) return;
240
+ let pkgJson;
241
+ try {
242
+ pkgJson = JSON.parse(await readFile(resolved.packageJsonPath, "utf8"));
243
+ } catch {
244
+ return;
245
+ }
246
+ if (pkgJson.exports) return;
247
+ const parsed = parseNodeModulesPath(resolved.id);
248
+ if (!parsed) return;
249
+ const result = parsed[0] + parsed[1];
250
+ if (result === id) return;
251
+ return result;
252
+ }
204
253
  function getProductionDeps(pkg) {
205
- return new Set([...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.peerDependencies || {})]);
254
+ return new Set([
255
+ ...Object.keys(pkg.dependencies || {}),
256
+ ...Object.keys(pkg.peerDependencies || {}),
257
+ ...Object.keys(pkg.optionalDependencies || {})
258
+ ]);
206
259
  }
207
260
  function formatBytes(bytes) {
208
261
  if (bytes === Infinity) return void 0;
@@ -260,7 +313,7 @@ createDefu((object, key, currentValue) => {
260
313
  }
261
314
  });
262
315
  //#endregion
263
- //#region ../../node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.3/node_modules/fdir/dist/index.mjs
316
+ //#region ../../node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.4/node_modules/fdir/dist/index.mjs
264
317
  var __require$1 = /* @__PURE__ */ createRequire$1(import.meta.url);
265
318
  function cleanPath(path) {
266
319
  let normalized = normalize$1(path);
@@ -768,10 +821,11 @@ var Builder = class {
768
821
  }
769
822
  };
770
823
  //#endregion
771
- //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/constants.js
824
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js
772
825
  var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
773
826
  const WIN_SLASH = "\\\\/";
774
827
  const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
828
+ const DEFAULT_MAX_EXTGLOB_RECURSION = 0;
775
829
  /**
776
830
  * Posix glob regex
777
831
  */
@@ -821,8 +875,10 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
821
875
  SEP: "\\"
822
876
  };
823
877
  module.exports = {
878
+ DEFAULT_MAX_EXTGLOB_RECURSION,
824
879
  MAX_LENGTH: 1024 * 64,
825
880
  POSIX_REGEX_SOURCE: {
881
+ __proto__: null,
826
882
  alnum: "a-zA-Z0-9",
827
883
  alpha: "a-zA-Z",
828
884
  ascii: "\\x00-\\x7F",
@@ -928,7 +984,7 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
928
984
  };
929
985
  }));
930
986
  //#endregion
931
- //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/utils.js
987
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js
932
988
  var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
933
989
  const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants();
934
990
  exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
@@ -976,7 +1032,7 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
976
1032
  };
977
1033
  }));
978
1034
  //#endregion
979
- //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/scan.js
1035
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/scan.js
980
1036
  var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
981
1037
  const utils = require_utils();
982
1038
  const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = require_constants();
@@ -1263,7 +1319,7 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1263
1319
  module.exports = scan;
1264
1320
  }));
1265
1321
  //#endregion
1266
- //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/parse.js
1322
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/parse.js
1267
1323
  var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1268
1324
  const constants = require_constants();
1269
1325
  const utils = require_utils();
@@ -1291,6 +1347,177 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1291
1347
  const syntaxError = (type, char) => {
1292
1348
  return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
1293
1349
  };
1350
+ const splitTopLevel = (input) => {
1351
+ const parts = [];
1352
+ let bracket = 0;
1353
+ let paren = 0;
1354
+ let quote = 0;
1355
+ let value = "";
1356
+ let escaped = false;
1357
+ for (const ch of input) {
1358
+ if (escaped === true) {
1359
+ value += ch;
1360
+ escaped = false;
1361
+ continue;
1362
+ }
1363
+ if (ch === "\\") {
1364
+ value += ch;
1365
+ escaped = true;
1366
+ continue;
1367
+ }
1368
+ if (ch === "\"") {
1369
+ quote = quote === 1 ? 0 : 1;
1370
+ value += ch;
1371
+ continue;
1372
+ }
1373
+ if (quote === 0) {
1374
+ if (ch === "[") bracket++;
1375
+ else if (ch === "]" && bracket > 0) bracket--;
1376
+ else if (bracket === 0) {
1377
+ if (ch === "(") paren++;
1378
+ else if (ch === ")" && paren > 0) paren--;
1379
+ else if (ch === "|" && paren === 0) {
1380
+ parts.push(value);
1381
+ value = "";
1382
+ continue;
1383
+ }
1384
+ }
1385
+ }
1386
+ value += ch;
1387
+ }
1388
+ parts.push(value);
1389
+ return parts;
1390
+ };
1391
+ const isPlainBranch = (branch) => {
1392
+ let escaped = false;
1393
+ for (const ch of branch) {
1394
+ if (escaped === true) {
1395
+ escaped = false;
1396
+ continue;
1397
+ }
1398
+ if (ch === "\\") {
1399
+ escaped = true;
1400
+ continue;
1401
+ }
1402
+ if (/[?*+@!()[\]{}]/.test(ch)) return false;
1403
+ }
1404
+ return true;
1405
+ };
1406
+ const normalizeSimpleBranch = (branch) => {
1407
+ let value = branch.trim();
1408
+ let changed = true;
1409
+ while (changed === true) {
1410
+ changed = false;
1411
+ if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
1412
+ value = value.slice(2, -1);
1413
+ changed = true;
1414
+ }
1415
+ }
1416
+ if (!isPlainBranch(value)) return;
1417
+ return value.replace(/\\(.)/g, "$1");
1418
+ };
1419
+ const hasRepeatedCharPrefixOverlap = (branches) => {
1420
+ const values = branches.map(normalizeSimpleBranch).filter(Boolean);
1421
+ for (let i = 0; i < values.length; i++) for (let j = i + 1; j < values.length; j++) {
1422
+ const a = values[i];
1423
+ const b = values[j];
1424
+ const char = a[0];
1425
+ if (!char || a !== char.repeat(a.length) || b !== char.repeat(b.length)) continue;
1426
+ if (a === b || a.startsWith(b) || b.startsWith(a)) return true;
1427
+ }
1428
+ return false;
1429
+ };
1430
+ const parseRepeatedExtglob = (pattern, requireEnd = true) => {
1431
+ if (pattern[0] !== "+" && pattern[0] !== "*" || pattern[1] !== "(") return;
1432
+ let bracket = 0;
1433
+ let paren = 0;
1434
+ let quote = 0;
1435
+ let escaped = false;
1436
+ for (let i = 1; i < pattern.length; i++) {
1437
+ const ch = pattern[i];
1438
+ if (escaped === true) {
1439
+ escaped = false;
1440
+ continue;
1441
+ }
1442
+ if (ch === "\\") {
1443
+ escaped = true;
1444
+ continue;
1445
+ }
1446
+ if (ch === "\"") {
1447
+ quote = quote === 1 ? 0 : 1;
1448
+ continue;
1449
+ }
1450
+ if (quote === 1) continue;
1451
+ if (ch === "[") {
1452
+ bracket++;
1453
+ continue;
1454
+ }
1455
+ if (ch === "]" && bracket > 0) {
1456
+ bracket--;
1457
+ continue;
1458
+ }
1459
+ if (bracket > 0) continue;
1460
+ if (ch === "(") {
1461
+ paren++;
1462
+ continue;
1463
+ }
1464
+ if (ch === ")") {
1465
+ paren--;
1466
+ if (paren === 0) {
1467
+ if (requireEnd === true && i !== pattern.length - 1) return;
1468
+ return {
1469
+ type: pattern[0],
1470
+ body: pattern.slice(2, i),
1471
+ end: i
1472
+ };
1473
+ }
1474
+ }
1475
+ }
1476
+ };
1477
+ const getStarExtglobSequenceOutput = (pattern) => {
1478
+ let index = 0;
1479
+ const chars = [];
1480
+ while (index < pattern.length) {
1481
+ const match = parseRepeatedExtglob(pattern.slice(index), false);
1482
+ if (!match || match.type !== "*") return;
1483
+ const branches = splitTopLevel(match.body).map((branch) => branch.trim());
1484
+ if (branches.length !== 1) return;
1485
+ const branch = normalizeSimpleBranch(branches[0]);
1486
+ if (!branch || branch.length !== 1) return;
1487
+ chars.push(branch);
1488
+ index += match.end + 1;
1489
+ }
1490
+ if (chars.length < 1) return;
1491
+ return `${chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`}*`;
1492
+ };
1493
+ const repeatedExtglobRecursion = (pattern) => {
1494
+ let depth = 0;
1495
+ let value = pattern.trim();
1496
+ let match = parseRepeatedExtglob(value);
1497
+ while (match) {
1498
+ depth++;
1499
+ value = match.body.trim();
1500
+ match = parseRepeatedExtglob(value);
1501
+ }
1502
+ return depth;
1503
+ };
1504
+ const analyzeRepeatedExtglob = (body, options) => {
1505
+ if (options.maxExtglobRecursion === false) return { risky: false };
1506
+ const max = typeof options.maxExtglobRecursion === "number" ? options.maxExtglobRecursion : constants.DEFAULT_MAX_EXTGLOB_RECURSION;
1507
+ const branches = splitTopLevel(body).map((branch) => branch.trim());
1508
+ if (branches.length > 1) {
1509
+ if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) return { risky: true };
1510
+ }
1511
+ for (const branch of branches) {
1512
+ const safeOutput = getStarExtglobSequenceOutput(branch);
1513
+ if (safeOutput) return {
1514
+ risky: true,
1515
+ safeOutput
1516
+ };
1517
+ if (repeatedExtglobRecursion(branch) > max) return { risky: true };
1518
+ }
1519
+ return { risky: false };
1520
+ };
1294
1521
  /**
1295
1522
  * Parse the given input string.
1296
1523
  * @param {String} input
@@ -1420,6 +1647,8 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1420
1647
  token.prev = prev;
1421
1648
  token.parens = state.parens;
1422
1649
  token.output = state.output;
1650
+ token.startIndex = state.index;
1651
+ token.tokensIndex = tokens.length;
1423
1652
  const output = (opts.capture ? "(" : "") + token.open;
1424
1653
  increment("parens");
1425
1654
  push({
@@ -1436,6 +1665,30 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1436
1665
  extglobs.push(token);
1437
1666
  };
1438
1667
  const extglobClose = (token) => {
1668
+ const literal = input.slice(token.startIndex, state.index + 1);
1669
+ const analysis = analyzeRepeatedExtglob(input.slice(token.startIndex + 2, state.index), opts);
1670
+ if ((token.type === "plus" || token.type === "star") && analysis.risky) {
1671
+ const safeOutput = analysis.safeOutput ? (token.output ? "" : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : void 0;
1672
+ const open = tokens[token.tokensIndex];
1673
+ open.type = "text";
1674
+ open.value = literal;
1675
+ open.output = safeOutput || utils.escapeRegex(literal);
1676
+ for (let i = token.tokensIndex + 1; i < tokens.length; i++) {
1677
+ tokens[i].value = "";
1678
+ tokens[i].output = "";
1679
+ delete tokens[i].suffix;
1680
+ }
1681
+ state.output = token.output + open.output;
1682
+ state.backtrack = true;
1683
+ push({
1684
+ type: "paren",
1685
+ extglob: true,
1686
+ value,
1687
+ output: ""
1688
+ });
1689
+ decrement("parens");
1690
+ return;
1691
+ }
1439
1692
  let output = token.close + (opts.capture ? ")" : "");
1440
1693
  let rest;
1441
1694
  if (token.type === "negate") {
@@ -2121,7 +2374,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2121
2374
  module.exports = parse;
2122
2375
  }));
2123
2376
  //#endregion
2124
- //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/picomatch.js
2377
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/picomatch.js
2125
2378
  var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2126
2379
  const scan = require_scan();
2127
2380
  const parse = require_parse();
@@ -2331,6 +2584,14 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2331
2584
  * Compile a regular expression from the `state` object returned by the
2332
2585
  * [parse()](#parse) method.
2333
2586
  *
2587
+ * ```js
2588
+ * const picomatch = require('picomatch');
2589
+ * const state = picomatch.parse('*.js');
2590
+ * // picomatch.compileRe(state[, options]);
2591
+ *
2592
+ * console.log(picomatch.compileRe(state));
2593
+ * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
2594
+ * ```
2334
2595
  * @param {Object} `state`
2335
2596
  * @param {Object} `options`
2336
2597
  * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
@@ -2354,10 +2615,10 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2354
2615
  *
2355
2616
  * ```js
2356
2617
  * const picomatch = require('picomatch');
2357
- * const state = picomatch.parse('*.js');
2358
- * // picomatch.compileRe(state[, options]);
2618
+ * // picomatch.makeRe(state[, options]);
2359
2619
  *
2360
- * console.log(picomatch.compileRe(state));
2620
+ * const result = picomatch.makeRe('*.js');
2621
+ * console.log(result);
2361
2622
  * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
2362
2623
  * ```
2363
2624
  * @param {String} `state` The object returned from the `.parse` method.
@@ -2917,87 +3178,87 @@ quansync$1({
2917
3178
  */
2918
3179
  const quansync = quansync$1;
2919
3180
  quansync$1({
2920
- sync: re.readFileSync,
2921
- async: re.promises.readFile
3181
+ sync: fs$1.readFileSync,
3182
+ async: fs$1.promises.readFile
2922
3183
  });
2923
3184
  quansync$1({
2924
- sync: re.writeFileSync,
2925
- async: re.promises.writeFile
3185
+ sync: fs$1.writeFileSync,
3186
+ async: fs$1.promises.writeFile
2926
3187
  });
2927
3188
  quansync$1({
2928
- sync: re.unlinkSync,
2929
- async: re.promises.unlink
3189
+ sync: fs$1.unlinkSync,
3190
+ async: fs$1.promises.unlink
2930
3191
  });
2931
3192
  quansync$1({
2932
- sync: re.accessSync,
2933
- async: re.promises.access
3193
+ sync: fs$1.accessSync,
3194
+ async: fs$1.promises.access
2934
3195
  });
2935
3196
  /**
2936
3197
  * @link https://nodejs.org/api/fs.html#fspromisesstatpath-options
2937
3198
  */
2938
3199
  const stat$1 = quansync$1({
2939
- sync: re.statSync,
2940
- async: re.promises.stat
3200
+ sync: fs$1.statSync,
3201
+ async: fs$1.promises.stat
2941
3202
  });
2942
3203
  const lstat = quansync$1({
2943
- sync: re.lstatSync,
2944
- async: re.promises.lstat
3204
+ sync: fs$1.lstatSync,
3205
+ async: fs$1.promises.lstat
2945
3206
  });
2946
3207
  quansync$1({
2947
- sync: re.copyFileSync,
2948
- async: re.promises.copyFile
3208
+ sync: fs$1.copyFileSync,
3209
+ async: fs$1.promises.copyFile
2949
3210
  });
2950
3211
  quansync$1({
2951
- sync: re.rmSync,
2952
- async: re.promises.rm
3212
+ sync: fs$1.rmSync,
3213
+ async: fs$1.promises.rm
2953
3214
  });
2954
3215
  quansync$1({
2955
- sync: re.mkdirSync,
2956
- async: re.promises.mkdir
3216
+ sync: fs$1.mkdirSync,
3217
+ async: fs$1.promises.mkdir
2957
3218
  });
2958
3219
  quansync$1({
2959
- sync: re.renameSync,
2960
- async: re.promises.rename
3220
+ sync: fs$1.renameSync,
3221
+ async: fs$1.promises.rename
2961
3222
  });
2962
3223
  quansync$1({
2963
- sync: re.readdirSync,
2964
- async: re.promises.readdir
3224
+ sync: fs$1.readdirSync,
3225
+ async: fs$1.promises.readdir
2965
3226
  });
2966
3227
  quansync$1({
2967
- sync: re.realpathSync,
2968
- async: re.promises.realpath
3228
+ sync: fs$1.realpathSync,
3229
+ async: fs$1.promises.realpath
2969
3230
  });
2970
3231
  quansync$1({
2971
- sync: re.readlinkSync,
2972
- async: re.promises.readlink
3232
+ sync: fs$1.readlinkSync,
3233
+ async: fs$1.promises.readlink
2973
3234
  });
2974
3235
  quansync$1({
2975
- sync: re.symlinkSync,
2976
- async: re.promises.symlink
3236
+ sync: fs$1.symlinkSync,
3237
+ async: fs$1.promises.symlink
2977
3238
  });
2978
3239
  quansync$1({
2979
- sync: re.chownSync,
2980
- async: re.promises.chown
3240
+ sync: fs$1.chownSync,
3241
+ async: fs$1.promises.chown
2981
3242
  });
2982
3243
  quansync$1({
2983
- sync: re.lchownSync,
2984
- async: re.promises.lchown
3244
+ sync: fs$1.lchownSync,
3245
+ async: fs$1.promises.lchown
2985
3246
  });
2986
3247
  quansync$1({
2987
- sync: re.chmodSync,
2988
- async: re.promises.chmod
3248
+ sync: fs$1.chmodSync,
3249
+ async: fs$1.promises.chmod
2989
3250
  });
2990
3251
  quansync$1({
2991
- sync: re.utimesSync,
2992
- async: re.promises.utimes
3252
+ sync: fs$1.utimesSync,
3253
+ async: fs$1.promises.utimes
2993
3254
  });
2994
3255
  quansync$1({
2995
- sync: re.lutimesSync,
2996
- async: re.promises.lutimes
3256
+ sync: fs$1.lutimesSync,
3257
+ async: fs$1.promises.lutimes
2997
3258
  });
2998
3259
  quansync$1({
2999
- sync: re.mkdtempSync,
3000
- async: re.promises.mkdtemp
3260
+ sync: fs$1.mkdtempSync,
3261
+ async: fs$1.promises.mkdtemp
3001
3262
  });
3002
3263
  //#endregion
3003
3264
  //#region ../../node_modules/.pnpm/unconfig-core@7.5.0/node_modules/unconfig-core/dist/index.mjs
@@ -3076,7 +3337,7 @@ function createConfigCoreLoader(options) {
3076
3337
  };
3077
3338
  }
3078
3339
  //#endregion
3079
- //#region ../../node_modules/.pnpm/tsdown@0.21.4_@arethetypeswrong+core@0.18.2_@tsdown+css@0.21.4_@tsdown+exe@0.21.4_@type_f14dd4168fd2bd4ac31d1349e8200015/node_modules/tsdown/dist/options-DoRzOC0d.mjs
3340
+ //#region ../../node_modules/.pnpm/tsdown@0.21.5_@arethetypeswrong+core@0.18.2_@tsdown+css@0.21.5_@tsdown+exe@0.21.5_@type_bddbe1807a7ea96241d07b33ef15a1ae/node_modules/tsdown/dist/options-efTzQ_AE.mjs
3080
3341
  const __cjs_require$1 = createRequire(import.meta.url);
3081
3342
  const picomatch = __cjs_require$1("./npm_entry_picomatch.cjs");
3082
3343
  const satisfies$1 = __cjs_require$1("./npm_entry_semver_functions_satisfies.cjs");
@@ -3640,7 +3901,7 @@ async function nativeImport(id) {
3640
3901
  return mod.default || mod;
3641
3902
  }
3642
3903
  async function unrunImport(id) {
3643
- const { unrun } = await import("./dist-DUfkEqWP.js");
3904
+ const { unrun } = await import("./dist-BkOM3Vdg.js");
3644
3905
  const { module } = await unrun({ path: pathToFileURL(id).href });
3645
3906
  return module;
3646
3907
  }
@@ -3833,7 +4094,7 @@ function filterConfig(filter, configCwd, name) {
3833
4094
  return toArray(filter).some((value) => name && name === value || cwd === value);
3834
4095
  }
3835
4096
  //#endregion
3836
- //#region ../../node_modules/.pnpm/tsdown@0.21.4_@arethetypeswrong+core@0.18.2_@tsdown+css@0.21.4_@tsdown+exe@0.21.4_@type_f14dd4168fd2bd4ac31d1349e8200015/node_modules/tsdown/dist/watch-CS1xCZMR.mjs
4097
+ //#region ../../node_modules/.pnpm/tsdown@0.21.5_@arethetypeswrong+core@0.18.2_@tsdown+css@0.21.5_@tsdown+exe@0.21.5_@type_bddbe1807a7ea96241d07b33ef15a1ae/node_modules/tsdown/dist/watch-BywZdNr-.mjs
3837
4098
  async function copy(options) {
3838
4099
  if (!options.copy) return;
3839
4100
  const resolved = await resolveCopyEntries(options);
@@ -4213,7 +4474,7 @@ var Hookable = class {
4213
4474
  }
4214
4475
  };
4215
4476
  //#endregion
4216
- //#region ../../node_modules/.pnpm/tsdown@0.21.4_@arethetypeswrong+core@0.18.2_@tsdown+css@0.21.4_@tsdown+exe@0.21.4_@type_f14dd4168fd2bd4ac31d1349e8200015/node_modules/tsdown/dist/build-CoLhkNXE.mjs
4477
+ //#region ../../node_modules/.pnpm/tsdown@0.21.5_@arethetypeswrong+core@0.18.2_@tsdown+css@0.21.5_@tsdown+exe@0.21.5_@type_bddbe1807a7ea96241d07b33ef15a1ae/node_modules/tsdown/dist/build-DpU0PBVv.mjs
4217
4478
  const __cjs_require = createRequire(import.meta.url);
4218
4479
  const satisfies = __cjs_require("./npm_entry_semver_functions_satisfies.cjs");
4219
4480
  const coerce = __cjs_require("./npm_entry_semver_functions_coerce.cjs");
@@ -4506,7 +4767,7 @@ async function bundleDone(bundleByPkg, bundle) {
4506
4767
  async function packTarball(packageJsonPath) {
4507
4768
  const pkgDir = path.dirname(packageJsonPath);
4508
4769
  const destination = await mkdtemp(path.join(tmpdir(), "tsdown-pack-"));
4509
- const { detect } = await import("./detect-DN3DXXYt-XnCR4Kxo.js");
4770
+ const { detect } = await import("./detect-DN3DXXYt-GIMDNpE1.js");
4510
4771
  try {
4511
4772
  const detected = await detect({ cwd: pkgDir });
4512
4773
  if (detected?.name === "deno") throw new Error(`Cannot pack tarball for Deno projects at ${pkgDir}`);
@@ -4640,9 +4901,9 @@ async function resolveInputOptions(config, format, configFiles, bundle, cjsDts,
4640
4901
  const { alias, checks: { legacyCjs, ...checks } = {}, cjsDefault, cwd, deps: { neverBundle }, devtools, dts, entry, env, globImport, loader, logger, nameLabel, nodeProtocol, platform, plugins: userPlugins, report, shims, target, treeshake, tsconfig, unused, watch } = config;
4641
4902
  const plugins = [];
4642
4903
  if (nodeProtocol) plugins.push(NodeProtocolPlugin(nodeProtocol));
4643
- if (config.pkg || config.deps.skipNodeModulesBundle) plugins.push(DepPlugin(config, bundle));
4904
+ if (config.pkg || config.deps.skipNodeModulesBundle) plugins.push(DepsPlugin(config, bundle));
4644
4905
  if (dts) {
4645
- const { dts: dtsPlugin } = await import("./dist-CtF_Stv5.js");
4906
+ const { dts: dtsPlugin } = await import("./dist-dJp148cE.js");
4646
4907
  const options = {
4647
4908
  tsconfig,
4648
4909
  ...dts