nitro-nightly 4.0.0-20251010-091516-7cafddba → 4.0.0-20251030-091344-d4418b98
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.
- package/dist/{_chunks/build2.mjs → _build/build.mjs} +108 -58
- package/dist/_build/build2.mjs +556 -0
- package/dist/_build/info.mjs +1002 -0
- package/dist/_build/prepare.mjs +1511 -0
- package/dist/_build/snapshot.mjs +185 -0
- package/dist/{_chunks/plugin.mjs → _build/vite.mjs} +295 -296
- package/dist/_build/vite2.mjs +149 -0
- package/dist/_chunks/_deps/@jridgewell/gen-mapping.mjs +189 -0
- package/dist/_chunks/_deps/@jridgewell/remapping.mjs +137 -0
- package/dist/_chunks/_deps/@jridgewell/resolve-uri.mjs +231 -0
- package/dist/_chunks/_deps/@jridgewell/sourcemap-codec.mjs +173 -0
- package/dist/_chunks/_deps/@jridgewell/trace-mapping.mjs +170 -0
- package/dist/_chunks/_deps/@pi0/vite-plugin-fullstack.mjs +575 -0
- package/dist/_chunks/_deps/@rollup/plugin-alias.mjs +89 -0
- package/dist/_chunks/_deps/@rollup/plugin-commonjs.mjs +2376 -0
- package/dist/_chunks/{index2.mjs → _deps/@rollup/plugin-inject.mjs} +5 -90
- package/dist/_chunks/_deps/@rollup/plugin-json.mjs +37 -0
- package/dist/_chunks/_deps/@rollup/plugin-node-resolve.mjs +1386 -0
- package/dist/_chunks/_deps/@rollup/plugin-replace.mjs +133 -0
- package/dist/_chunks/_deps/@rollup/pluginutils.mjs +346 -0
- package/dist/_chunks/_deps/acorn.mjs +6225 -0
- package/dist/_chunks/_deps/c12.mjs +510 -0
- package/dist/_chunks/_deps/chokidar.mjs +1428 -0
- package/dist/_chunks/_deps/citty.mjs +460 -0
- package/dist/_chunks/_deps/commondir.mjs +77 -0
- package/dist/_chunks/_deps/compatx.mjs +76 -0
- package/dist/_chunks/_deps/confbox.mjs +300 -0
- package/dist/_chunks/_deps/debug.mjs +885 -0
- package/dist/_chunks/_deps/deepmerge.mjs +147 -0
- package/dist/_chunks/_deps/depd.mjs +550 -0
- package/dist/_chunks/_deps/dot-prop.mjs +282 -0
- package/dist/_chunks/_deps/dotenv.mjs +555 -0
- package/dist/_chunks/_deps/duplexer.mjs +1 -0
- package/dist/_chunks/_deps/ee-first.mjs +104 -0
- package/dist/_chunks/_deps/encodeurl.mjs +69 -0
- package/dist/_chunks/_deps/escape-html.mjs +87 -0
- package/dist/_chunks/_deps/escape-string-regexp.mjs +13 -0
- package/dist/_chunks/_deps/estree-walker.mjs +433 -0
- package/dist/_chunks/_deps/etag.mjs +147 -0
- package/dist/_chunks/_deps/exsolve.mjs +1416 -0
- package/dist/_chunks/_deps/fdir.mjs +569 -0
- package/dist/_chunks/_deps/fresh.mjs +145 -0
- package/dist/_chunks/_deps/function-bind.mjs +106 -0
- package/dist/_chunks/{index4.mjs → _deps/giget.mjs} +21 -776
- package/dist/_chunks/_deps/gzip-size.mjs +19 -0
- package/dist/_chunks/_deps/hasown.mjs +19 -0
- package/dist/_chunks/_deps/http-errors.mjs +307 -0
- package/dist/_chunks/_deps/httpxy.mjs +580 -0
- package/dist/_chunks/_deps/inherits.mjs +57 -0
- package/dist/_chunks/_deps/is-core-module.mjs +596 -0
- package/dist/_chunks/_deps/is-module.mjs +25 -0
- package/dist/_chunks/_deps/is-reference.mjs +31 -0
- package/dist/_chunks/_deps/js-tokens.mjs +411 -0
- package/dist/_chunks/_deps/klona.mjs +137 -0
- package/dist/_chunks/_deps/knitwork.mjs +172 -0
- package/dist/_chunks/_deps/local-pkg.mjs +163 -0
- package/dist/_chunks/_deps/magic-string.mjs +1296 -0
- package/dist/_chunks/_deps/mime-db.mjs +11685 -0
- package/dist/_chunks/_deps/mime-types.mjs +287 -0
- package/dist/_chunks/_deps/mime.mjs +1172 -0
- package/dist/_chunks/_deps/mlly.mjs +2413 -0
- package/dist/_chunks/_deps/ms.mjs +172 -0
- package/dist/_chunks/_deps/node-fetch-native.mjs +3 -0
- package/dist/_chunks/_deps/nypm.mjs +219 -0
- package/dist/_chunks/_deps/on-finished.mjs +246 -0
- package/dist/_chunks/_deps/parseurl.mjs +168 -0
- package/dist/_chunks/_deps/path-parse.mjs +85 -0
- package/dist/_chunks/{pathe.M-eThtNZ.mjs → _deps/pathe.mjs} +48 -1
- package/dist/_chunks/_deps/perfect-debounce.mjs +88 -0
- package/dist/_chunks/_deps/picomatch.mjs +2144 -0
- package/dist/_chunks/_deps/pkg-types.mjs +247 -0
- package/dist/_chunks/{snapshot.mjs → _deps/pretty-bytes.mjs} +1 -105
- package/dist/_chunks/_deps/quansync.mjs +99 -0
- package/dist/_chunks/_deps/range-parser.mjs +171 -0
- package/dist/_chunks/_deps/rc9.mjs +219 -0
- package/dist/_chunks/_deps/readdirp.mjs +245 -0
- package/dist/_chunks/_deps/resolve.mjs +1260 -0
- package/dist/_chunks/_deps/rou3.mjs +326 -0
- package/dist/_chunks/_deps/send.mjs +1022 -0
- package/dist/_chunks/_deps/serve-static.mjs +228 -0
- package/dist/_chunks/_deps/setprototypeof.mjs +26 -0
- package/dist/_chunks/_deps/statuses.mjs +457 -0
- package/dist/_chunks/_deps/std-env.mjs +3 -0
- package/dist/_chunks/_deps/strip-literal.mjs +67 -0
- package/dist/_chunks/_deps/supports-color.mjs +44 -0
- package/dist/_chunks/_deps/tinyexec.mjs +552 -0
- package/dist/_chunks/_deps/tinyglobby.mjs +293 -0
- package/dist/_chunks/_deps/toidentifier.mjs +41 -0
- package/dist/_chunks/_deps/ultrahtml.mjs +3 -0
- package/dist/_chunks/_deps/unimport.mjs +2267 -0
- package/dist/_chunks/_deps/unplugin-utils.mjs +65 -0
- package/dist/_chunks/_deps/unplugin.mjs +1294 -0
- package/dist/_chunks/_deps/untyped.mjs +375 -0
- package/dist/_chunks/{info.mjs → _deps/unwasm.mjs} +8 -4206
- package/dist/_chunks/_deps/webpack-virtual-modules.mjs +360 -0
- package/dist/_chunks/_presets/_all.mjs +59 -0
- package/dist/_chunks/_presets/_nitro.mjs +74 -0
- package/dist/_chunks/_presets/_resolve.mjs +64 -0
- package/dist/_chunks/_presets/_static.mjs +69 -0
- package/dist/_chunks/_presets/_types.mjs +3 -0
- package/dist/_chunks/_presets/_utils.mjs +31 -0
- package/dist/_chunks/_presets/alwaysdata.mjs +17 -0
- package/dist/_chunks/_presets/aws-amplify.mjs +111 -0
- package/dist/_chunks/_presets/aws-lambda.mjs +23 -0
- package/dist/_chunks/_presets/azure.mjs +162 -0
- package/dist/_chunks/_presets/bun.mjs +19 -0
- package/dist/_chunks/_presets/cleavr.mjs +15 -0
- package/dist/_chunks/_presets/cloudflare.mjs +608 -0
- package/dist/_chunks/_presets/deno.mjs +196 -0
- package/dist/_chunks/_presets/digitalocean.mjs +14 -0
- package/dist/_chunks/_presets/firebase.mjs +47 -0
- package/dist/_chunks/_presets/flightcontrol.mjs +14 -0
- package/dist/_chunks/_presets/genezio.mjs +13 -0
- package/dist/_chunks/_presets/heroku.mjs +14 -0
- package/dist/_chunks/_presets/iis.mjs +194 -0
- package/dist/_chunks/_presets/index.mjs +62 -0
- package/dist/_chunks/_presets/koyeb.mjs +14 -0
- package/dist/_chunks/_presets/netlify.mjs +241 -0
- package/dist/_chunks/_presets/node.mjs +54 -0
- package/dist/_chunks/_presets/platform.mjs +14 -0
- package/dist/_chunks/_presets/render.mjs +14 -0
- package/dist/_chunks/_presets/standard.mjs +23 -0
- package/dist/_chunks/_presets/stormkit.mjs +18 -0
- package/dist/_chunks/_presets/vercel.mjs +375 -0
- package/dist/_chunks/_presets/winterjs.mjs +22 -0
- package/dist/_chunks/_presets/zeabur.mjs +69 -0
- package/dist/_chunks/_presets/zerops.mjs +27 -0
- package/dist/_chunks/app.mjs +9 -19206
- package/dist/_chunks/{index3.mjs → builder.mjs} +560 -970
- package/dist/_chunks/server.mjs +6 -4
- package/dist/{cli → _cli}/build.mjs +3 -8
- package/dist/{cli → _cli}/dev.mjs +38 -12
- package/dist/{cli/index2.mjs → _cli/index.mjs} +1 -2
- package/dist/{cli → _cli}/list.mjs +3 -4
- package/dist/{cli → _cli}/prepare.mjs +3 -4
- package/dist/{cli → _cli}/run.mjs +3 -4
- package/dist/{index.d.mts → builder.d.mts} +11 -11
- package/dist/builder.mjs +117 -0
- package/dist/cli/index.mjs +7 -464
- package/dist/node_modules/@speed-highlight/core/dist/index.js +1 -1
- package/dist/node_modules/@speed-highlight/core/dist/terminal.js +1 -1
- package/dist/node_modules/@speed-highlight/core/package.json +7 -3
- package/dist/node_modules/cookie-es/dist/index.mjs +262 -0
- package/dist/node_modules/cookie-es/package.json +37 -0
- package/dist/node_modules/hookable/dist/index.mjs +243 -266
- package/dist/node_modules/hookable/package.json +29 -26
- package/dist/node_modules/rendu/dist/index.mjs +380 -0
- package/dist/node_modules/rendu/package.json +47 -0
- package/dist/presets/_nitro/runtime/nitro-dev.mjs +4 -7
- package/dist/presets/_nitro/runtime/nitro-prerenderer.mjs +5 -4
- package/dist/presets/azure/runtime/azure-swa.mjs +1 -1
- package/dist/presets/cloudflare/runtime/_module-handler.mjs +7 -6
- package/dist/presets/cloudflare/runtime/cloudflare-durable.mjs +4 -5
- package/dist/presets/cloudflare/runtime/plugin.dev.mjs +7 -10
- package/dist/presets/cloudflare/runtime/shims/workers.dev.d.mts +21 -0
- package/dist/presets/cloudflare/runtime/shims/workers.dev.mjs +27 -0
- package/dist/presets/node/runtime/node-server.mjs +1 -1
- package/dist/runtime/index.d.mts +1 -1
- package/dist/runtime/index.mjs +1 -1
- package/dist/runtime/internal/app.d.mts +3 -1
- package/dist/runtime/internal/app.mjs +90 -64
- package/dist/runtime/internal/error/prod.d.mts +3 -2
- package/dist/runtime/internal/error/prod.mjs +9 -13
- package/dist/runtime/internal/renderer.mjs +4 -4
- package/dist/runtime/internal/routes/dev-tasks.d.mts +30 -2
- package/dist/runtime/internal/shutdown.d.mts +1 -2
- package/dist/runtime/internal/shutdown.mjs +3 -2
- package/dist/runtime/internal/task.mjs +1 -2
- package/dist/types/index.d.mts +1603 -10
- package/dist/vite.d.mts +5 -0
- package/dist/vite.mjs +94 -30
- package/lib/index.mjs +1 -0
- package/lib/indexd.mts +1 -0
- package/lib/runtime/meta.mjs +35 -0
- package/package.json +40 -41
- package/dist/_chunks/build.mjs +0 -84
- package/dist/_chunks/build3.mjs +0 -6452
- package/dist/_chunks/detect-acorn.mjs +0 -503
- package/dist/_chunks/index.mjs +0 -22242
- package/dist/_chunks/json5.mjs +0 -68
- package/dist/_chunks/jsonc.mjs +0 -51
- package/dist/_chunks/toml.mjs +0 -259
- package/dist/_chunks/yaml.mjs +0 -86
- package/dist/index.mjs +0 -55
- package/dist/node_modules/klona/dist/index.mjs +0 -81
- package/dist/node_modules/klona/full/index.mjs +0 -53
- package/dist/node_modules/klona/package.json +0 -74
- package/dist/node_modules/std-env/dist/index.mjs +0 -1
- package/dist/node_modules/std-env/package.json +0 -46
- package/dist/presets.mjs +0 -2460
- package/dist/runtime/internal/debug.d.mts +0 -2
- package/dist/runtime/internal/debug.mjs +0 -5
- package/lib/runtime-meta.mjs +0 -38
- /package/dist/{cli → _cli}/common.mjs +0 -0
- /package/lib/{runtime-meta.d.mts → runtime/meta.d.mts} +0 -0
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
// Matches the scheme of a URL, eg "http://"
|
|
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 /* Absolute */,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function parseUrl(input) {
|
|
61
|
+
if (isSchemeRelativeUrl(input)) {
|
|
62
|
+
const url = parseAbsoluteUrl('http:' + input);
|
|
63
|
+
url.scheme = '';
|
|
64
|
+
url.type = 6 /* SchemeRelative */;
|
|
65
|
+
return url;
|
|
66
|
+
}
|
|
67
|
+
if (isAbsolutePath(input)) {
|
|
68
|
+
const url = parseAbsoluteUrl('http://foo.com' + input);
|
|
69
|
+
url.scheme = '';
|
|
70
|
+
url.host = '';
|
|
71
|
+
url.type = 5 /* AbsolutePath */;
|
|
72
|
+
return url;
|
|
73
|
+
}
|
|
74
|
+
if (isFileUrl(input))
|
|
75
|
+
return parseFileUrl(input);
|
|
76
|
+
if (isAbsoluteUrl(input))
|
|
77
|
+
return parseAbsoluteUrl(input);
|
|
78
|
+
const url = parseAbsoluteUrl('http://foo.com/' + input);
|
|
79
|
+
url.scheme = '';
|
|
80
|
+
url.host = '';
|
|
81
|
+
url.type = input
|
|
82
|
+
? input.startsWith('?')
|
|
83
|
+
? 3 /* Query */
|
|
84
|
+
: input.startsWith('#')
|
|
85
|
+
? 2 /* Hash */
|
|
86
|
+
: 4 /* RelativePath */
|
|
87
|
+
: 1 /* Empty */;
|
|
88
|
+
return url;
|
|
89
|
+
}
|
|
90
|
+
function stripPathFilename(path) {
|
|
91
|
+
// If a path ends with a parent directory "..", then it's a relative path with excess parent
|
|
92
|
+
// paths. It's not a file, so we can't strip it.
|
|
93
|
+
if (path.endsWith('/..'))
|
|
94
|
+
return path;
|
|
95
|
+
const index = path.lastIndexOf('/');
|
|
96
|
+
return path.slice(0, index + 1);
|
|
97
|
+
}
|
|
98
|
+
function mergePaths(url, base) {
|
|
99
|
+
normalizePath(base, base.type);
|
|
100
|
+
// If the path is just a "/", then it was an empty path to begin with (remember, we're a relative
|
|
101
|
+
// path).
|
|
102
|
+
if (url.path === '/') {
|
|
103
|
+
url.path = base.path;
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
// Resolution happens relative to the base path's directory, not the file.
|
|
107
|
+
url.path = stripPathFilename(base.path) + url.path;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* The path can have empty directories "//", unneeded parents "foo/..", or current directory
|
|
112
|
+
* "foo/.". We need to normalize to a standard representation.
|
|
113
|
+
*/
|
|
114
|
+
function normalizePath(url, type) {
|
|
115
|
+
const rel = type <= 4 /* RelativePath */;
|
|
116
|
+
const pieces = url.path.split('/');
|
|
117
|
+
// We need to preserve the first piece always, so that we output a leading slash. The item at
|
|
118
|
+
// pieces[0] is an empty string.
|
|
119
|
+
let pointer = 1;
|
|
120
|
+
// Positive is the number of real directories we've output, used for popping a parent directory.
|
|
121
|
+
// Eg, "foo/bar/.." will have a positive 2, and we can decrement to be left with just "foo".
|
|
122
|
+
let positive = 0;
|
|
123
|
+
// We need to keep a trailing slash if we encounter an empty directory (eg, splitting "foo/" will
|
|
124
|
+
// generate `["foo", ""]` pieces). And, if we pop a parent directory. But once we encounter a
|
|
125
|
+
// real directory, we won't need to append, unless the other conditions happen again.
|
|
126
|
+
let addTrailingSlash = false;
|
|
127
|
+
for (let i = 1; i < pieces.length; i++) {
|
|
128
|
+
const piece = pieces[i];
|
|
129
|
+
// An empty directory, could be a trailing slash, or just a double "//" in the path.
|
|
130
|
+
if (!piece) {
|
|
131
|
+
addTrailingSlash = true;
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
// If we encounter a real directory, then we don't need to append anymore.
|
|
135
|
+
addTrailingSlash = false;
|
|
136
|
+
// A current directory, which we can always drop.
|
|
137
|
+
if (piece === '.')
|
|
138
|
+
continue;
|
|
139
|
+
// A parent directory, we need to see if there are any real directories we can pop. Else, we
|
|
140
|
+
// have an excess of parents, and we'll need to keep the "..".
|
|
141
|
+
if (piece === '..') {
|
|
142
|
+
if (positive) {
|
|
143
|
+
addTrailingSlash = true;
|
|
144
|
+
positive--;
|
|
145
|
+
pointer--;
|
|
146
|
+
}
|
|
147
|
+
else if (rel) {
|
|
148
|
+
// If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute
|
|
149
|
+
// URL, protocol relative URL, or an absolute path, we don't need to keep excess.
|
|
150
|
+
pieces[pointer++] = piece;
|
|
151
|
+
}
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
// We've encountered a real directory. Move it to the next insertion pointer, which accounts for
|
|
155
|
+
// any popped or dropped directories.
|
|
156
|
+
pieces[pointer++] = piece;
|
|
157
|
+
positive++;
|
|
158
|
+
}
|
|
159
|
+
let path = '';
|
|
160
|
+
for (let i = 1; i < pointer; i++) {
|
|
161
|
+
path += '/' + pieces[i];
|
|
162
|
+
}
|
|
163
|
+
if (!path || (addTrailingSlash && !path.endsWith('/..'))) {
|
|
164
|
+
path += '/';
|
|
165
|
+
}
|
|
166
|
+
url.path = path;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Attempts to resolve `input` URL/path relative to `base`.
|
|
170
|
+
*/
|
|
171
|
+
function resolve(input, base) {
|
|
172
|
+
if (!input && !base)
|
|
173
|
+
return '';
|
|
174
|
+
const url = parseUrl(input);
|
|
175
|
+
let inputType = url.type;
|
|
176
|
+
if (base && inputType !== 7 /* Absolute */) {
|
|
177
|
+
const baseUrl = parseUrl(base);
|
|
178
|
+
const baseType = baseUrl.type;
|
|
179
|
+
switch (inputType) {
|
|
180
|
+
case 1 /* Empty */:
|
|
181
|
+
url.hash = baseUrl.hash;
|
|
182
|
+
// fall through
|
|
183
|
+
case 2 /* Hash */:
|
|
184
|
+
url.query = baseUrl.query;
|
|
185
|
+
// fall through
|
|
186
|
+
case 3 /* Query */:
|
|
187
|
+
case 4 /* RelativePath */:
|
|
188
|
+
mergePaths(url, baseUrl);
|
|
189
|
+
// fall through
|
|
190
|
+
case 5 /* AbsolutePath */:
|
|
191
|
+
// The host, user, and port are joined, you can't copy one without the others.
|
|
192
|
+
url.user = baseUrl.user;
|
|
193
|
+
url.host = baseUrl.host;
|
|
194
|
+
url.port = baseUrl.port;
|
|
195
|
+
// fall through
|
|
196
|
+
case 6 /* SchemeRelative */:
|
|
197
|
+
// The input doesn't have a schema at least, so we need to copy at least that over.
|
|
198
|
+
url.scheme = baseUrl.scheme;
|
|
199
|
+
}
|
|
200
|
+
if (baseType > inputType)
|
|
201
|
+
inputType = baseType;
|
|
202
|
+
}
|
|
203
|
+
normalizePath(url, inputType);
|
|
204
|
+
const queryHash = url.query + url.hash;
|
|
205
|
+
switch (inputType) {
|
|
206
|
+
// This is impossible, because of the empty checks at the start of the function.
|
|
207
|
+
// case UrlType.Empty:
|
|
208
|
+
case 2 /* Hash */:
|
|
209
|
+
case 3 /* Query */:
|
|
210
|
+
return queryHash;
|
|
211
|
+
case 4 /* RelativePath */: {
|
|
212
|
+
// The first char is always a "/", and we need it to be relative.
|
|
213
|
+
const path = url.path.slice(1);
|
|
214
|
+
if (!path)
|
|
215
|
+
return queryHash || '.';
|
|
216
|
+
if (isRelative(base || input) && !isRelative(path)) {
|
|
217
|
+
// If base started with a leading ".", or there is no base and input started with a ".",
|
|
218
|
+
// then we need to ensure that the relative path starts with a ".". We don't know if
|
|
219
|
+
// relative starts with a "..", though, so check before prepending.
|
|
220
|
+
return './' + path + queryHash;
|
|
221
|
+
}
|
|
222
|
+
return path + queryHash;
|
|
223
|
+
}
|
|
224
|
+
case 5 /* AbsolutePath */:
|
|
225
|
+
return url.path + queryHash;
|
|
226
|
+
default:
|
|
227
|
+
return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export { resolve as r };
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
// src/vlq.ts
|
|
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
|
+
const c = reader.next();
|
|
18
|
+
integer = charToInt[c];
|
|
19
|
+
value |= (integer & 31) << shift;
|
|
20
|
+
shift += 5;
|
|
21
|
+
} while (integer & 32);
|
|
22
|
+
const shouldNegate = value & 1;
|
|
23
|
+
value >>>= 1;
|
|
24
|
+
if (shouldNegate) {
|
|
25
|
+
value = -2147483648 | -value;
|
|
26
|
+
}
|
|
27
|
+
return relative + value;
|
|
28
|
+
}
|
|
29
|
+
function encodeInteger(builder, num, relative) {
|
|
30
|
+
let delta = num - relative;
|
|
31
|
+
delta = delta < 0 ? -delta << 1 | 1 : delta << 1;
|
|
32
|
+
do {
|
|
33
|
+
let clamped = delta & 31;
|
|
34
|
+
delta >>>= 5;
|
|
35
|
+
if (delta > 0) clamped |= 32;
|
|
36
|
+
builder.write(intToChar[clamped]);
|
|
37
|
+
} while (delta > 0);
|
|
38
|
+
return num;
|
|
39
|
+
}
|
|
40
|
+
function hasMoreVlq(reader, max) {
|
|
41
|
+
if (reader.pos >= max) return false;
|
|
42
|
+
return reader.peek() !== comma;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// src/strings.ts
|
|
46
|
+
var bufLength = 1024 * 16;
|
|
47
|
+
var td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? {
|
|
48
|
+
decode(buf) {
|
|
49
|
+
const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
50
|
+
return out.toString();
|
|
51
|
+
}
|
|
52
|
+
} : {
|
|
53
|
+
decode(buf) {
|
|
54
|
+
let out = "";
|
|
55
|
+
for (let i = 0; i < buf.length; i++) {
|
|
56
|
+
out += String.fromCharCode(buf[i]);
|
|
57
|
+
}
|
|
58
|
+
return out;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var StringWriter = class {
|
|
62
|
+
constructor() {
|
|
63
|
+
this.pos = 0;
|
|
64
|
+
this.out = "";
|
|
65
|
+
this.buffer = new Uint8Array(bufLength);
|
|
66
|
+
}
|
|
67
|
+
write(v) {
|
|
68
|
+
const { buffer } = this;
|
|
69
|
+
buffer[this.pos++] = v;
|
|
70
|
+
if (this.pos === bufLength) {
|
|
71
|
+
this.out += td.decode(buffer);
|
|
72
|
+
this.pos = 0;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
flush() {
|
|
76
|
+
const { buffer, out, pos } = this;
|
|
77
|
+
return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
var StringReader = class {
|
|
81
|
+
constructor(buffer) {
|
|
82
|
+
this.pos = 0;
|
|
83
|
+
this.buffer = buffer;
|
|
84
|
+
}
|
|
85
|
+
next() {
|
|
86
|
+
return this.buffer.charCodeAt(this.pos++);
|
|
87
|
+
}
|
|
88
|
+
peek() {
|
|
89
|
+
return this.buffer.charCodeAt(this.pos);
|
|
90
|
+
}
|
|
91
|
+
indexOf(char) {
|
|
92
|
+
const { buffer, pos } = this;
|
|
93
|
+
const idx = buffer.indexOf(char, pos);
|
|
94
|
+
return idx === -1 ? buffer.length : idx;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
// src/sourcemap-codec.ts
|
|
99
|
+
function decode(mappings) {
|
|
100
|
+
const { length } = mappings;
|
|
101
|
+
const reader = new StringReader(mappings);
|
|
102
|
+
const decoded = [];
|
|
103
|
+
let genColumn = 0;
|
|
104
|
+
let sourcesIndex = 0;
|
|
105
|
+
let sourceLine = 0;
|
|
106
|
+
let sourceColumn = 0;
|
|
107
|
+
let namesIndex = 0;
|
|
108
|
+
do {
|
|
109
|
+
const semi = reader.indexOf(";");
|
|
110
|
+
const line = [];
|
|
111
|
+
let sorted = true;
|
|
112
|
+
let lastCol = 0;
|
|
113
|
+
genColumn = 0;
|
|
114
|
+
while (reader.pos < semi) {
|
|
115
|
+
let seg;
|
|
116
|
+
genColumn = decodeInteger(reader, genColumn);
|
|
117
|
+
if (genColumn < lastCol) sorted = false;
|
|
118
|
+
lastCol = genColumn;
|
|
119
|
+
if (hasMoreVlq(reader, semi)) {
|
|
120
|
+
sourcesIndex = decodeInteger(reader, sourcesIndex);
|
|
121
|
+
sourceLine = decodeInteger(reader, sourceLine);
|
|
122
|
+
sourceColumn = decodeInteger(reader, sourceColumn);
|
|
123
|
+
if (hasMoreVlq(reader, semi)) {
|
|
124
|
+
namesIndex = decodeInteger(reader, namesIndex);
|
|
125
|
+
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];
|
|
126
|
+
} else {
|
|
127
|
+
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];
|
|
128
|
+
}
|
|
129
|
+
} else {
|
|
130
|
+
seg = [genColumn];
|
|
131
|
+
}
|
|
132
|
+
line.push(seg);
|
|
133
|
+
reader.pos++;
|
|
134
|
+
}
|
|
135
|
+
if (!sorted) sort(line);
|
|
136
|
+
decoded.push(line);
|
|
137
|
+
reader.pos = semi + 1;
|
|
138
|
+
} while (reader.pos <= length);
|
|
139
|
+
return decoded;
|
|
140
|
+
}
|
|
141
|
+
function sort(line) {
|
|
142
|
+
line.sort(sortComparator);
|
|
143
|
+
}
|
|
144
|
+
function sortComparator(a, b) {
|
|
145
|
+
return a[0] - b[0];
|
|
146
|
+
}
|
|
147
|
+
function encode(decoded) {
|
|
148
|
+
const writer = new StringWriter();
|
|
149
|
+
let sourcesIndex = 0;
|
|
150
|
+
let sourceLine = 0;
|
|
151
|
+
let sourceColumn = 0;
|
|
152
|
+
let namesIndex = 0;
|
|
153
|
+
for (let i = 0; i < decoded.length; i++) {
|
|
154
|
+
const line = decoded[i];
|
|
155
|
+
if (i > 0) writer.write(semicolon);
|
|
156
|
+
if (line.length === 0) continue;
|
|
157
|
+
let genColumn = 0;
|
|
158
|
+
for (let j = 0; j < line.length; j++) {
|
|
159
|
+
const segment = line[j];
|
|
160
|
+
if (j > 0) writer.write(comma);
|
|
161
|
+
genColumn = encodeInteger(writer, segment[0], genColumn);
|
|
162
|
+
if (segment.length === 1) continue;
|
|
163
|
+
sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
|
|
164
|
+
sourceLine = encodeInteger(writer, segment[2], sourceLine);
|
|
165
|
+
sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
|
|
166
|
+
if (segment.length === 4) continue;
|
|
167
|
+
namesIndex = encodeInteger(writer, segment[4], namesIndex);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return writer.flush();
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export { decode as d, encode as e };
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { d as decode } from './sourcemap-codec.mjs';
|
|
2
|
+
import { r as resolve } from './resolve-uri.mjs';
|
|
3
|
+
|
|
4
|
+
// src/trace-mapping.ts
|
|
5
|
+
|
|
6
|
+
// src/strip-filename.ts
|
|
7
|
+
function stripFilename(path) {
|
|
8
|
+
if (!path) return "";
|
|
9
|
+
const index = path.lastIndexOf("/");
|
|
10
|
+
return path.slice(0, index + 1);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// src/resolve.ts
|
|
14
|
+
function resolver(mapUrl, sourceRoot) {
|
|
15
|
+
const from = stripFilename(mapUrl);
|
|
16
|
+
const prefix = sourceRoot ? sourceRoot + "/" : "";
|
|
17
|
+
return (source) => resolve(prefix + (source || ""), from);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// src/sourcemap-segment.ts
|
|
21
|
+
var COLUMN = 0;
|
|
22
|
+
|
|
23
|
+
// src/sort.ts
|
|
24
|
+
function maybeSort(mappings, owned) {
|
|
25
|
+
const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
|
|
26
|
+
if (unsortedIndex === mappings.length) return mappings;
|
|
27
|
+
if (!owned) mappings = mappings.slice();
|
|
28
|
+
for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) {
|
|
29
|
+
mappings[i] = sortSegments(mappings[i], owned);
|
|
30
|
+
}
|
|
31
|
+
return mappings;
|
|
32
|
+
}
|
|
33
|
+
function nextUnsortedSegmentLine(mappings, start) {
|
|
34
|
+
for (let i = start; i < mappings.length; i++) {
|
|
35
|
+
if (!isSorted(mappings[i])) return i;
|
|
36
|
+
}
|
|
37
|
+
return mappings.length;
|
|
38
|
+
}
|
|
39
|
+
function isSorted(line) {
|
|
40
|
+
for (let j = 1; j < line.length; j++) {
|
|
41
|
+
if (line[j][COLUMN] < line[j - 1][COLUMN]) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
function sortSegments(line, owned) {
|
|
48
|
+
if (!owned) line = line.slice();
|
|
49
|
+
return line.sort(sortComparator);
|
|
50
|
+
}
|
|
51
|
+
function sortComparator(a, b) {
|
|
52
|
+
return a[COLUMN] - b[COLUMN];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// src/binary-search.ts
|
|
56
|
+
var found = false;
|
|
57
|
+
function binarySearch(haystack, needle, low, high) {
|
|
58
|
+
while (low <= high) {
|
|
59
|
+
const mid = low + (high - low >> 1);
|
|
60
|
+
const cmp = haystack[mid][COLUMN] - needle;
|
|
61
|
+
if (cmp === 0) {
|
|
62
|
+
found = true;
|
|
63
|
+
return mid;
|
|
64
|
+
}
|
|
65
|
+
if (cmp < 0) {
|
|
66
|
+
low = mid + 1;
|
|
67
|
+
} else {
|
|
68
|
+
high = mid - 1;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
found = false;
|
|
72
|
+
return low - 1;
|
|
73
|
+
}
|
|
74
|
+
function lowerBound(haystack, needle, index) {
|
|
75
|
+
for (let i = index - 1; i >= 0; index = i--) {
|
|
76
|
+
if (haystack[i][COLUMN] !== needle) break;
|
|
77
|
+
}
|
|
78
|
+
return index;
|
|
79
|
+
}
|
|
80
|
+
function memoizedState() {
|
|
81
|
+
return {
|
|
82
|
+
lastKey: -1,
|
|
83
|
+
lastNeedle: -1,
|
|
84
|
+
lastIndex: -1
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function memoizedBinarySearch(haystack, needle, state, key) {
|
|
88
|
+
const { lastKey, lastNeedle, lastIndex } = state;
|
|
89
|
+
let low = 0;
|
|
90
|
+
let high = haystack.length - 1;
|
|
91
|
+
if (key === lastKey) {
|
|
92
|
+
if (needle === lastNeedle) {
|
|
93
|
+
found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle;
|
|
94
|
+
return lastIndex;
|
|
95
|
+
}
|
|
96
|
+
if (needle >= lastNeedle) {
|
|
97
|
+
low = lastIndex === -1 ? 0 : lastIndex;
|
|
98
|
+
} else {
|
|
99
|
+
high = lastIndex;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
state.lastKey = key;
|
|
103
|
+
state.lastNeedle = needle;
|
|
104
|
+
return state.lastIndex = binarySearch(haystack, needle, low, high);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// src/types.ts
|
|
108
|
+
function parse(map) {
|
|
109
|
+
return typeof map === "string" ? JSON.parse(map) : map;
|
|
110
|
+
}
|
|
111
|
+
var TraceMap = class {
|
|
112
|
+
constructor(map, mapUrl) {
|
|
113
|
+
const isString = typeof map === "string";
|
|
114
|
+
if (!isString && map._decodedMemo) return map;
|
|
115
|
+
const parsed = parse(map);
|
|
116
|
+
const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;
|
|
117
|
+
this.version = version;
|
|
118
|
+
this.file = file;
|
|
119
|
+
this.names = names || [];
|
|
120
|
+
this.sourceRoot = sourceRoot;
|
|
121
|
+
this.sources = sources;
|
|
122
|
+
this.sourcesContent = sourcesContent;
|
|
123
|
+
this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0;
|
|
124
|
+
const resolve = resolver(mapUrl, sourceRoot);
|
|
125
|
+
this.resolvedSources = sources.map(resolve);
|
|
126
|
+
const { mappings } = parsed;
|
|
127
|
+
if (typeof mappings === "string") {
|
|
128
|
+
this._encoded = mappings;
|
|
129
|
+
this._decoded = void 0;
|
|
130
|
+
} else if (Array.isArray(mappings)) {
|
|
131
|
+
this._encoded = void 0;
|
|
132
|
+
this._decoded = maybeSort(mappings, isString);
|
|
133
|
+
} else if (parsed.sections) {
|
|
134
|
+
throw new Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`);
|
|
135
|
+
} else {
|
|
136
|
+
throw new Error(`invalid source map: ${JSON.stringify(parsed)}`);
|
|
137
|
+
}
|
|
138
|
+
this._decodedMemo = memoizedState();
|
|
139
|
+
this._bySources = void 0;
|
|
140
|
+
this._bySourceMemos = void 0;
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
function cast(map) {
|
|
144
|
+
return map;
|
|
145
|
+
}
|
|
146
|
+
function decodedMappings(map) {
|
|
147
|
+
var _a;
|
|
148
|
+
return (_a = cast(map))._decoded || (_a._decoded = decode(cast(map)._encoded));
|
|
149
|
+
}
|
|
150
|
+
function traceSegment(map, line, column) {
|
|
151
|
+
const decoded = decodedMappings(map);
|
|
152
|
+
if (line >= decoded.length) return null;
|
|
153
|
+
const segments = decoded[line];
|
|
154
|
+
const index = traceSegmentInternal(
|
|
155
|
+
segments,
|
|
156
|
+
cast(map)._decodedMemo,
|
|
157
|
+
line,
|
|
158
|
+
column);
|
|
159
|
+
return index === -1 ? null : segments[index];
|
|
160
|
+
}
|
|
161
|
+
function traceSegmentInternal(segments, memo, line, column, bias) {
|
|
162
|
+
let index = memoizedBinarySearch(segments, column, memo, line);
|
|
163
|
+
if (found) {
|
|
164
|
+
index = (lowerBound)(segments, column, index);
|
|
165
|
+
}
|
|
166
|
+
if (index === -1 || index === segments.length) return -1;
|
|
167
|
+
return index;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export { TraceMap as T, decodedMappings as d, traceSegment as t };
|