weapp-tailwindcss 3.7.0 → 3.8.0-alpha.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/README.md +1 -23
- package/dist/chunk-2STNBSVB.js +216 -0
- package/dist/chunk-35CYTBPM.js +26 -0
- package/dist/chunk-6FNC3XMI.js +45 -0
- package/dist/chunk-6Z776ZWK.js +43 -0
- package/dist/chunk-75EWCRQW.mjs +13 -0
- package/dist/chunk-AB467PG7.mjs +43 -0
- package/dist/chunk-AXBFBHS2.mjs +45 -0
- package/dist/chunk-EODGLB63.mjs +173 -0
- package/dist/chunk-FG63RW47.mjs +7106 -0
- package/dist/chunk-HBQASQKY.js +13 -0
- package/dist/chunk-IETFIAKJ.js +152 -0
- package/dist/chunk-KE7J6XFD.mjs +537 -0
- package/dist/chunk-LQN2VTMU.js +537 -0
- package/dist/chunk-LWRZXI5T.js +1003 -0
- package/dist/chunk-MUJ65IQ3.mjs +26 -0
- package/dist/chunk-MWTUP5KG.mjs +1003 -0
- package/dist/chunk-NLFQ7XRK.mjs +152 -0
- package/dist/chunk-QEEWOML6.mjs +216 -0
- package/dist/chunk-RFNUATFD.js +24 -0
- package/dist/chunk-U7O2XXYR.mjs +24 -0
- package/dist/chunk-VKSQ6BRD.mjs +27 -0
- package/dist/chunk-XSZXPWWL.js +27 -0
- package/dist/chunk-YSEHQ3FF.js +173 -0
- package/dist/chunk-YYT4NLHK.js +7109 -0
- package/dist/cli.d.mts +2 -0
- package/dist/cli.d.ts +2 -1
- package/dist/cli.js +23 -3400
- package/dist/cli.mjs +28 -3392
- package/dist/core.d.mts +27 -0
- package/dist/core.d.ts +23 -4
- package/dist/core.js +34 -56
- package/dist/core.mjs +36 -54
- package/dist/css-macro/postcss.d.mts +7 -0
- package/dist/css-macro/postcss.d.ts +5 -3
- package/dist/css-macro/postcss.js +54 -45
- package/dist/css-macro/postcss.mjs +54 -45
- package/dist/css-macro.d.mts +18 -0
- package/dist/css-macro.d.ts +18 -0
- package/dist/css-macro.js +40 -0
- package/dist/css-macro.mjs +38 -0
- package/dist/defaults.d.mts +16 -0
- package/dist/defaults.d.ts +16 -2
- package/dist/defaults.js +5 -9
- package/dist/defaults.mjs +8 -4
- package/dist/escape.d.mts +19 -0
- package/dist/escape.d.ts +19 -4
- package/dist/escape.js +11 -0
- package/dist/escape.mjs +11 -0
- package/dist/gulp.d.mts +26 -0
- package/dist/gulp.d.ts +26 -1
- package/dist/gulp.js +11 -36
- package/dist/gulp.mjs +14 -31
- package/dist/index-g4epDIUu.d.mts +534 -0
- package/dist/index-g4epDIUu.d.ts +534 -0
- package/dist/index.d.mts +17 -0
- package/dist/index.d.ts +17 -4
- package/dist/index.js +22 -44
- package/dist/index.mjs +22 -34
- package/dist/postcss.d.mts +28 -0
- package/dist/postcss.d.ts +28 -1
- package/dist/postcss.js +9 -24
- package/dist/postcss.mjs +16 -8
- package/dist/replace.d.mts +22 -0
- package/dist/replace.d.ts +22 -3
- package/dist/replace.js +33 -50
- package/dist/replace.mjs +32 -25
- package/dist/shared-5ArEo9kL.d.mts +5 -0
- package/dist/shared-DI2Qz1ou.d.ts +5 -0
- package/dist/vite.d.mts +22 -0
- package/dist/vite.d.ts +22 -1
- package/dist/vite.js +11 -34
- package/dist/vite.mjs +14 -29
- package/dist/weapp-tw-runtime-loader.d.mts +7 -0
- package/dist/{bundlers/webpack/loaders/weapp-tw-runtime-loader.d.ts → weapp-tw-runtime-loader.d.ts} +4 -2
- package/dist/weapp-tw-runtime-loader.js +12 -12
- package/dist/weapp-tw-runtime-loader.mjs +12 -8
- package/dist/webpack.d.mts +26 -0
- package/dist/webpack.d.ts +26 -1
- package/dist/webpack.js +11 -35
- package/dist/webpack.mjs +14 -30
- package/dist/webpack4.d.mts +27 -0
- package/dist/webpack4.d.ts +27 -1
- package/dist/webpack4.js +204 -192
- package/dist/webpack4.mjs +210 -189
- package/package.json +29 -19
- package/dist/babel/index.d.ts +0 -5
- package/dist/bundlers/gulp/index.d.ts +0 -7
- package/dist/bundlers/vite/index.d.ts +0 -3
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +0 -8
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +0 -8
- package/dist/bundlers/webpack/index.d.ts +0 -1
- package/dist/cache/index.d.ts +0 -31
- package/dist/constants-CFM1J-h1.js +0 -42
- package/dist/constants-Dy2Dd3Fz.mjs +0 -36
- package/dist/constants.d.ts +0 -7
- package/dist/css-macro/constants.d.ts +0 -14
- package/dist/css-macro/index.d.ts +0 -15
- package/dist/css-macro/index.js +0 -36
- package/dist/css-macro/index.mjs +0 -30
- package/dist/debug/index.d.ts +0 -2
- package/dist/defaults-5A8JI2hW.mjs +0 -139
- package/dist/defaults-CdqzSWsR.js +0 -145
- package/dist/defu-Cdz2PomB.js +0 -60
- package/dist/defu-n46TJT6t.mjs +0 -57
- package/dist/env.d.ts +0 -2
- package/dist/extractors/split.d.ts +0 -3
- package/dist/index-BEIjgKpF.mjs +0 -11
- package/dist/index-BF8k8rHr.mjs +0 -517
- package/dist/index-BTXkyxen.js +0 -136
- package/dist/index-C0QsyqD6.mjs +0 -134
- package/dist/index-ClSBbhnm.js +0 -130
- package/dist/index-DoMb0-xW.mjs +0 -124
- package/dist/index-HC-Qkn0i.js +0 -17
- package/dist/index-h2-ZMO3S.js +0 -530
- package/dist/init.d.ts +0 -34
- package/dist/js/ast-grep.d.ts +0 -1
- package/dist/js/babel.d.ts +0 -3
- package/dist/js/handlers.d.ts +0 -11
- package/dist/js/index.d.ts +0 -7
- package/dist/logger.d.ts +0 -1
- package/dist/mangle/index.d.ts +0 -8
- package/dist/npm.d.ts +0 -22
- package/dist/options-Bv-1GQJY.js +0 -891
- package/dist/options-yXyCFCtr.mjs +0 -858
- package/dist/options.d.ts +0 -2
- package/dist/postcss/cssVars.d.ts +0 -5
- package/dist/postcss/index.d.ts +0 -4
- package/dist/postcss/mp.d.ts +0 -8
- package/dist/postcss/plugins/ctx.d.ts +0 -6
- package/dist/postcss/plugins/index.d.ts +0 -7
- package/dist/postcss/plugins/post.d.ts +0 -5
- package/dist/postcss/plugins/pre.d.ts +0 -5
- package/dist/postcss/preflight.d.ts +0 -3
- package/dist/postcss/selectorParser.d.ts +0 -6
- package/dist/postcss/shared.d.ts +0 -3
- package/dist/postcss/symbols.d.ts +0 -1
- package/dist/reg.d.ts +0 -1
- package/dist/shared-COWjpokr.mjs +0 -25
- package/dist/shared-r_GpWheO.js +0 -28
- package/dist/tailwindcss/patcher.d.ts +0 -3
- package/dist/types.d.ts +0 -165
- package/dist/utils.d.ts +0 -18
- package/dist/v5-DwFXG7m_.js +0 -181
- package/dist/v5-N5BYJ5JY.mjs +0 -174
- package/dist/wxml/Tokenizer.d.ts +0 -31
- package/dist/wxml/index.d.ts +0 -2
- package/dist/wxml/shared.d.ts +0 -2
- package/dist/wxml/utils.d.ts +0 -10
package/dist/index-C0QsyqD6.mjs
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { g as getOptions, _ as __awaiter } from './options-yXyCFCtr.mjs';
|
|
2
|
-
import { v as vitePluginName } from './index-BF8k8rHr.mjs';
|
|
3
|
-
import { c as createDebug } from './index-BEIjgKpF.mjs';
|
|
4
|
-
import { g as getGroupedEntries } from './defaults-5A8JI2hW.mjs';
|
|
5
|
-
|
|
6
|
-
const debug = createDebug();
|
|
7
|
-
function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
8
|
-
const opts = getOptions(options);
|
|
9
|
-
const { disabled, onEnd, onLoad, onStart, onUpdate, templateHandler, styleHandler, patch, jsHandler, mainCssChunkMatcher, appType, setMangleRuntimeSet, cache, twPatcher, } = opts;
|
|
10
|
-
if (disabled) {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
patch === null || patch === void 0 ? void 0 : patch();
|
|
14
|
-
onLoad();
|
|
15
|
-
return {
|
|
16
|
-
name: vitePluginName,
|
|
17
|
-
enforce: 'post',
|
|
18
|
-
generateBundle(_opt, bundle) {
|
|
19
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
debug('start');
|
|
21
|
-
onStart();
|
|
22
|
-
const entries = Object.entries(bundle);
|
|
23
|
-
const groupedEntries = getGroupedEntries(entries, opts);
|
|
24
|
-
const runtimeSet = twPatcher.getClassSet();
|
|
25
|
-
setMangleRuntimeSet(runtimeSet);
|
|
26
|
-
debug('get runtimeSet, class count: %d', runtimeSet.size);
|
|
27
|
-
if (Array.isArray(groupedEntries.html)) {
|
|
28
|
-
let noCachedCount = 0;
|
|
29
|
-
for (let i = 0; i < groupedEntries.html.length; i++) {
|
|
30
|
-
const [file, originalSource] = groupedEntries.html[i];
|
|
31
|
-
const oldVal = originalSource.source.toString();
|
|
32
|
-
const hash = cache.computeHash(oldVal);
|
|
33
|
-
cache.calcHashValueChanged(file, hash);
|
|
34
|
-
yield cache.process(file, () => {
|
|
35
|
-
const source = cache.get(file);
|
|
36
|
-
if (source) {
|
|
37
|
-
originalSource.source = source;
|
|
38
|
-
debug('html cache hit: %s', file);
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
}, () => __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
originalSource.source = yield templateHandler(oldVal, {
|
|
45
|
-
runtimeSet,
|
|
46
|
-
});
|
|
47
|
-
onUpdate(file, oldVal, originalSource.source);
|
|
48
|
-
debug('html handle: %s', file);
|
|
49
|
-
noCachedCount++;
|
|
50
|
-
return {
|
|
51
|
-
key: file,
|
|
52
|
-
source: originalSource.source,
|
|
53
|
-
};
|
|
54
|
-
}));
|
|
55
|
-
}
|
|
56
|
-
debug('html handle finish, total: %d, no-cached: %d', groupedEntries.html.length, noCachedCount);
|
|
57
|
-
}
|
|
58
|
-
if (Array.isArray(groupedEntries.js)) {
|
|
59
|
-
let noCachedCount = 0;
|
|
60
|
-
for (let i = 0; i < groupedEntries.js.length; i++) {
|
|
61
|
-
const [file, originalSource] = groupedEntries.js[i];
|
|
62
|
-
const rawSource = originalSource.code;
|
|
63
|
-
const hash = cache.computeHash(rawSource);
|
|
64
|
-
cache.calcHashValueChanged(file, hash);
|
|
65
|
-
yield cache.process(file, () => {
|
|
66
|
-
const source = cache.get(file);
|
|
67
|
-
if (source) {
|
|
68
|
-
originalSource.code = source;
|
|
69
|
-
debug('js cache hit: %s', file);
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
}, () => __awaiter(this, void 0, void 0, function* () {
|
|
75
|
-
const mapFilename = `${file}.map`;
|
|
76
|
-
const hasMap = Boolean(bundle[mapFilename]);
|
|
77
|
-
const { code, map } = yield jsHandler(rawSource, runtimeSet, {
|
|
78
|
-
generateMap: hasMap,
|
|
79
|
-
});
|
|
80
|
-
originalSource.code = code;
|
|
81
|
-
onUpdate(file, rawSource, code);
|
|
82
|
-
debug('js handle: %s', file);
|
|
83
|
-
noCachedCount++;
|
|
84
|
-
if (hasMap && map) {
|
|
85
|
-
bundle[mapFilename].source = map.toString();
|
|
86
|
-
}
|
|
87
|
-
return {
|
|
88
|
-
key: file,
|
|
89
|
-
source: code,
|
|
90
|
-
};
|
|
91
|
-
}));
|
|
92
|
-
}
|
|
93
|
-
debug('js handle finish, total: %d, no-cached: %d', groupedEntries.js.length, noCachedCount);
|
|
94
|
-
}
|
|
95
|
-
if (Array.isArray(groupedEntries.css)) {
|
|
96
|
-
let noCachedCount = 0;
|
|
97
|
-
for (let i = 0; i < groupedEntries.css.length; i++) {
|
|
98
|
-
const [file, originalSource] = groupedEntries.css[i];
|
|
99
|
-
const rawSource = originalSource.source.toString();
|
|
100
|
-
const hash = cache.computeHash(rawSource);
|
|
101
|
-
cache.calcHashValueChanged(file, hash);
|
|
102
|
-
yield cache.process(file, () => {
|
|
103
|
-
const source = cache.get(file);
|
|
104
|
-
if (source) {
|
|
105
|
-
originalSource.source = source;
|
|
106
|
-
debug('css cache hit: %s', file);
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
return false;
|
|
110
|
-
}
|
|
111
|
-
}, () => __awaiter(this, void 0, void 0, function* () {
|
|
112
|
-
const { css } = yield styleHandler(rawSource, {
|
|
113
|
-
isMainChunk: mainCssChunkMatcher(originalSource.fileName, appType),
|
|
114
|
-
});
|
|
115
|
-
originalSource.source = css;
|
|
116
|
-
onUpdate(file, rawSource, css);
|
|
117
|
-
debug('css handle: %s', file);
|
|
118
|
-
noCachedCount++;
|
|
119
|
-
return {
|
|
120
|
-
key: file,
|
|
121
|
-
source: css,
|
|
122
|
-
};
|
|
123
|
-
}));
|
|
124
|
-
}
|
|
125
|
-
debug('css handle finish, total: %d, no-cached: %d', groupedEntries.css.length, noCachedCount);
|
|
126
|
-
}
|
|
127
|
-
onEnd();
|
|
128
|
-
debug('end');
|
|
129
|
-
});
|
|
130
|
-
},
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
export { UnifiedViteWeappTailwindcssPlugin as U };
|
package/dist/index-ClSBbhnm.js
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var options = require('./options-Bv-1GQJY.js');
|
|
4
|
-
var node_buffer = require('node:buffer');
|
|
5
|
-
var stream = require('node:stream');
|
|
6
|
-
var index = require('./index-HC-Qkn0i.js');
|
|
7
|
-
|
|
8
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
9
|
-
|
|
10
|
-
var stream__default = /*#__PURE__*/_interopDefaultCompat(stream);
|
|
11
|
-
|
|
12
|
-
const debug = index.createDebug();
|
|
13
|
-
const Transform = stream__default["default"].Transform;
|
|
14
|
-
function createPlugins(options$1 = {}) {
|
|
15
|
-
const opts = options.getOptions(options$1);
|
|
16
|
-
const { templateHandler, styleHandler, patch, jsHandler, setMangleRuntimeSet, cache, twPatcher } = opts;
|
|
17
|
-
let runtimeSet = new Set();
|
|
18
|
-
patch === null || patch === void 0 ? void 0 : patch();
|
|
19
|
-
function transformWxss(options$1 = {}) {
|
|
20
|
-
return new Transform({
|
|
21
|
-
objectMode: true,
|
|
22
|
-
transform(file, _encoding, callback) {
|
|
23
|
-
return options.__awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
runtimeSet = twPatcher.getClassSet();
|
|
25
|
-
setMangleRuntimeSet(runtimeSet);
|
|
26
|
-
const error = null;
|
|
27
|
-
if (file.contents) {
|
|
28
|
-
const rawSource = file.contents.toString();
|
|
29
|
-
const hash = cache.computeHash(rawSource);
|
|
30
|
-
cache.calcHashValueChanged(file.path, hash);
|
|
31
|
-
yield cache.process(file.path, () => {
|
|
32
|
-
const source = cache.get(file.path);
|
|
33
|
-
if (source) {
|
|
34
|
-
file.contents = node_buffer.Buffer.from(source);
|
|
35
|
-
debug('css cache hit: %s', file.path);
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
}, () => options.__awaiter(this, void 0, void 0, function* () {
|
|
41
|
-
const { css } = yield styleHandler(rawSource, Object.assign({ isMainChunk: true }, options$1));
|
|
42
|
-
file.contents = node_buffer.Buffer.from(css);
|
|
43
|
-
debug('css handle: %s', file.path);
|
|
44
|
-
return {
|
|
45
|
-
key: file.path,
|
|
46
|
-
source: css,
|
|
47
|
-
};
|
|
48
|
-
}));
|
|
49
|
-
}
|
|
50
|
-
callback(error, file);
|
|
51
|
-
});
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
function transformJs(options$1 = {}) {
|
|
56
|
-
return new Transform({
|
|
57
|
-
objectMode: true,
|
|
58
|
-
transform(file, _encoding, callback) {
|
|
59
|
-
return options.__awaiter(this, void 0, void 0, function* () {
|
|
60
|
-
const error = null;
|
|
61
|
-
if (file.contents) {
|
|
62
|
-
const rawSource = file.contents.toString();
|
|
63
|
-
const hash = cache.computeHash(rawSource);
|
|
64
|
-
cache.calcHashValueChanged(file.path, hash);
|
|
65
|
-
yield cache.process(file.path, () => {
|
|
66
|
-
const source = cache.get(file.path);
|
|
67
|
-
if (source) {
|
|
68
|
-
file.contents = node_buffer.Buffer.from(source);
|
|
69
|
-
debug('js cache hit: %s', file.path);
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
}, () => options.__awaiter(this, void 0, void 0, function* () {
|
|
75
|
-
const { code } = yield jsHandler(rawSource, runtimeSet, options$1);
|
|
76
|
-
file.contents = node_buffer.Buffer.from(code);
|
|
77
|
-
debug('js handle: %s', file.path);
|
|
78
|
-
return {
|
|
79
|
-
key: file.path,
|
|
80
|
-
source: code,
|
|
81
|
-
};
|
|
82
|
-
}));
|
|
83
|
-
}
|
|
84
|
-
callback(error, file);
|
|
85
|
-
});
|
|
86
|
-
},
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
function transformWxml(options$1 = {}) {
|
|
90
|
-
return new Transform({
|
|
91
|
-
objectMode: true,
|
|
92
|
-
transform(file, _encoding, callback) {
|
|
93
|
-
return options.__awaiter(this, void 0, void 0, function* () {
|
|
94
|
-
const error = null;
|
|
95
|
-
if (file.contents) {
|
|
96
|
-
const rawSource = file.contents.toString();
|
|
97
|
-
const hash = cache.computeHash(rawSource);
|
|
98
|
-
cache.calcHashValueChanged(file.path, hash);
|
|
99
|
-
yield cache.process(file.path, () => {
|
|
100
|
-
const source = cache.get(file.path);
|
|
101
|
-
if (source) {
|
|
102
|
-
file.contents = node_buffer.Buffer.from(source);
|
|
103
|
-
debug('html cache hit: %s', file.path);
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
return false;
|
|
107
|
-
}
|
|
108
|
-
}, () => options.__awaiter(this, void 0, void 0, function* () {
|
|
109
|
-
const code = yield templateHandler(rawSource, Object.assign({ runtimeSet }, options$1));
|
|
110
|
-
file.contents = node_buffer.Buffer.from(code);
|
|
111
|
-
debug('html handle: %s', file.path);
|
|
112
|
-
return {
|
|
113
|
-
key: file.path,
|
|
114
|
-
source: code,
|
|
115
|
-
};
|
|
116
|
-
}));
|
|
117
|
-
}
|
|
118
|
-
callback(error, file);
|
|
119
|
-
});
|
|
120
|
-
},
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
return {
|
|
124
|
-
transformWxss,
|
|
125
|
-
transformWxml,
|
|
126
|
-
transformJs,
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
exports.createPlugins = createPlugins;
|
package/dist/index-DoMb0-xW.mjs
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { g as getOptions, _ as __awaiter } from './options-yXyCFCtr.mjs';
|
|
2
|
-
import { Buffer } from 'node:buffer';
|
|
3
|
-
import stream from 'node:stream';
|
|
4
|
-
import { c as createDebug } from './index-BEIjgKpF.mjs';
|
|
5
|
-
|
|
6
|
-
const debug = createDebug();
|
|
7
|
-
const Transform = stream.Transform;
|
|
8
|
-
function createPlugins(options = {}) {
|
|
9
|
-
const opts = getOptions(options);
|
|
10
|
-
const { templateHandler, styleHandler, patch, jsHandler, setMangleRuntimeSet, cache, twPatcher } = opts;
|
|
11
|
-
let runtimeSet = new Set();
|
|
12
|
-
patch === null || patch === void 0 ? void 0 : patch();
|
|
13
|
-
function transformWxss(options = {}) {
|
|
14
|
-
return new Transform({
|
|
15
|
-
objectMode: true,
|
|
16
|
-
transform(file, _encoding, callback) {
|
|
17
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
-
runtimeSet = twPatcher.getClassSet();
|
|
19
|
-
setMangleRuntimeSet(runtimeSet);
|
|
20
|
-
const error = null;
|
|
21
|
-
if (file.contents) {
|
|
22
|
-
const rawSource = file.contents.toString();
|
|
23
|
-
const hash = cache.computeHash(rawSource);
|
|
24
|
-
cache.calcHashValueChanged(file.path, hash);
|
|
25
|
-
yield cache.process(file.path, () => {
|
|
26
|
-
const source = cache.get(file.path);
|
|
27
|
-
if (source) {
|
|
28
|
-
file.contents = Buffer.from(source);
|
|
29
|
-
debug('css cache hit: %s', file.path);
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
}, () => __awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
const { css } = yield styleHandler(rawSource, Object.assign({ isMainChunk: true }, options));
|
|
36
|
-
file.contents = Buffer.from(css);
|
|
37
|
-
debug('css handle: %s', file.path);
|
|
38
|
-
return {
|
|
39
|
-
key: file.path,
|
|
40
|
-
source: css,
|
|
41
|
-
};
|
|
42
|
-
}));
|
|
43
|
-
}
|
|
44
|
-
callback(error, file);
|
|
45
|
-
});
|
|
46
|
-
},
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
function transformJs(options = {}) {
|
|
50
|
-
return new Transform({
|
|
51
|
-
objectMode: true,
|
|
52
|
-
transform(file, _encoding, callback) {
|
|
53
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
-
const error = null;
|
|
55
|
-
if (file.contents) {
|
|
56
|
-
const rawSource = file.contents.toString();
|
|
57
|
-
const hash = cache.computeHash(rawSource);
|
|
58
|
-
cache.calcHashValueChanged(file.path, hash);
|
|
59
|
-
yield cache.process(file.path, () => {
|
|
60
|
-
const source = cache.get(file.path);
|
|
61
|
-
if (source) {
|
|
62
|
-
file.contents = Buffer.from(source);
|
|
63
|
-
debug('js cache hit: %s', file.path);
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
return false;
|
|
67
|
-
}
|
|
68
|
-
}, () => __awaiter(this, void 0, void 0, function* () {
|
|
69
|
-
const { code } = yield jsHandler(rawSource, runtimeSet, options);
|
|
70
|
-
file.contents = Buffer.from(code);
|
|
71
|
-
debug('js handle: %s', file.path);
|
|
72
|
-
return {
|
|
73
|
-
key: file.path,
|
|
74
|
-
source: code,
|
|
75
|
-
};
|
|
76
|
-
}));
|
|
77
|
-
}
|
|
78
|
-
callback(error, file);
|
|
79
|
-
});
|
|
80
|
-
},
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
function transformWxml(options = {}) {
|
|
84
|
-
return new Transform({
|
|
85
|
-
objectMode: true,
|
|
86
|
-
transform(file, _encoding, callback) {
|
|
87
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
-
const error = null;
|
|
89
|
-
if (file.contents) {
|
|
90
|
-
const rawSource = file.contents.toString();
|
|
91
|
-
const hash = cache.computeHash(rawSource);
|
|
92
|
-
cache.calcHashValueChanged(file.path, hash);
|
|
93
|
-
yield cache.process(file.path, () => {
|
|
94
|
-
const source = cache.get(file.path);
|
|
95
|
-
if (source) {
|
|
96
|
-
file.contents = Buffer.from(source);
|
|
97
|
-
debug('html cache hit: %s', file.path);
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
return false;
|
|
101
|
-
}
|
|
102
|
-
}, () => __awaiter(this, void 0, void 0, function* () {
|
|
103
|
-
const code = yield templateHandler(rawSource, Object.assign({ runtimeSet }, options));
|
|
104
|
-
file.contents = Buffer.from(code);
|
|
105
|
-
debug('html handle: %s', file.path);
|
|
106
|
-
return {
|
|
107
|
-
key: file.path,
|
|
108
|
-
source: code,
|
|
109
|
-
};
|
|
110
|
-
}));
|
|
111
|
-
}
|
|
112
|
-
callback(error, file);
|
|
113
|
-
});
|
|
114
|
-
},
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
return {
|
|
118
|
-
transformWxss,
|
|
119
|
-
transformWxml,
|
|
120
|
-
transformJs,
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export { createPlugins as c };
|
package/dist/index-HC-Qkn0i.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var _createDebug = require('debug');
|
|
4
|
-
|
|
5
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
6
|
-
|
|
7
|
-
var _createDebug__default = /*#__PURE__*/_interopDefaultCompat(_createDebug);
|
|
8
|
-
|
|
9
|
-
const _debug = _createDebug__default["default"]('weapp-tw');
|
|
10
|
-
function createDebug(prefix) {
|
|
11
|
-
function debug(formatter, ...args) {
|
|
12
|
-
return _debug(('') + formatter, ...args);
|
|
13
|
-
}
|
|
14
|
-
return debug;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
exports.createDebug = createDebug;
|