@tailwindcss-mangle/config 2.2.1 → 3.0.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
@@ -3,15 +3,18 @@
3
3
  const path = require('node:path');
4
4
  const fs = require('node:fs/promises');
5
5
  const c12 = require('c12');
6
- const dedent = require('dedent');
6
+ const process = require('node:process');
7
7
  const shared = require('@tailwindcss-mangle/shared');
8
+ const isCssRequest = require('is-css-request');
8
9
 
9
10
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
10
11
 
11
12
  const path__default = /*#__PURE__*/_interopDefaultCompat(path);
12
13
  const fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
13
- const dedent__default = /*#__PURE__*/_interopDefaultCompat(dedent);
14
+ const process__default = /*#__PURE__*/_interopDefaultCompat(process);
14
15
 
16
+ const defaultPipelineInclude = ["**/*.{html,js,ts,jsx,tsx,vue,svelte,astro,elm,php,phtml,mdx,md}", isCssRequest.CSS_LANGS_RE];
17
+ const defaultPipelineExclude = [/[\\/](node_modules|dist|\.temp|\.cache|\.vscode)[\\/]/];
15
18
  function getDefaultPatchConfig() {
16
19
  return {
17
20
  output: {
@@ -25,9 +28,9 @@ function getDefaultPatchConfig() {
25
28
  function getDefaultMangleUserConfig() {
26
29
  return {
27
30
  mangleClassFilter: shared.defaultMangleClassFilter,
28
- include: ["**/*.{js,jsx,ts,tsx,svelte,vue}"],
29
- exclude: ["node_modules/**/*", "**/*.{css,scss,less,sass,postcss,html,htm}"],
30
- disabled: process.env.NODE_ENV === "development",
31
+ include: defaultPipelineInclude,
32
+ exclude: defaultPipelineExclude,
33
+ disabled: process__default.env.NODE_ENV === "development",
31
34
  classListPath: ".tw-patch/tw-class-list.json",
32
35
  classMapOutput: {
33
36
  enable: false,
@@ -59,11 +62,10 @@ const defineConfig = c12.createDefineConfig();
59
62
  function initConfig(cwd) {
60
63
  return fs__default.writeFile(
61
64
  path__default.resolve(cwd, `${configName}.config.ts`),
62
- dedent__default`
63
- import { defineConfig } from 'tailwindcss-patch'
65
+ `import { defineConfig } from 'tailwindcss-patch'
64
66
 
65
- export default defineConfig({})
66
- `,
67
+ export default defineConfig({})
68
+ `,
67
69
  "utf8"
68
70
  );
69
71
  }
package/dist/index.d.cts CHANGED
@@ -1,18 +1,24 @@
1
1
  import * as c12 from 'c12';
2
2
  import { IClassGeneratorOptions } from '@tailwindcss-mangle/shared';
3
+ import { FilterPattern } from '@rollup/pluginutils';
3
4
 
4
5
  interface ClassMapOutputOptions {
5
6
  enable?: boolean;
6
7
  filename?: string;
7
8
  loose?: boolean;
8
9
  }
10
+ interface ClassMapOutputItem {
11
+ before: string;
12
+ after: string;
13
+ usedBy: string[];
14
+ }
9
15
  interface MangleUserConfig {
10
16
  mangleClassFilter?: (className: string) => boolean;
11
17
  classGenerator?: IClassGeneratorOptions;
12
- exclude?: string[];
13
- include?: string[];
18
+ exclude?: FilterPattern;
19
+ include?: FilterPattern;
14
20
  classListPath?: string;
15
- classMapOutput?: ClassMapOutputOptions;
21
+ classMapOutput?: boolean | ClassMapOutputOptions | ((json: ClassMapOutputItem[]) => void);
16
22
  disabled?: boolean;
17
23
  preserveFunction?: string[];
18
24
  }
@@ -45,4 +51,4 @@ declare function getDefaultUserConfig(): UserConfig;
45
51
 
46
52
  declare const configName = "tailwindcss-mangle";
47
53
 
48
- export { type ClassMapOutputOptions, type MangleUserConfig, type PatchUserConfig, type UserConfig, configName, defineConfig, getConfig, getDefaultMangleUserConfig, getDefaultPatchConfig, getDefaultUserConfig, initConfig };
54
+ export { type ClassMapOutputItem, type ClassMapOutputOptions, type MangleUserConfig, type PatchUserConfig, type UserConfig, configName, defineConfig, getConfig, getDefaultMangleUserConfig, getDefaultPatchConfig, getDefaultUserConfig, initConfig };
package/dist/index.d.mts CHANGED
@@ -1,18 +1,24 @@
1
1
  import * as c12 from 'c12';
2
2
  import { IClassGeneratorOptions } from '@tailwindcss-mangle/shared';
3
+ import { FilterPattern } from '@rollup/pluginutils';
3
4
 
4
5
  interface ClassMapOutputOptions {
5
6
  enable?: boolean;
6
7
  filename?: string;
7
8
  loose?: boolean;
8
9
  }
10
+ interface ClassMapOutputItem {
11
+ before: string;
12
+ after: string;
13
+ usedBy: string[];
14
+ }
9
15
  interface MangleUserConfig {
10
16
  mangleClassFilter?: (className: string) => boolean;
11
17
  classGenerator?: IClassGeneratorOptions;
12
- exclude?: string[];
13
- include?: string[];
18
+ exclude?: FilterPattern;
19
+ include?: FilterPattern;
14
20
  classListPath?: string;
15
- classMapOutput?: ClassMapOutputOptions;
21
+ classMapOutput?: boolean | ClassMapOutputOptions | ((json: ClassMapOutputItem[]) => void);
16
22
  disabled?: boolean;
17
23
  preserveFunction?: string[];
18
24
  }
@@ -45,4 +51,4 @@ declare function getDefaultUserConfig(): UserConfig;
45
51
 
46
52
  declare const configName = "tailwindcss-mangle";
47
53
 
48
- export { type ClassMapOutputOptions, type MangleUserConfig, type PatchUserConfig, type UserConfig, configName, defineConfig, getConfig, getDefaultMangleUserConfig, getDefaultPatchConfig, getDefaultUserConfig, initConfig };
54
+ export { type ClassMapOutputItem, type ClassMapOutputOptions, type MangleUserConfig, type PatchUserConfig, type UserConfig, configName, defineConfig, getConfig, getDefaultMangleUserConfig, getDefaultPatchConfig, getDefaultUserConfig, initConfig };
package/dist/index.d.ts CHANGED
@@ -1,18 +1,24 @@
1
1
  import * as c12 from 'c12';
2
2
  import { IClassGeneratorOptions } from '@tailwindcss-mangle/shared';
3
+ import { FilterPattern } from '@rollup/pluginutils';
3
4
 
4
5
  interface ClassMapOutputOptions {
5
6
  enable?: boolean;
6
7
  filename?: string;
7
8
  loose?: boolean;
8
9
  }
10
+ interface ClassMapOutputItem {
11
+ before: string;
12
+ after: string;
13
+ usedBy: string[];
14
+ }
9
15
  interface MangleUserConfig {
10
16
  mangleClassFilter?: (className: string) => boolean;
11
17
  classGenerator?: IClassGeneratorOptions;
12
- exclude?: string[];
13
- include?: string[];
18
+ exclude?: FilterPattern;
19
+ include?: FilterPattern;
14
20
  classListPath?: string;
15
- classMapOutput?: ClassMapOutputOptions;
21
+ classMapOutput?: boolean | ClassMapOutputOptions | ((json: ClassMapOutputItem[]) => void);
16
22
  disabled?: boolean;
17
23
  preserveFunction?: string[];
18
24
  }
@@ -45,4 +51,4 @@ declare function getDefaultUserConfig(): UserConfig;
45
51
 
46
52
  declare const configName = "tailwindcss-mangle";
47
53
 
48
- export { type ClassMapOutputOptions, type MangleUserConfig, type PatchUserConfig, type UserConfig, configName, defineConfig, getConfig, getDefaultMangleUserConfig, getDefaultPatchConfig, getDefaultUserConfig, initConfig };
54
+ export { type ClassMapOutputItem, type ClassMapOutputOptions, type MangleUserConfig, type PatchUserConfig, type UserConfig, configName, defineConfig, getConfig, getDefaultMangleUserConfig, getDefaultPatchConfig, getDefaultUserConfig, initConfig };
package/dist/index.mjs CHANGED
@@ -1,9 +1,12 @@
1
1
  import path from 'node:path';
2
2
  import fs from 'node:fs/promises';
3
3
  import { createDefineConfig, loadConfig } from 'c12';
4
- import dedent from 'dedent';
4
+ import process from 'node:process';
5
5
  import { defaultMangleClassFilter } from '@tailwindcss-mangle/shared';
6
+ import { CSS_LANGS_RE } from 'is-css-request';
6
7
 
8
+ const defaultPipelineInclude = ["**/*.{html,js,ts,jsx,tsx,vue,svelte,astro,elm,php,phtml,mdx,md}", CSS_LANGS_RE];
9
+ const defaultPipelineExclude = [/[\\/](node_modules|dist|\.temp|\.cache|\.vscode)[\\/]/];
7
10
  function getDefaultPatchConfig() {
8
11
  return {
9
12
  output: {
@@ -17,8 +20,8 @@ function getDefaultPatchConfig() {
17
20
  function getDefaultMangleUserConfig() {
18
21
  return {
19
22
  mangleClassFilter: defaultMangleClassFilter,
20
- include: ["**/*.{js,jsx,ts,tsx,svelte,vue}"],
21
- exclude: ["node_modules/**/*", "**/*.{css,scss,less,sass,postcss,html,htm}"],
23
+ include: defaultPipelineInclude,
24
+ exclude: defaultPipelineExclude,
22
25
  disabled: process.env.NODE_ENV === "development",
23
26
  classListPath: ".tw-patch/tw-class-list.json",
24
27
  classMapOutput: {
@@ -51,11 +54,10 @@ const defineConfig = createDefineConfig();
51
54
  function initConfig(cwd) {
52
55
  return fs.writeFile(
53
56
  path.resolve(cwd, `${configName}.config.ts`),
54
- dedent`
55
- import { defineConfig } from 'tailwindcss-patch'
57
+ `import { defineConfig } from 'tailwindcss-patch'
56
58
 
57
- export default defineConfig({})
58
- `,
59
+ export default defineConfig({})
60
+ `,
59
61
  "utf8"
60
62
  );
61
63
  }
package/package.json CHANGED
@@ -1,7 +1,23 @@
1
1
  {
2
2
  "name": "@tailwindcss-mangle/config",
3
- "version": "2.2.1",
3
+ "version": "3.0.0",
4
4
  "description": "The config and load function of tailwindcss-mangle",
5
+ "author": "SonOfMagic <qq1324318532@gmail.com>",
6
+ "license": "MIT",
7
+ "homepage": "https://github.com/sonofmagic/tailwindcss-mangle",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/sonofmagic/tailwindcss-mangle.git"
11
+ },
12
+ "keywords": [
13
+ "tailwindcss",
14
+ "mangle",
15
+ "patch",
16
+ "core",
17
+ "mangle",
18
+ "shared",
19
+ "utils"
20
+ ],
5
21
  "exports": {
6
22
  ".": {
7
23
  "types": "./dist/index.d.ts",
@@ -9,6 +25,9 @@
9
25
  "require": "./dist/index.cjs"
10
26
  }
11
27
  },
28
+ "main": "./dist/index.cjs",
29
+ "module": "./dist/index.mjs",
30
+ "types": "./dist/index.d.ts",
12
31
  "typesVersions": {
13
32
  "*": {
14
33
  "*": [
@@ -17,36 +36,17 @@
17
36
  ]
18
37
  }
19
38
  },
20
- "main": "./dist/index.cjs",
21
- "module": "./dist/index.mjs",
22
- "types": "./dist/index.d.ts",
23
39
  "files": [
24
40
  "dist"
25
41
  ],
26
- "keywords": [
27
- "tailwindcss",
28
- "mangle",
29
- "patch",
30
- "core",
31
- "mangle",
32
- "shared",
33
- "utils"
34
- ],
35
- "author": "SonOfMagic <qq1324318532@gmail.com>",
36
- "license": "MIT",
37
42
  "publishConfig": {
38
43
  "access": "public",
39
44
  "registry": "https://registry.npmjs.org/"
40
45
  },
41
46
  "dependencies": {
42
- "c12": "^1.4.2",
43
- "dedent": "^1.5.1",
44
- "@tailwindcss-mangle/shared": "^2.2.1"
45
- },
46
- "homepage": "https://github.com/sonofmagic/tailwindcss-mangle",
47
- "repository": {
48
- "type": "git",
49
- "url": "git+https://github.com/sonofmagic/tailwindcss-mangle.git"
47
+ "c12": "^1.11.1",
48
+ "is-css-request": "^1.0.1",
49
+ "@tailwindcss-mangle/shared": "^3.0.0"
50
50
  },
51
51
  "scripts": {
52
52
  "dev": "unbuild --sourcemap",