nf3 0.3.14 → 0.3.16

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.
package/README.md CHANGED
@@ -119,6 +119,16 @@ These packages cannot be bundled and should be traced as external dependencies m
119
119
  import { NodeNativePackages } from "nf3/db";
120
120
  ```
121
121
 
122
+ NF3 exports a list of packages that need full tracing (all files copied instead of only NFT-detected ones), because they use dynamic requires or runtime asset loading that static analysis cannot detect. You can use this with the `traceInclude` plugin option to ensure they are always traced:
123
+
124
+ ```js
125
+ import { FullTracePackages } from "nf3/db";
126
+
127
+ externals({
128
+ traceInclude: [...FullTracePackages],
129
+ });
130
+ ```
131
+
122
132
  NF3 also exports a list of packages that must be externalized rather than bundled, due to bundler compatibility issues with their module format or dynamic imports.
123
133
 
124
134
  ```js
@@ -1,5 +1,5 @@
1
- import { URL as e, fileURLToPath as t, pathToFileURL as n } from "node:url";
2
- import r, { lstatSync as i, realpathSync as a, statSync as o } from "node:fs";
1
+ import e, { lstatSync as t, realpathSync as n, statSync as r } from "node:fs";
2
+ import { URL as i, fileURLToPath as a, pathToFileURL as o } from "node:url";
3
3
  import s, { isAbsolute as c } from "node:path";
4
4
  import l from "node:assert";
5
5
  import u from "node:process";
@@ -105,19 +105,19 @@ b(`ERR_INVALID_ARG_VALUE`, (e, t, n = `is invalid`) => {
105
105
  return r.length > 128 && (r = `${r.slice(0, 128)}...`), `The ${e.includes(`.`) ? `property` : `argument`} '${e}' ${n}. Received ${r}`;
106
106
  }, TypeError);
107
107
  const A = {}.hasOwnProperty, j = /* @__PURE__ */ new Map();
