nitro-nightly 4.0.0-20251010-091516-7cafddba → 4.0.0-20251030-091344-d4418b98

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 (195) hide show
  1. package/dist/{_chunks/build2.mjs → _build/build.mjs} +108 -58
  2. package/dist/_build/build2.mjs +556 -0
  3. package/dist/_build/info.mjs +1002 -0
  4. package/dist/_build/prepare.mjs +1511 -0
  5. package/dist/_build/snapshot.mjs +185 -0
  6. package/dist/{_chunks/plugin.mjs → _build/vite.mjs} +295 -296
  7. package/dist/_build/vite2.mjs +149 -0
  8. package/dist/_chunks/_deps/@jridgewell/gen-mapping.mjs +189 -0
  9. package/dist/_chunks/_deps/@jridgewell/remapping.mjs +137 -0
  10. package/dist/_chunks/_deps/@jridgewell/resolve-uri.mjs +231 -0
  11. package/dist/_chunks/_deps/@jridgewell/sourcemap-codec.mjs +173 -0
  12. package/dist/_chunks/_deps/@jridgewell/trace-mapping.mjs +170 -0
  13. package/dist/_chunks/_deps/@pi0/vite-plugin-fullstack.mjs +575 -0
  14. package/dist/_chunks/_deps/@rollup/plugin-alias.mjs +89 -0
  15. package/dist/_chunks/_deps/@rollup/plugin-commonjs.mjs +2376 -0
  16. package/dist/_chunks/{index2.mjs → _deps/@rollup/plugin-inject.mjs} +5 -90
  17. package/dist/_chunks/_deps/@rollup/plugin-json.mjs +37 -0
  18. package/dist/_chunks/_deps/@rollup/plugin-node-resolve.mjs +1386 -0
  19. package/dist/_chunks/_deps/@rollup/plugin-replace.mjs +133 -0
  20. package/dist/_chunks/_deps/@rollup/pluginutils.mjs +346 -0
  21. package/dist/_chunks/_deps/acorn.mjs +6225 -0
  22. package/dist/_chunks/_deps/c12.mjs +510 -0
  23. package/dist/_chunks/_deps/chokidar.mjs +1428 -0
  24. package/dist/_chunks/_deps/citty.mjs +460 -0
  25. package/dist/_chunks/_deps/commondir.mjs +77 -0
  26. package/dist/_chunks/_deps/compatx.mjs +76 -0
  27. package/dist/_chunks/_deps/confbox.mjs +300 -0
  28. package/dist/_chunks/_deps/debug.mjs +885 -0
  29. package/dist/_chunks/_deps/deepmerge.mjs +147 -0
  30. package/dist/_chunks/_deps/depd.mjs +550 -0
  31. package/dist/_chunks/_deps/dot-prop.mjs +282 -0
  32. package/dist/_chunks/_deps/dotenv.mjs +555 -0
  33. package/dist/_chunks/_deps/duplexer.mjs +1 -0
  34. package/dist/_chunks/_deps/ee-first.mjs +104 -0
  35. package/dist/_chunks/_deps/encodeurl.mjs +69 -0
  36. package/dist/_chunks/_deps/escape-html.mjs +87 -0
  37. package/dist/_chunks/_deps/escape-string-regexp.mjs +13 -0
  38. package/dist/_chunks/_deps/estree-walker.mjs +433 -0
  39. package/dist/_chunks/_deps/etag.mjs +147 -0
  40. package/dist/_chunks/_deps/exsolve.mjs +1416 -0
  41. package/dist/_chunks/_deps/fdir.mjs +569 -0
  42. package/dist/_chunks/_deps/fresh.mjs +145 -0
  43. package/dist/_chunks/_deps/function-bind.mjs +106 -0
  44. package/dist/_chunks/{index4.mjs → _deps/giget.mjs} +21 -776
  45. package/dist/_chunks/_deps/gzip-size.mjs +19 -0
  46. package/dist/_chunks/_deps/hasown.mjs +19 -0
  47. package/dist/_chunks/_deps/http-errors.mjs +307 -0
  48. package/dist/_chunks/_deps/httpxy.mjs +580 -0
  49. package/dist/_chunks/_deps/inherits.mjs +57 -0
  50. package/dist/_chunks/_deps/is-core-module.mjs +596 -0
  51. package/dist/_chunks/_deps/is-module.mjs +25 -0
  52. package/dist/_chunks/_deps/is-reference.mjs +31 -0
  53. package/dist/_chunks/_deps/js-tokens.mjs +411 -0
  54. package/dist/_chunks/_deps/klona.mjs +137 -0
  55. package/dist/_chunks/_deps/knitwork.mjs +172 -0
  56. package/dist/_chunks/_deps/local-pkg.mjs +163 -0
  57. package/dist/_chunks/_deps/magic-string.mjs +1296 -0
  58. package/dist/_chunks/_deps/mime-db.mjs +11685 -0
  59. package/dist/_chunks/_deps/mime-types.mjs +287 -0
  60. package/dist/_chunks/_deps/mime.mjs +1172 -0
  61. package/dist/_chunks/_deps/mlly.mjs +2413 -0
  62. package/dist/_chunks/_deps/ms.mjs +172 -0
  63. package/dist/_chunks/_deps/node-fetch-native.mjs +3 -0
  64. package/dist/_chunks/_deps/nypm.mjs +219 -0
  65. package/dist/_chunks/_deps/on-finished.mjs +246 -0
  66. package/dist/_chunks/_deps/parseurl.mjs +168 -0
  67. package/dist/_chunks/_deps/path-parse.mjs +85 -0
  68. package/dist/_chunks/{pathe.M-eThtNZ.mjs → _deps/pathe.mjs} +48 -1
  69. package/dist/_chunks/_deps/perfect-debounce.mjs +88 -0
  70. package/dist/_chunks/_deps/picomatch.mjs +2144 -0
  71. package/dist/_chunks/_deps/pkg-types.mjs +247 -0
  72. package/dist/_chunks/{snapshot.mjs → _deps/pretty-bytes.mjs} +1 -105
  73. package/dist/_chunks/_deps/quansync.mjs +99 -0
  74. package/dist/_chunks/_deps/range-parser.mjs +171 -0
  75. package/dist/_chunks/_deps/rc9.mjs +219 -0
  76. package/dist/_chunks/_deps/readdirp.mjs +245 -0
  77. package/dist/_chunks/_deps/resolve.mjs +1260 -0
  78. package/dist/_chunks/_deps/rou3.mjs +326 -0
  79. package/dist/_chunks/_deps/send.mjs +1022 -0
  80. package/dist/_chunks/_deps/serve-static.mjs +228 -0
  81. package/dist/_chunks/_deps/setprototypeof.mjs +26 -0
  82. package/dist/_chunks/_deps/statuses.mjs +457 -0
  83. package/dist/_chunks/_deps/std-env.mjs +3 -0
  84. package/dist/_chunks/_deps/strip-literal.mjs +67 -0
  85. package/dist/_chunks/_deps/supports-color.mjs +44 -0
  86. package/dist/_chunks/_deps/tinyexec.mjs +552 -0
  87. package/dist/_chunks/_deps/tinyglobby.mjs +293 -0
  88. package/dist/_chunks/_deps/toidentifier.mjs +41 -0
  89. package/dist/_chunks/_deps/ultrahtml.mjs +3 -0
  90. package/dist/_chunks/_deps/unimport.mjs +2267 -0
  91. package/dist/_chunks/_deps/unplugin-utils.mjs +65 -0
  92. package/dist/_chunks/_deps/unplugin.mjs +1294 -0
  93. package/dist/_chunks/_deps/untyped.mjs +375 -0
  94. package/dist/_chunks/{info.mjs → _deps/unwasm.mjs} +8 -4206
  95. package/dist/_chunks/_deps/webpack-virtual-modules.mjs +360 -0
  96. package/dist/_chunks/_presets/_all.mjs +59 -0
  97. package/dist/_chunks/_presets/_nitro.mjs +74 -0
  98. package/dist/_chunks/_presets/_resolve.mjs +64 -0
  99. package/dist/_chunks/_presets/_static.mjs +69 -0
  100. package/dist/_chunks/_presets/_types.mjs +3 -0
  101. package/dist/_chunks/_presets/_utils.mjs +31 -0
  102. package/dist/_chunks/_presets/alwaysdata.mjs +17 -0
  103. package/dist/_chunks/_presets/aws-amplify.mjs +111 -0
  104. package/dist/_chunks/_presets/aws-lambda.mjs +23 -0
  105. package/dist/_chunks/_presets/azure.mjs +162 -0
  106. package/dist/_chunks/_presets/bun.mjs +19 -0
  107. package/dist/_chunks/_presets/cleavr.mjs +15 -0
  108. package/dist/_chunks/_presets/cloudflare.mjs +608 -0
  109. package/dist/_chunks/_presets/deno.mjs +196 -0
  110. package/dist/_chunks/_presets/digitalocean.mjs +14 -0
  111. package/dist/_chunks/_presets/firebase.mjs +47 -0
  112. package/dist/_chunks/_presets/flightcontrol.mjs +14 -0
  113. package/dist/_chunks/_presets/genezio.mjs +13 -0
  114. package/dist/_chunks/_presets/heroku.mjs +14 -0
  115. package/dist/_chunks/_presets/iis.mjs +194 -0
  116. package/dist/_chunks/_presets/index.mjs +62 -0
  117. package/dist/_chunks/_presets/koyeb.mjs +14 -0
  118. package/dist/_chunks/_presets/netlify.mjs +241 -0
  119. package/dist/_chunks/_presets/node.mjs +54 -0
  120. package/dist/_chunks/_presets/platform.mjs +14 -0
  121. package/dist/_chunks/_presets/render.mjs +14 -0
  122. package/dist/_chunks/_presets/standard.mjs +23 -0
  123. package/dist/_chunks/_presets/stormkit.mjs +18 -0
  124. package/dist/_chunks/_presets/vercel.mjs +375 -0
  125. package/dist/_chunks/_presets/winterjs.mjs +22 -0
  126. package/dist/_chunks/_presets/zeabur.mjs +69 -0
  127. package/dist/_chunks/_presets/zerops.mjs +27 -0
  128. package/dist/_chunks/app.mjs +9 -19206
  129. package/dist/_chunks/{index3.mjs → builder.mjs} +560 -970
  130. package/dist/_chunks/server.mjs +6 -4
  131. package/dist/{cli → _cli}/build.mjs +3 -8
  132. package/dist/{cli → _cli}/dev.mjs +38 -12
  133. package/dist/{cli/index2.mjs → _cli/index.mjs} +1 -2
  134. package/dist/{cli → _cli}/list.mjs +3 -4
  135. package/dist/{cli → _cli}/prepare.mjs +3 -4
  136. package/dist/{cli → _cli}/run.mjs +3 -4
  137. package/dist/{index.d.mts → builder.d.mts} +11 -11
  138. package/dist/builder.mjs +117 -0
  139. package/dist/cli/index.mjs +7 -464
  140. package/dist/node_modules/@speed-highlight/core/dist/index.js +1 -1
  141. package/dist/node_modules/@speed-highlight/core/dist/terminal.js +1 -1
  142. package/dist/node_modules/@speed-highlight/core/package.json +7 -3
  143. package/dist/node_modules/cookie-es/dist/index.mjs +262 -0
  144. package/dist/node_modules/cookie-es/package.json +37 -0
  145. package/dist/node_modules/hookable/dist/index.mjs +243 -266
  146. package/dist/node_modules/hookable/package.json +29 -26
  147. package/dist/node_modules/rendu/dist/index.mjs +380 -0
  148. package/dist/node_modules/rendu/package.json +47 -0
  149. package/dist/presets/_nitro/runtime/nitro-dev.mjs +4 -7
  150. package/dist/presets/_nitro/runtime/nitro-prerenderer.mjs +5 -4
  151. package/dist/presets/azure/runtime/azure-swa.mjs +1 -1
  152. package/dist/presets/cloudflare/runtime/_module-handler.mjs +7 -6
  153. package/dist/presets/cloudflare/runtime/cloudflare-durable.mjs +4 -5
  154. package/dist/presets/cloudflare/runtime/plugin.dev.mjs +7 -10
  155. package/dist/presets/cloudflare/runtime/shims/workers.dev.d.mts +21 -0
  156. package/dist/presets/cloudflare/runtime/shims/workers.dev.mjs +27 -0
  157. package/dist/presets/node/runtime/node-server.mjs +1 -1
  158. package/dist/runtime/index.d.mts +1 -1
  159. package/dist/runtime/index.mjs +1 -1
  160. package/dist/runtime/internal/app.d.mts +3 -1
  161. package/dist/runtime/internal/app.mjs +90 -64
  162. package/dist/runtime/internal/error/prod.d.mts +3 -2
  163. package/dist/runtime/internal/error/prod.mjs +9 -13
  164. package/dist/runtime/internal/renderer.mjs +4 -4
  165. package/dist/runtime/internal/routes/dev-tasks.d.mts +30 -2
  166. package/dist/runtime/internal/shutdown.d.mts +1 -2
  167. package/dist/runtime/internal/shutdown.mjs +3 -2
  168. package/dist/runtime/internal/task.mjs +1 -2
  169. package/dist/types/index.d.mts +1603 -10
  170. package/dist/vite.d.mts +5 -0
  171. package/dist/vite.mjs +94 -30
  172. package/lib/index.mjs +1 -0
  173. package/lib/indexd.mts +1 -0
  174. package/lib/runtime/meta.mjs +35 -0
  175. package/package.json +40 -41
  176. package/dist/_chunks/build.mjs +0 -84
  177. package/dist/_chunks/build3.mjs +0 -6452
  178. package/dist/_chunks/detect-acorn.mjs +0 -503
  179. package/dist/_chunks/index.mjs +0 -22242
  180. package/dist/_chunks/json5.mjs +0 -68
  181. package/dist/_chunks/jsonc.mjs +0 -51
  182. package/dist/_chunks/toml.mjs +0 -259
  183. package/dist/_chunks/yaml.mjs +0 -86
  184. package/dist/index.mjs +0 -55
  185. package/dist/node_modules/klona/dist/index.mjs +0 -81
  186. package/dist/node_modules/klona/full/index.mjs +0 -53
  187. package/dist/node_modules/klona/package.json +0 -74
  188. package/dist/node_modules/std-env/dist/index.mjs +0 -1
  189. package/dist/node_modules/std-env/package.json +0 -46
  190. package/dist/presets.mjs +0 -2460
  191. package/dist/runtime/internal/debug.d.mts +0 -2
  192. package/dist/runtime/internal/debug.mjs +0 -5
  193. package/lib/runtime-meta.mjs +0 -38
  194. /package/dist/{cli → _cli}/common.mjs +0 -0
  195. /package/lib/{runtime-meta.d.mts → runtime/meta.d.mts} +0 -0
