@stillwind/integration 0.0.0-stage → 0.1.0-rc.0
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/LICENSE +21 -0
- package/README.md +67 -2
- package/dist/NPM-THIRD-PARTY-LICENSES +52 -0
- package/dist/astro/development.d.ts +15 -0
- package/dist/astro/development.js +34 -0
- package/dist/astro/development.js.map +1 -0
- package/dist/astro/index.d.ts +17 -0
- package/dist/astro/index.js +194 -0
- package/dist/astro/index.js.map +1 -0
- package/dist/astro/middleware.d.ts +2 -0
- package/dist/astro/middleware.js +64 -0
- package/dist/astro/middleware.js.map +1 -0
- package/dist/binding-files-Ds5NpyVV.js +45 -0
- package/dist/binding-files-Ds5NpyVV.js.map +1 -0
- package/dist/emission-BVi5aRbb.js +520 -0
- package/dist/emission-BVi5aRbb.js.map +1 -0
- package/dist/fresh/index.d.ts +10 -0
- package/dist/fresh/index.js +55 -0
- package/dist/fresh/index.js.map +1 -0
- package/dist/gen-mapping-D7jFzOEh.js +559 -0
- package/dist/gen-mapping-D7jFzOEh.js.map +1 -0
- package/dist/index-DFfbZxNT.d.ts +12 -0
- package/dist/next/css-loader.d.ts +14 -0
- package/dist/next/css-loader.js +58 -0
- package/dist/next/css-loader.js.map +1 -0
- package/dist/next/index.d.ts +15 -0
- package/dist/next/index.js +66 -0
- package/dist/next/index.js.map +1 -0
- package/dist/node-loader-D-3Ynpy1.d.ts +19 -0
- package/dist/nuxt/index.d.ts +13 -0
- package/dist/nuxt/index.js +64 -0
- package/dist/nuxt/index.js.map +1 -0
- package/dist/plugin-C_ZFfzo2.js +2572 -0
- package/dist/plugin-C_ZFfzo2.js.map +1 -0
- package/dist/plugin-aV0zIIAe.d.ts +278 -0
- package/dist/plugin-mPiBLdqa.js +79 -0
- package/dist/plugin-mPiBLdqa.js.map +1 -0
- package/dist/project-BNw0nZBE.d.ts +58 -0
- package/dist/project-C3IH7geC.js +182 -0
- package/dist/project-C3IH7geC.js.map +1 -0
- package/dist/project-DUGu8g_L.d.ts +15 -0
- package/dist/rsbuild/index.d.ts +28 -0
- package/dist/rsbuild/index.js +77 -0
- package/dist/rsbuild/index.js.map +1 -0
- package/dist/rspack/index.d.ts +3 -0
- package/dist/rspack/index.js +1 -0
- package/dist/rules-BvKsL2at.js +91 -0
- package/dist/rules-BvKsL2at.js.map +1 -0
- package/dist/session-B9_rp9TH.d.ts +72 -0
- package/dist/session-DHUCQMG5.js +117 -0
- package/dist/session-DHUCQMG5.js.map +1 -0
- package/dist/source-map-loader-CBLiYaBI.d.ts +128 -0
- package/dist/sveltekit/handle.d.ts +13 -0
- package/dist/sveltekit/handle.js +16 -0
- package/dist/sveltekit/handle.js.map +1 -0
- package/dist/trace-mapping-DV_eP3r7.d.ts +58 -0
- package/dist/turbopack/css-loader.d.ts +15 -0
- package/dist/turbopack/css-loader.js +44 -0
- package/dist/turbopack/css-loader.js.map +1 -0
- package/dist/turbopack/index.d.ts +54 -0
- package/dist/turbopack/index.js +1 -0
- package/dist/turbopack/loader.d.ts +13 -0
- package/dist/turbopack/loader.js +70 -0
- package/dist/turbopack/loader.js.map +1 -0
- package/dist/turbopack/node-loader.d.ts +2 -0
- package/dist/turbopack/node-loader.js +20 -0
- package/dist/turbopack/node-loader.js.map +1 -0
- package/dist/turbopack/stillwind-turbopack.css +0 -0
- package/dist/vite/index.d.ts +3 -0
- package/dist/vite/index.js +1 -0
- package/dist/vite/runtime-source-map.d.ts +19 -0
- package/dist/vite/runtime-source-map.js +106 -0
- package/dist/vite/runtime-source-map.js.map +1 -0
- package/dist/vite/runtime.d.ts +58 -0
- package/dist/vite/runtime.js +90 -0
- package/dist/vite/runtime.js.map +1 -0
- package/dist/webpack/css-loader.d.ts +17 -0
- package/dist/webpack/css-loader.js +36 -0
- package/dist/webpack/css-loader.js.map +1 -0
- package/dist/webpack/css-map-loader.d.ts +24 -0
- package/dist/webpack/css-map-loader.js +43 -0
- package/dist/webpack/css-map-loader.js.map +1 -0
- package/dist/webpack/document-loader.d.ts +12 -0
- package/dist/webpack/document-loader.js +19 -0
- package/dist/webpack/document-loader.js.map +1 -0
- package/dist/webpack/fragment-loader.d.ts +9 -0
- package/dist/webpack/fragment-loader.js +23 -0
- package/dist/webpack/fragment-loader.js.map +1 -0
- package/dist/webpack/index.d.ts +3 -0
- package/dist/webpack/index.js +1 -0
- package/dist/webpack/loader.d.ts +35 -0
- package/dist/webpack/loader.js +199 -0
- package/dist/webpack/loader.js.map +1 -0
- package/dist/webpack/source-loader.d.ts +11 -0
- package/dist/webpack/source-loader.js +17 -0
- package/dist/webpack/source-loader.js.map +1 -0
- package/dist/webpack/source-map-loader.d.ts +2 -0
- package/dist/webpack/source-map-loader.js +35 -0
- package/dist/webpack/source-map-loader.js.map +1 -0
- package/dist/webpack/stillwind-fragment.d.ts +1 -0
- package/dist/webpack/stillwind-fragment.js +1 -0
- package/dist/webpack/stillwind-webpack.css +1 -0
- package/package.json +133 -3
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { r as createViteProject, t as createVitePlugins } from "../plugin-C_ZFfzo2.js";
|
|
2
|
+
// src/fresh/manifest.ts
|
|
3
|
+
/** Filters repeated static files for Fresh's move operation without changing the emitted manifest. */
|
|
4
|
+
function registrationManifest(source) {
|
|
5
|
+
const manifest = JSON.parse(source);
|
|
6
|
+
const registered = /* @__PURE__ */ new Set();
|
|
7
|
+
for (const entry of Object.values(manifest)) for (const field of ["assets", "css"]) entry[field] = entry[field]?.filter((file) => {
|
|
8
|
+
if (registered.has(file)) return false;
|
|
9
|
+
registered.add(file);
|
|
10
|
+
return true;
|
|
11
|
+
});
|
|
12
|
+
return JSON.stringify(manifest);
|
|
13
|
+
}
|
|
14
|
+
/** Passes unique static files to Fresh while retaining the complete manifest for route CSS. */
|
|
15
|
+
function registrationHooks() {
|
|
16
|
+
return {
|
|
17
|
+
name: "stillwind:fresh-static-files",
|
|
18
|
+
apply: "build",
|
|
19
|
+
configResolved(config) {
|
|
20
|
+
const entry = config.plugins.find((plugin) => plugin.name === "fresh:server_entry");
|
|
21
|
+
const hook = entry?.writeBundle;
|
|
22
|
+
if (!entry || !hook) throw new Error("The Stillwind Fresh integration requires the Fresh Vite plugin");
|
|
23
|
+
const original = typeof hook === "function" ? hook : hook.handler;
|
|
24
|
+
entry.writeBundle = {
|
|
25
|
+
...typeof hook === "object" ? hook : {},
|
|
26
|
+
handler(options, bundle) {
|
|
27
|
+
const manifest = bundle[".vite/manifest.json"];
|
|
28
|
+
const registration = manifest?.type === "asset" && typeof manifest.source === "string" ? {
|
|
29
|
+
...bundle,
|
|
30
|
+
[manifest.fileName]: {
|
|
31
|
+
...manifest,
|
|
32
|
+
source: registrationManifest(manifest.source)
|
|
33
|
+
}
|
|
34
|
+
} : bundle;
|
|
35
|
+
return original.call(this, options, registration);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
// src/fresh/plugin.ts
|
|
42
|
+
/**
|
|
43
|
+
* Registers Stillwind after Fresh 2's Deno source loader. Place it after `fresh()`.
|
|
44
|
+
* Macro identities use the original files in both environments, so SSR and islands
|
|
45
|
+
* receive the same classes. Vite lowers the compiled JSX for Preact.
|
|
46
|
+
*/
|
|
47
|
+
function stillwind(config = {}) {
|
|
48
|
+
return [...createVitePlugins(createViteProject(config), {
|
|
49
|
+
order: "normal",
|
|
50
|
+
originalSource: true
|
|
51
|
+
}), registrationHooks()];
|
|
52
|
+
}
|
|
53
|
+
export { stillwind };
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/fresh/manifest.ts","../../src/fresh/plugin.ts"],"sourcesContent":["import type { Plugin } from \"vite\";\n\n/** Filters repeated static files for Fresh's move operation without changing the emitted manifest. */\nexport function registrationManifest(source: string): string {\n const manifest = JSON.parse(source) as Record<string, { assets?: string[]; css?: string[] }>;\n const registered = new Set<string>();\n for (const entry of Object.values(manifest)) {\n for (const field of [\"assets\", \"css\"] as const) {\n entry[field] = entry[field]?.filter((file) => {\n if (registered.has(file)) {\n return false;\n }\n registered.add(file);\n return true;\n });\n }\n }\n return JSON.stringify(manifest);\n}\n\n/** Passes unique static files to Fresh while retaining the complete manifest for route CSS. */\nexport function registrationHooks(): Plugin {\n return {\n name: \"stillwind:fresh-static-files\",\n apply: \"build\",\n configResolved(config) {\n const entry = config.plugins.find((plugin) => plugin.name === \"fresh:server_entry\");\n const hook = entry?.writeBundle;\n if (!entry || !hook) {\n throw new Error(\"The Stillwind Fresh integration requires the Fresh Vite plugin\");\n }\n const original = typeof hook === \"function\" ? hook : hook.handler;\n entry.writeBundle = {\n ...(typeof hook === \"object\" ? hook : {}),\n handler(options, bundle) {\n const manifest = bundle[\".vite/manifest.json\"];\n const registration =\n manifest?.type === \"asset\" && typeof manifest.source === \"string\"\n ? {\n ...bundle,\n [manifest.fileName]: {\n ...manifest,\n source: registrationManifest(manifest.source),\n },\n }\n : bundle;\n return original.call(this, options, registration);\n },\n };\n },\n };\n}\n","import type { Plugin } from \"vite\";\n\nimport { createVitePlugins } from \"../vite/plugin.ts\";\nimport { createViteProject, type IntegrationConfig } from \"../vite/project.ts\";\nimport { registrationHooks } from \"./manifest.ts\";\n\nexport type { IntegrationConfig } from \"../vite/project.ts\";\n\n/**\n * Registers Stillwind after Fresh 2's Deno source loader. Place it after `fresh()`.\n * Macro identities use the original files in both environments, so SSR and islands\n * receive the same classes. Vite lowers the compiled JSX for Preact.\n */\nexport function stillwind(config: IntegrationConfig = {}): Plugin[] {\n return [\n ...createVitePlugins(createViteProject(config), {\n order: \"normal\",\n originalSource: true,\n }),\n registrationHooks(),\n ];\n}\n"],"mappings":";;;AAGA,SAAgB,qBAAqB,QAAwB;CAC3D,MAAM,WAAW,KAAK,MAAM,MAAM;CAClC,MAAM,6BAAa,IAAI,IAAY;CACnC,KAAK,MAAM,SAAS,OAAO,OAAO,QAAQ,GACxC,KAAK,MAAM,SAAS,CAAC,UAAU,KAAK,GAClC,MAAM,SAAS,MAAM,MAAM,EAAE,QAAQ,SAAS;EAC5C,IAAI,WAAW,IAAI,IAAI,GACrB,OAAO;EAET,WAAW,IAAI,IAAI;EACnB,OAAO;CACT,CAAC;CAGL,OAAO,KAAK,UAAU,QAAQ;AAChC;;AAGA,SAAgB,oBAA4B;CAC1C,OAAO;EACL,MAAM;EACN,OAAO;EACP,eAAe,QAAQ;GACrB,MAAM,QAAQ,OAAO,QAAQ,MAAM,WAAW,OAAO,SAAS,oBAAoB;GAClF,MAAM,OAAO,OAAO;GACpB,IAAI,CAAC,SAAS,CAAC,MACb,MAAM,IAAI,MAAM,gEAAgE;GAElF,MAAM,WAAW,OAAO,SAAS,aAAa,OAAO,KAAK;GAC1D,MAAM,cAAc;IAClB,GAAI,OAAO,SAAS,WAAW,OAAO,CAAC;IACvC,QAAQ,SAAS,QAAQ;KACvB,MAAM,WAAW,OAAO;KACxB,MAAM,eACJ,UAAU,SAAS,WAAW,OAAO,SAAS,WAAW,WACrD;MACE,GAAG;OACF,SAAS,WAAW;OACnB,GAAG;OACH,QAAQ,qBAAqB,SAAS,MAAM;MAC9C;KACF,IACA;KACN,OAAO,SAAS,KAAK,MAAM,SAAS,YAAY;IAClD;GACF;EACF;CACF;AACF;;;;;;;ACtCA,SAAgB,UAAU,SAA4B,CAAC,GAAa;CAClE,OAAO,CACL,GAAG,kBAAkB,kBAAkB,MAAM,GAAG;EAC9C,OAAO;EACP,gBAAgB;CAClB,CAAC,GACD,kBAAkB,CACpB;AACF"}
|
|
@@ -0,0 +1,559 @@
|
|
|
1
|
+
// ../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.6.0/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 = /* @__PURE__ */ new Uint8Array(64);
|
|
6
|
+
var charToInt = /* @__PURE__ */ 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) {
|
|
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
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
function decodeSign(num) {
|
|
24
|
+
return num & 1 ? -2147483648 | -(num >>> 1) : num >>> 1;
|
|
25
|
+
}
|
|
26
|
+
function encodeInteger(builder, num) {
|
|
27
|
+
do {
|
|
28
|
+
let clamped = num & 31;
|
|
29
|
+
num >>>= 5;
|
|
30
|
+
if (num > 0) clamped |= 32;
|
|
31
|
+
builder.write(intToChar[clamped]);
|
|
32
|
+
} while (num > 0);
|
|
33
|
+
}
|
|
34
|
+
function encodeSign(num) {
|
|
35
|
+
return num < 0 ? -num << 1 | 1 : num << 1;
|
|
36
|
+
}
|
|
37
|
+
function hasMoreVlq(reader, max) {
|
|
38
|
+
if (reader.pos >= max) return false;
|
|
39
|
+
return reader.peek() !== comma;
|
|
40
|
+
}
|
|
41
|
+
var bufLength = 16384;
|
|
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 += decodeSign(decodeInteger(reader));
|
|
103
|
+
if (genColumn < lastCol) sorted = false;
|
|
104
|
+
lastCol = genColumn;
|
|
105
|
+
if (hasMoreVlq(reader, semi)) {
|
|
106
|
+
sourcesIndex += decodeSign(decodeInteger(reader));
|
|
107
|
+
sourceLine += decodeSign(decodeInteger(reader));
|
|
108
|
+
sourceColumn += decodeSign(decodeInteger(reader));
|
|
109
|
+
if (hasMoreVlq(reader, semi)) {
|
|
110
|
+
namesIndex += decodeSign(decodeInteger(reader));
|
|
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$1);
|
|
136
|
+
}
|
|
137
|
+
function sortComparator$1(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
|
+
encodeInteger(writer, encodeSign(segment[0] - genColumn));
|
|
155
|
+
genColumn = segment[0];
|
|
156
|
+
if (segment.length === 1) continue;
|
|
157
|
+
encodeInteger(writer, encodeSign(segment[1] - sourcesIndex));
|
|
158
|
+
encodeInteger(writer, encodeSign(segment[2] - sourceLine));
|
|
159
|
+
encodeInteger(writer, encodeSign(segment[3] - sourceColumn));
|
|
160
|
+
sourcesIndex = segment[1];
|
|
161
|
+
sourceLine = segment[2];
|
|
162
|
+
sourceColumn = segment[3];
|
|
163
|
+
if (segment.length === 4) continue;
|
|
164
|
+
encodeInteger(writer, encodeSign(segment[4] - namesIndex));
|
|
165
|
+
namesIndex = segment[4];
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return writer.flush();
|
|
169
|
+
}
|
|
170
|
+
// ../../node_modules/.pnpm/@jridgewell+resolve-uri@3.1.2/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs
|
|
171
|
+
const schemeRegex = /^[\w+.-]+:\/\//;
|
|
172
|
+
/**
|
|
173
|
+
* Matches the parts of a URL:
|
|
174
|
+
* 1. Scheme, including ":", guaranteed.
|
|
175
|
+
* 2. User/password, including "@", optional.
|
|
176
|
+
* 3. Host, guaranteed.
|
|
177
|
+
* 4. Port, including ":", optional.
|
|
178
|
+
* 5. Path, including "/", optional.
|
|
179
|
+
* 6. Query, including "?", optional.
|
|
180
|
+
* 7. Hash, including "#", optional.
|
|
181
|
+
*/
|
|
182
|
+
const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
|
|
183
|
+
/**
|
|
184
|
+
* File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start
|
|
185
|
+
* with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).
|
|
186
|
+
*
|
|
187
|
+
* 1. Host, optional.
|
|
188
|
+
* 2. Path, which may include "/", guaranteed.
|
|
189
|
+
* 3. Query, including "?", optional.
|
|
190
|
+
* 4. Hash, including "#", optional.
|
|
191
|
+
*/
|
|
192
|
+
const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
|
|
193
|
+
function isAbsoluteUrl(input) {
|
|
194
|
+
return schemeRegex.test(input);
|
|
195
|
+
}
|
|
196
|
+
function isSchemeRelativeUrl(input) {
|
|
197
|
+
return input.startsWith("//");
|
|
198
|
+
}
|
|
199
|
+
function isAbsolutePath(input) {
|
|
200
|
+
return input.startsWith("/");
|
|
201
|
+
}
|
|
202
|
+
function isFileUrl(input) {
|
|
203
|
+
return input.startsWith("file:");
|
|
204
|
+
}
|
|
205
|
+
function isRelative(input) {
|
|
206
|
+
return /^[.?#]/.test(input);
|
|
207
|
+
}
|
|
208
|
+
function parseAbsoluteUrl(input) {
|
|
209
|
+
const match = urlRegex.exec(input);
|
|
210
|
+
return makeUrl(match[1], match[2] || "", match[3], match[4] || "", match[5] || "/", match[6] || "", match[7] || "");
|
|
211
|
+
}
|
|
212
|
+
function parseFileUrl(input) {
|
|
213
|
+
const match = fileRegex.exec(input);
|
|
214
|
+
const path = match[2];
|
|
215
|
+
return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path) ? path : "/" + path, match[3] || "", match[4] || "");
|
|
216
|
+
}
|
|
217
|
+
function makeUrl(scheme, user, host, port, path, query, hash) {
|
|
218
|
+
return {
|
|
219
|
+
scheme,
|
|
220
|
+
user,
|
|
221
|
+
host,
|
|
222
|
+
port,
|
|
223
|
+
path,
|
|
224
|
+
query,
|
|
225
|
+
hash,
|
|
226
|
+
type: 7
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
function parseUrl(input) {
|
|
230
|
+
if (isSchemeRelativeUrl(input)) {
|
|
231
|
+
const url = parseAbsoluteUrl("http:" + input);
|
|
232
|
+
url.scheme = "";
|
|
233
|
+
url.type = 6;
|
|
234
|
+
return url;
|
|
235
|
+
}
|
|
236
|
+
if (isAbsolutePath(input)) {
|
|
237
|
+
const url = parseAbsoluteUrl("http://foo.com" + input);
|
|
238
|
+
url.scheme = "";
|
|
239
|
+
url.host = "";
|
|
240
|
+
url.type = 5;
|
|
241
|
+
return url;
|
|
242
|
+
}
|
|
243
|
+
if (isFileUrl(input)) return parseFileUrl(input);
|
|
244
|
+
if (isAbsoluteUrl(input)) return parseAbsoluteUrl(input);
|
|
245
|
+
const url = parseAbsoluteUrl("http://foo.com/" + input);
|
|
246
|
+
url.scheme = "";
|
|
247
|
+
url.host = "";
|
|
248
|
+
url.type = input ? input.startsWith("?") ? 3 : input.startsWith("#") ? 2 : 4 : 1;
|
|
249
|
+
return url;
|
|
250
|
+
}
|
|
251
|
+
function stripPathFilename(path) {
|
|
252
|
+
if (path.endsWith("/..")) return path;
|
|
253
|
+
const index = path.lastIndexOf("/");
|
|
254
|
+
return path.slice(0, index + 1);
|
|
255
|
+
}
|
|
256
|
+
function mergePaths(url, base) {
|
|
257
|
+
normalizePath(base, base.type);
|
|
258
|
+
if (url.path === "/") url.path = base.path;
|
|
259
|
+
else url.path = stripPathFilename(base.path) + url.path;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* The path can have empty directories "//", unneeded parents "foo/..", or current directory
|
|
263
|
+
* "foo/.". We need to normalize to a standard representation.
|
|
264
|
+
*/
|
|
265
|
+
function normalizePath(url, type) {
|
|
266
|
+
const rel = type <= 4;
|
|
267
|
+
const pieces = url.path.split("/");
|
|
268
|
+
let pointer = 1;
|
|
269
|
+
let positive = 0;
|
|
270
|
+
let addTrailingSlash = false;
|
|
271
|
+
for (let i = 1; i < pieces.length; i++) {
|
|
272
|
+
const piece = pieces[i];
|
|
273
|
+
if (!piece) {
|
|
274
|
+
addTrailingSlash = true;
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
277
|
+
addTrailingSlash = false;
|
|
278
|
+
if (piece === ".") continue;
|
|
279
|
+
if (piece === "..") {
|
|
280
|
+
if (positive) {
|
|
281
|
+
addTrailingSlash = true;
|
|
282
|
+
positive--;
|
|
283
|
+
pointer--;
|
|
284
|
+
} else if (rel) pieces[pointer++] = piece;
|
|
285
|
+
continue;
|
|
286
|
+
}
|
|
287
|
+
pieces[pointer++] = piece;
|
|
288
|
+
positive++;
|
|
289
|
+
}
|
|
290
|
+
let path = "";
|
|
291
|
+
for (let i = 1; i < pointer; i++) path += "/" + pieces[i];
|
|
292
|
+
if (!path || addTrailingSlash && !path.endsWith("/..")) path += "/";
|
|
293
|
+
url.path = path;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Attempts to resolve `input` URL/path relative to `base`.
|
|
297
|
+
*/
|
|
298
|
+
function resolve(input, base) {
|
|
299
|
+
if (!input && !base) return "";
|
|
300
|
+
const url = parseUrl(input);
|
|
301
|
+
let inputType = url.type;
|
|
302
|
+
if (base && inputType !== 7) {
|
|
303
|
+
const baseUrl = parseUrl(base);
|
|
304
|
+
const baseType = baseUrl.type;
|
|
305
|
+
switch (inputType) {
|
|
306
|
+
case 1: url.hash = baseUrl.hash;
|
|
307
|
+
case 2: url.query = baseUrl.query;
|
|
308
|
+
case 3:
|
|
309
|
+
case 4: mergePaths(url, baseUrl);
|
|
310
|
+
case 5:
|
|
311
|
+
url.user = baseUrl.user;
|
|
312
|
+
url.host = baseUrl.host;
|
|
313
|
+
url.port = baseUrl.port;
|
|
314
|
+
case 6: url.scheme = baseUrl.scheme;
|
|
315
|
+
}
|
|
316
|
+
if (baseType > inputType) inputType = baseType;
|
|
317
|
+
}
|
|
318
|
+
normalizePath(url, inputType);
|
|
319
|
+
const queryHash = url.query + url.hash;
|
|
320
|
+
switch (inputType) {
|
|
321
|
+
case 2:
|
|
322
|
+
case 3: return queryHash;
|
|
323
|
+
case 4: {
|
|
324
|
+
const path = url.path.slice(1);
|
|
325
|
+
if (!path) return queryHash || ".";
|
|
326
|
+
if (isRelative(base || input) && !isRelative(path)) return "./" + path + queryHash;
|
|
327
|
+
return path + queryHash;
|
|
328
|
+
}
|
|
329
|
+
case 5: return url.path + queryHash;
|
|
330
|
+
default: return url.scheme + "//" + url.user + url.host + url.port + url.path + queryHash;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
// ../../node_modules/.pnpm/@jridgewell+trace-mapping@0.3.31/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs
|
|
334
|
+
function stripFilename(path) {
|
|
335
|
+
if (!path) return "";
|
|
336
|
+
const index = path.lastIndexOf("/");
|
|
337
|
+
return path.slice(0, index + 1);
|
|
338
|
+
}
|
|
339
|
+
function resolver(mapUrl, sourceRoot) {
|
|
340
|
+
const from = stripFilename(mapUrl);
|
|
341
|
+
const prefix = sourceRoot ? sourceRoot + "/" : "";
|
|
342
|
+
return (source) => resolve(prefix + (source || ""), from);
|
|
343
|
+
}
|
|
344
|
+
var COLUMN$1 = 0;
|
|
345
|
+
function maybeSort(mappings, owned) {
|
|
346
|
+
const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
|
|
347
|
+
if (unsortedIndex === mappings.length) return mappings;
|
|
348
|
+
if (!owned) mappings = mappings.slice();
|
|
349
|
+
for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) mappings[i] = sortSegments(mappings[i], owned);
|
|
350
|
+
return mappings;
|
|
351
|
+
}
|
|
352
|
+
function nextUnsortedSegmentLine(mappings, start) {
|
|
353
|
+
for (let i = start; i < mappings.length; i++) if (!isSorted(mappings[i])) return i;
|
|
354
|
+
return mappings.length;
|
|
355
|
+
}
|
|
356
|
+
function isSorted(line) {
|
|
357
|
+
for (let j = 1; j < line.length; j++) if (line[j][COLUMN$1] < line[j - 1][COLUMN$1]) return false;
|
|
358
|
+
return true;
|
|
359
|
+
}
|
|
360
|
+
function sortSegments(line, owned) {
|
|
361
|
+
if (!owned) line = line.slice();
|
|
362
|
+
return line.sort(sortComparator);
|
|
363
|
+
}
|
|
364
|
+
function sortComparator(a, b) {
|
|
365
|
+
return a[COLUMN$1] - b[COLUMN$1];
|
|
366
|
+
}
|
|
367
|
+
function memoizedState() {
|
|
368
|
+
return {
|
|
369
|
+
lastKey: -1,
|
|
370
|
+
lastNeedle: -1,
|
|
371
|
+
lastIndex: -1
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
function parse(map) {
|
|
375
|
+
return typeof map === "string" ? JSON.parse(map) : map;
|
|
376
|
+
}
|
|
377
|
+
var TraceMap = class {
|
|
378
|
+
constructor(map, mapUrl) {
|
|
379
|
+
const isString = typeof map === "string";
|
|
380
|
+
if (!isString && map._decodedMemo) return map;
|
|
381
|
+
const parsed = parse(map);
|
|
382
|
+
const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;
|
|
383
|
+
this.version = version;
|
|
384
|
+
this.file = file;
|
|
385
|
+
this.names = names || [];
|
|
386
|
+
this.sourceRoot = sourceRoot;
|
|
387
|
+
this.sources = sources;
|
|
388
|
+
this.sourcesContent = sourcesContent;
|
|
389
|
+
this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0;
|
|
390
|
+
const resolve = resolver(mapUrl, sourceRoot);
|
|
391
|
+
this.resolvedSources = sources.map(resolve);
|
|
392
|
+
const { mappings } = parsed;
|
|
393
|
+
if (typeof mappings === "string") {
|
|
394
|
+
this._encoded = mappings;
|
|
395
|
+
this._decoded = void 0;
|
|
396
|
+
} else if (Array.isArray(mappings)) {
|
|
397
|
+
this._encoded = void 0;
|
|
398
|
+
this._decoded = maybeSort(mappings, isString);
|
|
399
|
+
} else if (parsed.sections) throw new Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`);
|
|
400
|
+
else throw new Error(`invalid source map: ${JSON.stringify(parsed)}`);
|
|
401
|
+
this._decodedMemo = memoizedState();
|
|
402
|
+
this._bySources = void 0;
|
|
403
|
+
this._bySourceMemos = void 0;
|
|
404
|
+
}
|
|
405
|
+
};
|
|
406
|
+
function cast$1(map) {
|
|
407
|
+
return map;
|
|
408
|
+
}
|
|
409
|
+
function decodedMappings(map) {
|
|
410
|
+
var _a;
|
|
411
|
+
return (_a = cast$1(map))._decoded || (_a._decoded = decode(cast$1(map)._encoded));
|
|
412
|
+
}
|
|
413
|
+
function eachMapping(map, cb) {
|
|
414
|
+
const decoded = decodedMappings(map);
|
|
415
|
+
const { names, resolvedSources } = map;
|
|
416
|
+
for (let i = 0; i < decoded.length; i++) {
|
|
417
|
+
const line = decoded[i];
|
|
418
|
+
for (let j = 0; j < line.length; j++) {
|
|
419
|
+
const seg = line[j];
|
|
420
|
+
const generatedLine = i + 1;
|
|
421
|
+
const generatedColumn = seg[0];
|
|
422
|
+
let source = null;
|
|
423
|
+
let originalLine = null;
|
|
424
|
+
let originalColumn = null;
|
|
425
|
+
let name = null;
|
|
426
|
+
if (seg.length !== 1) {
|
|
427
|
+
source = resolvedSources[seg[1]];
|
|
428
|
+
originalLine = seg[2] + 1;
|
|
429
|
+
originalColumn = seg[3];
|
|
430
|
+
}
|
|
431
|
+
if (seg.length === 5) name = names[seg[4]];
|
|
432
|
+
cb({
|
|
433
|
+
generatedLine,
|
|
434
|
+
generatedColumn,
|
|
435
|
+
source,
|
|
436
|
+
originalLine,
|
|
437
|
+
originalColumn,
|
|
438
|
+
name
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
// ../../node_modules/.pnpm/@jridgewell+gen-mapping@0.3.13/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.mjs
|
|
444
|
+
var SetArray = class {
|
|
445
|
+
constructor() {
|
|
446
|
+
this._indexes = { __proto__: null };
|
|
447
|
+
this.array = [];
|
|
448
|
+
}
|
|
449
|
+
};
|
|
450
|
+
function cast(set) {
|
|
451
|
+
return set;
|
|
452
|
+
}
|
|
453
|
+
function get(setarr, key) {
|
|
454
|
+
return cast(setarr)._indexes[key];
|
|
455
|
+
}
|
|
456
|
+
function put(setarr, key) {
|
|
457
|
+
const index = get(setarr, key);
|
|
458
|
+
if (index !== void 0) return index;
|
|
459
|
+
const { array, _indexes: indexes } = cast(setarr);
|
|
460
|
+
return indexes[key] = array.push(key) - 1;
|
|
461
|
+
}
|
|
462
|
+
var COLUMN = 0;
|
|
463
|
+
var SOURCES_INDEX = 1;
|
|
464
|
+
var SOURCE_LINE = 2;
|
|
465
|
+
var SOURCE_COLUMN = 3;
|
|
466
|
+
var NAMES_INDEX = 4;
|
|
467
|
+
var NO_NAME = -1;
|
|
468
|
+
var GenMapping = class {
|
|
469
|
+
constructor({ file, sourceRoot } = {}) {
|
|
470
|
+
this._names = new SetArray();
|
|
471
|
+
this._sources = new SetArray();
|
|
472
|
+
this._sourcesContent = [];
|
|
473
|
+
this._mappings = [];
|
|
474
|
+
this.file = file;
|
|
475
|
+
this.sourceRoot = sourceRoot;
|
|
476
|
+
this._ignoreList = new SetArray();
|
|
477
|
+
}
|
|
478
|
+
};
|
|
479
|
+
function cast2(map) {
|
|
480
|
+
return map;
|
|
481
|
+
}
|
|
482
|
+
function addSegment(map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) {
|
|
483
|
+
return addSegmentInternal(false, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content);
|
|
484
|
+
}
|
|
485
|
+
function toDecodedMap(map) {
|
|
486
|
+
const { _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names, _ignoreList: ignoreList } = cast2(map);
|
|
487
|
+
removeEmptyFinalLines(mappings);
|
|
488
|
+
return {
|
|
489
|
+
version: 3,
|
|
490
|
+
file: map.file || void 0,
|
|
491
|
+
names: names.array,
|
|
492
|
+
sourceRoot: map.sourceRoot || void 0,
|
|
493
|
+
sources: sources.array,
|
|
494
|
+
sourcesContent,
|
|
495
|
+
mappings,
|
|
496
|
+
ignoreList: ignoreList.array
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
function toEncodedMap(map) {
|
|
500
|
+
const decoded = toDecodedMap(map);
|
|
501
|
+
return Object.assign({}, decoded, { mappings: encode(decoded.mappings) });
|
|
502
|
+
}
|
|
503
|
+
function addSegmentInternal(skipable, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) {
|
|
504
|
+
const { _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names } = cast2(map);
|
|
505
|
+
const line = getIndex(mappings, genLine);
|
|
506
|
+
const index = getColumnIndex(line, genColumn);
|
|
507
|
+
if (!source) {
|
|
508
|
+
if (skipable && skipSourceless(line, index)) return;
|
|
509
|
+
return insert(line, index, [genColumn]);
|
|
510
|
+
}
|
|
511
|
+
const sourcesIndex = put(sources, source);
|
|
512
|
+
const namesIndex = name ? put(names, name) : NO_NAME;
|
|
513
|
+
if (sourcesIndex === sourcesContent.length) sourcesContent[sourcesIndex] = content != null ? content : null;
|
|
514
|
+
if (skipable && skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex)) return;
|
|
515
|
+
return insert(line, index, name ? [
|
|
516
|
+
genColumn,
|
|
517
|
+
sourcesIndex,
|
|
518
|
+
sourceLine,
|
|
519
|
+
sourceColumn,
|
|
520
|
+
namesIndex
|
|
521
|
+
] : [
|
|
522
|
+
genColumn,
|
|
523
|
+
sourcesIndex,
|
|
524
|
+
sourceLine,
|
|
525
|
+
sourceColumn
|
|
526
|
+
]);
|
|
527
|
+
}
|
|
528
|
+
function getIndex(arr, index) {
|
|
529
|
+
for (let i = arr.length; i <= index; i++) arr[i] = [];
|
|
530
|
+
return arr[index];
|
|
531
|
+
}
|
|
532
|
+
function getColumnIndex(line, genColumn) {
|
|
533
|
+
let index = line.length;
|
|
534
|
+
for (let i = index - 1; i >= 0; index = i--) if (genColumn >= line[i][COLUMN]) break;
|
|
535
|
+
return index;
|
|
536
|
+
}
|
|
537
|
+
function insert(array, index, value) {
|
|
538
|
+
for (let i = array.length; i > index; i--) array[i] = array[i - 1];
|
|
539
|
+
array[index] = value;
|
|
540
|
+
}
|
|
541
|
+
function removeEmptyFinalLines(mappings) {
|
|
542
|
+
const { length } = mappings;
|
|
543
|
+
let len = length;
|
|
544
|
+
for (let i = len - 1; i >= 0; len = i, i--) if (mappings[i].length > 0) break;
|
|
545
|
+
if (len < length) mappings.length = len;
|
|
546
|
+
}
|
|
547
|
+
function skipSourceless(line, index) {
|
|
548
|
+
if (index === 0) return true;
|
|
549
|
+
return line[index - 1].length === 1;
|
|
550
|
+
}
|
|
551
|
+
function skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex) {
|
|
552
|
+
if (index === 0) return false;
|
|
553
|
+
const prev = line[index - 1];
|
|
554
|
+
if (prev.length === 1) return false;
|
|
555
|
+
return sourcesIndex === prev[SOURCES_INDEX] && sourceLine === prev[SOURCE_LINE] && sourceColumn === prev[SOURCE_COLUMN] && namesIndex === (prev.length === 5 ? prev[NAMES_INDEX] : NO_NAME);
|
|
556
|
+
}
|
|
557
|
+
export { eachMapping as a, TraceMap as i, addSegment as n, toEncodedMap as r, GenMapping as t };
|
|
558
|
+
|
|
559
|
+
//# sourceMappingURL=gen-mapping-D7jFzOEh.js.map
|