nf3 0.3.9 → 0.3.11

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 (54) hide show
  1. package/LICENSE +7 -1
  2. package/dist/THIRD-PARTY-LICENSES.md +253 -0
  3. package/dist/_chunks/libs/exsolve.d.mts +1 -0
  4. package/dist/_chunks/libs/exsolve.mjs +212 -212
  5. package/dist/_chunks/libs/pathe.mjs +25 -24
  6. package/dist/_chunks/libs/pkg-types.d.mts +1 -1
  7. package/dist/_chunks/trace.mjs +6 -0
  8. package/dist/db.mjs +12 -45
  9. package/dist/index.mjs +1 -0
  10. package/dist/node_modules/@vercel/nft/out/analyze.js +1 -1
  11. package/dist/node_modules/@vercel/nft/out/node-file-trace.js +1 -1
  12. package/dist/node_modules/@vercel/nft/package.json +1 -1
  13. package/dist/node_modules/acorn/dist/acorn.js +6 -6
  14. package/dist/node_modules/acorn/package.json +1 -1
  15. package/dist/node_modules/consola/dist/basic.cjs +1 -1
  16. package/dist/node_modules/consola/dist/core.cjs +2 -2
  17. package/dist/node_modules/consola/dist/shared/consola.DCGIlDNP.cjs +7 -7
  18. package/dist/node_modules/glob/dist/commonjs/index.min.js +3 -0
  19. package/dist/node_modules/glob/package.json +13 -3
  20. package/dist/plugin.mjs +3 -1
  21. package/package.json +11 -11
  22. package/dist/node_modules/@isaacs/balanced-match/dist/commonjs/index.js +0 -1
  23. package/dist/node_modules/@isaacs/balanced-match/dist/commonjs/package.json +0 -3
  24. package/dist/node_modules/@isaacs/balanced-match/package.json +0 -19
  25. package/dist/node_modules/@isaacs/brace-expansion/dist/commonjs/index.js +0 -1
  26. package/dist/node_modules/@isaacs/brace-expansion/dist/commonjs/package.json +0 -3
  27. package/dist/node_modules/@isaacs/brace-expansion/package.json +0 -19
  28. package/dist/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js +0 -1
  29. package/dist/node_modules/@isaacs/fs-minipass/dist/commonjs/package.json +0 -3
  30. package/dist/node_modules/@isaacs/fs-minipass/package.json +0 -19
  31. package/dist/node_modules/glob/dist/commonjs/glob.js +0 -1
  32. package/dist/node_modules/glob/dist/commonjs/has-magic.js +0 -1
  33. package/dist/node_modules/glob/dist/commonjs/ignore.js +0 -1
  34. package/dist/node_modules/glob/dist/commonjs/index.js +0 -1
  35. package/dist/node_modules/glob/dist/commonjs/pattern.js +0 -1
  36. package/dist/node_modules/glob/dist/commonjs/processor.js +0 -1
  37. package/dist/node_modules/glob/dist/commonjs/walker.js +0 -1
  38. package/dist/node_modules/lru-cache/dist/commonjs/index.js +0 -1
  39. package/dist/node_modules/lru-cache/dist/commonjs/package.json +0 -3
  40. package/dist/node_modules/lru-cache/package.json +0 -28
  41. package/dist/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js +0 -1
  42. package/dist/node_modules/minimatch/dist/commonjs/ast.js +0 -1
  43. package/dist/node_modules/minimatch/dist/commonjs/brace-expressions.js +0 -1
  44. package/dist/node_modules/minimatch/dist/commonjs/escape.js +0 -1
  45. package/dist/node_modules/minimatch/dist/commonjs/index.js +0 -3
  46. package/dist/node_modules/minimatch/dist/commonjs/package.json +0 -3
  47. package/dist/node_modules/minimatch/dist/commonjs/unescape.js +0 -1
  48. package/dist/node_modules/minimatch/package.json +0 -19
  49. package/dist/node_modules/minipass/dist/commonjs/index.js +0 -1
  50. package/dist/node_modules/minipass/dist/commonjs/package.json +0 -3
  51. package/dist/node_modules/minipass/package.json +0 -19
  52. package/dist/node_modules/path-scurry/dist/commonjs/index.js +0 -1
  53. package/dist/node_modules/path-scurry/dist/commonjs/package.json +0 -3
  54. package/dist/node_modules/path-scurry/package.json +0 -19
