@rolldown/browser 1.0.0-beta.14 → 1.0.0-beta.15

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/cli.cjs +2 -2
  2. package/dist/cli.mjs +2 -2
  3. package/dist/config.cjs +2 -2
  4. package/dist/config.d.cts +2 -2
  5. package/dist/config.d.mts +2 -2
  6. package/dist/config.mjs +2 -2
  7. package/dist/experimental-index.browser.mjs +3 -2
  8. package/dist/experimental-index.cjs +3 -2
  9. package/dist/experimental-index.d.cts +2 -2
  10. package/dist/experimental-index.d.mts +2 -2
  11. package/dist/experimental-index.mjs +4 -2
  12. package/dist/filter-index.d.cts +2 -2
  13. package/dist/filter-index.d.mts +2 -2
  14. package/dist/index.browser.mjs +1 -1
  15. package/dist/index.cjs +1 -1
  16. package/dist/index.d.cts +2 -2
  17. package/dist/index.d.mts +2 -2
  18. package/dist/index.mjs +1 -1
  19. package/dist/parallel-plugin-worker.cjs +1 -1
  20. package/dist/parallel-plugin-worker.mjs +1 -1
  21. package/dist/parallel-plugin.d.cts +2 -2
  22. package/dist/parallel-plugin.d.mts +2 -2
  23. package/dist/parse-ast-index.d.cts +1 -1
  24. package/dist/parse-ast-index.d.mts +1 -1
  25. package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
  26. package/dist/shared/{binding-B4cY4d9y.d.mts → binding-CZdobbZA.d.cts} +13 -2
  27. package/dist/shared/{binding-By50amn5.d.cts → binding-Dze8QVpf.d.mts} +13 -2
  28. package/dist/shared/{define-config-CTbU8qen.d.mts → define-config-BE-fkZNW.d.cts} +3 -2
  29. package/dist/shared/{define-config-DpEXoypA.d.cts → define-config-CnVvtpOm.d.mts} +3 -2
  30. package/dist/shared/{load-config-C0_-rrb-.mjs → load-config-CmZwBnZf.mjs} +1 -1
  31. package/dist/shared/{load-config-BL7e2rjR.cjs → load-config-DlY_Bz-0.cjs} +1 -1
  32. package/dist/shared/{src-DnKb-KyP.cjs → src-CYvvndv2.cjs} +27 -6
  33. package/dist/shared/{src-DedSB68M.mjs → src-Do34b1Pc.mjs} +23 -7
  34. package/dist/{src-CFRFoSBR.js → src-B1yRSHcw.js} +498 -30
  35. package/package.json +1 -1
@@ -1,5 +1,4 @@
1
1
  import { BindingCallableBuiltinPlugin, BindingHookSideEffects, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingWatcher, Bundler, parseSync, shutdownAsyncRuntime, startAsyncRuntime } from "./rolldown-binding.wasi-browser.js";
2
- import path from "node:path";
3
2
 
4
3
  //#region rolldown:runtime
5
4
  var __create = Object.create;
@@ -28,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
27
 
29
28
  //#endregion
30
29
  //#region package.json
31
- var version = "1.0.0-beta.14";
30
+ var version = "1.0.0-beta.15";
32
31
 
33
32
  //#endregion
34
33
  //#region src/builtin-plugin/utils.ts
@@ -55,8 +54,8 @@ var BuiltinPlugin = class {
55
54
  this._options = _options;
56
55
  }
57
56
  };
