@teacss/engine 0.8.5-alpha.4 → 0.9.0-alpha.4

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/contract.d.ts ADDED
@@ -0,0 +1,290 @@
1
+ // Mirror of docs/specs/v02.2-engine-contract.md §3 (spec-revision 11). Do not edit without bumping the spec revision.
2
+ export interface InspectEntryRequest {
3
+ /** 项目根(绝对路径)。相对 @source 以声明它的文件所在目录为基准。 */
4
+ root: string;
5
+ /** 入口 CSS 绝对路径。 */
6
+ entryPath: string;
7
+ /** 若宿主已持有入口内容(未保存的编辑器缓冲等),传入以替代磁盘读取。 */
8
+ entryCss?: string | undefined | null;
9
+ }
10
+
11
+ export interface InspectEntryResult {
12
+ /** @presets 列表,按声明顺序、去重(oracle resolvePresetGraph 的输入)。 */
13
+ presets: string[];
14
+ /** @source 声明;glob 已按声明文件目录解析为相对 root 的形式,exclude 以 `!` 前缀表示。 */
15
+ sources: string[];
16
+ /** 入口与本地 @import 图中读取过的文件(绝对路径,深度优先)。 */
17
+ configFiles: string[];
18
+ hasTeacss: boolean;
19
+ /** 入口语法诊断;非空时 loadProject 会以 E_ENTRY_INVALID 失败。 */
20
+ diagnostics: EntryDiagnostic[];
21
+ }
22
+
23
+ export interface LoadProjectRequest {
24
+ root: string;
25
+ /** null 表示没有入口文件(oracle loadConfig 找不到 entry 的情形)。 */
26
+ entry: { path: string; css?: string | undefined | null } | null;
27
+ /** 已解析顺序的预设(oracle 排序规则:pre、normal、post,见 core/config.ts:209)。 */
28
+ presets: PresetSpec[];
29
+ /** @source 匹配到的 .css 文件(绝对路径),只贡献 @shortcut/@safelist。由 JS 枚举。 */
30
+ declarationFiles: string[];
31
+ /** 内联 UserConfig / defaults 中可静态表示的部分。 */
32
+ inline?: StaticConfig | undefined | null;
33
+ envMode: "dev" | "build";
34
+ unmatched: "warn" | "error" | "off";
35
+ /** 对应 UserConfig.outputToCssLayers;函数形式由 facade 判定回退。 */
36
+ outputToCssLayers?: boolean | { allLayers?: boolean } | undefined | null;
37
+ shortcutsLayer?: string | undefined | null;
38
+ virtualModulePrefix?: string | undefined | null;
39
+ }
40
+
41
+ export interface LoadProjectResult {
42
+ programKey: string;
43
+ /** 与上一次 loadProject 相比 programKey 是否变化;首次为 true。 */
44
+ changed: boolean;
45
+ /** 声明文件中解析失败的位置(不阻止加载,oracle 行为相同)。 */
46
+ warnings: EntryDiagnostic[];
47
+ /** @custom 中不属于任何命名空间的属性名(oracle `ResolveEntryResult.unknown`),facade 的 `resolveEntryConfig` 透传。 */
48
+ unknownCustom: string[];
49
+ }
50
+
51
+ export type PresetSpec = { kind: "standard"; options?: PresetStandardOptions | undefined | null } | { kind: "official" } | { kind: "icons"; options?: PresetIconsOptions | undefined | null } | { kind: "static"; preset: StaticPreset };
52
+
53
+ export interface PresetStandardOptions {
54
+ modeSelectors?: { dark?: string; light?: string } | undefined | null;
55
+ containers?: Record<string, string> | undefined | null;
56
+ preflight?: boolean | "on-demand" | undefined | null;
57
+ variablePrefix?: string | undefined | null;
58
+ compileClass?: boolean | CompileClassOptions | undefined | null;
59
+ }
60
+
61
+ export interface CompileClassOptions {
62
+ classPrefix?: string | undefined | null;
63
+ alwaysHash?: boolean | undefined | null;
64
+ keepUnknown?: boolean | undefined | null;
65
+ layer?: string | undefined | null;
66
+ }
67
+
68
+ export interface PresetIconsOptions {
69
+ scale?: number | undefined | null;
70
+ mode?: "mask" | "bg" | "auto" | undefined | null;
71
+ extraProperties?: Record<string, string> | undefined | null;
72
+ warn?: boolean | undefined | null;
73
+ layer?: string | undefined | null;
74
+ unit?: string | undefined | null;
75
+ /** 只允许内置集合名;其他集合由 facade 判定回退。 */
76
+ collections?: string[] | undefined | null;
77
+ }
78
+
79
+ /** 本地/第三方 preset 的可静态表示部分。任何不能表示的字段都由 facade 判定回退,不进入这里。 */
80
+ export interface StaticPreset {
81
+ name: string;
82
+ enforce?: "pre" | "post" | undefined | null;
83
+ layer?: string | undefined | null;
84
+ layers?: Record<string, number> | undefined | null;
85
+ shortcuts?: Array<[string, string]> | undefined | null;
86
+ safelist?: string[] | undefined | null;
87
+ blocklist?: string[] | undefined | null;
88
+ /** 只接受 oracle `Theme` 中的标量叶子;对象按点路径展平后传入。 */
89
+ theme?: Record<string, string> | undefined | null;
90
+ }
91
+
92
+ export interface StaticConfig {
93
+ shortcuts?: Array<[string, string]> | undefined | null;
94
+ safelist?: string[] | undefined | null;
95
+ blocklist?: string[] | undefined | null;
96
+ layers?: Record<string, number> | undefined | null;
97
+ theme?: Record<string, string> | undefined | null;
98
+ content?: { filesystem?: string[] | undefined | null } | undefined | null;
99
+ }
100
+
101
+ export interface ModuleUpdateResult {
102
+ tokens: string[];
103
+ /** 该模块 token 集或 compile-class 定义相对上一次是否变化。 */
104
+ changed: boolean;
105
+ }
106
+
107
+ export interface ExtractFileResult {
108
+ path: string;
109
+ tokens: string[];
110
+ /** 读取失败时的错误码(E_IO);成功为 null。 */
111
+ error: string | null;
112
+ }
113
+
114
+ export interface TransformResult {
115
+ code: string;
116
+ /** 从原文到 code 的替换序列,UTF-16 code unit 偏移,按 (start, end) 升序且互不重叠。facade 在宿主的 MagicString 上按顺序回放:`start === end ? s.appendLeft(start, text) : s.update(start, end, text)`(magic-string 1.x 的 `update` 与 `overwrite` 除 `storeName` 默认值外相同),使 runtime 生成的 source map 与 0.8.2 完全一致(v02.8 §7)。 */
117
+ edits: Array<{ start: number; end: number; text: string }>;
118
+ /** 独立使用者(无 MagicString)用的 Source Map v3:sources = [id],sourcesContent = [原文]。 */
119
+ map: SourceMap;
120
+ /** oracle SourceCodeTransformer 返回的高亮区间(compileClass 提供)。 */
121
+ highlightAnnotations: HighlightAnnotation[];
122
+ /** transformSource:本次登记的 compile-class 类名(facade 并入 `ctx.tokens`,v02.9 §6);transformStylesheet 为空数组。 */
123
+ compiledClasses: string[];
124
+ /** transformSource:该模块的定义集相对上一次是否变化(facade 据此调用 `ctx.invalidate()`);transformStylesheet 为 false。 */
125
+ definitionsChanged: boolean;
126
+ }
127
+
128
+ export interface SourceMap {
129
+ version: 3;
130
+ file: string | null;
131
+ sources: string[];
132
+ sourcesContent: string[];
133
+ names: string[];
134
+ mappings: string;
135
+ }
136
+
137
+ export interface HighlightAnnotation {
138
+ offset: number;
139
+ length: number;
140
+ className: string;
141
+ }
142
+
143
+ export type GenerateInput = { kind: "tokens"; tokens: string[] } | { kind: "code"; code: string; id?: string | undefined | null } | { kind: "all" };
144
+
145
+ export interface GenerateOptions {
146
+ id?: string | undefined | null;
147
+ /** 默认 true */
148
+ preflights?: boolean | undefined | null;
149
+ /** 默认 true */
150
+ safelist?: boolean | undefined | null;
151
+ /** 默认 false */
152
+ minify?: boolean | undefined | null;
153
+ /** 默认 false;为 true 时填充 matchedInfo */
154
+ extendedInfo?: boolean | undefined | null;
155
+ scope?: string | undefined | null;
156
+ /** 默认 true;false 时不拼、不传整表 css,result.css 为 ""。facade 传 false,它用 layers 重建。 */
157
+ css?: boolean | undefined | null;
158
+ }
159
+
160
+ export interface GenerateResult {
161
+ /** 与 oracle `result.css` 逐字节相同;`options.css` 为 false 时为 ""。 */
162
+ css: string;
163
+ /** 有序层;oracle `result.layers` 与 `getLayer(name)` 的来源。 */
164
+ layers: Array<{ name: string; css: string }>;
165
+ /** oracle `result.matched`(Set)按首次出现顺序,以 "\0" 分隔;没有时为 ""。 */
166
+ matched: string;
167
+ /** extendedInfo 时填充。input 为 {kind:"code"} 时 count 是该 token 在抽取结果中的出现次数(oracle CountableSet 语义);tokens/all 输入时为 -1(oracle 对不可计数输入的语义)。 */
168
+ matchedInfo: Array<{ token: string; data: StringifiedUtil[]; count: number }> | null;
169
+ programKey: string;
170
+ /** 有 shortcut 留下警告时才有这个键,按 token 的访问顺序(输入,再 safelist),每个 token 至多一项。facade 据此打印 oracle `stringifyShortcuts` 的警告(§6.8)。 */
171
+ shortcutWarnings?: ShortcutWarning[];
172
+ }
173
+
174
+ /**
175
+ * 一个 shortcut token 留下的警告。`shortcut` 是去掉 token 自身条件与 `!` 后的名(oracle `parent[1]`)。
176
+ * `unmatched`:不匹配任何规则的成员(blocklist 不作用于成员),按叶子顺序每个名一次,不带 token 自身的修饰;
177
+ * `leafLimit`:展开后成员超过该上限(§8),token 不匹配,成员不再报告。
178
+ */
179
+ export type ShortcutWarning = { shortcut: string; unmatched: string[] } | { shortcut: string; leafLimit: number };
180
+
181
+ /** oracle `StringifiedUtil` 元组的对象形式;`context` 字段不跨边界,facade 以 undefined 填充。 */
182
+ export interface StringifiedUtil {
183
+ index: number;
184
+ selector: string | null;
185
+ body: string;
186
+ parent: string | null;
187
+ meta: RuleMeta | null;
188
+ noMerge: boolean | null;
189
+ }
190
+
191
+ export interface RuleMeta {
192
+ layer?: string | undefined | null;
193
+ noMerge?: boolean | undefined | null;
194
+ noScope?: boolean | undefined | null;
195
+ sort?: number | undefined | null;
196
+ prefix?: string | string[] | undefined | null;
197
+ internal?: boolean | undefined | null;
198
+ }
199
+
200
+ export interface UnmatchedDiagnostic {
201
+ token: string;
202
+ suggestions: string[];
203
+ }
204
+
205
+ export interface EntryConfig {
206
+ presets: string[];
207
+ rolePalettes: Partial<Record<"primary" | "neutral" | "success" | "warning" | "failure" | "general" | "focused", string[]>> | null;
208
+ sources: Array<{ glob: string; exclude: boolean }>;
209
+ custom: Array<{
210
+ alias: { name: string; family: string } | null;
211
+ mode: string | null;
212
+ declarations: Array<{ property: string; value: string }>;
213
+ }>;
214
+ shortcuts: Array<{ name: string; expansion: string }>;
215
+ safelist: string[];
216
+ hasTeacss: boolean;
217
+ }
218
+
219
+ export interface EntryDiagnostic {
220
+ file: string | null;
221
+ start: number;
222
+ end: number;
223
+ message: string;
224
+ }
225
+
226
+ export interface CustomDiagnostic {
227
+ property: string;
228
+ start: number;
229
+ end: number;
230
+ reason: "unknown-prefix" | "illegal-color-step" | "removed-theme";
231
+ message: string;
232
+ }
233
+
234
+ export interface ResolvedConfigView {
235
+ presets: Array<{ name: string; enforce: "pre" | "post" | null; layer: string | null }>;
236
+ layers: Record<string, number>;
237
+ content: { filesystem: string[] } | null;
238
+ /** 合并后的 theme(oracle `config.theme`);嵌套对象原样。 */
239
+ theme: Record<string, unknown>;
240
+ shortcuts: Array<[string, string]>;
241
+ safelist: string[];
242
+ blocklist: string[];
243
+ separators: string[];
244
+ envMode: "dev" | "build";
245
+ unmatched: "warn" | "error" | "off";
246
+ shortcutsLayer: string;
247
+ virtualModulePrefix: string;
248
+ mergeSelectors: boolean;
249
+ warn: boolean;
250
+ details: boolean;
251
+ outputToCssLayers: boolean | { allLayers: boolean } | false;
252
+ rulesSize: number;
253
+ transformers: Array<{ name: string; enforce: "pre" | "post" | "default" }>;
254
+ extractors: Array<{ name: string }>;
255
+ standard: { preflight: boolean | "on-demand"; variablePrefix: string; compileClass: boolean } | null;
256
+ icons: { collections: string[]; mode: "mask" | "bg" | "auto"; layer: string } | null;
257
+ }
258
+
259
+ export interface RuleInfo {
260
+ /** `RuleDescriptor` 的 id(如 "standard.spacing.p");shortcut 为 "shortcut:<name>"。 */
261
+ id: string;
262
+ /** `RuleMeta.layer`。 */
263
+ layer: string | null;
264
+ /** `RuleDescriptor` 的 priority;shortcut 为 0。 */
265
+ priority: number;
266
+ /** `MatcherKey` 的变体:Property、PropertyPrefix、Keyword;shortcut 按名作 keyword。 */
267
+ matcher: { kind: "property" | "prefix" | "keyword"; value: string };
268
+ source: "standard" | "official" | "icons" | "shortcut";
269
+ }
270
+
271
+ export interface VariantInfo {
272
+ /** 用户写在 `@` 之后的名字:表项按名,开放族为 `prefix-*`,括号参数为 `[…]`。 */
273
+ name: string;
274
+ /** 接受它的解析器:pseudo、relational、attribute、language、media、at-rule、container、breakpoint、arbitrary。 */
275
+ kind: string;
276
+ source: RuleInfo["source"];
277
+ }
278
+
279
+ export interface EngineStats {
280
+ moduleCount: number;
281
+ /** 所有模块 token 的总数(含跨模块重复)。 */
282
+ tokenCount: number;
283
+ distinctTokens: number;
284
+ /** fragment 缓存条数,含未匹配或被 blocklist 拦截的负条目。 */
285
+ fragmentEntries: number;
286
+ /** 估算:每条键的 token 字节 + 每个 util 的 selector、body、parent 字节 + 结构体大小。 */
287
+ fragmentBytes: number;
288
+ /** 上一次 generate 结果:css、各层 css、matched 的字节和;没有时为 0。 */
289
+ memoBytes: number;
290
+ }
@@ -0,0 +1,27 @@
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
+ export declare function createConfigView({ view, presets, merged, transformers, host, fallback, engine }: ConfigViewArgs): Record<string, unknown>;
27
+ //# sourceMappingURL=config-view.d.ts.map
@@ -0,0 +1,98 @@
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
+ export function createConfigView({ view, presets, merged, transformers, host, fallback, engine }) {
42
+ const config = {};
43
+ const data = (key, value) => Object.defineProperty(config, key, { value, enumerable: true, configurable: true, writable: true });
44
+ const tsOnly = (key) => Object.defineProperty(config, key, {
45
+ enumerable: true,
46
+ configurable: true,
47
+ get() {
48
+ const ts = fallback.peek();
49
+ if (!ts)
50
+ throw tsNotReadyError(`config.${key}`);
51
+ return ts.config[key];
52
+ },
53
+ });
54
+ const extractors = host.core ? [host.core.extractorSplit] : [{ name: view.extractors?.[0]?.name ?? "@teacss/core/extractor-split" }];
55
+ const fields = {
56
+ presets: () => data("presets", presets),
57
+ content: () => data("content", view.content ?? {}),
58
+ transformers: () => data("transformers", transformers),
59
+ extractors: () => data("extractors", extractors),
60
+ extractorDefault: () => data("extractorDefault", extractors[0]),
61
+ sortLayers: () => data("sortLayers", (layers) => layers),
62
+ };
63
+ for (const key of VIEW_FIELDS)
64
+ fields[key] = () => data(key, view[key]);
65
+ // config.ts:263. Rust never warns, so its view does not carry the option.
66
+ fields.warn = () => data("warn", (Object.hasOwn(merged, "warn") ? merged.warn : undefined) ?? true);
67
+ if (engine) {
68
+ // compile-class.ts:84-106 pushes each definition onto `config.shortcuts` and splices it out
69
+ // when its last module drops it; the definitions live in the Engine, so one array is kept in
70
+ // step on every read.
71
+ const shortcuts = [...(view.shortcuts ?? [])];
72
+ const configured = shortcuts.length;
73
+ fields.shortcuts = () => Object.defineProperty(config, "shortcuts", {
74
+ enumerable: true,
75
+ configurable: true,
76
+ get() {
77
+ shortcuts.length = configured;
78
+ shortcuts.push(...engine.compileClassShortcuts());
79
+ return shortcuts;
80
+ },
81
+ });
82
+ }
83
+ for (const key of TS_ONLY_FIELDS)
84
+ fields[key] = () => tsOnly(key);
85
+ for (const key of Object.keys(merged)) {
86
+ if (key === "engine")
87
+ continue;
88
+ if (Object.hasOwn(fields, key))
89
+ fields[key]();
90
+ else
91
+ data(key, merged[key]);
92
+ }
93
+ // Redefining a spread key keeps its position, as the object literal does.
94
+ for (const key of RESOLVED_KEYS)
95
+ fields[key]();
96
+ return config;
97
+ }
98
+ //# sourceMappingURL=config-view.js.map
@@ -0,0 +1,22 @@
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
@@ -1,24 +1,23 @@
1
- // @ts-check
2
1
  // The facade's symbols and package constants. It imports nothing from the facade, so every
