brumate 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{boot-BkUdiYOF.d.ts → boot-ej-9NRT3.d.ts} +20 -2
- package/dist/cli.js +88 -82
- package/dist/cli.js.map +1 -1
- package/dist/{client-B0FXW5Kw.js → client-B-ww-PQ7.js} +402 -63
- package/dist/client-B-ww-PQ7.js.map +1 -0
- package/dist/{client-Cq6aTiDs.d.ts → client-Do6IBIhI.d.ts} +58 -14
- package/dist/{defer-BMIMP4Hq.js → defer-JD2FK9mV.js} +5 -3
- package/dist/defer-JD2FK9mV.js.map +1 -0
- package/dist/{devtools-calls-DGW6nLZ2.js → devtools-calls-DCjuSkim.js} +3 -3
- package/dist/{devtools-calls-DGW6nLZ2.js.map → devtools-calls-DCjuSkim.js.map} +1 -1
- package/dist/{devtools-panel-B1nF1KB7.js → devtools-panel-DLeWTPhU.js} +4 -4
- package/dist/{devtools-panel-B1nF1KB7.js.map → devtools-panel-DLeWTPhU.js.map} +1 -1
- package/dist/{devtools-B4prrxht.js → devtools-tuq7ATGN.js} +10 -7
- package/dist/devtools-tuq7ATGN.js.map +1 -0
- package/dist/{error-catalog-DakxjSgj.js → error-catalog-BBWB7w-E.js} +11 -4
- package/dist/error-catalog-BBWB7w-E.js.map +1 -0
- package/dist/{error-catalog-VxLbz-6p.js → error-catalog-CbmQqfat.js} +1 -1
- package/dist/{events-LgLdp1R7.js → events-BDVITj3P.js} +3 -5
- package/dist/events-BDVITj3P.js.map +1 -0
- package/dist/{features-DwMYKBIC.js → features-Cte5aj20.js} +8 -2
- package/dist/features-Cte5aj20.js.map +1 -0
- package/dist/{files-D5GtxwEQ.js → files-Bz0lAQzD.js} +2 -2
- package/dist/{files-D5GtxwEQ.js.map → files-Bz0lAQzD.js.map} +1 -1
- package/dist/{html-Cf5uKhLs.js → html-BYuHDvxy.js} +10 -3
- package/dist/html-BYuHDvxy.js.map +1 -0
- package/dist/index.d.ts +71 -19
- package/dist/index.js +3 -3
- package/dist/{inspect-CGl5Y8q6.js → inspect-fpaBJ5pm.js} +1305 -75
- package/dist/inspect-fpaBJ5pm.js.map +1 -0
- package/dist/{loader-BsaSuIoG.js → loader-DMxuZ6He.js} +14 -6
- package/dist/loader-DMxuZ6He.js.map +1 -0
- package/dist/{navigate-BlowKvhB.js → navigate-C5PjwYMh.js} +108 -20
- package/dist/navigate-C5PjwYMh.js.map +1 -0
- package/dist/{produce-CLABZ8k2.d.ts → produce-BDkCsGH7.d.ts} +3 -3
- package/dist/{rpc-C1jYVNAe.js → rpc-DOdrekhP.js} +23 -13
- package/dist/rpc-DOdrekhP.js.map +1 -0
- package/dist/runtime/bundles.d.ts +3 -2
- package/dist/runtime/bundles.js +20 -5
- package/dist/runtime/bundles.js.map +1 -1
- package/dist/runtime/client.d.ts +4 -3
- package/dist/runtime/client.js +5 -5
- package/dist/runtime/devtools.d.ts +3 -1
- package/dist/runtime/devtools.js +1 -1
- package/dist/runtime/events.js +1 -1
- package/dist/runtime/hot.d.ts +1 -1
- package/dist/runtime/html.js +1 -1
- package/dist/runtime/loader.d.ts +2 -2
- package/dist/runtime/loader.js +2 -2
- package/dist/runtime/otel.d.ts +18 -0
- package/dist/runtime/otel.js +127 -0
- package/dist/runtime/otel.js.map +1 -0
- package/dist/runtime/server.d.ts +4 -3
- package/dist/runtime/server.js +5 -5
- package/dist/runtime/signals.d.ts +2 -2
- package/dist/runtime/signals.js +4 -1
- package/dist/runtime/signals.js.map +1 -1
- package/dist/runtime/static-loader.d.ts +2 -2
- package/dist/runtime/static-loader.js +1 -1
- package/dist/runtime/store.d.ts +2 -2
- package/dist/runtime/store.js +1 -1
- package/dist/runtime/testing.d.ts +2 -2
- package/dist/runtime/testing.js +2 -2
- package/dist/search-params-qGERTLi3.js +382 -0
- package/dist/search-params-qGERTLi3.js.map +1 -0
- package/dist/{serial-ribg9NAj.js → serial-B2AJ9VGx.js} +1 -1
- package/dist/{serial-ioa17MuY.js → serial-Cj6pDGOq.js} +6 -6
- package/dist/{serial-ioa17MuY.js.map → serial-Cj6pDGOq.js.map} +1 -1
- package/dist/{server-DesBZv5g.d.ts → server-2-LS_KFo.d.ts} +125 -9
- package/dist/{server-BUuf7XPZ.js → server-CRGZMWnK.js} +545 -236
- package/dist/server-CRGZMWnK.js.map +1 -0
- package/dist/{shared-CX_YacDm.js → shared-CUBWrbiM.js} +4 -4
- package/dist/{shared-CX_YacDm.js.map → shared-CUBWrbiM.js.map} +1 -1
- package/dist/sheets-B9Zr50mf.js +105 -0
- package/dist/sheets-B9Zr50mf.js.map +1 -0
- package/dist/{signals-7VVD9C_H.d.ts → signals-BgsJK-uT.d.ts} +16 -6
- package/dist/{static-loader-C_en-4v8.js → static-loader-BDBtWsdg.js} +107 -19
- package/dist/static-loader-BDBtWsdg.js.map +1 -0
- package/dist/{static-loader-UKnK11Em.d.ts → static-loader-CAFn6p0l.d.ts} +2 -2
- package/dist/{store-9_oa0HG1.d.ts → store-BwWg-Iei.d.ts} +79 -2
- package/dist/store-DNr24Z8L.js +950 -0
- package/dist/store-DNr24Z8L.js.map +1 -0
- package/dist/{stream-read-BTsYstJY.js → stream-read-CiLDH60b.js} +2 -2
- package/dist/{stream-read-BTsYstJY.js.map → stream-read-CiLDH60b.js.map} +1 -1
- package/dist/{stream-read-Dek3HnqO.js → stream-read-DVoregpA.js} +1 -1
- package/dist/trace-DT7RGRAV.d.ts +52 -0
- package/dist/trace-browser-C7MFMove.js +170 -0
- package/dist/trace-browser-C7MFMove.js.map +1 -0
- package/dist/trace-flag-Dy267snx.js +7 -0
- package/dist/trace-flag-Dy267snx.js.map +1 -0
- package/dist/{trusted-g_zUJbh2.js → trusted-Bmwg4_hf.js} +12 -5
- package/dist/trusted-Bmwg4_hf.js.map +1 -0
- package/dist/view-transitions-BpnVwtS4.js +141 -0
- package/dist/view-transitions-BpnVwtS4.js.map +1 -0
- package/dist/vite.d.ts +8 -1
- package/dist/vite.js +356 -46
- package/dist/vite.js.map +1 -1
- package/elements.d.ts +8 -0
- package/package.json +13 -1
- package/skills/brumate/SKILL.md +9 -5
- package/skills/brumate/references/errors.md +95 -14
- package/skills/brumate/references/events.md +27 -1
- package/skills/brumate/references/signals.md +4 -4
- package/skills/brumate/references/state.md +79 -4
- package/skills/brumate/references/syntax.md +58 -9
- package/dist/client-B0FXW5Kw.js.map +0 -1
- package/dist/defer-BMIMP4Hq.js.map +0 -1
- package/dist/devtools-B4prrxht.js.map +0 -1
- package/dist/error-catalog-DakxjSgj.js.map +0 -1
- package/dist/events-LgLdp1R7.js.map +0 -1
- package/dist/features-DwMYKBIC.js.map +0 -1
- package/dist/html-Cf5uKhLs.js.map +0 -1
- package/dist/inspect-CGl5Y8q6.js.map +0 -1
- package/dist/loader-BsaSuIoG.js.map +0 -1
- package/dist/navigate-BlowKvhB.js.map +0 -1
- package/dist/rpc-C1jYVNAe.js.map +0 -1
- package/dist/search-params-Wg-0FsMj.js +0 -148
- package/dist/search-params-Wg-0FsMj.js.map +0 -1
- package/dist/server-BUuf7XPZ.js.map +0 -1
- package/dist/static-loader-C_en-4v8.js.map +0 -1
- package/dist/store-Cy4EEyZ7.js +0 -439
- package/dist/store-Cy4EEyZ7.js.map +0 -1
- package/dist/trusted-g_zUJbh2.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files-D5GtxwEQ.js","names":[],"sources":["../src/packages.ts","../src/server-files.ts","../src/files.ts"],"sourcesContent":["// Packages of components. A dependency of the app whose package.json has a\n// `brumate` field ships `.brm` files, `.brm.ts` modules and `'use server'`\n// files as source, and the plugin of the app compiles them with its own files.\n\nimport { existsSync, readFileSync, realpathSync, statSync } from 'node:fs';\nimport path from 'node:path';\n\n/** A dependency of the app that ships `.brm` files. */\nexport interface BrumatePackage {\n /** The name of the package, such as `@acme/ui`. */\n name: string;\n version: string;\n /** The real path of the directory of the package, with forward slashes. */\n root: string;\n /** The directories to search for files, as absolute paths with forward slashes. */\n directories: string[];\n /**\n * The prefix of the names of its files, which their IDs come from: the\n * name of the package, and its version when the app has two versions.\n */\n prefix: string;\n /** True when the package is not inside `node_modules`, such as a workspace package. */\n linked: boolean;\n}\n\ninterface PackageJson {\n name?: string;\n version?: string;\n brumate?: unknown;\n exports?: unknown;\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n optionalDependencies?: Record<string, string>;\n peerDependencies?: Record<string, string>;\n}\n\nfunction toPosix(file: string): string {\n return file.split(path.sep).join('/');\n}\n\nfunction readJson(file: string): PackageJson | undefined {\n try {\n return JSON.parse(readFileSync(file, 'utf8')) as PackageJson;\n } catch {\n return undefined;\n }\n}\n\n/** The real directory of a package that code in `from` can import, or undefined. */\nexport function findPackageDirectory(name: string, from: string): string | undefined {\n for (let directory = from; ; directory = path.dirname(directory)) {\n const candidate = path.join(directory, 'node_modules', name);\n if (existsSync(path.join(candidate, 'package.json'))) {\n return toPosix(realpathSync(candidate));\n }\n if (path.dirname(directory) === directory) {\n return undefined;\n }\n }\n}\n\n/** The directory of the nearest package.json at or above a directory. */\nfunction packageRoot(directory: string): string | undefined {\n for (let current = directory; ; current = path.dirname(current)) {\n if (existsSync(path.join(current, 'package.json'))) {\n return current;\n }\n if (path.dirname(current) === current) {\n return undefined;\n }\n }\n}\n\n/** The version of the `brumate` field that this version of brumate reads. */\nexport const PACKAGE_FORMAT = 1;\n\n/** The directories that the `brumate` field names, or undefined when the package does not opt in. */\nfunction readDirectories(root: string, field: unknown, name: string): string[] | undefined {\n if (field === true) {\n return [root];\n }\n if (typeof field === 'object' && field !== null) {\n const { dir, version = PACKAGE_FORMAT } = field as {\n dir?: string | string[];\n version?: number;\n };\n if (version !== PACKAGE_FORMAT) {\n throw new Error(\n `The package ${name} has \"brumate\": { \"version\": ${version} }, but this version of brumate reads version ${PACKAGE_FORMAT}. Install a version of ${name} or of brumate that matches.`,\n );\n }\n if (dir === undefined) {\n return [root];\n }\n const directories: string[] = [];\n for (const item of Array.isArray(dir) ? dir : [dir]) {\n directories.push(toPosix(path.resolve(root, item)));\n }\n return directories;\n }\n return undefined;\n}\n\n/**\n * Finds the dependencies of the app at `root` that ship `.brm` files, and\n * theirs. The app's dependencies come from its package.json: `dependencies`,\n * `devDependencies`, `optionalDependencies` and `peerDependencies`. A package\n * opts in with `\"brumate\": true`, or `\"brumate\": { \"dir\": \"src\" }` to search\n * only that directory. Symbolic links, such as those of pnpm, resolve to the\n * real directory.\n */\nexport function findPackages(root: string): BrumatePackage[] {\n const app = packageRoot(path.resolve(root));\n if (!app) {\n return [];\n }\n const found = new Map<string, Omit<BrumatePackage, 'prefix'>>();\n function visit(directory: string, json: PackageJson, own: boolean): void {\n const names = new Set([\n ...Object.keys(json.dependencies ?? {}),\n ...Object.keys(json.optionalDependencies ?? {}),\n ...Object.keys(json.peerDependencies ?? {}),\n // The dev dependencies of a package are its own tools, not part of what it ships.\n ...(own ? Object.keys(json.devDependencies ?? {}) : []),\n ]);\n for (const name of [...names].toSorted()) {\n const real = findPackageDirectory(name, directory);\n if (!real || found.has(real)) {\n continue;\n }\n const dependency = readJson(`${real}/package.json`);\n const directories = dependency && readDirectories(real, dependency.brumate, name);\n if (!dependency || !directories) {\n continue;\n }\n found.set(real, {\n name: dependency.name ?? name,\n version: dependency.version ?? '0.0.0',\n root: real,\n directories,\n linked: !real.includes('/node_modules/'),\n });\n visit(real, dependency, false);\n }\n }\n visit(app, readJson(path.join(app, 'package.json')) ?? {}, true);\n const list = [...found.values()];\n // Two versions of one package get IDs apart. Copies of one version share theirs, as their files are the same.\n const versions = new Map<string, Set<string>>();\n for (const item of list) {\n versions.set(item.name, (versions.get(item.name) ?? new Set()).add(item.version));\n }\n const result: BrumatePackage[] = [];\n for (const item of list) {\n result.push(\n Object.assign(item, {\n prefix: versions.get(item.name)!.size > 1 ? `${item.name}@${item.version}` : item.name,\n }),\n );\n }\n return result;\n}\n\n/** An installed package that can export a bridge. */\nexport interface BridgePackage {\n /** The name in bridge names: the package name, with `@<version>` when two copies share it. */\n name: string;\n /** The package name. */\n package: string;\n /** The real directory of the package. */\n root: string;\n /**\n * The installed dependencies and peers it imports, other than brumate. The package is not\n * prebundled, so Vite prebundles these through it (`<package> > <dependency>`), which turns\n * CommonJS into ESM.\n */\n dependencies: string[];\n}\n\n/**\n * Finds the dependencies of the app, by the walk of `findPackages`, that can export a `bridge`\n * without shipping `.brm` files: those that list `brumate` in `dependencies` or\n * `peerDependencies`. A package with the `brumate` field is a package of components, which\n * `findPackages` returns. The walk goes on into both kinds, never into other packages.\n */\nexport function findBridgePackages(root: string): BridgePackage[] {\n const app = packageRoot(path.resolve(root));\n if (!app) {\n return [];\n }\n const seen = new Set<string>();\n function visit(directory: string, json: PackageJson, own: boolean): void {\n const names = new Set([\n ...Object.keys(json.dependencies ?? {}),\n ...Object.keys(json.optionalDependencies ?? {}),\n ...Object.keys(json.peerDependencies ?? {}),\n ...(own ? Object.keys(json.devDependencies ?? {}) : []),\n ]);\n for (const name of [...names].toSorted()) {\n const real = findPackageDirectory(name, directory);\n if (!real || seen.has(real) || name === 'brumate') {\n continue;\n }\n seen.add(real);\n const dependency = readJson(`${real}/package.json`);\n if (!dependency) {\n continue;\n }\n const components = readDirectories(real, dependency.brumate, name) !== undefined;\n const wants =\n 'brumate' in (dependency.dependencies ?? {}) ||\n 'brumate' in (dependency.peerDependencies ?? {});\n if (!components && !wants) {\n continue;\n }\n if (!components) {\n const imports: string[] = [];\n const listed = new Set([\n ...Object.keys(dependency.dependencies ?? {}),\n ...Object.keys(dependency.optionalDependencies ?? {}),\n ...Object.keys(dependency.peerDependencies ?? {}),\n ]);\n for (const item of [...listed].toSorted()) {\n // Type packages have no code to prebundle.\n if (\n item !== 'brumate' &&\n !item.startsWith('@types/') &&\n findPackageDirectory(item, real)\n ) {\n imports.push(item);\n }\n }\n found.push({\n name: dependency.name ?? name,\n package: name,\n version: dependency.version,\n root: real,\n dependencies: imports,\n });\n }\n visit(real, dependency, false);\n }\n }\n const found: (BridgePackage & { version?: string })[] = [];\n visit(app, readJson(path.join(app, 'package.json')) ?? {}, true);\n return nameBridgePackages(found);\n}\n\n/**\n * Gives each package a name of its own. Two installed copies of one package, such as two\n * versions in nested `node_modules`, get `@<version>`. Two copies of one version cannot be told\n * apart on every machine, so they throw, since their bridges would share one page state.\n */\nfunction nameBridgePackages(found: (BridgePackage & { version?: string })[]): BridgePackage[] {\n const counts = new Map<string, number>();\n for (const item of found) {\n counts.set(item.name, (counts.get(item.name) ?? 0) + 1);\n }\n const result: BridgePackage[] = [];\n const roots = new Map<string, string>();\n for (const item of found) {\n const name = counts.get(item.name)! > 1 ? `${item.name}@${item.version ?? ''}` : item.name;\n const other = roots.get(name);\n if (other !== undefined) {\n throw new Error(\n `brumate: two installed copies of ${name} export bridges, at ${other} and ${item.root}. ` +\n 'Their bridges would share one name in the page state. Dedupe the package.',\n );\n }\n roots.set(name, item.root);\n result.push({\n name,\n package: item.package,\n root: item.root,\n dependencies: item.dependencies,\n });\n }\n return result;\n}\n\n/** The package that a file belongs to, or undefined for a file of the app. */\nexport function findPackage(packages: BrumatePackage[], file: string): BrumatePackage | undefined {\n for (const item of packages) {\n if (file.startsWith(`${item.root}/`)) {\n return item;\n }\n }\n return undefined;\n}\n\n/**\n * The name of a file of a package, which its IDs come from: the prefix of\n * the package and the path of the file in it, such as `@acme/ui/src/Button.brm`.\n * It is the same wherever the package is installed.\n */\nexport function packageFileName(item: BrumatePackage, file: string): string {\n return `${item.prefix}/${file.slice(item.root.length + 1)}`;\n}\n\n/** The name and the subpath of a bare specifier, such as `@acme/ui` and `./Button.brm`. */\nexport function splitSpecifier(specifier: string): { name: string; subpath: string } | undefined {\n if (specifier.startsWith('.') || specifier.startsWith('/') || /^[a-z]+:/i.test(specifier)) {\n return undefined;\n }\n const parts = specifier.split('/');\n const count = specifier.startsWith('@') ? 2 : 1;\n if (parts.length < count) {\n return undefined;\n }\n for (const part of parts.slice(0, count)) {\n if (part === '') {\n return undefined;\n }\n }\n const rest = parts.slice(count).join('/');\n return { name: parts.slice(0, count).join('/'), subpath: rest ? `./${rest}` : '.' };\n}\n\n/** The conditions of `exports` that a `.brm` file or a source module can be under. */\nconst CONDITIONS = new Set(['brumate', 'import', 'module', 'node', 'browser', 'default']);\n\nfunction resolveTarget(target: unknown, star: string): string | undefined {\n if (typeof target === 'string') {\n return target.replaceAll('*', star);\n }\n if (Array.isArray(target)) {\n for (const item of target) {\n const result = resolveTarget(item, star);\n if (result) {\n return result;\n }\n }\n return undefined;\n }\n if (typeof target === 'object' && target !== null) {\n for (const [condition, value] of Object.entries(target)) {\n if (CONDITIONS.has(condition)) {\n const result = resolveTarget(value, star);\n if (result) {\n return result;\n }\n }\n }\n }\n return undefined;\n}\n\n/** Resolves a subpath through the `exports` of a package.json, or undefined if it does not export it. */\nexport function resolveExports(exports: unknown, subpath: string): string | undefined {\n let hasSubpaths = false;\n if (typeof exports === 'object' && exports !== null && !Array.isArray(exports)) {\n for (const key of Object.keys(exports)) {\n if (key.startsWith('.')) {\n hasSubpaths = true;\n break;\n }\n }\n }\n const map = hasSubpaths ? (exports as Record<string, unknown>) : { '.': exports };\n if (subpath in map) {\n return resolveTarget(map[subpath], '');\n }\n // The pattern with the longest prefix wins, as in Node.\n let best: { key: string; star: string } | undefined;\n for (const key of Object.keys(map)) {\n const index = key.indexOf('*');\n if (index === -1) {\n continue;\n }\n const before = key.slice(0, index);\n const after = key.slice(index + 1);\n if (\n subpath.startsWith(before) &&\n subpath.endsWith(after) &&\n subpath.length >= key.length - 1 &&\n (!best || before.length > best.key.indexOf('*'))\n ) {\n best = { key, star: subpath.slice(before.length, subpath.length - after.length) };\n }\n }\n return best && resolveTarget(map[best.key], best.star);\n}\n\n/**\n * Resolves a bare specifier, such as `@acme/ui/Button.brm`, to the real path\n * of the file, through the `exports` of the package. Returns undefined when\n * it is not a bare specifier or names no file.\n */\nexport function resolvePackageImport(specifier: string, importer: string): string | undefined {\n const split = splitSpecifier(specifier);\n if (!split) {\n return undefined;\n }\n const directory = findPackageDirectory(split.name, path.dirname(importer));\n if (!directory) {\n return undefined;\n }\n const json = readJson(`${directory}/package.json`);\n const target =\n json?.exports === undefined ? split.subpath : resolveExports(json.exports, split.subpath);\n if (!target) {\n return undefined;\n }\n const file = path.resolve(directory, target);\n return existsSync(file) ? toPosix(realpathSync(file)) : undefined;\n}\n\n/**\n * Resolves a bare specifier like `resolvePackageImport`, but only for a\n * package of components in the list. Returns undefined for any other package.\n */\nexport function resolveComponentPackage(\n packages: BrumatePackage[],\n specifier: string,\n importer: string,\n): string | undefined {\n const name = splitSpecifier(specifier)?.name;\n for (const item of packages) {\n if (item.name === name) {\n return resolvePackageImport(specifier, importer);\n }\n }\n return undefined;\n}\n\n/** The specifiers that a file imports or exports from, found by a pattern, so it can only find more. */\nexport function importSpecifiers(source: string): string[] {\n const result: string[] = [];\n for (const match of source.matchAll(/(?:\\bfrom|\\bimport\\s*\\(?)\\s*(['\"])([^'\"\\n]+)\\1/g)) {\n result.push(match[2]!);\n }\n return result;\n}\n\n/** The extensions that an import without one can name. */\nconst EXTENSIONS = ['', '.ts', '.tsx', '.js', '.mjs', '/index.ts', '/index.js'];\n\n/**\n * The files of packages that the app reaches: the files of packages that\n * files of the app import, and the files of packages that those import, and\n * so on. Only these become server functions of the app.\n */\nexport function reachableFiles(\n packages: BrumatePackage[],\n appFiles: string[],\n read: (file: string) => string | undefined,\n): Set<string> {\n const reached = new Set<string>();\n const names = new Set<string>();\n for (const item of packages) {\n names.add(item.name);\n }\n const pending: string[] = [];\n function add(file: string | undefined): void {\n if (file && !reached.has(file) && findPackage(packages, file)) {\n reached.add(file);\n pending.push(file);\n }\n }\n function resolve(specifier: string, importer: string): string | undefined {\n if (specifier.startsWith('.')) {\n const stem = path.resolve(path.dirname(importer), specifier.split('?')[0]!);\n for (const extension of EXTENSIONS) {\n const candidate = stem + extension;\n if (statSync(candidate, { throwIfNoEntry: false })?.isFile()) {\n return toPosix(realpathSync(candidate));\n }\n }\n return undefined;\n }\n const name = splitSpecifier(specifier)?.name;\n return name && names.has(name)\n ? resolvePackageImport(specifier.split('?')[0]!, importer)\n : undefined;\n }\n function visit(file: string, own: boolean): void {\n const source = read(file);\n if (source === undefined) {\n return;\n }\n for (const specifier of importSpecifiers(source)) {\n // A file of the app reaches a package only by its name.\n if (own && specifier.startsWith('.')) {\n continue;\n }\n try {\n add(resolve(specifier, file));\n } catch {\n // A path that is not a file, such as a directory, reaches nothing.\n }\n }\n }\n for (const file of appFiles) {\n visit(file, true);\n }\n while (pending.length > 0) {\n visit(pending.pop()!, false);\n }\n return reached;\n}\n","// Files of server functions. A `.ts` or `.js` file whose first statement is\n// `'use server'` holds functions that only run on the server. Its exports are\n// server functions: the browser gets a stub for each one, which calls the\n// server, and the code of the file never ships.\n\nimport { existsSync, readFileSync } from 'node:fs';\nimport path from 'node:path';\nimport { parseSync } from 'oxc-parser';\nimport type { BrumatePackage } from './packages.ts';\nimport { resolveComponentPackage } from './packages.ts';\nimport { functionId } from './plan.ts';\n\n/** The import of the stubs, which call server functions with `rpc` of the core. */\nconst CLIENT = 'brumate/client';\n\n/** True for a file whose first statement is `'use server'`, after comments. */\nexport function hasUseServer(source: string): boolean {\n return /^(?:\\s|\\/\\/[^\\n]*\\n|\\/\\*[\\s\\S]*?\\*\\/)*(['\"])use server\\1/.test(source);\n}\n\n/** True for a path that can be a file of server functions. */\nexport function isScriptFile(path: string): boolean {\n return (\n /\\.[cm]?[jt]sx?$/.test(path) && !path.endsWith('.d.ts') && !/\\.brm\\.[cm]?[jt]s$/.test(path)\n );\n}\n\n/** True for a function expression or an arrow. */\ntype Program = ReturnType<typeof parseSync>['program'];\ntype Node = Program['body'][number] | { type: string; callee?: unknown } | null | undefined;\n\n/**\n * Tells a value that the file exports as a function: a function expression,\n * or a call of `cached` or `idempotent` of `brumate/server`, which return a function.\n */\nfunction functionTest(program: Program): (node: Node) => boolean {\n const wrappers = new Set<string>();\n for (const statement of program.body) {\n if (statement.type === 'ImportDeclaration' && statement.source.value === 'brumate/server') {\n for (const specifier of statement.specifiers) {\n if (\n specifier.type === 'ImportSpecifier' &&\n specifier.imported.type === 'Identifier' &&\n (specifier.imported.name === 'cached' || specifier.imported.name === 'idempotent')\n ) {\n wrappers.add(specifier.local.name);\n }\n }\n }\n }\n return (node) => {\n if (node?.type === 'ArrowFunctionExpression' || node?.type === 'FunctionExpression') {\n return true;\n }\n const callee =\n node?.type === 'CallExpression'\n ? (node.callee as { type: string; name?: string })\n : undefined;\n return callee?.type === 'Identifier' && wrappers.has(callee.name!);\n };\n}\n\n/**\n * The names of the functions that a file of server functions exports.\n * Throws for an export that is not a function, because the browser can only\n * call a server function through its stub.\n */\nexport function serverExports(source: string, filename: string): string[] {\n const { program, errors } = parseSync(filename, source, { lang: 'ts' });\n if (errors[0]) {\n throw new Error(`${errors[0].message} (${filename})`);\n }\n const functions = new Set<string>();\n const values = new Set<string>();\n const local = new Map<string, 'function' | 'value'>();\n const isFunction = functionTest(program);\n for (const statement of program.body) {\n const declaration =\n statement.type === 'ExportNamedDeclaration' ? statement.declaration : statement;\n if (declaration?.type === 'FunctionDeclaration' && declaration.id) {\n local.set(declaration.id.name, 'function');\n } else if (declaration?.type === 'VariableDeclaration') {\n for (const declarator of declaration.declarations) {\n if (declarator.id.type === 'Identifier') {\n local.set(declarator.id.name, isFunction(declarator.init) ? 'function' : 'value');\n }\n }\n }\n }\n for (const statement of program.body) {\n if (statement.type === 'ExportDefaultDeclaration') {\n const value = statement.declaration;\n if (value.type === 'FunctionDeclaration' || isFunction(value)) {\n functions.add('default');\n } else {\n values.add('default');\n }\n } else if (statement.type === 'ExportNamedDeclaration') {\n if (statement.exportKind === 'type') {\n continue;\n }\n const declaration = statement.declaration;\n if (declaration?.type === 'FunctionDeclaration' && declaration.id) {\n functions.add(declaration.id.name);\n } else if (declaration?.type === 'VariableDeclaration') {\n for (const declarator of declaration.declarations) {\n if (declarator.id.type === 'Identifier') {\n (isFunction(declarator.init) ? functions : values).add(declarator.id.name);\n }\n }\n } else if (declaration && !declaration.type.startsWith('TS')) {\n values.add('a class');\n }\n for (const specifier of statement.specifiers) {\n if (specifier.exportKind === 'type') {\n continue;\n }\n const name =\n specifier.exported.type === 'Identifier'\n ? specifier.exported.name\n : specifier.exported.value;\n const from = specifier.local.type === 'Identifier' ? specifier.local.name : '';\n (local.get(from) === 'function' && !statement.source ? functions : values).add(name);\n }\n } else if (statement.type === 'ExportAllDeclaration') {\n values.add('*');\n }\n }\n if (values.size > 0) {\n throw new Error(\n `A 'use server' file exports only functions, because the browser calls them on the server. ${[...values].join(', ')} of ${filename} is not one`,\n );\n }\n // The middleware of the file runs before its functions. The browser cannot call it.\n functions.delete(MIDDLEWARE);\n return [...functions];\n}\n\n/** The export of a file of server functions that runs before each of them. */\nexport const MIDDLEWARE = 'middleware';\n\n/** True if a file of server functions exports `middleware`. */\nexport function hasServerMiddleware(source: string, filename: string): boolean {\n const { program } = parseSync(filename, source, { lang: 'ts' });\n for (const statement of program.body) {\n if (statement.type !== 'ExportNamedDeclaration' || statement.exportKind === 'type') {\n continue;\n }\n const declaration = statement.declaration;\n if (declaration?.type === 'FunctionDeclaration' && declaration.id?.name === MIDDLEWARE) {\n return true;\n }\n if (declaration?.type === 'VariableDeclaration') {\n for (const declarator of declaration.declarations) {\n if (declarator.id.type === 'Identifier' && declarator.id.name === MIDDLEWARE) {\n return true;\n }\n }\n }\n for (const specifier of statement.specifiers) {\n const name =\n specifier.exported.type === 'Identifier'\n ? specifier.exported.name\n : specifier.exported.value;\n if (specifier.exportKind !== 'type' && name === MIDDLEWARE) {\n return true;\n }\n }\n }\n return false;\n}\n\n/** The module that the browser gets in place of a file of server functions. */\nexport function serverStubs(\n source: string,\n filename: string,\n id: string,\n hideNames = false,\n): string {\n const lines = [`import { rpc } from ${JSON.stringify(CLIENT)};`];\n for (const name of serverExports(source, filename)) {\n const call = `(...args) => rpc(${JSON.stringify(functionId(id, name, hideNames))}, args)`;\n lines.push(name === 'default' ? `export default ${call};` : `export const ${name} = ${call};`);\n }\n return `${lines.join('\\n')}\\n`;\n}\n\n/**\n * The module that the server runs for a file of server functions: the file,\n * with each exported function wrapped, so its calls while a page renders\n * share a result when their arguments are the same. Offsets stay the same.\n */\nexport function serverModule(source: string, filename: string, id: string): string {\n const { program } = parseSync(filename, source, { lang: 'ts' });\n const isFunction = functionTest(program);\n // Local names of exported functions, with the name that each is exported as.\n const wrapped = new Map<string, string>();\n const declarations = new Map<string, 'function' | 'const'>();\n let code = source;\n for (const statement of program.body) {\n const declaration =\n statement.type === 'ExportNamedDeclaration' ? statement.declaration : statement;\n if (declaration?.type === 'FunctionDeclaration' && declaration.id) {\n declarations.set(declaration.id.name, 'function');\n } else if (declaration?.type === 'VariableDeclaration') {\n for (const declarator of declaration.declarations) {\n if (declarator.id.type === 'Identifier' && isFunction(declarator.init)) {\n declarations.set(declarator.id.name, 'const');\n }\n }\n }\n }\n function makeLet(declaration: { start: number; kind: string }): void {\n // `const` becomes `let `, so the function can be wrapped and offsets stay the same.\n if (declaration.kind === 'const') {\n code = `${code.slice(0, declaration.start)}let ${code.slice(declaration.start + 5)}`;\n }\n }\n for (const statement of program.body) {\n if (\n statement.type !== 'ExportNamedDeclaration' ||\n statement.source ||\n statement.exportKind === 'type'\n ) {\n continue;\n }\n const declaration = statement.declaration;\n if (declaration?.type === 'FunctionDeclaration' && declaration.id) {\n wrapped.set(declaration.id.name, declaration.id.name);\n } else if (declaration?.type === 'VariableDeclaration') {\n for (const declarator of declaration.declarations) {\n if (declarator.id.type === 'Identifier' && isFunction(declarator.init)) {\n wrapped.set(declarator.id.name, declarator.id.name);\n makeLet(declaration);\n }\n }\n }\n for (const specifier of statement.specifiers) {\n const local = specifier.local.type === 'Identifier' ? specifier.local.name : '';\n const exported =\n specifier.exported.type === 'Identifier'\n ? specifier.exported.name\n : specifier.exported.value;\n if (declarations.has(local)) {\n wrapped.set(local, exported);\n }\n }\n }\n // A `const` arrow that `export { name }` exports is declared with `let` too.\n for (const statement of program.body) {\n if (statement.type === 'VariableDeclaration') {\n for (const declarator of statement.declarations) {\n if (declarator.id.type === 'Identifier' && wrapped.has(declarator.id.name)) {\n makeLet(statement);\n }\n }\n }\n }\n if (wrapped.size === 0) {\n return source;\n }\n const lines = [\"import { dedupe as __brumateDedupe } from 'brumate/server';\"];\n for (const [local, exported] of wrapped) {\n lines.push(`${local} = __brumateDedupe(${local}, ${JSON.stringify(`${id}#${exported}`)});`);\n }\n return `${code}\\n${lines.join('\\n')}\\n`;\n}\n\n/**\n * The file of a relative import that holds server functions, such as `./issues` for `issues.ts`\n * with `'use server'` first, or undefined. A package specifier is not looked up.\n */\nexport function findServerImport(importer: string, specifier: string): string | undefined {\n if (!specifier.startsWith('.')) {\n return undefined;\n }\n const stem = path.resolve(path.dirname(importer), specifier);\n const candidates = [stem];\n for (const extension of ['.ts', '.tsx', '.js', '.mjs']) {\n candidates.push(stem + extension);\n }\n for (const candidate of candidates) {\n if (\n isScriptFile(candidate) &&\n existsSync(candidate) &&\n hasUseServer(readFileSync(candidate, 'utf8'))\n ) {\n return candidate;\n }\n }\n return undefined;\n}\n\n/**\n * The file of server functions that a package of components exports under a\n * bare specifier, or undefined.\n */\nexport function findPackageServerFile(\n packages: BrumatePackage[],\n importer: string,\n specifier: string,\n): string | undefined {\n const file = resolveComponentPackage(packages, specifier, importer);\n return file && isScriptFile(file) && hasUseServer(readFileSync(file, 'utf8')) ? file : undefined;\n}\n","import { readFile, readdir, stat } from 'node:fs/promises';\nimport path from 'node:path';\nimport { hasBridge, mayHaveBridge } from './bridges.ts';\nimport { hasUseServer, isScriptFile } from './server-files.ts';\n\n/** Skips `node_modules`, `dist` and hidden directories when looking for `.brm` files. */\nexport function defaultExclude(directory: string): boolean {\n return directory === 'node_modules' || directory === 'dist' || directory.startsWith('.');\n}\n\n/** Finds every `.brm` file under a directory, as absolute paths with forward slashes. */\nexport async function findFiles(\n root: string,\n exclude: (directory: string) => boolean,\n): Promise<string[]> {\n const result: string[] = [];\n async function visit(directory: string): Promise<void> {\n const directories: Promise<void>[] = [];\n for (const entry of await readdir(directory, { withFileTypes: true })) {\n const file = path.join(directory, entry.name);\n if (entry.isDirectory()) {\n if (!exclude(entry.name)) {\n directories.push(visit(file));\n }\n } else if (entry.name.endsWith('.brm')) {\n result.push(file.split(path.sep).join('/'));\n }\n }\n await Promise.all(directories);\n }\n await visit(root);\n return result.toSorted();\n}\n\n/**\n * Finds every file of server functions under a directory: a script whose\n * first statement is `'use server'`.\n */\nexport async function findServerFiles(\n root: string,\n exclude: (directory: string) => boolean,\n): Promise<string[]> {\n const result: string[] = [];\n async function visit(directory: string): Promise<void> {\n const pending: Promise<void>[] = [];\n for (const entry of await readdir(directory, { withFileTypes: true })) {\n const file = path.join(directory, entry.name);\n if (entry.isDirectory()) {\n if (!exclude(entry.name)) {\n pending.push(visit(file));\n }\n } else if (isScriptFile(entry.name)) {\n pending.push(\n readFile(file, 'utf8').then((source) => {\n if (hasUseServer(source)) {\n result.push(file.split(path.sep).join('/'));\n }\n }),\n );\n }\n }\n await Promise.all(pending);\n }\n await visit(root);\n return result.toSorted();\n}\n\n/** Finds every script file under a directory that can hold a call of `bridge`. */\nexport async function findBridgeFiles(\n root: string,\n exclude: (directory: string) => boolean,\n): Promise<string[]> {\n const result: string[] = [];\n async function visit(directory: string): Promise<void> {\n const pending: Promise<void>[] = [];\n for (const entry of await readdir(directory, { withFileTypes: true })) {\n const file = path.join(directory, entry.name);\n if (entry.isDirectory()) {\n if (!exclude(entry.name)) {\n pending.push(visit(file));\n }\n } else if (isScriptFile(entry.name)) {\n pending.push(\n readFile(file, 'utf8').then((source) => {\n // The text test is a cheap filter; the parse confirms a bridge that is exported.\n if (mayHaveBridge(source) && hasBridge(source, file)) {\n result.push(file.split(path.sep).join('/'));\n }\n }),\n );\n }\n }\n await Promise.all(pending);\n }\n await visit(root);\n return result.toSorted();\n}\n\n/**\n * Finds every script under a directory, such as `.ts` and `.brm.ts` files, as\n * absolute paths with forward slashes, without reading them.\n */\nexport async function findScripts(\n root: string,\n exclude: (directory: string) => boolean,\n): Promise<string[]> {\n const result: string[] = [];\n async function visit(directory: string): Promise<void> {\n const directories: Promise<void>[] = [];\n for (const entry of await readdir(directory, { withFileTypes: true })) {\n const file = path.join(directory, entry.name);\n if (entry.isDirectory()) {\n if (!exclude(entry.name)) {\n directories.push(visit(file));\n }\n } else if (/\\.[cm]?[jt]sx?$/.test(entry.name) && !entry.name.endsWith('.d.ts')) {\n result.push(file.split(path.sep).join('/'));\n }\n }\n await Promise.all(directories);\n }\n await visit(root);\n return result.toSorted();\n}\n\n/**\n * Reads every `.brm` file under a root, and finds the files that the paths\n * name: a file, or the files under a directory. Without paths, the targets are\n * the whole project. A file outside the root is read too. A path that does not\n * exist throws.\n */\nexport async function collectSources(\n root: string,\n paths: string[],\n): Promise<{ sources: Map<string, string>; targets: string[] }> {\n const project = await findFiles(root, defaultExclude);\n const sources = new Map<string, string>();\n const reads: Promise<string>[] = [];\n for (const file of project) {\n reads.push(readFile(file, 'utf8'));\n }\n const texts = await Promise.all(reads);\n for (const [index, file] of project.entries()) {\n sources.set(file, texts[index]!);\n }\n\n const targets: string[] = paths.length === 0 ? [...project] : [];\n const lookups: Promise<string[]>[] = [];\n for (const target of paths) {\n const absolute = path.resolve(root, target);\n lookups.push(\n stat(absolute).then((info) =>\n info.isDirectory()\n ? findFiles(absolute, defaultExclude)\n : [absolute.split(path.sep).join('/')],\n ),\n );\n }\n for (const found of await Promise.all(lookups)) {\n targets.push(...found);\n }\n const extra: string[] = [];\n const extraReads: Promise<string>[] = [];\n for (const file of targets) {\n if (!sources.has(file)) {\n extra.push(file);\n extraReads.push(readFile(file, 'utf8'));\n }\n }\n const extraTexts = await Promise.all(extraReads);\n for (const [index, file] of extra.entries()) {\n sources.set(file, extraTexts[index]!);\n }\n return { sources, targets };\n}\n"],"mappings":";;;;;;AAoCA,SAAS,QAAQ,MAAsB;CACrC,OAAO,KAAK,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG;AACtC;AAEA,SAA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AO;CAEtC,OAAO;EAAE;EAAS;CAAQ;AAC5B"}
|
|
1
|
+
{"version":3,"file":"files-Bz0lAQzD.js","names":[],"sources":["../src/packages.ts","../src/server-files.ts","../src/files.ts"],"sourcesContent":["// Packages of components. A dependency of the app whose package.json has a\n// `brumate` field ships `.brm` files, `.brm.ts` modules and `'use server'`\n// files as source, and the plugin of the app compiles them with its own files.\n\nimport { existsSync, readFileSync, realpathSync, statSync } from 'node:fs';\nimport path from 'node:path';\n\n/** A dependency of the app that ships `.brm` files. */\nexport interface BrumatePackage {\n /** The name of the package, such as `@acme/ui`. */\n name: string;\n version: string;\n /** The real path of the directory of the package, with forward slashes. */\n root: string;\n /** The directories to search for files, as absolute paths with forward slashes. */\n directories: string[];\n /**\n * The prefix of the names of its files, which their IDs come from: the\n * name of the package, and its version when the app has two versions.\n */\n prefix: string;\n /** True when the package is not inside `node_modules`, such as a workspace package. */\n linked: boolean;\n}\n\ninterface PackageJson {\n name?: string;\n version?: string;\n brumate?: unknown;\n exports?: unknown;\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n optionalDependencies?: Record<string, string>;\n peerDependencies?: Record<string, string>;\n}\n\nfunction toPosix(file: string): string {\n return file.split(path.sep).join('/');\n}\n\nfunction readJson(file: string): PackageJson | undefined {\n try {\n return JSON.parse(readFileSync(file, 'utf8')) as PackageJson;\n } catch {\n return undefined;\n }\n}\n\n/** The real directory of a package that code in `from` can import, or undefined. */\nexport function findPackageDirectory(name: string, from: string): string | undefined {\n for (let directory = from; ; directory = path.dirname(directory)) {\n const candidate = path.join(directory, 'node_modules', name);\n if (existsSync(path.join(candidate, 'package.json'))) {\n return toPosix(realpathSync(candidate));\n }\n if (path.dirname(directory) === directory) {\n return undefined;\n }\n }\n}\n\n/** The directory of the nearest package.json at or above a directory. */\nfunction packageRoot(directory: string): string | undefined {\n for (let current = directory; ; current = path.dirname(current)) {\n if (existsSync(path.join(current, 'package.json'))) {\n return current;\n }\n if (path.dirname(current) === current) {\n return undefined;\n }\n }\n}\n\n/** The version of the `brumate` field that this version of brumate reads. */\nexport const PACKAGE_FORMAT = 1;\n\n/** The directories that the `brumate` field names, or undefined when the package does not opt in. */\nfunction readDirectories(root: string, field: unknown, name: string): string[] | undefined {\n if (field === true) {\n return [root];\n }\n if (typeof field === 'object' && field !== null) {\n const { dir, version = PACKAGE_FORMAT } = field as {\n dir?: string | string[];\n version?: number;\n };\n if (version !== PACKAGE_FORMAT) {\n throw new Error(\n `The package ${name} has \"brumate\": { \"version\": ${version} }, but this version of brumate reads version ${PACKAGE_FORMAT}. Install a version of ${name} or of brumate that matches.`,\n );\n }\n if (dir === undefined) {\n return [root];\n }\n const directories: string[] = [];\n for (const item of Array.isArray(dir) ? dir : [dir]) {\n directories.push(toPosix(path.resolve(root, item)));\n }\n return directories;\n }\n return undefined;\n}\n\n/**\n * Finds the dependencies of the app at `root` that ship `.brm` files, and\n * theirs. The app's dependencies come from its package.json: `dependencies`,\n * `devDependencies`, `optionalDependencies` and `peerDependencies`. A package\n * opts in with `\"brumate\": true`, or `\"brumate\": { \"dir\": \"src\" }` to search\n * only that directory. Symbolic links, such as those of pnpm, resolve to the\n * real directory.\n */\nexport function findPackages(root: string): BrumatePackage[] {\n const app = packageRoot(path.resolve(root));\n if (!app) {\n return [];\n }\n const found = new Map<string, Omit<BrumatePackage, 'prefix'>>();\n function visit(directory: string, json: PackageJson, own: boolean): void {\n const names = new Set([\n ...Object.keys(json.dependencies ?? {}),\n ...Object.keys(json.optionalDependencies ?? {}),\n ...Object.keys(json.peerDependencies ?? {}),\n // The dev dependencies of a package are its own tools, not part of what it ships.\n ...(own ? Object.keys(json.devDependencies ?? {}) : []),\n ]);\n for (const name of [...names].toSorted()) {\n const real = findPackageDirectory(name, directory);\n if (!real || found.has(real)) {\n continue;\n }\n const dependency = readJson(`${real}/package.json`);\n const directories = dependency && readDirectories(real, dependency.brumate, name);\n if (!dependency || !directories) {\n continue;\n }\n found.set(real, {\n name: dependency.name ?? name,\n version: dependency.version ?? '0.0.0',\n root: real,\n directories,\n linked: !real.includes('/node_modules/'),\n });\n visit(real, dependency, false);\n }\n }\n visit(app, readJson(path.join(app, 'package.json')) ?? {}, true);\n const list = [...found.values()];\n // Two versions of one package get IDs apart. Copies of one version share theirs, as their files are the same.\n const versions = new Map<string, Set<string>>();\n for (const item of list) {\n versions.set(item.name, (versions.get(item.name) ?? new Set()).add(item.version));\n }\n const result: BrumatePackage[] = [];\n for (const item of list) {\n result.push(\n Object.assign(item, {\n prefix: versions.get(item.name)!.size > 1 ? `${item.name}@${item.version}` : item.name,\n }),\n );\n }\n return result;\n}\n\n/** An installed package that can export a bridge. */\nexport interface BridgePackage {\n /** The name in bridge names: the package name, with `@<version>` when two copies share it. */\n name: string;\n /** The package name. */\n package: string;\n /** The real directory of the package. */\n root: string;\n /**\n * The installed dependencies and peers it imports, other than brumate. The package is not\n * prebundled, so Vite prebundles these through it (`<package> > <dependency>`), which turns\n * CommonJS into ESM.\n */\n dependencies: string[];\n}\n\n/**\n * Finds the dependencies of the app, by the walk of `findPackages`, that can export a `bridge`\n * without shipping `.brm` files: those that list `brumate` in `dependencies` or\n * `peerDependencies`. A package with the `brumate` field is a package of components, which\n * `findPackages` returns. The walk goes on into both kinds, never into other packages.\n */\nexport function findBridgePackages(root: string): BridgePackage[] {\n const app = packageRoot(path.resolve(root));\n if (!app) {\n return [];\n }\n const seen = new Set<string>();\n function visit(directory: string, json: PackageJson, own: boolean): void {\n const names = new Set([\n ...Object.keys(json.dependencies ?? {}),\n ...Object.keys(json.optionalDependencies ?? {}),\n ...Object.keys(json.peerDependencies ?? {}),\n ...(own ? Object.keys(json.devDependencies ?? {}) : []),\n ]);\n for (const name of [...names].toSorted()) {\n const real = findPackageDirectory(name, directory);\n if (!real || seen.has(real) || name === 'brumate') {\n continue;\n }\n seen.add(real);\n const dependency = readJson(`${real}/package.json`);\n if (!dependency) {\n continue;\n }\n const components = readDirectories(real, dependency.brumate, name) !== undefined;\n const wants =\n 'brumate' in (dependency.dependencies ?? {}) ||\n 'brumate' in (dependency.peerDependencies ?? {});\n if (!components && !wants) {\n continue;\n }\n if (!components) {\n const imports: string[] = [];\n const listed = new Set([\n ...Object.keys(dependency.dependencies ?? {}),\n ...Object.keys(dependency.optionalDependencies ?? {}),\n ...Object.keys(dependency.peerDependencies ?? {}),\n ]);\n for (const item of [...listed].toSorted()) {\n // Type packages have no code to prebundle.\n if (\n item !== 'brumate' &&\n !item.startsWith('@types/') &&\n findPackageDirectory(item, real)\n ) {\n imports.push(item);\n }\n }\n found.push({\n name: dependency.name ?? name,\n package: name,\n version: dependency.version,\n root: real,\n dependencies: imports,\n });\n }\n visit(real, dependency, false);\n }\n }\n const found: (BridgePackage & { version?: string })[] = [];\n visit(app, readJson(path.join(app, 'package.json')) ?? {}, true);\n return nameBridgePackages(found);\n}\n\n/**\n * Gives each package a name of its own. Two installed copies of one package, such as two\n * versions in nested `node_modules`, get `@<version>`. Two copies of one version cannot be told\n * apart on every machine, so they throw, since their bridges would share one page state.\n */\nfunction nameBridgePackages(found: (BridgePackage & { version?: string })[]): BridgePackage[] {\n const counts = new Map<string, number>();\n for (const item of found) {\n counts.set(item.name, (counts.get(item.name) ?? 0) + 1);\n }\n const result: BridgePackage[] = [];\n const roots = new Map<string, string>();\n for (const item of found) {\n const name = counts.get(item.name)! > 1 ? `${item.name}@${item.version ?? ''}` : item.name;\n const other = roots.get(name);\n if (other !== undefined) {\n throw new Error(\n `brumate: two installed copies of ${name} export bridges, at ${other} and ${item.root}. ` +\n 'Their bridges would share one name in the page state. Dedupe the package.',\n );\n }\n roots.set(name, item.root);\n result.push({\n name,\n package: item.package,\n root: item.root,\n dependencies: item.dependencies,\n });\n }\n return result;\n}\n\n/** The package that a file belongs to, or undefined for a file of the app. */\nexport function findPackage(packages: BrumatePackage[], file: string): BrumatePackage | undefined {\n for (const item of packages) {\n if (file.startsWith(`${item.root}/`)) {\n return item;\n }\n }\n return undefined;\n}\n\n/**\n * The name of a file of a package, which its IDs come from: the prefix of\n * the package and the path of the file in it, such as `@acme/ui/src/Button.brm`.\n * It is the same wherever the package is installed.\n */\nexport function packageFileName(item: BrumatePackage, file: string): string {\n return `${item.prefix}/${file.slice(item.root.length + 1)}`;\n}\n\n/** The name and the subpath of a bare specifier, such as `@acme/ui` and `./Button.brm`. */\nexport function splitSpecifier(specifier: string): { name: string; subpath: string } | undefined {\n if (specifier.startsWith('.') || specifier.startsWith('/') || /^[a-z]+:/i.test(specifier)) {\n return undefined;\n }\n const parts = specifier.split('/');\n const count = specifier.startsWith('@') ? 2 : 1;\n if (parts.length < count) {\n return undefined;\n }\n for (const part of parts.slice(0, count)) {\n if (part === '') {\n return undefined;\n }\n }\n const rest = parts.slice(count).join('/');\n return { name: parts.slice(0, count).join('/'), subpath: rest ? `./${rest}` : '.' };\n}\n\n/** The conditions of `exports` that a `.brm` file or a source module can be under. */\nconst CONDITIONS = new Set(['brumate', 'import', 'module', 'node', 'browser', 'default']);\n\nfunction resolveTarget(target: unknown, star: string): string | undefined {\n if (typeof target === 'string') {\n return target.replaceAll('*', star);\n }\n if (Array.isArray(target)) {\n for (const item of target) {\n const result = resolveTarget(item, star);\n if (result) {\n return result;\n }\n }\n return undefined;\n }\n if (typeof target === 'object' && target !== null) {\n for (const [condition, value] of Object.entries(target)) {\n if (CONDITIONS.has(condition)) {\n const result = resolveTarget(value, star);\n if (result) {\n return result;\n }\n }\n }\n }\n return undefined;\n}\n\n/** Resolves a subpath through the `exports` of a package.json, or undefined if it does not export it. */\nexport function resolveExports(exports: unknown, subpath: string): string | undefined {\n let hasSubpaths = false;\n if (typeof exports === 'object' && exports !== null && !Array.isArray(exports)) {\n for (const key of Object.keys(exports)) {\n if (key.startsWith('.')) {\n hasSubpaths = true;\n break;\n }\n }\n }\n const map = hasSubpaths ? (exports as Record<string, unknown>) : { '.': exports };\n if (subpath in map) {\n return resolveTarget(map[subpath], '');\n }\n // The pattern with the longest prefix wins, as in Node.\n let best: { key: string; star: string } | undefined;\n for (const key of Object.keys(map)) {\n const index = key.indexOf('*');\n if (index === -1) {\n continue;\n }\n const before = key.slice(0, index);\n const after = key.slice(index + 1);\n if (\n subpath.startsWith(before) &&\n subpath.endsWith(after) &&\n subpath.length >= key.length - 1 &&\n (!best || before.length > best.key.indexOf('*'))\n ) {\n best = { key, star: subpath.slice(before.length, subpath.length - after.length) };\n }\n }\n return best && resolveTarget(map[best.key], best.star);\n}\n\n/**\n * Resolves a bare specifier, such as `@acme/ui/Button.brm`, to the real path\n * of the file, through the `exports` of the package. Returns undefined when\n * it is not a bare specifier or names no file.\n */\nexport function resolvePackageImport(specifier: string, importer: string): string | undefined {\n const split = splitSpecifier(specifier);\n if (!split) {\n return undefined;\n }\n const directory = findPackageDirectory(split.name, path.dirname(importer));\n if (!directory) {\n return undefined;\n }\n const json = readJson(`${directory}/package.json`);\n const target =\n json?.exports === undefined ? split.subpath : resolveExports(json.exports, split.subpath);\n if (!target) {\n return undefined;\n }\n const file = path.resolve(directory, target);\n return existsSync(file) ? toPosix(realpathSync(file)) : undefined;\n}\n\n/**\n * Resolves a bare specifier like `resolvePackageImport`, but only for a\n * package of components in the list. Returns undefined for any other package.\n */\nexport function resolveComponentPackage(\n packages: BrumatePackage[],\n specifier: string,\n importer: string,\n): string | undefined {\n const name = splitSpecifier(specifier)?.name;\n for (const item of packages) {\n if (item.name === name) {\n return resolvePackageImport(specifier, importer);\n }\n }\n return undefined;\n}\n\n/** The specifiers that a file imports or exports from, found by a pattern, so it can only find more. */\nexport function importSpecifiers(source: string): string[] {\n const result: string[] = [];\n for (const match of source.matchAll(/(?:\\bfrom|\\bimport\\s*\\(?)\\s*(['\"])([^'\"\\n]+)\\1/g)) {\n result.push(match[2]!);\n }\n return result;\n}\n\n/** The extensions that an import without one can name. */\nconst EXTENSIONS = ['', '.ts', '.tsx', '.js', '.mjs', '/index.ts', '/index.js'];\n\n/**\n * The files of packages that the app reaches: the files of packages that\n * files of the app import, and the files of packages that those import, and\n * so on. Only these become server functions of the app.\n */\nexport function reachableFiles(\n packages: BrumatePackage[],\n appFiles: string[],\n read: (file: string) => string | undefined,\n): Set<string> {\n const reached = new Set<string>();\n const names = new Set<string>();\n for (const item of packages) {\n names.add(item.name);\n }\n const pending: string[] = [];\n function add(file: string | undefined): void {\n if (file && !reached.has(file) && findPackage(packages, file)) {\n reached.add(file);\n pending.push(file);\n }\n }\n function resolve(specifier: string, importer: string): string | undefined {\n if (specifier.startsWith('.')) {\n const stem = path.resolve(path.dirname(importer), specifier.split('?')[0]!);\n for (const extension of EXTENSIONS) {\n const candidate = stem + extension;\n if (statSync(candidate, { throwIfNoEntry: false })?.isFile()) {\n return toPosix(realpathSync(candidate));\n }\n }\n return undefined;\n }\n const name = splitSpecifier(specifier)?.name;\n return name && names.has(name)\n ? resolvePackageImport(specifier.split('?')[0]!, importer)\n : undefined;\n }\n function visit(file: string, own: boolean): void {\n const source = read(file);\n if (source === undefined) {\n return;\n }\n for (const specifier of importSpecifiers(source)) {\n // A file of the app reaches a package only by its name.\n if (own && specifier.startsWith('.')) {\n continue;\n }\n try {\n add(resolve(specifier, file));\n } catch {\n // A path that is not a file, such as a directory, reaches nothing.\n }\n }\n }\n for (const file of appFiles) {\n visit(file, true);\n }\n while (pending.length > 0) {\n visit(pending.pop()!, false);\n }\n return reached;\n}\n","// Files of server functions. A `.ts` or `.js` file whose first statement is\n// `'use server'` holds functions that only run on the server. Its exports are\n// server functions: the browser gets a stub for each one, which calls the\n// server, and the code of the file never ships.\n\nimport { existsSync, readFileSync } from 'node:fs';\nimport path from 'node:path';\nimport { parseSync } from 'oxc-parser';\nimport type { BrumatePackage } from './packages.ts';\nimport { resolveComponentPackage } from './packages.ts';\nimport { functionId } from './plan.ts';\n\n/** The import of the stubs, which call server functions with `rpc` of the core. */\nconst CLIENT = 'brumate/client';\n\n/** True for a file whose first statement is `'use server'`, after comments. */\nexport function hasUseServer(source: string): boolean {\n return /^(?:\\s|\\/\\/[^\\n]*\\n|\\/\\*[\\s\\S]*?\\*\\/)*(['\"])use server\\1/.test(source);\n}\n\n/** True for a path that can be a file of server functions. */\nexport function isScriptFile(path: string): boolean {\n return (\n /\\.[cm]?[jt]sx?$/.test(path) && !path.endsWith('.d.ts') && !/\\.brm\\.[cm]?[jt]s$/.test(path)\n );\n}\n\n/** True for a function expression or an arrow. */\ntype Program = ReturnType<typeof parseSync>['program'];\ntype Node = Program['body'][number] | { type: string; callee?: unknown } | null | undefined;\n\n/**\n * Tells a value that the file exports as a function: a function expression,\n * or a call of `cached` or `idempotent` of `brumate/server`, which return a function.\n */\nfunction functionTest(program: Program): (node: Node) => boolean {\n const wrappers = new Set<string>();\n for (const statement of program.body) {\n if (statement.type === 'ImportDeclaration' && statement.source.value === 'brumate/server') {\n for (const specifier of statement.specifiers) {\n if (\n specifier.type === 'ImportSpecifier' &&\n specifier.imported.type === 'Identifier' &&\n (specifier.imported.name === 'cached' || specifier.imported.name === 'idempotent')\n ) {\n wrappers.add(specifier.local.name);\n }\n }\n }\n }\n return (node) => {\n if (node?.type === 'ArrowFunctionExpression' || node?.type === 'FunctionExpression') {\n return true;\n }\n const callee =\n node?.type === 'CallExpression'\n ? (node.callee as { type: string; name?: string })\n : undefined;\n return callee?.type === 'Identifier' && wrappers.has(callee.name!);\n };\n}\n\n/**\n * The names of the functions that a file of server functions exports.\n * Throws for an export that is not a function, because the browser can only\n * call a server function through its stub.\n */\nexport function serverExports(source: string, filename: string): string[] {\n const { program, errors } = parseSync(filename, source, { lang: 'ts' });\n if (errors[0]) {\n throw new Error(`${errors[0].message} (${filename})`);\n }\n const functions = new Set<string>();\n const values = new Set<string>();\n const local = new Map<string, 'function' | 'value'>();\n const isFunction = functionTest(program);\n for (const statement of program.body) {\n const declaration =\n statement.type === 'ExportNamedDeclaration' ? statement.declaration : statement;\n if (declaration?.type === 'FunctionDeclaration' && declaration.id) {\n local.set(declaration.id.name, 'function');\n } else if (declaration?.type === 'VariableDeclaration') {\n for (const declarator of declaration.declarations) {\n if (declarator.id.type === 'Identifier') {\n local.set(declarator.id.name, isFunction(declarator.init) ? 'function' : 'value');\n }\n }\n }\n }\n for (const statement of program.body) {\n if (statement.type === 'ExportDefaultDeclaration') {\n const value = statement.declaration;\n if (value.type === 'FunctionDeclaration' || isFunction(value)) {\n functions.add('default');\n } else {\n values.add('default');\n }\n } else if (statement.type === 'ExportNamedDeclaration') {\n if (statement.exportKind === 'type') {\n continue;\n }\n const declaration = statement.declaration;\n if (declaration?.type === 'FunctionDeclaration' && declaration.id) {\n functions.add(declaration.id.name);\n } else if (declaration?.type === 'VariableDeclaration') {\n for (const declarator of declaration.declarations) {\n if (declarator.id.type === 'Identifier') {\n (isFunction(declarator.init) ? functions : values).add(declarator.id.name);\n }\n }\n } else if (declaration && !declaration.type.startsWith('TS')) {\n values.add('a class');\n }\n for (const specifier of statement.specifiers) {\n if (specifier.exportKind === 'type') {\n continue;\n }\n const name =\n specifier.exported.type === 'Identifier'\n ? specifier.exported.name\n : specifier.exported.value;\n const from = specifier.local.type === 'Identifier' ? specifier.local.name : '';\n (local.get(from) === 'function' && !statement.source ? functions : values).add(name);\n }\n } else if (statement.type === 'ExportAllDeclaration') {\n values.add('*');\n }\n }\n if (values.size > 0) {\n throw new Error(\n `A 'use server' file exports only functions, because the browser calls them on the server. ${[...values].join(', ')} of ${filename} is not one`,\n );\n }\n // The middleware of the file runs before its functions. The browser cannot call it.\n functions.delete(MIDDLEWARE);\n return [...functions];\n}\n\n/** The export of a file of server functions that runs before each of them. */\nexport const MIDDLEWARE = 'middleware';\n\n/** True if a file of server functions exports `middleware`. */\nexport function hasServerMiddleware(source: string, filename: string): boolean {\n const { program } = parseSync(filename, source, { lang: 'ts' });\n for (const statement of program.body) {\n if (statement.type !== 'ExportNamedDeclaration' || statement.exportKind === 'type') {\n continue;\n }\n const declaration = statement.declaration;\n if (declaration?.type === 'FunctionDeclaration' && declaration.id?.name === MIDDLEWARE) {\n return true;\n }\n if (declaration?.type === 'VariableDeclaration') {\n for (const declarator of declaration.declarations) {\n if (declarator.id.type === 'Identifier' && declarator.id.name === MIDDLEWARE) {\n return true;\n }\n }\n }\n for (const specifier of statement.specifiers) {\n const name =\n specifier.exported.type === 'Identifier'\n ? specifier.exported.name\n : specifier.exported.value;\n if (specifier.exportKind !== 'type' && name === MIDDLEWARE) {\n return true;\n }\n }\n }\n return false;\n}\n\n/** The module that the browser gets in place of a file of server functions. */\nexport function serverStubs(\n source: string,\n filename: string,\n id: string,\n hideNames = false,\n): string {\n const lines = [`import { rpc } from ${JSON.stringify(CLIENT)};`];\n for (const name of serverExports(source, filename)) {\n const call = `(...args) => rpc(${JSON.stringify(functionId(id, name, hideNames))}, args)`;\n lines.push(name === 'default' ? `export default ${call};` : `export const ${name} = ${call};`);\n }\n return `${lines.join('\\n')}\\n`;\n}\n\n/**\n * The module that the server runs for a file of server functions: the file,\n * with each exported function wrapped, so its calls while a page renders\n * share a result when their arguments are the same. Offsets stay the same.\n */\nexport function serverModule(source: string, filename: string, id: string): string {\n const { program } = parseSync(filename, source, { lang: 'ts' });\n const isFunction = functionTest(program);\n // Local names of exported functions, with the name that each is exported as.\n const wrapped = new Map<string, string>();\n const declarations = new Map<string, 'function' | 'const'>();\n let code = source;\n for (const statement of program.body) {\n const declaration =\n statement.type === 'ExportNamedDeclaration' ? statement.declaration : statement;\n if (declaration?.type === 'FunctionDeclaration' && declaration.id) {\n declarations.set(declaration.id.name, 'function');\n } else if (declaration?.type === 'VariableDeclaration') {\n for (const declarator of declaration.declarations) {\n if (declarator.id.type === 'Identifier' && isFunction(declarator.init)) {\n declarations.set(declarator.id.name, 'const');\n }\n }\n }\n }\n function makeLet(declaration: { start: number; kind: string }): void {\n // `const` becomes `let `, so the function can be wrapped and offsets stay the same.\n if (declaration.kind === 'const') {\n code = `${code.slice(0, declaration.start)}let ${code.slice(declaration.start + 5)}`;\n }\n }\n for (const statement of program.body) {\n if (\n statement.type !== 'ExportNamedDeclaration' ||\n statement.source ||\n statement.exportKind === 'type'\n ) {\n continue;\n }\n const declaration = statement.declaration;\n if (declaration?.type === 'FunctionDeclaration' && declaration.id) {\n wrapped.set(declaration.id.name, declaration.id.name);\n } else if (declaration?.type === 'VariableDeclaration') {\n for (const declarator of declaration.declarations) {\n if (declarator.id.type === 'Identifier' && isFunction(declarator.init)) {\n wrapped.set(declarator.id.name, declarator.id.name);\n makeLet(declaration);\n }\n }\n }\n for (const specifier of statement.specifiers) {\n const local = specifier.local.type === 'Identifier' ? specifier.local.name : '';\n const exported =\n specifier.exported.type === 'Identifier'\n ? specifier.exported.name\n : specifier.exported.value;\n if (declarations.has(local)) {\n wrapped.set(local, exported);\n }\n }\n }\n // A `const` arrow that `export { name }` exports is declared with `let` too.\n for (const statement of program.body) {\n if (statement.type === 'VariableDeclaration') {\n for (const declarator of statement.declarations) {\n if (declarator.id.type === 'Identifier' && wrapped.has(declarator.id.name)) {\n makeLet(statement);\n }\n }\n }\n }\n if (wrapped.size === 0) {\n return source;\n }\n const lines = [\"import { dedupe as __brumateDedupe } from 'brumate/server';\"];\n for (const [local, exported] of wrapped) {\n lines.push(`${local} = __brumateDedupe(${local}, ${JSON.stringify(`${id}#${exported}`)});`);\n }\n return `${code}\\n${lines.join('\\n')}\\n`;\n}\n\n/**\n * The file of a relative import that holds server functions, such as `./issues` for `issues.ts`\n * with `'use server'` first, or undefined. A package specifier is not looked up.\n */\nexport function findServerImport(importer: string, specifier: string): string | undefined {\n if (!specifier.startsWith('.')) {\n return undefined;\n }\n const stem = path.resolve(path.dirname(importer), specifier);\n const candidates = [stem];\n for (const extension of ['.ts', '.tsx', '.js', '.mjs']) {\n candidates.push(stem + extension);\n }\n for (const candidate of candidates) {\n if (\n isScriptFile(candidate) &&\n existsSync(candidate) &&\n hasUseServer(readFileSync(candidate, 'utf8'))\n ) {\n return candidate;\n }\n }\n return undefined;\n}\n\n/**\n * The file of server functions that a package of components exports under a\n * bare specifier, or undefined.\n */\nexport function findPackageServerFile(\n packages: BrumatePackage[],\n importer: string,\n specifier: string,\n): string | undefined {\n const file = resolveComponentPackage(packages, specifier, importer);\n return file && isScriptFile(file) && hasUseServer(readFileSync(file, 'utf8')) ? file : undefined;\n}\n","import { readFile, readdir, stat } from 'node:fs/promises';\nimport path from 'node:path';\nimport { hasBridge, mayHaveBridge } from './bridges.ts';\nimport { hasUseServer, isScriptFile } from './server-files.ts';\n\n/** Skips `node_modules`, `dist` and hidden directories when looking for `.brm` files. */\nexport function defaultExclude(directory: string): boolean {\n return directory === 'node_modules' || directory === 'dist' || directory.startsWith('.');\n}\n\n/** Finds every `.brm` file under a directory, as absolute paths with forward slashes. */\nexport async function findFiles(\n root: string,\n exclude: (directory: string) => boolean,\n): Promise<string[]> {\n const result: string[] = [];\n async function visit(directory: string): Promise<void> {\n const directories: Promise<void>[] = [];\n for (const entry of await readdir(directory, { withFileTypes: true })) {\n const file = path.join(directory, entry.name);\n if (entry.isDirectory()) {\n if (!exclude(entry.name)) {\n directories.push(visit(file));\n }\n } else if (entry.name.endsWith('.brm')) {\n result.push(file.split(path.sep).join('/'));\n }\n }\n await Promise.all(directories);\n }\n await visit(root);\n return result.toSorted();\n}\n\n/**\n * Finds every file of server functions under a directory: a script whose\n * first statement is `'use server'`.\n */\nexport async function findServerFiles(\n root: string,\n exclude: (directory: string) => boolean,\n): Promise<string[]> {\n const result: string[] = [];\n async function visit(directory: string): Promise<void> {\n const pending: Promise<void>[] = [];\n for (const entry of await readdir(directory, { withFileTypes: true })) {\n const file = path.join(directory, entry.name);\n if (entry.isDirectory()) {\n if (!exclude(entry.name)) {\n pending.push(visit(file));\n }\n } else if (isScriptFile(entry.name)) {\n pending.push(\n readFile(file, 'utf8').then((source) => {\n if (hasUseServer(source)) {\n result.push(file.split(path.sep).join('/'));\n }\n }),\n );\n }\n }\n await Promise.all(pending);\n }\n await visit(root);\n return result.toSorted();\n}\n\n/** Finds every script file under a directory that can hold a call of `bridge`. */\nexport async function findBridgeFiles(\n root: string,\n exclude: (directory: string) => boolean,\n): Promise<string[]> {\n const result: string[] = [];\n async function visit(directory: string): Promise<void> {\n const pending: Promise<void>[] = [];\n for (const entry of await readdir(directory, { withFileTypes: true })) {\n const file = path.join(directory, entry.name);\n if (entry.isDirectory()) {\n if (!exclude(entry.name)) {\n pending.push(visit(file));\n }\n } else if (isScriptFile(entry.name)) {\n pending.push(\n readFile(file, 'utf8').then((source) => {\n // The text test is a cheap filter; the parse confirms a bridge that is exported.\n if (mayHaveBridge(source) && hasBridge(source, file)) {\n result.push(file.split(path.sep).join('/'));\n }\n }),\n );\n }\n }\n await Promise.all(pending);\n }\n await visit(root);\n return result.toSorted();\n}\n\n/**\n * Finds every script under a directory, such as `.ts` and `.brm.ts` files, as\n * absolute paths with forward slashes, without reading them.\n */\nexport async function findScripts(\n root: string,\n exclude: (directory: string) => boolean,\n): Promise<string[]> {\n const result: string[] = [];\n async function visit(directory: string): Promise<void> {\n const directories: Promise<void>[] = [];\n for (const entry of await readdir(directory, { withFileTypes: true })) {\n const file = path.join(directory, entry.name);\n if (entry.isDirectory()) {\n if (!exclude(entry.name)) {\n directories.push(visit(file));\n }\n } else if (/\\.[cm]?[jt]sx?$/.test(entry.name) && !entry.name.endsWith('.d.ts')) {\n result.push(file.split(path.sep).join('/'));\n }\n }\n await Promise.all(directories);\n }\n await visit(root);\n return result.toSorted();\n}\n\n/**\n * Reads every `.brm` file under a root, and finds the files that the paths\n * name: a file, or the files under a directory. Without paths, the targets are\n * the whole project. A file outside the root is read too. A path that does not\n * exist throws.\n */\nexport async function collectSources(\n root: string,\n paths: string[],\n): Promise<{ sources: Map<string, string>; targets: string[] }> {\n const project = await findFiles(root, defaultExclude);\n const sources = new Map<string, string>();\n const reads: Promise<string>[] = [];\n for (const file of project) {\n reads.push(readFile(file, 'utf8'));\n }\n const texts = await Promise.all(reads);\n for (const [index, file] of project.entries()) {\n sources.set(file, texts[index]!);\n }\n\n const targets: string[] = paths.length === 0 ? [...project] : [];\n const lookups: Promise<string[]>[] = [];\n for (const target of paths) {\n const absolute = path.resolve(root, target);\n lookups.push(\n stat(absolute).then((info) =>\n info.isDirectory()\n ? findFiles(absolute, defaultExclude)\n : [absolute.split(path.sep).join('/')],\n ),\n );\n }\n for (const found of await Promise.all(lookups)) {\n targets.push(...found);\n }\n const extra: string[] = [];\n const extraReads: Promise<string>[] = [];\n for (const file of targets) {\n if (!sources.has(file)) {\n extra.push(file);\n extraReads.push(readFile(file, 'utf8'));\n }\n }\n const extraTexts = await Promise.all(extraReads);\n for (const [index, file] of extra.entries()) {\n sources.set(file, extraTexts[index]!);\n }\n return { sources, targets };\n}\n"],"mappings":";;;;;;AAoCA,SAAS,QAAQ,MAAsB;CACrC,OAAO,KAAK,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG;AACtC;AAEA,SAAS,SAAS,MAAuC;CACvD,IAAI;EACF,OAAO,KAAK,MAAM,aAAa,MAAM,MAAM,CAAC;CAC9C,QAAQ;EACN;CACF;AACF;;AAGA,SAAgB,qBAAqB,MAAc,MAAkC;CACnF,KAAK,IAAI,YAAY,OAAQ,YAAY,KAAK,QAAQ,SAAS,GAAG;EAChE,MAAM,YAAY,KAAK,KAAK,WAAW,gBAAgB,IAAI;EAC3D,IAAI,WAAW,KAAK,KAAK,WAAW,cAAc,CAAC,GACjD,OAAO,QAAQ,aAAa,SAAS,CAAC;EAExC,IAAI,KAAK,QAAQ,SAAS,MAAM,WAC9B;CAEJ;AACF;;AAGA,SAAS,YAAY,WAAuC;CAC1D,KAAK,IAAI,UAAU,YAAa,UAAU,KAAK,QAAQ,OAAO,GAAG;EAC/D,IAAI,WAAW,KAAK,KAAK,SAAS,cAAc,CAAC,GAC/C,OAAO;EAET,IAAI,KAAK,QAAQ,OAAO,MAAM,SAC5B;CAEJ;AACF;;AAMA,SAAS,gBAAgB,MAAc,OAAgB,MAAoC;CACzF,IAAI,UAAU,MACZ,OAAO,CAAC,IAAI;CAEd,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM;EAC/C,MAAM,EAAE,KAAK,UAAA,MAA6B;EAI1C,IAAI,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GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,CACzC,CACF;CACF;CACA,KAAK,MAAM,SAAS,MAAM,QAAQ,IAAI,OAAO,GAC3C,QAAQ,KAAK,GAAG,KAAK;CAEvB,MAAM,QAAkB,CAAC;CACzB,MAAM,aAAgC,CAAC;CACvC,KAAK,MAAM,QAAQ,SACjB,IAAI,CAAC,QAAQ,IAAI,IAAI,GAAG;EACtB,MAAM,KAAK,IAAI;EACf,WAAW,KAAK,SAAS,MAAM,MAAM,CAAC;CACxC;CAEF,MAAM,aAAa,MAAM,QAAQ,IAAI,UAAU;CAC/C,KAAK,MAAM,CAAC,OAAO,SAAS,MAAM,QAAQ,GACxC,QAAQ,IAAI,MAAM,WAAW,MAAO;CAEtC,OAAO;EAAE;EAAS;CAAQ;AAC5B"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { x as HAS_VIEW_TRANSITIONS } from "./features-Cte5aj20.js";
|
|
1
2
|
//#region src/runtime/html.ts
|
|
2
3
|
const RAW = Symbol.for("brumate.raw");
|
|
3
4
|
const INTERNAL = Symbol.for("brumate.internal");
|
|
@@ -263,15 +264,21 @@ function onValue(on, own) {
|
|
|
263
264
|
]) if (part) parts.push(part);
|
|
264
265
|
return parts.join(" ");
|
|
265
266
|
}
|
|
267
|
+
/** The attributes that mark an element for a view transition, as the compiler writes them. */
|
|
268
|
+
const TRANSITION_NAMES = {
|
|
269
|
+
viewTransition: "b-vt",
|
|
270
|
+
viewTransitionName: "b-vtn"
|
|
271
|
+
};
|
|
266
272
|
/** Renders an object of attributes. */
|
|
267
273
|
function spread(attributes, names = false) {
|
|
268
274
|
let result = "";
|
|
269
275
|
const written = [];
|
|
270
276
|
for (const [name, value] of Object.entries(attributes)) if (name !== "children" && !/^on[A-Z]/.test(name)) {
|
|
271
|
-
const
|
|
277
|
+
const mapped = HAS_VIEW_TRANSITIONS && TRANSITION_NAMES[name] || name;
|
|
278
|
+
const text = attribute(mapped, ownValue(name, value));
|
|
272
279
|
if (text) {
|
|
273
280
|
result += text;
|
|
274
|
-
written.push(
|
|
281
|
+
written.push(mapped);
|
|
275
282
|
}
|
|
276
283
|
}
|
|
277
284
|
return names ? `${result} b-s="${written.join(" ")}"` : result;
|
|
@@ -310,4 +317,4 @@ function actionAttributes(prefix, name, id, method, result, build, key) {
|
|
|
310
317
|
//#endregion
|
|
311
318
|
export { spread as C, vars as E, rawHTML as S, textValue as T, mergeAttributes as _, attribute as a, ownValue as b, classAttribute as c, escapeAttribute as d, handlerEntry as f, isRaw as g, isInternal as h, affix as i, classValue as l, internal as m, VOID_ELEMENTS as n, attributeText as o, insertValue as p, actionAttributes as r, bindEntry as s, Internal as t, escape as u, onAttribute as v, styleElement as w, raw as x, onValue as y };
|
|
312
319
|
|
|
313
|
-
//# sourceMappingURL=html-
|
|
320
|
+
//# sourceMappingURL=html-BYuHDvxy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html-BYuHDvxy.js","names":[],"sources":["../src/runtime/html.ts"],"sourcesContent":["// HTML string helpers that the server and the client both use.\n\nimport { HAS_VIEW_TRANSITIONS } from './features.ts';\nimport type { ScopeId } from './shared.ts';\n\nconst RAW: unique symbol = Symbol.for('brumate.raw');\nconst INTERNAL: unique symbol = Symbol.for('brumate.internal');\n\n/** HTML that is inserted as it is, such as the output of a template. */\nexport interface Raw {\n [RAW]: string;\n /** For the output of a template, the ID of its scope, which the insert links to its call. */\n s?: ScopeId;\n}\n\n// A class, not an object literal, so serializers can skip their test for raw HTML on plain objects.\nclass RawHTML implements Raw {\n readonly [RAW]: string;\n readonly s?: ScopeId;\n\n constructor(html: string, scope?: ScopeId) {\n this[RAW] = html;\n this.s = scope;\n }\n}\n\nexport function raw(html: string, scope?: ScopeId): Raw {\n return new RawHTML(html, scope);\n}\n\nexport function isRaw(value: unknown): value is Raw {\n return typeof value === 'object' && value !== null && RAW in value;\n}\n\nexport function rawHTML(value: Raw): string {\n return value[RAW];\n}\n\nconst ESCAPES: Record<string, string> = { '&': '&', '<': '<', '>': '>', '\"': '"' };\n\nfunction toEscape(char: string): string {\n return ESCAPES[char]!;\n}\n\n// Most text has nothing to escape, so a test without the global flag skips the replace.\nexport function escape(value: string): string {\n return /[&<>]/.test(value) ? value.replace(/[&<>]/g, toEscape) : value;\n}\n\nexport function escapeAttribute(value: string): string {\n return /[&<\"]/.test(value) ? value.replace(/[&<\"]/g, toEscape) : value;\n}\n\n/** True for a promise, or any object with a `then` function, as the server awaits it. */\nfunction isThenable(value: unknown): boolean {\n return (\n value !== null &&\n (typeof value === 'object' || typeof value === 'function') &&\n typeof (value as PromiseLike<unknown>).then === 'function'\n );\n}\n\n/** Renders a value inserted in markup. A promise is not awaited: it renders empty. */\nexport function insertValue(value: unknown): string {\n if (isRaw(value)) {\n return value[RAW];\n }\n // A memo of a promise that is still loading: empty until its value lands.\n if (value === null || value === undefined || typeof value === 'boolean' || isThenable(value)) {\n return '';\n }\n if (Array.isArray(value)) {\n let result = '';\n for (const item of value) {\n result += insertValue(item);\n }\n return result;\n }\n return escape(String(value));\n}\n\n/**\n * Renders a value as the text of an element whose content is text, such as\n * a `<textarea>`, as `insertValue` does but without escaping.\n */\nexport function textValue(value: unknown): string {\n if (isRaw(value)) {\n return value[RAW];\n }\n if (value === null || value === undefined || typeof value === 'boolean' || isThenable(value)) {\n return '';\n }\n if (Array.isArray(value)) {\n let result = '';\n for (const item of value) {\n result += textValue(item);\n }\n return result;\n }\n return String(value);\n}\n\nfunction toKebabCase(name: string): string {\n return name.startsWith('--') ? name : name.replace(/[A-Z]/g, (char) => `-${char.toLowerCase()}`);\n}\n\nexport function classValue(value: unknown): string {\n if (typeof value !== 'object' || value === null) {\n return value ? String(value) : '';\n }\n let text = '';\n if (Array.isArray(value)) {\n for (const item of value) {\n const part = classValue(item);\n if (part !== '') {\n text = text === '' ? part : `${text} ${part}`;\n }\n }\n return text;\n }\n // An empty name still adds a space between its neighbours, as in a join.\n let first = true;\n for (const name in value) {\n if (Object.hasOwn(value, name) && (value as Record<string, unknown>)[name]) {\n text = first ? name : `${text} ${name}`;\n first = false;\n }\n }\n return text;\n}\n\n/**\n * Renders a `class` attribute from classes that each have a space before\n * them, which the compiler builds from a literal class value. The classes\n * are escaped already. No class renders nothing.\n */\nexport function classAttribute(classes: string): string {\n return classes === '' ? '' : ` class=\"${classes.slice(1)}\"`;\n}\n\nfunction styleValue(value: unknown): string {\n if (typeof value === 'object' && value !== null) {\n const declarations: string[] = [];\n for (const [name, item] of Object.entries(value)) {\n if (item !== null && item !== undefined && item !== false) {\n declarations.push(`${toKebabCase(name)}:${String(item)}`);\n }\n }\n return declarations.join(';');\n }\n return String(value);\n}\n\n/** The brand of a binding of `$bind`, under the key of the registry. See `Binding`. */\nconst BOUND = Symbol.for('brumate.binding');\n\n/** The words of an attribute that says `true` or `false` in its value. */\nconst TRUE_FALSE = ['true', 'false'] as const;\n\n/**\n * Attributes whose two states are words in the value, not whether the\n * attribute is there, by their words for `true` and `false`. A missing\n * attribute means a third state, such as the default of the element, so\n * `false` must not remove it. `aria-*` and `data-*` are such attributes too.\n */\nconst SWITCHES = new Map<string, readonly [string, string]>([\n ['contenteditable', TRUE_FALSE],\n ['draggable', TRUE_FALSE],\n ['spellcheck', TRUE_FALSE],\n ['writingsuggestions', TRUE_FALSE],\n // SVG.\n ['focusable', TRUE_FALSE],\n ['translate', ['yes', 'no']],\n ['autocomplete', ['on', 'off']],\n ['autocorrect', ['on', 'off']],\n]);\n\n/** The words of `true` and `false` for an attribute that says them in its value, or undefined. */\nfunction switchWords(name: string): readonly [string, string] | undefined {\n const lower = name.toLowerCase();\n if (lower.startsWith('aria-') || lower.startsWith('data-')) {\n return TRUE_FALSE;\n }\n return SWITCHES.get(lower);\n}\n\n/**\n * Returns the text of an attribute, or undefined if the attribute is not\n * rendered.\n *\n * - `null` and `undefined` leave the attribute out.\n * - For an attribute whose value says its state, such as `aria-expanded`,\n * `draggable` or `translate`, `true` and `false` render as its words:\n * `\"true\"` and `\"false\"`, or `\"yes\"` and `\"no\"`, or `\"on\"` and `\"off\"`.\n * - For other attributes, such as `disabled`, `true` renders the attribute\n * without a value, and `false` leaves it out.\n */\nexport function attributeText(name: string, value: unknown): string | undefined {\n // `value=$bind(name)` on an element renders the value of the name.\n if (typeof value === 'object' && value !== null && BOUND in value) {\n // A `ref` is no attribute: the element goes to its signal.\n if (name === 'ref') {\n return undefined;\n }\n value = (value as unknown as { value: unknown }).value;\n }\n // A promise is a memo that is still loading: the attribute is absent until its value lands.\n if (value === null || value === undefined || typeof value === 'function' || isThenable(value)) {\n return undefined;\n }\n if (typeof value === 'boolean') {\n const words = switchWords(name);\n if (words) {\n return value ? words[0] : words[1];\n }\n return value ? '' : undefined;\n }\n if (name === 'class') {\n const text = classValue(value);\n return text === '' ? undefined : text;\n }\n return name === 'style' ? styleValue(value) : String(value);\n}\n\n/**\n * A name that HTML reads as one attribute. A spread takes its names from\n * data, so a name with a space, a quote, `>`, `/` or `=` could write other\n * attributes or markup.\n */\n// oxlint-disable-next-line no-control-regex -- HTML reads no control character in a name.\nconst ATTRIBUTE_NAME = /^[^\\s\"'>/=\\x00-\\x1f\\x7f]+$/;\n\n/** Renders one attribute, with a leading space. A name that is not one attribute renders nothing. */\nexport function attribute(name: string, value: unknown): string {\n const text = attributeText(name, value);\n if (text === undefined || !ATTRIBUTE_NAME.test(name)) {\n return '';\n }\n return value === true && text === '' ? ` ${name}` : ` ${name}=\"${escapeAttribute(text)}\"`;\n}\n\n/**\n * Returns the value of a style variable with text around it, such as `12px`\n * for `${size}px`. A value that sets no variable stays as it is.\n */\nexport function affix(prefix: string, value: unknown, suffix: string): unknown {\n return value === null || value === undefined || value === false\n ? value\n : `${prefix}${String(value)}${suffix}`;\n}\n\n/** Returns a style with custom properties before an element's own style. */\nexport function vars(variables: Record<string, unknown>, own: unknown): string {\n const parts: string[] = [];\n for (const [name, value] of Object.entries(variables)) {\n if (value !== null && value !== undefined && value !== false) {\n parts.push(`${name}:${String(value)}`);\n }\n }\n const rest = own === null || own === undefined || own === false ? '' : styleValue(own);\n if (rest) {\n parts.push(rest);\n }\n return parts.join(';');\n}\n\n/** Returns a `<style>` element for a component's stylesheet. */\nexport function styleElement(id: string, css: string, nonce?: string): string {\n const extra = nonce === undefined ? '' : ` nonce=\"${escapeAttribute(nonce)}\"`;\n return `<style${extra} b-style=\"${escapeAttribute(id)}\">${css.replace(/<\\/style/gi, '<\\\\/style')}</style>`;\n}\n\n/**\n * Merges the attributes of an element that has spreads, in their order: a\n * later value wins, except `class`, whose values all apply.\n */\n/**\n * A value of an attribute that brumate writes, such as the `b-on` of a dynamic tag, which the\n * compiler wraps. An object of attributes, such as a spread, writes a `b-` attribute only with\n * one, so data from outside the app cannot name handlers or scopes.\n */\nexport class Internal {\n readonly value: unknown;\n\n constructor(value: unknown) {\n this.value = value;\n }\n}\n\n// The brand sits on the prototype, so an instance does not carry a field for it.\n(Internal.prototype as unknown as Record<symbol, boolean>)[INTERNAL] = true;\n\n/** True for an `Internal`, also one that another copy of the runtime made. */\nexport function isInternal(value: unknown): value is Internal {\n return typeof value === 'object' && value !== null && INTERNAL in value;\n}\n\n/** Wraps the value of an attribute that brumate writes. See `Internal`. */\nexport function internal(value: unknown): Internal {\n return new Internal(value);\n}\n\n/** The value of an attribute of an object, or undefined for a `b-` attribute from outside. */\nexport function ownValue(name: string, value: unknown): unknown {\n if (isInternal(value)) {\n return value.value;\n }\n return name.startsWith('b-') ? undefined : value;\n}\n\nexport function mergeAttributes(\n parts: Record<string, unknown>[],\n variables?: Record<string, unknown>,\n): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n for (const part of parts) {\n for (const [name, value] of Object.entries(part ?? {})) {\n // A `b-` attribute from outside the app does not take the place of brumate's own.\n if (name.startsWith('b-') && !isInternal(value)) {\n continue;\n }\n result[name] =\n name === 'class' && result.class !== undefined && value !== undefined\n ? [result.class, value]\n : value;\n }\n }\n // The style variables of the component come before the style that won, whoever gave it.\n if (variables) {\n result.style = vars(variables, result.style);\n }\n return result;\n}\n\n/**\n * The `b-on` entry of a handler that a spread passes on, such as\n * `click:prevent=Parent#h1@3`: its event, the modifiers of its wrappers, its\n * client function and the scope it runs in. A handler that `$handler` made\n * has its arguments after another `@`, encoded so that they hold no space.\n */\nexport function handlerEntry(\n name: string,\n ref: string,\n scope: number | string,\n modifiers: readonly string[] = [],\n args?: unknown[],\n): string {\n const bound = args === undefined ? '' : `@${encodeURIComponent(JSON.stringify(args))}`;\n return `${[name.slice(2).toLowerCase(), ...modifiers].join(':')}=${ref}@${scope}${bound}`;\n}\n\n/**\n * The `b-on` entry of a binding that a spread puts on `value` or `checked`\n * of an element. It names the scope of the slot, or of the setter of\n * `$bind(name, fn)`, after `@`. A box writes on `change`.\n */\nexport function bindEntry(\n name: string,\n ref: { scope: number | string; slot: number },\n setter?: { ref: string; scope: number | string },\n): string {\n const event = name === 'checked' ? 'change' : 'input';\n return setter\n ? `${event}=$set:${setter.ref}@${setter.scope}`\n : `${event}=$bind#0.${ref.slot}@${ref.scope}`;\n}\n\n/**\n * The `b-on` attribute of an element with spreads: the bindings of its\n * spreads, so its handlers read the new value, then its own handlers, then\n * those of its spreads.\n */\nexport function onAttribute(on: string[], own: string): string {\n const value = onValue(on, own);\n return value ? ` b-on=\"${escapeAttribute(value)}\"` : '';\n}\n\n/** The value of `b-on`, in the order of `onAttribute`. */\nexport function onValue(on: string[], own: string): string {\n const bindings: string[] = [];\n const rest: string[] = [];\n for (const entry of on) {\n if (/=\\$(bind#|set:)/.test(entry)) {\n bindings.push(entry);\n } else {\n rest.push(entry);\n }\n }\n const parts: string[] = [];\n for (const part of [...bindings, own, ...rest]) {\n if (part) {\n parts.push(part);\n }\n }\n return parts.join(' ');\n}\n\n/** The attributes that mark an element for a view transition, as the compiler writes them. */\nconst TRANSITION_NAMES: Record<string, string> = {\n viewTransition: 'b-vt',\n viewTransitionName: 'b-vtn',\n};\n\n/** Renders an object of attributes. */\nexport function spread(attributes: Record<string, unknown>, names = false): string {\n let result = '';\n const written: string[] = [];\n for (const [name, value] of Object.entries(attributes)) {\n if (name !== 'children' && !/^on[A-Z]/.test(name)) {\n // A prop that `{...rest}` passes on marks the element as the attribute would.\n const mapped = (HAS_VIEW_TRANSITIONS && TRANSITION_NAMES[name]) || name;\n const text = attribute(mapped, ownValue(name, value));\n if (text) {\n result += text;\n written.push(mapped);\n }\n }\n }\n // `b-s` names the attributes of a spread that changes in the browser. Its first update there\n // removes only those, so a spread that wrote none still writes it, empty.\n return names ? `${result} b-s=\"${written.join(' ')}\"` : result;\n}\n\nexport const VOID_ELEMENTS: Set<string> = new Set([\n 'area',\n 'base',\n 'br',\n 'col',\n 'embed',\n 'hr',\n 'img',\n 'input',\n 'link',\n 'meta',\n 'source',\n 'track',\n 'wbr',\n]);\n\n/**\n * Renders the attributes of a form that posts to a server function, such as\n * ` action=\"/_brumate/App_1abc%23save\" method=\"post\"`. `method` is the name of\n * the method attribute to add, if the element has none. `build` is the ID\n * of the build of the page, which the URL carries as `__build`, so the\n * server can tell a post from before a deploy without scripts.\n */\nexport function actionAttributes(\n prefix: string,\n name: string,\n id: string,\n method?: string,\n result?: string,\n build?: string,\n key?: string,\n): string {\n const methodText = method ? ` ${method}=\"post\"` : '';\n // The key of a form of a function that `idempotent` made, so a second post gets the first result.\n const params: string[] = [];\n if (build !== undefined) {\n params.push(`__build=${encodeURIComponent(build)}`);\n }\n if (key !== undefined) {\n params.push(`__key=${key}`);\n }\n const query = params.join('&');\n if (result !== undefined) {\n // The form posts to its page, which renders with the result. With the\n // loader, the result is written into the `$action` at `result` instead.\n const url = `?__action=${encodeURIComponent(id)}${query ? `&${query}` : ''}`;\n return ` ${name}=\"${escapeAttribute(url)}\"${methodText} b-action=\"${escapeAttribute(id)}\" b-result=\"${escapeAttribute(result)}\"`;\n }\n const url = `${prefix}/${encodeURIComponent(id)}${query ? `?${query}` : ''}`;\n return ` ${name}=\"${escapeAttribute(url)}\"${methodText}`;\n}\n"],"mappings":";;AAKA,MAAM,MAAqB,OAA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AGhI,OAAO,IAAI,KAAK,IAAI,gBAAgB,GADrB,OAAO,GAAG,mBAAmB,EAAE,IAAI,QAAQ,IAAI,UAAU,IACjC,EAAE,GAAG;AAC9C"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1355,6 +1355,21 @@ interface ElementNode extends Range {
|
|
|
1355
1355
|
tag: string;
|
|
1356
1356
|
attributes: Attribute[];
|
|
1357
1357
|
children: Markup[];
|
|
1358
|
+
/** For a `<script src>` or `<script inline>` in markup. */
|
|
1359
|
+
script?: ScriptMark;
|
|
1360
|
+
}
|
|
1361
|
+
/** When a script of markup runs, as its `trigger` writes it. */
|
|
1362
|
+
type ScriptTrigger = "idle" | "visible" | "interaction" | "load";
|
|
1363
|
+
/**
|
|
1364
|
+
* The marks of a `<script>` in markup. Its `trigger` and `inline` attributes stay in
|
|
1365
|
+
* `attributes`, so the type check reads them, and the render leaves them out. An `inline`
|
|
1366
|
+
* script has one text child, which is code that the compiler does not read.
|
|
1367
|
+
*/
|
|
1368
|
+
interface ScriptMark {
|
|
1369
|
+
trigger: ScriptTrigger | undefined;
|
|
1370
|
+
inline: boolean;
|
|
1371
|
+
/** True inside `#head`, where a script without a trigger is an element that runs as it is. */
|
|
1372
|
+
head: boolean;
|
|
1358
1373
|
}
|
|
1359
1374
|
interface ComponentNode extends Range {
|
|
1360
1375
|
kind: "component";
|
|
@@ -1574,6 +1589,32 @@ declare function bodyTree(file: SFCFile): Map<Body, BodyInfo>;
|
|
|
1574
1589
|
*/
|
|
1575
1590
|
declare function fileBody(file: SFCFile): Body;
|
|
1576
1591
|
//#endregion
|
|
1592
|
+
//#region src/modules.d.ts
|
|
1593
|
+
/** A module of reactive logic, read by its path. */
|
|
1594
|
+
interface ReactiveModule {
|
|
1595
|
+
/** The absolute path of the module. */
|
|
1596
|
+
path: string;
|
|
1597
|
+
source: string;
|
|
1598
|
+
}
|
|
1599
|
+
/** Finds a module that a file imports, or returns undefined if it cannot. */
|
|
1600
|
+
type ResolveModule = (specifier: string, importer: string) => ReactiveModule | undefined;
|
|
1601
|
+
/** What a name of a module function is in the component that calls it. */
|
|
1602
|
+
type CallName = {
|
|
1603
|
+
name: string;
|
|
1604
|
+
} | {
|
|
1605
|
+
literal: string;
|
|
1606
|
+
};
|
|
1607
|
+
//#endregion
|
|
1608
|
+
//#region src/module-signals.d.ts
|
|
1609
|
+
/** The code of a module with its signals and memos compiled, or undefined when it has none. */
|
|
1610
|
+
export declare function transformModuleSignals(module: ReactiveModule, resolve?: ResolveModule): string | undefined;
|
|
1611
|
+
/** A name of a component that reads a module signal. */
|
|
1612
|
+
interface SignalName {
|
|
1613
|
+
/** The module that the name is imported from. Undefined for a signal of `<script module>`. */
|
|
1614
|
+
specifier?: string;
|
|
1615
|
+
memo: boolean;
|
|
1616
|
+
}
|
|
1617
|
+
//#endregion
|
|
1577
1618
|
//#region src/model.d.ts
|
|
1578
1619
|
type ScopeKind = "module" | "component" | "body" | "template";
|
|
1579
1620
|
interface Scope {
|
|
@@ -1631,6 +1672,11 @@ interface Declaration {
|
|
|
1631
1672
|
* a guess, until the source changes or the server calls of the page finish.
|
|
1632
1673
|
*/
|
|
1633
1674
|
optimistic?: Declaration;
|
|
1675
|
+
/**
|
|
1676
|
+
* For a `$store` of an imported memo of a module, true: the memo can throw, and the slot then
|
|
1677
|
+
* holds the error, so each read of it throws as a read of a memo does.
|
|
1678
|
+
*/
|
|
1679
|
+
moduleMemo?: boolean;
|
|
1634
1680
|
/**
|
|
1635
1681
|
* For `$debounced(value, ms)` and `$throttled(value, ms)`, how the browser
|
|
1636
1682
|
* writes the memo: after the value stops changing for `ms`, or at most once every `ms`.
|
|
@@ -1814,7 +1860,7 @@ declare function upstreamMemos(declaration: Declaration): Declaration[];
|
|
|
1814
1860
|
export declare function lookup(scope: Scope, name: string): Declaration | undefined;
|
|
1815
1861
|
//#endregion
|
|
1816
1862
|
//#region src/analyze.d.ts
|
|
1817
|
-
export declare function analyze(file: SFCFile): SemanticModel;
|
|
1863
|
+
export declare function analyze(file: SFCFile, moduleSignals?: ReadonlyMap<string, SignalName>): SemanticModel;
|
|
1818
1864
|
//#endregion
|
|
1819
1865
|
//#region src/error-catalog.d.ts
|
|
1820
1866
|
/** One compile error of a `.brm` file. */
|
|
@@ -2049,6 +2095,10 @@ interface Plan {
|
|
|
2049
2095
|
symbol: string;
|
|
2050
2096
|
scope: Scope;
|
|
2051
2097
|
}>;
|
|
2098
|
+
/** True when the markup holds a `<script src>` or `<script inline>`, which the emit sets. */
|
|
2099
|
+
scripts: boolean;
|
|
2100
|
+
/** True when markup holds `viewTransition` or `viewTransitionName`, which the emit sets. */
|
|
2101
|
+
viewTransitions: boolean;
|
|
2052
2102
|
/**
|
|
2053
2103
|
* The component whose children hold a block, for the blocks in children. The browser renders
|
|
2054
2104
|
* the new bodies of such a block with the contexts of that component, as the server does.
|
|
@@ -2068,12 +2118,17 @@ interface Plan {
|
|
|
2068
2118
|
liveBlocks: Set<Body>;
|
|
2069
2119
|
/** True when server function IDs hash the names of the functions. */
|
|
2070
2120
|
hideNames: boolean;
|
|
2121
|
+
/**
|
|
2122
|
+
* True when the stylesheet is a style module of its own (`styleFiles`), so the render and
|
|
2123
|
+
* server modules leave it out.
|
|
2124
|
+
*/
|
|
2125
|
+
styleFiles: boolean;
|
|
2071
2126
|
/** Errors in markup that the client could not update. */
|
|
2072
2127
|
diagnostics: Diagnostic[];
|
|
2073
2128
|
}
|
|
2074
2129
|
/** Returns the component name for a file name, such as `TodoList` for `todo-list.brm`. */
|
|
2075
2130
|
export declare function getComponentName(filename: string): string;
|
|
2076
|
-
export declare function createPlan(file: SFCFile, graph: Graph, path?: string, hideNames?: boolean): Plan;
|
|
2131
|
+
export declare function createPlan(file: SFCFile, graph: Graph, path?: string, hideNames?: boolean, styleFiles?: boolean): Plan;
|
|
2077
2132
|
//#endregion
|
|
2078
2133
|
//#region src/env-check.d.ts
|
|
2079
2134
|
/**
|
|
@@ -2082,22 +2137,6 @@ export declare function createPlan(file: SFCFile, graph: Graph, path?: string, h
|
|
|
2082
2137
|
*/
|
|
2083
2138
|
type EnvImport = (specifier: string, name: string) => string[] | undefined;
|
|
2084
2139
|
//#endregion
|
|
2085
|
-
//#region src/modules.d.ts
|
|
2086
|
-
/** A module of reactive logic, read by its path. */
|
|
2087
|
-
interface ReactiveModule {
|
|
2088
|
-
/** The absolute path of the module. */
|
|
2089
|
-
path: string;
|
|
2090
|
-
source: string;
|
|
2091
|
-
}
|
|
2092
|
-
/** Finds a module that a file imports, or returns undefined if it cannot. */
|
|
2093
|
-
type ResolveModule = (specifier: string, importer: string) => ReactiveModule | undefined;
|
|
2094
|
-
/** What a name of a module function is in the component that calls it. */
|
|
2095
|
-
type CallName = {
|
|
2096
|
-
name: string;
|
|
2097
|
-
} | {
|
|
2098
|
-
literal: string;
|
|
2099
|
-
};
|
|
2100
|
-
//#endregion
|
|
2101
2140
|
//#region src/sourcemap.d.ts
|
|
2102
2141
|
/** A source map, version 3. */
|
|
2103
2142
|
interface SourceMap {
|
|
@@ -2158,6 +2197,19 @@ interface CompileOptions {
|
|
|
2158
2197
|
* name, so the browser does not see it. The Vite plugin sets it in builds.
|
|
2159
2198
|
*/
|
|
2160
2199
|
hideNames?: boolean;
|
|
2200
|
+
/**
|
|
2201
|
+
* The stylesheet is a CSS module of its own, which the Vite plugin serves as
|
|
2202
|
+
* `<file>?brumate-style&lang.css` in builds, so Vite's CSS pipeline makes it into the stylesheet
|
|
2203
|
+
* of a bundle. The render and server modules then leave it out: they write no `$$css` and
|
|
2204
|
+
* call no `style`. The CSS is in `css` of the result.
|
|
2205
|
+
*/
|
|
2206
|
+
styleFiles?: boolean;
|
|
2207
|
+
/**
|
|
2208
|
+
* The CSS of the component after a CSS pipeline, which replaces the scoped CSS that the compiler
|
|
2209
|
+
* wrote. The Vite plugin runs the project's PostCSS or Lightning CSS on the CSS of a first
|
|
2210
|
+
* compile, and compiles again with the result, where the CSS stays inline (the dev server).
|
|
2211
|
+
*/
|
|
2212
|
+
css?: string;
|
|
2161
2213
|
/**
|
|
2162
2214
|
* Reads a module of reactive logic, such as `./counter.brm.ts`, that the
|
|
2163
2215
|
* component imports. Defaults to reading it from disk next to `path`.
|
|
@@ -2372,5 +2424,5 @@ export declare function inspect(source: string, options?: InspectOptions): {
|
|
|
2372
2424
|
text: string;
|
|
2373
2425
|
};
|
|
2374
2426
|
//#endregion
|
|
2375
|
-
export type { AnchorTarget, Attribute, Block, Body, BodyInfo, Branch, CheckMapping, CheckOutput, ClientBlock, ClientTrigger, CompileOptions, CompileResult, ComponentNode, ComponentUsage, ComputedAttribute, Declaration, DeclarationKind, DeferBlock, Diagnostic, DynamicTagNode, Edge, ElementNode, ErrorEntry, EventAttribute, Expression, ForBlock, FragmentNode, GlobalListenerNode, Graph, GraphNode, GraphOptions, HeadBlock, IfBlock, InsertNode, InspectEntry, InspectOptions, InspectReport, KeyBlock, LoadingBlock, Location, Markup, OffscreenBlock, ParseOptions, Plan, PortalBlock, ProjectProps, Range, ReactiveModule, RefAttribute, Reference, RepeatBlock, Resolve, ResolveModule, Reveal, RevealOrder, SFCFile, Scope, ScopeKind, ScopePlan, Script, SemanticModel, Severity, SharedSite, Site, SiteKind, SourceMap, SpreadAttribute, StaticAttribute, Style, SwitchBlock, TemplateDecl, TextNode, TryBlock, ValueAttribute, blockBodies, bodyTree, fileBody, forEachNode, getChildren, upstreamMemos };
|
|
2427
|
+
export type { AnchorTarget, Attribute, Block, Body, BodyInfo, Branch, CheckMapping, CheckOutput, ClientBlock, ClientTrigger, CompileOptions, CompileResult, ComponentNode, ComponentUsage, ComputedAttribute, Declaration, DeclarationKind, DeferBlock, Diagnostic, DynamicTagNode, Edge, ElementNode, ErrorEntry, EventAttribute, Expression, ForBlock, FragmentNode, GlobalListenerNode, Graph, GraphNode, GraphOptions, HeadBlock, IfBlock, InsertNode, InspectEntry, InspectOptions, InspectReport, KeyBlock, LoadingBlock, Location, Markup, OffscreenBlock, ParseOptions, Plan, PortalBlock, ProjectProps, Range, ReactiveModule, RefAttribute, Reference, RepeatBlock, Resolve, ResolveModule, Reveal, RevealOrder, SFCFile, Scope, ScopeKind, ScopePlan, Script, ScriptMark, ScriptTrigger, SemanticModel, Severity, SharedSite, Site, SiteKind, SourceMap, SpreadAttribute, StaticAttribute, Style, SwitchBlock, TemplateDecl, TextNode, TryBlock, ValueAttribute, blockBodies, bodyTree, fileBody, forEachNode, getChildren, upstreamMemos };
|
|
2376
2428
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as findError, i as errorLink } from "./error-catalog-
|
|
2
|
-
import { A as
|
|
1
|
+
import { a as findError, i as errorLink } from "./error-catalog-BBWB7w-E.js";
|
|
2
|
+
import { A as unmarked, B as buildGraph, G as lookup, L as resolveRelative, N as analyzeProject, P as analyzeProjectProps, R as summarize, U as analyze, V as blockBodies, W as isWithin, _ as getComponentName, b as generateShared, d as generateServer$1, et as getPatternNames, h as createPlan, i as report, l as generateClient$1, m as clientState, n as formatReport, nt as getLocation, o as CompileError, r as inspect, s as compile, tt as BrumateError, u as generateRender$1, w as transformModuleSignals, x as sharedSites, y as SHARED_QUERY, z as parse } from "./inspect-fpaBJ5pm.js";
|
|
3
3
|
//#region src/print.ts
|
|
4
4
|
function at(source, range) {
|
|
5
5
|
const { line, column } = getLocation(source, range.start);
|
|
@@ -1250,6 +1250,6 @@ function toTypeScript(source, filename = "Component.brm") {
|
|
|
1250
1250
|
};
|
|
1251
1251
|
}
|
|
1252
1252
|
//#endregion
|
|
1253
|
-
export { BrumateError, CompileError, SHARED_QUERY, analyze, analyzeProject, analyzeProjectProps, buildGraph, compile, createPlan, errorLink, findError, formatReport, generateClient, generateRender, generateServer, generateShared, getComponentName, getLocation, inspect, isWithin, lookup, parse, printAST, printGraph, printModel, report, resolveRelative, sharedSites, summarize, toTypeScript };
|
|
1253
|
+
export { BrumateError, CompileError, SHARED_QUERY, analyze, analyzeProject, analyzeProjectProps, buildGraph, compile, createPlan, errorLink, findError, formatReport, generateClient, generateRender, generateServer, generateShared, getComponentName, getLocation, inspect, isWithin, lookup, parse, printAST, printGraph, printModel, report, resolveRelative, sharedSites, summarize, toTypeScript, transformModuleSignals };
|
|
1254
1254
|
|
|
1255
1255
|
//# sourceMappingURL=index.js.map
|