@tamagui/vite-plugin 2.7.7 → 3.0.0-beta.637.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.
@@ -0,0 +1,205 @@
1
+ import Static from '@tamagui/static'
2
+ import type {
3
+ IslandThemeBridge,
4
+ TamaguiOptions,
5
+ ZeroCSSArtifact,
6
+ ZeroGraphReceipt,
7
+ ZeroIsland,
8
+ ZeroRuntimeResolved,
9
+ ZeroViolationSite,
10
+ } from '@tamagui/static'
11
+ import { createHash } from 'node:crypto'
12
+ import { gzipSync } from 'node:zlib'
13
+ import { readFileSync, writeFileSync } from 'node:fs'
14
+ import path from 'node:path'
15
+
16
+ /**
17
+ * Vite's half of the zero-runtime mode.
18
+ *
19
+ * The plugin owns the one generated CSS artifact, runs each declared island as a
20
+ * separate full-runtime child build, and proves the emitted zero graph contains
21
+ * no forbidden Tamagui module before it lets the build succeed.
22
+ */
23
+
24
+ export const ZERO_CSS_FILENAME = 'tamagui-zero.css'
25
+ export const ZERO_ISLAND_DIRNAME = 'tamagui-islands'
26
+
27
+ export interface ZeroIslandBuildContext {
28
+ islandId: string
29
+ artifact: ZeroCSSArtifact
30
+ }
31
+
32
+ export interface ZeroRuntimeController {
33
+ /** The loaded build options, captured before the loader can be torn down. */
34
+ options: TamaguiOptions
35
+ resolved: ZeroRuntimeResolved
36
+ artifact: ZeroCSSArtifact
37
+ cssHref: string
38
+ bridges: Map<string, IslandThemeBridge[]>
39
+ /** Every zero-contract violation seen this build, aggregated before failing. */
40
+ violations: ZeroViolationSite[]
41
+ /** Modules the zero transform ran on, for the erased-export gate. */
42
+ transformed: Set<string>
43
+ /** Erased exported declarator names, by declaring module. */
44
+ erasedExports: Map<string, string[]>
45
+ loaderIds: Map<string, string>
46
+ islandModuleIds: Map<string, string>
47
+ isEnforcing: boolean
48
+ }
49
+
50
+ const normalizePath = (value: string) => value.replace(/\\/g, '/')
51
+
52
+ /**
53
+ * Import specifiers may or may not carry an extension, so both sides of the
54
+ * island lookup are compared without one.
55
+ */
56
+ export const zeroModuleKey = (value: string) =>
57
+ normalizePath(value).replace(/\.(?:js|jsx|ts|tsx|mjs|cjs)$/, '')
58
+
59
+ export async function createZeroRuntimeController(
60
+ options: TamaguiOptions,
61
+ root: string,
62
+ base: string
63
+ ): Promise<ZeroRuntimeController | null> {
64
+ const resolved = await Static.resolveZeroRuntime(options, root)
65
+ if (resolved.mode === 'off') return null
66
+ Static.assertZeroIntegrationSupport('vite', resolved)
67
+
68
+ const cssHref = `${base.endsWith('/') ? base : `${base}/`}${ZERO_CSS_FILENAME}`
69
+ const artifact = new Static.ZeroCSSArtifact(resolved.cssPath)
70
+ artifact.expectIslands(resolved.islands.map((island) => island.id))
71
+
72
+ const configPath = path.isAbsolute(options.config || '')
73
+ ? options.config!
74
+ : path.resolve(root, options.config || 'tamagui.config.ts')
75
+
76
+ for (const island of resolved.islands) {
77
+ Static.writeIslandModules({
78
+ island,
79
+ integration: 'vite',
80
+ configPath,
81
+ scriptUrl: `${base.endsWith('/') ? base : `${base}/`}${ZERO_ISLAND_DIRNAME}/${island.id}.js`,
82
+ cssHref,
83
+ })
84
+ }
85
+
86
+ return {
87
+ options,
88
+ resolved,
89
+ artifact,
90
+ cssHref,
91
+ bridges: new Map(),
92
+ violations: [],
93
+ transformed: new Set(),
94
+ erasedExports: new Map(),
95
+ loaderIds: new Map(
96
+ resolved.islands.map((island) => [zeroModuleKey(island.loader), island.id])
97
+ ),
98
+ islandModuleIds: new Map(
99
+ resolved.islands.map((island) => [zeroModuleKey(island.module), island.id])
100
+ ),
101
+ isEnforcing: resolved.mode === 'enforce',
102
+ }
103
+ }
104
+
105
+ /**
106
+ * Builds one island as a separate bundler invocation with
107
+ * `TAMAGUI_RUNTIME='full'`. React is externalized to the handoff the generated
108
+ * loader publishes, so both graphs share one React instance.
109
+ */
110
+ export async function buildIsland(input: {
111
+ island: ZeroIsland
112
+ controller: ZeroRuntimeController
113
+ root: string
114
+ outDir: string
115
+ mode: string
116
+ }): Promise<{ file: string; hash: string }> {
117
+ const { build } = await import('vite')
118
+ const { createTamaguiPlugins } = await import('./plugin')
119
+
120
+ const islandOutDir = path.join(input.outDir, ZERO_ISLAND_DIRNAME)
121
+ await build({
122
+ configFile: false,
123
+ root: input.root,
124
+ mode: 'production',
125
+ logLevel: 'warn',
126
+ define: {
127
+ 'process.env.TAMAGUI_RUNTIME': JSON.stringify('full'),
128
+ 'process.env.TAMAGUI_DID_OUTPUT_CSS': JSON.stringify('1'),
129
+ // the island is a separately built artifact, never a dev asset, so it is
130
+ // always a production build and always uses react/jsx-runtime
131
+ 'process.env.NODE_ENV': JSON.stringify('production'),
132
+ },
133
+ esbuild: { jsx: 'automatic', jsxDev: false },
134
+ plugins: [
135
+ createTamaguiPlugins({
136
+ ...input.controller.options,
137
+ outputCSS: null,
138
+ experimental: {
139
+ ...input.controller.options.experimental,
140
+ zeroRuntime: undefined,
141
+ },
142
+ zeroIslandBuild: {
143
+ islandId: input.island.id,
144
+ artifact: input.controller.artifact,
145
+ },
146
+ }).plugins,
147
+ ],
148
+ build: {
149
+ // a normal application build, not library mode: the island must go through
150
+ // the same transform pipeline the zero entry does
151
+ outDir: islandOutDir,
152
+ emptyOutDir: false,
153
+ cssCodeSplit: false,
154
+ minify: input.mode === 'production',
155
+ sourcemap: false,
156
+ rollupOptions: {
157
+ input: input.island.entry,
158
+ external: Object.keys(Static.ISLAND_EXTERNAL_GLOBALS),
159
+ output: {
160
+ format: 'iife',
161
+ name: `tamaguiIsland_${input.island.id}`,
162
+ entryFileNames: `${input.island.id}.js`,
163
+ globals: Static.ISLAND_EXTERNAL_GLOBALS,
164
+ inlineDynamicImports: true,
165
+ },
166
+ },
167
+ },
168
+ })
169
+
170
+ const file = path.join(islandOutDir, `${input.island.id}.js`)
171
+ const contents = readFileSync(file)
172
+ input.controller.artifact.markIslandComplete(input.island.id)
173
+ return {
174
+ file,
175
+ hash: createHash('sha256').update(contents).digest('hex').slice(0, 16),
176
+ }
177
+ }
178
+
179
+ export function finalizeZeroCSS(
180
+ controller: ZeroRuntimeController,
181
+ outDir: string
182
+ ): { href: string; hash: string; bytes: number; gzip: number } {
183
+ const written = controller.artifact.write()
184
+ if (!written.complete) {
185
+ throw new Error(
186
+ `[tamagui zero-runtime] cannot derive TAMAGUI_DID_OUTPUT_CSS: the generated CSS artifact is missing ${written.missing.join(
187
+ ', '
188
+ )}`
189
+ )
190
+ }
191
+ const css = controller.artifact.css()
192
+ const target = path.join(outDir, ZERO_CSS_FILENAME)
193
+ writeFileSync(target, css)
194
+ return {
195
+ href: controller.cssHref,
196
+ hash: written.hash,
197
+ bytes: Buffer.byteLength(css),
198
+ gzip: gzipSync(Buffer.from(css), { level: 9 }).length,
199
+ }
200
+ }
201
+
202
+ export function assertZeroGraph(receipt: ZeroGraphReceipt): void {
203
+ if (receipt.forbidden.length === 0) return
204
+ throw new Error(Static.formatZeroGraphFailure(receipt))
205
+ }
@@ -0,0 +1,44 @@
1
+ export interface CompilerModuleReport {
2
+ stats: {
3
+ found: number;
4
+ lowered: number;
5
+ flattened: number;
6
+ styled: number;
7
+ bailed: number;
8
+ };
9
+ diagnostics: {
10
+ code: string;
11
+ message: string;
12
+ component?: string;
13
+ }[];
14
+ }
15
+ export interface CompilerStatsReport {
16
+ schemaVersion: 1;
17
+ selector: {
18
+ id: 'all';
19
+ include: ['**'];
20
+ };
21
+ totals: CompilerModuleReport['stats'] & {
22
+ modules: number;
23
+ partial: number;
24
+ notFlattened: number;
25
+ flattenRate: number;
26
+ };
27
+ bailoutCodes: Record<string, number>;
28
+ bailoutReasons: Array<{
29
+ code: string;
30
+ message: string;
31
+ component?: string;
32
+ count: number;
33
+ }>;
34
+ modules: Array<CompilerModuleReport & {
35
+ id: string;
36
+ stats: CompilerModuleReport['stats'] & {
37
+ partial: number;
38
+ notFlattened: number;
39
+ };
40
+ }>;
41
+ }
42
+ export declare function createCompilerStatsReport(root: string, reports: Map<string, CompilerModuleReport>): CompilerStatsReport;
43
+ export declare function formatCompilerStatsReport(report: CompilerStatsReport, verbose: boolean): string;
44
+ //# sourceMappingURL=compilerStats.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compilerStats.d.ts","sourceRoot":"","sources":["../src/compilerStats.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE;QACL,KAAK,EAAE,MAAM,CAAA;QACb,OAAO,EAAE,MAAM,CAAA;QACf,SAAS,EAAE,MAAM,CAAA;QACjB,MAAM,EAAE,MAAM,CAAA;QACd,MAAM,EAAE,MAAM,CAAA;KACf,CAAA;IACD,WAAW,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CACrE;AAED,MAAM,WAAW,mBAAmB;IAClC,aAAa,EAAE,CAAC,CAAA;IAChB,QAAQ,EAAE;QAAE,EAAE,EAAE,KAAK,CAAC;QAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAA;KAAE,CAAA;IACxC,MAAM,EAAE,oBAAoB,CAAC,OAAO,CAAC,GAAG;QACtC,OAAO,EAAE,MAAM,CAAA;QACf,OAAO,EAAE,MAAM,CAAA;QACf,YAAY,EAAE,MAAM,CAAA;QACpB,WAAW,EAAE,MAAM,CAAA;KACpB,CAAA;IACD,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACpC,cAAc,EAAE,KAAK,CAAC;QACpB,IAAI,EAAE,MAAM,CAAA;QACZ,OAAO,EAAE,MAAM,CAAA;QACf,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,KAAK,EAAE,MAAM,CAAA;KACd,CAAC,CAAA;IACF,OAAO,EAAE,KAAK,CACZ,oBAAoB,GAAG;QACrB,EAAE,EAAE,MAAM,CAAA;QACV,KAAK,EAAE,oBAAoB,CAAC,OAAO,CAAC,GAAG;YACrC,OAAO,EAAE,MAAM,CAAA;YACf,YAAY,EAAE,MAAM,CAAA;SACrB,CAAA;KACF,CACF,CAAA;CACF;AAoBD,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC,GACzC,mBAAmB,CAmFrB;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,mBAAmB,EAAE,OAAO,EAAE,OAAO,UAqBtF"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Private implementation boundary for building another Tamagui Vite integration on
3
+ * top of the base compiler plugin. Not public API: the only consumer is
4
+ * `@tamagui/tailwind/vite`, which needs the base plugins and the one config loader
5
+ * they evaluate through so the Tamagui config is never evaluated twice.
6
+ */
7
+ export { createTamaguiPlugins } from './plugin';
8
+ export type { TamaguiInternalPluginOptions, TamaguiVitePluginOptions } from './plugin';
9
+ export type { ViteTamaguiLoader } from './loadTamagui';
10
+ //# sourceMappingURL=internal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAC/C,YAAY,EAAE,4BAA4B,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAA;AACtF,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA"}
@@ -1,15 +1,35 @@
1
+ import Static from '@tamagui/static';
2
+ import type { TamaguiProjectInfo } from '@tamagui/static';
1
3
  import type { TamaguiOptions } from '@tamagui/types';
