weapp-tailwindcss 2.9.1 → 2.9.3
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 +13 -9
- package/dist/cache/index.d.ts +5 -2
- package/dist/cli.js +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/gulp.js +15 -11
- package/dist/gulp.mjs +15 -11
- package/dist/index.js +3 -3
- package/dist/index.mjs +3 -3
- package/dist/{options-b96f6338.js → options-09ebba08.js} +56 -17
- package/dist/{options-f70d1c6f.mjs → options-63407615.mjs} +56 -18
- package/dist/postcss/index.d.ts +2 -2
- package/dist/types.d.ts +3 -1
- package/dist/vite.js +110 -106
- package/dist/vite.mjs +110 -106
- package/dist/webpack.js +15 -13
- package/dist/webpack.mjs +15 -13
- package/package.json +32 -28
package/dist/vite.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var options = require('./options-
|
|
5
|
+
var options = require('./options-09ebba08.js');
|
|
6
6
|
var postcss = require('./postcss-8d7f67b4.js');
|
|
7
7
|
var defaults = require('./defaults-b7341550.js');
|
|
8
8
|
var index = require('./index-aede98ce.js');
|
|
@@ -36,7 +36,7 @@ function UnifiedViteWeappTailwindcssPlugin(options$1 = {}) {
|
|
|
36
36
|
options$1.customReplaceDictionary = 'simple';
|
|
37
37
|
}
|
|
38
38
|
const opts = options.getOptions(options$1);
|
|
39
|
-
const { disabled, onEnd, onLoad, onStart, onUpdate, templateHandler, styleHandler, patch, jsHandler, mainCssChunkMatcher, appType, setMangleRuntimeSet, cache } = opts;
|
|
39
|
+
const { disabled, onEnd, onLoad, onStart, onUpdate, templateHandler, styleHandler, patch, jsHandler, mainCssChunkMatcher, appType, setMangleRuntimeSet, cache, tailwindcssBasedir } = opts;
|
|
40
40
|
if (disabled) {
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
@@ -47,115 +47,119 @@ function UnifiedViteWeappTailwindcssPlugin(options$1 = {}) {
|
|
|
47
47
|
name: postcss.vitePluginName,
|
|
48
48
|
enforce: 'post',
|
|
49
49
|
generateBundle(opt, bundle) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
50
|
+
return options.__awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
debug('start');
|
|
52
|
+
onStart();
|
|
53
|
+
const entries = Object.entries(bundle);
|
|
54
|
+
const groupedEntries = defaults.getGroupedEntries(entries, opts);
|
|
55
|
+
const runtimeSet = twPatcher.getClassSet({
|
|
56
|
+
basedir: tailwindcssBasedir
|
|
57
|
+
});
|
|
58
|
+
setMangleRuntimeSet(runtimeSet);
|
|
59
|
+
debug('get runtimeSet, class count: %d', runtimeSet.size);
|
|
60
|
+
if (Array.isArray(groupedEntries.html)) {
|
|
61
|
+
let noCachedCount = 0;
|
|
62
|
+
for (let i = 0; i < groupedEntries.html.length; i++) {
|
|
63
|
+
const [file, originalSource] = groupedEntries.html[i];
|
|
64
|
+
const oldVal = originalSource.source.toString();
|
|
65
|
+
const hash = cache.computeHash(oldVal);
|
|
66
|
+
cache.calcHashValueChanged(file, hash);
|
|
67
|
+
yield cache.process(file, () => {
|
|
68
|
+
const source = cache.get(file);
|
|
69
|
+
if (source) {
|
|
70
|
+
originalSource.source = source;
|
|
71
|
+
debug('html cache hit: %s', file);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
}, () => {
|
|
77
|
+
originalSource.source = templateHandler(oldVal, {
|
|
78
|
+
runtimeSet
|
|
79
|
+
});
|
|
80
|
+
onUpdate(file, oldVal, originalSource.source);
|
|
81
|
+
debug('html handle: %s', file);
|
|
82
|
+
noCachedCount++;
|
|
83
|
+
return {
|
|
84
|
+
key: file,
|
|
85
|
+
source: originalSource.source
|
|
86
|
+
};
|
|
76
87
|
});
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
noCachedCount++;
|
|
80
|
-
return {
|
|
81
|
-
key: file,
|
|
82
|
-
source: originalSource.source
|
|
83
|
-
};
|
|
84
|
-
});
|
|
88
|
+
}
|
|
89
|
+
debug('html handle finish, total: %d, no-cached: %d', groupedEntries.html.length, noCachedCount);
|
|
85
90
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
91
|
+
if (Array.isArray(groupedEntries.js)) {
|
|
92
|
+
let noCachedCount = 0;
|
|
93
|
+
for (let i = 0; i < groupedEntries.js.length; i++) {
|
|
94
|
+
const [file, originalSource] = groupedEntries.js[i];
|
|
95
|
+
const rawSource = originalSource.code;
|
|
96
|
+
const hash = cache.computeHash(rawSource);
|
|
97
|
+
cache.calcHashValueChanged(file, hash);
|
|
98
|
+
yield cache.process(file, () => {
|
|
99
|
+
const source = cache.get(file);
|
|
100
|
+
if (source) {
|
|
101
|
+
originalSource.code = source;
|
|
102
|
+
debug('js cache hit: %s', file);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
}, () => {
|
|
108
|
+
const mapFilename = file + '.map';
|
|
109
|
+
const hasMap = Boolean(bundle[mapFilename]);
|
|
110
|
+
const { code, map } = jsHandler(rawSource, runtimeSet, {
|
|
111
|
+
generateMap: hasMap
|
|
112
|
+
});
|
|
113
|
+
originalSource.code = code;
|
|
114
|
+
onUpdate(file, rawSource, code);
|
|
115
|
+
debug('js handle: %s', file);
|
|
116
|
+
noCachedCount++;
|
|
117
|
+
if (hasMap && map) {
|
|
118
|
+
bundle[mapFilename].source = map.toString();
|
|
119
|
+
}
|
|
120
|
+
return {
|
|
121
|
+
key: file,
|
|
122
|
+
source: code
|
|
123
|
+
};
|
|
109
124
|
});
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
debug('js handle: %s', file);
|
|
113
|
-
noCachedCount++;
|
|
114
|
-
if (hasMap && map) {
|
|
115
|
-
bundle[mapFilename].source = map.toString();
|
|
116
|
-
}
|
|
117
|
-
return {
|
|
118
|
-
key: file,
|
|
119
|
-
source: code
|
|
120
|
-
};
|
|
121
|
-
});
|
|
125
|
+
}
|
|
126
|
+
debug('js handle finish, total: %d, no-cached: %d', groupedEntries.js.length, noCachedCount);
|
|
122
127
|
}
|
|
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
|
-
|
|
128
|
+
if (Array.isArray(groupedEntries.css)) {
|
|
129
|
+
let noCachedCount = 0;
|
|
130
|
+
for (let i = 0; i < groupedEntries.css.length; i++) {
|
|
131
|
+
const [file, originalSource] = groupedEntries.css[i];
|
|
132
|
+
const rawSource = originalSource.source.toString();
|
|
133
|
+
const hash = cache.computeHash(rawSource);
|
|
134
|
+
cache.calcHashValueChanged(file, hash);
|
|
135
|
+
yield cache.process(file, () => {
|
|
136
|
+
const source = cache.get(file);
|
|
137
|
+
if (source) {
|
|
138
|
+
originalSource.source = source;
|
|
139
|
+
debug('css cache hit: %s', file);
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
}, () => options.__awaiter(this, void 0, void 0, function* () {
|
|
145
|
+
const css = yield styleHandler(rawSource, {
|
|
146
|
+
isMainChunk: mainCssChunkMatcher(originalSource.fileName, appType)
|
|
147
|
+
});
|
|
148
|
+
originalSource.source = css;
|
|
149
|
+
onUpdate(file, rawSource, css);
|
|
150
|
+
debug('css handle: %s', file);
|
|
151
|
+
noCachedCount++;
|
|
152
|
+
return {
|
|
153
|
+
key: file,
|
|
154
|
+
source: css
|
|
155
|
+
};
|
|
156
|
+
}));
|
|
157
|
+
}
|
|
158
|
+
debug('css handle finish, total: %d, no-cached: %d', groupedEntries.css.length, noCachedCount);
|
|
154
159
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
debug('end');
|
|
160
|
+
onEnd();
|
|
161
|
+
debug('end');
|
|
162
|
+
});
|
|
159
163
|
}
|
|
160
164
|
};
|
|
161
165
|
}
|
package/dist/vite.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as getOptions, a as createTailwindcssPatcher } from './options-
|
|
1
|
+
import { g as getOptions, a as createTailwindcssPatcher, _ as __awaiter } from './options-63407615.mjs';
|
|
2
2
|
import { v as vitePluginName } from './postcss-55ed4d42.mjs';
|
|
3
3
|
import { g as getGroupedEntries } from './defaults-d2c66d23.mjs';
|
|
4
4
|
import { c as createDebug } from './index-84c7aa87.mjs';
|
|
@@ -32,7 +32,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
32
32
|
options.customReplaceDictionary = 'simple';
|
|
33
33
|
}
|
|
34
34
|
const opts = getOptions(options);
|
|
35
|
-
const { disabled, onEnd, onLoad, onStart, onUpdate, templateHandler, styleHandler, patch, jsHandler, mainCssChunkMatcher, appType, setMangleRuntimeSet, cache } = opts;
|
|
35
|
+
const { disabled, onEnd, onLoad, onStart, onUpdate, templateHandler, styleHandler, patch, jsHandler, mainCssChunkMatcher, appType, setMangleRuntimeSet, cache, tailwindcssBasedir } = opts;
|
|
36
36
|
if (disabled) {
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
@@ -43,115 +43,119 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
43
43
|
name: vitePluginName,
|
|
44
44
|
enforce: 'post',
|
|
45
45
|
generateBundle(opt, bundle) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
debug('start');
|
|
48
|
+
onStart();
|
|
49
|
+
const entries = Object.entries(bundle);
|
|
50
|
+
const groupedEntries = getGroupedEntries(entries, opts);
|
|
51
|
+
const runtimeSet = twPatcher.getClassSet({
|
|
52
|
+
basedir: tailwindcssBasedir
|
|
53
|
+
});
|
|
54
|
+
setMangleRuntimeSet(runtimeSet);
|
|
55
|
+
debug('get runtimeSet, class count: %d', runtimeSet.size);
|
|
56
|
+
if (Array.isArray(groupedEntries.html)) {
|
|
57
|
+
let noCachedCount = 0;
|
|
58
|
+
for (let i = 0; i < groupedEntries.html.length; i++) {
|
|
59
|
+
const [file, originalSource] = groupedEntries.html[i];
|
|
60
|
+
const oldVal = originalSource.source.toString();
|
|
61
|
+
const hash = cache.computeHash(oldVal);
|
|
62
|
+
cache.calcHashValueChanged(file, hash);
|
|
63
|
+
yield cache.process(file, () => {
|
|
64
|
+
const source = cache.get(file);
|
|
65
|
+
if (source) {
|
|
66
|
+
originalSource.source = source;
|
|
67
|
+
debug('html cache hit: %s', file);
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
}, () => {
|
|
73
|
+
originalSource.source = templateHandler(oldVal, {
|
|
74
|
+
runtimeSet
|
|
75
|
+
});
|
|
76
|
+
onUpdate(file, oldVal, originalSource.source);
|
|
77
|
+
debug('html handle: %s', file);
|
|
78
|
+
noCachedCount++;
|
|
79
|
+
return {
|
|
80
|
+
key: file,
|
|
81
|
+
source: originalSource.source
|
|
82
|
+
};
|
|
72
83
|
});
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
noCachedCount++;
|
|
76
|
-
return {
|
|
77
|
-
key: file,
|
|
78
|
-
source: originalSource.source
|
|
79
|
-
};
|
|
80
|
-
});
|
|
84
|
+
}
|
|
85
|
+
debug('html handle finish, total: %d, no-cached: %d', groupedEntries.html.length, noCachedCount);
|
|
81
86
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
87
|
+
if (Array.isArray(groupedEntries.js)) {
|
|
88
|
+
let noCachedCount = 0;
|
|
89
|
+
for (let i = 0; i < groupedEntries.js.length; i++) {
|
|
90
|
+
const [file, originalSource] = groupedEntries.js[i];
|
|
91
|
+
const rawSource = originalSource.code;
|
|
92
|
+
const hash = cache.computeHash(rawSource);
|
|
93
|
+
cache.calcHashValueChanged(file, hash);
|
|
94
|
+
yield cache.process(file, () => {
|
|
95
|
+
const source = cache.get(file);
|
|
96
|
+
if (source) {
|
|
97
|
+
originalSource.code = source;
|
|
98
|
+
debug('js cache hit: %s', file);
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
}, () => {
|
|
104
|
+
const mapFilename = file + '.map';
|
|
105
|
+
const hasMap = Boolean(bundle[mapFilename]);
|
|
106
|
+
const { code, map } = jsHandler(rawSource, runtimeSet, {
|
|
107
|
+
generateMap: hasMap
|
|
108
|
+
});
|
|
109
|
+
originalSource.code = code;
|
|
110
|
+
onUpdate(file, rawSource, code);
|
|
111
|
+
debug('js handle: %s', file);
|
|
112
|
+
noCachedCount++;
|
|
113
|
+
if (hasMap && map) {
|
|
114
|
+
bundle[mapFilename].source = map.toString();
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
key: file,
|
|
118
|
+
source: code
|
|
119
|
+
};
|
|
105
120
|
});
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
debug('js handle: %s', file);
|
|
109
|
-
noCachedCount++;
|
|
110
|
-
if (hasMap && map) {
|
|
111
|
-
bundle[mapFilename].source = map.toString();
|
|
112
|
-
}
|
|
113
|
-
return {
|
|
114
|
-
key: file,
|
|
115
|
-
source: code
|
|
116
|
-
};
|
|
117
|
-
});
|
|
121
|
+
}
|
|
122
|
+
debug('js handle finish, total: %d, no-cached: %d', groupedEntries.js.length, noCachedCount);
|
|
118
123
|
}
|
|
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
|
-
|
|
124
|
+
if (Array.isArray(groupedEntries.css)) {
|
|
125
|
+
let noCachedCount = 0;
|
|
126
|
+
for (let i = 0; i < groupedEntries.css.length; i++) {
|
|
127
|
+
const [file, originalSource] = groupedEntries.css[i];
|
|
128
|
+
const rawSource = originalSource.source.toString();
|
|
129
|
+
const hash = cache.computeHash(rawSource);
|
|
130
|
+
cache.calcHashValueChanged(file, hash);
|
|
131
|
+
yield cache.process(file, () => {
|
|
132
|
+
const source = cache.get(file);
|
|
133
|
+
if (source) {
|
|
134
|
+
originalSource.source = source;
|
|
135
|
+
debug('css cache hit: %s', file);
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
}, () => __awaiter(this, void 0, void 0, function* () {
|
|
141
|
+
const css = yield styleHandler(rawSource, {
|
|
142
|
+
isMainChunk: mainCssChunkMatcher(originalSource.fileName, appType)
|
|
143
|
+
});
|
|
144
|
+
originalSource.source = css;
|
|
145
|
+
onUpdate(file, rawSource, css);
|
|
146
|
+
debug('css handle: %s', file);
|
|
147
|
+
noCachedCount++;
|
|
148
|
+
return {
|
|
149
|
+
key: file,
|
|
150
|
+
source: css
|
|
151
|
+
};
|
|
152
|
+
}));
|
|
153
|
+
}
|
|
154
|
+
debug('css handle finish, total: %d, no-cached: %d', groupedEntries.css.length, noCachedCount);
|
|
150
155
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
debug('end');
|
|
156
|
+
onEnd();
|
|
157
|
+
debug('end');
|
|
158
|
+
});
|
|
155
159
|
}
|
|
156
160
|
};
|
|
157
161
|
}
|
package/dist/webpack.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var options = require('./options-09ebba08.js');
|
|
5
6
|
var path = require('node:path');
|
|
6
7
|
var fs = require('node:fs');
|
|
7
|
-
var options = require('./options-b96f6338.js');
|
|
8
8
|
var postcss = require('./postcss-8d7f67b4.js');
|
|
9
9
|
var defaults = require('./defaults-b7341550.js');
|
|
10
10
|
var index = require('./index-aede98ce.js');
|
|
@@ -35,7 +35,7 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
35
35
|
var path__default = /*#__PURE__*/_interopDefaultCompat(path);
|
|
36
36
|
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
37
37
|
|
|
38
|
-
const debug = index.createDebug('');
|
|
38
|
+
const debug = index.createDebug('processAssets: ');
|
|
39
39
|
class UnifiedWebpackPluginV5 {
|
|
40
40
|
constructor(options$1 = {}) {
|
|
41
41
|
if (options$1.customReplaceDictionary === undefined) {
|
|
@@ -45,7 +45,7 @@ class UnifiedWebpackPluginV5 {
|
|
|
45
45
|
this.appType = this.options.appType;
|
|
46
46
|
}
|
|
47
47
|
apply(compiler) {
|
|
48
|
-
const { mainCssChunkMatcher, disabled, onLoad, onUpdate, onEnd, onStart, styleHandler, patch, templateHandler, jsHandler, setMangleRuntimeSet, runtimeLoaderPath, cache } = this.options;
|
|
48
|
+
const { mainCssChunkMatcher, disabled, onLoad, onUpdate, onEnd, onStart, styleHandler, patch, templateHandler, jsHandler, setMangleRuntimeSet, runtimeLoaderPath, cache, tailwindcssBasedir } = this.options;
|
|
49
49
|
if (disabled) {
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
@@ -54,7 +54,9 @@ class UnifiedWebpackPluginV5 {
|
|
|
54
54
|
const { ConcatSource, RawSource } = sources;
|
|
55
55
|
const twPatcher = options.createTailwindcssPatcher();
|
|
56
56
|
function getClassSet() {
|
|
57
|
-
return twPatcher.getClassSet(
|
|
57
|
+
return twPatcher.getClassSet({
|
|
58
|
+
basedir: tailwindcssBasedir
|
|
59
|
+
});
|
|
58
60
|
}
|
|
59
61
|
onLoad();
|
|
60
62
|
const loader = runtimeLoaderPath !== null && runtimeLoaderPath !== void 0 ? runtimeLoaderPath : path__default["default"].resolve(__dirname, './weapp-tw-runtime-loader.js');
|
|
@@ -76,10 +78,10 @@ class UnifiedWebpackPluginV5 {
|
|
|
76
78
|
}
|
|
77
79
|
}
|
|
78
80
|
});
|
|
79
|
-
compilation.hooks.processAssets.
|
|
81
|
+
compilation.hooks.processAssets.tapPromise({
|
|
80
82
|
name: postcss.pluginName,
|
|
81
83
|
stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
|
|
82
|
-
}, (assets) => {
|
|
84
|
+
}, (assets) => options.__awaiter(this, void 0, void 0, function* () {
|
|
83
85
|
onStart();
|
|
84
86
|
debug('start');
|
|
85
87
|
for (const chunk of compilation.chunks) {
|
|
@@ -100,7 +102,7 @@ class UnifiedWebpackPluginV5 {
|
|
|
100
102
|
const hash = cache.computeHash(rawSource);
|
|
101
103
|
const cacheKey = file;
|
|
102
104
|
cache.calcHashValueChanged(cacheKey, hash);
|
|
103
|
-
cache.process(cacheKey, () => {
|
|
105
|
+
yield cache.process(cacheKey, () => {
|
|
104
106
|
const source = cache.get(cacheKey);
|
|
105
107
|
if (source) {
|
|
106
108
|
compilation.updateAsset(file, source);
|
|
@@ -131,7 +133,7 @@ class UnifiedWebpackPluginV5 {
|
|
|
131
133
|
for (let i = 0; i < groupedEntries.js.length; i++) {
|
|
132
134
|
const [file, originalSource] = groupedEntries.js[i];
|
|
133
135
|
const cacheKey = defaults.removeExt(file);
|
|
134
|
-
cache.process(cacheKey, () => {
|
|
136
|
+
yield cache.process(cacheKey, () => {
|
|
135
137
|
const source = cache.get(cacheKey);
|
|
136
138
|
if (source) {
|
|
137
139
|
compilation.updateAsset(file, source);
|
|
@@ -172,7 +174,7 @@ class UnifiedWebpackPluginV5 {
|
|
|
172
174
|
const hash = cache.computeHash(rawSource);
|
|
173
175
|
const cacheKey = file;
|
|
174
176
|
cache.calcHashValueChanged(cacheKey, hash);
|
|
175
|
-
cache.process(cacheKey, () => {
|
|
177
|
+
yield cache.process(cacheKey, () => {
|
|
176
178
|
const source = cache.get(cacheKey);
|
|
177
179
|
if (source) {
|
|
178
180
|
compilation.updateAsset(file, source);
|
|
@@ -181,8 +183,8 @@ class UnifiedWebpackPluginV5 {
|
|
|
181
183
|
else {
|
|
182
184
|
return false;
|
|
183
185
|
}
|
|
184
|
-
}, () => {
|
|
185
|
-
const css = styleHandler(rawSource, {
|
|
186
|
+
}, () => options.__awaiter(this, void 0, void 0, function* () {
|
|
187
|
+
const css = yield styleHandler(rawSource, {
|
|
186
188
|
isMainChunk: mainCssChunkMatcher(file, this.appType)
|
|
187
189
|
});
|
|
188
190
|
const source = new ConcatSource(css);
|
|
@@ -194,13 +196,13 @@ class UnifiedWebpackPluginV5 {
|
|
|
194
196
|
key: cacheKey,
|
|
195
197
|
source
|
|
196
198
|
};
|
|
197
|
-
});
|
|
199
|
+
}));
|
|
198
200
|
}
|
|
199
201
|
debug('css handle finish, total: %d, no-cached: %d', groupedEntries.css.length, noCachedCount);
|
|
200
202
|
}
|
|
201
203
|
debug('end');
|
|
202
204
|
onEnd();
|
|
203
|
-
});
|
|
205
|
+
}));
|
|
204
206
|
});
|
|
205
207
|
}
|
|
206
208
|
}
|