weapp-tailwindcss 4.4.0 → 4.5.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/dist/chunk-34T2BFTJ.mjs +59 -0
- package/dist/{chunk-VN2BU7ON.js → chunk-4NWVZ7I2.js} +160 -59
- package/dist/{chunk-D2AKCBDU.mjs → chunk-DKUPUV4T.mjs} +75 -2
- package/dist/{chunk-FBGUUXQV.mjs → chunk-FWIGQ4RY.mjs} +1 -1
- package/dist/{chunk-QXCC745G.js → chunk-IO3RB6AQ.js} +99 -28
- package/dist/chunk-MRKRCDIE.js +195 -0
- package/dist/{chunk-RBRSMHFS.js → chunk-NHB7NFQC.js} +1 -1
- package/dist/{chunk-L3HOZDIV.mjs → chunk-OHUQYFGP.mjs} +98 -27
- package/dist/{chunk-NDHL3P32.mjs → chunk-RQGIJKLG.mjs} +156 -55
- package/dist/chunk-WVKK6TBL.js +59 -0
- package/dist/{chunk-GQAB52GE.js → chunk-XYYHPJOQ.js} +384 -14
- package/dist/{chunk-D25XJJMP.mjs → chunk-Z7Q5UFNU.mjs} +381 -11
- package/dist/cli.js +3 -3
- package/dist/cli.mjs +2 -2
- package/dist/core.js +3 -3
- package/dist/core.mjs +2 -2
- package/dist/css-macro/postcss.js +1 -1
- package/dist/css-macro/postcss.mjs +1 -1
- package/dist/css-macro.js +1 -1
- package/dist/css-macro.mjs +1 -1
- package/dist/defaults.js +1 -1
- package/dist/defaults.mjs +1 -1
- package/dist/escape.js +1 -1
- package/dist/escape.mjs +1 -1
- package/dist/gulp.js +4 -4
- package/dist/gulp.mjs +3 -3
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -6
- package/dist/index.mjs +6 -5
- package/dist/postcss-html-transform.js +1 -1
- package/dist/postcss-html-transform.mjs +1 -1
- package/dist/presets.js +1 -1
- package/dist/presets.mjs +1 -1
- package/dist/types.d.mts +48 -2
- package/dist/types.d.ts +48 -2
- package/dist/types.js +1 -1
- package/dist/types.mjs +1 -1
- package/dist/vite.js +5 -4
- package/dist/vite.mjs +4 -3
- package/dist/webpack.js +5 -4
- package/dist/webpack.mjs +4 -3
- package/dist/webpack4.js +99 -29
- package/dist/webpack4.mjs +97 -27
- package/package.json +5 -5
- package/dist/chunk-H2Y5VNOJ.js +0 -122
|
@@ -10,17 +10,14 @@ import {
|
|
|
10
10
|
} from "./chunk-ZNKIYZRQ.mjs";
|
|
11
11
|
|
|
12
12
|
// src/context/index.ts
|
|
13
|
-
import { logger as
|
|
13
|
+
import { logger as logger3, pc } from "@weapp-tailwindcss/logger";
|
|
14
14
|
import { useMangleStore } from "@weapp-tailwindcss/mangle";
|
|
15
15
|
|
|
16
16
|
// src/cache/index.ts
|
|
17
17
|
import { LRUCache } from "lru-cache";
|
|
18
18
|
|
|
19
19
|
// src/cache/md5.ts
|
|
20
|
-
import
|
|
21
|
-
function md5Hash(data) {
|
|
22
|
-
return crypto.createHash("md5").update(data).digest("hex");
|
|
23
|
-
}
|
|
20
|
+
import { md5 } from "@weapp-tailwindcss/shared/node";
|
|
24
21
|
|
|
25
22
|
// src/cache/index.ts
|
|
26
23
|
function isProcessResult(value) {
|
|
@@ -54,7 +51,7 @@ function createCache(options) {
|
|
|
54
51
|
return instance.set(key, value);
|
|
55
52
|
},
|
|
56
53
|
computeHash(message) {
|
|
57
|
-
return
|
|
54
|
+
return md5(message);
|
|
58
55
|
},
|
|
59
56
|
calcHashValueChanged(key, hash) {
|
|
60
57
|
const hit = hashMap.get(key);
|
|
@@ -395,6 +392,274 @@ var JsTokenUpdater = class {
|
|
|
395
392
|
}
|
|
396
393
|
};
|
|
397
394
|
|
|
395
|
+
// src/js/ModuleGraph.ts
|
|
396
|
+
var JsModuleGraph = class {
|
|
397
|
+
constructor(entry, graphOptions) {
|
|
398
|
+
this.modules = /* @__PURE__ */ new Map();
|
|
399
|
+
this.queue = [];
|
|
400
|
+
this.ignoredExportNames = /* @__PURE__ */ new Map();
|
|
401
|
+
this.resolve = graphOptions.resolve;
|
|
402
|
+
this.load = graphOptions.load;
|
|
403
|
+
this.filter = graphOptions.filter;
|
|
404
|
+
this.maxDepth = graphOptions.maxDepth ?? Number.POSITIVE_INFINITY;
|
|
405
|
+
const { moduleGraph: _moduleGraph, filename: _ignoredFilename, ...rest } = entry.handlerOptions;
|
|
406
|
+
this.baseOptions = {
|
|
407
|
+
...rest,
|
|
408
|
+
filename: entry.filename
|
|
409
|
+
};
|
|
410
|
+
this.parserOptions = entry.handlerOptions.babelParserOptions;
|
|
411
|
+
this.rootFilename = entry.filename;
|
|
412
|
+
this.modules.set(entry.filename, {
|
|
413
|
+
filename: entry.filename,
|
|
414
|
+
source: entry.source,
|
|
415
|
+
analysis: entry.analysis
|
|
416
|
+
});
|
|
417
|
+
this.queue.push({ filename: entry.filename, depth: 0 });
|
|
418
|
+
}
|
|
419
|
+
build() {
|
|
420
|
+
this.collectDependencies();
|
|
421
|
+
const linked = {};
|
|
422
|
+
for (const [filename, state] of this.modules) {
|
|
423
|
+
if (filename === this.rootFilename) {
|
|
424
|
+
continue;
|
|
425
|
+
}
|
|
426
|
+
const childOptions = {
|
|
427
|
+
...this.baseOptions,
|
|
428
|
+
filename
|
|
429
|
+
};
|
|
430
|
+
const ms = processUpdatedSource(state.source, childOptions, state.analysis);
|
|
431
|
+
const code = ms.toString();
|
|
432
|
+
if (code !== state.source) {
|
|
433
|
+
linked[filename] = { code };
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
return linked;
|
|
437
|
+
}
|
|
438
|
+
addIgnoredExport(filename, exportName) {
|
|
439
|
+
if (!exportName) {
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
let pending = this.ignoredExportNames.get(filename);
|
|
443
|
+
if (!pending) {
|
|
444
|
+
pending = /* @__PURE__ */ new Set();
|
|
445
|
+
this.ignoredExportNames.set(filename, pending);
|
|
446
|
+
}
|
|
447
|
+
if (pending.has(exportName)) {
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
pending.add(exportName);
|
|
451
|
+
const existing = this.modules.get(filename);
|
|
452
|
+
if (existing) {
|
|
453
|
+
this.applyIgnoredExportsToAnalysis(filename, existing.analysis);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
registerIgnoredExportsFromTokens(resolved, tokens) {
|
|
457
|
+
for (const token of tokens) {
|
|
458
|
+
if (token.type === "ImportSpecifier") {
|
|
459
|
+
this.addIgnoredExport(resolved, token.imported);
|
|
460
|
+
} else if (token.type === "ImportDefaultSpecifier") {
|
|
461
|
+
this.addIgnoredExport(resolved, "default");
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
applyIgnoredExportsToAnalysis(filename, analysis) {
|
|
466
|
+
const pending = this.ignoredExportNames.get(filename);
|
|
467
|
+
if (!pending || pending.size === 0) {
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
const names = new Set(pending);
|
|
471
|
+
pending.clear();
|
|
472
|
+
const propagate = [];
|
|
473
|
+
for (const exportPath of analysis.exportDeclarations) {
|
|
474
|
+
if (names.size === 0) {
|
|
475
|
+
break;
|
|
476
|
+
}
|
|
477
|
+
if (exportPath.isExportDefaultDeclaration()) {
|
|
478
|
+
if (names.has("default")) {
|
|
479
|
+
analysis.walker.walkExportDefaultDeclaration(exportPath);
|
|
480
|
+
names.delete("default");
|
|
481
|
+
}
|
|
482
|
+
continue;
|
|
483
|
+
}
|
|
484
|
+
if (exportPath.isExportNamedDeclaration()) {
|
|
485
|
+
const source = exportPath.node.source?.value;
|
|
486
|
+
if (typeof source === "string") {
|
|
487
|
+
for (const spec of exportPath.get("specifiers")) {
|
|
488
|
+
if (!spec.isExportSpecifier()) {
|
|
489
|
+
continue;
|
|
490
|
+
}
|
|
491
|
+
const exported = spec.get("exported");
|
|
492
|
+
let exportedName;
|
|
493
|
+
if (exported.isIdentifier()) {
|
|
494
|
+
exportedName = exported.node.name;
|
|
495
|
+
} else if (exported.isStringLiteral()) {
|
|
496
|
+
exportedName = exported.node.value;
|
|
497
|
+
}
|
|
498
|
+
if (!exportedName || !names.has(exportedName)) {
|
|
499
|
+
continue;
|
|
500
|
+
}
|
|
501
|
+
const local = spec.get("local");
|
|
502
|
+
if (local.isIdentifier()) {
|
|
503
|
+
propagate.push({
|
|
504
|
+
specifier: source,
|
|
505
|
+
exportName: local.node.name
|
|
506
|
+
});
|
|
507
|
+
names.delete(exportedName);
|
|
508
|
+
} else if (local.isStringLiteral()) {
|
|
509
|
+
propagate.push({
|
|
510
|
+
specifier: source,
|
|
511
|
+
exportName: local.node.value
|
|
512
|
+
});
|
|
513
|
+
names.delete(exportedName);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
continue;
|
|
517
|
+
}
|
|
518
|
+
const declaration = exportPath.get("declaration");
|
|
519
|
+
if (declaration.isVariableDeclaration()) {
|
|
520
|
+
for (const decl of declaration.get("declarations")) {
|
|
521
|
+
const id = decl.get("id");
|
|
522
|
+
if (id.isIdentifier()) {
|
|
523
|
+
const exportName = id.node.name;
|
|
524
|
+
if (names.has(exportName)) {
|
|
525
|
+
analysis.walker.walkVariableDeclarator(decl);
|
|
526
|
+
names.delete(exportName);
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
for (const spec of exportPath.get("specifiers")) {
|
|
532
|
+
if (!spec.isExportSpecifier()) {
|
|
533
|
+
continue;
|
|
534
|
+
}
|
|
535
|
+
const exported = spec.get("exported");
|
|
536
|
+
let exportedName;
|
|
537
|
+
if (exported.isIdentifier()) {
|
|
538
|
+
exportedName = exported.node.name;
|
|
539
|
+
} else if (exported.isStringLiteral()) {
|
|
540
|
+
exportedName = exported.node.value;
|
|
541
|
+
}
|
|
542
|
+
if (!exportedName || !names.has(exportedName)) {
|
|
543
|
+
continue;
|
|
544
|
+
}
|
|
545
|
+
const local = spec.get("local");
|
|
546
|
+
analysis.walker.walkNode(local);
|
|
547
|
+
names.delete(exportedName);
|
|
548
|
+
}
|
|
549
|
+
continue;
|
|
550
|
+
}
|
|
551
|
+
if (exportPath.isExportAllDeclaration()) {
|
|
552
|
+
const source = exportPath.node.source?.value;
|
|
553
|
+
if (typeof source === "string") {
|
|
554
|
+
for (const exportName of names) {
|
|
555
|
+
propagate.push({
|
|
556
|
+
specifier: source,
|
|
557
|
+
exportName
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
names.clear();
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
for (const { specifier, exportName } of propagate) {
|
|
565
|
+
let resolved;
|
|
566
|
+
try {
|
|
567
|
+
resolved = this.resolve(specifier, filename);
|
|
568
|
+
} catch {
|
|
569
|
+
resolved = void 0;
|
|
570
|
+
}
|
|
571
|
+
if (!resolved) {
|
|
572
|
+
pending.add(exportName);
|
|
573
|
+
continue;
|
|
574
|
+
}
|
|
575
|
+
if (this.filter && !this.filter(resolved, specifier, filename)) {
|
|
576
|
+
pending.add(exportName);
|
|
577
|
+
continue;
|
|
578
|
+
}
|
|
579
|
+
this.addIgnoredExport(resolved, exportName);
|
|
580
|
+
}
|
|
581
|
+
for (const name of names) {
|
|
582
|
+
pending.add(name);
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
collectDependencies() {
|
|
586
|
+
while (this.queue.length > 0) {
|
|
587
|
+
const { filename, depth } = this.queue.shift();
|
|
588
|
+
if (depth >= this.maxDepth) {
|
|
589
|
+
continue;
|
|
590
|
+
}
|
|
591
|
+
const state = this.modules.get(filename);
|
|
592
|
+
if (!state) {
|
|
593
|
+
continue;
|
|
594
|
+
}
|
|
595
|
+
const dependencySpecifiers = /* @__PURE__ */ new Map();
|
|
596
|
+
for (const token of state.analysis.walker.imports) {
|
|
597
|
+
if (!dependencySpecifiers.has(token.source)) {
|
|
598
|
+
dependencySpecifiers.set(token.source, []);
|
|
599
|
+
}
|
|
600
|
+
dependencySpecifiers.get(token.source).push(token);
|
|
601
|
+
}
|
|
602
|
+
for (const exportPath of state.analysis.exportDeclarations) {
|
|
603
|
+
if (exportPath.isExportAllDeclaration() || exportPath.isExportNamedDeclaration()) {
|
|
604
|
+
const source = exportPath.node.source?.value;
|
|
605
|
+
if (typeof source === "string" && !dependencySpecifiers.has(source)) {
|
|
606
|
+
dependencySpecifiers.set(source, []);
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
for (const [specifier, tokens] of dependencySpecifiers) {
|
|
611
|
+
let resolved;
|
|
612
|
+
try {
|
|
613
|
+
resolved = this.resolve(specifier, filename);
|
|
614
|
+
} catch {
|
|
615
|
+
continue;
|
|
616
|
+
}
|
|
617
|
+
if (!resolved) {
|
|
618
|
+
continue;
|
|
619
|
+
}
|
|
620
|
+
if (this.filter && !this.filter(resolved, specifier, filename)) {
|
|
621
|
+
continue;
|
|
622
|
+
}
|
|
623
|
+
if (tokens.length > 0) {
|
|
624
|
+
this.registerIgnoredExportsFromTokens(resolved, tokens);
|
|
625
|
+
}
|
|
626
|
+
if (this.modules.has(resolved)) {
|
|
627
|
+
continue;
|
|
628
|
+
}
|
|
629
|
+
let source;
|
|
630
|
+
try {
|
|
631
|
+
source = this.load(resolved);
|
|
632
|
+
} catch {
|
|
633
|
+
continue;
|
|
634
|
+
}
|
|
635
|
+
if (typeof source !== "string") {
|
|
636
|
+
continue;
|
|
637
|
+
}
|
|
638
|
+
let analysis;
|
|
639
|
+
try {
|
|
640
|
+
const ast = babelParse(source, {
|
|
641
|
+
...this.parserOptions,
|
|
642
|
+
sourceFilename: resolved
|
|
643
|
+
});
|
|
644
|
+
analysis = analyzeSource(ast, {
|
|
645
|
+
...this.baseOptions,
|
|
646
|
+
filename: resolved
|
|
647
|
+
});
|
|
648
|
+
this.applyIgnoredExportsToAnalysis(resolved, analysis);
|
|
649
|
+
} catch {
|
|
650
|
+
continue;
|
|
651
|
+
}
|
|
652
|
+
this.modules.set(resolved, {
|
|
653
|
+
filename: resolved,
|
|
654
|
+
source,
|
|
655
|
+
analysis
|
|
656
|
+
});
|
|
657
|
+
this.queue.push({ filename: resolved, depth: depth + 1 });
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
};
|
|
662
|
+
|
|
398
663
|
// src/js/NodePathWalker.ts
|
|
399
664
|
var NodePathWalker = class {
|
|
400
665
|
constructor({ ignoreCallExpressionIdentifiers, callback } = {}) {
|
|
@@ -494,6 +759,7 @@ var NodePathWalker = class {
|
|
|
494
759
|
declaration: importDeclaration,
|
|
495
760
|
specifier: arg,
|
|
496
761
|
imported: imported.node.name,
|
|
762
|
+
local: arg.node.local.name,
|
|
497
763
|
source: importDeclaration.node.source.value,
|
|
498
764
|
type: "ImportSpecifier"
|
|
499
765
|
}
|
|
@@ -504,6 +770,7 @@ var NodePathWalker = class {
|
|
|
504
770
|
{
|
|
505
771
|
declaration: importDeclaration,
|
|
506
772
|
specifier: arg,
|
|
773
|
+
local: arg.node.local.name,
|
|
507
774
|
source: importDeclaration.node.source.value,
|
|
508
775
|
type: "ImportDefaultSpecifier"
|
|
509
776
|
}
|
|
@@ -555,6 +822,8 @@ var NodePathWalker = class {
|
|
|
555
822
|
const decl = path2.get("declaration");
|
|
556
823
|
if (decl.isIdentifier()) {
|
|
557
824
|
this.walkNode(decl);
|
|
825
|
+
} else {
|
|
826
|
+
this.walkNode(decl);
|
|
558
827
|
}
|
|
559
828
|
}
|
|
560
829
|
walkExportAllDeclaration(path2) {
|
|
@@ -782,12 +1051,28 @@ function jsHandler(rawSource, options) {
|
|
|
782
1051
|
}
|
|
783
1052
|
const analysis = analyzeSource(ast, options);
|
|
784
1053
|
const ms = processUpdatedSource(rawSource, options, analysis);
|
|
785
|
-
|
|
1054
|
+
const result = {
|
|
786
1055
|
code: ms.toString(),
|
|
787
1056
|
get map() {
|
|
788
1057
|
return ms.generateMap();
|
|
789
1058
|
}
|
|
790
1059
|
};
|
|
1060
|
+
if (options.moduleGraph && options.filename) {
|
|
1061
|
+
const graph = new JsModuleGraph(
|
|
1062
|
+
{
|
|
1063
|
+
filename: options.filename,
|
|
1064
|
+
source: rawSource,
|
|
1065
|
+
analysis,
|
|
1066
|
+
handlerOptions: options
|
|
1067
|
+
},
|
|
1068
|
+
options.moduleGraph
|
|
1069
|
+
);
|
|
1070
|
+
const linked = graph.build();
|
|
1071
|
+
if (Object.keys(linked).length > 0) {
|
|
1072
|
+
result.linked = linked;
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
return result;
|
|
791
1076
|
}
|
|
792
1077
|
|
|
793
1078
|
// src/js/index.ts
|
|
@@ -1325,8 +1610,38 @@ import { getPackageInfoSync } from "local-pkg";
|
|
|
1325
1610
|
// src/tailwindcss/patcher.ts
|
|
1326
1611
|
import path from "path";
|
|
1327
1612
|
import process from "process";
|
|
1613
|
+
import { logger as logger2 } from "@weapp-tailwindcss/logger";
|
|
1328
1614
|
import { defuOverrideArray as defuOverrideArray2 } from "@weapp-tailwindcss/shared";
|
|
1329
1615
|
import { TailwindcssPatcher } from "tailwindcss-patch";
|
|
1616
|
+
function createFallbackTailwindcssPatcher() {
|
|
1617
|
+
const packageInfo = {
|
|
1618
|
+
name: "tailwindcss",
|
|
1619
|
+
version: void 0,
|
|
1620
|
+
rootPath: "",
|
|
1621
|
+
packageJsonPath: "",
|
|
1622
|
+
packageJson: {}
|
|
1623
|
+
};
|
|
1624
|
+
return {
|
|
1625
|
+
packageInfo,
|
|
1626
|
+
majorVersion: 0,
|
|
1627
|
+
patch() {
|
|
1628
|
+
},
|
|
1629
|
+
async getClassSet() {
|
|
1630
|
+
return /* @__PURE__ */ new Set();
|
|
1631
|
+
},
|
|
1632
|
+
getClassSetV3() {
|
|
1633
|
+
return /* @__PURE__ */ new Set();
|
|
1634
|
+
},
|
|
1635
|
+
async extract(_options) {
|
|
1636
|
+
const classSet = /* @__PURE__ */ new Set();
|
|
1637
|
+
return {
|
|
1638
|
+
classList: [],
|
|
1639
|
+
classSet
|
|
1640
|
+
};
|
|
1641
|
+
}
|
|
1642
|
+
};
|
|
1643
|
+
}
|
|
1644
|
+
var hasLoggedMissingTailwind = false;
|
|
1330
1645
|
function createTailwindcssPatcher(options) {
|
|
1331
1646
|
const { basedir, cacheDir, supportCustomLengthUnitsPatch, tailwindcss, tailwindcssPatcherOptions } = options || {};
|
|
1332
1647
|
const cache = {};
|
|
@@ -1339,7 +1654,7 @@ function createTailwindcssPatcher(options) {
|
|
|
1339
1654
|
cache.dir = path.resolve(process.cwd(), cacheDir);
|
|
1340
1655
|
}
|
|
1341
1656
|
}
|
|
1342
|
-
|
|
1657
|
+
const resolvedOptions = defuOverrideArray2(
|
|
1343
1658
|
tailwindcssPatcherOptions,
|
|
1344
1659
|
{
|
|
1345
1660
|
cache,
|
|
@@ -1357,7 +1672,19 @@ function createTailwindcssPatcher(options) {
|
|
|
1357
1672
|
}
|
|
1358
1673
|
}
|
|
1359
1674
|
}
|
|
1360
|
-
)
|
|
1675
|
+
);
|
|
1676
|
+
try {
|
|
1677
|
+
return new TailwindcssPatcher(resolvedOptions);
|
|
1678
|
+
} catch (error) {
|
|
1679
|
+
if (error instanceof Error && /tailwindcss not found/i.test(error.message)) {
|
|
1680
|
+
if (!hasLoggedMissingTailwind) {
|
|
1681
|
+
logger2.warn("Tailwind CSS \u672A\u5B89\u88C5\uFF0C\u5DF2\u8DF3\u8FC7 Tailwind \u76F8\u5173\u8865\u4E01\u3002\u82E5\u9700\u4F7F\u7528 Tailwind \u80FD\u529B\uFF0C\u8BF7\u5B89\u88C5 tailwindcss\u3002");
|
|
1682
|
+
hasLoggedMissingTailwind = true;
|
|
1683
|
+
}
|
|
1684
|
+
return createFallbackTailwindcssPatcher();
|
|
1685
|
+
}
|
|
1686
|
+
throw error;
|
|
1687
|
+
}
|
|
1361
1688
|
}
|
|
1362
1689
|
|
|
1363
1690
|
// src/context/tailwindcss.ts
|
|
@@ -1390,6 +1717,41 @@ function createTailwindcssPatcherFromContext(ctx) {
|
|
|
1390
1717
|
}
|
|
1391
1718
|
|
|
1392
1719
|
// src/context/index.ts
|
|
1720
|
+
var DEFAULT_SPACING_VARIABLE = "--spacing";
|
|
1721
|
+
function matchesSpacingToken(token) {
|
|
1722
|
+
if (typeof token === "string") {
|
|
1723
|
+
return token === DEFAULT_SPACING_VARIABLE;
|
|
1724
|
+
}
|
|
1725
|
+
token.lastIndex = 0;
|
|
1726
|
+
return token.test(DEFAULT_SPACING_VARIABLE);
|
|
1727
|
+
}
|
|
1728
|
+
function ensureSpacingIncluded(value) {
|
|
1729
|
+
if (value === true) {
|
|
1730
|
+
return {
|
|
1731
|
+
includeCustomProperties: [DEFAULT_SPACING_VARIABLE]
|
|
1732
|
+
};
|
|
1733
|
+
}
|
|
1734
|
+
if (Array.isArray(value)) {
|
|
1735
|
+
return value.some(matchesSpacingToken) ? value : [...value, DEFAULT_SPACING_VARIABLE];
|
|
1736
|
+
}
|
|
1737
|
+
if (value && typeof value === "object") {
|
|
1738
|
+
const include = value.includeCustomProperties;
|
|
1739
|
+
if (!Array.isArray(include) || include.length === 0) {
|
|
1740
|
+
return {
|
|
1741
|
+
...value,
|
|
1742
|
+
includeCustomProperties: [DEFAULT_SPACING_VARIABLE]
|
|
1743
|
+
};
|
|
1744
|
+
}
|
|
1745
|
+
if (include.some(matchesSpacingToken)) {
|
|
1746
|
+
return value;
|
|
1747
|
+
}
|
|
1748
|
+
return {
|
|
1749
|
+
...value,
|
|
1750
|
+
includeCustomProperties: [...include, DEFAULT_SPACING_VARIABLE]
|
|
1751
|
+
};
|
|
1752
|
+
}
|
|
1753
|
+
return value;
|
|
1754
|
+
}
|
|
1393
1755
|
function getCompilerContext(opts) {
|
|
1394
1756
|
const ctx = defuOverrideArray(
|
|
1395
1757
|
opts,
|
|
@@ -1399,8 +1761,16 @@ function getCompilerContext(opts) {
|
|
|
1399
1761
|
ctx.escapeMap = ctx.customReplaceDictionary;
|
|
1400
1762
|
applyLoggerLevel(ctx.logLevel);
|
|
1401
1763
|
const twPatcher = createTailwindcssPatcherFromContext(ctx);
|
|
1402
|
-
|
|
1403
|
-
|
|
1764
|
+
if (twPatcher.packageInfo?.version) {
|
|
1765
|
+
logger3.success(`\u5F53\u524D\u4F7F\u7528 ${pc.cyanBright("Tailwind CSS")} \u7248\u672C\u4E3A: ${pc.underline(pc.bold(pc.green(twPatcher.packageInfo.version)))}`);
|
|
1766
|
+
} else {
|
|
1767
|
+
logger3.warn(`${pc.cyanBright("Tailwind CSS")} \u672A\u5B89\u88C5\uFF0C\u5DF2\u8DF3\u8FC7\u7248\u672C\u68C0\u6D4B\u4E0E\u8865\u4E01\u5E94\u7528\u3002`);
|
|
1768
|
+
}
|
|
1769
|
+
let cssCalcOptions = ctx.cssCalc ?? twPatcher.majorVersion === 4;
|
|
1770
|
+
if (twPatcher.majorVersion === 4 && cssCalcOptions) {
|
|
1771
|
+
cssCalcOptions = ensureSpacingIncluded(cssCalcOptions);
|
|
1772
|
+
}
|
|
1773
|
+
ctx.cssCalc = cssCalcOptions;
|
|
1404
1774
|
const customAttributesEntities = toCustomAttributesEntities(ctx.customAttributes);
|
|
1405
1775
|
const { initMangle, mangleContext, setMangleRuntimeSet } = useMangleStore();
|
|
1406
1776
|
initMangle(ctx.mangle);
|
package/dist/cli.js
CHANGED
|
@@ -6,11 +6,11 @@ var _chunkOXASK55Qjs = require('./chunk-OXASK55Q.js');
|
|
|
6
6
|
var _chunkOGROHM4Ljs = require('./chunk-OGROHM4L.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkXYYHPJOQjs = require('./chunk-XYYHPJOQ.js');
|
|
10
10
|
require('./chunk-PLMJW644.js');
|
|
11
11
|
require('./chunk-FOSGDQZ7.js');
|
|
12
12
|
require('./chunk-UW3WHSZ5.js');
|
|
13
|
-
require('./chunk-
|
|
13
|
+
require('./chunk-NHB7NFQC.js');
|
|
14
14
|
|
|
15
15
|
// src/cli.ts
|
|
16
16
|
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
@@ -24,6 +24,6 @@ if (_semver2.default.lt(_process2.default.versions.node, _chunkOGROHM4Ljs.WEAPP_
|
|
|
24
24
|
}
|
|
25
25
|
var command = args[0];
|
|
26
26
|
if (command === "patch") {
|
|
27
|
-
const ctx =
|
|
27
|
+
const ctx = _chunkXYYHPJOQjs.getCompilerContext.call(void 0, );
|
|
28
28
|
ctx.twPatcher.patch();
|
|
29
29
|
}
|
package/dist/cli.mjs
CHANGED
|
@@ -6,11 +6,11 @@ import {
|
|
|
6
6
|
} from "./chunk-CMUA5KCO.mjs";
|
|
7
7
|
import {
|
|
8
8
|
getCompilerContext
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-Z7Q5UFNU.mjs";
|
|
10
10
|
import "./chunk-Q67IXIAH.mjs";
|
|
11
11
|
import "./chunk-IHKVNALD.mjs";
|
|
12
12
|
import "./chunk-ZNKIYZRQ.mjs";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-FWIGQ4RY.mjs";
|
|
14
14
|
|
|
15
15
|
// src/cli.ts
|
|
16
16
|
import process from "process";
|
package/dist/core.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkXYYHPJOQjs = require('./chunk-XYYHPJOQ.js');
|
|
4
4
|
require('./chunk-PLMJW644.js');
|
|
5
5
|
require('./chunk-FOSGDQZ7.js');
|
|
6
6
|
require('./chunk-UW3WHSZ5.js');
|
|
7
|
-
require('./chunk-
|
|
7
|
+
require('./chunk-NHB7NFQC.js');
|
|
8
8
|
|
|
9
9
|
// src/core.ts
|
|
10
10
|
var _shared = require('@weapp-tailwindcss/shared');
|
|
11
11
|
function createContext(options = {}) {
|
|
12
|
-
const opts =
|
|
12
|
+
const opts = _chunkXYYHPJOQjs.getCompilerContext.call(void 0, options);
|
|
13
13
|
const { templateHandler, styleHandler, jsHandler, twPatcher } = opts;
|
|
14
14
|
let runtimeSet = /* @__PURE__ */ new Set();
|
|
15
15
|
twPatcher.patch();
|
package/dist/core.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getCompilerContext
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-Z7Q5UFNU.mjs";
|
|
4
4
|
import "./chunk-Q67IXIAH.mjs";
|
|
5
5
|
import "./chunk-IHKVNALD.mjs";
|
|
6
6
|
import "./chunk-ZNKIYZRQ.mjs";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-FWIGQ4RY.mjs";
|
|
8
8
|
|
|
9
9
|
// src/core.ts
|
|
10
10
|
import { defuOverrideArray } from "@weapp-tailwindcss/shared";
|
package/dist/css-macro.js
CHANGED
|
@@ -5,7 +5,7 @@ var _chunkNS3NEDWDjs = require('./chunk-NS3NEDWD.js');
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
|
|
8
|
-
require('./chunk-
|
|
8
|
+
require('./chunk-NHB7NFQC.js');
|
|
9
9
|
|
|
10
10
|
// src/css-macro/index.ts
|
|
11
11
|
var _plugin = require('tailwindcss/plugin'); var _plugin2 = _interopRequireDefault(_plugin);
|
package/dist/css-macro.mjs
CHANGED
package/dist/defaults.js
CHANGED
package/dist/defaults.mjs
CHANGED
package/dist/escape.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
var _chunkPLMJW644js = require('./chunk-PLMJW644.js');
|
|
4
|
-
require('./chunk-
|
|
4
|
+
require('./chunk-NHB7NFQC.js');
|
|
5
5
|
|
|
6
6
|
// src/escape.ts
|
|
7
7
|
var _escape = require('@weapp-core/escape');
|
package/dist/escape.mjs
CHANGED
package/dist/gulp.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkMRKRCDIEjs = require('./chunk-MRKRCDIE.js');
|
|
4
4
|
require('./chunk-2NRTWL47.js');
|
|
5
|
-
require('./chunk-
|
|
5
|
+
require('./chunk-XYYHPJOQ.js');
|
|
6
6
|
require('./chunk-PLMJW644.js');
|
|
7
7
|
require('./chunk-FOSGDQZ7.js');
|
|
8
8
|
require('./chunk-UW3WHSZ5.js');
|
|
9
|
-
require('./chunk-
|
|
9
|
+
require('./chunk-NHB7NFQC.js');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
exports.createPlugins =
|
|
12
|
+
exports.createPlugins = _chunkMRKRCDIEjs.createPlugins;
|
package/dist/gulp.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createPlugins
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DKUPUV4T.mjs";
|
|
4
4
|
import "./chunk-H4JTYYOI.mjs";
|
|
5
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-Z7Q5UFNU.mjs";
|
|
6
6
|
import "./chunk-Q67IXIAH.mjs";
|
|
7
7
|
import "./chunk-IHKVNALD.mjs";
|
|
8
8
|
import "./chunk-ZNKIYZRQ.mjs";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-FWIGQ4RY.mjs";
|
|
10
10
|
export {
|
|
11
11
|
createPlugins
|
|
12
12
|
};
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { createPlugins } from './gulp.mjs';
|
|
2
|
-
export { AppType, CreateJsHandlerOptions, IArbitraryValues, IBaseWebpackPlugin, ICommonReplaceOptions, ICustomAttributes, ICustomAttributesEntities, IJsHandlerOptions, ITemplateHandlerOptions, InternalCssSelectorReplacerOptions, InternalPatchResult, InternalPostcssOptions, InternalUserDefinedOptions, ItemOrItemArray, JsHandler, JsHandlerResult, UserDefinedOptions } from './types.mjs';
|
|
2
|
+
export { AppType, CreateJsHandlerOptions, IArbitraryValues, IBaseWebpackPlugin, ICommonReplaceOptions, ICustomAttributes, ICustomAttributesEntities, IJsHandlerOptions, ITemplateHandlerOptions, InternalCssSelectorReplacerOptions, InternalPatchResult, InternalPostcssOptions, InternalUserDefinedOptions, ItemOrItemArray, JsHandler, JsHandlerResult, JsModuleGraphOptions, LinkedJsModuleResult, TailwindcssPatcherLike, UserDefinedOptions } from './types.mjs';
|
|
3
3
|
export { UnifiedViteWeappTailwindcssPlugin } from './vite.mjs';
|
|
4
4
|
export { UnifiedWebpackPluginV5 } from './webpack.mjs';
|
|
5
5
|
export { CssPreflightOptions, IStyleHandlerOptions } from '@weapp-tailwindcss/postcss';
|