weapp-tailwindcss 3.0.3 → 3.0.4

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/webpack.js CHANGED
@@ -2,12 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var options = require('./options-MDCr-9Qn.js');
6
- var path = require('node:path');
7
- var fs = require('node:fs');
8
- var postcss = require('./postcss-bdPbDgs7.js');
9
- var defaults = require('./defaults-QOAV8NSV.js');
10
- var index = require('./index-z25r_Htj.js');
5
+ var v5 = require('./v5-RkdOexPP.js');
6
+ require('./options-N9g3FpWO.js');
11
7
  require('magic-string');
12
8
  require('./replace.js');
13
9
  require('@weapp-core/escape');
@@ -17,195 +13,25 @@ require('@weapp-core/regex');
17
13
  require('@babel/generator');
18
14
  require('@babel/parser');
19
15
  require('@babel/traverse');
16
+ require('./defaults-QOAV8NSV.js');
17
+ require('./defu-KWuJnZLV.js');
20
18
  require('@babel/types');
21
19
  require('htmlparser2');
22
20
  require('postcss');
21
+ require('./index-Fkmyt0Rc.js');
22
+ require('@csstools/postcss-is-pseudo-class');
23
+ require('postcss-rem-to-responsive-pixel');
24
+ require('postcss-selector-parser');
25
+ require('node:path');
26
+ require('node:fs');
23
27
  require('semver');
24
28
  require('tailwindcss-patch');
25
29
  require('@tailwindcss-mangle/shared');
26
30
  require('lru-cache');
27
31
  require('md5');
28
- require('@csstools/postcss-is-pseudo-class');
29
- require('postcss-rem-to-responsive-pixel');
30
- require('postcss-selector-parser');
31
- require('./defu-KWuJnZLV.js');
32
+ require('./index-juOeq2Kt.js');
32
33
  require('debug');
33
34
 
34
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
35
-
36
- var path__default = /*#__PURE__*/_interopDefaultCompat(path);
37
- var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
38
35
 
