weapp-tailwindcss 4.12.0 → 5.0.0-next.2
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/babel/index.d.ts +3 -0
- package/dist/bundlers/gulp/index.d.ts +7 -0
- package/dist/bundlers/shared/cache.d.ts +16 -0
- package/dist/bundlers/shared/css-cleanup.d.ts +4 -0
- package/dist/bundlers/shared/css-imports.d.ts +8 -0
- package/dist/bundlers/shared/generator-candidates.d.ts +5 -0
- package/dist/bundlers/shared/generator-css.d.ts +43 -0
- package/dist/bundlers/shared/module-graph.d.ts +5 -0
- package/dist/bundlers/shared/run-tasks.d.ts +2 -0
- package/dist/bundlers/vite/bundle-entries.d.ts +14 -0
- package/dist/bundlers/vite/bundle-state.d.ts +43 -0
- package/dist/bundlers/vite/css-finalizer.d.ts +22 -0
- package/dist/bundlers/vite/generate-bundle.d.ts +33 -0
- package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +21 -0
- package/dist/bundlers/vite/index.d.ts +3 -0
- package/dist/bundlers/vite/js-precheck.d.ts +1 -0
- package/dist/bundlers/vite/query.d.ts +15 -0
- package/dist/bundlers/vite/resolve-app-type.d.ts +2 -0
- package/dist/bundlers/vite/rewrite-css-imports.d.ts +11 -0
- package/dist/bundlers/vite/runtime-affecting-signature.d.ts +2 -0
- package/dist/bundlers/vite/source-candidates.d.ts +15 -0
- package/dist/bundlers/vite/utils.d.ts +9 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +20 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-assets.d.ts +14 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-loaders.d.ts +15 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +9 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +17 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +19 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +9 -0
- package/dist/bundlers/webpack/index.d.ts +1 -0
- package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +12 -0
- package/dist/bundlers/webpack/loaders/weapp-tw-runtime-classset-loader.d.ts +11 -0
- package/dist/bundlers/webpack/shared/css-imports.d.ts +6 -0
- package/dist/bundlers/webpack/shared/loader-anchors.d.ts +8 -0
- package/dist/cache/index.d.ts +38 -0
- package/dist/cache/md5.d.ts +1 -0
- package/dist/chunk-8l464Juk.js +28 -0
- package/dist/cli/config.d.ts +5 -0
- package/dist/cli/context.d.ts +16 -0
- package/dist/cli/doctor/constants.d.ts +7 -0
- package/dist/cli/doctor/types.d.ts +31 -0
- package/dist/cli/doctor.d.ts +4 -0
- package/dist/cli/helpers/options/format.d.ts +2 -0
- package/dist/cli/helpers/options/parse.d.ts +3 -0
- package/dist/cli/helpers/options/resolve.d.ts +1 -0
- package/dist/cli/helpers/options.d.ts +3 -0
- package/dist/cli/helpers/patch-cwd.d.ts +1 -0
- package/dist/cli/helpers.d.ts +5 -0
- package/dist/cli/mount-options/patch-status.d.ts +2 -0
- package/dist/cli/mount-options.d.ts +2 -0
- package/dist/cli/patch-options.d.ts +6 -0
- package/dist/cli/tokens.d.ts +4 -0
- package/dist/cli/types.d.ts +17 -0
- package/dist/cli/vscode-entry.d.ts +14 -0
- package/dist/cli/workspace/package-dirs.d.ts +3 -0
- package/dist/cli/workspace/patch-package.d.ts +3 -0
- package/dist/cli/workspace/patch-utils.d.ts +3 -0
- package/dist/cli/workspace/types.d.ts +11 -0
- package/dist/cli/workspace/workspace-globs.d.ts +2 -0
- package/dist/cli/workspace/workspace-io.d.ts +1 -0
- package/dist/cli/workspace/workspace-lock.d.ts +1 -0
- package/dist/cli/workspace.d.ts +2 -0
- package/dist/cli.d.ts +1 -2
- package/dist/cli.js +2425 -3524
- package/dist/cli.mjs +2402 -3505
- package/dist/constants-B-_T5UnW.mjs +44 -0
- package/dist/constants-p1dyh1x1.js +73 -0
- package/dist/constants.d.ts +13 -0
- package/dist/context/compiler-context-cache.d.ts +3 -0
- package/dist/context/custom-attributes.d.ts +2 -0
- package/dist/context/handlers.d.ts +6 -0
- package/dist/context/index.d.ts +7 -0
- package/dist/context/logger.d.ts +4 -0
- package/dist/context/tailwindcss/basedir.d.ts +1 -0
- package/dist/context/tailwindcss/rax.d.ts +2 -0
- package/dist/context/tailwindcss.d.ts +4 -0
- package/dist/context/workspace.d.ts +3 -0
- package/dist/core.d.ts +5 -21
- package/dist/core.js +138 -180
- package/dist/core.mjs +135 -180
- package/dist/css-imports-BbrbluP9.js +177 -0
- package/dist/css-imports-CSdPq_Sc.mjs +128 -0
- package/dist/css-macro/constants.d.ts +14 -0
- package/dist/css-macro/index.d.ts +15 -0
- package/dist/css-macro/postcss.d.ts +3 -7
- package/dist/css-macro/postcss.js +44 -58
- package/dist/css-macro/postcss.mjs +44 -56
- package/dist/css-macro.d.ts +1 -20
- package/dist/css-macro.js +37 -50
- package/dist/css-macro.mjs +33 -47
- package/dist/debug/index.d.ts +5 -0
- package/dist/defaults.d.ts +2 -11
- package/dist/defaults.js +132 -8
- package/dist/defaults.mjs +128 -7
- package/dist/escape.js +31 -54
- package/dist/escape.mjs +18 -25
- package/dist/experimental/index.d.ts +2 -0
- package/dist/experimental/oxc/ast-utils.d.ts +30 -0
- package/dist/experimental/oxc/index.d.ts +2 -0
- package/dist/experimental/oxc/module-specifiers.d.ts +2 -0
- package/dist/experimental/shared/cache.d.ts +3 -0
- package/dist/experimental/shared/transform.d.ts +3 -0
- package/dist/experimental/shared.d.ts +8 -0
- package/dist/experimental/swc/ast-utils.d.ts +30 -0
- package/dist/experimental/swc/index.d.ts +2 -0
- package/dist/experimental/swc/module-specifiers.d.ts +2 -0
- package/dist/generator/index.d.ts +11 -0
- package/dist/generator/options.d.ts +17 -0
- package/dist/generator/types.d.ts +20 -0
- package/dist/generator-Y-Ikv4Fu.mjs +1177 -0
- package/dist/generator-css-B5ejWUMv.mjs +1098 -0
- package/dist/generator-css-D3OdPRiS.js +1125 -0
- package/dist/generator-mmhXzZnv.js +1276 -0
- package/dist/generator.d.ts +1 -0
- package/dist/generator.js +19 -0
- package/dist/generator.mjs +2 -0
- package/dist/gulp.d.ts +4 -24
- package/dist/gulp.js +271 -13
- package/dist/gulp.mjs +263 -13
- package/dist/index.d.ts +8 -15
- package/dist/index.js +12 -24
- package/dist/index.mjs +6 -24
- package/dist/js/JsTokenUpdater.d.ts +14 -0
- package/dist/js/ModuleGraph.d.ts +18 -0
- package/dist/js/NodePathWalker.d.ts +33 -0
- package/dist/js/babel/parse.d.ts +9 -0
- package/dist/js/babel/process.d.ts +4 -0
- package/dist/js/babel.d.ts +13 -0
- package/dist/js/class-context.d.ts +3 -0
- package/dist/js/evalTransforms.d.ts +7 -0
- package/dist/js/handlers.d.ts +5 -0
- package/dist/js/index.d.ts +4 -0
- package/dist/js/module-graph/ignored-exports.d.ts +18 -0
- package/dist/js/module-graph/types.d.ts +17 -0
- package/dist/js/node-path-walker/export-handlers.d.ts +12 -0
- package/dist/js/node-path-walker/import-tokens.d.ts +24 -0
- package/dist/js/precheck.d.ts +2 -0
- package/dist/js/sourceAnalysis.d.ts +17 -0
- package/dist/js/syntax.d.ts +10 -0
- package/dist/js/taggedTemplateIgnore.d.ts +13 -0
- package/dist/js/types.d.ts +11 -0
- package/dist/lightningcss/index.d.ts +8 -0
- package/dist/lightningcss/style-handler/options.d.ts +3 -0
- package/dist/lightningcss/style-handler/selector-transform.d.ts +10 -0
- package/dist/lightningcss/style-handler/selector-utils.d.ts +10 -0
- package/dist/lightningcss/style-handler.d.ts +17 -0
- package/dist/loader-anchors-CNkWT8hx.js +273 -0
- package/dist/loader-anchors-TrU7EUr7.mjs +205 -0
- package/dist/logger/index.d.ts +2 -0
- package/dist/logger-BZ45DZJT.js +1003 -0
- package/dist/logger-BoVx1Dbt.mjs +935 -0
- package/dist/patcher-options-6gJN2EXy.js +115 -0
- package/dist/patcher-options-DQfR5xxT.mjs +92 -0
- package/dist/postcss-html-transform.d.ts +3 -3
- package/dist/postcss-html-transform.js +7 -10
- package/dist/postcss-html-transform.mjs +3 -6
- package/dist/postcss.d.ts +15 -0
- package/dist/postcss.js +280 -0
- package/dist/postcss.mjs +270 -0
- package/dist/presets/hbuilderx.d.ts +4 -0
- package/dist/presets/index.d.ts +3 -0
- package/dist/presets/shared.d.ts +10 -0
- package/dist/presets/taro.d.ts +4 -0
- package/dist/presets/uni-app-x.d.ts +16 -0
- package/dist/presets/uni-app.d.ts +4 -0
- package/dist/presets.d.ts +1 -76
- package/dist/presets.js +115 -163
- package/dist/presets.mjs +107 -163
- package/dist/recorder-gYSNLfOP.js +2878 -0
- package/dist/recorder-zsgatmkB.mjs +2763 -0
- package/dist/reset/index.d.ts +2 -0
- package/dist/reset.d.ts +1 -4
- package/dist/reset.js +19 -8
- package/dist/reset.mjs +2 -8
- package/dist/shared/classname-transform.d.ts +14 -0
- package/dist/shared/mpx.d.ts +7 -0
- package/dist/shared/tailwindcss-css-redirect.d.ts +1 -0
- package/dist/tailwindcss/index.d.ts +11 -0
- package/dist/tailwindcss/miniprogram.d.ts +1 -0
- package/dist/tailwindcss/patcher-options.d.ts +56 -0
- package/dist/tailwindcss/patcher-resolve.d.ts +4 -0
- package/dist/tailwindcss/patcher.d.ts +13 -0
- package/dist/tailwindcss/recorder.d.ts +13 -0
- package/dist/tailwindcss/remove-unsupported-css.d.ts +2 -0
- package/dist/tailwindcss/runtime/cache.d.ts +11 -0
- package/dist/tailwindcss/runtime-logs.d.ts +3 -0
- package/dist/tailwindcss/runtime.d.ts +29 -0
- package/dist/tailwindcss/targets/paths.d.ts +13 -0
- package/dist/tailwindcss/targets/record-io.d.ts +5 -0
- package/dist/tailwindcss/targets/recorder.d.ts +3 -0
- package/dist/tailwindcss/targets/types.d.ts +35 -0
- package/dist/tailwindcss/targets.d.ts +6 -0
- package/dist/tailwindcss/v3-engine/generator.d.ts +2 -0
- package/dist/tailwindcss/v3-engine/index.d.ts +4 -0
- package/dist/tailwindcss/v3-engine/miniprogram.d.ts +4 -0
- package/dist/tailwindcss/v3-engine/source.d.ts +5 -0
- package/dist/tailwindcss/v3-engine/types.d.ts +55 -0
- package/dist/tailwindcss/v4/config.d.ts +5 -0
- package/dist/tailwindcss/v4/css-entries.d.ts +7 -0
- package/dist/tailwindcss/v4/index.d.ts +2 -0
- package/dist/tailwindcss/v4/multi-patcher.d.ts +2 -0
- package/dist/tailwindcss/v4/patcher-options.d.ts +24 -0
- package/dist/tailwindcss/v4/patcher.d.ts +14 -0
- package/dist/tailwindcss/v4-engine/candidates.d.ts +2 -0
- package/dist/tailwindcss/v4-engine/design-system.d.ts +1 -0
- package/dist/tailwindcss/v4-engine/generator.d.ts +2 -0
- package/dist/tailwindcss/v4-engine/index.d.ts +5 -0
- package/dist/tailwindcss/v4-engine/miniprogram.d.ts +5 -0
- package/dist/tailwindcss/v4-engine/source.d.ts +7 -0
- package/dist/tailwindcss/v4-engine/tailwind-v3-compatibility.d.ts +1 -0
- package/dist/tailwindcss/v4-engine/tailwind-v3-default-colors.d.ts +1 -0
- package/dist/tailwindcss/v4-engine/tailwind-v4-default-colors.d.ts +1 -0
- package/dist/tailwindcss/v4-engine/types.d.ts +19 -0
- package/dist/typedoc.export.d.ts +5 -0
- package/dist/types/base.d.ts +1 -0
- package/dist/types/disabled-options.d.ts +4 -0
- package/dist/types/index.d.ts +104 -0
- package/dist/types/shared.d.ts +7 -0
- package/dist/types/user-defined-options/general.d.ts +31 -0
- package/dist/types/user-defined-options/important.d.ts +37 -0
- package/dist/types/user-defined-options/index.d.ts +11 -0
- package/dist/types/user-defined-options/lifecycle.d.ts +6 -0
- package/dist/types/user-defined-options/matcher.d.ts +9 -0
- package/dist/types.d.ts +1 -150
- package/dist/types.js +0 -1
- package/dist/types.mjs +1 -1
- package/dist/uni-app-x/component-local-style.d.ts +19 -0
- package/dist/uni-app-x/index.d.ts +2 -0
- package/dist/uni-app-x/options.d.ts +12 -0
- package/dist/uni-app-x/style-isolation.d.ts +2 -0
- package/dist/uni-app-x/transform.d.ts +9 -0
- package/dist/uni-app-x/vite.d.ts +36 -0
- package/dist/utils/decode.d.ts +2 -0
- package/dist/utils/disabled.d.ts +6 -0
- package/dist/utils/hbuilderx.d.ts +5 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/nameMatcher.d.ts +4 -0
- package/dist/utils/resolve-package.d.ts +1 -0
- package/dist/utils/uni-platform.d.ts +11 -0
- package/dist/utils-7DUGTFED.mjs +48 -0
- package/dist/utils-DmC9_In3.js +61 -0
- package/dist/vite-BC9U7ahn.js +2199 -0
- package/dist/vite-CrlzCNqz.mjs +2186 -0
- package/dist/vite.d.ts +4 -17
- package/dist/vite.js +5 -14
- package/dist/vite.mjs +2 -14
- package/dist/weapp-tw-css-import-rewrite-loader.js +59 -92
- package/dist/weapp-tw-runtime-classset-loader.js +31 -50
- package/dist/webpack-Bu6M-Hbw.mjs +441 -0
- package/dist/webpack-DD7A6V0u.js +456 -0
- package/dist/webpack.d.ts +4 -25
- package/dist/webpack.js +6 -17
- package/dist/webpack.mjs +2 -17
- package/dist/webpack4.d.ts +4 -26
- package/dist/webpack4.js +375 -481
- package/dist/webpack4.mjs +366 -482
- package/dist/wxml/Tokenizer.d.ts +15 -0
- package/dist/wxml/custom-attributes.d.ts +4 -0
- package/dist/wxml/index.d.ts +2 -0
- package/dist/wxml/shared.d.ts +2 -0
- package/dist/wxml/tokenizer/types.d.ts +18 -0
- package/dist/wxml/utils/codegen/legacy-rewriter.d.ts +2 -0
- package/dist/wxml/utils/codegen/legacy-visitor.d.ts +8 -0
- package/dist/wxml/utils/codegen.d.ts +2 -0
- package/dist/wxml/utils/custom-template.d.ts +3 -0
- package/dist/wxml/utils/fragment-helpers.d.ts +6 -0
- package/dist/wxml/utils/fragment-updater.d.ts +4 -0
- package/dist/wxml/utils/template-fragments.d.ts +3 -0
- package/dist/wxml/utils.d.ts +8 -0
- package/dist/wxml/whitespace.d.ts +2 -0
- package/generator-placeholder.css +1 -0
- package/package.json +19 -8
- package/dist/chunk-24AGZQVR.js +0 -183
- package/dist/chunk-3VQKDHGP.mjs +0 -179
- package/dist/chunk-4AFQP74Z.js +0 -24
- package/dist/chunk-57SOQCAU.mjs +0 -582
- package/dist/chunk-5ZYHNDEK.mjs +0 -2439
- package/dist/chunk-76S2EME4.mjs +0 -34
- package/dist/chunk-A5PB4KZT.js +0 -138
- package/dist/chunk-DUHYLR2R.js +0 -276
- package/dist/chunk-DYLQ6UOI.js +0 -71
- package/dist/chunk-E7I5TW5K.js +0 -52
- package/dist/chunk-FS2NOOEB.js +0 -292
- package/dist/chunk-HVNGIKLS.js +0 -3930
- package/dist/chunk-JZQBZHN5.js +0 -579
- package/dist/chunk-KGTVD4EP.mjs +0 -3930
- package/dist/chunk-NNOQDMUP.mjs +0 -10
- package/dist/chunk-OF6MFURR.js +0 -34
- package/dist/chunk-OFB2KBRP.js +0 -2442
- package/dist/chunk-OOHJLO5M.mjs +0 -71
- package/dist/chunk-PCDYXXSK.mjs +0 -1515
- package/dist/chunk-RKISS72P.js +0 -7
- package/dist/chunk-RRQZL7FQ.mjs +0 -292
- package/dist/chunk-XAKAD2CR.mjs +0 -138
- package/dist/chunk-XZP3MREK.mjs +0 -276
- package/dist/chunk-ZAA5ZG3D.js +0 -1518
- package/dist/chunk-ZCH4YINE.mjs +0 -52
- package/dist/cli.d.mts +0 -2
- package/dist/core.d.mts +0 -26
- package/dist/css-macro/postcss.d.mts +0 -7
- package/dist/css-macro.d.mts +0 -18
- package/dist/defaults.d.mts +0 -11
- package/dist/gulp.d.mts +0 -24
- package/dist/index-BXrmQelt.d.mts +0 -672
- package/dist/index-BXrmQelt.d.ts +0 -672
- package/dist/index.d.mts +0 -15
- package/dist/postcss-html-transform.d.mts +0 -2
- package/dist/presets.d.mts +0 -76
- package/dist/reset.d.mts +0 -1
- package/dist/types.d.mts +0 -150
- package/dist/vite.d.mts +0 -17
- package/dist/webpack.d.mts +0 -25
- package/dist/webpack4.d.mts +0 -26
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './generator/index'
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("./chunk-8l464Juk.js");
|
|
3
|
+
const require_generator = require("./generator-mmhXzZnv.js");
|
|
4
|
+
let tailwindcss_patch = require("tailwindcss-patch");
|
|
5
|
+
exports.createWeappTailwindcssGenerator = require_generator.createWeappTailwindcssGenerator;
|
|
6
|
+
exports.createWeappTailwindcssGeneratorFromPatcher = require_generator.createWeappTailwindcssGeneratorFromPatcher;
|
|
7
|
+
exports.normalizeWeappTailwindcssGeneratorOptions = require_generator.normalizeWeappTailwindcssGeneratorOptions;
|
|
8
|
+
exports.resolveTailwindSourceFromPatcher = require_generator.resolveTailwindSourceFromPatcher;
|
|
9
|
+
exports.resolveTailwindV3Source = require_generator.resolveTailwindV3Source;
|
|
10
|
+
exports.resolveTailwindV3SourceFromPatcher = require_generator.resolveTailwindV3SourceFromPatcher;
|
|
11
|
+
exports.resolveTailwindV3SourceOptionsFromPatcher = require_generator.resolveTailwindV3SourceOptionsFromPatcher;
|
|
12
|
+
exports.resolveTailwindV4Source = require_generator.resolveTailwindV4Source;
|
|
13
|
+
exports.resolveTailwindV4SourceFromPatchOptions = tailwindcss_patch.resolveTailwindV4SourceFromPatchOptions;
|
|
14
|
+
exports.resolveTailwindV4SourceFromPatcher = require_generator.resolveTailwindV4SourceFromPatcher;
|
|
15
|
+
exports.resolveTailwindV4SourceOptionsFromPatcher = require_generator.resolveTailwindV4SourceOptionsFromPatcher;
|
|
16
|
+
exports.transformTailwindV3CssByTarget = require_generator.transformTailwindV3CssByTarget;
|
|
17
|
+
exports.transformTailwindV3CssToWeapp = require_generator.transformTailwindV3CssToWeapp;
|
|
18
|
+
exports.transformTailwindV4CssByTarget = require_generator.transformTailwindV4CssByTarget;
|
|
19
|
+
exports.transformTailwindV4CssToWeapp = require_generator.transformTailwindV4CssToWeapp;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { _ as transformTailwindV3CssToWeapp, a as resolveTailwindV4Source, c as resolveTailwindV4SourceOptionsFromPatcher, g as transformTailwindV3CssByTarget, h as resolveTailwindV3SourceOptionsFromPatcher, i as normalizeWeappTailwindcssGeneratorOptions, l as transformTailwindV4CssByTarget, m as resolveTailwindV3SourceFromPatcher, n as createWeappTailwindcssGeneratorFromPatcher, o as resolveTailwindV4SourceFromPatchOptions, p as resolveTailwindV3Source, r as resolveTailwindSourceFromPatcher, s as resolveTailwindV4SourceFromPatcher, t as createWeappTailwindcssGenerator, u as transformTailwindV4CssToWeapp } from "./generator-Y-Ikv4Fu.mjs";
|
|
2
|
+
export { createWeappTailwindcssGenerator, createWeappTailwindcssGeneratorFromPatcher, normalizeWeappTailwindcssGeneratorOptions, resolveTailwindSourceFromPatcher, resolveTailwindV3Source, resolveTailwindV3SourceFromPatcher, resolveTailwindV3SourceOptionsFromPatcher, resolveTailwindV4Source, resolveTailwindV4SourceFromPatchOptions, resolveTailwindV4SourceFromPatcher, resolveTailwindV4SourceOptionsFromPatcher, transformTailwindV3CssByTarget, transformTailwindV3CssToWeapp, transformTailwindV4CssByTarget, transformTailwindV4CssToWeapp };
|
package/dist/gulp.d.ts
CHANGED
|
@@ -1,24 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import '@babel/parser';
|
|
6
|
-
import 'magic-string';
|
|
7
|
-
import 'postcss';
|
|
8
|
-
import 'tailwindcss-patch';
|
|
9
|
-
import 'node:buffer';
|
|
10
|
-
import 'webpack';
|
|
11
|
-
import 'lru-cache';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* @name weapp-tw-gulp
|
|
15
|
-
* @description gulp版本weapp-tw插件
|
|
16
|
-
* @link https://tw.icebreaker.top/docs/quick-start/frameworks/native
|
|
17
|
-
*/
|
|
18
|
-
declare function createPlugins(options?: UserDefinedOptions): {
|
|
19
|
-
transformWxss: (options?: Partial<IStyleHandlerOptions>) => stream.Transform;
|
|
20
|
-
transformWxml: (options?: Partial<ITemplateHandlerOptions>) => stream.Transform;
|
|
21
|
-
transformJs: (options?: Partial<CreateJsHandlerOptions>) => stream.Transform;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export { UserDefinedOptions, createPlugins, createPlugins as weappTailwindcss };
|
|
1
|
+
export * from './bundlers/gulp/index';
|
|
2
|
+
export { createPlugins as WeappTailwindcss } from './bundlers/gulp/index';
|
|
3
|
+
export { createPlugins as weappTailwindcss } from './bundlers/gulp/index';
|
|
4
|
+
export type { UserDefinedOptions } from './types';
|
package/dist/gulp.js
CHANGED
|
@@ -1,13 +1,271 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
require(
|
|
5
|
-
require(
|
|
6
|
-
|
|
7
|
-
require(
|
|
8
|
-
|
|
9
|
-
require(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_chunk = require("./chunk-8l464Juk.js");
|
|
3
|
+
const require_recorder = require("./recorder-gYSNLfOP.js");
|
|
4
|
+
const require_generator_css = require("./generator-css-D3OdPRiS.js");
|
|
5
|
+
let node_path = require("node:path");
|
|
6
|
+
node_path = require_chunk.__toESM(node_path);
|
|
7
|
+
let node_process = require("node:process");
|
|
8
|
+
node_process = require_chunk.__toESM(node_process);
|
|
9
|
+
let node_buffer = require("node:buffer");
|
|
10
|
+
let node_fs = require("node:fs");
|
|
11
|
+
node_fs = require_chunk.__toESM(node_fs);
|
|
12
|
+
let node_stream = require("node:stream");
|
|
13
|
+
node_stream = require_chunk.__toESM(node_stream);
|
|
14
|
+
//#region src/bundlers/gulp/index.ts
|
|
15
|
+
const debug = require_recorder.createDebug();
|
|
16
|
+
const Transform = node_stream.default.Transform;
|
|
17
|
+
/**
|
|
18
|
+
* @name weapp-tw-gulp
|
|
19
|
+
* @description gulp版本weapp-tw插件
|
|
20
|
+
* @link https://tw.icebreaker.top/docs/quick-start/frameworks/native
|
|
21
|
+
*/
|
|
22
|
+
function createPlugins(options = {}) {
|
|
23
|
+
const opts = require_recorder.getCompilerContext(options);
|
|
24
|
+
const hasExplicitGeneratorOptions = options.generator !== void 0;
|
|
25
|
+
const { templateHandler, styleHandler, jsHandler, cache, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
|
|
26
|
+
const patchRecorderState = require_recorder.setupPatchRecorder(initialTwPatcher, opts.tailwindcssBasedir, {
|
|
27
|
+
source: "runtime",
|
|
28
|
+
cwd: opts.tailwindcssBasedir ?? node_process.default.cwd()
|
|
29
|
+
});
|
|
30
|
+
let runtimeSet = /* @__PURE__ */ new Set();
|
|
31
|
+
const runtimeState = {
|
|
32
|
+
twPatcher: initialTwPatcher,
|
|
33
|
+
patchPromise: patchRecorderState.patchPromise,
|
|
34
|
+
refreshTailwindcssPatcher,
|
|
35
|
+
onPatchCompleted: patchRecorderState.onPatchCompleted
|
|
36
|
+
};
|
|
37
|
+
const defaultStyleHandlerOptionsCache = /* @__PURE__ */ new Map();
|
|
38
|
+
let cachedDefaultTemplateHandlerOptions;
|
|
39
|
+
let cachedDefaultTemplateRuntimeSet;
|
|
40
|
+
let cachedDefaultModuleGraphOptions;
|
|
41
|
+
const MODULE_EXTENSIONS = [
|
|
42
|
+
".js",
|
|
43
|
+
".mjs",
|
|
44
|
+
".cjs",
|
|
45
|
+
".ts",
|
|
46
|
+
".tsx",
|
|
47
|
+
".jsx"
|
|
48
|
+
];
|
|
49
|
+
let runtimeSetInitialized = false;
|
|
50
|
+
async function refreshRuntimeState(force) {
|
|
51
|
+
await require_recorder.refreshTailwindRuntimeState(runtimeState, force);
|
|
52
|
+
}
|
|
53
|
+
async function refreshRuntimeSet(force = false) {
|
|
54
|
+
if (!force && runtimeSetInitialized) return runtimeSet;
|
|
55
|
+
runtimeSet = await require_recorder.ensureRuntimeClassSet(runtimeState, {
|
|
56
|
+
forceRefresh: force,
|
|
57
|
+
forceCollect: force,
|
|
58
|
+
clearCache: force,
|
|
59
|
+
allowEmpty: false
|
|
60
|
+
});
|
|
61
|
+
runtimeSetInitialized = true;
|
|
62
|
+
return runtimeSet;
|
|
63
|
+
}
|
|
64
|
+
function resolveWithExtensions(base) {
|
|
65
|
+
for (const ext of MODULE_EXTENSIONS) {
|
|
66
|
+
const candidate = `${base}${ext}`;
|
|
67
|
+
try {
|
|
68
|
+
if (node_fs.default.statSync(candidate).isFile()) return candidate;
|
|
69
|
+
} catch {
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function resolveLocalModuleCandidate(base) {
|
|
75
|
+
try {
|
|
76
|
+
const stat = node_fs.default.statSync(base);
|
|
77
|
+
if (stat.isFile()) return base;
|
|
78
|
+
if (stat.isDirectory()) {
|
|
79
|
+
const resolvedIndex = resolveWithExtensions(node_path.default.join(base, "index"));
|
|
80
|
+
if (resolvedIndex) return resolvedIndex;
|
|
81
|
+
}
|
|
82
|
+
} catch {}
|
|
83
|
+
if (!node_path.default.extname(base)) return resolveWithExtensions(base);
|
|
84
|
+
}
|
|
85
|
+
function createModuleGraphOptionsFor() {
|
|
86
|
+
return {
|
|
87
|
+
resolve(specifier, importer) {
|
|
88
|
+
if (!specifier) return;
|
|
89
|
+
if (!specifier.startsWith(".") && !node_path.default.isAbsolute(specifier)) return;
|
|
90
|
+
return resolveLocalModuleCandidate(node_path.default.resolve(node_path.default.dirname(importer), specifier));
|
|
91
|
+
},
|
|
92
|
+
load(id) {
|
|
93
|
+
try {
|
|
94
|
+
return node_fs.default.readFileSync(id, "utf8");
|
|
95
|
+
} catch {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
filter(id) {
|
|
100
|
+
const relative = node_path.default.relative(node_process.default.cwd(), id);
|
|
101
|
+
return opts.jsMatcher(relative) || opts.wxsMatcher(relative);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
function resolveModuleGraphOptions(moduleGraph) {
|
|
106
|
+
if (moduleGraph) return moduleGraph;
|
|
107
|
+
if (!cachedDefaultModuleGraphOptions) cachedDefaultModuleGraphOptions = createModuleGraphOptionsFor();
|
|
108
|
+
return cachedDefaultModuleGraphOptions;
|
|
109
|
+
}
|
|
110
|
+
function createVinylTransform(handler) {
|
|
111
|
+
return new Transform({
|
|
112
|
+
objectMode: true,
|
|
113
|
+
async transform(file, _encoding, callback) {
|
|
114
|
+
try {
|
|
115
|
+
await handler(file);
|
|
116
|
+
callback(null, file);
|
|
117
|
+
} catch (error) {
|
|
118
|
+
callback(error, file);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
function resolveWxssHandlerOptions(options) {
|
|
124
|
+
const majorVersion = runtimeState.twPatcher.majorVersion ?? "unknown";
|
|
125
|
+
if (!options || Object.keys(options).length === 0) {
|
|
126
|
+
let cached = defaultStyleHandlerOptionsCache.get(majorVersion);
|
|
127
|
+
if (!cached) {
|
|
128
|
+
cached = { majorVersion: runtimeState.twPatcher.majorVersion };
|
|
129
|
+
defaultStyleHandlerOptionsCache.set(majorVersion, cached);
|
|
130
|
+
}
|
|
131
|
+
return cached;
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
majorVersion: runtimeState.twPatcher.majorVersion,
|
|
135
|
+
...options
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
function resolveGulpMatcherName(file) {
|
|
139
|
+
return (file.relative || node_path.default.basename(file.path)).replaceAll(node_path.default.sep, "/");
|
|
140
|
+
}
|
|
141
|
+
function resolveWxssFileHandlerOptions(file, options) {
|
|
142
|
+
const resolved = resolveWxssHandlerOptions(options);
|
|
143
|
+
if (resolved.isMainChunk !== void 0) return resolved;
|
|
144
|
+
return {
|
|
145
|
+
...resolved,
|
|
146
|
+
isMainChunk: opts.mainCssChunkMatcher(resolveGulpMatcherName(file), opts.appType)
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
function resolveWxssUserHandlerOptions(options) {
|
|
150
|
+
return {
|
|
151
|
+
...resolveWxssHandlerOptions(options),
|
|
152
|
+
isMainChunk: false
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function resolveWxmlHandlerOptions(options) {
|
|
156
|
+
if (!options || Object.keys(options).length === 0) {
|
|
157
|
+
if (cachedDefaultTemplateRuntimeSet !== runtimeSet || !cachedDefaultTemplateHandlerOptions) {
|
|
158
|
+
cachedDefaultTemplateRuntimeSet = runtimeSet;
|
|
159
|
+
cachedDefaultTemplateHandlerOptions = { runtimeSet };
|
|
160
|
+
}
|
|
161
|
+
return cachedDefaultTemplateHandlerOptions;
|
|
162
|
+
}
|
|
163
|
+
return {
|
|
164
|
+
runtimeSet,
|
|
165
|
+
...options
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
const transformWxss = (options = {}) => createVinylTransform(async (file) => {
|
|
169
|
+
if (!file.contents) return;
|
|
170
|
+
await refreshRuntimeState(true);
|
|
171
|
+
await runtimeState.patchPromise;
|
|
172
|
+
const rawSource = file.contents.toString();
|
|
173
|
+
await require_generator_css.processCachedTask({
|
|
174
|
+
cache,
|
|
175
|
+
cacheKey: file.path,
|
|
176
|
+
rawSource,
|
|
177
|
+
applyResult(source) {
|
|
178
|
+
file.contents = node_buffer.Buffer.from(source);
|
|
179
|
+
},
|
|
180
|
+
onCacheHit() {
|
|
181
|
+
debug("css cache hit: %s", file.path);
|
|
182
|
+
},
|
|
183
|
+
async transform() {
|
|
184
|
+
await runtimeState.patchPromise;
|
|
185
|
+
const cssHandlerOptions = resolveWxssFileHandlerOptions(file, options);
|
|
186
|
+
const css = (hasExplicitGeneratorOptions ? await require_generator_css.generateCssByGenerator({
|
|
187
|
+
opts,
|
|
188
|
+
runtimeState,
|
|
189
|
+
runtime: await refreshRuntimeSet(false),
|
|
190
|
+
rawSource,
|
|
191
|
+
file: file.path,
|
|
192
|
+
cssHandlerOptions,
|
|
193
|
+
cssUserHandlerOptions: resolveWxssUserHandlerOptions(options),
|
|
194
|
+
styleHandler,
|
|
195
|
+
debug
|
|
196
|
+
}) : void 0)?.css ?? (await styleHandler(rawSource, cssHandlerOptions)).css;
|
|
197
|
+
debug("css handle: %s", file.path);
|
|
198
|
+
return { result: css };
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
const transformJs = (options = {}) => createVinylTransform(async (file) => {
|
|
203
|
+
if (!file.contents) return;
|
|
204
|
+
await refreshRuntimeSet(false);
|
|
205
|
+
await runtimeState.patchPromise;
|
|
206
|
+
const filename = node_path.default.resolve(file.path);
|
|
207
|
+
const moduleGraph = resolveModuleGraphOptions(options.moduleGraph);
|
|
208
|
+
const handlerOptions = {
|
|
209
|
+
...options,
|
|
210
|
+
filename,
|
|
211
|
+
moduleGraph,
|
|
212
|
+
tailwindcssMajorVersion: runtimeState.twPatcher.majorVersion,
|
|
213
|
+
babelParserOptions: {
|
|
214
|
+
...options?.babelParserOptions ?? {},
|
|
215
|
+
sourceFilename: filename
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
const rawSource = file.contents.toString();
|
|
219
|
+
await require_generator_css.processCachedTask({
|
|
220
|
+
cache,
|
|
221
|
+
cacheKey: file.path,
|
|
222
|
+
rawSource,
|
|
223
|
+
applyResult(source) {
|
|
224
|
+
file.contents = node_buffer.Buffer.from(source);
|
|
225
|
+
},
|
|
226
|
+
onCacheHit() {
|
|
227
|
+
debug("js cache hit: %s", file.path);
|
|
228
|
+
},
|
|
229
|
+
async transform() {
|
|
230
|
+
await runtimeState.patchPromise;
|
|
231
|
+
const currentSource = file.contents?.toString() ?? rawSource;
|
|
232
|
+
if (require_recorder.shouldSkipJsTransform(currentSource, handlerOptions)) return { result: currentSource };
|
|
233
|
+
const { code } = await jsHandler(currentSource, runtimeSet, handlerOptions);
|
|
234
|
+
debug("js handle: %s", file.path);
|
|
235
|
+
return { result: code };
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
const transformWxml = (options = {}) => createVinylTransform(async (file) => {
|
|
240
|
+
if (!file.contents) return;
|
|
241
|
+
await refreshRuntimeSet(false);
|
|
242
|
+
await runtimeState.patchPromise;
|
|
243
|
+
const rawSource = file.contents.toString();
|
|
244
|
+
await require_generator_css.processCachedTask({
|
|
245
|
+
cache,
|
|
246
|
+
cacheKey: file.path,
|
|
247
|
+
rawSource,
|
|
248
|
+
applyResult(source) {
|
|
249
|
+
file.contents = node_buffer.Buffer.from(source);
|
|
250
|
+
},
|
|
251
|
+
onCacheHit() {
|
|
252
|
+
debug("html cache hit: %s", file.path);
|
|
253
|
+
},
|
|
254
|
+
async transform() {
|
|
255
|
+
await runtimeState.patchPromise;
|
|
256
|
+
const code = await templateHandler(rawSource, resolveWxmlHandlerOptions(options));
|
|
257
|
+
debug("html handle: %s", file.path);
|
|
258
|
+
return { result: code };
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
return {
|
|
263
|
+
transformWxss,
|
|
264
|
+
transformWxml,
|
|
265
|
+
transformJs
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
//#endregion
|
|
269
|
+
exports.WeappTailwindcss = createPlugins;
|
|
270
|
+
exports.createPlugins = createPlugins;
|
|
271
|
+
exports.weappTailwindcss = createPlugins;
|
package/dist/gulp.mjs
CHANGED
|
@@ -1,13 +1,263 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import "
|
|
5
|
-
import "
|
|
6
|
-
import "
|
|
7
|
-
import "
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { _ as refreshTailwindRuntimeState, g as ensureRuntimeClassSet, n as shouldSkipJsTransform, r as getCompilerContext, t as setupPatchRecorder, v as createDebug } from "./recorder-zsgatmkB.mjs";
|
|
2
|
+
import { i as processCachedTask, t as generateCssByGenerator } from "./generator-css-B5ejWUMv.mjs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import process from "node:process";
|
|
5
|
+
import { Buffer } from "node:buffer";
|
|
6
|
+
import fs from "node:fs";
|
|
7
|
+
import stream from "node:stream";
|
|
8
|
+
//#region src/bundlers/gulp/index.ts
|
|
9
|
+
const debug = createDebug();
|
|
10
|
+
const Transform = stream.Transform;
|
|
11
|
+
/**
|
|
12
|
+
* @name weapp-tw-gulp
|
|
13
|
+
* @description gulp版本weapp-tw插件
|
|
14
|
+
* @link https://tw.icebreaker.top/docs/quick-start/frameworks/native
|
|
15
|
+
*/
|
|
16
|
+
function createPlugins(options = {}) {
|
|
17
|
+
const opts = getCompilerContext(options);
|
|
18
|
+
const hasExplicitGeneratorOptions = options.generator !== void 0;
|
|
19
|
+
const { templateHandler, styleHandler, jsHandler, cache, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
|
|
20
|
+
const patchRecorderState = setupPatchRecorder(initialTwPatcher, opts.tailwindcssBasedir, {
|
|
21
|
+
source: "runtime",
|
|
22
|
+
cwd: opts.tailwindcssBasedir ?? process.cwd()
|
|
23
|
+
});
|
|
24
|
+
let runtimeSet = /* @__PURE__ */ new Set();
|
|
25
|
+
const runtimeState = {
|
|
26
|
+
twPatcher: initialTwPatcher,
|
|
27
|
+
patchPromise: patchRecorderState.patchPromise,
|
|
28
|
+
refreshTailwindcssPatcher,
|
|
29
|
+
onPatchCompleted: patchRecorderState.onPatchCompleted
|
|
30
|
+
};
|
|
31
|
+
const defaultStyleHandlerOptionsCache = /* @__PURE__ */ new Map();
|
|
32
|
+
let cachedDefaultTemplateHandlerOptions;
|
|
33
|
+
let cachedDefaultTemplateRuntimeSet;
|
|
34
|
+
let cachedDefaultModuleGraphOptions;
|
|
35
|
+
const MODULE_EXTENSIONS = [
|
|
36
|
+
".js",
|
|
37
|
+
".mjs",
|
|
38
|
+
".cjs",
|
|
39
|
+
".ts",
|
|
40
|
+
".tsx",
|
|
41
|
+
".jsx"
|
|
42
|
+
];
|
|
43
|
+
let runtimeSetInitialized = false;
|
|
44
|
+
async function refreshRuntimeState(force) {
|
|
45
|
+
await refreshTailwindRuntimeState(runtimeState, force);
|
|
46
|
+
}
|
|
47
|
+
async function refreshRuntimeSet(force = false) {
|
|
48
|
+
if (!force && runtimeSetInitialized) return runtimeSet;
|
|
49
|
+
runtimeSet = await ensureRuntimeClassSet(runtimeState, {
|
|
50
|
+
forceRefresh: force,
|
|
51
|
+
forceCollect: force,
|
|
52
|
+
clearCache: force,
|
|
53
|
+
allowEmpty: false
|
|
54
|
+
});
|
|
55
|
+
runtimeSetInitialized = true;
|
|
56
|
+
return runtimeSet;
|
|
57
|
+
}
|
|
58
|
+
function resolveWithExtensions(base) {
|
|
59
|
+
for (const ext of MODULE_EXTENSIONS) {
|
|
60
|
+
const candidate = `${base}${ext}`;
|
|
61
|
+
try {
|
|
62
|
+
if (fs.statSync(candidate).isFile()) return candidate;
|
|
63
|
+
} catch {
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function resolveLocalModuleCandidate(base) {
|
|
69
|
+
try {
|
|
70
|
+
const stat = fs.statSync(base);
|
|
71
|
+
if (stat.isFile()) return base;
|
|
72
|
+
if (stat.isDirectory()) {
|
|
73
|
+
const resolvedIndex = resolveWithExtensions(path.join(base, "index"));
|
|
74
|
+
if (resolvedIndex) return resolvedIndex;
|
|
75
|
+
}
|
|
76
|
+
} catch {}
|
|
77
|
+
if (!path.extname(base)) return resolveWithExtensions(base);
|
|
78
|
+
}
|
|
79
|
+
function createModuleGraphOptionsFor() {
|
|
80
|
+
return {
|
|
81
|
+
resolve(specifier, importer) {
|
|
82
|
+
if (!specifier) return;
|
|
83
|
+
if (!specifier.startsWith(".") && !path.isAbsolute(specifier)) return;
|
|
84
|
+
return resolveLocalModuleCandidate(path.resolve(path.dirname(importer), specifier));
|
|
85
|
+
},
|
|
86
|
+
load(id) {
|
|
87
|
+
try {
|
|
88
|
+
return fs.readFileSync(id, "utf8");
|
|
89
|
+
} catch {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
filter(id) {
|
|
94
|
+
const relative = path.relative(process.cwd(), id);
|
|
95
|
+
return opts.jsMatcher(relative) || opts.wxsMatcher(relative);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
function resolveModuleGraphOptions(moduleGraph) {
|
|
100
|
+
if (moduleGraph) return moduleGraph;
|
|
101
|
+
if (!cachedDefaultModuleGraphOptions) cachedDefaultModuleGraphOptions = createModuleGraphOptionsFor();
|
|
102
|
+
return cachedDefaultModuleGraphOptions;
|
|
103
|
+
}
|
|
104
|
+
function createVinylTransform(handler) {
|
|
105
|
+
return new Transform({
|
|
106
|
+
objectMode: true,
|
|
107
|
+
async transform(file, _encoding, callback) {
|
|
108
|
+
try {
|
|
109
|
+
await handler(file);
|
|
110
|
+
callback(null, file);
|
|
111
|
+
} catch (error) {
|
|
112
|
+
callback(error, file);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
function resolveWxssHandlerOptions(options) {
|
|
118
|
+
const majorVersion = runtimeState.twPatcher.majorVersion ?? "unknown";
|
|
119
|
+
if (!options || Object.keys(options).length === 0) {
|
|
120
|
+
let cached = defaultStyleHandlerOptionsCache.get(majorVersion);
|
|
121
|
+
if (!cached) {
|
|
122
|
+
cached = { majorVersion: runtimeState.twPatcher.majorVersion };
|
|
123
|
+
defaultStyleHandlerOptionsCache.set(majorVersion, cached);
|
|
124
|
+
}
|
|
125
|
+
return cached;
|
|
126
|
+
}
|
|
127
|
+
return {
|
|
128
|
+
majorVersion: runtimeState.twPatcher.majorVersion,
|
|
129
|
+
...options
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
function resolveGulpMatcherName(file) {
|
|
133
|
+
return (file.relative || path.basename(file.path)).replaceAll(path.sep, "/");
|
|
134
|
+
}
|
|
135
|
+
function resolveWxssFileHandlerOptions(file, options) {
|
|
136
|
+
const resolved = resolveWxssHandlerOptions(options);
|
|
137
|
+
if (resolved.isMainChunk !== void 0) return resolved;
|
|
138
|
+
return {
|
|
139
|
+
...resolved,
|
|
140
|
+
isMainChunk: opts.mainCssChunkMatcher(resolveGulpMatcherName(file), opts.appType)
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function resolveWxssUserHandlerOptions(options) {
|
|
144
|
+
return {
|
|
145
|
+
...resolveWxssHandlerOptions(options),
|
|
146
|
+
isMainChunk: false
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
function resolveWxmlHandlerOptions(options) {
|
|
150
|
+
if (!options || Object.keys(options).length === 0) {
|
|
151
|
+
if (cachedDefaultTemplateRuntimeSet !== runtimeSet || !cachedDefaultTemplateHandlerOptions) {
|
|
152
|
+
cachedDefaultTemplateRuntimeSet = runtimeSet;
|
|
153
|
+
cachedDefaultTemplateHandlerOptions = { runtimeSet };
|
|
154
|
+
}
|
|
155
|
+
return cachedDefaultTemplateHandlerOptions;
|
|
156
|
+
}
|
|
157
|
+
return {
|
|
158
|
+
runtimeSet,
|
|
159
|
+
...options
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
const transformWxss = (options = {}) => createVinylTransform(async (file) => {
|
|
163
|
+
if (!file.contents) return;
|
|
164
|
+
await refreshRuntimeState(true);
|
|
165
|
+
await runtimeState.patchPromise;
|
|
166
|
+
const rawSource = file.contents.toString();
|
|
167
|
+
await processCachedTask({
|
|
168
|
+
cache,
|
|
169
|
+
cacheKey: file.path,
|
|
170
|
+
rawSource,
|
|
171
|
+
applyResult(source) {
|
|
172
|
+
file.contents = Buffer.from(source);
|
|
173
|
+
},
|
|
174
|
+
onCacheHit() {
|
|
175
|
+
debug("css cache hit: %s", file.path);
|
|
176
|
+
},
|
|
177
|
+
async transform() {
|
|
178
|
+
await runtimeState.patchPromise;
|
|
179
|
+
const cssHandlerOptions = resolveWxssFileHandlerOptions(file, options);
|
|
180
|
+
const css = (hasExplicitGeneratorOptions ? await generateCssByGenerator({
|
|
181
|
+
opts,
|
|
182
|
+
runtimeState,
|
|
183
|
+
runtime: await refreshRuntimeSet(false),
|
|
184
|
+
rawSource,
|
|
185
|
+
file: file.path,
|
|
186
|
+
cssHandlerOptions,
|
|
187
|
+
cssUserHandlerOptions: resolveWxssUserHandlerOptions(options),
|
|
188
|
+
styleHandler,
|
|
189
|
+
debug
|
|
190
|
+
}) : void 0)?.css ?? (await styleHandler(rawSource, cssHandlerOptions)).css;
|
|
191
|
+
debug("css handle: %s", file.path);
|
|
192
|
+
return { result: css };
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
const transformJs = (options = {}) => createVinylTransform(async (file) => {
|
|
197
|
+
if (!file.contents) return;
|
|
198
|
+
await refreshRuntimeSet(false);
|
|
199
|
+
await runtimeState.patchPromise;
|
|
200
|
+
const filename = path.resolve(file.path);
|
|
201
|
+
const moduleGraph = resolveModuleGraphOptions(options.moduleGraph);
|
|
202
|
+
const handlerOptions = {
|
|
203
|
+
...options,
|
|
204
|
+
filename,
|
|
205
|
+
moduleGraph,
|
|
206
|
+
tailwindcssMajorVersion: runtimeState.twPatcher.majorVersion,
|
|
207
|
+
babelParserOptions: {
|
|
208
|
+
...options?.babelParserOptions ?? {},
|
|
209
|
+
sourceFilename: filename
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
const rawSource = file.contents.toString();
|
|
213
|
+
await processCachedTask({
|
|
214
|
+
cache,
|
|
215
|
+
cacheKey: file.path,
|
|
216
|
+
rawSource,
|
|
217
|
+
applyResult(source) {
|
|
218
|
+
file.contents = Buffer.from(source);
|
|
219
|
+
},
|
|
220
|
+
onCacheHit() {
|
|
221
|
+
debug("js cache hit: %s", file.path);
|
|
222
|
+
},
|
|
223
|
+
async transform() {
|
|
224
|
+
await runtimeState.patchPromise;
|
|
225
|
+
const currentSource = file.contents?.toString() ?? rawSource;
|
|
226
|
+
if (shouldSkipJsTransform(currentSource, handlerOptions)) return { result: currentSource };
|
|
227
|
+
const { code } = await jsHandler(currentSource, runtimeSet, handlerOptions);
|
|
228
|
+
debug("js handle: %s", file.path);
|
|
229
|
+
return { result: code };
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
const transformWxml = (options = {}) => createVinylTransform(async (file) => {
|
|
234
|
+
if (!file.contents) return;
|
|
235
|
+
await refreshRuntimeSet(false);
|
|
236
|
+
await runtimeState.patchPromise;
|
|
237
|
+
const rawSource = file.contents.toString();
|
|
238
|
+
await processCachedTask({
|
|
239
|
+
cache,
|
|
240
|
+
cacheKey: file.path,
|
|
241
|
+
rawSource,
|
|
242
|
+
applyResult(source) {
|
|
243
|
+
file.contents = Buffer.from(source);
|
|
244
|
+
},
|
|
245
|
+
onCacheHit() {
|
|
246
|
+
debug("html cache hit: %s", file.path);
|
|
247
|
+
},
|
|
248
|
+
async transform() {
|
|
249
|
+
await runtimeState.patchPromise;
|
|
250
|
+
const code = await templateHandler(rawSource, resolveWxmlHandlerOptions(options));
|
|
251
|
+
debug("html handle: %s", file.path);
|
|
252
|
+
return { result: code };
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
});
|
|
256
|
+
return {
|
|
257
|
+
transformWxss,
|
|
258
|
+
transformWxml,
|
|
259
|
+
transformJs
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
//#endregion
|
|
263
|
+
export { createPlugins as WeappTailwindcss, createPlugins, createPlugins as weappTailwindcss };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import 'magic-string';
|
|
10
|
-
import 'postcss';
|
|
11
|
-
import 'tailwindcss-patch';
|
|
12
|
-
import 'vite';
|
|
13
|
-
import 'webpack';
|
|
14
|
-
import 'node:buffer';
|
|
15
|
-
import 'lru-cache';
|
|
1
|
+
export { createWeappTailwindcssGenerator } from './generator';
|
|
2
|
+
export type * from './generator';
|
|
3
|
+
export { createPlugins } from './gulp';
|
|
4
|
+
export { weappTailwindcssPostcssPlugin } from './postcss';
|
|
5
|
+
export type { WeappTailwindcssPostcssPluginOptions } from './postcss';
|
|
6
|
+
export type * from './types';
|
|
7
|
+
export { UnifiedViteWeappTailwindcssPlugin } from './vite';
|
|
8
|
+
export { UnifiedWebpackPluginV5, weappTailwindcssPackageDir } from './webpack';
|
package/dist/index.js
CHANGED
|
@@ -1,24 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
require(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
require('./chunk-OF6MFURR.js');
|
|
14
|
-
require('./chunk-HVNGIKLS.js');
|
|
15
|
-
require('./chunk-ZAA5ZG3D.js');
|
|
16
|
-
require('./chunk-A5PB4KZT.js');
|
|
17
|
-
require('./chunk-DYLQ6UOI.js');
|
|
18
|
-
require('./chunk-RKISS72P.js');
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
exports.UnifiedViteWeappTailwindcssPlugin = _chunkOFB2KBRPjs.UnifiedViteWeappTailwindcssPlugin; exports.UnifiedWebpackPluginV5 = _chunkJZQBZHN5js.UnifiedWebpackPluginV5; exports.createPlugins = _chunkDUHYLR2Rjs.createPlugins; exports.weappTailwindcssPackageDir = _chunkJZQBZHN5js.weappTailwindcssPackageDir;
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_generator = require("./generator-mmhXzZnv.js");
|
|
3
|
+
const require_gulp = require("./gulp.js");
|
|
4
|
+
const require_postcss = require("./postcss.js");
|
|
5
|
+
const require_vite = require("./vite-BC9U7ahn.js");
|
|
6
|
+
const require_webpack = require("./webpack-DD7A6V0u.js");
|
|
7
|
+
exports.UnifiedViteWeappTailwindcssPlugin = require_vite.UnifiedViteWeappTailwindcssPlugin;
|
|
8
|
+
exports.UnifiedWebpackPluginV5 = require_webpack.UnifiedWebpackPluginV5;
|
|
9
|
+
exports.createPlugins = require_gulp.createPlugins;
|
|
10
|
+
exports.createWeappTailwindcssGenerator = require_generator.createWeappTailwindcssGenerator;
|
|
11
|
+
exports.weappTailwindcssPackageDir = require_webpack.weappTailwindcssPackageDir;
|
|
12
|
+
exports.weappTailwindcssPostcssPlugin = require_postcss;
|