2
- export declare function getTamaguiOptions(): TamaguiOptions | null;
3
- export declare function getLoadPromise(): Promise<TamaguiOptions> | null;
4
- /**
5
- * Load just the tamagui.build.ts config (lightweight)
6
- * This doesn't bundle the full tamagui config - call ensureFullConfigLoaded() for that
7
- */
8
- export declare function loadTamaguiBuildConfig(optionsIn?: Partial<TamaguiOptions>): Promise<TamaguiOptions>;
9
- /**
10
- * Ensure the full tamagui config is loaded (heavy - bundles config + components)
11
- * Call this lazily when transform/extraction is actually needed
12
- */
13
- export declare function ensureFullConfigLoaded(): Promise<void>;
14
- export declare function cleanup(): Promise<void>;
4
+ import type { RunnableDevEnvironment } from 'vite';
5
+ export declare const TAMAGUI_EVALUATION_ENVIRONMENT = "tamagui";
6
+ type ResolvedEvaluationModule = {
7
+ moduleName: string;
8
+ id: string;
9
+ module: Record<string, unknown>;
10
+ };
11
+ type EvaluatedProjectModules = {
12
+ config: ResolvedEvaluationModule;
13
+ components: ResolvedEvaluationModule[];
14
+ };
15
+ export type ViteTamaguiLoader = {
16
+ getEnvironment(): RunnableDevEnvironment | null;
17
+ getGeneration(): number;
18
+ getLoadPromise(): Promise<TamaguiOptions> | null;
19
+ getTamaguiOptions(): TamaguiOptions | null;
20
+ getTamaguiConfig(): Promise<TamaguiProjectInfo['tamaguiConfig']>;
21
+ getCompilerProject(): Promise<Static.CompilerProject>;
22
+ getEvaluationDependencies(): string[];
23
+ isEvaluationDependency(id: string): boolean;
24
+ evaluateProjectModules(options: TamaguiOptions): Promise<EvaluatedProjectModules>;
25
+ loadTamaguiBuildConfig(): Promise<TamaguiOptions>;
26
+ setEnvironment(next: RunnableDevEnvironment, options?: {
27
+ owned?: boolean;
28
+ }): void;
29
+ invalidate(file?: string): void;
30
+ ensureFullConfigLoaded(): Promise<string[]>;
31
+ cleanup(): Promise<void>;
32
+ };
33
+ export declare function createViteTamaguiLoader(optionsIn?: Partial<TamaguiOptions>): ViteTamaguiLoader;
34
+ export {};
15
35
  //# sourceMappingURL=loadTamagui.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"loadTamagui.d.ts","sourceRoot":"","sources":["../src/loadTamagui.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAwBpD,wBAAgB,iBAAiB,IAAI,cAAc,GAAG,IAAI,CAEzD;AAED,wBAAgB,cAAc,IAAI,OAAO,CAAC,c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,CAAA;IACrC,sBAAsB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;IAC3C,sBAAsB,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAA;IACjF,sBAAsB,IAAI,OAAO,CAAC,cAAc,CAAC,CAAA;IACjD,cAAc,CAAC,IAAI,EAAE,sBAAsB,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAA;IACjF,UAAU,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,sBAAsB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;IAC3C,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACzB,CAAA;AAED,wBAAgB,uBAAuB,CACrC,SAAS,GAAE,OAAO,CAAC,cAAc,CAAM,GACtC,iBAAiB,CA6NnB"}