58
- function modulePreloadPolyfillPlugin() {
59
- return new BuiltinPlugin("builtin:module-preload-polyfill");
57
+ function modulePreloadPolyfillPlugin(config) {
58
+ return new BuiltinPlugin("builtin:module-preload-polyfill", config);
60
59
  }
61
60
  function dynamicImportVarsPlugin(config) {
62
61
  return new BuiltinPlugin("builtin:dynamic-import-vars", config);
@@ -81,7 +80,8 @@ function loadFallbackPlugin() {
81
80
  return new BuiltinPlugin("builtin:load-fallback");
82
81
  }
83
82
  function jsonPlugin(config) {
84
- return new BuiltinPlugin("builtin:json", config);
83
+ const builtinPlugin = new BuiltinPlugin("builtin:json", config);
84
+ return makeBuiltinPluginCallable(builtinPlugin);
85
85
  }
86
86
  function buildImportAnalysisPlugin(config) {
87
87
  return new BuiltinPlugin("builtin:build-import-analysis", config);
@@ -121,6 +121,460 @@ function webWorkerPostPlugin() {
121
121
  return new BuiltinPlugin("builtin:web-worker-post");
122
122
  }
123
123
 
124
+ //#endregion
125
+ //#region ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
126
+ let _lazyMatch = () => {
127
+ var __lib__ = (() => {
128
+ var m$1 = Object.defineProperty, V = Object.getOwnPropertyDescriptor, G = Object.getOwnPropertyNames, T = Object.prototype.hasOwnProperty, q = (r$1, e$1) => {
129
+ for (var n$1 in e$1) m$1(r$1, n$1, {
130
+ get: e$1[n$1],
131
+ enumerable: true
132
+ });
133
+ }, H = (r$1, e$1, n$1, a$2) => {
134
+ if (e$1 && typeof e$1 == "object" || typeof e$1 == "function") for (let t$2 of G(e$1)) !T.call(r$1, t$2) && t$2 !== n$1 && m$1(r$1, t$2, {
135
+ get: () => e$1[t$2],
136
+ enumerable: !(a$2 = V(e$1, t$2)) || a$2.enumerable
137
+ });
138
+ return r$1;
139
+ }, J = (r$1) => H(m$1({}, "__esModule", { value: true }), r$1), w$1 = {};
140
+ q(w$1, { default: () => re });
141
+ var A = (r$1) => Array.isArray(r$1), d$2 = (r$1) => typeof r$1 == "function", Q = (r$1) => r$1.length === 0, W = (r$1) => typeof r$1 == "number", K = (r$1) => typeof r$1 == "object" && r$1 !== null, X = (r$1) => r$1 instanceof RegExp, b$1 = (r$1) => typeof r$1 == "string", h$1 = (r$1) => r$1 === void 0, Y = (r$1) => {
142
+ const e$1 = /* @__PURE__ */ new Map();
143
+ return (n$1) => {
144
+ const a$2 = e$1.get(n$1);
145
+ if (a$2) return a$2;
146
+ const t$2 = r$1(n$1);
147
+ return e$1.set(n$1, t$2), t$2;
148
+ };
149
+ }, rr = (r$1, e$1, n$1 = {}) => {
150
+ const a$2 = {
151
+ cache: {},
152
+ input: r$1,
153
+ index: 0,
154
+ indexMax: 0,
155
+ options: n$1,
156
+ output: []
157
+ };
158
+ if (v(e$1)(a$2) && a$2.index === r$1.length) return a$2.output;
159
+ throw new Error(`Failed to parse at index ${a$2.indexMax}`);
160
+ }, i$2 = (r$1, e$1) => A(r$1) ? er(r$1, e$1) : b$1(r$1) ? ar(r$1, e$1) : nr(r$1, e$1), er = (r$1, e$1) => {
161
+ const n$1 = {};
162
+ for (const a$2 of r$1) {
163
+ if (a$2.length !== 1) throw new Error(`Invalid character: "${a$2}"`);
164
+ const t$2 = a$2.charCodeAt(0);
165
+ n$1[t$2] = true;
166
+ }
167
+ return (a$2) => {
168
+ const t$2 = a$2.index, o$1 = a$2.input;
169
+ for (; a$2.index < o$1.length && o$1.charCodeAt(a$2.index) in n$1;) a$2.index += 1;
170
+ const u$3 = a$2.index;
171
+ if (u$3 > t$2) {
172
+ if (!h$1(e$1) && !a$2.options.silent) {
173
+ const s$1 = a$2.input.slice(t$2, u$3), c$1 = d$2(e$1) ? e$1(s$1, o$1, String(t$2)) : e$1;
174
+ h$1(c$1) || a$2.output.push(c$1);
175
+ }
176
+ a$2.indexMax = Math.max(a$2.indexMax, a$2.index);
177
+ }
178
+ return true;
179
+ };
180
+ }, nr = (r$1, e$1) => {
181
+ const n$1 = r$1.source, a$2 = r$1.flags.replace(/y|$/, "y"), t$2 = new RegExp(n$1, a$2);
182
+ return g$1((o$1) => {
183
+ t$2.lastIndex = o$1.index;
184
+ const u$3 = t$2.exec(o$1.input);
185
+ if (u$3) {
186
+ if (!h$1(e$1) && !o$1.options.silent) {
187
+ const s$1 = d$2(e$1) ? e$1(...u$3, o$1.input, String(o$1.index)) : e$1;
188
+ h$1(s$1) || o$1.output.push(s$1);
189
+ }
190
+ return o$1.index += u$3[0].length, o$1.indexMax = Math.max(o$1.indexMax, o$1.index), true;
191
+ } else return false;
192
+ });
193
+ }, ar = (r$1, e$1) => (n$1) => {
194
+ if (n$1.input.startsWith(r$1, n$1.index)) {
195
+ if (!h$1(e$1) && !n$1.options.silent) {
196
+ const t$2 = d$2(e$1) ? e$1(r$1, n$1.input, String(n$1.index)) : e$1;
197
+ h$1(t$2) || n$1.output.push(t$2);
198
+ }
199
+ return n$1.index += r$1.length, n$1.indexMax = Math.max(n$1.indexMax, n$1.index), true;
200
+ } else return false;
201
+ }, C = (r$1, e$1, n$1, a$2) => {
202
+ const t$2 = v(r$1);
203
+ return g$1(_(M((o$1) => {
204
+ let u$3 = 0;
205
+ for (; u$3 < n$1;) {
206
+ const s$1 = o$1.index;
207
+ if (!t$2(o$1) || (u$3 += 1, o$1.index === s$1)) break;
208
+ }
209
+ return u$3 >= e$1;
210
+ })));
211
+ }, tr = (r$1, e$1) => C(r$1, 0, 1), f$1 = (r$1, e$1) => C(r$1, 0, Infinity), x = (r$1, e$1) => {
212
+ const n$1 = r$1.map(v);
213
+ return g$1(_(M((a$2) => {
214
+ for (let t$2 = 0, o$1 = n$1.length; t$2 < o$1; t$2++) if (!n$1[t$2](a$2)) return false;
215
+ return true;
216
+ })));
217
+ }, l$1 = (r$1, e$1) => {
218
+ const n$1 = r$1.map(v);
219
+ return g$1(_((a$2) => {
220
+ for (let t$2 = 0, o$1 = n$1.length; t$2 < o$1; t$2++) if (n$1[t$2](a$2)) return true;
221
+ return false;
222
+ }));
223
+ }, M = (r$1, e$1 = false) => {
224
+ const n$1 = v(r$1);
225
+ return (a$2) => {
226
+ const t$2 = a$2.index, o$1 = a$2.output.length, u$3 = n$1(a$2);
227
+ return (!u$3 || e$1) && (a$2.index = t$2, a$2.output.length !== o$1 && (a$2.output.length = o$1)), u$3;
228
+ };
229
+ }, _ = (r$1, e$1) => {
230
+ const n$1 = v(r$1);
231
+ return n$1;
232
+ }, g$1 = (() => {
233
+ let r$1 = 0;
234
+ return (e$1) => {
235
+ const n$1 = v(e$1), a$2 = r$1 += 1;
236
+ return (t$2) => {
237
+ var o$1;
238
+ if (t$2.options.memoization === false) return n$1(t$2);
239
+ const u$3 = t$2.index, s$1 = (o$1 = t$2.cache)[a$2] || (o$1[a$2] = /* @__PURE__ */ new Map()), c$1 = s$1.get(u$3);
240
+ if (c$1 === false) return false;
241
+ if (W(c$1)) return t$2.index = c$1, true;
242
+ if (c$1) return t$2.index = c$1.index, c$1.output?.length && t$2.output.push(...c$1.output), true;
243
+ {
244
+ const Z = t$2.output.length;
245
+ if (n$1(t$2)) {
246
+ const D = t$2.index, U = t$2.output.length;
247
+ if (U > Z) {
248
+ const ee = t$2.output.slice(Z, U);
249
+ s$1.set(u$3, {
250
+ index: D,
251
+ output: ee
252
+ });
253
+ } else s$1.set(u$3, D);
254
+ return true;
255
+ } else return s$1.set(u$3, false), false;
256
+ }
257
+ };
258
+ };
259
+ })(), E = (r$1) => {
260
+ let e$1;
261
+ return (n$1) => (e$1 || (e$1 = v(r$1())), e$1(n$1));
262
+ }, v = Y((r$1) => {
263
+ if (d$2(r$1)) return Q(r$1) ? E(r$1) : r$1;
264
+ if (b$1(r$1) || X(r$1)) return i$2(r$1);
265
+ if (A(r$1)) return x(r$1);
266
+ if (K(r$1)) return l$1(Object.values(r$1));
267
+ throw new Error("Invalid rule");
268
+ }), P = "abcdefghijklmnopqrstuvwxyz", ir = (r$1) => {
269
+ let e$1 = "";
270
+ for (; r$1 > 0;) {
271
+ const n$1 = (r$1 - 1) % 26;
272
+ e$1 = P[n$1] + e$1, r$1 = Math.floor((r$1 - 1) / 26);
273
+ }
274
+ return e$1;
275
+ }, O$1 = (r$1) => {
276
+ let e$1 = 0;
277
+ for (let n$1 = 0, a$2 = r$1.length; n$1 < a$2; n$1++) e$1 = e$1 * 26 + P.indexOf(r$1[n$1]) + 1;
278
+ return e$1;
279
+ }, S = (r$1, e$1) => {
280
+ if (e$1 < r$1) return S(e$1, r$1);
281
+ const n$1 = [];
282
+ for (; r$1 <= e$1;) n$1.push(r$1++);
283
+ return n$1;
284
+ }, or$1 = (r$1, e$1, n$1) => S(r$1, e$1).map((a$2) => String(a$2).padStart(n$1, "0")), R = (r$1, e$1) => S(O$1(r$1), O$1(e$1)).map(ir), p$1 = (r$1) => r$1, z = (r$1) => ur((e$1) => rr(e$1, r$1, { memoization: false }).join("")), ur = (r$1) => {
285
+ const e$1 = {};
286
+ return (n$1) => e$1[n$1] ?? (e$1[n$1] = r$1(n$1));
287
+ }, sr = i$2(/^\*\*\/\*$/, ".*"), cr = i$2(/^\*\*\/(\*)?([ a-zA-Z0-9._-]+)$/, (r$1, e$1, n$1) => `.*${e$1 ? "" : "(?:^|/)"}${n$1.replaceAll(".", "\\.")}`), lr = i$2(/^\*\*\/(\*)?([ a-zA-Z0-9._-]*)\{([ a-zA-Z0-9._-]+(?:,[ a-zA-Z0-9._-]+)*)\}$/, (r$1, e$1, n$1, a$2) => `.*${e$1 ? "" : "(?:^|/)"}${n$1.replaceAll(".", "\\.")}(?:${a$2.replaceAll(",", "|").replaceAll(".", "\\.")})`), y$1 = i$2(/\\./, p$1), pr = i$2(/[$.*+?^(){}[\]\|]/, (r$1) => `\\${r$1}`), vr = i$2(/./, p$1), hr = i$2(/^(?:!!)*!(.*)$/, (r$1, e$1) => `(?!^${L(e$1)}$).*?`), dr = i$2(/^(!!)+/, ""), fr = l$1([hr, dr]), xr = i$2(/\/(\*\*\/)+/, "(?:/.+/|/)"), gr = i$2(/^(\*\*\/)+/, "(?:^|.*/)"), mr = i$2(/\/(\*\*)$/, "(?:/.*|$)"), _r = i$2(/\*\*/, ".*"), j = l$1([
288
+ xr,
289
+ gr,
290
+ mr,
291
+ _r
292
+ ]), Sr = i$2(/\*\/(?!\*\*\/)/, "[^/]*/"), yr = i$2(/\*/, "[^/]*"), N = l$1([Sr, yr]), k = i$2("?", "[^/]"), $r = i$2("[", p$1), wr = i$2("]", p$1), Ar = i$2(/[!^]/, "^/"), br = i$2(/[a-z]-[a-z]|[0-9]-[0-9]/i, p$1), Cr = i$2(/[$.*+?^(){}[\|]/, (r$1) => `\\${r$1}`), Mr = i$2(/[^\]]/, p$1), Er = l$1([
293
+ y$1,
294
+ Cr,
295
+ br,
296
+ Mr
297
+ ]), B = x([
298
+ $r,
299
+ tr(Ar),
300
+ f$1(Er),
301
+ wr
302
+ ]), Pr = i$2("{", "(?:"), Or$1 = i$2("}", ")"), Rr = i$2(/(\d+)\.\.(\d+)/, (r$1, e$1, n$1) => or$1(+e$1, +n$1, Math.min(e$1.length, n$1.length)).join("|")), zr = i$2(/([a-z]+)\.\.([a-z]+)/, (r$1, e$1, n$1) => R(e$1, n$1).join("|")), jr = i$2(/([A-Z]+)\.\.([A-Z]+)/, (r$1, e$1, n$1) => R(e$1.toLowerCase(), n$1.toLowerCase()).join("|").toUpperCase()), Nr = l$1([
303
+ Rr,
304
+ zr,
305
+ jr
306
+ ]), I = x([
307
+ Pr,
308
+ Nr,
309
+ Or$1
310
+ ]), kr = i$2("{", "(?:"), Br = i$2("}", ")"), Ir = i$2(",", "|"), Fr = i$2(/[$.*+?^(){[\]\|]/, (r$1) => `\\${r$1}`), Lr = i$2(/[^}]/, p$1), Zr = E(() => F), Dr = l$1([
311
+ j,
312
+ N,
313
+ k,
314
+ B,
315
+ I,
316
+ Zr,
317
+ y$1,
318
+ Fr,
319
+ Ir,
320
+ Lr
321
+ ]), F = x([
322
+ kr,
323
+ f$1(Dr),
324
+ Br
325
+ ]), Ur = f$1(l$1([
326
+ sr,
327
+ cr,
328
+ lr,
329
+ fr,
330
+ j,
331
+ N,
332
+ k,
333
+ B,
334
+ I,
335
+ F,
336
+ y$1,
337
+ pr,
338
+ vr
339
+ ])), Vr = Ur, Gr = z(Vr), L = Gr, Tr = i$2(/\\./, p$1), qr = i$2(/./, p$1), Hr = i$2(/\*\*\*+/, "*"), Jr = i$2(/([^/{[(!])\*\*/, (r$1, e$1) => `${e$1}*`), Qr = i$2(/(^|.)\*\*(?=[^*/)\]}])/, (r$1, e$1) => `${e$1}*`), Wr = f$1(l$1([
340
+ Tr,
341
+ Hr,
342
+ Jr,
343
+ Qr,
344
+ qr
345
+ ])), Kr = Wr, Xr = z(Kr), Yr = Xr, $ = (r$1, e$1) => {
346
+ const n$1 = Array.isArray(r$1) ? r$1 : [r$1];
347
+ if (!n$1.length) return false;
348
+ const a$2 = n$1.map($.compile), t$2 = n$1.every((s$1) => /(\/(?:\*\*)?|\[\/\])$/.test(s$1)), o$1 = e$1.replace(/[\\\/]+/g, "/").replace(/\/$/, t$2 ? "/" : "");
349
+ return a$2.some((s$1) => s$1.test(o$1));
350
+ };
351
+ $.compile = (r$1) => new RegExp(`^${L(Yr(r$1))}$`, "s");
352
+ var re = $;
353
+ return J(w$1);
354
+ })();
355
+ return __lib__.default || __lib__;
356
+ };
357
+ let _match;
358
+ const zeptomatch = (path, pattern) => {
359
+ if (!_match) {
360
+ _match = _lazyMatch();
361
+ _lazyMatch = null;
362
+ }
363
+ return _match(path, pattern);
364
+ };
365
+ const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
366
+ function normalizeWindowsPath(input = "") {
367
+ if (!input) return input;
368
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r$1) => r$1.toUpperCase());
369
+ }
370
+ const _UNC_REGEX = /^[/\\]{2}/;
371
+ const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
372
+ const _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
373
+ const _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
374
+ const _EXTNAME_RE = /.(\.[^./]+|\.)$/;
375
+ const _PATH_ROOT_RE = /^[/\\]|^[a-zA-Z]:[/\\]/;
376
+ const sep = "/";
377
+ const normalize = function(path) {
378
+ if (path.length === 0) return ".";
379
+ path = normalizeWindowsPath(path);
380
+ const isUNCPath = path.match(_UNC_REGEX);
381
+ const isPathAbsolute = isAbsolute(path);
382
+ const trailingSeparator = path[path.length - 1] === "/";
383
+ path = normalizeString(path, !isPathAbsolute);
384
+ if (path.length === 0) {
385
+ if (isPathAbsolute) return "/";
386
+ return trailingSeparator ? "./" : ".";
387
+ }
388
+ if (trailingSeparator) path += "/";
389
+ if (_DRIVE_LETTER_RE.test(path)) path += "/";
390
+ if (isUNCPath) {
391
+ if (!isPathAbsolute) return `//./${path}`;
392
+ return `//${path}`;
393
+ }
394
+ return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
395
+ };
396
+ const join = function(...segments) {
397
+ let path = "";
398
+ for (const seg of segments) {
399
+ if (!seg) continue;
400
+ if (path.length > 0) {
401
+ const pathTrailing = path[path.length - 1] === "/";
402
+ const segLeading = seg[0] === "/";
403
+ const both = pathTrailing && segLeading;
404
+ if (both) path += seg.slice(1);
405
+ else path += pathTrailing || segLeading ? seg : `/${seg}`;
406
+ } else path += seg;
407
+ }
408
+ return normalize(path);
409
+ };
410
+ function cwd() {
411
+ if (typeof process !== "undefined" && typeof process.cwd === "function") return process.cwd().replace(/\\/g, "/");
412
+ return "/";
413
+ }
414
+ const resolve = function(...arguments_) {
415
+ arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
416
+ let resolvedPath = "";
417
+ let resolvedAbsolute = false;
418
+ for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
419
+ const path = index >= 0 ? arguments_[index] : cwd();
420
+ if (!path || path.length === 0) continue;
421
+ resolvedPath = `${path}/${resolvedPath}`;
422
+ resolvedAbsolute = isAbsolute(path);
423
+ }
424
+ resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
425
+ if (resolvedAbsolute && !isAbsolute(resolvedPath)) return `/${resolvedPath}`;
426
+ return resolvedPath.length > 0 ? resolvedPath : ".";
427
+ };
428
+ function normalizeString(path, allowAboveRoot) {
429
+ let res = "";
430
+ let lastSegmentLength = 0;
431
+ let lastSlash = -1;
432
+ let dots = 0;
433
+ let char = null;
434
+ for (let index = 0; index <= path.length; ++index) {
435
+ if (index < path.length) char = path[index];
436
+ else if (char === "/") break;
437
+ else char = "/";
438
+ if (char === "/") {
439
+ if (lastSlash === index - 1 || dots === 1);
440
+ else if (dots === 2) {
441
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
442
+ if (res.length > 2) {
443
+ const lastSlashIndex = res.lastIndexOf("/");
444
+ if (lastSlashIndex === -1) {
445
+ res = "";
446
+ lastSegmentLength = 0;
447
+ } else {
448
+ res = res.slice(0, lastSlashIndex);
449
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
450
+ }
451
+ lastSlash = index;
452
+ dots = 0;
453
+ continue;
454
+ } else if (res.length > 0) {
455
+ res = "";
456
+ lastSegmentLength = 0;
457
+ lastSlash = index;
458
+ dots = 0;
459
+ continue;
460
+ }
461
+ }
462
+ if (allowAboveRoot) {
463
+ res += res.length > 0 ? "/.." : "..";
464
+ lastSegmentLength = 2;
465
+ }
466
+ } else {
467
+ if (res.length > 0) res += `/${path.slice(lastSlash + 1, index)}`;
468
+ else res = path.slice(lastSlash + 1, index);
469
+ lastSegmentLength = index - lastSlash - 1;
470
+ }
471
+ lastSlash = index;
472
+ dots = 0;
473
+ } else if (char === "." && dots !== -1) ++dots;
474
+ else dots = -1;
475
+ }
476
+ return res;
477
+ }
478
+ const isAbsolute = function(p$1) {
479
+ return _IS_ABSOLUTE_RE.test(p$1);
480
+ };
481
+ const toNamespacedPath = function(p$1) {
482
+ return normalizeWindowsPath(p$1);
483
+ };
484
+ const extname = function(p$1) {
485
+ if (p$1 === "..") return "";
486
+ const match = _EXTNAME_RE.exec(normalizeWindowsPath(p$1));
487
+ return match && match[1] || "";
488
+ };
489
+ const relative = function(from, to) {
490
+ const _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
491
+ const _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
492
+ if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) return _to.join("/");
493
+ const _fromCopy = [..._from];
494
+ for (const segment of _fromCopy) {
495
+ if (_to[0] !== segment) break;
496
+ _from.shift();
497
+ _to.shift();
498
+ }
499
+ return [..._from.map(() => ".."), ..._to].join("/");
500
+ };
501
+ const dirname = function(p$1) {
502
+ const segments = normalizeWindowsPath(p$1).replace(/\/$/, "").split("/").slice(0, -1);
503
+ if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) segments[0] += "/";
504
+ return segments.join("/") || (isAbsolute(p$1) ? "/" : ".");
505
+ };
506
+ const format = function(p$1) {
507
+ const ext = p$1.ext ? p$1.ext.startsWith(".") ? p$1.ext : `.${p$1.ext}` : "";
508
+ const segments = [
509
+ p$1.root,
510
+ p$1.dir,
511
+ p$1.base ?? (p$1.name ?? "") + ext
512
+ ].filter(Boolean);
513
+ return normalizeWindowsPath(p$1.root ? resolve(...segments) : segments.join("/"));
514
+ };
515
+ const basename = function(p$1, extension) {
516
+ const segments = normalizeWindowsPath(p$1).split("/");
517
+ let lastSegment = "";
518
+ for (let i$2 = segments.length - 1; i$2 >= 0; i$2--) {
519
+ const val = segments[i$2];
520
+ if (val) {
521
+ lastSegment = val;
522
+ break;
523
+ }
524
+ }
525
+ return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
526
+ };
527
+ const parse = function(p$1) {
528
+ const root = _PATH_ROOT_RE.exec(p$1)?.[0]?.replace(/\\/g, "/") || "";
529
+ const base = basename(p$1);
530
+ const extension = extname(base);
531
+ return {
532
+ root,
533
+ dir: dirname(p$1),
534
+ base,
535
+ ext: extension,
536
+ name: base.slice(0, base.length - extension.length)
537
+ };
538
+ };
539
+ const matchesGlob = (path, pattern) => {
540
+ return zeptomatch(pattern, normalize(path));
541
+ };
542
+ const _path = {
543
+ __proto__: null,
544
+ basename,
545
+ dirname,
546
+ extname,
547
+ format,
548
+ isAbsolute,
549
+ join,
550
+ matchesGlob,
551
+ normalize,
552
+ normalizeString,
553
+ parse,
554
+ relative,
555
+ resolve,
556
+ sep,
557
+ toNamespacedPath
558
+ };
559
+
560
+ //#endregion
561
+ //#region ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/index.mjs
562
+ const delimiter = /* @__PURE__ */ (() => globalThis.process?.platform === "win32" ? ";" : ":")();
563
+ const _platforms = {
564
+ posix: void 0,
565
+ win32: void 0
566
+ };
567
+ const mix = (del = delimiter) => {
568
+ return new Proxy(_path, { get(_, prop) {
569
+ if (prop === "delimiter") return del;
570
+ if (prop === "posix") return posix;
571
+ if (prop === "win32") return win32;
572
+ return _platforms[prop] || _path[prop];
573
+ } });
574
+ };
575
+ const posix = /* @__PURE__ */ mix(":");
576
+ const win32 = /* @__PURE__ */ mix(";");
577
+
124
578
  //#endregion
