@teacss/engine 0.9.3 → 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.
- package/LICENSE +22 -0
- package/README.md +28 -109
- package/binding-header.d.ts +9 -0
- package/binding.d.ts +29 -0
- package/binding.js +56 -55
- package/contract.d.ts +121 -16
- package/dist/entry.d.ts +20 -0
- package/dist/entry.js +279 -0
- package/dist/errors.d.ts +1 -7
- package/dist/errors.js +1 -13
- package/dist/fonts.d.ts +21 -0
- package/dist/fonts.js +32 -0
- package/dist/index.d.ts +3 -4
- package/dist/index.js +4 -7
- package/dist/project.d.ts +80 -0
- package/dist/project.js +136 -0
- package/package.json +19 -49
- package/dist/config-view.d.ts +0 -36
- package/dist/config-view.js +0 -135
- package/dist/constants.d.ts +0 -22
- package/dist/constants.js +0 -23
- package/dist/countable-set.d.ts +0 -57
- package/dist/countable-set.js +0 -205
- package/dist/generator.d.ts +0 -163
- package/dist/generator.js +0 -893
- package/dist/result.d.ts +0 -83
- package/dist/result.js +0 -142
- package/dist/select.d.ts +0 -183
- package/dist/select.js +0 -741
- package/dist/transformer.d.ts +0 -44
- package/dist/transformer.js +0 -59
- package/dist/ts-fallback.d.ts +0 -41
- package/dist/ts-fallback.js +0 -79
package/dist/generator.d.ts
DELETED
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { ENGINE_INSTANCE, ENGINE_MATERIALIZE } from "./constants.js";
|
|
2
|
-
/** Port of core/utils/events.ts:84-112. */
|
|
3
|
-
export declare function createNanoEvents(): {
|
|
4
|
-
events: any;
|
|
5
|
-
emit(event: string, ...args: unknown[]): void;
|
|
6
|
-
on(event: string, cb: Function): () => void;
|
|
7
|
-
};
|
|
8
|
-
/** Port of core/utils/escape.ts:10-72 (CSSOM "serialize an identifier"). */
|
|
9
|
-
export declare function escapeSelector(str: string): string;
|
|
10
|
-
/** generator.ts:3722. */
|
|
11
|
-
export declare function toEscapedSelector(raw: string): string;
|
|
12
|
-
/**
|
|
13
|
-
* v02.9 §8.1: the process-wide counters, the same object the teacss-ts hook updates.
|
|
14
|
-
*/
|
|
15
|
-
export declare function engineStats(): {
|
|
16
|
-
rust: number;
|
|
17
|
-
ts: number;
|
|
18
|
-
fallbacks: Record<string, number>;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* v02.9 §9: each reason and path prints once per process; the counter grows on every call. A
|
|
22
|
-
* host `report(reason, path, level)` (core's `reportFallback`) gets every call and does both
|
|
23
|
-
* itself, so the counter is not touched here.
|
|
24
|
-
*/
|
|
25
|
-
export declare function reportFallback(reason: string, path: string, host?: FacadeHost, level?: "info" | "warn"): void;
|
|
26
|
-
export declare class FacadeGenerator {
|
|
27
|
-
#private;
|
|
28
|
-
/** The facade's own emitter; a TS backend's `events` are not forwarded. */
|
|
29
|
-
events: {
|
|
30
|
-
events: any;
|
|
31
|
-
emit(event: string, ...args: unknown[]): void;
|
|
32
|
-
on(event: string, cb: Function): () => void;
|
|
33
|
-
};
|
|
34
|
-
userConfig: Record<string, unknown>;
|
|
35
|
-
defaults: Record<string, unknown>;
|
|
36
|
-
/**
|
|
37
|
-
* An `engine` gives a Rust backend and `ts` a TypeScript one.
|
|
38
|
-
*/
|
|
39
|
-
constructor({ engine, request, presets, transformers, ts, userConfig, defaults, host, transformer, }: {
|
|
40
|
-
engine?: any;
|
|
41
|
-
request?: object;
|
|
42
|
-
presets?: object[];
|
|
43
|
-
transformers?: object[];
|
|
44
|
-
ts?: any;
|
|
45
|
-
userConfig?: Record<string, unknown>;
|
|
46
|
-
defaults?: Record<string, unknown>;
|
|
47
|
-
host?: {
|
|
48
|
-
core?: any;
|
|
49
|
-
};
|
|
50
|
-
transformer?: object | null;
|
|
51
|
-
});
|
|
52
|
-
get version(): any;
|
|
53
|
-
get config(): any;
|
|
54
|
-
get cache(): any;
|
|
55
|
-
get blocked(): any;
|
|
56
|
-
get parentOrders(): any;
|
|
57
|
-
get activatedRules(): any;
|
|
58
|
-
set cache(value: any);
|
|
59
|
-
set blocked(value: any);
|
|
60
|
-
set parentOrders(value: any);
|
|
61
|
-
set activatedRules(value: any);
|
|
62
|
-
get [ENGINE_INSTANCE](): any;
|
|
63
|
-
/**
|
|
64
|
-
* The two overloads of generator.ts:2037-2040. With an `id` the Engine records the module's
|
|
65
|
-
* tokens; a counted set adds each token's occurrences.
|
|
66
|
-
*/
|
|
67
|
-
applyExtractors(code: string, id?: string, extracted?: Set<string>): Promise<any>;
|
|
68
|
-
/**
|
|
69
|
-
* The overloads of generator.ts:2316-2318. String input is extracted here, as Rust's
|
|
70
|
-
* `{ kind: "code" }` would, so its tokens reach the cache and the unmatched check (the oracle
|
|
71
|
-
* runs `applyExtractors` on it, generator.ts:2378).
|
|
72
|
-
*/
|
|
73
|
-
generate(input: string | string[] | Set<string>, options?: Record<string, any>): Promise<any>;
|
|
74
|
-
/**
|
|
75
|
-
* generator.ts:2113-2286. A tuple array, or `undefined` for a miss or a blocked token; a miss
|
|
76
|
-
* already cached reads back as `null`. With an `alias` nothing is cached.
|
|
77
|
-
*/
|
|
78
|
-
parseToken(raw: string, alias?: string): Promise<any>;
|
|
79
|
-
/** generator.ts:3611. */
|
|
80
|
-
isBlocked(raw: string): any;
|
|
81
|
-
/** generator.ts:3623; the blocklist holds strings only (anything else falls back). */
|
|
82
|
-
getBlocked(raw: string): [string, undefined] | undefined;
|
|
83
|
-
/** generator.ts:2304-2314: cached tokens that emit the same output as `raw`. */
|
|
84
|
-
getCachedEquivalentTokens(raw: string): string[];
|
|
85
|
-
/** The TypeScript generator behind the tooling members, created on first call; a TS backend returns itself. */
|
|
86
|
-
[ENGINE_MATERIALIZE](): Promise<any>;
|
|
87
|
-
/** generator.ts:2105. */
|
|
88
|
-
makeContext(raw: string, applied: unknown): any;
|
|
89
|
-
/** generator.ts:2809. */
|
|
90
|
-
constructCustomCSS(context: unknown, body: unknown, overrideSelector?: string): any;
|
|
91
|
-
/** generator.ts:3160. */
|
|
92
|
-
stringifyUtil(parsed?: unknown, context?: unknown): any;
|
|
93
|
-
/** generator.ts:2635. */
|
|
94
|
-
matchVariants(raw: string, current?: string): Promise<any>;
|
|
95
|
-
/** generator.ts:2866. */
|
|
96
|
-
parseUtil(input: unknown, context: unknown, internal?: boolean, shortcutPrefix?: string | string[]): Promise<any>;
|
|
97
|
-
/** generator.ts:3208. */
|
|
98
|
-
expandShortcut(input: string, context: unknown, depth?: number): Promise<any>;
|
|
99
|
-
/** generator.ts:3409. */
|
|
100
|
-
stringifyShortcuts(parent: unknown, context: unknown, expanded: unknown[], meta?: unknown, matchedPrefixes?: unknown): Promise<any>;
|
|
101
|
-
/** generator.ts:1976-1980: a falsy config keeps the current one. */
|
|
102
|
-
setConfig(userConfig?: Record<string, unknown>, defaults?: Record<string, unknown>): Promise<void>;
|
|
103
|
-
/**
|
|
104
|
-
* generator.ts:1983-2008: a candidate generator for the configuration, without touching this
|
|
105
|
-
* one. A configuration Rust cannot serve gets a TypeScript candidate.
|
|
106
|
-
*/
|
|
107
|
-
prepareConfig(userConfig: Record<string, unknown>, defaults?: Record<string, unknown>): Promise<Readonly<{
|
|
108
|
-
config: any;
|
|
109
|
-
defaults: Record<string, unknown>;
|
|
110
|
-
generator: FacadeGenerator;
|
|
111
|
-
userConfig: Record<string, unknown>;
|
|
112
|
-
version: number;
|
|
113
|
-
}>>;
|
|
114
|
-
/**
|
|
115
|
-
* generator.ts:2010-2035: switch to the prepared backend if no newer request superseded it. A
|
|
116
|
-
* superseded Rust candidate is disposed; so is the previous Engine once it is replaced.
|
|
117
|
-
*/
|
|
118
|
-
commitConfig(prepared: {
|
|
119
|
-
config: unknown;
|
|
120
|
-
defaults: Record<string, unknown>;
|
|
121
|
-
generator: FacadeGenerator;
|
|
122
|
-
userConfig: Record<string, unknown>;
|
|
123
|
-
version: number;
|
|
124
|
-
}): boolean;
|
|
125
|
-
/**
|
|
126
|
-
* Releases the Engine this generator owns; later `generate`, `parseToken`, `applyExtractors`,
|
|
127
|
-
* `prepareConfig` and `commitConfig` throw `E_DISPOSED`, and a second call does nothing. A
|
|
128
|
-
* candidate committed into another generator handed its Engine over and leaves it alone.
|
|
129
|
-
*/
|
|
130
|
-
dispose(): void;
|
|
131
|
-
[Symbol.dispose](): void;
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* v02.9 §3.1: a Rust facade, or the reason the configuration needs TypeScript. Errors from
|
|
135
|
-
* `loadProject` (`E_*`) are thrown as they are, not turned into a fallback. The hook counts the
|
|
136
|
-
* initial creation, so this does not.
|
|
137
|
-
*/
|
|
138
|
-
export interface FacadeHost {
|
|
139
|
-
/** 挂钩注入的 @teacss/core 绑定;缺省时 facade 按需动态 import。 */
|
|
140
|
-
core?: {
|
|
141
|
-
version: string;
|
|
142
|
-
createGenerator: (config?: object, defaults?: object) => Promise<object>;
|
|
143
|
-
createTsGenerator?: (config?: object, defaults?: object) => Promise<object>;
|
|
144
|
-
extractorSplit: object;
|
|
145
|
-
isCountableSet?: (value: unknown) => boolean;
|
|
146
|
-
isTokenShaped?: (token: string) => boolean;
|
|
147
|
-
toEscapedSelector?: (raw: string) => string;
|
|
148
|
-
/** core/utils/warn.ts 的 warnOnce;传入时 shortcut 警告与 TS 引擎共用一个去重集合。 */
|
|
149
|
-
warnOnce?: (message: string) => void;
|
|
150
|
-
} | undefined;
|
|
151
|
-
/** 挂钩注入的回退出口(core 的 reportFallback):每次回退都调用,由它计数并按 reason 与 path 去重打印;缺省时 facade 自己计数并写 process.stderr。 */
|
|
152
|
-
report?: (reason: string, path: string, level: "info" | "warn") => void;
|
|
153
|
-
}
|
|
154
|
-
export type FacadeCreateResult = {
|
|
155
|
-
ok: true;
|
|
156
|
-
generator: FacadeGenerator;
|
|
157
|
-
} | {
|
|
158
|
-
ok: false;
|
|
159
|
-
reason: string;
|
|
160
|
-
path: string;
|
|
161
|
-
};
|
|
162
|
-
export declare function createGenerator(config?: Record<string, unknown>, defaults?: Record<string, unknown>, host?: FacadeHost): Promise<FacadeCreateResult>;
|
|
163
|
-
//# sourceMappingURL=generator.d.ts.map
|