108
- function M(e, { base: n, specifier: i }) {
109
- let a = j.get(e);
110
- if (a) return a;
108
+ function M(t, { base: n, specifier: r }) {
109
+ let i = j.get(t);
110
+ if (i) return i;
111
111
  let o;
112
112
  try {
113
- o = r.readFileSync(s.toNamespacedPath(e), `utf8`);
113
+ o = e.readFileSync(s.toNamespacedPath(t), `utf8`);
114
114
  } catch (e) {
115
115
  let t = e;
116
116
  if (t.code !== `ENOENT`) throw t;
117
117
  }
118
118
  let c = {
119
119
  exists: !1,
120
- pjsonPath: e,
120
+ pjsonPath: t,
121
121
  main: void 0,
122
122
  name: void 0,
123
123
  type: `none`,
@@ -125,27 +125,27 @@ function M(e, { base: n, specifier: i }) {
125
125
  imports: void 0
126
126
  };
127
127
  if (o !== void 0) {
128
- let r;
128
+ let e;
129
129
  try {
130
- r = JSON.parse(o);
131
- } catch (r) {
132
- let a = new w(e, (n ? `"${i}" from ` : ``) + t(n || i), r.message);
133
- throw a.cause = r, a;
130
+ e = JSON.parse(o);
131
+ } catch (e) {
132
+ let i = new w(t, (n ? `"${r}" from ` : ``) + a(n || r), e.message);
133
+ throw i.cause = e, i;
134
134
  }
135
- c.exists = !0, A.call(r, `name`) && typeof r.name == `string` && (c.name = r.name), A.call(r, `main`) && typeof r.main == `string` && (c.main = r.main), A.call(r, `exports`) && (c.exports = r.exports), A.call(r, `imports`) && (c.imports = r.imports), A.call(r, `type`) && (r.type === `commonjs` || r.type === `module`) && (c.type = r.type);
135
+ c.exists = !0, A.call(e, `name`) && typeof e.name == `string` && (c.name = e.name), A.call(e, `main`) && typeof e.main == `string` && (c.main = e.main), A.call(e, `exports`) && (c.exports = e.exports), A.call(e, `imports`) && (c.imports = e.imports), A.call(e, `type`) && (e.type === `commonjs` || e.type === `module`) && (c.type = e.type);
136
136
  }
137
- return j.set(e, c), c;
137
+ return j.set(t, c), c;
138
138
  }
139
139
  function N(e) {
140
- let n = new URL(`package.json`, e);
141
- for (; !n.pathname.endsWith(`node_modules/package.json`);) {
142
- let r = M(t(n), { specifier: e });
143
- if (r.exists) return r;
144
- let i = n;
145
- if (n = new URL(`../package.json`, n), n.pathname === i.pathname) break;
140
+ let t = new URL(`package.json`, e);
141
+ for (; !t.pathname.endsWith(`node_modules/package.json`);) {
142
+ let n = M(a(t), { specifier: e });
143
+ if (n.exists) return n;
144
+ let r = t;
145
+ if (t = new URL(`../package.json`, t), t.pathname === r.pathname) break;
146
146
  }
147
147
  return {
148
- pjsonPath: t(n),
148
+ pjsonPath: a(t),
149
149
  exists: !1,
150
150
  type: `none`
151
151
  };
@@ -185,144 +185,144 @@ function de(e) {
185
185
  }
186
186
  return ``;
187
187
  }
188
- function fe(e, n, r) {
189
- let i = de(e);
190
- if (i === `.js`) {
188
+ function fe(e, t, n) {
189
+ let r = de(e);
190
+ if (r === `.js`) {
191
191
  let { type: t } = N(e);
192
192
  return t === `none` ? `commonjs` : t;
193
193
  }
194
- if (i === ``) {
194
+ if (r === ``) {
195
195
  let { type: t } = N(e);
196
196
  return t === `none` || t === `commonjs` ? `commonjs` : `module`;
197
197
  }
198
- let a = ce[i];
199
- if (a) return a;
200
- if (!r) throw new oe(i, t(e));
198
+ let i = ce[r];
199
+ if (i) return i;
200
+ if (!n) throw new oe(r, a(e));
201
201
  }
202
202
  function pe(e, t) {
203
203
  let n = e.protocol;
204
204
  return se.call(P, n) && P[n](e, t, !0) || null;
205
205
  }
206
206
  const F = RegExp.prototype[Symbol.replace], I = {}.hasOwnProperty, L = /(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))?(\\|\/|$)/i, R = /(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))(\\|\/|$)/i, z = /^\.|%|\\/, B = /\*/g, me = /%2f|%5c/i, V = /* @__PURE__ */ new Set(), he = /[/\\]{2}/;
207
- function H(e, n, r, i, a, o, s) {
207
+ function H(e, t, n, r, i, o, s) {
208
208
  if (u.noDeprecation) return;
209
- let c = t(i), l = he.exec(s ? e : n) !== null;
210
- u.emitWarning(`Use of deprecated ${l ? `double slash` : `leading or trailing slash matching`} resolving "${e}" for module request "${n}" ${n === r ? `` : `matched to "${r}" `}in the "${a ? `imports` : `exports`}" field module resolution of the package at ${c}${o ? ` imported from ${t(o)}` : ``}.`, `DeprecationWarning`, `DEP0166`);
209
+ let c = a(r), l = he.exec(s ? e : t) !== null;
210
+ u.emitWarning(`Use of deprecated ${l ? `double slash` : `leading or trailing slash matching`} resolving "${e}" for module request "${t}" ${t === n ? `` : `matched to "${n}" `}in the "${i ? `imports` : `exports`}" field module resolution of the package at ${c}${o ? ` imported from ${a(o)}` : ``}.`, `DeprecationWarning`, `DEP0166`);
211
211
  }
212
- function U(n, r, i, a) {
213
- if (u.noDeprecation || pe(n, { parentURL: i.href }) !== `module`) return;
214
- let o = t(n.href), c = t(new e(`.`, r)), l = t(i);
215
- a ? s.resolve(c, a) !== o && u.emitWarning(`Package ${c} has a "main" field set to "${a}", excluding the full filename and extension to the resolved file at "${o.slice(c.length)}", imported from ${l}.\n Automatic extension resolution of the "main" field is deprecated for ES modules.`, `DeprecationWarning`, `DEP0151`) : u.emitWarning(`No "main" or "exports" field defined in the package.json for ${c} resolving the main entry point "${o.slice(c.length)}", imported from ${l}.\nDefault "index" lookups for the main are deprecated for ES modules.`, `DeprecationWarning`, `DEP0151`);
212
+ function U(e, t, n, r) {
213
+ if (u.noDeprecation || pe(e, { parentURL: n.href }) !== `module`) return;
214
+ let o = a(e.href), c = a(new i(`.`, t)), l = a(n);
215
+ r ? s.resolve(c, r) !== o && u.emitWarning(`Package ${c} has a "main" field set to "${r}", excluding the full filename and extension to the resolved file at "${o.slice(c.length)}", imported from ${l}.\n Automatic extension resolution of the "main" field is deprecated for ES modules.`, `DeprecationWarning`, `DEP0151`) : u.emitWarning(`No "main" or "exports" field defined in the package.json for ${c} resolving the main entry point "${o.slice(c.length)}", imported from ${l}.\nDefault "index" lookups for the main are deprecated for ES modules.`, `DeprecationWarning`, `DEP0151`);
216
216
  }
217
217
  function W(e) {
218
218
  try {
219
- return o(e);
219
+ return r(e);
220
220
  } catch {}
221
221
  }
222
222
  function G(e) {
223
- let t = o(e, { throwIfNoEntry: !1 });
223
+ let t = r(e, { throwIfNoEntry: !1 });
224
224
  return (t ? t.isFile() : void 0) ?? !1;
225
225
  }
226
- function ge(n, r, i) {
227
- let a;
228
- if (r.main !== void 0) {
229
- if (a = new e(r.main, n), G(a)) return a;
230
- let t = [
231
- `./${r.main}.js`,
232
- `./${r.main}.json`,
233
- `./${r.main}.node`,
234
- `./${r.main}/index.js`,
235
- `./${r.main}/index.json`,
236
- `./${r.main}/index.node`
226
+ function ge(e, t, n) {
227
+ let r;
228
+ if (t.main !== void 0) {
229
+ if (r = new i(t.main, e), G(r)) return r;
230
+ let a = [
231
+ `./${t.main}.js`,
232
+ `./${t.main}.json`,
233
+ `./${t.main}.node`,
234
+ `./${t.main}/index.js`,
235
+ `./${t.main}/index.json`,
236
+ `./${t.main}/index.node`
237
237
  ], o = -1;
238
- for (; ++o < t.length && (a = new e(t[o], n), !G(a));) a = void 0;
239
- if (a) return U(a, n, i, r.main), a;
238
+ for (; ++o < a.length && (r = new i(a[o], e), !G(r));) r = void 0;
239
+ if (r) return U(r, e, n, t.main), r;
240
240
  }
241
241
  let o = [
242
242
  `./index.js`,
243
243
  `./index.json`,
244
244
  `./index.node`
245
245
  ], s = -1;
246
- for (; ++s < o.length && (a = new e(o[s], n), !G(a));) a = void 0;
247
- if (a) return U(a, n, i, r.main), a;
248
- throw new T(t(new e(`.`, n)), t(i));
246
+ for (; ++s < o.length && (r = new i(o[s], e), !G(r));) r = void 0;
247
+ if (r) return U(r, e, n, t.main), r;
248
+ throw new T(a(new i(`.`, e)), a(n));
249
249
  }
250
- function _e(e, r, i) {
251
- if (me.exec(e.pathname) !== null) throw new C(e.pathname, String.raw`must not include encoded "/" or "\" characters`, t(r));
252
- let o;
250
+ function _e(e, t, r) {
251
+ if (me.exec(e.pathname) !== null) throw new C(e.pathname, String.raw`must not include encoded "/" or "\" characters`, a(t));
252
+ let i;
253
253
  try {
254
- o = t(e);
255
- } catch (t) {
256
- throw Object.defineProperty(t, `input`, { value: String(e) }), Object.defineProperty(t, `module`, { value: String(r) }), t;
254
+ i = a(e);
255
+ } catch (n) {
256
+ throw Object.defineProperty(n, `input`, { value: String(e) }), Object.defineProperty(n, `module`, { value: String(t) }), n;
257
257
  }
258
- let c = W(o.endsWith(`/`) ? o.slice(-1) : o);
258
+ let c = W(i.endsWith(`/`) ? i.slice(-1) : i);
259
259
  if (c && c.isDirectory()) {
260
- let n = new O(o, t(r));
260
+ let n = new O(i, a(t));
261
261
  throw n.url = String(e), n;
262
262
  }
263
263
  if (!c || !c.isFile()) {
264
- let n = new T(o || e.pathname, r && t(r), !0);
264
+ let n = new T(i || e.pathname, t && a(t), !0);
265
265
  throw n.url = String(e), n;
266
266
  }
267
- if (!i) {
268
- let t = a(o), { search: r, hash: i } = e;
269
- e = n(t + (o.endsWith(s.sep) ? `/` : ``)), e.search = r, e.hash = i;
267
+ if (!r) {
268
+ let t = n(i), { search: r, hash: a } = e;
269
+ e = o(t + (i.endsWith(s.sep) ? `/` : ``)), e.search = r, e.hash = a;
270
270
  }
271
271
  return e;
272
272
  }
273
- function ve(n, r, i) {
274
- return new E(n, r && t(new e(`.`, r)), t(i));
273
+ function ve(e, t, n) {
274
+ return new E(e, t && a(new i(`.`, t)), a(n));
275
275
  }
276
- function K(n, r, i) {
277
- return new D(t(new e(`.`, r)), n, i && t(i));
276
+ function K(e, t, n) {
277
+ return new D(a(new i(`.`, t)), e, n && a(n));
278
278
  }
279
- function ye(e, n, r, i, a) {
280
- throw new C(e, `request is not a valid match in pattern "${n}" for the "${i ? `imports` : `exports`}" resolution of ${t(r)}`, a && t(a));
279
+ function ye(e, t, n, r, i) {
280
+ throw new C(e, `request is not a valid match in pattern "${t}" for the "${r ? `imports` : `exports`}" resolution of ${a(n)}`, i && a(i));
281
281
  }
282
- function q(n, r, i, a, o) {
283
- return r = typeof r == `object` && r ? JSON.stringify(r, null, ``) : `${r}`, new ae(t(new e(`.`, i)), n, r, a, o && t(o));
282
+ function q(e, t, n, r, o) {
283
+ return t = typeof t == `object` && t ? JSON.stringify(t, null, ``) : `${t}`, new ae(a(new i(`.`, n)), e, t, r, o && a(o));
284
284
  }
285
- function be(t, n, r, i, a, o, s, c, l) {
286
- if (n !== `` && !o && t.at(-1) !== `/`) throw q(r, t, i, s, a);
287
- if (!t.startsWith(`./`)) {
288
- if (s && !t.startsWith(`../`) && !t.startsWith(`/`)) {
289
- let r = !1;
285
+ function be(e, t, n, r, a, o, s, c, l) {
286
+ if (t !== `` && !o && e.at(-1) !== `/`) throw q(n, e, r, s, a);
287
+ if (!e.startsWith(`./`)) {
288
+ if (s && !e.startsWith(`../`) && !e.startsWith(`/`)) {
289
+ let n = !1;
290
290
  try {
291
- new e(t), r = !0;
291
+ new i(e), n = !0;
292
292
  } catch {}
293
- if (!r) return Z(o ? F.call(B, t, () => n) : t + n, i, l);
293
+ if (!n) return Z(o ? F.call(B, e, () => t) : e + t, r, l);
294
294
  }
295
- throw q(r, t, i, s, a);
295
+ throw q(n, e, r, s, a);
296
296
  }
297
- if (L.exec(t.slice(2)) !== null) if (R.exec(t.slice(2)) === null) {
297
+ if (L.exec(e.slice(2)) !== null) if (R.exec(e.slice(2)) === null) {
298
298
  if (!c) {
299
- let e = o ? r.replace(`*`, () => n) : r + n;
300
- H(o ? F.call(B, t, () => n) : t, e, r, i, s, a, !0);
299
+ let i = o ? n.replace(`*`, () => t) : n + t;
300
+ H(o ? F.call(B, e, () => t) : e, i, n, r, s, a, !0);
301
301
  }
302
- } else throw q(r, t, i, s, a);
303
- let u = new e(t, i), d = u.pathname, f = new e(`.`, i).pathname;
304
- if (!d.startsWith(f)) throw q(r, t, i, s, a);
305
- if (n === ``) return u;
306
- if (L.exec(n) !== null) {
307
- let e = o ? r.replace(`*`, () => n) : r + n;
308
- R.exec(n) === null ? c || H(o ? F.call(B, t, () => n) : t, e, r, i, s, a, !1) : ye(e, r, i, s, a);
302
+ } else throw q(n, e, r, s, a);
303
+ let u = new i(e, r), d = u.pathname, f = new i(`.`, r).pathname;
304
+ if (!d.startsWith(f)) throw q(n, e, r, s, a);
305
+ if (t === ``) return u;
306
+ if (L.exec(t) !== null) {
307
+ let i = o ? n.replace(`*`, () => t) : n + t;
308
+ R.exec(t) === null ? c || H(o ? F.call(B, e, () => t) : e, i, n, r, s, a, !1) : ye(i, n, r, s, a);
309
309
  }
310
- return o ? new e(F.call(B, u.href, () => n)) : new e(n, u);
310
+ return o ? new i(F.call(B, u.href, () => t)) : new i(t, u);
311
311
  }
312
312
  function xe(e) {
313
313
  let t = Number(e);
314
314
  return `${t}` === e ? t >= 0 && t < 4294967295 : !1;
315
315
  }
316
- function J(e, n, r, i, a, o, s, c, l) {
317
- if (typeof n == `string`) return be(n, r, i, e, a, o, s, c, l);
318
- if (Array.isArray(n)) {
319
- let t = n;
320
- if (t.length === 0) return null;
316
+ function J(e, t, n, r, i, o, s, c, l) {
317
+ if (typeof t == `string`) return be(t, n, r, e, i, o, s, c, l);
318
+ if (Array.isArray(t)) {
319
+ let a = t;
320
+ if (a.length === 0) return null;
321
321
  let u, d = -1;
322
- for (; ++d < t.length;) {
323
- let n = t[d], f;
322
+ for (; ++d < a.length;) {
323
+ let t = a[d], f;
324
324
  try {
325
- f = J(e, n, r, i, a, o, s, c, l);
325
+ f = J(e, t, n, r, i, o, s, c, l);
326
326
  } catch (e) {
327
327
  let t = e;
328
328
  if (u = t, t.code === `ERR_INVALID_PACKAGE_TARGET`) continue;
@@ -339,40 +339,40 @@ function J(e, n, r, i, a, o, s, c, l) {
339
339
  if (u == null) return null;
340
340
  throw u;
341
341
  }
342
- if (typeof n == `object` && n) {
343
- let u = Object.getOwnPropertyNames(n), d = -1;
342
+ if (typeof t == `object` && t) {
343
+ let u = Object.getOwnPropertyNames(t), d = -1;
344
344
  for (; ++d < u.length;) {
345
- let n = u[d];
346
- if (xe(n)) throw new w(t(e), t(a), `"exports" cannot contain numeric property keys.`);
345
+ let t = u[d];
346
+ if (xe(t)) throw new w(a(e), a(i), `"exports" cannot contain numeric property keys.`);
347
347
  }
348
348
  for (d = -1; ++d < u.length;) {
349
- let t = u[d];
350
- if (t === `default` || l && l.has(t)) {
351
- let u = n[t], d = J(e, u, r, i, a, o, s, c, l);
349
+ let a = u[d];
350
+ if (a === `default` || l && l.has(a)) {
351
+ let u = t[a], d = J(e, u, n, r, i, o, s, c, l);
352
352
  if (d === void 0) continue;
353
353
  return d;
354
354
  }
355
355
  }
356
356
  return null;
357
357
  }
358
- if (n === null) return null;
359
- throw q(i, n, e, s, a);
358
+ if (t === null) return null;
359
+ throw q(r, t, e, s, i);
360
360
  }
361
- function Se(e, n, r) {
361
+ function Se(e, t, n) {
362
362
  if (typeof e == `string` || Array.isArray(e)) return !0;
363
363
  if (typeof e != `object` || !e) return !1;
364
- let i = Object.getOwnPropertyNames(e), a = !1, o = 0, s = -1;
365
- for (; ++s < i.length;) {
366
- let e = i[s], c = e === `` || e[0] !== `.`;
367
- if (o++ === 0) a = c;
368
- else if (a !== c) throw new w(t(n), t(r), `"exports" cannot contain some keys starting with '.' and some not. The exports object must either be an object of package subpath keys or an object of main entry condition name keys only.`);
364
+ let r = Object.getOwnPropertyNames(e), i = !1, o = 0, s = -1;
365
+ for (; ++s < r.length;) {
366
+ let e = r[s], c = e === `` || e[0] !== `.`;
367
+ if (o++ === 0) i = c;
368
+ else if (i !== c) throw new w(a(t), a(n), `"exports" cannot contain some keys starting with '.' and some not. The exports object must either be an object of package subpath keys or an object of main entry condition name keys only.`);
369
369
  }
370
- return a;
370
+ return i;
371
371
  }
372
- function Ce(e, n, r) {
372
+ function Ce(e, t, n) {
373
373
  if (u.noDeprecation) return;
374
- let i = t(n);
375
- V.has(i + `|` + e) || (V.add(i + `|` + e), u.emitWarning(`Use of deprecated trailing slash pattern mapping "${e}" in the "exports" field module resolution of the package at ${i}${r ? ` imported from ${t(r)}` : ``}. Mapping specifiers ending in "/" is no longer supported.`, `DeprecationWarning`, `DEP0155`));
374
+ let r = a(t);
375
+ V.has(r + `|` + e) || (V.add(r + `|` + e), u.emitWarning(`Use of deprecated trailing slash pattern mapping "${e}" in the "exports" field module resolution of the package at ${r}${n ? ` imported from ${a(n)}` : ``}. Mapping specifiers ending in "/" is no longer supported.`, `DeprecationWarning`, `DEP0155`));
376
376
  }
377
377
  function Y(e, t, n, r, i) {
378
378
  let a = n.exports;
@@ -399,63 +399,63 @@ function Y(e, t, n, r, i) {
399
399
  }
400
400
  function X(e, t) {
401
401
  let n = e.indexOf(`*`), r = t.indexOf(`*`), i = n === -1 ? e.length : n + 1, a = r === -1 ? t.length : r + 1;
402
- return i > a ? -1 : a > i || n === -1 ? 1 : r === -1 || e.length > t.length ? -1 : t.length > e.length ? 1 : 0;
403
- }
404
- function we(e, r, i) {
405
- if (e === `#` || e.startsWith(`#/`) || e.endsWith(`/`)) throw new C(e, `is not a valid internal imports specifier name`, t(r));
406
- let a, o = N(r);
407
- if (o.exists) {
408
- a = n(o.pjsonPath);
409
- let t = o.imports;
410
- if (t) if (I.call(t, e) && !e.includes(`*`)) {
411
- let n = J(a, t[e], ``, e, r, !1, !0, !1, i);
412
- if (n != null) return n;
402
+ return i > a ? -1 : a > i || n === -1 ? 1 : r === -1 || e.length > t.length ? -1 : +(t.length > e.length);
403
+ }
404
+ function we(e, t, n) {
405
+ if (e === `#` || e.startsWith(`#/`) || e.endsWith(`/`)) throw new C(e, `is not a valid internal imports specifier name`, a(t));
406
+ let r, i = N(t);
407
+ if (i.exists) {
408
+ r = o(i.pjsonPath);
409
+ let a = i.imports;
410
+ if (a) if (I.call(a, e) && !e.includes(`*`)) {
411
+ let i = J(r, a[e], ``, e, t, !1, !0, !1, n);
412
+ if (i != null) return i;
413
413
  } else {
414
- let n = ``, o = ``, s = Object.getOwnPropertyNames(t), c = -1;
414
+ let i = ``, o = ``, s = Object.getOwnPropertyNames(a), c = -1;
415
415
  for (; ++c < s.length;) {
416
- let t = s[c], r = t.indexOf(`*`);
417
- if (r !== -1 && e.startsWith(t.slice(0, -1))) {
418
- let i = t.slice(r + 1);
419
- e.length >= t.length && e.endsWith(i) && X(n, t) === 1 && t.lastIndexOf(`*`) === r && (n = t, o = e.slice(r, e.length - i.length));
416
+ let t = s[c], n = t.indexOf(`*`);
417
+ if (n !== -1 && e.startsWith(t.slice(0, -1))) {
418
+ let r = t.slice(n + 1);
419
+ e.length >= t.length && e.endsWith(r) && X(i, t) === 1 && t.lastIndexOf(`*`) === n && (i = t, o = e.slice(n, e.length - r.length));
420
420
  }
421
421
  }
422
- if (n) {
423
- let e = t[n], s = J(a, e, o, n, r, !0, !0, !1, i);
422
+ if (i) {
423
+ let e = a[i], s = J(r, e, o, i, t, !0, !0, !1, n);
424
424
  if (s != null) return s;
425
425
  }
426
426
  }
427
427
  }
428
- throw ve(e, a, r);
428
+ throw ve(e, r, t);
429
429
  }
430
- function Te(e, n) {
431
- let r = e.indexOf(`/`), i = !0, a = !1;
432
- e[0] === `@` && (a = !0, r === -1 || e.length === 0 ? i = !1 : r = e.indexOf(`/`, r + 1));
433
- let o = r === -1 ? e : e.slice(0, r);
434
- if (z.exec(o) !== null && (i = !1), !i) throw new C(e, `is not a valid package name`, t(n));
430
+ function Te(e, t) {
431
+ let n = e.indexOf(`/`), r = !0, i = !1;
432
+ e[0] === `@` && (i = !0, n === -1 || e.length === 0 ? r = !1 : n = e.indexOf(`/`, n + 1));
433
+ let o = n === -1 ? e : e.slice(0, n);
434
+ if (z.exec(o) !== null && (r = !1), !r) throw new C(e, `is not a valid package name`, a(t));
435
435
  return {
436
436
  packageName: o,
437
- packageSubpath: `.` + (r === -1 ? `` : e.slice(r)),
438
- isScoped: a
437
+ packageSubpath: `.` + (n === -1 ? `` : e.slice(n)),
438
+ isScoped: i
439
439
  };
440
440
  }
441
- function Z(r, i, a) {
442
- if (m.includes(r)) return new e(`node:` + r);
443
- let { packageName: o, packageSubpath: s, isScoped: c } = Te(r, i), l = N(i);
444
- if (l.exists && l.name === o && l.exports !== void 0 && l.exports !== null) return Y(n(l.pjsonPath), s, l, i, a);
445
- let u = new e(`./node_modules/` + o + `/package.json`, i), d = t(u), f;
441
+ function Z(e, t, n) {
442
+ if (m.includes(e)) return new i(`node:` + e);
443
+ let { packageName: r, packageSubpath: s, isScoped: c } = Te(e, t), l = N(t);
444
+ if (l.exists && l.name === r && l.exports !== void 0 && l.exports !== null) return Y(o(l.pjsonPath), s, l, t, n);
445
+ let u = new i(`./node_modules/` + r + `/package.json`, t), d = a(u), f;
446
446
  do {
447
- let n = W(d.slice(0, -13));
448
- if (!n || !n.isDirectory()) {
449
- f = d, u = new e((c ? `../../../../node_modules/` : `../../../node_modules/`) + o + `/package.json`, u), d = t(u);
447
+ let o = W(d.slice(0, -13));
448
+ if (!o || !o.isDirectory()) {
449
+ f = d, u = new i((c ? `../../../../node_modules/` : `../../../node_modules/`) + r + `/package.json`, u), d = a(u);
450
450
  continue;
451
451
  }
452
452
  let l = M(d, {
453
- base: i,
454
- specifier: r
453
+ base: t,
454
+ specifier: e
455
455
  });
456
- return l.exports !== void 0 && l.exports !== null ? Y(u, s, l, i, a) : s === `.` ? ge(u, l, i) : new e(s, u);
456
+ return l.exports !== void 0 && l.exports !== null ? Y(u, s, l, t, n) : s === `.` ? ge(u, l, t) : new i(s, u);
457
457
  } while (d.length !== f.length);
458
- throw new T(o, t(i), !1);
458
+ throw new T(r, a(t), !1);
459
459
  }
460
460
  function Ee(e) {
461
461
  return e[0] === `.` && (e.length === 1 || e[1] === `/` || e[1] === `.` && (e.length === 2 || e[2] === `/`));
@@ -463,46 +463,46 @@ function Ee(e) {
463
463
  function De(e) {
464
464
  return e === `` ? !1 : e[0] === `/` ? !0 : Ee(e);
465
465
  }
466
- function Oe(t, n, r, i) {
467
- let a = n.protocol, o = a === `data:`, s;
468
- if (De(t)) try {
469
- s = new e(t, n);
470
- } catch (e) {
471
- let r = new k(t, n);
472
- throw r.cause = e, r;
466
+ function Oe(e, t, n, r) {
467
+ let a = t.protocol, o = a === `data:`, s;
468
+ if (De(e)) try {
469
+ s = new i(e, t);
470
+ } catch (n) {
471
+ let r = new k(e, t);
472
+ throw r.cause = n, r;
473
473
  }
474
- else if (a === `file:` && t[0] === `#`) s = we(t, n, r);
474
+ else if (a === `file:` && e[0] === `#`) s = we(e, t, n);
475
475
  else try {
476
- s = new e(t);
477
- } catch (e) {
478
- if (o && !m.includes(t)) {
479
- let r = new k(t, n);
480
- throw r.cause = e, r;
476
+ s = new i(e);
477
+ } catch (r) {
478
+ if (o && !m.includes(e)) {
479
+ let n = new k(e, t);
480
+ throw n.cause = r, n;
481
481
  }
482
- s = Z(t, n, r);
482
+ s = Z(e, t, n);
483
483
  }
484
- return l.ok(s !== void 0, `expected to be defined`), s.protocol === `file:` ? _e(s, n, i) : s;
484
+ return l.ok(s !== void 0, `expected to be defined`), s.protocol === `file:` ? _e(s, t, r) : s;
485
485
  }
486
486
  const ke = new Set([`node`, `import`]), Ae = process.platform === `win32`, je = globalThis.__EXSOLVE_CACHE__ ||= /* @__PURE__ */ new Map();
487
- function Q(e, t) {
488
- let r = Be(e);
489
- if (`external` in r) return r.external;
490
- let o = r.specifier, s = r.url, c = r.absolutePath, l, u;
491
- if (t?.cache !== !1 && (l = Le(c || o, t), u = t?.cache && typeof t?.cache == `object` ? t.cache : je), u) {
487
+ function Q(e, r) {
488
+ let i = Be(e);
489
+ if (`external` in i) return i.external;
490
+ let a = i.specifier, s = i.url, c = i.absolutePath, l, u;
491
+ if (r?.cache !== !1 && (l = Le(c || a, r), u = r?.cache && typeof r?.cache == `object` ? r.cache : je), u) {
492
492
  let e = u.get(l);
493
493
  if (typeof e == `string`) return e;
494
494
  if (e instanceof Error) {
495
- if (t?.try) return;
495
+ if (r?.try) return;
496
496
  throw e;
497
497
  }
498
498
  }
499
499
  if (c) try {
500
- let e = i(c);
501
- if (e.isSymbolicLink() && (c = a(c), s = n(c)), e.isFile()) return u && u.set(l, s.href), s.href;
500
+ let e = t(c);
501
+ if (e.isSymbolicLink() && (c = n(c), s = o(c)), e.isFile()) return u && u.set(l, s.href), s.href;
502
502
  } catch (e) {
503
503
  if (e?.code !== `ENOENT`) throw u && u.set(l, e), e;
504
504
  }
505
- let d = t?.conditions ? new Set(t.conditions) : ke, f = o || s.href, p = Pe(t?.from), m = t?.suffixes || [``], h = t?.extensions ? [``, ...t.extensions] : [``], g;
505
+ let d = r?.conditions ? new Set(r.conditions) : ke, f = a || s.href, p = Pe(r?.from), m = r?.suffixes || [``], h = r?.extensions ? [``, ...r.extensions] : [``], g;
506
506
  for (let e of p) {
507
507
  for (let t of m) {
508
508
  let n = Re(f, t);
@@ -513,17 +513,17 @@ function Q(e, t) {
513
513
  if (g) break;
514
514
  }
515
515
  if (!g) {
516
- let n = Error(`Cannot resolve module "${e}" (from: ${p.map((e) => Ie(e)).join(`, `)})`);
517
- if (n.code = `ERR_MODULE_NOT_FOUND`, u && u.set(l, n), t?.try) return;
518
- throw n;
516
+ let t = Error(`Cannot resolve module "${e}" (from: ${p.map((e) => Ie(e)).join(`, `)})`);
517
+ if (t.code = `ERR_MODULE_NOT_FOUND`, u && u.set(l, t), r?.try) return;
518
+ throw t;
519
519
  }
520
520
  return u && u.set(l, g.href), g.href;
521
521
  }
522
- function Me(e, n) {
523
- let r = Q(e, n);
524
- if (!r || !r.startsWith(`file://`) && n?.try) return;
525
- let i = t(r);
526
- return Ae ? ze(i) : i;
522
+ function Me(e, t) {
523
+ let n = Q(e, t);
524
+ if (!n || !n.startsWith(`file://`) && t?.try) return;
525
+ let r = a(n);
526
+ return Ae ? ze(r) : r;
527
527
  }
528
528
  function Ne(e, t, n) {
529
529
  try {
@@ -532,7 +532,7 @@ function Ne(e, t, n) {
532
532
  }
533
533
  function Pe(e) {
534
534
  let t = (Array.isArray(e) ? e : [e]).flatMap((e) => Fe(e));
535
- return t.length === 0 ? [n(`./`)] : t;
535
+ return t.length === 0 ? [o(`./`)] : t;
536
536
  }
537
537
  function Fe(e) {
538
538
  if (!e) return [];
@@ -540,14 +540,14 @@ function Fe(e) {
540
540
  if (typeof e != `string`) return [];
541
541
  if (/^(?:node|data|http|https|file):/.test(e)) return new URL(e);
542
542
  try {
543
- return e.endsWith(`/`) || o(e).isDirectory() ? n(e + `/`) : n(e);
543
+ return e.endsWith(`/`) || r(e).isDirectory() ? o(e + `/`) : o(e);
544
544
  } catch {
545
- return [n(e + `/`), n(e)];
545
+ return [o(e + `/`), o(e)];
546
546
  }
547
547
  }
548
548
  function Ie(e) {
549
549
  try {
550
- return t(e);
550
+ return a(e);
551
551
  } catch {
552
552
  return e;
553
553
  }
@@ -573,20 +573,20 @@ function $(e) {
573
573
  function Be(e) {
574
574
  if (typeof e == `string`) {
575
575
  if (e.startsWith(`file:`)) {
576
- let n = new URL(e);
576
+ let t = new URL(e);
577
577
  return {
578
- url: n,
579
- absolutePath: t(n)
578
+ url: t,
579
+ absolutePath: a(t)
580
580
  };
581
581
  }
582
582
  return c(e) ? {
583
- url: n(e),
583
+ url: o(e),
584
584
  absolutePath: e
585
585
  } : /^(?:node|data|http|https):/.test(e) ? { external: e } : m.includes(e) && !e.includes(`:`) ? { external: `node:${e}` } : { specifier: e };
586
586
  }
587
587
  if ($(e)) return e.protocol === `file:` ? {
588
588
  url: e,
589
- absolutePath: t(e)
589
+ absolutePath: a(e)
590
590
  } : { external: e.href };
591
591
  throw TypeError("id must be a `string` or `URL`");
592
592
  }