nitro-nightly 3.0.1-20260106-182834-5019d347 → 3.0.1-20260106-205209-b085a480

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 (85) hide show
  1. package/dist/_build/common.mjs +24899 -0
  2. package/dist/_build/rolldown.mjs +5 -18
  3. package/dist/_build/rollup.mjs +5 -52
  4. package/dist/_build/vite.build.mjs +2 -21
  5. package/dist/{_dev.mjs → _chunks/dev.mjs} +4 -7
  6. package/dist/{_nitro.mjs → _chunks/nitro.mjs} +16 -195
  7. package/dist/_chunks/nitro2.mjs +101 -0
  8. package/dist/_chunks/utils.mjs +278 -0
  9. package/dist/_libs/@hiogawa/vite-plugin-fullstack.mjs +32 -4
  10. package/dist/_libs/@jridgewell/gen-mapping.mjs +304 -2
  11. package/dist/_libs/@jridgewell/remapping.mjs +1 -2
  12. package/dist/_libs/@rollup/plugin-commonjs.mjs +75 -31
  13. package/dist/_libs/@rollup/plugin-inject.mjs +1 -3
  14. package/dist/_libs/@rollup/plugin-json.mjs +1 -1
  15. package/dist/_libs/@rollup/plugin-node-resolve.mjs +1111 -7
  16. package/dist/_libs/c12.mjs +597 -41
  17. package/dist/_libs/chokidar.mjs +235 -2
  18. package/dist/_libs/confbox.mjs +454 -1476
  19. package/dist/_libs/estree-walker.mjs +1 -144
  20. package/dist/_libs/giget.mjs +2235 -1377
  21. package/dist/_libs/httpxy.mjs +1 -1
  22. package/dist/_libs/unimport.mjs +1547 -1772
  23. package/dist/_presets.mjs +3 -9
  24. package/dist/builder.mjs +7 -12
  25. package/dist/cli/_chunks/build.mjs +1 -1
  26. package/dist/cli/_chunks/dev.mjs +3 -5
  27. package/dist/cli/_chunks/list.mjs +1 -1
  28. package/dist/cli/_chunks/prepare.mjs +1 -1
  29. package/dist/cli/_chunks/run.mjs +1 -1
  30. package/dist/types/index.d.mts +4 -4
  31. package/dist/vite.mjs +14 -1128
  32. package/package.json +2 -2
  33. package/dist/_build/shared.mjs +0 -60
  34. package/dist/_build/shared2.mjs +0 -40
  35. package/dist/_build/shared3.mjs +0 -68
  36. package/dist/_libs/@jridgewell/resolve-uri.mjs +0 -166
  37. package/dist/_libs/@jridgewell/sourcemap-codec.mjs +0 -167
  38. package/dist/_libs/@jridgewell/trace-mapping.mjs +0 -141
  39. package/dist/_libs/@rolldown/pluginutils.mjs +0 -31
  40. package/dist/_libs/@rollup/plugin-replace.mjs +0 -104
  41. package/dist/_libs/@rollup/pluginutils.mjs +0 -241
  42. package/dist/_libs/acorn.mjs +0 -5034
  43. package/dist/_libs/commondir.mjs +0 -22
  44. package/dist/_libs/deepmerge.mjs +0 -86
  45. package/dist/_libs/dot-prop.mjs +0 -138
  46. package/dist/_libs/dotenv.mjs +0 -345
  47. package/dist/_libs/duplexer.mjs +0 -71
  48. package/dist/_libs/etag.mjs +0 -80
  49. package/dist/_libs/exsolve.mjs +0 -1007
  50. package/dist/_libs/fdir.mjs +0 -514
  51. package/dist/_libs/function-bind.mjs +0 -63
  52. package/dist/_libs/gzip-size.mjs +0 -21
  53. package/dist/_libs/hasown.mjs +0 -14
  54. package/dist/_libs/is-core-module.mjs +0 -220
  55. package/dist/_libs/is-module.mjs +0 -13
  56. package/dist/_libs/is-reference.mjs +0 -33
  57. package/dist/_libs/js-tokens.mjs +0 -382
  58. package/dist/_libs/knitwork.mjs +0 -124
  59. package/dist/_libs/local-pkg.mjs +0 -125
  60. package/dist/_libs/magic-string.mjs +0 -939
  61. package/dist/_libs/mime.mjs +0 -1391
  62. package/dist/_libs/mlly.mjs +0 -1415
  63. package/dist/_libs/node-fetch-native.mjs +0 -7
  64. package/dist/_libs/nypm.mjs +0 -239
  65. package/dist/_libs/path-parse.mjs +0 -47
  66. package/dist/_libs/pathe.mjs +0 -202
  67. package/dist/_libs/perfect-debounce.mjs +0 -89
  68. package/dist/_libs/picomatch.mjs +0 -1673
  69. package/dist/_libs/pkg-types.mjs +0 -197
  70. package/dist/_libs/pretty-bytes.mjs +0 -116
  71. package/dist/_libs/quansync.mjs +0 -90
  72. package/dist/_libs/rc9.mjs +0 -136
  73. package/dist/_libs/readdirp.mjs +0 -237
  74. package/dist/_libs/resolve.mjs +0 -689
  75. package/dist/_libs/std-env.mjs +0 -158
  76. package/dist/_libs/strip-literal.mjs +0 -51
  77. package/dist/_libs/tinyexec.mjs +0 -627
  78. package/dist/_libs/tinyglobby.mjs +0 -292
  79. package/dist/_libs/unplugin-utils.mjs +0 -61
  80. package/dist/_libs/unplugin.mjs +0 -1225
  81. package/dist/_libs/untyped.mjs +0 -271
  82. package/dist/_libs/unwasm.mjs +0 -5895
  83. package/dist/_libs/webpack-virtual-modules.mjs +0 -272
  84. package/dist/_nitro2.mjs +0 -303
  85. /package/dist/{_rolldown.mjs → _common.mjs} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nitro-nightly",