package/types/plugin.d.ts CHANGED
@@ -1,5 +1,7 @@
1
- import type { TamaguiOptions } from '@tamagui/static-worker';
2
- import type { PluginOption } from 'vite';
1
+ import type { TamaguiOptions } from '@tamagui/static';
2
+ import type { Plugin, PluginOption } from 'vite';
3
+ import type { ViteTamaguiLoader } from './loadTamagui';
4
+ import { type ZeroIslandBuildContext } from './zeroRuntime';
3
5
  type AliasOptions = {
4
6
  /** use @tamagui/react-native-web-lite, 'without-animated' for smaller bundle */
5
7
  rnwLite?: boolean | 'without-animated';
@@ -15,8 +17,34 @@ type AliasEntry = {
15
17
  * use this when you need control over alias ordering in your config
16
18
  */
17
19
  export declare function tamaguiAliases(options?: AliasOptions): AliasEntry[];
18
- export declare function tamaguiPlugin({ disableResolveConfig, ...tamaguiOptionsIn }?: TamaguiOptions & {
20
+ export declare function tamaguiNativePlugin(tamaguiOptionsIn?: TamaguiOptions): Plugin;
21
+ export type TamaguiVitePluginOptions = TamaguiOptions & {
19
22
  disableResolveConfig?: boolean;
20
- }): PluginOption;
23
+ };
24
+ export type TamaguiInternalPluginOptions = TamaguiVitePluginOptions & {
25
+ /**
26
+ * Wraps compiler-extracted Tamagui CSS before it is served.
27
+ * `@tamagui/tailwind/vite` uses it to put those rules in `@layer tamagui`, which is
28
+ * what orders them against official Tailwind's `theme`/`utilities` layers.
29
+ */
30
+ wrapExtractedCSS?: (css: string) => string;
31
+ /**
32
+ * Set by the zero-runtime controller when this invocation is an island child
33
+ * build. The island keeps the full runtime and contributes its compiler atomic
34
+ * CSS to the parent's single artifact instead of injecting its own.
35
+ */
36
+ zeroIslandBuild?: ZeroIslandBuildContext;
37
+ };
38
+ /**
39
+ * The base Tamagui Vite plugins plus the one config loader they evaluate through.
40
+ *
41
+ * `@tamagui/tailwind/vite` wraps this: it reuses the returned loader for its own
42
+ * scanner plugin, so the Tamagui config is evaluated exactly once for both.
43
+ */
44
+ export declare function createTamaguiPlugins({ disableResolveConfig, wrapExtractedCSS, zeroIslandBuild, ...tamaguiOptionsIn }?: TamaguiInternalPluginOptions): {
45
+ plugins: PluginOption[];
46
+ loader: ViteTamaguiLoader;
47
+ };
48
+ export declare function tamaguiPlugin(options?: TamaguiVitePluginOptions): PluginOption;
21
49
  export {};
22
50
  //# sourceMappingURL=plugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAqB,MAAM,wBAAwB,CAAA;AAQ/E,OAAO,KAAK,EAAU,YAAY,EAAiC,MAAM,MAAM,CAAA;AAmF/E,KAAK,YAAY,GAAG;IAClB,gFAAgF;IAChF,OAAO,CAAC,EAAE,OAAO,GAAG,kBAAkB,CAAA;IACtC,0DAA0D;IAC1D,GAAG,CAAC,EAAE,OAAO,CAAA;CACd,CAAA;AAED,KAAK,UAAU,GAAG;IAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAA;AAEhE;;;GAG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ACzC,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,oBAAoB,EACpB,gBAA+B,EAC/B,eAAe,EACf,GAAG,gBAAgB,EACpB,GAAE,4BAAiC,GAAG;IACrC,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,MAAM,EAAE,iBAAiB,CAAA;CAC1B,CAojCA;AAYD,wBAAgB,aAAa,CAAC,OAAO,GAAE,wBAA6B,GAAG,YAAY,CAElF"}
@@ -0,0 +1,60 @@
1
+ import type { IslandThemeBridge, TamaguiOptions, ZeroCSSArtifact, ZeroGraphReceipt, ZeroIsland, ZeroRuntimeResolved, ZeroViolationSite } from '@tamagui/static';
2
+ /**
3
+ * Vite's half of the zero-runtime mode.
4
+ *
5
+ * The plugin owns the one generated CSS artifact, runs each declared island as a
6
+ * separate full-runtime child build, and proves the emitted zero graph contains
7
+ * no forbidden Tamagui module before it lets the build succeed.
8
+ */
9
+ export declare const ZERO_CSS_FILENAME = "tamagui-zero.css";
10
+ export declare const ZERO_ISLAND_DIRNAME = "tamagui-islands";
11
+ export interface ZeroIslandBuildContext {
12
+ islandId: string;
13
+ artifact: ZeroCSSArtifact;
14
+ }
15
+ export interface ZeroRuntimeController {
16
+ /** The loaded build options, captured before the loader can be torn down. */
17
+ options: TamaguiOptions;
18
+ resolved: ZeroRuntimeResolved;
19
+ artifact: ZeroCSSArtifact;
20
+ cssHref: string;
21
+ bridges: Map<string, IslandThemeBridge[]>;
22
+ /** Every zero-contract violation seen this build, aggregated before failing. */
23
+ violations: ZeroViolationSite[];
24
+ /** Modules the zero transform ran on, for the erased-export gate. */
25
+ transformed: Set<string>;
26
+ /** Erased exported declarator names, by declaring module. */
27
+ erasedExports: Map<string, string[]>;
28
+ loaderIds: Map<string, string>;
29
+ islandModuleIds: Map<string, string>;
30
+ isEnforcing: boolean;
31
+ }
32
+ /**
33
+ * Import specifiers may or may not carry an extension, so both sides of the
34
+ * island lookup are compared without one.
35
+ */
36
+ export declare const zeroModuleKey: (value: string) => string;
37
+ export declare function createZeroRuntimeController(options: TamaguiOptions, root: string, base: string): Promise<ZeroRuntimeController | null>;
38
+ /**
39
+ * Builds one island as a separate bundler invocation with
40
+ * `TAMAGUI_RUNTIME='full'`. React is externalized to the handoff the generated
41
+ * loader publishes, so both graphs share one React instance.
42
+ */
43
+ export declare function buildIsland(input: {
44
+ island: ZeroIsland;
45
+ controller: ZeroRuntimeController;
46
+ root: string;
47
+ outDir: string;
48
+ mode: string;
49
+ }): Promise<{
50
+ file: string;
51
+ hash: string;
52
+ }>;
53
+ export declare function finalizeZeroCSS(controller: ZeroRuntimeController, outDir: string): {
54
+ href: string;
55
+ hash: string;
56
+ bytes: number;
57
+ gzip: number;
58
+ };
59
+ export declare function assertZeroGraph(receipt: ZeroGraphReceipt): void;
60
+ //# sourceMappingURL=zeroRuntime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zeroRuntime.d.ts","sourceRoot":"","sources":["../src/zeroRuntime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,iBAAiB,CAAA;AAMxB;;;;;;GAMG;AAEH,eAAO,MAAM,iBAAiB,qBAAqB,CAAA;AACnD,eAAO,MAAM,mBAAmB,oBAAoB,CAAA;AAEpD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,eAAe,CAAA;CAC1B;AAED,MAAM,WAAW,qBAAqB;IACpC,6EAA6E;IAC7E,OAAO,EAAE,cAAc,CAAA;IACvB,QAAQ,EAAE,mBAAmB,CAAA;IAC7B,QAAQ,EAAE,eAAe,CAAA;IACzB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,EAAE,CAAC,CAAA;IACzC,gFAAgF;IAChF,UAAU,EAAE,iBAAiB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,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}