nitro 3.0.260415-beta → 3.0.260429-beta

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 (50) hide show
  1. package/dist/THIRD-PARTY-LICENSES.md +32 -2
  2. package/dist/_build/common.mjs +43 -29
  3. package/dist/_build/rolldown.mjs +1 -1
  4. package/dist/_build/rollup.mjs +2 -2
  5. package/dist/_build/vite.build.mjs +1 -1
  6. package/dist/_chunks/nitro.mjs +5 -5
  7. package/dist/_chunks/nitro2.mjs +1 -1
  8. package/dist/_chunks/nitro3.mjs +1 -1
  9. package/dist/_chunks/nitro4.mjs +2 -2
  10. package/dist/_chunks/utils.mjs +2 -2
  11. package/dist/_common.mjs +1 -1
  12. package/dist/_dev.mjs +3 -2
  13. package/dist/_libs/c12+rc9.mjs +21 -9
  14. package/dist/_libs/hasown+resolve+deepmerge.mjs +47 -34
  15. package/dist/_libs/httpxy.d.mts +1 -3
  16. package/dist/_libs/httpxy.mjs +5 -5
  17. package/dist/_libs/nypm+tinyexec.mjs +129 -98
  18. package/dist/_libs/pkg-types.d.mts +7 -4
  19. package/dist/_libs/plugin-inject.mjs +3 -1
  20. package/dist/_libs/pluginutils.mjs +4 -2
  21. package/dist/_libs/readdirp+chokidar.mjs +2 -1
  22. package/dist/_libs/{unimport+unplugin.mjs → unimport+unplugin+oxc-parser.mjs} +49 -37
  23. package/dist/_libs/unplugin+unimport.d.mts +1 -1
  24. package/dist/_presets.mjs +2 -1
  25. package/dist/cli/_chunks/build.mjs +1 -1
  26. package/dist/cli/_chunks/deploy.mjs +1 -1
  27. package/dist/cli/_chunks/dev.mjs +1 -1
  28. package/dist/cli/_chunks/list.mjs +1 -1
  29. package/dist/cli/_chunks/prepare.mjs +1 -1
  30. package/dist/cli/_chunks/preview.mjs +1 -1
  31. package/dist/cli/_chunks/run.mjs +1 -1
  32. package/dist/docs/0.docs/5.cache.md +53 -9
  33. package/dist/node_modules/ufo/dist/index.mjs +2 -2
  34. package/dist/node_modules/ufo/package.json +9 -9
  35. package/dist/presets/azure/runtime/azure-swa.mjs +2 -0
  36. package/dist/runtime/internal/route-rules.d.mts +1 -0
  37. package/dist/runtime/internal/route-rules.mjs +29 -1
  38. package/dist/runtime/internal/routes/scalar.mjs +1 -0
  39. package/dist/types/index.d.mts +922 -64
  40. package/dist/vite.d.mts +1 -1
  41. package/dist/vite.mjs +11 -5
  42. package/package.json +28 -27
  43. package/dist/_libs/_.mjs +0 -2
  44. package/dist/_libs/_2.mjs +0 -2
  45. package/dist/_libs/_3.mjs +0 -2
  46. package/dist/_libs/_4.mjs +0 -2
  47. package/dist/_libs/_5.mjs +0 -2
  48. package/dist/_libs/_6.mjs +0 -2
  49. package/dist/_libs/_7.mjs +0 -2
  50. package/dist/_libs/escape-string-regexp.mjs +0 -5
@@ -367,11 +367,11 @@ Repository: https://github.com/TehShrike/deepmerge
367
367
 
368
368
  ---------------------------------------
369
369
 
370
- ## dot-prop, escape-string-regexp, gzip-size, pretty-bytes
370
+ ## dot-prop, gzip-size, pretty-bytes
371
371
 
372
372
  License: MIT
373
373
  By: Sindre Sorhus
374
- Repositories: https://github.com/sindresorhus/dot-prop, https://github.com/sindresorhus/escape-string-regexp, https://github.com/sindresorhus/gzip-size, https://github.com/sindresorhus/pretty-bytes
374
+ Repositories: https://github.com/sindresorhus/dot-prop, https://github.com/sindresorhus/gzip-size, https://github.com/sindresorhus/pretty-bytes
375
375
 
376
376
  > MIT License
377
377
  >
@@ -413,6 +413,36 @@ Repository: https://github.com/Raynos/duplexer
413
413
 
414
414
  ---------------------------------------
415
415
 
