@fluentic/style 0.1.0-beta.2 → 0.1.0-beta.20
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/CHANGELOG.md +228 -16
- package/README.md +182 -49
- package/atomic/className.ts +33 -12
- package/atomic/debug/className/className.ts +10 -15
- package/atomic/element.ts +2 -2
- package/atomic/layer/layer.ts +7 -3
- package/atomic/rule.ts +20 -6
- package/atomic/scope.ts +19 -0
- package/atomic/theme.ts +41 -2
- package/atomic/token.ts +13 -3
- package/atomic/utils/{css.ts → cssIdent.ts} +0 -20
- package/atomic/utils/cssVar.ts +19 -0
- package/atomic/utils/debug.ts +1 -1
- package/atomic/utils/hash.ts +1 -65
- package/atomic/utils/selector.ts +40 -1
- package/atomic/utils/types.ts +4 -2
- package/builder/classname/class_name_builder.ts +68 -24
- package/builder/classname/fns.ts +2 -2
- package/builder/classname/types.ts +7 -0
- package/builder/data/const.ts +10 -1
- package/builder/data/create.ts +46 -0
- package/builder/data/data.ts +26 -1
- package/builder/data/index.ts +0 -1
- package/builder/data/is.ts +23 -0
- package/builder/data/merge/scope.ts +27 -19
- package/builder/data/merge/style.ts +115 -46
- package/builder/data/state.ts +17 -2
- package/builder/extract/index.ts +1 -0
- package/builder/extract/sheet.ts +30 -0
- package/builder/extract/token.ts +40 -14
- package/builder/extract/utils.ts +2 -0
- package/builder/extract/withTokens.ts +2 -1
- package/builder/selector_override.noop.ts +11 -0
- package/builder/selector_override.ts +31 -0
- package/builder/selector_override_core.ts +99 -0
- package/builder/style_builder.ts +127 -3
- package/builder/style_data.ts +25 -0
- package/builder/style_fns.ts +24 -24
- package/builder/token/data.ts +30 -0
- package/builder/token/index.ts +3 -0
- package/builder/token/name.ts +54 -0
- package/builder/token/symbols.ts +6 -0
- package/builder/types/alias.ts +34 -6
- package/builder/types/fns.ts +13 -5
- package/builder/types/types.ts +32 -2
- package/builder/utils.ts +1 -0
- package/compiler/compiler/cache_identity.ts +115 -0
- package/compiler/compiler/compiler.ts +123 -18
- package/compiler/compiler/constants.ts +6 -0
- package/compiler/compiler/index.ts +1 -0
- package/compiler/compiler/persistent_cache.ts +310 -0
- package/compiler/compiler/types.ts +16 -1
- package/compiler/cssProp.ts +21 -0
- package/compiler/extract/collector.ts +2 -2
- package/compiler/extract/extract.ts +24 -45
- package/compiler/extract/types.ts +6 -0
- package/compiler/index.ts +1 -0
- package/compiler/transform/cssProp/index.ts +1 -0
- package/compiler/transform/cssProp/plugin.ts +161 -0
- package/compiler/transform/debug/plugin.ts +107 -1
- package/compiler/transform/debug/transform.ts +2 -1
- package/compiler/transform/evaluator/evaluator.ts +223 -38
- package/compiler/transform/evaluator/lazy_bindings.ts +63 -0
- package/compiler/transform/evaluator/metadata_cache.ts +124 -0
- package/compiler/transform/evaluator/tracer.ts +151 -89
- package/compiler/transform/extract/chain/chain.ts +794 -84
- package/compiler/transform/extract/chain/extract_chain.ts +28 -4
- package/compiler/transform/extract/chain/types.ts +3 -1
- package/compiler/transform/extract/plugin.ts +159 -42
- package/compiler/transform/extract/transform.ts +2 -1
- package/compiler/transform/extract/utils/imports.ts +8 -1
- package/compiler/transform/extract/utils/replacement.ts +92 -5
- package/compiler/transform/extract/utils/state.ts +8 -2
- package/compiler/transform/extract/utils/theme.ts +6 -6
- package/compiler/transform/extract/utils/token.ts +107 -0
- package/compiler/transform/index.ts +1 -0
- package/compiler/transform/syntax/isStaticStyleValue.ts +15 -9
- package/compiler/transform/syntax/static_ids.ts +1 -1
- package/compiler/transform/utils/babel.ts +1 -1
- package/compiler/utils/check_diagnostics.ts +18 -0
- package/compiler/utils/constants.ts +10 -5
- package/compiler/utils/file_resolver.ts +27 -1
- package/compiler/utils/import_source.ts +17 -7
- package/compiler/utils/imports.ts +11 -1
- package/config/build.ts +9 -2
- package/config/config/check.ts +25 -0
- package/config/config/css.ts +36 -1
- package/config/config/debug.ts +24 -1
- package/config/config/dev.ts +8 -0
- package/config/configure.ts +23 -2
- package/config/document.ts +23 -0
- package/css/globalSheet.ts +66 -0
- package/css/index.ts +5 -0
- package/css/sheet.ts +173 -0
- package/css/styleTarget.ts +251 -0
- package/dev/config.ts +2 -3
- package/dev/utils.ts +3 -3
- package/dialect/namedTokens.ts +30 -8
- package/dist/adapter/preact.js +2 -0
- package/dist/adapter/react.js +2 -0
- package/dist/adapter/solid.js +2 -0
- package/dist/className-CC5PHcXI.js +311 -0
- package/dist/className-CC5PHcXI.js.map +1 -0
- package/dist/{style-DUztHzBz.js → combine-CtR6MyD4.js} +402 -733
- package/dist/combine-CtR6MyD4.js.map +1 -0
- package/dist/compiler/index.mjs +2 -2
- package/dist/{compiler-BXcGyZUP.mjs → compiler-oXXProzz.mjs} +3092 -850
- package/dist/compiler-oXXProzz.mjs.map +1 -0
- package/dist/config/index.js +2 -2
- package/dist/config-BK7oK4Hx.js +57 -0
- package/dist/config-BK7oK4Hx.js.map +1 -0
- package/dist/config-BWFlaJ_v.js +6 -0
- package/dist/config-BWFlaJ_v.js.map +1 -0
- package/dist/config-BsF-QRgz.js +6 -0
- package/dist/{config-DcYrUB-M.js.map → config-BsF-QRgz.js.map} +1 -1
- package/dist/{config-C1k9vUrM.js → config-DKaGtG9O.js} +9 -7
- package/dist/config-DKaGtG9O.js.map +1 -0
- package/dist/config-IFmsTOQp.js +1 -0
- package/dist/css-B-7-Do-J.js +4541 -0
- package/dist/css-B-7-Do-J.js.map +1 -0
- package/dist/{css-CohHH2tn.js → css-BmIytNon.js} +185 -14
- package/dist/css-BmIytNon.js.map +1 -0
- package/dist/css-CYnQKnPu.js +563 -0
- package/dist/css-CYnQKnPu.js.map +1 -0
- package/dist/css.js +2 -2
- package/dist/{css_extra-DQdCrYoC.js → css_extra-Br7eDCrf.js} +2 -2
- package/dist/{css_extra-9BZ_jVET.js.map → css_extra-Br7eDCrf.js.map} +1 -1
- package/dist/{css_extra-9BZ_jVET.js → css_extra-qzi_eFFf.js} +2 -2
- package/dist/{css_extra-DQdCrYoC.js.map → css_extra-qzi_eFFf.js.map} +1 -1
- package/dist/data-D6dD67li.js +786 -0
- package/dist/data-D6dD67li.js.map +1 -0
- package/dist/debug-Bo43rBKc.js +73 -0
- package/dist/debug-Bo43rBKc.js.map +1 -0
- package/dist/dev/rsc.js +138 -28
- package/dist/dev/rsc.js.map +1 -1
- package/dist/{dev-C2u78xuv.js → dev-_DW5n4U4.js} +9 -10
- package/dist/dev-_DW5n4U4.js.map +1 -0
- package/dist/dev.js +1 -1
- package/dist/dialect/extracted/index.js +1 -1
- package/dist/dialect/index.js +1 -1
- package/dist/{elementMarker-BKzZyg5V.js → elementMarker-u0d2LH8r.js} +582 -61
- package/dist/elementMarker-u0d2LH8r.js.map +1 -0
- package/dist/entry/dev/adapter/preact.js +12 -0
- package/dist/entry/dev/adapter/preact.js.map +1 -0
- package/dist/entry/dev/adapter/react.js +12 -0
- package/dist/entry/dev/adapter/react.js.map +1 -0
- package/dist/entry/dev/adapter/solid.js +12 -0
- package/dist/entry/dev/adapter/solid.js.map +1 -0
- package/dist/entry/dev/css.js +3 -3
- package/dist/entry/dev/jsx-dev-runtime.js +2 -2
- package/dist/entry/dev/jsx-runtime.js +2 -2
- package/dist/entry/dev.js +13 -12
- package/dist/entry/prod/adapter/preact.js +12 -0
- package/dist/entry/prod/adapter/preact.js.map +1 -0
- package/dist/entry/prod/adapter/react.js +12 -0
- package/dist/entry/prod/adapter/react.js.map +1 -0
- package/dist/entry/prod/adapter/solid.js +12 -0
- package/dist/entry/prod/adapter/solid.js.map +1 -0
- package/dist/entry/prod/css.js +3 -3
- package/dist/entry/prod/extract.js +251 -3
- package/dist/entry/prod/extract.js.map +1 -0
- package/dist/entry/prod/jsx-dev-runtime.js +2 -2
- package/dist/entry/prod/jsx-runtime.js +2 -2
- package/dist/entry/prod/runtime.js +3 -4
- package/dist/entry/prod.js +84 -1201
- package/dist/entry/prod.js.map +1 -1
- package/dist/entry/rsc-dev/adapter/preact.js +13 -0
- package/dist/entry/rsc-dev/adapter/preact.js.map +1 -0
- package/dist/entry/rsc-dev/adapter/react.js +13 -0
- package/dist/entry/rsc-dev/adapter/react.js.map +1 -0
- package/dist/entry/rsc-dev/adapter/solid.js +13 -0
- package/dist/entry/rsc-dev/adapter/solid.js.map +1 -0
- package/dist/entry/rsc-dev/css.js +4 -3
- package/dist/entry/rsc-dev/dev.js +135 -32
- package/dist/entry/rsc-dev/dev.js.map +1 -1
- package/dist/entry/rsc-dev/jsx-dev-runtime.js +5 -4
- package/dist/entry/rsc-dev/jsx-dev-runtime.js.map +1 -1
- package/dist/entry/rsc-dev/jsx-runtime.js +2 -2
- package/dist/entry/rsc-dev.js +298 -616
- package/dist/entry/rsc-dev.js.map +1 -1
- package/dist/entry/rsc-prod/adapter/preact.js +2 -0
- package/dist/entry/rsc-prod/adapter/react.js +2 -0
- package/dist/entry/rsc-prod/adapter/solid.js +2 -0
- package/dist/entry/rsc-prod/css.js +9 -3
- package/dist/entry/rsc-prod/css.js.map +1 -0
- package/dist/entry/rsc-prod/jsx-dev-runtime.js +2 -2
- package/dist/entry/rsc-prod/jsx-runtime.js +2 -2
- package/dist/entry/rsc-prod/runtime.js +3 -4
- package/dist/entry/rsc-prod.js +251 -10
- package/dist/entry/rsc-prod.js.map +1 -0
- package/dist/{rules-Dz7Pu2K6.js → env-C8lKN1dB.js} +727 -147
- package/dist/env-C8lKN1dB.js.map +1 -0
- package/dist/{getClassName-C6690_nr.js → getClassName-BraU01Hd.js} +60 -15
- package/dist/getClassName-BraU01Hd.js.map +1 -0
- package/dist/getClassName-C35yO40s.js +548 -0
- package/dist/getClassName-C35yO40s.js.map +1 -0
- package/dist/getClassName-CfkGcBZy.js +49 -0
- package/dist/getClassName-CfkGcBZy.js.map +1 -0
- package/dist/{utils-D4YWF2K0.js → getClassName-i4oy2Up_.js} +27 -65
- package/dist/getClassName-i4oy2Up_.js.map +1 -0
- package/dist/{global-zaCE-g1C.js → global-DGcWZODV.js} +7 -8
- package/dist/global-DGcWZODV.js.map +1 -0
- package/dist/globalSheet-2ozCV1Zm.js +1091 -0
- package/dist/globalSheet-2ozCV1Zm.js.map +1 -0
- package/dist/hash-CGO13tOn.js +407 -0
- package/dist/hash-CGO13tOn.js.map +1 -0
- package/dist/index.js +10 -10
- package/dist/jsx/jsx-dev-runtime.js +2 -2
- package/dist/jsx/jsx-dev-runtime.server.js +3 -3
- package/dist/jsx/jsx-dev-runtime.server.js.map +1 -1
- package/dist/jsx/jsx-runtime.js +2 -2
- package/dist/jsx/jsx-runtime.server.js +4 -4
- package/dist/jsx/jsx-runtime.server.js.map +1 -1
- package/dist/jsx-C-v1b99-.js +39 -0
- package/dist/jsx-C-v1b99-.js.map +1 -0
- package/dist/{jsx_dev_runtime-DXlSD6kV.js → jsx_dev_runtime-Bd7FO7C1.js} +2 -3
- package/dist/{jsx_dev_runtime-DXlSD6kV.js.map → jsx_dev_runtime-Bd7FO7C1.js.map} +1 -1
- package/dist/jsx_runtime-BxumFGUy.js +13 -0
- package/dist/jsx_runtime-BxumFGUy.js.map +1 -0
- package/dist/{jsx_runtime-DPWo5qvV.js → jsx_runtime-gO4GQFcW.js} +3 -3
- package/dist/{jsx_runtime-CMdEXGNZ.js.map → jsx_runtime-gO4GQFcW.js.map} +1 -1
- package/dist/{loader-DCT1Q9yi.mjs → loader-A15L-NVK.mjs} +13 -14
- package/dist/loader-A15L-NVK.mjs.map +1 -0
- package/dist/{misc-o8pviMUi.mjs → misc-CRRQr1DT.mjs} +35 -8
- package/dist/misc-CRRQr1DT.mjs.map +1 -0
- package/dist/{namedTokens-BUa6raTb.js → namedTokens-paLD-Pdk.js} +15 -9
- package/dist/namedTokens-paLD-Pdk.js.map +1 -0
- package/dist/plugin/farm/index.mjs +5 -4
- package/dist/plugin/farm/index.mjs.map +1 -1
- package/dist/plugin/nextjs/index.mjs +153 -33
- package/dist/plugin/nextjs/index.mjs.map +1 -1
- package/dist/plugin/nextjs/loader.mjs +7 -5
- package/dist/plugin/nextjs/loader.mjs.map +1 -1
- package/dist/plugin/parcel/index.cjs +2 -0
- package/dist/plugin/parcel/index.mjs +3 -1
- package/dist/plugin/parcel/optimizer.cjs +3 -2
- package/dist/plugin/parcel/optimizer.cjs.map +1 -1
- package/dist/plugin/parcel/optimizer.mjs +3 -2
- package/dist/plugin/parcel/optimizer.mjs.map +1 -1
- package/dist/plugin/parcel/resolver.cjs +1 -1
- package/dist/plugin/parcel/resolver.mjs +2 -2
- package/dist/plugin/parcel/runtime.cjs +1 -1
- package/dist/plugin/parcel/runtime.mjs +1 -1
- package/dist/plugin/parcel/transformer.cjs +1 -1
- package/dist/plugin/parcel/transformer.mjs +2 -2
- package/dist/plugin/rspack/index.mjs +3 -2
- package/dist/plugin/rspack/index.mjs.map +1 -1
- package/dist/plugin/vite/index.mjs +26 -23
- package/dist/plugin/vite/index.mjs.map +1 -1
- package/dist/plugin/webpack/index.mjs +3 -2
- package/dist/plugin/webpack/loader.mjs +2 -2
- package/dist/presets/tailwind/index.js +32 -8
- package/dist/presets/tailwind/index.js.map +1 -1
- package/dist/{assert-BGdigdr5.js → presets-DSanixJV.js} +106 -2
- package/dist/presets-DSanixJV.js.map +1 -0
- package/dist/{registry-D3x1EDJm.mjs → registry-D2C6hTdx.mjs} +2 -2
- package/dist/{registry-D3x1EDJm.mjs.map → registry-D2C6hTdx.mjs.map} +1 -1
- package/dist/resolveClassNameRuntime-Cp8_UcxF.js +63 -0
- package/dist/resolveClassNameRuntime-Cp8_UcxF.js.map +1 -0
- package/dist/scope-Dg83Az-2.js +601 -0
- package/dist/scope-Dg83Az-2.js.map +1 -0
- package/dist/selector/index.js +1 -2
- package/dist/server.js +91 -17
- package/dist/server.js.map +1 -1
- package/dist/{shared-B_gJf5uj.cjs → shared-B7Nw_dcx.cjs} +3152 -891
- package/dist/shared-B7Nw_dcx.cjs.map +1 -0
- package/dist/{shared-uAzFeq0x.mjs → shared-BmJmaxu8.mjs} +5 -5
- package/dist/shared-BmJmaxu8.mjs.map +1 -0
- package/dist/sheet-CHnDkjn4.js +56 -0
- package/dist/sheet-CHnDkjn4.js.map +1 -0
- package/dist/sheet-PVxRQrOp.js +7 -0
- package/dist/sheet-PVxRQrOp.js.map +1 -0
- package/dist/sheet-ueNBw_2u.js +1 -0
- package/dist/{sidecar-BUO1hKXu.mjs → sidecar-DVegwGec.mjs} +3 -3
- package/dist/{sidecar-BUO1hKXu.mjs.map → sidecar-DVegwGec.mjs.map} +1 -1
- package/dist/{style-BkeAZl0n.js → style-B1tkE8zl.js} +329 -129
- package/dist/style-B1tkE8zl.js.map +1 -0
- package/dist/styleStore-BK2XBS8n.js +45 -0
- package/dist/styleStore-BK2XBS8n.js.map +1 -0
- package/dist/styleStore-D4umgIwQ.js +3457 -0
- package/dist/styleStore-D4umgIwQ.js.map +1 -0
- package/dist/token-BX5jRxMb.js +110 -0
- package/dist/token-BX5jRxMb.js.map +1 -0
- package/dist/token-CS0iRIIa.js +140 -0
- package/dist/token-CS0iRIIa.js.map +1 -0
- package/dist/{trace-D0IL6JT8.js → trace-DZYKSwdB.js} +2 -2
- package/dist/{trace-D0IL6JT8.js.map → trace-DZYKSwdB.js.map} +1 -1
- package/dist/{trace-DR7_Rpkg.js → trace-EEKXwKSr.js} +3 -3
- package/dist/{trace-DR7_Rpkg.js.map → trace-EEKXwKSr.js.map} +1 -1
- package/dist/{transform-BTJOg8Hg.js → transform-BZ4jPwy3.js} +2 -2
- package/dist/transform-BZ4jPwy3.js.map +1 -0
- package/dist/types/adapter/preact.d.ts +1 -0
- package/dist/types/adapter/react.d.ts +1 -0
- package/dist/types/adapter/solid.d.ts +1 -0
- package/dist/types/atomic/atRule/counterStyle.d.ts +10 -0
- package/dist/types/atomic/atRule/fontFace.d.ts +10 -0
- package/dist/types/atomic/atRule/fontPaletteValues.d.ts +10 -0
- package/dist/types/atomic/atRule/fontSrc.d.ts +1 -0
- package/dist/types/atomic/atRule/keyframes.d.ts +13 -0
- package/dist/types/atomic/atRule/positionTry.d.ts +13 -0
- package/dist/types/atomic/atRule/property.d.ts +13 -0
- package/dist/types/atomic/atRule/utils.d.ts +5 -0
- package/dist/types/atomic/className.d.ts +11 -0
- package/dist/types/atomic/debug/className/className.d.ts +9 -0
- package/dist/types/atomic/debug/className/index.d.ts +1 -0
- package/dist/types/atomic/debug/property/data.d.ts +3 -0
- package/dist/types/atomic/debug/property/index.d.ts +1 -0
- package/dist/types/atomic/debug/property/property.d.ts +5 -0
- package/dist/types/atomic/debug/selector.d.ts +2 -0
- package/dist/types/atomic/debug/value.d.ts +5 -0
- package/dist/types/atomic/element.d.ts +5 -0
- package/dist/types/atomic/layer/index.d.ts +3 -0
- package/dist/types/atomic/layer/layer.d.ts +12 -0
- package/dist/types/atomic/layer/types.d.ts +30 -0
- package/dist/types/atomic/layer/utils.d.ts +4 -0
- package/dist/types/atomic/property/index.d.ts +2 -0
- package/dist/types/atomic/property/presets.d.ts +4 -0
- package/dist/types/atomic/property/property.d.ts +3 -0
- package/dist/types/atomic/property/type_maps.d.ts +31 -0
- package/dist/types/atomic/property/types.d.ts +4 -0
- package/dist/types/atomic/rule.d.ts +5 -0
- package/dist/types/atomic/scope.d.ts +3 -0
- package/dist/types/atomic/theme.d.ts +7 -0
- package/dist/types/atomic/token.d.ts +7 -0
- package/dist/types/atomic/utils/cssIdent.d.ts +2 -0
- package/dist/types/atomic/utils/cssVar.d.ts +3 -0
- package/dist/types/atomic/utils/debug.d.ts +4 -0
- package/dist/types/atomic/utils/format.d.ts +5 -0
- package/dist/types/atomic/utils/hash.d.ts +1 -0
- package/dist/types/atomic/utils/selector.d.ts +7 -0
- package/dist/types/atomic/utils/types.d.ts +8 -0
- package/dist/types/atomic/value/index.d.ts +2 -0
- package/dist/types/atomic/value/unitless.d.ts +1 -0
- package/dist/types/atomic/value/value.d.ts +2 -0
- package/dist/types/atomic/var.d.ts +4 -0
- package/dist/types/builder/classname/class_name_builder.d.ts +4 -0
- package/dist/types/builder/classname/fns.d.ts +48 -0
- package/dist/types/builder/classname/index.d.ts +3 -0
- package/dist/types/builder/classname/types.d.ts +18 -0
- package/dist/types/builder/data/check_selector.d.ts +2 -0
- package/dist/types/builder/data/const.d.ts +27 -0
- package/dist/types/builder/data/create.d.ts +13 -0
- package/dist/types/builder/data/data.d.ts +44 -0
- package/dist/types/builder/data/debug.d.ts +38 -0
- package/dist/types/builder/data/index.d.ts +8 -0
- package/dist/types/builder/data/is.d.ts +16 -0
- package/dist/types/builder/data/merge/index.d.ts +2 -0
- package/dist/types/builder/data/merge/scope.d.ts +7 -0
- package/dist/types/builder/data/merge/style.d.ts +6 -0
- package/dist/types/builder/data/merge/utils.d.ts +10 -0
- package/dist/types/builder/data/selector.d.ts +8 -0
- package/dist/types/builder/data/state.d.ts +100 -0
- package/dist/types/builder/extract/index.d.ts +7 -0
- package/dist/types/builder/extract/scope.d.ts +14 -0
- package/dist/types/builder/extract/sheet.d.ts +10 -0
- package/dist/types/builder/extract/slot.d.ts +9 -0
- package/dist/types/builder/extract/style.d.ts +11 -0
- package/dist/types/builder/extract/theme.d.ts +2 -0
- package/dist/types/builder/extract/token.d.ts +12 -0
- package/dist/types/builder/extract/utils.d.ts +28 -0
- package/dist/types/builder/extract/withTokens.d.ts +10 -0
- package/dist/types/builder/index.d.ts +2 -0
- package/dist/types/builder/selector_override.d.ts +5 -0
- package/dist/types/builder/selector_override_core.d.ts +8 -0
- package/dist/types/builder/style_builder.d.ts +15 -0
- package/dist/types/builder/style_data.d.ts +8 -0
- package/dist/types/builder/style_fns.d.ts +14 -0
- package/dist/types/builder/token/data.d.ts +10 -0
- package/dist/types/builder/token/name.d.ts +3 -0
- package/dist/types/builder/token/symbols.d.ts +4 -0
- package/dist/types/builder/types/alias.d.ts +59 -0
- package/dist/types/builder/types/fns.d.ts +115 -0
- package/dist/types/builder/types/index.d.ts +1 -0
- package/dist/types/builder/types/types.d.ts +22 -0
- package/dist/types/builder/utils.d.ts +9 -0
- package/dist/types/compiler/compiler/cache.d.ts +24 -0
- package/dist/types/compiler/compiler/cache_identity.d.ts +4 -0
- package/dist/types/compiler/compiler/compiler.d.ts +40 -0
- package/dist/types/compiler/compiler/constants.d.ts +6 -0
- package/dist/types/compiler/compiler/index.d.ts +4 -0
- package/dist/types/compiler/compiler/persistent_cache.d.ts +14 -0
- package/dist/types/compiler/compiler/types.d.ts +64 -0
- package/dist/types/compiler/cssProp.d.ts +8 -0
- package/dist/types/compiler/extract/collector.d.ts +8 -0
- package/dist/types/compiler/extract/extract.d.ts +6 -0
- package/dist/types/compiler/extract/index.d.ts +3 -0
- package/dist/types/compiler/extract/types.d.ts +29 -0
- package/dist/types/compiler/index.d.ts +3 -0
- package/dist/types/compiler/transform/cssProp/index.d.ts +1 -0
- package/dist/types/compiler/transform/cssProp/plugin.d.ts +13 -0
- package/dist/types/compiler/transform/debug/index.d.ts +2 -0
- package/dist/types/compiler/transform/debug/plugin.d.ts +34 -0
- package/dist/types/compiler/transform/debug/transform.d.ts +7 -0
- package/dist/types/compiler/transform/debug/utils/debug_data.d.ts +11 -0
- package/dist/types/compiler/transform/debug/utils/source_url.d.ts +2 -0
- package/dist/types/compiler/transform/evaluator/evaluator.d.ts +58 -0
- package/dist/types/compiler/transform/evaluator/index.d.ts +3 -0
- package/dist/types/compiler/transform/evaluator/lazy_bindings.d.ts +22 -0
- package/dist/types/compiler/transform/evaluator/metadata_cache.d.ts +13 -0
- package/dist/types/compiler/transform/evaluator/tracer.d.ts +15 -0
- package/dist/types/compiler/transform/evaluator/types.d.ts +21 -0
- package/dist/types/compiler/transform/extract/chain/chain.d.ts +18 -0
- package/dist/types/compiler/transform/extract/chain/extract_chain.d.ts +21 -0
- package/dist/types/compiler/transform/extract/chain/index.d.ts +3 -0
- package/dist/types/compiler/transform/extract/chain/types.d.ts +32 -0
- package/dist/types/compiler/transform/extract/index.d.ts +2 -0
- package/dist/types/compiler/transform/extract/plugin.d.ts +20 -0
- package/dist/types/compiler/transform/extract/transform.d.ts +10 -0
- package/dist/types/compiler/transform/extract/utils/imports.d.ts +3 -0
- package/dist/types/compiler/transform/extract/utils/replacement.d.ts +11 -0
- package/dist/types/compiler/transform/extract/utils/slot.d.ts +4 -0
- package/dist/types/compiler/transform/extract/utils/state.d.ts +36 -0
- package/dist/types/compiler/transform/extract/utils/theme.d.ts +9 -0
- package/dist/types/compiler/transform/extract/utils/token.d.ts +4 -0
- package/dist/types/compiler/transform/index.d.ts +5 -0
- package/dist/types/compiler/transform/syntax/index.d.ts +5 -0
- package/dist/types/compiler/transform/syntax/isStaticStyleValue.d.ts +2 -0
- package/dist/types/compiler/transform/syntax/isStyleChainCall.d.ts +2 -0
- package/dist/types/compiler/transform/syntax/static_ids.d.ts +16 -0
- package/dist/types/compiler/transform/syntax/types.d.ts +4 -0
- package/dist/types/compiler/transform/syntax/utils.d.ts +5 -0
- package/dist/types/compiler/transform/utils/babel.d.ts +21 -0
- package/dist/types/compiler/transform/utils/import.d.ts +2 -0
- package/dist/types/compiler/transform/utils/path.d.ts +1 -0
- package/dist/types/compiler/transform/utils/selector.d.ts +18 -0
- package/dist/types/compiler/utils/check_diagnostics.d.ts +7 -0
- package/dist/types/compiler/utils/constants.d.ts +70 -0
- package/dist/types/compiler/utils/file_resolver.d.ts +16 -0
- package/dist/types/compiler/utils/import_source.d.ts +34 -0
- package/dist/types/compiler/utils/imports.d.ts +6 -0
- package/dist/types/compiler/utils/path.d.ts +4 -0
- package/dist/types/compiler/utils/sourcemap.d.ts +36 -0
- package/dist/types/config/build.d.ts +20 -0
- package/dist/types/config/config/check.d.ts +11 -0
- package/dist/types/config/config/css.d.ts +29 -0
- package/dist/types/config/config/css_extra.d.ts +13 -0
- package/dist/types/config/config/debug.d.ts +14 -0
- package/dist/types/config/config/dev.d.ts +36 -0
- package/dist/types/config/config/runtime.d.ts +10 -0
- package/dist/types/config/configure.d.ts +14 -0
- package/dist/types/config/constants.d.ts +1 -0
- package/dist/types/config/document.d.ts +3 -0
- package/dist/types/config/index.d.ts +2 -0
- package/dist/types/config/types.d.ts +47 -0
- package/dist/types/config/utils.d.ts +2 -0
- package/dist/types/css/counterStyle.d.ts +4 -0
- package/dist/types/css/fontFace.d.ts +5 -0
- package/dist/types/css/fontPaletteValues.d.ts +4 -0
- package/dist/types/css/globalSheet.d.ts +24 -0
- package/dist/types/css/index.d.ts +12 -0
- package/dist/types/css/keyframes.d.ts +4 -0
- package/dist/types/css/positionTry.d.ts +4 -0
- package/dist/types/css/property.d.ts +7 -0
- package/dist/types/css/sheet.d.ts +8 -0
- package/dist/types/css/styleTarget.d.ts +9 -0
- package/dist/types/css/utils.d.ts +19 -0
- package/dist/types/dev/config.d.ts +6 -0
- package/dist/types/dev/fns.d.ts +14 -0
- package/dist/types/dev/index.d.ts +2 -0
- package/dist/types/dev/trace.d.ts +8 -0
- package/dist/types/dev/utils.d.ts +5 -0
- package/dist/types/dialect/extracted/index.d.ts +1 -0
- package/dist/types/dialect/index.d.ts +1 -0
- package/dist/types/dialect/namedTokens.d.ts +9 -0
- package/dist/types/entry/dev/adapter/preact.d.ts +1 -0
- package/dist/types/entry/dev/adapter/react.d.ts +1 -0
- package/dist/types/entry/dev/adapter/solid.d.ts +1 -0
- package/dist/types/entry/dev/config.d.ts +2 -0
- package/dist/types/entry/dev/css.d.ts +2 -0
- package/dist/types/entry/dev/index.d.ts +3 -0
- package/dist/types/entry/dev/jsx_dev_runtime.d.ts +3 -0
- package/dist/types/entry/dev/sheet.d.ts +1 -0
- package/dist/types/entry/prod/adapter/preact.d.ts +1 -0
- package/dist/types/entry/prod/adapter/react.d.ts +1 -0
- package/dist/types/entry/prod/adapter/solid.d.ts +1 -0
- package/dist/types/entry/prod/config.d.ts +2 -0
- package/dist/types/entry/prod/config_debug.d.ts +2 -0
- package/dist/types/entry/prod/css.d.ts +2 -0
- package/dist/types/entry/prod/extract.d.ts +1 -0
- package/dist/types/entry/prod/index.d.ts +2 -0
- package/dist/types/entry/prod/jsx_runtime.d.ts +2 -0
- package/dist/types/entry/prod/runtime.d.ts +8 -0
- package/dist/types/entry/rsc_dev/adapter/preact.d.ts +1 -0
- package/dist/types/entry/rsc_dev/adapter/react.d.ts +1 -0
- package/dist/types/entry/rsc_dev/adapter/solid.d.ts +1 -0
- package/dist/types/entry/rsc_dev/config.d.ts +2 -0
- package/dist/types/entry/rsc_dev/css.d.ts +3 -0
- package/dist/types/entry/rsc_dev/index.d.ts +2 -0
- package/dist/types/entry/rsc_dev/server.d.ts +10 -0
- package/dist/types/entry/rsc_prod/adapter/preact.d.ts +1 -0
- package/dist/types/entry/rsc_prod/adapter/react.d.ts +1 -0
- package/dist/types/entry/rsc_prod/adapter/solid.d.ts +1 -0
- package/dist/types/entry/rsc_prod/config.d.ts +2 -0
- package/dist/types/entry/rsc_prod/config_debug.d.ts +2 -0
- package/dist/types/entry/rsc_prod/css.d.ts +2 -0
- package/dist/types/entry/rsc_prod/index.d.ts +2 -0
- package/dist/types/entry/rsc_prod/jsx_runtime.d.ts +2 -0
- package/dist/types/entry/rsc_prod/runtime.d.ts +4 -0
- package/dist/types/entry/rsc_prod/server.d.ts +6 -0
- package/dist/types/entry/shared/config.d.ts +1 -0
- package/dist/types/entry/shared/config_debug.d.ts +1 -0
- package/dist/types/entry/shared/config_dev.d.ts +1 -0
- package/dist/types/entry/shared/dev.d.ts +1 -0
- package/dist/types/entry/shared/prod.d.ts +1 -0
- package/dist/types/entry/shared/utils.d.ts +2 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/jsx/extracted/jsx_runtime.d.ts +7 -0
- package/dist/types/jsx/rsc/jsx_runtime.d.ts +7 -0
- package/dist/types/jsx/rsc_extracted/jsx_runtime.d.ts +2 -0
- package/dist/types/jsx/runtime/jsx_dev_runtime.d.ts +6 -0
- package/dist/types/jsx/runtime/jsx_runtime.d.ts +7 -0
- package/dist/types/jsx/types/index.d.ts +1 -0
- package/dist/types/jsx/types/preact.d.ts +12 -0
- package/dist/types/jsx/types/react.d.ts +10 -0
- package/dist/types/jsx/types/solid.d.ts +12 -0
- package/dist/types/jsx/utils.d.ts +19 -0
- package/dist/types/plugin/bundler/farm/index.d.ts +1 -0
- package/dist/types/plugin/bundler/farm/plugin.d.ts +97 -0
- package/dist/types/plugin/bundler/parcel/index.d.ts +1 -0
- package/dist/types/plugin/bundler/parcel/optimizer.d.ts +3 -0
- package/dist/types/plugin/bundler/parcel/plugin.d.ts +6 -0
- package/dist/types/plugin/bundler/parcel/resolver.d.ts +3 -0
- package/dist/types/plugin/bundler/parcel/runtime.d.ts +3 -0
- package/dist/types/plugin/bundler/parcel/shared.d.ts +37 -0
- package/dist/types/plugin/bundler/parcel/transformer.d.ts +3 -0
- package/dist/types/plugin/bundler/rspack/index.d.ts +1 -0
- package/dist/types/plugin/bundler/rspack/plugin.d.ts +7 -0
- package/dist/types/plugin/bundler/vite/index.d.ts +1 -0
- package/dist/types/plugin/bundler/vite/plugin.d.ts +6 -0
- package/dist/types/plugin/bundler/vite/state.d.ts +79 -0
- package/dist/types/plugin/bundler/webpack/index.d.ts +1 -0
- package/dist/types/plugin/bundler/webpack/loader.d.ts +2 -0
- package/dist/types/plugin/bundler/webpack/plugin.d.ts +11 -0
- package/dist/types/plugin/bundler/webpack/shared/loader.d.ts +31 -0
- package/dist/types/plugin/bundler/webpack/shared/registry.d.ts +4 -0
- package/dist/types/plugin/bundler/webpack/utils.d.ts +18 -0
- package/dist/types/plugin/nextjs/constants.d.ts +3 -0
- package/dist/types/plugin/nextjs/html.d.ts +1 -0
- package/dist/types/plugin/nextjs/index.d.ts +2 -0
- package/dist/types/plugin/nextjs/loader.d.ts +3 -0
- package/dist/types/plugin/nextjs/plugin.d.ts +5 -0
- package/dist/types/plugin/nextjs/types.d.ts +21 -0
- package/dist/types/plugin/nextjs/utils.d.ts +59 -0
- package/dist/types/plugin/utils/cache/css_cache.d.ts +34 -0
- package/dist/types/plugin/utils/cache/file.d.ts +4 -0
- package/dist/types/plugin/utils/cache/index.d.ts +2 -0
- package/dist/types/plugin/utils/compiler.d.ts +51 -0
- package/dist/types/plugin/utils/constants.d.ts +4 -0
- package/dist/types/plugin/utils/cssMarker.d.ts +4 -0
- package/dist/types/plugin/utils/cssOutput.d.ts +10 -0
- package/dist/types/plugin/utils/filter.d.ts +25 -0
- package/dist/types/plugin/utils/imports.d.ts +3 -0
- package/dist/types/plugin/utils/index.d.ts +10 -0
- package/dist/types/plugin/utils/injection.d.ts +3 -0
- package/dist/types/plugin/utils/misc.d.ts +1 -0
- package/dist/types/plugin/utils/runtimeEntry.d.ts +8 -0
- package/dist/types/plugin/utils/sidecar/index.d.ts +1 -0
- package/dist/types/plugin/utils/sidecar/server.d.ts +19 -0
- package/dist/types/plugin/utils/sidecar/sidecar.d.ts +17 -0
- package/dist/types/plugin/utils/sidecar/utils.d.ts +33 -0
- package/dist/types/plugin/utils/sourcemap.d.ts +9 -0
- package/dist/types/plugin/utils/virtual.d.ts +12 -0
- package/dist/types/presets/tailwind/classname/index.d.ts +2 -0
- package/dist/types/presets/tailwind/classname/transform.d.ts +8 -0
- package/dist/types/presets/tailwind/classname/types.d.ts +27 -0
- package/dist/types/presets/tailwind/index.d.ts +5 -0
- package/dist/types/presets/tailwind/selectors.d.ts +68 -0
- package/dist/types/presets/tailwind/style/index.d.ts +2 -0
- package/dist/types/presets/tailwind/style/transform.d.ts +8 -0
- package/dist/types/presets/tailwind/style/types.d.ts +149 -0
- package/dist/types/presets/tailwind/theme.d.ts +477 -0
- package/dist/types/presets/tailwind/types.d.ts +53 -0
- package/dist/types/runtime/adapter/utils.d.ts +12 -0
- package/dist/types/runtime/core/cache/combine.d.ts +6 -0
- package/dist/types/runtime/core/cache/combineRuntime.d.ts +1 -0
- package/dist/types/runtime/core/cache/item.d.ts +15 -0
- package/dist/types/runtime/core/cache/itemWithResolver.d.ts +4 -0
- package/dist/types/runtime/core/cache/pool.d.ts +16 -0
- package/dist/types/runtime/core/cache/prop.d.ts +19 -0
- package/dist/types/runtime/core/cache/propCache.d.ts +12 -0
- package/dist/types/runtime/core/cache/resolvedItem.d.ts +5 -0
- package/dist/types/runtime/core/cache/result.d.ts +9 -0
- package/dist/types/runtime/core/cache/stateItem.d.ts +14 -0
- package/dist/types/runtime/core/cache/token.d.ts +2 -0
- package/dist/types/runtime/core/cache/tokenValues.d.ts +26 -0
- package/dist/types/runtime/core/cache/utils/tree.d.ts +12 -0
- package/dist/types/runtime/core/cache/utils/walk.d.ts +1 -0
- package/dist/types/runtime/core/className.d.ts +18 -0
- package/dist/types/runtime/core/combinedStyle.d.ts +20 -0
- package/dist/types/runtime/core/createTransformElement.d.ts +4 -0
- package/dist/types/runtime/core/elementMarker.d.ts +12 -0
- package/dist/types/runtime/core/elementMarkerData.d.ts +7 -0
- package/dist/types/runtime/core/getClassName.d.ts +4 -0
- package/dist/types/runtime/core/getSheetRules.d.ts +3 -0
- package/dist/types/runtime/core/getToken.d.ts +3 -0
- package/dist/types/runtime/core/index.d.ts +5 -0
- package/dist/types/runtime/core/jsx.d.ts +1 -0
- package/dist/types/runtime/core/resolveClassNameRuntime.d.ts +8 -0
- package/dist/types/runtime/env.d.ts +2 -0
- package/dist/types/runtime/extract/combineStyle.d.ts +27 -0
- package/dist/types/runtime/extract/getClassName.d.ts +10 -0
- package/dist/types/runtime/extract/index.d.ts +6 -0
- package/dist/types/runtime/extract/jsx.d.ts +10 -0
- package/dist/types/runtime/extract/token.d.ts +5 -0
- package/dist/types/runtime/extract/tokenResolver.d.ts +2 -0
- package/dist/types/runtime/rsc/constants.d.ts +6 -0
- package/dist/types/runtime/rsc/dev.d.ts +11 -0
- package/dist/types/runtime/rsc/getClassName.d.ts +27 -0
- package/dist/types/runtime/rsc/globalSheet.d.ts +22 -0
- package/dist/types/runtime/rsc/index.d.ts +1 -0
- package/dist/types/runtime/rsc/jsx.d.ts +1 -0
- package/dist/types/runtime/rsc/observer.d.ts +10 -0
- package/dist/types/runtime/rsc/styleStore.d.ts +7 -0
- package/dist/types/runtime/sheet/document.d.ts +3 -0
- package/dist/types/runtime/sheet/element.d.ts +2 -0
- package/dist/types/runtime/sheet/global.d.ts +3 -0
- package/dist/types/runtime/sheet/index.d.ts +3 -0
- package/dist/types/runtime/sheet/insert.d.ts +5 -0
- package/dist/types/runtime/sheet/rule.d.ts +8 -0
- package/dist/types/runtime/sheet/rules.d.ts +10 -0
- package/dist/types/runtime/sheet/theme.d.ts +5 -0
- package/dist/types/runtime/style/index.d.ts +3 -0
- package/dist/types/runtime/style/scope.d.ts +4 -0
- package/dist/types/runtime/style/style.d.ts +27 -0
- package/dist/types/runtime/style/token.d.ts +1 -0
- package/dist/types/runtime/types.d.ts +31 -0
- package/dist/types/selector/assert.d.ts +13 -0
- package/dist/types/selector/index.d.ts +5 -0
- package/dist/types/selector/presets/default.d.ts +108 -0
- package/dist/types/selector/presets/index.d.ts +3 -0
- package/dist/types/selector/presets/minimal.d.ts +46 -0
- package/dist/types/selector/presets/selectors.d.ts +62 -0
- package/dist/types/selector/selector.d.ts +25 -0
- package/dist/types/selector/types.d.ts +12 -0
- package/dist/types/selector/validate.d.ts +5 -0
- package/dist/types/sheet/dev/dev_layer.d.ts +4 -0
- package/dist/types/sheet/dev/dev_sort.d.ts +2 -0
- package/dist/types/sheet/dev/index.d.ts +5 -0
- package/dist/types/sheet/dev/utils.d.ts +26 -0
- package/dist/types/sheet/index.d.ts +4 -0
- package/dist/types/sheet/ordered.d.ts +4 -0
- package/dist/types/sheet/ordering.d.ts +15 -0
- package/dist/types/sheet/prod.d.ts +2 -0
- package/dist/types/sheet/sheet.d.ts +2 -0
- package/dist/types/sheet/sourcemap.d.ts +11 -0
- package/dist/types/sheet/types.d.ts +37 -0
- package/dist/types/sheet/utils/dom.d.ts +5 -0
- package/dist/types/sheet/utils/index.d.ts +4 -0
- package/dist/types/sheet/utils/layer.d.ts +10 -0
- package/dist/types/sheet/utils/noop.d.ts +2 -0
- package/dist/types/sheet/utils/rule.d.ts +3 -0
- package/dist/types/sheet/utils/sourcemap.d.ts +12 -0
- package/dist/types/style/classname.d.ts +15 -0
- package/dist/types/style/important.d.ts +9 -0
- package/dist/types/style/index.d.ts +12 -0
- package/dist/types/style/keyframes.d.ts +10 -0
- package/dist/types/style/style.d.ts +426 -0
- package/dist/types/style/theme.d.ts +5 -0
- package/dist/types/style/token.d.ts +29 -0
- package/dist/types/style/tokens.d.ts +10 -0
- package/dist/types/style/transform.d.ts +22 -0
- package/dist/types/style/types.d.ts +22 -0
- package/dist/types/style/utils/expose.d.ts +8 -0
- package/dist/types/style/utils/index.d.ts +1 -0
- package/dist/types/style/value.d.ts +12 -0
- package/dist/types/style/valueRef.d.ts +13 -0
- package/dist/types/style/weight.d.ts +9 -0
- package/dist/types/utils/global.d.ts +4 -0
- package/dist/types/utils/hash.d.ts +3 -0
- package/dist/types/utils/id.d.ts +12 -0
- package/dist/types/utils/object.d.ts +10 -0
- package/dist/types/utils/symbol.d.ts +1 -0
- package/dist/types/utils/trace.d.ts +21 -0
- package/dist/types/utils/type.d.ts +11 -0
- package/dist/utils-0UTYm294.js +42 -0
- package/dist/utils-0UTYm294.js.map +1 -0
- package/dist/utils-CO1ZXzKK.mjs +182 -0
- package/dist/utils-CO1ZXzKK.mjs.map +1 -0
- package/dist/{utils-DQGa0uzS.mjs → utils-CxYxZSSk.mjs} +3 -3
- package/dist/{utils-DQGa0uzS.mjs.map → utils-CxYxZSSk.mjs.map} +1 -1
- package/dist/utils-D1duUYV9.js +72 -0
- package/dist/utils-D1duUYV9.js.map +1 -0
- package/dist/utils-DxCpyV2E.js +62 -0
- package/dist/utils-DxCpyV2E.js.map +1 -0
- package/dist/{utils-BsbfH6cd.js → utils-ymEmGz-T.js} +1274 -608
- package/dist/utils-ymEmGz-T.js.map +1 -0
- package/dist/utils.js +4 -4
- package/dist/utils.js.map +1 -1
- package/dist/{webpack-Fb9xF5jS.mjs → webpack-DF165M2x.mjs} +7 -7
- package/dist/webpack-DF165M2x.mjs.map +1 -0
- package/entry/dev/adapter/preact.ts +8 -0
- package/entry/dev/adapter/react.ts +8 -0
- package/entry/dev/adapter/solid.ts +8 -0
- package/entry/dev/sheet.ts +4 -2
- package/entry/prod/adapter/preact.ts +8 -0
- package/entry/prod/adapter/react.ts +8 -0
- package/entry/prod/adapter/solid.ts +8 -0
- package/entry/prod/config_debug.ts +2 -0
- package/entry/prod/index.ts +1 -1
- package/entry/prod/runtime.ts +3 -1
- package/entry/rsc_dev/adapter/preact.ts +9 -0
- package/entry/rsc_dev/adapter/react.ts +9 -0
- package/entry/rsc_dev/adapter/solid.ts +9 -0
- package/entry/rsc_dev/css.ts +2 -0
- package/entry/rsc_prod/adapter/preact.ts +1 -0
- package/entry/rsc_prod/adapter/react.ts +1 -0
- package/entry/rsc_prod/adapter/solid.ts +1 -0
- package/entry/rsc_prod/config_debug.ts +6 -0
- package/entry/rsc_prod/index.ts +1 -1
- package/entry/shared/config_debug.ts +9 -0
- package/entry/shared/config_dev.ts +9 -7
- package/index.ts +1 -0
- package/jsx/rsc/jsx_dev_runtime.ts +11 -2
- package/jsx/rsc/jsx_runtime.ts +14 -3
- package/jsx/types/index.ts +1 -0
- package/jsx/types/preact.ts +14 -0
- package/jsx/{types.ts → types/react.ts} +2 -2
- package/jsx/types/solid.ts +15 -0
- package/package.json +179 -74
- package/plugin/bundler/farm/plugin.ts +3 -1
- package/plugin/bundler/parcel/optimizer.ts +1 -0
- package/plugin/bundler/parcel/plugin.ts +2 -0
- package/plugin/bundler/parcel/shared.ts +1 -1
- package/plugin/bundler/rspack/plugin.ts +1 -0
- package/plugin/bundler/vite/plugin.ts +23 -25
- package/plugin/bundler/vite/state.ts +7 -8
- package/plugin/bundler/webpack/plugin.ts +4 -3
- package/plugin/bundler/webpack/shared/loader.ts +13 -7
- package/plugin/nextjs/loader.ts +18 -2
- package/plugin/nextjs/plugin.ts +248 -35
- package/plugin/nextjs/types.ts +1 -2
- package/plugin/nextjs/utils.ts +122 -1
- package/plugin/utils/compiler.ts +3 -2
- package/plugin/utils/filter.ts +65 -1
- package/plugin/utils/runtimeEntry.ts +3 -2
- package/presets/tailwind/classname/transform.ts +32 -1
- package/presets/tailwind/style/transform.ts +9 -3
- package/runtime/adapter/utils.ts +120 -0
- package/runtime/core/cache/combine.ts +76 -28
- package/runtime/core/cache/combineRuntime.ts +4 -0
- package/runtime/core/cache/index.ts +2 -1
- package/runtime/core/cache/item.ts +32 -13
- package/runtime/core/cache/itemWithResolver.ts +44 -0
- package/runtime/core/cache/pool.ts +15 -30
- package/runtime/core/cache/prop.ts +10 -8
- package/runtime/core/cache/result.ts +2 -2
- package/runtime/core/cache/stateItem.ts +19 -1
- package/runtime/core/cache/token.ts +20 -0
- package/runtime/core/cache/tokenValues.ts +19 -11
- package/runtime/core/combinedStyle.ts +4 -4
- package/runtime/core/elementMarker.ts +9 -3
- package/runtime/extract/combineStyle.ts +211 -0
- package/runtime/extract/getClassName.ts +61 -16
- package/runtime/extract/index.ts +3 -1
- package/runtime/extract/token.ts +41 -0
- package/runtime/extract/tokenResolver.ts +17 -0
- package/runtime/rsc/constants.ts +3 -0
- package/runtime/rsc/dev.ts +31 -15
- package/runtime/rsc/getClassName.ts +10 -0
- package/runtime/rsc/globalSheet.ts +130 -0
- package/runtime/rsc/observer.ts +125 -15
- package/runtime/rsc/styleStore.ts +10 -19
- package/runtime/sheet/document.ts +28 -0
- package/runtime/sheet/global-prod.ts +3 -5
- package/runtime/sheet/global.ts +3 -5
- package/runtime/sheet/rule.ts +18 -12
- package/runtime/sheet/rules.ts +11 -3
- package/runtime/style/scope.ts +0 -24
- package/runtime/style/style.ts +181 -6
- package/runtime/types.ts +3 -3
- package/sheet/dev/dev_layer.ts +76 -17
- package/sheet/dev/dev_sort.ts +70 -18
- package/sheet/dev/index.ts +23 -3
- package/sheet/ordered.ts +225 -0
- package/sheet/ordering.ts +156 -0
- package/sheet/prod.ts +39 -12
- package/sheet/types.ts +7 -0
- package/sheet/utils/layer.ts +34 -0
- package/style/classname.ts +12 -6
- package/style/important.ts +21 -0
- package/style/index.ts +2 -0
- package/style/style.ts +17 -5
- package/style/theme.ts +0 -1
- package/style/token.ts +28 -21
- package/style/tokens.ts +20 -13
- package/style/transform.ts +5 -4
- package/style/types.ts +6 -4
- package/style/utils/expose.ts +4 -3
- package/style/value.ts +26 -11
- package/style/valueRef.ts +1 -1
- package/style/weight.ts +21 -0
- package/utils/global.ts +1 -3
- package/utils/symbol.ts +3 -0
- package/utils/trace.ts +1 -0
- package/dist/assert-BGdigdr5.js.map +0 -1
- package/dist/className-Cuh2JNxO.js +0 -263
- package/dist/className-Cuh2JNxO.js.map +0 -1
- package/dist/className-W2kDyeVl.js +0 -144
- package/dist/className-W2kDyeVl.js.map +0 -1
- package/dist/compiler-BXcGyZUP.mjs.map +0 -1
- package/dist/config-C1k9vUrM.js.map +0 -1
- package/dist/config-CLYMN3_p.js +0 -26
- package/dist/config-CLYMN3_p.js.map +0 -1
- package/dist/config-DcYrUB-M.js +0 -6
- package/dist/config-oI_yS50f.js +0 -1
- package/dist/css-CELBp6Gu.js +0 -58
- package/dist/css-CELBp6Gu.js.map +0 -1
- package/dist/css-CohHH2tn.js.map +0 -1
- package/dist/css-D_DL1yOz.js +0 -237
- package/dist/css-D_DL1yOz.js.map +0 -1
- package/dist/css-DfH4Gb1c.js +0 -805
- package/dist/css-DfH4Gb1c.js.map +0 -1
- package/dist/data-Ze8GNiJm.js +0 -483
- package/dist/data-Ze8GNiJm.js.map +0 -1
- package/dist/debug-BefbXMq1.js +0 -15
- package/dist/debug-BefbXMq1.js.map +0 -1
- package/dist/debug-DLmUG3Vh.js +0 -172
- package/dist/debug-DLmUG3Vh.js.map +0 -1
- package/dist/debug-OG2wSB5R.js +0 -15
- package/dist/debug-OG2wSB5R.js.map +0 -1
- package/dist/dev-4TqJORRn.js +0 -75
- package/dist/dev-4TqJORRn.js.map +0 -1
- package/dist/dev-C2u78xuv.js.map +0 -1
- package/dist/elementMarker-BKzZyg5V.js.map +0 -1
- package/dist/extract-B9j4TBkU.js +0 -2
- package/dist/extract-CzWJeQi8.js +0 -121
- package/dist/extract-CzWJeQi8.js.map +0 -1
- package/dist/getClassName-C6690_nr.js.map +0 -1
- package/dist/global-C7GsCW6Y.js +0 -14
- package/dist/global-C7GsCW6Y.js.map +0 -1
- package/dist/global-zaCE-g1C.js.map +0 -1
- package/dist/hash-Bycpk3MR.js +0 -160
- package/dist/hash-Bycpk3MR.js.map +0 -1
- package/dist/jsx-Berx-L-r.js +0 -39
- package/dist/jsx-Berx-L-r.js.map +0 -1
- package/dist/jsx-DsMajv_M.js +0 -38
- package/dist/jsx-DsMajv_M.js.map +0 -1
- package/dist/jsx_runtime-CMdEXGNZ.js +0 -13
- package/dist/jsx_runtime-DPWo5qvV.js.map +0 -1
- package/dist/layer-DiNeeTgG.js +0 -94
- package/dist/layer-DiNeeTgG.js.map +0 -1
- package/dist/loader-DCT1Q9yi.mjs.map +0 -1
- package/dist/misc-o8pviMUi.mjs.map +0 -1
- package/dist/namedTokens-BUa6raTb.js.map +0 -1
- package/dist/presets-BhXa232U.js +0 -108
- package/dist/presets-BhXa232U.js.map +0 -1
- package/dist/property-BzZSTVIh.js +0 -406
- package/dist/property-BzZSTVIh.js.map +0 -1
- package/dist/rules-Dz7Pu2K6.js.map +0 -1
- package/dist/runtime-B3jHW9B1.js +0 -32
- package/dist/runtime-B3jHW9B1.js.map +0 -1
- package/dist/shared-B_gJf5uj.cjs.map +0 -1
- package/dist/shared-uAzFeq0x.mjs.map +0 -1
- package/dist/sheet-DasbRnvy.js +0 -7
- package/dist/sheet-DasbRnvy.js.map +0 -1
- package/dist/style-B0F1sgRZ.js +0 -5
- package/dist/style-BkeAZl0n.js.map +0 -1
- package/dist/style-CYXTs1iu.js +0 -771
- package/dist/style-CYXTs1iu.js.map +0 -1
- package/dist/style-DUztHzBz.js.map +0 -1
- package/dist/styleStore-BGJ2ZYtK.js +0 -2009
- package/dist/styleStore-BGJ2ZYtK.js.map +0 -1
- package/dist/styleStore-DVDp-gI-.js +0 -55
- package/dist/styleStore-DVDp-gI-.js.map +0 -1
- package/dist/token-CA1j7suG.js +0 -273
- package/dist/token-CA1j7suG.js.map +0 -1
- package/dist/token-CKXUECuU.js +0 -76
- package/dist/token-CKXUECuU.js.map +0 -1
- package/dist/token-DTOyFLmp.js +0 -58
- package/dist/token-DTOyFLmp.js.map +0 -1
- package/dist/transform-BTJOg8Hg.js.map +0 -1
- package/dist/utils-BsbfH6cd.js.map +0 -1
- package/dist/utils-CpA-dSpY.mjs +0 -97
- package/dist/utils-CpA-dSpY.mjs.map +0 -1
- package/dist/utils-D4YWF2K0.js.map +0 -1
- package/dist/utils-R6QadAsY.js +0 -170
- package/dist/utils-R6QadAsY.js.map +0 -1
- package/dist/value-CJG6EWe8.js +0 -85
- package/dist/value-CJG6EWe8.js.map +0 -1
- package/dist/value-D-ZcRzLA.js +0 -42
- package/dist/value-D-ZcRzLA.js.map +0 -1
- package/dist/value-DBtSe-9B.js +0 -1000
- package/dist/value-DBtSe-9B.js.map +0 -1
- package/dist/valueRef-CsLVJwjA.js +0 -16
- package/dist/valueRef-CsLVJwjA.js.map +0 -1
- package/dist/webpack-Fb9xF5jS.mjs.map +0 -1
- package/dist/withTokens-LRidu3Vc.js +0 -95
- package/dist/withTokens-LRidu3Vc.js.map +0 -1
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import * as fs from 'node:fs';
|
|
3
|
+
import { createRequire } from 'node:module';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
|
|
7
|
+
let identity: string | null | undefined;
|
|
8
|
+
|
|
9
|
+
/** Fingerprint actual compiler and dependency bytes, including locally patched packages.
|
|
10
|
+
* Computed once per process: replacing loaded compiler code requires restarting Node.
|
|
11
|
+
*/
|
|
12
|
+
export function getCompilerCacheIdentity(): string | null {
|
|
13
|
+
if (identity !== undefined) return identity;
|
|
14
|
+
try {
|
|
15
|
+
const filename = typeof __filename === 'string' ? __filename : fileURLToPath(import.meta.url);
|
|
16
|
+
const root = findPackageRoot(filename, '@fluentic/style');
|
|
17
|
+
const hash = createHash('sha256');
|
|
18
|
+
hash.update(JSON.stringify([
|
|
19
|
+
process.versions,
|
|
20
|
+
process.platform,
|
|
21
|
+
process.arch,
|
|
22
|
+
process.execArgv,
|
|
23
|
+
process.env.NODE_OPTIONS,
|
|
24
|
+
process.env.NODE_ENV,
|
|
25
|
+
process.env.BABEL_ENV,
|
|
26
|
+
]));
|
|
27
|
+
const visited = new Set<string>();
|
|
28
|
+
const hashTree = (directory: string, source = false) => {
|
|
29
|
+
for (
|
|
30
|
+
const item of fs.readdirSync(directory, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))
|
|
31
|
+
) {
|
|
32
|
+
if (item.name === 'node_modules' || item.name === '.git') continue;
|
|
33
|
+
const file = path.join(directory, item.name);
|
|
34
|
+
if (item.isDirectory()) hashTree(file, source);
|
|
35
|
+
else if (item.isFile()) {
|
|
36
|
+
// Declarations, source maps and documentation are not executable compiler inputs.
|
|
37
|
+
if (!(source ? /\.(?:[cm]?[jt]sx?|json|node|wasm)$/ : /\.(?:[cm]?js|json|node|wasm)$/).test(item.name)) {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
hash.update(file).update('\0').update(fs.readFileSync(file)).update('\0');
|
|
41
|
+
} else {
|
|
42
|
+
// Unusual package layouts should rebuild, not silently omit inputs.
|
|
43
|
+
throw new Error('Unsupported package entry');
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const visit = (directory: string) => {
|
|
48
|
+
directory = fs.realpathSync(directory);
|
|
49
|
+
if (visited.has(directory)) return;
|
|
50
|
+
visited.add(directory);
|
|
51
|
+
hashTree(directory);
|
|
52
|
+
const manifest = JSON.parse(fs.readFileSync(path.join(directory, 'package.json'), 'utf8'));
|
|
53
|
+
const require = createRequire(path.join(directory, 'package.json'));
|
|
54
|
+
const optional = manifest.optionalDependencies ?? {};
|
|
55
|
+
for (const name of Object.keys({ ...manifest.dependencies, ...optional }).sort()) {
|
|
56
|
+
let dependency: string;
|
|
57
|
+
try {
|
|
58
|
+
dependency = resolvePackageRoot(require, name);
|
|
59
|
+
} catch (error) {
|
|
60
|
+
if (name in optional) {
|
|
61
|
+
hash.update('absent:' + name);
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
visit(dependency);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const manifest = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8'));
|
|
70
|
+
hash.update(fs.readFileSync(path.join(root, 'package.json')));
|
|
71
|
+
// Hash the implementation actually loaded. Packed builds execute dist, not shipped TS.
|
|
72
|
+
if (filename.startsWith(path.join(root, 'dist') + path.sep)) {
|
|
73
|
+
hashTree(path.join(root, 'dist'));
|
|
74
|
+
} else {
|
|
75
|
+
for (const item of manifest.files as string[]) {
|
|
76
|
+
if (item === 'dist') continue;
|
|
77
|
+
const file = path.join(root, item);
|
|
78
|
+
if (!fs.existsSync(file)) continue;
|
|
79
|
+
if (fs.statSync(file).isDirectory()) hashTree(file, true);
|
|
80
|
+
else if (/\.[cm]?[jt]sx?$/.test(item)) hash.update(item).update(fs.readFileSync(file));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const require = createRequire(path.join(root, 'package.json'));
|
|
84
|
+
for (const name of ['@babel/core', '@jridgewell/trace-mapping', 'css-what', 'oxc-resolver', 'picomatch']) {
|
|
85
|
+
visit(resolvePackageRoot(require, name));
|
|
86
|
+
}
|
|
87
|
+
identity = hash.digest('hex');
|
|
88
|
+
} catch {
|
|
89
|
+
identity = null;
|
|
90
|
+
}
|
|
91
|
+
return identity;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function resolvePackageRoot(require: NodeRequire, name: string): string {
|
|
95
|
+
for (const directory of require.resolve.paths(name) ?? []) {
|
|
96
|
+
const root = path.join(directory, name);
|
|
97
|
+
if (fs.existsSync(path.join(root, 'package.json'))) return fs.realpathSync(root);
|
|
98
|
+
}
|
|
99
|
+
try {
|
|
100
|
+
return path.dirname(require.resolve(name + '/package.json'));
|
|
101
|
+
} catch {
|
|
102
|
+
return findPackageRoot(require.resolve(name), name);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function findPackageRoot(filename: string, name: string): string {
|
|
107
|
+
let directory = path.dirname(filename);
|
|
108
|
+
while (true) {
|
|
109
|
+
const manifest = path.join(directory, 'package.json');
|
|
110
|
+
if (fs.existsSync(manifest) && JSON.parse(fs.readFileSync(manifest, 'utf8')).name === name) return directory;
|
|
111
|
+
const parent = path.dirname(directory);
|
|
112
|
+
if (parent === directory) throw new Error('Package root not found');
|
|
113
|
+
directory = parent;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
1
2
|
import { createCssCollector, extractCss } from '../extract';
|
|
2
3
|
import { createTracer, transformDebug, transformExtract } from '../transform';
|
|
3
4
|
import { getDebugSourceUrl } from '../transform/debug/utils/source_url';
|
|
@@ -11,11 +12,14 @@ import {
|
|
|
11
12
|
import { clearResolverCache } from '../utils/file_resolver';
|
|
12
13
|
import {
|
|
13
14
|
getStyleExtractRuntimeImportPath,
|
|
15
|
+
getStyleRuntimeAdapterImportPath,
|
|
14
16
|
getStyleRuntimeCssImportPath,
|
|
15
17
|
getStyleRuntimeDevRscImportPath,
|
|
16
18
|
getStyleRuntimeImportPath,
|
|
17
19
|
} from '../utils/imports';
|
|
18
20
|
import { createCompilerCache } from './cache';
|
|
21
|
+
import { CompilerRuntimeMode } from './constants';
|
|
22
|
+
import { createPersistentTransformCache } from './persistent_cache';
|
|
19
23
|
import type {
|
|
20
24
|
CompilerInvalidateFileInfo,
|
|
21
25
|
CompilerOptions,
|
|
@@ -26,13 +30,6 @@ import type {
|
|
|
26
30
|
TransformExtractResult,
|
|
27
31
|
} from './types';
|
|
28
32
|
|
|
29
|
-
export enum CompilerRuntimeMode {
|
|
30
|
-
Dev = 'dev',
|
|
31
|
-
Prod = 'prod',
|
|
32
|
-
RscDev = 'rsc-dev',
|
|
33
|
-
RscProd = 'rsc-prod',
|
|
34
|
-
}
|
|
35
|
-
|
|
36
33
|
export type CompilerArgs = {
|
|
37
34
|
projectDir: string;
|
|
38
35
|
cacheDir: string;
|
|
@@ -48,18 +45,23 @@ export function createCompiler(args: CompilerArgs, options: CompilerOptions) {
|
|
|
48
45
|
|
|
49
46
|
const tracer = createTracer(internal);
|
|
50
47
|
const collector = createCssCollector();
|
|
48
|
+
const persistentCache = createPersistentTransformCache(internal);
|
|
51
49
|
|
|
52
50
|
const compileDebug = (args: TransformDebugArgs): TransformDebugResult | null => {
|
|
51
|
+
tracer.beginCompilation();
|
|
53
52
|
return rewriteTransformResult(
|
|
54
53
|
transformDebug(internal, args, { tracer }),
|
|
55
54
|
internal.runtimeMode,
|
|
55
|
+
args.code,
|
|
56
56
|
);
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
const compileDebugRSC = (args: TransformDebugArgs): TransformDebugRscResult | null => {
|
|
60
|
+
tracer.beginCompilation();
|
|
60
61
|
const debugResult = rewriteTransformResult(
|
|
61
62
|
transformDebug(internal, args, { tracer }),
|
|
62
63
|
internal.runtimeMode,
|
|
64
|
+
args.code,
|
|
63
65
|
);
|
|
64
66
|
if (!debugResult) return null;
|
|
65
67
|
|
|
@@ -93,6 +95,19 @@ export function createCompiler(args: CompilerArgs, options: CompilerOptions) {
|
|
|
93
95
|
|
|
94
96
|
const compileExtract = (args: TransformExtractArgs): TransformExtractResult | null => {
|
|
95
97
|
const startIndex = collector.getItems().length;
|
|
98
|
+
try {
|
|
99
|
+
const cached = persistentCache.run(args, () => compileExtractUncached(args));
|
|
100
|
+
if (cached.hit && cached.result) collector.addMany(cached.result.rules);
|
|
101
|
+
return cached.result;
|
|
102
|
+
} catch (error) {
|
|
103
|
+
collector.getItems().splice(startIndex);
|
|
104
|
+
throw error;
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const compileExtractUncached = (args: TransformExtractArgs): TransformExtractResult | null => {
|
|
109
|
+
tracer.beginCompilation();
|
|
110
|
+
const startIndex = collector.getItems().length;
|
|
96
111
|
|
|
97
112
|
const result = transformExtract(internal, args, {
|
|
98
113
|
collector,
|
|
@@ -101,10 +116,14 @@ export function createCompiler(args: CompilerArgs, options: CompilerOptions) {
|
|
|
101
116
|
|
|
102
117
|
if (!result) return null;
|
|
103
118
|
|
|
104
|
-
return rewriteTransformResult(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
119
|
+
return rewriteTransformResult(
|
|
120
|
+
{
|
|
121
|
+
...result,
|
|
122
|
+
rules: collector.getItems().slice(startIndex),
|
|
123
|
+
},
|
|
124
|
+
internal.runtimeMode,
|
|
125
|
+
args.code,
|
|
126
|
+
);
|
|
108
127
|
};
|
|
109
128
|
|
|
110
129
|
const getExtractedCss = () => {
|
|
@@ -125,11 +144,16 @@ export function createCompiler(args: CompilerArgs, options: CompilerOptions) {
|
|
|
125
144
|
compileExtract,
|
|
126
145
|
getExtractedCss,
|
|
127
146
|
invalidateFile,
|
|
147
|
+
getPersistentCacheStats: persistentCache.getStats,
|
|
148
|
+
getTraceMetadataCacheStats: tracer.getMetadataCacheStats,
|
|
128
149
|
};
|
|
129
150
|
}
|
|
130
151
|
|
|
131
152
|
function createCompilerInternal(args: CompilerArgs, options: CompilerOptions) {
|
|
132
|
-
const { projectDir,
|
|
153
|
+
const { projectDir, runtimeMode } = args;
|
|
154
|
+
const cacheDir = options.cache?.location === undefined
|
|
155
|
+
? args.cacheDir
|
|
156
|
+
: path.resolve(projectDir, options.cache.location);
|
|
133
157
|
|
|
134
158
|
const cache = createCompilerCache({ cacheDir });
|
|
135
159
|
|
|
@@ -145,25 +169,50 @@ function createCompilerInternal(args: CompilerArgs, options: CompilerOptions) {
|
|
|
145
169
|
function rewriteTransformResult<Result extends { code: string; }>(
|
|
146
170
|
result: Result | null,
|
|
147
171
|
runtimeMode: CompilerRuntimeMode | null,
|
|
172
|
+
sourceCode: string,
|
|
148
173
|
) {
|
|
149
174
|
if (!result || !runtimeMode) return result;
|
|
150
175
|
|
|
151
176
|
return {
|
|
152
177
|
...result,
|
|
153
|
-
code: rewriteCompilerRuntimeImports(result.code, runtimeMode),
|
|
178
|
+
code: rewriteCompilerRuntimeImports(result.code, runtimeMode, sourceCode),
|
|
154
179
|
};
|
|
155
180
|
}
|
|
156
181
|
|
|
157
|
-
function rewriteCompilerRuntimeImports(
|
|
182
|
+
function rewriteCompilerRuntimeImports(
|
|
183
|
+
code: string,
|
|
184
|
+
runtimeMode: CompilerRuntimeMode,
|
|
185
|
+
sourceCode: string,
|
|
186
|
+
) {
|
|
187
|
+
// All rewritable entry points share this prefix. Escaped specifiers still
|
|
188
|
+
// need parsing, so only take the fast path when no escapes are present.
|
|
189
|
+
if (!code.includes(STYLE_IMPORT_PATH) && !code.includes('\\')) return code;
|
|
190
|
+
|
|
191
|
+
const importRuntimeMode = getImportRuntimeMode(runtimeMode, sourceCode);
|
|
192
|
+
|
|
158
193
|
return rewriteImportSources(
|
|
159
194
|
code,
|
|
160
|
-
(source) => getCompilerRuntimeImportSource(source, runtimeMode),
|
|
195
|
+
(source) => getCompilerRuntimeImportSource(source, runtimeMode, importRuntimeMode),
|
|
161
196
|
);
|
|
162
197
|
}
|
|
163
198
|
|
|
164
|
-
function
|
|
165
|
-
if (
|
|
166
|
-
|
|
199
|
+
function getImportRuntimeMode(runtimeMode: CompilerRuntimeMode, sourceCode: string) {
|
|
200
|
+
if (runtimeMode === CompilerRuntimeMode.RscDev && hasUseClientDirective(sourceCode)) {
|
|
201
|
+
return CompilerRuntimeMode.Dev;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
return runtimeMode;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function getCompilerRuntimeImportSource(
|
|
208
|
+
source: string,
|
|
209
|
+
runtimeMode: CompilerRuntimeMode,
|
|
210
|
+
importRuntimeMode: CompilerRuntimeMode,
|
|
211
|
+
) {
|
|
212
|
+
if (source === STYLE_IMPORT_PATH) return getStyleRuntimeImportPath(importRuntimeMode);
|
|
213
|
+
const adapterImportPath = getStyleRuntimeAdapterImportPath(source, importRuntimeMode);
|
|
214
|
+
if (adapterImportPath) return adapterImportPath;
|
|
215
|
+
if (source === STYLE_CSS_IMPORT_PATH) return getStyleRuntimeCssImportPath(importRuntimeMode);
|
|
167
216
|
if (source === STYLE_EXTRACT_RUNTIME_IMPORT_PATH) return getStyleExtractRuntimeImportPath(runtimeMode);
|
|
168
217
|
if (runtimeMode === CompilerRuntimeMode.RscDev && source === STYLE_DEV_RSC_IMPORT_PATH) {
|
|
169
218
|
return getStyleRuntimeDevRscImportPath(runtimeMode);
|
|
@@ -171,3 +220,59 @@ function getCompilerRuntimeImportSource(source: string, runtimeMode: CompilerRun
|
|
|
171
220
|
|
|
172
221
|
return null;
|
|
173
222
|
}
|
|
223
|
+
|
|
224
|
+
function hasUseClientDirective(code: string) {
|
|
225
|
+
let index = 0;
|
|
226
|
+
|
|
227
|
+
while (index < code.length) {
|
|
228
|
+
index = skipWhitespaceAndComments(code, index);
|
|
229
|
+
|
|
230
|
+
const quote = code[index];
|
|
231
|
+
if (quote !== '"' && quote !== "'") return false;
|
|
232
|
+
|
|
233
|
+
const end = code.indexOf(quote, index + 1);
|
|
234
|
+
if (end < 0) return false;
|
|
235
|
+
|
|
236
|
+
const directive = code.slice(index + 1, end);
|
|
237
|
+
index = skipWhitespaceAndComments(code, end + 1);
|
|
238
|
+
|
|
239
|
+
if (code[index] === ';') {
|
|
240
|
+
index += 1;
|
|
241
|
+
} else if (code[index] && code[index] !== '\n' && code[index] !== '\r') {
|
|
242
|
+
return false;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
if (directive === 'use client') return true;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
function skipWhitespaceAndComments(code: string, index: number) {
|
|
252
|
+
let next = index;
|
|
253
|
+
|
|
254
|
+
while (next < code.length) {
|
|
255
|
+
const char = code[next];
|
|
256
|
+
|
|
257
|
+
if (char === ' ' || char === '\t' || char === '\n' || char === '\r') {
|
|
258
|
+
next += 1;
|
|
259
|
+
continue;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
if (char === '/' && code[next + 1] === '/') {
|
|
263
|
+
const lineEnd = code.indexOf('\n', next + 2);
|
|
264
|
+
next = lineEnd < 0 ? code.length : lineEnd + 1;
|
|
265
|
+
continue;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
if (char === '/' && code[next + 1] === '*') {
|
|
269
|
+
const commentEnd = code.indexOf('*/', next + 2);
|
|
270
|
+
next = commentEnd < 0 ? code.length : commentEnd + 2;
|
|
271
|
+
continue;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
return next;
|
|
278
|
+
}
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
import { createHash, randomUUID } from 'node:crypto';
|
|
2
|
+
import * as fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { types } from 'node:util';
|
|
5
|
+
import { deserialize, serialize } from 'node:v8';
|
|
6
|
+
import { CHECK_CONFIG } from '../../config/config/check';
|
|
7
|
+
import { CSS_CONFIG } from '../../config/config/css';
|
|
8
|
+
import { CSS_EXTRA_CONFIG } from '../../config/config/css_extra';
|
|
9
|
+
import { DEBUG_CONFIG } from '../../config/config/debug';
|
|
10
|
+
import { DEV_CONFIG, IS_DEV } from '../../config/config/dev';
|
|
11
|
+
import { RUNTIME_CONFIG } from '../../config/config/runtime';
|
|
12
|
+
import { PrioritySelectors } from '../../selector/presets';
|
|
13
|
+
import { getStyleFnMeta } from '../../style/style';
|
|
14
|
+
import { symbol } from '../../utils/symbol';
|
|
15
|
+
import { type CheckDiagnostic, observeCheckDiagnostics } from '../utils/check_diagnostics';
|
|
16
|
+
import { DEFAULT_CONFIG } from '../utils/constants';
|
|
17
|
+
import { clearResolverCache, observeFileResolutions, resolveFile } from '../utils/file_resolver';
|
|
18
|
+
import { getCompilerCacheIdentity } from './cache_identity';
|
|
19
|
+
import type { CompilerInternal } from './compiler';
|
|
20
|
+
import type { TransformExtractArgs, TransformExtractResult } from './types';
|
|
21
|
+
|
|
22
|
+
type Dependency = { source: string; fromFile: string; filePath: string | null; hash: string | null; };
|
|
23
|
+
type CachedError = { name: string; message: string; stack?: string; };
|
|
24
|
+
type RecordData = {
|
|
25
|
+
key: string;
|
|
26
|
+
dependencies: Dependency[];
|
|
27
|
+
result: TransformExtractResult | null;
|
|
28
|
+
diagnostics: CheckDiagnostic[];
|
|
29
|
+
error: CachedError | null;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export function createPersistentTransformCache(internal: CompilerInternal) {
|
|
33
|
+
const stats = { hits: 0, misses: 0, bypasses: 0, writes: 0 };
|
|
34
|
+
const directory = path.join(internal.cacheDir, 'extract-v1');
|
|
35
|
+
let previousContext: string | null = null;
|
|
36
|
+
const contextFor = (): string | null => {
|
|
37
|
+
if (internal.options.cache?.persistent === false || DEV_CONFIG.isDev) return null;
|
|
38
|
+
try {
|
|
39
|
+
const identity = getCompilerCacheIdentity();
|
|
40
|
+
if (!identity) return null;
|
|
41
|
+
const options = internal.options;
|
|
42
|
+
// Reject accessors/proxies before inspecting or normalizing configuration.
|
|
43
|
+
assertDataProperties(options);
|
|
44
|
+
if (Object.getPrototypeOf(options) !== Object.prototype && Object.getPrototypeOf(options) !== null) {
|
|
45
|
+
throw new Error('Non-plain compiler options');
|
|
46
|
+
}
|
|
47
|
+
if (options.importSources) assertPlainArray(options.importSources);
|
|
48
|
+
const importSources = options.importSources?.map((entry) => {
|
|
49
|
+
assertDataProperties(entry);
|
|
50
|
+
if (Object.getPrototypeOf(entry) !== Object.prototype && Object.getPrototypeOf(entry) !== null) {
|
|
51
|
+
throw new Error('Non-plain import source');
|
|
52
|
+
}
|
|
53
|
+
if (entry.styleFn && types.isProxy(entry.styleFn)) throw new Error('Proxy style function');
|
|
54
|
+
if (!entry.meta && entry.styleFn) {
|
|
55
|
+
const metadata = Object.getOwnPropertyDescriptor(entry.styleFn, symbol('style.fn:meta'));
|
|
56
|
+
if (!metadata || !('value' in metadata)) throw new Error('Dynamic style metadata');
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
...entry,
|
|
60
|
+
styleFn: undefined,
|
|
61
|
+
meta: entry.meta ?? (entry.styleFn ? getStyleFnMeta(entry.styleFn) : null),
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
return digest(encode({
|
|
65
|
+
schema: 1,
|
|
66
|
+
identity,
|
|
67
|
+
cwd: process.cwd(),
|
|
68
|
+
projectDir: internal.projectDir,
|
|
69
|
+
runtimeMode: internal.runtimeMode,
|
|
70
|
+
options: { ...options, importSources },
|
|
71
|
+
globals: {
|
|
72
|
+
CSS_CONFIG,
|
|
73
|
+
CSS_EXTRA_CONFIG,
|
|
74
|
+
DEBUG_CONFIG,
|
|
75
|
+
DEV_CONFIG,
|
|
76
|
+
IS_DEV,
|
|
77
|
+
RUNTIME_CONFIG,
|
|
78
|
+
CHECK_CONFIG,
|
|
79
|
+
DEFAULT_CONFIG,
|
|
80
|
+
PrioritySelectors,
|
|
81
|
+
},
|
|
82
|
+
}, options.cache?.dynamicConfig !== false));
|
|
83
|
+
} catch {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const run = (args: TransformExtractArgs, compile: () => TransformExtractResult | null) => {
|
|
88
|
+
const context = contextFor();
|
|
89
|
+
let key: string | null = null;
|
|
90
|
+
try {
|
|
91
|
+
if (context) key = digest(encode({ context, args }));
|
|
92
|
+
} catch { /* Unsupported input. */ }
|
|
93
|
+
if (!key) {
|
|
94
|
+
stats.bypasses++;
|
|
95
|
+
previousContext = null;
|
|
96
|
+
internal.cache.clear();
|
|
97
|
+
clearResolverCache();
|
|
98
|
+
return { result: compile(), hit: false };
|
|
99
|
+
}
|
|
100
|
+
// Different Node/compiler versions may build the same project concurrently.
|
|
101
|
+
// Keep their records separate instead of repeatedly displacing each other.
|
|
102
|
+
const filename = path.join(
|
|
103
|
+
directory,
|
|
104
|
+
getCompilerCacheIdentity()!,
|
|
105
|
+
digest(encode(internal.options.cache?.version)),
|
|
106
|
+
digest(args.filePath) + '.bin',
|
|
107
|
+
);
|
|
108
|
+
// A new snapshot for each compilation: never trust resolver or mtime caches across calls.
|
|
109
|
+
clearResolverCache();
|
|
110
|
+
let hit: RecordData | undefined;
|
|
111
|
+
try {
|
|
112
|
+
const buffer = fs.readFileSync(filename);
|
|
113
|
+
const body = buffer.subarray(65);
|
|
114
|
+
if (buffer.subarray(0, 64).toString() === digest(body)) {
|
|
115
|
+
const record = deserialize(body) as RecordData;
|
|
116
|
+
if (
|
|
117
|
+
record.key === key && Array.isArray(record.dependencies) && validRecord(record) &&
|
|
118
|
+
record.dependencies.every(isFresh)
|
|
119
|
+
) {
|
|
120
|
+
hit = record;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
} catch {
|
|
124
|
+
// Missing, truncated, incompatible, or otherwise unreadable cache: compile normally.
|
|
125
|
+
}
|
|
126
|
+
// Replay outside the read/recovery catch: cached errors must still fail builds.
|
|
127
|
+
if (hit) {
|
|
128
|
+
stats.hits++;
|
|
129
|
+
for (const diagnostic of hit.diagnostics) {
|
|
130
|
+
if (diagnostic.level === 'warn') console.warn('[fluentic-style] ' + diagnostic.message);
|
|
131
|
+
}
|
|
132
|
+
if (hit.error) {
|
|
133
|
+
const error = new Error(hit.error.message);
|
|
134
|
+
error.name = hit.error.name;
|
|
135
|
+
error.stack = hit.error.stack;
|
|
136
|
+
throw error;
|
|
137
|
+
}
|
|
138
|
+
return { result: hit.result, hit: true };
|
|
139
|
+
}
|
|
140
|
+
stats.misses++;
|
|
141
|
+
clearResolverCache();
|
|
142
|
+
// Tracer hits revalidate/replay their lookup graph into the active observer.
|
|
143
|
+
// Evaluated bindings are reusable only under the same compiler configuration.
|
|
144
|
+
if (context !== previousContext) internal.cache.clear();
|
|
145
|
+
previousContext = context;
|
|
146
|
+
const dependencies = new Map<string, Dependency>();
|
|
147
|
+
const diagnostics: CheckDiagnostic[] = [];
|
|
148
|
+
let result: TransformExtractResult | null = null;
|
|
149
|
+
let failure: Error | null = null;
|
|
150
|
+
try {
|
|
151
|
+
result = observeCheckDiagnostics(
|
|
152
|
+
(diagnostic) => diagnostics.push(diagnostic),
|
|
153
|
+
() =>
|
|
154
|
+
observeFileResolutions((source, fromFile, resolved) => {
|
|
155
|
+
dependencies.set(JSON.stringify([source, fromFile]), {
|
|
156
|
+
source,
|
|
157
|
+
fromFile,
|
|
158
|
+
filePath: resolved?.filePath ?? null,
|
|
159
|
+
hash: resolved ? digest(resolved.content) : null,
|
|
160
|
+
});
|
|
161
|
+
}, compile),
|
|
162
|
+
);
|
|
163
|
+
} catch (error) {
|
|
164
|
+
// Cache deliberate check failures only, not arbitrary compiler/I/O errors.
|
|
165
|
+
if (!(error instanceof Error) || diagnostics[diagnostics.length - 1]?.level !== 'error') throw error;
|
|
166
|
+
failure = error;
|
|
167
|
+
}
|
|
168
|
+
const cachedError = failure ? { name: failure.name, message: failure.message, stack: failure.stack } : null;
|
|
169
|
+
if (result || failure) {
|
|
170
|
+
let temporary: string | undefined;
|
|
171
|
+
try {
|
|
172
|
+
encode(result); // Only persist plain data; never evaluator functions/symbols.
|
|
173
|
+
const records = [...dependencies.values()];
|
|
174
|
+
clearResolverCache();
|
|
175
|
+
// Do not save a mixed snapshot if inputs/configuration changed during extraction.
|
|
176
|
+
if (!records.every(isFresh) || contextFor() !== context) throw new Error('Cache snapshot changed');
|
|
177
|
+
const body = serialize(
|
|
178
|
+
{ key, dependencies: records, result, diagnostics, error: cachedError } satisfies RecordData,
|
|
179
|
+
);
|
|
180
|
+
fs.mkdirSync(path.dirname(filename), { recursive: true });
|
|
181
|
+
temporary = filename + '.' + randomUUID() + '.tmp';
|
|
182
|
+
fs.writeFileSync(temporary, Buffer.concat([Buffer.from(digest(body) + '\n'), body]));
|
|
183
|
+
fs.renameSync(temporary, filename);
|
|
184
|
+
stats.writes++;
|
|
185
|
+
} catch {
|
|
186
|
+
// Caching is optional; permission/disk/serialization failures cannot fail a build.
|
|
187
|
+
} finally {
|
|
188
|
+
if (temporary) {
|
|
189
|
+
try {
|
|
190
|
+
fs.unlinkSync(temporary);
|
|
191
|
+
} catch { /* Already renamed or unavailable. */ }
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (failure) throw failure;
|
|
196
|
+
return { result, hit: false };
|
|
197
|
+
};
|
|
198
|
+
return { run, getStats: () => ({ ...stats }) };
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function isFresh(dependency: Dependency): boolean {
|
|
202
|
+
if (typeof dependency.source !== 'string' || typeof dependency.fromFile !== 'string') return false;
|
|
203
|
+
const resolved = resolveFile(dependency.source, dependency.fromFile);
|
|
204
|
+
return (resolved?.filePath ?? null) === dependency.filePath &&
|
|
205
|
+
(resolved ? digest(resolved.content) : null) === dependency.hash;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function validRecord(record: RecordData): boolean {
|
|
209
|
+
if (
|
|
210
|
+
!Array.isArray(record.diagnostics) ||
|
|
211
|
+
!record.diagnostics.every((item) =>
|
|
212
|
+
item && (item.level === 'warn' || item.level === 'error') && typeof item.message === 'string'
|
|
213
|
+
)
|
|
214
|
+
) return false;
|
|
215
|
+
if (record.error) {
|
|
216
|
+
return record.result === null && record.diagnostics[record.diagnostics.length - 1]?.level === 'error' &&
|
|
217
|
+
typeof record.error.name === 'string' && typeof record.error.message === 'string' &&
|
|
218
|
+
(record.error.stack === undefined || typeof record.error.stack === 'string');
|
|
219
|
+
}
|
|
220
|
+
return record.error === null && record.diagnostics.every((item) => item.level === 'warn') &&
|
|
221
|
+
validResult(record.result);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function validResult(result: TransformExtractResult | null): boolean {
|
|
225
|
+
return !!result && typeof result.code === 'string' &&
|
|
226
|
+
(result.sourcemap === null || typeof result.sourcemap === 'string') && Array.isArray(result.rules) &&
|
|
227
|
+
result.rules.every((rule) =>
|
|
228
|
+
typeof rule.css === 'string' && typeof rule.dedupe === 'string' &&
|
|
229
|
+
typeof rule.className === 'string' && Array.isArray(rule.priority)
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function digest(value: string | Buffer): string {
|
|
234
|
+
return createHash('sha256').update(value).digest('hex');
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function assertDataProperties(value: object) {
|
|
238
|
+
if (types.isProxy(value)) throw new Error('Proxy configuration');
|
|
239
|
+
for (const key of Reflect.ownKeys(value)) {
|
|
240
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key)!;
|
|
241
|
+
if (
|
|
242
|
+
typeof key === 'symbol' || !('value' in descriptor) ||
|
|
243
|
+
(!descriptor.enumerable && !(Array.isArray(value) && key === 'length') &&
|
|
244
|
+
!(value instanceof RegExp && key === 'lastIndex'))
|
|
245
|
+
) {
|
|
246
|
+
throw new Error('Dynamic configuration');
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
function assertPlainArray(value: unknown[]) {
|
|
252
|
+
assertDataProperties(value);
|
|
253
|
+
if (
|
|
254
|
+
Object.getPrototypeOf(value) !== Array.prototype ||
|
|
255
|
+
Object.keys(value).some((key) => !/^(0|[1-9][0-9]*)$/.test(key))
|
|
256
|
+
) {
|
|
257
|
+
throw new Error('Non-plain array');
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/** Tagged, order-preserving encoding: property order can affect generated CSS. */
|
|
262
|
+
function encode(value: unknown, dynamicConfig = false): string {
|
|
263
|
+
return JSON.stringify(encodeValue(value, new Set(), dynamicConfig));
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function encodeValue(value: unknown, seen = new Set<object>(), dynamicConfig = false): unknown {
|
|
267
|
+
if (typeof value === 'function' && dynamicConfig) {
|
|
268
|
+
if (types.isProxy(value)) throw new Error('Proxy callback');
|
|
269
|
+
for (const key of Reflect.ownKeys(value)) {
|
|
270
|
+
if (typeof key !== 'string' || !['length', 'name', 'prototype', 'arguments', 'caller'].includes(key)) {
|
|
271
|
+
throw new Error('Callback with custom properties');
|
|
272
|
+
}
|
|
273
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key)!;
|
|
274
|
+
if (!('value' in descriptor)) throw new Error('Callback accessor');
|
|
275
|
+
}
|
|
276
|
+
const source = Function.prototype.toString.call(value);
|
|
277
|
+
if (source.includes('[native code]')) throw new Error('Opaque callback');
|
|
278
|
+
return ['function', source];
|
|
279
|
+
}
|
|
280
|
+
if (value === undefined) return ['undefined'];
|
|
281
|
+
if (value === null || typeof value === 'string' || typeof value === 'boolean') return value;
|
|
282
|
+
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
283
|
+
return ['number', Object.is(value, -0) ? '-0' : value];
|
|
284
|
+
}
|
|
285
|
+
if (typeof value !== 'object' || value === null || seen.has(value)) throw new Error('Unsupported cache input');
|
|
286
|
+
assertDataProperties(value);
|
|
287
|
+
if (value instanceof RegExp) {
|
|
288
|
+
if (
|
|
289
|
+
value.global || value.sticky || Object.getPrototypeOf(value) !== RegExp.prototype || Object.keys(value).length
|
|
290
|
+
) {
|
|
291
|
+
throw new Error('Dynamic pattern');
|
|
292
|
+
}
|
|
293
|
+
return ['regexp', value.source, value.flags];
|
|
294
|
+
}
|
|
295
|
+
if (Array.isArray(value)) assertPlainArray(value);
|
|
296
|
+
if (
|
|
297
|
+
!Array.isArray(value) && Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null
|
|
298
|
+
) {
|
|
299
|
+
throw new Error('Non-plain cache input');
|
|
300
|
+
}
|
|
301
|
+
seen.add(value);
|
|
302
|
+
try {
|
|
303
|
+
return [
|
|
304
|
+
Array.isArray(value) ? ['array', value.length] : 'object',
|
|
305
|
+
Object.keys(value).map((key) => [key, encodeValue((value as Record<string, unknown>)[key], seen, dynamicConfig)]),
|
|
306
|
+
];
|
|
307
|
+
} finally {
|
|
308
|
+
seen.delete(value);
|
|
309
|
+
}
|
|
310
|
+
}
|