@@ -0,0 +1,1260 @@
1
+ import { b as getAugmentedNamespace, a as getDefaultExportFromCjs } from './commondir.mjs';
2
+ import V__default from 'fs';
3
+ import require$$2 from 'os';
4
+ import sysPath__default from 'path';
5
+ import { r as requirePathParse } from './path-parse.mjs';
6
+ import { r as requireIsCoreModule } from './is-core-module.mjs';
7
+
8
+ var homedir;
9
+ var hasRequiredHomedir;
10
+
11
+ function requireHomedir () {
12
+ if (hasRequiredHomedir) return homedir;
13
+ hasRequiredHomedir = 1;
14
+
15
+ var os = require$$2;
16
+
17
+ // adapted from https://github.com/sindresorhus/os-homedir/blob/11e089f4754db38bb535e5a8416320c4446e8cfd/index.js
18
+
19
+ homedir = os.homedir || function homedir() {
20
+ var home = process.env.HOME;
21
+ var user = process.env.LOGNAME || process.env.USER || process.env.LNAME || process.env.USERNAME;
22
+
23
+ if (process.platform === 'win32') {
24
+ return process.env.USERPROFILE || process.env.HOMEDRIVE + process.env.HOMEPATH || home || null;
25
+ }
26
+
27
+ if (process.platform === 'darwin') {
28
+ return home || (user ? '/Users/' + user : null);
29
+ }
30
+
31
+ if (process.platform === 'linux') {
32
+ return home || (process.getuid() === 0 ? '/root' : (user ? '/home/' + user : null)); // eslint-disable-line no-extra-parens
33
+ }
34
+
35
+ return home || null;
36
+ };
37
+ return homedir;
38
+ }
39
+
40
+ var caller;
41
+ var hasRequiredCaller;
42
+
43
+ function requireCaller () {
44
+ if (hasRequiredCaller) return caller;
45
+ hasRequiredCaller = 1;
46
+ caller = function () {
47
+ // see https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi
48
+ var origPrepareStackTrace = Error.prepareStackTrace;
49
+ Error.prepareStackTrace = function (_, stack) { return stack; };
50
+ var stack = (new Error()).stack;
51
+ Error.prepareStackTrace = origPrepareStackTrace;
52
+ return stack[2].getFileName();
53
+ };
54
+ return caller;
55
+ }
56
+
57
+ var nodeModulesPaths;
58
+ var hasRequiredNodeModulesPaths;
59
+
60
+ function requireNodeModulesPaths () {
61
+ if (hasRequiredNodeModulesPaths) return nodeModulesPaths;
62
+ hasRequiredNodeModulesPaths = 1;
63
+ var path = sysPath__default;
64
+ var parse = path.parse || requirePathParse(); // eslint-disable-line global-require
65
+
66
+ var driveLetterRegex = /^([A-Za-z]:)/;
67
+ var uncPathRegex = /^\\\\/;
68
+
69
+ var getNodeModulesDirs = function getNodeModulesDirs(absoluteStart, modules) {
70
+ var prefix = '/';
71
+ if (driveLetterRegex.test(absoluteStart)) {
72
+ prefix = '';
73
+ } else if (uncPathRegex.test(absoluteStart)) {
74
+ prefix = '\\\\';
75
+ }
76
+
77
+ var paths = [absoluteStart];
78
+ var parsed = parse(absoluteStart);
79
+ while (parsed.dir !== paths[paths.length - 1]) {
80
+ paths.push(parsed.dir);
81
+ parsed = parse(parsed.dir);
82
+ }
83
+
84
+ return paths.reduce(function (dirs, aPath) {
85
+ return dirs.concat(modules.map(function (moduleDir) {
86
+ return path.resolve(prefix, aPath, moduleDir);
87
+ }));
88
+ }, []);
89
+ };
90
+
91
+ nodeModulesPaths = function nodeModulesPaths(start, opts, request) {
92
+ var modules = opts && opts.moduleDirectory
93
+ ? [].concat(opts.moduleDirectory)
94
+ : ['node_modules'];
95
+
96
+ if (opts && typeof opts.paths === 'function') {
97
+ return opts.paths(
98
+ request,
99
+ start,
100
+ function () { return getNodeModulesDirs(start, modules); },
101
+ opts
102
+ );
103
+ }
104
+
105
+ var dirs = getNodeModulesDirs(start, modules);
106
+ return opts && opts.paths ? dirs.concat(opts.paths) : dirs;
107
+ };
108
+ return nodeModulesPaths;
109
+ }
110
+
111
+ var normalizeOptions;
112
+ var hasRequiredNormalizeOptions;
113
+
114
+ function requireNormalizeOptions () {
115
+ if (hasRequiredNormalizeOptions) return normalizeOptions;
116
+ hasRequiredNormalizeOptions = 1;
117
+ normalizeOptions = function (x, opts) {
118
+ /**
119
+ * This file is purposefully a passthrough. It's expected that third-party
120
+ * environments will override it at runtime in order to inject special logic
121
+ * into `resolve` (by manipulating the options). One such example is the PnP
122
+ * code path in Yarn.
123
+ */
124
+
125
+ return opts || {};
126
+ };
127
+ return normalizeOptions;
128
+ }
129
+
130
+ var async;
131
+ var hasRequiredAsync;
132
+
133
+ function requireAsync () {
134
+ if (hasRequiredAsync) return async;
135
+ hasRequiredAsync = 1;
136
+ var fs = V__default;
137
+ var getHomedir = requireHomedir();
138
+ var path = sysPath__default;
139
+ var caller = requireCaller();
140
+ var nodeModulesPaths = requireNodeModulesPaths();
141
+ var normalizeOptions = requireNormalizeOptions();
142
+ var isCore = /*@__PURE__*/ requireIsCoreModule();
143
+
144
+ var realpathFS = process.platform !== 'win32' && fs.realpath && typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath;
145
+
146
+ var relativePathRegex = /^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/;
147
+ var windowsDriveRegex = /^\w:[/\\]*$/;
148
+ var nodeModulesRegex = /[/\\]node_modules[/\\]*$/;
149
+
150
+ var homedir = getHomedir();
151
+ var defaultPaths = function () {
152
+ return [
153
+ path.join(homedir, '.node_modules'),
154
+ path.join(homedir, '.node_libraries')
155
+ ];
156
+ };
157
+
158
+ var defaultIsFile = function isFile(file, cb) {
159
+ fs.stat(file, function (err, stat) {
160
+ if (!err) {
161
+ return cb(null, stat.isFile() || stat.isFIFO());
162
+ }
163
+ if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false);
164
+ return cb(err);
165
+ });
166
+ };
167
+
168
+ var defaultIsDir = function isDirectory(dir, cb) {
169
+ fs.stat(dir, function (err, stat) {
170
+ if (!err) {
171
+ return cb(null, stat.isDirectory());
172
+ }
173
+ if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false);
174
+ return cb(err);
175
+ });
176
+ };
177
+
178
+ var defaultRealpath = function realpath(x, cb) {
179
+ realpathFS(x, function (realpathErr, realPath) {
180
+ if (realpathErr && realpathErr.code !== 'ENOENT') cb(realpathErr);
181
+ else cb(null, realpathErr ? x : realPath);
182
+ });
183
+ };
184
+
185
+ var maybeRealpath = function maybeRealpath(realpath, x, opts, cb) {
186
+ if (opts && opts.preserveSymlinks === false) {
187
+ realpath(x, cb);
188
+ } else {
189
+ cb(null, x);
190
+ }
191
+ };
192
+
193
+ var defaultReadPackage = function defaultReadPackage(readFile, pkgfile, cb) {
194
+ readFile(pkgfile, function (readFileErr, body) {
195
+ if (readFileErr) cb(readFileErr);
196
+ else {
197
+ try {
198
+ var pkg = JSON.parse(body);
199
+ cb(null, pkg);
200
+ } catch (jsonErr) {
201
+ cb(null);
202
+ }
203
+ }
204
+ });
205
+ };
206
+
207
+ var getPackageCandidates = function getPackageCandidates(x, start, opts) {
208
+ var dirs = nodeModulesPaths(start, opts, x);
209
+ for (var i = 0; i < dirs.length; i++) {
210
+ dirs[i] = path.join(dirs[i], x);
211
+ }
212
+ return dirs;
213
+ };
214
+
215
+ async = function resolve(x, options, callback) {
216
+ var cb = callback;
217
+ var opts = options;
218
+ if (typeof options === 'function') {
219
+ cb = opts;
220
+ opts = {};
221
+ }
222
+ if (typeof x !== 'string') {
223
+ var err = new TypeError('Path must be a string.');
224
+ return process.nextTick(function () {
225
+ cb(err);
226
+ });
227
+ }
228
+
229
+ opts = normalizeOptions(x, opts);
230
+
231
+ var isFile = opts.isFile || defaultIsFile;
232
+ var isDirectory = opts.isDirectory || defaultIsDir;
233
+ var readFile = opts.readFile || fs.readFile;
234
+ var realpath = opts.realpath || defaultRealpath;
235
+ var readPackage = opts.readPackage || defaultReadPackage;
236
+ if (opts.readFile && opts.readPackage) {
237
+ var conflictErr = new TypeError('`readFile` and `readPackage` are mutually exclusive.');
238
+ return process.nextTick(function () {
239
+ cb(conflictErr);
240
+ });
241
+ }
242
+ var packageIterator = opts.packageIterator;
243
+
244
+ var extensions = opts.extensions || ['.js'];
245
+ var includeCoreModules = opts.includeCoreModules !== false;
246
+ var basedir = opts.basedir || path.dirname(caller());
247
+ var parent = opts.filename || basedir;
248
+
249
+ opts.paths = opts.paths || defaultPaths();
250
+
251
+ // ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory
252
+ var absoluteStart = path.resolve(basedir);
253
+
254
+ maybeRealpath(
255
+ realpath,
256
+ absoluteStart,
257
+ opts,
258
+ function (err, realStart) {
259
+ if (err) cb(err);
260
+ else init(realStart);
261
+ }
262
+ );
263
+
264
+ var res;
265
+ function init(basedir) {
266
+ if (relativePathRegex.test(x)) {
267
+ res = path.resolve(basedir, x);
268
+ if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/';
269
+ if (x.slice(-1) === '/' && res === basedir) {
270
+ loadAsDirectory(res, opts.package, onfile);
271
+ } else loadAsFile(res, opts.package, onfile);
272
+ } else if (includeCoreModules && isCore(x)) {
273
+ return cb(null, x);
274
+ } else loadNodeModules(x, basedir, function (err, n, pkg) {
275
+ if (err) cb(err);
276
+ else if (n) {
277
+ return maybeRealpath(realpath, n, opts, function (err, realN) {
278
+ if (err) {
279
+ cb(err);
280
+ } else {
281
+ cb(null, realN, pkg);
282
+ }
283
+ });
284
+ } else {
285
+ var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'");
286
+ moduleError.code = 'MODULE_NOT_FOUND';
287
+ cb(moduleError);
288
+ }
289
+ });
290
+ }
291
+
292
+ function onfile(err, m, pkg) {
293
+ if (err) cb(err);
294
+ else if (m) cb(null, m, pkg);
295
+ else loadAsDirectory(res, function (err, d, pkg) {
296
+ if (err) cb(err);
297
+ else if (d) {
298
+ maybeRealpath(realpath, d, opts, function (err, realD) {
299
+ if (err) {
300
+ cb(err);
301
+ } else {
302
+ cb(null, realD, pkg);
303
+ }
304
+ });
305
+ } else {
306
+ var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'");
307
+ moduleError.code = 'MODULE_NOT_FOUND';
308
+ cb(moduleError);
309
+ }
310
+ });
311
+ }
312
+
313
+ function loadAsFile(x, thePackage, callback) {
314
+ var loadAsFilePackage = thePackage;
315
+ var cb = callback;
316
+ if (typeof loadAsFilePackage === 'function') {
317
+ cb = loadAsFilePackage;
318
+ loadAsFilePackage = undefined;
319
+ }
320
+
321
+ var exts = [''].concat(extensions);
322
+ load(exts, x, loadAsFilePackage);
323
+
324
+ function load(exts, x, loadPackage) {
325
+ if (exts.length === 0) return cb(null, undefined, loadPackage);
326
+ var file = x + exts[0];
327
+
328
+ var pkg = loadPackage;
329
+ if (pkg) onpkg(null, pkg);
330
+ else loadpkg(path.dirname(file), onpkg);
331
+
332
+ function onpkg(err, pkg_, dir) {
333
+ pkg = pkg_;
334
+ if (err) return cb(err);
335
+ if (dir && pkg && opts.pathFilter) {
336
+ var rfile = path.relative(dir, file);
337
+ var rel = rfile.slice(0, rfile.length - exts[0].length);
338
+ var r = opts.pathFilter(pkg, x, rel);
339
+ if (r) return load(
340
+ [''].concat(extensions.slice()),
341
+ path.resolve(dir, r),
342
+ pkg
343
+ );
344
+ }
345
+ isFile(file, onex);
346
+ }
347
+ function onex(err, ex) {
348
+ if (err) return cb(err);
349
+ if (ex) return cb(null, file, pkg);
350
+ load(exts.slice(1), x, pkg);
351
+ }
352
+ }
353
+ }
354
+
355
+ function loadpkg(dir, cb) {
356
+ if (dir === '' || dir === '/') return cb(null);
357
+ if (process.platform === 'win32' && windowsDriveRegex.test(dir)) {
358
+ return cb(null);
359
+ }
360
+ if (nodeModulesRegex.test(dir)) return cb(null);
361
+
362
+ maybeRealpath(realpath, dir, opts, function (unwrapErr, pkgdir) {
363
+ if (unwrapErr) return loadpkg(path.dirname(dir), cb);
364
+ var pkgfile = path.join(pkgdir, 'package.json');
365
+ isFile(pkgfile, function (err, ex) {
366
+ // on err, ex is false
367
+ if (!ex) return loadpkg(path.dirname(dir), cb);
368
+
369
+ readPackage(readFile, pkgfile, function (err, pkgParam) {
370
+ if (err) cb(err);
371
+
372
+ var pkg = pkgParam;
373
+
374
+ if (pkg && opts.packageFilter) {
375
+ pkg = opts.packageFilter(pkg, pkgfile);
376
+ }
377
+ cb(null, pkg, dir);
378
+ });
379
+ });
380
+ });
381
+ }
382
+
383
+ function loadAsDirectory(x, loadAsDirectoryPackage, callback) {
384
+ var cb = callback;
385
+ var fpkg = loadAsDirectoryPackage;
386
+ if (typeof fpkg === 'function') {
387
+ cb = fpkg;
388
+ fpkg = opts.package;
389
+ }
390
+
391
+ maybeRealpath(realpath, x, opts, function (unwrapErr, pkgdir) {
392
+ if (unwrapErr) return cb(unwrapErr);
393
+ var pkgfile = path.join(pkgdir, 'package.json');
394
+ isFile(pkgfile, function (err, ex) {
395
+ if (err) return cb(err);
396
+ if (!ex) return loadAsFile(path.join(x, 'index'), fpkg, cb);
397
+
398
+ readPackage(readFile, pkgfile, function (err, pkgParam) {
399
+ if (err) return cb(err);
400
+
401
+ var pkg = pkgParam;
402
+
403
+ if (pkg && opts.packageFilter) {
404
+ pkg = opts.packageFilter(pkg, pkgfile);
405
+ }
406
+
407
+ if (pkg && pkg.main) {
408
+ if (typeof pkg.main !== 'string') {
409
+ var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string');
410
+ mainError.code = 'INVALID_PACKAGE_MAIN';
411
+ return cb(mainError);
412
+ }
413
+ if (pkg.main === '.' || pkg.main === './') {
414
+ pkg.main = 'index';
415
+ }
416
+ loadAsFile(path.resolve(x, pkg.main), pkg, function (err, m, pkg) {
417
+ if (err) return cb(err);
418
+ if (m) return cb(null, m, pkg);
419
+ if (!pkg) return loadAsFile(path.join(x, 'index'), pkg, cb);
420
+
421
+ var dir = path.resolve(x, pkg.main);
422
+ loadAsDirectory(dir, pkg, function (err, n, pkg) {
423
+ if (err) return cb(err);
424
+ if (n) return cb(null, n, pkg);
425
+ loadAsFile(path.join(x, 'index'), pkg, cb);
426
+ });
427
+ });
428
+ return;
429
+ }
430
+
431
+ loadAsFile(path.join(x, '/index'), pkg, cb);
432
+ });
433
+ });
434
+ });
435
+ }
436
+
437
+ function processDirs(cb, dirs) {
438
+ if (dirs.length === 0) return cb(null, undefined);
439
+ var dir = dirs[0];
440
+
441
+ isDirectory(path.dirname(dir), isdir);
442
+
443
+ function isdir(err, isdir) {
444
+ if (err) return cb(err);
445
+ if (!isdir) return processDirs(cb, dirs.slice(1));
446
+ loadAsFile(dir, opts.package, onfile);
447
+ }
448
+
449
+ function onfile(err, m, pkg) {
450
+ if (err) return cb(err);
451
+ if (m) return cb(null, m, pkg);
452
+ loadAsDirectory(dir, opts.package, ondir);
453
+ }
454
+
455
+ function ondir(err, n, pkg) {
456
+ if (err) return cb(err);
457
+ if (n) return cb(null, n, pkg);
458
+ processDirs(cb, dirs.slice(1));
459
+ }
460
+ }
461
+ function loadNodeModules(x, start, cb) {
462
+ var thunk = function () { return getPackageCandidates(x, start, opts); };
463
+ processDirs(
464
+ cb,
465
+ packageIterator ? packageIterator(x, start, thunk, opts) : thunk()
466
+ );
467
+ }
468
+ };
469
+ return async;
470
+ }
471
+
472
+ const assert = true;
473
+ const async_hooks = ">= 8";
474
+ const buffer_ieee754 = ">= 0.5 && < 0.9.7";
475
+ const buffer = true;
476
+ const child_process = true;
477
+ const cluster = ">= 0.5";
478
+ const console = true;
479
+ const constants = true;
480
+ const crypto = true;
481
+ const _debug_agent = ">= 1 && < 8";
482
+ const _debugger = "< 8";
483
+ const dgram = true;
484
+ const diagnostics_channel = [
485
+ ">= 14.17 && < 15",
486
+ ">= 15.1"
487
+ ];
488
+ const dns = true;
489
+ const domain = ">= 0.7.12";
490
+ const events = true;
491
+ const freelist = "< 6";
492
+ const fs = true;
493
+ const _http_agent = ">= 0.11.1";
494
+ const _http_client = ">= 0.11.1";
495
+ const _http_common = ">= 0.11.1";
496
+ const _http_incoming = ">= 0.11.1";
497
+ const _http_outgoing = ">= 0.11.1";
498
+ const _http_server = ">= 0.11.1";
499
+ const http = true;
500
+ const http2 = ">= 8.8";
501
+ const https = true;
502
+ const inspector = ">= 8";
503
+ const _linklist = "< 8";
504
+ const module = true;
505
+ const net = true;
506
+ const os = true;
507
+ const path = true;
508
+ const perf_hooks = ">= 8.5";
509
+ const process$1 = ">= 1";
510
+ const punycode = ">= 0.5";
511
+ const querystring = true;
512
+ const readline = true;
513
+ const repl = true;
514
+ const smalloc = ">= 0.11.5 && < 3";
515
+ const _stream_duplex = ">= 0.9.4";
516
+ const _stream_transform = ">= 0.9.4";
517
+ const _stream_wrap = ">= 1.4.1";
518
+ const _stream_passthrough = ">= 0.9.4";
519
+ const _stream_readable = ">= 0.9.4";
520
+ const _stream_writable = ">= 0.9.4";
521
+ const stream = true;
522
+ const string_decoder = true;
523
+ const sys = [
524
+ ">= 0.4 && < 0.7",
525
+ ">= 0.8"
526
+ ];
527
+ const timers = true;
528
+ const _tls_common = ">= 0.11.13";
529
+ const _tls_legacy = ">= 0.11.3 && < 10";
530
+ const _tls_wrap = ">= 0.11.3";
531
+ const tls = true;
532
+ const trace_events = ">= 10";
533
+ const tty = true;
534
+ const url = true;
535
+ const util = true;
536
+ const v8 = ">= 1";
537
+ const vm = true;
538
+ const wasi = [
539
+ ">= 13.4 && < 13.5",
540
+ ">= 18.17 && < 19",
541
+ ">= 20"
542
+ ];
543
+ const worker_threads = ">= 11.7";
544
+ const zlib = ">= 0.5";
545
+ const core = {
546
+ assert: assert,
547
+ "node:assert": [
548
+ ">= 14.18 && < 15",
549
+ ">= 16"
550
+ ],
551
+ "assert/strict": ">= 15",
552
+ "node:assert/strict": ">= 16",
553
+ async_hooks: async_hooks,
554
+ "node:async_hooks": [
555
+ ">= 14.18 && < 15",
556
+ ">= 16"
557
+ ],
558
+ buffer_ieee754: buffer_ieee754,
559
+ buffer: buffer,
560
+ "node:buffer": [
561
+ ">= 14.18 && < 15",
562
+ ">= 16"
563
+ ],
564
+ child_process: child_process,
565
+ "node:child_process": [
566
+ ">= 14.18 && < 15",
567
+ ">= 16"
568
+ ],
569
+ cluster: cluster,
570
+ "node:cluster": [
571
+ ">= 14.18 && < 15",
572
+ ">= 16"
573
+ ],
574
+ console: console,
575
+ "node:console": [
576
+ ">= 14.18 && < 15",
577
+ ">= 16"
578
+ ],
579
+ constants: constants,
580
+ "node:constants": [
581
+ ">= 14.18 && < 15",
582
+ ">= 16"
583
+ ],
584
+ crypto: crypto,
585
+ "node:crypto": [
586
+ ">= 14.18 && < 15",
587
+ ">= 16"
588
+ ],
589
+ _debug_agent: _debug_agent,
590
+ _debugger: _debugger,
591
+ dgram: dgram,
592
+ "node:dgram": [
593
+ ">= 14.18 && < 15",
594
+ ">= 16"
595
+ ],
596
+ diagnostics_channel: diagnostics_channel,
597
+ "node:diagnostics_channel": [
598
+ ">= 14.18 && < 15",
599
+ ">= 16"
600
+ ],
601
+ dns: dns,
602
+ "node:dns": [
603
+ ">= 14.18 && < 15",
604
+ ">= 16"
605
+ ],
606
+ "dns/promises": ">= 15",
607
+ "node:dns/promises": ">= 16",
608
+ domain: domain,
609
+ "node:domain": [
610
+ ">= 14.18 && < 15",
611
+ ">= 16"
612
+ ],
613
+ events: events,
614
+ "node:events": [
615
+ ">= 14.18 && < 15",
616
+ ">= 16"
617
+ ],
618
+ freelist: freelist,
619
+ fs: fs,
620
+ "node:fs": [
621
+ ">= 14.18 && < 15",
622
+ ">= 16"
623
+ ],
624
+ "fs/promises": [
625
+ ">= 10 && < 10.1",
626
+ ">= 14"
627
+ ],
628
+ "node:fs/promises": [
629
+ ">= 14.18 && < 15",
630
+ ">= 16"
631
+ ],
632
+ _http_agent: _http_agent,
633
+ "node:_http_agent": [
634
+ ">= 14.18 && < 15",
635
+ ">= 16"
636
+ ],
637
+ _http_client: _http_client,
638
+ "node:_http_client": [
639
+ ">= 14.18 && < 15",
640
+ ">= 16"
641
+ ],
642
+ _http_common: _http_common,
643
+ "node:_http_common": [
644
+ ">= 14.18 && < 15",
645
+ ">= 16"
646
+ ],
647
+ _http_incoming: _http_incoming,
648
+ "node:_http_incoming": [
649
+ ">= 14.18 && < 15",
650
+ ">= 16"
651
+ ],
652
+ _http_outgoing: _http_outgoing,
653
+ "node:_http_outgoing": [
654
+ ">= 14.18 && < 15",
655
+ ">= 16"
656
+ ],
657
+ _http_server: _http_server,
658
+ "node:_http_server": [
659
+ ">= 14.18 && < 15",
660
+ ">= 16"
661
+ ],
662
+ http: http,
663
+ "node:http": [
664
+ ">= 14.18 && < 15",
665
+ ">= 16"
666
+ ],
667
+ http2: http2,
668
+ "node:http2": [
669
+ ">= 14.18 && < 15",
670
+ ">= 16"
671
+ ],
672
+ https: https,
673
+ "node:https": [
674
+ ">= 14.18 && < 15",
675
+ ">= 16"
676
+ ],
677
+ inspector: inspector,
678
+ "node:inspector": [
679
+ ">= 14.18 && < 15",
680
+ ">= 16"
681
+ ],
682
+ "inspector/promises": [
683
+ ">= 19"
684
+ ],
685
+ "node:inspector/promises": [
686
+ ">= 19"
687
+ ],
688
+ _linklist: _linklist,
689
+ module: module,
690
+ "node:module": [
691
+ ">= 14.18 && < 15",
692
+ ">= 16"
693
+ ],
694
+ net: net,
695
+ "node:net": [
696
+ ">= 14.18 && < 15",
697
+ ">= 16"
698
+ ],
699
+ "node-inspect/lib/_inspect": ">= 7.6 && < 12",
700
+ "node-inspect/lib/internal/inspect_client": ">= 7.6 && < 12",
701
+ "node-inspect/lib/internal/inspect_repl": ">= 7.6 && < 12",
702
+ os: os,
703
+ "node:os": [
704
+ ">= 14.18 && < 15",
705
+ ">= 16"
706
+ ],
707
+ path: path,
708
+ "node:path": [
709
+ ">= 14.18 && < 15",
710
+ ">= 16"
711
+ ],
712
+ "path/posix": ">= 15.3",
713
+ "node:path/posix": ">= 16",
714
+ "path/win32": ">= 15.3",
715
+ "node:path/win32": ">= 16",
716
+ perf_hooks: perf_hooks,
717
+ "node:perf_hooks": [
718
+ ">= 14.18 && < 15",
719
+ ">= 16"
720
+ ],
721
+ process: process$1,
722
+ "node:process": [
723
+ ">= 14.18 && < 15",
724
+ ">= 16"
725
+ ],
726
+ punycode: punycode,
727
+ "node:punycode": [
728
+ ">= 14.18 && < 15",
729
+ ">= 16"
730
+ ],
731
+ querystring: querystring,
732
+ "node:querystring": [
733
+ ">= 14.18 && < 15",
734
+ ">= 16"
735
+ ],
736
+ readline: readline,
737
+ "node:readline": [
738
+ ">= 14.18 && < 15",
739
+ ">= 16"
740
+ ],
741
+ "readline/promises": ">= 17",
742
+ "node:readline/promises": ">= 17",
743
+ repl: repl,
744
+ "node:repl": [
745
+ ">= 14.18 && < 15",
746
+ ">= 16"
747
+ ],
748
+ "node:sea": [
749
+ ">= 20.12 && < 21",
750
+ ">= 21.7"
751
+ ],
752
+ smalloc: smalloc,
753
+ "node:sqlite": [
754
+ ">= 22.13 && < 23",
755
+ ">= 23.4"
756
+ ],
757
+ _stream_duplex: _stream_duplex,
758
+ "node:_stream_duplex": [
759
+ ">= 14.18 && < 15",
760
+ ">= 16"
761
+ ],
762
+ _stream_transform: _stream_transform,
763
+ "node:_stream_transform": [
764
+ ">= 14.18 && < 15",
765
+ ">= 16"
766
+ ],
767
+ _stream_wrap: _stream_wrap,
768
+ "node:_stream_wrap": [
769
+ ">= 14.18 && < 15",
770
+ ">= 16"
771
+ ],
772
+ _stream_passthrough: _stream_passthrough,
773
+ "node:_stream_passthrough": [
774
+ ">= 14.18 && < 15",
775
+ ">= 16"
776
+ ],
777
+ _stream_readable: _stream_readable,
778
+ "node:_stream_readable": [
779
+ ">= 14.18 && < 15",
780
+ ">= 16"
781
+ ],
782
+ _stream_writable: _stream_writable,
783
+ "node:_stream_writable": [
784
+ ">= 14.18 && < 15",
785
+ ">= 16"
786
+ ],
787
+ stream: stream,
788
+ "node:stream": [
789
+ ">= 14.18 && < 15",
790
+ ">= 16"
791
+ ],
792
+ "stream/consumers": ">= 16.7",
793
+ "node:stream/consumers": ">= 16.7",
794
+ "stream/promises": ">= 15",
795
+ "node:stream/promises": ">= 16",
796
+ "stream/web": ">= 16.5",
797
+ "node:stream/web": ">= 16.5",
798
+ string_decoder: string_decoder,
799
+ "node:string_decoder": [
800
+ ">= 14.18 && < 15",
801
+ ">= 16"
802
+ ],
803
+ sys: sys,
804
+ "node:sys": [
805
+ ">= 14.18 && < 15",
806
+ ">= 16"
807
+ ],
808
+ "test/reporters": ">= 19.9 && < 20.2",
809
+ "node:test/reporters": [
810
+ ">= 18.17 && < 19",
811
+ ">= 19.9",
812
+ ">= 20"
813
+ ],
814
+ "test/mock_loader": ">= 22.3 && < 22.7",
815
+ "node:test/mock_loader": ">= 22.3 && < 22.7",
816
+ "node:test": [
817
+ ">= 16.17 && < 17",
818
+ ">= 18"
819
+ ],
820
+ timers: timers,
821
+ "node:timers": [
822
+ ">= 14.18 && < 15",
823
+ ">= 16"
824
+ ],
825
+ "timers/promises": ">= 15",
826
+ "node:timers/promises": ">= 16",
827
+ _tls_common: _tls_common,
828
+ "node:_tls_common": [
829
+ ">= 14.18 && < 15",
830
+ ">= 16"
831
+ ],
832
+ _tls_legacy: _tls_legacy,
833
+ _tls_wrap: _tls_wrap,
834
+ "node:_tls_wrap": [
835
+ ">= 14.18 && < 15",
836
+ ">= 16"
837
+ ],
838
+ tls: tls,
839
+ "node:tls": [
840
+ ">= 14.18 && < 15",
841
+ ">= 16"
842
+ ],
843
+ trace_events: trace_events,
844
+ "node:trace_events": [
845
+ ">= 14.18 && < 15",
846
+ ">= 16"
847
+ ],
848
+ tty: tty,
849
+ "node:tty": [
850
+ ">= 14.18 && < 15",
851
+ ">= 16"
852
+ ],
853
+ url: url,
854
+ "node:url": [
855
+ ">= 14.18 && < 15",
856
+ ">= 16"
857
+ ],
858
+ util: util,
859
+ "node:util": [
860
+ ">= 14.18 && < 15",
861
+ ">= 16"
862
+ ],
863
+ "util/types": ">= 15.3",
864
+ "node:util/types": ">= 16",
865
+ "v8/tools/arguments": ">= 10 && < 12",
866
+ "v8/tools/codemap": [
867
+ ">= 4.4 && < 5",
868
+ ">= 5.2 && < 12"
869
+ ],
870
+ "v8/tools/consarray": [
871
+ ">= 4.4 && < 5",
872
+ ">= 5.2 && < 12"
873
+ ],
874
+ "v8/tools/csvparser": [
875
+ ">= 4.4 && < 5",
876
+ ">= 5.2 && < 12"
877
+ ],
878
+ "v8/tools/logreader": [
879
+ ">= 4.4 && < 5",
880
+ ">= 5.2 && < 12"
881
+ ],
882
+ "v8/tools/profile_view": [
883
+ ">= 4.4 && < 5",
884
+ ">= 5.2 && < 12"
885
+ ],
886
+ "v8/tools/splaytree": [
887
+ ">= 4.4 && < 5",
888
+ ">= 5.2 && < 12"
889
+ ],
890
+ v8: v8,
891
+ "node:v8": [
892
+ ">= 14.18 && < 15",
893
+ ">= 16"
894
+ ],
895
+ vm: vm,
896
+ "node:vm": [
897
+ ">= 14.18 && < 15",
898
+ ">= 16"
899
+ ],
900
+ wasi: wasi,
901
+ "node:wasi": [
902
+ ">= 18.17 && < 19",
903
+ ">= 20"
904
+ ],
905
+ worker_threads: worker_threads,
906
+ "node:worker_threads": [
907
+ ">= 14.18 && < 15",
908
+ ">= 16"
909
+ ],
910
+ zlib: zlib,
911
+ "node:zlib": [
912
+ ">= 14.18 && < 15",
913
+ ">= 16"
914
+ ]
915
+ };
916
+
917
+ const core$1 = {
918
+ __proto__: null,
919
+ _debug_agent: _debug_agent,
920
+ _debugger: _debugger,
921
+ _http_agent: _http_agent,
922
+ _http_client: _http_client,
923
+ _http_common: _http_common,
924
+ _http_incoming: _http_incoming,
925
+ _http_outgoing: _http_outgoing,
926
+ _http_server: _http_server,
927
+ _linklist: _linklist,
928
+ _stream_duplex: _stream_duplex,
929
+ _stream_passthrough: _stream_passthrough,
930
+ _stream_readable: _stream_readable,
931
+ _stream_transform: _stream_transform,
932
+ _stream_wrap: _stream_wrap,
933
+ _stream_writable: _stream_writable,
934
+ _tls_common: _tls_common,
935
+ _tls_legacy: _tls_legacy,
936
+ _tls_wrap: _tls_wrap,
937
+ assert: assert,
938
+ async_hooks: async_hooks,
939
+ buffer: buffer,
940
+ buffer_ieee754: buffer_ieee754,
941
+ child_process: child_process,
942
+ cluster: cluster,
943
+ console: console,
944
+ constants: constants,
945
+ crypto: crypto,
946
+ default: core,
947
+ dgram: dgram,
948
+ diagnostics_channel: diagnostics_channel,
949
+ dns: dns,
950
+ domain: domain,
951
+ events: events,
952
+ freelist: freelist,
953
+ fs: fs,
954
+ http: http,
955
+ http2: http2,
956
+ https: https,
957
+ inspector: inspector,
958
+ module: module,
959
+ net: net,
960
+ os: os,
961
+ path: path,
962
+ perf_hooks: perf_hooks,
963
+ process: process$1,
964
+ punycode: punycode,
965
+ querystring: querystring,
966
+ readline: readline,
967
+ repl: repl,
968
+ smalloc: smalloc,
969
+ stream: stream,
970
+ string_decoder: string_decoder,
971
+ sys: sys,
972
+ timers: timers,
973
+ tls: tls,
974
+ trace_events: trace_events,
975
+ tty: tty,
976
+ url: url,
977
+ util: util,
978
+ v8: v8,
979
+ vm: vm,
980
+ wasi: wasi,
981
+ worker_threads: worker_threads,
982
+ zlib: zlib
983
+ };
984
+
985
+ const require$$1 = /*@__PURE__*/getAugmentedNamespace(core$1);
986
+
987
+ var core_1;
988
+ var hasRequiredCore;
989
+
990
+ function requireCore () {
991
+ if (hasRequiredCore) return core_1;
992
+ hasRequiredCore = 1;
993
+
994
+ var isCoreModule = /*@__PURE__*/ requireIsCoreModule();
995
+ var data = require$$1;
996
+
997
+ var core = {};
998
+ for (var mod in data) { // eslint-disable-line no-restricted-syntax
999
+ if (Object.prototype.hasOwnProperty.call(data, mod)) {
1000
+ core[mod] = isCoreModule(mod);
1001
+ }
1002
+ }
1003
+ core_1 = core;
1004
+ return core_1;
1005
+ }
1006
+
1007
+ var isCore;
1008
+ var hasRequiredIsCore;
1009
+
1010
+ function requireIsCore () {
1011
+ if (hasRequiredIsCore) return isCore;
1012
+ hasRequiredIsCore = 1;
1013
+ var isCoreModule = /*@__PURE__*/ requireIsCoreModule();
1014
+
1015
+ isCore = function isCore(x) {
1016
+ return isCoreModule(x);
1017
+ };
1018
+ return isCore;
1019
+ }
1020
+
1021
+ var sync;
1022
+ var hasRequiredSync;
1023
+
1024
+ function requireSync () {
1025
+ if (hasRequiredSync) return sync;
1026
+ hasRequiredSync = 1;
1027
+ var isCore = /*@__PURE__*/ requireIsCoreModule();
1028
+ var fs = V__default;
1029
+ var path = sysPath__default;
1030
+ var getHomedir = requireHomedir();
1031
+ var caller = requireCaller();
1032
+ var nodeModulesPaths = requireNodeModulesPaths();
1033
+ var normalizeOptions = requireNormalizeOptions();
1034
+
1035
+ var realpathFS = process.platform !== 'win32' && fs.realpathSync && typeof fs.realpathSync.native === 'function' ? fs.realpathSync.native : fs.realpathSync;
1036
+
1037
+ var relativePathRegex = /^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/;
1038
+ var windowsDriveRegex = /^\w:[/\\]*$/;
1039
+ var nodeModulesRegex = /[/\\]node_modules[/\\]*$/;
1040
+
1041
+ var homedir = getHomedir();
1042
+ var defaultPaths = function () {
1043
+ return [
1044
+ path.join(homedir, '.node_modules'),
1045
+ path.join(homedir, '.node_libraries')
1046
+ ];
1047
+ };
1048
+
1049
+ var defaultIsFile = function isFile(file) {
1050
+ try {
1051
+ var stat = fs.statSync(file, { throwIfNoEntry: false });
1052
+ } catch (e) {
1053
+ if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false;
1054
+ throw e;
1055
+ }
1056
+ return !!stat && (stat.isFile() || stat.isFIFO());
1057
+ };
1058
+
1059
+ var defaultIsDir = function isDirectory(dir) {
1060
+ try {
1061
+ var stat = fs.statSync(dir, { throwIfNoEntry: false });
1062
+ } catch (e) {
1063
+ if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false;
1064
+ throw e;
1065
+ }
1066
+ return !!stat && stat.isDirectory();
1067
+ };
1068
+
1069
+ var defaultRealpathSync = function realpathSync(x) {
1070
+ try {
1071
+ return realpathFS(x);
1072
+ } catch (realpathErr) {
1073
+ if (realpathErr.code !== 'ENOENT') {
1074
+ throw realpathErr;
1075
+ }
1076
+ }
1077
+ return x;
1078
+ };
1079
+
1080
+ var maybeRealpathSync = function maybeRealpathSync(realpathSync, x, opts) {
1081
+ if (opts && opts.preserveSymlinks === false) {
1082
+ return realpathSync(x);
1083
+ }
1084
+ return x;
1085
+ };
1086
+
1087
+ var defaultReadPackageSync = function defaultReadPackageSync(readFileSync, pkgfile) {
1088
+ var body = readFileSync(pkgfile);
1089
+ try {
1090
+ var pkg = JSON.parse(body);
1091
+ return pkg;
1092
+ } catch (jsonErr) {}
1093
+ };
1094
+
1095
+ var getPackageCandidates = function getPackageCandidates(x, start, opts) {
1096
+ var dirs = nodeModulesPaths(start, opts, x);
1097
+ for (var i = 0; i < dirs.length; i++) {
1098
+ dirs[i] = path.join(dirs[i], x);
1099
+ }
1100
+ return dirs;
1101
+ };
1102
+
1103
+ sync = function resolveSync(x, options) {
1104
+ if (typeof x !== 'string') {
1105
+ throw new TypeError('Path must be a string.');
1106
+ }
1107
+ var opts = normalizeOptions(x, options);
1108
+
1109
+ var isFile = opts.isFile || defaultIsFile;
1110
+ var readFileSync = opts.readFileSync || fs.readFileSync;
1111
+ var isDirectory = opts.isDirectory || defaultIsDir;
1112
+ var realpathSync = opts.realpathSync || defaultRealpathSync;
1113
+ var readPackageSync = opts.readPackageSync || defaultReadPackageSync;
1114
+ if (opts.readFileSync && opts.readPackageSync) {
1115
+ throw new TypeError('`readFileSync` and `readPackageSync` are mutually exclusive.');
1116
+ }
1117
+ var packageIterator = opts.packageIterator;
1118
+
1119
+ var extensions = opts.extensions || ['.js'];
1120
+ var includeCoreModules = opts.includeCoreModules !== false;
1121
+ var basedir = opts.basedir || path.dirname(caller());
1122
+ var parent = opts.filename || basedir;
1123
+
1124
+ opts.paths = opts.paths || defaultPaths();
1125
+
1126
+ // ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory
1127
+ var absoluteStart = maybeRealpathSync(realpathSync, path.resolve(basedir), opts);
1128
+
1129
+ if (relativePathRegex.test(x)) {
1130
+ var res = path.resolve(absoluteStart, x);
1131
+ if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/';
1132
+ var m = loadAsFileSync(res) || loadAsDirectorySync(res);
1133
+ if (m) return maybeRealpathSync(realpathSync, m, opts);
1134
+ } else if (includeCoreModules && isCore(x)) {
1135
+ return x;
1136
+ } else {
1137
+ var n = loadNodeModulesSync(x, absoluteStart);
1138
+ if (n) return maybeRealpathSync(realpathSync, n, opts);
1139
+ }
1140
+
1141
+ var err = new Error("Cannot find module '" + x + "' from '" + parent + "'");
1142
+ err.code = 'MODULE_NOT_FOUND';
1143
+ throw err;
1144
+
1145
+ function loadAsFileSync(x) {
1146
+ var pkg = loadpkg(path.dirname(x));
1147
+
1148
+ if (pkg && pkg.dir && pkg.pkg && opts.pathFilter) {
1149
+ var rfile = path.relative(pkg.dir, x);
1150
+ var r = opts.pathFilter(pkg.pkg, x, rfile);
1151
+ if (r) {
1152
+ x = path.resolve(pkg.dir, r); // eslint-disable-line no-param-reassign
1153
+ }
1154
+ }
1155
+
1156
+ if (isFile(x)) {
1157
+ return x;
1158
+ }
1159
+
1160
+ for (var i = 0; i < extensions.length; i++) {
1161
+ var file = x + extensions[i];
1162
+ if (isFile(file)) {
1163
+ return file;
1164
+ }
1165
+ }
1166
+ }
1167
+
1168
+ function loadpkg(dir) {
1169
+ if (dir === '' || dir === '/') return;
1170
+ if (process.platform === 'win32' && windowsDriveRegex.test(dir)) {
1171
+ return;
1172
+ }
1173
+ if (nodeModulesRegex.test(dir)) return;
1174
+
1175
+ var pkgfile = path.join(maybeRealpathSync(realpathSync, dir, opts), 'package.json');
1176
+
1177
+ if (!isFile(pkgfile)) {
1178
+ return loadpkg(path.dirname(dir));
1179
+ }
1180
+
1181
+ var pkg = readPackageSync(readFileSync, pkgfile);
1182
+
1183
+ if (pkg && opts.packageFilter) {
1184
+ // v2 will pass pkgfile
1185
+ pkg = opts.packageFilter(pkg, /*pkgfile,*/ dir); // eslint-disable-line spaced-comment
1186
+ }
1187
+
1188
+ return { pkg: pkg, dir: dir };
1189
+ }
1190
+
1191
+ function loadAsDirectorySync(x) {
1192
+ var pkgfile = path.join(maybeRealpathSync(realpathSync, x, opts), '/package.json');
1193
+ if (isFile(pkgfile)) {
1194
+ try {
1195
+ var pkg = readPackageSync(readFileSync, pkgfile);
1196
+ } catch (e) {}
1197
+
1198
+ if (pkg && opts.packageFilter) {
1199
+ // v2 will pass pkgfile
1200
+ pkg = opts.packageFilter(pkg, /*pkgfile,*/ x); // eslint-disable-line spaced-comment
1201
+ }
1202
+
1203
+ if (pkg && pkg.main) {
1204
+ if (typeof pkg.main !== 'string') {
1205
+ var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string');
1206
+ mainError.code = 'INVALID_PACKAGE_MAIN';
1207
+ throw mainError;
1208
+ }
1209
+ if (pkg.main === '.' || pkg.main === './') {
1210
+ pkg.main = 'index';
1211
+ }
1212
+ try {
1213
+ var m = loadAsFileSync(path.resolve(x, pkg.main));
1214
+ if (m) return m;
1215
+ var n = loadAsDirectorySync(path.resolve(x, pkg.main));
1216
+ if (n) return n;
1217
+ } catch (e) {}
1218
+ }
1219
+ }
1220
+
1221
+ return loadAsFileSync(path.join(x, '/index'));
1222
+ }
1223
+
1224
+ function loadNodeModulesSync(x, start) {
1225
+ var thunk = function () { return getPackageCandidates(x, start, opts); };
1226
+ var dirs = packageIterator ? packageIterator(x, start, thunk, opts) : thunk();
1227
+
1228
+ for (var i = 0; i < dirs.length; i++) {
1229
+ var dir = dirs[i];
1230
+ if (isDirectory(path.dirname(dir))) {
1231
+ var m = loadAsFileSync(dir);
1232
+ if (m) return m;
1233
+ var n = loadAsDirectorySync(dir);
1234
+ if (n) return n;
1235
+ }
1236
+ }
1237
+ }
1238
+ };
1239
+ return sync;
1240
+ }
1241
+
1242
+ var resolve;
1243
+ var hasRequiredResolve;
1244
+
1245
+ function requireResolve () {
1246
+ if (hasRequiredResolve) return resolve;
1247
+ hasRequiredResolve = 1;
1248
+ var async = requireAsync();
1249
+ async.core = requireCore();
1250
+ async.isCore = requireIsCore();
1251
+ async.sync = requireSync();
1252
+
1253
+ resolve = async;
1254
+ return resolve;
1255
+ }
1256
+
1257
+ var resolveExports = requireResolve();
1258
+ const resolve$1 = /*@__PURE__*/getDefaultExportFromCjs(resolveExports);
1259
+
1260
+ export { resolve$1 as r };