3
- "version": "3.0.1-20260106-182834-5019d347",
3
+ "version": "3.0.1-20260106-205209-b085a480",
4
4
  "description": "Build and Deploy Universal JavaScript Servers",
5
5
  "homepage": "https://nitro.build",
6
6
  "repository": "nitrojs/nitro",
@@ -132,7 +132,7 @@
132
132
  "miniflare": "^4.20251217.0",
133
133
  "mlly": "^1.8.0",
134
134
  "nypm": "^0.6.2",
135
- "obuild": "^0.4.12",
135
+ "obuild": "^0.4.13",
136
136
  "pathe": "^2.0.3",
137
137
  "perfect-debounce": "^2.0.0",
138
138
  "pkg-types": "^2.3.0",
@@ -1,60 +0,0 @@
1
- import { l as relative, r as dirname, u as resolve } from "../_libs/pathe.mjs";
2
- import { a as parseGitConfig, c as resolveGitConfig, i as findWorkspaceDir, l as resolvePackageJSON, n as findFile, o as readGitConfig, r as findNearestFile, s as readPackageJSON } from "../_libs/pkg-types.mjs";
3
- import { i as a } from "../_libs/std-env.mjs";
4
- import { t as glob } from "../_libs/tinyglobby.mjs";
5
- import { t as runParallel } from "../_nitro2.mjs";
6
- import { t as gzipSize } from "../_libs/gzip-size.mjs";
7
- import { t as prettyBytes } from "../_libs/pretty-bytes.mjs";
8
- import { promises } from "node:fs";
9
- import { colors } from "consola/utils";
10
-
11
- //#region src/utils/fs-tree.ts
12
- async function generateFSTree(dir, options = {}) {
13
- if (a) return;
14
- const files = await glob("**/*.*", {
15
- cwd: dir,
16
- ignore: ["*.map"]
17
- });
18
- const items = [];
19
- await runParallel(new Set(files), async (file) => {
20
- const path = resolve(dir, file);
21
- const src = await promises.readFile(path);
22
- const size = src.byteLength;
23
- const gzip = options.compressedSizes ? await gzipSize(src) : 0;
24
- items.push({
25
- file,
26
- path,
27
- size,
28
- gzip
29
- });
30
- }, { concurrency: 10 });
31
- items.sort((a$1, b) => a$1.path.localeCompare(b.path));
32
- let totalSize = 0;
33
- let totalGzip = 0;
34
- let totalNodeModulesSize = 0;
35
- let totalNodeModulesGzip = 0;
36
- let treeText = "";
37
- for (const [index, item] of items.entries()) {
38
- let dir$1 = dirname(item.file);
39
- if (dir$1 === ".") dir$1 = "";
40
- const rpath = relative(process.cwd(), item.path);
41
- const treeChar = index === items.length - 1 ? "└─" : "├─";
42
- if (item.file.includes("node_modules")) {
43
- totalNodeModulesSize += item.size;
44
- totalNodeModulesGzip += item.gzip;
45
- continue;
46
- }
47
- treeText += colors.gray(` ${treeChar} ${rpath} (${prettyBytes(item.size)})`);
48
- if (options.compressedSizes) treeText += colors.gray(` (${prettyBytes(item.gzip)} gzip)`);
49
- treeText += "\n";
50
- totalSize += item.size;
51
- totalGzip += item.gzip;
52
- }
53
- treeText += `${colors.cyan("Σ Total size:")} ${prettyBytes(totalSize + totalNodeModulesSize)}`;
54
- if (options.compressedSizes) treeText += ` (${prettyBytes(totalGzip + totalNodeModulesGzip)} gzip)`;
55
- treeText += "\n";
56
- return treeText;
57
- }
58
-
59
- //#endregion
60
- export { readPackageJSON, generateFSTree as t };
@@ -1,40 +0,0 @@
1
- import { l as relative, r as dirname, u as resolve } from "../_libs/pathe.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
-
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}`;
24
- });
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;
36
- }
37
- }
38
-
39
- //#endregion
40
- export { writeFile$1 as i, prettyPath as n, resolveNitroPath as r, isDirectory as t };
@@ -1,68 +0,0 @@
1
- import { l as relative$1, o as join$1, u as resolve$1 } from "../_libs/pathe.mjs";
2
- import { i as writeFile$1 } from "./shared2.mjs";
3
- import { mkdir, readFile, stat } from "node:fs/promises";
4
- import { dirname } from "node:path";
5
- import { version } from "nitro/meta";
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
- };
28
- }
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"));
32
- }
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;
51
- }
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));
65
- }
66
-
67
- //#endregion
68
- export { writeBuildInfo as n, writeDevBuildInfo as r, getBuildInfo as t };
@@ -1,166 +0,0 @@
1
- //#region node_modules/.pnpm/@jridgewell+resolve-uri@3.1.2/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs
2
- const schemeRegex = /^[\w+.-]+:\/\//;
3
- /**
4
- * Matches the parts of a URL:
5
- * 1. Scheme, including ":", guaranteed.
6
- * 2. User/password, including "@", optional.
7
- * 3. Host, guaranteed.
8
- * 4. Port, including ":", optional.
9
- * 5. Path, including "/", optional.
10
- * 6. Query, including "?", optional.
11
- * 7. Hash, including "#", optional.
12
- */
13
- const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
14
- /**
15
- * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start
16
- * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).
17
- *
18
- * 1. Host, optional.
19
- * 2. Path, which may include "/", guaranteed.
20
- * 3. Query, including "?", optional.
21
- * 4. Hash, including "#", optional.
22
- */
23
- const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
24
- function isAbsoluteUrl(input) {
25
- return schemeRegex.test(input);
26
- }
27
- function isSchemeRelativeUrl(input) {
28
- return input.startsWith("//");
29
- }
30
- function isAbsolutePath(input) {
31
- return input.startsWith("/");
32
- }
33
- function isFileUrl(input) {
34
- return input.startsWith("file:");
35
- }
36
- function isRelative(input) {
37
- return /^[.?#]/.test(input);
38
- }
39
- function parseAbsoluteUrl(input) {
40
- const match = urlRegex.exec(input);
41
- return makeUrl(match[1], match[2] || "", match[3], match[4] || "", match[5] || "/", match[6] || "", match[7] || "");
42
- }
43
- function parseFileUrl(input) {
44
- const match = fileRegex.exec(input);
45
- const path = match[2];
46
- return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path) ? path : "/" + path, match[3] || "", match[4] || "");
47
- }
48
- function makeUrl(scheme, user, host, port, path, query, hash) {
49
- return {
50
- scheme,
51
- user,
52
- host,
53
- port,
54
- path,
55
- query,
56
- hash,
57
- type: 7
58
- };
59
- }
60
- function parseUrl(input) {
61
- if (isSchemeRelativeUrl(input)) {
62
- const url$1 = parseAbsoluteUrl("http:" + input);
63
- url$1.scheme = "";
64
- url$1.type = 6;
65
- return url$1;
66
- }
67
- if (isAbsolutePath(input)) {
68
- const url$1 = parseAbsoluteUrl("http://foo.com" + input);
69
- url$1.scheme = "";
70
- url$1.host = "";
71
- url$1.type = 5;
72
- return url$1;
73
- }
74
- if (isFileUrl(input)) return parseFileUrl(input);
75
- if (isAbsoluteUrl(input)) return parseAbsoluteUrl(input);
76
- const url = parseAbsoluteUrl("http://foo.com/" + input);
77
- url.scheme = "";
78
- url.host = "";
79
- url.type = input ? input.startsWith("?") ? 3 : input.startsWith("#") ? 2 : 4 : 1;
80
- return url;
81
- }
82
- function stripPathFilename(path) {
83
- if (path.endsWith("/..")) return path;
84
- const index = path.lastIndexOf("/");
85
- return path.slice(0, index + 1);
86
- }
87
- function mergePaths(url, base) {
88
- normalizePath(base, base.type);
89
- if (url.path === "/") url.path = base.path;
90
- else url.path = stripPathFilename(base.path) + url.path;
91
- }
92
- /**
93
- * The path can have empty directories "//", unneeded parents "foo/..", or current directory
94
- * "foo/.". We need to normalize to a standard representation.
95
- */
96
- function normalizePath(url, type) {
97
- const rel = type <= 4;
98
- const pieces = url.path.split("/");
99
- let pointer = 1;
100
- let positive = 0;
101
- let addTrailingSlash = false;
102
- for (let i = 1; i < pieces.length; i++) {
103
- const piece = pieces[i];
104
- if (!piece) {
105
- addTrailingSlash = true;
106
- continue;
107
- }
108
- addTrailingSlash = false;
109
- if (piece === ".") continue;
110
- if (piece === "..") {
111
- if (positive) {
112
- addTrailingSlash = true;
113
- positive--;
114
- pointer--;
115
- } else if (rel) pieces[pointer++] = piece;
116
- continue;
117
- }
118
- pieces[pointer++] = piece;
119
- positive++;
120
- }
121
- let path = "";
122
- for (let i = 1; i < pointer; i++) path += "/" + pieces[i];
123
- if (!path || addTrailingSlash && !path.endsWith("/..")) path += "/";
124
- url.path = path;
125
- }
126
- /**
127
- * Attempts to resolve `input` URL/path relative to `base`.
128
- */
129
- function resolve(input, base) {
130
- if (!input && !base) return "";
131
- const url = parseUrl(input);
132
- let inputType = url.type;
133
- if (base && inputType !== 7) {
134
- const baseUrl = parseUrl(base);
135
- const baseType = baseUrl.type;
136
- switch (inputType) {
137
- case 1: url.hash = baseUrl.hash;
138
- case 2: url.query = baseUrl.query;
139
- case 3:
140
- case 4: mergePaths(url, baseUrl);
141
- case 5:
142
- url.user = baseUrl.user;
143
- url.host = baseUrl.host;
144
- url.port = baseUrl.port;
145
- case 6: url.scheme = baseUrl.scheme;
146
- }
147
- if (baseType > inputType) inputType = baseType;
148
- }
149
- normalizePath(url, inputType);
150
- const queryHash = url.query + url.hash;
151
- switch (inputType) {
152
- case 2:
153
- case 3: return queryHash;
154
- case 4: {
155
- const path = url.path.slice(1);
156
- if (!path) return queryHash || ".";
157
- if (isRelative(base || input) && !isRelative(path)) return "./" + path + queryHash;
158
- return path + queryHash;
159
- }
160
- case 5: return url.path + queryHash;
161
- default: return url.scheme + "//" + url.user + url.host + url.port + url.path + queryHash;
162
- }
163
- }
164
-
165
- //#endregion
166
- export { resolve as t };
@@ -1,167 +0,0 @@
1
- //#region node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
2
- var comma = ",".charCodeAt(0);
3
- var semicolon = ";".charCodeAt(0);
4
- var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
5
- var intToChar = new Uint8Array(64);
6
- var charToInt = new Uint8Array(128);
7
- for (let i = 0; i < chars.length; i++) {
8
- const c = chars.charCodeAt(i);
9
- intToChar[i] = c;
10
- charToInt[c] = i;
11
- }
12
- function decodeInteger(reader, relative) {
13
- let value = 0;
14
- let shift = 0;
15
- let integer = 0;
16
- do {
17
- integer = charToInt[reader.next()];
18
- value |= (integer & 31) << shift;
19
- shift += 5;
20
- } while (integer & 32);
21
- const shouldNegate = value & 1;
22
- value >>>= 1;
23
- if (shouldNegate) value = -2147483648 | -value;
24
- return relative + value;
25
- }
26
- function encodeInteger(builder, num, relative) {
27
- let delta = num - relative;
28
- delta = delta < 0 ? -delta << 1 | 1 : delta << 1;
29
- do {
30
- let clamped = delta & 31;
31
- delta >>>= 5;
32
- if (delta > 0) clamped |= 32;
33
- builder.write(intToChar[clamped]);
34
- } while (delta > 0);
35
- return num;
36
- }
37
- function hasMoreVlq(reader, max) {
38
- if (reader.pos >= max) return false;
39
- return reader.peek() !== comma;
40
- }
41
- var bufLength = 1024 * 16;
42
- var td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? { decode(buf) {
43
- return Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength).toString();
44
- } } : { decode(buf) {
45
- let out = "";
46
- for (let i = 0; i < buf.length; i++) out += String.fromCharCode(buf[i]);
47
- return out;
48
- } };
49
- var StringWriter = class {
50
- constructor() {
51
- this.pos = 0;
52
- this.out = "";
53
- this.buffer = new Uint8Array(bufLength);
54
- }
55
- write(v) {
56
- const { buffer } = this;
57
- buffer[this.pos++] = v;
58
- if (this.pos === bufLength) {
59
- this.out += td.decode(buffer);
60
- this.pos = 0;
61
- }
62
- }
63
- flush() {
64
- const { buffer, out, pos } = this;
65
- return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
66
- }
67
- };
68
- var StringReader = class {
69
- constructor(buffer) {
70
- this.pos = 0;
71
- this.buffer = buffer;
72
- }
73
- next() {
74
- return this.buffer.charCodeAt(this.pos++);
75
- }
76
- peek() {
77
- return this.buffer.charCodeAt(this.pos);
78
- }
79
- indexOf(char) {
80
- const { buffer, pos } = this;
81
- const idx = buffer.indexOf(char, pos);
82
- return idx === -1 ? buffer.length : idx;
83
- }
84
- };
85
- function decode(mappings) {
86
- const { length } = mappings;
87
- const reader = new StringReader(mappings);
88
- const decoded = [];
89
- let genColumn = 0;
90
- let sourcesIndex = 0;
91
- let sourceLine = 0;
92
- let sourceColumn = 0;
93
- let namesIndex = 0;
94
- do {
95
- const semi = reader.indexOf(";");
96
- const line = [];
97
- let sorted = true;
98
- let lastCol = 0;
99
- genColumn = 0;
100
- while (reader.pos < semi) {
101
- let seg;
102
- genColumn = decodeInteger(reader, genColumn);
103
- if (genColumn < lastCol) sorted = false;
104
- lastCol = genColumn;
105
- if (hasMoreVlq(reader, semi)) {
106
- sourcesIndex = decodeInteger(reader, sourcesIndex);
107
- sourceLine = decodeInteger(reader, sourceLine);
108
- sourceColumn = decodeInteger(reader, sourceColumn);
109
- if (hasMoreVlq(reader, semi)) {
110
- namesIndex = decodeInteger(reader, namesIndex);
111
- seg = [
112
- genColumn,
113
- sourcesIndex,
114
- sourceLine,
115
- sourceColumn,
116
- namesIndex
117
- ];
118
- } else seg = [
119
- genColumn,
120
- sourcesIndex,
121
- sourceLine,
122
- sourceColumn
123
- ];
124
- } else seg = [genColumn];
125
- line.push(seg);
126
- reader.pos++;
127
- }
128
- if (!sorted) sort(line);
129
- decoded.push(line);
130
- reader.pos = semi + 1;
131
- } while (reader.pos <= length);
132
- return decoded;
133
- }
134
- function sort(line) {
135
- line.sort(sortComparator);
136
- }
137
- function sortComparator(a, b) {
138
- return a[0] - b[0];
139
- }
140
- function encode(decoded) {
141
- const writer = new StringWriter();
142
- let sourcesIndex = 0;
143
- let sourceLine = 0;
144
- let sourceColumn = 0;
145
- let namesIndex = 0;
146
- for (let i = 0; i < decoded.length; i++) {
147
- const line = decoded[i];
148
- if (i > 0) writer.write(semicolon);
149
- if (line.length === 0) continue;
150
- let genColumn = 0;
151
- for (let j = 0; j < line.length; j++) {
152
- const segment = line[j];
153
- if (j > 0) writer.write(comma);
154
- genColumn = encodeInteger(writer, segment[0], genColumn);
155
- if (segment.length === 1) continue;
156
- sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
157
- sourceLine = encodeInteger(writer, segment[2], sourceLine);
158
- sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
159
- if (segment.length === 4) continue;
160
- namesIndex = encodeInteger(writer, segment[4], namesIndex);
161
- }
162
- }
163
- return writer.flush();
164
- }
165
-
166
- //#endregion
167
- export { encode as n, decode as t };
@@ -1,141 +0,0 @@
1
- import { t as decode } from "./sourcemap-codec.mjs";
2
- import { t as resolve } from "./resolve-uri.mjs";
3
-
4
- //#region node_modules/.pnpm/@jridgewell+trace-mapping@0.3.31/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs
5
- function stripFilename(path) {
6
- if (!path) return "";
7
- const index = path.lastIndexOf("/");
8
- return path.slice(0, index + 1);
9
- }
10
- function resolver(mapUrl, sourceRoot) {
11
- const from = stripFilename(mapUrl);
12
- const prefix = sourceRoot ? sourceRoot + "/" : "";
13
- return (source) => resolve(prefix + (source || ""), from);
14
- }
15
- var COLUMN = 0;
16
- function maybeSort(mappings, owned) {
17
- const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
18
- if (unsortedIndex === mappings.length) return mappings;
19
- if (!owned) mappings = mappings.slice();
20
- for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) mappings[i] = sortSegments(mappings[i], owned);
21
- return mappings;
22
- }
23
- function nextUnsortedSegmentLine(mappings, start) {
24
- for (let i = start; i < mappings.length; i++) if (!isSorted(mappings[i])) return i;
25
- return mappings.length;
26
- }
27
- function isSorted(line) {
28
- for (let j = 1; j < line.length; j++) if (line[j][COLUMN] < line[j - 1][COLUMN]) return false;
29
- return true;
30
- }
31
- function sortSegments(line, owned) {
32
- if (!owned) line = line.slice();
33
- return line.sort(sortComparator);
34
- }
35
- function sortComparator(a, b) {
36
- return a[COLUMN] - b[COLUMN];
37
- }
38
- var found = false;
39
- function binarySearch(haystack, needle, low, high) {
40
- while (low <= high) {
41
- const mid = low + (high - low >> 1);
42
- const cmp = haystack[mid][COLUMN] - needle;
43
- if (cmp === 0) {
44
- found = true;
45
- return mid;
46
- }
47
- if (cmp < 0) low = mid + 1;
48
- else high = mid - 1;
49
- }
50
- found = false;
51
- return low - 1;
52
- }
53
- function upperBound(haystack, needle, index) {
54
- for (let i = index + 1; i < haystack.length; index = i++) if (haystack[i][COLUMN] !== needle) break;
55
- return index;
56
- }
57
- function lowerBound(haystack, needle, index) {
58
- for (let i = index - 1; i >= 0; index = i--) if (haystack[i][COLUMN] !== needle) break;
59
- return index;
60
- }
61
- function memoizedState() {
62
- return {
63
- lastKey: -1,
64
- lastNeedle: -1,
65
- lastIndex: -1
66
- };
67
- }
68
- function memoizedBinarySearch(haystack, needle, state, key) {
69
- const { lastKey, lastNeedle, lastIndex } = state;
70
- let low = 0;
71
- let high = haystack.length - 1;
72
- if (key === lastKey) {
73
- if (needle === lastNeedle) {
74
- found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle;
75
- return lastIndex;
76
- }
77
- if (needle >= lastNeedle) low = lastIndex === -1 ? 0 : lastIndex;
78
- else high = lastIndex;
79
- }
80
- state.lastKey = key;
81
- state.lastNeedle = needle;
82
- return state.lastIndex = binarySearch(haystack, needle, low, high);
83
- }
84
- function parse(map) {
85
- return typeof map === "string" ? JSON.parse(map) : map;
86
- }
87
- var LEAST_UPPER_BOUND = -1;
88
- var GREATEST_LOWER_BOUND = 1;
89
- var TraceMap = class {
90
- constructor(map, mapUrl) {
91
- const isString = typeof map === "string";
92
- if (!isString && map._decodedMemo) return map;
93
- const parsed = parse(map);
94
- const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;
95
- this.version = version;
96
- this.file = file;
97
- this.names = names || [];
98
- this.sourceRoot = sourceRoot;
99
- this.sources = sources;
100
- this.sourcesContent = sourcesContent;
101
- this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0;
102
- const resolve$1 = resolver(mapUrl, sourceRoot);
103
- this.resolvedSources = sources.map(resolve$1);
104
- const { mappings } = parsed;
105
- if (typeof mappings === "string") {
106
- this._encoded = mappings;
107
- this._decoded = void 0;
108
- } else if (Array.isArray(mappings)) {
109
- this._encoded = void 0;
110
- this._decoded = maybeSort(mappings, isString);
111
- } else if (parsed.sections) throw new Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`);
112
- else throw new Error(`invalid source map: ${JSON.stringify(parsed)}`);
113
- this._decodedMemo = memoizedState();
114
- this._bySources = void 0;
115
- this._bySourceMemos = void 0;
116
- }
117
- };
118
- function cast(map) {
119
- return map;
120
- }
121
- function decodedMappings(map) {
122
- var _a;
123
- return (_a = cast(map))._decoded || (_a._decoded = decode(cast(map)._encoded));
124
- }
125
- function traceSegment(map, line, column) {
126
- const decoded = decodedMappings(map);
127
- if (line >= decoded.length) return null;
128
- const segments = decoded[line];
129
- const index = traceSegmentInternal(segments, cast(map)._decodedMemo, line, column, GREATEST_LOWER_BOUND);
130
- return index === -1 ? null : segments[index];
131
- }
132
- function traceSegmentInternal(segments, memo, line, column, bias) {
133
- let index = memoizedBinarySearch(segments, column, memo, line);
134
- if (found) index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index);
135
- else if (bias === LEAST_UPPER_BOUND) index++;
136
- if (index === -1 || index === segments.length) return -1;
137
- return index;
138
- }
139
-
140
- //#endregion
141
- export { decodedMappings as n, traceSegment as r, TraceMap as t };
@@ -1,31 +0,0 @@
1
- //#region node_modules/.pnpm/@rolldown+pluginutils@1.0.0-beta.55/node_modules/@rolldown/pluginutils/dist/simple-filters.js
2
- /**
3
- * Constructs a RegExp that matches the exact string specified.
4
- *
5
- * This is useful for plugin hook filters.
6
- *
7
- * @param str the string to match.
8
- * @param flags flags for the RegExp.
9
- *
10
- * @example
11
- * ```ts
12
- * import { exactRegex } from '@rolldown/pluginutils';
13
- * const plugin = {
14
- * name: 'plugin',
15
- * resolveId: {
16
- * filter: { id: exactRegex('foo') },
17
- * handler(id) {} // will only be called for `foo`
18
- * }
19
- * }
20
- * ```
21
- */
22
- function exactRegex(str, flags) {
23
- return new RegExp(`^${escapeRegex(str)}$`, flags);
24
- }
25
- const escapeRegexRE = /[-/\\^$*+?.()|[\]{}]/g;
26
- function escapeRegex(str) {
27
- return str.replace(escapeRegexRE, "\\$&");
28
- }
29
-
30
- //#endregion
31
- export { exactRegex as t };