authorgravatar for git@paperclover.netclover caruso <git@paperclover.net> 2025-06-07 01:24:32-07:00
committergravatar for git@paperclover.netclover caruso <git@paperclover.net> 2025-10-14 02:40:43-07:00
log69f8d0a5f1709f154d141d6585af5e1af99baa81
treeb955a7c2ffdf9ad07a7963e660ce4e0e546ead33
parent07f12d340d1763aaa9726ee2381c98a80ad580ab
signature Commit is signed but in an unrecognized format.

delete corrupted files and start recovering sitegen.tsx


104 files changed, 3410 insertions(+), 11271 deletions(-)

framework/fs.ts+24-9
......@@ -1,10 +1,25 @@
1// default
2function isScope(node, parent) {
3 if ((0, _index.isBlockStatement)(node) && ((0, _index.isFunction)(parent) || (0, _index.isCatchClause)(parent))) {
4 return false;
5 }
6 if ((0, _index.isPattern)(node) && ((0, _index.isFunction)(parent) || (0, _index.isCatchClause)(parent))) {
7 return true;
8 }
9 return (0, _index.isScopable)(node);
1// File System APIs
2import { readFileSync, writeFileSync, readdirSync, statSync, existsSync, mkdirSync as nodeMkdirSync, rmSync } from 'node:fs';
3import { readFile, writeFile, readdir, stat, mkdir as nodeMkdir, rm } from 'node:fs/promises';
4
5// Re-export a mix of built-in Node.js sync+promise fs methods.
6export {
7 readFileSync, writeFileSync, readdirSync, statSync, existsSync, rmSync ,
8 readFile, writeFile, readdir, stat, mkdir, rm
109}
10
11export function mkdir(dir: string) {
12 return nodeMkdir(dir, { recursive: true });
13}
14
15export function mkdirSync(dir: string) {
16 return nodeMkdirSync(dir, { recursive: true });
17}
18
19export async function writeMkdir(file: string, contents: Buffer | string) {
20 await mkdir(path.dirname(file));
21 return writeFile(file, contents);
22}
23
24import * as path from 'node:path';
25
framework/mime.txt deleted-8
......@@ -1,8 +0,0 @@
1.css text/css
2.html text/html; charset=utf8
3.jpeg image/jpeg
4.jpg image/jpeg
5.js text/javascript
6.json application/json
7.png image/png
8.txt text/plain
framework/sitegen.tsx+219-8
......@@ -1,11 +1,222 @@
1// default
2class Hub {
3 getCode() {}
4 getScope() {}
5 addHelper() {
6 throw new Error("Helpers are not supported by the default hub.");
1// Sitegen! Clover's static site generator, built with love.
2
3function main() {
4 return withSpinner({
5 text: "Recovering State",
6 successText: ({ elapsed }) =>
7 "sitegen! update in " + elapsed.toFixed(1) + "s",
8 failureText: () => "sitegen FAIL",
9 }, sitegen);
10}
11
12async function sitegen(status) {
13 const startTime = performance.now();
14
15 let root = path.resolve(import_meta.dirname, "../src");
16 const join = (...sub) => path.join(root, ...sub);
17 const incr = new Incremental();
18 const sections: Section[] =
19 require(path.join(root, "sections.ts")).siteSections;
20 const views = [];
21 const staticFiles = [];
22 let pages = [];
23 let scripts = [];
24 const backendFiles = [];
25
26 status.text = "Scanning Project";
27 for (const section of sections) {
28 const { root: sectionRoot } = section;
29 const sectionPath = (...sub) => path.join(sectionRoot, ...sub);
30 const rootPrefix = root === sectionRoot
31 ? ""
32 : path.relative(root, sectionRoot) + "/";
33 const kinds = [
34 {
35 dir: sectionPath("pages"),
36 list: pages,
37 prefix: "/",
38 exclude: [".css", ".client.ts", ".client.tsx"],
39 },
40 { dir: sectionPath("static"), list: staticFiles, prefix: "/", ext: true },
41 { dir: sectionPath("scripts"), list: scripts, prefix: rootPrefix },
42 { dir: sectionPath("views"), list: views, prefix: rootPrefix },
43 ];
44 for (const { dir, list, prefix, exclude = [], ext = false } of kinds) {
45 const pages2 = fs.readDirRecOptional(dir);
46 page: for (const page of pages2) {
47 if (page.isDirectory()) continue;
48 for (const ext2 of exclude) {
49 if (page.name.endsWith(ext2)) continue page;
50 }
51 const file = path.relative(dir, page.parentPath + "/" + page.name);
52 const trim = ext
53 ? file
54 : file.slice(0, -path.extname(file).length).replaceAll(".", "/");
55 let id = prefix + trim.replaceAll("\\", "/");
56 if (prefix === "/" && id.endsWith("/index")) {
57 id = id.slice(0, -"/index".length) || "/";
58 }
59 list.push({ id, file: path.join(page.parentPath, page.name) });
60 }
61 }
62 let backendFile = [
63 sectionPath("backend.ts"),
64 sectionPath("backend.tsx"),
65 ].find((file) => fs.existsSync(file));
66 if (backendFile) backendFiles.push(backendFile);
67 }
68 scripts = scripts.filter(({ file }) => !file.match(/\.client\.[tj]sx?/));
69 const globalCssPath = join("global.css");
70 status.text = "Building";
71 const cssOnce = new OnceMap();
72 const cssQueue = new Queue({
73 name: "Bundle",
74 fn: ([, files, theme]) => css.bundleCssFiles(files, theme),
75 passive: true,
76 getItemText: ([id]) => id,
77 maxJobs: 2,
78 });
79 const ssrResults = [];
80 function loadSsrModule(page) {
81 require(page.file);
82 }
83 async function doSsrPage(page) {
84 const module2 = require(page.file);
85 const Page = module2.default;
86 if (!Page) {
87 throw new Error("Page is missing a 'default' export.");
88 }
89 const metadata = module2.meta;
90 if (!metadata) {
91 throw new Error("Page is missing 'meta' attribute with a title.");
92 }
93 const theme = {
94 bg: "#fff",
95 fg: "#050505",
96 primary: "#2e7dab",
97 ...module2.theme,
98 };
99 const renderedMetaPromise = Promise.resolve(
100 typeof metadata === "function" ? metadata({ ssr: true }) : metadata,
101 ).then((m) => meta.resolveAndRenderMetadata(m));
102 const cssImports = [globalCssPath, ...hot.getCssImports(page.file)];
103 const cssPromise = cssOnce.get(
104 cssImports.join(":") + JSON.stringify(theme),
105 () => cssQueue.add([page.id, cssImports, theme]),
106 );
107 const sitegenApi = sg.initRender();
108 const body = await (0, import_ssr.ssrAsync)(
109 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Page, {}),
110 {
111 sitegen: sitegenApi,
112 },
113 );
114 const inlineCss = await cssPromise;
115 const renderedMeta = await renderedMetaPromise;
116 if (!renderedMeta.includes("<title>")) {
117 throw new Error(
118 "Page is missing 'meta.title'. All pages need a title tag.",
119 );
120 }
121 ssrResults.push({
122 body,
123 head: renderedMeta,
124 inlineCss,
125 scriptFiles: Array.from(sitegenApi.scripts),
126 page,
127 });
7128 }
8 buildError(node, msg, Error = TypeError) {
9 return new Error(msg);
129 const spinnerFormat = status.format;
130 status.format = () => "";
131 const moduleLoadQueue = new import_queue.Queue({
132 name: "Load Render Module",
133 fn: loadSSRModule,
134 getItemText,
135 maxJobs: 1,
136 });
137 moduleLoadQueue.addMany(pages);
138 await moduleLoadQueue.done({ method: "stop" });
139 const pageQueue = new import_queue.Queue({
140 name: "Render",
141 fn: doSsrPage,
142 getItemText,
143 maxJobs: 2,
144 });
145 pageQueue.addMany(pages);
146 await pageQueue.done({ method: "stop" });
147 status.format = spinnerFormat;
148 const referencedScripts = Array.from(
149 new Set(ssrResults.flatMap((r) => r.scriptFiles)),
150 );
151 const extraPublicScripts = scripts.map((entry) => entry.file);
152 const uniqueCount = new Set([
153 ...referencedScripts,
154 ...extraPublicScripts,
155 ]).size;
156 status.text = `Bundle ${uniqueCount} Scripts`;
157 await bundle.bundleClientJavaScript(
158 referencedScripts,
159 extraPublicScripts,
160 incr,
161 );
162 async function doStaticFile(page) {
163 const body = await fs.readFile(page.file);
164 incr.putAsset({
165 srcId: "static:" + page.file,
166 key: page.id,
167 body,
168 });
10169 }
170 const staticQueue = new import_queue.Queue({
171 name: "Load Static",
172 fn: doStaticFile,
173 getItemText,
174 maxJobs: 16,
175 });
176 status.format = () => "";
177 staticQueue.addMany(staticFiles);
178 await staticQueue.done({ method: "stop" });
179 status.format = spinnerFormat;
180 status.text = `Concat ${ssrResults.length} Pages`;
181 await Promise.all(
182 ssrResults.map(async ({ page, body, head, inlineCss, scriptFiles }) => {
183 const doc = wrapDocument({
184 body,
185 head,
186 inlineCss,
187 scripts: scriptFiles.map(
188 (id) =>
189 UNWRAP(
190 incr.out.script.get(
191 path.basename(id).replace(/\.client\.[jt]sx?$/, ""),
192 ),
193 ),
194 ).map((x) => `{${x}}`).join(""),
195 });
196 incr.putAsset({
197 srcId: "page:" + page.file,
198 key: page.id,
199 body: doc,
200 headers: {
201 "Content-Type": "text/html",
202 },
203 });
204 }),
205 );
206 status.format = () => "";
207 status.text = ``;
208 await incr.wait();
209 status.format = spinnerFormat;
210 status.text = `Incremental Flush`;
211 incr.flush();
212 incr.serializeToDisk();
213 return { elapsed: (performance.now() - startTime) / 1e3 };
11214}
215
216import type { Section } from "./sitegen-lib.ts";
217import { OnceMap, Queue } from "./queue.ts";
218import { Incremental } from "./incremental.ts";
219import * as bundle from "./bundle.ts";
220import * as css from "./css.ts";
221import * as fs from './fs.ts';
222import { withSpinner, Spinner } from "@paperclover/console/Spinner";
package-lock.json+3100-76
......@@ -1,81 +1,3105 @@
1// DEFAULT_OPTIONS
2[object Object]
3
4// strip
5function strip(jsonString, options = DEFAULT_OPTIONS) {
6 if (typeof jsonString !== "string") {
7 throw new TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof jsonString}\``);
8 }
9 const { trailingCommas = false, whitespace = true } = options;
10 const _strip = whitespace ? stripWithWhitespace : stripWithoutWhitespace;
11 let isInsideString = false;
12 let isInsideComment = false;
13 let offset = 0;
14 let buffer = "";
15 let result = "";
16 let commaIndex = -1;
17 for (let i = 0; i < jsonString.length; i++) {
18 const currentCharacter = jsonString[i];
19 const nextCharacter = jsonString[i + 1];
20 if (!currentCharacter) {
21 continue;
22 }
23 if (!isInsideComment && currentCharacter === '"') {
24 const escaped = isEscaped(jsonString, i);
25 if (!escaped) {
26 isInsideString = !isInsideString;
1{
2 "name": "paperclover.net",
3 "lockfileVersion": 3,
4 "requires": true,
5 "packages": {
6 "": {
7 "dependencies": {
8 "@hono/node-server": "^1.14.3",
9 "@mdx-js/mdx": "^3.1.0",
10 "@paperclover/console": "git+https://git.paperclover.net/clo/console.git",
11 "esbuild": "^0.25.5",
12 "hls.js": "^1.6.5",
13 "hono": "^4.7.11",
14 "marko": "^6.0.20"
15 },
16 "devDependencies": {
17 "@types/node": "^22.15.29",
18 "typescript": "^5.8.3"
2719 }
28 }
29 if (isInsideString) {
30 continue;
31 }
32 if (!isInsideComment && currentCharacter + nextCharacter === "//") {
33 buffer += jsonString.slice(offset, i);
34 offset = i;
35 isInsideComment = singleComment;
36 i++;
37 } else if (isInsideComment === singleComment && currentCharacter + nextCharacter === "\r\n") {
38 i++;
39 isInsideComment = false;
40 buffer += _strip(jsonString, offset, i);
41 offset = i;
42 continue;
43 } else if (isInsideComment === singleComment && currentCharacter === "\n") {
44 isInsideComment = false;
45 buffer += _strip(jsonString, offset, i);
46 offset = i;
47 } else if (!isInsideComment && currentCharacter + nextCharacter === "/*") {
48 buffer += jsonString.slice(offset, i);
49 offset = i;
50 isInsideComment = multiComment;
51 i++;
52 continue;
53 } else if (isInsideComment === multiComment && currentCharacter + nextCharacter === "*/") {
54 i++;
55 isInsideComment = false;
56 buffer += _strip(jsonString, offset, i + 1);
57 offset = i + 1;
58 continue;
59 } else if (trailingCommas && !isInsideComment) {
60 if (commaIndex !== -1) {
61 if (currentCharacter === "}" || currentCharacter === "]") {
62 buffer += jsonString.slice(offset, i);
63 result += _strip(buffer, 0, 1) + buffer.slice(1);
64 buffer = "";
65 offset = i;
66 commaIndex = -1;
67 } else if (currentCharacter !== " " && currentCharacter !== " " && currentCharacter !== "\r" && currentCharacter !== "\n") {
68 buffer += jsonString.slice(offset, i);
69 offset = i;
70 commaIndex = -1;
71 }
72 } else if (currentCharacter === ",") {
73 result += buffer + jsonString.slice(offset, i);
74 buffer = "";
75 offset = i;
76 commaIndex = i;
20 },
21 "node_modules/@ampproject/remapping": {
22 "version": "2.3.0",
23 "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz",
24 "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==",
25 "license": "Apache-2.0",
26 "dependencies": {
27 "@jridgewell/gen-mapping": "^0.3.5",
28 "@jridgewell/trace-mapping": "^0.3.24"
29 },
30 "engines": {
31 "node": ">=6.0.0"
32 }
33 },
34 "node_modules/@babel/code-frame": {
35 "version": "7.27.1",
36 "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz",
37 "integrity": "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==",
38 "license": "MIT",
39 "dependencies": {
40 "@babel/helper-validator-identifier": "^7.27.1",
41 "js-tokens": "^4.0.0",
42 "picocolors": "^1.1.1"
43 },
44 "engines": {
45 "node": ">=6.9.0"
46 }
47 },
48 "node_modules/@babel/compat-data": {
49 "version": "7.27.5",
50 "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.27.5.tgz",
51 "integrity": "sha512-KiRAp/VoJaWkkte84TvUd9qjdbZAdiqyvMxrGl1N6vzFogKmaLgoM3L1kgtLicp2HP5fBJS8JrZKLVIZGVJAVg==",
52 "license": "MIT",
53 "engines": {
54 "node": ">=6.9.0"
55 }
56 },
57 "node_modules/@babel/core": {
58 "version": "7.27.4",
59 "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.27.4.tgz",
60 "integrity": "sha512-bXYxrXFubeYdvB0NhD/NBB3Qi6aZeV20GOWVI47t2dkecCEoneR4NPVcb7abpXDEvejgrUfFtG6vG/zxAKmg+g==",
61 "license": "MIT",
62 "dependencies": {
63 "@ampproject/remapping": "^2.2.0",
64 "@babel/code-frame": "^7.27.1",
65 "@babel/generator": "^7.27.3",
66 "@babel/helper-compilation-targets": "^7.27.2",
67 "@babel/helper-module-transforms": "^7.27.3",
68 "@babel/helpers": "^7.27.4",
69 "@babel/parser": "^7.27.4",
70 "@babel/template": "^7.27.2",
71 "@babel/traverse": "^7.27.4",
72 "@babel/types": "^7.27.3",
73 "convert-source-map": "^2.0.0",
74 "debug": "^4.1.0",
75 "gensync": "^1.0.0-beta.2",
76 "json5": "^2.2.3",
77 "semver": "^6.3.1"
78 },
79 "engines": {
80 "node": ">=6.9.0"
81 },
82 "funding": {
83 "type": "opencollective",
84 "url": "https://opencollective.com/babel"
85 }
86 },
87 "node_modules/@babel/generator": {
88 "version": "7.27.5",
89 "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.27.5.tgz",
90 "integrity": "sha512-ZGhA37l0e/g2s1Cnzdix0O3aLYm66eF8aufiVteOgnwxgnRP8GoyMj7VWsgWnQbVKXyge7hqrFh2K2TQM6t1Hw==",
91 "license": "MIT",
92 "dependencies": {
93 "@babel/parser": "^7.27.5",
94 "@babel/types": "^7.27.3",
95 "@jridgewell/gen-mapping": "^0.3.5",
96 "@jridgewell/trace-mapping": "^0.3.25",
97 "jsesc": "^3.0.2"
98 },
99 "engines": {
100 "node": ">=6.9.0"
101 }
102 },
103 "node_modules/@babel/helper-annotate-as-pure": {
104 "version": "7.27.3",
105 "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.27.3.tgz",
106 "integrity": "sha512-fXSwMQqitTGeHLBC08Eq5yXz2m37E4pJX1qAU1+2cNedz/ifv/bVXft90VeSav5nFO61EcNgwr0aJxbyPaWBPg==",
107 "license": "MIT",
108 "dependencies": {
109 "@babel/types": "^7.27.3"
110 },
111 "engines": {
112 "node": ">=6.9.0"
113 }
114 },
115 "node_modules/@babel/helper-compilation-targets": {
116 "version": "7.27.2",
117 "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.27.2.tgz",
118 "integrity": "sha512-2+1thGUUWWjLTYTHZWK1n8Yga0ijBz1XAhUXcKy81rd5g6yh7hGqMp45v7cadSbEHc9G3OTv45SyneRN3ps4DQ==",
119 "license": "MIT",
120 "dependencies": {
121 "@babel/compat-data": "^7.27.2",
122 "@babel/helper-validator-option": "^7.27.1",
123 "browserslist": "^4.24.0",
124 "lru-cache": "^5.1.1",
125 "semver": "^6.3.1"
126 },
127 "engines": {
128 "node": ">=6.9.0"
129 }
130 },
131 "node_modules/@babel/helper-create-class-features-plugin": {
132 "version": "7.27.1",
133 "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.27.1.tgz",
134 "integrity": "sha512-QwGAmuvM17btKU5VqXfb+Giw4JcN0hjuufz3DYnpeVDvZLAObloM77bhMXiqry3Iio+Ai4phVRDwl6WU10+r5A==",
135 "license": "MIT",
136 "dependencies": {
137 "@babel/helper-annotate-as-pure": "^7.27.1",
138 "@babel/helper-member-expression-to-functions": "^7.27.1",
139 "@babel/helper-optimise-call-expression": "^7.27.1",
140 "@babel/helper-replace-supers": "^7.27.1",
141 "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1",
142 "@babel/traverse": "^7.27.1",
143 "semver": "^6.3.1"
144 },
145 "engines": {
146 "node": ">=6.9.0"
147 },
148 "peerDependencies": {
149 "@babel/core": "^7.0.0"
150 }
151 },
152 "node_modules/@babel/helper-member-expression-to-functions": {
153 "version": "7.27.1",
154 "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.27.1.tgz",
155 "integrity": "sha512-E5chM8eWjTp/aNoVpcbfM7mLxu9XGLWYise2eBKGQomAk/Mb4XoxyqXTZbuTohbsl8EKqdlMhnDI2CCLfcs9wA==",
156 "license": "MIT",
157 "dependencies": {
158 "@babel/traverse": "^7.27.1",
159 "@babel/types": "^7.27.1"
160 },
161 "engines": {
162 "node": ">=6.9.0"
163 }
164 },
165 "node_modules/@babel/helper-module-imports": {
166 "version": "7.27.1",
167 "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.27.1.tgz",
168 "integrity": "sha512-0gSFWUPNXNopqtIPQvlD5WgXYI5GY2kP2cCvoT8kczjbfcfuIljTbcWrulD1CIPIX2gt1wghbDy08yE1p+/r3w==",
169 "license": "MIT",
170 "dependencies": {
171 "@babel/traverse": "^7.27.1",
172 "@babel/types": "^7.27.1"
173 },
174 "engines": {
175 "node": ">=6.9.0"
176 }
177 },
178 "node_modules/@babel/helper-module-transforms": {
179 "version": "7.27.3",
180 "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.27.3.tgz",
181 "integrity": "sha512-dSOvYwvyLsWBeIRyOeHXp5vPj5l1I011r52FM1+r1jCERv+aFXYk4whgQccYEGYxK2H3ZAIA8nuPkQ0HaUo3qg==",
182 "license": "MIT",
183 "dependencies": {
184 "@babel/helper-module-imports": "^7.27.1",
185 "@babel/helper-validator-identifier": "^7.27.1",
186 "@babel/traverse": "^7.27.3"
187 },
188 "engines": {
189 "node": ">=6.9.0"
190 },
191 "peerDependencies": {
192 "@babel/core": "^7.0.0"
193 }
194 },
195 "node_modules/@babel/helper-optimise-call-expression": {
196 "version": "7.27.1",
197 "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.27.1.tgz",
198 "integrity": "sha512-URMGH08NzYFhubNSGJrpUEphGKQwMQYBySzat5cAByY1/YgIRkULnIy3tAMeszlL/so2HbeilYloUmSpd7GdVw==",
199 "license": "MIT",
200 "dependencies": {
201 "@babel/types": "^7.27.1"
202 },
203 "engines": {
204 "node": ">=6.9.0"
205 }
206 },
207 "node_modules/@babel/helper-plugin-utils": {
208 "version": "7.27.1",
209 "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.27.1.tgz",
210 "integrity": "sha512-1gn1Up5YXka3YYAHGKpbideQ5Yjf1tDa9qYcgysz+cNCXukyLl6DjPXhD3VRwSb8c0J9tA4b2+rHEZtc6R0tlw==",
211 "license": "MIT",
212 "engines": {
213 "node": ">=6.9.0"
214 }
215 },
216 "node_modules/@babel/helper-replace-supers": {
217 "version": "7.27.1",
218 "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.27.1.tgz",
219 "integrity": "sha512-7EHz6qDZc8RYS5ElPoShMheWvEgERonFCs7IAonWLLUTXW59DP14bCZt89/GKyreYn8g3S83m21FelHKbeDCKA==",
220 "license": "MIT",
221 "dependencies": {
222 "@babel/helper-member-expression-to-functions": "^7.27.1",
223 "@babel/helper-optimise-call-expression": "^7.27.1",
224 "@babel/traverse": "^7.27.1"
225 },
226 "engines": {
227 "node": ">=6.9.0"
228 },
229 "peerDependencies": {
230 "@babel/core": "^7.0.0"
231 }
232 },
233 "node_modules/@babel/helper-skip-transparent-expression-wrappers": {
234 "version": "7.27.1",
235 "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.27.1.tgz",
236 "integrity": "sha512-Tub4ZKEXqbPjXgWLl2+3JpQAYBJ8+ikpQ2Ocj/q/r0LwE3UhENh7EUabyHjz2kCEsrRY83ew2DQdHluuiDQFzg==",
237 "license": "MIT",
238 "dependencies": {
239 "@babel/traverse": "^7.27.1",
240 "@babel/types": "^7.27.1"
241 },
242 "engines": {
243 "node": ">=6.9.0"
244 }
245 },
246 "node_modules/@babel/helper-string-parser": {
247 "version": "7.27.1",
248 "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz",
249 "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==",
250 "license": "MIT",
251 "engines": {
252 "node": ">=6.9.0"
253 }
254 },
255 "node_modules/@babel/helper-validator-identifier": {
256 "version": "7.27.1",
257 "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz",
258 "integrity": "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==",
259 "license": "MIT",
260 "engines": {
261 "node": ">=6.9.0"
262 }
263 },
264 "node_modules/@babel/helper-validator-option": {
265 "version": "7.27.1",
266 "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz",
267 "integrity": "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==",
268 "license": "MIT",
269 "engines": {
270 "node": ">=6.9.0"
271 }
272 },
273 "node_modules/@babel/helpers": {
274 "version": "7.27.6",
275 "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.27.6.tgz",
276 "integrity": "sha512-muE8Tt8M22638HU31A3CgfSUciwz1fhATfoVai05aPXGor//CdWDCbnlY1yvBPo07njuVOCNGCSp/GTt12lIug==",
277 "license": "MIT",
278 "dependencies": {
279 "@babel/template": "^7.27.2",
280 "@babel/types": "^7.27.6"
281 },
282 "engines": {
283 "node": ">=6.9.0"
284 }
285 },
286 "node_modules/@babel/parser": {
287 "version": "7.27.5",
288 "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.27.5.tgz",
289 "integrity": "sha512-OsQd175SxWkGlzbny8J3K8TnnDD0N3lrIUtB92xwyRpzaenGZhxDvxN/JgU00U3CDZNj9tPuDJ5H0WS4Nt3vKg==",
290 "license": "MIT",
291 "dependencies": {
292 "@babel/types": "^7.27.3"
293 },
294 "bin": {
295 "parser": "bin/babel-parser.js"
296 },
297 "engines": {
298 "node": ">=6.0.0"
299 }
300 },
301 "node_modules/@babel/plugin-syntax-typescript": {
302 "version": "7.27.1",
303 "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.27.1.tgz",
304 "integrity": "sha512-xfYCBMxveHrRMnAWl1ZlPXOZjzkN82THFvLhQhFXFt81Z5HnN+EtUkZhv/zcKpmT3fzmWZB0ywiBrbC3vogbwQ==",
305 "license": "MIT",
306 "dependencies": {
307 "@babel/helper-plugin-utils": "^7.27.1"
308 },
309 "engines": {
310 "node": ">=6.9.0"
311 },
312 "peerDependencies": {
313 "@babel/core": "^7.0.0-0"
314 }
315 },
316 "node_modules/@babel/plugin-transform-modules-commonjs": {
317 "version": "7.27.1",
318 "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.27.1.tgz",
319 "integrity": "sha512-OJguuwlTYlN0gBZFRPqwOGNWssZjfIUdS7HMYtN8c1KmwpwHFBwTeFZrg9XZa+DFTitWOW5iTAG7tyCUPsCCyw==",
320 "license": "MIT",
321 "dependencies": {
322 "@babel/helper-module-transforms": "^7.27.1",
323 "@babel/helper-plugin-utils": "^7.27.1"
324 },
325 "engines": {
326 "node": ">=6.9.0"
327 },
328 "peerDependencies": {
329 "@babel/core": "^7.0.0-0"
330 }
331 },
332 "node_modules/@babel/plugin-transform-typescript": {
333 "version": "7.27.1",
334 "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.27.1.tgz",
335 "integrity": "sha512-Q5sT5+O4QUebHdbwKedFBEwRLb02zJ7r4A5Gg2hUoLuU3FjdMcyqcywqUrLCaDsFCxzokf7u9kuy7qz51YUuAg==",
336 "license": "MIT",
337 "dependencies": {
338 "@babel/helper-annotate-as-pure": "^7.27.1",
339 "@babel/helper-create-class-features-plugin": "^7.27.1",
340 "@babel/helper-plugin-utils": "^7.27.1",
341 "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1",
342 "@babel/plugin-syntax-typescript": "^7.27.1"
343 },
344 "engines": {
345 "node": ">=6.9.0"
346 },
347 "peerDependencies": {
348 "@babel/core": "^7.0.0-0"
349 }
350 },
351 "node_modules/@babel/runtime": {
352 "version": "7.27.6",
353 "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.27.6.tgz",
354 "integrity": "sha512-vbavdySgbTTrmFE+EsiqUTzlOr5bzlnJtUv9PynGCAKvfQqjIXbvFdumPM/GxMDfyuGMJaJAU6TO4zc1Jf1i8Q==",
355 "license": "MIT",
356 "engines": {
357 "node": ">=6.9.0"
358 }
359 },
360 "node_modules/@babel/template": {
361 "version": "7.27.2",
362 "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.27.2.tgz",
363 "integrity": "sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw==",
364 "license": "MIT",
365 "dependencies": {
366 "@babel/code-frame": "^7.27.1",
367 "@babel/parser": "^7.27.2",
368 "@babel/types": "^7.27.1"
369 },
370 "engines": {
371 "node": ">=6.9.0"
372 }
373 },
374 "node_modules/@babel/traverse": {
375 "version": "7.27.4",
376 "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.27.4.tgz",
377 "integrity": "sha512-oNcu2QbHqts9BtOWJosOVJapWjBDSxGCpFvikNR5TGDYDQf3JwpIoMzIKrvfoti93cLfPJEG4tH9SPVeyCGgdA==",
378 "license": "MIT",
379 "dependencies": {
380 "@babel/code-frame": "^7.27.1",
381 "@babel/generator": "^7.27.3",
382 "@babel/parser": "^7.27.4",
383 "@babel/template": "^7.27.2",
384 "@babel/types": "^7.27.3",
385 "debug": "^4.3.1",
386 "globals": "^11.1.0"
387 },
388 "engines": {
389 "node": ">=6.9.0"
390 }
391 },
392 "node_modules/@babel/types": {
393 "version": "7.27.6",
394 "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.27.6.tgz",
395 "integrity": "sha512-ETyHEk2VHHvl9b9jZP5IHPavHYk57EhanlRRuae9XCpb/j5bDCbPPMOBfCWhnl/7EDJz0jEMCi/RhccCE8r1+Q==",
396 "license": "MIT",
397 "dependencies": {
398 "@babel/helper-string-parser": "^7.27.1",
399 "@babel/helper-validator-identifier": "^7.27.1"
400 },
401 "engines": {
402 "node": ">=6.9.0"
403 }
404 },
405 "node_modules/@esbuild/aix-ppc64": {
406 "version": "0.25.5",
407 "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.5.tgz",
408 "integrity": "sha512-9o3TMmpmftaCMepOdA5k/yDw8SfInyzWWTjYTFCX3kPSDJMROQTb8jg+h9Cnwnmm1vOzvxN7gIfB5V2ewpjtGA==",
409 "cpu": [
410 "ppc64"
411 ],
412 "license": "MIT",
413 "optional": true,
414 "os": [
415 "aix"
416 ],
417 "engines": {
418 "node": ">=18"
419 }
420 },
421 "node_modules/@esbuild/android-arm": {
422 "version": "0.25.5",
423 "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.5.tgz",
424 "integrity": "sha512-AdJKSPeEHgi7/ZhuIPtcQKr5RQdo6OO2IL87JkianiMYMPbCtot9fxPbrMiBADOWWm3T2si9stAiVsGbTQFkbA==",
425 "cpu": [
426 "arm"
427 ],
428 "license": "MIT",
429 "optional": true,
430 "os": [
431 "android"
432 ],
433 "engines": {
434 "node": ">=18"
435 }
436 },
437 "node_modules/@esbuild/android-arm64": {
438 "version": "0.25.5",
439 "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.5.tgz",
440 "integrity": "sha512-VGzGhj4lJO+TVGV1v8ntCZWJktV7SGCs3Pn1GRWI1SBFtRALoomm8k5E9Pmwg3HOAal2VDc2F9+PM/rEY6oIDg==",
441 "cpu": [
442 "arm64"
443 ],
444 "license": "MIT",
445 "optional": true,
446 "os": [
447 "android"
448 ],
449 "engines": {
450 "node": ">=18"
451 }
452 },
453 "node_modules/@esbuild/android-x64": {
454 "version": "0.25.5",
455 "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.5.tgz",
456 "integrity": "sha512-D2GyJT1kjvO//drbRT3Hib9XPwQeWd9vZoBJn+bu/lVsOZ13cqNdDeqIF/xQ5/VmWvMduP6AmXvylO/PIc2isw==",
457 "cpu": [
458 "x64"
459 ],
460 "license": "MIT",
461 "optional": true,
462 "os": [
463 "android"
464 ],
465 "engines": {
466 "node": ">=18"
467 }
468 },
469 "node_modules/@esbuild/darwin-arm64": {
470 "version": "0.25.5",
471 "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.5.tgz",
472 "integrity": "sha512-GtaBgammVvdF7aPIgH2jxMDdivezgFu6iKpmT+48+F8Hhg5J/sfnDieg0aeG/jfSvkYQU2/pceFPDKlqZzwnfQ==",
473 "cpu": [
474 "arm64"
475 ],
476 "license": "MIT",
477 "optional": true,
478 "os": [
479 "darwin"
480 ],
481 "engines": {
482 "node": ">=18"
483 }
484 },
485 "node_modules/@esbuild/darwin-x64": {
486 "version": "0.25.5",
487 "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.5.tgz",
488 "integrity": "sha512-1iT4FVL0dJ76/q1wd7XDsXrSW+oLoquptvh4CLR4kITDtqi2e/xwXwdCVH8hVHU43wgJdsq7Gxuzcs6Iq/7bxQ==",
489 "cpu": [
490 "x64"
491 ],
492 "license": "MIT",
493 "optional": true,
494 "os": [
495 "darwin"
496 ],
497 "engines": {
498 "node": ">=18"
499 }
500 },
501 "node_modules/@esbuild/freebsd-arm64": {
502 "version": "0.25.5",
503 "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.5.tgz",
504 "integrity": "sha512-nk4tGP3JThz4La38Uy/gzyXtpkPW8zSAmoUhK9xKKXdBCzKODMc2adkB2+8om9BDYugz+uGV7sLmpTYzvmz6Sw==",
505 "cpu": [
506 "arm64"
507 ],
508 "license": "MIT",
509 "optional": true,
510 "os": [
511 "freebsd"
512 ],
513 "engines": {
514 "node": ">=18"
515 }
516 },
517 "node_modules/@esbuild/freebsd-x64": {
518 "version": "0.25.5",
519 "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.5.tgz",
520 "integrity": "sha512-PrikaNjiXdR2laW6OIjlbeuCPrPaAl0IwPIaRv+SMV8CiM8i2LqVUHFC1+8eORgWyY7yhQY+2U2fA55mBzReaw==",
521 "cpu": [
522 "x64"
523 ],
524 "license": "MIT",
525 "optional": true,
526 "os": [
527 "freebsd"
528 ],
529 "engines": {
530 "node": ">=18"
531 }
532 },
533 "node_modules/@esbuild/linux-arm": {
534 "version": "0.25.5",
535 "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.5.tgz",
536 "integrity": "sha512-cPzojwW2okgh7ZlRpcBEtsX7WBuqbLrNXqLU89GxWbNt6uIg78ET82qifUy3W6OVww6ZWobWub5oqZOVtwolfw==",
537 "cpu": [
538 "arm"
539 ],
540 "license": "MIT",
541 "optional": true,
542 "os": [
543 "linux"
544 ],
545 "engines": {
546 "node": ">=18"
547 }
548 },
549 "node_modules/@esbuild/linux-arm64": {
550 "version": "0.25.5",
551 "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.5.tgz",
552 "integrity": "sha512-Z9kfb1v6ZlGbWj8EJk9T6czVEjjq2ntSYLY2cw6pAZl4oKtfgQuS4HOq41M/BcoLPzrUbNd+R4BXFyH//nHxVg==",
553 "cpu": [
554 "arm64"
555 ],
556 "license": "MIT",
557 "optional": true,
558 "os": [
559 "linux"
560 ],
561 "engines": {
562 "node": ">=18"
563 }
564 },
565 "node_modules/@esbuild/linux-ia32": {
566 "version": "0.25.5",
567 "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.5.tgz",
568 "integrity": "sha512-sQ7l00M8bSv36GLV95BVAdhJ2QsIbCuCjh/uYrWiMQSUuV+LpXwIqhgJDcvMTj+VsQmqAHL2yYaasENvJ7CDKA==",
569 "cpu": [
570 "ia32"
571 ],
572 "license": "MIT",
573 "optional": true,
574 "os": [
575 "linux"
576 ],
577 "engines": {
578 "node": ">=18"
579 }
580 },
581 "node_modules/@esbuild/linux-loong64": {
582 "version": "0.25.5",
583 "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.5.tgz",
584 "integrity": "sha512-0ur7ae16hDUC4OL5iEnDb0tZHDxYmuQyhKhsPBV8f99f6Z9KQM02g33f93rNH5A30agMS46u2HP6qTdEt6Q1kg==",
585 "cpu": [
586 "loong64"
587 ],
588 "license": "MIT",
589 "optional": true,
590 "os": [
591 "linux"
592 ],
593 "engines": {
594 "node": ">=18"
595 }
596 },
597 "node_modules/@esbuild/linux-mips64el": {
598 "version": "0.25.5",
599 "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.5.tgz",
600 "integrity": "sha512-kB/66P1OsHO5zLz0i6X0RxlQ+3cu0mkxS3TKFvkb5lin6uwZ/ttOkP3Z8lfR9mJOBk14ZwZ9182SIIWFGNmqmg==",
601 "cpu": [
602 "mips64el"
603 ],
604 "license": "MIT",
605 "optional": true,
606 "os": [
607 "linux"
608 ],
609 "engines": {
610 "node": ">=18"
611 }
612 },
613 "node_modules/@esbuild/linux-ppc64": {
614 "version": "0.25.5",
615 "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.5.tgz",
616 "integrity": "sha512-UZCmJ7r9X2fe2D6jBmkLBMQetXPXIsZjQJCjgwpVDz+YMcS6oFR27alkgGv3Oqkv07bxdvw7fyB71/olceJhkQ==",
617 "cpu": [
618 "ppc64"
619 ],
620 "license": "MIT",
621 "optional": true,
622 "os": [
623 "linux"
624 ],
625 "engines": {
626 "node": ">=18"
627 }
628 },
629 "node_modules/@esbuild/linux-riscv64": {
630 "version": "0.25.5",
631 "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.5.tgz",
632 "integrity": "sha512-kTxwu4mLyeOlsVIFPfQo+fQJAV9mh24xL+y+Bm6ej067sYANjyEw1dNHmvoqxJUCMnkBdKpvOn0Ahql6+4VyeA==",
633 "cpu": [
634 "riscv64"
635 ],
636 "license": "MIT",
637 "optional": true,
638 "os": [
639 "linux"
640 ],
641 "engines": {
642 "node": ">=18"
643 }
644 },
645 "node_modules/@esbuild/linux-s390x": {
646 "version": "0.25.5",
647 "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.5.tgz",
648 "integrity": "sha512-K2dSKTKfmdh78uJ3NcWFiqyRrimfdinS5ErLSn3vluHNeHVnBAFWC8a4X5N+7FgVE1EjXS1QDZbpqZBjfrqMTQ==",
649 "cpu": [
650 "s390x"
651 ],
652 "license": "MIT",
653 "optional": true,
654 "os": [
655 "linux"
656 ],
657 "engines": {
658 "node": ">=18"
659 }
660 },
661 "node_modules/@esbuild/linux-x64": {
662 "version": "0.25.5",
663 "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.5.tgz",
664 "integrity": "sha512-uhj8N2obKTE6pSZ+aMUbqq+1nXxNjZIIjCjGLfsWvVpy7gKCOL6rsY1MhRh9zLtUtAI7vpgLMK6DxjO8Qm9lJw==",
665 "cpu": [
666 "x64"
667 ],
668 "license": "MIT",
669 "optional": true,
670 "os": [
671 "linux"
672 ],
673 "engines": {
674 "node": ">=18"
675 }
676 },
677 "node_modules/@esbuild/netbsd-arm64": {
678 "version": "0.25.5",
679 "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.5.tgz",
680 "integrity": "sha512-pwHtMP9viAy1oHPvgxtOv+OkduK5ugofNTVDilIzBLpoWAM16r7b/mxBvfpuQDpRQFMfuVr5aLcn4yveGvBZvw==",
681 "cpu": [
682 "arm64"
683 ],
684 "license": "MIT",
685 "optional": true,
686 "os": [
687 "netbsd"
688 ],
689 "engines": {
690 "node": ">=18"
691 }
692 },
693 "node_modules/@esbuild/netbsd-x64": {
694 "version": "0.25.5",
695 "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.5.tgz",
696 "integrity": "sha512-WOb5fKrvVTRMfWFNCroYWWklbnXH0Q5rZppjq0vQIdlsQKuw6mdSihwSo4RV/YdQ5UCKKvBy7/0ZZYLBZKIbwQ==",
697 "cpu": [
698 "x64"
699 ],
700 "license": "MIT",
701 "optional": true,
702 "os": [
703 "netbsd"
704 ],
705 "engines": {
706 "node": ">=18"
707 }
708 },
709 "node_modules/@esbuild/openbsd-arm64": {
710 "version": "0.25.5",
711 "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.5.tgz",
712 "integrity": "sha512-7A208+uQKgTxHd0G0uqZO8UjK2R0DDb4fDmERtARjSHWxqMTye4Erz4zZafx7Di9Cv+lNHYuncAkiGFySoD+Mw==",
713 "cpu": [
714 "arm64"
715 ],
716 "license": "MIT",
717 "optional": true,
718 "os": [
719 "openbsd"
720 ],
721 "engines": {
722 "node": ">=18"
723 }
724 },
725 "node_modules/@esbuild/openbsd-x64": {
726 "version": "0.25.5",
727 "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.5.tgz",
728 "integrity": "sha512-G4hE405ErTWraiZ8UiSoesH8DaCsMm0Cay4fsFWOOUcz8b8rC6uCvnagr+gnioEjWn0wC+o1/TAHt+It+MpIMg==",
729 "cpu": [
730 "x64"
731 ],
732 "license": "MIT",
733 "optional": true,
734 "os": [
735 "openbsd"
736 ],
737 "engines": {
738 "node": ">=18"
739 }
740 },
741 "node_modules/@esbuild/sunos-x64": {
742 "version": "0.25.5",
743 "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.5.tgz",
744 "integrity": "sha512-l+azKShMy7FxzY0Rj4RCt5VD/q8mG/e+mDivgspo+yL8zW7qEwctQ6YqKX34DTEleFAvCIUviCFX1SDZRSyMQA==",
745 "cpu": [
746 "x64"
747 ],
748 "license": "MIT",
749 "optional": true,
750 "os": [
751 "sunos"
752 ],
753 "engines": {
754 "node": ">=18"
755 }
756 },
757 "node_modules/@esbuild/win32-arm64": {
758 "version": "0.25.5",
759 "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.5.tgz",
760 "integrity": "sha512-O2S7SNZzdcFG7eFKgvwUEZ2VG9D/sn/eIiz8XRZ1Q/DO5a3s76Xv0mdBzVM5j5R639lXQmPmSo0iRpHqUUrsxw==",
761 "cpu": [
762 "arm64"
763 ],
764 "license": "MIT",
765 "optional": true,
766 "os": [
767 "win32"
768 ],
769 "engines": {
770 "node": ">=18"
771 }
772 },
773 "node_modules/@esbuild/win32-ia32": {
774 "version": "0.25.5",
775 "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.5.tgz",
776 "integrity": "sha512-onOJ02pqs9h1iMJ1PQphR+VZv8qBMQ77Klcsqv9CNW2w6yLqoURLcgERAIurY6QE63bbLuqgP9ATqajFLK5AMQ==",
777 "cpu": [
778 "ia32"
779 ],
780 "license": "MIT",
781 "optional": true,
782 "os": [
783 "win32"
784 ],
785 "engines": {
786 "node": ">=18"
787 }
788 },
789 "node_modules/@esbuild/win32-x64": {
790 "version": "0.25.5",
791 "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.5.tgz",
792 "integrity": "sha512-TXv6YnJ8ZMVdX+SXWVBo/0p8LTcrUYngpWjvm91TMjjBQii7Oz11Lw5lbDV5Y0TzuhSJHwiH4hEtC1I42mMS0g==",
793 "cpu": [
794 "x64"
795 ],
796 "license": "MIT",
797 "optional": true,
798 "os": [
799 "win32"
800 ],
801 "engines": {
802 "node": ">=18"
803 }
804 },
805 "node_modules/@hono/node-server": {
806 "version": "1.14.4",
807 "resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-1.14.4.tgz",
808 "integrity": "sha512-DnxpshhYewr2q9ZN8ez/M5mmc3sucr8CT1sIgIy1bkeUXut9XWDkqHoFHRhWIQgkYnKpVRxunyhK7WzpJeJ6qQ==",
809 "license": "MIT",
810 "engines": {
811 "node": ">=18.14.1"
812 },
813 "peerDependencies": {
814 "hono": "^4"
815 }
816 },
817 "node_modules/@jridgewell/gen-mapping": {
818 "version": "0.3.8",
819 "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz",
820 "integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==",
821 "license": "MIT",
822 "dependencies": {
823 "@jridgewell/set-array": "^1.2.1",
824 "@jridgewell/sourcemap-codec": "^1.4.10",
825 "@jridgewell/trace-mapping": "^0.3.24"
826 },
827 "engines": {
828 "node": ">=6.0.0"
829 }
830 },
831 "node_modules/@jridgewell/resolve-uri": {
832 "version": "3.1.2",
833 "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
834 "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
835 "license": "MIT",
836 "engines": {
837 "node": ">=6.0.0"
838 }
839 },
840 "node_modules/@jridgewell/set-array": {
841 "version": "1.2.1",
842 "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz",
843 "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==",
844 "license": "MIT",
845 "engines": {
846 "node": ">=6.0.0"
847 }
848 },
849 "node_modules/@jridgewell/sourcemap-codec": {
850 "version": "1.5.0",
851 "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz",
852 "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==",
853 "license": "MIT"
854 },
855 "node_modules/@jridgewell/trace-mapping": {
856 "version": "0.3.25",
857 "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz",
858 "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==",
859 "license": "MIT",
860 "dependencies": {
861 "@jridgewell/resolve-uri": "^3.1.0",
862 "@jridgewell/sourcemap-codec": "^1.4.14"
863 }
864 },
865 "node_modules/@luxass/strip-json-comments": {
866 "version": "1.4.0",
867 "resolved": "https://registry.npmjs.org/@luxass/strip-json-comments/-/strip-json-comments-1.4.0.tgz",
868 "integrity": "sha512-Zl343to4u/t8jz1q7R/1UY6hLX+344cwPLEXsIYthVwdU5zyjuVBGcpf2E24+QZkwFfRfmnHTcscreQzWn3hiA==",
869 "license": "MIT",
870 "engines": {
871 "node": ">=18"
872 }
873 },
874 "node_modules/@marko/compiler": {
875 "version": "5.39.21",
876 "resolved": "https://registry.npmjs.org/@marko/compiler/-/compiler-5.39.21.tgz",
877 "integrity": "sha512-wDLJYjINuH4ESSlVGXmUnEQV+VcHXEEbXK7BWRjp3Bg+nLyLapa+hBBrYLRt9/ctyWXgzYscInKQpGAxm/Sgdg==",
878 "license": "MIT",
879 "dependencies": {
880 "@babel/code-frame": "^7.26.2",
881 "@babel/core": "^7.26.10",
882 "@babel/generator": "^7.27.0",
883 "@babel/parser": "^7.27.0",
884 "@babel/plugin-syntax-typescript": "^7.25.9",
885 "@babel/plugin-transform-modules-commonjs": "^7.26.3",
886 "@babel/plugin-transform-typescript": "^7.27.0",
887 "@babel/runtime": "^7.27.0",
888 "@babel/traverse": "^7.27.0",
889 "@babel/types": "^7.27.0",
890 "@luxass/strip-json-comments": "^1.4.0",
891 "complain": "^1.6.1",
892 "he": "^1.2.0",
893 "htmljs-parser": "^5.5.4",
894 "jsesc": "^3.1.0",
895 "kleur": "^4.1.5",
896 "lasso-package-root": "^1.0.1",
897 "raptor-regexp": "^1.0.1",
898 "raptor-util": "^3.2.0",
899 "relative-import-path": "^1.0.0",
900 "resolve-from": "^5.0.0",
901 "self-closing-tags": "^1.0.1",
902 "source-map-support": "^0.5.21"
903 },
904 "engines": {
905 "node": "18 || 20 || >=22"
906 }
907 },
908 "node_modules/@mdx-js/mdx": {
909 "version": "3.1.0",
910 "resolved": "https://registry.npmjs.org/@mdx-js/mdx/-/mdx-3.1.0.tgz",
911 "integrity": "sha512-/QxEhPAvGwbQmy1Px8F899L5Uc2KZ6JtXwlCgJmjSTBedwOZkByYcBG4GceIGPXRDsmfxhHazuS+hlOShRLeDw==",
912 "license": "MIT",
913 "dependencies": {
914 "@types/estree": "^1.0.0",
915 "@types/estree-jsx": "^1.0.0",
916 "@types/hast": "^3.0.0",
917 "@types/mdx": "^2.0.0",
918 "collapse-white-space": "^2.0.0",
919 "devlop": "^1.0.0",
920 "estree-util-is-identifier-name": "^3.0.0",
921 "estree-util-scope": "^1.0.0",
922 "estree-walker": "^3.0.0",
923 "hast-util-to-jsx-runtime": "^2.0.0",
924 "markdown-extensions": "^2.0.0",
925 "recma-build-jsx": "^1.0.0",
926 "recma-jsx": "^1.0.0",
927 "recma-stringify": "^1.0.0",
928 "rehype-recma": "^1.0.0",
929 "remark-mdx": "^3.0.0",
930 "remark-parse": "^11.0.0",
931 "remark-rehype": "^11.0.0",
932 "source-map": "^0.7.0",
933 "unified": "^11.0.0",
934 "unist-util-position-from-estree": "^2.0.0",
935 "unist-util-stringify-position": "^4.0.0",
936 "unist-util-visit": "^5.0.0",
937 "vfile": "^6.0.0"
938 },
939 "funding": {
940 "type": "opencollective",
941 "url": "https://opencollective.com/unified"
942 }
943 },
944 "node_modules/@paperclover/console": {
945 "resolved": "git+https://git.paperclover.net/clo/console.git#29ae0fe6bb948723655b2d875faef75433b78ac0",
946 "dependencies": {
947 "ansi-escapes": "^7.0.0",
948 "chalk": "^5.4.1",
949 "strip-ansi": "^7.1.0"
950 }
951 },
952 "node_modules/@types/debug": {
953 "version": "4.1.12",
954 "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz",
955 "integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==",
956 "license": "MIT",
957 "dependencies": {
958 "@types/ms": "*"
959 }
960 },
961 "node_modules/@types/estree": {
962 "version": "1.0.8",
963 "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz",
964 "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==",
965 "license": "MIT"
966 },
967 "node_modules/@types/estree-jsx": {
968 "version": "1.0.5",
969 "resolved": "https://registry.npmjs.org/@types/estree-jsx/-/estree-jsx-1.0.5.tgz",
970 "integrity": "sha512-52CcUVNFyfb1A2ALocQw/Dd1BQFNmSdkuC3BkZ6iqhdMfQz7JWOFRuJFloOzjk+6WijU56m9oKXFAXc7o3Towg==",
971 "license": "MIT",
972 "dependencies": {
973 "@types/estree": "*"
974 }
975 },
976 "node_modules/@types/hast": {
977 "version": "3.0.4",
978 "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz",
979 "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==",
980 "license": "MIT",
981 "dependencies": {
982 "@types/unist": "*"
983 }
984 },
985 "node_modules/@types/mdast": {
986 "version": "4.0.4",
987 "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz",
988 "integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==",
989 "license": "MIT",
990 "dependencies": {
991 "@types/unist": "*"
992 }
993 },
994 "node_modules/@types/mdx": {
995 "version": "2.0.13",
996 "resolved": "https://registry.npmjs.org/@types/mdx/-/mdx-2.0.13.tgz",
997 "integrity": "sha512-+OWZQfAYyio6YkJb3HLxDrvnx6SWWDbC0zVPfBRzUk0/nqoDyf6dNxQi3eArPe8rJ473nobTMQ/8Zk+LxJ+Yuw==",
998 "license": "MIT"
999 },
1000 "node_modules/@types/ms": {
1001 "version": "2.1.0",
1002 "resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz",
1003 "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==",
1004 "license": "MIT"
1005 },
1006 "node_modules/@types/node": {
1007 "version": "22.15.30",
1008 "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.30.tgz",
1009 "integrity": "sha512-6Q7lr06bEHdlfplU6YRbgG1SFBdlsfNC4/lX+SkhiTs0cpJkOElmWls8PxDFv4yY/xKb8Y6SO0OmSX4wgqTZbA==",
1010 "dev": true,
1011 "license": "MIT",
1012 "dependencies": {
1013 "undici-types": "~6.21.0"
1014 }
1015 },
1016 "node_modules/@types/unist": {
1017 "version": "3.0.3",
1018 "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz",
1019 "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==",
1020 "license": "MIT"
1021 },
1022 "node_modules/@ungap/structured-clone": {
1023 "version": "1.3.0",
1024 "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz",
1025 "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==",
1026 "license": "ISC"
1027 },
1028 "node_modules/acorn": {
1029 "version": "8.14.1",
1030 "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz",
1031 "integrity": "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==",
1032 "license": "MIT",
1033 "bin": {
1034 "acorn": "bin/acorn"
1035 },
1036 "engines": {
1037 "node": ">=0.4.0"
1038 }
1039 },
1040 "node_modules/acorn-jsx": {
1041 "version": "5.3.2",
1042 "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz",
1043 "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==",
1044 "license": "MIT",
1045 "peerDependencies": {
1046 "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
1047 }
1048 },
1049 "node_modules/ansi-escapes": {
1050 "version": "7.0.0",
1051 "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-7.0.0.tgz",
1052 "integrity": "sha512-GdYO7a61mR0fOlAsvC9/rIHf7L96sBc6dEWzeOu+KAea5bZyQRPIpojrVoI4AXGJS/ycu/fBTdLrUkA4ODrvjw==",
1053 "license": "MIT",
1054 "dependencies": {
1055 "environment": "^1.0.0"
1056 },
1057 "engines": {
1058 "node": ">=18"
1059 },
1060 "funding": {
1061 "url": "https://github.com/sponsors/sindresorhus"
1062 }
1063 },
1064 "node_modules/ansi-regex": {
1065 "version": "6.1.0",
1066 "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz",
1067 "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==",
1068 "license": "MIT",
1069 "engines": {
1070 "node": ">=12"
1071 },
1072 "funding": {
1073 "url": "https://github.com/chalk/ansi-regex?sponsor=1"
1074 }
1075 },
1076 "node_modules/astring": {
1077 "version": "1.9.0",
1078 "resolved": "https://registry.npmjs.org/astring/-/astring-1.9.0.tgz",
1079 "integrity": "sha512-LElXdjswlqjWrPpJFg1Fx4wpkOCxj1TDHlSV4PlaRxHGWko024xICaa97ZkMfs6DRKlCguiAI+rbXv5GWwXIkg==",
1080 "license": "MIT",
1081 "bin": {
1082 "astring": "bin/astring"
1083 }
1084 },
1085 "node_modules/bail": {
1086 "version": "2.0.2",
1087 "resolved": "https://registry.npmjs.org/bail/-/bail-2.0.2.tgz",
1088 "integrity": "sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==",
1089 "license": "MIT",
1090 "funding": {
1091 "type": "github",
1092 "url": "https://github.com/sponsors/wooorm"
1093 }
1094 },
1095 "node_modules/browserslist": {
1096 "version": "4.25.0",
1097 "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.25.0.tgz",
1098 "integrity": "sha512-PJ8gYKeS5e/whHBh8xrwYK+dAvEj7JXtz6uTucnMRB8OiGTsKccFekoRrjajPBHV8oOY+2tI4uxeceSimKwMFA==",
1099 "funding": [
1100 {
1101 "type": "opencollective",
1102 "url": "https://opencollective.com/browserslist"
1103 },
1104 {
1105 "type": "tidelift",
1106 "url": "https://tidelift.com/funding/github/npm/browserslist"
1107 },
1108 {
1109 "type": "github",
1110 "url": "https://github.com/sponsors/ai"
1111 }
1112 ],
1113 "license": "MIT",
1114 "dependencies": {
1115 "caniuse-lite": "^1.0.30001718",
1116 "electron-to-chromium": "^1.5.160",
1117 "node-releases": "^2.0.19",
1118 "update-browserslist-db": "^1.1.3"
1119 },
1120 "bin": {
1121 "browserslist": "cli.js"
1122 },
1123 "engines": {
1124 "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
1125 }
1126 },
1127 "node_modules/buffer-from": {
1128 "version": "1.1.2",
1129 "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
1130 "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==",
1131 "license": "MIT"
1132 },
1133 "node_modules/caniuse-lite": {
1134 "version": "1.0.30001721",
1135 "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001721.tgz",
1136 "integrity": "sha512-cOuvmUVtKrtEaoKiO0rSc29jcjwMwX5tOHDy4MgVFEWiUXj4uBMJkwI8MDySkgXidpMiHUcviogAvFi4pA2hDQ==",
1137 "funding": [
1138 {
1139 "type": "opencollective",
1140 "url": "https://opencollective.com/browserslist"
1141 },
1142 {
1143 "type": "tidelift",
1144 "url": "https://tidelift.com/funding/github/npm/caniuse-lite"
1145 },
1146 {
1147 "type": "github",
1148 "url": "https://github.com/sponsors/ai"
1149 }
1150 ],
1151 "license": "CC-BY-4.0"
1152 },
1153 "node_modules/ccount": {
1154 "version": "2.0.1",
1155 "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz",
1156 "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==",
1157 "license": "MIT",
1158 "funding": {
1159 "type": "github",
1160 "url": "https://github.com/sponsors/wooorm"
1161 }
1162 },
1163 "node_modules/chalk": {
1164 "version": "5.4.1",
1165 "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.4.1.tgz",
1166 "integrity": "sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w==",
1167 "license": "MIT",
1168 "engines": {
1169 "node": "^12.17.0 || ^14.13 || >=16.0.0"
1170 },
1171 "funding": {
1172 "url": "https://github.com/chalk/chalk?sponsor=1"
1173 }
1174 },
1175 "node_modules/character-entities": {
1176 "version": "2.0.2",
1177 "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz",
1178 "integrity": "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==",
1179 "license": "MIT",
1180 "funding": {
1181 "type": "github",
1182 "url": "https://github.com/sponsors/wooorm"
1183 }
1184 },
1185 "node_modules/character-entities-html4": {
1186 "version": "2.1.0",
1187 "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-2.1.0.tgz",
1188 "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==",
1189 "license": "MIT",
1190 "funding": {
1191 "type": "github",
1192 "url": "https://github.com/sponsors/wooorm"
1193 }
1194 },
1195 "node_modules/character-entities-legacy": {
1196 "version": "3.0.0",
1197 "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz",
1198 "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==",
1199 "license": "MIT",
1200 "funding": {
1201 "type": "github",
1202 "url": "https://github.com/sponsors/wooorm"
1203 }
1204 },
1205 "node_modules/character-reference-invalid": {
1206 "version": "2.0.1",
1207 "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-2.0.1.tgz",
1208 "integrity": "sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw==",
1209 "license": "MIT",
1210 "funding": {
1211 "type": "github",
1212 "url": "https://github.com/sponsors/wooorm"
1213 }
1214 },
1215 "node_modules/collapse-white-space": {
1216 "version": "2.1.0",
1217 "resolved": "https://registry.npmjs.org/collapse-white-space/-/collapse-white-space-2.1.0.tgz",
1218 "integrity": "sha512-loKTxY1zCOuG4j9f6EPnuyyYkf58RnhhWTvRoZEokgB+WbdXehfjFviyOVYkqzEWz1Q5kRiZdBYS5SwxbQYwzw==",
1219 "license": "MIT",
1220 "funding": {
1221 "type": "github",
1222 "url": "https://github.com/sponsors/wooorm"
1223 }
1224 },
1225 "node_modules/comma-separated-tokens": {
1226 "version": "2.0.3",
1227 "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz",
1228 "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==",
1229 "license": "MIT",
1230 "funding": {
1231 "type": "github",
1232 "url": "https://github.com/sponsors/wooorm"
1233 }
1234 },
1235 "node_modules/complain": {
1236 "version": "1.6.1",
1237 "resolved": "https://registry.npmjs.org/complain/-/complain-1.6.1.tgz",
1238 "integrity": "sha512-WsiVAbAPcPSwyC5k8g/PLceaW0MXJUw61KqBd9uiyDOSuDIC6Ho/EbyhdFjeV6wq44R2g/b8IFpvV/1ZyXiqUQ==",
1239 "license": "MIT",
1240 "dependencies": {
1241 "error-stack-parser": "^2.0.1"
1242 }
1243 },
1244 "node_modules/convert-source-map": {
1245 "version": "2.0.0",
1246 "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz",
1247 "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==",
1248 "license": "MIT"
1249 },
1250 "node_modules/csstype": {
1251 "version": "3.1.3",
1252 "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz",
1253 "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==",
1254 "license": "MIT"
1255 },
1256 "node_modules/debug": {
1257 "version": "4.4.1",
1258 "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz",
1259 "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==",
1260 "license": "MIT",
1261 "dependencies": {
1262 "ms": "^2.1.3"
1263 },
1264 "engines": {
1265 "node": ">=6.0"
1266 },
1267 "peerDependenciesMeta": {
1268 "supports-color": {
1269 "optional": true
1270 }
1271 }
1272 },
1273 "node_modules/decode-named-character-reference": {
1274 "version": "1.1.0",
1275 "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.1.0.tgz",
1276 "integrity": "sha512-Wy+JTSbFThEOXQIR2L6mxJvEs+veIzpmqD7ynWxMXGpnk3smkHQOp6forLdHsKpAMW9iJpaBBIxz285t1n1C3w==",
1277 "license": "MIT",
1278 "dependencies": {
1279 "character-entities": "^2.0.0"
1280 },
1281 "funding": {
1282 "type": "github",
1283 "url": "https://github.com/sponsors/wooorm"
1284 }
1285 },
1286 "node_modules/dequal": {
1287 "version": "2.0.3",
1288 "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz",
1289 "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==",
1290 "license": "MIT",
1291 "engines": {
1292 "node": ">=6"
1293 }
1294 },
1295 "node_modules/devlop": {
1296 "version": "1.1.0",
1297 "resolved": "https://registry.npmjs.org/devlop/-/devlop-1.1.0.tgz",
1298 "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==",
1299 "license": "MIT",
1300 "dependencies": {
1301 "dequal": "^2.0.0"
1302 },
1303 "funding": {
1304 "type": "github",
1305 "url": "https://github.com/sponsors/wooorm"
1306 }
1307 },
1308 "node_modules/electron-to-chromium": {
1309 "version": "1.5.165",
1310 "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.165.tgz",
1311 "integrity": "sha512-naiMx1Z6Nb2TxPU6fiFrUrDTjyPMLdTtaOd2oLmG8zVSg2hCWGkhPyxwk+qRmZ1ytwVqUv0u7ZcDA5+ALhaUtw==",
1312 "license": "ISC"
1313 },
1314 "node_modules/environment": {
1315 "version": "1.1.0",
1316 "resolved": "https://registry.npmjs.org/environment/-/environment-1.1.0.tgz",
1317 "integrity": "sha512-xUtoPkMggbz0MPyPiIWr1Kp4aeWJjDZ6SMvURhimjdZgsRuDplF5/s9hcgGhyXMhs+6vpnuoiZ2kFiu3FMnS8Q==",
1318 "license": "MIT",
1319 "engines": {
1320 "node": ">=18"
1321 },
1322 "funding": {
1323 "url": "https://github.com/sponsors/sindresorhus"
1324 }
1325 },
1326 "node_modules/error-stack-parser": {
1327 "version": "2.1.4",
1328 "resolved": "https://registry.npmjs.org/error-stack-parser/-/error-stack-parser-2.1.4.tgz",
1329 "integrity": "sha512-Sk5V6wVazPhq5MhpO+AUxJn5x7XSXGl1R93Vn7i+zS15KDVxQijejNCrz8340/2bgLBjR9GtEG8ZVKONDjcqGQ==",
1330 "license": "MIT",
1331 "dependencies": {
1332 "stackframe": "^1.3.4"
1333 }
1334 },
1335 "node_modules/esast-util-from-estree": {
1336 "version": "2.0.0",
1337 "resolved": "https://registry.npmjs.org/esast-util-from-estree/-/esast-util-from-estree-2.0.0.tgz",
1338 "integrity": "sha512-4CyanoAudUSBAn5K13H4JhsMH6L9ZP7XbLVe/dKybkxMO7eDyLsT8UHl9TRNrU2Gr9nz+FovfSIjuXWJ81uVwQ==",
1339 "license": "MIT",
1340 "dependencies": {
1341 "@types/estree-jsx": "^1.0.0",
1342 "devlop": "^1.0.0",
1343 "estree-util-visit": "^2.0.0",
1344 "unist-util-position-from-estree": "^2.0.0"
1345 },
1346 "funding": {
1347 "type": "opencollective",
1348 "url": "https://opencollective.com/unified"
1349 }
1350 },
1351 "node_modules/esast-util-from-js": {
1352 "version": "2.0.1",
1353 "resolved": "https://registry.npmjs.org/esast-util-from-js/-/esast-util-from-js-2.0.1.tgz",
1354 "integrity": "sha512-8Ja+rNJ0Lt56Pcf3TAmpBZjmx8ZcK5Ts4cAzIOjsjevg9oSXJnl6SUQ2EevU8tv3h6ZLWmoKL5H4fgWvdvfETw==",
1355 "license": "MIT",
1356 "dependencies": {
1357 "@types/estree-jsx": "^1.0.0",
1358 "acorn": "^8.0.0",
1359 "esast-util-from-estree": "^2.0.0",
1360 "vfile-message": "^4.0.0"
1361 },
1362 "funding": {
1363 "type": "opencollective",
1364 "url": "https://opencollective.com/unified"
1365 }
1366 },
1367 "node_modules/esbuild": {
1368 "version": "0.25.5",
1369 "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.5.tgz",
1370 "integrity": "sha512-P8OtKZRv/5J5hhz0cUAdu/cLuPIKXpQl1R9pZtvmHWQvrAUVd0UNIPT4IB4W3rNOqVO0rlqHmCIbSwxh/c9yUQ==",
1371 "hasInstallScript": true,
1372 "license": "MIT",
1373 "bin": {
1374 "esbuild": "bin/esbuild"
1375 },
1376 "engines": {
1377 "node": ">=18"
1378 },
1379 "optionalDependencies": {
1380 "@esbuild/aix-ppc64": "0.25.5",
1381 "@esbuild/android-arm": "0.25.5",
1382 "@esbuild/android-arm64": "0.25.5",
1383 "@esbuild/android-x64": "0.25.5",
1384 "@esbuild/darwin-arm64": "0.25.5",
1385 "@esbuild/darwin-x64": "0.25.5",
1386 "@esbuild/freebsd-arm64": "0.25.5",
1387 "@esbuild/freebsd-x64": "0.25.5",
1388 "@esbuild/linux-arm": "0.25.5",
1389 "@esbuild/linux-arm64": "0.25.5",
1390 "@esbuild/linux-ia32": "0.25.5",
1391 "@esbuild/linux-loong64": "0.25.5",
1392 "@esbuild/linux-mips64el": "0.25.5",
1393 "@esbuild/linux-ppc64": "0.25.5",
1394 "@esbuild/linux-riscv64": "0.25.5",
1395 "@esbuild/linux-s390x": "0.25.5",
1396 "@esbuild/linux-x64": "0.25.5",
1397 "@esbuild/netbsd-arm64": "0.25.5",
1398 "@esbuild/netbsd-x64": "0.25.5",
1399 "@esbuild/openbsd-arm64": "0.25.5",
1400 "@esbuild/openbsd-x64": "0.25.5",
1401 "@esbuild/sunos-x64": "0.25.5",
1402 "@esbuild/win32-arm64": "0.25.5",
1403 "@esbuild/win32-ia32": "0.25.5",
1404 "@esbuild/win32-x64": "0.25.5"
1405 }
1406 },
1407 "node_modules/escalade": {
1408 "version": "3.2.0",
1409 "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz",
1410 "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",
1411 "license": "MIT",
1412 "engines": {
1413 "node": ">=6"
1414 }
1415 },
1416 "node_modules/estree-util-attach-comments": {
1417 "version": "3.0.0",
1418 "resolved": "https://registry.npmjs.org/estree-util-attach-comments/-/estree-util-attach-comments-3.0.0.tgz",
1419 "integrity": "sha512-cKUwm/HUcTDsYh/9FgnuFqpfquUbwIqwKM26BVCGDPVgvaCl/nDCCjUfiLlx6lsEZ3Z4RFxNbOQ60pkaEwFxGw==",
1420 "license": "MIT",
1421 "dependencies": {
1422 "@types/estree": "^1.0.0"
1423 },
1424 "funding": {
1425 "type": "opencollective",
1426 "url": "https://opencollective.com/unified"
1427 }
1428 },
1429 "node_modules/estree-util-build-jsx": {
1430 "version": "3.0.1",
1431 "resolved": "https://registry.npmjs.org/estree-util-build-jsx/-/estree-util-build-jsx-3.0.1.tgz",
1432 "integrity": "sha512-8U5eiL6BTrPxp/CHbs2yMgP8ftMhR5ww1eIKoWRMlqvltHF8fZn5LRDvTKuxD3DUn+shRbLGqXemcP51oFCsGQ==",
1433 "license": "MIT",
1434 "dependencies": {
1435 "@types/estree-jsx": "^1.0.0",
1436 "devlop": "^1.0.0",
1437 "estree-util-is-identifier-name": "^3.0.0",
1438 "estree-walker": "^3.0.0"
1439 },
1440 "funding": {
1441 "type": "opencollective",
1442 "url": "https://opencollective.com/unified"
1443 }
1444 },
1445 "node_modules/estree-util-is-identifier-name": {
1446 "version": "3.0.0",
1447 "resolved": "https://registry.npmjs.org/estree-util-is-identifier-name/-/estree-util-is-identifier-name-3.0.0.tgz",
1448 "integrity": "sha512-hFtqIDZTIUZ9BXLb8y4pYGyk6+wekIivNVTcmvk8NoOh+VeRn5y6cEHzbURrWbfp1fIqdVipilzj+lfaadNZmg==",
1449 "license": "MIT",
1450 "funding": {
1451 "type": "opencollective",
1452 "url": "https://opencollective.com/unified"
1453 }
1454 },
1455 "node_modules/estree-util-scope": {
1456 "version": "1.0.0",
1457 "resolved": "https://registry.npmjs.org/estree-util-scope/-/estree-util-scope-1.0.0.tgz",
1458 "integrity": "sha512-2CAASclonf+JFWBNJPndcOpA8EMJwa0Q8LUFJEKqXLW6+qBvbFZuF5gItbQOs/umBUkjviCSDCbBwU2cXbmrhQ==",
1459 "license": "MIT",
1460 "dependencies": {
1461 "@types/estree": "^1.0.0",
1462 "devlop": "^1.0.0"
1463 },
1464 "funding": {
1465 "type": "opencollective",
1466 "url": "https://opencollective.com/unified"
1467 }
1468 },
1469 "node_modules/estree-util-to-js": {
1470 "version": "2.0.0",
1471 "resolved": "https://registry.npmjs.org/estree-util-to-js/-/estree-util-to-js-2.0.0.tgz",
1472 "integrity": "sha512-WDF+xj5rRWmD5tj6bIqRi6CkLIXbbNQUcxQHzGysQzvHmdYG2G7p/Tf0J0gpxGgkeMZNTIjT/AoSvC9Xehcgdg==",
1473 "license": "MIT",
1474 "dependencies": {
1475 "@types/estree-jsx": "^1.0.0",
1476 "astring": "^1.8.0",
1477 "source-map": "^0.7.0"
1478 },
1479 "funding": {
1480 "type": "opencollective",
1481 "url": "https://opencollective.com/unified"
1482 }
1483 },
1484 "node_modules/estree-util-visit": {
1485 "version": "2.0.0",
1486 "resolved": "https://registry.npmjs.org/estree-util-visit/-/estree-util-visit-2.0.0.tgz",
1487 "integrity": "sha512-m5KgiH85xAhhW8Wta0vShLcUvOsh3LLPI2YVwcbio1l7E09NTLL1EyMZFM1OyWowoH0skScNbhOPl4kcBgzTww==",
1488 "license": "MIT",
1489 "dependencies": {
1490 "@types/estree-jsx": "^1.0.0",
1491 "@types/unist": "^3.0.0"
1492 },
1493 "funding": {
1494 "type": "opencollective",
1495 "url": "https://opencollective.com/unified"
1496 }
1497 },
1498 "node_modules/estree-walker": {
1499 "version": "3.0.3",
1500 "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz",
1501 "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==",
1502 "license": "MIT",
1503 "dependencies": {
1504 "@types/estree": "^1.0.0"
1505 }
1506 },
1507 "node_modules/extend": {
1508 "version": "3.0.2",
1509 "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
1510 "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==",
1511 "license": "MIT"
1512 },
1513 "node_modules/gensync": {
1514 "version": "1.0.0-beta.2",
1515 "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz",
1516 "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==",
1517 "license": "MIT",
1518 "engines": {
1519 "node": ">=6.9.0"
1520 }
1521 },
1522 "node_modules/globals": {
1523 "version": "11.12.0",
1524 "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz",
1525 "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==",
1526 "license": "MIT",
1527 "engines": {
1528 "node": ">=4"
1529 }
1530 },
1531 "node_modules/hast-util-to-estree": {
1532 "version": "3.1.3",
1533 "resolved": "https://registry.npmjs.org/hast-util-to-estree/-/hast-util-to-estree-3.1.3.tgz",
1534 "integrity": "sha512-48+B/rJWAp0jamNbAAf9M7Uf//UVqAoMmgXhBdxTDJLGKY+LRnZ99qcG+Qjl5HfMpYNzS5v4EAwVEF34LeAj7w==",
1535 "license": "MIT",
1536 "dependencies": {
1537 "@types/estree": "^1.0.0",
1538 "@types/estree-jsx": "^1.0.0",
1539 "@types/hast": "^3.0.0",
1540 "comma-separated-tokens": "^2.0.0",
1541 "devlop": "^1.0.0",
1542 "estree-util-attach-comments": "^3.0.0",
1543 "estree-util-is-identifier-name": "^3.0.0",
1544 "hast-util-whitespace": "^3.0.0",
1545 "mdast-util-mdx-expression": "^2.0.0",
1546 "mdast-util-mdx-jsx": "^3.0.0",
1547 "mdast-util-mdxjs-esm": "^2.0.0",
1548 "property-information": "^7.0.0",
1549 "space-separated-tokens": "^2.0.0",
1550 "style-to-js": "^1.0.0",
1551 "unist-util-position": "^5.0.0",
1552 "zwitch": "^2.0.0"
1553 },
1554 "funding": {
1555 "type": "opencollective",
1556 "url": "https://opencollective.com/unified"
1557 }
1558 },
1559 "node_modules/hast-util-to-jsx-runtime": {
1560 "version": "2.3.6",
1561 "resolved": "https://registry.npmjs.org/hast-util-to-jsx-runtime/-/hast-util-to-jsx-runtime-2.3.6.tgz",
1562 "integrity": "sha512-zl6s8LwNyo1P9uw+XJGvZtdFF1GdAkOg8ujOw+4Pyb76874fLps4ueHXDhXWdk6YHQ6OgUtinliG7RsYvCbbBg==",
1563 "license": "MIT",
1564 "dependencies": {
1565 "@types/estree": "^1.0.0",
1566 "@types/hast": "^3.0.0",
1567 "@types/unist": "^3.0.0",
1568 "comma-separated-tokens": "^2.0.0",
1569 "devlop": "^1.0.0",
1570 "estree-util-is-identifier-name": "^3.0.0",
1571 "hast-util-whitespace": "^3.0.0",
1572 "mdast-util-mdx-expression": "^2.0.0",
1573 "mdast-util-mdx-jsx": "^3.0.0",
1574 "mdast-util-mdxjs-esm": "^2.0.0",
1575 "property-information": "^7.0.0",
1576 "space-separated-tokens": "^2.0.0",
1577 "style-to-js": "^1.0.0",
1578 "unist-util-position": "^5.0.0",
1579 "vfile-message": "^4.0.0"
1580 },
1581 "funding": {
1582 "type": "opencollective",
1583 "url": "https://opencollective.com/unified"
1584 }
1585 },
1586 "node_modules/hast-util-whitespace": {
1587 "version": "3.0.0",
1588 "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz",
1589 "integrity": "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==",
1590 "license": "MIT",
1591 "dependencies": {
1592 "@types/hast": "^3.0.0"
1593 },
1594 "funding": {
1595 "type": "opencollective",
1596 "url": "https://opencollective.com/unified"
1597 }
1598 },
1599 "node_modules/he": {
1600 "version": "1.2.0",
1601 "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz",
1602 "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==",
1603 "license": "MIT",
1604 "bin": {
1605 "he": "bin/he"
1606 }
1607 },
1608 "node_modules/hls.js": {
1609 "version": "1.6.5",
1610 "resolved": "https://registry.npmjs.org/hls.js/-/hls.js-1.6.5.tgz",
1611 "integrity": "sha512-KMn5n7JBK+olC342740hDPHnGWfE8FiHtGMOdJPfUjRdARTWj9OB+8c13fnsf9sk1VtpuU2fKSgUjHvg4rNbzQ==",
1612 "license": "Apache-2.0"
1613 },
1614 "node_modules/hono": {
1615 "version": "4.7.11",
1616 "resolved": "https://registry.npmjs.org/hono/-/hono-4.7.11.tgz",
1617 "integrity": "sha512-rv0JMwC0KALbbmwJDEnxvQCeJh+xbS3KEWW5PC9cMJ08Ur9xgatI0HmtgYZfOdOSOeYsp5LO2cOhdI8cLEbDEQ==",
1618 "license": "MIT",
1619 "engines": {
1620 "node": ">=16.9.0"
1621 }
1622 },
1623 "node_modules/htmljs-parser": {
1624 "version": "5.5.4",
1625 "resolved": "https://registry.npmjs.org/htmljs-parser/-/htmljs-parser-5.5.4.tgz",
1626 "integrity": "sha512-qJiir3ViASVhGdNW4kwM4pQWvDtDLtjwaflEQDooiNzbOPIzoaIzmRFWweFl8GomVhJqXqX0jjrhDED3pmAdzg==",
1627 "license": "MIT"
1628 },
1629 "node_modules/inline-style-parser": {
1630 "version": "0.2.4",
1631 "resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.2.4.tgz",
1632 "integrity": "sha512-0aO8FkhNZlj/ZIbNi7Lxxr12obT7cL1moPfE4tg1LkX7LlLfC6DeX4l2ZEud1ukP9jNQyNnfzQVqwbwmAATY4Q==",
1633 "license": "MIT"
1634 },
1635 "node_modules/is-alphabetical": {
1636 "version": "2.0.1",
1637 "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.1.tgz",
1638 "integrity": "sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ==",
1639 "license": "MIT",
1640 "funding": {
1641 "type": "github",
1642 "url": "https://github.com/sponsors/wooorm"
1643 }
1644 },
1645 "node_modules/is-alphanumerical": {
1646 "version": "2.0.1",
1647 "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-2.0.1.tgz",
1648 "integrity": "sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw==",
1649 "license": "MIT",
1650 "dependencies": {
1651 "is-alphabetical": "^2.0.0",
1652 "is-decimal": "^2.0.0"
1653 },
1654 "funding": {
1655 "type": "github",
1656 "url": "https://github.com/sponsors/wooorm"
1657 }
1658 },
1659 "node_modules/is-decimal": {
1660 "version": "2.0.1",
1661 "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-2.0.1.tgz",
1662 "integrity": "sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==",
1663 "license": "MIT",
1664 "funding": {
1665 "type": "github",
1666 "url": "https://github.com/sponsors/wooorm"
1667 }
1668 },
1669 "node_modules/is-hexadecimal": {
1670 "version": "2.0.1",
1671 "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-2.0.1.tgz",
1672 "integrity": "sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg==",
1673 "license": "MIT",
1674 "funding": {
1675 "type": "github",
1676 "url": "https://github.com/sponsors/wooorm"
1677 }
1678 },
1679 "node_modules/is-plain-obj": {
1680 "version": "4.1.0",
1681 "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz",
1682 "integrity": "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==",
1683 "license": "MIT",
1684 "engines": {
1685 "node": ">=12"
1686 },
1687 "funding": {
1688 "url": "https://github.com/sponsors/sindresorhus"
1689 }
1690 },
1691 "node_modules/js-tokens": {
1692 "version": "4.0.0",
1693 "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
1694 "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
1695 "license": "MIT"
1696 },
1697 "node_modules/jsesc": {
1698 "version": "3.1.0",
1699 "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz",
1700 "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==",
1701 "license": "MIT",
1702 "bin": {
1703 "jsesc": "bin/jsesc"
1704 },
1705 "engines": {
1706 "node": ">=6"
1707 }
1708 },
1709 "node_modules/json5": {
1710 "version": "2.2.3",
1711 "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
1712 "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
1713 "license": "MIT",
1714 "bin": {
1715 "json5": "lib/cli.js"
1716 },
1717 "engines": {
1718 "node": ">=6"
1719 }
1720 },
1721 "node_modules/kleur": {
1722 "version": "4.1.5",
1723 "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz",
1724 "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==",
1725 "license": "MIT",
1726 "engines": {
1727 "node": ">=6"
1728 }
1729 },
1730 "node_modules/lasso-caching-fs": {
1731 "version": "1.0.2",
1732 "resolved": "https://registry.npmjs.org/lasso-caching-fs/-/lasso-caching-fs-1.0.2.tgz",
1733 "integrity": "sha512-mudop0s8U3tLm3Fn9lhiZsiELpLeJToEo6RlDLdph7vWRxL9Sz0o+9WUw1IwlpCYXv/P0CLsMYWFgPwIKWEYvg==",
1734 "license": "Apache-2.0",
1735 "dependencies": {
1736 "raptor-async": "^1.1.2"
1737 }
1738 },
1739 "node_modules/lasso-package-root": {
1740 "version": "1.0.1",
1741 "resolved": "https://registry.npmjs.org/lasso-package-root/-/lasso-package-root-1.0.1.tgz",
1742 "integrity": "sha512-j6LnauNCldqSDvOxoKpD6sTzudPGMiwcZQbySoF9KvJ0lD9Dp2t6QZF8kC0jbUDHuQPiAo5RuQ/mC3AGXscUYA==",
1743 "license": "Apache-2.0",
1744 "dependencies": {
1745 "lasso-caching-fs": "^1.0.0"
1746 }
1747 },
1748 "node_modules/longest-streak": {
1749 "version": "3.1.0",
1750 "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-3.1.0.tgz",
1751 "integrity": "sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==",
1752 "license": "MIT",
1753 "funding": {
1754 "type": "github",
1755 "url": "https://github.com/sponsors/wooorm"
1756 }
1757 },
1758 "node_modules/lru-cache": {
1759 "version": "5.1.1",
1760 "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
1761 "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==",
1762 "license": "ISC",
1763 "dependencies": {
1764 "yallist": "^3.0.2"
1765 }
1766 },
1767 "node_modules/magic-string": {
1768 "version": "0.30.17",
1769 "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz",
1770 "integrity": "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==",
1771 "license": "MIT",
1772 "dependencies": {
1773 "@jridgewell/sourcemap-codec": "^1.5.0"
1774 }
1775 },
1776 "node_modules/markdown-extensions": {
1777 "version": "2.0.0",
1778 "resolved": "https://registry.npmjs.org/markdown-extensions/-/markdown-extensions-2.0.0.tgz",
1779 "integrity": "sha512-o5vL7aDWatOTX8LzaS1WMoaoxIiLRQJuIKKe2wAw6IeULDHaqbiqiggmx+pKvZDb1Sj+pE46Sn1T7lCqfFtg1Q==",
1780 "license": "MIT",
1781 "engines": {
1782 "node": ">=16"
1783 },
1784 "funding": {
1785 "url": "https://github.com/sponsors/sindresorhus"
1786 }
1787 },
1788 "node_modules/marko": {
1789 "version": "6.0.21",
1790 "resolved": "https://registry.npmjs.org/marko/-/marko-6.0.21.tgz",
1791 "integrity": "sha512-yBMI1GfqAncP/R24vATKOr/VkAOox49hr6Jqw/HBwYQqU/QMpwYOMMNii09K3mJm0ABcq/oGk/CF81a3AZ3EsQ==",
1792 "license": "MIT",
1793 "dependencies": {
1794 "@marko/compiler": "^5.39.21",
1795 "csstype": "^3.1.3",
1796 "magic-string": "^0.30.17"
1797 },
1798 "engines": {
1799 "node": "18 || 20 || >=22"
1800 }
1801 },
1802 "node_modules/mdast-util-from-markdown": {
1803 "version": "2.0.2",
1804 "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-2.0.2.tgz",
1805 "integrity": "sha512-uZhTV/8NBuw0WHkPTrCqDOl0zVe1BIng5ZtHoDk49ME1qqcjYmmLmOf0gELgcRMxN4w2iuIeVso5/6QymSrgmA==",
1806 "license": "MIT",
1807 "dependencies": {
1808 "@types/mdast": "^4.0.0",
1809 "@types/unist": "^3.0.0",
1810 "decode-named-character-reference": "^1.0.0",
1811 "devlop": "^1.0.0",
1812 "mdast-util-to-string": "^4.0.0",
1813 "micromark": "^4.0.0",
1814 "micromark-util-decode-numeric-character-reference": "^2.0.0",
1815 "micromark-util-decode-string": "^2.0.0",
1816 "micromark-util-normalize-identifier": "^2.0.0",
1817 "micromark-util-symbol": "^2.0.0",
1818 "micromark-util-types": "^2.0.0",
1819 "unist-util-stringify-position": "^4.0.0"
1820 },
1821 "funding": {
1822 "type": "opencollective",
1823 "url": "https://opencollective.com/unified"
1824 }
1825 },
1826 "node_modules/mdast-util-mdx": {
1827 "version": "3.0.0",
1828 "resolved": "https://registry.npmjs.org/mdast-util-mdx/-/mdast-util-mdx-3.0.0.tgz",
1829 "integrity": "sha512-JfbYLAW7XnYTTbUsmpu0kdBUVe+yKVJZBItEjwyYJiDJuZ9w4eeaqks4HQO+R7objWgS2ymV60GYpI14Ug554w==",
1830 "license": "MIT",
1831 "dependencies": {
1832 "mdast-util-from-markdown": "^2.0.0",
1833 "mdast-util-mdx-expression": "^2.0.0",
1834 "mdast-util-mdx-jsx": "^3.0.0",
1835 "mdast-util-mdxjs-esm": "^2.0.0",
1836 "mdast-util-to-markdown": "^2.0.0"
1837 },
1838 "funding": {
1839 "type": "opencollective",
1840 "url": "https://opencollective.com/unified"
1841 }
1842 },
1843 "node_modules/mdast-util-mdx-expression": {
1844 "version": "2.0.1",
1845 "resolved": "https://registry.npmjs.org/mdast-util-mdx-expression/-/mdast-util-mdx-expression-2.0.1.tgz",
1846 "integrity": "sha512-J6f+9hUp+ldTZqKRSg7Vw5V6MqjATc+3E4gf3CFNcuZNWD8XdyI6zQ8GqH7f8169MM6P7hMBRDVGnn7oHB9kXQ==",
1847 "license": "MIT",
1848 "dependencies": {
1849 "@types/estree-jsx": "^1.0.0",
1850 "@types/hast": "^3.0.0",
1851 "@types/mdast": "^4.0.0",
1852 "devlop": "^1.0.0",
1853 "mdast-util-from-markdown": "^2.0.0",
1854 "mdast-util-to-markdown": "^2.0.0"
1855 },
1856 "funding": {
1857 "type": "opencollective",
1858 "url": "https://opencollective.com/unified"
1859 }
1860 },
1861 "node_modules/mdast-util-mdx-jsx": {
1862 "version": "3.2.0",
1863 "resolved": "https://registry.npmjs.org/mdast-util-mdx-jsx/-/mdast-util-mdx-jsx-3.2.0.tgz",
1864 "integrity": "sha512-lj/z8v0r6ZtsN/cGNNtemmmfoLAFZnjMbNyLzBafjzikOM+glrjNHPlf6lQDOTccj9n5b0PPihEBbhneMyGs1Q==",
1865 "license": "MIT",
1866 "dependencies": {
1867 "@types/estree-jsx": "^1.0.0",
1868 "@types/hast": "^3.0.0",
1869 "@types/mdast": "^4.0.0",
1870 "@types/unist": "^3.0.0",
1871 "ccount": "^2.0.0",
1872 "devlop": "^1.1.0",
1873 "mdast-util-from-markdown": "^2.0.0",
1874 "mdast-util-to-markdown": "^2.0.0",
1875 "parse-entities": "^4.0.0",
1876 "stringify-entities": "^4.0.0",
1877 "unist-util-stringify-position": "^4.0.0",
1878 "vfile-message": "^4.0.0"
1879 },
1880 "funding": {
1881 "type": "opencollective",
1882 "url": "https://opencollective.com/unified"
1883 }
1884 },
1885 "node_modules/mdast-util-mdxjs-esm": {
1886 "version": "2.0.1",
1887 "resolved": "https://registry.npmjs.org/mdast-util-mdxjs-esm/-/mdast-util-mdxjs-esm-2.0.1.tgz",
1888 "integrity": "sha512-EcmOpxsZ96CvlP03NghtH1EsLtr0n9Tm4lPUJUBccV9RwUOneqSycg19n5HGzCf+10LozMRSObtVr3ee1WoHtg==",
1889 "license": "MIT",
1890 "dependencies": {
1891 "@types/estree-jsx": "^1.0.0",
1892 "@types/hast": "^3.0.0",
1893 "@types/mdast": "^4.0.0",
1894 "devlop": "^1.0.0",
1895 "mdast-util-from-markdown": "^2.0.0",
1896 "mdast-util-to-markdown": "^2.0.0"
1897 },
1898 "funding": {
1899 "type": "opencollective",
1900 "url": "https://opencollective.com/unified"
1901 }
1902 },
1903 "node_modules/mdast-util-phrasing": {
1904 "version": "4.1.0",
1905 "resolved": "https://registry.npmjs.org/mdast-util-phrasing/-/mdast-util-phrasing-4.1.0.tgz",
1906 "integrity": "sha512-TqICwyvJJpBwvGAMZjj4J2n0X8QWp21b9l0o7eXyVJ25YNWYbJDVIyD1bZXE6WtV6RmKJVYmQAKWa0zWOABz2w==",
1907 "license": "MIT",
1908 "dependencies": {
1909 "@types/mdast": "^4.0.0",
1910 "unist-util-is": "^6.0.0"
1911 },
1912 "funding": {
1913 "type": "opencollective",
1914 "url": "https://opencollective.com/unified"
1915 }
1916 },
1917 "node_modules/mdast-util-to-hast": {
1918 "version": "13.2.0",
1919 "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.0.tgz",
1920 "integrity": "sha512-QGYKEuUsYT9ykKBCMOEDLsU5JRObWQusAolFMeko/tYPufNkRffBAQjIE+99jbA87xv6FgmjLtwjh9wBWajwAA==",
1921 "license": "MIT",
1922 "dependencies": {
1923 "@types/hast": "^3.0.0",
1924 "@types/mdast": "^4.0.0",
1925 "@ungap/structured-clone": "^1.0.0",
1926 "devlop": "^1.0.0",
1927 "micromark-util-sanitize-uri": "^2.0.0",
1928 "trim-lines": "^3.0.0",
1929 "unist-util-position": "^5.0.0",
1930 "unist-util-visit": "^5.0.0",
1931 "vfile": "^6.0.0"
1932 },
1933 "funding": {
1934 "type": "opencollective",
1935 "url": "https://opencollective.com/unified"
1936 }
1937 },
1938 "node_modules/mdast-util-to-markdown": {
1939 "version": "2.1.2",
1940 "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-2.1.2.tgz",
1941 "integrity": "sha512-xj68wMTvGXVOKonmog6LwyJKrYXZPvlwabaryTjLh9LuvovB/KAH+kvi8Gjj+7rJjsFi23nkUxRQv1KqSroMqA==",
1942 "license": "MIT",
1943 "dependencies": {
1944 "@types/mdast": "^4.0.0",
1945 "@types/unist": "^3.0.0",
1946 "longest-streak": "^3.0.0",
1947 "mdast-util-phrasing": "^4.0.0",
1948 "mdast-util-to-string": "^4.0.0",
1949 "micromark-util-classify-character": "^2.0.0",
1950 "micromark-util-decode-string": "^2.0.0",
1951 "unist-util-visit": "^5.0.0",
1952 "zwitch": "^2.0.0"
1953 },
1954 "funding": {
1955 "type": "opencollective",
1956 "url": "https://opencollective.com/unified"
1957 }
1958 },
1959 "node_modules/mdast-util-to-string": {
1960 "version": "4.0.0",
1961 "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-4.0.0.tgz",
1962 "integrity": "sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg==",
1963 "license": "MIT",
1964 "dependencies": {
1965 "@types/mdast": "^4.0.0"
1966 },
1967 "funding": {
1968 "type": "opencollective",
1969 "url": "https://opencollective.com/unified"
1970 }
1971 },
1972 "node_modules/micromark": {
1973 "version": "4.0.2",
1974 "resolved": "https://registry.npmjs.org/micromark/-/micromark-4.0.2.tgz",
1975 "integrity": "sha512-zpe98Q6kvavpCr1NPVSCMebCKfD7CA2NqZ+rykeNhONIJBpc1tFKt9hucLGwha3jNTNI8lHpctWJWoimVF4PfA==",
1976 "funding": [
1977 {
1978 "type": "GitHub Sponsors",
1979 "url": "https://github.com/sponsors/unifiedjs"
1980 },
1981 {
1982 "type": "OpenCollective",
1983 "url": "https://opencollective.com/unified"
1984 }
1985 ],
1986 "license": "MIT",
1987 "dependencies": {
1988 "@types/debug": "^4.0.0",
1989 "debug": "^4.0.0",
1990 "decode-named-character-reference": "^1.0.0",
1991 "devlop": "^1.0.0",
1992 "micromark-core-commonmark": "^2.0.0",
1993 "micromark-factory-space": "^2.0.0",
1994 "micromark-util-character": "^2.0.0",
1995 "micromark-util-chunked": "^2.0.0",
1996 "micromark-util-combine-extensions": "^2.0.0",
1997 "micromark-util-decode-numeric-character-reference": "^2.0.0",
1998 "micromark-util-encode": "^2.0.0",
1999 "micromark-util-normalize-identifier": "^2.0.0",
2000 "micromark-util-resolve-all": "^2.0.0",
2001 "micromark-util-sanitize-uri": "^2.0.0",
2002 "micromark-util-subtokenize": "^2.0.0",
2003 "micromark-util-symbol": "^2.0.0",
2004 "micromark-util-types": "^2.0.0"
2005 }
2006 },
2007 "node_modules/micromark-core-commonmark": {
2008 "version": "2.0.3",
2009 "resolved": "https://registry.npmjs.org/micromark-core-commonmark/-/micromark-core-commonmark-2.0.3.tgz",
2010 "integrity": "sha512-RDBrHEMSxVFLg6xvnXmb1Ayr2WzLAWjeSATAoxwKYJV94TeNavgoIdA0a9ytzDSVzBy2YKFK+emCPOEibLeCrg==",
2011 "funding": [
2012 {
2013 "type": "GitHub Sponsors",
2014 "url": "https://github.com/sponsors/unifiedjs"
2015 },
2016 {
2017 "type": "OpenCollective",
2018 "url": "https://opencollective.com/unified"
2019 }
2020 ],
2021 "license": "MIT",
2022 "dependencies": {
2023 "decode-named-character-reference": "^1.0.0",
2024 "devlop": "^1.0.0",
2025 "micromark-factory-destination": "^2.0.0",
2026 "micromark-factory-label": "^2.0.0",
2027 "micromark-factory-space": "^2.0.0",
2028 "micromark-factory-title": "^2.0.0",
2029 "micromark-factory-whitespace": "^2.0.0",
2030 "micromark-util-character": "^2.0.0",
2031 "micromark-util-chunked": "^2.0.0",
2032 "micromark-util-classify-character": "^2.0.0",
2033 "micromark-util-html-tag-name": "^2.0.0",
2034 "micromark-util-normalize-identifier": "^2.0.0",
2035 "micromark-util-resolve-all": "^2.0.0",
2036 "micromark-util-subtokenize": "^2.0.0",
2037 "micromark-util-symbol": "^2.0.0",
2038 "micromark-util-types": "^2.0.0"
2039 }
2040 },
2041 "node_modules/micromark-extension-mdx-expression": {
2042 "version": "3.0.1",
2043 "resolved": "https://registry.npmjs.org/micromark-extension-mdx-expression/-/micromark-extension-mdx-expression-3.0.1.tgz",
2044 "integrity": "sha512-dD/ADLJ1AeMvSAKBwO22zG22N4ybhe7kFIZ3LsDI0GlsNr2A3KYxb0LdC1u5rj4Nw+CHKY0RVdnHX8vj8ejm4Q==",
2045 "funding": [
2046 {
2047 "type": "GitHub Sponsors",
2048 "url": "https://github.com/sponsors/unifiedjs"
2049 },
2050 {
2051 "type": "OpenCollective",
2052 "url": "https://opencollective.com/unified"
2053 }
2054 ],
2055 "license": "MIT",
2056 "dependencies": {
2057 "@types/estree": "^1.0.0",
2058 "devlop": "^1.0.0",
2059 "micromark-factory-mdx-expression": "^2.0.0",
2060 "micromark-factory-space": "^2.0.0",
2061 "micromark-util-character": "^2.0.0",
2062 "micromark-util-events-to-acorn": "^2.0.0",
2063 "micromark-util-symbol": "^2.0.0",
2064 "micromark-util-types": "^2.0.0"
2065 }
2066 },
2067 "node_modules/micromark-extension-mdx-jsx": {
2068 "version": "3.0.2",
2069 "resolved": "https://registry.npmjs.org/micromark-extension-mdx-jsx/-/micromark-extension-mdx-jsx-3.0.2.tgz",
2070 "integrity": "sha512-e5+q1DjMh62LZAJOnDraSSbDMvGJ8x3cbjygy2qFEi7HCeUT4BDKCvMozPozcD6WmOt6sVvYDNBKhFSz3kjOVQ==",
2071 "license": "MIT",
2072 "dependencies": {
2073 "@types/estree": "^1.0.0",
2074 "devlop": "^1.0.0",
2075 "estree-util-is-identifier-name": "^3.0.0",
2076 "micromark-factory-mdx-expression": "^2.0.0",
2077 "micromark-factory-space": "^2.0.0",
2078 "micromark-util-character": "^2.0.0",
2079 "micromark-util-events-to-acorn": "^2.0.0",
2080 "micromark-util-symbol": "^2.0.0",
2081 "micromark-util-types": "^2.0.0",
2082 "vfile-message": "^4.0.0"
2083 },
2084 "funding": {
2085 "type": "opencollective",
2086 "url": "https://opencollective.com/unified"
2087 }
2088 },
2089 "node_modules/micromark-extension-mdx-md": {
2090 "version": "2.0.0",
2091 "resolved": "https://registry.npmjs.org/micromark-extension-mdx-md/-/micromark-extension-mdx-md-2.0.0.tgz",
2092 "integrity": "sha512-EpAiszsB3blw4Rpba7xTOUptcFeBFi+6PY8VnJ2hhimH+vCQDirWgsMpz7w1XcZE7LVrSAUGb9VJpG9ghlYvYQ==",
2093 "license": "MIT",
2094 "dependencies": {
2095 "micromark-util-types": "^2.0.0"
2096 },
2097 "funding": {
2098 "type": "opencollective",
2099 "url": "https://opencollective.com/unified"
2100 }
2101 },
2102 "node_modules/micromark-extension-mdxjs": {
2103 "version": "3.0.0",
2104 "resolved": "https://registry.npmjs.org/micromark-extension-mdxjs/-/micromark-extension-mdxjs-3.0.0.tgz",
2105 "integrity": "sha512-A873fJfhnJ2siZyUrJ31l34Uqwy4xIFmvPY1oj+Ean5PHcPBYzEsvqvWGaWcfEIr11O5Dlw3p2y0tZWpKHDejQ==",
2106 "license": "MIT",
2107 "dependencies": {
2108 "acorn": "^8.0.0",
2109 "acorn-jsx": "^5.0.0",
2110 "micromark-extension-mdx-expression": "^3.0.0",
2111 "micromark-extension-mdx-jsx": "^3.0.0",
2112 "micromark-extension-mdx-md": "^2.0.0",
2113 "micromark-extension-mdxjs-esm": "^3.0.0",
2114 "micromark-util-combine-extensions": "^2.0.0",
2115 "micromark-util-types": "^2.0.0"
2116 },
2117 "funding": {
2118 "type": "opencollective",
2119 "url": "https://opencollective.com/unified"
2120 }
2121 },
2122 "node_modules/micromark-extension-mdxjs-esm": {
2123 "version": "3.0.0",
2124 "resolved": "https://registry.npmjs.org/micromark-extension-mdxjs-esm/-/micromark-extension-mdxjs-esm-3.0.0.tgz",
2125 "integrity": "sha512-DJFl4ZqkErRpq/dAPyeWp15tGrcrrJho1hKK5uBS70BCtfrIFg81sqcTVu3Ta+KD1Tk5vAtBNElWxtAa+m8K9A==",
2126 "license": "MIT",
2127 "dependencies": {
2128 "@types/estree": "^1.0.0",
2129 "devlop": "^1.0.0",
2130 "micromark-core-commonmark": "^2.0.0",
2131 "micromark-util-character": "^2.0.0",
2132 "micromark-util-events-to-acorn": "^2.0.0",
2133 "micromark-util-symbol": "^2.0.0",
2134 "micromark-util-types": "^2.0.0",
2135 "unist-util-position-from-estree": "^2.0.0",
2136 "vfile-message": "^4.0.0"
2137 },
2138 "funding": {
2139 "type": "opencollective",
2140 "url": "https://opencollective.com/unified"
2141 }
2142 },
2143 "node_modules/micromark-factory-destination": {
2144 "version": "2.0.1",
2145 "resolved": "https://registry.npmjs.org/micromark-factory-destination/-/micromark-factory-destination-2.0.1.tgz",
2146 "integrity": "sha512-Xe6rDdJlkmbFRExpTOmRj9N3MaWmbAgdpSrBQvCFqhezUn4AHqJHbaEnfbVYYiexVSs//tqOdY/DxhjdCiJnIA==",
2147 "funding": [
2148 {
2149 "type": "GitHub Sponsors",
2150 "url": "https://github.com/sponsors/unifiedjs"
2151 },
2152 {
2153 "type": "OpenCollective",
2154 "url": "https://opencollective.com/unified"
2155 }
2156 ],
2157 "license": "MIT",
2158 "dependencies": {
2159 "micromark-util-character": "^2.0.0",
2160 "micromark-util-symbol": "^2.0.0",
2161 "micromark-util-types": "^2.0.0"
2162 }
2163 },
2164 "node_modules/micromark-factory-label": {
2165 "version": "2.0.1",
2166 "resolved": "https://registry.npmjs.org/micromark-factory-label/-/micromark-factory-label-2.0.1.tgz",
2167 "integrity": "sha512-VFMekyQExqIW7xIChcXn4ok29YE3rnuyveW3wZQWWqF4Nv9Wk5rgJ99KzPvHjkmPXF93FXIbBp6YdW3t71/7Vg==",
2168 "funding": [
2169 {
2170 "type": "GitHub Sponsors",
2171 "url": "https://github.com/sponsors/unifiedjs"
2172 },
2173 {
2174 "type": "OpenCollective",
2175 "url": "https://opencollective.com/unified"
2176 }
2177 ],
2178 "license": "MIT",
2179 "dependencies": {
2180 "devlop": "^1.0.0",
2181 "micromark-util-character": "^2.0.0",
2182 "micromark-util-symbol": "^2.0.0",
2183 "micromark-util-types": "^2.0.0"
2184 }
2185 },
2186 "node_modules/micromark-factory-mdx-expression": {
2187 "version": "2.0.3",
2188 "resolved": "https://registry.npmjs.org/micromark-factory-mdx-expression/-/micromark-factory-mdx-expression-2.0.3.tgz",
2189 "integrity": "sha512-kQnEtA3vzucU2BkrIa8/VaSAsP+EJ3CKOvhMuJgOEGg9KDC6OAY6nSnNDVRiVNRqj7Y4SlSzcStaH/5jge8JdQ==",
2190 "funding": [
2191 {
2192 "type": "GitHub Sponsors",
2193 "url": "https://github.com/sponsors/unifiedjs"
2194 },
2195 {
2196 "type": "OpenCollective",
2197 "url": "https://opencollective.com/unified"
2198 }
2199 ],
2200 "license": "MIT",
2201 "dependencies": {
2202 "@types/estree": "^1.0.0",
2203 "devlop": "^1.0.0",
2204 "micromark-factory-space": "^2.0.0",
2205 "micromark-util-character": "^2.0.0",
2206 "micromark-util-events-to-acorn": "^2.0.0",
2207 "micromark-util-symbol": "^2.0.0",
2208 "micromark-util-types": "^2.0.0",
2209 "unist-util-position-from-estree": "^2.0.0",
2210 "vfile-message": "^4.0.0"
2211 }
2212 },
2213 "node_modules/micromark-factory-space": {
2214 "version": "2.0.1",
2215 "resolved": "https://registry.npmjs.org/micromark-factory-space/-/micromark-factory-space-2.0.1.tgz",
2216 "integrity": "sha512-zRkxjtBxxLd2Sc0d+fbnEunsTj46SWXgXciZmHq0kDYGnck/ZSGj9/wULTV95uoeYiK5hRXP2mJ98Uo4cq/LQg==",
2217 "funding": [
2218 {
2219 "type": "GitHub Sponsors",
2220 "url": "https://github.com/sponsors/unifiedjs"
2221 },
2222 {
2223 "type": "OpenCollective",
2224 "url": "https://opencollective.com/unified"
2225 }
2226 ],
2227 "license": "MIT",
2228 "dependencies": {
2229 "micromark-util-character": "^2.0.0",
2230 "micromark-util-types": "^2.0.0"
2231 }
2232 },
2233 "node_modules/micromark-factory-title": {
2234 "version": "2.0.1",
2235 "resolved": "https://registry.npmjs.org/micromark-factory-title/-/micromark-factory-title-2.0.1.tgz",
2236 "integrity": "sha512-5bZ+3CjhAd9eChYTHsjy6TGxpOFSKgKKJPJxr293jTbfry2KDoWkhBb6TcPVB4NmzaPhMs1Frm9AZH7OD4Cjzw==",
2237 "funding": [
2238 {
2239 "type": "GitHub Sponsors",
2240 "url": "https://github.com/sponsors/unifiedjs"
2241 },
2242 {
2243 "type": "OpenCollective",
2244 "url": "https://opencollective.com/unified"
2245 }
2246 ],
2247 "license": "MIT",
2248 "dependencies": {
2249 "micromark-factory-space": "^2.0.0",
2250 "micromark-util-character": "^2.0.0",
2251 "micromark-util-symbol": "^2.0.0",
2252 "micromark-util-types": "^2.0.0"
2253 }
2254 },
2255 "node_modules/micromark-factory-whitespace": {
2256 "version": "2.0.1",
2257 "resolved": "https://registry.npmjs.org/micromark-factory-whitespace/-/micromark-factory-whitespace-2.0.1.tgz",
2258 "integrity": "sha512-Ob0nuZ3PKt/n0hORHyvoD9uZhr+Za8sFoP+OnMcnWK5lngSzALgQYKMr9RJVOWLqQYuyn6ulqGWSXdwf6F80lQ==",
2259 "funding": [
2260 {
2261 "type": "GitHub Sponsors",
2262 "url": "https://github.com/sponsors/unifiedjs"
2263 },
2264 {
2265 "type": "OpenCollective",
2266 "url": "https://opencollective.com/unified"
2267 }
2268 ],
2269 "license": "MIT",
2270 "dependencies": {
2271 "micromark-factory-space": "^2.0.0",
2272 "micromark-util-character": "^2.0.0",
2273 "micromark-util-symbol": "^2.0.0",
2274 "micromark-util-types": "^2.0.0"
2275 }
2276 },
2277 "node_modules/micromark-util-character": {
2278 "version": "2.1.1",
2279 "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.1.tgz",
2280 "integrity": "sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==",
2281 "funding": [
2282 {
2283 "type": "GitHub Sponsors",
2284 "url": "https://github.com/sponsors/unifiedjs"
2285 },
2286 {
2287 "type": "OpenCollective",
2288 "url": "https://opencollective.com/unified"
2289 }
2290 ],
2291 "license": "MIT",
2292 "dependencies": {
2293 "micromark-util-symbol": "^2.0.0",
2294 "micromark-util-types": "^2.0.0"
2295 }
2296 },
2297 "node_modules/micromark-util-chunked": {
2298 "version": "2.0.1",
2299 "resolved": "https://registry.npmjs.org/micromark-util-chunked/-/micromark-util-chunked-2.0.1.tgz",
2300 "integrity": "sha512-QUNFEOPELfmvv+4xiNg2sRYeS/P84pTW0TCgP5zc9FpXetHY0ab7SxKyAQCNCc1eK0459uoLI1y5oO5Vc1dbhA==",
2301 "funding": [
2302 {
2303 "type": "GitHub Sponsors",
2304 "url": "https://github.com/sponsors/unifiedjs"
2305 },
2306 {
2307 "type": "OpenCollective",
2308 "url": "https://opencollective.com/unified"
2309 }
2310 ],
2311 "license": "MIT",
2312 "dependencies": {
2313 "micromark-util-symbol": "^2.0.0"
2314 }
2315 },
2316 "node_modules/micromark-util-classify-character": {
2317 "version": "2.0.1",
2318 "resolved": "https://registry.npmjs.org/micromark-util-classify-character/-/micromark-util-classify-character-2.0.1.tgz",
2319 "integrity": "sha512-K0kHzM6afW/MbeWYWLjoHQv1sgg2Q9EccHEDzSkxiP/EaagNzCm7T/WMKZ3rjMbvIpvBiZgwR3dKMygtA4mG1Q==",
2320 "funding": [
2321 {
2322 "type": "GitHub Sponsors",
2323 "url": "https://github.com/sponsors/unifiedjs"
2324 },
2325 {
2326 "type": "OpenCollective",
2327 "url": "https://opencollective.com/unified"
2328 }
2329 ],
2330 "license": "MIT",
2331 "dependencies": {
2332 "micromark-util-character": "^2.0.0",
2333 "micromark-util-symbol": "^2.0.0",
2334 "micromark-util-types": "^2.0.0"
2335 }
2336 },
2337 "node_modules/micromark-util-combine-extensions": {
2338 "version": "2.0.1",
2339 "resolved": "https://registry.npmjs.org/micromark-util-combine-extensions/-/micromark-util-combine-extensions-2.0.1.tgz",
2340 "integrity": "sha512-OnAnH8Ujmy59JcyZw8JSbK9cGpdVY44NKgSM7E9Eh7DiLS2E9RNQf0dONaGDzEG9yjEl5hcqeIsj4hfRkLH/Bg==",
2341 "funding": [
2342 {
2343 "type": "GitHub Sponsors",
2344 "url": "https://github.com/sponsors/unifiedjs"
2345 },
2346 {
2347 "type": "OpenCollective",
2348 "url": "https://opencollective.com/unified"
2349 }
2350 ],
2351 "license": "MIT",
2352 "dependencies": {
2353 "micromark-util-chunked": "^2.0.0",
2354 "micromark-util-types": "^2.0.0"
2355 }
2356 },
2357 "node_modules/micromark-util-decode-numeric-character-reference": {
2358 "version": "2.0.2",
2359 "resolved": "https://registry.npmjs.org/micromark-util-decode-numeric-character-reference/-/micromark-util-decode-numeric-character-reference-2.0.2.tgz",
2360 "integrity": "sha512-ccUbYk6CwVdkmCQMyr64dXz42EfHGkPQlBj5p7YVGzq8I7CtjXZJrubAYezf7Rp+bjPseiROqe7G6foFd+lEuw==",
2361 "funding": [
2362 {
2363 "type": "GitHub Sponsors",
2364 "url": "https://github.com/sponsors/unifiedjs"
2365 },
2366 {
2367 "type": "OpenCollective",
2368 "url": "https://opencollective.com/unified"
2369 }
2370 ],
2371 "license": "MIT",
2372 "dependencies": {
2373 "micromark-util-symbol": "^2.0.0"
2374 }
2375 },
2376 "node_modules/micromark-util-decode-string": {
2377 "version": "2.0.1",
2378 "resolved": "https://registry.npmjs.org/micromark-util-decode-string/-/micromark-util-decode-string-2.0.1.tgz",
2379 "integrity": "sha512-nDV/77Fj6eH1ynwscYTOsbK7rR//Uj0bZXBwJZRfaLEJ1iGBR6kIfNmlNqaqJf649EP0F3NWNdeJi03elllNUQ==",
2380 "funding": [
2381 {
2382 "type": "GitHub Sponsors",
2383 "url": "https://github.com/sponsors/unifiedjs"
2384 },
2385 {
2386 "type": "OpenCollective",
2387 "url": "https://opencollective.com/unified"
2388 }
2389 ],
2390 "license": "MIT",
2391 "dependencies": {
2392 "decode-named-character-reference": "^1.0.0",
2393 "micromark-util-character": "^2.0.0",
2394 "micromark-util-decode-numeric-character-reference": "^2.0.0",
2395 "micromark-util-symbol": "^2.0.0"
2396 }
2397 },
2398 "node_modules/micromark-util-encode": {
2399 "version": "2.0.1",
2400 "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-2.0.1.tgz",
2401 "integrity": "sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw==",
2402 "funding": [
2403 {
2404 "type": "GitHub Sponsors",
2405 "url": "https://github.com/sponsors/unifiedjs"
2406 },
2407 {
2408 "type": "OpenCollective",
2409 "url": "https://opencollective.com/unified"
2410 }
2411 ],
2412 "license": "MIT"
2413 },
2414 "node_modules/micromark-util-events-to-acorn": {
2415 "version": "2.0.3",
2416 "resolved": "https://registry.npmjs.org/micromark-util-events-to-acorn/-/micromark-util-events-to-acorn-2.0.3.tgz",
2417 "integrity": "sha512-jmsiEIiZ1n7X1Rr5k8wVExBQCg5jy4UXVADItHmNk1zkwEVhBuIUKRu3fqv+hs4nxLISi2DQGlqIOGiFxgbfHg==",
2418 "funding": [
2419 {
2420 "type": "GitHub Sponsors",
2421 "url": "https://github.com/sponsors/unifiedjs"
2422 },
2423 {
2424 "type": "OpenCollective",
2425 "url": "https://opencollective.com/unified"
2426 }
2427 ],
2428 "license": "MIT",
2429 "dependencies": {
2430 "@types/estree": "^1.0.0",
2431 "@types/unist": "^3.0.0",
2432 "devlop": "^1.0.0",
2433 "estree-util-visit": "^2.0.0",
2434 "micromark-util-symbol": "^2.0.0",
2435 "micromark-util-types": "^2.0.0",
2436 "vfile-message": "^4.0.0"
2437 }
2438 },
2439 "node_modules/micromark-util-html-tag-name": {
2440 "version": "2.0.1",
2441 "resolved": "https://registry.npmjs.org/micromark-util-html-tag-name/-/micromark-util-html-tag-name-2.0.1.tgz",
2442 "integrity": "sha512-2cNEiYDhCWKI+Gs9T0Tiysk136SnR13hhO8yW6BGNyhOC4qYFnwF1nKfD3HFAIXA5c45RrIG1ub11GiXeYd1xA==",
2443 "funding": [
2444 {
2445 "type": "GitHub Sponsors",
2446 "url": "https://github.com/sponsors/unifiedjs"
2447 },
2448 {
2449 "type": "OpenCollective",
2450 "url": "https://opencollective.com/unified"
2451 }
2452 ],
2453 "license": "MIT"
2454 },
2455 "node_modules/micromark-util-normalize-identifier": {
2456 "version": "2.0.1",
2457 "resolved": "https://registry.npmjs.org/micromark-util-normalize-identifier/-/micromark-util-normalize-identifier-2.0.1.tgz",
2458 "integrity": "sha512-sxPqmo70LyARJs0w2UclACPUUEqltCkJ6PhKdMIDuJ3gSf/Q+/GIe3WKl0Ijb/GyH9lOpUkRAO2wp0GVkLvS9Q==",
2459 "funding": [
2460 {
2461 "type": "GitHub Sponsors",
2462 "url": "https://github.com/sponsors/unifiedjs"
2463 },
2464 {
2465 "type": "OpenCollective",
2466 "url": "https://opencollective.com/unified"
2467 }
2468 ],
2469 "license": "MIT",
2470 "dependencies": {
2471 "micromark-util-symbol": "^2.0.0"
2472 }
2473 },
2474 "node_modules/micromark-util-resolve-all": {
2475 "version": "2.0.1",
2476 "resolved": "https://registry.npmjs.org/micromark-util-resolve-all/-/micromark-util-resolve-all-2.0.1.tgz",
2477 "integrity": "sha512-VdQyxFWFT2/FGJgwQnJYbe1jjQoNTS4RjglmSjTUlpUMa95Htx9NHeYW4rGDJzbjvCsl9eLjMQwGeElsqmzcHg==",
2478 "funding": [
2479 {
2480 "type": "GitHub Sponsors",
2481 "url": "https://github.com/sponsors/unifiedjs"
2482 },
2483 {
2484 "type": "OpenCollective",
2485 "url": "https://opencollective.com/unified"
2486 }
2487 ],
2488 "license": "MIT",
2489 "dependencies": {
2490 "micromark-util-types": "^2.0.0"
2491 }
2492 },
2493 "node_modules/micromark-util-sanitize-uri": {
2494 "version": "2.0.1",
2495 "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-2.0.1.tgz",
2496 "integrity": "sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ==",
2497 "funding": [
2498 {
2499 "type": "GitHub Sponsors",
2500 "url": "https://github.com/sponsors/unifiedjs"
2501 },
2502 {
2503 "type": "OpenCollective",
2504 "url": "https://opencollective.com/unified"
2505 }
2506 ],
2507 "license": "MIT",
2508 "dependencies": {
2509 "micromark-util-character": "^2.0.0",
2510 "micromark-util-encode": "^2.0.0",
2511 "micromark-util-symbol": "^2.0.0"
2512 }
2513 },
2514 "node_modules/micromark-util-subtokenize": {
2515 "version": "2.1.0",
2516 "resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-2.1.0.tgz",
2517 "integrity": "sha512-XQLu552iSctvnEcgXw6+Sx75GflAPNED1qx7eBJ+wydBb2KCbRZe+NwvIEEMM83uml1+2WSXpBAcp9IUCgCYWA==",
2518 "funding": [
2519 {
2520 "type": "GitHub Sponsors",
2521 "url": "https://github.com/sponsors/unifiedjs"
2522 },
2523 {
2524 "type": "OpenCollective",
2525 "url": "https://opencollective.com/unified"
2526 }
2527 ],
2528 "license": "MIT",
2529 "dependencies": {
2530 "devlop": "^1.0.0",
2531 "micromark-util-chunked": "^2.0.0",
2532 "micromark-util-symbol": "^2.0.0",
2533 "micromark-util-types": "^2.0.0"
2534 }
2535 },
2536 "node_modules/micromark-util-symbol": {
2537 "version": "2.0.1",
2538 "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.1.tgz",
2539 "integrity": "sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q==",
2540 "funding": [
2541 {
2542 "type": "GitHub Sponsors",
2543 "url": "https://github.com/sponsors/unifiedjs"
2544 },
2545 {
2546 "type": "OpenCollective",
2547 "url": "https://opencollective.com/unified"
2548 }
2549 ],
2550 "license": "MIT"
2551 },
2552 "node_modules/micromark-util-types": {
2553 "version": "2.0.2",
2554 "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-2.0.2.tgz",
2555 "integrity": "sha512-Yw0ECSpJoViF1qTU4DC6NwtC4aWGt1EkzaQB8KPPyCRR8z9TWeV0HbEFGTO+ZY1wB22zmxnJqhPyTpOVCpeHTA==",
2556 "funding": [
2557 {
2558 "type": "GitHub Sponsors",
2559 "url": "https://github.com/sponsors/unifiedjs"
2560 },
2561 {
2562 "type": "OpenCollective",
2563 "url": "https://opencollective.com/unified"
2564 }
2565 ],
2566 "license": "MIT"
2567 },
2568 "node_modules/ms": {
2569 "version": "2.1.3",
2570 "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
2571 "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
2572 "license": "MIT"
2573 },
2574 "node_modules/node-releases": {
2575 "version": "2.0.19",
2576 "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.19.tgz",
2577 "integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==",
2578 "license": "MIT"
2579 },
2580 "node_modules/parse-entities": {
2581 "version": "4.0.2",
2582 "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-4.0.2.tgz",
2583 "integrity": "sha512-GG2AQYWoLgL877gQIKeRPGO1xF9+eG1ujIb5soS5gPvLQ1y2o8FL90w2QWNdf9I361Mpp7726c+lj3U0qK1uGw==",
2584 "license": "MIT",
2585 "dependencies": {
2586 "@types/unist": "^2.0.0",
2587 "character-entities-legacy": "^3.0.0",
2588 "character-reference-invalid": "^2.0.0",
2589 "decode-named-character-reference": "^1.0.0",
2590 "is-alphanumerical": "^2.0.0",
2591 "is-decimal": "^2.0.0",
2592 "is-hexadecimal": "^2.0.0"
2593 },
2594 "funding": {
2595 "type": "github",
2596 "url": "https://github.com/sponsors/wooorm"
2597 }
2598 },
2599 "node_modules/parse-entities/node_modules/@types/unist": {
2600 "version": "2.0.11",
2601 "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.11.tgz",
2602 "integrity": "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==",
2603 "license": "MIT"
2604 },
2605 "node_modules/picocolors": {
2606 "version": "1.1.1",
2607 "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
2608 "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
2609 "license": "ISC"
2610 },
2611 "node_modules/property-information": {
2612 "version": "7.1.0",
2613 "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.1.0.tgz",
2614 "integrity": "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ==",
2615 "license": "MIT",
2616 "funding": {
2617 "type": "github",
2618 "url": "https://github.com/sponsors/wooorm"
2619 }
2620 },
2621 "node_modules/raptor-async": {
2622 "version": "1.1.3",
2623 "resolved": "https://registry.npmjs.org/raptor-async/-/raptor-async-1.1.3.tgz",
2624 "integrity": "sha512-VZCxygWMjW9lKqnApK9D2QbfyzRn7ehiTqnXWwMCLBXANSy+xbnYfbX/5f8YX3bZXu+g+JESmqWPchIQrZj2ig==",
2625 "license": "Apache License v2.0"
2626 },
2627 "node_modules/raptor-regexp": {
2628 "version": "1.0.1",
2629 "resolved": "https://registry.npmjs.org/raptor-regexp/-/raptor-regexp-1.0.1.tgz",
2630 "integrity": "sha512-DqC7ViHJUs3jLIxJI1/HVvCu3yPJaP8CM7PGsHvjimg7yJ3lLOdCBxlPE0G2Q8OJgUA8Pe7nvhm6lcQ3hZepow==",
2631 "license": "Apache License v2.0"
2632 },
2633 "node_modules/raptor-util": {
2634 "version": "3.2.0",
2635 "resolved": "https://registry.npmjs.org/raptor-util/-/raptor-util-3.2.0.tgz",
2636 "integrity": "sha512-uEDMMkBCJvjTqYMBnJNxn+neiS6a0rhybQNA9RaexGor1uvKjwyHA5VcbZMZEuqXhKUWbL+WNS7PhuZVZNB7pw==",
2637 "license": "Apache-2.0"
2638 },
2639 "node_modules/recma-build-jsx": {
2640 "version": "1.0.0",
2641 "resolved": "https://registry.npmjs.org/recma-build-jsx/-/recma-build-jsx-1.0.0.tgz",
2642 "integrity": "sha512-8GtdyqaBcDfva+GUKDr3nev3VpKAhup1+RvkMvUxURHpW7QyIvk9F5wz7Vzo06CEMSilw6uArgRqhpiUcWp8ew==",
2643 "license": "MIT",
2644 "dependencies": {
2645 "@types/estree": "^1.0.0",
2646 "estree-util-build-jsx": "^3.0.0",
2647 "vfile": "^6.0.0"
2648 },
2649 "funding": {
2650 "type": "opencollective",
2651 "url": "https://opencollective.com/unified"
2652 }
2653 },
2654 "node_modules/recma-jsx": {
2655 "version": "1.0.0",
2656 "resolved": "https://registry.npmjs.org/recma-jsx/-/recma-jsx-1.0.0.tgz",
2657 "integrity": "sha512-5vwkv65qWwYxg+Atz95acp8DMu1JDSqdGkA2Of1j6rCreyFUE/gp15fC8MnGEuG1W68UKjM6x6+YTWIh7hZM/Q==",
2658 "license": "MIT",
2659 "dependencies": {
2660 "acorn-jsx": "^5.0.0",
2661 "estree-util-to-js": "^2.0.0",
2662 "recma-parse": "^1.0.0",
2663 "recma-stringify": "^1.0.0",
2664 "unified": "^11.0.0"
2665 },
2666 "funding": {
2667 "type": "opencollective",
2668 "url": "https://opencollective.com/unified"
2669 }
2670 },
2671 "node_modules/recma-parse": {
2672 "version": "1.0.0",
2673 "resolved": "https://registry.npmjs.org/recma-parse/-/recma-parse-1.0.0.tgz",
2674 "integrity": "sha512-OYLsIGBB5Y5wjnSnQW6t3Xg7q3fQ7FWbw/vcXtORTnyaSFscOtABg+7Pnz6YZ6c27fG1/aN8CjfwoUEUIdwqWQ==",
2675 "license": "MIT",
2676 "dependencies": {
2677 "@types/estree": "^1.0.0",
2678 "esast-util-from-js": "^2.0.0",
2679 "unified": "^11.0.0",
2680 "vfile": "^6.0.0"
2681 },
2682 "funding": {
2683 "type": "opencollective",
2684 "url": "https://opencollective.com/unified"
2685 }
2686 },
2687 "node_modules/recma-stringify": {
2688 "version": "1.0.0",
2689 "resolved": "https://registry.npmjs.org/recma-stringify/-/recma-stringify-1.0.0.tgz",
2690 "integrity": "sha512-cjwII1MdIIVloKvC9ErQ+OgAtwHBmcZ0Bg4ciz78FtbT8In39aAYbaA7zvxQ61xVMSPE8WxhLwLbhif4Js2C+g==",
2691 "license": "MIT",
2692 "dependencies": {
2693 "@types/estree": "^1.0.0",
2694 "estree-util-to-js": "^2.0.0",
2695 "unified": "^11.0.0",
2696 "vfile": "^6.0.0"
2697 },
2698 "funding": {
2699 "type": "opencollective",
2700 "url": "https://opencollective.com/unified"
2701 }
2702 },
2703 "node_modules/rehype-recma": {
2704 "version": "1.0.0",
2705 "resolved": "https://registry.npmjs.org/rehype-recma/-/rehype-recma-1.0.0.tgz",
2706 "integrity": "sha512-lqA4rGUf1JmacCNWWZx0Wv1dHqMwxzsDWYMTowuplHF3xH0N/MmrZ/G3BDZnzAkRmxDadujCjaKM2hqYdCBOGw==",
2707 "license": "MIT",
2708 "dependencies": {
2709 "@types/estree": "^1.0.0",
2710 "@types/hast": "^3.0.0",
2711 "hast-util-to-estree": "^3.0.0"
2712 },
2713 "funding": {
2714 "type": "opencollective",
2715 "url": "https://opencollective.com/unified"
2716 }
2717 },
2718 "node_modules/relative-import-path": {
2719 "version": "1.0.0",
2720 "resolved": "https://registry.npmjs.org/relative-import-path/-/relative-import-path-1.0.0.tgz",
2721 "integrity": "sha512-ZvbtoduKQmD4PZeJPfH6Ql21qUWhaMxiHkIsH+FUnZqKDwNIXBtGg5zRZyHWomiGYk8n5+KMBPK7Mi4D0XWfNg==",
2722 "license": "MIT"
2723 },
2724 "node_modules/remark-mdx": {
2725 "version": "3.1.0",
2726 "resolved": "https://registry.npmjs.org/remark-mdx/-/remark-mdx-3.1.0.tgz",
2727 "integrity": "sha512-Ngl/H3YXyBV9RcRNdlYsZujAmhsxwzxpDzpDEhFBVAGthS4GDgnctpDjgFl/ULx5UEDzqtW1cyBSNKqYYrqLBA==",
2728 "license": "MIT",
2729 "dependencies": {
2730 "mdast-util-mdx": "^3.0.0",
2731 "micromark-extension-mdxjs": "^3.0.0"
2732 },
2733 "funding": {
2734 "type": "opencollective",
2735 "url": "https://opencollective.com/unified"
2736 }
2737 },
2738 "node_modules/remark-parse": {
2739 "version": "11.0.0",
2740 "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-11.0.0.tgz",
2741 "integrity": "sha512-FCxlKLNGknS5ba/1lmpYijMUzX2esxW5xQqjWxw2eHFfS2MSdaHVINFmhjo+qN1WhZhNimq0dZATN9pH0IDrpA==",
2742 "license": "MIT",
2743 "dependencies": {
2744 "@types/mdast": "^4.0.0",
2745 "mdast-util-from-markdown": "^2.0.0",
2746 "micromark-util-types": "^2.0.0",
2747 "unified": "^11.0.0"
2748 },
2749 "funding": {
2750 "type": "opencollective",
2751 "url": "https://opencollective.com/unified"
2752 }
2753 },
2754 "node_modules/remark-rehype": {
2755 "version": "11.1.2",
2756 "resolved": "https://registry.npmjs.org/remark-rehype/-/remark-rehype-11.1.2.tgz",
2757 "integrity": "sha512-Dh7l57ianaEoIpzbp0PC9UKAdCSVklD8E5Rpw7ETfbTl3FqcOOgq5q2LVDhgGCkaBv7p24JXikPdvhhmHvKMsw==",
2758 "license": "MIT",
2759 "dependencies": {
2760 "@types/hast": "^3.0.0",
2761 "@types/mdast": "^4.0.0",
2762 "mdast-util-to-hast": "^13.0.0",
2763 "unified": "^11.0.0",
2764 "vfile": "^6.0.0"
2765 },
2766 "funding": {
2767 "type": "opencollective",
2768 "url": "https://opencollective.com/unified"
2769 }
2770 },
2771 "node_modules/resolve-from": {
2772 "version": "5.0.0",
2773 "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz",
2774 "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==",
2775 "license": "MIT",
2776 "engines": {
2777 "node": ">=8"
2778 }
2779 },
2780 "node_modules/self-closing-tags": {
2781 "version": "1.0.1",
2782 "resolved": "https://registry.npmjs.org/self-closing-tags/-/self-closing-tags-1.0.1.tgz",
2783 "integrity": "sha512-7t6hNbYMxM+VHXTgJmxwgZgLGktuXtVVD5AivWzNTdJBM4DBjnDKDzkf2SrNjihaArpeJYNjxkELBu1evI4lQA==",
2784 "license": "MIT",
2785 "engines": {
2786 "node": ">=0.12.0"
2787 }
2788 },
2789 "node_modules/semver": {
2790 "version": "6.3.1",
2791 "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
2792 "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
2793 "license": "ISC",
2794 "bin": {
2795 "semver": "bin/semver.js"
2796 }
2797 },
2798 "node_modules/source-map": {
2799 "version": "0.7.4",
2800 "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz",
2801 "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==",
2802 "license": "BSD-3-Clause",
2803 "engines": {
2804 "node": ">= 8"
2805 }
2806 },
2807 "node_modules/source-map-support": {
2808 "version": "0.5.21",
2809 "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz",
2810 "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==",
2811 "license": "MIT",
2812 "dependencies": {
2813 "buffer-from": "^1.0.0",
2814 "source-map": "^0.6.0"
2815 }
2816 },
2817 "node_modules/source-map-support/node_modules/source-map": {
2818 "version": "0.6.1",
2819 "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
2820 "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
2821 "license": "BSD-3-Clause",
2822 "engines": {
2823 "node": ">=0.10.0"
2824 }
2825 },
2826 "node_modules/space-separated-tokens": {
2827 "version": "2.0.2",
2828 "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz",
2829 "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==",
2830 "license": "MIT",
2831 "funding": {
2832 "type": "github",
2833 "url": "https://github.com/sponsors/wooorm"
2834 }
2835 },
2836 "node_modules/stackframe": {
2837 "version": "1.3.4",
2838 "resolved": "https://registry.npmjs.org/stackframe/-/stackframe-1.3.4.tgz",
2839 "integrity": "sha512-oeVtt7eWQS+Na6F//S4kJ2K2VbRlS9D43mAlMyVpVWovy9o+jfgH8O9agzANzaiLjclA0oYzUXEM4PurhSUChw==",
2840 "license": "MIT"
2841 },
2842 "node_modules/stringify-entities": {
2843 "version": "4.0.4",
2844 "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz",
2845 "integrity": "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==",
2846 "license": "MIT",
2847 "dependencies": {
2848 "character-entities-html4": "^2.0.0",
2849 "character-entities-legacy": "^3.0.0"
2850 },
2851 "funding": {
2852 "type": "github",
2853 "url": "https://github.com/sponsors/wooorm"
2854 }
2855 },
2856 "node_modules/strip-ansi": {
2857 "version": "7.1.0",
2858 "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz",
2859 "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==",
2860 "license": "MIT",
2861 "dependencies": {
2862 "ansi-regex": "^6.0.1"
2863 },
2864 "engines": {
2865 "node": ">=12"
2866 },
2867 "funding": {
2868 "url": "https://github.com/chalk/strip-ansi?sponsor=1"
2869 }
2870 },
2871 "node_modules/style-to-js": {
2872 "version": "1.1.16",
2873 "resolved": "https://registry.npmjs.org/style-to-js/-/style-to-js-1.1.16.tgz",
2874 "integrity": "sha512-/Q6ld50hKYPH3d/r6nr117TZkHR0w0kGGIVfpG9N6D8NymRPM9RqCUv4pRpJ62E5DqOYx2AFpbZMyCPnjQCnOw==",
2875 "license": "MIT",
2876 "dependencies": {
2877 "style-to-object": "1.0.8"
2878 }
2879 },
2880 "node_modules/style-to-object": {
2881 "version": "1.0.8",
2882 "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-1.0.8.tgz",
2883 "integrity": "sha512-xT47I/Eo0rwJmaXC4oilDGDWLohVhR6o/xAQcPQN8q6QBuZVL8qMYL85kLmST5cPjAorwvqIA4qXTRQoYHaL6g==",
2884 "license": "MIT",
2885 "dependencies": {
2886 "inline-style-parser": "0.2.4"
2887 }
2888 },
2889 "node_modules/trim-lines": {
2890 "version": "3.0.1",
2891 "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz",
2892 "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==",
2893 "license": "MIT",
2894 "funding": {
2895 "type": "github",
2896 "url": "https://github.com/sponsors/wooorm"
2897 }
2898 },
2899 "node_modules/trough": {
2900 "version": "2.2.0",
2901 "resolved": "https://registry.npmjs.org/trough/-/trough-2.2.0.tgz",
2902 "integrity": "sha512-tmMpK00BjZiUyVyvrBK7knerNgmgvcV/KLVyuma/SC+TQN167GrMRciANTz09+k3zW8L8t60jWO1GpfkZdjTaw==",
2903 "license": "MIT",
2904 "funding": {
2905 "type": "github",
2906 "url": "https://github.com/sponsors/wooorm"
2907 }
2908 },
2909 "node_modules/typescript": {
2910 "version": "5.8.3",
2911 "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz",
2912 "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==",
2913 "dev": true,
2914 "license": "Apache-2.0",
2915 "bin": {
2916 "tsc": "bin/tsc",
2917 "tsserver": "bin/tsserver"
2918 },
2919 "engines": {
2920 "node": ">=14.17"
2921 }
2922 },
2923 "node_modules/undici-types": {
2924 "version": "6.21.0",
2925 "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
2926 "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
2927 "dev": true,
2928 "license": "MIT"
2929 },
2930 "node_modules/unified": {
2931 "version": "11.0.5",
2932 "resolved": "https://registry.npmjs.org/unified/-/unified-11.0.5.tgz",
2933 "integrity": "sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==",
2934 "license": "MIT",
2935 "dependencies": {
2936 "@types/unist": "^3.0.0",
2937 "bail": "^2.0.0",
2938 "devlop": "^1.0.0",
2939 "extend": "^3.0.0",
2940 "is-plain-obj": "^4.0.0",
2941 "trough": "^2.0.0",
2942 "vfile": "^6.0.0"
2943 },
2944 "funding": {
2945 "type": "opencollective",
2946 "url": "https://opencollective.com/unified"
2947 }
2948 },
2949 "node_modules/unist-util-is": {
2950 "version": "6.0.0",
2951 "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.0.tgz",
2952 "integrity": "sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw==",
2953 "license": "MIT",
2954 "dependencies": {
2955 "@types/unist": "^3.0.0"
2956 },
2957 "funding": {
2958 "type": "opencollective",
2959 "url": "https://opencollective.com/unified"
2960 }
2961 },
2962 "node_modules/unist-util-position": {
2963 "version": "5.0.0",
2964 "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-5.0.0.tgz",
2965 "integrity": "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==",
2966 "license": "MIT",
2967 "dependencies": {
2968 "@types/unist": "^3.0.0"
2969 },
2970 "funding": {
2971 "type": "opencollective",
2972 "url": "https://opencollective.com/unified"
2973 }
2974 },
2975 "node_modules/unist-util-position-from-estree": {
2976 "version": "2.0.0",
2977 "resolved": "https://registry.npmjs.org/unist-util-position-from-estree/-/unist-util-position-from-estree-2.0.0.tgz",
2978 "integrity": "sha512-KaFVRjoqLyF6YXCbVLNad/eS4+OfPQQn2yOd7zF/h5T/CSL2v8NpN6a5TPvtbXthAGw5nG+PuTtq+DdIZr+cRQ==",
2979 "license": "MIT",
2980 "dependencies": {
2981 "@types/unist": "^3.0.0"
2982 },
2983 "funding": {
2984 "type": "opencollective",
2985 "url": "https://opencollective.com/unified"
2986 }
2987 },
2988 "node_modules/unist-util-stringify-position": {
2989 "version": "4.0.0",
2990 "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-4.0.0.tgz",
2991 "integrity": "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==",
2992 "license": "MIT",
2993 "dependencies": {
2994 "@types/unist": "^3.0.0"
2995 },
2996 "funding": {
2997 "type": "opencollective",
2998 "url": "https://opencollective.com/unified"
2999 }
3000 },
3001 "node_modules/unist-util-visit": {
3002 "version": "5.0.0",
3003 "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-5.0.0.tgz",
3004 "integrity": "sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==",
3005 "license": "MIT",
3006 "dependencies": {
3007 "@types/unist": "^3.0.0",
3008 "unist-util-is": "^6.0.0",
3009 "unist-util-visit-parents": "^6.0.0"
3010 },
3011 "funding": {
3012 "type": "opencollective",
3013 "url": "https://opencollective.com/unified"
3014 }
3015 },
3016 "node_modules/unist-util-visit-parents": {
3017 "version": "6.0.1",
3018 "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-6.0.1.tgz",
3019 "integrity": "sha512-L/PqWzfTP9lzzEa6CKs0k2nARxTdZduw3zyh8d2NVBnsyvHjSX4TWse388YrrQKbvI8w20fGjGlhgT96WwKykw==",
3020 "license": "MIT",
3021 "dependencies": {
3022 "@types/unist": "^3.0.0",
3023 "unist-util-is": "^6.0.0"
3024 },
3025 "funding": {
3026 "type": "opencollective",
3027 "url": "https://opencollective.com/unified"
3028 }
3029 },
3030 "node_modules/update-browserslist-db": {
3031 "version": "1.1.3",
3032 "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.3.tgz",
3033 "integrity": "sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw==",
3034 "funding": [
3035 {
3036 "type": "opencollective",
3037 "url": "https://opencollective.com/browserslist"
3038 },
3039 {
3040 "type": "tidelift",
3041 "url": "https://tidelift.com/funding/github/npm/browserslist"
3042 },
3043 {
3044 "type": "github",
3045 "url": "https://github.com/sponsors/ai"
3046 }
3047 ],
3048 "license": "MIT",
3049 "dependencies": {
3050 "escalade": "^3.2.0",
3051 "picocolors": "^1.1.1"
3052 },
3053 "bin": {
3054 "update-browserslist-db": "cli.js"
3055 },
3056 "peerDependencies": {
3057 "browserslist": ">= 4.21.0"
3058 }
3059 },
3060 "node_modules/vfile": {
3061 "version": "6.0.3",
3062 "resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz",
3063 "integrity": "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==",
3064 "license": "MIT",
3065 "dependencies": {
3066 "@types/unist": "^3.0.0",
3067 "vfile-message": "^4.0.0"
3068 },
3069 "funding": {
3070 "type": "opencollective",
3071 "url": "https://opencollective.com/unified"
3072 }
3073 },
3074 "node_modules/vfile-message": {
3075 "version": "4.0.2",
3076 "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-4.0.2.tgz",
3077 "integrity": "sha512-jRDZ1IMLttGj41KcZvlrYAaI3CfqpLpfpf+Mfig13viT6NKvRzWZ+lXz0Y5D60w6uJIBAOGq9mSHf0gktF0duw==",
3078 "license": "MIT",
3079 "dependencies": {
3080 "@types/unist": "^3.0.0",
3081 "unist-util-stringify-position": "^4.0.0"
3082 },
3083 "funding": {
3084 "type": "opencollective",
3085 "url": "https://opencollective.com/unified"
3086 }
3087 },
3088 "node_modules/yallist": {
3089 "version": "3.1.1",
3090 "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
3091 "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
3092 "license": "ISC"
3093 },
3094 "node_modules/zwitch": {
3095 "version": "2.0.4",
3096 "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz",
3097 "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==",
3098 "license": "MIT",
3099 "funding": {
3100 "type": "github",
3101 "url": "https://github.com/sponsors/wooorm"
773102 }
783103 }
793104 }
80 return result + buffer + (isInsideComment ? _strip(jsonString.slice(offset)) : jsonString.slice(offset));
813105}
repl.js+1-11
......@@ -1,11 +1 @@
1// default
2(node, parent, grandparent) => {
3 switch (parent.type) {
4 case "MarkoTag":
5 return parent.var !== node;
6 case "MarkoTagBody":
7 return false;
8 default:
9 return originalIsReferenced(node, parent, grandparent);
10 }
11}
1// RIP
src/file-viewer/backend.tsx deleted-29
......@@ -1,29 +0,0 @@
1// default
2function transpileNamespace(path, allowNamespaces) {
3 if (path.node.declare || path.node.id.type === "StringLiteral") {
4 path.remove();
5 return;
6 }
7 if (!allowNamespaces) {
8 throw path.get("id").buildCodeFrameError("Namespace not marked type-only declare." + " Non-declarative namespaces are only supported experimentally in Babel." + " To enable and review caveats see:" + " https://babeljs.io/docs/en/babel-plugin-transform-typescript");
9 }
10 const name = getFirstIdentifier(path.node.id).name;
11 const value = handleNested(path, path.node);
12 if (value === null) {
13 const program = path.findParent(p => p.isProgram());
14 (0, _globalTypes.registerGlobalType)(program.scope, name);
15 path.remove();
16 } else if (path.scope.hasOwnBinding(name)) {
17 path.replaceWith(value);
18 } else {
19 path.scope.registerDeclaration(path.replaceWithMultiple([getDeclaration(name), value])[0]);
20 }
21}
22
23// getFirstIdentifier
24function getFirstIdentifier(node) {
25 if (_core.types.isIdentifier(node)) {
26 return node;
27 }
28 return getFirstIdentifier(node.left);
29}
src/file-viewer/cache.ts deleted-36
......@@ -1,36 +0,0 @@
1// beginHiddenCallStack
2function beginHiddenCallStack(fn) {
3 if (!SUPPORTED) return fn;
4 return Object.defineProperty(function (...args) {
5 setupPrepareStackTrace();
6 return fn(...args);
7 }, "name", {
8 value: STOP_HIDING
9 });
10}
11
12// endHiddenCallStack
13function endHiddenCallStack(fn) {
14 if (!SUPPORTED) return fn;
15 return Object.defineProperty(function (...args) {
16 return fn(...args);
17 }, "name", {
18 value: START_HIDING
19 });
20}
21
22// expectedError
23function expectedError(error) {
24 if (!SUPPORTED) return;
25 expectedErrors.add(error);
26 return error;
27}
28
29// injectVirtualStackFrame
30function injectVirtualStackFrame(error, filename) {
31 if (!SUPPORTED) return;
32 let frames = virtualFrames.get(error);
33 if (!frames) virtualFrames.set(error, frames = []);
34 frames.push(CallSite(filename));
35 return error;
36}
src/file-viewer/cert.pem deleted-91
......@@ -1,91 +0,0 @@
1// default
2function* loadPrivatePartialConfig(inputOpts) {
3 if (inputOpts != null && (typeof inputOpts !== "object" || Array.isArray(inputOpts))) {
4 throw new Error("Babel options must be an object, null, or undefined");
5 }
6 const args = inputOpts ? (0, _options.validate)("arguments", inputOpts) : {};
7 const {
8 envName = (0, _environment.getEnv)(),
9 cwd = ".",
10 root: rootDir = ".",
11 rootMode = "root",
12 caller,
13 cloneInputAst = true
14 } = args;
15 const absoluteCwd = _path().resolve(cwd);
16 const absoluteRootDir = resolveRootMode(_path().resolve(absoluteCwd, rootDir), rootMode);
17 const filename = typeof args.filename === "string" ? _path().resolve(cwd, args.filename) : undefined;
18 const showConfigPath = yield* (0, _index.resolveShowConfigPath)(absoluteCwd);
19 const context = {
20 filename,
21 cwd: absoluteCwd,
22 root: absoluteRootDir,
23 envName,
24 caller,
25 showConfig: showConfigPath === filename
26 };
27 const configChain = yield* (0, _configChain.buildRootChain)(args, context);
28 if (!configChain) return null;
29 const merged = {
30 assumptions: {}
31 };
32 configChain.options.forEach(opts => {
33 (0, _util.mergeOptions)(merged, opts);
34 });
35 const options = Object.assign({}, merged, {
36 targets: (0, _resolveTargets.resolveTargets)(merged, absoluteRootDir),
37 cloneInputAst,
38 babelrc: false,
39 configFile: false,
40 browserslistConfigFile: false,
41 passPerPreset: false,
42 envName: context.envName,
43 cwd: context.cwd,
44 root: context.root,
45 rootMode: "root",
46 filename: typeof context.filename === "string" ? context.filename : undefined,
47 plugins: configChain.plugins.map(descriptor => (0, _item.createItemFromDescriptor)(descriptor)),
48 presets: configChain.presets.map(descriptor => (0, _item.createItemFromDescriptor)(descriptor))
49 });
50 return {
51 options,
52 context,
53 fileHandling: configChain.fileHandling,
54 ignore: configChain.ignore,
55 babelrc: configChain.babelrc,
56 config: configChain.config,
57 files: configChain.files
58 };
59}
60
61// loadPartialConfig
62function* loadPartialConfig(opts) {
63 let showIgnoredFiles = false;
64 if (typeof opts === "object" && opts !== null && !Array.isArray(opts)) {
65 var _opts = opts;
66 ({
67 showIgnoredFiles
68 } = _opts);
69 opts = _objectWithoutPropertiesLoose(_opts, _excluded);
70 _opts;
71 }
72 const result = yield* loadPrivatePartialConfig(opts);
73 if (!result) return null;
74 const {
75 options,
76 babelrc,
77 ignore,
78 config,
79 fileHandling,
80 files
81 } = result;
82 if (fileHandling === "ignored" && !showIgnoredFiles) {
83 return null;
84 }
85 (options.plugins || []).forEach(item => {
86 if (item.value instanceof _plugin.default) {
87 throw new Error("Passing cached plugin instances is not supported in " + "babel.loadPartialConfig()");
88 }
89 });
90 return new PartialConfig(options, babelrc ? babelrc.filepath : undefined, ignore ? ignore.filepath : undefined, config ? config.filepath : undefined, fileHandling, files);
91}
src/file-viewer/cotyledon.tsx deleted-291
......@@ -1,291 +0,0 @@
1export function Speedbump() {
2 return (
3 <div class="panel last">
4 <div className="header">
5 an interlude
6 </div>
7 <div className="content file-view file-view-text speedbump">
8 <canvas
9 style="linear-gradient(45deg, #111318, #181f20)"
10 data-canvas="cotyledon"
11 >
12 </canvas>
13 <header>
14 <h1>cotyledon</h1>
15 </header>
16 <div id="captcha" style="display: none;">
17 <p style="max-width:480px">
18 please prove you're not a robot by selecting all of the images with
19 four-leaf clovers, until there are only regular clovers.
20 <noscript>
21 this will require javascript enabled on your computer to verify
22 the mouse clicks.
23 </noscript>
24 </p>
25 <div className="enter-container">
26 <div className="image-grid">
27 <button>
28 <img src="/captcha/image/1.jpeg" alt="a four-leaf clover" />
29 </button>
30 <button>
31 <img src="/captcha/image/2.jpeg" alt="a four-leaf clover" />
32 </button>
33 <button>
34 <img src="/captcha/image/3.jpeg" alt="a four-leaf clover" />
35 </button>
36 <button>
37 <img src="/captcha/image/4.jpeg" alt="a four-leaf clover" />
38 </button>
39 <button>
40 <img src="/captcha/image/5.jpeg" alt="a four-leaf clover" />
41 </button>
42 <button>
43 <img src="/captcha/image/6.jpeg" alt="a four-leaf clover" />
44 </button>
45 <button>
46 <img src="/captcha/image/7.jpeg" alt="a four-leaf clover" />
47 </button>
48 <button>
49 <img src="/captcha/image/8.jpeg" alt="a four-leaf clover" />
50 </button>
51 <button>
52 <img src="/captcha/image/9.jpeg" alt="a four-leaf clover" />
53 </button>
54 </div>
55 </div>
56 <div class="enter-container">
57 <button id="enter2">all done</button>
58 </div>
59 </div>
60 <div id="first">
61 <p>
62 this place is sacred, but dangerous. i have to keep visitors to an
63 absolute minimum; you'll get dust on all the artifacts.
64 </p>
65 <p>
66 by entering our museum, you agree not to use your camera. flash off
67 isn't enough; the bits and bytes are alergic even to a camera's
68 sensor
69 </p>
70 <p style="font-size:0.9rem;">
71 (in english: please do not store downloads after you're done viewing
72 them)
73 </p>
74 <div class="enter-container">
75 <button id="enter">break my boundaries</button>
76 </div>
77 </div>
78 </div>
79 </div>
80 );
81}
82
83export function Readme() {
84 return (
85 <div class="panel last">
86 <div className="header">
87 cotyledon
88 </div>
89 <div className="content file-view file-view-text">
90 <div style="max-width: 71ch;padding:3rem;font-family:rmo,monospace">
91 <p style="margin-top:0">
92 welcome to the archive. if this is your first time here, i recommend
93 starting in '<a href="/file/2017">2017</a>' and going
94 chronologically from there. however, there is truly no wrong way to
95 explore.
96 </p>
97 <p>
98 note that there is a blanket trigger warning for everything in this
99 archive: while there is nothing visually offensive, some portions of
100 the text and emotions conveyed through this may hit extremely hard.
101 you are warned.
102 </p>
103 <p>
104 all file dates are real. at least as real as i could figure out.
105 when i moved data across drives over my years, i accidentally had a
106 few points where i stamped over all the dates with the day that
107 moved the files. even fucked it up a final time in february 2025,
108 while in the process of unfucking things.
109 </p>
110 <p>
111 thankfully, my past self knew i'd want to assemble this kind of
112 site, and because of that they were crazy about storing the dates of
113 things inside of html, json/yaml files, and even in fucking
114 databases. i'm glad it was all stored though, but jeez what a nerd.
115 </p>
116 <p>
117 a few files were touched up for privacy, or otherwise re-encoded.
118 some of them i added extra metadata.
119 </p>
120 <p>
121 from the bottom of my heart: i hope you enjoy. it has been a
122 nightmare putting this all together. technically and emotionally
123 speaking. i'm glad we can put this all behind us, mark it as
124 completed, and get started with the good shit.
125 </p>
126 <p>
127 love,<br />clo
128 </p>
129 <br />
130 <p>
131 start here -&gt; <a href="/file/2017">2017</a>
132 </p>
133 </div>
134 </div>
135 </div>
136 );
137}
138
139export function ForEveryone() {
140 // deno-fmt-ignore
141 return <><div class="for_everyone">
142<p>today is my 21st birthday. april 30th, 2025.</p>
143<p>it's been nearly six months starting hormones.</p>
144<p>sometimes i feel great,</p>
145<p>sometimes i get dysphoria.</p>
146<p>with the walls around me gone</p>
147<p>that shit hits way harder than it did before.</p>
148<p>ugh..</p>
149<p>i'm glad the pain i felt is now explained,</p>
150<p>but now rendered in high definition.</p>
151<p>the smallest strands of hair on my face and belly act</p>
152<p>as sharpened nails to pierce my soul.</p>
153<p></p>
154<p>it's all a pathway to better days; the sun had risen.</p>
155<p>one little step at a time for both of us.</p>
156<p>today i quit my job. free falling, it feels so weird.</p>
157<p>like sky diving.</p>
158<p>the only thing i feel is cold wind.</p>
159<p>the only thing i see is everything,</p>
160<p>and it's beautiful.</p>
161<p>i have a month of falling before the parachute activates,</p>
162<p>gonna spend as much time of it on art as i can.</p>
163<p>that was, after all, my life plan:</p>
164<p>i wanted to make art, all the time,</p>
165<p>for everyone.</p>
166<p></p>
167<p>then you see what happened</p>
168<p>to the world and the internet.</p>
169<p>i never really got to live through that golden age,</p>
170<p>it probably sucked back then too.</p>
171<p>but now the big sites definitely stopped being fun.</p>
172<p>they slide their cold hands up my body</p>
173<p>and feel me around. it's unwelcoming, and</p>
174<p>inconsiderate to how sensitive my skin is.</p>
175<p>i'm so fucking glad i broke up with YouTube</p>
176<p>and their devilish friends.</p>
177<p>my NAS is at 5 / 24 TB</p>
178<p>and probably wont fill for the next decade.</p>
179<p></p>
180<p>it took 2 months for me to notice my body changed.</p>
181<p>that day was really nice, but it hurt a lot.</p>
182<p>a sharp, satisfying pain in my chest gave me life.</p>
183<p>learned new instincts for my arms</p>
184<p>so they'd stop poking my new shape.</p>
185<p>when i look at my face</p>
186<p>it's like a different person.</p>
187<p>she was the same as before, but completely new.</p>
188<p>something changed</p>
189<p>or i'm now used to seeing what makes me smile.</p>
190<p>regardless, whatever i see in the mirror, i smile.</p>
191<p>and, i don't hear that old name much anymore</p>
192<p>aside from nightmares. and you'll never repeat it, ok?</p>
193<p>okay.</p>
194<p></p>
195<p>been playing 'new canaan' by 'bill wurtz' on loop</p>
196<p>in the background.</p>
197<p>it kinda just feels right.</p>
198<p>especially when that verse near the end comes on.</p>
199<p></p>
200<p>more people have been allowed to visit me.</p>
201<p>my apartment used to be just for me,</p>
202<p>but the more i felt like a person</p>
203<p>the more i felt like having others over.</p>
204<p>still have to decorate and clean it a little,</p>
205<p>but it isn't a job to do alone.</p>
206<p>we dragged a giant a rug across the city one day,</p>
207<p>and it felt was like anything was possible.</p>
208<p>sometimes i have ten people visit in a day,</p>
209<p>or sometimes i focus my little eyes on just one.</p>
210<p>i never really know what i want to do</p>
211<p>until the time actually comes.</p>
212<p></p>
213{/* FILIP */}
214<p>i think about the times i was by the water with you.</p>
215<p>the sun setting warmly, icy air fell on our shoulders.</p>
216{/* NATALIE */}
217<p>and how we walked up to the top of that hill,</p>
218<p>you picked up and disposed a nail on the ground,</p>
219<p>walking the city thru places i've never been.</p>
220{/* BEN */}
221<p>or hiking through the park talking about compilers,</p>
222<p>tiring me out until i'd fall asleep in your arms.</p>
223{/* ELENA */}
224<p>and the way you held on to my hand as i woke up,</p>
225<p>noticing how i was trying to hide nightmare's tears.</p>
226<p></p>
227{/* HIGH SCHOOL */}
228<p>i remember we were yelling lyrics loudly,</p>
229<p>out of key yet cheered on because it was fun.</p>
230{/* ADVAITH/NATALIE */}
231<p>and when we all toured the big corporate office,</p>
232{/* AYU/HARRIS */}
233<p>then snuck in to some startup's office after hours;</p>
234<p>i don't remember what movie we watched.</p>
235{/* COLLEGE, DAY 1 IN EV's ROOM */}
236<p>i remember laying on the bunk bed,</p>
237<p>while the rest played a card game.</p>
238{/* MEGHAN/MORE */}
239<p>with us all laying on the rug, staring at the TV</p>
240<p>as the ending twist to that show was revealed.</p>
241<p></p>
242<p>all the moments i cherish,</p>
243<p>i love because it was always me.</p>
244<p>i didn't have to pretend,</p>
245<p>even if i didn't know who i was at the time.</p>
246<p>you all were there. for me.</p>
247<p></p>
248<p>i don't want to pretend any more</p>
249<p>i want to be myself. for everyone.</p>
250<p></p>
251<p>oh, the song ended. i thought it was on loop?</p>
252<p>it's late... can hear the crickets...</p>
253<p>and i can almost see the moon... mmmm...</p>
254<p>...nah, too much light pollution.</p>
255<p></p>
256<p>one day. one day.</p>
257<p></p>
258<p class="normal">before i go, i want to show the uncensored version of "journal about a girl", because i can trust you at least. keep in mind, i think you're one of the first people to ever see this.</p>
259</div>
260<div class="for_everyone" style="max-width:80ch;">
261<blockquote>
262<p>journal - 2024-09-14</p>
263<p>been at HackMIT today on behalf of the company. it's fun. me and zack were running around looking for people that might be good hires. he had this magic arbitrary criteria to tell "oh this person is probably cracked let's talk to them" and we go to the first one. they were a nerd, perfect. they seemed to be extremely talented with some extreme software projects.<br/>
264okay.. oof... its still clouding my mind<br/>
265i cant shake that feeling away</p>
266<p>hold on...</p>
267<p>at some point they open one of their profiles to navigate to some code, and it displays for a couple of seconds: "pronouns: she/they". i don't actually know anything about this person, but it was my perception that she is trans. their appearance, physique, and age felt similar to me, which tends makes people think you are male.</p>
268<p>but... she was having fun being herself. being a legend of identity and of her skill in computer science. winning the physics major. making cool shit at the hackathon, and probably in life. my perception of her was the exact essence of who i myself wanted to be. i was jealous of her life.</p>
269<p>i tried hard to avoid a breakdown. success. but i was feeling distant. the next hour or so was disorienting, trying not to think about it too hard. i think there was one possibly interesting person we talked to. i don't remember any of the other conversations. they were not important. but i couldn't think through them regardless.</p>
270<p>later, i decided to read some of her code. i either have a huge dislike towards the Rust programming language and/or it was not high quality code. welp, so just is a person studying. my perception was just a perception, inaccurate but impacting. i know i need to become myself, whoever that is. otherwise, i'm just going to feel this shit at higher doses. i think about this every day, and the amount of time i feel being consumed by these problems only grows.</p>
271<p>getting through it all is a lonely feeling. not because no one is around, but because i am isolated emotionally. i know other people hit these feelings, but we all are too afraid to speak up, and it's all lonely.</p>
272<p>waiting on a reply from someone from healthcare. it'll be slow, but it will be okay.</p>
273</blockquote>
274</div>
275<div class="for_everyone">
276<p class="normal">
277i've learned that even when i feel alone, it doesn't have to feel lonely. i know it's hard, dear. i know it's scary. but i promise it's possible. we're all in this together. struggling together. sacrificing together. we dedicate our lives to each you, and our art for everyone.
278</p>
279
280<p class="normal" style="font-size:2rem;color:#9C91FF;font-family:times,serif;font-style:italic">
281 and then we knew,<br/>
282 just like paper airplanes: that we could fly...
283</p>
284<br />
285<p class="normal">
286 <a href="/" style='text-decoration:underline;text-underline-offset:0.2em;'>fin.</a>
287</p>
288</div>
289</>
290}
291ForEveryone.class = "text";
src/file-viewer/extension-stats.ts deleted-40
......@@ -1,40 +0,0 @@
1// run
2function* run(config, code, ast) {
3 const file = yield* (0, _normalizeFile.default)(config.passes, (0, _normalizeOpts.default)(config), code, ast);
4 const opts = file.opts;
5 try {
6 yield* transformFile(file, config.passes);
7 } catch (e) {
8 var _opts$filename;
9 e.message = `${(_opts$filename = opts.filename) != null ? _opts$filename : "unknown file"}: ${e.message}`;
10 if (!e.code) {
11 e.code = "BABEL_TRANSFORM_ERROR";
12 }
13 throw e;
14 }
15 let outputCode, outputMap;
16 try {
17 if (opts.code !== false) {
18 ({
19 outputCode,
20 outputMap
21 } = (0, _generate.default)(config.passes, file));
22 }
23 } catch (e) {
24 var _opts$filename2;
25 e.message = `${(_opts$filename2 = opts.filename) != null ? _opts$filename2 : "unknown file"}: ${e.message}`;
26 if (!e.code) {
27 e.code = "BABEL_GENERATE_ERROR";
28 }
29 throw e;
30 }
31 return {
32 metadata: file.metadata,
33 options: opts,
34 ast: opts.ast === true ? file.ast : null,
35 code: outputCode === undefined ? null : outputCode,
36 map: outputMap === undefined ? null : outputMap,
37 sourceType: file.ast.program.sourceType,
38 externalDependencies: (0, _deepArray.flattenToSet)(config.externalDependencies)
39 };
40}
src/file-viewer/highlight-grammar/astro.plist deleted-44
......@@ -1,44 +0,0 @@
1// default
2function normalizeOptions(config) {
3 const {
4 filename,
5 cwd,
6 filenameRelative = typeof filename === "string" ? _path().relative(cwd, filename) : "unknown",
7 sourceType = "module",
8 inputSourceMap,
9 sourceMaps = !!inputSourceMap,
10 sourceRoot = config.options.moduleRoot,
11 sourceFileName = _path().basename(filenameRelative),
12 comments = true,
13 compact = "auto"
14 } = config.options;
15 const opts = config.options;
16 const options = Object.assign({}, opts, {
17 parserOpts: Object.assign({
18 sourceType: _path().extname(filenameRelative) === ".mjs" ? "module" : sourceType,
19 sourceFileName: filename,
20 plugins: []
21 }, opts.parserOpts),
22 generatorOpts: Object.assign({
23 filename,
24 auxiliaryCommentBefore: opts.auxiliaryCommentBefore,
25 auxiliaryCommentAfter: opts.auxiliaryCommentAfter,
26 retainLines: opts.retainLines,
27 comments,
28 shouldPrintComment: opts.shouldPrintComment,
29 compact,
30 minified: opts.minified,
31 sourceMaps,
32 sourceRoot,
33 sourceFileName
34 }, opts.generatorOpts)
35 });
36 for (const plugins of config.passes) {
37 for (const plugin of plugins) {
38 if (plugin.manipulateOptions) {
39 plugin.manipulateOptions(options, options.parserOpts);
40 }
41 }
42 }
43 return options;
44}
src/file-viewer/highlight-grammar/css.plist deleted-53
......@@ -1,53 +0,0 @@
1// default
2function* normalizeFile(pluginPasses, options, code, ast) {
3 code = `${code || ""}`;
4 if (ast) {
5 if (ast.type === "Program") {
6 ast = file(ast, [], []);
7 } else if (ast.type !== "File") {
8 throw new Error("AST root must be a Program or File node");
9 }
10 if (options.cloneInputAst) {
11 ast = (0, _cloneDeep.default)(ast);
12 }
13 } else {
14 ast = yield* (0, _index.default)(pluginPasses, options, code);
15 }
16 let inputMap = null;
17 if (options.inputSourceMap !== false) {
18 if (typeof options.inputSourceMap === "object") {
19 inputMap = _convertSourceMap().fromObject(options.inputSourceMap);
20 }
21 if (!inputMap) {
22 const lastComment = extractComments(INLINE_SOURCEMAP_REGEX, ast);
23 if (lastComment) {
24 try {
25 inputMap = _convertSourceMap().fromComment("//" + lastComment);
26 } catch (err) {
27 {
28 debug("discarding unknown inline input sourcemap");
29 }
30 }
31 }
32 }
33 if (!inputMap) {
34 const lastComment = extractComments(EXTERNAL_SOURCEMAP_REGEX, ast);
35 if (typeof options.filename === "string" && lastComment) {
36 try {
37 const match = EXTERNAL_SOURCEMAP_REGEX.exec(lastComment);
38 const inputMapContent = _fs().readFileSync(_path().resolve(_path().dirname(options.filename), match[1]), "utf8");
39 inputMap = _convertSourceMap().fromJSON(inputMapContent);
40 } catch (err) {
41 debug("discarding unknown file input sourcemap", err);
42 }
43 } else if (lastComment) {
44 debug("discarding un-loadable file input sourcemap");
45 }
46 }
47 }
48 return new _file.default(options, {
49 code,
50 ast: ast,
51 inputMap
52 });
53}
src/file-viewer/highlight-grammar/diff.plist deleted-56
......@@ -1,56 +0,0 @@
1// default
2function* parser(pluginPasses, {
3 parserOpts,
4 highlightCode = true,
5 filename = "unknown"
6}, code) {
7 try {
8 const results = [];
9 for (const plugins of pluginPasses) {
10 for (const plugin of plugins) {
11 const {
12 parserOverride
13 } = plugin;
14 if (parserOverride) {
15 const ast = parserOverride(code, parserOpts, _parser().parse);
16 if (ast !== undefined) results.push(ast);
17 }
18 }
19 }
20 if (results.length === 0) {
21 return (0, _parser().parse)(code, parserOpts);
22 } else if (results.length === 1) {
23 yield* [];
24 if (typeof results[0].then === "function") {
25 throw new Error(`You appear to be using an async parser plugin, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, you may need to upgrade ` + `your @babel/core version.`);
26 }
27 return results[0];
28 }
29 throw new Error("More than one plugin attempted to override parsing.");
30 } catch (err) {
31 if (err.code === "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED") {
32 err.message += "\nConsider renaming the file to '.mjs', or setting sourceType:module " + "or sourceType:unambiguous in your Babel config for this file.";
33 }
34 const {
35 loc,
36 missingPlugin
37 } = err;
38 if (loc) {
39 const codeFrame = (0, _codeFrame().codeFrameColumns)(code, {
40 start: {
41 line: loc.line,
42 column: loc.column + 1
43 }
44 }, {
45 highlightCode
46 });
47 if (missingPlugin) {
48 err.message = `${filename}: ` + (0, _missingPluginHelper.default)(missingPlugin[0], loc, codeFrame, filename);
49 } else {
50 err.message = `${filename}: ${err.message}\n\n` + codeFrame;
51 }
52 err.code = "BABEL_PARSE_ERROR";
53 }
54 throw err;
55 }
56}
src/file-viewer/highlight-grammar/dosbatch.plist deleted-33
......@@ -1,33 +0,0 @@
1// default
2function generateMissingPluginMessage(missingPluginName, loc, codeFrame, filename) {
3 let helpMessage = `Support for the experimental syntax '${missingPluginName}' isn't currently enabled ` + `(${loc.line}:${loc.column + 1}):\n\n` + codeFrame;
4 const pluginInfo = pluginNameMap[missingPluginName];
5 if (pluginInfo) {
6 const {
7 syntax: syntaxPlugin,
8 transform: transformPlugin
9 } = pluginInfo;
10 if (syntaxPlugin) {
11 const syntaxPluginInfo = getNameURLCombination(syntaxPlugin);
12 if (transformPlugin) {
13 const transformPluginInfo = getNameURLCombination(transformPlugin);
14 const sectionType = transformPlugin.name.startsWith("@babel/plugin") ? "plugins" : "presets";
15 helpMessage += `\n\nAdd ${transformPluginInfo} to the '${sectionType}' section of your Babel config to enable transformation.
16If you want to leave it as-is, add ${syntaxPluginInfo} to the 'plugins' section to enable parsing.`;
17 } else {
18 helpMessage += `\n\nAdd ${syntaxPluginInfo} to the 'plugins' section of your Babel config ` + `to enable parsing.`;
19 }
20 }
21 }
22 const msgFilename = filename === "unknown" ? "<name of the input file>" : filename;
23 helpMessage += `
24
25If you already added the plugin for this syntax to your config, it's possible that your config \
26isn't being loaded.
27You can re-run Babel with the BABEL_SHOW_CONFIG_FOR environment variable to show the loaded \
28configuration:
29\tnpx cross-env BABEL_SHOW_CONFIG_FOR=${msgFilename} <your build command>
30See https://babeljs.io/docs/configuration#print-effective-configs for more info.
31`;
32 return helpMessage;
33}
src/file-viewer/highlight-grammar/json.plist deleted-11
......@@ -1,11 +0,0 @@
1// default
2function _default(value) {
3 if (typeof value !== "object") return value;
4 {
5 try {
6 return deepClone(value, new Map(), true);
7 } catch (_) {
8 return structuredClone(value);
9 }
10 }
11}
src/file-viewer/highlight-grammar/lua.plist deleted-61
......@@ -1,61 +0,0 @@
1// default
2function generateCode(pluginPasses, file) {
3 const {
4 opts,
5 ast,
6 code,
7 inputMap
8 } = file;
9 const {
10 generatorOpts
11 } = opts;
12 generatorOpts.inputSourceMap = inputMap == null ? void 0 : inputMap.toObject();
13 const results = [];
14 for (const plugins of pluginPasses) {
15 for (const plugin of plugins) {
16 const {
17 generatorOverride
18 } = plugin;
19 if (generatorOverride) {
20 const result = generatorOverride(ast, generatorOpts, code, _generator().default);
21 if (result !== undefined) results.push(result);
22 }
23 }
24 }
25 let result;
26 if (results.length === 0) {
27 result = (0, _generator().default)(ast, generatorOpts, code);
28 } else if (results.length === 1) {
29 result = results[0];
30 if (typeof result.then === "function") {
31 throw new Error(`You appear to be using an async codegen plugin, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, ` + `you may need to upgrade your @babel/core version.`);
32 }
33 } else {
34 throw new Error("More than one plugin attempted to override codegen.");
35 }
36 let {
37 code: outputCode,
38 decodedMap: outputMap = result.map
39 } = result;
40 if (result.__mergedMap) {
41 outputMap = Object.assign({}, result.map);
42 } else {
43 if (outputMap) {
44 if (inputMap) {
45 outputMap = (0, _mergeMap.default)(inputMap.toObject(), outputMap, generatorOpts.sourceFileName);
46 } else {
47 outputMap = result.map;
48 }
49 }
50 }
51 if (opts.sourceMaps === "inline" || opts.sourceMaps === "both") {
52 outputCode += "\n" + _convertSourceMap().fromObject(outputMap).toComment();
53 }
54 if (opts.sourceMaps === "inline") {
55 outputMap = null;
56 }
57 return {
58 outputCode,
59 outputMap
60 };
61}
src/file-viewer/highlight-grammar/mdx.plist deleted-17
......@@ -1,17 +0,0 @@
1// default
2function mergeSourceMap(inputMap, map, sourceFileName) {
3 const source = sourceFileName.replace(/\\/g, "/");
4 let found = false;
5 const result = _remapping()(rootless(map), (s, ctx) => {
6 if (s === source && !found) {
7 found = true;
8 ctx.source = "";
9 return rootless(inputMap);
10 }
11 return null;
12 });
13 if (typeof inputMap.sourceRoot === "string") {
14 result.sourceRoot = inputMap.sourceRoot;
15 }
16 return Object.assign({}, result);
17}
src/file-viewer/highlight-grammar/php.plist deleted
src/file-viewer/highlight-grammar/powershell.plist deleted-676
......@@ -1,676 +0,0 @@
1// SEMVER_SPEC_VERSION
22.0.0
3
4// re
5/0|[1-9]\d*/,/\d+/,/\d*[a-zA-Z-][a-zA-Z0-9-]*/,/(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)/,/(\d+)\.(\d+)\.(\d+)/,/(?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*)/,/(?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*)/,/(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*))*))/,/(?:-?((?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*))*))/,/[a-zA-Z0-9-]+/,/(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))/,/^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*))*))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?$/,/v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*))*))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?/,/[v=\s]*(\d+)\.(\d+)\.(\d+)(?:-?((?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*))*))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?/,/^[v=\s]*(\d+)\.(\d+)\.(\d+)(?:-?((?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*))*))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?$/,/((?:<|>)?=?)/,/\d+|x|X|\*/,/0|[1-9]\d*|x|X|\*/,/[v=\s]*(0|[1-9]\d*|x|X|\*)(?:\.(0|[1-9]\d*|x|X|\*)(?:\.(0|[1-9]\d*|x|X|\*)(?:(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?)?)?/,/[v=\s]*(\d+|x|X|\*)(?:\.(\d+|x|X|\*)(?:\.(\d+|x|X|\*)(?:(?:-?((?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?)?)?/,/^((?:<|>)?=?)\s*[v=\s]*(0|[1-9]\d*|x|X|\*)(?:\.(0|[1-9]\d*|x|X|\*)(?:\.(0|[1-9]\d*|x|X|\*)(?:(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?)?)?$/,/^((?:<|>)?=?)\s*[v=\s]*(\d+|x|X|\*)(?:\.(\d+|x|X|\*)(?:\.(\d+|x|X|\*)(?:(?:-?((?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?)?)?$/,/(^|[^\d])(\d{1,16})(?:\.(\d{1,16}))?(?:\.(\d{1,16}))?(?:$|[^\d])/,/(^|[^\d])(\d{1,16})(?:\.(\d{1,16}))?(?:\.(\d{1,16}))?(?:$|[^\d])/g,/(?:~>?)/,/(\s*)(?:~>?)\s+/g,/^(?:~>?)[v=\s]*(0|[1-9]\d*|x|X|\*)(?:\.(0|[1-9]\d*|x|X|\*)(?:\.(0|[1-9]\d*|x|X|\*)(?:(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?)?)?$/,/^(?:~>?)[v=\s]*(\d+|x|X|\*)(?:\.(\d+|x|X|\*)(?:\.(\d+|x|X|\*)(?:(?:-?((?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?)?)?$/,/(?:\^)/,/(\s*)(?:\^)\s+/g,/^(?:\^)[v=\s]*(0|[1-9]\d*|x|X|\*)(?:\.(0|[1-9]\d*|x|X|\*)(?:\.(0|[1-9]\d*|x|X|\*)(?:(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?)?)?$/,/^(?:\^)[v=\s]*(\d+|x|X|\*)(?:\.(\d+|x|X|\*)(?:\.(\d+|x|X|\*)(?:(?:-?((?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?)?)?$/,/^((?:<|>)?=?)\s*([v=\s]*(\d+)\.(\d+)\.(\d+)(?:-?((?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*))*))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?)$|^$/,/^((?:<|>)?=?)\s*(v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*))*))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?)$|^$/,/(\s*)((?:<|>)?=?)\s*([v=\s]*(\d+)\.(\d+)\.(\d+)(?:-?((?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*))*))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?|[v=\s]*(0|[1-9]\d*|x|X|\*)(?:\.(0|[1-9]\d*|x|X|\*)(?:\.(0|[1-9]\d*|x|X|\*)(?:(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?)?)?)/g,/^\s*([v=\s]*(0|[1-9]\d*|x|X|\*)(?:\.(0|[1-9]\d*|x|X|\*)(?:\.(0|[1-9]\d*|x|X|\*)(?:(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?)?)?)\s+-\s+([v=\s]*(0|[1-9]\d*|x|X|\*)(?:\.(0|[1-9]\d*|x|X|\*)(?:\.(0|[1-9]\d*|x|X|\*)(?:(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?)?)?)\s*$/,/^\s*([v=\s]*(\d+|x|X|\*)(?:\.(\d+|x|X|\*)(?:\.(\d+|x|X|\*)(?:(?:-?((?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?)?)?)\s+-\s+([v=\s]*(\d+|x|X|\*)(?:\.(\d+|x|X|\*)(?:\.(\d+|x|X|\*)(?:(?:-?((?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?)?)?)\s*$/,/(<|>)?=?\s*\*/
6
7// safeRe
8/0|[1-9]\d{0,256}/,/\d{1,256}/,/\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250}/,/(0|[1-9]\d{0,256})\.(0|[1-9]\d{0,256})\.(0|[1-9]\d{0,256})/,/(\d{1,256})\.(\d{1,256})\.(\d{1,256})/,/(?:0|[1-9]\d{0,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250})/,/(?:\d{1,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250})/,/(?:-((?:0|[1-9]\d{0,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250})(?:\.(?:0|[1-9]\d{0,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250}))*))/,/(?:-?((?:\d{1,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250})(?:\.(?:\d{1,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250}))*))/,/[a-zA-Z0-9-]{1,250}/,/(?:\+([a-zA-Z0-9-]{1,250}(?:\.[a-zA-Z0-9-]{1,250})*))/,/^v?(0|[1-9]\d{0,256})\.(0|[1-9]\d{0,256})\.(0|[1-9]\d{0,256})(?:-((?:0|[1-9]\d{0,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250})(?:\.(?:0|[1-9]\d{0,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250}))*))?(?:\+([a-zA-Z0-9-]{1,250}(?:\.[a-zA-Z0-9-]{1,250})*))?$/,/v?(0|[1-9]\d{0,256})\.(0|[1-9]\d{0,256})\.(0|[1-9]\d{0,256})(?:-((?:0|[1-9]\d{0,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250})(?:\.(?:0|[1-9]\d{0,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250}))*))?(?:\+([a-zA-Z0-9-]{1,250}(?:\.[a-zA-Z0-9-]{1,250})*))?/,/[v=\s]*(\d{1,256})\.(\d{1,256})\.(\d{1,256})(?:-?((?:\d{1,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250})(?:\.(?:\d{1,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250}))*))?(?:\+([a-zA-Z0-9-]{1,250}(?:\.[a-zA-Z0-9-]{1,250})*))?/,/^[v=\s]*(\d{1,256})\.(\d{1,256})\.(\d{1,256})(?:-?((?:\d{1,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250})(?:\.(?:\d{1,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250}))*))?(?:\+([a-zA-Z0-9-]{1,250}(?:\.[a-zA-Z0-9-]{1,250})*))?$/,/((?:<|>)?=?)/,/\d{1,256}|x|X|\*/,/0|[1-9]\d{0,256}|x|X|\*/,/[v=\s]*(0|[1-9]\d{0,256}|x|X|\*)(?:\.(0|[1-9]\d{0,256}|x|X|\*)(?:\.(0|[1-9]\d{0,256}|x|X|\*)(?:(?:-((?:0|[1-9]\d{0,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250})(?:\.(?:0|[1-9]\d{0,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250}))*)))?(?:\+([a-zA-Z0-9-]{1,250}(?:\.[a-zA-Z0-9-]{1,250})*))?)?)?/,/[v=\s]*(\d{1,256}|x|X|\*)(?:\.(\d{1,256}|x|X|\*)(?:\.(\d{1,256}|x|X|\*)(?:(?:-?((?:\d{1,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250})(?:\.(?:\d{1,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250}))*)))?(?:\+([a-zA-Z0-9-]{1,250}(?:\.[a-zA-Z0-9-]{1,250})*))?)?)?/,/^((?:<|>)?=?)\s{0,1}[v=\s]*(0|[1-9]\d{0,256}|x|X|\*)(?:\.(0|[1-9]\d{0,256}|x|X|\*)(?:\.(0|[1-9]\d{0,256}|x|X|\*)(?:(?:-((?:0|[1-9]\d{0,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250})(?:\.(?:0|[1-9]\d{0,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250}))*)))?(?:\+([a-zA-Z0-9-]{1,250}(?:\.[a-zA-Z0-9-]{1,250})*))?)?)?$/,/^((?:<|>)?=?)\s{0,1}[v=\s]*(\d{1,256}|x|X|\*)(?:\.(\d{1,256}|x|X|\*)(?:\.(\d{1,256}|x|X|\*)(?:(?:-?((?:\d{1,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250})(?:\.(?:\d{1,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250}))*)))?(?:\+([a-zA-Z0-9-]{1,250}(?:\.[a-zA-Z0-9-]{1,250})*))?)?)?$/,/(^|[^\d])(\d{1,16})(?:\.(\d{1,16}))?(?:\.(\d{1,16}))?(?:$|[^\d])/,/(^|[^\d])(\d{1,16})(?:\.(\d{1,16}))?(?:\.(\d{1,16}))?(?:$|[^\d])/g,/(?:~>?)/,/(\s{0,1})(?:~>?)\s{1,1}/g,/^(?:~>?)[v=\s]*(0|[1-9]\d{0,256}|x|X|\*)(?:\.(0|[1-9]\d{0,256}|x|X|\*)(?:\.(0|[1-9]\d{0,256}|x|X|\*)(?:(?:-((?:0|[1-9]\d{0,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250})(?:\.(?:0|[1-9]\d{0,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250}))*)))?(?:\+([a-zA-Z0-9-]{1,250}(?:\.[a-zA-Z0-9-]{1,250})*))?)?)?$/,/^(?:~>?)[v=\s]*(\d{1,256}|x|X|\*)(?:\.(\d{1,256}|x|X|\*)(?:\.(\d{1,256}|x|X|\*)(?:(?:-?((?:\d{1,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250})(?:\.(?:\d{1,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250}))*)))?(?:\+([a-zA-Z0-9-]{1,250}(?:\.[a-zA-Z0-9-]{1,250})*))?)?)?$/,/(?:\^)/,/(\s{0,1})(?:\^)\s{1,1}/g,/^(?:\^)[v=\s]*(0|[1-9]\d{0,256}|x|X|\*)(?:\.(0|[1-9]\d{0,256}|x|X|\*)(?:\.(0|[1-9]\d{0,256}|x|X|\*)(?:(?:-((?:0|[1-9]\d{0,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250})(?:\.(?:0|[1-9]\d{0,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250}))*)))?(?:\+([a-zA-Z0-9-]{1,250}(?:\.[a-zA-Z0-9-]{1,250})*))?)?)?$/,/^(?:\^)[v=\s]*(\d{1,256}|x|X|\*)(?:\.(\d{1,256}|x|X|\*)(?:\.(\d{1,256}|x|X|\*)(?:(?:-?((?:\d{1,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250})(?:\.(?:\d{1,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250}))*)))?(?:\+([a-zA-Z0-9-]{1,250}(?:\.[a-zA-Z0-9-]{1,250})*))?)?)?$/,/^((?:<|>)?=?)\s{0,1}([v=\s]*(\d{1,256})\.(\d{1,256})\.(\d{1,256})(?:-?((?:\d{1,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250})(?:\.(?:\d{1,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250}))*))?(?:\+([a-zA-Z0-9-]{1,250}(?:\.[a-zA-Z0-9-]{1,250})*))?)$|^$/,/^((?:<|>)?=?)\s{0,1}(v?(0|[1-9]\d{0,256})\.(0|[1-9]\d{0,256})\.(0|[1-9]\d{0,256})(?:-((?:0|[1-9]\d{0,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250})(?:\.(?:0|[1-9]\d{0,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250}))*))?(?:\+([a-zA-Z0-9-]{1,250}(?:\.[a-zA-Z0-9-]{1,250})*))?)$|^$/,/(\s{0,1})((?:<|>)?=?)\s{0,1}([v=\s]*(\d{1,256})\.(\d{1,256})\.(\d{1,256})(?:-?((?:\d{1,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250})(?:\.(?:\d{1,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250}))*))?(?:\+([a-zA-Z0-9-]{1,250}(?:\.[a-zA-Z0-9-]{1,250})*))?|[v=\s]*(0|[1-9]\d{0,256}|x|X|\*)(?:\.(0|[1-9]\d{0,256}|x|X|\*)(?:\.(0|[1-9]\d{0,256}|x|X|\*)(?:(?:-((?:0|[1-9]\d{0,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250})(?:\.(?:0|[1-9]\d{0,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250}))*)))?(?:\+([a-zA-Z0-9-]{1,250}(?:\.[a-zA-Z0-9-]{1,250})*))?)?)?)/g,/^\s{0,1}([v=\s]*(0|[1-9]\d{0,256}|x|X|\*)(?:\.(0|[1-9]\d{0,256}|x|X|\*)(?:\.(0|[1-9]\d{0,256}|x|X|\*)(?:(?:-((?:0|[1-9]\d{0,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250})(?:\.(?:0|[1-9]\d{0,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250}))*)))?(?:\+([a-zA-Z0-9-]{1,250}(?:\.[a-zA-Z0-9-]{1,250})*))?)?)?)\s{1,1}-\s{1,1}([v=\s]*(0|[1-9]\d{0,256}|x|X|\*)(?:\.(0|[1-9]\d{0,256}|x|X|\*)(?:\.(0|[1-9]\d{0,256}|x|X|\*)(?:(?:-((?:0|[1-9]\d{0,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250})(?:\.(?:0|[1-9]\d{0,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250}))*)))?(?:\+([a-zA-Z0-9-]{1,250}(?:\.[a-zA-Z0-9-]{1,250})*))?)?)?)\s{0,1}$/,/^\s{0,1}([v=\s]*(\d{1,256}|x|X|\*)(?:\.(\d{1,256}|x|X|\*)(?:\.(\d{1,256}|x|X|\*)(?:(?:-?((?:\d{1,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250})(?:\.(?:\d{1,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250}))*)))?(?:\+([a-zA-Z0-9-]{1,250}(?:\.[a-zA-Z0-9-]{1,250})*))?)?)?)\s{1,1}-\s{1,1}([v=\s]*(\d{1,256}|x|X|\*)(?:\.(\d{1,256}|x|X|\*)(?:\.(\d{1,256}|x|X|\*)(?:(?:-?((?:\d{1,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250})(?:\.(?:\d{1,256}|\d{0,256}[a-zA-Z-][a-zA-Z0-9-]{0,250}))*)))?(?:\+([a-zA-Z0-9-]{1,250}(?:\.[a-zA-Z0-9-]{1,250})*))?)?)?)\s{0,1}$/,/(<|>)?=?\s{0,1}\*/
9
10// src
110|[1-9]\d*,\d+,\d*[a-zA-Z-][a-zA-Z0-9-]*,(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*),(\d+)\.(\d+)\.(\d+),(?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*),(?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*),(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*))*)),(?:-?((?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*))*)),[a-zA-Z0-9-]+,(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*)),^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*))*))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?$,v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*))*))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?,[v=\s]*(\d+)\.(\d+)\.(\d+)(?:-?((?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*))*))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?,^[v=\s]*(\d+)\.(\d+)\.(\d+)(?:-?((?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*))*))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?$,((?:<|>)?=?),\d+|x|X|\*,0|[1-9]\d*|x|X|\*,[v=\s]*(0|[1-9]\d*|x|X|\*)(?:\.(0|[1-9]\d*|x|X|\*)(?:\.(0|[1-9]\d*|x|X|\*)(?:(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?)?)?,[v=\s]*(\d+|x|X|\*)(?:\.(\d+|x|X|\*)(?:\.(\d+|x|X|\*)(?:(?:-?((?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?)?)?,^((?:<|>)?=?)\s*[v=\s]*(0|[1-9]\d*|x|X|\*)(?:\.(0|[1-9]\d*|x|X|\*)(?:\.(0|[1-9]\d*|x|X|\*)(?:(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?)?)?$,^((?:<|>)?=?)\s*[v=\s]*(\d+|x|X|\*)(?:\.(\d+|x|X|\*)(?:\.(\d+|x|X|\*)(?:(?:-?((?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?)?)?$,(^|[^\d])(\d{1,16})(?:\.(\d{1,16}))?(?:\.(\d{1,16}))?(?:$|[^\d]),,(?:~>?),(\s*)(?:~>?)\s+,^(?:~>?)[v=\s]*(0|[1-9]\d*|x|X|\*)(?:\.(0|[1-9]\d*|x|X|\*)(?:\.(0|[1-9]\d*|x|X|\*)(?:(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?)?)?$,^(?:~>?)[v=\s]*(\d+|x|X|\*)(?:\.(\d+|x|X|\*)(?:\.(\d+|x|X|\*)(?:(?:-?((?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?)?)?$,(?:\^),(\s*)(?:\^)\s+,^(?:\^)[v=\s]*(0|[1-9]\d*|x|X|\*)(?:\.(0|[1-9]\d*|x|X|\*)(?:\.(0|[1-9]\d*|x|X|\*)(?:(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?)?)?$,^(?:\^)[v=\s]*(\d+|x|X|\*)(?:\.(\d+|x|X|\*)(?:\.(\d+|x|X|\*)(?:(?:-?((?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?)?)?$,^((?:<|>)?=?)\s*([v=\s]*(\d+)\.(\d+)\.(\d+)(?:-?((?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*))*))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?)$|^$,^((?:<|>)?=?)\s*(v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*))*))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?)$|^$,(\s*)((?:<|>)?=?)\s*([v=\s]*(\d+)\.(\d+)\.(\d+)(?:-?((?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*))*))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?|[v=\s]*(0|[1-9]\d*|x|X|\*)(?:\.(0|[1-9]\d*|x|X|\*)(?:\.(0|[1-9]\d*|x|X|\*)(?:(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?)?)?),^\s*([v=\s]*(0|[1-9]\d*|x|X|\*)(?:\.(0|[1-9]\d*|x|X|\*)(?:\.(0|[1-9]\d*|x|X|\*)(?:(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?)?)?)\s+-\s+([v=\s]*(0|[1-9]\d*|x|X|\*)(?:\.(0|[1-9]\d*|x|X|\*)(?:\.(0|[1-9]\d*|x|X|\*)(?:(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?)?)?)\s*$,^\s*([v=\s]*(\d+|x|X|\*)(?:\.(\d+|x|X|\*)(?:\.(\d+|x|X|\*)(?:(?:-?((?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?)?)?)\s+-\s+([v=\s]*(\d+|x|X|\*)(?:\.(\d+|x|X|\*)(?:\.(\d+|x|X|\*)(?:(?:-?((?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:\d+|\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\+([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*))?)?)?)\s*$,(<|>)?=?\s*\*
12
13// tokens
14[object Object]
15
16// parse
17function parse (version, options) {
18 if (!options || typeof options !== 'object') {
19 options = {
20 loose: !!options,
21 includePrerelease: false
22 }
23 }
24
25 if (version instanceof SemVer) {
26 return version
27 }
28
29 if (typeof version !== 'string') {
30 return null
31 }
32
33 if (version.length > MAX_LENGTH) {
34 return null
35 }
36
37 var r = options.loose ? safeRe[t.LOOSE] : safeRe[t.FULL]
38 if (!r.test(version)) {
39 return null
40 }
41
42 try {
43 return new SemVer(version, options)
44 } catch (er) {
45 return null
46 }
47}
48
49// valid
50function valid (version, options) {
51 var v = parse(version, options)
52 return v ? v.version : null
53}
54
55// clean
56function clean (version, options) {
57 var s = parse(version.trim().replace(/^[=v]+/, ''), options)
58 return s ? s.version : null
59}
60
61// SemVer
62function SemVer (version, options) {
63 if (!options || typeof options !== 'object') {
64 options = {
65 loose: !!options,
66 includePrerelease: false
67 }
68 }
69 if (version instanceof SemVer) {
70 if (version.loose === options.loose) {
71 return version
72 } else {
73 version = version.version
74 }
75 } else if (typeof version !== 'string') {
76 throw new TypeError('Invalid Version: ' + version)
77 }
78
79 if (version.length > MAX_LENGTH) {
80 throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters')
81 }
82
83 if (!(this instanceof SemVer)) {
84 return new SemVer(version, options)
85 }
86
87 debug('SemVer', version, options)
88 this.options = options
89 this.loose = !!options.loose
90
91 var m = version.trim().match(options.loose ? safeRe[t.LOOSE] : safeRe[t.FULL])
92
93 if (!m) {
94 throw new TypeError('Invalid Version: ' + version)
95 }
96
97 this.raw = version
98
99 // these are actually numbers
100 this.major = +m[1]
101 this.minor = +m[2]
102 this.patch = +m[3]
103
104 if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
105 throw new TypeError('Invalid major version')
106 }
107
108 if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
109 throw new TypeError('Invalid minor version')
110 }
111
112 if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
113 throw new TypeError('Invalid patch version')
114 }
115
116 // numberify any prerelease numeric ids
117 if (!m[4]) {
118 this.prerelease = []
119 } else {
120 this.prerelease = m[4].split('.').map(function (id) {
121 if (/^[0-9]+$/.test(id)) {
122 var num = +id
123 if (num >= 0 && num < MAX_SAFE_INTEGER) {
124 return num
125 }
126 }
127 return id
128 })
129 }
130
131 this.build = m[5] ? m[5].split('.') : []
132 this.format()
133}
134
135// inc
136function inc (version, release, loose, identifier) {
137 if (typeof (loose) === 'string') {
138 identifier = loose
139 loose = undefined
140 }
141
142 try {
143 return new SemVer(version, loose).inc(release, identifier).version
144 } catch (er) {
145 return null
146 }
147}
148
149// diff
150function diff (version1, version2) {
151 if (eq(version1, version2)) {
152 return null
153 } else {
154 var v1 = parse(version1)
155 var v2 = parse(version2)
156 var prefix = ''
157 if (v1.prerelease.length || v2.prerelease.length) {
158 prefix = 'pre'
159 var defaultResult = 'prerelease'
160 }
161 for (var key in v1) {
162 if (key === 'major' || key === 'minor' || key === 'patch') {
163 if (v1[key] !== v2[key]) {
164 return prefix + key
165 }
166 }
167 }
168 return defaultResult // may be undefined
169 }
170}
171
172// compareIdentifiers
173function compareIdentifiers (a, b) {
174 var anum = numeric.test(a)
175 var bnum = numeric.test(b)
176
177 if (anum && bnum) {
178 a = +a
179 b = +b
180 }
181
182 return a === b ? 0
183 : (anum && !bnum) ? -1
184 : (bnum && !anum) ? 1
185 : a < b ? -1
186 : 1
187}
188
189// rcompareIdentifiers
190function rcompareIdentifiers (a, b) {
191 return compareIdentifiers(b, a)
192}
193
194// major
195function major (a, loose) {
196 return new SemVer(a, loose).major
197}
198
199// minor
200function minor (a, loose) {
201 return new SemVer(a, loose).minor
202}
203
204// patch
205function patch (a, loose) {
206 return new SemVer(a, loose).patch
207}
208
209// compare
210function compare (a, b, loose) {
211 return new SemVer(a, loose).compare(new SemVer(b, loose))
212}
213
214// compareLoose
215function compareLoose (a, b) {
216 return compare(a, b, true)
217}
218
219// compareBuild
220function compareBuild (a, b, loose) {
221 var versionA = new SemVer(a, loose)
222 var versionB = new SemVer(b, loose)
223 return versionA.compare(versionB) || versionA.compareBuild(versionB)
224}
225
226// rcompare
227function rcompare (a, b, loose) {
228 return compare(b, a, loose)
229}
230
231// sort
232function sort (list, loose) {
233 return list.sort(function (a, b) {
234 return exports.compareBuild(a, b, loose)
235 })
236}
237
238// rsort
239function rsort (list, loose) {
240 return list.sort(function (a, b) {
241 return exports.compareBuild(b, a, loose)
242 })
243}
244
245// gt
246function gt (a, b, loose) {
247 return compare(a, b, loose) > 0
248}
249
250// lt
251function lt (a, b, loose) {
252 return compare(a, b, loose) < 0
253}
254
255// eq
256function eq (a, b, loose) {
257 return compare(a, b, loose) === 0
258}
259
260// neq
261function neq (a, b, loose) {
262 return compare(a, b, loose) !== 0
263}
264
265// gte
266function gte (a, b, loose) {
267 return compare(a, b, loose) >= 0
268}
269
270// lte
271function lte (a, b, loose) {
272 return compare(a, b, loose) <= 0
273}
274
275// cmp
276function cmp (a, op, b, loose) {
277 switch (op) {
278 case '===':
279 if (typeof a === 'object')
280 a = a.version
281 if (typeof b === 'object')
282 b = b.version
283 return a === b
284
285 case '!==':
286 if (typeof a === 'object')
287 a = a.version
288 if (typeof b === 'object')
289 b = b.version
290 return a !== b
291
292 case '':
293 case '=':
294 case '==':
295 return eq(a, b, loose)
296
297 case '!=':
298 return neq(a, b, loose)
299
300 case '>':
301 return gt(a, b, loose)
302
303 case '>=':
304 return gte(a, b, loose)
305
306 case '<':
307 return lt(a, b, loose)
308
309 case '<=':
310 return lte(a, b, loose)
311
312 default:
313 throw new TypeError('Invalid operator: ' + op)
314 }
315}
316
317// Comparator
318function Comparator (comp, options) {
319 if (!options || typeof options !== 'object') {
320 options = {
321 loose: !!options,
322 includePrerelease: false
323 }
324 }
325
326 if (comp instanceof Comparator) {
327 if (comp.loose === !!options.loose) {
328 return comp
329 } else {
330 comp = comp.value
331 }
332 }
333
334 if (!(this instanceof Comparator)) {
335 return new Comparator(comp, options)
336 }
337
338 comp = comp.trim().split(/\s+/).join(' ')
339 debug('comparator', comp, options)
340 this.options = options
341 this.loose = !!options.loose
342 this.parse(comp)
343
344 if (this.semver === ANY) {
345 this.value = ''
346 } else {
347 this.value = this.operator + this.semver.version
348 }
349
350 debug('comp', this)
351}
352
353// Range
354function Range (range, options) {
355 if (!options || typeof options !== 'object') {
356 options = {
357 loose: !!options,
358 includePrerelease: false
359 }
360 }
361
362 if (range instanceof Range) {
363 if (range.loose === !!options.loose &&
364 range.includePrerelease === !!options.includePrerelease) {
365 return range
366 } else {
367 return new Range(range.raw, options)
368 }
369 }
370
371 if (range instanceof Comparator) {
372 return new Range(range.value, options)
373 }
374
375 if (!(this instanceof Range)) {
376 return new Range(range, options)
377 }
378
379 this.options = options
380 this.loose = !!options.loose
381 this.includePrerelease = !!options.includePrerelease
382
383 // First reduce all whitespace as much as possible so we do not have to rely
384 // on potentially slow regexes like \s*. This is then stored and used for
385 // future error messages as well.
386 this.raw = range
387 .trim()
388 .split(/\s+/)
389 .join(' ')
390
391 // First, split based on boolean or ||
392 this.set = this.raw.split('||').map(function (range) {
393 return this.parseRange(range.trim())
394 }, this).filter(function (c) {
395 // throw out any that are not relevant for whatever reason
396 return c.length
397 })
398
399 if (!this.set.length) {
400 throw new TypeError('Invalid SemVer Range: ' + this.raw)
401 }
402
403 this.format()
404}
405
406// toComparators
407function toComparators (range, options) {
408 return new Range(range, options).set.map(function (comp) {
409 return comp.map(function (c) {
410 return c.value
411 }).join(' ').trim().split(' ')
412 })
413}
414
415// satisfies
416function satisfies (version, range, options) {
417 try {
418 range = new Range(range, options)
419 } catch (er) {
420 return false
421 }
422 return range.test(version)
423}
424
425// maxSatisfying
426function maxSatisfying (versions, range, options) {
427 var max = null
428 var maxSV = null
429 try {
430 var rangeObj = new Range(range, options)
431 } catch (er) {
432 return null
433 }
434 versions.forEach(function (v) {
435 if (rangeObj.test(v)) {
436 // satisfies(v, range, options)
437 if (!max || maxSV.compare(v) === -1) {
438 // compare(max, v, true)
439 max = v
440 maxSV = new SemVer(max, options)
441 }
442 }
443 })
444 return max
445}
446
447// minSatisfying
448function minSatisfying (versions, range, options) {
449 var min = null
450 var minSV = null
451 try {
452 var rangeObj = new Range(range, options)
453 } catch (er) {
454 return null
455 }
456 versions.forEach(function (v) {
457 if (rangeObj.test(v)) {
458 // satisfies(v, range, options)
459 if (!min || minSV.compare(v) === 1) {
460 // compare(min, v, true)
461 min = v
462 minSV = new SemVer(min, options)
463 }
464 }
465 })
466 return min
467}
468
469// minVersion
470function minVersion (range, loose) {
471 range = new Range(range, loose)
472
473 var minver = new SemVer('0.0.0')
474 if (range.test(minver)) {
475 return minver
476 }
477
478 minver = new SemVer('0.0.0-0')
479 if (range.test(minver)) {
480 return minver
481 }
482
483 minver = null
484 for (var i = 0; i < range.set.length; ++i) {
485 var comparators = range.set[i]
486
487 comparators.forEach(function (comparator) {
488 // Clone to avoid manipulating the comparator's semver object.
489 var compver = new SemVer(comparator.semver.version)
490 switch (comparator.operator) {
491 case '>':
492 if (compver.prerelease.length === 0) {
493 compver.patch++
494 } else {
495 compver.prerelease.push(0)
496 }
497 compver.raw = compver.format()
498 /* fallthrough */
499 case '':
500 case '>=':
501 if (!minver || gt(minver, compver)) {
502 minver = compver
503 }
504 break
505 case '<':
506 case '<=':
507 /* Ignore maximum versions */
508 break
509 /* istanbul ignore next */
510 default:
511 throw new Error('Unexpected operation: ' + comparator.operator)
512 }
513 })
514 }
515
516 if (minver && range.test(minver)) {
517 return minver
518 }
519
520 return null
521}
522
523// validRange
524function validRange (range, options) {
525 try {
526 // Return '*' instead of '' so that truthiness works.
527 // This will throw if it's invalid anyway
528 return new Range(range, options).range || '*'
529 } catch (er) {
530 return null
531 }
532}
533
534// ltr
535function ltr (version, range, options) {
536 return outside(version, range, '<', options)
537}
538
539// gtr
540function gtr (version, range, options) {
541 return outside(version, range, '>', options)
542}
543
544// outside
545function outside (version, range, hilo, options) {
546 version = new SemVer(version, options)
547 range = new Range(range, options)
548
549 var gtfn, ltefn, ltfn, comp, ecomp
550 switch (hilo) {
551 case '>':
552 gtfn = gt
553 ltefn = lte
554 ltfn = lt
555 comp = '>'
556 ecomp = '>='
557 break
558 case '<':
559 gtfn = lt
560 ltefn = gte
561 ltfn = gt
562 comp = '<'
563 ecomp = '<='
564 break
565 default:
566 throw new TypeError('Must provide a hilo val of "<" or ">"')
567 }
568
569 // If it satisifes the range it is not outside
570 if (satisfies(version, range, options)) {
571 return false
572 }
573
574 // From now on, variable terms are as if we're in "gtr" mode.
575 // but note that everything is flipped for the "ltr" function.
576
577 for (var i = 0; i < range.set.length; ++i) {
578 var comparators = range.set[i]
579
580 var high = null
581 var low = null
582
583 comparators.forEach(function (comparator) {
584 if (comparator.semver === ANY) {
585 comparator = new Comparator('>=0.0.0')
586 }
587 high = high || comparator
588 low = low || comparator
589 if (gtfn(comparator.semver, high.semver, options)) {
590 high = comparator
591 } else if (ltfn(comparator.semver, low.semver, options)) {
592 low = comparator
593 }
594 })
595
596 // If the edge version comparator has a operator then our version
597 // isn't outside it
598 if (high.operator === comp || high.operator === ecomp) {
599 return false
600 }
601
602 // If the lowest version comparator has an operator and our version
603 // is less than it then it isn't higher than the range
604 if ((!low.operator || low.operator === comp) &&
605 ltefn(version, low.semver)) {
606 return false
607 } else if (low.operator === ecomp && ltfn(version, low.semver)) {
608 return false
609 }
610 }
611 return true
612}
613
614// prerelease
615function prerelease (version, options) {
616 var parsed = parse(version, options)
617 return (parsed && parsed.prerelease.length) ? parsed.prerelease : null
618}
619
620// intersects
621function intersects (r1, r2, options) {
622 r1 = new Range(r1, options)
623 r2 = new Range(r2, options)
624 return r1.intersects(r2)
625}
626
627// coerce
628function coerce (version, options) {
629 if (version instanceof SemVer) {
630 return version
631 }
632
633 if (typeof version === 'number') {
634 version = String(version)
635 }
636
637 if (typeof version !== 'string') {
638 return null
639 }
640
641 options = options || {}
642
643 var match = null
644 if (!options.rtl) {
645 match = version.match(safeRe[t.COERCE])
646 } else {
647 // Find the right-most coercible string that does not share
648 // a terminus with a more left-ward coercible string.
649 // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
650 //
651 // Walk through the string checking with a /g regexp
652 // Manually set the index so as to pick up overlapping matches.
653 // Stop when we get a match that ends at the string end, since no
654 // coercible string can be more right-ward without the same terminus.
655 var next
656 while ((next = safeRe[t.COERCERTL].exec(version)) &&
657 (!match || match.index + match[0].length !== version.length)
658 ) {
659 if (!match ||
660 next.index + next[0].length !== match.index + match[0].length) {
661 match = next
662 }
663 safeRe[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length
664 }
665 // leave it in a clean state
666 safeRe[t.COERCERTL].lastIndex = -1
667 }
668
669 if (match === null) {
670 return null
671 }
672
673 return parse(match[2] +
674 '.' + (match[3] || '0') +
675 '.' + (match[4] || '0'), options)
676}
src/file-viewer/highlight-grammar/python.plist deleted-33
......@@ -1,33 +0,0 @@
1// loadPlugin
2function* loadPlugin(name, dirname) {
3 const {
4 filepath,
5 loader
6 } = resolvePlugin(name, dirname, yield* (0, _async.isAsync)());
7 const value = yield* requireModule("plugin", loader, filepath);
8 debug("Loaded plugin %o from %o.", name, dirname);
9 return {
10 filepath,
11 value
12 };
13}
14
15// loadPreset
16function* loadPreset(name, dirname) {
17 const {
18 filepath,
19 loader
20 } = resolvePreset(name, dirname, yield* (0, _async.isAsync)());
21 const value = yield* requireModule("preset", loader, filepath);
22 debug("Loaded preset %o from %o.", name, dirname);
23 return {
24 filepath,
25 value
26 };
27}
28
29// resolvePlugin
30function () { [native code] }
31
32// resolvePreset
33function () { [native code] }
src/file-viewer/highlight-grammar/shell.plist deleted-52
......@@ -1,52 +0,0 @@
1// moduleResolve
2function moduleResolve(specifier, base, conditions, preserveSymlinks) {
3 const protocol = base.protocol;
4 const isData = protocol === 'data:';
5 const isRemote = isData || protocol === 'http:' || protocol === 'https:';
6 let resolved;
7 if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) {
8 try {
9 resolved = new (_url().URL)(specifier, base);
10 } catch (error_) {
11 const error = new ERR_UNSUPPORTED_RESOLVE_REQUEST(specifier, base);
12 error.cause = error_;
13 throw error;
14 }
15 } else if (protocol === 'file:' && specifier[0] === '#') {
16 resolved = packageImportsResolve(specifier, base, conditions);
17 } else {
18 try {
19 resolved = new (_url().URL)(specifier);
20 } catch (error_) {
21 if (isRemote && !_module().builtinModules.includes(specifier)) {
22 const error = new ERR_UNSUPPORTED_RESOLVE_REQUEST(specifier, base);
23 error.cause = error_;
24 throw error;
25 }
26 resolved = packageResolve(specifier, base, conditions);
27 }
28 }
29 _assert()(resolved !== undefined, 'expected to be defined');
30 if (resolved.protocol !== 'file:') {
31 return resolved;
32 }
33 return finalizeResolution(resolved, base, preserveSymlinks);
34}
35
36// resolve
37function resolve(specifier, parent) {
38 if (!parent) {
39 throw new Error('Please pass `parent`: `import-meta-resolve` cannot ponyfill that');
40 }
41 try {
42 return defaultResolve(specifier, {
43 parentURL: parent
44 }).url;
45 } catch (error) {
46 const exception = error;
47 if ((exception.code === 'ERR_UNSUPPORTED_DIR_IMPORT' || exception.code === 'ERR_MODULE_NOT_FOUND') && typeof exception.url === 'string') {
48 return exception.url;
49 }
50 throw error;
51 }
52}
src/file-viewer/highlight-grammar/toml.plist deleted-28
......@@ -1,28 +0,0 @@
1// transform
2function transform(code, optsOrCallback, maybeCallback) {
3 let opts;
4 let callback;
5 if (typeof optsOrCallback === "function") {
6 callback = optsOrCallback;
7 opts = undefined;
8 } else {
9 opts = optsOrCallback;
10 callback = maybeCallback;
11 }
12 if (callback === undefined) {
13 {
14 return (0, _rewriteStackTrace.beginHiddenCallStack)(transformRunner.sync)(code, opts);
15 }
16 }
17 (0, _rewriteStackTrace.beginHiddenCallStack)(transformRunner.errback)(code, opts, callback);
18}
19
20// transformAsync
21function transformAsync(...args) {
22 return (0, _rewriteStackTrace.beginHiddenCallStack)(transformRunner.async)(...args);
23}
24
25// transformSync
26function transformSync(...args) {
27 return (0, _rewriteStackTrace.beginHiddenCallStack)(transformRunner.sync)(...args);
28}
src/file-viewer/highlight-grammar/ts.plist deleted-28
......@@ -1,28 +0,0 @@
1// transformFromAst
2function transformFromAst(ast, code, optsOrCallback, maybeCallback) {
3 let opts;
4 let callback;
5 if (typeof optsOrCallback === "function") {
6 callback = optsOrCallback;
7 opts = undefined;
8 } else {
9 opts = optsOrCallback;
10 callback = maybeCallback;
11 }
12 if (callback === undefined) {
13 {
14 return (0, _rewriteStackTrace.beginHiddenCallStack)(transformFromAstRunner.sync)(ast, code, opts);
15 }
16 }
17 (0, _rewriteStackTrace.beginHiddenCallStack)(transformFromAstRunner.errback)(ast, code, opts, callback);
18}
19
20// transformFromAstAsync
21function transformFromAstAsync(...args) {
22 return (0, _rewriteStackTrace.beginHiddenCallStack)(transformFromAstRunner.async)(...args);
23}
24
25// transformFromAstSync
26function transformFromAstSync(...args) {
27 return (0, _rewriteStackTrace.beginHiddenCallStack)(transformFromAstRunner.sync)(...args);
28}
src/file-viewer/highlight-grammar/tsx.plist deleted-23
......@@ -1,23 +0,0 @@
1// parse
2function parse(code, opts, callback) {
3 if (typeof opts === "function") {
4 callback = opts;
5 opts = undefined;
6 }
7 if (callback === undefined) {
8 {
9 return (0, _rewriteStackTrace.beginHiddenCallStack)(parseRunner.sync)(code, opts);
10 }
11 }
12 (0, _rewriteStackTrace.beginHiddenCallStack)(parseRunner.errback)(code, opts, callback);
13}
14
15// parseAsync
16function parseAsync(...args) {
17 return (0, _rewriteStackTrace.beginHiddenCallStack)(parseRunner.async)(...args);
18}
19
20// parseSync
21function parseSync(...args) {
22 return (0, _rewriteStackTrace.beginHiddenCallStack)(parseRunner.sync)(...args);
23}
src/file-viewer/highlight-grammar/xml.plist deleted-10
......@@ -1,10 +0,0 @@
1// default
2(api, options, dirname) => {
3 let clonedApi;
4 for (const name of Object.keys(apiPolyfills)) {
5 if (api[name]) continue;
6 clonedApi != null ? clonedApi : clonedApi = copyApiObject(api);
7 clonedApi[name] = apiPolyfills[name](clonedApi);
8 }
9 return builder(clonedApi != null ? clonedApi : api, options || {}, dirname);
10 }
src/file-viewer/highlight-grammar/yaml.plist deleted-25
......@@ -1,25 +0,0 @@
1// declare
2function declare(builder) {
3 return (api, options, dirname) => {
4 let clonedApi;
5 for (const name of Object.keys(apiPolyfills)) {
6 if (api[name]) continue;
7 clonedApi != null ? clonedApi : clonedApi = copyApiObject(api);
8 clonedApi[name] = apiPolyfills[name](clonedApi);
9 }
10 return builder(clonedApi != null ? clonedApi : api, options || {}, dirname);
11 };
12}
13
14// declarePreset
15function declare(builder) {
16 return (api, options, dirname) => {
17 let clonedApi;
18 for (const name of Object.keys(apiPolyfills)) {
19 if (api[name]) continue;
20 clonedApi != null ? clonedApi : clonedApi = copyApiObject(api);
21 clonedApi[name] = apiPolyfills[name](clonedApi);
22 }
23 return builder(clonedApi != null ? clonedApi : api, options || {}, dirname);
24 };
25}
src/file-viewer/highlight-grammar/zig.plist deleted-17
......@@ -1,17 +0,0 @@
1// default
2(api, options, dirname) => {
3 let clonedApi;
4 for (const name of Object.keys(apiPolyfills)) {
5 if (api[name]) continue;
6 clonedApi != null ? clonedApi : clonedApi = copyApiObject(api);
7 clonedApi[name] = apiPolyfills[name](clonedApi);
8 }
9 return builder(clonedApi != null ? clonedApi : api, options || {}, dirname);
10 }
11
12// defineCommonJSHook
13function defineCommonJSHook(file, hook) {
14 let hooks = file.get(commonJSHooksKey);
15 if (!hooks) file.set(commonJSHooksKey, hooks = []);
16 hooks.push(hook);
17}
src/file-viewer/highlight.ts deleted-200
......@@ -1,200 +0,0 @@
1// buildDynamicImport
2function buildDynamicImport(node, deferToThen, wrapWithPromise, builder) {
3 const specifier = _core.types.isCallExpression(node) ? node.arguments[0] : node.source;
4 if (_core.types.isStringLiteral(specifier) || _core.types.isTemplateLiteral(specifier) && specifier.quasis.length === 0) {
5 if (deferToThen) {
6 return _core.template.expression.ast`
7 Promise.resolve().then(() => ${builder(specifier)})
8 `;
9 } else return builder(specifier);
10 }
11 const specifierToString = _core.types.isTemplateLiteral(specifier) ? _core.types.identifier("specifier") : _core.types.templateLiteral([_core.types.templateElement({
12 raw: ""
13 }), _core.types.templateElement({
14 raw: ""
15 })], [_core.types.identifier("specifier")]);
16 if (deferToThen) {
17 return _core.template.expression.ast`
18 (specifier =>
19 new Promise(r => r(${specifierToString}))
20 .then(s => ${builder(_core.types.identifier("s"))})
21 )(${specifier})
22 `;
23 } else if (wrapWithPromise) {
24 return _core.template.expression.ast`
25 (specifier =>
26 new Promise(r => r(${builder(specifierToString)}))
27 )(${specifier})
28 `;
29 } else {
30 return _core.template.expression.ast`
31 (specifier => ${builder(specifierToString)})(${specifier})
32 `;
33 }
34}
35
36// buildNamespaceInitStatements
37function buildNamespaceInitStatements(metadata, sourceMetadata, constantReexports = false, wrapReference = Lazy.wrapReference) {
38 var _wrapReference;
39 const statements = [];
40 const srcNamespaceId = _core.types.identifier(sourceMetadata.name);
41 for (const localName of sourceMetadata.importsNamespace) {
42 if (localName === sourceMetadata.name) continue;
43 statements.push(_core.template.statement`var NAME = SOURCE;`({
44 NAME: localName,
45 SOURCE: _core.types.cloneNode(srcNamespaceId)
46 }));
47 }
48 const srcNamespace = (_wrapReference = wrapReference(srcNamespaceId, sourceMetadata.wrap)) != null ? _wrapReference : srcNamespaceId;
49 if (constantReexports) {
50 statements.push(...buildReexportsFromMeta(metadata, sourceMetadata, true, wrapReference));
51 }
52 for (const exportName of sourceMetadata.reexportNamespace) {
53 statements.push((!_core.types.isIdentifier(srcNamespace) ? _core.template.statement`
54 Object.defineProperty(EXPORTS, "NAME", {
55 enumerable: true,
56 get: function() {
57 return NAMESPACE;
58 }
59 });
60 ` : _core.template.statement`EXPORTS.NAME = NAMESPACE;`)({
61 EXPORTS: metadata.exportName,
62 NAME: exportName,
63 NAMESPACE: _core.types.cloneNode(srcNamespace)
64 }));
65 }
66 if (sourceMetadata.reexportAll) {
67 const statement = buildNamespaceReexport(metadata, _core.types.cloneNode(srcNamespace), constantReexports);
68 statement.loc = sourceMetadata.reexportAll.loc;
69 statements.push(statement);
70 }
71 return statements;
72}
73
74// ensureStatementsHoisted
75function ensureStatementsHoisted(statements) {
76 statements.forEach(header => {
77 header._blockHoist = 3;
78 });
79}
80
81// getModuleName
82function getModuleName(rootOpts, pluginOpts) {
83 var _pluginOpts$moduleId, _pluginOpts$moduleIds, _pluginOpts$getModule, _pluginOpts$moduleRoo;
84 return originalGetModuleName(rootOpts, {
85 moduleId: (_pluginOpts$moduleId = pluginOpts.moduleId) != null ? _pluginOpts$moduleId : rootOpts.moduleId,
86 moduleIds: (_pluginOpts$moduleIds = pluginOpts.moduleIds) != null ? _pluginOpts$moduleIds : rootOpts.moduleIds,
87 getModuleId: (_pluginOpts$getModule = pluginOpts.getModuleId) != null ? _pluginOpts$getModule : rootOpts.getModuleId,
88 moduleRoot: (_pluginOpts$moduleRoo = pluginOpts.moduleRoot) != null ? _pluginOpts$moduleRoo : rootOpts.moduleRoot
89 });
90 }
91
92// hasExports
93function hasExports(metadata) {
94 return metadata.hasExports;
95}
96
97// isModule
98function isModule(path) {
99 return path.node.sourceType === "module";
100}
101
102// isSideEffectImport
103function isSideEffectImport(source) {
104 return source.imports.size === 0 && source.importsNamespace.size === 0 && source.reexports.size === 0 && source.reexportNamespace.size === 0 && !source.reexportAll;
105}
106
107// rewriteModuleStatementsAndPrepareHeader
108function rewriteModuleStatementsAndPrepareHeader(path, {
109 exportName,
110 strict,
111 allowTopLevelThis,
112 strictMode,
113 noInterop,
114 importInterop = noInterop ? "none" : "babel",
115 lazy,
116 getWrapperPayload = Lazy.toGetWrapperPayload(lazy != null ? lazy : false),
117 wrapReference = Lazy.wrapReference,
118 esNamespaceOnly,
119 filename,
120 constantReexports = arguments[1].loose,
121 enumerableModuleMeta = arguments[1].loose,
122 noIncompleteNsImportDetection
123}) {
124 (0, _normalizeAndLoadMetadata.validateImportInteropOption)(importInterop);
125 _assert((0, _helperModuleImports.isModule)(path), "Cannot process module statements in a script");
126 path.node.sourceType = "script";
127 const meta = (0, _normalizeAndLoadMetadata.default)(path, exportName, {
128 importInterop,
129 initializeReexports: constantReexports,
130 getWrapperPayload,
131 esNamespaceOnly,
132 filename
133 });
134 if (!allowTopLevelThis) {
135 (0, _rewriteThis.default)(path);
136 }
137 (0, _rewriteLiveReferences.default)(path, meta, wrapReference);
138 if (strictMode !== false) {
139 const hasStrict = path.node.directives.some(directive => {
140 return directive.value.value === "use strict";
141 });
142 if (!hasStrict) {
143 path.unshiftContainer("directives", _core.types.directive(_core.types.directiveLiteral("use strict")));
144 }
145 }
146 const headers = [];
147 if ((0, _normalizeAndLoadMetadata.hasExports)(meta) && !strict) {
148 headers.push(buildESModuleHeader(meta, enumerableModuleMeta));
149 }
150 const nameList = buildExportNameListDeclaration(path, meta);
151 if (nameList) {
152 meta.exportNameListName = nameList.name;
153 headers.push(nameList.statement);
154 }
155 headers.push(...buildExportInitializationStatements(path, meta, wrapReference, constantReexports, noIncompleteNsImportDetection));
156 return {
157 meta,
158 headers
159 };
160}
161
162// rewriteThis
163function rewriteThis(programPath) {
164 if (!rewriteThisVisitor) {
165 rewriteThisVisitor = _traverse.visitors.environmentVisitor({
166 ThisExpression(path) {
167 path.replaceWith(_core.types.unaryExpression("void", _core.types.numericLiteral(0), true));
168 }
169 });
170 rewriteThisVisitor.noScope = true;
171 }
172 (0, _traverse.default)(programPath.node, rewriteThisVisitor);
173}
174
175// wrapInterop
176function wrapInterop(programPath, expr, type) {
177 if (type === "none") {
178 return null;
179 }
180 if (type === "node-namespace") {
181 return _core.types.callExpression(programPath.hub.addHelper("interopRequireWildcard"), [expr, _core.types.booleanLiteral(true)]);
182 } else if (type === "node-default") {
183 return null;
184 }
185 let helper;
186 if (type === "default") {
187 helper = "interopRequireDefault";
188 } else if (type === "namespace") {
189 helper = "interopRequireWildcard";
190 } else {
191 throw new Error(`Unknown interop: ${type}`);
192 }
193 return _core.types.callExpression(programPath.hub.addHelper(helper), [expr]);
194}
195
196// getDynamicImportSource
197function getDynamicImportSource(node) {
198 const [source] = node.arguments;
199 return _core.types.isStringLiteral(source) || _core.types.isTemplateLiteral(source) ? source : _core.template.expression.ast`\`\${${source}}\``;
200 }
src/file-viewer/mime.json deleted-463
......@@ -1,463 +0,0 @@
1
2 ".aac": "audio/x-aac",
3 ".aif": "audio/x-aiff",
4 ".aifc": "audio/x-aiff",
5 ".aiff": "audio/x-aiff",
6 ".apk": "application/vnd.android.package-archive",
7 ".asm": "text/x-asm",
8 ".bat": "application/x-msdownload",
9 ".bmp": "image/bmp",
10 ".c": "text/x-c",
11 ".cc": "text/x-c",
12 ".class": "application/java-vm",
13 ".com": "application/x-msdownload",
14 ".conf": "text/plain",
15 ".cpp": "text/x-c",
16 ".css": "text/css",
17 ".cxx": "text/x-c",
18 ".def": "text/plain",
19 ".diff": "text/plain",
20 ".dll": "application/x-msdownload",
21 ".doc": "application/msword",
22 ".docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
23 ".epub": "application/epub+zip",
24 ".exe": "application/x-msdownload",
25 ".gif": "image/gif",
26 ".gz": "application/x-gzip",
27 ".h": "text/x-c",
28 ".hh": "text/x-c",
29 ".htm": "text/html;charset=utf-8",
30 ".html": "text/html;charset=utf-8",
31 ".ico": "image/x-icon",
32 ".ics": "text/calendar",
33 ".ifb": "text/calendar",
34 ".iso": "application/octet-stream",
35 ".jar": "application/java-archive",
36 ".java": "text/x-java-source",
37 ".jpe": "image/jpeg",
38 ".jpeg": "image/jpeg",
39 ".jpg": "image/jpeg",
40 ".jpgv": "video/jpeg",
41 ".js": "application/javascript",
42 ".json": "application/json",
43 ".latex": "application/x-latex",
44 ".list": "text/plain",
45 ".log": "text/plain",
46 ".chat": "text/plain",
47 ".m4a": "audio/mp4",
48 ".mid": "audio/midi",
49 ".midi": "audio/midi",
50 ".mov": "video/quicktime",
51 ".mp3": "audio/mpeg",
52 ".mp4": "video/mp4",
53 ".mp4a": "audio/mp4",
54 ".mp4v": "video/mp4",
55 ".mpa": "video/mpeg",
56 ".mpe": "video/mpeg",
57 ".mpeg": "video/mpeg",
58 ".mpg": "video/mpeg",
59 ".mpg4": "video/mp4",
60 ".mpga": "audio/mpeg",
61 ".mpkg": "application/vnd.apple.installer+xml",
62 ".msi": "application/x-msdownload",
63
64 ".nb": "application/mathematica",
65 ".nc": "application/x-netcdf",
66 ".ncx": "application/x-dtbncx+xml",
67 ".ngdat": "application/vnd.nokia.n-gage.data",
68 ".nlu": "application/vnd.neurolanguage.nlu",
69 ".nml": "application/vnd.enliven",
70 ".nnd": "application/vnd.noblenet-directory",
71 ".nns": "application/vnd.noblenet-sealer",
72 ".nnw": "application/vnd.noblenet-web",
73 ".npx": "image/vnd.net-fpx",
74 ".nsf": "application/vnd.lotus-notes",
75 ".nws": "message/rfc822",
76 ".o": "application/octet-stream",
77 ".oa2": "application/vnd.fujitsu.oasys2",
78 ".oa3": "application/vnd.fujitsu.oasys3",
79 ".oas": "application/vnd.fujitsu.oasys",
80 ".obd": "application/x-msbinder",
81 ".obj": "application/octet-stream",
82 ".oda": "application/oda",
83 ".odb": "application/vnd.oasis.opendocument.database",
84 ".odc": "application/vnd.oasis.opendocument.chart",
85 ".odf": "application/vnd.oasis.opendocument.formula",
86 ".odft": "application/vnd.oasis.opendocument.formula-template",
87 ".odg": "application/vnd.oasis.opendocument.graphics",
88 ".odi": "application/vnd.oasis.opendocument.image",
89 ".odp": "application/vnd.oasis.opendocument.presentation",
90 ".ods": "application/vnd.oasis.opendocument.spreadsheet",
91 ".odt": "application/vnd.oasis.opendocument.text",
92 ".oga": "audio/ogg",
93 ".ogg": "audio/ogg",
94 ".ogv": "video/ogg",
95 ".ogx": "application/ogg",
96 ".onepkg": "application/onenote",
97 ".onetmp": "application/onenote",
98 ".onetoc": "application/onenote",
99 ".onetoc2": "application/onenote",
100 ".opf": "application/oebps-package+xml",
101 ".oprc": "application/vnd.palm",
102 ".org": "application/vnd.lotus-organizer",
103 ".osf": "application/vnd.yamaha.openscoreformat",
104 ".osfpvg": "application/vnd.yamaha.openscoreformat.osfpvg+xml",
105 ".otc": "application/vnd.oasis.opendocument.chart-template",
106 ".otf": "application/x-font-otf",
107 ".otg": "application/vnd.oasis.opendocument.graphics-template",
108 ".oth": "application/vnd.oasis.opendocument.text-web",
109 ".oti": "application/vnd.oasis.opendocument.image-template",
110 ".otm": "application/vnd.oasis.opendocument.text-master",
111 ".otp": "application/vnd.oasis.opendocument.presentation-template",
112 ".ots": "application/vnd.oasis.opendocument.spreadsheet-template",
113 ".ott": "application/vnd.oasis.opendocument.text-template",
114 ".oxt": "application/vnd.openofficeorg.extension",
115 ".p": "text/x-pascal",
116 ".p10": "application/pkcs10",
117 ".p12": "application/x-pkcs12",
118 ".p7b": "application/x-pkcs7-certificates",
119 ".p7c": "application/pkcs7-mime",
120 ".p7m": "application/pkcs7-mime",
121 ".p7r": "application/x-pkcs7-certreqresp",
122 ".p7s": "application/pkcs7-signature",
123 ".pas": "text/x-pascal",
124 ".pbd": "application/vnd.powerbuilder6",
125 ".pbm": "image/x-portable-bitmap",
126 ".pcf": "application/x-font-pcf",
127 ".pcl": "application/vnd.hp-pcl",
128 ".pclxl": "application/vnd.hp-pclxl",
129 ".pct": "image/x-pict",
130 ".pcurl": "application/vnd.curl.pcurl",
131 ".pcx": "image/x-pcx",
132 ".pdb": "application/vnd.palm",
133 ".pdf": "application/pdf",
134 ".pfa": "application/x-font-type1",
135 ".pfb": "application/x-font-type1",
136 ".pfm": "application/x-font-type1",
137 ".pfr": "application/font-tdpfr",
138 ".pfx": "application/x-pkcs12",
139 ".pgm": "image/x-portable-graymap",
140 ".pgn": "application/x-chess-pgn",
141 ".pgp": "application/pgp-encrypted",
142 ".pic": "image/x-pict",
143 ".pkg": "application/octet-stream",
144 ".pki": "application/pkixcmp",
145 ".pkipath": "application/pkix-pkipath",
146 ".pl": "text/plain",
147 ".plb": "application/vnd.3gpp.pic-bw-large",
148 ".plc": "application/vnd.mobius.plc",
149 ".plf": "application/vnd.pocketlearn",
150 ".pls": "application/pls+xml",
151 ".pml": "application/vnd.ctc-posml",
152 ".png": "image/png",
153 ".pnm": "image/x-portable-anymap",
154 ".portpkg": "application/vnd.macports.portpkg",
155 ".pot": "application/vnd.ms-powerpoint",
156 ".potm": "application/vnd.ms-powerpoint.template.macroenabled.12",
157 ".potx": "application/vnd.openxmlformats-officedocument.presentationml.template",
158 ".ppa": "application/vnd.ms-powerpoint",
159 ".ppam": "application/vnd.ms-powerpoint.addin.macroenabled.12",
160 ".ppd": "application/vnd.cups-ppd",
161 ".ppm": "image/x-portable-pixmap",
162 ".pps": "application/vnd.ms-powerpoint",
163 ".ppsm": "application/vnd.ms-powerpoint.slideshow.macroenabled.12",
164 ".ppsx": "application/vnd.openxmlformats-officedocument.presentationml.slideshow",
165 ".ppt": "application/vnd.ms-powerpoint",
166 ".pptm": "application/vnd.ms-powerpoint.presentation.macroenabled.12",
167 ".pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
168 ".pqa": "application/vnd.palm",
169 ".prc": "application/x-mobipocket-ebook",
170 ".pre": "application/vnd.lotus-freelance",
171 ".prf": "application/pics-rules",
172 ".ps": "application/postscript",
173 ".psb": "application/vnd.3gpp.pic-bw-small",
174 ".psd": "image/vnd.adobe.photoshop",
175 ".psf": "application/x-font-linux-psf",
176 ".ptid": "application/vnd.pvi.ptid1",
177 ".pub": "application/x-mspublisher",
178 ".pvb": "application/vnd.3gpp.pic-bw-var",
179 ".pwn": "application/vnd.3m.post-it-notes",
180 ".pwz": "application/vnd.ms-powerpoint",
181 ".py": "text/x-python",
182 ".pya": "audio/vnd.ms-playready.media.pya",
183 ".pyc": "application/x-python-code",
184 ".pyo": "application/x-python-code",
185 ".pyv": "video/vnd.ms-playready.media.pyv",
186 ".qam": "application/vnd.epson.quickanime",
187 ".qbo": "application/vnd.intu.qbo",
188 ".qfx": "application/vnd.intu.qfx",
189 ".qps": "application/vnd.publishare-delta-tree",
190 ".qt": "video/quicktime",
191 ".qwd": "application/vnd.quark.quarkxpress",
192 ".qwt": "application/vnd.quark.quarkxpress",
193 ".qxb": "application/vnd.quark.quarkxpress",
194 ".qxd": "application/vnd.quark.quarkxpress",
195 ".qxl": "application/vnd.quark.quarkxpress",
196 ".qxt": "application/vnd.quark.quarkxpress",
197 ".ra": "audio/x-pn-realaudio",
198 ".ram": "audio/x-pn-realaudio",
199 ".rar": "application/x-rar-compressed",
200 ".ras": "image/x-cmu-raster",
201 ".rcprofile": "application/vnd.ipunplugged.rcprofile",
202 ".rdf": "application/rdf+xml",
203 ".rdz": "application/vnd.data-vision.rdz",
204 ".rep": "application/vnd.businessobjects",
205 ".res": "application/x-dtbresource+xml",
206 ".rgb": "image/x-rgb",
207 ".rif": "application/reginfo+xml",
208 ".rl": "application/resource-lists+xml",
209 ".rlc": "image/vnd.fujixerox.edmics-rlc",
210 ".rld": "application/resource-lists-diff+xml",
211 ".rm": "application/vnd.rn-realmedia",
212 ".rmi": "audio/midi",
213 ".rmp": "audio/x-pn-realaudio-plugin",
214 ".rms": "application/vnd.jcp.javame.midlet-rms",
215 ".rnc": "application/relax-ng-compact-syntax",
216 ".roff": "text/troff",
217 ".rpm": "application/x-rpm",
218 ".rpss": "application/vnd.nokia.radio-presets",
219 ".rpst": "application/vnd.nokia.radio-preset",
220 ".rq": "application/sparql-query",
221 ".rs": "application/rls-services+xml",
222 ".rsd": "application/rsd+xml",
223 ".rss": "application/rss+xml",
224 ".rtf": "application/rtf",
225 ".rtx": "text/richtext",
226 ".s": "text/x-asm",
227 ".saf": "application/vnd.yamaha.smaf-audio",
228 ".sbml": "application/sbml+xml",
229 ".sc": "application/vnd.ibm.secure-container",
230 ".scd": "application/x-msschedule",
231 ".scm": "application/vnd.lotus-screencam",
232 ".scq": "application/scvp-cv-request",
233 ".scs": "application/scvp-cv-response",
234 ".scurl": "text/vnd.curl.scurl",
235 ".sda": "application/vnd.stardivision.draw",
236 ".sdc": "application/vnd.stardivision.calc",
237 ".sdd": "application/vnd.stardivision.impress",
238 ".sdkd": "application/vnd.solent.sdkm+xml",
239 ".sdkm": "application/vnd.solent.sdkm+xml",
240 ".sdp": "application/sdp",
241 ".sdw": "application/vnd.stardivision.writer",
242 ".see": "application/vnd.seemail",
243 ".seed": "application/vnd.fdsn.seed",
244 ".sema": "application/vnd.sema",
245 ".semd": "application/vnd.semd",
246 ".semf": "application/vnd.semf",
247 ".ser": "application/java-serialized-object",
248 ".setpay": "application/set-payment-initiation",
249 ".setreg": "application/set-registration-initiation",
250 ".sfd-hdstx": "application/vnd.hydrostatix.sof-data",
251 ".sfs": "application/vnd.spotfire.sfs",
252 ".sgl": "application/vnd.stardivision.writer-global",
253 ".sgm": "text/sgml",
254 ".sgml": "text/sgml",
255 ".sh": "application/x-sh",
256 ".shar": "application/x-shar",
257 ".shf": "application/shf+xml",
258 ".si": "text/vnd.wap.si",
259 ".sic": "application/vnd.wap.sic",
260 ".sig": "application/pgp-signature",
261 ".silo": "model/mesh",
262 ".sis": "application/vnd.symbian.install",
263 ".sisx": "application/vnd.symbian.install",
264 ".sit": "application/x-stuffit",
265 ".sitx": "application/x-stuffitx",
266 ".skd": "application/vnd.koan",
267 ".skm": "application/vnd.koan",
268 ".skp": "application/vnd.koan",
269 ".skt": "application/vnd.koan",
270 ".sl": "text/vnd.wap.sl",
271 ".slc": "application/vnd.wap.slc",
272 ".sldm": "application/vnd.ms-powerpoint.slide.macroenabled.12",
273 ".sldx": "application/vnd.openxmlformats-officedocument.presentationml.slide",
274 ".slt": "application/vnd.epson.salt",
275 ".smf": "application/vnd.stardivision.math",
276 ".smi": "application/smil+xml",
277 ".smil": "application/smil+xml",
278 ".snd": "audio/basic",
279 ".snf": "application/x-font-snf",
280 ".so": "application/octet-stream",
281 ".spc": "application/x-pkcs7-certificates",
282 ".spf": "application/vnd.yamaha.smaf-phrase",
283 ".spl": "application/x-futuresplash",
284 ".spot": "text/vnd.in3d.spot",
285 ".spp": "application/scvp-vp-response",
286 ".spq": "application/scvp-vp-request",
287 ".spx": "audio/ogg",
288 ".src": "application/x-wais-source",
289 ".srx": "application/sparql-results+xml",
290 ".sse": "application/vnd.kodak-descriptor",
291 ".ssf": "application/vnd.epson.ssf",
292 ".ssml": "application/ssml+xml",
293 ".stc": "application/vnd.sun.xml.calc.template",
294 ".std": "application/vnd.sun.xml.draw.template",
295 ".stf": "application/vnd.wt.stf",
296 ".sti": "application/vnd.sun.xml.impress.template",
297 ".stk": "application/hyperstudio",
298 ".stl": "application/vnd.ms-pki.stl",
299 ".str": "application/vnd.pg.format",
300 ".stw": "application/vnd.sun.xml.writer.template",
301 ".sus": "application/vnd.sus-calendar",
302 ".susp": "application/vnd.sus-calendar",
303 ".sv4cpio": "application/x-sv4cpio",
304 ".sv4crc": "application/x-sv4crc",
305 ".svd": "application/vnd.svd",
306 ".svg": "image/svg+xml",
307 ".svgz": "image/svg+xml",
308 ".swa": "application/x-director",
309 ".swf": "application/x-shockwave-flash",
310 ".swi": "application/vnd.arastra.swi",
311 ".sxc": "application/vnd.sun.xml.calc",
312 ".sxd": "application/vnd.sun.xml.draw",
313 ".sxg": "application/vnd.sun.xml.writer.global",
314 ".sxi": "application/vnd.sun.xml.impress",
315 ".sxm": "application/vnd.sun.xml.math",
316 ".sxw": "application/vnd.sun.xml.writer",
317 ".t": "text/troff",
318 ".tao": "application/vnd.tao.intent-module-archive",
319 ".tar": "application/x-tar",
320 ".tcap": "application/vnd.3gpp2.tcap",
321 ".tcl": "application/x-tcl",
322 ".teacher": "application/vnd.smart.teacher",
323 ".tex": "application/x-tex",
324 ".texi": "application/x-texinfo",
325 ".texinfo": "application/x-texinfo",
326 ".text": "text/plain",
327 ".tfm": "application/x-tex-tfm",
328 ".tgz": "application/x-gzip",
329 ".tif": "image/tiff",
330 ".tiff": "image/tiff",
331 ".tmo": "application/vnd.tmobile-livetv",
332 ".torrent": "application/x-bittorrent",
333 ".tpl": "application/vnd.groove-tool-template",
334 ".tpt": "application/vnd.trid.tpt",
335 ".tr": "text/troff",
336 ".tra": "application/vnd.trueapp",
337 ".trm": "application/x-msterminal",
338 ".tsv": "text/tab-separated-values",
339 ".ttc": "application/x-font-ttf",
340 ".ttf": "application/x-font-ttf",
341 ".twd": "application/vnd.simtech-mindmapper",
342 ".twds": "application/vnd.simtech-mindmapper",
343 ".txd": "application/vnd.genomatix.tuxedo",
344 ".txf": "application/vnd.mobius.txf",
345 ".txt": "text/plain",
346 ".u32": "application/x-authorware-bin",
347 ".udeb": "application/x-debian-package",
348 ".ufd": "application/vnd.ufdl",
349 ".ufdl": "application/vnd.ufdl",
350 ".umj": "application/vnd.umajin",
351 ".unityweb": "application/vnd.unity",
352 ".uoml": "application/vnd.uoml+xml",
353 ".uri": "text/uri-list",
354 ".uris": "text/uri-list",
355 ".urls": "text/uri-list",
356 ".ustar": "application/x-ustar",
357 ".utz": "application/vnd.uiq.theme",
358 ".uu": "text/x-uuencode",
359 ".vcd": "application/x-cdlink",
360 ".vcf": "text/x-vcard",
361 ".vcg": "application/vnd.groove-vcard",
362 ".vcs": "text/x-vcalendar",
363 ".vcx": "application/vnd.vcx",
364 ".vis": "application/vnd.visionary",
365 ".viv": "video/vnd.vivo",
366 ".vor": "application/vnd.stardivision.writer",
367 ".vox": "application/x-authorware-bin",
368 ".vrml": "model/vrml",
369 ".vsd": "application/vnd.visio",
370 ".vsf": "application/vnd.vsf",
371 ".vss": "application/vnd.visio",
372 ".vst": "application/vnd.visio",
373 ".vsw": "application/vnd.visio",
374 ".vtu": "model/vnd.vtu",
375 ".vxml": "application/voicexml+xml",
376 ".w3d": "application/x-director",
377 ".wad": "application/x-doom",
378 ".wav": "audio/x-wav",
379 ".wax": "audio/x-ms-wax",
380 ".wbmp": "image/vnd.wap.wbmp",
381 ".wbs": "application/vnd.criticaltools.wbs+xml",
382 ".wbxml": "application/vnd.wap.wbxml",
383 ".wcm": "application/vnd.ms-works",
384 ".wdb": "application/vnd.ms-works",
385 ".wiz": "application/msword",
386 ".wks": "application/vnd.ms-works",
387 ".wm": "video/x-ms-wm",
388 ".wma": "audio/x-ms-wma",
389 ".wmd": "application/x-ms-wmd",
390 ".wmf": "application/x-msmetafile",
391 ".wml": "text/vnd.wap.wml",
392 ".wmlc": "application/vnd.wap.wmlc",
393 ".wmls": "text/vnd.wap.wmlscript",
394 ".wmlsc": "application/vnd.wap.wmlscriptc",
395 ".wmv": "video/x-ms-wmv",
396 ".wmx": "video/x-ms-wmx",
397 ".wmz": "application/x-ms-wmz",
398 ".wpd": "application/vnd.wordperfect",
399 ".wpl": "application/vnd.ms-wpl",
400 ".wps": "application/vnd.ms-works",
401 ".wqd": "application/vnd.wqd",
402 ".wri": "application/x-mswrite",
403 ".wrl": "model/vrml",
404 ".wsdl": "application/wsdl+xml",
405 ".wspolicy": "application/wspolicy+xml",
406 ".wtb": "application/vnd.webturbo",
407 ".wvx": "video/x-ms-wvx",
408 ".x32": "application/x-authorware-bin",
409 ".x3d": "application/vnd.hzn-3d-crossword",
410 ".xap": "application/x-silverlight-app",
411 ".xar": "application/vnd.xara",
412 ".xbap": "application/x-ms-xbap",
413 ".xbd": "application/vnd.fujixerox.docuworks.binder",
414 ".xbm": "image/x-xbitmap",
415 ".xdm": "application/vnd.syncml.dm+xml",
416 ".xdp": "application/vnd.adobe.xdp+xml",
417 ".xdw": "application/vnd.fujixerox.docuworks",
418 ".xenc": "application/xenc+xml",
419 ".xer": "application/patch-ops-error+xml",
420 ".xfdf": "application/vnd.adobe.xfdf",
421 ".xfdl": "application/vnd.xfdl",
422 ".xht": "application/xhtml+xml",
423 ".xhtml": "application/xhtml+xml",
424 ".xhvml": "application/xv+xml",
425 ".xif": "image/vnd.xiff",
426 ".xla": "application/vnd.ms-excel",
427 ".xlam": "application/vnd.ms-excel.addin.macroenabled.12",
428 ".xlb": "application/vnd.ms-excel",
429 ".xlc": "application/vnd.ms-excel",
430 ".xlm": "application/vnd.ms-excel",
431 ".xls": "application/vnd.ms-excel",
432 ".xlsb": "application/vnd.ms-excel.sheet.binary.macroenabled.12",
433 ".xlsm": "application/vnd.ms-excel.sheet.macroenabled.12",
434 ".xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
435 ".xlt": "application/vnd.ms-excel",
436 ".xltm": "application/vnd.ms-excel.template.macroenabled.12",
437 ".xltx": "application/vnd.openxmlformats-officedocument.spreadsheetml.template",
438 ".xlw": "application/vnd.ms-excel",
439 ".xml": "application/xml",
440 ".xo": "application/vnd.olpc-sugar",
441 ".xop": "application/xop+xml",
442 ".xpdl": "application/xml",
443 ".xpi": "application/x-xpinstall",
444 ".xpm": "image/x-xpixmap",
445 ".xpr": "application/vnd.is-xpr",
446 ".xps": "application/vnd.ms-xpsdocument",
447 ".xpw": "application/vnd.intercon.formnet",
448 ".xpx": "application/vnd.intercon.formnet",
449 ".xsl": "application/xml",
450 ".xslt": "application/xslt+xml",
451 ".xsm": "application/vnd.syncml+xml",
452 ".xspf": "application/xspf+xml",
453 ".xul": "application/vnd.mozilla.xul+xml",
454 ".xvm": "application/xv+xml",
455 ".xvml": "application/xv+xml",
456 ".xwd": "image/x-xwindowdump",
457 ".xyz": "chemical/x-xyz",
458 ".zaz": "application/vnd.zzazz.deck+xml",
459 ".zip": "application/zip",
460 ".zir": "application/vnd.zul",
461 ".zirz": "application/vnd.zul",
462 ".zmm": "application/vnd.handheld-entertainment+xml"
463}
src/file-viewer/models/BlobAsset.ts deleted-55
......@@ -1,55 +0,0 @@
1const db = getDb("cache.sqlite");
2db.table(
3 "blob_assets",
4 /* SQL */ `
5 create table blob_assets (
6 hash text primary key,
7 refs integer not null default 0
8 );
9`,
10);
11/**
12 * Uncompressed files are read directly from the media store root. Compressed
13 * files are stored as `<compress store>/<first 2 chars of hash>/<hash>` Since
14 * multiple files can share the same hash, the number of references is tracked
15 * so that when a file is deleted, the compressed data is only removed when all
16 * references are gone.
17 */
18export class BlobAsset {
19 /** sha1 of the contents */
20 hash!: string;
21 refs!: number;
22}
23
24export namespace BlobAsset {
25 const getQuery = cache.prepare(/* SQL */ `
26 SELECT * FROM blob_assets WHERE hash = ?;
27 `).as(BlobAsset);
28 export function get(hash: string) {
29 return getQuery.get(hash);
30 }
31
32 const putOrIncrementQuery = cache.prepare(/* SQL */ `
33 INSERT INTO blob_assets (hash, refs) VALUES (?, 1)
34 ON CONFLICT(hash) DO UPDATE SET refs = refs + 1;
35 `);
36 export function putOrIncrement(hash: string) {
37 assert(hash.length === 40);
38 putOrIncrementQuery.get(hash);
39 return get(hash)!;
40 }
41
42 const decrementQuery = cache.prepare(/* SQL */ `
43 UPDATE blob_assets SET refs = refs - 1 WHERE hash = ? AND refs > 0;
44 `);
45 const deleteQuery = cache.prepare(/* SQL */ `
46 DELETE FROM blob_assets WHERE hash = ? AND refs <= 0;
47 `);
48 export function decrementOrDelete(hash: string) {
49 assert(hash.length === 40);
50 decrementQuery.run(hash);
51 return deleteQuery.run(hash).changes > 0;
52 }
53}
54
55import { getDb } from "#sqlite";
src/file-viewer/models/FilePermissions.ts deleted
src/file-viewer/models/MediaFile.ts deleted-51
......@@ -1,51 +0,0 @@
1import { getDb } from "#database";
2
3const db = getDb("cache.sqlite");
4
5db.table(/* SQL */ `
6 CREATE TABLE IF NOT EXISTS permissions (
7 prefix TEXT PRIMARY KEY,
8 allow INTEGER NOT NULL
9 );
10`);
11
12export class FilePermissions {
13 prefix!: string;
14 /** Currently set to 1 always */
15 allow!: number;
16
17 // -- static ops --
18
19 static getByPrefix(filePath: string): number {
20 return (getByPrefixQuery.get(filePath))?.allow ?? 0;
21 }
22 static getExact(filePath: string): number {
23 return (getExactQuery.get(filePath))?.allow ?? 0;
24 }
25 static setPermissions(dirPath: string, level: number) {
26 if (level) {
27 insertQuery.run(dirPath, level);
28 } else {
29 deleteQuery.run(dirPath);
30 }
31 }
32}
33
34const getByPrefixQuery = db.prepare(/* SQL */ `
35 SELECT allow
36 FROM permissions
37 WHERE ? GLOB prefix || '*'
38 ORDER BY LENGTH(prefix) DESC
39 LIMIT 1;
40`).type<FilePermissions>();
41
42const getExactQuery = db.prepare(/* SQL */ `
43 SELECT allow FROM permissions WHERE ? == prefix
44`).type<FilePermissions>();
45
46const insertQuery = db.prepare(/* SQL */ `
47 REPLACE INTO permissions(prefix, allow) VALUES(?, ?);
48`);
49const deleteQuery = db.prepare(/* SQL */ `
50 DELETE FROM permissions WHERE prefix = ?;
51`);
src/file-viewer/pages.off/file.cotyledon_enterance.tsx deleted-27
......@@ -1,27 +0,0 @@
1import { MediaFile } from "../db";
2import { useInlineScript } from "../framework/page-resources";
3import { Readme } from "../media/cotyledon";
4import { MediaPanel } from "../pages-dynamic/file_viewer";
5import "../media/files.css";
6
7export const theme = {
8 bg: "#312652",
9 fg: "#f0f0ff",
10 primary: "#fabe32",
11};
12
13export default function CotyledonPage() {
14 useInlineScript("canvas_cotyledon");
15 useInlineScript("file_viewer");
16 return (
17 <div class="files ctld ctld-et">
18 <MediaPanel
19 file={MediaFile.getByPath("/")!}
20 isLast={false}
21 activeFilename={null}
22 hasCotyledonCookie
23 />
24 <Readme />
25 </div>
26 );
27}
src/file-viewer/pages.off/file.cotyledon_speedbump.tsx deleted-43
......@@ -1,43 +0,0 @@
1// relativeImportPath
2function relativeImportPath(from, to) {
3 let i = 0;
4 let sepPos = -1;
5 let prevSepPos = -1;
6 let prevPrevSepPos = -1;
7 const fromLen = from.length;
8 const commonLen = Math.min(to.length, fromLen);
9 for (; i < commonLen; i++) {
10 const curChar = to[i];
11 if (curChar !== from[i])
12 break;
13 if (curChar === import_path.sep) {
14 prevPrevSepPos = prevSepPos;
15 prevSepPos = sepPos;
16 sepPos = i;
17 }
18 }
19 if (sepPos !== -1) {
20 if (hasNms(to, sepPos)) {
21 return toPosix(stripNms(to, sepPos));
22 }
23 if (prevSepPos !== -1) {
24 if (prevPrevSepPos !== -1 && to[prevSepPos + 1] === "@") {
25 prevSepPos = prevPrevSepPos;
26 }
27 if (hasNms(to, prevSepPos)) {
28 return toPosix(stripNms(to, prevSepPos));
29 }
30 }
31 }
32 if (sepPos <= 0)
33 return toPosix(to);
34 let back = 0;
35 for (; i < fromLen; i++)
36 if (from[i] === import_path.sep)
37 back++;
38 if (back) {
39 return backSep.repeat(back) + toPosix(to.slice(sepPos + 1));
40 } else {
41 return `.${toPosix(to.slice(sepPos))}`;
42 }
43}
src/file-viewer/redirects.ts deleted-284
......@@ -1,284 +0,0 @@
1// ImportInjector
2class ImportInjector {
3 constructor(path, importedSource, opts) {
4 this._defaultOpts = {
5 importedSource: null,
6 importedType: "commonjs",
7 importedInterop: "babel",
8 importingInterop: "babel",
9 ensureLiveReference: false,
10 ensureNoContext: false,
11 importPosition: "before"
12 };
13 const programPath = path.find(p => p.isProgram());
14 this._programPath = programPath;
15 this._programScope = programPath.scope;
16 this._hub = programPath.hub;
17 this._defaultOpts = this._applyDefaults(importedSource, opts, true);
18 }
19 addDefault(importedSourceIn, opts) {
20 return this.addNamed("default", importedSourceIn, opts);
21 }
22 addNamed(importName, importedSourceIn, opts) {
23 _assert(typeof importName === "string");
24 return this._generateImport(this._applyDefaults(importedSourceIn, opts), importName);
25 }
26 addNamespace(importedSourceIn, opts) {
27 return this._generateImport(this._applyDefaults(importedSourceIn, opts), null);
28 }
29 addSideEffect(importedSourceIn, opts) {
30 return this._generateImport(this._applyDefaults(importedSourceIn, opts), void 0);
31 }
32 _applyDefaults(importedSource, opts, isInit = false) {
33 let newOpts;
34 if (typeof importedSource === "string") {
35 newOpts = Object.assign({}, this._defaultOpts, {
36 importedSource
37 }, opts);
38 } else {
39 _assert(!opts, "Unexpected secondary arguments.");
40 newOpts = Object.assign({}, this._defaultOpts, importedSource);
41 }
42 if (!isInit && opts) {
43 if (opts.nameHint !== undefined) newOpts.nameHint = opts.nameHint;
44 if (opts.blockHoist !== undefined) newOpts.blockHoist = opts.blockHoist;
45 }
46 return newOpts;
47 }
48 _generateImport(opts, importName) {
49 const isDefault = importName === "default";
50 const isNamed = !!importName && !isDefault;
51 const isNamespace = importName === null;
52 const {
53 importedSource,
54 importedType,
55 importedInterop,
56 importingInterop,
57 ensureLiveReference,
58 ensureNoContext,
59 nameHint,
60 importPosition,
61 blockHoist
62 } = opts;
63 let name = nameHint || importName;
64 const isMod = (0, _isModule.default)(this._programPath);
65 const isModuleForNode = isMod && importingInterop === "node";
66 const isModuleForBabel = isMod && importingInterop === "babel";
67 if (importPosition === "after" && !isMod) {
68 throw new Error(`"importPosition": "after" is only supported in modules`);
69 }
70 const builder = new _importBuilder.default(importedSource, this._programScope, this._hub);
71 if (importedType === "es6") {
72 if (!isModuleForNode && !isModuleForBabel) {
73 throw new Error("Cannot import an ES6 module from CommonJS");
74 }
75 builder.import();
76 if (isNamespace) {
77 builder.namespace(nameHint || importedSource);
78 } else if (isDefault || isNamed) {
79 builder.named(name, importName);
80 }
81 } else if (importedType !== "commonjs") {
82 throw new Error(`Unexpected interopType "${importedType}"`);
83 } else if (importedInterop === "babel") {
84 if (isModuleForNode) {
85 name = name !== "default" ? name : importedSource;
86 const es6Default = `${importedSource}$es6Default`;
87 builder.import();
88 if (isNamespace) {
89 builder.default(es6Default).var(name || importedSource).wildcardInterop();
90 } else if (isDefault) {
91 if (ensureLiveReference) {
92 builder.default(es6Default).var(name || importedSource).defaultInterop().read("default");
93 } else {
94 builder.default(es6Default).var(name).defaultInterop().prop(importName);
95 }
96 } else if (isNamed) {
97 builder.default(es6Default).read(importName);
98 }
99 } else if (isModuleForBabel) {
100 builder.import();
101 if (isNamespace) {
102 builder.namespace(name || importedSource);
103 } else if (isDefault || isNamed) {
104 builder.named(name, importName);
105 }
106 } else {
107 builder.require();
108 if (isNamespace) {
109 builder.var(name || importedSource).wildcardInterop();
110 } else if ((isDefault || isNamed) && ensureLiveReference) {
111 if (isDefault) {
112 name = name !== "default" ? name : importedSource;
113 builder.var(name).read(importName);
114 builder.defaultInterop();
115 } else {
116 builder.var(importedSource).read(importName);
117 }
118 } else if (isDefault) {
119 builder.var(name).defaultInterop().prop(importName);
120 } else if (isNamed) {
121 builder.var(name).prop(importName);
122 }
123 }
124 } else if (importedInterop === "compiled") {
125 if (isModuleForNode) {
126 builder.import();
127 if (isNamespace) {
128 builder.default(name || importedSource);
129 } else if (isDefault || isNamed) {
130 builder.default(importedSource).read(name);
131 }
132 } else if (isModuleForBabel) {
133 builder.import();
134 if (isNamespace) {
135 builder.namespace(name || importedSource);
136 } else if (isDefault || isNamed) {
137 builder.named(name, importName);
138 }
139 } else {
140 builder.require();
141 if (isNamespace) {
142 builder.var(name || importedSource);
143 } else if (isDefault || isNamed) {
144 if (ensureLiveReference) {
145 builder.var(importedSource).read(name);
146 } else {
147 builder.prop(importName).var(name);
148 }
149 }
150 }
151 } else if (importedInterop === "uncompiled") {
152 if (isDefault && ensureLiveReference) {
153 throw new Error("No live reference for commonjs default");
154 }
155 if (isModuleForNode) {
156 builder.import();
157 if (isNamespace) {
158 builder.default(name || importedSource);
159 } else if (isDefault) {
160 builder.default(name);
161 } else if (isNamed) {
162 builder.default(importedSource).read(name);
163 }
164 } else if (isModuleForBabel) {
165 builder.import();
166 if (isNamespace) {
167 builder.default(name || importedSource);
168 } else if (isDefault) {
169 builder.default(name);
170 } else if (isNamed) {
171 builder.named(name, importName);
172 }
173 } else {
174 builder.require();
175 if (isNamespace) {
176 builder.var(name || importedSource);
177 } else if (isDefault) {
178 builder.var(name);
179 } else if (isNamed) {
180 if (ensureLiveReference) {
181 builder.var(importedSource).read(name);
182 } else {
183 builder.var(name).prop(importName);
184 }
185 }
186 }
187 } else {
188 throw new Error(`Unknown importedInterop "${importedInterop}".`);
189 }
190 const {
191 statements,
192 resultName
193 } = builder.done();
194 this._insertStatements(statements, importPosition, blockHoist);
195 if ((isDefault || isNamed) && ensureNoContext && resultName.type !== "Identifier") {
196 return sequenceExpression([numericLiteral(0), resultName]);
197 }
198 return resultName;
199 }
200 _insertStatements(statements, importPosition = "before", blockHoist = 3) {
201 if (importPosition === "after") {
202 if (this._insertStatementsAfter(statements)) return;
203 } else {
204 if (this._insertStatementsBefore(statements, blockHoist)) return;
205 }
206 this._programPath.unshiftContainer("body", statements);
207 }
208 _insertStatementsBefore(statements, blockHoist) {
209 if (statements.length === 1 && isImportDeclaration(statements[0]) && isValueImport(statements[0])) {
210 const firstImportDecl = this._programPath.get("body").find(p => {
211 return p.isImportDeclaration() && isValueImport(p.node);
212 });
213 if ((firstImportDecl == null ? void 0 : firstImportDecl.node.source.value) === statements[0].source.value && maybeAppendImportSpecifiers(firstImportDecl.node, statements[0])) {
214 return true;
215 }
216 }
217 statements.forEach(node => {
218 node._blockHoist = blockHoist;
219 });
220 const targetPath = this._programPath.get("body").find(p => {
221 const val = p.node._blockHoist;
222 return Number.isFinite(val) && val < 4;
223 });
224 if (targetPath) {
225 targetPath.insertBefore(statements);
226 return true;
227 }
228 return false;
229 }
230 _insertStatementsAfter(statements) {
231 const statementsSet = new Set(statements);
232 const importDeclarations = new Map();
233 for (const statement of statements) {
234 if (isImportDeclaration(statement) && isValueImport(statement)) {
235 const source = statement.source.value;
236 if (!importDeclarations.has(source)) importDeclarations.set(source, []);
237 importDeclarations.get(source).push(statement);
238 }
239 }
240 let lastImportPath = null;
241 for (const bodyStmt of this._programPath.get("body")) {
242 if (bodyStmt.isImportDeclaration() && isValueImport(bodyStmt.node)) {
243 lastImportPath = bodyStmt;
244 const source = bodyStmt.node.source.value;
245 const newImports = importDeclarations.get(source);
246 if (!newImports) continue;
247 for (const decl of newImports) {
248 if (!statementsSet.has(decl)) continue;
249 if (maybeAppendImportSpecifiers(bodyStmt.node, decl)) {
250 statementsSet.delete(decl);
251 }
252 }
253 }
254 }
255 if (statementsSet.size === 0) return true;
256 if (lastImportPath) lastImportPath.insertAfter(Array.from(statementsSet));
257 return !!lastImportPath;
258 }
259}
260
261// addDefault
262function addDefault(path, importedSource, opts) {
263 return new _importInjector.default(path).addDefault(importedSource, opts);
264}
265
266// addNamed
267function addNamed(path, name, importedSource, opts) {
268 return new _importInjector.default(path).addNamed(name, importedSource, opts);
269}
270
271// addNamespace
272function addNamespace(path, importedSource, opts) {
273 return new _importInjector.default(path).addNamespace(importedSource, opts);
274}
275
276// addSideEffect
277function addSideEffect(path, importedSource, opts) {
278 return new _importInjector.default(path).addSideEffect(importedSource, opts);
279}
280
281// isModule
282function isModule(path) {
283 return path.node.sourceType === "module";
284}
src/file-viewer/scan.ts deleted-1008
......@@ -1,1008 +0,0 @@
1// This file was started by AI and maintained by hand since.
2import "@paperclover/console/inject";
3import { Progress } from "@paperclover/console/Progress";
4import { Spinner } from "@paperclover/console/Spinner";
5import assert from "node:assert";
6import { execFile } from "node:child_process";
7import { existsSync, Stats } from "node:fs";
8import * as fsp from "node:fs/promises";
9import * as path from "node:path";
10import { promisify } from "node:util";
11import { BlobAsset, cache, MediaFile } from "../db.ts";
12import { formatDate, formatSize } from "./share.ts";
13import { highlightCode, type Language } from "./highlight.ts";
14import process from "node:process";
15
16const execFileAsync = promisify(execFile);
17
18// Configuration
19const FILE_ROOT = process.env.SCAN_FILE_ROOT;
20if (!FILE_ROOT) {
21 throw new Error(
22 "FILE_ROOT environment variable not set (e.g. '/path/to/files')",
23 );
24}
25const LOCAL_DIR = path.resolve(FILE_ROOT);
26const DRY_RUN = process.argv.includes("--dry-run");
27const SHOULD_COMPRESS = true;
28const VERBOSE = process.argv.includes("--verbose");
29const SHOULD_SCRUB = true;
30const COMPRESS_STORE = process.env.COMPRESS_STORE ||
31 path.join(process.cwd(), ".clover/compressed");
32
33// Helper function for logging that respects verbose flag
34function log(message: string, always = false): void {
35 if (always || VERBOSE) {
36 console.log(message);
37 }
38}
39
40// File extensions that need duration metadata
41const MEDIA_EXTENSIONS = new Set([
42 ".mp4",
43 ".mkv",
44 ".webm",
45 ".avi",
46 ".mov",
47 ".mp3",
48 ".flac",
49 ".wav",
50 ".ogg",
51 ".m4a",
52]);
53
54// File extensions that need dimension metadata
55const IMAGE_EXTENSIONS = new Set([
56 ".jpg",
57 ".jpeg",
58 ".png",
59 ".gif",
60 ".webp",
61 ".avif",
62 ".heic",
63 ".svg",
64]);
65
66const VIDEO_EXTENSIONS = new Set([".mp4", ".mkv", ".webm", ".avi", ".mov"]);
67
68// File extensions that need metadata scrubbing
69const SCRUB_EXTENSIONS = new Set([
70 ".jpg",
71 ".jpeg",
72 ".png",
73 ".mov",
74 ".mp4",
75 ".m4a",
76]);
77
78const CODE_EXTENSIONS: Record<string, Language> = {
79 ".json": "json",
80 ".toml": "toml",
81 ".ts": "ts",
82 ".js": "ts",
83 ".tsx": "tsx",
84 ".jsx": "tsx",
85 ".css": "css",
86 ".py": "python",
87 ".lua": "lua",
88 ".sh": "shell",
89 ".bat": "dosbatch",
90 ".ps1": "powershell",
91 ".cmd": "dosbatch",
92 ".yaml": "yaml",
93 ".yml": "yaml",
94 ".zig": "zig",
95 ".astro": "astro",
96 ".mdx": "mdx",
97 ".xml": "xml",
98 ".jsonc": "json",
99 ".php": "php",
100 ".patch": "diff",
101 ".diff": "diff",
102};
103
104const READ_CONTENTS_EXTENSIONS = new Set([".txt", ".chat"]);
105
106// For files that have changed indexing logic, update the date here rescanning
107// will reconstruct the entire file object. This way you can incrementally
108// update new file types without having to reindex everything.
109const lastUpdateTypes: Record<string, Date> = {};
110lastUpdateTypes[".lnk"] = new Date("2025-05-13 13:58:00");
111for (const ext in CODE_EXTENSIONS) {
112 lastUpdateTypes[ext] = new Date("2025-05-13 13:58:00");
113}
114for (const ext of READ_CONTENTS_EXTENSIONS) {
115 lastUpdateTypes[ext] = new Date("2025-05-13 13:58:00");
116}
117lastUpdateTypes[".diff"] = new Date("2025-05-18 13:58:00");
118lastUpdateTypes[".patch"] = new Date("2025-05-18 13:58:00");
119
120// Helper functions for metadata extraction
121async function calculateHash(filePath: string): Promise<string> {
122 try {
123 const hash = await execFileAsync("sha1sum", [filePath]);
124 return hash.stdout.split(" ")[0];
125 } catch (error) {
126 console.error(`Error calculating hash for ${filePath}:`, error);
127 throw error;
128 }
129}
130
131async function calculateDuration(filePath: string): Promise<number> {
132 try {
133 const ext = path.extname(filePath).toLowerCase();
134 if (!MEDIA_EXTENSIONS.has(ext)) return 0;
135
136 const { stdout } = await execFileAsync("ffprobe", [
137 "-v",
138 "error",
139 "-show_entries",
140 "format=duration",
141 "-of",
142 "default=noprint_wrappers=1:nokey=1",
143 filePath,
144 ]);
145 return Math.ceil(parseFloat(stdout.trim()));
146 } catch (error) {
147 console.error(`Error calculating duration for ${filePath}:`, error);
148 return 0; // Return 0 for duration on error
149 }
150}
151
152async function calculateDimensions(filePath: string): Promise<string> {
153 const ext = path.extname(filePath).toLowerCase();
154 if (!IMAGE_EXTENSIONS.has(ext) && !VIDEO_EXTENSIONS.has(ext)) return "";
155
156 try {
157 if (ext === ".svg") {
158 // For SVG files, parse the file and extract width/height
159 const content = await fsp.readFile(filePath, "utf8");
160 const widthMatch = content.match(/width="(\d+)"/);
161 const heightMatch = content.match(/height="(\d+)"/);
162
163 if (widthMatch && heightMatch) {
164 return `${widthMatch[1]}x${heightMatch[1]}`;
165 }
166 } else if (IMAGE_EXTENSIONS.has(ext) || VIDEO_EXTENSIONS.has(ext)) {
167 // Use ffprobe for images and videos
168 const { stdout } = await execFileAsync("ffprobe", [
169 "-v",
170 "error",
171 "-select_streams",
172 "v:0",
173 "-show_entries",
174 "stream=width,height",
175 "-of",
176 "csv=s=x:p=0",
177 filePath,
178 ]);
179 return stdout.trim();
180 }
181 } catch (error) {
182 console.error(`Error calculating dimensions for ${filePath}:`, error);
183 }
184
185 return "";
186}
187
188// Helper function to check and remove location metadata
189async function scrubLocationMetadata(
190 filePath: string,
191 stats: Stats,
192): Promise<boolean> {
193 try {
194 const ext = path.extname(filePath).toLowerCase();
195 if (!SCRUB_EXTENSIONS.has(ext)) return false;
196
197 let hasLocation = false;
198 let args: string[] = [];
199
200 // Check for location metadata based on file type
201 const tempOutput = path.join(
202 path.dirname(filePath),
203 `._${path.basename(filePath)}.temp`,
204 );
205 switch (ext) {
206 case ".jpg":
207 case ".jpeg":
208 case ".png":
209 // Check for GPS tags in EXIF
210 const { stdout: gpsCheck } = await execFileAsync("exiftool", [
211 "-gps:all",
212 filePath,
213 ]);
214 hasLocation = gpsCheck.trim().length > 0;
215 args = ["-gps:all=", filePath, "-o", tempOutput];
216 break;
217 case ".mov":
218 case ".mp4":
219 // Check for GPS metadata in video files
220 const { stdout: videoCheck } = await execFileAsync("exiftool", [
221 "-ee",
222 "-G3",
223 "-s",
224 filePath,
225 ]);
226 hasLocation = videoCheck.includes("GPS") ||
227 videoCheck.includes("Location");
228 args = ["-gps:all=", "-xmp:all=", filePath, "-o", tempOutput];
229 break;
230 case ".m4a":
231 // Check for location and other metadata in m4a files
232 const { stdout: m4aCheck } = await execFileAsync("exiftool", [
233 "-ee",
234 "-G3",
235 "-s",
236 filePath,
237 ]);
238 hasLocation = m4aCheck.includes("GPS") ||
239 m4aCheck.includes("Location") ||
240 m4aCheck.includes("Filename") ||
241 m4aCheck.includes("Title");
242
243 if (hasLocation) {
244 args = [
245 "-gps:all=",
246 "-location:all=",
247 "-filename:all=",
248 "-title=",
249 "-m4a:all=",
250 filePath,
251 "-o",
252 tempOutput,
253 ];
254 }
255 break;
256 }
257
258 const accessTime = stats.atime;
259 const modTime = stats.mtime;
260
261 let backup: string | null = null;
262 try {
263 if (hasLocation) {
264 if (DRY_RUN) return true;
265
266 // Prepare a backup
267 const tmp = path.join(
268 path.dirname(filePath),
269 `._${path.basename(filePath)}.backup`,
270 );
271 await fsp.copyFile(filePath, tmp);
272 await fsp.utimes(tmp, accessTime, modTime);
273 backup = tmp;
274
275 // Remove metadata
276 await execFileAsync("exiftool", args);
277 if (!existsSync(tempOutput)) {
278 throw new Error(`Failed to create output file: ${tempOutput}`);
279 }
280
281 // Restore original timestamps
282 await fsp.rename(tempOutput, filePath);
283 await fsp.utimes(filePath, accessTime, modTime);
284
285 // Backup is no longer needed
286 await fsp.unlink(backup);
287
288 log(
289 `Scrubbed location metadata in ${path.relative(LOCAL_DIR, filePath)}`,
290 true,
291 );
292 return true;
293 }
294 } catch (error) {
295 if (backup) {
296 await fsp.rename(backup, filePath);
297 }
298 if (existsSync(tempOutput)) {
299 await fsp.unlink(tempOutput);
300 }
301 throw error;
302 }
303 } catch (error) {
304 console.error(`Error scrubbing metadata for ${filePath}:`, error);
305 }
306
307 return false;
308}
309
310// Queue implementation for parallel processing
311type AsyncQueueProcessor<T> = (s: Spinner, item: T) => Promise<void>;
312class AsyncQueue<T> {
313 private queue: T[] = [];
314 private running = 0;
315 private maxConcurrent: number;
316 private processed = 0;
317 private progress?: Progress<{ active: Spinner[] }>;
318 private name: string;
319 private estimate?: number;
320
321 constructor(name: string, maxConcurrent: number) {
322 this.maxConcurrent = maxConcurrent;
323 this.name = name;
324 }
325
326 setEstimate(estimate: number) {
327 this.estimate = estimate;
328 if (this.progress) {
329 this.progress.total = Math.max(
330 this.processed + this.queue.length,
331 estimate,
332 );
333 }
334 }
335
336 getProgress() {
337 if (!this.progress) {
338 this.progress = new Progress({
339 spinner: null,
340 text: ({ active }) => {
341 const now = performance.now();
342 let text = `[${this.processed}/${
343 this.processed + this.queue.length
344 }] ${this.name}`;
345 let n = 0;
346 for (const item of active) {
347 let itemText = "- " + item.format(now);
348 text += `\n` +
349 itemText.slice(0, Math.max(0, process.stdout.columns - 1));
350 if (n > 10) {
351 text += `\n ... + ${active.length - n} more`;
352 break;
353 }
354 n++;
355 }
356 return text;
357 },
358 props: {
359 active: [] as Spinner[],
360 },
361 });
362 this.progress.total = this.estimate ?? 0;
363 this.progress.value = 0;
364 this.progress.fps = 30;
365 }
366 return this.progress;
367 }
368
369 async add(item: T, processor: AsyncQueueProcessor<T>): Promise<void> {
370 this.queue.push(item);
371 this.getProgress().total = Math.max(
372 this.processed + this.queue.length,
373 this.estimate ?? 0,
374 );
375 return this.processNext(processor);
376 }
377
378 async addBatch(items: T[], processor: AsyncQueueProcessor<T>): Promise<void> {
379 this.queue.push(...items);
380 this.getProgress().total = Math.max(
381 this.processed + this.queue.length,
382 this.estimate ?? 0,
383 );
384 return this.processNext(processor);
385 }
386
387 private async processNext(processor: AsyncQueueProcessor<T>): Promise<void> {
388 if (this.running >= this.maxConcurrent || this.queue.length === 0) {
389 return;
390 }
391
392 const item = this.queue.shift();
393 if (!item) return;
394
395 this.running++;
396
397 try {
398 const progress = this.getProgress();
399
400 let itemText = "";
401 if (typeof item === "string") {
402 itemText = item;
403 } else if (typeof item === "object" && item !== null && "path" in item) {
404 itemText = "" + item.path;
405 } else {
406 itemText = JSON.stringify(item);
407 }
408 if (itemText.startsWith(LOCAL_DIR)) {
409 itemText = path.relative(LOCAL_DIR, itemText);
410 }
411
412 const spinner = new Spinner(itemText);
413 spinner.stop();
414 progress.props.active.unshift(spinner);
415 await processor(spinner, item);
416 progress.props = {
417 active: progress.props.active.filter((s) => s !== spinner),
418 };
419 this.processed++;
420 progress.value = this.processed;
421 } catch (error) {
422 console.error(`Error processing ${this.name} queue item:`, error);
423 this.processed++;
424 this.getProgress().value = this.processed;
425 } finally {
426 this.running--;
427 await this.processNext(processor);
428 }
429 }
430
431 async waitForCompletion(): Promise<void> {
432 if (this.queue.length === 0 && this.running === 0) {
433 if (this.processed > 0) {
434 this.#success();
435 }
436 return;
437 }
438
439 return new Promise((resolve) => {
440 const checkInterval = setInterval(() => {
441 if (this.queue.length === 0 && this.running === 0) {
442 clearInterval(checkInterval);
443 this.#success();
444 resolve();
445 }
446 }, 100);
447 });
448 }
449
450 #success() {
451 this.getProgress().success(`${this.processed} ${this.name}`);
452 }
453}
454
455function skipBasename(basename: string): boolean {
456 // dot files must be incrementally tracked
457 if (basename === ".dirsort") return true;
458
459 return (
460 basename.startsWith(".") ||
461 basename.startsWith("._") ||
462 basename === ".DS_Store" ||
463 basename.toLowerCase() === "thumbs.db" ||
464 basename.toLowerCase() === "desktop.ini"
465 );
466}
467
468// File system scanner
469class FileSystemScanner {
470 private visitedPaths = new Set<string>();
471 private previousPaths = new Set<string>();
472 private dirQueue = new AsyncQueue<string>("Scan Directories", 10);
473 private fileQueue = new AsyncQueue<{ path: string; stat: any }>(
474 "File metadata",
475 20,
476 );
477 private compressQueue: AsyncQueue<{ file: MediaFile; path: string }> | null =
478 SHOULD_COMPRESS ? new AsyncQueue("Compress Assets", 10) : null;
479
480 private getDbPath(localPath: string): string {
481 // Convert local file system path to database path
482 const relativePath = path.relative(LOCAL_DIR, localPath);
483 return "/" + relativePath.split(path.sep).join(path.posix.sep);
484 }
485
486 private getLocalPath(dbPath: string): string {
487 // Convert database path to local file system path
488 return path.join(LOCAL_DIR, dbPath.slice(1));
489 }
490
491 async scanFile(s: Spinner, filePath: string, stat: any): Promise<void> {
492 const dbPath = this.getDbPath(filePath);
493
494 // Skip hidden files
495 const basename = path.basename(filePath);
496 if (skipBasename(basename)) {
497 return;
498 }
499
500 this.visitedPaths.add(dbPath);
501
502 // Get existing file info from db
503 const existingFile = MediaFile.getByPath(dbPath);
504
505 // Determine which date to use (for date protection)
506 let dateToUse = stat.mtime;
507 const year2025Start = new Date("2025-01-01T00:00:00Z");
508
509 if (
510 existingFile &&
511 existingFile.date < year2025Start &&
512 stat.mtime >= year2025Start
513 ) {
514 console.error(
515 `Error: ${dbPath} is ${
516 formatDate(
517 existingFile.date,
518 )
519 }, got modified to ${formatDate(stat.mtime)}`,
520 );
521 dateToUse = existingFile.date;
522 }
523
524 // Check if we need to reprocess the file
525 if (existingFile && existingFile.size === stat.size && existingFile.hash) {
526 maybe_skip: {
527 const lastUpdateDate = lastUpdateTypes[path.extname(filePath)];
528 if (lastUpdateDate && existingFile.lastUpdateDate < lastUpdateDate) {
529 console.log(
530 `Reprocessing ${dbPath} because indexing logic changed after ${
531 formatDate(
532 lastUpdateDate,
533 )
534 }`,
535 );
536 break maybe_skip;
537 }
538
539 if (SHOULD_COMPRESS && existingFile.processed !== 2) {
540 this.compressQueue!.add(
541 { file: existingFile, path: dbPath },
542 this.compressFile.bind(this),
543 );
544 }
545
546 // File hasn't changed, no need to reprocess
547 MediaFile.createFile({
548 path: dbPath,
549 date: dateToUse,
550 hash: existingFile.hash,
551 size: stat.size,
552 duration: existingFile.duration,
553 dimensions: existingFile.dimensions,
554 content: existingFile.contents,
555 });
556 return;
557 }
558 }
559
560 // Process the file
561 log(`Processing file: ${dbPath}`);
562
563 // Scrub location metadata if needed
564 if (SHOULD_SCRUB) {
565 if (await scrubLocationMetadata(filePath, stat)) {
566 // Re-stat the file in case it was modified
567 const newStat = await fsp.stat(filePath);
568 stat.size = newStat.size;
569 }
570 }
571
572 // Extract content
573 const hash = await calculateHash(filePath);
574 let content = "";
575 if (filePath.endsWith(".lnk")) {
576 content = (await fsp.readFile(filePath, "utf8")).trim();
577 }
578 const language = CODE_EXTENSIONS[path.extname(filePath)];
579 if (language) {
580 read_code: {
581 // An issue is that .ts is an overloaded extension, shared between
582 // 'transport stream' and 'typescript'.
583 //
584 // Filter used here is:
585 // - more than 1mb
586 // - invalid UTF-8
587 if (stat.size > 1_000_000) break read_code;
588 let code;
589 const buf = await fsp.readFile(filePath);
590 try {
591 code = new TextDecoder("utf-8", { fatal: true }).decode(buf);
592 } catch (error) {
593 break read_code;
594 }
595 content = await highlightCode(code, language);
596 }
597 }
598 if (!content && READ_CONTENTS_EXTENSIONS.has(path.extname(filePath))) {
599 content = await fsp.readFile(filePath, "utf8");
600 }
601 // End extract content
602
603 if (hash === existingFile?.hash) {
604 MediaFile.createFile({
605 path: dbPath,
606 date: dateToUse,
607 hash,
608 size: stat.size,
609 duration: existingFile.duration,
610 dimensions: existingFile.dimensions,
611 content,
612 });
613 return;
614 } else if (existingFile) {
615 if (existingFile.processed === 2) {
616 if (BlobAsset.decrementOrDelete(existingFile.hash)) {
617 log(
618 `Deleted compressed asset ${existingFile.hash}.{gzip, zstd}`,
619 true,
620 );
621 await fsp.unlink(
622 path.join(
623 COMPRESS_STORE,
624 existingFile.hash.substring(0, 2),
625 existingFile.hash + ".gz",
626 ),
627 );
628 await fsp.unlink(
629 path.join(
630 COMPRESS_STORE,
631 existingFile.hash.substring(0, 2),
632 existingFile.hash + ".zstd",
633 ),
634 );
635 }
636 }
637 }
638 const [duration, dimensions] = await Promise.all([
639 calculateDuration(filePath),
640 calculateDimensions(filePath),
641 ]);
642
643 // Update database with all metadata
644 MediaFile.createFile({
645 path: dbPath,
646 date: dateToUse,
647 hash,
648 size: stat.size,
649 duration,
650 dimensions,
651 content,
652 });
653
654 if (SHOULD_COMPRESS) {
655 this.compressQueue!.add(
656 {
657 file: MediaFile.getByPath(dbPath)!,
658 path: dbPath,
659 },
660 this.compressFile.bind(this),
661 );
662 }
663 }
664
665 async compressFile(s: Spinner, { file }: { file: MediaFile }): Promise<void> {
666 log(`Compressing file: ${file.path}`);
667 if (DRY_RUN) return;
668
669 const filePath = path.join(FILE_ROOT!, file.path);
670
671 const hash = file.hash;
672 const firstTwoChars = hash.substring(0, 2);
673 const compressDir = `${COMPRESS_STORE}/${firstTwoChars}`;
674 const compressPath = `${compressDir}/${hash}`;
675
676 // Create directory structure if it doesn't exist
677 await fsp.mkdir(compressDir, { recursive: true });
678
679 // Compress the file with gzip
680 const blob = BlobAsset.putOrIncrement(hash);
681 if (blob.refs > 1) {
682 log(
683 `Skipping compression of ${filePath} because it already exists in ${compressPath}`,
684 );
685 return;
686 }
687 // Check if already exists
688 if (existsSync(compressPath + ".gz")) {
689 file.setCompressed(true);
690 return;
691 }
692 try {
693 const gzipProcess = Bun.spawn(["gzip", "-c", filePath, "-9"], {
694 stdout: Bun.file(compressPath + ".gz"),
695 });
696 const zstdProcess = Bun.spawn(["zstd", "-c", filePath, "-9"], {
697 stdout: Bun.file(compressPath + ".zstd"),
698 });
699 const [gzipExited, zstdExited] = await Promise.all([
700 gzipProcess.exited,
701 zstdProcess.exited,
702 ]);
703 assert(gzipExited === 0);
704 assert(zstdExited === 0);
705 assert(existsSync(compressPath + ".gz"));
706 assert(existsSync(compressPath + ".zstd"));
707 file.setCompressed(true);
708 } catch (error) {
709 console.error(`Error compressing file ${filePath}:`, error);
710 BlobAsset.decrementOrDelete(hash);
711 file.setCompressed(false);
712 }
713 }
714
715 async scanDirectory(s: Spinner, dirPath: string): Promise<void> {
716 const dbPath = this.getDbPath(dirPath);
717
718 this.visitedPaths.add(dbPath);
719
720 // Create or update directory entry
721 log(`Scanning directory: ${dbPath}`);
722 if (!DRY_RUN) {
723 MediaFile.createOrUpdateDirectory(dbPath);
724 }
725
726 try {
727 const entries = await fsp.readdir(dirPath, { withFileTypes: true });
728
729 // Process files and subdirectories
730 for (const entry of entries) {
731 const entryPath = path.join(dirPath, entry.name);
732
733 // Skip hidden files and system files
734 if (skipBasename(entry.name)) {
735 continue;
736 }
737
738 if (entry.isDirectory()) {
739 // Queue subdirectory for scanning
740 this.dirQueue.add(entryPath, this.scanDirectory.bind(this));
741 } else if (entry.isFile()) {
742 // Queue file for processing
743 const stat = await fsp.stat(entryPath);
744
745 this.fileQueue.add(
746 { path: entryPath, stat },
747 async (s, item) => await this.scanFile(s, item.path, item.stat),
748 );
749 }
750 }
751 } catch (error) {
752 console.error(`Error scanning directory ${dirPath}:`, error);
753 }
754 }
755
756 async processDirectoryMetadata(dirPath: string): Promise<void> {
757 const dbPath = this.getDbPath(dirPath);
758 const dir = MediaFile.getByPath(dbPath);
759
760 if (!dir || dir.kind !== MediaFile.Kind.directory) {
761 return;
762 }
763
764 if (DRY_RUN) return;
765
766 const children = dir.getChildren();
767
768 // Calculate directory metadata
769 let totalSize = 0;
770 let newestDate = new Date(0);
771 let allHashes = "";
772
773 // Check for readme.txt
774 let readmeContent = "";
775
776 try {
777 readmeContent = await fsp.readFile(
778 path.join(dirPath, "readme.txt"),
779 "utf8",
780 );
781 } catch (error: any) {
782 console.info(`no readme ${dirPath}`);
783 if (error.code !== "ENOENT") {
784 console.error(`Error reading readme.txt in ${dirPath}:`, error);
785 }
786 }
787
788 let dirsort: string[] | null = null;
789 try {
790 dirsort = (await fsp.readFile(path.join(dirPath, ".dirsort"), "utf8"))
791 .split("\n")
792 .map((x) => x.trim())
793 .filter(Boolean);
794 } catch (error: any) {
795 if (error.code !== "ENOENT") {
796 console.error(`Error reading .dirsort in ${dirPath}:`, error);
797 }
798 }
799
800 // Process children
801 for (const child of children) {
802 totalSize += child.size;
803 allHashes += child.hash;
804
805 // Update newest date, ignoring readme.txt
806 if (!child.path.endsWith("/readme.txt") && child.date > newestDate) {
807 newestDate = child.date;
808 }
809 }
810
811 // Create a hash for the directory
812 const dirHash = new Bun.CryptoHasher("sha1")
813 .update(dbPath + allHashes)
814 .digest("hex");
815
816 // Update directory metadata
817 MediaFile.markDirectoryProcessed({
818 id: dir.id,
819 timestamp: newestDate,
820 contents: readmeContent,
821 size: totalSize,
822 hash: dirHash,
823 dirsort,
824 });
825 }
826
827 async findDeletedFiles(): Promise<void> {
828 if (DRY_RUN) return;
829
830 // Find all paths that exist in the DB but not in the filesystem
831 const deletedPaths = Array.from(this.previousPaths).filter(
832 (path) => !this.visitedPaths.has(path),
833 );
834
835 for (const dbPath of deletedPaths) {
836 const file = MediaFile.getByPath(dbPath);
837 if (!file) continue;
838
839 log(`Item Deleted: ${dbPath}`, true);
840 if (file.processed === 2) {
841 if (BlobAsset.decrementOrDelete(file.hash)) {
842 log(`Deleted compressed asset ${file.hash}.{gzip, zstd}`, true);
843 await fsp.unlink(
844 path.join(
845 COMPRESS_STORE,
846 file.hash.substring(0, 2),
847 file.hash + ".gz",
848 ),
849 );
850 await fsp.unlink(
851 path.join(
852 COMPRESS_STORE,
853 file.hash.substring(0, 2),
854 file.hash + ".zstd",
855 ),
856 );
857 }
858 }
859 MediaFile.deleteByPath(dbPath);
860 }
861 }
862
863 async loadPreviousPaths(): Promise<void> {
864 // Get all files and directories from the database
865 // This uses a custom query to get all paths at once
866 const getAllPathsQuery = cache
867 .prepare(`SELECT path, kind FROM media_files`)
868 .all() as {
869 path: string;
870 kind: MediaFile.Kind;
871 }[];
872
873 let dirs = 0;
874 let files = 0;
875 for (const row of getAllPathsQuery) {
876 this.previousPaths.add(row.path);
877 if (row.kind === MediaFile.Kind.directory) {
878 dirs++;
879 } else {
880 files++;
881 }
882 }
883
884 this.dirQueue.setEstimate(dirs);
885 this.fileQueue.setEstimate(files);
886
887 // log(`Loaded ${this.previousPaths.size} paths from database`, true);
888 }
889
890 async scan(): Promise<void> {
891 log(`Starting file system scan in ${LOCAL_DIR}`, true);
892
893 // Check if the root directory exists and is accessible
894 try {
895 const rootStat = await fsp.stat(LOCAL_DIR);
896 if (!rootStat.isDirectory()) {
897 throw new Error(`${LOCAL_DIR} is not a directory`);
898 }
899 } catch (error) {
900 console.error(`Error: Cannot access root directory ${LOCAL_DIR}`, error);
901 console.error(
902 `Aborting scan to prevent database corruption. Please check if the volume is mounted.`,
903 );
904 process.exit(1);
905 }
906
907 await this.loadPreviousPaths();
908
909 await this.dirQueue.add(LOCAL_DIR, this.scanDirectory.bind(this));
910
911 await this.dirQueue.waitForCompletion();
912 await this.fileQueue.waitForCompletion();
913
914 await this.findDeletedFiles();
915
916 const allDirs = Array.from(this.visitedPaths)
917 .filter((path) => {
918 const file = MediaFile.getByPath(path);
919 return file && file.kind === MediaFile.Kind.directory;
920 })
921 .sort((a, b) => b.length - a.length);
922
923 const dirMetadataQueue = new AsyncQueue<string>("Directory Metadata", 10);
924 for (const dirPath of allDirs) {
925 await this.processDirectoryMetadata(this.getLocalPath(dirPath));
926 }
927
928 await dirMetadataQueue.waitForCompletion();
929
930 if (SHOULD_COMPRESS) {
931 await this.compressQueue!.waitForCompletion();
932 }
933
934 log("Scan completed successfully!", true);
935 }
936}
937
938// Main execution
939function showHelp() {
940 console.log(`
941MediaFile Scanner - Index filesystem content for paperclover.net
942
943Environment variables:
944 FILE_ROOT Required. Path to the directory to scan
945 COMPRESS_STORE Optional. Path to store compressed files (default: .clover/compressed)
946
947Options:
948 --help Show this help message
949 --dry-run Don't make any changes to the database
950 --verbose Show detailed output
951
952Usage:
953 bun ./media/scan.ts [options]
954
955`);
956 process.exit(0);
957}
958
959{
960 // Show help if requested
961 if (process.argv.includes("--help")) {
962 showHelp();
963 process.exit(0);
964 }
965
966 // Check if the root directory exists before starting
967 if (!existsSync(LOCAL_DIR)) {
968 console.error(
969 `Error: Root directory ${LOCAL_DIR} does not exist or is not accessible.`,
970 );
971 console.error(`Please check if the volume is mounted correctly.`);
972 process.exit(1);
973 }
974
975 const startTime = Date.now();
976
977 try {
978 const scanner = new FileSystemScanner();
979 await scanner.scan();
980
981 const endTime = Date.now();
982 log(`Scan completed in ${(endTime - startTime) / 1000} seconds`, true);
983
984 const rootDir = MediaFile.getByPath("/")!;
985 const totalEntries = cache
986 .prepare(`SELECT COUNT(*) as count FROM media_files`)
987 .get() as { count: number };
988 const totalDuration = cache
989 .prepare(`SELECT SUM(duration) as duration FROM media_files`)
990 .get() as { duration: number };
991 console.log();
992 console.log("Global Stats");
993 console.log(` Entry count: ${totalEntries.count}`);
994 console.log(` Uncompressed size: ${formatSize(rootDir.size)}`);
995 console.log(
996 ` Total audio/video duration: ${
997 (
998 totalDuration.duration /
999 60 /
1000 60
1001 ).toFixed(1)
1002 } hours`,
1003 );
1004 } catch (error) {
1005 console.error("Error during scan:", error);
1006 process.exit(1);
1007 }
1008}
src/file-viewer/scripts/canvas_2017.client.ts deleted-233
......@@ -1,233 +0,0 @@
1// Vibe coded with AI
2(globalThis as any).canvas_2017 = function (canvas: HTMLCanvasElement) {
3 const isStandalone = canvas.getAttribute("data-standalone") === "true";
4 // Configuration interface for the checkerboard effect
5 interface CheckerboardConfig {
6 fps: number; // frames per second
7 color1: string; // first checkerboard color
8 color2: string; // second checkerboard color
9 opacity: number; // opacity of each checkerboard (0-1)
10 speedX1: number; // horizontal speed of first checkerboard (pixels per second)
11 speedY1: number; // vertical speed of first checkerboard (pixels per second)
12 speedX2: number; // horizontal speed of second checkerboard (pixels per second)
13 speedY2: number; // vertical speed of second checkerboard (pixels per second)
14 baseTileSize: number; // base size of checkerboard tiles
15 sizeVariation: number; // maximum variation in tile size (pixels)
16 sineFrequency1: number; // frequency of first sine wave for size variation
17 sineFrequency2: number; // frequency of second sine wave for size variation
18 sineOffset: number; // offset between the two sine waves (radians)
19 rotation: number; // rotation in degrees for the entire pattern
20 rotation2: number; // rotation in degrees for the entire pattern
21 }
22
23 // Default configuration
24 const config: CheckerboardConfig = {
25 fps: 30,
26 color1: "#1A1C17",
27 color2: "#1A1C17",
28 opacity: 0.3,
29 speedX1: -0.02, // moving left slowly
30 speedY1: -0.01, // moving up slowly
31 speedX2: -0.015, // moving left (slightly slower)
32 speedY2: 0.012, // moving down slowly
33 baseTileSize: 200,
34 sizeVariation: 1.5,
35 sineFrequency1: 0.0005,
36 sineFrequency2: 0.0008,
37 sineOffset: Math.PI / 2, // 90 degrees offset
38 rotation: 2, // 5 degree rotation
39 rotation2: -2, // 5 degree rotation
40 };
41
42 // Get the canvas context
43 const ctx = canvas.getContext("2d");
44 if (!ctx) {
45 console.error("Could not get canvas context");
46 return () => {};
47 }
48
49 // Make canvas transparent
50 if (isStandalone) {
51 canvas.style.backgroundColor = "#737D60";
52 } else {
53 canvas.style.backgroundColor = "transparent";
54 }
55
56 // Variables to track position and animation
57 let width = canvas.width;
58 let height = canvas.height;
59 let animationFrameId: number;
60 let lastFrameTime = 0;
61 const frameInterval = 1000 / config.fps;
62
63 // Position offsets for the two checkerboards (centered)
64 let offset1X = 0;
65 let offset1Y = 0;
66 let offset2X = 0;
67 let offset2Y = 0;
68
69 // Time variable for sine wave calculation
70 let time = 0;
71
72 // Convert rotation to radians
73 const rotationRad = (config.rotation * Math.PI) / 180;
74 const rotationRad2 = (config.rotation2 * Math.PI) / 180;
75
76 // Update canvas dimensions when resized
77 const updateDimensions = () => {
78 width = canvas.width = canvas.clientWidth;
79 height = canvas.height = canvas.clientHeight;
80 };
81
82 // Calculate the diagonal length of the canvas (to ensure rotation covers corners)
83 const calculateDiagonal = () => {
84 return Math.sqrt(width * width + height * height);
85 };
86
87 // Draw a single checkerboard pattern scaled from center with rotation
88 const drawCheckerboard = (
89 offsetX: number,
90 offsetY: number,
91 tileSize: number,
92 color1: string,
93 color2: string,
94 opacity: number,
95 rotationRad: number,
96 ) => {
97 ctx.globalAlpha = opacity;
98
99 // Get the center of the viewport
100 const centerX = width / 2;
101 const centerY = height / 2;
102
103 // Save the current transformation state
104 ctx.save();
105
106 // Move to the center of the canvas, rotate, then move back
107 ctx.translate(centerX, centerY);
108 ctx.rotate(rotationRad);
109
110 // Calculate the number of tiles needed to cover the rotated canvas
111 // We need to use the diagonal length to ensure we cover the corners when rotated
112 const diagonal = calculateDiagonal();
113 const tilesX = Math.ceil(diagonal / tileSize) + 6; // Added extra tiles for rotation
114 const tilesY = Math.ceil(diagonal / tileSize) + 6;
115
116 // Calculate how many tiles fit from center to edge (in each direction)
117 const halfTilesX = Math.ceil(tilesX / 2);
118 const halfTilesY = Math.ceil(tilesY / 2);
119
120 // Adjust the offset to be relative to the center
121 // The modulo ensures the pattern repeats smoothly even with scaling
122 const adjustedOffsetX = offsetX % (tileSize * 2);
123 const adjustedOffsetY = offsetY % (tileSize * 2);
124
125 // Draw the checker pattern, centered on the viewport
126 for (let y = -halfTilesY; y <= halfTilesY; y++) {
127 for (let x = -halfTilesX; x <= halfTilesX; x++) {
128 // Determine if this tile should be colored (creating checker pattern)
129 // We add a large number to ensure (x+y) is always positive for the modulo
130 if ((x + y + 1000) % 2 === 0) {
131 ctx.fillStyle = color1;
132 } else {
133 ctx.fillStyle = color2;
134 }
135
136 // Calculate the position of this tile relative to the center
137 // The adjusted offset creates the movement effect
138 const posX = (x * tileSize) + adjustedOffsetX;
139 const posY = (y * tileSize) + adjustedOffsetY;
140
141 // Draw the tile
142 ctx.fillRect(
143 posX - tileSize / 2,
144 posY - tileSize / 2,
145 tileSize,
146 tileSize,
147 );
148 }
149 }
150
151 // Restore the transformation state
152 ctx.restore();
153 };
154
155 // Animation loop
156 const animate = (currentTime: number) => {
157 animationFrameId = requestAnimationFrame(animate);
158
159 // Control frame rate
160 if (currentTime - lastFrameTime < frameInterval) {
161 return;
162 }
163
164 // Calculate the time elapsed since the last frame
165 const dt = currentTime - lastFrameTime;
166 lastFrameTime = currentTime;
167
168 // Increment time for sine wave calculation
169 time += dt;
170
171 // Update the position offsets based on speed and elapsed time
172 offset1X += config.speedX1 * dt;
173 offset1Y += config.speedY1 * dt;
174 offset2X += config.speedX2 * dt;
175 offset2Y += config.speedY2 * dt;
176
177 // Calculate the tile sizes using sine waves
178 const tileSize1 = config.baseTileSize +
179 Math.sin(time * config.sineFrequency1) * config.sizeVariation;
180 const tileSize2 = config.baseTileSize +
181 Math.sin(time * config.sineFrequency2 + config.sineOffset) *
182 config.sizeVariation;
183
184 // Clear canvas
185 ctx.clearRect(0, 0, width, height);
186
187 // Draw the two checkerboards
188 drawCheckerboard(
189 offset1X,
190 offset1Y,
191 tileSize1,
192 config.color1,
193 "transparent",
194 config.opacity,
195 rotationRad,
196 );
197
198 drawCheckerboard(
199 offset2X,
200 offset2Y,
201 tileSize2,
202 config.color2,
203 "transparent",
204 config.opacity,
205 rotationRad2,
206 );
207
208 // Reset global alpha
209 ctx.globalAlpha = 1.0;
210 };
211
212 // Initialize the animation
213 const init = () => {
214 // Set up resize handler
215 globalThis.addEventListener("resize", updateDimensions);
216
217 // Initial setup
218 updateDimensions();
219
220 // Start animation
221 lastFrameTime = performance.now();
222 animationFrameId = requestAnimationFrame(animate);
223 };
224
225 // Start the animation
226 init();
227
228 // Return cleanup function
229 return () => {
230 globalThis.removeEventListener("resize", updateDimensions);
231 cancelAnimationFrame(animationFrameId);
232 };
233};
src/file-viewer/scripts/canvas_2018.client.ts deleted-431
......@@ -1,431 +0,0 @@
1// This canvas is based on the maze generation algo in Tanks. This was
2// originally written in C++ as a single function in 2018, and was ported to TS
3// by Chloe in 2025 for the cotyledon canvas.
4//
5// The main difference is that this version is a visualization, rather than the
6// practical function. Instead of taking a millisecond, only 5 steps are
7// performed per second, visualizing the whole ordeal. It also isn't a playable
8// game, obviously.
9//
10// Ported with love because I care about my old self
11// She deserves the world, but instead gave it to me.
12(globalThis as any).canvas_2018 = function (canvas: HTMLCanvasElement) {
13 const isStandalone = canvas.getAttribute("data-standalone") === "true";
14 if (isStandalone) {
15 canvas.style.backgroundColor = "#27201E";
16 }
17 interface Cell {
18 down: boolean;
19 right: boolean;
20 visited: boolean;
21
22 cell_flash: number;
23 down_flash: number;
24 right_flash: number;
25 }
26 interface Pos {
27 x: number;
28 y: number;
29 /** Where the wall is relative to x, y. */
30 dir: "left" | "right" | "up" | "down";
31 }
32 interface Maze {
33 grid: Grid;
34 cursor: { x: number; y: number };
35 lastTick: number;
36 /* Pixels */
37 transform: number;
38 newCellsToVisit: Pos[];
39 randomWallBag: Cell[];
40 randomWallTarget: number;
41 renderOffset: { x: number; y: number };
42 done: boolean;
43 }
44 const hex = (color: number[]) =>
45 "#" + color.map((c) => c.toString(16).padStart(2, "0")).join("");
46 let cellSize: number;
47 let borderThickness: number;
48 const cellFlashModifier = isStandalone ? 0.4 : 0.2;
49 const color = isStandalone ? "#170d0b" : "#231C1A";
50 const bg = [0x27, 0x20, 0x1E];
51 const wallFlashColor = [0xFF, 0xA8, 0x7A];
52 const cellFlashColor = "#FFA87A";
53 const updateTime = 1000 / 7;
54 const randomWallBreakInterval = [6, 12]; // every 10 to 18 walls.
55 function randomBetween(min: number, max: number) {
56 return Math.round(
57 Math.random() * (max - min),
58 ) + min;
59 }
60 function randomOf<T>(array: T[]): T {
61 return array[randomBetween(0, array.length - 1)];
62 }
63 function randomWallTarget() {
64 return randomBetween(
65 randomWallBreakInterval[0],
66 randomWallBreakInterval[1],
67 );
68 }
69
70 // Originally, this used a 2-dimensional array. However, I wanted to make sure
71 // that the grid could be infinitely sized. This grid constructs new cells on
72 // demand, as needed.
73 class Grid {
74 cells = new Map<number, Cell>();
75 cell({ x, y }: { x: number; y: number }) {
76 const k = ((x | 0) << 16) + (y | 0);
77 const { cells } = this;
78 let existing = this.cells.get(k);
79 if (!existing) {
80 existing = {
81 cell_flash: 0,
82 down: true,
83 down_flash: 0,
84 right: true,
85 right_flash: 0,
86 visited: false,
87 };
88 cells.set(k, existing);
89 }
90 return existing;
91 }
92 forAll(
93 renderOffset: { x: number; y: number },
94 width: number,
95 height: number,
96 cb: (cell: Cell, pos: { x: number; y: number }) => void,
97 ) {
98 const { x: offsetX, y: offsetY } = renderOffset;
99 const startX = Math.floor(-offsetX / cellSize);
100 const startY = Math.floor(-offsetY / cellSize);
101 const endX = Math.ceil((width - offsetX) / cellSize);
102 const endY = Math.ceil((height - offsetY) / cellSize);
103 for (let x = startX; x <= endX; x++) {
104 for (let y = startY; y <= endY; y++) {
105 const cellX = offsetX + x * cellSize;
106 const cellY = offsetY + y * cellSize;
107 cb(this.cell({ x, y }), { x: cellX, y: cellY });
108 }
109 }
110 }
111 }
112
113 const ctx = canvas.getContext("2d")!;
114 if (!ctx) {
115 console.error("Could not get canvas context");
116 return () => {};
117 }
118
119 let width: number, height: number;
120 const updateDimensions = () => {
121 width = canvas.width = canvas.offsetWidth;
122 height = canvas.height = canvas.offsetHeight;
123 cellSize = 100;
124 borderThickness = 8;
125 };
126 updateDimensions();
127
128 setTimeout(() => {
129 updateDimensions();
130 }, 10);
131
132 let maze = initMaze();
133 let nextMaze: Maze | null = null;
134 let completeFade = 0;
135 function initMaze(): Maze {
136 return {
137 grid: new Grid(),
138 transform: 0,
139 cursor: {
140 x: randomBetween(0, Math.ceil(width / cellSize)),
141 y: randomBetween(0, Math.ceil(height / cellSize)),
142 },
143 lastTick: performance.now(),
144 randomWallBag: [],
145 randomWallTarget: randomWallTarget(),
146 newCellsToVisit: [],
147 renderOffset: { x: 0, y: 0 },
148 done: false,
149 };
150 }
151
152 function isOnScreen(maze: Maze, x: number, y: number) {
153 const { x: offsetX, y: offsetY } = maze.renderOffset;
154 const cellX = offsetX + x * cellSize;
155 const cellY = offsetY + y * cellSize;
156 return (
157 cellX + cellSize > 0 &&
158 cellX < width &&
159 cellY + cellSize > 0 &&
160 cellY < height
161 );
162 }
163
164 function tick(maze: Maze, other?: Maze) {
165 if (maze.done) return;
166
167 // The original maze algorithm broke down 4%-8% of random right facing
168 // walls, and 4%-8% of down facing walls. It did this at the end.
169 // To make this visual more interesting, two random walls will be broken
170 // down every 12-25 cell visits. This way, the main trail is always running.
171 if (maze.randomWallBag.length > maze.randomWallTarget) {
172 const down: Cell = randomOf(maze.randomWallBag);
173 const right: Cell = randomOf(maze.randomWallBag);
174 maze.randomWallBag.forEach((cell) =>
175 cell.cell_flash = Math.min(cell.cell_flash + 0.2, 1)
176 );
177 down.cell_flash = 1;
178 down.down = false;
179 down.down_flash = 1;
180 right.cell_flash = 1;
181 right.right = false;
182 right.right_flash = 1;
183 maze.randomWallBag = [];
184 maze.randomWallTarget = randomWallTarget();
185 return;
186 }
187
188 // The main algorithm was simple: Have a cursor position, and move it in a
189 // random direction that it had not seen before. Once it had run out of
190 // options, branch off of a previous location. Only visit each cell once.
191 //
192 // In this visualization, cells that are too far offscreen are softly
193 // treated as "visited", which is how the simulation always stays in frame.
194 const current = maze.grid.cell(maze.cursor);
195 current.visited = true;
196 current.cell_flash = 1;
197 maze.randomWallBag.push(current);
198 const adjacent = ([
199 { x: maze.cursor.x + 1, y: maze.cursor.y, dir: "left" },
200 { x: maze.cursor.x - 1, y: maze.cursor.y, dir: "right" },
201 { x: maze.cursor.x, y: maze.cursor.y + 1, dir: "up" },
202 { x: maze.cursor.x, y: maze.cursor.y - 1, dir: "down" },
203 ] as Pos[]).filter((pos) =>
204 isOnScreen(maze, pos.x, pos.y) &&
205 maze.grid.cell(pos).visited === false
206 );
207 if (adjacent.length === 0) {
208 // move cursor to a random cell that has not been visited.
209 const cells = maze.newCellsToVisit.filter((pos) =>
210 isOnScreen(maze, pos.x, pos.y) &&
211 maze.grid.cell(pos).visited === false
212 );
213 if (cells.length === 0) {
214 maze.done = true;
215 return;
216 }
217 const continuePos = randomOf(cells);
218 breakWall(maze, continuePos, other);
219 maze.cursor = { x: continuePos.x, y: continuePos.y };
220 return;
221 }
222
223 // break a random wall
224 const toBreak = randomOf(adjacent);
225 breakWall(maze, toBreak, other);
226 maze.cursor = { x: toBreak.x, y: toBreak.y };
227
228 // add the other directions to the new cells to visit.
229 maze.newCellsToVisit.push(
230 ...adjacent.filter((pos) => pos.dir !== toBreak.dir),
231 );
232 }
233
234 function breakWall(maze: Maze, pos: Pos, other?: Maze) {
235 if (pos.dir === "right") {
236 const cell = maze.grid.cell(pos);
237 cell.right = false;
238 cell.right_flash = 1;
239 if (other) cell.right = false;
240 } else if (pos.dir === "down") {
241 const cell = maze.grid.cell(pos);
242 cell.down = false;
243 cell.down_flash = 1;
244 if (other) cell.down = false;
245 } else if (pos.dir === "left") {
246 const cell = maze.grid.cell({ x: pos.x - 1, y: pos.y });
247 cell.right = false;
248 cell.right_flash = 1;
249 if (other) cell.right = false;
250 } else if (pos.dir === "up") {
251 const cell = maze.grid.cell({ x: pos.x, y: pos.y - 1 });
252 cell.down = false;
253 cell.down_flash = 1;
254 if (other) cell.down = false;
255 }
256 }
257
258 function renderOffset(maze: Maze) {
259 return { x: maze.transform, y: maze.transform };
260 }
261
262 let animationFrameId: number;
263 let last = performance.now();
264 let dt: number = 0;
265
266 function renderMazeBorders(maze: Maze, opacity: number) {
267 ctx.globalAlpha = opacity;
268 maze.grid.forAll(
269 maze.renderOffset,
270 width,
271 height,
272 (cell, { x: cellX, y: cellY }) => {
273 // Walls
274 if (cell.right) {
275 ctx.fillStyle = color;
276 ctx.fillRect(
277 cellX + cellSize - borderThickness / 2,
278 cellY - borderThickness / 2,
279 borderThickness,
280 cellSize + borderThickness,
281 );
282 }
283 if (cell.down) {
284 ctx.fillStyle = color;
285 ctx.fillRect(
286 cellX - borderThickness / 2,
287 cellY + cellSize - borderThickness / 2,
288 cellSize + borderThickness,
289 borderThickness,
290 );
291 }
292 },
293 );
294 ctx.globalAlpha = 1;
295 }
296
297 function renderCellFlash(maze: Maze) {
298 maze.grid.forAll(
299 maze.renderOffset,
300 width,
301 height,
302 (cell, { x: cellX, y: cellY }) => {
303 // Cell flash to show visiting path.
304 if (cell.cell_flash > 0) {
305 cell.cell_flash = Math.max(0, cell.cell_flash - dt / 1000);
306 ctx.fillStyle = cellFlashColor;
307 ctx.globalAlpha = cell.cell_flash * cellFlashModifier;
308 ctx.fillRect(cellX, cellY, cellSize, cellSize);
309 ctx.globalAlpha = 1;
310 }
311 },
312 );
313 }
314
315 function renderBorderFlash(maze: Maze) {
316 maze.grid.forAll(
317 maze.renderOffset,
318 width,
319 height,
320 (cell, { x: cellX, y: cellY }) => {
321 if (cell.right_flash == 0 && cell.down_flash == 0) {
322 return;
323 }
324
325 // Walls
326 const cellFlash = cell.cell_flash * cellFlashModifier;
327 if (cell.right_flash > 0) {
328 cell.right_flash = Math.max(0, cell.right_flash - dt / 500);
329 ctx.fillStyle = interpolateColor(
330 bg,
331 wallFlashColor,
332 Math.max(cell.right_flash, cellFlash),
333 );
334 if (cellFlash > cell.right_flash) {
335 ctx.globalAlpha = cell.right_flash / cellFlash;
336 }
337 ctx.fillRect(
338 cellX + cellSize - borderThickness / 2,
339 cellY + borderThickness / 2,
340 borderThickness,
341 cellSize - borderThickness,
342 );
343 ctx.globalAlpha = 1;
344 }
345 if (cell.down_flash > 0) {
346 if (cellFlash > cell.down_flash) {
347 ctx.globalAlpha = cell.down_flash / cellFlash;
348 }
349 cell.down_flash = Math.max(0, cell.down_flash - dt / 500);
350 ctx.fillStyle = interpolateColor(
351 bg,
352 wallFlashColor,
353 Math.max(cell.down_flash, cellFlash),
354 );
355 ctx.fillRect(
356 cellX + borderThickness / 2,
357 cellY + cellSize - borderThickness / 2,
358 cellSize - borderThickness,
359 borderThickness,
360 );
361 ctx.globalAlpha = 1;
362 }
363 },
364 );
365 }
366
367 function render() {
368 const now = performance.now();
369 dt = now - last;
370 maze.transform += dt * 0.005;
371 maze.renderOffset = renderOffset(maze);
372 if (!maze.done) {
373 if (now - maze.lastTick >= updateTime) {
374 tick(maze);
375 maze.lastTick = now;
376
377 if (maze.done) {
378 nextMaze = initMaze();
379 nextMaze.transform = (maze.transform % cellSize) - dt * 0.005;
380 nextMaze.lastTick = now;
381 completeFade = 0;
382 }
383 }
384 }
385 if (nextMaze) {
386 nextMaze.transform += dt * 0.005;
387 nextMaze.renderOffset = renderOffset(nextMaze);
388 if (!nextMaze.done && now - nextMaze.lastTick >= updateTime) {
389 tick(nextMaze, maze);
390 nextMaze.lastTick = now;
391 }
392 }
393 last = now;
394
395 ctx.clearRect(0, 0, width, height);
396
397 renderCellFlash(maze);
398 if (nextMaze) renderCellFlash(nextMaze);
399
400 renderMazeBorders(maze, 1);
401 if (nextMaze) {
402 renderMazeBorders(nextMaze, completeFade);
403 completeFade += dt / 3000;
404 if (completeFade >= 1) {
405 maze = nextMaze;
406 nextMaze = null;
407 }
408 }
409
410 renderBorderFlash(maze);
411 if (nextMaze) {
412 renderCellFlash(nextMaze);
413 renderBorderFlash(nextMaze);
414 }
415
416 animationFrameId = requestAnimationFrame(render);
417 }
418
419 function interpolateColor(start: number[], end: number[], t: number) {
420 return hex(start.map((s, i) => Math.round(s + (end[i] - s) * t)));
421 }
422
423 globalThis.addEventListener("resize", updateDimensions);
424 animationFrameId = requestAnimationFrame(render);
425
426 // cleanup function
427 return () => {
428 globalThis.removeEventListener("resize", updateDimensions);
429 cancelAnimationFrame(animationFrameId);
430 };
431};
src/file-viewer/scripts/canvas_2019.client.ts deleted-109
......@@ -1,109 +0,0 @@
1// __esModule
2true
3
4// assertAllowedAttributes
5function assertAllowedAttributes(path, allowed) {
6 let i = 0;
7 for (const attr of path.node.attributes) {
8 if (attr.type === "MarkoSpreadAttribute") {
9 throw path.hub.buildError(
10 attr,
11 `Tag does not support spread attributes.`
12 );
13 } else if (!allowed.includes(attr.name)) {
14 throw path.hub.buildError(
15 attr,
16 `Tag does not support the \`${attr.name}\` attribute.`
17 );
18 }
19
20 i++;
21 }
22}
23
24// assertAttributesOrArgs
25function assertAttributesOrArgs(path) {
26 const { node } = path;
27 const args = node.arguments;
28 if (args && args.length && (node.attributes.length > 0 || node.body.length)) {
29 const start = args[0].loc.start;
30 const end = args[args.length - 1].loc.end;
31 throw path.hub.buildError(
32 { loc: { start, end } },
33 "Tag does not support arguments when attributes or body present."
34 );
35 }
36}
37
38// assertAttributesOrSingleArg
39function assertAttributesOrSingleArg(path) {
40 assertAttributesOrArgs(path);
41 const args = path.node.arguments;
42 if (args && args.length > 1) {
43 const start = args[1].loc.start;
44 const end = args[args.length - 1].loc.end;
45 throw path.hub.buildError(
46 { loc: { start, end } },
47 "Tag does not support multiple arguments."
48 );
49 }
50}
51
52// assertNoArgs
53function assertNoArgs(path) {
54 const args = path.node.arguments;
55 if (args && args.length) {
56 const start = args[0].loc.start;
57 const end = args[args.length - 1].loc.end;
58 throw path.hub.buildError(
59 { loc: { start, end } },
60 "Tag does not support arguments."
61 );
62 }
63}
64
65// assertNoAttributeTags
66function assertNoAttributeTags(path) {
67 if (path.node.attributeTags.length) {
68 throw path.hub.buildError(
69 path.node.attributeTags[0],
70 "Tag not support nested attribute tags."
71 );
72 }
73}
74
75// assertNoAttributes
76function assertNoAttributes(path) {
77 const { attributes } = path.node;
78 if (attributes.length) {
79 const start = attributes[0].loc.start;
80 const end = attributes[attributes.length - 1].loc.end;
81 throw path.hub.buildError(
82 { loc: { start, end } },
83 "Tag does not support attributes."
84 );
85 }
86}
87
88// assertNoParams
89function assertNoParams(path) {
90 const { params } = path.node.body;
91 if (params.length) {
92 const start = params[0].loc.start;
93 const end = params[params.length - 1].loc.end;
94 throw path.hub.buildError(
95 { loc: { start, end } },
96 "Tag does not support parameters."
97 );
98 }
99}
100
101// assertNoVar
102function assertNoVar(path) {
103 if (path.node.var) {
104 throw path.hub.buildError(
105 path.node.var,
106 "Tag does not support a variable."
107 );
108 }
109}
src/file-viewer/scripts/canvas_2020.client.ts deleted-197
......@@ -1,197 +0,0 @@
1// Vibe coded with AI
2(globalThis as any).canvas_2020 = function (canvas: HTMLCanvasElement) {
3 const isStandalone = canvas.getAttribute("data-standalone") === "true";
4 // Rain effect with slanted lines
5 // Configuration interface for the rain effect
6 interface RainConfig {
7 fps: number; // frames per second
8 color: string; // color of rain particles
9 angle: number; // angle in degrees
10 particleDensity: number; // particles per 10000 pixels of canvas area
11 speed: number; // speed of particles (pixels per frame)
12 lineWidth: number; // thickness of rain lines
13 lineLength: number; // length of rain lines
14 }
15
16 // Rain particle interface
17 interface RainParticle {
18 x: number; // x position
19 y: number; // y position
20 }
21
22 // Default configuration
23 const config: RainConfig = {
24 fps: 16,
25 color: isStandalone ? "#00FEFB99" : "#081F24",
26 angle: -18,
27 particleDensity: 1,
28 speed: 400,
29 lineWidth: 8,
30 lineLength: 100,
31 };
32
33 // Get the canvas context
34 const ctx = canvas.getContext("2d");
35 if (!ctx) {
36 console.error("Could not get canvas context");
37 return () => {};
38 }
39
40 // Make canvas transparent
41 if (isStandalone) {
42 canvas.style.backgroundColor = "#0F252B";
43 } else {
44 canvas.style.backgroundColor = "transparent";
45 }
46
47 // Calculate canvas dimensions and update when resized
48 let width = canvas.width;
49 let height = canvas.height;
50 let particles: RainParticle[] = [];
51 let animationFrameId: number;
52 let lastFrameTime = 0;
53 const frameInterval = 1000 / config.fps;
54
55 // Calculate angle in radians
56 const angleRad = (config.angle * Math.PI) / 180;
57
58 // Update canvas dimensions and particle count when resized
59 const updateDimensions = () => {
60 width = canvas.width = canvas.offsetWidth;
61 height = canvas.height = canvas.offsetHeight;
62
63 // Calculate the canvas area in pixels
64 const canvasArea = width * height;
65
66 // Calculate target number of particles based on canvas area
67 const targetParticleCount = Math.floor(
68 (canvasArea / 10000) * config.particleDensity,
69 );
70
71 // Calculate buffer for horizontal offset due to slanted angle
72 const buffer = Math.abs(height * Math.tan(angleRad)) + config.lineLength;
73
74 // Adjust the particles array
75 if (particles.length < targetParticleCount) {
76 // Add more particles if needed
77 for (let i = particles.length; i < targetParticleCount; i++) {
78 particles.push(createParticle(true, buffer));
79 }
80 } else if (particles.length > targetParticleCount) {
81 // Remove excess particles
82 particles = particles.slice(0, targetParticleCount);
83 }
84 };
85
86 // Create a new particle
87 // Added initialDistribution parameter to distribute particles across the entire canvas at startup
88 const createParticle = (
89 initialDistribution = false,
90 buffer: number,
91 ): RainParticle => {
92 // For initial distribution, place particles throughout the canvas
93 // Otherwise start them above the canvas
94 let x = Math.random() * (width + buffer * 2) - buffer;
95 let y;
96
97 if (initialDistribution) {
98 // Distribute across the entire canvas height for initial setup
99 y = Math.random() * (height + config.lineLength * 2) - config.lineLength;
100 } else {
101 // Start new particles from above the canvas with some randomization
102 y = -config.lineLength - (Math.random() * config.lineLength * 20);
103 }
104
105 return {
106 x,
107 y,
108 };
109 };
110
111 // Update particle positions
112 const updateParticles = () => {
113 // Calculate buffer for horizontal offset due to slanted angle
114 const buffer = Math.abs(height * Math.tan(angleRad)) + config.lineLength;
115
116 for (let i = 0; i < particles.length; i++) {
117 const p = particles[i];
118
119 // Update position based on speed and angle
120 p.x += Math.sin(angleRad) * config.speed;
121 p.y += Math.cos(angleRad) * config.speed;
122
123 // Reset particles that go offscreen - only determined by position
124 // Add extra buffer to ensure particles fully exit the visible area before resetting
125 if (
126 p.y > height + config.lineLength ||
127 p.x < -buffer ||
128 p.x > width + buffer
129 ) {
130 particles[i] = createParticle(false, buffer);
131 }
132 }
133 };
134
135 // Draw particles
136 const drawParticles = () => {
137 // Clear canvas
138 ctx.clearRect(0, 0, width, height);
139
140 // Set drawing properties
141 ctx.strokeStyle = config.color;
142 ctx.lineWidth = config.lineWidth;
143 ctx.lineCap = "square";
144
145 // Draw each rain line
146 ctx.beginPath();
147 for (const p of particles) {
148 // Only draw particles that are either on screen or within a reasonable buffer
149 // This is for performance reasons - we don't need to draw particles far offscreen
150 if (p.y >= -config.lineLength * 2 && p.y <= height + config.lineLength) {
151 const endX = p.x + Math.sin(angleRad) * config.lineLength;
152 const endY = p.y + Math.cos(angleRad) * config.lineLength;
153
154 ctx.moveTo(p.x, p.y);
155 ctx.lineTo(endX, endY);
156 }
157 }
158 ctx.stroke();
159 };
160
161 // Animation loop
162 const animate = (currentTime: number) => {
163 animationFrameId = requestAnimationFrame(animate);
164
165 // Control frame rate
166 if (currentTime - lastFrameTime < frameInterval) {
167 return;
168 }
169
170 lastFrameTime = currentTime;
171
172 updateParticles();
173 drawParticles();
174 };
175
176 // Initialize the animation
177 const init = () => {
178 // Set up resize handler
179 globalThis.addEventListener("resize", updateDimensions);
180
181 // Initial setup
182 updateDimensions();
183
184 // Start animation
185 lastFrameTime = performance.now();
186 animationFrameId = requestAnimationFrame(animate);
187 };
188
189 // Start the animation
190 init();
191
192 // Return cleanup function
193 return () => {
194 globalThis.removeEventListener("resize", updateDimensions);
195 cancelAnimationFrame(animationFrameId);
196 };
197};
src/file-viewer/scripts/canvas_2021.client.ts deleted-783
......@@ -1,783 +0,0 @@
1// Vibe coded.
2(globalThis as any).canvas_2021 = function (canvas: HTMLCanvasElement) {
3 const isStandalone = canvas.getAttribute("data-standalone") === "true";
4 // Constants for simulation
5 const PARTICLE_RADIUS = 4.5;
6 const PARTICLE_DENSITY = 0.004; // Particles per pixel
7 const MIN_SPEED = 0.05;
8 const MAX_SPEED = 6.0;
9 const FRICTION = 0.96;
10 const REPULSION_STRENGTH = 0.1;
11 const REPULSION_RADIUS = 50;
12 const FORCE_RADIUS = 400; // Increased radius
13 const FORCE_STRENGTH = 0.25;
14 const FORCE_FALLOFF_EXPONENT = 3; // Higher value = sharper falloff
15 const FORCE_SPACING = 10; // Pixels between force points
16 const MIN_FORCE_STRENGTH = 0.05; // Minimum force strength for very slow movements
17 const MAX_FORCE_STRENGTH = 0.4; // Maximum force strength for fast movements
18 const MIN_SPEED_THRESHOLD = 1; // Movement speed (px/frame) that produces minimum force
19 const MAX_SPEED_THRESHOLD = 20; // Movement speed that produces maximum force
20 const OVERSCAN_PIXELS = 250;
21 const CELL_SIZE = REPULSION_RADIUS; // For spatial hashing
22
23 let globalOpacity = 0;
24
25 if (isStandalone) {
26 canvas.style.backgroundColor = "#301D02";
27 } else {
28 canvas.style.backgroundColor = "transparent";
29 }
30
31 // Interfaces
32 interface Particle {
33 x: number;
34 y: number;
35 vx: number;
36 vy: number;
37 charge: number; // 0 to 1, affecting color
38 }
39
40 interface Force {
41 x: number;
42 y: number;
43 dx: number;
44 dy: number;
45 strength: number;
46 radius: number;
47 createdAt: number;
48 }
49
50 interface SpatialHash {
51 [key: string]: Particle[];
52 }
53
54 // State
55 let first = true;
56 let particles: Particle[] = [];
57 let forces: Force[] = [];
58 let width = canvas.width;
59 let height = canvas.height;
60 let targetParticleCount = 0;
61 let spatialHash: SpatialHash = {};
62 let ctx: CanvasRenderingContext2D | null = null;
63 let animationId: number | null = null;
64 let isRunning = false;
65
66 // Mouse tracking
67 let lastMousePosition: { x: number; y: number } | null = null;
68 // Track position of the last created force
69 let lastForcePosition: { x: number; y: number } | null = null;
70
71 // Keep track of previous canvas dimensions for resize logic
72 let previousWidth = 0;
73 let previousHeight = 0;
74
75 // Initialize and cleanup
76 function init(): void {
77 ctx = canvas.getContext("2d");
78 if (!ctx) return;
79
80 // Set canvas to full size
81 resizeCanvas();
82
83 // Event listeners
84 globalThis.addEventListener("resize", resizeCanvas);
85 document.addEventListener("mousemove", handleMouseMove);
86
87 // Start animation immediately
88 start();
89 }
90
91 function cleanup(): void {
92 // Stop the animation
93 stop();
94
95 // Remove event listeners
96 globalThis.removeEventListener("resize", resizeCanvas);
97 document.removeEventListener("mousemove", handleMouseMove);
98
99 // Clear arrays
100 particles = [];
101 forces = [];
102 spatialHash = {};
103 lastMousePosition = null;
104 lastForcePosition = null;
105 }
106
107 // Resize canvas and adjust particle count
108 function resizeCanvas(): void {
109 // Store previous dimensions
110 previousWidth = width;
111 previousHeight = height;
112
113 // Update to new dimensions
114 width = globalThis.innerWidth;
115 height = globalThis.innerHeight;
116 canvas.width = width;
117 canvas.height = height;
118
119 const oldTargetCount = targetParticleCount;
120 targetParticleCount = Math.floor(width * height * PARTICLE_DENSITY);
121
122 // Adjust particle count
123 if (targetParticleCount > oldTargetCount) {
124 // Add more particles if needed, but only in newly available space
125 addParticles(targetParticleCount - oldTargetCount, !first);
126 first = false;
127 }
128 // Note: Removal of excess particles happens naturally during update
129 }
130
131 // Handle mouse movement
132 function handleMouseMove(e: MouseEvent): void {
133 const rect = canvas.getBoundingClientRect();
134 const currentX = e.clientX - rect.left;
135 const currentY = e.clientY - rect.top;
136
137 // Initialize positions if this is the first movement
138 if (!lastMousePosition || !lastForcePosition) {
139 lastMousePosition = { x: currentX, y: currentY };
140 lastForcePosition = { x: currentX, y: currentY };
141 return;
142 }
143
144 // Store current mouse position
145 const mouseX = currentX;
146 const mouseY = currentY;
147
148 // Calculate vector from last mouse position to current
149 const dx = mouseX - lastMousePosition.x;
150 const dy = mouseY - lastMousePosition.y;
151 const distMoved = Math.sqrt(dx * dx + dy * dy);
152
153 // Skip if essentially no movement (avoids numerical issues)
154 if (distMoved < 0.1) {
155 return;
156 }
157
158 // Get the vector from the last force to the current mouse position
159 const forceDx = mouseX - lastForcePosition.x;
160 const forceDy = mouseY - lastForcePosition.y;
161 const forceDistance = Math.sqrt(forceDx * forceDx + forceDy * forceDy);
162
163 // Only create forces if we've moved far enough from the last force
164 if (forceDistance >= FORCE_SPACING) {
165 // Calculate the direction vector from last force to current mouse
166 let dirX = forceDx / forceDistance;
167 let dirY = forceDy / forceDistance;
168
169 // Calculate how many force points to create
170 const numPoints = Math.floor(forceDistance / FORCE_SPACING);
171
172 // Calculate movement speed based on the recent movement
173 const movementSpeed = distMoved; // Simple approximation of speed
174
175 // Scale force strength based on movement speed
176 let speedFactor;
177 if (movementSpeed <= MIN_SPEED_THRESHOLD) {
178 speedFactor = MIN_FORCE_STRENGTH;
179 } else if (movementSpeed >= MAX_SPEED_THRESHOLD) {
180 speedFactor = MAX_FORCE_STRENGTH;
181 } else {
182 // Linear interpolation between min and max
183 const t = (movementSpeed - MIN_SPEED_THRESHOLD) /
184 (MAX_SPEED_THRESHOLD - MIN_SPEED_THRESHOLD);
185 speedFactor = MIN_FORCE_STRENGTH +
186 t * (MAX_FORCE_STRENGTH - MIN_FORCE_STRENGTH);
187 }
188
189 // Store current force position to update incrementally
190 let currentForceX = lastForcePosition.x;
191 let currentForceY = lastForcePosition.y;
192
193 // Create evenly spaced force points along the path from last force to current mouse
194 for (let i = 0; i < numPoints; i++) {
195 // Calculate position for this force point
196 const t = (i + 1) / numPoints;
197 const fx = lastForcePosition.x + forceDx * t;
198 const fy = lastForcePosition.y + forceDy * t;
199
200 // Create force at this position with the direction vector
201 createForce(fx, fy, dirX, dirY, speedFactor);
202
203 // Update the last force position to this new force
204 currentForceX = fx;
205 currentForceY = fy;
206 }
207
208 // Update the last force position
209 lastForcePosition = { x: currentForceX, y: currentForceY };
210 }
211
212 // Always update the last mouse position
213 lastMousePosition = { x: mouseX, y: mouseY };
214 }
215
216 // Create a new force
217 function createForce(
218 x: number,
219 y: number,
220 dx: number,
221 dy: number,
222 strength = FORCE_STRENGTH,
223 ): void {
224 forces.push({
225 x,
226 y,
227 dx,
228 dy,
229 strength,
230 radius: 1,
231 createdAt: Date.now(),
232 });
233 }
234
235 // Improved particle addition with fill strategy options
236 function addParticles(count: number, inNewAreaOnly: boolean = false): void {
237 // Determine available space
238 const minX = -OVERSCAN_PIXELS;
239 const maxX = width + OVERSCAN_PIXELS;
240 const minY = -OVERSCAN_PIXELS;
241 const maxY = height + OVERSCAN_PIXELS;
242
243 // Use a grid system that guarantees uniform spacing of particles
244 const gridSpacing = REPULSION_RADIUS * 0.8; // Slightly less than repulsion radius
245 const gridWidth = Math.ceil((maxX - minX) / gridSpacing);
246 const gridHeight = Math.ceil((maxY - minY) / gridSpacing);
247
248 // Track which grid cells are already occupied
249 const occupiedCells: Set<string> = new Set();
250
251 // Mark cells occupied by existing particles
252 for (const particle of particles) {
253 const cellX = Math.floor((particle.x - minX) / gridSpacing);
254 const cellY = Math.floor((particle.y - minY) / gridSpacing);
255
256 // Ensure cell coordinates are within valid range
257 if (cellX >= 0 && cellX < gridWidth && cellY >= 0 && cellY < gridHeight) {
258 occupiedCells.add(`${cellX},${cellY}`);
259 }
260 }
261
262 // Create arrays of all cells and filter by placement strategy
263 const allGridCells: { x: number; y: number }[] = [];
264
265 for (let cellY = 0; cellY < gridHeight; cellY++) {
266 for (let cellX = 0; cellX < gridWidth; cellX++) {
267 const cellKey = `${cellX},${cellY}`;
268 if (!occupiedCells.has(cellKey)) {
269 const posX = minX + (cellX + 0.5) * gridSpacing;
270 const posY = minY + (cellY + 0.5) * gridSpacing;
271
272 // For new area only placement, filter to expanded areas
273 if (inNewAreaOnly && previousWidth > 0 && previousHeight > 0) {
274 const expandedRight = width > previousWidth;
275 const expandedBottom = height > previousHeight;
276
277 const inNewRightArea = expandedRight && posX >= previousWidth &&
278 posX <= width;
279 const inNewBottomArea = expandedBottom && posY >= previousHeight &&
280 posY <= height;
281
282 if (inNewRightArea || inNewBottomArea) {
283 allGridCells.push({ x: cellX, y: cellY });
284 }
285 } else if (!inNewAreaOnly) {
286 // Standard placement - add all valid cells
287 allGridCells.push({ x: cellX, y: cellY });
288 }
289 }
290 }
291 }
292
293 if (allGridCells.length == 0) {
294 throw new Error("No cells available to place particles");
295 }
296
297 // We now have all grid cells that match our placement criteria
298
299 // If we need more particles than we have available cells, we need to adjust
300 // gridSpacing to fit more cells into the same space
301 if (count > allGridCells.length) {
302 // Retry with a smaller grid spacing
303 // Proportionally reduce the grid spacing to fit the required number of particles
304 const scaleFactor = Math.sqrt(allGridCells.length / count);
305 const newGridSpacing = gridSpacing * scaleFactor;
306
307 // Clear particles and try again with new spacing
308 // This is a recursive call, but with adjusted parameters that will fit
309 return addParticlesWithCustomSpacing(
310 count,
311 inNewAreaOnly,
312 newGridSpacing,
313 );
314 }
315
316 // Shuffle the available cells for random selection
317 shuffleArray(allGridCells);
318
319 // Take the number of cells we need
320 const cellsToUse = Math.min(count, allGridCells.length);
321 const selectedCells = allGridCells.slice(0, cellsToUse);
322
323 // Create particles in selected cells
324 for (const cell of selectedCells) {
325 // Add jitter within the cell for natural look
326 const jitterX = (Math.random() - 0.5) * gridSpacing * 0.8;
327 const jitterY = (Math.random() - 0.5) * gridSpacing * 0.8;
328
329 // Calculate final position
330 const x = minX + (cell.x + 0.5) * gridSpacing + jitterX;
331 const y = minY + (cell.y + 0.5) * gridSpacing + jitterY;
332
333 // Create a particle at this position
334 particles.push(createParticle(x, y));
335 }
336 }
337
338 // Helper function to add particles with custom grid spacing
339 function addParticlesWithCustomSpacing(
340 count: number,
341 inNewAreaOnly: boolean,
342 gridSpacing: number,
343 ): void {
344 if (gridSpacing == 0) throw new Error("Grid spacing is 0");
345 // Determine available space
346 const minX = -OVERSCAN_PIXELS;
347 const maxX = width + OVERSCAN_PIXELS;
348 const minY = -OVERSCAN_PIXELS;
349 const maxY = height + OVERSCAN_PIXELS;
350
351 // Create grid using the custom spacing
352 const gridWidth = Math.ceil((maxX - minX) / gridSpacing);
353 const gridHeight = Math.ceil((maxY - minY) / gridSpacing);
354
355 // Track which grid cells are already occupied
356 const occupiedCells: Set<string> = new Set();
357
358 // Mark cells occupied by existing particles
359 for (const particle of particles) {
360 const cellX = Math.floor((particle.x - minX) / gridSpacing);
361 const cellY = Math.floor((particle.y - minY) / gridSpacing);
362
363 // Ensure cell coordinates are within valid range
364 if (cellX >= 0 && cellX < gridWidth && cellY >= 0 && cellY < gridHeight) {
365 occupiedCells.add(`${cellX},${cellY}`);
366 }
367 }
368
369 // Create arrays of all cells and filter by placement strategy
370 const allGridCells: { x: number; y: number }[] = [];
371
372 for (let cellY = 0; cellY < gridHeight; cellY++) {
373 for (let cellX = 0; cellX < gridWidth; cellX++) {
374 const cellKey = `${cellX},${cellY}`;
375 if (!occupiedCells.has(cellKey)) {
376 const posX = minX + (cellX + 0.5) * gridSpacing;
377 const posY = minY + (cellY + 0.5) * gridSpacing;
378
379 // For new area only placement, filter to expanded areas
380 if (inNewAreaOnly && previousWidth > 0 && previousHeight > 0) {
381 const expandedRight = width > previousWidth;
382 const expandedBottom = height > previousHeight;
383
384 const inNewRightArea = expandedRight && posX >= previousWidth &&
385 posX <= width;
386 const inNewBottomArea = expandedBottom && posY >= previousHeight &&
387 posY <= height;
388
389 if (inNewRightArea || inNewBottomArea) {
390 allGridCells.push({ x: cellX, y: cellY });
391 }
392 } else if (!inNewAreaOnly) {
393 // Standard placement - add all valid cells
394 allGridCells.push({ x: cellX, y: cellY });
395 }
396 }
397 }
398 }
399
400 // Shuffle the available cells for random distribution
401 shuffleArray(allGridCells);
402
403 // Take the number of cells we need (or all if we have fewer)
404 const cellsToUse = Math.min(count, allGridCells.length);
405
406 // Create particles in selected cells
407 for (let i = 0; i < cellsToUse; i++) {
408 const cell = allGridCells[i];
409
410 // Add jitter within the cell
411 const jitterX = (Math.random() - 0.5) * gridSpacing * 0.8;
412 const jitterY = (Math.random() - 0.5) * gridSpacing * 0.8;
413
414 // Calculate final position
415 const x = minX + (cell.x + 0.5) * gridSpacing + jitterX;
416 const y = minY + (cell.y + 0.5) * gridSpacing + jitterY;
417
418 // Create a particle at this position
419 particles.push(createParticle(x, y));
420 }
421 }
422
423 // Utility to shuffle an array (Fisher-Yates algorithm)
424 function shuffleArray<T>(array: T[]): void {
425 for (let i = array.length - 1; i > 0; i--) {
426 const j = Math.floor(Math.random() * (i + 1));
427 [array[i], array[j]] = [array[j], array[i]];
428 }
429 }
430
431 // Simplified createParticle function that just places at a specific position
432 function createParticle(x: number, y: number): Particle {
433 return {
434 x: x + (Math.random() * 4 - 2),
435 y: y + (Math.random() * 4 - 2),
436 vx: 0,
437 vy: 0,
438 charge: 0,
439 };
440 }
441
442 // Function to create a particle on one of the edges
443 function createParticleOnEdge(): Particle {
444 // Overscan bounds with fixed pixel size
445 const minX = -OVERSCAN_PIXELS;
446 const maxX = width + OVERSCAN_PIXELS;
447 const minY = -OVERSCAN_PIXELS;
448 const maxY = height + OVERSCAN_PIXELS;
449
450 let x: number, y: number;
451
452 // Place on one of the edges
453 const edge = Math.floor(Math.random() * 4);
454 switch (edge) {
455 case 0: // Top
456 x = minX + Math.random() * (maxX - minX);
457 y = minY;
458 break;
459 case 1: // Right
460 x = maxX;
461 y = minY + Math.random() * (maxY - minY);
462 break;
463 case 2: // Bottom
464 x = minX + Math.random() * (maxX - minX);
465 y = maxY;
466 break;
467 case 3: // Left
468 x = minX;
469 y = minY + Math.random() * (maxY - minY);
470 break;
471 default:
472 x = minX + Math.random() * (maxX - minX);
473 y = minY + Math.random() * (maxY - minY);
474 }
475
476 return createParticle(x, y);
477 }
478
479 // Spatial hashing functions
480 function getHashKey(x: number, y: number): string {
481 const cellX = Math.floor(x / CELL_SIZE);
482 const cellY = Math.floor(y / CELL_SIZE);
483 return `${cellX},${cellY}`;
484 }
485
486 function addToSpatialHash(particle: Particle): void {
487 const key = getHashKey(particle.x, particle.y);
488 if (!spatialHash[key]) {
489 spatialHash[key] = [];
490 }
491 spatialHash[key].push(particle);
492 }
493
494 function updateSpatialHash(): void {
495 // Clear previous hash
496 spatialHash = {};
497
498 // Add all particles to hash
499 for (const particle of particles) {
500 addToSpatialHash(particle);
501 }
502 }
503
504 function getNearbyParticles(
505 x: number,
506 y: number,
507 radius: number,
508 ): Particle[] {
509 const result: Particle[] = [];
510 const cellRadius = Math.ceil(radius / CELL_SIZE);
511
512 const centerCellX = Math.floor(x / CELL_SIZE);
513 const centerCellY = Math.floor(y / CELL_SIZE);
514
515 for (
516 let cellX = centerCellX - cellRadius;
517 cellX <= centerCellX + cellRadius;
518 cellX++
519 ) {
520 for (
521 let cellY = centerCellY - cellRadius;
522 cellY <= centerCellY + cellRadius;
523 cellY++
524 ) {
525 const key = `${cellX},${cellY}`;
526 const cell = spatialHash[key];
527
528 if (cell) {
529 result.push(...cell);
530 }
531 }
532 }
533
534 return result;
535 }
536
537 // Main update function
538 function update(): void {
539 const now = Date.now();
540 // Fixed pixel overscan
541 const minX = -OVERSCAN_PIXELS;
542 const maxX = width + OVERSCAN_PIXELS;
543 const minY = -OVERSCAN_PIXELS;
544 const maxY = height + OVERSCAN_PIXELS;
545
546 // Update spatial hash
547 updateSpatialHash();
548
549 // Update forces and remove expired ones
550 if (forces.length > 40) {
551 forces = forces.slice(-40);
552 }
553 forces = forces.filter((force) => {
554 force.strength *= 0.95;
555 force.radius *= 0.95;
556 return force.strength > 0.001;
557 });
558
559 // Update particles
560 const newParticles: Particle[] = [];
561
562 for (const particle of particles) {
563 // Apply forces
564 for (const force of forces) {
565 const dx = particle.x - force.x;
566 const dy = particle.y - force.y;
567 const distSq = dx * dx + dy * dy;
568
569 const radius = force.radius * FORCE_RADIUS;
570
571 if (distSq < radius * radius) {
572 const dist = Math.sqrt(distSq);
573
574 // Exponential falloff - much more concentrated at center
575 // (1 - x/R)^n where n controls how sharp the falloff is
576 const normalizedDist = dist / radius;
577 const factor = Math.pow(1 - normalizedDist, FORCE_FALLOFF_EXPONENT);
578
579 // Calculate force line projection for directional effect
580 // This makes particles along the force's path experience stronger effect
581 const dotProduct = (dx * -force.dx) + (dy * -force.dy);
582 const projectionFactor = Math.max(0, dotProduct / dist);
583
584 // Apply the combined factors - stronger directional bias
585 const finalFactor = factor * force.strength *
586 (0.1 + 0.9 * projectionFactor);
587
588 particle.vx += force.dx * finalFactor;
589 particle.vy += force.dy * finalFactor;
590 // charge for the first 100ms
591 if ((now - force.createdAt) < 100) {
592 particle.charge = Math.min(
593 1,
594 particle.charge + (finalFactor * finalFactor) * 0.2,
595 );
596 }
597 }
598 }
599
600 // Apply repulsion from nearby particles
601 const nearby = getNearbyParticles(
602 particle.x,
603 particle.y,
604 REPULSION_RADIUS,
605 );
606
607 for (const other of nearby) {
608 if (other === particle) continue;
609
610 const dx = particle.x - other.x;
611 const dy = particle.y - other.y;
612 const distSq = dx * dx + dy * dy;
613
614 if (distSq < REPULSION_RADIUS * REPULSION_RADIUS && distSq > 0) {
615 const dist = Math.sqrt(distSq);
616 const factor = REPULSION_STRENGTH * (1 - dist / REPULSION_RADIUS);
617
618 const fx = dx / dist * factor;
619 const fy = dy / dist * factor;
620
621 particle.vx += fx;
622 particle.vy += fy;
623 }
624 }
625
626 // Apply friction
627 particle.vx *= FRICTION;
628 particle.vy *= FRICTION;
629
630 // Ensure minimum speed
631 const speed = Math.sqrt(
632 particle.vx * particle.vx + particle.vy * particle.vy,
633 );
634 if (speed < MIN_SPEED && speed > 0) {
635 const scale = MIN_SPEED / speed;
636 particle.vx *= scale;
637 particle.vy *= scale;
638 }
639
640 // Cap at maximum speed
641 if (speed > MAX_SPEED) {
642 const scale = MAX_SPEED / speed;
643 particle.vx *= scale;
644 particle.vy *= scale;
645 }
646
647 // Update position
648 particle.x += particle.vx;
649 particle.y += particle.vy;
650
651 // Decrease charge
652 particle.charge *= 0.99;
653
654 // Check if particle is within extended bounds
655 if (
656 particle.x >= minX && particle.x <= maxX &&
657 particle.y >= minY && particle.y <= maxY
658 ) {
659 // If outside screen but within overscan, keep it if we need more particles
660 if (
661 (particle.x < 0 || particle.x > width ||
662 particle.y < 0 || particle.y > height) &&
663 newParticles.length >= targetParticleCount
664 ) {
665 continue;
666 }
667
668 newParticles.push(particle);
669 } else {
670 // Out of bounds, respawn if needed
671 if (newParticles.length < targetParticleCount) {
672 newParticles.push(createParticleOnEdge());
673 }
674 }
675 }
676
677 // Add more particles if needed
678 while (newParticles.length < targetParticleCount) {
679 newParticles.push(createParticleOnEdge());
680 }
681
682 particles = newParticles;
683 }
684
685 // Render function
686 const mul = isStandalone ? 0.9 : 0.5;
687 const add = isStandalone ? 0.1 : 0.03;
688 function render(): void {
689 if (!ctx) return;
690
691 // Clear canvas
692 ctx.clearRect(0, 0, width, height);
693
694 // Draw particles
695 for (const particle of particles) {
696 // Only draw if within canvas bounds (plus a small margin)
697 if (
698 particle.x >= -PARTICLE_RADIUS &&
699 particle.x <= width + PARTICLE_RADIUS &&
700 particle.y >= -PARTICLE_RADIUS && particle.y <= height + PARTICLE_RADIUS
701 ) {
702 ctx.beginPath();
703 ctx.arc(particle.x, particle.y, PARTICLE_RADIUS, 0, Math.PI * 2);
704
705 // Color based on charge
706 ctx.fillStyle = "#FFCB1F";
707 ctx.globalAlpha = (particle.charge * mul + add) * globalOpacity;
708 ctx.fill();
709 }
710 }
711
712 // // Debug: Draw forces and falloff visualization
713 // if (ctx) {
714 // for (const force of forces) {
715 // const R = force.radius * FORCE_RADIUS;
716
717 // // Draw force point
718 // ctx.beginPath();
719 // ctx.arc(force.x, force.y, 5, 0, Math.PI * 2);
720 // ctx.fillStyle = 'rgba(255, 0, 0, 0.5)';
721 // ctx.fill();
722
723 // // Draw force direction
724 // ctx.beginPath();
725 // ctx.moveTo(force.x, force.y);
726 // ctx.lineTo(force.x + force.dx * 20, force.y + force.dy * 20);
727 // ctx.strokeStyle = 'red';
728 // ctx.stroke();
729
730 // // Visualize the falloff curve with rings
731 // for (let i = 0; i <= 10; i++) {
732 // const radius = (R * i) / 10;
733 // const normalizedDist = radius / R;
734 // const intensity = Math.pow(1 - normalizedDist, FORCE_FALLOFF_EXPONENT);
735
736 // ctx.beginPath();
737 // ctx.arc(force.x, force.y, radius, 0, Math.PI * 2);
738 // ctx.strokeStyle = `rgba(255, 0, 0, ${intensity * 0.2})`;
739 // ctx.stroke();
740 // }
741 // }
742 // }
743 }
744
745 // Animation loop
746 let r = Math.random();
747 function animate(): void {
748 globalOpacity = Math.min(1, globalOpacity + 0.03);
749 update();
750 render();
751
752 if (isRunning) {
753 animationId = requestAnimationFrame(animate);
754 }
755 }
756
757 // Start/stop functions
758 function start(): void {
759 if (isRunning) return;
760
761 // Calculate target particle count based on canvas size
762 targetParticleCount = Math.floor(width * height * PARTICLE_DENSITY);
763
764 // Clear any existing particles and create new ones with proper spacing
765 particles = [];
766 addParticles(targetParticleCount);
767
768 isRunning = true;
769 animate();
770 }
771
772 function stop(): void {
773 isRunning = false;
774
775 if (animationId !== null) {
776 cancelAnimationFrame(animationId);
777 animationId = null;
778 }
779 }
780
781 init();
782 return cleanup;
783};
src/file-viewer/scripts/canvas_2022.client.ts deleted-160
......@@ -1,160 +0,0 @@
1(globalThis as any).canvas_2022 = function (canvas: HTMLCanvasElement) {
2 const isStandalone = canvas.getAttribute("data-standalone") === "true";
3 // Configuration for the grid of rotating squares
4 const config = {
5 gridRotation: 20, // Overall grid rotation in degrees
6 squareSize: 20, // Size of each square
7 spacing: 100, // Distance between square centers
8 moveSpeedX: 0.01, // Horizontal movement speed (pixels per second)
9 moveSpeedY: 0.01, // Vertical movement speed (pixels per second)
10 squareColor: "#00220A", // Color of the squares
11 squareOpacity: 1, // Opacity of the squares
12
13 // Function to determine square rotation based on its coordinates and time
14 // Can be adjusted for different patterns
15 rotationFunction: (x: number, y: number, time: number): number => {
16 // Combination of spatial wave and time-based rotation
17 return Math.sin(x * 0.05) * Math.cos(y * 0.05) * 180;
18 },
19 };
20
21 // Convert grid rotation to radians
22 const gridRotationRad = (config.gridRotation * Math.PI) / 180;
23
24 // Get the canvas context
25 const ctx = canvas.getContext("2d");
26 if (!ctx) {
27 console.error("Could not get canvas context");
28 return () => {};
29 }
30
31 // Make canvas transparent
32 if (isStandalone) {
33 canvas.style.backgroundColor = "#154226";
34 } else {
35 canvas.style.backgroundColor = "transparent";
36 }
37
38 // Animation variables
39 let width = canvas.width;
40 let height = canvas.height;
41 let offsetX = 0;
42 let offsetY = 0;
43 let time = 0;
44 let animationFrameId: number;
45 let lastTime = 0;
46
47 // Update canvas dimensions when resized
48 const updateDimensions = () => {
49 width = canvas.width = canvas.clientWidth;
50 height = canvas.height = canvas.clientHeight;
51 };
52
53 // Calculate the diagonal length of the canvas (to ensure rotation covers corners)
54 const calculateDiagonal = () => {
55 return Math.sqrt(width * width + height * height);
56 };
57
58 // Draw a single square with rotation
59 const drawSquare = (x: number, y: number, size: number, rotation: number) => {
60 ctx.save();
61
62 // Move to the center of the square position, rotate, then draw
63 ctx.translate(x, y);
64 ctx.rotate((rotation * Math.PI) / 180); // Convert rotation degrees to radians
65
66 // Draw square centered at position
67 ctx.fillRect(-size / 2, -size / 2, size, size);
68
69 ctx.restore();
70 };
71
72 // Draw the entire grid of squares
73 const drawGrid = () => {
74 ctx.clearRect(0, 0, width, height);
75
76 // Set drawing properties
77 ctx.fillStyle = config.squareColor;
78 ctx.globalAlpha = config.squareOpacity;
79
80 // Save the current transformation state
81 ctx.save();
82
83 // Move to the center of the canvas, rotate the grid, then move back
84 const centerX = width / 2;
85 const centerY = height / 2;
86 ctx.translate(centerX, centerY);
87 ctx.rotate(gridRotationRad);
88
89 // Calculate how much of the grid to draw based on canvas size
90 const diagonal = calculateDiagonal();
91 const gridSize = Math.ceil(diagonal / config.spacing) + 2;
92
93 // Adjust for offset to create movement
94 const adjustedOffsetX = offsetX % config.spacing;
95 const adjustedOffsetY = offsetY % config.spacing;
96
97 // Draw grid with enough squares to cover the rotated canvas
98 const halfGrid = Math.ceil(gridSize / 2);
99
100 for (let y = -halfGrid; y <= halfGrid; y++) {
101 for (let x = -halfGrid; x <= halfGrid; x++) {
102 // Calculate actual position with offset
103 const posX = x * config.spacing + adjustedOffsetX;
104 const posY = y * config.spacing + adjustedOffsetY;
105
106 // Calculate square rotation based on its position and time
107 const squareRotation = config.rotationFunction(posX, posY, time);
108
109 // Draw the square
110 drawSquare(posX, posY, config.squareSize, squareRotation);
111 }
112 }
113
114 // Restore the transformation state
115 ctx.restore();
116
117 // Reset global alpha
118 ctx.globalAlpha = 1.0;
119 };
120
121 // Animation loop
122 const animate = (currentTime: number) => {
123 animationFrameId = requestAnimationFrame(animate);
124
125 // Calculate time elapsed since last frame
126 const elapsed = currentTime - lastTime;
127 lastTime = currentTime;
128
129 // Update time variable for rotation function
130 time += elapsed;
131
132 // Update position offsets for movement
133 offsetX += config.moveSpeedX * elapsed;
134 offsetY += config.moveSpeedY * elapsed;
135
136 // Draw the grid
137 drawGrid();
138 };
139
140 // Initialize the animation
141 const init = () => {
142 // Set up resize handler
143 globalThis.addEventListener("resize", updateDimensions);
144
145 // Initial setup
146 updateDimensions();
147
148 // Start animation
149 animationFrameId = requestAnimationFrame(animate);
150 };
151
152 // Start the animation
153 init();
154
155 // Return cleanup function
156 return () => {
157 globalThis.removeEventListener("resize", updateDimensions);
158 cancelAnimationFrame(animationFrameId);
159 };
160};
src/file-viewer/scripts/canvas_2023.client.ts deleted-197
......@@ -1,197 +0,0 @@
1(globalThis as any).canvas_2023 = function (canvas: HTMLCanvasElement) {
2 const isStandalone = canvas.getAttribute("data-standalone") === "true";
3 const config = {
4 heartBaseSize: 50,
5 heartMaxSize: 100,
6 spacing: 150,
7 rowSpeed: 0.1,
8 heartColor: "#FF90D9",
9 heartOpacity: isStandalone ? 0.5 : 0.04,
10 mouseInfluenceRadius: 1000,
11 heartScaleFunction: (distance: number, radius: number): number => {
12 if (distance > radius) return 1;
13
14 const normalizedDistance = distance / radius;
15 const scaleFactor = 1 +
16 (1 - normalizedDistance) *
17 (config.heartMaxSize / config.heartBaseSize - 1);
18
19 return 1 + (scaleFactor - 1) * Math.pow(1 - normalizedDistance, 2);
20 },
21 };
22
23 const heart = new Path2D(
24 "M23.9451 45.3973L20.8672 42.6493C16.9551 39.0174 13.7054 35.8927 11.1181 33.275C8.53056 30.6574 6.46731 28.286 4.92839 26.1608C3.38946 24.0356 2.31772 22.1028 1.71314 20.3624C1.10856 18.6219 0.806274 16.8705 0.806274 15.1081C0.806274 11.4718 2.03118 8.42016 4.481 5.95312C6.93118 3.48608 9.93831 2.25256 13.5024 2.25256C15.5649 2.25256 17.482 2.70142 19.2536 3.59912C21.0255 4.49682 22.5893 5.80674 23.9451 7.52887C25.484 5.73346 27.1059 4.40522 28.8108 3.54416C30.5161 2.6831 32.3751 2.25256 34.3877 2.25256C38.0141 2.25256 41.0551 3.48663 43.5108 5.95477C45.9661 8.42291 47.1938 11.4758 47.1938 15.1136C47.1938 16.8712 46.8823 18.6115 46.2594 20.3343C45.6365 22.0568 44.5648 23.9807 43.0442 26.1059C41.5236 28.231 39.4721 30.6136 36.8896 33.2536C34.3068 35.8936 31.0362 39.0255 27.0779 42.6493L23.9451 45.3973ZM23.9176 38.802C27.6088 35.431 30.6339 32.5547 32.9928 30.173C35.3518 27.7913 37.2091 25.7211 38.5648 23.9624C39.9205 22.2036 40.864 20.6137 41.3953 19.1928C41.9266 17.7715 42.1923 16.4101 42.1923 15.1086C42.1923 12.8768 41.4529 11.0098 39.974 9.50748C38.4952 8.0052 36.6461 7.25406 34.4268 7.25406C32.631 7.25406 30.9572 7.6811 29.4055 8.87193C27.8537 10.0628 25.5389 13.0434 25.5389 13.0434L23.9451 15.3299L22.3512 13.0434C22.3512 13.0434 20.0643 10.2311 18.4638 9.04031C16.8634 7.84948 15.2194 7.25406 13.4991 7.25406C11.2929 7.25406 9.46857 7.98816 8.02602 9.45637C6.58383 10.9246 5.86273 12.8162 5.86273 15.1311C5.86273 16.4784 6.13644 17.8679 6.68386 19.2994C7.23127 20.731 8.18394 22.3333 9.54185 24.1064C10.8998 25.879 12.7329 27.9562 15.0413 30.3379C17.3497 32.7196 20.3084 35.5409 23.9176 38.802Z",
25 );
26
27 const ctx = canvas.getContext("2d");
28 if (!ctx) {
29 console.error("Could not get canvas context");
30 return () => {};
31 }
32
33 if (isStandalone) {
34 canvas.style.backgroundColor = "#2F1C21";
35 } else {
36 canvas.style.backgroundColor = "transparent";
37 }
38
39 let width = canvas.width;
40 let height = canvas.height;
41 let animationFrameId: number;
42 let lastFrameTime = 0;
43
44 let mouseX = width / 2;
45 let mouseY = height / 2;
46
47 let offset = config.spacing / 2;
48
49 const updateDimensions = () => {
50 width = canvas.width = canvas.clientWidth;
51 height = canvas.height = canvas.clientHeight;
52
53 mouseX = width / 2;
54 mouseY = height / 2;
55 };
56
57 const drawHeart = (x: number, y: number, size: number) => {
58 const scale = size / 30;
59
60 ctx.save();
61 ctx.translate(x, y);
62 ctx.scale(scale, scale);
63
64 ctx.fillStyle = config.heartColor;
65 ctx.fill(heart);
66
67 ctx.restore();
68 };
69
70 const c = 400;
71 const h = 40;
72 const k = solveForK(c, h);
73
74 const drawHeartGrid = () => {
75 ctx.clearRect(0, 0, width, height);
76
77 ctx.globalAlpha = config.heartOpacity;
78
79 const numRows = Math.ceil(height / config.spacing) + 1;
80
81 for (let row = 0; row < numRows; row++) {
82 const direction = row % 2 === 0 ? 1 : -1;
83 const rowOffset = (offset * direction) % config.spacing;
84
85 const posYInit = row * config.spacing + config.spacing / 2;
86
87 for (
88 let posXInit = -config.spacing + rowOffset;
89 posXInit < width + config.spacing;
90 posXInit += config.spacing
91 ) {
92 const dx = (posXInit + config.heartBaseSize / 2) - mouseX;
93 const dy = (posYInit + config.heartBaseSize / 2) - mouseY;
94 const distance = Math.sqrt(dx * dx + dy * dy);
95
96 const pushIntensity = asymmetricBump(distance, h, c, k, 0.00002);
97
98 const pushAngle = Math.atan2(dy, dx);
99
100 const pushDistanceX = pushIntensity * Math.cos(pushAngle);
101 const pushDistanceY = pushIntensity * Math.sin(pushAngle);
102 const posX = posXInit + pushDistanceX * 1;
103 const posY = posYInit + pushDistanceY * 2;
104
105 const scaleFactor = config.heartScaleFunction(
106 distance,
107 config.mouseInfluenceRadius,
108 );
109 const heartSize = config.heartBaseSize * scaleFactor;
110
111 if (
112 posX > -config.heartMaxSize &&
113 posX < width + config.heartMaxSize &&
114 posY > -config.heartMaxSize &&
115 posY < height + config.heartMaxSize
116 ) {
117 drawHeart(posX - heartSize / 2, posY - heartSize / 2, heartSize);
118 }
119 }
120 }
121
122 ctx.globalAlpha = 1.0;
123 };
124
125 function solveForK(c: number, k: number) {
126 // input -> f(x)=h*e^{(-k*(x-c)^{2})}
127 // desired result is (0, 0.45). (0, 0) is unsolvable but 0.45px will round down to 0.
128 //
129 // solution: -\frac{\ln\left(\frac{0.45}{h}\right)}{c^{2}}
130 return -Math.log(0.45 / h) / (c * c);
131 }
132
133 function asymmetricBump(
134 x: number,
135 h: number,
136 c: number,
137 leftK: number,
138 rightK: number,
139 ) {
140 const k = (x <= c) ? leftK : rightK;
141 return h * Math.exp(-k * Math.pow(x - c, 2));
142 }
143
144 const updateOffset = (elapsed: number) => {
145 offset += config.rowSpeed * elapsed;
146
147 if (offset > 1000000) {
148 offset -= 1000000;
149 }
150 };
151
152 const animate = (currentTime: number) => {
153 animationFrameId = requestAnimationFrame(animate);
154
155 const elapsed = currentTime - lastFrameTime;
156 lastFrameTime = currentTime;
157
158 updateOffset(elapsed * 0.05);
159
160 drawHeartGrid();
161 };
162
163 const handleMouseMove = (event: MouseEvent) => {
164 const rect = canvas.getBoundingClientRect();
165 mouseX = event.clientX - rect.left;
166 mouseY = event.clientY - rect.top;
167 };
168
169 const handleTouchMove = (event: TouchEvent) => {
170 if (event.touches.length > 0) {
171 event.preventDefault();
172 const rect = canvas.getBoundingClientRect();
173 mouseX = event.touches[0].clientX - rect.left;
174 mouseY = event.touches[0].clientY - rect.top;
175 }
176 };
177
178 const init = () => {
179 globalThis.addEventListener("resize", updateDimensions);
180 document.addEventListener("mousemove", handleMouseMove);
181 document.addEventListener("touchmove", handleTouchMove, { passive: false });
182
183 updateDimensions();
184
185 lastFrameTime = performance.now();
186 animationFrameId = requestAnimationFrame(animate);
187 };
188
189 init();
190
191 return () => {
192 globalThis.removeEventListener("resize", updateDimensions);
193 document.removeEventListener("mousemove", handleMouseMove);
194 document.removeEventListener("touchmove", handleTouchMove);
195 cancelAnimationFrame(animationFrameId);
196 };
197};
src/file-viewer/scripts/canvas_2024.client.ts deleted-251
......@@ -1,251 +0,0 @@
1// Vibe coded with AI
2(globalThis as any).canvas_2024 = function (canvas: HTMLCanvasElement) {
3 const isStandalone = canvas.getAttribute("data-standalone") === "true";
4 if (isStandalone) {
5 canvas.parentElement!.style.backgroundColor = "black";
6 }
7
8 const gl = canvas.getContext("webgl", {
9 alpha: true,
10 premultipliedAlpha: false,
11 });
12 if (!gl) {
13 console.error("WebGL not supported");
14 return () => {};
15 }
16
17 canvas.style.imageRendering = "pixelated";
18 canvas.style.opacity = isStandalone ? "0.3" : "0.15";
19
20 // Resize canvas to match display size
21 const resize = () => {
22 const displayWidth = Math.floor(
23 (canvas.clientWidth || globalThis.innerWidth) / 3,
24 );
25 const displayHeight = Math.floor(
26 (canvas.clientHeight || globalThis.innerHeight) / 3,
27 );
28
29 if (canvas.width !== displayWidth || canvas.height !== displayHeight) {
30 canvas.width = displayWidth;
31 canvas.height = displayHeight;
32 gl.viewport(0, 0, canvas.width, canvas.height);
33 }
34 };
35 resize();
36
37 // Vertex shader (just passes coordinates)
38 const vertexShaderSource = `
39 attribute vec2 a_position;
40 void main() {
41 gl_Position = vec4(a_position, 0.0, 1.0);
42 }
43 `;
44
45 // Fragment shader creates random noise with higher opacity to ensure visibility
46 const fragmentShaderSource = `
47 precision mediump float;
48 uniform float u_time;
49
50 float noise1(float seed1,float seed2){
51 return(
52 fract(seed1+12.34567*
53 fract(100.*(abs(seed1*0.91)+seed2+94.68)*
54 fract((abs(seed2*0.41)+45.46)*
55 fract((abs(seed2)+757.21)*
56 fract(seed1*0.0171))))))
57 * 1.0038 - 0.00185;
58 }
59
60 float n(float seed1, float seed2, float seed3){
61 float buff1 = abs(seed1+100.81) + 1000.3;
62 float buff2 = abs(seed2+100.45) + 1000.2;
63 float buff3 = abs(noise1(seed1, seed2)+seed3) + 1000.1;
64 buff1 = (buff3*fract(buff2*fract(buff1*fract(buff2*0.146))));
65 buff2 = (buff2*fract(buff2*fract(buff1+buff2*fract(buff3*0.52))));
66 buff1 = noise1(buff1, buff2);
67 return(buff1);
68 }
69
70 void main() {
71 float noise = n(gl_FragCoord.x, gl_FragCoord.y, u_time);
72
73 gl_FragColor = vec4(1.0, 0.7, 0.7, 0.8*noise);
74 }
75 `;
76
77 // Create and compile shaders
78 const vertexShader = createShader(gl, gl.VERTEX_SHADER, vertexShaderSource);
79 const fragmentShader = createShader(
80 gl,
81 gl.FRAGMENT_SHADER,
82 fragmentShaderSource,
83 );
84
85 // Check if shader creation failed
86 if (!vertexShader || !fragmentShader) {
87 console.error("Failed to create shaders");
88 return () => {};
89 }
90
91 // Create program and link shaders
92 const program = createProgram(gl, vertexShader, fragmentShader);
93
94 // Check if program creation failed
95 if (!program) {
96 console.error("Failed to create program");
97 return () => {};
98 }
99
100 // Get attribute and uniform locations
101 const positionAttributeLocation = gl.getAttribLocation(program, "a_position");
102 const timeUniformLocation = gl.getUniformLocation(program, "u_time");
103
104 // Create a position buffer for a rectangle covering the entire canvas
105 const positionBuffer = gl.createBuffer();
106 if (!positionBuffer) {
107 console.error("Failed to create position buffer");
108 return () => {};
109 }
110
111 gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer);
112 // Rectangle that covers the entire clip space
113 const positions = [
114 -1.0,
115 -1.0, // bottom left
116 1.0,
117 -1.0, // bottom right
118 -1.0,
119 1.0, // top left
120 1.0,
121 1.0, // top right
122 ];
123 gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(positions), gl.STATIC_DRAW);
124
125 // Set up blending
126 gl.enable(gl.BLEND);
127 gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
128
129 // Fixed 24 FPS timing
130 const FPS = 24;
131 const FRAME_TIME = 1000 / FPS; // ms per frame
132
133 // Handle animation
134 let animationTimerId: number;
135 let startTime = Date.now();
136 let lastFrameTime = 0;
137
138 const render = () => {
139 // Get current time
140 const currentTime = Date.now();
141 const deltaTime = currentTime - lastFrameTime;
142
143 // Skip frame if it's too early (maintain 24 FPS)
144 if (deltaTime < FRAME_TIME) {
145 animationTimerId = globalThis.setTimeout(render, 0); // Check again ASAP but yield to browser
146 return;
147 }
148
149 // Update last frame time, accounting for any drift
150 lastFrameTime = currentTime - (deltaTime % FRAME_TIME);
151
152 // Resize canvas if needed
153 resize();
154
155 // Calculate elapsed time in seconds for animation
156 const elapsedTime = (currentTime - startTime) / 1000;
157
158 // Clear the canvas with transparent black
159 gl.clearColor(0, 0, 0, 0);
160 gl.clear(gl.COLOR_BUFFER_BIT);
161
162 // Use our shader program
163 gl.useProgram(program);
164
165 // Set up the position attribute
166 gl.enableVertexAttribArray(positionAttributeLocation);
167 gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer);
168 gl.vertexAttribPointer(
169 positionAttributeLocation,
170 2, // 2 components per vertex
171 gl.FLOAT, // data type
172 false, // normalize
173 0, // stride (0 = compute from size and type)
174 0, // offset
175 );
176
177 // Update time uniform for animation
178 gl.uniform1f(timeUniformLocation, elapsedTime);
179
180 // Draw the rectangle (2 triangles)
181 gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
182
183 // Schedule next frame (aiming for 24 FPS)
184 const timeToNextFrame = Math.max(
185 0,
186 FRAME_TIME - (Date.now() - currentTime),
187 );
188 animationTimerId = globalThis.setTimeout(render, timeToNextFrame);
189 };
190
191 // Helper function to create shaders
192 function createShader(
193 gl: WebGLRenderingContext,
194 type: number,
195 source: string,
196 ): WebGLShader | null {
197 const shader = gl.createShader(type);
198 if (!shader) {
199 console.error("Failed to create shader object");
200 return null;
201 }
202
203 gl.shaderSource(shader, source);
204 gl.compileShader(shader);
205
206 if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
207 console.error("Shader compilation error:", gl.getShaderInfoLog(shader));
208 gl.deleteShader(shader);
209 return null;
210 }
211
212 return shader;
213 }
214
215 // Helper function to create program and link shaders
216 function createProgram(
217 gl: WebGLRenderingContext,
218 vertexShader: WebGLShader,
219 fragmentShader: WebGLShader,
220 ): WebGLProgram | null {
221 const program = gl.createProgram();
222 if (!program) {
223 console.error("Failed to create program object");
224 return null;
225 }
226
227 gl.attachShader(program, vertexShader);
228 gl.attachShader(program, fragmentShader);
229 gl.linkProgram(program);
230
231 if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
232 console.error("Program linking error:", gl.getProgramInfoLog(program));
233 return null;
234 }
235
236 return program;
237 }
238
239 // Start the rendering with initial timestamp
240 lastFrameTime = Date.now();
241 render();
242
243 // Return cleanup function
244 return () => {
245 clearTimeout(animationTimerId);
246 if (program) gl.deleteProgram(program);
247 if (vertexShader) gl.deleteShader(vertexShader);
248 if (fragmentShader) gl.deleteShader(fragmentShader);
249 if (positionBuffer) gl.deleteBuffer(positionBuffer);
250 };
251};
src/file-viewer/scripts/canvas_cotyledon.client.ts deleted-197
......@@ -1,197 +0,0 @@
1// __esModule
2true
3
4// computeNode
5function computeNode(node) {
6 switch (node.type) {
7 case "StringLiteral":
8 case "NumericLiteral":
9 case "BooleanLiteral":
10 return { value: node.value };
11 case "RegExpLiteral":
12 return { value: new RegExp(node.pattern, node.flags) };
13 case "NullLiteral":
14 return { value: null };
15 case "Identifier":
16 switch (node.name) {
17 case "undefined":
18 return { value: undefined };
19 case "NaN":
20 return { value: NaN };
21 case "Infinity":
22 return { value: Infinity };
23 default:
24 return;
25 }
26 case "BigIntLiteral":
27 return { value: BigInt(node.value) };
28 case "ParenthesizedExpression":
29 return computeNode(node.expression);
30 case "BinaryExpression":{
31 const left = computeNode(node.left);
32 if (!left) return;
33 const right = computeNode(node.right);
34 if (!right) return;
35 switch (node.operator) {
36 case "+":
37 return { value: left.value + right.value };
38 case "-":
39 return { value: left.value - right.value };
40 case "*":
41 return { value: left.value * right.value };
42 case "/":
43 return { value: left.value / right.value };
44 case "%":
45 return { value: left.value % right.value };
46 case "**":
47 return { value: left.value ** right.value };
48 case "|":
49 return { value: left.value | right.value };
50 case "&":
51 return { value: left.value & right.value };
52 case "^":
53 return { value: left.value ^ right.value };
54 case "<<":
55 return { value: left.value << right.value };
56 case ">>":
57 return { value: left.value >> right.value };
58 case ">>>":
59 return { value: left.value >>> right.value };
60 case "==":
61 return { value: left.value == right.value };
62 case "!=":
63 return { value: left.value != right.value };
64 case "===":
65 return { value: left.value === right.value };
66 case "!==":
67 return { value: left.value !== right.value };
68 case "<":
69 return { value: left.value < right.value };
70 case "<=":
71 return { value: left.value <= right.value };
72 case ">":
73 return { value: left.value > right.value };
74 case ">=":
75 return { value: left.value >= right.value };
76 default:
77 return;
78 }
79 }
80 case "UnaryExpression":{
81 const arg = computeNode(node.argument);
82 if (!arg) return;
83 switch (node.operator) {
84 case "+":
85 return { value: +arg.value };
86 case "-":
87 return { value: -arg.value };
88 case "~":
89 return { value: ~arg.value };
90 case "!":
91 return { value: !arg.value };
92 case "typeof":
93 return { value: typeof arg.value };
94 case "void":
95 return { value: void arg.value };
96 default:
97 return;
98 }
99 }
100 case "LogicalExpression":{
101 const left = computeNode(node.left);
102 if (!left) return;
103 const right = computeNode(node.right);
104 if (!right) return;
105 switch (node.operator) {
106 case "&&":
107 return { value: left.value && right.value };
108 case "||":
109 return { value: left.value || right.value };
110 case "??":
111 return { value: left.value ?? right.value };
112 default:
113 return;
114 }
115 }
116 case "ConditionalExpression":{
117 const test = computeNode(node.test);
118 if (!test) return;
119 const consequent = computeNode(node.consequent);
120 if (!consequent) return;
121 const alternate = computeNode(node.alternate);
122 if (!alternate) return;
123 return { value: test.value ? consequent.value : alternate.value };
124 }
125 case "TemplateLiteral":{
126 let value = node.quasis[0].value.cooked;
127 for (let i = 0; i < node.expressions.length; i++) {
128 const expr = computeNode(node.expressions[i]);
129 if (!expr) return;
130 value += expr.value + node.quasis[i + 1].value.cooked;
131 }
132 return { value };
133 }
134 case "ObjectExpression":{
135 const value = {};
136 for (const prop of node.properties) {
137 if (prop.decorators) return;
138 switch (prop.type) {
139 case "ObjectProperty":{
140 let key;
141 if (prop.computed) {
142 const keyNode = computeNode(prop.key);
143 if (!keyNode) return;
144 key = keyNode.value + "";
145 } else {
146 switch (prop.key.type) {
147 case "Identifier":
148 key = prop.key.name;
149 break;
150 case "StringLiteral":
151 key = prop.key.value;
152 break;
153 default:
154 return;
155 }
156 }
157
158 const propValue = computeNode(prop.value);
159 if (!propValue) return;
160 value[key] = propValue.value;
161 break;
162 }
163 case "SpreadElement":{
164 const arg = computeNode(prop.argument);
165 if (!arg) return;
166 Object.assign(value, arg.value);
167 break;
168 }
169 }
170 }
171
172 return { value };
173 }
174 case "ArrayExpression":{
175 const value = [];
176 for (const elem of node.elements) {
177 if (elem) {
178 if (elem.type === "SpreadElement") {
179 const arg = computeNode(elem.argument);
180 if (typeof arg?.value?.[Symbol.iterator] !== "function") return;
181 for (const item of arg.value) {
182 value.push(item);
183 }
184 } else {
185 const elemValue = computeNode(elem);
186 if (!elemValue) return;
187 value.push(elemValue.value);
188 }
189 } else {
190 value.length++;
191 }
192 }
193
194 return { value };
195 }
196 }
197}
src/file-viewer/server/.gitignore deleted-98
......@@ -1,98 +0,0 @@
1// default
2class ImportBuilder {
3 constructor(importedSource, scope, hub) {
4 this._statements = [];
5 this._resultName = null;
6 this._importedSource = void 0;
7 this._scope = scope;
8 this._hub = hub;
9 this._importedSource = importedSource;
10 }
11 done() {
12 return {
13 statements: this._statements,
14 resultName: this._resultName
15 };
16 }
17 import() {
18 this._statements.push(importDeclaration([], stringLiteral(this._importedSource)));
19 return this;
20 }
21 require() {
22 this._statements.push(expressionStatement(callExpression(identifier("require"), [stringLiteral(this._importedSource)])));
23 return this;
24 }
25 namespace(name = "namespace") {
26 const local = this._scope.generateUidIdentifier(name);
27 const statement = this._statements[this._statements.length - 1];
28 _assert(statement.type === "ImportDeclaration");
29 _assert(statement.specifiers.length === 0);
30 statement.specifiers = [importNamespaceSpecifier(local)];
31 this._resultName = cloneNode(local);
32 return this;
33 }
34 default(name) {
35 const id = this._scope.generateUidIdentifier(name);
36 const statement = this._statements[this._statements.length - 1];
37 _assert(statement.type === "ImportDeclaration");
38 _assert(statement.specifiers.length === 0);
39 statement.specifiers = [importDefaultSpecifier(id)];
40 this._resultName = cloneNode(id);
41 return this;
42 }
43 named(name, importName) {
44 if (importName === "default") return this.default(name);
45 const id = this._scope.generateUidIdentifier(name);
46 const statement = this._statements[this._statements.length - 1];
47 _assert(statement.type === "ImportDeclaration");
48 _assert(statement.specifiers.length === 0);
49 statement.specifiers = [importSpecifier(id, identifier(importName))];
50 this._resultName = cloneNode(id);
51 return this;
52 }
53 var(name) {
54 const id = this._scope.generateUidIdentifier(name);
55 let statement = this._statements[this._statements.length - 1];
56 if (statement.type !== "ExpressionStatement") {
57 _assert(this._resultName);
58 statement = expressionStatement(this._resultName);
59 this._statements.push(statement);
60 }
61 this._statements[this._statements.length - 1] = variableDeclaration("var", [variableDeclarator(id, statement.expression)]);
62 this._resultName = cloneNode(id);
63 return this;
64 }
65 defaultInterop() {
66 return this._interop(this._hub.addHelper("interopRequireDefault"));
67 }
68 wildcardInterop() {
69 return this._interop(this._hub.addHelper("interopRequireWildcard"));
70 }
71 _interop(callee) {
72 const statement = this._statements[this._statements.length - 1];
73 if (statement.type === "ExpressionStatement") {
74 statement.expression = callExpression(callee, [statement.expression]);
75 } else if (statement.type === "VariableDeclaration") {
76 _assert(statement.declarations.length === 1);
77 statement.declarations[0].init = callExpression(callee, [statement.declarations[0].init]);
78 } else {
79 _assert.fail("Unexpected type.");
80 }
81 return this;
82 }
83 prop(name) {
84 const statement = this._statements[this._statements.length - 1];
85 if (statement.type === "ExpressionStatement") {
86 statement.expression = memberExpression(statement.expression, identifier(name));
87 } else if (statement.type === "VariableDeclaration") {
88 _assert(statement.declarations.length === 1);
89 statement.declarations[0].init = memberExpression(statement.declarations[0].init, identifier(name));
90 } else {
91 _assert.fail("Unexpected type:" + statement.type);
92 }
93 return this;
94 }
95 read(name) {
96 this._resultName = memberExpression(this._resultName, identifier(name));
97 }
98}
src/file-viewer/server/CHANGES.md deleted-4
......@@ -1,4 +0,0 @@
1// default
2function isModule(path) {
3 return path.node.sourceType === "module";
4}
src/file-viewer/server/CLAUDE.md deleted-12
......@@ -1,12 +0,0 @@
1// default
2function rewriteThis(programPath) {
3 if (!rewriteThisVisitor) {
4 rewriteThisVisitor = _traverse.visitors.environmentVisitor({
5 ThisExpression(path) {
6 path.replaceWith(_core.types.unaryExpression("void", _core.types.numericLiteral(0), true));
7 }
8 });
9 rewriteThisVisitor.noScope = true;
10 }
11 (0, _traverse.default)(programPath.node, rewriteThisVisitor);
12}
src/file-viewer/server/Cargo.lock deleted-61
......@@ -1,61 +0,0 @@
1// default
2function rewriteLiveReferences(programPath, metadata, wrapReference) {
3 const imported = new Map();
4 const exported = new Map();
5 const requeueInParent = path => {
6 programPath.requeue(path);
7 };
8 for (const [source, data] of metadata.source) {
9 for (const [localName, importName] of data.imports) {
10 imported.set(localName, [source, importName, null]);
11 }
12 for (const localName of data.importsNamespace) {
13 imported.set(localName, [source, null, localName]);
14 }
15 }
16 for (const [local, data] of metadata.local) {
17 let exportMeta = exported.get(local);
18 if (!exportMeta) {
19 exportMeta = [];
20 exported.set(local, exportMeta);
21 }
22 exportMeta.push(...data.names);
23 }
24 const rewriteBindingInitVisitorState = {
25 metadata,
26 requeueInParent,
27 scope: programPath.scope,
28 exported
29 };
30 programPath.traverse(rewriteBindingInitVisitor, rewriteBindingInitVisitorState);
31 const rewriteReferencesVisitorState = {
32 seen: new WeakSet(),
33 metadata,
34 requeueInParent,
35 scope: programPath.scope,
36 imported,
37 exported,
38 buildImportReference([source, importName, localName], identNode) {
39 const meta = metadata.source.get(source);
40 meta.referenced = true;
41 if (localName) {
42 if (meta.wrap) {
43 var _wrapReference;
44 identNode = (_wrapReference = wrapReference(identNode, meta.wrap)) != null ? _wrapReference : identNode;
45 }
46 return identNode;
47 }
48 let namespace = _core.types.identifier(meta.name);
49 if (meta.wrap) {
50 var _wrapReference2;
51 namespace = (_wrapReference2 = wrapReference(namespace, meta.wrap)) != null ? _wrapReference2 : namespace;
52 }
53 if (importName === "default" && meta.interop === "node-default") {
54 return namespace;
55 }
56 const computed = metadata.stringSpecifiers.has(importName);
57 return _core.types.memberExpression(namespace, computed ? _core.types.stringLiteral(importName) : _core.types.identifier(importName), computed);
58 }
59 };
60 programPath.traverse(rewriteReferencesVisitor, rewriteReferencesVisitorState);
61}
src/file-viewer/server/Cargo.toml deleted-69
......@@ -1,69 +0,0 @@
1// default
2function normalizeModuleAndLoadMetadata(programPath, exportName, {
3 importInterop,
4 initializeReexports = false,
5 getWrapperPayload,
6 esNamespaceOnly = false,
7 filename
8}) {
9 if (!exportName) {
10 exportName = programPath.scope.generateUidIdentifier("exports").name;
11 }
12 const stringSpecifiers = new Set();
13 nameAnonymousExports(programPath);
14 const {
15 local,
16 sources,
17 hasExports
18 } = getModuleMetadata(programPath, {
19 initializeReexports,
20 getWrapperPayload
21 }, stringSpecifiers);
22 removeImportExportDeclarations(programPath);
23 for (const [source, metadata] of sources) {
24 const {
25 importsNamespace,
26 imports
27 } = metadata;
28 if (importsNamespace.size > 0 && imports.size === 0) {
29 const [nameOfnamespace] = importsNamespace;
30 metadata.name = nameOfnamespace;
31 }
32 const resolvedInterop = resolveImportInterop(importInterop, source, filename);
33 if (resolvedInterop === "none") {
34 metadata.interop = "none";
35 } else if (resolvedInterop === "node" && metadata.interop === "namespace") {
36 metadata.interop = "node-namespace";
37 } else if (resolvedInterop === "node" && metadata.interop === "default") {
38 metadata.interop = "node-default";
39 } else if (esNamespaceOnly && metadata.interop === "namespace") {
40 metadata.interop = "default";
41 }
42 }
43 return {
44 exportName,
45 exportNameListName: null,
46 hasExports,
47 local,
48 source: sources,
49 stringSpecifiers
50 };
51}
52
53// hasExports
54function hasExports(metadata) {
55 return metadata.hasExports;
56}
57
58// isSideEffectImport
59function isSideEffectImport(source) {
60 return source.imports.size === 0 && source.importsNamespace.size === 0 && source.reexports.size === 0 && source.reexportNamespace.size === 0 && !source.reexportAll;
61}
62
63// validateImportInteropOption
64function validateImportInteropOption(importInterop) {
65 if (typeof importInterop !== "function" && importInterop !== "none" && importInterop !== "babel" && importInterop !== "node") {
66 throw new Error(`.importInterop must be one of "none", "babel", "node", or a function returning one of those values (received ${importInterop}).`);
67 }
68 return importInterop;
69}
src/file-viewer/server/DOCKER.md deleted-23
......@@ -1,23 +0,0 @@
1// toGetWrapperPayload
2function toGetWrapperPayload(lazy) {
3 return (source, metadata) => {
4 if (lazy === false) return null;
5 if ((0, _normalizeAndLoadMetadata.isSideEffectImport)(metadata) || metadata.reexportAll) return null;
6 if (lazy === true) {
7 return source.includes(".") ? null : "lazy";
8 }
9 if (Array.isArray(lazy)) {
10 return !lazy.includes(source) ? null : "lazy";
11 }
12 if (typeof lazy === "function") {
13 return lazy(source) ? "lazy" : null;
14 }
15 throw new Error(`.lazy must be a boolean, string array, or function`);
16 };
17}
18
19// wrapReference
20function wrapReference(ref, payload) {
21 if (payload === "lazy") return _core.types.callExpression(ref, []);
22 return null;
23}
src/file-viewer/server/Dockerfile deleted-40
......@@ -1,40 +0,0 @@
1// buildDynamicImport
2function buildDynamicImport(node, deferToThen, wrapWithPromise, builder) {
3 const specifier = _core.types.isCallExpression(node) ? node.arguments[0] : node.source;
4 if (_core.types.isStringLiteral(specifier) || _core.types.isTemplateLiteral(specifier) && specifier.quasis.length === 0) {
5 if (deferToThen) {
6 return _core.template.expression.ast`
7 Promise.resolve().then(() => ${builder(specifier)})
8 `;
9 } else return builder(specifier);
10 }
11 const specifierToString = _core.types.isTemplateLiteral(specifier) ? _core.types.identifier("specifier") : _core.types.templateLiteral([_core.types.templateElement({
12 raw: ""
13 }), _core.types.templateElement({
14 raw: ""
15 })], [_core.types.identifier("specifier")]);
16 if (deferToThen) {
17 return _core.template.expression.ast`
18 (specifier =>
19 new Promise(r => r(${specifierToString}))
20 .then(s => ${builder(_core.types.identifier("s"))})
21 )(${specifier})
22 `;
23 } else if (wrapWithPromise) {
24 return _core.template.expression.ast`
25 (specifier =>
26 new Promise(r => r(${builder(specifierToString)}))
27 )(${specifier})
28 `;
29 } else {
30 return _core.template.expression.ast`
31 (specifier => ${builder(specifierToString)})(${specifier})
32 `;
33 }
34}
35
36// getDynamicImportSource
37function getDynamicImportSource(node) {
38 const [source] = node.arguments;
39 return _core.types.isStringLiteral(source) || _core.types.isTemplateLiteral(source) ? source : _core.template.expression.ast`\`\${${source}}\``;
40 }
src/file-viewer/server/README.md deleted-10
......@@ -1,10 +0,0 @@
1// default
2function getModuleName(rootOpts, pluginOpts) {
3 var _pluginOpts$moduleId, _pluginOpts$moduleIds, _pluginOpts$getModule, _pluginOpts$moduleRoo;
4 return originalGetModuleName(rootOpts, {
5 moduleId: (_pluginOpts$moduleId = pluginOpts.moduleId) != null ? _pluginOpts$moduleId : rootOpts.moduleId,
6 moduleIds: (_pluginOpts$moduleIds = pluginOpts.moduleIds) != null ? _pluginOpts$moduleIds : rootOpts.moduleIds,
7 getModuleId: (_pluginOpts$getModule = pluginOpts.getModuleId) != null ? _pluginOpts$getModule : rootOpts.getModuleId,
8 moduleRoot: (_pluginOpts$moduleRoo = pluginOpts.moduleRoot) != null ? _pluginOpts$moduleRoo : rootOpts.moduleRoot
9 });
10 }
src/file-viewer/server/config.docker.toml deleted-5
......@@ -1,5 +0,0 @@
1// transformDynamicImport
2function transformDynamicImport(path, noInterop, file) {
3 const buildRequire = noInterop ? requireNoInterop : requireInterop;
4 path.replaceWith((0, _helperModuleTransforms.buildDynamicImport)(path.node, true, false, specifier => buildRequire(specifier, file)));
5}
src/file-viewer/server/config.example.toml deleted-34
......@@ -1,34 +0,0 @@
1// lazyImportsHook
2lazy => ({
3 name: `${"@babel/plugin-transform-modules-commonjs"}/lazy`,
4 version: "7.27.1",
5 getWrapperPayload(source, metadata) {
6 if ((0, _helperModuleTransforms.isSideEffectImport)(metadata) || metadata.reexportAll) {
7 return null;
8 }
9 if (lazy === true) {
10 return source.includes(".") ? null : "lazy/function";
11 }
12 if (Array.isArray(lazy)) {
13 return !lazy.includes(source) ? null : "lazy/function";
14 }
15 if (typeof lazy === "function") {
16 return lazy(source) ? "lazy/function" : null;
17 }
18 },
19 buildRequireWrapper(name, init, payload, referenced) {
20 if (payload === "lazy/function") {
21 if (!referenced) return false;
22 return _core.template.statement.ast`
23 function ${name}() {
24 const data = ${init};
25 ${name} = function(){ return data; };
26 return data;
27 }
28 `;
29 }
30 },
31 wrapReference(ref, payload) {
32 if (payload === "lazy/function") return _core.types.callExpression(ref, []);
33 }
34})
src/file-viewer/server/config.test.toml deleted-22
......@@ -1,22 +0,0 @@
1// defineCommonJSHook
2function defineCommonJSHook(file, hook) {
3 let hooks = file.get(commonJSHooksKey);
4 if (!hooks) file.set(commonJSHooksKey, hooks = []);
5 hooks.push(hook);
6}
7
8// makeInvokers
9function makeInvokers(file) {
10 const hooks = file.get(commonJSHooksKey);
11 return {
12 getWrapperPayload(...args) {
13 return findMap(hooks, hook => hook.getWrapperPayload == null ? void 0 : hook.getWrapperPayload(...args));
14 },
15 wrapReference(...args) {
16 return findMap(hooks, hook => hook.wrapReference == null ? void 0 : hook.wrapReference(...args));
17 },
18 buildRequireWrapper(...args) {
19 return findMap(hooks, hook => hook.buildRequireWrapper == null ? void 0 : hook.buildRequireWrapper(...args));
20 }
21 };
22}
src/file-viewer/server/docker-compose.yml deleted-10
......@@ -1,10 +0,0 @@
1// default
2(api, options, dirname) => {
3 let clonedApi;
4 for (const name of Object.keys(apiPolyfills)) {
5 if (api[name]) continue;
6 clonedApi != null ? clonedApi : clonedApi = copyApiObject(api);
7 clonedApi[name] = apiPolyfills[name](clonedApi);
8 }
9 return builder(clonedApi != null ? clonedApi : api, options || {}, dirname);
10 }
src/file-viewer/server/docker-compose.yml.bak deleted-298
......@@ -1,298 +0,0 @@
1// FEATURES
2[object Object]
3
4// buildCheckInRHS
5function buildCheckInRHS(rhs, file, inRHSIsObject) {
6 if (inRHSIsObject || !(file.availableHelper != null && file.availableHelper("checkInRHS"))) return rhs;
7 return _core.types.callExpression(file.addHelper("checkInRHS"), [rhs]);
8}
9
10// createClassFeaturePlugin
11function createClassFeaturePlugin({
12 name,
13 feature,
14 loose,
15 manipulateOptions,
16 api,
17 inherits,
18 decoratorVersion
19}) {
20 var _api$assumption;
21 if (feature & _features.FEATURES.decorators) {
22 {
23 if (decoratorVersion === "2023-11" || decoratorVersion === "2023-05" || decoratorVersion === "2023-01" || decoratorVersion === "2022-03" || decoratorVersion === "2021-12") {
24 return (0, _decorators.default)(api, {
25 loose
26 }, decoratorVersion, inherits);
27 }
28 }
29 }
30 {
31 api != null ? api : api = {
32 assumption: () => void 0
33 };
34 }
35 const setPublicClassFields = api.assumption("setPublicClassFields");
36 const privateFieldsAsSymbols = api.assumption("privateFieldsAsSymbols");
37 const privateFieldsAsProperties = api.assumption("privateFieldsAsProperties");
38 const noUninitializedPrivateFieldAccess = (_api$assumption = api.assumption("noUninitializedPrivateFieldAccess")) != null ? _api$assumption : false;
39 const constantSuper = api.assumption("constantSuper");
40 const noDocumentAll = api.assumption("noDocumentAll");
41 if (privateFieldsAsProperties && privateFieldsAsSymbols) {
42 throw new Error(`Cannot enable both the "privateFieldsAsProperties" and ` + `"privateFieldsAsSymbols" assumptions as the same time.`);
43 }
44 const privateFieldsAsSymbolsOrProperties = privateFieldsAsProperties || privateFieldsAsSymbols;
45 if (loose === true) {
46 const explicit = [];
47 if (setPublicClassFields !== undefined) {
48 explicit.push(`"setPublicClassFields"`);
49 }
50 if (privateFieldsAsProperties !== undefined) {
51 explicit.push(`"privateFieldsAsProperties"`);
52 }
53 if (privateFieldsAsSymbols !== undefined) {
54 explicit.push(`"privateFieldsAsSymbols"`);
55 }
56 if (explicit.length !== 0) {
57 console.warn(`[${name}]: You are using the "loose: true" option and you are` + ` explicitly setting a value for the ${explicit.join(" and ")}` + ` assumption${explicit.length > 1 ? "s" : ""}. The "loose" option` + ` can cause incompatibilities with the other class features` + ` plugins, so it's recommended that you replace it with the` + ` following top-level option:\n` + `\t"assumptions": {\n` + `\t\t"setPublicClassFields": true,\n` + `\t\t"privateFieldsAsSymbols": true\n` + `\t}`);
58 }
59 }
60 return {
61 name,
62 manipulateOptions,
63 inherits,
64 pre(file) {
65 (0, _features.enableFeature)(file, feature, loose);
66 {
67 if (typeof file.get(versionKey) === "number") {
68 file.set(versionKey, "7.27.1");
69 return;
70 }
71 }
72 if (!file.get(versionKey) || _semver.lt(file.get(versionKey), "7.27.1")) {
73 file.set(versionKey, "7.27.1");
74 }
75 },
76 visitor: {
77 Class(path, {
78 file
79 }) {
80 if (file.get(versionKey) !== "7.27.1") return;
81 if (!(0, _features.shouldTransform)(path, file)) return;
82 const pathIsClassDeclaration = path.isClassDeclaration();
83 if (pathIsClassDeclaration) (0, _typescript.assertFieldTransformed)(path);
84 const loose = (0, _features.isLoose)(file, feature);
85 let constructor;
86 const isDecorated = (0, _decorators.hasDecorators)(path.node);
87 const props = [];
88 const elements = [];
89 const computedPaths = [];
90 const privateNames = new Set();
91 const body = path.get("body");
92 for (const path of body.get("body")) {
93 if ((path.isClassProperty() || path.isClassMethod()) && path.node.computed) {
94 computedPaths.push(path);
95 }
96 if (path.isPrivate()) {
97 const {
98 name
99 } = path.node.key.id;
100 const getName = `get ${name}`;
101 const setName = `set ${name}`;
102 if (path.isClassPrivateMethod()) {
103 if (path.node.kind === "get") {
104 if (privateNames.has(getName) || privateNames.has(name) && !privateNames.has(setName)) {
105 throw path.buildCodeFrameError("Duplicate private field");
106 }
107 privateNames.add(getName).add(name);
108 } else if (path.node.kind === "set") {
109 if (privateNames.has(setName) || privateNames.has(name) && !privateNames.has(getName)) {
110 throw path.buildCodeFrameError("Duplicate private field");
111 }
112 privateNames.add(setName).add(name);
113 }
114 } else {
115 if (privateNames.has(name) && !privateNames.has(getName) && !privateNames.has(setName) || privateNames.has(name) && (privateNames.has(getName) || privateNames.has(setName))) {
116 throw path.buildCodeFrameError("Duplicate private field");
117 }
118 privateNames.add(name);
119 }
120 }
121 if (path.isClassMethod({
122 kind: "constructor"
123 })) {
124 constructor = path;
125 } else {
126 elements.push(path);
127 if (path.isProperty() || path.isPrivate() || path.isStaticBlock != null && path.isStaticBlock()) {
128 props.push(path);
129 }
130 }
131 }
132 {
133 if (!props.length && !isDecorated) return;
134 }
135 const innerBinding = path.node.id;
136 let ref;
137 if (!innerBinding || !pathIsClassDeclaration) {
138 {
139 var _path$ensureFunctionN;
140 (_path$ensureFunctionN = path.ensureFunctionName) != null ? _path$ensureFunctionN : path.ensureFunctionName = require("@babel/traverse").NodePath.prototype.ensureFunctionName;
141 }
142 path.ensureFunctionName(false);
143 ref = path.scope.generateUidIdentifier((innerBinding == null ? void 0 : innerBinding.name) || "Class");
144 }
145 const classRefForDefine = ref != null ? ref : _core.types.cloneNode(innerBinding);
146 const privateNamesMap = (0, _fields.buildPrivateNamesMap)(classRefForDefine.name, privateFieldsAsSymbolsOrProperties != null ? privateFieldsAsSymbolsOrProperties : loose, props, file);
147 const privateNamesNodes = (0, _fields.buildPrivateNamesNodes)(privateNamesMap, privateFieldsAsProperties != null ? privateFieldsAsProperties : loose, privateFieldsAsSymbols != null ? privateFieldsAsSymbols : false, file);
148 (0, _fields.transformPrivateNamesUsage)(classRefForDefine, path, privateNamesMap, {
149 privateFieldsAsProperties: privateFieldsAsSymbolsOrProperties != null ? privateFieldsAsSymbolsOrProperties : loose,
150 noUninitializedPrivateFieldAccess,
151 noDocumentAll,
152 innerBinding
153 }, file);
154 let keysNodes, staticNodes, instanceNodes, lastInstanceNodeReturnsThis, pureStaticNodes, classBindingNode, wrapClass;
155 {
156 if (isDecorated) {
157 staticNodes = pureStaticNodes = keysNodes = [];
158 ({
159 instanceNodes,
160 wrapClass
161 } = (0, _decorators2.buildDecoratedClass)(classRefForDefine, path, elements, file));
162 } else {
163 keysNodes = (0, _misc.extractComputedKeys)(path, computedPaths, file);
164 ({
165 staticNodes,
166 pureStaticNodes,
167 instanceNodes,
168 lastInstanceNodeReturnsThis,
169 classBindingNode,
170 wrapClass
171 } = (0, _fields.buildFieldsInitNodes)(ref, path.node.superClass, props, privateNamesMap, file, setPublicClassFields != null ? setPublicClassFields : loose, privateFieldsAsSymbolsOrProperties != null ? privateFieldsAsSymbolsOrProperties : loose, noUninitializedPrivateFieldAccess, constantSuper != null ? constantSuper : loose, innerBinding));
172 }
173 }
174 if (instanceNodes.length > 0) {
175 (0, _misc.injectInitialization)(path, constructor, instanceNodes, (referenceVisitor, state) => {
176 {
177 if (isDecorated) return;
178 }
179 for (const prop of props) {
180 if (_core.types.isStaticBlock != null && _core.types.isStaticBlock(prop.node) || prop.node.static) continue;
181 prop.traverse(referenceVisitor, state);
182 }
183 }, lastInstanceNodeReturnsThis);
184 }
185 const wrappedPath = wrapClass(path);
186 wrappedPath.insertBefore([...privateNamesNodes, ...keysNodes]);
187 if (staticNodes.length > 0) {
188 wrappedPath.insertAfter(staticNodes);
189 }
190 if (pureStaticNodes.length > 0) {
191 wrappedPath.find(parent => parent.isStatement() || parent.isDeclaration()).insertAfter(pureStaticNodes);
192 }
193 if (classBindingNode != null && pathIsClassDeclaration) {
194 wrappedPath.insertAfter(classBindingNode);
195 }
196 },
197 ExportDefaultDeclaration(path, {
198 file
199 }) {
200 {
201 if (file.get(versionKey) !== "7.27.1") return;
202 const decl = path.get("declaration");
203 if (decl.isClassDeclaration() && (0, _decorators.hasDecorators)(decl.node)) {
204 if (decl.node.id) {
205 {
206 var _path$splitExportDecl;
207 (_path$splitExportDecl = path.splitExportDeclaration) != null ? _path$splitExportDecl : path.splitExportDeclaration = require("@babel/traverse").NodePath.prototype.splitExportDeclaration;
208 }
209 path.splitExportDeclaration();
210 } else {
211 decl.node.type = "ClassExpression";
212 }
213 }
214 }
215 }
216 }
217 };
218}
219
220// enableFeature
221function enableFeature(file, feature, loose) {
222 if (!hasFeature(file, feature) || canIgnoreLoose(file, feature)) {
223 file.set(featuresKey, file.get(featuresKey) | feature);
224 if (loose === "#__internal__@babel/preset-env__prefer-true-but-false-is-ok-if-it-prevents-an-error") {
225 setLoose(file, feature, true);
226 file.set(looseLowPriorityKey, file.get(looseLowPriorityKey) | feature);
227 } else if (loose === "#__internal__@babel/preset-env__prefer-false-but-true-is-ok-if-it-prevents-an-error") {
228 setLoose(file, feature, false);
229 file.set(looseLowPriorityKey, file.get(looseLowPriorityKey) | feature);
230 } else {
231 setLoose(file, feature, loose);
232 }
233 }
234 let resolvedLoose;
235 for (const [mask, name] of featuresSameLoose) {
236 if (!hasFeature(file, mask)) continue;
237 {
238 if (canIgnoreLoose(file, mask)) continue;
239 }
240 const loose = isLoose(file, mask);
241 if (resolvedLoose === !loose) {
242 throw new Error("'loose' mode configuration must be the same for @babel/plugin-transform-class-properties, " + "@babel/plugin-transform-private-methods and " + "@babel/plugin-transform-private-property-in-object (when they are enabled)." + "\n\n" + getBabelShowConfigForHint(file));
243 } else {
244 resolvedLoose = loose;
245 {
246 var higherPriorityPluginName = name;
247 }
248 }
249 }
250 if (resolvedLoose !== undefined) {
251 for (const [mask, name] of featuresSameLoose) {
252 if (hasFeature(file, mask) && isLoose(file, mask) !== resolvedLoose) {
253 setLoose(file, mask, resolvedLoose);
254 console.warn(`Though the "loose" option was set to "${!resolvedLoose}" in your @babel/preset-env ` + `config, it will not be used for ${name} since the "loose" mode option was set to ` + `"${resolvedLoose}" for ${higherPriorityPluginName}.\nThe "loose" option must be the ` + `same for @babel/plugin-transform-class-properties, @babel/plugin-transform-private-methods ` + `and @babel/plugin-transform-private-property-in-object (when they are enabled): you can ` + `silence this warning by explicitly adding\n` + `\t["${name}", { "loose": ${resolvedLoose} }]\n` + `to the "plugins" section of your Babel config.` + "\n\n" + getBabelShowConfigForHint(file));
255 }
256 }
257 }
258}
259
260// injectInitialization
261function injectInitialization(path, constructor, nodes, renamer, lastReturnsThis) {
262 if (!nodes.length) return;
263 const isDerived = !!path.node.superClass;
264 if (!constructor) {
265 const newConstructor = _core.types.classMethod("constructor", _core.types.identifier("constructor"), [], _core.types.blockStatement([]));
266 if (isDerived) {
267 newConstructor.params = [_core.types.restElement(_core.types.identifier("args"))];
268 newConstructor.body.body.push(_core.template.statement.ast`super(...args)`);
269 }
270 [constructor] = path.get("body").unshiftContainer("body", newConstructor);
271 }
272 if (renamer) {
273 renamer(referenceVisitor, {
274 scope: constructor.scope
275 });
276 }
277 if (isDerived) {
278 const bareSupers = [];
279 constructor.traverse(findBareSupers, bareSupers);
280 let isFirst = true;
281 for (const bareSuper of bareSupers) {
282 if (isFirst) {
283 isFirst = false;
284 } else {
285 nodes = nodes.map(n => _core.types.cloneNode(n));
286 }
287 if (!bareSuper.parentPath.isExpressionStatement()) {
288 const allNodes = [bareSuper.node, ...nodes.map(n => _core.types.toExpression(n))];
289 if (!lastReturnsThis) allNodes.push(_core.types.thisExpression());
290 bareSuper.replaceWith(_core.types.sequenceExpression(allNodes));
291 } else {
292 bareSuper.insertAfter(nodes);
293 }
294 }
295 } else {
296 constructor.get("body").unshiftContainer("body", nodes);
297 }
298}
src/file-viewer/server/generate_certs.sh deleted-323
......@@ -1,323 +0,0 @@
1// buildCheckInRHS
2function buildCheckInRHS(rhs, file, inRHSIsObject) {
3 if (inRHSIsObject || !(file.availableHelper != null && file.availableHelper("checkInRHS"))) return rhs;
4 return _core.types.callExpression(file.addHelper("checkInRHS"), [rhs]);
5}
6
7// buildFieldsInitNodes
8function buildFieldsInitNodes(ref, superRef, props, privateNamesMap, file, setPublicClassFields, privateFieldsAsSymbolsOrProperties, noUninitializedPrivateFieldAccess, constantSuper, innerBindingRef) {
9 let classRefFlags = 0;
10 let injectSuperRef;
11 const staticNodes = [];
12 const instanceNodes = [];
13 let lastInstanceNodeReturnsThis = false;
14 const pureStaticNodes = [];
15 let classBindingNode = null;
16 const getSuperRef = _core.types.isIdentifier(superRef) ? () => superRef : () => {
17 injectSuperRef != null ? injectSuperRef : injectSuperRef = props[0].scope.generateUidIdentifierBasedOnNode(superRef);
18 return injectSuperRef;
19 };
20 const classRefForInnerBinding = ref != null ? ref : props[0].scope.generateUidIdentifier((innerBindingRef == null ? void 0 : innerBindingRef.name) || "Class");
21 ref != null ? ref : ref = _core.types.cloneNode(innerBindingRef);
22 for (const prop of props) {
23 if (prop.isClassProperty()) {
24 ts.assertFieldTransformed(prop);
25 }
26 const isStatic = !(_core.types.isStaticBlock != null && _core.types.isStaticBlock(prop.node)) && prop.node.static;
27 const isInstance = !isStatic;
28 const isPrivate = prop.isPrivate();
29 const isPublic = !isPrivate;
30 const isField = prop.isProperty();
31 const isMethod = !isField;
32 const isStaticBlock = prop.isStaticBlock == null ? void 0 : prop.isStaticBlock();
33 if (isStatic) classRefFlags |= 1;
34 if (isStatic || isMethod && isPrivate || isStaticBlock) {
35 new _helperReplaceSupers.default({
36 methodPath: prop,
37 constantSuper,
38 file: file,
39 refToPreserve: innerBindingRef,
40 getSuperRef,
41 getObjectRef() {
42 classRefFlags |= 2;
43 if (isStatic || isStaticBlock) {
44 return classRefForInnerBinding;
45 } else {
46 return _core.types.memberExpression(classRefForInnerBinding, _core.types.identifier("prototype"));
47 }
48 }
49 }).replace();
50 const replaced = replaceThisContext(prop, classRefForInnerBinding, innerBindingRef);
51 if (replaced) {
52 classRefFlags |= 2;
53 }
54 }
55 lastInstanceNodeReturnsThis = false;
56 switch (true) {
57 case isStaticBlock:
58 {
59 const blockBody = prop.node.body;
60 if (blockBody.length === 1 && _core.types.isExpressionStatement(blockBody[0])) {
61 staticNodes.push(inheritPropComments(blockBody[0], prop));
62 } else {
63 staticNodes.push(_core.types.inheritsComments(_core.template.statement.ast`(() => { ${blockBody} })()`, prop.node));
64 }
65 break;
66 }
67 case isStatic && isPrivate && isField && privateFieldsAsSymbolsOrProperties:
68 staticNodes.push(buildPrivateFieldInitLoose(_core.types.cloneNode(ref), prop, privateNamesMap));
69 break;
70 case isStatic && isPrivate && isField && !privateFieldsAsSymbolsOrProperties:
71 if (!newHelpers(file)) {
72 staticNodes.push(buildPrivateStaticFieldInitSpecOld(prop, privateNamesMap));
73 } else {
74 staticNodes.push(buildPrivateStaticFieldInitSpec(prop, privateNamesMap, noUninitializedPrivateFieldAccess));
75 }
76 break;
77 case isStatic && isPublic && isField && setPublicClassFields:
78 if (!isNameOrLength(prop.node)) {
79 staticNodes.push(buildPublicFieldInitLoose(_core.types.cloneNode(ref), prop));
80 break;
81 }
82 case isStatic && isPublic && isField && !setPublicClassFields:
83 staticNodes.push(buildPublicFieldInitSpec(_core.types.cloneNode(ref), prop, file));
84 break;
85 case isInstance && isPrivate && isField && privateFieldsAsSymbolsOrProperties:
86 instanceNodes.push(buildPrivateFieldInitLoose(_core.types.thisExpression(), prop, privateNamesMap));
87 break;
88 case isInstance && isPrivate && isField && !privateFieldsAsSymbolsOrProperties:
89 instanceNodes.push(buildPrivateInstanceFieldInitSpec(_core.types.thisExpression(), prop, privateNamesMap, file));
90 break;
91 case isInstance && isPrivate && isMethod && privateFieldsAsSymbolsOrProperties:
92 instanceNodes.unshift(buildPrivateMethodInitLoose(_core.types.thisExpression(), prop, privateNamesMap));
93 pureStaticNodes.push(buildPrivateMethodDeclaration(file, prop, privateNamesMap, privateFieldsAsSymbolsOrProperties));
94 break;
95 case isInstance && isPrivate && isMethod && !privateFieldsAsSymbolsOrProperties:
96 instanceNodes.unshift(buildPrivateInstanceMethodInitSpec(_core.types.thisExpression(), prop, privateNamesMap, file));
97 pureStaticNodes.push(buildPrivateMethodDeclaration(file, prop, privateNamesMap, privateFieldsAsSymbolsOrProperties));
98 break;
99 case isStatic && isPrivate && isMethod && !privateFieldsAsSymbolsOrProperties:
100 if (!newHelpers(file)) {
101 staticNodes.unshift(buildPrivateStaticFieldInitSpecOld(prop, privateNamesMap));
102 }
103 pureStaticNodes.push(buildPrivateMethodDeclaration(file, prop, privateNamesMap, privateFieldsAsSymbolsOrProperties));
104 break;
105 case isStatic && isPrivate && isMethod && privateFieldsAsSymbolsOrProperties:
106 staticNodes.unshift(buildPrivateStaticMethodInitLoose(_core.types.cloneNode(ref), prop, file, privateNamesMap));
107 pureStaticNodes.push(buildPrivateMethodDeclaration(file, prop, privateNamesMap, privateFieldsAsSymbolsOrProperties));
108 break;
109 case isInstance && isPublic && isField && setPublicClassFields:
110 instanceNodes.push(buildPublicFieldInitLoose(_core.types.thisExpression(), prop));
111 break;
112 case isInstance && isPublic && isField && !setPublicClassFields:
113 lastInstanceNodeReturnsThis = true;
114 instanceNodes.push(buildPublicFieldInitSpec(_core.types.thisExpression(), prop, file));
115 break;
116 default:
117 throw new Error("Unreachable.");
118 }
119 }
120 if (classRefFlags & 2 && innerBindingRef != null) {
121 classBindingNode = _core.types.expressionStatement(_core.types.assignmentExpression("=", _core.types.cloneNode(classRefForInnerBinding), _core.types.cloneNode(innerBindingRef)));
122 }
123 return {
124 staticNodes: staticNodes.filter(Boolean),
125 instanceNodes: instanceNodes.filter(Boolean),
126 lastInstanceNodeReturnsThis,
127 pureStaticNodes: pureStaticNodes.filter(Boolean),
128 classBindingNode,
129 wrapClass(path) {
130 for (const prop of props) {
131 prop.node.leadingComments = null;
132 prop.remove();
133 }
134 if (injectSuperRef) {
135 path.scope.push({
136 id: _core.types.cloneNode(injectSuperRef)
137 });
138 path.set("superClass", _core.types.assignmentExpression("=", injectSuperRef, path.node.superClass));
139 }
140 if (classRefFlags !== 0) {
141 if (path.isClassExpression()) {
142 path.scope.push({
143 id: ref
144 });
145 path.replaceWith(_core.types.assignmentExpression("=", _core.types.cloneNode(ref), path.node));
146 } else {
147 if (innerBindingRef == null) {
148 path.node.id = ref;
149 }
150 if (classBindingNode != null) {
151 path.scope.push({
152 id: classRefForInnerBinding
153 });
154 }
155 }
156 }
157 return path;
158 }
159 };
160}
161
162// buildPrivateNamesMap
163function buildPrivateNamesMap(className, privateFieldsAsSymbolsOrProperties, props, file) {
164 const privateNamesMap = new Map();
165 let classBrandId;
166 for (const prop of props) {
167 if (prop.isPrivate()) {
168 const {
169 name
170 } = prop.node.key.id;
171 let update = privateNamesMap.get(name);
172 if (!update) {
173 const isMethod = !prop.isProperty();
174 const isStatic = prop.node.static;
175 let initAdded = false;
176 let id;
177 if (!privateFieldsAsSymbolsOrProperties && newHelpers(file) && isMethod && !isStatic) {
178 initAdded = !!classBrandId;
179 classBrandId != null ? classBrandId : classBrandId = prop.scope.generateUidIdentifier(`${className}_brand`);
180 id = classBrandId;
181 } else {
182 id = prop.scope.generateUidIdentifier(name);
183 }
184 update = {
185 id,
186 static: isStatic,
187 method: isMethod,
188 initAdded
189 };
190 privateNamesMap.set(name, update);
191 }
192 if (prop.isClassPrivateMethod()) {
193 if (prop.node.kind === "get") {
194 const {
195 body
196 } = prop.node.body;
197 let $;
198 if (body.length === 1 && _core.types.isReturnStatement($ = body[0]) && _core.types.isCallExpression($ = $.argument) && $.arguments.length === 1 && _core.types.isThisExpression($.arguments[0]) && _core.types.isIdentifier($ = $.callee)) {
199 update.getId = _core.types.cloneNode($);
200 update.getterDeclared = true;
201 } else {
202 update.getId = prop.scope.generateUidIdentifier(`get_${name}`);
203 }
204 } else if (prop.node.kind === "set") {
205 const {
206 params
207 } = prop.node;
208 const {
209 body
210 } = prop.node.body;
211 let $;
212 if (body.length === 1 && _core.types.isExpressionStatement($ = body[0]) && _core.types.isCallExpression($ = $.expression) && $.arguments.length === 2 && _core.types.isThisExpression($.arguments[0]) && _core.types.isIdentifier($.arguments[1], {
213 name: params[0].name
214 }) && _core.types.isIdentifier($ = $.callee)) {
215 update.setId = _core.types.cloneNode($);
216 update.setterDeclared = true;
217 } else {
218 update.setId = prop.scope.generateUidIdentifier(`set_${name}`);
219 }
220 } else if (prop.node.kind === "method") {
221 update.methodId = prop.scope.generateUidIdentifier(name);
222 }
223 }
224 privateNamesMap.set(name, update);
225 }
226 }
227 return privateNamesMap;
228}
229
230// buildPrivateNamesNodes
231function buildPrivateNamesNodes(privateNamesMap, privateFieldsAsProperties, privateFieldsAsSymbols, state) {
232 const initNodes = [];
233 const injectedIds = new Set();
234 for (const [name, value] of privateNamesMap) {
235 const {
236 static: isStatic,
237 method: isMethod,
238 getId,
239 setId
240 } = value;
241 const isGetterOrSetter = getId || setId;
242 const id = _core.types.cloneNode(value.id);
243 let init;
244 if (privateFieldsAsProperties) {
245 init = _core.types.callExpression(state.addHelper("classPrivateFieldLooseKey"), [_core.types.stringLiteral(name)]);
246 } else if (privateFieldsAsSymbols) {
247 init = _core.types.callExpression(_core.types.identifier("Symbol"), [_core.types.stringLiteral(name)]);
248 } else if (!isStatic) {
249 if (injectedIds.has(id.name)) continue;
250 injectedIds.add(id.name);
251 init = _core.types.newExpression(_core.types.identifier(isMethod && (!isGetterOrSetter || newHelpers(state)) ? "WeakSet" : "WeakMap"), []);
252 }
253 if (init) {
254 if (!privateFieldsAsSymbols) {
255 (0, _helperAnnotateAsPure.default)(init);
256 }
257 initNodes.push(_core.template.statement.ast`var ${id} = ${init}`);
258 }
259 }
260 return initNodes;
261}
262
263// privateNameVisitorFactory
264function privateNameVisitorFactory(visitor) {
265 const nestedVisitor = _traverse.visitors.environmentVisitor(Object.assign({}, visitor));
266 const privateNameVisitor = Object.assign({}, visitor, {
267 Class(path) {
268 const {
269 privateNamesMap
270 } = this;
271 const body = path.get("body.body");
272 const visiblePrivateNames = new Map(privateNamesMap);
273 const redeclared = [];
274 for (const prop of body) {
275 if (!prop.isPrivate()) continue;
276 const {
277 name
278 } = prop.node.key.id;
279 visiblePrivateNames.delete(name);
280 redeclared.push(name);
281 }
282 if (!redeclared.length) {
283 return;
284 }
285 path.get("body").traverse(nestedVisitor, Object.assign({}, this, {
286 redeclared
287 }));
288 path.traverse(privateNameVisitor, Object.assign({}, this, {
289 privateNamesMap: visiblePrivateNames
290 }));
291 path.skipKey("body");
292 }
293 });
294 return privateNameVisitor;
295}
296
297// transformPrivateNamesUsage
298function transformPrivateNamesUsage(ref, path, privateNamesMap, {
299 privateFieldsAsProperties,
300 noUninitializedPrivateFieldAccess,
301 noDocumentAll,
302 innerBinding
303}, state) {
304 if (!privateNamesMap.size) return;
305 const body = path.get("body");
306 const handler = privateFieldsAsProperties ? privateNameHandlerLoose : privateNameHandlerSpec;
307 (0, _helperMemberExpressionToFunctions.default)(body, privateNameVisitor, Object.assign({
308 privateNamesMap,
309 classRef: ref,
310 file: state
311 }, handler, {
312 noDocumentAll,
313 noUninitializedPrivateFieldAccess,
314 innerBinding
315 }));
316 body.traverse(privateInVisitor, {
317 privateNamesMap,
318 classRef: ref,
319 file: state,
320 privateFieldsAsProperties,
321 innerBinding
322 });
323}
src/file-viewer/server/src/cache.rs deleted-6
......@@ -1,6 +0,0 @@
1// default
2function memberExpressionToFunctions(path, visitor, state) {
3 path.traverse(visitor, Object.assign({}, handle, state, {
4 memoiser: new AssignmentMemoiser()
5 }));
6}
src/file-viewer/server/src/config.rs deleted-16
......@@ -1,16 +0,0 @@
1// default
2function optimiseCallExpression(callee, thisNode, args, optional) {
3 if (args.length === 1 && isSpreadElement(args[0]) && isIdentifier(args[0].argument, {
4 name: "arguments"
5 })) {
6 if (optional) {
7 return optionalCallExpression(optionalMemberExpression(callee, identifier("apply"), false, true), [thisNode, args[0].argument], false);
8 }
9 return callExpression(memberExpression(callee, identifier("apply")), [thisNode, args[0].argument]);
10 } else {
11 if (optional) {
12 return optionalCallExpression(optionalMemberExpression(callee, identifier("call"), false, true), [thisNode, ...args], false);
13 }
14 return callExpression(memberExpression(callee, identifier("call")), [thisNode, ...args]);
15 }
16}
src/file-viewer/server/src/database.rs deleted-8
......@@ -1,8 +0,0 @@
1// default
2function annotateAsPure(pathOrNode) {
3 const node = pathOrNode.node || pathOrNode;
4 if (isPureAnnotated(node)) {
5 return;
6 }
7 addComment(node, "leading", PURE_ANNOTATION);
8}
src/file-viewer/server/src/main.rs deleted-20
......@@ -1,20 +0,0 @@
1// isTransparentExprWrapper
2function isTransparentExprWrapper(node) {
3 return isTSAsExpression(node) || isTSSatisfiesExpression(node) || isTSTypeAssertion(node) || isTSNonNullExpression(node) || isTypeCastExpression(node) || isParenthesizedExpression(node);
4}
5
6// skipTransparentExprWrapperNodes
7function skipTransparentExprWrapperNodes(node) {
8 while (isTransparentExprWrapper(node)) {
9 node = node.expression;
10 }
11 return node;
12}
13
14// skipTransparentExprWrappers
15function skipTransparentExprWrappers(path) {
16 while (isTransparentExprWrapper(path.node)) {
17 path = path.get("expression");
18 }
19 return path;
20}
src/file-viewer/server/src/routes.rs deleted-6
......@@ -1,6 +0,0 @@
1// assertFieldTransformed
2function assertFieldTransformed(path) {
3 if (path.node.declare || false) {
4 throw path.buildCodeFrameError(`TypeScript 'declare' fields must first be transformed by ` + `@babel/plugin-transform-typescript.\n` + `If you have already enabled that plugin (or '@babel/preset-typescript'), make sure ` + `that it runs before any plugin related to additional class features:\n` + ` - @babel/plugin-transform-class-properties\n` + ` - @babel/plugin-transform-private-methods\n` + ` - @babel/plugin-proposal-decorators`);
5 }
6}
src/file-viewer/server/src/routes_test.rs deleted-84
......@@ -1,84 +0,0 @@
1// default
2function _default({
3 assertVersion,
4 assumption
5}, {
6 loose
7}, version, inherits) {
8 var _assumption, _assumption2;
9 {
10 if (version === "2023-11" || version === "2023-05" || version === "2023-01") {
11 assertVersion("^7.21.0");
12 } else if (version === "2021-12") {
13 assertVersion("^7.16.0");
14 } else {
15 assertVersion("^7.19.0");
16 }
17 }
18 const VISITED = new WeakSet();
19 const constantSuper = (_assumption = assumption("constantSuper")) != null ? _assumption : loose;
20 const ignoreFunctionLength = (_assumption2 = assumption("ignoreFunctionLength")) != null ? _assumption2 : loose;
21 const namedEvaluationVisitor = NamedEvaluationVisitoryFactory(isDecoratedAnonymousClassExpression, visitClass);
22 function visitClass(path, state, className) {
23 var _node$id;
24 if (VISITED.has(path)) return;
25 const {
26 node
27 } = path;
28 className != null ? className : className = (_node$id = node.id) == null ? void 0 : _node$id.name;
29 const newPath = transformClass(path, state, constantSuper, ignoreFunctionLength, className, namedEvaluationVisitor, version);
30 if (newPath) {
31 VISITED.add(newPath);
32 return;
33 }
34 VISITED.add(path);
35 }
36 return {
37 name: "proposal-decorators",
38 inherits: inherits,
39 visitor: Object.assign({
40 ExportDefaultDeclaration(path, state) {
41 const {
42 declaration
43 } = path.node;
44 if ((declaration == null ? void 0 : declaration.type) === "ClassDeclaration" && isDecorated(declaration)) {
45 const isAnonymous = !declaration.id;
46 {
47 var _path$splitExportDecl;
48 (_path$splitExportDecl = path.splitExportDeclaration) != null ? _path$splitExportDecl : path.splitExportDeclaration = require("@babel/traverse").NodePath.prototype.splitExportDeclaration;
49 }
50 const updatedVarDeclarationPath = path.splitExportDeclaration();
51 if (isAnonymous) {
52 visitClass(updatedVarDeclarationPath, state, _core.types.stringLiteral("default"));
53 }
54 }
55 },
56 ExportNamedDeclaration(path) {
57 const {
58 declaration
59 } = path.node;
60 if ((declaration == null ? void 0 : declaration.type) === "ClassDeclaration" && isDecorated(declaration)) {
61 {
62 var _path$splitExportDecl2;
63 (_path$splitExportDecl2 = path.splitExportDeclaration) != null ? _path$splitExportDecl2 : path.splitExportDeclaration = require("@babel/traverse").NodePath.prototype.splitExportDeclaration;
64 }
65 path.splitExportDeclaration();
66 }
67 },
68 Class(path, state) {
69 visitClass(path, state, undefined);
70 }
71 }, namedEvaluationVisitor)
72 };
73}
74
75// hasDecorators
76function hasDecorators(node) {
77 return hasOwnDecorators(node) || node.body.body.some(hasOwnDecorators);
78}
79
80// hasOwnDecorators
81function hasOwnDecorators(node) {
82 var _node$decorators;
83 return !!((_node$decorators = node.decorators) != null && _node$decorators.length);
84}
src/file-viewer/server/src/server.rs deleted-89
......@@ -1,89 +0,0 @@
1// extractComputedKeys
2function extractComputedKeys(path, computedPaths, file) {
3 const {
4 scope
5 } = path;
6 const declarations = [];
7 const state = {
8 classBinding: path.node.id && scope.getBinding(path.node.id.name),
9 file
10 };
11 for (const computedPath of computedPaths) {
12 const computedKey = computedPath.get("key");
13 if (computedKey.isReferencedIdentifier()) {
14 handleClassTDZ(computedKey, state);
15 } else {
16 computedKey.traverse(classFieldDefinitionEvaluationTDZVisitor, state);
17 }
18 const computedNode = computedPath.node;
19 if (!computedKey.isConstantExpression()) {
20 const assignment = memoiseComputedKey(computedKey.node, scope, scope.generateUidBasedOnNode(computedKey.node));
21 if (assignment) {
22 declarations.push(_core.types.expressionStatement(assignment));
23 computedNode.key = _core.types.cloneNode(assignment.left);
24 }
25 }
26 }
27 return declarations;
28}
29
30// injectInitialization
31function injectInitialization(path, constructor, nodes, renamer, lastReturnsThis) {
32 if (!nodes.length) return;
33 const isDerived = !!path.node.superClass;
34 if (!constructor) {
35 const newConstructor = _core.types.classMethod("constructor", _core.types.identifier("constructor"), [], _core.types.blockStatement([]));
36 if (isDerived) {
37 newConstructor.params = [_core.types.restElement(_core.types.identifier("args"))];
38 newConstructor.body.body.push(_core.template.statement.ast`super(...args)`);
39 }
40 [constructor] = path.get("body").unshiftContainer("body", newConstructor);
41 }
42 if (renamer) {
43 renamer(referenceVisitor, {
44 scope: constructor.scope
45 });
46 }
47 if (isDerived) {
48 const bareSupers = [];
49 constructor.traverse(findBareSupers, bareSupers);
50 let isFirst = true;
51 for (const bareSuper of bareSupers) {
52 if (isFirst) {
53 isFirst = false;
54 } else {
55 nodes = nodes.map(n => _core.types.cloneNode(n));
56 }
57 if (!bareSuper.parentPath.isExpressionStatement()) {
58 const allNodes = [bareSuper.node, ...nodes.map(n => _core.types.toExpression(n))];
59 if (!lastReturnsThis) allNodes.push(_core.types.thisExpression());
60 bareSuper.replaceWith(_core.types.sequenceExpression(allNodes));
61 } else {
62 bareSuper.insertAfter(nodes);
63 }
64 }
65 } else {
66 constructor.get("body").unshiftContainer("body", nodes);
67 }
68}
69
70// memoiseComputedKey
71function memoiseComputedKey(keyNode, scope, hint) {
72 const isUidReference = _core.types.isIdentifier(keyNode) && scope.hasUid(keyNode.name);
73 if (isUidReference) {
74 return;
75 }
76 const isMemoiseAssignment = _core.types.isAssignmentExpression(keyNode, {
77 operator: "="
78 }) && _core.types.isIdentifier(keyNode.left) && scope.hasUid(keyNode.left.name);
79 if (isMemoiseAssignment) {
80 return _core.types.cloneNode(keyNode);
81 } else {
82 const ident = _core.types.identifier(hint);
83 scope.push({
84 id: ident,
85 kind: "let"
86 });
87 return _core.types.assignmentExpression("=", _core.types.cloneNode(ident), keyNode);
88 }
89}
src/file-viewer/server/tests/end_to_end.rs deleted-101
......@@ -1,101 +0,0 @@
1// FEATURES
2[object Object]
3
4// enableFeature
5function enableFeature(file, feature, loose) {
6 if (!hasFeature(file, feature) || canIgnoreLoose(file, feature)) {
7 file.set(featuresKey, file.get(featuresKey) | feature);
8 if (loose === "#__internal__@babel/preset-env__prefer-true-but-false-is-ok-if-it-prevents-an-error") {
9 setLoose(file, feature, true);
10 file.set(looseLowPriorityKey, file.get(looseLowPriorityKey) | feature);
11 } else if (loose === "#__internal__@babel/preset-env__prefer-false-but-true-is-ok-if-it-prevents-an-error") {
12 setLoose(file, feature, false);
13 file.set(looseLowPriorityKey, file.get(looseLowPriorityKey) | feature);
14 } else {
15 setLoose(file, feature, loose);
16 }
17 }
18 let resolvedLoose;
19 for (const [mask, name] of featuresSameLoose) {
20 if (!hasFeature(file, mask)) continue;
21 {
22 if (canIgnoreLoose(file, mask)) continue;
23 }
24 const loose = isLoose(file, mask);
25 if (resolvedLoose === !loose) {
26 throw new Error("'loose' mode configuration must be the same for @babel/plugin-transform-class-properties, " + "@babel/plugin-transform-private-methods and " + "@babel/plugin-transform-private-property-in-object (when they are enabled)." + "\n\n" + getBabelShowConfigForHint(file));
27 } else {
28 resolvedLoose = loose;
29 {
30 var higherPriorityPluginName = name;
31 }
32 }
33 }
34 if (resolvedLoose !== undefined) {
35 for (const [mask, name] of featuresSameLoose) {
36 if (hasFeature(file, mask) && isLoose(file, mask) !== resolvedLoose) {
37 setLoose(file, mask, resolvedLoose);
38 console.warn(`Though the "loose" option was set to "${!resolvedLoose}" in your @babel/preset-env ` + `config, it will not be used for ${name} since the "loose" mode option was set to ` + `"${resolvedLoose}" for ${higherPriorityPluginName}.\nThe "loose" option must be the ` + `same for @babel/plugin-transform-class-properties, @babel/plugin-transform-private-methods ` + `and @babel/plugin-transform-private-property-in-object (when they are enabled): you can ` + `silence this warning by explicitly adding\n` + `\t["${name}", { "loose": ${resolvedLoose} }]\n` + `to the "plugins" section of your Babel config.` + "\n\n" + getBabelShowConfigForHint(file));
39 }
40 }
41 }
42}
43
44// isLoose
45function isLoose(file, feature) {
46 return !!(file.get(looseKey) & feature);
47}
48
49// shouldTransform
50function shouldTransform(path, file) {
51 let decoratorPath = null;
52 let publicFieldPath = null;
53 let privateFieldPath = null;
54 let privateMethodPath = null;
55 let staticBlockPath = null;
56 if ((0, _decorators.hasOwnDecorators)(path.node)) {
57 decoratorPath = path.get("decorators.0");
58 }
59 for (const el of path.get("body.body")) {
60 if (!decoratorPath && (0, _decorators.hasOwnDecorators)(el.node)) {
61 decoratorPath = el.get("decorators.0");
62 }
63 if (!publicFieldPath && el.isClassProperty()) {
64 publicFieldPath = el;
65 }
66 if (!privateFieldPath && el.isClassPrivateProperty()) {
67 privateFieldPath = el;
68 }
69 if (!privateMethodPath && el.isClassPrivateMethod != null && el.isClassPrivateMethod()) {
70 privateMethodPath = el;
71 }
72 if (!staticBlockPath && el.isStaticBlock != null && el.isStaticBlock()) {
73 staticBlockPath = el;
74 }
75 }
76 if (decoratorPath && privateFieldPath) {
77 throw privateFieldPath.buildCodeFrameError("Private fields in decorated classes are not supported yet.");
78 }
79 if (decoratorPath && privateMethodPath) {
80 throw privateMethodPath.buildCodeFrameError("Private methods in decorated classes are not supported yet.");
81 }
82 if (decoratorPath && !hasFeature(file, FEATURES.decorators)) {
83 throw path.buildCodeFrameError("Decorators are not enabled." + "\nIf you are using " + '["@babel/plugin-proposal-decorators", { "version": "legacy" }], ' + 'make sure it comes *before* "@babel/plugin-transform-class-properties" ' + "and enable loose mode, like so:\n" + '\t["@babel/plugin-proposal-decorators", { "version": "legacy" }]\n' + '\t["@babel/plugin-transform-class-properties", { "loose": true }]');
84 }
85 if (privateMethodPath && !hasFeature(file, FEATURES.privateMethods)) {
86 throw privateMethodPath.buildCodeFrameError("Class private methods are not enabled. " + "Please add `@babel/plugin-transform-private-methods` to your configuration.");
87 }
88 if ((publicFieldPath || privateFieldPath) && !hasFeature(file, FEATURES.fields) && !hasFeature(file, FEATURES.privateMethods)) {
89 throw path.buildCodeFrameError("Class fields are not enabled. " + "Please add `@babel/plugin-transform-class-properties` to your configuration.");
90 }
91 if (staticBlockPath && !hasFeature(file, FEATURES.staticBlocks)) {
92 throw path.buildCodeFrameError("Static class blocks are not enabled. " + "Please add `@babel/plugin-transform-class-static-block` to your configuration.");
93 }
94 if (decoratorPath || privateMethodPath || staticBlockPath) {
95 return true;
96 }
97 if ((publicFieldPath || privateFieldPath) && hasFeature(file, FEATURES.fields)) {
98 return true;
99 }
100 return false;
101}
src/file-viewer/server/tests/manual_test.cjs deleted-53
......@@ -1,53 +0,0 @@
1// EXPORTED_CONST_ENUMS_IN_NAMESPACE
2[object WeakSet]
3
4// default
5function transpileConstEnum(path, t) {
6 const {
7 name
8 } = path.node.id;
9 const parentIsExport = path.parentPath.isExportNamedDeclaration();
10 let isExported = parentIsExport;
11 if (!isExported && t.isProgram(path.parent)) {
12 isExported = path.parent.body.some(stmt => t.isExportNamedDeclaration(stmt) && stmt.exportKind !== "type" && !stmt.source && stmt.specifiers.some(spec => t.isExportSpecifier(spec) && spec.exportKind !== "type" && spec.local.name === name));
13 }
14 const {
15 enumValues: entries
16 } = (0, _enum.translateEnumValues)(path, t);
17 if (isExported || EXPORTED_CONST_ENUMS_IN_NAMESPACE.has(path.node)) {
18 const obj = t.objectExpression(entries.map(([name, value]) => t.objectProperty(t.isValidIdentifier(name) ? t.identifier(name) : t.stringLiteral(name), value)));
19 if (path.scope.hasOwnBinding(name)) {
20 (parentIsExport ? path.parentPath : path).replaceWith(t.expressionStatement(t.callExpression(t.memberExpression(t.identifier("Object"), t.identifier("assign")), [path.node.id, obj])));
21 } else {
22 path.replaceWith(t.variableDeclaration("var", [t.variableDeclarator(path.node.id, obj)]));
23 path.scope.registerDeclaration(path);
24 }
25 return;
26 }
27 const entriesMap = new Map(entries);
28 path.scope.path.traverse({
29 Scope(path) {
30 if (path.scope.hasOwnBinding(name)) path.skip();
31 },
32 MemberExpression(path) {
33 if (!t.isIdentifier(path.node.object, {
34 name
35 })) return;
36 let key;
37 if (path.node.computed) {
38 if (t.isStringLiteral(path.node.property)) {
39 key = path.node.property.value;
40 } else {
41 return;
42 }
43 } else if (t.isIdentifier(path.node.property)) {
44 key = path.node.property.name;
45 } else {
46 return;
47 }
48 if (!entriesMap.has(key)) return;
49 path.replaceWith(t.cloneNode(entriesMap.get(key)));
50 }
51 });
52 path.remove();
53}
src/file-viewer/server/tests/setup_test_env.sh deleted-138
......@@ -1,138 +0,0 @@
1// default
2function transpileEnum(path, t) {
3 const {
4 node,
5 parentPath
6 } = path;
7 if (node.declare) {
8 path.remove();
9 return;
10 }
11 const name = node.id.name;
12 const {
13 fill,
14 data,
15 isPure
16 } = enumFill(path, t, node.id);
17 switch (parentPath.type) {
18 case "BlockStatement":
19 case "ExportNamedDeclaration":
20 case "Program":
21 {
22 const isGlobal = t.isProgram(path.parent);
23 const isSeen = seen(parentPath);
24 let init = t.objectExpression([]);
25 if (isSeen || isGlobal) {
26 init = t.logicalExpression("||", t.cloneNode(fill.ID), init);
27 }
28 const enumIIFE = buildEnumWrapper(Object.assign({}, fill, {
29 INIT: init
30 }));
31 if (isPure) (0, _helperAnnotateAsPure.default)(enumIIFE);
32 if (isSeen) {
33 const toReplace = parentPath.isExportDeclaration() ? parentPath : path;
34 toReplace.replaceWith(t.expressionStatement(t.assignmentExpression("=", t.cloneNode(node.id), enumIIFE)));
35 } else {
36 path.scope.registerDeclaration(path.replaceWith(t.variableDeclaration(isGlobal ? "var" : "let", [t.variableDeclarator(node.id, enumIIFE)]))[0]);
37 }
38 ENUMS.set(path.scope.getBindingIdentifier(name), data);
39 break;
40 }
41 default:
42 throw new Error(`Unexpected enum parent '${path.parent.type}`);
43 }
44 function seen(parentPath) {
45 if (parentPath.isExportDeclaration()) {
46 return seen(parentPath.parentPath);
47 }
48 if (parentPath.getData(name)) {
49 return true;
50 } else {
51 parentPath.setData(name, true);
52 return false;
53 }
54 }
55}
56
57// isSyntacticallyString
58function isSyntacticallyString(expr) {
59 expr = (0, _helperSkipTransparentExpressionWrappers.skipTransparentExprWrapperNodes)(expr);
60 switch (expr.type) {
61 case "BinaryExpression":
62 {
63 const left = expr.left;
64 const right = expr.right;
65 return expr.operator === "+" && (isSyntacticallyString(left) || isSyntacticallyString(right));
66 }
67 case "TemplateLiteral":
68 case "StringLiteral":
69 return true;
70 }
71 return false;
72}
73
74// translateEnumValues
75function translateEnumValues(path, t) {
76 var _ENUMS$get;
77 const bindingIdentifier = path.scope.getBindingIdentifier(path.node.id.name);
78 const seen = (_ENUMS$get = ENUMS.get(bindingIdentifier)) != null ? _ENUMS$get : new Map();
79 let constValue = -1;
80 let lastName;
81 let isPure = true;
82 const enumMembers = path.get("members");
83 const enumValues = enumMembers.map(memberPath => {
84 const member = memberPath.node;
85 const name = t.isIdentifier(member.id) ? member.id.name : member.id.value;
86 const initializerPath = memberPath.get("initializer");
87 const initializer = member.initializer;
88 let value;
89 if (initializer) {
90 constValue = computeConstantValue(initializerPath, seen);
91 if (constValue !== undefined) {
92 seen.set(name, constValue);
93 _assert(typeof constValue === "number" || typeof constValue === "string");
94 if (constValue === Infinity || Number.isNaN(constValue)) {
95 value = t.identifier(String(constValue));
96 } else if (constValue === -Infinity) {
97 value = t.unaryExpression("-", t.identifier("Infinity"));
98 } else {
99 value = t.valueToNode(constValue);
100 }
101 } else {
102 isPure && (isPure = initializerPath.isPure());
103 if (initializerPath.isReferencedIdentifier()) {
104 ReferencedIdentifier(initializerPath, {
105 t,
106 seen,
107 path
108 });
109 } else {
110 initializerPath.traverse(enumSelfReferenceVisitor, {
111 t,
112 seen,
113 path
114 });
115 }
116 value = initializerPath.node;
117 seen.set(name, undefined);
118 }
119 } else if (typeof constValue === "number") {
120 constValue += 1;
121 value = t.numericLiteral(constValue);
122 seen.set(name, constValue);
123 } else if (typeof constValue === "string") {
124 throw path.buildCodeFrameError("Enum member must have initializer.");
125 } else {
126 const lastRef = t.memberExpression(t.cloneNode(path.node.id), t.stringLiteral(lastName), true);
127 value = t.binaryExpression("+", t.numericLiteral(1), lastRef);
128 seen.set(name, undefined);
129 }
130 lastName = name;
131 return [name, value];
132 });
133 return {
134 isPure,
135 data: seen,
136 enumValues
137 };
138}
src/file-viewer/share.ts deleted-17
......@@ -1,17 +0,0 @@
1// GLOBAL_TYPES
2[object WeakMap]
3
4// isGlobalType
5function isGlobalType({
6 scope
7}, name) {
8 if (scope.hasBinding(name)) return false;
9 if (GLOBAL_TYPES.get(scope).has(name)) return true;
10 console.warn(`The exported identifier "${name}" is not declared in Babel's scope tracker\n` + `as a JavaScript value binding, and "@babel/plugin-transform-typescript"\n` + `never encountered it as a TypeScript type declaration.\n` + `It will be treated as a JavaScript value.\n\n` + `This problem is likely caused by another plugin injecting\n` + `"${name}" without registering it in the scope tracker. If you are the author\n` + ` of that plugin, please use "scope.registerDeclaration(declarationPath)".`);
11 return false;
12}
13
14// registerGlobalType
15function registerGlobalType(programScope, name) {
16 GLOBAL_TYPES.get(programScope).add(name);
17}
src/file-viewer/static/captcha/image/0.jpeg deleted-44
......@@ -1,44 +0,0 @@
1// makeConfigAPI
2function makeConfigAPI(cache) {
3 const env = value => cache.using(data => {
4 if (value === undefined) return data.envName;
5 if (typeof value === "function") {
6 return (0, _caching.assertSimpleType)(value(data.envName));
7 }
8 return (Array.isArray(value) ? value : [value]).some(entry => {
9 if (typeof entry !== "string") {
10 throw new Error("Unexpected non-string value");
11 }
12 return entry === data.envName;
13 });
14 });
15 const caller = cb => cache.using(data => (0, _caching.assertSimpleType)(cb(data.caller)));
16 return {
17 version: _index.version,
18 cache: cache.simple(),
19 env,
20 async: () => false,
21 caller,
22 assertVersion
23 };
24}
25
26// makePluginAPI
27function makePluginAPI(cache, externalDependencies) {
28 const assumption = name => cache.using(data => data.assumptions[name]);
29 return Object.assign({}, makePresetAPI(cache, externalDependencies), {
30 assumption
31 });
32}
33
34// makePresetAPI
35function makePresetAPI(cache, externalDependencies) {
36 const targets = () => JSON.parse(cache.using(data => JSON.stringify(data.targets)));
37 const addExternalDependency = ref => {
38 externalDependencies.push(ref);
39 };
40 return Object.assign({}, makeConfigAPI(cache), {
41 targets,
42 addExternalDependency
43 });
44}
src/file-viewer/static/captcha/image/1.jpeg deleted-47
......@@ -1,47 +0,0 @@
1// default
2function* loadCodeDefault(filepath, loader, esmError, tlaError) {
3 let async;
4 const ext = _path().extname(filepath);
5 const isTS = ext === ".ts" || ext === ".cts" || ext === ".mts";
6 const type = SUPPORTED_EXTENSIONS[hasOwnProperty.call(SUPPORTED_EXTENSIONS, ext) ? ext : ".js"];
7 const pattern = `${loader} ${type}`;
8 switch (pattern) {
9 case "require cjs":
10 case "auto cjs":
11 if (isTS) {
12 return ensureTsSupport(filepath, ext, () => loadCjsDefault(filepath));
13 } else {
14 return loadCjsDefault(filepath, arguments[2]);
15 }
16 case "auto unknown":
17 case "require unknown":
18 case "require esm":
19 try {
20 if (isTS) {
21 return ensureTsSupport(filepath, ext, () => loadCjsDefault(filepath));
22 } else {
23 return loadCjsDefault(filepath, arguments[2]);
24 }
25 } catch (e) {
26 if (e.code === "ERR_REQUIRE_ASYNC_MODULE" || e.code === "ERR_REQUIRE_CYCLE_MODULE" && asyncModules.has(filepath)) {
27 asyncModules.add(filepath);
28 if (!(async != null ? async : async = yield* (0, _async.isAsync)())) {
29 throw new _configError.default(tlaError, filepath);
30 }
31 } else if (e.code === "ERR_REQUIRE_ESM" || type === "esm") {} else {
32 throw e;
33 }
34 }
35 case "auto esm":
36 if (async != null ? async : async = yield* (0, _async.isAsync)()) {
37 const promise = isTS ? ensureTsSupport(filepath, ext, () => loadMjsFromPath(filepath)) : loadMjsFromPath(filepath);
38 return (yield* (0, _async.waitFor)(promise)).default;
39 }
40 throw new _configError.default(esmError, filepath);
41 default:
42 throw new Error("Internal Babel error: unreachable code.");
43 }
44}
45
46// supportsESM
47true
src/file-viewer/static/captcha/image/10.jpeg deleted-14
......@@ -1,14 +0,0 @@
1// transformFile
2function transformFile(...args) {
3 transformFileRunner.errback(...args);
4}
5
6// transformFileAsync
7function transformFileAsync(...args) {
8 return transformFileRunner.async(...args);
9}
10
11// transformFileSync
12function transformFileSync(...args) {
13 return transformFileRunner.sync(...args);
14}
src/file-viewer/static/captcha/image/11.jpeg deleted-73
......@@ -1,73 +0,0 @@
1// createConfigItem
2function createConfigItem(target, options, callback) {
3 if (callback !== undefined) {
4 (0, _rewriteStackTrace.beginHiddenCallStack)(createConfigItemRunner.errback)(target, options, callback);
5 } else if (typeof options === "function") {
6 (0, _rewriteStackTrace.beginHiddenCallStack)(createConfigItemRunner.errback)(target, undefined, callback);
7 } else {
8 {
9 return createConfigItemSync(target, options);
10 }
11 }
12}
13
14// createConfigItemAsync
15function createConfigItemAsync(...args) {
16 return (0, _rewriteStackTrace.beginHiddenCallStack)(createConfigItemRunner.async)(...args);
17}
18
19// createConfigItemSync
20function createConfigItemSync(...args) {
21 return (0, _rewriteStackTrace.beginHiddenCallStack)(createConfigItemRunner.sync)(...args);
22}
23
24// default
25function(...args) {
26 return genFn.apply(this, args);
27 }
28
29// loadOptions
30function loadOptions(opts, callback) {
31 if (callback !== undefined) {
32 (0, _rewriteStackTrace.beginHiddenCallStack)(loadOptionsRunner.errback)(opts, callback);
33 } else if (typeof opts === "function") {
34 (0, _rewriteStackTrace.beginHiddenCallStack)(loadOptionsRunner.errback)(undefined, opts);
35 } else {
36 {
37 return loadOptionsSync(opts);
38 }
39 }
40}
41
42// loadOptionsAsync
43function loadOptionsAsync(...args) {
44 return (0, _rewriteStackTrace.beginHiddenCallStack)(loadOptionsRunner.async)(...args);
45}
46
47// loadOptionsSync
48function loadOptionsSync(...args) {
49 return (0, _rewriteStackTrace.beginHiddenCallStack)(loadOptionsRunner.sync)(...args);
50}
51
52// loadPartialConfig
53function loadPartialConfig(opts, callback) {
54 if (callback !== undefined) {
55 (0, _rewriteStackTrace.beginHiddenCallStack)(loadPartialConfigRunner.errback)(opts, callback);
56 } else if (typeof opts === "function") {
57 (0, _rewriteStackTrace.beginHiddenCallStack)(loadPartialConfigRunner.errback)(undefined, opts);
58 } else {
59 {
60 return loadPartialConfigSync(opts);
61 }
62 }
63}
64
65// loadPartialConfigAsync
66function loadPartialConfigAsync(...args) {
67 return (0, _rewriteStackTrace.beginHiddenCallStack)(loadPartialConfigRunner.async)(...args);
68}
69
70// loadPartialConfigSync
71function loadPartialConfigSync(...args) {
72 return (0, _rewriteStackTrace.beginHiddenCallStack)(loadPartialConfigRunner.sync)(...args);
73}
src/file-viewer/static/captcha/image/12.jpeg deleted-4
......@@ -1,4 +0,0 @@
1// default
2function(...args) {
3 return genFn.apply(this, args);
4 }
src/file-viewer/static/captcha/image/13.jpeg deleted-23
......@@ -1,23 +0,0 @@
1// default
2class Plugin {
3 constructor(plugin, options, key, externalDependencies = (0, _deepArray.finalize)([])) {
4 this.key = void 0;
5 this.manipulateOptions = void 0;
6 this.post = void 0;
7 this.pre = void 0;
8 this.visitor = void 0;
9 this.parserOverride = void 0;
10 this.generatorOverride = void 0;
11 this.options = void 0;
12 this.externalDependencies = void 0;
13 this.key = plugin.name || key;
14 this.manipulateOptions = plugin.manipulateOptions;
15 this.post = plugin.post;
16 this.pre = plugin.pre;
17 this.visitor = plugin.visitor || {};
18 this.parserOverride = plugin.parserOverride;
19 this.generatorOverride = plugin.generatorOverride;
20 this.options = options;
21 this.externalDependencies = externalDependencies;
22 }
23}
src/file-viewer/static/captcha/image/14.jpeg deleted-16
......@@ -1,16 +0,0 @@
1// finalize
2function finalize(deepArr) {
3 return Object.freeze(deepArr);
4}
5
6// flattenToSet
7function flattenToSet(arr) {
8 const result = new Set();
9 const stack = [arr];
10 while (stack.length > 0) {
11 for (const el of stack.pop()) {
12 if (Array.isArray(el)) stack.push(el);else result.add(el);
13 }
14 }
15 return result;
16}
src/file-viewer/static/captcha/image/15.jpeg deleted-24
......@@ -1,24 +0,0 @@
1// createConfigItem
2function* createConfigItem(value, {
3 dirname = ".",
4 type
5} = {}) {
6 const descriptor = yield* (0, _configDescriptors.createDescriptor)(value, _path().resolve(dirname), {
7 type,
8 alias: "programmatic item"
9 });
10 return createItemFromDescriptor(descriptor);
11}
12
13// createItemFromDescriptor
14function createItemFromDescriptor(desc) {
15 return new ConfigItem(desc);
16}
17
18// getItemDescriptor
19function getItemDescriptor(item) {
20 if (item != null && item[CONFIG_ITEM_BRAND]) {
21 return item._descriptor;
22 }
23 return undefined;
24}
src/file-viewer/static/captcha/image/16.jpeg deleted-86
......@@ -1,86 +0,0 @@
1// createCachedDescriptors
2function createCachedDescriptors(dirname, options, alias) {
3 const {
4 plugins,
5 presets,
6 passPerPreset
7 } = options;
8 return {
9 options: optionsWithResolvedBrowserslistConfigFile(options, dirname),
10 plugins: plugins ? () => createCachedPluginDescriptors(plugins, dirname)(alias) : () => handlerOf([]),
11 presets: presets ? () => createCachedPresetDescriptors(presets, dirname)(alias)(!!passPerPreset) : () => handlerOf([])
12 };
13}
14
15// createDescriptor
16function* createDescriptor(pair, dirname, {
17 type,
18 alias,
19 ownPass
20}) {
21 const desc = (0, _item.getItemDescriptor)(pair);
22 if (desc) {
23 return desc;
24 }
25 let name;
26 let options;
27 let value = pair;
28 if (Array.isArray(value)) {
29 if (value.length === 3) {
30 [value, options, name] = value;
31 } else {
32 [value, options] = value;
33 }
34 }
35 let file = undefined;
36 let filepath = null;
37 if (typeof value === "string") {
38 if (typeof type !== "string") {
39 throw new Error("To resolve a string-based item, the type of item must be given");
40 }
41 const resolver = type === "plugin" ? _index.loadPlugin : _index.loadPreset;
42 const request = value;
43 ({
44 filepath,
45 value
46 } = yield* resolver(value, dirname));
47 file = {
48 request,
49 resolved: filepath
50 };
51 }
52 if (!value) {
53 throw new Error(`Unexpected falsy value: ${String(value)}`);
54 }
55 if (typeof value === "object" && value.__esModule) {
56 if (value.default) {
57 value = value.default;
58 } else {
59 throw new Error("Must export a default export when using ES6 modules.");
60 }
61 }
62 if (typeof value !== "object" && typeof value !== "function") {
63 throw new Error(`Unsupported format: ${typeof value}. Expected an object or a function.`);
64 }
65 if (filepath !== null && typeof value === "object" && value) {
66 throw new Error(`Plugin/Preset files are not allowed to export objects, only functions. In ${filepath}`);
67 }
68 return {
69 name,
70 alias: filepath || alias,
71 value,
72 options,
73 dirname,
74 ownPass,
75 file
76 };
77}
78
79// createUncachedDescriptors
80function createUncachedDescriptors(dirname, options, alias) {
81 return {
82 options: optionsWithResolvedBrowserslistConfigFile(options, dirname),
83 plugins: (0, _functional.once)(() => createPluginDescriptors(options.plugins || [], dirname, alias)),
84 presets: (0, _functional.once)(() => createPresetDescriptors(options.presets || [], dirname, alias, !!options.passPerPreset))
85 };
86}
src/file-viewer/static/captcha/image/17.jpeg deleted-49
......@@ -1,49 +0,0 @@
1// once
2function once(fn) {
3 let result;
4 let resultP;
5 let promiseReferenced = false;
6 return function* () {
7 if (!result) {
8 if (resultP) {
9 promiseReferenced = true;
10 return yield* (0, _async.waitFor)(resultP);
11 }
12 if (!(yield* (0, _async.isAsync)())) {
13 try {
14 result = {
15 ok: true,
16 value: yield* fn()
17 };
18 } catch (error) {
19 result = {
20 ok: false,
21 value: error
22 };
23 }
24 } else {
25 let resolve, reject;
26 resultP = new Promise((res, rej) => {
27 resolve = res;
28 reject = rej;
29 });
30 try {
31 result = {
32 ok: true,
33 value: yield* fn()
34 };
35 resultP = null;
36 if (promiseReferenced) resolve(result.value);
37 } catch (error) {
38 result = {
39 ok: false,
40 value: error
41 };
42 resultP = null;
43 if (promiseReferenced) reject(error);
44 }
45 }
46 }
47 if (result.ok) return result.value;else throw result.value;
48 };
49}
src/file-viewer/static/captcha/image/2.jpeg deleted-39
......@@ -1,39 +0,0 @@
1// resolveBrowserslistConfigFile
2function resolveBrowserslistConfigFile(browserslistConfigFile, configFileDir) {
3 return _path().resolve(configFileDir, browserslistConfigFile);
4}
5
6// resolveTargets
7function resolveTargets(options, root) {
8 const optTargets = options.targets;
9 let targets;
10 if (typeof optTargets === "string" || Array.isArray(optTargets)) {
11 targets = {
12 browsers: optTargets
13 };
14 } else if (optTargets) {
15 if ("esmodules" in optTargets) {
16 targets = Object.assign({}, optTargets, {
17 esmodules: "intersect"
18 });
19 } else {
20 targets = optTargets;
21 }
22 }
23 const {
24 browserslistConfigFile
25 } = options;
26 let configFile;
27 let ignoreBrowserslistConfig = false;
28 if (typeof browserslistConfigFile === "string") {
29 configFile = browserslistConfigFile;
30 } else {
31 ignoreBrowserslistConfig = browserslistConfigFile === false;
32 }
33 return (0, _helperCompilationTargets().default)(targets, {
34 ignoreBrowserslistConfig,
35 configFile,
36 configPath: root,
37 browserslistEnv: options.browserslistEnv
38 });
39}
src/file-viewer/static/captcha/image/3.jpeg deleted-162
......@@ -1,162 +0,0 @@
1// buildPresetChain
2function* buildPresetChain(arg, context) {
3 const chain = yield* buildPresetChainWalker(arg, context);
4 if (!chain) return null;
5 return {
6 plugins: dedupDescriptors(chain.plugins),
7 presets: dedupDescriptors(chain.presets),
8 options: chain.options.map(o => normalizeOptions(o)),
9 files: new Set()
10 };
11}
12
13// buildPresetChainWalker
14function* chainWalker(input, context, files = new Set(), baseLogger) {
15 const {
16 dirname
17 } = input;
18 const flattenedConfigs = [];
19 const rootOpts = root(input);
20 if (configIsApplicable(rootOpts, dirname, context, input.filepath)) {
21 flattenedConfigs.push({
22 config: rootOpts,
23 envName: undefined,
24 index: undefined
25 });
26 const envOpts = env(input, context.envName);
27 if (envOpts && configIsApplicable(envOpts, dirname, context, input.filepath)) {
28 flattenedConfigs.push({
29 config: envOpts,
30 envName: context.envName,
31 index: undefined
32 });
33 }
34 (rootOpts.options.overrides || []).forEach((_, index) => {
35 const overrideOps = overrides(input, index);
36 if (configIsApplicable(overrideOps, dirname, context, input.filepath)) {
37 flattenedConfigs.push({
38 config: overrideOps,
39 index,
40 envName: undefined
41 });
42 const overrideEnvOpts = overridesEnv(input, index, context.envName);
43 if (overrideEnvOpts && configIsApplicable(overrideEnvOpts, dirname, context, input.filepath)) {
44 flattenedConfigs.push({
45 config: overrideEnvOpts,
46 index,
47 envName: context.envName
48 });
49 }
50 }
51 });
52 }
53 if (flattenedConfigs.some(({
54 config: {
55 options: {
56 ignore,
57 only
58 }
59 }
60 }) => shouldIgnore(context, ignore, only, dirname))) {
61 return null;
62 }
63 const chain = emptyChain();
64 const logger = createLogger(input, context, baseLogger);
65 for (const {
66 config,
67 index,
68 envName
69 } of flattenedConfigs) {
70 if (!(yield* mergeExtendsChain(chain, config.options, dirname, context, files, baseLogger))) {
71 return null;
72 }
73 logger(config, index, envName);
74 yield* mergeChainOpts(chain, config);
75 }
76 return chain;
77 }
78
79// buildRootChain
80function* buildRootChain(opts, context) {
81 let configReport, babelRcReport;
82 const programmaticLogger = new _printer.ConfigPrinter();
83 const programmaticChain = yield* loadProgrammaticChain({
84 options: opts,
85 dirname: context.cwd
86 }, context, undefined, programmaticLogger);
87 if (!programmaticChain) return null;
88 const programmaticReport = yield* programmaticLogger.output();
89 let configFile;
90 if (typeof opts.configFile === "string") {
91 configFile = yield* (0, _index.loadConfig)(opts.configFile, context.cwd, context.envName, context.caller);
92 } else if (opts.configFile !== false) {
93 configFile = yield* (0, _index.findRootConfig)(context.root, context.envName, context.caller);
94 }
95 let {
96 babelrc,
97 babelrcRoots
98 } = opts;
99 let babelrcRootsDirectory = context.cwd;
100 const configFileChain = emptyChain();
101 const configFileLogger = new _printer.ConfigPrinter();
102 if (configFile) {
103 const validatedFile = validateConfigFile(configFile);
104 const result = yield* loadFileChain(validatedFile, context, undefined, configFileLogger);
105 if (!result) return null;
106 configReport = yield* configFileLogger.output();
107 if (babelrc === undefined) {
108 babelrc = validatedFile.options.babelrc;
109 }
110 if (babelrcRoots === undefined) {
111 babelrcRootsDirectory = validatedFile.dirname;
112 babelrcRoots = validatedFile.options.babelrcRoots;
113 }
114 mergeChain(configFileChain, result);
115 }
116 let ignoreFile, babelrcFile;
117 let isIgnored = false;
118 const fileChain = emptyChain();
119 if ((babelrc === true || babelrc === undefined) && typeof context.filename === "string") {
120 const pkgData = yield* (0, _index.findPackageData)(context.filename);
121 if (pkgData && babelrcLoadEnabled(context, pkgData, babelrcRoots, babelrcRootsDirectory)) {
122 ({
123 ignore: ignoreFile,
124 config: babelrcFile
125 } = yield* (0, _index.findRelativeConfig)(pkgData, context.envName, context.caller));
126 if (ignoreFile) {
127 fileChain.files.add(ignoreFile.filepath);
128 }
129 if (ignoreFile && shouldIgnore(context, ignoreFile.ignore, null, ignoreFile.dirname)) {
130 isIgnored = true;
131 }
132 if (babelrcFile && !isIgnored) {
133 const validatedFile = validateBabelrcFile(babelrcFile);
134 const babelrcLogger = new _printer.ConfigPrinter();
135 const result = yield* loadFileChain(validatedFile, context, undefined, babelrcLogger);
136 if (!result) {
137 isIgnored = true;
138 } else {
139 babelRcReport = yield* babelrcLogger.output();
140 mergeChain(fileChain, result);
141 }
142 }
143 if (babelrcFile && isIgnored) {
144 fileChain.files.add(babelrcFile.filepath);
145 }
146 }
147 }
148 if (context.showConfig) {
149 console.log(`Babel configs on "${context.filename}" (ascending priority):\n` + [configReport, babelRcReport, programmaticReport].filter(x => !!x).join("\n\n") + "\n-----End Babel configs-----");
150 }
151 const chain = mergeChain(mergeChain(mergeChain(emptyChain(), configFileChain), fileChain), programmaticChain);
152 return {
153 plugins: isIgnored ? [] : dedupDescriptors(chain.plugins),
154 presets: isIgnored ? [] : dedupDescriptors(chain.presets),
155 options: isIgnored ? [] : chain.options.map(o => normalizeOptions(o)),
156 fileHandling: isIgnored ? "ignored" : "transpile",
157 ignore: ignoreFile || undefined,
158 babelrc: babelrcFile || undefined,
159 config: configFile || undefined,
160 files: chain.files
161 };
162}
src/file-viewer/static/captcha/image/4.jpeg deleted-26
......@@ -1,26 +0,0 @@
1// assumptionsNames
2[object Set]
3
4// checkNoUnwrappedItemOptionPairs
5function checkNoUnwrappedItemOptionPairs(items, index, type, e) {
6 if (index === 0) return;
7 const lastItem = items[index - 1];
8 const thisItem = items[index];
9 if (lastItem.file && lastItem.options === undefined && typeof thisItem.value === "object") {
10 e.message += `\n- Maybe you meant to use\n` + `"${type}s": [\n ["${lastItem.file.request}", ${JSON.stringify(thisItem.value, undefined, 2)}]\n]\n` + `To be a valid ${type}, its name and options should be wrapped in a pair of brackets`;
11 }
12}
13
14// validate
15function validate(type, opts, filename) {
16 try {
17 return validateNested({
18 type: "root",
19 source: type
20 }, opts);
21 } catch (error) {
22 const configError = new _configError.default(error.message, filename);
23 if (error.code) configError.code = error.code;
24 throw configError;
25 }
26}
src/file-viewer/static/captcha/image/5.jpeg deleted-2
......@@ -1,2 +0,0 @@
1// default
2[object Object]
src/file-viewer/static/captcha/image/6.jpeg deleted-229
......@@ -1,229 +0,0 @@
1// access
2function access(loc, name) {
3 return {
4 type: "access",
5 name,
6 parent: loc
7 };
8}
9
10// assertArray
11function assertArray(loc, value) {
12 if (value != null && !Array.isArray(value)) {
13 throw new Error(`${msg(loc)} must be an array, or undefined`);
14 }
15 return value;
16}
17
18// assertAssumptions
19function assertAssumptions(loc, value) {
20 if (value === undefined) return;
21 if (typeof value !== "object" || value === null) {
22 throw new Error(`${msg(loc)} must be an object or undefined.`);
23 }
24 let root = loc;
25 do {
26 root = root.parent;
27 } while (root.type !== "root");
28 const inPreset = root.source === "preset";
29 for (const name of Object.keys(value)) {
30 const subLoc = access(loc, name);
31 if (!_options.assumptionsNames.has(name)) {
32 throw new Error(`${msg(subLoc)} is not a supported assumption.`);
33 }
34 if (typeof value[name] !== "boolean") {
35 throw new Error(`${msg(subLoc)} must be a boolean.`);
36 }
37 if (inPreset && value[name] === false) {
38 throw new Error(`${msg(subLoc)} cannot be set to 'false' inside presets.`);
39 }
40 }
41 return value;
42}
43
44// assertBabelrcSearch
45function assertBabelrcSearch(loc, value) {
46 if (value === undefined || typeof value === "boolean") {
47 return value;
48 }
49 if (Array.isArray(value)) {
50 value.forEach((item, i) => {
51 if (!checkValidTest(item)) {
52 throw new Error(`${msg(access(loc, i))} must be a string/Function/RegExp.`);
53 }
54 });
55 } else if (!checkValidTest(value)) {
56 throw new Error(`${msg(loc)} must be a undefined, a boolean, a string/Function/RegExp ` + `or an array of those, got ${JSON.stringify(value)}`);
57 }
58 return value;
59}
60
61// assertBoolean
62function assertBoolean(loc, value) {
63 if (value !== undefined && typeof value !== "boolean") {
64 throw new Error(`${msg(loc)} must be a boolean, or undefined`);
65 }
66 return value;
67}
68
69// assertCallerMetadata
70function assertCallerMetadata(loc, value) {
71 const obj = assertObject(loc, value);
72 if (obj) {
73 if (typeof obj.name !== "string") {
74 throw new Error(`${msg(loc)} set but does not contain "name" property string`);
75 }
76 for (const prop of Object.keys(obj)) {
77 const propLoc = access(loc, prop);
78 const value = obj[prop];
79 if (value != null && typeof value !== "boolean" && typeof value !== "string" && typeof value !== "number") {
80 throw new Error(`${msg(propLoc)} must be null, undefined, a boolean, a string, or a number.`);
81 }
82 }
83 }
84 return value;
85}
86
87// assertCompact
88function assertCompact(loc, value) {
89 if (value !== undefined && typeof value !== "boolean" && value !== "auto") {
90 throw new Error(`${msg(loc)} must be a boolean, "auto", or undefined`);
91 }
92 return value;
93}
94
95// assertConfigApplicableTest
96function assertConfigApplicableTest(loc, value) {
97 if (value === undefined) {
98 return value;
99 }
100 if (Array.isArray(value)) {
101 value.forEach((item, i) => {
102 if (!checkValidTest(item)) {
103 throw new Error(`${msg(access(loc, i))} must be a string/Function/RegExp.`);
104 }
105 });
106 } else if (!checkValidTest(value)) {
107 throw new Error(`${msg(loc)} must be a string/Function/RegExp, or an array of those`);
108 }
109 return value;
110}
111
112// assertConfigFileSearch
113function assertConfigFileSearch(loc, value) {
114 if (value !== undefined && typeof value !== "boolean" && typeof value !== "string") {
115 throw new Error(`${msg(loc)} must be a undefined, a boolean, a string, ` + `got ${JSON.stringify(value)}`);
116 }
117 return value;
118}
119
120// assertFunction
121function assertFunction(loc, value) {
122 if (value !== undefined && typeof value !== "function") {
123 throw new Error(`${msg(loc)} must be a function, or undefined`);
124 }
125 return value;
126}
127
128// assertIgnoreList
129function assertIgnoreList(loc, value) {
130 const arr = assertArray(loc, value);
131 arr == null || arr.forEach((item, i) => assertIgnoreItem(access(loc, i), item));
132 return arr;
133}
134
135// assertInputSourceMap
136function assertInputSourceMap(loc, value) {
137 if (value !== undefined && typeof value !== "boolean" && (typeof value !== "object" || !value)) {
138 throw new Error(`${msg(loc)} must be a boolean, object, or undefined`);
139 }
140 return value;
141}
142
143// assertObject
144function assertObject(loc, value) {
145 if (value !== undefined && (typeof value !== "object" || Array.isArray(value) || !value)) {
146 throw new Error(`${msg(loc)} must be an object, or undefined`);
147 }
148 return value;
149}
150
151// assertPluginList
152function assertPluginList(loc, value) {
153 const arr = assertArray(loc, value);
154 if (arr) {
155 arr.forEach((item, i) => assertPluginItem(access(loc, i), item));
156 }
157 return arr;
158}
159
160// assertRootMode
161function assertRootMode(loc, value) {
162 if (value !== undefined && value !== "root" && value !== "upward" && value !== "upward-optional") {
163 throw new Error(`${msg(loc)} must be a "root", "upward", "upward-optional" or undefined`);
164 }
165 return value;
166}
167
168// assertSourceMaps
169function assertSourceMaps(loc, value) {
170 if (value !== undefined && typeof value !== "boolean" && value !== "inline" && value !== "both") {
171 throw new Error(`${msg(loc)} must be a boolean, "inline", "both", or undefined`);
172 }
173 return value;
174}
175
176// assertSourceType
177function assertSourceType(loc, value) {
178 if (value !== undefined && value !== "module" && value !== "script" && value !== "unambiguous") {
179 throw new Error(`${msg(loc)} must be "module", "script", "unambiguous", or undefined`);
180 }
181 return value;
182}
183
184// assertString
185function assertString(loc, value) {
186 if (value !== undefined && typeof value !== "string") {
187 throw new Error(`${msg(loc)} must be a string, or undefined`);
188 }
189 return value;
190}
191
192// assertTargets
193function assertTargets(loc, value) {
194 if ((0, _helperCompilationTargets().isBrowsersQueryValid)(value)) return value;
195 if (typeof value !== "object" || !value || Array.isArray(value)) {
196 throw new Error(`${msg(loc)} must be a string, an array of strings or an object`);
197 }
198 const browsersLoc = access(loc, "browsers");
199 const esmodulesLoc = access(loc, "esmodules");
200 assertBrowsersList(browsersLoc, value.browsers);
201 assertBoolean(esmodulesLoc, value.esmodules);
202 for (const key of Object.keys(value)) {
203 const val = value[key];
204 const subLoc = access(loc, key);
205 if (key === "esmodules") assertBoolean(subLoc, val);else if (key === "browsers") assertBrowsersList(subLoc, val);else if (!hasOwnProperty.call(_helperCompilationTargets().TargetNames, key)) {
206 const validTargets = Object.keys(_helperCompilationTargets().TargetNames).join(", ");
207 throw new Error(`${msg(subLoc)} is not a valid target. Supported targets are ${validTargets}`);
208 } else assertBrowserVersion(subLoc, val);
209 }
210 return value;
211}
212
213// msg
214function msg(loc) {
215 switch (loc.type) {
216 case "root":
217 return ``;
218 case "env":
219 return `${msg(loc.parent)}.env["${loc.name}"]`;
220 case "overrides":
221 return `${msg(loc.parent)}.overrides[${loc.index}]`;
222 case "option":
223 return `${msg(loc.parent)}.${loc.name}`;
224 case "access":
225 return `${msg(loc.parent)}[${JSON.stringify(loc.name)}]`;
226 default:
227 throw new Error(`Assertion failure: Unknown type ${loc.type}`);
228 }
229}
src/file-viewer/static/captcha/image/7.jpeg deleted-13
......@@ -1,13 +0,0 @@
1// default
2function pathToPattern(pattern, dirname) {
3 const parts = _path().resolve(dirname, pattern).split(_path().sep);
4 return new RegExp(["^", ...parts.map((part, i) => {
5 const last = i === parts.length - 1;
6 if (part === "**") return last ? starStarPatLast : starStarPat;
7 if (part === "*") return last ? starPatLast : starPat;
8 if (part.indexOf("*.") === 0) {
9 return substitution + escapeRegExp(part.slice(1)) + (last ? endSep : sep);
10 }
11 return escapeRegExp(part) + (last ? endSep : sep);
12 })].join(""));
13}
src/file-viewer/static/captcha/image/8.jpeg deleted-37
......@@ -1,37 +0,0 @@
1// ChainFormatter
2[object Object]
3
4// ConfigPrinter
5class ConfigPrinter {
6 constructor() {
7 this._stack = [];
8 }
9 configure(enabled, type, {
10 callerName,
11 filepath
12 }) {
13 if (!enabled) return () => {};
14 return (content, index, envName) => {
15 this._stack.push({
16 type,
17 callerName,
18 filepath,
19 content,
20 index,
21 envName
22 });
23 };
24 }
25 static *format(config) {
26 let title = Formatter.title(config.type, config.callerName, config.filepath);
27 const loc = Formatter.loc(config.index, config.envName);
28 if (loc) title += ` ${loc}`;
29 const content = yield* Formatter.optionsAndDescriptors(config.content);
30 return `${title}\n${content}`;
31 }
32 *output() {
33 if (this._stack.length === 0) return "";
34 const configs = yield* _gensync().all(this._stack.map(s => ConfigPrinter.format(s)));
35 return configs.join("\n\n");
36 }
37}
src/file-viewer/static/captcha/image/9.jpeg deleted-23
......@@ -1,23 +0,0 @@
1// validatePluginObject
2function validatePluginObject(obj) {
3 const rootPath = {
4 type: "root",
5 source: "plugin"
6 };
7 Object.keys(obj).forEach(key => {
8 const validator = VALIDATORS[key];
9 if (validator) {
10 const optLoc = {
11 type: "option",
12 name: key,
13 parent: rootPath
14 };
15 validator(optLoc, obj[key]);
16 } else {
17 const invalidPluginPropertyError = new Error(`.${key} is not a valid Plugin property`);
18 invalidPluginPropertyError.code = "BABEL_UNKNOWN_PLUGIN_PROPERTY";
19 throw invalidPluginPropertyError;
20 }
21 });
22 return obj;
23}
src/file-viewer/test-tree.ts deleted-4
......@@ -1,4 +0,0 @@
1// getEnv
2function getEnv(defaultValue = "development") {
3 return process.env.BABEL_ENV || process.env.NODE_ENV || defaultValue;
4}
src/file-viewer/text-formatting.ts deleted-1073
......@@ -1,1073 +0,0 @@
1// __esModule
2true
3
4// DiagnosticType
5[object Object]
6
7// assertAllowedAttributes
8function assertAllowedAttributes(path, allowed) {
9 let i = 0;
10 for (const attr of path.node.attributes) {
11 if (attr.type === "MarkoSpreadAttribute") {
12 throw path.hub.buildError(
13 attr,
14 `Tag does not support spread attributes.`
15 );
16 } else if (!allowed.includes(attr.name)) {
17 throw path.hub.buildError(
18 attr,
19 `Tag does not support the \`${attr.name}\` attribute.`
20 );
21 }
22
23 i++;
24 }
25}
26
27// assertAttributesOrArgs
28function assertAttributesOrArgs(path) {
29 const { node } = path;
30 const args = node.arguments;
31 if (args && args.length && (node.attributes.length > 0 || node.body.length)) {
32 const start = args[0].loc.start;
33 const end = args[args.length - 1].loc.end;
34 throw path.hub.buildError(
35 { loc: { start, end } },
36 "Tag does not support arguments when attributes or body present."
37 );
38 }
39}
40
41// assertAttributesOrSingleArg
42function assertAttributesOrSingleArg(path) {
43 assertAttributesOrArgs(path);
44 const args = path.node.arguments;
45 if (args && args.length > 1) {
46 const start = args[1].loc.start;
47 const end = args[args.length - 1].loc.end;
48 throw path.hub.buildError(
49 { loc: { start, end } },
50 "Tag does not support multiple arguments."
51 );
52 }
53}
54
55// assertNoArgs
56function assertNoArgs(path) {
57 const args = path.node.arguments;
58 if (args && args.length) {
59 const start = args[0].loc.start;
60 const end = args[args.length - 1].loc.end;
61 throw path.hub.buildError(
62 { loc: { start, end } },
63 "Tag does not support arguments."
64 );
65 }
66}
67
68// assertNoAttributeTags
69function assertNoAttributeTags(path) {
70 if (path.node.attributeTags.length) {
71 throw path.hub.buildError(
72 path.node.attributeTags[0],
73 "Tag not support nested attribute tags."
74 );
75 }
76}
77
78// assertNoAttributes
79function assertNoAttributes(path) {
80 const { attributes } = path.node;
81 if (attributes.length) {
82 const start = attributes[0].loc.start;
83 const end = attributes[attributes.length - 1].loc.end;
84 throw path.hub.buildError(
85 { loc: { start, end } },
86 "Tag does not support attributes."
87 );
88 }
89}
90
91// assertNoParams
92function assertNoParams(path) {
93 const { params } = path.node.body;
94 if (params.length) {
95 const start = params[0].loc.start;
96 const end = params[params.length - 1].loc.end;
97 throw path.hub.buildError(
98 { loc: { start, end } },
99 "Tag does not support parameters."
100 );
101 }
102}
103
104// assertNoVar
105function assertNoVar(path) {
106 if (path.node.var) {
107 throw path.hub.buildError(
108 path.node.var,
109 "Tag does not support a variable."
110 );
111 }
112}
113
114// computeNode
115function computeNode(node) {
116 switch (node.type) {
117 case "StringLiteral":
118 case "NumericLiteral":
119 case "BooleanLiteral":
120 return { value: node.value };
121 case "RegExpLiteral":
122 return { value: new RegExp(node.pattern, node.flags) };
123 case "NullLiteral":
124 return { value: null };
125 case "Identifier":
126 switch (node.name) {
127 case "undefined":
128 return { value: undefined };
129 case "NaN":
130 return { value: NaN };
131 case "Infinity":
132 return { value: Infinity };
133 default:
134 return;
135 }
136 case "BigIntLiteral":
137 return { value: BigInt(node.value) };
138 case "ParenthesizedExpression":
139 return computeNode(node.expression);
140 case "BinaryExpression":{
141 const left = computeNode(node.left);
142 if (!left) return;
143 const right = computeNode(node.right);
144 if (!right) return;
145 switch (node.operator) {
146 case "+":
147 return { value: left.value + right.value };
148 case "-":
149 return { value: left.value - right.value };
150 case "*":
151 return { value: left.value * right.value };
152 case "/":
153 return { value: left.value / right.value };
154 case "%":
155 return { value: left.value % right.value };
156 case "**":
157 return { value: left.value ** right.value };
158 case "|":
159 return { value: left.value | right.value };
160 case "&":
161 return { value: left.value & right.value };
162 case "^":
163 return { value: left.value ^ right.value };
164 case "<<":
165 return { value: left.value << right.value };
166 case ">>":
167 return { value: left.value >> right.value };
168 case ">>>":
169 return { value: left.value >>> right.value };
170 case "==":
171 return { value: left.value == right.value };
172 case "!=":
173 return { value: left.value != right.value };
174 case "===":
175 return { value: left.value === right.value };
176 case "!==":
177 return { value: left.value !== right.value };
178 case "<":
179 return { value: left.value < right.value };
180 case "<=":
181 return { value: left.value <= right.value };
182 case ">":
183 return { value: left.value > right.value };
184 case ">=":
185 return { value: left.value >= right.value };
186 default:
187 return;
188 }
189 }
190 case "UnaryExpression":{
191 const arg = computeNode(node.argument);
192 if (!arg) return;
193 switch (node.operator) {
194 case "+":
195 return { value: +arg.value };
196 case "-":
197 return { value: -arg.value };
198 case "~":
199 return { value: ~arg.value };
200 case "!":
201 return { value: !arg.value };
202 case "typeof":
203 return { value: typeof arg.value };
204 case "void":
205 return { value: void arg.value };
206 default:
207 return;
208 }
209 }
210 case "LogicalExpression":{
211 const left = computeNode(node.left);
212 if (!left) return;
213 const right = computeNode(node.right);
214 if (!right) return;
215 switch (node.operator) {
216 case "&&":
217 return { value: left.value && right.value };
218 case "||":
219 return { value: left.value || right.value };
220 case "??":
221 return { value: left.value ?? right.value };
222 default:
223 return;
224 }
225 }
226 case "ConditionalExpression":{
227 const test = computeNode(node.test);
228 if (!test) return;
229 const consequent = computeNode(node.consequent);
230 if (!consequent) return;
231 const alternate = computeNode(node.alternate);
232 if (!alternate) return;
233 return { value: test.value ? consequent.value : alternate.value };
234 }
235 case "TemplateLiteral":{
236 let value = node.quasis[0].value.cooked;
237 for (let i = 0; i < node.expressions.length; i++) {
238 const expr = computeNode(node.expressions[i]);
239 if (!expr) return;
240 value += expr.value + node.quasis[i + 1].value.cooked;
241 }
242 return { value };
243 }
244 case "ObjectExpression":{
245 const value = {};
246 for (const prop of node.properties) {
247 if (prop.decorators) return;
248 switch (prop.type) {
249 case "ObjectProperty":{
250 let key;
251 if (prop.computed) {
252 const keyNode = computeNode(prop.key);
253 if (!keyNode) return;
254 key = keyNode.value + "";
255 } else {
256 switch (prop.key.type) {
257 case "Identifier":
258 key = prop.key.name;
259 break;
260 case "StringLiteral":
261 key = prop.key.value;
262 break;
263 default:
264 return;
265 }
266 }
267
268 const propValue = computeNode(prop.value);
269 if (!propValue) return;
270 value[key] = propValue.value;
271 break;
272 }
273 case "SpreadElement":{
274 const arg = computeNode(prop.argument);
275 if (!arg) return;
276 Object.assign(value, arg.value);
277 break;
278 }
279 }
280 }
281
282 return { value };
283 }
284 case "ArrayExpression":{
285 const value = [];
286 for (const elem of node.elements) {
287 if (elem) {
288 if (elem.type === "SpreadElement") {
289 const arg = computeNode(elem.argument);
290 if (typeof arg?.value?.[Symbol.iterator] !== "function") return;
291 for (const item of arg.value) {
292 value.push(item);
293 }
294 } else {
295 const elemValue = computeNode(elem);
296 if (!elemValue) return;
297 value.push(elemValue.value);
298 }
299 } else {
300 value.length++;
301 }
302 }
303
304 return { value };
305 }
306 }
307}
308
309// defineTag
310function defineTag(tag) {
311 return tag;
312}
313
314// diagnosticDeprecate
315function diagnosticDeprecate(path, options) {
316 add(DiagnosticType.Deprecation, path, options);
317}
318
319// diagnosticError
320function diagnosticError(path, options) {
321 add(DiagnosticType.Error, path, options);
322}
323
324// diagnosticSuggest
325function diagnosticSuggest(path, options) {
326 add(DiagnosticType.Suggestion, path, options);
327}
328
329// diagnosticWarn
330function diagnosticWarn(path, options) {
331 add(DiagnosticType.Warning, path, options);
332}
333
334// findAttributeTags
335function findAttributeTags(path, attributeTags = []) {
336 const attrTags = path.node.body.attributeTags ?
337 path.get("body").get("body") :
338 path.get("attributeTags");
339 attrTags.forEach((child) => {
340 if (isAttributeTag(child)) {
341 attributeTags.push(child);
342 } else if (isTransparentTag(child)) {
343 findAttributeTags(child, attributeTags);
344 }
345 });
346
347 return attributeTags;
348}
349
350// findParentTag
351function findParentTag(path) {
352 let cur = path.parentPath;
353
354 while (cur.node) {
355 if (cur.isMarkoTagBody()) {
356 cur = cur.parentPath;
357 continue;
358 }
359
360 if (!cur.isMarkoTag()) {
361 cur = undefined;
362 break;
363 }
364
365 if (isTransparentTag(cur)) {
366 cur = cur.parentPath;
367 continue;
368 }
369
370 return cur;
371 }
372}
373
374// getArgOrSequence
375function getArgOrSequence(path) {
376 const {
377 node: { arguments: args }
378 } = path;
379 const len = args && args.length;
380
381 if (len) {
382 if (len > 1) {
383 return _compiler.types.sequenceExpression(args);
384 } else {
385 return args[0];
386 }
387 }
388}
389
390// getEnd
391function getEnd(file, node) {
392 // Restore if merged: https://github.com/babel/babel/pull/16849
393 // if (node.end != null) {
394 // return node.end;
395 // }
396
397 if (node.loc) {
398 return locToIndex(file, node.loc.end);
399 }
400
401 return null;
402}
403
404// getFile
405function getFile() {
406 if (currentFile) {
407 return currentFile;
408 }
409
410 throw new Error("Unable to access Marko File outside of a compilation");
411}
412
413// getFullyResolvedTagName
414function getFullyResolvedTagName(path) {
415 const parts = [];
416 let cur;
417 do {
418 cur = path.node.name.value;
419
420 if (isAttributeTag(path)) {
421 parts.push(cur.slice(1));
422 } else {
423 parts.push(cur || "*");
424 break;
425 }
426 } while (path = findParentTag(path));
427
428 return parts.reverse().join(":");
429}
430
431// getLoc
432function getLoc(file, index) {
433 return findLoc(getLineIndexes(file), 0, index);
434}
435
436// getLocRange
437function getLocRange(file, start, end) {
438 const lineIndexes = getLineIndexes(file);
439 const startLoc = findLoc(lineIndexes, 0, start);
440
441 if (startLoc) {
442 const endLoc =
443 start === end ? startLoc : findLoc(lineIndexes, startLoc.line - 1, end);
444
445 return {
446 start: startLoc,
447 end: endLoc
448 };
449 }
450}
451
452// getMacroIdentifier
453function getMacroIdentifier(path) {
454 const { file } = path.hub;
455
456 if (file.___compileStage !== "translate") {
457 throw new Error(
458 "getMacroIdentifier can only be called during the translate phase of the compiler."
459 );
460 }
461
462 if (!isMacroTag(path)) {
463 throw path.buildCodeFrameError(
464 "getMacroIdentifier called on non macro referencing tag."
465 );
466 }
467
468 return getMacroIdentifierForName(path, path.node.name.value);
469}
470
471// getMacroIdentifierForName
472function getMacroIdentifierForName(path, name) {
473 const { file } = path.hub;
474
475 if (file.___compileStage !== "translate") {
476 throw new Error(
477 "getMacroIdentifierForName can only be called during the translate phase of the compiler."
478 );
479 }
480
481 const markoMeta = file.metadata.marko;
482 let macroIds = markoMeta[MACRO_IDS_KEY];
483
484 if (!macroIds) {
485 macroIds = markoMeta[MACRO_IDS_KEY] = {};
486
487 for (const macroName in markoMeta[MACRO_NAMES_KEY]) {
488 macroIds[macroName] = file.path.scope.generateUid(macroName);
489 }
490 }
491
492 const id = macroIds[name];
493
494 if (!id) {
495 throw new Error(
496 "<macro> was added programmatically, but was not registered via the 'registerMacro' api in @marko/compiler/babel-utils."
497 );
498 }
499
500 return _compiler.types.identifier(id);
501}
502
503// getProgram
504function getProgram() {
505 if (currentFile) {
506 return currentFile.path;
507 }
508
509 throw new Error("Unable to access Marko Program outside of a compilation");
510}
511
512// getStart
513function getStart(file, node) {
514 // Restore if merged: https://github.com/babel/babel/pull/16849
515 // if (node.start != null) {
516 // return node.start;
517 // }
518
519 if (node.loc) {
520 return locToIndex(file, node.loc.start);
521 }
522
523 return null;
524}
525
526// getTagDef
527function getTagDef(path) {
528 const {
529 node,
530 hub: { file }
531 } = path;
532
533 if (node.tagDef === undefined) {
534 if (isDynamicTag(path) || isMacroTag(path)) {
535 node.tagDef = null;
536 } else {
537 node.tagDef =
538 (0, _taglib.getTagDefForTagName)(
539 file,
540 isAttributeTag(path) ?
541 getFullyResolvedTagName(path) :
542 node.name.value
543 ) || null;
544 }
545 }
546
547 return node.tagDef;
548}
549
550// getTagDefForTagName
551function getTagDefForTagName(file, tagName) {
552 const tagDef = getTaglibLookup(file).getTag(tagName);
553
554 if (tagDef) {
555 let seen = file.metadata.marko[SEEN_TAGS_KEY];
556 if (!seen) {
557 seen = file.metadata.marko[SEEN_TAGS_KEY] = new Set();
558 }
559
560 if (!seen.has(tagDef)) {
561 seen.add(tagName);
562 const { filePath } = tagDef;
563 const len = filePath.length;
564
565 if (filePath[len - 14] === "m" && filePath.endsWith("marko-tag.json")) {
566 file.metadata.marko.watchFiles.push(filePath);
567 }
568 }
569 }
570 return tagDef;
571}
572
573// getTagTemplate
574function getTagTemplate(tag) {
575 const {
576 node,
577 hub: { file }
578 } = tag;
579
580 if (node.extra?.tagNameImported) {
581 return (0, _path.join)(file.opts.filename, node.extra.tagNameImported);
582 }
583 return getTagDef(tag)?.template;
584}
585
586// getTaglibLookup
587function getTaglibLookup(file) {
588 return file.___taglibLookup;
589}
590
591// getTemplateId
592function getTemplateId(opts, request, child) {
593 const id = (0, _path.relative)(ROOT, request).replace(/[^a-zA-Z0-9_$./-]/g, "/");
594 const optimize = typeof opts === "object" ? opts.optimize : opts;
595
596 if (optimize) {
597 const optimizeKnownTemplates =
598 typeof opts === "object" && opts.optimizeKnownTemplates;
599 const knownTemplatesSize = optimizeKnownTemplates?.length || 0;
600 if (knownTemplatesSize) {
601 let lookup = idCache.get(optimizeKnownTemplates);
602 if (!lookup) {
603 lookup = new Map();
604 idCache.set(optimizeKnownTemplates, lookup);
605 for (let i = 0; i < knownTemplatesSize; i++) {
606 lookup.set(optimizeKnownTemplates[i], {
607 id: encodeTemplateId(i),
608 children: new Map()
609 });
610 }
611 }
612 let registered = lookup.get(request);
613 if (registered) {
614 if (child) {
615 let childId = registered.children.get(child);
616 if (childId === undefined) {
617 childId = registered.children.size;
618 registered.children.set(child, childId);
619 }
620 return registered.id + childId;
621 }
622 return registered.id;
623 }
624 }
625
626 const hash = (0, _crypto.createHash)("shake256", templateIdHashOpts).update(id);
627 if (child) {
628 hash.update(child);
629 }
630
631 return encodeTemplateId(parseInt(hash.digest("hex"), 16));
632 }
633
634 return id + (child ? `_${child}` : "");
635}
636
637// hasMacro
638function hasMacro(path, name) {
639 const macroNames = path.hub.file.metadata.marko[MACRO_NAMES_KEY];
640 return !!(macroNames && macroNames[name]);
641}
642
643// importDefault
644function importDefault(file, request, nameHint) {
645 const imports = getImports(file);
646 request = resolveRelativePath(file, request);
647 let importDeclaration = imports.get(request);
648
649 if (!importDeclaration) {
650 imports.set(
651 request,
652 importDeclaration = file.path.pushContainer(
653 "body",
654 _compiler.types.importDeclaration([], _compiler.types.stringLiteral(request))
655 )[0]
656 );
657 }
658
659 if (!nameHint) {
660 return;
661 }
662
663 const specifiers = importDeclaration.get("specifiers");
664 const specifier = specifiers.find((specifier) =>
665 specifier.isImportDefaultSpecifier()
666 );
667
668 if (!specifier) {
669 const identifier = file.scope.generateUidIdentifier(nameHint);
670 importDeclaration.pushContainer(
671 "specifiers",
672 _compiler.types.importDefaultSpecifier(identifier)
673 );
674 return identifier;
675 }
676
677 return _compiler.types.identifier(specifier.node.local.name);
678}
679
680// importNamed
681function importNamed(file, request, name, nameHint = name) {
682 request = resolveRelativePath(file, request);
683 const imports = getImports(file);
684 let importDeclaration = imports.get(request);
685
686 if (!importDeclaration) {
687 imports.set(
688 request,
689 importDeclaration = file.path.pushContainer(
690 "body",
691 _compiler.types.importDeclaration([], _compiler.types.stringLiteral(request))
692 )[0]
693 );
694 }
695
696 const specifiers = importDeclaration.get("specifiers");
697 const specifier = specifiers.find(
698 (specifier) =>
699 specifier.isImportSpecifier() && specifier.node.imported.name === name
700 );
701
702 if (!specifier) {
703 const identifier = file.scope.generateUidIdentifier(nameHint);
704 importDeclaration.pushContainer(
705 "specifiers",
706 _compiler.types.importSpecifier(identifier, _compiler.types.identifier(name))
707 );
708 return identifier;
709 }
710
711 return _compiler.types.identifier(specifier.node.local.name);
712}
713
714// importStar
715function importStar(file, request, nameHint) {
716 const imports = getImports(file);
717 request = resolveRelativePath(file, request);
718 let importDeclaration = imports.get(request);
719
720 if (!importDeclaration) {
721 imports.set(
722 request,
723 importDeclaration = file.path.pushContainer(
724 "body",
725 _compiler.types.importDeclaration([], _compiler.types.stringLiteral(request))
726 )[0]
727 );
728 }
729
730 if (!nameHint) {
731 return;
732 }
733
734 const specifiers = importDeclaration.get("specifiers");
735 const specifier = specifiers.find((specifier) =>
736 specifier.isImportNamespaceSpecifier()
737 );
738
739 if (!specifier) {
740 const identifier = file.scope.generateUidIdentifier(nameHint);
741 importDeclaration.pushContainer(
742 "specifiers",
743 _compiler.types.importNamespaceSpecifier(identifier)
744 );
745 return identifier;
746 }
747
748 return _compiler.types.identifier(specifier.node.local.name);
749}
750
751// isAttributeTag
752function isAttributeTag(path) {
753 const {
754 node: { name }
755 } = path;
756 return _compiler.types.isStringLiteral(name) && name.value[0] === "@";
757}
758
759// isDynamicTag
760function isDynamicTag(path) {
761 return !_compiler.types.isStringLiteral(path.node.name);
762}
763
764// isLoopTag
765function isLoopTag(path) {
766 if (!path.isMarkoTag()) {
767 return false;
768 }
769
770 const tagName = path.node.name.value;
771 return tagName === "while" || tagName === "for";
772}
773
774// isMacroTag
775function isMacroTag(path) {
776 const { name } = path.node;
777 return _compiler.types.isStringLiteral(name) && hasMacro(path, name.value);
778}
779
780// isNativeTag
781function isNativeTag(path) {
782 if (path.node._isDynamicString) {
783 return true;
784 }
785
786 const tagDef = getTagDef(path);
787 return (
788 tagDef &&
789 tagDef.html && (
790 tagDef.htmlType === "custom-element" ||
791 !tagDef.template && !tagDef.renderer));
792
793}
794
795// isTransparentTag
796function isTransparentTag(path) {
797 const {
798 node: { name }
799 } = path;
800 return _compiler.types.isStringLiteral(name) && TRANSPARENT_TAGS.has(name.value);
801}
802
803// loadFileForImport
804function loadFileForImport(file, request) {
805 const relativeRequest = resolveTagImport(file.path, request);
806
807 if (relativeRequest) {
808 const filename =
809 relativeRequest[0] === "." ?
810 (0, _path.resolve)(file.opts.filename, "..", relativeRequest) :
811 (0, _resolveFrom.default)((0, _path.dirname)(file.opts.filename), relativeRequest);
812 const markoMeta = file.metadata.marko;
813 const { analyzedTags } = markoMeta;
814 if (analyzedTags) {
815 analyzedTags.add(relativeRequest);
816 } else {
817 markoMeta.analyzedTags = new Set([relativeRequest]);
818 }
819
820 return resolveMarkoFile(file, filename);
821 }
822}
823
824// loadFileForTag
825function loadFileForTag(tag) {
826 const { file } = tag.hub;
827 if (tag.node.extra?.tagNameImported) {
828 return loadFileForImport(file, tag.node.extra?.tagNameImported);
829 }
830
831 const def = getTagDef(tag);
832 const filename = def && def.template;
833
834 if (filename) {
835 const markoMeta = file.metadata.marko;
836 const relativeFileName = (0, _imports.resolveRelativePath)(file, filename);
837 const { analyzedTags } = markoMeta;
838 if (analyzedTags) {
839 analyzedTags.add(relativeFileName);
840 } else {
841 markoMeta.analyzedTags = new Set([relativeFileName]);
842 }
843
844 return resolveMarkoFile(file, filename);
845 }
846}
847
848// normalizeTemplateString
849function normalizeTemplateString(quasis, ...expressions) {
850 quasis = quasis.map((q) => _compiler.types.isTemplateElement(q) ? q.value.cooked : q);
851
852 for (let i = expressions.length; i--;) {
853 let v = expressions[i];
854 if (_compiler.types.isTemplateLiteral(v)) {
855 quasis[i] += v.quasis[0].value.cooked;
856 quasis[i + 1] =
857 v.quasis[v.quasis.length - 1].value.cooked + (quasis[i + 1] || "");
858 quasis.splice(
859 i + 1,
860 0,
861 ...v.quasis.slice(1, -1).map((q) => q.value.cooked)
862 );
863 expressions.splice(i, 1, ...v.expressions);
864 i += v.expressions.length;
865 } else if (_compiler.types.isStringLiteral(v) || typeof v === "string") {
866 const value = _compiler.types.isStringLiteral(v) ? v.value : v;
867 quasis[i] += value + quasis[i + 1];
868 expressions.splice(i, 1);
869 quasis.splice(i + 1, 1);
870 }
871 }
872
873 if (!expressions.length) {
874 // No expression, just return a literal or empty.
875 const literal = quasis.join("");
876 return literal === "" ? undefined : _compiler.types.stringLiteral(literal);
877 }
878
879 if (
880 expressions.length === 1 &&
881 quasis.length === 2 &&
882 quasis.every(isEmptyString))
883 {
884 // Only expression `${expr}` just return the expr.
885 return expressions[0];
886 }
887
888 // Do it.
889 return _compiler.types.templateLiteral(quasis.map(getTemplateElement), expressions);
890}
891
892// parseArgs
893function parseArgs(file, str, sourceStart, sourceEnd) {
894 const parsed = parseExpression(file, `_(${str})`, sourceStart, sourceEnd, 2);
895
896 if (parsed.type === "CallExpression") {
897 return parsed.arguments;
898 }
899
900 return [ensureParseError(file, parsed, sourceStart, sourceEnd)];
901}
902
903// parseExpression
904function parseExpression(
905file,
906str,
907sourceStart,
908sourceEnd,
909sourceOffset)
910{
911 return tryParse(file, true, str, sourceStart, sourceEnd, sourceOffset);
912}
913
914// parseParams
915function parseParams(file, str, sourceStart, sourceEnd) {
916 const parsed = parseExpression(
917 file,
918 `(${str})=>{}`,
919 sourceStart,
920 sourceEnd,
921 1
922 );
923
924 if (parsed.type === "ArrowFunctionExpression") {
925 return parsed.params;
926 }
927
928 return [ensureParseError(file, parsed, sourceStart, sourceEnd)];
929}
930
931// parseStatements
932function parseStatements(
933file,
934str,
935sourceStart,
936sourceEnd,
937sourceOffset)
938{
939 return tryParse(file, false, str, sourceStart, sourceEnd, sourceOffset);
940}
941
942// parseTemplateLiteral
943function parseTemplateLiteral(file, str, sourceStart, sourceEnd) {
944 const parsed = parseExpression(
945 file,
946 "`" + str + "`",
947 sourceStart,
948 sourceEnd,
949 1
950 );
951
952 if (parsed.type === "TemplateLiteral") {
953 return _compiler.types.templateLiteral(parsed.quasis, parsed.expressions);
954 }
955
956 return ensureParseError(file, parsed, sourceStart, sourceEnd);
957}
958
959// parseTypeArgs
960function parseTypeArgs(file, str, sourceStart, sourceEnd) {
961 const parsed = parseExpression(file, `_<${str}>`, sourceStart, sourceEnd, 2);
962
963 if (parsed.type === "TSInstantiationExpression") {
964 // typeArguments is Flow only (not TS), we need to use typeParameters
965 return parsed.typeParameters;
966 }
967
968 return [ensureParseError(file, parsed, sourceStart, sourceEnd)];
969}
970
971// parseTypeParams
972function parseTypeParams(file, str, sourceStart, sourceEnd) {
973 const parsed = parseExpression(
974 file,
975 `<${str}>()=>{}`,
976 sourceStart,
977 sourceEnd,
978 1
979 );
980
981 if (parsed.type === "ArrowFunctionExpression") {
982 return parsed.typeParameters;
983 }
984
985 return [ensureParseError(file, parsed, sourceStart, sourceEnd)];
986}
987
988// parseVar
989function parseVar(file, str, sourceStart, sourceEnd) {
990 const parsed = parseExpression(
991 file,
992 `(${str})=>{}`,
993 sourceStart,
994 sourceEnd,
995 1
996 );
997
998 if (parsed.type === "ArrowFunctionExpression" && parsed.params.length === 1) {
999 return parsed.params[0];
1000 }
1001
1002 return ensureParseError(file, parsed, sourceStart, sourceEnd);
1003}
1004
1005// registerMacro
1006function registerMacro(path, name) {
1007 const { file } = path.hub;
1008 const markoMeta = file.metadata.marko;
1009 const macroNames = markoMeta[MACRO_NAMES_KEY];
1010
1011 if (macroNames) {
1012 if (macroNames[name]) {
1013 (0, _diagnostics.diagnosticWarn)(path, {
1014 label: `A macro with the name "${name}" already exists.`,
1015 fix() {
1016 findParentTag(path).remove();
1017 }
1018 });
1019 }
1020 macroNames[name] = true;
1021 } else {
1022 markoMeta[MACRO_NAMES_KEY] = { [name]: true };
1023 }
1024}
1025
1026// resolveRelativePath
1027function resolveRelativePath(file, request) {
1028 if (request.startsWith(FS_START)) {
1029 request = (0, _relativeImportPath.relativeImportPath)(file.opts.filename, request);
1030 }
1031
1032 if (file.markoOpts.optimize) {
1033 request = request.replace(
1034 /(^|\/node-modules\/)marko\/src\//,
1035 "$1marko/dist/"
1036 );
1037 }
1038
1039 return request;
1040}
1041
1042// resolveTagImport
1043function resolveTagImport(path, request) {
1044 const {
1045 hub: { file }
1046 } = path;
1047 if (request[0] === "<") {
1048 const tagName = request.slice(1, -1);
1049 const tagDef = (0, _taglib.getTagDefForTagName)(file, tagName);
1050 const tagEntry = tagDef && (tagDef.renderer || tagDef.template);
1051 const relativePath = tagEntry && (0, _imports.resolveRelativePath)(file, tagEntry);
1052
1053 if (!relativePath) {
1054 throw path.buildCodeFrameError(
1055 `Unable to find entry point for custom tag <${tagName}>.`
1056 );
1057 }
1058
1059 return relativePath;
1060 }
1061
1062 if (request.endsWith(".marko")) {
1063 return (0, _imports.resolveRelativePath)(file, request);
1064 }
1065}
1066
1067// withLoc
1068function withLoc(file, node, start, end) {
1069 node.loc = getLocRange(file, start, end);
1070 node.start = start;
1071 node.end = end;
1072 return node;
1073}
src/file-viewer/views/canvas.client.ts deleted-30
......@@ -1,30 +0,0 @@
1// __esModule
2true
3
4// getFile
5function getFile() {
6 if (currentFile) {
7 return currentFile;
8 }
9
10 throw new Error("Unable to access Marko File outside of a compilation");
11}
12
13// getFileInternal
14function getFileInternal() {
15 return currentFile;
16}
17
18// getProgram
19function getProgram() {
20 if (currentFile) {
21 return currentFile.path;
22 }
23
24 throw new Error("Unable to access Marko Program outside of a compilation");
25}
26
27// setFileInternal
28function setFileInternal(file) {
29 return currentFile = file;
30}
src/file-viewer/views/canvas.marko deleted-13
......@@ -1,13 +0,0 @@
1import { Script } from "#sitegen";
2
3export interface Input {
4 script: string;
5}
6
7<Script src="./canvas.client.ts" />;
8
9<canvas#canvas
10 data-canvas=script
11 data-standalone="true"
12 style="position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;"
13/>
src/file-viewer/views/file-viewer.client.ts deleted-25
......@@ -1,25 +0,0 @@
1// __esModule
2true
3
4// DiagnosticType
5[object Object]
6
7// diagnosticDeprecate
8function diagnosticDeprecate(path, options) {
9 add(DiagnosticType.Deprecation, path, options);
10}
11
12// diagnosticError
13function diagnosticError(path, options) {
14 add(DiagnosticType.Error, path, options);
15}
16
17// diagnosticSuggest
18function diagnosticSuggest(path, options) {
19 add(DiagnosticType.Suggestion, path, options);
20}
21
22// diagnosticWarn
23function diagnosticWarn(path, options) {
24 add(DiagnosticType.Warning, path, options);
25}
src/file-viewer/views/file-viewer.css deleted-33
......@@ -1,33 +0,0 @@
1// default
2class PluginPass {
3 constructor(file, key, options, isAsync) {
4 this._map = new Map();
5 this.key = void 0;
6 this.file = void 0;
7 this.opts = void 0;
8 this.cwd = void 0;
9 this.filename = void 0;
10 this.isAsync = void 0;
11 this.key = key;
12 this.file = file;
13 this.opts = options || {};
14 this.cwd = file.opts.cwd;
15 this.filename = file.opts.filename;
16 this.isAsync = isAsync;
17 }
18 set(key, val) {
19 this._map.set(key, val);
20 }
21 get(key) {
22 return this._map.get(key);
23 }
24 availableHelper(name, versionRange) {
25 return this.file.availableHelper(name, versionRange);
26 }
27 addHelper(name) {
28 return this.file.addHelper(name);
29 }
30 buildCodeFrameError(node, msg, _Error) {
31 return this.file.buildCodeFrameError(node, msg, _Error);
32 }
33}
src/file-viewer/views/file-viewer.tsx deleted-1007
......@@ -1,1007 +0,0 @@
1import "./file-viewer.css";
2import assert from "node:assert";
3import path, { dirname } from "node:path";
4import { MediaFile } from "../db.ts";
5import { useInlineScript } from "../framework/page-resources.ts";
6import { escapeUri, formatDuration, formatSize } from "../media/share.ts";
7import {
8 highlightConvo,
9 highlightHashComments,
10 highlightLinksInTextView,
11} from "../media/text-formatting.ts";
12import { TestID } from "../test/id.ts";
13import { ForEveryone } from "../media/cotyledon.tsx";
14
15export const theme = {
16 bg: "#312652",
17 fg: "#f0f0ff",
18 primary: "#fabe32",
19};
20
21export const extensionToViewer: {
22 [key: string]: (props: {
23 file: MediaFile;
24 siblingFiles?: MediaFile[];
25 }) => any;
26} = {
27 ".html": IframeView,
28 ".txt": TextView,
29 ".md": TextView,
30 ".mp4": VideoView,
31 ".mkv": VideoView,
32 ".webm": VideoView,
33 ".avi": VideoView,
34 ".mov": VideoView,
35 ".mp3": AudioView,
36 ".flac": AudioView,
37 ".wav": AudioView,
38 ".ogg": AudioView,
39 ".m4a": AudioView,
40 ".jpg": ImageView,
41 ".jpeg": ImageView,
42 ".png": ImageView,
43 ".gif": ImageView,
44 ".webp": ImageView,
45 ".avif": ImageView,
46 ".heic": ImageView,
47 ".svg": ImageView,
48 ".chat": ChatView,
49 ".json": CodeView,
50 ".jsonc": CodeView,
51 ".toml": CodeView,
52 ".ts": CodeView,
53 ".js": CodeView,
54 ".tsx": CodeView,
55 ".jsx": CodeView,
56 ".css": CodeView,
57 ".py": CodeView,
58 ".lua": CodeView,
59 ".sh": CodeView,
60 ".bat": CodeView,
61 ".ps1": CodeView,
62 ".cmd": CodeView,
63 ".yaml": CodeView,
64 ".yml": CodeView,
65 ".xml": CodeView,
66 ".zig": CodeView,
67 ".astro": CodeView,
68 ".mdx": CodeView,
69 ".php": CodeView,
70 ".diff": CodeView,
71 ".patch": CodeView,
72};
73
74export default function MediaList({
75 file,
76 hasCotyledonCookie,
77}: {
78 file: MediaFile;
79 hasCotyledonCookie: boolean;
80}) {
81 useInlineScript("file_viewer");
82
83 const dirs: MediaFile[] = [];
84 let dir: MediaFile | null = file;
85 assert(dir);
86 do {
87 dirs.unshift(dir);
88 dir = dir?.getParent();
89 } while (dir);
90 const parts = file.path.split("/");
91
92 const isCotyledon = parseInt(parts[1]) < 2025;
93
94 return (
95 <div class={"files" + (isCotyledon ? " ctld ctld-" + parts[1] : "")}>
96 {dirs.map((entry, i) => {
97 const isLast = i === dirs.length - 1;
98 return (
99 <MediaPanel
100 file={entry}
101 isLast={isLast}
102 activeFilename={parts[i + 1]}
103 hasCotyledonCookie={hasCotyledonCookie}
104 />
105 );
106 })}
107 </div>
108 );
109}
110
111const specialCaseViewers: Record<string, any> = {
112 "/2024/for everyone": ForEveryone,
113};
114
115export function MediaPanel({
116 file,
117 isLast,
118 activeFilename,
119 hasCotyledonCookie,
120}: {
121 file: MediaFile;
122 isLast: boolean;
123 activeFilename: string | null;
124 hasCotyledonCookie: boolean;
125}) {
126 const showsActions = file.path !== "/2024/for everyone";
127 const label = file.path === "/"
128 ? (
129 "clo's files"
130 )
131 : (
132 <>
133 {file.kind === MediaFile.Kind.directory
134 ? (
135 <span>
136 {file.basename}
137 <span class="bold-slash">/</span>
138 </span>
139 )
140 : (
141 <>
142 {file.basename}
143 <div style="flex:1" />
144 {showsActions && (
145 <div class="actions">
146 <a
147 class="custom full-screen"
148 href={`/file${escapeUri(file.path)}?view=embed`}
149 aria-label="full screen"
150 >
151 </a>
152 <a
153 class="custom download"
154 href={`/file${escapeUri(file.path)}?dl`}
155 aria-label="download"
156 >
157 </a>
158 </div>
159 )}
160 </>
161 )}
162 </>
163 );
164 let View = specialCaseViewers[file.path] ??
165 (extensionToViewer[file.extension.toLowerCase()] as any) ??
166 DownloadView;
167 if (View === VideoView && file.size > 500_000_000) {
168 View = DownloadViewTooBig;
169 }
170 const mobileBtn = file.path !== "/" && (
171 <a
172 href={`/file${escapeUri(path.dirname(file.path).replace(/\/$/, ""))}`}
173 className="custom mobile-back"
174 />
175 );
176 const canvases: Record<string, string> = {
177 "/2017": "2017",
178 "/2018": "2018",
179 "/2019": "2019",
180 "/2020": "2020",
181 "/2021": "2021",
182 "/2022": "2022",
183 "/2023": "2023",
184 "/2024": "2024",
185 };
186 if (canvases[file.path]) {
187 useInlineScript(`canvas_${canvases[file.path]}` as any);
188 }
189 return (
190 <div
191 class={(isLast ? "panel last" : "panel") +
192 (file.path === "/" ? " first" : "")}
193 >
194 {canvases[file.path] && (
195 <canvas
196 class="fullscreen-canvas"
197 data-canvas={canvases[file.path]}
198 >
199 </canvas>
200 )}
201 {file.kind === MediaFile.Kind.directory && (
202 <a class="custom header" href={`/file${escapeUri(file.path)}`}>
203 <div class="ico ico-dir-open"></div>
204 {label}
205 </a>
206 )}
207 <div class="header">
208 {mobileBtn}
209 {<div class={`ico ico-${fileIcon(file, true)}`}></div>}
210 {label}
211 </div>
212
213 {file.kind === MediaFile.Kind.directory
214 ? (
215 <DirView
216 dir={file}
217 activeFilename={activeFilename}
218 isLast={isLast}
219 hasCotyledonCookie={hasCotyledonCookie}
220 />
221 )
222 : (
223 <div
224 class={`content file-view${
225 View.class ? " file-view-" + View.class : ""
226 }`}
227 >
228 <View file={file} />
229 </div>
230 )}
231 </div>
232 );
233}
234
235const readmeFile = "readme.txt";
236const priorityFiles = ["readme.txt", "index.html"];
237
238function sorterFromDirSort(dirsort: string) {
239 const array: string[] = JSON.parse(dirsort);
240 if (array.length === 1 && array[0] === "a-z") {
241 return sortAlphabetically;
242 }
243 return (a: MediaFile, b: MediaFile) => {
244 const aIndex = array.indexOf(a.basename);
245 const bIndex = array.indexOf(b.basename);
246 if (bIndex == -1 && aIndex >= 0) return -1;
247 if (aIndex == -1 && bIndex >= 0) return 1;
248 if (aIndex >= 0 && bIndex >= 0) {
249 return aIndex - bIndex;
250 }
251 sortDefault(a, b);
252 };
253}
254
255function sortNumerically(a: MediaFile, b: MediaFile) {
256 const n1 = parseInt(a.basenameWithoutExt);
257 const n2 = parseInt(a.basenameWithoutExt);
258 return n1 - n2;
259}
260
261function sortDefault(a: MediaFile, b: MediaFile) {
262 // First check if either file is in the priority list
263 const aIndex = priorityFiles.indexOf(a.basename.toLowerCase());
264 const bIndex = priorityFiles.indexOf(b.basename.toLowerCase());
265
266 if (aIndex !== -1 && bIndex !== -1) {
267 // Both are priority files, sort by priority order
268 return aIndex - bIndex;
269 } else if (aIndex !== -1) {
270 // Only a is a priority file
271 return -1;
272 } else if (bIndex !== -1) {
273 // Only b is a priority file
274 return 1;
275 }
276
277 // Then sort directories before files
278 if (a.kind !== b.kind) {
279 return a.kind === MediaFile.Kind.directory ? -1 : 1;
280 }
281
282 // Finally sort by date (newest first), then by name (a-z) if dates are the same
283 const dateComparison = b.date.getTime() - a.date.getTime();
284 if (dateComparison !== 0) {
285 return dateComparison;
286 }
287 // If dates are the same, sort alphabetically by name
288 return a.basename.localeCompare(b.basename);
289}
290
291function sortAlphabetically(a: MediaFile, b: MediaFile) {
292 // First check if either file is in the priority list
293 const aIndex = priorityFiles.indexOf(a.basename.toLowerCase());
294 const bIndex = priorityFiles.indexOf(b.basename.toLowerCase());
295
296 if (aIndex !== -1 && bIndex !== -1) {
297 // Both are priority files, sort by priority order
298 return aIndex - bIndex;
299 } else if (aIndex !== -1) {
300 // Only a is a priority file
301 return -1;
302 } else if (bIndex !== -1) {
303 // Only b is a priority file
304 return 1;
305 }
306
307 // If dates are the same, sort alphabetically by name
308 return a.basename.localeCompare(b.basename);
309}
310
311function isNumericallyOrdered(files: MediaFile[]) {
312 return !files.some((x) => Number.isNaN(parseInt(x.basenameWithoutExt)));
313}
314
315function sortChronologicalStartToEnd(a: MediaFile, b: MediaFile) {
316 const aIndex = priorityFiles.indexOf(a.basename.toLowerCase());
317 const bIndex = priorityFiles.indexOf(b.basename.toLowerCase());
318
319 if (aIndex !== -1 && bIndex !== -1) {
320 return aIndex - bIndex;
321 } else if (aIndex !== -1) {
322 return -1;
323 } else if (bIndex !== -1) {
324 return 1;
325 }
326
327 const dateComparison = a.date.getTime() - b.date.getTime();
328 if (dateComparison !== 0) {
329 return dateComparison;
330 }
331 return a.basename.localeCompare(b.basename);
332}
333
334const sortOverrides: Record<string, (a: MediaFile, b: MediaFile) => number> = {
335 "/2024": sortChronologicalStartToEnd,
336 "/2023": sortChronologicalStartToEnd,
337 "/2022": sortChronologicalStartToEnd,
338 "/2021": sortChronologicalStartToEnd,
339 "/2020": sortChronologicalStartToEnd,
340 "/2019": sortChronologicalStartToEnd,
341 "/2018": sortChronologicalStartToEnd,
342 "/2017": sortChronologicalStartToEnd,
343};
344
345function DirView({
346 dir,
347 activeFilename,
348 isLast,
349 hasCotyledonCookie,
350}: {
351 dir: MediaFile;
352 activeFilename: string | null;
353 isLast: boolean;
354 hasCotyledonCookie: boolean;
355}) {
356 if (dir.path === "/") {
357 return (
358 <RootDirView
359 dir={dir}
360 activeFilename={activeFilename}
361 isLast={isLast}
362 hasCotyledonCookie={hasCotyledonCookie}
363 />
364 );
365 }
366 const isCotyledon = parseInt(dir.path.split("/")?.[1]) < 2025;
367 const unsortedFiles = dir
368 .getChildren()
369 .filter((f) => !f.basenameWithoutExt.startsWith("_unlisted"));
370 const sorter = dir.dirsort
371 ? sorterFromDirSort(dir.dirsort)
372 : isNumericallyOrdered(unsortedFiles)
373 ? sortNumerically
374 : isCotyledon
375 ? sortChronologicalStartToEnd
376 : (sortOverrides[dir.path] ?? sortDefault);
377 const sortedFiles = unsortedFiles.sort(sorter);
378 const readme = sortedFiles.find((f) => f.basename === readmeFile);
379 if (readme && isLast) activeFilename ||= readmeFile;
380 const main = (
381 <div class="content primary">
382 <ul>
383 {sortedFiles.map((file) => {
384 return (
385 <ListItem file={file} active={activeFilename === file.basename} />
386 );
387 })}
388 </ul>
389 </div>
390 );
391
392 if (readme && isLast) {
393 return (
394 <div class="hsplit">
395 <ReadmeView file={readme} siblingFiles={sortedFiles} />
396 {main}
397 </div>
398 );
399 }
400
401 return main;
402}
403
404const unknownDate = new Date("1970-01-03");
405const unknownDateWithKnownYear = new Date("1970-02-20");
406
407function ListItem({
408 file,
409 active,
410 noDate,
411}: {
412 file: MediaFile;
413 active: boolean;
414 noDate?: boolean;
415}) {
416 const dateTime = file.date;
417 let shortDate = dateTime < unknownDateWithKnownYear
418 ? (
419 dateTime < unknownDate
420 ? (
421 "??.??.??"
422 )
423 : <>xx.xx.{21 + Math.floor(dateTime.getTime() / 86400000)}</>
424 )
425 : (
426 `${(dateTime.getMonth() + 1).toString().padStart(2, "0")}.${
427 dateTime
428 .getDate()
429 .toString()
430 .padStart(2, "0")
431 }.${dateTime.getFullYear().toString().slice(2)}`
432 );
433
434 let basenameWithoutExt = file.basenameWithoutExt;
435
436 let meta = file.kind === MediaFile.Kind.directory
437 ? formatSize(file.size)
438 : (file.duration ?? 0) > 0
439 ? formatDuration(file.duration!)
440 : null;
441 if (meta && dirname(file.path) !== "/") {
442 meta = `(${meta})`;
443 }
444
445 const isReadme = file.basename === readmeFile;
446
447 return (
448 <li>
449 <a
450 class={(active ? "active " : "") + (isReadme ? "readme " : "") +
451 "li custom"}
452 href={file.extension === ".lnk"
453 ? file.contents
454 : isReadme
455 ? `/file${escapeUri(path.dirname(file.path).replace(/\/$/, ""))}`
456 : `/file${escapeUri(file.path)}`}
457 >
458 <span>
459 {file.basename === readmeFile
460 ? <>{!noDate && <div class="line"></div>}</>
461 : <>{!noDate && <date>{shortDate}</date>}</>}
462 <span class="size mobile">{meta}</span>
463 </span>
464
465 <span>
466 {path.dirname(file.path) !== "/" && (
467 <span className={`ico ico-${fileIcon(file)}`}></span>
468 )}
469 {basenameWithoutExt}
470 <span class="ext">{file.extension}</span>
471 {file.kind === MediaFile.Kind.directory
472 ? <span class="bold-slash">/</span>
473 : (
474 ""
475 )}
476
477 <span class="size desktop">{meta}</span>
478 </span>
479 </a>
480 </li>
481 );
482}
483
484function fileIcon(file: MediaFile, dirOpen?: boolean) {
485 if (file.kind === MediaFile.Kind.directory) {
486 return dirOpen ? "dir-open" : "dir";
487 }
488 if (file.basename === "readme.txt") {
489 return "readme";
490 }
491 if (file.path === "/2024/for everyone") {
492 return "snow";
493 }
494 const ext = path.extname(file.basename).toLowerCase();
495 if (
496 ext === ".mp4" ||
497 ext === ".mkv" ||
498 ext === ".webm" ||
499 ext === ".avi" ||
500 ext === ".mov"
501 ) {
502 return "video";
503 }
504 if (
505 ext === ".mp3" ||
506 ext === ".flac" ||
507 ext === ".wav" ||
508 ext === ".ogg" ||
509 ext === ".m4a"
510 ) {
511 return "audio";
512 }
513 if (
514 ext === ".jpg" ||
515 ext === ".jpeg" ||
516 ext === ".png" ||
517 ext === ".gif" ||
518 ext === ".webp" ||
519 ext === ".avif" ||
520 ext === ".heic" ||
521 ext === ".svg"
522 ) {
523 return "image";
524 }
525 if (ext === ".comp" || ext === ".fuse" || ext === ".setting") return "fusion";
526 if (ext === ".txt" || ext === ".md") return "text";
527 if (ext === ".html") return "webpage";
528 if (ext === ".blend") return "blend";
529 if (
530 ext === ".zip" ||
531 ext === ".rar" ||
532 ext === ".7z" ||
533 ext === ".tar" ||
534 ext === ".gz" ||
535 ext === ".bz2" ||
536 ext === ".xz"
537 ) {
538 return "archive";
539 }
540 if (ext === ".lnk") return "link";
541 if (ext === ".chat") return "chat";
542 if (
543 ext === ".ts" ||
544 ext === ".js" ||
545 ext === ".tsx" ||
546 ext === ".jsx" ||
547 ext === ".css" ||
548 ext === ".py" ||
549 ext === ".lua" ||
550 ext === ".sh" ||
551 ext === ".bat" ||
552 ext === ".ps1" ||
553 ext === ".cmd" ||
554 ext === ".php"
555 ) {
556 return "code";
557 }
558 if (ext === ".json" || ext === ".toml" || ext === ".yaml" || ext === ".yml") {
559 return "json";
560 }
561 return "file";
562}
563
564function RootDirView({
565 dir,
566 activeFilename,
567 isLast,
568 hasCotyledonCookie,
569}: {
570 dir: MediaFile;
571 activeFilename: string | null;
572 isLast: boolean;
573 hasCotyledonCookie: boolean;
574}) {
575 const children = dir.getChildren();
576 let readme: MediaFile | null = null;
577
578 const groups = {
579 // years 2025 and onwards
580 years: [] as MediaFile[],
581 // named categories
582 categories: [] as MediaFile[],
583 // years 2017 to 2024
584 cotyledon: [] as MediaFile[],
585 };
586 const colorMap = {
587 years: "#a2ff91",
588 categories: "#9c91ff",
589 cotyledon: "#ff91ca",
590 };
591 for (const child of children) {
592 const basename = child.basename;
593 if (basename === readmeFile) {
594 readme = child;
595 continue;
596 }
597
598 const year = basename.match(/^(\d{4})/);
599 if (year) {
600 const n = parseInt(year[1]);
601 if (n >= 2025) {
602 groups.years.push(child);
603 } else {
604 groups.cotyledon.push(child);
605 }
606 } else {
607 groups.categories.push(child);
608 }
609 }
610
611 if (readme && isLast) activeFilename ||= readmeFile;
612
613 const main = (
614 <div class="content primary">
615 {readme && (
616 <ul>
617 <ListItem
618 file={readme}
619 active={activeFilename === readmeFile}
620 noDate
621 />
622 </ul>
623 )}
624 {Object.entries(groups).map(([key, files]) => {
625 if (key === "cotyledon" && !hasCotyledonCookie) {
626 return null;
627 }
628 if (key === "years" || key === "cotyledon") {
629 files.sort((a, b) => {
630 return b.basename.localeCompare(a.basename);
631 });
632 } else {
633 files.sort((a, b) => {
634 return a.basename.localeCompare(b.basename);
635 });
636 }
637 return (
638 <div class="group" data-group={key}>
639 <h3 style={`color:${colorMap[key as keyof typeof colorMap]};`}>
640 {key}
641 </h3>
642 <ul>
643 {files.map((file) => (
644 <ListItem
645 file={file}
646 active={activeFilename === file.basename}
647 noDate={key === "cotyledon"}
648 />
649 ))}
650 </ul>
651 </div>
652 );
653 })}
654 </div>
655 );
656
657 if (readme && isLast) {
658 return (
659 <div class="hsplit">
660 <ReadmeView
661 file={readme}
662 siblingFiles={children}
663 extra={!hasCotyledonCookie && (
664 <>
665 <a href="/file/cotyledon" class="custom cotyledon-link desktop">
666 cotyledon
667 </a>
668 </>
669 )}
670 />
671 {main}
672 {!hasCotyledonCookie && (
673 <>
674 <a href="/file/cotyledon" class="custom cotyledon-link mobile">
675 cotyledon
676 </a>
677 </>
678 )}
679 </div>
680 );
681 }
682
683 return main;
684}
685
686function TextView({
687 file,
688 siblingFiles = [],
689}: {
690 file: MediaFile;
691 siblingFiles?: MediaFile[];
692}) {
693 const contents = file.contents;
694
695 if (file.path.startsWith("/2021/phoenix-write/maps")) {
696 const basename = file.basename;
697 if (basename.includes("map") && basename.endsWith(".txt")) {
698 return (
699 <pre
700 style="white-space:normal;max-width:73ch"
701 dangerouslySetInnerHTML={{
702 __html: highlightHashComments(contents),
703 }}
704 ></pre>
705 );
706 }
707 }
708
709 return (
710 <pre
711 style="white-space:pre-wrap;max-width:70ch"
712 dangerouslySetInnerHTML={{
713 __html: highlightLinksInTextView(
714 contents,
715 siblingFiles.filter((f) => f.kind === MediaFile.Kind.file),
716 ),
717 }}
718 ></pre>
719 );
720}
721
722function ChatView({ file }: { file: MediaFile }) {
723 const contents = file.contents;
724 return (
725 <div
726 style="max-width:70ch"
727 class="convo"
728 dangerouslySetInnerHTML={{
729 __html: highlightConvo(contents),
730 }}
731 >
732 </div>
733 );
734}
735
736function CodeView({ file }: { file: MediaFile }) {
737 const highlightedContents = file.contents;
738 if (!highlightedContents) {
739 if (file.size > 1_000_000) {
740 return <DownloadViewTooBig file={file} />;
741 }
742 return <DownloadViewCodeNotComputed file={file} />;
743 }
744 return (
745 <pre
746 style="white-space:pre-wrap"
747 dangerouslySetInnerHTML={{
748 __html: highlightedContents,
749 }}
750 />
751 );
752}
753
754function VideoView({ file }: { file: MediaFile }) {
755 useInlineScript("video_player");
756 const dimensions = file.parseDimensions() ?? { width: 1920, height: 1080 };
757 return (
758 <>
759 <video
760 controls
761 preload
762 style={`background:transparent;aspect-ratio:${
763 simplifyFraction(
764 dimensions.width,
765 dimensions.height,
766 )
767 }`}
768 >
769 <source
770 src={"/file" + file.path}
771 type={contentTypeFromExt(file.path)}
772 />
773 </video>
774 </>
775 );
776}
777
778function AudioView({
779 file,
780 onlyAudio = false,
781}: {
782 file: MediaFile;
783 onlyAudio?: boolean;
784}) {
785 const parent = file.getParent();
786 let lyricsFile: MediaFile | null = null;
787 if (parent && !onlyAudio) {
788 const siblings = parent.getChildren();
789 // show lyrics only if
790 // - this media file is the only audio file
791 // - there is lyrics.txt in the same directory
792 const audioFiles = siblings.filter(
793 (f) =>
794 f.kind === MediaFile.Kind.file &&
795 extensionToViewer[path.extname(f.basename)] === AudioView,
796 );
797 if (
798 audioFiles.length === 1 &&
799 siblings.find((f) => f.basename === "lyrics.txt")
800 ) {
801 lyricsFile = siblings.find((f) => f.basename === "lyrics.txt")!;
802 }
803 }
804 return (
805 <>
806 <audio controls preload="none" style="width:100%;">
807 <source
808 src={"/file" + file.path}
809 type={`audio/${path.extname(file.path).substring(1)}`}
810 />
811 </audio>
812 {lyricsFile && (
813 <div class="lyrics">
814 <h2 style="margin-left:1rem;margin-bottom:-0.2rem;margin-top:0.5rem;">
815 lyrics
816 </h2>
817 <TextView file={lyricsFile} siblingFiles={[]} />
818 </div>
819 )}
820 </>
821 );
822}
823
824function ImageView({ file }: { file: MediaFile }) {
825 return (
826 <img
827 src={"/file" + file.path}
828 alt={file.basename}
829 style="max-width:100%;max-height:100%;object-fit:contain;margin:auto;display:block;"
830 />
831 );
832}
833
834function IframeView({ file }: { file: MediaFile }) {
835 return (
836 <>
837 <iframe
838 style="flex:1;height:100%;border:none"
839 src={"/file" + file.path + "?view=embed"}
840 />
841 </>
842 );
843}
844
845const helptexts: Record<string, any> = {
846 ".blend": (
847 <p>
848 <code>.blend</code> files can be open in{" "}
849 <a href="https://www.blender.org" target="_blank">
850 Blender
851 </a>
852 .
853 </p>
854 ),
855 ".comp": <FusionHelp ext="comp" name="composition files (project/scene)" />,
856 ".setting": <FusionHelp ext="setting" name="macro/template" />,
857 ".fuse": <FusionHelp ext="setting" name="FUSE Plugin (lua source code)" />,
858};
859
860function FusionHelp({ ext, name }: { ext: string; name: string }) {
861 return (
862 <>
863 <p>
864 <code>.{ext}</code> files are{" "}
865 <a
866 href="https://www.blackmagicdesign.com/products/fusion"
867 target="_blank"
868 >
869 Fusion
870 </a>{" "}
871 {name}.
872 </p>
873 <p>
874 Blackmagic Fusion is paid-only since mid-2019 (the "Studio" version).
875 The last free version is Fusion 9.0.2, which exists for MacOS, Linux,
876 and Microsoft Windows on{" "}
877 <a href="https://www.blackmagicdesign.com/support" target="_blank">
878 Blackmagic Design's support page
879 </a>
880 .
881 </p>
882 <p>
883 Alternatively, you can use DaVinci Resolve, however I do not recommend
884 it as it is very unstable, at least as of when I last tried version 18.
885 </p>
886 </>
887 );
888}
889function DownloadView({ file }: { file: MediaFile }) {
890 const help = helptexts[path.extname(file.basename)];
891 return help
892 ? (
893 <>
894 {help}
895 <p>
896 File download:{" "}
897 <a href={"/file" + file.path + "?dl"} aria-label="download">
898 {file.basename}
899 </a>
900 .
901 </p>
902 </>
903 )
904 : (
905 <>
906 <p>
907 No built-in viewer for <code>{path.extname(file.basename)}</code>{" "}
908 files.
909 </p>
910 <p>
911 Instead, you may download it:{" "}
912 <a href={"/file" + file.path + "?dl"} aria-label="download">
913 {file.basename}
914 </a>
915 .
916 </p>
917 </>
918 );
919}
920
921function DownloadViewTooBig({ file }: { file: MediaFile }) {
922 return (
923 <div style="padding:0.5rem">
924 <p>
925 This file is too large to view in the browser right now (
926 <code>{formatSize(file.size)}</code>). Later, this file viewer will
927 properly process video files for web streaming.
928 </p>
929 <p>
930 Instead, you may download it:{" "}
931 <a href={"/file" + file.path + "?dl"} aria-label="download">
932 {file.basename}
933 </a>
934 .
935 </p>
936 </div>
937 );
938}
939
940function DownloadViewCodeNotComputed({ file }: { file: MediaFile }) {
941 return (
942 <div style="padding:0.5rem">
943 <p>
944 This file has not been pre-processed for code highlighting. This either
945 means it is not a valid UTF-8 text file (<code>.ts</code>{" "}
946 can be TypeScript or an MPEG "Transport Stream"), or there is a bug in
947 the file indexing logic.
948 </p>
949 <p>
950 Instead, you may download it:{" "}
951 <a href={"/file" + file.path + "?dl"} aria-label="download">
952 {file.basename}
953 </a>
954 .
955 </p>
956 </div>
957 );
958}
959
960function ReadmeView({
961 file,
962 siblingFiles,
963 extra,
964}: {
965 file: MediaFile;
966 siblingFiles: MediaFile[];
967 extra?: any;
968}) {
969 // let showFileCandidates = siblingFiles.filter(f =>
970 // f.kind === MediaFile.Kind.file
971 // && (extensionToViewer[path.extname(f.basename)] === AudioView
972 // || extensionToViewer[path.extname(f.basename)] === VideoView)
973 // );
974 return (
975 <div class="content readme" data-testid={TestID.Readme}>
976 {/* {showFileCandidates.length === 1 && <AudioView file={showFileCandidates[0]} onlyAudio />} */}
977 <TextView file={file} siblingFiles={siblingFiles} />
978 {extra}
979 </div>
980 );
981}
982
983const gcd = (a: number, b: number): number => (b ? gcd(b, a % b) : a);
984function simplifyFraction(n: number, d: number) {
985 const divisor = gcd(n, d);
986 return `${n / divisor}/${d / divisor}`;
987}
988
989export function contentTypeFromExt(src: string) {
990 src = src.toLowerCase();
991 if (src.endsWith(".m3u8")) return "application/x-mpegURL";
992 if (src.endsWith(".webm")) return "video/webm";
993 if (src.endsWith(".mp4")) return "video/mp4";
994 if (src.endsWith(".mkv")) return "video/x-matroska";
995 if (src.endsWith(".avi")) return "video/x-msvideo";
996 if (src.endsWith(".mov")) return "video/quicktime";
997 if (src.endsWith(".ogg")) return "video/ogg";
998 throw new Error("Unknown video extension: " + path.extname(src));
999}
1000
1001// Add class properties to the components
1002AudioView.class = "audio";
1003ImageView.class = "image";
1004VideoView.class = "video";
1005TextView.class = "text";
1006DownloadView.class = "download";
1007CodeView.class = "code";
src/pages/subscribe.client.ts deleted
Binary files a/src/pages/subscribe.client.ts and /dev/null differ
src/pages/subscribe.css deleted-8
......@@ -1,8 +0,0 @@
1// default
2class ConfigError extends Error {
3 constructor(message, filename) {
4 super(message);
5 (0, _rewriteStackTrace.expectedError)(this);
6 if (filename) (0, _rewriteStackTrace.injectVirtualStackFrame)(this, filename);
7 }
8}
src/pages/subscribe.marko deleted
Binary files a/src/pages/subscribe.marko and /dev/null differ
src/q+a/artifacts.ts deleted
Binary files a/src/q+a/artifacts.ts and /dev/null differ
src/q+a/components/clickable-links.client.ts+54-123
......@@ -1,126 +1,57 @@
1// __esModule
2true
3
4// importDefault
5function importDefault(file, request, nameHint) {
6 const imports = getImports(file);
7 request = resolveRelativePath(file, request);
8 let importDeclaration = imports.get(request);
9
10 if (!importDeclaration) {
11 imports.set(
12 request,
13 importDeclaration = file.path.pushContainer(
14 "body",
15 _compiler.types.importDeclaration([], _compiler.types.stringLiteral(request))
16 )[0]
17 );
18 }
19
20 if (!nameHint) {
21 return;
22 }
23
24 const specifiers = importDeclaration.get("specifiers");
25 const specifier = specifiers.find((specifier) =>
26 specifier.isImportDefaultSpecifier()
27 );
28
29 if (!specifier) {
30 const identifier = file.scope.generateUidIdentifier(nameHint);
31 importDeclaration.pushContainer(
32 "specifiers",
33 _compiler.types.importDefaultSpecifier(identifier)
34 );
35 return identifier;
36 }
37
38 return _compiler.types.identifier(specifier.node.local.name);
1async function qaDate(el: HTMLAnchorElement) {
2 if (el.hasAttribute("data-copy-state")) return;
3 const time = el.children[0] as HTMLTimeElement;
4 const prevText = time.textContent;
5 const url = `${window.location.origin}/q+a/${
6 time.dateTime.replace(/[^\d]/g, "").slice(2, 12)
7 }`;
8 el.setAttribute("data-copy-state", "1");
9 try {
10 await navigator.clipboard.writeText(url);
11 time.textContent = "copied permalink to question";
12 time.classList.add("winner");
13 } catch (error) {
14 time.textContent = "failed to copy :(";
15 }
16 setTimeout(() => {
17 el.removeAttribute("data-copy-state");
18 time.textContent = prevText;
19 time.classList.remove("winner");
20 }, 1500);
3921}
40
41// importNamed
42function importNamed(file, request, name, nameHint = name) {
43 request = resolveRelativePath(file, request);
44 const imports = getImports(file);
45 let importDeclaration = imports.get(request);
46
47 if (!importDeclaration) {
48 imports.set(
49 request,
50 importDeclaration = file.path.pushContainer(
51 "body",
52 _compiler.types.importDeclaration([], _compiler.types.stringLiteral(request))
53 )[0]
54 );
55 }
56
57 const specifiers = importDeclaration.get("specifiers");
58 const specifier = specifiers.find(
59 (specifier) =>
60 specifier.isImportSpecifier() && specifier.node.imported.name === name
22requestAnimationFrame(() => {
23 // Make every link clickable
24 document.querySelectorAll("e-").forEach((questionRoot) =>
25 (questionRoot.querySelector("a:not([href])") as HTMLAnchorElement).href =
26 "#"
6127 );
62
63 if (!specifier) {
64 const identifier = file.scope.generateUidIdentifier(nameHint);
65 importDeclaration.pushContainer(
66 "specifiers",
67 _compiler.types.importSpecifier(identifier, _compiler.types.identifier(name))
68 );
69 return identifier;
70 }
71
72 return _compiler.types.identifier(specifier.node.local.name);
73}
74
75// importStar
76function importStar(file, request, nameHint) {
77 const imports = getImports(file);
78 request = resolveRelativePath(file, request);
79 let importDeclaration = imports.get(request);
80
81 if (!importDeclaration) {
82 imports.set(
83 request,
84 importDeclaration = file.path.pushContainer(
85 "body",
86 _compiler.types.importDeclaration([], _compiler.types.stringLiteral(request))
87 )[0]
88 );
89 }
90
91 if (!nameHint) {
92 return;
93 }
94
95 const specifiers = importDeclaration.get("specifiers");
96 const specifier = specifiers.find((specifier) =>
97 specifier.isImportNamespaceSpecifier()
28 // Avoid attaching 1500+ event listeners
29 document.querySelector("main")!.addEventListener(
30 "click",
31 (event, element = event.target as HTMLAnchorElement) => {
32 if (
33 !(event.button ||
34 event.which != 1 ||
35 event.metaKey ||
36 event.ctrlKey ||
37 event.shiftKey ||
38 event.altKey ||
39 event.defaultPrevented)
40 ) {
41 while (element && element !== document.body) {
42 if (
43 element.nodeName.toUpperCase() === "A" &&
44 element.getAttribute("href") === "#" &&
45 element.parentElement?.tagName === "E-"
46 ) {
47 event.preventDefault();
48 qaDate(element);
49 return;
50 }
51 element =
52 (element.assignedSlot ?? element.parentNode) as HTMLAnchorElement;
53 }
54 }
55 },
9856 );
99
100 if (!specifier) {
101 const identifier = file.scope.generateUidIdentifier(nameHint);
102 importDeclaration.pushContainer(
103 "specifiers",
104 _compiler.types.importNamespaceSpecifier(identifier)
105 );
106 return identifier;
107 }
108
109 return _compiler.types.identifier(specifier.node.local.name);
110}
111
112// resolveRelativePath
113function resolveRelativePath(file, request) {
114 if (request.startsWith(FS_START)) {
115 request = (0, _relativeImportPath.relativeImportPath)(file.opts.filename, request);
116 }
117
118 if (file.markoOpts.optimize) {
119 request = request.replace(
120 /(^|\/node-modules\/)marko\/src\//,
121 "$1marko/dist/"
122 );
123 }
124
125 return request;
126}
57});
src/q+a/edit-frontend.tsx deleted-8
......@@ -1,8 +0,0 @@
1// default
2function prependToMemberExpression(member, prepend) {
3 if ((0, _index2.isSuper)(member.object)) {
4 throw new Error("Cannot prepend node to super property access (`super.foo`).");
5 }
6 member.object = (0, _index.memberExpression)(prepend, member.object);
7 return member;
8}
src/q+a/format.ts deleted
Binary files a/src/q+a/format.ts and /dev/null differ
src/q+a/question-image.tsx deleted
Binary files a/src/q+a/question-image.tsx and /dev/null differ
tsconfig.json+12-34
......@@ -1,35 +1,13 @@
1// default
2function getFunctionName(node, parent) {
3 if ("id" in node && node.id) {
4 return {
5 name: node.id.name,
6 originalNode: node.id
7 };
8 }
9 let prefix = "";
10 let id;
11 if ((0, _index.isObjectProperty)(parent, {
12 value: node
13 })) {
14 id = getObjectMemberKey(parent);
15 } else if ((0, _index.isObjectMethod)(node) || (0, _index.isClassMethod)(node)) {
16 id = getObjectMemberKey(node);
17 if (node.kind === "get") prefix = "get ";else if (node.kind === "set") prefix = "set ";
18 } else if ((0, _index.isVariableDeclarator)(parent, {
19 init: node
20 })) {
21 id = parent.id;
22 } else if ((0, _index.isAssignmentExpression)(parent, {
23 operator: "=",
24 right: node
25 })) {
26 id = parent.left;
27 }
28 if (!id) return null;
29 const name = (0, _index.isLiteral)(id) ? getNameFromLiteralId(id) : (0, _index.isIdentifier)(id) ? id.name : (0, _index.isPrivateName)(id) ? id.id.name : null;
30 if (name == null) return null;
31 return {
32 name: prefix + name,
33 originalNode: id
34 };
1{
2 "allowImportingTSExtensions": true,
3 "baseDir": ".",
4 "incremental": true,
5 "lib": ["dom", "esnext"],
6 "moduleResolution": "node18",
7 "outdir": ".clover/ts",
8 "paths": { "@/*": ["src/*"] },
9 "strict": true,
10 "target": "es2022",
11 "jsxImportSource": "#ssr",
12 "jsx": "react-jsx",
3513}