nitro-nightly 3.0.1-20251217-214519-a335d7df → 3.0.1-20251217-223324-2058e206

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.
@@ -0,0 +1,59 @@
1
+ import { O as relative, k as resolve, x as dirname } from "../_libs/c12.mjs";
2
+ import { t as glob } from "../_libs/tinyglobby.mjs";
3
+ import { i as a } from "../_libs/std-env.mjs";
4
+ import { t as runParallel } from "../_nitro2.mjs";
5
+ import { t as gzipSize } from "../_libs/gzip-size.mjs";
6
+ import { t as prettyBytes } from "../_libs/pretty-bytes.mjs";
7
+ import { promises } from "node:fs";
8
+ import { colors } from "consola/utils";
9
+
10
+ //#region src/utils/fs-tree.ts
11
+ async function generateFSTree(dir, options = {}) {
12
+ if (a) return;
13
+ const files = await glob("**/*.*", {
14
+ cwd: dir,
15
+ ignore: ["*.map"]
16
+ });
17
+ const items = [];
18
+ await runParallel(new Set(files), async (file) => {
19
+ const path = resolve(dir, file);
20
+ const src = await promises.readFile(path);
21
+ const size = src.byteLength;
22
+ const gzip = options.compressedSizes ? await gzipSize(src) : 0;
23
+ items.push({
24
+ file,
25
+ path,
26
+ size,
27
+ gzip
28
+ });
29
+ }, { concurrency: 10 });
30
+ items.sort((a$1, b) => a$1.path.localeCompare(b.path));
31
+ let totalSize = 0;
32
+ let totalGzip = 0;
33
+ let totalNodeModulesSize = 0;
34
+ let totalNodeModulesGzip = 0;
35
+ let treeText = "";
36
+ for (const [index, item] of items.entries()) {
37
+ let dir$1 = dirname(item.file);
38
+ if (dir$1 === ".") dir$1 = "";
39
+ const rpath = relative(process.cwd(), item.path);
40
+ const treeChar = index === items.length - 1 ? "└─" : "├─";
41
+ if (item.file.includes("node_modules")) {
42
+ totalNodeModulesSize += item.size;
43
+ totalNodeModulesGzip += item.gzip;
44
+ continue;
45
+ }
46
+ treeText += colors.gray(` ${treeChar} ${rpath} (${prettyBytes(item.size)})`);
47
+ if (options.compressedSizes) treeText += colors.gray(` (${prettyBytes(item.gzip)} gzip)`);
48
+ treeText += "\n";
49
+ totalSize += item.size;
50
+ totalGzip += item.gzip;
51
+ }
52
+ treeText += `${colors.cyan("Σ Total size:")} ${prettyBytes(totalSize + totalNodeModulesSize)}`;
53
+ if (options.compressedSizes) treeText += ` (${prettyBytes(totalGzip + totalNodeModulesGzip)} gzip)`;
54
+ treeText += "\n";
55
+ return treeText;
56
+ }
57
+
58
+ //#endregion
59
+ export { generateFSTree as t };
@@ -14,7 +14,7 @@ import "./shared2.mjs";
14
14
  import "../_dev.mjs";
15
15
  import "../_libs/@rollup/plugin-alias.mjs";
16
16
  import "../_libs/@rollup/plugin-inject.mjs";
17
- import "../_nitro3.mjs";
17
+ import "./shared3.mjs";
18
18
  import "../_libs/etag.mjs";
19
19
  import "../_libs/@jridgewell/gen-mapping.mjs";
20
20
  import "../_libs/@jridgewell/remapping.mjs";
@@ -10,7 +10,7 @@ import { i as NodeEnvRunner, r as NitroDevApp } from "../_dev.mjs";
10
10
  import { i as watch$1 } from "../_libs/chokidar.mjs";
11
11
  import { t as alias } from "../_libs/@rollup/plugin-alias.mjs";
12
12
  import { t as inject } from "../_libs/@rollup/plugin-inject.mjs";