39
- const debug = index.createDebug('processAssets: ');
40
- class UnifiedWebpackPluginV5 {
41
- constructor(options$1 = {}) {
42
- if (options$1.customReplaceDictionary === undefined) {
43
- options$1.customReplaceDictionary = 'simple';
44
- }
45
- this.options = options.getOptions(options$1);
46
- this.appType = this.options.appType;
47
- }
48
- apply(compiler) {
49
- const { mainCssChunkMatcher, disabled, onLoad, onUpdate, onEnd, onStart, styleHandler, patch, templateHandler, jsHandler, setMangleRuntimeSet, runtimeLoaderPath, cache, tailwindcssBasedir } = this.options;
50
- if (disabled) {
51
- return;
52
- }
53
- patch === null || patch === void 0 ? void 0 : patch();
54
- const { Compilation, sources, NormalModule } = compiler.webpack;
55
- const { ConcatSource, RawSource } = sources;
56
- const twPatcher = options.createTailwindcssPatcher();
57
- function getClassSet() {
58
- return twPatcher.getClassSet({
59
- basedir: tailwindcssBasedir
60
- });
61
- }
62
- onLoad();
63
- const loader = runtimeLoaderPath !== null && runtimeLoaderPath !== void 0 ? runtimeLoaderPath : path__default["default"].resolve(__dirname, './weapp-tw-runtime-loader.js');
64
- const isExisted = fs__default["default"].existsSync(loader);
65
- const WeappTwRuntimeAopLoader = {
66
- loader,
67
- options: {
68
- getClassSet
69
- },
70
- ident: null,
71
- type: null
72
- };
73
- compiler.hooks.compilation.tap(postcss.pluginName, (compilation) => {
74
- NormalModule.getCompilationHooks(compilation).loader.tap(postcss.pluginName, (loaderContext, module) => {
75
- if (isExisted) {
76
- const idx = module.loaders.findIndex((x) => x.loader.includes('postcss-loader'));
77
- if (idx > -1) {
78
- module.loaders.unshift(WeappTwRuntimeAopLoader);
79
- }
80
- }
81
- });
82
- compilation.hooks.processAssets.tapPromise({
83
- name: postcss.pluginName,
84
- stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
85
- }, (assets) => options.__awaiter(this, void 0, void 0, function* () {
86
- onStart();
87
- debug('start');
88
- for (const chunk of compilation.chunks) {
89
- if (chunk.id && chunk.hash) {
90
- cache.calcHashValueChanged(chunk.id, chunk.hash);
91
- }
92
- }
93
- const entries = Object.entries(assets);
94
- const groupedEntries = defaults.getGroupedEntries(entries, this.options);
95
- const runtimeSet = getClassSet();
96
- setMangleRuntimeSet(runtimeSet);
97
- debug('get runtimeSet, class count: %d', runtimeSet.size);
98
- if (Array.isArray(groupedEntries.html)) {
99
- let noCachedCount = 0;
100
- for (let i = 0; i < groupedEntries.html.length; i++) {
101
- const [file, originalSource] = groupedEntries.html[i];
102
- const rawSource = originalSource.source().toString();
103
- const hash = cache.computeHash(rawSource);
104
- const cacheKey = file;
105
- cache.calcHashValueChanged(cacheKey, hash);
106
- yield cache.process(cacheKey, () => {
107
- const source = cache.get(cacheKey);
108
- if (source) {
109
- compilation.updateAsset(file, source);
110
- debug('html cache hit: %s', file);
111
- }
112
- else {
113
- return false;
114
- }
115
- }, () => {
116
- const wxml = templateHandler(rawSource, {
117
- runtimeSet
118
- });
119
- const source = new ConcatSource(wxml);
120
- compilation.updateAsset(file, source);
121
- onUpdate(file, rawSource, wxml);
122
- debug('html handle: %s', file);
123
- noCachedCount++;
124
- return {
125
- key: cacheKey,
126
- source
127
- };
128
- });
129
- }
130
- debug('html handle finish, total: %d, no-cached: %d', groupedEntries.html.length, noCachedCount);
131
- }
132
- if (Array.isArray(groupedEntries.js)) {
133
- let noCachedCount = 0;
134
- for (let i = 0; i < groupedEntries.js.length; i++) {
135
- const [file, originalSource] = groupedEntries.js[i];
136
- const cacheKey = defaults.removeExt(file);
137
- yield cache.process(cacheKey, () => {
138
- const source = cache.get(cacheKey);
139
- if (source) {
140
- compilation.updateAsset(file, source);
141
- debug('js cache hit: %s', file);
142
- }
143
- else {
144
- return false;
145
- }
146
- }, () => {
147
- const rawSource = originalSource.source().toString();
148
- const mapFilename = file + '.map';
149
- const hasMap = Boolean(assets[mapFilename]);
150
- const { code, map } = jsHandler(rawSource, runtimeSet, {
151
- generateMap: hasMap
152
- });
153
- const source = new ConcatSource(code);
154
- compilation.updateAsset(file, source);
155
- onUpdate(file, rawSource, code);
156
- debug('js handle: %s', file);
157
- noCachedCount++;
158
- if (hasMap && map) {
159
- const source = new RawSource(map.toString());
160
- compilation.updateAsset(mapFilename, source);
161
- }
162
- return {
163
- key: cacheKey,
164
- source
165
- };
166
- });
167
- }
168
- debug('js handle finish, total: %d, no-cached: %d', groupedEntries.js.length, noCachedCount);
169
- }
170
- if (Array.isArray(groupedEntries.css)) {
171
- let noCachedCount = 0;
172
- for (let i = 0; i < groupedEntries.css.length; i++) {
173
- const [file, originalSource] = groupedEntries.css[i];
174
- const rawSource = originalSource.source().toString();
175
- const hash = cache.computeHash(rawSource);
176
- const cacheKey = file;
177
- cache.calcHashValueChanged(cacheKey, hash);
178
- yield cache.process(cacheKey, () => {
179
- const source = cache.get(cacheKey);
180
- if (source) {
181
- compilation.updateAsset(file, source);
182
- debug('css cache hit: %s', file);
183
- }
184
- else {
185
- return false;
186
- }
187
- }, () => options.__awaiter(this, void 0, void 0, function* () {
188
- const css = yield styleHandler(rawSource, {
189
- isMainChunk: mainCssChunkMatcher(file, this.appType)
190
- });
191
- const source = new ConcatSource(css);
192
- compilation.updateAsset(file, source);
193
- onUpdate(file, rawSource, css);
194
- debug('css handle: %s', file);
195
- noCachedCount++;
196
- return {
197
- key: cacheKey,
198
- source
199
- };
200
- }));
201
- }
202
- debug('css handle finish, total: %d, no-cached: %d', groupedEntries.css.length, noCachedCount);
203
- }
204
- debug('end');
205
- onEnd();
206
- }));
207
- });
208
- }
209
- }
210
36
 
