@tamagui/static 2.7.7 → 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/dist/cjs/check-dep-versions.cjs +355 -0
- package/dist/cjs/checkDeps.cjs +302 -0
- package/dist/cjs/compiler.cjs +286 -0
- package/dist/cjs/compilerHost.cjs +1695 -0
- package/dist/cjs/constants.cjs +33 -0
- package/dist/cjs/domStructuralPass.cjs +112 -0
- package/dist/cjs/exports.cjs +42 -0
- package/dist/cjs/extractor/addLocalExports.cjs +64 -0
- package/dist/cjs/extractor/bundle.cjs +203 -0
- package/dist/cjs/extractor/bundleConfig.cjs +747 -0
- package/dist/cjs/extractor/concatClassName.cjs +117 -0
- package/dist/cjs/extractor/detectModuleFormat.cjs +54 -0
- package/dist/cjs/extractor/esbuildAliasPlugin.cjs +47 -0
- package/dist/cjs/extractor/esbuildTsconfigPaths.cjs +92 -0
- package/dist/cjs/extractor/getTamaguiConfigPathFromOptionsConfig.cjs +38 -0
- package/dist/cjs/extractor/loadTamagui.cjs +344 -0
- package/dist/cjs/extractor/regenerateConfig.cjs +161 -0
- package/dist/cjs/extractor/watchTamaguiConfig.cjs +64 -0
- package/dist/cjs/getPragmaOptions.cjs +67 -0
- package/dist/cjs/helpers/memoize.cjs +42 -0
- package/dist/cjs/helpers/requireTamaguiCore.cjs +40 -0
- package/dist/cjs/index.cjs +34 -0
- package/dist/cjs/registerRequire.cjs +220 -0
- package/dist/cjs/server.cjs +66 -0
- package/dist/cjs/staticEvaluationIgnoredModules.cjs +86 -0
- package/dist/cjs/types.cjs +17 -0
- package/dist/cjs/zero/artifact.cjs +145 -0
- package/dist/cjs/zero/graph.cjs +209 -0
- package/dist/cjs/zero/identity.cjs +61 -0
- package/dist/cjs/zero/index.cjs +26 -0
- package/dist/cjs/zero/islands.cjs +232 -0
- package/dist/cjs/zero/options.cjs +163 -0
- package/dist/cjs/zero/ownership.cjs +79 -0
- package/dist/cjs/zero/theme.cjs +328 -0
- package/dist/cjs/zero/transform.cjs +203 -0
- package/dist/esm/check-dep-versions.mjs +329 -0
- package/dist/esm/check-dep-versions.mjs.map +1 -0
- package/dist/esm/checkDeps.mjs +279 -0
- package/dist/esm/checkDeps.mjs.map +1 -0
- package/dist/esm/compiler.mjs +255 -0
- package/dist/esm/compiler.mjs.map +1 -0
- package/dist/esm/compilerHost.mjs +1675 -0
- package/dist/esm/compilerHost.mjs.map +1 -0
- package/dist/esm/constants.mjs +7 -0
- package/dist/esm/constants.mjs.map +1 -0
- package/dist/esm/domStructuralPass.mjs +92 -0
- package/dist/esm/domStructuralPass.mjs.map +1 -0
- package/dist/esm/exports.mjs +26 -0
- package/dist/esm/extractor/addLocalExports.mjs +44 -0
- package/dist/esm/extractor/addLocalExports.mjs.map +1 -0
- package/dist/esm/extractor/bundle.mjs +173 -0
- package/dist/esm/extractor/bundle.mjs.map +1 -0
- package/dist/esm/extractor/bundleConfig.mjs +706 -0
- package/dist/esm/extractor/bundleConfig.mjs.map +1 -0
- package/dist/esm/extractor/concatClassName.mjs +96 -0
- package/dist/esm/extractor/concatClassName.mjs.map +1 -0
- package/dist/esm/extractor/detectModuleFormat.mjs +31 -0
- package/dist/esm/extractor/detectModuleFormat.mjs.map +1 -0
- package/dist/esm/extractor/esbuildAliasPlugin.mjs +26 -0
- package/dist/esm/extractor/esbuildAliasPlugin.mjs.map +1 -0
- package/dist/esm/extractor/esbuildTsconfigPaths.mjs +63 -0
- package/dist/esm/extractor/esbuildTsconfigPaths.mjs.map +1 -0
- package/dist/esm/extractor/getTamaguiConfigPathFromOptionsConfig.mjs +18 -0
- package/dist/esm/extractor/getTamaguiConfigPathFromOptionsConfig.mjs.map +1 -0
- package/dist/esm/extractor/loadTamagui.mjs +306 -0
- package/dist/esm/extractor/loadTamagui.mjs.map +1 -0
- package/dist/esm/extractor/regenerateConfig.mjs +131 -0
- package/dist/esm/extractor/regenerateConfig.mjs.map +1 -0
- package/dist/esm/extractor/watchTamaguiConfig.mjs +43 -0
- package/dist/esm/extractor/watchTamaguiConfig.mjs.map +1 -0
- package/dist/esm/getPragmaOptions.mjs +46 -0
- package/dist/esm/getPragmaOptions.mjs.map +1 -0
- package/dist/esm/helpers/memoize.mjs +21 -0
- package/dist/esm/helpers/memoize.mjs.map +1 -0
- package/dist/esm/helpers/requireTamaguiCore.mjs +19 -0
- package/dist/esm/helpers/requireTamaguiCore.mjs.map +1 -0
- package/dist/esm/index.mjs +8 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/registerRequire.mjs +195 -0
- package/dist/esm/registerRequire.mjs.map +1 -0
- package/dist/esm/server.mjs +40 -0
- package/dist/esm/server.mjs.map +1 -0
- package/dist/esm/setup.mjs +0 -0
- package/dist/esm/staticEvaluationIgnoredModules.mjs +61 -0
- package/dist/esm/staticEvaluationIgnoredModules.mjs.map +1 -0
- package/dist/esm/types.mjs +0 -0
- package/dist/esm/zero/artifact.mjs +119 -0
- package/dist/esm/zero/artifact.mjs.map +1 -0
- package/dist/esm/zero/graph.mjs +170 -0
- package/dist/esm/zero/graph.mjs.map +1 -0
- package/dist/esm/zero/identity.mjs +36 -0
- package/dist/esm/zero/identity.mjs.map +1 -0
- package/dist/esm/zero/index.mjs +15 -0
- package/dist/esm/zero/islands.mjs +197 -0
- package/dist/esm/zero/islands.mjs.map +1 -0
- package/dist/esm/zero/options.mjs +129 -0
- package/dist/esm/zero/options.mjs.map +1 -0
- package/dist/esm/zero/ownership.mjs +48 -0
- package/dist/esm/zero/ownership.mjs.map +1 -0
- package/dist/esm/zero/theme.mjs +303 -0
- package/dist/esm/zero/theme.mjs.map +1 -0
- package/dist/esm/zero/transform.mjs +177 -0
- package/dist/esm/zero/transform.mjs.map +1 -0
- package/package.json +33 -43
- package/src/check-dep-versions.ts +2 -2
- package/src/checkDeps.ts +3 -2
- package/src/compiler.ts +425 -0
- package/src/compilerHost.ts +3125 -0
- package/src/constants.ts +0 -5
- package/src/domStructuralPass.ts +170 -0
- package/src/exports.ts +3 -6
- package/src/extractor/addLocalExports.ts +49 -0
- package/src/extractor/bundle.ts +20 -35
- package/src/extractor/bundleConfig.ts +334 -187
- package/src/extractor/concatClassName.ts +13 -20
- package/src/extractor/getTamaguiConfigPathFromOptionsConfig.ts +5 -4
- package/src/extractor/loadTamagui.ts +196 -143
- package/src/extractor/regenerateConfig.ts +65 -13
- package/src/extractor/watchTamaguiConfig.ts +6 -1
- package/src/helpers/requireTamaguiCore.ts +6 -1
- package/src/registerRequire.ts +94 -132
- package/src/staticEvaluationIgnoredModules.ts +74 -0
- package/src/types.ts +2 -107
- package/src/zero/artifact.ts +142 -0
- package/src/zero/graph.ts +359 -0
- package/src/zero/identity.ts +73 -0
- package/src/zero/index.ts +8 -0
- package/src/zero/islands.ts +262 -0
- package/src/zero/options.ts +239 -0
- package/src/zero/ownership.ts +113 -0
- package/src/zero/theme.ts +478 -0
- package/src/zero/transform.ts +320 -0
- package/types/check-dep-versions.d.ts.map +1 -1
- package/types/checkDeps.d.ts.map +1 -1
- package/types/compiler.d.ts +117 -0
- package/types/compiler.d.ts.map +1 -0
- package/types/compilerHost.d.ts +25 -0
- package/types/compilerHost.d.ts.map +1 -0
- package/types/constants.d.ts +0 -1
- package/types/constants.d.ts.map +1 -1
- package/types/domStructuralPass.d.ts +3 -0
- package/types/domStructuralPass.d.ts.map +1 -0
- package/types/exports.d.ts +3 -6
- package/types/exports.d.ts.map +1 -1
- package/types/extractor/addLocalExports.d.ts +3 -0
- package/types/extractor/addLocalExports.d.ts.map +1 -0
- package/types/extractor/bundle.d.ts +66 -65
- package/types/extractor/bundle.d.ts.map +1 -1
- package/types/extractor/bundleConfig.d.ts +19 -4
- package/types/extractor/bundleConfig.d.ts.map +1 -1
- package/types/extractor/esbuildAliasPlugin.d.ts.map +1 -1
- package/types/extractor/getTamaguiConfigPathFromOptionsConfig.d.ts +1 -1
- package/types/extractor/getTamaguiConfigPathFromOptionsConfig.d.ts.map +1 -1
- package/types/extractor/loadTamagui.d.ts +26 -3
- package/types/extractor/loadTamagui.d.ts.map +1 -1
- package/types/extractor/regenerateConfig.d.ts +1 -1
- package/types/extractor/regenerateConfig.d.ts.map +1 -1
- package/types/extractor/watchTamaguiConfig.d.ts.map +1 -1
- package/types/getPragmaOptions.d.ts +1 -1
- package/types/helpers/memoize.d.ts +1 -1
- package/types/helpers/memoize.d.ts.map +1 -1
- package/types/helpers/requireTamaguiCore.d.ts.map +1 -1
- package/types/index.d.ts.map +1 -1
- package/types/registerRequire.d.ts +2 -2
- package/types/registerRequire.d.ts.map +1 -1
- package/types/staticEvaluationIgnoredModules.d.ts +9 -0
- package/types/staticEvaluationIgnoredModules.d.ts.map +1 -0
- package/types/types.d.ts +2 -90
- package/types/types.d.ts.map +1 -1
- package/types/zero/artifact.d.ts +44 -0
- package/types/zero/artifact.d.ts.map +1 -0
- package/types/zero/graph.d.ts +139 -0
- package/types/zero/graph.d.ts.map +1 -0
- package/types/zero/identity.d.ts +33 -0
- package/types/zero/identity.d.ts.map +1 -0
- package/types/zero/index.d.ts +9 -0
- package/types/zero/index.d.ts.map +1 -0
- package/types/zero/islands.d.ts +56 -0
- package/types/zero/islands.d.ts.map +1 -0
- package/types/zero/options.d.ts +58 -0
- package/types/zero/options.d.ts.map +1 -0
- package/types/zero/ownership.d.ts +51 -0
- package/types/zero/ownership.d.ts.map +1 -0
- package/types/zero/theme.d.ts +83 -0
- package/types/zero/theme.d.ts.map +1 -0
- package/types/zero/transform.d.ts +53 -0
- package/types/zero/transform.d.ts.map +1 -0
- package/dist/check-dep-versions.cjs +0 -372
- package/dist/checkDeps.cjs +0 -271
- package/dist/constants.cjs +0 -51
- package/dist/exports.cjs +0 -48
- package/dist/extractor/accessSafe.cjs +0 -48
- package/dist/extractor/babelParse.cjs +0 -56
- package/dist/extractor/buildClassName.cjs +0 -86
- package/dist/extractor/bundle.cjs +0 -234
- package/dist/extractor/bundleConfig.cjs +0 -729
- package/dist/extractor/concatClassName.cjs +0 -129
- package/dist/extractor/createEvaluator.cjs +0 -88
- package/dist/extractor/createExtractor.cjs +0 -1968
- package/dist/extractor/createLogger.cjs +0 -50
- package/dist/extractor/detectModuleFormat.cjs +0 -55
- package/dist/extractor/ensureImportingConcat.cjs +0 -54
- package/dist/extractor/errors.cjs +0 -28
- package/dist/extractor/esbuildAliasPlugin.cjs +0 -56
- package/dist/extractor/esbuildTsconfigPaths.cjs +0 -108
- package/dist/extractor/evaluateAstNode.cjs +0 -128
- package/dist/extractor/extractHelpers.cjs +0 -182
- package/dist/extractor/extractMediaStyle.cjs +0 -169
- package/dist/extractor/extractToClassNames.cjs +0 -475
- package/dist/extractor/extractToNative.cjs +0 -369
- package/dist/extractor/findTopmostFunction.cjs +0 -43
- package/dist/extractor/generatedUid.cjs +0 -58
- package/dist/extractor/getPrefixLogs.cjs +0 -31
- package/dist/extractor/getPropValueFromAttributes.cjs +0 -85
- package/dist/extractor/getSourceModule.cjs +0 -100
- package/dist/extractor/getStaticBindingsForScope.cjs +0 -213
- package/dist/extractor/getTamaguiConfigPathFromOptionsConfig.cjs +0 -41
- package/dist/extractor/hasTopLevelAwait.cjs +0 -62
- package/dist/extractor/hoistClassNames.cjs +0 -76
- package/dist/extractor/literalToAst.cjs +0 -109
- package/dist/extractor/loadFile.cjs +0 -17
- package/dist/extractor/loadTamagui.cjs +0 -373
- package/dist/extractor/logLines.cjs +0 -43
- package/dist/extractor/normalizeTernaries.cjs +0 -100
- package/dist/extractor/propsToFontFamilyCache.cjs +0 -42
- package/dist/extractor/regenerateConfig.cjs +0 -178
- package/dist/extractor/removeUnusedHooks.cjs +0 -108
- package/dist/extractor/timer.cjs +0 -52
- package/dist/extractor/validHTMLAttributes.cjs +0 -79
- package/dist/extractor/watchTamaguiConfig.cjs +0 -70
- package/dist/getPragmaOptions.cjs +0 -73
- package/dist/helpers/memoize.cjs +0 -45
- package/dist/helpers/requireTamaguiCore.cjs +0 -40
- package/dist/index.cjs +0 -42
- package/dist/registerRequire.cjs +0 -209
- package/dist/server.cjs +0 -82
- package/dist/types.cjs +0 -18
- package/dist/worker.cjs +0 -111
- package/src/extractor/accessSafe.ts +0 -22
- package/src/extractor/babelParse.ts +0 -38
- package/src/extractor/buildClassName.ts +0 -76
- package/src/extractor/createEvaluator.ts +0 -82
- package/src/extractor/createExtractor.ts +0 -2970
- package/src/extractor/createLogger.ts +0 -41
- package/src/extractor/ensureImportingConcat.ts +0 -36
- package/src/extractor/errors.ts +0 -1
- package/src/extractor/evaluateAstNode.ts +0 -136
- package/src/extractor/extractHelpers.ts +0 -211
- package/src/extractor/extractMediaStyle.ts +0 -194
- package/src/extractor/extractToClassNames.ts +0 -733
- package/src/extractor/extractToNative.ts +0 -506
- package/src/extractor/findTopmostFunction.ts +0 -24
- package/src/extractor/generatedUid.ts +0 -41
- package/src/extractor/getPrefixLogs.ts +0 -9
- package/src/extractor/getPropValueFromAttributes.ts +0 -95
- package/src/extractor/getSourceModule.ts +0 -96
- package/src/extractor/getStaticBindingsForScope.ts +0 -237
- package/src/extractor/hasTopLevelAwait.ts +0 -28
- package/src/extractor/hoistClassNames.ts +0 -52
- package/src/extractor/literalToAst.ts +0 -85
- package/src/extractor/loadFile.ts +0 -17
- package/src/extractor/logLines.ts +0 -16
- package/src/extractor/normalizeTernaries.ts +0 -89
- package/src/extractor/propsToFontFamilyCache.ts +0 -18
- package/src/extractor/removeUnusedHooks.ts +0 -83
- package/src/extractor/timer.ts +0 -25
- package/src/extractor/validHTMLAttributes.ts +0 -52
- package/src/worker.ts +0 -142
- package/types/extractor/accessSafe.d.ts +0 -3
- package/types/extractor/accessSafe.d.ts.map +0 -1
- package/types/extractor/babelParse.d.ts +0 -5
- package/types/extractor/babelParse.d.ts.map +0 -1
- package/types/extractor/buildClassName.d.ts +0 -7
- package/types/extractor/buildClassName.d.ts.map +0 -1
- package/types/extractor/createEvaluator.d.ts +0 -12
- package/types/extractor/createEvaluator.d.ts.map +0 -1
- package/types/extractor/createExtractor.d.ts +0 -32
- package/types/extractor/createExtractor.d.ts.map +0 -1
- package/types/extractor/createLogger.d.ts +0 -3
- package/types/extractor/createLogger.d.ts.map +0 -1
- package/types/extractor/ensureImportingConcat.d.ts +0 -4
- package/types/extractor/ensureImportingConcat.d.ts.map +0 -1
- package/types/extractor/errors.d.ts +0 -3
- package/types/extractor/errors.d.ts.map +0 -1
- package/types/extractor/evaluateAstNode.d.ts +0 -3
- package/types/extractor/evaluateAstNode.d.ts.map +0 -1
- package/types/extractor/extractHelpers.d.ts +0 -28
- package/types/extractor/extractHelpers.d.ts.map +0 -1
- package/types/extractor/extractMediaStyle.d.ts +0 -11
- package/types/extractor/extractMediaStyle.d.ts.map +0 -1
- package/types/extractor/extractToClassNames.d.ts +0 -25
- package/types/extractor/extractToClassNames.d.ts.map +0 -1
- package/types/extractor/extractToNative.d.ts +0 -13
- package/types/extractor/extractToNative.d.ts.map +0 -1
- package/types/extractor/findTopmostFunction.d.ts +0 -4
- package/types/extractor/findTopmostFunction.d.ts.map +0 -1
- package/types/extractor/generatedUid.d.ts +0 -5
- package/types/extractor/generatedUid.d.ts.map +0 -1
- package/types/extractor/getPrefixLogs.d.ts +0 -3
- package/types/extractor/getPrefixLogs.d.ts.map +0 -1
- package/types/extractor/getPropValueFromAttributes.d.ts +0 -19
- package/types/extractor/getPropValueFromAttributes.d.ts.map +0 -1
- package/types/extractor/getSourceModule.d.ts +0 -16
- package/types/extractor/getSourceModule.d.ts.map +0 -1
- package/types/extractor/getStaticBindingsForScope.d.ts +0 -5
- package/types/extractor/getStaticBindingsForScope.d.ts.map +0 -1
- package/types/extractor/hasTopLevelAwait.d.ts +0 -2
- package/types/extractor/hasTopLevelAwait.d.ts.map +0 -1
- package/types/extractor/hoistClassNames.d.ts +0 -6
- package/types/extractor/hoistClassNames.d.ts.map +0 -1
- package/types/extractor/literalToAst.d.ts +0 -4
- package/types/extractor/literalToAst.d.ts.map +0 -1
- package/types/extractor/loadFile.d.ts +0 -1
- package/types/extractor/loadFile.d.ts.map +0 -1
- package/types/extractor/logLines.d.ts +0 -2
- package/types/extractor/logLines.d.ts.map +0 -1
- package/types/extractor/normalizeTernaries.d.ts +0 -5
- package/types/extractor/normalizeTernaries.d.ts.map +0 -1
- package/types/extractor/propsToFontFamilyCache.d.ts +0 -4
- package/types/extractor/propsToFontFamilyCache.d.ts.map +0 -1
- package/types/extractor/removeUnusedHooks.d.ts +0 -3
- package/types/extractor/removeUnusedHooks.d.ts.map +0 -1
- package/types/extractor/timer.d.ts +0 -5
- package/types/extractor/timer.d.ts.map +0 -1
- package/types/extractor/validHTMLAttributes.d.ts +0 -52
- package/types/extractor/validHTMLAttributes.d.ts.map +0 -1
- package/types/worker.d.ts +0 -46
- package/types/worker.d.ts.map +0 -1
- /package/dist/{setup.cjs → cjs/setup.cjs} +0 -0
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import {
|
|
2
|
+
applyLoweredModule,
|
|
3
|
+
childNode,
|
|
4
|
+
childNodes,
|
|
5
|
+
parseModuleAst,
|
|
6
|
+
planZeroErasure,
|
|
7
|
+
resolvedModuleId,
|
|
8
|
+
walkAst,
|
|
9
|
+
zeroIslandThemeMessage,
|
|
10
|
+
zeroViolationsFromPlan,
|
|
11
|
+
type AppliedLoweredModule,
|
|
12
|
+
type AstNode,
|
|
13
|
+
type LoweredModulePlan,
|
|
14
|
+
type SourceEdit,
|
|
15
|
+
type ZeroViolation,
|
|
16
|
+
} from '@tamagui/compiler-core'
|
|
17
|
+
import { type TamaguiInternalConfig } from '@tamagui/web'
|
|
18
|
+
|
|
19
|
+
import { createHash } from 'node:crypto'
|
|
20
|
+
import path from 'node:path'
|
|
21
|
+
|
|
22
|
+
import type { IslandThemeBridge, IslandThemeBridgeLayer } from './islands'
|
|
23
|
+
import {
|
|
24
|
+
foldBranches,
|
|
25
|
+
lowerStaticTheme,
|
|
26
|
+
readStaticTheme,
|
|
27
|
+
resolveThemeChain,
|
|
28
|
+
type StaticThemeNode,
|
|
29
|
+
} from './theme'
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The zero-mode source transform.
|
|
33
|
+
*
|
|
34
|
+
* It runs after lowering has committed its edits and before the bundler records
|
|
35
|
+
* this module's dependencies. It lowers static `<Theme>` into host markup plus
|
|
36
|
+
* classes, assigns each island mount its theme bridge, and erases the Tamagui
|
|
37
|
+
* references lowering consumed.
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
export interface ZeroModuleTransformInput {
|
|
41
|
+
/**
|
|
42
|
+
* `report` runs every analysis and returns the source unchanged, so a project
|
|
43
|
+
* can see its violations without moving off the full runtime.
|
|
44
|
+
*/
|
|
45
|
+
mode: 'report' | 'enforce'
|
|
46
|
+
id: string
|
|
47
|
+
/** Project root, so bridge ids are stable and unique across modules. */
|
|
48
|
+
root: string
|
|
49
|
+
source: string
|
|
50
|
+
/** The module's lowering plan. Erasure only runs on a plan with no violations. */
|
|
51
|
+
plan: LoweredModulePlan
|
|
52
|
+
config: TamaguiInternalConfig
|
|
53
|
+
/** Specifier prefixes that name the Tamagui surface, e.g. `tamagui`. */
|
|
54
|
+
isTamaguiSpecifier(specifier: string): boolean
|
|
55
|
+
/** Island id when a specifier resolves to a generated island loader. */
|
|
56
|
+
resolveIslandLoader(specifier: string): { islandId: string } | null
|
|
57
|
+
/** Island id when a specifier resolves to a declared island root module. */
|
|
58
|
+
resolveIslandModule(specifier: string): string | null
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface ZeroModuleTransformResult {
|
|
62
|
+
output: AppliedLoweredModule
|
|
63
|
+
edits: SourceEdit[]
|
|
64
|
+
/** Deterministic bridge descriptors this module produced, by island id. */
|
|
65
|
+
bridges: Map<string, IslandThemeBridge[]>
|
|
66
|
+
/** Inline-value CSS rules keyed by their generated class name. */
|
|
67
|
+
bridgeCSS: Map<string, string>
|
|
68
|
+
violations: ZeroViolation[]
|
|
69
|
+
erased: {
|
|
70
|
+
modules: string[]
|
|
71
|
+
bindings: string[]
|
|
72
|
+
styledDefinitions: string[]
|
|
73
|
+
/** Erased declarators this module also exported. */
|
|
74
|
+
exports: string[]
|
|
75
|
+
}
|
|
76
|
+
/** Animated-number hooks rewritten from the public barrel to the leaf. */
|
|
77
|
+
rewrittenAnimatedNumberHooks: string[]
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function identifierNameOf(node: AstNode | null): string | null {
|
|
81
|
+
return node && node.type === 'Identifier' && typeof node.name === 'string'
|
|
82
|
+
? node.name
|
|
83
|
+
: null
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function jsxNameOf(element: AstNode): string | null {
|
|
87
|
+
const opening = childNode(element, 'openingElement')
|
|
88
|
+
if (!opening) return null
|
|
89
|
+
const name = childNode(opening, 'name')
|
|
90
|
+
return name && name.type === 'JSXIdentifier' && typeof name.name === 'string'
|
|
91
|
+
? name.name
|
|
92
|
+
: null
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function transformZeroModule(
|
|
96
|
+
input: ZeroModuleTransformInput
|
|
97
|
+
): ZeroModuleTransformResult {
|
|
98
|
+
const { id, source, config } = input
|
|
99
|
+
const moduleId = resolvedModuleId(id)
|
|
100
|
+
const program = parseModuleAst(source, id)
|
|
101
|
+
|
|
102
|
+
// The lowering plan's own blocking diagnostics are the rule 1-6 sites. A
|
|
103
|
+
// candidate that did not lower left a runtime behind, which is the violation.
|
|
104
|
+
const violations: ZeroViolation[] = zeroViolationsFromPlan(input.plan)
|
|
105
|
+
const edits: SourceEdit[] = []
|
|
106
|
+
const bridges = new Map<string, IslandThemeBridge[]>()
|
|
107
|
+
const bridgeCSS = new Map<string, string>()
|
|
108
|
+
|
|
109
|
+
// module-level bindings we care about
|
|
110
|
+
let themeLocal: string | null = null
|
|
111
|
+
const islandLocals = new Map<string, string>()
|
|
112
|
+
for (const statement of childNodes(program, 'body')) {
|
|
113
|
+
if (statement.type !== 'ImportDeclaration') continue
|
|
114
|
+
const sourceNode = childNode(statement, 'source')
|
|
115
|
+
const specifier =
|
|
116
|
+
sourceNode && typeof sourceNode.value === 'string' ? sourceNode.value : null
|
|
117
|
+
if (!specifier) continue
|
|
118
|
+
const island = input.resolveIslandLoader(specifier)
|
|
119
|
+
for (const importSpecifier of childNodes(statement, 'specifiers')) {
|
|
120
|
+
const local = identifierNameOf(childNode(importSpecifier, 'local'))
|
|
121
|
+
if (!local) continue
|
|
122
|
+
if (island) {
|
|
123
|
+
islandLocals.set(local, island.islandId)
|
|
124
|
+
continue
|
|
125
|
+
}
|
|
126
|
+
if (!input.isTamaguiSpecifier(specifier)) continue
|
|
127
|
+
const imported = childNode(importSpecifier, 'imported')
|
|
128
|
+
if (imported && imported.name === 'Theme') themeLocal = local
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// parent chain, built in one walk
|
|
133
|
+
const parents = new Map<AstNode, AstNode>()
|
|
134
|
+
const elements: AstNode[] = []
|
|
135
|
+
walkAst(program, (node, parent) => {
|
|
136
|
+
if (parent) parents.set(node, parent)
|
|
137
|
+
if (node.type === 'JSXElement') elements.push(node)
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
const themeElements = themeLocal
|
|
141
|
+
? elements.filter((element) => jsxNameOf(element) === themeLocal)
|
|
142
|
+
: []
|
|
143
|
+
|
|
144
|
+
// Each <Theme> is read once, then lowered against its own ancestry, so a
|
|
145
|
+
// nested node resolves against whatever its parent resolved to.
|
|
146
|
+
const themeNodes = new Map<AstNode, StaticThemeNode>()
|
|
147
|
+
for (const element of themeElements) {
|
|
148
|
+
const read = readStaticTheme(element, id, source, config)
|
|
149
|
+
for (const [identifier, rules] of read.css) bridgeCSS.set(identifier, rules)
|
|
150
|
+
violations.push(...read.violations)
|
|
151
|
+
if (read.node) themeNodes.set(element, read.node)
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const themeChainOf = (element: AstNode): StaticThemeNode[] => {
|
|
155
|
+
const chain: StaticThemeNode[] = []
|
|
156
|
+
let cursor: AstNode | undefined = element
|
|
157
|
+
while (cursor) {
|
|
158
|
+
const node = themeNodes.get(cursor)
|
|
159
|
+
if (node) chain.unshift(node)
|
|
160
|
+
cursor = parents.get(cursor)
|
|
161
|
+
}
|
|
162
|
+
return chain
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// With no provider in the zero graph, the document's theme is the config's
|
|
166
|
+
// first theme: that is the one the generated artifact writes to `:root`.
|
|
167
|
+
const rootThemeName = Object.keys(config.themes)[0] ?? 'light'
|
|
168
|
+
|
|
169
|
+
for (const element of themeElements) {
|
|
170
|
+
const node = themeNodes.get(element)
|
|
171
|
+
if (!node) continue
|
|
172
|
+
const lowered = lowerStaticTheme(
|
|
173
|
+
node,
|
|
174
|
+
themeChainOf(element),
|
|
175
|
+
rootThemeName,
|
|
176
|
+
config,
|
|
177
|
+
id
|
|
178
|
+
)
|
|
179
|
+
violations.push(...lowered.violations)
|
|
180
|
+
edits.push(...lowered.edits)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// island mounts: assign each site a stable bridge from its static Theme chain
|
|
184
|
+
const mounts = elements
|
|
185
|
+
.filter((element) => {
|
|
186
|
+
const name = jsxNameOf(element)
|
|
187
|
+
return !!name && islandLocals.has(name)
|
|
188
|
+
})
|
|
189
|
+
.sort((left, right) => left.start - right.start)
|
|
190
|
+
|
|
191
|
+
const moduleBridgePrefix = createHash('sha256')
|
|
192
|
+
.update(path.relative(input.root, id).replace(/\\/g, '/'))
|
|
193
|
+
.digest('hex')
|
|
194
|
+
.slice(0, 8)
|
|
195
|
+
|
|
196
|
+
// Lowering rewrites the component name of every element it turned into a host
|
|
197
|
+
// element, so an uppercase JSX name that no edit covers is an opaque component
|
|
198
|
+
// call: what it renders around its children is not visible from this module.
|
|
199
|
+
const loweredRanges = input.plan.edits.filter((edit) => edit.end > edit.start)
|
|
200
|
+
const isOpaqueAncestor = (element: AstNode): boolean => {
|
|
201
|
+
if (themeNodes.has(element)) return false
|
|
202
|
+
const name = jsxNameOf(element)
|
|
203
|
+
if (!name || islandLocals.has(name)) return false
|
|
204
|
+
if (name[0] !== name[0].toUpperCase()) return false
|
|
205
|
+
const nameNode = childNode(childNode(element, 'openingElement')!, 'name')!
|
|
206
|
+
return !loweredRanges.some(
|
|
207
|
+
(edit) => edit.start <= nameNode.start && edit.end >= nameNode.end
|
|
208
|
+
)
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
mounts.forEach((element, index) => {
|
|
212
|
+
const islandId = islandLocals.get(jsxNameOf(element)!)!
|
|
213
|
+
|
|
214
|
+
let opaque: AstNode | null = null
|
|
215
|
+
for (let cursor = parents.get(element); cursor; cursor = parents.get(cursor)) {
|
|
216
|
+
if (cursor.type === 'JSXElement' && isOpaqueAncestor(cursor)) opaque = cursor
|
|
217
|
+
}
|
|
218
|
+
if (opaque) {
|
|
219
|
+
violations.push({
|
|
220
|
+
rule: 4,
|
|
221
|
+
code: 'local/unsupported-target',
|
|
222
|
+
span: { id: moduleId, start: element.start, end: element.end },
|
|
223
|
+
component: islandId,
|
|
224
|
+
message: zeroIslandThemeMessage(islandId),
|
|
225
|
+
})
|
|
226
|
+
return
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const chain = themeChainOf(element)
|
|
230
|
+
const layers = chain
|
|
231
|
+
.map((node) => node.layer)
|
|
232
|
+
.filter((layer): layer is IslandThemeBridgeLayer => !!layer)
|
|
233
|
+
const branches = resolveThemeChain(chain, rootThemeName, config)
|
|
234
|
+
|
|
235
|
+
// One descriptor per enumerated theme name, and the mount selects its id
|
|
236
|
+
// with the same condition the compiled classes use.
|
|
237
|
+
const descriptors = branches.map((branch, branchIndex) => ({
|
|
238
|
+
test: branch.test,
|
|
239
|
+
bridge: {
|
|
240
|
+
// unique across modules and stable across the server and client
|
|
241
|
+
// compilations of the same entry, because both see the same module path
|
|
242
|
+
id:
|
|
243
|
+
branches.length === 1
|
|
244
|
+
? `b${moduleBridgePrefix}_${index}`
|
|
245
|
+
: `b${moduleBridgePrefix}_${index}_${branchIndex}`,
|
|
246
|
+
name: branch.name,
|
|
247
|
+
layers,
|
|
248
|
+
} satisfies IslandThemeBridge,
|
|
249
|
+
}))
|
|
250
|
+
|
|
251
|
+
const list = bridges.get(islandId) ?? []
|
|
252
|
+
for (const descriptor of descriptors) list.push(descriptor.bridge)
|
|
253
|
+
bridges.set(islandId, list)
|
|
254
|
+
|
|
255
|
+
// The descriptor travels inline as data, so nothing in the zero graph has to
|
|
256
|
+
// import a manifest module and no build ordering can desynchronize them.
|
|
257
|
+
const fold = (value: (bridge: IslandThemeBridge) => string) =>
|
|
258
|
+
foldBranches(
|
|
259
|
+
descriptors.map((descriptor) => ({
|
|
260
|
+
test: descriptor.test,
|
|
261
|
+
value: value(descriptor.bridge),
|
|
262
|
+
}))
|
|
263
|
+
)
|
|
264
|
+
const opening = childNode(element, 'openingElement')!
|
|
265
|
+
const nameNode = childNode(opening, 'name')!
|
|
266
|
+
edits.push({
|
|
267
|
+
start: nameNode.end,
|
|
268
|
+
end: nameNode.end,
|
|
269
|
+
content: ` data-tamagui-bridge={${fold((bridge) =>
|
|
270
|
+
JSON.stringify(bridge.id)
|
|
271
|
+
)}} __tamaguiBridge={${fold((bridge) => JSON.stringify(bridge))}}`,
|
|
272
|
+
origin: { id: moduleId, start: nameNode.start, end: nameNode.end },
|
|
273
|
+
})
|
|
274
|
+
})
|
|
275
|
+
|
|
276
|
+
// Reference erasure runs last, so it sees the Theme edits as consumed ranges,
|
|
277
|
+
// and only on a plan that already has nothing to report: erasure's whole
|
|
278
|
+
// licence is that every use in this module lowered.
|
|
279
|
+
const erasure = violations.length
|
|
280
|
+
? null
|
|
281
|
+
: planZeroErasure({
|
|
282
|
+
id: moduleId,
|
|
283
|
+
source,
|
|
284
|
+
loweredEdits: [...input.plan.edits, ...edits],
|
|
285
|
+
isTamaguiSpecifier: input.isTamaguiSpecifier,
|
|
286
|
+
islandIdFor: input.resolveIslandModule,
|
|
287
|
+
})
|
|
288
|
+
if (erasure) {
|
|
289
|
+
edits.push(...erasure.edits)
|
|
290
|
+
violations.push(...erasure.violations)
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// `report` leaves the source alone by contract, so its output is whatever
|
|
294
|
+
// ordinary lowering produced.
|
|
295
|
+
const output =
|
|
296
|
+
input.mode === 'report'
|
|
297
|
+
? applyLoweredModule(source, moduleId, input.plan)
|
|
298
|
+
: violations.length
|
|
299
|
+
? { changed: false, code: source, map: null }
|
|
300
|
+
: applyLoweredModule(source, moduleId, {
|
|
301
|
+
id: moduleId,
|
|
302
|
+
sourceHash: input.plan.sourceHash,
|
|
303
|
+
edits: [...input.plan.edits, ...edits],
|
|
304
|
+
})
|
|
305
|
+
|
|
306
|
+
return {
|
|
307
|
+
output,
|
|
308
|
+
edits: input.mode === 'report' ? [] : edits,
|
|
309
|
+
bridges: input.mode === 'report' ? new Map() : bridges,
|
|
310
|
+
bridgeCSS: input.mode === 'report' ? new Map() : bridgeCSS,
|
|
311
|
+
violations,
|
|
312
|
+
erased: {
|
|
313
|
+
modules: erasure?.removedModules ?? [],
|
|
314
|
+
bindings: erasure?.removedBindings ?? [],
|
|
315
|
+
styledDefinitions: erasure?.erasedStyledDefinitions ?? [],
|
|
316
|
+
exports: erasure?.erasedExports ?? [],
|
|
317
|
+
},
|
|
318
|
+
rewrittenAnimatedNumberHooks: erasure?.rewrittenAnimatedNumberHooks ?? [],
|
|
319
|
+
}
|
|
320
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-dep-versions.d.ts","sourceRoot":"","sources":["../src/check-dep-versions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA8oBH,+CAA+C;AAC/C,KAAK,UAAU,GAAG;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,EAAE,OAAO,CAAA;IACtB,QAAQ,EAAE,SAAS;QACjB,OAAO,EAAE,MAAM,CAAA;QACf,QAAQ,EAAE,SAAS;YAAE,YAAY,EAAE,MAAM,CAAA;SAAE,EAAE,CAAA;KAC9C,EAAE,CAAA;CACJ,CAAA;AAED,qBAAa,IAAI;IACf,4GAA4G;IAC5G,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAc;IAE3C;;;;;;;;;;OAUG;
|
|
1
|
+
{"version":3,"file":"check-dep-versions.d.ts","sourceRoot":"","sources":["../src/check-dep-versions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA8oBH,+CAA+C;AAC/C,KAAK,UAAU,GAAG;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,EAAE,OAAO,CAAA;IACtB,QAAQ,EAAE,SAAS;QACjB,OAAO,EAAE,MAAM,CAAA;QACf,QAAQ,EAAE,SAAS;YAAE,YAAY,EAAE,MAAM,CAAA;SAAE,EAAE,CAAA;KAC9C,EAAE,CAAA;CACJ,CAAA;AAED,qBAAa,IAAI;IACf,4GAA4G;IAC5G,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAc;IAE3C;;;;;;;;;;OAUG;IACH,YAAY,IAAI,EAAE,MAAM,EAGvB;IAEM,iBAAiB,IAAI,MAAM,CAEjC;IAEM,eAAe,IAAI,SAAS,UAAU,EAAE,CAI9C;IAEM,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAY7C;IAED,IAAW,0BAA0B,IAAI,OAAO,CAE/C;CACF"}
|
package/types/checkDeps.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkDeps.d.ts","sourceRoot":"","sources":["../src/checkDeps.ts"],"names":[],"mappings":"AAIA,oBAAY,eAAe;IACzB,YAAY,iBAAiB;IAC7B,eAAe,oBAAoB;IACnC,oBAAoB,yBAAyB;IAC7C,gBAAgB,qBAAqB;IACrC,WAAW,gBAAgB;CAC5B;AAED,MAAM,MAAM,OAAO,GAAG;IACpB,OAAO,CAAC,EAAE,SAAS,GAAG,eAAe,EAAE,EAAE,CAAA;IACzC,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAC7B,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACpC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACjC,oBAAoB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACxC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAC9B,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CACtC,CAAA;AA+TD,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"checkDeps.d.ts","sourceRoot":"","sources":["../src/checkDeps.ts"],"names":[],"mappings":"AAIA,oBAAY,eAAe;IACzB,YAAY,iBAAiB;IAC7B,eAAe,oBAAoB;IACnC,oBAAoB,yBAAyB;IAC7C,gBAAgB,qBAAqB;IACrC,WAAW,gBAAgB;CAC5B;AAED,MAAM,MAAM,OAAO,GAAG;IACpB,OAAO,CAAC,EAAE,SAAS,GAAG,eAAe,EAAE,EAAE,CAAA;IACzC,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAC7B,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACpC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACjC,oBAAoB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACxC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAC9B,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CACtC,CAAA;AA+TD,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,iBA+B3C"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { type AppliedLoweredModule, type CompilerTarget, type LoweredModulePlan, type ResolvedModuleId } from '@tamagui/compiler-core';
|
|
2
|
+
import type { TamaguiOptions } from '@tamagui/types';
|
|
3
|
+
import type { TamaguiProjectInfo } from './extractor/bundleConfig';
|
|
4
|
+
export interface CompilerProjectComponentModule {
|
|
5
|
+
moduleName: string;
|
|
6
|
+
id: string;
|
|
7
|
+
}
|
|
8
|
+
export interface CompilerProject {
|
|
9
|
+
projectInfo: TamaguiProjectInfo;
|
|
10
|
+
componentModules: CompilerProjectComponentModule[];
|
|
11
|
+
generation: string;
|
|
12
|
+
/** Keep elements with dynamic style props fully on the runtime path. */
|
|
13
|
+
disablePartialExtraction?: boolean;
|
|
14
|
+
/** emit native theme-token mappings for the native style engine */
|
|
15
|
+
experimentalNativeFastPath?: boolean;
|
|
16
|
+
/** Zero-runtime mode, which makes the host's diagnostics mode-aware. */
|
|
17
|
+
zeroRuntime?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Content identity of everything a lowering plan depends on that is not a
|
|
20
|
+
* module: the compiler build, the evaluated config and component registry,
|
|
21
|
+
* the platform, and the modes. Null when the project could not name the files
|
|
22
|
+
* that determine it, in which case nothing is cached to disk.
|
|
23
|
+
*/
|
|
24
|
+
cacheStamp: string | null;
|
|
25
|
+
}
|
|
26
|
+
export interface LoadCompilerProjectInput {
|
|
27
|
+
root: string;
|
|
28
|
+
target: CompilerTarget;
|
|
29
|
+
options: Partial<TamaguiOptions>;
|
|
30
|
+
generation: string | ((projectInfo: TamaguiProjectInfo, componentModules: CompilerProjectComponentModule[], options: TamaguiOptions) => string);
|
|
31
|
+
rebuild?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* `name@version` for the host integration package, folded into the cache
|
|
34
|
+
* stamp so a plugin upgrade cannot reuse plans built by the previous one.
|
|
35
|
+
*/
|
|
36
|
+
hostVersions?: readonly string[];
|
|
37
|
+
missingProjectMessage?: string;
|
|
38
|
+
load?: (options: TamaguiOptions, rebuild: boolean) => Promise<TamaguiProjectInfo | null>;
|
|
39
|
+
resolveComponents?: (moduleNames: readonly string[], projectInfo: TamaguiProjectInfo, options: TamaguiOptions) => Promise<CompilerProjectComponentModule[]>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* normalize and load the compiler-owned project contract. module resolution and
|
|
43
|
+
* evaluation stay with the adapter through the two callbacks.
|
|
44
|
+
*/
|
|
45
|
+
export declare function loadCompilerProject({ root, target, options: optionsIn, generation, rebuild, hostVersions, missingProjectMessage, load, resolveComponents, }: LoadCompilerProjectInput): Promise<CompilerProject>;
|
|
46
|
+
/**
|
|
47
|
+
* The non-module half of every plan cache key. Null when the project named no
|
|
48
|
+
* stamp sources: a stamp that cannot see a config change is worse than no
|
|
49
|
+
* cache, so that project simply does not cache.
|
|
50
|
+
*/
|
|
51
|
+
export declare function compilerProjectStamp(input: {
|
|
52
|
+
stampSources: readonly string[];
|
|
53
|
+
hostVersions: readonly string[];
|
|
54
|
+
target: CompilerTarget;
|
|
55
|
+
componentModules: readonly CompilerProjectComponentModule[];
|
|
56
|
+
disablePartialExtraction: boolean;
|
|
57
|
+
experimentalNativeFastPath: boolean;
|
|
58
|
+
zeroRuntime: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* `process.env.NODE_ENV === 'development'` in the process that builds plans.
|
|
61
|
+
* The host emits debug-receipt edits into `plan.edits` only in development
|
|
62
|
+
* (compilerHost.ts's developmentDebugInstrumentation), so a development plan
|
|
63
|
+
* is not a plan a production build may reuse. This is the ONLY ambient input
|
|
64
|
+
* to a plan, and it lives in the stamp so every host inherits it rather than
|
|
65
|
+
* each one remembering to add it to its own key.
|
|
66
|
+
*/
|
|
67
|
+
development: boolean;
|
|
68
|
+
}): string | null;
|
|
69
|
+
export interface CompilerResolution {
|
|
70
|
+
id: string;
|
|
71
|
+
external?: boolean;
|
|
72
|
+
}
|
|
73
|
+
export interface CompilerInput {
|
|
74
|
+
id: string;
|
|
75
|
+
source: string;
|
|
76
|
+
root: string;
|
|
77
|
+
target: CompilerTarget;
|
|
78
|
+
project: CompilerProject;
|
|
79
|
+
resolve(specifier: string, importer: string): Promise<CompilerResolution | null>;
|
|
80
|
+
load(id: string): Promise<string | null>;
|
|
81
|
+
}
|
|
82
|
+
export type CompilerUpdateInput = Omit<CompilerInput, 'target'>;
|
|
83
|
+
export interface CompilerResult {
|
|
84
|
+
plan: LoweredModulePlan;
|
|
85
|
+
output: AppliedLoweredModule;
|
|
86
|
+
invalidatedIds: ResolvedModuleId[];
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Long-lived host-resolved graph frontend. The adapter supplies every identity and
|
|
90
|
+
* load result; compiler-core never guesses package, alias, or workspace resolution.
|
|
91
|
+
*/
|
|
92
|
+
export declare class CompilerFrontend {
|
|
93
|
+
private readonly session;
|
|
94
|
+
private queue;
|
|
95
|
+
private readonly planCaches;
|
|
96
|
+
/**
|
|
97
|
+
* One cache per project root and platform. Absent when the project produced
|
|
98
|
+
* no content stamp, in which case plans are never persisted rather than
|
|
99
|
+
* persisted under an identity that cannot see a config change.
|
|
100
|
+
*/
|
|
101
|
+
private planCacheFor;
|
|
102
|
+
/** Hits, misses and writes across every plan cache this frontend has used. */
|
|
103
|
+
get planCacheStats(): {
|
|
104
|
+
hits: number;
|
|
105
|
+
misses: number;
|
|
106
|
+
writes: number;
|
|
107
|
+
};
|
|
108
|
+
compile(input: CompilerInput): Promise<CompilerResult>;
|
|
109
|
+
update(input: CompilerUpdateInput): Promise<ResolvedModuleId[]>;
|
|
110
|
+
has(id: string): boolean;
|
|
111
|
+
dependentsOf(id: string): ResolvedModuleId[];
|
|
112
|
+
remove(id: string): Promise<import("@tamagui/compiler-core").GraphInvalidation>;
|
|
113
|
+
parseCount(id: string): number;
|
|
114
|
+
private compileNow;
|
|
115
|
+
private buildTree;
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=compiler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compiler.d.ts","sourceRoot":"","sources":["../src/compiler.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { CompilerLoweringHost, CompilerTarget } from '@tamagui/compiler-core';
|
|
2
|
+
import type { TamaguiInternalConfig } from '@tamagui/web';
|
|
3
|
+
import type { LoadedComponents } from './extractor/bundleConfig';
|
|
4
|
+
export interface CompilerComponentModule {
|
|
5
|
+
moduleName: string;
|
|
6
|
+
resolvedId: string;
|
|
7
|
+
}
|
|
8
|
+
export interface TamaguiCompilerHostOptions {
|
|
9
|
+
target: CompilerTarget;
|
|
10
|
+
tamaguiConfig: TamaguiInternalConfig;
|
|
11
|
+
components: LoadedComponents[];
|
|
12
|
+
componentModules: CompilerComponentModule[];
|
|
13
|
+
/** Keep elements with dynamic style props fully on the runtime path. */
|
|
14
|
+
disablePartialExtraction?: boolean;
|
|
15
|
+
/** emit native theme-token mappings for the native style engine */
|
|
16
|
+
experimentalNativeFastPath?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Zero-runtime mode. The diagnostics stay the same shape; what changes is that
|
|
19
|
+
* a spread the compiler cannot prove style-free is rejected instead of merged,
|
|
20
|
+
* and the sites whose rule differs from their code's default say so.
|
|
21
|
+
*/
|
|
22
|
+
zeroRuntime?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare function createTamaguiCompilerHost(options: TamaguiCompilerHostOptions): CompilerLoweringHost;
|
|
25
|
+
//# sourceMappingURL=compilerHost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compilerHost.d.ts","sourceRoot":"","sources":["../src/compilerHost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,cAAc,EAQf,MAAM,wBAAwB,CAAA;AA8B/B,OAAO,KAAK,EAAiC,qBAAqB,EAAE,MAAM,cAAc,CAAA;AAExF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAIhE,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,cAAc,CAAA;IACtB,aAAa,EAAE,qBAAqB,CAAA;IACpC,UAAU,EAAE,gBAAgB,EAAE,CAAA;IAC9B,gBAAgB,EAAE,uBAAuB,EAAE,CAAA;IAC3C,wEAAwE;IACxE,wBAAwB,CAAC,EAAE,OAAO,CAAA;IAClC,mEAAmE;IACnE,0BAA0B,CAAC,EAAE,OAAO,CAAA;IACpC;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AA00BD,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,0BAA0B,GAClC,oBAAoB,CA6oEtB"}
|
package/types/constants.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export declare const CSS_FILE_NAME = "__snack.css";
|
|
2
2
|
export declare const MEDIA_SEP = "_";
|
|
3
|
-
export declare const cacheDir: any;
|
|
4
3
|
export declare const FAILED_EVAL: unique symbol;
|
|
5
4
|
export declare const SHOULD_DEBUG: boolean | undefined;
|
|
6
5
|
//# sourceMappingURL=constants.d.ts.map
|
package/types/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,gBAAgB,CAAA;AAG1C,eAAO,MAAM,SAAS,MAAM,CAAA;AAE5B,eAAO,MAAM,WAAW,eAA8B,CAAA;AAEtD,eAAO,MAAM,YAAY,qBAC8C,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domStructuralPass.d.ts","sourceRoot":"","sources":["../src/domStructuralPass.ts"],"names":[],"mappings":"AAQA,OAAO,EAML,KAAK,oBAAoB,EAC1B,MAAM,wBAAwB,CAAA;AA8B/B,eAAO,MAAM,iBAAiB,EAAE,oBA4H/B,CAAA"}
|
package/types/exports.d.ts
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
export * from './checkDeps';
|
|
2
|
+
export * from './compilerHost';
|
|
3
|
+
export * from './compiler';
|
|
2
4
|
export * from './types';
|
|
3
|
-
export { createExtractor } from './extractor/createExtractor';
|
|
4
|
-
export { literalToAst } from './extractor/literalToAst';
|
|
5
5
|
export * from './constants';
|
|
6
|
-
export * from './extractor/extractToClassNames';
|
|
7
6
|
export * from './extractor/concatClassName';
|
|
8
|
-
export * from './extractor/extractToNative';
|
|
9
|
-
export * from './extractor/extractHelpers';
|
|
10
7
|
export * from './extractor/loadTamagui';
|
|
11
8
|
export * from './extractor/watchTamaguiConfig';
|
|
12
|
-
export * from './extractor/createLogger';
|
|
13
9
|
export * from './registerRequire';
|
|
14
10
|
export { detectModuleFormat, clearFormatCache } from './extractor/detectModuleFormat';
|
|
15
11
|
export { esbundleTamaguiConfig } from './extractor/bundle';
|
|
16
12
|
export * from './getPragmaOptions';
|
|
13
|
+
export * from './zero';
|
|
17
14
|
//# sourceMappingURL=exports.d.ts.map
|
package/types/exports.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,
|
|
1
|
+
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAC3B,cAAc,6BAA6B,CAAA;AAC3C,cAAc,yBAAyB,CAAA;AACvC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,mBAAmB,CAAA;AACjC,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACrF,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,cAAc,oBAAoB,CAAA;AAClC,cAAc,QAAQ,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addLocalExports.d.ts","sourceRoot":"","sources":["../../src/extractor/addLocalExports.ts"],"names":[],"mappings":"AAWA,uEAAuE;AACvE,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAoCnE"}
|