416
+ ## es-errors
417
+
418
+ License: MIT
419
+ By: Jordan Harband
420
+ Repository: https://github.com/ljharb/es-errors
421
+
422
+ > MIT License
423
+ >
424
+ > Copyright (c) 2024 Jordan Harband
425
+ >
426
+ > Permission is hereby granted, free of charge, to any person obtaining a copy
427
+ > of this software and associated documentation files (the "Software"), to deal
428
+ > in the Software without restriction, including without limitation the rights
429
+ > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
430
+ > copies of the Software, and to permit persons to whom the Software is
431
+ > furnished to do so, subject to the following conditions:
432
+ >
433
+ > The above copyright notice and this permission notice shall be included in all
434
+ > copies or substantial portions of the Software.
435
+ >
436
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
437
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
438
+ > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
439
+ > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
440
+ > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
441
+ > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
442
+ > SOFTWARE.
443
+
444
+ ---------------------------------------
445
+
416
446
  ## esbuild
417
447
 
418
448
  License: MIT
@@ -3995,12 +3995,12 @@ async function findFile$1(filename, _options = {}) {
3995
3995
  if (leadingSlash) segments[0] = "/" + segments[0];
3996
3996
  let root = segments.findIndex((r) => r.match(options.rootPattern));
3997
3997
  if (root === -1) root = 0;
3998
- if (options.reverse) for (let index = root + 1; index <= segments.length; index++) for (const filename2 of filenames) {
3999
- const filePath = join$2(...segments.slice(0, index), filename2);
3998
+ if (options.reverse) for (let index = root + 1; index <= segments.length; index++) for (const filename of filenames) {
3999
+ const filePath = join$2(...segments.slice(0, index), filename);
4000
4000
  if (await options.test(filePath)) return filePath;
4001
4001
  }
4002
- else for (let index = segments.length; index > root; index--) for (const filename2 of filenames) {
4003
- const filePath = join$2(...segments.slice(0, index), filename2);
4002
+ else for (let index = segments.length; index > root; index--) for (const filename of filenames) {
4003
+ const filePath = join$2(...segments.slice(0, index), filename);
4004
4004
  if (await options.test(filePath)) return filePath;
4005
4005
  }
4006
4006
  throw new Error(`Cannot find matching ${filename} in ${options.startingFrom} or parent directories`);
@@ -4267,6 +4267,20 @@ function I$2() {
4267
4267
  if (e) return { name: e[1] };
4268
4268
  }
4269
4269
  const R$1 = I$2()?.name || ``;
4270
+ function escapeRegExp$1(string) {
4271
+ return string.replace(/[-\\^$*+?.()|[\]{}]/g, String.raw`\$&`);
4272
+ }
4273
+ function pathRegExp(string) {
4274
+ if (S$3) string = string.replace(/\\/g, "/");
4275
+ let escaped = escapeRegExp$1(string);
4276
+ if (S$3) escaped = escaped.replace(/\//g, String.raw`[/\\]`);
4277
+ return escaped;
4278
+ }
4279
+ function toPathRegExp(input) {
4280
+ if (input instanceof RegExp) return input;
4281
+ if (typeof input === "string") return new RegExp(pathRegExp(input));
4282
+ throw new TypeError("Expected a string or RegExp", { cause: input });
4283
+ }
4270
4284
  const isObject$2 = (value) => {
4271
4285
  const type = typeof value;
4272
4286
  return value !== null && (type === "object" || type === "function");
@@ -18774,7 +18788,7 @@ function dedupeImports(imports, warn) {
18774
18788
  }
18775
18789
  if (currImp.type || prevImp.type ? (currImp.typeFrom || currImp.from) === (prevImp.typeFrom || prevImp.from) : currImp.from === prevImp.from) {
18776
18790
  if (Boolean(currImp.type) === Boolean(prevImp.type)) {
18777
- if ((currImp.priority || 1) > (prevImp.priority || 1)) {
18791
+ if ((currImp.priority ?? 1) > (prevImp.priority ?? 1)) {
18778
18792
  deduped.delete(name);
18779
18793
  deduped.set(name, currImp);
18780
18794
  }
@@ -18782,7 +18796,7 @@ function dedupeImports(imports, warn) {
18782
18796
  const altName2 = encodeImportName(name);
18783
18797
  const prevImpComplement2 = deduped.get(altName2);
18784
18798
  if (!prevImpComplement2) deduped.set(altName2, currImp);
18785
- else if ((currImp.priority || 1) > (prevImpComplement2.priority || 1)) {
18799
+ else if ((currImp.priority ?? 1) > (prevImpComplement2.priority ?? 1)) {
18786
18800
  deduped.delete(altName2);
18787
18801
  deduped.set(altName2, currImp);
18788
18802
  }
@@ -18791,7 +18805,8 @@ function dedupeImports(imports, warn) {
18791
18805
  }
18792
18806
  const altName = encodeImportName(name);
18793
18807
  const prevImpComplement = deduped.get(altName);
18794
- const priorityDiff = (currImp.priority || 1) - Math.max(prevImp.priority || 1, prevImpComplement?.priority || 1);
18808
+ const prevPriority = prevImpComplement ? Math.max(prevImp.priority ?? 1, prevImpComplement.priority ?? 1) : prevImp.priority ?? 1;
18809
+ const priorityDiff = (currImp.priority ?? 1) - prevPriority;
18795
18810
  if (priorityDiff > 0) {
18796
18811
  deduped.delete(name);
18797
18812
  deduped.delete(altName);
@@ -18819,7 +18834,14 @@ function toExports(imports, fileDir, includeType = false, options = {}) {
18819
18834
  }
18820
18835
  return true;
18821
18836
  });
18822
- if (filtered.length) entries.push(`export { ${filtered.map((i) => stringifyImportAlias(i, false)).join(", ")} } from '${name}';`);
18837
+ const byAlias = /* @__PURE__ */ new Map();
18838
+ for (const i of filtered) {
18839
+ const key = String(i.as ?? i.name);
18840
+ const existing = byAlias.get(key);
18841
+ if (!existing || existing.type && !i.type) byAlias.set(key, i);
18842
+ }
18843
+ const deduped = Array.from(byAlias.values());
18844
+ if (deduped.length) entries.push(`export { ${deduped.map((i) => stringifyImportAlias(i, false)).join(", ")} } from '${name}';`);
18823
18845
  return entries;
18824
18846
  }).join("\n");
18825
18847
  }
@@ -19337,7 +19359,7 @@ quansync(function* (name, cwd) {
19337
19359
  const pkg = (yield loadPackageJSON(cwd)) || {};
19338
19360
  return name in (pkg.dependencies || {}) || name in (pkg.devDependencies || {});
19339
19361
  }).sync;
19340
- const version$1 = "6.1.0";
19362
+ const version$1 = "6.2.0";
19341
19363
  function configureAddons(opts) {
19342
19364
  const addons = [];
19343
19365
  if (Array.isArray(opts.addons)) addons.push(...opts.addons);
@@ -19432,8 +19454,11 @@ function parseVirtualImportsRegex(strippedCode, importMap, virtualImports) {
19432
19454
  };
19433
19455
  }
19434
19456
  async function detectImports(code, ctx, options) {
19435
- if (options?.parser === "acorn") return import("../_libs/_6.mjs").then((r) => r.detectImportsAcorn(code, ctx, options));
19436
- return detectImportsRegex(code, ctx, options);
19457
+ switch (options?.parser) {
19458
+ case "acorn": return import("../_libs/unimport+unplugin+oxc-parser.mjs").then((n) => n.r).then((r) => r.detectImportsAcorn(code, ctx, options));
19459
+ case "oxc": return import("../_libs/unimport+unplugin+oxc-parser.mjs").then((n) => n.n).then((r) => r.detectImportsOxc(code, ctx, options));
19460
+ default: return detectImportsRegex(code, ctx, options);
19461
+ }
19437
19462
  }
19438
19463
  const JS_RESERVED_WORDS = /* @__PURE__ */ new Set([
19439
19464
  "abstract",
@@ -20965,20 +20990,6 @@ async function runParallel(inputs, cb, opts) {
20965
20990
  await refillQueue();
20966
20991
  return { errors };
20967
20992
  }
20968
- function escapeRegExp$1(string) {
20969
- return string.replace(/[-\\^$*+?.()|[\]{}]/g, String.raw`\$&`);
20970
- }
20971
- function pathRegExp(string) {
20972
- if (S$3) string = string.replace(/\\/g, "/");
20973
- let escaped = escapeRegExp$1(string);
20974
- if (S$3) escaped = escaped.replace(/\//g, String.raw`[/\\]`);
20975
- return escaped;
20976
- }
20977
- function toPathRegExp(input) {
20978
- if (input instanceof RegExp) return input;
20979
- if (typeof input === "string") return new RegExp(pathRegExp(input));
20980
- throw new TypeError("Expected a string or RegExp", { cause: input });
20981
- }
20982
20993
  function baseBuildConfig(nitro) {
20983
20994
  const extensions = [
20984
20995
  ".ts",
@@ -21555,17 +21566,20 @@ function storage(nitro) {
21555
21566
  opts: driverOpts
21556
21567
  });
21557
21568
  }
21569
+ const driverImports = [...new Set(mounts.map((m) => m.driver))];
21570
+ const tracingEnabled = !!(typeof nitro.options.tracingChannel === "object" && nitro.options.tracingChannel?.unstorage);
21558
21571
  return `
21559
21572
  import { createStorage } from 'unstorage'
21573
+ ${tracingEnabled ? `import { withTracing } from 'unstorage/tracing'` : ""}
21560
21574
  import { assets } from '#nitro/virtual/server-assets'
21561
21575
 
21562
- ${[...new Set(mounts.map((m) => m.driver))].map((i) => genImport(i, genSafeVariableName(i))).join("\n")}
21576
+ ${driverImports.map((i) => genImport(i, genSafeVariableName(i))).join("\n")}
21563
21577
 
21564
21578
  export function initStorage() {
21565
21579
  const storage = createStorage({})
21566
21580
  storage.mount('/assets', assets)
21567
21581
  ${mounts.map((m) => `storage.mount('${m.path}', ${genSafeVariableName(m.driver)}(${JSON.stringify(m.opts)}))`).join("\n")}
21568
- return storage
21582
+ return ${tracingEnabled ? "withTracing(storage)" : "storage"}
21569
21583
  }
21570
21584
  `;
21571
21585
  }
@@ -28335,7 +28349,7 @@ async function baseBuildPlugins(nitro, base) {
28335
28349
  nitro.vfs = virtualPlugin.api.modules;
28336
28350
  plugins.push(virtualPlugin, virtualDeps());
28337
28351
  if (nitro.options.imports) {
28338
- const unimportPlugin = await import("../_libs/_7.mjs");
28352
+ const unimportPlugin = await import("../_libs/unimport+unplugin+oxc-parser.mjs").then((n) => n.t);
28339
28353
  plugins.push(unimportPlugin.default.rollup(nitro.options.imports));
28340
28354
  }
28341
28355
  if (nitro.options.wasm !== false) plugins.push(unwasm(nitro.options.wasm || {}));
@@ -28386,4 +28400,4 @@ async function oxc(options) {
28386
28400
  }
28387
28401
  };
28388
28402
  }
28389
- export { jsonc_exports as $, src_default as A, f$1 as B, decode as C, copyPublicAssets as D, prepare as E, prettyPath as F, findNearestFile$1 as G, v$2 as H, resolveNitroPath as I, readPackageJSON$1 as J, findWorkspaceDir as K, writeFile$1 as L, glob as M, require_picomatch as N, scanUnprefixedPublicAssets as O, Builder as P, yaml_exports as Q, R$1 as R, MagicString as S, parse as T, dist_exports$1 as U, m$2 as V, findFile$1 as W, toml_exports as X, i$3 as Y, a$3 as Z, writeTypes as _, dataToEsm as a, dirname$2 as at, getMagicString as b, walk as c, join$2 as ct, libChunkName as d, resolve$3 as dt, r$5 as et, baseBuildConfig as f, writeDevBuildInfo as g, writeBuildInfo as h, createFilter as i, basename$2 as it, build as j, compressPublicAssets as k, NODE_MODULES_RE$1 as l, normalize$2 as lt, getBuildInfo as m, baseBuildPlugins as n, resolveModulePath as nt, extractAssignedNames as o, extname$4 as ot, runParallel as p, readGitConfig as q, attachScopes as r, resolveModuleURL as rt, makeLegalIdentifier as s, isAbsolute$2 as st, oxc as t, json5_exports as tt, getChunkName as u, relative$2 as ut, dist_exports as v, encode as w, stripLiteral as x, createUnimport as y, _$2 as z };
28403
+ export { yaml_exports as $, src_default as A, _$2 as B, decode as C, copyPublicAssets as D, prepare as E, prettyPath as F, findFile$1 as G, m$2 as H, resolveNitroPath as I, readGitConfig as J, findNearestFile$1 as K, writeFile$1 as L, glob as M, require_picomatch as N, scanUnprefixedPublicAssets as O, Builder as P, a$3 as Q, escapeRegExp$1 as R, MagicString as S, parse as T, v$2 as U, f$1 as V, dist_exports$1 as W, i$3 as X, readPackageJSON$1 as Y, toml_exports as Z, writeTypes as _, dataToEsm as a, basename$2 as at, getMagicString as b, walk as c, isAbsolute$2 as ct, libChunkName as d, relative$2 as dt, jsonc_exports as et, baseBuildConfig as f, resolve$3 as ft, writeDevBuildInfo as g, writeBuildInfo as h, createFilter as i, resolveModuleURL as it, build as j, compressPublicAssets as k, NODE_MODULES_RE$1 as l, join$2 as lt, getBuildInfo as m, baseBuildPlugins as n, json5_exports as nt, extractAssignedNames as o, dirname$2 as ot, runParallel as p, findWorkspaceDir as q, attachScopes as r, resolveModulePath as rt, makeLegalIdentifier as s, extname$4 as st, oxc as t, r$5 as tt, getChunkName as u, normalize$2 as ut, dist_exports as v, encode as w, stripLiteral as x, createUnimport as y, R$1 as z };
@@ -1,4 +1,4 @@
1
- import { _ as writeTypes, ct as join, d as libChunkName, f as baseBuildConfig, h as writeBuildInfo, it as basename, l as NODE_MODULES_RE, n as baseBuildPlugins, u as getChunkName, ut as relative } from "./common.mjs";
1
+ import { _ as writeTypes, at as basename, d as libChunkName, dt as relative, f as baseBuildConfig, h as writeBuildInfo, l as NODE_MODULES_RE, lt as join, n as baseBuildPlugins, u as getChunkName } from "./common.mjs";
2
2
  import { t as formatCompatibilityDate } from "../_libs/compatx.mjs";
3
3
  import { n as scanHandlers } from "../_chunks/nitro2.mjs";
4
4
  import { n as watch } from "../_libs/readdirp+chokidar.mjs";
@@ -1,10 +1,10 @@
1
- import { _ as writeTypes, ct as join, d as libChunkName, f as baseBuildConfig, h as writeBuildInfo, it as basename, l as NODE_MODULES_RE, n as baseBuildPlugins, st as isAbsolute, t as oxc, u as getChunkName, ut as relative } from "./common.mjs";
1
+ import { _ as writeTypes, at as basename, ct as isAbsolute, d as libChunkName, dt as relative, f as baseBuildConfig, h as writeBuildInfo, l as NODE_MODULES_RE, lt as join, n as baseBuildPlugins, t as oxc, u as getChunkName } from "./common.mjs";
2
2
  import { t as formatCompatibilityDate } from "../_libs/compatx.mjs";
3
3
  import { n as scanHandlers } from "../_chunks/nitro2.mjs";
4
4
  import { n as watch } from "../_libs/readdirp+chokidar.mjs";
5
5
  import { t as debounce } from "../_libs/perfect-debounce.mjs";
6
6
  import { t as alias } from "../_libs/plugin-alias.mjs";
7
- import { t as inject } from "../_libs/plugin-inject.mjs";
7
+ import { n as inject } from "../_libs/plugin-inject.mjs";
8
8
  import { n as generateFSTree } from "../_chunks/utils.mjs";
9
9
  import { t as commonjs } from "../_libs/commondir+is-reference.mjs";
10
10
  import { t as json } from "../_libs/plugin-json.mjs";
@@ -1,4 +1,4 @@
1
- import { H as v } from "./common.mjs";
1
+ import { U as v } from "./common.mjs";
2
2
  import { nitro } from "nitro/vite";
3
3
  async function viteBuild(nitro$1) {
4
4
  if (nitro$1.options.dev) throw new Error("Nitro dev CLI does not supports vite. Please use `vite dev` instead.");
@@ -1,8 +1,7 @@
1
- import { i as loadConfig, s as watchConfig } from "../_libs/c12+rc9.mjs";
2
- import { A as src_default, F as prettyPath, H as v, I as resolveNitroPath, K as findWorkspaceDir, L as writeFile$1, O as scanUnprefixedPublicAssets, ct as join, dt as resolve, j as build, k as compressPublicAssets, nt as resolveModulePath, p as runParallel, rt as resolveModuleURL, ut as relative, z as _ } from "../_build/common.mjs";
1
+ import { i as watchConfig, r as loadConfig } from "../_libs/c12+rc9.mjs";
2
+ import { A as src_default, B as _, F as prettyPath, I as resolveNitroPath, L as writeFile$1, O as scanUnprefixedPublicAssets, R as escapeRegExp, U as v, dt as relative, ft as resolve, it as resolveModuleURL, j as build, k as compressPublicAssets, lt as join, p as runParallel, q as findWorkspaceDir, rt as resolveModulePath } from "../_build/common.mjs";
3
3
  import { n as resolveCompatibilityDates, r as resolveCompatibilityDatesFromEnv } from "../_libs/compatx.mjs";
4
4
  import { t as klona } from "../_libs/klona.mjs";
5
- import { t as escapeStringRegexp } from "../_libs/escape-string-regexp.mjs";
6
5
  import { n as parse, t as TSConfckCache } from "../_libs/tsconfck.mjs";
7
6
  import { n as scanHandlers, t as scanAndSyncOptions } from "./nitro2.mjs";
8
7
  import { i as findAllRoutes, n as addRoute, r as createRouter } from "../_libs/rou3.mjs";
@@ -165,7 +164,7 @@ async function resolveImportsOptions(options) {
165
164
  options.imports.exclude.push(/[/\\]\.git[/\\]/);
166
165
  options.imports.exclude.push(options.buildDir);
167
166
  const scanDirsInNodeModules = options.scanDirs.map((dir) => dir.match(/(?<=\/)node_modules\/(.+)$/)?.[1]).filter(Boolean);
168
- options.imports.exclude.push(scanDirsInNodeModules.length > 0 ? new RegExp(`node_modules\\/(?!${scanDirsInNodeModules.map((dir) => escapeStringRegexp(dir)).join("|")})`) : /[/\\]node_modules[/\\]/);
167
+ options.imports.exclude.push(scanDirsInNodeModules.length > 0 ? new RegExp(`node_modules\\/(?!${scanDirsInNodeModules.map((dir) => escapeRegExp(dir)).join("|")})`) : /[/\\]node_modules[/\\]/);
169
168
  }
170
169
  }
171
170
  async function resolveOpenAPIOptions(options) {
@@ -475,7 +474,7 @@ function isPkgInstalled(pkg, root) {
475
474
  }
476
475
  }
477
476
  async function installPkg(pkg, root) {
478
- const { addDevDependency } = await import("../_libs/_5.mjs");
477
+ const { addDevDependency } = await import("../_libs/nypm+tinyexec.mjs").then((n) => n.t);
479
478
  return addDevDependency(pkg, { cwd: root });
480
479
  }
481
480
  function hasNitroViteConfig(options) {
@@ -497,6 +496,7 @@ async function resolveTracingOptions(options) {
497
496
  options.tracingChannel = {
498
497
  srvx: true,
499
498
  h3: true,
499
+ unstorage: true,
500
500
  ...typeof options.tracingChannel === "object" ? options.tracingChannel : {}
501
501
  };
502
502
  options.plugins = options.plugins || [];
@@ -1,4 +1,4 @@
1
- import { M as glob, ct as join, ut as relative } from "../_build/common.mjs";
1
+ import { M as glob, dt as relative, lt as join } from "../_build/common.mjs";
2
2
  import { withBase, withLeadingSlash, withoutTrailingSlash } from "ufo";
3
3
  const GLOB_SCAN_PATTERN = "**/*.{js,mjs,cjs,ts,mts,cts,tsx,jsx}";
4
4
  const suffixRegex = /(\.(?<method>connect|delete|get|head|options|patch|post|put|trace))?(\.(?<env>dev|prod|prerender))?$/;
@@ -1,4 +1,4 @@
1
- import { ct as join } from "../_build/common.mjs";
1
+ import { lt as join } from "../_build/common.mjs";
2
2
  import { a as findRoute, i as findAllRoutes, n as addRoute, r as createRouter, t as compileRouterToString } from "../_libs/rou3.mjs";
3
3
  import { runtimeDir } from "nitro/meta";
4
4
  import { hash } from "ohash";
@@ -1,4 +1,4 @@
1
- import { F as prettyPath, ct as join, dt as resolve, m as getBuildInfo } from "../_build/common.mjs";
1
+ import { F as prettyPath, ft as resolve, lt as join, m as getBuildInfo } from "../_build/common.mjs";
2
2
  import { n as proxyFetch, r as proxyUpgrade } from "../_libs/httpxy.mjs";
3
3
  import consola from "consola";
4
4
  import { spawn } from "node:child_process";
@@ -59,7 +59,7 @@ async function startPreview(opts) {
59
59
  };
60
60
  }
61
61
  async function loadPreviewDotEnv(root) {
62
- const { loadDotenv } = await import("../_libs/_.mjs");
62
+ const { loadDotenv } = await import("../_libs/c12+rc9.mjs").then((n) => n.n);
63
63
  const env = await loadDotenv({
64
64
  cwd: root,
65
65
  fileName: [
@@ -1,5 +1,5 @@
1
1
  import { r as __require, t as __commonJSMin } from "../_common.mjs";
2
- import { H as v, M as glob, V as m, at as dirname, dt as resolve, nt as resolveModulePath, p as runParallel, ut as relative } from "../_build/common.mjs";
2
+ import { H as m, M as glob, U as v, dt as relative, ft as resolve, ot as dirname, p as runParallel, rt as resolveModulePath } from "../_build/common.mjs";
3
3
  import { consola as consola$1 } from "consola";
4
4
  import { promises } from "node:fs";
5
5
  import { promisify } from "node:util";
@@ -257,7 +257,7 @@ async function importDep(opts, _retry) {
257
257
  if (!shouldInstall) throw new Error(`\`${opts.id}\` is not installed. Please add it to your dependencies for ${opts.reason}.`);
258
258
  const start = Date.now();
259
259
  consola$1.start(`Installing \`${opts.id}\` in \`${opts.dir}\`...`);
260
- const { addDevDependency } = await import("../_libs/_5.mjs");
260
+ const { addDevDependency } = await import("../_libs/nypm+tinyexec.mjs").then((n) => n.t);
261
261
  await addDevDependency(opts.id, { cwd: opts.dir });
262
262
  consola$1.success(`Installed \`${opts.id}\` in ${opts.dir} (${Date.now() - start}ms).`);
263
263
  return importDep(opts, true);
package/dist/_common.mjs CHANGED
@@ -5,7 +5,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
8
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
9
9
  var __exportAll = (all, no_symbols) => {
10
10
  let target = {};
11
11
  for (var name in all) __defProp(target, name, {
package/dist/_dev.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { A as src_default, H as v, V as m, ct as join$1, dt as resolve$1, g as writeDevBuildInfo, ot as extname$1 } from "./_build/common.mjs";
1
+ import { A as src_default, H as m, U as v, ft as resolve$1, g as writeDevBuildInfo, lt as join$1, st as extname$1 } from "./_build/common.mjs";
2
2
  import { n as watch$1 } from "./_libs/readdirp+chokidar.mjs";
3
3
  import { t as debounce } from "./_libs/perfect-debounce.mjs";
4
4
  import { t as createProxyServer } from "./_libs/httpxy.mjs";
@@ -16,7 +16,8 @@ function createVFSHandler(nitro) {
16
16
  return defineHandler(async (event) => {
17
17
  const { socket } = event.runtime?.node?.req || {};
18
18
  const ip = getRequestIP(event, { xForwardedFor: !socket?.remoteAddress && !socket?.localAddress && Object.keys(socket?.address?.() || {}).length === 0 && socket?.readable && socket?.writable && !socket?.remotePort });
19
- if (!(ip && /^::1$|^127\.\d+\.\d+\.\d+$/.test(ip))) throw new HTTPError({
19
+ const v4 = ip?.toLowerCase().startsWith("::ffff:") ? ip.slice(7) : ip;
20
+ if (!(v4 && /^(?:::1|127\.\d+\.\d+\.\d+)$/.test(v4))) throw new HTTPError({
20
21
  statusText: `Forbidden IP: "${ip || "?"}"`,
21
22
  status: 403
22
23
  });
@@ -1,4 +1,5 @@
1
- import { J as readPackageJSON, K as findWorkspaceDir, at as dirname$1, ct as join$1, dt as resolve$1, it as basename$1, lt as normalize$1, nt as resolveModulePath, ot as extname$1 } from "../_build/common.mjs";
1
+ import { n as __exportAll$1 } from "../_common.mjs";
2
+ import { Y as readPackageJSON, at as basename$1, ft as resolve$1, lt as join$1, ot as dirname$1, q as findWorkspaceDir, rt as resolveModulePath, st as extname$1, ut as normalize$1 } from "../_build/common.mjs";
2
3
  import { existsSync, readFileSync, statSync } from "node:fs";
3
4
  import * as nodeUtil from "node:util";
4
5
  import { readFile, rm } from "node:fs/promises";
@@ -201,6 +202,13 @@ function readUser(options) {
201
202
  options.dir = process.env.XDG_CONFIG_HOME || homedir();
202
203
  return read(options);
203
204
  }
205
+ var dist_exports$1 = /* @__PURE__ */ __exportAll$1({
206
+ SUPPORTED_EXTENSIONS: () => SUPPORTED_EXTENSIONS,
207
+ loadConfig: () => loadConfig,
208
+ loadDotenv: () => loadDotenv,
209
+ setupDotenv: () => setupDotenv,
210
+ watchConfig: () => watchConfig
211
+ });
204
212
  async function setupDotenv(options) {
205
213
  const targetEnvironment = options.env ?? process.env;
206
214
  const environment = await loadDotenv({
@@ -296,11 +304,11 @@ function getDotEnvVars(targetEnvironment) {
296
304
  const _normalize = (p) => p?.replace(/\\/g, "/");
297
305
  let importCounter = 0;
298
306
  const ASYNC_LOADERS = {
299
- ".yaml": () => import("../_build/common.mjs").then((n) => n.Q).then((r) => r.parseYAML),
300
- ".yml": () => import("../_build/common.mjs").then((n) => n.Q).then((r) => r.parseYAML),
301
- ".jsonc": () => import("../_build/common.mjs").then((n) => n.$).then((r) => r.parseJSONC),
302
- ".json5": () => import("../_build/common.mjs").then((n) => n.tt).then((r) => r.parseJSON5),
303
- ".toml": () => import("../_build/common.mjs").then((n) => n.X).then((r) => r.parseTOML)
307
+ ".yaml": () => import("../_build/common.mjs").then((n) => n.$).then((r) => r.parseYAML),
308
+ ".yml": () => import("../_build/common.mjs").then((n) => n.$).then((r) => r.parseYAML),
309
+ ".jsonc": () => import("../_build/common.mjs").then((n) => n.et).then((r) => r.parseJSONC),
310
+ ".json5": () => import("../_build/common.mjs").then((n) => n.nt).then((r) => r.parseJSON5),
311
+ ".toml": () => import("../_build/common.mjs").then((n) => n.Z).then((r) => r.parseTOML)
304
312
  };
305
313
  const SUPPORTED_EXTENSIONS = Object.freeze([
306
314
  ".js",
@@ -483,7 +491,7 @@ async function resolveConfig(source, options, sourceOptions = {}) {
483
491
  const { downloadTemplate } = await import("giget").catch((error) => {
484
492
  throw new Error(`Extending config from \`${source}\` requires \`giget\` peer dependency to be installed.\n\nInstall it with: \`npx nypm i giget\``, { cause: error });
485
493
  });
486
- const { digest } = await import("./_4.mjs").then((n) => n.n);
494
+ const { digest } = await Promise.resolve().then(() => ohash_exports).then((n) => n.n);
487
495
  const cloneName = source.replace(/\W+/g, "_").split("_").splice(0, 3).join("_") + "_" + digest(source).slice(0, 10).replace(/[-_]/g, "");
488
496
  let cloneDir;
489
497
  const localNodeModules = resolve$1(options.cwd, "node_modules");
@@ -590,7 +598,7 @@ async function watchConfig(options) {
590
598
  options.packageJson && resolve$1(l.cwd, "package.json")
591
599
  ]).filter(Boolean))];
592
600
  const watch = await import("./readdirp+chokidar.mjs").then((n) => n.t).then((r) => r.watch || r.default || r);
593
- const { diff } = await import("./_4.mjs").then((n) => n.t);
601
+ const { diff } = await Promise.resolve().then(() => ohash_exports).then((n) => n.t);
594
602
  const _fswatcher = watch(watchingFiles, {
595
603
  ignoreInitial: true,
596
604
  ...options.chokidarOptions
@@ -632,6 +640,10 @@ async function watchConfig(options) {
632
640
  return config[prop];
633
641
  } });
634
642
  }
643
+ var ohash_exports = /* @__PURE__ */ __exportAll$1({
644
+ n: () => dist_exports,
645
+ t: () => utils_exports
646
+ });
635
647
  var __defProp = Object.defineProperty;
636
648
  var __exportAll = (all, no_symbols) => {
637
649
  let target = {};
@@ -811,4 +823,4 @@ var DiffHashedObject = class {
811
823
  return `${k}(${this.value})`;
812
824
  }
813
825
  };
814
- export { loadDotenv as a, loadConfig as i, utils_exports as n, setupDotenv as o, SUPPORTED_EXTENSIONS as r, watchConfig as s, dist_exports as t };
826
+ export { watchConfig as i, dist_exports$1 as n, loadConfig as r, ohash_exports as t };