@nuxt/nitro-server-nightly 5.0.0-29813402.54cae253 → 5.0.0-29813502.963c819f

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 (2) hide show
  1. package/dist/index.mjs +12 -23
  2. package/package.json +5 -5
package/dist/index.mjs CHANGED
@@ -28,7 +28,7 @@ import { compileRouterToString } from "rou3/compiler";
28
28
  import { createUnimport, scanDirExports, toExports } from "unimport";
29
29
  import { createUnplugin } from "unplugin";
30
30
  //#region package.json
31
- var version = "5.0.0-29813402.54cae253";
31
+ var version = "5.0.0-29813502.963c819f";
32
32
  //#endregion
33
33
  //#region src/utils.ts
34
34
  /**
@@ -965,12 +965,10 @@ function createServerAutoImports(nuxt, options, typesDir) {
965
965
  });
966
966
  },
967
967
  async getImports() {
968
- if (!enabled) return [];
969
968
  await init();
970
969
  return ctx.getImports();
971
970
  },
972
971
  async refresh() {
973
- if (!enabled) return;
974
972
  await init();
975
973
  resolvedTypePaths.clear();
976
974
  await ctx.modifyDynamicImports((imports) => {
@@ -981,24 +979,15 @@ function createServerAutoImports(nuxt, options, typesDir) {
981
979
  },
982
980
  async writeTypes() {
983
981
  await mkdir(join(typesDir, "types"), { recursive: true });
984
- if (!enabled) {
985
- await writeFile(importsModulePath + ".d.ts", "export {}\n", "utf8");
986
- await writeFile(importsModulePath + ".mjs", "export {}\n", "utf8");
987
- return;
988
- }
989
982
  await init();
990
983
  const imports = await ctx.getImports();
991
984
  resolveTypePaths(imports);
992
- const declarations = await ctx.generateTypeDeclarations({
985
+ const declarations = enabled ? await ctx.generateTypeDeclarations({
993
986
  exportHelper: false,
994
987
  resolvePath: (i) => resolvedTypePaths.get(i.typeFrom || i.from) ?? i.from
995
- });
988
+ }) : "";
996
989
  const reExports = toExports(imports, importsModuleDir, true);
997
- await Promise.all([writeFile(importsModulePath + ".d.ts", [
998
- declarations.trim(),
999
- reExports.trim() || "export {}",
1000
- ""
1001
- ].join("\n"), "utf8"), writeFile(importsModulePath + ".mjs", (toExports(imports, importsModuleDir).trim() || "export {}") + "\n", "utf8")]);
990
+ await Promise.all([writeFile(importsModulePath + ".d.ts", [declarations.trim(), reExports.trim() || "export {}"].filter(Boolean).join("\n") + "\n", "utf8"), writeFile(importsModulePath + ".mjs", (toExports(imports, importsModuleDir).trim() || "export {}") + "\n", "utf8")]);
1002
991
  }
1003
992
  };
1004
993
  }
@@ -1504,15 +1493,15 @@ async function bundle(nuxt) {
1504
1493
  nuxt.options.vite.plugins ||= [];
1505
1494
  for (const plugin of [ServerAutoImportsPlugin.vite(autoImportsPluginOptions)].flat()) nuxt.options.vite.plugins.push(Object.assign(plugin, { applyToEnvironment: (env) => env.name === "nitro" }));
1506
1495
  }
1507
- const scannedDirs = nitroConfig.imports.dirs ?? [];
1508
- nuxt.hook("builder:watch", async (event, relativePath) => {
1509
- if (event !== "add" && event !== "unlink") return;
1510
- const path = resolve(nuxt.options.srcDir, relativePath);
1511
- if (!scannedDirs.some((dir) => path === dir || path.startsWith(dir + "/"))) return;
1512
- await autoImports.refresh();
1513
- await autoImports.writeTypes();
1514
- });
1515
1496
  }
1497
+ const scannedDirs = nitroConfig.imports.dirs ?? [];
1498
+ nuxt.hook("builder:watch", async (event, relativePath) => {
1499
+ if (event !== "add" && event !== "unlink") return;
1500
+ const path = resolve(nuxt.options.srcDir, relativePath);
1501
+ if (!scannedDirs.some((dir) => path === dir || path.startsWith(dir + "/"))) return;
1502
+ await autoImports.refresh();
1503
+ await autoImports.writeTypes();
1504
+ });
1516
1505
  if (nitroConfig.static && nuxt.options.dev) {
1517
1506
  nitroConfig.routeRules ||= {};
1518
1507
  nitroConfig.routeRules["/**"] = defu(nitroConfig.routeRules["/**"], { prerender: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/nitro-server-nightly",
3
- "version": "5.0.0-29813402.54cae253",
3
+ "version": "5.0.0-29813502.963c819f",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",
@@ -36,7 +36,7 @@
36
36
  ],
37
37
  "dependencies": {
38
38
  "@ampproject/remapping": "^2.3.0",
39
- "@nuxt/kit": "npm:@nuxt/kit-nightly@5.0.0-29813402.54cae253",
39
+ "@nuxt/kit": "npm:@nuxt/kit-nightly@5.0.0-29813502.963c819f",
40
40
  "@unhead/vue": "^3.4.0",
41
41
  "@vue/shared": "^3.5.42",
42
42
  "consola": "^3.4.2",
@@ -72,7 +72,7 @@
72
72
  "@babel/plugin-proposal-decorators": "^7.25.0 || ^8.0.0",
73
73
  "@babel/plugin-syntax-typescript": "^7.25.0 || ^8.0.0",
74
74
  "@rollup/plugin-babel": "^6.0.0 || ^7.0.0",
75
- "nuxt": "npm:nuxt-nightly@5.0.0-29813402.54cae253"
75
+ "nuxt": "npm:nuxt-nightly@5.0.0-29813502.963c819f"
76
76
  },
77
77
  "peerDependenciesMeta": {
78
78
  "@babel/plugin-proposal-decorators": {
@@ -88,11 +88,11 @@
88
88
  "devDependencies": {
89
89
  "@babel/plugin-proposal-decorators": "8.0.2",
90
90
  "@babel/plugin-syntax-typescript": "8.0.3",
91
- "@nuxt/schema": "npm:@nuxt/schema-nightly@5.0.0-29813402.54cae253",
91
+ "@nuxt/schema": "npm:@nuxt/schema-nightly@5.0.0-29813502.963c819f",
92
92
  "@rollup/plugin-babel": "7.1.0",
93
93
  "h3": "^2.0.1-rc.31",
94
94
  "hookable": "^6.1.1",
95
- "nuxt": "npm:nuxt-nightly@5.0.0-29813402.54cae253",
95
+ "nuxt": "npm:nuxt-nightly@5.0.0-29813502.963c819f",
96
96
  "tsdown": "0.23.0",
97
97
  "vitest": "5.0.0"
98
98
  },