@tailwindcss-mangle/core 2.0.6 → 2.1.0

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
@@ -402,8 +402,8 @@ const plugin = helperPluginUtils.declare((api, options) => {
402
402
  });
403
403
  function preProcessJs(options) {
404
404
  const { code, replaceMap, id, addToUsedBy } = options;
405
- const magicString = new MagicString__default(code);
406
- babel__default.transformSync(code, {
405
+ const magicString = typeof code === "string" ? new MagicString__default(code) : code;
406
+ babel__default.transformSync(magicString.original, {
407
407
  presets: [
408
408
  // ['@babel/preset-react', {}],
409
409
  [
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ import { ClassGenerator } from '@tailwindcss-mangle/shared';
4
4
  export { ClassGenerator } from '@tailwindcss-mangle/shared';
5
5
  import { StringLiteral, TemplateElement } from '@babel/types';
6
6
  import { BabelFileResult } from '@babel/core';
7
+ import MagicString from 'magic-string';
7
8
 
8
9
  interface IClassGeneratorContextItem {
9
10
  name: string;
@@ -38,7 +39,7 @@ declare function cssHandler(rawSource: string, options: ICssHandlerOptions): pos
38
39
  declare function htmlHandler(rawSource: string, options: IHtmlHandlerOptions): string;
39
40
 
40
41
  declare function preProcessJs(options: {
41
- code: string;
42
+ code: string | MagicString;
42
43
  replaceMap: Map<string, string>;
43
44
  id: string;
44
45
  addToUsedBy: (key: string, file: string) => void;
package/dist/index.mjs CHANGED
@@ -403,8 +403,8 @@ const plugin = declare((api, options) => {
403
403
  });
404
404
  function preProcessJs(options) {
405
405
  const { code, replaceMap, id, addToUsedBy } = options;
406
- const magicString = new MagicString(code);
407
- babel.transformSync(code, {
406
+ const magicString = typeof code === "string" ? new MagicString(code) : code;
407
+ babel.transformSync(magicString.original, {
408
408
  presets: [
409
409
  // ['@babel/preset-react', {}],
410
410
  [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tailwindcss-mangle/core",
3
- "version": "2.0.6",
3
+ "version": "2.1.0",
4
4
  "description": "The core of tailwindcss-mangle",
5
5
  "exports": {
6
6
  ".": {
@@ -45,7 +45,7 @@
45
45
  "parse5": "^7.1.2",
46
46
  "postcss": "^8.4.27",
47
47
  "postcss-selector-parser": "^6.0.13",
48
- "@tailwindcss-mangle/shared": "^2.0.4"
48
+ "@tailwindcss-mangle/shared": "^2.1.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@parse5/tools": "^0.2.0",