@fluentic/style 0.1.0-beta.14 → 0.1.0-beta.16
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 +18 -0
- package/atomic/className.ts +4 -0
- package/atomic/rule.ts +15 -7
- package/atomic/utils/selector.ts +12 -3
- package/builder/classname/class_name_builder.ts +1 -1
- package/builder/data/const.ts +2 -0
- package/builder/data/data.ts +1 -1
- package/builder/data/merge/scope.ts +7 -0
- package/builder/data/merge/style.ts +12 -3
- package/builder/data/state.ts +1 -0
- package/builder/selector_override.ts +1 -1
- package/builder/selector_override_core.ts +17 -3
- package/builder/types/alias.ts +1 -1
- package/compiler/extract/extract.ts +21 -75
- package/compiler/extract/types.ts +4 -1
- package/compiler/transform/debug/plugin.ts +22 -0
- package/compiler/transform/evaluator/evaluator.ts +4 -1
- package/compiler/transform/extract/chain/chain.ts +82 -22
- package/compiler/transform/extract/chain/extract_chain.ts +2 -0
- package/compiler/transform/extract/plugin.ts +51 -25
- package/compiler/transform/extract/utils/imports.ts +4 -1
- package/compiler/transform/extract/utils/replacement.ts +2 -2
- package/compiler/transform/utils/babel.ts +1 -1
- package/compiler/utils/constants.ts +1 -0
- package/config/config/css.ts +5 -3
- package/config/configure.ts +4 -0
- package/config/document.ts +23 -0
- package/css/globalSheet.ts +66 -0
- package/css/index.ts +4 -1
- package/css/sheet.ts +34 -14
- package/dist/{className-yhJCGT0F.js → className-CC5PHcXI.js} +9 -2
- package/dist/className-CC5PHcXI.js.map +1 -0
- package/dist/{combine-CC9bY-hu.js → combine-BpOQWCtM.js} +5 -5
- package/dist/combine-BpOQWCtM.js.map +1 -0
- package/dist/compiler/index.mjs +1 -1
- package/dist/{compiler-Ct5xGIeu.mjs → compiler-AOb_VaKQ.mjs} +464 -166
- package/dist/compiler-AOb_VaKQ.mjs.map +1 -0
- package/dist/config/index.js +2 -2
- package/dist/{config-CCgsVvyR.js → config-B70LIQhi.js} +2 -2
- package/dist/{config-CCgsVvyR.js.map → config-B70LIQhi.js.map} +1 -1
- package/dist/{config-BiiMS4rU.js → config-BK7oK4Hx.js} +25 -4
- package/dist/config-BK7oK4Hx.js.map +1 -0
- package/dist/{config-DZKR6gH1.js → config-DFxeuT46.js} +4 -4
- package/dist/{config-DZKR6gH1.js.map → config-DFxeuT46.js.map} +1 -1
- package/dist/{css-IecKRNxs.js → css-BkNqUfLD.js} +112 -73
- package/dist/css-BkNqUfLD.js.map +1 -0
- package/dist/{css-WaHZ6gxv.js → css-C7tcD3IO.js} +611 -213
- package/dist/css-C7tcD3IO.js.map +1 -0
- package/dist/css-Cdxkur4h.js +414 -0
- package/dist/css-Cdxkur4h.js.map +1 -0
- package/dist/css.js +2 -2
- package/dist/css_extra-BC1Z_hDy.js +8 -0
- package/dist/{css_extra-DDeJc2Cu.js.map → css_extra-BC1Z_hDy.js.map} +1 -1
- package/dist/{css_extra-DDeJc2Cu.js → css_extra-qzi_eFFf.js} +2 -2
- package/dist/css_extra-qzi_eFFf.js.map +1 -0
- package/dist/{data-BgZmL55Y.js → data-MrBhvIQZ.js} +28 -19
- package/dist/data-MrBhvIQZ.js.map +1 -0
- package/dist/{debug-D-1hhd0G.js → debug-Bo43rBKc.js} +6 -9
- package/dist/debug-Bo43rBKc.js.map +1 -0
- package/dist/dev/rsc.js +134 -25
- package/dist/dev/rsc.js.map +1 -1
- package/dist/{dev-CBRbVaeq.js → dev-BoEgFs_x.js} +6 -6
- package/dist/{dev-CBRbVaeq.js.map → dev-BoEgFs_x.js.map} +1 -1
- package/dist/dev.js +1 -1
- package/dist/dialect/extracted/index.js +1 -1
- package/dist/dialect/index.js +1 -1
- package/dist/{elementMarker-CJcfpKL1.js → elementMarker-nYeJnJPQ.js} +334 -53
- package/dist/elementMarker-nYeJnJPQ.js.map +1 -0
- package/dist/entry/dev/adapter/preact.js +1 -1
- package/dist/entry/dev/adapter/react.js +1 -1
- package/dist/entry/dev/adapter/solid.js +1 -1
- 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 +11 -11
- package/dist/entry/prod/adapter/preact.js +1 -1
- package/dist/entry/prod/adapter/react.js +1 -1
- package/dist/entry/prod/adapter/solid.js +1 -1
- package/dist/entry/prod/css.js +3 -3
- package/dist/entry/prod/extract.js.map +1 -1
- package/dist/entry/prod.js +3 -3
- package/dist/entry/rsc-dev/adapter/preact.js +1 -1
- package/dist/entry/rsc-dev/adapter/react.js +1 -1
- package/dist/entry/rsc-dev/adapter/solid.js +1 -1
- package/dist/entry/rsc-dev/css.js +4 -3
- package/dist/entry/rsc-dev/dev.js +129 -24
- 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 +8 -7
- package/dist/entry/rsc-dev.js.map +1 -1
- package/dist/entry/rsc-prod/css.js +4 -4
- package/dist/entry/rsc-prod.js +4 -4
- package/dist/{rules-Dz-szpPu.js → env-BcNl1tsJ.js} +59 -21
- package/dist/env-BcNl1tsJ.js.map +1 -0
- package/dist/{getClassName-DtkplEIt.js → getClassName-5yYUibKw.js} +2 -2
- package/dist/{getClassName-DtkplEIt.js.map → getClassName-5yYUibKw.js.map} +1 -1
- package/dist/getClassName-9CsXbNls.js.map +1 -1
- package/dist/{getClassName-CeoxISNW.js → getClassName-B3azD1TO.js} +6 -4
- package/dist/getClassName-B3azD1TO.js.map +1 -0
- package/dist/{getClassName-BNe3Ycyy.js → getClassName-CkTq92nR.js} +4 -4
- package/dist/{getClassName-BNe3Ycyy.js.map → getClassName-CkTq92nR.js.map} +1 -1
- package/dist/{global-UOHFwqHN.js → global-DGcWZODV.js} +4 -7
- package/dist/{global-UOHFwqHN.js.map → global-DGcWZODV.js.map} +1 -1
- package/dist/{css-BhoclXaw.js → globalSheet-CdgVpvCb.js} +185 -426
- package/dist/globalSheet-CdgVpvCb.js.map +1 -0
- package/dist/{hash-DlXmmPPm.js → hash-CjTP-uES.js} +4 -4
- package/dist/hash-CjTP-uES.js.map +1 -0
- package/dist/index.js +9 -9
- package/dist/jsx/jsx-dev-runtime.js +1 -1
- 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 +1 -1
- package/dist/jsx/jsx-runtime.server.js +4 -4
- package/dist/jsx/jsx-runtime.server.js.map +1 -1
- package/dist/{jsx-8TwYuvgM.js → jsx-DA1LD8nU.js} +4 -4
- package/dist/{jsx-8TwYuvgM.js.map → jsx-DA1LD8nU.js.map} +1 -1
- package/dist/jsx_runtime-pt7DOZOE.js +13 -0
- package/dist/jsx_runtime-pt7DOZOE.js.map +1 -0
- package/dist/{loader-BVebGteg.mjs → loader-fAuIjIik.mjs} +3 -3
- package/dist/{loader-BVebGteg.mjs.map → loader-fAuIjIik.mjs.map} +1 -1
- package/dist/{misc-Bs2DgdG7.mjs → misc-CyZgGtc9.mjs} +3 -3
- package/dist/{misc-Bs2DgdG7.mjs.map → misc-CyZgGtc9.mjs.map} +1 -1
- package/dist/{namedTokens-CwniouKk.js → namedTokens-paLD-Pdk.js} +2 -2
- package/dist/{namedTokens-CwniouKk.js.map → namedTokens-paLD-Pdk.js.map} +1 -1
- package/dist/plugin/farm/index.mjs +3 -3
- package/dist/plugin/nextjs/index.mjs +4 -4
- package/dist/plugin/nextjs/loader.mjs +7 -5
- package/dist/plugin/nextjs/loader.mjs.map +1 -1
- package/dist/plugin/parcel/index.cjs +1 -1
- package/dist/plugin/parcel/index.mjs +2 -2
- package/dist/plugin/parcel/optimizer.cjs +1 -1
- package/dist/plugin/parcel/optimizer.mjs +2 -2
- 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 +2 -2
- package/dist/plugin/vite/index.mjs +3 -3
- package/dist/plugin/webpack/index.mjs +2 -2
- package/dist/plugin/webpack/loader.mjs +2 -2
- package/dist/presets/tailwind/index.js +3 -3
- package/dist/{registry-D1n78rd7.mjs → registry-BMijh1CM.mjs} +2 -2
- package/dist/{registry-D1n78rd7.mjs.map → registry-BMijh1CM.mjs.map} +1 -1
- package/dist/{resolveClassNameRuntime-BJcykzdl.js → resolveClassNameRuntime-B6vKNL5y.js} +2 -2
- package/dist/{resolveClassNameRuntime-BJcykzdl.js.map → resolveClassNameRuntime-B6vKNL5y.js.map} +1 -1
- package/dist/server.js +87 -17
- package/dist/server.js.map +1 -1
- package/dist/{shared-D4-AKGn6.mjs → shared-BfASWZo1.mjs} +4 -4
- package/dist/{shared-D4-AKGn6.mjs.map → shared-BfASWZo1.mjs.map} +1 -1
- package/dist/{shared-C9XQd8p_.cjs → shared-DY0kuBcN.cjs} +460 -162
- package/dist/shared-DY0kuBcN.cjs.map +1 -0
- package/dist/sheet-Biw_rI4_.js +1 -0
- package/dist/{config-TyjNpRrV.js → sheet-C6ymGhKV.js} +23 -2
- package/dist/sheet-C6ymGhKV.js.map +1 -0
- package/dist/sheet-D_grHnaJ.js +7 -0
- package/dist/sheet-D_grHnaJ.js.map +1 -0
- package/dist/{sidecar-CZTYX2vA.mjs → sidecar-cCzTDkzg.mjs} +3 -3
- package/dist/{sidecar-CZTYX2vA.mjs.map → sidecar-cCzTDkzg.mjs.map} +1 -1
- package/dist/{style-CmXHCPF4.js → style-CRs-vfY1.js} +12 -12
- package/dist/style-CRs-vfY1.js.map +1 -0
- package/dist/{env-C8TRVSyb.js → styleStore-D1IEmq1v.js} +435 -63
- package/dist/styleStore-D1IEmq1v.js.map +1 -0
- package/dist/styleStore-HI4V2puu.js +45 -0
- package/dist/styleStore-HI4V2puu.js.map +1 -0
- package/dist/{token-DMrBbat8.js → token-BX5jRxMb.js} +2 -2
- package/dist/{token-DMrBbat8.js.map → token-BX5jRxMb.js.map} +1 -1
- package/dist/{trace-C7EzEj2Q.js → trace-DdFJPELS.js} +3 -3
- package/dist/{trace-C7EzEj2Q.js.map → trace-DdFJPELS.js.map} +1 -1
- package/dist/{trace-DzCntvK4.js → trace-uHVvnYiw.js} +2 -2
- package/dist/{trace-DzCntvK4.js.map → trace-uHVvnYiw.js.map} +1 -1
- package/dist/{transform-CSZMklMb.js → transform-BZ4jPwy3.js} +2 -2
- package/dist/{transform-CSZMklMb.js.map → transform-BZ4jPwy3.js.map} +1 -1
- package/dist/types/atomic/className.d.ts +2 -2
- package/dist/types/atomic/utils/selector.d.ts +2 -1
- package/dist/types/builder/data/const.d.ts +1 -0
- package/dist/types/builder/data/data.d.ts +1 -1
- package/dist/types/builder/data/state.d.ts +1 -0
- package/dist/types/builder/selector_override.d.ts +1 -1
- package/dist/types/builder/selector_override_core.d.ts +2 -0
- package/dist/types/builder/types/alias.d.ts +2 -2
- package/dist/types/compiler/extract/types.d.ts +7 -1
- package/dist/types/compiler/transform/extract/chain/extract_chain.d.ts +2 -0
- package/dist/types/compiler/utils/constants.d.ts +1 -0
- package/dist/types/config/config/css.d.ts +2 -1
- package/dist/types/config/configure.d.ts +2 -0
- package/dist/types/config/document.d.ts +3 -0
- package/dist/types/css/globalSheet.d.ts +24 -0
- package/dist/types/css/index.d.ts +4 -1
- package/dist/types/css/sheet.d.ts +3 -2
- package/dist/types/entry/rsc_dev/css.d.ts +1 -0
- package/dist/types/runtime/rsc/constants.d.ts +2 -0
- package/dist/types/runtime/rsc/dev.d.ts +5 -0
- package/dist/types/runtime/rsc/getClassName.d.ts +3 -0
- package/dist/types/runtime/rsc/globalSheet.d.ts +22 -0
- package/dist/types/runtime/rsc/observer.d.ts +5 -0
- package/dist/types/runtime/rsc/styleStore.d.ts +2 -0
- package/dist/types/runtime/sheet/document.d.ts +3 -0
- package/dist/types/sheet/ordered.d.ts +4 -0
- package/dist/types/sheet/ordering.d.ts +15 -0
- package/dist/types/sheet/types.d.ts +7 -0
- package/dist/types/style/important.d.ts +2 -1
- package/dist/types/style/style.d.ts +2 -2
- package/dist/{utils-CoMwEfhG.mjs → utils-BO6Ix8t5.mjs} +4 -4
- package/dist/{utils-CoMwEfhG.mjs.map → utils-BO6Ix8t5.mjs.map} +1 -1
- package/dist/{utils-B7QcJ-Yw.js → utils-CB70kIh6.js} +3 -3
- package/dist/{utils-B7QcJ-Yw.js.map → utils-CB70kIh6.js.map} +1 -1
- package/dist/{utils-BYpkJ-uE.mjs → utils-EG9gh2g3.mjs} +3 -3
- package/dist/{utils-BYpkJ-uE.mjs.map → utils-EG9gh2g3.mjs.map} +1 -1
- package/dist/{utils-D4KMqCu2.js → utils-sG7IWYP6.js} +1089 -646
- package/dist/utils-sG7IWYP6.js.map +1 -0
- package/dist/utils.js +3 -3
- package/dist/{value-yd2SZ1XQ.js → value-BhyWGLkf.js} +16 -9
- package/dist/value-BhyWGLkf.js.map +1 -0
- package/dist/{webpack-B6z1UHh9.mjs → webpack-WXAJ3IYn.mjs} +5 -5
- package/dist/{webpack-B6z1UHh9.mjs.map → webpack-WXAJ3IYn.mjs.map} +1 -1
- package/entry/dev/sheet.ts +4 -2
- package/entry/rsc_dev/css.ts +2 -0
- package/jsx/rsc/jsx_dev_runtime.ts +11 -2
- package/jsx/rsc/jsx_runtime.ts +14 -3
- package/package.json +16 -1
- package/plugin/nextjs/loader.ts +18 -2
- package/runtime/core/elementMarker.ts +9 -3
- package/runtime/rsc/constants.ts +3 -0
- package/runtime/rsc/dev.ts +31 -15
- package/runtime/rsc/getClassName.ts +6 -0
- package/runtime/rsc/globalSheet.ts +130 -0
- package/runtime/rsc/observer.ts +118 -15
- package/runtime/rsc/styleStore.ts +12 -36
- 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 +4 -2
- package/runtime/sheet/rules.ts +3 -0
- package/sheet/dev/dev_sort.ts +5 -1
- package/sheet/dev/index.ts +23 -3
- package/sheet/ordered.ts +188 -0
- package/sheet/ordering.ts +138 -0
- package/sheet/prod.ts +17 -5
- package/sheet/types.ts +4 -0
- package/style/important.ts +3 -1
- package/style/style.ts +1 -1
- package/utils/trace.ts +1 -0
- package/dist/className-yhJCGT0F.js.map +0 -1
- package/dist/combine-CC9bY-hu.js.map +0 -1
- package/dist/compiler-Ct5xGIeu.mjs.map +0 -1
- package/dist/config-BiiMS4rU.js.map +0 -1
- package/dist/config-TyjNpRrV.js.map +0 -1
- package/dist/createTransformElement-BGznW-Mu.js +0 -34
- package/dist/createTransformElement-BGznW-Mu.js.map +0 -1
- package/dist/css-BhoclXaw.js.map +0 -1
- package/dist/css-IecKRNxs.js.map +0 -1
- package/dist/css-WaHZ6gxv.js.map +0 -1
- package/dist/data-BgZmL55Y.js.map +0 -1
- package/dist/debug-D-1hhd0G.js.map +0 -1
- package/dist/elementMarker-CJcfpKL1.js.map +0 -1
- package/dist/env-C8TRVSyb.js.map +0 -1
- package/dist/getClassName-CeoxISNW.js.map +0 -1
- package/dist/global-CWYOol4o.js +0 -14
- package/dist/global-CWYOol4o.js.map +0 -1
- package/dist/hash-DlXmmPPm.js.map +0 -1
- package/dist/jsx_runtime-CPojW0KD.js +0 -12
- package/dist/jsx_runtime-CPojW0KD.js.map +0 -1
- package/dist/rules-Dz-szpPu.js.map +0 -1
- package/dist/shared-C9XQd8p_.cjs.map +0 -1
- package/dist/sheet-LU89fcH_.js +0 -7
- package/dist/sheet-LU89fcH_.js.map +0 -1
- package/dist/style-CmXHCPF4.js.map +0 -1
- package/dist/styleStore-B0x4Ahpx.js +0 -60
- package/dist/styleStore-B0x4Ahpx.js.map +0 -1
- package/dist/styleStore-BrpgLNgc.js +0 -57
- package/dist/styleStore-BrpgLNgc.js.map +0 -1
- package/dist/utils-D4KMqCu2.js.map +0 -1
- package/dist/value-yd2SZ1XQ.js.map +0 -1
|
@@ -3,3 +3,8 @@ export declare function startRscDevObserver(root?: ParentNode): void;
|
|
|
3
3
|
export declare function stopRscDevObserver(): void;
|
|
4
4
|
export declare function getRscDevInitialStyleSelector(): string;
|
|
5
5
|
export declare function parseRscStylePayload(value: string | null): SheetRule[];
|
|
6
|
+
export declare function parseGlobalRulePayload(value: string | null): Array<{
|
|
7
|
+
owner: string;
|
|
8
|
+
revision: string;
|
|
9
|
+
rules: SheetRule[];
|
|
10
|
+
}> | null;
|
|
@@ -2,4 +2,6 @@ import type { SheetRule } from "../../sheet/index.js";
|
|
|
2
2
|
export declare function addRscStyleRules(rules: SheetRule[]): void;
|
|
3
3
|
export declare function getRscStyleCssIfChanged(): string | null;
|
|
4
4
|
export declare function getRscStyleCss(): string;
|
|
5
|
+
export declare function getRscStyleRules(): readonly SheetRule[];
|
|
6
|
+
export declare function serializeRscRules(rules: readonly SheetRule[]): string;
|
|
5
7
|
export declare function clearRscStyleStore(): void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SheetOptions, StyleSheet } from "./types.js";
|
|
2
|
+
export declare function refreshOrderedSheets(): void;
|
|
3
|
+
/** Keep whole global sheets together; move DOM groups without rebuilding unrelated rules. */
|
|
4
|
+
export declare function createOrderedSheet(create: (options: SheetOptions) => StyleSheet, options: SheetOptions, dev: boolean): StyleSheet;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type CssConfig } from "../config/config/css.js";
|
|
2
|
+
import type { SheetRule } from "./types.js";
|
|
3
|
+
export type OrderedRule = Pick<SheetRule, 'css' | 'priority' | 'layer' | 'important' | 'importantNative' | 'sheet' | 'globalSheet'>;
|
|
4
|
+
export type OrderingConfig = Pick<CssConfig, 'layer' | 'layers' | 'layerNamespace'>;
|
|
5
|
+
export declare function sheetRuleLayer(rule: OrderedRule, config?: OrderingConfig): SheetRule['layer'];
|
|
6
|
+
export declare function sheetRuleGroup(rule: OrderedRule, config?: OrderingConfig): string;
|
|
7
|
+
export declare function compareSheetGroups(a: OrderedRule, b: OrderedRule): number;
|
|
8
|
+
export declare function compareSheetRules(a: OrderedRule, b: OrderedRule, config?: OrderingConfig): number;
|
|
9
|
+
/** Stable group sort: equal global orders keep the first-discovered sheet first. */
|
|
10
|
+
export declare function orderSheetRules<T extends OrderedRule>(rules: readonly T[], config?: OrderingConfig): T[];
|
|
11
|
+
/** Reserve each parent's first child for managed important declarations. */
|
|
12
|
+
export declare function sheetLayerOrder(names: readonly string[], config?: OrderingConfig, reservedParents?: readonly string[]): string;
|
|
13
|
+
/** Build only ordering declarations; runtime flushing need not serialize rule bodies. */
|
|
14
|
+
export declare function sheetOrderingPreamble(rules: readonly OrderedRule[], config?: OrderingConfig, mode?: 'sort' | 'layer'): string;
|
|
15
|
+
export declare function serializeOrderedRules(rules: readonly OrderedRule[], config?: OrderingConfig, mode?: 'sort' | 'layer'): string;
|
|
@@ -8,6 +8,12 @@ export type SheetRule = {
|
|
|
8
8
|
key?: string | null;
|
|
9
9
|
priority?: LayerPriority | null;
|
|
10
10
|
important?: boolean;
|
|
11
|
+
importantNative?: boolean;
|
|
12
|
+
sheet?: boolean;
|
|
13
|
+
globalSheet?: {
|
|
14
|
+
id: string;
|
|
15
|
+
order: number;
|
|
16
|
+
};
|
|
11
17
|
layer?: 'style' | 'sheet' | false | NamedSheetLayer;
|
|
12
18
|
callsite?: SheetCallsite | null;
|
|
13
19
|
debug?: DebugData | null;
|
|
@@ -26,5 +32,6 @@ export type StyleSheet = {
|
|
|
26
32
|
updateLayers(layers: readonly string[]): void;
|
|
27
33
|
insert(rule: SheetRule | string): void;
|
|
28
34
|
flush(): void;
|
|
35
|
+
replaceRules?(owner: string, rules: SheetRule[]): void;
|
|
29
36
|
destroy?(): void;
|
|
30
37
|
};
|
|
@@ -2,7 +2,8 @@ declare const STYLE_IMPORTANT: unique symbol;
|
|
|
2
2
|
export type StyleImportantValue<T = unknown> = {
|
|
3
3
|
readonly [STYLE_IMPORTANT]: true;
|
|
4
4
|
readonly value: T;
|
|
5
|
+
readonly native?: boolean;
|
|
5
6
|
};
|
|
6
|
-
export declare function importantValue<T>(value: T): StyleImportantValue<T>;
|
|
7
|
+
export declare function importantValue<T>(value: T, native?: boolean): StyleImportantValue<T>;
|
|
7
8
|
export declare function isStyleImportantValue(value: unknown): value is StyleImportantValue;
|
|
8
9
|
export {};
|
|
@@ -283,7 +283,7 @@ export declare const style: import("../builder/types/fns.js").StyleSelfFn<CSSPro
|
|
|
283
283
|
supports: import("../selector/index.js").Selector<"@supports $$", string>;
|
|
284
284
|
} & import("../utils/type.js").Collapse>;
|
|
285
285
|
weight: <const T>(value: T, weight: number) => import("./weight.js").StyleWeightValue<T>;
|
|
286
|
-
important: <const T>(value: T) => import("./important.js").StyleImportantValue<T>;
|
|
286
|
+
important: <const T>(value: T, native?: boolean) => import("./important.js").StyleImportantValue<T>;
|
|
287
287
|
raw: <T extends import("./types.js").StyleObject<CSSProperties>>(style: T) => T;
|
|
288
288
|
plain: <T extends import("./types.js").PlainStyleObject<CSSProperties>>(style: T) => T;
|
|
289
289
|
keyframes: <T extends import("./keyframes.js").StyleKeyframesObject<CSSProperties>>(frames: T) => import("./valueRef.js").AtRuleRef;
|
|
@@ -410,7 +410,7 @@ export declare function createStyleFn<Style = CSSProperties, const Selectors ext
|
|
|
410
410
|
slot: import("../builder/types/fns.js").SlotSelfFn<Style, Selectors>;
|
|
411
411
|
scope: import("../builder/index.js").ScopeSelfFn<Selectors> & import("../builder/data/index.js").BuilderData<unknown, 4> & ((slot: import("../builder/data/index.js").SlotData<any>) => import("../builder/data/index.js").ScopeTargetData) & import("../builder/types/fns.js").ScopeSelectorFns<Selectors & import("../utils/type.js").Collapse>;
|
|
412
412
|
weight: <const T>(value: T, weight: number) => import("./weight.js").StyleWeightValue<T>;
|
|
413
|
-
important: <const T>(value: T) => import("./important.js").StyleImportantValue<T>;
|
|
413
|
+
important: <const T>(value: T, native?: boolean) => import("./important.js").StyleImportantValue<T>;
|
|
414
414
|
raw: <T extends import("./types.js").StyleObject<Style>>(style: T) => T;
|
|
415
415
|
plain: <T extends import("./types.js").PlainStyleObject<Style>>(style: T) => T;
|
|
416
416
|
keyframes: <T extends import("./keyframes.js").StyleKeyframesObject<Style>>(frames: T) => import("./valueRef.js").AtRuleRef;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as getStyleFnMeta, s as normalizePath } from "./compiler-
|
|
2
|
-
import { f as resolvePluginSourcemapOptions, h as getPluginBuildDevConfig, m as getPluginBuildConfig } from "./misc-
|
|
3
|
-
import { n as STYLE_IMPORTS, t as createWebpackRegistry } from "./registry-
|
|
1
|
+
import { c as getStyleFnMeta, s as normalizePath } from "./compiler-AOb_VaKQ.mjs";
|
|
2
|
+
import { f as resolvePluginSourcemapOptions, h as getPluginBuildDevConfig, m as getPluginBuildConfig } from "./misc-CyZgGtc9.mjs";
|
|
3
|
+
import { n as STYLE_IMPORTS, t as createWebpackRegistry } from "./registry-BMijh1CM.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
import fs from "node:fs";
|
|
@@ -179,4 +179,4 @@ function replaceCssMarkerAsset(args) {
|
|
|
179
179
|
//#endregion
|
|
180
180
|
export { DEV_CSS_ROUTE as _, createNextBuildDevConfig as a, getNextCacheDir as c, isAppLayoutFile as d, nextRegistry as f, CSS_ENTRY_IMPORT_PATH as g, resolveNextCompilerOptions as h, createNextBuildConfig as i, getNextPrecollectCacheSubdir as l, replaceCssMarkerAsset as m, addAliases as n, createNextConfigHash as o, removeUndefinedValues as p, addWebpackPlugin as r, createSerializableImportSources as s, NEXT_COMPILER_IDS as t, getTransformLoaderPath as u, LOADER_IMPORT_PATH as v };
|
|
181
181
|
|
|
182
|
-
//# sourceMappingURL=utils-
|
|
182
|
+
//# sourceMappingURL=utils-BO6Ix8t5.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-CoMwEfhG.mjs","names":[],"sources":["../plugin/nextjs/constants.ts","../plugin/nextjs/utils.ts"],"sourcesContent":["import { STYLE_IMPORTS } from '../utils/imports';\n\nexport const DEV_CSS_ROUTE = '/__fluentic/dev.css';\n\nexport const LOADER_IMPORT_PATH = STYLE_IMPORTS.Plugin + '/nextjs/loader';\n\nexport const CSS_ENTRY_IMPORT_PATH = STYLE_IMPORTS.Plugin + '/nextjs/bundle.css';\n","import { createHash } from 'node:crypto';\nimport fs from 'node:fs';\nimport { createRequire } from 'node:module';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport type { Compilation, Compiler, WebpackPluginInstance } from 'webpack';\nimport type { Compiler as PluginCompiler } from '../../compiler';\nimport type { ImportSource } from '../../compiler/utils/import_source';\nimport { normalizePath } from '../../compiler/utils/path';\nimport type { BuildConfig, BuildDevConfig } from '../../config/build';\nimport { getStyleFnMeta } from '../../style/style';\nimport { createWebpackRegistry } from '../bundler/webpack/shared/registry';\nimport type { FileCssCache } from '../utils/cache';\nimport type { PluginOptions as BasePluginOptions } from '../utils/compiler';\nimport type { TransformFilter } from '../utils/filter';\nimport { getPluginBuildConfig, getPluginBuildDevConfig } from '../utils/runtimeEntry';\nimport type { SourcemapSidecar } from '../utils/sidecar';\nimport { resolvePluginSourcemapOptions } from '../utils/sourcemap';\nimport { LOADER_IMPORT_PATH } from './constants';\nimport type { PluginOptions, WebpackConfiguration } from './types';\n\nexport const nextRegistry = createWebpackRegistry('nextjs.registry');\n\nexport const PRECOLLECT_CACHE_DIRS = {\n dev: 'nextjs/precollect/dev',\n prod: 'nextjs/precollect/prod',\n};\n\nexport const NEXT_COMPILER_IDS = {\n turbopack: 'nextjs:turbopack',\n webpackServer: 'nextjs:webpack-server',\n webpackClient: 'nextjs:webpack-client',\n};\n\nexport type { PluginCompiler };\n\nexport type NextLoaderState = {\n compiler: PluginCompiler;\n filter: TransformFilter;\n dev: boolean;\n isServer: boolean;\n configHash: string;\n devCssHref: string | null;\n cssEntryImportPath: string;\n cssCache: Pick<FileCssCache, 'setFileCss'> | null;\n};\n\nexport type NextWebpackEntryValue = string | string[] | {\n import?: string | string[];\n [key: string]: unknown;\n};\n\nexport function getTransformLoaderPath() {\n return createRequire(import.meta.url).resolve(LOADER_IMPORT_PATH);\n}\n\nexport function getNextCacheDir(rootDir: string, cacheDir?: string) {\n return cacheDir ?? path.join(rootDir, '.next/cache/fluentic-style');\n}\n\nexport function getNextPrecollectCacheSubdir(dev: boolean) {\n return dev ? PRECOLLECT_CACHE_DIRS.dev : PRECOLLECT_CACHE_DIRS.prod;\n}\n\nexport function createNextBuildConfig(options: PluginOptions): BuildConfig {\n return getPluginBuildConfig(options);\n}\n\nexport function createNextBuildDevConfig(options: PluginOptions): BuildDevConfig | null {\n return getPluginBuildDevConfig(options);\n}\n\nexport function createNextConfigHash(\n buildConfig: BuildConfig,\n dev: boolean,\n importSources?: readonly ImportSource[] | null,\n) {\n const values = [\n createPackageCacheIdentity(),\n dev ? 'dev' : 'prod',\n buildConfig.hoist ? 'hoist' : 'no-hoist',\n JSON.stringify(createSerializableImportSources(importSources)),\n ];\n\n return createHash('sha256').update(values.join('\\0')).digest('hex');\n}\n\nfunction createPackageCacheIdentity() {\n const require = createRequire(import.meta.url);\n let entryPath = '';\n\n try {\n entryPath = require.resolve('@fluentic/style/plugin/nextjs');\n } catch {\n entryPath = fileURLToPath(import.meta.url);\n }\n\n const packageInfo = findPackageInfo(entryPath);\n const parts = [\n packageInfo.version,\n normalizePath(packageInfo.packageRoot),\n normalizePath(entryPath),\n getStatIdentity(packageInfo.packageJsonPath),\n getStatIdentity(entryPath),\n ];\n\n return parts.join('\\0');\n}\n\nfunction findPackageInfo(entryPath: string) {\n let current = path.dirname(entryPath);\n\n while (true) {\n const packageJsonPath = path.join(current, 'package.json');\n\n try {\n const pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')) as {\n name?: string;\n version?: string;\n };\n\n if (pkg.name === '@fluentic/style') {\n return {\n packageRoot: current,\n packageJsonPath,\n version: pkg.version ?? '',\n };\n }\n } catch {\n // Keep walking toward the filesystem root.\n }\n\n const parent = path.dirname(current);\n if (parent === current) break;\n current = parent;\n }\n\n return {\n packageRoot: path.dirname(entryPath),\n packageJsonPath: '',\n version: '',\n };\n}\n\nfunction getStatIdentity(filePath: string) {\n if (!filePath) return '';\n\n try {\n const stat = fs.statSync(filePath);\n return `${stat.size}:${stat.mtimeMs}`;\n } catch {\n return '';\n }\n}\n\nexport function createSerializableImportSources(\n importSources: readonly ImportSource[] | null | undefined,\n): ImportSource[] | undefined {\n if (!importSources?.length) return undefined;\n\n const result: ImportSource[] = [];\n\n for (const entry of importSources) {\n if (entry.check) continue;\n\n const source = serializeImportSourcePattern(entry.source);\n const name = entry.name;\n const meta = entry.meta ?? (entry.styleFn ? getStyleFnMeta(entry.styleFn) : null);\n\n if (!meta) continue;\n if (entry.source !== undefined && source === undefined) continue;\n\n result.push(removeUndefinedValues({\n source,\n name,\n meta,\n }));\n }\n\n return result.length ? result : undefined;\n}\n\nfunction serializeImportSourcePattern(\n source: ImportSource['source'],\n): string | string[] | undefined {\n if (source === undefined) return undefined;\n\n if (Array.isArray(source)) {\n const result: string[] = [];\n\n for (const item of source) {\n if (typeof item !== 'string') return undefined;\n result.push(item);\n }\n\n return result;\n }\n\n return typeof source === 'string' ? source : undefined;\n}\n\nexport function resolveNextCompilerOptions(\n options: PluginOptions,\n sidecar: SourcemapSidecar | null,\n buildConfig: BuildConfig,\n buildDevConfig: BuildDevConfig | null,\n dev: boolean,\n): BasePluginOptions {\n const resolved = resolvePluginSourcemapOptions({\n ...options,\n devSourcemap: dev ? 'sidecarServer' : 'sourceUrl',\n }, sidecar);\n\n return {\n ...resolved,\n css: {\n ...resolved.css,\n ...buildConfig.css,\n },\n dev: {\n ...resolved.dev,\n ...buildDevConfig,\n },\n };\n}\n\nexport function removeUndefinedValues<T>(value: T): T {\n if (Array.isArray(value)) {\n return value.map((item) => removeUndefinedValues(item)) as T;\n }\n\n if (!value || typeof value !== 'object') {\n return value;\n }\n\n const result: Record<string, unknown> = {};\n\n for (const [key, item] of Object.entries(value)) {\n if (item !== undefined) {\n result[key] = removeUndefinedValues(item);\n }\n }\n\n return result as T;\n}\n\nexport function prependClientEntry(entry: unknown, moduleId: string) {\n if (typeof entry === 'function') {\n return async () => prependClientEntry(await entry(), moduleId);\n }\n\n if (!entry || typeof entry !== 'object') return entry;\n\n const result: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(entry)) {\n result[key] = prependEntryValue(value as NextWebpackEntryValue, moduleId);\n }\n\n return result;\n}\n\nexport function prependEntryValue(entry: NextWebpackEntryValue, moduleId: string): NextWebpackEntryValue {\n if (typeof entry === 'string') {\n return entry === moduleId ? entry : [moduleId, entry];\n }\n\n if (Array.isArray(entry)) {\n return entry.includes(moduleId) ? entry : [moduleId, ...entry];\n }\n\n const imports = entry.import;\n if (!imports) return { ...entry, import: moduleId };\n\n return {\n ...entry,\n import: Array.isArray(imports)\n ? imports.includes(moduleId) ? imports : [moduleId, ...imports]\n : imports === moduleId\n ? imports\n : [moduleId, imports],\n };\n}\n\nexport function isAppLayoutFile(filePath: string) {\n return /\\/app\\/(?:[^/]+\\/)*layout\\.[cm]?[jt]sx?$/.test(normalizePath(filePath));\n}\n\nexport function hasCssMarker(source: string, marker: string) {\n return source.includes(marker);\n}\n\nexport function replaceCssMarker(source: string, marker: string, css: string) {\n return source.split(marker).join(css);\n}\n\nexport function addAliases(config: WebpackConfiguration, aliases: Record<string, string>) {\n if (!config.resolve) config.resolve = {};\n if (!config.resolve.alias) config.resolve.alias = {};\n Object.assign(config.resolve.alias, aliases);\n}\n\nexport function addWebpackPlugin(config: WebpackConfiguration, plugin: WebpackPluginInstance) {\n if (!config.plugins) config.plugins = [];\n config.plugins.push(plugin);\n}\n\nexport function replaceCssMarkerAsset(args: {\n compiler: Compiler;\n compilation: Compilation;\n css: string;\n marker: string;\n}) {\n for (const asset of args.compilation.getAssets()) {\n if (!asset.name.endsWith('.css')) continue;\n\n const source = asset.source.source().toString();\n if (!hasCssMarker(source, args.marker)) continue;\n\n args.compilation.updateAsset(\n asset.name,\n new args.compiler.webpack.sources.RawSource(\n replaceCssMarker(source, args.marker, args.css),\n ),\n );\n\n return true;\n }\n\n return false;\n}\n"],"mappings":";;;;;;;;;AAEA,MAAa,gBAAgB;AAE7B,MAAa,qBAAqB,cAAc,SAAS;AAEzD,MAAa,wBAAwB,cAAc,SAAS;;;ACe5D,MAAa,eAAe,sBAAsB,iBAAiB;AAEnE,MAAa,wBAAwB;CACnC,KAAK;CACL,MAAM;AACR;AAEA,MAAa,oBAAoB;CAC/B,WAAW;CACX,eAAe;CACf,eAAe;AACjB;AAoBA,SAAgB,yBAAyB;CACvC,OAAO,cAAc,OAAO,KAAK,GAAG,EAAE,QAAQ,kBAAkB;AAClE;AAEA,SAAgB,gBAAgB,SAAiB,UAAmB;CAClE,OAAO,YAAY,KAAK,KAAK,SAAS,4BAA4B;AACpE;AAEA,SAAgB,6BAA6B,KAAc;CACzD,OAAO,MAAM,sBAAsB,MAAM,sBAAsB;AACjE;AAEA,SAAgB,sBAAsB,SAAqC;CACzE,OAAO,qBAAqB,OAAO;AACrC;AAEA,SAAgB,yBAAyB,SAA+C;CACtF,OAAO,wBAAwB,OAAO;AACxC;AAEA,SAAgB,qBACd,aACA,KACA,eACA;CACA,MAAM,SAAS;EACb,2BAA2B;EAC3B,MAAM,QAAQ;EACd,YAAY,QAAQ,UAAU;EAC9B,KAAK,UAAU,gCAAgC,aAAa,CAAC;CAC/D;CAEA,OAAO,WAAW,QAAQ,EAAE,OAAO,OAAO,KAAK,IAAI,CAAC,EAAE,OAAO,KAAK;AACpE;AAEA,SAAS,6BAA6B;CACpC,MAAM,UAAU,cAAc,OAAO,KAAK,GAAG;CAC7C,IAAI,YAAY;CAEhB,IAAI;EACF,YAAY,QAAQ,QAAQ,+BAA+B;CAC7D,QAAQ;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C;AAEA,SAAgB,WAAW,QAA8B,SAAiC;CACxF,IAAI,CAAC,OAAO,SAAS,OAAO,UAAU,CAAC;CACvC,IAAI,CAAC,OAAO,QAAQ,OAAO,OAAO,QAAQ,QAAQ,CAAC;CACnD,OAAO,OAAO,OAAO,QAAQ,OAAO,OAAO;AAC7C;AAEA,SAAgB,iBAAiB,QAA8B,QAA+B;CAC5F,IAAI,CAAC,OAAO,SAAS,OAAO,UAAU,CAAC;CACvC,OAAO,QAAQ,KAAK,MAAM;AAC5B;AAEA,SAAgB,sBAAsB,MAKnC;CACD,KAAK,MAAM,SAAS,KAAK,YAAY,UAAU,GAAG;EAChD,IAAI,CAAC,MAAM,KAAK,SAAS,MAAM,GAAG;EAElC,MAAM,SAAS,MAAM,OAAO,OAAO,EAAE,SAAS;EAC9C,IAAI,CAAC,aAAa,QAAQ,KAAK,MAAM,GAAG;EAExC,KAAK,YAAY,YACf,MAAM,MACN,IAAI,KAAK,SAAS,QAAQ,QAAQ,UAChC,iBAAiB,QAAQ,KAAK,QAAQ,KAAK,GAAG,CAChD,CACF;EAEA,OAAO;CACT;CAEA,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"utils-BO6Ix8t5.mjs","names":[],"sources":["../plugin/nextjs/constants.ts","../plugin/nextjs/utils.ts"],"sourcesContent":["import { STYLE_IMPORTS } from '../utils/imports';\n\nexport const DEV_CSS_ROUTE = '/__fluentic/dev.css';\n\nexport const LOADER_IMPORT_PATH = STYLE_IMPORTS.Plugin + '/nextjs/loader';\n\nexport const CSS_ENTRY_IMPORT_PATH = STYLE_IMPORTS.Plugin + '/nextjs/bundle.css';\n","import { createHash } from 'node:crypto';\nimport fs from 'node:fs';\nimport { createRequire } from 'node:module';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport type { Compilation, Compiler, WebpackPluginInstance } from 'webpack';\nimport type { Compiler as PluginCompiler } from '../../compiler';\nimport type { ImportSource } from '../../compiler/utils/import_source';\nimport { normalizePath } from '../../compiler/utils/path';\nimport type { BuildConfig, BuildDevConfig } from '../../config/build';\nimport { getStyleFnMeta } from '../../style/style';\nimport { createWebpackRegistry } from '../bundler/webpack/shared/registry';\nimport type { FileCssCache } from '../utils/cache';\nimport type { PluginOptions as BasePluginOptions } from '../utils/compiler';\nimport type { TransformFilter } from '../utils/filter';\nimport { getPluginBuildConfig, getPluginBuildDevConfig } from '../utils/runtimeEntry';\nimport type { SourcemapSidecar } from '../utils/sidecar';\nimport { resolvePluginSourcemapOptions } from '../utils/sourcemap';\nimport { LOADER_IMPORT_PATH } from './constants';\nimport type { PluginOptions, WebpackConfiguration } from './types';\n\nexport const nextRegistry = createWebpackRegistry('nextjs.registry');\n\nexport const PRECOLLECT_CACHE_DIRS = {\n dev: 'nextjs/precollect/dev',\n prod: 'nextjs/precollect/prod',\n};\n\nexport const NEXT_COMPILER_IDS = {\n turbopack: 'nextjs:turbopack',\n webpackServer: 'nextjs:webpack-server',\n webpackClient: 'nextjs:webpack-client',\n};\n\nexport type { PluginCompiler };\n\nexport type NextLoaderState = {\n compiler: PluginCompiler;\n filter: TransformFilter;\n dev: boolean;\n isServer: boolean;\n configHash: string;\n devCssHref: string | null;\n cssEntryImportPath: string;\n cssCache: Pick<FileCssCache, 'setFileCss'> | null;\n};\n\nexport type NextWebpackEntryValue = string | string[] | {\n import?: string | string[];\n [key: string]: unknown;\n};\n\nexport function getTransformLoaderPath() {\n return createRequire(import.meta.url).resolve(LOADER_IMPORT_PATH);\n}\n\nexport function getNextCacheDir(rootDir: string, cacheDir?: string) {\n return cacheDir ?? path.join(rootDir, '.next/cache/fluentic-style');\n}\n\nexport function getNextPrecollectCacheSubdir(dev: boolean) {\n return dev ? PRECOLLECT_CACHE_DIRS.dev : PRECOLLECT_CACHE_DIRS.prod;\n}\n\nexport function createNextBuildConfig(options: PluginOptions): BuildConfig {\n return getPluginBuildConfig(options);\n}\n\nexport function createNextBuildDevConfig(options: PluginOptions): BuildDevConfig | null {\n return getPluginBuildDevConfig(options);\n}\n\nexport function createNextConfigHash(\n buildConfig: BuildConfig,\n dev: boolean,\n importSources?: readonly ImportSource[] | null,\n) {\n const values = [\n createPackageCacheIdentity(),\n dev ? 'dev' : 'prod',\n buildConfig.hoist ? 'hoist' : 'no-hoist',\n JSON.stringify(createSerializableImportSources(importSources)),\n ];\n\n return createHash('sha256').update(values.join('\\0')).digest('hex');\n}\n\nfunction createPackageCacheIdentity() {\n const require = createRequire(import.meta.url);\n let entryPath = '';\n\n try {\n entryPath = require.resolve('@fluentic/style/plugin/nextjs');\n } catch {\n entryPath = fileURLToPath(import.meta.url);\n }\n\n const packageInfo = findPackageInfo(entryPath);\n const parts = [\n packageInfo.version,\n normalizePath(packageInfo.packageRoot),\n normalizePath(entryPath),\n getStatIdentity(packageInfo.packageJsonPath),\n getStatIdentity(entryPath),\n ];\n\n return parts.join('\\0');\n}\n\nfunction findPackageInfo(entryPath: string) {\n let current = path.dirname(entryPath);\n\n while (true) {\n const packageJsonPath = path.join(current, 'package.json');\n\n try {\n const pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')) as {\n name?: string;\n version?: string;\n };\n\n if (pkg.name === '@fluentic/style') {\n return {\n packageRoot: current,\n packageJsonPath,\n version: pkg.version ?? '',\n };\n }\n } catch {\n // Keep walking toward the filesystem root.\n }\n\n const parent = path.dirname(current);\n if (parent === current) break;\n current = parent;\n }\n\n return {\n packageRoot: path.dirname(entryPath),\n packageJsonPath: '',\n version: '',\n };\n}\n\nfunction getStatIdentity(filePath: string) {\n if (!filePath) return '';\n\n try {\n const stat = fs.statSync(filePath);\n return `${stat.size}:${stat.mtimeMs}`;\n } catch {\n return '';\n }\n}\n\nexport function createSerializableImportSources(\n importSources: readonly ImportSource[] | null | undefined,\n): ImportSource[] | undefined {\n if (!importSources?.length) return undefined;\n\n const result: ImportSource[] = [];\n\n for (const entry of importSources) {\n if (entry.check) continue;\n\n const source = serializeImportSourcePattern(entry.source);\n const name = entry.name;\n const meta = entry.meta ?? (entry.styleFn ? getStyleFnMeta(entry.styleFn) : null);\n\n if (!meta) continue;\n if (entry.source !== undefined && source === undefined) continue;\n\n result.push(removeUndefinedValues({\n source,\n name,\n meta,\n }));\n }\n\n return result.length ? result : undefined;\n}\n\nfunction serializeImportSourcePattern(\n source: ImportSource['source'],\n): string | string[] | undefined {\n if (source === undefined) return undefined;\n\n if (Array.isArray(source)) {\n const result: string[] = [];\n\n for (const item of source) {\n if (typeof item !== 'string') return undefined;\n result.push(item);\n }\n\n return result;\n }\n\n return typeof source === 'string' ? source : undefined;\n}\n\nexport function resolveNextCompilerOptions(\n options: PluginOptions,\n sidecar: SourcemapSidecar | null,\n buildConfig: BuildConfig,\n buildDevConfig: BuildDevConfig | null,\n dev: boolean,\n): BasePluginOptions {\n const resolved = resolvePluginSourcemapOptions({\n ...options,\n devSourcemap: dev ? 'sidecarServer' : 'sourceUrl',\n }, sidecar);\n\n return {\n ...resolved,\n css: {\n ...resolved.css,\n ...buildConfig.css,\n },\n dev: {\n ...resolved.dev,\n ...buildDevConfig,\n },\n };\n}\n\nexport function removeUndefinedValues<T>(value: T): T {\n if (Array.isArray(value)) {\n return value.map((item) => removeUndefinedValues(item)) as T;\n }\n\n if (!value || typeof value !== 'object') {\n return value;\n }\n\n const result: Record<string, unknown> = {};\n\n for (const [key, item] of Object.entries(value)) {\n if (item !== undefined) {\n result[key] = removeUndefinedValues(item);\n }\n }\n\n return result as T;\n}\n\nexport function prependClientEntry(entry: unknown, moduleId: string) {\n if (typeof entry === 'function') {\n return async () => prependClientEntry(await entry(), moduleId);\n }\n\n if (!entry || typeof entry !== 'object') return entry;\n\n const result: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(entry)) {\n result[key] = prependEntryValue(value as NextWebpackEntryValue, moduleId);\n }\n\n return result;\n}\n\nexport function prependEntryValue(entry: NextWebpackEntryValue, moduleId: string): NextWebpackEntryValue {\n if (typeof entry === 'string') {\n return entry === moduleId ? entry : [moduleId, entry];\n }\n\n if (Array.isArray(entry)) {\n return entry.includes(moduleId) ? entry : [moduleId, ...entry];\n }\n\n const imports = entry.import;\n if (!imports) return { ...entry, import: moduleId };\n\n return {\n ...entry,\n import: Array.isArray(imports)\n ? imports.includes(moduleId) ? imports : [moduleId, ...imports]\n : imports === moduleId\n ? imports\n : [moduleId, imports],\n };\n}\n\nexport function isAppLayoutFile(filePath: string) {\n return /\\/app\\/(?:[^/]+\\/)*layout\\.[cm]?[jt]sx?$/.test(normalizePath(filePath));\n}\n\nexport function hasCssMarker(source: string, marker: string) {\n return source.includes(marker);\n}\n\nexport function replaceCssMarker(source: string, marker: string, css: string) {\n return source.split(marker).join(css);\n}\n\nexport function addAliases(config: WebpackConfiguration, aliases: Record<string, string>) {\n if (!config.resolve) config.resolve = {};\n if (!config.resolve.alias) config.resolve.alias = {};\n Object.assign(config.resolve.alias, aliases);\n}\n\nexport function addWebpackPlugin(config: WebpackConfiguration, plugin: WebpackPluginInstance) {\n if (!config.plugins) config.plugins = [];\n config.plugins.push(plugin);\n}\n\nexport function replaceCssMarkerAsset(args: {\n compiler: Compiler;\n compilation: Compilation;\n css: string;\n marker: string;\n}) {\n for (const asset of args.compilation.getAssets()) {\n if (!asset.name.endsWith('.css')) continue;\n\n const source = asset.source.source().toString();\n if (!hasCssMarker(source, args.marker)) continue;\n\n args.compilation.updateAsset(\n asset.name,\n new args.compiler.webpack.sources.RawSource(\n replaceCssMarker(source, args.marker, args.css),\n ),\n );\n\n return true;\n }\n\n return false;\n}\n"],"mappings":";;;;;;;;;AAEA,MAAa,gBAAgB;AAE7B,MAAa,qBAAqB,cAAc,SAAS;AAEzD,MAAa,wBAAwB,cAAc,SAAS;;;ACe5D,MAAa,eAAe,sBAAsB,iBAAiB;AAEnE,MAAa,wBAAwB;CACnC,KAAK;CACL,MAAM;AACR;AAEA,MAAa,oBAAoB;CAC/B,WAAW;CACX,eAAe;CACf,eAAe;AACjB;AAoBA,SAAgB,yBAAyB;CACvC,OAAO,cAAc,OAAO,KAAK,GAAG,EAAE,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G;EAExC,KAAK,YAAY,YACf,MAAM,MACN,IAAI,KAAK,SAAS,QAAQ,QAAQ,UAChC,iBAAiB,QAAQ,KAAK,QAAQ,KAAK,GAAG,CAChD,CACF;EAEA,OAAO;CACT;CAEA,OAAO;AACT"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as getClassName } from "./getClassName-
|
|
2
|
-
import {
|
|
1
|
+
import { t as getClassName } from "./getClassName-B3azD1TO.js";
|
|
2
|
+
import { a as createTransformElement } from "./globalSheet-CdgVpvCb.js";
|
|
3
3
|
//#region runtime/rsc/jsx.ts
|
|
4
4
|
const transformElement = createTransformElement(getClassName);
|
|
5
5
|
//#endregion
|
|
@@ -39,4 +39,4 @@ function createJsx(fn, transformElement) {
|
|
|
39
39
|
//#endregion
|
|
40
40
|
export { transformElement as a, wrapFragment as i, createJsxDEV as n, wrapCreateElement as r, createJsx as t };
|
|
41
41
|
|
|
42
|
-
//# sourceMappingURL=utils-
|
|
42
|
+
//# sourceMappingURL=utils-CB70kIh6.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-
|
|
1
|
+
{"version":3,"file":"utils-CB70kIh6.js","names":[],"sources":["../runtime/rsc/jsx.ts","../jsx/utils.ts"],"sourcesContent":["import { createTransformElement } from '../core/createTransformElement';\nimport { getClassName } from './getClassName';\n\nexport const transformElement = createTransformElement(getClassName);\n","import type { createElement, ElementType, Fragment } from 'react';\nimport type { jsxDEV } from 'react/jsx-dev-runtime';\nimport type { jsx, jsxs } from 'react/jsx-runtime';\n\nexport type FnJsxDEV = typeof jsxDEV;\nexport type FnJsx = typeof jsx;\nexport type FnJsxs = typeof jsxs;\nexport type FnCreateElement = typeof createElement;\n\nexport type TransformElementArgs = {\n type: ElementType;\n props: unknown;\n source?: unknown;\n};\n\nexport type TransformElement = {\n (args: TransformElementArgs): TransformElementArgs;\n};\n\nexport function wrapCreateElement(\n createElement: FnCreateElement,\n transformElement: TransformElement,\n): FnCreateElement {\n const fn = (type: ElementType, props: unknown, ...children: []) => {\n const result = transformElement({ type, props });\n\n return createElement(result.type, result.props, ...children);\n };\n\n return fn as FnCreateElement;\n}\n\nexport function wrapFragment(\n fragment: typeof Fragment,\n) {\n return fragment;\n}\n\nexport function createJsxDEV(\n fn: FnJsxDEV,\n transformElement: TransformElement,\n): FnJsxDEV {\n return (type, props, key, isStatic, source, self) => {\n const result = transformElement({ type, props, source });\n\n return fn(result.type, result.props, key, isStatic, source, self);\n };\n}\n\nexport function createJsx(\n fn: FnJsx,\n transformElement: TransformElement,\n): FnJsx {\n return (type, props, key) => {\n const result = transformElement({ type, props });\n\n return fn(result.type, result.props, key);\n };\n}\n"],"mappings":";;;AAGA,MAAa,mBAAmB,uBAAuB,YAAY;;;ACgBnE,SAAgB,kBACd,eACA,kBACiB;CACjB,MAAM,MAAM,MAAmB,OAAgB,GAAG,aAAiB;EACjE,MAAM,SAAS,iBAAiB;GAAE;GAAM;EAAM,CAAC;EAE/C,OAAO,cAAc,OAAO,MAAM,OAAO,OAAO,GAAG,QAAQ;CAC7D;CAEA,OAAO;AACT;AAEA,SAAgB,aACd,UACA;CACA,OAAO;AACT;AAEA,SAAgB,aACd,IACA,kBACU;CACV,QAAQ,MAAM,OAAO,KAAK,UAAU,QAAQ,SAAS;EACnD,MAAM,SAAS,iBAAiB;GAAE;GAAM;GAAO;EAAO,CAAC;EAEvD,OAAO,GAAG,OAAO,MAAM,OAAO,OAAO,KAAK,UAAU,QAAQ,IAAI;CAClE;AACF;AAEA,SAAgB,UACd,IACA,kBACO;CACP,QAAQ,MAAM,OAAO,QAAQ;EAC3B,MAAM,SAAS,iBAAiB;GAAE;GAAM;EAAM,CAAC;EAE/C,OAAO,GAAG,OAAO,MAAM,OAAO,OAAO,GAAG;CAC1C;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as normalizePath } from "./compiler-
|
|
2
|
-
import { n as STYLE_IMPORTS, t as createWebpackRegistry } from "./registry-
|
|
1
|
+
import { s as normalizePath } from "./compiler-AOb_VaKQ.mjs";
|
|
2
|
+
import { n as STYLE_IMPORTS, t as createWebpackRegistry } from "./registry-BMijh1CM.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
//#region plugin/bundler/webpack/utils.ts
|
|
@@ -46,4 +46,4 @@ function prependEntryImport(entryImport, runtimeFilePath) {
|
|
|
46
46
|
//#endregion
|
|
47
47
|
export { prependWebpackRuntimeEntry as a, hasWebpackCssMarker as i, getStylePackageDistPath as n, replaceWebpackCssMarker as o, getTransformLoaderPath as r, webpackRegistry as s, createWebpackRuntimeModuleSource as t };
|
|
48
48
|
|
|
49
|
-
//# sourceMappingURL=utils-
|
|
49
|
+
//# sourceMappingURL=utils-EG9gh2g3.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-
|
|
1
|
+
{"version":3,"file":"utils-EG9gh2g3.mjs","names":[],"sources":["../plugin/bundler/webpack/utils.ts"],"sourcesContent":["import { createRequire } from 'node:module';\nimport path from 'node:path';\nimport type { EntryNormalized } from 'webpack';\nimport { normalizePath } from '../../../compiler/utils/path';\nimport { SIDECAR_URL_GLOBAL_SYMBOL } from '../../../config/utils';\nimport type { PluginCompiler } from '../../utils';\nimport { STYLE_IMPORTS } from '../../utils/imports';\nimport { createWebpackRegistry } from './shared/registry';\n\ntype WebpackStaticEntry = Exclude<EntryNormalized, () => Promise<unknown>>;\ntype WebpackEntryDescription = WebpackStaticEntry[string];\n\nexport type WebpackLoaderState = {\n transform: PluginCompiler['transform'];\n};\n\nexport const webpackRegistry = createWebpackRegistry('webpack.registry');\n\nexport function getTransformLoaderPath() {\n return createRequire(import.meta.url).resolve(STYLE_IMPORTS.Plugin + '/webpack/loader');\n}\n\nexport function getStylePackageDistPath() {\n return path.resolve(path.dirname(getTransformLoaderPath()), '../..');\n}\n\nexport function createWebpackRuntimeModuleSource(\n extract: boolean,\n cssFilePath: string | null,\n options: {\n runtimeImportPath?: string | null;\n sidecarUrl?: string | null;\n } = {},\n) {\n return [\n extract && cssFilePath && `import ${JSON.stringify(normalizePath(cssFilePath))};`,\n options.sidecarUrl && options.runtimeImportPath && `import ${JSON.stringify(options.runtimeImportPath)};`,\n options.sidecarUrl &&\n `globalThis[Symbol.for(${JSON.stringify(SIDECAR_URL_GLOBAL_SYMBOL)})] = ${JSON.stringify(options.sidecarUrl)};`,\n '',\n ].filter(Boolean).join('\\n');\n}\n\nexport function replaceWebpackCssMarker(\n source: string,\n marker: string,\n css: string,\n) {\n return source.replace(marker, css);\n}\n\nexport function hasWebpackCssMarker(source: string, marker: string) {\n return source.includes(marker);\n}\n\nexport function prependWebpackRuntimeEntry(\n entry: EntryNormalized,\n runtimeFilePath: string,\n): EntryNormalized {\n if (typeof entry === 'function') {\n return async () => prependWebpackRuntimeStaticEntry(await entry(), runtimeFilePath);\n }\n\n return prependWebpackRuntimeStaticEntry(entry, runtimeFilePath);\n}\n\nfunction prependWebpackRuntimeStaticEntry(\n entry: WebpackStaticEntry,\n runtimeFilePath: string,\n): WebpackStaticEntry {\n const result: WebpackStaticEntry = {};\n\n for (const [key, value] of Object.entries(entry)) {\n result[key] = prependWebpackRuntimeEntryDescription(value, runtimeFilePath);\n }\n\n return result;\n}\n\nfunction prependWebpackRuntimeEntryDescription(\n entry: WebpackEntryDescription,\n runtimeFilePath: string,\n): WebpackEntryDescription {\n if (!entry.import) return entry;\n\n return {\n ...entry,\n import: prependEntryImport(entry.import, runtimeFilePath),\n };\n}\n\nfunction prependEntryImport(entryImport: string[], runtimeFilePath: string) {\n return entryImport.includes(runtimeFilePath)\n ? entryImport\n : [runtimeFilePath, ...entryImport];\n}\n"],"mappings":";;;;;AAgBA,MAAa,kBAAkB,sBAAsB,kBAAkB;AAEvE,SAAgB,yBAAyB;CACvC,OAAO,cAAc,OAAO,KAAK,GAAG,EAAE,QAAQ,cAAc,SAAS,iBAAiB;AACxF;AAEA,SAAgB,0BAA0B;CACxC,O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