@teacss/engine 0.9.4 → 0.10.2

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.
@@ -0,0 +1,80 @@
1
+ import { Engine } from "../binding.js";
2
+ import type { GenerateResult, LoadProjectFromRootResult, OutputToCssLayersOptions, PresetIconsOptions, PresetStandardOptions, SourceMap, StaticConfig, TransformResult } from "../contract.js";
3
+ /** v10.2 §2.1: a shell's static options. Every field but `minify` maps 1:1 onto `LoadProjectFromRootRequest`. */
4
+ export interface ShellOptions {
5
+ /** Default `process.cwd()`. */
6
+ root?: string;
7
+ entry?: string;
8
+ inline?: StaticConfig;
9
+ /** Default "build". */
10
+ envMode?: "dev" | "build";
11
+ /** Default "warn". */
12
+ unmatched?: "warn" | "error" | "off";
13
+ outputToCssLayers?: boolean | OutputToCssLayersOptions;
14
+ shortcutsLayer?: string;
15
+ presetOptions?: {
16
+ standard?: PresetStandardOptions;
17
+ icons?: PresetIconsOptions;
18
+ };
19
+ /** Default for `Project.css()`: `envMode === "build"`. */
20
+ minify?: boolean;
21
+ }
22
+ export type Edit = TransformResult["edits"][number];
23
+ export interface SourceDirectory {
24
+ /** Absolute path. */
25
+ dir: string;
26
+ /** The rest of the `@source` glob, relative to `dir`. */
27
+ glob: string;
28
+ }
29
+ export interface UnmatchedReport {
30
+ /** The tokens `result` was generated from; default `engine.allTokens()`, what `css()` generates. */
31
+ tokens?: readonly string[];
32
+ /** The host's warning logger. */
33
+ warn(message: string): void;
34
+ }
35
+ /** v10.2 §2.2: what the shells share on top of the binding. */
36
+ export interface Project {
37
+ readonly engine: Engine;
38
+ readonly root: string;
39
+ /** The latest `loadProjectFromRoot` result; `entryPath` is null when the root has no entry. */
40
+ readonly info: LoadProjectFromRootResult;
41
+ /** Runs `loadProjectFromRoot` again; returns whether the programKey changed. */
42
+ reload(): boolean;
43
+ /** `configFiles()` plus `info.sourceFiles`, sorted and deduplicated. */
44
+ watchFiles(): string[];
45
+ /**
46
+ * Where each included `@source` glob can match a file that does not exist yet: the directory before its
47
+ * first glob segment, with the rest of the glob. Sorted by directory; hosts watch these for new files.
48
+ */
49
+ sourceDirectories(): SourceDirectory[];
50
+ /** The tokens of `inline.content.inline`, each item extracted under its id (default `inline:<index>`). */
51
+ inlineTokens(): string[];
52
+ /** `transformStylesheet` for a CSS id, otherwise `transformSource` then `updateModule`. */
53
+ transform(id: string, code: string): {
54
+ code: string;
55
+ map: SourceMap | null;
56
+ changed: boolean;
57
+ };
58
+ /** Ids registered through `transform`, in first-seen order. */
59
+ modules(): string[];
60
+ /** Forgets a module `transform` registered (`engine.removeModule`); returns whether its tokens or definitions changed. */
61
+ removeModule(id: string): boolean;
62
+ /** `generate({ kind: "all" })` with `minify` defaulting to the option; `extendedInfo` fills `matchedInfo`. */
63
+ css(options?: {
64
+ minify?: boolean;
65
+ extendedInfo?: boolean;
66
+ }): GenerateResult;
67
+ /**
68
+ * Applies the `unmatched` option to `result`: the near-miss tokens `diagnoseUnmatched` keeps are
69
+ * warned about once per project with "warn" (and with "error" in dev), and throw `E_UNMATCHED`
70
+ * with "error" in a build. "off" reports nothing.
71
+ */
72
+ reportUnmatched(result: GenerateResult, report: UnmatchedReport): void;
73
+ dispose(): void;
74
+ }
75
+ export declare function createProject(options: ShellOptions): Project;
76
+ /** Splices v02.2 §3 edits (UTF-16 offsets, ascending, non-overlapping) into `code`. */
77
+ export declare function replayEdits(code: string, edits: readonly Edit[]): string;
78
+ export declare const CSS_PLACEHOLDER: string;
79
+ export declare function isCssId(id: string): boolean;
80
+ //# sourceMappingURL=project.d.ts.map
@@ -0,0 +1,136 @@
1
+ import { dirname, isAbsolute, resolve } from "node:path";
2
+ import { Engine, markers } from "../binding.js";
3
+ import { TeacssEngineError } from "./errors.js";
4
+ class ShellProject {
5
+ engine = new Engine();
6
+ root;
7
+ #request;
8
+ #minify;
9
+ #modules = new Set();
10
+ #warnedUnmatched = new Set();
11
+ #info;
12
+ constructor(options) {
13
+ const { minify, root = process.cwd(), envMode = "build", unmatched = "warn", ...rest } = options;
14
+ this.root = root;
15
+ this.#request = { ...rest, root, envMode, unmatched };
16
+ this.#minify = minify ?? envMode === "build";
17
+ this.#info = this.engine.loadProjectFromRoot(this.#request);
18
+ }
19
+ get info() {
20
+ return this.#info;
21
+ }
22
+ reload() {
23
+ this.#info = this.engine.loadProjectFromRoot(this.#request);
24
+ return this.#info.changed;
25
+ }
26
+ watchFiles() {
27
+ return [...new Set([...this.engine.configFiles(), ...this.#info.sourceFiles])].sort();
28
+ }
29
+ sourceDirectories() {
30
+ const { entryPath } = this.#info;
31
+ if (entryPath === null)
32
+ return [];
33
+ const { sources } = this.engine.inspectEntry({ root: this.root, entryPath });
34
+ return sources
35
+ .filter((source) => !source.startsWith("!"))
36
+ .map((source) => splitGlob(this.root, source))
37
+ .sort((a, b) => (a.dir < b.dir ? -1 : a.dir > b.dir ? 1 : 0));
38
+ }
39
+ inlineTokens() {
40
+ const tokens = new Set();
41
+ for (const [index, item] of (this.#request.inline?.content?.inline ?? []).entries()) {
42
+ const { code, id } = typeof item === "string" ? { code: item, id: null } : item;
43
+ for (const token of this.engine.extract(code, id ?? `inline:${index}`))
44
+ tokens.add(token);
45
+ }
46
+ return [...tokens];
47
+ }
48
+ transform(id, code) {
49
+ if (isCssId(id)) {
50
+ const result = this.engine.transformStylesheet(id, code);
51
+ return result ? { code: result.code, map: result.map, changed: result.edits.length > 0 } : { code, map: null, changed: false };
52
+ }
53
+ const result = this.engine.transformSource(id, code);
54
+ const next = result?.code ?? code;
55
+ const update = this.engine.updateModule(id, next);
56
+ this.#modules.add(id);
57
+ return { code: next, map: result?.map ?? null, changed: (result?.edits.length ?? 0) > 0 || update.changed };
58
+ }
59
+ modules() {
60
+ return [...this.#modules];
61
+ }
62
+ removeModule(id) {
63
+ this.#modules.delete(id);
64
+ return this.engine.removeModule(id);
65
+ }
66
+ css(options) {
67
+ return this.engine.generate({ kind: "all" }, { minify: options?.minify ?? this.#minify, extendedInfo: options?.extendedInfo, css: true });
68
+ }
69
+ reportUnmatched(result, report) {
70
+ const { unmatched, envMode } = this.#request;
71
+ if (unmatched === "off")
72
+ return;
73
+ const matched = new Set(result.matched === "" ? [] : result.matched.split("\0"));
74
+ const tokens = report.tokens ?? this.engine.allTokens();
75
+ const diagnosed = this.engine.diagnoseUnmatched(tokens.filter((token) => !matched.has(token)));
76
+ if (diagnosed.length === 0)
77
+ return;
78
+ if (unmatched === "error" && envMode === "build") {
79
+ const plural = diagnosed.length === 1 ? "" : "s";
80
+ throw new TeacssEngineError("E_UNMATCHED", `[@teacss/engine] ${diagnosed.length} token${plural} matched no rule: ${diagnosed.map(describeUnmatched).join("; ")}`, { diagnostics: diagnosed });
81
+ }
82
+ for (const diagnostic of diagnosed) {
83
+ if (this.#warnedUnmatched.has(diagnostic.token))
84
+ continue;
85
+ this.#warnedUnmatched.add(diagnostic.token);
86
+ report.warn(`unmatched token ${describeUnmatched(diagnostic)}`);
87
+ }
88
+ }
89
+ dispose() {
90
+ this.engine.dispose();
91
+ }
92
+ }
93
+ /** The text of `teacss build --unmatched error`: `"token"`, plus `(did you mean "a", "b"?)` when there are suggestions. */
94
+ function describeUnmatched({ token, suggestions }) {
95
+ const quoted = `"${token}"`;
96
+ return suggestions.length === 0 ? quoted : `${quoted} (did you mean ${suggestions.map((suggestion) => `"${suggestion}"`).join(", ")}?)`;
97
+ }
98
+ const GLOB_SEGMENT = /[*?[\]{}\\]/;
99
+ /**
100
+ * `glob` (relative to `root`, or absolute) split before its first segment with glob syntax; a plain path splits before its file name.
101
+ * As the engine's `static_base`: an absolute base at the filesystem root is clamped to `root`, the tree the engine scans instead.
102
+ */
103
+ function splitGlob(root, glob) {
104
+ const segments = glob.split("/");
105
+ const first = segments.findIndex((segment) => GLOB_SEGMENT.test(segment));
106
+ const at = first === -1 ? segments.length - 1 : first;
107
+ const rest = segments.slice(at).join("/");
108
+ const base = segments.slice(0, at).join("/");
109
+ if (!isAbsolute(glob))
110
+ return { dir: resolve(root, base), glob: rest };
111
+ const dir = resolve(base || "/");
112
+ return { dir: dirname(dir) === dir ? root : dir, glob: rest };
113
+ }
114
+ export function createProject(options) {
115
+ return new ShellProject(options);
116
+ }
117
+ /** Splices v02.2 §3 edits (UTF-16 offsets, ascending, non-overlapping) into `code`. */
118
+ export function replayEdits(code, edits) {
119
+ let out = "";
120
+ let cursor = 0;
121
+ for (const [index, { start, end, text }] of edits.entries()) {
122
+ if (start < cursor || end < start || end > code.length) {
123
+ throw new TeacssEngineError("E_INVALID_ARGUMENT", `[@teacss/engine] replayEdits: edits[${index}] (${start}, ${end}) overlaps the previous edit or leaves the code (length ${code.length})`, { path: `edits[${index}]`, start, end });
124
+ }
125
+ out += code.slice(cursor, start) + text;
126
+ cursor = end;
127
+ }
128
+ return out + code.slice(cursor);
129
+ }
130
+ export const CSS_PLACEHOLDER = markers().cssPlaceholder;
131
+ // same as teacss-ts core isCssId
132
+ const cssIdMatcher = /\.(css|postcss|sass|scss|less|stylus|styl)($|\?)/;
133
+ export function isCssId(id) {
134
+ return cssIdMatcher.test(id);
135
+ }
136
+ //# sourceMappingURL=project.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@teacss/engine",
3
- "version": "0.9.4",
4
- "description": "In-process Rust engine for TeaCSS 0.9 (napi-rs binding and 0.8.x-compatible facade)",
3
+ "version": "0.10.2",
4
+ "description": "In-process Rust engine for TeaCSS (napi-rs binding, contract types and the project helper the shells share)",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "repository": {
@@ -21,14 +21,6 @@
21
21
  "types": "./binding.d.ts",
22
22
  "default": "./binding.js"
23
23
  },
24
- "./facade": {
25
- "types": "./dist/index.d.ts",
26
- "default": "./dist/index.js"
27
- },
28
- "./select": {
29
- "types": "./dist/select.d.ts",
30
- "default": "./dist/select.js"
31
- },
32
24
  "./package.json": "./package.json"
33
25
  },
34
26
  "imports": {
@@ -41,11 +33,12 @@
41
33
  "binding-header.d.ts",
42
34
  "dist/**/*.js",
43
35
  "dist/**/*.d.ts",
44
- "README.md"
36
+ "README.md",
37
+ "LICENSE"
45
38
  ],
46
39
  "sideEffects": false,
47
40
  "engines": {
48
- "node": ">=22.12.0"
41
+ "node": ">=26"
49
42
  },
50
43
  "napi": {
51
44
  "binaryName": "teacss-engine",
@@ -59,45 +52,23 @@
59
52
  "aarch64-unknown-linux-gnu",
60
53
  "aarch64-unknown-linux-musl",
61
54
  "x86_64-pc-windows-msvc",
62
- "aarch64-pc-windows-msvc",
63
- "wasm32-wasip1-threads"
55
+ "aarch64-pc-windows-msvc"
64
56
  ]
65
57
  },
66
- "engineCompat": {
67
- "core": ">=0.8.5 <0.10.0",
68
- "defaultMode": "auto",
69
- "oracle": {
70
- "teacssTs": "0.8.5",
71
- "commit": "786b4d40"
72
- }
73
- },
74
58
  "optionalDependencies": {
75
- "@teacss/engine-darwin-arm64": "0.9.4",
76
- "@teacss/engine-darwin-x64": "0.9.4",
77
- "@teacss/engine-linux-arm64-gnu": "0.9.4",
78
- "@teacss/engine-linux-arm64-musl": "0.9.4",
79
- "@teacss/engine-linux-x64-gnu": "0.9.4",
80
- "@teacss/engine-linux-x64-musl": "0.9.4",
81
- "@teacss/engine-win32-arm64-msvc": "0.9.4",
82
- "@teacss/engine-win32-x64-msvc": "0.9.4"
83
- },
84
- "peerDependencies": {
85
- "@teacss/config": ">=0.8.5 <0.10.0 || >=0.9.0-alpha.0 <0.10.0",
86
- "@teacss/core": ">=0.8.5 <0.10.0 || >=0.9.0-alpha.0 <0.10.0"
87
- },
88
- "peerDependenciesMeta": {
89
- "@teacss/core": {
90
- "optional": true
91
- },
92
- "@teacss/config": {
93
- "optional": true
94
- }
59
+ "@teacss/engine-darwin-arm64": "0.10.2",
60
+ "@teacss/engine-darwin-x64": "0.10.2",
61
+ "@teacss/engine-linux-arm64-gnu": "0.10.2",
62
+ "@teacss/engine-linux-arm64-musl": "0.10.2",
63
+ "@teacss/engine-linux-x64-gnu": "0.10.2",
64
+ "@teacss/engine-linux-x64-musl": "0.10.2",
65
+ "@teacss/engine-win32-arm64-msvc": "0.10.2",
66
+ "@teacss/engine-win32-x64-msvc": "0.10.2"
95
67
  },
96
68
  "devDependencies": {
97
69
  "@napi-rs/cli": "3.10.8",
98
70
  "@types/node": "^22.20.5",
99
71
  "emnapi": "1.11.3",
100
- "magic-string": "^0.30.17",
101
72
  "typescript": "^5.9.3"
102
73
  },
103
74
  "scripts": {
@@ -107,12 +78,12 @@
107
78
  "artifacts": "napi artifacts --output-dir ../../artifacts --npm-dir npm",
108
79
  "create-npm-dirs": "napi create-npm-dirs",
109
80
  "prepublishOnly": "npm run build:ts && node build/scripts/check-publish.js",
110
- "test": "npm run build:ts && npm run check:types && node --expose-gc --test \"build/test/**/*.test.js\"",
81
+ "test": "npm run build:ts && npm run check:types && node --expose-gc --test \"build/tests/**/*.test.js\"",
111
82
  "check:version": "npm run build:ts && node build/scripts/sync-version.js --check",
112
83
  "check:size": "node build/scripts/size-budget.js",
113
- "version": "napi version && npm run build:ts && node build/scripts/sync-version.js --write && git add npm/*/package.json package-lock.json ../../Cargo.toml ../../Cargo.lock ../../package-lock.json",
114
- "build:ts": "tsc -p tsconfig.json && tsc -p tsconfig.test.json",
115
- "check:types": "tsc -p test/consumer/tsconfig.json --noEmit",
84
+ "version": "napi version && npm run build:ts && node build/scripts/sync-version.js --write && git add -- npm/*/package.json package-lock.json ../*/package.json ../*/npm/*/package.json ../*/package-lock.json ../../Cargo.toml ../../Cargo.lock ../../extensions/zed/Cargo.toml ../../extensions/zed/extension.toml ../../extensions/zed/Cargo.lock ../../package-lock.json",
85
+ "build:ts": "node -e \"require('fs').rmSync('build',{recursive:true,force:true})\" && tsc -p tsconfig.json && tsc -p tsconfig.test.json",
86
+ "check:types": "tsc -p tests/consumer/tsconfig.json --noEmit",
116
87
  "check:publish": "node build/scripts/check-publish.js",
117
88
  "check:tag": "node build/scripts/check-tag.js",
118
89
  "inspect-binding": "node build/scripts/inspect-binding.js",
@@ -122,8 +93,7 @@
122
93
  "release:evidence": "node build/scripts/release-evidence.js",
123
94
  "publish:npm": "node build/scripts/publish.js",
124
95
  "dist-tag": "node build/scripts/dist-tag.js",
125
- "qualify": "node build/scripts/qualify.js",
126
- "setup-wasi-sdk": "node build/scripts/setup-wasi-sdk.js"
96
+ "qualify": "node build/scripts/qualify.js"
127
97
  },
128
98
  "publishConfig": {
129
99
  "access": "public",
@@ -1,36 +0,0 @@
1
- /** Fields the TypeScript generator provides; reading one before materialize throws `E_TS_REQUIRED`. */
2
- export declare const TS_ONLY_FIELDS: readonly string[];
3
- /** Fields copied from the Rust `ResolvedConfigView`. */
4
- export declare const VIEW_FIELDS: readonly string[];
5
- export interface ConfigViewArgs {
6
- view: Record<string, any>;
7
- request: object;
8
- presets: object[];
9
- /** The merged config (`mergeDefinedConfig(defaults, userConfig)`, config.ts:210) the oracle spreads. */
10
- merged: Record<string, unknown>;
11
- transformers: object[];
12
- host: {
13
- core?: {
14
- extractorSplit: object;
15
- } | undefined;
16
- };
17
- fallback: {
18
- peek(): {
19
- config: Record<string, unknown>;
20
- } | null;
21
- };
22
- engine?: {
23
- compileClassShortcuts(): unknown[];
24
- };
25
- }
26
- /**
27
- * The merged `content.pipeline` of the presets and the config, as `mergeContentOptions`
28
- * (core/config.ts) builds it: `false` anywhere disables it, otherwise includes and excludes
29
- * concatenate in source order without duplicates. The runtime builds its module filter from it.
30
- */
31
- export declare function mergePipeline(sources: readonly unknown[]): false | {
32
- include?: Array<string | RegExp>;
33
- exclude?: Array<string | RegExp>;
34
- } | undefined;
35
- export declare function createConfigView({ view, presets, merged, transformers, host, fallback, engine }: ConfigViewArgs): Record<string, unknown>;
36
- //# sourceMappingURL=config-view.d.ts.map
@@ -1,135 +0,0 @@
1
- // The facade's `generator.config`: a plain object whose keys follow the oracle `resolveConfig`
2
- // (core/config.ts:260-288), which spreads the merged config and then sets its own fields.
3
- import { tsNotReadyError } from "./errors.js";
4
- /** Fields the TypeScript generator provides; reading one before materialize throws `E_TS_REQUIRED`. */
5
- export const TS_ONLY_FIELDS = Object.freeze(["configResolved", "extendTheme", "preprocess", "postprocess", "preflights", "autocomplete", "rules", "rulesDynamic", "rulesStaticMap", "variants"]);
6
- /** Fields copied from the Rust `ResolvedConfigView`. */
7
- export const VIEW_FIELDS = Object.freeze(["layers", "theme", "shortcuts", "safelist", "blocklist", "separators", "envMode", "unmatched", "shortcutsLayer", "virtualModulePrefix", "mergeSelectors", "warn", "details", "outputToCssLayers", "rulesSize"]);
8
- /**
9
- * The keys `resolveConfig` always sets, in its order (config.ts:262-288); `configResolved`,
10
- * `extendTheme`, `extractorDefault` and `virtualModulePrefix` appear only through the spread.
11
- */
12
- const RESOLVED_KEYS = Object.freeze([
13
- "mergeSelectors",
14
- "warn",
15
- "unmatched",
16
- "outputToCssLayers",
17
- "sortLayers",
18
- "blocklist",
19
- "presets",
20
- "envMode",
21
- "shortcutsLayer",
22
- "layers",
23
- "theme",
24
- "rules",
25
- "rulesSize",
26
- "rulesDynamic",
27
- "rulesStaticMap",
28
- "preprocess",
29
- "postprocess",
30
- "preflights",
31
- "autocomplete",
32
- "variants",
33
- "shortcuts",
34
- "extractors",
35
- "safelist",
36
- "separators",
37
- "details",
38
- "content",
39
- "transformers",
40
- ]);
41
- const ownValue = (source, key) => (source !== null && typeof source === "object" && Object.hasOwn(source, key) ? source[key] : undefined);
42
- const flattenPatterns = (patterns) => [...new Set(patterns.flatMap((pattern) => (Array.isArray(pattern) ? pattern : pattern ? [pattern] : [])))];
43
- /**
44
- * The merged `content.pipeline` of the presets and the config, as `mergeContentOptions`
45
- * (core/config.ts) builds it: `false` anywhere disables it, otherwise includes and excludes
46
- * concatenate in source order without duplicates. The runtime builds its module filter from it.
47
- */
48
- export function mergePipeline(sources) {
49
- const includes = [];
50
- const excludes = [];
51
- let configured = false;
52
- for (const content of new Set(sources.map((source) => ownValue(source, "content")).filter((content) => content !== undefined && content !== null))) {
53
- const pipeline = ownValue(content, "pipeline");
54
- if (pipeline === false)
55
- return false;
56
- if (pipeline === undefined)
57
- continue;
58
- configured = true;
59
- const include = pipeline && ownValue(pipeline, "include");
60
- const exclude = pipeline && ownValue(pipeline, "exclude");
61
- if (include)
62
- includes.push(include);
63
- if (exclude)
64
- excludes.push(exclude);
65
- }
66
- if (!configured)
67
- return undefined;
68
- const merged = {};
69
- if (includes.length)
70
- merged.include = flattenPatterns(includes);
71
- if (excludes.length)
72
- merged.exclude = flattenPatterns(excludes);
73
- return merged;
74
- }
75
- export function createConfigView({ view, presets, merged, transformers, host, fallback, engine }) {
76
- const config = {};
77
- const data = (key, value) => Object.defineProperty(config, key, { value, enumerable: true, configurable: true, writable: true });
78
- const tsOnly = (key) => Object.defineProperty(config, key, {
79
- enumerable: true,
80
- configurable: true,
81
- get() {
82
- const ts = fallback.peek();
83
- if (!ts)
84
- throw tsNotReadyError(`config.${key}`);
85
- return ts.config[key];
86
- },
87
- });
88
- const extractors = host.core ? [host.core.extractorSplit] : [{ name: view.extractors?.[0]?.name ?? "@teacss/core/extractor-split" }];
89
- const fields = {
90
- presets: () => data("presets", presets),
91
- content: () => {
92
- const pipeline = mergePipeline([...presets, merged]);
93
- data("content", pipeline === undefined ? (view.content ?? {}) : { pipeline, ...view.content });
94
- },
95
- transformers: () => data("transformers", transformers),
96
- extractors: () => data("extractors", extractors),
97
- extractorDefault: () => data("extractorDefault", extractors[0]),
98
- sortLayers: () => data("sortLayers", (layers) => layers),
99
- };
100
- for (const key of VIEW_FIELDS)
101
- fields[key] = () => data(key, view[key]);
102
- // config.ts:263. Rust never warns, so its view does not carry the option.
103
- fields.warn = () => data("warn", (Object.hasOwn(merged, "warn") ? merged.warn : undefined) ?? true);
104
- if (engine) {
105
- // compile-class.ts:84-106 pushes each definition onto `config.shortcuts` and splices it out
106
- // when its last module drops it; the definitions live in the Engine, so one array is kept in
107
- // step on every read.
108
- const shortcuts = [...(view.shortcuts ?? [])];
109
- const configured = shortcuts.length;
110
- fields.shortcuts = () => Object.defineProperty(config, "shortcuts", {
111
- enumerable: true,
112
- configurable: true,
113
- get() {
114
- shortcuts.length = configured;
115
- shortcuts.push(...engine.compileClassShortcuts());
116
- return shortcuts;
117
- },
118
- });
119
- }
120
- for (const key of TS_ONLY_FIELDS)
121
- fields[key] = () => tsOnly(key);
122
- for (const key of Object.keys(merged)) {
123
- if (key === "engine")
124
- continue;
125
- if (Object.hasOwn(fields, key))
126
- fields[key]();
127
- else
128
- data(key, merged[key]);
129
- }
130
- // Redefining a spread key keeps its position, as the object literal does.
131
- for (const key of RESOLVED_KEYS)
132
- fields[key]();
133
- return config;
134
- }
135
- //# sourceMappingURL=config-view.js.map
@@ -1,22 +0,0 @@
1
- /** `@teacss/engine`'s own package.json version; the facade `generator.version` without a host. */
2
- export declare const ENGINE_PACKAGE_VERSION: string;
3
- /** `package.json#engineCompat` (v02.11 §7.3); without it `core` is unrestricted and `defaultMode` is `"auto"`. */
4
- export declare const ENGINE_COMPAT: Readonly<{
5
- core: string | undefined;
6
- defaultMode: "opt-in" | "auto";
7
- oracle: {
8
- teacssTs: string;
9
- commit: string;
10
- } | undefined;
11
- }>;
12
- export declare const ENGINE_INSTANCE: unique symbol;
13
- export declare const ENGINE_MATERIALIZE: unique symbol;
14
- export declare const ENGINE_STATS: unique symbol;
15
- export declare const PRESET_OPTIONS: Readonly<{
16
- standard: symbol;
17
- icons: symbol;
18
- official: symbol;
19
- }>;
20
- export declare const CONFIG_SOURCE_DECLARATIONS: unique symbol;
21
- export declare const CONFIG_ENTRY_PROVENANCE: unique symbol;
22
- //# sourceMappingURL=constants.d.ts.map
package/dist/constants.js DELETED
@@ -1,23 +0,0 @@
1
- // The facade's symbols and package constants. It imports nothing from the facade, so every
2
- // facade module can import it without a cycle through `index.ts`.
3
- import { createRequire } from "node:module";
4
- const pkg = createRequire(import.meta.url)("../package.json");
5
- /** `@teacss/engine`'s own package.json version; the facade `generator.version` without a host. */
6
- export const ENGINE_PACKAGE_VERSION = pkg.version;
7
- /** `package.json#engineCompat` (v02.11 §7.3); without it `core` is unrestricted and `defaultMode` is `"auto"`. */
8
- export const ENGINE_COMPAT = Object.freeze({
9
- core: pkg.engineCompat?.core,
10
- defaultMode: pkg.engineCompat?.defaultMode ?? "auto",
11
- oracle: pkg.engineCompat?.oracle,
12
- });
13
- export const ENGINE_INSTANCE = Symbol.for("@teacss/engine/instance");
14
- export const ENGINE_MATERIALIZE = Symbol.for("@teacss/engine/materialize");
15
- export const ENGINE_STATS = Symbol.for("@teacss/engine/stats");
16
- export const PRESET_OPTIONS = Object.freeze({
17
- standard: Symbol.for("@teacss/preset-standard/options"),
18
- icons: Symbol.for("@teacss/preset-icons/options"),
19
- official: Symbol.for("@teacss/preset-official/options"),
20
- });
21
- export const CONFIG_SOURCE_DECLARATIONS = Symbol.for("@teacss/config/source-declarations");
22
- export const CONFIG_ENTRY_PROVENANCE = Symbol.for("@teacss/config/entry-provenance");
23
- //# sourceMappingURL=constants.js.map
@@ -1,57 +0,0 @@
1
- export declare const MAX_RUNTIME_CACHE_ENTRIES = 10000;
2
- export declare class CountableSet<K> extends Set<K> {
3
- _map: Map<K, number>;
4
- constructor(values?: Iterable<K>);
5
- add(key: K): this;
6
- delete(key: K): boolean;
7
- clear(): void;
8
- getCount(key: K): number;
9
- setCount(key: K, count: number): this;
10
- }
11
- export declare function isCountableSet(value: unknown): value is CountableSet<string>;
12
- export declare function copyCountableSet<K>(input: CountableSet<K>): CountableSet<K>;
13
- /**
14
- * Expands the tokens holding a `{…}` group in place; the parts go to the end, and a counted
15
- * group's count carries over to each part.
16
- */
17
- export declare function expandInputGroups<T extends Set<string>>(tokens: T): T;
18
- /**
19
- * The part of the oracle `BoundedMap` the facade uses: ordinary keys are evicted oldest first,
20
- * retained keys never count toward the limit. An entry can be pending (`setPending`,
21
- * `replaceRetainedPending`): its value is `resolve(token)`, computed on the first read through
22
- * `get`, `forEach` or iteration and kept in place; `has`, `size`, `delete` and eviction never
23
- * resolve.
24
- */
25
- export declare class BoundedTokenCache<V> extends Map<string, V> {
26
- #private;
27
- maxEntries: number;
28
- retained: Set<string>;
29
- /** Ordinary keys in insertion order, the order the native map iterates them. */
30
- order: Set<string>;
31
- /** The value of a pending entry, called once per entry on its first read. */
32
- resolve: (token: string) => V;
33
- constructor(maxEntries?: number, resolve?: (token: string) => V);
34
- get retainedSize(): number;
35
- isRetained(key: string): boolean;
36
- get(key: string): V | undefined;
37
- entries(): MapIterator<[string, V]>;
38
- values(): MapIterator<V>;
39
- [Symbol.iterator](): MapIterator<[string, V]>;
40
- forEach(callback: (value: V, key: string, map: Map<string, V>) => void, thisArg?: unknown): void;
41
- set(key: string, value: V): this;
42
- /** Caches `key` with the value `resolve` supplies on its first read. */
43
- setPending(key: string): this;
44
- delete(key: string): boolean;
45
- clear(): void;
46
- /** Replaces the retained entries (bounded-cache.ts:188-205 without the revision check). */
47
- replaceRetained(entries: Iterable<readonly [string, V]>): void;
48
- /** `replaceRetained` with every value pending. */
49
- replaceRetainedPending(keys: Iterable<string>): void;
50
- }
51
- /** FIFO bounded Set (the oracle `BoundedSet` without its `assumeNoPrototypeBypass` fast path). */
52
- export declare class BoundedSet extends Set<string> {
53
- maxEntries: number;
54
- constructor(maxEntries?: number, values?: Iterable<string>);
55
- add(value: string): this;
56
- }
57
- //# sourceMappingURL=countable-set.d.ts.map