nitro-nightly 3.1.0-20251029-230306-50bca1ed → 3.1.0-20251030-005056-3637ebe2

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.
@@ -1,5 +1,4 @@
1
1
  import { s as sanitizeFilePath } from '../_chunks/_deps/mlly.mjs';
2
- import { r as resolveModulePath } from '../_chunks/_deps/exsolve.mjs';
3
2
  import { runtimeDir } from 'nitro/runtime/meta';
4
3
  import { b as baseBuildConfig, a as baseBuildPlugins, r as replace, w as writeBuildInfo } from './info.mjs';
5
4
  import { builtinModules } from 'node:module';
@@ -16,13 +15,14 @@ import '../_chunks/_deps/acorn.mjs';
16
15
  import 'ufo';
17
16
  import '../_chunks/_deps/pkg-types.mjs';
18
17
  import '../_chunks/_deps/confbox.mjs';
18
+ import '../_chunks/_deps/exsolve.mjs';
19
19
  import 'node:url';
20
- import 'node:fs/promises';
20
+ import 'node:path';
21
21
  import 'node:assert';
22
22
  import 'node:process';
23
- import 'node:path';
24
23
  import 'node:v8';
25
24
  import 'node:util';
25
+ import 'node:fs/promises';
26
26
  import '../_chunks/_deps/@rollup/plugin-replace.mjs';
27
27
  import '../_chunks/_deps/magic-string.mjs';
28
28
  import '../_chunks/_deps/@jridgewell/sourcemap-codec.mjs';
@@ -234,27 +234,6 @@ const getRolldownConfig = (nitro) => {
234
234
  }
235
235
  }
236
236
  };
237
- config.plugins.push({
238
- name: "nitro:rolldown-resolves",
239
- async resolveId(id, parent, options) {
240
- if (parent?.startsWith("\0virtual:#nitro-internal-virtual")) {
241
- const internalRes = await this.resolve(id, import.meta.url, {
242
- ...options,
243
- custom: { ...options.custom, skipNoExternals: true }
244
- });
245
- if (internalRes) {
246
- return internalRes;
247
- }
248
- return resolveModulePath(id, {
249
- from: [nitro.options.rootDir, import.meta.url],
250
- try: true
251
- }) || resolveModulePath("./" + id, {
252
- from: [nitro.options.rootDir, import.meta.url],
253
- try: true
254
- });
255
- }
256
- }
257
- });
258
237
  config = defu(nitro.options.rollupConfig, config);
259
238
  return config;
260
239
  };
@@ -1,12 +1,9 @@
1
1
  import { r as replace$1 } from '../_chunks/_deps/@rollup/plugin-replace.mjs';
2
2
  import { defineEnv } from 'unenv';
3
3
  import { runtimeDir, runtimeDependencies } from 'nitro/runtime/meta';
4
- import { j as join, r as resolve, d as dirname, e as extname, a as relative, i as isAbsolute } from '../_chunks/_deps/pathe.mjs';
5
- import { pathToFileURL } from 'node:url';
6
- import { builtinModules } from 'node:module';
4
+ import { j as join, r as resolve, d as dirname, e as extname, a as relative } from '../_chunks/_deps/pathe.mjs';
7
5
  import { hash } from 'ohash';
8
6
  import { defu } from 'defu';
9
- import { r as resolveModulePath } from '../_chunks/_deps/exsolve.mjs';
10
7
  import { u as unplugin } from '../_chunks/_deps/unimport.mjs';
11
8
  import { r as rollup } from '../_chunks/_deps/unwasm.mjs';
12
9
  import { connectors } from 'db0';
