zyzz 0.0.0 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +380 -0
- package/dist/Config.d.ts +170 -0
- package/dist/Config.d.ts.map +1 -0
- package/dist/Config.js +249 -0
- package/dist/Config.js.map +1 -0
- package/dist/Props.d.ts +7 -0
- package/dist/Props.d.ts.map +1 -0
- package/dist/Props.js +3 -0
- package/dist/Props.js.map +1 -0
- package/dist/Style.d.ts +167 -0
- package/dist/Style.d.ts.map +1 -0
- package/dist/Style.js +284 -0
- package/dist/Style.js.map +1 -0
- package/dist/Theme.d.ts +154 -0
- package/dist/Theme.d.ts.map +1 -0
- package/dist/Theme.js +257 -0
- package/dist/Theme.js.map +1 -0
- package/dist/babel/NativeEdits.d.ts +8 -0
- package/dist/babel/NativeEdits.d.ts.map +1 -0
- package/dist/babel/NativeEdits.js +233 -0
- package/dist/babel/NativeEdits.js.map +1 -0
- package/dist/babel/NativeJsx.d.ts +10 -0
- package/dist/babel/NativeJsx.d.ts.map +1 -0
- package/dist/babel/NativeJsx.js +204 -0
- package/dist/babel/NativeJsx.js.map +1 -0
- package/dist/babel/index.d.ts +51 -0
- package/dist/babel/index.d.ts.map +1 -0
- package/dist/babel/index.js +220 -0
- package/dist/babel/index.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +178 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/compiler/Graph.d.ts +64 -0
- package/dist/compiler/Graph.d.ts.map +1 -0
- package/dist/compiler/Graph.js +1111 -0
- package/dist/compiler/Graph.js.map +1 -0
- package/dist/compiler/Native.d.ts +53 -0
- package/dist/compiler/Native.d.ts.map +1 -0
- package/dist/compiler/Native.js +617 -0
- package/dist/compiler/Native.js.map +1 -0
- package/dist/compiler/Source.d.ts +165 -0
- package/dist/compiler/Source.d.ts.map +1 -0
- package/dist/compiler/Source.js +990 -0
- package/dist/compiler/Source.js.map +1 -0
- package/dist/compiler/Transform.d.ts +57 -0
- package/dist/compiler/Transform.d.ts.map +1 -0
- package/dist/compiler/Transform.js +884 -0
- package/dist/compiler/Transform.js.map +1 -0
- package/dist/compiler/index.d.ts +13 -0
- package/dist/compiler/index.d.ts.map +1 -0
- package/dist/compiler/index.js +13 -0
- package/dist/compiler/index.js.map +1 -0
- package/dist/compiler/internal/Applications.d.ts +35 -0
- package/dist/compiler/internal/Applications.d.ts.map +1 -0
- package/dist/compiler/internal/Applications.js +248 -0
- package/dist/compiler/internal/Applications.js.map +1 -0
- package/dist/compiler/internal/AtRules.d.ts +8 -0
- package/dist/compiler/internal/AtRules.d.ts.map +1 -0
- package/dist/compiler/internal/AtRules.js +180 -0
- package/dist/compiler/internal/AtRules.js.map +1 -0
- package/dist/compiler/internal/Catalogs.d.ts +19 -0
- package/dist/compiler/internal/Catalogs.d.ts.map +1 -0
- package/dist/compiler/internal/Catalogs.js +68 -0
- package/dist/compiler/internal/Catalogs.js.map +1 -0
- package/dist/compiler/internal/ColorProfiles.d.ts +3 -0
- package/dist/compiler/internal/ColorProfiles.d.ts.map +1 -0
- package/dist/compiler/internal/ColorProfiles.js +84 -0
- package/dist/compiler/internal/ColorProfiles.js.map +1 -0
- package/dist/compiler/internal/CompositionBindings.d.ts +16 -0
- package/dist/compiler/internal/CompositionBindings.d.ts.map +1 -0
- package/dist/compiler/internal/CompositionBindings.js +89 -0
- package/dist/compiler/internal/CompositionBindings.js.map +1 -0
- package/dist/compiler/internal/Compositions.d.ts +32 -0
- package/dist/compiler/internal/Compositions.d.ts.map +1 -0
- package/dist/compiler/internal/Compositions.js +464 -0
- package/dist/compiler/internal/Compositions.js.map +1 -0
- package/dist/compiler/internal/Configurations.d.ts +21 -0
- package/dist/compiler/internal/Configurations.d.ts.map +1 -0
- package/dist/compiler/internal/Configurations.js +171 -0
- package/dist/compiler/internal/Configurations.js.map +1 -0
- package/dist/compiler/internal/Contract.d.ts +27 -0
- package/dist/compiler/internal/Contract.d.ts.map +1 -0
- package/dist/compiler/internal/Contract.js +600 -0
- package/dist/compiler/internal/Contract.js.map +1 -0
- package/dist/compiler/internal/Contributions.d.ts +54 -0
- package/dist/compiler/internal/Contributions.d.ts.map +1 -0
- package/dist/compiler/internal/Contributions.js +1109 -0
- package/dist/compiler/internal/Contributions.js.map +1 -0
- package/dist/compiler/internal/Descriptors.d.ts +15 -0
- package/dist/compiler/internal/Descriptors.d.ts.map +1 -0
- package/dist/compiler/internal/Descriptors.js +183 -0
- package/dist/compiler/internal/Descriptors.js.map +1 -0
- package/dist/compiler/internal/Dynamic.d.ts +14 -0
- package/dist/compiler/internal/Dynamic.d.ts.map +1 -0
- package/dist/compiler/internal/Dynamic.js +172 -0
- package/dist/compiler/internal/Dynamic.js.map +1 -0
- package/dist/compiler/internal/Edits.d.ts +12 -0
- package/dist/compiler/internal/Edits.d.ts.map +1 -0
- package/dist/compiler/internal/Edits.js +5 -0
- package/dist/compiler/internal/Edits.js.map +1 -0
- package/dist/compiler/internal/Expression.d.ts +12 -0
- package/dist/compiler/internal/Expression.d.ts.map +1 -0
- package/dist/compiler/internal/Expression.js +98 -0
- package/dist/compiler/internal/Expression.js.map +1 -0
- package/dist/compiler/internal/Functions.d.ts +5 -0
- package/dist/compiler/internal/Functions.d.ts.map +1 -0
- package/dist/compiler/internal/Functions.js +191 -0
- package/dist/compiler/internal/Functions.js.map +1 -0
- package/dist/compiler/internal/Identifiers.d.ts +9 -0
- package/dist/compiler/internal/Identifiers.d.ts.map +1 -0
- package/dist/compiler/internal/Identifiers.js +106 -0
- package/dist/compiler/internal/Identifiers.js.map +1 -0
- package/dist/compiler/internal/Keyframes.d.ts +5 -0
- package/dist/compiler/internal/Keyframes.d.ts.map +1 -0
- package/dist/compiler/internal/Keyframes.js +51 -0
- package/dist/compiler/internal/Keyframes.js.map +1 -0
- package/dist/compiler/internal/Namespaces.d.ts +17 -0
- package/dist/compiler/internal/Namespaces.d.ts.map +1 -0
- package/dist/compiler/internal/Namespaces.js +265 -0
- package/dist/compiler/internal/Namespaces.js.map +1 -0
- package/dist/compiler/internal/NativeBindings.d.ts +74 -0
- package/dist/compiler/internal/NativeBindings.d.ts.map +1 -0
- package/dist/compiler/internal/NativeBindings.js +117 -0
- package/dist/compiler/internal/NativeBindings.js.map +1 -0
- package/dist/compiler/internal/PackedStyles.d.ts +35 -0
- package/dist/compiler/internal/PackedStyles.d.ts.map +1 -0
- package/dist/compiler/internal/PackedStyles.js +345 -0
- package/dist/compiler/internal/PackedStyles.js.map +1 -0
- package/dist/compiler/internal/Properties.d.ts +5 -0
- package/dist/compiler/internal/Properties.d.ts.map +1 -0
- package/dist/compiler/internal/Properties.js +82 -0
- package/dist/compiler/internal/Properties.js.map +1 -0
- package/dist/compiler/internal/RecipeConditions.d.ts +41 -0
- package/dist/compiler/internal/RecipeConditions.d.ts.map +1 -0
- package/dist/compiler/internal/RecipeConditions.js +82 -0
- package/dist/compiler/internal/RecipeConditions.js.map +1 -0
- package/dist/compiler/internal/RecipePayloads.d.ts +31 -0
- package/dist/compiler/internal/RecipePayloads.d.ts.map +1 -0
- package/dist/compiler/internal/RecipePayloads.js +99 -0
- package/dist/compiler/internal/RecipePayloads.js.map +1 -0
- package/dist/compiler/internal/Recipes.d.ts +32 -0
- package/dist/compiler/internal/Recipes.d.ts.map +1 -0
- package/dist/compiler/internal/Recipes.js +339 -0
- package/dist/compiler/internal/Recipes.js.map +1 -0
- package/dist/compiler/internal/Relative.d.ts +19 -0
- package/dist/compiler/internal/Relative.d.ts.map +1 -0
- package/dist/compiler/internal/Relative.js +62 -0
- package/dist/compiler/internal/Relative.js.map +1 -0
- package/dist/compiler/internal/Scope.d.ts +10 -0
- package/dist/compiler/internal/Scope.d.ts.map +1 -0
- package/dist/compiler/internal/Scope.js +28 -0
- package/dist/compiler/internal/Scope.js.map +1 -0
- package/dist/compiler/internal/Selectors.d.ts +12 -0
- package/dist/compiler/internal/Selectors.d.ts.map +1 -0
- package/dist/compiler/internal/Selectors.js +265 -0
- package/dist/compiler/internal/Selectors.js.map +1 -0
- package/dist/compiler/internal/Static.d.ts +39 -0
- package/dist/compiler/internal/Static.d.ts.map +1 -0
- package/dist/compiler/internal/Static.js +532 -0
- package/dist/compiler/internal/Static.js.map +1 -0
- package/dist/compiler/internal/Stylesheets.d.ts +47 -0
- package/dist/compiler/internal/Stylesheets.d.ts.map +1 -0
- package/dist/compiler/internal/Stylesheets.js +272 -0
- package/dist/compiler/internal/Stylesheets.js.map +1 -0
- package/dist/compiler/internal/Syntax.d.ts +17 -0
- package/dist/compiler/internal/Syntax.d.ts.map +1 -0
- package/dist/compiler/internal/Syntax.js +19 -0
- package/dist/compiler/internal/Syntax.js.map +1 -0
- package/dist/compiler/internal/Themes.d.ts +158 -0
- package/dist/compiler/internal/Themes.d.ts.map +1 -0
- package/dist/compiler/internal/Themes.js +1169 -0
- package/dist/compiler/internal/Themes.js.map +1 -0
- package/dist/compiler/internal/Variables.d.ts +31 -0
- package/dist/compiler/internal/Variables.d.ts.map +1 -0
- package/dist/compiler/internal/Variables.js +376 -0
- package/dist/compiler/internal/Variables.js.map +1 -0
- package/dist/compiler/internal/ViewTransitions.d.ts +3 -0
- package/dist/compiler/internal/ViewTransitions.d.ts.map +1 -0
- package/dist/compiler/internal/ViewTransitions.js +68 -0
- package/dist/compiler/internal/ViewTransitions.js.map +1 -0
- package/dist/cx.d.ts +18 -0
- package/dist/cx.d.ts.map +1 -0
- package/dist/cx.js +60 -0
- package/dist/cx.js.map +1 -0
- package/dist/default.d.ts +2008 -0
- package/dist/default.d.ts.map +1 -0
- package/dist/default.js +243 -0
- package/dist/default.js.map +7 -0
- package/dist/default.js.zyzz.json +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/Authoring.d.ts +26 -0
- package/dist/internal/Authoring.d.ts.map +1 -0
- package/dist/internal/Authoring.js +134 -0
- package/dist/internal/Authoring.js.map +1 -0
- package/dist/internal/Binding.d.ts +64 -0
- package/dist/internal/Binding.d.ts.map +1 -0
- package/dist/internal/Binding.js +27 -0
- package/dist/internal/Binding.js.map +1 -0
- package/dist/internal/BindingDomains.d.ts +11 -0
- package/dist/internal/BindingDomains.d.ts.map +1 -0
- package/dist/internal/BindingDomains.js +459 -0
- package/dist/internal/BindingDomains.js.map +1 -0
- package/dist/internal/Cascade.d.ts +45 -0
- package/dist/internal/Cascade.d.ts.map +1 -0
- package/dist/internal/Cascade.js +165 -0
- package/dist/internal/Cascade.js.map +1 -0
- package/dist/internal/Compound.d.ts +132 -0
- package/dist/internal/Compound.d.ts.map +1 -0
- package/dist/internal/Compound.js +2 -0
- package/dist/internal/Compound.js.map +1 -0
- package/dist/internal/Condition.d.ts +33 -0
- package/dist/internal/Condition.d.ts.map +1 -0
- package/dist/internal/Condition.js +180 -0
- package/dist/internal/Condition.js.map +1 -0
- package/dist/internal/Corner.d.ts +9 -0
- package/dist/internal/Corner.d.ts.map +1 -0
- package/dist/internal/Corner.js +14 -0
- package/dist/internal/Corner.js.map +1 -0
- package/dist/internal/FunctionSyntax.d.ts +27 -0
- package/dist/internal/FunctionSyntax.d.ts.map +1 -0
- package/dist/internal/FunctionSyntax.js +91 -0
- package/dist/internal/FunctionSyntax.js.map +1 -0
- package/dist/internal/FunctionValue.d.ts +19 -0
- package/dist/internal/FunctionValue.d.ts.map +1 -0
- package/dist/internal/FunctionValue.js +2 -0
- package/dist/internal/FunctionValue.js.map +1 -0
- package/dist/internal/Geometry.d.ts +8 -0
- package/dist/internal/Geometry.d.ts.map +1 -0
- package/dist/internal/Geometry.js +2 -0
- package/dist/internal/Geometry.js.map +1 -0
- package/dist/internal/Grid.d.ts +15 -0
- package/dist/internal/Grid.d.ts.map +1 -0
- package/dist/internal/Grid.js +2 -0
- package/dist/internal/Grid.js.map +1 -0
- package/dist/internal/Identifier.d.ts +15 -0
- package/dist/internal/Identifier.d.ts.map +1 -0
- package/dist/internal/Identifier.js +2 -0
- package/dist/internal/Identifier.js.map +1 -0
- package/dist/internal/Identity.d.ts +16 -0
- package/dist/internal/Identity.d.ts.map +1 -0
- package/dist/internal/Identity.js +78 -0
- package/dist/internal/Identity.js.map +1 -0
- package/dist/internal/Lexical.d.ts +89 -0
- package/dist/internal/Lexical.d.ts.map +1 -0
- package/dist/internal/Lexical.js +15 -0
- package/dist/internal/Lexical.js.map +1 -0
- package/dist/internal/Literal.d.ts +3459 -0
- package/dist/internal/Literal.d.ts.map +1 -0
- package/dist/internal/Literal.js +3371 -0
- package/dist/internal/Literal.js.map +1 -0
- package/dist/internal/NativeProperties.d.ts +596 -0
- package/dist/internal/NativeProperties.d.ts.map +1 -0
- package/dist/internal/NativeProperties.js +2 -0
- package/dist/internal/NativeProperties.js.map +1 -0
- package/dist/internal/Numeric.d.ts +23 -0
- package/dist/internal/Numeric.d.ts.map +1 -0
- package/dist/internal/Numeric.js +2 -0
- package/dist/internal/Numeric.js.map +1 -0
- package/dist/internal/Query.d.ts +15 -0
- package/dist/internal/Query.d.ts.map +1 -0
- package/dist/internal/Query.js +58 -0
- package/dist/internal/Query.js.map +1 -0
- package/dist/internal/Recipe.d.ts +17 -0
- package/dist/internal/Recipe.d.ts.map +1 -0
- package/dist/internal/Recipe.js +2 -0
- package/dist/internal/Recipe.js.map +1 -0
- package/dist/internal/RuleReference.d.ts +23 -0
- package/dist/internal/RuleReference.d.ts.map +1 -0
- package/dist/internal/RuleReference.js +65 -0
- package/dist/internal/RuleReference.js.map +1 -0
- package/dist/internal/Scheme.d.ts +12 -0
- package/dist/internal/Scheme.d.ts.map +1 -0
- package/dist/internal/Scheme.js +16 -0
- package/dist/internal/Scheme.js.map +1 -0
- package/dist/internal/Shorthands.d.ts +20 -0
- package/dist/internal/Shorthands.d.ts.map +1 -0
- package/dist/internal/Shorthands.js +49 -0
- package/dist/internal/Shorthands.js.map +1 -0
- package/dist/internal/Targets.d.ts +43 -0
- package/dist/internal/Targets.d.ts.map +1 -0
- package/dist/internal/Targets.js +60 -0
- package/dist/internal/Targets.js.map +1 -0
- package/dist/internal/Token.d.ts +104 -0
- package/dist/internal/Token.d.ts.map +1 -0
- package/dist/internal/Token.js +162 -0
- package/dist/internal/Token.js.map +1 -0
- package/dist/internal/Tuple.d.ts +23 -0
- package/dist/internal/Tuple.d.ts.map +1 -0
- package/dist/internal/Tuple.js +2 -0
- package/dist/internal/Tuple.js.map +1 -0
- package/dist/internal/Value.d.ts +74 -0
- package/dist/internal/Value.d.ts.map +1 -0
- package/dist/internal/Value.js +60 -0
- package/dist/internal/Value.js.map +1 -0
- package/dist/metro/Graph.d.ts +8 -0
- package/dist/metro/Graph.d.ts.map +1 -0
- package/dist/metro/Graph.js +63 -0
- package/dist/metro/Graph.js.map +1 -0
- package/dist/metro/Watch.d.ts +21 -0
- package/dist/metro/Watch.d.ts.map +1 -0
- package/dist/metro/Watch.js +51 -0
- package/dist/metro/Watch.js.map +1 -0
- package/dist/metro/index.d.ts +30 -0
- package/dist/metro/index.d.ts.map +1 -0
- package/dist/metro/index.js +52 -0
- package/dist/metro/index.js.map +1 -0
- package/dist/metro/transformer.d.ts +21 -0
- package/dist/metro/transformer.d.ts.map +1 -0
- package/dist/metro/transformer.js +71 -0
- package/dist/metro/transformer.js.map +1 -0
- package/dist/next/index.d.ts +18 -0
- package/dist/next/index.d.ts.map +1 -0
- package/dist/next/index.js +92 -0
- package/dist/next/index.js.map +1 -0
- package/dist/next/loader.d.ts +16 -0
- package/dist/next/loader.d.ts.map +1 -0
- package/dist/next/loader.js +282 -0
- package/dist/next/loader.js.map +1 -0
- package/dist/node/Host.d.ts +80 -0
- package/dist/node/Host.d.ts.map +1 -0
- package/dist/node/Host.js +882 -0
- package/dist/node/Host.js.map +1 -0
- package/dist/node/index.d.ts +7 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +7 -0
- package/dist/node/index.js.map +1 -0
- package/dist/react-native/Host.d.ts +76 -0
- package/dist/react-native/Host.d.ts.map +1 -0
- package/dist/react-native/Host.js +209 -0
- package/dist/react-native/Host.js.map +1 -0
- package/dist/react-native/StyleSheet.d.ts +226 -0
- package/dist/react-native/StyleSheet.d.ts.map +1 -0
- package/dist/react-native/StyleSheet.js +606 -0
- package/dist/react-native/StyleSheet.js.map +1 -0
- package/dist/react-native/Variants.d.ts +38 -0
- package/dist/react-native/Variants.d.ts.map +1 -0
- package/dist/react-native/Variants.js +66 -0
- package/dist/react-native/Variants.js.map +1 -0
- package/dist/react-native/index.d.ts +8 -0
- package/dist/react-native/index.d.ts.map +1 -0
- package/dist/react-native/index.js +8 -0
- package/dist/react-native/index.js.map +1 -0
- package/dist/react-native/internal/Color.d.ts +7 -0
- package/dist/react-native/internal/Color.d.ts.map +1 -0
- package/dist/react-native/internal/Color.js +93 -0
- package/dist/react-native/internal/Color.js.map +1 -0
- package/dist/react-native/internal/NativeSchema.d.ts +5138 -0
- package/dist/react-native/internal/NativeSchema.d.ts.map +1 -0
- package/dist/react-native/internal/NativeSchema.js +3097 -0
- package/dist/react-native/internal/NativeSchema.js.map +1 -0
- package/dist/react-native/internal/Scalar.d.ts +95 -0
- package/dist/react-native/internal/Scalar.d.ts.map +1 -0
- package/dist/react-native/internal/Scalar.js +199 -0
- package/dist/react-native/internal/Scalar.js.map +1 -0
- package/dist/react-native/internal/Values.d.ts +5 -0
- package/dist/react-native/internal/Values.d.ts.map +1 -0
- package/dist/react-native/internal/Values.js +65 -0
- package/dist/react-native/internal/Values.js.map +1 -0
- package/dist/react-native/react.d.ts +22 -0
- package/dist/react-native/react.d.ts.map +1 -0
- package/dist/react-native/react.js +26 -0
- package/dist/react-native/react.js.map +1 -0
- package/dist/reset.css +244 -0
- package/dist/runtime/Appearance.d.ts +55 -0
- package/dist/runtime/Appearance.d.ts.map +1 -0
- package/dist/runtime/Appearance.js +84 -0
- package/dist/runtime/Appearance.js.map +1 -0
- package/dist/runtime/Composition.d.ts +46 -0
- package/dist/runtime/Composition.d.ts.map +1 -0
- package/dist/runtime/Composition.js +52 -0
- package/dist/runtime/Composition.js.map +1 -0
- package/dist/runtime/CompositionHtml.d.ts +15 -0
- package/dist/runtime/CompositionHtml.d.ts.map +1 -0
- package/dist/runtime/CompositionHtml.js +20 -0
- package/dist/runtime/CompositionHtml.js.map +1 -0
- package/dist/runtime/ConditionalRecipe.d.ts +30 -0
- package/dist/runtime/ConditionalRecipe.d.ts.map +1 -0
- package/dist/runtime/ConditionalRecipe.js +39 -0
- package/dist/runtime/ConditionalRecipe.js.map +1 -0
- package/dist/runtime/Dynamic.d.ts +19 -0
- package/dist/runtime/Dynamic.d.ts.map +1 -0
- package/dist/runtime/Dynamic.js +22 -0
- package/dist/runtime/Dynamic.js.map +1 -0
- package/dist/runtime/Html.d.ts +32 -0
- package/dist/runtime/Html.d.ts.map +1 -0
- package/dist/runtime/Html.js +63 -0
- package/dist/runtime/Html.js.map +1 -0
- package/dist/runtime/Native.d.ts +48 -0
- package/dist/runtime/Native.d.ts.map +1 -0
- package/dist/runtime/Native.js +78 -0
- package/dist/runtime/Native.js.map +1 -0
- package/dist/runtime/NativeContext.d.ts +17 -0
- package/dist/runtime/NativeContext.d.ts.map +1 -0
- package/dist/runtime/NativeContext.js +47 -0
- package/dist/runtime/NativeContext.js.map +1 -0
- package/dist/runtime/NativeDynamic.d.ts +47 -0
- package/dist/runtime/NativeDynamic.d.ts.map +1 -0
- package/dist/runtime/NativeDynamic.js +141 -0
- package/dist/runtime/NativeDynamic.js.map +1 -0
- package/dist/runtime/PayloadRecipe.d.ts +22 -0
- package/dist/runtime/PayloadRecipe.d.ts.map +1 -0
- package/dist/runtime/PayloadRecipe.js +59 -0
- package/dist/runtime/PayloadRecipe.js.map +1 -0
- package/dist/runtime/Props.d.ts +21 -0
- package/dist/runtime/Props.d.ts.map +1 -0
- package/dist/runtime/Props.js +17 -0
- package/dist/runtime/Props.js.map +1 -0
- package/dist/runtime/Recipe.d.ts +52 -0
- package/dist/runtime/Recipe.d.ts.map +1 -0
- package/dist/runtime/Recipe.js +30 -0
- package/dist/runtime/Recipe.js.map +1 -0
- package/dist/runtime/Selection.d.ts +31 -0
- package/dist/runtime/Selection.d.ts.map +1 -0
- package/dist/runtime/Selection.js +30 -0
- package/dist/runtime/Selection.js.map +1 -0
- package/dist/runtime/Variable.d.ts +6 -0
- package/dist/runtime/Variable.d.ts.map +1 -0
- package/dist/runtime/Variable.js +10 -0
- package/dist/runtime/Variable.js.map +1 -0
- package/dist/runtime/index.d.ts +33 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +33 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/styleFunction.d.ts +72 -0
- package/dist/styleFunction.d.ts.map +1 -0
- package/dist/styleFunction.js +18 -0
- package/dist/styleFunction.js.map +1 -0
- package/dist/themes/LICENSE.tailwind +21 -0
- package/dist/variable.d.ts +50 -0
- package/dist/variable.d.ts.map +1 -0
- package/dist/variable.js +20 -0
- package/dist/variable.js.map +1 -0
- package/dist/variants.d.ts +84 -0
- package/dist/variants.d.ts.map +1 -0
- package/dist/variants.js +21 -0
- package/dist/variants.js.map +1 -0
- package/dist/vite/index.d.ts +24 -0
- package/dist/vite/index.d.ts.map +1 -0
- package/dist/vite/index.js +1089 -0
- package/dist/vite/index.js.map +1 -0
- package/dist/web/Css.d.ts +81 -0
- package/dist/web/Css.d.ts.map +1 -0
- package/dist/web/Css.js +593 -0
- package/dist/web/Css.js.map +1 -0
- package/dist/web/colorProfile.d.ts +28 -0
- package/dist/web/colorProfile.d.ts.map +1 -0
- package/dist/web/colorProfile.js +8 -0
- package/dist/web/colorProfile.js.map +1 -0
- package/dist/web/counterStyle.d.ts +48 -0
- package/dist/web/counterStyle.d.ts.map +1 -0
- package/dist/web/counterStyle.js +8 -0
- package/dist/web/counterStyle.js.map +1 -0
- package/dist/web/cssFunction.d.ts +80 -0
- package/dist/web/cssFunction.d.ts.map +1 -0
- package/dist/web/cssFunction.js +18 -0
- package/dist/web/cssFunction.js.map +1 -0
- package/dist/web/customMedia.d.ts +12 -0
- package/dist/web/customMedia.d.ts.map +1 -0
- package/dist/web/customMedia.js +7 -0
- package/dist/web/customMedia.js.map +1 -0
- package/dist/web/fontFace.d.ts +26 -0
- package/dist/web/fontFace.d.ts.map +1 -0
- package/dist/web/fontFace.js +7 -0
- package/dist/web/fontFace.js.map +1 -0
- package/dist/web/fontFeatureValues.d.ts +40 -0
- package/dist/web/fontFeatureValues.d.ts.map +1 -0
- package/dist/web/fontFeatureValues.js +7 -0
- package/dist/web/fontFeatureValues.js.map +1 -0
- package/dist/web/fontPaletteValues.d.ts +21 -0
- package/dist/web/fontPaletteValues.d.ts.map +1 -0
- package/dist/web/fontPaletteValues.js +9 -0
- package/dist/web/fontPaletteValues.js.map +1 -0
- package/dist/web/global.d.ts +19 -0
- package/dist/web/global.d.ts.map +1 -0
- package/dist/web/global.js +6 -0
- package/dist/web/global.js.map +1 -0
- package/dist/web/importCss.d.ts +18 -0
- package/dist/web/importCss.d.ts.map +1 -0
- package/dist/web/importCss.js +7 -0
- package/dist/web/importCss.js.map +1 -0
- package/dist/web/index.d.ts +22 -0
- package/dist/web/index.d.ts.map +1 -0
- package/dist/web/index.js +22 -0
- package/dist/web/index.js.map +1 -0
- package/dist/web/internal/Block.d.ts +18 -0
- package/dist/web/internal/Block.d.ts.map +1 -0
- package/dist/web/internal/Block.js +13 -0
- package/dist/web/internal/Block.js.map +1 -0
- package/dist/web/internal/ClassName.d.ts +19 -0
- package/dist/web/internal/ClassName.d.ts.map +1 -0
- package/dist/web/internal/ClassName.js +77 -0
- package/dist/web/internal/ClassName.js.map +1 -0
- package/dist/web/internal/Context.d.ts +11 -0
- package/dist/web/internal/Context.d.ts.map +1 -0
- package/dist/web/internal/Context.js +2 -0
- package/dist/web/internal/Context.js.map +1 -0
- package/dist/web/internal/Contributions.d.ts +70 -0
- package/dist/web/internal/Contributions.d.ts.map +1 -0
- package/dist/web/internal/Contributions.js +109 -0
- package/dist/web/internal/Contributions.js.map +1 -0
- package/dist/web/internal/Namespace.d.ts +13 -0
- package/dist/web/internal/Namespace.d.ts.map +1 -0
- package/dist/web/internal/Namespace.js +13 -0
- package/dist/web/internal/Namespace.js.map +1 -0
- package/dist/web/internal/Themes.d.ts +13 -0
- package/dist/web/internal/Themes.d.ts.map +1 -0
- package/dist/web/internal/Themes.js +96 -0
- package/dist/web/internal/Themes.js.map +1 -0
- package/dist/web/keyframes.d.ts +14 -0
- package/dist/web/keyframes.d.ts.map +1 -0
- package/dist/web/keyframes.js +8 -0
- package/dist/web/keyframes.js.map +1 -0
- package/dist/web/layers.d.ts +4 -0
- package/dist/web/layers.d.ts.map +1 -0
- package/dist/web/layers.js +7 -0
- package/dist/web/layers.js.map +1 -0
- package/dist/web/namespace.d.ts +14 -0
- package/dist/web/namespace.d.ts.map +1 -0
- package/dist/web/namespace.js +7 -0
- package/dist/web/namespace.js.map +1 -0
- package/dist/web/page.d.ts +38 -0
- package/dist/web/page.d.ts.map +1 -0
- package/dist/web/page.js +7 -0
- package/dist/web/page.js.map +1 -0
- package/dist/web/positionTry.d.ts +14 -0
- package/dist/web/positionTry.d.ts.map +1 -0
- package/dist/web/positionTry.js +9 -0
- package/dist/web/positionTry.js.map +1 -0
- package/dist/web/property.d.ts +24 -0
- package/dist/web/property.d.ts.map +1 -0
- package/dist/web/property.js +7 -0
- package/dist/web/property.js.map +1 -0
- package/dist/web/viewTransition.d.ts +29 -0
- package/dist/web/viewTransition.d.ts.map +1 -0
- package/dist/web/viewTransition.js +7 -0
- package/dist/web/viewTransition.js.map +1 -0
- package/package.json +136 -10
- package/src/Config.ts +690 -0
- package/src/Props.ts +8 -0
- package/src/Style.ts +748 -0
- package/src/Theme.ts +713 -0
- package/src/babel/NativeEdits.ts +273 -0
- package/src/babel/NativeJsx.ts +260 -0
- package/src/babel/index.ts +332 -0
- package/src/cli/index.ts +196 -0
- package/src/compiler/Graph.ts +1586 -0
- package/src/compiler/Native.ts +801 -0
- package/src/compiler/Source.ts +1550 -0
- package/src/compiler/Transform.ts +1235 -0
- package/src/compiler/index.ts +12 -0
- package/src/compiler/internal/Applications.ts +378 -0
- package/src/compiler/internal/AtRules.ts +202 -0
- package/src/compiler/internal/Catalogs.ts +114 -0
- package/src/compiler/internal/ColorProfiles.ts +93 -0
- package/src/compiler/internal/CompositionBindings.ts +120 -0
- package/src/compiler/internal/Compositions.ts +629 -0
- package/src/compiler/internal/Configurations.ts +244 -0
- package/src/compiler/internal/Contract.ts +846 -0
- package/src/compiler/internal/Contributions.ts +1507 -0
- package/src/compiler/internal/Descriptors.ts +238 -0
- package/src/compiler/internal/Dynamic.ts +266 -0
- package/src/compiler/internal/Edits.ts +13 -0
- package/src/compiler/internal/Expression.ts +135 -0
- package/src/compiler/internal/Functions.ts +206 -0
- package/src/compiler/internal/Identifiers.ts +124 -0
- package/src/compiler/internal/Keyframes.ts +62 -0
- package/src/compiler/internal/Namespaces.ts +296 -0
- package/src/compiler/internal/NativeBindings.ts +151 -0
- package/src/compiler/internal/PackedStyles.ts +464 -0
- package/src/compiler/internal/Properties.ts +121 -0
- package/src/compiler/internal/RecipeConditions.ts +139 -0
- package/src/compiler/internal/RecipePayloads.ts +132 -0
- package/src/compiler/internal/Recipes.ts +531 -0
- package/src/compiler/internal/Relative.ts +87 -0
- package/src/compiler/internal/Scope.ts +36 -0
- package/src/compiler/internal/Selectors.ts +334 -0
- package/src/compiler/internal/Static.ts +783 -0
- package/src/compiler/internal/Stylesheets.ts +361 -0
- package/src/compiler/internal/Syntax.ts +31 -0
- package/src/compiler/internal/Themes.ts +1794 -0
- package/src/compiler/internal/Variables.ts +497 -0
- package/src/compiler/internal/ViewTransitions.ts +82 -0
- package/src/cx.ts +98 -0
- package/src/default.ts +484 -0
- package/src/index.ts +20 -0
- package/src/internal/Authoring.ts +199 -0
- package/src/internal/Binding.ts +187 -0
- package/src/internal/BindingDomains.ts +458 -0
- package/src/internal/Cascade.ts +165 -0
- package/src/internal/Compound.ts +522 -0
- package/src/internal/Condition.ts +283 -0
- package/src/internal/Corner.ts +17 -0
- package/src/internal/FunctionSyntax.ts +271 -0
- package/src/internal/FunctionValue.ts +96 -0
- package/src/internal/Geometry.ts +30 -0
- package/src/internal/Grid.ts +67 -0
- package/src/internal/Identifier.ts +14 -0
- package/src/internal/Identity.ts +89 -0
- package/src/internal/Lexical.ts +202 -0
- package/src/internal/Literal.ts +3820 -0
- package/src/internal/NativeProperties.ts +936 -0
- package/src/internal/Numeric.ts +77 -0
- package/src/internal/Query.ts +87 -0
- package/src/internal/Recipe.ts +17 -0
- package/src/internal/RuleReference.ts +102 -0
- package/src/internal/Scheme.ts +20 -0
- package/src/internal/Shorthands.ts +120 -0
- package/src/internal/Targets.ts +162 -0
- package/src/internal/Token.ts +380 -0
- package/src/internal/Tuple.ts +29 -0
- package/src/internal/Value.ts +320 -0
- package/src/metro/Graph.ts +78 -0
- package/src/metro/Watch.ts +88 -0
- package/src/metro/index.ts +99 -0
- package/src/metro/transformer.ts +97 -0
- package/src/next/index.ts +114 -0
- package/src/next/loader.ts +369 -0
- package/src/node/Host.ts +1204 -0
- package/src/node/index.ts +6 -0
- package/src/react-native/Host.ts +289 -0
- package/src/react-native/StyleSheet.ts +1084 -0
- package/src/react-native/Variants.ts +122 -0
- package/src/react-native/index.ts +7 -0
- package/src/react-native/internal/Color.ts +110 -0
- package/src/react-native/internal/NativeSchema.ts +3096 -0
- package/src/react-native/internal/Scalar.ts +253 -0
- package/src/react-native/internal/Values.ts +87 -0
- package/src/react-native/react.ts +47 -0
- package/src/reset.css +244 -0
- package/src/runtime/Appearance.ts +155 -0
- package/src/runtime/Composition.ts +87 -0
- package/src/runtime/CompositionHtml.ts +38 -0
- package/src/runtime/ConditionalRecipe.ts +70 -0
- package/src/runtime/Dynamic.ts +51 -0
- package/src/runtime/Html.ts +91 -0
- package/src/runtime/Native.ts +144 -0
- package/src/runtime/NativeContext.ts +74 -0
- package/src/runtime/NativeDynamic.ts +246 -0
- package/src/runtime/PayloadRecipe.ts +96 -0
- package/src/runtime/Props.ts +33 -0
- package/src/runtime/Recipe.ts +74 -0
- package/src/runtime/Selection.ts +82 -0
- package/src/runtime/Variable.ts +15 -0
- package/src/runtime/index.ts +45 -0
- package/src/styleFunction.ts +138 -0
- package/src/themes/LICENSE.tailwind +21 -0
- package/src/variable.ts +105 -0
- package/src/variants.ts +218 -0
- package/src/vite/index.ts +1473 -0
- package/src/web/Css.ts +801 -0
- package/src/web/colorProfile.ts +60 -0
- package/src/web/counterStyle.ts +82 -0
- package/src/web/cssFunction.ts +181 -0
- package/src/web/customMedia.ts +16 -0
- package/src/web/fontFace.ts +41 -0
- package/src/web/fontFeatureValues.ts +79 -0
- package/src/web/fontPaletteValues.ts +42 -0
- package/src/web/global.ts +39 -0
- package/src/web/importCss.ts +23 -0
- package/src/web/index.ts +22 -0
- package/src/web/internal/Block.ts +29 -0
- package/src/web/internal/ClassName.ts +112 -0
- package/src/web/internal/Context.ts +16 -0
- package/src/web/internal/Contributions.ts +219 -0
- package/src/web/internal/Namespace.ts +21 -0
- package/src/web/internal/Themes.ts +133 -0
- package/src/web/keyframes.ts +43 -0
- package/src/web/layers.ts +6 -0
- package/src/web/namespace.ts +19 -0
- package/src/web/page.ts +140 -0
- package/src/web/positionTry.ts +71 -0
- package/src/web/property.ts +35 -0
- package/src/web/viewTransition.ts +89 -0
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
/** Compiles local Zyzz authoring before Babel lowers TypeScript and JSX. @module */
|
|
2
|
+
import type * as Babel from '@babel/core'
|
|
3
|
+
import type * as Ast from '@oxc-project/types'
|
|
4
|
+
import * as Syntax from '../compiler/internal/Syntax.js'
|
|
5
|
+
import * as Themes from '../compiler/internal/Themes.js'
|
|
6
|
+
import * as Path from 'node:path'
|
|
7
|
+
import * as Trace from '@jridgewell/trace-mapping'
|
|
8
|
+
import * as Graph from '../compiler/Graph.js'
|
|
9
|
+
import * as Native from '../compiler/Native.js'
|
|
10
|
+
import * as NativeJsx from './NativeJsx.js'
|
|
11
|
+
import * as NativeEdits from './NativeEdits.js'
|
|
12
|
+
import * as Edits from '../compiler/internal/Edits.js'
|
|
13
|
+
import * as Transform from '../compiler/Transform.js'
|
|
14
|
+
|
|
15
|
+
/** Native compilation settings for one Babel transformation. */
|
|
16
|
+
export type NativeOptions = {
|
|
17
|
+
/** Fixed build-time scheme. Omit for runtime selection through React. */
|
|
18
|
+
readonly colorScheme?: 'dark' | 'light' | undefined
|
|
19
|
+
/** Closed source graph supplied by the bundler for imported authoring. */
|
|
20
|
+
readonly modules?: Readonly<Record<string, string>> | undefined
|
|
21
|
+
/** Host-resolved graph imports. */
|
|
22
|
+
readonly imports?: Graph.compile.Options['imports']
|
|
23
|
+
/** Portable source identity. Defaults to a native module-local identity. */
|
|
24
|
+
readonly moduleId?: string | undefined
|
|
25
|
+
/** Native destination selected by the bundler. */
|
|
26
|
+
readonly platform: 'android' | 'ios'
|
|
27
|
+
/** Native compiler selection. Omission preserves existing native configurations. */
|
|
28
|
+
readonly target?: 'native' | undefined
|
|
29
|
+
/** Conversion factors for authored lengths. */
|
|
30
|
+
readonly units?: Native.compile.Options['units']
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Web compilation settings for one Babel transformation. */
|
|
34
|
+
export type WebOptions = {
|
|
35
|
+
/** CSS representation. Defaults to the web compiler's atomic output. */
|
|
36
|
+
readonly cssOutput?: Transform.compile.Options['cssOutput']
|
|
37
|
+
/** Portable identity. Defaults to the filename relative to Babel's root. */
|
|
38
|
+
readonly moduleId?: string | undefined
|
|
39
|
+
/** Selects rewritten JavaScript and extracted CSS. */
|
|
40
|
+
readonly target: 'web'
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Explicit web or native compiler selection. */
|
|
44
|
+
export type Options = NativeOptions | WebOptions
|
|
45
|
+
|
|
46
|
+
/** Stylesheet artifacts stored on Babel's result.metadata.zyzz for web transforms. */
|
|
47
|
+
export type WebMetadata = {
|
|
48
|
+
/** Extracted CSS. The consuming build must deliver this stylesheet. */
|
|
49
|
+
readonly css: string
|
|
50
|
+
/** CSS source map with original authoring content. */
|
|
51
|
+
readonly cssMap: Transform.compile.ReturnType['cssMap']
|
|
52
|
+
/** Portable identity used for class names and stylesheet ownership. */
|
|
53
|
+
readonly moduleId: string
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
declare module '@babel/core' {
|
|
57
|
+
interface BabelFileMetadata {
|
|
58
|
+
/** Web stylesheet output owned by the consuming build. Absent on native and ordinary modules. */
|
|
59
|
+
zyzz?: WebMetadata | undefined
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Rewrites direct Zyzz imports while preserving authored source locations. */
|
|
64
|
+
export function zyzz(api: typeof Babel, options: Options): Babel.PluginObj {
|
|
65
|
+
const prepared = new WeakSet<Babel.types.File>()
|
|
66
|
+
const callables = new WeakSet<Babel.types.Node>()
|
|
67
|
+
const parsing = new WeakMap<object, Babel.TransformOptions>()
|
|
68
|
+
function compile(
|
|
69
|
+
file: {
|
|
70
|
+
ast: Babel.types.File | { program: Ast.Program }
|
|
71
|
+
code: string
|
|
72
|
+
opts: Babel.TransformOptions
|
|
73
|
+
metadata: Babel.BabelFile['metadata']
|
|
74
|
+
},
|
|
75
|
+
parsed?: ReturnType<typeof Syntax.parse>,
|
|
76
|
+
) {
|
|
77
|
+
const contextual =
|
|
78
|
+
options.target !== 'web' && options.colorScheme === undefined
|
|
79
|
+
for (const node of file.ast.program.body) {
|
|
80
|
+
if (
|
|
81
|
+
node.type === 'ImportDeclaration' &&
|
|
82
|
+
node.importKind !== 'type' &&
|
|
83
|
+
node.source.value === 'zyzz/default'
|
|
84
|
+
)
|
|
85
|
+
throw new Error(
|
|
86
|
+
'Zyzz Babel requires local theme authoring; bundled themes require package graph support.',
|
|
87
|
+
)
|
|
88
|
+
if (contextual) continue
|
|
89
|
+
if (
|
|
90
|
+
node.type === 'ExportNamedDeclaration' &&
|
|
91
|
+
node.specifiers.every(
|
|
92
|
+
(specifier) =>
|
|
93
|
+
specifier.type === 'ExportSpecifier' &&
|
|
94
|
+
specifier.exportKind === 'type',
|
|
95
|
+
)
|
|
96
|
+
)
|
|
97
|
+
continue
|
|
98
|
+
if (
|
|
99
|
+
(node.type === 'ExportNamedDeclaration' ||
|
|
100
|
+
node.type === 'ExportAllDeclaration') &&
|
|
101
|
+
node.exportKind !== 'type' &&
|
|
102
|
+
node.source?.value === 'zyzz'
|
|
103
|
+
)
|
|
104
|
+
throw new Error(
|
|
105
|
+
'Zyzz Babel does not support re-exporting authoring helpers. Export compiled style definitions instead.',
|
|
106
|
+
)
|
|
107
|
+
if (node.type !== 'ImportDeclaration' || node.importKind === 'type')
|
|
108
|
+
continue
|
|
109
|
+
if (
|
|
110
|
+
node.source.value === 'zyzz/default' ||
|
|
111
|
+
(node.source.value === 'zyzz' &&
|
|
112
|
+
node.specifiers.some(
|
|
113
|
+
(specifier) =>
|
|
114
|
+
specifier.type === 'ImportNamespaceSpecifier' ||
|
|
115
|
+
(specifier.type === 'ImportSpecifier' &&
|
|
116
|
+
specifier.importKind !== 'type' &&
|
|
117
|
+
(specifier.imported.type === 'Identifier'
|
|
118
|
+
? specifier.imported.name
|
|
119
|
+
: specifier.imported.value) === 'Config'),
|
|
120
|
+
))
|
|
121
|
+
)
|
|
122
|
+
throw new Error(
|
|
123
|
+
'Zyzz Babel currently supports literal style and variants definitions. Theme/config compilation requires the graph adapter.',
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
const authorsStyles = file.ast.program.body.some(
|
|
127
|
+
(node) =>
|
|
128
|
+
node.type === 'ImportDeclaration' &&
|
|
129
|
+
(node.source.value === 'zyzz' ||
|
|
130
|
+
node.source.value === 'zyzz/default' ||
|
|
131
|
+
node.source.value === 'zyzz/web'),
|
|
132
|
+
)
|
|
133
|
+
if (!authorsStyles && !contextual) return
|
|
134
|
+
const filename = file.opts.filename
|
|
135
|
+
if (!filename)
|
|
136
|
+
throw new Error('Zyzz Babel compilation requires a filename.')
|
|
137
|
+
const output = (() => {
|
|
138
|
+
if (options.target === 'web') {
|
|
139
|
+
const moduleId =
|
|
140
|
+
options.moduleId ??
|
|
141
|
+
Path.relative(
|
|
142
|
+
file.opts.root ?? file.opts.cwd ?? process.cwd(),
|
|
143
|
+
filename,
|
|
144
|
+
)
|
|
145
|
+
.split(Path.sep)
|
|
146
|
+
.join('/')
|
|
147
|
+
const output = Transform.compile({
|
|
148
|
+
cssOutput: options.cssOutput,
|
|
149
|
+
moduleId,
|
|
150
|
+
source: file.code,
|
|
151
|
+
})
|
|
152
|
+
const metadata: WebMetadata = {
|
|
153
|
+
css: output.css,
|
|
154
|
+
cssMap: output.cssMap,
|
|
155
|
+
moduleId,
|
|
156
|
+
}
|
|
157
|
+
Object.assign(file.metadata, { zyzz: metadata })
|
|
158
|
+
return output
|
|
159
|
+
}
|
|
160
|
+
if (options.target !== undefined && options.target !== 'native')
|
|
161
|
+
throw new Error('Zyzz Babel target must be web or native.')
|
|
162
|
+
if (options.platform !== 'ios' && options.platform !== 'android')
|
|
163
|
+
throw new Error(
|
|
164
|
+
'Zyzz Babel compilation requires an ios or android platform.',
|
|
165
|
+
)
|
|
166
|
+
if (
|
|
167
|
+
!contextual &&
|
|
168
|
+
options.colorScheme !== 'light' &&
|
|
169
|
+
options.colorScheme !== 'dark'
|
|
170
|
+
)
|
|
171
|
+
throw new Error(
|
|
172
|
+
'Zyzz Babel compilation requires an explicit light or dark scheme.',
|
|
173
|
+
)
|
|
174
|
+
if (options.modules) {
|
|
175
|
+
const moduleId = options.moduleId
|
|
176
|
+
if (!moduleId || !Object.hasOwn(options.modules, moduleId))
|
|
177
|
+
throw new Error(
|
|
178
|
+
'Native Babel graph compilation requires a moduleId present in modules.',
|
|
179
|
+
)
|
|
180
|
+
return Graph.compile({
|
|
181
|
+
[Syntax.cache]: parsed ? new Map([[moduleId, parsed]]) : undefined,
|
|
182
|
+
modules: { ...options.modules, [moduleId]: file.code },
|
|
183
|
+
imports: options.imports,
|
|
184
|
+
native: {
|
|
185
|
+
[Edits.runtime]: true,
|
|
186
|
+
platform: options.platform,
|
|
187
|
+
units: options.units,
|
|
188
|
+
colorScheme: options.colorScheme ?? 'light',
|
|
189
|
+
contextual,
|
|
190
|
+
},
|
|
191
|
+
}).modules[moduleId]!
|
|
192
|
+
}
|
|
193
|
+
return Native.compile({
|
|
194
|
+
[Themes.context]: parsed ? { parsed, links: {} } : undefined,
|
|
195
|
+
[Edits.runtime]: true,
|
|
196
|
+
platform: options.platform,
|
|
197
|
+
units: options.units,
|
|
198
|
+
colorScheme: options.colorScheme ?? 'light',
|
|
199
|
+
contextual,
|
|
200
|
+
moduleId: options.moduleId ?? `babel/${Path.basename(filename)}`,
|
|
201
|
+
source: file.code,
|
|
202
|
+
})
|
|
203
|
+
})()
|
|
204
|
+
return output
|
|
205
|
+
}
|
|
206
|
+
type Plugin = Babel.PluginObj & {
|
|
207
|
+
parserOverride: (
|
|
208
|
+
code: string,
|
|
209
|
+
options: Babel.ParserOptions,
|
|
210
|
+
parse: (code: string, options: Babel.ParserOptions) => Babel.types.File,
|
|
211
|
+
) => Babel.types.File | undefined
|
|
212
|
+
}
|
|
213
|
+
const plugin: Plugin = {
|
|
214
|
+
name: 'zyzz',
|
|
215
|
+
manipulateOptions(
|
|
216
|
+
opts: Babel.TransformOptions,
|
|
217
|
+
parserOpts: Babel.ParserOptions,
|
|
218
|
+
) {
|
|
219
|
+
const compatible =
|
|
220
|
+
options.target !== 'web' &&
|
|
221
|
+
!opts.presets?.length &&
|
|
222
|
+
(opts.plugins ?? []).every((entry) => {
|
|
223
|
+
if (!entry || typeof entry !== 'object' || Array.isArray(entry))
|
|
224
|
+
return false
|
|
225
|
+
const override = Reflect.get(entry, 'parserOverride')
|
|
226
|
+
if (
|
|
227
|
+
typeof override !== 'function' ||
|
|
228
|
+
override === plugin.parserOverride
|
|
229
|
+
)
|
|
230
|
+
return true
|
|
231
|
+
// Hermes delegates TypeScript files to Babel without returning a parsed tree.
|
|
232
|
+
return (
|
|
233
|
+
Reflect.get(entry, 'key') === 'syntax-hermes-parser' &&
|
|
234
|
+
/\.tsx?$/.test(opts.filename ?? '')
|
|
235
|
+
)
|
|
236
|
+
})
|
|
237
|
+
if (compatible) parsing.set(parserOpts, opts)
|
|
238
|
+
},
|
|
239
|
+
parserOverride(code, parserOpts, parse) {
|
|
240
|
+
const opts = parsing.get(parserOpts)
|
|
241
|
+
if (!opts) return
|
|
242
|
+
try {
|
|
243
|
+
const parsed = Syntax.parse({
|
|
244
|
+
moduleId:
|
|
245
|
+
options.moduleId ??
|
|
246
|
+
`babel/${Path.basename(opts.filename ?? 'source.tsx')}`,
|
|
247
|
+
source: code,
|
|
248
|
+
})
|
|
249
|
+
const original = parsed.errors.length
|
|
250
|
+
? parse(code, parserOpts)
|
|
251
|
+
: undefined
|
|
252
|
+
const output = compile(
|
|
253
|
+
{
|
|
254
|
+
ast: original ?? { program: parsed.program },
|
|
255
|
+
code,
|
|
256
|
+
opts,
|
|
257
|
+
metadata: {},
|
|
258
|
+
},
|
|
259
|
+
parsed.errors.length ? undefined : parsed,
|
|
260
|
+
)
|
|
261
|
+
const edits = output?.[Edits.key]
|
|
262
|
+
const ast =
|
|
263
|
+
!original && edits
|
|
264
|
+
? NativeEdits.parse(api, code, parserOpts, edits, parse, callables)
|
|
265
|
+
: undefined
|
|
266
|
+
if (ast) {
|
|
267
|
+
prepared.add(ast)
|
|
268
|
+
return ast
|
|
269
|
+
}
|
|
270
|
+
const fallback = original ?? parse(code, parserOpts)
|
|
271
|
+
if (edits) NativeEdits.apply(api, fallback, opts, edits, callables)
|
|
272
|
+
prepared.add(fallback)
|
|
273
|
+
return fallback
|
|
274
|
+
} catch (error) {
|
|
275
|
+
if (
|
|
276
|
+
error instanceof Error &&
|
|
277
|
+
Reflect.get(error, 'code') !== 'BABEL_PARSER_SYNTAX_ERROR'
|
|
278
|
+
) {
|
|
279
|
+
error.message = `${opts.filename ?? 'unknown file'}: ${error.message}`
|
|
280
|
+
if (!Reflect.get(error, 'code'))
|
|
281
|
+
Object.assign(error, { code: 'BABEL_TRANSFORM_ERROR' })
|
|
282
|
+
}
|
|
283
|
+
throw error
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
pre(file) {
|
|
287
|
+
if (prepared.has(file.ast)) return
|
|
288
|
+
const output = compile(file)
|
|
289
|
+
if (!output || output.code === file.code) {
|
|
290
|
+
return
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
const edits = output[Edits.key]
|
|
294
|
+
if (edits) {
|
|
295
|
+
NativeEdits.apply(api, file.ast, file.opts, edits, callables)
|
|
296
|
+
file.scope.crawl()
|
|
297
|
+
return
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
const parsed = api.parseSync(output.code, {
|
|
301
|
+
babelrc: false,
|
|
302
|
+
configFile: false,
|
|
303
|
+
filename: file.opts.filename,
|
|
304
|
+
parserOpts: file.opts.parserOpts,
|
|
305
|
+
})
|
|
306
|
+
if (!parsed) throw new Error('Babel did not parse the compiled module.')
|
|
307
|
+
|
|
308
|
+
const map = new Trace.TraceMap(output.map)
|
|
309
|
+
api.types.traverseFast(parsed, (node) => {
|
|
310
|
+
const loc = node.loc
|
|
311
|
+
if (!loc) return
|
|
312
|
+
const start = Trace.originalPositionFor(map, loc.start)
|
|
313
|
+
const end = Trace.originalPositionFor(map, loc.end)
|
|
314
|
+
// Metro's function map requires locations for generated helpers as well as authored nodes.
|
|
315
|
+
if (start.line === null || end.line === null) {
|
|
316
|
+
loc.start = { ...loc.start, line: 1, column: 0 }
|
|
317
|
+
loc.end = { ...loc.end, line: 1, column: 0 }
|
|
318
|
+
return
|
|
319
|
+
}
|
|
320
|
+
loc.start = { ...loc.start, line: start.line, column: start.column }
|
|
321
|
+
loc.end = { ...loc.end, line: end.line, column: end.column }
|
|
322
|
+
})
|
|
323
|
+
file.path.replaceWith(parsed.program)
|
|
324
|
+
file.scope.crawl()
|
|
325
|
+
},
|
|
326
|
+
visitor:
|
|
327
|
+
options.target !== 'web' && options.colorScheme === undefined
|
|
328
|
+
? NativeJsx.visitor(api, callables)
|
|
329
|
+
: {},
|
|
330
|
+
}
|
|
331
|
+
return plugin
|
|
332
|
+
}
|
package/src/cli/index.ts
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Exposes standalone compilation and recoverable development watching through Incur.
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import * as Fs from 'node:fs/promises'
|
|
7
|
+
import * as Path from 'node:path'
|
|
8
|
+
import { Cli, z } from 'incur'
|
|
9
|
+
import * as Host from '../node/Host.js'
|
|
10
|
+
|
|
11
|
+
const args = z.object({
|
|
12
|
+
src: z.string().optional().describe('Source directory (default: src)'),
|
|
13
|
+
})
|
|
14
|
+
const options = z.object({
|
|
15
|
+
target: z
|
|
16
|
+
.enum(['web', 'native'])
|
|
17
|
+
.default('web')
|
|
18
|
+
.describe('Compilation target'),
|
|
19
|
+
platform: z.enum(['ios', 'android']).optional().describe('Native platform'),
|
|
20
|
+
'color-scheme': z
|
|
21
|
+
.enum(['light', 'dark'])
|
|
22
|
+
.optional()
|
|
23
|
+
.describe('Native color scheme'),
|
|
24
|
+
'css-only': z
|
|
25
|
+
.boolean()
|
|
26
|
+
.default(false)
|
|
27
|
+
.describe('Emit only CSS and CSS maps without source transformation'),
|
|
28
|
+
minify: z.boolean().default(false).describe('Minify emitted CSS'),
|
|
29
|
+
'out-dir': z.string().default('dist').describe('Output directory'),
|
|
30
|
+
'package-id': z
|
|
31
|
+
.string()
|
|
32
|
+
.optional()
|
|
33
|
+
.describe('Stable compiled package identity'),
|
|
34
|
+
script: z
|
|
35
|
+
.string()
|
|
36
|
+
.optional()
|
|
37
|
+
.describe('Initialization script path (default: <out-dir>/zyzz.js)'),
|
|
38
|
+
})
|
|
39
|
+
const { version } = JSON.parse(
|
|
40
|
+
await Fs.readFile(new URL('../../package.json', import.meta.url), 'utf8'),
|
|
41
|
+
) as { version: string }
|
|
42
|
+
|
|
43
|
+
await Cli.create('zyzz', {
|
|
44
|
+
description: 'Compile source modules and CSS, or extract CSS only.',
|
|
45
|
+
version,
|
|
46
|
+
})
|
|
47
|
+
.command('build', {
|
|
48
|
+
args,
|
|
49
|
+
description: 'Compile once and publish the output.',
|
|
50
|
+
options,
|
|
51
|
+
async run(context) {
|
|
52
|
+
let host: Host.Runtime | undefined
|
|
53
|
+
const interrupt = () => {
|
|
54
|
+
process.exitCode = 130
|
|
55
|
+
}
|
|
56
|
+
const terminate = () => {
|
|
57
|
+
process.exitCode = 143
|
|
58
|
+
}
|
|
59
|
+
process.once('SIGINT', interrupt)
|
|
60
|
+
process.once('SIGTERM', terminate)
|
|
61
|
+
|
|
62
|
+
try {
|
|
63
|
+
host = await open(context)
|
|
64
|
+
return await host.build()
|
|
65
|
+
} finally {
|
|
66
|
+
try {
|
|
67
|
+
await host?.close()
|
|
68
|
+
} finally {
|
|
69
|
+
process.removeListener('SIGINT', interrupt)
|
|
70
|
+
process.removeListener('SIGTERM', terminate)
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
})
|
|
75
|
+
.command('dev', {
|
|
76
|
+
args,
|
|
77
|
+
description: 'Compile immediately and watch for changes.',
|
|
78
|
+
options,
|
|
79
|
+
async *run(context) {
|
|
80
|
+
const events: Host.Event[] = []
|
|
81
|
+
let host: Host.Runtime | undefined
|
|
82
|
+
let notify: (() => void) | undefined
|
|
83
|
+
let stopped = false
|
|
84
|
+
const stop = () => {
|
|
85
|
+
stopped = true
|
|
86
|
+
notify?.()
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
process.once('SIGINT', stop)
|
|
90
|
+
process.once('SIGTERM', stop)
|
|
91
|
+
|
|
92
|
+
try {
|
|
93
|
+
host = await open(context)
|
|
94
|
+
if (stopped) return
|
|
95
|
+
|
|
96
|
+
host.watch({
|
|
97
|
+
onResult(event) {
|
|
98
|
+
events.push(event)
|
|
99
|
+
notify?.()
|
|
100
|
+
},
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
while (!stopped) {
|
|
104
|
+
if (!events.length)
|
|
105
|
+
await new Promise<void>((resolve) => {
|
|
106
|
+
notify = resolve
|
|
107
|
+
})
|
|
108
|
+
notify = undefined
|
|
109
|
+
if (stopped) break
|
|
110
|
+
|
|
111
|
+
const event = events.shift()!
|
|
112
|
+
if ('error' in event)
|
|
113
|
+
yield {
|
|
114
|
+
message:
|
|
115
|
+
event.error instanceof Error
|
|
116
|
+
? event.error.message
|
|
117
|
+
: String(event.error),
|
|
118
|
+
status: 'error',
|
|
119
|
+
}
|
|
120
|
+
else yield { ...event.result, status: 'built' }
|
|
121
|
+
}
|
|
122
|
+
} finally {
|
|
123
|
+
try {
|
|
124
|
+
await host?.close()
|
|
125
|
+
} finally {
|
|
126
|
+
process.removeListener('SIGINT', stop)
|
|
127
|
+
process.removeListener('SIGTERM', stop)
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
})
|
|
132
|
+
.serve()
|
|
133
|
+
|
|
134
|
+
async function identity(): Promise<string> {
|
|
135
|
+
try {
|
|
136
|
+
const value: unknown = JSON.parse(await Fs.readFile('package.json', 'utf8'))
|
|
137
|
+
if (
|
|
138
|
+
value &&
|
|
139
|
+
typeof value === 'object' &&
|
|
140
|
+
'name' in value &&
|
|
141
|
+
typeof value.name === 'string'
|
|
142
|
+
)
|
|
143
|
+
return value.name
|
|
144
|
+
|
|
145
|
+
return 'app'
|
|
146
|
+
} catch (error) {
|
|
147
|
+
if (
|
|
148
|
+
error &&
|
|
149
|
+
typeof error === 'object' &&
|
|
150
|
+
'code' in error &&
|
|
151
|
+
error.code === 'ENOENT'
|
|
152
|
+
)
|
|
153
|
+
return 'app'
|
|
154
|
+
|
|
155
|
+
throw error
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
async function open(context: open.Context) {
|
|
160
|
+
const packageId = context.options['package-id'] ?? (await identity())
|
|
161
|
+
|
|
162
|
+
if (context.options.target === 'native') {
|
|
163
|
+
if (!context.options['color-scheme'])
|
|
164
|
+
throw new Error('Native builds require --color-scheme light or dark.')
|
|
165
|
+
if (context.options.script !== undefined)
|
|
166
|
+
throw new Error('Native builds do not emit an initialization script.')
|
|
167
|
+
} else if (context.options.platform || context.options['color-scheme'])
|
|
168
|
+
throw new Error('--platform and --color-scheme require --target native.')
|
|
169
|
+
|
|
170
|
+
return Host.create({
|
|
171
|
+
...(context.options.target === 'native'
|
|
172
|
+
? {
|
|
173
|
+
native: {
|
|
174
|
+
colorScheme: context.options['color-scheme']!,
|
|
175
|
+
platform: context.options.platform,
|
|
176
|
+
},
|
|
177
|
+
}
|
|
178
|
+
: {}),
|
|
179
|
+
compiler: !context.options['css-only'],
|
|
180
|
+
css: { minify: context.options.minify },
|
|
181
|
+
modules: !context.options['css-only'],
|
|
182
|
+
outDir: Path.resolve(context.options['out-dir']),
|
|
183
|
+
packageId,
|
|
184
|
+
root: Path.resolve(context.args.src ?? 'src'),
|
|
185
|
+
...(context.options.script === undefined
|
|
186
|
+
? {}
|
|
187
|
+
: { script: Path.resolve(context.options.script) }),
|
|
188
|
+
})
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
declare namespace open {
|
|
192
|
+
type Context = {
|
|
193
|
+
args: z.infer<typeof args>
|
|
194
|
+
options: z.infer<typeof options>
|
|
195
|
+
}
|
|
196
|
+
}
|