125
579
  //#region src/utils/misc.ts
126
580
  function arraify(value) {
@@ -423,8 +877,8 @@ const getExtendedLogMessage = (log) => {
423
877
  return prefix + log.message;
424
878
  };
425
879
  function relativeId(id$1) {
426
- if (!path.isAbsolute(id$1)) return id$1;
427
- return path.relative(path.resolve(), id$1);
880
+ if (!posix.isAbsolute(id$1)) return id$1;
881
+ return posix.relative(posix.resolve(), id$1);
428
882
  }
429
883
 
430
884
  //#endregion
@@ -2082,12 +2536,12 @@ function validateOption(key, options) {
2082
2536
  let parsed = safeParse(key === "input" ? InputOptionsSchema : OutputOptionsSchema, options);
2083
2537
  if (!parsed.success) {
2084
2538
  const errors = parsed.issues.map((issue) => {
2085
- const issuePaths = issue.path.map((path$1) => path$1.key);
2539
+ const issuePaths = issue.path.map((path) => path.key);
2086
2540
  let issueMsg = issue.message;
2087
2541
  if (issue.type === "union") {
2088
2542
  const subIssue = issue.issues?.find((i$2) => !(i$2.type !== issue.received && i$2.input === issue.input));
2089
2543
  if (subIssue) {
2090
- if (subIssue.path) issuePaths.push(subIssue.path.map((path$1) => path$1.key));
2544
+ if (subIssue.path) issuePaths.push(subIssue.path.map((path) => path.key));
2091
2545
  issueMsg = subIssue.message;
2092
2546
  }
2093
2547
  }
@@ -2630,8 +3084,8 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
2630
3084
  async function createLoadModulePromise(context, data) {
2631
3085
  const loadPromise = data.loadModulePromiseMap.get(id$1);
2632
3086
  if (loadPromise) return loadPromise;
2633
- const promise$1 = new Promise((resolve, _) => {
2634
- data.loadModulePromiseResolveFnMap.set(id$1, resolve);
3087
+ const promise$1 = new Promise((resolve$1, _) => {
3088
+ data.loadModulePromiseResolveFnMap.set(id$1, resolve$1);
2635
3089
  });
2636
3090
  data.loadModulePromiseMap.set(id$1, promise$1);
2637
3091
  try {
@@ -2664,7 +3118,10 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
2664
3118
  }
2665
3119
  emitFile = (file) => {
2666
3120
  if (file.type === "prebuilt-chunk") return unimplemented("PluginContext.emitFile with type prebuilt-chunk");
2667
- if (file.type === "chunk") return this.context.emitChunk(file);
3121
+ if (file.type === "chunk") return this.context.emitChunk({
3122
+ preserveEntrySignatures: bindingifyPreserveEntrySignatures(file.preserveSignature),
3123
+ ...file
3124
+ });
2668
3125
  const fnSanitizedFileName = file.fileName || typeof this.outputOptions.sanitizeFileName !== "function" ? void 0 : this.outputOptions.sanitizeFileName(file.name || "asset");
2669
3126
  const filename = file.fileName ? void 0 : this.getAssetFileNames(file);
2670
3127
  return this.context.emitFile({
@@ -2872,9 +3329,9 @@ function preProcessSourceMap(ret, id$1) {
2872
3329
  if (!ret.map) return;
2873
3330
  let map = typeof ret.map === "object" ? ret.map : JSON.parse(ret.map);
2874
3331
  if (!isEmptySourcemapFiled(map.sources)) {
2875
- const directory = path.dirname(id$1) || ".";
3332
+ const directory = posix.dirname(id$1) || ".";
2876
3333
  const sourceRoot = map.sourceRoot || ".";
2877
- map.sources = map.sources.map((source) => path.resolve(directory, sourceRoot, source));
3334
+ map.sources = map.sources.map((source) => posix.resolve(directory, sourceRoot, source));
2878
3335
  }
2879
3336
  return map;
2880
3337
  }
@@ -2958,11 +3415,11 @@ function transformChunkModules(modules) {
2958
3415
  //#endregion
2959
3416
  //#region src/utils/bindingify-output-options.ts
2960
3417
  function bindingifyOutputOptions(outputOptions) {
2961
- const { dir, format, exports, hashCharacters, sourcemap, sourcemapDebugIds, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, cssEntryFileNames, cssChunkFileNames, banner, footer, intro, outro, esModule, globals, file, sanitizeFileName, preserveModules, virtualDirname, legalComments, preserveModulesRoot } = outputOptions;
3418
+ const { dir, format: format$1, exports, hashCharacters, sourcemap, sourcemapDebugIds, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, cssEntryFileNames, cssChunkFileNames, banner, footer, intro, outro, esModule, globals, file, sanitizeFileName, preserveModules, virtualDirname, legalComments, preserveModulesRoot } = outputOptions;
2962
3419
  return {
2963
3420
  dir,
2964
3421
  file: file == null ? void 0 : file,
2965
- format: bindingifyFormat(format),
3422
+ format: bindingifyFormat(format$1),
2966
3423
  exports,
2967
3424
  hashCharacters,
2968
3425
  sourcemap: bindingifySourcemap$1(sourcemap),
@@ -3001,8 +3458,8 @@ function bindingifyAddon(configAddon) {
3001
3458
  return configAddon || "";
3002
3459
  };
3003
3460
  }
3004
- function bindingifyFormat(format) {
3005
- switch (format) {
3461
+ function bindingifyFormat(format$1) {
3462
+ switch (format$1) {
3006
3463
  case void 0:
3007
3464
  case "es":
3008
3465
  case "esm":
@@ -3011,7 +3468,7 @@ function bindingifyFormat(format) {
3011
3468
  case "commonjs": return "cjs";
3012
3469
  case "iife": return "iife";
3013
3470
  case "umd": return "umd";
3014
- default: unimplemented(`output.format: ${format}`);
3471
+ default: unimplemented(`output.format: ${format$1}`);
3015
3472
  }
3016
3473
  }
3017
3474
  function bindingifySourcemap$1(sourcemap) {
@@ -3744,8 +4201,8 @@ var PluginContextData = class {
3744
4201
  return this.renderedChunkMeta;
3745
4202
  }
3746
4203
  markModuleLoaded(id$1, _success) {
3747
- const resolve = this.loadModulePromiseResolveFnMap.get(id$1);
3748
- if (resolve) resolve();
4204
+ const resolve$1 = this.loadModulePromiseResolveFnMap.get(id$1);
4205
+ if (resolve$1) resolve$1();
3749
4206
  }
3750
4207
  clear() {
3751
4208
  this.renderedChunkMeta = null;
@@ -3819,7 +4276,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
3819
4276
  debug: inputOptions.debug,
3820
4277
  invalidateJsSideCache: pluginContextData.clear.bind(pluginContextData),
3821
4278
  markModuleLoaded: pluginContextData.markModuleLoaded.bind(pluginContextData),
3822
- preserveEntrySignatures: inputOptions.preserveEntrySignatures
4279
+ preserveEntrySignatures: bindingifyPreserveEntrySignatures(inputOptions.preserveEntrySignatures)
3823
4280
  };
3824
4281
  }
3825
4282
  function bindingifyHmr(hmr) {
@@ -3843,9 +4300,9 @@ function bindingifyExternal(external) {
3843
4300
  };
3844
4301
  }
3845
4302
  }
3846
- function bindingifyResolve(resolve) {
3847
- if (resolve) {
3848
- const { alias, extensionAlias,...rest } = resolve;
4303
+ function bindingifyResolve(resolve$1) {
4304
+ if (resolve$1) {
4305
+ const { alias, extensionAlias,...rest } = resolve$1;
3849
4306
  return {
3850
4307
  alias: alias ? Object.entries(alias).map(([name, replacement]) => ({
3851
4308
  find: name,
@@ -3955,6 +4412,17 @@ function bindingifyMakeAbsoluteExternalsRelative(makeAbsoluteExternalsRelative)
3955
4412
  field0: makeAbsoluteExternalsRelative
3956
4413
  };
3957
4414
  }
4415
+ function bindingifyPreserveEntrySignatures(preserveEntrySignatures) {
4416
+ if (preserveEntrySignatures == void 0) return void 0;
4417
+ else if (typeof preserveEntrySignatures === "string") return {
4418
+ type: "String",
4419
+ field0: preserveEntrySignatures
4420
+ };
4421
+ else return {
4422
+ type: "Bool",
4423
+ field0: preserveEntrySignatures
4424
+ };
4425
+ }
3958
4426
 
3959
4427
  //#endregion
3960
4428
  //#region src/utils/plugin/index.ts
@@ -4072,14 +4540,14 @@ function createComposedPlugin(plugins) {
4072
4540
  for (let handlerIdx = 0; handlerIdx < batchedHandlers.length; handlerIdx++) {
4073
4541
  const [_handler, plugin] = batchedHandlers[handlerIdx];
4074
4542
  const handlerSymbol = handlerSymbols[handlerIdx];
4075
- const createFixedPluginResolveFn = (ctx, resolve) => {
4543
+ const createFixedPluginResolveFn = (ctx, resolve$1) => {
4076
4544
  return (source, importer, rawContextResolveOptions) => {
4077
4545
  const contextResolveOptions = rawContextResolveOptions ?? {};
4078
4546
  if (contextResolveOptions.skipSelf) {
4079
4547
  contextResolveOptions[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF] = handlerSymbol;
4080
4548
  contextResolveOptions.skipSelf = false;
4081
4549
  }
4082
- return resolve(source, importer, contextResolveOptions);
4550
+ return resolve$1(source, importer, contextResolveOptions);
4083
4551
  };
4084
4552
  };
4085
4553
  createFixedPluginResolveFnMap.set(plugin, createFixedPluginResolveFn);
@@ -4472,8 +4940,8 @@ var WatcherEmitter = class {
4472
4940
  break;
4473
4941
  case "change":
4474
4942
  for (const listener of listeners) {
4475
- const { path: path$1, kind } = event.watchChangeData();
4476
- await listener(path$1, { event: kind });
4943
+ const { path, kind } = event.watchChangeData();
4944
+ await listener(path, { event: kind });
4477
4945
  }
4478
4946
  break;
4479
4947
  default: throw new Error(`Unknown event: ${event}`);
@@ -4554,4 +5022,4 @@ function defineConfig(config) {
4554
5022
  const VERSION = version;
4555
5023
 
4556
5024
  //#endregion
4557
- export { BuiltinPlugin, VERSION, assetPlugin, build, buildImportAnalysisPlugin, composeJsPlugins, createBundler, defineConfig, dynamicImportVarsPlugin, handleOutputErrors, importGlobPlugin, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, reporterPlugin, rolldown, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, watch, webWorkerPostPlugin };
5025
+ export { BuiltinPlugin, PluginDriver, VERSION, assetPlugin, build, buildImportAnalysisPlugin, composeJsPlugins, createBundler, defineConfig, dynamicImportVarsPlugin, handleOutputErrors, importGlobPlugin, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, reporterPlugin, rolldown, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, watch, webWorkerPostPlugin };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rolldown/browser",
3
- "version": "1.0.0-beta.14",
3
+ "version": "1.0.0-beta.15",
4
4
  "description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",
5
5
  "homepage": "https://rolldown.rs/",
6
6
  "type": "module",