@tamagui/compiler-core 0.0.0-bootstrap.0 → 3.0.0-beta.643.1
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 +21 -0
- package/README.md +57 -1
- package/dist/cjs/ast.cjs +95 -0
- package/dist/cjs/contracts.cjs +62 -0
- package/dist/cjs/diagnostics.cjs +69 -0
- package/dist/cjs/evaluate.cjs +351 -0
- package/dist/cjs/graph.cjs +279 -0
- package/dist/cjs/hash.cjs +49 -0
- package/dist/cjs/index.cjs +44 -0
- package/dist/cjs/ir.cjs +33 -0
- package/dist/cjs/lower.cjs +225 -0
- package/dist/cjs/materialize.cjs +200 -0
- package/dist/cjs/normalize.cjs +622 -0
- package/dist/cjs/output.cjs +149 -0
- package/dist/cjs/planCache.cjs +224 -0
- package/dist/cjs/session.cjs +119 -0
- package/dist/cjs/yuku.cjs +159 -0
- package/dist/cjs/zero.cjs +387 -0
- package/dist/esm/ast.mjs +65 -0
- package/dist/esm/ast.mjs.map +1 -0
- package/dist/esm/contracts.mjs +34 -0
- package/dist/esm/contracts.mjs.map +1 -0
- package/dist/esm/diagnostics.mjs +44 -0
- package/dist/esm/diagnostics.mjs.map +1 -0
- package/dist/esm/evaluate.mjs +327 -0
- package/dist/esm/evaluate.mjs.map +1 -0
- package/dist/esm/graph.mjs +256 -0
- package/dist/esm/graph.mjs.map +1 -0
- package/dist/esm/hash.mjs +26 -0
- package/dist/esm/hash.mjs.map +1 -0
- package/dist/esm/index.mjs +30 -0
- package/dist/esm/ir.mjs +12 -0
- package/dist/esm/ir.mjs.map +1 -0
- package/dist/esm/lower.mjs +202 -0
- package/dist/esm/lower.mjs.map +1 -0
- package/dist/esm/materialize.mjs +179 -0
- package/dist/esm/materialize.mjs.map +1 -0
- package/dist/esm/normalize.mjs +596 -0
- package/dist/esm/normalize.mjs.map +1 -0
- package/dist/esm/output.mjs +119 -0
- package/dist/esm/output.mjs.map +1 -0
- package/dist/esm/planCache.mjs +194 -0
- package/dist/esm/planCache.mjs.map +1 -0
- package/dist/esm/session.mjs +99 -0
- package/dist/esm/session.mjs.map +1 -0
- package/dist/esm/yuku.mjs +136 -0
- package/dist/esm/yuku.mjs.map +1 -0
- package/dist/esm/zero.mjs +352 -0
- package/dist/esm/zero.mjs.map +1 -0
- package/package.json +42 -4
- package/src/ast.ts +86 -0
- package/src/contracts.ts +148 -0
- package/src/diagnostics.ts +96 -0
- package/src/evaluate.ts +497 -0
- package/src/graph.ts +347 -0
- package/src/hash.ts +36 -0
- package/src/index.ts +15 -0
- package/src/ir.ts +154 -0
- package/src/lower.ts +418 -0
- package/src/materialize.ts +330 -0
- package/src/normalize.ts +846 -0
- package/src/output.ts +175 -0
- package/src/planCache.ts +327 -0
- package/src/session.ts +172 -0
- package/src/yuku.ts +189 -0
- package/src/zero.ts +598 -0
- package/types/ast.d.ts +10 -0
- package/types/ast.d.ts.map +1 -0
- package/types/contracts.d.ts +97 -0
- package/types/contracts.d.ts.map +1 -0
- package/types/diagnostics.d.ts +31 -0
- package/types/diagnostics.d.ts.map +1 -0
- package/types/evaluate.d.ts +36 -0
- package/types/evaluate.d.ts.map +1 -0
- package/types/graph.d.ts +37 -0
- package/types/graph.d.ts.map +1 -0
- package/types/hash.d.ts +8 -0
- package/types/hash.d.ts.map +1 -0
- package/types/index.d.ts +16 -0
- package/types/index.d.ts.map +1 -0
- package/types/ir.d.ts +118 -0
- package/types/ir.d.ts.map +1 -0
- package/types/lower.d.ts +99 -0
- package/types/lower.d.ts.map +1 -0
- package/types/materialize.d.ts +104 -0
- package/types/materialize.d.ts.map +1 -0
- package/types/normalize.d.ts +8 -0
- package/types/normalize.d.ts.map +1 -0
- package/types/output.d.ts +32 -0
- package/types/output.d.ts.map +1 -0
- package/types/planCache.d.ts +113 -0
- package/types/planCache.d.ts.map +1 -0
- package/types/session.d.ts +44 -0
- package/types/session.d.ts.map +1 -0
- package/types/yuku.d.ts +4 -0
- package/types/yuku.d.ts.map +1 -0
- package/types/zero.d.ts +98 -0
- package/types/zero.d.ts.map +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAG/D,MAAM,WAAW,UAAU;IACzB,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAA;IACb,8EAA8E;IAC9E,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,UAAU,CAAA;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,CAAC,CAAA;IACV,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;IACxB,OAAO,EAAE,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAA;IACnC,cAAc,EAAE,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAA;IAC1C,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,iBAAiB,GAAG,IAAI,CAAA;CAC9B;AAED,MAAM,WAAW,2BAA2B;IAC1C,EAAE,EAAE,gBAAgB,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,SAAS,UAAU,EAAE,CAAA;CAC7B;AASD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,UAAU,EAAE,GAAG,IAAI,CAkBtF;AA2ED,uFAAuF;AACvF,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,gBAAgB,EACpB,IAAI,EAAE,2BAA2B,GAChC,oBAAoB,CAwBtB"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import type { HostModuleInput, ResolvedModuleId } from './contracts';
|
|
2
|
+
import { type LoweredModulePlan } from './lower';
|
|
3
|
+
export declare const PLAN_CACHE_SCHEMA_VERSION = 1;
|
|
4
|
+
/**
|
|
5
|
+
* Entries are content addressed, so every edit of a shared module writes new
|
|
6
|
+
* files and nothing ever replaces the old ones. Twenty edits of one module a
|
|
7
|
+
* hundred consumers import leaves two thousand dead entries that would live
|
|
8
|
+
* forever. A pruned entry is just a miss, and a miss recompiles, so dropping
|
|
9
|
+
* entries can never be wrong - only slower.
|
|
10
|
+
*
|
|
11
|
+
* The cap has to sit well above the module count of a real project, or an
|
|
12
|
+
* unchanged rebuild of a project larger than the cap would miss on every module
|
|
13
|
+
* the last build evicted. Twenty thousand entries is a few hundred MB at the
|
|
14
|
+
* high end and comfortably holds a large app plus several generations of edits.
|
|
15
|
+
*
|
|
16
|
+
* It is a soft cap: pruning runs between batches of writes, so a store can sit
|
|
17
|
+
* up to one batch above it. Bounding growth is the point, not an exact size.
|
|
18
|
+
*/
|
|
19
|
+
export declare const PLAN_CACHE_MAX_ENTRIES = 20000;
|
|
20
|
+
/**
|
|
21
|
+
* The one on-disk cache location for a project. Metro's plan manifest already
|
|
22
|
+
* lives under it, and the build-time benchmark's "cold" state is defined as
|
|
23
|
+
* deleting it, so everything the compiler persists belongs here and nowhere
|
|
24
|
+
* else.
|
|
25
|
+
*/
|
|
26
|
+
export declare function tamaguiCacheRoot(projectRoot: string): string;
|
|
27
|
+
export declare function defaultPlanCacheRoot(projectRoot: string, target: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Everything a plan depends on that is not a module: the compiler build, the
|
|
30
|
+
* evaluated Tamagui config and component registry, the platform, and the
|
|
31
|
+
* structural pass. `stamp` comes from `loadCompilerProject`'s `cacheStamp`.
|
|
32
|
+
*/
|
|
33
|
+
export interface PlanCacheIdentity {
|
|
34
|
+
stamp: string;
|
|
35
|
+
target: string;
|
|
36
|
+
structuralPassHash: string;
|
|
37
|
+
}
|
|
38
|
+
export interface PlanCacheEntry {
|
|
39
|
+
schemaVersion: typeof PLAN_CACHE_SCHEMA_VERSION;
|
|
40
|
+
moduleId: ResolvedModuleId;
|
|
41
|
+
/** Digest of this module plus its whole non-external import closure. */
|
|
42
|
+
closureDigest: string;
|
|
43
|
+
plan: LoweredModulePlan;
|
|
44
|
+
}
|
|
45
|
+
export interface ModuleClosureNode {
|
|
46
|
+
contentHash: string;
|
|
47
|
+
/** Non-external dependencies only: the edges symbol resolution can cross. */
|
|
48
|
+
dependencies: readonly ResolvedModuleId[];
|
|
49
|
+
}
|
|
50
|
+
export type ModuleClosureLookup = (id: ResolvedModuleId) => ModuleClosureNode | null;
|
|
51
|
+
/**
|
|
52
|
+
* Reads a closure node straight off host module records, for callers that have
|
|
53
|
+
* not built a ProjectGraph (Metro's prepass skips it entirely on a full hit).
|
|
54
|
+
*/
|
|
55
|
+
export declare function moduleClosureNode(input: HostModuleInput): ModuleClosureNode;
|
|
56
|
+
/**
|
|
57
|
+
* Identity of a module's whole compile input: itself plus every module reachable
|
|
58
|
+
* from it over non-external imports, each by content hash.
|
|
59
|
+
*
|
|
60
|
+
* This is deliberately the import closure rather than the dependency set a
|
|
61
|
+
* successful compile recorded. The recorded set is only known after compiling,
|
|
62
|
+
* and it omits the module that made a value bail, so a dependency edit that
|
|
63
|
+
* turns a bailout into a static value would not invalidate its consumer, which
|
|
64
|
+
* is exactly how a stale style ships. The import closure is the same edge set
|
|
65
|
+
* `ProjectGraph.affectedBy` propagates over in memory, so it can never
|
|
66
|
+
* invalidate less than a live session would.
|
|
67
|
+
*
|
|
68
|
+
* Null when any module in the closure is unknown: an unknown input is a miss,
|
|
69
|
+
* never a guess.
|
|
70
|
+
*/
|
|
71
|
+
export declare function moduleClosureDigest(id: ResolvedModuleId, lookup: ModuleClosureLookup, memo?: Map<ResolvedModuleId, string | null>): string | null;
|
|
72
|
+
export declare function planCacheKey(identity: PlanCacheIdentity, id: ResolvedModuleId, closureDigest: string): string;
|
|
73
|
+
/**
|
|
74
|
+
* Content-addressed JSON entries on disk, one file per key. There is no
|
|
75
|
+
* manifest on purpose: a manifest is what makes a cache all-or-nothing, and the
|
|
76
|
+
* point of these caches is that editing one module leaves every other module's
|
|
77
|
+
* entry valid.
|
|
78
|
+
*/
|
|
79
|
+
export declare class JsonFileCache {
|
|
80
|
+
#private;
|
|
81
|
+
readonly root: string;
|
|
82
|
+
readonly schemaVersion: number;
|
|
83
|
+
readonly maxEntries: number;
|
|
84
|
+
constructor(root: string, schemaVersion: number, maxEntries?: number);
|
|
85
|
+
get stats(): {
|
|
86
|
+
hits: number;
|
|
87
|
+
misses: number;
|
|
88
|
+
writes: number;
|
|
89
|
+
};
|
|
90
|
+
resetStats(): void;
|
|
91
|
+
/**
|
|
92
|
+
* Null on anything short of an entry `validate` fully accepts. A miss
|
|
93
|
+
* recompiles; nothing here repairs or partially trusts an entry, and a later
|
|
94
|
+
* successful compile overwrites the bad file.
|
|
95
|
+
*/
|
|
96
|
+
read<T>(key: string, validate: (value: unknown) => T | null): Promise<T | null>;
|
|
97
|
+
write(key: string, value: unknown): Promise<void>;
|
|
98
|
+
}
|
|
99
|
+
/** Per-module lowering plans, keyed by `planCacheKey`. */
|
|
100
|
+
export declare class ModulePlanCache {
|
|
101
|
+
#private;
|
|
102
|
+
readonly root: string;
|
|
103
|
+
constructor(root: string);
|
|
104
|
+
get stats(): {
|
|
105
|
+
hits: number;
|
|
106
|
+
misses: number;
|
|
107
|
+
writes: number;
|
|
108
|
+
};
|
|
109
|
+
resetStats(): void;
|
|
110
|
+
read(key: string, id: ResolvedModuleId, closureDigest: string): Promise<PlanCacheEntry | null>;
|
|
111
|
+
write(key: string, entry: PlanCacheEntry): Promise<void>;
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=planCache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{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GAAG,IAAI,CAAC,CAmBhC;IAED,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAEvD;CACF"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { HostModuleInput, ResolvedModuleId } from './contracts';
|
|
2
|
+
import type { GraphInvalidation } from './graph';
|
|
3
|
+
import type { CompilerLoweringHost, CompilerTarget, LoweredModulePlan, StructuralModulePass } from './lower';
|
|
4
|
+
import type { AppliedLoweredModule } from './output';
|
|
5
|
+
import type { ModulePlanCache } from './planCache';
|
|
6
|
+
export interface CompilerAdapter {
|
|
7
|
+
target: CompilerTarget;
|
|
8
|
+
projectGeneration: string;
|
|
9
|
+
host: CompilerLoweringHost;
|
|
10
|
+
load(id: ResolvedModuleId): Promise<HostModuleInput | null>;
|
|
11
|
+
/**
|
|
12
|
+
* Persistent per-module plan reuse across processes. Absent means the host
|
|
13
|
+
* could not produce a content stamp for this project, so nothing is cached
|
|
14
|
+
* rather than cached under a stamp that does not describe the config.
|
|
15
|
+
*/
|
|
16
|
+
planCache?: {
|
|
17
|
+
store: ModulePlanCache;
|
|
18
|
+
stamp: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export interface CompileModuleInput {
|
|
22
|
+
module: HostModuleInput;
|
|
23
|
+
adapter: CompilerAdapter;
|
|
24
|
+
structuralPass?: StructuralModulePass;
|
|
25
|
+
}
|
|
26
|
+
export interface CompilerSessionResult {
|
|
27
|
+
plan: LoweredModulePlan;
|
|
28
|
+
output: AppliedLoweredModule;
|
|
29
|
+
invalidatedIds: ResolvedModuleId[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Bundler-neutral compiler state. The adapter owns module resolution and loading;
|
|
33
|
+
* the session only accepts canonical host-resolved module records.
|
|
34
|
+
*/
|
|
35
|
+
export declare class CompilerSession {
|
|
36
|
+
#private;
|
|
37
|
+
compile(input: CompileModuleInput): Promise<CompilerSessionResult>;
|
|
38
|
+
update(module: HostModuleInput): Promise<ResolvedModuleId[]>;
|
|
39
|
+
has(id: ResolvedModuleId): boolean;
|
|
40
|
+
dependentsOf(id: ResolvedModuleId): ResolvedModuleId[];
|
|
41
|
+
remove(id: ResolvedModuleId): Promise<GraphInvalidation>;
|
|
42
|
+
parseCount(id: ResolvedModuleId): number;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEhD,OAAO,KAAK,EACV,oBAAoB,EACpB,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,SAAS,CAAA;AAGhB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAEpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAIlD,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,cAAc,CAAA;IACtB,iBAAiB,EAAE,MAAM,CAAA;IACzB,IAAI,EAAE,oBAAoB,CAAA;IAC1B,IAAI,CAAC,EAAE,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAAA;IAC3D;;;;OAIG;IACH,SAAS,CAAC,EAAE;QAAE,KAAK,EAAE,eAAe,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;CACtD;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,eAAe,CAAA;IACvB,OAAO,EAAE,eAAe,CAAA;IACxB,cAAc,CAAC,EAAE,oBAAoB,CAAA;CACtC;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,iBAAiB,CAAA;IACvB,MAAM,EAAE,oBAAoB,CAAA;IAC5B,cAAc,EAAE,gBAAgB,EAAE,CAAA;CACnC;AAMD;;;GAGG;AACH,qBAAa,eAAe;;IAI1B,OAAO,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAIjE;IAED,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAE3D;IAED,GAAG,CAAC,EAAE,EAAE,gBAAgB,GAAG,OAAO,CAEjC;IAED,YAAY,CAAC,EAAE,EAAE,gBAAgB,GAAG,gBAAgB,EAAE,CAErD;IAED,MAAM,CAAC,EAAE,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAEvD;IAED,UAAU,CAAC,EAAE,EAAE,gBAAgB,GAAG,MAAM,CAEvC;CA6FF"}
|
package/types/yuku.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yuku.d.ts","sourceRoot":"","sources":["../src/yuku.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,OAAO,EACP,gBAAgB,EAKjB,MAAM,aAAa,CAAA;AAgIpB,eAAO,MAAM,WAAW,EAAE,gBA+BzB,CAAA;AAED,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,EAAE,SAAiC,GAClC,OAAO,CAcT"}
|
package/types/zero.d.ts
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { ResolvedModuleId, SourceSpan } from './contracts';
|
|
2
|
+
import type { BailoutReason, ZeroRule } from './diagnostics';
|
|
3
|
+
import type { LoweredModulePlan } from './lower';
|
|
4
|
+
import type { SourceEdit } from './output';
|
|
5
|
+
/**
|
|
6
|
+
* Zero-runtime reference erasure and the rule-mapped diagnostics that gate it.
|
|
7
|
+
*
|
|
8
|
+
* A passing lowering plan already proved every Tamagui use in this module became
|
|
9
|
+
* host markup. That fact is stronger than anything a bundler can derive, so the
|
|
10
|
+
* compiler removes the now-dead references before the bundler records this
|
|
11
|
+
* module's dependencies. Metro fixes its dependency graph at resolution time and
|
|
12
|
+
* does no export-level shaking, so nothing later in the pipeline can do this.
|
|
13
|
+
*/
|
|
14
|
+
export type { ZeroRule };
|
|
15
|
+
export type ZeroViolationCode = 'zero/static-island-import' | 'zero/side-effect-import' | 'zero/live-tamagui-reference' | 'zero/design-state-read' | 'zero/runtime-provider' | BailoutReason['code'];
|
|
16
|
+
export interface ZeroViolation {
|
|
17
|
+
rule: ZeroRule;
|
|
18
|
+
code: ZeroViolationCode;
|
|
19
|
+
span: SourceSpan;
|
|
20
|
+
message: string;
|
|
21
|
+
component?: string;
|
|
22
|
+
}
|
|
23
|
+
/** The last line of every zero-runtime failure, in both gates. */
|
|
24
|
+
export declare const ZERO_FAILURE_FOOTER = "Fix every site or move the owning module to a declared full-runtime island. Zero-runtime never retains one component as a fallback.";
|
|
25
|
+
/**
|
|
26
|
+
* The JavaScript design-state surface. A reference to any of these in a zero
|
|
27
|
+
* graph is rule 7: the value only exists once a runtime has parsed the config.
|
|
28
|
+
*/
|
|
29
|
+
export declare const ZERO_DESIGN_STATE_APIS: Set<string>;
|
|
30
|
+
/** Root providers. Their use is illegal in a zero graph, never erasable. */
|
|
31
|
+
export declare const ZERO_PROVIDER_EXPORTS: Set<string>;
|
|
32
|
+
/**
|
|
33
|
+
* The four public animated-number hooks. They are the one opt-in runtime a zero
|
|
34
|
+
* graph may keep, and only through the leaf module: the public barrel would drag
|
|
35
|
+
* the config-bound driver resolution in with them.
|
|
36
|
+
*/
|
|
37
|
+
export declare const ZERO_ANIMATED_NUMBER_HOOKS: Set<string>;
|
|
38
|
+
export declare const ZERO_ANIMATED_NUMBER_MODULE = "@tamagui/animations-css/animated-number";
|
|
39
|
+
export interface ZeroRuleParams {
|
|
40
|
+
component?: string;
|
|
41
|
+
expression?: string;
|
|
42
|
+
prop?: string;
|
|
43
|
+
detail?: string;
|
|
44
|
+
api?: string;
|
|
45
|
+
/** Rule 8 only: what to do about this import, which differs per code. */
|
|
46
|
+
remediation?: string;
|
|
47
|
+
}
|
|
48
|
+
/** The rule map's developer messages, verbatim. */
|
|
49
|
+
export declare function zeroRuleMessage(rule: ZeroRule, params: ZeroRuleParams): string;
|
|
50
|
+
/**
|
|
51
|
+
* Rule 8's two codes.
|
|
52
|
+
*
|
|
53
|
+
* They are module-level imports rather than element sites, and neither one is
|
|
54
|
+
* fixed by moving the module to an island: a stray side-effect import wants
|
|
55
|
+
* deleting, and an island import wants the generated loader. Reporting them as
|
|
56
|
+
* rule 6 sent developers to do island work that would not have helped.
|
|
57
|
+
*/
|
|
58
|
+
export declare function zeroSideEffectImportMessage(specifier: string): string;
|
|
59
|
+
export declare function zeroStaticIslandImportMessage(specifier: string, islandId: string): string;
|
|
60
|
+
export declare const ZERO_PROVIDER_MESSAGE = "[tamagui zero-runtime] Rule 4: TamaguiProvider is not used by a zero-runtime root. The bundler loads generated CSS and the compiler lowers static Theme nodes. Remove this provider or make this entry full-runtime.";
|
|
61
|
+
export declare function zeroThemeBoundaryMessage(component: string, prop: string): string;
|
|
62
|
+
export declare function zeroConfigDriverMessage(name: string, outputStyle: unknown): string;
|
|
63
|
+
export declare function zeroIslandThemeMessage(entry: string): string;
|
|
64
|
+
/**
|
|
65
|
+
* The lowering plan's own diagnostics, read as zero-runtime violations.
|
|
66
|
+
*
|
|
67
|
+
* Only the diagnostics that stopped a candidate from lowering count: one
|
|
68
|
+
* recorded next to a successful lowering describes a dropped prop and leaves no
|
|
69
|
+
* runtime behind.
|
|
70
|
+
*/
|
|
71
|
+
export declare function zeroViolationsFromPlan(plan: LoweredModulePlan): ZeroViolation[];
|
|
72
|
+
export interface ZeroErasureInput {
|
|
73
|
+
id: ResolvedModuleId;
|
|
74
|
+
source: string;
|
|
75
|
+
/** Edits already committed by lowering. A reference inside one is consumed. */
|
|
76
|
+
loweredEdits: readonly SourceEdit[];
|
|
77
|
+
/** True when this import specifier names the zero-forbidden Tamagui surface. */
|
|
78
|
+
isTamaguiSpecifier(specifier: string): boolean;
|
|
79
|
+
/** Returns the island id when this specifier names a declared island module. */
|
|
80
|
+
islandIdFor(specifier: string): string | null;
|
|
81
|
+
}
|
|
82
|
+
export interface ZeroErasureResult {
|
|
83
|
+
edits: SourceEdit[];
|
|
84
|
+
removedModules: string[];
|
|
85
|
+
removedBindings: string[];
|
|
86
|
+
erasedStyledDefinitions: string[];
|
|
87
|
+
/**
|
|
88
|
+
* Erased declarators this module also exported. The build-wide gate proves
|
|
89
|
+
* every importer of them inside the zero entry graph was itself transformed.
|
|
90
|
+
*/
|
|
91
|
+
erasedExports: string[];
|
|
92
|
+
/** Hooks rewritten to the animated-number leaf, by their imported name. */
|
|
93
|
+
rewrittenAnimatedNumberHooks: string[];
|
|
94
|
+
liveBindings: string[];
|
|
95
|
+
violations: ZeroViolation[];
|
|
96
|
+
}
|
|
97
|
+
export declare function planZeroErasure(input: ZeroErasureInput): ZeroErasureResult;
|
|
98
|
+
//# sourceMappingURL=zero.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zero.d.ts","sourceRoot":"","sources":["../src/zero.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAW,gBAAgB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAE5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAG1C;;;;;;;;GAQG;AAEH,YAAY,EAAE,QAAQ,EAAE,CAAA;AAExB,MAAM,MAAM,iBAAiB,GACzB,2BAA2B,GAC3B,yBAAyB,GACzB,6BAA6B,GAC7B,wBAAwB,GACxB,uBAAuB,GACvB,aAAa,CAAC,MAAM,CAAC,CAAA;AAEzB,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,QAAQ,CAAA;IACd,IAAI,E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