@tailwindcss-mangle/core 5.1.0 → 5.1.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/index.cjs +9 -5
- package/dist/index.js +9 -5
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -264,7 +264,7 @@ var Context = class {
|
|
|
264
264
|
const { cwd, classList: _classList, transformerOptions } = opts;
|
|
265
265
|
const { config, cwd: configCwd } = await (0, import_config.getConfig)(cwd);
|
|
266
266
|
this.configRoot = configCwd ?? cwd ?? import_node_process.default.cwd();
|
|
267
|
-
|
|
267
|
+
const normalizedTransformer = transformerOptions ? { ...transformerOptions, registry: { ...transformerOptions.registry } } : void 0;
|
|
268
268
|
if (normalizedTransformer?.registry?.mapping === true) {
|
|
269
269
|
const fallback = config?.transformer?.registry?.mapping;
|
|
270
270
|
if (typeof fallback === "function") {
|
|
@@ -499,8 +499,8 @@ function jsHandler(rawSource, options) {
|
|
|
499
499
|
}
|
|
500
500
|
|
|
501
501
|
// src/svelte/index.ts
|
|
502
|
-
var import_compiler = require("svelte/compiler");
|
|
503
502
|
var import_magic_string3 = __toESM(require("magic-string"), 1);
|
|
503
|
+
var import_compiler = require("svelte/compiler");
|
|
504
504
|
async function svelteHandler(rawSource, options) {
|
|
505
505
|
const { ctx, id } = options;
|
|
506
506
|
const ms = new import_magic_string3.default(rawSource);
|
|
@@ -523,7 +523,9 @@ async function processSvelteAst(ast, ms, ctx, id) {
|
|
|
523
523
|
const { replaceMap, classGenerator } = ctx;
|
|
524
524
|
const stylePromises = [];
|
|
525
525
|
async function walk(node) {
|
|
526
|
-
if (!node)
|
|
526
|
+
if (!node) {
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
527
529
|
if (node.type === "Attribute" && node.name === "class") {
|
|
528
530
|
for (const attrValue of node.value) {
|
|
529
531
|
if (attrValue.type === "Text") {
|
|
@@ -627,7 +629,7 @@ async function processTemplate(template, ms, ctx, id) {
|
|
|
627
629
|
const compiled = (0, import_compiler_sfc.compileTemplate)({
|
|
628
630
|
source: template.content,
|
|
629
631
|
filename: id || "unknown.vue",
|
|
630
|
-
id:
|
|
632
|
+
id: `${id || "unknown"}?template`
|
|
631
633
|
});
|
|
632
634
|
} catch {
|
|
633
635
|
return;
|
|
@@ -674,7 +676,9 @@ async function processTemplate(template, ms, ctx, id) {
|
|
|
674
676
|
}
|
|
675
677
|
async function processScript(descriptor, ms, ctx, id) {
|
|
676
678
|
const script = descriptor.scriptSetup || descriptor.script;
|
|
677
|
-
if (!script)
|
|
679
|
+
if (!script) {
|
|
680
|
+
return;
|
|
681
|
+
}
|
|
678
682
|
const scriptContent = ms.original.slice(
|
|
679
683
|
script.loc.start.offset,
|
|
680
684
|
script.loc.end.offset
|
package/dist/index.js
CHANGED
|
@@ -235,7 +235,7 @@ var Context = class {
|
|
|
235
235
|
const { cwd, classList: _classList, transformerOptions } = opts;
|
|
236
236
|
const { config, cwd: configCwd } = await getConfig(cwd);
|
|
237
237
|
this.configRoot = configCwd ?? cwd ?? process.cwd();
|
|
238
|
-
|
|
238
|
+
const normalizedTransformer = transformerOptions ? { ...transformerOptions, registry: { ...transformerOptions.registry } } : void 0;
|
|
239
239
|
if (normalizedTransformer?.registry?.mapping === true) {
|
|
240
240
|
const fallback = config?.transformer?.registry?.mapping;
|
|
241
241
|
if (typeof fallback === "function") {
|
|
@@ -470,8 +470,8 @@ function jsHandler(rawSource, options) {
|
|
|
470
470
|
}
|
|
471
471
|
|
|
472
472
|
// src/svelte/index.ts
|
|
473
|
-
import { parse as parse2 } from "svelte/compiler";
|
|
474
473
|
import MagicString3 from "magic-string";
|
|
474
|
+
import { parse as parse2 } from "svelte/compiler";
|
|
475
475
|
async function svelteHandler(rawSource, options) {
|
|
476
476
|
const { ctx, id } = options;
|
|
477
477
|
const ms = new MagicString3(rawSource);
|
|
@@ -494,7 +494,9 @@ async function processSvelteAst(ast, ms, ctx, id) {
|
|
|
494
494
|
const { replaceMap, classGenerator } = ctx;
|
|
495
495
|
const stylePromises = [];
|
|
496
496
|
async function walk(node) {
|
|
497
|
-
if (!node)
|
|
497
|
+
if (!node) {
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
498
500
|
if (node.type === "Attribute" && node.name === "class") {
|
|
499
501
|
for (const attrValue of node.value) {
|
|
500
502
|
if (attrValue.type === "Text") {
|
|
@@ -598,7 +600,7 @@ async function processTemplate(template, ms, ctx, id) {
|
|
|
598
600
|
const compiled = compileTemplate({
|
|
599
601
|
source: template.content,
|
|
600
602
|
filename: id || "unknown.vue",
|
|
601
|
-
id:
|
|
603
|
+
id: `${id || "unknown"}?template`
|
|
602
604
|
});
|
|
603
605
|
} catch {
|
|
604
606
|
return;
|
|
@@ -645,7 +647,9 @@ async function processTemplate(template, ms, ctx, id) {
|
|
|
645
647
|
}
|
|
646
648
|
async function processScript(descriptor, ms, ctx, id) {
|
|
647
649
|
const script = descriptor.scriptSetup || descriptor.script;
|
|
648
|
-
if (!script)
|
|
650
|
+
if (!script) {
|
|
651
|
+
return;
|
|
652
|
+
}
|
|
649
653
|
const scriptContent = ms.original.slice(
|
|
650
654
|
script.loc.start.offset,
|
|
651
655
|
script.loc.end.offset
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailwindcss-mangle/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.1.
|
|
4
|
+
"version": "5.1.1",
|
|
5
5
|
"description": "The core of tailwindcss-mangle",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
"pathe": "^2.0.3",
|
|
60
60
|
"postcss": "^8.5.6",
|
|
61
61
|
"postcss-selector-parser": "^7.1.1",
|
|
62
|
-
"svelte": "^5.
|
|
63
|
-
"@tailwindcss-mangle/config": "^6.1.
|
|
64
|
-
"@tailwindcss-mangle/shared": "^4.1.
|
|
62
|
+
"svelte": "^5.53.3",
|
|
63
|
+
"@tailwindcss-mangle/config": "^6.1.2",
|
|
64
|
+
"@tailwindcss-mangle/shared": "^4.1.2"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@types/parse5": "^7.0.0"
|