@tamagui/static 3.0.0-beta.831.1 → 3.0.0-beta.889.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/dist/cjs/compiler.cjs +17 -5
- package/dist/cjs/compilerHost.cjs +148 -39
- package/dist/cjs/componentDiscovery.cjs +94 -0
- package/dist/cjs/domStructuralPass.cjs +12 -2
- package/dist/cjs/exports.cjs +4 -1
- package/dist/cjs/extractor/bundleConfig.cjs +23 -0
- package/dist/cjs/zero/theme.cjs +5 -20
- package/dist/esm/compiler.mjs +18 -6
- package/dist/esm/compiler.mjs.map +1 -1
- package/dist/esm/compilerHost.mjs +146 -40
- package/dist/esm/compilerHost.mjs.map +1 -1
- package/dist/esm/componentDiscovery.mjs +69 -0
- package/dist/esm/componentDiscovery.mjs.map +1 -0
- package/dist/esm/domStructuralPass.mjs +12 -2
- package/dist/esm/domStructuralPass.mjs.map +1 -1
- package/dist/esm/exports.mjs +4 -1
- package/dist/esm/extractor/bundleConfig.mjs +23 -1
- package/dist/esm/extractor/bundleConfig.mjs.map +1 -1
- package/dist/esm/zero/theme.mjs +5 -20
- package/dist/esm/zero/theme.mjs.map +1 -1
- package/package.json +17 -17
- package/src/compiler.ts +27 -5
- package/src/compilerHost.ts +262 -74
- package/src/componentDiscovery.ts +105 -0
- package/src/domStructuralPass.ts +22 -2
- package/src/exports.ts +2 -0
- package/src/extractor/bundleConfig.ts +34 -0
- package/src/zero/theme.ts +12 -21
- package/types/compiler.d.ts +13 -0
- package/types/compiler.d.ts.map +1 -1
- package/types/compilerHost.d.ts +13 -0
- package/types/compilerHost.d.ts.map +1 -1
- package/types/componentDiscovery.d.ts +27 -0
- package/types/componentDiscovery.d.ts.map +1 -0
- package/types/domStructuralPass.d.ts.map +1 -1
- package/types/exports.d.ts +2 -0
- package/types/exports.d.ts.map +1 -1
- package/types/extractor/bundleConfig.d.ts +7 -0
- package/types/extractor/bundleConfig.d.ts.map +1 -1
- package/types/zero/theme.d.ts +0 -1
- package/types/zero/theme.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/static",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.889.1",
|
|
4
4
|
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -45,21 +45,21 @@
|
|
|
45
45
|
"clean:build": "tamagui-build clean:build"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@tamagui/cli-color": "3.0.0-beta.
|
|
49
|
-
"@tamagui/compiler-core": "3.0.0-beta.
|
|
50
|
-
"@tamagui/config-default": "3.0.0-beta.
|
|
51
|
-
"@tamagui/core": "3.0.0-beta.
|
|
52
|
-
"@tamagui/dom": "3.0.0-beta.
|
|
53
|
-
"@tamagui/fake-react-native": "3.0.0-beta.
|
|
54
|
-
"@tamagui/generate-themes": "3.0.0-beta.
|
|
55
|
-
"@tamagui/helpers": "3.0.0-beta.
|
|
56
|
-
"@tamagui/helpers-node": "3.0.0-beta.
|
|
57
|
-
"@tamagui/react-native-web-internals": "3.0.0-beta.
|
|
58
|
-
"@tamagui/react-native-web-lite": "3.0.0-beta.
|
|
59
|
-
"@tamagui/shorthands": "3.0.0-beta.
|
|
60
|
-
"@tamagui/style-grammar": "3.0.0-beta.
|
|
61
|
-
"@tamagui/types": "3.0.0-beta.
|
|
62
|
-
"@tamagui/web": "3.0.0-beta.
|
|
48
|
+
"@tamagui/cli-color": "3.0.0-beta.889.1",
|
|
49
|
+
"@tamagui/compiler-core": "3.0.0-beta.889.1",
|
|
50
|
+
"@tamagui/config-default": "3.0.0-beta.889.1",
|
|
51
|
+
"@tamagui/core": "3.0.0-beta.889.1",
|
|
52
|
+
"@tamagui/dom": "3.0.0-beta.889.1",
|
|
53
|
+
"@tamagui/fake-react-native": "3.0.0-beta.889.1",
|
|
54
|
+
"@tamagui/generate-themes": "3.0.0-beta.889.1",
|
|
55
|
+
"@tamagui/helpers": "3.0.0-beta.889.1",
|
|
56
|
+
"@tamagui/helpers-node": "3.0.0-beta.889.1",
|
|
57
|
+
"@tamagui/react-native-web-internals": "3.0.0-beta.889.1",
|
|
58
|
+
"@tamagui/react-native-web-lite": "3.0.0-beta.889.1",
|
|
59
|
+
"@tamagui/shorthands": "3.0.0-beta.889.1",
|
|
60
|
+
"@tamagui/style-grammar": "3.0.0-beta.889.1",
|
|
61
|
+
"@tamagui/types": "3.0.0-beta.889.1",
|
|
62
|
+
"@tamagui/web": "3.0.0-beta.889.1",
|
|
63
63
|
"browserslist": "^4.28.1",
|
|
64
64
|
"check-dependency-version-consistency": "^4.1.0",
|
|
65
65
|
"esbuild": "0.28.1",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"react-native-web": "~0.21.0"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@tamagui/build": "3.0.0-beta.
|
|
74
|
+
"@tamagui/build": "3.0.0-beta.889.1",
|
|
75
75
|
"@types/find-root": "^1.1.2",
|
|
76
76
|
"@types/node": "^22.1.0",
|
|
77
77
|
"@types/webpack": "^4.41.26",
|
package/src/compiler.ts
CHANGED
|
@@ -19,7 +19,8 @@ import { readFileSync } from 'node:fs'
|
|
|
19
19
|
import { createRequire } from 'node:module'
|
|
20
20
|
import path from 'node:path'
|
|
21
21
|
|
|
22
|
-
import {
|
|
22
|
+
import { ComponentDiscovery, type ComponentModuleEvaluator } from './componentDiscovery'
|
|
23
|
+
import { createComponentRegistry, createTamaguiCompilerHost } from './compilerHost'
|
|
23
24
|
import { domStructuralPass } from './domStructuralPass'
|
|
24
25
|
import type { TamaguiProjectInfo } from './extractor/bundleConfig'
|
|
25
26
|
import { loadTamagui } from './extractor/loadTamagui'
|
|
@@ -217,6 +218,15 @@ export interface CompilerInput {
|
|
|
217
218
|
project: CompilerProject
|
|
218
219
|
resolve(specifier: string, importer: string): Promise<CompilerResolution | null>
|
|
219
220
|
load(id: string): Promise<string | null>
|
|
221
|
+
/**
|
|
222
|
+
* Evaluate a host-resolved module and return its exports. The frontend asks
|
|
223
|
+
* for every package a JSX element or styled() base imports from that is not
|
|
224
|
+
* in the configured `components` list, once per module per project, and
|
|
225
|
+
* lowers against the static configs it finds. Return null (or throw) when
|
|
226
|
+
* the host cannot evaluate the module; those elements stay on the runtime
|
|
227
|
+
* path exactly as before.
|
|
228
|
+
*/
|
|
229
|
+
evaluate?: ComponentModuleEvaluator
|
|
220
230
|
}
|
|
221
231
|
|
|
222
232
|
export type CompilerUpdateInput = CompilerInput
|
|
@@ -257,6 +267,7 @@ export class CompilerFrontend {
|
|
|
257
267
|
private readonly planCaches = new Map<string, ModulePlanCache>()
|
|
258
268
|
private readonly moduleRecords = new Map<ResolvedModuleId, HostModuleInput>()
|
|
259
269
|
private moduleContext: string | null = null
|
|
270
|
+
private readonly discovery = new ComponentDiscovery()
|
|
260
271
|
|
|
261
272
|
/**
|
|
262
273
|
* One cache per project root and platform. Absent when the project produced
|
|
@@ -358,14 +369,18 @@ export class CompilerFrontend {
|
|
|
358
369
|
if (!projectInfo.tamaguiConfig || !projectInfo.components) {
|
|
359
370
|
throw new Error('The compiler requires evaluated Tamagui config and components')
|
|
360
371
|
}
|
|
372
|
+
const componentModules = input.project.componentModules.map((component) => ({
|
|
373
|
+
moduleName: component.moduleName,
|
|
374
|
+
resolvedId: cleanId(component.id),
|
|
375
|
+
}))
|
|
376
|
+
const registry = createComponentRegistry(projectInfo.components, componentModules)
|
|
377
|
+
this.discovery.seed(registry)
|
|
361
378
|
const host = createTamaguiCompilerHost({
|
|
362
379
|
target: input.target,
|
|
363
380
|
tamaguiConfig: projectInfo.tamaguiConfig,
|
|
364
381
|
components: projectInfo.components,
|
|
365
|
-
componentModules
|
|
366
|
-
|
|
367
|
-
resolvedId: cleanId(component.id),
|
|
368
|
-
})),
|
|
382
|
+
componentModules,
|
|
383
|
+
registry,
|
|
369
384
|
disablePartialExtraction: input.project.disablePartialExtraction,
|
|
370
385
|
experimentalNativeFastPath: input.project.experimentalNativeFastPath,
|
|
371
386
|
zeroRuntime: input.project.zeroRuntime,
|
|
@@ -380,6 +395,7 @@ export class CompilerFrontend {
|
|
|
380
395
|
async load(id) {
|
|
381
396
|
return modules.get(id) ?? null
|
|
382
397
|
},
|
|
398
|
+
prepare: (module) => this.discovery.prepare(module, registry, input.evaluate),
|
|
383
399
|
},
|
|
384
400
|
structuralPass: domStructuralPass,
|
|
385
401
|
})
|
|
@@ -391,6 +407,11 @@ export class CompilerFrontend {
|
|
|
391
407
|
}
|
|
392
408
|
}
|
|
393
409
|
|
|
410
|
+
/** host-resolved ids of every module discovery found components in */
|
|
411
|
+
discoveredModuleIds(): string[] {
|
|
412
|
+
return this.discovery.ids()
|
|
413
|
+
}
|
|
414
|
+
|
|
394
415
|
private async buildTree(input: CompilerUpdateInput): Promise<{
|
|
395
416
|
rootModule: HostModuleInput
|
|
396
417
|
modules: Map<ResolvedModuleId, HostModuleInput>
|
|
@@ -398,6 +419,7 @@ export class CompilerFrontend {
|
|
|
398
419
|
const moduleContext = compilerContext(input)
|
|
399
420
|
if (this.moduleContext !== moduleContext) {
|
|
400
421
|
this.moduleRecords.clear()
|
|
422
|
+
this.discovery.clear()
|
|
401
423
|
this.moduleContext = moduleContext
|
|
402
424
|
}
|
|
403
425
|
|