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,22 +1,22 @@
|
|
|
1
|
-
const require_rolldown_runtime = require("./rolldown-runtime-
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-fg3euq-1.cjs");
|
|
2
2
|
const require_framework = require("./framework.cjs");
|
|
3
|
-
const require_generator = require("./generator-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const require_hmr_timing = require("./hmr-timing-
|
|
9
|
-
const require_source_candidate_scan_signature = require("./source-candidate-scan-signature-
|
|
10
|
-
const require_css_imports = require("./css-imports-
|
|
3
|
+
const require_generator = require("./generator-CxauQbx3.cjs");
|
|
4
|
+
const require_compiler = require("./compiler-DkGY5Nmh.cjs");
|
|
5
|
+
const require_runtime_state = require("./runtime-state-BOzuVoKl.cjs");
|
|
6
|
+
const require_tailwindcss = require("./tailwindcss-U3KIUegn.cjs");
|
|
7
|
+
const require_generated_css_marker = require("./generated-css-marker-jMNbQHpy.cjs");
|
|
8
|
+
const require_hmr_timing = require("./hmr-timing-DfMbbZ1E.cjs");
|
|
9
|
+
const require_source_candidate_scan_signature = require("./source-candidate-scan-signature-nG-rg809.cjs");
|
|
10
|
+
const require_css_imports = require("./css-imports-R_RDMjPz.cjs");
|
|
11
11
|
let node_fs = require("node:fs");
|
|
12
12
|
let node_path = require("node:path");
|
|
13
13
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
14
14
|
let node_process = require("node:process");
|
|
15
15
|
node_process = require_rolldown_runtime.__toESM(node_process, 1);
|
|
16
|
-
let
|
|
16
|
+
let _weapp_tailwindcss_postcss_transform = require("@weapp-tailwindcss/postcss/transform");
|
|
17
17
|
let lru_cache = require("lru-cache");
|
|
18
|
-
let node_fs_promises = require("node:fs/promises");
|
|
19
18
|
let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
|
|
19
|
+
let node_fs_promises = require("node:fs/promises");
|
|
20
20
|
let _weapp_tailwindcss_logger = require("@weapp-tailwindcss/logger");
|
|
21
21
|
let node_url = require("node:url");
|
|
22
22
|
let weapp_style_injector_vite = require("weapp-style-injector/vite");
|
|
@@ -208,6 +208,19 @@ function createViteCssAssetIdentityResolver(options) {
|
|
|
208
208
|
};
|
|
209
209
|
}
|
|
210
210
|
//#endregion
|
|
211
|
+
//#region src/bundlers/vite/processed-css-assets/style-files.ts
|
|
212
|
+
const CSS_OUTPUT_FILE_RE = /\.(?:css|wxss|acss|ttss|qss|jxss|tyss)(?:$|[?#])/i;
|
|
213
|
+
function isCssOutputFile(file) {
|
|
214
|
+
return CSS_OUTPUT_FILE_RE.test(file);
|
|
215
|
+
}
|
|
216
|
+
function isRootStyleOutputFile(file) {
|
|
217
|
+
const normalized = require_source_candidate_scan_signature.normalizeOutputPathKey(file.replace(/[?#].*$/, ""));
|
|
218
|
+
return isCssOutputFile(normalized) && !normalized.includes("/");
|
|
219
|
+
}
|
|
220
|
+
function isMiniProgramStyleOutputFile(file) {
|
|
221
|
+
return /\.(?:wxss|acss|ttss|qss|jxss|tyss)(?:$|[?#])/i.test(file);
|
|
222
|
+
}
|
|
223
|
+
//#endregion
|
|
211
224
|
//#region src/bundlers/vite/css-handler-options.ts
|
|
212
225
|
function resolveViteCssHandlerExtraOptions(file) {
|
|
213
226
|
return require_source_candidate_scan_signature.normalizeOutputPathKey(file.replace(/[?#].*$/, "")).includes("/") ? { isMainChunk: false } : {};
|
|
@@ -220,7 +233,7 @@ function createCssHandlerOptionsCache(options) {
|
|
|
220
233
|
const appType = options.getAppType();
|
|
221
234
|
const isMainChunk = options.mainCssChunkMatcher(file, appType);
|
|
222
235
|
const outputRoot = options.getOutputRoot?.();
|
|
223
|
-
const sourceFile =
|
|
236
|
+
const sourceFile = require_generated_css_marker.stripRequestQuery(file);
|
|
224
237
|
const from = node_path.default.isAbsolute(sourceFile) ? sourceFile : outputRoot ? node_path.default.resolve(outputRoot, sourceFile) : sourceFile;
|
|
225
238
|
const extraOptions = options.getExtraOptions?.(file) ?? {};
|
|
226
239
|
const dynamicCssOptions = options.getDynamicCssOptions?.() ?? {};
|
|
@@ -268,7 +281,7 @@ const isWindows = node_process.default.platform === "win32";
|
|
|
268
281
|
const cssLangRE = new RegExp(`\\.(?:css|less|sass|scss|styl|stylus|pcss|postcss)(?:$|\\?)`);
|
|
269
282
|
const htmlLangRE = /\.html?(?:$|\?)/;
|
|
270
283
|
function isCSSRequest(request) {
|
|
271
|
-
return cssLangRE.test(request) ||
|
|
284
|
+
return cssLangRE.test(request) || require_generated_css_marker.isSourceStyleRequest(request);
|
|
272
285
|
}
|
|
273
286
|
function isWeappViteSidecarRequest(request) {
|
|
274
287
|
const queryIndex = request.indexOf("?");
|
|
@@ -306,7 +319,6 @@ async function formatPostcssSourceMap(rawMap, file) {
|
|
|
306
319
|
//#region src/bundlers/vite/css-output.ts
|
|
307
320
|
const SOURCE_STYLE_OUTPUT_EXT_RE = /\.(?:less|sass|scss|styl|stylus|pcss|postcss)$/i;
|
|
308
321
|
const CSS_SOURCE_OUTPUT_EXT_RE = /\.(?:css|less|sass|scss|styl|stylus|pcss|postcss)$/i;
|
|
309
|
-
const SOURCE_STYLE_NON_CSS_SYNTAX_RE = /(?:^|\n)\s*(?:\/\/|\$[\w-]+\s*:|@(?:use|forward|mixin|include|function)\b)/;
|
|
310
322
|
const FALLBACK_STYLE_OUTPUT_EXTENSION = ".css";
|
|
311
323
|
const COMMON_MINI_PROGRAM_STYLE_OUTPUT_EXTENSIONS = [
|
|
312
324
|
".wxss",
|
|
@@ -457,13 +469,7 @@ function resolveViteCssPipelineOutputFileFromSourceFile(sourceFile, opts, rootDi
|
|
|
457
469
|
return cleanFile.replace(CSS_SOURCE_OUTPUT_EXT_RE, styleExtension);
|
|
458
470
|
}
|
|
459
471
|
function canProcessViteSourceStyleAsCss(source, file) {
|
|
460
|
-
|
|
461
|
-
try {
|
|
462
|
-
_weapp_tailwindcss_postcss.postcss.parse(source, { from: file });
|
|
463
|
-
return true;
|
|
464
|
-
} catch {
|
|
465
|
-
return false;
|
|
466
|
-
}
|
|
472
|
+
return (0, _weapp_tailwindcss_postcss_transform.canProcessSourceStyleAsCss)(source, file);
|
|
467
473
|
}
|
|
468
474
|
function normalizeCssSourceForCompare(css) {
|
|
469
475
|
return css.trim();
|
|
@@ -920,19 +926,6 @@ const mix = (del = delimiter) => {
|
|
|
920
926
|
const posix = /* @__PURE__ */ mix(":");
|
|
921
927
|
const win32 = /* @__PURE__ */ mix(";");
|
|
922
928
|
//#endregion
|
|
923
|
-
//#region src/bundlers/vite/processed-css-assets/style-files.ts
|
|
924
|
-
const CSS_OUTPUT_FILE_RE = /\.(?:css|wxss|acss|ttss|qss|jxss|tyss)(?:$|[?#])/i;
|
|
925
|
-
function isCssOutputFile(file) {
|
|
926
|
-
return CSS_OUTPUT_FILE_RE.test(file);
|
|
927
|
-
}
|
|
928
|
-
function isRootStyleOutputFile(file) {
|
|
929
|
-
const normalized = require_source_candidate_scan_signature.normalizeOutputPathKey(file.replace(/[?#].*$/, ""));
|
|
930
|
-
return isCssOutputFile(normalized) && !normalized.includes("/");
|
|
931
|
-
}
|
|
932
|
-
function isMiniProgramStyleOutputFile(file) {
|
|
933
|
-
return /\.(?:wxss|acss|ttss|qss|jxss|tyss)(?:$|[?#])/i.test(file);
|
|
934
|
-
}
|
|
935
|
-
//#endregion
|
|
936
929
|
//#region src/bundlers/vite/processed-css-assets/markers-imports.ts
|
|
937
930
|
function createCssAssetPipelineContext(options, file, bundle) {
|
|
938
931
|
const context = options.createCssPipelineContext?.(file);
|
|
@@ -958,9 +951,6 @@ function appendCss(baseCss, css) {
|
|
|
958
951
|
function normalizeCssRecordIdentity(css) {
|
|
959
952
|
return css.trim();
|
|
960
953
|
}
|
|
961
|
-
function hasNonCommentCss(css) {
|
|
962
|
-
return css.replace(/\/\*[\s\S]*?\*\//g, "").trim().length > 0;
|
|
963
|
-
}
|
|
964
954
|
function dedupeViteCssResults(records) {
|
|
965
955
|
const seen = /* @__PURE__ */ new Set();
|
|
966
956
|
return records.filter((record) => {
|
|
@@ -970,101 +960,24 @@ function dedupeViteCssResults(records) {
|
|
|
970
960
|
return true;
|
|
971
961
|
});
|
|
972
962
|
}
|
|
973
|
-
function removeTailwindSourceMediaWrappersRoot(root) {
|
|
974
|
-
let changed = false;
|
|
975
|
-
root.walkAtRules("media", (atRule) => {
|
|
976
|
-
if (!atRule.params.startsWith("source(")) return;
|
|
977
|
-
if (atRule.nodes && atRule.nodes.length > 0) atRule.replaceWith(...atRule.nodes);
|
|
978
|
-
else atRule.remove();
|
|
979
|
-
changed = true;
|
|
980
|
-
});
|
|
981
|
-
if (changed) root.walkAtRules((atRule) => {
|
|
982
|
-
if (atRule.nodes && atRule.nodes.length === 0) atRule.remove();
|
|
983
|
-
});
|
|
984
|
-
return changed;
|
|
985
|
-
}
|
|
986
|
-
function removeTailwindSourceMediaWrappersFallback(css) {
|
|
987
|
-
return css.replace(/@media\s+source\([^)]*\)\s*\{\s*\/\*!\s*weapp-tailwindcss generator-placeholder\s*\*\/?\s*\}/gi, "").replace(/@media\s+source\([^)]*\)\s*\{\s*\}/gi, "");
|
|
988
|
-
}
|
|
989
|
-
function removeTailwindEntryDirectivesFromCss(css) {
|
|
990
|
-
try {
|
|
991
|
-
const source = require_generator.stripGeneratorPlaceholderMarkers(css);
|
|
992
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(source);
|
|
993
|
-
const removedMediaWrappers = removeTailwindSourceMediaWrappersRoot(root);
|
|
994
|
-
const removedTailwindDirectives = (0, _weapp_tailwindcss_postcss.removeTailwindSourceDirectivesRoot)(root);
|
|
995
|
-
return removedMediaWrappers || removedTailwindDirectives ? root.toString() : source;
|
|
996
|
-
} catch {
|
|
997
|
-
return require_generator.removeTailwindSourceDirectives(removeTailwindSourceMediaWrappersFallback(css));
|
|
998
|
-
}
|
|
999
|
-
}
|
|
1000
|
-
function removeUnsupportedMiniProgramCssImportsFallback(css, file) {
|
|
1001
|
-
if (!isMiniProgramStyleOutputFile(file) || !css.includes("@import")) return css;
|
|
1002
|
-
return css.split(/\r?\n/).filter((line) => {
|
|
1003
|
-
const trimmed = line.trim();
|
|
1004
|
-
if (!trimmed.startsWith("@import")) return true;
|
|
1005
|
-
const params = trimmed.slice(7).trim().replace(/;$/, "").trim();
|
|
1006
|
-
const request = (0, _weapp_tailwindcss_postcss.parseTailwindCssDirectiveRequest)(params);
|
|
1007
|
-
return request === void 0 || (0, _weapp_tailwindcss_postcss.isMiniProgramLocalCssImportRequest)(request);
|
|
1008
|
-
}).join("\n");
|
|
1009
|
-
}
|
|
1010
963
|
function normalizeInjectableCssForTarget(css, file) {
|
|
1011
964
|
return normalizeInjectableCssForTargetWithImports(css, file).css;
|
|
1012
965
|
}
|
|
1013
966
|
function normalizeInjectableCssForTargetWithImports(css, file) {
|
|
1014
|
-
|
|
1015
|
-
css,
|
|
1016
|
-
importedStyleFiles: /* @__PURE__ */ new Set()
|
|
1017
|
-
};
|
|
1018
|
-
try {
|
|
1019
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
1020
|
-
const changed = isMiniProgramStyleOutputFile(file) ? (0, _weapp_tailwindcss_postcss.removeUnsupportedMiniProgramCssImportsRoot)(root) : false;
|
|
1021
|
-
const importedStyleFiles = collectImportedStyleFilesRoot(root, file);
|
|
1022
|
-
return {
|
|
1023
|
-
css: changed ? root.toString() : css,
|
|
1024
|
-
importedStyleFiles: importedStyleFiles.size > 0 ? importedStyleFiles : collectImportedStyleFilesFallback(css, file)
|
|
1025
|
-
};
|
|
1026
|
-
} catch {
|
|
1027
|
-
const fallbackCss = removeUnsupportedMiniProgramCssImportsFallback(css, file);
|
|
1028
|
-
return {
|
|
1029
|
-
css: fallbackCss,
|
|
1030
|
-
importedStyleFiles: collectImportedStyleFiles(fallbackCss, file)
|
|
1031
|
-
};
|
|
1032
|
-
}
|
|
967
|
+
return (0, _weapp_tailwindcss_postcss_transform.normalizeInjectableCssWithImports)(css, isMiniProgramStyleOutputFile(file), (request) => resolveImportedStyleFile(file, request));
|
|
1033
968
|
}
|
|
1034
969
|
function stripStyleExtension(file) {
|
|
1035
970
|
return file.replace(/[?#].*$/, "").replace(/\.(?:css|wxss|acss|ttss|qss|jxss|tyss|scss|sass|less|styl|stylus|pcss|postcss)$/i, "");
|
|
1036
971
|
}
|
|
1037
|
-
function isStyleImportRequest(request) {
|
|
1038
|
-
return typeof request === "string" && request.length > 0 && !/^(?:https?:)?\/\//i.test(request) && /\.(?:css|wxss|acss|ttss|qss|jxss|tyss)(?:$|[?#])/i.test(request);
|
|
1039
|
-
}
|
|
1040
972
|
function resolveImportedStyleFile(targetFile, request) {
|
|
1041
|
-
if (!isStyleImportRequest(request)) return;
|
|
973
|
+
if (!(0, _weapp_tailwindcss_postcss_transform.isStyleImportRequest)(request)) return;
|
|
1042
974
|
const cleanRequest = request.replace(/[?#].*$/, "");
|
|
1043
975
|
if (cleanRequest.startsWith("/")) return require_source_candidate_scan_signature.normalizeOutputPathKey(cleanRequest.slice(1));
|
|
1044
976
|
const targetDir = posix.posix.dirname(require_source_candidate_scan_signature.normalizeOutputPathKey(targetFile));
|
|
1045
977
|
return require_source_candidate_scan_signature.normalizeOutputPathKey(posix.posix.join(targetDir === "." ? "" : targetDir, cleanRequest));
|
|
1046
978
|
}
|
|
1047
|
-
function collectImportedStyleFilesFromRequests(requests, targetFile) {
|
|
1048
|
-
const imports = /* @__PURE__ */ new Set();
|
|
1049
|
-
for (const request of requests) {
|
|
1050
|
-
const importedFile = resolveImportedStyleFile(targetFile, request);
|
|
1051
|
-
if (importedFile) imports.add(importedFile);
|
|
1052
|
-
}
|
|
1053
|
-
return imports;
|
|
1054
|
-
}
|
|
1055
|
-
function collectImportedStyleFilesRoot(root, targetFile) {
|
|
1056
|
-
return collectImportedStyleFilesFromRequests((0, _weapp_tailwindcss_postcss.collectCssImportRequestsRoot)(root), targetFile);
|
|
1057
|
-
}
|
|
1058
|
-
function collectImportedStyleFilesFallback(css, targetFile) {
|
|
1059
|
-
return collectImportedStyleFilesFromRequests([...css.matchAll(/@import\s+(?:url\(\s*)?(?:"([^"]+)"|'([^']+)'|([^\s;)]+))/g)].map((match) => match[1] ?? match[2] ?? match[3]).filter((request) => typeof request === "string" && request.length > 0), targetFile);
|
|
1060
|
-
}
|
|
1061
979
|
function collectImportedStyleFiles(css, targetFile) {
|
|
1062
|
-
|
|
1063
|
-
try {
|
|
1064
|
-
const imports = collectImportedStyleFilesRoot(_weapp_tailwindcss_postcss.postcss.parse(css), targetFile);
|
|
1065
|
-
return imports.size > 0 ? imports : collectImportedStyleFilesFallback(css, targetFile);
|
|
1066
|
-
} catch {}
|
|
1067
|
-
return collectImportedStyleFilesFallback(css, targetFile);
|
|
980
|
+
return (0, _weapp_tailwindcss_postcss_transform.collectImportedCssFiles)(css, (request) => resolveImportedStyleFile(targetFile, request));
|
|
1068
981
|
}
|
|
1069
982
|
function normalizeMarkerOutputFile(markerFile, resolveViteProcessedCssOutputFile) {
|
|
1070
983
|
return resolveViteProcessedCssOutputFile?.(markerFile) ?? markerFile;
|
|
@@ -1074,13 +987,13 @@ function isMatchingGeneratedCssMarkerFile(targetFile, markerFile, resolveVitePro
|
|
|
1074
987
|
return require_source_candidate_scan_signature.normalizeOutputPathKey(stripStyleExtension(targetFile)) === require_source_candidate_scan_signature.normalizeOutputPathKey(stripStyleExtension(normalizeMarkerOutputFile(markerFile, resolveViteProcessedCssOutputFile)));
|
|
1075
988
|
}
|
|
1076
989
|
function resolveViteProcessedCssAssetSource(file, rawSource, resolveViteProcessedCssOutputFile) {
|
|
1077
|
-
const blocks =
|
|
1078
|
-
if (blocks.length <= 1) return
|
|
990
|
+
const blocks = (0, _weapp_tailwindcss_postcss_transform.parseBundlerGeneratedCssMarkerBlocks)(rawSource).filter((block) => block.bundler === "vite");
|
|
991
|
+
if (blocks.length <= 1) return (0, _weapp_tailwindcss_postcss_transform.stripBundlerGeneratedCssMarkers)(rawSource);
|
|
1079
992
|
const matchedCss = blocks.filter((block) => isMatchingGeneratedCssMarkerFile(file, block.file, resolveViteProcessedCssOutputFile)).map((block) => block.css);
|
|
1080
|
-
return matchedCss.length > 0 ? matchedCss.join("\n") :
|
|
993
|
+
return matchedCss.length > 0 ? matchedCss.join("\n") : (0, _weapp_tailwindcss_postcss_transform.stripBundlerGeneratedCssMarkers)(rawSource);
|
|
1081
994
|
}
|
|
1082
995
|
function collectMatchingGeneratedCssMarkerFiles(file, rawSource, resolveViteProcessedCssOutputFile) {
|
|
1083
|
-
return
|
|
996
|
+
return (0, _weapp_tailwindcss_postcss_transform.parseBundlerGeneratedCssMarkerBlocks)(rawSource).filter((block) => block.bundler === "vite").filter((block) => isMatchingGeneratedCssMarkerFile(file, block.file, resolveViteProcessedCssOutputFile)).map((block) => block.file).filter((markerFile) => typeof markerFile === "string" && markerFile.length > 0);
|
|
1084
997
|
}
|
|
1085
998
|
function collectRootStyleBundleCssSources(bundle, excludedFile) {
|
|
1086
999
|
const sources = [];
|
|
@@ -1089,7 +1002,7 @@ function collectRootStyleBundleCssSources(bundle, excludedFile) {
|
|
|
1089
1002
|
if (output.type !== "asset") continue;
|
|
1090
1003
|
const file = require_source_candidate_scan_signature.normalizeOutputPathKey(getAssetFile(bundleFile, output));
|
|
1091
1004
|
if (file === excludedFileKey || !isRootStyleOutputFile(file)) continue;
|
|
1092
|
-
const source =
|
|
1005
|
+
const source = (0, _weapp_tailwindcss_postcss_transform.stripBundlerGeneratedCssMarkers)(readAssetSource$1(output)).trim();
|
|
1093
1006
|
if (source.length > 0) sources.push(source);
|
|
1094
1007
|
}
|
|
1095
1008
|
return sources;
|
|
@@ -1101,7 +1014,7 @@ function stripQueryAndHash(file) {
|
|
|
1101
1014
|
return file.replace(/[?#].*$/, "");
|
|
1102
1015
|
}
|
|
1103
1016
|
function resolveHtmlLinkedStyleFile(htmlFile, request) {
|
|
1104
|
-
if (!isStyleImportRequest(request)) return;
|
|
1017
|
+
if (!(0, _weapp_tailwindcss_postcss_transform.isStyleImportRequest)(request)) return;
|
|
1105
1018
|
const cleanRequest = stripQueryAndHash(request);
|
|
1106
1019
|
if (cleanRequest.startsWith("/")) return require_source_candidate_scan_signature.normalizeOutputPathKey(cleanRequest.slice(1));
|
|
1107
1020
|
const htmlDir = posix.posix.dirname(require_source_candidate_scan_signature.normalizeOutputPathKey(stripQueryAndHash(htmlFile)));
|
|
@@ -1142,7 +1055,7 @@ function removeDuplicateUnlinkedRootCssAssetsReferencedByHtml(bundle, options =
|
|
|
1142
1055
|
if (output.type !== "asset") continue;
|
|
1143
1056
|
const file = getAssetFile(bundleFile, output);
|
|
1144
1057
|
if (!isCssOutputFile(file) || isMiniProgramStyleOutputFile(file) || !isLinkedStyleFile(file, linked)) continue;
|
|
1145
|
-
const source =
|
|
1058
|
+
const source = (0, _weapp_tailwindcss_postcss_transform.stripBundlerGeneratedCssMarkers)(readAssetSource$1(output)).trim();
|
|
1146
1059
|
if (source.length > 0) linkedSources.add(source);
|
|
1147
1060
|
}
|
|
1148
1061
|
if (linkedSources.size === 0) return 0;
|
|
@@ -1151,7 +1064,7 @@ function removeDuplicateUnlinkedRootCssAssetsReferencedByHtml(bundle, options =
|
|
|
1151
1064
|
if (output.type !== "asset") continue;
|
|
1152
1065
|
const file = getAssetFile(bundleFile, output);
|
|
1153
1066
|
if (!isRootStyleOutputFile(file) || isMiniProgramStyleOutputFile(file) || isLinkedStyleFile(file, linked)) continue;
|
|
1154
|
-
const source =
|
|
1067
|
+
const source = (0, _weapp_tailwindcss_postcss_transform.stripBundlerGeneratedCssMarkers)(readAssetSource$1(output)).trim();
|
|
1155
1068
|
if (!linkedSources.has(source)) continue;
|
|
1156
1069
|
delete bundle[bundleFile];
|
|
1157
1070
|
options.debug?.("remove duplicate unlinked root css asset referenced by html: %s", file);
|
|
@@ -1297,7 +1210,7 @@ function resolveSfcStyleRequestFromKnownSource(sourceFile, sfcSource, styleSourc
|
|
|
1297
1210
|
}
|
|
1298
1211
|
function hasTailwindGenerationSource(source, options = {}) {
|
|
1299
1212
|
const allowRootDirectives = options.allowRootDirectives !== false;
|
|
1300
|
-
return
|
|
1213
|
+
return (0, _weapp_tailwindcss_postcss_transform.hasTailwindNonRootGenerationDirectives)(source, { importFallback: true }) || allowRootDirectives && (0, _weapp_tailwindcss_postcss_transform.hasTailwindSourceDirectives)(source, { importFallback: true }) || allowRootDirectives && (0, _weapp_tailwindcss_postcss_transform.hasTailwindRootDirectives)(source, { importFallback: true }) || (0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyDirective)(source);
|
|
1301
1214
|
}
|
|
1302
1215
|
function hasTailwindGenerationSourceForFile(file, source) {
|
|
1303
1216
|
if (require_generator.isTailwindV4CssEntry(file)) return hasTailwindGenerationSource(source);
|
|
@@ -1431,7 +1344,7 @@ function resolveSourceStyleSourceFromOutputFile(outputFile, snapshot, outputRoot
|
|
|
1431
1344
|
const cachedSources = [...getSourceStyleSources?.() ?? []].filter(([file, source]) => CSS_SOURCE_OUTPUT_EXT_RE.test(file) && hasTailwindGenerationSourceForFile(file, source)).map(([file, source]) => ({
|
|
1432
1345
|
file,
|
|
1433
1346
|
source,
|
|
1434
|
-
score:
|
|
1347
|
+
score: require_generated_css_marker.scoreTailwindV4CssSourceFileMatch(outputFile, file, {
|
|
1435
1348
|
outputRoot,
|
|
1436
1349
|
projectRoot: sourceRoot
|
|
1437
1350
|
})
|
|
@@ -1439,7 +1352,7 @@ function resolveSourceStyleSourceFromOutputFile(outputFile, snapshot, outputRoot
|
|
|
1439
1352
|
const configuredSources = [...configuredSourceEntries ?? []].filter(([file, source]) => CSS_SOURCE_OUTPUT_EXT_RE.test(file) && hasTailwindGenerationSourceForFile(file, source)).map(([file, source]) => ({
|
|
1440
1353
|
file,
|
|
1441
1354
|
source,
|
|
1442
|
-
score:
|
|
1355
|
+
score: require_generated_css_marker.scoreTailwindV4CssSourceFileMatch(outputFile, file, {
|
|
1443
1356
|
outputRoot,
|
|
1444
1357
|
projectRoot: sourceRoot
|
|
1445
1358
|
})
|
|
@@ -1625,7 +1538,7 @@ async function resolveHotTailwindCssModules(ctx, tailwindRootCssModuleIds, selec
|
|
|
1625
1538
|
const root = ctx.server.config?.root ?? node_process.default.cwd();
|
|
1626
1539
|
const outDir = ctx.server.config?.build?.outDir ? resolveViteModuleIdentity(ctx.server.config.build.outDir, root) : void 0;
|
|
1627
1540
|
const isHotSourceStyleModule = (id) => {
|
|
1628
|
-
if (!
|
|
1541
|
+
if (typeof id !== "string" || !require_generated_css_marker.isSourceStyleRequest(id)) return false;
|
|
1629
1542
|
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(id);
|
|
1630
1543
|
if (isRootMiniProgramStyleUrl(file) || !isAbsoluteFilePath(file) && !file.startsWith("/")) return false;
|
|
1631
1544
|
if (outDir) {
|
|
@@ -1660,7 +1573,7 @@ async function resolveHotSourceModulesByIds(ctx, ids) {
|
|
|
1660
1573
|
}
|
|
1661
1574
|
return resolveHotModulesByIds(ctx, sourceIds, (mod) => {
|
|
1662
1575
|
const modId = mod.id ?? mod.url;
|
|
1663
|
-
return !
|
|
1576
|
+
return !require_generated_css_marker.isSourceStyleRequest(modId);
|
|
1664
1577
|
});
|
|
1665
1578
|
}
|
|
1666
1579
|
async function resolveHotSourceModules(ctx) {
|
|
@@ -1669,7 +1582,7 @@ async function resolveHotSourceModules(ctx) {
|
|
|
1669
1582
|
const collectModule = (mod) => {
|
|
1670
1583
|
if (mod == null || seenModules.has(mod)) return;
|
|
1671
1584
|
const modId = mod.id ?? mod.url;
|
|
1672
|
-
if (
|
|
1585
|
+
if (require_generated_css_marker.isSourceStyleRequest(modId)) return;
|
|
1673
1586
|
seenModules.add(mod);
|
|
1674
1587
|
modules.push(mod);
|
|
1675
1588
|
};
|
|
@@ -1688,7 +1601,7 @@ function mergeHotModulesByIdentity(root, ...groups) {
|
|
|
1688
1601
|
mod.url,
|
|
1689
1602
|
mod.file
|
|
1690
1603
|
].filter((id) => typeof id === "string" && id.length > 0);
|
|
1691
|
-
const moduleKind = ids.some(
|
|
1604
|
+
const moduleKind = ids.some(require_generated_css_marker.isSourceStyleRequest) ? "style" : "source";
|
|
1692
1605
|
const keys = ids.map((id) => `${moduleKind}:${resolveViteModuleIdentity(id, root).key}`);
|
|
1693
1606
|
if (keys.some((key) => seenIdentities.has(key))) continue;
|
|
1694
1607
|
seenModules.add(mod);
|
|
@@ -1761,7 +1674,7 @@ function createSupplementalHotUpdate(hotUrl, timestamp) {
|
|
|
1761
1674
|
function hasSelfAcceptingNonStyleHotModule(modules) {
|
|
1762
1675
|
return modules.some((mod) => {
|
|
1763
1676
|
const modId = mod.id ?? mod.url;
|
|
1764
|
-
return !
|
|
1677
|
+
return !require_generated_css_marker.isSourceStyleRequest(modId) && mod.isSelfAccepting === true;
|
|
1765
1678
|
});
|
|
1766
1679
|
}
|
|
1767
1680
|
function sendSupplementalCssHotUpdates(ctx, cssModules, fallbackCssIds = [], fallbackSourceIds = [], handledModules = ctx.modules) {
|
|
@@ -1776,7 +1689,7 @@ function sendSupplementalCssHotUpdates(ctx, cssModules, fallbackCssIds = [], fal
|
|
|
1776
1689
|
updates.push(createSupplementalHotUpdate(hotUrl, ctx.timestamp));
|
|
1777
1690
|
}
|
|
1778
1691
|
for (const id of fallbackCssIds) {
|
|
1779
|
-
if (!
|
|
1692
|
+
if (!require_generated_css_marker.isSourceStyleRequest(id) || includesHotId(handledModules, id, root)) continue;
|
|
1780
1693
|
const hotUrl = resolveCssHotUrl(id, root);
|
|
1781
1694
|
if (!hotUrl || seenUrls.has(hotUrl)) continue;
|
|
1782
1695
|
seenUrls.add(hotUrl);
|
|
@@ -1806,59 +1719,6 @@ function sendFullReloadForUnresolvedHotUpdate(ctx) {
|
|
|
1806
1719
|
});
|
|
1807
1720
|
}
|
|
1808
1721
|
//#endregion
|
|
1809
|
-
//#region src/bundlers/vite/shared/generic-web-production-fast-path.ts
|
|
1810
|
-
/**
|
|
1811
|
-
* Generic Web 非 watch 生产构建由 Tailwind Scanner 直接提供候选,不需要重复维护小程序候选状态。
|
|
1812
|
-
*/
|
|
1813
|
-
function shouldSkipGenericWebProductionSourceCandidates(options) {
|
|
1814
|
-
return options.frameworkName === "generic" && options.command === "build" && options.watch == null && options.isWebGeneratorTarget && options.requiresSourceCandidateState !== true;
|
|
1815
|
-
}
|
|
1816
|
-
/**
|
|
1817
|
-
* 在 Vite 解析插件列表时排除无需维护的候选层,避免其 hooks 进入模块图。
|
|
1818
|
-
*/
|
|
1819
|
-
function createGenericWebProductionSourceCandidatesApply(options) {
|
|
1820
|
-
return (config, env) => !shouldSkipGenericWebProductionSourceCandidates({
|
|
1821
|
-
command: env.command,
|
|
1822
|
-
frameworkName: options.frameworkName,
|
|
1823
|
-
isWebGeneratorTarget: options.getIsWebGeneratorTarget(),
|
|
1824
|
-
requiresSourceCandidateState: options.requiresSourceCandidateState,
|
|
1825
|
-
watch: config.build?.watch
|
|
1826
|
-
});
|
|
1827
|
-
}
|
|
1828
|
-
/**
|
|
1829
|
-
* Generic Web 生产构建的 CSS 已在 Vite transform 阶段生成时,不需要再建立面向小程序的完整产物快照。
|
|
1830
|
-
*/
|
|
1831
|
-
function shouldUseGenericWebProductionFastPath(options) {
|
|
1832
|
-
return shouldSkipGenericWebProductionSourceCandidates(options) && options.hasProcessedCss;
|
|
1833
|
-
}
|
|
1834
|
-
/**
|
|
1835
|
-
* Finalizer fast path 只处理无小程序结构语义的 Generic Web 生产产物。
|
|
1836
|
-
*/
|
|
1837
|
-
function shouldUseGenericWebFinalizerFastPath(options) {
|
|
1838
|
-
return shouldUseGenericWebProductionFastPath(options) && !options.hasFrameworkRootImportShells && !options.isHarmonyAppStyleTarget && !options.isNativeAppStyleTarget;
|
|
1839
|
-
}
|
|
1840
|
-
/**
|
|
1841
|
-
* 将 Generic Web fast path 的判定和跳过生命周期集中起来,供 generateBundle hook 直接消费。
|
|
1842
|
-
*/
|
|
1843
|
-
function createGenericWebProductionBundleHooks(options) {
|
|
1844
|
-
return {
|
|
1845
|
-
onSkipProcessBundle: () => {
|
|
1846
|
-
options.onStart();
|
|
1847
|
-
options.onEnd();
|
|
1848
|
-
},
|
|
1849
|
-
shouldProcessBundle: () => {
|
|
1850
|
-
const config = options.getResolvedConfig();
|
|
1851
|
-
return !shouldUseGenericWebProductionFastPath({
|
|
1852
|
-
command: config?.command,
|
|
1853
|
-
frameworkName: options.frameworkName,
|
|
1854
|
-
hasProcessedCss: options.getHasProcessedCss(),
|
|
1855
|
-
isWebGeneratorTarget: options.getIsWebGeneratorTarget(),
|
|
1856
|
-
watch: config?.build?.watch
|
|
1857
|
-
});
|
|
1858
|
-
}
|
|
1859
|
-
};
|
|
1860
|
-
}
|
|
1861
|
-
//#endregion
|
|
1862
1722
|
//#region src/bundlers/vite/css-finalizer/options.ts
|
|
1863
1723
|
function inferPlatformFromViteOutDir(outDir) {
|
|
1864
1724
|
const segment = outDir ? node_path.default.basename(node_path.default.normalize(outDir)) : void 0;
|
|
@@ -1900,10 +1760,10 @@ function shouldGenerateCssByGenerator(opts, majorVersion, file, rawSource, proce
|
|
|
1900
1760
|
uniAppX: opts.uniAppX
|
|
1901
1761
|
});
|
|
1902
1762
|
if (!generatorOptions.enabled) return false;
|
|
1903
|
-
if (
|
|
1904
|
-
if (
|
|
1905
|
-
if (
|
|
1906
|
-
return processed &&
|
|
1763
|
+
if ((0, _weapp_tailwindcss_postcss_transform.hasLocalCssImport)(rawSource)) return false;
|
|
1764
|
+
if ((0, _weapp_tailwindcss_postcss_transform.hasTailwindGeneratedCssMarkers)(rawSource)) return true;
|
|
1765
|
+
if ((0, _weapp_tailwindcss_postcss_transform.hasTailwindRootDirectives)(rawSource, { importFallback: generatorOptions.importFallback })) return true;
|
|
1766
|
+
return processed && (0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyDirective)(rawSource) && shouldFinalizeProcessedCssAsset(opts, file);
|
|
1907
1767
|
}
|
|
1908
1768
|
function shouldFinalizeProcessedCssAsset(opts, file) {
|
|
1909
1769
|
return opts.mainCssChunkMatcher(file, opts.appType);
|
|
@@ -1913,7 +1773,7 @@ function collectViteProcessedCssSources(getViteProcessedCssAssetResults) {
|
|
|
1913
1773
|
}
|
|
1914
1774
|
function finalizeWebCss(css, context, cssPipelineStrategy) {
|
|
1915
1775
|
const shouldApplyWebCssCompat = shouldApplyViteWebCssCompat(context, cssPipelineStrategy);
|
|
1916
|
-
const defaultWebCssCompat = (value) => (0,
|
|
1776
|
+
const defaultWebCssCompat = (value) => (0, _weapp_tailwindcss_postcss_transform.transformWebCssCompat)(value, resolveViteWebCssCompatOptions(context));
|
|
1917
1777
|
return cssPipelineStrategy?.transformGeneratedCss?.(css, {
|
|
1918
1778
|
...context,
|
|
1919
1779
|
defaultWebCssCompat,
|
|
@@ -1922,6 +1782,84 @@ function finalizeWebCss(css, context, cssPipelineStrategy) {
|
|
|
1922
1782
|
}) ?? (shouldApplyWebCssCompat ? defaultWebCssCompat(css) : css);
|
|
1923
1783
|
}
|
|
1924
1784
|
//#endregion
|
|
1785
|
+
//#region src/bundlers/vite/css-finalizer/css-calc.ts
|
|
1786
|
+
/** 在所有 CSS 资产完成组装后,为普通 Web 样式补齐显式启用的 calc 计算。 */
|
|
1787
|
+
async function finalizeWebCssCalc(bundle, context) {
|
|
1788
|
+
const cssCalc = context.opts.cssOptions?.cssCalc ?? context.opts.cssCalc;
|
|
1789
|
+
if (!cssCalc) return;
|
|
1790
|
+
const pending = Object.values(bundle).filter((output) => output.type === "asset" && context.opts.cssMatcher(output.fileName) && !context.opts.htmlMatcher(output.fileName)).map((asset) => ({
|
|
1791
|
+
asset,
|
|
1792
|
+
original: typeof asset.source === "string" ? asset.source : new TextDecoder().decode(asset.source)
|
|
1793
|
+
})).filter(({ original }) => original.includes("calc("));
|
|
1794
|
+
if (pending.length === 0) return;
|
|
1795
|
+
const sources = new Set(collectViteProcessedCssSources(context.getViteProcessedCssAssetResults));
|
|
1796
|
+
const contextCss = sources.size === 1 ? sources.values().next().value : void 0;
|
|
1797
|
+
for (const { asset, original } of pending) {
|
|
1798
|
+
const css = await (0, _weapp_tailwindcss_postcss_transform.applyConfiguredCssCalc)(original, {
|
|
1799
|
+
cssCalc,
|
|
1800
|
+
contextCss
|
|
1801
|
+
});
|
|
1802
|
+
if (css !== original) {
|
|
1803
|
+
asset.source = css;
|
|
1804
|
+
context.recordCssAssetResult?.(asset.fileName, css);
|
|
1805
|
+
context.opts.onUpdate(asset.fileName, original, css);
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
}
|
|
1809
|
+
//#endregion
|
|
1810
|
+
//#region src/bundlers/vite/shared/generic-web-production-fast-path.ts
|
|
1811
|
+
/**
|
|
1812
|
+
* Generic Web 非 watch 生产构建由 Tailwind Scanner 直接提供候选,不需要重复维护小程序候选状态。
|
|
1813
|
+
*/
|
|
1814
|
+
function shouldSkipGenericWebProductionSourceCandidates(options) {
|
|
1815
|
+
return options.frameworkName === "generic" && options.command === "build" && options.watch == null && options.isWebGeneratorTarget && options.requiresSourceCandidateState !== true;
|
|
1816
|
+
}
|
|
1817
|
+
/**
|
|
1818
|
+
* 在 Vite 解析插件列表时排除无需维护的候选层,避免其 hooks 进入模块图。
|
|
1819
|
+
*/
|
|
1820
|
+
function createGenericWebProductionSourceCandidatesApply(options) {
|
|
1821
|
+
return (config, env) => !shouldSkipGenericWebProductionSourceCandidates({
|
|
1822
|
+
command: env.command,
|
|
1823
|
+
frameworkName: options.frameworkName,
|
|
1824
|
+
isWebGeneratorTarget: options.getIsWebGeneratorTarget(),
|
|
1825
|
+
requiresSourceCandidateState: options.requiresSourceCandidateState,
|
|
1826
|
+
watch: config.build?.watch
|
|
1827
|
+
});
|
|
1828
|
+
}
|
|
1829
|
+
/**
|
|
1830
|
+
* Generic Web 生产构建的 CSS 已在 Vite transform 阶段生成时,不需要再建立面向小程序的完整产物快照。
|
|
1831
|
+
*/
|
|
1832
|
+
function shouldUseGenericWebProductionFastPath(options) {
|
|
1833
|
+
return shouldSkipGenericWebProductionSourceCandidates(options) && options.hasProcessedCss;
|
|
1834
|
+
}
|
|
1835
|
+
/**
|
|
1836
|
+
* Finalizer fast path 只处理无小程序结构语义的 Generic Web 生产产物。
|
|
1837
|
+
*/
|
|
1838
|
+
function shouldUseGenericWebFinalizerFastPath(options) {
|
|
1839
|
+
return shouldUseGenericWebProductionFastPath(options) && !options.hasFrameworkRootImportShells && !options.isHarmonyAppStyleTarget && !options.isNativeAppStyleTarget;
|
|
1840
|
+
}
|
|
1841
|
+
/**
|
|
1842
|
+
* 将 Generic Web fast path 的判定和跳过生命周期集中起来,供 generateBundle hook 直接消费。
|
|
1843
|
+
*/
|
|
1844
|
+
function createGenericWebProductionBundleHooks(options) {
|
|
1845
|
+
return {
|
|
1846
|
+
onSkipProcessBundle: () => {
|
|
1847
|
+
options.onStart();
|
|
1848
|
+
options.onEnd();
|
|
1849
|
+
},
|
|
1850
|
+
shouldProcessBundle: () => {
|
|
1851
|
+
const config = options.getResolvedConfig();
|
|
1852
|
+
return !shouldUseGenericWebProductionFastPath({
|
|
1853
|
+
command: config?.command,
|
|
1854
|
+
frameworkName: options.frameworkName,
|
|
1855
|
+
hasProcessedCss: options.getHasProcessedCss(),
|
|
1856
|
+
isWebGeneratorTarget: options.getIsWebGeneratorTarget(),
|
|
1857
|
+
watch: config?.build?.watch
|
|
1858
|
+
});
|
|
1859
|
+
}
|
|
1860
|
+
};
|
|
1861
|
+
}
|
|
1862
|
+
//#endregion
|
|
1925
1863
|
//#region src/bundlers/vite/css-finalizer/generic-web-fast-path.ts
|
|
1926
1864
|
function readAssetSource(asset) {
|
|
1927
1865
|
return typeof asset.source === "string" ? asset.source : asset.source.toString();
|
|
@@ -1964,9 +1902,9 @@ function resolveProcessedCssAssets(cssAssets, records, options, bundleFiles) {
|
|
|
1964
1902
|
useAssetSource = true;
|
|
1965
1903
|
}
|
|
1966
1904
|
}
|
|
1967
|
-
if (!output && records.length === 1 && htmlOwnedAssets.length === 1) {
|
|
1905
|
+
if (!output && records.length === 1 && htmlOwnedAssets.length === 1 && htmlOwnedAssets[0]) {
|
|
1968
1906
|
output = htmlOwnedAssets[0];
|
|
1969
|
-
useAssetSource =
|
|
1907
|
+
useAssetSource = (0, _weapp_tailwindcss_postcss_transform.hasTailwindGeneratedCss)(output.original) || (0, _weapp_tailwindcss_postcss_transform.hasTailwindGeneratedCssMarkers)(output.original);
|
|
1970
1908
|
}
|
|
1971
1909
|
if (!output) return;
|
|
1972
1910
|
const existing = processedAssets.get(output);
|
|
@@ -2007,7 +1945,7 @@ function tryFinalizeGenericWebCss(options) {
|
|
|
2007
1945
|
for (const [{ asset, file, original }, processed] of processedAssets) {
|
|
2008
1946
|
const finalizeStartedAt = performance.now();
|
|
2009
1947
|
const finalCssSource = processed.useAssetSource ? original : processed.css;
|
|
2010
|
-
const generated = finalizeWebCss(
|
|
1948
|
+
const generated = finalizeWebCss((0, _weapp_tailwindcss_postcss_transform.stripBundlerGeneratedCssMarkers)(finalCssSource), {
|
|
2011
1949
|
...options.createCssPipelineContext(file),
|
|
2012
1950
|
file
|
|
2013
1951
|
}, context.cssPipelineStrategy);
|
|
@@ -2026,8 +1964,8 @@ function tryFinalizeGenericWebCss(options) {
|
|
|
2026
1964
|
/**
|
|
2027
1965
|
* Generic Web 专用 CSS finalizer。
|
|
2028
1966
|
*
|
|
2029
|
-
*
|
|
2030
|
-
* HTML、JavaScript、模板和小程序分包产物。
|
|
1967
|
+
* 该插件复用 CSS transform 阶段记录的 CSS asset,显式开启 cssCalc 时也处理
|
|
1968
|
+
* 最终资产中的普通 CSS;不扫描或改写 HTML、JavaScript、模板和小程序分包产物。
|
|
2031
1969
|
*/
|
|
2032
1970
|
function createViteWebCssFinalizerOutputPlugin(context) {
|
|
2033
1971
|
return {
|
|
@@ -2076,6 +2014,7 @@ function createViteWebCssFinalizerOutputPlugin(context) {
|
|
|
2076
2014
|
rootDir,
|
|
2077
2015
|
sourceRoot: void 0
|
|
2078
2016
|
})) context.debug("Generic Web CSS finalizer skipped: no unique processed CSS asset");
|
|
2017
|
+
await finalizeWebCssCalc(bundle, context);
|
|
2079
2018
|
require_hmr_timing.finalizeCompilerShadowRun(context.runtimeState);
|
|
2080
2019
|
context.hmrTimingRecorder?.record("webCssFinalizer.total", performance.now() - startedAt);
|
|
2081
2020
|
}
|
|
@@ -2132,7 +2071,7 @@ function normalizeCssSourceIdentity(sourceFile) {
|
|
|
2132
2071
|
const { filename, query } = parseVueRequest(cleanSourceFile);
|
|
2133
2072
|
const normalizedFile = require_source_candidate_scan_signature.normalizeOutputPathKey(filename);
|
|
2134
2073
|
if (query.type === "style") return `${normalizedFile}?type=style&index=${query.index ?? 0}`;
|
|
2135
|
-
return require_source_candidate_scan_signature.normalizeOutputPathKey(
|
|
2074
|
+
return require_source_candidate_scan_signature.normalizeOutputPathKey(require_generated_css_marker.stripRequestQuery(cleanSourceFile));
|
|
2136
2075
|
}
|
|
2137
2076
|
function hasSfcStyleBlocks(source) {
|
|
2138
2077
|
SFC_STYLE_BLOCK_RE.lastIndex = 0;
|
|
@@ -2237,14 +2176,14 @@ function createViteCssMemory(options) {
|
|
|
2237
2176
|
for (const [rememberedKey, remembered] of relatedRememberedEntries) refreshRememberedCssSourceEntry(rememberedKey, remembered, sourceFile, rawSource);
|
|
2238
2177
|
};
|
|
2239
2178
|
const resolveCachedStyleSource = (sourceFile) => {
|
|
2240
|
-
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(
|
|
2179
|
+
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(require_generated_css_marker.stripRequestQuery(sourceFile));
|
|
2241
2180
|
if (SFC_COMPONENT_FILE_RE.test(file)) return getKnownSfcSource(file);
|
|
2242
|
-
if (
|
|
2181
|
+
if (require_generated_css_marker.isSourceStyleRequest(file)) return options.getSourceCandidateSource(file);
|
|
2243
2182
|
};
|
|
2244
2183
|
const resolveCurrentStyleSource = (sourceFile) => {
|
|
2245
2184
|
const cached = resolveCachedStyleSource(sourceFile);
|
|
2246
2185
|
if (cached != null) return cached;
|
|
2247
|
-
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(
|
|
2186
|
+
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(require_generated_css_marker.stripRequestQuery(sourceFile));
|
|
2248
2187
|
const knownSource = knownCssSources.get(normalizeCssSourceIdentity(sourceFile));
|
|
2249
2188
|
if (knownSource != null) return knownSource;
|
|
2250
2189
|
const candidateSource = options.getSourceCandidateSource(file);
|
|
@@ -2253,7 +2192,7 @@ function createViteCssMemory(options) {
|
|
|
2253
2192
|
const refreshRememberedCssSourceByCurrentFile = async (sourceFile) => {
|
|
2254
2193
|
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(sourceFile);
|
|
2255
2194
|
const normalizedSourceFile = require_source_candidate_scan_signature.normalizeOutputPathKey(file);
|
|
2256
|
-
const matchedRememberedSources = [...rememberedCssSources.values()].filter((remembered) => require_source_candidate_scan_signature.normalizeOutputPathKey(
|
|
2195
|
+
const matchedRememberedSources = [...rememberedCssSources.values()].filter((remembered) => require_source_candidate_scan_signature.normalizeOutputPathKey(require_generated_css_marker.stripRequestQuery((0, _weapp_tailwindcss_shared.cleanUrl)(remembered.sourceFile))) === normalizedSourceFile);
|
|
2257
2196
|
if (matchedRememberedSources.length === 0) return;
|
|
2258
2197
|
const source = await resolveCurrentStyleSource(file);
|
|
2259
2198
|
if (source == null) {
|
|
@@ -2268,7 +2207,7 @@ function createViteCssMemory(options) {
|
|
|
2268
2207
|
}
|
|
2269
2208
|
return;
|
|
2270
2209
|
}
|
|
2271
|
-
if (
|
|
2210
|
+
if (require_generated_css_marker.isSourceStyleRequest(file)) refreshRememberedCssSourceBySourceFile(file, source);
|
|
2272
2211
|
};
|
|
2273
2212
|
const prune = (pruneOptions) => {
|
|
2274
2213
|
const activeFiles = new Set([...pruneOptions.activeFiles].map(require_source_candidate_scan_signature.normalizeOutputPathKey));
|
|
@@ -2353,10 +2292,7 @@ function joinPosixPath(base, subpath) {
|
|
|
2353
2292
|
function isCssLikeImporter(importer) {
|
|
2354
2293
|
if (!importer) return false;
|
|
2355
2294
|
const normalized = (0, _weapp_tailwindcss_shared.cleanUrl)(importer);
|
|
2356
|
-
return
|
|
2357
|
-
}
|
|
2358
|
-
function stripTailwindConfigDirectives(code) {
|
|
2359
|
-
return code.replace(/^\s*@config\s+(?:"[^"]+"|'[^']+')[^;\n]*;\s*$/gm, "");
|
|
2295
|
+
return require_generated_css_marker.isSourceStyleRequest(importer) || isCSSRequest(normalized) || normalized.endsWith("/*");
|
|
2360
2296
|
}
|
|
2361
2297
|
function createRewriteCssImportsPlugins(options) {
|
|
2362
2298
|
if (!options.shouldRewrite && !options.shouldOwnTailwindGeneration) return [];
|
|
@@ -2379,9 +2315,9 @@ function createRewriteCssImportsPlugins(options) {
|
|
|
2379
2315
|
async transform(code, id) {
|
|
2380
2316
|
if (!isCSSRequest(id)) return null;
|
|
2381
2317
|
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(id);
|
|
2382
|
-
const normalizedCode = !isSfcStyleSourceFile(file) && (
|
|
2318
|
+
const normalizedCode = !isSfcStyleSourceFile(file) && ((0, _weapp_tailwindcss_postcss_transform.hasTailwindRootDirectives)(code) || code.includes("@config")) ? (0, _weapp_tailwindcss_postcss_transform.normalizeTailwindConfigDirectives)(code, node_path.default.dirname(file)) : code;
|
|
2383
2319
|
await options.onCssSourceTransform?.(id, normalizedCode);
|
|
2384
|
-
const hasTailwindRoot =
|
|
2320
|
+
const hasTailwindRoot = (0, _weapp_tailwindcss_postcss_transform.hasTailwindRootDirectives)(normalizedCode, { importFallback: true });
|
|
2385
2321
|
if (hasTailwindRoot) await options.onTailwindRootCss?.(id, normalizedCode);
|
|
2386
2322
|
const shouldGenerateInPreTransform = !options.shouldDeferGeneration?.(id, normalizedCode) && (hasTailwindRoot || options.shouldGenerateCss?.(id, normalizedCode));
|
|
2387
2323
|
if (options.shouldOwnTailwindGeneration && shouldGenerateInPreTransform) {
|
|
@@ -2407,7 +2343,7 @@ function createRewriteCssImportsPlugins(options) {
|
|
|
2407
2343
|
appType: resolveAppType(),
|
|
2408
2344
|
rootImport
|
|
2409
2345
|
});
|
|
2410
|
-
const nextCode = shouldOwnTailwindGeneration ? stripTailwindConfigDirectives(rewritten ?? normalizedCode) : rewritten;
|
|
2346
|
+
const nextCode = shouldOwnTailwindGeneration ? (0, _weapp_tailwindcss_postcss_transform.stripTailwindConfigDirectives)(rewritten ?? normalizedCode) : rewritten;
|
|
2411
2347
|
if (!nextCode || nextCode === code) return null;
|
|
2412
2348
|
return {
|
|
2413
2349
|
code: nextCode,
|
|
@@ -2417,7 +2353,7 @@ function createRewriteCssImportsPlugins(options) {
|
|
|
2417
2353
|
}];
|
|
2418
2354
|
}
|
|
2419
2355
|
function hasVitePipelineTailwindGenerationDirective(code) {
|
|
2420
|
-
return
|
|
2356
|
+
return (0, _weapp_tailwindcss_postcss_transform.hasTailwindRootDirectives)(code) || (0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyDirective)(code);
|
|
2421
2357
|
}
|
|
2422
2358
|
//#endregion
|
|
2423
2359
|
//#region src/bundlers/vite/runtime-class-set.ts
|
|
@@ -2614,22 +2550,22 @@ function replaceViteCssHmrModuleCss(code, css) {
|
|
|
2614
2550
|
return `${code.slice(0, extracted.start)}${encodeJsStringLiteral(css)}${code.slice(extracted.end)}`;
|
|
2615
2551
|
}
|
|
2616
2552
|
function isViteServeStyleRequest(id, command) {
|
|
2617
|
-
return command === "serve" &&
|
|
2553
|
+
return command === "serve" && require_generated_css_marker.isSourceStyleRequest(id) && !SPECIAL_QUERY_RE.test(id) && !COMMON_JS_PROXY_RE.test(id);
|
|
2618
2554
|
}
|
|
2619
2555
|
function isViteServeCssRootRequest(id, command) {
|
|
2620
|
-
return command === "serve" &&
|
|
2556
|
+
return command === "serve" && require_generated_css_marker.isSourceStyleRequest(id) && !SPECIAL_QUERY_RE.test(id) && !COMMON_JS_PROXY_RE.test(id);
|
|
2621
2557
|
}
|
|
2622
2558
|
function isViteBuildStyleRequest(id, command) {
|
|
2623
|
-
return command === "build" &&
|
|
2559
|
+
return command === "build" && require_generated_css_marker.isSourceStyleRequest(id) && !SPECIAL_QUERY_RE.test(id) && !COMMON_JS_PROXY_RE.test(id);
|
|
2624
2560
|
}
|
|
2625
2561
|
function isViteCssHmrModule(code, id, command) {
|
|
2626
2562
|
return isViteServeStyleRequest(id, command) && VITE_CSS_HMR_MODULE_RE.test(code) && (/[?&](?:direct|vue)(?:&|$)/.test(id) || DEFERRED_CSS_HMR_QUERY_RE.test(id));
|
|
2627
2563
|
}
|
|
2628
2564
|
function hasViteCssGenerationDirective(code) {
|
|
2629
|
-
return
|
|
2565
|
+
return (0, _weapp_tailwindcss_postcss_transform.hasTailwindRootDirectives)(code) || (0, _weapp_tailwindcss_postcss_transform.hasTailwindSourceDirectives)(code, { importFallback: true }) || (0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyDirective)(code);
|
|
2630
2566
|
}
|
|
2631
2567
|
function hasViteServeCssRootDirective(code) {
|
|
2632
|
-
return
|
|
2568
|
+
return (0, _weapp_tailwindcss_postcss_transform.hasTailwindRootDirectives)(code);
|
|
2633
2569
|
}
|
|
2634
2570
|
function createViteCssGenerationPlugins(options) {
|
|
2635
2571
|
return [
|
|
@@ -2639,7 +2575,7 @@ function createViteCssGenerationPlugins(options) {
|
|
|
2639
2575
|
enforce: "pre",
|
|
2640
2576
|
async transform(code, id) {
|
|
2641
2577
|
if (!options.shouldGenerate() || !isViteServeCssRootRequest(id, options.getCommand())) return;
|
|
2642
|
-
if (!
|
|
2578
|
+
if (!(0, _weapp_tailwindcss_postcss_transform.hasTailwindRootDirectives)(code)) return;
|
|
2643
2579
|
if (DEFERRED_CSS_HMR_QUERY_RE.test(id)) return;
|
|
2644
2580
|
await options.onTailwindRootCss?.(id, code);
|
|
2645
2581
|
const generatedCss = await options.generateCss(id, code, {
|
|
@@ -2761,10 +2697,10 @@ function createViteHmrCandidateState(options) {
|
|
|
2761
2697
|
const createChange = (file, change, changeOptions = {}) => ({
|
|
2762
2698
|
...change,
|
|
2763
2699
|
file,
|
|
2764
|
-
runtimeAffecting: changeOptions.runtimeAffecting === true || options.isRuntimeAffectingSource?.(file) === true ||
|
|
2700
|
+
runtimeAffecting: changeOptions.runtimeAffecting === true || options.isRuntimeAffectingSource?.(file) === true || require_generated_css_marker.isSourceStyleRequest(file)
|
|
2765
2701
|
});
|
|
2766
2702
|
const apply = (change) => {
|
|
2767
|
-
if (
|
|
2703
|
+
if (require_generated_css_marker.isSourceStyleRequest(change.file)) {
|
|
2768
2704
|
clear();
|
|
2769
2705
|
return change;
|
|
2770
2706
|
}
|
|
@@ -2784,7 +2720,7 @@ function createViteHmrCandidateState(options) {
|
|
|
2784
2720
|
};
|
|
2785
2721
|
const resolve = (generatorCode, file) => {
|
|
2786
2722
|
const fileKey = normalizeCssTargetFile(file);
|
|
2787
|
-
if (options.getCommand() !== "serve" || !pendingChange || pendingChange.runtimeAffecting || pendingChange.addedCandidates.size === 0 || options.getGeneratorOptions().target === "weapp" &&
|
|
2723
|
+
if (options.getCommand() !== "serve" || !pendingChange || pendingChange.runtimeAffecting || pendingChange.addedCandidates.size === 0 || options.getGeneratorOptions().target === "weapp" && (0, _weapp_tailwindcss_postcss_transform.hasUserCssLayerBlocks)(generatorCode) || !options.cleanGeneratedCssByFile.has(fileKey) || !options.generatedClassSetByFile.has(fileKey) || pendingTargetsArmed && !pendingCssTargetFiles?.has(fileKey)) return;
|
|
2788
2724
|
return pendingChange;
|
|
2789
2725
|
};
|
|
2790
2726
|
const finishTarget = (file) => {
|
|
@@ -2903,7 +2839,7 @@ function createViteHmrCssModuleVersionFilterPlugin(tracker) {
|
|
|
2903
2839
|
handler(ctx) {
|
|
2904
2840
|
const styleModules = ctx.modules.filter((mod) => {
|
|
2905
2841
|
const request = mod.id ?? mod.url;
|
|
2906
|
-
return
|
|
2842
|
+
return require_generated_css_marker.isSourceStyleRequest(request);
|
|
2907
2843
|
});
|
|
2908
2844
|
if (styleModules.length === 0) return;
|
|
2909
2845
|
const root = ctx.server.config?.root ?? node_process.default.cwd();
|
|
@@ -3005,10 +2941,10 @@ function createFrameworkPostPlugin(options) {
|
|
|
3005
2941
|
replacement: options.generatorPlaceholderCssFile
|
|
3006
2942
|
}] } };
|
|
3007
2943
|
if (config.css?.postcss !== void 0) return baseConfig;
|
|
3008
|
-
return (0,
|
|
2944
|
+
return (0, _weapp_tailwindcss_postcss_transform.resolvePostcssConfig)(root).then((postcssConfig) => {
|
|
3009
2945
|
if (!postcssConfig) return baseConfig;
|
|
3010
2946
|
const plugins = [...postcssConfig.plugins];
|
|
3011
|
-
const removed = (0,
|
|
2947
|
+
const removed = (0, _weapp_tailwindcss_postcss_transform.removeTailwindPostcssPlugins)(plugins);
|
|
3012
2948
|
if (removed > 0) options.debug("inline filtered postcss config without official tailwind plugins in generator mode: %d", removed);
|
|
3013
2949
|
return {
|
|
3014
2950
|
...baseConfig,
|
|
@@ -3062,14 +2998,14 @@ function createFrameworkPostPlugin(options) {
|
|
|
3062
2998
|
if (typeof config.css.postcss === "object" && Array.isArray(config.css.postcss.plugins)) {
|
|
3063
2999
|
const postcssPlugins = config.css.postcss.plugins;
|
|
3064
3000
|
if (options.shouldOwnTailwindGeneration) {
|
|
3065
|
-
const removed = (0,
|
|
3001
|
+
const removed = (0, _weapp_tailwindcss_postcss_transform.removeTailwindPostcssPlugins)(postcssPlugins);
|
|
3066
3002
|
if (removed > 0) {
|
|
3067
3003
|
_weapp_tailwindcss_logger.logger.warn("检测到 @tailwindcss/postcss,生成模式下已移除该插件以避免 Tailwind CSS 重复生成。");
|
|
3068
3004
|
options.debug("remove official tailwind postcss plugins in generator mode: %d", removed);
|
|
3069
3005
|
}
|
|
3070
3006
|
}
|
|
3071
3007
|
}
|
|
3072
|
-
|
|
3008
|
+
require_generated_css_marker.captureFrameworkPostcssOptions(options.opts, config.css?.postcss && typeof config.css.postcss === "object" ? config.css.postcss : void 0);
|
|
3073
3009
|
}, { emit: false });
|
|
3074
3010
|
}
|
|
3075
3011
|
};
|
|
@@ -3123,6 +3059,16 @@ function createFrameworkProcessedCssRegistry() {
|
|
|
3123
3059
|
};
|
|
3124
3060
|
}
|
|
3125
3061
|
//#endregion
|
|
3062
|
+
//#region src/bundlers/vite/shared/hmr-source.ts
|
|
3063
|
+
/** 兼容 Vite 同步或异步的 HMR 源码读取,并沿用读取失败后的候选扫描。 */
|
|
3064
|
+
async function readViteHmrSource(context) {
|
|
3065
|
+
try {
|
|
3066
|
+
return await context.read?.();
|
|
3067
|
+
} catch {
|
|
3068
|
+
return;
|
|
3069
|
+
}
|
|
3070
|
+
}
|
|
3071
|
+
//#endregion
|
|
3126
3072
|
//#region src/bundlers/vite/shared/framework-hmr-runtime-signature.ts
|
|
3127
3073
|
const WEB_HMR_RUNTIME_AFFECTING_DIRECTIVE_RE = /@(?:theme|source|config|plugin|apply)\b/;
|
|
3128
3074
|
function createFrameworkHmrRuntimeSignature(file, source) {
|
|
@@ -3137,7 +3083,7 @@ function hasFrameworkHmrRuntimeSourceChange(file, previousSource, nextSource) {
|
|
|
3137
3083
|
const SOURCE_CANDIDATE_SCAN_CACHE_MAX = 8;
|
|
3138
3084
|
const sourceCandidateScanSnapshotCache = new lru_cache.LRUCache({ max: SOURCE_CANDIDATE_SCAN_CACHE_MAX });
|
|
3139
3085
|
async function syncFrameworkSourceCandidatesForHotUpdate(sourceScanSession, ctx) {
|
|
3140
|
-
const source = typeof ctx.read === "function" ? await ctx
|
|
3086
|
+
const source = typeof ctx.read === "function" ? await readViteHmrSource(ctx) : void 0;
|
|
3141
3087
|
await sourceScanSession.syncChangedFile(ctx.file, source);
|
|
3142
3088
|
await sourceScanSession.waitForPendingSyncs();
|
|
3143
3089
|
}
|
|
@@ -3219,8 +3165,8 @@ function createFrameworkSourceScanSession(options) {
|
|
|
3219
3165
|
...scanRoot,
|
|
3220
3166
|
outDir: sourceScanOutDir
|
|
3221
3167
|
}));
|
|
3222
|
-
sourceScanBoundaryMatcher =
|
|
3223
|
-
sourceScanMatcher =
|
|
3168
|
+
sourceScanBoundaryMatcher = require_generated_css_marker.createSourceCandidateEligibilityMatcher(matcherRoots);
|
|
3169
|
+
sourceScanMatcher = require_generated_css_marker.createSourceCandidateEligibilityMatcher(matcherRoots, sourceScanEligibleFiles);
|
|
3224
3170
|
};
|
|
3225
3171
|
const refreshSourceScanEligibleFiles = async () => {
|
|
3226
3172
|
sourceScanEligibleFilesRefresh ?? (sourceScanEligibleFilesRefresh = Promise.all(sourceScanRoots.map((scanRoot) => options.sourceCandidateCollector.resolveScanFiles({
|
|
@@ -3329,7 +3275,7 @@ function createFrameworkSourceScanSession(options) {
|
|
|
3329
3275
|
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(id);
|
|
3330
3276
|
const runtimeAffectingByDependency = isDependency(file);
|
|
3331
3277
|
if (runtimeAffectingByDependency) invalidate();
|
|
3332
|
-
const resolvedFile =
|
|
3278
|
+
const resolvedFile = (0, require_tailwindcss.source_scan_exports.resolveSourceScanPath)(file);
|
|
3333
3279
|
if (sourceScanMatcher && !sourceScanMatcher(file) && sourceScanBoundaryMatcher?.(file) && !sourceScanIneligibleFiles.has(resolvedFile)) {
|
|
3334
3280
|
await refreshSourceScanEligibleFiles();
|
|
3335
3281
|
if (!sourceScanMatcher(file)) sourceScanIneligibleFiles.add(resolvedFile);
|
|
@@ -3337,7 +3283,7 @@ function createFrameworkSourceScanSession(options) {
|
|
|
3337
3283
|
if (sourceScanMatcher && !sourceScanMatcher(file)) {
|
|
3338
3284
|
const change = options.sourceCandidateCollector.remove(file);
|
|
3339
3285
|
cacheCurrent();
|
|
3340
|
-
return (
|
|
3286
|
+
return (require_generated_css_marker.isSourceStyleRequest(file) ? (0, node_fs_promises.readFile)(file, "utf8").then((source) => options.cssMemory.refreshRememberedCssSourceBySourceFile(file, source)).catch((error) => {
|
|
3341
3287
|
if ((typeof error === "object" && error !== null && "code" in error ? error.code : void 0) !== "ENOENT") options.debug("remembered css source watch refresh failed: %s %O", file, error);
|
|
3342
3288
|
}) : Promise.resolve()).then(() => options.cssMemory.refreshRememberedCssSourceByCurrentFile(file)).then(() => rememberHotUpdateChange(options.hmrCandidateState.apply(options.hmrCandidateState.createChange(file, change, { runtimeAffecting: true }))));
|
|
3343
3289
|
}
|
|
@@ -3441,7 +3387,7 @@ function createFrameworkTailwindRootCss(options) {
|
|
|
3441
3387
|
if (!options.shouldOwnTailwindGeneration || typeof id !== "string" || id.length === 0) return;
|
|
3442
3388
|
moduleIds.add(id);
|
|
3443
3389
|
const identity = resolveViteModuleIdentity(id);
|
|
3444
|
-
if (
|
|
3390
|
+
if (require_generated_css_marker.isSourceStyleRequest(identity.cleanId)) for (const moduleId of identity.lookupIds) moduleIds.add(moduleId);
|
|
3445
3391
|
};
|
|
3446
3392
|
const register = async (id, code) => {
|
|
3447
3393
|
rememberModule(id);
|
|
@@ -3450,7 +3396,7 @@ function createFrameworkTailwindRootCss(options) {
|
|
|
3450
3396
|
};
|
|
3451
3397
|
const refreshSource = async (id, code) => {
|
|
3452
3398
|
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(id);
|
|
3453
|
-
if (!moduleIds.has(id) && !moduleIds.has(file) && !
|
|
3399
|
+
if (!moduleIds.has(id) && !moduleIds.has(file) && !(0, _weapp_tailwindcss_postcss_transform.hasTailwindRootDirectives)(code, { importFallback: options.getImportFallback() })) return;
|
|
3454
3400
|
hotSourceByFile.set(normalizeSourceFile(id), code);
|
|
3455
3401
|
await register(id, code);
|
|
3456
3402
|
options.sourceScanSession.invalidate();
|
|
@@ -3466,26 +3412,22 @@ function createFrameworkTailwindRootCss(options) {
|
|
|
3466
3412
|
}
|
|
3467
3413
|
//#endregion
|
|
3468
3414
|
//#region src/style-injector/vite-web.ts
|
|
3469
|
-
function getHandler(hook) {
|
|
3470
|
-
if (typeof hook === "function") return hook;
|
|
3471
|
-
if (hook && typeof hook === "object" && typeof hook.handler === "function") return hook.handler;
|
|
3472
|
-
}
|
|
3473
3415
|
/** Generic Web 专用 style injector,避免引入其他构建器和框架适配。 */
|
|
3474
3416
|
function createBuiltinViteWebStyleInjectorPlugins(options) {
|
|
3475
3417
|
const normalized = require_source_candidate_scan_signature.normalizeStyleInjectorOptions(options);
|
|
3476
3418
|
if (!normalized) return [];
|
|
3477
3419
|
const injector = (0, weapp_style_injector_vite.weappStyleInjector)(normalized);
|
|
3478
|
-
const transform =
|
|
3479
|
-
const generateBundle =
|
|
3420
|
+
const transform = require_source_candidate_scan_signature.getViteHookHandler(injector.transform);
|
|
3421
|
+
const generateBundle = require_source_candidate_scan_signature.getViteHookHandler(injector.generateBundle);
|
|
3480
3422
|
return [{
|
|
3481
3423
|
name: "weapp-tailwindcss:web-style-injector-pre",
|
|
3482
3424
|
apply: "build",
|
|
3483
3425
|
enforce: "pre",
|
|
3484
3426
|
configResolved(config) {
|
|
3485
|
-
injector.configResolved?.(config);
|
|
3427
|
+
return require_source_candidate_scan_signature.getViteHookHandler(injector.configResolved)?.call(this, config);
|
|
3486
3428
|
},
|
|
3487
|
-
async buildStart() {
|
|
3488
|
-
await injector.buildStart?.call(this,
|
|
3429
|
+
async buildStart(buildOptions) {
|
|
3430
|
+
await require_source_candidate_scan_signature.getViteHookHandler(injector.buildStart)?.call(this, buildOptions);
|
|
3489
3431
|
},
|
|
3490
3432
|
async transform(code, id, options2) {
|
|
3491
3433
|
return transform?.call(this, code, id, options2);
|
|
@@ -3495,7 +3437,7 @@ function createBuiltinViteWebStyleInjectorPlugins(options) {
|
|
|
3495
3437
|
apply: "build",
|
|
3496
3438
|
enforce: "post",
|
|
3497
3439
|
configResolved(config) {
|
|
3498
|
-
injector.configResolved?.(config);
|
|
3440
|
+
return require_source_candidate_scan_signature.getViteHookHandler(injector.configResolved)?.call(this, config);
|
|
3499
3441
|
},
|
|
3500
3442
|
async generateBundle(outputOptions, bundle, isWrite) {
|
|
3501
3443
|
await generateBundle?.call(this, outputOptions, bundle, isWrite);
|
|
@@ -3529,7 +3471,7 @@ function createCssOnlyVitePlugins(options = {}) {
|
|
|
3529
3471
|
});
|
|
3530
3472
|
const disabled = opts.disabled === true || typeof opts.disabled === "object" && opts.disabled.plugin === true;
|
|
3531
3473
|
const shouldGenerate = !disabled && resolveWebGeneratorOptions(opts).enabled;
|
|
3532
|
-
const sourceCandidateCollector =
|
|
3474
|
+
const sourceCandidateCollector = require_generated_css_marker.createSourceCandidateCollector({
|
|
3533
3475
|
bareArbitraryValues: opts.arbitraryValues?.bareArbitraryValues,
|
|
3534
3476
|
customAttributesEntities: opts.customAttributesEntities,
|
|
3535
3477
|
disabledDefaultTemplateHandler: opts.disabledDefaultTemplateHandler
|
|
@@ -3540,7 +3482,7 @@ function createCssOnlyVitePlugins(options = {}) {
|
|
|
3540
3482
|
});
|
|
3541
3483
|
const hmrCssModuleVersions = createViteHmrCssModuleVersionTracker();
|
|
3542
3484
|
const hmrTimingRecorder = require_hmr_timing.createHmrTimingRecorder("vite");
|
|
3543
|
-
const { runtimeState,
|
|
3485
|
+
const { runtimeState, refreshRuntimeState } = createViteRuntimeClassSet({
|
|
3544
3486
|
opts,
|
|
3545
3487
|
initialTailwindRuntime: opts.tailwindRuntime,
|
|
3546
3488
|
refreshTailwindcssRuntime: opts.refreshTailwindcssRuntime,
|
|
@@ -3560,26 +3502,30 @@ function createCssOnlyVitePlugins(options = {}) {
|
|
|
3560
3502
|
let recordedCandidates;
|
|
3561
3503
|
const processedCssRegistry = createFrameworkProcessedCssRegistry();
|
|
3562
3504
|
const processedCssAssets = /* @__PURE__ */ new WeakSet();
|
|
3563
|
-
const tailwindRootCssModuleIds = /* @__PURE__ */ new Set();
|
|
3564
3505
|
const sourceScanSession = createFrameworkSourceScanSession({
|
|
3565
3506
|
cssMemory,
|
|
3566
3507
|
debug,
|
|
3567
3508
|
getResolvedConfig: () => resolvedConfig,
|
|
3568
3509
|
hmrCandidateState,
|
|
3569
|
-
isCandidateRequest:
|
|
3510
|
+
isCandidateRequest: require_generated_css_marker.isSourceCandidateRequest,
|
|
3570
3511
|
isWatchLikeBuild: () => resolvedConfig?.command === "serve" || resolvedConfig?.build.watch != null,
|
|
3571
3512
|
opts,
|
|
3572
3513
|
runtimeState,
|
|
3573
3514
|
shouldOwnTailwindGeneration: shouldGenerate,
|
|
3574
3515
|
sourceCandidateCollector
|
|
3575
3516
|
});
|
|
3576
|
-
|
|
3517
|
+
async function collectCssSourceCandidates() {
|
|
3518
|
+
await runtimeState.readyPromise;
|
|
3519
|
+
await sourceScanSession.waitForPendingSyncs();
|
|
3520
|
+
return sourceCandidateCollector.values();
|
|
3521
|
+
}
|
|
3522
|
+
const { moduleIds: tailwindRootCssModuleIds, refreshSource: refreshTailwindRootCssSource, register: registerTailwindRootCss, rememberModule: rememberTailwindRootCssModule } = createFrameworkTailwindRootCss({
|
|
3577
3523
|
getImportFallback: () => resolveWebGeneratorOptions(opts).importFallback,
|
|
3578
3524
|
refreshRuntimeState: async () => {
|
|
3579
3525
|
await refreshRuntimeState(true);
|
|
3580
3526
|
},
|
|
3581
3527
|
registerAutoCssSource: async (id, css) => {
|
|
3582
|
-
cssMemory.refreshRememberedCssSourceBySourceFile(id,
|
|
3528
|
+
cssMemory.refreshRememberedCssSourceBySourceFile(id, (0, _weapp_tailwindcss_postcss_transform.normalizeTailwindSourceForGenerator)((0, _weapp_tailwindcss_postcss_transform.normalizeTailwindConfigDirectives)(css, node_path.default.dirname((0, _weapp_tailwindcss_shared.cleanUrl)(id))), { importFallback: true }));
|
|
3583
3529
|
},
|
|
3584
3530
|
shouldOwnTailwindGeneration: shouldGenerate,
|
|
3585
3531
|
sourceScanSession
|
|
@@ -3597,13 +3543,13 @@ function createCssOnlyVitePlugins(options = {}) {
|
|
|
3597
3543
|
await sourceScanSession.waitForPendingSyncs();
|
|
3598
3544
|
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(id);
|
|
3599
3545
|
const outputFile = resolveViteCssPipelineOutputFile(file, opts, resolvedConfig?.root ?? node_process.default.cwd(), true, false, void 0);
|
|
3600
|
-
const runtime = hookContext?.sourceCandidates ? new Set(hookContext.sourceCandidates) : await
|
|
3601
|
-
const generated = await
|
|
3546
|
+
const runtime = hookContext?.sourceCandidates ? new Set(hookContext.sourceCandidates) : await collectCssSourceCandidates();
|
|
3547
|
+
const generated = await require_generated_css_marker.generateTailwindV4Css({
|
|
3602
3548
|
opts,
|
|
3603
3549
|
runtimeState,
|
|
3604
3550
|
runtime,
|
|
3605
3551
|
compilerMode: "legacy",
|
|
3606
|
-
rawSource:
|
|
3552
|
+
rawSource: (0, _weapp_tailwindcss_postcss_transform.normalizeEmptyTailwindCustomVariants)(code),
|
|
3607
3553
|
file,
|
|
3608
3554
|
outputFile,
|
|
3609
3555
|
cssHandlerOptions: cssHandlerOptions.getCssHandlerOptions(file),
|
|
@@ -3615,9 +3561,9 @@ function createCssOnlyVitePlugins(options = {}) {
|
|
|
3615
3561
|
cssStage: hookContext?.cssStage
|
|
3616
3562
|
});
|
|
3617
3563
|
if (!generated) return;
|
|
3618
|
-
const tracedCss =
|
|
3564
|
+
const tracedCss = require_generated_css_marker.annotateCssSourceTrace(generated.css, {
|
|
3619
3565
|
opts,
|
|
3620
|
-
tokenSources:
|
|
3566
|
+
tokenSources: require_generated_css_marker.isCssSourceTraceEnabled(opts) ? require_generated_css_marker.createCssTokenSourceMap(sourceCandidateCollector.sourcesForEntries(void 0), opts) : void 0
|
|
3621
3567
|
});
|
|
3622
3568
|
generatedCssByFile.set(file, tracedCss);
|
|
3623
3569
|
processedCssRegistry.record(file, tracedCss, {
|
|
@@ -3627,7 +3573,7 @@ function createCssOnlyVitePlugins(options = {}) {
|
|
|
3627
3573
|
processedCssRegistry.markSource(file);
|
|
3628
3574
|
recordedCandidates = new Set(runtime);
|
|
3629
3575
|
for (const dependency of generated.dependencies) hookContext?.addWatchFile?.(dependency);
|
|
3630
|
-
return `${
|
|
3576
|
+
return `${(0, _weapp_tailwindcss_postcss_transform.createBundlerGeneratedCssMarker)("vite", file)}\n${tracedCss}`;
|
|
3631
3577
|
});
|
|
3632
3578
|
const rewritePlugins = createRewriteCssImportsPlugins({
|
|
3633
3579
|
getAppType: () => void 0,
|
|
@@ -3692,7 +3638,7 @@ function createCssOnlyVitePlugins(options = {}) {
|
|
|
3692
3638
|
const finalizer = createViteWebCssFinalizerOutputPlugin({
|
|
3693
3639
|
opts,
|
|
3694
3640
|
runtimeState,
|
|
3695
|
-
ensureRuntimeClassSet,
|
|
3641
|
+
ensureRuntimeClassSet: collectCssSourceCandidates,
|
|
3696
3642
|
debug,
|
|
3697
3643
|
frameworkName: "generic",
|
|
3698
3644
|
getResolvedConfig: () => resolvedConfig,
|
|
@@ -3740,9 +3686,9 @@ function createFrameworkSourceCandidatesPluginForCssOnly(options) {
|
|
|
3740
3686
|
name: `${require_compiler.vitePluginName}:source-candidates`,
|
|
3741
3687
|
enforce: "pre",
|
|
3742
3688
|
async transform(code, id) {
|
|
3743
|
-
if (!options.sourceCandidateCollector || !
|
|
3689
|
+
if (!options.sourceCandidateCollector || !require_generated_css_marker.isSourceCandidateRequest(id)) return;
|
|
3744
3690
|
options.cssMemory.rememberKnownSfcSource(id, code);
|
|
3745
|
-
if (isCSSRequest(id) &&
|
|
3691
|
+
if (isCSSRequest(id) && (0, _weapp_tailwindcss_postcss_transform.hasUserCssLayerBlocks)(code)) options.rememberTailwindRootCssModule(id);
|
|
3746
3692
|
await options.sourceCandidateCollector.merge(id, code);
|
|
3747
3693
|
},
|
|
3748
3694
|
async watchChange(id) {
|
|
@@ -3767,11 +3713,12 @@ function createFrameworkSourceCandidatesPluginForCssOnly(options) {
|
|
|
3767
3713
|
function createGenericWebVitePlugins(options = {}) {
|
|
3768
3714
|
const capability = createGenericWebViteCapabilityProfile(options);
|
|
3769
3715
|
const owner = createViteSourceOutputRelationOwner();
|
|
3770
|
-
const
|
|
3716
|
+
const runtimeOptions = {
|
|
3771
3717
|
...options,
|
|
3772
3718
|
__internalViteCapabilityProfile: capability,
|
|
3773
3719
|
__internalViteWebStyleInjectorFactory: createBuiltinViteWebStyleInjectorPlugins
|
|
3774
|
-
}
|
|
3720
|
+
};
|
|
3721
|
+
const plugins = withViteSourceOutputRelationOwner(owner, () => createCssOnlyVitePlugins(runtimeOptions));
|
|
3775
3722
|
if (!plugins) {
|
|
3776
3723
|
owner.dispose();
|
|
3777
3724
|
return;
|
|
@@ -3780,26 +3727,25 @@ function createGenericWebVitePlugins(options = {}) {
|
|
|
3780
3727
|
const wrapped = { ...plugin };
|
|
3781
3728
|
if (plugin.watchChange) {
|
|
3782
3729
|
const hook = plugin.watchChange;
|
|
3783
|
-
wrapped.watchChange = async function(
|
|
3784
|
-
|
|
3785
|
-
if (args[1]?.event === "delete") owner.removeSource(id);
|
|
3730
|
+
wrapped.watchChange = async function(id, change) {
|
|
3731
|
+
if (change?.event === "delete") owner.removeSource(id);
|
|
3786
3732
|
else if (typeof id === "string") owner.observeSource(id);
|
|
3787
|
-
return typeof hook === "function" ? hook.
|
|
3733
|
+
return typeof hook === "function" ? hook.call(this, id, change) : hook.handler.call(this, id, change);
|
|
3788
3734
|
};
|
|
3789
3735
|
}
|
|
3790
3736
|
if (plugin.handleHotUpdate) {
|
|
3791
3737
|
const hook = plugin.handleHotUpdate;
|
|
3792
|
-
wrapped.handleHotUpdate = async function(
|
|
3793
|
-
const file =
|
|
3738
|
+
wrapped.handleHotUpdate = async function(context) {
|
|
3739
|
+
const file = context.file;
|
|
3794
3740
|
if (typeof file === "string") owner.observeSource(file);
|
|
3795
|
-
return typeof hook === "function" ? hook.
|
|
3741
|
+
return typeof hook === "function" ? hook.call(this, context) : hook.handler.call(this, context);
|
|
3796
3742
|
};
|
|
3797
3743
|
}
|
|
3798
3744
|
if (plugin.closeBundle) {
|
|
3799
3745
|
const hook = plugin.closeBundle;
|
|
3800
|
-
wrapped.closeBundle = async function(
|
|
3746
|
+
wrapped.closeBundle = async function() {
|
|
3801
3747
|
try {
|
|
3802
|
-
return typeof hook === "function" ? await hook.
|
|
3748
|
+
return typeof hook === "function" ? await hook.call(this) : await hook.handler.call(this);
|
|
3803
3749
|
} finally {
|
|
3804
3750
|
owner.dispose();
|
|
3805
3751
|
}
|
|
@@ -4019,6 +3965,12 @@ Object.defineProperty(exports, "finalizeWebCss", {
|
|
|
4019
3965
|
return finalizeWebCss;
|
|
4020
3966
|
}
|
|
4021
3967
|
});
|
|
3968
|
+
Object.defineProperty(exports, "finalizeWebCssCalc", {
|
|
3969
|
+
enumerable: true,
|
|
3970
|
+
get: function() {
|
|
3971
|
+
return finalizeWebCssCalc;
|
|
3972
|
+
}
|
|
3973
|
+
});
|
|
4022
3974
|
Object.defineProperty(exports, "formatPostcssSourceMap", {
|
|
4023
3975
|
enumerable: true,
|
|
4024
3976
|
get: function() {
|
|
@@ -4049,12 +4001,6 @@ Object.defineProperty(exports, "hasMatchingStyleFileBase", {
|
|
|
4049
4001
|
return hasMatchingStyleFileBase;
|
|
4050
4002
|
}
|
|
4051
4003
|
});
|
|
4052
|
-
Object.defineProperty(exports, "hasNonCommentCss", {
|
|
4053
|
-
enumerable: true,
|
|
4054
|
-
get: function() {
|
|
4055
|
-
return hasNonCommentCss;
|
|
4056
|
-
}
|
|
4057
|
-
});
|
|
4058
4004
|
Object.defineProperty(exports, "hasSelfAcceptingNonStyleHotModule", {
|
|
4059
4005
|
enumerable: true,
|
|
4060
4006
|
get: function() {
|
|
@@ -4139,12 +4085,6 @@ Object.defineProperty(exports, "isSfcStyleSourceFile", {
|
|
|
4139
4085
|
return isSfcStyleSourceFile;
|
|
4140
4086
|
}
|
|
4141
4087
|
});
|
|
4142
|
-
Object.defineProperty(exports, "isStyleImportRequest", {
|
|
4143
|
-
enumerable: true,
|
|
4144
|
-
get: function() {
|
|
4145
|
-
return isStyleImportRequest;
|
|
4146
|
-
}
|
|
4147
|
-
});
|
|
4148
4088
|
Object.defineProperty(exports, "mergeHotModulesByIdentity", {
|
|
4149
4089
|
enumerable: true,
|
|
4150
4090
|
get: function() {
|
|
@@ -4211,22 +4151,22 @@ Object.defineProperty(exports, "readAssetSource", {
|
|
|
4211
4151
|
return readAssetSource$1;
|
|
4212
4152
|
}
|
|
4213
4153
|
});
|
|
4214
|
-
Object.defineProperty(exports, "
|
|
4154
|
+
Object.defineProperty(exports, "readViteHmrSource", {
|
|
4215
4155
|
enumerable: true,
|
|
4216
4156
|
get: function() {
|
|
4217
|
-
return
|
|
4157
|
+
return readViteHmrSource;
|
|
4218
4158
|
}
|
|
4219
4159
|
});
|
|
4220
|
-
Object.defineProperty(exports, "
|
|
4160
|
+
Object.defineProperty(exports, "registerGeneratorDependencies", {
|
|
4221
4161
|
enumerable: true,
|
|
4222
4162
|
get: function() {
|
|
4223
|
-
return
|
|
4163
|
+
return registerGeneratorDependencies;
|
|
4224
4164
|
}
|
|
4225
4165
|
});
|
|
4226
|
-
Object.defineProperty(exports, "
|
|
4166
|
+
Object.defineProperty(exports, "removeDuplicateUnlinkedRootCssAssetsReferencedByHtml", {
|
|
4227
4167
|
enumerable: true,
|
|
4228
4168
|
get: function() {
|
|
4229
|
-
return
|
|
4169
|
+
return removeDuplicateUnlinkedRootCssAssetsReferencedByHtml;
|
|
4230
4170
|
}
|
|
4231
4171
|
});
|
|
4232
4172
|
Object.defineProperty(exports, "resolveHotSourceModules", {
|