@tamagui/static 2.7.7 → 3.0.0-beta.1093.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 +354 -0
- package/dist/cjs/checkDeps.cjs +301 -0
- package/dist/cjs/compiler.cjs +349 -0
- package/dist/cjs/compilerHost.cjs +2285 -0
- package/dist/cjs/componentDiscovery.cjs +94 -0
- package/dist/cjs/constants.cjs +32 -0
- package/dist/cjs/domStructuralPass.cjs +121 -0
- package/dist/cjs/exports.cjs +44 -0
- package/dist/cjs/extractor/addLocalExports.cjs +63 -0
- package/dist/cjs/extractor/bundle.cjs +229 -0
- package/dist/cjs/extractor/bundleConfig.cjs +769 -0
- package/dist/cjs/extractor/concatClassName.cjs +120 -0
- package/dist/cjs/extractor/detectModuleFormat.cjs +53 -0
- package/dist/cjs/extractor/esbuildAliasPlugin.cjs +46 -0
- package/dist/cjs/extractor/esbuildTsconfigPaths.cjs +91 -0
- package/dist/cjs/extractor/getTamaguiConfigPathFromOptionsConfig.cjs +42 -0
- package/dist/cjs/extractor/loadTamagui.cjs +394 -0
- package/dist/cjs/extractor/regenerateConfig.cjs +160 -0
- package/dist/cjs/extractor/watchTamaguiConfig.cjs +63 -0
- package/dist/cjs/getPragmaOptions.cjs +66 -0
- package/dist/cjs/helpers/memoize.cjs +41 -0
- package/dist/cjs/helpers/requireTamaguiCore.cjs +39 -0
- package/dist/cjs/index.cjs +33 -0
- package/dist/cjs/registerRequire.cjs +219 -0
- package/dist/cjs/server.cjs +65 -0
- package/dist/cjs/staticEvaluationIgnoredModules.cjs +85 -0
- package/dist/cjs/types.cjs +16 -0
- package/dist/cjs/zero/artifact.cjs +144 -0
- package/dist/cjs/zero/graph.cjs +208 -0
- package/dist/cjs/zero/identity.cjs +60 -0
- package/dist/cjs/zero/index.cjs +33 -0
- package/dist/cjs/zero/islands.cjs +234 -0
- package/dist/cjs/zero/options.cjs +162 -0
- package/dist/cjs/zero/ownership.cjs +78 -0
- package/dist/cjs/zero/theme.cjs +337 -0
- package/dist/cjs/zero/transform.cjs +207 -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 +319 -0
- package/dist/esm/compiler.mjs.map +1 -0
- package/dist/esm/compilerHost.mjs +2263 -0
- package/dist/esm/compilerHost.mjs.map +1 -0
- package/dist/esm/componentDiscovery.mjs +69 -0
- package/dist/esm/componentDiscovery.mjs.map +1 -0
- package/dist/esm/constants.mjs +7 -0
- package/dist/esm/constants.mjs.map +1 -0
- package/dist/esm/domStructuralPass.mjs +102 -0
- package/dist/esm/domStructuralPass.mjs.map +1 -0
- package/dist/esm/exports.mjs +29 -0
- package/dist/esm/extractor/addLocalExports.mjs +44 -0
- package/dist/esm/extractor/addLocalExports.mjs.map +1 -0
- package/dist/esm/extractor/bundle.mjs +199 -0
- package/dist/esm/extractor/bundle.mjs.map +1 -0
- package/dist/esm/extractor/bundleConfig.mjs +728 -0
- package/dist/esm/extractor/bundleConfig.mjs.map +1 -0
- package/dist/esm/extractor/concatClassName.mjs +100 -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 +23 -0
- package/dist/esm/extractor/getTamaguiConfigPathFromOptionsConfig.mjs.map +1 -0
- package/dist/esm/extractor/loadTamagui.mjs +357 -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 +19 -0
- package/dist/esm/zero/islands.mjs +200 -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 +313 -0
- package/dist/esm/zero/theme.mjs.map +1 -0
- package/dist/esm/zero/transform.mjs +182 -0
- package/dist/esm/zero/transform.mjs.map +1 -0
- package/package.json +38 -47
- package/src/check-dep-versions.ts +2 -2
- package/src/checkDeps.ts +3 -2
- package/src/compiler.ts +506 -0
- package/src/compilerHost.ts +3752 -0
- package/src/componentDiscovery.ts +105 -0
- package/src/constants.ts +0 -5
- package/src/domStructuralPass.ts +190 -0
- package/src/exports.ts +5 -6
- package/src/extractor/addLocalExports.ts +49 -0
- package/src/extractor/bundle.ts +38 -40
- package/src/extractor/bundleConfig.ts +368 -187
- package/src/extractor/concatClassName.ts +21 -24
- package/src/extractor/getTamaguiConfigPathFromOptionsConfig.ts +13 -5
- 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 +9 -0
- package/src/zero/islands.ts +265 -0
- package/src/zero/options.ts +239 -0
- package/src/zero/ownership.ts +113 -0
- package/src/zero/theme.ts +526 -0
- package/src/zero/transform.ts +329 -0
- package/types/check-dep-versions.d.ts.map +1 -1
- package/types/checkDeps.d.ts.map +1 -1
- package/types/compiler.d.ts +134 -0
- package/types/compiler.d.ts.map +1 -0
- package/types/compilerHost.d.ts +38 -0
- package/types/compilerHost.d.ts.map +1 -0
- package/types/componentDiscovery.d.ts +27 -0
- package/types/componentDiscovery.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 +5 -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 +26 -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 +10 -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 +85 -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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/static",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-beta.1093.1",
|
|
4
4
|
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -9,87 +9,78 @@
|
|
|
9
9
|
"types",
|
|
10
10
|
"dist"
|
|
11
11
|
],
|
|
12
|
-
"type": "
|
|
13
|
-
"main": "dist",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"main": "dist/cjs/index.cjs",
|
|
14
|
+
"module": "dist/esm/index.mjs",
|
|
14
15
|
"types": "./types/index.d.ts",
|
|
15
16
|
"exports": {
|
|
16
17
|
"./package.json": "./package.json",
|
|
17
18
|
".": {
|
|
18
19
|
"types": "./types/index.d.ts",
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
"default": "./dist/worker.cjs"
|
|
20
|
+
"module": "./dist/esm/index.mjs",
|
|
21
|
+
"import": "./dist/esm/index.mjs",
|
|
22
|
+
"require": "./dist/cjs/index.cjs",
|
|
23
|
+
"default": "./dist/esm/index.mjs"
|
|
24
24
|
},
|
|
25
25
|
"./checkDeps": {
|
|
26
26
|
"types": "./types/checkDeps.d.ts",
|
|
27
|
-
"
|
|
27
|
+
"import": "./dist/esm/checkDeps.mjs",
|
|
28
|
+
"require": "./dist/cjs/checkDeps.cjs",
|
|
29
|
+
"default": "./dist/esm/checkDeps.mjs"
|
|
28
30
|
},
|
|
29
31
|
"./loadTamagui": {
|
|
30
32
|
"types": "./types/extractor/loadTamagui.d.ts",
|
|
31
|
-
"
|
|
33
|
+
"import": "./dist/esm/extractor/loadTamagui.mjs",
|
|
34
|
+
"require": "./dist/cjs/extractor/loadTamagui.cjs",
|
|
35
|
+
"default": "./dist/esm/extractor/loadTamagui.mjs"
|
|
32
36
|
}
|
|
33
37
|
},
|
|
34
38
|
"publishConfig": {
|
|
35
39
|
"access": "public"
|
|
36
40
|
},
|
|
37
41
|
"scripts": {
|
|
38
|
-
"build": "tamagui-build --skip-native",
|
|
39
|
-
"watch": "tamagui-build --skip-native --watch",
|
|
42
|
+
"build": "tamagui-build --skip-native --keep-env-target",
|
|
43
|
+
"watch": "tamagui-build --skip-native --keep-env-target --watch",
|
|
40
44
|
"clean": "tamagui-build clean",
|
|
41
45
|
"clean:build": "tamagui-build clean:build"
|
|
42
46
|
},
|
|
43
47
|
"dependencies": {
|
|
44
|
-
"@
|
|
45
|
-
"@
|
|
46
|
-
"@
|
|
47
|
-
"@
|
|
48
|
-
"@
|
|
49
|
-
"@
|
|
50
|
-
"@
|
|
51
|
-
"@
|
|
52
|
-
"@
|
|
53
|
-
"@tamagui/
|
|
54
|
-
"@tamagui/
|
|
55
|
-
"@tamagui/
|
|
56
|
-
"@tamagui/
|
|
57
|
-
"@tamagui/
|
|
58
|
-
"@tamagui/
|
|
59
|
-
"@tamagui/
|
|
60
|
-
"@tamagui/proxy-worm": "2.7.7",
|
|
61
|
-
"@tamagui/react-native-web-internals": "2.7.7",
|
|
62
|
-
"@tamagui/react-native-web-lite": "2.7.7",
|
|
63
|
-
"@tamagui/shorthands": "2.7.7",
|
|
64
|
-
"@tamagui/types": "2.7.7",
|
|
65
|
-
"@tamagui/web": "2.7.7",
|
|
66
|
-
"babel-literal-to-ast": "^2.1.0",
|
|
48
|
+
"@tamagui/animation-helpers": "3.0.0-beta.1093.1",
|
|
49
|
+
"@tamagui/cli-color": "3.0.0-beta.1093.1",
|
|
50
|
+
"@tamagui/compiler-core": "3.0.0-beta.1093.1",
|
|
51
|
+
"@tamagui/config-default": "3.0.0-beta.1093.1",
|
|
52
|
+
"@tamagui/core": "3.0.0-beta.1093.1",
|
|
53
|
+
"@tamagui/dom": "3.0.0-beta.1093.1",
|
|
54
|
+
"@tamagui/fake-react-native": "3.0.0-beta.1093.1",
|
|
55
|
+
"@tamagui/generate-themes": "3.0.0-beta.1093.1",
|
|
56
|
+
"@tamagui/helpers": "3.0.0-beta.1093.1",
|
|
57
|
+
"@tamagui/helpers-node": "3.0.0-beta.1093.1",
|
|
58
|
+
"@tamagui/react-native-web-internals": "3.0.0-beta.1093.1",
|
|
59
|
+
"@tamagui/react-native-web-lite": "3.0.0-beta.1093.1",
|
|
60
|
+
"@tamagui/shorthands": "3.0.0-beta.1093.1",
|
|
61
|
+
"@tamagui/style-grammar": "3.0.0-beta.1093.1",
|
|
62
|
+
"@tamagui/types": "3.0.0-beta.1093.1",
|
|
63
|
+
"@tamagui/web": "3.0.0-beta.1093.1",
|
|
67
64
|
"browserslist": "^4.28.1",
|
|
68
65
|
"check-dependency-version-consistency": "^4.1.0",
|
|
69
|
-
"esbuild": "
|
|
66
|
+
"esbuild": "0.28.1",
|
|
70
67
|
"esbuild-register": "^3.6.0",
|
|
71
|
-
"esbuild-wasm": "^0.27.2",
|
|
72
68
|
"fast-glob": "^3.2.11",
|
|
73
|
-
"find-cache-dir": "^3.3.2",
|
|
74
69
|
"find-root": "^1.1.0",
|
|
75
70
|
"fs-extra": "^11.2.0",
|
|
76
|
-
"invariant": "^2.2.4",
|
|
77
71
|
"js-yaml": "^4.1.0",
|
|
78
|
-
"react-native-web": "
|
|
72
|
+
"react-native-web": "~0.21.0"
|
|
79
73
|
},
|
|
80
74
|
"devDependencies": {
|
|
81
|
-
"@
|
|
82
|
-
"@tamagui/build": "2.7.7",
|
|
83
|
-
"@types/babel__core": "^7.20.5",
|
|
75
|
+
"@tamagui/build": "3.0.0-beta.1093.1",
|
|
84
76
|
"@types/find-root": "^1.1.2",
|
|
85
77
|
"@types/node": "^22.1.0",
|
|
86
78
|
"@types/webpack": "^4.41.26",
|
|
87
|
-
"babel-loader": "^9.1.3",
|
|
88
79
|
"esbuild-loader": "^4.2.2",
|
|
89
80
|
"null-loader": "^4.0.1",
|
|
90
|
-
"react": "
|
|
91
|
-
"react-native": "0.
|
|
92
|
-
"typescript": "~
|
|
81
|
+
"react": "19.2.3",
|
|
82
|
+
"react-native": "0.86.2",
|
|
83
|
+
"typescript": "~6.0.3"
|
|
93
84
|
},
|
|
94
85
|
"peerDependencies": {
|
|
95
86
|
"react": ">=19"
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"author": "Bryan Mishkin",
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import FastGlob from 'fast-glob'
|
|
7
7
|
import { load } from 'js-yaml'
|
|
8
8
|
import { existsSync, readFileSync } from 'node:fs'
|
|
9
9
|
import { join, relative } from 'node:path'
|
|
@@ -399,7 +399,7 @@ function expandWorkspaces(
|
|
|
399
399
|
}
|
|
400
400
|
// Use cwd instead of passing join()'d paths to globby for Windows support: https://github.com/micromatch/micromatch/blob/34f44b4f57eacbdbcc74f64252e0845cf44bbdbd/README.md?plain=1#L822
|
|
401
401
|
// Ignore any node_modules that may be present due to the use of nohoist.
|
|
402
|
-
return globSync(workspace, {
|
|
402
|
+
return FastGlob.globSync(workspace, {
|
|
403
403
|
onlyDirectories: true,
|
|
404
404
|
cwd: root,
|
|
405
405
|
ignore: ['**/node_modules'],
|
package/src/checkDeps.ts
CHANGED
|
@@ -359,7 +359,7 @@ export async function checkDeps(root: string) {
|
|
|
359
359
|
|
|
360
360
|
if (issues.length === 0) {
|
|
361
361
|
console.info(`Tamagui dependencies look good ✅`)
|
|
362
|
-
|
|
362
|
+
return
|
|
363
363
|
}
|
|
364
364
|
|
|
365
365
|
for (let i = 0; i < issues.length; i++) {
|
|
@@ -367,5 +367,6 @@ export async function checkDeps(root: string) {
|
|
|
367
367
|
console.error(issues[i])
|
|
368
368
|
}
|
|
369
369
|
|
|
370
|
-
|
|
370
|
+
// the caller owns the exit; `tamagui check` still has the style half to run
|
|
371
|
+
process.exitCode = 1
|
|
371
372
|
}
|
package/src/compiler.ts
ADDED
|
@@ -0,0 +1,506 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CompilerSession,
|
|
3
|
+
LOWERED_MODULE_PLAN_VERSION,
|
|
4
|
+
ModulePlanCache,
|
|
5
|
+
PLAN_CACHE_SCHEMA_VERSION,
|
|
6
|
+
contentHash,
|
|
7
|
+
defaultPlanCacheRoot,
|
|
8
|
+
resolvedModuleId,
|
|
9
|
+
stableStringify,
|
|
10
|
+
yukuFactory,
|
|
11
|
+
type AppliedLoweredModule,
|
|
12
|
+
type CompilerTarget,
|
|
13
|
+
type HostModuleInput,
|
|
14
|
+
type LoweredModulePlan,
|
|
15
|
+
type ResolvedModuleId,
|
|
16
|
+
} from '@tamagui/compiler-core'
|
|
17
|
+
import type { TamaguiOptions } from '@tamagui/types'
|
|
18
|
+
import { readFileSync } from 'node:fs'
|
|
19
|
+
import { createRequire } from 'node:module'
|
|
20
|
+
import path from 'node:path'
|
|
21
|
+
|
|
22
|
+
import { ComponentDiscovery, type ComponentModuleEvaluator } from './componentDiscovery'
|
|
23
|
+
import { createComponentRegistry, createTamaguiCompilerHost } from './compilerHost'
|
|
24
|
+
import { domStructuralPass } from './domStructuralPass'
|
|
25
|
+
import type { TamaguiProjectInfo } from './extractor/bundleConfig'
|
|
26
|
+
import { loadTamagui } from './extractor/loadTamagui'
|
|
27
|
+
import { resolveZeroRuntimeSync } from './zero/options'
|
|
28
|
+
|
|
29
|
+
export interface CompilerProjectComponentModule {
|
|
30
|
+
moduleName: string
|
|
31
|
+
id: string
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface CompilerProject {
|
|
35
|
+
projectInfo: TamaguiProjectInfo
|
|
36
|
+
componentModules: CompilerProjectComponentModule[]
|
|
37
|
+
generation: string
|
|
38
|
+
/** Keep elements with dynamic style props fully on the runtime path. */
|
|
39
|
+
disablePartialExtraction?: boolean
|
|
40
|
+
/** emit native theme-token mappings for the native style engine */
|
|
41
|
+
experimentalNativeFastPath?: boolean
|
|
42
|
+
/** Zero-runtime mode, which makes the host's diagnostics mode-aware. */
|
|
43
|
+
zeroRuntime?: boolean
|
|
44
|
+
/**
|
|
45
|
+
* Content identity of everything a lowering plan depends on that is not a
|
|
46
|
+
* module: the compiler build, the evaluated config and component registry,
|
|
47
|
+
* the platform, and the modes. Null when the project could not name the files
|
|
48
|
+
* that determine it, in which case nothing is cached to disk.
|
|
49
|
+
*/
|
|
50
|
+
cacheStamp: string | null
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface LoadCompilerProjectInput {
|
|
54
|
+
root: string
|
|
55
|
+
target: CompilerTarget
|
|
56
|
+
options: Partial<TamaguiOptions>
|
|
57
|
+
generation:
|
|
58
|
+
| string
|
|
59
|
+
| ((
|
|
60
|
+
projectInfo: TamaguiProjectInfo,
|
|
61
|
+
componentModules: CompilerProjectComponentModule[],
|
|
62
|
+
options: TamaguiOptions
|
|
63
|
+
) => string)
|
|
64
|
+
rebuild?: boolean
|
|
65
|
+
/**
|
|
66
|
+
* `name@version` for the host integration package, folded into the cache
|
|
67
|
+
* stamp so a plugin upgrade cannot reuse plans built by the previous one.
|
|
68
|
+
*/
|
|
69
|
+
hostVersions?: readonly string[]
|
|
70
|
+
missingProjectMessage?: string
|
|
71
|
+
load?: (options: TamaguiOptions, rebuild: boolean) => Promise<TamaguiProjectInfo | null>
|
|
72
|
+
resolveComponents?: (
|
|
73
|
+
moduleNames: readonly string[],
|
|
74
|
+
projectInfo: TamaguiProjectInfo,
|
|
75
|
+
options: TamaguiOptions
|
|
76
|
+
) => Promise<CompilerProjectComponentModule[]>
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* normalize and load the compiler-owned project contract. module resolution and
|
|
81
|
+
* evaluation stay with the adapter through the two callbacks.
|
|
82
|
+
*/
|
|
83
|
+
export async function loadCompilerProject({
|
|
84
|
+
root,
|
|
85
|
+
target,
|
|
86
|
+
options: optionsIn,
|
|
87
|
+
generation,
|
|
88
|
+
rebuild = false,
|
|
89
|
+
hostVersions = [],
|
|
90
|
+
missingProjectMessage = 'Unable to load the Tamagui compiler project',
|
|
91
|
+
load = loadTamagui,
|
|
92
|
+
resolveComponents,
|
|
93
|
+
}: LoadCompilerProjectInput): Promise<CompilerProject> {
|
|
94
|
+
const components = [
|
|
95
|
+
...new Set(['@tamagui/core', ...(optionsIn.components || ['tamagui'])]),
|
|
96
|
+
]
|
|
97
|
+
const options = {
|
|
98
|
+
...optionsIn,
|
|
99
|
+
root,
|
|
100
|
+
platform: target,
|
|
101
|
+
components,
|
|
102
|
+
} as TamaguiOptions
|
|
103
|
+
const zeroRuntime = resolveZeroRuntimeSync(options, root).mode
|
|
104
|
+
if (zeroRuntime === 'enforce') options.outputCSS = undefined
|
|
105
|
+
|
|
106
|
+
const projectInfo = await load(options, rebuild)
|
|
107
|
+
if (!projectInfo?.tamaguiConfig || !projectInfo.components) {
|
|
108
|
+
throw new Error(missingProjectMessage)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const componentModules = resolveComponents
|
|
112
|
+
? await resolveComponents(components, projectInfo, options)
|
|
113
|
+
: []
|
|
114
|
+
|
|
115
|
+
const disablePartialExtraction = !!options.disablePartialExtraction
|
|
116
|
+
const experimentalNativeFastPath =
|
|
117
|
+
target === 'native' && options.experimental?.nativeFastPath === true
|
|
118
|
+
|
|
119
|
+
return {
|
|
120
|
+
projectInfo,
|
|
121
|
+
componentModules,
|
|
122
|
+
generation:
|
|
123
|
+
typeof generation === 'function'
|
|
124
|
+
? generation(projectInfo, componentModules, options)
|
|
125
|
+
: generation,
|
|
126
|
+
disablePartialExtraction,
|
|
127
|
+
experimentalNativeFastPath,
|
|
128
|
+
zeroRuntime: zeroRuntime !== 'off',
|
|
129
|
+
cacheStamp: compilerProjectStamp({
|
|
130
|
+
stampSources: projectInfo.stampSources ?? [],
|
|
131
|
+
hostVersions,
|
|
132
|
+
target,
|
|
133
|
+
componentModules,
|
|
134
|
+
disablePartialExtraction,
|
|
135
|
+
experimentalNativeFastPath,
|
|
136
|
+
zeroRuntime: zeroRuntime !== 'off',
|
|
137
|
+
development: process.env.NODE_ENV === 'development',
|
|
138
|
+
}),
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const requireFromCompiler = createRequire(
|
|
143
|
+
typeof __filename === 'string' ? __filename : import.meta.url
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
// upgrading the compiler must invalidate cached plans even when nothing about
|
|
147
|
+
// the project changed
|
|
148
|
+
const compilerPackageVersions = ['@tamagui/compiler-core', '@tamagui/static'].map(
|
|
149
|
+
(name) =>
|
|
150
|
+
`${name}@${(requireFromCompiler(`${name}/package.json`) as { version: string }).version}`
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* The non-module half of every plan cache key. Null when the project named no
|
|
155
|
+
* stamp sources: a stamp that cannot see a config change is worse than no
|
|
156
|
+
* cache, so that project simply does not cache.
|
|
157
|
+
*/
|
|
158
|
+
export function compilerProjectStamp(input: {
|
|
159
|
+
stampSources: readonly string[]
|
|
160
|
+
hostVersions: readonly string[]
|
|
161
|
+
target: CompilerTarget
|
|
162
|
+
componentModules: readonly CompilerProjectComponentModule[]
|
|
163
|
+
disablePartialExtraction: boolean
|
|
164
|
+
experimentalNativeFastPath: boolean
|
|
165
|
+
zeroRuntime: boolean
|
|
166
|
+
/**
|
|
167
|
+
* `process.env.NODE_ENV === 'development'` in the process that builds plans.
|
|
168
|
+
* The host emits debug-receipt edits into `plan.edits` only in development
|
|
169
|
+
* (compilerHost.ts's developmentDebugInstrumentation), so a development plan
|
|
170
|
+
* is not a plan a production build may reuse. This is the ONLY ambient input
|
|
171
|
+
* to a plan, and it lives in the stamp so every host inherits it rather than
|
|
172
|
+
* each one remembering to add it to its own key.
|
|
173
|
+
*/
|
|
174
|
+
development: boolean
|
|
175
|
+
}): string | null {
|
|
176
|
+
if (!input.stampSources.length) return null
|
|
177
|
+
const sources: [string, string][] = []
|
|
178
|
+
for (const file of [...new Set(input.stampSources)].sort()) {
|
|
179
|
+
try {
|
|
180
|
+
sources.push([file, contentHash(readFileSync(file))])
|
|
181
|
+
} catch {
|
|
182
|
+
// a source the project named but that is not readable makes the stamp
|
|
183
|
+
// incomplete, and an incomplete stamp is what ships stale styles
|
|
184
|
+
return null
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return contentHash(
|
|
188
|
+
stableStringify({
|
|
189
|
+
schema: PLAN_CACHE_SCHEMA_VERSION,
|
|
190
|
+
plan: LOWERED_MODULE_PLAN_VERSION,
|
|
191
|
+
packages: [...compilerPackageVersions, ...input.hostVersions].sort(),
|
|
192
|
+
target: input.target,
|
|
193
|
+
development: input.development,
|
|
194
|
+
componentModules: input.componentModules.map(({ moduleName, id }) => [
|
|
195
|
+
moduleName,
|
|
196
|
+
cleanId(id),
|
|
197
|
+
]),
|
|
198
|
+
disablePartialExtraction: input.disablePartialExtraction,
|
|
199
|
+
experimentalNativeFastPath: input.experimentalNativeFastPath,
|
|
200
|
+
zeroRuntime: input.zeroRuntime,
|
|
201
|
+
sources,
|
|
202
|
+
})
|
|
203
|
+
)
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export interface CompilerResolution {
|
|
207
|
+
id: string
|
|
208
|
+
external?: boolean
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export interface CompilerInput {
|
|
212
|
+
id: string
|
|
213
|
+
source: string
|
|
214
|
+
root: string
|
|
215
|
+
target: CompilerTarget
|
|
216
|
+
/** Host environment whose resolver produced this module graph. */
|
|
217
|
+
environment?: string
|
|
218
|
+
project: CompilerProject
|
|
219
|
+
resolve(specifier: string, importer: string): Promise<CompilerResolution | null>
|
|
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
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export type CompilerUpdateInput = CompilerInput
|
|
233
|
+
|
|
234
|
+
export interface CompilerResult {
|
|
235
|
+
plan: LoweredModulePlan
|
|
236
|
+
output: AppliedLoweredModule
|
|
237
|
+
invalidatedIds: ResolvedModuleId[]
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function cleanId(id: string): string {
|
|
241
|
+
return id.split(/[?#]/, 1)[0]
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function externalId(specifier: string): ResolvedModuleId {
|
|
245
|
+
return resolvedModuleId(`external://${encodeURIComponent(specifier)}`)
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function compilerContext(input: CompilerInput): string {
|
|
249
|
+
return `${input.root}\0${input.target}\0${input.environment ?? ''}\0${input.project.generation}`
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
function sourceCanBeLinked(root: string, id: string): boolean {
|
|
253
|
+
const clean = cleanId(id)
|
|
254
|
+
const normalized = clean.replace(/\\/g, '/')
|
|
255
|
+
if (!path.isAbsolute(clean) || normalized.includes('/node_modules/')) return false
|
|
256
|
+
const relative = path.relative(root, clean)
|
|
257
|
+
return relative === '' || (relative !== '..' && !relative.startsWith(`..${path.sep}`))
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Long-lived host-resolved graph frontend. The adapter supplies every identity and
|
|
262
|
+
* load result; compiler-core never guesses package, alias, or workspace resolution.
|
|
263
|
+
*/
|
|
264
|
+
export class CompilerFrontend {
|
|
265
|
+
private readonly session = new CompilerSession()
|
|
266
|
+
private queue: Promise<unknown> = Promise.resolve()
|
|
267
|
+
private readonly planCaches = new Map<string, ModulePlanCache>()
|
|
268
|
+
private readonly moduleRecords = new Map<ResolvedModuleId, HostModuleInput>()
|
|
269
|
+
private moduleContext: string | null = null
|
|
270
|
+
private readonly discovery = new ComponentDiscovery()
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* One cache per project root and platform. Absent when the project produced
|
|
274
|
+
* no content stamp, in which case plans are never persisted rather than
|
|
275
|
+
* persisted under an identity that cannot see a config change.
|
|
276
|
+
*/
|
|
277
|
+
private planCacheFor(
|
|
278
|
+
input: CompilerInput
|
|
279
|
+
): { store: ModulePlanCache; stamp: string } | undefined {
|
|
280
|
+
const stamp = input.project.cacheStamp
|
|
281
|
+
if (!stamp) return undefined
|
|
282
|
+
const root = defaultPlanCacheRoot(input.root, input.target)
|
|
283
|
+
let store = this.planCaches.get(root)
|
|
284
|
+
if (!store) {
|
|
285
|
+
store = new ModulePlanCache(root)
|
|
286
|
+
this.planCaches.set(root, store)
|
|
287
|
+
}
|
|
288
|
+
return { store, stamp }
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/** Hits, misses and writes across every plan cache this frontend has used. */
|
|
292
|
+
get planCacheStats(): { hits: number; misses: number; writes: number } {
|
|
293
|
+
const total = { hits: 0, misses: 0, writes: 0 }
|
|
294
|
+
for (const store of this.planCaches.values()) {
|
|
295
|
+
total.hits += store.stats.hits
|
|
296
|
+
total.misses += store.stats.misses
|
|
297
|
+
total.writes += store.stats.writes
|
|
298
|
+
}
|
|
299
|
+
return total
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
compile(input: CompilerInput): Promise<CompilerResult> {
|
|
303
|
+
// compiling must not leak process-global state: internal stages set
|
|
304
|
+
// TAMAGUI_TARGET / IS_STATIC while evaluating modules for a platform, and
|
|
305
|
+
// an embedder (or a test that renders at runtime after compiling) must see
|
|
306
|
+
// its own environment unchanged afterward
|
|
307
|
+
const operation = this.queue.then(async () => {
|
|
308
|
+
const previousTarget = process.env.TAMAGUI_TARGET
|
|
309
|
+
const previousStatic = process.env.IS_STATIC
|
|
310
|
+
try {
|
|
311
|
+
return await this.compileNow(input)
|
|
312
|
+
} finally {
|
|
313
|
+
if (previousTarget === undefined) delete process.env.TAMAGUI_TARGET
|
|
314
|
+
else process.env.TAMAGUI_TARGET = previousTarget
|
|
315
|
+
if (previousStatic === undefined) delete process.env.IS_STATIC
|
|
316
|
+
else process.env.IS_STATIC = previousStatic
|
|
317
|
+
}
|
|
318
|
+
})
|
|
319
|
+
this.queue = operation.catch(() => undefined)
|
|
320
|
+
return operation
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
update(input: CompilerUpdateInput): Promise<ResolvedModuleId[]> {
|
|
324
|
+
const operation = this.queue.then(async () => {
|
|
325
|
+
const { modules } = await this.buildTree(input)
|
|
326
|
+
const invalidated = new Set<ResolvedModuleId>()
|
|
327
|
+
for (const module of modules.values()) {
|
|
328
|
+
for (const id of await this.session.update(module)) invalidated.add(id)
|
|
329
|
+
this.moduleRecords.set(module.id, module)
|
|
330
|
+
}
|
|
331
|
+
return [...invalidated].sort()
|
|
332
|
+
})
|
|
333
|
+
this.queue = operation.catch(() => undefined)
|
|
334
|
+
return operation
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
has(id: string): boolean {
|
|
338
|
+
return this.session.has(resolvedModuleId(cleanId(id)))
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
dependentsOf(id: string): ResolvedModuleId[] {
|
|
342
|
+
return this.session.dependentsOf(resolvedModuleId(cleanId(id)))
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
remove(id: string) {
|
|
346
|
+
const operation = this.queue.then(async () => {
|
|
347
|
+
const result = await this.session.remove(resolvedModuleId(cleanId(id)))
|
|
348
|
+
for (const invalidatedId of result.invalidatedIds) {
|
|
349
|
+
this.moduleRecords.delete(invalidatedId)
|
|
350
|
+
}
|
|
351
|
+
return result
|
|
352
|
+
})
|
|
353
|
+
this.queue = operation.catch(() => undefined)
|
|
354
|
+
return operation
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
parseCount(id: string): number {
|
|
358
|
+
return this.session.parseCount(resolvedModuleId(cleanId(id)))
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
private async compileNow(input: CompilerInput): Promise<CompilerResult> {
|
|
362
|
+
const { rootModule, modules } = await this.buildTree(input)
|
|
363
|
+
const invalidated = new Set<ResolvedModuleId>()
|
|
364
|
+
for (const module of modules.values()) {
|
|
365
|
+
for (const id of await this.session.update(module)) invalidated.add(id)
|
|
366
|
+
this.moduleRecords.set(module.id, module)
|
|
367
|
+
}
|
|
368
|
+
const projectInfo = input.project.projectInfo
|
|
369
|
+
if (!projectInfo.tamaguiConfig || !projectInfo.components) {
|
|
370
|
+
throw new Error('The compiler requires evaluated Tamagui config and components')
|
|
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)
|
|
378
|
+
const host = createTamaguiCompilerHost({
|
|
379
|
+
target: input.target,
|
|
380
|
+
tamaguiConfig: projectInfo.tamaguiConfig,
|
|
381
|
+
components: projectInfo.components,
|
|
382
|
+
componentModules,
|
|
383
|
+
registry,
|
|
384
|
+
disablePartialExtraction: input.project.disablePartialExtraction,
|
|
385
|
+
experimentalNativeFastPath: input.project.experimentalNativeFastPath,
|
|
386
|
+
zeroRuntime: input.project.zeroRuntime,
|
|
387
|
+
})
|
|
388
|
+
const result = await this.session.compile({
|
|
389
|
+
module: rootModule,
|
|
390
|
+
adapter: {
|
|
391
|
+
target: input.target,
|
|
392
|
+
projectGeneration: input.project.generation,
|
|
393
|
+
host,
|
|
394
|
+
planCache: this.planCacheFor(input),
|
|
395
|
+
async load(id) {
|
|
396
|
+
return modules.get(id) ?? null
|
|
397
|
+
},
|
|
398
|
+
prepare: (module) => this.discovery.prepare(module, registry, input.evaluate),
|
|
399
|
+
},
|
|
400
|
+
structuralPass: domStructuralPass,
|
|
401
|
+
})
|
|
402
|
+
for (const id of result.invalidatedIds) invalidated.add(id)
|
|
403
|
+
return {
|
|
404
|
+
plan: result.plan,
|
|
405
|
+
output: result.output,
|
|
406
|
+
invalidatedIds: [...invalidated].sort(),
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/** host-resolved ids of every module discovery found components in */
|
|
411
|
+
discoveredModuleIds(): string[] {
|
|
412
|
+
return this.discovery.ids()
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
private async buildTree(input: CompilerUpdateInput): Promise<{
|
|
416
|
+
rootModule: HostModuleInput
|
|
417
|
+
modules: Map<ResolvedModuleId, HostModuleInput>
|
|
418
|
+
}> {
|
|
419
|
+
const moduleContext = compilerContext(input)
|
|
420
|
+
if (this.moduleContext !== moduleContext) {
|
|
421
|
+
this.moduleRecords.clear()
|
|
422
|
+
this.discovery.clear()
|
|
423
|
+
this.moduleContext = moduleContext
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
const componentBySpecifier = new Map(
|
|
427
|
+
input.project.componentModules.map((component) => [
|
|
428
|
+
component.moduleName,
|
|
429
|
+
resolvedModuleId(cleanId(component.id)),
|
|
430
|
+
])
|
|
431
|
+
)
|
|
432
|
+
const modules = new Map<ResolvedModuleId, HostModuleInput>()
|
|
433
|
+
const loading = new Set<ResolvedModuleId>()
|
|
434
|
+
|
|
435
|
+
const addInstalledClosure = (module: HostModuleInput): void => {
|
|
436
|
+
if (modules.has(module.id) || loading.has(module.id)) return
|
|
437
|
+
loading.add(module.id)
|
|
438
|
+
for (const dependency of module.imports) {
|
|
439
|
+
if (dependency.external) continue
|
|
440
|
+
const installedDependency = this.moduleRecords.get(dependency.resolvedId)
|
|
441
|
+
if (installedDependency && this.session.has(dependency.resolvedId)) {
|
|
442
|
+
addInstalledClosure(installedDependency)
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
modules.set(module.id, module)
|
|
446
|
+
loading.delete(module.id)
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
const loadModule = async (
|
|
450
|
+
rawId: string,
|
|
451
|
+
source: string
|
|
452
|
+
): Promise<HostModuleInput> => {
|
|
453
|
+
const id = resolvedModuleId(cleanId(rawId))
|
|
454
|
+
const existing = modules.get(id)
|
|
455
|
+
if (existing) return existing
|
|
456
|
+
const installed = this.moduleRecords.get(id)
|
|
457
|
+
if (installed?.source === source && this.session.has(id)) {
|
|
458
|
+
addInstalledClosure(installed)
|
|
459
|
+
return installed
|
|
460
|
+
}
|
|
461
|
+
if (loading.has(id)) {
|
|
462
|
+
return { id, source, imports: [] }
|
|
463
|
+
}
|
|
464
|
+
loading.add(id)
|
|
465
|
+
|
|
466
|
+
const imports: HostModuleInput['imports'][number][] = []
|
|
467
|
+
for (const specifier of yukuFactory.scanImports(id, source)) {
|
|
468
|
+
const configuredComponent = componentBySpecifier.get(specifier)
|
|
469
|
+
if (configuredComponent) {
|
|
470
|
+
imports.push({ specifier, resolvedId: configuredComponent, external: true })
|
|
471
|
+
continue
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
const resolution = await input.resolve(specifier, id)
|
|
475
|
+
if (!resolution) continue
|
|
476
|
+
const canLink =
|
|
477
|
+
!resolution.external && sourceCanBeLinked(input.root, resolution.id)
|
|
478
|
+
const resolvedId = canLink
|
|
479
|
+
? resolvedModuleId(cleanId(resolution.id))
|
|
480
|
+
: path.isAbsolute(cleanId(resolution.id))
|
|
481
|
+
? resolvedModuleId(cleanId(resolution.id))
|
|
482
|
+
: externalId(specifier)
|
|
483
|
+
imports.push({ specifier, resolvedId, external: !canLink })
|
|
484
|
+
if (canLink && !modules.has(resolvedId) && !loading.has(resolvedId)) {
|
|
485
|
+
const installedDependency = this.moduleRecords.get(resolvedId)
|
|
486
|
+
if (installedDependency && this.session.has(resolvedId)) {
|
|
487
|
+
addInstalledClosure(installedDependency)
|
|
488
|
+
} else {
|
|
489
|
+
const dependencySource = await input.load(resolution.id)
|
|
490
|
+
if (dependencySource !== null) {
|
|
491
|
+
await loadModule(resolution.id, dependencySource)
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
const module = { id, source, imports }
|
|
498
|
+
modules.set(id, module)
|
|
499
|
+
loading.delete(id)
|
|
500
|
+
return module
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
const rootModule = await loadModule(input.id, input.source)
|
|
504
|
+
return { rootModule, modules }
|
|
505
|
+
}
|
|
506
|
+
}
|