@@ -1,11 +1,11 @@
1
- import fs, { lstatSync, realpathSync, statSync } from "node:fs";
2
- import { URL as URL$1, fileURLToPath, pathToFileURL } from "node:url";
3
- import path, { isAbsolute } from "node:path";
4
- import assert from "node:assert";
5
- import process$1 from "node:process";
6
- import v8 from "node:v8";
7
- import { format, inspect } from "node:util";
8
- const nodeBuiltins = `_http_agent._http_client._http_common._http_incoming._http_outgoing._http_server._stream_duplex._stream_passthrough._stream_readable._stream_transform._stream_wrap._stream_writable._tls_common._tls_wrap.assert.assert/strict.async_hooks.buffer.child_process.cluster.console.constants.crypto.dgram.diagnostics_channel.dns.dns/promises.domain.events.fs.fs/promises.http.http2.https.inspector.inspector/promises.module.net.os.path.path/posix.path/win32.perf_hooks.process.punycode.querystring.readline.readline/promises.repl.stream.stream/consumers.stream/promises.stream/web.string_decoder.sys.timers.timers/promises.tls.trace_events.tty.url.util.util/types.v8.vm.wasi.worker_threads.zlib`.split(`.`), own$1 = {}.hasOwnProperty, classRegExp = /^([A-Z][a-z\d]*)+$/, kTypes = new Set([
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
+ import s, { isAbsolute as c } from "node:path";
4
+ import l from "node:assert";
5
+ import u from "node:process";
6
+ import d from "node:v8";
7
+ import { format as f, inspect as p } from "node:util";
8
+ const m = `_http_agent._http_client._http_common._http_incoming._http_outgoing._http_server._stream_duplex._stream_passthrough._stream_readable._stream_transform._stream_wrap._stream_writable._tls_common._tls_wrap.assert.assert/strict.async_hooks.buffer.child_process.cluster.console.constants.crypto.dgram.diagnostics_channel.dns.dns/promises.domain.events.fs.fs/promises.http.http2.https.inspector.inspector/promises.module.net.os.path.path/posix.path/win32.perf_hooks.process.punycode.querystring.readline.readline/promises.repl.stream.stream/consumers.stream/promises.stream/web.string_decoder.sys.timers.timers/promises.tls.trace_events.tty.url.util.util/types.v8.vm.wasi.worker_threads.zlib`.split(`.`), h = {}.hasOwnProperty, g = /^([A-Z][a-z\d]*)+$/, ee = new Set([
9
9
  `string`,
10
10
  `function`,
11
11
  `number`,
@@ -15,21 +15,21 @@ const nodeBuiltins = `_http_agent._http_client._http_common._http_incoming._http
15
15
  `boolean`,
16
16
  `bigint`,
17
17
  `symbol`
18
- ]), messages = /* @__PURE__ */ new Map();
19
- let userStackTraceLimit;
20
- function formatList(e, t = `and`) {
18
+ ]), _ = /* @__PURE__ */ new Map();
19
+ let v;
20
+ function y(e, t = `and`) {
21
21
  return e.length < 3 ? e.join(` ${t} `) : `${e.slice(0, -1).join(`, `)}, ${t} ${e.at(-1)}`;
22
22
  }
23
- function createError(e, t, n) {
24
- return messages.set(e, t), makeNodeErrorWithCode(n, e);
23
+ function b(e, t, n) {
24
+ return _.set(e, t), te(n, e);
25
25
  }
26
- function makeNodeErrorWithCode(e, t) {
26
+ function te(e, t) {
27
27
  return function(...n) {
28
28
  let r = Error.stackTraceLimit;
29
- isErrorStackTraceLimitWritable() && (Error.stackTraceLimit = 0);
29
+ x() && (Error.stackTraceLimit = 0);
30
30
  let i = new e();
31
- isErrorStackTraceLimitWritable() && (Error.stackTraceLimit = r);
32
- let a = getMessage(t, n, i);
31
+ x() && (Error.stackTraceLimit = r);
32
+ let a = re(t, n, i);
33
33
  return Object.defineProperties(i, {
34
34
  message: {
35
35
  value: a,
@@ -45,40 +45,40 @@ function makeNodeErrorWithCode(e, t) {
45
45
  writable: !0,
46
46
  configurable: !0
47
47
  }
48
- }), captureLargerStackTrace(i), i.code = t, i;
48
+ }), S(i), i.code = t, i;
49
49
  };
50
50
  }
51
- function isErrorStackTraceLimitWritable() {
51
+ function x() {
52
52
  try {
53
- if (v8.startupSnapshot.isBuildingSnapshot()) return !1;
53
+ if (d.startupSnapshot.isBuildingSnapshot()) return !1;
54
54
  } catch {}
55
55
  let e = Object.getOwnPropertyDescriptor(Error, `stackTraceLimit`);
56
- return e === void 0 ? Object.isExtensible(Error) : own$1.call(e, `writable`) && e.writable !== void 0 ? e.writable : e.set !== void 0;
56
+ return e === void 0 ? Object.isExtensible(Error) : h.call(e, `writable`) && e.writable !== void 0 ? e.writable : e.set !== void 0;
57
57
  }
58
- function hideStackFrames(e) {
58
+ function ne(e) {
59
59
  let t = `__node_internal_` + e.name;
60
60
  return Object.defineProperty(e, `name`, { value: t }), e;
61
61
  }
62
- const captureLargerStackTrace = hideStackFrames(function(e) {
63
- let t = isErrorStackTraceLimitWritable();
64
- return t && (userStackTraceLimit = Error.stackTraceLimit, Error.stackTraceLimit = Infinity), Error.captureStackTrace(e), t && (Error.stackTraceLimit = userStackTraceLimit), e;
62
+ const S = ne(function(e) {
63
+ let t = x();
64
+ return t && (v = Error.stackTraceLimit, Error.stackTraceLimit = Infinity), Error.captureStackTrace(e), t && (Error.stackTraceLimit = v), e;
65
65
  });
66
- function getMessage(e, t, n) {
67
- let r = messages.get(e);
68
- if (assert.ok(r !== void 0, "expected `message` to be found"), typeof r == `function`) return assert.ok(r.length <= t.length, `Code: ${e}; The provided arguments length (${t.length}) does not match the required ones (${r.length}).`), Reflect.apply(r, n, t);
66
+ function re(e, t, n) {
67
+ let r = _.get(e);
68
+ if (l.ok(r !== void 0, "expected `message` to be found"), typeof r == `function`) return l.ok(r.length <= t.length, `Code: ${e}; The provided arguments length (${t.length}) does not match the required ones (${r.length}).`), Reflect.apply(r, n, t);
69
69
  let i = /%[dfijoOs]/g, a = 0;
70
70
  for (; i.exec(r) !== null;) a++;
71
- return assert.ok(a === t.length, `Code: ${e}; The provided arguments length (${t.length}) does not match the required ones (${a}).`), t.length === 0 ? r : (t.unshift(r), Reflect.apply(format, null, t));
71
+ return l.ok(a === t.length, `Code: ${e}; The provided arguments length (${t.length}) does not match the required ones (${a}).`), t.length === 0 ? r : (t.unshift(r), Reflect.apply(f, null, t));
72
72
  }
73
- function determineSpecificType(e) {
73
+ function ie(e) {
74
74
  if (e == null) return String(e);
75
75
  if (typeof e == `function` && e.name) return `function ${e.name}`;
76
- if (typeof e == `object`) return e.constructor && e.constructor.name ? `an instance of ${e.constructor.name}` : `${inspect(e, { depth: -1 })}`;
77
- let t = inspect(e, { colors: !1 });
76
+ if (typeof e == `object`) return e.constructor && e.constructor.name ? `an instance of ${e.constructor.name}` : `${p(e, { depth: -1 })}`;
77
+ let t = p(e, { colors: !1 });
78
78
  return t.length > 28 && (t = `${t.slice(0, 25)}...`), `type ${typeof e} (${t})`;
79
79
  }
80
- createError(`ERR_INVALID_ARG_TYPE`, (e, t, n) => {
81
- assert.ok(typeof e == `string`, `'name' must be a string`), Array.isArray(t) || (t = [t]);
80
+ b(`ERR_INVALID_ARG_TYPE`, (e, t, n) => {
81
+ l.ok(typeof e == `string`, `'name' must be a string`), Array.isArray(t) || (t = [t]);
82
82
  let r = `The `;
83
83
  if (e.endsWith(` argument`)) r += `${e} `;
84
84
  else {
@@ -87,30 +87,30 @@ createError(`ERR_INVALID_ARG_TYPE`, (e, t, n) => {
87
87
  }
88
88
  r += `must be `;
89
89
  let i = [], a = [], o = [];
90
- for (let e of t) assert.ok(typeof e == `string`, `All expected entries have to be of type string`), kTypes.has(e) ? i.push(e.toLowerCase()) : classRegExp.exec(e) === null ? (assert.ok(e !== `object`, `The value "object" should be written as "Object"`), o.push(e)) : a.push(e);
90
+ for (let e of t) l.ok(typeof e == `string`, `All expected entries have to be of type string`), ee.has(e) ? i.push(e.toLowerCase()) : g.exec(e) === null ? (l.ok(e !== `object`, `The value "object" should be written as "Object"`), o.push(e)) : a.push(e);
91
91
  if (a.length > 0) {
92
92
  let e = i.indexOf(`object`);
93
93
  e !== -1 && (i.slice(e, 1), a.push(`Object`));
94
94
  }
95
- return i.length > 0 && (r += `${i.length > 1 ? `one of type` : `of type`} ${formatList(i, `or`)}`, (a.length > 0 || o.length > 0) && (r += ` or `)), a.length > 0 && (r += `an instance of ${formatList(a, `or`)}`, o.length > 0 && (r += ` or `)), o.length > 0 && (o.length > 1 ? r += `one of ${formatList(o, `or`)}` : (o[0]?.toLowerCase() !== o[0] && (r += `an `), r += `${o[0]}`)), r += `. Received ${determineSpecificType(n)}`, r;
95
+ return i.length > 0 && (r += `${i.length > 1 ? `one of type` : `of type`} ${y(i, `or`)}`, (a.length > 0 || o.length > 0) && (r += ` or `)), a.length > 0 && (r += `an instance of ${y(a, `or`)}`, o.length > 0 && (r += ` or `)), o.length > 0 && (o.length > 1 ? r += `one of ${y(o, `or`)}` : (o[0]?.toLowerCase() !== o[0] && (r += `an `), r += `${o[0]}`)), r += `. Received ${ie(n)}`, r;
96
96
  }, TypeError);
97
- const ERR_INVALID_MODULE_SPECIFIER = createError(`ERR_INVALID_MODULE_SPECIFIER`, (e, t, n) => `Invalid module "${e}" ${t}${n ? ` imported from ${n}` : ``}`, TypeError), ERR_INVALID_PACKAGE_CONFIG = createError(`ERR_INVALID_PACKAGE_CONFIG`, (e, t, n) => `Invalid package config ${e}${t ? ` while importing ${t}` : ``}${n ? `. ${n}` : ``}`, Error), ERR_INVALID_PACKAGE_TARGET = createError(`ERR_INVALID_PACKAGE_TARGET`, (e, t, n, r = !1, i) => {
97
+ const C = b(`ERR_INVALID_MODULE_SPECIFIER`, (e, t, n) => `Invalid module "${e}" ${t}${n ? ` imported from ${n}` : ``}`, TypeError), w = b(`ERR_INVALID_PACKAGE_CONFIG`, (e, t, n) => `Invalid package config ${e}${t ? ` while importing ${t}` : ``}${n ? `. ${n}` : ``}`, Error), ae = b(`ERR_INVALID_PACKAGE_TARGET`, (e, t, n, r = !1, i) => {
98
98
  let a = typeof n == `string` && !r && n.length > 0 && !n.startsWith(`./`);
99
- return t === `.` ? (assert.ok(r === !1), `Invalid "exports" main target ${JSON.stringify(n)} defined in the package config ${e}package.json${i ? ` imported from ${i}` : ``}${a ? `; targets must start with "./"` : ``}`) : `Invalid "${r ? `imports` : `exports`}" target ${JSON.stringify(n)} defined for '${t}' in the package config ${e}package.json${i ? ` imported from ${i}` : ``}${a ? `; targets must start with "./"` : ``}`;
100
- }, Error), ERR_MODULE_NOT_FOUND = createError(`ERR_MODULE_NOT_FOUND`, (e, t, n = !1) => `Cannot find ${n ? `module` : `package`} '${e}' imported from ${t}`, Error);
101
- createError(`ERR_NETWORK_IMPORT_DISALLOWED`, `import of '%s' by %s is not supported: %s`, Error);
102
- const ERR_PACKAGE_IMPORT_NOT_DEFINED = createError(`ERR_PACKAGE_IMPORT_NOT_DEFINED`, (e, t, n) => `Package import specifier "${e}" is not defined${t ? ` in package ${t || ``}package.json` : ``} imported from ${n}`, TypeError), ERR_PACKAGE_PATH_NOT_EXPORTED = createError(`ERR_PACKAGE_PATH_NOT_EXPORTED`, (e, t, n) => t === `.` ? `No "exports" main defined in ${e}package.json${n ? ` imported from ${n}` : ``}` : `Package subpath '${t}' is not defined by "exports" in ${e}package.json${n ? ` imported from ${n}` : ``}`, Error), ERR_UNSUPPORTED_DIR_IMPORT = createError(`ERR_UNSUPPORTED_DIR_IMPORT`, `Directory import '%s' is not supported resolving ES modules imported from %s`, Error), ERR_UNSUPPORTED_RESOLVE_REQUEST = createError(`ERR_UNSUPPORTED_RESOLVE_REQUEST`, `Failed to resolve module specifier "%s" from "%s": Invalid relative URL or base scheme is not hierarchical.`, TypeError), ERR_UNKNOWN_FILE_EXTENSION = createError(`ERR_UNKNOWN_FILE_EXTENSION`, (e, t) => `Unknown file extension "${e}" for ${t}`, TypeError);
103
- createError(`ERR_INVALID_ARG_VALUE`, (e, t, n = `is invalid`) => {
104
- let r = inspect(t);
99
+ return t === `.` ? (l.ok(r === !1), `Invalid "exports" main target ${JSON.stringify(n)} defined in the package config ${e}package.json${i ? ` imported from ${i}` : ``}${a ? `; targets must start with "./"` : ``}`) : `Invalid "${r ? `imports` : `exports`}" target ${JSON.stringify(n)} defined for '${t}' in the package config ${e}package.json${i ? ` imported from ${i}` : ``}${a ? `; targets must start with "./"` : ``}`;
100
+ }, Error), T = b(`ERR_MODULE_NOT_FOUND`, (e, t, n = !1) => `Cannot find ${n ? `module` : `package`} '${e}' imported from ${t}`, Error);
101
+ b(`ERR_NETWORK_IMPORT_DISALLOWED`, `import of '%s' by %s is not supported: %s`, Error);
102
+ const E = b(`ERR_PACKAGE_IMPORT_NOT_DEFINED`, (e, t, n) => `Package import specifier "${e}" is not defined${t ? ` in package ${t || ``}package.json` : ``} imported from ${n}`, TypeError), D = b(`ERR_PACKAGE_PATH_NOT_EXPORTED`, (e, t, n) => t === `.` ? `No "exports" main defined in ${e}package.json${n ? ` imported from ${n}` : ``}` : `Package subpath '${t}' is not defined by "exports" in ${e}package.json${n ? ` imported from ${n}` : ``}`, Error), O = b(`ERR_UNSUPPORTED_DIR_IMPORT`, `Directory import '%s' is not supported resolving ES modules imported from %s`, Error), k = b(`ERR_UNSUPPORTED_RESOLVE_REQUEST`, `Failed to resolve module specifier "%s" from "%s": Invalid relative URL or base scheme is not hierarchical.`, TypeError), oe = b(`ERR_UNKNOWN_FILE_EXTENSION`, (e, t) => `Unknown file extension "${e}" for ${t}`, TypeError);
103
+ b(`ERR_INVALID_ARG_VALUE`, (e, t, n = `is invalid`) => {
104
+ let r = p(t);
105
105
  return r.length > 128 && (r = `${r.slice(0, 128)}...`), `The ${e.includes(`.`) ? `property` : `argument`} '${e}' ${n}. Received ${r}`;
106
106
  }, TypeError);
107
- const hasOwnProperty$1 = {}.hasOwnProperty, cache = /* @__PURE__ */ new Map();
108
- function read(t, { base: n, specifier: r }) {
109
- let i = cache.get(t);
107
+ const A = {}.hasOwnProperty, j = /* @__PURE__ */ new Map();
108
+ function M(t, { base: n, specifier: r }) {
109
+ let i = j.get(t);
110
110
  if (i) return i;
111
111
  let o;
112
112
  try {
113
- o = fs.readFileSync(path.toNamespacedPath(t), `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;
@@ -129,28 +129,28 @@ function read(t, { base: n, specifier: r }) {
129
129
  try {
130
130
  e = JSON.parse(o);
131
131
  } catch (e) {
132
- let i = new ERR_INVALID_PACKAGE_CONFIG(t, (n ? `"${r}" from ` : ``) + fileURLToPath(n || r), e.message);
132
+ let i = new w(t, (n ? `"${r}" from ` : ``) + a(n || r), e.message);
133
133
  throw i.cause = e, i;
134
134
  }
135
- c.exists = !0, hasOwnProperty$1.call(e, `name`) && typeof e.name == `string` && (c.name = e.name), hasOwnProperty$1.call(e, `main`) && typeof e.main == `string` && (c.main = e.main), hasOwnProperty$1.call(e, `exports`) && (c.exports = e.exports), hasOwnProperty$1.call(e, `imports`) && (c.imports = e.imports), hasOwnProperty$1.call(e, `type`) && (e.type === `commonjs` || e.type === `module`) && (c.type = e.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 cache.set(t, c), c;
137
+ return j.set(t, c), c;
138
138
  }
139
- function getPackageScopeConfig(e) {
139
+ function N(e) {
140
140
  let t = new URL(`package.json`, e);
141
141
  for (; !t.pathname.endsWith(`node_modules/package.json`);) {
142
- let n = read(fileURLToPath(t), { specifier: e });
142
+ let n = M(a(t), { specifier: e });
143
143
  if (n.exists) return n;
144
144
  let r = t;
145
145
  if (t = new URL(`../package.json`, t), t.pathname === r.pathname) break;
146
146
  }
147
147
  return {
148
- pjsonPath: fileURLToPath(t),
148
+ pjsonPath: a(t),
149
149
  exists: !1,
150
150
  type: `none`
151
151
  };
152
152
  }
153
- const hasOwnProperty = {}.hasOwnProperty, extensionFormatMap = {
153
+ const se = {}.hasOwnProperty, ce = {
154
154
  __proto__: null,
155
155
  ".json": `json`,
156
156
  ".cjs": `commonjs`,
@@ -159,24 +159,24 @@ const hasOwnProperty = {}.hasOwnProperty, extensionFormatMap = {
159
159
  ".ts": `module`,
160
160
  ".mts": `module`,
161
161
  ".mjs": `module`
162
- }, protocolHandlers = {
162
+ }, P = {
163
163
  __proto__: null,
164
- "data:": getDataProtocolModuleFormat,
165
- "file:": getFileProtocolModuleFormat,
164
+ "data:": ue,
165
+ "file:": fe,
166
166
  "node:": () => `builtin`
167
167
  };
168
- function mimeToFormat(e) {
168
+ function le(e) {
169
169
  return e && /\s*(text|application)\/javascript\s*(;\s*charset=utf-?8\s*)?/i.test(e) ? `module` : e === `application/json` ? `json` : null;
170
170
  }
171
- function getDataProtocolModuleFormat(e) {
171
+ function ue(e) {
172
172
  let { 1: t } = /^([^/]+\/[^;,]+)[^,]*?(;base64)?,/.exec(e.pathname) || [
173
173
  null,
174
174
  null,
175
175
  null
176
176
  ];
177
- return mimeToFormat(t);
177
+ return le(t);
178
178
  }
179
- function extname(e) {
179
+ function de(e) {
180
180
  let t = e.pathname, n = t.length;
181
181
  for (; n--;) {
182
182
  let e = t.codePointAt(n);
@@ -185,48 +185,48 @@ function extname(e) {
185
185
  }
186
186
  return ``;
187
187
  }
188
- function getFileProtocolModuleFormat(e, t, n) {
189
- let r = extname(e);
188
+ function fe(e, t, n) {
189
+ let r = de(e);
190
190
  if (r === `.js`) {
191
- let { type: t } = getPackageScopeConfig(e);
191
+ let { type: t } = N(e);
192
192
  return t === `none` ? `commonjs` : t;
193
193
  }
194
194
  if (r === ``) {
195
- let { type: t } = getPackageScopeConfig(e);
195
+ let { type: t } = N(e);
196
196
  return t === `none` || t === `commonjs` ? `commonjs` : `module`;
197
197
  }
198
- let i = extensionFormatMap[r];
198
+ let i = ce[r];
199
199
  if (i) return i;
200
- if (!n) throw new ERR_UNKNOWN_FILE_EXTENSION(r, fileURLToPath(e));
200
+ if (!n) throw new oe(r, a(e));
201
201
  }
202
- function defaultGetFormatWithoutErrors(e, t) {
202
+ function pe(e, t) {
203
203
  let n = e.protocol;
204
- return hasOwnProperty.call(protocolHandlers, n) && protocolHandlers[n](e, t, !0) || null;
204
+ return se.call(P, n) && P[n](e, t, !0) || null;
205
205
  }
206
- const RegExpPrototypeSymbolReplace = RegExp.prototype[Symbol.replace], own = {}.hasOwnProperty, invalidSegmentRegEx = /(^|\\|\/)((\.|%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, deprecatedInvalidSegmentRegEx = /(^|\\|\/)((\.|%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, invalidPackageNameRegEx = /^\.|%|\\/, patternRegEx = /\*/g, encodedSeparatorRegEx = /%2f|%5c/i, emittedPackageWarnings = /* @__PURE__ */ new Set(), doubleSlashRegEx = /[/\\]{2}/;
207
- function emitInvalidSegmentDeprecation(e, t, n, r, i, o, s) {
208
- if (process$1.noDeprecation) return;
209
- let c = fileURLToPath(r), l = doubleSlashRegEx.exec(s ? e : t) !== null;
210
- process$1.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 ${fileURLToPath(o)}` : ``}.`, `DeprecationWarning`, `DEP0166`);
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, t, n, r, i, o, s) {
208
+ if (u.noDeprecation) return;
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 emitLegacyIndexDeprecation(e, t, n, r) {
213
- if (process$1.noDeprecation || defaultGetFormatWithoutErrors(e, { parentURL: n.href }) !== `module`) return;
214
- let o = fileURLToPath(e.href), c = fileURLToPath(new URL$1(`.`, t)), l = fileURLToPath(n);
215
- r ? path.resolve(c, r) !== o && process$1.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`) : process$1.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
- function tryStatSync(e) {
217
+ function W(e) {
218
218
  try {
219
- return statSync(e);
219
+ return r(e);
220
220
  } catch {}
221
221
  }
222
- function fileExists(e) {
223
- let t = statSync(e, { throwIfNoEntry: !1 });
222
+ function G(e) {
223
+ let t = r(e, { throwIfNoEntry: !1 });
224
224
  return (t ? t.isFile() : void 0) ?? !1;
225
225
  }
226
- function legacyMainResolve(e, t, n) {
226
+ function ge(e, t, n) {
227
227
  let r;
228
228
  if (t.main !== void 0) {
229
- if (r = new URL$1(t.main, e), fileExists(r)) return r;
229
+ if (r = new i(t.main, e), G(r)) return r;
230
230
  let a = [
231
231
  `./${t.main}.js`,
232
232
  `./${t.main}.json`,
@@ -235,86 +235,86 @@ function legacyMainResolve(e, t, n) {
235
235
  `./${t.main}/index.json`,
236
236
  `./${t.main}/index.node`
237
237
  ], o = -1;
238
- for (; ++o < a.length && (r = new URL$1(a[o], e), !fileExists(r));) r = void 0;
239
- if (r) return emitLegacyIndexDeprecation(r, e, n, t.main), r;
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 && (r = new URL$1(o[s], e), !fileExists(r));) r = void 0;
247
- if (r) return emitLegacyIndexDeprecation(r, e, n, t.main), r;
248
- throw new ERR_MODULE_NOT_FOUND(fileURLToPath(new URL$1(`.`, e)), fileURLToPath(n));
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 finalizeResolution(e, t, r) {
251
- if (encodedSeparatorRegEx.exec(e.pathname) !== null) throw new ERR_INVALID_MODULE_SPECIFIER(e.pathname, String.raw`must not include encoded "/" or "\" characters`, fileURLToPath(t));
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
252
  let i;
253
253
  try {
254
- i = fileURLToPath(e);
254
+ i = a(e);
255
255
  } catch (n) {
256
256
  throw Object.defineProperty(n, `input`, { value: String(e) }), Object.defineProperty(n, `module`, { value: String(t) }), n;
257
257
  }
258
- let c = tryStatSync(i.endsWith(`/`) ? i.slice(-1) : i);
258
+ let c = W(i.endsWith(`/`) ? i.slice(-1) : i);
259
259
  if (c && c.isDirectory()) {
260
- let n = new ERR_UNSUPPORTED_DIR_IMPORT(i, fileURLToPath(t));
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 ERR_MODULE_NOT_FOUND(i || e.pathname, t && fileURLToPath(t), !0);
264
+ let n = new T(i || e.pathname, t && a(t), !0);
265
265
  throw n.url = String(e), n;
266
266
  }
267
267
  if (!r) {
268
- let t = realpathSync(i), { search: r, hash: a } = e;
269
- e = pathToFileURL(t + (i.endsWith(path.sep) ? `/` : ``)), e.search = r, e.hash = a;
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 importNotDefined(e, t, n) {
274
- return new ERR_PACKAGE_IMPORT_NOT_DEFINED(e, t && fileURLToPath(new URL$1(`.`, t)), fileURLToPath(n));
273
+ function ve(e, t, n) {
274
+ return new E(e, t && a(new i(`.`, t)), a(n));
275
275
  }
276
- function exportsNotFound(e, t, n) {
277
- return new ERR_PACKAGE_PATH_NOT_EXPORTED(fileURLToPath(new URL$1(`.`, t)), e, n && fileURLToPath(n));
276
+ function K(e, t, n) {
277
+ return new D(a(new i(`.`, t)), e, n && a(n));
278
278
  }
279
- function throwInvalidSubpath(e, t, n, r, i) {
280
- throw new ERR_INVALID_MODULE_SPECIFIER(e, `request is not a valid match in pattern "${t}" for the "${r ? `imports` : `exports`}" resolution of ${fileURLToPath(n)}`, i && fileURLToPath(i));
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 invalidPackageTarget(e, t, n, r, o) {
283
- return t = typeof t == `object` && t ? JSON.stringify(t, null, ``) : `${t}`, new ERR_INVALID_PACKAGE_TARGET(fileURLToPath(new URL$1(`.`, n)), e, t, r, o && fileURLToPath(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 resolvePackageTargetString(e, t, n, r, a, o, s, c, l) {
286
- if (t !== `` && !o && e.at(-1) !== `/`) throw invalidPackageTarget(n, e, r, s, a);
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
287
  if (!e.startsWith(`./`)) {
288
288
  if (s && !e.startsWith(`../`) && !e.startsWith(`/`)) {
289
289
  let n = !1;
290
290
  try {
291
- new URL$1(e), n = !0;
291
+ new i(e), n = !0;
292
292
  } catch {}
293
- if (!n) return packageResolve(o ? RegExpPrototypeSymbolReplace.call(patternRegEx, e, () => t) : e + t, r, l);
293
+ if (!n) return Z(o ? F.call(B, e, () => t) : e + t, r, l);
294
294
  }
295
- throw invalidPackageTarget(n, e, r, s, a);
295
+ throw q(n, e, r, s, a);
296
296
  }
297
- if (invalidSegmentRegEx.exec(e.slice(2)) !== null) if (deprecatedInvalidSegmentRegEx.exec(e.slice(2)) === null) {
297
+ if (L.exec(e.slice(2)) !== null) if (R.exec(e.slice(2)) === null) {
298
298
  if (!c) {
299
299
  let i = o ? n.replace(`*`, () => t) : n + t;
300
- emitInvalidSegmentDeprecation(o ? RegExpPrototypeSymbolReplace.call(patternRegEx, e, () => t) : e, i, n, r, s, a, !0);
300
+ H(o ? F.call(B, e, () => t) : e, i, n, r, s, a, !0);
301
301
  }
302
- } else throw invalidPackageTarget(n, e, r, s, a);
303
- let u = new URL$1(e, r), d = u.pathname, f = new URL$1(`.`, r).pathname;
304
- if (!d.startsWith(f)) throw invalidPackageTarget(n, e, r, 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
305
  if (t === ``) return u;
306
- if (invalidSegmentRegEx.exec(t) !== null) {
306
+ if (L.exec(t) !== null) {
307
307
  let i = o ? n.replace(`*`, () => t) : n + t;
308
- deprecatedInvalidSegmentRegEx.exec(t) === null ? c || emitInvalidSegmentDeprecation(o ? RegExpPrototypeSymbolReplace.call(patternRegEx, e, () => t) : e, i, n, r, s, a, !1) : throwInvalidSubpath(i, n, r, s, a);
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 URL$1(RegExpPrototypeSymbolReplace.call(patternRegEx, u.href, () => t)) : new URL$1(t, u);
310
+ return o ? new i(F.call(B, u.href, () => t)) : new i(t, u);
311
311
  }
312
- function isArrayIndex(e) {
312
+ function xe(e) {
313
313
  let t = Number(e);
314
314
  return `${t}` === e ? t >= 0 && t < 4294967295 : !1;
315
315
  }
316
- function resolvePackageTarget(e, t, n, r, i, o, s, c, l) {
317
- if (typeof t == `string`) return resolvePackageTargetString(t, n, r, e, i, o, s, c, l);
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
318
  if (Array.isArray(t)) {
319
319
  let a = t;
320
320
  if (a.length === 0) return null;
@@ -322,7 +322,7 @@ function resolvePackageTarget(e, t, n, r, i, o, s, c, l) {
322
322
  for (; ++d < a.length;) {
323
323
  let t = a[d], f;
324
324
  try {
325
- f = resolvePackageTarget(e, t, n, r, i, 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;
@@ -343,12 +343,12 @@ function resolvePackageTarget(e, t, n, r, i, o, s, c, l) {
343
343
  let u = Object.getOwnPropertyNames(t), d = -1;
344
344
  for (; ++d < u.length;) {
345
345
  let t = u[d];
346
- if (isArrayIndex(t)) throw new ERR_INVALID_PACKAGE_CONFIG(fileURLToPath(e), fileURLToPath(i), `"exports" cannot contain numeric property keys.`);
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
349
  let a = u[d];
350
350
  if (a === `default` || l && l.has(a)) {
351
- let u = t[a], d = resolvePackageTarget(e, u, n, r, i, o, s, c, l);
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
  }
@@ -356,59 +356,59 @@ function resolvePackageTarget(e, t, n, r, i, o, s, c, l) {
356
356
  return null;
357
357
  }
358
358
  if (t === null) return null;
359
- throw invalidPackageTarget(r, t, e, s, i);
359
+ throw q(r, t, e, s, i);
360
360
  }
361
- function isConditionalExportsMainSugar(e, t, n) {
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
364
  let r = Object.getOwnPropertyNames(e), i = !1, o = 0, s = -1;
365
365
  for (; ++s < r.length;) {
366
366
  let e = r[s], c = e === `` || e[0] !== `.`;
367
367
  if (o++ === 0) i = c;
368
- else if (i !== c) throw new ERR_INVALID_PACKAGE_CONFIG(fileURLToPath(t), fileURLToPath(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.`);
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
370
  return i;
371
371
  }
372
- function emitTrailingSlashPatternDeprecation(e, t, n) {
373
- if (process$1.noDeprecation) return;
374
- let r = fileURLToPath(t);
375
- emittedPackageWarnings.has(r + `|` + e) || (emittedPackageWarnings.add(r + `|` + e), process$1.emitWarning(`Use of deprecated trailing slash pattern mapping "${e}" in the "exports" field module resolution of the package at ${r}${n ? ` imported from ${fileURLToPath(n)}` : ``}. Mapping specifiers ending in "/" is no longer supported.`, `DeprecationWarning`, `DEP0155`));
372
+ function Ce(e, t, n) {
373
+ if (u.noDeprecation) return;
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
- function packageExportsResolve(e, t, n, r, i) {
377
+ function Y(e, t, n, r, i) {
378
378
  let a = n.exports;
379
- if (isConditionalExportsMainSugar(a, e, r) && (a = { ".": a }), own.call(a, t) && !t.includes(`*`) && !t.endsWith(`/`)) {
380
- let n = a[t], o = resolvePackageTarget(e, n, ``, t, r, !1, !1, !1, i);
381
- if (o == null) throw exportsNotFound(t, e, r);
379
+ if (Se(a, e, r) && (a = { ".": a }), I.call(a, t) && !t.includes(`*`) && !t.endsWith(`/`)) {
380
+ let n = a[t], o = J(e, n, ``, t, r, !1, !1, !1, i);
381
+ if (o == null) throw K(t, e, r);
382
382
  return o;
383
383
  }
384
384
  let o = ``, s = ``, c = Object.getOwnPropertyNames(a), l = -1;
385
385
  for (; ++l < c.length;) {
386
386
  let n = c[l], i = n.indexOf(`*`);
387
387
  if (i !== -1 && t.startsWith(n.slice(0, i))) {
388
- t.endsWith(`/`) && emitTrailingSlashPatternDeprecation(t, e, r);
388
+ t.endsWith(`/`) && Ce(t, e, r);
389
389
  let a = n.slice(i + 1);
390
- t.length >= n.length && t.endsWith(a) && patternKeyCompare(o, n) === 1 && n.lastIndexOf(`*`) === i && (o = n, s = t.slice(i, t.length - a.length));
390
+ t.length >= n.length && t.endsWith(a) && X(o, n) === 1 && n.lastIndexOf(`*`) === i && (o = n, s = t.slice(i, t.length - a.length));
391
391
  }
392
392
  }
393
393
  if (o) {
394
- let n = a[o], c = resolvePackageTarget(e, n, s, o, r, !0, !1, t.endsWith(`/`), i);
395
- if (c == null) throw exportsNotFound(t, e, r);
394
+ let n = a[o], c = J(e, n, s, o, r, !0, !1, t.endsWith(`/`), i);
395
+ if (c == null) throw K(t, e, r);
396
396
  return c;
397
397
  }
398
- throw exportsNotFound(t, e, r);
398
+ throw K(t, e, r);
399
399
  }
400
- function patternKeyCompare(e, t) {
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
402
  return i > a ? -1 : a > i || n === -1 ? 1 : r === -1 || e.length > t.length ? -1 : t.length > e.length ? 1 : 0;
403
403
  }
404
- function packageImportsResolve(e, t, n) {
405
- if (e === `#` || e.startsWith(`#/`) || e.endsWith(`/`)) throw new ERR_INVALID_MODULE_SPECIFIER(e, `is not a valid internal imports specifier name`, fileURLToPath(t));
406
- let r, i = getPackageScopeConfig(t);
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
407
  if (i.exists) {
408
- r = pathToFileURL(i.pjsonPath);
408
+ r = o(i.pjsonPath);
409
409
  let a = i.imports;
410
- if (a) if (own.call(a, e) && !e.includes(`*`)) {
411
- let i = resolvePackageTarget(r, a[e], ``, e, t, !1, !0, !1, n);
410
+ if (a) if (I.call(a, e) && !e.includes(`*`)) {
411
+ let i = J(r, a[e], ``, e, t, !1, !0, !1, n);
412
412
  if (i != null) return i;
413
413
  } else {
414
414
  let i = ``, o = ``, s = Object.getOwnPropertyNames(a), c = -1;
@@ -416,79 +416,79 @@ function packageImportsResolve(e, t, n) {
416
416
  let t = s[c], n = t.indexOf(`*`);
417
417
  if (n !== -1 && e.startsWith(t.slice(0, -1))) {
418
418
  let r = t.slice(n + 1);
419
- e.length >= t.length && e.endsWith(r) && patternKeyCompare(i, t) === 1 && t.lastIndexOf(`*`) === n && (i = t, o = e.slice(n, e.length - r.length));
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
422
  if (i) {
423
- let e = a[i], s = resolvePackageTarget(r, e, o, i, t, !0, !0, !1, n);
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 importNotDefined(e, r, t);
428
+ throw ve(e, r, t);
429
429
  }
430
- function parsePackageName(e, t) {
430
+ function Te(e, t) {
431
431
  let n = e.indexOf(`/`), r = !0, i = !1;
432
432
  e[0] === `@` && (i = !0, n === -1 || e.length === 0 ? r = !1 : n = e.indexOf(`/`, n + 1));
433
433
  let o = n === -1 ? e : e.slice(0, n);
434
- if (invalidPackageNameRegEx.exec(o) !== null && (r = !1), !r) throw new ERR_INVALID_MODULE_SPECIFIER(e, `is not a valid package name`, fileURLToPath(t));
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
437
  packageSubpath: `.` + (n === -1 ? `` : e.slice(n)),
438
438
  isScoped: i
439
439
  };
440
440
  }
441
- function packageResolve(e, t, n) {
442
- if (nodeBuiltins.includes(e)) return new URL$1(`node:` + e);
443
- let { packageName: r, packageSubpath: s, isScoped: c } = parsePackageName(e, t), l = getPackageScopeConfig(t);
444
- if (l.exists && l.name === r && l.exports !== void 0 && l.exports !== null) return packageExportsResolve(pathToFileURL(l.pjsonPath), s, l, t, n);
445
- let u = new URL$1(`./node_modules/` + r + `/package.json`, t), d = fileURLToPath(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 o = tryStatSync(d.slice(0, -13));
447
+ let o = W(d.slice(0, -13));
448
448
  if (!o || !o.isDirectory()) {
449
- f = d, u = new URL$1((c ? `../../../../node_modules/` : `../../../node_modules/`) + r + `/package.json`, u), d = fileURLToPath(u);
449
+ f = d, u = new i((c ? `../../../../node_modules/` : `../../../node_modules/`) + r + `/package.json`, u), d = a(u);
450
450
  continue;
451
451
  }
452
- let l = read(d, {
452
+ let l = M(d, {
453
453
  base: t,
454
454
  specifier: e
455
455
  });
456
- return l.exports !== void 0 && l.exports !== null ? packageExportsResolve(u, s, l, t, n) : s === `.` ? legacyMainResolve(u, l, t) : new URL$1(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 ERR_MODULE_NOT_FOUND(r, fileURLToPath(t), !1);
458
+ throw new T(r, a(t), !1);
459
459
  }
460
- function isRelativeSpecifier(e) {
460
+ function Ee(e) {
461
461
  return e[0] === `.` && (e.length === 1 || e[1] === `/` || e[1] === `.` && (e.length === 2 || e[2] === `/`));
462
462
  }
463
- function shouldBeTreatedAsRelativeOrAbsolutePath(e) {
464
- return e === `` ? !1 : e[0] === `/` ? !0 : isRelativeSpecifier(e);
463
+ function De(e) {
464
+ return e === `` ? !1 : e[0] === `/` ? !0 : Ee(e);
465
465
  }
466
- function moduleResolve(e, t, n, r) {
466
+ function Oe(e, t, n, r) {
467
467
  let a = t.protocol, o = a === `data:`, s;
468
- if (shouldBeTreatedAsRelativeOrAbsolutePath(e)) try {
469
- s = new URL$1(e, t);
468
+ if (De(e)) try {
469
+ s = new i(e, t);
470
470
  } catch (n) {
471
- let r = new ERR_UNSUPPORTED_RESOLVE_REQUEST(e, t);
471
+ let r = new k(e, t);
472
472
  throw r.cause = n, r;
473
473
  }
474
- else if (a === `file:` && e[0] === `#`) s = packageImportsResolve(e, t, n);
474
+ else if (a === `file:` && e[0] === `#`) s = we(e, t, n);
475
475
  else try {
476
- s = new URL$1(e);
476
+ s = new i(e);
477
477
  } catch (r) {
478
- if (o && !nodeBuiltins.includes(e)) {
479
- let n = new ERR_UNSUPPORTED_RESOLVE_REQUEST(e, t);
478
+ if (o && !m.includes(e)) {
479
+ let n = new k(e, t);
480
480
  throw n.cause = r, n;
481
481
  }
482
- s = packageResolve(e, t, n);
482
+ s = Z(e, t, n);
483
483
  }
484
- return assert.ok(s !== void 0, `expected to be defined`), s.protocol === `file:` ? finalizeResolution(s, t, r) : s;
484
+ return l.ok(s !== void 0, `expected to be defined`), s.protocol === `file:` ? _e(s, t, r) : s;
485
485
  }
486
- const DEFAULT_CONDITIONS_SET = new Set([`node`, `import`]), isWindows = process.platform === `win32`, globalCache = globalThis.__EXSOLVE_CACHE__ ||= /* @__PURE__ */ new Map();
487
- function resolveModuleURL(e, r) {
488
- let i = _parseInput(e);
486
+ const ke = new Set([`node`, `import`]), Ae = process.platform === `win32`, je = globalThis.__EXSOLVE_CACHE__ ||= /* @__PURE__ */ new Map();
487
+ function Q(e, r) {
488
+ let i = Be(e);
489
489
  if (`external` in i) return i.external;
490
490
  let a = i.specifier, s = i.url, c = i.absolutePath, l, u;
491
- if (r?.cache !== !1 && (l = _cacheKey(c || a, r), u = r?.cache && typeof r?.cache == `object` ? r.cache : globalCache), 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) {
@@ -497,62 +497,62 @@ function resolveModuleURL(e, r) {
497
497
  }
498
498
  }
499
499
  if (c) try {
500
- let e = lstatSync(c);
501
- if (e.isSymbolicLink() && (c = realpathSync(c), s = pathToFileURL(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 = r?.conditions ? new Set(r.conditions) : DEFAULT_CONDITIONS_SET, f = a || s.href, p = _normalizeBases(r?.from), m = r?.suffixes || [``], h = r?.extensions ? [``, ...r.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
- let n = _join(f, t);
508
+ let n = Re(f, t);
509
509
  n === `.` && (n += `/.`);
510
- for (let t of h) if (g = _tryModuleResolve(n + t, e, d), g) break;
510
+ for (let t of h) if (g = Ne(n + t, e, d), g) break;
511
511
  if (g) break;
512
512
  }
513
513
  if (g) break;
514
514
  }
515
515
  if (!g) {
516
- let t = Error(`Cannot resolve module "${e}" (from: ${p.map((e) => _fmtPath(e)).join(`, `)})`);
516
+ let t = Error(`Cannot resolve module "${e}" (from: ${p.map((e) => Ie(e)).join(`, `)})`);
517
517
  if (t.code = `ERR_MODULE_NOT_FOUND`, u && u.set(l, t), r?.try) return;
518
518
  throw t;
519
519
  }
520
520
  return u && u.set(l, g.href), g.href;
521
521
  }
522
- function resolveModulePath(e, t) {
523
- let n = resolveModuleURL(e, t);
522
+ function Me(e, t) {
523
+ let n = Q(e, t);
524
524
  if (!n || !n.startsWith(`file://`) && t?.try) return;
525
- let r = fileURLToPath(n);
526
- return isWindows ? _normalizeWinPath(r) : r;
525
+ let r = a(n);
526
+ return Ae ? ze(r) : r;
527
527
  }
528
- function _tryModuleResolve(e, t, n) {
528
+ function Ne(e, t, n) {
529
529
  try {
530
- return moduleResolve(e, t, n);
530
+ return Oe(e, t, n);
531
531
  } catch {}
532
532
  }
533
- function _normalizeBases(e) {
534
- let t = (Array.isArray(e) ? e : [e]).flatMap((e) => _normalizeBase(e));
535
- return t.length === 0 ? [pathToFileURL(`./`)] : t;
533
+ function Pe(e) {
534
+ let t = (Array.isArray(e) ? e : [e]).flatMap((e) => Fe(e));
535
+ return t.length === 0 ? [o(`./`)] : t;
536
536
  }
537
- function _normalizeBase(e) {
537
+ function Fe(e) {
538
538
  if (!e) return [];
539
- if (_isURL(e)) return [e];
539
+ if ($(e)) return [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(`/`) || statSync(e).isDirectory() ? pathToFileURL(e + `/`) : pathToFileURL(e);
543
+ return e.endsWith(`/`) || r(e).isDirectory() ? o(e + `/`) : o(e);
544
544
  } catch {
545
- return [pathToFileURL(e + `/`), pathToFileURL(e)];
545
+ return [o(e + `/`), o(e)];
546
546
  }
547
547
  }
548
- function _fmtPath(e) {
548
+ function Ie(e) {
549
549
  try {
550
- return fileURLToPath(e);
550
+ return a(e);
551
551
  } catch {
552
552
  return e;
553
553
  }
554
554
  }
555
- function _cacheKey(e, t) {
555
+ function Le(e, t) {
556
556
  return JSON.stringify([
557
557
  e,
558
558
  (t?.conditions || [`node`, `import`]).sort(),
@@ -561,33 +561,33 @@ function _cacheKey(e, t) {
561
561
  t?.suffixes
562
562
  ]);
563
563
  }
564
- function _join(e, t) {
564
+ function Re(e, t) {
565
565
  return !e || !t || t === `/` ? e : (e.endsWith(`/`) ? e : e + `/`) + (t.startsWith(`/`) ? t.slice(1) : t);
566
566
  }
567
- function _normalizeWinPath(e) {
567
+ function ze(e) {
568
568
  return e.replace(/\\/g, `/`).replace(/^[a-z]:\//, (e) => e.toUpperCase());
569
569
  }
570
- function _isURL(e) {
570
+ function $(e) {
571
571
  return e instanceof URL || e?.constructor?.name === `URL`;
572
572
  }
573
- function _parseInput(e) {
573
+ function Be(e) {
574
574
  if (typeof e == `string`) {
575
575
  if (e.startsWith(`file:`)) {
576
576
  let t = new URL(e);
577
577
  return {
578
578
  url: t,
579
- absolutePath: fileURLToPath(t)
579
+ absolutePath: a(t)
580
580
  };
581
581
  }
582
- return isAbsolute(e) ? {
583
- url: pathToFileURL(e),
582
+ return c(e) ? {
583
+ url: o(e),
584
584
  absolutePath: e
585
- } : /^(?:node|data|http|https):/.test(e) ? { external: e } : nodeBuiltins.includes(e) && !e.includes(`:`) ? { external: `node:${e}` } : { specifier: e };
585
+ } : /^(?:node|data|http|https):/.test(e) ? { external: e } : m.includes(e) && !e.includes(`:`) ? { external: `node:${e}` } : { specifier: e };
586
586
  }
587
- if (_isURL(e)) return e.protocol === `file:` ? {
587
+ if ($(e)) return e.protocol === `file:` ? {
588
588
  url: e,
589
- absolutePath: fileURLToPath(e)
589
+ absolutePath: a(e)
590
590
  } : { external: e.href };
591
591
  throw TypeError("id must be a `string` or `URL`");
592
592
  }
593
- export { resolveModulePath as t };
593
+ export { Me as t };