nitro-nightly 3.0.1-20260106-111729-02aef37b → 3.0.1-20260106-122532-056cfafb

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,23 +1,23 @@
1
1
  import "../_rolldown.mjs";
2
- import { A as relative, E as join, s as debounce } from "../_libs/c12.mjs";
2
+ import { T as join, k as relative, s as debounce } from "../_libs/c12.mjs";
3
3
  import "../_libs/@hiogawa/vite-plugin-fullstack.mjs";
4
4
  import "../_libs/acorn.mjs";
5
5
  import "../_libs/unimport.mjs";
6
6
  import "../_libs/@rollup/plugin-commonjs.mjs";
7
+ import { t as generateFSTree } from "./shared.mjs";
7
8
  import { t as formatCompatibilityDate } from "../_libs/compatx.mjs";
8
- import "./shared.mjs";
9
+ import "./shared2.mjs";
9
10
  import { i as scanHandlers, n as writeTypes } from "../_nitro2.mjs";
10
11
  import "../_libs/mime.mjs";
11
- import { n as writeBuildInfo } from "./shared2.mjs";
12
+ import { n as writeBuildInfo } from "./shared3.mjs";
12
13
  import { a as watch$1 } from "../_libs/chokidar.mjs";
13
- import { a as baseBuildConfig, i as libChunkName, n as NODE_MODULES_RE, r as getChunkName, t as baseBuildPlugins } from "./shared3.mjs";
14
+ import { a as baseBuildConfig, i as libChunkName, n as NODE_MODULES_RE, r as getChunkName, t as baseBuildPlugins } from "./shared4.mjs";
14
15
  import "../_libs/etag.mjs";
15
16
  import "../_libs/@jridgewell/gen-mapping.mjs";
16
17
  import "../_libs/@jridgewell/remapping.mjs";
17
18
  import "../_libs/@rollup/plugin-replace.mjs";
18
19
  import "../_libs/duplexer.mjs";
19
20
  import "../_libs/gzip-size.mjs";
20
- import { t as generateFSTree } from "./shared4.mjs";
21
21
  import { builtinModules } from "node:module";
22
22
  import { watch } from "node:fs";
23
23
  import { defu } from "defu";
@@ -1,25 +1,25 @@
1
1
  import "../_rolldown.mjs";
2
- import { A as relative, E as join, T as isAbsolute, s as debounce } from "../_libs/c12.mjs";
2
+ import { T as join, k as relative, s as debounce, w as isAbsolute } from "../_libs/c12.mjs";
3
3
  import "../_libs/@hiogawa/vite-plugin-fullstack.mjs";
4
4
  import "../_libs/acorn.mjs";
5
5
  import "../_libs/unimport.mjs";
6
6
  import { t as commonjs } from "../_libs/@rollup/plugin-commonjs.mjs";
7
+ import { t as generateFSTree } from "./shared.mjs";
7
8
  import { t as formatCompatibilityDate } from "../_libs/compatx.mjs";
8
- import "./shared.mjs";
9
+ import "./shared2.mjs";
9
10
  import { i as scanHandlers, n as writeTypes } from "../_nitro2.mjs";
10
11
  import "../_libs/mime.mjs";
11
- import { n as writeBuildInfo } from "./shared2.mjs";
12
+ import { n as writeBuildInfo } from "./shared3.mjs";
12
13
  import { a as watch$1 } from "../_libs/chokidar.mjs";
13
14
  import { t as alias } from "../_libs/@rollup/plugin-alias.mjs";
14
15
  import { t as inject } from "../_libs/@rollup/plugin-inject.mjs";
15
- import { a as baseBuildConfig, i as libChunkName, n as NODE_MODULES_RE, r as getChunkName, t as baseBuildPlugins } from "./shared3.mjs";
16
+ import { a as baseBuildConfig, i as libChunkName, n as NODE_MODULES_RE, r as getChunkName, t as baseBuildPlugins } from "./shared4.mjs";
16
17
  import "../_libs/etag.mjs";
17
18
  import "../_libs/@jridgewell/gen-mapping.mjs";
18
19
  import "../_libs/@jridgewell/remapping.mjs";
19
20
  import "../_libs/@rollup/plugin-replace.mjs";
