@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/result.d.ts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
export interface RustUtil {
|
|
2
|
-
index: number;
|
|
3
|
-
selector: string | null;
|
|
4
|
-
body: string;
|
|
5
|
-
parent: string | null;
|
|
6
|
-
meta: Record<string, unknown> | null;
|
|
7
|
-
noMerge: boolean | null;
|
|
8
|
-
}
|
|
9
|
-
export interface RustGenerateResult {
|
|
10
|
-
css: string;
|
|
11
|
-
layers: Array<{
|
|
12
|
-
name: string;
|
|
13
|
-
css: string;
|
|
14
|
-
}>;
|
|
15
|
-
/** The matched tokens joined with `"\0"`, `""` when none (v02.2 §3). */
|
|
16
|
-
matched: string;
|
|
17
|
-
matchedInfo: Array<{
|
|
18
|
-
token: string;
|
|
19
|
-
data: RustUtil[];
|
|
20
|
-
count: number;
|
|
21
|
-
}> | null;
|
|
22
|
-
programKey: string;
|
|
23
|
-
/** Present only when a shortcut left a warning (v02.2 §6.8). */
|
|
24
|
-
shortcutWarnings?: RustShortcutWarning[];
|
|
25
|
-
}
|
|
26
|
-
export type RustShortcutWarning = {
|
|
27
|
-
shortcut: string;
|
|
28
|
-
unmatched: string[];
|
|
29
|
-
} | {
|
|
30
|
-
shortcut: string;
|
|
31
|
-
leafLimit: number;
|
|
32
|
-
};
|
|
33
|
-
/** The `stringifyShortcuts` warnings (generator.ts:3445) and the leaf-limit warning, in order. */
|
|
34
|
-
export declare function shortcutWarningMessages(warnings: RustShortcutWarning[]): string[];
|
|
35
|
-
/** `rust.matched` as the token list, split once at the boundary. */
|
|
36
|
-
export declare function splitMatched(rust: RustGenerateResult): string[];
|
|
37
|
-
export interface UnmatchedEntry {
|
|
38
|
-
token: string;
|
|
39
|
-
suggestions: string[];
|
|
40
|
-
}
|
|
41
|
-
/** The oracle `StringifiedUtil` 7-tuple; the context slot is always `undefined`. */
|
|
42
|
-
export type UtilTuple = [number, string | undefined, string, string | undefined, Record<string, unknown> | undefined, undefined, boolean | undefined];
|
|
43
|
-
export declare function uniq(items: string[]): string[];
|
|
44
|
-
/** By `configuredLayers[name] ?? 0`, ties by UTF-16 code units (generator.ts:1310-1312). */
|
|
45
|
-
export declare function sortLayerNames(names: string[], configuredLayers: Record<string, number>): string[];
|
|
46
|
-
/** A v02.2 `StringifiedUtil` as the oracle 7-tuple; `null` meta values are dropped. */
|
|
47
|
-
export declare function toTuple(util: RustUtil): UtilTuple;
|
|
48
|
-
export declare function buildMatched({ rust, matched, extendedInfo, countOf }: {
|
|
49
|
-
rust: RustGenerateResult;
|
|
50
|
-
matched: string[];
|
|
51
|
-
extendedInfo: boolean;
|
|
52
|
-
countOf?: (token: string, rustCount: number) => number;
|
|
53
|
-
}): Set<string> | Map<string, {
|
|
54
|
-
data: UtilTuple[];
|
|
55
|
-
count: number;
|
|
56
|
-
}>;
|
|
57
|
-
export declare function describeUnmatched({ token, suggestions }: UnmatchedEntry): string;
|
|
58
|
-
/** The `unmatched: "error"` message (generator.ts:2574). */
|
|
59
|
-
export declare function formatUnmatchedError(diagnosed: UnmatchedEntry[]): string;
|
|
60
|
-
/** `isTokenShaped` (unmatched-diagnostics.ts:59-70), for when no `@teacss/core` host is present. */
|
|
61
|
-
export declare function fallbackIsTokenShaped(token: string): boolean;
|
|
62
|
-
export interface FacadeResult {
|
|
63
|
-
readonly css: string;
|
|
64
|
-
layers: string[];
|
|
65
|
-
matched: Set<string> | Map<string, unknown>;
|
|
66
|
-
getLayers: (includes?: string[], excludes?: string[]) => string;
|
|
67
|
-
getLayer: (layer?: string) => string;
|
|
68
|
-
setLayer: (layer: string, callback: (content: string) => string | Promise<string>) => Promise<string>;
|
|
69
|
-
readonly diagnostics: {
|
|
70
|
-
unmatched: UnmatchedEntry[];
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
export declare function createFacadeResult({ rust, matched, minify, outputToCssLayers, configuredLayers, resolveUnmatched, }: {
|
|
74
|
-
rust: RustGenerateResult;
|
|
75
|
-
matched: Set<string> | Map<string, unknown>;
|
|
76
|
-
minify: boolean;
|
|
77
|
-
outputToCssLayers: boolean | {
|
|
78
|
-
allLayers?: boolean;
|
|
79
|
-
} | null | undefined;
|
|
80
|
-
configuredLayers: Record<string, number>;
|
|
81
|
-
resolveUnmatched: () => UnmatchedEntry[];
|
|
82
|
-
}): FacadeResult;
|
|
83
|
-
//# sourceMappingURL=result.d.ts.map
|
package/dist/result.js
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
// The facade's `generate` result, shaped like the 0.8.2 `GenerateResult` (core/generator.ts:1540-1575).
|
|
2
|
-
/** The `stringifyShortcuts` warnings (generator.ts:3445) and the leaf-limit warning, in order. */
|
|
3
|
-
export function shortcutWarningMessages(warnings) {
|
|
4
|
-
return warnings.flatMap((warning) => ("unmatched" in warning ? warning.unmatched.map((member) => `unmatched utility "${member}" in shortcut "${warning.shortcut}"`) : [`shortcut "${warning.shortcut}" expands to more than ${warning.leafLimit} members (repeats included) and matches nothing`]));
|
|
5
|
-
}
|
|
6
|
-
/** `rust.matched` as the token list, split once at the boundary. */
|
|
7
|
-
export function splitMatched(rust) {
|
|
8
|
-
return rust.matched === "" ? [] : rust.matched.split("\0");
|
|
9
|
-
}
|
|
10
|
-
export function uniq(items) {
|
|
11
|
-
return [...new Set(items)];
|
|
12
|
-
}
|
|
13
|
-
/** By `configuredLayers[name] ?? 0`, ties by UTF-16 code units (generator.ts:1310-1312). */
|
|
14
|
-
export function sortLayerNames(names, configuredLayers) {
|
|
15
|
-
const order = (layer) => (Object.hasOwn(configuredLayers, layer) ? (configuredLayers[layer] ?? 0) : 0);
|
|
16
|
-
return [...names].sort((a, b) => order(a) - order(b) || (a < b ? -1 : a > b ? 1 : 0));
|
|
17
|
-
}
|
|
18
|
-
/** A v02.2 `StringifiedUtil` as the oracle 7-tuple; `null` meta values are dropped. */
|
|
19
|
-
export function toTuple(util) {
|
|
20
|
-
let meta;
|
|
21
|
-
if (util.meta) {
|
|
22
|
-
meta = {};
|
|
23
|
-
for (const [key, value] of Object.entries(util.meta))
|
|
24
|
-
if (value !== null && value !== undefined)
|
|
25
|
-
meta[key] = value;
|
|
26
|
-
}
|
|
27
|
-
return [util.index, util.selector ?? undefined, util.body, util.parent ?? undefined, meta, undefined, util.noMerge ?? undefined];
|
|
28
|
-
}
|
|
29
|
-
export function buildMatched({ rust, matched, extendedInfo, countOf }) {
|
|
30
|
-
if (!extendedInfo)
|
|
31
|
-
return new Set(matched);
|
|
32
|
-
return new Map((rust.matchedInfo ?? []).map(({ token, data, count }) => [token, { data: data.map(toTuple), count: countOf ? countOf(token, count) : count }]));
|
|
33
|
-
}
|
|
34
|
-
export function describeUnmatched({ token, suggestions }) {
|
|
35
|
-
return suggestions.length ? `"${token}" (did you mean ${suggestions.map((s) => `"${s}"`).join(", ")}?)` : `"${token}"`;
|
|
36
|
-
}
|
|
37
|
-
/** The `unmatched: "error"` message (generator.ts:2574). */
|
|
38
|
-
export function formatUnmatchedError(diagnosed) {
|
|
39
|
-
return `[@teacss/core] ${diagnosed.length} token${diagnosed.length === 1 ? "" : "s"} matched no rule: ${diagnosed.map(describeUnmatched).join("; ")}`;
|
|
40
|
-
}
|
|
41
|
-
const TOKEN_PREFIX_RE = /^[a-z][a-z0-9-]*$/;
|
|
42
|
-
const NON_TOKEN_SCHEMES = new Set(["about", "blob", "bun", "chrome", "data", "deno", "file", "ftp", "http", "https", "jsr", "mailto", "node", "npm", "tel", "urn", "vscode", "virtual", "ws", "wss"]);
|
|
43
|
-
/**
|
|
44
|
-
* `tokenConditionBase` (unmatched-diagnostics.ts:49): the token before its first depth-0 `@`, the
|
|
45
|
-
* `!` kept. As in `parseClassToken` (token.ts:54), only `()` and `[]` nest, and quotes, escapes
|
|
46
|
-
* and comments count inside them; an unclosed comment ends the scan.
|
|
47
|
-
*/
|
|
48
|
-
function tokenConditionBase(raw) {
|
|
49
|
-
let closers = "";
|
|
50
|
-
let quote;
|
|
51
|
-
for (let index = 0; index < raw.length; index++) {
|
|
52
|
-
const character = raw[index];
|
|
53
|
-
if (quote) {
|
|
54
|
-
if (character === "\\")
|
|
55
|
-
index++;
|
|
56
|
-
else if (character === quote)
|
|
57
|
-
quote = undefined;
|
|
58
|
-
continue;
|
|
59
|
-
}
|
|
60
|
-
if (closers.length > 0) {
|
|
61
|
-
if (character === "\\") {
|
|
62
|
-
index++;
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
if (character === '"' || character === "'") {
|
|
66
|
-
quote = character;
|
|
67
|
-
continue;
|
|
68
|
-
}
|
|
69
|
-
if (character === "/" && raw[index + 1] === "*") {
|
|
70
|
-
const close = raw.indexOf("*/", index + 2);
|
|
71
|
-
if (close < 0)
|
|
72
|
-
break;
|
|
73
|
-
index = close + 1;
|
|
74
|
-
continue;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
if (character === "(" || character === "[")
|
|
78
|
-
closers += character === "(" ? ")" : "]";
|
|
79
|
-
else if (character === closers.at(-1))
|
|
80
|
-
closers = closers.slice(0, -1);
|
|
81
|
-
else if (closers.length === 0 && character === "@")
|
|
82
|
-
return raw.slice(0, index);
|
|
83
|
-
}
|
|
84
|
-
return raw;
|
|
85
|
-
}
|
|
86
|
-
/** `isTokenShaped` (unmatched-diagnostics.ts:59-70), for when no `@teacss/core` host is present. */
|
|
87
|
-
export function fallbackIsTokenShaped(token) {
|
|
88
|
-
const base = tokenConditionBase(token);
|
|
89
|
-
if (!base || base.startsWith("$") || base.startsWith("["))
|
|
90
|
-
return false;
|
|
91
|
-
const separator = base.indexOf(":");
|
|
92
|
-
if (separator <= 0 || separator === base.length - 1)
|
|
93
|
-
return false;
|
|
94
|
-
const prefix = base.slice(0, separator);
|
|
95
|
-
if (!TOKEN_PREFIX_RE.test(prefix))
|
|
96
|
-
return false;
|
|
97
|
-
if (base.startsWith("//", separator + 1))
|
|
98
|
-
return false;
|
|
99
|
-
return !NON_TOKEN_SCHEMES.has(prefix);
|
|
100
|
-
}
|
|
101
|
-
export function createFacadeResult({ rust, matched, minify, outputToCssLayers, configuredLayers, resolveUnmatched, }) {
|
|
102
|
-
const nl = minify ? "" : "\n";
|
|
103
|
-
const orderedLayers = rust.layers.map((layer) => layer.name);
|
|
104
|
-
const layerCache = Object.create(null);
|
|
105
|
-
for (const layer of rust.layers)
|
|
106
|
-
layerCache[layer.name] = layer.css;
|
|
107
|
-
const allCssLayers = typeof outputToCssLayers === "object" && outputToCssLayers !== null && outputToCssLayers.allLayers ? sortLayerNames(uniq([...Object.keys(configuredLayers), ...orderedLayers]), configuredLayers) : undefined;
|
|
108
|
-
// `hasOwn` guarantees the entry, which `noUncheckedIndexedAccess` cannot see.
|
|
109
|
-
const getLayer = (layer = "utilities") => (Object.hasOwn(layerCache, layer) ? layerCache[layer] : "");
|
|
110
|
-
const getLayers = (includes = orderedLayers, excludes) => {
|
|
111
|
-
const excluded = new Set(excludes ?? []);
|
|
112
|
-
const selected = [...includes].filter((layer) => !excluded.has(layer));
|
|
113
|
-
const css = selected.map((layer) => getLayer(layer)).filter(Boolean);
|
|
114
|
-
if (outputToCssLayers) {
|
|
115
|
-
const names = uniq(allCssLayers ?? selected);
|
|
116
|
-
if (names.length > 0)
|
|
117
|
-
css.unshift(`@layer ${names.join(", ")};`);
|
|
118
|
-
}
|
|
119
|
-
return css.join(nl);
|
|
120
|
-
};
|
|
121
|
-
const setLayer = async (layer, callback) => {
|
|
122
|
-
const content = await callback(getLayer(layer));
|
|
123
|
-
layerCache[layer] = content;
|
|
124
|
-
return content;
|
|
125
|
-
};
|
|
126
|
-
let diagnostics;
|
|
127
|
-
return {
|
|
128
|
-
get css() {
|
|
129
|
-
return getLayers();
|
|
130
|
-
},
|
|
131
|
-
layers: [...orderedLayers],
|
|
132
|
-
matched,
|
|
133
|
-
getLayers,
|
|
134
|
-
getLayer,
|
|
135
|
-
setLayer,
|
|
136
|
-
get diagnostics() {
|
|
137
|
-
diagnostics ??= { unmatched: resolveUnmatched() };
|
|
138
|
-
return diagnostics;
|
|
139
|
-
},
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
//# sourceMappingURL=result.js.map
|
package/dist/select.d.ts
DELETED
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import type { LoadProjectRequest } from "../contract.js";
|
|
2
|
-
export type Failure = {
|
|
3
|
-
ok: false;
|
|
4
|
-
reason: string;
|
|
5
|
-
path: string;
|
|
6
|
-
};
|
|
7
|
-
export type Success<T> = {
|
|
8
|
-
ok: true;
|
|
9
|
-
value: T;
|
|
10
|
-
};
|
|
11
|
-
export declare function fail(reason: string, path: string): Failure;
|
|
12
|
-
export declare function ok<T>(value: T): Success<T>;
|
|
13
|
-
/**
|
|
14
|
-
* Port of core/config.ts:48-59: `defaults` underneath, then the user config's own enumerable keys
|
|
15
|
-
* whose value is not `undefined`. Only string keys are copied (v02.9 §4.4); values are defined
|
|
16
|
-
* rather than assigned so a `__proto__` key stays a plain property.
|
|
17
|
-
*/
|
|
18
|
-
export declare function mergeDefinedConfig(defaults: object, userConfig: object): Record<string, unknown>;
|
|
19
|
-
export declare const KNOWN_KEYS: Set<string>;
|
|
20
|
-
/** Keys whose presence with a non-empty value means fallback; `transformers` is checked by name (F7.09). */
|
|
21
|
-
export declare const DYNAMIC_KEYS: readonly string[];
|
|
22
|
-
/** A function, a non-empty array or object, or any other defined non-null value. */
|
|
23
|
-
export declare function isNonEmpty(value: unknown): boolean;
|
|
24
|
-
/**
|
|
25
|
-
* v02.9 §4.2 step 2: unknown keys, then the dynamic keys in order, then the static options only
|
|
26
|
-
* the TypeScript engine honours. `engine` is a hook option and its value is not checked here.
|
|
27
|
-
*/
|
|
28
|
-
export declare function checkTopLevelKeys(merged: Record<string, unknown>): Success<null> | Failure;
|
|
29
|
-
/**
|
|
30
|
-
* The first own accessor property of `object`. Translation reads every field, so a getter would
|
|
31
|
-
* run before TS reads it again (presets.test.ts "snapshots an own preset name exactly once"); an
|
|
32
|
-
* object with accessors falls back without invoking them.
|
|
33
|
-
*/
|
|
34
|
-
export declare function ownAccessor(object: object): string | undefined;
|
|
35
|
-
/**
|
|
36
|
-
* v02.9 §4.2 step 3: nested presets flattened depth first, deduplicated by name keeping the first
|
|
37
|
-
* (core/config.ts:26-36 — a missing name is a name too), then ordered pre, normal, post
|
|
38
|
-
* (config.ts:216-220; any other `enforce` value drops the preset, as there).
|
|
39
|
-
*/
|
|
40
|
-
export declare function flattenPresets(presetsValue: unknown): Success<object[]> | Failure;
|
|
41
|
-
/** The oracle's `PresetOptions` base (types.ts:53) has no named fields, so these five are Standard's whole option set. */
|
|
42
|
-
export declare const STANDARD_OPTION_KEYS: Set<string>;
|
|
43
|
-
export declare const COMPILE_CLASS_KEYS: string[];
|
|
44
|
-
export declare const ICONS_OPTION_KEYS: string[];
|
|
45
|
-
export declare const BUNDLED_ICON_COLLECTIONS: Set<string>;
|
|
46
|
-
export declare const ROLE_PALETTES_PRESET = "@teacss/config/role-palettes";
|
|
47
|
-
export declare function pick(obj: Record<string, unknown>, keys: Iterable<string>): Record<string, unknown>;
|
|
48
|
-
/**
|
|
49
|
-
* v02.9 §4.2 step 4, first four items: the marked built-in presets and the role-palettes marker.
|
|
50
|
-
* `ok(null)` means the preset yields no `PresetSpec`; `undefined` means it is not one of these
|
|
51
|
-
* (unmarked presets go to F7.08's static translation).
|
|
52
|
-
* such as `presets[1]`
|
|
53
|
-
*/
|
|
54
|
-
export declare function translateTaggedPreset(preset: object, path: string, ctx: {
|
|
55
|
-
hasEntry: boolean;
|
|
56
|
-
}): Success<object | null> | Failure | undefined;
|
|
57
|
-
/** Keys of an unmarked preset whose non-empty value means fallback; `content` is checked by `hasContentBeyondPipeline`. */
|
|
58
|
-
export declare const PRESET_DYNAMIC_KEYS: readonly string[];
|
|
59
|
-
/**
|
|
60
|
-
* v02.9 §4.5: the static shortcut forms as `[name, expansion]` pairs. A shortcut meta (`[n, e, meta]`)
|
|
61
|
-
* has no place in `StaticPreset.shortcuts`, so any meta key falls back.
|
|
62
|
-
*
|
|
63
|
-
*/
|
|
64
|
-
export declare function translateShortcuts(value: unknown, path: string, reasonOnFail: string): Success<Array<[string, string]> | undefined> | Failure;
|
|
65
|
-
/**
|
|
66
|
-
* v02.9 §4.5: a theme as dotted keys to string leaves (numbers stringified); empty objects vanish.
|
|
67
|
-
*
|
|
68
|
-
*/
|
|
69
|
-
export declare function flattenTheme(theme: unknown, path: string, reasonOnFail: string): Success<Record<string, string> | undefined> | Failure;
|
|
70
|
-
export declare function translateStringList(list: unknown, path: string, reasonOnFail: string): Success<string[] | undefined> | Failure;
|
|
71
|
-
export declare function translateLayers(layers: unknown, path: string, reasonOnFail: string): Success<Record<string, number> | undefined> | Failure;
|
|
72
|
-
/**
|
|
73
|
-
* v02.9 §4.2 step 4, "other objects": an unmarked preset as a `StaticPreset`.
|
|
74
|
-
*/
|
|
75
|
-
export declare function translateStaticPreset(preset: Record<string, any>, path: string): Success<{
|
|
76
|
-
kind: "static";
|
|
77
|
-
preset: object;
|
|
78
|
-
}> | Failure;
|
|
79
|
-
/**
|
|
80
|
-
* v02.9 §4.2 step 5: the merged config's static fields as a `StaticConfig` (possibly empty).
|
|
81
|
-
*/
|
|
82
|
-
export declare function translateInline(merged: Record<string, any>): Success<object> | Failure;
|
|
83
|
-
export declare const ALLOWED_TRANSFORMER_NAMES: Set<string>;
|
|
84
|
-
/**
|
|
85
|
-
* v02.2 §4: allow-listed transformers stay with the host (kept in the facade's `config.transformers`)
|
|
86
|
-
* and never reach Rust; any other name falls back. Repeated names are kept in order; the config view
|
|
87
|
-
* applies `uniqueNamed` later (F7.20). `@teacss/directives` options live in its closure and are
|
|
88
|
-
* checked per call (v02.9 §6.3), so none are read here.
|
|
89
|
-
*/
|
|
90
|
-
export declare function translateTransformers(list: unknown): Success<object[]> | Failure;
|
|
91
|
-
/**
|
|
92
|
-
* A config's own `transformerCompileClass(options)` keeps its options in a closure the facade
|
|
93
|
-
* cannot read, and it registers classes by pushing onto `config.shortcuts`, which never reaches
|
|
94
|
-
* the Engine. It is harmless only when the last Standard preset enables compileClass: the facade's
|
|
95
|
-
* Rust transformer then comes first and `uniqueNamed` drops it, as the oracle drops it after the
|
|
96
|
-
* preset's own. Otherwise it would run and its classes would generate no CSS, so it falls back.
|
|
97
|
-
*/
|
|
98
|
-
export declare function hostCompileClass(transformers: readonly object[], presetSpecs: readonly object[]): Failure | undefined;
|
|
99
|
-
export type EntryProvenance = {
|
|
100
|
-
base: string;
|
|
101
|
-
entryFile: string | undefined;
|
|
102
|
-
entryCss: string | undefined;
|
|
103
|
-
derivedKeys: string[];
|
|
104
|
-
};
|
|
105
|
-
export type EntrySource = {
|
|
106
|
-
root: string;
|
|
107
|
-
entry: {
|
|
108
|
-
path: string;
|
|
109
|
-
css: string | null;
|
|
110
|
-
} | null;
|
|
111
|
-
declarationFiles: string[];
|
|
112
|
-
derivedKeys: string[];
|
|
113
|
-
};
|
|
114
|
-
/** Test seam for the scanner; the default dynamically imports `@teacss/config/internal/source-scan`. */
|
|
115
|
-
type SourceScanner = {
|
|
116
|
-
scanSourceFiles: (patterns: readonly string[], options: {
|
|
117
|
-
cwd: string;
|
|
118
|
-
ignore?: readonly string[];
|
|
119
|
-
expandDirectories: boolean;
|
|
120
|
-
}) => Promise<string[]>;
|
|
121
|
-
};
|
|
122
|
-
export declare const scanners: {
|
|
123
|
-
load: (() => Promise<SourceScanner>) | null;
|
|
124
|
-
};
|
|
125
|
-
/**
|
|
126
|
-
* Entry source and declaration files (v02.9 §4.4). The symbols are read from `userConfig`, not
|
|
127
|
-
* `merged`: `mergeDefinedConfig` copies no symbols.
|
|
128
|
-
*/
|
|
129
|
-
export declare function resolveEntrySource(userConfig: object, merged: Record<string, unknown>): Promise<Success<EntrySource> | Failure>;
|
|
130
|
-
/**
|
|
131
|
-
* v02.9 §4: `UserConfig` → `LoadProjectRequest`; the first item that cannot be translated is
|
|
132
|
-
* returned as a `Failure`.
|
|
133
|
-
*
|
|
134
|
-
*/
|
|
135
|
-
export type TranslateResult = {
|
|
136
|
-
ok: true;
|
|
137
|
-
request: LoadProjectRequest;
|
|
138
|
-
presets: object[];
|
|
139
|
-
transformers: object[];
|
|
140
|
-
} | Failure;
|
|
141
|
-
export declare function translateConfig(userConfig?: object, defaults?: object): Promise<TranslateResult>;
|
|
142
|
-
/**
|
|
143
|
-
* v02.9 §9: with `TEACSS_ENGINE_DEBUG=1`, the request or the failure goes to stderr.
|
|
144
|
-
*/
|
|
145
|
-
export declare function debugTranslate(outcome: {
|
|
146
|
-
ok: true;
|
|
147
|
-
request: Record<string, any>;
|
|
148
|
-
} | Failure, userConfig: object): void;
|
|
149
|
-
export declare const VALID_MODES: Set<string>;
|
|
150
|
-
/**
|
|
151
|
-
* SemVer 2.0 precedence: the numeric triple, then a release above any of its prereleases, then
|
|
152
|
-
* the prerelease identifiers in order (numeric ones by value and below alphanumeric ones, a shorter
|
|
153
|
-
* list first when one is a prefix of the other).
|
|
154
|
-
*/
|
|
155
|
-
export declare function compareSemver(a: string, b: string): -1 | 0 | 1;
|
|
156
|
-
/** Only the `>=A <B` form `engineCompat.core` uses (v02.11 §7.3). */
|
|
157
|
-
export declare function satisfiesRange(version: string, range: string): boolean;
|
|
158
|
-
/**
|
|
159
|
-
* v02.9 §8.1: `TEACSS_ENGINE` over the hook option over `"ts"`; an `"auto"` option stays on TS while
|
|
160
|
-
* `defaultMode` is `"opt-in"`; a host core outside `engineCompat.core` keeps TS, or throws when
|
|
161
|
-
* Rust was asked for.
|
|
162
|
-
*
|
|
163
|
-
*/
|
|
164
|
-
export declare function selectEngineRequest({ hostCoreVersion, option, env, compat }: {
|
|
165
|
-
hostCoreVersion?: string | undefined;
|
|
166
|
-
option?: unknown;
|
|
167
|
-
env?: string | undefined;
|
|
168
|
-
compat?: {
|
|
169
|
-
core?: string;
|
|
170
|
-
defaultMode?: "opt-in" | "auto";
|
|
171
|
-
};
|
|
172
|
-
}): {
|
|
173
|
-
engine: "rust" | "ts";
|
|
174
|
-
mode: "auto" | "rust" | "ts";
|
|
175
|
-
source: "env" | "option" | "default";
|
|
176
|
-
invalidEnv?: string;
|
|
177
|
-
resolvedBy?: "opt-in";
|
|
178
|
-
reason?: string;
|
|
179
|
-
path?: string;
|
|
180
|
-
detail?: Record<string, unknown>;
|
|
181
|
-
};
|
|
182
|
-
export {};
|
|
183
|
-
//# sourceMappingURL=select.d.ts.map
|