211
- exports.UnifiedWebpackPluginV5 = UnifiedWebpackPluginV5;
37
+ exports.UnifiedWebpackPluginV5 = v5.UnifiedWebpackPluginV5;
package/dist/webpack.mjs CHANGED
@@ -1,9 +1,5 @@
1
- import { g as getOptions, a as createTailwindcssPatcher, _ as __awaiter } from './options-9bBYg22L.mjs';
2
- import path from 'node:path';
3
- import fs from 'node:fs';
4
- import { p as pluginName } from './postcss-MxkGjr8g.mjs';
5
- import { g as getGroupedEntries, r as removeExt } from './defaults-TZpmwtzd.mjs';
6
- import { c as createDebug } from './index-06BoOZig.mjs';
1
+ export { U as UnifiedWebpackPluginV5 } from './v5-UTJ5AaEA.mjs';
2
+ import './options-6YPFqoRJ.mjs';
7
3
  import 'magic-string';
8
4
  import './replace.mjs';
9
5
  import '@weapp-core/escape';
@@ -13,190 +9,21 @@ import '@weapp-core/regex';
13
9
  import '@babel/generator';
14
10
  import '@babel/parser';
15
11
  import '@babel/traverse';
12
+ import './defaults-TZpmwtzd.mjs';
13
+ import './defu-ms_ZBCiB.mjs';
16
14
  import '@babel/types';
17
15
  import 'htmlparser2';
18
16
  import 'postcss';
17
+ import './index-_74RBzwy.mjs';
18
+ import '@csstools/postcss-is-pseudo-class';
19
+ import 'postcss-rem-to-responsive-pixel';
20
+ import 'postcss-selector-parser';
21
+ import 'node:path';
22
+ import 'node:fs';
19
23
  import 'semver';
20
24
  import 'tailwindcss-patch';
21
25
  import '@tailwindcss-mangle/shared';
22
26
  import 'lru-cache';
23
27
  import 'md5';
24
- import '@csstools/postcss-is-pseudo-class';
25
- import 'postcss-rem-to-responsive-pixel';
26
- import 'postcss-selector-parser';
27
- import './defu-ms_ZBCiB.mjs';
28
+ import './index-06BoOZig.mjs';
28
29
  import 'debug';