20
21
  import "../_libs/duplexer.mjs";
21
22
  import "../_libs/gzip-size.mjs";
22
- import { t as generateFSTree } from "./shared4.mjs";
23
23
  import { t as json } from "../_libs/@rollup/plugin-json.mjs";
24
24
  import { t as nodeResolve } from "../_libs/@rollup/plugin-node-resolve.mjs";
25
25
  import { watch } from "node:fs";
@@ -1,40 +1,59 @@
1
- import { A as relative, C as dirname, j as resolve } from "../_libs/c12.mjs";
2
- import { t as getProperty } from "../_libs/dot-prop.mjs";
3
- import consola$1 from "consola";
4
- import { mkdir, stat, writeFile } from "node:fs/promises";
1
+ import { A as resolve, S as dirname, c as findFile, d as parseGitConfig, f as readGitConfig, h as resolvePackageJSON, k as relative, l as findNearestFile, m as resolveGitConfig, p as readPackageJSON, u as findWorkspaceDir } 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";
5
8
  import { colors } from "consola/utils";
6
9
 
7
- //#region src/utils/fs.ts
8
- function prettyPath(p, highlight = true) {
9
- p = relative(process.cwd(), p);
10
- return highlight ? colors.cyan(p) : p;
11
- }
12
- function resolveNitroPath(path, nitroOptions, base) {
13
- if (typeof path !== "string") throw new TypeError("Invalid path: " + path);
14
- path = _compilePathTemplate(path)(nitroOptions);
15
- for (const base$1 in nitroOptions.alias) if (path.startsWith(base$1)) path = nitroOptions.alias[base$1] + path.slice(base$1.length);
16
- if (/^[#\u0000]/.test(path)) return path;
17
- return resolve(base || nitroOptions.rootDir, path);
18
- }
19
- function _compilePathTemplate(contents) {
20
- return (params) => contents.replace(/{{ ?([\w.]+) ?}}/g, (_, match) => {
21
- const val = getProperty(params, match);
22
- if (!val) consola$1.warn(`cannot resolve template param '${match}' in ${contents.slice(0, 20)}`);
23
- return val || `${match}`;
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"]
24
16
  });
25
- }
26
- async function writeFile$1(file, contents, log = false) {
27
- await mkdir(dirname(file), { recursive: true });
28
- await writeFile(file, contents, typeof contents === "string" ? "utf8" : void 0);
29
- if (log) consola$1.info("Generated", prettyPath(file));
30
- }
31
- async function isDirectory(path) {
32
- try {
33
- return (await stat(path)).isDirectory();
34
- } catch {
35
- return false;
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;
36
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;
37
56
  }
38
57
 
39
58
  //#endregion
40
- export { writeFile$1 as i, prettyPath as n, resolveNitroPath as r, isDirectory as t };
59
+ export { readPackageJSON, generateFSTree as t };
@@ -1,68 +1,40 @@
1
- import { A as relative$1, E as join$1, j as resolve$1 } from "../_libs/c12.mjs";
2
- import { i as writeFile$1 } from "./shared.mjs";
3
- import { dirname } from "node:path";
4
- import { mkdir, readFile, stat } from "node:fs/promises";
5
- import { version } from "nitro/meta";
1
+ import { A as resolve, S as dirname, k as relative } from "../_libs/c12.mjs";
2
+ import { t as getProperty } from "../_libs/dot-prop.mjs";
3
+ import consola$1 from "consola";
4
+ import { mkdir, stat, writeFile } from "node:fs/promises";
5
+ import { colors } from "consola/utils";
6
6
 
7
- //#region src/presets/_types.gen.ts
8
- const presetsWithConfig = [
9
- "awsAmplify",
10
- "awsLambda",
11
- "azure",
12
- "cloudflare",
13
- "firebase",
14
- "netlify",
15
- "vercel"
16
- ];
17
-
18
- //#endregion
19
- //#region src/build/info.ts
20
- const NITRO_WELLKNOWN_DIR = "node_modules/.nitro";
21
- async function getBuildInfo(root) {
22
- const outputDir = await findLastBuildDir(root);
23
- if (!await stat(outputDir).then((s) => s.isDirectory()).catch(() => false)) return {};
24
- return {
25
- outputDir,
26
- buildInfo: await readFile(resolve$1(outputDir, "nitro.json"), "utf8").then(JSON.parse).catch(() => void 0)
27
- };
7
+ //#region src/utils/fs.ts
8
+ function prettyPath(p, highlight = true) {
9
+ p = relative(process.cwd(), p);
10
+ return highlight ? colors.cyan(p) : p;
11
+ }
12
+ function resolveNitroPath(path, nitroOptions, base) {
13
+ if (typeof path !== "string") throw new TypeError("Invalid path: " + path);
14
+ path = _compilePathTemplate(path)(nitroOptions);
15
+ for (const base$1 in nitroOptions.alias) if (path.startsWith(base$1)) path = nitroOptions.alias[base$1] + path.slice(base$1.length);
16
+ if (/^[#\u0000]/.test(path)) return path;
17
+ return resolve(base || nitroOptions.rootDir, path);
28
18
  }
29
- async function findLastBuildDir(root) {
30
- const lastBuildLink = join$1(root, NITRO_WELLKNOWN_DIR, "last-build.json");
31
- return await readFile(lastBuildLink, "utf8").then(JSON.parse).then((data) => resolve$1(lastBuildLink, data.outputDir || "../../../.output")).catch(() => resolve$1(root, ".output"));
19
+ function _compilePathTemplate(contents) {
20
+ return (params) => contents.replace(/{{ ?([\w.]+) ?}}/g, (_, match) => {
21
+ const val = getProperty(params, match);
22
+ if (!val) consola$1.warn(`cannot resolve template param '${match}' in ${contents.slice(0, 20)}`);
23
+ return val || `${match}`;
24
+ });
32
25
  }
33
- async function writeBuildInfo(nitro) {
34
- const buildInfoPath = resolve$1(nitro.options.output.dir, "nitro.json");
35
- const buildInfo = {
36
- date: (/* @__PURE__ */ new Date()).toJSON(),
37
- preset: nitro.options.preset,
38
- framework: nitro.options.framework,
39
- versions: { nitro: version },
40
- commands: {
41
- preview: nitro.options.commands.preview,
42
- deploy: nitro.options.commands.deploy
43
- },
44
- config: { ...Object.fromEntries(presetsWithConfig.map((key) => [key, nitro.options[key]])) }
45
- };
46
- await writeFile$1(buildInfoPath, JSON.stringify(buildInfo, null, 2), true);
47
- const lastBuild = join$1(nitro.options.rootDir, NITRO_WELLKNOWN_DIR, "last-build.json");
48
- await mkdir(dirname(lastBuild), { recursive: true });
49
- await writeFile$1(lastBuild, JSON.stringify({ outputDir: relative$1(lastBuild, nitro.options.output.dir) }));
50
- return buildInfo;
26
+ async function writeFile$1(file, contents, log = false) {
27
+ await mkdir(dirname(file), { recursive: true });
28
+ await writeFile(file, contents, typeof contents === "string" ? "utf8" : void 0);
29
+ if (log) consola$1.info("Generated", prettyPath(file));
51
30
  }
52
- async function writeDevBuildInfo(nitro, addr) {
53
- const buildInfoPath = join$1(nitro.options.rootDir, NITRO_WELLKNOWN_DIR, "nitro.dev.json");
54
- const buildInfo = {
55
- date: (/* @__PURE__ */ new Date()).toJSON(),
56
- preset: nitro.options.preset,
57
- framework: nitro.options.framework,
58
- versions: { nitro: version },
59
- dev: {
60
- pid: process.pid,
61
- workerAddress: addr
62
- }
63
- };
64
- await writeFile$1(buildInfoPath, JSON.stringify(buildInfo, null, 2));
31
+ async function isDirectory(path) {
32
+ try {
33
+ return (await stat(path)).isDirectory();
34
+ } catch {
35
+ return false;
36
+ }
65
37
  }
66
38
 
67
39
  //#endregion
68
- export { writeBuildInfo as n, writeDevBuildInfo as r, getBuildInfo as t };
40
+ export { writeFile$1 as i, prettyPath as n, resolveNitroPath as r, isDirectory as t };