weapp-tailwindcss 5.1.16 → 5.2.0
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/README.en.md +6 -0
- package/README.md +6 -0
- package/bin/{weapp-tailwindcss.js → weapp-tailwindcss.cjs} +1 -1
- package/dist/bundlers/framework-selector.d.ts +2 -2
- package/dist/bundlers/gulp/asset-emission-plan.d.ts +10 -0
- package/dist/bundlers/gulp/frameworks/native/index.d.ts +10 -3
- package/dist/bundlers/gulp/index.d.ts +10 -3
- package/dist/bundlers/gulp/module-graph.d.ts +1 -1
- package/dist/bundlers/gulp/runtime-snapshot.d.ts +4 -2
- package/dist/bundlers/gulp/shared/create-native-framework-plugins/cache-state.d.ts +4 -4
- package/dist/bundlers/gulp/shared/create-native-framework-plugins/file-transforms.d.ts +5 -3
- package/dist/bundlers/gulp/shared/create-native-framework-plugins.d.ts +9 -2
- package/dist/bundlers/rspack/index.d.ts +2 -2
- package/dist/bundlers/shared/cache.d.ts +1 -1
- package/dist/bundlers/shared/css-imports.d.ts +1 -1
- package/dist/bundlers/shared/css-source-trace.d.ts +2 -2
- package/dist/bundlers/shared/framework-postcss.d.ts +9 -2
- package/dist/bundlers/shared/generator-css/candidates.d.ts +2 -0
- package/dist/bundlers/shared/generator-css/generation-helpers/preflight.d.ts +4 -3
- package/dist/bundlers/shared/generator-css/generation-helpers/results.d.ts +3 -3
- package/dist/bundlers/shared/generator-css/generation-helpers/runtime-isolation.d.ts +4 -4
- package/dist/bundlers/shared/generator-css/generation-helpers.d.ts +4 -4
- package/dist/bundlers/shared/generator-css/legacy-compat.d.ts +2 -2
- package/dist/bundlers/shared/generator-css/pipeline/context.d.ts +58 -0
- package/dist/bundlers/shared/generator-css/pipeline/deferred-output.d.ts +3 -14
- package/dist/bundlers/shared/generator-css/pipeline/execution.d.ts +3 -12
- package/dist/bundlers/shared/generator-css/pipeline/fallback-output.d.ts +3 -12
- package/dist/bundlers/shared/generator-css/pipeline/ordered-output.d.ts +3 -25
- package/dist/bundlers/shared/generator-css/pipeline.d.ts +1 -1
- package/dist/bundlers/shared/generator-css/result-helpers.d.ts +2 -2
- package/dist/bundlers/shared/generator-css/source-resolver/configuration.d.ts +3 -4
- package/dist/bundlers/shared/generator-css/source-resolver/matching.d.ts +1 -1
- package/dist/bundlers/shared/generator-css/source-resolver/metadata.d.ts +13 -5
- package/dist/bundlers/shared/generator-css/source-resolver/postcss-source.d.ts +1 -1
- package/dist/bundlers/shared/generator-css/source-resolver/resolve-source.d.ts +3 -3
- package/dist/bundlers/shared/generator-css/source-resolver/resolve-sources.d.ts +4 -3
- package/dist/bundlers/shared/generator-css/source-resolver/single-source.d.ts +9 -9
- package/dist/bundlers/shared/generator-css/source-resolver/source-entries.d.ts +3 -3
- package/dist/bundlers/shared/generator-css/source-resolver/source-matching.d.ts +4 -4
- package/dist/bundlers/shared/generator-css/source-resolver/types.d.ts +4 -4
- package/dist/bundlers/shared/generator-css/source-resolver.d.ts +7 -6
- package/dist/bundlers/shared/generator-css/types.d.ts +12 -3
- package/dist/bundlers/shared/generator-css/user-css/transform.d.ts +1 -1
- package/dist/bundlers/shared/generator-css/user-css.d.ts +5 -5
- package/dist/bundlers/shared/generator-css/validate.d.ts +1 -1
- package/dist/bundlers/shared/generator-css.d.ts +9 -9
- package/dist/bundlers/shared/runtime-class-set/entries.d.ts +4 -0
- package/dist/bundlers/shared/runtime-class-set/escaped-candidates.d.ts +9 -0
- package/dist/bundlers/shared/runtime-class-set.d.ts +30 -0
- package/dist/bundlers/shared/runtime-entry-type.d.ts +8 -0
- package/dist/bundlers/shared/runtime-signatures.d.ts +8 -0
- package/dist/bundlers/shared/source-candidate-scan-signature.d.ts +13 -0
- package/dist/bundlers/{vite → shared}/source-candidates/collector.d.ts +1 -1
- package/dist/bundlers/shared/source-candidates/scan-root.d.ts +10 -0
- package/dist/bundlers/{vite → shared}/source-candidates/script.d.ts +1 -1
- package/dist/bundlers/{vite → shared}/source-candidates/store.d.ts +1 -1
- package/dist/bundlers/{vite → shared}/source-candidates/types-and-cache.d.ts +3 -3
- package/dist/bundlers/shared/source-candidates.d.ts +4 -0
- package/dist/bundlers/shared/source-scan/css-entries.d.ts +18 -0
- package/dist/bundlers/shared/source-scan.d.ts +16 -0
- package/dist/bundlers/shared/static-config-content.d.ts +5 -0
- package/dist/bundlers/shared/v4-generation-core.d.ts +8 -3
- package/dist/bundlers/vite/bundle-entries.d.ts +1 -1
- package/dist/bundlers/vite/bundle-state.d.ts +11 -38
- package/dist/bundlers/vite/css-asset-identity.d.ts +11 -0
- package/dist/bundlers/vite/css-finalizer/options.d.ts +3 -3
- package/dist/bundlers/vite/css-finalizer/plugin.d.ts +1 -1
- package/dist/bundlers/vite/css-finalizer.d.ts +1 -1
- package/dist/bundlers/vite/css-memory.d.ts +1 -2
- package/dist/bundlers/vite/frameworks/generic/index.d.ts +2 -2
- package/dist/bundlers/vite/frameworks/taro/index.d.ts +2 -2
- package/dist/bundlers/vite/frameworks/uni-app/index.d.ts +3 -3
- package/dist/bundlers/vite/frameworks/uni-app-x/index.d.ts +3 -3
- package/dist/bundlers/vite/frameworks/weapp-vite/index.d.ts +2 -2
- package/dist/bundlers/vite/generate-bundle/asset-emission-plan.d.ts +8 -0
- package/dist/bundlers/vite/generate-bundle/bundle-markup-candidates.d.ts +4 -4
- package/dist/bundlers/vite/generate-bundle/configured-css-sources.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/css-assets.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/css-cache-task.d.ts +34 -0
- package/dist/bundlers/vite/generate-bundle/css-composition-plan.d.ts +58 -0
- package/dist/bundlers/vite/generate-bundle/css-config-directives.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/css-entry-processing.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/css-output-helpers.d.ts +21 -2
- package/dist/bundlers/vite/generate-bundle/css-output.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/css-share-scope.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/css-source-plan.d.ts +19 -0
- package/dist/bundlers/vite/generate-bundle/css-transform-decision-plan.d.ts +61 -0
- package/dist/bundlers/vite/generate-bundle/css-transform-result.d.ts +23 -0
- package/dist/bundlers/vite/generate-bundle/css-transform-task.d.ts +42 -0
- package/dist/bundlers/vite/generate-bundle/final-css-assets.d.ts +3 -2
- package/dist/bundlers/vite/generate-bundle/finalize/bundle.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/finalize/root-import-shell.d.ts +5 -5
- package/dist/bundlers/vite/generate-bundle/finalize.d.ts +2 -2
- package/dist/bundlers/vite/generate-bundle/html-processing.d.ts +2 -2
- package/dist/bundlers/vite/generate-bundle/js-entries.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/js-handler-options.d.ts +2 -1
- package/dist/bundlers/vite/generate-bundle/js-linking.d.ts +2 -2
- package/dist/bundlers/vite/generate-bundle/js-processing.d.ts +6 -5
- package/dist/bundlers/vite/generate-bundle/memory-debug.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/process-plan.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/remembered-css-plan.d.ts +35 -0
- package/dist/bundlers/vite/generate-bundle/remembered-css-replay.d.ts +5 -6
- package/dist/bundlers/vite/generate-bundle/remembered-css.d.ts +2 -2
- package/dist/bundlers/vite/generate-bundle/root-style-output.d.ts +20 -0
- package/dist/bundlers/vite/generate-bundle/runtime-configured-css.d.ts +54 -0
- package/dist/bundlers/vite/generate-bundle/runtime-linked-css.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/runtime-linked-source-memory.d.ts +3 -3
- package/dist/bundlers/vite/{generate-bundle-runtime.d.ts → generate-bundle/runtime.d.ts} +4 -4
- package/dist/bundlers/vite/generate-bundle/scoped-generator.d.ts +2 -2
- package/dist/bundlers/vite/generate-bundle/sfc-style-source.d.ts +2 -2
- package/dist/bundlers/vite/generate-bundle/signatures.d.ts +1 -8
- package/dist/bundlers/vite/generate-bundle/source-candidate-scope.d.ts +3 -3
- package/dist/bundlers/vite/generate-bundle/source-candidate-source.d.ts +5 -0
- package/dist/bundlers/vite/generate-bundle/subpackages.d.ts +2 -2
- package/dist/bundlers/vite/generate-bundle/temporary-css-assets.d.ts +14 -1
- package/dist/bundlers/vite/generate-bundle/transform-filter.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/transform-scheduling.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/types.d.ts +8 -7
- package/dist/bundlers/vite/generate-bundle/uni-app-x-postprocess.d.ts +3 -2
- package/dist/bundlers/vite/generate-bundle/validate-runtime-candidates.d.ts +22 -0
- package/dist/bundlers/vite/generate-bundle.d.ts +6 -6
- package/dist/bundlers/vite/incremental-runtime-class-set/entries.d.ts +1 -4
- package/dist/bundlers/vite/incremental-runtime-class-set/escaped-candidates.d.ts +1 -3
- package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +2 -30
- package/dist/bundlers/vite/index.d.ts +3 -3
- package/dist/bundlers/vite/js-precheck.d.ts +1 -1
- package/dist/bundlers/vite/processed-css-assets/cleanup.d.ts +2 -1
- package/dist/bundlers/vite/processed-css-assets/collector.d.ts +1 -1
- package/dist/bundlers/vite/processed-css-assets/coverage.d.ts +1 -1
- package/dist/bundlers/vite/processed-css-assets/empty-at-rule.d.ts +1 -0
- package/dist/bundlers/vite/processed-css-assets/injection-plan.d.ts +4 -4
- package/dist/bundlers/vite/processed-css-assets/markers-imports.d.ts +5 -5
- package/dist/bundlers/vite/processed-css-assets.d.ts +4 -4
- package/dist/bundlers/vite/resolve-app-type.d.ts +1 -1
- package/dist/bundlers/vite/rewrite-css-imports.d.ts +3 -2
- package/dist/bundlers/vite/runtime-affecting-signature.d.ts +1 -2
- package/dist/bundlers/vite/runtime-candidate-entry.d.ts +9 -0
- package/dist/bundlers/vite/runtime-class-set.d.ts +4 -4
- package/dist/bundlers/vite/serve-css-generation.d.ts +2 -1
- package/dist/bundlers/vite/serve-js-transform.d.ts +1 -1
- package/dist/bundlers/vite/serve-root-import-shell.d.ts +1 -1
- package/dist/bundlers/vite/shared/create-framework-plugins.d.ts +7 -7
- package/dist/bundlers/vite/shared/framework-hmr-candidate-state.d.ts +45 -0
- package/dist/bundlers/vite/shared/framework-post-plugin.d.ts +2 -0
- package/dist/bundlers/vite/shared/framework-processed-css-registry.d.ts +22 -0
- package/dist/bundlers/vite/shared/framework-runtime-options.d.ts +1 -0
- package/dist/bundlers/vite/shared/framework-source-candidates-plugin.d.ts +2 -0
- package/dist/bundlers/vite/shared/framework-source-scan-session.d.ts +38 -0
- package/dist/bundlers/vite/shared/framework-strategy.d.ts +4 -4
- package/dist/bundlers/vite/source-candidate-scan-signature.d.ts +2 -13
- package/dist/bundlers/vite/source-candidates/scan-root.d.ts +1 -10
- package/dist/bundlers/vite/source-candidates.d.ts +1 -4
- package/dist/bundlers/vite/source-output-relations.d.ts +24 -0
- package/dist/bundlers/vite/source-scan/css-entries.d.ts +2 -18
- package/dist/bundlers/vite/source-scan.d.ts +2 -16
- package/dist/bundlers/vite/static-config-content.d.ts +1 -5
- package/dist/bundlers/vite/uni-app-x-css-options.d.ts +1 -1
- package/dist/bundlers/vite/web-css-compat.d.ts +1 -1
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/asset-emission-plan.d.ts +18 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/css-source-resolvers.d.ts +2 -2
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/finalize-assets.d.ts +1 -1
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/generated-css-task.d.ts +1 -1
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/helpers.d.ts +11 -41
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/html-js-tasks.d.ts +1 -1
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/js-module-graph.d.ts +4 -10
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/finalize.d.ts +4 -4
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/memory-trace.d.ts +3 -3
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/preflight-runtime.d.ts +6 -6
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/resources.d.ts +2 -2
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/sources.d.ts +4 -4
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/user-css.d.ts +1 -1
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers.d.ts +9 -9
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/source-candidate-cache.d.ts +3 -3
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/source-candidate-refresh.d.ts +3 -3
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +2 -2
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +4 -4
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +2 -2
- package/dist/bundlers/webpack/frameworks/generic/index.d.ts +2 -2
- package/dist/bundlers/webpack/frameworks/index.d.ts +7 -7
- package/dist/bundlers/webpack/frameworks/mpx/index.d.ts +2 -2
- package/dist/bundlers/webpack/frameworks/taro/index.d.ts +2 -2
- package/dist/bundlers/webpack/frameworks/uni-app/index.d.ts +2 -2
- package/dist/bundlers/webpack/frameworks/weapp-vite/index.d.ts +2 -2
- package/dist/bundlers/webpack/index.d.ts +1 -1
- package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +2 -2
- package/dist/bundlers/webpack/loaders/weapp-tw-css-generation-loader.d.ts +1 -1
- package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +1 -1
- package/dist/bundlers/webpack/loaders/weapp-tw-runtime-classset-loader.d.ts +1 -1
- package/dist/bundlers/webpack/shared/create-framework-plugin/plugin.d.ts +4 -4
- package/dist/bundlers/webpack/shared/create-framework-plugin.d.ts +3 -3
- package/dist/cli/context.d.ts +2 -2
- package/dist/cli/doctor.d.ts +1 -1
- package/dist/cli/helpers/options.d.ts +3 -3
- package/dist/cli/helpers.d.ts +1 -1
- package/dist/cli.cjs +37012 -0
- package/dist/cli.js +141 -168
- package/dist/compiler/artifact.d.ts +14 -0
- package/dist/compiler/candidate-index.d.ts +10 -0
- package/dist/compiler/compilation-change-coordinator.d.ts +28 -0
- package/dist/compiler/compilation-dependency-state.d.ts +16 -0
- package/dist/compiler/compilation-scope-graph.d.ts +31 -0
- package/dist/compiler/compilation-session-pool.d.ts +54 -0
- package/dist/compiler/compiler-owner-state.d.ts +3 -0
- package/dist/compiler/composition.d.ts +8 -0
- package/dist/compiler/emission-plan.d.ts +26 -0
- package/dist/compiler/index.d.ts +23 -0
- package/dist/compiler/invalidation.d.ts +3 -0
- package/dist/compiler/mode.d.ts +3 -0
- package/dist/compiler/owner-lifecycle.d.ts +1 -0
- package/dist/compiler/platform-adapter.d.ts +9 -0
- package/dist/compiler/runtime-affecting-signature.d.ts +2 -0
- package/dist/compiler/runtime-build-state.d.ts +6 -0
- package/dist/compiler/runtime-snapshot.d.ts +53 -0
- package/dist/compiler/scope-planner.d.ts +6 -0
- package/dist/compiler/semantic-css.d.ts +66 -0
- package/dist/compiler/session.d.ts +13 -0
- package/dist/compiler/shadow-gate.d.ts +26 -0
- package/dist/compiler/shadow-report-session.d.ts +37 -0
- package/dist/compiler/shadow-report.d.ts +15 -0
- package/dist/compiler/source-graph.d.ts +32 -0
- package/dist/compiler/tailwind-generation-session-pool.d.ts +22 -0
- package/dist/compiler/types.d.ts +95 -0
- package/dist/constants.d.ts +2 -2
- package/dist/context/compiler-context-cache.d.ts +1 -1
- package/dist/context/custom-attributes.d.ts +1 -1
- package/dist/context/handlers.d.ts +3 -3
- package/dist/context/index.d.ts +1 -1
- package/dist/context/runtime-package-replacements.d.ts +1 -1
- package/dist/context/style-options.d.ts +1 -1
- package/dist/context/tailwindcss.d.ts +3 -3
- package/dist/{context-BtLIID4m.js → context-PZXBqrAJ.cjs} +31 -93
- package/dist/{context-JzwzSX36.mjs → context-oTkxC5aZ.js} +22 -11
- package/dist/{core.mjs → core.cjs} +13 -12
- package/dist/core.d.ts +2 -2
- package/dist/core.js +12 -13
- package/dist/css-imports-DfNC3e6a.cjs +43 -0
- package/dist/css-loader-runtime-CSv0lKqV.cjs +11 -0
- package/dist/css-macro/postcss.cjs +19 -0
- package/dist/css-macro/postcss.js +2 -19
- package/dist/{css-macro.mjs → css-macro.cjs} +11 -8
- package/dist/css-macro.d.ts +2 -2
- package/dist/css-macro.js +8 -11
- package/dist/{defaults.mjs → defaults.cjs} +16 -11
- package/dist/defaults.d.ts +1 -1
- package/dist/defaults.js +11 -16
- package/dist/{escape.mjs → escape.cjs} +18 -4
- package/dist/escape.js +4 -18
- package/dist/framework/platform.d.ts +1 -1
- package/dist/{framework.mjs → framework.cjs} +47 -25
- package/dist/framework.d.ts +1 -1
- package/dist/framework.js +25 -47
- package/dist/generator/index.d.ts +6 -6
- package/dist/generator/options.d.ts +3 -3
- package/dist/generator/types.d.ts +2 -2
- package/dist/{generator-B91GhUJQ.js → generator-C8D5cnbe.cjs} +164 -33
- package/dist/{generator-Bv7myuhY.mjs → generator-CDdzqf1S.js} +155 -30
- package/dist/generator.cjs +12 -0
- package/dist/generator.d.ts +1 -1
- package/dist/generator.js +2 -12
- package/dist/{gulp-Q1wITegn.js → gulp-Cjcss8T_.cjs} +157 -103
- package/dist/{gulp-CKSklPlH.mjs → gulp-DNXQvDUw.js} +141 -90
- package/dist/gulp.cjs +5 -0
- package/dist/gulp.d.ts +4 -4
- package/dist/gulp.js +2 -5
- package/dist/{hmr-timing-BXg7nI8N.mjs → hmr-timing-CuJwQzDc.js} +3824 -1988
- package/dist/hmr-timing-DMLfNfGG.cjs +555 -0
- package/dist/index.cjs +45 -0
- package/dist/index.d.ts +9 -9
- package/dist/index.js +9 -45
- package/dist/js/JsTokenUpdater.d.ts +1 -1
- package/dist/js/ModuleGraph.d.ts +3 -3
- package/dist/js/NodePathWalker.d.ts +2 -2
- package/dist/js/babel/process.d.ts +2 -2
- package/dist/js/babel.d.ts +8 -8
- package/dist/js/evalTransforms.d.ts +2 -2
- package/dist/js/fast-path/oxc.d.ts +1 -1
- package/dist/js/handlers.d.ts +2 -2
- package/dist/js/index.d.ts +3 -3
- package/dist/js/literal-transform.d.ts +1 -1
- package/dist/js/module-graph/ignored-exports.d.ts +4 -4
- package/dist/js/module-graph/types.d.ts +2 -2
- package/dist/js/node-path-walker/export-handlers.d.ts +1 -1
- package/dist/js/precheck.d.ts +1 -1
- package/dist/js/replacement-cache.d.ts +1 -1
- package/dist/js/sourceAnalysis.d.ts +3 -3
- package/dist/js/taggedTemplateIgnore.d.ts +1 -1
- package/dist/object-Bvy6-w9r.js +47 -0
- package/dist/object-C_Vr6_S5.cjs +58 -0
- package/dist/options-DlvhQwWB.cjs +775 -0
- package/dist/pipeline-helpers-XtUmUlci.cjs +955 -0
- package/dist/postcss-html-transform.cjs +7 -0
- package/dist/postcss-html-transform.js +3 -5
- package/dist/postcss.cjs +15 -0
- package/dist/postcss.js +7 -11
- package/dist/presets/hbuilderx.d.ts +2 -2
- package/dist/presets/index.d.ts +4 -4
- package/dist/presets/shared.d.ts +1 -1
- package/dist/presets/taro.d.ts +2 -2
- package/dist/presets/uni-app-x.d.ts +1 -1
- package/dist/presets/uni-app.d.ts +2 -2
- package/dist/{presets.mjs → presets.cjs} +37 -24
- package/dist/presets.d.ts +1 -1
- package/dist/presets.js +24 -36
- package/dist/reset.cjs +19 -0
- package/dist/reset.d.ts +2 -2
- package/dist/reset.js +2 -19
- package/dist/{rolldown-runtime-emK7D4bc.js → rolldown-runtime-CVvi-lCc.cjs} +15 -0
- package/dist/{rspack.mjs → rspack.cjs} +10 -4
- package/dist/rspack.d.ts +3 -3
- package/dist/rspack.js +4 -10
- package/dist/runtime-branch/create-branch.d.ts +1 -1
- package/dist/runtime-branch/generator-target-env.d.ts +1 -1
- package/dist/runtime-branch/index.d.ts +2 -2
- package/dist/runtime-branch/mini-program.d.ts +1 -1
- package/dist/runtime-branch/native-app.d.ts +1 -1
- package/dist/runtime-branch/platform.d.ts +2 -2
- package/dist/runtime-branch/tailwind-version.d.ts +1 -1
- package/dist/runtime-branch/types.d.ts +2 -2
- package/dist/runtime-branch/web.d.ts +1 -1
- package/dist/runtime-branch.d.ts +1 -1
- package/dist/runtime-registry-Y7NrD2WH.cjs +31 -0
- package/dist/shared/classname-transform.d.ts +1 -1
- package/dist/shared/mpx.d.ts +1 -1
- package/dist/source-candidate-scan-signature-B0S7f5P7.js +421 -0
- package/dist/source-candidate-scan-signature-BmSuoxR9.cjs +555 -0
- package/dist/style-injector/internal.d.ts +6 -6
- package/dist/style-options-CEfXwZzX.cjs +75 -0
- package/dist/tailwindcss/candidates.d.ts +2 -2
- package/dist/tailwindcss/index.d.ts +1 -1
- package/dist/tailwindcss/runtime/cache.d.ts +1 -1
- package/dist/tailwindcss/runtime-factory.d.ts +2 -2
- package/dist/tailwindcss/runtime-options.d.ts +1 -1
- package/dist/tailwindcss/runtime-types.d.ts +2 -2
- package/dist/tailwindcss/runtime.d.ts +2 -2
- package/dist/tailwindcss/source-scan.d.ts +2 -2
- package/dist/tailwindcss/targets.d.ts +1 -1
- package/dist/tailwindcss/v4/config.d.ts +1 -1
- package/dist/tailwindcss/v4/css-sources.d.ts +2 -1
- package/dist/tailwindcss/v4/index.d.ts +2 -2
- package/dist/tailwindcss/v4/multi-runtime.d.ts +1 -1
- package/dist/tailwindcss/v4/runtime-factory.d.ts +5 -5
- package/dist/tailwindcss/v4/runtime-options.d.ts +1 -1
- package/dist/tailwindcss/v4-engine/css-macro-source.d.ts +1 -1
- package/dist/tailwindcss/v4-engine/generator/css-compat.d.ts +1 -1
- package/dist/tailwindcss/v4-engine/generator/engine.d.ts +1 -1
- package/dist/tailwindcss/v4-engine/generator/incremental-cache.d.ts +4 -5
- package/dist/tailwindcss/v4-engine/generator/native-session.d.ts +17 -0
- package/dist/tailwindcss/v4-engine/generator/scan-sources.d.ts +2 -1
- package/dist/tailwindcss/v4-engine/generator.d.ts +2 -2
- package/dist/tailwindcss/v4-engine/index.d.ts +5 -5
- package/dist/tailwindcss/v4-engine/miniprogram.d.ts +2 -2
- package/dist/tailwindcss/v4-engine/source.d.ts +2 -2
- package/dist/tailwindcss/v4-engine/types.d.ts +1 -0
- package/dist/{tailwindcss-B4phC0kB.js → tailwindcss-Cs94gJgf.cjs} +9 -769
- package/dist/{tailwindcss-BTcXX8Ka.mjs → tailwindcss-D7TGiZR2.js} +22 -22
- package/dist/transform-BUEyOCT7.cjs +341 -0
- package/dist/transform-BbaPIji9.js +342 -0
- package/dist/typedoc.export.d.ts +4 -4
- package/dist/types/index.d.ts +7 -7
- package/dist/types/shared.d.ts +1 -1
- package/dist/types/typedoc-tailwindcss-runtime.d.ts +3 -3
- package/dist/types/user-defined-options/general.d.ts +5 -5
- package/dist/types/user-defined-options/important.d.ts +2 -2
- package/dist/types/user-defined-options/index.d.ts +9 -9
- package/dist/types/user-defined-options/matcher.d.ts +2 -2
- package/dist/types.cjs +0 -0
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -0
- package/dist/uni-app-x/harmony.d.ts +1 -0
- package/dist/uni-app-x/index.d.ts +2 -2
- package/dist/uni-app-x/options.d.ts +1 -1
- package/dist/uni-app-x/style-asset/harmony-apply.d.ts +1 -0
- package/dist/uni-app-x/style-asset/style-value.d.ts +3 -0
- package/dist/uni-app-x/style-asset.d.ts +5 -4
- package/dist/uni-app-x/transform.d.ts +1 -1
- package/dist/uni-app-x/vite/harmony-apply.d.ts +19 -0
- package/dist/uni-app-x/vite/native-target.d.ts +2 -0
- package/dist/uni-app-x/vite.d.ts +5 -2
- package/dist/unocss/index.d.ts +1 -1
- package/dist/utils/disabled.d.ts +1 -1
- package/dist/utils/index.d.ts +3 -3
- package/dist/{hmr-timing-CMPaWn9P.js → v4-generation-core-D7MuR5ZF.cjs} +3468 -2059
- package/dist/{vite-BwQWl9ft.mjs → vite-BI1TeUPO.js} +5968 -4456
- package/dist/{vite-DhVnXvAQ.js → vite-CBzmUTu-.cjs} +6159 -4672
- package/dist/vite.cjs +4 -0
- package/dist/vite.d.ts +3 -3
- package/dist/vite.js +2 -4
- package/dist/watch-dependencies-BZGubvuJ.cjs +40 -0
- package/dist/{weapp-tw-css-generation-loader.js → weapp-tw-css-generation-loader.cjs} +3 -2
- package/dist/weapp-tw-css-import-rewrite-loader.cjs +201 -0
- package/dist/{weapp-tw-runtime-classset-loader.js → weapp-tw-runtime-classset-loader.cjs} +9 -11
- package/dist/{webpack-kh78iMSS.js → webpack-Dao6bWEj.cjs} +208 -954
- package/dist/{webpack-Bo1QrFPf.mjs → webpack-dAY9h8r8.js} +105 -101
- package/dist/webpack.cjs +5 -0
- package/dist/webpack.d.ts +2 -2
- package/dist/webpack.js +2 -5
- package/dist/wxml/Tokenizer.d.ts +2 -2
- package/dist/wxml/custom-attributes.d.ts +1 -1
- package/dist/wxml/index.d.ts +2 -2
- package/dist/wxml/shared.d.ts +1 -1
- package/dist/wxml/utils/codegen/legacy-rewriter.d.ts +1 -1
- package/dist/wxml/utils/codegen/legacy-visitor.d.ts +2 -2
- package/dist/wxml/utils/codegen.d.ts +1 -1
- package/dist/wxml/utils/custom-template.d.ts +2 -2
- package/dist/wxml/utils/fragment-helpers.d.ts +2 -2
- package/dist/wxml/utils/fragment-updater.d.ts +2 -2
- package/dist/wxml/utils/template-fragments.d.ts +2 -2
- package/dist/wxml/utils.d.ts +5 -5
- package/dist/wxml-DSMNuUaP.cjs +38609 -0
- package/dist/{cli.mjs → wxml-IBzZSaQC.js} +237 -714
- package/package.json +56 -53
- package/dist/css-macro/postcss.mjs +0 -2
- package/dist/generator.mjs +0 -2
- package/dist/gulp.mjs +0 -2
- package/dist/index.mjs +0 -9
- package/dist/object-BJSWl-E5.mjs +0 -9
- package/dist/object-COs_Mw6p.js +0 -14
- package/dist/postcss-html-transform.mjs +0 -5
- package/dist/postcss.mjs +0 -11
- package/dist/reset.mjs +0 -2
- package/dist/source-candidate-scan-signature-BKZZk_e6.js +0 -1078
- package/dist/source-candidate-scan-signature-CtK-mB_C.mjs +0 -854
- package/dist/transform-B_KM9sLX.mjs +0 -14930
- package/dist/transform-CcYptivi.js +0 -14927
- package/dist/types.mjs +0 -1
- package/dist/vite.mjs +0 -2
- package/dist/watch-dependencies-bpG6kmAf.js +0 -80
- package/dist/weapp-tw-css-import-rewrite-loader-B0tVkJLH.js +0 -10524
- package/dist/weapp-tw-css-import-rewrite-loader.js +0 -10
- package/dist/webpack.mjs +0 -2
- package/dist/wxml-Ce10eREX.js +0 -3979
- package/dist/wxml-DdGdeqaH.mjs +0 -3861
- /package/dist/{auto-2dg_uhEJ.mjs → auto-2dg_uhEJ.js} +0 -0
- /package/dist/{auto-DtU6f3X6.js → auto-DtU6f3X6.cjs} +0 -0
- /package/dist/bundlers/{vite → shared}/source-scan/dependencies.d.ts +0 -0
- /package/dist/{cache-options-DavPxrhC.js → cache-options-DavPxrhC.cjs} +0 -0
- /package/dist/{cache-options-DwBtLwQe.mjs → cache-options-DwBtLwQe.js} +0 -0
- /package/dist/{logger-BNzxZbZj.mjs → logger-BNzxZbZj.js} +0 -0
- /package/dist/{logger-TlKT3xmR.js → logger-TlKT3xmR.cjs} +0 -0
- /package/dist/{utils-CuKLf1Zv.js → utils-CuKLf1Zv.cjs} +0 -0
- /package/dist/{utils-MVwpU07P.mjs → utils-MVwpU07P.js} +0 -0
|
@@ -1,854 +0,0 @@
|
|
|
1
|
-
import { detectAppType } from "./framework.mjs";
|
|
2
|
-
import { i as normalizeWeappTailwindcssGeneratorOptions, q as preferScopedGeneratedCssRules } from "./generator-Bv7myuhY.mjs";
|
|
3
|
-
import { n as hasCssMacroTailwindV4CustomVariantConditionalComments } from "./auto-2dg_uhEJ.mjs";
|
|
4
|
-
import { g as resolveTailwindV4EntriesFromCssCached, i as resolveUniAppXOptions } from "./tailwindcss-BTcXX8Ka.mjs";
|
|
5
|
-
import { _ as babelParse, n as Parser, v as traverse } from "./wxml-DdGdeqaH.mjs";
|
|
6
|
-
import { _ as isVueScopedStyleRequest, b as resolvePostcssRequestOption, g as isSourceStyleRequest, i as generateCssByGenerator, m as finalizeMiniProgramGeneratorCss } from "./hmr-timing-BXg7nI8N.mjs";
|
|
7
|
-
import { createRequire } from "node:module";
|
|
8
|
-
import path from "node:path";
|
|
9
|
-
import process from "node:process";
|
|
10
|
-
import { removeTailwindPostcssPlugins } from "@weapp-tailwindcss/postcss";
|
|
11
|
-
import { cleanUrl, ensurePosix } from "@weapp-tailwindcss/shared";
|
|
12
|
-
import { Buffer } from "node:buffer";
|
|
13
|
-
import { weappStyleInjector } from "weapp-style-injector/vite";
|
|
14
|
-
import { StyleInjector } from "weapp-style-injector/vite/taro";
|
|
15
|
-
import { StyleInjector as StyleInjector$1 } from "weapp-style-injector/vite/uni-app";
|
|
16
|
-
import { weappStyleInjectorWebpack } from "weapp-style-injector/webpack";
|
|
17
|
-
import { StyleInjector as StyleInjector$2 } from "weapp-style-injector/webpack/mpx";
|
|
18
|
-
import { StyleInjector as StyleInjector$3 } from "weapp-style-injector/webpack/taro";
|
|
19
|
-
import { StyleInjector as StyleInjector$4 } from "weapp-style-injector/webpack/uni-app";
|
|
20
|
-
//#region src/bundlers/framework-selector.ts
|
|
21
|
-
function resolveBundlerAppType(options) {
|
|
22
|
-
if (options.appType) return options.appType;
|
|
23
|
-
return detectAppType({
|
|
24
|
-
cwd: options.cwd,
|
|
25
|
-
detectEnv: options.detectEnv,
|
|
26
|
-
env: options.env,
|
|
27
|
-
manifest: options.manifest,
|
|
28
|
-
packageJson: options.packageJson,
|
|
29
|
-
root: options.root,
|
|
30
|
-
searchUp: options.searchUp
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
function isUniAppXFramework(appType, uniAppX) {
|
|
34
|
-
return appType === "uni-app-x" || resolveUniAppXOptions(uniAppX).enabled;
|
|
35
|
-
}
|
|
36
|
-
function resolveViteFrameworkProfile(options) {
|
|
37
|
-
const appType = resolveBundlerAppType(options);
|
|
38
|
-
if (isUniAppXFramework(appType, options.uniAppX)) return {
|
|
39
|
-
appType,
|
|
40
|
-
frameworkName: "uni-app-x"
|
|
41
|
-
};
|
|
42
|
-
if (appType === "uni-app" || appType === "uni-app-vite") return {
|
|
43
|
-
appType,
|
|
44
|
-
frameworkName: "uni-app"
|
|
45
|
-
};
|
|
46
|
-
if (appType === "taro") return {
|
|
47
|
-
appType,
|
|
48
|
-
frameworkName: "taro"
|
|
49
|
-
};
|
|
50
|
-
if (appType === "weapp-vite") return {
|
|
51
|
-
appType,
|
|
52
|
-
frameworkName: "weapp-vite"
|
|
53
|
-
};
|
|
54
|
-
return {
|
|
55
|
-
appType,
|
|
56
|
-
frameworkName: "generic"
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
function resolveWebpackFrameworkProfile(options) {
|
|
60
|
-
const appType = resolveBundlerAppType(options);
|
|
61
|
-
if (appType === "mpx") return {
|
|
62
|
-
appType,
|
|
63
|
-
frameworkName: "mpx"
|
|
64
|
-
};
|
|
65
|
-
if (appType === "taro") return {
|
|
66
|
-
appType,
|
|
67
|
-
frameworkName: "taro"
|
|
68
|
-
};
|
|
69
|
-
if (appType === "uni-app" || appType === "uni-app-vite" || isUniAppXFramework(appType, options.uniAppX)) return {
|
|
70
|
-
appType,
|
|
71
|
-
frameworkName: "uni-app"
|
|
72
|
-
};
|
|
73
|
-
if (appType === "weapp-vite") return {
|
|
74
|
-
appType,
|
|
75
|
-
frameworkName: "weapp-vite"
|
|
76
|
-
};
|
|
77
|
-
return {
|
|
78
|
-
appType,
|
|
79
|
-
frameworkName: "generic"
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
//#endregion
|
|
83
|
-
//#region src/style-injector/options.ts
|
|
84
|
-
function normalizeStyleInjectorOptions(options) {
|
|
85
|
-
if (options === true) return {};
|
|
86
|
-
if (!options) return;
|
|
87
|
-
return options;
|
|
88
|
-
}
|
|
89
|
-
//#endregion
|
|
90
|
-
//#region src/style-injector/internal.ts
|
|
91
|
-
function toPluginArray(pluginOrPlugins) {
|
|
92
|
-
return Array.isArray(pluginOrPlugins) ? pluginOrPlugins : [pluginOrPlugins];
|
|
93
|
-
}
|
|
94
|
-
function normalizeWebpackStyleInjectorOptions(options) {
|
|
95
|
-
const normalized = normalizeStyleInjectorOptions(options);
|
|
96
|
-
if (!normalized) return;
|
|
97
|
-
const { generateSubpackageStyle, loadSubpackageTargetStyle, ...rest } = normalized;
|
|
98
|
-
const webpackOptions = { ...rest };
|
|
99
|
-
if (generateSubpackageStyle) webpackOptions.generateSubpackageStyle = (context) => {
|
|
100
|
-
const generated = generateSubpackageStyle(context);
|
|
101
|
-
if (generated && typeof generated.then === "function") throw new TypeError("[weapp-style-injector] Webpack subpackage style generators must return synchronously.");
|
|
102
|
-
return generated;
|
|
103
|
-
};
|
|
104
|
-
if (loadSubpackageTargetStyle) webpackOptions.loadSubpackageTargetStyle = (fileName, sourceAbsolutePath) => {
|
|
105
|
-
const loaded = loadSubpackageTargetStyle(fileName, sourceAbsolutePath);
|
|
106
|
-
if (loaded && typeof loaded.then === "function") throw new TypeError("[weapp-style-injector] Webpack subpackage target style loaders must return synchronously.");
|
|
107
|
-
return loaded;
|
|
108
|
-
};
|
|
109
|
-
return webpackOptions;
|
|
110
|
-
}
|
|
111
|
-
function getTransformHandler(hook) {
|
|
112
|
-
if (typeof hook === "function") return hook;
|
|
113
|
-
if (hook && typeof hook === "object" && typeof hook.handler === "function") return hook.handler;
|
|
114
|
-
}
|
|
115
|
-
function getGenerateBundleHandler(hook) {
|
|
116
|
-
if (typeof hook === "function") return hook;
|
|
117
|
-
if (hook && typeof hook === "object" && typeof hook.handler === "function") return hook.handler;
|
|
118
|
-
}
|
|
119
|
-
const viteStyleInjectorDelegates = {
|
|
120
|
-
generic: ((options) => [weappStyleInjector(options)]),
|
|
121
|
-
taro: ((options) => toPluginArray(StyleInjector(options))),
|
|
122
|
-
uniApp: ((options) => toPluginArray(StyleInjector$1(options)))
|
|
123
|
-
};
|
|
124
|
-
const webpackStyleInjectorDelegates = {
|
|
125
|
-
generic: ((options) => weappStyleInjectorWebpack(options)),
|
|
126
|
-
mpx: ((options) => StyleInjector$2(options)),
|
|
127
|
-
taro: ((options) => StyleInjector$3(options)),
|
|
128
|
-
uniApp: ((options) => StyleInjector$4(options))
|
|
129
|
-
};
|
|
130
|
-
function createBuiltinViteStyleInjectorPlugins(options, getDelegateFactory) {
|
|
131
|
-
const normalized = normalizeStyleInjectorOptions(options);
|
|
132
|
-
if (!normalized) return [];
|
|
133
|
-
let config;
|
|
134
|
-
let delegates;
|
|
135
|
-
let delegatesConfigured = false;
|
|
136
|
-
let delegatesBuildStarted = false;
|
|
137
|
-
const resolveDelegates = () => {
|
|
138
|
-
if (delegates) return delegates;
|
|
139
|
-
delegates = getDelegateFactory()(normalized);
|
|
140
|
-
return delegates;
|
|
141
|
-
};
|
|
142
|
-
const configureDelegates = async () => {
|
|
143
|
-
if (delegatesConfigured || !config) return;
|
|
144
|
-
delegatesConfigured = true;
|
|
145
|
-
for (const plugin of resolveDelegates()) if (typeof plugin.configResolved === "function") await plugin.configResolved(config);
|
|
146
|
-
};
|
|
147
|
-
const startDelegates = async (context) => {
|
|
148
|
-
if (delegatesBuildStarted) return;
|
|
149
|
-
await configureDelegates();
|
|
150
|
-
delegatesBuildStarted = true;
|
|
151
|
-
for (const plugin of resolveDelegates()) if (typeof plugin.buildStart === "function") await plugin.buildStart.call(context, {});
|
|
152
|
-
};
|
|
153
|
-
return [{
|
|
154
|
-
name: "weapp-tailwindcss:style-injector-pre",
|
|
155
|
-
apply: "build",
|
|
156
|
-
enforce: "pre",
|
|
157
|
-
configResolved(resolvedConfig) {
|
|
158
|
-
config = resolvedConfig;
|
|
159
|
-
},
|
|
160
|
-
async buildStart() {
|
|
161
|
-
await startDelegates(this);
|
|
162
|
-
},
|
|
163
|
-
async load(id, options) {
|
|
164
|
-
await configureDelegates();
|
|
165
|
-
for (const plugin of resolveDelegates()) {
|
|
166
|
-
if (typeof plugin.load !== "function") continue;
|
|
167
|
-
const result = await plugin.load.call(this, id, options);
|
|
168
|
-
if (result != null) return result;
|
|
169
|
-
}
|
|
170
|
-
},
|
|
171
|
-
async transform(code, id, options) {
|
|
172
|
-
await configureDelegates();
|
|
173
|
-
let currentCode = code;
|
|
174
|
-
let changed = false;
|
|
175
|
-
for (const plugin of resolveDelegates()) {
|
|
176
|
-
const handler = getTransformHandler(plugin.transform);
|
|
177
|
-
if (!handler) continue;
|
|
178
|
-
const result = await handler.call(this, currentCode, id, options);
|
|
179
|
-
if (!result) continue;
|
|
180
|
-
if (typeof result === "string") {
|
|
181
|
-
currentCode = result;
|
|
182
|
-
changed = true;
|
|
183
|
-
} else if (typeof result === "object" && typeof result.code === "string") {
|
|
184
|
-
currentCode = result.code;
|
|
185
|
-
changed = true;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
if (changed) return {
|
|
189
|
-
code: currentCode,
|
|
190
|
-
map: null
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
}, {
|
|
194
|
-
name: "weapp-tailwindcss:style-injector",
|
|
195
|
-
apply: "build",
|
|
196
|
-
enforce: "post",
|
|
197
|
-
configResolved(resolvedConfig) {
|
|
198
|
-
config = resolvedConfig;
|
|
199
|
-
},
|
|
200
|
-
async generateBundle(outputOptions, bundle, isWrite) {
|
|
201
|
-
await configureDelegates();
|
|
202
|
-
for (const plugin of resolveDelegates()) {
|
|
203
|
-
const handler = getGenerateBundleHandler(plugin.generateBundle);
|
|
204
|
-
if (!handler) continue;
|
|
205
|
-
await handler.call(this, outputOptions, bundle, isWrite);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
}];
|
|
209
|
-
}
|
|
210
|
-
function createBuiltinWebpackStyleInjectorPlugin(options, delegateFactory) {
|
|
211
|
-
const normalized = normalizeWebpackStyleInjectorOptions(options);
|
|
212
|
-
if (!normalized) return;
|
|
213
|
-
return delegateFactory(normalized);
|
|
214
|
-
}
|
|
215
|
-
//#endregion
|
|
216
|
-
//#region src/utils/disabled.ts
|
|
217
|
-
function resolvePluginDisabledState(disabled) {
|
|
218
|
-
if (disabled === true) return { plugin: true };
|
|
219
|
-
if (disabled === false || disabled == null) return { plugin: false };
|
|
220
|
-
return { plugin: disabled.plugin ?? false };
|
|
221
|
-
}
|
|
222
|
-
//#endregion
|
|
223
|
-
//#region src/utils/resolve-package.ts
|
|
224
|
-
const require = createRequire(import.meta.url);
|
|
225
|
-
function resolvePackageDir(name) {
|
|
226
|
-
const pkgPath = require.resolve(`${name}/package.json`);
|
|
227
|
-
return path.dirname(pkgPath);
|
|
228
|
-
}
|
|
229
|
-
//#endregion
|
|
230
|
-
//#region src/bundlers/shared/framework-postcss.ts
|
|
231
|
-
const FRAMEWORK_POSTCSS_REGISTRY = Symbol.for("weapp-tailwindcss.framework-postcss-options");
|
|
232
|
-
const registryHost = globalThis;
|
|
233
|
-
const frameworkPostcssOptions = registryHost[FRAMEWORK_POSTCSS_REGISTRY] ?? (registryHost[FRAMEWORK_POSTCSS_REGISTRY] = /* @__PURE__ */ new WeakMap());
|
|
234
|
-
function isObject(value) {
|
|
235
|
-
return typeof value === "object" && value !== null;
|
|
236
|
-
}
|
|
237
|
-
function normalizePlugins(plugins) {
|
|
238
|
-
const entries = Array.isArray(plugins) ? plugins : isObject(plugins) ? Object.values(plugins) : [];
|
|
239
|
-
const resolved = [...new Set(entries.filter(Boolean))];
|
|
240
|
-
removeTailwindPostcssPlugins(resolved);
|
|
241
|
-
return resolved;
|
|
242
|
-
}
|
|
243
|
-
function resolveFrameworkPostcssOptions(value) {
|
|
244
|
-
if (!isObject(value)) return;
|
|
245
|
-
const plugins = normalizePlugins(value["plugins"]);
|
|
246
|
-
const options = Object.fromEntries(Object.entries(value).filter(([key]) => key !== "plugins" && key !== "config"));
|
|
247
|
-
if (plugins.length === 0 && Object.keys(options).length === 0) return;
|
|
248
|
-
return {
|
|
249
|
-
plugins,
|
|
250
|
-
options
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
function mergeFrameworkPostcssOptions(left, right) {
|
|
254
|
-
if (!left) return right;
|
|
255
|
-
if (!right) return left;
|
|
256
|
-
return {
|
|
257
|
-
plugins: [.../* @__PURE__ */ new Set([...normalizePlugins(left.plugins), ...normalizePlugins(right.plugins)])],
|
|
258
|
-
options: {
|
|
259
|
-
...left.options ?? {},
|
|
260
|
-
...right.options ?? {}
|
|
261
|
-
}
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
function collectFrameworkPostcssOptionsFromLoaderEntries(entries, loaderContext) {
|
|
265
|
-
let resolved;
|
|
266
|
-
const visit = (value) => {
|
|
267
|
-
if (Array.isArray(value)) {
|
|
268
|
-
value.forEach(visit);
|
|
269
|
-
return;
|
|
270
|
-
}
|
|
271
|
-
if (!isObject(value)) return;
|
|
272
|
-
const loader = value["loader"];
|
|
273
|
-
if (typeof loader === "string" && loader.includes("postcss-loader")) {
|
|
274
|
-
const loaderOptions = value["options"];
|
|
275
|
-
const rawOptions = isObject(loaderOptions) ? loaderOptions["postcssOptions"] : void 0;
|
|
276
|
-
const options = typeof rawOptions === "function" ? rawOptions(loaderContext) : rawOptions;
|
|
277
|
-
resolved = mergeFrameworkPostcssOptions(resolved, resolveFrameworkPostcssOptions(options));
|
|
278
|
-
return;
|
|
279
|
-
}
|
|
280
|
-
visit(value["rules"]);
|
|
281
|
-
visit(value["oneOf"]);
|
|
282
|
-
visit(value["use"]);
|
|
283
|
-
};
|
|
284
|
-
entries.forEach(visit);
|
|
285
|
-
return resolved;
|
|
286
|
-
}
|
|
287
|
-
function captureFrameworkPostcssOptions(owner, options) {
|
|
288
|
-
const resolved = resolveFrameworkPostcssOptions(options);
|
|
289
|
-
if (!resolved) {
|
|
290
|
-
frameworkPostcssOptions.delete(owner);
|
|
291
|
-
return;
|
|
292
|
-
}
|
|
293
|
-
frameworkPostcssOptions.set(owner, resolved);
|
|
294
|
-
return resolved;
|
|
295
|
-
}
|
|
296
|
-
function captureResolvedFrameworkPostcssOptions(owner, options) {
|
|
297
|
-
if (!options) {
|
|
298
|
-
frameworkPostcssOptions.delete(owner);
|
|
299
|
-
return;
|
|
300
|
-
}
|
|
301
|
-
frameworkPostcssOptions.set(owner, options);
|
|
302
|
-
return options;
|
|
303
|
-
}
|
|
304
|
-
function hasFrameworkPostcssOptions(owner) {
|
|
305
|
-
return frameworkPostcssOptions.has(owner);
|
|
306
|
-
}
|
|
307
|
-
function createGeneratedCssHandlerOptions(owner, options, from) {
|
|
308
|
-
const frameworkOptions = frameworkPostcssOptions.get(owner);
|
|
309
|
-
const merged = mergeFrameworkPostcssOptions(options.postcssOptions, frameworkOptions);
|
|
310
|
-
return {
|
|
311
|
-
...options,
|
|
312
|
-
postcssOptions: {
|
|
313
|
-
...merged ?? {},
|
|
314
|
-
options: {
|
|
315
|
-
...merged?.options ?? {},
|
|
316
|
-
from
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
};
|
|
320
|
-
}
|
|
321
|
-
async function adaptGeneratedCssWithFrameworkPipeline(owner, generated, options) {
|
|
322
|
-
const handled = await options.styleHandler(generated.css, createGeneratedCssHandlerOptions(owner, options.cssHandlerOptions, options.file));
|
|
323
|
-
const preflightMode = generated.metadata?.preflightMode;
|
|
324
|
-
const injectPreflight = preflightMode?.inject ?? options.cssHandlerOptions.isMainChunk;
|
|
325
|
-
const preservePreflight = preflightMode?.preserve ?? options.cssHandlerOptions.isMainChunk;
|
|
326
|
-
return finalizeMiniProgramGeneratorCss(handled.css, generated.target, options.majorVersion, owner.cssPreflight, {
|
|
327
|
-
...injectPreflight === void 0 ? {} : { injectPreflight },
|
|
328
|
-
...preservePreflight === void 0 ? {} : { preservePreflight },
|
|
329
|
-
styleOptions: options.cssHandlerOptions
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
|
-
//#endregion
|
|
333
|
-
//#region src/bundlers/shared/module-graph.ts
|
|
334
|
-
const QUERY_HASH_RE = /[?#].*$/u;
|
|
335
|
-
const PROTOCOL_RE = /^[a-z][a-z+.-]*:/iu;
|
|
336
|
-
const WINDOWS_ABSOLUTE_RE = /^[a-z]:[\\/]/iu;
|
|
337
|
-
const VIRTUAL_PREFIX = "\0";
|
|
338
|
-
const JS_EXTENSIONS = [
|
|
339
|
-
".js",
|
|
340
|
-
".mjs",
|
|
341
|
-
".cjs"
|
|
342
|
-
];
|
|
343
|
-
function normalizeOutputPathKey(value) {
|
|
344
|
-
return path.normalize(value).replace(/\\/g, "/");
|
|
345
|
-
}
|
|
346
|
-
function stripQueryAndHash(specifier) {
|
|
347
|
-
return specifier.replace(QUERY_HASH_RE, "");
|
|
348
|
-
}
|
|
349
|
-
function isResolvableSpecifier(specifier) {
|
|
350
|
-
if (!specifier) return false;
|
|
351
|
-
const normalized = stripQueryAndHash(specifier);
|
|
352
|
-
if (normalized.startsWith(VIRTUAL_PREFIX)) return false;
|
|
353
|
-
if (path.isAbsolute(normalized) || WINDOWS_ABSOLUTE_RE.test(normalized)) return true;
|
|
354
|
-
return !PROTOCOL_RE.test(normalized);
|
|
355
|
-
}
|
|
356
|
-
function toAbsoluteOutputPath(fileName, outDir) {
|
|
357
|
-
if (path.isAbsolute(fileName) || WINDOWS_ABSOLUTE_RE.test(fileName)) return path.normalize(fileName);
|
|
358
|
-
return path.resolve(outDir, fileName);
|
|
359
|
-
}
|
|
360
|
-
function matchWithExtensions(candidate, hasOutput) {
|
|
361
|
-
if (hasOutput(candidate)) return candidate;
|
|
362
|
-
if (!path.extname(candidate)) for (const ext of JS_EXTENSIONS) {
|
|
363
|
-
const extended = `${candidate}${ext}`;
|
|
364
|
-
if (hasOutput(extended)) return extended;
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
function resolveOutputSpecifier(specifier, importer, outDir, hasOutput) {
|
|
368
|
-
if (!isResolvableSpecifier(specifier)) return;
|
|
369
|
-
const normalized = stripQueryAndHash(specifier);
|
|
370
|
-
let candidate;
|
|
371
|
-
if (path.isAbsolute(normalized) || WINDOWS_ABSOLUTE_RE.test(normalized)) candidate = path.normalize(normalized);
|
|
372
|
-
else if (normalized.startsWith("/")) candidate = path.resolve(outDir, normalized.slice(1));
|
|
373
|
-
else candidate = path.resolve(path.dirname(importer), normalized);
|
|
374
|
-
return matchWithExtensions(candidate, hasOutput);
|
|
375
|
-
}
|
|
376
|
-
//#endregion
|
|
377
|
-
//#region src/bundlers/shared/v4-generation-core.ts
|
|
378
|
-
async function generateTailwindV4Css(options) {
|
|
379
|
-
const majorVersion = options.runtimeState.tailwindRuntime.majorVersion;
|
|
380
|
-
if (majorVersion !== 4) throw new Error("weapp-tailwindcss 生成管线仅支持 Tailwind CSS v4。");
|
|
381
|
-
const frameworkPostcssOwner = options.frameworkPostcssOwner ?? options.opts;
|
|
382
|
-
const shouldReplayFrameworkPostcss = options.frameworkPostcssStage === "complete" && hasFrameworkPostcssOptions(frameworkPostcssOwner) && normalizeWeappTailwindcssGeneratorOptions(options.opts.generator, {
|
|
383
|
-
appType: options.opts.appType,
|
|
384
|
-
platform: options.generatorPlatform ?? options.opts.cssOptions?.platform ?? options.opts.platform,
|
|
385
|
-
tailwindcssMajorVersion: majorVersion,
|
|
386
|
-
uniAppX: options.opts.uniAppX
|
|
387
|
-
}).target === "weapp";
|
|
388
|
-
const generated = await generateCssByGenerator(shouldReplayFrameworkPostcss ? {
|
|
389
|
-
...options,
|
|
390
|
-
deferCssAdaptation: true
|
|
391
|
-
} : options);
|
|
392
|
-
if (!generated) return;
|
|
393
|
-
const adaptedCss = shouldReplayFrameworkPostcss ? await adaptGeneratedCssWithFrameworkPipeline(frameworkPostcssOwner, generated, {
|
|
394
|
-
cssHandlerOptions: options.cssHandlerOptions,
|
|
395
|
-
file: options.file,
|
|
396
|
-
majorVersion,
|
|
397
|
-
styleHandler: options.styleHandler
|
|
398
|
-
}) : generated.css;
|
|
399
|
-
const css = isVueScopedStyleRequest(resolvePostcssRequestOption(options.cssHandlerOptions)) ? preferScopedGeneratedCssRules(adaptedCss) : adaptedCss;
|
|
400
|
-
return {
|
|
401
|
-
...generated,
|
|
402
|
-
css,
|
|
403
|
-
classSet: generated.classSet,
|
|
404
|
-
dependencies: generated.dependencies,
|
|
405
|
-
metadata: {
|
|
406
|
-
file: options.file,
|
|
407
|
-
majorVersion,
|
|
408
|
-
outputFile: options.outputFile,
|
|
409
|
-
...generated.metadata ?? {}
|
|
410
|
-
}
|
|
411
|
-
};
|
|
412
|
-
}
|
|
413
|
-
//#endregion
|
|
414
|
-
//#region src/bundlers/vite/bundle-entries.ts
|
|
415
|
-
function readOutputEntry(entry) {
|
|
416
|
-
if (entry.output.type === "chunk") return entry.output.code;
|
|
417
|
-
const source = entry.output.source;
|
|
418
|
-
if (typeof source === "string") return source;
|
|
419
|
-
if (source instanceof Uint8Array) return Buffer.from(source).toString();
|
|
420
|
-
const fallbackSource = source;
|
|
421
|
-
if (fallbackSource == null) return;
|
|
422
|
-
if (typeof fallbackSource.toString === "function") return fallbackSource.toString();
|
|
423
|
-
}
|
|
424
|
-
function isJavaScriptEntry(entry) {
|
|
425
|
-
if (entry.output.type === "chunk") return true;
|
|
426
|
-
return entry.fileName.endsWith(".js");
|
|
427
|
-
}
|
|
428
|
-
function createBundleModuleGraphOptions(outputDir, entries) {
|
|
429
|
-
const normalizedEntries = /* @__PURE__ */ new Map();
|
|
430
|
-
for (const [id, entry] of entries) normalizedEntries.set(normalizeOutputPathKey(id), entry);
|
|
431
|
-
const getEntry = (id) => entries.get(id) ?? normalizedEntries.get(normalizeOutputPathKey(id));
|
|
432
|
-
return {
|
|
433
|
-
resolve(specifier, importer) {
|
|
434
|
-
return resolveOutputSpecifier(specifier, importer, outputDir, (candidate) => Boolean(getEntry(candidate)));
|
|
435
|
-
},
|
|
436
|
-
load(id) {
|
|
437
|
-
const entry = getEntry(id);
|
|
438
|
-
if (!entry) return;
|
|
439
|
-
return readOutputEntry(entry);
|
|
440
|
-
},
|
|
441
|
-
filter(id) {
|
|
442
|
-
return Boolean(getEntry(id));
|
|
443
|
-
}
|
|
444
|
-
};
|
|
445
|
-
}
|
|
446
|
-
function applyLinkedResults(linked, entries, onLinkedUpdate, onApplied) {
|
|
447
|
-
if (!linked) return;
|
|
448
|
-
const normalizedEntries = /* @__PURE__ */ new Map();
|
|
449
|
-
for (const [entryId, entry] of entries) normalizedEntries.set(normalizeOutputPathKey(entryId), entry);
|
|
450
|
-
for (const [id, { code }] of Object.entries(linked)) {
|
|
451
|
-
const entry = entries.get(id) ?? normalizedEntries.get(normalizeOutputPathKey(id));
|
|
452
|
-
if (!entry) continue;
|
|
453
|
-
const previous = readOutputEntry(entry);
|
|
454
|
-
if (previous == null || previous === code) continue;
|
|
455
|
-
if (entry.output.type === "chunk") entry.output.code = code;
|
|
456
|
-
else entry.output.source = code;
|
|
457
|
-
onApplied?.(entry, code);
|
|
458
|
-
onLinkedUpdate(entry.fileName, previous, code);
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
//#endregion
|
|
462
|
-
//#region src/bundlers/vite/runtime-affecting-signature.ts
|
|
463
|
-
const CSS_BLOCK_COMMENT_RE = /\/\*[\s\S]*?\*\//g;
|
|
464
|
-
const CSS_AROUND_PUNCTUATION_RE = /\s*([{}:;,>+~()])\s*/g;
|
|
465
|
-
const CSS_TRAILING_DECLARATION_SEMICOLON_RE = /;\}/g;
|
|
466
|
-
const CSS_WHITESPACE_RE = /\s+/g;
|
|
467
|
-
const JS_RUNTIME_AFFECTING_TEXT_HINT_RE = /["'`/]/;
|
|
468
|
-
const JS_INCOMPLETE_TRAILING_OPERATOR_RE = /(?:=>|[=+\-*%&|^!~?:,.({[\]])\s*$/;
|
|
469
|
-
function createHtmlRuntimeAffectingSignature(source) {
|
|
470
|
-
try {
|
|
471
|
-
const parts = [];
|
|
472
|
-
const parser = new Parser({
|
|
473
|
-
onattribute(name, value) {
|
|
474
|
-
parts.push(`a:${name}=${value}`);
|
|
475
|
-
},
|
|
476
|
-
oncomment(data) {
|
|
477
|
-
parts.push(`c:${data}`);
|
|
478
|
-
},
|
|
479
|
-
ontext(data) {
|
|
480
|
-
const value = data.trim();
|
|
481
|
-
if (value.length > 0) parts.push(`t:${value}`);
|
|
482
|
-
}
|
|
483
|
-
}, { xmlMode: true });
|
|
484
|
-
parser.write(source);
|
|
485
|
-
parser.end();
|
|
486
|
-
return parts.join("\n");
|
|
487
|
-
} catch {
|
|
488
|
-
return source;
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
function createJsRuntimeAffectingSignature(source) {
|
|
492
|
-
if (!JS_RUNTIME_AFFECTING_TEXT_HINT_RE.test(source) && !JS_INCOMPLETE_TRAILING_OPERATOR_RE.test(source)) return "";
|
|
493
|
-
try {
|
|
494
|
-
const ast = babelParse(source, {
|
|
495
|
-
cache: false,
|
|
496
|
-
cacheKey: "vite-runtime-affecting:unambiguous",
|
|
497
|
-
plugins: ["jsx", "typescript"],
|
|
498
|
-
sourceType: "unambiguous"
|
|
499
|
-
});
|
|
500
|
-
const parts = [];
|
|
501
|
-
traverse(ast, {
|
|
502
|
-
noScope: true,
|
|
503
|
-
StringLiteral(path) {
|
|
504
|
-
parts.push(`s:${path.node.value}`);
|
|
505
|
-
},
|
|
506
|
-
TemplateElement(path) {
|
|
507
|
-
parts.push(`t:${path.node.value.raw}`);
|
|
508
|
-
},
|
|
509
|
-
JSXText(path) {
|
|
510
|
-
const value = path.node.value.trim();
|
|
511
|
-
if (value.length > 0) parts.push(`x:${value}`);
|
|
512
|
-
}
|
|
513
|
-
});
|
|
514
|
-
const comments = ast.comments;
|
|
515
|
-
if (Array.isArray(comments)) {
|
|
516
|
-
for (const comment of comments) if (typeof comment?.value === "string" && comment.value.length > 0) parts.push(`c:${comment.value}`);
|
|
517
|
-
}
|
|
518
|
-
return parts.join("\n");
|
|
519
|
-
} catch {
|
|
520
|
-
return source;
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
function createCssRuntimeAffectingSignature(source) {
|
|
524
|
-
return source.replace(CSS_BLOCK_COMMENT_RE, "").replace(CSS_AROUND_PUNCTUATION_RE, "$1").replace(CSS_TRAILING_DECLARATION_SEMICOLON_RE, "}").replace(CSS_WHITESPACE_RE, " ").trim();
|
|
525
|
-
}
|
|
526
|
-
function createRuntimeAffectingSourceSignature(source, type) {
|
|
527
|
-
if (type === "html") return createHtmlRuntimeAffectingSignature(source);
|
|
528
|
-
if (type === "js") return createJsRuntimeAffectingSignature(source);
|
|
529
|
-
if (type === "css") return createCssRuntimeAffectingSignature(source);
|
|
530
|
-
return source;
|
|
531
|
-
}
|
|
532
|
-
//#endregion
|
|
533
|
-
//#region src/bundlers/vite/utils.ts
|
|
534
|
-
function slash(p) {
|
|
535
|
-
return ensurePosix(p);
|
|
536
|
-
}
|
|
537
|
-
const isWindows = process.platform === "win32";
|
|
538
|
-
const cssLangRE = new RegExp(`\\.(?:css|less|sass|scss|styl|stylus|pcss|postcss)(?:$|\\?)`);
|
|
539
|
-
const htmlLangRE = /\.html?(?:$|\?)/;
|
|
540
|
-
function isCSSRequest(request) {
|
|
541
|
-
return cssLangRE.test(request) || isSourceStyleRequest(request);
|
|
542
|
-
}
|
|
543
|
-
function isHTMLRequest(request) {
|
|
544
|
-
return htmlLangRE.test(request);
|
|
545
|
-
}
|
|
546
|
-
function normalizePath(id) {
|
|
547
|
-
return path.posix.normalize(isWindows ? ensurePosix(id) : id);
|
|
548
|
-
}
|
|
549
|
-
async function formatPostcssSourceMap(rawMap, file) {
|
|
550
|
-
const inputFileDir = path.dirname(file);
|
|
551
|
-
const sources = rawMap.sources.map((source) => {
|
|
552
|
-
const cleanSource = cleanUrl(decodeURIComponent(source));
|
|
553
|
-
if (cleanSource[0] === "<" && cleanSource.endsWith(">")) return `\0${cleanSource}`;
|
|
554
|
-
return normalizePath(path.resolve(inputFileDir, cleanSource));
|
|
555
|
-
});
|
|
556
|
-
return {
|
|
557
|
-
file,
|
|
558
|
-
mappings: rawMap.mappings,
|
|
559
|
-
names: rawMap.names,
|
|
560
|
-
sources,
|
|
561
|
-
sourcesContent: rawMap.sourcesContent,
|
|
562
|
-
version: rawMap.version
|
|
563
|
-
};
|
|
564
|
-
}
|
|
565
|
-
//#endregion
|
|
566
|
-
//#region src/bundlers/vite/bundle-state.ts
|
|
567
|
-
function createBundleBuildState() {
|
|
568
|
-
return {
|
|
569
|
-
iteration: 0,
|
|
570
|
-
sourceHashByFile: /* @__PURE__ */ new Map(),
|
|
571
|
-
runtimeAffectingSignatureByFile: /* @__PURE__ */ new Map(),
|
|
572
|
-
runtimeAffectingHashByFile: /* @__PURE__ */ new Map(),
|
|
573
|
-
linkedByEntry: /* @__PURE__ */ new Map(),
|
|
574
|
-
dependentsByLinkedFile: /* @__PURE__ */ new Map(),
|
|
575
|
-
bundleMarkupCandidatesByFile: /* @__PURE__ */ new Map(),
|
|
576
|
-
generatorCandidateSignature: void 0
|
|
577
|
-
};
|
|
578
|
-
}
|
|
579
|
-
function createChangedByType() {
|
|
580
|
-
return {
|
|
581
|
-
html: /* @__PURE__ */ new Set(),
|
|
582
|
-
js: /* @__PURE__ */ new Set(),
|
|
583
|
-
css: /* @__PURE__ */ new Set(),
|
|
584
|
-
other: /* @__PURE__ */ new Set()
|
|
585
|
-
};
|
|
586
|
-
}
|
|
587
|
-
function createProcessFiles() {
|
|
588
|
-
return {
|
|
589
|
-
html: /* @__PURE__ */ new Set(),
|
|
590
|
-
js: /* @__PURE__ */ new Set(),
|
|
591
|
-
css: /* @__PURE__ */ new Set()
|
|
592
|
-
};
|
|
593
|
-
}
|
|
594
|
-
function readEntrySource(output) {
|
|
595
|
-
if (output.type === "chunk") return output.code;
|
|
596
|
-
return typeof output.source === "string" ? output.source : Buffer.from(output.source).toString();
|
|
597
|
-
}
|
|
598
|
-
function classifyBundleEntry(file, opts) {
|
|
599
|
-
if (opts.htmlMatcher(file) || isHTMLRequest(file)) return "html";
|
|
600
|
-
if (opts.cssMatcher(file) || isCSSRequest(file)) return "css";
|
|
601
|
-
if (opts.jsMatcher(file) || opts.wxsMatcher(file)) return "js";
|
|
602
|
-
return "other";
|
|
603
|
-
}
|
|
604
|
-
function collectJsEntries(fileName, output, outDir, store) {
|
|
605
|
-
const entry = {
|
|
606
|
-
fileName,
|
|
607
|
-
output
|
|
608
|
-
};
|
|
609
|
-
if (!isJavaScriptEntry(entry)) return;
|
|
610
|
-
const absolute = toAbsoluteOutputPath(fileName, outDir);
|
|
611
|
-
store.set(absolute, entry);
|
|
612
|
-
}
|
|
613
|
-
function markProcessFile(type, file, processFiles) {
|
|
614
|
-
if (type === "html" || type === "js" || type === "css") processFiles[type].add(file);
|
|
615
|
-
}
|
|
616
|
-
function buildBundleSnapshot(bundle, opts, outDir, state, forceAll = false, options = {}) {
|
|
617
|
-
const sourceHashByFile = /* @__PURE__ */ new Map();
|
|
618
|
-
const runtimeAffectingSignatureByFile = /* @__PURE__ */ new Map();
|
|
619
|
-
const runtimeAffectingHashByFile = /* @__PURE__ */ new Map();
|
|
620
|
-
const changedByType = createChangedByType();
|
|
621
|
-
const runtimeAffectingChangedByType = createChangedByType();
|
|
622
|
-
const processFiles = createProcessFiles();
|
|
623
|
-
const linkedImpactsByEntry = /* @__PURE__ */ new Map();
|
|
624
|
-
const jsEntries = /* @__PURE__ */ new Map();
|
|
625
|
-
const entries = [];
|
|
626
|
-
const firstRun = state.iteration === 0 && state.sourceHashByFile.size === 0;
|
|
627
|
-
const hasOmittedKnownFiles = options.hasOmittedKnownFiles === true;
|
|
628
|
-
for (const [file, output] of Object.entries(bundle)) {
|
|
629
|
-
const type = classifyBundleEntry(file, opts);
|
|
630
|
-
const source = readEntrySource(output);
|
|
631
|
-
const hash = opts.cache.computeHash(source);
|
|
632
|
-
sourceHashByFile.set(file, hash);
|
|
633
|
-
const previousHash = state.sourceHashByFile.get(file);
|
|
634
|
-
const changed = previousHash == null || previousHash !== hash;
|
|
635
|
-
const previousRuntimeAffectingHash = state.runtimeAffectingHashByFile.get(file);
|
|
636
|
-
const runtimeAffectingHash = !changed && previousRuntimeAffectingHash != null ? previousRuntimeAffectingHash : (() => {
|
|
637
|
-
const runtimeAffectingSignature = createRuntimeAffectingSourceSignature(source, type);
|
|
638
|
-
runtimeAffectingSignatureByFile.set(file, runtimeAffectingSignature);
|
|
639
|
-
return opts.cache.computeHash(runtimeAffectingSignature);
|
|
640
|
-
})();
|
|
641
|
-
runtimeAffectingHashByFile.set(file, runtimeAffectingHash);
|
|
642
|
-
if (changed) changedByType[type].add(file);
|
|
643
|
-
if (previousRuntimeAffectingHash == null || previousRuntimeAffectingHash !== runtimeAffectingHash) runtimeAffectingChangedByType[type].add(file);
|
|
644
|
-
if (forceAll || firstRun) markProcessFile(type, file, processFiles);
|
|
645
|
-
else if (type === "html") processFiles.html.add(file);
|
|
646
|
-
else if (changed && (type === "js" || type === "css")) processFiles[type].add(file);
|
|
647
|
-
collectJsEntries(file, output, outDir, jsEntries);
|
|
648
|
-
entries.push({
|
|
649
|
-
file,
|
|
650
|
-
output,
|
|
651
|
-
source,
|
|
652
|
-
type
|
|
653
|
-
});
|
|
654
|
-
}
|
|
655
|
-
if (!forceAll && !firstRun) for (const changedFile of changedByType.js) {
|
|
656
|
-
const dependents = state.dependentsByLinkedFile.get(changedFile);
|
|
657
|
-
if (!dependents) continue;
|
|
658
|
-
for (const entryFile of dependents) {
|
|
659
|
-
processFiles.js.add(entryFile);
|
|
660
|
-
let impacts = linkedImpactsByEntry.get(entryFile);
|
|
661
|
-
if (!impacts) {
|
|
662
|
-
impacts = /* @__PURE__ */ new Set();
|
|
663
|
-
linkedImpactsByEntry.set(entryFile, impacts);
|
|
664
|
-
}
|
|
665
|
-
impacts.add(changedFile);
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
return {
|
|
669
|
-
entries,
|
|
670
|
-
jsEntries,
|
|
671
|
-
sourceHashByFile,
|
|
672
|
-
runtimeAffectingSignatureByFile,
|
|
673
|
-
runtimeAffectingHashByFile,
|
|
674
|
-
hasOmittedKnownFiles,
|
|
675
|
-
changedByType,
|
|
676
|
-
runtimeAffectingChangedByType,
|
|
677
|
-
processFiles,
|
|
678
|
-
linkedImpactsByEntry
|
|
679
|
-
};
|
|
680
|
-
}
|
|
681
|
-
function invertLinkedByEntry(linkedByEntry) {
|
|
682
|
-
const dependentsByLinkedFile = /* @__PURE__ */ new Map();
|
|
683
|
-
for (const [entryFile, linkedFiles] of linkedByEntry.entries()) for (const linkedFile of linkedFiles) {
|
|
684
|
-
let dependents = dependentsByLinkedFile.get(linkedFile);
|
|
685
|
-
if (!dependents) {
|
|
686
|
-
dependents = /* @__PURE__ */ new Set();
|
|
687
|
-
dependentsByLinkedFile.set(linkedFile, dependents);
|
|
688
|
-
}
|
|
689
|
-
dependents.add(entryFile);
|
|
690
|
-
}
|
|
691
|
-
return dependentsByLinkedFile;
|
|
692
|
-
}
|
|
693
|
-
function replaceMapEntries(target, source) {
|
|
694
|
-
target.clear();
|
|
695
|
-
for (const [key, value] of source) target.set(key, value);
|
|
696
|
-
return target;
|
|
697
|
-
}
|
|
698
|
-
function mergeMapEntries(target, source) {
|
|
699
|
-
for (const [key, value] of source) target.set(key, value);
|
|
700
|
-
return target;
|
|
701
|
-
}
|
|
702
|
-
function updateBundleBuildState(state, snapshot, linkedByEntry, options = {}) {
|
|
703
|
-
const incremental = options.incremental === true;
|
|
704
|
-
state.iteration += 1;
|
|
705
|
-
state.sourceHashByFile = incremental ? mergeMapEntries(state.sourceHashByFile, snapshot.sourceHashByFile) : replaceMapEntries(state.sourceHashByFile, snapshot.sourceHashByFile);
|
|
706
|
-
state.runtimeAffectingSignatureByFile.clear();
|
|
707
|
-
state.runtimeAffectingHashByFile = incremental ? mergeMapEntries(state.runtimeAffectingHashByFile, snapshot.runtimeAffectingHashByFile) : replaceMapEntries(state.runtimeAffectingHashByFile, snapshot.runtimeAffectingHashByFile);
|
|
708
|
-
state.linkedByEntry = incremental ? mergeMapEntries(state.linkedByEntry, linkedByEntry) : replaceMapEntries(state.linkedByEntry, linkedByEntry);
|
|
709
|
-
state.dependentsByLinkedFile = invertLinkedByEntry(state.linkedByEntry);
|
|
710
|
-
}
|
|
711
|
-
//#endregion
|
|
712
|
-
//#region src/bundlers/vite/generate-bundle/signatures.ts
|
|
713
|
-
function summarizeStringDiff(previous, next) {
|
|
714
|
-
if (previous === next) return "same";
|
|
715
|
-
const previousLength = previous.length;
|
|
716
|
-
const nextLength = next.length;
|
|
717
|
-
const minLength = Math.min(previousLength, nextLength);
|
|
718
|
-
let prefixLength = 0;
|
|
719
|
-
while (prefixLength < minLength && previous.charCodeAt(prefixLength) === next.charCodeAt(prefixLength)) prefixLength += 1;
|
|
720
|
-
let previousSuffixCursor = previousLength - 1;
|
|
721
|
-
let nextSuffixCursor = nextLength - 1;
|
|
722
|
-
while (previousSuffixCursor >= prefixLength && nextSuffixCursor >= prefixLength && previous.charCodeAt(previousSuffixCursor) === next.charCodeAt(nextSuffixCursor)) {
|
|
723
|
-
previousSuffixCursor -= 1;
|
|
724
|
-
nextSuffixCursor -= 1;
|
|
725
|
-
}
|
|
726
|
-
const previousChangedLength = previousSuffixCursor >= prefixLength ? previousSuffixCursor - prefixLength + 1 : 0;
|
|
727
|
-
const nextChangedLength = nextSuffixCursor >= prefixLength ? nextSuffixCursor - prefixLength + 1 : 0;
|
|
728
|
-
return `changed@${prefixLength} old=${previousChangedLength} new=${nextChangedLength} len=${previousLength}->${nextLength}`;
|
|
729
|
-
}
|
|
730
|
-
function createLinkedImpactSignature(entry, linkedImpactsByEntry, sourceHashByFile) {
|
|
731
|
-
const changedLinkedFiles = linkedImpactsByEntry.get(entry);
|
|
732
|
-
if (!changedLinkedFiles || changedLinkedFiles.size === 0) return;
|
|
733
|
-
return [...changedLinkedFiles].sort().map((file) => {
|
|
734
|
-
return `${file}:${sourceHashByFile.get(file) ?? "missing"}`;
|
|
735
|
-
}).join(",");
|
|
736
|
-
}
|
|
737
|
-
function createJsHashSalt(runtimeSignature, linkedImpactSignature) {
|
|
738
|
-
if (!linkedImpactSignature) return runtimeSignature;
|
|
739
|
-
return `${runtimeSignature}:linked:${linkedImpactSignature}`;
|
|
740
|
-
}
|
|
741
|
-
function createStableTextSignature(input) {
|
|
742
|
-
let hash = 2166136261;
|
|
743
|
-
for (let i = 0; i < input.length; i++) {
|
|
744
|
-
hash ^= input.charCodeAt(i);
|
|
745
|
-
hash = Math.imul(hash, 16777619);
|
|
746
|
-
}
|
|
747
|
-
return (hash >>> 0).toString(36);
|
|
748
|
-
}
|
|
749
|
-
function createCandidateSignature(candidates) {
|
|
750
|
-
if (candidates.size === 0) return "empty";
|
|
751
|
-
return createStableTextSignature([...candidates].sort().join("\n"));
|
|
752
|
-
}
|
|
753
|
-
function getSnapshotHash(snapshotMap, file, fallback) {
|
|
754
|
-
return snapshotMap.get(file) ?? fallback;
|
|
755
|
-
}
|
|
756
|
-
function hasRuntimeAffectingSourceChanges(changedByType) {
|
|
757
|
-
return changedByType.html.size > 0 || changedByType.js.size > 0;
|
|
758
|
-
}
|
|
759
|
-
//#endregion
|
|
760
|
-
//#region src/bundlers/vite/generate-bundle/scoped-generator.ts
|
|
761
|
-
function hasOwnSourceDirectives(rawSource) {
|
|
762
|
-
return rawSource.includes("@source") || rawSource.includes("@config");
|
|
763
|
-
}
|
|
764
|
-
function createLocalSourceEntries(sourceFile) {
|
|
765
|
-
return [{
|
|
766
|
-
base: path.dirname(path.resolve(sourceFile.replace(/[?#].*$/, ""))),
|
|
767
|
-
negated: false,
|
|
768
|
-
pattern: "**/*"
|
|
769
|
-
}];
|
|
770
|
-
}
|
|
771
|
-
function intersectCandidates(first, second) {
|
|
772
|
-
if (first.size === 0 || second.size === 0) return /* @__PURE__ */ new Set();
|
|
773
|
-
const [small, large] = first.size <= second.size ? [first, second] : [second, first];
|
|
774
|
-
const scoped = /* @__PURE__ */ new Set();
|
|
775
|
-
for (const candidate of small) if (large.has(candidate)) scoped.add(candidate);
|
|
776
|
-
return scoped;
|
|
777
|
-
}
|
|
778
|
-
function mergeCandidates(first, second) {
|
|
779
|
-
return /* @__PURE__ */ new Set([...first, ...second]);
|
|
780
|
-
}
|
|
781
|
-
function canFallbackToOutputCandidates(rawSource, entries) {
|
|
782
|
-
return rawSource.includes("@source") && entries.length > 0 && entries.every((entry) => !entry.negated);
|
|
783
|
-
}
|
|
784
|
-
function resolveScopedSourceEntries(rawSource, sourceFile, resolvedEntries) {
|
|
785
|
-
if (!hasOwnSourceDirectives(rawSource)) return {
|
|
786
|
-
entries: resolvedEntries,
|
|
787
|
-
localEntries: void 0
|
|
788
|
-
};
|
|
789
|
-
if (resolvedEntries !== void 0) return { entries: resolvedEntries };
|
|
790
|
-
return { entries: createLocalSourceEntries(sourceFile) };
|
|
791
|
-
}
|
|
792
|
-
async function resolveScopedGeneratorSourceEntries(rawSource, sourceFile) {
|
|
793
|
-
return resolveScopedSourceEntries(rawSource, sourceFile, (await resolveTailwindV4EntriesFromCssCached(rawSource, path.dirname(path.resolve(sourceFile.replace(/[?#].*$/, "")))))?.entries);
|
|
794
|
-
}
|
|
795
|
-
async function createScopedGeneratorCandidateSignature(rawSource, sourceFile, fallbackSignature, getSourceCandidatesForEntries, options = {}) {
|
|
796
|
-
if (!getSourceCandidatesForEntries || !hasOwnSourceDirectives(rawSource)) return fallbackSignature;
|
|
797
|
-
const { entries } = await resolveScopedGeneratorSourceEntries(rawSource, sourceFile);
|
|
798
|
-
if (entries === void 0) return fallbackSignature;
|
|
799
|
-
const scopedSignature = createCandidateSignature(getSourceCandidatesForEntries(entries));
|
|
800
|
-
return options.includeFallbackSignature === true ? `${scopedSignature}:${fallbackSignature}` : scopedSignature;
|
|
801
|
-
}
|
|
802
|
-
async function createScopedGeneratorSourceTraceMap(rawSource, sourceFile, getSourceCandidateSourcesForEntries) {
|
|
803
|
-
if (!getSourceCandidateSourcesForEntries || !hasOwnSourceDirectives(rawSource)) return getSourceCandidateSourcesForEntries?.(void 0);
|
|
804
|
-
const { entries } = await resolveScopedGeneratorSourceEntries(rawSource, sourceFile);
|
|
805
|
-
if (entries === void 0) return getSourceCandidateSourcesForEntries(void 0);
|
|
806
|
-
return getSourceCandidateSourcesForEntries(entries);
|
|
807
|
-
}
|
|
808
|
-
async function createScopedGeneratorRuntime(options) {
|
|
809
|
-
const { cssHandlerOptions, fallbackRuntime, getSourceCandidatesForEntries, outputFile, rawSource, shouldExcludeSubpackageSourceCandidates, sourceFile, scopedSourceCandidateGetter } = options;
|
|
810
|
-
if (getSourceCandidatesForEntries && rawSource && sourceFile) {
|
|
811
|
-
const { entries } = await resolveScopedGeneratorSourceEntries(rawSource, sourceFile);
|
|
812
|
-
if (entries !== void 0 && (entries.length > 0 || hasOwnSourceDirectives(rawSource))) {
|
|
813
|
-
const explicitCandidates = getSourceCandidatesForEntries(entries);
|
|
814
|
-
const outputCandidates = scopedSourceCandidateGetter?.(void 0);
|
|
815
|
-
const scopedCandidates = outputCandidates ? explicitCandidates.size === 0 && canFallbackToOutputCandidates(rawSource, entries) ? outputCandidates : intersectCandidates(explicitCandidates, outputCandidates) : explicitCandidates;
|
|
816
|
-
return hasCssMacroTailwindV4CustomVariantConditionalComments(rawSource) ? mergeCandidates(scopedCandidates, fallbackRuntime) : scopedCandidates;
|
|
817
|
-
}
|
|
818
|
-
}
|
|
819
|
-
const scopedCandidates = scopedSourceCandidateGetter?.(void 0);
|
|
820
|
-
if (scopedCandidates && (scopedCandidates.size > 0 || shouldExcludeSubpackageSourceCandidates(outputFile, cssHandlerOptions))) return shouldExcludeSubpackageSourceCandidates(outputFile, cssHandlerOptions) ? scopedCandidates : mergeCandidates(scopedCandidates, fallbackRuntime);
|
|
821
|
-
if (!shouldExcludeSubpackageSourceCandidates(outputFile, cssHandlerOptions)) return fallbackRuntime;
|
|
822
|
-
return fallbackRuntime;
|
|
823
|
-
}
|
|
824
|
-
//#endregion
|
|
825
|
-
//#region src/bundlers/vite/source-candidate-scan-signature.ts
|
|
826
|
-
function normalizeSignaturePath(value) {
|
|
827
|
-
return slash(path.resolve(value));
|
|
828
|
-
}
|
|
829
|
-
function serializeInlineCandidates(inlineCandidates) {
|
|
830
|
-
return {
|
|
831
|
-
excluded: [...inlineCandidates?.excluded ?? []].sort(),
|
|
832
|
-
included: [...inlineCandidates?.included ?? []].sort()
|
|
833
|
-
};
|
|
834
|
-
}
|
|
835
|
-
function serializeSourceEntries(entries) {
|
|
836
|
-
return (entries ?? []).map((entry) => ({
|
|
837
|
-
base: normalizeSignaturePath(entry.base),
|
|
838
|
-
negated: entry.negated,
|
|
839
|
-
pattern: entry.pattern
|
|
840
|
-
})).sort((a, b) => `${a.base}\0${a.pattern}\0${a.negated}`.localeCompare(`${b.base}\0${b.pattern}\0${b.negated}`));
|
|
841
|
-
}
|
|
842
|
-
function createSourceCandidateScanSignature(input) {
|
|
843
|
-
return JSON.stringify({
|
|
844
|
-
inlineCandidates: serializeInlineCandidates(input.inlineCandidates),
|
|
845
|
-
outDir: input.outDir ? normalizeSignaturePath(input.outDir) : void 0,
|
|
846
|
-
roots: input.roots.map((root) => ({
|
|
847
|
-
entries: serializeSourceEntries(root.entries),
|
|
848
|
-
root: normalizeSignaturePath(root.root)
|
|
849
|
-
})),
|
|
850
|
-
scanAllSources: input.scanAllSources ?? false
|
|
851
|
-
});
|
|
852
|
-
}
|
|
853
|
-
//#endregion
|
|
854
|
-
export { collectFrameworkPostcssOptionsFromLoaderEntries as A, createBundleModuleGraphOptions as C, toAbsoluteOutputPath as D, resolveOutputSpecifier as E, viteStyleInjectorDelegates as F, webpackStyleInjectorDelegates as I, resolveViteFrameworkProfile as L, resolvePluginDisabledState as M, createBuiltinViteStyleInjectorPlugins as N, captureFrameworkPostcssOptions as O, createBuiltinWebpackStyleInjectorPlugin as P, resolveWebpackFrameworkProfile as R, applyLinkedResults as S, normalizeOutputPathKey as T, isCSSRequest as _, createCandidateSignature as a, slash as b, getSnapshotHash as c, buildBundleSnapshot as d, classifyBundleEntry as f, formatPostcssSourceMap as g, cleanUrl as h, createScopedGeneratorSourceTraceMap as i, resolvePackageDir as j, captureResolvedFrameworkPostcssOptions as k, hasRuntimeAffectingSourceChanges as l, updateBundleBuildState as m, createScopedGeneratorCandidateSignature as n, createJsHashSalt as o, createBundleBuildState as p, createScopedGeneratorRuntime as r, createLinkedImpactSignature as s, createSourceCandidateScanSignature as t, summarizeStringDiff as u, isHTMLRequest as v, generateTailwindV4Css as w, createRuntimeAffectingSourceSignature as x, normalizePath as y };
|