weapp-tailwindcss 4.7.5-alpha.0 → 4.7.5
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/{chunk-T5BSWDY2.js → chunk-24ADBRZN.js} +25 -15
- package/dist/{chunk-FPX2BD2A.mjs → chunk-42FXROX4.mjs} +23 -13
- package/dist/{chunk-QA6SPWSQ.js → chunk-E5LRICST.js} +253 -25
- package/dist/{chunk-SIZNRUIV.js → chunk-GGD75A34.js} +8 -0
- package/dist/{chunk-NGTZQLCI.mjs → chunk-PUFKPENL.mjs} +30 -14
- package/dist/{chunk-GUCFNE5U.js → chunk-RLWIDWTA.js} +35 -19
- package/dist/{chunk-3ARXMTWC.mjs → chunk-SHMBWMDV.mjs} +8 -0
- package/dist/{chunk-HMTZ4JJN.js → chunk-SJV6DCNZ.js} +22 -15
- package/dist/{chunk-JII7EQ6K.mjs → chunk-TK5LOBHZ.mjs} +23 -16
- package/dist/{chunk-V35QS2PT.mjs → chunk-XEQBYGBX.mjs} +229 -1
- package/dist/cli.js +5 -5
- package/dist/cli.mjs +2 -2
- package/dist/core.js +29 -13
- package/dist/core.mjs +30 -14
- package/dist/gulp.js +4 -5
- package/dist/gulp.mjs +3 -4
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -7
- package/dist/index.mjs +5 -6
- package/dist/presets.js +2 -2
- package/dist/presets.mjs +1 -1
- package/dist/types.d.mts +11 -1
- package/dist/types.d.ts +11 -1
- package/dist/vite.js +4 -5
- package/dist/vite.mjs +3 -4
- package/dist/webpack.js +4 -5
- package/dist/webpack.mjs +3 -4
- package/dist/webpack4.js +26 -16
- package/dist/webpack4.mjs +24 -14
- package/package.json +3 -3
- package/dist/chunk-667CYXAH.mjs +0 -133
- package/dist/chunk-BUMQQPAO.js +0 -133
|
@@ -8,16 +8,15 @@ import {
|
|
|
8
8
|
} from "./chunk-RRHPTTCP.mjs";
|
|
9
9
|
import {
|
|
10
10
|
collectRuntimeClassSet,
|
|
11
|
-
createDebug,
|
|
12
|
-
createTailwindPatchPromise
|
|
13
|
-
} from "./chunk-667CYXAH.mjs";
|
|
14
|
-
import {
|
|
15
11
|
createAttributeMatcher,
|
|
12
|
+
createDebug,
|
|
13
|
+
createTailwindPatchPromise,
|
|
16
14
|
generateCode,
|
|
17
15
|
getCompilerContext,
|
|
16
|
+
refreshTailwindRuntimeState,
|
|
18
17
|
toCustomAttributesEntities,
|
|
19
18
|
vitePluginName
|
|
20
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-XEQBYGBX.mjs";
|
|
21
20
|
import {
|
|
22
21
|
replaceWxml
|
|
23
22
|
} from "./chunk-VSRDBMDB.mjs";
|
|
@@ -297,7 +296,8 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
297
296
|
mainCssChunkMatcher,
|
|
298
297
|
appType,
|
|
299
298
|
cache,
|
|
300
|
-
twPatcher,
|
|
299
|
+
twPatcher: initialTwPatcher,
|
|
300
|
+
refreshTailwindcssPatcher,
|
|
301
301
|
uniAppX,
|
|
302
302
|
disabledDefaultTemplateHandler
|
|
303
303
|
} = opts;
|
|
@@ -305,17 +305,32 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
305
305
|
return;
|
|
306
306
|
}
|
|
307
307
|
const customAttributesEntities = toCustomAttributesEntities(customAttributes);
|
|
308
|
-
const
|
|
308
|
+
const runtimeState = {
|
|
309
|
+
twPatcher: initialTwPatcher,
|
|
310
|
+
patchPromise: createTailwindPatchPromise(initialTwPatcher),
|
|
311
|
+
refreshTailwindcssPatcher
|
|
312
|
+
};
|
|
309
313
|
let runtimeSet;
|
|
310
314
|
let runtimeSetPromise;
|
|
311
315
|
let resolvedConfig;
|
|
316
|
+
async function refreshRuntimeState(force) {
|
|
317
|
+
const refreshed = await refreshTailwindRuntimeState(runtimeState, force);
|
|
318
|
+
if (refreshed) {
|
|
319
|
+
runtimeSet = void 0;
|
|
320
|
+
runtimeSetPromise = void 0;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
312
323
|
async function ensureRuntimeClassSet(force = false) {
|
|
313
|
-
await
|
|
324
|
+
await refreshRuntimeState(force);
|
|
325
|
+
await runtimeState.patchPromise;
|
|
314
326
|
if (!force && runtimeSet) {
|
|
315
327
|
return runtimeSet;
|
|
316
328
|
}
|
|
317
329
|
if (force || !runtimeSetPromise) {
|
|
318
|
-
const task2 = collectRuntimeClassSet(twPatcher, {
|
|
330
|
+
const task2 = collectRuntimeClassSet(runtimeState.twPatcher, {
|
|
331
|
+
force: force || !runtimeSet,
|
|
332
|
+
skipRefresh: force
|
|
333
|
+
});
|
|
319
334
|
runtimeSetPromise = task2;
|
|
320
335
|
}
|
|
321
336
|
const task = runtimeSetPromise;
|
|
@@ -347,7 +362,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
347
362
|
}
|
|
348
363
|
},
|
|
349
364
|
async generateBundle(_opt, bundle) {
|
|
350
|
-
await patchPromise;
|
|
365
|
+
await runtimeState.patchPromise;
|
|
351
366
|
debug("start");
|
|
352
367
|
onStart();
|
|
353
368
|
const entries = Object.entries(bundle);
|
|
@@ -498,7 +513,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
498
513
|
debug("css cache hit: %s", file);
|
|
499
514
|
},
|
|
500
515
|
async transform() {
|
|
501
|
-
await patchPromise;
|
|
516
|
+
await runtimeState.patchPromise;
|
|
502
517
|
const { css } = await styleHandler(rawSource, {
|
|
503
518
|
isMainChunk: mainCssChunkMatcher(originalSource.fileName, appType),
|
|
504
519
|
postcssOptions: {
|
|
@@ -506,7 +521,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
506
521
|
from: file
|
|
507
522
|
}
|
|
508
523
|
},
|
|
509
|
-
majorVersion: twPatcher.majorVersion
|
|
524
|
+
majorVersion: runtimeState.twPatcher.majorVersion
|
|
510
525
|
});
|
|
511
526
|
onUpdate(file, rawSource, css);
|
|
512
527
|
debug("css handle: %s", file);
|
|
@@ -536,7 +551,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
536
551
|
name: `weapp-tailwindcss:uni-app-x:css${enforce ? `:${enforce}` : ""}`,
|
|
537
552
|
enforce,
|
|
538
553
|
async transform(code, id) {
|
|
539
|
-
await patchPromise;
|
|
554
|
+
await runtimeState.patchPromise;
|
|
540
555
|
const { query } = parseVueRequest(id);
|
|
541
556
|
if (isCSSRequest(id) || query.vue && query.type === "style") {
|
|
542
557
|
const postcssResult = await styleHandler(code, {
|
|
@@ -584,7 +599,8 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
584
599
|
}
|
|
585
600
|
const isServeCommand = resolvedConfig?.command === "serve";
|
|
586
601
|
const isWatchBuild = resolvedConfig?.command === "build" && !!resolvedConfig.build?.watch;
|
|
587
|
-
const
|
|
602
|
+
const isNonWatchBuild = resolvedConfig?.command === "build" && !resolvedConfig.build?.watch;
|
|
603
|
+
const shouldForceRefresh = isServeCommand || isWatchBuild || isNonWatchBuild;
|
|
588
604
|
let currentRuntimeSet;
|
|
589
605
|
if (shouldForceRefresh) {
|
|
590
606
|
currentRuntimeSet = await ensureRuntimeClassSet(true);
|
|
@@ -10,14 +10,13 @@ var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var _chunkBUMQQPAOjs = require('./chunk-BUMQQPAO.js');
|
|
14
13
|
|
|
15
14
|
|
|
16
15
|
|
|
17
16
|
|
|
18
17
|
|
|
19
18
|
|
|
20
|
-
var
|
|
19
|
+
var _chunkE5LRICSTjs = require('./chunk-E5LRICST.js');
|
|
21
20
|
|
|
22
21
|
|
|
23
22
|
var _chunkDWAEHRHNjs = require('./chunk-DWAEHRHN.js');
|
|
@@ -64,7 +63,7 @@ function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet) {
|
|
|
64
63
|
if (start >= end) {
|
|
65
64
|
return;
|
|
66
65
|
}
|
|
67
|
-
const generated =
|
|
66
|
+
const generated = _chunkE5LRICSTjs.generateCode.call(void 0, prop.exp.content, {
|
|
68
67
|
jsHandler,
|
|
69
68
|
runtimeSet,
|
|
70
69
|
wrapExpression: true
|
|
@@ -93,7 +92,7 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
|
93
92
|
return;
|
|
94
93
|
}
|
|
95
94
|
const { customAttributesEntities, disabledDefaultTemplateHandler = false } = options;
|
|
96
|
-
const matchCustomAttribute =
|
|
95
|
+
const matchCustomAttribute = _chunkE5LRICSTjs.createAttributeMatcher.call(void 0, customAttributesEntities);
|
|
97
96
|
const ms = new (0, _magicstring2.default)(code);
|
|
98
97
|
const { descriptor, errors } = _compilersfc.parse.call(void 0, code);
|
|
99
98
|
if (errors.length === 0) {
|
|
@@ -216,7 +215,7 @@ async function formatPostcssSourceMap(rawMap, file) {
|
|
|
216
215
|
}
|
|
217
216
|
|
|
218
217
|
// src/bundlers/vite/index.ts
|
|
219
|
-
var debug =
|
|
218
|
+
var debug = _chunkE5LRICSTjs.createDebug.call(void 0, );
|
|
220
219
|
function readOutputEntry(entry) {
|
|
221
220
|
if (entry.output.type === "chunk") {
|
|
222
221
|
return entry.output.code;
|
|
@@ -283,7 +282,7 @@ function applyLinkedResults(linked, entries, onLinkedUpdate, onApplied) {
|
|
|
283
282
|
}
|
|
284
283
|
}
|
|
285
284
|
function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
286
|
-
const opts =
|
|
285
|
+
const opts = _chunkE5LRICSTjs.getCompilerContext.call(void 0, options);
|
|
287
286
|
const {
|
|
288
287
|
disabled,
|
|
289
288
|
customAttributes,
|
|
@@ -297,25 +296,41 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
297
296
|
mainCssChunkMatcher,
|
|
298
297
|
appType,
|
|
299
298
|
cache,
|
|
300
|
-
twPatcher,
|
|
299
|
+
twPatcher: initialTwPatcher,
|
|
300
|
+
refreshTailwindcssPatcher,
|
|
301
301
|
uniAppX,
|
|
302
302
|
disabledDefaultTemplateHandler
|
|
303
303
|
} = opts;
|
|
304
304
|
if (disabled) {
|
|
305
305
|
return;
|
|
306
306
|
}
|
|
307
|
-
const customAttributesEntities =
|
|
308
|
-
const
|
|
307
|
+
const customAttributesEntities = _chunkE5LRICSTjs.toCustomAttributesEntities.call(void 0, customAttributes);
|
|
308
|
+
const runtimeState = {
|
|
309
|
+
twPatcher: initialTwPatcher,
|
|
310
|
+
patchPromise: _chunkE5LRICSTjs.createTailwindPatchPromise.call(void 0, initialTwPatcher),
|
|
311
|
+
refreshTailwindcssPatcher
|
|
312
|
+
};
|
|
309
313
|
let runtimeSet;
|
|
310
314
|
let runtimeSetPromise;
|
|
311
315
|
let resolvedConfig;
|
|
316
|
+
async function refreshRuntimeState(force) {
|
|
317
|
+
const refreshed = await _chunkE5LRICSTjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
|
|
318
|
+
if (refreshed) {
|
|
319
|
+
runtimeSet = void 0;
|
|
320
|
+
runtimeSetPromise = void 0;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
312
323
|
async function ensureRuntimeClassSet(force = false) {
|
|
313
|
-
await
|
|
324
|
+
await refreshRuntimeState(force);
|
|
325
|
+
await runtimeState.patchPromise;
|
|
314
326
|
if (!force && runtimeSet) {
|
|
315
327
|
return runtimeSet;
|
|
316
328
|
}
|
|
317
329
|
if (force || !runtimeSetPromise) {
|
|
318
|
-
const task2 =
|
|
330
|
+
const task2 = _chunkE5LRICSTjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, {
|
|
331
|
+
force: force || !runtimeSet,
|
|
332
|
+
skipRefresh: force
|
|
333
|
+
});
|
|
319
334
|
runtimeSetPromise = task2;
|
|
320
335
|
}
|
|
321
336
|
const task = runtimeSetPromise;
|
|
@@ -331,7 +346,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
331
346
|
onLoad();
|
|
332
347
|
const plugins = [
|
|
333
348
|
{
|
|
334
|
-
name: `${
|
|
349
|
+
name: `${_chunkE5LRICSTjs.vitePluginName}:post`,
|
|
335
350
|
enforce: "post",
|
|
336
351
|
configResolved(config) {
|
|
337
352
|
resolvedConfig = config;
|
|
@@ -347,7 +362,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
347
362
|
}
|
|
348
363
|
},
|
|
349
364
|
async generateBundle(_opt, bundle) {
|
|
350
|
-
await patchPromise;
|
|
365
|
+
await runtimeState.patchPromise;
|
|
351
366
|
debug("start");
|
|
352
367
|
onStart();
|
|
353
368
|
const entries = Object.entries(bundle);
|
|
@@ -498,7 +513,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
498
513
|
debug("css cache hit: %s", file);
|
|
499
514
|
},
|
|
500
515
|
async transform() {
|
|
501
|
-
await patchPromise;
|
|
516
|
+
await runtimeState.patchPromise;
|
|
502
517
|
const { css } = await styleHandler(rawSource, {
|
|
503
518
|
isMainChunk: mainCssChunkMatcher(originalSource.fileName, appType),
|
|
504
519
|
postcssOptions: {
|
|
@@ -506,7 +521,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
506
521
|
from: file
|
|
507
522
|
}
|
|
508
523
|
},
|
|
509
|
-
majorVersion: twPatcher.majorVersion
|
|
524
|
+
majorVersion: runtimeState.twPatcher.majorVersion
|
|
510
525
|
});
|
|
511
526
|
onUpdate(file, rawSource, css);
|
|
512
527
|
debug("css handle: %s", file);
|
|
@@ -536,7 +551,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
536
551
|
name: `weapp-tailwindcss:uni-app-x:css${enforce ? `:${enforce}` : ""}`,
|
|
537
552
|
enforce,
|
|
538
553
|
async transform(code, id) {
|
|
539
|
-
await patchPromise;
|
|
554
|
+
await runtimeState.patchPromise;
|
|
540
555
|
const { query } = parseVueRequest(id);
|
|
541
556
|
if (isCSSRequest(id) || query.vue && query.type === "style") {
|
|
542
557
|
const postcssResult = await styleHandler(code, {
|
|
@@ -584,7 +599,8 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
584
599
|
}
|
|
585
600
|
const isServeCommand = _optionalChain([resolvedConfig, 'optionalAccess', _13 => _13.command]) === "serve";
|
|
586
601
|
const isWatchBuild = _optionalChain([resolvedConfig, 'optionalAccess', _14 => _14.command]) === "build" && !!_optionalChain([resolvedConfig, 'access', _15 => _15.build, 'optionalAccess', _16 => _16.watch]);
|
|
587
|
-
const
|
|
602
|
+
const isNonWatchBuild = _optionalChain([resolvedConfig, 'optionalAccess', _17 => _17.command]) === "build" && !_optionalChain([resolvedConfig, 'access', _18 => _18.build, 'optionalAccess', _19 => _19.watch]);
|
|
603
|
+
const shouldForceRefresh = isServeCommand || isWatchBuild || isNonWatchBuild;
|
|
588
604
|
let currentRuntimeSet;
|
|
589
605
|
if (shouldForceRefresh) {
|
|
590
606
|
currentRuntimeSet = await ensureRuntimeClassSet(true);
|
|
@@ -601,7 +617,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
601
617
|
return transformUVue(code, id, jsHandler, currentRuntimeSet);
|
|
602
618
|
},
|
|
603
619
|
async handleHotUpdate(ctx) {
|
|
604
|
-
if (_optionalChain([resolvedConfig, 'optionalAccess',
|
|
620
|
+
if (_optionalChain([resolvedConfig, 'optionalAccess', _20 => _20.command]) !== "serve") {
|
|
605
621
|
return;
|
|
606
622
|
}
|
|
607
623
|
if (!/\.(?:uvue|nvue)$/.test(ctx.file)) {
|
|
@@ -610,7 +626,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
610
626
|
await ensureRuntimeClassSet(true);
|
|
611
627
|
},
|
|
612
628
|
async watchChange(id) {
|
|
613
|
-
if (_optionalChain([resolvedConfig, 'optionalAccess',
|
|
629
|
+
if (_optionalChain([resolvedConfig, 'optionalAccess', _21 => _21.command]) !== "build" || !_optionalChain([resolvedConfig, 'access', _22 => _22.build, 'optionalAccess', _23 => _23.watch])) {
|
|
614
630
|
return;
|
|
615
631
|
}
|
|
616
632
|
if (!/\.(?:uvue|nvue)(?:\?.*)?$/.test(id)) {
|
|
@@ -5,10 +5,9 @@ var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var _chunkBUMQQPAOjs = require('./chunk-BUMQQPAO.js');
|
|
9
8
|
|
|
10
9
|
|
|
11
|
-
var
|
|
10
|
+
var _chunkE5LRICSTjs = require('./chunk-E5LRICST.js');
|
|
12
11
|
|
|
13
12
|
// src/bundlers/gulp/index.ts
|
|
14
13
|
var _buffer = require('buffer');
|
|
@@ -16,21 +15,29 @@ var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
|
16
15
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
17
16
|
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
18
17
|
var _stream = require('stream'); var _stream2 = _interopRequireDefault(_stream);
|
|
19
|
-
var debug =
|
|
18
|
+
var debug = _chunkE5LRICSTjs.createDebug.call(void 0, );
|
|
20
19
|
var Transform = _stream2.default.Transform;
|
|
21
20
|
function createPlugins(options = {}) {
|
|
22
|
-
const opts =
|
|
23
|
-
const { templateHandler, styleHandler, jsHandler, cache, twPatcher } = opts;
|
|
21
|
+
const opts = _chunkE5LRICSTjs.getCompilerContext.call(void 0, options);
|
|
22
|
+
const { templateHandler, styleHandler, jsHandler, cache, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
|
|
24
23
|
let runtimeSet = /* @__PURE__ */ new Set();
|
|
25
|
-
const
|
|
24
|
+
const runtimeState = {
|
|
25
|
+
twPatcher: initialTwPatcher,
|
|
26
|
+
patchPromise: _chunkE5LRICSTjs.createTailwindPatchPromise.call(void 0, initialTwPatcher),
|
|
27
|
+
refreshTailwindcssPatcher
|
|
28
|
+
};
|
|
26
29
|
const MODULE_EXTENSIONS = [".js", ".mjs", ".cjs", ".ts", ".tsx", ".jsx"];
|
|
27
30
|
let runtimeSetInitialized = false;
|
|
31
|
+
async function refreshRuntimeState(force) {
|
|
32
|
+
await _chunkE5LRICSTjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
|
|
33
|
+
}
|
|
28
34
|
async function refreshRuntimeSet(force = false) {
|
|
29
|
-
await
|
|
35
|
+
await refreshRuntimeState(force);
|
|
36
|
+
await runtimeState.patchPromise;
|
|
30
37
|
if (!force && runtimeSetInitialized && runtimeSet.size > 0) {
|
|
31
38
|
return runtimeSet;
|
|
32
39
|
}
|
|
33
|
-
runtimeSet = await
|
|
40
|
+
runtimeSet = await _chunkE5LRICSTjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force, skipRefresh: force });
|
|
34
41
|
runtimeSetInitialized = true;
|
|
35
42
|
return runtimeSet;
|
|
36
43
|
}
|
|
@@ -109,7 +116,7 @@ function createPlugins(options = {}) {
|
|
|
109
116
|
return;
|
|
110
117
|
}
|
|
111
118
|
await refreshRuntimeSet(true);
|
|
112
|
-
await patchPromise;
|
|
119
|
+
await runtimeState.patchPromise;
|
|
113
120
|
const rawSource = file.contents.toString();
|
|
114
121
|
await _chunkLTJQUORKjs.processCachedTask.call(void 0, {
|
|
115
122
|
cache,
|
|
@@ -122,10 +129,10 @@ function createPlugins(options = {}) {
|
|
|
122
129
|
debug("css cache hit: %s", file.path);
|
|
123
130
|
},
|
|
124
131
|
async transform() {
|
|
125
|
-
await patchPromise;
|
|
132
|
+
await runtimeState.patchPromise;
|
|
126
133
|
const { css } = await styleHandler(rawSource, {
|
|
127
134
|
isMainChunk: true,
|
|
128
|
-
majorVersion: twPatcher.majorVersion,
|
|
135
|
+
majorVersion: runtimeState.twPatcher.majorVersion,
|
|
129
136
|
...options2
|
|
130
137
|
});
|
|
131
138
|
debug("css handle: %s", file.path);
|
|
@@ -140,7 +147,7 @@ function createPlugins(options = {}) {
|
|
|
140
147
|
return;
|
|
141
148
|
}
|
|
142
149
|
await refreshRuntimeSet(runtimeSet.size === 0);
|
|
143
|
-
await patchPromise;
|
|
150
|
+
await runtimeState.patchPromise;
|
|
144
151
|
const filename = _path2.default.resolve(file.path);
|
|
145
152
|
const moduleGraph = _nullishCoalesce(options2.moduleGraph, () => ( createModuleGraphOptionsFor()));
|
|
146
153
|
const handlerOptions = {
|
|
@@ -164,7 +171,7 @@ function createPlugins(options = {}) {
|
|
|
164
171
|
debug("js cache hit: %s", file.path);
|
|
165
172
|
},
|
|
166
173
|
async transform() {
|
|
167
|
-
await patchPromise;
|
|
174
|
+
await runtimeState.patchPromise;
|
|
168
175
|
const currentSource = _nullishCoalesce(_optionalChain([file, 'access', _2 => _2.contents, 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]), () => ( rawSource));
|
|
169
176
|
const { code } = await jsHandler(currentSource, runtimeSet, handlerOptions);
|
|
170
177
|
debug("js handle: %s", file.path);
|
|
@@ -179,7 +186,7 @@ function createPlugins(options = {}) {
|
|
|
179
186
|
return;
|
|
180
187
|
}
|
|
181
188
|
await refreshRuntimeSet(runtimeSet.size === 0);
|
|
182
|
-
await patchPromise;
|
|
189
|
+
await runtimeState.patchPromise;
|
|
183
190
|
const rawSource = file.contents.toString();
|
|
184
191
|
await _chunkLTJQUORKjs.processCachedTask.call(void 0, {
|
|
185
192
|
cache,
|
|
@@ -192,7 +199,7 @@ function createPlugins(options = {}) {
|
|
|
192
199
|
debug("html cache hit: %s", file.path);
|
|
193
200
|
},
|
|
194
201
|
async transform() {
|
|
195
|
-
await patchPromise;
|
|
202
|
+
await runtimeState.patchPromise;
|
|
196
203
|
const code = await templateHandler(rawSource, {
|
|
197
204
|
runtimeSet,
|
|
198
205
|
...options2
|
|
@@ -4,11 +4,10 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
collectRuntimeClassSet,
|
|
6
6
|
createDebug,
|
|
7
|
-
createTailwindPatchPromise
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} from "./chunk-V35QS2PT.mjs";
|
|
7
|
+
createTailwindPatchPromise,
|
|
8
|
+
getCompilerContext,
|
|
9
|
+
refreshTailwindRuntimeState
|
|
10
|
+
} from "./chunk-XEQBYGBX.mjs";
|
|
12
11
|
|
|
13
12
|
// src/bundlers/gulp/index.ts
|
|
14
13
|
import { Buffer } from "buffer";
|
|
@@ -20,17 +19,25 @@ var debug = createDebug();
|
|
|
20
19
|
var Transform = stream.Transform;
|
|
21
20
|
function createPlugins(options = {}) {
|
|
22
21
|
const opts = getCompilerContext(options);
|
|
23
|
-
const { templateHandler, styleHandler, jsHandler, cache, twPatcher } = opts;
|
|
22
|
+
const { templateHandler, styleHandler, jsHandler, cache, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
|
|
24
23
|
let runtimeSet = /* @__PURE__ */ new Set();
|
|
25
|
-
const
|
|
24
|
+
const runtimeState = {
|
|
25
|
+
twPatcher: initialTwPatcher,
|
|
26
|
+
patchPromise: createTailwindPatchPromise(initialTwPatcher),
|
|
27
|
+
refreshTailwindcssPatcher
|
|
28
|
+
};
|
|
26
29
|
const MODULE_EXTENSIONS = [".js", ".mjs", ".cjs", ".ts", ".tsx", ".jsx"];
|
|
27
30
|
let runtimeSetInitialized = false;
|
|
31
|
+
async function refreshRuntimeState(force) {
|
|
32
|
+
await refreshTailwindRuntimeState(runtimeState, force);
|
|
33
|
+
}
|
|
28
34
|
async function refreshRuntimeSet(force = false) {
|
|
29
|
-
await
|
|
35
|
+
await refreshRuntimeState(force);
|
|
36
|
+
await runtimeState.patchPromise;
|
|
30
37
|
if (!force && runtimeSetInitialized && runtimeSet.size > 0) {
|
|
31
38
|
return runtimeSet;
|
|
32
39
|
}
|
|
33
|
-
runtimeSet = await collectRuntimeClassSet(twPatcher, { force });
|
|
40
|
+
runtimeSet = await collectRuntimeClassSet(runtimeState.twPatcher, { force, skipRefresh: force });
|
|
34
41
|
runtimeSetInitialized = true;
|
|
35
42
|
return runtimeSet;
|
|
36
43
|
}
|
|
@@ -109,7 +116,7 @@ function createPlugins(options = {}) {
|
|
|
109
116
|
return;
|
|
110
117
|
}
|
|
111
118
|
await refreshRuntimeSet(true);
|
|
112
|
-
await patchPromise;
|
|
119
|
+
await runtimeState.patchPromise;
|
|
113
120
|
const rawSource = file.contents.toString();
|
|
114
121
|
await processCachedTask({
|
|
115
122
|
cache,
|
|
@@ -122,10 +129,10 @@ function createPlugins(options = {}) {
|
|
|
122
129
|
debug("css cache hit: %s", file.path);
|
|
123
130
|
},
|
|
124
131
|
async transform() {
|
|
125
|
-
await patchPromise;
|
|
132
|
+
await runtimeState.patchPromise;
|
|
126
133
|
const { css } = await styleHandler(rawSource, {
|
|
127
134
|
isMainChunk: true,
|
|
128
|
-
majorVersion: twPatcher.majorVersion,
|
|
135
|
+
majorVersion: runtimeState.twPatcher.majorVersion,
|
|
129
136
|
...options2
|
|
130
137
|
});
|
|
131
138
|
debug("css handle: %s", file.path);
|
|
@@ -140,7 +147,7 @@ function createPlugins(options = {}) {
|
|
|
140
147
|
return;
|
|
141
148
|
}
|
|
142
149
|
await refreshRuntimeSet(runtimeSet.size === 0);
|
|
143
|
-
await patchPromise;
|
|
150
|
+
await runtimeState.patchPromise;
|
|
144
151
|
const filename = path.resolve(file.path);
|
|
145
152
|
const moduleGraph = options2.moduleGraph ?? createModuleGraphOptionsFor();
|
|
146
153
|
const handlerOptions = {
|
|
@@ -164,7 +171,7 @@ function createPlugins(options = {}) {
|
|
|
164
171
|
debug("js cache hit: %s", file.path);
|
|
165
172
|
},
|
|
166
173
|
async transform() {
|
|
167
|
-
await patchPromise;
|
|
174
|
+
await runtimeState.patchPromise;
|
|
168
175
|
const currentSource = file.contents?.toString() ?? rawSource;
|
|
169
176
|
const { code } = await jsHandler(currentSource, runtimeSet, handlerOptions);
|
|
170
177
|
debug("js handle: %s", file.path);
|
|
@@ -179,7 +186,7 @@ function createPlugins(options = {}) {
|
|
|
179
186
|
return;
|
|
180
187
|
}
|
|
181
188
|
await refreshRuntimeSet(runtimeSet.size === 0);
|
|
182
|
-
await patchPromise;
|
|
189
|
+
await runtimeState.patchPromise;
|
|
183
190
|
const rawSource = file.contents.toString();
|
|
184
191
|
await processCachedTask({
|
|
185
192
|
cache,
|
|
@@ -192,7 +199,7 @@ function createPlugins(options = {}) {
|
|
|
192
199
|
debug("html cache hit: %s", file.path);
|
|
193
200
|
},
|
|
194
201
|
async transform() {
|
|
195
|
-
await patchPromise;
|
|
202
|
+
await runtimeState.patchPromise;
|
|
196
203
|
const code = await templateHandler(rawSource, {
|
|
197
204
|
runtimeSet,
|
|
198
205
|
...options2
|