@tailwindcss-mangle/config 1.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 ADDED
@@ -0,0 +1,59 @@
1
+ 'use strict';
2
+
3
+ const path = require('node:path');
4
+ const fs = require('node:fs/promises');
5
+ const c12 = require('c12');
6
+ const dedent = require('dedent');
7
+
8
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
9
+
10
+ const path__default = /*#__PURE__*/_interopDefaultCompat(path);
11
+ const fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
12
+ const dedent__default = /*#__PURE__*/_interopDefaultCompat(dedent);
13
+
14
+ function getDefaultPatchConfig() {
15
+ return {
16
+ output: {
17
+ filename: ".tw-patch/tw-class-list.json",
18
+ removeUniversalSelector: true,
19
+ loose: true
20
+ },
21
+ tailwindcss: {}
22
+ };
23
+ }
24
+ function getDefaultUserConfig() {
25
+ return {
26
+ patch: getDefaultPatchConfig()
27
+ };
28
+ }
29
+
30
+ const configName = "tailwindcss-mangle";
31
+
32
+ function getConfig(cwd) {
33
+ return c12.loadConfig({
34
+ name: configName,
35
+ defaults: {
36
+ ...getDefaultUserConfig()
37
+ },
38
+ cwd
39
+ });
40
+ }
41
+ const defineConfig = c12.createDefineConfig();
42
+ function initConfig(cwd) {
43
+ return fs__default.writeFile(
44
+ path__default.resolve(cwd, `${configName}.config.ts`),
45
+ dedent__default`
46
+ import { defineConfig } from 'tailwindcss-patch'
47
+
48
+ export default defineConfig({})
49
+ `,
50
+ "utf8"
51
+ );
52
+ }
53
+
54
+ exports.configName = configName;
55
+ exports.defineConfig = defineConfig;
56
+ exports.getConfig = getConfig;
57
+ exports.getDefaultPatchConfig = getDefaultPatchConfig;
58
+ exports.getDefaultUserConfig = getDefaultUserConfig;
59
+ exports.initConfig = initConfig;
@@ -0,0 +1,30 @@
1
+ import * as c12 from 'c12';
2
+
3
+ interface PatchUserConfig {
4
+ output?: {
5
+ filename?: string;
6
+ loose?: boolean;
7
+ /**
8
+ * @description remove * in output json
9
+ */
10
+ removeUniversalSelector?: boolean;
11
+ };
12
+ tailwindcss?: {
13
+ cwd?: string;
14
+ config?: string;
15
+ };
16
+ }
17
+ interface UserConfig {
18
+ patch?: PatchUserConfig;
19
+ }
20
+
21
+ declare function getConfig(cwd?: string): Promise<c12.ResolvedConfig<UserConfig, c12.ConfigLayerMeta>>;
22
+ declare const defineConfig: c12.DefineConfig<UserConfig, c12.ConfigLayerMeta>;
23
+ declare function initConfig(cwd: string): Promise<void>;
24
+
25
+ declare function getDefaultPatchConfig(): PatchUserConfig;
26
+ declare function getDefaultUserConfig(): UserConfig;
27
+
28
+ declare const configName = "tailwindcss-mangle";
29
+
30
+ export { PatchUserConfig, UserConfig, configName, defineConfig, getConfig, getDefaultPatchConfig, getDefaultUserConfig, initConfig };
package/dist/index.mjs ADDED
@@ -0,0 +1,46 @@
1
+ import path from 'node:path';
2
+ import fs from 'node:fs/promises';
3
+ import { createDefineConfig, loadConfig } from 'c12';
4
+ import dedent from 'dedent';
5
+
6
+ function getDefaultPatchConfig() {
7
+ return {
8
+ output: {
9
+ filename: ".tw-patch/tw-class-list.json",
10
+ removeUniversalSelector: true,
11
+ loose: true
12
+ },
13
+ tailwindcss: {}
14
+ };
15
+ }
16
+ function getDefaultUserConfig() {
17
+ return {
18
+ patch: getDefaultPatchConfig()
19
+ };
20
+ }
21
+
22
+ const configName = "tailwindcss-mangle";
23
+
24
+ function getConfig(cwd) {
25
+ return loadConfig({
26
+ name: configName,
27
+ defaults: {
28
+ ...getDefaultUserConfig()
29
+ },
30
+ cwd
31
+ });
32
+ }
33
+ const defineConfig = createDefineConfig();
34
+ function initConfig(cwd) {
35
+ return fs.writeFile(
36
+ path.resolve(cwd, `${configName}.config.ts`),
37
+ dedent`
38
+ import { defineConfig } from 'tailwindcss-patch'
39
+
40
+ export default defineConfig({})
41
+ `,
42
+ "utf8"
43
+ );
44
+ }
45
+
46
+ export { configName, defineConfig, getConfig, getDefaultPatchConfig, getDefaultUserConfig, initConfig };
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@tailwindcss-mangle/config",
3
+ "version": "1.0.0",
4
+ "description": "The config and load function of tailwindcss-mangle",
5
+ "exports": {
6
+ ".": {
7
+ "types": "./dist/index.d.ts",
8
+ "import": "./dist/index.mjs",
9
+ "require": "./dist/index.cjs"
10
+ }
11
+ },
12
+ "typesVersions": {
13
+ "*": {
14
+ "*": [
15
+ "./dist/*",
16
+ "./dist/index.d.ts"
17
+ ]
18
+ }
19
+ },
20
+ "main": "./dist/index.cjs",
21
+ "module": "./dist/index.mjs",
22
+ "types": "./dist/index.d.ts",
23
+ "files": [
24
+ "dist"
25
+ ],
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
+ "publishConfig": {
38
+ "access": "public",
39
+ "registry": "https://registry.npmjs.org/"
40
+ },
41
+ "dependencies": {
42
+ "c12": "^1.4.2",
43
+ "dedent": "^1.5.1"
44
+ },
45
+ "homepage": "https://github.com/sonofmagic/tailwindcss-mangle",
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "git+https://github.com/sonofmagic/tailwindcss-mangle.git"
49
+ },
50
+ "scripts": {
51
+ "build": "unbuild",
52
+ "test": "vitest run",
53
+ "test:dev": "vitest"
54
+ }
55
+ }