weapp-tailwindcss 4.12.0 → 5.0.0-next.1
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 +41 -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 +19 -0
- package/dist/bundlers/vite/generate-bundle.d.ts +20 -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/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 +15 -0
- package/dist/generator/types.d.ts +19 -0
- package/dist/generator-CZ-JXw6T.js +492 -0
- package/dist/generator-Dwxgra97.mjs +399 -0
- package/dist/generator-css-CnYjiMrD.js +1084 -0
- package/dist/generator-css-DhPFjSzK.mjs +1057 -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-DvwgIYdA.mjs +205 -0
- package/dist/loader-anchors-cprm4Klq.js +273 -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 +278 -0
- package/dist/postcss.mjs +268 -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-B_XyZ576.mjs +2763 -0
- package/dist/recorder-rn_2v_nd.js +2878 -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/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 +4 -0
- package/dist/tailwindcss/v4-engine/source.d.ts +7 -0
- package/dist/tailwindcss/v4-engine/types.d.ts +17 -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-BHpAqldo.js +1952 -0
- package/dist/vite-C8JlHiyR.mjs +1940 -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-CABjKGGQ.mjs +441 -0
- package/dist/webpack-DNIJ0ysE.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 -5
- 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
package/dist/presets.js
CHANGED
|
@@ -1,177 +1,129 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
// src/presets/shared.ts
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_chunk = require("./chunk-8l464Juk.js");
|
|
3
|
+
const require_utils = require("./utils-DmC9_In3.js");
|
|
4
|
+
const require_logger = require("./logger-BZ45DZJT.js");
|
|
5
|
+
let node_process = require("node:process");
|
|
6
|
+
node_process = require_chunk.__toESM(node_process);
|
|
7
|
+
let local_pkg = require("local-pkg");
|
|
8
|
+
let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
|
|
9
|
+
let _weapp_tailwindcss_logger = require("@weapp-tailwindcss/logger");
|
|
10
|
+
//#region src/presets/shared.ts
|
|
13
11
|
function normalizeCssEntries(entries) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const normalized = Array.isArray(entries) ? entries : [entries];
|
|
18
|
-
return normalized.length > 0 ? normalized : void 0;
|
|
12
|
+
if (!entries) return;
|
|
13
|
+
const normalized = Array.isArray(entries) ? entries : [entries];
|
|
14
|
+
return normalized.length > 0 ? normalized : void 0;
|
|
19
15
|
}
|
|
20
16
|
function createBasePreset(options = {}) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const preset = {
|
|
46
|
-
tailwindcssBasedir: baseDir,
|
|
47
|
-
tailwindcss: tailwindConfig,
|
|
48
|
-
tailwindcssPatcherOptions: {
|
|
49
|
-
projectRoot: baseDir,
|
|
50
|
-
tailwindcss: patchTailwindConfig
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
const mergedUserOptions = _chunkDYLQ6UOIjs.defuOverrideArray.call(void 0, userOptions, _nullishCoalesce(rawOptions, () => ( {})));
|
|
54
|
-
return _chunkDYLQ6UOIjs.defuOverrideArray.call(void 0,
|
|
55
|
-
mergedUserOptions,
|
|
56
|
-
preset
|
|
57
|
-
);
|
|
17
|
+
const { base, cssEntries, resolve, rawOptions, ...userOptions } = options;
|
|
18
|
+
const baseDir = require_logger.resolveTailwindcssBasedir(base);
|
|
19
|
+
const normalizedCssEntries = normalizeCssEntries(cssEntries);
|
|
20
|
+
const tailwindConfig = {
|
|
21
|
+
v2: { cwd: baseDir },
|
|
22
|
+
v3: { cwd: baseDir },
|
|
23
|
+
v4: {
|
|
24
|
+
base: baseDir,
|
|
25
|
+
cssEntries: normalizedCssEntries
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
if (normalizedCssEntries && normalizedCssEntries.length > 0) tailwindConfig.version = 4;
|
|
29
|
+
const preset = {
|
|
30
|
+
tailwindcssBasedir: baseDir,
|
|
31
|
+
tailwindcss: tailwindConfig,
|
|
32
|
+
tailwindcssPatcherOptions: {
|
|
33
|
+
projectRoot: baseDir,
|
|
34
|
+
tailwindcss: resolve ? {
|
|
35
|
+
...tailwindConfig,
|
|
36
|
+
resolve
|
|
37
|
+
} : tailwindConfig
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
return (0, _weapp_tailwindcss_shared.defuOverrideArray)((0, _weapp_tailwindcss_shared.defuOverrideArray)(userOptions, rawOptions ?? {}), preset);
|
|
58
41
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/presets/uni-app.ts
|
|
62
44
|
function uniApp(options = {}) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
});
|
|
45
|
+
const uniPlatform = node_process.default.env.UNI_PLATFORM;
|
|
46
|
+
return createBasePreset({
|
|
47
|
+
disabled: uniPlatform === "h5" || uniPlatform === "app" || uniPlatform === "app-plus" ? true : void 0,
|
|
48
|
+
...options
|
|
49
|
+
});
|
|
69
50
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
// src/tailwindcss/index.ts
|
|
75
|
-
var _localpkg = require('local-pkg');
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/tailwindcss/index.ts
|
|
76
53
|
function getTailwindcssPackageInfo(options) {
|
|
77
|
-
|
|
54
|
+
return (0, local_pkg.getPackageInfoSync)("tailwindcss", options);
|
|
78
55
|
}
|
|
79
|
-
|
|
80
|
-
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region src/presets/uni-app-x.ts
|
|
81
58
|
function resolveTailwindResolveOptions(base, resolve) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
59
|
+
const currentPaths = Array.isArray(resolve?.paths) ? resolve.paths : [];
|
|
60
|
+
return {
|
|
61
|
+
...resolve ?? {},
|
|
62
|
+
paths: [...new Set([base, ...currentPaths])]
|
|
63
|
+
};
|
|
87
64
|
}
|
|
88
65
|
function resolveInstalledTailwindDefaults(resolve) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
if (major === 3) {
|
|
106
|
-
return {
|
|
107
|
-
version: 3,
|
|
108
|
-
packageName: "tailwindcss",
|
|
109
|
-
postcssPlugin: "tailwindcss"
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
return void 0;
|
|
66
|
+
const version = getTailwindcssPackageInfo(resolve)?.version;
|
|
67
|
+
if (!version) return;
|
|
68
|
+
const major = Number.parseInt(version.split(".")[0] ?? "", 10);
|
|
69
|
+
if (!Number.isFinite(major)) return;
|
|
70
|
+
if (major === 4) return {
|
|
71
|
+
version: 4,
|
|
72
|
+
packageName: "tailwindcss",
|
|
73
|
+
postcssPlugin: "@tailwindcss/postcss"
|
|
74
|
+
};
|
|
75
|
+
if (major === 3) return {
|
|
76
|
+
version: 3,
|
|
77
|
+
packageName: "tailwindcss",
|
|
78
|
+
postcssPlugin: "tailwindcss"
|
|
79
|
+
};
|
|
113
80
|
}
|
|
114
81
|
function uniAppX(options) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
},
|
|
158
|
-
cssPreflight: {
|
|
159
|
-
"border-style": false
|
|
160
|
-
},
|
|
161
|
-
cssPresetEnv: {
|
|
162
|
-
features: {
|
|
163
|
-
"custom-properties": {
|
|
164
|
-
preserve: false
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
},
|
|
168
|
-
...options.customAttributes ? { customAttributes: options.customAttributes } : {}
|
|
169
|
-
}
|
|
170
|
-
);
|
|
82
|
+
_weapp_tailwindcss_logger.logger.info(`UNI_PLATFORM: ${node_process.default.env.UNI_PLATFORM}`);
|
|
83
|
+
const utsPlatform = require_utils.resolveUniUtsPlatform();
|
|
84
|
+
const uniPlatform = require_utils.resolveUniUtsPlatform(node_process.default.env.UNI_PLATFORM);
|
|
85
|
+
_weapp_tailwindcss_logger.logger.info(`UNI_UTS_PLATFORM: ${utsPlatform.raw ?? "undefined"}`);
|
|
86
|
+
const isApp = utsPlatform.isApp || uniPlatform.isApp;
|
|
87
|
+
const cssEntries = normalizeCssEntries(options.cssEntries);
|
|
88
|
+
const resolvedResolve = resolveTailwindResolveOptions(options.base, options.resolve);
|
|
89
|
+
const installedTailwindDefaults = resolveInstalledTailwindDefaults(resolvedResolve);
|
|
90
|
+
const resolvedUniAppX = require_logger.resolveUniAppXOptions({
|
|
91
|
+
enabled: isApp,
|
|
92
|
+
componentLocalStyles: options.componentLocalStyles ?? true,
|
|
93
|
+
uvueUnsupported: options.uvueUnsupported,
|
|
94
|
+
...typeof options.uniAppX === "object" ? options.uniAppX : {}
|
|
95
|
+
});
|
|
96
|
+
if (typeof options.uniAppX === "boolean") resolvedUniAppX.enabled = options.uniAppX;
|
|
97
|
+
return (0, _weapp_tailwindcss_shared.defuOverrideArray)(options.rawOptions ?? {}, {
|
|
98
|
+
uniAppX: resolvedUniAppX,
|
|
99
|
+
...options.generator !== void 0 ? { generator: options.generator } : {},
|
|
100
|
+
rem2rpx: options.rem2rpx,
|
|
101
|
+
unitsToPx: options.unitsToPx,
|
|
102
|
+
tailwindcssBasedir: options.base,
|
|
103
|
+
tailwindcssPatcherOptions: {
|
|
104
|
+
projectRoot: options.base,
|
|
105
|
+
tailwindcss: {
|
|
106
|
+
...installedTailwindDefaults ?? {},
|
|
107
|
+
cwd: options.base,
|
|
108
|
+
resolve: resolvedResolve,
|
|
109
|
+
v3: { cwd: options.base },
|
|
110
|
+
v4: {
|
|
111
|
+
base: options.base,
|
|
112
|
+
cssEntries
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
tailwindcss: {
|
|
117
|
+
...installedTailwindDefaults ?? {},
|
|
118
|
+
resolve: resolvedResolve
|
|
119
|
+
},
|
|
120
|
+
cssPreflight: { "border-style": false },
|
|
121
|
+
cssPresetEnv: { features: { "custom-properties": { preserve: false } } },
|
|
122
|
+
...options.customAttributes ? { customAttributes: options.customAttributes } : {}
|
|
123
|
+
});
|
|
171
124
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
exports.createBasePreset = createBasePreset; exports.normalizeCssEntries = normalizeCssEntries; exports.uniApp = uniApp; exports.uniAppX = uniAppX;
|
|
125
|
+
//#endregion
|
|
126
|
+
exports.createBasePreset = createBasePreset;
|
|
127
|
+
exports.normalizeCssEntries = normalizeCssEntries;
|
|
128
|
+
exports.uniApp = uniApp;
|
|
129
|
+
exports.uniAppX = uniAppX;
|
package/dist/presets.mjs
CHANGED
|
@@ -1,177 +1,121 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
defuOverrideArray,
|
|
8
|
-
resolveUniUtsPlatform
|
|
9
|
-
} from "./chunk-OOHJLO5M.mjs";
|
|
10
|
-
import "./chunk-NNOQDMUP.mjs";
|
|
11
|
-
|
|
12
|
-
// src/presets/shared.ts
|
|
1
|
+
import { n as defuOverrideArray, o as resolveUniUtsPlatform } from "./utils-7DUGTFED.mjs";
|
|
2
|
+
import { a as resolveUniAppXOptions, r as resolveTailwindcssBasedir, t as logger } from "./logger-BoVx1Dbt.mjs";
|
|
3
|
+
import process from "node:process";
|
|
4
|
+
import { getPackageInfoSync } from "local-pkg";
|
|
5
|
+
//#region src/presets/shared.ts
|
|
13
6
|
function normalizeCssEntries(entries) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const normalized = Array.isArray(entries) ? entries : [entries];
|
|
18
|
-
return normalized.length > 0 ? normalized : void 0;
|
|
7
|
+
if (!entries) return;
|
|
8
|
+
const normalized = Array.isArray(entries) ? entries : [entries];
|
|
9
|
+
return normalized.length > 0 ? normalized : void 0;
|
|
19
10
|
}
|
|
20
11
|
function createBasePreset(options = {}) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const preset = {
|
|
46
|
-
tailwindcssBasedir: baseDir,
|
|
47
|
-
tailwindcss: tailwindConfig,
|
|
48
|
-
tailwindcssPatcherOptions: {
|
|
49
|
-
projectRoot: baseDir,
|
|
50
|
-
tailwindcss: patchTailwindConfig
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
const mergedUserOptions = defuOverrideArray(userOptions, rawOptions ?? {});
|
|
54
|
-
return defuOverrideArray(
|
|
55
|
-
mergedUserOptions,
|
|
56
|
-
preset
|
|
57
|
-
);
|
|
12
|
+
const { base, cssEntries, resolve, rawOptions, ...userOptions } = options;
|
|
13
|
+
const baseDir = resolveTailwindcssBasedir(base);
|
|
14
|
+
const normalizedCssEntries = normalizeCssEntries(cssEntries);
|
|
15
|
+
const tailwindConfig = {
|
|
16
|
+
v2: { cwd: baseDir },
|
|
17
|
+
v3: { cwd: baseDir },
|
|
18
|
+
v4: {
|
|
19
|
+
base: baseDir,
|
|
20
|
+
cssEntries: normalizedCssEntries
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
if (normalizedCssEntries && normalizedCssEntries.length > 0) tailwindConfig.version = 4;
|
|
24
|
+
const preset = {
|
|
25
|
+
tailwindcssBasedir: baseDir,
|
|
26
|
+
tailwindcss: tailwindConfig,
|
|
27
|
+
tailwindcssPatcherOptions: {
|
|
28
|
+
projectRoot: baseDir,
|
|
29
|
+
tailwindcss: resolve ? {
|
|
30
|
+
...tailwindConfig,
|
|
31
|
+
resolve
|
|
32
|
+
} : tailwindConfig
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
return defuOverrideArray(defuOverrideArray(userOptions, rawOptions ?? {}), preset);
|
|
58
36
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
import process from "process";
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/presets/uni-app.ts
|
|
62
39
|
function uniApp(options = {}) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
});
|
|
40
|
+
const uniPlatform = process.env.UNI_PLATFORM;
|
|
41
|
+
return createBasePreset({
|
|
42
|
+
disabled: uniPlatform === "h5" || uniPlatform === "app" || uniPlatform === "app-plus" ? true : void 0,
|
|
43
|
+
...options
|
|
44
|
+
});
|
|
69
45
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
import process2 from "process";
|
|
73
|
-
|
|
74
|
-
// src/tailwindcss/index.ts
|
|
75
|
-
import { getPackageInfoSync } from "local-pkg";
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/tailwindcss/index.ts
|
|
76
48
|
function getTailwindcssPackageInfo(options) {
|
|
77
|
-
|
|
49
|
+
return getPackageInfoSync("tailwindcss", options);
|
|
78
50
|
}
|
|
79
|
-
|
|
80
|
-
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/presets/uni-app-x.ts
|
|
81
53
|
function resolveTailwindResolveOptions(base, resolve) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
54
|
+
const currentPaths = Array.isArray(resolve?.paths) ? resolve.paths : [];
|
|
55
|
+
return {
|
|
56
|
+
...resolve ?? {},
|
|
57
|
+
paths: [...new Set([base, ...currentPaths])]
|
|
58
|
+
};
|
|
87
59
|
}
|
|
88
60
|
function resolveInstalledTailwindDefaults(resolve) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
if (major === 3) {
|
|
106
|
-
return {
|
|
107
|
-
version: 3,
|
|
108
|
-
packageName: "tailwindcss",
|
|
109
|
-
postcssPlugin: "tailwindcss"
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
return void 0;
|
|
61
|
+
const version = getTailwindcssPackageInfo(resolve)?.version;
|
|
62
|
+
if (!version) return;
|
|
63
|
+
const major = Number.parseInt(version.split(".")[0] ?? "", 10);
|
|
64
|
+
if (!Number.isFinite(major)) return;
|
|
65
|
+
if (major === 4) return {
|
|
66
|
+
version: 4,
|
|
67
|
+
packageName: "tailwindcss",
|
|
68
|
+
postcssPlugin: "@tailwindcss/postcss"
|
|
69
|
+
};
|
|
70
|
+
if (major === 3) return {
|
|
71
|
+
version: 3,
|
|
72
|
+
packageName: "tailwindcss",
|
|
73
|
+
postcssPlugin: "tailwindcss"
|
|
74
|
+
};
|
|
113
75
|
}
|
|
114
76
|
function uniAppX(options) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
},
|
|
158
|
-
cssPreflight: {
|
|
159
|
-
"border-style": false
|
|
160
|
-
},
|
|
161
|
-
cssPresetEnv: {
|
|
162
|
-
features: {
|
|
163
|
-
"custom-properties": {
|
|
164
|
-
preserve: false
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
},
|
|
168
|
-
...options.customAttributes ? { customAttributes: options.customAttributes } : {}
|
|
169
|
-
}
|
|
170
|
-
);
|
|
77
|
+
logger.info(`UNI_PLATFORM: ${process.env.UNI_PLATFORM}`);
|
|
78
|
+
const utsPlatform = resolveUniUtsPlatform();
|
|
79
|
+
const uniPlatform = resolveUniUtsPlatform(process.env.UNI_PLATFORM);
|
|
80
|
+
logger.info(`UNI_UTS_PLATFORM: ${utsPlatform.raw ?? "undefined"}`);
|
|
81
|
+
const isApp = utsPlatform.isApp || uniPlatform.isApp;
|
|
82
|
+
const cssEntries = normalizeCssEntries(options.cssEntries);
|
|
83
|
+
const resolvedResolve = resolveTailwindResolveOptions(options.base, options.resolve);
|
|
84
|
+
const installedTailwindDefaults = resolveInstalledTailwindDefaults(resolvedResolve);
|
|
85
|
+
const resolvedUniAppX = resolveUniAppXOptions({
|
|
86
|
+
enabled: isApp,
|
|
87
|
+
componentLocalStyles: options.componentLocalStyles ?? true,
|
|
88
|
+
uvueUnsupported: options.uvueUnsupported,
|
|
89
|
+
...typeof options.uniAppX === "object" ? options.uniAppX : {}
|
|
90
|
+
});
|
|
91
|
+
if (typeof options.uniAppX === "boolean") resolvedUniAppX.enabled = options.uniAppX;
|
|
92
|
+
return defuOverrideArray(options.rawOptions ?? {}, {
|
|
93
|
+
uniAppX: resolvedUniAppX,
|
|
94
|
+
...options.generator !== void 0 ? { generator: options.generator } : {},
|
|
95
|
+
rem2rpx: options.rem2rpx,
|
|
96
|
+
unitsToPx: options.unitsToPx,
|
|
97
|
+
tailwindcssBasedir: options.base,
|
|
98
|
+
tailwindcssPatcherOptions: {
|
|
99
|
+
projectRoot: options.base,
|
|
100
|
+
tailwindcss: {
|
|
101
|
+
...installedTailwindDefaults ?? {},
|
|
102
|
+
cwd: options.base,
|
|
103
|
+
resolve: resolvedResolve,
|
|
104
|
+
v3: { cwd: options.base },
|
|
105
|
+
v4: {
|
|
106
|
+
base: options.base,
|
|
107
|
+
cssEntries
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
tailwindcss: {
|
|
112
|
+
...installedTailwindDefaults ?? {},
|
|
113
|
+
resolve: resolvedResolve
|
|
114
|
+
},
|
|
115
|
+
cssPreflight: { "border-style": false },
|
|
116
|
+
cssPresetEnv: { features: { "custom-properties": { preserve: false } } },
|
|
117
|
+
...options.customAttributes ? { customAttributes: options.customAttributes } : {}
|
|
118
|
+
});
|
|
171
119
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
normalizeCssEntries,
|
|
175
|
-
uniApp,
|
|
176
|
-
uniAppX
|
|
177
|
-
};
|
|
120
|
+
//#endregion
|
|
121
|
+
export { createBasePreset, normalizeCssEntries, uniApp, uniAppX };
|