weapp-tailwindcss 4.12.0-next.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/bin/weapp-tailwindcss.js +21 -1
- 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 +2517 -1544
- package/dist/cli.mjs +2493 -1524
- 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 -87
- package/dist/weapp-tw-runtime-classset-loader.js +33 -47
- 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 +379 -481
- package/dist/webpack4.mjs +370 -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 +28 -13
- package/scripts/postinstall.mjs +59 -0
- package/dist/chunk-2LH6PZH3.mjs +0 -51
- package/dist/chunk-4AFQP74Z.js +0 -24
- package/dist/chunk-5ONE75V7.js +0 -2381
- package/dist/chunk-76S2EME4.mjs +0 -34
- package/dist/chunk-A5PB4KZT.js +0 -138
- package/dist/chunk-AYJ4HLWZ.mjs +0 -1508
- package/dist/chunk-DYLQ6UOI.js +0 -71
- package/dist/chunk-F2CKKG6Q.mjs +0 -171
- package/dist/chunk-F5XJWJYO.mjs +0 -582
- package/dist/chunk-FMK6SFQQ.js +0 -276
- package/dist/chunk-GC7WXUOW.js +0 -3906
- package/dist/chunk-GD4SQMVF.mjs +0 -2378
- package/dist/chunk-GMKSBLNY.js +0 -175
- package/dist/chunk-HL3US2OT.mjs +0 -10
- package/dist/chunk-LVSUBDJC.js +0 -579
- package/dist/chunk-NIS74SI6.js +0 -1511
- package/dist/chunk-OF6MFURR.js +0 -34
- package/dist/chunk-ONLKZIRQ.js +0 -7
- package/dist/chunk-OOHJLO5M.mjs +0 -71
- package/dist/chunk-OYSABARD.js +0 -51
- package/dist/chunk-QNRJCEZN.mjs +0 -3906
- package/dist/chunk-UUJWDME4.mjs +0 -276
- package/dist/chunk-WSS26HZS.js +0 -292
- package/dist/chunk-XAKAD2CR.mjs +0 -138
- package/dist/chunk-ZR3KN3FG.mjs +0 -292
- 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/chunk-FMK6SFQQ.js
DELETED
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
-
|
|
3
|
-
var _chunkOF6MFURRjs = require('./chunk-OF6MFURR.js');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var _chunkGC7WXUOWjs = require('./chunk-GC7WXUOW.js');
|
|
12
|
-
|
|
13
|
-
// src/bundlers/gulp/index.ts
|
|
14
|
-
var _buffer = require('buffer');
|
|
15
|
-
var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
16
|
-
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
17
|
-
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
18
|
-
var _stream = require('stream'); var _stream2 = _interopRequireDefault(_stream);
|
|
19
|
-
var debug = _chunkGC7WXUOWjs.createDebug.call(void 0, );
|
|
20
|
-
var Transform = _stream2.default.Transform;
|
|
21
|
-
function createPlugins(options = {}) {
|
|
22
|
-
const opts = _chunkGC7WXUOWjs.getCompilerContext.call(void 0, options);
|
|
23
|
-
const { templateHandler, styleHandler, jsHandler, cache, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
|
|
24
|
-
const patchRecorderState = _chunkGC7WXUOWjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
|
|
25
|
-
source: "runtime",
|
|
26
|
-
cwd: _nullishCoalesce(opts.tailwindcssBasedir, () => ( _process2.default.cwd()))
|
|
27
|
-
});
|
|
28
|
-
let runtimeSet = /* @__PURE__ */ new Set();
|
|
29
|
-
const runtimeState = {
|
|
30
|
-
twPatcher: initialTwPatcher,
|
|
31
|
-
patchPromise: patchRecorderState.patchPromise,
|
|
32
|
-
refreshTailwindcssPatcher,
|
|
33
|
-
onPatchCompleted: patchRecorderState.onPatchCompleted
|
|
34
|
-
};
|
|
35
|
-
const defaultStyleHandlerOptionsCache = /* @__PURE__ */ new Map();
|
|
36
|
-
let cachedDefaultTemplateHandlerOptions;
|
|
37
|
-
let cachedDefaultTemplateRuntimeSet;
|
|
38
|
-
let cachedDefaultModuleGraphOptions;
|
|
39
|
-
const MODULE_EXTENSIONS = [".js", ".mjs", ".cjs", ".ts", ".tsx", ".jsx"];
|
|
40
|
-
let runtimeSetInitialized = false;
|
|
41
|
-
async function refreshRuntimeState(force) {
|
|
42
|
-
await _chunkGC7WXUOWjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
|
|
43
|
-
}
|
|
44
|
-
async function refreshRuntimeSet(force = false) {
|
|
45
|
-
if (!force && runtimeSetInitialized) {
|
|
46
|
-
return runtimeSet;
|
|
47
|
-
}
|
|
48
|
-
runtimeSet = await _chunkGC7WXUOWjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
|
|
49
|
-
forceRefresh: force,
|
|
50
|
-
forceCollect: force,
|
|
51
|
-
clearCache: force,
|
|
52
|
-
allowEmpty: false
|
|
53
|
-
});
|
|
54
|
-
runtimeSetInitialized = true;
|
|
55
|
-
return runtimeSet;
|
|
56
|
-
}
|
|
57
|
-
function resolveWithExtensions(base) {
|
|
58
|
-
for (const ext of MODULE_EXTENSIONS) {
|
|
59
|
-
const candidate = `${base}${ext}`;
|
|
60
|
-
try {
|
|
61
|
-
if (_fs2.default.statSync(candidate).isFile()) {
|
|
62
|
-
return candidate;
|
|
63
|
-
}
|
|
64
|
-
} catch (e) {
|
|
65
|
-
continue;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return void 0;
|
|
69
|
-
}
|
|
70
|
-
function resolveLocalModuleCandidate(base) {
|
|
71
|
-
try {
|
|
72
|
-
const stat = _fs2.default.statSync(base);
|
|
73
|
-
if (stat.isFile()) {
|
|
74
|
-
return base;
|
|
75
|
-
}
|
|
76
|
-
if (stat.isDirectory()) {
|
|
77
|
-
const resolvedIndex = resolveWithExtensions(_path2.default.join(base, "index"));
|
|
78
|
-
if (resolvedIndex) {
|
|
79
|
-
return resolvedIndex;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
} catch (e2) {
|
|
83
|
-
}
|
|
84
|
-
if (!_path2.default.extname(base)) {
|
|
85
|
-
return resolveWithExtensions(base);
|
|
86
|
-
}
|
|
87
|
-
return void 0;
|
|
88
|
-
}
|
|
89
|
-
function createModuleGraphOptionsFor() {
|
|
90
|
-
return {
|
|
91
|
-
resolve(specifier, importer) {
|
|
92
|
-
if (!specifier) {
|
|
93
|
-
return void 0;
|
|
94
|
-
}
|
|
95
|
-
if (!specifier.startsWith(".") && !_path2.default.isAbsolute(specifier)) {
|
|
96
|
-
return void 0;
|
|
97
|
-
}
|
|
98
|
-
const normalized = _path2.default.resolve(_path2.default.dirname(importer), specifier);
|
|
99
|
-
return resolveLocalModuleCandidate(normalized);
|
|
100
|
-
},
|
|
101
|
-
load(id) {
|
|
102
|
-
try {
|
|
103
|
-
return _fs2.default.readFileSync(id, "utf8");
|
|
104
|
-
} catch (e3) {
|
|
105
|
-
return void 0;
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
filter(id) {
|
|
109
|
-
const relative = _path2.default.relative(_process2.default.cwd(), id);
|
|
110
|
-
return opts.jsMatcher(relative) || opts.wxsMatcher(relative);
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
function resolveModuleGraphOptions(moduleGraph) {
|
|
115
|
-
if (moduleGraph) {
|
|
116
|
-
return moduleGraph;
|
|
117
|
-
}
|
|
118
|
-
if (!cachedDefaultModuleGraphOptions) {
|
|
119
|
-
cachedDefaultModuleGraphOptions = createModuleGraphOptionsFor();
|
|
120
|
-
}
|
|
121
|
-
return cachedDefaultModuleGraphOptions;
|
|
122
|
-
}
|
|
123
|
-
function createVinylTransform(handler) {
|
|
124
|
-
return new Transform({
|
|
125
|
-
objectMode: true,
|
|
126
|
-
async transform(file, _encoding, callback) {
|
|
127
|
-
try {
|
|
128
|
-
await handler(file);
|
|
129
|
-
callback(null, file);
|
|
130
|
-
} catch (error) {
|
|
131
|
-
callback(error, file);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
function resolveWxssHandlerOptions(options2) {
|
|
137
|
-
const majorVersion = _nullishCoalesce(runtimeState.twPatcher.majorVersion, () => ( "unknown"));
|
|
138
|
-
if (!options2 || Object.keys(options2).length === 0) {
|
|
139
|
-
let cached = defaultStyleHandlerOptionsCache.get(majorVersion);
|
|
140
|
-
if (!cached) {
|
|
141
|
-
cached = {
|
|
142
|
-
isMainChunk: true,
|
|
143
|
-
majorVersion: runtimeState.twPatcher.majorVersion
|
|
144
|
-
};
|
|
145
|
-
defaultStyleHandlerOptionsCache.set(majorVersion, cached);
|
|
146
|
-
}
|
|
147
|
-
return cached;
|
|
148
|
-
}
|
|
149
|
-
return {
|
|
150
|
-
isMainChunk: true,
|
|
151
|
-
majorVersion: runtimeState.twPatcher.majorVersion,
|
|
152
|
-
...options2
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
function resolveWxmlHandlerOptions(options2) {
|
|
156
|
-
if (!options2 || Object.keys(options2).length === 0) {
|
|
157
|
-
if (cachedDefaultTemplateRuntimeSet !== runtimeSet || !cachedDefaultTemplateHandlerOptions) {
|
|
158
|
-
cachedDefaultTemplateRuntimeSet = runtimeSet;
|
|
159
|
-
cachedDefaultTemplateHandlerOptions = {
|
|
160
|
-
runtimeSet
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
return cachedDefaultTemplateHandlerOptions;
|
|
164
|
-
}
|
|
165
|
-
return {
|
|
166
|
-
runtimeSet,
|
|
167
|
-
...options2
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
const transformWxss = (options2 = {}) => createVinylTransform(async (file) => {
|
|
171
|
-
if (!file.contents) {
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
await refreshRuntimeState(true);
|
|
175
|
-
await runtimeState.patchPromise;
|
|
176
|
-
const rawSource = file.contents.toString();
|
|
177
|
-
await _chunkOF6MFURRjs.processCachedTask.call(void 0, {
|
|
178
|
-
cache,
|
|
179
|
-
cacheKey: file.path,
|
|
180
|
-
rawSource,
|
|
181
|
-
applyResult(source) {
|
|
182
|
-
file.contents = _buffer.Buffer.from(source);
|
|
183
|
-
},
|
|
184
|
-
onCacheHit() {
|
|
185
|
-
debug("css cache hit: %s", file.path);
|
|
186
|
-
},
|
|
187
|
-
async transform() {
|
|
188
|
-
await runtimeState.patchPromise;
|
|
189
|
-
const { css } = await styleHandler(rawSource, resolveWxssHandlerOptions(options2));
|
|
190
|
-
debug("css handle: %s", file.path);
|
|
191
|
-
return {
|
|
192
|
-
result: css
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
});
|
|
197
|
-
const transformJs = (options2 = {}) => createVinylTransform(async (file) => {
|
|
198
|
-
if (!file.contents) {
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
201
|
-
await refreshRuntimeSet(false);
|
|
202
|
-
await runtimeState.patchPromise;
|
|
203
|
-
const filename = _path2.default.resolve(file.path);
|
|
204
|
-
const moduleGraph = resolveModuleGraphOptions(options2.moduleGraph);
|
|
205
|
-
const handlerOptions = {
|
|
206
|
-
...options2,
|
|
207
|
-
filename,
|
|
208
|
-
moduleGraph,
|
|
209
|
-
tailwindcssMajorVersion: runtimeState.twPatcher.majorVersion,
|
|
210
|
-
babelParserOptions: {
|
|
211
|
-
..._nullishCoalesce(_optionalChain([options2, 'optionalAccess', _ => _.babelParserOptions]), () => ( {})),
|
|
212
|
-
sourceFilename: filename
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
const rawSource = file.contents.toString();
|
|
216
|
-
await _chunkOF6MFURRjs.processCachedTask.call(void 0, {
|
|
217
|
-
cache,
|
|
218
|
-
cacheKey: file.path,
|
|
219
|
-
rawSource,
|
|
220
|
-
applyResult(source) {
|
|
221
|
-
file.contents = _buffer.Buffer.from(source);
|
|
222
|
-
},
|
|
223
|
-
onCacheHit() {
|
|
224
|
-
debug("js cache hit: %s", file.path);
|
|
225
|
-
},
|
|
226
|
-
async transform() {
|
|
227
|
-
await runtimeState.patchPromise;
|
|
228
|
-
const currentSource = _nullishCoalesce(_optionalChain([file, 'access', _2 => _2.contents, 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]), () => ( rawSource));
|
|
229
|
-
if (_chunkGC7WXUOWjs.shouldSkipJsTransform.call(void 0, currentSource, handlerOptions)) {
|
|
230
|
-
return { result: currentSource };
|
|
231
|
-
}
|
|
232
|
-
const { code } = await jsHandler(currentSource, runtimeSet, handlerOptions);
|
|
233
|
-
debug("js handle: %s", file.path);
|
|
234
|
-
return {
|
|
235
|
-
result: code
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
});
|
|
239
|
-
});
|
|
240
|
-
const transformWxml = (options2 = {}) => createVinylTransform(async (file) => {
|
|
241
|
-
if (!file.contents) {
|
|
242
|
-
return;
|
|
243
|
-
}
|
|
244
|
-
await refreshRuntimeSet(false);
|
|
245
|
-
await runtimeState.patchPromise;
|
|
246
|
-
const rawSource = file.contents.toString();
|
|
247
|
-
await _chunkOF6MFURRjs.processCachedTask.call(void 0, {
|
|
248
|
-
cache,
|
|
249
|
-
cacheKey: file.path,
|
|
250
|
-
rawSource,
|
|
251
|
-
applyResult(source) {
|
|
252
|
-
file.contents = _buffer.Buffer.from(source);
|
|
253
|
-
},
|
|
254
|
-
onCacheHit() {
|
|
255
|
-
debug("html cache hit: %s", file.path);
|
|
256
|
-
},
|
|
257
|
-
async transform() {
|
|
258
|
-
await runtimeState.patchPromise;
|
|
259
|
-
const code = await templateHandler(rawSource, resolveWxmlHandlerOptions(options2));
|
|
260
|
-
debug("html handle: %s", file.path);
|
|
261
|
-
return {
|
|
262
|
-
result: code
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
|
-
});
|
|
267
|
-
return {
|
|
268
|
-
transformWxss,
|
|
269
|
-
transformWxml,
|
|
270
|
-
transformJs
|
|
271
|
-
};
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
exports.createPlugins = createPlugins;
|