@@ -286,7 +283,7 @@ function routing(nitro) {
286
283
  `
287
284
  import * as __routeRules__ from "nitro/runtime/internal/route-rules";
288
285
  ${nitro.options.serverEntry ? `import __serverEntry__ from ${JSON.stringify(nitro.options.serverEntry)};` : ""}
289
- import {${h3Imports.join(", ")}} from "nitro/deps/h3";
286
+ import {${h3Imports.join(", ")}} from "h3";
290
287
 
291
288
  export const findRouteRules = ${nitro.routing.routeRules.compileToString({ serialize: serializeRouteRule, matchAll: true })}
292
289
 
@@ -808,7 +805,7 @@ function rendererTemplate(nitro) {
808
805
  return (
809
806
  /* js */
810
807
  `
811
- import { HTTPResponse } from "nitro/deps/h3";
808
+ import { HTTPResponse } from "h3";
812
809
  export const rendererTemplate = () => new HTTPResponse(${JSON.stringify(html)}, { headers: { "content-type": "text/html; charset=utf-8" } });
813
810
  `
814
811
  );
@@ -849,6 +846,29 @@ function featureFlags(nitro) {
849
846
  );
850
847
  }
851
848
 
849
+ const subpathMap = {
850
+ "nitro/h3": "h3",
851
+ "nitro/deps/h3": "h3",
852
+ "nitro/deps/ofetch": "ofetch"
853
+ };
854
+ function nitroResolveIds() {
855
+ return {
856
+ name: "nitro:resolve-ids",
857
+ resolveId: {
858
+ order: "pre",
859
+ handler(id, importer, rOpts) {
860
+ if (importer && importer.startsWith("\0virtual:#nitro-internal-virtual")) {
861
+ return this.resolve(id, runtimeDir, { skipSelf: true });
862
+ }
863
+ const mappedId = subpathMap[id];
864
+ if (mappedId) {
865
+ return this.resolve(mappedId, runtimeDir, { skipSelf: true });
866
+ }
867
+ }
868
+ }
869
+ };
870
+ }
871
+
852
872
  function baseBuildPlugins(nitro, base) {
853
873
  const plugins = [];
854
874
  if (nitro.options.imports) {
@@ -879,6 +899,7 @@ function baseBuildPlugins(nitro, base) {
879
899
  )
880
900
  );
881
901
  plugins.push(featureFlags(nitro));
902
+ plugins.push(nitroResolveIds());
882
903
  plugins.push(serverAssets(nitro));
883
904
  plugins.push(publicAssets(nitro));
884
905
  plugins.push(storage(nitro));
@@ -904,46 +925,7 @@ function baseBuildPlugins(nitro, base) {
904
925
  if (nitro.options.renderer?.template) {
905
926
  plugins.push(rendererTemplate(nitro));
906
927
  }
907
- if (nitro.options.noExternals) {
908
- plugins.push({
909
- name: "no-externals",
910
- async resolveId(id, importer, resolveOpts) {
911
- if (resolveOpts.custom?.skipNoExternals) {
912
- return;
913
- }
914
- id = base.aliases[id] || id;
915
- if (base.env.external.includes(id) || nitro.options.node && (id.startsWith("node:") || builtinModules.includes(id))) {
916
- return { id, external: true };
917
- }
918
- const resolved = await this.resolve(id, importer, resolveOpts);
919
- if (!resolved) {
920
- const _resolved = resolveModulePath(id, {
921
- try: true,
922
- from: importer && isAbsolute(importer) ? [pathToFileURL(importer), ...nitro.options.nodeModulesDirs] : nitro.options.nodeModulesDirs,
923
- suffixes: ["", "/index"],
924
- extensions: [".mjs", ".cjs", ".js", ".mts", ".cts", ".ts", ".json"],
925
- conditions: [
926
- "default",
927
- nitro.options.dev ? "development" : "production",
928
- "node",
929
- "import",
930
- "require"
931
- ]
932
- });
933
- if (_resolved) {
934
- return { id: _resolved, external: false };
935
- }
936
- }
937
- if (!resolved || resolved.external && !id.endsWith(".wasm")) {
938
- throw new Error(
939
- `Cannot resolve ${JSON.stringify(id)} from ${JSON.stringify(
940
- importer
941
- )} and externals are not allowed!`
942
- );
943
- }
944
- }
945
- });
946
- } else {
928
+ if (!nitro.options.noExternals) {
947
929
  plugins.push(
948
930
  rollupNodeFileTrace(
949
931
  defu(nitro.options.externals, {
@@ -961,7 +943,6 @@ function baseBuildPlugins(nitro, base) {
961
943
  "@@/",
962
944
  "virtual:",
963
945
  "nitro/runtime",
964
- "nitro/runtime",
965
946
  dirname(nitro.options.entry),
966
947
  ...nitro.options.experimental.wasm ? [(id) => id?.endsWith(".wasm")] : [],
967
948
  runtimeDir,
@@ -841,58 +841,13 @@ function nitroService(ctx) {
841
841
  sharedDuringBuild: true,
842
842
  applyToEnvironment: (env) => env.name === "nitro",
843
843
  resolveId: {
844
- async handler(id, importer, options) {
844
+ async handler(id) {
845
845
  if (id === "#nitro-vite-setup") {
846
846
  return { id, moduleSideEffects: true };
847
847
  }
848
848
  if (id === "#nitro-vite-services") {
849
849
  return id;
850
850
  }
851
- if (runtimeDependencies.some(
852
- (dep) => id === dep || id.startsWith(`${dep}/`)
853
- )) {
854
- const resolved = await this.resolve(id, importer, {
855
- ...options,
856
- skipSelf: true
857
- });
858
- return resolved || resolveModulePath(id, {
859
- from: ctx.nitro.options.nodeModulesDirs,
860
- conditions: ctx.nitro.options.exportConditions,
861
- try: true
862
- });
863
- }
864
- if (importer?.startsWith("\0virtual:#nitro-internal-virtual")) {
865
- const internalRes = await this.resolve(id, import.meta.url, {
866
- ...options,
867
- custom: { ...options.custom, skipNoExternals: true }
868
- });
869
- if (internalRes) {
870
- return internalRes;
871
- }
872
- const resolvedFromRoot = await this.resolve(
873
- id,
874
- ctx.nitro.options.rootDir,
875
- { ...options, custom: { ...options.custom, skipNoExternals: true } }
876
- );
877
- if (resolvedFromRoot) {
878
- return resolvedFromRoot;
879
- }
880
- const ids = [id];
881
- if (!/^[./@#]/.test(id)) {
882
- ids.push(`./${id}`);
883
- }
884
- for (const _id of ids) {
885
- const resolved = resolveModulePath(_id, {
886
- from: process.cwd(),
887
- extensions: DEFAULT_EXTENSIONS,
888
- suffixes: ["", "/index"],
889
- try: true
890
- });
891
- if (resolved) {
892
- return resolved;
893
- }
894
- }
895
- }
896
851
  }
897
852
  },
898
853
  load: {
@@ -1,6 +1,6 @@
1
1
  import { fileURLToPath } from "node:url";
2
2
 
3
- export const pkgDir = fileURLToPath(new URL("../", import.meta.url));
3
+ export const pkgDir = fileURLToPath(new URL("../../", import.meta.url));
4
4
 
5
5
  export const runtimeDir = fileURLToPath(
6
6
  new URL("../../dist/runtime/", import.meta.url)
@@ -28,6 +28,7 @@ export const runtimeDependencies = [
28
28
  "unctx", // traced
29
29
  "unenv", // dep
30
30
  "unstorage", // dep
31
+ "nitro/h3",
31
32
  "nitro/deps/h3",
32
33
  "nitro/deps/ofetch",
33
34
  "nitro/runtime",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nitro-nightly",
3
- "version": "3.1.0-20251029-230306-50bca1ed",
3
+ "version": "3.1.0-20251030-005056-3637ebe2",
4
4
  "description": "Build and Deploy Universal JavaScript Servers",
5
5
  "homepage": "https://nitro.build",
6
6
  "repository": "nitrojs/nitro",