13
- import { a as baseBuildConfig, i as libChunkName, n as NODE_MODULES_RE, r as getChunkName, t as baseBuildPlugins } from "../_nitro3.mjs";
13
+ import { a as baseBuildConfig, i as libChunkName, n as NODE_MODULES_RE, r as getChunkName, t as baseBuildPlugins } from "./shared3.mjs";
14
14
  import consola$1 from "consola";
15
15
  import { join, resolve } from "node:path";
16
16
  import { existsSync, watch } from "node:fs";
@@ -30,7 +30,6 @@ const getViteRollupConfig = (ctx) => {
30
30
  input: nitro$1.options.entry,
31
31
  external: [...base.env.external],
32
32
  plugins: [
33
- ctx.pluginConfig.experimental?.vite?.virtualBundle && virtualBundlePlugin(ctx._serviceBundles),
34
33
  ...baseBuildPlugins(nitro$1, base),
35
34
  alias({ entries: base.aliases }),
36
35
  !ctx._isRolldown && inject(base.env.inject)
@@ -65,41 +64,6 @@ const getViteRollupConfig = (ctx) => {
65
64
  base
66
65
  };
67
66
  };
68
- function virtualBundlePlugin(bundles) {
69
- let _modules = null;
70
- const getModules = () => {
71
- if (_modules) return _modules;
72
- _modules = /* @__PURE__ */ new Map();
73
- for (const bundle of Object.values(bundles)) for (const [fileName, content] of Object.entries(bundle)) if (content.type === "chunk") {
74
- const virtualModule = {
75
- code: content.code,
76
- map: null
77
- };
78
- const maybeMap = bundle[`${fileName}.map`];
79
- if (maybeMap && maybeMap.type === "asset") virtualModule.map = maybeMap.source;
80
- _modules.set(fileName, virtualModule);
81
- _modules.set(resolve$1(fileName), virtualModule);
82
- }
83
- return _modules;
84
- };
85
- return {
86
- name: "virtual-bundle",
87
- resolveId(id, importer) {
88
- const modules = getModules();
89
- if (modules.has(id)) return resolve$1(id);
90
- if (importer) {
91
- const resolved = resolve$1(dirname$1(importer), id);
92
- if (modules.has(resolved)) return resolved;
93
- }
94
- return null;
95
- },
96
- load(id) {
97
- const m = getModules().get(id);
98
- if (!m) return null;
99
- return m;
100
- }
101
- };
102
- }
103
67
 
104
68
  //#endregion
105
69
  //#region src/build/vite/prod.ts
@@ -181,10 +145,7 @@ function lazyService(loader) {
181
145
 
182
146
  const services = {
183
147
  ${Object.keys(ctx.services).map((name) => {
184
- let entry;
185
- if (ctx.pluginConfig.experimental?.vite?.virtualBundle) entry = ctx._entryPoints[name];
186
- else entry = resolve$1(ctx.nitro.options.buildDir, "vite/services", name, ctx._entryPoints[name]);
187
- return [name, entry];
148
+ return [name, resolve$1(ctx.nitro.options.buildDir, "vite/services", name, ctx._entryPoints[name])];
188
149
  }).map(([name, entry]) => `[${JSON.stringify(name)}]: lazyService(() => import(${JSON.stringify(entry)}))`).join(",\n")}
189
150
  };
190
151
 
@@ -552,10 +513,6 @@ function nitroEnv(ctx) {
552
513
  debug("[env] Configuring client environment", name === "client" ? "" : ` (${name})`);
553
514
  config.build.emptyOutDir = false;
554
515
  config.build.outDir = useNitro(ctx).options.output.publicDir;
555
- } else if (ctx.pluginConfig.experimental?.vite?.virtualBundle && name in (ctx.services || {})) {
556
- debug("[env] Configuring service environment for virtual:", name);
557
- config.build ??= {};
558
- config.build.write = config.build.write ?? false;
559
516
  }
560
517
  }
561
518
  };
