weapp-tailwindcss 3.4.0-alpha.0 → 3.4.0-alpha.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 +16 -0
- package/dist/bundlers/gulp/index.d.ts +8 -0
- package/dist/bundlers/vite/index.d.ts +3 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +8 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +8 -0
- package/dist/bundlers/webpack/index.d.ts +1 -0
- package/dist/{weapp-tw-runtime-loader.d.ts → bundlers/webpack/loaders/weapp-tw-runtime-loader.d.ts} +2 -4
- package/dist/cache/index.d.ts +32 -0
- package/dist/cli.d.ts +1 -2
- package/dist/cli.js +51 -1760
- package/dist/cli.mjs +45 -34
- package/dist/constants-CFM1J-h1.js +42 -0
- package/dist/constants-Dy2Dd3Fz.mjs +36 -0
- package/dist/constants.d.ts +7 -0
- package/dist/core.d.ts +2 -16
- package/dist/core.js +60 -1775
- package/dist/core.mjs +60 -46
- package/dist/css-macro/constants.d.ts +14 -0
- package/dist/css-macro/index.d.ts +4 -7
- package/dist/css-macro/index.js +30 -140
- package/dist/css-macro/index.mjs +28 -35
- package/dist/css-macro/postcss.d.ts +3 -5
- package/dist/css-macro/postcss.js +46 -99
- package/dist/css-macro/postcss.mjs +45 -54
- package/dist/debug/index.d.ts +2 -0
- package/dist/defaults-DW-EahCC.js +145 -0
- package/dist/defaults-w3rlKQwe.mjs +139 -0
- package/dist/defaults.d.ts +2 -16
- package/dist/defaults.js +7 -208
- package/dist/defaults.mjs +4 -9
- package/dist/defu-Cdz2PomB.js +60 -0
- package/dist/defu-n46TJT6t.mjs +57 -0
- package/dist/env.d.ts +2 -0
- package/dist/escape.d.ts +4 -0
- package/dist/extractors/split.d.ts +3 -0
- package/dist/gulp.d.ts +1 -26
- package/dist/gulp.js +38 -1898
- package/dist/gulp.mjs +30 -15
- package/dist/index-B2TNoaOv.mjs +134 -0
- package/dist/index-B5NiRecR.js +130 -0
- package/dist/index-BEIjgKpF.mjs +11 -0
- package/dist/index-BPzIdybK.mjs +513 -0
- package/dist/index-DeW_zXzo.mjs +124 -0
- package/dist/index-DmzxhHCX.js +136 -0
- package/dist/index-DwZHOkK3.js +526 -0
- package/dist/index-HC-Qkn0i.js +17 -0
- package/dist/index.d.ts +4 -17
- package/dist/index.js +43 -2291
- package/dist/index.mjs +33 -23
- package/dist/js/handlers.d.ts +13 -0
- package/dist/js/index.d.ts +7 -0
- package/dist/mangle/index.d.ts +8 -0
- package/dist/options-7EjuAISl.mjs +869 -0
- package/dist/options-C-rvBixk.js +901 -0
- package/dist/options.d.ts +2 -0
- package/dist/postcss/cssVars.d.ts +5 -0
- package/dist/postcss/index.d.ts +3 -0
- package/dist/postcss/mp.d.ts +8 -0
- package/dist/postcss/plugins/ctx.d.ts +6 -0
- package/dist/postcss/plugins/index.d.ts +7 -0
- package/dist/postcss/plugins/post.d.ts +5 -0
- package/dist/postcss/plugins/pre.d.ts +5 -0
- package/dist/postcss/preflight.d.ts +3 -0
- package/dist/postcss/selectorParser.d.ts +6 -0
- package/dist/postcss/shared.d.ts +3 -0
- package/dist/postcss/symbols.d.ts +1 -0
- package/dist/postcss.d.ts +1 -23
- package/dist/postcss.js +22 -598
- package/dist/postcss.mjs +8 -17
- package/dist/reg.d.ts +1 -0
- package/dist/replace.d.ts +3 -19
- package/dist/replace.js +42 -93
- package/dist/replace.mjs +26 -30
- package/dist/shared-DbJl6i6a.mjs +25 -0
- package/dist/shared-hzYeE1wX.js +28 -0
- package/dist/tailwindcss/patcher.d.ts +3 -0
- package/dist/types.d.ts +165 -0
- package/dist/utils.d.ts +18 -0
- package/dist/v5-BD9-sqra.mjs +174 -0
- package/dist/v5-Ch6783yy.js +181 -0
- package/dist/vite.d.ts +1 -22
- package/dist/vite.js +36 -1947
- package/dist/vite.mjs +28 -15
- package/dist/weapp-tw-runtime-loader.js +14 -41
- package/dist/weapp-tw-runtime-loader.mjs +8 -12
- package/dist/webpack.d.ts +1 -26
- package/dist/webpack.js +37 -1994
- package/dist/webpack.mjs +29 -15
- package/dist/webpack4.d.ts +1 -27
- package/dist/webpack4.js +190 -1979
- package/dist/webpack4.mjs +188 -211
- package/dist/wxml/Tokenizer.d.ts +31 -0
- package/dist/wxml/index.d.ts +2 -0
- package/dist/wxml/shared.d.ts +2 -0
- package/dist/wxml/utils.d.ts +13 -0
- package/package.json +3 -3
- package/dist/chunk-257YPDSI.mjs +0 -173
- package/dist/chunk-75EWCRQW.mjs +0 -13
- package/dist/chunk-AB467PG7.mjs +0 -43
- package/dist/chunk-E7XGHGC7.mjs +0 -62
- package/dist/chunk-GUE4UCRJ.mjs +0 -126
- package/dist/chunk-IOYI6MSW.mjs +0 -533
- package/dist/chunk-LDWI65M5.mjs +0 -152
- package/dist/chunk-NVFWRLOI.mjs +0 -27
- package/dist/chunk-ORMKM6ZA.mjs +0 -30
- package/dist/chunk-PC4B5JJB.mjs +0 -953
- package/dist/chunk-SRLZU2YE.mjs +0 -95
- package/dist/chunk-VECXHWWG.mjs +0 -31
- package/dist/chunk-VN37QGSM.mjs +0 -216
- package/dist/cli.d.mts +0 -2
- package/dist/core.d.mts +0 -22
- package/dist/css-macro/index.d.mts +0 -18
- package/dist/css-macro/postcss.d.mts +0 -7
- package/dist/defaults.d.mts +0 -16
- package/dist/gulp.d.mts +0 -26
- package/dist/index.d.mts +0 -17
- package/dist/postcss.d.mts +0 -23
- package/dist/replace.d.mts +0 -19
- package/dist/types-DSNuiOhH.d.mts +0 -519
- package/dist/types-DSNuiOhH.d.ts +0 -519
- package/dist/vite.d.mts +0 -22
- package/dist/weapp-tw-runtime-loader.d.mts +0 -7
- package/dist/webpack.d.mts +0 -26
- package/dist/webpack4.d.mts +0 -27
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var options = require('./options-C-rvBixk.js');
|
|
4
|
+
var path = require('node:path');
|
|
5
|
+
var fs = require('node:fs');
|
|
6
|
+
var index = require('./index-DwZHOkK3.js');
|
|
7
|
+
var defaults = require('./defaults-DW-EahCC.js');
|
|
8
|
+
var index$1 = require('./index-HC-Qkn0i.js');
|
|
9
|
+
|
|
10
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
11
|
+
|
|
12
|
+
var path__default = /*#__PURE__*/_interopDefaultCompat(path);
|
|
13
|
+
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
14
|
+
|
|
15
|
+
const debug = index$1.createDebug();
|
|
16
|
+
class UnifiedWebpackPluginV5 {
|
|
17
|
+
constructor(options$1 = {}) {
|
|
18
|
+
this.options = options.getOptions(options$1);
|
|
19
|
+
this.appType = this.options.appType;
|
|
20
|
+
}
|
|
21
|
+
apply(compiler) {
|
|
22
|
+
const { mainCssChunkMatcher, disabled, onLoad, onUpdate, onEnd, onStart, styleHandler, patch, templateHandler, jsHandler, setMangleRuntimeSet, runtimeLoaderPath, cache, twPatcher, } = this.options;
|
|
23
|
+
if (disabled) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
patch === null || patch === void 0 ? void 0 : patch();
|
|
27
|
+
const { Compilation, sources, NormalModule } = compiler.webpack;
|
|
28
|
+
const { ConcatSource, RawSource } = sources;
|
|
29
|
+
function getClassSet() {
|
|
30
|
+
return twPatcher.getClassSet();
|
|
31
|
+
}
|
|
32
|
+
onLoad();
|
|
33
|
+
const loader = runtimeLoaderPath !== null && runtimeLoaderPath !== void 0 ? runtimeLoaderPath : path__default["default"].resolve(__dirname, './weapp-tw-runtime-loader.js');
|
|
34
|
+
const isExisted = fs__default["default"].existsSync(loader);
|
|
35
|
+
const WeappTwRuntimeAopLoader = {
|
|
36
|
+
loader,
|
|
37
|
+
options: {
|
|
38
|
+
getClassSet,
|
|
39
|
+
},
|
|
40
|
+
ident: null,
|
|
41
|
+
type: null,
|
|
42
|
+
};
|
|
43
|
+
compiler.hooks.compilation.tap(index.pluginName, (compilation) => {
|
|
44
|
+
NormalModule.getCompilationHooks(compilation).loader.tap(index.pluginName, (_loaderContext, module) => {
|
|
45
|
+
if (isExisted) {
|
|
46
|
+
const idx = module.loaders.findIndex(x => x.loader.includes('postcss-loader'));
|
|
47
|
+
if (idx > -1) {
|
|
48
|
+
module.loaders.unshift(WeappTwRuntimeAopLoader);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
compilation.hooks.processAssets.tapPromise({
|
|
53
|
+
name: index.pluginName,
|
|
54
|
+
stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE,
|
|
55
|
+
}, (assets) => options.__awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
onStart();
|
|
57
|
+
debug('start');
|
|
58
|
+
for (const chunk of compilation.chunks) {
|
|
59
|
+
if (chunk.id && chunk.hash) {
|
|
60
|
+
cache.calcHashValueChanged(chunk.id, chunk.hash);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const entries = Object.entries(assets);
|
|
64
|
+
const groupedEntries = defaults.getGroupedEntries(entries, this.options);
|
|
65
|
+
const runtimeSet = getClassSet();
|
|
66
|
+
setMangleRuntimeSet(runtimeSet);
|
|
67
|
+
debug('get runtimeSet, class count: %d', runtimeSet.size);
|
|
68
|
+
if (Array.isArray(groupedEntries.html)) {
|
|
69
|
+
let noCachedCount = 0;
|
|
70
|
+
for (let i = 0; i < groupedEntries.html.length; i++) {
|
|
71
|
+
const [file, originalSource] = groupedEntries.html[i];
|
|
72
|
+
const rawSource = originalSource.source().toString();
|
|
73
|
+
const hash = cache.computeHash(rawSource);
|
|
74
|
+
const cacheKey = file;
|
|
75
|
+
cache.calcHashValueChanged(cacheKey, hash);
|
|
76
|
+
yield cache.process(cacheKey, () => {
|
|
77
|
+
const source = cache.get(cacheKey);
|
|
78
|
+
if (source) {
|
|
79
|
+
compilation.updateAsset(file, source);
|
|
80
|
+
debug('html cache hit: %s', file);
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
}, () => options.__awaiter(this, void 0, void 0, function* () {
|
|
86
|
+
const wxml = yield templateHandler(rawSource, {
|
|
87
|
+
runtimeSet,
|
|
88
|
+
});
|
|
89
|
+
const source = new ConcatSource(wxml);
|
|
90
|
+
compilation.updateAsset(file, source);
|
|
91
|
+
onUpdate(file, rawSource, wxml);
|
|
92
|
+
debug('html handle: %s', file);
|
|
93
|
+
noCachedCount++;
|
|
94
|
+
return {
|
|
95
|
+
key: cacheKey,
|
|
96
|
+
source,
|
|
97
|
+
};
|
|
98
|
+
}));
|
|
99
|
+
}
|
|
100
|
+
debug('html handle finish, total: %d, no-cached: %d', groupedEntries.html.length, noCachedCount);
|
|
101
|
+
}
|
|
102
|
+
if (Array.isArray(groupedEntries.js)) {
|
|
103
|
+
let noCachedCount = 0;
|
|
104
|
+
for (let i = 0; i < groupedEntries.js.length; i++) {
|
|
105
|
+
const [file, originalSource] = groupedEntries.js[i];
|
|
106
|
+
const cacheKey = defaults.removeExt(file);
|
|
107
|
+
yield cache.process(cacheKey, () => {
|
|
108
|
+
const source = cache.get(cacheKey);
|
|
109
|
+
if (source) {
|
|
110
|
+
compilation.updateAsset(file, source);
|
|
111
|
+
debug('js cache hit: %s', file);
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
}, () => options.__awaiter(this, void 0, void 0, function* () {
|
|
117
|
+
const rawSource = originalSource.source().toString();
|
|
118
|
+
const mapFilename = `${file}.map`;
|
|
119
|
+
const hasMap = Boolean(assets[mapFilename]);
|
|
120
|
+
const { code, map } = yield jsHandler(rawSource, runtimeSet, {
|
|
121
|
+
generateMap: hasMap,
|
|
122
|
+
});
|
|
123
|
+
const source = new ConcatSource(code);
|
|
124
|
+
compilation.updateAsset(file, source);
|
|
125
|
+
onUpdate(file, rawSource, code);
|
|
126
|
+
debug('js handle: %s', file);
|
|
127
|
+
noCachedCount++;
|
|
128
|
+
if (hasMap && map) {
|
|
129
|
+
const source = new RawSource(map.toString());
|
|
130
|
+
compilation.updateAsset(mapFilename, source);
|
|
131
|
+
}
|
|
132
|
+
return {
|
|
133
|
+
key: cacheKey,
|
|
134
|
+
source,
|
|
135
|
+
};
|
|
136
|
+
}));
|
|
137
|
+
}
|
|
138
|
+
debug('js handle finish, total: %d, no-cached: %d', groupedEntries.js.length, noCachedCount);
|
|
139
|
+
}
|
|
140
|
+
if (Array.isArray(groupedEntries.css)) {
|
|
141
|
+
let noCachedCount = 0;
|
|
142
|
+
for (let i = 0; i < groupedEntries.css.length; i++) {
|
|
143
|
+
const [file, originalSource] = groupedEntries.css[i];
|
|
144
|
+
const rawSource = originalSource.source().toString();
|
|
145
|
+
const hash = cache.computeHash(rawSource);
|
|
146
|
+
const cacheKey = file;
|
|
147
|
+
cache.calcHashValueChanged(cacheKey, hash);
|
|
148
|
+
yield cache.process(cacheKey, () => {
|
|
149
|
+
const source = cache.get(cacheKey);
|
|
150
|
+
if (source) {
|
|
151
|
+
compilation.updateAsset(file, source);
|
|
152
|
+
debug('css cache hit: %s', file);
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
}, () => options.__awaiter(this, void 0, void 0, function* () {
|
|
158
|
+
const css = yield styleHandler(rawSource, {
|
|
159
|
+
isMainChunk: mainCssChunkMatcher(file, this.appType),
|
|
160
|
+
});
|
|
161
|
+
const source = new ConcatSource(css);
|
|
162
|
+
compilation.updateAsset(file, source);
|
|
163
|
+
onUpdate(file, rawSource, css);
|
|
164
|
+
debug('css handle: %s', file);
|
|
165
|
+
noCachedCount++;
|
|
166
|
+
return {
|
|
167
|
+
key: cacheKey,
|
|
168
|
+
source,
|
|
169
|
+
};
|
|
170
|
+
}));
|
|
171
|
+
}
|
|
172
|
+
debug('css handle finish, total: %d, no-cached: %d', groupedEntries.css.length, noCachedCount);
|
|
173
|
+
}
|
|
174
|
+
debug('end');
|
|
175
|
+
onEnd();
|
|
176
|
+
}));
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
exports.UnifiedWebpackPluginV5 = UnifiedWebpackPluginV5;
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,22 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { U as UserDefinedOptions } from './types-DSNuiOhH.js';
|
|
3
|
-
import 'postcss';
|
|
4
|
-
import '@tailwindcss-mangle/shared';
|
|
5
|
-
import 'magic-string';
|
|
6
|
-
import '@babel/generator';
|
|
7
|
-
import '@babel/parser';
|
|
8
|
-
import 'postcss-rem-to-responsive-pixel';
|
|
9
|
-
import 'postcss-load-config';
|
|
10
|
-
import 'tailwindcss-patch';
|
|
11
|
-
import 'node:buffer';
|
|
12
|
-
import 'lru-cache';
|
|
13
|
-
import 'webpack';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @name UnifiedViteWeappTailwindcssPlugin
|
|
17
|
-
* @description uni-app vite vue3 版本插件
|
|
18
|
-
* @link https://weapp-tw.icebreaker.top/docs/quick-start/frameworks/uni-app-vite
|
|
19
|
-
*/
|
|
20
|
-
declare function UnifiedViteWeappTailwindcssPlugin(options?: UserDefinedOptions): Plugin | undefined;
|
|
21
|
-
|
|
22
|
-
export { UnifiedViteWeappTailwindcssPlugin };
|
|
1
|
+
export * from './bundlers/vite/index';
|