@tailwindcss-mangle/core 4.0.1 → 4.0.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/dist/index.cjs CHANGED
@@ -29,8 +29,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
29
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
30
 
31
31
  // src/index.ts
32
- var src_exports = {};
33
- __export(src_exports, {
32
+ var index_exports = {};
33
+ __export(index_exports, {
34
34
  ClassGenerator: () => shared_exports.ClassGenerator,
35
35
  Context: () => Context,
36
36
  cssHandler: () => cssHandler,
@@ -38,7 +38,7 @@ __export(src_exports, {
38
38
  htmlHandler: () => htmlHandler,
39
39
  jsHandler: () => jsHandler
40
40
  });
41
- module.exports = __toCommonJS(src_exports);
41
+ module.exports = __toCommonJS(index_exports);
42
42
 
43
43
  // src/css/index.ts
44
44
  var import_postcss = __toESM(require("postcss"), 1);
@@ -352,6 +352,9 @@ function _interopDefaultCompat(e) {
352
352
  }
353
353
  var traverse = _interopDefaultCompat(import_traverse.default);
354
354
 
355
+ // src/constants.ts
356
+ var ignoreIdentifier = "twIgnore";
357
+
355
358
  // src/js/index.ts
356
359
  function handleValue(raw, node, options, ms, offset, escape) {
357
360
  const { ctx, splitQuote = true, id } = options;
@@ -407,6 +410,20 @@ function jsHandler(rawSource, options) {
407
410
  TemplateElement: {
408
411
  enter(p) {
409
412
  const n = p.node;
413
+ if (p.parentPath.isTemplateLiteral()) {
414
+ if (p.parentPath.parentPath.isTaggedTemplateExpression() && p.parentPath.parentPath.get("tag").isIdentifier({
415
+ name: ignoreIdentifier
416
+ })) {
417
+ const { splitQuote = true } = options;
418
+ const array = (0, shared_exports.splitCode)(n.value.raw, {
419
+ splitQuote
420
+ });
421
+ for (const item of array) {
422
+ ctx.addPreserveClass(item);
423
+ }
424
+ return;
425
+ }
426
+ }
410
427
  handleValue(n.value.raw, n, options, ms, 0, false);
411
428
  }
412
429
  },
package/dist/index.js CHANGED
@@ -325,6 +325,9 @@ function _interopDefaultCompat(e) {
325
325
  }
326
326
  var traverse = _interopDefaultCompat(_babelTraverse);
327
327
 
328
+ // src/constants.ts
329
+ var ignoreIdentifier = "twIgnore";
330
+
328
331
  // src/js/index.ts
329
332
  function handleValue(raw, node, options, ms, offset, escape) {
330
333
  const { ctx, splitQuote = true, id } = options;
@@ -380,6 +383,20 @@ function jsHandler(rawSource, options) {
380
383
  TemplateElement: {
381
384
  enter(p) {
382
385
  const n = p.node;
386
+ if (p.parentPath.isTemplateLiteral()) {
387
+ if (p.parentPath.parentPath.isTaggedTemplateExpression() && p.parentPath.parentPath.get("tag").isIdentifier({
388
+ name: ignoreIdentifier
389
+ })) {
390
+ const { splitQuote = true } = options;
391
+ const array = (0, shared_exports.splitCode)(n.value.raw, {
392
+ splitQuote
393
+ });
394
+ for (const item of array) {
395
+ ctx.addPreserveClass(item);
396
+ }
397
+ return;
398
+ }
399
+ }
383
400
  handleValue(n.value.raw, n, options, ms, 0, false);
384
401
  }
385
402
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tailwindcss-mangle/core",
3
3
  "type": "module",
4
- "version": "4.0.1",
4
+ "version": "4.0.3",
5
5
  "description": "The core of tailwindcss-mangle",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -47,17 +47,17 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "@ast-core/escape": "^1.0.1",
50
- "@babel/parser": "^7.26.1",
51
- "@babel/traverse": "^7.25.9",
52
- "@babel/types": "^7.26.0",
50
+ "@babel/parser": "^7.26.9",
51
+ "@babel/traverse": "^7.26.9",
52
+ "@babel/types": "^7.26.9",
53
53
  "fast-sort": "^3.4.1",
54
- "fs-extra": "^11.2.0",
55
- "htmlparser2": "9.1.0",
56
- "magic-string": "^0.30.12",
57
- "pathe": "^1.1.2",
58
- "postcss": "^8.4.47",
59
- "postcss-selector-parser": "^7.0.0",
60
- "@tailwindcss-mangle/config": "^4.0.1",
54
+ "fs-extra": "^11.3.0",
55
+ "htmlparser2": "10.0.0",
56
+ "magic-string": "^0.30.17",
57
+ "pathe": "^2.0.3",
58
+ "postcss": "^8.5.2",
59
+ "postcss-selector-parser": "^7.1.0",
60
+ "@tailwindcss-mangle/config": "^5.0.0",
61
61
  "@tailwindcss-mangle/shared": "^4.0.1"
62
62
  },
63
63
  "scripts": {