29
-
30
- const debug = createDebug('processAssets: ');
31
- class UnifiedWebpackPluginV5 {
32
- constructor(options = {}) {
33
- if (options.customReplaceDictionary === undefined) {
34
- options.customReplaceDictionary = 'simple';
35
- }
36
- this.options = getOptions(options);
37
- this.appType = this.options.appType;
38
- }
39
- apply(compiler) {
40
- const { mainCssChunkMatcher, disabled, onLoad, onUpdate, onEnd, onStart, styleHandler, patch, templateHandler, jsHandler, setMangleRuntimeSet, runtimeLoaderPath, cache, tailwindcssBasedir } = this.options;
41
- if (disabled) {
42
- return;
43
- }
44
- patch === null || patch === void 0 ? void 0 : patch();
45
- const { Compilation, sources, NormalModule } = compiler.webpack;
46
- const { ConcatSource, RawSource } = sources;
47
- const twPatcher = createTailwindcssPatcher();
48
- function getClassSet() {
49
- return twPatcher.getClassSet({
50
- basedir: tailwindcssBasedir
51
- });
52
- }
53
- onLoad();
54
- const loader = runtimeLoaderPath !== null && runtimeLoaderPath !== void 0 ? runtimeLoaderPath : path.resolve(__dirname, './weapp-tw-runtime-loader.js');
55
- const isExisted = fs.existsSync(loader);
56
- const WeappTwRuntimeAopLoader = {
57
- loader,
58
- options: {
59
- getClassSet
60
- },
61
- ident: null,
62
- type: null
63
- };
64
- compiler.hooks.compilation.tap(pluginName, (compilation) => {
65
- NormalModule.getCompilationHooks(compilation).loader.tap(pluginName, (loaderContext, module) => {
66
- if (isExisted) {
67
- const idx = module.loaders.findIndex((x) => x.loader.includes('postcss-loader'));
68
- if (idx > -1) {
69
- module.loaders.unshift(WeappTwRuntimeAopLoader);
70
- }
71
- }
72
- });
73
- compilation.hooks.processAssets.tapPromise({
74
- name: pluginName,
75
- stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
76
- }, (assets) => __awaiter(this, void 0, void 0, function* () {
77
- onStart();
78
- debug('start');
79
- for (const chunk of compilation.chunks) {
80
- if (chunk.id && chunk.hash) {
81
- cache.calcHashValueChanged(chunk.id, chunk.hash);
82
- }
83
- }
84
- const entries = Object.entries(assets);
85
- const groupedEntries = getGroupedEntries(entries, this.options);
86
- const runtimeSet = getClassSet();
87
- setMangleRuntimeSet(runtimeSet);
88
- debug('get runtimeSet, class count: %d', runtimeSet.size);
89
- if (Array.isArray(groupedEntries.html)) {
90
- let noCachedCount = 0;
91
- for (let i = 0; i < groupedEntries.html.length; i++) {
92
- const [file, originalSource] = groupedEntries.html[i];
93
- const rawSource = originalSource.source().toString();
94
- const hash = cache.computeHash(rawSource);
95
- const cacheKey = file;
96
- cache.calcHashValueChanged(cacheKey, hash);
97
- yield cache.process(cacheKey, () => {
98
- const source = cache.get(cacheKey);
99
- if (source) {
100
- compilation.updateAsset(file, source);
101
- debug('html cache hit: %s', file);
102
- }
103
- else {
104
- return false;
105
- }
106
- }, () => {
107
- const wxml = templateHandler(rawSource, {
108
- runtimeSet
109
- });
110
- const source = new ConcatSource(wxml);
111
- compilation.updateAsset(file, source);
112
- onUpdate(file, rawSource, wxml);
113
- debug('html handle: %s', file);
114
- noCachedCount++;
115
- return {
116
- key: cacheKey,
117
- source
118
- };
119
- });
120
- }
121
- debug('html handle finish, total: %d, no-cached: %d', groupedEntries.html.length, noCachedCount);
122
- }
123
- if (Array.isArray(groupedEntries.js)) {
124
- let noCachedCount = 0;
125
- for (let i = 0; i < groupedEntries.js.length; i++) {
126
- const [file, originalSource] = groupedEntries.js[i];
127
- const cacheKey = removeExt(file);
128
- yield cache.process(cacheKey, () => {
129
- const source = cache.get(cacheKey);
130
- if (source) {
131
- compilation.updateAsset(file, source);
132
- debug('js cache hit: %s', file);
133
- }
134
- else {
135
- return false;
136
- }
137
- }, () => {
138
- const rawSource = originalSource.source().toString();
139
- const mapFilename = file + '.map';
140
- const hasMap = Boolean(assets[mapFilename]);
141
- const { code, map } = jsHandler(rawSource, runtimeSet, {
142
- generateMap: hasMap
143
- });
144
- const source = new ConcatSource(code);
145
- compilation.updateAsset(file, source);
146
- onUpdate(file, rawSource, code);
147
- debug('js handle: %s', file);
148
- noCachedCount++;
149
- if (hasMap && map) {
150
- const source = new RawSource(map.toString());
151
- compilation.updateAsset(mapFilename, source);
152
- }
153
- return {
154
- key: cacheKey,
155
- source
156
- };
157
- });
158
- }
159
- debug('js handle finish, total: %d, no-cached: %d', groupedEntries.js.length, noCachedCount);
160
- }
161
- if (Array.isArray(groupedEntries.css)) {
162
- let noCachedCount = 0;
163
- for (let i = 0; i < groupedEntries.css.length; i++) {
164
- const [file, originalSource] = groupedEntries.css[i];
165
- const rawSource = originalSource.source().toString();
166
- const hash = cache.computeHash(rawSource);
167
- const cacheKey = file;
168
- cache.calcHashValueChanged(cacheKey, hash);
169
- yield cache.process(cacheKey, () => {
170
- const source = cache.get(cacheKey);
171
- if (source) {
172
- compilation.updateAsset(file, source);
173
- debug('css cache hit: %s', file);
174
- }
175
- else {
176
- return false;
177
- }
178
- }, () => __awaiter(this, void 0, void 0, function* () {
179
- const css = yield styleHandler(rawSource, {
180
- isMainChunk: mainCssChunkMatcher(file, this.appType)
181
- });
182
- const source = new ConcatSource(css);
183
- compilation.updateAsset(file, source);
184
- onUpdate(file, rawSource, css);
185
- debug('css handle: %s', file);
186
- noCachedCount++;
187
- return {
188
- key: cacheKey,
189
- source
190
- };
191
- }));
192
- }
193
- debug('css handle finish, total: %d, no-cached: %d', groupedEntries.css.length, noCachedCount);
194
- }
195
- debug('end');
196
- onEnd();
197
- }));
198
- });
199
- }
200
- }
201
-
202
- export { UnifiedWebpackPluginV5 };
@@ -0,0 +1 @@
1
+ export * from './bundlers/webpack/BaseUnifiedPlugin/v4';
@@ -0,0 +1,208 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var options = require('./options-N9g3FpWO.js');
6
+ var path = require('node:path');
7
+ var fs = require('node:fs');
8
+ var webpackSources = require('webpack-sources');
9
+ var index = require('./index-Fkmyt0Rc.js');
10
+ var defaults = require('./defaults-QOAV8NSV.js');
11
+ var index$1 = require('./index-juOeq2Kt.js');
12
+ require('magic-string');
13
+ require('./replace.js');
14
+ require('@weapp-core/escape');
15
+ require('@ast-core/escape');
16
+ require('./shared-AxeHlAoJ.js');
17
+ require('@weapp-core/regex');
18
+ require('@babel/generator');
19
+ require('@babel/parser');
20
+ require('@babel/traverse');
21
+ require('@babel/types');
22
+ require('htmlparser2');
23
+ require('postcss');
24
+ require('semver');
25
+ require('tailwindcss-patch');
26
+ require('@tailwindcss-mangle/shared');
27
+ require('lru-cache');
28
+ require('md5');
29
+ require('@csstools/postcss-is-pseudo-class');
30
+ require('postcss-rem-to-responsive-pixel');
31
+ require('postcss-selector-parser');
32
+ require('./defu-KWuJnZLV.js');
33
+ require('debug');
34
+
35
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
36
+
37
+ var path__default = /*#__PURE__*/_interopDefaultCompat(path);
38
+ var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
39
+
40
+ const debug = index$1.createDebug('processAssets: ');
41
+ class UnifiedWebpackPluginV4 {
42
+ constructor(options$1 = {}) {
43
+ if (options$1.customReplaceDictionary === undefined) {
44
+ options$1.customReplaceDictionary = 'simple';
45
+ }
46
+ this.options = options.getOptions(options$1);
47
+ this.appType = this.options.appType;
48
+ }
49
+ apply(compiler) {
50
+ const { mainCssChunkMatcher, disabled, onLoad, onUpdate, onEnd, onStart, styleHandler, patch, templateHandler, jsHandler, setMangleRuntimeSet, runtimeLoaderPath, cache, tailwindcssBasedir } = this.options;
51
+ if (disabled) {
52
+ return;
53
+ }
54
+ patch === null || patch === void 0 ? void 0 : patch();
55
+ const twPatcher = options.createTailwindcssPatcher();
56
+ function getClassSet() {
57
+ return twPatcher.getClassSet({
58
+ basedir: tailwindcssBasedir
59
+ });
60
+ }
61
+ onLoad();
62
+ const loader = runtimeLoaderPath !== null && runtimeLoaderPath !== void 0 ? runtimeLoaderPath : path__default["default"].resolve(__dirname, './weapp-tw-runtime-loader.js');
63
+ const isExisted = fs__default["default"].existsSync(loader);
64
+ const WeappTwRuntimeAopLoader = {
65
+ loader,
66
+ options: {
67
+ getClassSet
68
+ },
69
+ ident: null,
70
+ type: null
71
+ };
72
+ compiler.hooks.compilation.tap(index.pluginName, (compilation) => {
73
+ compilation.hooks.normalModuleLoader.tap(index.pluginName, (loaderContext, module) => {
74
+ if (isExisted) {
75
+ const idx = module.loaders.findIndex((x) => x.loader.includes('postcss-loader'));
76
+ if (idx > -1) {
77
+ module.loaders.unshift(WeappTwRuntimeAopLoader);
78
+ }
79
+ }
80
+ });
81
+ });
82
+ compiler.hooks.emit.tapPromise(index.pluginName, (compilation) => options.__awaiter(this, void 0, void 0, function* () {
83
+ onStart();
84
+ debug('start');
85
+ for (const chunk of compilation.chunks) {
86
+ if (chunk.id && chunk.hash) {
87
+ cache.calcHashValueChanged(chunk.id, chunk.hash);
88
+ }
89
+ }
90
+ const assets = compilation.assets;
91
+ const entries = Object.entries(assets);
92
+ const groupedEntries = defaults.getGroupedEntries(entries, this.options);
93
+ const runtimeSet = getClassSet();
94
+ setMangleRuntimeSet(runtimeSet);
95
+ debug('get runtimeSet, class count: %d', runtimeSet.size);
96
+ if (Array.isArray(groupedEntries.html)) {
97
+ let noCachedCount = 0;
98
+ for (let i = 0; i < groupedEntries.html.length; i++) {
99
+ const [file, originalSource] = groupedEntries.html[i];
100
+ const rawSource = originalSource.source().toString();
101
+ const hash = cache.computeHash(rawSource);
102
+ const cacheKey = file;
103
+ cache.calcHashValueChanged(cacheKey, hash);
104
+ yield cache.process(cacheKey, () => {
105
+ const source = cache.get(cacheKey);
106
+ if (source) {
107
+ compilation.updateAsset(file, source);
108
+ debug('html cache hit: %s', file);
109
+ }
110
+ else {
111
+ return false;
112
+ }
113
+ }, () => {
114
+ const wxml = templateHandler(rawSource, {
115
+ runtimeSet
116
+ });
117
+ const source = new webpackSources.ConcatSource(wxml);
118
+ compilation.updateAsset(file, source);
119
+ onUpdate(file, rawSource, wxml);
120
+ debug('html handle: %s', file);
121
+ noCachedCount++;
122
+ return {
123
+ key: cacheKey,
124
+ source
125
+ };
126
+ });
127
+ }
128
+ debug('html handle finish, total: %d, no-cached: %d', groupedEntries.html.length, noCachedCount);
129
+ }
130
+ if (Array.isArray(groupedEntries.js)) {
131
+ let noCachedCount = 0;
132
+ for (let i = 0; i < groupedEntries.js.length; i++) {
133
+ const [file, originalSource] = groupedEntries.js[i];
134
+ const cacheKey = defaults.removeExt(file);
135
+ yield cache.process(cacheKey, () => {
136
+ const source = cache.get(cacheKey);
137
+ if (source) {
138
+ compilation.updateAsset(file, source);
139
+ debug('js cache hit: %s', file);
140
+ }
141
+ else {
142
+ return false;
143
+ }
144
+ }, () => {
145
+ const rawSource = originalSource.source().toString();
146
+ const mapFilename = file + '.map';
147
+ const hasMap = Boolean(assets[mapFilename]);
148
+ const { code, map } = jsHandler(rawSource, runtimeSet, {
149
+ generateMap: hasMap
150
+ });
151
+ const source = new webpackSources.ConcatSource(code);
152
+ compilation.updateAsset(file, source);
153
+ onUpdate(file, rawSource, code);
154
+ debug('js handle: %s', file);
155
+ noCachedCount++;
156
+ if (hasMap && map) {
157
+ const source = new webpackSources.RawSource(map.toString());
158
+ compilation.updateAsset(mapFilename, source);
159
+ }
160
+ return {
161
+ key: cacheKey,
162
+ source
163
+ };
164
+ });
165
+ }
166
+ debug('js handle finish, total: %d, no-cached: %d', groupedEntries.js.length, noCachedCount);
167
+ }
168
+ if (Array.isArray(groupedEntries.css)) {
169
+ let noCachedCount = 0;
170
+ for (let i = 0; i < groupedEntries.css.length; i++) {
171
+ const [file, originalSource] = groupedEntries.css[i];
172
+ const rawSource = originalSource.source().toString();
173
+ const hash = cache.computeHash(rawSource);
174
+ const cacheKey = file;
175
+ cache.calcHashValueChanged(cacheKey, hash);
176
+ yield cache.process(cacheKey, () => {
177
+ const source = cache.get(cacheKey);
178
+ if (source) {
179
+ compilation.updateAsset(file, source);
180
+ debug('css cache hit: %s', file);
181
+ }
182
+ else {
183
+ return false;
184
+ }
185
+ }, () => options.__awaiter(this, void 0, void 0, function* () {
186
+ const css = yield styleHandler(rawSource, {
187
+ isMainChunk: mainCssChunkMatcher(file, this.appType)
188
+ });
189
+ const source = new webpackSources.ConcatSource(css);
190
+ compilation.updateAsset(file, source);
191
+ onUpdate(file, rawSource, css);
192
+ debug('css handle: %s', file);
193
+ noCachedCount++;
194
+ return {
195
+ key: cacheKey,
196
+ source
197
+ };
198
+ }));
199
+ }
200
+ debug('css handle finish, total: %d, no-cached: %d', groupedEntries.css.length, noCachedCount);
201
+ }
202
+ debug('end');
203
+ onEnd();
204
+ }));
205
+ }
206
+ }
207
+
208
+ exports.UnifiedWebpackPluginV4 = UnifiedWebpackPluginV4;