@@ -595,7 +552,6 @@ function nitroMain(ctx) {
595
552
  if (isRegisteredService) {
596
553
  if (entryFile === void 0) this.error(`No entry point found for service "${this.environment.name}".`);
597
554
  ctx._entryPoints[this.environment.name] = entryFile;
598
- ctx._serviceBundles[this.environment.name] = bundle;
599
555
  }
600
556
  } },
601
557
  configureServer: (server) => {
@@ -662,8 +618,7 @@ function createContext(pluginConfig) {
662
618
  return {
663
619
  pluginConfig,
664
620
  services: {},
665
- _entryPoints: {},
666
- _serviceBundles: {}
621
+ _entryPoints: {}
667
622
  };
668
623
  }
669
624
  function useNitro(ctx) {
@@ -1,20 +1,3 @@
1
- import "nitro";
2
- import "nitro/app";
3
- import "nitro/builder";
4
- import "nitro/cache";
5
- import "nitro/config";
6
- import "nitro/context";
7
- import "nitro/database";
8
- import "nitro/h3";
9
- import "nitro/meta";
10
- import "nitro/package.json";
11
- import "nitro/runtime-config";
12
- import "nitro/storage";
13
- import "nitro/task";
14
- import "nitro/tsconfig";
15
- import "nitro/types";
16
- import "nitro/vite";
17
- import "nitro/vite/runtime";
18
1
  import { ConsolaInstance, LogLevel } from "consola";
19
2
  import { Hookable, HookableCore, NestedHooks } from "hookable";
20
3
  import { version } from "nitro/meta";
@@ -26,6 +9,15 @@ import { Preset } from "unenv";
26
9
  import { ConnectorName } from "db0";
27
10
  import { BuiltinDriverName } from "unstorage";
28
11
  import { JsxOptions, TransformOptions } from "oxc-transform";
12
+ import "nitro";
13
+ import "nitro/app";
14
+ import "nitro/cache";
15
+ import "nitro/context";
16
+ import "nitro/database";
17
+ import "nitro/h3";
18
+ import "nitro/runtime-config";
19
+ import "nitro/storage";
20
+ import "nitro/task";
29
21
  import { MinifyOptions } from "oxc-minify";
30
22
  import { InputOptions, OutputOptions } from "rollup";
31
23
  import { Nitro as Nitro$1, RunnerMessageListener as RunnerMessageListener$1 } from "nitro/types";
@@ -235,35 +227,6 @@ interface TaskRunnerOptions {
235
227
  buildDir?: string;
236
228
  }
237
229
  //#endregion
238
- //#region src/types/runtime/client/assets.d.ts
239
- // Based on https://github.com/hi-ogawa/vite-plugins/blob/main/packages/fullstack/types/query.d.ts
240
-
241
- type ImportAssetsResult = ImportAssetsResultRaw & {
242
- merge(...args: ImportAssetsResultRaw[]): ImportAssetsResult;
243
- };
244
- type ImportAssetsResultRaw = {
245
- entry?: string;
246
- js: {
247
- href: string;
248
- }[];
249
- css: {
250
- href: string;
251
- "data-vite-dev-id"?: string;
252
- }[];
253
- };
254
- declare module "*?assets" {
255
- const assets: ImportAssetsResult;
256
- export default assets;
257
- }
258
- declare module "*?assets=client" {
259
- const assets: ImportAssetsResult;
260
- export default assets;
261
- }
262
- declare module "*?assets=ssr" {
263
- const assets: ImportAssetsResult;
264
- export default assets;
265
- }
266
- //#endregion
267
230
  //#region src/presets/aws-amplify/types.d.ts
268
231
  type AmplifyImageSettings = {
269
232
  /** Array of supported image widths */
@@ -3234,4 +3197,4 @@ declare module "srvx" {
3234
3197
  }
3235
3198
  }
3236
3199
  //#endregion
3237
- export { $Fetch, AssetMeta, AvailableRouterMethod, Base$Fetch, CacheEntry, CacheOptions, CachedEventHandlerOptions, CaptureError, CapturedErrorContext, CompressOptions, DatabaseConnectionConfig, DatabaseConnectionConfigs, DatabaseConnectionName, EnvRunner, EventHandlerFormat, ExtractedRouteMethod, FetchHandler, H3Event$Fetch, H3EventFetch, HTTPstatus, ImportAssetsResult, ImportAssetsResultRaw, InternalApi, LoadConfigOptions, MatchedRouteRule, MatchedRouteRules, MatchedRoutes, MiddlewareOf, Nitro, NitroApp, NitroAppPlugin, NitroAsyncContext, NitroBuildInfo, NitroConfig, NitroDevEventHandler, NitroDynamicConfig, NitroErrorHandler, NitroEventHandler, NitroFetchOptions, NitroFetchRequest, NitroFrameworkInfo, NitroHooks, NitroImportMeta, NitroModule, NitroModuleInput, type NitroOpenAPIConfig, NitroOptions, NitroPreset, NitroPresetMeta, NitroRouteConfig, NitroRouteMeta, NitroRouteRules, NitroRuntimeConfig, NitroRuntimeConfigApp, NitroRuntimeHooks, NitroTypes, OXCOptions, PrerenderGenerateRoute, PrerenderRoute, PublicAsset, PublicAssetDir, RenderContext, RenderHandler, RenderResponse, ResponseCacheEntry, RollupConfig, RollupVirtualOptions, RunnerMessageListener, RunnerRPCHooks, Serialize, SerializeObject, SerializeTuple, ServerAssetDir, ServerAssetOptions, type ServerRequest, Simplify, StorageMounts, Task, TaskContext, TaskEvent, TaskMeta, TaskPayload, TaskResult, TaskRunnerOptions, TypedInternalResponse, UpgradeHandler, VirtualModule, WorkerAddress, WorkerHooks };
3200
+ export { $Fetch, AssetMeta, AvailableRouterMethod, Base$Fetch, CacheEntry, CacheOptions, CachedEventHandlerOptions, CaptureError, CapturedErrorContext, CompressOptions, DatabaseConnectionConfig, DatabaseConnectionConfigs, DatabaseConnectionName, EnvRunner, EventHandlerFormat, ExtractedRouteMethod, FetchHandler, H3Event$Fetch, H3EventFetch, HTTPstatus, InternalApi, LoadConfigOptions, MatchedRouteRule, MatchedRouteRules, MatchedRoutes, MiddlewareOf, Nitro, NitroApp, NitroAppPlugin, NitroAsyncContext, NitroBuildInfo, NitroConfig, NitroDevEventHandler, NitroDynamicConfig, NitroErrorHandler, NitroEventHandler, NitroFetchOptions, NitroFetchRequest, NitroFrameworkInfo, NitroHooks, NitroImportMeta, NitroModule, NitroModuleInput, type NitroOpenAPIConfig, NitroOptions, NitroPreset, NitroPresetMeta, NitroRouteConfig, NitroRouteMeta, NitroRouteRules, NitroRuntimeConfig, NitroRuntimeConfigApp, NitroRuntimeHooks, NitroTypes, OXCOptions, PrerenderGenerateRoute, PrerenderRoute, PublicAsset, PublicAssetDir, RenderContext, RenderHandler, RenderResponse, ResponseCacheEntry, RollupConfig, RollupVirtualOptions, RunnerMessageListener, RunnerRPCHooks, Serialize, SerializeObject, SerializeTuple, ServerAssetDir, ServerAssetOptions, type ServerRequest, Simplify, StorageMounts, Task, TaskContext, TaskEvent, TaskMeta, TaskPayload, TaskResult, TaskRunnerOptions, TypedInternalResponse, UpgradeHandler, VirtualModule, WorkerAddress, WorkerHooks };
package/dist/vite.d.mts CHANGED
@@ -1,4 +1,5 @@
1
1
  import "./_dev.mjs";
2
+ import "nitro/vite/types";
2
3
  import "unenv";
3
4
  import { Plugin } from "vite";
4
5
  import { Nitro, NitroConfig, NitroModule } from "nitro/types";
@@ -22,11 +23,6 @@ interface NitroPluginConfig extends NitroConfig {
22
23
  _nitro?: Nitro;
23
24
  experimental?: NitroConfig["experimental"] & {
24
25
  vite: {
25
- /**
26
- * @experimental Use the virtual filesystem for intermediate environment build output files.
27
- * @note This is unsafe if plugins rely on temporary files on the filesystem.
28
- */
29
- virtualBundle?: boolean;
30
26
  /**
31
27
  * @experimental Enable `?assets` import proposed by https://github.com/vitejs/vite/discussions/20913
32
28
  * @default true
package/dist/vite.mjs CHANGED
@@ -13,11 +13,12 @@ import "./_build/shared2.mjs";
13
13
  import "./_dev.mjs";
14
14
  import "./_libs/@rollup/plugin-alias.mjs";
15
15
  import "./_libs/@rollup/plugin-inject.mjs";
16
- import "./_nitro3.mjs";
16
+ import "./_build/shared3.mjs";
17
17
  import "./_libs/etag.mjs";
18
18
  import "./_libs/@jridgewell/gen-mapping.mjs";
19
19
  import "./_libs/@jridgewell/remapping.mjs";
20
20
  import "./_libs/@rollup/plugin-replace.mjs";
21
21
  import { t as nitro } from "./_build/vite.plugin.mjs";
22
+ import "nitro/vite/types";
22
23
 
23
24
  export { nitro };
package/lib/vite.d.mts ADDED
@@ -0,0 +1,26 @@
1
+ // Based on https://github.com/hi-ogawa/vite-plugins/blob/main/packages/fullstack/types/query.d.ts
2
+
3
+ export type ImportAssetsResult = ImportAssetsResultRaw & {
4
+ merge(...args: ImportAssetsResultRaw[]): ImportAssetsResult;
5
+ };
6
+
7
+ export type ImportAssetsResultRaw = {
8
+ entry?: string;
9
+ js: { href: string }[];
10
+ css: { href: string; "data-vite-dev-id"?: string }[];
11
+ };
12
+
13
+ declare module "*?assets" {
14
+ const assets: ImportAssetsResult;
15
+ export default assets;
16
+ }
17
+
18
+ declare module "*?assets=client" {
19
+ const assets: ImportAssetsResult;
20
+ export default assets;
21
+ }
22
+
23
+ declare module "*?assets=ssr" {
24
+ const assets: ImportAssetsResult;
25
+ export default assets;
26
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nitro-nightly",
3
- "version": "3.0.1-20251217-214519-a335d7df",
3
+ "version": "3.0.1-20251217-223324-2058e206",
4
4
  "description": "Build and Deploy Universal JavaScript Servers",
5
5
  "homepage": "https://nitro.build",
6
6
  "repository": "nitrojs/nitro",
@@ -18,7 +18,7 @@
18
18
  "./config": "./dist/runtime/config.mjs",
19
19
  "./context": "./dist/runtime/context.mjs",
20
20
  "./database": "./dist/runtime/database.mjs",
21
- "./h3": "./lib/deps/h3.mjs",
21
+ "./h3": "./lib/h3.mjs",
22
22
  "./meta": "./dist/runtime/meta.mjs",
23
23
  "./package.json": "./package.json",
24
24
  "./runtime-config": "./dist/runtime/runtime-config.mjs",
@@ -27,7 +27,8 @@
27
27
  "./tsconfig": "./lib/tsconfig.json",
28
28
  "./types": "./dist/types/index.mjs",
29
29
  "./vite": "./dist/vite.mjs",
30
- "./vite/runtime": "./dist/runtime/vite.mjs"
30
+ "./vite/runtime": "./dist/runtime/vite.mjs",
31
+ "./vite/types": "./lib/vite.d.mts"
31
32
  },
32
33
  "types": "./lib/index.d.mts",
33
34
  "bin": {