weapp-tailwindcss 5.5.5 → 5.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{auto-DtU6f3X6.cjs → auto-B1OyRrE8.cjs} +1 -1
- package/dist/{auto-2dg_uhEJ.js → auto-ENr4xzzw.js} +1 -1
- package/dist/bundlers/gulp/shared/create-native-framework-plugins/file-transforms.d.ts +5 -4
- package/dist/bundlers/shared/css-cleanup/at-rules.d.ts +1 -1
- package/dist/bundlers/shared/css-cleanup.d.ts +1 -1
- package/dist/bundlers/shared/css-source-trace.d.ts +2 -5
- package/dist/bundlers/shared/final-css-cleanup.d.ts +1 -2
- package/dist/bundlers/shared/framework-css-composition.d.ts +1 -0
- package/dist/bundlers/shared/framework-postcss.d.ts +1 -24
- package/dist/bundlers/shared/framework-user-css.d.ts +1 -3
- package/dist/bundlers/shared/generated-css-marker.d.ts +1 -9
- package/dist/bundlers/shared/generator-css/candidates.d.ts +1 -2
- package/dist/bundlers/shared/generator-css/class-selectors.d.ts +1 -3
- package/dist/bundlers/shared/generator-css/config-directive.d.ts +1 -2
- package/dist/bundlers/shared/generator-css/directives/fallback.d.ts +1 -11
- package/dist/bundlers/shared/generator-css/directives.d.ts +1 -25
- package/dist/bundlers/shared/generator-css/generation-helpers/preflight.d.ts +1 -19
- package/dist/bundlers/shared/generator-css/generation-helpers/results.d.ts +1 -25
- package/dist/bundlers/shared/generator-css/generation-helpers/runtime-isolation.d.ts +1 -30
- package/dist/bundlers/shared/generator-css/generation-helpers/source-order.d.ts +1 -2
- package/dist/bundlers/shared/generator-css/generation-helpers.d.ts +1 -4
- package/dist/bundlers/shared/generator-css/legacy-compat.d.ts +1 -9
- package/dist/bundlers/shared/generator-css/legacy-selectors.d.ts +1 -5
- package/dist/bundlers/shared/generator-css/legacy-units.d.ts +1 -1
- package/dist/bundlers/shared/generator-css/local-imports.d.ts +1 -1
- package/dist/bundlers/shared/generator-css/markers.d.ts +1 -28
- package/dist/bundlers/shared/generator-css/output-import-shell.d.ts +1 -8
- package/dist/bundlers/shared/generator-css/pipeline/context.d.ts +1 -58
- package/dist/bundlers/shared/generator-css/pipeline/deferred-output.d.ts +1 -3
- package/dist/bundlers/shared/generator-css/pipeline/execution.d.ts +1 -3
- package/dist/bundlers/shared/generator-css/pipeline/fallback-output.d.ts +1 -3
- package/dist/bundlers/shared/generator-css/pipeline/ordered-output.d.ts +1 -3
- package/dist/bundlers/shared/generator-css/pipeline.d.ts +1 -2
- package/dist/bundlers/shared/generator-css/result-helpers.d.ts +1 -6
- package/dist/bundlers/shared/generator-css/scoped-rules.d.ts +1 -1
- package/dist/bundlers/shared/generator-css/source-files.d.ts +1 -21
- package/dist/bundlers/shared/generator-css/source-resolver/apply-reference.d.ts +1 -13
- package/dist/bundlers/shared/generator-css/source-resolver/config.d.ts +1 -7
- package/dist/bundlers/shared/generator-css/source-resolver/configuration.d.ts +1 -33
- package/dist/bundlers/shared/generator-css/source-resolver/matching.d.ts +1 -3
- package/dist/bundlers/shared/generator-css/source-resolver/metadata.d.ts +1 -28
- package/dist/bundlers/shared/generator-css/source-resolver/postcss-source.d.ts +1 -14
- package/dist/bundlers/shared/generator-css/source-resolver/resolve-source.d.ts +1 -4
- package/dist/bundlers/shared/generator-css/source-resolver/resolve-sources.d.ts +1 -5
- package/dist/bundlers/shared/generator-css/source-resolver/single-source.d.ts +1 -16
- package/dist/bundlers/shared/generator-css/source-resolver/source-entries.d.ts +1 -3
- package/dist/bundlers/shared/generator-css/source-resolver/source-matching.d.ts +1 -5
- package/dist/bundlers/shared/generator-css/source-resolver/types.d.ts +1 -22
- package/dist/bundlers/shared/generator-css/source-resolver.d.ts +1 -7
- package/dist/bundlers/shared/generator-css/types.d.ts +1 -61
- package/dist/bundlers/shared/generator-css/user-css/apply-only.d.ts +1 -9
- package/dist/bundlers/shared/generator-css/user-css/at-rules.d.ts +1 -3
- package/dist/bundlers/shared/generator-css/user-css/compile-functions.d.ts +1 -0
- package/dist/bundlers/shared/generator-css/user-css/generated-cleanup.d.ts +1 -4
- package/dist/bundlers/shared/generator-css/user-css/source-fragments.d.ts +1 -15
- package/dist/bundlers/shared/generator-css/user-css/transform.d.ts +1 -10
- package/dist/bundlers/shared/generator-css/user-css/user-layers.d.ts +1 -15
- package/dist/bundlers/shared/generator-css/user-css.d.ts +1 -5
- package/dist/bundlers/shared/generator-css/user-layer-order.d.ts +1 -10
- package/dist/bundlers/shared/generator-css/validate.d.ts +1 -7
- package/dist/bundlers/shared/generator-css.d.ts +1 -9
- package/dist/bundlers/shared/run-tasks.d.ts +1 -3
- package/dist/bundlers/shared/runtime-class-set.d.ts +1 -1
- package/dist/bundlers/shared/source-candidates/collector.d.ts +1 -8
- package/dist/bundlers/shared/source-candidates/scan-root.d.ts +1 -12
- package/dist/bundlers/shared/source-candidates/script.d.ts +1 -1
- package/dist/bundlers/shared/source-candidates/snapshot.d.ts +1 -19
- package/dist/bundlers/shared/source-candidates/source-priority.d.ts +1 -1
- package/dist/bundlers/shared/source-candidates/store.d.ts +1 -2
- package/dist/bundlers/shared/source-candidates/types-and-cache.d.ts +1 -75
- package/dist/bundlers/shared/source-candidates/views.d.ts +1 -12
- package/dist/bundlers/shared/source-candidates.d.ts +1 -4
- package/dist/bundlers/shared/source-scan/css-entries.d.ts +1 -18
- package/dist/bundlers/shared/source-scan/dependencies.d.ts +1 -2
- package/dist/bundlers/shared/source-scan.d.ts +1 -16
- package/dist/bundlers/shared/static-config-content.d.ts +1 -5
- package/dist/bundlers/shared/style-handler-options.d.ts +1 -0
- package/dist/bundlers/shared/style-requests.d.ts +1 -5
- package/dist/bundlers/shared/v4-generation-core.d.ts +1 -21
- package/dist/bundlers/vite/css-finalizer/css-calc.d.ts +3 -0
- package/dist/bundlers/vite/css-finalizer/final-assets.d.ts +3 -0
- package/dist/bundlers/vite/css-handler-options.d.ts +1 -1
- package/dist/bundlers/vite/frameworks/generic/web.d.ts +2 -1
- package/dist/bundlers/vite/generate-bundle/configured-css-sources.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/css-transform-decision-plan.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/css-transform-task.d.ts +2 -2
- package/dist/bundlers/vite/generate-bundle/finalize/sync-processed-css.d.ts +4 -0
- package/dist/bundlers/vite/generate-bundle/framework-style-memory.d.ts +4 -0
- package/dist/bundlers/vite/generate-bundle/js-handler-options.d.ts +7 -0
- package/dist/bundlers/vite/generate-bundle/remembered-css.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/rollup-assets.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/runtime.d.ts +3 -1
- package/dist/bundlers/vite/generate-bundle/sfc-style-source.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/temporary-css-assets.d.ts +2 -2
- package/dist/bundlers/vite/generate-bundle/types.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/web-css-module.d.ts +1 -0
- package/dist/bundlers/vite/plugin-hook.d.ts +3 -0
- package/dist/bundlers/vite/processed-css-assets/cleanup.d.ts +1 -1
- package/dist/bundlers/vite/processed-css-assets/coverage.d.ts +1 -10
- package/dist/bundlers/vite/processed-css-assets/injection-plan.d.ts +1 -4
- package/dist/bundlers/vite/processed-css-assets/markers-imports.d.ts +4 -7
- package/dist/bundlers/vite/processed-css-assets/scoped-tailwind-noise.d.ts +1 -13
- package/dist/bundlers/vite/shared/create-framework-plugins-runtime.d.ts +3 -1
- package/dist/bundlers/vite/shared/framework-module-candidates.d.ts +3 -2
- package/dist/bundlers/vite/shared/framework-runtime-configuration.d.ts +3 -0
- package/dist/bundlers/vite/shared/framework-runtime-options.d.ts +9 -0
- package/dist/bundlers/vite/shared/framework-runtime-utils.d.ts +6 -5
- package/dist/bundlers/vite/shared/framework-source-scan-session.d.ts +3 -3
- package/dist/bundlers/vite/shared/framework-strategy.d.ts +3 -1
- package/dist/bundlers/vite/shared/hmr-source.d.ts +2 -0
- package/dist/bundlers/vite/source-candidates/scan-root.d.ts +1 -1
- package/dist/bundlers/vite/source-candidates.d.ts +1 -1
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/finalize.d.ts +1 -1
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/generated-css.d.ts +2 -7
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/preflight-runtime.d.ts +4 -8
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/sources.d.ts +3 -3
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/user-css-markers.d.ts +1 -1
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/user-css.d.ts +2 -7
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/processed-css-task.d.ts +2 -1
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/source-candidate-cache.d.ts +1 -1
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +1 -1
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +1 -1
- package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +1 -1
- package/dist/bundlers/webpack/loaders/watch-dependencies.d.ts +6 -0
- package/dist/bundlers/webpack/shared/create-framework-plugin/plugin.d.ts +1 -1
- package/dist/cache/index.d.ts +4 -4
- package/dist/cache/source.d.ts +29 -0
- package/dist/{cache-CBJFB1HN.cjs → cache-CzvIGfwS.cjs} +1 -0
- package/dist/compiler/composition.d.ts +1 -1
- package/dist/compiler/index.d.ts +2 -0
- package/dist/compiler/runtime-affecting-signature/js.d.ts +1 -0
- package/dist/compiler/semantic-css.d.ts +1 -1
- package/dist/compiler/types.d.ts +1 -1
- package/dist/{compiler-D_vxtEdw.js → compiler-CThodfGH.js} +3105 -3065
- package/dist/{compiler-Cc0JXfbw.cjs → compiler-DkGY5Nmh.cjs} +22414 -45557
- package/dist/core/compiler/generation-cache.d.ts +4 -2
- package/dist/core/compiler/transforms.d.ts +1 -1
- package/dist/core/compiler/types.d.ts +1 -1
- package/dist/core.cjs +10 -10
- package/dist/core.d.ts +2 -2
- package/dist/core.js +5 -5
- package/dist/css-cleanup-B6FUJC3z.cjs +1 -0
- package/dist/{css-imports-FRZwX4P6.cjs → css-imports-R_RDMjPz.cjs} +7 -22
- package/dist/css-macro/auto.d.ts +1 -1
- package/dist/css-macro/postcss.cjs +1 -1
- package/dist/css-macro.cjs +3 -3
- package/dist/css-macro.js +2 -2
- package/dist/{defaults-CKx-4LcW.js → defaults-AQuvJS-h.js} +4 -2
- package/dist/{defaults-CiGsr8Xq.cjs → defaults-CyX5iO9y.cjs} +4 -2
- package/dist/defaults.cjs +1 -1
- package/dist/defaults.js +1 -1
- package/dist/final-css-cleanup-B6FUJC3z.cjs +1 -0
- package/dist/{final-css-cleanup-B0HUBtiE.js → final-css-cleanup-BOzhuhGz.js} +3 -127
- package/dist/framework/index.d.ts +1 -1
- package/dist/framework/platform.d.ts +2 -2
- package/dist/framework.cjs +1 -1
- package/dist/{v4-generation-core-DJBWZ_D0.cjs → generated-css-marker-jMNbQHpy.cjs} +717 -1730
- package/dist/generation/candidates.d.ts +1 -0
- package/dist/generation/class-selectors.d.ts +4 -0
- package/dist/generation/config-directive.d.ts +1 -0
- package/dist/generation/directives/fallback.d.ts +1 -0
- package/dist/generation/directives.d.ts +1 -0
- package/dist/generation/framework-css-composition.d.ts +1 -0
- package/dist/generation/framework-postcss.d.ts +25 -0
- package/dist/generation/framework-user-css.d.ts +5 -0
- package/dist/generation/generation-helpers/preflight.d.ts +19 -0
- package/dist/generation/generation-helpers/results.d.ts +23 -0
- package/dist/generation/generation-helpers/runtime-isolation.d.ts +30 -0
- package/dist/generation/generation-helpers/source-order.d.ts +1 -0
- package/dist/generation/generation-helpers.d.ts +4 -0
- package/dist/generation/index.d.ts +9 -0
- package/dist/generation/legacy-compat.d.ts +12 -0
- package/dist/generation/legacy-selectors.d.ts +1 -0
- package/dist/generation/legacy-units.d.ts +1 -0
- package/dist/generation/local-imports.d.ts +1 -0
- package/dist/generation/markers.d.ts +1 -0
- package/dist/generation/output-import-shell.d.ts +1 -0
- package/dist/generation/pipeline/context.d.ts +60 -0
- package/dist/generation/pipeline/deferred-output.d.ts +3 -0
- package/dist/generation/pipeline/execution.d.ts +3 -0
- package/dist/generation/pipeline/fallback-output.d.ts +3 -0
- package/dist/generation/pipeline/ordered-output.d.ts +3 -0
- package/dist/generation/pipeline/preparation.d.ts +19 -0
- package/dist/generation/pipeline.d.ts +2 -0
- package/dist/generation/result-helpers.d.ts +6 -0
- package/dist/generation/scoped-rules.d.ts +1 -0
- package/dist/generation/service.d.ts +20 -0
- package/dist/generation/source-files.d.ts +21 -0
- package/dist/generation/source-resolver/apply-reference.d.ts +10 -0
- package/dist/generation/source-resolver/config.d.ts +7 -0
- package/dist/generation/source-resolver/configuration.d.ts +33 -0
- package/dist/generation/source-resolver/matching.d.ts +3 -0
- package/dist/generation/source-resolver/metadata.d.ts +28 -0
- package/dist/generation/source-resolver/postcss-source.d.ts +14 -0
- package/dist/generation/source-resolver/resolve-source.d.ts +4 -0
- package/dist/generation/source-resolver/resolve-sources.d.ts +5 -0
- package/dist/generation/source-resolver/single-source.d.ts +16 -0
- package/dist/generation/source-resolver/source-entries.d.ts +3 -0
- package/dist/generation/source-resolver/source-matching.d.ts +5 -0
- package/dist/generation/source-resolver/types.d.ts +22 -0
- package/dist/generation/source-resolver.d.ts +7 -0
- package/dist/generation/style-options.d.ts +8 -0
- package/dist/generation/style-requests.d.ts +5 -0
- package/dist/generation/types.d.ts +65 -0
- package/dist/generation/user-css/apply-only.d.ts +5 -0
- package/dist/generation/user-css/at-rules.d.ts +1 -0
- package/dist/generation/user-css/compile-functions.d.ts +3 -0
- package/dist/generation/user-css/generated-cleanup.d.ts +1 -0
- package/dist/generation/user-css/source-fragments.d.ts +1 -0
- package/dist/generation/user-css/transform.d.ts +1 -0
- package/dist/generation/user-css/user-layers.d.ts +1 -0
- package/dist/generation/user-css.d.ts +5 -0
- package/dist/generation/user-layer-order.d.ts +1 -0
- package/dist/generation/validate.d.ts +7 -0
- package/dist/generator-CxauQbx3.cjs +1868 -0
- package/dist/generator-oKZ5mCJ5.js +1637 -0
- package/dist/generator.cjs +10 -4
- package/dist/generator.js +1 -1
- package/dist/{gulp-Dnt8VL8D.cjs → gulp-CVvBpIlq.cjs} +27 -26
- package/dist/{gulp-B1mPTMqw.js → gulp-DhddVxGA.js} +6 -5
- package/dist/gulp.cjs +1 -1
- package/dist/gulp.js +1 -1
- package/dist/{hmr-timing-qpX410qU.cjs → hmr-timing-DfMbbZ1E.cjs} +13 -13
- package/dist/{hmr-timing-wAt0LavM.js → hmr-timing-xPpat-km.js} +601 -1548
- package/dist/index.cjs +7 -7
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -5
- package/dist/js/ModuleGraph.d.ts +3 -1
- package/dist/js/NodePathWalker.d.ts +1 -1
- package/dist/js/babel/analyze.d.ts +6 -0
- package/dist/js/babel.d.ts +1 -2
- package/dist/js/fast-path/analysis.d.ts +14 -0
- package/dist/js/fast-path/oxc.d.ts +1 -1
- package/dist/js/node-path-walker/export-handlers.d.ts +1 -1
- package/dist/js/node-path-walker/import-tokens.d.ts +1 -1
- package/dist/js/oxc-parser.d.ts +4 -0
- package/dist/pipeline-helpers-zMPmp5F3.cjs +516 -0
- package/dist/postcss-html-transform.cjs +1 -1
- package/dist/postcss.cjs +3 -2
- package/dist/postcss.d.ts +1 -1
- package/dist/postcss.js +3 -2
- package/dist/presets.cjs +3 -3
- package/dist/presets.js +2 -2
- package/dist/project-sources/candidates/collector.d.ts +8 -0
- package/dist/project-sources/candidates/scan-root.d.ts +12 -0
- package/dist/project-sources/candidates/script.d.ts +1 -0
- package/dist/project-sources/candidates/snapshot.d.ts +19 -0
- package/dist/project-sources/candidates/source-priority.d.ts +1 -0
- package/dist/project-sources/candidates/store.d.ts +2 -0
- package/dist/project-sources/candidates/types-and-cache.d.ts +75 -0
- package/dist/project-sources/candidates/views.d.ts +12 -0
- package/dist/project-sources/candidates.d.ts +4 -0
- package/dist/project-sources/css-entries.d.ts +18 -0
- package/dist/project-sources/dependencies.d.ts +2 -0
- package/dist/project-sources/index.d.ts +16 -0
- package/dist/project-sources/static-config-content.d.ts +5 -0
- package/dist/reset.cjs +1 -1
- package/dist/{rolldown-runtime-Ctb5zv51.cjs → rolldown-runtime-fg3euq-1.cjs} +7 -0
- package/dist/rspack.cjs +4 -4
- package/dist/rspack.js +2 -2
- package/dist/{runtime-state-XYSycuGu.cjs → runtime-state-BOzuVoKl.cjs} +1 -1
- package/dist/{scoped-generator-CtetE5rm.cjs → scoped-generator-BIZ7N_J-.cjs} +51 -36
- package/dist/{scoped-generator-BqxVxNp9.js → scoped-generator-DlQrVbuC.js} +49 -33
- package/dist/{source-candidate-scan-signature-Lm32zKVA.js → source-candidate-scan-signature-BjVQYL-C.js} +22 -5
- package/dist/{source-candidate-scan-signature-BDGB9nKZ.cjs → source-candidate-scan-signature-nG-rg809.cjs} +34 -5
- package/dist/style-injector/internal.d.ts +118 -8
- package/dist/style-injector/options.d.ts +6 -2
- package/dist/tailwindcss/miniprogram.d.ts +1 -1
- package/dist/tailwindcss/remove-unsupported-css.d.ts +1 -1
- package/dist/tailwindcss/runtime-options.d.ts +5 -0
- package/dist/tailwindcss/source-scan/inline-source.d.ts +1 -7
- package/dist/tailwindcss/source-scan.d.ts +3 -32
- package/dist/tailwindcss/v4/css-sources.d.ts +1 -1
- package/dist/tailwindcss/v4/preflight.d.ts +1 -4
- package/dist/tailwindcss/v4/rpx-theme-warning.d.ts +4 -0
- package/dist/tailwindcss/v4-engine/design-system.d.ts +1 -1
- package/dist/tailwindcss/v4-engine/generator/incremental-cache.d.ts +2 -3
- package/dist/tailwindcss/v4-engine/generator/native-session.d.ts +1 -1
- package/dist/tailwindcss/v4-engine/generator/rpx-candidates.d.ts +1 -6
- package/dist/tailwindcss/v4-engine/generator/scan-sources.d.ts +5 -2
- package/dist/tailwindcss/v4-engine/generator/style-context.d.ts +1 -3
- package/dist/tailwindcss/v4-engine/miniprogram.d.ts +3 -7
- package/dist/tailwindcss/v4-engine/source.d.ts +1 -1
- package/dist/tailwindcss/v4-engine/types.d.ts +3 -1
- package/dist/{tailwindcss-9e6ZuYgS.cjs → tailwindcss-U3KIUegn.cjs} +66 -271
- package/dist/{tailwindcss-DTV9MoJT.js → tailwindcss-kSd0ykiX.js} +73 -251
- package/dist/{transform-BbbZvFQq.js → transform-BAon9ykq.js} +35 -20
- package/dist/{transform-D21f8Dm8.cjs → transform-D2KFdA3C.cjs} +41 -26
- package/dist/types/index.d.ts +4 -3
- package/dist/types/user-defined-options/general.d.ts +1 -1
- package/dist/uni-app-x/border-preflight.d.ts +1 -2
- package/dist/uni-app-x/component-local-style.d.ts +4 -1
- package/dist/uni-app-x/transform.d.ts +4 -2
- package/dist/uni-app-x/vite/author-apply.d.ts +3 -1
- package/dist/uni-app-x/vite/native-hmr.d.ts +1 -1
- package/dist/uni-app-x/vite/style-result.d.ts +5 -0
- package/dist/utils/run-tasks.d.ts +3 -0
- package/dist/vite/web.cjs +1 -1
- package/dist/vite/web.js +1 -1
- package/dist/{vite-CaH7WjX6.cjs → vite-BxW0qd7J.cjs} +677 -1315
- package/dist/{vite-CuYntLZP.js → vite-D-RGkmOE.js} +541 -1173
- package/dist/vite-web.d.ts +1 -1
- package/dist/vite.cjs +1 -1
- package/dist/vite.js +1 -1
- package/dist/{watch-dependencies-GbC14Rlt.cjs → watch-dependencies-C1so1whD.cjs} +14 -1
- package/dist/weapp-tw-css-generation-loader.cjs +4 -3
- package/dist/weapp-tw-css-import-rewrite-loader.cjs +34 -29
- package/dist/weapp-tw-runtime-classset-loader.cjs +5 -18
- package/dist/{web-CdXkY_VO.js → web--kA4HUTm.js} +149 -211
- package/dist/{web-CYs2Kcaa.cjs → web-Y-H6I1k6.cjs} +226 -286
- package/dist/{webpack-BnCSOUuu.js → webpack-BB-kw4Qr.js} +38 -450
- package/dist/{webpack-BQNnpQPC.cjs → webpack-DxrWatNB.cjs} +97 -97
- package/dist/webpack.cjs +1 -1
- package/dist/webpack.js +1 -1
- package/dist/wxml/utils/codegen/legacy-visitor.d.ts +2 -2
- package/dist/wxml/utils/custom-template.d.ts +1 -1
- package/package.json +16 -13
- package/dist/final-css-cleanup-DSjczga3.cjs +0 -138
- package/dist/generator-BdSIvFEO.cjs +0 -3905
- package/dist/generator-CAOx1Sqm.js +0 -3357
- package/dist/pipeline-helpers-BHagysZY.cjs +0 -971
- package/dist/tailwindcss/v4-engine/css-import.d.ts +0 -14
- package/dist/uni-app-x/style-asset/source-parser.d.ts +0 -2
|
@@ -1,108 +1,207 @@
|
|
|
1
|
-
const require_rolldown_runtime = require("./rolldown-runtime-
|
|
2
|
-
const require_generator = require("./generator-
|
|
3
|
-
require("./auto-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-fg3euq-1.cjs");
|
|
2
|
+
const require_generator = require("./generator-CxauQbx3.cjs");
|
|
3
|
+
require("./auto-B1OyRrE8.cjs");
|
|
4
|
+
const require_compiler = require("./compiler-DkGY5Nmh.cjs");
|
|
5
|
+
const require_tailwindcss = require("./tailwindcss-U3KIUegn.cjs");
|
|
6
6
|
let node_fs = require("node:fs");
|
|
7
7
|
let node_path = require("node:path");
|
|
8
8
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
9
9
|
let node_process = require("node:process");
|
|
10
10
|
node_process = require_rolldown_runtime.__toESM(node_process, 1);
|
|
11
|
-
let
|
|
12
|
-
let
|
|
11
|
+
let _weapp_tailwindcss_engine = require("@weapp-tailwindcss/engine");
|
|
12
|
+
let _weapp_tailwindcss_postcss_transform = require("@weapp-tailwindcss/postcss/transform");
|
|
13
13
|
let lru_cache = require("lru-cache");
|
|
14
|
+
let _weapp_tailwindcss_source_scan = require("@weapp-tailwindcss/source-scan");
|
|
14
15
|
let node_fs_promises = require("node:fs/promises");
|
|
16
|
+
let _weapp_tailwindcss_logger = require("@weapp-tailwindcss/logger");
|
|
15
17
|
let _weapp_core_escape = require("@weapp-core/escape");
|
|
16
18
|
let _weapp_tailwindcss_shared_node = require("@weapp-tailwindcss/shared/node");
|
|
17
|
-
//#region src/
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
19
|
+
//#region src/compiler/mode.ts
|
|
20
|
+
const COMPILER_MODE_ENV = "WEAPP_TAILWINDCSS_COMPILER";
|
|
21
|
+
function resolveCompilerMode(env = node_process.default.env) {
|
|
22
|
+
const value = env[COMPILER_MODE_ENV];
|
|
23
|
+
return value === "legacy" || value === "shadow" || value === "graph" ? value : "graph";
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/compiler/semantic-css.ts
|
|
27
|
+
const defaultMaxDifferences = 50;
|
|
28
|
+
function isSemanticCssNode(node) {
|
|
29
|
+
return node !== void 0;
|
|
30
|
+
}
|
|
31
|
+
function normalizeNode(node) {
|
|
32
|
+
switch (node.type) {
|
|
33
|
+
case "comment": return;
|
|
34
|
+
case "decl": return {
|
|
35
|
+
type: "declaration",
|
|
36
|
+
property: node.prop,
|
|
37
|
+
value: node.value,
|
|
38
|
+
important: Boolean(node.important)
|
|
39
|
+
};
|
|
40
|
+
case "rule": return {
|
|
41
|
+
type: "rule",
|
|
42
|
+
selector: node.selector,
|
|
43
|
+
nodes: node.nodes.map(normalizeNode).filter(isSemanticCssNode)
|
|
44
|
+
};
|
|
45
|
+
case "atrule": return {
|
|
46
|
+
type: "at-rule",
|
|
47
|
+
name: node.name,
|
|
48
|
+
params: node.params,
|
|
49
|
+
nodes: node.nodes?.map(normalizeNode).filter(isSemanticCssNode) ?? []
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function createArtifactSemanticSummary(snapshot) {
|
|
54
|
+
return {
|
|
55
|
+
present: snapshot.present,
|
|
56
|
+
fragments: snapshot.fragments.length,
|
|
57
|
+
classes: snapshot.classSet.length,
|
|
58
|
+
rawCandidates: snapshot.rawCandidates.length,
|
|
59
|
+
dependencies: snapshot.dependencies.length,
|
|
60
|
+
sourceEntries: snapshot.sourceEntries.length
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function isRecord(value) {
|
|
64
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
65
|
+
}
|
|
66
|
+
function appendObjectPath(path, key) {
|
|
67
|
+
return /^[A-Z_$][\w$]*$/i.test(key) ? `${path}.${key}` : `${path}[${JSON.stringify(key)}]`;
|
|
68
|
+
}
|
|
69
|
+
function compareSemanticValues(left, right, path, state) {
|
|
70
|
+
if (state.truncated || Object.is(left, right)) return;
|
|
71
|
+
if (left === void 0 || right === void 0) {
|
|
72
|
+
const value = left === void 0 ? right : left;
|
|
73
|
+
if (Array.isArray(value) && value.length > 0) {
|
|
74
|
+
for (let index = 0; index < value.length; index++) {
|
|
75
|
+
compareSemanticValues(left === void 0 ? void 0 : value[index], right === void 0 ? void 0 : value[index], `${path}[${index}]`, state);
|
|
76
|
+
if (state.truncated) return;
|
|
77
|
+
}
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (isRecord(value) && Object.keys(value).length > 0) {
|
|
81
|
+
for (const key of Object.keys(value)) {
|
|
82
|
+
compareSemanticValues(left === void 0 ? void 0 : value[key], right === void 0 ? void 0 : value[key], appendObjectPath(path, key), state);
|
|
83
|
+
if (state.truncated) return;
|
|
84
|
+
}
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
} else if (Array.isArray(left) && Array.isArray(right)) {
|
|
88
|
+
const length = Math.max(left.length, right.length);
|
|
89
|
+
for (let index = 0; index < length; index++) {
|
|
90
|
+
compareSemanticValues(left[index], right[index], `${path}[${index}]`, state);
|
|
91
|
+
if (state.truncated) return;
|
|
92
|
+
}
|
|
93
|
+
return;
|
|
94
|
+
} else if (isRecord(left) && isRecord(right)) {
|
|
95
|
+
const keys = /* @__PURE__ */ new Set([...Object.keys(left), ...Object.keys(right)]);
|
|
96
|
+
for (const key of keys) {
|
|
97
|
+
compareSemanticValues(left[key], right[key], appendObjectPath(path, key), state);
|
|
98
|
+
if (state.truncated) return;
|
|
99
|
+
}
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
state.equal = false;
|
|
103
|
+
if (state.differences.length >= state.maxDifferences) {
|
|
104
|
+
state.truncated = true;
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
state.differences.push({
|
|
108
|
+
kind: left === void 0 ? "added" : right === void 0 ? "removed" : "changed",
|
|
109
|
+
path,
|
|
110
|
+
...left === void 0 ? {} : { left },
|
|
111
|
+
...right === void 0 ? {} : { right }
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
function normalizeCssRoot(root) {
|
|
115
|
+
return root.nodes.map(normalizeNode).filter(isSemanticCssNode);
|
|
116
|
+
}
|
|
117
|
+
function createArtifactSemanticSnapshot(artifact) {
|
|
118
|
+
if (artifact === void 0) return {
|
|
119
|
+
present: false,
|
|
120
|
+
fragments: [],
|
|
121
|
+
classSet: [],
|
|
122
|
+
rawCandidates: [],
|
|
123
|
+
dependencies: [],
|
|
124
|
+
sourceEntries: []
|
|
125
|
+
};
|
|
126
|
+
return {
|
|
127
|
+
present: true,
|
|
128
|
+
fragments: [...artifact.fragments].sort((left, right) => left.order - right.order || left.id.localeCompare(right.id)).map((fragment) => ({
|
|
129
|
+
id: fragment.id,
|
|
130
|
+
kind: fragment.kind,
|
|
131
|
+
order: fragment.order,
|
|
132
|
+
scope: { ...fragment.scope },
|
|
133
|
+
sourceId: fragment.sourceId,
|
|
134
|
+
stage: fragment.stage,
|
|
135
|
+
root: normalizeCssRoot(fragment.root)
|
|
136
|
+
})),
|
|
137
|
+
classSet: [...artifact.classSet].sort(),
|
|
138
|
+
rawCandidates: [...artifact.rawCandidates].sort(),
|
|
139
|
+
dependencies: [...artifact.dependencies].sort(),
|
|
140
|
+
sourceEntries: [...artifact.sourceEntries].sort()
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function compareArtifactSemantics(left, right, options = {}) {
|
|
144
|
+
const leftSnapshot = createArtifactSemanticSnapshot(left);
|
|
145
|
+
const rightSnapshot = createArtifactSemanticSnapshot(right);
|
|
146
|
+
const state = {
|
|
147
|
+
differences: [],
|
|
148
|
+
equal: true,
|
|
149
|
+
maxDifferences: Math.max(0, Math.floor(options.maxDifferences ?? defaultMaxDifferences)),
|
|
150
|
+
truncated: false
|
|
151
|
+
};
|
|
152
|
+
compareSemanticValues(leftSnapshot, rightSnapshot, "$", state);
|
|
153
|
+
return {
|
|
154
|
+
equal: state.equal,
|
|
155
|
+
differences: state.differences,
|
|
156
|
+
truncated: state.truncated,
|
|
157
|
+
left: createArtifactSemanticSummary(leftSnapshot),
|
|
158
|
+
right: createArtifactSemanticSummary(rightSnapshot)
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region src/compiler/shadow-report.ts
|
|
163
|
+
function createCompilerShadowReport(file, legacy, graph, options = {}) {
|
|
164
|
+
const comparison = compareArtifactSemantics(legacy, graph, options);
|
|
165
|
+
return {
|
|
166
|
+
file,
|
|
167
|
+
scopeId: options.scopeId ?? file,
|
|
168
|
+
equal: comparison.equal,
|
|
169
|
+
differences: comparison.differences,
|
|
170
|
+
truncated: comparison.truncated,
|
|
171
|
+
legacy: comparison.left,
|
|
172
|
+
graph: comparison.right
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
//#endregion
|
|
176
|
+
//#region src/project-sources/candidates/scan-root.ts
|
|
61
177
|
function resolveOutDirIgnorePattern(root, outDir) {
|
|
62
178
|
if (!outDir) return;
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
179
|
+
const path = (0, _weapp_tailwindcss_source_scan.sourcePathApi)(root, outDir);
|
|
180
|
+
const relative = path.relative(root, path.resolve(root, outDir));
|
|
181
|
+
if (!relative || relative.startsWith("..") || path.isAbsolute(relative)) return;
|
|
182
|
+
return `${(0, require_tailwindcss.source_scan_exports.toPosixPath)(relative)}/**`;
|
|
66
183
|
}
|
|
67
184
|
function normalizeScanEntries(root, entries, outDirIgnore) {
|
|
68
|
-
|
|
69
|
-
|
|
185
|
+
if (!entries?.length && !outDirIgnore) return;
|
|
186
|
+
return (0, _weapp_tailwindcss_source_scan.createSourceScanPlan)({
|
|
70
187
|
base: root,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
negated: false
|
|
79
|
-
}], {
|
|
80
|
-
base: root,
|
|
81
|
-
pattern: outDirIgnore,
|
|
82
|
-
negated: true
|
|
83
|
-
}];
|
|
188
|
+
mode: "fallback",
|
|
189
|
+
entries: [...entries ?? [], ...outDirIgnore ? [{
|
|
190
|
+
base: root,
|
|
191
|
+
pattern: outDirIgnore,
|
|
192
|
+
negated: true
|
|
193
|
+
}] : []]
|
|
194
|
+
});
|
|
84
195
|
}
|
|
85
196
|
function shouldApplyDefaultIgnoredSources(entries) {
|
|
86
197
|
return entries?.length === void 0 ? false : entries.length > 0 && entries.every((entry) => entry.negated);
|
|
87
198
|
}
|
|
88
199
|
function createDefaultIgnoredSources(root, outDirIgnore, entries, explicit) {
|
|
89
|
-
return [...!explicit || shouldApplyDefaultIgnoredSources(entries) ?
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
})),
|
|
95
|
-
...TAILWIND_V4_IGNORED_EXTENSIONS.map((extension) => ({
|
|
96
|
-
base: root,
|
|
97
|
-
pattern: `**/*.${extension}`,
|
|
98
|
-
negated: true
|
|
99
|
-
})),
|
|
100
|
-
...TAILWIND_V4_IGNORED_FILES.map((pattern) => ({
|
|
101
|
-
base: root,
|
|
102
|
-
pattern: `**/${pattern}`,
|
|
103
|
-
negated: true
|
|
104
|
-
}))
|
|
105
|
-
] : [], ...outDirIgnore ? [{
|
|
200
|
+
return [...!explicit || shouldApplyDefaultIgnoredSources(entries) ? _weapp_tailwindcss_source_scan.CANDIDATE_SOURCE_IGNORED_PATTERNS.map((pattern) => ({
|
|
201
|
+
base: root,
|
|
202
|
+
pattern,
|
|
203
|
+
negated: true
|
|
204
|
+
})) : [], ...outDirIgnore ? [{
|
|
106
205
|
base: root,
|
|
107
206
|
pattern: outDirIgnore,
|
|
108
207
|
negated: true
|
|
@@ -110,33 +209,34 @@ function createDefaultIgnoredSources(root, outDirIgnore, entries, explicit) {
|
|
|
110
209
|
}
|
|
111
210
|
/** 创建与文件系统 root scan 一致的增量源码资格判断器。 */
|
|
112
211
|
function createSourceCandidateEligibilityMatcher(roots, eligibleFiles) {
|
|
113
|
-
const eligibleFileSet = eligibleFiles === void 0 ? void 0 : new Set([...eligibleFiles].map(
|
|
212
|
+
const eligibleFileSet = eligibleFiles === void 0 ? void 0 : new Set([...eligibleFiles].map(require_tailwindcss.source_scan_exports.resolveSourceScanPath));
|
|
114
213
|
const matchers = roots.map((options) => {
|
|
115
|
-
const root =
|
|
214
|
+
const root = (0, require_tailwindcss.source_scan_exports.resolveSourceScanPath)(options.root);
|
|
116
215
|
const outDirIgnore = resolveOutDirIgnorePattern(root, options.outDir);
|
|
117
216
|
const entries = options.entries;
|
|
118
217
|
const explicit = options.explicit === true;
|
|
119
218
|
const hasPositiveEntry = entries?.some((entry) => !entry.negated) === true;
|
|
120
219
|
const ignoredSources = createDefaultIgnoredSources(root, outDirIgnore, entries, explicit);
|
|
121
220
|
return (resolvedFile) => {
|
|
122
|
-
if (explicit) return hasPositiveEntry &&
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
221
|
+
if (explicit) return hasPositiveEntry && (0, require_tailwindcss.source_scan_exports.isFileMatchedByTailwindSourceEntries)(resolvedFile, entries);
|
|
222
|
+
const path = (0, _weapp_tailwindcss_source_scan.sourcePathApi)(root, resolvedFile);
|
|
223
|
+
const relative = path.relative(root, resolvedFile);
|
|
224
|
+
if (!relative || relative.startsWith("..") || path.isAbsolute(relative)) return false;
|
|
225
|
+
return (0, require_tailwindcss.source_scan_exports.isFileMatchedByTailwindSourceEntries)(resolvedFile, entries) && !(0, require_tailwindcss.source_scan_exports.isFileExcludedByTailwindSourceEntries)(resolvedFile, ignoredSources) && (eligibleFileSet?.has(resolvedFile) ?? true);
|
|
126
226
|
};
|
|
127
227
|
});
|
|
128
228
|
return (file) => {
|
|
129
|
-
const resolvedFile =
|
|
229
|
+
const resolvedFile = (0, require_tailwindcss.source_scan_exports.resolveSourceScanPath)(file);
|
|
130
230
|
return matchers.some((matches) => matches(resolvedFile));
|
|
131
231
|
};
|
|
132
232
|
}
|
|
133
233
|
function resolveSourceCandidateScanFiles(options) {
|
|
134
|
-
const resolvedRoot =
|
|
135
|
-
if (options.explicit && options.entries?.
|
|
234
|
+
const resolvedRoot = (0, require_tailwindcss.source_scan_exports.resolveSourceScanPath)(options.root);
|
|
235
|
+
if (options.explicit && !options.entries?.some((entry) => !entry.negated)) return Promise.resolve([]);
|
|
136
236
|
const outDirIgnore = resolveOutDirIgnorePattern(resolvedRoot, options.outDir);
|
|
137
237
|
const scanEntries = normalizeScanEntries(resolvedRoot, options.entries, outDirIgnore);
|
|
138
238
|
const ignoredSources = createDefaultIgnoredSources(resolvedRoot, outDirIgnore, options.entries, options.explicit);
|
|
139
|
-
return (0,
|
|
239
|
+
return (0, _weapp_tailwindcss_engine.resolveProjectSourceFiles)({
|
|
140
240
|
cwd: resolvedRoot,
|
|
141
241
|
...scanEntries === void 0 ? {} : { sources: scanEntries },
|
|
142
242
|
...ignoredSources.length > 0 ? { ignoredSources } : {},
|
|
@@ -144,7 +244,7 @@ function resolveSourceCandidateScanFiles(options) {
|
|
|
144
244
|
});
|
|
145
245
|
}
|
|
146
246
|
//#endregion
|
|
147
|
-
//#region src/
|
|
247
|
+
//#region src/project-sources/candidates/source-priority.ts
|
|
148
248
|
function mergeSourcesByPriority(moduleSourceById, transformSourceById, cssSourceById, scanSourceById) {
|
|
149
249
|
const sources = /* @__PURE__ */ new Map();
|
|
150
250
|
for (const [id, source] of moduleSourceById) sources.set(id, source);
|
|
@@ -154,7 +254,7 @@ function mergeSourcesByPriority(moduleSourceById, transformSourceById, cssSource
|
|
|
154
254
|
return sources;
|
|
155
255
|
}
|
|
156
256
|
//#endregion
|
|
157
|
-
//#region src/
|
|
257
|
+
//#region src/project-sources/candidates/snapshot.ts
|
|
158
258
|
function createCandidateSnapshot(maps) {
|
|
159
259
|
return {
|
|
160
260
|
candidatesById: [...maps.candidatesById.entries()].map(([id, candidates]) => [id, [...candidates]]),
|
|
@@ -229,7 +329,7 @@ const TEMPLATE_SOURCE_CANDIDATE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
|
229
329
|
"mpx"
|
|
230
330
|
]);
|
|
231
331
|
async function extractCandidatesFromSource(source, extension, options = {}) {
|
|
232
|
-
const candidates = options.extractor ? new Set(await options.extractor(source, extension)) : new Set(await (0,
|
|
332
|
+
const candidates = options.extractor ? new Set(await options.extractor(source, extension)) : new Set(await (0, _weapp_tailwindcss_engine.extractSourceCandidates)(source, extension, { ...options.bareArbitraryValues === void 0 ? {} : { bareArbitraryValues: options.bareArbitraryValues } }));
|
|
233
333
|
const scriptCandidates = await extractScriptStringCandidates(source, extension, options);
|
|
234
334
|
for (const candidate of scriptCandidates) candidates.add(candidate);
|
|
235
335
|
const templateAttributeCandidates = await extractTemplateAttributeCandidates(source, extension, options);
|
|
@@ -242,7 +342,7 @@ function isDefaultTemplateAttribute(name) {
|
|
|
242
342
|
return lowerName === "class" || lowerName === "hover-class" || lowerName === "virtualhostclass";
|
|
243
343
|
}
|
|
244
344
|
async function extractCandidateTokensFromTemplateAttributeValue(value, options) {
|
|
245
|
-
return options.extractor ? await options.extractor(value, "html") : await (0,
|
|
345
|
+
return options.extractor ? await options.extractor(value, "html") : await (0, _weapp_tailwindcss_engine.extractSourceCandidates)(value, "html", { ...options.bareArbitraryValues === void 0 ? {} : { bareArbitraryValues: options.bareArbitraryValues } });
|
|
246
346
|
}
|
|
247
347
|
async function extractTemplateAttributeCandidates(source, extension, options) {
|
|
248
348
|
if (!TEMPLATE_SOURCE_CANDIDATE_EXTENSIONS.has(extension)) return [];
|
|
@@ -298,17 +398,17 @@ async function extractScriptStringCandidates(source, extension, options) {
|
|
|
298
398
|
}
|
|
299
399
|
const candidates = /* @__PURE__ */ new Set();
|
|
300
400
|
for (const value of values) {
|
|
301
|
-
const extractedCandidates = options.extractor ? await options.extractor(value, "html") : await (0,
|
|
401
|
+
const extractedCandidates = options.extractor ? await options.extractor(value, "html") : await (0, _weapp_tailwindcss_engine.extractSourceCandidates)(value, "html", { ...options.bareArbitraryValues === void 0 ? {} : { bareArbitraryValues: options.bareArbitraryValues } });
|
|
302
402
|
for (const candidate of extractedCandidates) candidates.add(candidate);
|
|
303
403
|
}
|
|
304
404
|
return candidates;
|
|
305
405
|
}
|
|
306
406
|
//#endregion
|
|
307
|
-
//#region src/
|
|
407
|
+
//#region src/project-sources/candidates/types-and-cache.ts
|
|
308
408
|
const CLEAN_URL_RE = /[?#].*$/;
|
|
309
409
|
const sourceCandidateContentCache = new lru_cache.LRUCache({ max: 128 });
|
|
310
410
|
function cleanUrl(id) {
|
|
311
|
-
return
|
|
411
|
+
return (0, require_tailwindcss.source_scan_exports.resolveSourceScanPath)(id.replace(CLEAN_URL_RE, ""));
|
|
312
412
|
}
|
|
313
413
|
function resolveSourceCandidateExtension(id) {
|
|
314
414
|
const normalized = cleanUrl(id);
|
|
@@ -334,7 +434,7 @@ async function extractCandidates(source, extension, options) {
|
|
|
334
434
|
return extractCandidatesFromSource(source, extension, options);
|
|
335
435
|
}
|
|
336
436
|
function isSourceCandidateRequest(id) {
|
|
337
|
-
return
|
|
437
|
+
return require_tailwindcss.source_scan_exports.FULL_SOURCE_SCAN_EXTENSION_RE.test(cleanUrl(id));
|
|
338
438
|
}
|
|
339
439
|
function removeCandidateSet(candidateCount, candidates) {
|
|
340
440
|
for (const candidate of candidates) {
|
|
@@ -361,10 +461,10 @@ function diffCandidateSets(previous, next) {
|
|
|
361
461
|
};
|
|
362
462
|
}
|
|
363
463
|
//#endregion
|
|
364
|
-
//#region src/
|
|
464
|
+
//#region src/project-sources/candidates/views.ts
|
|
365
465
|
function isIncludedFile(id, isActiveModule, entries, excludeEntries) {
|
|
366
|
-
if (entries !== void 0 && (isActiveModule ?
|
|
367
|
-
return !(excludeEntries?.length &&
|
|
466
|
+
if (entries !== void 0 && (isActiveModule ? (0, require_tailwindcss.source_scan_exports.isFileExcludedByTailwindSourceEntries)(id, entries) : entries.length === 0 || !(0, require_tailwindcss.source_scan_exports.isFileMatchedByTailwindSourceEntries)(id, entries))) return false;
|
|
467
|
+
return !(excludeEntries?.length && (0, require_tailwindcss.source_scan_exports.isFileMatchedByTailwindSourceEntries)(id, excludeEntries));
|
|
368
468
|
}
|
|
369
469
|
function collectCandidateValues(view, entries, excludeEntries) {
|
|
370
470
|
if (entries === void 0 && !excludeEntries?.length) {
|
|
@@ -401,7 +501,7 @@ function collectCandidateSources(view, entries, excludeEntries) {
|
|
|
401
501
|
return sources;
|
|
402
502
|
}
|
|
403
503
|
//#endregion
|
|
404
|
-
//#region src/
|
|
504
|
+
//#region src/project-sources/candidates/store.ts
|
|
405
505
|
const SOURCE_CANDIDATE_FILE_MEMO_MAX = 4096;
|
|
406
506
|
function areSetsEqual(left, right) {
|
|
407
507
|
if (!left || left.size !== right.size) return false;
|
|
@@ -527,7 +627,7 @@ function createSourceCandidateStore(options = {}) {
|
|
|
527
627
|
filter: isSourceCandidateRequest,
|
|
528
628
|
outDir,
|
|
529
629
|
root
|
|
530
|
-
})).map(
|
|
630
|
+
})).map(require_tailwindcss.source_scan_exports.resolveSourceScanPath);
|
|
531
631
|
}
|
|
532
632
|
async function scanRoot(options) {
|
|
533
633
|
const resolvedFiles = await resolveScanFiles(options);
|
|
@@ -737,204 +837,47 @@ function createSourceCandidateStore(options = {}) {
|
|
|
737
837
|
};
|
|
738
838
|
}
|
|
739
839
|
//#endregion
|
|
740
|
-
//#region src/
|
|
840
|
+
//#region src/project-sources/candidates/collector.ts
|
|
741
841
|
function createSourceCandidateCollector(options = {}) {
|
|
742
842
|
return createSourceCandidateStore(options);
|
|
743
843
|
}
|
|
744
844
|
//#endregion
|
|
745
|
-
//#region src/
|
|
746
|
-
const
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
845
|
+
//#region src/bundlers/shared/runtime-class-set/escaped-candidates.ts
|
|
846
|
+
const ESCAPED_CLASS_TOKEN_RE = /[\w-]+_[A-Z][\w-]*/gi;
|
|
847
|
+
const TAILWIND_RESTORED_CANDIDATE_SIGNAL_RE = /[[\]:/#!.]/;
|
|
848
|
+
const MAX_RESTORED_CANDIDATE_VARIANTS = 512;
|
|
849
|
+
const restoredCandidateCaches = /* @__PURE__ */ new WeakMap();
|
|
850
|
+
function hasBalancedCandidateDelimitersFallback(candidate) {
|
|
851
|
+
const stack = [];
|
|
852
|
+
let escaped = false;
|
|
853
|
+
let quote;
|
|
854
|
+
for (const char of candidate) {
|
|
855
|
+
if (escaped) {
|
|
856
|
+
escaped = false;
|
|
857
|
+
continue;
|
|
858
|
+
}
|
|
859
|
+
if (char === "\\") {
|
|
860
|
+
escaped = true;
|
|
861
|
+
continue;
|
|
862
|
+
}
|
|
863
|
+
if (quote) {
|
|
864
|
+
if (char === quote) quote = void 0;
|
|
865
|
+
continue;
|
|
866
|
+
}
|
|
867
|
+
if (char === "\"" || char === "'") {
|
|
868
|
+
quote = char;
|
|
869
|
+
continue;
|
|
870
|
+
}
|
|
871
|
+
if (char === "(" || char === "[" || char === "{") {
|
|
872
|
+
stack.push(char);
|
|
873
|
+
continue;
|
|
874
|
+
}
|
|
875
|
+
if (char === ")" || char === "]" || char === "}") {
|
|
876
|
+
const opening = stack.pop();
|
|
877
|
+
if (!opening || opening === "(" && char !== ")" || opening === "[" && char !== "]" || opening === "{" && char !== "}") return false;
|
|
878
|
+
}
|
|
777
879
|
}
|
|
778
|
-
|
|
779
|
-
function createArtifactSemanticSummary(snapshot) {
|
|
780
|
-
return {
|
|
781
|
-
present: snapshot.present,
|
|
782
|
-
fragments: snapshot.fragments.length,
|
|
783
|
-
classes: snapshot.classSet.length,
|
|
784
|
-
rawCandidates: snapshot.rawCandidates.length,
|
|
785
|
-
dependencies: snapshot.dependencies.length,
|
|
786
|
-
sourceEntries: snapshot.sourceEntries.length
|
|
787
|
-
};
|
|
788
|
-
}
|
|
789
|
-
function isRecord(value) {
|
|
790
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
791
|
-
}
|
|
792
|
-
function appendObjectPath(path, key) {
|
|
793
|
-
return /^[A-Z_$][\w$]*$/i.test(key) ? `${path}.${key}` : `${path}[${JSON.stringify(key)}]`;
|
|
794
|
-
}
|
|
795
|
-
function compareSemanticValues(left, right, path, state) {
|
|
796
|
-
if (state.truncated || Object.is(left, right)) return;
|
|
797
|
-
if (left === void 0 || right === void 0) {
|
|
798
|
-
const value = left === void 0 ? right : left;
|
|
799
|
-
if (Array.isArray(value) && value.length > 0) {
|
|
800
|
-
for (let index = 0; index < value.length; index++) {
|
|
801
|
-
compareSemanticValues(left === void 0 ? void 0 : value[index], right === void 0 ? void 0 : value[index], `${path}[${index}]`, state);
|
|
802
|
-
if (state.truncated) return;
|
|
803
|
-
}
|
|
804
|
-
return;
|
|
805
|
-
}
|
|
806
|
-
if (isRecord(value) && Object.keys(value).length > 0) {
|
|
807
|
-
for (const key of Object.keys(value)) {
|
|
808
|
-
compareSemanticValues(left === void 0 ? void 0 : value[key], right === void 0 ? void 0 : value[key], appendObjectPath(path, key), state);
|
|
809
|
-
if (state.truncated) return;
|
|
810
|
-
}
|
|
811
|
-
return;
|
|
812
|
-
}
|
|
813
|
-
} else if (Array.isArray(left) && Array.isArray(right)) {
|
|
814
|
-
const length = Math.max(left.length, right.length);
|
|
815
|
-
for (let index = 0; index < length; index++) {
|
|
816
|
-
compareSemanticValues(left[index], right[index], `${path}[${index}]`, state);
|
|
817
|
-
if (state.truncated) return;
|
|
818
|
-
}
|
|
819
|
-
return;
|
|
820
|
-
} else if (isRecord(left) && isRecord(right)) {
|
|
821
|
-
const keys = /* @__PURE__ */ new Set([...Object.keys(left), ...Object.keys(right)]);
|
|
822
|
-
for (const key of keys) {
|
|
823
|
-
compareSemanticValues(left[key], right[key], appendObjectPath(path, key), state);
|
|
824
|
-
if (state.truncated) return;
|
|
825
|
-
}
|
|
826
|
-
return;
|
|
827
|
-
}
|
|
828
|
-
state.equal = false;
|
|
829
|
-
if (state.differences.length >= state.maxDifferences) {
|
|
830
|
-
state.truncated = true;
|
|
831
|
-
return;
|
|
832
|
-
}
|
|
833
|
-
state.differences.push({
|
|
834
|
-
kind: left === void 0 ? "added" : right === void 0 ? "removed" : "changed",
|
|
835
|
-
path,
|
|
836
|
-
...left === void 0 ? {} : { left },
|
|
837
|
-
...right === void 0 ? {} : { right }
|
|
838
|
-
});
|
|
839
|
-
}
|
|
840
|
-
function normalizeCssRoot(root) {
|
|
841
|
-
return root.nodes.map(normalizeNode).filter(isSemanticCssNode);
|
|
842
|
-
}
|
|
843
|
-
function createArtifactSemanticSnapshot(artifact) {
|
|
844
|
-
if (artifact === void 0) return {
|
|
845
|
-
present: false,
|
|
846
|
-
fragments: [],
|
|
847
|
-
classSet: [],
|
|
848
|
-
rawCandidates: [],
|
|
849
|
-
dependencies: [],
|
|
850
|
-
sourceEntries: []
|
|
851
|
-
};
|
|
852
|
-
return {
|
|
853
|
-
present: true,
|
|
854
|
-
fragments: [...artifact.fragments].sort((left, right) => left.order - right.order || left.id.localeCompare(right.id)).map((fragment) => ({
|
|
855
|
-
id: fragment.id,
|
|
856
|
-
kind: fragment.kind,
|
|
857
|
-
order: fragment.order,
|
|
858
|
-
scope: { ...fragment.scope },
|
|
859
|
-
sourceId: fragment.sourceId,
|
|
860
|
-
stage: fragment.stage,
|
|
861
|
-
root: normalizeCssRoot(fragment.root)
|
|
862
|
-
})),
|
|
863
|
-
classSet: [...artifact.classSet].sort(),
|
|
864
|
-
rawCandidates: [...artifact.rawCandidates].sort(),
|
|
865
|
-
dependencies: [...artifact.dependencies].sort(),
|
|
866
|
-
sourceEntries: [...artifact.sourceEntries].sort()
|
|
867
|
-
};
|
|
868
|
-
}
|
|
869
|
-
function compareArtifactSemantics(left, right, options = {}) {
|
|
870
|
-
const leftSnapshot = createArtifactSemanticSnapshot(left);
|
|
871
|
-
const rightSnapshot = createArtifactSemanticSnapshot(right);
|
|
872
|
-
const state = {
|
|
873
|
-
differences: [],
|
|
874
|
-
equal: true,
|
|
875
|
-
maxDifferences: Math.max(0, Math.floor(options.maxDifferences ?? defaultMaxDifferences)),
|
|
876
|
-
truncated: false
|
|
877
|
-
};
|
|
878
|
-
compareSemanticValues(leftSnapshot, rightSnapshot, "$", state);
|
|
879
|
-
return {
|
|
880
|
-
equal: state.equal,
|
|
881
|
-
differences: state.differences,
|
|
882
|
-
truncated: state.truncated,
|
|
883
|
-
left: createArtifactSemanticSummary(leftSnapshot),
|
|
884
|
-
right: createArtifactSemanticSummary(rightSnapshot)
|
|
885
|
-
};
|
|
886
|
-
}
|
|
887
|
-
//#endregion
|
|
888
|
-
//#region src/compiler/shadow-report.ts
|
|
889
|
-
function createCompilerShadowReport(file, legacy, graph, options = {}) {
|
|
890
|
-
const comparison = compareArtifactSemantics(legacy, graph, options);
|
|
891
|
-
return {
|
|
892
|
-
file,
|
|
893
|
-
scopeId: options.scopeId ?? file,
|
|
894
|
-
equal: comparison.equal,
|
|
895
|
-
differences: comparison.differences,
|
|
896
|
-
truncated: comparison.truncated,
|
|
897
|
-
legacy: comparison.left,
|
|
898
|
-
graph: comparison.right
|
|
899
|
-
};
|
|
900
|
-
}
|
|
901
|
-
//#endregion
|
|
902
|
-
//#region src/bundlers/shared/runtime-class-set/escaped-candidates.ts
|
|
903
|
-
const ESCAPED_CLASS_TOKEN_RE = /[\w-]+_[A-Z][\w-]*/gi;
|
|
904
|
-
const TAILWIND_RESTORED_CANDIDATE_SIGNAL_RE = /[[\]:/#!.]/;
|
|
905
|
-
const MAX_RESTORED_CANDIDATE_VARIANTS = 512;
|
|
906
|
-
const restoredCandidateCaches = /* @__PURE__ */ new WeakMap();
|
|
907
|
-
function hasBalancedCandidateDelimitersFallback(candidate) {
|
|
908
|
-
const stack = [];
|
|
909
|
-
let escaped = false;
|
|
910
|
-
let quote;
|
|
911
|
-
for (const char of candidate) {
|
|
912
|
-
if (escaped) {
|
|
913
|
-
escaped = false;
|
|
914
|
-
continue;
|
|
915
|
-
}
|
|
916
|
-
if (char === "\\") {
|
|
917
|
-
escaped = true;
|
|
918
|
-
continue;
|
|
919
|
-
}
|
|
920
|
-
if (quote) {
|
|
921
|
-
if (char === quote) quote = void 0;
|
|
922
|
-
continue;
|
|
923
|
-
}
|
|
924
|
-
if (char === "\"" || char === "'") {
|
|
925
|
-
quote = char;
|
|
926
|
-
continue;
|
|
927
|
-
}
|
|
928
|
-
if (char === "(" || char === "[" || char === "{") {
|
|
929
|
-
stack.push(char);
|
|
930
|
-
continue;
|
|
931
|
-
}
|
|
932
|
-
if (char === ")" || char === "]" || char === "}") {
|
|
933
|
-
const opening = stack.pop();
|
|
934
|
-
if (!opening || opening === "(" && char !== ")" || opening === "[" && char !== "]" || opening === "{" && char !== "}") return false;
|
|
935
|
-
}
|
|
936
|
-
}
|
|
937
|
-
return stack.length === 0 && quote === void 0 && !escaped;
|
|
880
|
+
return stack.length === 0 && quote === void 0 && !escaped;
|
|
938
881
|
}
|
|
939
882
|
function hasBalancedCandidateDelimiters(candidate) {
|
|
940
883
|
let delimiterStack = 0;
|
|
@@ -1062,139 +1005,28 @@ function collectStrictEscapedRuntimeCandidates(source, escapeMap, escapeFragment
|
|
|
1062
1005
|
return candidates;
|
|
1063
1006
|
}
|
|
1064
1007
|
//#endregion
|
|
1065
|
-
//#region src/
|
|
1066
|
-
|
|
1067
|
-
const
|
|
1068
|
-
|
|
1069
|
-
return candidate.replace(/(?<!\\)\\:/g, ":").replace(/(?<!\\)\\\//g, "/");
|
|
1070
|
-
}
|
|
1071
|
-
function normalizeSourcePath(source, root) {
|
|
1072
|
-
const resolvedRoot = node_path.default.resolve(root);
|
|
1073
|
-
const resolvedSource = node_path.default.resolve(source);
|
|
1074
|
-
const relative = node_path.default.relative(resolvedRoot, resolvedSource);
|
|
1075
|
-
if (relative && !relative.startsWith("..") && !node_path.default.isAbsolute(relative)) return relative.split(node_path.default.sep).join("/");
|
|
1076
|
-
return source.split(node_path.default.sep).join("/");
|
|
1077
|
-
}
|
|
1078
|
-
function getSourceTraceRoot(opts) {
|
|
1079
|
-
const configured = opts.cssSourceTrace;
|
|
1080
|
-
if (configured && typeof configured === "object" && configured.root) return configured.root;
|
|
1081
|
-
return opts.tailwindcssBasedir ?? node_process.default.cwd();
|
|
1082
|
-
}
|
|
1083
|
-
function isCssSourceTraceEnabled(opts) {
|
|
1084
|
-
return opts.cssSourceTrace === true || typeof opts.cssSourceTrace === "object" && opts.cssSourceTrace !== null;
|
|
1085
|
-
}
|
|
1086
|
-
function createCssTokenSourceMap(sourcesByToken, opts) {
|
|
1087
|
-
const root = getSourceTraceRoot(opts);
|
|
1088
|
-
const tokenSources = /* @__PURE__ */ new Map();
|
|
1089
|
-
for (const [token, sources] of [...sourcesByToken.entries()].sort(([a], [b]) => a.localeCompare(b))) {
|
|
1090
|
-
const source = {
|
|
1091
|
-
token,
|
|
1092
|
-
sources: [...sources].map((file) => normalizeSourcePath(file, root)).sort()
|
|
1093
|
-
};
|
|
1094
|
-
tokenSources.set(token, source);
|
|
1095
|
-
const escaped = require_compiler.replaceWxml(token, { escapeMap: opts.escapeMap });
|
|
1096
|
-
tokenSources.set(escaped, source);
|
|
1097
|
-
tokenSources.set(escaped.replaceAll("\\", ""), source);
|
|
1098
|
-
}
|
|
1099
|
-
return tokenSources;
|
|
1100
|
-
}
|
|
1101
|
-
function createCssSourceTraceCacheSignature(tokenSources, opts) {
|
|
1102
|
-
if (!isCssSourceTraceEnabled(opts)) return "css-source-trace:0";
|
|
1103
|
-
if (!tokenSources?.size) return "css-source-trace:1:empty";
|
|
1104
|
-
return `css-source-trace:1:${[...tokenSources.values()].map(({ token, sources }) => `${token}<=${sources.join(",")}`).sort().join("|")}`;
|
|
1008
|
+
//#region src/generation/source-resolver/postcss-source.ts
|
|
1009
|
+
function resolvePostcssFromOption(cssHandlerOptions) {
|
|
1010
|
+
const from = cssHandlerOptions.postcssOptions?.options?.from;
|
|
1011
|
+
return typeof from === "string" && from.length > 0 ? from : void 0;
|
|
1105
1012
|
}
|
|
1106
|
-
function
|
|
1107
|
-
return
|
|
1108
|
-
}
|
|
1109
|
-
function collectRuleSourceTokens(rule, tokenSources) {
|
|
1110
|
-
const tokens = /* @__PURE__ */ new Map();
|
|
1111
|
-
for (const selector of rule.selectors) {
|
|
1112
|
-
const classMatches = selector.matchAll(/\.((?:\\.|[^\s.#:[{>,])*)/g);
|
|
1113
|
-
for (const match of classMatches) {
|
|
1114
|
-
const rawCandidate = match[1];
|
|
1115
|
-
if (!rawCandidate) continue;
|
|
1116
|
-
const candidates = [normalizeSelectorTokenCandidate(rawCandidate), rawCandidate];
|
|
1117
|
-
for (const candidate of candidates) {
|
|
1118
|
-
const source = getTokenSource(tokenSources, candidate);
|
|
1119
|
-
if (!source) continue;
|
|
1120
|
-
tokens.set(source.token, source);
|
|
1121
|
-
break;
|
|
1122
|
-
}
|
|
1123
|
-
}
|
|
1124
|
-
}
|
|
1125
|
-
return tokens;
|
|
1126
|
-
}
|
|
1127
|
-
function removeTracedTailwindGeneratedContainerRules(root) {
|
|
1128
|
-
root.walkRules((rule) => {
|
|
1129
|
-
if (!rule.selectors || rule.selectors.length !== 1 || rule.selectors[0] !== ".container") return;
|
|
1130
|
-
const previous = rule.prev();
|
|
1131
|
-
if (previous?.type !== "comment" || !TAILWIND_GENERATED_CONTAINER_TRACE_COMMENT_RE.test(previous.text)) return;
|
|
1132
|
-
previous.remove();
|
|
1133
|
-
rule.remove();
|
|
1134
|
-
});
|
|
1013
|
+
function resolvePostcssRequestOption(cssHandlerOptions) {
|
|
1014
|
+
return resolveCssHandlerSourceOptions(cssHandlerOptions)?.requestFile ?? resolvePostcssFromOption(cssHandlerOptions);
|
|
1135
1015
|
}
|
|
1136
|
-
function
|
|
1137
|
-
|
|
1016
|
+
function resolvePostcssSourceFile(cssHandlerOptions) {
|
|
1017
|
+
const from = resolvePostcssFromOption(cssHandlerOptions);
|
|
1018
|
+
if (!from || !node_path.default.isAbsolute(from)) return;
|
|
1019
|
+
return from.replace(/[?#].*$/, "");
|
|
1138
1020
|
}
|
|
1139
|
-
function
|
|
1140
|
-
|
|
1141
|
-
try {
|
|
1142
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
1143
|
-
root.walkComments((comment) => {
|
|
1144
|
-
if (CSS_SOURCE_TRACE_COMMENT_RE.test(comment.text)) comment.remove();
|
|
1145
|
-
});
|
|
1146
|
-
root.walkRules((rule) => {
|
|
1147
|
-
const tokens = collectRuleSourceTokens(rule, options.tokenSources);
|
|
1148
|
-
if (tokens.size === 0 || !rule.parent) return;
|
|
1149
|
-
const lines = [...tokens.values()].map(({ token, sources }) => {
|
|
1150
|
-
return `${token} <= ${sources.length > 0 ? sources.join(", ") : "<tailwind generated>"}`;
|
|
1151
|
-
});
|
|
1152
|
-
const comment = _weapp_tailwindcss_postcss.postcss.comment({ text: `tokens: ${lines.join(" | ")}` });
|
|
1153
|
-
comment.raws.before = normalizeTraceCommentBefore(rule.raws.before);
|
|
1154
|
-
rule.raws.before = "\n";
|
|
1155
|
-
rule.parent.insertBefore(rule, comment);
|
|
1156
|
-
});
|
|
1157
|
-
removeTracedTailwindGeneratedContainerRules(root);
|
|
1158
|
-
return root.toString();
|
|
1159
|
-
} catch {
|
|
1160
|
-
return css;
|
|
1161
|
-
}
|
|
1021
|
+
function resolveCssHandlerSourceOptions(cssHandlerOptions) {
|
|
1022
|
+
return cssHandlerOptions.sourceOptions;
|
|
1162
1023
|
}
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
const BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE = /\/\*!?\s*weapp-tailwindcss (?:gulp|vite|webpack)-generated-css(?:\s*:\s*[^\s*]+)?\s*\*\/\s*/gi;
|
|
1167
|
-
const BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE = /\/\*!?\s*weapp-tailwindcss (gulp|vite|webpack)-generated-css(?:\s*:\s*([^\s*]+))?\s*\*\/\s*/gi;
|
|
1168
|
-
const VITE_INTERNAL_CSS_MARKER_GLOBAL_RE = /\/\*\$vite\$:\d+\*\/\s*/g;
|
|
1169
|
-
function createBundlerGeneratedCssMarker(bundler, file) {
|
|
1170
|
-
return `/*! weapp-tailwindcss ${bundler}-generated-css:${encodeURIComponent(file)} */`;
|
|
1171
|
-
}
|
|
1172
|
-
function hasBundlerGeneratedCssMarker(source) {
|
|
1173
|
-
return typeof source === "string" && BUNDLER_GENERATED_CSS_MARKER_RE.test(source);
|
|
1174
|
-
}
|
|
1175
|
-
function stripBundlerGeneratedCssMarkers(source) {
|
|
1176
|
-
return source.replace(BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE, "").replace(VITE_INTERNAL_CSS_MARKER_GLOBAL_RE, "");
|
|
1177
|
-
}
|
|
1178
|
-
function parseBundlerGeneratedCssMarkerBlocks(source) {
|
|
1179
|
-
const blocks = [];
|
|
1180
|
-
BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.lastIndex = 0;
|
|
1181
|
-
let match = BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.exec(source);
|
|
1182
|
-
while (match !== null) {
|
|
1183
|
-
const cssStart = BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.lastIndex;
|
|
1184
|
-
const nextMatch = BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.exec(source);
|
|
1185
|
-
const cssEnd = nextMatch?.index ?? source.length;
|
|
1186
|
-
const file = match[2] ? decodeURIComponent(match[2]) : void 0;
|
|
1187
|
-
blocks.push({
|
|
1188
|
-
bundler: match[1],
|
|
1189
|
-
file,
|
|
1190
|
-
css: source.slice(cssStart, cssEnd)
|
|
1191
|
-
});
|
|
1192
|
-
match = nextMatch;
|
|
1193
|
-
}
|
|
1194
|
-
return blocks;
|
|
1024
|
+
function resolveCssSourceBase(file, cssHandlerOptions) {
|
|
1025
|
+
const normalized = (resolvePostcssFromOption(cssHandlerOptions) ?? file).replace(/[?#].*$/, "");
|
|
1026
|
+
return node_path.default.dirname(node_path.default.resolve(normalized));
|
|
1195
1027
|
}
|
|
1196
1028
|
//#endregion
|
|
1197
|
-
//#region src/
|
|
1029
|
+
//#region src/generation/style-requests.ts
|
|
1198
1030
|
const SOURCE_STYLE_EXT_RE = /\.(?:css|scss|sass|less|styl|stylus|pcss|postcss)$/i;
|
|
1199
1031
|
const SOURCE_PREPROCESSOR_EXT_RE = /\.(?:scss|sass|less|styl|stylus)$/i;
|
|
1200
1032
|
const SFC_SOURCE_EXT_RE = /\.(?:vue|uvue|nvue|svelte|mpx)$/i;
|
|
@@ -1246,28 +1078,7 @@ function isVueScopedStyleRequest(request) {
|
|
|
1246
1078
|
return VUE_STYLE_QUERY_RE.test(query) && /(?:^|&)scoped(?:=[^&]*)?(?:&|$)/.test(query);
|
|
1247
1079
|
}
|
|
1248
1080
|
//#endregion
|
|
1249
|
-
//#region src/
|
|
1250
|
-
function resolvePostcssFromOption(cssHandlerOptions) {
|
|
1251
|
-
const from = cssHandlerOptions.postcssOptions?.options?.from;
|
|
1252
|
-
return typeof from === "string" && from.length > 0 ? from : void 0;
|
|
1253
|
-
}
|
|
1254
|
-
function resolvePostcssRequestOption(cssHandlerOptions) {
|
|
1255
|
-
return resolveCssHandlerSourceOptions(cssHandlerOptions)?.requestFile ?? resolvePostcssFromOption(cssHandlerOptions);
|
|
1256
|
-
}
|
|
1257
|
-
function resolvePostcssSourceFile(cssHandlerOptions) {
|
|
1258
|
-
const from = resolvePostcssFromOption(cssHandlerOptions);
|
|
1259
|
-
if (!from || !node_path.default.isAbsolute(from)) return;
|
|
1260
|
-
return from.replace(/[?#].*$/, "");
|
|
1261
|
-
}
|
|
1262
|
-
function resolveCssHandlerSourceOptions(cssHandlerOptions) {
|
|
1263
|
-
return cssHandlerOptions.sourceOptions;
|
|
1264
|
-
}
|
|
1265
|
-
function resolveCssSourceBase(file, cssHandlerOptions) {
|
|
1266
|
-
const normalized = (resolvePostcssFromOption(cssHandlerOptions) ?? file).replace(/[?#].*$/, "");
|
|
1267
|
-
return node_path.default.dirname(node_path.default.resolve(normalized));
|
|
1268
|
-
}
|
|
1269
|
-
//#endregion
|
|
1270
|
-
//#region src/bundlers/shared/generator-css/generation-helpers/preflight.ts
|
|
1081
|
+
//#region src/generation/generation-helpers/preflight.ts
|
|
1271
1082
|
function hasMiniProgramTailwindV4PreflightReset(css) {
|
|
1272
1083
|
return /(?:^|[},])\s*view\s*,\s*text\s*,\s*::after\s*,\s*::before\s*\{[^}]*\bborder\s*:\s*0\s+solid\b/.test(css);
|
|
1273
1084
|
}
|
|
@@ -1276,7 +1087,7 @@ function isMiniProgramGeneratorTarget(target) {
|
|
|
1276
1087
|
}
|
|
1277
1088
|
function finalizeMiniProgramGeneratorCss(css, target, _majorVersion, cssPreflight, options = {}) {
|
|
1278
1089
|
if (!isMiniProgramGeneratorTarget(target)) return css;
|
|
1279
|
-
if (options.styleOptions && isVueScopedStyleRequest(resolvePostcssRequestOption(options.styleOptions))) return (0,
|
|
1090
|
+
if (options.styleOptions && isVueScopedStyleRequest(resolvePostcssRequestOption(options.styleOptions))) return (0, _weapp_tailwindcss_postcss_transform.finalizeMiniProgramCss)(css, {
|
|
1280
1091
|
cssPreflight: false,
|
|
1281
1092
|
cssSelectorReplacement: options.styleOptions?.cssOptions?.cssSelectorReplacement ?? options.styleOptions?.cssSelectorReplacement,
|
|
1282
1093
|
isTailwindcssV4: true,
|
|
@@ -1286,7 +1097,7 @@ function finalizeMiniProgramGeneratorCss(css, target, _majorVersion, cssPrefligh
|
|
|
1286
1097
|
const hasPreflightReset = hasMiniProgramTailwindV4PreflightReset(css);
|
|
1287
1098
|
const injectPreflight = options.injectPreflight !== false && !hasPreflightReset;
|
|
1288
1099
|
const preservePreflight = options.preservePreflight !== false;
|
|
1289
|
-
return (0,
|
|
1100
|
+
return (0, _weapp_tailwindcss_postcss_transform.finalizeMiniProgramCss)(css, {
|
|
1290
1101
|
cssPreflight: cssPreflight === false || options.injectPreflight === false && (!hasPreflightReset || !preservePreflight) ? false : injectPreflight ? cssPreflight : hasPreflightReset && preservePreflight ? cssPreflight : void 0,
|
|
1291
1102
|
cssSelectorReplacement: options.styleOptions?.cssOptions?.cssSelectorReplacement ?? options.styleOptions?.cssSelectorReplacement,
|
|
1292
1103
|
isTailwindcssV4: true,
|
|
@@ -1334,142 +1145,21 @@ function resolveMiniProgramPreflightModeForGeneratorCss(opts, options) {
|
|
|
1334
1145
|
};
|
|
1335
1146
|
}
|
|
1336
1147
|
//#endregion
|
|
1337
|
-
//#region src/
|
|
1338
|
-
function createCssSourceOrderAppend(base, extra) {
|
|
1339
|
-
if (!base) return extra;
|
|
1340
|
-
if (!extra) return base;
|
|
1341
|
-
if (/\s$/.test(base) || /^\s/.test(extra)) return `${base}${extra}`;
|
|
1342
|
-
return `${base}\n${extra}`;
|
|
1343
|
-
}
|
|
1344
|
-
const LEGACY_PSEUDO_ELEMENTS$1 = [
|
|
1345
|
-
"before",
|
|
1346
|
-
"after",
|
|
1347
|
-
"first-letter",
|
|
1348
|
-
"first-line"
|
|
1349
|
-
];
|
|
1350
|
-
const CSS_STRING_LITERAL_RE = /(["'])((?:\\[\s\S]|(?!\1)[\s\S])*)\1/g;
|
|
1351
|
-
function isLegacyPseudoElementAt$1(selector, index) {
|
|
1352
|
-
for (const name of LEGACY_PSEUDO_ELEMENTS$1) {
|
|
1353
|
-
if (!selector.startsWith(name, index)) continue;
|
|
1354
|
-
const next = selector[index + name.length];
|
|
1355
|
-
if (next === void 0 || !/[\w-]/.test(next)) return name;
|
|
1356
|
-
}
|
|
1357
|
-
}
|
|
1358
|
-
function normalizeLegacyPseudoElements$1(selector) {
|
|
1359
|
-
let result = "";
|
|
1360
|
-
let quote;
|
|
1361
|
-
let bracketDepth = 0;
|
|
1362
|
-
let index = 0;
|
|
1363
|
-
while (index < selector.length) {
|
|
1364
|
-
const char = selector[index];
|
|
1365
|
-
if (char === "\\") {
|
|
1366
|
-
result += selector.slice(index, index + 2);
|
|
1367
|
-
index += 2;
|
|
1368
|
-
continue;
|
|
1369
|
-
}
|
|
1370
|
-
if (quote !== void 0) {
|
|
1371
|
-
result += char;
|
|
1372
|
-
if (char === quote) quote = void 0;
|
|
1373
|
-
index += 1;
|
|
1374
|
-
continue;
|
|
1375
|
-
}
|
|
1376
|
-
if (char === "\"" || char === "'") {
|
|
1377
|
-
quote = char;
|
|
1378
|
-
result += char;
|
|
1379
|
-
index += 1;
|
|
1380
|
-
continue;
|
|
1381
|
-
}
|
|
1382
|
-
if (char === "[") {
|
|
1383
|
-
bracketDepth++;
|
|
1384
|
-
result += char;
|
|
1385
|
-
index += 1;
|
|
1386
|
-
continue;
|
|
1387
|
-
}
|
|
1388
|
-
if (char === "]") {
|
|
1389
|
-
bracketDepth = Math.max(0, bracketDepth - 1);
|
|
1390
|
-
result += char;
|
|
1391
|
-
index += 1;
|
|
1392
|
-
continue;
|
|
1393
|
-
}
|
|
1394
|
-
if (bracketDepth === 0 && char === ":" && selector[index + 1] === ":") {
|
|
1395
|
-
result += "::";
|
|
1396
|
-
index += 2;
|
|
1397
|
-
continue;
|
|
1398
|
-
}
|
|
1399
|
-
if (bracketDepth === 0 && char === ":") {
|
|
1400
|
-
const name = isLegacyPseudoElementAt$1(selector, index + 1);
|
|
1401
|
-
if (name) {
|
|
1402
|
-
result += `::${name}`;
|
|
1403
|
-
index += name.length + 1;
|
|
1404
|
-
continue;
|
|
1405
|
-
}
|
|
1406
|
-
}
|
|
1407
|
-
result += char;
|
|
1408
|
-
index += 1;
|
|
1409
|
-
}
|
|
1410
|
-
return result;
|
|
1411
|
-
}
|
|
1412
|
-
function normalizeCssRuleDeduplicationSelector(selector) {
|
|
1413
|
-
return normalizeLegacyPseudoElements$1(selector).replace(/\s+/g, " ").replace(/\s*([>+~])\s*/g, "$1").replace(/\(\s+/g, "(").replace(/\s+\)/g, ")").trim();
|
|
1414
|
-
}
|
|
1415
|
-
function normalizeCssRuleDeduplicationValue(value) {
|
|
1416
|
-
return value.replace(/\s+/g, " ").replace(CSS_STRING_LITERAL_RE, (_match, _quote, content) => {
|
|
1417
|
-
return `'${content.replace(/\\(["'])/g, "$1").replace(/'/g, "\\'")}'`;
|
|
1418
|
-
}).trim();
|
|
1419
|
-
}
|
|
1420
|
-
function createRuleDeduplicationKey(rule) {
|
|
1421
|
-
const parents = [];
|
|
1422
|
-
let parent = rule.parent;
|
|
1423
|
-
while (parent && parent.type !== "root") {
|
|
1424
|
-
if (parent.type === "atrule") parents.push(`${parent.name}:${parent.params}`);
|
|
1425
|
-
parent = parent.parent;
|
|
1426
|
-
}
|
|
1427
|
-
const declarations = (rule.nodes ?? []).map((node) => {
|
|
1428
|
-
if (node.type === "decl") return `${node.prop}:${normalizeCssRuleDeduplicationValue(node.value)}:${node.important ? "1" : "0"}`;
|
|
1429
|
-
if (node.type === "comment") return "";
|
|
1430
|
-
return normalizeCssRuleDeduplicationValue(node.toString());
|
|
1431
|
-
}).filter(Boolean);
|
|
1432
|
-
const selectors = (rule.selectors?.length ? rule.selectors : [rule.selector]).map(normalizeCssRuleDeduplicationSelector);
|
|
1433
|
-
return [
|
|
1434
|
-
parents.reverse().join("|"),
|
|
1435
|
-
selectors.join(","),
|
|
1436
|
-
declarations.join(";")
|
|
1437
|
-
].join("\n");
|
|
1438
|
-
}
|
|
1439
|
-
function deduplicateGeneratedCssRules(css) {
|
|
1440
|
-
if (!css) return css;
|
|
1441
|
-
try {
|
|
1442
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
1443
|
-
const seen = /* @__PURE__ */ new Set();
|
|
1444
|
-
root.walkRules((rule) => {
|
|
1445
|
-
const key = createRuleDeduplicationKey(rule);
|
|
1446
|
-
if (seen.has(key)) {
|
|
1447
|
-
rule.remove();
|
|
1448
|
-
return;
|
|
1449
|
-
}
|
|
1450
|
-
seen.add(key);
|
|
1451
|
-
});
|
|
1452
|
-
return root.toString();
|
|
1453
|
-
} catch {
|
|
1454
|
-
return css;
|
|
1455
|
-
}
|
|
1456
|
-
}
|
|
1457
|
-
//#endregion
|
|
1458
|
-
//#region src/bundlers/shared/generator-css/generation-helpers/results.ts
|
|
1148
|
+
//#region src/generation/generation-helpers/results.ts
|
|
1459
1149
|
function shouldFinalizeMarkedUserLayerComponentsCss(file) {
|
|
1460
1150
|
return !/\.(?:vue|svelte|astro|scss|sass|less|styl)(?:[?#].*)?$/i.test(file);
|
|
1461
1151
|
}
|
|
1462
1152
|
function splitRawSourceByGeneratedCssOrder(rawSource, rawTailwindCss) {
|
|
1463
|
-
const placeholderParts =
|
|
1153
|
+
const placeholderParts = (0, _weapp_tailwindcss_postcss_transform.splitGeneratorPlaceholderCssBySourceOrder)(rawSource, rawTailwindCss);
|
|
1464
1154
|
if (placeholderParts) return placeholderParts;
|
|
1465
|
-
const exactParts =
|
|
1155
|
+
const exactParts = (0, _weapp_tailwindcss_postcss_transform.splitTailwindV4GeneratedCssBySourceOrder)(rawSource, rawTailwindCss);
|
|
1466
1156
|
if (exactParts) return exactParts;
|
|
1467
|
-
return
|
|
1157
|
+
return (0, _weapp_tailwindcss_postcss_transform.splitTailwindGeneratedCssByBanner)(rawSource);
|
|
1468
1158
|
}
|
|
1469
1159
|
function shouldUseGeneratorForCurrentCss(_majorVersion, cssHandlerOptions, options) {
|
|
1470
|
-
const hasApplyDirectives =
|
|
1160
|
+
const hasApplyDirectives = (0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyDirective)(options.rawSource);
|
|
1471
1161
|
const sourceCss = cssHandlerOptions.sourceOptions?.sourceCss;
|
|
1472
|
-
const hasSourceCssDirectives = typeof sourceCss === "string" && (
|
|
1162
|
+
const hasSourceCssDirectives = typeof sourceCss === "string" && ((0, _weapp_tailwindcss_postcss_transform.hasTailwindRootDirectives)(sourceCss, { importFallback: true }) || (0, _weapp_tailwindcss_postcss_transform.hasTailwindSourceDirectives)(sourceCss, { importFallback: true }) || (0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyDirective)(sourceCss));
|
|
1473
1163
|
return options.forceGenerator === true || options.hasGeneratedCss || options.hasGeneratedMarkers || options.hasSourceDirectives || hasApplyDirectives || hasSourceCssDirectives || cssHandlerOptions.isMainChunk && (options.configuredCssSourceCount ?? 0) > 0 || cssHandlerOptions.isMainChunk && options.rawSource.includes("weapp-tailwindcss") || options.target === "web" && cssHandlerOptions.isMainChunk && (options.runtimeCandidateCount ?? 0) > 0;
|
|
1474
1164
|
}
|
|
1475
1165
|
function createRuntimeWithCurrentCssCandidates(runtime, currentCssCandidates, isolateCurrentCssCandidates) {
|
|
@@ -1483,8 +1173,8 @@ function mergeGeneratorResults(generatedResults) {
|
|
|
1483
1173
|
const incrementalRawCssResults = generatedResults.map((item) => item.incrementalRawCss).filter((css) => typeof css === "string");
|
|
1484
1174
|
return {
|
|
1485
1175
|
...firstGenerated,
|
|
1486
|
-
css: deduplicateGeneratedCssRules(generatedResults.map((item) => item.css).join("\n")),
|
|
1487
|
-
rawCss: deduplicateGeneratedCssRules(generatedResults.map((item) => item.rawCss).join("\n")),
|
|
1176
|
+
css: (0, _weapp_tailwindcss_postcss_transform.deduplicateGeneratedCssRules)(generatedResults.map((item) => item.css).join("\n")),
|
|
1177
|
+
rawCss: (0, _weapp_tailwindcss_postcss_transform.deduplicateGeneratedCssRules)(generatedResults.map((item) => item.rawCss).join("\n")),
|
|
1488
1178
|
incrementalCss: incrementalCssResults.length === generatedResults.length ? incrementalCssResults.filter(Boolean).join("\n") : void 0,
|
|
1489
1179
|
incrementalRawCss: incrementalRawCssResults.length === generatedResults.length ? incrementalRawCssResults.filter(Boolean).join("\n") : void 0,
|
|
1490
1180
|
classSet: new Set(generatedResults.flatMap((item) => [...item.classSet])),
|
|
@@ -1493,7 +1183,7 @@ function mergeGeneratorResults(generatedResults) {
|
|
|
1493
1183
|
};
|
|
1494
1184
|
}
|
|
1495
1185
|
//#endregion
|
|
1496
|
-
//#region src/
|
|
1186
|
+
//#region src/generation/generation-helpers/runtime-isolation.ts
|
|
1497
1187
|
function mergeScopedRuntimeWithCurrentRuntime(scopedRuntime, runtime, options) {
|
|
1498
1188
|
if (options.isolateCssSource) {
|
|
1499
1189
|
if (options.matchedCssSourceFile) return /* @__PURE__ */ new Set([...scopedRuntime, ...options.currentCssCandidates ?? []]);
|
|
@@ -1511,7 +1201,7 @@ function shouldIsolateScopedCssSource(_majorVersion, record, sourceEntries, opti
|
|
|
1511
1201
|
return sourceEntries !== void 0 && options.cssHandlerOptions?.isMainChunk !== true;
|
|
1512
1202
|
}
|
|
1513
1203
|
function shouldIsolateCurrentTailwindV4CssCandidates(_majorVersion, cssHandlerOptions, options) {
|
|
1514
|
-
return !cssHandlerOptions.isMainChunk &&
|
|
1204
|
+
return !cssHandlerOptions.isMainChunk && (0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyDirective)(options.rawSource) && !(0, _weapp_tailwindcss_postcss_transform.hasTailwindRootDirectives)(options.rawSource) && !options.hasGeneratedCss && !options.hasGeneratedMarkers;
|
|
1515
1205
|
}
|
|
1516
1206
|
function shouldScanTailwindV4Sources(majorVersion, target, generatorRuntime, isolateCssSource) {
|
|
1517
1207
|
if (majorVersion !== 4) throw new Error("weapp-tailwindcss 生成管线仅支持 Tailwind CSS v4。");
|
|
@@ -1542,7 +1232,27 @@ function resolveGeneratorStyleOptions(opts, cssHandlerOptions, generatorStyleOpt
|
|
|
1542
1232
|
};
|
|
1543
1233
|
}
|
|
1544
1234
|
//#endregion
|
|
1545
|
-
//#region src/
|
|
1235
|
+
//#region src/tailwindcss/v4/rpx-theme-warning.ts
|
|
1236
|
+
const warnedSessions = /* @__PURE__ */ new WeakSet();
|
|
1237
|
+
function shouldCheckRpxThemeRisk(session, target, opts, platform) {
|
|
1238
|
+
if (target !== "weapp" || warnedSessions.has(session) || opts.logLevel === "silent" || opts.logLevel === "error") return false;
|
|
1239
|
+
const resolved = require_compiler.normalizeFrameworkStylePlatform(platform ?? opts.cssOptions?.platform ?? opts.platform ?? node_process.default.env["UNI_UTS_PLATFORM"] ?? node_process.default.env["UNI_PLATFORM"] ?? node_process.default.env["TARO_ENV"] ?? node_process.default.env["MPX_CURRENT_TARGET_MODE"] ?? node_process.default.env["MPX_CLI_MODE"], opts.appType);
|
|
1240
|
+
return resolved === "mp-weixin" || resolved === "weapp" || resolved === "wx" || resolved === "weixin";
|
|
1241
|
+
}
|
|
1242
|
+
function collectRpxThemeRiskSources(sources) {
|
|
1243
|
+
const variables = /* @__PURE__ */ new Set();
|
|
1244
|
+
for (const css of new Set(sources)) for (const name of (0, _weapp_tailwindcss_postcss_transform.collectRpxThemeVariables)(css)) variables.add(name);
|
|
1245
|
+
return [...variables];
|
|
1246
|
+
}
|
|
1247
|
+
function warnRpxThemeRisk(session, variables, outputCss) {
|
|
1248
|
+
if (warnedSessions.has(session) || variables.length === 0) return;
|
|
1249
|
+
const usage = (0, _weapp_tailwindcss_postcss_transform.inspectRpxCalcUsage)(outputCss, new Set(variables));
|
|
1250
|
+
const runtimeHint = usage === void 0 ? "当前 CSS 无法完成诊断,请检查最终 WXSS。" : usage.variables.length > 0 || usage.inlineRpx ? `当前输出仍含运行时 calc:${[...usage.variables, ...usage.inlineRpx ? ["内联 rpx"] : []].join(", ")}。` : "当前输出未检测到相关运行时 calc;这不代表已验证所有作用域和设备。";
|
|
1251
|
+
warnedSessions.add(session);
|
|
1252
|
+
_weapp_tailwindcss_logger.logger.warn(`[tailwindcss@4][rpx-theme] @theme 中使用 rpx 的主题变量:${variables.join(", ")}。${runtimeHint} 微信 WXSS 可能先独立换算或量化基数再乘法,造成尺寸偏差,具体取整算法尚未确认。固定像素尺寸优先使用 px,需要缩放时在构建期输出最终静态 rpx;偶数或较大 rpx 也不保证准确。请检查最终 WXSS 并在目标设备验证:https://tw.weapp.dev/docs/issues/spacing-rpx`);
|
|
1253
|
+
}
|
|
1254
|
+
//#endregion
|
|
1255
|
+
//#region src/generation/framework-postcss.ts
|
|
1546
1256
|
const FRAMEWORK_POSTCSS_REGISTRY = Symbol.for("weapp-tailwindcss.framework-postcss-options");
|
|
1547
1257
|
const registryHost = globalThis;
|
|
1548
1258
|
const frameworkPostcssOptions = registryHost[FRAMEWORK_POSTCSS_REGISTRY] ?? (registryHost[FRAMEWORK_POSTCSS_REGISTRY] = /* @__PURE__ */ new WeakMap());
|
|
@@ -1552,7 +1262,7 @@ function isObject(value) {
|
|
|
1552
1262
|
function normalizePlugins(plugins) {
|
|
1553
1263
|
const entries = Array.isArray(plugins) ? plugins : isObject(plugins) ? Object.values(plugins) : [];
|
|
1554
1264
|
const resolved = [...new Set(entries.filter(Boolean))];
|
|
1555
|
-
(0,
|
|
1265
|
+
(0, _weapp_tailwindcss_postcss_transform.removeTailwindPostcssPlugins)(resolved);
|
|
1556
1266
|
return resolved;
|
|
1557
1267
|
}
|
|
1558
1268
|
function resolveFrameworkPostcssOptions(value) {
|
|
@@ -1647,7 +1357,7 @@ function createFrameworkReplayArtifact(generated, options) {
|
|
|
1647
1357
|
scope,
|
|
1648
1358
|
stage: "raw"
|
|
1649
1359
|
})], {
|
|
1650
|
-
classSet: generated.classSet,
|
|
1360
|
+
classSet: new Set(generated.classSet),
|
|
1651
1361
|
rawCandidates: new Set(options.rawCandidates),
|
|
1652
1362
|
dependencies: generated.dependencies,
|
|
1653
1363
|
sourceEntries: options.cssHandlerOptions.sourceOptions?.cssEntries ?? [],
|
|
@@ -1655,7 +1365,9 @@ function createFrameworkReplayArtifact(generated, options) {
|
|
|
1655
1365
|
});
|
|
1656
1366
|
}
|
|
1657
1367
|
async function adaptGeneratedCssWithFrameworkPipeline(owner, generated, options) {
|
|
1658
|
-
const
|
|
1368
|
+
const handlerOptions = createGeneratedCssHandlerOptions(owner, options.cssHandlerOptions, options.file);
|
|
1369
|
+
if (generated.target === "web") return (await (0, _weapp_tailwindcss_postcss_transform.processFrameworkCss)(generated.css, handlerOptions.postcssOptions)).css;
|
|
1370
|
+
const handled = await options.styleHandler(generated.css, handlerOptions);
|
|
1659
1371
|
const preflightMode = generated.metadata?.preflightMode;
|
|
1660
1372
|
const injectPreflight = preflightMode?.inject ?? options.cssHandlerOptions.isMainChunk;
|
|
1661
1373
|
const preservePreflight = preflightMode?.preserve ?? options.cssHandlerOptions.isMainChunk;
|
|
@@ -1667,6 +1379,7 @@ async function adaptGeneratedCssWithFrameworkPipeline(owner, generated, options)
|
|
|
1667
1379
|
}
|
|
1668
1380
|
async function adaptGeneratedCssWithFrameworkRootPipeline(owner, generated, options) {
|
|
1669
1381
|
const handlerOptions = createGeneratedCssHandlerOptions(owner, options.cssHandlerOptions, options.file);
|
|
1382
|
+
if (generated.target === "web") return (await (0, _weapp_tailwindcss_postcss_transform.processFrameworkCss)(generated.css, handlerOptions.postcssOptions)).css;
|
|
1670
1383
|
const replayArtifact = createFrameworkReplayArtifact(generated, options);
|
|
1671
1384
|
const handled = options.compiler && options.snapshot ? require_compiler.composeGenerationArtifact(await (async () => {
|
|
1672
1385
|
for (const fragment of replayArtifact.fragments) {
|
|
@@ -1689,515 +1402,46 @@ async function adaptGeneratedCssWithFrameworkRootPipeline(owner, generated, opti
|
|
|
1689
1402
|
});
|
|
1690
1403
|
}
|
|
1691
1404
|
//#endregion
|
|
1692
|
-
//#region src/
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
if (!extra) return base;
|
|
1698
|
-
if (/\s$/.test(base) || /^\s/.test(extra)) return `${base}${extra}`;
|
|
1699
|
-
return `${base}\n${extra}`;
|
|
1700
|
-
}
|
|
1701
|
-
function removeFirstCssOccurrence(css, chunk) {
|
|
1702
|
-
const trimmed = chunk.trim();
|
|
1703
|
-
if (!trimmed) return css;
|
|
1704
|
-
const index = css.indexOf(trimmed);
|
|
1705
|
-
if (index === -1) return css;
|
|
1706
|
-
return appendCss(css.slice(0, index).trimEnd(), css.slice(index + trimmed.length).trimStart());
|
|
1707
|
-
}
|
|
1708
|
-
function collectSelectorsFromCss(css) {
|
|
1709
|
-
const selectors = /* @__PURE__ */ new Set();
|
|
1710
|
-
try {
|
|
1711
|
-
_weapp_tailwindcss_postcss.postcss.parse(css).walkRules((rule) => {
|
|
1712
|
-
for (const selector of rule.selectors ?? [rule.selector]) {
|
|
1713
|
-
const normalized = selector.trim();
|
|
1714
|
-
if (normalized) selectors.add(normalized);
|
|
1715
|
-
}
|
|
1716
|
-
});
|
|
1717
|
-
} catch {}
|
|
1718
|
-
return selectors;
|
|
1719
|
-
}
|
|
1720
|
-
function normalizeRuleValue(value) {
|
|
1721
|
-
return value.replace(/\s+/g, " ").trim();
|
|
1722
|
-
}
|
|
1723
|
-
function createRuleKey(rule) {
|
|
1724
|
-
const parents = [];
|
|
1725
|
-
let parent = rule.parent;
|
|
1726
|
-
while (parent && parent.type !== "root") {
|
|
1727
|
-
if (parent.type === "atrule") parents.push(`${parent.name}:${normalizeRuleValue(parent.params)}`);
|
|
1728
|
-
parent = parent.parent;
|
|
1729
|
-
}
|
|
1730
|
-
const selectors = (rule.selectors ?? [rule.selector]).map((selector) => normalizeRuleValue(selector)).join(",");
|
|
1731
|
-
const declarations = (rule.nodes ?? []).filter((node) => node.type === "decl").map((node) => `${node.prop}:${normalizeRuleValue(node.value)}:${node.important ? "1" : "0"}`).join(";");
|
|
1732
|
-
return `${parents.reverse().join("|")}\n${selectors}\n${declarations}`;
|
|
1733
|
-
}
|
|
1734
|
-
function collectRuleKeysFromCss(css) {
|
|
1735
|
-
const keys = /* @__PURE__ */ new Set();
|
|
1736
|
-
try {
|
|
1737
|
-
_weapp_tailwindcss_postcss.postcss.parse(css).walkRules((rule) => {
|
|
1738
|
-
keys.add(createRuleKey(rule));
|
|
1739
|
-
});
|
|
1740
|
-
} catch {}
|
|
1741
|
-
return keys;
|
|
1742
|
-
}
|
|
1743
|
-
function matchesLayerSelector(selector, layerSelector) {
|
|
1744
|
-
if (selector === layerSelector) return true;
|
|
1745
|
-
if (!selector.startsWith(layerSelector)) return false;
|
|
1746
|
-
const next = selector[layerSelector.length];
|
|
1747
|
-
return next === ":" || next === "[";
|
|
1748
|
-
}
|
|
1749
|
-
function removeCssRulesForSelectors(css, layerCss) {
|
|
1750
|
-
const selectors = [...collectSelectorsFromCss(layerCss)];
|
|
1751
|
-
if (selectors.length === 0) return css;
|
|
1752
|
-
try {
|
|
1753
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
1754
|
-
root.walkRules((rule) => {
|
|
1755
|
-
if ((rule.selectors ?? [rule.selector]).some((selector) => selectors.some((layerSelector) => matchesLayerSelector(selector.trim(), layerSelector)))) rule.remove();
|
|
1756
|
-
});
|
|
1757
|
-
return root.toString();
|
|
1758
|
-
} catch {
|
|
1759
|
-
return removeFirstCssOccurrence(css, layerCss);
|
|
1760
|
-
}
|
|
1761
|
-
}
|
|
1762
|
-
function removeExactCssRules(css, duplicateCss) {
|
|
1763
|
-
const duplicateKeys = collectRuleKeysFromCss(duplicateCss);
|
|
1764
|
-
if (duplicateKeys.size === 0) return css;
|
|
1765
|
-
try {
|
|
1766
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
1767
|
-
root.walkRules((rule) => {
|
|
1768
|
-
if (duplicateKeys.has(createRuleKey(rule))) rule.remove();
|
|
1769
|
-
});
|
|
1770
|
-
return root.toString();
|
|
1771
|
-
} catch {
|
|
1772
|
-
return css;
|
|
1773
|
-
}
|
|
1774
|
-
}
|
|
1775
|
-
function wrapUserLayerComponentsCss(css) {
|
|
1776
|
-
return css.trim().length > 0 ? `${USER_LAYER_COMPONENTS_START}\n${css}\n${USER_LAYER_COMPONENTS_END}` : css;
|
|
1777
|
-
}
|
|
1778
|
-
function extractMarkedUserLayerComponentsCss(css) {
|
|
1779
|
-
const layers = [];
|
|
1780
|
-
let rest = "";
|
|
1781
|
-
let cursor = 0;
|
|
1782
|
-
while (cursor < css.length) {
|
|
1783
|
-
const startIndex = css.indexOf(USER_LAYER_COMPONENTS_START, cursor);
|
|
1784
|
-
if (startIndex === -1) {
|
|
1785
|
-
rest += css.slice(cursor);
|
|
1786
|
-
break;
|
|
1787
|
-
}
|
|
1788
|
-
rest += css.slice(cursor, startIndex);
|
|
1789
|
-
const contentStart = startIndex + 47;
|
|
1790
|
-
const endIndex = css.indexOf(USER_LAYER_COMPONENTS_END, contentStart);
|
|
1791
|
-
if (endIndex === -1) {
|
|
1792
|
-
rest += css.slice(startIndex);
|
|
1793
|
-
break;
|
|
1794
|
-
}
|
|
1795
|
-
const layerCss = css.slice(contentStart, endIndex).trim();
|
|
1796
|
-
if (layerCss) layers.push(layerCss);
|
|
1797
|
-
cursor = endIndex + 45;
|
|
1798
|
-
}
|
|
1799
|
-
return {
|
|
1800
|
-
layers,
|
|
1801
|
-
rest
|
|
1802
|
-
};
|
|
1803
|
-
}
|
|
1804
|
-
function isGeneratedInfrastructureRule(rule) {
|
|
1805
|
-
const declarations = (rule.nodes ?? []).filter((node) => node.type === "decl");
|
|
1806
|
-
if (declarations.length === 0) return false;
|
|
1807
|
-
if (declarations.every((declaration) => declaration.prop.startsWith("--"))) return true;
|
|
1808
|
-
const selectors = (rule.selectors ?? [rule.selector]).map((selector) => selector.trim());
|
|
1809
|
-
if (!(selectors.length > 0 && selectors.every((selector) => selector === "view" || selector === "text" || selector === "::before" || selector === "::after"))) return false;
|
|
1810
|
-
const declarationMap = new Map(declarations.map((declaration) => [declaration.prop, declaration.value]));
|
|
1811
|
-
return declarationMap.get("box-sizing") === "border-box" && declarationMap.has("border");
|
|
1812
|
-
}
|
|
1813
|
-
function findLayerInsertionIndex(css) {
|
|
1814
|
-
try {
|
|
1815
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
1816
|
-
let insertionIndex = -1;
|
|
1817
|
-
root.walkRules((rule) => {
|
|
1818
|
-
if (insertionIndex !== -1 || isGeneratedInfrastructureRule(rule)) return;
|
|
1819
|
-
let topLevelNode = rule;
|
|
1820
|
-
while (topLevelNode.parent && topLevelNode.parent.type !== "root") topLevelNode = topLevelNode.parent;
|
|
1821
|
-
const offset = topLevelNode.source?.start?.offset;
|
|
1822
|
-
if (typeof offset === "number") insertionIndex = css.lastIndexOf("\n", Math.max(0, offset - 1)) + 1;
|
|
1823
|
-
});
|
|
1824
|
-
return insertionIndex;
|
|
1825
|
-
} catch {
|
|
1826
|
-
return -1;
|
|
1827
|
-
}
|
|
1828
|
-
}
|
|
1829
|
-
function reorderMarkedUserLayerComponentsCss(css) {
|
|
1830
|
-
if (!css.includes(USER_LAYER_COMPONENTS_START)) return css;
|
|
1831
|
-
const { layers, rest } = extractMarkedUserLayerComponentsCss(css);
|
|
1832
|
-
if (layers.length === 0) return rest;
|
|
1833
|
-
const layerCss = layers.join("\n");
|
|
1834
|
-
const restWithoutLayerDuplicates = removeExactCssRules(rest, layerCss);
|
|
1835
|
-
const insertionIndex = findLayerInsertionIndex(restWithoutLayerDuplicates);
|
|
1836
|
-
if (insertionIndex === -1) return appendCss(restWithoutLayerDuplicates, layerCss);
|
|
1837
|
-
return appendCss(appendCss(restWithoutLayerDuplicates.slice(0, insertionIndex), layerCss), restWithoutLayerDuplicates.slice(insertionIndex));
|
|
1838
|
-
}
|
|
1839
|
-
function mergeMarkedUserLayerComponentsCss(baseCss, markedCss) {
|
|
1840
|
-
if (!markedCss.includes(USER_LAYER_COMPONENTS_START)) return {
|
|
1841
|
-
css: baseCss,
|
|
1842
|
-
merged: false
|
|
1843
|
-
};
|
|
1844
|
-
const { layers } = extractMarkedUserLayerComponentsCss(markedCss);
|
|
1845
|
-
if (layers.length === 0) return {
|
|
1846
|
-
css: baseCss,
|
|
1847
|
-
merged: false
|
|
1848
|
-
};
|
|
1849
|
-
const layerCss = layers.join("\n");
|
|
1850
|
-
return {
|
|
1851
|
-
css: reorderMarkedUserLayerComponentsCss(appendCss(removeCssRulesForSelectors(baseCss, layerCss), wrapUserLayerComponentsCss(layerCss))),
|
|
1852
|
-
merged: true
|
|
1853
|
-
};
|
|
1405
|
+
//#region src/generation/user-css/apply-only.ts
|
|
1406
|
+
function shouldFilterApplyOnlyGeneratedCss(_majorVersion, target, source, options) {
|
|
1407
|
+
if (!((target === "weapp" || target === "web") && (0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyDirective)(source) && !(0, _weapp_tailwindcss_postcss_transform.hasTailwindRootDirectives)(source) && !options.hasGeneratedCss && !options.hasGeneratedMarkers)) return false;
|
|
1408
|
+
const analysis = (0, _weapp_tailwindcss_postcss_transform.analyzeApplyOnlySource)(source);
|
|
1409
|
+
return analysis.selectors.size > 0 && analysis.onlyApply;
|
|
1854
1410
|
}
|
|
1855
1411
|
//#endregion
|
|
1856
|
-
//#region src/
|
|
1857
|
-
function normalizeUserSource(source) {
|
|
1858
|
-
try {
|
|
1859
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(source);
|
|
1860
|
-
root.walkAtRules("media", (rule) => {
|
|
1861
|
-
if (/^source\(/.test(rule.params)) rule.replaceWith(...rule.nodes ?? []);
|
|
1862
|
-
});
|
|
1863
|
-
return root.toString();
|
|
1864
|
-
} catch {
|
|
1865
|
-
return require_generator.stripUnmatchedTailwindSourceMediaCloseFragments(require_generator.stripTailwindSourceMediaFragments(source));
|
|
1866
|
-
}
|
|
1867
|
-
}
|
|
1412
|
+
//#region src/generation/framework-user-css.ts
|
|
1868
1413
|
async function restoreFrameworkProcessedUserCss(css, generated, source, options, generatorOptions) {
|
|
1414
|
+
const generatedSource = (0, _weapp_tailwindcss_postcss_transform.createGeneratedThemeDeclarationResolver)([generated.metadata?.rawCss, css].filter(Boolean).join("\n"));
|
|
1869
1415
|
const userCssOptions = {
|
|
1416
|
+
compileAuthorCssFunctions: generated.compileAuthorCssFunctions,
|
|
1870
1417
|
generatorTarget: generated.target,
|
|
1418
|
+
generatedSource,
|
|
1871
1419
|
generatorStyleOptions: resolveGeneratorStyleOptions(options.opts, options.cssHandlerOptions, generatorOptions.styleOptions),
|
|
1872
1420
|
cssUserHandlerOptions: options.cssUserHandlerOptions,
|
|
1873
1421
|
styleHandler: options.styleHandler,
|
|
1874
1422
|
importFallback: generatorOptions.importFallback
|
|
1875
1423
|
};
|
|
1876
1424
|
const transform = async (value) => {
|
|
1877
|
-
const parts =
|
|
1878
|
-
const layer = await
|
|
1879
|
-
const rest = await
|
|
1880
|
-
return
|
|
1425
|
+
const parts = (0, _weapp_tailwindcss_postcss_transform.splitUserCssLayerBlocks)(value);
|
|
1426
|
+
const layer = await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)(parts.layer, userCssOptions);
|
|
1427
|
+
const rest = await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)(parts.rest, userCssOptions);
|
|
1428
|
+
return (0, _weapp_tailwindcss_postcss_transform.removeTailwindV4GeneratedUserCssArtifacts)(finalizeMiniProgramGeneratorCss((0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)((0, _weapp_tailwindcss_postcss_transform.wrapUserLayerComponentsCss)(layer), rest), generated.target, options.runtimeState.tailwindRuntime.majorVersion, options.opts.cssPreflight, {
|
|
1881
1429
|
injectPreflight: false,
|
|
1882
1430
|
preservePreflight: generated.metadata?.preflightMode?.preserve,
|
|
1883
1431
|
styleOptions: options.cssHandlerOptions
|
|
1884
|
-
}));
|
|
1885
|
-
};
|
|
1886
|
-
const userSource =
|
|
1887
|
-
const ordered = splitRawSourceByGeneratedCssOrder(userSource, generated.metadata?.rawCss ?? "") ?? {
|
|
1888
|
-
before: "",
|
|
1889
|
-
after: userSource
|
|
1890
|
-
};
|
|
1891
|
-
const
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
//#endregion
|
|
1895
|
-
//#region src/bundlers/shared/generator-css/legacy-selectors.ts
|
|
1896
|
-
const CLASS_SELECTOR_RE = /(?:^|[^\w-])\.[_a-z\u00A0-\uFFFF\\-]/i;
|
|
1897
|
-
const MINI_PROGRAM_THEME_SCOPE_SELECTORS = /* @__PURE__ */ new Set([
|
|
1898
|
-
":host",
|
|
1899
|
-
"page",
|
|
1900
|
-
".tw-root",
|
|
1901
|
-
"wx-root-portal-content"
|
|
1902
|
-
]);
|
|
1903
|
-
const SPECIFICITY_PLACEHOLDER_RE = /:not\(#(?:\\#|n)\)/g;
|
|
1904
|
-
const SELECTOR_CACHE_LIMIT = 64;
|
|
1905
|
-
const LEGACY_PSEUDO_ELEMENTS = [
|
|
1906
|
-
"before",
|
|
1907
|
-
"after",
|
|
1908
|
-
"first-letter",
|
|
1909
|
-
"first-line"
|
|
1910
|
-
];
|
|
1911
|
-
const generatedSelectorCache = /* @__PURE__ */ new Map();
|
|
1912
|
-
function setGeneratedSelectorCache(css, selectors) {
|
|
1913
|
-
if (generatedSelectorCache.size >= SELECTOR_CACHE_LIMIT) {
|
|
1914
|
-
const firstKey = generatedSelectorCache.keys().next().value;
|
|
1915
|
-
if (firstKey !== void 0) generatedSelectorCache.delete(firstKey);
|
|
1916
|
-
}
|
|
1917
|
-
generatedSelectorCache.set(css, selectors);
|
|
1918
|
-
}
|
|
1919
|
-
function normalizeCompatSelector(selector) {
|
|
1920
|
-
return selector.replace(SPECIFICITY_PLACEHOLDER_RE, "").replace(/\s+/g, " ").trim();
|
|
1921
|
-
}
|
|
1922
|
-
function isLegacyPseudoElementAt(selector, index) {
|
|
1923
|
-
for (const name of LEGACY_PSEUDO_ELEMENTS) {
|
|
1924
|
-
if (!selector.startsWith(name, index)) continue;
|
|
1925
|
-
const next = selector[index + name.length];
|
|
1926
|
-
if (next === void 0 || !/[\w-]/.test(next)) return name;
|
|
1927
|
-
}
|
|
1928
|
-
}
|
|
1929
|
-
function normalizeLegacyPseudoElements(selector) {
|
|
1930
|
-
let result = "";
|
|
1931
|
-
let quote;
|
|
1932
|
-
let bracketDepth = 0;
|
|
1933
|
-
let index = 0;
|
|
1934
|
-
while (index < selector.length) {
|
|
1935
|
-
const char = selector[index];
|
|
1936
|
-
if (char === "\\") {
|
|
1937
|
-
result += selector.slice(index, index + 2);
|
|
1938
|
-
index += 2;
|
|
1939
|
-
continue;
|
|
1940
|
-
}
|
|
1941
|
-
if (quote !== void 0) {
|
|
1942
|
-
result += char;
|
|
1943
|
-
if (char === quote) quote = void 0;
|
|
1944
|
-
index += 1;
|
|
1945
|
-
continue;
|
|
1946
|
-
}
|
|
1947
|
-
if (char === "\"" || char === "'") {
|
|
1948
|
-
quote = char;
|
|
1949
|
-
result += char;
|
|
1950
|
-
index += 1;
|
|
1951
|
-
continue;
|
|
1952
|
-
}
|
|
1953
|
-
if (char === "[") {
|
|
1954
|
-
bracketDepth++;
|
|
1955
|
-
result += char;
|
|
1956
|
-
index += 1;
|
|
1957
|
-
continue;
|
|
1958
|
-
}
|
|
1959
|
-
if (char === "]") {
|
|
1960
|
-
bracketDepth = Math.max(0, bracketDepth - 1);
|
|
1961
|
-
result += char;
|
|
1962
|
-
index += 1;
|
|
1963
|
-
continue;
|
|
1964
|
-
}
|
|
1965
|
-
if (bracketDepth === 0 && char === ":" && selector[index + 1] === ":") {
|
|
1966
|
-
result += "::";
|
|
1967
|
-
index += 2;
|
|
1968
|
-
continue;
|
|
1969
|
-
}
|
|
1970
|
-
if (bracketDepth === 0 && char === ":") {
|
|
1971
|
-
const name = isLegacyPseudoElementAt(selector, index + 1);
|
|
1972
|
-
if (name) {
|
|
1973
|
-
result += `::${name}`;
|
|
1974
|
-
index += name.length + 1;
|
|
1975
|
-
continue;
|
|
1976
|
-
}
|
|
1977
|
-
}
|
|
1978
|
-
result += char;
|
|
1979
|
-
index += 1;
|
|
1980
|
-
}
|
|
1981
|
-
return result;
|
|
1982
|
-
}
|
|
1983
|
-
function isClassSelectorTerminator(char) {
|
|
1984
|
-
return /[\s>+~#,.:()[\]]/.test(char);
|
|
1985
|
-
}
|
|
1986
|
-
function unescapeSimpleCssIdent(value) {
|
|
1987
|
-
return value.replaceAll(/\\(.)/g, "$1");
|
|
1988
|
-
}
|
|
1989
|
-
function escapeCompatSelectorClasses(selector) {
|
|
1990
|
-
let result = "";
|
|
1991
|
-
let index = 0;
|
|
1992
|
-
let changed = false;
|
|
1993
|
-
while (index < selector.length) {
|
|
1994
|
-
const char = selector[index];
|
|
1995
|
-
if (char !== ".") {
|
|
1996
|
-
result += char;
|
|
1997
|
-
index += 1;
|
|
1998
|
-
continue;
|
|
1999
|
-
}
|
|
2000
|
-
let end = index + 1;
|
|
2001
|
-
let className = "";
|
|
2002
|
-
while (end < selector.length) {
|
|
2003
|
-
const current = selector[end];
|
|
2004
|
-
if (current === void 0) break;
|
|
2005
|
-
if (current === "\\" && end + 1 < selector.length) {
|
|
2006
|
-
const escaped = selector[end + 1];
|
|
2007
|
-
if (escaped === void 0) break;
|
|
2008
|
-
className += current + escaped;
|
|
2009
|
-
end += 2;
|
|
2010
|
-
continue;
|
|
2011
|
-
}
|
|
2012
|
-
if (isClassSelectorTerminator(current)) break;
|
|
2013
|
-
className += current;
|
|
2014
|
-
end += 1;
|
|
2015
|
-
}
|
|
2016
|
-
if (className.includes("\\")) {
|
|
2017
|
-
result += `.${require_compiler.replaceWxml(unescapeSimpleCssIdent(className))}`;
|
|
2018
|
-
changed = true;
|
|
2019
|
-
} else result += `.${className}`;
|
|
2020
|
-
index = end;
|
|
2021
|
-
}
|
|
2022
|
-
return changed ? result : selector;
|
|
2023
|
-
}
|
|
2024
|
-
function normalizeCompatSelectors(selector) {
|
|
2025
|
-
const normalized = normalizeCompatSelector(selector);
|
|
2026
|
-
if (!normalized) return [];
|
|
2027
|
-
const selectors = /* @__PURE__ */ new Set([normalized]);
|
|
2028
|
-
const escaped = normalizeCompatSelector(escapeCompatSelectorClasses(normalized));
|
|
2029
|
-
if (escaped) selectors.add(escaped);
|
|
2030
|
-
return [...selectors];
|
|
2031
|
-
}
|
|
2032
|
-
function normalizeCssSelector(selector) {
|
|
2033
|
-
return normalizeLegacyPseudoElements(selector).trim().replace(/\s+/g, "");
|
|
2034
|
-
}
|
|
2035
|
-
function getCompatSelectorKeys(selector) {
|
|
2036
|
-
return normalizeCompatSelectors(selector).map(normalizeCssSelector);
|
|
2037
|
-
}
|
|
2038
|
-
function getRuleCompatSelectorKeys(rule) {
|
|
2039
|
-
return (rule.selectors?.length ? rule.selectors : [rule.selector]).flatMap((selector) => getCompatSelectorKeys(selector));
|
|
2040
|
-
}
|
|
2041
|
-
function hasClassSelector(selector) {
|
|
2042
|
-
return CLASS_SELECTOR_RE.test(selector);
|
|
2043
|
-
}
|
|
2044
|
-
function getNormalizedSelectorList(selector) {
|
|
2045
|
-
return selector.split(",").map(normalizeCssSelector).filter(Boolean);
|
|
2046
|
-
}
|
|
2047
|
-
function isMiniProgramThemeScopeSelector(selector) {
|
|
2048
|
-
const selectors = getNormalizedSelectorList(selector);
|
|
2049
|
-
return selectors.length > 0 && selectors.every((item) => MINI_PROGRAM_THEME_SCOPE_SELECTORS.has(item));
|
|
2050
|
-
}
|
|
2051
|
-
function hasUtilityClassSelector(selector) {
|
|
2052
|
-
return hasClassSelector(selector) && !isMiniProgramThemeScopeSelector(selector);
|
|
2053
|
-
}
|
|
2054
|
-
function isCustomPropertyOnlyRule(rule) {
|
|
2055
|
-
let hasDeclaration = false;
|
|
2056
|
-
let allCustomProperties = true;
|
|
2057
|
-
rule.each((node) => {
|
|
2058
|
-
if (node.type !== "decl") return;
|
|
2059
|
-
hasDeclaration = true;
|
|
2060
|
-
if (!node.prop.startsWith("--")) allCustomProperties = false;
|
|
2061
|
-
});
|
|
2062
|
-
return hasDeclaration && allCustomProperties;
|
|
2063
|
-
}
|
|
2064
|
-
function isPseudoContentInitRule(rule) {
|
|
2065
|
-
let hasDeclaration = false;
|
|
2066
|
-
let onlyContentVariable = true;
|
|
2067
|
-
rule.each((node) => {
|
|
2068
|
-
if (node.type !== "decl") return;
|
|
2069
|
-
hasDeclaration = true;
|
|
2070
|
-
if (node.prop !== "--tw-content") onlyContentVariable = false;
|
|
2071
|
-
});
|
|
2072
|
-
return hasDeclaration && onlyContentVariable;
|
|
2073
|
-
}
|
|
2074
|
-
function collectGeneratedSelectors(css) {
|
|
2075
|
-
const cached = generatedSelectorCache.get(css);
|
|
2076
|
-
if (cached) return cached;
|
|
2077
|
-
const selectors = /* @__PURE__ */ new Set();
|
|
2078
|
-
try {
|
|
2079
|
-
_weapp_tailwindcss_postcss.postcss.parse(css).walkRules((rule) => {
|
|
2080
|
-
if (isCustomPropertyOnlyRule(rule) && !isPseudoContentInitRule(rule) && !hasUtilityClassSelector(rule.selector)) return;
|
|
2081
|
-
for (const selector of getRuleCompatSelectorKeys(rule)) selectors.add(selector);
|
|
2082
|
-
});
|
|
2083
|
-
} catch {
|
|
2084
|
-
return selectors;
|
|
2085
|
-
}
|
|
2086
|
-
setGeneratedSelectorCache(css, selectors);
|
|
2087
|
-
return selectors;
|
|
2088
|
-
}
|
|
2089
|
-
function collectGeneratedDeclarationPropsBySelector(generatedCss, selectors) {
|
|
2090
|
-
const propsBySelector = /* @__PURE__ */ new Map();
|
|
2091
|
-
try {
|
|
2092
|
-
_weapp_tailwindcss_postcss.postcss.parse(generatedCss).walkRules((rule) => {
|
|
2093
|
-
const matchedSelectors = getRuleCompatSelectorKeys(rule).filter((selector) => selectors.has(selector));
|
|
2094
|
-
if (matchedSelectors.length === 0) return;
|
|
2095
|
-
const props = /* @__PURE__ */ new Set();
|
|
2096
|
-
rule.walkDecls((decl) => {
|
|
2097
|
-
props.add(decl.prop);
|
|
2098
|
-
});
|
|
2099
|
-
for (const selector of matchedSelectors) {
|
|
2100
|
-
const existing = propsBySelector.get(selector);
|
|
2101
|
-
if (existing) for (const prop of props) existing.add(prop);
|
|
2102
|
-
else propsBySelector.set(selector, new Set(props));
|
|
2103
|
-
}
|
|
2104
|
-
});
|
|
2105
|
-
} catch {
|
|
2106
|
-
return propsBySelector;
|
|
2107
|
-
}
|
|
2108
|
-
return propsBySelector;
|
|
2109
|
-
}
|
|
2110
|
-
function isRuleCoveredByGeneratedProps(rule, generatedDeclarationPropsBySelector) {
|
|
2111
|
-
const nodeSelectors = getRuleCompatSelectorKeys(rule);
|
|
2112
|
-
if (nodeSelectors.length === 0) return false;
|
|
2113
|
-
const props = /* @__PURE__ */ new Set();
|
|
2114
|
-
rule.walkDecls((decl) => {
|
|
2115
|
-
props.add(decl.prop);
|
|
2116
|
-
});
|
|
2117
|
-
if (props.size === 0) return false;
|
|
2118
|
-
for (const selector of nodeSelectors) {
|
|
2119
|
-
const generatedProps = generatedDeclarationPropsBySelector.get(selector);
|
|
2120
|
-
if (!generatedProps) continue;
|
|
2121
|
-
if ([...props].every((prop) => generatedProps.has(prop))) return true;
|
|
2122
|
-
}
|
|
2123
|
-
return false;
|
|
2124
|
-
}
|
|
2125
|
-
function removeGeneratedSelectorCompatCss(css, generatedCss) {
|
|
2126
|
-
const generatedSelectors = collectGeneratedSelectors(generatedCss);
|
|
2127
|
-
if (generatedSelectors.size === 0) return css;
|
|
2128
|
-
try {
|
|
2129
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
2130
|
-
let removed = false;
|
|
2131
|
-
root.walkRules((rule) => {
|
|
2132
|
-
if (isPseudoContentInitRule(rule)) {
|
|
2133
|
-
rule.remove();
|
|
2134
|
-
removed = true;
|
|
2135
|
-
return;
|
|
2136
|
-
}
|
|
2137
|
-
if (isCustomPropertyOnlyRule(rule) && !isPseudoContentInitRule(rule) && !hasUtilityClassSelector(rule.selector)) return;
|
|
2138
|
-
if (getRuleCompatSelectorKeys(rule).some((selector) => generatedSelectors.has(selector))) {
|
|
2139
|
-
rule.remove();
|
|
2140
|
-
removed = true;
|
|
2141
|
-
}
|
|
2142
|
-
});
|
|
2143
|
-
root.walkAtRules((atRule) => {
|
|
2144
|
-
if (atRule.nodes && atRule.nodes.length === 0) atRule.remove();
|
|
2145
|
-
});
|
|
2146
|
-
return removed ? root.toString() : css;
|
|
2147
|
-
} catch {
|
|
2148
|
-
return css;
|
|
2149
|
-
}
|
|
2150
|
-
}
|
|
2151
|
-
function collectDedupedPostTransformCompatCss(css, generatedCss) {
|
|
2152
|
-
const generatedSelectors = collectGeneratedSelectors(generatedCss);
|
|
2153
|
-
if (generatedSelectors.size === 0) return css;
|
|
2154
|
-
const generatedDeclarationPropsBySelector = collectGeneratedDeclarationPropsBySelector(generatedCss, generatedSelectors);
|
|
2155
|
-
const preservedNodes = [];
|
|
2156
|
-
try {
|
|
2157
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
2158
|
-
root.each((node) => {
|
|
2159
|
-
if (node.type === "rule") {
|
|
2160
|
-
const nodeSelectors = getRuleCompatSelectorKeys(node);
|
|
2161
|
-
if (!nodeSelectors.some((selector) => generatedSelectors.has(selector))) {
|
|
2162
|
-
preservedNodes.push(node.clone());
|
|
2163
|
-
return;
|
|
2164
|
-
}
|
|
2165
|
-
if (isRuleCoveredByGeneratedProps(node, generatedDeclarationPropsBySelector)) return;
|
|
2166
|
-
if (isCustomPropertyOnlyRule(node) && !isPseudoContentInitRule(node) && !hasUtilityClassSelector(node.selector)) {
|
|
2167
|
-
const declarationProps = /* @__PURE__ */ new Set();
|
|
2168
|
-
node.walkDecls((decl) => {
|
|
2169
|
-
declarationProps.add(decl.prop);
|
|
2170
|
-
});
|
|
2171
|
-
for (const selector of nodeSelectors) {
|
|
2172
|
-
const generatedProps = generatedDeclarationPropsBySelector.get(selector);
|
|
2173
|
-
if (!generatedProps) continue;
|
|
2174
|
-
for (const prop of generatedProps) declarationProps.delete(prop);
|
|
2175
|
-
}
|
|
2176
|
-
const nextRule = node.clone();
|
|
2177
|
-
nextRule.walkDecls((decl) => {
|
|
2178
|
-
if (!declarationProps.has(decl.prop)) decl.remove();
|
|
2179
|
-
});
|
|
2180
|
-
if (nextRule.nodes.length > 0) preservedNodes.push(nextRule);
|
|
2181
|
-
}
|
|
2182
|
-
return;
|
|
2183
|
-
}
|
|
2184
|
-
preservedNodes.push(node.clone());
|
|
2185
|
-
});
|
|
2186
|
-
if (preservedNodes.length === root.nodes.length) return css;
|
|
2187
|
-
const nextRoot = _weapp_tailwindcss_postcss.postcss.root();
|
|
2188
|
-
nextRoot.append(preservedNodes);
|
|
2189
|
-
return nextRoot.toString();
|
|
2190
|
-
} catch {
|
|
2191
|
-
return css;
|
|
2192
|
-
}
|
|
2193
|
-
}
|
|
2194
|
-
function removeDuplicatedViteMarkers(css, baseCss) {
|
|
2195
|
-
if (!require_generator.VITE_MARKER_RE.test(baseCss)) return css;
|
|
2196
|
-
require_generator.VITE_MARKER_RE.lastIndex = 0;
|
|
2197
|
-
return css.replace(require_generator.VITE_MARKER_RE, "");
|
|
1432
|
+
}), generatedSource);
|
|
1433
|
+
};
|
|
1434
|
+
const userSource = (0, _weapp_tailwindcss_postcss_transform.normalizeFrameworkProcessedUserCss)(source);
|
|
1435
|
+
const ordered = splitRawSourceByGeneratedCssOrder(userSource, generated.metadata?.rawCss ?? "") ?? {
|
|
1436
|
+
before: "",
|
|
1437
|
+
after: userSource
|
|
1438
|
+
};
|
|
1439
|
+
const before = await transform(ordered.before);
|
|
1440
|
+
const after = await transform(ordered.after);
|
|
1441
|
+
return (0, _weapp_tailwindcss_postcss_transform.stripTailwindBanners)((0, _weapp_tailwindcss_postcss_transform.reorderMarkedUserLayerComponentsCss)((0, _weapp_tailwindcss_postcss_transform.composeFrameworkProcessedCss)(before, css, after)));
|
|
2198
1442
|
}
|
|
2199
1443
|
//#endregion
|
|
2200
|
-
//#region src/
|
|
1444
|
+
//#region src/generation/source-resolver/metadata.ts
|
|
2201
1445
|
const generatorSourceMetadataKey = Symbol.for("weapp-tailwindcss.generator-source-metadata");
|
|
2202
1446
|
function getGeneratorSourceMetadata(source) {
|
|
2203
1447
|
return source[generatorSourceMetadataKey];
|
|
@@ -2225,7 +1469,7 @@ function withMatchedSourceSideMetadata(source, resolvedEntrySource, metadata = {
|
|
|
2225
1469
|
}) : source;
|
|
2226
1470
|
}
|
|
2227
1471
|
//#endregion
|
|
2228
|
-
//#region src/
|
|
1472
|
+
//#region src/generation/source-files.ts
|
|
2229
1473
|
const SFC_STYLE_BLOCK_RE = /<style\b[^>]*>([\s\S]*?)<\/style>/gi;
|
|
2230
1474
|
const STYLE_IMPORT_EXTENSIONS = [
|
|
2231
1475
|
".css",
|
|
@@ -2338,11 +1582,11 @@ function extractStyleDirectiveSources(source) {
|
|
|
2338
1582
|
let match = SFC_STYLE_BLOCK_RE.exec(source);
|
|
2339
1583
|
while (match !== null) {
|
|
2340
1584
|
const styleSource = match[1] ?? "";
|
|
2341
|
-
if (
|
|
1585
|
+
if ((0, _weapp_tailwindcss_postcss_transform.hasTailwindSourceDirectives)(styleSource, { importFallback: true })) styleSources.push(styleSource);
|
|
2342
1586
|
match = SFC_STYLE_BLOCK_RE.exec(source);
|
|
2343
1587
|
}
|
|
2344
1588
|
if (styleSources.length > 0) return styleSources;
|
|
2345
|
-
return
|
|
1589
|
+
return (0, _weapp_tailwindcss_postcss_transform.hasTailwindSourceDirectives)(source, { importFallback: true }) ? [source] : [];
|
|
2346
1590
|
}
|
|
2347
1591
|
function extractSfcStyleSources(source) {
|
|
2348
1592
|
const styleSources = [];
|
|
@@ -2371,8 +1615,8 @@ function collectLocalStyleImportFiles(source, base) {
|
|
|
2371
1615
|
const sources = extractSfcStyleSources(source);
|
|
2372
1616
|
if (sources.length === 0) sources.push(source);
|
|
2373
1617
|
for (const styleSource of sources) try {
|
|
2374
|
-
|
|
2375
|
-
const request =
|
|
1618
|
+
_weapp_tailwindcss_postcss_transform.postcss.parse(styleSource).walkAtRules("import", (rule) => {
|
|
1619
|
+
const request = (0, _weapp_tailwindcss_postcss_transform.parseImportRequest)(rule.params);
|
|
2376
1620
|
if (!isLocalStyleImportRequest(request)) return;
|
|
2377
1621
|
const file = request ? resolveLocalStyleImportFile(request, base) : void 0;
|
|
2378
1622
|
if (file) files.push(file);
|
|
@@ -2382,7 +1626,7 @@ function collectLocalStyleImportFiles(source, base) {
|
|
|
2382
1626
|
}
|
|
2383
1627
|
function extractStyleDirectiveSourcesDeep(source, sourceFile, seen) {
|
|
2384
1628
|
const ownSources = extractStyleDirectiveSources(source);
|
|
2385
|
-
if (ownSources.some((styleSource) =>
|
|
1629
|
+
if (ownSources.some((styleSource) => (0, _weapp_tailwindcss_postcss_transform.hasTailwindRootDirectives)(styleSource, { importFallback: true }))) return ownSources.map((styleSource) => ({
|
|
2386
1630
|
source: styleSource,
|
|
2387
1631
|
file: sourceFile
|
|
2388
1632
|
}));
|
|
@@ -2408,7 +1652,7 @@ function resolveSourceSideCssEntrySource(file, sourceOptions, resolveOptions = {
|
|
|
2408
1652
|
if (source === void 0) continue;
|
|
2409
1653
|
const directiveSources = extractStyleDirectiveSourcesDeep(source, sourceFile, /* @__PURE__ */ new Set([node_path.default.resolve(sourceFile)]));
|
|
2410
1654
|
for (const styleSource of directiveSources) {
|
|
2411
|
-
const cssEntrySource =
|
|
1655
|
+
const cssEntrySource = (0, _weapp_tailwindcss_postcss_transform.resolveCssEntrySource)(styleSource.source, node_path.default.dirname(styleSource.file), resolveOptions);
|
|
2412
1656
|
if (cssEntrySource) return {
|
|
2413
1657
|
...cssEntrySource,
|
|
2414
1658
|
file: styleSource.file
|
|
@@ -2419,95 +1663,18 @@ function resolveSourceSideCssEntrySource(file, sourceOptions, resolveOptions = {
|
|
|
2419
1663
|
}
|
|
2420
1664
|
}
|
|
2421
1665
|
//#endregion
|
|
2422
|
-
//#region src/
|
|
2423
|
-
function parseGeneratorCss(css) {
|
|
2424
|
-
let root;
|
|
2425
|
-
try {
|
|
2426
|
-
root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
2427
|
-
} catch {
|
|
2428
|
-
return;
|
|
2429
|
-
}
|
|
2430
|
-
return root;
|
|
2431
|
-
}
|
|
2432
|
-
function collectApplyCandidates(root) {
|
|
2433
|
-
const candidates = /* @__PURE__ */ new Set();
|
|
2434
|
-
root.walkAtRules("apply", (rule) => {
|
|
2435
|
-
for (const candidate of (0, _tailwindcss_mangle_engine.splitCandidateTokens)(rule.params)) candidates.add(candidate);
|
|
2436
|
-
});
|
|
2437
|
-
return candidates;
|
|
2438
|
-
}
|
|
2439
|
-
function collectCssApplyCandidates(css) {
|
|
2440
|
-
const root = parseGeneratorCss(css);
|
|
2441
|
-
return root ? [...collectApplyCandidates(root)].sort() : [];
|
|
2442
|
-
}
|
|
2443
|
-
function collectGeneratorCssCandidates(css) {
|
|
2444
|
-
const root = parseGeneratorCss(css);
|
|
2445
|
-
if (!root) return [];
|
|
2446
|
-
const candidates = collectApplyCandidates(root);
|
|
2447
|
-
const inlineCandidates = require_tailwindcss.collectCssInlineSourceCandidates(root);
|
|
2448
|
-
for (const candidate of inlineCandidates.included) candidates.add(candidate);
|
|
2449
|
-
for (const candidate of inlineCandidates.excluded) candidates.delete(candidate);
|
|
2450
|
-
return [...candidates].sort();
|
|
2451
|
-
}
|
|
2452
|
-
//#endregion
|
|
2453
|
-
//#region src/bundlers/shared/generator-css/source-resolver/apply-reference.ts
|
|
1666
|
+
//#region src/generation/source-resolver/apply-reference.ts
|
|
2454
1667
|
function resolveTailwindV4ApplyReference(options) {
|
|
2455
1668
|
const references = /* @__PURE__ */ new Set();
|
|
2456
|
-
for (const source of options.cssSources ?? []) if (typeof source.file === "string" && source.file.length > 0 && typeof source.css === "string" &&
|
|
1669
|
+
for (const source of options.cssSources ?? []) if (typeof source.file === "string" && source.file.length > 0 && typeof source.css === "string" && (0, _weapp_tailwindcss_postcss_transform.hasTailwindRootDirectives)(source.css, { importFallback: true }) && (0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyContextDirective)(source.css)) references.add(source.file);
|
|
2457
1670
|
return references.size === 1 ? references.values().next().value : void 0;
|
|
2458
1671
|
}
|
|
2459
|
-
function hasTailwindApplyContextDirective(css) {
|
|
2460
|
-
try {
|
|
2461
|
-
let found = false;
|
|
2462
|
-
_weapp_tailwindcss_postcss.postcss.parse(css).walkAtRules((rule) => {
|
|
2463
|
-
if (rule.name === "theme" || rule.name === "config") {
|
|
2464
|
-
found = true;
|
|
2465
|
-
return false;
|
|
2466
|
-
}
|
|
2467
|
-
});
|
|
2468
|
-
return found;
|
|
2469
|
-
} catch {
|
|
2470
|
-
return false;
|
|
2471
|
-
}
|
|
2472
|
-
}
|
|
2473
1672
|
function createTailwindV4ApplyReferenceSource(css, sourceOptions) {
|
|
2474
1673
|
const reference = resolveTailwindV4ApplyReference(sourceOptions);
|
|
2475
|
-
return createTailwindV4SourceReferenceSource(css, sourceOptions, reference ? `@reference ${JSON.stringify(reference.replace(/\\/g, "/"))};` : void 0);
|
|
2476
|
-
}
|
|
2477
|
-
function createTailwindV4SourceReferenceSource(css, sourceOptions, referenceDirective) {
|
|
2478
|
-
if (hasTailwindV4RootImport(css, sourceOptions)) return css;
|
|
2479
|
-
const hasApplyDirective = require_generator.hasTailwindApplyDirective(css);
|
|
2480
|
-
if (!hasApplyDirective && !require_generator.hasTailwindSourceDirectives(css, { importFallback: true })) return css;
|
|
2481
|
-
const utilities = hasApplyDirective ? collectCssApplyCandidates(css) : [];
|
|
2482
|
-
return [
|
|
2483
|
-
referenceDirective ?? `@import "${sourceOptions.packageName ?? "tailwindcss"}" source(none);`,
|
|
2484
|
-
utilities.length > 0 ? `@source inline(${JSON.stringify(utilities.join(" "))});` : void 0,
|
|
2485
|
-
css
|
|
2486
|
-
].filter(Boolean).join("\n");
|
|
2487
|
-
}
|
|
2488
|
-
function hasTailwindV4RootImport(css, sourceOptions) {
|
|
2489
|
-
try {
|
|
2490
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
2491
|
-
let found = false;
|
|
2492
|
-
root.walkAtRules((rule) => {
|
|
2493
|
-
if (rule.name === "tailwind") {
|
|
2494
|
-
found = true;
|
|
2495
|
-
return false;
|
|
2496
|
-
}
|
|
2497
|
-
if (rule.name !== "import" && rule.name !== "use" && rule.name !== "forward") return;
|
|
2498
|
-
const request = require_generator.parseImportRequest(rule.params);
|
|
2499
|
-
if (request === (sourceOptions.packageName ?? "tailwindcss") || request === "tailwindcss" || request === "tailwindcss4" || request?.startsWith("tailwindcss/") || request?.startsWith("tailwindcss4/")) {
|
|
2500
|
-
found = true;
|
|
2501
|
-
return false;
|
|
2502
|
-
}
|
|
2503
|
-
});
|
|
2504
|
-
return found;
|
|
2505
|
-
} catch {
|
|
2506
|
-
return /@(?:import|use|forward|tailwind)(?:[\s"'(;]|$)/.test(css) && (css.includes("tailwindcss") || css.includes("tailwindcss4") || css.includes("weapp-tailwindcss"));
|
|
2507
|
-
}
|
|
1674
|
+
return (0, _weapp_tailwindcss_postcss_transform.createTailwindV4SourceReferenceSource)(css, sourceOptions, reference ? `@reference ${JSON.stringify(reference.replace(/\\/g, "/"))};` : void 0);
|
|
2508
1675
|
}
|
|
2509
1676
|
//#endregion
|
|
2510
|
-
//#region src/
|
|
1677
|
+
//#region src/generation/source-resolver/config.ts
|
|
2511
1678
|
function resolveExistingConfigPath(config, configRequest, file, sourceOptions) {
|
|
2512
1679
|
if (config && (0, node_fs.existsSync)(config)) return config;
|
|
2513
1680
|
if (!configRequest || node_path.default.isAbsolute(configRequest)) return sourceOptions.config;
|
|
@@ -2535,9 +1702,9 @@ function resolveExistingConfigPath(config, configRequest, file, sourceOptions) {
|
|
|
2535
1702
|
return sourceOptions.config;
|
|
2536
1703
|
}
|
|
2537
1704
|
//#endregion
|
|
2538
|
-
//#region src/
|
|
1705
|
+
//#region src/generation/source-resolver/matching.ts
|
|
2539
1706
|
function normalizeCssSourceForCompare(css) {
|
|
2540
|
-
return
|
|
1707
|
+
return (0, _weapp_tailwindcss_postcss_transform.stripGeneratorPlaceholderMarkers)((0, _weapp_tailwindcss_postcss_transform.stripTailwindBanners)(css)).trim();
|
|
2541
1708
|
}
|
|
2542
1709
|
function getOutputFileWithoutExtension(file) {
|
|
2543
1710
|
const normalized = file.replace(/[?#].*$/, "");
|
|
@@ -2609,7 +1776,7 @@ function scoreTailwindV4CssSourceFileMatch(file, cssSourceFile, sourceOptions) {
|
|
|
2609
1776
|
return bestScore;
|
|
2610
1777
|
}
|
|
2611
1778
|
//#endregion
|
|
2612
|
-
//#region src/
|
|
1779
|
+
//#region src/generation/source-resolver/configuration.ts
|
|
2613
1780
|
function createCssEntrySources(cssEntries) {
|
|
2614
1781
|
return cssEntries?.filter((entry) => typeof entry === "string" && entry.length > 0 && node_path.default.isAbsolute(entry)).map((entry) => ({ file: node_path.default.resolve(entry) }));
|
|
2615
1782
|
}
|
|
@@ -2636,7 +1803,7 @@ function resolveUniqueTailwindV4CssConfig(sourceOptions) {
|
|
|
2636
1803
|
const configs = /* @__PURE__ */ new Set();
|
|
2637
1804
|
const collect = (css, base) => {
|
|
2638
1805
|
if (!css || !base || !css.includes("@config")) return;
|
|
2639
|
-
const source =
|
|
1806
|
+
const source = (0, _weapp_tailwindcss_postcss_transform.resolveCssEntrySource)(css, base, { removeConfig: false });
|
|
2640
1807
|
if (source?.config) configs.add(node_path.default.resolve(source.config));
|
|
2641
1808
|
};
|
|
2642
1809
|
collect(sourceOptions.css, sourceOptions.base ?? sourceOptions.projectRoot);
|
|
@@ -2669,7 +1836,7 @@ async function resolveTailwindV4CssEntrySource(cssEntry, sourceOptions, options
|
|
|
2669
1836
|
});
|
|
2670
1837
|
const css = (0, node_fs.readFileSync)(cssEntry, "utf8");
|
|
2671
1838
|
const base = node_path.default.dirname(node_path.default.resolve(cssEntry));
|
|
2672
|
-
const entrySource =
|
|
1839
|
+
const entrySource = (0, _weapp_tailwindcss_postcss_transform.resolveCssEntrySource)(css, base, { removeConfig: false });
|
|
2673
1840
|
const config = resolveExistingConfigPath(entrySource?.config, entrySource?.configRequest, cssEntry, {
|
|
2674
1841
|
...sourceOptions,
|
|
2675
1842
|
sourceFile: sourceOptions.sourceFile ?? cssEntry
|
|
@@ -2677,7 +1844,7 @@ async function resolveTailwindV4CssEntrySource(cssEntry, sourceOptions, options
|
|
|
2677
1844
|
return withGeneratorSourceMetadata(await require_generator.resolveTailwindV4Source({
|
|
2678
1845
|
...require_generator.omitUndefined(singleEntrySourceOptions),
|
|
2679
1846
|
base,
|
|
2680
|
-
css:
|
|
1847
|
+
css: (0, _weapp_tailwindcss_postcss_transform.normalizeConfigDirective)(css, config),
|
|
2681
1848
|
cssEntries: [cssEntry]
|
|
2682
1849
|
}), {
|
|
2683
1850
|
candidateMatchedCssSource: options.candidateMatched,
|
|
@@ -2695,24 +1862,24 @@ function canResolveSourceSideCssEntry(file, cssHandlerOptions, sourceOptions) {
|
|
|
2695
1862
|
return true;
|
|
2696
1863
|
}
|
|
2697
1864
|
function shouldResolveSourceSideCssEntry(rawSource) {
|
|
2698
|
-
return rawSource.includes("@apply") ||
|
|
1865
|
+
return rawSource.includes("@apply") || (0, _weapp_tailwindcss_postcss_transform.hasTailwindRootDirectives)(rawSource, { importFallback: true }) || (0, _weapp_tailwindcss_postcss_transform.hasTailwindSourceDirectives)(rawSource, { importFallback: true }) || (0, _weapp_tailwindcss_postcss_transform.hasTailwindGeneratedCss)(rawSource) || (0, _weapp_tailwindcss_postcss_transform.hasTailwindGeneratedCssMarkers)(rawSource);
|
|
2699
1866
|
}
|
|
2700
1867
|
function normalizeTailwindV4CssSourceConfig(cssSource, sourceBase) {
|
|
2701
1868
|
if (typeof cssSource.css !== "string" || cssSource.css.length === 0 || !cssSource.css.includes("@config")) return cssSource;
|
|
2702
|
-
const entrySource =
|
|
1869
|
+
const entrySource = (0, _weapp_tailwindcss_postcss_transform.resolveCssEntrySource)(cssSource.css, sourceBase, { removeConfig: false });
|
|
2703
1870
|
if (!entrySource?.config) return cssSource;
|
|
2704
1871
|
return {
|
|
2705
1872
|
...cssSource,
|
|
2706
|
-
css:
|
|
1873
|
+
css: (0, _weapp_tailwindcss_postcss_transform.normalizeConfigDirective)(cssSource.css, entrySource.config)
|
|
2707
1874
|
};
|
|
2708
1875
|
}
|
|
2709
1876
|
function normalizeResolvedTailwindV4SourceConfig(source, file, sourceOptions) {
|
|
2710
1877
|
if (!("css" in source) || typeof source.css !== "string" || !source.css.includes("@config")) return source;
|
|
2711
1878
|
const sourceFile = typeof file === "string" && file.length > 0 ? file : getGeneratorSourceMetadata(source)?.matchedCssSourceFile;
|
|
2712
1879
|
if (!sourceFile) return source;
|
|
2713
|
-
const entrySource =
|
|
1880
|
+
const entrySource = (0, _weapp_tailwindcss_postcss_transform.resolveCssEntrySource)(source.css, node_path.default.dirname(node_path.default.resolve(sourceFile)), { removeConfig: false });
|
|
2714
1881
|
const config = resolveExistingConfigPath(entrySource?.config, entrySource?.configRequest, sourceFile, sourceOptions ?? {});
|
|
2715
|
-
const normalizedCss =
|
|
1882
|
+
const normalizedCss = (0, _weapp_tailwindcss_postcss_transform.normalizeConfigDirective)(source.css, config);
|
|
2716
1883
|
return normalizedCss === source.css ? source : {
|
|
2717
1884
|
...source,
|
|
2718
1885
|
css: normalizedCss
|
|
@@ -2736,7 +1903,7 @@ function normalizeTailwindV4CssSourceConfigs(sourceOptions) {
|
|
|
2736
1903
|
let changed = false;
|
|
2737
1904
|
const cssSources = sourceOptions.cssSources.map((cssSource) => {
|
|
2738
1905
|
const hydratedCssSource = hydrateTailwindV4CssSource(cssSource);
|
|
2739
|
-
const normalizedCssSource = normalizeTailwindV4CssSourceConfig(hydratedCssSource,
|
|
1906
|
+
const normalizedCssSource = normalizeTailwindV4CssSourceConfig(hydratedCssSource, require_tailwindcss.resolveTailwindV4CssSourceBase(hydratedCssSource, sourceBaseFallback));
|
|
2740
1907
|
changed || (changed = normalizedCssSource !== cssSource);
|
|
2741
1908
|
return normalizedCssSource;
|
|
2742
1909
|
});
|
|
@@ -2761,10 +1928,10 @@ function isSameTailwindV4CssSource(a, b) {
|
|
|
2761
1928
|
return typeof a.css === "string" && typeof b.css === "string" && normalizeCssSourceForCompare(a.css) === normalizeCssSourceForCompare(b.css);
|
|
2762
1929
|
}
|
|
2763
1930
|
//#endregion
|
|
2764
|
-
//#region src/
|
|
1931
|
+
//#region src/generation/source-resolver/single-source.ts
|
|
2765
1932
|
async function resolveSingleTailwindV4CssSource(cssSource, sourceOptions, options = {}) {
|
|
2766
1933
|
const sourceBaseFallback = sourceOptions.base ?? sourceOptions.projectRoot ?? node_process.default.cwd();
|
|
2767
|
-
const sourceBase =
|
|
1934
|
+
const sourceBase = require_tailwindcss.resolveTailwindV4CssSourceBase(cssSource, sourceBaseFallback);
|
|
2768
1935
|
const normalizedCssSource = normalizeTailwindV4CssSourceConfig(cssSource, sourceBase);
|
|
2769
1936
|
const source = await require_generator.resolveTailwindV4Source(createSingleTailwindV4SourceOptions(sourceOptions, {
|
|
2770
1937
|
base: sourceBase,
|
|
@@ -2783,7 +1950,7 @@ async function resolveSingleTailwindV4CssSource(cssSource, sourceOptions, option
|
|
|
2783
1950
|
async function resolveTailwindV4CssSourceEntries(cssSource, sourceOptions) {
|
|
2784
1951
|
if (typeof cssSource.css !== "string" || cssSource.css.length === 0) return;
|
|
2785
1952
|
const sourceBaseFallback = sourceOptions.base ?? sourceOptions.projectRoot ?? node_process.default.cwd();
|
|
2786
|
-
const sourceBase =
|
|
1953
|
+
const sourceBase = require_tailwindcss.resolveTailwindV4CssSourceBase(cssSource, sourceBaseFallback);
|
|
2787
1954
|
return require_tailwindcss.resolveTailwindV4EntriesFromCss(cssSource.css, sourceBase);
|
|
2788
1955
|
}
|
|
2789
1956
|
function countRuntimeCandidateHits(candidates, runtime) {
|
|
@@ -2866,7 +2033,7 @@ async function resolveCandidateMatchedTailwindV4CssEntry(sourceOptions, selectio
|
|
|
2866
2033
|
function createTailwindV4CssSourceResolver(sourceOptions, generatorOptions) {
|
|
2867
2034
|
return (cssSource, index) => resolveSingleTailwindV4CssSource(cssSource, sourceOptions, { index }).then((source) => generatorOptions?.config ? {
|
|
2868
2035
|
...source,
|
|
2869
|
-
css:
|
|
2036
|
+
css: (0, _weapp_tailwindcss_postcss_transform.prependConfigDirective)(source.css, generatorOptions.config)
|
|
2870
2037
|
} : source);
|
|
2871
2038
|
}
|
|
2872
2039
|
async function resolveTailwindV4SourceSideEntrySource(resolvedEntrySource, sourceOptions, generatorOptions, file, currentCss) {
|
|
@@ -2876,7 +2043,7 @@ async function resolveTailwindV4SourceSideEntrySource(resolvedEntrySource, sourc
|
|
|
2876
2043
|
...resolvedSourceOptions,
|
|
2877
2044
|
sourceFile: resolvedEntrySource.file
|
|
2878
2045
|
});
|
|
2879
|
-
const css = createTailwindV4SourceReferenceSource(
|
|
2046
|
+
const css = (0, _weapp_tailwindcss_postcss_transform.createTailwindV4SourceReferenceSource)((0, _weapp_tailwindcss_postcss_transform.normalizeConfigDirective)((0, _weapp_tailwindcss_postcss_transform.prependConfigDirective)(currentCss ?? resolvedEntrySource.css, generatorOptions?.config), config), resolvedSourceOptions);
|
|
2880
2047
|
const source = await require_generator.resolveTailwindV4Source(createSingleTailwindV4SourceOptions(resolvedSourceOptions, {
|
|
2881
2048
|
base: currentCss && config ? node_path.default.dirname(config) : resolvedEntrySource.base,
|
|
2882
2049
|
css,
|
|
@@ -2893,7 +2060,7 @@ async function resolveTailwindV4SourceSideEntrySource(resolvedEntrySource, sourc
|
|
|
2893
2060
|
});
|
|
2894
2061
|
}
|
|
2895
2062
|
//#endregion
|
|
2896
|
-
//#region src/
|
|
2063
|
+
//#region src/generation/source-resolver/source-matching.ts
|
|
2897
2064
|
async function resolveMatchingTailwindV4CssEntry(rawSource, file, sourceOptions) {
|
|
2898
2065
|
const cssEntries = sourceOptions.cssEntries;
|
|
2899
2066
|
if (!cssEntries?.length) return;
|
|
@@ -2955,14 +2122,14 @@ async function resolveMatchingTailwindV4CssSource(rawSource, file, cssHandlerOpt
|
|
|
2955
2122
|
});
|
|
2956
2123
|
}
|
|
2957
2124
|
//#endregion
|
|
2958
|
-
//#region src/
|
|
2125
|
+
//#region src/generation/source-resolver/resolve-source.ts
|
|
2959
2126
|
async function resolveGeneratorSource(_majorVersion, runtimeState, rawSource, file, cssHandlerOptions, generatorOptions, selectionOptions) {
|
|
2960
2127
|
const base = resolveCssSourceBase(file, cssHandlerOptions);
|
|
2961
|
-
const cssEntrySource =
|
|
2128
|
+
const cssEntrySource = (0, _weapp_tailwindcss_postcss_transform.resolveCssEntrySource)(rawSource, base, {
|
|
2962
2129
|
importFallback: generatorOptions?.importFallback ?? false,
|
|
2963
2130
|
removeConfig: false
|
|
2964
2131
|
});
|
|
2965
|
-
const applyEntrySource =
|
|
2132
|
+
const applyEntrySource = (0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyDirective)(rawSource) ? {
|
|
2966
2133
|
base,
|
|
2967
2134
|
css: rawSource
|
|
2968
2135
|
} : void 0;
|
|
@@ -2975,9 +2142,9 @@ async function resolveGeneratorSource(_majorVersion, runtimeState, rawSource, fi
|
|
|
2975
2142
|
cssSources: mergeCssSources(mergeCssSources(sourceOptions.cssSources, selectionOptions?.cssSources), sourceOptions.cssSources?.length || selectionOptions?.cssSources?.length ? void 0 : createCssEntrySources(selectionOptions?.cssEntries ?? sourceOptions.cssEntries))
|
|
2976
2143
|
}) : void 0;
|
|
2977
2144
|
const normalizedSourceOptions = resolvedSourceOptions ? normalizeTailwindV4CssSourceConfigs(resolvedSourceOptions) : void 0;
|
|
2978
|
-
if (applyEntrySource && !cssHandlerOptions.isMainChunk && !
|
|
2145
|
+
if (applyEntrySource && !cssHandlerOptions.isMainChunk && !(0, _weapp_tailwindcss_postcss_transform.hasTailwindRootDirectives)(rawSource, { importFallback: generatorOptions?.importFallback ?? false })) {
|
|
2979
2146
|
const config = generatorOptions?.config ?? (normalizedSourceOptions ? resolveUniqueTailwindV4CssConfig(normalizedSourceOptions) : void 0);
|
|
2980
|
-
const css = createTailwindV4ApplyReferenceSource(
|
|
2147
|
+
const css = createTailwindV4ApplyReferenceSource((0, _weapp_tailwindcss_postcss_transform.normalizeConfigDirective)((0, _weapp_tailwindcss_postcss_transform.prependConfigDirective)(applyEntrySource.css, config), void 0), normalizedSourceOptions ?? {});
|
|
2981
2148
|
return require_generator.resolveTailwindV4Source(createSingleTailwindV4SourceOptions(normalizedSourceOptions ?? {}, {
|
|
2982
2149
|
base: applyEntrySource.base,
|
|
2983
2150
|
css
|
|
@@ -2985,7 +2152,8 @@ async function resolveGeneratorSource(_majorVersion, runtimeState, rawSource, fi
|
|
|
2985
2152
|
}
|
|
2986
2153
|
const shouldPreferSourceSideEntry = shouldResolveSourceSideCssEntry(rawSource) || Boolean(cssEntrySource?.css.includes("weapp-tailwindcss generator-placeholder")) && (sourceOptions?.cssEntries?.length ?? 0) <= 1;
|
|
2987
2154
|
const sourceSideEntrySource = normalizedSourceOptions && (shouldPreferSourceSideEntry || normalizedSourceOptions.sourceFile !== void 0) && canResolveSourceSideCssEntry(file, cssHandlerOptions, normalizedSourceOptions) ? resolveSourceSideCssEntrySource(file, normalizedSourceOptions, { removeConfig: false }) : void 0;
|
|
2988
|
-
const
|
|
2155
|
+
const shouldPreferMatchedSourceSideCssSource = sourceSideEntrySource?.file && (sourceOptions?.cssEntries?.some((cssEntry) => node_path.default.resolve(cssEntry.replace(/[?#].*$/, "")) === node_path.default.resolve(sourceSideEntrySource.file)) || isSfcStyleSourceRequest(file) && sourceOptions?.cssSources?.some((cssSource) => typeof cssSource.file === "string" && node_path.default.resolve(cssSource.file.replace(/[?#].*$/, "")) === node_path.default.resolve(sourceSideEntrySource.file)));
|
|
2156
|
+
const sourceSideCssSource = normalizedSourceOptions && shouldPreferMatchedSourceSideCssSource ? await resolveTailwindV4SourceSideEntrySource(sourceSideEntrySource, normalizedSourceOptions, generatorOptions, file, rawSource) : void 0;
|
|
2989
2157
|
if (sourceSideCssSource) return sourceSideCssSource;
|
|
2990
2158
|
const matchedCssEntrySource = normalizedSourceOptions ? await resolveMatchingTailwindV4CssEntry(rawSource, file, normalizedSourceOptions) : void 0;
|
|
2991
2159
|
const matchedCssSource = normalizedSourceOptions && !matchedCssEntrySource ? await resolveMatchingTailwindV4CssSource(rawSource, file, cssHandlerOptions, normalizedSourceOptions, selectionOptions) : void 0;
|
|
@@ -2995,24 +2163,24 @@ async function resolveGeneratorSource(_majorVersion, runtimeState, rawSource, fi
|
|
|
2995
2163
|
index: 0,
|
|
2996
2164
|
matched: true
|
|
2997
2165
|
}) : void 0;
|
|
2998
|
-
const canResolveCombinedConfiguredCssSources = (normalizedSourceOptions?.cssSources?.length ?? 0) <= 1 ||
|
|
2999
|
-
const configuredCssSource = normalizedSourceOptions && hasConfiguredTailwindV4CssSource(normalizedSourceOptions) &&
|
|
2166
|
+
const canResolveCombinedConfiguredCssSources = (normalizedSourceOptions?.cssSources?.length ?? 0) <= 1 || (0, _weapp_tailwindcss_postcss_transform.hasTailwindGeneratedCss)(rawSource);
|
|
2167
|
+
const configuredCssSource = normalizedSourceOptions && hasConfiguredTailwindV4CssSource(normalizedSourceOptions) && (0, _weapp_tailwindcss_postcss_transform.hasTailwindGeneratedCssMarkers)(rawSource) ? matchedCssSource ?? candidateMatchedCssSource ?? singleConfiguredCssSource ?? (canResolveCombinedConfiguredCssSources ? await require_generator.resolveTailwindV4Source(normalizedSourceOptions) : void 0) : void 0;
|
|
3000
2168
|
if (configuredCssSource) return generatorOptions?.config ? {
|
|
3001
2169
|
...configuredCssSource,
|
|
3002
|
-
css:
|
|
2170
|
+
css: (0, _weapp_tailwindcss_postcss_transform.prependConfigDirective)(configuredCssSource.css, generatorOptions.config)
|
|
3003
2171
|
} : configuredCssSource;
|
|
3004
2172
|
const mainCssEntrySource = normalizedSourceOptions && cssHandlerOptions.isMainChunk && normalizedSourceOptions.cssEntries?.length === 1 ? await resolveTailwindV4CssEntrySource(normalizedSourceOptions.cssEntries[0], normalizedSourceOptions) : void 0;
|
|
3005
2173
|
const preferredCssEntrySource = matchedCssEntrySource ?? matchedCssSource ?? candidateMatchedCssEntrySource ?? candidateMatchedCssSource ?? mainCssEntrySource ?? singleConfiguredCssSource;
|
|
3006
2174
|
if (preferredCssEntrySource) return generatorOptions?.config ? {
|
|
3007
2175
|
...preferredCssEntrySource,
|
|
3008
|
-
css:
|
|
2176
|
+
css: (0, _weapp_tailwindcss_postcss_transform.prependConfigDirective)(preferredCssEntrySource.css, generatorOptions.config)
|
|
3009
2177
|
} : preferredCssEntrySource;
|
|
3010
2178
|
const resolvedEntrySource = sourceSideEntrySource ?? cssEntrySource ?? applyEntrySource;
|
|
3011
2179
|
if (!resolvedEntrySource) {
|
|
3012
2180
|
const source = await require_generator.resolveTailwindV4SourceFromRuntime(runtimeState.tailwindRuntime);
|
|
3013
2181
|
return generatorOptions?.config ? {
|
|
3014
2182
|
...source,
|
|
3015
|
-
css:
|
|
2183
|
+
css: (0, _weapp_tailwindcss_postcss_transform.prependConfigDirective)(source.css, generatorOptions.config)
|
|
3016
2184
|
} : source;
|
|
3017
2185
|
}
|
|
3018
2186
|
const config = resolveExistingConfigPath(resolvedEntrySource.config, resolvedEntrySource.configRequest, file, require_generator.omitUndefined({
|
|
@@ -3020,21 +2188,21 @@ async function resolveGeneratorSource(_majorVersion, runtimeState, rawSource, fi
|
|
|
3020
2188
|
sourceFile: resolvedEntrySource.file ?? resolvedSourceOptions?.sourceFile ?? resolvePostcssSourceFile(cssHandlerOptions)
|
|
3021
2189
|
}));
|
|
3022
2190
|
const sourceBase = resolvedEntrySource === cssEntrySource && config ? node_path.default.dirname(config) : resolvedEntrySource.base;
|
|
3023
|
-
const css = createTailwindV4SourceReferenceSource(
|
|
2191
|
+
const css = (0, _weapp_tailwindcss_postcss_transform.createTailwindV4SourceReferenceSource)((0, _weapp_tailwindcss_postcss_transform.normalizeConfigDirective)((0, _weapp_tailwindcss_postcss_transform.prependConfigDirective)(resolvedEntrySource.css, generatorOptions?.config), config), normalizedSourceOptions ?? {});
|
|
3024
2192
|
return require_generator.resolveTailwindV4Source(createSingleTailwindV4SourceOptions(normalizedSourceOptions ?? {}, {
|
|
3025
2193
|
base: sourceBase,
|
|
3026
2194
|
css
|
|
3027
2195
|
}));
|
|
3028
2196
|
}
|
|
3029
2197
|
//#endregion
|
|
3030
|
-
//#region src/
|
|
2198
|
+
//#region src/generation/source-resolver/resolve-sources.ts
|
|
3031
2199
|
async function resolveGeneratorResolvedSources(majorVersion, runtimeState, rawSource, file, cssHandlerOptions, generatorOptions, selectionOptions) {
|
|
3032
2200
|
const base = resolveCssSourceBase(file, cssHandlerOptions);
|
|
3033
|
-
const cssEntrySource =
|
|
2201
|
+
const cssEntrySource = (0, _weapp_tailwindcss_postcss_transform.resolveCssEntrySource)(rawSource, base, {
|
|
3034
2202
|
importFallback: generatorOptions?.importFallback ?? false,
|
|
3035
2203
|
removeConfig: false
|
|
3036
2204
|
});
|
|
3037
|
-
if (cssEntrySource && !cssHandlerOptions.isMainChunk || !cssHandlerOptions.isMainChunk &&
|
|
2205
|
+
if (cssEntrySource && !cssHandlerOptions.isMainChunk || !cssHandlerOptions.isMainChunk && (0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyDirective)(rawSource) && !(0, _weapp_tailwindcss_postcss_transform.hasTailwindRootDirectives)(rawSource, { importFallback: generatorOptions?.importFallback ?? false })) {
|
|
3038
2206
|
const resolved = await resolveGeneratorSource(majorVersion, runtimeState, rawSource, file, cssHandlerOptions, generatorOptions, selectionOptions);
|
|
3039
2207
|
return resolved ? [resolved] : [];
|
|
3040
2208
|
}
|
|
@@ -3057,7 +2225,7 @@ async function resolveGeneratorResolvedSources(majorVersion, runtimeState, rawSo
|
|
|
3057
2225
|
const matchedCssEntrySource = sourceOptions ? await resolveMatchingTailwindV4CssEntry(rawSource, file, sourceOptions) : void 0;
|
|
3058
2226
|
if (matchedCssEntrySource) return [normalizeResolvedTailwindV4SourceConfig(generatorOptions?.config ? {
|
|
3059
2227
|
...matchedCssEntrySource,
|
|
3060
|
-
css:
|
|
2228
|
+
css: (0, _weapp_tailwindcss_postcss_transform.prependConfigDirective)(matchedCssEntrySource.css, generatorOptions.config)
|
|
3061
2229
|
} : matchedCssEntrySource, getGeneratorSourceMetadata(matchedCssEntrySource)?.matchedCssSourceFile, sourceOptions)];
|
|
3062
2230
|
const sourceSideCssSource = await resolveTailwindV4SourceSideEntrySource(canResolveSourceSideCssEntry(file, cssHandlerOptions, sourceOptions) ? resolveSourceSideCssEntrySource(file, sourceOptions, { removeConfig: false }) : void 0, sourceOptions, generatorOptions, file);
|
|
3063
2231
|
if (sourceSideCssSource) return [sourceSideCssSource];
|
|
@@ -3067,25 +2235,25 @@ async function resolveGeneratorResolvedSources(majorVersion, runtimeState, rawSo
|
|
|
3067
2235
|
const preferredCssEntrySource = matchedCssEntrySource ?? matchedCssSource ?? candidateMatchedCssEntrySource ?? candidateMatchedCssSource;
|
|
3068
2236
|
if (preferredCssEntrySource) return [normalizeResolvedTailwindV4SourceConfig(generatorOptions?.config ? {
|
|
3069
2237
|
...preferredCssEntrySource,
|
|
3070
|
-
css:
|
|
2238
|
+
css: (0, _weapp_tailwindcss_postcss_transform.prependConfigDirective)(preferredCssEntrySource.css, generatorOptions.config)
|
|
3071
2239
|
} : preferredCssEntrySource, getGeneratorSourceMetadata(preferredCssEntrySource)?.matchedCssSourceFile, sourceOptions)];
|
|
3072
2240
|
if (!sourceOptions.cssEntries || sourceOptions.cssEntries.length <= 1) {
|
|
3073
2241
|
if (cssHandlerOptions.isMainChunk && sourceOptions.cssEntries?.length === 1) return [await resolveTailwindV4CssEntrySource(sourceOptions.cssEntries[0], normalizeTailwindV4CssSourceConfigs(sourceOptions), { index: 0 }).then((source) => generatorOptions?.config ? {
|
|
3074
2242
|
...source,
|
|
3075
|
-
css:
|
|
2243
|
+
css: (0, _weapp_tailwindcss_postcss_transform.prependConfigDirective)(source.css, generatorOptions.config)
|
|
3076
2244
|
} : source)];
|
|
3077
2245
|
if (sourceOptions.cssSources?.length === 1) return [normalizeResolvedTailwindV4SourceConfig(await createTailwindV4CssSourceResolver(sourceOptions, generatorOptions)(sourceOptions.cssSources[0], 0), sourceOptions.cssSources[0]?.file, sourceOptions)];
|
|
3078
2246
|
const resolved = await resolveGeneratorSource(majorVersion, runtimeState, rawSource, file, cssHandlerOptions, generatorOptions, selectionOptions);
|
|
3079
2247
|
return resolved ? [resolved] : [];
|
|
3080
2248
|
}
|
|
3081
|
-
if (cssHandlerOptions.isMainChunk && !cssEntrySource && !
|
|
2249
|
+
if (cssHandlerOptions.isMainChunk && !cssEntrySource && !(0, _weapp_tailwindcss_postcss_transform.hasTailwindGeneratedCss)(rawSource) && !(0, _weapp_tailwindcss_postcss_transform.hasTailwindGeneratedCssMarkers)(rawSource) && !(0, _weapp_tailwindcss_postcss_transform.hasTailwindSourceDirectives)(rawSource, { importFallback: generatorOptions?.importFallback ?? false }) && !rawSource.includes("weapp-tailwindcss generator-placeholder") && !hasConfiguredTailwindV4CssSource(sourceOptions)) {
|
|
3082
2250
|
const resolved = await resolveGeneratorSource(majorVersion, runtimeState, rawSource, file, cssHandlerOptions, generatorOptions, selectionOptions);
|
|
3083
2251
|
return resolved ? [resolved] : [];
|
|
3084
2252
|
}
|
|
3085
2253
|
const normalizedCssSourceOptions = normalizeTailwindV4CssSourceConfigs(sourceOptions);
|
|
3086
2254
|
const cssEntrySources = await Promise.all(sourceOptions.cssEntries.map((cssEntry, index) => resolveTailwindV4CssEntrySource(cssEntry, normalizedCssSourceOptions, { index }).then((source) => generatorOptions?.config ? {
|
|
3087
2255
|
...source,
|
|
3088
|
-
css:
|
|
2256
|
+
css: (0, _weapp_tailwindcss_postcss_transform.prependConfigDirective)(source.css, generatorOptions.config)
|
|
3089
2257
|
} : source)));
|
|
3090
2258
|
const cssSources = sourceOptions.cssSources?.length ? await Promise.all(sourceOptions.cssSources.map(createTailwindV4CssSourceResolver(sourceOptions, generatorOptions))) : [];
|
|
3091
2259
|
return [...cssEntrySources, ...cssSources];
|
|
@@ -3094,7 +2262,7 @@ async function resolveGeneratorSources(majorVersion, runtimeState, rawSource, fi
|
|
|
3094
2262
|
return (await resolveGeneratorResolvedSources(majorVersion, runtimeState, rawSource, file, cssHandlerOptions, generatorOptions, selectionOptions)).map(createGeneratorSourceRecord);
|
|
3095
2263
|
}
|
|
3096
2264
|
//#endregion
|
|
3097
|
-
//#region src/
|
|
2265
|
+
//#region src/generation/source-resolver/source-entries.ts
|
|
3098
2266
|
async function resolveGeneratorSourceEntries(record, runtimeState) {
|
|
3099
2267
|
const { metadata: sourceMetadata, source } = record;
|
|
3100
2268
|
if (sourceMetadata?.sourceEntries) return sourceMetadata.sourceEntries;
|
|
@@ -3122,7 +2290,7 @@ async function resolveGeneratorSourceEntries(record, runtimeState) {
|
|
|
3122
2290
|
return resolved?.entries;
|
|
3123
2291
|
}
|
|
3124
2292
|
//#endregion
|
|
3125
|
-
//#region src/
|
|
2293
|
+
//#region src/generation/legacy-compat.ts
|
|
3126
2294
|
const LEGACY_CONTAINER_COMPAT_CSS = [
|
|
3127
2295
|
".container {",
|
|
3128
2296
|
" width: 100%;",
|
|
@@ -3175,112 +2343,20 @@ function createStableJson(value) {
|
|
|
3175
2343
|
function createLegacyCompatTransformCacheKey(source, options) {
|
|
3176
2344
|
return `${createStableJson(options)}\0${source}`;
|
|
3177
2345
|
}
|
|
3178
|
-
function countUnclosedBlocks(source) {
|
|
3179
|
-
let depth = 0;
|
|
3180
|
-
let quote;
|
|
3181
|
-
let inComment = false;
|
|
3182
|
-
let escaped = false;
|
|
3183
|
-
for (let index = 0; index < source.length; index += 1) {
|
|
3184
|
-
const char = source[index];
|
|
3185
|
-
const next = source[index + 1];
|
|
3186
|
-
if (inComment) {
|
|
3187
|
-
if (char === "*" && next === "/") {
|
|
3188
|
-
inComment = false;
|
|
3189
|
-
index += 1;
|
|
3190
|
-
}
|
|
3191
|
-
continue;
|
|
3192
|
-
}
|
|
3193
|
-
if (quote) {
|
|
3194
|
-
if (escaped) {
|
|
3195
|
-
escaped = false;
|
|
3196
|
-
continue;
|
|
3197
|
-
}
|
|
3198
|
-
if (char === "\\") {
|
|
3199
|
-
escaped = true;
|
|
3200
|
-
continue;
|
|
3201
|
-
}
|
|
3202
|
-
if (char === quote) quote = void 0;
|
|
3203
|
-
continue;
|
|
3204
|
-
}
|
|
3205
|
-
if (char === "/" && next === "*") {
|
|
3206
|
-
inComment = true;
|
|
3207
|
-
index += 1;
|
|
3208
|
-
continue;
|
|
3209
|
-
}
|
|
3210
|
-
if (char === "\"" || char === "'") {
|
|
3211
|
-
quote = char;
|
|
3212
|
-
continue;
|
|
3213
|
-
}
|
|
3214
|
-
if (char === "{") depth += 1;
|
|
3215
|
-
else if (char === "}" && depth > 0) depth -= 1;
|
|
3216
|
-
}
|
|
3217
|
-
return depth;
|
|
3218
|
-
}
|
|
3219
|
-
function closeTrailingUnclosedBlocks(source) {
|
|
3220
|
-
try {
|
|
3221
|
-
_weapp_tailwindcss_postcss.postcss.parse(source);
|
|
3222
|
-
return source;
|
|
3223
|
-
} catch (error) {
|
|
3224
|
-
if (error.reason !== "Unclosed block") return source;
|
|
3225
|
-
const unclosedBlocks = countUnclosedBlocks(source);
|
|
3226
|
-
return unclosedBlocks > 0 ? `${source}${"}".repeat(unclosedBlocks)}` : source;
|
|
3227
|
-
}
|
|
3228
|
-
}
|
|
3229
|
-
function removeTailwindApplyRules(rawSource) {
|
|
3230
|
-
try {
|
|
3231
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(rawSource);
|
|
3232
|
-
let removed = false;
|
|
3233
|
-
root.walkAtRules("apply", (rule) => {
|
|
3234
|
-
const parent = rule.parent;
|
|
3235
|
-
if (parent?.type === "rule") parent.remove();
|
|
3236
|
-
else rule.remove();
|
|
3237
|
-
removed = true;
|
|
3238
|
-
});
|
|
3239
|
-
root.walkAtRules((rule) => {
|
|
3240
|
-
if (rule.nodes && rule.nodes.length === 0) rule.remove();
|
|
3241
|
-
});
|
|
3242
|
-
return removed ? root.toString() : rawSource;
|
|
3243
|
-
} catch {
|
|
3244
|
-
return rawSource;
|
|
3245
|
-
}
|
|
3246
|
-
}
|
|
3247
2346
|
function resolveLegacyCompatCssSource(rawSource) {
|
|
3248
2347
|
const cached = legacyCompatSourceCache.get(rawSource);
|
|
3249
2348
|
if (cached !== void 0) return cached;
|
|
3250
|
-
const
|
|
3251
|
-
const source = require_generator.removeTailwindSourceDirectives(parseableSource);
|
|
3252
|
-
const resolved = closeTrailingUnclosedBlocks(require_generator.removeTailwindV4GeneratedUserCssArtifacts((0, _weapp_tailwindcss_postcss.removeUnsupportedMiniProgramAtRules)(removeTailwindApplyRules(source))));
|
|
2349
|
+
const resolved = (0, _weapp_tailwindcss_postcss_transform.normalizeLegacyCompatCssSource)(rawSource);
|
|
3253
2350
|
setLimitedCacheValue(legacyCompatSourceCache, rawSource, resolved);
|
|
3254
2351
|
return resolved;
|
|
3255
2352
|
}
|
|
3256
|
-
function removeMiniProgramContainerCompatCss(css) {
|
|
3257
|
-
try {
|
|
3258
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
3259
|
-
let removed = false;
|
|
3260
|
-
root.walkRules((rule) => {
|
|
3261
|
-
if (rule.selectors?.length === 1 && rule.selectors[0] === ".container") {
|
|
3262
|
-
rule.remove();
|
|
3263
|
-
removed = true;
|
|
3264
|
-
}
|
|
3265
|
-
});
|
|
3266
|
-
root.walkAtRules((atRule) => {
|
|
3267
|
-
if (atRule.nodes && atRule.nodes.length === 0) {
|
|
3268
|
-
atRule.remove();
|
|
3269
|
-
removed = true;
|
|
3270
|
-
}
|
|
3271
|
-
});
|
|
3272
|
-
return removed ? root.toString() : css;
|
|
3273
|
-
} catch {
|
|
3274
|
-
return css;
|
|
3275
|
-
}
|
|
3276
|
-
}
|
|
3277
2353
|
function hasContainerConfigToken(rawSource) {
|
|
3278
2354
|
return rawSource.includes("@config") && /\bcontainer\b/.test(rawSource);
|
|
3279
2355
|
}
|
|
3280
2356
|
function hasConfiguredContainerCompat(rawSource, file, cssHandlerOptions) {
|
|
3281
2357
|
if (hasContainerConfigToken(rawSource)) return true;
|
|
3282
2358
|
const base = resolveCssSourceBase(file, cssHandlerOptions);
|
|
3283
|
-
const cssEntrySource =
|
|
2359
|
+
const cssEntrySource = (0, _weapp_tailwindcss_postcss_transform.resolveCssEntrySource)(rawSource, base);
|
|
3284
2360
|
if (!cssEntrySource?.config) return false;
|
|
3285
2361
|
try {
|
|
3286
2362
|
return /\bcontainer\b/.test((0, node_fs.readFileSync)(cssEntrySource.config, "utf8"));
|
|
@@ -3291,7 +2367,7 @@ function hasConfiguredContainerCompat(rawSource, file, cssHandlerOptions) {
|
|
|
3291
2367
|
function hasConfiguredContainerCompatSource(source) {
|
|
3292
2368
|
if (typeof source.css !== "string") return false;
|
|
3293
2369
|
if (hasContainerConfigToken(source.css)) return true;
|
|
3294
|
-
const cssEntrySource =
|
|
2370
|
+
const cssEntrySource = (0, _weapp_tailwindcss_postcss_transform.resolveCssEntrySource)(source.css, source.base);
|
|
3295
2371
|
if (cssEntrySource?.config) try {
|
|
3296
2372
|
if (/\bcontainer\b/.test((0, node_fs.readFileSync)(cssEntrySource.config, "utf8"))) return true;
|
|
3297
2373
|
} catch {}
|
|
@@ -3305,10 +2381,11 @@ function hasConfiguredContainerCompatSources(sources) {
|
|
|
3305
2381
|
}
|
|
3306
2382
|
async function appendLegacyCompatCss(css, rawSource, generatorTarget, styleHandler, cssHandlerOptions, generatorStyleOptions, options = {}) {
|
|
3307
2383
|
const resolvedCompatSource = resolveLegacyCompatCssSource(rawSource);
|
|
3308
|
-
const normalizedCompatSource = generatorTarget === "weapp" ? removeMiniProgramContainerCompatCss(resolvedCompatSource) : resolvedCompatSource;
|
|
3309
|
-
const
|
|
3310
|
-
if (
|
|
3311
|
-
|
|
2384
|
+
const normalizedCompatSource = generatorTarget === "weapp" ? (0, _weapp_tailwindcss_postcss_transform.removeMiniProgramContainerCompatCss)(resolvedCompatSource) : resolvedCompatSource;
|
|
2385
|
+
const filteredCompatSource = options.preserveSelectorOverrides ? normalizedCompatSource : (0, _weapp_tailwindcss_postcss_transform.removeGeneratedSelectorCompatCss)(normalizedCompatSource, css);
|
|
2386
|
+
if (filteredCompatSource.trim().length === 0) return css;
|
|
2387
|
+
const compatSource = await options.compileAuthorCssFunctions?.(filteredCompatSource) ?? filteredCompatSource;
|
|
2388
|
+
if (generatorTarget !== "weapp") return (0, _weapp_tailwindcss_postcss_transform.createCssAppend)(css, compatSource);
|
|
3312
2389
|
const styleOptions = {
|
|
3313
2390
|
...cssHandlerOptions,
|
|
3314
2391
|
...generatorStyleOptions
|
|
@@ -3319,16 +2396,16 @@ async function appendLegacyCompatCss(css, rawSource, generatorTarget, styleHandl
|
|
|
3319
2396
|
compatCss = (await styleHandler(compatSource, styleOptions)).css;
|
|
3320
2397
|
setLimitedCacheValue(legacyCompatTransformCache, compatCssCacheKey, compatCss);
|
|
3321
2398
|
}
|
|
3322
|
-
const transformedCompatCss =
|
|
3323
|
-
const cleanedCompatCss = options.preserveSelectorOverrides ? (0,
|
|
2399
|
+
const transformedCompatCss = (0, _weapp_tailwindcss_postcss_transform.removeTailwindV4GeneratedUserCssArtifacts)((0, _weapp_tailwindcss_postcss_transform.removeDuplicatedViteMarkers)((0, _weapp_tailwindcss_postcss_transform.removeUnsupportedMiniProgramAtRules)(compatCss), css), options.generatedSource ?? css);
|
|
2400
|
+
const cleanedCompatCss = options.preserveSelectorOverrides ? (0, _weapp_tailwindcss_postcss_transform.filterExistingCssRules)(css, transformedCompatCss) : (0, _weapp_tailwindcss_postcss_transform.collectDedupedPostTransformCompatCss)(transformedCompatCss, css);
|
|
3324
2401
|
if (cleanedCompatCss.trim().length === 0) return css;
|
|
3325
|
-
return
|
|
2402
|
+
return (0, _weapp_tailwindcss_postcss_transform.createCssAppend)(css, cleanedCompatCss);
|
|
3326
2403
|
}
|
|
3327
2404
|
async function appendLegacyContainerCompatCss(css, rawSource, file, runtime, configuredContainerCompat, generatorTarget, styleHandler, cssHandlerOptions, generatorStyleOptions) {
|
|
3328
2405
|
if (generatorTarget === "weapp") return css;
|
|
3329
2406
|
const compatSource = resolveLegacyCompatCssSource(rawSource);
|
|
3330
|
-
const shouldAppendContainer = runtime.has("container") || hasConfiguredContainerCompat(rawSource, file, cssHandlerOptions) || configuredContainerCompat || collectGeneratedSelectors(compatSource).has(".container");
|
|
3331
|
-
if (generatorTarget !== "weapp" || !shouldAppendContainer || collectGeneratedSelectors(css).has(".container")) return css;
|
|
2407
|
+
const shouldAppendContainer = runtime.has("container") || hasConfiguredContainerCompat(rawSource, file, cssHandlerOptions) || configuredContainerCompat || (0, _weapp_tailwindcss_postcss_transform.collectGeneratedSelectors)(compatSource).has(".container");
|
|
2408
|
+
if (generatorTarget !== "weapp" || !shouldAppendContainer || (0, _weapp_tailwindcss_postcss_transform.collectGeneratedSelectors)(css).has(".container")) return css;
|
|
3332
2409
|
const styleOptions = {
|
|
3333
2410
|
...cssHandlerOptions,
|
|
3334
2411
|
...generatorStyleOptions
|
|
@@ -3339,144 +2416,12 @@ async function appendLegacyContainerCompatCss(css, rawSource, file, runtime, con
|
|
|
3339
2416
|
compatCss = (await styleHandler(LEGACY_CONTAINER_COMPAT_CSS, styleOptions)).css;
|
|
3340
2417
|
setLimitedCacheValue(legacyCompatTransformCache, compatCssCacheKey, compatCss);
|
|
3341
2418
|
}
|
|
3342
|
-
const cleanedCompatCss = collectDedupedPostTransformCompatCss((0,
|
|
2419
|
+
const cleanedCompatCss = (0, _weapp_tailwindcss_postcss_transform.collectDedupedPostTransformCompatCss)((0, _weapp_tailwindcss_postcss_transform.removeUnsupportedMiniProgramAtRules)(compatCss), css);
|
|
3343
2420
|
if (cleanedCompatCss.trim().length === 0) return css;
|
|
3344
|
-
return
|
|
3345
|
-
}
|
|
3346
|
-
//#endregion
|
|
3347
|
-
//#region src/bundlers/shared/generator-css/legacy-units.ts
|
|
3348
|
-
const CSS_LENGTH_UNIT_RE = /(?:^|[\s(,])[-+]?(?:\d+|\d*\.\d+)(?:px|rem)\b/i;
|
|
3349
|
-
const RPX_UNIT_RE = /(?:^|[\s(,])[-+]?(?:\d+|\d*\.\d+)rpx\b/i;
|
|
3350
|
-
function createLegacyDeclarationValueMap(css) {
|
|
3351
|
-
const values = /* @__PURE__ */ new Map();
|
|
3352
|
-
_weapp_tailwindcss_postcss.postcss.parse(css).walkRules((rule) => {
|
|
3353
|
-
if (!rule.selectors || rule.selectors.length === 0) return;
|
|
3354
|
-
for (const selector of rule.selectors) {
|
|
3355
|
-
const normalizedSelectors = normalizeCompatSelectors(selector);
|
|
3356
|
-
rule.walkDecls((decl) => {
|
|
3357
|
-
if (RPX_UNIT_RE.test(decl.value)) for (const normalizedSelector of normalizedSelectors) values.set(`${normalizedSelector}\n${decl.prop}`, decl.value);
|
|
3358
|
-
});
|
|
3359
|
-
}
|
|
3360
|
-
});
|
|
3361
|
-
return values;
|
|
3362
|
-
}
|
|
3363
|
-
function inheritLegacyUnitConvertedDeclarations(css, legacyCss) {
|
|
3364
|
-
try {
|
|
3365
|
-
const legacyValues = createLegacyDeclarationValueMap(legacyCss);
|
|
3366
|
-
if (legacyValues.size === 0) return css;
|
|
3367
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
3368
|
-
let changed = false;
|
|
3369
|
-
root.walkRules((rule) => {
|
|
3370
|
-
if (!rule.selectors || rule.selectors.length === 0) return;
|
|
3371
|
-
const selectors = rule.selectors.flatMap((selector) => normalizeCompatSelectors(selector));
|
|
3372
|
-
if (selectors.length === 0) return;
|
|
3373
|
-
rule.walkDecls((decl) => {
|
|
3374
|
-
if (!CSS_LENGTH_UNIT_RE.test(decl.value)) return;
|
|
3375
|
-
for (const selector of selectors) {
|
|
3376
|
-
const legacyValue = legacyValues.get(`${selector}\n${decl.prop}`);
|
|
3377
|
-
if (legacyValue && legacyValue !== decl.value) {
|
|
3378
|
-
decl.value = legacyValue;
|
|
3379
|
-
changed = true;
|
|
3380
|
-
return;
|
|
3381
|
-
}
|
|
3382
|
-
}
|
|
3383
|
-
});
|
|
3384
|
-
});
|
|
3385
|
-
return changed ? root.toString() : css;
|
|
3386
|
-
} catch {
|
|
3387
|
-
return css;
|
|
3388
|
-
}
|
|
3389
|
-
}
|
|
3390
|
-
//#endregion
|
|
3391
|
-
//#region src/bundlers/shared/generator-css/output-import-shell.ts
|
|
3392
|
-
const MINI_PROGRAM_OUTPUT_IMPORT_RE = /(@import\s+(?:url\(\s*)?)(["'])([^"']+\.(?:wxss|acss|ttss|qss|jxss|tyss)(?:[?#][^"']*)?)\2([^;]*;)/gi;
|
|
3393
|
-
const MINI_PROGRAM_OUTPUT_STYLE_RE = /\.(?:wxss|acss|ttss|qss|jxss|tyss)(?:$|[?#])/i;
|
|
3394
|
-
function normalizeMiniProgramOutputImportRequest(request) {
|
|
3395
|
-
if (request.startsWith(".") || request.startsWith("/") || /^(?:[a-z][a-z\d+.-]*:|#)/i.test(request)) return request;
|
|
3396
|
-
return `./${request}`;
|
|
3397
|
-
}
|
|
3398
|
-
function normalizeMiniProgramImportShell(css, output) {
|
|
3399
|
-
const normalized = output?.cssOnly ? css : css.replace(MINI_PROGRAM_OUTPUT_IMPORT_RE, (_match, prefix, quote, request, suffix) => {
|
|
3400
|
-
return `${prefix}${quote}${normalizeMiniProgramOutputImportRequest(request)}${quote}${suffix}`;
|
|
3401
|
-
});
|
|
3402
|
-
if (!output || !normalized.includes("@import")) return normalized;
|
|
3403
|
-
const files = new Set([...output.outputFiles].map(normalizeOutputPath));
|
|
3404
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(normalized);
|
|
3405
|
-
root.walkAtRules("import", (rule) => {
|
|
3406
|
-
const parsed = require_generator.parseCssImportSpecifier(rule.params);
|
|
3407
|
-
if (!parsed || output.cssOnly && !/\.css(?:$|[?#])/i.test(parsed.specifier) || !files.has(resolveOutputImportRequest(output.outputFile, parsed.specifier))) return;
|
|
3408
|
-
const request = normalizeMiniProgramOutputImportRequest(parsed.specifier);
|
|
3409
|
-
if (request !== parsed.specifier) rule.params = rule.params.replace(parsed.raw, require_generator.quoteCssImportSpecifier(request, parsed.quote));
|
|
3410
|
-
});
|
|
3411
|
-
return root.toString();
|
|
3412
|
-
}
|
|
3413
|
-
function normalizeOutputPath(file) {
|
|
3414
|
-
const segments = [];
|
|
3415
|
-
for (const segment of file.replace(/\\/g, "/").replace(/^\/+/, "").split("/")) {
|
|
3416
|
-
if (!segment || segment === ".") continue;
|
|
3417
|
-
if (segment === "..") {
|
|
3418
|
-
if (segments.length > 0 && segments[segments.length - 1] !== "..") segments.pop();
|
|
3419
|
-
else segments.push(segment);
|
|
3420
|
-
continue;
|
|
3421
|
-
}
|
|
3422
|
-
segments.push(segment);
|
|
3423
|
-
}
|
|
3424
|
-
return segments.join("/");
|
|
3425
|
-
}
|
|
3426
|
-
function splitRequestSuffix(request) {
|
|
3427
|
-
const suffixIndexCandidates = [request.indexOf("?"), request.indexOf("#")].filter((index) => index >= 0);
|
|
3428
|
-
const suffixIndex = suffixIndexCandidates.length > 0 ? Math.min(...suffixIndexCandidates) : -1;
|
|
3429
|
-
return suffixIndex < 0 ? request : request.slice(0, suffixIndex);
|
|
3430
|
-
}
|
|
3431
|
-
function resolveOutputImportRequest(file, request) {
|
|
3432
|
-
const cleanRequest = splitRequestSuffix(request.replace(/\\/g, "/"));
|
|
3433
|
-
if (cleanRequest.startsWith("/")) return normalizeOutputPath(cleanRequest);
|
|
3434
|
-
const normalizedFile = normalizeOutputPath(file);
|
|
3435
|
-
const baseDir = normalizedFile.includes("/") ? normalizedFile.slice(0, normalizedFile.lastIndexOf("/")) : "";
|
|
3436
|
-
return normalizeOutputPath(baseDir ? `${baseDir}/${cleanRequest}` : cleanRequest);
|
|
3437
|
-
}
|
|
3438
|
-
function isMiniProgramOutputImport(node) {
|
|
3439
|
-
if (node.type !== "atrule" || node.name !== "import") return false;
|
|
3440
|
-
const request = require_generator.parseImportRequest(node.params);
|
|
3441
|
-
return request !== void 0 && MINI_PROGRAM_OUTPUT_STYLE_RE.test(request);
|
|
3442
|
-
}
|
|
3443
|
-
function isSelfMiniProgramOutputImport(outputFile, node) {
|
|
3444
|
-
if (node.type !== "atrule" || node.name !== "import") return false;
|
|
3445
|
-
const request = require_generator.parseCssImportSpecifier(node.params)?.specifier;
|
|
3446
|
-
return request !== void 0 && /\.(?:css|wxss|acss|ttss|qss|jxss|tyss)(?:$|[?#])/i.test(request) && resolveOutputImportRequest(outputFile, request) === normalizeOutputPath(outputFile);
|
|
3447
|
-
}
|
|
3448
|
-
function removeMiniProgramOutputImportsBy(css, predicate) {
|
|
3449
|
-
if (!css.includes("@import")) return css;
|
|
3450
|
-
try {
|
|
3451
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
3452
|
-
let changed = false;
|
|
3453
|
-
root.walk((node) => {
|
|
3454
|
-
if (predicate(node)) {
|
|
3455
|
-
node.remove();
|
|
3456
|
-
changed = true;
|
|
3457
|
-
}
|
|
3458
|
-
});
|
|
3459
|
-
return changed ? root.toString() : css;
|
|
3460
|
-
} catch {
|
|
3461
|
-
return css;
|
|
3462
|
-
}
|
|
3463
|
-
}
|
|
3464
|
-
function removeSelfMiniProgramOutputImports(css, outputFile) {
|
|
3465
|
-
return removeMiniProgramOutputImportsBy(css, (node) => isSelfMiniProgramOutputImport(outputFile, node));
|
|
3466
|
-
}
|
|
3467
|
-
function removeMiniProgramOutputImports(css) {
|
|
3468
|
-
return removeMiniProgramOutputImportsBy(css, isMiniProgramOutputImport);
|
|
3469
|
-
}
|
|
3470
|
-
function normalizeMiniProgramGeneratorCssSource(css, outputFile, outputFiles) {
|
|
3471
|
-
const normalized = normalizeMiniProgramImportShell(css, outputFile && outputFiles ? {
|
|
3472
|
-
outputFile,
|
|
3473
|
-
outputFiles
|
|
3474
|
-
} : void 0);
|
|
3475
|
-
if (outputFile) return removeSelfMiniProgramOutputImports(normalized, outputFile);
|
|
3476
|
-
return (0, _weapp_tailwindcss_postcss.isPureLocalCssImportWrapper)(normalized) ? normalized : removeMiniProgramOutputImports(normalized);
|
|
2421
|
+
return (0, _weapp_tailwindcss_postcss_transform.createCssAppend)(css, cleanedCompatCss);
|
|
3477
2422
|
}
|
|
3478
2423
|
//#endregion
|
|
3479
|
-
//#region src/
|
|
2424
|
+
//#region src/utils/run-tasks.ts
|
|
3480
2425
|
async function runWithConcurrency(factories, limit = Math.min(4, Math.max(1, factories.length))) {
|
|
3481
2426
|
if (factories.length === 0) return [];
|
|
3482
2427
|
const results = Array.from({ length: factories.length });
|
|
@@ -3513,25 +2458,46 @@ function pushConcurrentTaskFactories(queue, factories, limit) {
|
|
|
3513
2458
|
queue.push(runWithConcurrency(factories, limit).then(() => void 0));
|
|
3514
2459
|
}
|
|
3515
2460
|
//#endregion
|
|
3516
|
-
//#region src/
|
|
3517
|
-
function
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
2461
|
+
//#region src/generation/user-css/compile-functions.ts
|
|
2462
|
+
function createAuthorCssFunctionCompiler(sources, session) {
|
|
2463
|
+
const cache = /* @__PURE__ */ new Map();
|
|
2464
|
+
return (css) => {
|
|
2465
|
+
return (0, _weapp_tailwindcss_postcss_transform.compileTailwindAuthorFunctions)(css, async (values) => {
|
|
2466
|
+
const missing = [...new Set(values.filter((value) => !cache.has(value)))];
|
|
2467
|
+
if (missing.length > 0) {
|
|
2468
|
+
let selector = `.weapp-author-functions-${(0, _weapp_tailwindcss_shared_node.md5)(missing.join("\0"))}`;
|
|
2469
|
+
while (sources.some((source) => source.css.includes(selector))) selector += "-probe";
|
|
2470
|
+
const probe = (0, _weapp_tailwindcss_postcss_transform.createTailwindAuthorFunctionProbe)(missing, selector);
|
|
2471
|
+
let resolved;
|
|
2472
|
+
for (const source of sources) {
|
|
2473
|
+
const result = await session.generate({
|
|
2474
|
+
...source,
|
|
2475
|
+
css: `${source.css}\n${probe.css}`
|
|
2476
|
+
}, {
|
|
2477
|
+
candidates: [],
|
|
2478
|
+
scanSources: false,
|
|
2479
|
+
incrementalCache: false,
|
|
2480
|
+
target: "web"
|
|
2481
|
+
});
|
|
2482
|
+
const current = probe.read(result.rawCss);
|
|
2483
|
+
if (resolved && current.some((value, index) => value !== resolved[index])) throw new Error("作者样式函数匹配到多个不同的 Tailwind 配置上下文,无法安全回填。");
|
|
2484
|
+
resolved = current;
|
|
2485
|
+
}
|
|
2486
|
+
if (!resolved) throw new Error("作者样式函数缺少 Tailwind 编译上下文。");
|
|
2487
|
+
missing.forEach((value, index) => cache.set(value, resolved[index]));
|
|
2488
|
+
}
|
|
2489
|
+
return values.map((value) => cache.get(value));
|
|
3525
2490
|
});
|
|
3526
|
-
}
|
|
3527
|
-
return selectors;
|
|
2491
|
+
};
|
|
3528
2492
|
}
|
|
2493
|
+
//#endregion
|
|
2494
|
+
//#region src/generation/class-selectors.ts
|
|
3529
2495
|
function collectGeneratedRawSourceCandidates(candidates, rawSource, escapeMap) {
|
|
3530
|
-
const selectors = collectRawSourceClassSelectors(rawSource);
|
|
2496
|
+
const selectors = (0, _weapp_tailwindcss_postcss_transform.collectRawSourceClassSelectors)(rawSource);
|
|
3531
2497
|
if (selectors.size === 0) return /* @__PURE__ */ new Set();
|
|
3532
2498
|
const matched = /* @__PURE__ */ new Set();
|
|
3533
2499
|
for (const candidate of candidates) {
|
|
3534
|
-
const escaped = normalizeCssClassSelector(require_compiler.replaceWxml(candidate, { escapeMap }));
|
|
2500
|
+
const escaped = (0, _weapp_tailwindcss_postcss_transform.normalizeCssClassSelector)(require_compiler.replaceWxml(candidate, { escapeMap }));
|
|
3535
2501
|
if (selectors.has(candidate) || selectors.has(escaped)) matched.add(candidate);
|
|
3536
2502
|
}
|
|
3537
2503
|
return matched;
|
|
@@ -3542,27 +2508,7 @@ function collectGeneratedRawSourceCandidatesFromCss(candidates, cssSources, esca
|
|
|
3542
2508
|
return matched;
|
|
3543
2509
|
}
|
|
3544
2510
|
//#endregion
|
|
3545
|
-
//#region src/
|
|
3546
|
-
function collectCssRuleIdentityMarkers(source) {
|
|
3547
|
-
const markers = /* @__PURE__ */ new Set();
|
|
3548
|
-
try {
|
|
3549
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(source);
|
|
3550
|
-
root.walkRules((rule) => {
|
|
3551
|
-
for (const selector of rule.selectors ?? [rule.selector]) for (const match of selector.matchAll(/\.((?:\\.|[_a-z\u00A0-\uFFFF-])(?:\\.|[\w\u00A0-\uFFFF-])*)/gi)) markers.add(`class:${match[1]}`);
|
|
3552
|
-
});
|
|
3553
|
-
root.walkAtRules("keyframes", (rule) => {
|
|
3554
|
-
if (rule.params) markers.add(`keyframes:${rule.params}`);
|
|
3555
|
-
});
|
|
3556
|
-
} catch {}
|
|
3557
|
-
return markers;
|
|
3558
|
-
}
|
|
3559
|
-
function isCssAlreadyRepresentedByMarkers(css, source) {
|
|
3560
|
-
const sourceMarkers = collectCssRuleIdentityMarkers(source);
|
|
3561
|
-
if (sourceMarkers.size === 0) return false;
|
|
3562
|
-
const cssMarkers = collectCssRuleIdentityMarkers(css);
|
|
3563
|
-
for (const marker of sourceMarkers) if (!cssMarkers.has(marker)) return false;
|
|
3564
|
-
return true;
|
|
3565
|
-
}
|
|
2511
|
+
//#region src/generation/result-helpers.ts
|
|
3566
2512
|
function mergeGeneratedCssClassSet(classSet, candidates, css, escapeMap) {
|
|
3567
2513
|
const merged = new Set(classSet);
|
|
3568
2514
|
for (const candidate of collectGeneratedRawSourceCandidates(candidates, css, escapeMap)) merged.add(candidate);
|
|
@@ -3573,22 +2519,22 @@ function resolveGeneratedCssClassSet(target, classSet, candidates, css, escapeMa
|
|
|
3573
2519
|
return mergeGeneratedCssClassSet(classSet, candidates, css, escapeMap);
|
|
3574
2520
|
}
|
|
3575
2521
|
function finalizeWebGeneratorCss(css, target, webCompat) {
|
|
3576
|
-
return target === "web" ? (0,
|
|
2522
|
+
return target === "web" ? (0, _weapp_tailwindcss_postcss_transform.transformWebCssCompat)(css, webCompat) : css;
|
|
3577
2523
|
}
|
|
3578
2524
|
function finalizeIncrementalGeneratorCss(previousCss, incrementalCss, target, majorVersion, cssPreflight, options, webCompat) {
|
|
3579
2525
|
const finalizedIncrementalCss = finalizeMiniProgramGeneratorCss(incrementalCss, target, majorVersion, cssPreflight, options);
|
|
3580
|
-
if (target === "web") return
|
|
3581
|
-
return
|
|
2526
|
+
if (target === "web") return (0, _weapp_tailwindcss_postcss_transform.createCssAppend)(previousCss, finalizeWebGeneratorCss(finalizedIncrementalCss, target, webCompat));
|
|
2527
|
+
return (0, _weapp_tailwindcss_postcss_transform.createCssAppend)(previousCss, finalizedIncrementalCss);
|
|
3582
2528
|
}
|
|
3583
2529
|
//#endregion
|
|
3584
|
-
//#region src/
|
|
2530
|
+
//#region src/generation/pipeline/deferred-output.ts
|
|
3585
2531
|
async function finalizeDeferredGeneratorCss(context) {
|
|
3586
2532
|
const { cssUserHandlerOptions, file, filterGeneratedApplyOnlyCss, generated, generatedUserCssRawSource, generatorOptions, generatorRawSource, generatorStyleOptions, hasMatchedCssSourceFile, localImports, majorVersion, options, opts, preflightMode, runtimeWithCurrentCss, styleHandler, userCssOrderSource, userRawSourceProcessed } = context;
|
|
3587
2533
|
if (options.deferCssAdaptation) {
|
|
3588
2534
|
const normalizeDeferredGeneratedCss = async (css) => {
|
|
3589
|
-
const rawCss =
|
|
3590
|
-
const generationCss = generated.target === "weapp" && ((0,
|
|
3591
|
-
const normalizedCss = generated.target === "weapp" ? await (0,
|
|
2535
|
+
const rawCss = (0, _weapp_tailwindcss_postcss_transform.stripTailwindBanner)(css);
|
|
2536
|
+
const generationCss = generated.target === "weapp" && ((0, _weapp_tailwindcss_postcss_transform.hasCssMacroStyleOptions)(generatorStyleOptions) || (0, _weapp_tailwindcss_postcss_transform.hasCssMacroTailwindV4InternalAtRules)(rawCss)) ? await (0, _weapp_tailwindcss_postcss_transform.transformCssMacroCss)(rawCss, generatorStyleOptions) : rawCss;
|
|
2537
|
+
const normalizedCss = generated.target === "weapp" ? await (0, _weapp_tailwindcss_postcss_transform.normalizeMiniProgramGeneratedCssForPostcss)(generationCss, {
|
|
3592
2538
|
preservePreflight: true,
|
|
3593
2539
|
preserveRawClassRules: true
|
|
3594
2540
|
}) : generationCss;
|
|
@@ -3598,6 +2544,8 @@ async function finalizeDeferredGeneratorCss(context) {
|
|
|
3598
2544
|
if (generated.target !== "weapp" || generatedUserCssRawSource.trim().length === 0) return css;
|
|
3599
2545
|
const userCssOptions = {
|
|
3600
2546
|
generatorTarget: generated.target,
|
|
2547
|
+
compileAuthorCssFunctions: context.compileAuthorCssFunctions,
|
|
2548
|
+
generatedSource: generated.rawCss,
|
|
3601
2549
|
generatorStyleOptions,
|
|
3602
2550
|
cssUserHandlerOptions,
|
|
3603
2551
|
styleHandler,
|
|
@@ -3605,33 +2553,36 @@ async function finalizeDeferredGeneratorCss(context) {
|
|
|
3605
2553
|
processed: userRawSourceProcessed
|
|
3606
2554
|
};
|
|
3607
2555
|
const transformDeferredUserCss = async (source) => {
|
|
3608
|
-
const parts =
|
|
3609
|
-
const layerCss = await
|
|
3610
|
-
const restCss = await
|
|
3611
|
-
return createCssSourceOrderAppend(wrapUserLayerComponentsCss(layerCss), restCss);
|
|
2556
|
+
const parts = (0, _weapp_tailwindcss_postcss_transform.splitUserCssLayerBlocks)(source);
|
|
2557
|
+
const layerCss = await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)(parts.layer, userCssOptions);
|
|
2558
|
+
const restCss = await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)(parts.rest, userCssOptions);
|
|
2559
|
+
return (0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)((0, _weapp_tailwindcss_postcss_transform.wrapUserLayerComponentsCss)(layerCss), restCss);
|
|
3612
2560
|
};
|
|
3613
|
-
const orderedUserCss =
|
|
2561
|
+
const orderedUserCss = (0, _weapp_tailwindcss_postcss_transform.splitGeneratorPlaceholderCssBySourceOrder)(userCssOrderSource, generated.rawCss) ?? (hasMatchedCssSourceFile ? (0, _weapp_tailwindcss_postcss_transform.splitTailwindV4GeneratedCssBySourceOrder)(userCssOrderSource, generated.rawCss) : splitRawSourceByGeneratedCssOrder(userCssOrderSource, generated.rawCss));
|
|
3614
2562
|
if (orderedUserCss) {
|
|
3615
2563
|
const beforeUserCss = await transformDeferredUserCss(orderedUserCss.before);
|
|
3616
2564
|
const afterUserCss = await transformDeferredUserCss(orderedUserCss.after);
|
|
3617
|
-
const
|
|
3618
|
-
|
|
2565
|
+
const missingBeforeUserCss = (0, _weapp_tailwindcss_postcss_transform.filterExistingCssRules)(css, beforeUserCss);
|
|
2566
|
+
const cssWithBeforeUserCss = (0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)(missingBeforeUserCss, css);
|
|
2567
|
+
const missingAfterUserCss = (0, _weapp_tailwindcss_postcss_transform.filterExistingCssRules)(cssWithBeforeUserCss, afterUserCss);
|
|
2568
|
+
return (0, _weapp_tailwindcss_postcss_transform.reorderMarkedUserLayerComponentsCss)((0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)(cssWithBeforeUserCss, missingAfterUserCss));
|
|
3619
2569
|
}
|
|
3620
2570
|
const userCss = await transformDeferredUserCss(generatedUserCssRawSource);
|
|
3621
|
-
return reorderMarkedUserLayerComponentsCss(createCssSourceOrderAppend(css, (0,
|
|
2571
|
+
return (0, _weapp_tailwindcss_postcss_transform.reorderMarkedUserLayerComponentsCss)((0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)(css, (0, _weapp_tailwindcss_postcss_transform.filterExistingCssRules)(css, userCss)));
|
|
3622
2572
|
};
|
|
3623
|
-
const canAppendIncrementalCss = generated.target !== "weapp" || !
|
|
2573
|
+
const canAppendIncrementalCss = generated.target !== "weapp" || !(0, _weapp_tailwindcss_postcss_transform.hasUserCssLayerBlocks)(generatorRawSource);
|
|
3624
2574
|
const incrementalRawCss = generated.incrementalRawCss ?? generated.incrementalCss;
|
|
3625
|
-
const
|
|
3626
|
-
const
|
|
2575
|
+
const previousCss = options.previousCss;
|
|
2576
|
+
const shouldAppendIncrementalCss = canAppendIncrementalCss && typeof previousCss === "string" && typeof incrementalRawCss === "string";
|
|
2577
|
+
const normalizedCss = shouldAppendIncrementalCss ? incrementalRawCss.trim().length > 0 ? (0, _weapp_tailwindcss_postcss_transform.createCssAppend)(previousCss, await normalizeDeferredGeneratedCss(incrementalRawCss)) : previousCss : await normalizeDeferredGeneratedCss(generated.rawCss ?? generated.css);
|
|
3627
2578
|
const intermediateCss = shouldAppendIncrementalCss ? normalizedCss : await restoreDeferredUserCss(normalizedCss);
|
|
3628
|
-
const css = (0,
|
|
2579
|
+
const css = (0, _weapp_tailwindcss_postcss_transform.restoreLocalCssImports)(intermediateCss, localImports, { outputFile: file });
|
|
3629
2580
|
return {
|
|
3630
2581
|
css,
|
|
3631
2582
|
classSet: resolveGeneratedCssClassSet(generated.target, generated.classSet, runtimeWithCurrentCss, css, opts.escapeMap, options.previousClassSet),
|
|
3632
2583
|
target: generated.target,
|
|
3633
2584
|
source: "generator",
|
|
3634
|
-
dependencies: generated.dependencies,
|
|
2585
|
+
dependencies: [...generated.dependencies],
|
|
3635
2586
|
incremental: shouldAppendIncrementalCss,
|
|
3636
2587
|
metadata: {
|
|
3637
2588
|
file,
|
|
@@ -3643,87 +2594,102 @@ async function finalizeDeferredGeneratorCss(context) {
|
|
|
3643
2594
|
}
|
|
3644
2595
|
}
|
|
3645
2596
|
//#endregion
|
|
3646
|
-
//#region src/
|
|
2597
|
+
//#region src/generation/pipeline/fallback-output.ts
|
|
3647
2598
|
async function finalizeFallbackGeneratorCss(context) {
|
|
3648
2599
|
const { configuredContainerCompat, cssHandlerOptions, cssUserHandlerOptions, debug, file, finalizeGeneratorCss, generated, generatedCss, generatedUserCssRawSource, generatorOptions, generatorRawSource, generatorStyleOptions, hasDistinctUserRawSource, hasGeneratedCss, hasGeneratedMarkers, hasMatchedCssSourceFile, hasSourceDirectives, hasWebUserCssFallbackSource, isolateCurrentCssCandidates, legacyCompatUserCssRawSource, majorVersion, options, opts, preflightMode, prepareFinalGeneratorCss, runtime, runtimeWithCurrentCss, shouldFilterApplyOnlyCss, shouldPreserveLegacyCompatSelectorOverrides, styleHandler, userCssRawSource, userRawSourceProcessed } = context;
|
|
3649
2600
|
debug("tailwind direct css generation prefix mismatch, append transformed bundle css %s", file);
|
|
3650
2601
|
let css = generatedCss;
|
|
3651
|
-
const distinctUserLayerParts = hasDistinctUserRawSource &&
|
|
2602
|
+
const distinctUserLayerParts = hasDistinctUserRawSource && (0, _weapp_tailwindcss_postcss_transform.hasUserCssLayerBlocks)(generatedUserCssRawSource) ? (0, _weapp_tailwindcss_postcss_transform.splitUserCssLayerBlocks)(generatedUserCssRawSource) : void 0;
|
|
3652
2603
|
let restoredDistinctUserLayerCss = false;
|
|
3653
|
-
if (generated.target === "weapp" && generatorRawSource.includes("weapp-tailwindcss generator-placeholder") && !
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
2604
|
+
if (generated.target === "weapp" && generatorRawSource.includes("weapp-tailwindcss generator-placeholder") && !(0, _weapp_tailwindcss_postcss_transform.hasUserCssLayerBlocks)(generatorRawSource)) {
|
|
2605
|
+
const userCss = await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)(generatedUserCssRawSource, {
|
|
2606
|
+
generatorTarget: generated.target,
|
|
2607
|
+
compileAuthorCssFunctions: context.compileAuthorCssFunctions,
|
|
2608
|
+
generatedSource: generated.rawCss,
|
|
2609
|
+
generatorStyleOptions,
|
|
2610
|
+
cssUserHandlerOptions,
|
|
2611
|
+
styleHandler,
|
|
2612
|
+
importFallback: generatorOptions.importFallback,
|
|
2613
|
+
processed: userRawSourceProcessed
|
|
2614
|
+
});
|
|
2615
|
+
css = (0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)(userCss, css);
|
|
2616
|
+
}
|
|
3661
2617
|
if (generated.target === "weapp") {
|
|
3662
|
-
css = inheritLegacyUnitConvertedDeclarations(css, generatorRawSource);
|
|
3663
|
-
if (
|
|
3664
|
-
const layerParts =
|
|
3665
|
-
const layerUserCss = await
|
|
2618
|
+
css = (0, _weapp_tailwindcss_postcss_transform.inheritLegacyUnitConvertedDeclarations)(css, generatorRawSource);
|
|
2619
|
+
if ((0, _weapp_tailwindcss_postcss_transform.hasUserCssLayerBlocks)(generatorRawSource)) {
|
|
2620
|
+
const layerParts = (0, _weapp_tailwindcss_postcss_transform.splitUserCssLayerBlocks)(generatorRawSource);
|
|
2621
|
+
const layerUserCss = await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)(layerParts.layer, {
|
|
3666
2622
|
generatorTarget: generated.target,
|
|
2623
|
+
compileAuthorCssFunctions: context.compileAuthorCssFunctions,
|
|
2624
|
+
generatedSource: generated.rawCss,
|
|
3667
2625
|
generatorStyleOptions,
|
|
3668
2626
|
cssUserHandlerOptions,
|
|
3669
2627
|
styleHandler,
|
|
3670
2628
|
importFallback: generatorOptions.importFallback,
|
|
3671
2629
|
processed: userRawSourceProcessed
|
|
3672
2630
|
});
|
|
3673
|
-
const layerCss = layerUserCss.trim().length > 0 && !
|
|
2631
|
+
const layerCss = layerUserCss.trim().length > 0 && !(0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyDirective)(layerUserCss) ? {
|
|
3674
2632
|
layer: layerUserCss,
|
|
3675
2633
|
rest: css
|
|
3676
|
-
} :
|
|
2634
|
+
} : (0, _weapp_tailwindcss_postcss_transform.extractGeneratedCssForUserLayerSelectors)(css, layerParts.layer);
|
|
3677
2635
|
if (layerCss.layer.trim().length > 0) {
|
|
3678
|
-
css = createCssSourceOrderAppend(wrapUserLayerComponentsCss(layerCss.layer), layerCss.rest);
|
|
3679
|
-
if (shouldFinalizeMarkedUserLayerComponentsCss(file)) css = reorderMarkedUserLayerComponentsCss(css);
|
|
2636
|
+
css = (0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)((0, _weapp_tailwindcss_postcss_transform.wrapUserLayerComponentsCss)(layerCss.layer), layerCss.rest);
|
|
2637
|
+
if (shouldFinalizeMarkedUserLayerComponentsCss(file)) css = (0, _weapp_tailwindcss_postcss_transform.reorderMarkedUserLayerComponentsCss)(css);
|
|
3680
2638
|
}
|
|
3681
2639
|
}
|
|
3682
2640
|
if (hasDistinctUserRawSource && distinctUserLayerParts) {
|
|
3683
|
-
const layerUserCss = await
|
|
2641
|
+
const layerUserCss = await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)(distinctUserLayerParts.layer, {
|
|
3684
2642
|
generatorTarget: generated.target,
|
|
2643
|
+
compileAuthorCssFunctions: context.compileAuthorCssFunctions,
|
|
2644
|
+
generatedSource: generated.rawCss,
|
|
3685
2645
|
generatorStyleOptions,
|
|
3686
2646
|
cssUserHandlerOptions,
|
|
3687
2647
|
styleHandler,
|
|
3688
2648
|
importFallback: generatorOptions.importFallback,
|
|
3689
2649
|
processed: userRawSourceProcessed
|
|
3690
2650
|
});
|
|
3691
|
-
if ((0,
|
|
3692
|
-
css = createCssSourceOrderAppend(wrapUserLayerComponentsCss(layerUserCss), css);
|
|
2651
|
+
if ((0, _weapp_tailwindcss_postcss_transform.filterExistingCssRules)(css, layerUserCss).trim().length > 0) {
|
|
2652
|
+
css = (0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)((0, _weapp_tailwindcss_postcss_transform.wrapUserLayerComponentsCss)(layerUserCss), css);
|
|
3693
2653
|
restoredDistinctUserLayerCss = true;
|
|
3694
|
-
if (shouldFinalizeMarkedUserLayerComponentsCss(file)) css = reorderMarkedUserLayerComponentsCss(css);
|
|
2654
|
+
if (shouldFinalizeMarkedUserLayerComponentsCss(file)) css = (0, _weapp_tailwindcss_postcss_transform.reorderMarkedUserLayerComponentsCss)(css);
|
|
3695
2655
|
}
|
|
3696
2656
|
}
|
|
3697
2657
|
}
|
|
3698
2658
|
if (hasMatchedCssSourceFile || generated.target === "web") {
|
|
3699
2659
|
if (generated.target === "weapp" && !hasGeneratedCss && !hasGeneratedMarkers) {
|
|
3700
2660
|
const distinctUserCssRawSource = restoredDistinctUserLayerCss ? distinctUserLayerParts?.rest ?? generatedUserCssRawSource : generatedUserCssRawSource;
|
|
3701
|
-
const userCss = await
|
|
2661
|
+
const userCss = await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)(distinctUserCssRawSource, {
|
|
3702
2662
|
generatorTarget: generated.target,
|
|
2663
|
+
compileAuthorCssFunctions: context.compileAuthorCssFunctions,
|
|
2664
|
+
generatedSource: generated.rawCss,
|
|
3703
2665
|
generatorStyleOptions,
|
|
3704
2666
|
cssUserHandlerOptions,
|
|
3705
2667
|
styleHandler,
|
|
3706
2668
|
importFallback: generatorOptions.importFallback,
|
|
3707
2669
|
processed: userRawSourceProcessed
|
|
3708
2670
|
});
|
|
3709
|
-
const missingUserCss = isCssAlreadyRepresentedByMarkers(css, distinctUserCssRawSource) ? (0,
|
|
3710
|
-
css = createCssSourceOrderAppend(css, missingUserCss);
|
|
2671
|
+
const missingUserCss = (0, _weapp_tailwindcss_postcss_transform.isCssAlreadyRepresentedByMarkers)(css, distinctUserCssRawSource) ? (0, _weapp_tailwindcss_postcss_transform.filterExistingCssRules)(css, userCss) : userCss;
|
|
2672
|
+
css = (0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)(css, missingUserCss);
|
|
3711
2673
|
} else if (hasMatchedCssSourceFile && generated.target === "weapp" && hasGeneratedMarkers && !hasGeneratedCss) {
|
|
3712
|
-
const cleanedUserCssRawSource =
|
|
3713
|
-
const cleanedUserCssRestSource = restoredDistinctUserLayerCss &&
|
|
3714
|
-
const userCss = await
|
|
2674
|
+
const cleanedUserCssRawSource = (0, _weapp_tailwindcss_postcss_transform.removeTailwindV4GeneratedUserCssArtifacts)(userCssRawSource, generated.rawCss);
|
|
2675
|
+
const cleanedUserCssRestSource = restoredDistinctUserLayerCss && (0, _weapp_tailwindcss_postcss_transform.hasUserCssLayerBlocks)(cleanedUserCssRawSource) ? (0, _weapp_tailwindcss_postcss_transform.splitUserCssLayerBlocks)(cleanedUserCssRawSource).rest : cleanedUserCssRawSource;
|
|
2676
|
+
const userCss = await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)(cleanedUserCssRestSource, {
|
|
3715
2677
|
generatorTarget: generated.target,
|
|
2678
|
+
compileAuthorCssFunctions: context.compileAuthorCssFunctions,
|
|
2679
|
+
generatedSource: generated.rawCss,
|
|
3716
2680
|
generatorStyleOptions,
|
|
3717
2681
|
cssUserHandlerOptions,
|
|
3718
2682
|
styleHandler,
|
|
3719
2683
|
importFallback: generatorOptions.importFallback,
|
|
3720
2684
|
processed: userRawSourceProcessed
|
|
3721
2685
|
});
|
|
3722
|
-
const missingUserCss = (0,
|
|
3723
|
-
css = createCssSourceOrderAppend(css, missingUserCss);
|
|
3724
|
-
} else if (hasMatchedCssSourceFile && generated.target === "weapp" &&
|
|
3725
|
-
const layerUserCss = await
|
|
2686
|
+
const missingUserCss = (0, _weapp_tailwindcss_postcss_transform.filterExistingCssRules)(css, userCss);
|
|
2687
|
+
css = (0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)(css, missingUserCss);
|
|
2688
|
+
} else if (hasMatchedCssSourceFile && generated.target === "weapp" && (0, _weapp_tailwindcss_postcss_transform.hasUserCssLayerBlocks)(generatedUserCssRawSource)) {
|
|
2689
|
+
const layerUserCss = await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)((0, _weapp_tailwindcss_postcss_transform.splitUserCssLayerBlocks)(generatedUserCssRawSource).layer, {
|
|
3726
2690
|
generatorTarget: generated.target,
|
|
2691
|
+
compileAuthorCssFunctions: context.compileAuthorCssFunctions,
|
|
2692
|
+
generatedSource: generated.rawCss,
|
|
3727
2693
|
generatorStyleOptions,
|
|
3728
2694
|
cssUserHandlerOptions,
|
|
3729
2695
|
styleHandler,
|
|
@@ -3731,8 +2697,8 @@ async function finalizeFallbackGeneratorCss(context) {
|
|
|
3731
2697
|
processed: userRawSourceProcessed
|
|
3732
2698
|
});
|
|
3733
2699
|
if (layerUserCss.trim().length > 0) {
|
|
3734
|
-
css = createCssSourceOrderAppend(css, wrapUserLayerComponentsCss(layerUserCss));
|
|
3735
|
-
if (shouldFinalizeMarkedUserLayerComponentsCss(file)) css = reorderMarkedUserLayerComponentsCss(css);
|
|
2700
|
+
css = (0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)(css, (0, _weapp_tailwindcss_postcss_transform.wrapUserLayerComponentsCss)(layerUserCss));
|
|
2701
|
+
if (shouldFinalizeMarkedUserLayerComponentsCss(file)) css = (0, _weapp_tailwindcss_postcss_transform.reorderMarkedUserLayerComponentsCss)(css);
|
|
3736
2702
|
}
|
|
3737
2703
|
}
|
|
3738
2704
|
if (hasMatchedCssSourceFile && generated.target === "weapp") {
|
|
@@ -3742,16 +2708,18 @@ async function finalizeFallbackGeneratorCss(context) {
|
|
|
3742
2708
|
hasSourceDirectives,
|
|
3743
2709
|
hasMatchedCssSourceFile
|
|
3744
2710
|
})) {
|
|
3745
|
-
const userCss = await
|
|
2711
|
+
const userCss = await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)(generatedUserCssRawSource, {
|
|
3746
2712
|
generatorTarget: generated.target,
|
|
2713
|
+
compileAuthorCssFunctions: context.compileAuthorCssFunctions,
|
|
2714
|
+
generatedSource: generated.rawCss,
|
|
3747
2715
|
generatorStyleOptions,
|
|
3748
2716
|
cssUserHandlerOptions,
|
|
3749
2717
|
styleHandler,
|
|
3750
2718
|
importFallback: generatorOptions.importFallback,
|
|
3751
2719
|
processed: userRawSourceProcessed
|
|
3752
2720
|
});
|
|
3753
|
-
const missingUserCss =
|
|
3754
|
-
css = createCssSourceOrderAppend(css, missingUserCss);
|
|
2721
|
+
const missingUserCss = (0, _weapp_tailwindcss_postcss_transform.isCommentOnlyCss)(userCss) ? "" : (0, _weapp_tailwindcss_postcss_transform.filterExistingCssRules)(css, userCss);
|
|
2722
|
+
css = (0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)(css, missingUserCss);
|
|
3755
2723
|
}
|
|
3756
2724
|
const finalCss = finalizeGeneratorCss(prepareFinalGeneratorCss(css), generated.target, {
|
|
3757
2725
|
injectPreflight: preflightMode.inject,
|
|
@@ -3763,7 +2731,7 @@ async function finalizeFallbackGeneratorCss(context) {
|
|
|
3763
2731
|
classSet: resolveGeneratedCssClassSet(generated.target, generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap, options.previousClassSet),
|
|
3764
2732
|
target: generated.target,
|
|
3765
2733
|
source: "generator",
|
|
3766
|
-
dependencies: generated.dependencies,
|
|
2734
|
+
dependencies: [...generated.dependencies],
|
|
3767
2735
|
metadata: {
|
|
3768
2736
|
file,
|
|
3769
2737
|
majorVersion,
|
|
@@ -3772,21 +2740,27 @@ async function finalizeFallbackGeneratorCss(context) {
|
|
|
3772
2740
|
};
|
|
3773
2741
|
}
|
|
3774
2742
|
if (!shouldFilterApplyOnlyCss && !userRawSourceProcessed && !hasGeneratedCss && !hasGeneratedMarkers) {
|
|
3775
|
-
css = await appendLegacyCompatCss(css, legacyCompatUserCssRawSource, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions, {
|
|
2743
|
+
css = await appendLegacyCompatCss(css, legacyCompatUserCssRawSource, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions, {
|
|
2744
|
+
preserveSelectorOverrides: shouldPreserveLegacyCompatSelectorOverrides,
|
|
2745
|
+
generatedSource: generated.rawCss,
|
|
2746
|
+
compileAuthorCssFunctions: context.compileAuthorCssFunctions
|
|
2747
|
+
});
|
|
3776
2748
|
css = await appendLegacyContainerCompatCss(css, generatedUserCssRawSource, file, runtime, configuredContainerCompat, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
3777
2749
|
}
|
|
3778
|
-
if (generated.target === "weapp" && hasDistinctUserRawSource && !hasGeneratedCss && !hasGeneratedMarkers && !
|
|
2750
|
+
if (generated.target === "weapp" && hasDistinctUserRawSource && !hasGeneratedCss && !hasGeneratedMarkers && !(0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyDirective)(generatedUserCssRawSource)) {
|
|
3779
2751
|
const distinctUserCssRawSource = restoredDistinctUserLayerCss ? distinctUserLayerParts?.rest ?? generatedUserCssRawSource : generatedUserCssRawSource;
|
|
3780
|
-
const userCss = await
|
|
2752
|
+
const userCss = await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)(distinctUserCssRawSource, {
|
|
3781
2753
|
generatorTarget: generated.target,
|
|
2754
|
+
compileAuthorCssFunctions: context.compileAuthorCssFunctions,
|
|
2755
|
+
generatedSource: generated.rawCss,
|
|
3782
2756
|
generatorStyleOptions,
|
|
3783
2757
|
cssUserHandlerOptions,
|
|
3784
2758
|
styleHandler,
|
|
3785
2759
|
importFallback: generatorOptions.importFallback,
|
|
3786
2760
|
processed: userRawSourceProcessed
|
|
3787
2761
|
});
|
|
3788
|
-
const missingUserCss = isCssAlreadyRepresentedByMarkers(css, distinctUserCssRawSource) ? (0,
|
|
3789
|
-
css = createCssSourceOrderAppend(css, missingUserCss);
|
|
2762
|
+
const missingUserCss = (0, _weapp_tailwindcss_postcss_transform.isCssAlreadyRepresentedByMarkers)(css, distinctUserCssRawSource) ? (0, _weapp_tailwindcss_postcss_transform.filterExistingCssRules)(css, userCss) : userCss;
|
|
2763
|
+
css = (0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)(css, missingUserCss);
|
|
3790
2764
|
}
|
|
3791
2765
|
const finalCss = finalizeGeneratorCss(prepareFinalGeneratorCss(css), generated.target, {
|
|
3792
2766
|
injectPreflight: preflightMode.inject,
|
|
@@ -3798,7 +2772,7 @@ async function finalizeFallbackGeneratorCss(context) {
|
|
|
3798
2772
|
classSet: resolveGeneratedCssClassSet(generated.target, generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap, options.previousClassSet),
|
|
3799
2773
|
target: generated.target,
|
|
3800
2774
|
source: "generator",
|
|
3801
|
-
dependencies: generated.dependencies,
|
|
2775
|
+
dependencies: [...generated.dependencies],
|
|
3802
2776
|
metadata: {
|
|
3803
2777
|
file,
|
|
3804
2778
|
majorVersion,
|
|
@@ -3807,23 +2781,23 @@ async function finalizeFallbackGeneratorCss(context) {
|
|
|
3807
2781
|
};
|
|
3808
2782
|
}
|
|
3809
2783
|
//#endregion
|
|
3810
|
-
//#region src/
|
|
2784
|
+
//#region src/generation/pipeline/ordered-output.ts
|
|
3811
2785
|
async function finalizeOrderedGeneratorCss(context) {
|
|
3812
2786
|
const { configuredContainerCompat, cssHandlerOptions, cssUserHandlerOptions, file, filterGeneratedApplyOnlyCss, finalizeGeneratorCss, generated, generatedUserCssRawSource, generatorOptions, generatorRawSource, generatorStyleOptions, hasDistinctUserRawSource, hasGeneratedCss, hasGeneratedMarkers, hasMatchedCssSourceFile, hasSourceDirectives, hasWebUserCssFallbackSource, isolateCurrentCssCandidates, legacyCompatUserCssRawSource, localImports, majorVersion, options, opts, preflightMode, prepareFinalGeneratorCss, runtime, runtimeWithCurrentCss, shouldFilterApplyOnlyCss, shouldPreserveLegacyCompatSelectorOverrides, styleHandler, userCssOrderSource, userCssRawSource, userRawSourceProcessed } = context;
|
|
3813
|
-
if ((generated.target !== "weapp" || !
|
|
3814
|
-
const incrementalCss =
|
|
2787
|
+
if ((generated.target !== "weapp" || !(0, _weapp_tailwindcss_postcss_transform.hasUserCssLayerBlocks)(generatorRawSource)) && typeof options.previousCss === "string" && typeof generated.incrementalCss === "string") {
|
|
2788
|
+
const incrementalCss = (0, _weapp_tailwindcss_postcss_transform.stripTailwindBanner)(generated.incrementalCss);
|
|
3815
2789
|
const css = incrementalCss.trim().length > 0 ? finalizeIncrementalGeneratorCss(options.previousCss, incrementalCss, generated.target, majorVersion, opts.cssPreflight, {
|
|
3816
2790
|
injectPreflight: false,
|
|
3817
2791
|
removeEmptyAtRuleAncestors: false,
|
|
3818
2792
|
styleOptions: generatorStyleOptions
|
|
3819
2793
|
}, generatorOptions.webCompat) : options.previousCss;
|
|
3820
|
-
const finalCss = generated.target === "web" ? (0,
|
|
2794
|
+
const finalCss = generated.target === "web" ? (0, _weapp_tailwindcss_postcss_transform.restoreLocalCssImports)(css, localImports, { outputFile: file }) : finalizeWebGeneratorCss((0, _weapp_tailwindcss_postcss_transform.restoreLocalCssImports)(css, localImports, { outputFile: file }), generated.target, generatorOptions.webCompat);
|
|
3821
2795
|
return {
|
|
3822
2796
|
css: finalCss,
|
|
3823
2797
|
classSet: resolveGeneratedCssClassSet(generated.target, generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap, options.previousClassSet),
|
|
3824
2798
|
target: generated.target,
|
|
3825
2799
|
source: "generator",
|
|
3826
|
-
dependencies: generated.dependencies,
|
|
2800
|
+
dependencies: [...generated.dependencies],
|
|
3827
2801
|
incremental: true,
|
|
3828
2802
|
metadata: {
|
|
3829
2803
|
file,
|
|
@@ -3832,53 +2806,60 @@ async function finalizeOrderedGeneratorCss(context) {
|
|
|
3832
2806
|
}
|
|
3833
2807
|
};
|
|
3834
2808
|
}
|
|
3835
|
-
const generatedCss = filterGeneratedApplyOnlyCss(generated.target === "web" ? generated.css :
|
|
3836
|
-
const orderedExtraCss =
|
|
2809
|
+
const generatedCss = filterGeneratedApplyOnlyCss(generated.target === "web" ? generated.css : (0, _weapp_tailwindcss_postcss_transform.stripTailwindBanner)(generated.css));
|
|
2810
|
+
const orderedExtraCss = (0, _weapp_tailwindcss_postcss_transform.splitGeneratorPlaceholderCssBySourceOrder)(userCssOrderSource, generated.rawCss) ?? (hasMatchedCssSourceFile ? (0, _weapp_tailwindcss_postcss_transform.splitTailwindV4GeneratedCssBySourceOrder)(userCssOrderSource, generated.rawCss) : splitRawSourceByGeneratedCssOrder(userCssOrderSource, generated.rawCss));
|
|
3837
2811
|
const shouldAppendMatchedCssSourceCompat = !hasMatchedCssSourceFile || orderedExtraCss !== void 0;
|
|
3838
2812
|
if (orderedExtraCss) {
|
|
3839
2813
|
let css = generatedCss;
|
|
3840
|
-
if (generated.target === "weapp") css = inheritLegacyUnitConvertedDeclarations(css, generatorRawSource);
|
|
2814
|
+
if (generated.target === "weapp") css = (0, _weapp_tailwindcss_postcss_transform.inheritLegacyUnitConvertedDeclarations)(css, generatorRawSource);
|
|
3841
2815
|
const userCssOptions = {
|
|
3842
2816
|
generatorTarget: generated.target,
|
|
2817
|
+
compileAuthorCssFunctions: context.compileAuthorCssFunctions,
|
|
2818
|
+
generatedSource: generated.rawCss,
|
|
3843
2819
|
generatorStyleOptions,
|
|
3844
2820
|
cssUserHandlerOptions,
|
|
3845
2821
|
styleHandler,
|
|
3846
2822
|
importFallback: generatorOptions.importFallback,
|
|
3847
2823
|
processed: userRawSourceProcessed
|
|
3848
2824
|
};
|
|
3849
|
-
const afterLayerParts = generated.target === "weapp" ?
|
|
2825
|
+
const afterLayerParts = generated.target === "weapp" ? (0, _weapp_tailwindcss_postcss_transform.splitUserCssLayerBlocks)(orderedExtraCss.after) : {
|
|
3850
2826
|
layer: "",
|
|
3851
2827
|
rest: orderedExtraCss.after
|
|
3852
2828
|
};
|
|
3853
|
-
const beforeUserCss = await
|
|
3854
|
-
const afterLayerUserCss = await
|
|
3855
|
-
const afterUserCss = await
|
|
3856
|
-
const fallbackLayerUserCss = generated.target === "weapp" &&
|
|
3857
|
-
|
|
2829
|
+
const beforeUserCss = await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)(orderedExtraCss.before, userCssOptions);
|
|
2830
|
+
const afterLayerUserCss = await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)(afterLayerParts.layer, userCssOptions);
|
|
2831
|
+
const afterUserCss = await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)(afterLayerParts.rest, userCssOptions);
|
|
2832
|
+
const fallbackLayerUserCss = generated.target === "weapp" && (0, _weapp_tailwindcss_postcss_transform.hasUserCssLayerBlocks)(userCssRawSource) ? (0, _weapp_tailwindcss_postcss_transform.filterExistingCssRules)(afterLayerUserCss, await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)((0, _weapp_tailwindcss_postcss_transform.splitUserCssLayerBlocks)(userCssRawSource).layer, userCssOptions)) : "";
|
|
2833
|
+
const orderedAfterLayerUserCss = generated.target === "weapp" ? (0, _weapp_tailwindcss_postcss_transform.wrapUserLayerComponentsCss)((0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)(afterLayerUserCss, fallbackLayerUserCss)) : afterLayerUserCss;
|
|
2834
|
+
css = (0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)((0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)((0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)(beforeUserCss, orderedAfterLayerUserCss), css), afterUserCss);
|
|
3858
2835
|
if (hasWebUserCssFallbackSource && isEmptyCssSourceOrderParts(orderedExtraCss) && shouldAppendWebBundleCssFallback(generated.target, {
|
|
3859
2836
|
hasSourceDirectives,
|
|
3860
2837
|
hasMatchedCssSourceFile
|
|
3861
2838
|
})) {
|
|
3862
|
-
const userCss = await
|
|
3863
|
-
css = createCssSourceOrderAppend(css, userCss);
|
|
2839
|
+
const userCss = await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)(userCssRawSource, userCssOptions);
|
|
2840
|
+
css = (0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)(css, userCss);
|
|
3864
2841
|
}
|
|
3865
2842
|
if (generated.target === "web" && hasWebUserCssFallbackSource) {
|
|
3866
|
-
const userCss = await
|
|
3867
|
-
const missingUserCss =
|
|
3868
|
-
css = createCssSourceOrderAppend(css, missingUserCss);
|
|
2843
|
+
const userCss = await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)(userCssRawSource, userCssOptions);
|
|
2844
|
+
const missingUserCss = (0, _weapp_tailwindcss_postcss_transform.isCommentOnlyCss)(userCss) ? "" : (0, _weapp_tailwindcss_postcss_transform.filterExistingCssRules)(css, userCss);
|
|
2845
|
+
css = (0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)(css, missingUserCss);
|
|
3869
2846
|
}
|
|
3870
|
-
if (generated.target === "weapp" && isEmptyCssSourceOrderParts(orderedExtraCss) && hasDistinctUserRawSource && !hasGeneratedCss && !hasGeneratedMarkers && !
|
|
3871
|
-
const userCss = await
|
|
3872
|
-
const missingUserCss = isCssAlreadyRepresentedByMarkers(css, generatedUserCssRawSource) ? (0,
|
|
3873
|
-
css = createCssSourceOrderAppend(css, missingUserCss);
|
|
2847
|
+
if (generated.target === "weapp" && isEmptyCssSourceOrderParts(orderedExtraCss) && hasDistinctUserRawSource && !hasGeneratedCss && !hasGeneratedMarkers && !(0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyDirective)(generatedUserCssRawSource)) {
|
|
2848
|
+
const userCss = await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)(generatedUserCssRawSource, userCssOptions);
|
|
2849
|
+
const missingUserCss = (0, _weapp_tailwindcss_postcss_transform.isCssAlreadyRepresentedByMarkers)(css, generatedUserCssRawSource) ? (0, _weapp_tailwindcss_postcss_transform.filterExistingCssRules)(css, userCss) : userCss;
|
|
2850
|
+
css = (0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)(css, missingUserCss);
|
|
3874
2851
|
}
|
|
3875
2852
|
if (generated.target === "weapp" && shouldAppendMatchedCssSourceCompat) {
|
|
3876
|
-
if (shouldFinalizeMarkedUserLayerComponentsCss(file)) css = reorderMarkedUserLayerComponentsCss(css);
|
|
2853
|
+
if (shouldFinalizeMarkedUserLayerComponentsCss(file)) css = (0, _weapp_tailwindcss_postcss_transform.reorderMarkedUserLayerComponentsCss)(css);
|
|
3877
2854
|
if (!shouldFilterApplyOnlyCss && !userRawSourceProcessed && !hasGeneratedCss && !hasGeneratedMarkers) {
|
|
3878
|
-
css = await appendLegacyCompatCss(css, legacyCompatUserCssRawSource, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions, {
|
|
2855
|
+
css = await appendLegacyCompatCss(css, legacyCompatUserCssRawSource, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions, {
|
|
2856
|
+
preserveSelectorOverrides: shouldPreserveLegacyCompatSelectorOverrides,
|
|
2857
|
+
generatedSource: generated.rawCss,
|
|
2858
|
+
compileAuthorCssFunctions: context.compileAuthorCssFunctions
|
|
2859
|
+
});
|
|
3879
2860
|
if (!isolateCurrentCssCandidates) css = await appendLegacyContainerCompatCss(css, generatedUserCssRawSource, file, runtime, configuredContainerCompat, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
3880
2861
|
}
|
|
3881
|
-
} else if (generated.target === "weapp" && shouldFinalizeMarkedUserLayerComponentsCss(file)) css = reorderMarkedUserLayerComponentsCss(css);
|
|
2862
|
+
} else if (generated.target === "weapp" && shouldFinalizeMarkedUserLayerComponentsCss(file)) css = (0, _weapp_tailwindcss_postcss_transform.reorderMarkedUserLayerComponentsCss)(css);
|
|
3882
2863
|
const finalCss = finalizeGeneratorCss(prepareFinalGeneratorCss(css), generated.target, {
|
|
3883
2864
|
injectPreflight: preflightMode.inject,
|
|
3884
2865
|
preservePreflight: preflightMode.preserve,
|
|
@@ -3889,7 +2870,7 @@ async function finalizeOrderedGeneratorCss(context) {
|
|
|
3889
2870
|
classSet: resolveGeneratedCssClassSet(generated.target, generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap, options.previousClassSet),
|
|
3890
2871
|
target: generated.target,
|
|
3891
2872
|
source: "generator",
|
|
3892
|
-
dependencies: generated.dependencies,
|
|
2873
|
+
dependencies: [...generated.dependencies],
|
|
3893
2874
|
metadata: {
|
|
3894
2875
|
file,
|
|
3895
2876
|
majorVersion,
|
|
@@ -3899,7 +2880,7 @@ async function finalizeOrderedGeneratorCss(context) {
|
|
|
3899
2880
|
}
|
|
3900
2881
|
}
|
|
3901
2882
|
//#endregion
|
|
3902
|
-
//#region src/
|
|
2883
|
+
//#region src/generation/pipeline/preparation.ts
|
|
3903
2884
|
function resolveGeneratorSourceConcurrency() {
|
|
3904
2885
|
const configured = Number.parseInt(node_process.default.env["WEAPP_TW_GENERATOR_SOURCE_CONCURRENCY"] ?? "", 10);
|
|
3905
2886
|
return Number.isFinite(configured) && configured > 0 ? configured : 1;
|
|
@@ -3920,14 +2901,9 @@ function resolveCompilationDependencies(dependencies) {
|
|
|
3920
2901
|
kind: isSourceStyleRequest(id) ? "css" : "config"
|
|
3921
2902
|
}));
|
|
3922
2903
|
}
|
|
3923
|
-
async function
|
|
3924
|
-
return require_compiler.runCompilerOwnerActivity(context.runtimeState, () => executeGeneratorPipelineWithOwner(context, require_compiler.getCompilationSessionPool(context.runtimeState), require_compiler.getTailwindGenerationSessionPool(context.runtimeState)));
|
|
3925
|
-
}
|
|
3926
|
-
async function executeGeneratorPipelineWithOwner(context, compilationPool, generationSession) {
|
|
2904
|
+
async function prepareGeneratorInputs(context) {
|
|
3927
2905
|
const { cssHandlerOptions, debug, file, generatorBranch, generatorOptions, generatorRawSource, getSourceCandidatesForEntries, hasGeneratedCss, hasGeneratedMarkers, localImports, majorVersion, normalizeGeneratorSource, normalizedCssSources, options, opts, runtime, runtimeState, useMiniProgramCssBranch } = context;
|
|
3928
|
-
|
|
3929
|
-
const compilerSession = options.compilation?.enabled ? require_compiler.getFrameworkCompilerSession(runtimeState, opts) : void 0;
|
|
3930
|
-
const currentCssCandidates = collectGeneratorCssCandidates(generatorRawSource);
|
|
2906
|
+
const currentCssCandidates = (0, _weapp_tailwindcss_postcss_transform.collectGeneratorCssCandidates)(generatorRawSource);
|
|
3931
2907
|
const isolateCurrentCssCandidates = shouldIsolateCurrentTailwindV4CssCandidates(majorVersion, cssHandlerOptions, {
|
|
3932
2908
|
hasGeneratedCss,
|
|
3933
2909
|
hasGeneratedMarkers,
|
|
@@ -3947,46 +2923,65 @@ async function executeGeneratorPipelineWithOwner(context, compilationPool, gener
|
|
|
3947
2923
|
const generatorStyleOptions = resolveGeneratorStyleOptions(opts, cssHandlerOptions, generatorOptions.styleOptions);
|
|
3948
2924
|
const configuredContainerCompat = hasConfiguredContainerCompatSources(generatorSourceRecords.map((record) => record.source));
|
|
3949
2925
|
const sourceConcurrency = resolveGeneratorSourceConcurrency();
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
}
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
isolateCssSource
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
2926
|
+
return {
|
|
2927
|
+
isolateCurrentCssCandidates,
|
|
2928
|
+
runtimeWithCurrentCss,
|
|
2929
|
+
generatorSourceRecords,
|
|
2930
|
+
generatorStyleOptions,
|
|
2931
|
+
configuredContainerCompat,
|
|
2932
|
+
sourceConcurrency,
|
|
2933
|
+
preparedGenerationInputs: (await runWithConcurrency(generatorSourceRecords.map((record, index) => async () => {
|
|
2934
|
+
const { metadata: sourceMetadata, source } = record;
|
|
2935
|
+
const sourceCss = options.deferCssAdaptation ? (0, _weapp_tailwindcss_postcss_transform.removeMatchingLocalCssImports)(source.css, localImports) : source.css;
|
|
2936
|
+
const generatorSource = options.disableSourceScan === true ? {
|
|
2937
|
+
...source,
|
|
2938
|
+
css: (0, _weapp_tailwindcss_postcss_transform.removeTailwindSourceDirectives)(sourceCss, {
|
|
2939
|
+
importFallback: generatorOptions.importFallback,
|
|
2940
|
+
preserveApplyContext: true
|
|
2941
|
+
})
|
|
2942
|
+
} : sourceCss === source.css ? source : {
|
|
2943
|
+
...source,
|
|
2944
|
+
css: sourceCss
|
|
2945
|
+
};
|
|
2946
|
+
const sourceEntries = getSourceCandidatesForEntries ? await resolveGeneratorSourceEntries(record, runtimeState) : void 0;
|
|
2947
|
+
const sourceScopedRuntime = sourceEntries && sourceEntries.length > 0 ? getSourceCandidatesForEntries?.(sourceEntries) : void 0;
|
|
2948
|
+
const scopedRuntime = resolveScopedRuntimeCandidates(options.sourceCandidates, sourceScopedRuntime);
|
|
2949
|
+
const isolateCssSource = shouldIsolateScopedCssSource(majorVersion, record, sourceEntries, {
|
|
2950
|
+
cssHandlerOptions,
|
|
2951
|
+
target: generatorOptions.target
|
|
2952
|
+
});
|
|
2953
|
+
const matchedCssSourceFile = Boolean(sourceMetadata?.matchedCssSourceFile);
|
|
2954
|
+
if (options.deferEmptyScopedCssSource && isolateCssSource && scopedRuntime?.size === 0 && currentCssCandidates.length === 0 && !cssHandlerOptions.isMainChunk) {
|
|
2955
|
+
debug("defer empty scoped css source generation: %s", file);
|
|
2956
|
+
return;
|
|
2957
|
+
}
|
|
2958
|
+
const sourceRuntime = scopedRuntime && (scopedRuntime.size > 0 || isolateCssSource) || isolateCssSource ? isolateCurrentCssCandidates ? runtimeWithCurrentCss : mergeScopedRuntimeWithCurrentRuntime(scopedRuntime ?? /* @__PURE__ */ new Set(), runtimeWithCurrentCss, {
|
|
2959
|
+
currentCssCandidates,
|
|
2960
|
+
cssHandlerOptions,
|
|
2961
|
+
isolateCssSource,
|
|
2962
|
+
majorVersion,
|
|
2963
|
+
matchedCssSourceFile
|
|
2964
|
+
}) : runtimeWithCurrentCss;
|
|
2965
|
+
return {
|
|
2966
|
+
generatorRuntime: require_generator.shouldUseMiniProgramCssBranch(generatorBranch) ? require_generator.filterUnsupportedMiniProgramTailwindV4Candidates(sourceRuntime) : sourceRuntime,
|
|
2967
|
+
generatorSource,
|
|
2968
|
+
dependencies: resolveCompilationDependencies(record.source.dependencies),
|
|
2969
|
+
isolateCssSource,
|
|
2970
|
+
sourceId: resolveCompilationSourceId(record, index)
|
|
2971
|
+
};
|
|
2972
|
+
}), sourceConcurrency)).filter((item) => Boolean(item))
|
|
2973
|
+
};
|
|
2974
|
+
}
|
|
2975
|
+
//#endregion
|
|
2976
|
+
//#region src/generation/pipeline/execution.ts
|
|
2977
|
+
async function executeGeneratorPipeline(context) {
|
|
2978
|
+
return require_compiler.runCompilerOwnerActivity(context.runtimeState, () => executeGeneratorPipelineWithOwner(context, require_compiler.getCompilationSessionPool(context.runtimeState), require_compiler.getTailwindGenerationSessionPool(context.runtimeState)));
|
|
2979
|
+
}
|
|
2980
|
+
async function executeGeneratorPipelineWithOwner(context, compilationPool, generationSession) {
|
|
2981
|
+
const { cssHandlerOptions, debug, file, generatorOptions, generatorRawSource, hasGeneratedCss, hasGeneratedMarkers, localImports, majorVersion, options, opts, runtimeState } = context;
|
|
2982
|
+
await runtimeState.readyPromise;
|
|
2983
|
+
const compilerSession = options.compilation?.enabled ? require_compiler.getFrameworkCompilerSession(runtimeState, opts) : void 0;
|
|
2984
|
+
const { isolateCurrentCssCandidates, runtimeWithCurrentCss, generatorSourceRecords, generatorStyleOptions, configuredContainerCompat, sourceConcurrency, preparedGenerationInputs } = await prepareGeneratorInputs(context);
|
|
3990
2985
|
const generatePreparedInputs = async (candidateSets) => {
|
|
3991
2986
|
return runWithConcurrency(preparedGenerationInputs.map((input) => async () => {
|
|
3992
2987
|
const projectedCandidates = candidateSets?.get(input.sourceId);
|
|
@@ -4038,7 +3033,7 @@ async function executeGeneratorPipelineWithOwner(context, compilationPool, gener
|
|
|
4038
3033
|
dependenciesBySource: results.map((result) => [result.sourceId, resolveCompilationDependencies(result.generated.dependencies)]),
|
|
4039
3034
|
generated: merged,
|
|
4040
3035
|
...compilerSession ? (() => {
|
|
4041
|
-
const snapshots = results.map((result) => result.generated.snapshot).filter((snapshot) => snapshot !== void 0);
|
|
3036
|
+
const snapshots = results.map((result) => "snapshot" in result.generated ? result.generated.snapshot : void 0).filter((snapshot) => snapshot !== void 0);
|
|
4042
3037
|
return snapshots.length > 0 ? { snapshot: compilerSession.mergeSnapshots(snapshots) } : {};
|
|
4043
3038
|
})() : {}
|
|
4044
3039
|
} : void 0;
|
|
@@ -4064,17 +3059,20 @@ async function executeGeneratorPipelineWithOwner(context, compilationPool, gener
|
|
|
4064
3059
|
const appEntryMatchedByCandidates = metadata?.candidateMatchedCssSource === true && metadata.cssEntryIndex === 0 && metadata.cssSourceIndex === void 0;
|
|
4065
3060
|
return metadata?.includesPreflight === true && !appEntryMatchedByCandidates;
|
|
4066
3061
|
});
|
|
4067
|
-
const hasPreflightRawSource =
|
|
3062
|
+
const hasPreflightRawSource = (0, _weapp_tailwindcss_postcss_transform.includesTailwindV4PreflightDirective)(generatorRawSource);
|
|
4068
3063
|
const hasOnlyPrimaryCssSource = generatorSourceRecords.length > 0 && generatorSourceRecords.every(({ metadata }) => {
|
|
4069
3064
|
return metadata?.candidateMatchedCssSource !== true && metadata?.primaryCssSource === true;
|
|
4070
3065
|
});
|
|
4071
|
-
const shouldFilterApplyOnlyCss =
|
|
3066
|
+
const shouldFilterApplyOnlyCss = shouldFilterApplyOnlyGeneratedCss(majorVersion, generated.target, generatorRawSource, {
|
|
4072
3067
|
hasGeneratedCss,
|
|
4073
3068
|
hasGeneratedMarkers
|
|
4074
3069
|
});
|
|
4075
3070
|
const filterGeneratedApplyOnlyCss = (css) => {
|
|
4076
3071
|
if (!shouldFilterApplyOnlyCss) return css;
|
|
4077
|
-
return
|
|
3072
|
+
return (0, _weapp_tailwindcss_postcss_transform.filterTailwindV4ApplyOnlyGeneratedCss)(css, generatorRawSource, {
|
|
3073
|
+
preserveVariables: generated.target !== "web",
|
|
3074
|
+
preserveRuntimeProperties: generated.target === "web" && opts.appType === "uni-app-x"
|
|
3075
|
+
});
|
|
4078
3076
|
};
|
|
4079
3077
|
const preflightMode = resolveMiniProgramPreflightModeForGeneratorCss(opts, {
|
|
4080
3078
|
cssHandlerOptions,
|
|
@@ -4083,6 +3081,8 @@ async function executeGeneratorPipelineWithOwner(context, compilationPool, gener
|
|
|
4083
3081
|
explicitCssSource: hasExplicitCssSource,
|
|
4084
3082
|
primaryCssSource: hasOnlyPrimaryCssSource || hasPreflightCssSource || hasPreflightRawSource
|
|
4085
3083
|
});
|
|
3084
|
+
const compileAuthorCssFunctions = createAuthorCssFunctionCompiler(preparedGenerationInputs.map((input) => input.generatorSource), generationSession);
|
|
3085
|
+
const frameworkProcessedUserCss = options.frameworkProcessedUserCss === void 0 ? void 0 : await compileAuthorCssFunctions(options.frameworkProcessedUserCss);
|
|
4086
3086
|
const outputContext = {
|
|
4087
3087
|
...context,
|
|
4088
3088
|
...compilerSession && options.compilation?.preserveDeletedCss !== true ? { options: {
|
|
@@ -4090,10 +3090,11 @@ async function executeGeneratorPipelineWithOwner(context, compilationPool, gener
|
|
|
4090
3090
|
previousClassSet: void 0,
|
|
4091
3091
|
previousCss: void 0
|
|
4092
3092
|
} } : {},
|
|
3093
|
+
compileAuthorCssFunctions,
|
|
4093
3094
|
configuredContainerCompat,
|
|
4094
3095
|
filterGeneratedApplyOnlyCss,
|
|
4095
3096
|
generated,
|
|
4096
|
-
generatedCss: filterGeneratedApplyOnlyCss(generated.target === "web" ? generated.css :
|
|
3097
|
+
generatedCss: filterGeneratedApplyOnlyCss(generated.target === "web" ? generated.css : (0, _weapp_tailwindcss_postcss_transform.stripTailwindBanner)(generated.css)),
|
|
4097
3098
|
generatorStyleOptions,
|
|
4098
3099
|
hasMatchedCssSourceFile,
|
|
4099
3100
|
isolateCurrentCssCandidates,
|
|
@@ -4102,20 +3103,27 @@ async function executeGeneratorPipelineWithOwner(context, compilationPool, gener
|
|
|
4102
3103
|
shouldFilterApplyOnlyCss
|
|
4103
3104
|
};
|
|
4104
3105
|
const withCompilationMetadata = (result) => {
|
|
3106
|
+
if (result && shouldCheckRpxThemeRisk(runtimeState, generated.target, opts, options.generatorPlatform)) result.rpxThemeVariables = [.../* @__PURE__ */ new Set([...preparedGenerationInputs.flatMap((input) => input.generatorSource.rpxThemeVariables ?? []), ...collectRpxThemeRiskSources([generatorRawSource, ...preparedGenerationInputs.map((input) => input.generatorSource.css)])])];
|
|
3107
|
+
if (result && frameworkProcessedUserCss !== void 0) result = {
|
|
3108
|
+
...result,
|
|
3109
|
+
compileAuthorCssFunctions,
|
|
3110
|
+
frameworkProcessedUserCss
|
|
3111
|
+
};
|
|
4105
3112
|
if (!result || compilationRevision === void 0) return result;
|
|
4106
3113
|
return {
|
|
4107
3114
|
...result,
|
|
3115
|
+
...generated.snapshot ? { snapshot: generated.snapshot } : {},
|
|
4108
3116
|
metadata: {
|
|
3117
|
+
file,
|
|
4109
3118
|
...result.metadata,
|
|
4110
3119
|
revision: compilationRevision
|
|
4111
3120
|
}
|
|
4112
3121
|
};
|
|
4113
3122
|
};
|
|
4114
|
-
|
|
4115
|
-
return withCompilationMetadata(await finalizeOrderedGeneratorCss(outputContext) ?? await finalizeFallbackGeneratorCss(outputContext));
|
|
3123
|
+
return withCompilationMetadata(options.deferCssAdaptation ? await finalizeDeferredGeneratorCss(outputContext) : await finalizeOrderedGeneratorCss(outputContext) ?? await finalizeFallbackGeneratorCss(outputContext));
|
|
4116
3124
|
}
|
|
4117
3125
|
//#endregion
|
|
4118
|
-
//#region src/
|
|
3126
|
+
//#region src/generation/pipeline.ts
|
|
4119
3127
|
function hasPostcssUserPlugins(options) {
|
|
4120
3128
|
const plugins = options.postcssOptions?.plugins;
|
|
4121
3129
|
if (Array.isArray(plugins)) return plugins.length > 0;
|
|
@@ -4123,24 +3131,24 @@ function hasPostcssUserPlugins(options) {
|
|
|
4123
3131
|
}
|
|
4124
3132
|
function shouldProcessDisabledGeneratorCss(rawSource, options) {
|
|
4125
3133
|
if (!hasPostcssUserPlugins(options)) return false;
|
|
4126
|
-
return /@import\s+(?:url\(\s*)?["']tailwindcss(?:\/[^"')\s]*)?["']/.test(rawSource) ||
|
|
3134
|
+
return /@import\s+(?:url\(\s*)?["']tailwindcss(?:\/[^"')\s]*)?["']/.test(rawSource) || (0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyDirective)(rawSource);
|
|
4127
3135
|
}
|
|
4128
3136
|
function parseCssSourceRoot(rawSource) {
|
|
4129
3137
|
try {
|
|
4130
|
-
return
|
|
3138
|
+
return _weapp_tailwindcss_postcss_transform.postcss.parse(rawSource);
|
|
4131
3139
|
} catch {
|
|
4132
3140
|
return;
|
|
4133
3141
|
}
|
|
4134
3142
|
}
|
|
4135
3143
|
function cleanLocalCssImportWrapperFromParsedRoot(rawSource, root) {
|
|
4136
|
-
if (!root) return (0,
|
|
4137
|
-
return (0,
|
|
3144
|
+
if (!root) return (0, _weapp_tailwindcss_postcss_transform.cleanLocalCssImportWrapperTailwindDirectives)(rawSource);
|
|
3145
|
+
return (0, _weapp_tailwindcss_postcss_transform.cleanLocalCssImportWrapperTailwindDirectivesRoot)(root) ? root.toString() : void 0;
|
|
4138
3146
|
}
|
|
4139
3147
|
function isPureLocalCssImportWrapperFromParsedRoot(rawSource, root) {
|
|
4140
|
-
return root ? (0,
|
|
3148
|
+
return root ? (0, _weapp_tailwindcss_postcss_transform.isPureLocalCssImportWrapperRoot)(root) : (0, _weapp_tailwindcss_postcss_transform.isPureLocalCssImportWrapper)(rawSource);
|
|
4141
3149
|
}
|
|
4142
3150
|
function splitLocalCssImportsFromParsedRoot(rawSource, root) {
|
|
4143
|
-
return root ? (0,
|
|
3151
|
+
return root ? (0, _weapp_tailwindcss_postcss_transform.splitLocalCssImportsRoot)(root) : (0, _weapp_tailwindcss_postcss_transform.splitLocalCssImports)(rawSource);
|
|
4144
3152
|
}
|
|
4145
3153
|
async function generateCssByGenerator(options) {
|
|
4146
3154
|
const { opts, runtimeState, runtime, rawSource, file, cssHandlerOptions, cssUserHandlerOptions, getSourceCandidatesForEntries, styleHandler, generatorPlatform, userRawSource, userRawSourceProcessed, debug } = options;
|
|
@@ -4164,10 +3172,10 @@ async function generateCssByGenerator(options) {
|
|
|
4164
3172
|
if (majorVersion !== 4) throw new Error("weapp-tailwindcss 生成管线仅支持 Tailwind CSS v4。");
|
|
4165
3173
|
const useMiniProgramCssBranch = require_generator.shouldUseMiniProgramCssBranch(generatorBranch);
|
|
4166
3174
|
const normalizeGeneratorCssSource = (css) => {
|
|
4167
|
-
return useMiniProgramCssBranch ? normalizeMiniProgramGeneratorCssSource(css, file) : css;
|
|
3175
|
+
return useMiniProgramCssBranch ? (0, _weapp_tailwindcss_postcss_transform.normalizeMiniProgramGeneratorCssSource)(css, file) : css;
|
|
4168
3176
|
};
|
|
4169
3177
|
const normalizeGeneratorSource = (source) => {
|
|
4170
|
-
const css = normalizeGeneratorCssSource(source.css);
|
|
3178
|
+
const css = useMiniProgramCssBranch ? (0, _weapp_tailwindcss_postcss_transform.removeMiniProgramOutputImports)(normalizeGeneratorCssSource(source.css)) : source.css;
|
|
4171
3179
|
return css === source.css ? source : {
|
|
4172
3180
|
...source,
|
|
4173
3181
|
css
|
|
@@ -4192,11 +3200,11 @@ async function generateCssByGenerator(options) {
|
|
|
4192
3200
|
}
|
|
4193
3201
|
return;
|
|
4194
3202
|
}
|
|
4195
|
-
const effectiveRawSource =
|
|
3203
|
+
const effectiveRawSource = (0, _weapp_tailwindcss_postcss_transform.stripUnmatchedTailwindSourceMediaCloseFragments)((0, _weapp_tailwindcss_postcss_transform.stripTailwindSourceMediaFragments)((0, _weapp_tailwindcss_postcss_transform.normalizeEmptyTailwindCustomVariants)(normalizeGeneratorCssSource((0, _weapp_tailwindcss_postcss_transform.normalizeTailwindSourceDirectives)(rawSource, { importFallback: generatorOptions.importFallback })))));
|
|
4196
3204
|
const effectiveRawSourceRoot = parseCssSourceRoot(effectiveRawSource);
|
|
4197
3205
|
const cleanedLocalImportWrapper = cleanLocalCssImportWrapperFromParsedRoot(effectiveRawSource, effectiveRawSourceRoot);
|
|
4198
3206
|
if (cleanedLocalImportWrapper !== void 0) return {
|
|
4199
|
-
css: require_generator.shouldUseMiniProgramCssBranch(generatorBranch) ? (0,
|
|
3207
|
+
css: require_generator.shouldUseMiniProgramCssBranch(generatorBranch) ? (0, _weapp_tailwindcss_postcss_transform.removeUnsupportedMiniProgramAtRules)(cleanedLocalImportWrapper) : cleanedLocalImportWrapper,
|
|
4200
3208
|
classSet: /* @__PURE__ */ new Set(),
|
|
4201
3209
|
target: generatorOptions.target,
|
|
4202
3210
|
source: "generator",
|
|
@@ -4210,26 +3218,26 @@ async function generateCssByGenerator(options) {
|
|
|
4210
3218
|
const localImportParts = splitLocalCssImportsFromParsedRoot(effectiveRawSource, effectiveRawSourceRoot);
|
|
4211
3219
|
const localImports = options.restoreLocalCssImports === false ? void 0 : localImportParts?.imports;
|
|
4212
3220
|
const finalizeGeneratorCss = (css, target, finalizeOptions = {}) => {
|
|
4213
|
-
return finalizeWebGeneratorCss((0,
|
|
3221
|
+
return finalizeWebGeneratorCss((0, _weapp_tailwindcss_postcss_transform.restoreLocalCssImports)(finalizeMiniProgramGeneratorCss(css, target, majorVersion, opts.cssPreflight, finalizeOptions), localImports, { outputFile: file }), target, generatorOptions.webCompat);
|
|
4214
3222
|
};
|
|
4215
3223
|
const generatorRawSource = localImportParts?.source ?? effectiveRawSource;
|
|
4216
|
-
const rawUserSource = userRawSource === void 0 ? generatorRawSource : userRawSourceProcessed ? userRawSource :
|
|
4217
|
-
const userSource = (rawUserSource === generatorRawSource ? void 0 : (0,
|
|
4218
|
-
const userCssRawSource =
|
|
4219
|
-
const hasWebUserCssFallbackSource = userCssRawSource.trim().length > 0 && !
|
|
4220
|
-
const generatedUserCssOrderSource =
|
|
4221
|
-
const generatedUserCssRawSource = generatedUserCssOrderSource ?
|
|
4222
|
-
const userCssOrderSource =
|
|
3224
|
+
const rawUserSource = userRawSource === void 0 ? generatorRawSource : userRawSourceProcessed ? userRawSource : (0, _weapp_tailwindcss_postcss_transform.stripUnmatchedTailwindSourceMediaCloseFragments)((0, _weapp_tailwindcss_postcss_transform.stripTailwindSourceMediaFragments)((0, _weapp_tailwindcss_postcss_transform.normalizeEmptyTailwindCustomVariants)(normalizeGeneratorCssSource((0, _weapp_tailwindcss_postcss_transform.normalizeTailwindSourceDirectives)(userRawSource, { importFallback: generatorOptions.importFallback })))));
|
|
3225
|
+
const userSource = (rawUserSource === generatorRawSource ? void 0 : (0, _weapp_tailwindcss_postcss_transform.splitLocalCssImports)(rawUserSource))?.source ?? rawUserSource;
|
|
3226
|
+
const userCssRawSource = (0, _weapp_tailwindcss_postcss_transform.removeTailwindV4GeneratorAtRules)(userSource);
|
|
3227
|
+
const hasWebUserCssFallbackSource = userCssRawSource.trim().length > 0 && !(0, _weapp_tailwindcss_postcss_transform.isCommentOnlyCss)(userCssRawSource);
|
|
3228
|
+
const generatedUserCssOrderSource = (0, _weapp_tailwindcss_postcss_transform.hasTailwindGeneratedCss)(userSource) ? (0, _weapp_tailwindcss_postcss_transform.splitTailwindV4GeneratedCssBySourceOrder)(userSource, generatorRawSource) : void 0;
|
|
3229
|
+
const generatedUserCssRawSource = generatedUserCssOrderSource ? (0, _weapp_tailwindcss_postcss_transform.createCssAppend)(generatedUserCssOrderSource.before, generatedUserCssOrderSource.after) : (0, _weapp_tailwindcss_postcss_transform.hasTailwindGeneratedCss)(userSource) ? "" : userCssRawSource;
|
|
3230
|
+
const userCssOrderSource = _weapp_tailwindcss_postcss_transform.GENERATOR_PLACEHOLDER_MARKER_RE.test(userSource) ? userSource : (0, _weapp_tailwindcss_postcss_transform.hasTailwindGeneratedCss)(userSource) ? userSource : generatedUserCssRawSource;
|
|
4223
3231
|
const hasDistinctUserRawSource = typeof userRawSource === "string" && normalizeCssSourceForCompare(generatedUserCssRawSource) !== normalizeCssSourceForCompare(generatorRawSource);
|
|
4224
|
-
const legacyCompatUserCssRawSource = generatorOptions.target === "weapp" &&
|
|
3232
|
+
const legacyCompatUserCssRawSource = generatorOptions.target === "weapp" && (0, _weapp_tailwindcss_postcss_transform.hasUserCssLayerBlocks)(generatedUserCssRawSource) ? (0, _weapp_tailwindcss_postcss_transform.splitUserCssLayerBlocks)(generatedUserCssRawSource).rest : generatedUserCssRawSource;
|
|
4225
3233
|
const shouldPreserveLegacyCompatSelectorOverrides = legacyCompatUserCssRawSource !== generatedUserCssRawSource;
|
|
4226
|
-
const shouldDeduplicateUserLayerCss = generatorOptions.target === "weapp" && (
|
|
4227
|
-
const prepareFinalGeneratorCss = (css) => shouldDeduplicateUserLayerCss ? deduplicateGeneratedCssRules(css) : css;
|
|
4228
|
-
const hasGeneratedCss =
|
|
4229
|
-
const hasSourceDirectives =
|
|
4230
|
-
const hasGeneratedMarkers =
|
|
3234
|
+
const shouldDeduplicateUserLayerCss = generatorOptions.target === "weapp" && ((0, _weapp_tailwindcss_postcss_transform.hasUserCssLayerBlocks)(rawUserSource) || (0, _weapp_tailwindcss_postcss_transform.hasUserCssLayerBlocks)(generatorRawSource) || (0, _weapp_tailwindcss_postcss_transform.hasUserCssLayerBlocks)(generatedUserCssRawSource));
|
|
3235
|
+
const prepareFinalGeneratorCss = (css) => shouldDeduplicateUserLayerCss ? (0, _weapp_tailwindcss_postcss_transform.deduplicateGeneratedCssRules)(css) : css;
|
|
3236
|
+
const hasGeneratedCss = (0, _weapp_tailwindcss_postcss_transform.hasTailwindGeneratedCss)(generatorRawSource);
|
|
3237
|
+
const hasSourceDirectives = (0, _weapp_tailwindcss_postcss_transform.hasTailwindSourceDirectives)(generatorRawSource, { importFallback: generatorOptions.importFallback });
|
|
3238
|
+
const hasGeneratedMarkers = (0, _weapp_tailwindcss_postcss_transform.hasTailwindGeneratedCssMarkers)(generatorRawSource);
|
|
4231
3239
|
const normalizedCssSources = options.cssSources?.map((source) => {
|
|
4232
|
-
const css = normalizeGeneratorCssSource(
|
|
3240
|
+
const css = normalizeGeneratorCssSource((0, _weapp_tailwindcss_postcss_transform.normalizeEmptyTailwindCustomVariants)(source.css));
|
|
4233
3241
|
return css === source.css ? source : {
|
|
4234
3242
|
...source,
|
|
4235
3243
|
css
|
|
@@ -4285,7 +3293,7 @@ async function generateCssByGenerator(options) {
|
|
|
4285
3293
|
}
|
|
4286
3294
|
}
|
|
4287
3295
|
//#endregion
|
|
4288
|
-
//#region src/
|
|
3296
|
+
//#region src/generation/validate.ts
|
|
4289
3297
|
async function validateCandidatesByGenerator(options) {
|
|
4290
3298
|
return require_compiler.runCompilerOwnerActivity(options.runtimeState, () => validateCandidatesByGeneratorWithOwner(options, require_compiler.getTailwindGenerationSessionPool(options.runtimeState)));
|
|
4291
3299
|
}
|
|
@@ -4317,7 +3325,7 @@ async function validateCandidatesByGeneratorWithOwner(options, generationSession
|
|
|
4317
3325
|
return classSet;
|
|
4318
3326
|
}
|
|
4319
3327
|
//#endregion
|
|
4320
|
-
//#region src/
|
|
3328
|
+
//#region src/generation/service.ts
|
|
4321
3329
|
function resolveGenerationOptions(options, mode) {
|
|
4322
3330
|
const physicalFile = stripRequestQuery(options.file);
|
|
4323
3331
|
const normalizedOptions = physicalFile === options.file ? options : {
|
|
@@ -4350,7 +3358,7 @@ function createCoreArtifact(generated, css, options) {
|
|
|
4350
3358
|
scope,
|
|
4351
3359
|
stage: "adapted"
|
|
4352
3360
|
})], {
|
|
4353
|
-
classSet: generated.classSet,
|
|
3361
|
+
classSet: new Set(generated.classSet),
|
|
4354
3362
|
rawCandidates: options.runtime,
|
|
4355
3363
|
dependencies: generated.dependencies,
|
|
4356
3364
|
sourceEntries: options.cssHandlerOptions.sourceOptions?.cssEntries ?? [],
|
|
@@ -4367,10 +3375,11 @@ async function generateTailwindV4CssWithImplementation(options, implementation)
|
|
|
4367
3375
|
tailwindcssMajorVersion: majorVersion,
|
|
4368
3376
|
uniAppX: options.opts.uniAppX
|
|
4369
3377
|
});
|
|
4370
|
-
const shouldReplayFrameworkPostcss = options.cssStage === "framework-processed" && hasFrameworkPostcssOptions(frameworkPostcssOwner)
|
|
3378
|
+
const shouldReplayFrameworkPostcss = options.cssStage === "framework-processed" && hasFrameworkPostcssOptions(frameworkPostcssOwner);
|
|
4371
3379
|
const generationInput = !shouldReplayFrameworkPostcss && options.frameworkProcessedUserCss ? {
|
|
4372
3380
|
...options,
|
|
4373
|
-
userRawSource: [options.userRawSource, options.frameworkProcessedUserCss].filter(Boolean).join("\n")
|
|
3381
|
+
userRawSource: [options.userRawSource, options.frameworkProcessedUserCss].filter(Boolean).join("\n"),
|
|
3382
|
+
frameworkProcessedUserCss: void 0
|
|
4374
3383
|
} : options;
|
|
4375
3384
|
const scope = options.scope ?? {
|
|
4376
3385
|
id: options.outputFile ?? options.file,
|
|
@@ -4378,13 +3387,14 @@ async function generateTailwindV4CssWithImplementation(options, implementation)
|
|
|
4378
3387
|
};
|
|
4379
3388
|
const generated = await generateCssByGenerator(shouldReplayFrameworkPostcss ? {
|
|
4380
3389
|
...generationInput,
|
|
3390
|
+
frameworkProcessedUserCss: options.frameworkProcessedUserCss === void 0 ? void 0 : (0, _weapp_tailwindcss_postcss_transform.normalizeFrameworkProcessedUserCss)(options.frameworkProcessedUserCss),
|
|
4381
3391
|
compilation: implementation.frameworkAdapter === "graph" ? {
|
|
4382
3392
|
enabled: true,
|
|
4383
3393
|
preserveDeletedCss: normalizedGeneratorOptions.hmr?.preserveDeletedCss ?? true,
|
|
4384
3394
|
scope,
|
|
4385
3395
|
...options.compilationChanges === void 0 ? {} : { changes: options.compilationChanges }
|
|
4386
3396
|
} : void 0,
|
|
4387
|
-
deferCssAdaptation:
|
|
3397
|
+
deferCssAdaptation: normalizedGeneratorOptions.target === "weapp"
|
|
4388
3398
|
} : {
|
|
4389
3399
|
...generationInput,
|
|
4390
3400
|
compilation: implementation.frameworkAdapter === "graph" ? {
|
|
@@ -4406,15 +3416,17 @@ async function generateTailwindV4CssWithImplementation(options, implementation)
|
|
|
4406
3416
|
snapshot: generated.snapshot
|
|
4407
3417
|
} : {}
|
|
4408
3418
|
}) : generated.css;
|
|
4409
|
-
const composedCss = shouldReplayFrameworkPostcss && options.frameworkProcessedUserCss ? await restoreFrameworkProcessedUserCss(adaptedCss, generated, options.frameworkProcessedUserCss, options, normalizedGeneratorOptions) : adaptedCss;
|
|
4410
|
-
const css = isVueScopedStyleRequest(resolvePostcssRequestOption(options.cssHandlerOptions)) ?
|
|
4411
|
-
const classSet = options.frameworkProcessedUserCss ? resolveGeneratedCssClassSet(generated.target, generated.classSet, options.runtime, css, options.opts.escapeMap, options.previousClassSet) : generated.classSet;
|
|
3419
|
+
const composedCss = shouldReplayFrameworkPostcss && options.frameworkProcessedUserCss ? await restoreFrameworkProcessedUserCss(adaptedCss, generated, generated.frameworkProcessedUserCss ?? options.frameworkProcessedUserCss, options, normalizedGeneratorOptions) : adaptedCss;
|
|
3420
|
+
const css = isVueScopedStyleRequest(resolvePostcssRequestOption(options.cssHandlerOptions)) ? (0, _weapp_tailwindcss_postcss_transform.preferScopedGeneratedCssRules)(composedCss) : composedCss;
|
|
3421
|
+
const classSet = options.frameworkProcessedUserCss ? resolveGeneratedCssClassSet(generated.target, generated.classSet, options.runtime, css, options.opts.escapeMap, options.previousClassSet) : new Set(generated.classSet);
|
|
3422
|
+
if (shouldCheckRpxThemeRisk(options.runtimeState, generated.target, options.opts, options.generatorPlatform)) warnRpxThemeRisk(options.runtimeState, generated.rpxThemeVariables ?? [], css);
|
|
4412
3423
|
const artifact = implementation.emitArtifact ? createCoreArtifact({
|
|
4413
3424
|
...generated,
|
|
4414
3425
|
classSet
|
|
4415
3426
|
}, css, options) : void 0;
|
|
3427
|
+
const { compileAuthorCssFunctions: _compileAuthorCssFunctions, ...generatedRest } = generated;
|
|
4416
3428
|
return {
|
|
4417
|
-
...
|
|
3429
|
+
...generatedRest,
|
|
4418
3430
|
...artifact ? { artifact } : {},
|
|
4419
3431
|
css,
|
|
4420
3432
|
classSet,
|
|
@@ -4457,6 +3469,47 @@ async function generateTailwindV4Css(options) {
|
|
|
4457
3469
|
return legacy;
|
|
4458
3470
|
}
|
|
4459
3471
|
//#endregion
|
|
3472
|
+
//#region src/bundlers/shared/css-source-trace.ts
|
|
3473
|
+
function normalizeSourcePath(source, root) {
|
|
3474
|
+
const resolvedRoot = node_path.default.resolve(root);
|
|
3475
|
+
const resolvedSource = node_path.default.resolve(source);
|
|
3476
|
+
const relative = node_path.default.relative(resolvedRoot, resolvedSource);
|
|
3477
|
+
if (relative && !relative.startsWith("..") && !node_path.default.isAbsolute(relative)) return relative.split(node_path.default.sep).join("/");
|
|
3478
|
+
return source.split(node_path.default.sep).join("/");
|
|
3479
|
+
}
|
|
3480
|
+
function getSourceTraceRoot(opts) {
|
|
3481
|
+
const configured = opts.cssSourceTrace;
|
|
3482
|
+
if (configured && typeof configured === "object" && configured.root) return configured.root;
|
|
3483
|
+
return opts.tailwindcssBasedir ?? node_process.default.cwd();
|
|
3484
|
+
}
|
|
3485
|
+
function isCssSourceTraceEnabled(opts) {
|
|
3486
|
+
return opts.cssSourceTrace === true || typeof opts.cssSourceTrace === "object" && opts.cssSourceTrace !== null;
|
|
3487
|
+
}
|
|
3488
|
+
function createCssTokenSourceMap(sourcesByToken, opts) {
|
|
3489
|
+
const root = getSourceTraceRoot(opts);
|
|
3490
|
+
const tokenSources = /* @__PURE__ */ new Map();
|
|
3491
|
+
for (const [token, sources] of [...sourcesByToken.entries()].sort(([a], [b]) => a.localeCompare(b))) {
|
|
3492
|
+
const source = {
|
|
3493
|
+
token,
|
|
3494
|
+
sources: [...sources].map((file) => normalizeSourcePath(file, root)).sort()
|
|
3495
|
+
};
|
|
3496
|
+
tokenSources.set(token, source);
|
|
3497
|
+
const escaped = require_compiler.replaceWxml(token, { escapeMap: opts.escapeMap });
|
|
3498
|
+
tokenSources.set(escaped, source);
|
|
3499
|
+
tokenSources.set(escaped.replaceAll("\\", ""), source);
|
|
3500
|
+
}
|
|
3501
|
+
return tokenSources;
|
|
3502
|
+
}
|
|
3503
|
+
function createCssSourceTraceCacheSignature(tokenSources, opts) {
|
|
3504
|
+
if (!isCssSourceTraceEnabled(opts)) return "css-source-trace:0";
|
|
3505
|
+
if (!tokenSources?.size) return "css-source-trace:1:empty";
|
|
3506
|
+
return `css-source-trace:1:${[...tokenSources.values()].map(({ token, sources }) => `${token}<=${sources.join(",")}`).sort().join("|")}`;
|
|
3507
|
+
}
|
|
3508
|
+
function annotateCssSourceTrace(css, options) {
|
|
3509
|
+
if (!isCssSourceTraceEnabled(options.opts) || !options.tokenSources?.size) return css;
|
|
3510
|
+
return (0, _weapp_tailwindcss_postcss_transform.annotateCssTokenSources)(css, options.tokenSources);
|
|
3511
|
+
}
|
|
3512
|
+
//#endregion
|
|
4460
3513
|
Object.defineProperty(exports, "annotateCssSourceTrace", {
|
|
4461
3514
|
enumerable: true,
|
|
4462
3515
|
get: function() {
|
|
@@ -4493,30 +3546,12 @@ Object.defineProperty(exports, "collectGeneratedRawSourceCandidatesFromCss", {
|
|
|
4493
3546
|
return collectGeneratedRawSourceCandidatesFromCss;
|
|
4494
3547
|
}
|
|
4495
3548
|
});
|
|
4496
|
-
Object.defineProperty(exports, "collectRawSourceClassSelectors", {
|
|
4497
|
-
enumerable: true,
|
|
4498
|
-
get: function() {
|
|
4499
|
-
return collectRawSourceClassSelectors;
|
|
4500
|
-
}
|
|
4501
|
-
});
|
|
4502
3549
|
Object.defineProperty(exports, "collectStrictEscapedRuntimeCandidates", {
|
|
4503
3550
|
enumerable: true,
|
|
4504
3551
|
get: function() {
|
|
4505
3552
|
return collectStrictEscapedRuntimeCandidates;
|
|
4506
3553
|
}
|
|
4507
3554
|
});
|
|
4508
|
-
Object.defineProperty(exports, "createBundlerGeneratedCssMarker", {
|
|
4509
|
-
enumerable: true,
|
|
4510
|
-
get: function() {
|
|
4511
|
-
return createBundlerGeneratedCssMarker;
|
|
4512
|
-
}
|
|
4513
|
-
});
|
|
4514
|
-
Object.defineProperty(exports, "createCssSourceOrderAppend", {
|
|
4515
|
-
enumerable: true,
|
|
4516
|
-
get: function() {
|
|
4517
|
-
return createCssSourceOrderAppend;
|
|
4518
|
-
}
|
|
4519
|
-
});
|
|
4520
3555
|
Object.defineProperty(exports, "createCssSourceTraceCacheSignature", {
|
|
4521
3556
|
enumerable: true,
|
|
4522
3557
|
get: function() {
|
|
@@ -4559,12 +3594,6 @@ Object.defineProperty(exports, "extractCandidatesFromSource", {
|
|
|
4559
3594
|
return extractCandidatesFromSource;
|
|
4560
3595
|
}
|
|
4561
3596
|
});
|
|
4562
|
-
Object.defineProperty(exports, "extractMarkedUserLayerComponentsCss", {
|
|
4563
|
-
enumerable: true,
|
|
4564
|
-
get: function() {
|
|
4565
|
-
return extractMarkedUserLayerComponentsCss;
|
|
4566
|
-
}
|
|
4567
|
-
});
|
|
4568
3597
|
Object.defineProperty(exports, "finalizeMiniProgramGeneratorCss", {
|
|
4569
3598
|
enumerable: true,
|
|
4570
3599
|
get: function() {
|
|
@@ -4577,12 +3606,6 @@ Object.defineProperty(exports, "generateTailwindV4Css", {
|
|
|
4577
3606
|
return generateTailwindV4Css;
|
|
4578
3607
|
}
|
|
4579
3608
|
});
|
|
4580
|
-
Object.defineProperty(exports, "hasBundlerGeneratedCssMarker", {
|
|
4581
|
-
enumerable: true,
|
|
4582
|
-
get: function() {
|
|
4583
|
-
return hasBundlerGeneratedCssMarker;
|
|
4584
|
-
}
|
|
4585
|
-
});
|
|
4586
3609
|
Object.defineProperty(exports, "hasMiniProgramTailwindV4PreflightReset", {
|
|
4587
3610
|
enumerable: true,
|
|
4588
3611
|
get: function() {
|
|
@@ -4613,42 +3636,12 @@ Object.defineProperty(exports, "isSourceStyleRequest", {
|
|
|
4613
3636
|
return isSourceStyleRequest;
|
|
4614
3637
|
}
|
|
4615
3638
|
});
|
|
4616
|
-
Object.defineProperty(exports, "mergeMarkedUserLayerComponentsCss", {
|
|
4617
|
-
enumerable: true,
|
|
4618
|
-
get: function() {
|
|
4619
|
-
return mergeMarkedUserLayerComponentsCss;
|
|
4620
|
-
}
|
|
4621
|
-
});
|
|
4622
|
-
Object.defineProperty(exports, "normalizeMiniProgramGeneratorCssSource", {
|
|
4623
|
-
enumerable: true,
|
|
4624
|
-
get: function() {
|
|
4625
|
-
return normalizeMiniProgramGeneratorCssSource;
|
|
4626
|
-
}
|
|
4627
|
-
});
|
|
4628
|
-
Object.defineProperty(exports, "normalizeMiniProgramImportShell", {
|
|
4629
|
-
enumerable: true,
|
|
4630
|
-
get: function() {
|
|
4631
|
-
return normalizeMiniProgramImportShell;
|
|
4632
|
-
}
|
|
4633
|
-
});
|
|
4634
|
-
Object.defineProperty(exports, "parseBundlerGeneratedCssMarkerBlocks", {
|
|
4635
|
-
enumerable: true,
|
|
4636
|
-
get: function() {
|
|
4637
|
-
return parseBundlerGeneratedCssMarkerBlocks;
|
|
4638
|
-
}
|
|
4639
|
-
});
|
|
4640
3639
|
Object.defineProperty(exports, "pushConcurrentTaskFactories", {
|
|
4641
3640
|
enumerable: true,
|
|
4642
3641
|
get: function() {
|
|
4643
3642
|
return pushConcurrentTaskFactories;
|
|
4644
3643
|
}
|
|
4645
3644
|
});
|
|
4646
|
-
Object.defineProperty(exports, "removeGeneratedSelectorCompatCss", {
|
|
4647
|
-
enumerable: true,
|
|
4648
|
-
get: function() {
|
|
4649
|
-
return removeGeneratedSelectorCompatCss;
|
|
4650
|
-
}
|
|
4651
|
-
});
|
|
4652
3645
|
Object.defineProperty(exports, "resolveCompilerMode", {
|
|
4653
3646
|
enumerable: true,
|
|
4654
3647
|
get: function() {
|
|
@@ -4679,12 +3672,6 @@ Object.defineProperty(exports, "scoreTailwindV4CssSourceFileMatch", {
|
|
|
4679
3672
|
return scoreTailwindV4CssSourceFileMatch;
|
|
4680
3673
|
}
|
|
4681
3674
|
});
|
|
4682
|
-
Object.defineProperty(exports, "stripBundlerGeneratedCssMarkers", {
|
|
4683
|
-
enumerable: true,
|
|
4684
|
-
get: function() {
|
|
4685
|
-
return stripBundlerGeneratedCssMarkers;
|
|
4686
|
-
}
|
|
4687
|
-
});
|
|
4688
3675
|
Object.defineProperty(exports, "stripRequestQuery", {
|
|
4689
3676
|
enumerable: true,
|
|
4690
3677
|
get: function() {
|