3
- // facade module can import it without a cycle through `index.mjs`.
2
+ // facade module can import it without a cycle through `index.ts`.
4
3
  import { createRequire } from "node:module";
5
-
6
- /** @type {{ version: string, engineCompat?: { core?: string, defaultMode?: "opt-in" | "auto" } }} */
7
- const pkg = createRequire(import.meta.url)("../../package.json");
8
-
4
+ const pkg = createRequire(import.meta.url)("../package.json");
9
5
  /** `@teacss/engine`'s own package.json version; the facade `generator.version` without a host. */
10
6
  export const ENGINE_PACKAGE_VERSION = pkg.version;
11
-
12
7
  /** `package.json#engineCompat` (v02.11 §7.3); without it `core` is unrestricted and `defaultMode` is `"auto"`. */
13
- export const ENGINE_COMPAT = Object.freeze({ core: pkg.engineCompat?.core, defaultMode: pkg.engineCompat?.defaultMode ?? "auto", oracle: /** @type {any} */ (pkg.engineCompat)?.oracle });
14
-
8
+ export const ENGINE_COMPAT = Object.freeze({
9
+ core: pkg.engineCompat?.core,
10
+ defaultMode: pkg.engineCompat?.defaultMode ?? "auto",
11
+ oracle: pkg.engineCompat?.oracle,
12
+ });
15
13
  export const ENGINE_INSTANCE = Symbol.for("@teacss/engine/instance");
16
14
  export const ENGINE_MATERIALIZE = Symbol.for("@teacss/engine/materialize");
17
15
  export const ENGINE_STATS = Symbol.for("@teacss/engine/stats");
18
16
  export const PRESET_OPTIONS = Object.freeze({
19
- standard: Symbol.for("@teacss/preset-standard/options"),
20
- icons: Symbol.for("@teacss/preset-icons/options"),
21
- official: Symbol.for("@teacss/preset-official/options"),
17
+ standard: Symbol.for("@teacss/preset-standard/options"),
18
+ icons: Symbol.for("@teacss/preset-icons/options"),
19
+ official: Symbol.for("@teacss/preset-official/options"),
22
20
  });
23
21
  export const CONFIG_SOURCE_DECLARATIONS = Symbol.for("@teacss/config/source-declarations");
24
22
  export const CONFIG_ENTRY_PROVENANCE = Symbol.for("@teacss/config/entry-provenance");
23
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1,57 @@
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