weapp-tailwindcss 5.5.6 → 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 +1 -1
- 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 -1
- package/dist/bundlers/shared/framework-css-composition.d.ts +1 -1
- package/dist/bundlers/shared/framework-postcss.d.ts +1 -25
- package/dist/bundlers/shared/framework-user-css.d.ts +1 -4
- package/dist/bundlers/shared/generated-css-marker.d.ts +1 -10
- 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 -23
- 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 -12
- package/dist/bundlers/shared/generator-css/legacy-selectors.d.ts +1 -2
- 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 -60
- 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 -64
- package/dist/bundlers/shared/generator-css/user-css/apply-only.d.ts +1 -10
- 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 -4
- package/dist/bundlers/shared/generator-css/user-css/generated-cleanup.d.ts +1 -6
- 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 -13
- 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 -7
- package/dist/bundlers/shared/style-requests.d.ts +1 -5
- package/dist/bundlers/shared/v4-generation-core.d.ts +1 -20
- package/dist/bundlers/vite/generate-bundle/configured-css-sources.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/css-transform-task.d.ts +2 -2
- package/dist/bundlers/vite/processed-css-assets/cleanup.d.ts +1 -1
- package/dist/bundlers/vite/processed-css-assets/coverage.d.ts +1 -12
- 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/framework-module-candidates.d.ts +2 -2
- 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/source-candidate-cache.d.ts +1 -1
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.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/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/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-D3GBwxoa.js → compiler-CThodfGH.js} +3098 -3067
- package/dist/{compiler-C8FqI-P3.cjs → compiler-DkGY5Nmh.cjs} +5011 -4980
- package/dist/core/compiler/generation-cache.d.ts +4 -2
- package/dist/core/compiler/types.d.ts +1 -1
- package/dist/core.cjs +7 -7
- package/dist/core.d.ts +2 -2
- package/dist/core.js +2 -2
- package/dist/css-cleanup-B6FUJC3z.cjs +1 -0
- package/dist/{css-imports-XvtI1zCY.cjs → css-imports-R_RDMjPz.cjs} +7 -21
- package/dist/css-macro/auto.d.ts +1 -1
- package/dist/css-macro/postcss.cjs +1 -1
- package/dist/css-macro.cjs +2 -2
- package/dist/css-macro.js +1 -1
- package/dist/final-css-cleanup-B6FUJC3z.cjs +1 -0
- package/dist/{final-css-cleanup-u_sI2p56.js → final-css-cleanup-BOzhuhGz.js} +3 -2
- package/dist/framework.cjs +1 -1
- package/dist/{v4-generation-core-Cz1D7wm1.cjs → generated-css-marker-jMNbQHpy.cjs} +638 -1546
- 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-BExe5RBF.cjs → gulp-CVvBpIlq.cjs} +27 -26
- package/dist/{gulp-BhkIIk7J.js → gulp-DhddVxGA.js} +6 -5
- package/dist/gulp.cjs +1 -1
- package/dist/gulp.js +1 -1
- package/dist/{hmr-timing-CoiJIqDu.cjs → hmr-timing-DfMbbZ1E.cjs} +13 -13
- package/dist/{hmr-timing-B9Yt86-U.js → hmr-timing-xPpat-km.js} +518 -1360
- 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/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/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-BUBls_oM.cjs → scoped-generator-BIZ7N_J-.cjs} +9 -9
- package/dist/{scoped-generator-B6Y1bxzM.js → scoped-generator-DlQrVbuC.js} +7 -6
- package/dist/{source-candidate-scan-signature-DNuGKTqf.js → source-candidate-scan-signature-BjVQYL-C.js} +3 -3
- package/dist/{source-candidate-scan-signature-BtJZp28T.cjs → source-candidate-scan-signature-nG-rg809.cjs} +4 -4
- package/dist/style-injector/internal.d.ts +35 -35
- package/dist/style-injector/options.d.ts +1 -1
- package/dist/tailwindcss/miniprogram.d.ts +1 -1
- package/dist/tailwindcss/remove-unsupported-css.d.ts +1 -1
- 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 -3
- 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/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-CBYjzRmV.cjs → tailwindcss-U3KIUegn.cjs} +65 -264
- package/dist/{tailwindcss-B_4E52WF.js → tailwindcss-kSd0ykiX.js} +71 -243
- package/dist/{transform-CkEnJYIP.js → transform-BAon9ykq.js} +25 -16
- package/dist/{transform-FkqbTBJR.cjs → transform-D2KFdA3C.cjs} +32 -23
- package/dist/types/index.d.ts +2 -2
- package/dist/types/user-defined-options/general.d.ts +1 -1
- package/dist/uni-app-x/border-preflight.d.ts +1 -1
- package/dist/uni-app-x/component-local-style.d.ts +3 -1
- package/dist/uni-app-x/vite/style-result.d.ts +1 -1
- 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-DxuKPZlp.cjs → vite-BxW0qd7J.cjs} +217 -828
- package/dist/{vite-lP35OguX.js → vite-D-RGkmOE.js} +62 -674
- 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 +33 -28
- package/dist/weapp-tw-runtime-classset-loader.cjs +5 -18
- package/dist/{web-Dfz_jpNj.js → web--kA4HUTm.js} +16 -115
- package/dist/{web-DhDxhlkq.cjs → web-Y-H6I1k6.cjs} +83 -192
- package/dist/{webpack-D6jp1o3m.js → webpack-BB-kw4Qr.js} +27 -440
- package/dist/{webpack-R2Sbggiy.cjs → webpack-DxrWatNB.cjs} +87 -87
- package/dist/webpack.cjs +1 -1
- package/dist/webpack.js +1 -1
- package/package.json +10 -5
- package/dist/final-css-cleanup-CDTmVAye.cjs +0 -1
- package/dist/generator-Bvr4WmuF.cjs +0 -3891
- package/dist/generator-C0BJjyLM.js +0 -3343
- package/dist/pipeline-helpers-BOjTEmMi.cjs +0 -971
|
@@ -1,16 +1,17 @@
|
|
|
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 require_tailwindcss = require("./tailwindcss-CBYjzRmV.cjs");
|
|
3
|
+
const require_generator = require("./generator-CxauQbx3.cjs");
|
|
5
4
|
require("./utils-CuKLf1Zv.cjs");
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
require("./
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
const
|
|
5
|
+
const require_compiler = require("./compiler-DkGY5Nmh.cjs");
|
|
6
|
+
const require_tailwindcss = require("./tailwindcss-U3KIUegn.cjs");
|
|
7
|
+
const require_generated_css_marker = require("./generated-css-marker-jMNbQHpy.cjs");
|
|
8
|
+
const require_cache = require("./cache-CzvIGfwS.cjs");
|
|
9
|
+
const require_hmr_timing = require("./hmr-timing-DfMbbZ1E.cjs");
|
|
10
|
+
require("./final-css-cleanup-B6FUJC3z.cjs");
|
|
11
|
+
const require_scoped_generator = require("./scoped-generator-BIZ7N_J-.cjs");
|
|
12
|
+
const require_web = require("./web-Y-H6I1k6.cjs");
|
|
13
|
+
const require_source_candidate_scan_signature = require("./source-candidate-scan-signature-nG-rg809.cjs");
|
|
14
|
+
require("./css-cleanup-B6FUJC3z.cjs");
|
|
14
15
|
require("./logger-TlKT3xmR.cjs");
|
|
15
16
|
let node_fs = require("node:fs");
|
|
16
17
|
node_fs = require_rolldown_runtime.__toESM(node_fs, 1);
|
|
@@ -18,59 +19,26 @@ let node_path = require("node:path");
|
|
|
18
19
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
19
20
|
let node_process = require("node:process");
|
|
20
21
|
node_process = require_rolldown_runtime.__toESM(node_process, 1);
|
|
21
|
-
let
|
|
22
|
-
let
|
|
22
|
+
let _weapp_tailwindcss_engine = require("@weapp-tailwindcss/engine");
|
|
23
|
+
let _weapp_tailwindcss_postcss_transform = require("@weapp-tailwindcss/postcss/transform");
|
|
23
24
|
let lru_cache = require("lru-cache");
|
|
24
|
-
let node_fs_promises = require("node:fs/promises");
|
|
25
|
-
let micromatch = require("micromatch");
|
|
26
|
-
micromatch = require_rolldown_runtime.__toESM(micromatch, 1);
|
|
27
25
|
let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
|
|
28
26
|
let node_buffer = require("node:buffer");
|
|
27
|
+
let node_fs_promises = require("node:fs/promises");
|
|
29
28
|
let _weapp_tailwindcss_logger = require("@weapp-tailwindcss/logger");
|
|
30
29
|
let node_async_hooks = require("node:async_hooks");
|
|
30
|
+
let micromatch = require("micromatch");
|
|
31
|
+
micromatch = require_rolldown_runtime.__toESM(micromatch, 1);
|
|
31
32
|
let _vue_compiler_dom = require("@vue/compiler-dom");
|
|
32
33
|
let comment_json = require("comment-json");
|
|
33
34
|
//#region src/uni-app-x/style-asset/harmony-apply.ts
|
|
34
35
|
const SFC_STYLE_BLOCK_RE$1 = /(<style\b[^>]*>)([\s\S]*?)(<\/style>)/gi;
|
|
35
|
-
function createGeneratedRuleMap(css) {
|
|
36
|
-
let root;
|
|
37
|
-
try {
|
|
38
|
-
root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
39
|
-
} catch {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
const rules = /* @__PURE__ */ new Map();
|
|
43
|
-
root.walkRules((rule) => {
|
|
44
|
-
if (rule.nodes && rule.nodes.length > 0) rules.set(rule.selector.trim(), rule.nodes.map((node) => node.clone()));
|
|
45
|
-
});
|
|
46
|
-
return rules.size > 0 ? rules : void 0;
|
|
47
|
-
}
|
|
48
36
|
function expandUniAppXHarmonyApplyStyles(source, generatedCss) {
|
|
49
37
|
if (!source.includes("@apply")) return source;
|
|
50
|
-
const
|
|
51
|
-
if (!
|
|
52
|
-
return source.replace(SFC_STYLE_BLOCK_RE$1, (
|
|
53
|
-
|
|
54
|
-
let root;
|
|
55
|
-
try {
|
|
56
|
-
root = (0, _weapp_tailwindcss_postcss.parseUniAppXStyleSource)(styleSource);
|
|
57
|
-
} catch {
|
|
58
|
-
return block;
|
|
59
|
-
}
|
|
60
|
-
let changed = false;
|
|
61
|
-
root.walkRules((rule) => {
|
|
62
|
-
if (!(rule.nodes?.some((node) => node.type === "atrule" && node.name === "apply") === true)) return;
|
|
63
|
-
const generatedNodes = generatedRules.get(rule.selector.trim());
|
|
64
|
-
if (!generatedNodes) return;
|
|
65
|
-
rule.removeAll();
|
|
66
|
-
rule.append(generatedNodes.map((node) => node.clone()));
|
|
67
|
-
changed = true;
|
|
68
|
-
});
|
|
69
|
-
if (!changed) return block;
|
|
70
|
-
if (!root.toString().includes("@apply")) root.walkAtRules("reference", (rule) => {
|
|
71
|
-
rule.remove();
|
|
72
|
-
});
|
|
73
|
-
return `${open}${root.toString()}${close}`;
|
|
38
|
+
const expand = (0, _weapp_tailwindcss_postcss_transform.createUniAppXHarmonyApplyCssExpander)(generatedCss);
|
|
39
|
+
if (!expand) return source;
|
|
40
|
+
return source.replace(SFC_STYLE_BLOCK_RE$1, (_block, open, styleSource, close) => {
|
|
41
|
+
return `${open}${expand(styleSource)}${close}`;
|
|
74
42
|
});
|
|
75
43
|
}
|
|
76
44
|
//#endregion
|
|
@@ -103,7 +71,6 @@ const STYLE_ENTRY_RE = /\[\s*("((?:\\.|[^"\\])+)")\s*,\s*(_pS\(_uM\(\[[\s\S]*?\]
|
|
|
103
71
|
const STRING_LITERAL_RE = /(['"`])((?:\\.|(?!\1)[\s\S])*?)\1/g;
|
|
104
72
|
const SFC_STYLE_BLOCK_RE = /<style\b[^>]*>([\s\S]*?)<\/style>/gi;
|
|
105
73
|
const STYLE_EXPORT_PREFIX_RE = /^\s*export\s+default\s+/;
|
|
106
|
-
const STRING_STYLE_PROPERTIES = /* @__PURE__ */ new Set(["lineHeight"]);
|
|
107
74
|
function cloneStyleEntry(entry) {
|
|
108
75
|
return Object.fromEntries(Object.entries(entry).map(([state, declarations]) => [state, { ...declarations }]));
|
|
109
76
|
}
|
|
@@ -118,18 +85,6 @@ function mergeStyleEntry(local, generated) {
|
|
|
118
85
|
function cloneStyleValue(style) {
|
|
119
86
|
return Object.fromEntries(Object.entries(style).map(([className, entry]) => [className, cloneStyleEntry(entry)]));
|
|
120
87
|
}
|
|
121
|
-
function toCamelCase(prop) {
|
|
122
|
-
return prop.replace(/-([a-z])/g, (_, char) => char.toUpperCase());
|
|
123
|
-
}
|
|
124
|
-
function normalizeValue(prop, value) {
|
|
125
|
-
const trimmed = value.trim();
|
|
126
|
-
if (!STRING_STYLE_PROPERTIES.has(toCamelCase(prop)) && /^-?\d+(?:\.\d+)?px$/.test(trimmed)) return Number(trimmed.slice(0, -2));
|
|
127
|
-
return trimmed.replace(/\s*,\s*/g, ",");
|
|
128
|
-
}
|
|
129
|
-
function normalizeStyleValue(prop, value) {
|
|
130
|
-
if (typeof value === "number") return STRING_STYLE_PROPERTIES.has(toCamelCase(prop)) ? String(value) : value;
|
|
131
|
-
return normalizeValue(prop, value);
|
|
132
|
-
}
|
|
133
88
|
function parseStyleExport(source) {
|
|
134
89
|
const json = source.replace(STYLE_EXPORT_PREFIX_RE, "").trim();
|
|
135
90
|
if (!json) return;
|
|
@@ -160,7 +115,7 @@ function styleExportToUtsMap(styleExport) {
|
|
|
160
115
|
const declarations = styleStates[""];
|
|
161
116
|
if (!declarations || Object.keys(declarations).length === 0) continue;
|
|
162
117
|
const declarationEntries = Object.entries(declarations).map(([prop, value]) => {
|
|
163
|
-
return `[${JSON.stringify(
|
|
118
|
+
return `[${JSON.stringify((0, _weapp_tailwindcss_postcss_transform.normalizeUniAppXStyleProperty)(prop))}, ${JSON.stringify((0, _weapp_tailwindcss_postcss_transform.normalizeUniAppXStyleValue)(prop, value))}]`;
|
|
164
119
|
});
|
|
165
120
|
if (declarationEntries.length === 0) continue;
|
|
166
121
|
classEntries.push(`[${JSON.stringify(className)}, _pS(_uM([${declarationEntries.join(", ")}]))]`);
|
|
@@ -190,7 +145,7 @@ function collectUsedClassNames(code, entries) {
|
|
|
190
145
|
for (const literalMatch of code.matchAll(STRING_LITERAL_RE)) {
|
|
191
146
|
const literal = literalMatch[2];
|
|
192
147
|
if (!literal) continue;
|
|
193
|
-
for (const candidate of (0,
|
|
148
|
+
for (const candidate of (0, _weapp_tailwindcss_engine.splitCandidateTokens)(literal)) if (entries.has(candidate)) used.add(candidate);
|
|
194
149
|
}
|
|
195
150
|
return used;
|
|
196
151
|
}
|
|
@@ -206,7 +161,7 @@ function createUtsStyleArrayFromAppStyles(code, appSource) {
|
|
|
206
161
|
return createUtsStyleArray([...used].map((className) => entries.get(className)).filter(Boolean));
|
|
207
162
|
}
|
|
208
163
|
function cssSourceToStyleValue(source) {
|
|
209
|
-
return STYLE_EXPORT_PREFIX_RE.test(source) ? parseStyleExport(source) : (0,
|
|
164
|
+
return STYLE_EXPORT_PREFIX_RE.test(source) ? parseStyleExport(source) : (0, _weapp_tailwindcss_postcss_transform.cssToClassStyleValue)(source);
|
|
210
165
|
}
|
|
211
166
|
function mergeStyleValues(...items) {
|
|
212
167
|
const result = {};
|
|
@@ -222,7 +177,7 @@ function createStyleValueFromApplySources(sources, utilityStyles) {
|
|
|
222
177
|
for (const source of sources) {
|
|
223
178
|
const styleSources = source.includes("<style") ? [...source.matchAll(SFC_STYLE_BLOCK_RE)].map((styleBlock) => styleBlock[1] ?? "") : [source];
|
|
224
179
|
for (const styleSource of styleSources) {
|
|
225
|
-
const applied = (0,
|
|
180
|
+
const applied = (0, _weapp_tailwindcss_postcss_transform.expandCssApplySourcesToStyleValue)(styleSource, utilityStyles);
|
|
226
181
|
if (!applied) continue;
|
|
227
182
|
Object.assign(result, applied);
|
|
228
183
|
}
|
|
@@ -230,31 +185,15 @@ function createStyleValueFromApplySources(sources, utilityStyles) {
|
|
|
230
185
|
return Object.keys(result).length > 0 ? result : void 0;
|
|
231
186
|
}
|
|
232
187
|
function resolveReferencePaths(styleSource, sourceId) {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
root = (0, _weapp_tailwindcss_postcss.parseUniAppXStyleSource)(styleSource);
|
|
236
|
-
} catch {
|
|
237
|
-
return styleSource;
|
|
238
|
-
}
|
|
239
|
-
if (!sourceId || !styleSource.includes("@reference")) return root.toString();
|
|
240
|
-
const cleanSourceId = sourceId.replace(/\?.*$/, "");
|
|
241
|
-
root.walkAtRules("reference", (rule) => {
|
|
242
|
-
const quote = rule.params[0];
|
|
243
|
-
if (quote !== "\"" && quote !== "'") return;
|
|
244
|
-
const closingQuoteIndex = rule.params.indexOf(quote, 1);
|
|
245
|
-
if (closingQuoteIndex <= 1) return;
|
|
246
|
-
const referencePath = rule.params.slice(1, closingQuoteIndex);
|
|
247
|
-
if (!referencePath.startsWith(".")) return;
|
|
248
|
-
rule.params = `${quote}${resolveStyleReferencePath(cleanSourceId, referencePath)}${quote}${rule.params.slice(closingQuoteIndex + 1)}`;
|
|
249
|
-
});
|
|
250
|
-
return root.toString();
|
|
188
|
+
const cleanSourceId = sourceId?.replace(/\?.*$/, "");
|
|
189
|
+
return (0, _weapp_tailwindcss_postcss_transform.rewriteUniAppXStyleReferences)(styleSource, sourceId ? (reference) => resolveStyleReferencePath(cleanSourceId, reference) : void 0);
|
|
251
190
|
}
|
|
252
191
|
function collectUniAppXHarmonyApplyStyleSourcesFromSource(source, sourceId) {
|
|
253
192
|
return (source.includes("<style") ? [...source.matchAll(SFC_STYLE_BLOCK_RE)].map((styleBlock) => styleBlock[1] ?? "") : [source]).map((styleSource) => resolveReferencePaths(styleSource.trim(), sourceId)).filter((styleSource) => styleSource.length > 0 && styleSource.includes("@apply"));
|
|
254
193
|
}
|
|
255
194
|
function collectUniAppXHarmonyApplyUtilitiesFromSources(sources) {
|
|
256
195
|
const utilities = /* @__PURE__ */ new Set();
|
|
257
|
-
for (const source of sources) for (const styleSource of collectUniAppXHarmonyApplyStyleSourcesFromSource(source)) for (const utility of (0,
|
|
196
|
+
for (const source of sources) for (const styleSource of collectUniAppXHarmonyApplyStyleSourcesFromSource(source)) for (const utility of (0, _weapp_tailwindcss_postcss_transform.collectCssApplyUtilities)(styleSource)) utilities.add(utility);
|
|
258
197
|
return utilities;
|
|
259
198
|
}
|
|
260
199
|
function createMergedStyleValue(code, localStyle, appStyle) {
|
|
@@ -468,18 +407,7 @@ function resolveSourceMapFiles(file) {
|
|
|
468
407
|
}
|
|
469
408
|
const UNI_APP_X_STYLE_PLACEHOLDER_VERSION = "uni-app-x-style-placeholder-v3";
|
|
470
409
|
function createUniAppXHarmonyApplyGeneratorSource(applyStyleSources, _applyUtilities) {
|
|
471
|
-
return
|
|
472
|
-
let root;
|
|
473
|
-
try {
|
|
474
|
-
root = (0, _weapp_tailwindcss_postcss.parseUniAppXStyleSource)(source);
|
|
475
|
-
} catch {
|
|
476
|
-
return source;
|
|
477
|
-
}
|
|
478
|
-
root.walkAtRules("reference", (rule) => {
|
|
479
|
-
if (rule.params.match(/^(['"])(.+?)\1/)?.[2]?.startsWith(".")) rule.remove();
|
|
480
|
-
});
|
|
481
|
-
return root.toString();
|
|
482
|
-
}).join("\n");
|
|
410
|
+
return (0, _weapp_tailwindcss_postcss_transform.createUniAppXHarmonyApplyGeneratorSource)(applyStyleSources);
|
|
483
411
|
}
|
|
484
412
|
function collectUniAppXHarmonyApplyUtilities(bundle) {
|
|
485
413
|
const utilities = /* @__PURE__ */ new Set();
|
|
@@ -794,9 +722,9 @@ function createCssImportShell$1(targetFile, importedFile) {
|
|
|
794
722
|
function resolveSingleCssImportOutputFile(targetFile, css) {
|
|
795
723
|
let importedFile;
|
|
796
724
|
try {
|
|
797
|
-
|
|
725
|
+
_weapp_tailwindcss_postcss_transform.postcss.parse(css).walkAtRules("import", (atRule) => {
|
|
798
726
|
if (importedFile !== void 0) return;
|
|
799
|
-
const request =
|
|
727
|
+
const request = (0, _weapp_tailwindcss_postcss_transform.parseImportRequest)(atRule.params);
|
|
800
728
|
if (!request || /^(?:https?:)?\/\//i.test(request) || request.startsWith("data:")) return;
|
|
801
729
|
const cleanRequest = request.replace(/[?#].*$/, "");
|
|
802
730
|
if (!/\.(?:css|wxss|acss|ttss|qss|jxss|tyss)$/i.test(cleanRequest)) return;
|
|
@@ -815,7 +743,7 @@ function shouldKeepRootMiniProgramStyleAsImportShell(enabled) {
|
|
|
815
743
|
return enabled === true;
|
|
816
744
|
}
|
|
817
745
|
function shouldPreserveFrameworkRootMiniProgramImportShell(options) {
|
|
818
|
-
return !options.isWebGeneratorTarget && options.matchesCss && require_web.isRootStyleOutputFile(options.file) && (0,
|
|
746
|
+
return !options.isWebGeneratorTarget && options.matchesCss && require_web.isRootStyleOutputFile(options.file) && (0, _weapp_tailwindcss_postcss_transform.isPureLocalCssImportWrapper)(options.css) && shouldKeepRootMiniProgramStyleAsImportShell(options.shouldKeep());
|
|
819
747
|
}
|
|
820
748
|
function resolveFrameworkRootImportShellPlan(options) {
|
|
821
749
|
const isCurrentImportShell = shouldPreserveFrameworkRootMiniProgramImportShell({
|
|
@@ -940,7 +868,7 @@ function createFrameworkStyleMemory(targetByFile) {
|
|
|
940
868
|
for (const [file, asset] of Object.entries(bundle)) {
|
|
941
869
|
if (asset.type !== "asset" || !isRootMiniProgramStyleOutputFile$1(asset.fileName || file)) continue;
|
|
942
870
|
const source = typeof asset.source === "string" ? asset.source : node_buffer.Buffer.from(asset.source).toString();
|
|
943
|
-
if (
|
|
871
|
+
if ((0, _weapp_tailwindcss_postcss_transform.hasBundlerGeneratedCssMarker)(source)) sources.delete(require_source_candidate_scan_signature.normalizeOutputPathKey(asset.fileName || file));
|
|
944
872
|
else inputs.set(require_source_candidate_scan_signature.normalizeOutputPathKey(asset.fileName || file), {
|
|
945
873
|
...asset,
|
|
946
874
|
source
|
|
@@ -955,56 +883,8 @@ function createFrameworkStyleMemory(targetByFile) {
|
|
|
955
883
|
}
|
|
956
884
|
//#endregion
|
|
957
885
|
//#region src/bundlers/vite/processed-css-assets/cleanup.ts
|
|
958
|
-
function collectCssImportAtRuleCss(css) {
|
|
959
|
-
if (!css.includes("@import")) return [];
|
|
960
|
-
const fallbackImports = [...css.matchAll(/@import\s[^;]+;?/g)].map((match) => match[0]);
|
|
961
|
-
if (fallbackImports.length > 0) return fallbackImports;
|
|
962
|
-
try {
|
|
963
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
964
|
-
const imports = [];
|
|
965
|
-
root.each((node) => {
|
|
966
|
-
if (node.type === "atrule" && node.name === "import") imports.push(node.toString());
|
|
967
|
-
});
|
|
968
|
-
return imports;
|
|
969
|
-
} catch {
|
|
970
|
-
return [];
|
|
971
|
-
}
|
|
972
|
-
}
|
|
973
|
-
function parseCssImportRequest(importCss) {
|
|
974
|
-
const trimmed = importCss.trim();
|
|
975
|
-
if (!trimmed.startsWith("@import")) return;
|
|
976
|
-
const params = trimmed.slice(7).trim().replace(/;$/, "").trim();
|
|
977
|
-
return (0, _weapp_tailwindcss_postcss.parseTailwindCssDirectiveRequest)(params);
|
|
978
|
-
}
|
|
979
|
-
function shouldRestoreCssImportAtRule(importCss, file) {
|
|
980
|
-
if (file === void 0 || !require_web.isMiniProgramStyleOutputFile(file)) return true;
|
|
981
|
-
const request = parseCssImportRequest(importCss);
|
|
982
|
-
if (request === void 0) return false;
|
|
983
|
-
if ((0, _weapp_tailwindcss_postcss.isMiniProgramLocalCssImportRequest)(request)) return true;
|
|
984
|
-
return require_web.isStyleImportRequest(request) && !request.includes("/");
|
|
985
|
-
}
|
|
986
886
|
function restoreCssImportAtRules(source, filtered, file) {
|
|
987
|
-
|
|
988
|
-
if (imports.length === 0) return filtered;
|
|
989
|
-
const missingImports = imports.filter((importCss) => !filtered.includes(importCss));
|
|
990
|
-
if (missingImports.length === 0) return filtered;
|
|
991
|
-
return require_web.appendCss(missingImports.join("\n"), filtered);
|
|
992
|
-
}
|
|
993
|
-
function removeCommentOnlyAtRules(css) {
|
|
994
|
-
if (!(0, _weapp_tailwindcss_postcss.hasEmptyCssBlockCandidate)(css)) return css;
|
|
995
|
-
try {
|
|
996
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
997
|
-
let changed = false;
|
|
998
|
-
root.walkAtRules((atRule) => {
|
|
999
|
-
if (!atRule.nodes || atRule.nodes.length === 0) return;
|
|
1000
|
-
if (atRule.nodes.some((node) => node.type !== "comment")) return;
|
|
1001
|
-
atRule.remove();
|
|
1002
|
-
changed = true;
|
|
1003
|
-
});
|
|
1004
|
-
return changed ? root.toString() : css;
|
|
1005
|
-
} catch {
|
|
1006
|
-
return css;
|
|
1007
|
-
}
|
|
887
|
+
return (0, _weapp_tailwindcss_postcss_transform.restoreProcessedCssImports)(source, filtered, file !== void 0 && require_web.isMiniProgramStyleOutputFile(file));
|
|
1008
888
|
}
|
|
1009
889
|
function collectImportedBundleCssSources(bundle, importedStyleFiles) {
|
|
1010
890
|
if (importedStyleFiles.size === 0) return [];
|
|
@@ -1081,16 +961,7 @@ function findBundleAssetByOutputFile(bundle, file) {
|
|
|
1081
961
|
function isCssImportOnlyBundleAsset(bundle, file, css) {
|
|
1082
962
|
const importedStyleFiles = require_web.collectImportedStyleFiles(css, file);
|
|
1083
963
|
if (importedStyleFiles.size === 0) return false;
|
|
1084
|
-
|
|
1085
|
-
try {
|
|
1086
|
-
_weapp_tailwindcss_postcss.postcss.parse(css).each((node) => {
|
|
1087
|
-
if (node.type === "comment") return;
|
|
1088
|
-
if (node.type !== "atrule" || node.name !== "import") hasNonImportNode = true;
|
|
1089
|
-
});
|
|
1090
|
-
} catch {
|
|
1091
|
-
return false;
|
|
1092
|
-
}
|
|
1093
|
-
if (hasNonImportNode) return false;
|
|
964
|
+
if (!(0, _weapp_tailwindcss_postcss_transform.isCssImportOnly)(css)) return false;
|
|
1094
965
|
return collectImportedBundleCssSources(bundle, importedStyleFiles).length > 0;
|
|
1095
966
|
}
|
|
1096
967
|
function isCoveredViteGeneratedSourceAsset(file, existingAssetFiles, resolveViteProcessedCssOutputFile) {
|
|
@@ -1185,278 +1056,17 @@ function collectMiniProgramSubpackageSourceEntries(snapshot, subpackageRoots, so
|
|
|
1185
1056
|
return sourceEntries;
|
|
1186
1057
|
}
|
|
1187
1058
|
//#endregion
|
|
1188
|
-
//#region src/bundlers/vite/processed-css-assets/scoped-tailwind-noise.ts
|
|
1189
|
-
const VUE_SCOPED_ATTR_RE = /\[data-v-[^\]]+\]/gi;
|
|
1190
|
-
const VUE_SCOPED_CLASS_RE = /\.data-v-[\w-]+/gi;
|
|
1191
|
-
const SCOPED_UNIVERSAL_PREFLIGHT_SELECTORS = /* @__PURE__ */ new Set([
|
|
1192
|
-
"*",
|
|
1193
|
-
":after",
|
|
1194
|
-
":before",
|
|
1195
|
-
"::after",
|
|
1196
|
-
"::before",
|
|
1197
|
-
"::backdrop",
|
|
1198
|
-
"::file-selector-button"
|
|
1199
|
-
]);
|
|
1200
|
-
const MINI_PROGRAM_PREFLIGHT_SELECTORS = /* @__PURE__ */ new Set([
|
|
1201
|
-
"view",
|
|
1202
|
-
"text",
|
|
1203
|
-
"::after",
|
|
1204
|
-
"::before"
|
|
1205
|
-
]);
|
|
1206
|
-
const UNI_APP_WEB_PREFLIGHT_SELECTORS = /* @__PURE__ */ new Set([
|
|
1207
|
-
"uni-view",
|
|
1208
|
-
"uni-text",
|
|
1209
|
-
":after",
|
|
1210
|
-
":before",
|
|
1211
|
-
"::after",
|
|
1212
|
-
"::before"
|
|
1213
|
-
]);
|
|
1214
|
-
const MINI_PROGRAM_PREFLIGHT_DECLARATIONS = /* @__PURE__ */ new Set([
|
|
1215
|
-
"box-sizing",
|
|
1216
|
-
"margin",
|
|
1217
|
-
"padding",
|
|
1218
|
-
"border"
|
|
1219
|
-
]);
|
|
1220
|
-
const TAILWIND_PREFLIGHT_DECLARATIONS = /* @__PURE__ */ new Set([
|
|
1221
|
-
"-moz-tab-size:4",
|
|
1222
|
-
"-webkit-appearance:none",
|
|
1223
|
-
"-webkit-appearance:button",
|
|
1224
|
-
"-webkit-tap-highlight-color:transparent",
|
|
1225
|
-
"-webkit-text-decoration:inherit",
|
|
1226
|
-
"-webkit-text-decoration:underline dotted",
|
|
1227
|
-
"-webkit-text-size-adjust:100%",
|
|
1228
|
-
"-o-tab-size:4",
|
|
1229
|
-
"appearance:button",
|
|
1230
|
-
"background-color:transparent",
|
|
1231
|
-
"border-collapse:collapse",
|
|
1232
|
-
"border-color:inherit",
|
|
1233
|
-
"border-radius:0",
|
|
1234
|
-
"border-top-width:1px",
|
|
1235
|
-
"bottom:-.25em",
|
|
1236
|
-
"color:inherit",
|
|
1237
|
-
"display:block",
|
|
1238
|
-
"display:inline-flex",
|
|
1239
|
-
"display:list-item",
|
|
1240
|
-
"font:inherit",
|
|
1241
|
-
"font-family:inherit",
|
|
1242
|
-
"font-feature-settings:inherit",
|
|
1243
|
-
"font-size:1em",
|
|
1244
|
-
"font-size:75%",
|
|
1245
|
-
"font-size:80%",
|
|
1246
|
-
"font-size:inherit",
|
|
1247
|
-
"font-variation-settings:inherit",
|
|
1248
|
-
"font-weight:bolder",
|
|
1249
|
-
"font-weight:inherit",
|
|
1250
|
-
"height:0",
|
|
1251
|
-
"height:auto",
|
|
1252
|
-
"letter-spacing:inherit",
|
|
1253
|
-
"line-height:1",
|
|
1254
|
-
"line-height:1.5",
|
|
1255
|
-
"line-height:0",
|
|
1256
|
-
"line-height:inherit",
|
|
1257
|
-
"list-style:none",
|
|
1258
|
-
"margin-inline-end:4px",
|
|
1259
|
-
"max-width:100%",
|
|
1260
|
-
"min-height:1lh",
|
|
1261
|
-
"opacity:1",
|
|
1262
|
-
"outline:auto",
|
|
1263
|
-
"padding:0",
|
|
1264
|
-
"padding-block:0",
|
|
1265
|
-
"position:relative",
|
|
1266
|
-
"resize:vertical",
|
|
1267
|
-
"tab-size:4",
|
|
1268
|
-
"text-align:inherit",
|
|
1269
|
-
"text-decoration:inherit",
|
|
1270
|
-
"text-decoration:underline dotted",
|
|
1271
|
-
"text-indent:0",
|
|
1272
|
-
"text-transform:none",
|
|
1273
|
-
"top:-.5em",
|
|
1274
|
-
"vertical-align:baseline",
|
|
1275
|
-
"vertical-align:middle"
|
|
1276
|
-
]);
|
|
1277
|
-
function hasVueScopedAttr(value) {
|
|
1278
|
-
VUE_SCOPED_ATTR_RE.lastIndex = 0;
|
|
1279
|
-
VUE_SCOPED_CLASS_RE.lastIndex = 0;
|
|
1280
|
-
const matched = VUE_SCOPED_ATTR_RE.test(value) || VUE_SCOPED_CLASS_RE.test(value);
|
|
1281
|
-
VUE_SCOPED_ATTR_RE.lastIndex = 0;
|
|
1282
|
-
VUE_SCOPED_CLASS_RE.lastIndex = 0;
|
|
1283
|
-
return matched;
|
|
1284
|
-
}
|
|
1285
|
-
function normalizeCssSignatureValue(value) {
|
|
1286
|
-
return value.replace(VUE_SCOPED_ATTR_RE, "").replace(VUE_SCOPED_CLASS_RE, "").replace(/\s+/g, " ").replace(/\s*([>+~])\s*/g, "$1").replace(/\(\s+/g, "(").replace(/\s+\)/g, ")").trim();
|
|
1287
|
-
}
|
|
1288
|
-
function hasClassSelector(selector) {
|
|
1289
|
-
return /(?:^|[^\\])\.[_a-z\u00A0-\uFFFF-]/i.test(normalizeCssSignatureValue(selector));
|
|
1290
|
-
}
|
|
1291
|
-
function isLikelyTailwindGlobalSelector(selector) {
|
|
1292
|
-
const normalized = normalizeCssSignatureValue(selector);
|
|
1293
|
-
return normalized === "*" || normalized.startsWith("::") || normalized.startsWith(":root") || normalized.startsWith(":host") || /^(?:html|body|hr|abbr|h1|h2|h3|h4|h5|h6|a|b|strong|code|kbd|samp|pre|small|sub|sup|table|button|input|select|optgroup|textarea|summary|blockquote|dl|dd|fieldset|legend|ol|ul|menu|dialog|progress|video|audio|canvas|embed|iframe|img|object|svg|details|template|[uo]ni-progress)(?:$|[:,[\s>+~.#])/.test(normalized);
|
|
1294
|
-
}
|
|
1295
|
-
function isTailwindPreflightDeclaration(decl) {
|
|
1296
|
-
const prop = decl.prop.trim().toLowerCase();
|
|
1297
|
-
const value = normalizeCssSignatureValue(decl.value.trim().toLowerCase());
|
|
1298
|
-
if (prop.startsWith("--tw-")) return true;
|
|
1299
|
-
if (prop === "color" && value.startsWith("color-mix(") && value.includes("currentcolor") && value.includes("transparent")) return true;
|
|
1300
|
-
if (prop === "color" && value === "currentcolor") return true;
|
|
1301
|
-
if (prop === "font-family" && value.startsWith("var(--default-font-family") || prop === "font-feature-settings" && value.startsWith("var(--default-font-feature-settings") || prop === "font-variation-settings" && value.startsWith("var(--default-font-variation-settings")) return true;
|
|
1302
|
-
return TAILWIND_PREFLIGHT_DECLARATIONS.has(`${prop}:${value}`);
|
|
1303
|
-
}
|
|
1304
|
-
function getRuleDeclarations(rule) {
|
|
1305
|
-
return rule.nodes?.filter((node) => node.type === "decl") ?? [];
|
|
1306
|
-
}
|
|
1307
|
-
function isScopedTailwindThemeCarrierRule(rule) {
|
|
1308
|
-
const selectors = rule.selectors ?? [rule.selector];
|
|
1309
|
-
const declarations = getRuleDeclarations(rule);
|
|
1310
|
-
return selectors.length > 0 && selectors.every((selector) => {
|
|
1311
|
-
const normalized = normalizeCssSignatureValue(selector);
|
|
1312
|
-
return hasVueScopedAttr(selector) && (normalized.startsWith(":root") || normalized.startsWith(":host"));
|
|
1313
|
-
}) && declarations.length > 0 && declarations.every((decl) => decl.prop.startsWith("--"));
|
|
1314
|
-
}
|
|
1315
|
-
function isScopedUniversalTailwindPreflightRule(rule) {
|
|
1316
|
-
const selectors = rule.selectors ?? [rule.selector];
|
|
1317
|
-
const declarations = getRuleDeclarations(rule);
|
|
1318
|
-
return selectors.length > 0 && selectors.every((selector) => hasVueScopedAttr(selector) && SCOPED_UNIVERSAL_PREFLIGHT_SELECTORS.has(normalizeCssSignatureValue(selector))) && declarations.length > 0 && declarations.every((decl) => decl.prop.startsWith("--tw-") || MINI_PROGRAM_PREFLIGHT_DECLARATIONS.has(decl.prop));
|
|
1319
|
-
}
|
|
1320
|
-
function isScopedUniAppWebTailwindPreflightRule(rule) {
|
|
1321
|
-
const selectors = rule.selectors ?? [rule.selector];
|
|
1322
|
-
const declarations = getRuleDeclarations(rule);
|
|
1323
|
-
return selectors.length > 0 && selectors.every((selector) => hasVueScopedAttr(selector) && UNI_APP_WEB_PREFLIGHT_SELECTORS.has(normalizeCssSignatureValue(selector))) && declarations.length > 0 && declarations.every((decl) => decl.prop.startsWith("--tw-") || MINI_PROGRAM_PREFLIGHT_DECLARATIONS.has(decl.prop));
|
|
1324
|
-
}
|
|
1325
|
-
function isLikelyTailwindGlobalRule(rule) {
|
|
1326
|
-
const selectors = rule.selectors ?? [rule.selector];
|
|
1327
|
-
const declarations = getRuleDeclarations(rule);
|
|
1328
|
-
return isScopedTailwindThemeCarrierRule(rule) || isScopedUniversalTailwindPreflightRule(rule) || isScopedUniAppWebTailwindPreflightRule(rule) || selectors.every((selector) => !hasClassSelector(selector) && isLikelyTailwindGlobalSelector(selector)) && declarations.length > 0 && declarations.every(isTailwindPreflightDeclaration);
|
|
1329
|
-
}
|
|
1330
|
-
function isLikelyTailwindPropertyAtRule(atRule) {
|
|
1331
|
-
return atRule.name.toLowerCase() === "property" && normalizeCssSignatureValue(atRule.params).startsWith("--tw-");
|
|
1332
|
-
}
|
|
1333
|
-
function isLikelyTailwindLayerOrderAtRule(atRule) {
|
|
1334
|
-
if (atRule.name.toLowerCase() !== "layer" || atRule.nodes !== void 0) return false;
|
|
1335
|
-
const params = normalizeCssSignatureValue(atRule.params).replace(/\s+/g, "");
|
|
1336
|
-
return params === "properties" || params === "theme" || params === "base" || params === "theme,base,components,utilities";
|
|
1337
|
-
}
|
|
1338
|
-
function isUnscopedMiniProgramTailwindPreflightRule(rule) {
|
|
1339
|
-
const selectors = rule.selectors ?? [rule.selector];
|
|
1340
|
-
if (selectors.length === 0 || !selectors.every((selector) => {
|
|
1341
|
-
const normalized = normalizeCssSignatureValue(selector);
|
|
1342
|
-
return !hasVueScopedAttr(selector) && MINI_PROGRAM_PREFLIGHT_SELECTORS.has(normalized);
|
|
1343
|
-
})) return false;
|
|
1344
|
-
const declarations = getRuleDeclarations(rule);
|
|
1345
|
-
return declarations.length > 0 && declarations.every((decl) => decl.prop.startsWith("--tw-") || MINI_PROGRAM_PREFLIGHT_DECLARATIONS.has(decl.prop));
|
|
1346
|
-
}
|
|
1347
|
-
function isScopedMiniProgramTailwindContentInitRule(rule) {
|
|
1348
|
-
const selectors = rule.selectors ?? [rule.selector];
|
|
1349
|
-
if (selectors.length === 0 || !selectors.every((selector) => {
|
|
1350
|
-
const normalized = normalizeCssSignatureValue(selector);
|
|
1351
|
-
return hasVueScopedAttr(selector) && MINI_PROGRAM_PREFLIGHT_SELECTORS.has(normalized);
|
|
1352
|
-
})) return false;
|
|
1353
|
-
const declarations = getRuleDeclarations(rule);
|
|
1354
|
-
return declarations.length > 0 && declarations.every((decl) => decl.prop === "--tw-content");
|
|
1355
|
-
}
|
|
1356
|
-
//#endregion
|
|
1357
1059
|
//#region src/bundlers/vite/processed-css-assets/coverage.ts
|
|
1358
|
-
function createDeclarationSignature(rule) {
|
|
1359
|
-
return createDeclarationKeys(rule).sort().join(";");
|
|
1360
|
-
}
|
|
1361
|
-
function createRuleCoverageKey(selector, declarations) {
|
|
1362
|
-
return `${normalizeCssSignatureValue(selector)}\0${declarations}`;
|
|
1363
|
-
}
|
|
1364
|
-
function createDeclarationKeys(rule) {
|
|
1365
|
-
return (rule.nodes ?? []).filter((node) => node.type === "decl").map((node) => `${node.prop}:${normalizeCssSignatureValue(node.value)}${node.important ? "!important" : ""}`);
|
|
1366
|
-
}
|
|
1367
|
-
function createAtRuleCoverageKey(atRule) {
|
|
1368
|
-
return `${atRule.name}\0${normalizeCssSignatureValue(atRule.params)}\0${normalizeCssSignatureValue(atRule.toString())}`;
|
|
1369
|
-
}
|
|
1370
|
-
function collectRootScopedComparableCssCoverage(cssSources) {
|
|
1371
|
-
const rules = /* @__PURE__ */ new Set();
|
|
1372
|
-
const atRules = /* @__PURE__ */ new Set();
|
|
1373
|
-
const declarationsBySelector = /* @__PURE__ */ new Map();
|
|
1374
|
-
const normalizedRuleCss = /* @__PURE__ */ new Set();
|
|
1375
|
-
for (const source of cssSources) try {
|
|
1376
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(source);
|
|
1377
|
-
root.walkRules((rule) => {
|
|
1378
|
-
normalizedRuleCss.add(normalizeCssSignatureValue(rule.toString()));
|
|
1379
|
-
const declarations = createDeclarationSignature(rule);
|
|
1380
|
-
if (declarations.length === 0) return;
|
|
1381
|
-
for (const selector of rule.selectors ?? [rule.selector]) {
|
|
1382
|
-
const normalizedSelector = normalizeCssSignatureValue(selector);
|
|
1383
|
-
rules.add(`${normalizedSelector}\0${declarations}`);
|
|
1384
|
-
const selectorDeclarations = declarationsBySelector.get(normalizedSelector) ?? /* @__PURE__ */ new Set();
|
|
1385
|
-
for (const declaration of createDeclarationKeys(rule)) selectorDeclarations.add(declaration);
|
|
1386
|
-
declarationsBySelector.set(normalizedSelector, selectorDeclarations);
|
|
1387
|
-
}
|
|
1388
|
-
});
|
|
1389
|
-
root.walkAtRules((atRule) => {
|
|
1390
|
-
atRules.add(createAtRuleCoverageKey(atRule));
|
|
1391
|
-
});
|
|
1392
|
-
} catch {}
|
|
1393
|
-
return {
|
|
1394
|
-
rules,
|
|
1395
|
-
atRules,
|
|
1396
|
-
declarationsBySelector,
|
|
1397
|
-
normalizedRuleCss
|
|
1398
|
-
};
|
|
1399
|
-
}
|
|
1400
1060
|
function prepareImportedCssCoverage(importedCssSources) {
|
|
1401
|
-
const sources = importedCssSources.map((source) =>
|
|
1061
|
+
const sources = importedCssSources.map((source) => (0, _weapp_tailwindcss_postcss_transform.stripBundlerGeneratedCssMarkers)(source).trim()).filter(Boolean);
|
|
1402
1062
|
if (sources.length === 0) return;
|
|
1403
1063
|
return {
|
|
1404
|
-
coverage: collectRootScopedComparableCssCoverage(sources),
|
|
1064
|
+
coverage: (0, _weapp_tailwindcss_postcss_transform.collectRootScopedComparableCssCoverage)(sources),
|
|
1405
1065
|
sources
|
|
1406
1066
|
};
|
|
1407
1067
|
}
|
|
1408
|
-
function isRuleCoveredByRootCss(rule, coverage) {
|
|
1409
|
-
const declarations = createDeclarationSignature(rule);
|
|
1410
|
-
if (declarations.length === 0) return false;
|
|
1411
|
-
const selectors = rule.selectors ?? [rule.selector];
|
|
1412
|
-
if (selectors.every((selector) => coverage.rules.has(createRuleCoverageKey(selector, declarations)))) return true;
|
|
1413
|
-
const declarationKeys = createDeclarationKeys(rule);
|
|
1414
|
-
return declarationKeys.length > 0 && selectors.every((selector) => {
|
|
1415
|
-
const rootDeclarations = coverage.declarationsBySelector.get(normalizeCssSignatureValue(selector));
|
|
1416
|
-
return rootDeclarations != null && declarationKeys.every((declaration) => rootDeclarations.has(declaration));
|
|
1417
|
-
});
|
|
1418
|
-
}
|
|
1419
|
-
function removeScopedCssCoveredByRootStyleSources(css, rootSources, preserveRuntimeProperties = false) {
|
|
1420
|
-
if (!hasVueScopedAttr(css)) return css;
|
|
1421
|
-
const hasScopedTailwindGeneratedCss = /tailwindcss v\d/i.test(css);
|
|
1422
|
-
const coverage = collectRootScopedComparableCssCoverage(rootSources);
|
|
1423
|
-
try {
|
|
1424
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
1425
|
-
let changed = false;
|
|
1426
|
-
root.walkComments((comment) => {
|
|
1427
|
-
if (/tailwindcss v\d/i.test(comment.text)) {
|
|
1428
|
-
comment.remove();
|
|
1429
|
-
changed = true;
|
|
1430
|
-
}
|
|
1431
|
-
});
|
|
1432
|
-
root.walkRules((rule) => {
|
|
1433
|
-
if (preserveRuntimeProperties && (0, _weapp_tailwindcss_postcss.isTailwindRuntimePropertyRule)(rule)) return;
|
|
1434
|
-
if (isRuleCoveredByRootCss(rule, coverage) || hasScopedTailwindGeneratedCss && isLikelyTailwindGlobalRule(rule) || isUnscopedMiniProgramTailwindPreflightRule(rule) || isScopedMiniProgramTailwindContentInitRule(rule) || isScopedUniAppWebTailwindPreflightRule(rule) || isScopedUniversalTailwindPreflightRule(rule)) {
|
|
1435
|
-
rule.remove();
|
|
1436
|
-
changed = true;
|
|
1437
|
-
}
|
|
1438
|
-
});
|
|
1439
|
-
root.walkAtRules((atRule) => {
|
|
1440
|
-
if (coverage.atRules.has(createAtRuleCoverageKey(atRule)) || !preserveRuntimeProperties && isLikelyTailwindPropertyAtRule(atRule) || isLikelyTailwindLayerOrderAtRule(atRule)) {
|
|
1441
|
-
atRule.remove();
|
|
1442
|
-
changed = true;
|
|
1443
|
-
return;
|
|
1444
|
-
}
|
|
1445
|
-
if (atRule.nodes !== void 0 && atRule.nodes.length === 0) {
|
|
1446
|
-
atRule.remove();
|
|
1447
|
-
changed = true;
|
|
1448
|
-
}
|
|
1449
|
-
});
|
|
1450
|
-
return changed ? removeDanglingCssSourceTraceComments(root.toString()).trim() : css;
|
|
1451
|
-
} catch {
|
|
1452
|
-
return css;
|
|
1453
|
-
}
|
|
1454
|
-
}
|
|
1455
|
-
function removeScopedTailwindPreflightCss(css, options) {
|
|
1456
|
-
return removeScopedCssCoveredByRootStyleSources(css, [], options?.preserveRuntimeProperties);
|
|
1457
|
-
}
|
|
1458
1068
|
function collectSingleViteGeneratedCssMarkerFile(rawSource) {
|
|
1459
|
-
const blocks =
|
|
1069
|
+
const blocks = (0, _weapp_tailwindcss_postcss_transform.parseBundlerGeneratedCssMarkerBlocks)(rawSource).filter((block) => block.bundler === "vite");
|
|
1460
1070
|
if (blocks.length !== 1) return;
|
|
1461
1071
|
const file = blocks[0]?.file;
|
|
1462
1072
|
return typeof file === "string" && file.length > 0 ? file : void 0;
|
|
@@ -1468,68 +1078,7 @@ function shouldFilterRootGeneratedCssMarkerForScopedAsset(targetFile, markerFile
|
|
|
1468
1078
|
return !require_web.isMatchingGeneratedCssMarkerFile(targetFile, markerFile, resolveViteProcessedCssOutputFile);
|
|
1469
1079
|
}
|
|
1470
1080
|
function removeCssCoveredByRootStyleBundleSources(bundle, file, css) {
|
|
1471
|
-
|
|
1472
|
-
if (css.trim().length === 0) return css;
|
|
1473
|
-
const hasScopedCss = hasVueScopedAttr(css);
|
|
1474
|
-
const hasScopedTailwindGeneratedCss = hasScopedCss && /tailwindcss v\d/i.test(css);
|
|
1475
|
-
if (rootSources.length === 0 && !hasScopedCss) return css;
|
|
1476
|
-
const coverage = collectRootScopedComparableCssCoverage(rootSources);
|
|
1477
|
-
let nextCss = css;
|
|
1478
|
-
try {
|
|
1479
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
1480
|
-
let changed = false;
|
|
1481
|
-
root.walkRules((rule) => {
|
|
1482
|
-
if (coverage.normalizedRuleCss.has(normalizeCssSignatureValue(rule.toString())) || hasScopedCss && (isRuleCoveredByRootCss(rule, coverage) || hasScopedTailwindGeneratedCss && isLikelyTailwindGlobalRule(rule) || isUnscopedMiniProgramTailwindPreflightRule(rule) || isScopedMiniProgramTailwindContentInitRule(rule) || isScopedUniAppWebTailwindPreflightRule(rule) || isScopedUniversalTailwindPreflightRule(rule))) {
|
|
1483
|
-
rule.remove();
|
|
1484
|
-
changed = true;
|
|
1485
|
-
}
|
|
1486
|
-
});
|
|
1487
|
-
if (hasScopedCss) root.walkAtRules((atRule) => {
|
|
1488
|
-
if (coverage.atRules.has(createAtRuleCoverageKey(atRule)) || isLikelyTailwindPropertyAtRule(atRule) || isLikelyTailwindLayerOrderAtRule(atRule)) {
|
|
1489
|
-
atRule.remove();
|
|
1490
|
-
changed = true;
|
|
1491
|
-
return;
|
|
1492
|
-
}
|
|
1493
|
-
if (atRule.nodes !== void 0 && atRule.nodes.length === 0) {
|
|
1494
|
-
atRule.remove();
|
|
1495
|
-
changed = true;
|
|
1496
|
-
}
|
|
1497
|
-
});
|
|
1498
|
-
root.walkComments((comment) => {
|
|
1499
|
-
if (hasScopedCss && /tailwindcss v\d/i.test(comment.text)) {
|
|
1500
|
-
comment.remove();
|
|
1501
|
-
changed = true;
|
|
1502
|
-
return;
|
|
1503
|
-
}
|
|
1504
|
-
if (!comment.text.trim().startsWith("tokens:")) return;
|
|
1505
|
-
const next = comment.next();
|
|
1506
|
-
if (next?.type === "rule" || next?.type === "atrule") return;
|
|
1507
|
-
comment.remove();
|
|
1508
|
-
changed = true;
|
|
1509
|
-
});
|
|
1510
|
-
if (changed) {
|
|
1511
|
-
(0, _weapp_tailwindcss_postcss.removeUnusedMiniProgramContentInit)(root);
|
|
1512
|
-
nextCss = root.toString().trim();
|
|
1513
|
-
}
|
|
1514
|
-
} catch {}
|
|
1515
|
-
return require_web.hasNonCommentCss(nextCss) ? nextCss : "";
|
|
1516
|
-
}
|
|
1517
|
-
function removeDanglingCssSourceTraceComments(css) {
|
|
1518
|
-
if (!css.includes("/* tokens:")) return css;
|
|
1519
|
-
try {
|
|
1520
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
1521
|
-
let changed = false;
|
|
1522
|
-
root.each((node) => {
|
|
1523
|
-
if (node.type !== "comment" || !node.text.trim().startsWith("tokens:")) return;
|
|
1524
|
-
const next = node.next();
|
|
1525
|
-
if (next?.type === "rule" || next?.type === "atrule") return;
|
|
1526
|
-
node.remove();
|
|
1527
|
-
changed = true;
|
|
1528
|
-
});
|
|
1529
|
-
return changed ? root.toString().trim() : css;
|
|
1530
|
-
} catch {
|
|
1531
|
-
return css;
|
|
1532
|
-
}
|
|
1081
|
+
return (0, _weapp_tailwindcss_postcss_transform.removeCssCoveredByRootStyleSources)(css, require_web.collectRootStyleBundleCssSources(bundle, file));
|
|
1533
1082
|
}
|
|
1534
1083
|
function removeCssCoveredByRootStyleAssets(bundle, options) {
|
|
1535
1084
|
let updated = 0;
|
|
@@ -1537,7 +1086,7 @@ function removeCssCoveredByRootStyleAssets(bundle, options) {
|
|
|
1537
1086
|
if (output.type !== "asset") continue;
|
|
1538
1087
|
const file = require_web.getAssetFile(bundleFile, output);
|
|
1539
1088
|
const rawSource = require_web.readAssetSource(output);
|
|
1540
|
-
const hasScopedCss = hasVueScopedAttr(rawSource);
|
|
1089
|
+
const hasScopedCss = (0, _weapp_tailwindcss_postcss_transform.hasVueScopedAttr)(rawSource);
|
|
1541
1090
|
const hasTailwindGeneratedCss = /tailwindcss v\d/i.test(rawSource);
|
|
1542
1091
|
const shouldIncludeTailwindGeneratedCssAsset = options.includeTailwindGeneratedCssAssets === true && hasTailwindGeneratedCss && require_web.isCssOutputFile(file) && !require_web.isMiniProgramStyleOutputFile(file);
|
|
1543
1092
|
if (!(options.cssMatcher(file) || hasScopedCss && require_web.isCssOutputFile(file) || shouldIncludeTailwindGeneratedCssAsset) || require_web.isRootStyleOutputFile(file) || options.isViteProcessedCssAsset?.(output, file) === true && !hasScopedCss && !shouldIncludeTailwindGeneratedCssAsset || options.subpackageRoots != null && isSubpackageOutputFile(file, options.subpackageRoots)) continue;
|
|
@@ -1657,7 +1206,7 @@ function removeCoveredInjectedSourceAssets(bundle, targetFile, targetCss, record
|
|
|
1657
1206
|
if (removableRecords.length === 0) return 0;
|
|
1658
1207
|
const recordFileKeys = new Set(removableRecords.map((record) => require_source_candidate_scan_signature.normalizeOutputPathKey(record.file)));
|
|
1659
1208
|
const recordCss = new Set(removableRecords.map((record) => record.css.trim()));
|
|
1660
|
-
const targetMatcher = (0,
|
|
1209
|
+
const targetMatcher = (0, _weapp_tailwindcss_postcss_transform.createCssRuleMatcher)(targetCss);
|
|
1661
1210
|
let removed = 0;
|
|
1662
1211
|
for (const [candidateFile, candidateOutput] of Object.entries(bundle)) {
|
|
1663
1212
|
if (candidateOutput.type !== "asset") continue;
|
|
@@ -1666,7 +1215,7 @@ function removeCoveredInjectedSourceAssets(bundle, targetFile, targetCss, record
|
|
|
1666
1215
|
const candidateIsRootWebStyle = require_web.isRootStyleOutputFile(candidateKey) && !require_web.isMiniProgramStyleOutputFile(candidateKey);
|
|
1667
1216
|
if (candidateIsRootWebStyle && !targetIsRootWebStyle) continue;
|
|
1668
1217
|
const candidateSource = require_web.readAssetSource(candidateOutput).trim();
|
|
1669
|
-
if (!(recordFileKeys.has(candidateKey) || candidateSource.length > 0 && (recordCss.has(candidateSource) || targetMatcher.contains(candidateSource) || targetIsRootWebStyle && candidateIsRootWebStyle && !
|
|
1218
|
+
if (!(recordFileKeys.has(candidateKey) || candidateSource.length > 0 && (recordCss.has(candidateSource) || targetMatcher.contains(candidateSource) || targetIsRootWebStyle && candidateIsRootWebStyle && !(0, _weapp_tailwindcss_postcss_transform.hasNonCommentCss)(targetMatcher.filter(candidateSource).trim())))) continue;
|
|
1670
1219
|
if (candidateIsRootWebStyle) delete bundle[candidateFile];
|
|
1671
1220
|
else require_web.clearAssetSource(candidateOutput);
|
|
1672
1221
|
options.debug?.("remove injected vite-processed source css asset: %s -> %s", candidateKey, targetFile);
|
|
@@ -1676,24 +1225,7 @@ function removeCoveredInjectedSourceAssets(bundle, targetFile, targetCss, record
|
|
|
1676
1225
|
}
|
|
1677
1226
|
function removeCssCoveredByImportedViteResults(css, importedCssSources, prepared = prepareImportedCssCoverage(importedCssSources)) {
|
|
1678
1227
|
if (!prepared) return css;
|
|
1679
|
-
return restoreCssImportAtRules(css, removeCssRulesCoveredBySources(css, prepared.sources, { exactOnly: true }, prepared.coverage));
|
|
1680
|
-
}
|
|
1681
|
-
function removeCssRulesCoveredBySources(css, sources, options = {}, preparedCoverage) {
|
|
1682
|
-
if (sources.length === 0 || css.trim().length === 0) return css;
|
|
1683
|
-
const coverage = preparedCoverage ?? collectRootScopedComparableCssCoverage(sources);
|
|
1684
|
-
if (coverage.rules.size === 0 && coverage.declarationsBySelector.size === 0 && coverage.normalizedRuleCss.size === 0) return css;
|
|
1685
|
-
try {
|
|
1686
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
1687
|
-
let changed = false;
|
|
1688
|
-
root.walkRules((rule) => {
|
|
1689
|
-
if (!coverage.normalizedRuleCss.has(normalizeCssSignatureValue(rule.toString())) && (options.exactOnly === true || !isRuleCoveredByRootCss(rule, coverage))) return;
|
|
1690
|
-
rule.remove();
|
|
1691
|
-
changed = true;
|
|
1692
|
-
});
|
|
1693
|
-
return changed ? root.toString() : css;
|
|
1694
|
-
} catch {
|
|
1695
|
-
return css;
|
|
1696
|
-
}
|
|
1228
|
+
return restoreCssImportAtRules(css, (0, _weapp_tailwindcss_postcss_transform.removeCssRulesCoveredBySources)(css, prepared.sources, { exactOnly: true }, prepared.coverage));
|
|
1697
1229
|
}
|
|
1698
1230
|
//#endregion
|
|
1699
1231
|
//#region src/bundlers/vite/processed-css-assets/collector.ts
|
|
@@ -1727,7 +1259,7 @@ function collectViteProcessedCssAssetResults(bundle, options) {
|
|
|
1727
1259
|
const targetAsset = findBundleAssetByOutputFile(bundle, resolvedOutputFile);
|
|
1728
1260
|
if (targetAsset) {
|
|
1729
1261
|
const targetRawSource = require_web.readAssetSource(targetAsset);
|
|
1730
|
-
const missingCss = (0,
|
|
1262
|
+
const missingCss = (0, _weapp_tailwindcss_postcss_transform.filterExistingCssRules)(targetRawSource, nextCss).trim();
|
|
1731
1263
|
const targetNextCss = require_web.appendCss(targetRawSource, missingCss);
|
|
1732
1264
|
if (targetNextCss !== targetRawSource) {
|
|
1733
1265
|
targetAsset.source = targetNextCss;
|
|
@@ -1823,7 +1355,7 @@ function injectViteProcessedCssIntoMainCssAssets(bundle, options) {
|
|
|
1823
1355
|
}
|
|
1824
1356
|
const fileKey = require_source_candidate_scan_signature.normalizeOutputPathKey(file);
|
|
1825
1357
|
const mainFileKey = require_source_candidate_scan_signature.normalizeOutputPathKey(file);
|
|
1826
|
-
const normalizedOriginalCss = measure("normalizeTarget", () => require_web.normalizeInjectableCssForTargetWithImports(transformCss(
|
|
1358
|
+
const normalizedOriginalCss = measure("normalizeTarget", () => require_web.normalizeInjectableCssForTargetWithImports(transformCss((0, _weapp_tailwindcss_postcss_transform.removeTailwindEntryDirectivesFromCss)(originalSource, options.createCssPipelineContext?.(file)?.currentGeneratorBranch?.isWeb === true), file), file));
|
|
1827
1359
|
let nextCss = normalizedOriginalCss.css;
|
|
1828
1360
|
const importedStyleFiles = normalizedOriginalCss.importedStyleFiles;
|
|
1829
1361
|
const importedBundleCssSources = collectImportedBundleCssSources(bundle, importedStyleFiles);
|
|
@@ -1844,40 +1376,40 @@ function injectViteProcessedCssIntoMainCssAssets(bundle, options) {
|
|
|
1844
1376
|
if (!shouldInjectViteProcessedCssResult(options.opts, mainFileKey, record.file, record)) continue;
|
|
1845
1377
|
if (isViteProcessedCssResultImported(record, importedStyleFiles)) continue;
|
|
1846
1378
|
targetViteCssResults.push(record);
|
|
1847
|
-
let css = measure("normalizeRecord", () => require_web.normalizeInjectableCssForTarget(
|
|
1379
|
+
let css = measure("normalizeRecord", () => require_web.normalizeInjectableCssForTarget((0, _weapp_tailwindcss_postcss_transform.stripBundlerGeneratedCssMarkers)(record.css).trim(), file).trim());
|
|
1848
1380
|
css = measure("importCoverage", () => removeCssCoveredByImportedViteResults(css, importedCssSources, importedCssCoverage).trim());
|
|
1849
1381
|
if (css.length === 0) continue;
|
|
1850
|
-
const mergedLayerCss = measure("mergeLayers", () =>
|
|
1382
|
+
const mergedLayerCss = measure("mergeLayers", () => (0, _weapp_tailwindcss_postcss_transform.mergeMarkedUserLayerComponentsCss)(nextCss, css));
|
|
1851
1383
|
if (mergedLayerCss.merged) {
|
|
1852
1384
|
nextCss = mergedLayerCss.css;
|
|
1853
|
-
css =
|
|
1385
|
+
css = (0, _weapp_tailwindcss_postcss_transform.extractMarkedUserLayerComponentsCss)(css).rest.trim();
|
|
1854
1386
|
if (css.length === 0) continue;
|
|
1855
1387
|
}
|
|
1856
|
-
const mergedPreflightDeclarations = measure("mergePreflight", () => (0,
|
|
1388
|
+
const mergedPreflightDeclarations = measure("mergePreflight", () => (0, _weapp_tailwindcss_postcss_transform.mergeMiniProgramPreflightRuleDeclarations)(nextCss, css));
|
|
1857
1389
|
if (mergedPreflightDeclarations.changed) {
|
|
1858
1390
|
nextCss = mergedPreflightDeclarations.baseCss;
|
|
1859
1391
|
css = mergedPreflightDeclarations.css.trim();
|
|
1860
1392
|
if (css.length === 0) continue;
|
|
1861
1393
|
}
|
|
1862
|
-
const mergedThemeScopeDeclarations = measure("mergeTheme", () => (0,
|
|
1394
|
+
const mergedThemeScopeDeclarations = measure("mergeTheme", () => (0, _weapp_tailwindcss_postcss_transform.mergeMiniProgramThemeScopeRuleDeclarations)(nextCss, css));
|
|
1863
1395
|
if (mergedThemeScopeDeclarations.changed) {
|
|
1864
1396
|
nextCss = mergedThemeScopeDeclarations.baseCss;
|
|
1865
1397
|
css = mergedThemeScopeDeclarations.css.trim();
|
|
1866
1398
|
if (css.length === 0) continue;
|
|
1867
1399
|
}
|
|
1868
|
-
const mergedRuleDeclarations = measure("mergeDeclarations", () => (0,
|
|
1400
|
+
const mergedRuleDeclarations = measure("mergeDeclarations", () => (0, _weapp_tailwindcss_postcss_transform.mergeCoveredCssRuleDeclarations)(nextCss, css));
|
|
1869
1401
|
if (mergedRuleDeclarations.changed) {
|
|
1870
1402
|
nextCss = mergedRuleDeclarations.baseCss;
|
|
1871
1403
|
css = mergedRuleDeclarations.css.trim();
|
|
1872
1404
|
if (css.length === 0) continue;
|
|
1873
1405
|
}
|
|
1874
|
-
const missingCss = measure("filterRules", () => (0,
|
|
1875
|
-
if (missingCss.length === 0 || !
|
|
1406
|
+
const missingCss = measure("filterRules", () => (0, _weapp_tailwindcss_postcss_transform.filterExistingCssRules)(nextCss, css));
|
|
1407
|
+
if (missingCss.length === 0 || !(0, _weapp_tailwindcss_postcss_transform.hasNonCommentCss)(missingCss) || measure("containsMissing", () => (0, _weapp_tailwindcss_postcss_transform.containsCssAfterMinify)(nextCss, missingCss))) continue;
|
|
1876
1408
|
nextCss = require_web.appendCss(nextCss, missingCss);
|
|
1877
1409
|
}
|
|
1878
1410
|
const finalImportedCssSources = collectImportedBundleCssSources(bundle, require_web.collectImportedStyleFiles(originalSource, file));
|
|
1879
1411
|
const finalImportedCssCoverage = prepareImportedCssCoverage(finalImportedCssSources);
|
|
1880
|
-
nextCss = measure("finalizeTarget", () => transformCss(removeCommentOnlyAtRules(restoreCssImportAtRules(originalSource, removeCssRulesCoveredBySources(nextCss, finalImportedCssSources, { exactOnly: true }, finalImportedCssCoverage?.coverage).trim(), file)), file));
|
|
1412
|
+
nextCss = measure("finalizeTarget", () => transformCss((0, _weapp_tailwindcss_postcss_transform.removeCommentOnlyAtRules)(restoreCssImportAtRules(originalSource, (0, _weapp_tailwindcss_postcss_transform.removeCssRulesCoveredBySources)(nextCss, finalImportedCssSources, { exactOnly: true }, finalImportedCssCoverage?.coverage).trim(), file)), file));
|
|
1881
1413
|
if (nextCss.trim() === originalSource.trim()) nextCss = originalSource;
|
|
1882
1414
|
if (nextCss !== originalSource) {
|
|
1883
1415
|
output.source = nextCss;
|
|
@@ -2073,8 +1605,8 @@ async function collectBundleMarkupCandidates(options) {
|
|
|
2073
1605
|
const valuesForEntries = (entries, filterOptions = {}) => {
|
|
2074
1606
|
const values = /* @__PURE__ */ new Set();
|
|
2075
1607
|
for (const { sourceFile: file, candidates } of candidatesByFile.values()) {
|
|
2076
|
-
if (entries !== void 0 && !
|
|
2077
|
-
if (filterOptions.excludeEntries?.length &&
|
|
1608
|
+
if (entries !== void 0 && !(0, require_tailwindcss.source_scan_exports.isFileMatchedByTailwindSourceEntries)(file, entries)) continue;
|
|
1609
|
+
if (filterOptions.excludeEntries?.length && (0, require_tailwindcss.source_scan_exports.isFileMatchedByTailwindSourceEntries)(file, filterOptions.excludeEntries)) continue;
|
|
2078
1610
|
for (const candidate of candidates) values.add(candidate);
|
|
2079
1611
|
}
|
|
2080
1612
|
return values;
|
|
@@ -2324,17 +1856,17 @@ function resolveViteCssCompositionPlan(options) {
|
|
|
2324
1856
|
const vitePipelineCssAsset = options.viteProcessedCssAsset || useRememberedCssSource;
|
|
2325
1857
|
const resolvedGeneratorRawSource = vitePipelineCssAsset ? rememberedSource?.rawSource ?? options.rawSource : options.rawSource;
|
|
2326
1858
|
const generatorRawSource = options.normalizeGeneratorSource(resolvedGeneratorRawSource, outputFile);
|
|
2327
|
-
const hasCurrentTailwindGenerationDirective =
|
|
1859
|
+
const hasCurrentTailwindGenerationDirective = (0, _weapp_tailwindcss_postcss_transform.hasTailwindSourceDirectives)(options.rawSource, { importFallback: true }) || (0, _weapp_tailwindcss_postcss_transform.hasTailwindRootDirectives)(options.rawSource, { importFallback: true }) || (0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyDirective)(options.rawSource);
|
|
2328
1860
|
const preserveImportedCssShell = options.shouldKeepImportedCssShell && !hasCurrentTailwindGenerationDirective;
|
|
2329
|
-
const hasRememberedApplySource = vitePipelineCssAsset && rememberedSource != null &&
|
|
1861
|
+
const hasRememberedApplySource = vitePipelineCssAsset && rememberedSource != null && (0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyDirective)(generatorRawSource);
|
|
2330
1862
|
const hasDifferentRememberedCssSource = rememberedSource != null && require_web.normalizeCssSourceForCompare(rememberedSource.rawSource) !== require_web.normalizeCssSourceForCompare(options.rawSource);
|
|
2331
|
-
const hasRememberedApplyDirective = rememberedSource != null &&
|
|
1863
|
+
const hasRememberedApplyDirective = rememberedSource != null && (0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyDirective)(rememberedSource.rawSource);
|
|
2332
1864
|
const hasRememberedTailwindGenerationSource = rememberedSource != null && require_web.hasTailwindGenerationSource(rememberedSource.rawSource);
|
|
2333
1865
|
const hasSameOutputRememberedTailwindGenerationSource = hasRememberedTailwindGenerationSource && rememberedSource != null && require_source_candidate_scan_signature.normalizeOutputPathKey(rememberedSource.outputFile) === require_source_candidate_scan_signature.normalizeOutputPathKey(outputFile);
|
|
2334
1866
|
const hasStaleViteProcessedCssSource = vitePipelineCssAsset && hasDifferentRememberedCssSource && (hasCurrentTailwindGenerationDirective || hasRememberedApplyDirective || hasRememberedTailwindGenerationSource);
|
|
2335
1867
|
const generatorSourceFile = vitePipelineCssAsset ? rememberedSource?.sourceFile ?? options.assetSourceFile : options.assetSourceFile;
|
|
2336
1868
|
const originalGeneratorLayerSource = vitePipelineCssAsset ? options.getOriginalCssLayerSource?.(generatorSourceFile) : void 0;
|
|
2337
|
-
const generatorUserLayerRawSource = originalGeneratorLayerSource && require_web.normalizeCssSourceForCompare(originalGeneratorLayerSource) !== require_web.normalizeCssSourceForCompare(generatorRawSource) &&
|
|
1869
|
+
const generatorUserLayerRawSource = originalGeneratorLayerSource && require_web.normalizeCssSourceForCompare(originalGeneratorLayerSource) !== require_web.normalizeCssSourceForCompare(generatorRawSource) && (0, _weapp_tailwindcss_postcss_transform.hasUserCssLayerBlocks)(originalGeneratorLayerSource) ? options.normalizeGeneratorSource(options.normalizeGeneratorUserSource(originalGeneratorLayerSource, generatorSourceFile, options.assetSourceFile), outputFile) : void 0;
|
|
2338
1870
|
const webviewRootCssInjectionTarget = vitePipelineCssAsset ? options.resolveConfiguredRootInjectionTarget(generatorSourceFile, outputFile) : void 0;
|
|
2339
1871
|
const usesConfiguredTailwindV4FallbackSource = rememberedSource != null && require_source_candidate_scan_signature.normalizeOutputPathKey(rememberedSource.outputFile) === require_source_candidate_scan_signature.normalizeOutputPathKey(outputFile) && require_source_candidate_scan_signature.normalizeOutputPathKey(rememberedSource.sourceFile.replace(/[?#].*$/, "")) !== require_source_candidate_scan_signature.normalizeOutputPathKey(options.file);
|
|
2340
1872
|
const configuredSourceFile = vitePipelineCssAsset && outputCssHandlerOptions.isMainChunk !== true && options.configuredSourceFileKeys.has(options.normalizeConfiguredSourceFile(generatorSourceFile)) ? generatorSourceFile : void 0;
|
|
@@ -2412,7 +1944,7 @@ function collectConfiguredTailwindV4CssSourceEntries(opts, fallbackBase) {
|
|
|
2412
1944
|
}
|
|
2413
1945
|
for (const cssSource of collectConfiguredTailwindV4CssSources(opts)) {
|
|
2414
1946
|
if (typeof cssSource.css !== "string" || cssSource.css.length === 0) continue;
|
|
2415
|
-
const base =
|
|
1947
|
+
const base = require_tailwindcss.resolveTailwindV4CssSourceBase(cssSource, fallbackBase);
|
|
2416
1948
|
const file = typeof cssSource.file === "string" && cssSource.file.length > 0 ? cssSource.file : node_path.default.join(base, "tailwind.css");
|
|
2417
1949
|
const resolvedFile = node_path.default.isAbsolute(file) ? node_path.default.resolve(file) : node_path.default.resolve(base, file);
|
|
2418
1950
|
const key = `${resolvedFile}\0${cssSource.css}`;
|
|
@@ -2467,20 +1999,19 @@ function collectCssConfigBaseCandidates(source, file, outputRoot, opts) {
|
|
|
2467
1999
|
const cssSourceCss = typeof cssSource.css === "string" ? require_web.normalizeCssSourceForCompare(cssSource.css) : void 0;
|
|
2468
2000
|
if (cssSourceFile && !require_web.isMatchingCssSourceFile(file, cssSourceFile, outputRoot) && cssSourceCss !== normalizedSource) continue;
|
|
2469
2001
|
addCandidate(cssSourceFile ? node_path.default.dirname(cssSourceFile) : void 0);
|
|
2470
|
-
addCandidate(
|
|
2002
|
+
addCandidate(require_tailwindcss.resolveTailwindV4CssSourceBase(cssSource, sourceBaseFallback));
|
|
2471
2003
|
}
|
|
2472
2004
|
return candidates;
|
|
2473
2005
|
}
|
|
2474
2006
|
function normalizeRelativeCssConfigDirectives(source, file, outputRoot, opts) {
|
|
2475
2007
|
if (!source.includes("@config")) return source;
|
|
2476
2008
|
const baseCandidates = collectCssConfigBaseCandidates(source, file, outputRoot, opts);
|
|
2477
|
-
return
|
|
2478
|
-
if (node_path.default.isAbsolute(request) || isPackageJsonImportRequest(request)) return
|
|
2009
|
+
return (0, _weapp_tailwindcss_postcss_transform.rewriteCssConfigRequests)(source, (request) => {
|
|
2010
|
+
if (node_path.default.isAbsolute(request) || isPackageJsonImportRequest(request)) return;
|
|
2479
2011
|
for (const base of baseCandidates) {
|
|
2480
2012
|
const configFile = node_path.default.resolve(base, request);
|
|
2481
|
-
if ((0, node_fs.existsSync)(configFile)) return
|
|
2013
|
+
if ((0, node_fs.existsSync)(configFile)) return require_web.slash(configFile);
|
|
2482
2014
|
}
|
|
2483
|
-
return full;
|
|
2484
2015
|
});
|
|
2485
2016
|
}
|
|
2486
2017
|
//#endregion
|
|
@@ -2587,7 +2118,7 @@ async function processViteCssBundleEntry(options) {
|
|
|
2587
2118
|
const { activeViteCssCacheFiles, addWatchFile, annotateCssSourceTrace, applyCssResultToBundle, applyViteCssCacheResult, applyViteCssTransformTaskResult, bundle, bundleFiles, cache, collectedBundlerGeneratedCssFiles, configuredTailwindV4CssSourceFileKeysForScope, configuredTailwindV4ExplicitCssEntryFileKeysForScope, context, createCandidateSignature, createCssSourceTraceCacheSignature, createCssTokenSourceMap, createCssTransformShareScopeKey, createInitialCssPipelineContext, createRuntimeAffectingSourceSignature, createScopedGeneratorCandidateSignature, createScopedGeneratorRuntime, createScopedGeneratorSourceTraceMap, createScopedSourceCandidateGetter, createScopedSourceCandidateSourceGetter, cssTaskFactories, currentSubpackageRoots, debug, defaultStyleOutputExtension, emitOrReplayCssAsset, envFlags, executeViteCssTransformTask, file, frameworkRootImportShellTargetByFile, generatorCandidatesChanged, generatorPlatform, generatorRuntime, getConfiguredTailwindV4CssSourceEntries, getCssHandlerOptions, getCssSource, getCssUserHandlerOptions, getLastCssResult, getOriginalCssLayerSource, getRememberedCssSources, getSfcSource, getSourceCandidateSources, getViteProcessedCssAssetResult, getViteProcessedCssAssetResults, hasExplicitConfiguredRootCssEntryForOutput, hasRuntimeAffectingChanges, hasViteProcessedCssResultForSource, isCssAssetProcessed, isCssImportOnlyBundleAsset, isMiniProgramStyleOutputFile, isRootMiniProgramStyleOutputFile, isSubpackageOutputFile, isTemporaryCssAssetFile, isViteProcessedCssAsset, isWebGeneratorTarget, lastCssResultByFile, lastCssSourceHashByFile, markCssAssetProcessed, measureElapsed, metrics, normalizeConfiguredTailwindV4CssEntryFileKey, normalizeGeneratorUserRawSource, normalizeMiniProgramGeneratorRawSource, normalizeOutputPathKey, normalizeRelativeCssConfigDirectives, normalizeViteCssCacheKey, onUpdate, opts, originalEntrySource, originalSource, outDir, processFiles, processViteCssCacheTask, recordCssAssetResult, recordViteProcessedCssAssetResult, rememberCssSource, rememberProcessCacheKey, removeCssCoveredByRootStyleBundleSources, resolveAssetSourceFile, resolveConfiguredCssEntryRootInjectionTarget, resolveConfiguredRootCssSourceStyle, resolveCssAssetIdentity, resolveCssAssetOutputPlan, resolveFrameworkRootImportShellPlan, resolveMatchedCssSourceOutputFile, resolveReplayCssOutputFile, resolveViteCssCompositionPlan, resolveViteCssLinkedImpactSignature, resolveViteCssPipelineOutputFile, resolveViteCssSourcePlan, resolveViteCssTransformCachePlan, resolveViteCssTransformDecisionPlan, rootDir, runtimeLinkedCssFiles, runtimeSignature, runtimeState, selectConfiguredRootCssSourceEntry, sharedCssResultCache, shouldExcludeSubpackageSourceCandidates, shouldGenerateWebCssByGenerator, shouldInjectCssIntoMainFromOutput, shouldKeepCurrentRootCssOutputForConfiguredSource, shouldKeepCurrentRootMiniProgramStyleOutputAsImportShell, shouldKeepRootMiniProgramStyleAsImportShell, shouldMoveRootMiniProgramStyleToImportShellOrigin, shouldPreserveAppCssExtension, shouldProcessTailwindGeneration, shouldSkipRawRememberedCssSource, shouldSkipRawSourceStyleAsset, shouldSkipViteAssetTransform, snapshot, sourceRoot, state, styleHandler, temporaryCssAssetSourceResolver, timeTask, transformFilter, transformRuntime, transformWebTargetCss, useIncrementalMode, usedConfiguredTailwindV4CssSourceFiles } = options;
|
|
2588
2119
|
metrics.css.total++;
|
|
2589
2120
|
const assetSourceFile = resolveAssetSourceFile(originalSource, file);
|
|
2590
|
-
const rawSource = normalizeRelativeCssConfigDirectives(isWebGeneratorTarget ? originalEntrySource :
|
|
2121
|
+
const rawSource = normalizeRelativeCssConfigDirectives(isWebGeneratorTarget ? originalEntrySource : (0, _weapp_tailwindcss_postcss_transform.normalizeMiniProgramImportShell)(originalEntrySource, {
|
|
2591
2122
|
cssOnly: true,
|
|
2592
2123
|
outputFile: originalSource.fileName || file,
|
|
2593
2124
|
outputFiles: [...bundleFiles, ...lastCssResultByFile.keys()]
|
|
@@ -2988,7 +2519,7 @@ function shouldSkipRawSourceStyleAsset(outputFile, file, rawSource, assetSourceF
|
|
|
2988
2519
|
if (source.length === 0) return false;
|
|
2989
2520
|
if (require_web.canProcessViteSourceStyleAsCss(source, file)) return false;
|
|
2990
2521
|
if (require_web.SOURCE_STYLE_OUTPUT_EXT_RE.test(assetSourceFile.replace(/[?#].*$/, ""))) return true;
|
|
2991
|
-
const isKnownStyleSource =
|
|
2522
|
+
const isKnownStyleSource = require_generated_css_marker.isSourceStyleRequest(assetSourceFile) || cssMatcher?.(assetSourceFile) === true;
|
|
2992
2523
|
return outputFile !== file || !isKnownStyleSource;
|
|
2993
2524
|
}
|
|
2994
2525
|
function resolveOutputFileFromMatchedCssSource(options) {
|
|
@@ -3081,30 +2612,14 @@ function applyCssResultToBundle(options) {
|
|
|
3081
2612
|
}
|
|
3082
2613
|
//#endregion
|
|
3083
2614
|
//#region src/bundlers/vite/generate-bundle/css-share-scope.ts
|
|
3084
|
-
const CSS_URL_FUNCTION_RE = /url\((?:"([^"]*)"|'([^']*)'|([^)]*))\)/gi;
|
|
3085
|
-
const CSS_PATH_INDEPENDENT_URL_RE = /^(?:[a-z][a-z\d+.-]*:|\/\/|\/|#)/i;
|
|
3086
|
-
const CSS_IMPORT_RE = /@import\b/i;
|
|
3087
|
-
function isPathIndependentCssUrl(value) {
|
|
3088
|
-
const normalized = value.trim();
|
|
3089
|
-
return normalized.length > 0 && CSS_PATH_INDEPENDENT_URL_RE.test(normalized);
|
|
3090
|
-
}
|
|
3091
|
-
function hasPathDependentCssUrl(rawSource) {
|
|
3092
|
-
CSS_URL_FUNCTION_RE.lastIndex = 0;
|
|
3093
|
-
let match = CSS_URL_FUNCTION_RE.exec(rawSource);
|
|
3094
|
-
while (match !== null) {
|
|
3095
|
-
if (!isPathIndependentCssUrl(match[1] ?? match[2] ?? match[3] ?? "")) return true;
|
|
3096
|
-
match = CSS_URL_FUNCTION_RE.exec(rawSource);
|
|
3097
|
-
}
|
|
3098
|
-
return false;
|
|
3099
|
-
}
|
|
3100
2615
|
function createCssTransformShareScope(file, rawSource) {
|
|
3101
|
-
if (
|
|
2616
|
+
if ((0, _weapp_tailwindcss_postcss_transform.hasCssLocationDependencies)(rawSource)) return `dir:${require_source_candidate_scan_signature.normalizeOutputPathKey(node_path.default.dirname(file))}`;
|
|
3102
2617
|
return "global";
|
|
3103
2618
|
}
|
|
3104
2619
|
function createCssTransformShareScopeKey(opts, file, rawSource) {
|
|
3105
2620
|
if (opts.mainCssChunkMatcher(file, opts.appType)) return `main:${require_source_candidate_scan_signature.normalizeOutputPathKey(file)}`;
|
|
3106
2621
|
const generatorOptions = require_generator.normalizeWeappTailwindcssGeneratorOptions(opts.generator);
|
|
3107
|
-
if (
|
|
2622
|
+
if ((0, _weapp_tailwindcss_postcss_transform.hasTailwindGeneratedCssMarkers)(rawSource) || (0, _weapp_tailwindcss_postcss_transform.hasTailwindSourceDirectives)(rawSource, { importFallback: generatorOptions.importFallback })) return `source:${require_source_candidate_scan_signature.normalizeOutputPathKey(file)}`;
|
|
3108
2623
|
return createCssTransformShareScope(file, rawSource);
|
|
3109
2624
|
}
|
|
3110
2625
|
function createCssRuntimeSignature(runtimeSignature, generatorCandidateSignature) {
|
|
@@ -3172,147 +2687,38 @@ async function resolveRememberedCssSourcePlan(options) {
|
|
|
3172
2687
|
}
|
|
3173
2688
|
//#endregion
|
|
3174
2689
|
//#region src/bundlers/vite/generate-bundle/tailwind-v4-css-source.ts
|
|
3175
|
-
function createStableTextSignature(input) {
|
|
3176
|
-
let hash = 2166136261;
|
|
3177
|
-
for (let i = 0; i < input.length; i++) {
|
|
3178
|
-
hash ^= input.charCodeAt(i);
|
|
3179
|
-
hash = Math.imul(hash, 16777619);
|
|
3180
|
-
}
|
|
3181
|
-
return (hash >>> 0).toString(36);
|
|
3182
|
-
}
|
|
3183
|
-
function parseQuotedRequest(params) {
|
|
3184
|
-
const input = params.trim();
|
|
3185
|
-
const quote = input[0];
|
|
3186
|
-
if (quote !== "\"" && quote !== "'") return;
|
|
3187
|
-
let escaped = false;
|
|
3188
|
-
for (let index = 1; index < input.length; index++) {
|
|
3189
|
-
const char = input[index];
|
|
3190
|
-
if (escaped) {
|
|
3191
|
-
escaped = false;
|
|
3192
|
-
continue;
|
|
3193
|
-
}
|
|
3194
|
-
if (char === "\\") {
|
|
3195
|
-
escaped = true;
|
|
3196
|
-
continue;
|
|
3197
|
-
}
|
|
3198
|
-
if (char === quote) return input.slice(1, index);
|
|
3199
|
-
}
|
|
3200
|
-
}
|
|
3201
|
-
function parseSourceParams(params) {
|
|
3202
|
-
let input = params.trim();
|
|
3203
|
-
let negated = false;
|
|
3204
|
-
if (input.startsWith("not ")) {
|
|
3205
|
-
negated = true;
|
|
3206
|
-
input = input.slice(4).trim();
|
|
3207
|
-
}
|
|
3208
|
-
if (input.startsWith("inline(") && input.endsWith(")")) return {
|
|
3209
|
-
prefix: negated ? "source:inline:not" : "source:inline",
|
|
3210
|
-
value: input.slice(7, -1).trim()
|
|
3211
|
-
};
|
|
3212
|
-
const request = parseQuotedRequest(input);
|
|
3213
|
-
if (!request) return;
|
|
3214
|
-
return {
|
|
3215
|
-
prefix: negated ? "source:not" : "source",
|
|
3216
|
-
value: request
|
|
3217
|
-
};
|
|
3218
|
-
}
|
|
3219
|
-
function parseTailwindImportSource(params) {
|
|
3220
|
-
if (parseQuotedRequest(params) !== "tailwindcss") return;
|
|
3221
|
-
return /\bsource\(([^)]*)\)/.exec(params)?.[1]?.trim();
|
|
3222
|
-
}
|
|
3223
|
-
function hasExplicitTailwindV4Directive(source) {
|
|
3224
|
-
try {
|
|
3225
|
-
let found = false;
|
|
3226
|
-
_weapp_tailwindcss_postcss.postcss.parse(source).walkAtRules((rule) => {
|
|
3227
|
-
if (rule.name === "config" || rule.name === "source" || rule.name === "plugin" || rule.name === "custom-variant" || rule.name === "theme" || rule.name === "utility" || rule.name === "variant" || rule.name === "apply") {
|
|
3228
|
-
found = true;
|
|
3229
|
-
return false;
|
|
3230
|
-
}
|
|
3231
|
-
});
|
|
3232
|
-
return found;
|
|
3233
|
-
} catch {
|
|
3234
|
-
return false;
|
|
3235
|
-
}
|
|
3236
|
-
}
|
|
3237
2690
|
function collectTailwindV4SourceFingerprint(source) {
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
root.walkAtRules((rule) => {
|
|
3245
|
-
if (rule.name === "import") {
|
|
3246
|
-
const sourceMode = parseTailwindImportSource(rule.params);
|
|
3247
|
-
if (sourceMode) add("import-source", sourceMode);
|
|
3248
|
-
return;
|
|
3249
|
-
}
|
|
3250
|
-
if (rule.name === "config") {
|
|
3251
|
-
const configRequest = parseQuotedRequest(rule.params);
|
|
3252
|
-
if (configRequest) {
|
|
3253
|
-
add("config", node_path.default.basename(configRequest));
|
|
3254
|
-
add("config-request", configRequest.replace(/\\/g, "/"));
|
|
3255
|
-
}
|
|
3256
|
-
return;
|
|
3257
|
-
}
|
|
3258
|
-
if (rule.name === "source") {
|
|
3259
|
-
const parsed = parseSourceParams(rule.params);
|
|
3260
|
-
if (parsed) add(parsed.prefix, parsed.value);
|
|
3261
|
-
return;
|
|
3262
|
-
}
|
|
3263
|
-
if (rule.name === "plugin") {
|
|
3264
|
-
const request = parseQuotedRequest(rule.params);
|
|
3265
|
-
if (!request) return;
|
|
3266
|
-
add("plugin", request);
|
|
3267
|
-
add("plugin-request", request.replace(/\\/g, "/"));
|
|
3268
|
-
if (rule.nodes?.length) {
|
|
3269
|
-
add("plugin-options", `${request}:${createStableTextSignature(rule.toString())}`);
|
|
3270
|
-
rule.walkDecls((decl) => {
|
|
3271
|
-
add("plugin-option", `${request}:${decl.prop}:${decl.value}`);
|
|
3272
|
-
});
|
|
3273
|
-
}
|
|
3274
|
-
return;
|
|
3275
|
-
}
|
|
3276
|
-
if (rule.name === "custom-variant") {
|
|
3277
|
-
const [name] = rule.params.trim().split(/\s+/, 1);
|
|
3278
|
-
if (name) add("custom-variant", name);
|
|
3279
|
-
return;
|
|
3280
|
-
}
|
|
3281
|
-
if (rule.name === "theme" || rule.name === "utility" || rule.name === "variant" || rule.name === "layer") {
|
|
3282
|
-
const [name] = rule.params.trim().split(/\s+/, 1);
|
|
3283
|
-
if (name) add("directive", name);
|
|
3284
|
-
}
|
|
3285
|
-
});
|
|
3286
|
-
root.walkDecls((decl) => {
|
|
3287
|
-
if (decl.prop.startsWith("--")) add("theme-token", decl.prop);
|
|
3288
|
-
});
|
|
3289
|
-
root.walkRules((rule) => {
|
|
3290
|
-
for (const selector of rule.selectors ?? []) {
|
|
3291
|
-
const match = /\.([_a-z][\w-]*)/i.exec(selector);
|
|
3292
|
-
if (match?.[1]) add("selector", match[1]);
|
|
3293
|
-
}
|
|
3294
|
-
});
|
|
3295
|
-
} catch {}
|
|
3296
|
-
return tokens;
|
|
2691
|
+
return (0, _weapp_tailwindcss_postcss_transform.analyzeTailwindV4Source)(source, node_path.default.basename).getFingerprint();
|
|
2692
|
+
}
|
|
2693
|
+
function scoreSourceFingerprints(rawTokens, entryTokens) {
|
|
2694
|
+
let score = 0;
|
|
2695
|
+
for (const token of entryTokens) if (rawTokens.has(token)) score += token.startsWith("config:") ? 100 : 1;
|
|
2696
|
+
return score;
|
|
3297
2697
|
}
|
|
3298
2698
|
function scoreConfiguredTailwindV4SourceForRawSource(rawSource, entrySource) {
|
|
3299
2699
|
if (!rawSource) return 0;
|
|
3300
2700
|
const rawTokens = collectTailwindV4SourceFingerprint(rawSource);
|
|
3301
2701
|
if (rawTokens.size === 0) return 0;
|
|
3302
|
-
|
|
3303
|
-
let score = 0;
|
|
3304
|
-
for (const token of entryTokens) if (rawTokens.has(token)) score += token.startsWith("config:") ? 100 : 1;
|
|
3305
|
-
return score;
|
|
2702
|
+
return scoreSourceFingerprints(rawTokens, collectTailwindV4SourceFingerprint(entrySource));
|
|
3306
2703
|
}
|
|
3307
2704
|
function selectTailwindV4GenerationCssSourceForOutput(outputFile, entries, rawSource, options = {}) {
|
|
3308
2705
|
const generationSources = entries.filter((entry) => require_web.hasTailwindGenerationSource(entry.source));
|
|
3309
2706
|
if (generationSources.length <= 1) return generationSources[0];
|
|
2707
|
+
const analyses = /* @__PURE__ */ new Map();
|
|
2708
|
+
const analyze = (source) => {
|
|
2709
|
+
let analysis = analyses.get(source);
|
|
2710
|
+
if (!analysis) {
|
|
2711
|
+
analysis = (0, _weapp_tailwindcss_postcss_transform.analyzeTailwindV4Source)(source, node_path.default.basename);
|
|
2712
|
+
analyses.set(source, analysis);
|
|
2713
|
+
}
|
|
2714
|
+
return analysis;
|
|
2715
|
+
};
|
|
3310
2716
|
const canMatchByOutputPath = Boolean(options.cwd || options.outputRoot || options.projectRoot);
|
|
3311
2717
|
const selectByOutputPath = (candidates, shouldUseScore = (score) => score > 0) => {
|
|
3312
2718
|
if (!canMatchByOutputPath) return;
|
|
3313
2719
|
const scoredSources = candidates.map((entry) => ({
|
|
3314
2720
|
entry,
|
|
3315
|
-
score:
|
|
2721
|
+
score: require_generated_css_marker.scoreTailwindV4CssSourceFileMatch(outputFile, entry.file, {
|
|
3316
2722
|
cwd: options.cwd,
|
|
3317
2723
|
outputRoot: options.outputRoot,
|
|
3318
2724
|
projectRoot: options.projectRoot
|
|
@@ -3323,15 +2729,18 @@ function selectTailwindV4GenerationCssSourceForOutput(outputFile, entries, rawSo
|
|
|
3323
2729
|
return bestSources.length === 1 ? bestSources[0]?.entry : void 0;
|
|
3324
2730
|
};
|
|
3325
2731
|
const selectByRawSourceFingerprint = (candidates) => {
|
|
2732
|
+
if (!rawSource) return;
|
|
2733
|
+
const rawTokens = analyze(rawSource).getFingerprint();
|
|
2734
|
+
if (rawTokens.size === 0) return;
|
|
3326
2735
|
const scoredSources = candidates.map((entry) => ({
|
|
3327
2736
|
entry,
|
|
3328
|
-
score:
|
|
2737
|
+
score: scoreSourceFingerprints(rawTokens, analyze(entry.source).getFingerprint())
|
|
3329
2738
|
})).filter((item) => item.score > 0).sort((a, b) => b.score - a.score);
|
|
3330
2739
|
const bestScore = scoredSources[0]?.score;
|
|
3331
2740
|
const bestSources = bestScore ? scoredSources.filter((item) => item.score === bestScore) : [];
|
|
3332
2741
|
return bestSources.length === 1 ? bestSources[0]?.entry : void 0;
|
|
3333
2742
|
};
|
|
3334
|
-
const explicitSources = generationSources.filter((entry) =>
|
|
2743
|
+
const explicitSources = generationSources.filter((entry) => analyze(entry.source).hasExplicitDirectives);
|
|
3335
2744
|
const candidates = explicitSources.length === 1 ? explicitSources : generationSources;
|
|
3336
2745
|
const directoryIndexOutputPathMatched = selectByOutputPath(candidates, (score) => score >= 25e3 && score < 5e4);
|
|
3337
2746
|
if (directoryIndexOutputPathMatched) return directoryIndexOutputPathMatched;
|
|
@@ -3454,14 +2863,14 @@ async function resolveViteCssSourcePlan(options) {
|
|
|
3454
2863
|
//#region src/bundlers/vite/generate-bundle/css-transform-decision-plan.ts
|
|
3455
2864
|
function resolveViteCssTransformDecisionPlan(options) {
|
|
3456
2865
|
const hasRememberedTailwindGenerationSource = options.rememberedRawSource != null && require_web.hasTailwindGenerationSource(options.rememberedRawSource);
|
|
3457
|
-
const shouldRegenerateCollectedViteCss = options.viteProcessedCssAsset && options.useIncrementalMode && options.generatorCandidateSignatureInitialized && options.generatorCandidatesChanged && (require_web.hasTailwindGenerationSource(options.generatorRawSource) ||
|
|
2866
|
+
const shouldRegenerateCollectedViteCss = options.viteProcessedCssAsset && options.useIncrementalMode && options.generatorCandidateSignatureInitialized && options.generatorCandidatesChanged && (require_web.hasTailwindGenerationSource(options.generatorRawSource) || (0, _weapp_tailwindcss_postcss_transform.hasBundlerGeneratedCssMarker)(options.rawSource) || hasRememberedTailwindGenerationSource);
|
|
3458
2867
|
const shouldRefreshViteProcessedCssByCandidates = options.viteProcessedCssAsset && options.useIncrementalMode && options.generatorCandidateSignatureInitialized && options.generatorCandidatesChanged;
|
|
3459
2868
|
const hasRuntimeAffectingTrackedAsset = options.hasRuntimeAffectingChanges && (options.alreadyProcessedCssAsset || options.vitePipelineCssAsset);
|
|
3460
2869
|
const shouldTrackForTailwindGeneration = options.shouldProcessTailwindGeneration && (!options.useIncrementalMode || options.cssIsMainChunk || options.isProcessCssFile || options.isRuntimeLinkedCss || shouldRegenerateCollectedViteCss || hasRuntimeAffectingTrackedAsset);
|
|
3461
2870
|
const shouldTrackGeneratorRuntime = options.hasStaleViteProcessedCssSource || options.shouldRegenerateMainPackageCssWithScopedCandidates || options.hasCurrentTailwindGenerationDirective || options.hasSameOutputRememberedTailwindGenerationSource || shouldTrackForTailwindGeneration;
|
|
3462
|
-
const shouldPreserveCollectedViteCssAsset = !shouldRegenerateCollectedViteCss && (!options.generatorCandidateSignatureInitialized || !options.generatorCandidatesChanged) && (options.isCollectedBundlerGeneratedCssFile ||
|
|
3463
|
-
const strippedViteProcessedCss =
|
|
3464
|
-
const shouldPreserveStaleGeneratedCssAsset = options.hasStaleViteProcessedCssSource && shouldPreserveCollectedViteCssAsset && strippedViteProcessedCss.trim().length > 0 && options.cssAssetIdentityKind !== "generator-placeholder" && !require_web.hasTailwindGenerationSource(strippedViteProcessedCss) && !
|
|
2871
|
+
const shouldPreserveCollectedViteCssAsset = !shouldRegenerateCollectedViteCss && (!options.generatorCandidateSignatureInitialized || !options.generatorCandidatesChanged) && (options.isCollectedBundlerGeneratedCssFile || (0, _weapp_tailwindcss_postcss_transform.hasBundlerGeneratedCssMarker)(options.rawSource));
|
|
2872
|
+
const strippedViteProcessedCss = (0, _weapp_tailwindcss_postcss_transform.stripBundlerGeneratedCssMarkers)(options.rawSource);
|
|
2873
|
+
const shouldPreserveStaleGeneratedCssAsset = options.hasStaleViteProcessedCssSource && shouldPreserveCollectedViteCssAsset && strippedViteProcessedCss.trim().length > 0 && options.cssAssetIdentityKind !== "generator-placeholder" && !require_web.hasTailwindGenerationSource(strippedViteProcessedCss) && !(0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyDirective)(strippedViteProcessedCss);
|
|
3465
2874
|
const shouldReuseProcessedCss = options.alreadyProcessedCssAsset && !shouldRefreshViteProcessedCssByCandidates && (!options.hasStaleViteProcessedCssSource || shouldPreserveStaleGeneratedCssAsset) && !options.hasRememberedApplySource && !options.shouldRegenerateMainPackageCssWithScopedCandidates && (!shouldTrackGeneratorRuntime || shouldPreserveCollectedViteCssAsset);
|
|
3466
2875
|
return {
|
|
3467
2876
|
shouldPreserveCollectedViteCssAsset,
|
|
@@ -3531,37 +2940,22 @@ function applyViteCssTransformTaskResult(options) {
|
|
|
3531
2940
|
}
|
|
3532
2941
|
//#endregion
|
|
3533
2942
|
//#region src/bundlers/vite/generate-bundle/web-css-module.ts
|
|
3534
|
-
/** 仅替换 transform 阶段标记的模块区间,保留 bundler 合并的前后样式及其层叠顺序。 */
|
|
3535
2943
|
function replaceWebCssModule(source, sourceFile, generated) {
|
|
3536
|
-
const markers = [...source.matchAll(/\/\*!?\s*weapp-tailwindcss vite-generated-css(-end)?\s*:\s*([^\s*]+)\s*\*\//gi)];
|
|
3537
2944
|
const sourceKey = require_source_candidate_scan_signature.normalizeOutputPathKey(sourceFile.replace(/[?#].*$/, ""));
|
|
3538
|
-
|
|
3539
|
-
let result = "";
|
|
3540
|
-
let replaced = false;
|
|
3541
|
-
for (let index = 0; index < markers.length; index++) {
|
|
3542
|
-
const start = markers[index];
|
|
3543
|
-
const end = markers[index + 1];
|
|
3544
|
-
if (start[1] || !end?.[1] || start[2] !== end[2]) continue;
|
|
3545
|
-
if (require_source_candidate_scan_signature.normalizeOutputPathKey(decodeURIComponent(start[2])) !== sourceKey) continue;
|
|
3546
|
-
result += source.slice(cursor, start.index) + generated;
|
|
3547
|
-
cursor = end.index + end[0].length;
|
|
3548
|
-
replaced = true;
|
|
3549
|
-
index++;
|
|
3550
|
-
}
|
|
3551
|
-
return replaced ? result + source.slice(cursor) : void 0;
|
|
2945
|
+
return (0, _weapp_tailwindcss_postcss_transform.replaceViteGeneratedCssModule)(source, generated, (file) => require_source_candidate_scan_signature.normalizeOutputPathKey(file) === sourceKey);
|
|
3552
2946
|
}
|
|
3553
2947
|
//#endregion
|
|
3554
2948
|
//#region src/bundlers/vite/generate-bundle/css-transform-task.ts
|
|
3555
2949
|
function resolveBundleUserRawSource(options) {
|
|
3556
|
-
return options.vitePipelineCssAsset && !
|
|
2950
|
+
return options.vitePipelineCssAsset && !(0, _weapp_tailwindcss_postcss_transform.hasBundlerGeneratedCssMarker)(options.rawSource) && require_web.normalizeCssSourceForCompare(options.rawSource) !== require_web.normalizeCssSourceForCompare(options.generatorRawSource) ? options.normalizeMiniProgramGeneratorRawSource(options.normalizeGeneratorUserRawSource(options.rawSource, options.generatorSourceFile, options.assetSourceFile), options.outputFile) : void 0;
|
|
3557
2951
|
}
|
|
3558
2952
|
async function executeViteCssTransformTask(options) {
|
|
3559
2953
|
await options.runtimeState.readyPromise;
|
|
3560
2954
|
const previousGeneratorCss = options.previousCss && !options.isWebGeneratorTarget ? options.normalizeMiniProgramGeneratorRawSource(options.previousCss, options.outputFile) : options.previousCss;
|
|
3561
|
-
if (require_web.hasTailwindGenerationSource(options.generatorRawSource) && (!options.isWebGeneratorTarget || !
|
|
2955
|
+
if (require_web.hasTailwindGenerationSource(options.generatorRawSource) && (!options.isWebGeneratorTarget || !(0, _weapp_tailwindcss_postcss_transform.hasBundlerGeneratedCssMarker)(options.rawSource) || (0, _weapp_tailwindcss_postcss_transform.hasTailwindRootDirectives)(options.generatorRawSource, { importFallback: true })) || !options.isWebGeneratorTarget && (0, _weapp_tailwindcss_postcss_transform.hasBundlerGeneratedCssMarker)(options.rawSource)) {
|
|
3562
2956
|
const bundleUserRawSource = resolveBundleUserRawSource(options);
|
|
3563
2957
|
const generatorUserRawSource = [options.generatorUserLayerRawSource, options.isWebGeneratorTarget ? bundleUserRawSource : void 0].filter((source) => typeof source === "string" && source.trim().length > 0).join("\n");
|
|
3564
|
-
const generated = await (options.generateCss ??
|
|
2958
|
+
const generated = await (options.generateCss ?? require_generated_css_marker.generateTailwindV4Css)({
|
|
3565
2959
|
cssHandlerOptions: options.generatorCssHandlerOptions,
|
|
3566
2960
|
cssStage: "framework-processed",
|
|
3567
2961
|
cssUserHandlerOptions: options.cssUserHandlerOptions,
|
|
@@ -3600,7 +2994,7 @@ async function executeViteCssTransformTask(options) {
|
|
|
3600
2994
|
kind: "web",
|
|
3601
2995
|
shouldRecordCssAsset: false
|
|
3602
2996
|
};
|
|
3603
|
-
if ((0,
|
|
2997
|
+
if ((0, _weapp_tailwindcss_postcss_transform.isPureLocalCssImportWrapper)(options.generatorRawSource)) return {
|
|
3604
2998
|
css: options.annotateCss(options.generatorRawSource),
|
|
3605
2999
|
dependencies: [],
|
|
3606
3000
|
kind: "import-shell",
|
|
@@ -3640,7 +3034,7 @@ function readAssetSource$1(output) {
|
|
|
3640
3034
|
return typeof output.source === "string" ? output.source : output.source.toString();
|
|
3641
3035
|
}
|
|
3642
3036
|
function shouldFinalizeMiniProgramCssAsset(source) {
|
|
3643
|
-
return source.includes(":hover") || source.includes("does-not-exist") || (0,
|
|
3037
|
+
return source.includes(":hover") || source.includes("does-not-exist") || (0, _weapp_tailwindcss_postcss_transform.hasMiniProgramCssSpecificityPlaceholders)(source);
|
|
3644
3038
|
}
|
|
3645
3039
|
function finalizeMiniProgramCssAssetStructures(bundle, options) {
|
|
3646
3040
|
if (options.isWebGeneratorTarget) return 0;
|
|
@@ -3652,7 +3046,7 @@ function finalizeMiniProgramCssAssetStructures(bundle, options) {
|
|
|
3652
3046
|
const file = output.fileName || bundleFile;
|
|
3653
3047
|
if (!options.cssMatcher(file) || options.files && !options.files.has(file)) continue;
|
|
3654
3048
|
const rawSource = readAssetSource$1(output);
|
|
3655
|
-
const outputCss = (0,
|
|
3049
|
+
const outputCss = (0, _weapp_tailwindcss_postcss_transform.finalizeMiniProgramCssStructure)(rawSource);
|
|
3656
3050
|
if (outputCss === rawSource) continue;
|
|
3657
3051
|
plan.write(file, outputCss);
|
|
3658
3052
|
writeTargets.set(file, output);
|
|
@@ -3679,8 +3073,8 @@ async function finalizeMiniProgramCssAssets(bundle, options) {
|
|
|
3679
3073
|
const rawSource = readAssetSource$1(output);
|
|
3680
3074
|
if (rawSource.trim().length === 0) continue;
|
|
3681
3075
|
if (options.lastCssResultByFile?.has(file)) {
|
|
3682
|
-
const structurallyCleanSource = (0,
|
|
3683
|
-
const outputCss = (0,
|
|
3076
|
+
const structurallyCleanSource = (0, _weapp_tailwindcss_postcss_transform.finalizeMiniProgramCssStructure)(rawSource);
|
|
3077
|
+
const outputCss = (0, _weapp_tailwindcss_postcss_transform.stripMiniProgramCssSpecificityPlaceholders)(structurallyCleanSource);
|
|
3684
3078
|
if (outputCss !== rawSource) {
|
|
3685
3079
|
plan.write(file, outputCss);
|
|
3686
3080
|
writeTargets.set(file, output);
|
|
@@ -3692,7 +3086,7 @@ async function finalizeMiniProgramCssAssets(bundle, options) {
|
|
|
3692
3086
|
continue;
|
|
3693
3087
|
}
|
|
3694
3088
|
if (!shouldFinalizeMiniProgramCssAsset(rawSource)) {
|
|
3695
|
-
const structurallyCleanSource = (0,
|
|
3089
|
+
const structurallyCleanSource = (0, _weapp_tailwindcss_postcss_transform.finalizeMiniProgramCssStructure)(rawSource);
|
|
3696
3090
|
if (structurallyCleanSource !== rawSource) {
|
|
3697
3091
|
plan.write(file, structurallyCleanSource);
|
|
3698
3092
|
writeTargets.set(file, output);
|
|
@@ -3714,8 +3108,8 @@ async function finalizeMiniProgramCssAssets(bundle, options) {
|
|
|
3714
3108
|
},
|
|
3715
3109
|
cssPresetEnv: {}
|
|
3716
3110
|
});
|
|
3717
|
-
const structurallyCleanCss = (0,
|
|
3718
|
-
const outputCss = (0,
|
|
3111
|
+
const structurallyCleanCss = (0, _weapp_tailwindcss_postcss_transform.finalizeMiniProgramCssStructure)(css);
|
|
3112
|
+
const outputCss = (0, _weapp_tailwindcss_postcss_transform.stripMiniProgramCssSpecificityPlaceholders)(structurallyCleanCss);
|
|
3719
3113
|
if (outputCss === rawSource) continue;
|
|
3720
3114
|
plan.write(file, outputCss);
|
|
3721
3115
|
writeTargets.set(file, output);
|
|
@@ -3871,7 +3265,7 @@ async function handleUniAppXPostCssTasks(options) {
|
|
|
3871
3265
|
if (isHarmonyAppStyleTarget && applyUtilities.size > 0 && applyStyleSources.length > 0) {
|
|
3872
3266
|
const outputFile = "uni-app-x-harmony-apply.css";
|
|
3873
3267
|
const cssHandlerOptions = getCssHandlerOptions(outputFile);
|
|
3874
|
-
const generated = await
|
|
3268
|
+
const generated = await require_generated_css_marker.generateTailwindV4Css({
|
|
3875
3269
|
opts,
|
|
3876
3270
|
runtimeState,
|
|
3877
3271
|
runtime: /* @__PURE__ */ new Set(),
|
|
@@ -3889,9 +3283,9 @@ async function handleUniAppXPostCssTasks(options) {
|
|
|
3889
3283
|
styleHandler,
|
|
3890
3284
|
debug
|
|
3891
3285
|
});
|
|
3892
|
-
if (generated?.css) viteProcessedCssSources.push(
|
|
3286
|
+
if (generated?.css) viteProcessedCssSources.push(require_generated_css_marker.annotateCssSourceTrace(generated.css, {
|
|
3893
3287
|
opts,
|
|
3894
|
-
tokenSources: getSourceCandidateSourcesForEntries ?
|
|
3288
|
+
tokenSources: getSourceCandidateSourcesForEntries ? require_generated_css_marker.createCssTokenSourceMap(getSourceCandidateSourcesForEntries(void 0), opts) : void 0
|
|
3895
3289
|
}));
|
|
3896
3290
|
}
|
|
3897
3291
|
if (isHarmonyAppStyleTarget && injectUniAppXHarmonyBundleStyles(bundle, { cssSources: viteProcessedCssSources })) debug("uni-app-x harmony bundle styles inject");
|
|
@@ -3935,7 +3329,7 @@ function finalizeWebviewCssCompat(bundle, options) {
|
|
|
3935
3329
|
const file = getAssetFile(bundleFile, output);
|
|
3936
3330
|
if (!options.opts.cssMatcher(file) || !/\.css(?:$|[?#])/i.test(file)) continue;
|
|
3937
3331
|
const rawSource = readAssetSource(output);
|
|
3938
|
-
const nextCss = (0,
|
|
3332
|
+
const nextCss = (0, _weapp_tailwindcss_postcss_transform.transformWebCssSafeSelectors)((0, _weapp_tailwindcss_postcss_transform.transformWebCssCompat)(rawSource, generatorOptions.webCompat ?? true), { escapeMap: options.opts.escapeMap });
|
|
3939
3333
|
if (nextCss === rawSource) continue;
|
|
3940
3334
|
plan.write(file, nextCss);
|
|
3941
3335
|
writeTargets.set(file, output);
|
|
@@ -3997,9 +3391,9 @@ function normalizeRootMiniProgramImportShellAssets(bundle, options) {
|
|
|
3997
3391
|
updated++;
|
|
3998
3392
|
continue;
|
|
3999
3393
|
}
|
|
4000
|
-
if ((0,
|
|
3394
|
+
if ((0, _weapp_tailwindcss_postcss_transform.isPureLocalCssImportWrapper)(rootSource)) continue;
|
|
4001
3395
|
const originSource = readAssetSource(originOutput);
|
|
4002
|
-
if ((0,
|
|
3396
|
+
if ((0, _weapp_tailwindcss_postcss_transform.isPureLocalCssImportWrapper)(originSource)) {
|
|
4003
3397
|
const importedFile = resolveSingleCssImportOutputFile(originFile, originSource);
|
|
4004
3398
|
if (importedFile && require_source_candidate_scan_signature.normalizeOutputPathKey(importedFile) !== require_source_candidate_scan_signature.normalizeOutputPathKey(rootFile)) continue;
|
|
4005
3399
|
} else if (originSource.trim().length > 0 && originSource.trim() !== rootSource.trim()) continue;
|
|
@@ -4078,12 +3472,12 @@ async function finalizeGenerateBundle(options) {
|
|
|
4078
3472
|
const tasksStart = performance.now();
|
|
4079
3473
|
if (cssTaskFactories.length > 0) {
|
|
4080
3474
|
const cssConcurrency = resolveViteCssTaskConcurrency(useIncrementalMode, runtimeState.tailwindRuntime.majorVersion);
|
|
4081
|
-
const cssTask =
|
|
3475
|
+
const cssTask = require_generated_css_marker.runWithConcurrency(cssTaskFactories, cssConcurrency).then(() => void 0);
|
|
4082
3476
|
if (jsAfterCss) await cssTask;
|
|
4083
3477
|
else tasks.push(cssTask);
|
|
4084
3478
|
}
|
|
4085
3479
|
prepareJsTransformRuntime?.();
|
|
4086
|
-
if (jsTaskFactories.length > 0) tasks.push(
|
|
3480
|
+
if (jsTaskFactories.length > 0) tasks.push(require_generated_css_marker.runWithConcurrency(jsTaskFactories).then(() => void 0));
|
|
4087
3481
|
await Promise.all(tasks);
|
|
4088
3482
|
recordTimingDetail("tasks", tasksStart);
|
|
4089
3483
|
for (const apply of pendingLinkedUpdates) apply();
|
|
@@ -4267,7 +3661,7 @@ function collectUnescapedDynamicCandidates(source, allowedCandidates) {
|
|
|
4267
3661
|
let quoted = QUOTED_LITERAL_RE.exec(expression);
|
|
4268
3662
|
while (quoted !== null) {
|
|
4269
3663
|
const literal = quoted[1] ?? quoted[2] ?? quoted[3] ?? "";
|
|
4270
|
-
for (const candidate of (0,
|
|
3664
|
+
for (const candidate of (0, _weapp_tailwindcss_engine.splitCandidateTokens)(literal)) {
|
|
4271
3665
|
const normalized = candidate.trim();
|
|
4272
3666
|
if (!normalized || !isArbitraryValueCandidate(normalized)) continue;
|
|
4273
3667
|
if (shouldFilterByAllowedCandidates && !allowedCandidates.has(normalized)) continue;
|
|
@@ -4403,9 +3797,9 @@ function isUniAppXNativeAppOutDir(outDir) {
|
|
|
4403
3797
|
}
|
|
4404
3798
|
//#endregion
|
|
4405
3799
|
//#region src/uni-app-x/border-preflight.ts
|
|
4406
|
-
const BORDER_PREFLIGHT_CLASS =
|
|
3800
|
+
const BORDER_PREFLIGHT_CLASS = _weapp_tailwindcss_postcss_transform.UNI_APP_X_BORDER_PREFLIGHT_CLASS;
|
|
4407
3801
|
function resolveUniAppXBorderPreflightOptions(options, isWeb) {
|
|
4408
|
-
const borderPreflight = isWeb ? void 0 : (0,
|
|
3802
|
+
const borderPreflight = isWeb ? void 0 : (0, _weapp_tailwindcss_postcss_transform.createUniAppXBorderPreflight)(options.cssPreflight);
|
|
4409
3803
|
return borderPreflight ? {
|
|
4410
3804
|
borderPreflight,
|
|
4411
3805
|
borderPreflightRange: options.cssPreflightRange
|
|
@@ -4457,7 +3851,7 @@ function resolveUniAppXStyleIsolationEnabled(root) {
|
|
|
4457
3851
|
//#endregion
|
|
4458
3852
|
//#region src/uni-app-x/vite/author-apply.ts
|
|
4459
3853
|
function retainUniAppXAuthorApplyCss(generatedCss, authorCss, options) {
|
|
4460
|
-
return (0,
|
|
3854
|
+
return (0, _weapp_tailwindcss_postcss_transform.retainUniAppXAuthorApplyCss)(generatedCss, (0, _weapp_tailwindcss_postcss_transform.removeTailwindSourceDirectives)(authorCss, { importFallback: true }), options);
|
|
4461
3855
|
}
|
|
4462
3856
|
//#endregion
|
|
4463
3857
|
//#region src/uni-app-x/vite/harmony-apply.ts
|
|
@@ -4479,12 +3873,7 @@ function createUniAppXHarmonyApplyExpander(options) {
|
|
|
4479
3873
|
const references = authoritative ? /* @__PURE__ */ new Set() : new Set(referenceBySourceId.get(sourceKey));
|
|
4480
3874
|
for (const source of sources) {
|
|
4481
3875
|
styleSources.add(source);
|
|
4482
|
-
|
|
4483
|
-
_weapp_tailwindcss_postcss.postcss.parse(source).walkAtRules("reference", (rule) => {
|
|
4484
|
-
const reference = rule.toString();
|
|
4485
|
-
references.add(reference.endsWith(";") ? reference : `${reference};`);
|
|
4486
|
-
});
|
|
4487
|
-
} catch {}
|
|
3876
|
+
for (const reference of (0, _weapp_tailwindcss_postcss_transform.collectCssReferenceDirectives)(source)) references.add(reference);
|
|
4488
3877
|
for (const utility of collectUniAppXHarmonyApplyUtilitiesFromSources([source])) utilities.add(utility);
|
|
4489
3878
|
}
|
|
4490
3879
|
if (references.size > 0) referenceBySourceId.set(sourceKey, references);
|
|
@@ -4576,7 +3965,7 @@ const UVUE_NVUE_RE$1 = /\.(?:uvue|nvue)$/;
|
|
|
4576
3965
|
const CSS_MODULE_EXPORT_RE = /^\s*export\s+default\s+(?:\{|\w|\[\])/;
|
|
4577
3966
|
const RELATIVE_REFERENCE_RE = /@reference\s+(["'])(\.\.?[\\/][^"']+)\1\s*;?/g;
|
|
4578
3967
|
function isPreprocessorRequest(id, lang) {
|
|
4579
|
-
return
|
|
3968
|
+
return require_generated_css_marker.isSourcePreprocessorRequest(id, lang);
|
|
4580
3969
|
}
|
|
4581
3970
|
function resolveUniAppXCssTarget(id) {
|
|
4582
3971
|
return UVUE_NVUE_RE$1.test((0, _weapp_tailwindcss_shared.cleanUrl)(id)) ? "uvue" : void 0;
|
|
@@ -4594,7 +3983,7 @@ function normalizeRelativeTailwindReferences(code, id) {
|
|
|
4594
3983
|
function resolvePreprocessorTransform(code, id, lang, options) {
|
|
4595
3984
|
if (!isPreprocessorRequest(id, lang)) return;
|
|
4596
3985
|
if (options.isIosPlatform) {
|
|
4597
|
-
const normalizedCode = (0,
|
|
3986
|
+
const normalizedCode = (0, _weapp_tailwindcss_postcss_transform.normalizeTailwindcssV4InfinityCalcCss)(code);
|
|
4598
3987
|
return { result: normalizedCode === code ? void 0 : {
|
|
4599
3988
|
code: normalizedCode,
|
|
4600
3989
|
map: null
|
|
@@ -4660,7 +4049,7 @@ function createUniAppXSfcStyleSources() {
|
|
|
4660
4049
|
map: null
|
|
4661
4050
|
};
|
|
4662
4051
|
}
|
|
4663
|
-
const normalized = (0,
|
|
4052
|
+
const normalized = (0, _weapp_tailwindcss_postcss_transform.normalizeUniAppXImportantApplyForSass)(style.source);
|
|
4664
4053
|
return normalized === style.source ? void 0 : {
|
|
4665
4054
|
code: normalized,
|
|
4666
4055
|
map: null
|
|
@@ -4731,7 +4120,7 @@ function createUniAppXWebSfcHmr(options) {
|
|
|
4731
4120
|
if (!enabled(ctx)) return false;
|
|
4732
4121
|
options.hmrCssModuleVersions?.clear();
|
|
4733
4122
|
const source = sources.get(ctx) ?? await ctx.read();
|
|
4734
|
-
if (hasUniAppXImportantApply(source,
|
|
4123
|
+
if (hasUniAppXImportantApply(source, _weapp_tailwindcss_postcss_transform.normalizeUniAppXImportantApplyForSass)) {
|
|
4735
4124
|
ctx.server.ws.send({
|
|
4736
4125
|
type: "full-reload",
|
|
4737
4126
|
path: ctx.file
|
|
@@ -4787,7 +4176,7 @@ function createUniAppXAssetTask(file, originalSource, outDir, options) {
|
|
|
4787
4176
|
//#region src/uni-app-x/vite.ts
|
|
4788
4177
|
let transformUVuePromise;
|
|
4789
4178
|
function loadTransformUVue() {
|
|
4790
|
-
transformUVuePromise ?? (transformUVuePromise = Promise.resolve().then(() => require("./transform-
|
|
4179
|
+
transformUVuePromise ?? (transformUVuePromise = Promise.resolve().then(() => require("./transform-D2KFdA3C.cjs")).then((mod) => mod.transformUVue));
|
|
4791
4180
|
return transformUVuePromise;
|
|
4792
4181
|
}
|
|
4793
4182
|
const UVUE_NVUE_QUERY_RE = /\.(?:uvue|nvue)(?:\?.*)?$/;
|
|
@@ -4869,9 +4258,9 @@ function createUniAppXPlugins(options) {
|
|
|
4869
4258
|
code = resolvedSource.code;
|
|
4870
4259
|
if (require_web.isCSSRequest(id) || parsed.vue && parsed.type === "style") {
|
|
4871
4260
|
if (isCssModuleExport(code)) return;
|
|
4872
|
-
const sourceCode = normalizeRelativeTailwindReferences((0,
|
|
4873
|
-
const hasTailwindRoot =
|
|
4874
|
-
const hasTailwindApply =
|
|
4261
|
+
const sourceCode = normalizeRelativeTailwindReferences((0, _weapp_tailwindcss_postcss_transform.restoreUniAppXImportantApplyMarker)(code), id);
|
|
4262
|
+
const hasTailwindRoot = (0, _weapp_tailwindcss_postcss_transform.hasTailwindRootDirectives)(sourceCode, { importFallback: true });
|
|
4263
|
+
const hasTailwindApply = (0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyDirective)(sourceCode);
|
|
4875
4264
|
const shouldGenerateCss = hasTailwindRoot || hasTailwindApply;
|
|
4876
4265
|
const isNativeSfcAuthorStyle = isNativeStyle && resolveUniAppXCssTarget(id) === "uvue";
|
|
4877
4266
|
if (!shouldGenerateCss && (!isNativeStyle || isNativeSfcAuthorStyle)) return;
|
|
@@ -4884,7 +4273,7 @@ function createUniAppXPlugins(options) {
|
|
|
4884
4273
|
}) : void 0;
|
|
4885
4274
|
const styleCode = typeof generatedCss === "string" && generatedCss.trim().length > 0 ? hasTailwindApply && !hasTailwindRoot ? retainUniAppXAuthorApplyCss(generatedCss, sourceCode, { preserveRuntimeProperties: isWebGeneratorTarget() }) : generatedCss : sourceCode;
|
|
4886
4275
|
const styleHandlerOptions = getStyleHandlerOptions(id, isNativeStyle && hasTailwindRoot ? "tailwind-root" : isNativeStyle ? "author-apply" : void 0);
|
|
4887
|
-
return createUniAppXStyleResult(id, isWebGeneratorTarget() && typeof generatedCss === "string" && generatedCss.trim().length > 0 ? await (0,
|
|
4276
|
+
return createUniAppXStyleResult(id, isWebGeneratorTarget() && typeof generatedCss === "string" && generatedCss.trim().length > 0 ? await (0, _weapp_tailwindcss_postcss_transform.postcss)().process(styleCode, styleHandlerOptions.postcssOptions.options) : await styleHandler(styleCode, styleHandlerOptions));
|
|
4888
4277
|
}
|
|
4889
4278
|
}
|
|
4890
4279
|
const harmonyApply = createUniAppXHarmonyApplyExpander({
|
|
@@ -4929,7 +4318,7 @@ function createUniAppXPlugins(options) {
|
|
|
4929
4318
|
const resolvedSource = resolveUniAppXStyleSource(code, query, generatedSource);
|
|
4930
4319
|
if (resolvedSource.skip) return;
|
|
4931
4320
|
const styleCode = query.vue && query.type === "style" && generatedSource === void 0 && !sfcStyleSources.hasGenerated(filename) ? webLocalStyle.appendToStyle(resolvedSource.code, id) : resolvedSource.code;
|
|
4932
|
-
const preprocessorCode = query.vue && query.type === "style" ? (0,
|
|
4321
|
+
const preprocessorCode = query.vue && query.type === "style" ? (0, _weapp_tailwindcss_postcss_transform.normalizeUniAppXImportantApplyForSass)(styleCode) : styleCode;
|
|
4933
4322
|
const preprocessor = resolvePreprocessorTransform(preprocessorCode, id, query.lang, {
|
|
4934
4323
|
isIosPlatform,
|
|
4935
4324
|
isNativeAppStyleTarget: isNativeAppStyleTarget()
|
|
@@ -5240,7 +4629,7 @@ function logBundleProcessPlan(options) {
|
|
|
5240
4629
|
//#region src/bundlers/vite/generate-bundle/remembered-css-replay.ts
|
|
5241
4630
|
function shouldSkipRawRememberedCssSource(rawSource, sourceFile) {
|
|
5242
4631
|
const cleanSourceFile = sourceFile.replace(/[?#].*$/, "");
|
|
5243
|
-
return (require_web.SOURCE_STYLE_OUTPUT_EXT_RE.test(cleanSourceFile) ||
|
|
4632
|
+
return (require_web.SOURCE_STYLE_OUTPUT_EXT_RE.test(cleanSourceFile) || require_generated_css_marker.isSourcePreprocessorRequest(sourceFile)) && !require_web.canProcessViteSourceStyleAsCss(rawSource, sourceFile);
|
|
5244
4633
|
}
|
|
5245
4634
|
function resolveRememberedCssReplayOutputFile(outputFile, targetByFile) {
|
|
5246
4635
|
const outputKey = require_source_candidate_scan_signature.normalizeOutputPathKey(outputFile);
|
|
@@ -5280,12 +4669,12 @@ async function processRememberedCssReplay(options) {
|
|
|
5280
4669
|
if (!rememberedCssSource) continue;
|
|
5281
4670
|
const { sourceFile } = rememberedCssSource;
|
|
5282
4671
|
if (normalizedBundleFiles.has(require_source_candidate_scan_signature.normalizeOutputPathKey(rememberedOutputFile)) || normalizedBundleFiles.has(require_source_candidate_scan_signature.normalizeOutputPathKey(sourceFile)) || bundleFiles.includes(rememberedOutputFile) || bundleFiles.includes(sourceFile)) continue;
|
|
5283
|
-
const rawSource = isWebGeneratorTarget ? rememberedCssSource.rawSource :
|
|
4672
|
+
const rawSource = isWebGeneratorTarget ? rememberedCssSource.rawSource : (0, _weapp_tailwindcss_postcss_transform.normalizeMiniProgramImportShell)(rememberedCssSource.rawSource, {
|
|
5284
4673
|
cssOnly: true,
|
|
5285
4674
|
outputFile,
|
|
5286
4675
|
outputFiles: [...bundleFiles, ...lastCssResultByFile.keys()]
|
|
5287
4676
|
});
|
|
5288
|
-
const generatorRawSource = isWebGeneratorTarget ? rawSource :
|
|
4677
|
+
const generatorRawSource = isWebGeneratorTarget ? rawSource : (0, _weapp_tailwindcss_postcss_transform.normalizeMiniProgramGeneratorCssSource)(rawSource, outputFile, [...bundleFiles, ...lastCssResultByFile.keys()]);
|
|
5289
4678
|
activeViteCssCacheFiles.add(normalizeViteCssCacheKey(outputFile));
|
|
5290
4679
|
activeViteCssCacheFiles.add(normalizeViteCssCacheKey(sourceFile));
|
|
5291
4680
|
const outputCssHandlerOptions = getCssHandlerOptions(rememberedOutputFile);
|
|
@@ -5313,8 +4702,8 @@ async function processRememberedCssReplay(options) {
|
|
|
5313
4702
|
const cachedGeneratedReplayCss = allRememberedSignaturesFresh && shouldMergeReplayIntoFrameworkRootTarget ? lastCssResultByFile.get(generatedReplayKey) : void 0;
|
|
5314
4703
|
if (allRememberedSignaturesFresh && !shouldMergeReplayIntoFrameworkRootTarget) continue;
|
|
5315
4704
|
const sourceTraceSources = scopedSourceCandidateSourceGetter ? await require_scoped_generator.createScopedGeneratorSourceTraceMap(generatorRawSource, sourceFile, scopedSourceCandidateSourceGetter) : void 0;
|
|
5316
|
-
const sourceTraceTokenSources = sourceTraceSources ?
|
|
5317
|
-
const annotateCss = (css) =>
|
|
4705
|
+
const sourceTraceTokenSources = sourceTraceSources ? require_generated_css_marker.createCssTokenSourceMap(sourceTraceSources, opts) : void 0;
|
|
4706
|
+
const annotateCss = (css) => require_generated_css_marker.annotateCssSourceTrace(css, {
|
|
5318
4707
|
opts,
|
|
5319
4708
|
tokenSources: sourceTraceTokenSources
|
|
5320
4709
|
});
|
|
@@ -5331,7 +4720,7 @@ async function processRememberedCssReplay(options) {
|
|
|
5331
4720
|
css: rawSource,
|
|
5332
4721
|
file: outputFile
|
|
5333
4722
|
})
|
|
5334
|
-
}) || !isRootMiniProgramStyleOutputFile$1(outputFile) && !isWebGeneratorTarget && (0,
|
|
4723
|
+
}) || !isRootMiniProgramStyleOutputFile$1(outputFile) && !isWebGeneratorTarget && (0, _weapp_tailwindcss_postcss_transform.isPureLocalCssImportWrapper)(rawSource);
|
|
5335
4724
|
const emitRememberedCssAsset = (css) => {
|
|
5336
4725
|
const plan = new require_compiler.AssetEmissionPlan();
|
|
5337
4726
|
let replayAsset;
|
|
@@ -5348,7 +4737,7 @@ async function processRememberedCssReplay(options) {
|
|
|
5348
4737
|
if (shouldPreserveLocalImportWrapper) {
|
|
5349
4738
|
cssTaskFactories.push(() => timeTask("css.replay", async () => {
|
|
5350
4739
|
const start = performance.now();
|
|
5351
|
-
const css = annotateCss(
|
|
4740
|
+
const css = annotateCss((0, _weapp_tailwindcss_postcss_transform.normalizeMiniProgramImportShell)(rawSource));
|
|
5352
4741
|
lastCssRawSourceHashByFile.set(outputFile, rawSourceHash);
|
|
5353
4742
|
rememberLastCssResult(lastCssResultByFile, lastCssSourceHashByFile, outputFile, css, cssRuntimeAffectingHash);
|
|
5354
4743
|
for (const key of rememberedKeys) setRememberedCssSignature?.(key, rememberedCssRuntimeSignature);
|
|
@@ -5377,7 +4766,7 @@ async function processRememberedCssReplay(options) {
|
|
|
5377
4766
|
}
|
|
5378
4767
|
cssTaskFactories.push(() => timeTask("css.replay", async () => {
|
|
5379
4768
|
const start = performance.now();
|
|
5380
|
-
const generated = await
|
|
4769
|
+
const generated = await require_generated_css_marker.generateTailwindV4Css({
|
|
5381
4770
|
opts,
|
|
5382
4771
|
runtimeState,
|
|
5383
4772
|
runtime: scopedGeneratorRuntime,
|
|
@@ -5910,11 +5299,11 @@ async function validateRuntimeCandidates(options) {
|
|
|
5910
5299
|
const mainCssEntry = options.cssEntries.find((entry) => options.getCssHandlerOptions(entry.file).isMainChunk) ?? options.cssEntries[0];
|
|
5911
5300
|
if (!mainCssEntry) return;
|
|
5912
5301
|
const mainCssRawSource = typeof mainCssEntry.output.source === "string" ? mainCssEntry.output.source : node_buffer.Buffer.from(mainCssEntry.output.source).toString();
|
|
5913
|
-
if (
|
|
5302
|
+
if ((0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyDirective)(mainCssRawSource)) return;
|
|
5914
5303
|
const generatedCssSources = /* @__PURE__ */ new Set();
|
|
5915
5304
|
for (const [, record] of options.getViteProcessedCssAssetResults?.() ?? []) if (typeof record === "string") generatedCssSources.add(record);
|
|
5916
5305
|
else if (typeof record?.css === "string") generatedCssSources.add(record.css);
|
|
5917
|
-
const validatedSourceRuntime = await
|
|
5306
|
+
const validatedSourceRuntime = await require_generated_css_marker.validateCandidatesByGenerator({
|
|
5918
5307
|
candidates: options.sourceCandidates,
|
|
5919
5308
|
cssHandlerOptions: options.getCssHandlerOptions(mainCssEntry.file),
|
|
5920
5309
|
cssUserHandlerOptions: options.getCssUserHandlerOptions(mainCssEntry.file),
|
|
@@ -6025,10 +5414,10 @@ function createGenerateBundleHook$1(context) {
|
|
|
6025
5414
|
const transformWebTargetCss = (css) => {
|
|
6026
5415
|
return context.cssPipelineStrategy?.transformGeneratedCss?.(css, {
|
|
6027
5416
|
...cssPipelineContext,
|
|
6028
|
-
defaultWebCssCompat: (value) => (0,
|
|
5417
|
+
defaultWebCssCompat: (value) => (0, _weapp_tailwindcss_postcss_transform.transformWebCssCompat)(value, require_web.resolveViteWebCssCompatOptions(cssPipelineContext)),
|
|
6029
5418
|
removeScopedPreflight: (value) => value,
|
|
6030
5419
|
shouldApplyWebCssCompat
|
|
6031
|
-
}) ?? (shouldApplyWebCssCompat ? (0,
|
|
5420
|
+
}) ?? (shouldApplyWebCssCompat ? (0, _weapp_tailwindcss_postcss_transform.transformWebCssCompat)(css, require_web.resolveViteWebCssCompatOptions(cssPipelineContext)) : css);
|
|
6032
5421
|
};
|
|
6033
5422
|
const isNativeAppStyleTarget = context.cssPipelineStrategy?.isNativeAppStyleTarget?.(cssPipelineContext) === true;
|
|
6034
5423
|
const isHarmonyAppStyleTarget = context.cssPipelineStrategy?.isHarmonyAppStyleTarget?.(cssPipelineContext) === true;
|
|
@@ -6040,12 +5429,12 @@ function createGenerateBundleHook$1(context) {
|
|
|
6040
5429
|
const outDir = resolvedConfig?.build?.outDir ? node_path.default.resolve(rootDir, resolvedConfig.build.outDir) : rootDir;
|
|
6041
5430
|
const defaultStyleOutputExtension = require_web.resolveMiniProgramStyleOutputExtension({ files: Object.keys(bundle) });
|
|
6042
5431
|
const normalizeMiniProgramGeneratorRawSource = (source, outputFile) => {
|
|
6043
|
-
return isWebGeneratorTarget ? source :
|
|
5432
|
+
return isWebGeneratorTarget ? source : (0, _weapp_tailwindcss_postcss_transform.normalizeMiniProgramGeneratorCssSource)(source, outputFile, [...Object.keys(bundle), ...lastCssResultByFile.keys()]);
|
|
6044
5433
|
};
|
|
6045
5434
|
await runtimeState.readyPromise;
|
|
6046
5435
|
debug("start");
|
|
6047
5436
|
onStart();
|
|
6048
|
-
const collectedBundlerGeneratedCssFiles = new Set(Object.entries(bundle).filter(([, output]) => output.type === "asset" &&
|
|
5437
|
+
const collectedBundlerGeneratedCssFiles = new Set(Object.entries(bundle).filter(([, output]) => output.type === "asset" && (0, _weapp_tailwindcss_postcss_transform.hasBundlerGeneratedCssMarker)(output.source)).map(([file]) => file));
|
|
6049
5438
|
const subpackageRoots = collectMiniProgramSubpackageRoots(bundle);
|
|
6050
5439
|
if (subpackageRoots) currentSubpackageRoots = subpackageRoots;
|
|
6051
5440
|
collectViteProcessedCssAssetResults(bundle, {
|
|
@@ -6353,7 +5742,7 @@ function createGenerateBundleHook$1(context) {
|
|
|
6353
5742
|
await processViteCssBundleEntry({
|
|
6354
5743
|
activeViteCssCacheFiles,
|
|
6355
5744
|
addWatchFile,
|
|
6356
|
-
annotateCssSourceTrace:
|
|
5745
|
+
annotateCssSourceTrace: require_generated_css_marker.annotateCssSourceTrace,
|
|
6357
5746
|
applyCssResultToBundle,
|
|
6358
5747
|
applyViteCssCacheResult,
|
|
6359
5748
|
applyViteCssTransformTaskResult,
|
|
@@ -6365,8 +5754,8 @@ function createGenerateBundleHook$1(context) {
|
|
|
6365
5754
|
configuredTailwindV4ExplicitCssEntryFileKeysForScope,
|
|
6366
5755
|
context,
|
|
6367
5756
|
createCandidateSignature: require_scoped_generator.createCandidateSignature,
|
|
6368
|
-
createCssSourceTraceCacheSignature:
|
|
6369
|
-
createCssTokenSourceMap:
|
|
5757
|
+
createCssSourceTraceCacheSignature: require_generated_css_marker.createCssSourceTraceCacheSignature,
|
|
5758
|
+
createCssTokenSourceMap: require_generated_css_marker.createCssTokenSourceMap,
|
|
6370
5759
|
createCssTransformShareScopeKey,
|
|
6371
5760
|
createInitialCssPipelineContext,
|
|
6372
5761
|
createRuntimeAffectingSourceSignature: require_compiler.createRuntimeAffectingSourceSignature,
|
|
@@ -6582,7 +5971,7 @@ function createGenerateBundleHook$1(context) {
|
|
|
6582
5971
|
cssSources.add(typeof output.source === "string" ? output.source : node_buffer.Buffer.from(output.source).toString());
|
|
6583
5972
|
}
|
|
6584
5973
|
for (const [, record] of getViteProcessedCssAssetResults?.() ?? []) cssSources.add(typeof record === "string" ? record : record.css);
|
|
6585
|
-
for (const candidate of
|
|
5974
|
+
for (const candidate of require_generated_css_marker.collectGeneratedRawSourceCandidatesFromCss(generatorRuntime, cssSources, opts.escapeMap)) transformRuntime.add(candidate);
|
|
6586
5975
|
debug("rebuild webview JS transform class set from generated CSS: %d", transformRuntime.size);
|
|
6587
5976
|
} : void 0;
|
|
6588
5977
|
await finalizeGenerateBundle({
|
|
@@ -6681,8 +6070,8 @@ function linkEntryChunkStyles(bundle, options) {
|
|
|
6681
6070
|
for (const [file, asset] of assets) {
|
|
6682
6071
|
if (!options.matchesCss(file)) continue;
|
|
6683
6072
|
const targets = /* @__PURE__ */ new Set();
|
|
6684
|
-
|
|
6685
|
-
const request = (0,
|
|
6073
|
+
_weapp_tailwindcss_postcss_transform.postcss.parse(asset.source.toString()).walkAtRules("import", (rule) => {
|
|
6074
|
+
const request = (0, _weapp_tailwindcss_postcss_transform.parseCssImportSpecifier)(rule.params)?.specifier;
|
|
6686
6075
|
if (request && !/^(?:[a-z][a-z\d+.-]*:|\/\/|\/)/i.test(request)) {
|
|
6687
6076
|
const target = node_path.default.posix.normalize(node_path.default.posix.join(node_path.default.posix.dirname(file), request));
|
|
6688
6077
|
if (assets.has(target)) targets.add(target);
|
|
@@ -6713,7 +6102,7 @@ function linkEntryChunkStyles(bundle, options) {
|
|
|
6713
6102
|
if (!target || !imports.has(target) || reaches(file, target) || reaches(target, file)) continue;
|
|
6714
6103
|
imports.get(file).add(target);
|
|
6715
6104
|
const relative = node_path.default.posix.relative(node_path.default.posix.dirname(file), target);
|
|
6716
|
-
requests.push(`@import ${(0,
|
|
6105
|
+
requests.push(`@import ${(0, _weapp_tailwindcss_postcss_transform.quoteCssImportSpecifier)(relative.startsWith(".") ? relative : `./${relative}`)};\n`);
|
|
6717
6106
|
}
|
|
6718
6107
|
if (requests.length > 0) {
|
|
6719
6108
|
const next = requests.join("") + original;
|
|
@@ -6855,8 +6244,8 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
6855
6244
|
recordCssAssetResult,
|
|
6856
6245
|
targetByFile: frameworkRootImportShellTargetByFile ?? /* @__PURE__ */ new Map()
|
|
6857
6246
|
});
|
|
6858
|
-
const sourceTraceTokenSources = getSourceCandidateSourcesForEntries ?
|
|
6859
|
-
const annotateCss = (css) =>
|
|
6247
|
+
const sourceTraceTokenSources = getSourceCandidateSourcesForEntries ? require_generated_css_marker.createCssTokenSourceMap(getSourceCandidateSourcesForEntries(void 0), opts) : void 0;
|
|
6248
|
+
const annotateCss = (css) => require_generated_css_marker.annotateCssSourceTrace(css, {
|
|
6860
6249
|
opts,
|
|
6861
6250
|
tokenSources: sourceTraceTokenSources
|
|
6862
6251
|
});
|
|
@@ -6903,7 +6292,7 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
6903
6292
|
...createCssPipelineContext("uni-app-x-harmony-apply.css"),
|
|
6904
6293
|
file: "uni-app-x-harmony-apply.css"
|
|
6905
6294
|
}) ?? {});
|
|
6906
|
-
const generated = await
|
|
6295
|
+
const generated = await require_generated_css_marker.generateTailwindV4Css({
|
|
6907
6296
|
opts,
|
|
6908
6297
|
runtimeState,
|
|
6909
6298
|
runtime: /* @__PURE__ */ new Set(),
|
|
@@ -6970,7 +6359,7 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
6970
6359
|
const file = output.fileName || bundleFile;
|
|
6971
6360
|
const rawSource = output.source.toString();
|
|
6972
6361
|
if (isViteProcessedCssAsset?.(output, file)) {
|
|
6973
|
-
const cleanRawSource =
|
|
6362
|
+
const cleanRawSource = (0, _weapp_tailwindcss_postcss_transform.stripBundlerGeneratedCssMarkers)(rawSource);
|
|
6974
6363
|
const cssHandlerOptions = require_web.createCssHandlerOptions(opts, runtimeState.tailwindRuntime.majorVersion, file, outDir, cssPipelineStrategy?.getCssHandlerExtraOptions?.({
|
|
6975
6364
|
...createCssPipelineContext(file),
|
|
6976
6365
|
file
|
|
@@ -6990,7 +6379,7 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
6990
6379
|
...cssHandlerOptions,
|
|
6991
6380
|
isMainChunk: false
|
|
6992
6381
|
};
|
|
6993
|
-
const cleanRawSource =
|
|
6382
|
+
const cleanRawSource = (0, _weapp_tailwindcss_postcss_transform.stripBundlerGeneratedCssMarkers)(rawSource);
|
|
6994
6383
|
if (cleanRawSource !== rawSource && cleanRawSource.trim().length === 0) {
|
|
6995
6384
|
writeCssAsset(file, output, cleanRawSource);
|
|
6996
6385
|
markCssAssetProcessed(output, file);
|
|
@@ -7002,7 +6391,7 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
7002
6391
|
const processed = isCssAssetProcessed(output, file);
|
|
7003
6392
|
const rememberedMainCssSource = processed && cssHandlerOptions.isMainChunk ? getRememberedMainCssSource?.(file) : void 0;
|
|
7004
6393
|
const resolvedGeneratorRawSource = rememberedMainCssSource?.rawSource ?? cleanRawSource;
|
|
7005
|
-
const generatorRawSource = generatorBranch.isWeb ? resolvedGeneratorRawSource :
|
|
6394
|
+
const generatorRawSource = generatorBranch.isWeb ? resolvedGeneratorRawSource : (0, _weapp_tailwindcss_postcss_transform.normalizeMiniProgramGeneratorCssSource)(resolvedGeneratorRawSource, file);
|
|
7006
6395
|
const generatorSourceFile = rememberedMainCssSource?.sourceFile ?? file;
|
|
7007
6396
|
const generatorCssHandlerOptions = rememberedMainCssSource ? require_web.createCssHandlerOptions(opts, runtimeState.tailwindRuntime.majorVersion, generatorSourceFile, outDir, cssPipelineStrategy?.getCssHandlerExtraOptions?.({
|
|
7008
6397
|
...createCssPipelineContext(generatorSourceFile),
|
|
@@ -7013,7 +6402,7 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
7013
6402
|
isMainChunk: false
|
|
7014
6403
|
} : cssUserHandlerOptions;
|
|
7015
6404
|
const generatorTransformRawSource = generatorRawSource;
|
|
7016
|
-
const generated = require_web.shouldGenerateCssByGenerator(opts, runtimeState.tailwindRuntime.majorVersion, file, generatorTransformRawSource, processed) ? await
|
|
6405
|
+
const generated = require_web.shouldGenerateCssByGenerator(opts, runtimeState.tailwindRuntime.majorVersion, file, generatorTransformRawSource, processed) ? await require_generated_css_marker.generateTailwindV4Css({
|
|
7017
6406
|
opts,
|
|
7018
6407
|
runtimeState,
|
|
7019
6408
|
runtime: generatorRuntime,
|
|
@@ -7028,7 +6417,7 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
7028
6417
|
styleHandler: opts.styleHandler,
|
|
7029
6418
|
debug
|
|
7030
6419
|
}) : void 0;
|
|
7031
|
-
if (!generated && !generatorBranch.isWeb && (0,
|
|
6420
|
+
if (!generated && !generatorBranch.isWeb && (0, _weapp_tailwindcss_postcss_transform.isPureLocalCssImportWrapper)(generatorTransformRawSource)) {
|
|
7032
6421
|
const nextCss = generatorTransformRawSource;
|
|
7033
6422
|
if (nextCss !== rawSource) {
|
|
7034
6423
|
writeCssAsset(file, output, nextCss);
|
|
@@ -7115,7 +6504,7 @@ function resolveViteServeRootMiniProgramImportShell(options) {
|
|
|
7115
6504
|
css,
|
|
7116
6505
|
file: outputFile
|
|
7117
6506
|
})
|
|
7118
|
-
}) ?
|
|
6507
|
+
}) ? (0, _weapp_tailwindcss_postcss_transform.normalizeMiniProgramImportShell)(css) : void 0;
|
|
7119
6508
|
}
|
|
7120
6509
|
//#endregion
|
|
7121
6510
|
//#region src/bundlers/vite/watch-css-post.ts
|
|
@@ -7194,8 +6583,8 @@ function createConfiguredCssEntryObserver(options) {
|
|
|
7194
6583
|
observeSourceImports(source, sourceId) {
|
|
7195
6584
|
if (!source.includes("@import")) return;
|
|
7196
6585
|
try {
|
|
7197
|
-
|
|
7198
|
-
const request = (0,
|
|
6586
|
+
_weapp_tailwindcss_postcss_transform.postcss.parse(source).walkAtRules("import", (rule) => {
|
|
6587
|
+
const request = (0, _weapp_tailwindcss_postcss_transform.parseTailwindCssDirectiveRequest)(rule.params);
|
|
7199
6588
|
if (request) observeImport(request, sourceId);
|
|
7200
6589
|
});
|
|
7201
6590
|
} catch {}
|
|
@@ -7221,7 +6610,7 @@ function createConfiguredCssEntryDiagnostics(options) {
|
|
|
7221
6610
|
plugin: {
|
|
7222
6611
|
name: "weapp-tailwindcss:configured-css-entry-observer",
|
|
7223
6612
|
transform(_code, id) {
|
|
7224
|
-
if (options.isWeb() &&
|
|
6613
|
+
if (options.isWeb() && require_generated_css_marker.isSourceStyleRequest(id)) observer.observe(id);
|
|
7225
6614
|
}
|
|
7226
6615
|
}
|
|
7227
6616
|
};
|
|
@@ -7235,7 +6624,7 @@ function createFrameworkModuleCandidateRegistrar(options) {
|
|
|
7235
6624
|
options.invalidateRecordedGeneratorCandidates();
|
|
7236
6625
|
options.cacheCurrent();
|
|
7237
6626
|
const cssHandlerOptions = options.getCssHandlerOptions(id);
|
|
7238
|
-
return
|
|
6627
|
+
return require_generated_css_marker.validateCandidatesByGenerator({
|
|
7239
6628
|
candidates,
|
|
7240
6629
|
cssHandlerOptions,
|
|
7241
6630
|
cssUserHandlerOptions: cssHandlerOptions,
|
|
@@ -7348,7 +6737,7 @@ function createFrameworkSourceCandidatesPlugin(options, apply) {
|
|
|
7348
6737
|
});
|
|
7349
6738
|
const sendSupplementalSourceHotUpdates = (ctx, modules) => {
|
|
7350
6739
|
const root = ctx.server.config?.root ?? node_process.default.cwd();
|
|
7351
|
-
const updates = modules.flatMap((mod) => [mod, ...mod.importedModules ?? []]).filter((mod) => !
|
|
6740
|
+
const updates = modules.flatMap((mod) => [mod, ...mod.importedModules ?? []]).filter((mod) => !require_generated_css_marker.isSourceStyleRequest(mod.id ?? mod.url)).map((mod) => {
|
|
7352
6741
|
let hotPath;
|
|
7353
6742
|
if (typeof mod.id === "string" && node_path.default.isAbsolute(mod.id)) {
|
|
7354
6743
|
const relative = typeof mod.url === "string" && mod.url.startsWith("/pages/") ? node_path.default.relative(node_path.default.dirname(root), mod.id) : node_path.default.relative(root, mod.id);
|
|
@@ -7394,9 +6783,9 @@ function createFrameworkSourceCandidatesPlugin(options, apply) {
|
|
|
7394
6783
|
const shouldReturnTransformedCode = transformedCode !== code;
|
|
7395
6784
|
if (options.shouldOwnTailwindGeneration && require_web.shouldCollectTransformedSourceCandidates(id)) {
|
|
7396
6785
|
options.cssMemory.rememberKnownSfcSource(id, transformedCode);
|
|
7397
|
-
if (require_web.isCSSRequest(id) &&
|
|
6786
|
+
if (require_web.isCSSRequest(id) && (0, _weapp_tailwindcss_postcss_transform.hasTailwindRootDirectives)(transformedCode, { importFallback: options.resolveCurrentGeneratorOptions().importFallback })) options.rememberTailwindRootCssModule(id);
|
|
7398
6787
|
}
|
|
7399
|
-
if (!options.shouldOwnTailwindGeneration || shouldSkipSourceCandidateState() || options.collectSourceCandidates === false || !
|
|
6788
|
+
if (!options.shouldOwnTailwindGeneration || shouldSkipSourceCandidateState() || options.collectSourceCandidates === false || !require_generated_css_marker.isSourceCandidateRequest(id) || !require_web.shouldCollectTransformedSourceCandidates(id)) return shouldReturnTransformedCode ? {
|
|
7400
6789
|
code: transformedCode,
|
|
7401
6790
|
map: null
|
|
7402
6791
|
} : void 0;
|
|
@@ -7424,7 +6813,7 @@ function createFrameworkSourceCandidatesPlugin(options, apply) {
|
|
|
7424
6813
|
if (shouldSkipSourceCandidateState()) return;
|
|
7425
6814
|
require_compiler.recordCompilationDependencyChanges(options.runtimeState, require_compiler.createCompilationDependencyChanges([node_path.default.resolve((0, _weapp_tailwindcss_shared.cleanUrl)(id))]));
|
|
7426
6815
|
await options.hmrTimingRecorder.measure("sourceCandidates.watchChange", async () => {
|
|
7427
|
-
if (options.shouldOwnTailwindGeneration && options.collectSourceCandidates !== false &&
|
|
6816
|
+
if (options.shouldOwnTailwindGeneration && options.collectSourceCandidates !== false && require_generated_css_marker.isSourceCandidateRequest(id)) options.invalidateRecordedGeneratorCandidates();
|
|
7428
6817
|
if (options.sourceScanSession.isDependency(id)) options.sourceScanSession.invalidate();
|
|
7429
6818
|
if (change.event === "delete") {
|
|
7430
6819
|
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(id);
|
|
@@ -7441,7 +6830,7 @@ function createFrameworkSourceCandidatesPlugin(options, apply) {
|
|
|
7441
6830
|
}
|
|
7442
6831
|
return;
|
|
7443
6832
|
}
|
|
7444
|
-
const changedSource = options.shouldOwnTailwindGeneration &&
|
|
6833
|
+
const changedSource = options.shouldOwnTailwindGeneration && require_generated_css_marker.isSourceCandidateRequest(id) && require_web.isCSSRequest(id) ? await (0, node_fs_promises.readFile)((0, _weapp_tailwindcss_shared.cleanUrl)(id), "utf8").catch(() => void 0) : void 0;
|
|
7445
6834
|
if (typeof changedSource === "string") {
|
|
7446
6835
|
options.rememberOriginalCssLayerSource(id, changedSource);
|
|
7447
6836
|
await options.refreshTailwindRootCssSource(id, changedSource);
|
|
@@ -7462,8 +6851,8 @@ function createFrameworkSourceCandidatesPlugin(options, apply) {
|
|
|
7462
6851
|
if (shouldSkipSourceCandidateState()) return;
|
|
7463
6852
|
require_compiler.recordCompilationDependencyChanges(options.runtimeState, require_compiler.createCompilationDependencyChanges([node_path.default.resolve((0, _weapp_tailwindcss_shared.cleanUrl)(ctx.file))]));
|
|
7464
6853
|
return options.hmrTimingRecorder.measure("sourceCandidates.handleHotUpdate", async () => {
|
|
7465
|
-
const isSourceCandidateHotUpdate = options.shouldOwnTailwindGeneration && options.collectSourceCandidates !== false &&
|
|
7466
|
-
if (isSourceCandidateHotUpdate &&
|
|
6854
|
+
const isSourceCandidateHotUpdate = options.shouldOwnTailwindGeneration && options.collectSourceCandidates !== false && require_generated_css_marker.isSourceCandidateRequest(ctx.file);
|
|
6855
|
+
if (isSourceCandidateHotUpdate && require_generated_css_marker.isSourceStyleRequest(ctx.file)) {
|
|
7467
6856
|
for (const mod of ctx.modules) for (const id of [
|
|
7468
6857
|
mod.id,
|
|
7469
6858
|
mod.url,
|
|
@@ -7486,11 +6875,11 @@ function createFrameworkSourceCandidatesPlugin(options, apply) {
|
|
|
7486
6875
|
if (isSourceCandidateHotUpdate) {
|
|
7487
6876
|
options.invalidateRecordedGeneratorCandidates();
|
|
7488
6877
|
const preserveDeletedCssInHmr = options.resolveCurrentGeneratorOptions().hmr.preserveDeletedCss;
|
|
7489
|
-
canUseHmrCandidateAppend = preserveDeletedCssInHmr && !
|
|
6878
|
+
canUseHmrCandidateAppend = preserveDeletedCssInHmr && !require_generated_css_marker.isSourceStyleRequest(ctx.file) && sourceCandidateChange !== void 0 && !sourceCandidateChange.runtimeAffecting;
|
|
7490
6879
|
if (!canUseHmrCandidateAppend) {
|
|
7491
6880
|
if (sourceCandidateChange === void 0) {
|
|
7492
6881
|
options.hmrCandidateState.clear();
|
|
7493
|
-
if (!preserveDeletedCssInHmr && !
|
|
6882
|
+
if (!preserveDeletedCssInHmr && !require_generated_css_marker.isSourceStyleRequest(ctx.file)) options.hmrCandidateState.queueFullRegeneration();
|
|
7494
6883
|
}
|
|
7495
6884
|
if (isWebLikeHotUpdate) {
|
|
7496
6885
|
await options.refreshRuntimeStateForAutoCssSources?.(true);
|
|
@@ -7499,12 +6888,12 @@ function createFrameworkSourceCandidatesPlugin(options, apply) {
|
|
|
7499
6888
|
}
|
|
7500
6889
|
}
|
|
7501
6890
|
if (isSourceCandidateHotUpdate) await options.sourceScanSession.waitForPendingSyncs();
|
|
7502
|
-
if (isSourceCandidateHotUpdate && !
|
|
7503
|
-
const hotTailwindCssModuleIds =
|
|
6891
|
+
if (isSourceCandidateHotUpdate && !require_generated_css_marker.isSourceStyleRequest(ctx.file)) options.hmrCandidateState.reconcileRuntimeCandidates(ctx.file, options.sourceCandidateCollector.values(), options.tailwindRootCssModuleIds);
|
|
6892
|
+
const hotTailwindCssModuleIds = require_generated_css_marker.isSourceStyleRequest(ctx.file) ? [ctx.file] : options.tailwindRootCssModuleIds;
|
|
7504
6893
|
const hotRoot = ctx.server.config?.root ?? node_process.default.cwd();
|
|
7505
6894
|
const cssModules = await require_web.resolveHotTailwindCssModules(ctx, hotTailwindCssModuleIds, options.hmrCssModuleVersions ? (modules) => options.hmrCssModuleVersions.filterModules(modules, ctx.timestamp, hotRoot) : void 0);
|
|
7506
|
-
const sourceModules = isSourceCandidateHotUpdate && !
|
|
7507
|
-
if (isWebLikeHotUpdate && isSourceCandidateHotUpdate && !
|
|
6895
|
+
const sourceModules = isSourceCandidateHotUpdate && !require_generated_css_marker.isSourceStyleRequest(ctx.file) ? await require_web.resolveHotSourceModules(ctx) : ctx.modules;
|
|
6896
|
+
if (isWebLikeHotUpdate && isSourceCandidateHotUpdate && !require_generated_css_marker.isSourceStyleRequest(ctx.file)) {
|
|
7508
6897
|
if (!/\.(?:uvue|nvue)$/i.test((0, _weapp_tailwindcss_shared.cleanUrl)(ctx.file))) sendSupplementalSourceHotUpdates(ctx, sourceModules);
|
|
7509
6898
|
if (sourceModules.some((mod) => {
|
|
7510
6899
|
const id = mod.id ?? mod.url;
|
|
@@ -7515,25 +6904,25 @@ function createFrameworkSourceCandidatesPlugin(options, apply) {
|
|
|
7515
6904
|
}
|
|
7516
6905
|
}
|
|
7517
6906
|
const hasHmrCandidateAppend = options.hmrCandidateState.hasPendingCandidateAppend() || canUseHmrCandidateAppend && sourceCandidateChange !== void 0 && sourceCandidateChange.addedCandidates.size > 0;
|
|
7518
|
-
if (isSourceCandidateHotUpdate && !
|
|
6907
|
+
if (isSourceCandidateHotUpdate && !require_generated_css_marker.isSourceStyleRequest(ctx.file) && !hasHmrCandidateAppend && !isWebLikeHotUpdate && (!require_web.hasSelfAcceptingNonStyleHotModule(sourceModules) && cssModules.length === 0 || cssModules.length > 0 && options.isUniViteProject())) {
|
|
7519
6908
|
require_web.sendFullReloadForUnresolvedHotUpdate(ctx);
|
|
7520
6909
|
return [];
|
|
7521
6910
|
}
|
|
7522
|
-
if (isWebLikeHotUpdate && isSourceCandidateHotUpdate && !
|
|
6911
|
+
if (isWebLikeHotUpdate && isSourceCandidateHotUpdate && !require_generated_css_marker.isSourceStyleRequest(ctx.file) && sourceModules.some((mod) => options.isNuxtPageHotModule?.(mod.id ?? mod.url))) {
|
|
7523
6912
|
require_web.sendFullReloadForUnresolvedHotUpdate(ctx);
|
|
7524
6913
|
return [];
|
|
7525
6914
|
}
|
|
7526
|
-
if (isWebLikeHotUpdate && isSourceCandidateHotUpdate && !
|
|
6915
|
+
if (isWebLikeHotUpdate && isSourceCandidateHotUpdate && !require_generated_css_marker.isSourceStyleRequest(ctx.file) && /\.(?:uvue|nvue)$/i.test((0, _weapp_tailwindcss_shared.cleanUrl)(ctx.file)) && !hasTemplateHotSourceModule(sourceModules)) {
|
|
7527
6916
|
require_web.sendFullReloadForUnresolvedHotUpdate(ctx);
|
|
7528
6917
|
return [];
|
|
7529
6918
|
}
|
|
7530
|
-
const shouldSendSupplementalCssHotUpdates = !(isWebLikeHotUpdate && isSourceCandidateHotUpdate && !
|
|
6919
|
+
const shouldSendSupplementalCssHotUpdates = !(isWebLikeHotUpdate && isSourceCandidateHotUpdate && !require_generated_css_marker.isSourceStyleRequest(ctx.file) && sourceCandidateChange !== void 0 && options.resolveCurrentGeneratorOptions().hmr.preserveDeletedCss && !sourceCandidateChange.runtimeAffecting && sourceCandidateChange.addedCandidates.size === 0 && sourceCandidateChange.removedCandidates.size > 0);
|
|
7531
6920
|
const supplementalCssFallbackIds = /* @__PURE__ */ new Set([...options.tailwindRootCssModuleIds, ...options.viteProcessedCssSourceFiles]);
|
|
7532
6921
|
const currentSupplementalCssFallbackIds = options.hmrCssModuleVersions?.filterIds(supplementalCssFallbackIds, ctx.timestamp, hotRoot) ?? supplementalCssFallbackIds;
|
|
7533
6922
|
if (options.hmrCandidateState.hasPendingChange()) options.hmrCandidateState.armTargets(cssModules, currentSupplementalCssFallbackIds);
|
|
7534
6923
|
if (shouldSendSupplementalCssHotUpdates && cssModules.length === 0) require_web.sendSupplementalCssHotUpdates(ctx, [], currentSupplementalCssFallbackIds);
|
|
7535
|
-
if (isWebLikeHotUpdate && isSourceCandidateHotUpdate && !
|
|
7536
|
-
if (isSourceCandidateHotUpdate && !
|
|
6924
|
+
if (isWebLikeHotUpdate && isSourceCandidateHotUpdate && !require_generated_css_marker.isSourceStyleRequest(ctx.file)) return cssModules.length > 0 ? require_web.mergeHotModulesByIdentity(hotRoot, sourceModules, cssModules) : hasDifferentHotModules(sourceModules, ctx.modules) ? sourceModules : void 0;
|
|
6925
|
+
if (isSourceCandidateHotUpdate && !require_generated_css_marker.isSourceStyleRequest(ctx.file) && cssModules.length > 0) return require_web.mergeHotModulesByIdentity(hotRoot, sourceModules, cssModules);
|
|
7537
6926
|
return cssModules.length > 0 ? require_web.mergeHotModulesByIdentity(hotRoot, ctx.modules, cssModules) : void 0;
|
|
7538
6927
|
}, { emit: false });
|
|
7539
6928
|
}
|
|
@@ -7616,14 +7005,14 @@ function createViteFrameworkPlugins$1(options = {}, frameworkBranch) {
|
|
|
7616
7005
|
const platform = resolveViteStylePlatform();
|
|
7617
7006
|
if (!shouldOwnTailwindGeneration || (platform ? isWebOrNativeAppPlatform(platform) : resolveCurrentGeneratorBranch().isWeb)) return code;
|
|
7618
7007
|
let transformedCode = code;
|
|
7619
|
-
if (transformedCode.includes("#if")) transformedCode = (0,
|
|
7620
|
-
if (transformedCode.includes("@layer")) transformedCode = (0,
|
|
7008
|
+
if (transformedCode.includes("#if")) transformedCode = (0, _weapp_tailwindcss_postcss_transform.compileCssMacroConditionalComments)(transformedCode, { ...platform ? { platform } : {} });
|
|
7009
|
+
if (transformedCode.includes("@layer")) transformedCode = (0, _weapp_tailwindcss_postcss_transform.unwrapUnsupportedCascadeLayers)(transformedCode);
|
|
7621
7010
|
return transformedCode;
|
|
7622
7011
|
};
|
|
7623
7012
|
const finalizeViteMiniProgramCss = (css) => {
|
|
7624
7013
|
const platform = resolveViteStylePlatform();
|
|
7625
7014
|
if (!shouldOwnTailwindGeneration || (platform ? isWebOrNativeAppPlatform(platform) : resolveCurrentGeneratorBranch().isWeb)) return css;
|
|
7626
|
-
return (0,
|
|
7015
|
+
return (0, _weapp_tailwindcss_postcss_transform.unwrapUnsupportedCascadeLayers)(css);
|
|
7627
7016
|
};
|
|
7628
7017
|
const shouldInferAppType = !hasExplicitAppType && !initialGeneratorBranch.isWeb;
|
|
7629
7018
|
const hasInitialTailwindCssRoots = require_generator.hasConfiguredTailwindV4CssRoots({
|
|
@@ -7649,7 +7038,7 @@ function createViteFrameworkPlugins$1(options = {}, frameworkBranch) {
|
|
|
7649
7038
|
if (require_web.isMissingInternalCssSource(file, weappTailwindcssPackageDir)) return;
|
|
7650
7039
|
const sourceFile = node_path.default.normalize(file);
|
|
7651
7040
|
const sourceBase = node_path.default.dirname(sourceFile);
|
|
7652
|
-
const sourceCss =
|
|
7041
|
+
const sourceCss = (0, _weapp_tailwindcss_postcss_transform.normalizeTailwindSourceForGenerator)((0, _weapp_tailwindcss_postcss_transform.normalizeTailwindConfigDirectives)(css, sourceBase), { importFallback: true });
|
|
7653
7042
|
if (autoCssSourceContent.get(sourceFile) === sourceCss) return;
|
|
7654
7043
|
autoCssSourceContent.set(sourceFile, sourceCss);
|
|
7655
7044
|
await syncTailwindCssSourceCandidates(sourceFile, sourceCss);
|
|
@@ -7690,7 +7079,7 @@ function createViteFrameworkPlugins$1(options = {}, frameworkBranch) {
|
|
|
7690
7079
|
for (const cssEntry of cssEntries) {
|
|
7691
7080
|
const sourceFile = node_path.default.resolve(cssEntry);
|
|
7692
7081
|
const sourceBase = node_path.default.dirname(sourceFile);
|
|
7693
|
-
const sourceCss =
|
|
7082
|
+
const sourceCss = (0, _weapp_tailwindcss_postcss_transform.normalizeTailwindSourceForGenerator)((0, _weapp_tailwindcss_postcss_transform.normalizeTailwindConfigDirectives)(await (0, node_fs_promises.readFile)(sourceFile, "utf8"), sourceBase), { importFallback: true });
|
|
7694
7083
|
if (autoCssSourceContent.get(sourceFile) === sourceCss) continue;
|
|
7695
7084
|
autoCssSourceContent.set(sourceFile, sourceCss);
|
|
7696
7085
|
await syncTailwindCssSourceCandidates(sourceFile, sourceCss);
|
|
@@ -7708,7 +7097,7 @@ function createViteFrameworkPlugins$1(options = {}, frameworkBranch) {
|
|
|
7708
7097
|
};
|
|
7709
7098
|
const customAttributesEntities = require_compiler.toCustomAttributesEntities(customAttributes);
|
|
7710
7099
|
let recordedGeneratorCandidates;
|
|
7711
|
-
const sourceCandidateCollector =
|
|
7100
|
+
const sourceCandidateCollector = require_generated_css_marker.createSourceCandidateCollector({
|
|
7712
7101
|
bareArbitraryValues: opts.arbitraryValues?.bareArbitraryValues,
|
|
7713
7102
|
customAttributesEntities,
|
|
7714
7103
|
disabledDefaultTemplateHandler
|
|
@@ -7717,11 +7106,11 @@ function createViteFrameworkPlugins$1(options = {}, frameworkBranch) {
|
|
|
7717
7106
|
const rememberOriginalCssLayerSource = (id, code) => {
|
|
7718
7107
|
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(id);
|
|
7719
7108
|
if (!require_web.isCSSRequest(file)) return;
|
|
7720
|
-
if (!
|
|
7109
|
+
if (!(0, _weapp_tailwindcss_postcss_transform.hasUserCssLayerBlocks)(code)) {
|
|
7721
7110
|
originalCssLayerSourceByFile.delete(file);
|
|
7722
7111
|
return;
|
|
7723
7112
|
}
|
|
7724
|
-
originalCssLayerSourceByFile.set(file,
|
|
7113
|
+
originalCssLayerSourceByFile.set(file, (0, _weapp_tailwindcss_postcss_transform.splitUserCssLayerBlocks)(code).layer);
|
|
7725
7114
|
};
|
|
7726
7115
|
const processedCssAssets = /* @__PURE__ */ new WeakSet();
|
|
7727
7116
|
const processedCssAssetSourceByFile = /* @__PURE__ */ new Map();
|
|
@@ -7778,7 +7167,7 @@ function createViteFrameworkPlugins$1(options = {}, frameworkBranch) {
|
|
|
7778
7167
|
command: resolvedConfig?.command,
|
|
7779
7168
|
frameworkName: frameworkBranch.frameworkName,
|
|
7780
7169
|
isWebGeneratorTarget: resolveCurrentGeneratorBranch().isWeb,
|
|
7781
|
-
requiresSourceCandidateState:
|
|
7170
|
+
requiresSourceCandidateState: require_generated_css_marker.isCssSourceTraceEnabled(opts),
|
|
7782
7171
|
watch: resolvedConfig?.build?.watch
|
|
7783
7172
|
});
|
|
7784
7173
|
const isCurrentWebLikeStylePlatform = () => {
|
|
@@ -7798,7 +7187,7 @@ function createViteFrameworkPlugins$1(options = {}, frameworkBranch) {
|
|
|
7798
7187
|
debug,
|
|
7799
7188
|
getResolvedConfig: () => resolvedConfig,
|
|
7800
7189
|
hmrCandidateState,
|
|
7801
|
-
isCandidateRequest:
|
|
7190
|
+
isCandidateRequest: require_generated_css_marker.isSourceCandidateRequest,
|
|
7802
7191
|
isWatchLikeBuild,
|
|
7803
7192
|
opts,
|
|
7804
7193
|
runtimeState,
|
|
@@ -7883,7 +7272,7 @@ function createViteFrameworkPlugins$1(options = {}, frameworkBranch) {
|
|
|
7883
7272
|
const inferredSfcStyleRequest = require_web.isSfcStyleSourceFile(file) ? require_web.resolveSfcStyleRequestFromKnownSource(file, cssMemory.getKnownSfcSource(file), code) : file;
|
|
7884
7273
|
const requestFile = require_web.isCSSRequest(id) ? inferredSfcStyleRequest === file ? require_web.resolveViteCssPipelineRequestFile(id) : inferredSfcStyleRequest : inferredSfcStyleRequest;
|
|
7885
7274
|
if (!require_web.isCSSRequest(requestFile) || opts.htmlMatcher(file) || require_web.isHTMLRequest(file)) return;
|
|
7886
|
-
const generatorCode =
|
|
7275
|
+
const generatorCode = (0, _weapp_tailwindcss_postcss_transform.normalizeEmptyTailwindCustomVariants)(code);
|
|
7887
7276
|
const rootDir = resolvedConfig?.root ? node_path.default.resolve(resolvedConfig.root) : node_process.default.cwd();
|
|
7888
7277
|
const currentGeneratorOptions = resolveCurrentGeneratorOptions();
|
|
7889
7278
|
const currentGeneratorBranch = resolveCurrentGeneratorBranch();
|
|
@@ -7894,7 +7283,7 @@ function createViteFrameworkPlugins$1(options = {}, frameworkBranch) {
|
|
|
7894
7283
|
const shouldPreserveStyleOutputExtension = frameworkCssPipelineStrategy?.shouldPreserveStyleOutputExtension?.(cssPipelineContext) ?? frameworkCssPipelineStrategy?.isNativeAppStyleTarget?.(cssPipelineContext) === true;
|
|
7895
7284
|
const sourceRoot = resolveWeappViteSourceRoot(resolvedConfig, opts.appType);
|
|
7896
7285
|
const outputFile = require_web.resolveViteCssPipelineOutputFile(requestFile, opts, rootDir, currentGeneratorBranch.isWeb, shouldPreserveStyleOutputExtension, sourceRoot);
|
|
7897
|
-
const generatorTransformCode = currentGeneratorBranch.isWeb ? generatorCode :
|
|
7286
|
+
const generatorTransformCode = currentGeneratorBranch.isWeb ? generatorCode : (0, _weapp_tailwindcss_postcss_transform.normalizeMiniProgramGeneratorCssSource)(generatorCode, outputFile);
|
|
7898
7287
|
const fileKey = normalizeGeneratedCssCacheFile(file);
|
|
7899
7288
|
const fullRuntime = getSourceCandidates() ?? getRecordedGeneratorCandidates() ?? await ensureRuntimeClassSet();
|
|
7900
7289
|
const transient = hookContext?.transient === true;
|
|
@@ -7939,7 +7328,7 @@ function createViteFrameworkPlugins$1(options = {}, frameworkBranch) {
|
|
|
7939
7328
|
const previousTracedCss = tracedGeneratedCssByFile.get(fileKey);
|
|
7940
7329
|
if (previousTracedCss !== void 0) {
|
|
7941
7330
|
hmrCandidateState.finishTarget(file);
|
|
7942
|
-
return `${
|
|
7331
|
+
return `${(0, _weapp_tailwindcss_postcss_transform.createBundlerGeneratedCssMarker)("vite", normalizeViteProcessedCssFile(file))}
|
|
7943
7332
|
${previousTracedCss}`;
|
|
7944
7333
|
}
|
|
7945
7334
|
}
|
|
@@ -7949,7 +7338,7 @@ ${previousTracedCss}`;
|
|
|
7949
7338
|
...sourceCssHandlerOptions,
|
|
7950
7339
|
isMainChunk: outputCssHandlerOptions.isMainChunk
|
|
7951
7340
|
};
|
|
7952
|
-
const transientCssSource = transientAutoCssSources.get(file) ?? (
|
|
7341
|
+
const transientCssSource = transientAutoCssSources.get(file) ?? ((0, _weapp_tailwindcss_postcss_transform.hasTailwindRootDirectives)(generatorTransformCode, { importFallback: currentGeneratorOptions.importFallback }) || (0, _weapp_tailwindcss_postcss_transform.hasTailwindSourceDirectives)(generatorTransformCode, { importFallback: currentGeneratorOptions.importFallback }) || (0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyDirective)(generatorTransformCode) ? {
|
|
7953
7342
|
base: node_path.default.dirname(node_path.default.resolve(file)),
|
|
7954
7343
|
css: generatorTransformCode,
|
|
7955
7344
|
file: node_path.default.resolve(file)
|
|
@@ -7960,9 +7349,9 @@ ${previousTracedCss}`;
|
|
|
7960
7349
|
generatorCode: generatorTransformCode
|
|
7961
7350
|
}) ?? true);
|
|
7962
7351
|
const previousCss = pendingHmrChange && !forceFullHmrCssRegeneration ? cleanGeneratedCssByFile.get(fileKey) : void 0;
|
|
7963
|
-
const previousGeneratorCss = previousCss && !currentGeneratorBranch.isWeb ?
|
|
7352
|
+
const previousGeneratorCss = previousCss && !currentGeneratorBranch.isWeb ? (0, _weapp_tailwindcss_postcss_transform.normalizeMiniProgramGeneratorCssSource)(previousCss, outputFile) : previousCss;
|
|
7964
7353
|
const hmrDebugState = hmrCandidateState.snapshotDebugState();
|
|
7965
|
-
const generated = await hmrTimingRecorder.measure(`generateCss.${resolvedConfig?.command ?? "unknown"}`, () =>
|
|
7354
|
+
const generated = await hmrTimingRecorder.measure(`generateCss.${resolvedConfig?.command ?? "unknown"}`, () => require_generated_css_marker.generateTailwindV4Css({
|
|
7966
7355
|
opts,
|
|
7967
7356
|
runtimeState,
|
|
7968
7357
|
runtime,
|
|
@@ -8003,23 +7392,23 @@ ${previousTracedCss}`;
|
|
|
8003
7392
|
const shouldApplyWebCssCompat = require_web.shouldApplyViteWebCssCompat(cssPipelineContext, frameworkCssPipelineStrategy);
|
|
8004
7393
|
const outputCss = frameworkCssPipelineStrategy?.transformGeneratedCss?.(finalizedCss, {
|
|
8005
7394
|
...cssPipelineContext,
|
|
8006
|
-
defaultWebCssCompat: (css) => (0,
|
|
8007
|
-
removeScopedPreflight: removeScopedTailwindPreflightCss,
|
|
7395
|
+
defaultWebCssCompat: (css) => (0, _weapp_tailwindcss_postcss_transform.transformWebCssCompat)(css, require_web.resolveViteWebCssCompatOptions(cssPipelineContext)),
|
|
7396
|
+
removeScopedPreflight: _weapp_tailwindcss_postcss_transform.removeScopedTailwindPreflightCss,
|
|
8008
7397
|
shouldApplyWebCssCompat
|
|
8009
|
-
}) ?? removeScopedTailwindPreflightCss(shouldApplyWebCssCompat ? (0,
|
|
7398
|
+
}) ?? (0, _weapp_tailwindcss_postcss_transform.removeScopedTailwindPreflightCss)(shouldApplyWebCssCompat ? (0, _weapp_tailwindcss_postcss_transform.transformWebCssCompat)(finalizedCss, require_web.resolveViteWebCssCompatOptions(cssPipelineContext)) : finalizedCss);
|
|
8010
7399
|
if (transient) {
|
|
8011
7400
|
for (const dependency of generated.dependencies) hookContext?.addWatchFile?.(dependency);
|
|
8012
7401
|
return outputCss;
|
|
8013
7402
|
}
|
|
8014
|
-
const tracedCss =
|
|
7403
|
+
const tracedCss = require_generated_css_marker.annotateCssSourceTrace(outputCss, {
|
|
8015
7404
|
opts,
|
|
8016
|
-
tokenSources:
|
|
7405
|
+
tokenSources: require_generated_css_marker.createCssTokenSourceMap(getSourceCandidateSourcesForEntries(void 0), opts)
|
|
8017
7406
|
});
|
|
8018
7407
|
for (const dependency of generated.dependencies) hookContext?.addWatchFile?.(dependency);
|
|
8019
7408
|
cleanGeneratedCssByFile.set(fileKey, outputCss);
|
|
8020
7409
|
tracedGeneratedCssByFile.set(fileKey, tracedCss);
|
|
8021
7410
|
generatedClassSetByFile.set(fileKey, new Set(generated.classSet));
|
|
8022
|
-
const shouldInjectGeneratedCssIntoMain = mainCssChunkMatcher(outputFile, opts.appType) ||
|
|
7411
|
+
const shouldInjectGeneratedCssIntoMain = mainCssChunkMatcher(outputFile, opts.appType) || (0, _weapp_tailwindcss_postcss_transform.hasTailwindRootDirectives)(generatorTransformCode, { importFallback: currentGeneratorOptions.importFallback }) && !require_source_candidate_scan_signature.normalizeOutputPathKey(outputFile).includes("/");
|
|
8023
7412
|
recordViteProcessedCssAssetResult(file, tracedCss, {
|
|
8024
7413
|
injectIntoMain: shouldInjectGeneratedCssIntoMain,
|
|
8025
7414
|
outputFile
|
|
@@ -8034,7 +7423,7 @@ ${previousTracedCss}`;
|
|
|
8034
7423
|
source: tracedCss
|
|
8035
7424
|
});
|
|
8036
7425
|
markViteProcessedCssSource(file);
|
|
8037
|
-
if (
|
|
7426
|
+
if ((0, _weapp_tailwindcss_postcss_transform.hasTailwindRootDirectives)(generatorTransformCode, { importFallback: currentGeneratorOptions.importFallback })) rememberTailwindRootCssModule(id);
|
|
8038
7427
|
recordGeneratorCandidates(fullRuntime);
|
|
8039
7428
|
if (pendingHmrChange || forceFullHmrCssRegeneration) hmrCandidateState.finishTarget(file);
|
|
8040
7429
|
else if (!hmrCandidateState.hasPendingChange()) hmrCandidateState.clear();
|
|
@@ -8044,8 +7433,8 @@ ${previousTracedCss}`;
|
|
|
8044
7433
|
sourceFile: requestFile
|
|
8045
7434
|
});
|
|
8046
7435
|
debug("css generated for vite postcss pipeline: %s bytes=%d", requestFile, tracedCss.length);
|
|
8047
|
-
return `${
|
|
8048
|
-
${tracedCss}${currentGeneratorBranch.isWeb ? `\n${
|
|
7436
|
+
return `${(0, _weapp_tailwindcss_postcss_transform.createBundlerGeneratedCssMarker)("vite", normalizeViteProcessedCssFile(file))}
|
|
7437
|
+
${tracedCss}${currentGeneratorBranch.isWeb ? `\n${(0, _weapp_tailwindcss_postcss_transform.createBundlerGeneratedCssEndMarker)("vite", normalizeViteProcessedCssFile(file))}` : ""}`;
|
|
8049
7438
|
};
|
|
8050
7439
|
const generateTailwindCssForVitePipeline = require_web.createFrameworkCssGenerationQueue(normalizeGeneratedCssCacheFile, generateTailwindCssForVitePipelineNow);
|
|
8051
7440
|
const shouldDeferFrameworkPreTransformGeneration = (id, code) => frameworkCssPipelineStrategy?.shouldDeferPreTransformTailwindGeneration?.({
|
|
@@ -8060,7 +7449,7 @@ ${tracedCss}${currentGeneratorBranch.isWeb ? `\n${require_v4_generation_core.cre
|
|
|
8060
7449
|
onTailwindRootCss: registerTailwindRootCss,
|
|
8061
7450
|
onCssSourceTransform: (id, code) => cssMemory.refreshRememberedCssSourceBySourceFile(id, code),
|
|
8062
7451
|
shouldGenerateCss: (_id, code) => require_web.hasVitePipelineTailwindGenerationDirective(code),
|
|
8063
|
-
shouldDeferGeneration: (id, code) => !shouldRewriteCssImports &&
|
|
7452
|
+
shouldDeferGeneration: (id, code) => !shouldRewriteCssImports && (0, _weapp_tailwindcss_postcss_transform.hasTailwindRootDirectives)(code, { importFallback: resolveCurrentGeneratorOptions().importFallback }) || shouldDeferFrameworkPreTransformGeneration(id, code),
|
|
8064
7453
|
shouldOwnTailwindGeneration,
|
|
8065
7454
|
shouldRewrite: shouldRewriteCssImports,
|
|
8066
7455
|
weappTailwindcssDirPosix
|
|
@@ -8084,7 +7473,7 @@ ${tracedCss}${currentGeneratorBranch.isWeb ? `\n${require_v4_generation_core.cre
|
|
|
8084
7473
|
getSourceCandidates,
|
|
8085
7474
|
getSourceCandidateSource: (file) => sourceCandidateCollector.source(file),
|
|
8086
7475
|
getSourceCandidateSources: () => sourceCandidateCollector.sources(),
|
|
8087
|
-
extractSourceCandidates: (file, source) =>
|
|
7476
|
+
extractSourceCandidates: (file, source) => require_generated_css_marker.extractCandidatesFromSource(source, node_path.default.extname((0, _weapp_tailwindcss_shared.cleanUrl)(file)).slice(1) || "html", {
|
|
8088
7477
|
bareArbitraryValues: opts.arbitraryValues?.bareArbitraryValues,
|
|
8089
7478
|
customAttributesEntities,
|
|
8090
7479
|
disabledDefaultTemplateHandler
|
|
@@ -8199,7 +7588,7 @@ ${tracedCss}${currentGeneratorBranch.isWeb ? `\n${require_v4_generation_core.cre
|
|
|
8199
7588
|
if (!shouldAdaptFrameworkWatchCss()) return;
|
|
8200
7589
|
if (wrapViteCssPostTransform(config, async (css, id) => {
|
|
8201
7590
|
if (!require_web.isCSSRequest(id)) return css;
|
|
8202
|
-
if (
|
|
7591
|
+
if ((0, _weapp_tailwindcss_postcss_transform.hasBundlerGeneratedCssMarker)(css)) {
|
|
8203
7592
|
debug("preserve adapted generated css before uni-app watch cache: %s", id);
|
|
8204
7593
|
return css;
|
|
8205
7594
|
}
|
|
@@ -8212,7 +7601,7 @@ ${tracedCss}${currentGeneratorBranch.isWeb ? `\n${require_v4_generation_core.cre
|
|
|
8212
7601
|
};
|
|
8213
7602
|
const sourceCandidatesPlugin = createFrameworkSourceCandidatesPlugin({
|
|
8214
7603
|
cssMemory,
|
|
8215
|
-
hasUserCssLayerBlocks:
|
|
7604
|
+
hasUserCssLayerBlocks: _weapp_tailwindcss_postcss_transform.hasUserCssLayerBlocks,
|
|
8216
7605
|
hmrCandidateState,
|
|
8217
7606
|
hmrCssModuleVersions,
|
|
8218
7607
|
hmrTimingRecorder,
|
|
@@ -8242,7 +7631,7 @@ ${tracedCss}${currentGeneratorBranch.isWeb ? `\n${require_v4_generation_core.cre
|
|
|
8242
7631
|
}, require_web.createGenericWebProductionSourceCandidatesApply({
|
|
8243
7632
|
frameworkName: frameworkBranch.frameworkName,
|
|
8244
7633
|
getIsWebGeneratorTarget: () => resolveCurrentGeneratorBranch().isWeb,
|
|
8245
|
-
requiresSourceCandidateState:
|
|
7634
|
+
requiresSourceCandidateState: require_generated_css_marker.isCssSourceTraceEnabled(opts)
|
|
8246
7635
|
}));
|
|
8247
7636
|
const postPlugin = require_web.createFrameworkPostPlugin({
|
|
8248
7637
|
api: { registerProcessedCssAsset(entry) {
|
|
@@ -8474,7 +7863,7 @@ const uniAppCssPipelineStrategy = {
|
|
|
8474
7863
|
},
|
|
8475
7864
|
transformGeneratedCss(css, context) {
|
|
8476
7865
|
const webCss = context.shouldApplyWebCssCompat ? context.defaultWebCssCompat(css) : css;
|
|
8477
|
-
const safeCss = isUniAppWebviewStylePlatform(context.resolveStylePlatform()) ? (0,
|
|
7866
|
+
const safeCss = isUniAppWebviewStylePlatform(context.resolveStylePlatform()) ? (0, _weapp_tailwindcss_postcss_transform.transformWebCssSafeSelectors)(webCss, { escapeMap: context.opts.escapeMap }) : webCss;
|
|
8478
7867
|
return context.removeScopedPreflight(safeCss);
|
|
8479
7868
|
}
|
|
8480
7869
|
};
|
|
@@ -8599,16 +7988,16 @@ const uniAppXCssPipelineStrategy = {
|
|
|
8599
7988
|
return true;
|
|
8600
7989
|
},
|
|
8601
7990
|
shouldDeferEmptyScopedCssSource(context) {
|
|
8602
|
-
if (!context.cssHandlerOptions.isMainChunk &&
|
|
7991
|
+
if (!context.cssHandlerOptions.isMainChunk && (0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyDirective)(context.generatorCode)) return false;
|
|
8603
7992
|
return true;
|
|
8604
7993
|
},
|
|
8605
7994
|
shouldDeferPreTransformTailwindGeneration(context) {
|
|
8606
|
-
return resolveUniAppXCssTarget(context.id) === "uvue" &&
|
|
7995
|
+
return resolveUniAppXCssTarget(context.id) === "uvue" && (0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyDirective)(context.code) && !(0, _weapp_tailwindcss_postcss_transform.hasTailwindRootDirectives)(context.code, { importFallback: true });
|
|
8607
7996
|
},
|
|
8608
7997
|
transformGeneratedCss(css, context) {
|
|
8609
7998
|
const webCss = context.shouldApplyWebCssCompat ? context.defaultWebCssCompat(css) : css;
|
|
8610
7999
|
const output = withUniAppXWebPreflightReset(context.removeScopedPreflight(webCss, { preserveRuntimeProperties: context.currentGeneratorBranch.isWeb }), context.currentGeneratorBranch.isWeb);
|
|
8611
|
-
return context.currentGeneratorBranch.isWeb ? output : (0,
|
|
8000
|
+
return context.currentGeneratorBranch.isWeb ? output : (0, _weapp_tailwindcss_postcss_transform.hoistUniAppXBorderPreflight)(output);
|
|
8612
8001
|
}
|
|
8613
8002
|
};
|
|
8614
8003
|
function createUniAppXVitePlugins(options = {}) {
|