diff --git a/framework/fs.ts b/framework/fs.ts index 251e7cc..b6d2d61 100644 --- a/framework/fs.ts +++ b/framework/fs.ts @@ -1,10 +1,25 @@ -// default -function isScope(node, parent) { - if ((0, _index.isBlockStatement)(node) && ((0, _index.isFunction)(parent) || (0, _index.isCatchClause)(parent))) { - return false; - } - if ((0, _index.isPattern)(node) && ((0, _index.isFunction)(parent) || (0, _index.isCatchClause)(parent))) { - return true; - } - return (0, _index.isScopable)(node); +// File System APIs +import { readFileSync, writeFileSync, readdirSync, statSync, existsSync, mkdirSync as nodeMkdirSync, rmSync } from 'node:fs'; +import { readFile, writeFile, readdir, stat, mkdir as nodeMkdir, rm } from 'node:fs/promises'; + +// Re-export a mix of built-in Node.js sync+promise fs methods. +export { + readFileSync, writeFileSync, readdirSync, statSync, existsSync, rmSync , + readFile, writeFile, readdir, stat, mkdir, rm } + +export function mkdir(dir: string) { + return nodeMkdir(dir, { recursive: true }); +} + +export function mkdirSync(dir: string) { + return nodeMkdirSync(dir, { recursive: true }); +} + +export async function writeMkdir(file: string, contents: Buffer | string) { + await mkdir(path.dirname(file)); + return writeFile(file, contents); +} + +import * as path from 'node:path'; + diff --git a/framework/mime.txt b/framework/mime.txt deleted file mode 100644 index cb6b705..0000000 --- a/framework/mime.txt +++ /dev/null @@ -1,8 +0,0 @@ -.css text/css -.html text/html; charset=utf8 -.jpeg image/jpeg -.jpg image/jpeg -.js text/javascript -.json application/json -.png image/png -.txt text/plain diff --git a/framework/sitegen.tsx b/framework/sitegen.tsx index 930fbf5..3df1caf 100644 --- a/framework/sitegen.tsx +++ b/framework/sitegen.tsx @@ -1,11 +1,222 @@ -// default -class Hub { - getCode() {} - getScope() {} - addHelper() { - throw new Error("Helpers are not supported by the default hub."); - } - buildError(node, msg, Error = TypeError) { - return new Error(msg); - } +// Sitegen! Clover's static site generator, built with love. + +function main() { + return withSpinner({ + text: "Recovering State", + successText: ({ elapsed }) => + "sitegen! update in " + elapsed.toFixed(1) + "s", + failureText: () => "sitegen FAIL", + }, sitegen); } + +async function sitegen(status) { + const startTime = performance.now(); + + let root = path.resolve(import_meta.dirname, "../src"); + const join = (...sub) => path.join(root, ...sub); + const incr = new Incremental(); + const sections: Section[] = + require(path.join(root, "sections.ts")).siteSections; + const views = []; + const staticFiles = []; + let pages = []; + let scripts = []; + const backendFiles = []; + + status.text = "Scanning Project"; + for (const section of sections) { + const { root: sectionRoot } = section; + const sectionPath = (...sub) => path.join(sectionRoot, ...sub); + const rootPrefix = root === sectionRoot + ? "" + : path.relative(root, sectionRoot) + "/"; + const kinds = [ + { + dir: sectionPath("pages"), + list: pages, + prefix: "/", + exclude: [".css", ".client.ts", ".client.tsx"], + }, + { dir: sectionPath("static"), list: staticFiles, prefix: "/", ext: true }, + { dir: sectionPath("scripts"), list: scripts, prefix: rootPrefix }, + { dir: sectionPath("views"), list: views, prefix: rootPrefix }, + ]; + for (const { dir, list, prefix, exclude = [], ext = false } of kinds) { + const pages2 = fs.readDirRecOptional(dir); + page: for (const page of pages2) { + if (page.isDirectory()) continue; + for (const ext2 of exclude) { + if (page.name.endsWith(ext2)) continue page; + } + const file = path.relative(dir, page.parentPath + "/" + page.name); + const trim = ext + ? file + : file.slice(0, -path.extname(file).length).replaceAll(".", "/"); + let id = prefix + trim.replaceAll("\\", "/"); + if (prefix === "/" && id.endsWith("/index")) { + id = id.slice(0, -"/index".length) || "/"; + } + list.push({ id, file: path.join(page.parentPath, page.name) }); + } + } + let backendFile = [ + sectionPath("backend.ts"), + sectionPath("backend.tsx"), + ].find((file) => fs.existsSync(file)); + if (backendFile) backendFiles.push(backendFile); + } + scripts = scripts.filter(({ file }) => !file.match(/\.client\.[tj]sx?/)); + const globalCssPath = join("global.css"); + status.text = "Building"; + const cssOnce = new OnceMap(); + const cssQueue = new Queue({ + name: "Bundle", + fn: ([, files, theme]) => css.bundleCssFiles(files, theme), + passive: true, + getItemText: ([id]) => id, + maxJobs: 2, + }); + const ssrResults = []; + function loadSsrModule(page) { + require(page.file); + } + async function doSsrPage(page) { + const module2 = require(page.file); + const Page = module2.default; + if (!Page) { + throw new Error("Page is missing a 'default' export."); + } + const metadata = module2.meta; + if (!metadata) { + throw new Error("Page is missing 'meta' attribute with a title."); + } + const theme = { + bg: "#fff", + fg: "#050505", + primary: "#2e7dab", + ...module2.theme, + }; + const renderedMetaPromise = Promise.resolve( + typeof metadata === "function" ? metadata({ ssr: true }) : metadata, + ).then((m) => meta.resolveAndRenderMetadata(m)); + const cssImports = [globalCssPath, ...hot.getCssImports(page.file)]; + const cssPromise = cssOnce.get( + cssImports.join(":") + JSON.stringify(theme), + () => cssQueue.add([page.id, cssImports, theme]), + ); + const sitegenApi = sg.initRender(); + const body = await (0, import_ssr.ssrAsync)( + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Page, {}), + { + sitegen: sitegenApi, + }, + ); + const inlineCss = await cssPromise; + const renderedMeta = await renderedMetaPromise; + if (!renderedMeta.includes("")) { + throw new Error( + "Page is missing 'meta.title'. All pages need a title tag.", + ); + } + ssrResults.push({ + body, + head: renderedMeta, + inlineCss, + scriptFiles: Array.from(sitegenApi.scripts), + page, + }); + } + const spinnerFormat = status.format; + status.format = () => ""; + const moduleLoadQueue = new import_queue.Queue({ + name: "Load Render Module", + fn: loadSSRModule, + getItemText, + maxJobs: 1, + }); + moduleLoadQueue.addMany(pages); + await moduleLoadQueue.done({ method: "stop" }); + const pageQueue = new import_queue.Queue({ + name: "Render", + fn: doSsrPage, + getItemText, + maxJobs: 2, + }); + pageQueue.addMany(pages); + await pageQueue.done({ method: "stop" }); + status.format = spinnerFormat; + const referencedScripts = Array.from( + new Set(ssrResults.flatMap((r) => r.scriptFiles)), + ); + const extraPublicScripts = scripts.map((entry) => entry.file); + const uniqueCount = new Set([ + ...referencedScripts, + ...extraPublicScripts, + ]).size; + status.text = `Bundle ${uniqueCount} Scripts`; + await bundle.bundleClientJavaScript( + referencedScripts, + extraPublicScripts, + incr, + ); + async function doStaticFile(page) { + const body = await fs.readFile(page.file); + incr.putAsset({ + srcId: "static:" + page.file, + key: page.id, + body, + }); + } + const staticQueue = new import_queue.Queue({ + name: "Load Static", + fn: doStaticFile, + getItemText, + maxJobs: 16, + }); + status.format = () => ""; + staticQueue.addMany(staticFiles); + await staticQueue.done({ method: "stop" }); + status.format = spinnerFormat; + status.text = `Concat ${ssrResults.length} Pages`; + await Promise.all( + ssrResults.map(async ({ page, body, head, inlineCss, scriptFiles }) => { + const doc = wrapDocument({ + body, + head, + inlineCss, + scripts: scriptFiles.map( + (id) => + UNWRAP( + incr.out.script.get( + path.basename(id).replace(/\.client\.[jt]sx?$/, ""), + ), + ), + ).map((x) => `{${x}}`).join(""), + }); + incr.putAsset({ + srcId: "page:" + page.file, + key: page.id, + body: doc, + headers: { + "Content-Type": "text/html", + }, + }); + }), + ); + status.format = () => ""; + status.text = ``; + await incr.wait(); + status.format = spinnerFormat; + status.text = `Incremental Flush`; + incr.flush(); + incr.serializeToDisk(); + return { elapsed: (performance.now() - startTime) / 1e3 }; +} + +import type { Section } from "./sitegen-lib.ts"; +import { OnceMap, Queue } from "./queue.ts"; +import { Incremental } from "./incremental.ts"; +import * as bundle from "./bundle.ts"; +import * as css from "./css.ts"; +import * as fs from './fs.ts'; +import { withSpinner, Spinner } from "@paperclover/console/Spinner"; diff --git a/package-lock.json b/package-lock.json index 8cd590c..083d863 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,81 +1,3105 @@ -// DEFAULT_OPTIONS -[object Object] - -// strip -function strip(jsonString, options = DEFAULT_OPTIONS) { - if (typeof jsonString !== "string") { - throw new TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof jsonString}\``); - } - const { trailingCommas = false, whitespace = true } = options; - const _strip = whitespace ? stripWithWhitespace : stripWithoutWhitespace; - let isInsideString = false; - let isInsideComment = false; - let offset = 0; - let buffer = ""; - let result = ""; - let commaIndex = -1; - for (let i = 0; i < jsonString.length; i++) { - const currentCharacter = jsonString[i]; - const nextCharacter = jsonString[i + 1]; - if (!currentCharacter) { - continue; - } - if (!isInsideComment && currentCharacter === '"') { - const escaped = isEscaped(jsonString, i); - if (!escaped) { - isInsideString = !isInsideString; +{ + "name": "paperclover.net", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "@hono/node-server": "^1.14.3", + "@mdx-js/mdx": "^3.1.0", + "@paperclover/console": "git+https://git.paperclover.net/clo/console.git", + "esbuild": "^0.25.5", + "hls.js": "^1.6.5", + "hono": "^4.7.11", + "marko": "^6.0.20" + }, + "devDependencies": { + "@types/node": "^22.15.29", + "typescript": "^5.8.3" } - } - if (isInsideString) { - continue; - } - if (!isInsideComment && currentCharacter + nextCharacter === "//") { - buffer += jsonString.slice(offset, i); - offset = i; - isInsideComment = singleComment; - i++; - } else if (isInsideComment === singleComment && currentCharacter + nextCharacter === "\r\n") { - i++; - isInsideComment = false; - buffer += _strip(jsonString, offset, i); - offset = i; - continue; - } else if (isInsideComment === singleComment && currentCharacter === "\n") { - isInsideComment = false; - buffer += _strip(jsonString, offset, i); - offset = i; - } else if (!isInsideComment && currentCharacter + nextCharacter === "/*") { - buffer += jsonString.slice(offset, i); - offset = i; - isInsideComment = multiComment; - i++; - continue; - } else if (isInsideComment === multiComment && currentCharacter + nextCharacter === "*/") { - i++; - isInsideComment = false; - buffer += _strip(jsonString, offset, i + 1); - offset = i + 1; - continue; - } else if (trailingCommas && !isInsideComment) { - if (commaIndex !== -1) { - if (currentCharacter === "}" || currentCharacter === "]") { - buffer += jsonString.slice(offset, i); - result += _strip(buffer, 0, 1) + buffer.slice(1); - buffer = ""; - offset = i; - commaIndex = -1; - } else if (currentCharacter !== " " && currentCharacter !== " " && currentCharacter !== "\r" && currentCharacter !== "\n") { - buffer += jsonString.slice(offset, i); - offset = i; - commaIndex = -1; + }, + "node_modules/@ampproject/remapping": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", + "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", + "license": "Apache-2.0", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz", + "integrity": "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==", + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.27.1", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.27.5", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.27.5.tgz", + "integrity": "sha512-KiRAp/VoJaWkkte84TvUd9qjdbZAdiqyvMxrGl1N6vzFogKmaLgoM3L1kgtLicp2HP5fBJS8JrZKLVIZGVJAVg==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.27.4", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.27.4.tgz", + "integrity": "sha512-bXYxrXFubeYdvB0NhD/NBB3Qi6aZeV20GOWVI47t2dkecCEoneR4NPVcb7abpXDEvejgrUfFtG6vG/zxAKmg+g==", + "license": "MIT", + "dependencies": { + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.27.1", + "@babel/generator": "^7.27.3", + "@babel/helper-compilation-targets": "^7.27.2", + "@babel/helper-module-transforms": "^7.27.3", + "@babel/helpers": "^7.27.4", + "@babel/parser": "^7.27.4", + "@babel/template": "^7.27.2", + "@babel/traverse": "^7.27.4", + "@babel/types": "^7.27.3", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/generator": { + "version": "7.27.5", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.27.5.tgz", + "integrity": "sha512-ZGhA37l0e/g2s1Cnzdix0O3aLYm66eF8aufiVteOgnwxgnRP8GoyMj7VWsgWnQbVKXyge7hqrFh2K2TQM6t1Hw==", + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.27.5", + "@babel/types": "^7.27.3", + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25", + "jsesc": "^3.0.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-annotate-as-pure": { + "version": "7.27.3", + "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.27.3.tgz", + "integrity": "sha512-fXSwMQqitTGeHLBC08Eq5yXz2m37E4pJX1qAU1+2cNedz/ifv/bVXft90VeSav5nFO61EcNgwr0aJxbyPaWBPg==", + "license": "MIT", + "dependencies": { + "@babel/types": "^7.27.3" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.27.2", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.27.2.tgz", + "integrity": "sha512-2+1thGUUWWjLTYTHZWK1n8Yga0ijBz1XAhUXcKy81rd5g6yh7hGqMp45v7cadSbEHc9G3OTv45SyneRN3ps4DQ==", + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.27.2", + "@babel/helper-validator-option": "^7.27.1", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-create-class-features-plugin": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.27.1.tgz", + "integrity": "sha512-QwGAmuvM17btKU5VqXfb+Giw4JcN0hjuufz3DYnpeVDvZLAObloM77bhMXiqry3Iio+Ai4phVRDwl6WU10+r5A==", + "license": "MIT", + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.27.1", + "@babel/helper-member-expression-to-functions": "^7.27.1", + "@babel/helper-optimise-call-expression": "^7.27.1", + "@babel/helper-replace-supers": "^7.27.1", + "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1", + "@babel/traverse": "^7.27.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-member-expression-to-functions": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.27.1.tgz", + "integrity": "sha512-E5chM8eWjTp/aNoVpcbfM7mLxu9XGLWYise2eBKGQomAk/Mb4XoxyqXTZbuTohbsl8EKqdlMhnDI2CCLfcs9wA==", + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.27.1", + "@babel/types": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.27.1.tgz", + "integrity": "sha512-0gSFWUPNXNopqtIPQvlD5WgXYI5GY2kP2cCvoT8kczjbfcfuIljTbcWrulD1CIPIX2gt1wghbDy08yE1p+/r3w==", + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.27.1", + "@babel/types": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.27.3", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.27.3.tgz", + "integrity": "sha512-dSOvYwvyLsWBeIRyOeHXp5vPj5l1I011r52FM1+r1jCERv+aFXYk4whgQccYEGYxK2H3ZAIA8nuPkQ0HaUo3qg==", + "license": "MIT", + "dependencies": { + "@babel/helper-module-imports": "^7.27.1", + "@babel/helper-validator-identifier": "^7.27.1", + "@babel/traverse": "^7.27.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-optimise-call-expression": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.27.1.tgz", + "integrity": "sha512-URMGH08NzYFhubNSGJrpUEphGKQwMQYBySzat5cAByY1/YgIRkULnIy3tAMeszlL/so2HbeilYloUmSpd7GdVw==", + "license": "MIT", + "dependencies": { + "@babel/types": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.27.1.tgz", + "integrity": "sha512-1gn1Up5YXka3YYAHGKpbideQ5Yjf1tDa9qYcgysz+cNCXukyLl6DjPXhD3VRwSb8c0J9tA4b2+rHEZtc6R0tlw==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-replace-supers": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.27.1.tgz", + "integrity": "sha512-7EHz6qDZc8RYS5ElPoShMheWvEgERonFCs7IAonWLLUTXW59DP14bCZt89/GKyreYn8g3S83m21FelHKbeDCKA==", + "license": "MIT", + "dependencies": { + "@babel/helper-member-expression-to-functions": "^7.27.1", + "@babel/helper-optimise-call-expression": "^7.27.1", + "@babel/traverse": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-skip-transparent-expression-wrappers": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.27.1.tgz", + "integrity": "sha512-Tub4ZKEXqbPjXgWLl2+3JpQAYBJ8+ikpQ2Ocj/q/r0LwE3UhENh7EUabyHjz2kCEsrRY83ew2DQdHluuiDQFzg==", + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.27.1", + "@babel/types": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", + "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz", + "integrity": "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz", + "integrity": "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.27.6", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.27.6.tgz", + "integrity": "sha512-muE8Tt8M22638HU31A3CgfSUciwz1fhATfoVai05aPXGor//CdWDCbnlY1yvBPo07njuVOCNGCSp/GTt12lIug==", + "license": "MIT", + "dependencies": { + "@babel/template": "^7.27.2", + "@babel/types": "^7.27.6" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.27.5", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.27.5.tgz", + "integrity": "sha512-OsQd175SxWkGlzbny8J3K8TnnDD0N3lrIUtB92xwyRpzaenGZhxDvxN/JgU00U3CDZNj9tPuDJ5H0WS4Nt3vKg==", + "license": "MIT", + "dependencies": { + "@babel/types": "^7.27.3" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/plugin-syntax-typescript": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.27.1.tgz", + "integrity": "sha512-xfYCBMxveHrRMnAWl1ZlPXOZjzkN82THFvLhQhFXFt81Z5HnN+EtUkZhv/zcKpmT3fzmWZB0ywiBrbC3vogbwQ==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-modules-commonjs": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.27.1.tgz", + "integrity": "sha512-OJguuwlTYlN0gBZFRPqwOGNWssZjfIUdS7HMYtN8c1KmwpwHFBwTeFZrg9XZa+DFTitWOW5iTAG7tyCUPsCCyw==", + "license": "MIT", + "dependencies": { + "@babel/helper-module-transforms": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-typescript": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.27.1.tgz", + "integrity": "sha512-Q5sT5+O4QUebHdbwKedFBEwRLb02zJ7r4A5Gg2hUoLuU3FjdMcyqcywqUrLCaDsFCxzokf7u9kuy7qz51YUuAg==", + "license": "MIT", + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.27.1", + "@babel/helper-create-class-features-plugin": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1", + "@babel/plugin-syntax-typescript": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/runtime": { + "version": "7.27.6", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.27.6.tgz", + "integrity": "sha512-vbavdySgbTTrmFE+EsiqUTzlOr5bzlnJtUv9PynGCAKvfQqjIXbvFdumPM/GxMDfyuGMJaJAU6TO4zc1Jf1i8Q==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/template": { + "version": "7.27.2", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.27.2.tgz", + "integrity": "sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw==", + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.27.1", + "@babel/parser": "^7.27.2", + "@babel/types": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.27.4", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.27.4.tgz", + "integrity": "sha512-oNcu2QbHqts9BtOWJosOVJapWjBDSxGCpFvikNR5TGDYDQf3JwpIoMzIKrvfoti93cLfPJEG4tH9SPVeyCGgdA==", + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.27.1", + "@babel/generator": "^7.27.3", + "@babel/parser": "^7.27.4", + "@babel/template": "^7.27.2", + "@babel/types": "^7.27.3", + "debug": "^4.3.1", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.27.6", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.27.6.tgz", + "integrity": "sha512-ETyHEk2VHHvl9b9jZP5IHPavHYk57EhanlRRuae9XCpb/j5bDCbPPMOBfCWhnl/7EDJz0jEMCi/RhccCE8r1+Q==", + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.27.1", + "@babel/helper-validator-identifier": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.5.tgz", + "integrity": "sha512-9o3TMmpmftaCMepOdA5k/yDw8SfInyzWWTjYTFCX3kPSDJMROQTb8jg+h9Cnwnmm1vOzvxN7gIfB5V2ewpjtGA==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.5.tgz", + "integrity": "sha512-AdJKSPeEHgi7/ZhuIPtcQKr5RQdo6OO2IL87JkianiMYMPbCtot9fxPbrMiBADOWWm3T2si9stAiVsGbTQFkbA==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.5.tgz", + "integrity": "sha512-VGzGhj4lJO+TVGV1v8ntCZWJktV7SGCs3Pn1GRWI1SBFtRALoomm8k5E9Pmwg3HOAal2VDc2F9+PM/rEY6oIDg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.5.tgz", + "integrity": "sha512-D2GyJT1kjvO//drbRT3Hib9XPwQeWd9vZoBJn+bu/lVsOZ13cqNdDeqIF/xQ5/VmWvMduP6AmXvylO/PIc2isw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.5.tgz", + "integrity": "sha512-GtaBgammVvdF7aPIgH2jxMDdivezgFu6iKpmT+48+F8Hhg5J/sfnDieg0aeG/jfSvkYQU2/pceFPDKlqZzwnfQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.5.tgz", + "integrity": "sha512-1iT4FVL0dJ76/q1wd7XDsXrSW+oLoquptvh4CLR4kITDtqi2e/xwXwdCVH8hVHU43wgJdsq7Gxuzcs6Iq/7bxQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.5.tgz", + "integrity": "sha512-nk4tGP3JThz4La38Uy/gzyXtpkPW8zSAmoUhK9xKKXdBCzKODMc2adkB2+8om9BDYugz+uGV7sLmpTYzvmz6Sw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.5.tgz", + "integrity": "sha512-PrikaNjiXdR2laW6OIjlbeuCPrPaAl0IwPIaRv+SMV8CiM8i2LqVUHFC1+8eORgWyY7yhQY+2U2fA55mBzReaw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.5.tgz", + "integrity": "sha512-cPzojwW2okgh7ZlRpcBEtsX7WBuqbLrNXqLU89GxWbNt6uIg78ET82qifUy3W6OVww6ZWobWub5oqZOVtwolfw==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.5.tgz", + "integrity": "sha512-Z9kfb1v6ZlGbWj8EJk9T6czVEjjq2ntSYLY2cw6pAZl4oKtfgQuS4HOq41M/BcoLPzrUbNd+R4BXFyH//nHxVg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.5.tgz", + "integrity": "sha512-sQ7l00M8bSv36GLV95BVAdhJ2QsIbCuCjh/uYrWiMQSUuV+LpXwIqhgJDcvMTj+VsQmqAHL2yYaasENvJ7CDKA==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.5.tgz", + "integrity": "sha512-0ur7ae16hDUC4OL5iEnDb0tZHDxYmuQyhKhsPBV8f99f6Z9KQM02g33f93rNH5A30agMS46u2HP6qTdEt6Q1kg==", + "cpu": [ + "loong64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.5.tgz", + "integrity": "sha512-kB/66P1OsHO5zLz0i6X0RxlQ+3cu0mkxS3TKFvkb5lin6uwZ/ttOkP3Z8lfR9mJOBk14ZwZ9182SIIWFGNmqmg==", + "cpu": [ + "mips64el" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.5.tgz", + "integrity": "sha512-UZCmJ7r9X2fe2D6jBmkLBMQetXPXIsZjQJCjgwpVDz+YMcS6oFR27alkgGv3Oqkv07bxdvw7fyB71/olceJhkQ==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.5.tgz", + "integrity": "sha512-kTxwu4mLyeOlsVIFPfQo+fQJAV9mh24xL+y+Bm6ej067sYANjyEw1dNHmvoqxJUCMnkBdKpvOn0Ahql6+4VyeA==", + "cpu": [ + "riscv64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.5.tgz", + "integrity": "sha512-K2dSKTKfmdh78uJ3NcWFiqyRrimfdinS5ErLSn3vluHNeHVnBAFWC8a4X5N+7FgVE1EjXS1QDZbpqZBjfrqMTQ==", + "cpu": [ + "s390x" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.5.tgz", + "integrity": "sha512-uhj8N2obKTE6pSZ+aMUbqq+1nXxNjZIIjCjGLfsWvVpy7gKCOL6rsY1MhRh9zLtUtAI7vpgLMK6DxjO8Qm9lJw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.5.tgz", + "integrity": "sha512-pwHtMP9viAy1oHPvgxtOv+OkduK5ugofNTVDilIzBLpoWAM16r7b/mxBvfpuQDpRQFMfuVr5aLcn4yveGvBZvw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.5.tgz", + "integrity": "sha512-WOb5fKrvVTRMfWFNCroYWWklbnXH0Q5rZppjq0vQIdlsQKuw6mdSihwSo4RV/YdQ5UCKKvBy7/0ZZYLBZKIbwQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.5.tgz", + "integrity": "sha512-7A208+uQKgTxHd0G0uqZO8UjK2R0DDb4fDmERtARjSHWxqMTye4Erz4zZafx7Di9Cv+lNHYuncAkiGFySoD+Mw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.5.tgz", + "integrity": "sha512-G4hE405ErTWraiZ8UiSoesH8DaCsMm0Cay4fsFWOOUcz8b8rC6uCvnagr+gnioEjWn0wC+o1/TAHt+It+MpIMg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.5.tgz", + "integrity": "sha512-l+azKShMy7FxzY0Rj4RCt5VD/q8mG/e+mDivgspo+yL8zW7qEwctQ6YqKX34DTEleFAvCIUviCFX1SDZRSyMQA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.5.tgz", + "integrity": "sha512-O2S7SNZzdcFG7eFKgvwUEZ2VG9D/sn/eIiz8XRZ1Q/DO5a3s76Xv0mdBzVM5j5R639lXQmPmSo0iRpHqUUrsxw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.5.tgz", + "integrity": "sha512-onOJ02pqs9h1iMJ1PQphR+VZv8qBMQ77Klcsqv9CNW2w6yLqoURLcgERAIurY6QE63bbLuqgP9ATqajFLK5AMQ==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.5.tgz", + "integrity": "sha512-TXv6YnJ8ZMVdX+SXWVBo/0p8LTcrUYngpWjvm91TMjjBQii7Oz11Lw5lbDV5Y0TzuhSJHwiH4hEtC1I42mMS0g==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@hono/node-server": { + "version": "1.14.4", + "resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-1.14.4.tgz", + "integrity": "sha512-DnxpshhYewr2q9ZN8ez/M5mmc3sucr8CT1sIgIy1bkeUXut9XWDkqHoFHRhWIQgkYnKpVRxunyhK7WzpJeJ6qQ==", + "license": "MIT", + "engines": { + "node": ">=18.14.1" + }, + "peerDependencies": { + "hono": "^4" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz", + "integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==", + "license": "MIT", + "dependencies": { + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@luxass/strip-json-comments": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@luxass/strip-json-comments/-/strip-json-comments-1.4.0.tgz", + "integrity": "sha512-Zl343to4u/t8jz1q7R/1UY6hLX+344cwPLEXsIYthVwdU5zyjuVBGcpf2E24+QZkwFfRfmnHTcscreQzWn3hiA==", + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/@marko/compiler": { + "version": "5.39.21", + "resolved": "https://registry.npmjs.org/@marko/compiler/-/compiler-5.39.21.tgz", + "integrity": "sha512-wDLJYjINuH4ESSlVGXmUnEQV+VcHXEEbXK7BWRjp3Bg+nLyLapa+hBBrYLRt9/ctyWXgzYscInKQpGAxm/Sgdg==", + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.26.2", + "@babel/core": "^7.26.10", + "@babel/generator": "^7.27.0", + "@babel/parser": "^7.27.0", + "@babel/plugin-syntax-typescript": "^7.25.9", + "@babel/plugin-transform-modules-commonjs": "^7.26.3", + "@babel/plugin-transform-typescript": "^7.27.0", + "@babel/runtime": "^7.27.0", + "@babel/traverse": "^7.27.0", + "@babel/types": "^7.27.0", + "@luxass/strip-json-comments": "^1.4.0", + "complain": "^1.6.1", + "he": "^1.2.0", + "htmljs-parser": "^5.5.4", + "jsesc": "^3.1.0", + "kleur": "^4.1.5", + "lasso-package-root": "^1.0.1", + "raptor-regexp": "^1.0.1", + "raptor-util": "^3.2.0", + "relative-import-path": "^1.0.0", + "resolve-from": "^5.0.0", + "self-closing-tags": "^1.0.1", + "source-map-support": "^0.5.21" + }, + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/@mdx-js/mdx": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@mdx-js/mdx/-/mdx-3.1.0.tgz", + "integrity": "sha512-/QxEhPAvGwbQmy1Px8F899L5Uc2KZ6JtXwlCgJmjSTBedwOZkByYcBG4GceIGPXRDsmfxhHazuS+hlOShRLeDw==", + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/mdx": "^2.0.0", + "collapse-white-space": "^2.0.0", + "devlop": "^1.0.0", + "estree-util-is-identifier-name": "^3.0.0", + "estree-util-scope": "^1.0.0", + "estree-walker": "^3.0.0", + "hast-util-to-jsx-runtime": "^2.0.0", + "markdown-extensions": "^2.0.0", + "recma-build-jsx": "^1.0.0", + "recma-jsx": "^1.0.0", + "recma-stringify": "^1.0.0", + "rehype-recma": "^1.0.0", + "remark-mdx": "^3.0.0", + "remark-parse": "^11.0.0", + "remark-rehype": "^11.0.0", + "source-map": "^0.7.0", + "unified": "^11.0.0", + "unist-util-position-from-estree": "^2.0.0", + "unist-util-stringify-position": "^4.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/@paperclover/console": { + "resolved": "git+https://git.paperclover.net/clo/console.git#29ae0fe6bb948723655b2d875faef75433b78ac0", + "dependencies": { + "ansi-escapes": "^7.0.0", + "chalk": "^5.4.1", + "strip-ansi": "^7.1.0" + } + }, + "node_modules/@types/debug": { + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", + "integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==", + "license": "MIT", + "dependencies": { + "@types/ms": "*" + } + }, + "node_modules/@types/estree": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "license": "MIT" + }, + "node_modules/@types/estree-jsx": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/estree-jsx/-/estree-jsx-1.0.5.tgz", + "integrity": "sha512-52CcUVNFyfb1A2ALocQw/Dd1BQFNmSdkuC3BkZ6iqhdMfQz7JWOFRuJFloOzjk+6WijU56m9oKXFAXc7o3Towg==", + "license": "MIT", + "dependencies": { + "@types/estree": "*" + } + }, + "node_modules/@types/hast": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", + "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", + "license": "MIT", + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/mdast": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz", + "integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==", + "license": "MIT", + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/mdx": { + "version": "2.0.13", + "resolved": "https://registry.npmjs.org/@types/mdx/-/mdx-2.0.13.tgz", + "integrity": "sha512-+OWZQfAYyio6YkJb3HLxDrvnx6SWWDbC0zVPfBRzUk0/nqoDyf6dNxQi3eArPe8rJ473nobTMQ/8Zk+LxJ+Yuw==", + "license": "MIT" + }, + "node_modules/@types/ms": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz", + "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==", + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "22.15.30", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.30.tgz", + "integrity": "sha512-6Q7lr06bEHdlfplU6YRbgG1SFBdlsfNC4/lX+SkhiTs0cpJkOElmWls8PxDFv4yY/xKb8Y6SO0OmSX4wgqTZbA==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/@types/unist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", + "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", + "license": "MIT" + }, + "node_modules/@ungap/structured-clone": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", + "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==", + "license": "ISC" + }, + "node_modules/acorn": { + "version": "8.14.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz", + "integrity": "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==", + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ansi-escapes": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-7.0.0.tgz", + "integrity": "sha512-GdYO7a61mR0fOlAsvC9/rIHf7L96sBc6dEWzeOu+KAea5bZyQRPIpojrVoI4AXGJS/ycu/fBTdLrUkA4ODrvjw==", + "license": "MIT", + "dependencies": { + "environment": "^1.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-regex": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/astring": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/astring/-/astring-1.9.0.tgz", + "integrity": "sha512-LElXdjswlqjWrPpJFg1Fx4wpkOCxj1TDHlSV4PlaRxHGWko024xICaa97ZkMfs6DRKlCguiAI+rbXv5GWwXIkg==", + "license": "MIT", + "bin": { + "astring": "bin/astring" + } + }, + "node_modules/bail": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/bail/-/bail-2.0.2.tgz", + "integrity": "sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/browserslist": { + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.25.0.tgz", + "integrity": "sha512-PJ8gYKeS5e/whHBh8xrwYK+dAvEj7JXtz6uTucnMRB8OiGTsKccFekoRrjajPBHV8oOY+2tI4uxeceSimKwMFA==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" } - } else if (currentCharacter === ",") { - result += buffer + jsonString.slice(offset, i); - buffer = ""; - offset = i; - commaIndex = i; + ], + "license": "MIT", + "dependencies": { + "caniuse-lite": "^1.0.30001718", + "electron-to-chromium": "^1.5.160", + "node-releases": "^2.0.19", + "update-browserslist-db": "^1.1.3" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "license": "MIT" + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001721", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001721.tgz", + "integrity": "sha512-cOuvmUVtKrtEaoKiO0rSc29jcjwMwX5tOHDy4MgVFEWiUXj4uBMJkwI8MDySkgXidpMiHUcviogAvFi4pA2hDQ==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "CC-BY-4.0" + }, + "node_modules/ccount": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", + "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/chalk": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.4.1.tgz", + "integrity": "sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w==", + "license": "MIT", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/character-entities": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz", + "integrity": "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities-html4": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-2.1.0.tgz", + "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities-legacy": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz", + "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-reference-invalid": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-2.0.1.tgz", + "integrity": "sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/collapse-white-space": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/collapse-white-space/-/collapse-white-space-2.1.0.tgz", + "integrity": "sha512-loKTxY1zCOuG4j9f6EPnuyyYkf58RnhhWTvRoZEokgB+WbdXehfjFviyOVYkqzEWz1Q5kRiZdBYS5SwxbQYwzw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/comma-separated-tokens": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz", + "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/complain": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/complain/-/complain-1.6.1.tgz", + "integrity": "sha512-WsiVAbAPcPSwyC5k8g/PLceaW0MXJUw61KqBd9uiyDOSuDIC6Ho/EbyhdFjeV6wq44R2g/b8IFpvV/1ZyXiqUQ==", + "license": "MIT", + "dependencies": { + "error-stack-parser": "^2.0.1" + } + }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "license": "MIT" + }, + "node_modules/csstype": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", + "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", + "license": "MIT" + }, + "node_modules/debug": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz", + "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decode-named-character-reference": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.1.0.tgz", + "integrity": "sha512-Wy+JTSbFThEOXQIR2L6mxJvEs+veIzpmqD7ynWxMXGpnk3smkHQOp6forLdHsKpAMW9iJpaBBIxz285t1n1C3w==", + "license": "MIT", + "dependencies": { + "character-entities": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/devlop": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/devlop/-/devlop-1.1.0.tgz", + "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==", + "license": "MIT", + "dependencies": { + "dequal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/electron-to-chromium": { + "version": "1.5.165", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.165.tgz", + "integrity": "sha512-naiMx1Z6Nb2TxPU6fiFrUrDTjyPMLdTtaOd2oLmG8zVSg2hCWGkhPyxwk+qRmZ1ytwVqUv0u7ZcDA5+ALhaUtw==", + "license": "ISC" + }, + "node_modules/environment": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/environment/-/environment-1.1.0.tgz", + "integrity": "sha512-xUtoPkMggbz0MPyPiIWr1Kp4aeWJjDZ6SMvURhimjdZgsRuDplF5/s9hcgGhyXMhs+6vpnuoiZ2kFiu3FMnS8Q==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/error-stack-parser": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/error-stack-parser/-/error-stack-parser-2.1.4.tgz", + "integrity": "sha512-Sk5V6wVazPhq5MhpO+AUxJn5x7XSXGl1R93Vn7i+zS15KDVxQijejNCrz8340/2bgLBjR9GtEG8ZVKONDjcqGQ==", + "license": "MIT", + "dependencies": { + "stackframe": "^1.3.4" + } + }, + "node_modules/esast-util-from-estree": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/esast-util-from-estree/-/esast-util-from-estree-2.0.0.tgz", + "integrity": "sha512-4CyanoAudUSBAn5K13H4JhsMH6L9ZP7XbLVe/dKybkxMO7eDyLsT8UHl9TRNrU2Gr9nz+FovfSIjuXWJ81uVwQ==", + "license": "MIT", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "devlop": "^1.0.0", + "estree-util-visit": "^2.0.0", + "unist-util-position-from-estree": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/esast-util-from-js": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/esast-util-from-js/-/esast-util-from-js-2.0.1.tgz", + "integrity": "sha512-8Ja+rNJ0Lt56Pcf3TAmpBZjmx8ZcK5Ts4cAzIOjsjevg9oSXJnl6SUQ2EevU8tv3h6ZLWmoKL5H4fgWvdvfETw==", + "license": "MIT", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "acorn": "^8.0.0", + "esast-util-from-estree": "^2.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/esbuild": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.5.tgz", + "integrity": "sha512-P8OtKZRv/5J5hhz0cUAdu/cLuPIKXpQl1R9pZtvmHWQvrAUVd0UNIPT4IB4W3rNOqVO0rlqHmCIbSwxh/c9yUQ==", + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.25.5", + "@esbuild/android-arm": "0.25.5", + "@esbuild/android-arm64": "0.25.5", + "@esbuild/android-x64": "0.25.5", + "@esbuild/darwin-arm64": "0.25.5", + "@esbuild/darwin-x64": "0.25.5", + "@esbuild/freebsd-arm64": "0.25.5", + "@esbuild/freebsd-x64": "0.25.5", + "@esbuild/linux-arm": "0.25.5", + "@esbuild/linux-arm64": "0.25.5", + "@esbuild/linux-ia32": "0.25.5", + "@esbuild/linux-loong64": "0.25.5", + "@esbuild/linux-mips64el": "0.25.5", + "@esbuild/linux-ppc64": "0.25.5", + "@esbuild/linux-riscv64": "0.25.5", + "@esbuild/linux-s390x": "0.25.5", + "@esbuild/linux-x64": "0.25.5", + "@esbuild/netbsd-arm64": "0.25.5", + "@esbuild/netbsd-x64": "0.25.5", + "@esbuild/openbsd-arm64": "0.25.5", + "@esbuild/openbsd-x64": "0.25.5", + "@esbuild/sunos-x64": "0.25.5", + "@esbuild/win32-arm64": "0.25.5", + "@esbuild/win32-ia32": "0.25.5", + "@esbuild/win32-x64": "0.25.5" + } + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/estree-util-attach-comments": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/estree-util-attach-comments/-/estree-util-attach-comments-3.0.0.tgz", + "integrity": "sha512-cKUwm/HUcTDsYh/9FgnuFqpfquUbwIqwKM26BVCGDPVgvaCl/nDCCjUfiLlx6lsEZ3Z4RFxNbOQ60pkaEwFxGw==", + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/estree-util-build-jsx": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/estree-util-build-jsx/-/estree-util-build-jsx-3.0.1.tgz", + "integrity": "sha512-8U5eiL6BTrPxp/CHbs2yMgP8ftMhR5ww1eIKoWRMlqvltHF8fZn5LRDvTKuxD3DUn+shRbLGqXemcP51oFCsGQ==", + "license": "MIT", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "devlop": "^1.0.0", + "estree-util-is-identifier-name": "^3.0.0", + "estree-walker": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/estree-util-is-identifier-name": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/estree-util-is-identifier-name/-/estree-util-is-identifier-name-3.0.0.tgz", + "integrity": "sha512-hFtqIDZTIUZ9BXLb8y4pYGyk6+wekIivNVTcmvk8NoOh+VeRn5y6cEHzbURrWbfp1fIqdVipilzj+lfaadNZmg==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/estree-util-scope": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/estree-util-scope/-/estree-util-scope-1.0.0.tgz", + "integrity": "sha512-2CAASclonf+JFWBNJPndcOpA8EMJwa0Q8LUFJEKqXLW6+qBvbFZuF5gItbQOs/umBUkjviCSDCbBwU2cXbmrhQ==", + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "devlop": "^1.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/estree-util-to-js": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/estree-util-to-js/-/estree-util-to-js-2.0.0.tgz", + "integrity": "sha512-WDF+xj5rRWmD5tj6bIqRi6CkLIXbbNQUcxQHzGysQzvHmdYG2G7p/Tf0J0gpxGgkeMZNTIjT/AoSvC9Xehcgdg==", + "license": "MIT", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "astring": "^1.8.0", + "source-map": "^0.7.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/estree-util-visit": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/estree-util-visit/-/estree-util-visit-2.0.0.tgz", + "integrity": "sha512-m5KgiH85xAhhW8Wta0vShLcUvOsh3LLPI2YVwcbio1l7E09NTLL1EyMZFM1OyWowoH0skScNbhOPl4kcBgzTww==", + "license": "MIT", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" + } + }, + "node_modules/extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "license": "MIT" + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/hast-util-to-estree": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/hast-util-to-estree/-/hast-util-to-estree-3.1.3.tgz", + "integrity": "sha512-48+B/rJWAp0jamNbAAf9M7Uf//UVqAoMmgXhBdxTDJLGKY+LRnZ99qcG+Qjl5HfMpYNzS5v4EAwVEF34LeAj7w==", + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "comma-separated-tokens": "^2.0.0", + "devlop": "^1.0.0", + "estree-util-attach-comments": "^3.0.0", + "estree-util-is-identifier-name": "^3.0.0", + "hast-util-whitespace": "^3.0.0", + "mdast-util-mdx-expression": "^2.0.0", + "mdast-util-mdx-jsx": "^3.0.0", + "mdast-util-mdxjs-esm": "^2.0.0", + "property-information": "^7.0.0", + "space-separated-tokens": "^2.0.0", + "style-to-js": "^1.0.0", + "unist-util-position": "^5.0.0", + "zwitch": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-to-jsx-runtime": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/hast-util-to-jsx-runtime/-/hast-util-to-jsx-runtime-2.3.6.tgz", + "integrity": "sha512-zl6s8LwNyo1P9uw+XJGvZtdFF1GdAkOg8ujOw+4Pyb76874fLps4ueHXDhXWdk6YHQ6OgUtinliG7RsYvCbbBg==", + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/unist": "^3.0.0", + "comma-separated-tokens": "^2.0.0", + "devlop": "^1.0.0", + "estree-util-is-identifier-name": "^3.0.0", + "hast-util-whitespace": "^3.0.0", + "mdast-util-mdx-expression": "^2.0.0", + "mdast-util-mdx-jsx": "^3.0.0", + "mdast-util-mdxjs-esm": "^2.0.0", + "property-information": "^7.0.0", + "space-separated-tokens": "^2.0.0", + "style-to-js": "^1.0.0", + "unist-util-position": "^5.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-whitespace": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz", + "integrity": "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "license": "MIT", + "bin": { + "he": "bin/he" + } + }, + "node_modules/hls.js": { + "version": "1.6.5", + "resolved": "https://registry.npmjs.org/hls.js/-/hls.js-1.6.5.tgz", + "integrity": "sha512-KMn5n7JBK+olC342740hDPHnGWfE8FiHtGMOdJPfUjRdARTWj9OB+8c13fnsf9sk1VtpuU2fKSgUjHvg4rNbzQ==", + "license": "Apache-2.0" + }, + "node_modules/hono": { + "version": "4.7.11", + "resolved": "https://registry.npmjs.org/hono/-/hono-4.7.11.tgz", + "integrity": "sha512-rv0JMwC0KALbbmwJDEnxvQCeJh+xbS3KEWW5PC9cMJ08Ur9xgatI0HmtgYZfOdOSOeYsp5LO2cOhdI8cLEbDEQ==", + "license": "MIT", + "engines": { + "node": ">=16.9.0" + } + }, + "node_modules/htmljs-parser": { + "version": "5.5.4", + "resolved": "https://registry.npmjs.org/htmljs-parser/-/htmljs-parser-5.5.4.tgz", + "integrity": "sha512-qJiir3ViASVhGdNW4kwM4pQWvDtDLtjwaflEQDooiNzbOPIzoaIzmRFWweFl8GomVhJqXqX0jjrhDED3pmAdzg==", + "license": "MIT" + }, + "node_modules/inline-style-parser": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.2.4.tgz", + "integrity": "sha512-0aO8FkhNZlj/ZIbNi7Lxxr12obT7cL1moPfE4tg1LkX7LlLfC6DeX4l2ZEud1ukP9jNQyNnfzQVqwbwmAATY4Q==", + "license": "MIT" + }, + "node_modules/is-alphabetical": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.1.tgz", + "integrity": "sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-alphanumerical": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-2.0.1.tgz", + "integrity": "sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw==", + "license": "MIT", + "dependencies": { + "is-alphabetical": "^2.0.0", + "is-decimal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-decimal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-2.0.1.tgz", + "integrity": "sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-hexadecimal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-2.0.1.tgz", + "integrity": "sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-plain-obj": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", + "integrity": "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "license": "MIT" + }, + "node_modules/jsesc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "license": "MIT", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "license": "MIT", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/kleur": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", + "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/lasso-caching-fs": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/lasso-caching-fs/-/lasso-caching-fs-1.0.2.tgz", + "integrity": "sha512-mudop0s8U3tLm3Fn9lhiZsiELpLeJToEo6RlDLdph7vWRxL9Sz0o+9WUw1IwlpCYXv/P0CLsMYWFgPwIKWEYvg==", + "license": "Apache-2.0", + "dependencies": { + "raptor-async": "^1.1.2" + } + }, + "node_modules/lasso-package-root": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lasso-package-root/-/lasso-package-root-1.0.1.tgz", + "integrity": "sha512-j6LnauNCldqSDvOxoKpD6sTzudPGMiwcZQbySoF9KvJ0lD9Dp2t6QZF8kC0jbUDHuQPiAo5RuQ/mC3AGXscUYA==", + "license": "Apache-2.0", + "dependencies": { + "lasso-caching-fs": "^1.0.0" + } + }, + "node_modules/longest-streak": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-3.1.0.tgz", + "integrity": "sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "license": "ISC", + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/magic-string": { + "version": "0.30.17", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz", + "integrity": "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==", + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0" + } + }, + "node_modules/markdown-extensions": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/markdown-extensions/-/markdown-extensions-2.0.0.tgz", + "integrity": "sha512-o5vL7aDWatOTX8LzaS1WMoaoxIiLRQJuIKKe2wAw6IeULDHaqbiqiggmx+pKvZDb1Sj+pE46Sn1T7lCqfFtg1Q==", + "license": "MIT", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/marko": { + "version": "6.0.21", + "resolved": "https://registry.npmjs.org/marko/-/marko-6.0.21.tgz", + "integrity": "sha512-yBMI1GfqAncP/R24vATKOr/VkAOox49hr6Jqw/HBwYQqU/QMpwYOMMNii09K3mJm0ABcq/oGk/CF81a3AZ3EsQ==", + "license": "MIT", + "dependencies": { + "@marko/compiler": "^5.39.21", + "csstype": "^3.1.3", + "magic-string": "^0.30.17" + }, + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/mdast-util-from-markdown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-2.0.2.tgz", + "integrity": "sha512-uZhTV/8NBuw0WHkPTrCqDOl0zVe1BIng5ZtHoDk49ME1qqcjYmmLmOf0gELgcRMxN4w2iuIeVso5/6QymSrgmA==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "mdast-util-to-string": "^4.0.0", + "micromark": "^4.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-decode-string": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unist-util-stringify-position": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-mdx": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-mdx/-/mdast-util-mdx-3.0.0.tgz", + "integrity": "sha512-JfbYLAW7XnYTTbUsmpu0kdBUVe+yKVJZBItEjwyYJiDJuZ9w4eeaqks4HQO+R7objWgS2ymV60GYpI14Ug554w==", + "license": "MIT", + "dependencies": { + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-mdx-expression": "^2.0.0", + "mdast-util-mdx-jsx": "^3.0.0", + "mdast-util-mdxjs-esm": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-mdx-expression": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-mdx-expression/-/mdast-util-mdx-expression-2.0.1.tgz", + "integrity": "sha512-J6f+9hUp+ldTZqKRSg7Vw5V6MqjATc+3E4gf3CFNcuZNWD8XdyI6zQ8GqH7f8169MM6P7hMBRDVGnn7oHB9kXQ==", + "license": "MIT", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-mdx-jsx": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/mdast-util-mdx-jsx/-/mdast-util-mdx-jsx-3.2.0.tgz", + "integrity": "sha512-lj/z8v0r6ZtsN/cGNNtemmmfoLAFZnjMbNyLzBafjzikOM+glrjNHPlf6lQDOTccj9n5b0PPihEBbhneMyGs1Q==", + "license": "MIT", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "ccount": "^2.0.0", + "devlop": "^1.1.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0", + "parse-entities": "^4.0.0", + "stringify-entities": "^4.0.0", + "unist-util-stringify-position": "^4.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-mdxjs-esm": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-mdxjs-esm/-/mdast-util-mdxjs-esm-2.0.1.tgz", + "integrity": "sha512-EcmOpxsZ96CvlP03NghtH1EsLtr0n9Tm4lPUJUBccV9RwUOneqSycg19n5HGzCf+10LozMRSObtVr3ee1WoHtg==", + "license": "MIT", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-phrasing": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-phrasing/-/mdast-util-phrasing-4.1.0.tgz", + "integrity": "sha512-TqICwyvJJpBwvGAMZjj4J2n0X8QWp21b9l0o7eXyVJ25YNWYbJDVIyD1bZXE6WtV6RmKJVYmQAKWa0zWOABz2w==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-hast": { + "version": "13.2.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.0.tgz", + "integrity": "sha512-QGYKEuUsYT9ykKBCMOEDLsU5JRObWQusAolFMeko/tYPufNkRffBAQjIE+99jbA87xv6FgmjLtwjh9wBWajwAA==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "@ungap/structured-clone": "^1.0.0", + "devlop": "^1.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "trim-lines": "^3.0.0", + "unist-util-position": "^5.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-markdown": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-2.1.2.tgz", + "integrity": "sha512-xj68wMTvGXVOKonmog6LwyJKrYXZPvlwabaryTjLh9LuvovB/KAH+kvi8Gjj+7rJjsFi23nkUxRQv1KqSroMqA==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "longest-streak": "^3.0.0", + "mdast-util-phrasing": "^4.0.0", + "mdast-util-to-string": "^4.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-decode-string": "^2.0.0", + "unist-util-visit": "^5.0.0", + "zwitch": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-4.0.0.tgz", + "integrity": "sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromark/-/micromark-4.0.2.tgz", + "integrity": "sha512-zpe98Q6kvavpCr1NPVSCMebCKfD7CA2NqZ+rykeNhONIJBpc1tFKt9hucLGwha3jNTNI8lHpctWJWoimVF4PfA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "@types/debug": "^4.0.0", + "debug": "^4.0.0", + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-core-commonmark": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-combine-extensions": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-core-commonmark": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/micromark-core-commonmark/-/micromark-core-commonmark-2.0.3.tgz", + "integrity": "sha512-RDBrHEMSxVFLg6xvnXmb1Ayr2WzLAWjeSATAoxwKYJV94TeNavgoIdA0a9ytzDSVzBy2YKFK+emCPOEibLeCrg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-factory-destination": "^2.0.0", + "micromark-factory-label": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-factory-title": "^2.0.0", + "micromark-factory-whitespace": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-html-tag-name": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-extension-mdx-expression": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/micromark-extension-mdx-expression/-/micromark-extension-mdx-expression-3.0.1.tgz", + "integrity": "sha512-dD/ADLJ1AeMvSAKBwO22zG22N4ybhe7kFIZ3LsDI0GlsNr2A3KYxb0LdC1u5rj4Nw+CHKY0RVdnHX8vj8ejm4Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "devlop": "^1.0.0", + "micromark-factory-mdx-expression": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-events-to-acorn": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-extension-mdx-jsx": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/micromark-extension-mdx-jsx/-/micromark-extension-mdx-jsx-3.0.2.tgz", + "integrity": "sha512-e5+q1DjMh62LZAJOnDraSSbDMvGJ8x3cbjygy2qFEi7HCeUT4BDKCvMozPozcD6WmOt6sVvYDNBKhFSz3kjOVQ==", + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "devlop": "^1.0.0", + "estree-util-is-identifier-name": "^3.0.0", + "micromark-factory-mdx-expression": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-events-to-acorn": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-mdx-md": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-mdx-md/-/micromark-extension-mdx-md-2.0.0.tgz", + "integrity": "sha512-EpAiszsB3blw4Rpba7xTOUptcFeBFi+6PY8VnJ2hhimH+vCQDirWgsMpz7w1XcZE7LVrSAUGb9VJpG9ghlYvYQ==", + "license": "MIT", + "dependencies": { + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-mdxjs": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-mdxjs/-/micromark-extension-mdxjs-3.0.0.tgz", + "integrity": "sha512-A873fJfhnJ2siZyUrJ31l34Uqwy4xIFmvPY1oj+Ean5PHcPBYzEsvqvWGaWcfEIr11O5Dlw3p2y0tZWpKHDejQ==", + "license": "MIT", + "dependencies": { + "acorn": "^8.0.0", + "acorn-jsx": "^5.0.0", + "micromark-extension-mdx-expression": "^3.0.0", + "micromark-extension-mdx-jsx": "^3.0.0", + "micromark-extension-mdx-md": "^2.0.0", + "micromark-extension-mdxjs-esm": "^3.0.0", + "micromark-util-combine-extensions": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-mdxjs-esm": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-mdxjs-esm/-/micromark-extension-mdxjs-esm-3.0.0.tgz", + "integrity": "sha512-DJFl4ZqkErRpq/dAPyeWp15tGrcrrJho1hKK5uBS70BCtfrIFg81sqcTVu3Ta+KD1Tk5vAtBNElWxtAa+m8K9A==", + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "devlop": "^1.0.0", + "micromark-core-commonmark": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-events-to-acorn": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unist-util-position-from-estree": "^2.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-factory-destination": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-destination/-/micromark-factory-destination-2.0.1.tgz", + "integrity": "sha512-Xe6rDdJlkmbFRExpTOmRj9N3MaWmbAgdpSrBQvCFqhezUn4AHqJHbaEnfbVYYiexVSs//tqOdY/DxhjdCiJnIA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-label": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-label/-/micromark-factory-label-2.0.1.tgz", + "integrity": "sha512-VFMekyQExqIW7xIChcXn4ok29YE3rnuyveW3wZQWWqF4Nv9Wk5rgJ99KzPvHjkmPXF93FXIbBp6YdW3t71/7Vg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-mdx-expression": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/micromark-factory-mdx-expression/-/micromark-factory-mdx-expression-2.0.3.tgz", + "integrity": "sha512-kQnEtA3vzucU2BkrIa8/VaSAsP+EJ3CKOvhMuJgOEGg9KDC6OAY6nSnNDVRiVNRqj7Y4SlSzcStaH/5jge8JdQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "devlop": "^1.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-events-to-acorn": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unist-util-position-from-estree": "^2.0.0", + "vfile-message": "^4.0.0" + } + }, + "node_modules/micromark-factory-space": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-space/-/micromark-factory-space-2.0.1.tgz", + "integrity": "sha512-zRkxjtBxxLd2Sc0d+fbnEunsTj46SWXgXciZmHq0kDYGnck/ZSGj9/wULTV95uoeYiK5hRXP2mJ98Uo4cq/LQg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-title": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-title/-/micromark-factory-title-2.0.1.tgz", + "integrity": "sha512-5bZ+3CjhAd9eChYTHsjy6TGxpOFSKgKKJPJxr293jTbfry2KDoWkhBb6TcPVB4NmzaPhMs1Frm9AZH7OD4Cjzw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-whitespace": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-whitespace/-/micromark-factory-whitespace-2.0.1.tgz", + "integrity": "sha512-Ob0nuZ3PKt/n0hORHyvoD9uZhr+Za8sFoP+OnMcnWK5lngSzALgQYKMr9RJVOWLqQYuyn6ulqGWSXdwf6F80lQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-character": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.1.tgz", + "integrity": "sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-chunked": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-chunked/-/micromark-util-chunked-2.0.1.tgz", + "integrity": "sha512-QUNFEOPELfmvv+4xiNg2sRYeS/P84pTW0TCgP5zc9FpXetHY0ab7SxKyAQCNCc1eK0459uoLI1y5oO5Vc1dbhA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-classify-character": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-classify-character/-/micromark-util-classify-character-2.0.1.tgz", + "integrity": "sha512-K0kHzM6afW/MbeWYWLjoHQv1sgg2Q9EccHEDzSkxiP/EaagNzCm7T/WMKZ3rjMbvIpvBiZgwR3dKMygtA4mG1Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-combine-extensions": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-combine-extensions/-/micromark-util-combine-extensions-2.0.1.tgz", + "integrity": "sha512-OnAnH8Ujmy59JcyZw8JSbK9cGpdVY44NKgSM7E9Eh7DiLS2E9RNQf0dONaGDzEG9yjEl5hcqeIsj4hfRkLH/Bg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-chunked": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-decode-numeric-character-reference": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/micromark-util-decode-numeric-character-reference/-/micromark-util-decode-numeric-character-reference-2.0.2.tgz", + "integrity": "sha512-ccUbYk6CwVdkmCQMyr64dXz42EfHGkPQlBj5p7YVGzq8I7CtjXZJrubAYezf7Rp+bjPseiROqe7G6foFd+lEuw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-decode-string": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-decode-string/-/micromark-util-decode-string-2.0.1.tgz", + "integrity": "sha512-nDV/77Fj6eH1ynwscYTOsbK7rR//Uj0bZXBwJZRfaLEJ1iGBR6kIfNmlNqaqJf649EP0F3NWNdeJi03elllNUQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "decode-named-character-reference": "^1.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-encode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-2.0.1.tgz", + "integrity": "sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-events-to-acorn": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/micromark-util-events-to-acorn/-/micromark-util-events-to-acorn-2.0.3.tgz", + "integrity": "sha512-jmsiEIiZ1n7X1Rr5k8wVExBQCg5jy4UXVADItHmNk1zkwEVhBuIUKRu3fqv+hs4nxLISi2DQGlqIOGiFxgbfHg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "@types/unist": "^3.0.0", + "devlop": "^1.0.0", + "estree-util-visit": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0", + "vfile-message": "^4.0.0" + } + }, + "node_modules/micromark-util-html-tag-name": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-html-tag-name/-/micromark-util-html-tag-name-2.0.1.tgz", + "integrity": "sha512-2cNEiYDhCWKI+Gs9T0Tiysk136SnR13hhO8yW6BGNyhOC4qYFnwF1nKfD3HFAIXA5c45RrIG1ub11GiXeYd1xA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-normalize-identifier": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-normalize-identifier/-/micromark-util-normalize-identifier-2.0.1.tgz", + "integrity": "sha512-sxPqmo70LyARJs0w2UclACPUUEqltCkJ6PhKdMIDuJ3gSf/Q+/GIe3WKl0Ijb/GyH9lOpUkRAO2wp0GVkLvS9Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-resolve-all": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-resolve-all/-/micromark-util-resolve-all-2.0.1.tgz", + "integrity": "sha512-VdQyxFWFT2/FGJgwQnJYbe1jjQoNTS4RjglmSjTUlpUMa95Htx9NHeYW4rGDJzbjvCsl9eLjMQwGeElsqmzcHg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-sanitize-uri": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-2.0.1.tgz", + "integrity": "sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-subtokenize": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-2.1.0.tgz", + "integrity": "sha512-XQLu552iSctvnEcgXw6+Sx75GflAPNED1qx7eBJ+wydBb2KCbRZe+NwvIEEMM83uml1+2WSXpBAcp9IUCgCYWA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-symbol": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.1.tgz", + "integrity": "sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-types": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-2.0.2.tgz", + "integrity": "sha512-Yw0ECSpJoViF1qTU4DC6NwtC4aWGt1EkzaQB8KPPyCRR8z9TWeV0HbEFGTO+ZY1wB22zmxnJqhPyTpOVCpeHTA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/node-releases": { + "version": "2.0.19", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.19.tgz", + "integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==", + "license": "MIT" + }, + "node_modules/parse-entities": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-4.0.2.tgz", + "integrity": "sha512-GG2AQYWoLgL877gQIKeRPGO1xF9+eG1ujIb5soS5gPvLQ1y2o8FL90w2QWNdf9I361Mpp7726c+lj3U0qK1uGw==", + "license": "MIT", + "dependencies": { + "@types/unist": "^2.0.0", + "character-entities-legacy": "^3.0.0", + "character-reference-invalid": "^2.0.0", + "decode-named-character-reference": "^1.0.0", + "is-alphanumerical": "^2.0.0", + "is-decimal": "^2.0.0", + "is-hexadecimal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/parse-entities/node_modules/@types/unist": { + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.11.tgz", + "integrity": "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==", + "license": "MIT" + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "license": "ISC" + }, + "node_modules/property-information": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.1.0.tgz", + "integrity": "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/raptor-async": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/raptor-async/-/raptor-async-1.1.3.tgz", + "integrity": "sha512-VZCxygWMjW9lKqnApK9D2QbfyzRn7ehiTqnXWwMCLBXANSy+xbnYfbX/5f8YX3bZXu+g+JESmqWPchIQrZj2ig==", + "license": "Apache License v2.0" + }, + "node_modules/raptor-regexp": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/raptor-regexp/-/raptor-regexp-1.0.1.tgz", + "integrity": "sha512-DqC7ViHJUs3jLIxJI1/HVvCu3yPJaP8CM7PGsHvjimg7yJ3lLOdCBxlPE0G2Q8OJgUA8Pe7nvhm6lcQ3hZepow==", + "license": "Apache License v2.0" + }, + "node_modules/raptor-util": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/raptor-util/-/raptor-util-3.2.0.tgz", + "integrity": "sha512-uEDMMkBCJvjTqYMBnJNxn+neiS6a0rhybQNA9RaexGor1uvKjwyHA5VcbZMZEuqXhKUWbL+WNS7PhuZVZNB7pw==", + "license": "Apache-2.0" + }, + "node_modules/recma-build-jsx": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/recma-build-jsx/-/recma-build-jsx-1.0.0.tgz", + "integrity": "sha512-8GtdyqaBcDfva+GUKDr3nev3VpKAhup1+RvkMvUxURHpW7QyIvk9F5wz7Vzo06CEMSilw6uArgRqhpiUcWp8ew==", + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "estree-util-build-jsx": "^3.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/recma-jsx": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/recma-jsx/-/recma-jsx-1.0.0.tgz", + "integrity": "sha512-5vwkv65qWwYxg+Atz95acp8DMu1JDSqdGkA2Of1j6rCreyFUE/gp15fC8MnGEuG1W68UKjM6x6+YTWIh7hZM/Q==", + "license": "MIT", + "dependencies": { + "acorn-jsx": "^5.0.0", + "estree-util-to-js": "^2.0.0", + "recma-parse": "^1.0.0", + "recma-stringify": "^1.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/recma-parse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/recma-parse/-/recma-parse-1.0.0.tgz", + "integrity": "sha512-OYLsIGBB5Y5wjnSnQW6t3Xg7q3fQ7FWbw/vcXtORTnyaSFscOtABg+7Pnz6YZ6c27fG1/aN8CjfwoUEUIdwqWQ==", + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "esast-util-from-js": "^2.0.0", + "unified": "^11.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/recma-stringify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/recma-stringify/-/recma-stringify-1.0.0.tgz", + "integrity": "sha512-cjwII1MdIIVloKvC9ErQ+OgAtwHBmcZ0Bg4ciz78FtbT8In39aAYbaA7zvxQ61xVMSPE8WxhLwLbhif4Js2C+g==", + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "estree-util-to-js": "^2.0.0", + "unified": "^11.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/rehype-recma": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/rehype-recma/-/rehype-recma-1.0.0.tgz", + "integrity": "sha512-lqA4rGUf1JmacCNWWZx0Wv1dHqMwxzsDWYMTowuplHF3xH0N/MmrZ/G3BDZnzAkRmxDadujCjaKM2hqYdCBOGw==", + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "@types/hast": "^3.0.0", + "hast-util-to-estree": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/relative-import-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/relative-import-path/-/relative-import-path-1.0.0.tgz", + "integrity": "sha512-ZvbtoduKQmD4PZeJPfH6Ql21qUWhaMxiHkIsH+FUnZqKDwNIXBtGg5zRZyHWomiGYk8n5+KMBPK7Mi4D0XWfNg==", + "license": "MIT" + }, + "node_modules/remark-mdx": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/remark-mdx/-/remark-mdx-3.1.0.tgz", + "integrity": "sha512-Ngl/H3YXyBV9RcRNdlYsZujAmhsxwzxpDzpDEhFBVAGthS4GDgnctpDjgFl/ULx5UEDzqtW1cyBSNKqYYrqLBA==", + "license": "MIT", + "dependencies": { + "mdast-util-mdx": "^3.0.0", + "micromark-extension-mdxjs": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-parse": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-11.0.0.tgz", + "integrity": "sha512-FCxlKLNGknS5ba/1lmpYijMUzX2esxW5xQqjWxw2eHFfS2MSdaHVINFmhjo+qN1WhZhNimq0dZATN9pH0IDrpA==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-from-markdown": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-rehype": { + "version": "11.1.2", + "resolved": "https://registry.npmjs.org/remark-rehype/-/remark-rehype-11.1.2.tgz", + "integrity": "sha512-Dh7l57ianaEoIpzbp0PC9UKAdCSVklD8E5Rpw7ETfbTl3FqcOOgq5q2LVDhgGCkaBv7p24JXikPdvhhmHvKMsw==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "mdast-util-to-hast": "^13.0.0", + "unified": "^11.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/self-closing-tags": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/self-closing-tags/-/self-closing-tags-1.0.1.tgz", + "integrity": "sha512-7t6hNbYMxM+VHXTgJmxwgZgLGktuXtVVD5AivWzNTdJBM4DBjnDKDzkf2SrNjihaArpeJYNjxkELBu1evI4lQA==", + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/source-map": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", + "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", + "license": "BSD-3-Clause", + "engines": { + "node": ">= 8" + } + }, + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/source-map-support/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/space-separated-tokens": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz", + "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/stackframe": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/stackframe/-/stackframe-1.3.4.tgz", + "integrity": "sha512-oeVtt7eWQS+Na6F//S4kJ2K2VbRlS9D43mAlMyVpVWovy9o+jfgH8O9agzANzaiLjclA0oYzUXEM4PurhSUChw==", + "license": "MIT" + }, + "node_modules/stringify-entities": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz", + "integrity": "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==", + "license": "MIT", + "dependencies": { + "character-entities-html4": "^2.0.0", + "character-entities-legacy": "^3.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/style-to-js": { + "version": "1.1.16", + "resolved": "https://registry.npmjs.org/style-to-js/-/style-to-js-1.1.16.tgz", + "integrity": "sha512-/Q6ld50hKYPH3d/r6nr117TZkHR0w0kGGIVfpG9N6D8NymRPM9RqCUv4pRpJ62E5DqOYx2AFpbZMyCPnjQCnOw==", + "license": "MIT", + "dependencies": { + "style-to-object": "1.0.8" + } + }, + "node_modules/style-to-object": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-1.0.8.tgz", + "integrity": "sha512-xT47I/Eo0rwJmaXC4oilDGDWLohVhR6o/xAQcPQN8q6QBuZVL8qMYL85kLmST5cPjAorwvqIA4qXTRQoYHaL6g==", + "license": "MIT", + "dependencies": { + "inline-style-parser": "0.2.4" + } + }, + "node_modules/trim-lines": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz", + "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/trough": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/trough/-/trough-2.2.0.tgz", + "integrity": "sha512-tmMpK00BjZiUyVyvrBK7knerNgmgvcV/KLVyuma/SC+TQN167GrMRciANTz09+k3zW8L8t60jWO1GpfkZdjTaw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/typescript": { + "version": "5.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", + "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/unified": { + "version": "11.0.5", + "resolved": "https://registry.npmjs.org/unified/-/unified-11.0.5.tgz", + "integrity": "sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "bail": "^2.0.0", + "devlop": "^1.0.0", + "extend": "^3.0.0", + "is-plain-obj": "^4.0.0", + "trough": "^2.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-is": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.0.tgz", + "integrity": "sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-position": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-5.0.0.tgz", + "integrity": "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-position-from-estree": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unist-util-position-from-estree/-/unist-util-position-from-estree-2.0.0.tgz", + "integrity": "sha512-KaFVRjoqLyF6YXCbVLNad/eS4+OfPQQn2yOd7zF/h5T/CSL2v8NpN6a5TPvtbXthAGw5nG+PuTtq+DdIZr+cRQ==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-stringify-position": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-4.0.0.tgz", + "integrity": "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-5.0.0.tgz", + "integrity": "sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0", + "unist-util-visit-parents": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit-parents": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-6.0.1.tgz", + "integrity": "sha512-L/PqWzfTP9lzzEa6CKs0k2nARxTdZduw3zyh8d2NVBnsyvHjSX4TWse388YrrQKbvI8w20fGjGlhgT96WwKykw==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/update-browserslist-db": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.3.tgz", + "integrity": "sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "escalade": "^3.2.0", + "picocolors": "^1.1.1" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/vfile": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz", + "integrity": "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vfile-message": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-4.0.2.tgz", + "integrity": "sha512-jRDZ1IMLttGj41KcZvlrYAaI3CfqpLpfpf+Mfig13viT6NKvRzWZ+lXz0Y5D60w6uJIBAOGq9mSHf0gktF0duw==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-stringify-position": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "license": "ISC" + }, + "node_modules/zwitch": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", + "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" } } } - return result + buffer + (isInsideComment ? _strip(jsonString.slice(offset)) : jsonString.slice(offset)); } diff --git a/repl.js b/repl.js index 088f13e..ab9cb30 100644 --- a/repl.js +++ b/repl.js @@ -1,11 +1 @@ -// default -(node, parent, grandparent) => { - switch (parent.type) { - case "MarkoTag": - return parent.var !== node; - case "MarkoTagBody": - return false; - default: - return originalIsReferenced(node, parent, grandparent); - } -} +// RIP diff --git a/src/file-viewer/backend.tsx b/src/file-viewer/backend.tsx deleted file mode 100644 index 752b3eb..0000000 --- a/src/file-viewer/backend.tsx +++ /dev/null @@ -1,29 +0,0 @@ -// default -function transpileNamespace(path, allowNamespaces) { - if (path.node.declare || path.node.id.type === "StringLiteral") { - path.remove(); - return; - } - if (!allowNamespaces) { - 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"); - } - const name = getFirstIdentifier(path.node.id).name; - const value = handleNested(path, path.node); - if (value === null) { - const program = path.findParent(p => p.isProgram()); - (0, _globalTypes.registerGlobalType)(program.scope, name); - path.remove(); - } else if (path.scope.hasOwnBinding(name)) { - path.replaceWith(value); - } else { - path.scope.registerDeclaration(path.replaceWithMultiple([getDeclaration(name), value])[0]); - } -} - -// getFirstIdentifier -function getFirstIdentifier(node) { - if (_core.types.isIdentifier(node)) { - return node; - } - return getFirstIdentifier(node.left); -} diff --git a/src/file-viewer/cache.ts b/src/file-viewer/cache.ts deleted file mode 100644 index afe4911..0000000 --- a/src/file-viewer/cache.ts +++ /dev/null @@ -1,36 +0,0 @@ -// beginHiddenCallStack -function beginHiddenCallStack(fn) { - if (!SUPPORTED) return fn; - return Object.defineProperty(function (...args) { - setupPrepareStackTrace(); - return fn(...args); - }, "name", { - value: STOP_HIDING - }); -} - -// endHiddenCallStack -function endHiddenCallStack(fn) { - if (!SUPPORTED) return fn; - return Object.defineProperty(function (...args) { - return fn(...args); - }, "name", { - value: START_HIDING - }); -} - -// expectedError -function expectedError(error) { - if (!SUPPORTED) return; - expectedErrors.add(error); - return error; -} - -// injectVirtualStackFrame -function injectVirtualStackFrame(error, filename) { - if (!SUPPORTED) return; - let frames = virtualFrames.get(error); - if (!frames) virtualFrames.set(error, frames = []); - frames.push(CallSite(filename)); - return error; -} diff --git a/src/file-viewer/cert.pem b/src/file-viewer/cert.pem deleted file mode 100644 index 312f02f..0000000 --- a/src/file-viewer/cert.pem +++ /dev/null @@ -1,91 +0,0 @@ -// default -function* loadPrivatePartialConfig(inputOpts) { - if (inputOpts != null && (typeof inputOpts !== "object" || Array.isArray(inputOpts))) { - throw new Error("Babel options must be an object, null, or undefined"); - } - const args = inputOpts ? (0, _options.validate)("arguments", inputOpts) : {}; - const { - envName = (0, _environment.getEnv)(), - cwd = ".", - root: rootDir = ".", - rootMode = "root", - caller, - cloneInputAst = true - } = args; - const absoluteCwd = _path().resolve(cwd); - const absoluteRootDir = resolveRootMode(_path().resolve(absoluteCwd, rootDir), rootMode); - const filename = typeof args.filename === "string" ? _path().resolve(cwd, args.filename) : undefined; - const showConfigPath = yield* (0, _index.resolveShowConfigPath)(absoluteCwd); - const context = { - filename, - cwd: absoluteCwd, - root: absoluteRootDir, - envName, - caller, - showConfig: showConfigPath === filename - }; - const configChain = yield* (0, _configChain.buildRootChain)(args, context); - if (!configChain) return null; - const merged = { - assumptions: {} - }; - configChain.options.forEach(opts => { - (0, _util.mergeOptions)(merged, opts); - }); - const options = Object.assign({}, merged, { - targets: (0, _resolveTargets.resolveTargets)(merged, absoluteRootDir), - cloneInputAst, - babelrc: false, - configFile: false, - browserslistConfigFile: false, - passPerPreset: false, - envName: context.envName, - cwd: context.cwd, - root: context.root, - rootMode: "root", - filename: typeof context.filename === "string" ? context.filename : undefined, - plugins: configChain.plugins.map(descriptor => (0, _item.createItemFromDescriptor)(descriptor)), - presets: configChain.presets.map(descriptor => (0, _item.createItemFromDescriptor)(descriptor)) - }); - return { - options, - context, - fileHandling: configChain.fileHandling, - ignore: configChain.ignore, - babelrc: configChain.babelrc, - config: configChain.config, - files: configChain.files - }; -} - -// loadPartialConfig -function* loadPartialConfig(opts) { - let showIgnoredFiles = false; - if (typeof opts === "object" && opts !== null && !Array.isArray(opts)) { - var _opts = opts; - ({ - showIgnoredFiles - } = _opts); - opts = _objectWithoutPropertiesLoose(_opts, _excluded); - _opts; - } - const result = yield* loadPrivatePartialConfig(opts); - if (!result) return null; - const { - options, - babelrc, - ignore, - config, - fileHandling, - files - } = result; - if (fileHandling === "ignored" && !showIgnoredFiles) { - return null; - } - (options.plugins || []).forEach(item => { - if (item.value instanceof _plugin.default) { - throw new Error("Passing cached plugin instances is not supported in " + "babel.loadPartialConfig()"); - } - }); - return new PartialConfig(options, babelrc ? babelrc.filepath : undefined, ignore ? ignore.filepath : undefined, config ? config.filepath : undefined, fileHandling, files); -} diff --git a/src/file-viewer/cotyledon.tsx b/src/file-viewer/cotyledon.tsx deleted file mode 100644 index d14d49c..0000000 --- a/src/file-viewer/cotyledon.tsx +++ /dev/null @@ -1,291 +0,0 @@ -export function Speedbump() { - return ( - <div class="panel last"> - <div className="header"> - an interlude - </div> - <div className="content file-view file-view-text speedbump"> - <canvas - style="linear-gradient(45deg, #111318, #181f20)" - data-canvas="cotyledon" - > - </canvas> - <header> - <h1>cotyledon</h1> - </header> - <div id="captcha" style="display: none;"> - <p style="max-width:480px"> - please prove you're not a robot by selecting all of the images with - four-leaf clovers, until there are only regular clovers. - <noscript> - this will require javascript enabled on your computer to verify - the mouse clicks. - </noscript> - </p> - <div className="enter-container"> - <div className="image-grid"> - <button> - <img src="/captcha/image/1.jpeg" alt="a four-leaf clover" /> - </button> - <button> - <img src="/captcha/image/2.jpeg" alt="a four-leaf clover" /> - </button> - <button> - <img src="/captcha/image/3.jpeg" alt="a four-leaf clover" /> - </button> - <button> - <img src="/captcha/image/4.jpeg" alt="a four-leaf clover" /> - </button> - <button> - <img src="/captcha/image/5.jpeg" alt="a four-leaf clover" /> - </button> - <button> - <img src="/captcha/image/6.jpeg" alt="a four-leaf clover" /> - </button> - <button> - <img src="/captcha/image/7.jpeg" alt="a four-leaf clover" /> - </button> - <button> - <img src="/captcha/image/8.jpeg" alt="a four-leaf clover" /> - </button> - <button> - <img src="/captcha/image/9.jpeg" alt="a four-leaf clover" /> - </button> - </div> - </div> - <div class="enter-container"> - <button id="enter2">all done</button> - </div> - </div> - <div id="first"> - <p> - this place is sacred, but dangerous. i have to keep visitors to an - absolute minimum; you'll get dust on all the artifacts. - </p> - <p> - by entering our museum, you agree not to use your camera. flash off - isn't enough; the bits and bytes are alergic even to a camera's - sensor - </p> - <p style="font-size:0.9rem;"> - (in english: please do not store downloads after you're done viewing - them) - </p> - <div class="enter-container"> - <button id="enter">break my boundaries</button> - </div> - </div> - </div> - </div> - ); -} - -export function Readme() { - return ( - <div class="panel last"> - <div className="header"> - cotyledon - </div> - <div className="content file-view file-view-text"> - <div style="max-width: 71ch;padding:3rem;font-family:rmo,monospace"> - <p style="margin-top:0"> - welcome to the archive. if this is your first time here, i recommend - starting in '<a href="/file/2017">2017</a>' and going - chronologically from there. however, there is truly no wrong way to - explore. - </p> - <p> - note that there is a blanket trigger warning for everything in this - archive: while there is nothing visually offensive, some portions of - the text and emotions conveyed through this may hit extremely hard. - you are warned. - </p> - <p> - all file dates are real. at least as real as i could figure out. - when i moved data across drives over my years, i accidentally had a - few points where i stamped over all the dates with the day that - moved the files. even fucked it up a final time in february 2025, - while in the process of unfucking things. - </p> - <p> - thankfully, my past self knew i'd want to assemble this kind of - site, and because of that they were crazy about storing the dates of - things inside of html, json/yaml files, and even in fucking - databases. i'm glad it was all stored though, but jeez what a nerd. - </p> - <p> - a few files were touched up for privacy, or otherwise re-encoded. - some of them i added extra metadata. - </p> - <p> - from the bottom of my heart: i hope you enjoy. it has been a - nightmare putting this all together. technically and emotionally - speaking. i'm glad we can put this all behind us, mark it as - completed, and get started with the good shit. - </p> - <p> - love,<br />clo - </p> - <br /> - <p> - start here -> <a href="/file/2017">2017</a> - </p> - </div> - </div> - </div> - ); -} - -export function ForEveryone() { - // deno-fmt-ignore - return <><div class="for_everyone"> -<p>today is my 21st birthday. april 30th, 2025.</p> -<p>it's been nearly six months starting hormones.</p> -<p>sometimes i feel great,</p> -<p>sometimes i get dysphoria.</p> -<p>with the walls around me gone</p> -<p>that shit hits way harder than it did before.</p> -<p>ugh..</p> -<p>i'm glad the pain i felt is now explained,</p> -<p>but now rendered in high definition.</p> -<p>the smallest strands of hair on my face and belly act</p> -<p>as sharpened nails to pierce my soul.</p> -<p></p> -<p>it's all a pathway to better days; the sun had risen.</p> -<p>one little step at a time for both of us.</p> -<p>today i quit my job. free falling, it feels so weird.</p> -<p>like sky diving.</p> -<p>the only thing i feel is cold wind.</p> -<p>the only thing i see is everything,</p> -<p>and it's beautiful.</p> -<p>i have a month of falling before the parachute activates,</p> -<p>gonna spend as much time of it on art as i can.</p> -<p>that was, after all, my life plan:</p> -<p>i wanted to make art, all the time,</p> -<p>for everyone.</p> -<p></p> -<p>then you see what happened</p> -<p>to the world and the internet.</p> -<p>i never really got to live through that golden age,</p> -<p>it probably sucked back then too.</p> -<p>but now the big sites definitely stopped being fun.</p> -<p>they slide their cold hands up my body</p> -<p>and feel me around. it's unwelcoming, and</p> -<p>inconsiderate to how sensitive my skin is.</p> -<p>i'm so fucking glad i broke up with YouTube</p> -<p>and their devilish friends.</p> -<p>my NAS is at 5 / 24 TB</p> -<p>and probably wont fill for the next decade.</p> -<p></p> -<p>it took 2 months for me to notice my body changed.</p> -<p>that day was really nice, but it hurt a lot.</p> -<p>a sharp, satisfying pain in my chest gave me life.</p> -<p>learned new instincts for my arms</p> -<p>so they'd stop poking my new shape.</p> -<p>when i look at my face</p> -<p>it's like a different person.</p> -<p>she was the same as before, but completely new.</p> -<p>something changed</p> -<p>or i'm now used to seeing what makes me smile.</p> -<p>regardless, whatever i see in the mirror, i smile.</p> -<p>and, i don't hear that old name much anymore</p> -<p>aside from nightmares. and you'll never repeat it, ok?</p> -<p>okay.</p> -<p></p> -<p>been playing 'new canaan' by 'bill wurtz' on loop</p> -<p>in the background.</p> -<p>it kinda just feels right.</p> -<p>especially when that verse near the end comes on.</p> -<p></p> -<p>more people have been allowed to visit me.</p> -<p>my apartment used to be just for me,</p> -<p>but the more i felt like a person</p> -<p>the more i felt like having others over.</p> -<p>still have to decorate and clean it a little,</p> -<p>but it isn't a job to do alone.</p> -<p>we dragged a giant a rug across the city one day,</p> -<p>and it felt was like anything was possible.</p> -<p>sometimes i have ten people visit in a day,</p> -<p>or sometimes i focus my little eyes on just one.</p> -<p>i never really know what i want to do</p> -<p>until the time actually comes.</p> -<p></p> -{/* FILIP */} -<p>i think about the times i was by the water with you.</p> -<p>the sun setting warmly, icy air fell on our shoulders.</p> -{/* NATALIE */} -<p>and how we walked up to the top of that hill,</p> -<p>you picked up and disposed a nail on the ground,</p> -<p>walking the city thru places i've never been.</p> -{/* BEN */} -<p>or hiking through the park talking about compilers,</p> -<p>tiring me out until i'd fall asleep in your arms.</p> -{/* ELENA */} -<p>and the way you held on to my hand as i woke up,</p> -<p>noticing how i was trying to hide nightmare's tears.</p> -<p></p> -{/* HIGH SCHOOL */} -<p>i remember we were yelling lyrics loudly,</p> -<p>out of key yet cheered on because it was fun.</p> -{/* ADVAITH/NATALIE */} -<p>and when we all toured the big corporate office,</p> -{/* AYU/HARRIS */} -<p>then snuck in to some startup's office after hours;</p> -<p>i don't remember what movie we watched.</p> -{/* COLLEGE, DAY 1 IN EV's ROOM */} -<p>i remember laying on the bunk bed,</p> -<p>while the rest played a card game.</p> -{/* MEGHAN/MORE */} -<p>with us all laying on the rug, staring at the TV</p> -<p>as the ending twist to that show was revealed.</p> -<p></p> -<p>all the moments i cherish,</p> -<p>i love because it was always me.</p> -<p>i didn't have to pretend,</p> -<p>even if i didn't know who i was at the time.</p> -<p>you all were there. for me.</p> -<p></p> -<p>i don't want to pretend any more</p> -<p>i want to be myself. for everyone.</p> -<p></p> -<p>oh, the song ended. i thought it was on loop?</p> -<p>it's late... can hear the crickets...</p> -<p>and i can almost see the moon... mmmm...</p> -<p>...nah, too much light pollution.</p> -<p></p> -<p>one day. one day.</p> -<p></p> -<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> -</div> -<div class="for_everyone" style="max-width:80ch;"> -<blockquote> -<p>journal - 2024-09-14</p> -<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/> -okay.. oof... its still clouding my mind<br/> -i cant shake that feeling away</p> -<p>hold on...</p> -<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> -<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> -<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> -<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> -<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> -<p>waiting on a reply from someone from healthcare. it'll be slow, but it will be okay.</p> -</blockquote> -</div> -<div class="for_everyone"> -<p class="normal"> -i'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. -</p> - -<p class="normal" style="font-size:2rem;color:#9C91FF;font-family:times,serif;font-style:italic"> - and then we knew,<br/> - just like paper airplanes: that we could fly... -</p> -<br /> -<p class="normal"> - <a href="/" style='text-decoration:underline;text-underline-offset:0.2em;'>fin.</a> -</p> -</div> -</> -} -ForEveryone.class = "text"; diff --git a/src/file-viewer/extension-stats.ts b/src/file-viewer/extension-stats.ts deleted file mode 100644 index 38737f8..0000000 --- a/src/file-viewer/extension-stats.ts +++ /dev/null @@ -1,40 +0,0 @@ -// run -function* run(config, code, ast) { - const file = yield* (0, _normalizeFile.default)(config.passes, (0, _normalizeOpts.default)(config), code, ast); - const opts = file.opts; - try { - yield* transformFile(file, config.passes); - } catch (e) { - var _opts$filename; - e.message = `${(_opts$filename = opts.filename) != null ? _opts$filename : "unknown file"}: ${e.message}`; - if (!e.code) { - e.code = "BABEL_TRANSFORM_ERROR"; - } - throw e; - } - let outputCode, outputMap; - try { - if (opts.code !== false) { - ({ - outputCode, - outputMap - } = (0, _generate.default)(config.passes, file)); - } - } catch (e) { - var _opts$filename2; - e.message = `${(_opts$filename2 = opts.filename) != null ? _opts$filename2 : "unknown file"}: ${e.message}`; - if (!e.code) { - e.code = "BABEL_GENERATE_ERROR"; - } - throw e; - } - return { - metadata: file.metadata, - options: opts, - ast: opts.ast === true ? file.ast : null, - code: outputCode === undefined ? null : outputCode, - map: outputMap === undefined ? null : outputMap, - sourceType: file.ast.program.sourceType, - externalDependencies: (0, _deepArray.flattenToSet)(config.externalDependencies) - }; -} diff --git a/src/file-viewer/highlight-grammar/astro.plist b/src/file-viewer/highlight-grammar/astro.plist deleted file mode 100644 index 1b328ae..0000000 --- a/src/file-viewer/highlight-grammar/astro.plist +++ /dev/null @@ -1,44 +0,0 @@ -// default -function normalizeOptions(config) { - const { - filename, - cwd, - filenameRelative = typeof filename === "string" ? _path().relative(cwd, filename) : "unknown", - sourceType = "module", - inputSourceMap, - sourceMaps = !!inputSourceMap, - sourceRoot = config.options.moduleRoot, - sourceFileName = _path().basename(filenameRelative), - comments = true, - compact = "auto" - } = config.options; - const opts = config.options; - const options = Object.assign({}, opts, { - parserOpts: Object.assign({ - sourceType: _path().extname(filenameRelative) === ".mjs" ? "module" : sourceType, - sourceFileName: filename, - plugins: [] - }, opts.parserOpts), - generatorOpts: Object.assign({ - filename, - auxiliaryCommentBefore: opts.auxiliaryCommentBefore, - auxiliaryCommentAfter: opts.auxiliaryCommentAfter, - retainLines: opts.retainLines, - comments, - shouldPrintComment: opts.shouldPrintComment, - compact, - minified: opts.minified, - sourceMaps, - sourceRoot, - sourceFileName - }, opts.generatorOpts) - }); - for (const plugins of config.passes) { - for (const plugin of plugins) { - if (plugin.manipulateOptions) { - plugin.manipulateOptions(options, options.parserOpts); - } - } - } - return options; -} diff --git a/src/file-viewer/highlight-grammar/css.plist b/src/file-viewer/highlight-grammar/css.plist deleted file mode 100644 index 72d398d..0000000 --- a/src/file-viewer/highlight-grammar/css.plist +++ /dev/null @@ -1,53 +0,0 @@ -// default -function* normalizeFile(pluginPasses, options, code, ast) { - code = `${code || ""}`; - if (ast) { - if (ast.type === "Program") { - ast = file(ast, [], []); - } else if (ast.type !== "File") { - throw new Error("AST root must be a Program or File node"); - } - if (options.cloneInputAst) { - ast = (0, _cloneDeep.default)(ast); - } - } else { - ast = yield* (0, _index.default)(pluginPasses, options, code); - } - let inputMap = null; - if (options.inputSourceMap !== false) { - if (typeof options.inputSourceMap === "object") { - inputMap = _convertSourceMap().fromObject(options.inputSourceMap); - } - if (!inputMap) { - const lastComment = extractComments(INLINE_SOURCEMAP_REGEX, ast); - if (lastComment) { - try { - inputMap = _convertSourceMap().fromComment("//" + lastComment); - } catch (err) { - { - debug("discarding unknown inline input sourcemap"); - } - } - } - } - if (!inputMap) { - const lastComment = extractComments(EXTERNAL_SOURCEMAP_REGEX, ast); - if (typeof options.filename === "string" && lastComment) { - try { - const match = EXTERNAL_SOURCEMAP_REGEX.exec(lastComment); - const inputMapContent = _fs().readFileSync(_path().resolve(_path().dirname(options.filename), match[1]), "utf8"); - inputMap = _convertSourceMap().fromJSON(inputMapContent); - } catch (err) { - debug("discarding unknown file input sourcemap", err); - } - } else if (lastComment) { - debug("discarding un-loadable file input sourcemap"); - } - } - } - return new _file.default(options, { - code, - ast: ast, - inputMap - }); -} diff --git a/src/file-viewer/highlight-grammar/diff.plist b/src/file-viewer/highlight-grammar/diff.plist deleted file mode 100644 index edd7585..0000000 --- a/src/file-viewer/highlight-grammar/diff.plist +++ /dev/null @@ -1,56 +0,0 @@ -// default -function* parser(pluginPasses, { - parserOpts, - highlightCode = true, - filename = "unknown" -}, code) { - try { - const results = []; - for (const plugins of pluginPasses) { - for (const plugin of plugins) { - const { - parserOverride - } = plugin; - if (parserOverride) { - const ast = parserOverride(code, parserOpts, _parser().parse); - if (ast !== undefined) results.push(ast); - } - } - } - if (results.length === 0) { - return (0, _parser().parse)(code, parserOpts); - } else if (results.length === 1) { - yield* []; - if (typeof results[0].then === "function") { - 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.`); - } - return results[0]; - } - throw new Error("More than one plugin attempted to override parsing."); - } catch (err) { - if (err.code === "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED") { - err.message += "\nConsider renaming the file to '.mjs', or setting sourceType:module " + "or sourceType:unambiguous in your Babel config for this file."; - } - const { - loc, - missingPlugin - } = err; - if (loc) { - const codeFrame = (0, _codeFrame().codeFrameColumns)(code, { - start: { - line: loc.line, - column: loc.column + 1 - } - }, { - highlightCode - }); - if (missingPlugin) { - err.message = `${filename}: ` + (0, _missingPluginHelper.default)(missingPlugin[0], loc, codeFrame, filename); - } else { - err.message = `${filename}: ${err.message}\n\n` + codeFrame; - } - err.code = "BABEL_PARSE_ERROR"; - } - throw err; - } -} diff --git a/src/file-viewer/highlight-grammar/dosbatch.plist b/src/file-viewer/highlight-grammar/dosbatch.plist deleted file mode 100644 index a51abcd..0000000 --- a/src/file-viewer/highlight-grammar/dosbatch.plist +++ /dev/null @@ -1,33 +0,0 @@ -// default -function generateMissingPluginMessage(missingPluginName, loc, codeFrame, filename) { - let helpMessage = `Support for the experimental syntax '${missingPluginName}' isn't currently enabled ` + `(${loc.line}:${loc.column + 1}):\n\n` + codeFrame; - const pluginInfo = pluginNameMap[missingPluginName]; - if (pluginInfo) { - const { - syntax: syntaxPlugin, - transform: transformPlugin - } = pluginInfo; - if (syntaxPlugin) { - const syntaxPluginInfo = getNameURLCombination(syntaxPlugin); - if (transformPlugin) { - const transformPluginInfo = getNameURLCombination(transformPlugin); - const sectionType = transformPlugin.name.startsWith("@babel/plugin") ? "plugins" : "presets"; - helpMessage += `\n\nAdd ${transformPluginInfo} to the '${sectionType}' section of your Babel config to enable transformation. -If you want to leave it as-is, add ${syntaxPluginInfo} to the 'plugins' section to enable parsing.`; - } else { - helpMessage += `\n\nAdd ${syntaxPluginInfo} to the 'plugins' section of your Babel config ` + `to enable parsing.`; - } - } - } - const msgFilename = filename === "unknown" ? "<name of the input file>" : filename; - helpMessage += ` - -If you already added the plugin for this syntax to your config, it's possible that your config \ -isn't being loaded. -You can re-run Babel with the BABEL_SHOW_CONFIG_FOR environment variable to show the loaded \ -configuration: -\tnpx cross-env BABEL_SHOW_CONFIG_FOR=${msgFilename} <your build command> -See https://babeljs.io/docs/configuration#print-effective-configs for more info. -`; - return helpMessage; -} diff --git a/src/file-viewer/highlight-grammar/json.plist b/src/file-viewer/highlight-grammar/json.plist deleted file mode 100644 index 929056e..0000000 --- a/src/file-viewer/highlight-grammar/json.plist +++ /dev/null @@ -1,11 +0,0 @@ -// default -function _default(value) { - if (typeof value !== "object") return value; - { - try { - return deepClone(value, new Map(), true); - } catch (_) { - return structuredClone(value); - } - } -} diff --git a/src/file-viewer/highlight-grammar/lua.plist b/src/file-viewer/highlight-grammar/lua.plist deleted file mode 100644 index fa18f85..0000000 --- a/src/file-viewer/highlight-grammar/lua.plist +++ /dev/null @@ -1,61 +0,0 @@ -// default -function generateCode(pluginPasses, file) { - const { - opts, - ast, - code, - inputMap - } = file; - const { - generatorOpts - } = opts; - generatorOpts.inputSourceMap = inputMap == null ? void 0 : inputMap.toObject(); - const results = []; - for (const plugins of pluginPasses) { - for (const plugin of plugins) { - const { - generatorOverride - } = plugin; - if (generatorOverride) { - const result = generatorOverride(ast, generatorOpts, code, _generator().default); - if (result !== undefined) results.push(result); - } - } - } - let result; - if (results.length === 0) { - result = (0, _generator().default)(ast, generatorOpts, code); - } else if (results.length === 1) { - result = results[0]; - if (typeof result.then === "function") { - 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.`); - } - } else { - throw new Error("More than one plugin attempted to override codegen."); - } - let { - code: outputCode, - decodedMap: outputMap = result.map - } = result; - if (result.__mergedMap) { - outputMap = Object.assign({}, result.map); - } else { - if (outputMap) { - if (inputMap) { - outputMap = (0, _mergeMap.default)(inputMap.toObject(), outputMap, generatorOpts.sourceFileName); - } else { - outputMap = result.map; - } - } - } - if (opts.sourceMaps === "inline" || opts.sourceMaps === "both") { - outputCode += "\n" + _convertSourceMap().fromObject(outputMap).toComment(); - } - if (opts.sourceMaps === "inline") { - outputMap = null; - } - return { - outputCode, - outputMap - }; -} diff --git a/src/file-viewer/highlight-grammar/mdx.plist b/src/file-viewer/highlight-grammar/mdx.plist deleted file mode 100644 index 1ce5165..0000000 --- a/src/file-viewer/highlight-grammar/mdx.plist +++ /dev/null @@ -1,17 +0,0 @@ -// default -function mergeSourceMap(inputMap, map, sourceFileName) { - const source = sourceFileName.replace(/\\/g, "/"); - let found = false; - const result = _remapping()(rootless(map), (s, ctx) => { - if (s === source && !found) { - found = true; - ctx.source = ""; - return rootless(inputMap); - } - return null; - }); - if (typeof inputMap.sourceRoot === "string") { - result.sourceRoot = inputMap.sourceRoot; - } - return Object.assign({}, result); -} diff --git a/src/file-viewer/highlight-grammar/php.plist b/src/file-viewer/highlight-grammar/php.plist deleted file mode 100644 index e69de29..0000000 diff --git a/src/file-viewer/highlight-grammar/powershell.plist b/src/file-viewer/highlight-grammar/powershell.plist deleted file mode 100644 index 4d462db..0000000 --- a/src/file-viewer/highlight-grammar/powershell.plist +++ /dev/null @@ -1,676 +0,0 @@ -// SEMVER_SPEC_VERSION -2.0.0 - -// re -/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*\*/ - -// safeRe -/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}\*/ - -// src -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]),,(?:~>?),(\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*\* - -// tokens -[object Object] - -// parse -function parse (version, options) { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } - - if (version instanceof SemVer) { - return version - } - - if (typeof version !== 'string') { - return null - } - - if (version.length > MAX_LENGTH) { - return null - } - - var r = options.loose ? safeRe[t.LOOSE] : safeRe[t.FULL] - if (!r.test(version)) { - return null - } - - try { - return new SemVer(version, options) - } catch (er) { - return null - } -} - -// valid -function valid (version, options) { - var v = parse(version, options) - return v ? v.version : null -} - -// clean -function clean (version, options) { - var s = parse(version.trim().replace(/^[=v]+/, ''), options) - return s ? s.version : null -} - -// SemVer -function SemVer (version, options) { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } - if (version instanceof SemVer) { - if (version.loose === options.loose) { - return version - } else { - version = version.version - } - } else if (typeof version !== 'string') { - throw new TypeError('Invalid Version: ' + version) - } - - if (version.length > MAX_LENGTH) { - throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters') - } - - if (!(this instanceof SemVer)) { - return new SemVer(version, options) - } - - debug('SemVer', version, options) - this.options = options - this.loose = !!options.loose - - var m = version.trim().match(options.loose ? safeRe[t.LOOSE] : safeRe[t.FULL]) - - if (!m) { - throw new TypeError('Invalid Version: ' + version) - } - - this.raw = version - - // these are actually numbers - this.major = +m[1] - this.minor = +m[2] - this.patch = +m[3] - - if (this.major > MAX_SAFE_INTEGER || this.major < 0) { - throw new TypeError('Invalid major version') - } - - if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { - throw new TypeError('Invalid minor version') - } - - if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { - throw new TypeError('Invalid patch version') - } - - // numberify any prerelease numeric ids - if (!m[4]) { - this.prerelease = [] - } else { - this.prerelease = m[4].split('.').map(function (id) { - if (/^[0-9]+$/.test(id)) { - var num = +id - if (num >= 0 && num < MAX_SAFE_INTEGER) { - return num - } - } - return id - }) - } - - this.build = m[5] ? m[5].split('.') : [] - this.format() -} - -// inc -function inc (version, release, loose, identifier) { - if (typeof (loose) === 'string') { - identifier = loose - loose = undefined - } - - try { - return new SemVer(version, loose).inc(release, identifier).version - } catch (er) { - return null - } -} - -// diff -function diff (version1, version2) { - if (eq(version1, version2)) { - return null - } else { - var v1 = parse(version1) - var v2 = parse(version2) - var prefix = '' - if (v1.prerelease.length || v2.prerelease.length) { - prefix = 'pre' - var defaultResult = 'prerelease' - } - for (var key in v1) { - if (key === 'major' || key === 'minor' || key === 'patch') { - if (v1[key] !== v2[key]) { - return prefix + key - } - } - } - return defaultResult // may be undefined - } -} - -// compareIdentifiers -function compareIdentifiers (a, b) { - var anum = numeric.test(a) - var bnum = numeric.test(b) - - if (anum && bnum) { - a = +a - b = +b - } - - return a === b ? 0 - : (anum && !bnum) ? -1 - : (bnum && !anum) ? 1 - : a < b ? -1 - : 1 -} - -// rcompareIdentifiers -function rcompareIdentifiers (a, b) { - return compareIdentifiers(b, a) -} - -// major -function major (a, loose) { - return new SemVer(a, loose).major -} - -// minor -function minor (a, loose) { - return new SemVer(a, loose).minor -} - -// patch -function patch (a, loose) { - return new SemVer(a, loose).patch -} - -// compare -function compare (a, b, loose) { - return new SemVer(a, loose).compare(new SemVer(b, loose)) -} - -// compareLoose -function compareLoose (a, b) { - return compare(a, b, true) -} - -// compareBuild -function compareBuild (a, b, loose) { - var versionA = new SemVer(a, loose) - var versionB = new SemVer(b, loose) - return versionA.compare(versionB) || versionA.compareBuild(versionB) -} - -// rcompare -function rcompare (a, b, loose) { - return compare(b, a, loose) -} - -// sort -function sort (list, loose) { - return list.sort(function (a, b) { - return exports.compareBuild(a, b, loose) - }) -} - -// rsort -function rsort (list, loose) { - return list.sort(function (a, b) { - return exports.compareBuild(b, a, loose) - }) -} - -// gt -function gt (a, b, loose) { - return compare(a, b, loose) > 0 -} - -// lt -function lt (a, b, loose) { - return compare(a, b, loose) < 0 -} - -// eq -function eq (a, b, loose) { - return compare(a, b, loose) === 0 -} - -// neq -function neq (a, b, loose) { - return compare(a, b, loose) !== 0 -} - -// gte -function gte (a, b, loose) { - return compare(a, b, loose) >= 0 -} - -// lte -function lte (a, b, loose) { - return compare(a, b, loose) <= 0 -} - -// cmp -function cmp (a, op, b, loose) { - switch (op) { - case '===': - if (typeof a === 'object') - a = a.version - if (typeof b === 'object') - b = b.version - return a === b - - case '!==': - if (typeof a === 'object') - a = a.version - if (typeof b === 'object') - b = b.version - return a !== b - - case '': - case '=': - case '==': - return eq(a, b, loose) - - case '!=': - return neq(a, b, loose) - - case '>': - return gt(a, b, loose) - - case '>=': - return gte(a, b, loose) - - case '<': - return lt(a, b, loose) - - case '<=': - return lte(a, b, loose) - - default: - throw new TypeError('Invalid operator: ' + op) - } -} - -// Comparator -function Comparator (comp, options) { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } - - if (comp instanceof Comparator) { - if (comp.loose === !!options.loose) { - return comp - } else { - comp = comp.value - } - } - - if (!(this instanceof Comparator)) { - return new Comparator(comp, options) - } - - comp = comp.trim().split(/\s+/).join(' ') - debug('comparator', comp, options) - this.options = options - this.loose = !!options.loose - this.parse(comp) - - if (this.semver === ANY) { - this.value = '' - } else { - this.value = this.operator + this.semver.version - } - - debug('comp', this) -} - -// Range -function Range (range, options) { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } - - if (range instanceof Range) { - if (range.loose === !!options.loose && - range.includePrerelease === !!options.includePrerelease) { - return range - } else { - return new Range(range.raw, options) - } - } - - if (range instanceof Comparator) { - return new Range(range.value, options) - } - - if (!(this instanceof Range)) { - return new Range(range, options) - } - - this.options = options - this.loose = !!options.loose - this.includePrerelease = !!options.includePrerelease - - // First reduce all whitespace as much as possible so we do not have to rely - // on potentially slow regexes like \s*. This is then stored and used for - // future error messages as well. - this.raw = range - .trim() - .split(/\s+/) - .join(' ') - - // First, split based on boolean or || - this.set = this.raw.split('||').map(function (range) { - return this.parseRange(range.trim()) - }, this).filter(function (c) { - // throw out any that are not relevant for whatever reason - return c.length - }) - - if (!this.set.length) { - throw new TypeError('Invalid SemVer Range: ' + this.raw) - } - - this.format() -} - -// toComparators -function toComparators (range, options) { - return new Range(range, options).set.map(function (comp) { - return comp.map(function (c) { - return c.value - }).join(' ').trim().split(' ') - }) -} - -// satisfies -function satisfies (version, range, options) { - try { - range = new Range(range, options) - } catch (er) { - return false - } - return range.test(version) -} - -// maxSatisfying -function maxSatisfying (versions, range, options) { - var max = null - var maxSV = null - try { - var rangeObj = new Range(range, options) - } catch (er) { - return null - } - versions.forEach(function (v) { - if (rangeObj.test(v)) { - // satisfies(v, range, options) - if (!max || maxSV.compare(v) === -1) { - // compare(max, v, true) - max = v - maxSV = new SemVer(max, options) - } - } - }) - return max -} - -// minSatisfying -function minSatisfying (versions, range, options) { - var min = null - var minSV = null - try { - var rangeObj = new Range(range, options) - } catch (er) { - return null - } - versions.forEach(function (v) { - if (rangeObj.test(v)) { - // satisfies(v, range, options) - if (!min || minSV.compare(v) === 1) { - // compare(min, v, true) - min = v - minSV = new SemVer(min, options) - } - } - }) - return min -} - -// minVersion -function minVersion (range, loose) { - range = new Range(range, loose) - - var minver = new SemVer('0.0.0') - if (range.test(minver)) { - return minver - } - - minver = new SemVer('0.0.0-0') - if (range.test(minver)) { - return minver - } - - minver = null - for (var i = 0; i < range.set.length; ++i) { - var comparators = range.set[i] - - comparators.forEach(function (comparator) { - // Clone to avoid manipulating the comparator's semver object. - var compver = new SemVer(comparator.semver.version) - switch (comparator.operator) { - case '>': - if (compver.prerelease.length === 0) { - compver.patch++ - } else { - compver.prerelease.push(0) - } - compver.raw = compver.format() - /* fallthrough */ - case '': - case '>=': - if (!minver || gt(minver, compver)) { - minver = compver - } - break - case '<': - case '<=': - /* Ignore maximum versions */ - break - /* istanbul ignore next */ - default: - throw new Error('Unexpected operation: ' + comparator.operator) - } - }) - } - - if (minver && range.test(minver)) { - return minver - } - - return null -} - -// validRange -function validRange (range, options) { - try { - // Return '*' instead of '' so that truthiness works. - // This will throw if it's invalid anyway - return new Range(range, options).range || '*' - } catch (er) { - return null - } -} - -// ltr -function ltr (version, range, options) { - return outside(version, range, '<', options) -} - -// gtr -function gtr (version, range, options) { - return outside(version, range, '>', options) -} - -// outside -function outside (version, range, hilo, options) { - version = new SemVer(version, options) - range = new Range(range, options) - - var gtfn, ltefn, ltfn, comp, ecomp - switch (hilo) { - case '>': - gtfn = gt - ltefn = lte - ltfn = lt - comp = '>' - ecomp = '>=' - break - case '<': - gtfn = lt - ltefn = gte - ltfn = gt - comp = '<' - ecomp = '<=' - break - default: - throw new TypeError('Must provide a hilo val of "<" or ">"') - } - - // If it satisifes the range it is not outside - if (satisfies(version, range, options)) { - return false - } - - // From now on, variable terms are as if we're in "gtr" mode. - // but note that everything is flipped for the "ltr" function. - - for (var i = 0; i < range.set.length; ++i) { - var comparators = range.set[i] - - var high = null - var low = null - - comparators.forEach(function (comparator) { - if (comparator.semver === ANY) { - comparator = new Comparator('>=0.0.0') - } - high = high || comparator - low = low || comparator - if (gtfn(comparator.semver, high.semver, options)) { - high = comparator - } else if (ltfn(comparator.semver, low.semver, options)) { - low = comparator - } - }) - - // If the edge version comparator has a operator then our version - // isn't outside it - if (high.operator === comp || high.operator === ecomp) { - return false - } - - // If the lowest version comparator has an operator and our version - // is less than it then it isn't higher than the range - if ((!low.operator || low.operator === comp) && - ltefn(version, low.semver)) { - return false - } else if (low.operator === ecomp && ltfn(version, low.semver)) { - return false - } - } - return true -} - -// prerelease -function prerelease (version, options) { - var parsed = parse(version, options) - return (parsed && parsed.prerelease.length) ? parsed.prerelease : null -} - -// intersects -function intersects (r1, r2, options) { - r1 = new Range(r1, options) - r2 = new Range(r2, options) - return r1.intersects(r2) -} - -// coerce -function coerce (version, options) { - if (version instanceof SemVer) { - return version - } - - if (typeof version === 'number') { - version = String(version) - } - - if (typeof version !== 'string') { - return null - } - - options = options || {} - - var match = null - if (!options.rtl) { - match = version.match(safeRe[t.COERCE]) - } else { - // Find the right-most coercible string that does not share - // a terminus with a more left-ward coercible string. - // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4' - // - // Walk through the string checking with a /g regexp - // Manually set the index so as to pick up overlapping matches. - // Stop when we get a match that ends at the string end, since no - // coercible string can be more right-ward without the same terminus. - var next - while ((next = safeRe[t.COERCERTL].exec(version)) && - (!match || match.index + match[0].length !== version.length) - ) { - if (!match || - next.index + next[0].length !== match.index + match[0].length) { - match = next - } - safeRe[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length - } - // leave it in a clean state - safeRe[t.COERCERTL].lastIndex = -1 - } - - if (match === null) { - return null - } - - return parse(match[2] + - '.' + (match[3] || '0') + - '.' + (match[4] || '0'), options) -} diff --git a/src/file-viewer/highlight-grammar/python.plist b/src/file-viewer/highlight-grammar/python.plist deleted file mode 100644 index b0d8049..0000000 --- a/src/file-viewer/highlight-grammar/python.plist +++ /dev/null @@ -1,33 +0,0 @@ -// loadPlugin -function* loadPlugin(name, dirname) { - const { - filepath, - loader - } = resolvePlugin(name, dirname, yield* (0, _async.isAsync)()); - const value = yield* requireModule("plugin", loader, filepath); - debug("Loaded plugin %o from %o.", name, dirname); - return { - filepath, - value - }; -} - -// loadPreset -function* loadPreset(name, dirname) { - const { - filepath, - loader - } = resolvePreset(name, dirname, yield* (0, _async.isAsync)()); - const value = yield* requireModule("preset", loader, filepath); - debug("Loaded preset %o from %o.", name, dirname); - return { - filepath, - value - }; -} - -// resolvePlugin -function () { [native code] } - -// resolvePreset -function () { [native code] } diff --git a/src/file-viewer/highlight-grammar/shell.plist b/src/file-viewer/highlight-grammar/shell.plist deleted file mode 100644 index 9e971ca..0000000 --- a/src/file-viewer/highlight-grammar/shell.plist +++ /dev/null @@ -1,52 +0,0 @@ -// moduleResolve -function moduleResolve(specifier, base, conditions, preserveSymlinks) { - const protocol = base.protocol; - const isData = protocol === 'data:'; - const isRemote = isData || protocol === 'http:' || protocol === 'https:'; - let resolved; - if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) { - try { - resolved = new (_url().URL)(specifier, base); - } catch (error_) { - const error = new ERR_UNSUPPORTED_RESOLVE_REQUEST(specifier, base); - error.cause = error_; - throw error; - } - } else if (protocol === 'file:' && specifier[0] === '#') { - resolved = packageImportsResolve(specifier, base, conditions); - } else { - try { - resolved = new (_url().URL)(specifier); - } catch (error_) { - if (isRemote && !_module().builtinModules.includes(specifier)) { - const error = new ERR_UNSUPPORTED_RESOLVE_REQUEST(specifier, base); - error.cause = error_; - throw error; - } - resolved = packageResolve(specifier, base, conditions); - } - } - _assert()(resolved !== undefined, 'expected to be defined'); - if (resolved.protocol !== 'file:') { - return resolved; - } - return finalizeResolution(resolved, base, preserveSymlinks); -} - -// resolve -function resolve(specifier, parent) { - if (!parent) { - throw new Error('Please pass `parent`: `import-meta-resolve` cannot ponyfill that'); - } - try { - return defaultResolve(specifier, { - parentURL: parent - }).url; - } catch (error) { - const exception = error; - if ((exception.code === 'ERR_UNSUPPORTED_DIR_IMPORT' || exception.code === 'ERR_MODULE_NOT_FOUND') && typeof exception.url === 'string') { - return exception.url; - } - throw error; - } -} diff --git a/src/file-viewer/highlight-grammar/toml.plist b/src/file-viewer/highlight-grammar/toml.plist deleted file mode 100644 index baa779f..0000000 --- a/src/file-viewer/highlight-grammar/toml.plist +++ /dev/null @@ -1,28 +0,0 @@ -// transform -function transform(code, optsOrCallback, maybeCallback) { - let opts; - let callback; - if (typeof optsOrCallback === "function") { - callback = optsOrCallback; - opts = undefined; - } else { - opts = optsOrCallback; - callback = maybeCallback; - } - if (callback === undefined) { - { - return (0, _rewriteStackTrace.beginHiddenCallStack)(transformRunner.sync)(code, opts); - } - } - (0, _rewriteStackTrace.beginHiddenCallStack)(transformRunner.errback)(code, opts, callback); -} - -// transformAsync -function transformAsync(...args) { - return (0, _rewriteStackTrace.beginHiddenCallStack)(transformRunner.async)(...args); -} - -// transformSync -function transformSync(...args) { - return (0, _rewriteStackTrace.beginHiddenCallStack)(transformRunner.sync)(...args); -} diff --git a/src/file-viewer/highlight-grammar/ts.plist b/src/file-viewer/highlight-grammar/ts.plist deleted file mode 100644 index 3ed250b..0000000 --- a/src/file-viewer/highlight-grammar/ts.plist +++ /dev/null @@ -1,28 +0,0 @@ -// transformFromAst -function transformFromAst(ast, code, optsOrCallback, maybeCallback) { - let opts; - let callback; - if (typeof optsOrCallback === "function") { - callback = optsOrCallback; - opts = undefined; - } else { - opts = optsOrCallback; - callback = maybeCallback; - } - if (callback === undefined) { - { - return (0, _rewriteStackTrace.beginHiddenCallStack)(transformFromAstRunner.sync)(ast, code, opts); - } - } - (0, _rewriteStackTrace.beginHiddenCallStack)(transformFromAstRunner.errback)(ast, code, opts, callback); -} - -// transformFromAstAsync -function transformFromAstAsync(...args) { - return (0, _rewriteStackTrace.beginHiddenCallStack)(transformFromAstRunner.async)(...args); -} - -// transformFromAstSync -function transformFromAstSync(...args) { - return (0, _rewriteStackTrace.beginHiddenCallStack)(transformFromAstRunner.sync)(...args); -} diff --git a/src/file-viewer/highlight-grammar/tsx.plist b/src/file-viewer/highlight-grammar/tsx.plist deleted file mode 100644 index 5f46536..0000000 --- a/src/file-viewer/highlight-grammar/tsx.plist +++ /dev/null @@ -1,23 +0,0 @@ -// parse -function parse(code, opts, callback) { - if (typeof opts === "function") { - callback = opts; - opts = undefined; - } - if (callback === undefined) { - { - return (0, _rewriteStackTrace.beginHiddenCallStack)(parseRunner.sync)(code, opts); - } - } - (0, _rewriteStackTrace.beginHiddenCallStack)(parseRunner.errback)(code, opts, callback); -} - -// parseAsync -function parseAsync(...args) { - return (0, _rewriteStackTrace.beginHiddenCallStack)(parseRunner.async)(...args); -} - -// parseSync -function parseSync(...args) { - return (0, _rewriteStackTrace.beginHiddenCallStack)(parseRunner.sync)(...args); -} diff --git a/src/file-viewer/highlight-grammar/xml.plist b/src/file-viewer/highlight-grammar/xml.plist deleted file mode 100644 index fbacf2b..0000000 --- a/src/file-viewer/highlight-grammar/xml.plist +++ /dev/null @@ -1,10 +0,0 @@ -// default -(api, options, dirname) => { - let clonedApi; - for (const name of Object.keys(apiPolyfills)) { - if (api[name]) continue; - clonedApi != null ? clonedApi : clonedApi = copyApiObject(api); - clonedApi[name] = apiPolyfills[name](clonedApi); - } - return builder(clonedApi != null ? clonedApi : api, options || {}, dirname); - } diff --git a/src/file-viewer/highlight-grammar/yaml.plist b/src/file-viewer/highlight-grammar/yaml.plist deleted file mode 100644 index c43bddb..0000000 --- a/src/file-viewer/highlight-grammar/yaml.plist +++ /dev/null @@ -1,25 +0,0 @@ -// declare -function declare(builder) { - return (api, options, dirname) => { - let clonedApi; - for (const name of Object.keys(apiPolyfills)) { - if (api[name]) continue; - clonedApi != null ? clonedApi : clonedApi = copyApiObject(api); - clonedApi[name] = apiPolyfills[name](clonedApi); - } - return builder(clonedApi != null ? clonedApi : api, options || {}, dirname); - }; -} - -// declarePreset -function declare(builder) { - return (api, options, dirname) => { - let clonedApi; - for (const name of Object.keys(apiPolyfills)) { - if (api[name]) continue; - clonedApi != null ? clonedApi : clonedApi = copyApiObject(api); - clonedApi[name] = apiPolyfills[name](clonedApi); - } - return builder(clonedApi != null ? clonedApi : api, options || {}, dirname); - }; -} diff --git a/src/file-viewer/highlight-grammar/zig.plist b/src/file-viewer/highlight-grammar/zig.plist deleted file mode 100644 index 0fb6dae..0000000 --- a/src/file-viewer/highlight-grammar/zig.plist +++ /dev/null @@ -1,17 +0,0 @@ -// default -(api, options, dirname) => { - let clonedApi; - for (const name of Object.keys(apiPolyfills)) { - if (api[name]) continue; - clonedApi != null ? clonedApi : clonedApi = copyApiObject(api); - clonedApi[name] = apiPolyfills[name](clonedApi); - } - return builder(clonedApi != null ? clonedApi : api, options || {}, dirname); - } - -// defineCommonJSHook -function defineCommonJSHook(file, hook) { - let hooks = file.get(commonJSHooksKey); - if (!hooks) file.set(commonJSHooksKey, hooks = []); - hooks.push(hook); -} diff --git a/src/file-viewer/highlight.ts b/src/file-viewer/highlight.ts deleted file mode 100644 index c1c6c5b..0000000 --- a/src/file-viewer/highlight.ts +++ /dev/null @@ -1,200 +0,0 @@ -// buildDynamicImport -function buildDynamicImport(node, deferToThen, wrapWithPromise, builder) { - const specifier = _core.types.isCallExpression(node) ? node.arguments[0] : node.source; - if (_core.types.isStringLiteral(specifier) || _core.types.isTemplateLiteral(specifier) && specifier.quasis.length === 0) { - if (deferToThen) { - return _core.template.expression.ast` - Promise.resolve().then(() => ${builder(specifier)}) - `; - } else return builder(specifier); - } - const specifierToString = _core.types.isTemplateLiteral(specifier) ? _core.types.identifier("specifier") : _core.types.templateLiteral([_core.types.templateElement({ - raw: "" - }), _core.types.templateElement({ - raw: "" - })], [_core.types.identifier("specifier")]); - if (deferToThen) { - return _core.template.expression.ast` - (specifier => - new Promise(r => r(${specifierToString})) - .then(s => ${builder(_core.types.identifier("s"))}) - )(${specifier}) - `; - } else if (wrapWithPromise) { - return _core.template.expression.ast` - (specifier => - new Promise(r => r(${builder(specifierToString)})) - )(${specifier}) - `; - } else { - return _core.template.expression.ast` - (specifier => ${builder(specifierToString)})(${specifier}) - `; - } -} - -// buildNamespaceInitStatements -function buildNamespaceInitStatements(metadata, sourceMetadata, constantReexports = false, wrapReference = Lazy.wrapReference) { - var _wrapReference; - const statements = []; - const srcNamespaceId = _core.types.identifier(sourceMetadata.name); - for (const localName of sourceMetadata.importsNamespace) { - if (localName === sourceMetadata.name) continue; - statements.push(_core.template.statement`var NAME = SOURCE;`({ - NAME: localName, - SOURCE: _core.types.cloneNode(srcNamespaceId) - })); - } - const srcNamespace = (_wrapReference = wrapReference(srcNamespaceId, sourceMetadata.wrap)) != null ? _wrapReference : srcNamespaceId; - if (constantReexports) { - statements.push(...buildReexportsFromMeta(metadata, sourceMetadata, true, wrapReference)); - } - for (const exportName of sourceMetadata.reexportNamespace) { - statements.push((!_core.types.isIdentifier(srcNamespace) ? _core.template.statement` - Object.defineProperty(EXPORTS, "NAME", { - enumerable: true, - get: function() { - return NAMESPACE; - } - }); - ` : _core.template.statement`EXPORTS.NAME = NAMESPACE;`)({ - EXPORTS: metadata.exportName, - NAME: exportName, - NAMESPACE: _core.types.cloneNode(srcNamespace) - })); - } - if (sourceMetadata.reexportAll) { - const statement = buildNamespaceReexport(metadata, _core.types.cloneNode(srcNamespace), constantReexports); - statement.loc = sourceMetadata.reexportAll.loc; - statements.push(statement); - } - return statements; -} - -// ensureStatementsHoisted -function ensureStatementsHoisted(statements) { - statements.forEach(header => { - header._blockHoist = 3; - }); -} - -// getModuleName -function getModuleName(rootOpts, pluginOpts) { - var _pluginOpts$moduleId, _pluginOpts$moduleIds, _pluginOpts$getModule, _pluginOpts$moduleRoo; - return originalGetModuleName(rootOpts, { - moduleId: (_pluginOpts$moduleId = pluginOpts.moduleId) != null ? _pluginOpts$moduleId : rootOpts.moduleId, - moduleIds: (_pluginOpts$moduleIds = pluginOpts.moduleIds) != null ? _pluginOpts$moduleIds : rootOpts.moduleIds, - getModuleId: (_pluginOpts$getModule = pluginOpts.getModuleId) != null ? _pluginOpts$getModule : rootOpts.getModuleId, - moduleRoot: (_pluginOpts$moduleRoo = pluginOpts.moduleRoot) != null ? _pluginOpts$moduleRoo : rootOpts.moduleRoot - }); - } - -// hasExports -function hasExports(metadata) { - return metadata.hasExports; -} - -// isModule -function isModule(path) { - return path.node.sourceType === "module"; -} - -// isSideEffectImport -function isSideEffectImport(source) { - return source.imports.size === 0 && source.importsNamespace.size === 0 && source.reexports.size === 0 && source.reexportNamespace.size === 0 && !source.reexportAll; -} - -// rewriteModuleStatementsAndPrepareHeader -function rewriteModuleStatementsAndPrepareHeader(path, { - exportName, - strict, - allowTopLevelThis, - strictMode, - noInterop, - importInterop = noInterop ? "none" : "babel", - lazy, - getWrapperPayload = Lazy.toGetWrapperPayload(lazy != null ? lazy : false), - wrapReference = Lazy.wrapReference, - esNamespaceOnly, - filename, - constantReexports = arguments[1].loose, - enumerableModuleMeta = arguments[1].loose, - noIncompleteNsImportDetection -}) { - (0, _normalizeAndLoadMetadata.validateImportInteropOption)(importInterop); - _assert((0, _helperModuleImports.isModule)(path), "Cannot process module statements in a script"); - path.node.sourceType = "script"; - const meta = (0, _normalizeAndLoadMetadata.default)(path, exportName, { - importInterop, - initializeReexports: constantReexports, - getWrapperPayload, - esNamespaceOnly, - filename - }); - if (!allowTopLevelThis) { - (0, _rewriteThis.default)(path); - } - (0, _rewriteLiveReferences.default)(path, meta, wrapReference); - if (strictMode !== false) { - const hasStrict = path.node.directives.some(directive => { - return directive.value.value === "use strict"; - }); - if (!hasStrict) { - path.unshiftContainer("directives", _core.types.directive(_core.types.directiveLiteral("use strict"))); - } - } - const headers = []; - if ((0, _normalizeAndLoadMetadata.hasExports)(meta) && !strict) { - headers.push(buildESModuleHeader(meta, enumerableModuleMeta)); - } - const nameList = buildExportNameListDeclaration(path, meta); - if (nameList) { - meta.exportNameListName = nameList.name; - headers.push(nameList.statement); - } - headers.push(...buildExportInitializationStatements(path, meta, wrapReference, constantReexports, noIncompleteNsImportDetection)); - return { - meta, - headers - }; -} - -// rewriteThis -function rewriteThis(programPath) { - if (!rewriteThisVisitor) { - rewriteThisVisitor = _traverse.visitors.environmentVisitor({ - ThisExpression(path) { - path.replaceWith(_core.types.unaryExpression("void", _core.types.numericLiteral(0), true)); - } - }); - rewriteThisVisitor.noScope = true; - } - (0, _traverse.default)(programPath.node, rewriteThisVisitor); -} - -// wrapInterop -function wrapInterop(programPath, expr, type) { - if (type === "none") { - return null; - } - if (type === "node-namespace") { - return _core.types.callExpression(programPath.hub.addHelper("interopRequireWildcard"), [expr, _core.types.booleanLiteral(true)]); - } else if (type === "node-default") { - return null; - } - let helper; - if (type === "default") { - helper = "interopRequireDefault"; - } else if (type === "namespace") { - helper = "interopRequireWildcard"; - } else { - throw new Error(`Unknown interop: ${type}`); - } - return _core.types.callExpression(programPath.hub.addHelper(helper), [expr]); -} - -// getDynamicImportSource -function getDynamicImportSource(node) { - const [source] = node.arguments; - return _core.types.isStringLiteral(source) || _core.types.isTemplateLiteral(source) ? source : _core.template.expression.ast`\`\${${source}}\``; - } diff --git a/src/file-viewer/mime.json b/src/file-viewer/mime.json deleted file mode 100644 index fa671cc..0000000 --- a/src/file-viewer/mime.json +++ /dev/null @@ -1,463 +0,0 @@ - - ".aac": "audio/x-aac", - ".aif": "audio/x-aiff", - ".aifc": "audio/x-aiff", - ".aiff": "audio/x-aiff", - ".apk": "application/vnd.android.package-archive", - ".asm": "text/x-asm", - ".bat": "application/x-msdownload", - ".bmp": "image/bmp", - ".c": "text/x-c", - ".cc": "text/x-c", - ".class": "application/java-vm", - ".com": "application/x-msdownload", - ".conf": "text/plain", - ".cpp": "text/x-c", - ".css": "text/css", - ".cxx": "text/x-c", - ".def": "text/plain", - ".diff": "text/plain", - ".dll": "application/x-msdownload", - ".doc": "application/msword", - ".docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", - ".epub": "application/epub+zip", - ".exe": "application/x-msdownload", - ".gif": "image/gif", - ".gz": "application/x-gzip", - ".h": "text/x-c", - ".hh": "text/x-c", - ".htm": "text/html;charset=utf-8", - ".html": "text/html;charset=utf-8", - ".ico": "image/x-icon", - ".ics": "text/calendar", - ".ifb": "text/calendar", - ".iso": "application/octet-stream", - ".jar": "application/java-archive", - ".java": "text/x-java-source", - ".jpe": "image/jpeg", - ".jpeg": "image/jpeg", - ".jpg": "image/jpeg", - ".jpgv": "video/jpeg", - ".js": "application/javascript", - ".json": "application/json", - ".latex": "application/x-latex", - ".list": "text/plain", - ".log": "text/plain", - ".chat": "text/plain", - ".m4a": "audio/mp4", - ".mid": "audio/midi", - ".midi": "audio/midi", - ".mov": "video/quicktime", - ".mp3": "audio/mpeg", - ".mp4": "video/mp4", - ".mp4a": "audio/mp4", - ".mp4v": "video/mp4", - ".mpa": "video/mpeg", - ".mpe": "video/mpeg", - ".mpeg": "video/mpeg", - ".mpg": "video/mpeg", - ".mpg4": "video/mp4", - ".mpga": "audio/mpeg", - ".mpkg": "application/vnd.apple.installer+xml", - ".msi": "application/x-msdownload", - - ".nb": "application/mathematica", - ".nc": "application/x-netcdf", - ".ncx": "application/x-dtbncx+xml", - ".ngdat": "application/vnd.nokia.n-gage.data", - ".nlu": "application/vnd.neurolanguage.nlu", - ".nml": "application/vnd.enliven", - ".nnd": "application/vnd.noblenet-directory", - ".nns": "application/vnd.noblenet-sealer", - ".nnw": "application/vnd.noblenet-web", - ".npx": "image/vnd.net-fpx", - ".nsf": "application/vnd.lotus-notes", - ".nws": "message/rfc822", - ".o": "application/octet-stream", - ".oa2": "application/vnd.fujitsu.oasys2", - ".oa3": "application/vnd.fujitsu.oasys3", - ".oas": "application/vnd.fujitsu.oasys", - ".obd": "application/x-msbinder", - ".obj": "application/octet-stream", - ".oda": "application/oda", - ".odb": "application/vnd.oasis.opendocument.database", - ".odc": "application/vnd.oasis.opendocument.chart", - ".odf": "application/vnd.oasis.opendocument.formula", - ".odft": "application/vnd.oasis.opendocument.formula-template", - ".odg": "application/vnd.oasis.opendocument.graphics", - ".odi": "application/vnd.oasis.opendocument.image", - ".odp": "application/vnd.oasis.opendocument.presentation", - ".ods": "application/vnd.oasis.opendocument.spreadsheet", - ".odt": "application/vnd.oasis.opendocument.text", - ".oga": "audio/ogg", - ".ogg": "audio/ogg", - ".ogv": "video/ogg", - ".ogx": "application/ogg", - ".onepkg": "application/onenote", - ".onetmp": "application/onenote", - ".onetoc": "application/onenote", - ".onetoc2": "application/onenote", - ".opf": "application/oebps-package+xml", - ".oprc": "application/vnd.palm", - ".org": "application/vnd.lotus-organizer", - ".osf": "application/vnd.yamaha.openscoreformat", - ".osfpvg": "application/vnd.yamaha.openscoreformat.osfpvg+xml", - ".otc": "application/vnd.oasis.opendocument.chart-template", - ".otf": "application/x-font-otf", - ".otg": "application/vnd.oasis.opendocument.graphics-template", - ".oth": "application/vnd.oasis.opendocument.text-web", - ".oti": "application/vnd.oasis.opendocument.image-template", - ".otm": "application/vnd.oasis.opendocument.text-master", - ".otp": "application/vnd.oasis.opendocument.presentation-template", - ".ots": "application/vnd.oasis.opendocument.spreadsheet-template", - ".ott": "application/vnd.oasis.opendocument.text-template", - ".oxt": "application/vnd.openofficeorg.extension", - ".p": "text/x-pascal", - ".p10": "application/pkcs10", - ".p12": "application/x-pkcs12", - ".p7b": "application/x-pkcs7-certificates", - ".p7c": "application/pkcs7-mime", - ".p7m": "application/pkcs7-mime", - ".p7r": "application/x-pkcs7-certreqresp", - ".p7s": "application/pkcs7-signature", - ".pas": "text/x-pascal", - ".pbd": "application/vnd.powerbuilder6", - ".pbm": "image/x-portable-bitmap", - ".pcf": "application/x-font-pcf", - ".pcl": "application/vnd.hp-pcl", - ".pclxl": "application/vnd.hp-pclxl", - ".pct": "image/x-pict", - ".pcurl": "application/vnd.curl.pcurl", - ".pcx": "image/x-pcx", - ".pdb": "application/vnd.palm", - ".pdf": "application/pdf", - ".pfa": "application/x-font-type1", - ".pfb": "application/x-font-type1", - ".pfm": "application/x-font-type1", - ".pfr": "application/font-tdpfr", - ".pfx": "application/x-pkcs12", - ".pgm": "image/x-portable-graymap", - ".pgn": "application/x-chess-pgn", - ".pgp": "application/pgp-encrypted", - ".pic": "image/x-pict", - ".pkg": "application/octet-stream", - ".pki": "application/pkixcmp", - ".pkipath": "application/pkix-pkipath", - ".pl": "text/plain", - ".plb": "application/vnd.3gpp.pic-bw-large", - ".plc": "application/vnd.mobius.plc", - ".plf": "application/vnd.pocketlearn", - ".pls": "application/pls+xml", - ".pml": "application/vnd.ctc-posml", - ".png": "image/png", - ".pnm": "image/x-portable-anymap", - ".portpkg": "application/vnd.macports.portpkg", - ".pot": "application/vnd.ms-powerpoint", - ".potm": "application/vnd.ms-powerpoint.template.macroenabled.12", - ".potx": "application/vnd.openxmlformats-officedocument.presentationml.template", - ".ppa": "application/vnd.ms-powerpoint", - ".ppam": "application/vnd.ms-powerpoint.addin.macroenabled.12", - ".ppd": "application/vnd.cups-ppd", - ".ppm": "image/x-portable-pixmap", - ".pps": "application/vnd.ms-powerpoint", - ".ppsm": "application/vnd.ms-powerpoint.slideshow.macroenabled.12", - ".ppsx": "application/vnd.openxmlformats-officedocument.presentationml.slideshow", - ".ppt": "application/vnd.ms-powerpoint", - ".pptm": "application/vnd.ms-powerpoint.presentation.macroenabled.12", - ".pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation", - ".pqa": "application/vnd.palm", - ".prc": "application/x-mobipocket-ebook", - ".pre": "application/vnd.lotus-freelance", - ".prf": "application/pics-rules", - ".ps": "application/postscript", - ".psb": "application/vnd.3gpp.pic-bw-small", - ".psd": "image/vnd.adobe.photoshop", - ".psf": "application/x-font-linux-psf", - ".ptid": "application/vnd.pvi.ptid1", - ".pub": "application/x-mspublisher", - ".pvb": "application/vnd.3gpp.pic-bw-var", - ".pwn": "application/vnd.3m.post-it-notes", - ".pwz": "application/vnd.ms-powerpoint", - ".py": "text/x-python", - ".pya": "audio/vnd.ms-playready.media.pya", - ".pyc": "application/x-python-code", - ".pyo": "application/x-python-code", - ".pyv": "video/vnd.ms-playready.media.pyv", - ".qam": "application/vnd.epson.quickanime", - ".qbo": "application/vnd.intu.qbo", - ".qfx": "application/vnd.intu.qfx", - ".qps": "application/vnd.publishare-delta-tree", - ".qt": "video/quicktime", - ".qwd": "application/vnd.quark.quarkxpress", - ".qwt": "application/vnd.quark.quarkxpress", - ".qxb": "application/vnd.quark.quarkxpress", - ".qxd": "application/vnd.quark.quarkxpress", - ".qxl": "application/vnd.quark.quarkxpress", - ".qxt": "application/vnd.quark.quarkxpress", - ".ra": "audio/x-pn-realaudio", - ".ram": "audio/x-pn-realaudio", - ".rar": "application/x-rar-compressed", - ".ras": "image/x-cmu-raster", - ".rcprofile": "application/vnd.ipunplugged.rcprofile", - ".rdf": "application/rdf+xml", - ".rdz": "application/vnd.data-vision.rdz", - ".rep": "application/vnd.businessobjects", - ".res": "application/x-dtbresource+xml", - ".rgb": "image/x-rgb", - ".rif": "application/reginfo+xml", - ".rl": "application/resource-lists+xml", - ".rlc": "image/vnd.fujixerox.edmics-rlc", - ".rld": "application/resource-lists-diff+xml", - ".rm": "application/vnd.rn-realmedia", - ".rmi": "audio/midi", - ".rmp": "audio/x-pn-realaudio-plugin", - ".rms": "application/vnd.jcp.javame.midlet-rms", - ".rnc": "application/relax-ng-compact-syntax", - ".roff": "text/troff", - ".rpm": "application/x-rpm", - ".rpss": "application/vnd.nokia.radio-presets", - ".rpst": "application/vnd.nokia.radio-preset", - ".rq": "application/sparql-query", - ".rs": "application/rls-services+xml", - ".rsd": "application/rsd+xml", - ".rss": "application/rss+xml", - ".rtf": "application/rtf", - ".rtx": "text/richtext", - ".s": "text/x-asm", - ".saf": "application/vnd.yamaha.smaf-audio", - ".sbml": "application/sbml+xml", - ".sc": "application/vnd.ibm.secure-container", - ".scd": "application/x-msschedule", - ".scm": "application/vnd.lotus-screencam", - ".scq": "application/scvp-cv-request", - ".scs": "application/scvp-cv-response", - ".scurl": "text/vnd.curl.scurl", - ".sda": "application/vnd.stardivision.draw", - ".sdc": "application/vnd.stardivision.calc", - ".sdd": "application/vnd.stardivision.impress", - ".sdkd": "application/vnd.solent.sdkm+xml", - ".sdkm": "application/vnd.solent.sdkm+xml", - ".sdp": "application/sdp", - ".sdw": "application/vnd.stardivision.writer", - ".see": "application/vnd.seemail", - ".seed": "application/vnd.fdsn.seed", - ".sema": "application/vnd.sema", - ".semd": "application/vnd.semd", - ".semf": "application/vnd.semf", - ".ser": "application/java-serialized-object", - ".setpay": "application/set-payment-initiation", - ".setreg": "application/set-registration-initiation", - ".sfd-hdstx": "application/vnd.hydrostatix.sof-data", - ".sfs": "application/vnd.spotfire.sfs", - ".sgl": "application/vnd.stardivision.writer-global", - ".sgm": "text/sgml", - ".sgml": "text/sgml", - ".sh": "application/x-sh", - ".shar": "application/x-shar", - ".shf": "application/shf+xml", - ".si": "text/vnd.wap.si", - ".sic": "application/vnd.wap.sic", - ".sig": "application/pgp-signature", - ".silo": "model/mesh", - ".sis": "application/vnd.symbian.install", - ".sisx": "application/vnd.symbian.install", - ".sit": "application/x-stuffit", - ".sitx": "application/x-stuffitx", - ".skd": "application/vnd.koan", - ".skm": "application/vnd.koan", - ".skp": "application/vnd.koan", - ".skt": "application/vnd.koan", - ".sl": "text/vnd.wap.sl", - ".slc": "application/vnd.wap.slc", - ".sldm": "application/vnd.ms-powerpoint.slide.macroenabled.12", - ".sldx": "application/vnd.openxmlformats-officedocument.presentationml.slide", - ".slt": "application/vnd.epson.salt", - ".smf": "application/vnd.stardivision.math", - ".smi": "application/smil+xml", - ".smil": "application/smil+xml", - ".snd": "audio/basic", - ".snf": "application/x-font-snf", - ".so": "application/octet-stream", - ".spc": "application/x-pkcs7-certificates", - ".spf": "application/vnd.yamaha.smaf-phrase", - ".spl": "application/x-futuresplash", - ".spot": "text/vnd.in3d.spot", - ".spp": "application/scvp-vp-response", - ".spq": "application/scvp-vp-request", - ".spx": "audio/ogg", - ".src": "application/x-wais-source", - ".srx": "application/sparql-results+xml", - ".sse": "application/vnd.kodak-descriptor", - ".ssf": "application/vnd.epson.ssf", - ".ssml": "application/ssml+xml", - ".stc": "application/vnd.sun.xml.calc.template", - ".std": "application/vnd.sun.xml.draw.template", - ".stf": "application/vnd.wt.stf", - ".sti": "application/vnd.sun.xml.impress.template", - ".stk": "application/hyperstudio", - ".stl": "application/vnd.ms-pki.stl", - ".str": "application/vnd.pg.format", - ".stw": "application/vnd.sun.xml.writer.template", - ".sus": "application/vnd.sus-calendar", - ".susp": "application/vnd.sus-calendar", - ".sv4cpio": "application/x-sv4cpio", - ".sv4crc": "application/x-sv4crc", - ".svd": "application/vnd.svd", - ".svg": "image/svg+xml", - ".svgz": "image/svg+xml", - ".swa": "application/x-director", - ".swf": "application/x-shockwave-flash", - ".swi": "application/vnd.arastra.swi", - ".sxc": "application/vnd.sun.xml.calc", - ".sxd": "application/vnd.sun.xml.draw", - ".sxg": "application/vnd.sun.xml.writer.global", - ".sxi": "application/vnd.sun.xml.impress", - ".sxm": "application/vnd.sun.xml.math", - ".sxw": "application/vnd.sun.xml.writer", - ".t": "text/troff", - ".tao": "application/vnd.tao.intent-module-archive", - ".tar": "application/x-tar", - ".tcap": "application/vnd.3gpp2.tcap", - ".tcl": "application/x-tcl", - ".teacher": "application/vnd.smart.teacher", - ".tex": "application/x-tex", - ".texi": "application/x-texinfo", - ".texinfo": "application/x-texinfo", - ".text": "text/plain", - ".tfm": "application/x-tex-tfm", - ".tgz": "application/x-gzip", - ".tif": "image/tiff", - ".tiff": "image/tiff", - ".tmo": "application/vnd.tmobile-livetv", - ".torrent": "application/x-bittorrent", - ".tpl": "application/vnd.groove-tool-template", - ".tpt": "application/vnd.trid.tpt", - ".tr": "text/troff", - ".tra": "application/vnd.trueapp", - ".trm": "application/x-msterminal", - ".tsv": "text/tab-separated-values", - ".ttc": "application/x-font-ttf", - ".ttf": "application/x-font-ttf", - ".twd": "application/vnd.simtech-mindmapper", - ".twds": "application/vnd.simtech-mindmapper", - ".txd": "application/vnd.genomatix.tuxedo", - ".txf": "application/vnd.mobius.txf", - ".txt": "text/plain", - ".u32": "application/x-authorware-bin", - ".udeb": "application/x-debian-package", - ".ufd": "application/vnd.ufdl", - ".ufdl": "application/vnd.ufdl", - ".umj": "application/vnd.umajin", - ".unityweb": "application/vnd.unity", - ".uoml": "application/vnd.uoml+xml", - ".uri": "text/uri-list", - ".uris": "text/uri-list", - ".urls": "text/uri-list", - ".ustar": "application/x-ustar", - ".utz": "application/vnd.uiq.theme", - ".uu": "text/x-uuencode", - ".vcd": "application/x-cdlink", - ".vcf": "text/x-vcard", - ".vcg": "application/vnd.groove-vcard", - ".vcs": "text/x-vcalendar", - ".vcx": "application/vnd.vcx", - ".vis": "application/vnd.visionary", - ".viv": "video/vnd.vivo", - ".vor": "application/vnd.stardivision.writer", - ".vox": "application/x-authorware-bin", - ".vrml": "model/vrml", - ".vsd": "application/vnd.visio", - ".vsf": "application/vnd.vsf", - ".vss": "application/vnd.visio", - ".vst": "application/vnd.visio", - ".vsw": "application/vnd.visio", - ".vtu": "model/vnd.vtu", - ".vxml": "application/voicexml+xml", - ".w3d": "application/x-director", - ".wad": "application/x-doom", - ".wav": "audio/x-wav", - ".wax": "audio/x-ms-wax", - ".wbmp": "image/vnd.wap.wbmp", - ".wbs": "application/vnd.criticaltools.wbs+xml", - ".wbxml": "application/vnd.wap.wbxml", - ".wcm": "application/vnd.ms-works", - ".wdb": "application/vnd.ms-works", - ".wiz": "application/msword", - ".wks": "application/vnd.ms-works", - ".wm": "video/x-ms-wm", - ".wma": "audio/x-ms-wma", - ".wmd": "application/x-ms-wmd", - ".wmf": "application/x-msmetafile", - ".wml": "text/vnd.wap.wml", - ".wmlc": "application/vnd.wap.wmlc", - ".wmls": "text/vnd.wap.wmlscript", - ".wmlsc": "application/vnd.wap.wmlscriptc", - ".wmv": "video/x-ms-wmv", - ".wmx": "video/x-ms-wmx", - ".wmz": "application/x-ms-wmz", - ".wpd": "application/vnd.wordperfect", - ".wpl": "application/vnd.ms-wpl", - ".wps": "application/vnd.ms-works", - ".wqd": "application/vnd.wqd", - ".wri": "application/x-mswrite", - ".wrl": "model/vrml", - ".wsdl": "application/wsdl+xml", - ".wspolicy": "application/wspolicy+xml", - ".wtb": "application/vnd.webturbo", - ".wvx": "video/x-ms-wvx", - ".x32": "application/x-authorware-bin", - ".x3d": "application/vnd.hzn-3d-crossword", - ".xap": "application/x-silverlight-app", - ".xar": "application/vnd.xara", - ".xbap": "application/x-ms-xbap", - ".xbd": "application/vnd.fujixerox.docuworks.binder", - ".xbm": "image/x-xbitmap", - ".xdm": "application/vnd.syncml.dm+xml", - ".xdp": "application/vnd.adobe.xdp+xml", - ".xdw": "application/vnd.fujixerox.docuworks", - ".xenc": "application/xenc+xml", - ".xer": "application/patch-ops-error+xml", - ".xfdf": "application/vnd.adobe.xfdf", - ".xfdl": "application/vnd.xfdl", - ".xht": "application/xhtml+xml", - ".xhtml": "application/xhtml+xml", - ".xhvml": "application/xv+xml", - ".xif": "image/vnd.xiff", - ".xla": "application/vnd.ms-excel", - ".xlam": "application/vnd.ms-excel.addin.macroenabled.12", - ".xlb": "application/vnd.ms-excel", - ".xlc": "application/vnd.ms-excel", - ".xlm": "application/vnd.ms-excel", - ".xls": "application/vnd.ms-excel", - ".xlsb": "application/vnd.ms-excel.sheet.binary.macroenabled.12", - ".xlsm": "application/vnd.ms-excel.sheet.macroenabled.12", - ".xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", - ".xlt": "application/vnd.ms-excel", - ".xltm": "application/vnd.ms-excel.template.macroenabled.12", - ".xltx": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", - ".xlw": "application/vnd.ms-excel", - ".xml": "application/xml", - ".xo": "application/vnd.olpc-sugar", - ".xop": "application/xop+xml", - ".xpdl": "application/xml", - ".xpi": "application/x-xpinstall", - ".xpm": "image/x-xpixmap", - ".xpr": "application/vnd.is-xpr", - ".xps": "application/vnd.ms-xpsdocument", - ".xpw": "application/vnd.intercon.formnet", - ".xpx": "application/vnd.intercon.formnet", - ".xsl": "application/xml", - ".xslt": "application/xslt+xml", - ".xsm": "application/vnd.syncml+xml", - ".xspf": "application/xspf+xml", - ".xul": "application/vnd.mozilla.xul+xml", - ".xvm": "application/xv+xml", - ".xvml": "application/xv+xml", - ".xwd": "image/x-xwindowdump", - ".xyz": "chemical/x-xyz", - ".zaz": "application/vnd.zzazz.deck+xml", - ".zip": "application/zip", - ".zir": "application/vnd.zul", - ".zirz": "application/vnd.zul", - ".zmm": "application/vnd.handheld-entertainment+xml" -} diff --git a/src/file-viewer/models/BlobAsset.ts b/src/file-viewer/models/BlobAsset.ts deleted file mode 100644 index 3900884..0000000 --- a/src/file-viewer/models/BlobAsset.ts +++ /dev/null @@ -1,55 +0,0 @@ -const db = getDb("cache.sqlite"); -db.table( - "blob_assets", - /* SQL */ ` - create table blob_assets ( - hash text primary key, - refs integer not null default 0 - ); -`, -); -/** - * Uncompressed files are read directly from the media store root. Compressed - * files are stored as `<compress store>/<first 2 chars of hash>/<hash>` Since - * multiple files can share the same hash, the number of references is tracked - * so that when a file is deleted, the compressed data is only removed when all - * references are gone. - */ -export class BlobAsset { - /** sha1 of the contents */ - hash!: string; - refs!: number; -} - -export namespace BlobAsset { - const getQuery = cache.prepare(/* SQL */ ` - SELECT * FROM blob_assets WHERE hash = ?; - `).as(BlobAsset); - export function get(hash: string) { - return getQuery.get(hash); - } - - const putOrIncrementQuery = cache.prepare(/* SQL */ ` - INSERT INTO blob_assets (hash, refs) VALUES (?, 1) - ON CONFLICT(hash) DO UPDATE SET refs = refs + 1; - `); - export function putOrIncrement(hash: string) { - assert(hash.length === 40); - putOrIncrementQuery.get(hash); - return get(hash)!; - } - - const decrementQuery = cache.prepare(/* SQL */ ` - UPDATE blob_assets SET refs = refs - 1 WHERE hash = ? AND refs > 0; - `); - const deleteQuery = cache.prepare(/* SQL */ ` - DELETE FROM blob_assets WHERE hash = ? AND refs <= 0; - `); - export function decrementOrDelete(hash: string) { - assert(hash.length === 40); - decrementQuery.run(hash); - return deleteQuery.run(hash).changes > 0; - } -} - -import { getDb } from "#sqlite"; diff --git a/src/file-viewer/models/FilePermissions.ts b/src/file-viewer/models/FilePermissions.ts deleted file mode 100644 index e69de29..0000000 diff --git a/src/file-viewer/models/MediaFile.ts b/src/file-viewer/models/MediaFile.ts deleted file mode 100644 index 551fb8a..0000000 --- a/src/file-viewer/models/MediaFile.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { getDb } from "#database"; - -const db = getDb("cache.sqlite"); - -db.table(/* SQL */ ` - CREATE TABLE IF NOT EXISTS permissions ( - prefix TEXT PRIMARY KEY, - allow INTEGER NOT NULL - ); -`); - -export class FilePermissions { - prefix!: string; - /** Currently set to 1 always */ - allow!: number; - - // -- static ops -- - - static getByPrefix(filePath: string): number { - return (getByPrefixQuery.get(filePath))?.allow ?? 0; - } - static getExact(filePath: string): number { - return (getExactQuery.get(filePath))?.allow ?? 0; - } - static setPermissions(dirPath: string, level: number) { - if (level) { - insertQuery.run(dirPath, level); - } else { - deleteQuery.run(dirPath); - } - } -} - -const getByPrefixQuery = db.prepare(/* SQL */ ` - SELECT allow - FROM permissions - WHERE ? GLOB prefix || '*' - ORDER BY LENGTH(prefix) DESC - LIMIT 1; -`).type<FilePermissions>(); - -const getExactQuery = db.prepare(/* SQL */ ` - SELECT allow FROM permissions WHERE ? == prefix -`).type<FilePermissions>(); - -const insertQuery = db.prepare(/* SQL */ ` - REPLACE INTO permissions(prefix, allow) VALUES(?, ?); -`); -const deleteQuery = db.prepare(/* SQL */ ` - DELETE FROM permissions WHERE prefix = ?; -`); diff --git a/src/file-viewer/pages.off/file.cotyledon_enterance.tsx b/src/file-viewer/pages.off/file.cotyledon_enterance.tsx deleted file mode 100644 index dbea8f4..0000000 --- a/src/file-viewer/pages.off/file.cotyledon_enterance.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { MediaFile } from "../db"; -import { useInlineScript } from "../framework/page-resources"; -import { Readme } from "../media/cotyledon"; -import { MediaPanel } from "../pages-dynamic/file_viewer"; -import "../media/files.css"; - -export const theme = { - bg: "#312652", - fg: "#f0f0ff", - primary: "#fabe32", -}; - -export default function CotyledonPage() { - useInlineScript("canvas_cotyledon"); - useInlineScript("file_viewer"); - return ( - <div class="files ctld ctld-et"> - <MediaPanel - file={MediaFile.getByPath("/")!} - isLast={false} - activeFilename={null} - hasCotyledonCookie - /> - <Readme /> - </div> - ); -} diff --git a/src/file-viewer/pages.off/file.cotyledon_speedbump.tsx b/src/file-viewer/pages.off/file.cotyledon_speedbump.tsx deleted file mode 100644 index dea3800..0000000 --- a/src/file-viewer/pages.off/file.cotyledon_speedbump.tsx +++ /dev/null @@ -1,43 +0,0 @@ -// relativeImportPath -function relativeImportPath(from, to) { - let i = 0; - let sepPos = -1; - let prevSepPos = -1; - let prevPrevSepPos = -1; - const fromLen = from.length; - const commonLen = Math.min(to.length, fromLen); - for (; i < commonLen; i++) { - const curChar = to[i]; - if (curChar !== from[i]) - break; - if (curChar === import_path.sep) { - prevPrevSepPos = prevSepPos; - prevSepPos = sepPos; - sepPos = i; - } - } - if (sepPos !== -1) { - if (hasNms(to, sepPos)) { - return toPosix(stripNms(to, sepPos)); - } - if (prevSepPos !== -1) { - if (prevPrevSepPos !== -1 && to[prevSepPos + 1] === "@") { - prevSepPos = prevPrevSepPos; - } - if (hasNms(to, prevSepPos)) { - return toPosix(stripNms(to, prevSepPos)); - } - } - } - if (sepPos <= 0) - return toPosix(to); - let back = 0; - for (; i < fromLen; i++) - if (from[i] === import_path.sep) - back++; - if (back) { - return backSep.repeat(back) + toPosix(to.slice(sepPos + 1)); - } else { - return `.${toPosix(to.slice(sepPos))}`; - } -} diff --git a/src/file-viewer/redirects.ts b/src/file-viewer/redirects.ts deleted file mode 100644 index 21e5988..0000000 --- a/src/file-viewer/redirects.ts +++ /dev/null @@ -1,284 +0,0 @@ -// ImportInjector -class ImportInjector { - constructor(path, importedSource, opts) { - this._defaultOpts = { - importedSource: null, - importedType: "commonjs", - importedInterop: "babel", - importingInterop: "babel", - ensureLiveReference: false, - ensureNoContext: false, - importPosition: "before" - }; - const programPath = path.find(p => p.isProgram()); - this._programPath = programPath; - this._programScope = programPath.scope; - this._hub = programPath.hub; - this._defaultOpts = this._applyDefaults(importedSource, opts, true); - } - addDefault(importedSourceIn, opts) { - return this.addNamed("default", importedSourceIn, opts); - } - addNamed(importName, importedSourceIn, opts) { - _assert(typeof importName === "string"); - return this._generateImport(this._applyDefaults(importedSourceIn, opts), importName); - } - addNamespace(importedSourceIn, opts) { - return this._generateImport(this._applyDefaults(importedSourceIn, opts), null); - } - addSideEffect(importedSourceIn, opts) { - return this._generateImport(this._applyDefaults(importedSourceIn, opts), void 0); - } - _applyDefaults(importedSource, opts, isInit = false) { - let newOpts; - if (typeof importedSource === "string") { - newOpts = Object.assign({}, this._defaultOpts, { - importedSource - }, opts); - } else { - _assert(!opts, "Unexpected secondary arguments."); - newOpts = Object.assign({}, this._defaultOpts, importedSource); - } - if (!isInit && opts) { - if (opts.nameHint !== undefined) newOpts.nameHint = opts.nameHint; - if (opts.blockHoist !== undefined) newOpts.blockHoist = opts.blockHoist; - } - return newOpts; - } - _generateImport(opts, importName) { - const isDefault = importName === "default"; - const isNamed = !!importName && !isDefault; - const isNamespace = importName === null; - const { - importedSource, - importedType, - importedInterop, - importingInterop, - ensureLiveReference, - ensureNoContext, - nameHint, - importPosition, - blockHoist - } = opts; - let name = nameHint || importName; - const isMod = (0, _isModule.default)(this._programPath); - const isModuleForNode = isMod && importingInterop === "node"; - const isModuleForBabel = isMod && importingInterop === "babel"; - if (importPosition === "after" && !isMod) { - throw new Error(`"importPosition": "after" is only supported in modules`); - } - const builder = new _importBuilder.default(importedSource, this._programScope, this._hub); - if (importedType === "es6") { - if (!isModuleForNode && !isModuleForBabel) { - throw new Error("Cannot import an ES6 module from CommonJS"); - } - builder.import(); - if (isNamespace) { - builder.namespace(nameHint || importedSource); - } else if (isDefault || isNamed) { - builder.named(name, importName); - } - } else if (importedType !== "commonjs") { - throw new Error(`Unexpected interopType "${importedType}"`); - } else if (importedInterop === "babel") { - if (isModuleForNode) { - name = name !== "default" ? name : importedSource; - const es6Default = `${importedSource}$es6Default`; - builder.import(); - if (isNamespace) { - builder.default(es6Default).var(name || importedSource).wildcardInterop(); - } else if (isDefault) { - if (ensureLiveReference) { - builder.default(es6Default).var(name || importedSource).defaultInterop().read("default"); - } else { - builder.default(es6Default).var(name).defaultInterop().prop(importName); - } - } else if (isNamed) { - builder.default(es6Default).read(importName); - } - } else if (isModuleForBabel) { - builder.import(); - if (isNamespace) { - builder.namespace(name || importedSource); - } else if (isDefault || isNamed) { - builder.named(name, importName); - } - } else { - builder.require(); - if (isNamespace) { - builder.var(name || importedSource).wildcardInterop(); - } else if ((isDefault || isNamed) && ensureLiveReference) { - if (isDefault) { - name = name !== "default" ? name : importedSource; - builder.var(name).read(importName); - builder.defaultInterop(); - } else { - builder.var(importedSource).read(importName); - } - } else if (isDefault) { - builder.var(name).defaultInterop().prop(importName); - } else if (isNamed) { - builder.var(name).prop(importName); - } - } - } else if (importedInterop === "compiled") { - if (isModuleForNode) { - builder.import(); - if (isNamespace) { - builder.default(name || importedSource); - } else if (isDefault || isNamed) { - builder.default(importedSource).read(name); - } - } else if (isModuleForBabel) { - builder.import(); - if (isNamespace) { - builder.namespace(name || importedSource); - } else if (isDefault || isNamed) { - builder.named(name, importName); - } - } else { - builder.require(); - if (isNamespace) { - builder.var(name || importedSource); - } else if (isDefault || isNamed) { - if (ensureLiveReference) { - builder.var(importedSource).read(name); - } else { - builder.prop(importName).var(name); - } - } - } - } else if (importedInterop === "uncompiled") { - if (isDefault && ensureLiveReference) { - throw new Error("No live reference for commonjs default"); - } - if (isModuleForNode) { - builder.import(); - if (isNamespace) { - builder.default(name || importedSource); - } else if (isDefault) { - builder.default(name); - } else if (isNamed) { - builder.default(importedSource).read(name); - } - } else if (isModuleForBabel) { - builder.import(); - if (isNamespace) { - builder.default(name || importedSource); - } else if (isDefault) { - builder.default(name); - } else if (isNamed) { - builder.named(name, importName); - } - } else { - builder.require(); - if (isNamespace) { - builder.var(name || importedSource); - } else if (isDefault) { - builder.var(name); - } else if (isNamed) { - if (ensureLiveReference) { - builder.var(importedSource).read(name); - } else { - builder.var(name).prop(importName); - } - } - } - } else { - throw new Error(`Unknown importedInterop "${importedInterop}".`); - } - const { - statements, - resultName - } = builder.done(); - this._insertStatements(statements, importPosition, blockHoist); - if ((isDefault || isNamed) && ensureNoContext && resultName.type !== "Identifier") { - return sequenceExpression([numericLiteral(0), resultName]); - } - return resultName; - } - _insertStatements(statements, importPosition = "before", blockHoist = 3) { - if (importPosition === "after") { - if (this._insertStatementsAfter(statements)) return; - } else { - if (this._insertStatementsBefore(statements, blockHoist)) return; - } - this._programPath.unshiftContainer("body", statements); - } - _insertStatementsBefore(statements, blockHoist) { - if (statements.length === 1 && isImportDeclaration(statements[0]) && isValueImport(statements[0])) { - const firstImportDecl = this._programPath.get("body").find(p => { - return p.isImportDeclaration() && isValueImport(p.node); - }); - if ((firstImportDecl == null ? void 0 : firstImportDecl.node.source.value) === statements[0].source.value && maybeAppendImportSpecifiers(firstImportDecl.node, statements[0])) { - return true; - } - } - statements.forEach(node => { - node._blockHoist = blockHoist; - }); - const targetPath = this._programPath.get("body").find(p => { - const val = p.node._blockHoist; - return Number.isFinite(val) && val < 4; - }); - if (targetPath) { - targetPath.insertBefore(statements); - return true; - } - return false; - } - _insertStatementsAfter(statements) { - const statementsSet = new Set(statements); - const importDeclarations = new Map(); - for (const statement of statements) { - if (isImportDeclaration(statement) && isValueImport(statement)) { - const source = statement.source.value; - if (!importDeclarations.has(source)) importDeclarations.set(source, []); - importDeclarations.get(source).push(statement); - } - } - let lastImportPath = null; - for (const bodyStmt of this._programPath.get("body")) { - if (bodyStmt.isImportDeclaration() && isValueImport(bodyStmt.node)) { - lastImportPath = bodyStmt; - const source = bodyStmt.node.source.value; - const newImports = importDeclarations.get(source); - if (!newImports) continue; - for (const decl of newImports) { - if (!statementsSet.has(decl)) continue; - if (maybeAppendImportSpecifiers(bodyStmt.node, decl)) { - statementsSet.delete(decl); - } - } - } - } - if (statementsSet.size === 0) return true; - if (lastImportPath) lastImportPath.insertAfter(Array.from(statementsSet)); - return !!lastImportPath; - } -} - -// addDefault -function addDefault(path, importedSource, opts) { - return new _importInjector.default(path).addDefault(importedSource, opts); -} - -// addNamed -function addNamed(path, name, importedSource, opts) { - return new _importInjector.default(path).addNamed(name, importedSource, opts); -} - -// addNamespace -function addNamespace(path, importedSource, opts) { - return new _importInjector.default(path).addNamespace(importedSource, opts); -} - -// addSideEffect -function addSideEffect(path, importedSource, opts) { - return new _importInjector.default(path).addSideEffect(importedSource, opts); -} - -// isModule -function isModule(path) { - return path.node.sourceType === "module"; -} diff --git a/src/file-viewer/scan.ts b/src/file-viewer/scan.ts deleted file mode 100644 index 1e5012c..0000000 --- a/src/file-viewer/scan.ts +++ /dev/null @@ -1,1008 +0,0 @@ -// This file was started by AI and maintained by hand since. -import "@paperclover/console/inject"; -import { Progress } from "@paperclover/console/Progress"; -import { Spinner } from "@paperclover/console/Spinner"; -import assert from "node:assert"; -import { execFile } from "node:child_process"; -import { existsSync, Stats } from "node:fs"; -import * as fsp from "node:fs/promises"; -import * as path from "node:path"; -import { promisify } from "node:util"; -import { BlobAsset, cache, MediaFile } from "../db.ts"; -import { formatDate, formatSize } from "./share.ts"; -import { highlightCode, type Language } from "./highlight.ts"; -import process from "node:process"; - -const execFileAsync = promisify(execFile); - -// Configuration -const FILE_ROOT = process.env.SCAN_FILE_ROOT; -if (!FILE_ROOT) { - throw new Error( - "FILE_ROOT environment variable not set (e.g. '/path/to/files')", - ); -} -const LOCAL_DIR = path.resolve(FILE_ROOT); -const DRY_RUN = process.argv.includes("--dry-run"); -const SHOULD_COMPRESS = true; -const VERBOSE = process.argv.includes("--verbose"); -const SHOULD_SCRUB = true; -const COMPRESS_STORE = process.env.COMPRESS_STORE || - path.join(process.cwd(), ".clover/compressed"); - -// Helper function for logging that respects verbose flag -function log(message: string, always = false): void { - if (always || VERBOSE) { - console.log(message); - } -} - -// File extensions that need duration metadata -const MEDIA_EXTENSIONS = new Set([ - ".mp4", - ".mkv", - ".webm", - ".avi", - ".mov", - ".mp3", - ".flac", - ".wav", - ".ogg", - ".m4a", -]); - -// File extensions that need dimension metadata -const IMAGE_EXTENSIONS = new Set([ - ".jpg", - ".jpeg", - ".png", - ".gif", - ".webp", - ".avif", - ".heic", - ".svg", -]); - -const VIDEO_EXTENSIONS = new Set([".mp4", ".mkv", ".webm", ".avi", ".mov"]); - -// File extensions that need metadata scrubbing -const SCRUB_EXTENSIONS = new Set([ - ".jpg", - ".jpeg", - ".png", - ".mov", - ".mp4", - ".m4a", -]); - -const CODE_EXTENSIONS: Record<string, Language> = { - ".json": "json", - ".toml": "toml", - ".ts": "ts", - ".js": "ts", - ".tsx": "tsx", - ".jsx": "tsx", - ".css": "css", - ".py": "python", - ".lua": "lua", - ".sh": "shell", - ".bat": "dosbatch", - ".ps1": "powershell", - ".cmd": "dosbatch", - ".yaml": "yaml", - ".yml": "yaml", - ".zig": "zig", - ".astro": "astro", - ".mdx": "mdx", - ".xml": "xml", - ".jsonc": "json", - ".php": "php", - ".patch": "diff", - ".diff": "diff", -}; - -const READ_CONTENTS_EXTENSIONS = new Set([".txt", ".chat"]); - -// For files that have changed indexing logic, update the date here rescanning -// will reconstruct the entire file object. This way you can incrementally -// update new file types without having to reindex everything. -const lastUpdateTypes: Record<string, Date> = {}; -lastUpdateTypes[".lnk"] = new Date("2025-05-13 13:58:00"); -for (const ext in CODE_EXTENSIONS) { - lastUpdateTypes[ext] = new Date("2025-05-13 13:58:00"); -} -for (const ext of READ_CONTENTS_EXTENSIONS) { - lastUpdateTypes[ext] = new Date("2025-05-13 13:58:00"); -} -lastUpdateTypes[".diff"] = new Date("2025-05-18 13:58:00"); -lastUpdateTypes[".patch"] = new Date("2025-05-18 13:58:00"); - -// Helper functions for metadata extraction -async function calculateHash(filePath: string): Promise<string> { - try { - const hash = await execFileAsync("sha1sum", [filePath]); - return hash.stdout.split(" ")[0]; - } catch (error) { - console.error(`Error calculating hash for ${filePath}:`, error); - throw error; - } -} - -async function calculateDuration(filePath: string): Promise<number> { - try { - const ext = path.extname(filePath).toLowerCase(); - if (!MEDIA_EXTENSIONS.has(ext)) return 0; - - const { stdout } = await execFileAsync("ffprobe", [ - "-v", - "error", - "-show_entries", - "format=duration", - "-of", - "default=noprint_wrappers=1:nokey=1", - filePath, - ]); - return Math.ceil(parseFloat(stdout.trim())); - } catch (error) { - console.error(`Error calculating duration for ${filePath}:`, error); - return 0; // Return 0 for duration on error - } -} - -async function calculateDimensions(filePath: string): Promise<string> { - const ext = path.extname(filePath).toLowerCase(); - if (!IMAGE_EXTENSIONS.has(ext) && !VIDEO_EXTENSIONS.has(ext)) return ""; - - try { - if (ext === ".svg") { - // For SVG files, parse the file and extract width/height - const content = await fsp.readFile(filePath, "utf8"); - const widthMatch = content.match(/width="(\d+)"/); - const heightMatch = content.match(/height="(\d+)"/); - - if (widthMatch && heightMatch) { - return `${widthMatch[1]}x${heightMatch[1]}`; - } - } else if (IMAGE_EXTENSIONS.has(ext) || VIDEO_EXTENSIONS.has(ext)) { - // Use ffprobe for images and videos - const { stdout } = await execFileAsync("ffprobe", [ - "-v", - "error", - "-select_streams", - "v:0", - "-show_entries", - "stream=width,height", - "-of", - "csv=s=x:p=0", - filePath, - ]); - return stdout.trim(); - } - } catch (error) { - console.error(`Error calculating dimensions for ${filePath}:`, error); - } - - return ""; -} - -// Helper function to check and remove location metadata -async function scrubLocationMetadata( - filePath: string, - stats: Stats, -): Promise<boolean> { - try { - const ext = path.extname(filePath).toLowerCase(); - if (!SCRUB_EXTENSIONS.has(ext)) return false; - - let hasLocation = false; - let args: string[] = []; - - // Check for location metadata based on file type - const tempOutput = path.join( - path.dirname(filePath), - `._${path.basename(filePath)}.temp`, - ); - switch (ext) { - case ".jpg": - case ".jpeg": - case ".png": - // Check for GPS tags in EXIF - const { stdout: gpsCheck } = await execFileAsync("exiftool", [ - "-gps:all", - filePath, - ]); - hasLocation = gpsCheck.trim().length > 0; - args = ["-gps:all=", filePath, "-o", tempOutput]; - break; - case ".mov": - case ".mp4": - // Check for GPS metadata in video files - const { stdout: videoCheck } = await execFileAsync("exiftool", [ - "-ee", - "-G3", - "-s", - filePath, - ]); - hasLocation = videoCheck.includes("GPS") || - videoCheck.includes("Location"); - args = ["-gps:all=", "-xmp:all=", filePath, "-o", tempOutput]; - break; - case ".m4a": - // Check for location and other metadata in m4a files - const { stdout: m4aCheck } = await execFileAsync("exiftool", [ - "-ee", - "-G3", - "-s", - filePath, - ]); - hasLocation = m4aCheck.includes("GPS") || - m4aCheck.includes("Location") || - m4aCheck.includes("Filename") || - m4aCheck.includes("Title"); - - if (hasLocation) { - args = [ - "-gps:all=", - "-location:all=", - "-filename:all=", - "-title=", - "-m4a:all=", - filePath, - "-o", - tempOutput, - ]; - } - break; - } - - const accessTime = stats.atime; - const modTime = stats.mtime; - - let backup: string | null = null; - try { - if (hasLocation) { - if (DRY_RUN) return true; - - // Prepare a backup - const tmp = path.join( - path.dirname(filePath), - `._${path.basename(filePath)}.backup`, - ); - await fsp.copyFile(filePath, tmp); - await fsp.utimes(tmp, accessTime, modTime); - backup = tmp; - - // Remove metadata - await execFileAsync("exiftool", args); - if (!existsSync(tempOutput)) { - throw new Error(`Failed to create output file: ${tempOutput}`); - } - - // Restore original timestamps - await fsp.rename(tempOutput, filePath); - await fsp.utimes(filePath, accessTime, modTime); - - // Backup is no longer needed - await fsp.unlink(backup); - - log( - `Scrubbed location metadata in ${path.relative(LOCAL_DIR, filePath)}`, - true, - ); - return true; - } - } catch (error) { - if (backup) { - await fsp.rename(backup, filePath); - } - if (existsSync(tempOutput)) { - await fsp.unlink(tempOutput); - } - throw error; - } - } catch (error) { - console.error(`Error scrubbing metadata for ${filePath}:`, error); - } - - return false; -} - -// Queue implementation for parallel processing -type AsyncQueueProcessor<T> = (s: Spinner, item: T) => Promise<void>; -class AsyncQueue<T> { - private queue: T[] = []; - private running = 0; - private maxConcurrent: number; - private processed = 0; - private progress?: Progress<{ active: Spinner[] }>; - private name: string; - private estimate?: number; - - constructor(name: string, maxConcurrent: number) { - this.maxConcurrent = maxConcurrent; - this.name = name; - } - - setEstimate(estimate: number) { - this.estimate = estimate; - if (this.progress) { - this.progress.total = Math.max( - this.processed + this.queue.length, - estimate, - ); - } - } - - getProgress() { - if (!this.progress) { - this.progress = new Progress({ - spinner: null, - text: ({ active }) => { - const now = performance.now(); - let text = `[${this.processed}/${ - this.processed + this.queue.length - }] ${this.name}`; - let n = 0; - for (const item of active) { - let itemText = "- " + item.format(now); - text += `\n` + - itemText.slice(0, Math.max(0, process.stdout.columns - 1)); - if (n > 10) { - text += `\n ... + ${active.length - n} more`; - break; - } - n++; - } - return text; - }, - props: { - active: [] as Spinner[], - }, - }); - this.progress.total = this.estimate ?? 0; - this.progress.value = 0; - this.progress.fps = 30; - } - return this.progress; - } - - async add(item: T, processor: AsyncQueueProcessor<T>): Promise<void> { - this.queue.push(item); - this.getProgress().total = Math.max( - this.processed + this.queue.length, - this.estimate ?? 0, - ); - return this.processNext(processor); - } - - async addBatch(items: T[], processor: AsyncQueueProcessor<T>): Promise<void> { - this.queue.push(...items); - this.getProgress().total = Math.max( - this.processed + this.queue.length, - this.estimate ?? 0, - ); - return this.processNext(processor); - } - - private async processNext(processor: AsyncQueueProcessor<T>): Promise<void> { - if (this.running >= this.maxConcurrent || this.queue.length === 0) { - return; - } - - const item = this.queue.shift(); - if (!item) return; - - this.running++; - - try { - const progress = this.getProgress(); - - let itemText = ""; - if (typeof item === "string") { - itemText = item; - } else if (typeof item === "object" && item !== null && "path" in item) { - itemText = "" + item.path; - } else { - itemText = JSON.stringify(item); - } - if (itemText.startsWith(LOCAL_DIR)) { - itemText = path.relative(LOCAL_DIR, itemText); - } - - const spinner = new Spinner(itemText); - spinner.stop(); - progress.props.active.unshift(spinner); - await processor(spinner, item); - progress.props = { - active: progress.props.active.filter((s) => s !== spinner), - }; - this.processed++; - progress.value = this.processed; - } catch (error) { - console.error(`Error processing ${this.name} queue item:`, error); - this.processed++; - this.getProgress().value = this.processed; - } finally { - this.running--; - await this.processNext(processor); - } - } - - async waitForCompletion(): Promise<void> { - if (this.queue.length === 0 && this.running === 0) { - if (this.processed > 0) { - this.#success(); - } - return; - } - - return new Promise((resolve) => { - const checkInterval = setInterval(() => { - if (this.queue.length === 0 && this.running === 0) { - clearInterval(checkInterval); - this.#success(); - resolve(); - } - }, 100); - }); - } - - #success() { - this.getProgress().success(`${this.processed} ${this.name}`); - } -} - -function skipBasename(basename: string): boolean { - // dot files must be incrementally tracked - if (basename === ".dirsort") return true; - - return ( - basename.startsWith(".") || - basename.startsWith("._") || - basename === ".DS_Store" || - basename.toLowerCase() === "thumbs.db" || - basename.toLowerCase() === "desktop.ini" - ); -} - -// File system scanner -class FileSystemScanner { - private visitedPaths = new Set<string>(); - private previousPaths = new Set<string>(); - private dirQueue = new AsyncQueue<string>("Scan Directories", 10); - private fileQueue = new AsyncQueue<{ path: string; stat: any }>( - "File metadata", - 20, - ); - private compressQueue: AsyncQueue<{ file: MediaFile; path: string }> | null = - SHOULD_COMPRESS ? new AsyncQueue("Compress Assets", 10) : null; - - private getDbPath(localPath: string): string { - // Convert local file system path to database path - const relativePath = path.relative(LOCAL_DIR, localPath); - return "/" + relativePath.split(path.sep).join(path.posix.sep); - } - - private getLocalPath(dbPath: string): string { - // Convert database path to local file system path - return path.join(LOCAL_DIR, dbPath.slice(1)); - } - - async scanFile(s: Spinner, filePath: string, stat: any): Promise<void> { - const dbPath = this.getDbPath(filePath); - - // Skip hidden files - const basename = path.basename(filePath); - if (skipBasename(basename)) { - return; - } - - this.visitedPaths.add(dbPath); - - // Get existing file info from db - const existingFile = MediaFile.getByPath(dbPath); - - // Determine which date to use (for date protection) - let dateToUse = stat.mtime; - const year2025Start = new Date("2025-01-01T00:00:00Z"); - - if ( - existingFile && - existingFile.date < year2025Start && - stat.mtime >= year2025Start - ) { - console.error( - `Error: ${dbPath} is ${ - formatDate( - existingFile.date, - ) - }, got modified to ${formatDate(stat.mtime)}`, - ); - dateToUse = existingFile.date; - } - - // Check if we need to reprocess the file - if (existingFile && existingFile.size === stat.size && existingFile.hash) { - maybe_skip: { - const lastUpdateDate = lastUpdateTypes[path.extname(filePath)]; - if (lastUpdateDate && existingFile.lastUpdateDate < lastUpdateDate) { - console.log( - `Reprocessing ${dbPath} because indexing logic changed after ${ - formatDate( - lastUpdateDate, - ) - }`, - ); - break maybe_skip; - } - - if (SHOULD_COMPRESS && existingFile.processed !== 2) { - this.compressQueue!.add( - { file: existingFile, path: dbPath }, - this.compressFile.bind(this), - ); - } - - // File hasn't changed, no need to reprocess - MediaFile.createFile({ - path: dbPath, - date: dateToUse, - hash: existingFile.hash, - size: stat.size, - duration: existingFile.duration, - dimensions: existingFile.dimensions, - content: existingFile.contents, - }); - return; - } - } - - // Process the file - log(`Processing file: ${dbPath}`); - - // Scrub location metadata if needed - if (SHOULD_SCRUB) { - if (await scrubLocationMetadata(filePath, stat)) { - // Re-stat the file in case it was modified - const newStat = await fsp.stat(filePath); - stat.size = newStat.size; - } - } - - // Extract content - const hash = await calculateHash(filePath); - let content = ""; - if (filePath.endsWith(".lnk")) { - content = (await fsp.readFile(filePath, "utf8")).trim(); - } - const language = CODE_EXTENSIONS[path.extname(filePath)]; - if (language) { - read_code: { - // An issue is that .ts is an overloaded extension, shared between - // 'transport stream' and 'typescript'. - // - // Filter used here is: - // - more than 1mb - // - invalid UTF-8 - if (stat.size > 1_000_000) break read_code; - let code; - const buf = await fsp.readFile(filePath); - try { - code = new TextDecoder("utf-8", { fatal: true }).decode(buf); - } catch (error) { - break read_code; - } - content = await highlightCode(code, language); - } - } - if (!content && READ_CONTENTS_EXTENSIONS.has(path.extname(filePath))) { - content = await fsp.readFile(filePath, "utf8"); - } - // End extract content - - if (hash === existingFile?.hash) { - MediaFile.createFile({ - path: dbPath, - date: dateToUse, - hash, - size: stat.size, - duration: existingFile.duration, - dimensions: existingFile.dimensions, - content, - }); - return; - } else if (existingFile) { - if (existingFile.processed === 2) { - if (BlobAsset.decrementOrDelete(existingFile.hash)) { - log( - `Deleted compressed asset ${existingFile.hash}.{gzip, zstd}`, - true, - ); - await fsp.unlink( - path.join( - COMPRESS_STORE, - existingFile.hash.substring(0, 2), - existingFile.hash + ".gz", - ), - ); - await fsp.unlink( - path.join( - COMPRESS_STORE, - existingFile.hash.substring(0, 2), - existingFile.hash + ".zstd", - ), - ); - } - } - } - const [duration, dimensions] = await Promise.all([ - calculateDuration(filePath), - calculateDimensions(filePath), - ]); - - // Update database with all metadata - MediaFile.createFile({ - path: dbPath, - date: dateToUse, - hash, - size: stat.size, - duration, - dimensions, - content, - }); - - if (SHOULD_COMPRESS) { - this.compressQueue!.add( - { - file: MediaFile.getByPath(dbPath)!, - path: dbPath, - }, - this.compressFile.bind(this), - ); - } - } - - async compressFile(s: Spinner, { file }: { file: MediaFile }): Promise<void> { - log(`Compressing file: ${file.path}`); - if (DRY_RUN) return; - - const filePath = path.join(FILE_ROOT!, file.path); - - const hash = file.hash; - const firstTwoChars = hash.substring(0, 2); - const compressDir = `${COMPRESS_STORE}/${firstTwoChars}`; - const compressPath = `${compressDir}/${hash}`; - - // Create directory structure if it doesn't exist - await fsp.mkdir(compressDir, { recursive: true }); - - // Compress the file with gzip - const blob = BlobAsset.putOrIncrement(hash); - if (blob.refs > 1) { - log( - `Skipping compression of ${filePath} because it already exists in ${compressPath}`, - ); - return; - } - // Check if already exists - if (existsSync(compressPath + ".gz")) { - file.setCompressed(true); - return; - } - try { - const gzipProcess = Bun.spawn(["gzip", "-c", filePath, "-9"], { - stdout: Bun.file(compressPath + ".gz"), - }); - const zstdProcess = Bun.spawn(["zstd", "-c", filePath, "-9"], { - stdout: Bun.file(compressPath + ".zstd"), - }); - const [gzipExited, zstdExited] = await Promise.all([ - gzipProcess.exited, - zstdProcess.exited, - ]); - assert(gzipExited === 0); - assert(zstdExited === 0); - assert(existsSync(compressPath + ".gz")); - assert(existsSync(compressPath + ".zstd")); - file.setCompressed(true); - } catch (error) { - console.error(`Error compressing file ${filePath}:`, error); - BlobAsset.decrementOrDelete(hash); - file.setCompressed(false); - } - } - - async scanDirectory(s: Spinner, dirPath: string): Promise<void> { - const dbPath = this.getDbPath(dirPath); - - this.visitedPaths.add(dbPath); - - // Create or update directory entry - log(`Scanning directory: ${dbPath}`); - if (!DRY_RUN) { - MediaFile.createOrUpdateDirectory(dbPath); - } - - try { - const entries = await fsp.readdir(dirPath, { withFileTypes: true }); - - // Process files and subdirectories - for (const entry of entries) { - const entryPath = path.join(dirPath, entry.name); - - // Skip hidden files and system files - if (skipBasename(entry.name)) { - continue; - } - - if (entry.isDirectory()) { - // Queue subdirectory for scanning - this.dirQueue.add(entryPath, this.scanDirectory.bind(this)); - } else if (entry.isFile()) { - // Queue file for processing - const stat = await fsp.stat(entryPath); - - this.fileQueue.add( - { path: entryPath, stat }, - async (s, item) => await this.scanFile(s, item.path, item.stat), - ); - } - } - } catch (error) { - console.error(`Error scanning directory ${dirPath}:`, error); - } - } - - async processDirectoryMetadata(dirPath: string): Promise<void> { - const dbPath = this.getDbPath(dirPath); - const dir = MediaFile.getByPath(dbPath); - - if (!dir || dir.kind !== MediaFile.Kind.directory) { - return; - } - - if (DRY_RUN) return; - - const children = dir.getChildren(); - - // Calculate directory metadata - let totalSize = 0; - let newestDate = new Date(0); - let allHashes = ""; - - // Check for readme.txt - let readmeContent = ""; - - try { - readmeContent = await fsp.readFile( - path.join(dirPath, "readme.txt"), - "utf8", - ); - } catch (error: any) { - console.info(`no readme ${dirPath}`); - if (error.code !== "ENOENT") { - console.error(`Error reading readme.txt in ${dirPath}:`, error); - } - } - - let dirsort: string[] | null = null; - try { - dirsort = (await fsp.readFile(path.join(dirPath, ".dirsort"), "utf8")) - .split("\n") - .map((x) => x.trim()) - .filter(Boolean); - } catch (error: any) { - if (error.code !== "ENOENT") { - console.error(`Error reading .dirsort in ${dirPath}:`, error); - } - } - - // Process children - for (const child of children) { - totalSize += child.size; - allHashes += child.hash; - - // Update newest date, ignoring readme.txt - if (!child.path.endsWith("/readme.txt") && child.date > newestDate) { - newestDate = child.date; - } - } - - // Create a hash for the directory - const dirHash = new Bun.CryptoHasher("sha1") - .update(dbPath + allHashes) - .digest("hex"); - - // Update directory metadata - MediaFile.markDirectoryProcessed({ - id: dir.id, - timestamp: newestDate, - contents: readmeContent, - size: totalSize, - hash: dirHash, - dirsort, - }); - } - - async findDeletedFiles(): Promise<void> { - if (DRY_RUN) return; - - // Find all paths that exist in the DB but not in the filesystem - const deletedPaths = Array.from(this.previousPaths).filter( - (path) => !this.visitedPaths.has(path), - ); - - for (const dbPath of deletedPaths) { - const file = MediaFile.getByPath(dbPath); - if (!file) continue; - - log(`Item Deleted: ${dbPath}`, true); - if (file.processed === 2) { - if (BlobAsset.decrementOrDelete(file.hash)) { - log(`Deleted compressed asset ${file.hash}.{gzip, zstd}`, true); - await fsp.unlink( - path.join( - COMPRESS_STORE, - file.hash.substring(0, 2), - file.hash + ".gz", - ), - ); - await fsp.unlink( - path.join( - COMPRESS_STORE, - file.hash.substring(0, 2), - file.hash + ".zstd", - ), - ); - } - } - MediaFile.deleteByPath(dbPath); - } - } - - async loadPreviousPaths(): Promise<void> { - // Get all files and directories from the database - // This uses a custom query to get all paths at once - const getAllPathsQuery = cache - .prepare(`SELECT path, kind FROM media_files`) - .all() as { - path: string; - kind: MediaFile.Kind; - }[]; - - let dirs = 0; - let files = 0; - for (const row of getAllPathsQuery) { - this.previousPaths.add(row.path); - if (row.kind === MediaFile.Kind.directory) { - dirs++; - } else { - files++; - } - } - - this.dirQueue.setEstimate(dirs); - this.fileQueue.setEstimate(files); - - // log(`Loaded ${this.previousPaths.size} paths from database`, true); - } - - async scan(): Promise<void> { - log(`Starting file system scan in ${LOCAL_DIR}`, true); - - // Check if the root directory exists and is accessible - try { - const rootStat = await fsp.stat(LOCAL_DIR); - if (!rootStat.isDirectory()) { - throw new Error(`${LOCAL_DIR} is not a directory`); - } - } catch (error) { - console.error(`Error: Cannot access root directory ${LOCAL_DIR}`, error); - console.error( - `Aborting scan to prevent database corruption. Please check if the volume is mounted.`, - ); - process.exit(1); - } - - await this.loadPreviousPaths(); - - await this.dirQueue.add(LOCAL_DIR, this.scanDirectory.bind(this)); - - await this.dirQueue.waitForCompletion(); - await this.fileQueue.waitForCompletion(); - - await this.findDeletedFiles(); - - const allDirs = Array.from(this.visitedPaths) - .filter((path) => { - const file = MediaFile.getByPath(path); - return file && file.kind === MediaFile.Kind.directory; - }) - .sort((a, b) => b.length - a.length); - - const dirMetadataQueue = new AsyncQueue<string>("Directory Metadata", 10); - for (const dirPath of allDirs) { - await this.processDirectoryMetadata(this.getLocalPath(dirPath)); - } - - await dirMetadataQueue.waitForCompletion(); - - if (SHOULD_COMPRESS) { - await this.compressQueue!.waitForCompletion(); - } - - log("Scan completed successfully!", true); - } -} - -// Main execution -function showHelp() { - console.log(` -MediaFile Scanner - Index filesystem content for paperclover.net - -Environment variables: - FILE_ROOT Required. Path to the directory to scan - COMPRESS_STORE Optional. Path to store compressed files (default: .clover/compressed) - -Options: - --help Show this help message - --dry-run Don't make any changes to the database - --verbose Show detailed output - -Usage: - bun ./media/scan.ts [options] - -`); - process.exit(0); -} - -{ - // Show help if requested - if (process.argv.includes("--help")) { - showHelp(); - process.exit(0); - } - - // Check if the root directory exists before starting - if (!existsSync(LOCAL_DIR)) { - console.error( - `Error: Root directory ${LOCAL_DIR} does not exist or is not accessible.`, - ); - console.error(`Please check if the volume is mounted correctly.`); - process.exit(1); - } - - const startTime = Date.now(); - - try { - const scanner = new FileSystemScanner(); - await scanner.scan(); - - const endTime = Date.now(); - log(`Scan completed in ${(endTime - startTime) / 1000} seconds`, true); - - const rootDir = MediaFile.getByPath("/")!; - const totalEntries = cache - .prepare(`SELECT COUNT(*) as count FROM media_files`) - .get() as { count: number }; - const totalDuration = cache - .prepare(`SELECT SUM(duration) as duration FROM media_files`) - .get() as { duration: number }; - console.log(); - console.log("Global Stats"); - console.log(` Entry count: ${totalEntries.count}`); - console.log(` Uncompressed size: ${formatSize(rootDir.size)}`); - console.log( - ` Total audio/video duration: ${ - ( - totalDuration.duration / - 60 / - 60 - ).toFixed(1) - } hours`, - ); - } catch (error) { - console.error("Error during scan:", error); - process.exit(1); - } -} diff --git a/src/file-viewer/scripts/canvas_2017.client.ts b/src/file-viewer/scripts/canvas_2017.client.ts deleted file mode 100644 index b7d3719..0000000 --- a/src/file-viewer/scripts/canvas_2017.client.ts +++ /dev/null @@ -1,233 +0,0 @@ -// Vibe coded with AI -(globalThis as any).canvas_2017 = function (canvas: HTMLCanvasElement) { - const isStandalone = canvas.getAttribute("data-standalone") === "true"; - // Configuration interface for the checkerboard effect - interface CheckerboardConfig { - fps: number; // frames per second - color1: string; // first checkerboard color - color2: string; // second checkerboard color - opacity: number; // opacity of each checkerboard (0-1) - speedX1: number; // horizontal speed of first checkerboard (pixels per second) - speedY1: number; // vertical speed of first checkerboard (pixels per second) - speedX2: number; // horizontal speed of second checkerboard (pixels per second) - speedY2: number; // vertical speed of second checkerboard (pixels per second) - baseTileSize: number; // base size of checkerboard tiles - sizeVariation: number; // maximum variation in tile size (pixels) - sineFrequency1: number; // frequency of first sine wave for size variation - sineFrequency2: number; // frequency of second sine wave for size variation - sineOffset: number; // offset between the two sine waves (radians) - rotation: number; // rotation in degrees for the entire pattern - rotation2: number; // rotation in degrees for the entire pattern - } - - // Default configuration - const config: CheckerboardConfig = { - fps: 30, - color1: "#1A1C17", - color2: "#1A1C17", - opacity: 0.3, - speedX1: -0.02, // moving left slowly - speedY1: -0.01, // moving up slowly - speedX2: -0.015, // moving left (slightly slower) - speedY2: 0.012, // moving down slowly - baseTileSize: 200, - sizeVariation: 1.5, - sineFrequency1: 0.0005, - sineFrequency2: 0.0008, - sineOffset: Math.PI / 2, // 90 degrees offset - rotation: 2, // 5 degree rotation - rotation2: -2, // 5 degree rotation - }; - - // Get the canvas context - const ctx = canvas.getContext("2d"); - if (!ctx) { - console.error("Could not get canvas context"); - return () => {}; - } - - // Make canvas transparent - if (isStandalone) { - canvas.style.backgroundColor = "#737D60"; - } else { - canvas.style.backgroundColor = "transparent"; - } - - // Variables to track position and animation - let width = canvas.width; - let height = canvas.height; - let animationFrameId: number; - let lastFrameTime = 0; - const frameInterval = 1000 / config.fps; - - // Position offsets for the two checkerboards (centered) - let offset1X = 0; - let offset1Y = 0; - let offset2X = 0; - let offset2Y = 0; - - // Time variable for sine wave calculation - let time = 0; - - // Convert rotation to radians - const rotationRad = (config.rotation * Math.PI) / 180; - const rotationRad2 = (config.rotation2 * Math.PI) / 180; - - // Update canvas dimensions when resized - const updateDimensions = () => { - width = canvas.width = canvas.clientWidth; - height = canvas.height = canvas.clientHeight; - }; - - // Calculate the diagonal length of the canvas (to ensure rotation covers corners) - const calculateDiagonal = () => { - return Math.sqrt(width * width + height * height); - }; - - // Draw a single checkerboard pattern scaled from center with rotation - const drawCheckerboard = ( - offsetX: number, - offsetY: number, - tileSize: number, - color1: string, - color2: string, - opacity: number, - rotationRad: number, - ) => { - ctx.globalAlpha = opacity; - - // Get the center of the viewport - const centerX = width / 2; - const centerY = height / 2; - - // Save the current transformation state - ctx.save(); - - // Move to the center of the canvas, rotate, then move back - ctx.translate(centerX, centerY); - ctx.rotate(rotationRad); - - // Calculate the number of tiles needed to cover the rotated canvas - // We need to use the diagonal length to ensure we cover the corners when rotated - const diagonal = calculateDiagonal(); - const tilesX = Math.ceil(diagonal / tileSize) + 6; // Added extra tiles for rotation - const tilesY = Math.ceil(diagonal / tileSize) + 6; - - // Calculate how many tiles fit from center to edge (in each direction) - const halfTilesX = Math.ceil(tilesX / 2); - const halfTilesY = Math.ceil(tilesY / 2); - - // Adjust the offset to be relative to the center - // The modulo ensures the pattern repeats smoothly even with scaling - const adjustedOffsetX = offsetX % (tileSize * 2); - const adjustedOffsetY = offsetY % (tileSize * 2); - - // Draw the checker pattern, centered on the viewport - for (let y = -halfTilesY; y <= halfTilesY; y++) { - for (let x = -halfTilesX; x <= halfTilesX; x++) { - // Determine if this tile should be colored (creating checker pattern) - // We add a large number to ensure (x+y) is always positive for the modulo - if ((x + y + 1000) % 2 === 0) { - ctx.fillStyle = color1; - } else { - ctx.fillStyle = color2; - } - - // Calculate the position of this tile relative to the center - // The adjusted offset creates the movement effect - const posX = (x * tileSize) + adjustedOffsetX; - const posY = (y * tileSize) + adjustedOffsetY; - - // Draw the tile - ctx.fillRect( - posX - tileSize / 2, - posY - tileSize / 2, - tileSize, - tileSize, - ); - } - } - - // Restore the transformation state - ctx.restore(); - }; - - // Animation loop - const animate = (currentTime: number) => { - animationFrameId = requestAnimationFrame(animate); - - // Control frame rate - if (currentTime - lastFrameTime < frameInterval) { - return; - } - - // Calculate the time elapsed since the last frame - const dt = currentTime - lastFrameTime; - lastFrameTime = currentTime; - - // Increment time for sine wave calculation - time += dt; - - // Update the position offsets based on speed and elapsed time - offset1X += config.speedX1 * dt; - offset1Y += config.speedY1 * dt; - offset2X += config.speedX2 * dt; - offset2Y += config.speedY2 * dt; - - // Calculate the tile sizes using sine waves - const tileSize1 = config.baseTileSize + - Math.sin(time * config.sineFrequency1) * config.sizeVariation; - const tileSize2 = config.baseTileSize + - Math.sin(time * config.sineFrequency2 + config.sineOffset) * - config.sizeVariation; - - // Clear canvas - ctx.clearRect(0, 0, width, height); - - // Draw the two checkerboards - drawCheckerboard( - offset1X, - offset1Y, - tileSize1, - config.color1, - "transparent", - config.opacity, - rotationRad, - ); - - drawCheckerboard( - offset2X, - offset2Y, - tileSize2, - config.color2, - "transparent", - config.opacity, - rotationRad2, - ); - - // Reset global alpha - ctx.globalAlpha = 1.0; - }; - - // Initialize the animation - const init = () => { - // Set up resize handler - globalThis.addEventListener("resize", updateDimensions); - - // Initial setup - updateDimensions(); - - // Start animation - lastFrameTime = performance.now(); - animationFrameId = requestAnimationFrame(animate); - }; - - // Start the animation - init(); - - // Return cleanup function - return () => { - globalThis.removeEventListener("resize", updateDimensions); - cancelAnimationFrame(animationFrameId); - }; -}; diff --git a/src/file-viewer/scripts/canvas_2018.client.ts b/src/file-viewer/scripts/canvas_2018.client.ts deleted file mode 100644 index cb3a3e7..0000000 --- a/src/file-viewer/scripts/canvas_2018.client.ts +++ /dev/null @@ -1,431 +0,0 @@ -// This canvas is based on the maze generation algo in Tanks. This was -// originally written in C++ as a single function in 2018, and was ported to TS -// by Chloe in 2025 for the cotyledon canvas. -// -// The main difference is that this version is a visualization, rather than the -// practical function. Instead of taking a millisecond, only 5 steps are -// performed per second, visualizing the whole ordeal. It also isn't a playable -// game, obviously. -// -// Ported with love because I care about my old self -// She deserves the world, but instead gave it to me. -(globalThis as any).canvas_2018 = function (canvas: HTMLCanvasElement) { - const isStandalone = canvas.getAttribute("data-standalone") === "true"; - if (isStandalone) { - canvas.style.backgroundColor = "#27201E"; - } - interface Cell { - down: boolean; - right: boolean; - visited: boolean; - - cell_flash: number; - down_flash: number; - right_flash: number; - } - interface Pos { - x: number; - y: number; - /** Where the wall is relative to x, y. */ - dir: "left" | "right" | "up" | "down"; - } - interface Maze { - grid: Grid; - cursor: { x: number; y: number }; - lastTick: number; - /* Pixels */ - transform: number; - newCellsToVisit: Pos[]; - randomWallBag: Cell[]; - randomWallTarget: number; - renderOffset: { x: number; y: number }; - done: boolean; - } - const hex = (color: number[]) => - "#" + color.map((c) => c.toString(16).padStart(2, "0")).join(""); - let cellSize: number; - let borderThickness: number; - const cellFlashModifier = isStandalone ? 0.4 : 0.2; - const color = isStandalone ? "#170d0b" : "#231C1A"; - const bg = [0x27, 0x20, 0x1E]; - const wallFlashColor = [0xFF, 0xA8, 0x7A]; - const cellFlashColor = "#FFA87A"; - const updateTime = 1000 / 7; - const randomWallBreakInterval = [6, 12]; // every 10 to 18 walls. - function randomBetween(min: number, max: number) { - return Math.round( - Math.random() * (max - min), - ) + min; - } - function randomOf<T>(array: T[]): T { - return array[randomBetween(0, array.length - 1)]; - } - function randomWallTarget() { - return randomBetween( - randomWallBreakInterval[0], - randomWallBreakInterval[1], - ); - } - - // Originally, this used a 2-dimensional array. However, I wanted to make sure - // that the grid could be infinitely sized. This grid constructs new cells on - // demand, as needed. - class Grid { - cells = new Map<number, Cell>(); - cell({ x, y }: { x: number; y: number }) { - const k = ((x | 0) << 16) + (y | 0); - const { cells } = this; - let existing = this.cells.get(k); - if (!existing) { - existing = { - cell_flash: 0, - down: true, - down_flash: 0, - right: true, - right_flash: 0, - visited: false, - }; - cells.set(k, existing); - } - return existing; - } - forAll( - renderOffset: { x: number; y: number }, - width: number, - height: number, - cb: (cell: Cell, pos: { x: number; y: number }) => void, - ) { - const { x: offsetX, y: offsetY } = renderOffset; - const startX = Math.floor(-offsetX / cellSize); - const startY = Math.floor(-offsetY / cellSize); - const endX = Math.ceil((width - offsetX) / cellSize); - const endY = Math.ceil((height - offsetY) / cellSize); - for (let x = startX; x <= endX; x++) { - for (let y = startY; y <= endY; y++) { - const cellX = offsetX + x * cellSize; - const cellY = offsetY + y * cellSize; - cb(this.cell({ x, y }), { x: cellX, y: cellY }); - } - } - } - } - - const ctx = canvas.getContext("2d")!; - if (!ctx) { - console.error("Could not get canvas context"); - return () => {}; - } - - let width: number, height: number; - const updateDimensions = () => { - width = canvas.width = canvas.offsetWidth; - height = canvas.height = canvas.offsetHeight; - cellSize = 100; - borderThickness = 8; - }; - updateDimensions(); - - setTimeout(() => { - updateDimensions(); - }, 10); - - let maze = initMaze(); - let nextMaze: Maze | null = null; - let completeFade = 0; - function initMaze(): Maze { - return { - grid: new Grid(), - transform: 0, - cursor: { - x: randomBetween(0, Math.ceil(width / cellSize)), - y: randomBetween(0, Math.ceil(height / cellSize)), - }, - lastTick: performance.now(), - randomWallBag: [], - randomWallTarget: randomWallTarget(), - newCellsToVisit: [], - renderOffset: { x: 0, y: 0 }, - done: false, - }; - } - - function isOnScreen(maze: Maze, x: number, y: number) { - const { x: offsetX, y: offsetY } = maze.renderOffset; - const cellX = offsetX + x * cellSize; - const cellY = offsetY + y * cellSize; - return ( - cellX + cellSize > 0 && - cellX < width && - cellY + cellSize > 0 && - cellY < height - ); - } - - function tick(maze: Maze, other?: Maze) { - if (maze.done) return; - - // The original maze algorithm broke down 4%-8% of random right facing - // walls, and 4%-8% of down facing walls. It did this at the end. - // To make this visual more interesting, two random walls will be broken - // down every 12-25 cell visits. This way, the main trail is always running. - if (maze.randomWallBag.length > maze.randomWallTarget) { - const down: Cell = randomOf(maze.randomWallBag); - const right: Cell = randomOf(maze.randomWallBag); - maze.randomWallBag.forEach((cell) => - cell.cell_flash = Math.min(cell.cell_flash + 0.2, 1) - ); - down.cell_flash = 1; - down.down = false; - down.down_flash = 1; - right.cell_flash = 1; - right.right = false; - right.right_flash = 1; - maze.randomWallBag = []; - maze.randomWallTarget = randomWallTarget(); - return; - } - - // The main algorithm was simple: Have a cursor position, and move it in a - // random direction that it had not seen before. Once it had run out of - // options, branch off of a previous location. Only visit each cell once. - // - // In this visualization, cells that are too far offscreen are softly - // treated as "visited", which is how the simulation always stays in frame. - const current = maze.grid.cell(maze.cursor); - current.visited = true; - current.cell_flash = 1; - maze.randomWallBag.push(current); - const adjacent = ([ - { x: maze.cursor.x + 1, y: maze.cursor.y, dir: "left" }, - { x: maze.cursor.x - 1, y: maze.cursor.y, dir: "right" }, - { x: maze.cursor.x, y: maze.cursor.y + 1, dir: "up" }, - { x: maze.cursor.x, y: maze.cursor.y - 1, dir: "down" }, - ] as Pos[]).filter((pos) => - isOnScreen(maze, pos.x, pos.y) && - maze.grid.cell(pos).visited === false - ); - if (adjacent.length === 0) { - // move cursor to a random cell that has not been visited. - const cells = maze.newCellsToVisit.filter((pos) => - isOnScreen(maze, pos.x, pos.y) && - maze.grid.cell(pos).visited === false - ); - if (cells.length === 0) { - maze.done = true; - return; - } - const continuePos = randomOf(cells); - breakWall(maze, continuePos, other); - maze.cursor = { x: continuePos.x, y: continuePos.y }; - return; - } - - // break a random wall - const toBreak = randomOf(adjacent); - breakWall(maze, toBreak, other); - maze.cursor = { x: toBreak.x, y: toBreak.y }; - - // add the other directions to the new cells to visit. - maze.newCellsToVisit.push( - ...adjacent.filter((pos) => pos.dir !== toBreak.dir), - ); - } - - function breakWall(maze: Maze, pos: Pos, other?: Maze) { - if (pos.dir === "right") { - const cell = maze.grid.cell(pos); - cell.right = false; - cell.right_flash = 1; - if (other) cell.right = false; - } else if (pos.dir === "down") { - const cell = maze.grid.cell(pos); - cell.down = false; - cell.down_flash = 1; - if (other) cell.down = false; - } else if (pos.dir === "left") { - const cell = maze.grid.cell({ x: pos.x - 1, y: pos.y }); - cell.right = false; - cell.right_flash = 1; - if (other) cell.right = false; - } else if (pos.dir === "up") { - const cell = maze.grid.cell({ x: pos.x, y: pos.y - 1 }); - cell.down = false; - cell.down_flash = 1; - if (other) cell.down = false; - } - } - - function renderOffset(maze: Maze) { - return { x: maze.transform, y: maze.transform }; - } - - let animationFrameId: number; - let last = performance.now(); - let dt: number = 0; - - function renderMazeBorders(maze: Maze, opacity: number) { - ctx.globalAlpha = opacity; - maze.grid.forAll( - maze.renderOffset, - width, - height, - (cell, { x: cellX, y: cellY }) => { - // Walls - if (cell.right) { - ctx.fillStyle = color; - ctx.fillRect( - cellX + cellSize - borderThickness / 2, - cellY - borderThickness / 2, - borderThickness, - cellSize + borderThickness, - ); - } - if (cell.down) { - ctx.fillStyle = color; - ctx.fillRect( - cellX - borderThickness / 2, - cellY + cellSize - borderThickness / 2, - cellSize + borderThickness, - borderThickness, - ); - } - }, - ); - ctx.globalAlpha = 1; - } - - function renderCellFlash(maze: Maze) { - maze.grid.forAll( - maze.renderOffset, - width, - height, - (cell, { x: cellX, y: cellY }) => { - // Cell flash to show visiting path. - if (cell.cell_flash > 0) { - cell.cell_flash = Math.max(0, cell.cell_flash - dt / 1000); - ctx.fillStyle = cellFlashColor; - ctx.globalAlpha = cell.cell_flash * cellFlashModifier; - ctx.fillRect(cellX, cellY, cellSize, cellSize); - ctx.globalAlpha = 1; - } - }, - ); - } - - function renderBorderFlash(maze: Maze) { - maze.grid.forAll( - maze.renderOffset, - width, - height, - (cell, { x: cellX, y: cellY }) => { - if (cell.right_flash == 0 && cell.down_flash == 0) { - return; - } - - // Walls - const cellFlash = cell.cell_flash * cellFlashModifier; - if (cell.right_flash > 0) { - cell.right_flash = Math.max(0, cell.right_flash - dt / 500); - ctx.fillStyle = interpolateColor( - bg, - wallFlashColor, - Math.max(cell.right_flash, cellFlash), - ); - if (cellFlash > cell.right_flash) { - ctx.globalAlpha = cell.right_flash / cellFlash; - } - ctx.fillRect( - cellX + cellSize - borderThickness / 2, - cellY + borderThickness / 2, - borderThickness, - cellSize - borderThickness, - ); - ctx.globalAlpha = 1; - } - if (cell.down_flash > 0) { - if (cellFlash > cell.down_flash) { - ctx.globalAlpha = cell.down_flash / cellFlash; - } - cell.down_flash = Math.max(0, cell.down_flash - dt / 500); - ctx.fillStyle = interpolateColor( - bg, - wallFlashColor, - Math.max(cell.down_flash, cellFlash), - ); - ctx.fillRect( - cellX + borderThickness / 2, - cellY + cellSize - borderThickness / 2, - cellSize - borderThickness, - borderThickness, - ); - ctx.globalAlpha = 1; - } - }, - ); - } - - function render() { - const now = performance.now(); - dt = now - last; - maze.transform += dt * 0.005; - maze.renderOffset = renderOffset(maze); - if (!maze.done) { - if (now - maze.lastTick >= updateTime) { - tick(maze); - maze.lastTick = now; - - if (maze.done) { - nextMaze = initMaze(); - nextMaze.transform = (maze.transform % cellSize) - dt * 0.005; - nextMaze.lastTick = now; - completeFade = 0; - } - } - } - if (nextMaze) { - nextMaze.transform += dt * 0.005; - nextMaze.renderOffset = renderOffset(nextMaze); - if (!nextMaze.done && now - nextMaze.lastTick >= updateTime) { - tick(nextMaze, maze); - nextMaze.lastTick = now; - } - } - last = now; - - ctx.clearRect(0, 0, width, height); - - renderCellFlash(maze); - if (nextMaze) renderCellFlash(nextMaze); - - renderMazeBorders(maze, 1); - if (nextMaze) { - renderMazeBorders(nextMaze, completeFade); - completeFade += dt / 3000; - if (completeFade >= 1) { - maze = nextMaze; - nextMaze = null; - } - } - - renderBorderFlash(maze); - if (nextMaze) { - renderCellFlash(nextMaze); - renderBorderFlash(nextMaze); - } - - animationFrameId = requestAnimationFrame(render); - } - - function interpolateColor(start: number[], end: number[], t: number) { - return hex(start.map((s, i) => Math.round(s + (end[i] - s) * t))); - } - - globalThis.addEventListener("resize", updateDimensions); - animationFrameId = requestAnimationFrame(render); - - // cleanup function - return () => { - globalThis.removeEventListener("resize", updateDimensions); - cancelAnimationFrame(animationFrameId); - }; -}; diff --git a/src/file-viewer/scripts/canvas_2019.client.ts b/src/file-viewer/scripts/canvas_2019.client.ts deleted file mode 100644 index cd2f24a..0000000 --- a/src/file-viewer/scripts/canvas_2019.client.ts +++ /dev/null @@ -1,109 +0,0 @@ -// __esModule -true - -// assertAllowedAttributes -function assertAllowedAttributes(path, allowed) { - let i = 0; - for (const attr of path.node.attributes) { - if (attr.type === "MarkoSpreadAttribute") { - throw path.hub.buildError( - attr, - `Tag does not support spread attributes.` - ); - } else if (!allowed.includes(attr.name)) { - throw path.hub.buildError( - attr, - `Tag does not support the \`${attr.name}\` attribute.` - ); - } - - i++; - } -} - -// assertAttributesOrArgs -function assertAttributesOrArgs(path) { - const { node } = path; - const args = node.arguments; - if (args && args.length && (node.attributes.length > 0 || node.body.length)) { - const start = args[0].loc.start; - const end = args[args.length - 1].loc.end; - throw path.hub.buildError( - { loc: { start, end } }, - "Tag does not support arguments when attributes or body present." - ); - } -} - -// assertAttributesOrSingleArg -function assertAttributesOrSingleArg(path) { - assertAttributesOrArgs(path); - const args = path.node.arguments; - if (args && args.length > 1) { - const start = args[1].loc.start; - const end = args[args.length - 1].loc.end; - throw path.hub.buildError( - { loc: { start, end } }, - "Tag does not support multiple arguments." - ); - } -} - -// assertNoArgs -function assertNoArgs(path) { - const args = path.node.arguments; - if (args && args.length) { - const start = args[0].loc.start; - const end = args[args.length - 1].loc.end; - throw path.hub.buildError( - { loc: { start, end } }, - "Tag does not support arguments." - ); - } -} - -// assertNoAttributeTags -function assertNoAttributeTags(path) { - if (path.node.attributeTags.length) { - throw path.hub.buildError( - path.node.attributeTags[0], - "Tag not support nested attribute tags." - ); - } -} - -// assertNoAttributes -function assertNoAttributes(path) { - const { attributes } = path.node; - if (attributes.length) { - const start = attributes[0].loc.start; - const end = attributes[attributes.length - 1].loc.end; - throw path.hub.buildError( - { loc: { start, end } }, - "Tag does not support attributes." - ); - } -} - -// assertNoParams -function assertNoParams(path) { - const { params } = path.node.body; - if (params.length) { - const start = params[0].loc.start; - const end = params[params.length - 1].loc.end; - throw path.hub.buildError( - { loc: { start, end } }, - "Tag does not support parameters." - ); - } -} - -// assertNoVar -function assertNoVar(path) { - if (path.node.var) { - throw path.hub.buildError( - path.node.var, - "Tag does not support a variable." - ); - } -} diff --git a/src/file-viewer/scripts/canvas_2020.client.ts b/src/file-viewer/scripts/canvas_2020.client.ts deleted file mode 100644 index da9e056..0000000 --- a/src/file-viewer/scripts/canvas_2020.client.ts +++ /dev/null @@ -1,197 +0,0 @@ -// Vibe coded with AI -(globalThis as any).canvas_2020 = function (canvas: HTMLCanvasElement) { - const isStandalone = canvas.getAttribute("data-standalone") === "true"; - // Rain effect with slanted lines - // Configuration interface for the rain effect - interface RainConfig { - fps: number; // frames per second - color: string; // color of rain particles - angle: number; // angle in degrees - particleDensity: number; // particles per 10000 pixels of canvas area - speed: number; // speed of particles (pixels per frame) - lineWidth: number; // thickness of rain lines - lineLength: number; // length of rain lines - } - - // Rain particle interface - interface RainParticle { - x: number; // x position - y: number; // y position - } - - // Default configuration - const config: RainConfig = { - fps: 16, - color: isStandalone ? "#00FEFB99" : "#081F24", - angle: -18, - particleDensity: 1, - speed: 400, - lineWidth: 8, - lineLength: 100, - }; - - // Get the canvas context - const ctx = canvas.getContext("2d"); - if (!ctx) { - console.error("Could not get canvas context"); - return () => {}; - } - - // Make canvas transparent - if (isStandalone) { - canvas.style.backgroundColor = "#0F252B"; - } else { - canvas.style.backgroundColor = "transparent"; - } - - // Calculate canvas dimensions and update when resized - let width = canvas.width; - let height = canvas.height; - let particles: RainParticle[] = []; - let animationFrameId: number; - let lastFrameTime = 0; - const frameInterval = 1000 / config.fps; - - // Calculate angle in radians - const angleRad = (config.angle * Math.PI) / 180; - - // Update canvas dimensions and particle count when resized - const updateDimensions = () => { - width = canvas.width = canvas.offsetWidth; - height = canvas.height = canvas.offsetHeight; - - // Calculate the canvas area in pixels - const canvasArea = width * height; - - // Calculate target number of particles based on canvas area - const targetParticleCount = Math.floor( - (canvasArea / 10000) * config.particleDensity, - ); - - // Calculate buffer for horizontal offset due to slanted angle - const buffer = Math.abs(height * Math.tan(angleRad)) + config.lineLength; - - // Adjust the particles array - if (particles.length < targetParticleCount) { - // Add more particles if needed - for (let i = particles.length; i < targetParticleCount; i++) { - particles.push(createParticle(true, buffer)); - } - } else if (particles.length > targetParticleCount) { - // Remove excess particles - particles = particles.slice(0, targetParticleCount); - } - }; - - // Create a new particle - // Added initialDistribution parameter to distribute particles across the entire canvas at startup - const createParticle = ( - initialDistribution = false, - buffer: number, - ): RainParticle => { - // For initial distribution, place particles throughout the canvas - // Otherwise start them above the canvas - let x = Math.random() * (width + buffer * 2) - buffer; - let y; - - if (initialDistribution) { - // Distribute across the entire canvas height for initial setup - y = Math.random() * (height + config.lineLength * 2) - config.lineLength; - } else { - // Start new particles from above the canvas with some randomization - y = -config.lineLength - (Math.random() * config.lineLength * 20); - } - - return { - x, - y, - }; - }; - - // Update particle positions - const updateParticles = () => { - // Calculate buffer for horizontal offset due to slanted angle - const buffer = Math.abs(height * Math.tan(angleRad)) + config.lineLength; - - for (let i = 0; i < particles.length; i++) { - const p = particles[i]; - - // Update position based on speed and angle - p.x += Math.sin(angleRad) * config.speed; - p.y += Math.cos(angleRad) * config.speed; - - // Reset particles that go offscreen - only determined by position - // Add extra buffer to ensure particles fully exit the visible area before resetting - if ( - p.y > height + config.lineLength || - p.x < -buffer || - p.x > width + buffer - ) { - particles[i] = createParticle(false, buffer); - } - } - }; - - // Draw particles - const drawParticles = () => { - // Clear canvas - ctx.clearRect(0, 0, width, height); - - // Set drawing properties - ctx.strokeStyle = config.color; - ctx.lineWidth = config.lineWidth; - ctx.lineCap = "square"; - - // Draw each rain line - ctx.beginPath(); - for (const p of particles) { - // Only draw particles that are either on screen or within a reasonable buffer - // This is for performance reasons - we don't need to draw particles far offscreen - if (p.y >= -config.lineLength * 2 && p.y <= height + config.lineLength) { - const endX = p.x + Math.sin(angleRad) * config.lineLength; - const endY = p.y + Math.cos(angleRad) * config.lineLength; - - ctx.moveTo(p.x, p.y); - ctx.lineTo(endX, endY); - } - } - ctx.stroke(); - }; - - // Animation loop - const animate = (currentTime: number) => { - animationFrameId = requestAnimationFrame(animate); - - // Control frame rate - if (currentTime - lastFrameTime < frameInterval) { - return; - } - - lastFrameTime = currentTime; - - updateParticles(); - drawParticles(); - }; - - // Initialize the animation - const init = () => { - // Set up resize handler - globalThis.addEventListener("resize", updateDimensions); - - // Initial setup - updateDimensions(); - - // Start animation - lastFrameTime = performance.now(); - animationFrameId = requestAnimationFrame(animate); - }; - - // Start the animation - init(); - - // Return cleanup function - return () => { - globalThis.removeEventListener("resize", updateDimensions); - cancelAnimationFrame(animationFrameId); - }; -}; diff --git a/src/file-viewer/scripts/canvas_2021.client.ts b/src/file-viewer/scripts/canvas_2021.client.ts deleted file mode 100644 index 21472b2..0000000 --- a/src/file-viewer/scripts/canvas_2021.client.ts +++ /dev/null @@ -1,783 +0,0 @@ -// Vibe coded. -(globalThis as any).canvas_2021 = function (canvas: HTMLCanvasElement) { - const isStandalone = canvas.getAttribute("data-standalone") === "true"; - // Constants for simulation - const PARTICLE_RADIUS = 4.5; - const PARTICLE_DENSITY = 0.004; // Particles per pixel - const MIN_SPEED = 0.05; - const MAX_SPEED = 6.0; - const FRICTION = 0.96; - const REPULSION_STRENGTH = 0.1; - const REPULSION_RADIUS = 50; - const FORCE_RADIUS = 400; // Increased radius - const FORCE_STRENGTH = 0.25; - const FORCE_FALLOFF_EXPONENT = 3; // Higher value = sharper falloff - const FORCE_SPACING = 10; // Pixels between force points - const MIN_FORCE_STRENGTH = 0.05; // Minimum force strength for very slow movements - const MAX_FORCE_STRENGTH = 0.4; // Maximum force strength for fast movements - const MIN_SPEED_THRESHOLD = 1; // Movement speed (px/frame) that produces minimum force - const MAX_SPEED_THRESHOLD = 20; // Movement speed that produces maximum force - const OVERSCAN_PIXELS = 250; - const CELL_SIZE = REPULSION_RADIUS; // For spatial hashing - - let globalOpacity = 0; - - if (isStandalone) { - canvas.style.backgroundColor = "#301D02"; - } else { - canvas.style.backgroundColor = "transparent"; - } - - // Interfaces - interface Particle { - x: number; - y: number; - vx: number; - vy: number; - charge: number; // 0 to 1, affecting color - } - - interface Force { - x: number; - y: number; - dx: number; - dy: number; - strength: number; - radius: number; - createdAt: number; - } - - interface SpatialHash { - [key: string]: Particle[]; - } - - // State - let first = true; - let particles: Particle[] = []; - let forces: Force[] = []; - let width = canvas.width; - let height = canvas.height; - let targetParticleCount = 0; - let spatialHash: SpatialHash = {}; - let ctx: CanvasRenderingContext2D | null = null; - let animationId: number | null = null; - let isRunning = false; - - // Mouse tracking - let lastMousePosition: { x: number; y: number } | null = null; - // Track position of the last created force - let lastForcePosition: { x: number; y: number } | null = null; - - // Keep track of previous canvas dimensions for resize logic - let previousWidth = 0; - let previousHeight = 0; - - // Initialize and cleanup - function init(): void { - ctx = canvas.getContext("2d"); - if (!ctx) return; - - // Set canvas to full size - resizeCanvas(); - - // Event listeners - globalThis.addEventListener("resize", resizeCanvas); - document.addEventListener("mousemove", handleMouseMove); - - // Start animation immediately - start(); - } - - function cleanup(): void { - // Stop the animation - stop(); - - // Remove event listeners - globalThis.removeEventListener("resize", resizeCanvas); - document.removeEventListener("mousemove", handleMouseMove); - - // Clear arrays - particles = []; - forces = []; - spatialHash = {}; - lastMousePosition = null; - lastForcePosition = null; - } - - // Resize canvas and adjust particle count - function resizeCanvas(): void { - // Store previous dimensions - previousWidth = width; - previousHeight = height; - - // Update to new dimensions - width = globalThis.innerWidth; - height = globalThis.innerHeight; - canvas.width = width; - canvas.height = height; - - const oldTargetCount = targetParticleCount; - targetParticleCount = Math.floor(width * height * PARTICLE_DENSITY); - - // Adjust particle count - if (targetParticleCount > oldTargetCount) { - // Add more particles if needed, but only in newly available space - addParticles(targetParticleCount - oldTargetCount, !first); - first = false; - } - // Note: Removal of excess particles happens naturally during update - } - - // Handle mouse movement - function handleMouseMove(e: MouseEvent): void { - const rect = canvas.getBoundingClientRect(); - const currentX = e.clientX - rect.left; - const currentY = e.clientY - rect.top; - - // Initialize positions if this is the first movement - if (!lastMousePosition || !lastForcePosition) { - lastMousePosition = { x: currentX, y: currentY }; - lastForcePosition = { x: currentX, y: currentY }; - return; - } - - // Store current mouse position - const mouseX = currentX; - const mouseY = currentY; - - // Calculate vector from last mouse position to current - const dx = mouseX - lastMousePosition.x; - const dy = mouseY - lastMousePosition.y; - const distMoved = Math.sqrt(dx * dx + dy * dy); - - // Skip if essentially no movement (avoids numerical issues) - if (distMoved < 0.1) { - return; - } - - // Get the vector from the last force to the current mouse position - const forceDx = mouseX - lastForcePosition.x; - const forceDy = mouseY - lastForcePosition.y; - const forceDistance = Math.sqrt(forceDx * forceDx + forceDy * forceDy); - - // Only create forces if we've moved far enough from the last force - if (forceDistance >= FORCE_SPACING) { - // Calculate the direction vector from last force to current mouse - let dirX = forceDx / forceDistance; - let dirY = forceDy / forceDistance; - - // Calculate how many force points to create - const numPoints = Math.floor(forceDistance / FORCE_SPACING); - - // Calculate movement speed based on the recent movement - const movementSpeed = distMoved; // Simple approximation of speed - - // Scale force strength based on movement speed - let speedFactor; - if (movementSpeed <= MIN_SPEED_THRESHOLD) { - speedFactor = MIN_FORCE_STRENGTH; - } else if (movementSpeed >= MAX_SPEED_THRESHOLD) { - speedFactor = MAX_FORCE_STRENGTH; - } else { - // Linear interpolation between min and max - const t = (movementSpeed - MIN_SPEED_THRESHOLD) / - (MAX_SPEED_THRESHOLD - MIN_SPEED_THRESHOLD); - speedFactor = MIN_FORCE_STRENGTH + - t * (MAX_FORCE_STRENGTH - MIN_FORCE_STRENGTH); - } - - // Store current force position to update incrementally - let currentForceX = lastForcePosition.x; - let currentForceY = lastForcePosition.y; - - // Create evenly spaced force points along the path from last force to current mouse - for (let i = 0; i < numPoints; i++) { - // Calculate position for this force point - const t = (i + 1) / numPoints; - const fx = lastForcePosition.x + forceDx * t; - const fy = lastForcePosition.y + forceDy * t; - - // Create force at this position with the direction vector - createForce(fx, fy, dirX, dirY, speedFactor); - - // Update the last force position to this new force - currentForceX = fx; - currentForceY = fy; - } - - // Update the last force position - lastForcePosition = { x: currentForceX, y: currentForceY }; - } - - // Always update the last mouse position - lastMousePosition = { x: mouseX, y: mouseY }; - } - - // Create a new force - function createForce( - x: number, - y: number, - dx: number, - dy: number, - strength = FORCE_STRENGTH, - ): void { - forces.push({ - x, - y, - dx, - dy, - strength, - radius: 1, - createdAt: Date.now(), - }); - } - - // Improved particle addition with fill strategy options - function addParticles(count: number, inNewAreaOnly: boolean = false): void { - // Determine available space - const minX = -OVERSCAN_PIXELS; - const maxX = width + OVERSCAN_PIXELS; - const minY = -OVERSCAN_PIXELS; - const maxY = height + OVERSCAN_PIXELS; - - // Use a grid system that guarantees uniform spacing of particles - const gridSpacing = REPULSION_RADIUS * 0.8; // Slightly less than repulsion radius - const gridWidth = Math.ceil((maxX - minX) / gridSpacing); - const gridHeight = Math.ceil((maxY - minY) / gridSpacing); - - // Track which grid cells are already occupied - const occupiedCells: Set<string> = new Set(); - - // Mark cells occupied by existing particles - for (const particle of particles) { - const cellX = Math.floor((particle.x - minX) / gridSpacing); - const cellY = Math.floor((particle.y - minY) / gridSpacing); - - // Ensure cell coordinates are within valid range - if (cellX >= 0 && cellX < gridWidth && cellY >= 0 && cellY < gridHeight) { - occupiedCells.add(`${cellX},${cellY}`); - } - } - - // Create arrays of all cells and filter by placement strategy - const allGridCells: { x: number; y: number }[] = []; - - for (let cellY = 0; cellY < gridHeight; cellY++) { - for (let cellX = 0; cellX < gridWidth; cellX++) { - const cellKey = `${cellX},${cellY}`; - if (!occupiedCells.has(cellKey)) { - const posX = minX + (cellX + 0.5) * gridSpacing; - const posY = minY + (cellY + 0.5) * gridSpacing; - - // For new area only placement, filter to expanded areas - if (inNewAreaOnly && previousWidth > 0 && previousHeight > 0) { - const expandedRight = width > previousWidth; - const expandedBottom = height > previousHeight; - - const inNewRightArea = expandedRight && posX >= previousWidth && - posX <= width; - const inNewBottomArea = expandedBottom && posY >= previousHeight && - posY <= height; - - if (inNewRightArea || inNewBottomArea) { - allGridCells.push({ x: cellX, y: cellY }); - } - } else if (!inNewAreaOnly) { - // Standard placement - add all valid cells - allGridCells.push({ x: cellX, y: cellY }); - } - } - } - } - - if (allGridCells.length == 0) { - throw new Error("No cells available to place particles"); - } - - // We now have all grid cells that match our placement criteria - - // If we need more particles than we have available cells, we need to adjust - // gridSpacing to fit more cells into the same space - if (count > allGridCells.length) { - // Retry with a smaller grid spacing - // Proportionally reduce the grid spacing to fit the required number of particles - const scaleFactor = Math.sqrt(allGridCells.length / count); - const newGridSpacing = gridSpacing * scaleFactor; - - // Clear particles and try again with new spacing - // This is a recursive call, but with adjusted parameters that will fit - return addParticlesWithCustomSpacing( - count, - inNewAreaOnly, - newGridSpacing, - ); - } - - // Shuffle the available cells for random selection - shuffleArray(allGridCells); - - // Take the number of cells we need - const cellsToUse = Math.min(count, allGridCells.length); - const selectedCells = allGridCells.slice(0, cellsToUse); - - // Create particles in selected cells - for (const cell of selectedCells) { - // Add jitter within the cell for natural look - const jitterX = (Math.random() - 0.5) * gridSpacing * 0.8; - const jitterY = (Math.random() - 0.5) * gridSpacing * 0.8; - - // Calculate final position - const x = minX + (cell.x + 0.5) * gridSpacing + jitterX; - const y = minY + (cell.y + 0.5) * gridSpacing + jitterY; - - // Create a particle at this position - particles.push(createParticle(x, y)); - } - } - - // Helper function to add particles with custom grid spacing - function addParticlesWithCustomSpacing( - count: number, - inNewAreaOnly: boolean, - gridSpacing: number, - ): void { - if (gridSpacing == 0) throw new Error("Grid spacing is 0"); - // Determine available space - const minX = -OVERSCAN_PIXELS; - const maxX = width + OVERSCAN_PIXELS; - const minY = -OVERSCAN_PIXELS; - const maxY = height + OVERSCAN_PIXELS; - - // Create grid using the custom spacing - const gridWidth = Math.ceil((maxX - minX) / gridSpacing); - const gridHeight = Math.ceil((maxY - minY) / gridSpacing); - - // Track which grid cells are already occupied - const occupiedCells: Set<string> = new Set(); - - // Mark cells occupied by existing particles - for (const particle of particles) { - const cellX = Math.floor((particle.x - minX) / gridSpacing); - const cellY = Math.floor((particle.y - minY) / gridSpacing); - - // Ensure cell coordinates are within valid range - if (cellX >= 0 && cellX < gridWidth && cellY >= 0 && cellY < gridHeight) { - occupiedCells.add(`${cellX},${cellY}`); - } - } - - // Create arrays of all cells and filter by placement strategy - const allGridCells: { x: number; y: number }[] = []; - - for (let cellY = 0; cellY < gridHeight; cellY++) { - for (let cellX = 0; cellX < gridWidth; cellX++) { - const cellKey = `${cellX},${cellY}`; - if (!occupiedCells.has(cellKey)) { - const posX = minX + (cellX + 0.5) * gridSpacing; - const posY = minY + (cellY + 0.5) * gridSpacing; - - // For new area only placement, filter to expanded areas - if (inNewAreaOnly && previousWidth > 0 && previousHeight > 0) { - const expandedRight = width > previousWidth; - const expandedBottom = height > previousHeight; - - const inNewRightArea = expandedRight && posX >= previousWidth && - posX <= width; - const inNewBottomArea = expandedBottom && posY >= previousHeight && - posY <= height; - - if (inNewRightArea || inNewBottomArea) { - allGridCells.push({ x: cellX, y: cellY }); - } - } else if (!inNewAreaOnly) { - // Standard placement - add all valid cells - allGridCells.push({ x: cellX, y: cellY }); - } - } - } - } - - // Shuffle the available cells for random distribution - shuffleArray(allGridCells); - - // Take the number of cells we need (or all if we have fewer) - const cellsToUse = Math.min(count, allGridCells.length); - - // Create particles in selected cells - for (let i = 0; i < cellsToUse; i++) { - const cell = allGridCells[i]; - - // Add jitter within the cell - const jitterX = (Math.random() - 0.5) * gridSpacing * 0.8; - const jitterY = (Math.random() - 0.5) * gridSpacing * 0.8; - - // Calculate final position - const x = minX + (cell.x + 0.5) * gridSpacing + jitterX; - const y = minY + (cell.y + 0.5) * gridSpacing + jitterY; - - // Create a particle at this position - particles.push(createParticle(x, y)); - } - } - - // Utility to shuffle an array (Fisher-Yates algorithm) - function shuffleArray<T>(array: T[]): void { - for (let i = array.length - 1; i > 0; i--) { - const j = Math.floor(Math.random() * (i + 1)); - [array[i], array[j]] = [array[j], array[i]]; - } - } - - // Simplified createParticle function that just places at a specific position - function createParticle(x: number, y: number): Particle { - return { - x: x + (Math.random() * 4 - 2), - y: y + (Math.random() * 4 - 2), - vx: 0, - vy: 0, - charge: 0, - }; - } - - // Function to create a particle on one of the edges - function createParticleOnEdge(): Particle { - // Overscan bounds with fixed pixel size - const minX = -OVERSCAN_PIXELS; - const maxX = width + OVERSCAN_PIXELS; - const minY = -OVERSCAN_PIXELS; - const maxY = height + OVERSCAN_PIXELS; - - let x: number, y: number; - - // Place on one of the edges - const edge = Math.floor(Math.random() * 4); - switch (edge) { - case 0: // Top - x = minX + Math.random() * (maxX - minX); - y = minY; - break; - case 1: // Right - x = maxX; - y = minY + Math.random() * (maxY - minY); - break; - case 2: // Bottom - x = minX + Math.random() * (maxX - minX); - y = maxY; - break; - case 3: // Left - x = minX; - y = minY + Math.random() * (maxY - minY); - break; - default: - x = minX + Math.random() * (maxX - minX); - y = minY + Math.random() * (maxY - minY); - } - - return createParticle(x, y); - } - - // Spatial hashing functions - function getHashKey(x: number, y: number): string { - const cellX = Math.floor(x / CELL_SIZE); - const cellY = Math.floor(y / CELL_SIZE); - return `${cellX},${cellY}`; - } - - function addToSpatialHash(particle: Particle): void { - const key = getHashKey(particle.x, particle.y); - if (!spatialHash[key]) { - spatialHash[key] = []; - } - spatialHash[key].push(particle); - } - - function updateSpatialHash(): void { - // Clear previous hash - spatialHash = {}; - - // Add all particles to hash - for (const particle of particles) { - addToSpatialHash(particle); - } - } - - function getNearbyParticles( - x: number, - y: number, - radius: number, - ): Particle[] { - const result: Particle[] = []; - const cellRadius = Math.ceil(radius / CELL_SIZE); - - const centerCellX = Math.floor(x / CELL_SIZE); - const centerCellY = Math.floor(y / CELL_SIZE); - - for ( - let cellX = centerCellX - cellRadius; - cellX <= centerCellX + cellRadius; - cellX++ - ) { - for ( - let cellY = centerCellY - cellRadius; - cellY <= centerCellY + cellRadius; - cellY++ - ) { - const key = `${cellX},${cellY}`; - const cell = spatialHash[key]; - - if (cell) { - result.push(...cell); - } - } - } - - return result; - } - - // Main update function - function update(): void { - const now = Date.now(); - // Fixed pixel overscan - const minX = -OVERSCAN_PIXELS; - const maxX = width + OVERSCAN_PIXELS; - const minY = -OVERSCAN_PIXELS; - const maxY = height + OVERSCAN_PIXELS; - - // Update spatial hash - updateSpatialHash(); - - // Update forces and remove expired ones - if (forces.length > 40) { - forces = forces.slice(-40); - } - forces = forces.filter((force) => { - force.strength *= 0.95; - force.radius *= 0.95; - return force.strength > 0.001; - }); - - // Update particles - const newParticles: Particle[] = []; - - for (const particle of particles) { - // Apply forces - for (const force of forces) { - const dx = particle.x - force.x; - const dy = particle.y - force.y; - const distSq = dx * dx + dy * dy; - - const radius = force.radius * FORCE_RADIUS; - - if (distSq < radius * radius) { - const dist = Math.sqrt(distSq); - - // Exponential falloff - much more concentrated at center - // (1 - x/R)^n where n controls how sharp the falloff is - const normalizedDist = dist / radius; - const factor = Math.pow(1 - normalizedDist, FORCE_FALLOFF_EXPONENT); - - // Calculate force line projection for directional effect - // This makes particles along the force's path experience stronger effect - const dotProduct = (dx * -force.dx) + (dy * -force.dy); - const projectionFactor = Math.max(0, dotProduct / dist); - - // Apply the combined factors - stronger directional bias - const finalFactor = factor * force.strength * - (0.1 + 0.9 * projectionFactor); - - particle.vx += force.dx * finalFactor; - particle.vy += force.dy * finalFactor; - // charge for the first 100ms - if ((now - force.createdAt) < 100) { - particle.charge = Math.min( - 1, - particle.charge + (finalFactor * finalFactor) * 0.2, - ); - } - } - } - - // Apply repulsion from nearby particles - const nearby = getNearbyParticles( - particle.x, - particle.y, - REPULSION_RADIUS, - ); - - for (const other of nearby) { - if (other === particle) continue; - - const dx = particle.x - other.x; - const dy = particle.y - other.y; - const distSq = dx * dx + dy * dy; - - if (distSq < REPULSION_RADIUS * REPULSION_RADIUS && distSq > 0) { - const dist = Math.sqrt(distSq); - const factor = REPULSION_STRENGTH * (1 - dist / REPULSION_RADIUS); - - const fx = dx / dist * factor; - const fy = dy / dist * factor; - - particle.vx += fx; - particle.vy += fy; - } - } - - // Apply friction - particle.vx *= FRICTION; - particle.vy *= FRICTION; - - // Ensure minimum speed - const speed = Math.sqrt( - particle.vx * particle.vx + particle.vy * particle.vy, - ); - if (speed < MIN_SPEED && speed > 0) { - const scale = MIN_SPEED / speed; - particle.vx *= scale; - particle.vy *= scale; - } - - // Cap at maximum speed - if (speed > MAX_SPEED) { - const scale = MAX_SPEED / speed; - particle.vx *= scale; - particle.vy *= scale; - } - - // Update position - particle.x += particle.vx; - particle.y += particle.vy; - - // Decrease charge - particle.charge *= 0.99; - - // Check if particle is within extended bounds - if ( - particle.x >= minX && particle.x <= maxX && - particle.y >= minY && particle.y <= maxY - ) { - // If outside screen but within overscan, keep it if we need more particles - if ( - (particle.x < 0 || particle.x > width || - particle.y < 0 || particle.y > height) && - newParticles.length >= targetParticleCount - ) { - continue; - } - - newParticles.push(particle); - } else { - // Out of bounds, respawn if needed - if (newParticles.length < targetParticleCount) { - newParticles.push(createParticleOnEdge()); - } - } - } - - // Add more particles if needed - while (newParticles.length < targetParticleCount) { - newParticles.push(createParticleOnEdge()); - } - - particles = newParticles; - } - - // Render function - const mul = isStandalone ? 0.9 : 0.5; - const add = isStandalone ? 0.1 : 0.03; - function render(): void { - if (!ctx) return; - - // Clear canvas - ctx.clearRect(0, 0, width, height); - - // Draw particles - for (const particle of particles) { - // Only draw if within canvas bounds (plus a small margin) - if ( - particle.x >= -PARTICLE_RADIUS && - particle.x <= width + PARTICLE_RADIUS && - particle.y >= -PARTICLE_RADIUS && particle.y <= height + PARTICLE_RADIUS - ) { - ctx.beginPath(); - ctx.arc(particle.x, particle.y, PARTICLE_RADIUS, 0, Math.PI * 2); - - // Color based on charge - ctx.fillStyle = "#FFCB1F"; - ctx.globalAlpha = (particle.charge * mul + add) * globalOpacity; - ctx.fill(); - } - } - - // // Debug: Draw forces and falloff visualization - // if (ctx) { - // for (const force of forces) { - // const R = force.radius * FORCE_RADIUS; - - // // Draw force point - // ctx.beginPath(); - // ctx.arc(force.x, force.y, 5, 0, Math.PI * 2); - // ctx.fillStyle = 'rgba(255, 0, 0, 0.5)'; - // ctx.fill(); - - // // Draw force direction - // ctx.beginPath(); - // ctx.moveTo(force.x, force.y); - // ctx.lineTo(force.x + force.dx * 20, force.y + force.dy * 20); - // ctx.strokeStyle = 'red'; - // ctx.stroke(); - - // // Visualize the falloff curve with rings - // for (let i = 0; i <= 10; i++) { - // const radius = (R * i) / 10; - // const normalizedDist = radius / R; - // const intensity = Math.pow(1 - normalizedDist, FORCE_FALLOFF_EXPONENT); - - // ctx.beginPath(); - // ctx.arc(force.x, force.y, radius, 0, Math.PI * 2); - // ctx.strokeStyle = `rgba(255, 0, 0, ${intensity * 0.2})`; - // ctx.stroke(); - // } - // } - // } - } - - // Animation loop - let r = Math.random(); - function animate(): void { - globalOpacity = Math.min(1, globalOpacity + 0.03); - update(); - render(); - - if (isRunning) { - animationId = requestAnimationFrame(animate); - } - } - - // Start/stop functions - function start(): void { - if (isRunning) return; - - // Calculate target particle count based on canvas size - targetParticleCount = Math.floor(width * height * PARTICLE_DENSITY); - - // Clear any existing particles and create new ones with proper spacing - particles = []; - addParticles(targetParticleCount); - - isRunning = true; - animate(); - } - - function stop(): void { - isRunning = false; - - if (animationId !== null) { - cancelAnimationFrame(animationId); - animationId = null; - } - } - - init(); - return cleanup; -}; diff --git a/src/file-viewer/scripts/canvas_2022.client.ts b/src/file-viewer/scripts/canvas_2022.client.ts deleted file mode 100644 index ea0ad15..0000000 --- a/src/file-viewer/scripts/canvas_2022.client.ts +++ /dev/null @@ -1,160 +0,0 @@ -(globalThis as any).canvas_2022 = function (canvas: HTMLCanvasElement) { - const isStandalone = canvas.getAttribute("data-standalone") === "true"; - // Configuration for the grid of rotating squares - const config = { - gridRotation: 20, // Overall grid rotation in degrees - squareSize: 20, // Size of each square - spacing: 100, // Distance between square centers - moveSpeedX: 0.01, // Horizontal movement speed (pixels per second) - moveSpeedY: 0.01, // Vertical movement speed (pixels per second) - squareColor: "#00220A", // Color of the squares - squareOpacity: 1, // Opacity of the squares - - // Function to determine square rotation based on its coordinates and time - // Can be adjusted for different patterns - rotationFunction: (x: number, y: number, time: number): number => { - // Combination of spatial wave and time-based rotation - return Math.sin(x * 0.05) * Math.cos(y * 0.05) * 180; - }, - }; - - // Convert grid rotation to radians - const gridRotationRad = (config.gridRotation * Math.PI) / 180; - - // Get the canvas context - const ctx = canvas.getContext("2d"); - if (!ctx) { - console.error("Could not get canvas context"); - return () => {}; - } - - // Make canvas transparent - if (isStandalone) { - canvas.style.backgroundColor = "#154226"; - } else { - canvas.style.backgroundColor = "transparent"; - } - - // Animation variables - let width = canvas.width; - let height = canvas.height; - let offsetX = 0; - let offsetY = 0; - let time = 0; - let animationFrameId: number; - let lastTime = 0; - - // Update canvas dimensions when resized - const updateDimensions = () => { - width = canvas.width = canvas.clientWidth; - height = canvas.height = canvas.clientHeight; - }; - - // Calculate the diagonal length of the canvas (to ensure rotation covers corners) - const calculateDiagonal = () => { - return Math.sqrt(width * width + height * height); - }; - - // Draw a single square with rotation - const drawSquare = (x: number, y: number, size: number, rotation: number) => { - ctx.save(); - - // Move to the center of the square position, rotate, then draw - ctx.translate(x, y); - ctx.rotate((rotation * Math.PI) / 180); // Convert rotation degrees to radians - - // Draw square centered at position - ctx.fillRect(-size / 2, -size / 2, size, size); - - ctx.restore(); - }; - - // Draw the entire grid of squares - const drawGrid = () => { - ctx.clearRect(0, 0, width, height); - - // Set drawing properties - ctx.fillStyle = config.squareColor; - ctx.globalAlpha = config.squareOpacity; - - // Save the current transformation state - ctx.save(); - - // Move to the center of the canvas, rotate the grid, then move back - const centerX = width / 2; - const centerY = height / 2; - ctx.translate(centerX, centerY); - ctx.rotate(gridRotationRad); - - // Calculate how much of the grid to draw based on canvas size - const diagonal = calculateDiagonal(); - const gridSize = Math.ceil(diagonal / config.spacing) + 2; - - // Adjust for offset to create movement - const adjustedOffsetX = offsetX % config.spacing; - const adjustedOffsetY = offsetY % config.spacing; - - // Draw grid with enough squares to cover the rotated canvas - const halfGrid = Math.ceil(gridSize / 2); - - for (let y = -halfGrid; y <= halfGrid; y++) { - for (let x = -halfGrid; x <= halfGrid; x++) { - // Calculate actual position with offset - const posX = x * config.spacing + adjustedOffsetX; - const posY = y * config.spacing + adjustedOffsetY; - - // Calculate square rotation based on its position and time - const squareRotation = config.rotationFunction(posX, posY, time); - - // Draw the square - drawSquare(posX, posY, config.squareSize, squareRotation); - } - } - - // Restore the transformation state - ctx.restore(); - - // Reset global alpha - ctx.globalAlpha = 1.0; - }; - - // Animation loop - const animate = (currentTime: number) => { - animationFrameId = requestAnimationFrame(animate); - - // Calculate time elapsed since last frame - const elapsed = currentTime - lastTime; - lastTime = currentTime; - - // Update time variable for rotation function - time += elapsed; - - // Update position offsets for movement - offsetX += config.moveSpeedX * elapsed; - offsetY += config.moveSpeedY * elapsed; - - // Draw the grid - drawGrid(); - }; - - // Initialize the animation - const init = () => { - // Set up resize handler - globalThis.addEventListener("resize", updateDimensions); - - // Initial setup - updateDimensions(); - - // Start animation - animationFrameId = requestAnimationFrame(animate); - }; - - // Start the animation - init(); - - // Return cleanup function - return () => { - globalThis.removeEventListener("resize", updateDimensions); - cancelAnimationFrame(animationFrameId); - }; -}; diff --git a/src/file-viewer/scripts/canvas_2023.client.ts b/src/file-viewer/scripts/canvas_2023.client.ts deleted file mode 100644 index da6c795..0000000 --- a/src/file-viewer/scripts/canvas_2023.client.ts +++ /dev/null @@ -1,197 +0,0 @@ -(globalThis as any).canvas_2023 = function (canvas: HTMLCanvasElement) { - const isStandalone = canvas.getAttribute("data-standalone") === "true"; - const config = { - heartBaseSize: 50, - heartMaxSize: 100, - spacing: 150, - rowSpeed: 0.1, - heartColor: "#FF90D9", - heartOpacity: isStandalone ? 0.5 : 0.04, - mouseInfluenceRadius: 1000, - heartScaleFunction: (distance: number, radius: number): number => { - if (distance > radius) return 1; - - const normalizedDistance = distance / radius; - const scaleFactor = 1 + - (1 - normalizedDistance) * - (config.heartMaxSize / config.heartBaseSize - 1); - - return 1 + (scaleFactor - 1) * Math.pow(1 - normalizedDistance, 2); - }, - }; - - const heart = new Path2D( - "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", - ); - - const ctx = canvas.getContext("2d"); - if (!ctx) { - console.error("Could not get canvas context"); - return () => {}; - } - - if (isStandalone) { - canvas.style.backgroundColor = "#2F1C21"; - } else { - canvas.style.backgroundColor = "transparent"; - } - - let width = canvas.width; - let height = canvas.height; - let animationFrameId: number; - let lastFrameTime = 0; - - let mouseX = width / 2; - let mouseY = height / 2; - - let offset = config.spacing / 2; - - const updateDimensions = () => { - width = canvas.width = canvas.clientWidth; - height = canvas.height = canvas.clientHeight; - - mouseX = width / 2; - mouseY = height / 2; - }; - - const drawHeart = (x: number, y: number, size: number) => { - const scale = size / 30; - - ctx.save(); - ctx.translate(x, y); - ctx.scale(scale, scale); - - ctx.fillStyle = config.heartColor; - ctx.fill(heart); - - ctx.restore(); - }; - - const c = 400; - const h = 40; - const k = solveForK(c, h); - - const drawHeartGrid = () => { - ctx.clearRect(0, 0, width, height); - - ctx.globalAlpha = config.heartOpacity; - - const numRows = Math.ceil(height / config.spacing) + 1; - - for (let row = 0; row < numRows; row++) { - const direction = row % 2 === 0 ? 1 : -1; - const rowOffset = (offset * direction) % config.spacing; - - const posYInit = row * config.spacing + config.spacing / 2; - - for ( - let posXInit = -config.spacing + rowOffset; - posXInit < width + config.spacing; - posXInit += config.spacing - ) { - const dx = (posXInit + config.heartBaseSize / 2) - mouseX; - const dy = (posYInit + config.heartBaseSize / 2) - mouseY; - const distance = Math.sqrt(dx * dx + dy * dy); - - const pushIntensity = asymmetricBump(distance, h, c, k, 0.00002); - - const pushAngle = Math.atan2(dy, dx); - - const pushDistanceX = pushIntensity * Math.cos(pushAngle); - const pushDistanceY = pushIntensity * Math.sin(pushAngle); - const posX = posXInit + pushDistanceX * 1; - const posY = posYInit + pushDistanceY * 2; - - const scaleFactor = config.heartScaleFunction( - distance, - config.mouseInfluenceRadius, - ); - const heartSize = config.heartBaseSize * scaleFactor; - - if ( - posX > -config.heartMaxSize && - posX < width + config.heartMaxSize && - posY > -config.heartMaxSize && - posY < height + config.heartMaxSize - ) { - drawHeart(posX - heartSize / 2, posY - heartSize / 2, heartSize); - } - } - } - - ctx.globalAlpha = 1.0; - }; - - function solveForK(c: number, k: number) { - // input -> f(x)=h*e^{(-k*(x-c)^{2})} - // desired result is (0, 0.45). (0, 0) is unsolvable but 0.45px will round down to 0. - // - // solution: -\frac{\ln\left(\frac{0.45}{h}\right)}{c^{2}} - return -Math.log(0.45 / h) / (c * c); - } - - function asymmetricBump( - x: number, - h: number, - c: number, - leftK: number, - rightK: number, - ) { - const k = (x <= c) ? leftK : rightK; - return h * Math.exp(-k * Math.pow(x - c, 2)); - } - - const updateOffset = (elapsed: number) => { - offset += config.rowSpeed * elapsed; - - if (offset > 1000000) { - offset -= 1000000; - } - }; - - const animate = (currentTime: number) => { - animationFrameId = requestAnimationFrame(animate); - - const elapsed = currentTime - lastFrameTime; - lastFrameTime = currentTime; - - updateOffset(elapsed * 0.05); - - drawHeartGrid(); - }; - - const handleMouseMove = (event: MouseEvent) => { - const rect = canvas.getBoundingClientRect(); - mouseX = event.clientX - rect.left; - mouseY = event.clientY - rect.top; - }; - - const handleTouchMove = (event: TouchEvent) => { - if (event.touches.length > 0) { - event.preventDefault(); - const rect = canvas.getBoundingClientRect(); - mouseX = event.touches[0].clientX - rect.left; - mouseY = event.touches[0].clientY - rect.top; - } - }; - - const init = () => { - globalThis.addEventListener("resize", updateDimensions); - document.addEventListener("mousemove", handleMouseMove); - document.addEventListener("touchmove", handleTouchMove, { passive: false }); - - updateDimensions(); - - lastFrameTime = performance.now(); - animationFrameId = requestAnimationFrame(animate); - }; - - init(); - - return () => { - globalThis.removeEventListener("resize", updateDimensions); - document.removeEventListener("mousemove", handleMouseMove); - document.removeEventListener("touchmove", handleTouchMove); - cancelAnimationFrame(animationFrameId); - }; -}; diff --git a/src/file-viewer/scripts/canvas_2024.client.ts b/src/file-viewer/scripts/canvas_2024.client.ts deleted file mode 100644 index 89e8a21..0000000 --- a/src/file-viewer/scripts/canvas_2024.client.ts +++ /dev/null @@ -1,251 +0,0 @@ -// Vibe coded with AI -(globalThis as any).canvas_2024 = function (canvas: HTMLCanvasElement) { - const isStandalone = canvas.getAttribute("data-standalone") === "true"; - if (isStandalone) { - canvas.parentElement!.style.backgroundColor = "black"; - } - - const gl = canvas.getContext("webgl", { - alpha: true, - premultipliedAlpha: false, - }); - if (!gl) { - console.error("WebGL not supported"); - return () => {}; - } - - canvas.style.imageRendering = "pixelated"; - canvas.style.opacity = isStandalone ? "0.3" : "0.15"; - - // Resize canvas to match display size - const resize = () => { - const displayWidth = Math.floor( - (canvas.clientWidth || globalThis.innerWidth) / 3, - ); - const displayHeight = Math.floor( - (canvas.clientHeight || globalThis.innerHeight) / 3, - ); - - if (canvas.width !== displayWidth || canvas.height !== displayHeight) { - canvas.width = displayWidth; - canvas.height = displayHeight; - gl.viewport(0, 0, canvas.width, canvas.height); - } - }; - resize(); - - // Vertex shader (just passes coordinates) - const vertexShaderSource = ` - attribute vec2 a_position; - void main() { - gl_Position = vec4(a_position, 0.0, 1.0); - } - `; - - // Fragment shader creates random noise with higher opacity to ensure visibility - const fragmentShaderSource = ` - precision mediump float; - uniform float u_time; - - float noise1(float seed1,float seed2){ - return( - fract(seed1+12.34567* - fract(100.*(abs(seed1*0.91)+seed2+94.68)* - fract((abs(seed2*0.41)+45.46)* - fract((abs(seed2)+757.21)* - fract(seed1*0.0171)))))) - * 1.0038 - 0.00185; - } - - float n(float seed1, float seed2, float seed3){ - float buff1 = abs(seed1+100.81) + 1000.3; - float buff2 = abs(seed2+100.45) + 1000.2; - float buff3 = abs(noise1(seed1, seed2)+seed3) + 1000.1; - buff1 = (buff3*fract(buff2*fract(buff1*fract(buff2*0.146)))); - buff2 = (buff2*fract(buff2*fract(buff1+buff2*fract(buff3*0.52)))); - buff1 = noise1(buff1, buff2); - return(buff1); - } - - void main() { - float noise = n(gl_FragCoord.x, gl_FragCoord.y, u_time); - - gl_FragColor = vec4(1.0, 0.7, 0.7, 0.8*noise); - } - `; - - // Create and compile shaders - const vertexShader = createShader(gl, gl.VERTEX_SHADER, vertexShaderSource); - const fragmentShader = createShader( - gl, - gl.FRAGMENT_SHADER, - fragmentShaderSource, - ); - - // Check if shader creation failed - if (!vertexShader || !fragmentShader) { - console.error("Failed to create shaders"); - return () => {}; - } - - // Create program and link shaders - const program = createProgram(gl, vertexShader, fragmentShader); - - // Check if program creation failed - if (!program) { - console.error("Failed to create program"); - return () => {}; - } - - // Get attribute and uniform locations - const positionAttributeLocation = gl.getAttribLocation(program, "a_position"); - const timeUniformLocation = gl.getUniformLocation(program, "u_time"); - - // Create a position buffer for a rectangle covering the entire canvas - const positionBuffer = gl.createBuffer(); - if (!positionBuffer) { - console.error("Failed to create position buffer"); - return () => {}; - } - - gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer); - // Rectangle that covers the entire clip space - const positions = [ - -1.0, - -1.0, // bottom left - 1.0, - -1.0, // bottom right - -1.0, - 1.0, // top left - 1.0, - 1.0, // top right - ]; - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(positions), gl.STATIC_DRAW); - - // Set up blending - gl.enable(gl.BLEND); - gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA); - - // Fixed 24 FPS timing - const FPS = 24; - const FRAME_TIME = 1000 / FPS; // ms per frame - - // Handle animation - let animationTimerId: number; - let startTime = Date.now(); - let lastFrameTime = 0; - - const render = () => { - // Get current time - const currentTime = Date.now(); - const deltaTime = currentTime - lastFrameTime; - - // Skip frame if it's too early (maintain 24 FPS) - if (deltaTime < FRAME_TIME) { - animationTimerId = globalThis.setTimeout(render, 0); // Check again ASAP but yield to browser - return; - } - - // Update last frame time, accounting for any drift - lastFrameTime = currentTime - (deltaTime % FRAME_TIME); - - // Resize canvas if needed - resize(); - - // Calculate elapsed time in seconds for animation - const elapsedTime = (currentTime - startTime) / 1000; - - // Clear the canvas with transparent black - gl.clearColor(0, 0, 0, 0); - gl.clear(gl.COLOR_BUFFER_BIT); - - // Use our shader program - gl.useProgram(program); - - // Set up the position attribute - gl.enableVertexAttribArray(positionAttributeLocation); - gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer); - gl.vertexAttribPointer( - positionAttributeLocation, - 2, // 2 components per vertex - gl.FLOAT, // data type - false, // normalize - 0, // stride (0 = compute from size and type) - 0, // offset - ); - - // Update time uniform for animation - gl.uniform1f(timeUniformLocation, elapsedTime); - - // Draw the rectangle (2 triangles) - gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4); - - // Schedule next frame (aiming for 24 FPS) - const timeToNextFrame = Math.max( - 0, - FRAME_TIME - (Date.now() - currentTime), - ); - animationTimerId = globalThis.setTimeout(render, timeToNextFrame); - }; - - // Helper function to create shaders - function createShader( - gl: WebGLRenderingContext, - type: number, - source: string, - ): WebGLShader | null { - const shader = gl.createShader(type); - if (!shader) { - console.error("Failed to create shader object"); - return null; - } - - gl.shaderSource(shader, source); - gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) { - console.error("Shader compilation error:", gl.getShaderInfoLog(shader)); - gl.deleteShader(shader); - return null; - } - - return shader; - } - - // Helper function to create program and link shaders - function createProgram( - gl: WebGLRenderingContext, - vertexShader: WebGLShader, - fragmentShader: WebGLShader, - ): WebGLProgram | null { - const program = gl.createProgram(); - if (!program) { - console.error("Failed to create program object"); - return null; - } - - gl.attachShader(program, vertexShader); - gl.attachShader(program, fragmentShader); - gl.linkProgram(program); - - if (!gl.getProgramParameter(program, gl.LINK_STATUS)) { - console.error("Program linking error:", gl.getProgramInfoLog(program)); - return null; - } - - return program; - } - - // Start the rendering with initial timestamp - lastFrameTime = Date.now(); - render(); - - // Return cleanup function - return () => { - clearTimeout(animationTimerId); - if (program) gl.deleteProgram(program); - if (vertexShader) gl.deleteShader(vertexShader); - if (fragmentShader) gl.deleteShader(fragmentShader); - if (positionBuffer) gl.deleteBuffer(positionBuffer); - }; -}; diff --git a/src/file-viewer/scripts/canvas_cotyledon.client.ts b/src/file-viewer/scripts/canvas_cotyledon.client.ts deleted file mode 100644 index fa32986..0000000 --- a/src/file-viewer/scripts/canvas_cotyledon.client.ts +++ /dev/null @@ -1,197 +0,0 @@ -// __esModule -true - -// computeNode -function computeNode(node) { - switch (node.type) { - case "StringLiteral": - case "NumericLiteral": - case "BooleanLiteral": - return { value: node.value }; - case "RegExpLiteral": - return { value: new RegExp(node.pattern, node.flags) }; - case "NullLiteral": - return { value: null }; - case "Identifier": - switch (node.name) { - case "undefined": - return { value: undefined }; - case "NaN": - return { value: NaN }; - case "Infinity": - return { value: Infinity }; - default: - return; - } - case "BigIntLiteral": - return { value: BigInt(node.value) }; - case "ParenthesizedExpression": - return computeNode(node.expression); - case "BinaryExpression":{ - const left = computeNode(node.left); - if (!left) return; - const right = computeNode(node.right); - if (!right) return; - switch (node.operator) { - case "+": - return { value: left.value + right.value }; - case "-": - return { value: left.value - right.value }; - case "*": - return { value: left.value * right.value }; - case "/": - return { value: left.value / right.value }; - case "%": - return { value: left.value % right.value }; - case "**": - return { value: left.value ** right.value }; - case "|": - return { value: left.value | right.value }; - case "&": - return { value: left.value & right.value }; - case "^": - return { value: left.value ^ right.value }; - case "<<": - return { value: left.value << right.value }; - case ">>": - return { value: left.value >> right.value }; - case ">>>": - return { value: left.value >>> right.value }; - case "==": - return { value: left.value == right.value }; - case "!=": - return { value: left.value != right.value }; - case "===": - return { value: left.value === right.value }; - case "!==": - return { value: left.value !== right.value }; - case "<": - return { value: left.value < right.value }; - case "<=": - return { value: left.value <= right.value }; - case ">": - return { value: left.value > right.value }; - case ">=": - return { value: left.value >= right.value }; - default: - return; - } - } - case "UnaryExpression":{ - const arg = computeNode(node.argument); - if (!arg) return; - switch (node.operator) { - case "+": - return { value: +arg.value }; - case "-": - return { value: -arg.value }; - case "~": - return { value: ~arg.value }; - case "!": - return { value: !arg.value }; - case "typeof": - return { value: typeof arg.value }; - case "void": - return { value: void arg.value }; - default: - return; - } - } - case "LogicalExpression":{ - const left = computeNode(node.left); - if (!left) return; - const right = computeNode(node.right); - if (!right) return; - switch (node.operator) { - case "&&": - return { value: left.value && right.value }; - case "||": - return { value: left.value || right.value }; - case "??": - return { value: left.value ?? right.value }; - default: - return; - } - } - case "ConditionalExpression":{ - const test = computeNode(node.test); - if (!test) return; - const consequent = computeNode(node.consequent); - if (!consequent) return; - const alternate = computeNode(node.alternate); - if (!alternate) return; - return { value: test.value ? consequent.value : alternate.value }; - } - case "TemplateLiteral":{ - let value = node.quasis[0].value.cooked; - for (let i = 0; i < node.expressions.length; i++) { - const expr = computeNode(node.expressions[i]); - if (!expr) return; - value += expr.value + node.quasis[i + 1].value.cooked; - } - return { value }; - } - case "ObjectExpression":{ - const value = {}; - for (const prop of node.properties) { - if (prop.decorators) return; - switch (prop.type) { - case "ObjectProperty":{ - let key; - if (prop.computed) { - const keyNode = computeNode(prop.key); - if (!keyNode) return; - key = keyNode.value + ""; - } else { - switch (prop.key.type) { - case "Identifier": - key = prop.key.name; - break; - case "StringLiteral": - key = prop.key.value; - break; - default: - return; - } - } - - const propValue = computeNode(prop.value); - if (!propValue) return; - value[key] = propValue.value; - break; - } - case "SpreadElement":{ - const arg = computeNode(prop.argument); - if (!arg) return; - Object.assign(value, arg.value); - break; - } - } - } - - return { value }; - } - case "ArrayExpression":{ - const value = []; - for (const elem of node.elements) { - if (elem) { - if (elem.type === "SpreadElement") { - const arg = computeNode(elem.argument); - if (typeof arg?.value?.[Symbol.iterator] !== "function") return; - for (const item of arg.value) { - value.push(item); - } - } else { - const elemValue = computeNode(elem); - if (!elemValue) return; - value.push(elemValue.value); - } - } else { - value.length++; - } - } - - return { value }; - } - } -} diff --git a/src/file-viewer/server/.gitignore b/src/file-viewer/server/.gitignore deleted file mode 100644 index 4128795..0000000 --- a/src/file-viewer/server/.gitignore +++ /dev/null @@ -1,98 +0,0 @@ -// default -class ImportBuilder { - constructor(importedSource, scope, hub) { - this._statements = []; - this._resultName = null; - this._importedSource = void 0; - this._scope = scope; - this._hub = hub; - this._importedSource = importedSource; - } - done() { - return { - statements: this._statements, - resultName: this._resultName - }; - } - import() { - this._statements.push(importDeclaration([], stringLiteral(this._importedSource))); - return this; - } - require() { - this._statements.push(expressionStatement(callExpression(identifier("require"), [stringLiteral(this._importedSource)]))); - return this; - } - namespace(name = "namespace") { - const local = this._scope.generateUidIdentifier(name); - const statement = this._statements[this._statements.length - 1]; - _assert(statement.type === "ImportDeclaration"); - _assert(statement.specifiers.length === 0); - statement.specifiers = [importNamespaceSpecifier(local)]; - this._resultName = cloneNode(local); - return this; - } - default(name) { - const id = this._scope.generateUidIdentifier(name); - const statement = this._statements[this._statements.length - 1]; - _assert(statement.type === "ImportDeclaration"); - _assert(statement.specifiers.length === 0); - statement.specifiers = [importDefaultSpecifier(id)]; - this._resultName = cloneNode(id); - return this; - } - named(name, importName) { - if (importName === "default") return this.default(name); - const id = this._scope.generateUidIdentifier(name); - const statement = this._statements[this._statements.length - 1]; - _assert(statement.type === "ImportDeclaration"); - _assert(statement.specifiers.length === 0); - statement.specifiers = [importSpecifier(id, identifier(importName))]; - this._resultName = cloneNode(id); - return this; - } - var(name) { - const id = this._scope.generateUidIdentifier(name); - let statement = this._statements[this._statements.length - 1]; - if (statement.type !== "ExpressionStatement") { - _assert(this._resultName); - statement = expressionStatement(this._resultName); - this._statements.push(statement); - } - this._statements[this._statements.length - 1] = variableDeclaration("var", [variableDeclarator(id, statement.expression)]); - this._resultName = cloneNode(id); - return this; - } - defaultInterop() { - return this._interop(this._hub.addHelper("interopRequireDefault")); - } - wildcardInterop() { - return this._interop(this._hub.addHelper("interopRequireWildcard")); - } - _interop(callee) { - const statement = this._statements[this._statements.length - 1]; - if (statement.type === "ExpressionStatement") { - statement.expression = callExpression(callee, [statement.expression]); - } else if (statement.type === "VariableDeclaration") { - _assert(statement.declarations.length === 1); - statement.declarations[0].init = callExpression(callee, [statement.declarations[0].init]); - } else { - _assert.fail("Unexpected type."); - } - return this; - } - prop(name) { - const statement = this._statements[this._statements.length - 1]; - if (statement.type === "ExpressionStatement") { - statement.expression = memberExpression(statement.expression, identifier(name)); - } else if (statement.type === "VariableDeclaration") { - _assert(statement.declarations.length === 1); - statement.declarations[0].init = memberExpression(statement.declarations[0].init, identifier(name)); - } else { - _assert.fail("Unexpected type:" + statement.type); - } - return this; - } - read(name) { - this._resultName = memberExpression(this._resultName, identifier(name)); - } -} diff --git a/src/file-viewer/server/CHANGES.md b/src/file-viewer/server/CHANGES.md deleted file mode 100644 index 34f85eb..0000000 --- a/src/file-viewer/server/CHANGES.md +++ /dev/null @@ -1,4 +0,0 @@ -// default -function isModule(path) { - return path.node.sourceType === "module"; -} diff --git a/src/file-viewer/server/CLAUDE.md b/src/file-viewer/server/CLAUDE.md deleted file mode 100644 index 619cb63..0000000 --- a/src/file-viewer/server/CLAUDE.md +++ /dev/null @@ -1,12 +0,0 @@ -// default -function rewriteThis(programPath) { - if (!rewriteThisVisitor) { - rewriteThisVisitor = _traverse.visitors.environmentVisitor({ - ThisExpression(path) { - path.replaceWith(_core.types.unaryExpression("void", _core.types.numericLiteral(0), true)); - } - }); - rewriteThisVisitor.noScope = true; - } - (0, _traverse.default)(programPath.node, rewriteThisVisitor); -} diff --git a/src/file-viewer/server/Cargo.lock b/src/file-viewer/server/Cargo.lock deleted file mode 100644 index ed2012f..0000000 --- a/src/file-viewer/server/Cargo.lock +++ /dev/null @@ -1,61 +0,0 @@ -// default -function rewriteLiveReferences(programPath, metadata, wrapReference) { - const imported = new Map(); - const exported = new Map(); - const requeueInParent = path => { - programPath.requeue(path); - }; - for (const [source, data] of metadata.source) { - for (const [localName, importName] of data.imports) { - imported.set(localName, [source, importName, null]); - } - for (const localName of data.importsNamespace) { - imported.set(localName, [source, null, localName]); - } - } - for (const [local, data] of metadata.local) { - let exportMeta = exported.get(local); - if (!exportMeta) { - exportMeta = []; - exported.set(local, exportMeta); - } - exportMeta.push(...data.names); - } - const rewriteBindingInitVisitorState = { - metadata, - requeueInParent, - scope: programPath.scope, - exported - }; - programPath.traverse(rewriteBindingInitVisitor, rewriteBindingInitVisitorState); - const rewriteReferencesVisitorState = { - seen: new WeakSet(), - metadata, - requeueInParent, - scope: programPath.scope, - imported, - exported, - buildImportReference([source, importName, localName], identNode) { - const meta = metadata.source.get(source); - meta.referenced = true; - if (localName) { - if (meta.wrap) { - var _wrapReference; - identNode = (_wrapReference = wrapReference(identNode, meta.wrap)) != null ? _wrapReference : identNode; - } - return identNode; - } - let namespace = _core.types.identifier(meta.name); - if (meta.wrap) { - var _wrapReference2; - namespace = (_wrapReference2 = wrapReference(namespace, meta.wrap)) != null ? _wrapReference2 : namespace; - } - if (importName === "default" && meta.interop === "node-default") { - return namespace; - } - const computed = metadata.stringSpecifiers.has(importName); - return _core.types.memberExpression(namespace, computed ? _core.types.stringLiteral(importName) : _core.types.identifier(importName), computed); - } - }; - programPath.traverse(rewriteReferencesVisitor, rewriteReferencesVisitorState); -} diff --git a/src/file-viewer/server/Cargo.toml b/src/file-viewer/server/Cargo.toml deleted file mode 100644 index 8eac9f2..0000000 --- a/src/file-viewer/server/Cargo.toml +++ /dev/null @@ -1,69 +0,0 @@ -// default -function normalizeModuleAndLoadMetadata(programPath, exportName, { - importInterop, - initializeReexports = false, - getWrapperPayload, - esNamespaceOnly = false, - filename -}) { - if (!exportName) { - exportName = programPath.scope.generateUidIdentifier("exports").name; - } - const stringSpecifiers = new Set(); - nameAnonymousExports(programPath); - const { - local, - sources, - hasExports - } = getModuleMetadata(programPath, { - initializeReexports, - getWrapperPayload - }, stringSpecifiers); - removeImportExportDeclarations(programPath); - for (const [source, metadata] of sources) { - const { - importsNamespace, - imports - } = metadata; - if (importsNamespace.size > 0 && imports.size === 0) { - const [nameOfnamespace] = importsNamespace; - metadata.name = nameOfnamespace; - } - const resolvedInterop = resolveImportInterop(importInterop, source, filename); - if (resolvedInterop === "none") { - metadata.interop = "none"; - } else if (resolvedInterop === "node" && metadata.interop === "namespace") { - metadata.interop = "node-namespace"; - } else if (resolvedInterop === "node" && metadata.interop === "default") { - metadata.interop = "node-default"; - } else if (esNamespaceOnly && metadata.interop === "namespace") { - metadata.interop = "default"; - } - } - return { - exportName, - exportNameListName: null, - hasExports, - local, - source: sources, - stringSpecifiers - }; -} - -// hasExports -function hasExports(metadata) { - return metadata.hasExports; -} - -// isSideEffectImport -function isSideEffectImport(source) { - return source.imports.size === 0 && source.importsNamespace.size === 0 && source.reexports.size === 0 && source.reexportNamespace.size === 0 && !source.reexportAll; -} - -// validateImportInteropOption -function validateImportInteropOption(importInterop) { - if (typeof importInterop !== "function" && importInterop !== "none" && importInterop !== "babel" && importInterop !== "node") { - throw new Error(`.importInterop must be one of "none", "babel", "node", or a function returning one of those values (received ${importInterop}).`); - } - return importInterop; -} diff --git a/src/file-viewer/server/DOCKER.md b/src/file-viewer/server/DOCKER.md deleted file mode 100644 index 3f88e14..0000000 --- a/src/file-viewer/server/DOCKER.md +++ /dev/null @@ -1,23 +0,0 @@ -// toGetWrapperPayload -function toGetWrapperPayload(lazy) { - return (source, metadata) => { - if (lazy === false) return null; - if ((0, _normalizeAndLoadMetadata.isSideEffectImport)(metadata) || metadata.reexportAll) return null; - if (lazy === true) { - return source.includes(".") ? null : "lazy"; - } - if (Array.isArray(lazy)) { - return !lazy.includes(source) ? null : "lazy"; - } - if (typeof lazy === "function") { - return lazy(source) ? "lazy" : null; - } - throw new Error(`.lazy must be a boolean, string array, or function`); - }; -} - -// wrapReference -function wrapReference(ref, payload) { - if (payload === "lazy") return _core.types.callExpression(ref, []); - return null; -} diff --git a/src/file-viewer/server/Dockerfile b/src/file-viewer/server/Dockerfile deleted file mode 100644 index 3600394..0000000 --- a/src/file-viewer/server/Dockerfile +++ /dev/null @@ -1,40 +0,0 @@ -// buildDynamicImport -function buildDynamicImport(node, deferToThen, wrapWithPromise, builder) { - const specifier = _core.types.isCallExpression(node) ? node.arguments[0] : node.source; - if (_core.types.isStringLiteral(specifier) || _core.types.isTemplateLiteral(specifier) && specifier.quasis.length === 0) { - if (deferToThen) { - return _core.template.expression.ast` - Promise.resolve().then(() => ${builder(specifier)}) - `; - } else return builder(specifier); - } - const specifierToString = _core.types.isTemplateLiteral(specifier) ? _core.types.identifier("specifier") : _core.types.templateLiteral([_core.types.templateElement({ - raw: "" - }), _core.types.templateElement({ - raw: "" - })], [_core.types.identifier("specifier")]); - if (deferToThen) { - return _core.template.expression.ast` - (specifier => - new Promise(r => r(${specifierToString})) - .then(s => ${builder(_core.types.identifier("s"))}) - )(${specifier}) - `; - } else if (wrapWithPromise) { - return _core.template.expression.ast` - (specifier => - new Promise(r => r(${builder(specifierToString)})) - )(${specifier}) - `; - } else { - return _core.template.expression.ast` - (specifier => ${builder(specifierToString)})(${specifier}) - `; - } -} - -// getDynamicImportSource -function getDynamicImportSource(node) { - const [source] = node.arguments; - return _core.types.isStringLiteral(source) || _core.types.isTemplateLiteral(source) ? source : _core.template.expression.ast`\`\${${source}}\``; - } diff --git a/src/file-viewer/server/README.md b/src/file-viewer/server/README.md deleted file mode 100644 index 5aa5ee8..0000000 --- a/src/file-viewer/server/README.md +++ /dev/null @@ -1,10 +0,0 @@ -// default -function getModuleName(rootOpts, pluginOpts) { - var _pluginOpts$moduleId, _pluginOpts$moduleIds, _pluginOpts$getModule, _pluginOpts$moduleRoo; - return originalGetModuleName(rootOpts, { - moduleId: (_pluginOpts$moduleId = pluginOpts.moduleId) != null ? _pluginOpts$moduleId : rootOpts.moduleId, - moduleIds: (_pluginOpts$moduleIds = pluginOpts.moduleIds) != null ? _pluginOpts$moduleIds : rootOpts.moduleIds, - getModuleId: (_pluginOpts$getModule = pluginOpts.getModuleId) != null ? _pluginOpts$getModule : rootOpts.getModuleId, - moduleRoot: (_pluginOpts$moduleRoo = pluginOpts.moduleRoot) != null ? _pluginOpts$moduleRoo : rootOpts.moduleRoot - }); - } diff --git a/src/file-viewer/server/config.docker.toml b/src/file-viewer/server/config.docker.toml deleted file mode 100644 index ecee705..0000000 --- a/src/file-viewer/server/config.docker.toml +++ /dev/null @@ -1,5 +0,0 @@ -// transformDynamicImport -function transformDynamicImport(path, noInterop, file) { - const buildRequire = noInterop ? requireNoInterop : requireInterop; - path.replaceWith((0, _helperModuleTransforms.buildDynamicImport)(path.node, true, false, specifier => buildRequire(specifier, file))); -} diff --git a/src/file-viewer/server/config.example.toml b/src/file-viewer/server/config.example.toml deleted file mode 100644 index eca6d51..0000000 --- a/src/file-viewer/server/config.example.toml +++ /dev/null @@ -1,34 +0,0 @@ -// lazyImportsHook -lazy => ({ - name: `${"@babel/plugin-transform-modules-commonjs"}/lazy`, - version: "7.27.1", - getWrapperPayload(source, metadata) { - if ((0, _helperModuleTransforms.isSideEffectImport)(metadata) || metadata.reexportAll) { - return null; - } - if (lazy === true) { - return source.includes(".") ? null : "lazy/function"; - } - if (Array.isArray(lazy)) { - return !lazy.includes(source) ? null : "lazy/function"; - } - if (typeof lazy === "function") { - return lazy(source) ? "lazy/function" : null; - } - }, - buildRequireWrapper(name, init, payload, referenced) { - if (payload === "lazy/function") { - if (!referenced) return false; - return _core.template.statement.ast` - function ${name}() { - const data = ${init}; - ${name} = function(){ return data; }; - return data; - } - `; - } - }, - wrapReference(ref, payload) { - if (payload === "lazy/function") return _core.types.callExpression(ref, []); - } -}) diff --git a/src/file-viewer/server/config.test.toml b/src/file-viewer/server/config.test.toml deleted file mode 100644 index 06d7b5f..0000000 --- a/src/file-viewer/server/config.test.toml +++ /dev/null @@ -1,22 +0,0 @@ -// defineCommonJSHook -function defineCommonJSHook(file, hook) { - let hooks = file.get(commonJSHooksKey); - if (!hooks) file.set(commonJSHooksKey, hooks = []); - hooks.push(hook); -} - -// makeInvokers -function makeInvokers(file) { - const hooks = file.get(commonJSHooksKey); - return { - getWrapperPayload(...args) { - return findMap(hooks, hook => hook.getWrapperPayload == null ? void 0 : hook.getWrapperPayload(...args)); - }, - wrapReference(...args) { - return findMap(hooks, hook => hook.wrapReference == null ? void 0 : hook.wrapReference(...args)); - }, - buildRequireWrapper(...args) { - return findMap(hooks, hook => hook.buildRequireWrapper == null ? void 0 : hook.buildRequireWrapper(...args)); - } - }; -} diff --git a/src/file-viewer/server/docker-compose.yml b/src/file-viewer/server/docker-compose.yml deleted file mode 100644 index fbacf2b..0000000 --- a/src/file-viewer/server/docker-compose.yml +++ /dev/null @@ -1,10 +0,0 @@ -// default -(api, options, dirname) => { - let clonedApi; - for (const name of Object.keys(apiPolyfills)) { - if (api[name]) continue; - clonedApi != null ? clonedApi : clonedApi = copyApiObject(api); - clonedApi[name] = apiPolyfills[name](clonedApi); - } - return builder(clonedApi != null ? clonedApi : api, options || {}, dirname); - } diff --git a/src/file-viewer/server/docker-compose.yml.bak b/src/file-viewer/server/docker-compose.yml.bak deleted file mode 100644 index 7dab2b9..0000000 --- a/src/file-viewer/server/docker-compose.yml.bak +++ /dev/null @@ -1,298 +0,0 @@ -// FEATURES -[object Object] - -// buildCheckInRHS -function buildCheckInRHS(rhs, file, inRHSIsObject) { - if (inRHSIsObject || !(file.availableHelper != null && file.availableHelper("checkInRHS"))) return rhs; - return _core.types.callExpression(file.addHelper("checkInRHS"), [rhs]); -} - -// createClassFeaturePlugin -function createClassFeaturePlugin({ - name, - feature, - loose, - manipulateOptions, - api, - inherits, - decoratorVersion -}) { - var _api$assumption; - if (feature & _features.FEATURES.decorators) { - { - if (decoratorVersion === "2023-11" || decoratorVersion === "2023-05" || decoratorVersion === "2023-01" || decoratorVersion === "2022-03" || decoratorVersion === "2021-12") { - return (0, _decorators.default)(api, { - loose - }, decoratorVersion, inherits); - } - } - } - { - api != null ? api : api = { - assumption: () => void 0 - }; - } - const setPublicClassFields = api.assumption("setPublicClassFields"); - const privateFieldsAsSymbols = api.assumption("privateFieldsAsSymbols"); - const privateFieldsAsProperties = api.assumption("privateFieldsAsProperties"); - const noUninitializedPrivateFieldAccess = (_api$assumption = api.assumption("noUninitializedPrivateFieldAccess")) != null ? _api$assumption : false; - const constantSuper = api.assumption("constantSuper"); - const noDocumentAll = api.assumption("noDocumentAll"); - if (privateFieldsAsProperties && privateFieldsAsSymbols) { - throw new Error(`Cannot enable both the "privateFieldsAsProperties" and ` + `"privateFieldsAsSymbols" assumptions as the same time.`); - } - const privateFieldsAsSymbolsOrProperties = privateFieldsAsProperties || privateFieldsAsSymbols; - if (loose === true) { - const explicit = []; - if (setPublicClassFields !== undefined) { - explicit.push(`"setPublicClassFields"`); - } - if (privateFieldsAsProperties !== undefined) { - explicit.push(`"privateFieldsAsProperties"`); - } - if (privateFieldsAsSymbols !== undefined) { - explicit.push(`"privateFieldsAsSymbols"`); - } - if (explicit.length !== 0) { - 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}`); - } - } - return { - name, - manipulateOptions, - inherits, - pre(file) { - (0, _features.enableFeature)(file, feature, loose); - { - if (typeof file.get(versionKey) === "number") { - file.set(versionKey, "7.27.1"); - return; - } - } - if (!file.get(versionKey) || _semver.lt(file.get(versionKey), "7.27.1")) { - file.set(versionKey, "7.27.1"); - } - }, - visitor: { - Class(path, { - file - }) { - if (file.get(versionKey) !== "7.27.1") return; - if (!(0, _features.shouldTransform)(path, file)) return; - const pathIsClassDeclaration = path.isClassDeclaration(); - if (pathIsClassDeclaration) (0, _typescript.assertFieldTransformed)(path); - const loose = (0, _features.isLoose)(file, feature); - let constructor; - const isDecorated = (0, _decorators.hasDecorators)(path.node); - const props = []; - const elements = []; - const computedPaths = []; - const privateNames = new Set(); - const body = path.get("body"); - for (const path of body.get("body")) { - if ((path.isClassProperty() || path.isClassMethod()) && path.node.computed) { - computedPaths.push(path); - } - if (path.isPrivate()) { - const { - name - } = path.node.key.id; - const getName = `get ${name}`; - const setName = `set ${name}`; - if (path.isClassPrivateMethod()) { - if (path.node.kind === "get") { - if (privateNames.has(getName) || privateNames.has(name) && !privateNames.has(setName)) { - throw path.buildCodeFrameError("Duplicate private field"); - } - privateNames.add(getName).add(name); - } else if (path.node.kind === "set") { - if (privateNames.has(setName) || privateNames.has(name) && !privateNames.has(getName)) { - throw path.buildCodeFrameError("Duplicate private field"); - } - privateNames.add(setName).add(name); - } - } else { - if (privateNames.has(name) && !privateNames.has(getName) && !privateNames.has(setName) || privateNames.has(name) && (privateNames.has(getName) || privateNames.has(setName))) { - throw path.buildCodeFrameError("Duplicate private field"); - } - privateNames.add(name); - } - } - if (path.isClassMethod({ - kind: "constructor" - })) { - constructor = path; - } else { - elements.push(path); - if (path.isProperty() || path.isPrivate() || path.isStaticBlock != null && path.isStaticBlock()) { - props.push(path); - } - } - } - { - if (!props.length && !isDecorated) return; - } - const innerBinding = path.node.id; - let ref; - if (!innerBinding || !pathIsClassDeclaration) { - { - var _path$ensureFunctionN; - (_path$ensureFunctionN = path.ensureFunctionName) != null ? _path$ensureFunctionN : path.ensureFunctionName = require("@babel/traverse").NodePath.prototype.ensureFunctionName; - } - path.ensureFunctionName(false); - ref = path.scope.generateUidIdentifier((innerBinding == null ? void 0 : innerBinding.name) || "Class"); - } - const classRefForDefine = ref != null ? ref : _core.types.cloneNode(innerBinding); - const privateNamesMap = (0, _fields.buildPrivateNamesMap)(classRefForDefine.name, privateFieldsAsSymbolsOrProperties != null ? privateFieldsAsSymbolsOrProperties : loose, props, file); - const privateNamesNodes = (0, _fields.buildPrivateNamesNodes)(privateNamesMap, privateFieldsAsProperties != null ? privateFieldsAsProperties : loose, privateFieldsAsSymbols != null ? privateFieldsAsSymbols : false, file); - (0, _fields.transformPrivateNamesUsage)(classRefForDefine, path, privateNamesMap, { - privateFieldsAsProperties: privateFieldsAsSymbolsOrProperties != null ? privateFieldsAsSymbolsOrProperties : loose, - noUninitializedPrivateFieldAccess, - noDocumentAll, - innerBinding - }, file); - let keysNodes, staticNodes, instanceNodes, lastInstanceNodeReturnsThis, pureStaticNodes, classBindingNode, wrapClass; - { - if (isDecorated) { - staticNodes = pureStaticNodes = keysNodes = []; - ({ - instanceNodes, - wrapClass - } = (0, _decorators2.buildDecoratedClass)(classRefForDefine, path, elements, file)); - } else { - keysNodes = (0, _misc.extractComputedKeys)(path, computedPaths, file); - ({ - staticNodes, - pureStaticNodes, - instanceNodes, - lastInstanceNodeReturnsThis, - classBindingNode, - wrapClass - } = (0, _fields.buildFieldsInitNodes)(ref, path.node.superClass, props, privateNamesMap, file, setPublicClassFields != null ? setPublicClassFields : loose, privateFieldsAsSymbolsOrProperties != null ? privateFieldsAsSymbolsOrProperties : loose, noUninitializedPrivateFieldAccess, constantSuper != null ? constantSuper : loose, innerBinding)); - } - } - if (instanceNodes.length > 0) { - (0, _misc.injectInitialization)(path, constructor, instanceNodes, (referenceVisitor, state) => { - { - if (isDecorated) return; - } - for (const prop of props) { - if (_core.types.isStaticBlock != null && _core.types.isStaticBlock(prop.node) || prop.node.static) continue; - prop.traverse(referenceVisitor, state); - } - }, lastInstanceNodeReturnsThis); - } - const wrappedPath = wrapClass(path); - wrappedPath.insertBefore([...privateNamesNodes, ...keysNodes]); - if (staticNodes.length > 0) { - wrappedPath.insertAfter(staticNodes); - } - if (pureStaticNodes.length > 0) { - wrappedPath.find(parent => parent.isStatement() || parent.isDeclaration()).insertAfter(pureStaticNodes); - } - if (classBindingNode != null && pathIsClassDeclaration) { - wrappedPath.insertAfter(classBindingNode); - } - }, - ExportDefaultDeclaration(path, { - file - }) { - { - if (file.get(versionKey) !== "7.27.1") return; - const decl = path.get("declaration"); - if (decl.isClassDeclaration() && (0, _decorators.hasDecorators)(decl.node)) { - if (decl.node.id) { - { - var _path$splitExportDecl; - (_path$splitExportDecl = path.splitExportDeclaration) != null ? _path$splitExportDecl : path.splitExportDeclaration = require("@babel/traverse").NodePath.prototype.splitExportDeclaration; - } - path.splitExportDeclaration(); - } else { - decl.node.type = "ClassExpression"; - } - } - } - } - } - }; -} - -// enableFeature -function enableFeature(file, feature, loose) { - if (!hasFeature(file, feature) || canIgnoreLoose(file, feature)) { - file.set(featuresKey, file.get(featuresKey) | feature); - if (loose === "#__internal__@babel/preset-env__prefer-true-but-false-is-ok-if-it-prevents-an-error") { - setLoose(file, feature, true); - file.set(looseLowPriorityKey, file.get(looseLowPriorityKey) | feature); - } else if (loose === "#__internal__@babel/preset-env__prefer-false-but-true-is-ok-if-it-prevents-an-error") { - setLoose(file, feature, false); - file.set(looseLowPriorityKey, file.get(looseLowPriorityKey) | feature); - } else { - setLoose(file, feature, loose); - } - } - let resolvedLoose; - for (const [mask, name] of featuresSameLoose) { - if (!hasFeature(file, mask)) continue; - { - if (canIgnoreLoose(file, mask)) continue; - } - const loose = isLoose(file, mask); - if (resolvedLoose === !loose) { - 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)); - } else { - resolvedLoose = loose; - { - var higherPriorityPluginName = name; - } - } - } - if (resolvedLoose !== undefined) { - for (const [mask, name] of featuresSameLoose) { - if (hasFeature(file, mask) && isLoose(file, mask) !== resolvedLoose) { - setLoose(file, mask, resolvedLoose); - 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)); - } - } - } -} - -// injectInitialization -function injectInitialization(path, constructor, nodes, renamer, lastReturnsThis) { - if (!nodes.length) return; - const isDerived = !!path.node.superClass; - if (!constructor) { - const newConstructor = _core.types.classMethod("constructor", _core.types.identifier("constructor"), [], _core.types.blockStatement([])); - if (isDerived) { - newConstructor.params = [_core.types.restElement(_core.types.identifier("args"))]; - newConstructor.body.body.push(_core.template.statement.ast`super(...args)`); - } - [constructor] = path.get("body").unshiftContainer("body", newConstructor); - } - if (renamer) { - renamer(referenceVisitor, { - scope: constructor.scope - }); - } - if (isDerived) { - const bareSupers = []; - constructor.traverse(findBareSupers, bareSupers); - let isFirst = true; - for (const bareSuper of bareSupers) { - if (isFirst) { - isFirst = false; - } else { - nodes = nodes.map(n => _core.types.cloneNode(n)); - } - if (!bareSuper.parentPath.isExpressionStatement()) { - const allNodes = [bareSuper.node, ...nodes.map(n => _core.types.toExpression(n))]; - if (!lastReturnsThis) allNodes.push(_core.types.thisExpression()); - bareSuper.replaceWith(_core.types.sequenceExpression(allNodes)); - } else { - bareSuper.insertAfter(nodes); - } - } - } else { - constructor.get("body").unshiftContainer("body", nodes); - } -} diff --git a/src/file-viewer/server/generate_certs.sh b/src/file-viewer/server/generate_certs.sh deleted file mode 100644 index eaedcfe..0000000 --- a/src/file-viewer/server/generate_certs.sh +++ /dev/null @@ -1,323 +0,0 @@ -// buildCheckInRHS -function buildCheckInRHS(rhs, file, inRHSIsObject) { - if (inRHSIsObject || !(file.availableHelper != null && file.availableHelper("checkInRHS"))) return rhs; - return _core.types.callExpression(file.addHelper("checkInRHS"), [rhs]); -} - -// buildFieldsInitNodes -function buildFieldsInitNodes(ref, superRef, props, privateNamesMap, file, setPublicClassFields, privateFieldsAsSymbolsOrProperties, noUninitializedPrivateFieldAccess, constantSuper, innerBindingRef) { - let classRefFlags = 0; - let injectSuperRef; - const staticNodes = []; - const instanceNodes = []; - let lastInstanceNodeReturnsThis = false; - const pureStaticNodes = []; - let classBindingNode = null; - const getSuperRef = _core.types.isIdentifier(superRef) ? () => superRef : () => { - injectSuperRef != null ? injectSuperRef : injectSuperRef = props[0].scope.generateUidIdentifierBasedOnNode(superRef); - return injectSuperRef; - }; - const classRefForInnerBinding = ref != null ? ref : props[0].scope.generateUidIdentifier((innerBindingRef == null ? void 0 : innerBindingRef.name) || "Class"); - ref != null ? ref : ref = _core.types.cloneNode(innerBindingRef); - for (const prop of props) { - if (prop.isClassProperty()) { - ts.assertFieldTransformed(prop); - } - const isStatic = !(_core.types.isStaticBlock != null && _core.types.isStaticBlock(prop.node)) && prop.node.static; - const isInstance = !isStatic; - const isPrivate = prop.isPrivate(); - const isPublic = !isPrivate; - const isField = prop.isProperty(); - const isMethod = !isField; - const isStaticBlock = prop.isStaticBlock == null ? void 0 : prop.isStaticBlock(); - if (isStatic) classRefFlags |= 1; - if (isStatic || isMethod && isPrivate || isStaticBlock) { - new _helperReplaceSupers.default({ - methodPath: prop, - constantSuper, - file: file, - refToPreserve: innerBindingRef, - getSuperRef, - getObjectRef() { - classRefFlags |= 2; - if (isStatic || isStaticBlock) { - return classRefForInnerBinding; - } else { - return _core.types.memberExpression(classRefForInnerBinding, _core.types.identifier("prototype")); - } - } - }).replace(); - const replaced = replaceThisContext(prop, classRefForInnerBinding, innerBindingRef); - if (replaced) { - classRefFlags |= 2; - } - } - lastInstanceNodeReturnsThis = false; - switch (true) { - case isStaticBlock: - { - const blockBody = prop.node.body; - if (blockBody.length === 1 && _core.types.isExpressionStatement(blockBody[0])) { - staticNodes.push(inheritPropComments(blockBody[0], prop)); - } else { - staticNodes.push(_core.types.inheritsComments(_core.template.statement.ast`(() => { ${blockBody} })()`, prop.node)); - } - break; - } - case isStatic && isPrivate && isField && privateFieldsAsSymbolsOrProperties: - staticNodes.push(buildPrivateFieldInitLoose(_core.types.cloneNode(ref), prop, privateNamesMap)); - break; - case isStatic && isPrivate && isField && !privateFieldsAsSymbolsOrProperties: - if (!newHelpers(file)) { - staticNodes.push(buildPrivateStaticFieldInitSpecOld(prop, privateNamesMap)); - } else { - staticNodes.push(buildPrivateStaticFieldInitSpec(prop, privateNamesMap, noUninitializedPrivateFieldAccess)); - } - break; - case isStatic && isPublic && isField && setPublicClassFields: - if (!isNameOrLength(prop.node)) { - staticNodes.push(buildPublicFieldInitLoose(_core.types.cloneNode(ref), prop)); - break; - } - case isStatic && isPublic && isField && !setPublicClassFields: - staticNodes.push(buildPublicFieldInitSpec(_core.types.cloneNode(ref), prop, file)); - break; - case isInstance && isPrivate && isField && privateFieldsAsSymbolsOrProperties: - instanceNodes.push(buildPrivateFieldInitLoose(_core.types.thisExpression(), prop, privateNamesMap)); - break; - case isInstance && isPrivate && isField && !privateFieldsAsSymbolsOrProperties: - instanceNodes.push(buildPrivateInstanceFieldInitSpec(_core.types.thisExpression(), prop, privateNamesMap, file)); - break; - case isInstance && isPrivate && isMethod && privateFieldsAsSymbolsOrProperties: - instanceNodes.unshift(buildPrivateMethodInitLoose(_core.types.thisExpression(), prop, privateNamesMap)); - pureStaticNodes.push(buildPrivateMethodDeclaration(file, prop, privateNamesMap, privateFieldsAsSymbolsOrProperties)); - break; - case isInstance && isPrivate && isMethod && !privateFieldsAsSymbolsOrProperties: - instanceNodes.unshift(buildPrivateInstanceMethodInitSpec(_core.types.thisExpression(), prop, privateNamesMap, file)); - pureStaticNodes.push(buildPrivateMethodDeclaration(file, prop, privateNamesMap, privateFieldsAsSymbolsOrProperties)); - break; - case isStatic && isPrivate && isMethod && !privateFieldsAsSymbolsOrProperties: - if (!newHelpers(file)) { - staticNodes.unshift(buildPrivateStaticFieldInitSpecOld(prop, privateNamesMap)); - } - pureStaticNodes.push(buildPrivateMethodDeclaration(file, prop, privateNamesMap, privateFieldsAsSymbolsOrProperties)); - break; - case isStatic && isPrivate && isMethod && privateFieldsAsSymbolsOrProperties: - staticNodes.unshift(buildPrivateStaticMethodInitLoose(_core.types.cloneNode(ref), prop, file, privateNamesMap)); - pureStaticNodes.push(buildPrivateMethodDeclaration(file, prop, privateNamesMap, privateFieldsAsSymbolsOrProperties)); - break; - case isInstance && isPublic && isField && setPublicClassFields: - instanceNodes.push(buildPublicFieldInitLoose(_core.types.thisExpression(), prop)); - break; - case isInstance && isPublic && isField && !setPublicClassFields: - lastInstanceNodeReturnsThis = true; - instanceNodes.push(buildPublicFieldInitSpec(_core.types.thisExpression(), prop, file)); - break; - default: - throw new Error("Unreachable."); - } - } - if (classRefFlags & 2 && innerBindingRef != null) { - classBindingNode = _core.types.expressionStatement(_core.types.assignmentExpression("=", _core.types.cloneNode(classRefForInnerBinding), _core.types.cloneNode(innerBindingRef))); - } - return { - staticNodes: staticNodes.filter(Boolean), - instanceNodes: instanceNodes.filter(Boolean), - lastInstanceNodeReturnsThis, - pureStaticNodes: pureStaticNodes.filter(Boolean), - classBindingNode, - wrapClass(path) { - for (const prop of props) { - prop.node.leadingComments = null; - prop.remove(); - } - if (injectSuperRef) { - path.scope.push({ - id: _core.types.cloneNode(injectSuperRef) - }); - path.set("superClass", _core.types.assignmentExpression("=", injectSuperRef, path.node.superClass)); - } - if (classRefFlags !== 0) { - if (path.isClassExpression()) { - path.scope.push({ - id: ref - }); - path.replaceWith(_core.types.assignmentExpression("=", _core.types.cloneNode(ref), path.node)); - } else { - if (innerBindingRef == null) { - path.node.id = ref; - } - if (classBindingNode != null) { - path.scope.push({ - id: classRefForInnerBinding - }); - } - } - } - return path; - } - }; -} - -// buildPrivateNamesMap -function buildPrivateNamesMap(className, privateFieldsAsSymbolsOrProperties, props, file) { - const privateNamesMap = new Map(); - let classBrandId; - for (const prop of props) { - if (prop.isPrivate()) { - const { - name - } = prop.node.key.id; - let update = privateNamesMap.get(name); - if (!update) { - const isMethod = !prop.isProperty(); - const isStatic = prop.node.static; - let initAdded = false; - let id; - if (!privateFieldsAsSymbolsOrProperties && newHelpers(file) && isMethod && !isStatic) { - initAdded = !!classBrandId; - classBrandId != null ? classBrandId : classBrandId = prop.scope.generateUidIdentifier(`${className}_brand`); - id = classBrandId; - } else { - id = prop.scope.generateUidIdentifier(name); - } - update = { - id, - static: isStatic, - method: isMethod, - initAdded - }; - privateNamesMap.set(name, update); - } - if (prop.isClassPrivateMethod()) { - if (prop.node.kind === "get") { - const { - body - } = prop.node.body; - let $; - 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)) { - update.getId = _core.types.cloneNode($); - update.getterDeclared = true; - } else { - update.getId = prop.scope.generateUidIdentifier(`get_${name}`); - } - } else if (prop.node.kind === "set") { - const { - params - } = prop.node; - const { - body - } = prop.node.body; - let $; - 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], { - name: params[0].name - }) && _core.types.isIdentifier($ = $.callee)) { - update.setId = _core.types.cloneNode($); - update.setterDeclared = true; - } else { - update.setId = prop.scope.generateUidIdentifier(`set_${name}`); - } - } else if (prop.node.kind === "method") { - update.methodId = prop.scope.generateUidIdentifier(name); - } - } - privateNamesMap.set(name, update); - } - } - return privateNamesMap; -} - -// buildPrivateNamesNodes -function buildPrivateNamesNodes(privateNamesMap, privateFieldsAsProperties, privateFieldsAsSymbols, state) { - const initNodes = []; - const injectedIds = new Set(); - for (const [name, value] of privateNamesMap) { - const { - static: isStatic, - method: isMethod, - getId, - setId - } = value; - const isGetterOrSetter = getId || setId; - const id = _core.types.cloneNode(value.id); - let init; - if (privateFieldsAsProperties) { - init = _core.types.callExpression(state.addHelper("classPrivateFieldLooseKey"), [_core.types.stringLiteral(name)]); - } else if (privateFieldsAsSymbols) { - init = _core.types.callExpression(_core.types.identifier("Symbol"), [_core.types.stringLiteral(name)]); - } else if (!isStatic) { - if (injectedIds.has(id.name)) continue; - injectedIds.add(id.name); - init = _core.types.newExpression(_core.types.identifier(isMethod && (!isGetterOrSetter || newHelpers(state)) ? "WeakSet" : "WeakMap"), []); - } - if (init) { - if (!privateFieldsAsSymbols) { - (0, _helperAnnotateAsPure.default)(init); - } - initNodes.push(_core.template.statement.ast`var ${id} = ${init}`); - } - } - return initNodes; -} - -// privateNameVisitorFactory -function privateNameVisitorFactory(visitor) { - const nestedVisitor = _traverse.visitors.environmentVisitor(Object.assign({}, visitor)); - const privateNameVisitor = Object.assign({}, visitor, { - Class(path) { - const { - privateNamesMap - } = this; - const body = path.get("body.body"); - const visiblePrivateNames = new Map(privateNamesMap); - const redeclared = []; - for (const prop of body) { - if (!prop.isPrivate()) continue; - const { - name - } = prop.node.key.id; - visiblePrivateNames.delete(name); - redeclared.push(name); - } - if (!redeclared.length) { - return; - } - path.get("body").traverse(nestedVisitor, Object.assign({}, this, { - redeclared - })); - path.traverse(privateNameVisitor, Object.assign({}, this, { - privateNamesMap: visiblePrivateNames - })); - path.skipKey("body"); - } - }); - return privateNameVisitor; -} - -// transformPrivateNamesUsage -function transformPrivateNamesUsage(ref, path, privateNamesMap, { - privateFieldsAsProperties, - noUninitializedPrivateFieldAccess, - noDocumentAll, - innerBinding -}, state) { - if (!privateNamesMap.size) return; - const body = path.get("body"); - const handler = privateFieldsAsProperties ? privateNameHandlerLoose : privateNameHandlerSpec; - (0, _helperMemberExpressionToFunctions.default)(body, privateNameVisitor, Object.assign({ - privateNamesMap, - classRef: ref, - file: state - }, handler, { - noDocumentAll, - noUninitializedPrivateFieldAccess, - innerBinding - })); - body.traverse(privateInVisitor, { - privateNamesMap, - classRef: ref, - file: state, - privateFieldsAsProperties, - innerBinding - }); -} diff --git a/src/file-viewer/server/src/cache.rs b/src/file-viewer/server/src/cache.rs deleted file mode 100644 index fc066bf..0000000 --- a/src/file-viewer/server/src/cache.rs +++ /dev/null @@ -1,6 +0,0 @@ -// default -function memberExpressionToFunctions(path, visitor, state) { - path.traverse(visitor, Object.assign({}, handle, state, { - memoiser: new AssignmentMemoiser() - })); -} diff --git a/src/file-viewer/server/src/config.rs b/src/file-viewer/server/src/config.rs deleted file mode 100644 index d62b1dd..0000000 --- a/src/file-viewer/server/src/config.rs +++ /dev/null @@ -1,16 +0,0 @@ -// default -function optimiseCallExpression(callee, thisNode, args, optional) { - if (args.length === 1 && isSpreadElement(args[0]) && isIdentifier(args[0].argument, { - name: "arguments" - })) { - if (optional) { - return optionalCallExpression(optionalMemberExpression(callee, identifier("apply"), false, true), [thisNode, args[0].argument], false); - } - return callExpression(memberExpression(callee, identifier("apply")), [thisNode, args[0].argument]); - } else { - if (optional) { - return optionalCallExpression(optionalMemberExpression(callee, identifier("call"), false, true), [thisNode, ...args], false); - } - return callExpression(memberExpression(callee, identifier("call")), [thisNode, ...args]); - } -} diff --git a/src/file-viewer/server/src/database.rs b/src/file-viewer/server/src/database.rs deleted file mode 100644 index 7d6a39f..0000000 --- a/src/file-viewer/server/src/database.rs +++ /dev/null @@ -1,8 +0,0 @@ -// default -function annotateAsPure(pathOrNode) { - const node = pathOrNode.node || pathOrNode; - if (isPureAnnotated(node)) { - return; - } - addComment(node, "leading", PURE_ANNOTATION); -} diff --git a/src/file-viewer/server/src/main.rs b/src/file-viewer/server/src/main.rs deleted file mode 100644 index 4a2cca2..0000000 --- a/src/file-viewer/server/src/main.rs +++ /dev/null @@ -1,20 +0,0 @@ -// isTransparentExprWrapper -function isTransparentExprWrapper(node) { - return isTSAsExpression(node) || isTSSatisfiesExpression(node) || isTSTypeAssertion(node) || isTSNonNullExpression(node) || isTypeCastExpression(node) || isParenthesizedExpression(node); -} - -// skipTransparentExprWrapperNodes -function skipTransparentExprWrapperNodes(node) { - while (isTransparentExprWrapper(node)) { - node = node.expression; - } - return node; -} - -// skipTransparentExprWrappers -function skipTransparentExprWrappers(path) { - while (isTransparentExprWrapper(path.node)) { - path = path.get("expression"); - } - return path; -} diff --git a/src/file-viewer/server/src/routes.rs b/src/file-viewer/server/src/routes.rs deleted file mode 100644 index 940b6d7..0000000 --- a/src/file-viewer/server/src/routes.rs +++ /dev/null @@ -1,6 +0,0 @@ -// assertFieldTransformed -function assertFieldTransformed(path) { - if (path.node.declare || false) { - 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`); - } -} diff --git a/src/file-viewer/server/src/routes_test.rs b/src/file-viewer/server/src/routes_test.rs deleted file mode 100644 index 3c16403..0000000 --- a/src/file-viewer/server/src/routes_test.rs +++ /dev/null @@ -1,84 +0,0 @@ -// default -function _default({ - assertVersion, - assumption -}, { - loose -}, version, inherits) { - var _assumption, _assumption2; - { - if (version === "2023-11" || version === "2023-05" || version === "2023-01") { - assertVersion("^7.21.0"); - } else if (version === "2021-12") { - assertVersion("^7.16.0"); - } else { - assertVersion("^7.19.0"); - } - } - const VISITED = new WeakSet(); - const constantSuper = (_assumption = assumption("constantSuper")) != null ? _assumption : loose; - const ignoreFunctionLength = (_assumption2 = assumption("ignoreFunctionLength")) != null ? _assumption2 : loose; - const namedEvaluationVisitor = NamedEvaluationVisitoryFactory(isDecoratedAnonymousClassExpression, visitClass); - function visitClass(path, state, className) { - var _node$id; - if (VISITED.has(path)) return; - const { - node - } = path; - className != null ? className : className = (_node$id = node.id) == null ? void 0 : _node$id.name; - const newPath = transformClass(path, state, constantSuper, ignoreFunctionLength, className, namedEvaluationVisitor, version); - if (newPath) { - VISITED.add(newPath); - return; - } - VISITED.add(path); - } - return { - name: "proposal-decorators", - inherits: inherits, - visitor: Object.assign({ - ExportDefaultDeclaration(path, state) { - const { - declaration - } = path.node; - if ((declaration == null ? void 0 : declaration.type) === "ClassDeclaration" && isDecorated(declaration)) { - const isAnonymous = !declaration.id; - { - var _path$splitExportDecl; - (_path$splitExportDecl = path.splitExportDeclaration) != null ? _path$splitExportDecl : path.splitExportDeclaration = require("@babel/traverse").NodePath.prototype.splitExportDeclaration; - } - const updatedVarDeclarationPath = path.splitExportDeclaration(); - if (isAnonymous) { - visitClass(updatedVarDeclarationPath, state, _core.types.stringLiteral("default")); - } - } - }, - ExportNamedDeclaration(path) { - const { - declaration - } = path.node; - if ((declaration == null ? void 0 : declaration.type) === "ClassDeclaration" && isDecorated(declaration)) { - { - var _path$splitExportDecl2; - (_path$splitExportDecl2 = path.splitExportDeclaration) != null ? _path$splitExportDecl2 : path.splitExportDeclaration = require("@babel/traverse").NodePath.prototype.splitExportDeclaration; - } - path.splitExportDeclaration(); - } - }, - Class(path, state) { - visitClass(path, state, undefined); - } - }, namedEvaluationVisitor) - }; -} - -// hasDecorators -function hasDecorators(node) { - return hasOwnDecorators(node) || node.body.body.some(hasOwnDecorators); -} - -// hasOwnDecorators -function hasOwnDecorators(node) { - var _node$decorators; - return !!((_node$decorators = node.decorators) != null && _node$decorators.length); -} diff --git a/src/file-viewer/server/src/server.rs b/src/file-viewer/server/src/server.rs deleted file mode 100644 index a887173..0000000 --- a/src/file-viewer/server/src/server.rs +++ /dev/null @@ -1,89 +0,0 @@ -// extractComputedKeys -function extractComputedKeys(path, computedPaths, file) { - const { - scope - } = path; - const declarations = []; - const state = { - classBinding: path.node.id && scope.getBinding(path.node.id.name), - file - }; - for (const computedPath of computedPaths) { - const computedKey = computedPath.get("key"); - if (computedKey.isReferencedIdentifier()) { - handleClassTDZ(computedKey, state); - } else { - computedKey.traverse(classFieldDefinitionEvaluationTDZVisitor, state); - } - const computedNode = computedPath.node; - if (!computedKey.isConstantExpression()) { - const assignment = memoiseComputedKey(computedKey.node, scope, scope.generateUidBasedOnNode(computedKey.node)); - if (assignment) { - declarations.push(_core.types.expressionStatement(assignment)); - computedNode.key = _core.types.cloneNode(assignment.left); - } - } - } - return declarations; -} - -// injectInitialization -function injectInitialization(path, constructor, nodes, renamer, lastReturnsThis) { - if (!nodes.length) return; - const isDerived = !!path.node.superClass; - if (!constructor) { - const newConstructor = _core.types.classMethod("constructor", _core.types.identifier("constructor"), [], _core.types.blockStatement([])); - if (isDerived) { - newConstructor.params = [_core.types.restElement(_core.types.identifier("args"))]; - newConstructor.body.body.push(_core.template.statement.ast`super(...args)`); - } - [constructor] = path.get("body").unshiftContainer("body", newConstructor); - } - if (renamer) { - renamer(referenceVisitor, { - scope: constructor.scope - }); - } - if (isDerived) { - const bareSupers = []; - constructor.traverse(findBareSupers, bareSupers); - let isFirst = true; - for (const bareSuper of bareSupers) { - if (isFirst) { - isFirst = false; - } else { - nodes = nodes.map(n => _core.types.cloneNode(n)); - } - if (!bareSuper.parentPath.isExpressionStatement()) { - const allNodes = [bareSuper.node, ...nodes.map(n => _core.types.toExpression(n))]; - if (!lastReturnsThis) allNodes.push(_core.types.thisExpression()); - bareSuper.replaceWith(_core.types.sequenceExpression(allNodes)); - } else { - bareSuper.insertAfter(nodes); - } - } - } else { - constructor.get("body").unshiftContainer("body", nodes); - } -} - -// memoiseComputedKey -function memoiseComputedKey(keyNode, scope, hint) { - const isUidReference = _core.types.isIdentifier(keyNode) && scope.hasUid(keyNode.name); - if (isUidReference) { - return; - } - const isMemoiseAssignment = _core.types.isAssignmentExpression(keyNode, { - operator: "=" - }) && _core.types.isIdentifier(keyNode.left) && scope.hasUid(keyNode.left.name); - if (isMemoiseAssignment) { - return _core.types.cloneNode(keyNode); - } else { - const ident = _core.types.identifier(hint); - scope.push({ - id: ident, - kind: "let" - }); - return _core.types.assignmentExpression("=", _core.types.cloneNode(ident), keyNode); - } -} diff --git a/src/file-viewer/server/tests/end_to_end.rs b/src/file-viewer/server/tests/end_to_end.rs deleted file mode 100644 index 01b11a6..0000000 --- a/src/file-viewer/server/tests/end_to_end.rs +++ /dev/null @@ -1,101 +0,0 @@ -// FEATURES -[object Object] - -// enableFeature -function enableFeature(file, feature, loose) { - if (!hasFeature(file, feature) || canIgnoreLoose(file, feature)) { - file.set(featuresKey, file.get(featuresKey) | feature); - if (loose === "#__internal__@babel/preset-env__prefer-true-but-false-is-ok-if-it-prevents-an-error") { - setLoose(file, feature, true); - file.set(looseLowPriorityKey, file.get(looseLowPriorityKey) | feature); - } else if (loose === "#__internal__@babel/preset-env__prefer-false-but-true-is-ok-if-it-prevents-an-error") { - setLoose(file, feature, false); - file.set(looseLowPriorityKey, file.get(looseLowPriorityKey) | feature); - } else { - setLoose(file, feature, loose); - } - } - let resolvedLoose; - for (const [mask, name] of featuresSameLoose) { - if (!hasFeature(file, mask)) continue; - { - if (canIgnoreLoose(file, mask)) continue; - } - const loose = isLoose(file, mask); - if (resolvedLoose === !loose) { - 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)); - } else { - resolvedLoose = loose; - { - var higherPriorityPluginName = name; - } - } - } - if (resolvedLoose !== undefined) { - for (const [mask, name] of featuresSameLoose) { - if (hasFeature(file, mask) && isLoose(file, mask) !== resolvedLoose) { - setLoose(file, mask, resolvedLoose); - 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)); - } - } - } -} - -// isLoose -function isLoose(file, feature) { - return !!(file.get(looseKey) & feature); -} - -// shouldTransform -function shouldTransform(path, file) { - let decoratorPath = null; - let publicFieldPath = null; - let privateFieldPath = null; - let privateMethodPath = null; - let staticBlockPath = null; - if ((0, _decorators.hasOwnDecorators)(path.node)) { - decoratorPath = path.get("decorators.0"); - } - for (const el of path.get("body.body")) { - if (!decoratorPath && (0, _decorators.hasOwnDecorators)(el.node)) { - decoratorPath = el.get("decorators.0"); - } - if (!publicFieldPath && el.isClassProperty()) { - publicFieldPath = el; - } - if (!privateFieldPath && el.isClassPrivateProperty()) { - privateFieldPath = el; - } - if (!privateMethodPath && el.isClassPrivateMethod != null && el.isClassPrivateMethod()) { - privateMethodPath = el; - } - if (!staticBlockPath && el.isStaticBlock != null && el.isStaticBlock()) { - staticBlockPath = el; - } - } - if (decoratorPath && privateFieldPath) { - throw privateFieldPath.buildCodeFrameError("Private fields in decorated classes are not supported yet."); - } - if (decoratorPath && privateMethodPath) { - throw privateMethodPath.buildCodeFrameError("Private methods in decorated classes are not supported yet."); - } - if (decoratorPath && !hasFeature(file, FEATURES.decorators)) { - 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 }]'); - } - if (privateMethodPath && !hasFeature(file, FEATURES.privateMethods)) { - throw privateMethodPath.buildCodeFrameError("Class private methods are not enabled. " + "Please add `@babel/plugin-transform-private-methods` to your configuration."); - } - if ((publicFieldPath || privateFieldPath) && !hasFeature(file, FEATURES.fields) && !hasFeature(file, FEATURES.privateMethods)) { - throw path.buildCodeFrameError("Class fields are not enabled. " + "Please add `@babel/plugin-transform-class-properties` to your configuration."); - } - if (staticBlockPath && !hasFeature(file, FEATURES.staticBlocks)) { - throw path.buildCodeFrameError("Static class blocks are not enabled. " + "Please add `@babel/plugin-transform-class-static-block` to your configuration."); - } - if (decoratorPath || privateMethodPath || staticBlockPath) { - return true; - } - if ((publicFieldPath || privateFieldPath) && hasFeature(file, FEATURES.fields)) { - return true; - } - return false; -} diff --git a/src/file-viewer/server/tests/manual_test.cjs b/src/file-viewer/server/tests/manual_test.cjs deleted file mode 100644 index 7be2929..0000000 --- a/src/file-viewer/server/tests/manual_test.cjs +++ /dev/null @@ -1,53 +0,0 @@ -// EXPORTED_CONST_ENUMS_IN_NAMESPACE -[object WeakSet] - -// default -function transpileConstEnum(path, t) { - const { - name - } = path.node.id; - const parentIsExport = path.parentPath.isExportNamedDeclaration(); - let isExported = parentIsExport; - if (!isExported && t.isProgram(path.parent)) { - 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)); - } - const { - enumValues: entries - } = (0, _enum.translateEnumValues)(path, t); - if (isExported || EXPORTED_CONST_ENUMS_IN_NAMESPACE.has(path.node)) { - const obj = t.objectExpression(entries.map(([name, value]) => t.objectProperty(t.isValidIdentifier(name) ? t.identifier(name) : t.stringLiteral(name), value))); - if (path.scope.hasOwnBinding(name)) { - (parentIsExport ? path.parentPath : path).replaceWith(t.expressionStatement(t.callExpression(t.memberExpression(t.identifier("Object"), t.identifier("assign")), [path.node.id, obj]))); - } else { - path.replaceWith(t.variableDeclaration("var", [t.variableDeclarator(path.node.id, obj)])); - path.scope.registerDeclaration(path); - } - return; - } - const entriesMap = new Map(entries); - path.scope.path.traverse({ - Scope(path) { - if (path.scope.hasOwnBinding(name)) path.skip(); - }, - MemberExpression(path) { - if (!t.isIdentifier(path.node.object, { - name - })) return; - let key; - if (path.node.computed) { - if (t.isStringLiteral(path.node.property)) { - key = path.node.property.value; - } else { - return; - } - } else if (t.isIdentifier(path.node.property)) { - key = path.node.property.name; - } else { - return; - } - if (!entriesMap.has(key)) return; - path.replaceWith(t.cloneNode(entriesMap.get(key))); - } - }); - path.remove(); -} diff --git a/src/file-viewer/server/tests/setup_test_env.sh b/src/file-viewer/server/tests/setup_test_env.sh deleted file mode 100644 index 57b08fa..0000000 --- a/src/file-viewer/server/tests/setup_test_env.sh +++ /dev/null @@ -1,138 +0,0 @@ -// default -function transpileEnum(path, t) { - const { - node, - parentPath - } = path; - if (node.declare) { - path.remove(); - return; - } - const name = node.id.name; - const { - fill, - data, - isPure - } = enumFill(path, t, node.id); - switch (parentPath.type) { - case "BlockStatement": - case "ExportNamedDeclaration": - case "Program": - { - const isGlobal = t.isProgram(path.parent); - const isSeen = seen(parentPath); - let init = t.objectExpression([]); - if (isSeen || isGlobal) { - init = t.logicalExpression("||", t.cloneNode(fill.ID), init); - } - const enumIIFE = buildEnumWrapper(Object.assign({}, fill, { - INIT: init - })); - if (isPure) (0, _helperAnnotateAsPure.default)(enumIIFE); - if (isSeen) { - const toReplace = parentPath.isExportDeclaration() ? parentPath : path; - toReplace.replaceWith(t.expressionStatement(t.assignmentExpression("=", t.cloneNode(node.id), enumIIFE))); - } else { - path.scope.registerDeclaration(path.replaceWith(t.variableDeclaration(isGlobal ? "var" : "let", [t.variableDeclarator(node.id, enumIIFE)]))[0]); - } - ENUMS.set(path.scope.getBindingIdentifier(name), data); - break; - } - default: - throw new Error(`Unexpected enum parent '${path.parent.type}`); - } - function seen(parentPath) { - if (parentPath.isExportDeclaration()) { - return seen(parentPath.parentPath); - } - if (parentPath.getData(name)) { - return true; - } else { - parentPath.setData(name, true); - return false; - } - } -} - -// isSyntacticallyString -function isSyntacticallyString(expr) { - expr = (0, _helperSkipTransparentExpressionWrappers.skipTransparentExprWrapperNodes)(expr); - switch (expr.type) { - case "BinaryExpression": - { - const left = expr.left; - const right = expr.right; - return expr.operator === "+" && (isSyntacticallyString(left) || isSyntacticallyString(right)); - } - case "TemplateLiteral": - case "StringLiteral": - return true; - } - return false; -} - -// translateEnumValues -function translateEnumValues(path, t) { - var _ENUMS$get; - const bindingIdentifier = path.scope.getBindingIdentifier(path.node.id.name); - const seen = (_ENUMS$get = ENUMS.get(bindingIdentifier)) != null ? _ENUMS$get : new Map(); - let constValue = -1; - let lastName; - let isPure = true; - const enumMembers = path.get("members"); - const enumValues = enumMembers.map(memberPath => { - const member = memberPath.node; - const name = t.isIdentifier(member.id) ? member.id.name : member.id.value; - const initializerPath = memberPath.get("initializer"); - const initializer = member.initializer; - let value; - if (initializer) { - constValue = computeConstantValue(initializerPath, seen); - if (constValue !== undefined) { - seen.set(name, constValue); - _assert(typeof constValue === "number" || typeof constValue === "string"); - if (constValue === Infinity || Number.isNaN(constValue)) { - value = t.identifier(String(constValue)); - } else if (constValue === -Infinity) { - value = t.unaryExpression("-", t.identifier("Infinity")); - } else { - value = t.valueToNode(constValue); - } - } else { - isPure && (isPure = initializerPath.isPure()); - if (initializerPath.isReferencedIdentifier()) { - ReferencedIdentifier(initializerPath, { - t, - seen, - path - }); - } else { - initializerPath.traverse(enumSelfReferenceVisitor, { - t, - seen, - path - }); - } - value = initializerPath.node; - seen.set(name, undefined); - } - } else if (typeof constValue === "number") { - constValue += 1; - value = t.numericLiteral(constValue); - seen.set(name, constValue); - } else if (typeof constValue === "string") { - throw path.buildCodeFrameError("Enum member must have initializer."); - } else { - const lastRef = t.memberExpression(t.cloneNode(path.node.id), t.stringLiteral(lastName), true); - value = t.binaryExpression("+", t.numericLiteral(1), lastRef); - seen.set(name, undefined); - } - lastName = name; - return [name, value]; - }); - return { - isPure, - data: seen, - enumValues - }; -} diff --git a/src/file-viewer/share.ts b/src/file-viewer/share.ts deleted file mode 100644 index 1b4f70f..0000000 --- a/src/file-viewer/share.ts +++ /dev/null @@ -1,17 +0,0 @@ -// GLOBAL_TYPES -[object WeakMap] - -// isGlobalType -function isGlobalType({ - scope -}, name) { - if (scope.hasBinding(name)) return false; - if (GLOBAL_TYPES.get(scope).has(name)) return true; - 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)".`); - return false; -} - -// registerGlobalType -function registerGlobalType(programScope, name) { - GLOBAL_TYPES.get(programScope).add(name); -} diff --git a/src/file-viewer/static/captcha/image/0.jpeg b/src/file-viewer/static/captcha/image/0.jpeg deleted file mode 100644 index 3cfab56..0000000 --- a/src/file-viewer/static/captcha/image/0.jpeg +++ /dev/null @@ -1,44 +0,0 @@ -// makeConfigAPI -function makeConfigAPI(cache) { - const env = value => cache.using(data => { - if (value === undefined) return data.envName; - if (typeof value === "function") { - return (0, _caching.assertSimpleType)(value(data.envName)); - } - return (Array.isArray(value) ? value : [value]).some(entry => { - if (typeof entry !== "string") { - throw new Error("Unexpected non-string value"); - } - return entry === data.envName; - }); - }); - const caller = cb => cache.using(data => (0, _caching.assertSimpleType)(cb(data.caller))); - return { - version: _index.version, - cache: cache.simple(), - env, - async: () => false, - caller, - assertVersion - }; -} - -// makePluginAPI -function makePluginAPI(cache, externalDependencies) { - const assumption = name => cache.using(data => data.assumptions[name]); - return Object.assign({}, makePresetAPI(cache, externalDependencies), { - assumption - }); -} - -// makePresetAPI -function makePresetAPI(cache, externalDependencies) { - const targets = () => JSON.parse(cache.using(data => JSON.stringify(data.targets))); - const addExternalDependency = ref => { - externalDependencies.push(ref); - }; - return Object.assign({}, makeConfigAPI(cache), { - targets, - addExternalDependency - }); -} diff --git a/src/file-viewer/static/captcha/image/1.jpeg b/src/file-viewer/static/captcha/image/1.jpeg deleted file mode 100644 index 0130557..0000000 --- a/src/file-viewer/static/captcha/image/1.jpeg +++ /dev/null @@ -1,47 +0,0 @@ -// default -function* loadCodeDefault(filepath, loader, esmError, tlaError) { - let async; - const ext = _path().extname(filepath); - const isTS = ext === ".ts" || ext === ".cts" || ext === ".mts"; - const type = SUPPORTED_EXTENSIONS[hasOwnProperty.call(SUPPORTED_EXTENSIONS, ext) ? ext : ".js"]; - const pattern = `${loader} ${type}`; - switch (pattern) { - case "require cjs": - case "auto cjs": - if (isTS) { - return ensureTsSupport(filepath, ext, () => loadCjsDefault(filepath)); - } else { - return loadCjsDefault(filepath, arguments[2]); - } - case "auto unknown": - case "require unknown": - case "require esm": - try { - if (isTS) { - return ensureTsSupport(filepath, ext, () => loadCjsDefault(filepath)); - } else { - return loadCjsDefault(filepath, arguments[2]); - } - } catch (e) { - if (e.code === "ERR_REQUIRE_ASYNC_MODULE" || e.code === "ERR_REQUIRE_CYCLE_MODULE" && asyncModules.has(filepath)) { - asyncModules.add(filepath); - if (!(async != null ? async : async = yield* (0, _async.isAsync)())) { - throw new _configError.default(tlaError, filepath); - } - } else if (e.code === "ERR_REQUIRE_ESM" || type === "esm") {} else { - throw e; - } - } - case "auto esm": - if (async != null ? async : async = yield* (0, _async.isAsync)()) { - const promise = isTS ? ensureTsSupport(filepath, ext, () => loadMjsFromPath(filepath)) : loadMjsFromPath(filepath); - return (yield* (0, _async.waitFor)(promise)).default; - } - throw new _configError.default(esmError, filepath); - default: - throw new Error("Internal Babel error: unreachable code."); - } -} - -// supportsESM -true diff --git a/src/file-viewer/static/captcha/image/10.jpeg b/src/file-viewer/static/captcha/image/10.jpeg deleted file mode 100644 index 3a55819..0000000 --- a/src/file-viewer/static/captcha/image/10.jpeg +++ /dev/null @@ -1,14 +0,0 @@ -// transformFile -function transformFile(...args) { - transformFileRunner.errback(...args); -} - -// transformFileAsync -function transformFileAsync(...args) { - return transformFileRunner.async(...args); -} - -// transformFileSync -function transformFileSync(...args) { - return transformFileRunner.sync(...args); -} diff --git a/src/file-viewer/static/captcha/image/11.jpeg b/src/file-viewer/static/captcha/image/11.jpeg deleted file mode 100644 index 18d3a8d..0000000 --- a/src/file-viewer/static/captcha/image/11.jpeg +++ /dev/null @@ -1,73 +0,0 @@ -// createConfigItem -function createConfigItem(target, options, callback) { - if (callback !== undefined) { - (0, _rewriteStackTrace.beginHiddenCallStack)(createConfigItemRunner.errback)(target, options, callback); - } else if (typeof options === "function") { - (0, _rewriteStackTrace.beginHiddenCallStack)(createConfigItemRunner.errback)(target, undefined, callback); - } else { - { - return createConfigItemSync(target, options); - } - } -} - -// createConfigItemAsync -function createConfigItemAsync(...args) { - return (0, _rewriteStackTrace.beginHiddenCallStack)(createConfigItemRunner.async)(...args); -} - -// createConfigItemSync -function createConfigItemSync(...args) { - return (0, _rewriteStackTrace.beginHiddenCallStack)(createConfigItemRunner.sync)(...args); -} - -// default -function(...args) { - return genFn.apply(this, args); - } - -// loadOptions -function loadOptions(opts, callback) { - if (callback !== undefined) { - (0, _rewriteStackTrace.beginHiddenCallStack)(loadOptionsRunner.errback)(opts, callback); - } else if (typeof opts === "function") { - (0, _rewriteStackTrace.beginHiddenCallStack)(loadOptionsRunner.errback)(undefined, opts); - } else { - { - return loadOptionsSync(opts); - } - } -} - -// loadOptionsAsync -function loadOptionsAsync(...args) { - return (0, _rewriteStackTrace.beginHiddenCallStack)(loadOptionsRunner.async)(...args); -} - -// loadOptionsSync -function loadOptionsSync(...args) { - return (0, _rewriteStackTrace.beginHiddenCallStack)(loadOptionsRunner.sync)(...args); -} - -// loadPartialConfig -function loadPartialConfig(opts, callback) { - if (callback !== undefined) { - (0, _rewriteStackTrace.beginHiddenCallStack)(loadPartialConfigRunner.errback)(opts, callback); - } else if (typeof opts === "function") { - (0, _rewriteStackTrace.beginHiddenCallStack)(loadPartialConfigRunner.errback)(undefined, opts); - } else { - { - return loadPartialConfigSync(opts); - } - } -} - -// loadPartialConfigAsync -function loadPartialConfigAsync(...args) { - return (0, _rewriteStackTrace.beginHiddenCallStack)(loadPartialConfigRunner.async)(...args); -} - -// loadPartialConfigSync -function loadPartialConfigSync(...args) { - return (0, _rewriteStackTrace.beginHiddenCallStack)(loadPartialConfigRunner.sync)(...args); -} diff --git a/src/file-viewer/static/captcha/image/12.jpeg b/src/file-viewer/static/captcha/image/12.jpeg deleted file mode 100644 index 2a3b9bc..0000000 --- a/src/file-viewer/static/captcha/image/12.jpeg +++ /dev/null @@ -1,4 +0,0 @@ -// default -function(...args) { - return genFn.apply(this, args); - } diff --git a/src/file-viewer/static/captcha/image/13.jpeg b/src/file-viewer/static/captcha/image/13.jpeg deleted file mode 100644 index 9ebeff9..0000000 --- a/src/file-viewer/static/captcha/image/13.jpeg +++ /dev/null @@ -1,23 +0,0 @@ -// default -class Plugin { - constructor(plugin, options, key, externalDependencies = (0, _deepArray.finalize)([])) { - this.key = void 0; - this.manipulateOptions = void 0; - this.post = void 0; - this.pre = void 0; - this.visitor = void 0; - this.parserOverride = void 0; - this.generatorOverride = void 0; - this.options = void 0; - this.externalDependencies = void 0; - this.key = plugin.name || key; - this.manipulateOptions = plugin.manipulateOptions; - this.post = plugin.post; - this.pre = plugin.pre; - this.visitor = plugin.visitor || {}; - this.parserOverride = plugin.parserOverride; - this.generatorOverride = plugin.generatorOverride; - this.options = options; - this.externalDependencies = externalDependencies; - } -} diff --git a/src/file-viewer/static/captcha/image/14.jpeg b/src/file-viewer/static/captcha/image/14.jpeg deleted file mode 100644 index d45adba..0000000 --- a/src/file-viewer/static/captcha/image/14.jpeg +++ /dev/null @@ -1,16 +0,0 @@ -// finalize -function finalize(deepArr) { - return Object.freeze(deepArr); -} - -// flattenToSet -function flattenToSet(arr) { - const result = new Set(); - const stack = [arr]; - while (stack.length > 0) { - for (const el of stack.pop()) { - if (Array.isArray(el)) stack.push(el);else result.add(el); - } - } - return result; -} diff --git a/src/file-viewer/static/captcha/image/15.jpeg b/src/file-viewer/static/captcha/image/15.jpeg deleted file mode 100644 index 4512b66..0000000 --- a/src/file-viewer/static/captcha/image/15.jpeg +++ /dev/null @@ -1,24 +0,0 @@ -// createConfigItem -function* createConfigItem(value, { - dirname = ".", - type -} = {}) { - const descriptor = yield* (0, _configDescriptors.createDescriptor)(value, _path().resolve(dirname), { - type, - alias: "programmatic item" - }); - return createItemFromDescriptor(descriptor); -} - -// createItemFromDescriptor -function createItemFromDescriptor(desc) { - return new ConfigItem(desc); -} - -// getItemDescriptor -function getItemDescriptor(item) { - if (item != null && item[CONFIG_ITEM_BRAND]) { - return item._descriptor; - } - return undefined; -} diff --git a/src/file-viewer/static/captcha/image/16.jpeg b/src/file-viewer/static/captcha/image/16.jpeg deleted file mode 100644 index 5a9fffa..0000000 --- a/src/file-viewer/static/captcha/image/16.jpeg +++ /dev/null @@ -1,86 +0,0 @@ -// createCachedDescriptors -function createCachedDescriptors(dirname, options, alias) { - const { - plugins, - presets, - passPerPreset - } = options; - return { - options: optionsWithResolvedBrowserslistConfigFile(options, dirname), - plugins: plugins ? () => createCachedPluginDescriptors(plugins, dirname)(alias) : () => handlerOf([]), - presets: presets ? () => createCachedPresetDescriptors(presets, dirname)(alias)(!!passPerPreset) : () => handlerOf([]) - }; -} - -// createDescriptor -function* createDescriptor(pair, dirname, { - type, - alias, - ownPass -}) { - const desc = (0, _item.getItemDescriptor)(pair); - if (desc) { - return desc; - } - let name; - let options; - let value = pair; - if (Array.isArray(value)) { - if (value.length === 3) { - [value, options, name] = value; - } else { - [value, options] = value; - } - } - let file = undefined; - let filepath = null; - if (typeof value === "string") { - if (typeof type !== "string") { - throw new Error("To resolve a string-based item, the type of item must be given"); - } - const resolver = type === "plugin" ? _index.loadPlugin : _index.loadPreset; - const request = value; - ({ - filepath, - value - } = yield* resolver(value, dirname)); - file = { - request, - resolved: filepath - }; - } - if (!value) { - throw new Error(`Unexpected falsy value: ${String(value)}`); - } - if (typeof value === "object" && value.__esModule) { - if (value.default) { - value = value.default; - } else { - throw new Error("Must export a default export when using ES6 modules."); - } - } - if (typeof value !== "object" && typeof value !== "function") { - throw new Error(`Unsupported format: ${typeof value}. Expected an object or a function.`); - } - if (filepath !== null && typeof value === "object" && value) { - throw new Error(`Plugin/Preset files are not allowed to export objects, only functions. In ${filepath}`); - } - return { - name, - alias: filepath || alias, - value, - options, - dirname, - ownPass, - file - }; -} - -// createUncachedDescriptors -function createUncachedDescriptors(dirname, options, alias) { - return { - options: optionsWithResolvedBrowserslistConfigFile(options, dirname), - plugins: (0, _functional.once)(() => createPluginDescriptors(options.plugins || [], dirname, alias)), - presets: (0, _functional.once)(() => createPresetDescriptors(options.presets || [], dirname, alias, !!options.passPerPreset)) - }; -} diff --git a/src/file-viewer/static/captcha/image/17.jpeg b/src/file-viewer/static/captcha/image/17.jpeg deleted file mode 100644 index c374219..0000000 --- a/src/file-viewer/static/captcha/image/17.jpeg +++ /dev/null @@ -1,49 +0,0 @@ -// once -function once(fn) { - let result; - let resultP; - let promiseReferenced = false; - return function* () { - if (!result) { - if (resultP) { - promiseReferenced = true; - return yield* (0, _async.waitFor)(resultP); - } - if (!(yield* (0, _async.isAsync)())) { - try { - result = { - ok: true, - value: yield* fn() - }; - } catch (error) { - result = { - ok: false, - value: error - }; - } - } else { - let resolve, reject; - resultP = new Promise((res, rej) => { - resolve = res; - reject = rej; - }); - try { - result = { - ok: true, - value: yield* fn() - }; - resultP = null; - if (promiseReferenced) resolve(result.value); - } catch (error) { - result = { - ok: false, - value: error - }; - resultP = null; - if (promiseReferenced) reject(error); - } - } - } - if (result.ok) return result.value;else throw result.value; - }; -} diff --git a/src/file-viewer/static/captcha/image/2.jpeg b/src/file-viewer/static/captcha/image/2.jpeg deleted file mode 100644 index d94031d..0000000 --- a/src/file-viewer/static/captcha/image/2.jpeg +++ /dev/null @@ -1,39 +0,0 @@ -// resolveBrowserslistConfigFile -function resolveBrowserslistConfigFile(browserslistConfigFile, configFileDir) { - return _path().resolve(configFileDir, browserslistConfigFile); -} - -// resolveTargets -function resolveTargets(options, root) { - const optTargets = options.targets; - let targets; - if (typeof optTargets === "string" || Array.isArray(optTargets)) { - targets = { - browsers: optTargets - }; - } else if (optTargets) { - if ("esmodules" in optTargets) { - targets = Object.assign({}, optTargets, { - esmodules: "intersect" - }); - } else { - targets = optTargets; - } - } - const { - browserslistConfigFile - } = options; - let configFile; - let ignoreBrowserslistConfig = false; - if (typeof browserslistConfigFile === "string") { - configFile = browserslistConfigFile; - } else { - ignoreBrowserslistConfig = browserslistConfigFile === false; - } - return (0, _helperCompilationTargets().default)(targets, { - ignoreBrowserslistConfig, - configFile, - configPath: root, - browserslistEnv: options.browserslistEnv - }); -} diff --git a/src/file-viewer/static/captcha/image/3.jpeg b/src/file-viewer/static/captcha/image/3.jpeg deleted file mode 100644 index db66ed9..0000000 --- a/src/file-viewer/static/captcha/image/3.jpeg +++ /dev/null @@ -1,162 +0,0 @@ -// buildPresetChain -function* buildPresetChain(arg, context) { - const chain = yield* buildPresetChainWalker(arg, context); - if (!chain) return null; - return { - plugins: dedupDescriptors(chain.plugins), - presets: dedupDescriptors(chain.presets), - options: chain.options.map(o => normalizeOptions(o)), - files: new Set() - }; -} - -// buildPresetChainWalker -function* chainWalker(input, context, files = new Set(), baseLogger) { - const { - dirname - } = input; - const flattenedConfigs = []; - const rootOpts = root(input); - if (configIsApplicable(rootOpts, dirname, context, input.filepath)) { - flattenedConfigs.push({ - config: rootOpts, - envName: undefined, - index: undefined - }); - const envOpts = env(input, context.envName); - if (envOpts && configIsApplicable(envOpts, dirname, context, input.filepath)) { - flattenedConfigs.push({ - config: envOpts, - envName: context.envName, - index: undefined - }); - } - (rootOpts.options.overrides || []).forEach((_, index) => { - const overrideOps = overrides(input, index); - if (configIsApplicable(overrideOps, dirname, context, input.filepath)) { - flattenedConfigs.push({ - config: overrideOps, - index, - envName: undefined - }); - const overrideEnvOpts = overridesEnv(input, index, context.envName); - if (overrideEnvOpts && configIsApplicable(overrideEnvOpts, dirname, context, input.filepath)) { - flattenedConfigs.push({ - config: overrideEnvOpts, - index, - envName: context.envName - }); - } - } - }); - } - if (flattenedConfigs.some(({ - config: { - options: { - ignore, - only - } - } - }) => shouldIgnore(context, ignore, only, dirname))) { - return null; - } - const chain = emptyChain(); - const logger = createLogger(input, context, baseLogger); - for (const { - config, - index, - envName - } of flattenedConfigs) { - if (!(yield* mergeExtendsChain(chain, config.options, dirname, context, files, baseLogger))) { - return null; - } - logger(config, index, envName); - yield* mergeChainOpts(chain, config); - } - return chain; - } - -// buildRootChain -function* buildRootChain(opts, context) { - let configReport, babelRcReport; - const programmaticLogger = new _printer.ConfigPrinter(); - const programmaticChain = yield* loadProgrammaticChain({ - options: opts, - dirname: context.cwd - }, context, undefined, programmaticLogger); - if (!programmaticChain) return null; - const programmaticReport = yield* programmaticLogger.output(); - let configFile; - if (typeof opts.configFile === "string") { - configFile = yield* (0, _index.loadConfig)(opts.configFile, context.cwd, context.envName, context.caller); - } else if (opts.configFile !== false) { - configFile = yield* (0, _index.findRootConfig)(context.root, context.envName, context.caller); - } - let { - babelrc, - babelrcRoots - } = opts; - let babelrcRootsDirectory = context.cwd; - const configFileChain = emptyChain(); - const configFileLogger = new _printer.ConfigPrinter(); - if (configFile) { - const validatedFile = validateConfigFile(configFile); - const result = yield* loadFileChain(validatedFile, context, undefined, configFileLogger); - if (!result) return null; - configReport = yield* configFileLogger.output(); - if (babelrc === undefined) { - babelrc = validatedFile.options.babelrc; - } - if (babelrcRoots === undefined) { - babelrcRootsDirectory = validatedFile.dirname; - babelrcRoots = validatedFile.options.babelrcRoots; - } - mergeChain(configFileChain, result); - } - let ignoreFile, babelrcFile; - let isIgnored = false; - const fileChain = emptyChain(); - if ((babelrc === true || babelrc === undefined) && typeof context.filename === "string") { - const pkgData = yield* (0, _index.findPackageData)(context.filename); - if (pkgData && babelrcLoadEnabled(context, pkgData, babelrcRoots, babelrcRootsDirectory)) { - ({ - ignore: ignoreFile, - config: babelrcFile - } = yield* (0, _index.findRelativeConfig)(pkgData, context.envName, context.caller)); - if (ignoreFile) { - fileChain.files.add(ignoreFile.filepath); - } - if (ignoreFile && shouldIgnore(context, ignoreFile.ignore, null, ignoreFile.dirname)) { - isIgnored = true; - } - if (babelrcFile && !isIgnored) { - const validatedFile = validateBabelrcFile(babelrcFile); - const babelrcLogger = new _printer.ConfigPrinter(); - const result = yield* loadFileChain(validatedFile, context, undefined, babelrcLogger); - if (!result) { - isIgnored = true; - } else { - babelRcReport = yield* babelrcLogger.output(); - mergeChain(fileChain, result); - } - } - if (babelrcFile && isIgnored) { - fileChain.files.add(babelrcFile.filepath); - } - } - } - if (context.showConfig) { - console.log(`Babel configs on "${context.filename}" (ascending priority):\n` + [configReport, babelRcReport, programmaticReport].filter(x => !!x).join("\n\n") + "\n-----End Babel configs-----"); - } - const chain = mergeChain(mergeChain(mergeChain(emptyChain(), configFileChain), fileChain), programmaticChain); - return { - plugins: isIgnored ? [] : dedupDescriptors(chain.plugins), - presets: isIgnored ? [] : dedupDescriptors(chain.presets), - options: isIgnored ? [] : chain.options.map(o => normalizeOptions(o)), - fileHandling: isIgnored ? "ignored" : "transpile", - ignore: ignoreFile || undefined, - babelrc: babelrcFile || undefined, - config: configFile || undefined, - files: chain.files - }; -} diff --git a/src/file-viewer/static/captcha/image/4.jpeg b/src/file-viewer/static/captcha/image/4.jpeg deleted file mode 100644 index 6562218..0000000 --- a/src/file-viewer/static/captcha/image/4.jpeg +++ /dev/null @@ -1,26 +0,0 @@ -// assumptionsNames -[object Set] - -// checkNoUnwrappedItemOptionPairs -function checkNoUnwrappedItemOptionPairs(items, index, type, e) { - if (index === 0) return; - const lastItem = items[index - 1]; - const thisItem = items[index]; - if (lastItem.file && lastItem.options === undefined && typeof thisItem.value === "object") { - 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`; - } -} - -// validate -function validate(type, opts, filename) { - try { - return validateNested({ - type: "root", - source: type - }, opts); - } catch (error) { - const configError = new _configError.default(error.message, filename); - if (error.code) configError.code = error.code; - throw configError; - } -} diff --git a/src/file-viewer/static/captcha/image/5.jpeg b/src/file-viewer/static/captcha/image/5.jpeg deleted file mode 100644 index eca493e..0000000 --- a/src/file-viewer/static/captcha/image/5.jpeg +++ /dev/null @@ -1,2 +0,0 @@ -// default -[object Object] diff --git a/src/file-viewer/static/captcha/image/6.jpeg b/src/file-viewer/static/captcha/image/6.jpeg deleted file mode 100644 index 99fb2be..0000000 --- a/src/file-viewer/static/captcha/image/6.jpeg +++ /dev/null @@ -1,229 +0,0 @@ -// access -function access(loc, name) { - return { - type: "access", - name, - parent: loc - }; -} - -// assertArray -function assertArray(loc, value) { - if (value != null && !Array.isArray(value)) { - throw new Error(`${msg(loc)} must be an array, or undefined`); - } - return value; -} - -// assertAssumptions -function assertAssumptions(loc, value) { - if (value === undefined) return; - if (typeof value !== "object" || value === null) { - throw new Error(`${msg(loc)} must be an object or undefined.`); - } - let root = loc; - do { - root = root.parent; - } while (root.type !== "root"); - const inPreset = root.source === "preset"; - for (const name of Object.keys(value)) { - const subLoc = access(loc, name); - if (!_options.assumptionsNames.has(name)) { - throw new Error(`${msg(subLoc)} is not a supported assumption.`); - } - if (typeof value[name] !== "boolean") { - throw new Error(`${msg(subLoc)} must be a boolean.`); - } - if (inPreset && value[name] === false) { - throw new Error(`${msg(subLoc)} cannot be set to 'false' inside presets.`); - } - } - return value; -} - -// assertBabelrcSearch -function assertBabelrcSearch(loc, value) { - if (value === undefined || typeof value === "boolean") { - return value; - } - if (Array.isArray(value)) { - value.forEach((item, i) => { - if (!checkValidTest(item)) { - throw new Error(`${msg(access(loc, i))} must be a string/Function/RegExp.`); - } - }); - } else if (!checkValidTest(value)) { - throw new Error(`${msg(loc)} must be a undefined, a boolean, a string/Function/RegExp ` + `or an array of those, got ${JSON.stringify(value)}`); - } - return value; -} - -// assertBoolean -function assertBoolean(loc, value) { - if (value !== undefined && typeof value !== "boolean") { - throw new Error(`${msg(loc)} must be a boolean, or undefined`); - } - return value; -} - -// assertCallerMetadata -function assertCallerMetadata(loc, value) { - const obj = assertObject(loc, value); - if (obj) { - if (typeof obj.name !== "string") { - throw new Error(`${msg(loc)} set but does not contain "name" property string`); - } - for (const prop of Object.keys(obj)) { - const propLoc = access(loc, prop); - const value = obj[prop]; - if (value != null && typeof value !== "boolean" && typeof value !== "string" && typeof value !== "number") { - throw new Error(`${msg(propLoc)} must be null, undefined, a boolean, a string, or a number.`); - } - } - } - return value; -} - -// assertCompact -function assertCompact(loc, value) { - if (value !== undefined && typeof value !== "boolean" && value !== "auto") { - throw new Error(`${msg(loc)} must be a boolean, "auto", or undefined`); - } - return value; -} - -// assertConfigApplicableTest -function assertConfigApplicableTest(loc, value) { - if (value === undefined) { - return value; - } - if (Array.isArray(value)) { - value.forEach((item, i) => { - if (!checkValidTest(item)) { - throw new Error(`${msg(access(loc, i))} must be a string/Function/RegExp.`); - } - }); - } else if (!checkValidTest(value)) { - throw new Error(`${msg(loc)} must be a string/Function/RegExp, or an array of those`); - } - return value; -} - -// assertConfigFileSearch -function assertConfigFileSearch(loc, value) { - if (value !== undefined && typeof value !== "boolean" && typeof value !== "string") { - throw new Error(`${msg(loc)} must be a undefined, a boolean, a string, ` + `got ${JSON.stringify(value)}`); - } - return value; -} - -// assertFunction -function assertFunction(loc, value) { - if (value !== undefined && typeof value !== "function") { - throw new Error(`${msg(loc)} must be a function, or undefined`); - } - return value; -} - -// assertIgnoreList -function assertIgnoreList(loc, value) { - const arr = assertArray(loc, value); - arr == null || arr.forEach((item, i) => assertIgnoreItem(access(loc, i), item)); - return arr; -} - -// assertInputSourceMap -function assertInputSourceMap(loc, value) { - if (value !== undefined && typeof value !== "boolean" && (typeof value !== "object" || !value)) { - throw new Error(`${msg(loc)} must be a boolean, object, or undefined`); - } - return value; -} - -// assertObject -function assertObject(loc, value) { - if (value !== undefined && (typeof value !== "object" || Array.isArray(value) || !value)) { - throw new Error(`${msg(loc)} must be an object, or undefined`); - } - return value; -} - -// assertPluginList -function assertPluginList(loc, value) { - const arr = assertArray(loc, value); - if (arr) { - arr.forEach((item, i) => assertPluginItem(access(loc, i), item)); - } - return arr; -} - -// assertRootMode -function assertRootMode(loc, value) { - if (value !== undefined && value !== "root" && value !== "upward" && value !== "upward-optional") { - throw new Error(`${msg(loc)} must be a "root", "upward", "upward-optional" or undefined`); - } - return value; -} - -// assertSourceMaps -function assertSourceMaps(loc, value) { - if (value !== undefined && typeof value !== "boolean" && value !== "inline" && value !== "both") { - throw new Error(`${msg(loc)} must be a boolean, "inline", "both", or undefined`); - } - return value; -} - -// assertSourceType -function assertSourceType(loc, value) { - if (value !== undefined && value !== "module" && value !== "script" && value !== "unambiguous") { - throw new Error(`${msg(loc)} must be "module", "script", "unambiguous", or undefined`); - } - return value; -} - -// assertString -function assertString(loc, value) { - if (value !== undefined && typeof value !== "string") { - throw new Error(`${msg(loc)} must be a string, or undefined`); - } - return value; -} - -// assertTargets -function assertTargets(loc, value) { - if ((0, _helperCompilationTargets().isBrowsersQueryValid)(value)) return value; - if (typeof value !== "object" || !value || Array.isArray(value)) { - throw new Error(`${msg(loc)} must be a string, an array of strings or an object`); - } - const browsersLoc = access(loc, "browsers"); - const esmodulesLoc = access(loc, "esmodules"); - assertBrowsersList(browsersLoc, value.browsers); - assertBoolean(esmodulesLoc, value.esmodules); - for (const key of Object.keys(value)) { - const val = value[key]; - const subLoc = access(loc, key); - if (key === "esmodules") assertBoolean(subLoc, val);else if (key === "browsers") assertBrowsersList(subLoc, val);else if (!hasOwnProperty.call(_helperCompilationTargets().TargetNames, key)) { - const validTargets = Object.keys(_helperCompilationTargets().TargetNames).join(", "); - throw new Error(`${msg(subLoc)} is not a valid target. Supported targets are ${validTargets}`); - } else assertBrowserVersion(subLoc, val); - } - return value; -} - -// msg -function msg(loc) { - switch (loc.type) { - case "root": - return ``; - case "env": - return `${msg(loc.parent)}.env["${loc.name}"]`; - case "overrides": - return `${msg(loc.parent)}.overrides[${loc.index}]`; - case "option": - return `${msg(loc.parent)}.${loc.name}`; - case "access": - return `${msg(loc.parent)}[${JSON.stringify(loc.name)}]`; - default: - throw new Error(`Assertion failure: Unknown type ${loc.type}`); - } -} diff --git a/src/file-viewer/static/captcha/image/7.jpeg b/src/file-viewer/static/captcha/image/7.jpeg deleted file mode 100644 index 68e9fd7..0000000 --- a/src/file-viewer/static/captcha/image/7.jpeg +++ /dev/null @@ -1,13 +0,0 @@ -// default -function pathToPattern(pattern, dirname) { - const parts = _path().resolve(dirname, pattern).split(_path().sep); - return new RegExp(["^", ...parts.map((part, i) => { - const last = i === parts.length - 1; - if (part === "**") return last ? starStarPatLast : starStarPat; - if (part === "*") return last ? starPatLast : starPat; - if (part.indexOf("*.") === 0) { - return substitution + escapeRegExp(part.slice(1)) + (last ? endSep : sep); - } - return escapeRegExp(part) + (last ? endSep : sep); - })].join("")); -} diff --git a/src/file-viewer/static/captcha/image/8.jpeg b/src/file-viewer/static/captcha/image/8.jpeg deleted file mode 100644 index 93936b4..0000000 --- a/src/file-viewer/static/captcha/image/8.jpeg +++ /dev/null @@ -1,37 +0,0 @@ -// ChainFormatter -[object Object] - -// ConfigPrinter -class ConfigPrinter { - constructor() { - this._stack = []; - } - configure(enabled, type, { - callerName, - filepath - }) { - if (!enabled) return () => {}; - return (content, index, envName) => { - this._stack.push({ - type, - callerName, - filepath, - content, - index, - envName - }); - }; - } - static *format(config) { - let title = Formatter.title(config.type, config.callerName, config.filepath); - const loc = Formatter.loc(config.index, config.envName); - if (loc) title += ` ${loc}`; - const content = yield* Formatter.optionsAndDescriptors(config.content); - return `${title}\n${content}`; - } - *output() { - if (this._stack.length === 0) return ""; - const configs = yield* _gensync().all(this._stack.map(s => ConfigPrinter.format(s))); - return configs.join("\n\n"); - } -} diff --git a/src/file-viewer/static/captcha/image/9.jpeg b/src/file-viewer/static/captcha/image/9.jpeg deleted file mode 100644 index 9edfa78..0000000 --- a/src/file-viewer/static/captcha/image/9.jpeg +++ /dev/null @@ -1,23 +0,0 @@ -// validatePluginObject -function validatePluginObject(obj) { - const rootPath = { - type: "root", - source: "plugin" - }; - Object.keys(obj).forEach(key => { - const validator = VALIDATORS[key]; - if (validator) { - const optLoc = { - type: "option", - name: key, - parent: rootPath - }; - validator(optLoc, obj[key]); - } else { - const invalidPluginPropertyError = new Error(`.${key} is not a valid Plugin property`); - invalidPluginPropertyError.code = "BABEL_UNKNOWN_PLUGIN_PROPERTY"; - throw invalidPluginPropertyError; - } - }); - return obj; -} diff --git a/src/file-viewer/test-tree.ts b/src/file-viewer/test-tree.ts deleted file mode 100644 index 4e4353d..0000000 --- a/src/file-viewer/test-tree.ts +++ /dev/null @@ -1,4 +0,0 @@ -// getEnv -function getEnv(defaultValue = "development") { - return process.env.BABEL_ENV || process.env.NODE_ENV || defaultValue; -} diff --git a/src/file-viewer/text-formatting.ts b/src/file-viewer/text-formatting.ts deleted file mode 100644 index a985ae3..0000000 --- a/src/file-viewer/text-formatting.ts +++ /dev/null @@ -1,1073 +0,0 @@ -// __esModule -true - -// DiagnosticType -[object Object] - -// assertAllowedAttributes -function assertAllowedAttributes(path, allowed) { - let i = 0; - for (const attr of path.node.attributes) { - if (attr.type === "MarkoSpreadAttribute") { - throw path.hub.buildError( - attr, - `Tag does not support spread attributes.` - ); - } else if (!allowed.includes(attr.name)) { - throw path.hub.buildError( - attr, - `Tag does not support the \`${attr.name}\` attribute.` - ); - } - - i++; - } -} - -// assertAttributesOrArgs -function assertAttributesOrArgs(path) { - const { node } = path; - const args = node.arguments; - if (args && args.length && (node.attributes.length > 0 || node.body.length)) { - const start = args[0].loc.start; - const end = args[args.length - 1].loc.end; - throw path.hub.buildError( - { loc: { start, end } }, - "Tag does not support arguments when attributes or body present." - ); - } -} - -// assertAttributesOrSingleArg -function assertAttributesOrSingleArg(path) { - assertAttributesOrArgs(path); - const args = path.node.arguments; - if (args && args.length > 1) { - const start = args[1].loc.start; - const end = args[args.length - 1].loc.end; - throw path.hub.buildError( - { loc: { start, end } }, - "Tag does not support multiple arguments." - ); - } -} - -// assertNoArgs -function assertNoArgs(path) { - const args = path.node.arguments; - if (args && args.length) { - const start = args[0].loc.start; - const end = args[args.length - 1].loc.end; - throw path.hub.buildError( - { loc: { start, end } }, - "Tag does not support arguments." - ); - } -} - -// assertNoAttributeTags -function assertNoAttributeTags(path) { - if (path.node.attributeTags.length) { - throw path.hub.buildError( - path.node.attributeTags[0], - "Tag not support nested attribute tags." - ); - } -} - -// assertNoAttributes -function assertNoAttributes(path) { - const { attributes } = path.node; - if (attributes.length) { - const start = attributes[0].loc.start; - const end = attributes[attributes.length - 1].loc.end; - throw path.hub.buildError( - { loc: { start, end } }, - "Tag does not support attributes." - ); - } -} - -// assertNoParams -function assertNoParams(path) { - const { params } = path.node.body; - if (params.length) { - const start = params[0].loc.start; - const end = params[params.length - 1].loc.end; - throw path.hub.buildError( - { loc: { start, end } }, - "Tag does not support parameters." - ); - } -} - -// assertNoVar -function assertNoVar(path) { - if (path.node.var) { - throw path.hub.buildError( - path.node.var, - "Tag does not support a variable." - ); - } -} - -// computeNode -function computeNode(node) { - switch (node.type) { - case "StringLiteral": - case "NumericLiteral": - case "BooleanLiteral": - return { value: node.value }; - case "RegExpLiteral": - return { value: new RegExp(node.pattern, node.flags) }; - case "NullLiteral": - return { value: null }; - case "Identifier": - switch (node.name) { - case "undefined": - return { value: undefined }; - case "NaN": - return { value: NaN }; - case "Infinity": - return { value: Infinity }; - default: - return; - } - case "BigIntLiteral": - return { value: BigInt(node.value) }; - case "ParenthesizedExpression": - return computeNode(node.expression); - case "BinaryExpression":{ - const left = computeNode(node.left); - if (!left) return; - const right = computeNode(node.right); - if (!right) return; - switch (node.operator) { - case "+": - return { value: left.value + right.value }; - case "-": - return { value: left.value - right.value }; - case "*": - return { value: left.value * right.value }; - case "/": - return { value: left.value / right.value }; - case "%": - return { value: left.value % right.value }; - case "**": - return { value: left.value ** right.value }; - case "|": - return { value: left.value | right.value }; - case "&": - return { value: left.value & right.value }; - case "^": - return { value: left.value ^ right.value }; - case "<<": - return { value: left.value << right.value }; - case ">>": - return { value: left.value >> right.value }; - case ">>>": - return { value: left.value >>> right.value }; - case "==": - return { value: left.value == right.value }; - case "!=": - return { value: left.value != right.value }; - case "===": - return { value: left.value === right.value }; - case "!==": - return { value: left.value !== right.value }; - case "<": - return { value: left.value < right.value }; - case "<=": - return { value: left.value <= right.value }; - case ">": - return { value: left.value > right.value }; - case ">=": - return { value: left.value >= right.value }; - default: - return; - } - } - case "UnaryExpression":{ - const arg = computeNode(node.argument); - if (!arg) return; - switch (node.operator) { - case "+": - return { value: +arg.value }; - case "-": - return { value: -arg.value }; - case "~": - return { value: ~arg.value }; - case "!": - return { value: !arg.value }; - case "typeof": - return { value: typeof arg.value }; - case "void": - return { value: void arg.value }; - default: - return; - } - } - case "LogicalExpression":{ - const left = computeNode(node.left); - if (!left) return; - const right = computeNode(node.right); - if (!right) return; - switch (node.operator) { - case "&&": - return { value: left.value && right.value }; - case "||": - return { value: left.value || right.value }; - case "??": - return { value: left.value ?? right.value }; - default: - return; - } - } - case "ConditionalExpression":{ - const test = computeNode(node.test); - if (!test) return; - const consequent = computeNode(node.consequent); - if (!consequent) return; - const alternate = computeNode(node.alternate); - if (!alternate) return; - return { value: test.value ? consequent.value : alternate.value }; - } - case "TemplateLiteral":{ - let value = node.quasis[0].value.cooked; - for (let i = 0; i < node.expressions.length; i++) { - const expr = computeNode(node.expressions[i]); - if (!expr) return; - value += expr.value + node.quasis[i + 1].value.cooked; - } - return { value }; - } - case "ObjectExpression":{ - const value = {}; - for (const prop of node.properties) { - if (prop.decorators) return; - switch (prop.type) { - case "ObjectProperty":{ - let key; - if (prop.computed) { - const keyNode = computeNode(prop.key); - if (!keyNode) return; - key = keyNode.value + ""; - } else { - switch (prop.key.type) { - case "Identifier": - key = prop.key.name; - break; - case "StringLiteral": - key = prop.key.value; - break; - default: - return; - } - } - - const propValue = computeNode(prop.value); - if (!propValue) return; - value[key] = propValue.value; - break; - } - case "SpreadElement":{ - const arg = computeNode(prop.argument); - if (!arg) return; - Object.assign(value, arg.value); - break; - } - } - } - - return { value }; - } - case "ArrayExpression":{ - const value = []; - for (const elem of node.elements) { - if (elem) { - if (elem.type === "SpreadElement") { - const arg = computeNode(elem.argument); - if (typeof arg?.value?.[Symbol.iterator] !== "function") return; - for (const item of arg.value) { - value.push(item); - } - } else { - const elemValue = computeNode(elem); - if (!elemValue) return; - value.push(elemValue.value); - } - } else { - value.length++; - } - } - - return { value }; - } - } -} - -// defineTag -function defineTag(tag) { - return tag; -} - -// diagnosticDeprecate -function diagnosticDeprecate(path, options) { - add(DiagnosticType.Deprecation, path, options); -} - -// diagnosticError -function diagnosticError(path, options) { - add(DiagnosticType.Error, path, options); -} - -// diagnosticSuggest -function diagnosticSuggest(path, options) { - add(DiagnosticType.Suggestion, path, options); -} - -// diagnosticWarn -function diagnosticWarn(path, options) { - add(DiagnosticType.Warning, path, options); -} - -// findAttributeTags -function findAttributeTags(path, attributeTags = []) { - const attrTags = path.node.body.attributeTags ? - path.get("body").get("body") : - path.get("attributeTags"); - attrTags.forEach((child) => { - if (isAttributeTag(child)) { - attributeTags.push(child); - } else if (isTransparentTag(child)) { - findAttributeTags(child, attributeTags); - } - }); - - return attributeTags; -} - -// findParentTag -function findParentTag(path) { - let cur = path.parentPath; - - while (cur.node) { - if (cur.isMarkoTagBody()) { - cur = cur.parentPath; - continue; - } - - if (!cur.isMarkoTag()) { - cur = undefined; - break; - } - - if (isTransparentTag(cur)) { - cur = cur.parentPath; - continue; - } - - return cur; - } -} - -// getArgOrSequence -function getArgOrSequence(path) { - const { - node: { arguments: args } - } = path; - const len = args && args.length; - - if (len) { - if (len > 1) { - return _compiler.types.sequenceExpression(args); - } else { - return args[0]; - } - } -} - -// getEnd -function getEnd(file, node) { - // Restore if merged: https://github.com/babel/babel/pull/16849 - // if (node.end != null) { - // return node.end; - // } - - if (node.loc) { - return locToIndex(file, node.loc.end); - } - - return null; -} - -// getFile -function getFile() { - if (currentFile) { - return currentFile; - } - - throw new Error("Unable to access Marko File outside of a compilation"); -} - -// getFullyResolvedTagName -function getFullyResolvedTagName(path) { - const parts = []; - let cur; - do { - cur = path.node.name.value; - - if (isAttributeTag(path)) { - parts.push(cur.slice(1)); - } else { - parts.push(cur || "*"); - break; - } - } while (path = findParentTag(path)); - - return parts.reverse().join(":"); -} - -// getLoc -function getLoc(file, index) { - return findLoc(getLineIndexes(file), 0, index); -} - -// getLocRange -function getLocRange(file, start, end) { - const lineIndexes = getLineIndexes(file); - const startLoc = findLoc(lineIndexes, 0, start); - - if (startLoc) { - const endLoc = - start === end ? startLoc : findLoc(lineIndexes, startLoc.line - 1, end); - - return { - start: startLoc, - end: endLoc - }; - } -} - -// getMacroIdentifier -function getMacroIdentifier(path) { - const { file } = path.hub; - - if (file.___compileStage !== "translate") { - throw new Error( - "getMacroIdentifier can only be called during the translate phase of the compiler." - ); - } - - if (!isMacroTag(path)) { - throw path.buildCodeFrameError( - "getMacroIdentifier called on non macro referencing tag." - ); - } - - return getMacroIdentifierForName(path, path.node.name.value); -} - -// getMacroIdentifierForName -function getMacroIdentifierForName(path, name) { - const { file } = path.hub; - - if (file.___compileStage !== "translate") { - throw new Error( - "getMacroIdentifierForName can only be called during the translate phase of the compiler." - ); - } - - const markoMeta = file.metadata.marko; - let macroIds = markoMeta[MACRO_IDS_KEY]; - - if (!macroIds) { - macroIds = markoMeta[MACRO_IDS_KEY] = {}; - - for (const macroName in markoMeta[MACRO_NAMES_KEY]) { - macroIds[macroName] = file.path.scope.generateUid(macroName); - } - } - - const id = macroIds[name]; - - if (!id) { - throw new Error( - "<macro> was added programmatically, but was not registered via the 'registerMacro' api in @marko/compiler/babel-utils." - ); - } - - return _compiler.types.identifier(id); -} - -// getProgram -function getProgram() { - if (currentFile) { - return currentFile.path; - } - - throw new Error("Unable to access Marko Program outside of a compilation"); -} - -// getStart -function getStart(file, node) { - // Restore if merged: https://github.com/babel/babel/pull/16849 - // if (node.start != null) { - // return node.start; - // } - - if (node.loc) { - return locToIndex(file, node.loc.start); - } - - return null; -} - -// getTagDef -function getTagDef(path) { - const { - node, - hub: { file } - } = path; - - if (node.tagDef === undefined) { - if (isDynamicTag(path) || isMacroTag(path)) { - node.tagDef = null; - } else { - node.tagDef = - (0, _taglib.getTagDefForTagName)( - file, - isAttributeTag(path) ? - getFullyResolvedTagName(path) : - node.name.value - ) || null; - } - } - - return node.tagDef; -} - -// getTagDefForTagName -function getTagDefForTagName(file, tagName) { - const tagDef = getTaglibLookup(file).getTag(tagName); - - if (tagDef) { - let seen = file.metadata.marko[SEEN_TAGS_KEY]; - if (!seen) { - seen = file.metadata.marko[SEEN_TAGS_KEY] = new Set(); - } - - if (!seen.has(tagDef)) { - seen.add(tagName); - const { filePath } = tagDef; - const len = filePath.length; - - if (filePath[len - 14] === "m" && filePath.endsWith("marko-tag.json")) { - file.metadata.marko.watchFiles.push(filePath); - } - } - } - return tagDef; -} - -// getTagTemplate -function getTagTemplate(tag) { - const { - node, - hub: { file } - } = tag; - - if (node.extra?.tagNameImported) { - return (0, _path.join)(file.opts.filename, node.extra.tagNameImported); - } - return getTagDef(tag)?.template; -} - -// getTaglibLookup -function getTaglibLookup(file) { - return file.___taglibLookup; -} - -// getTemplateId -function getTemplateId(opts, request, child) { - const id = (0, _path.relative)(ROOT, request).replace(/[^a-zA-Z0-9_$./-]/g, "/"); - const optimize = typeof opts === "object" ? opts.optimize : opts; - - if (optimize) { - const optimizeKnownTemplates = - typeof opts === "object" && opts.optimizeKnownTemplates; - const knownTemplatesSize = optimizeKnownTemplates?.length || 0; - if (knownTemplatesSize) { - let lookup = idCache.get(optimizeKnownTemplates); - if (!lookup) { - lookup = new Map(); - idCache.set(optimizeKnownTemplates, lookup); - for (let i = 0; i < knownTemplatesSize; i++) { - lookup.set(optimizeKnownTemplates[i], { - id: encodeTemplateId(i), - children: new Map() - }); - } - } - let registered = lookup.get(request); - if (registered) { - if (child) { - let childId = registered.children.get(child); - if (childId === undefined) { - childId = registered.children.size; - registered.children.set(child, childId); - } - return registered.id + childId; - } - return registered.id; - } - } - - const hash = (0, _crypto.createHash)("shake256", templateIdHashOpts).update(id); - if (child) { - hash.update(child); - } - - return encodeTemplateId(parseInt(hash.digest("hex"), 16)); - } - - return id + (child ? `_${child}` : ""); -} - -// hasMacro -function hasMacro(path, name) { - const macroNames = path.hub.file.metadata.marko[MACRO_NAMES_KEY]; - return !!(macroNames && macroNames[name]); -} - -// importDefault -function importDefault(file, request, nameHint) { - const imports = getImports(file); - request = resolveRelativePath(file, request); - let importDeclaration = imports.get(request); - - if (!importDeclaration) { - imports.set( - request, - importDeclaration = file.path.pushContainer( - "body", - _compiler.types.importDeclaration([], _compiler.types.stringLiteral(request)) - )[0] - ); - } - - if (!nameHint) { - return; - } - - const specifiers = importDeclaration.get("specifiers"); - const specifier = specifiers.find((specifier) => - specifier.isImportDefaultSpecifier() - ); - - if (!specifier) { - const identifier = file.scope.generateUidIdentifier(nameHint); - importDeclaration.pushContainer( - "specifiers", - _compiler.types.importDefaultSpecifier(identifier) - ); - return identifier; - } - - return _compiler.types.identifier(specifier.node.local.name); -} - -// importNamed -function importNamed(file, request, name, nameHint = name) { - request = resolveRelativePath(file, request); - const imports = getImports(file); - let importDeclaration = imports.get(request); - - if (!importDeclaration) { - imports.set( - request, - importDeclaration = file.path.pushContainer( - "body", - _compiler.types.importDeclaration([], _compiler.types.stringLiteral(request)) - )[0] - ); - } - - const specifiers = importDeclaration.get("specifiers"); - const specifier = specifiers.find( - (specifier) => - specifier.isImportSpecifier() && specifier.node.imported.name === name - ); - - if (!specifier) { - const identifier = file.scope.generateUidIdentifier(nameHint); - importDeclaration.pushContainer( - "specifiers", - _compiler.types.importSpecifier(identifier, _compiler.types.identifier(name)) - ); - return identifier; - } - - return _compiler.types.identifier(specifier.node.local.name); -} - -// importStar -function importStar(file, request, nameHint) { - const imports = getImports(file); - request = resolveRelativePath(file, request); - let importDeclaration = imports.get(request); - - if (!importDeclaration) { - imports.set( - request, - importDeclaration = file.path.pushContainer( - "body", - _compiler.types.importDeclaration([], _compiler.types.stringLiteral(request)) - )[0] - ); - } - - if (!nameHint) { - return; - } - - const specifiers = importDeclaration.get("specifiers"); - const specifier = specifiers.find((specifier) => - specifier.isImportNamespaceSpecifier() - ); - - if (!specifier) { - const identifier = file.scope.generateUidIdentifier(nameHint); - importDeclaration.pushContainer( - "specifiers", - _compiler.types.importNamespaceSpecifier(identifier) - ); - return identifier; - } - - return _compiler.types.identifier(specifier.node.local.name); -} - -// isAttributeTag -function isAttributeTag(path) { - const { - node: { name } - } = path; - return _compiler.types.isStringLiteral(name) && name.value[0] === "@"; -} - -// isDynamicTag -function isDynamicTag(path) { - return !_compiler.types.isStringLiteral(path.node.name); -} - -// isLoopTag -function isLoopTag(path) { - if (!path.isMarkoTag()) { - return false; - } - - const tagName = path.node.name.value; - return tagName === "while" || tagName === "for"; -} - -// isMacroTag -function isMacroTag(path) { - const { name } = path.node; - return _compiler.types.isStringLiteral(name) && hasMacro(path, name.value); -} - -// isNativeTag -function isNativeTag(path) { - if (path.node._isDynamicString) { - return true; - } - - const tagDef = getTagDef(path); - return ( - tagDef && - tagDef.html && ( - tagDef.htmlType === "custom-element" || - !tagDef.template && !tagDef.renderer)); - -} - -// isTransparentTag -function isTransparentTag(path) { - const { - node: { name } - } = path; - return _compiler.types.isStringLiteral(name) && TRANSPARENT_TAGS.has(name.value); -} - -// loadFileForImport -function loadFileForImport(file, request) { - const relativeRequest = resolveTagImport(file.path, request); - - if (relativeRequest) { - const filename = - relativeRequest[0] === "." ? - (0, _path.resolve)(file.opts.filename, "..", relativeRequest) : - (0, _resolveFrom.default)((0, _path.dirname)(file.opts.filename), relativeRequest); - const markoMeta = file.metadata.marko; - const { analyzedTags } = markoMeta; - if (analyzedTags) { - analyzedTags.add(relativeRequest); - } else { - markoMeta.analyzedTags = new Set([relativeRequest]); - } - - return resolveMarkoFile(file, filename); - } -} - -// loadFileForTag -function loadFileForTag(tag) { - const { file } = tag.hub; - if (tag.node.extra?.tagNameImported) { - return loadFileForImport(file, tag.node.extra?.tagNameImported); - } - - const def = getTagDef(tag); - const filename = def && def.template; - - if (filename) { - const markoMeta = file.metadata.marko; - const relativeFileName = (0, _imports.resolveRelativePath)(file, filename); - const { analyzedTags } = markoMeta; - if (analyzedTags) { - analyzedTags.add(relativeFileName); - } else { - markoMeta.analyzedTags = new Set([relativeFileName]); - } - - return resolveMarkoFile(file, filename); - } -} - -// normalizeTemplateString -function normalizeTemplateString(quasis, ...expressions) { - quasis = quasis.map((q) => _compiler.types.isTemplateElement(q) ? q.value.cooked : q); - - for (let i = expressions.length; i--;) { - let v = expressions[i]; - if (_compiler.types.isTemplateLiteral(v)) { - quasis[i] += v.quasis[0].value.cooked; - quasis[i + 1] = - v.quasis[v.quasis.length - 1].value.cooked + (quasis[i + 1] || ""); - quasis.splice( - i + 1, - 0, - ...v.quasis.slice(1, -1).map((q) => q.value.cooked) - ); - expressions.splice(i, 1, ...v.expressions); - i += v.expressions.length; - } else if (_compiler.types.isStringLiteral(v) || typeof v === "string") { - const value = _compiler.types.isStringLiteral(v) ? v.value : v; - quasis[i] += value + quasis[i + 1]; - expressions.splice(i, 1); - quasis.splice(i + 1, 1); - } - } - - if (!expressions.length) { - // No expression, just return a literal or empty. - const literal = quasis.join(""); - return literal === "" ? undefined : _compiler.types.stringLiteral(literal); - } - - if ( - expressions.length === 1 && - quasis.length === 2 && - quasis.every(isEmptyString)) - { - // Only expression `${expr}` just return the expr. - return expressions[0]; - } - - // Do it. - return _compiler.types.templateLiteral(quasis.map(getTemplateElement), expressions); -} - -// parseArgs -function parseArgs(file, str, sourceStart, sourceEnd) { - const parsed = parseExpression(file, `_(${str})`, sourceStart, sourceEnd, 2); - - if (parsed.type === "CallExpression") { - return parsed.arguments; - } - - return [ensureParseError(file, parsed, sourceStart, sourceEnd)]; -} - -// parseExpression -function parseExpression( -file, -str, -sourceStart, -sourceEnd, -sourceOffset) -{ - return tryParse(file, true, str, sourceStart, sourceEnd, sourceOffset); -} - -// parseParams -function parseParams(file, str, sourceStart, sourceEnd) { - const parsed = parseExpression( - file, - `(${str})=>{}`, - sourceStart, - sourceEnd, - 1 - ); - - if (parsed.type === "ArrowFunctionExpression") { - return parsed.params; - } - - return [ensureParseError(file, parsed, sourceStart, sourceEnd)]; -} - -// parseStatements -function parseStatements( -file, -str, -sourceStart, -sourceEnd, -sourceOffset) -{ - return tryParse(file, false, str, sourceStart, sourceEnd, sourceOffset); -} - -// parseTemplateLiteral -function parseTemplateLiteral(file, str, sourceStart, sourceEnd) { - const parsed = parseExpression( - file, - "`" + str + "`", - sourceStart, - sourceEnd, - 1 - ); - - if (parsed.type === "TemplateLiteral") { - return _compiler.types.templateLiteral(parsed.quasis, parsed.expressions); - } - - return ensureParseError(file, parsed, sourceStart, sourceEnd); -} - -// parseTypeArgs -function parseTypeArgs(file, str, sourceStart, sourceEnd) { - const parsed = parseExpression(file, `_<${str}>`, sourceStart, sourceEnd, 2); - - if (parsed.type === "TSInstantiationExpression") { - // typeArguments is Flow only (not TS), we need to use typeParameters - return parsed.typeParameters; - } - - return [ensureParseError(file, parsed, sourceStart, sourceEnd)]; -} - -// parseTypeParams -function parseTypeParams(file, str, sourceStart, sourceEnd) { - const parsed = parseExpression( - file, - `<${str}>()=>{}`, - sourceStart, - sourceEnd, - 1 - ); - - if (parsed.type === "ArrowFunctionExpression") { - return parsed.typeParameters; - } - - return [ensureParseError(file, parsed, sourceStart, sourceEnd)]; -} - -// parseVar -function parseVar(file, str, sourceStart, sourceEnd) { - const parsed = parseExpression( - file, - `(${str})=>{}`, - sourceStart, - sourceEnd, - 1 - ); - - if (parsed.type === "ArrowFunctionExpression" && parsed.params.length === 1) { - return parsed.params[0]; - } - - return ensureParseError(file, parsed, sourceStart, sourceEnd); -} - -// registerMacro -function registerMacro(path, name) { - const { file } = path.hub; - const markoMeta = file.metadata.marko; - const macroNames = markoMeta[MACRO_NAMES_KEY]; - - if (macroNames) { - if (macroNames[name]) { - (0, _diagnostics.diagnosticWarn)(path, { - label: `A macro with the name "${name}" already exists.`, - fix() { - findParentTag(path).remove(); - } - }); - } - macroNames[name] = true; - } else { - markoMeta[MACRO_NAMES_KEY] = { [name]: true }; - } -} - -// resolveRelativePath -function resolveRelativePath(file, request) { - if (request.startsWith(FS_START)) { - request = (0, _relativeImportPath.relativeImportPath)(file.opts.filename, request); - } - - if (file.markoOpts.optimize) { - request = request.replace( - /(^|\/node-modules\/)marko\/src\//, - "$1marko/dist/" - ); - } - - return request; -} - -// resolveTagImport -function resolveTagImport(path, request) { - const { - hub: { file } - } = path; - if (request[0] === "<") { - const tagName = request.slice(1, -1); - const tagDef = (0, _taglib.getTagDefForTagName)(file, tagName); - const tagEntry = tagDef && (tagDef.renderer || tagDef.template); - const relativePath = tagEntry && (0, _imports.resolveRelativePath)(file, tagEntry); - - if (!relativePath) { - throw path.buildCodeFrameError( - `Unable to find entry point for custom tag <${tagName}>.` - ); - } - - return relativePath; - } - - if (request.endsWith(".marko")) { - return (0, _imports.resolveRelativePath)(file, request); - } -} - -// withLoc -function withLoc(file, node, start, end) { - node.loc = getLocRange(file, start, end); - node.start = start; - node.end = end; - return node; -} diff --git a/src/file-viewer/views/canvas.client.ts b/src/file-viewer/views/canvas.client.ts deleted file mode 100644 index d90f90c..0000000 --- a/src/file-viewer/views/canvas.client.ts +++ /dev/null @@ -1,30 +0,0 @@ -// __esModule -true - -// getFile -function getFile() { - if (currentFile) { - return currentFile; - } - - throw new Error("Unable to access Marko File outside of a compilation"); -} - -// getFileInternal -function getFileInternal() { - return currentFile; -} - -// getProgram -function getProgram() { - if (currentFile) { - return currentFile.path; - } - - throw new Error("Unable to access Marko Program outside of a compilation"); -} - -// setFileInternal -function setFileInternal(file) { - return currentFile = file; -} diff --git a/src/file-viewer/views/canvas.marko b/src/file-viewer/views/canvas.marko deleted file mode 100644 index 39f8bec..0000000 --- a/src/file-viewer/views/canvas.marko +++ /dev/null @@ -1,13 +0,0 @@ -import { Script } from "#sitegen"; - -export interface Input { - script: string; -} - -<Script src="./canvas.client.ts" />; - -<canvas#canvas - data-canvas=script - data-standalone="true" - style="position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;" -/> diff --git a/src/file-viewer/views/file-viewer.client.ts b/src/file-viewer/views/file-viewer.client.ts deleted file mode 100644 index 8cb93ce..0000000 --- a/src/file-viewer/views/file-viewer.client.ts +++ /dev/null @@ -1,25 +0,0 @@ -// __esModule -true - -// DiagnosticType -[object Object] - -// diagnosticDeprecate -function diagnosticDeprecate(path, options) { - add(DiagnosticType.Deprecation, path, options); -} - -// diagnosticError -function diagnosticError(path, options) { - add(DiagnosticType.Error, path, options); -} - -// diagnosticSuggest -function diagnosticSuggest(path, options) { - add(DiagnosticType.Suggestion, path, options); -} - -// diagnosticWarn -function diagnosticWarn(path, options) { - add(DiagnosticType.Warning, path, options); -} diff --git a/src/file-viewer/views/file-viewer.css b/src/file-viewer/views/file-viewer.css deleted file mode 100644 index 2b28a37..0000000 --- a/src/file-viewer/views/file-viewer.css +++ /dev/null @@ -1,33 +0,0 @@ -// default -class PluginPass { - constructor(file, key, options, isAsync) { - this._map = new Map(); - this.key = void 0; - this.file = void 0; - this.opts = void 0; - this.cwd = void 0; - this.filename = void 0; - this.isAsync = void 0; - this.key = key; - this.file = file; - this.opts = options || {}; - this.cwd = file.opts.cwd; - this.filename = file.opts.filename; - this.isAsync = isAsync; - } - set(key, val) { - this._map.set(key, val); - } - get(key) { - return this._map.get(key); - } - availableHelper(name, versionRange) { - return this.file.availableHelper(name, versionRange); - } - addHelper(name) { - return this.file.addHelper(name); - } - buildCodeFrameError(node, msg, _Error) { - return this.file.buildCodeFrameError(node, msg, _Error); - } -} diff --git a/src/file-viewer/views/file-viewer.tsx b/src/file-viewer/views/file-viewer.tsx deleted file mode 100644 index c95775e..0000000 --- a/src/file-viewer/views/file-viewer.tsx +++ /dev/null @@ -1,1007 +0,0 @@ -import "./file-viewer.css"; -import assert from "node:assert"; -import path, { dirname } from "node:path"; -import { MediaFile } from "../db.ts"; -import { useInlineScript } from "../framework/page-resources.ts"; -import { escapeUri, formatDuration, formatSize } from "../media/share.ts"; -import { - highlightConvo, - highlightHashComments, - highlightLinksInTextView, -} from "../media/text-formatting.ts"; -import { TestID } from "../test/id.ts"; -import { ForEveryone } from "../media/cotyledon.tsx"; - -export const theme = { - bg: "#312652", - fg: "#f0f0ff", - primary: "#fabe32", -}; - -export const extensionToViewer: { - [key: string]: (props: { - file: MediaFile; - siblingFiles?: MediaFile[]; - }) => any; -} = { - ".html": IframeView, - ".txt": TextView, - ".md": TextView, - ".mp4": VideoView, - ".mkv": VideoView, - ".webm": VideoView, - ".avi": VideoView, - ".mov": VideoView, - ".mp3": AudioView, - ".flac": AudioView, - ".wav": AudioView, - ".ogg": AudioView, - ".m4a": AudioView, - ".jpg": ImageView, - ".jpeg": ImageView, - ".png": ImageView, - ".gif": ImageView, - ".webp": ImageView, - ".avif": ImageView, - ".heic": ImageView, - ".svg": ImageView, - ".chat": ChatView, - ".json": CodeView, - ".jsonc": CodeView, - ".toml": CodeView, - ".ts": CodeView, - ".js": CodeView, - ".tsx": CodeView, - ".jsx": CodeView, - ".css": CodeView, - ".py": CodeView, - ".lua": CodeView, - ".sh": CodeView, - ".bat": CodeView, - ".ps1": CodeView, - ".cmd": CodeView, - ".yaml": CodeView, - ".yml": CodeView, - ".xml": CodeView, - ".zig": CodeView, - ".astro": CodeView, - ".mdx": CodeView, - ".php": CodeView, - ".diff": CodeView, - ".patch": CodeView, -}; - -export default function MediaList({ - file, - hasCotyledonCookie, -}: { - file: MediaFile; - hasCotyledonCookie: boolean; -}) { - useInlineScript("file_viewer"); - - const dirs: MediaFile[] = []; - let dir: MediaFile | null = file; - assert(dir); - do { - dirs.unshift(dir); - dir = dir?.getParent(); - } while (dir); - const parts = file.path.split("/"); - - const isCotyledon = parseInt(parts[1]) < 2025; - - return ( - <div class={"files" + (isCotyledon ? " ctld ctld-" + parts[1] : "")}> - {dirs.map((entry, i) => { - const isLast = i === dirs.length - 1; - return ( - <MediaPanel - file={entry} - isLast={isLast} - activeFilename={parts[i + 1]} - hasCotyledonCookie={hasCotyledonCookie} - /> - ); - })} - </div> - ); -} - -const specialCaseViewers: Record<string, any> = { - "/2024/for everyone": ForEveryone, -}; - -export function MediaPanel({ - file, - isLast, - activeFilename, - hasCotyledonCookie, -}: { - file: MediaFile; - isLast: boolean; - activeFilename: string | null; - hasCotyledonCookie: boolean; -}) { - const showsActions = file.path !== "/2024/for everyone"; - const label = file.path === "/" - ? ( - "clo's files" - ) - : ( - <> - {file.kind === MediaFile.Kind.directory - ? ( - <span> - {file.basename} - <span class="bold-slash">/</span> - </span> - ) - : ( - <> - {file.basename} - <div style="flex:1" /> - {showsActions && ( - <div class="actions"> - <a - class="custom full-screen" - href={`/file${escapeUri(file.path)}?view=embed`} - aria-label="full screen" - > - </a> - <a - class="custom download" - href={`/file${escapeUri(file.path)}?dl`} - aria-label="download" - > - </a> - </div> - )} - </> - )} - </> - ); - let View = specialCaseViewers[file.path] ?? - (extensionToViewer[file.extension.toLowerCase()] as any) ?? - DownloadView; - if (View === VideoView && file.size > 500_000_000) { - View = DownloadViewTooBig; - } - const mobileBtn = file.path !== "/" && ( - <a - href={`/file${escapeUri(path.dirname(file.path).replace(/\/$/, ""))}`} - className="custom mobile-back" - /> - ); - const canvases: Record<string, string> = { - "/2017": "2017", - "/2018": "2018", - "/2019": "2019", - "/2020": "2020", - "/2021": "2021", - "/2022": "2022", - "/2023": "2023", - "/2024": "2024", - }; - if (canvases[file.path]) { - useInlineScript(`canvas_${canvases[file.path]}` as any); - } - return ( - <div - class={(isLast ? "panel last" : "panel") + - (file.path === "/" ? " first" : "")} - > - {canvases[file.path] && ( - <canvas - class="fullscreen-canvas" - data-canvas={canvases[file.path]} - > - </canvas> - )} - {file.kind === MediaFile.Kind.directory && ( - <a class="custom header" href={`/file${escapeUri(file.path)}`}> - <div class="ico ico-dir-open"></div> - {label} - </a> - )} - <div class="header"> - {mobileBtn} - {<div class={`ico ico-${fileIcon(file, true)}`}></div>} - {label} - </div> - - {file.kind === MediaFile.Kind.directory - ? ( - <DirView - dir={file} - activeFilename={activeFilename} - isLast={isLast} - hasCotyledonCookie={hasCotyledonCookie} - /> - ) - : ( - <div - class={`content file-view${ - View.class ? " file-view-" + View.class : "" - }`} - > - <View file={file} /> - </div> - )} - </div> - ); -} - -const readmeFile = "readme.txt"; -const priorityFiles = ["readme.txt", "index.html"]; - -function sorterFromDirSort(dirsort: string) { - const array: string[] = JSON.parse(dirsort); - if (array.length === 1 && array[0] === "a-z") { - return sortAlphabetically; - } - return (a: MediaFile, b: MediaFile) => { - const aIndex = array.indexOf(a.basename); - const bIndex = array.indexOf(b.basename); - if (bIndex == -1 && aIndex >= 0) return -1; - if (aIndex == -1 && bIndex >= 0) return 1; - if (aIndex >= 0 && bIndex >= 0) { - return aIndex - bIndex; - } - sortDefault(a, b); - }; -} - -function sortNumerically(a: MediaFile, b: MediaFile) { - const n1 = parseInt(a.basenameWithoutExt); - const n2 = parseInt(a.basenameWithoutExt); - return n1 - n2; -} - -function sortDefault(a: MediaFile, b: MediaFile) { - // First check if either file is in the priority list - const aIndex = priorityFiles.indexOf(a.basename.toLowerCase()); - const bIndex = priorityFiles.indexOf(b.basename.toLowerCase()); - - if (aIndex !== -1 && bIndex !== -1) { - // Both are priority files, sort by priority order - return aIndex - bIndex; - } else if (aIndex !== -1) { - // Only a is a priority file - return -1; - } else if (bIndex !== -1) { - // Only b is a priority file - return 1; - } - - // Then sort directories before files - if (a.kind !== b.kind) { - return a.kind === MediaFile.Kind.directory ? -1 : 1; - } - - // Finally sort by date (newest first), then by name (a-z) if dates are the same - const dateComparison = b.date.getTime() - a.date.getTime(); - if (dateComparison !== 0) { - return dateComparison; - } - // If dates are the same, sort alphabetically by name - return a.basename.localeCompare(b.basename); -} - -function sortAlphabetically(a: MediaFile, b: MediaFile) { - // First check if either file is in the priority list - const aIndex = priorityFiles.indexOf(a.basename.toLowerCase()); - const bIndex = priorityFiles.indexOf(b.basename.toLowerCase()); - - if (aIndex !== -1 && bIndex !== -1) { - // Both are priority files, sort by priority order - return aIndex - bIndex; - } else if (aIndex !== -1) { - // Only a is a priority file - return -1; - } else if (bIndex !== -1) { - // Only b is a priority file - return 1; - } - - // If dates are the same, sort alphabetically by name - return a.basename.localeCompare(b.basename); -} - -function isNumericallyOrdered(files: MediaFile[]) { - return !files.some((x) => Number.isNaN(parseInt(x.basenameWithoutExt))); -} - -function sortChronologicalStartToEnd(a: MediaFile, b: MediaFile) { - const aIndex = priorityFiles.indexOf(a.basename.toLowerCase()); - const bIndex = priorityFiles.indexOf(b.basename.toLowerCase()); - - if (aIndex !== -1 && bIndex !== -1) { - return aIndex - bIndex; - } else if (aIndex !== -1) { - return -1; - } else if (bIndex !== -1) { - return 1; - } - - const dateComparison = a.date.getTime() - b.date.getTime(); - if (dateComparison !== 0) { - return dateComparison; - } - return a.basename.localeCompare(b.basename); -} - -const sortOverrides: Record<string, (a: MediaFile, b: MediaFile) => number> = { - "/2024": sortChronologicalStartToEnd, - "/2023": sortChronologicalStartToEnd, - "/2022": sortChronologicalStartToEnd, - "/2021": sortChronologicalStartToEnd, - "/2020": sortChronologicalStartToEnd, - "/2019": sortChronologicalStartToEnd, - "/2018": sortChronologicalStartToEnd, - "/2017": sortChronologicalStartToEnd, -}; - -function DirView({ - dir, - activeFilename, - isLast, - hasCotyledonCookie, -}: { - dir: MediaFile; - activeFilename: string | null; - isLast: boolean; - hasCotyledonCookie: boolean; -}) { - if (dir.path === "/") { - return ( - <RootDirView - dir={dir} - activeFilename={activeFilename} - isLast={isLast} - hasCotyledonCookie={hasCotyledonCookie} - /> - ); - } - const isCotyledon = parseInt(dir.path.split("/")?.[1]) < 2025; - const unsortedFiles = dir - .getChildren() - .filter((f) => !f.basenameWithoutExt.startsWith("_unlisted")); - const sorter = dir.dirsort - ? sorterFromDirSort(dir.dirsort) - : isNumericallyOrdered(unsortedFiles) - ? sortNumerically - : isCotyledon - ? sortChronologicalStartToEnd - : (sortOverrides[dir.path] ?? sortDefault); - const sortedFiles = unsortedFiles.sort(sorter); - const readme = sortedFiles.find((f) => f.basename === readmeFile); - if (readme && isLast) activeFilename ||= readmeFile; - const main = ( - <div class="content primary"> - <ul> - {sortedFiles.map((file) => { - return ( - <ListItem file={file} active={activeFilename === file.basename} /> - ); - })} - </ul> - </div> - ); - - if (readme && isLast) { - return ( - <div class="hsplit"> - <ReadmeView file={readme} siblingFiles={sortedFiles} /> - {main} - </div> - ); - } - - return main; -} - -const unknownDate = new Date("1970-01-03"); -const unknownDateWithKnownYear = new Date("1970-02-20"); - -function ListItem({ - file, - active, - noDate, -}: { - file: MediaFile; - active: boolean; - noDate?: boolean; -}) { - const dateTime = file.date; - let shortDate = dateTime < unknownDateWithKnownYear - ? ( - dateTime < unknownDate - ? ( - "??.??.??" - ) - : <>xx.xx.{21 + Math.floor(dateTime.getTime() / 86400000)}</> - ) - : ( - `${(dateTime.getMonth() + 1).toString().padStart(2, "0")}.${ - dateTime - .getDate() - .toString() - .padStart(2, "0") - }.${dateTime.getFullYear().toString().slice(2)}` - ); - - let basenameWithoutExt = file.basenameWithoutExt; - - let meta = file.kind === MediaFile.Kind.directory - ? formatSize(file.size) - : (file.duration ?? 0) > 0 - ? formatDuration(file.duration!) - : null; - if (meta && dirname(file.path) !== "/") { - meta = `(${meta})`; - } - - const isReadme = file.basename === readmeFile; - - return ( - <li> - <a - class={(active ? "active " : "") + (isReadme ? "readme " : "") + - "li custom"} - href={file.extension === ".lnk" - ? file.contents - : isReadme - ? `/file${escapeUri(path.dirname(file.path).replace(/\/$/, ""))}` - : `/file${escapeUri(file.path)}`} - > - <span> - {file.basename === readmeFile - ? <>{!noDate && <div class="line"></div>}</> - : <>{!noDate && <date>{shortDate}</date>}</>} - <span class="size mobile">{meta}</span> - </span> - - <span> - {path.dirname(file.path) !== "/" && ( - <span className={`ico ico-${fileIcon(file)}`}></span> - )} - {basenameWithoutExt} - <span class="ext">{file.extension}</span> - {file.kind === MediaFile.Kind.directory - ? <span class="bold-slash">/</span> - : ( - "" - )} - - <span class="size desktop">{meta}</span> - </span> - </a> - </li> - ); -} - -function fileIcon(file: MediaFile, dirOpen?: boolean) { - if (file.kind === MediaFile.Kind.directory) { - return dirOpen ? "dir-open" : "dir"; - } - if (file.basename === "readme.txt") { - return "readme"; - } - if (file.path === "/2024/for everyone") { - return "snow"; - } - const ext = path.extname(file.basename).toLowerCase(); - if ( - ext === ".mp4" || - ext === ".mkv" || - ext === ".webm" || - ext === ".avi" || - ext === ".mov" - ) { - return "video"; - } - if ( - ext === ".mp3" || - ext === ".flac" || - ext === ".wav" || - ext === ".ogg" || - ext === ".m4a" - ) { - return "audio"; - } - if ( - ext === ".jpg" || - ext === ".jpeg" || - ext === ".png" || - ext === ".gif" || - ext === ".webp" || - ext === ".avif" || - ext === ".heic" || - ext === ".svg" - ) { - return "image"; - } - if (ext === ".comp" || ext === ".fuse" || ext === ".setting") return "fusion"; - if (ext === ".txt" || ext === ".md") return "text"; - if (ext === ".html") return "webpage"; - if (ext === ".blend") return "blend"; - if ( - ext === ".zip" || - ext === ".rar" || - ext === ".7z" || - ext === ".tar" || - ext === ".gz" || - ext === ".bz2" || - ext === ".xz" - ) { - return "archive"; - } - if (ext === ".lnk") return "link"; - if (ext === ".chat") return "chat"; - if ( - ext === ".ts" || - ext === ".js" || - ext === ".tsx" || - ext === ".jsx" || - ext === ".css" || - ext === ".py" || - ext === ".lua" || - ext === ".sh" || - ext === ".bat" || - ext === ".ps1" || - ext === ".cmd" || - ext === ".php" - ) { - return "code"; - } - if (ext === ".json" || ext === ".toml" || ext === ".yaml" || ext === ".yml") { - return "json"; - } - return "file"; -} - -function RootDirView({ - dir, - activeFilename, - isLast, - hasCotyledonCookie, -}: { - dir: MediaFile; - activeFilename: string | null; - isLast: boolean; - hasCotyledonCookie: boolean; -}) { - const children = dir.getChildren(); - let readme: MediaFile | null = null; - - const groups = { - // years 2025 and onwards - years: [] as MediaFile[], - // named categories - categories: [] as MediaFile[], - // years 2017 to 2024 - cotyledon: [] as MediaFile[], - }; - const colorMap = { - years: "#a2ff91", - categories: "#9c91ff", - cotyledon: "#ff91ca", - }; - for (const child of children) { - const basename = child.basename; - if (basename === readmeFile) { - readme = child; - continue; - } - - const year = basename.match(/^(\d{4})/); - if (year) { - const n = parseInt(year[1]); - if (n >= 2025) { - groups.years.push(child); - } else { - groups.cotyledon.push(child); - } - } else { - groups.categories.push(child); - } - } - - if (readme && isLast) activeFilename ||= readmeFile; - - const main = ( - <div class="content primary"> - {readme && ( - <ul> - <ListItem - file={readme} - active={activeFilename === readmeFile} - noDate - /> - </ul> - )} - {Object.entries(groups).map(([key, files]) => { - if (key === "cotyledon" && !hasCotyledonCookie) { - return null; - } - if (key === "years" || key === "cotyledon") { - files.sort((a, b) => { - return b.basename.localeCompare(a.basename); - }); - } else { - files.sort((a, b) => { - return a.basename.localeCompare(b.basename); - }); - } - return ( - <div class="group" data-group={key}> - <h3 style={`color:${colorMap[key as keyof typeof colorMap]};`}> - {key} - </h3> - <ul> - {files.map((file) => ( - <ListItem - file={file} - active={activeFilename === file.basename} - noDate={key === "cotyledon"} - /> - ))} - </ul> - </div> - ); - })} - </div> - ); - - if (readme && isLast) { - return ( - <div class="hsplit"> - <ReadmeView - file={readme} - siblingFiles={children} - extra={!hasCotyledonCookie && ( - <> - <a href="/file/cotyledon" class="custom cotyledon-link desktop"> - cotyledon - </a> - </> - )} - /> - {main} - {!hasCotyledonCookie && ( - <> - <a href="/file/cotyledon" class="custom cotyledon-link mobile"> - cotyledon - </a> - </> - )} - </div> - ); - } - - return main; -} - -function TextView({ - file, - siblingFiles = [], -}: { - file: MediaFile; - siblingFiles?: MediaFile[]; -}) { - const contents = file.contents; - - if (file.path.startsWith("/2021/phoenix-write/maps")) { - const basename = file.basename; - if (basename.includes("map") && basename.endsWith(".txt")) { - return ( - <pre - style="white-space:normal;max-width:73ch" - dangerouslySetInnerHTML={{ - __html: highlightHashComments(contents), - }} - ></pre> - ); - } - } - - return ( - <pre - style="white-space:pre-wrap;max-width:70ch" - dangerouslySetInnerHTML={{ - __html: highlightLinksInTextView( - contents, - siblingFiles.filter((f) => f.kind === MediaFile.Kind.file), - ), - }} - ></pre> - ); -} - -function ChatView({ file }: { file: MediaFile }) { - const contents = file.contents; - return ( - <div - style="max-width:70ch" - class="convo" - dangerouslySetInnerHTML={{ - __html: highlightConvo(contents), - }} - > - </div> - ); -} - -function CodeView({ file }: { file: MediaFile }) { - const highlightedContents = file.contents; - if (!highlightedContents) { - if (file.size > 1_000_000) { - return <DownloadViewTooBig file={file} />; - } - return <DownloadViewCodeNotComputed file={file} />; - } - return ( - <pre - style="white-space:pre-wrap" - dangerouslySetInnerHTML={{ - __html: highlightedContents, - }} - /> - ); -} - -function VideoView({ file }: { file: MediaFile }) { - useInlineScript("video_player"); - const dimensions = file.parseDimensions() ?? { width: 1920, height: 1080 }; - return ( - <> - <video - controls - preload - style={`background:transparent;aspect-ratio:${ - simplifyFraction( - dimensions.width, - dimensions.height, - ) - }`} - > - <source - src={"/file" + file.path} - type={contentTypeFromExt(file.path)} - /> - </video> - </> - ); -} - -function AudioView({ - file, - onlyAudio = false, -}: { - file: MediaFile; - onlyAudio?: boolean; -}) { - const parent = file.getParent(); - let lyricsFile: MediaFile | null = null; - if (parent && !onlyAudio) { - const siblings = parent.getChildren(); - // show lyrics only if - // - this media file is the only audio file - // - there is lyrics.txt in the same directory - const audioFiles = siblings.filter( - (f) => - f.kind === MediaFile.Kind.file && - extensionToViewer[path.extname(f.basename)] === AudioView, - ); - if ( - audioFiles.length === 1 && - siblings.find((f) => f.basename === "lyrics.txt") - ) { - lyricsFile = siblings.find((f) => f.basename === "lyrics.txt")!; - } - } - return ( - <> - <audio controls preload="none" style="width:100%;"> - <source - src={"/file" + file.path} - type={`audio/${path.extname(file.path).substring(1)}`} - /> - </audio> - {lyricsFile && ( - <div class="lyrics"> - <h2 style="margin-left:1rem;margin-bottom:-0.2rem;margin-top:0.5rem;"> - lyrics - </h2> - <TextView file={lyricsFile} siblingFiles={[]} /> - </div> - )} - </> - ); -} - -function ImageView({ file }: { file: MediaFile }) { - return ( - <img - src={"/file" + file.path} - alt={file.basename} - style="max-width:100%;max-height:100%;object-fit:contain;margin:auto;display:block;" - /> - ); -} - -function IframeView({ file }: { file: MediaFile }) { - return ( - <> - <iframe - style="flex:1;height:100%;border:none" - src={"/file" + file.path + "?view=embed"} - /> - </> - ); -} - -const helptexts: Record<string, any> = { - ".blend": ( - <p> - <code>.blend</code> files can be open in{" "} - <a href="https://www.blender.org" target="_blank"> - Blender - </a> - . - </p> - ), - ".comp": <FusionHelp ext="comp" name="composition files (project/scene)" />, - ".setting": <FusionHelp ext="setting" name="macro/template" />, - ".fuse": <FusionHelp ext="setting" name="FUSE Plugin (lua source code)" />, -}; - -function FusionHelp({ ext, name }: { ext: string; name: string }) { - return ( - <> - <p> - <code>.{ext}</code> files are{" "} - <a - href="https://www.blackmagicdesign.com/products/fusion" - target="_blank" - > - Fusion - </a>{" "} - {name}. - </p> - <p> - Blackmagic Fusion is paid-only since mid-2019 (the "Studio" version). - The last free version is Fusion 9.0.2, which exists for MacOS, Linux, - and Microsoft Windows on{" "} - <a href="https://www.blackmagicdesign.com/support" target="_blank"> - Blackmagic Design's support page - </a> - . - </p> - <p> - Alternatively, you can use DaVinci Resolve, however I do not recommend - it as it is very unstable, at least as of when I last tried version 18. - </p> - </> - ); -} -function DownloadView({ file }: { file: MediaFile }) { - const help = helptexts[path.extname(file.basename)]; - return help - ? ( - <> - {help} - <p> - File download:{" "} - <a href={"/file" + file.path + "?dl"} aria-label="download"> - {file.basename} - </a> - . - </p> - </> - ) - : ( - <> - <p> - No built-in viewer for <code>{path.extname(file.basename)}</code>{" "} - files. - </p> - <p> - Instead, you may download it:{" "} - <a href={"/file" + file.path + "?dl"} aria-label="download"> - {file.basename} - </a> - . - </p> - </> - ); -} - -function DownloadViewTooBig({ file }: { file: MediaFile }) { - return ( - <div style="padding:0.5rem"> - <p> - This file is too large to view in the browser right now ( - <code>{formatSize(file.size)}</code>). Later, this file viewer will - properly process video files for web streaming. - </p> - <p> - Instead, you may download it:{" "} - <a href={"/file" + file.path + "?dl"} aria-label="download"> - {file.basename} - </a> - . - </p> - </div> - ); -} - -function DownloadViewCodeNotComputed({ file }: { file: MediaFile }) { - return ( - <div style="padding:0.5rem"> - <p> - This file has not been pre-processed for code highlighting. This either - means it is not a valid UTF-8 text file (<code>.ts</code>{" "} - can be TypeScript or an MPEG "Transport Stream"), or there is a bug in - the file indexing logic. - </p> - <p> - Instead, you may download it:{" "} - <a href={"/file" + file.path + "?dl"} aria-label="download"> - {file.basename} - </a> - . - </p> - </div> - ); -} - -function ReadmeView({ - file, - siblingFiles, - extra, -}: { - file: MediaFile; - siblingFiles: MediaFile[]; - extra?: any; -}) { - // let showFileCandidates = siblingFiles.filter(f => - // f.kind === MediaFile.Kind.file - // && (extensionToViewer[path.extname(f.basename)] === AudioView - // || extensionToViewer[path.extname(f.basename)] === VideoView) - // ); - return ( - <div class="content readme" data-testid={TestID.Readme}> - {/* {showFileCandidates.length === 1 && <AudioView file={showFileCandidates[0]} onlyAudio />} */} - <TextView file={file} siblingFiles={siblingFiles} /> - {extra} - </div> - ); -} - -const gcd = (a: number, b: number): number => (b ? gcd(b, a % b) : a); -function simplifyFraction(n: number, d: number) { - const divisor = gcd(n, d); - return `${n / divisor}/${d / divisor}`; -} - -export function contentTypeFromExt(src: string) { - src = src.toLowerCase(); - if (src.endsWith(".m3u8")) return "application/x-mpegURL"; - if (src.endsWith(".webm")) return "video/webm"; - if (src.endsWith(".mp4")) return "video/mp4"; - if (src.endsWith(".mkv")) return "video/x-matroska"; - if (src.endsWith(".avi")) return "video/x-msvideo"; - if (src.endsWith(".mov")) return "video/quicktime"; - if (src.endsWith(".ogg")) return "video/ogg"; - throw new Error("Unknown video extension: " + path.extname(src)); -} - -// Add class properties to the components -AudioView.class = "audio"; -ImageView.class = "image"; -VideoView.class = "video"; -TextView.class = "text"; -DownloadView.class = "download"; -CodeView.class = "code"; diff --git a/src/pages/subscribe.client.ts b/src/pages/subscribe.client.ts deleted file mode 100644 index 3cf9a15..0000000 Binary files a/src/pages/subscribe.client.ts and /dev/null differ diff --git a/src/pages/subscribe.css b/src/pages/subscribe.css deleted file mode 100644 index 41d901e..0000000 --- a/src/pages/subscribe.css +++ /dev/null @@ -1,8 +0,0 @@ -// default -class ConfigError extends Error { - constructor(message, filename) { - super(message); - (0, _rewriteStackTrace.expectedError)(this); - if (filename) (0, _rewriteStackTrace.injectVirtualStackFrame)(this, filename); - } -} diff --git a/src/pages/subscribe.marko b/src/pages/subscribe.marko deleted file mode 100644 index 00824eb..0000000 Binary files a/src/pages/subscribe.marko and /dev/null differ diff --git a/src/q+a/artifacts.ts b/src/q+a/artifacts.ts deleted file mode 100644 index fbfff18..0000000 Binary files a/src/q+a/artifacts.ts and /dev/null differ diff --git a/src/q+a/components/clickable-links.client.ts b/src/q+a/components/clickable-links.client.ts index db78111..549e457 100644 --- a/src/q+a/components/clickable-links.client.ts +++ b/src/q+a/components/clickable-links.client.ts @@ -1,126 +1,57 @@ -// __esModule -true - -// importDefault -function importDefault(file, request, nameHint) { - const imports = getImports(file); - request = resolveRelativePath(file, request); - let importDeclaration = imports.get(request); - - if (!importDeclaration) { - imports.set( - request, - importDeclaration = file.path.pushContainer( - "body", - _compiler.types.importDeclaration([], _compiler.types.stringLiteral(request)) - )[0] - ); +async function qaDate(el: HTMLAnchorElement) { + if (el.hasAttribute("data-copy-state")) return; + const time = el.children[0] as HTMLTimeElement; + const prevText = time.textContent; + const url = `${window.location.origin}/q+a/${ + time.dateTime.replace(/[^\d]/g, "").slice(2, 12) + }`; + el.setAttribute("data-copy-state", "1"); + try { + await navigator.clipboard.writeText(url); + time.textContent = "copied permalink to question"; + time.classList.add("winner"); + } catch (error) { + time.textContent = "failed to copy :("; } - - if (!nameHint) { - return; - } - - const specifiers = importDeclaration.get("specifiers"); - const specifier = specifiers.find((specifier) => - specifier.isImportDefaultSpecifier() + setTimeout(() => { + el.removeAttribute("data-copy-state"); + time.textContent = prevText; + time.classList.remove("winner"); + }, 1500); +} +requestAnimationFrame(() => { + // Make every link clickable + document.querySelectorAll("e-").forEach((questionRoot) => + (questionRoot.querySelector("a:not([href])") as HTMLAnchorElement).href = + "#" ); - - if (!specifier) { - const identifier = file.scope.generateUidIdentifier(nameHint); - importDeclaration.pushContainer( - "specifiers", - _compiler.types.importDefaultSpecifier(identifier) - ); - return identifier; - } - - return _compiler.types.identifier(specifier.node.local.name); -} - -// importNamed -function importNamed(file, request, name, nameHint = name) { - request = resolveRelativePath(file, request); - const imports = getImports(file); - let importDeclaration = imports.get(request); - - if (!importDeclaration) { - imports.set( - request, - importDeclaration = file.path.pushContainer( - "body", - _compiler.types.importDeclaration([], _compiler.types.stringLiteral(request)) - )[0] - ); - } - - const specifiers = importDeclaration.get("specifiers"); - const specifier = specifiers.find( - (specifier) => - specifier.isImportSpecifier() && specifier.node.imported.name === name + // Avoid attaching 1500+ event listeners + document.querySelector("main")!.addEventListener( + "click", + (event, element = event.target as HTMLAnchorElement) => { + if ( + !(event.button || + event.which != 1 || + event.metaKey || + event.ctrlKey || + event.shiftKey || + event.altKey || + event.defaultPrevented) + ) { + while (element && element !== document.body) { + if ( + element.nodeName.toUpperCase() === "A" && + element.getAttribute("href") === "#" && + element.parentElement?.tagName === "E-" + ) { + event.preventDefault(); + qaDate(element); + return; + } + element = + (element.assignedSlot ?? element.parentNode) as HTMLAnchorElement; + } + } + }, ); - - if (!specifier) { - const identifier = file.scope.generateUidIdentifier(nameHint); - importDeclaration.pushContainer( - "specifiers", - _compiler.types.importSpecifier(identifier, _compiler.types.identifier(name)) - ); - return identifier; - } - - return _compiler.types.identifier(specifier.node.local.name); -} - -// importStar -function importStar(file, request, nameHint) { - const imports = getImports(file); - request = resolveRelativePath(file, request); - let importDeclaration = imports.get(request); - - if (!importDeclaration) { - imports.set( - request, - importDeclaration = file.path.pushContainer( - "body", - _compiler.types.importDeclaration([], _compiler.types.stringLiteral(request)) - )[0] - ); - } - - if (!nameHint) { - return; - } - - const specifiers = importDeclaration.get("specifiers"); - const specifier = specifiers.find((specifier) => - specifier.isImportNamespaceSpecifier() - ); - - if (!specifier) { - const identifier = file.scope.generateUidIdentifier(nameHint); - importDeclaration.pushContainer( - "specifiers", - _compiler.types.importNamespaceSpecifier(identifier) - ); - return identifier; - } - - return _compiler.types.identifier(specifier.node.local.name); -} - -// resolveRelativePath -function resolveRelativePath(file, request) { - if (request.startsWith(FS_START)) { - request = (0, _relativeImportPath.relativeImportPath)(file.opts.filename, request); - } - - if (file.markoOpts.optimize) { - request = request.replace( - /(^|\/node-modules\/)marko\/src\//, - "$1marko/dist/" - ); - } - - return request; -} +}); diff --git a/src/q+a/edit-frontend.tsx b/src/q+a/edit-frontend.tsx deleted file mode 100644 index c255694..0000000 --- a/src/q+a/edit-frontend.tsx +++ /dev/null @@ -1,8 +0,0 @@ -// default -function prependToMemberExpression(member, prepend) { - if ((0, _index2.isSuper)(member.object)) { - throw new Error("Cannot prepend node to super property access (`super.foo`)."); - } - member.object = (0, _index.memberExpression)(prepend, member.object); - return member; -} diff --git a/src/q+a/format.ts b/src/q+a/format.ts deleted file mode 100644 index cab4058..0000000 Binary files a/src/q+a/format.ts and /dev/null differ diff --git a/src/q+a/question-image.tsx b/src/q+a/question-image.tsx deleted file mode 100644 index 5889f0e..0000000 Binary files a/src/q+a/question-image.tsx and /dev/null differ diff --git a/tsconfig.json b/tsconfig.json index 9782905..e3093bf 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,35 +1,13 @@ -// default -function getFunctionName(node, parent) { - if ("id" in node && node.id) { - return { - name: node.id.name, - originalNode: node.id - }; - } - let prefix = ""; - let id; - if ((0, _index.isObjectProperty)(parent, { - value: node - })) { - id = getObjectMemberKey(parent); - } else if ((0, _index.isObjectMethod)(node) || (0, _index.isClassMethod)(node)) { - id = getObjectMemberKey(node); - if (node.kind === "get") prefix = "get ";else if (node.kind === "set") prefix = "set "; - } else if ((0, _index.isVariableDeclarator)(parent, { - init: node - })) { - id = parent.id; - } else if ((0, _index.isAssignmentExpression)(parent, { - operator: "=", - right: node - })) { - id = parent.left; - } - if (!id) return null; - const name = (0, _index.isLiteral)(id) ? getNameFromLiteralId(id) : (0, _index.isIdentifier)(id) ? id.name : (0, _index.isPrivateName)(id) ? id.id.name : null; - if (name == null) return null; - return { - name: prefix + name, - originalNode: id - }; +{ + "allowImportingTSExtensions": true, + "baseDir": ".", + "incremental": true, + "lib": ["dom", "esnext"], + "moduleResolution": "node18", + "outdir": ".clover/ts", + "paths": { "@/*": ["src/*"] }, + "strict": true, + "target": "es2022", + "jsxImportSource": "#ssr", + "jsx": "react-jsx", }