js-style-kit 0.2.2 → 0.2.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.
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
|
|
25
|
+
// scripts/postinstall.js
|
|
26
|
+
var fs = __toESM(require("fs"), 1);
|
|
27
|
+
var path = __toESM(require("path"), 1);
|
|
28
|
+
var patchPrettierPluginTailwindcss = () => {
|
|
29
|
+
try {
|
|
30
|
+
console.info("js-style-kit: Starting postinstall patch...");
|
|
31
|
+
let pluginPath;
|
|
32
|
+
const rootPath = path.join(
|
|
33
|
+
"node_modules",
|
|
34
|
+
"prettier-plugin-tailwindcss",
|
|
35
|
+
"dist",
|
|
36
|
+
"index.d.ts"
|
|
37
|
+
);
|
|
38
|
+
const packagePath = path.join(
|
|
39
|
+
__dirname,
|
|
40
|
+
"..",
|
|
41
|
+
"..",
|
|
42
|
+
"prettier-plugin-tailwindcss",
|
|
43
|
+
"dist",
|
|
44
|
+
"index.d.ts"
|
|
45
|
+
);
|
|
46
|
+
if (fs.existsSync(rootPath)) {
|
|
47
|
+
pluginPath = rootPath;
|
|
48
|
+
} else if (fs.existsSync(packagePath)) {
|
|
49
|
+
pluginPath = packagePath;
|
|
50
|
+
} else {
|
|
51
|
+
console.warn(
|
|
52
|
+
"js-style-kit: prettier-plugin-tailwindcss not found, skipping patch"
|
|
53
|
+
);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
console.info(`js-style-kit: Found plugin at ${pluginPath}`);
|
|
57
|
+
const backupPath = `${pluginPath}.backup`;
|
|
58
|
+
if (!fs.existsSync(backupPath)) {
|
|
59
|
+
fs.writeFileSync(backupPath, fs.readFileSync(pluginPath, "utf8"));
|
|
60
|
+
console.info("js-style-kit: Created backup of original declaration file");
|
|
61
|
+
}
|
|
62
|
+
const content = fs.readFileSync(pluginPath, "utf8");
|
|
63
|
+
const declareBlock = `declare module 'prettier' {
|
|
64
|
+
interface RequiredOptions extends PluginOptions {
|
|
65
|
+
}
|
|
66
|
+
interface ParserOptions extends PluginOptions {
|
|
67
|
+
}
|
|
68
|
+
}`;
|
|
69
|
+
const patchedContent = content.replace(
|
|
70
|
+
declareBlock,
|
|
71
|
+
"// Removed unsafe declare module statement"
|
|
72
|
+
);
|
|
73
|
+
if (content !== patchedContent) {
|
|
74
|
+
fs.writeFileSync(pluginPath, patchedContent);
|
|
75
|
+
console.info(
|
|
76
|
+
"js-style-kit: Successfully patched prettier-plugin-tailwindcss declaration file"
|
|
77
|
+
);
|
|
78
|
+
} else {
|
|
79
|
+
console.info(
|
|
80
|
+
"js-style-kit: No patching needed, declaration block not found or already patched"
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
} catch (error) {
|
|
84
|
+
console.error(
|
|
85
|
+
"js-style-kit: Error patching prettier-plugin-tailwindcss:",
|
|
86
|
+
error
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
patchPrettierPluginTailwindcss();
|
|
91
|
+
//# sourceMappingURL=postinstall.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../scripts/postinstall.js"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\n\n/**\n * Patch the declaration file of prettier-plugin-tailwindcss to remove the unsafe declare statement\n */\nconst patchPrettierPluginTailwindcss = () => {\n try {\n console.info(\"js-style-kit: Starting postinstall patch...\");\n\n // Find the location of prettier-plugin-tailwindcss\n // This will work regardless of where js-style-kit is installed\n let pluginPath;\n\n // First try from the project root\n const rootPath = path.join(\n \"node_modules\",\n \"prettier-plugin-tailwindcss\",\n \"dist\",\n \"index.d.ts\",\n );\n\n // Then try from js-style-kit's directory\n const packagePath = path.join(\n __dirname,\n \"..\",\n \"..\",\n \"prettier-plugin-tailwindcss\",\n \"dist\",\n \"index.d.ts\",\n );\n\n // Choose the path that exists\n if (fs.existsSync(rootPath)) {\n pluginPath = rootPath;\n } else if (fs.existsSync(packagePath)) {\n pluginPath = packagePath;\n } else {\n console.warn(\n \"js-style-kit: prettier-plugin-tailwindcss not found, skipping patch\",\n );\n return;\n }\n\n console.info(`js-style-kit: Found plugin at ${pluginPath}`);\n\n // Create backup of original file if it doesn't exist already\n const backupPath = `${pluginPath}.backup`;\n if (!fs.existsSync(backupPath)) {\n fs.writeFileSync(backupPath, fs.readFileSync(pluginPath, \"utf8\"));\n console.info(\"js-style-kit: Created backup of original declaration file\");\n }\n\n // Read the file\n const content = fs.readFileSync(pluginPath, \"utf8\");\n\n // The exact declare statement to remove\n const declareBlock = `declare module 'prettier' {\n interface RequiredOptions extends PluginOptions {\n }\n interface ParserOptions extends PluginOptions {\n }\n}`;\n\n // Replace the declare block with a comment\n const patchedContent = content.replace(\n declareBlock,\n \"// Removed unsafe declare module statement\",\n );\n\n // Only write if content has changed\n if (content !== patchedContent) {\n // Write the patched file back\n fs.writeFileSync(pluginPath, patchedContent);\n console.info(\n \"js-style-kit: Successfully patched prettier-plugin-tailwindcss declaration file\",\n );\n } else {\n console.info(\n \"js-style-kit: No patching needed, declaration block not found or already patched\",\n );\n }\n } catch (error) {\n console.error(\n \"js-style-kit: Error patching prettier-plugin-tailwindcss:\",\n error,\n );\n }\n};\n\n// Run the patch function\npatchPrettierPluginTailwindcss();\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAoB;AACpB,WAAsB;AAKtB,IAAM,iCAAiC,MAAM;AAC3C,MAAI;AACF,YAAQ,KAAK,6CAA6C;AAI1D,QAAI;AAGJ,UAAM,WAAgB;AAAA,MACpB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAGA,UAAM,cAAmB;AAAA,MACvB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAGA,QAAO,cAAW,QAAQ,GAAG;AAC3B,mBAAa;AAAA,IACf,WAAc,cAAW,WAAW,GAAG;AACrC,mBAAa;AAAA,IACf,OAAO;AACL,cAAQ;AAAA,QACN;AAAA,MACF;AACA;AAAA,IACF;AAEA,YAAQ,KAAK,iCAAiC,UAAU,EAAE;AAG1D,UAAM,aAAa,GAAG,UAAU;AAChC,QAAI,CAAI,cAAW,UAAU,GAAG;AAC9B,MAAG,iBAAc,YAAe,gBAAa,YAAY,MAAM,CAAC;AAChE,cAAQ,KAAK,2DAA2D;AAAA,IAC1E;AAGA,UAAM,UAAa,gBAAa,YAAY,MAAM;AAGlD,UAAM,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAQrB,UAAM,iBAAiB,QAAQ;AAAA,MAC7B;AAAA,MACA;AAAA,IACF;AAGA,QAAI,YAAY,gBAAgB;AAE9B,MAAG,iBAAc,YAAY,cAAc;AAC3C,cAAQ;AAAA,QACN;AAAA,MACF;AAAA,IACF,OAAO;AACL,cAAQ;AAAA,QACN;AAAA,MACF;AAAA,IACF;AAAA,EACF,SAAS,OAAO;AACd,YAAQ;AAAA,MACN;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;AAGA,+BAA+B;","names":[]}
|
|
@@ -3,29 +3,38 @@ import * as fs from "node:fs";
|
|
|
3
3
|
import * as path from "node:path";
|
|
4
4
|
var patchPrettierPluginTailwindcss = () => {
|
|
5
5
|
try {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
console.info("js-style-kit: Starting postinstall patch...");
|
|
7
|
+
let pluginPath;
|
|
8
|
+
const rootPath = path.join(
|
|
9
|
+
"node_modules",
|
|
10
|
+
"prettier-plugin-tailwindcss",
|
|
11
|
+
"dist",
|
|
12
|
+
"index.d.ts"
|
|
9
13
|
);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"
|
|
14
|
+
const packagePath = path.join(
|
|
15
|
+
__dirname,
|
|
16
|
+
"..",
|
|
17
|
+
"..",
|
|
18
|
+
"prettier-plugin-tailwindcss",
|
|
19
|
+
"dist",
|
|
20
|
+
"index.d.ts"
|
|
17
21
|
);
|
|
18
|
-
if (fs.existsSync(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
if (fs.existsSync(rootPath)) {
|
|
23
|
+
pluginPath = rootPath;
|
|
24
|
+
} else if (fs.existsSync(packagePath)) {
|
|
25
|
+
pluginPath = packagePath;
|
|
26
|
+
} else {
|
|
27
|
+
console.warn(
|
|
28
|
+
"js-style-kit: prettier-plugin-tailwindcss not found, skipping patch"
|
|
22
29
|
);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
console.info(`js-style-kit: Found plugin at ${pluginPath}`);
|
|
33
|
+
const backupPath = `${pluginPath}.backup`;
|
|
34
|
+
if (!fs.existsSync(backupPath)) {
|
|
35
|
+
fs.writeFileSync(backupPath, fs.readFileSync(pluginPath, "utf8"));
|
|
36
|
+
console.info("js-style-kit: Created backup of original declaration file");
|
|
23
37
|
}
|
|
24
|
-
fs.writeFileSync(
|
|
25
|
-
`${pluginPath}.backup`,
|
|
26
|
-
fs.readFileSync(pluginPath, "utf8")
|
|
27
|
-
);
|
|
28
|
-
console.info("Created backup of original declaration file");
|
|
29
38
|
const content = fs.readFileSync(pluginPath, "utf8");
|
|
30
39
|
const declareBlock = `declare module 'prettier' {
|
|
31
40
|
interface RequiredOptions extends PluginOptions {
|
|
@@ -44,7 +53,7 @@ var patchPrettierPluginTailwindcss = () => {
|
|
|
44
53
|
);
|
|
45
54
|
} else {
|
|
46
55
|
console.info(
|
|
47
|
-
"No patching needed, declaration block not found or already patched"
|
|
56
|
+
"js-style-kit: No patching needed, declaration block not found or already patched"
|
|
48
57
|
);
|
|
49
58
|
}
|
|
50
59
|
} catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../scripts/postinstall.js"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\n\n/**\n * Patch the declaration file of prettier-plugin-tailwindcss to remove the unsafe declare statement\n */\nconst patchPrettierPluginTailwindcss = () => {\n try {\n //
|
|
1
|
+
{"version":3,"sources":["../../scripts/postinstall.js"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\n\n/**\n * Patch the declaration file of prettier-plugin-tailwindcss to remove the unsafe declare statement\n */\nconst patchPrettierPluginTailwindcss = () => {\n try {\n console.info(\"js-style-kit: Starting postinstall patch...\");\n\n // Find the location of prettier-plugin-tailwindcss\n // This will work regardless of where js-style-kit is installed\n let pluginPath;\n\n // First try from the project root\n const rootPath = path.join(\n \"node_modules\",\n \"prettier-plugin-tailwindcss\",\n \"dist\",\n \"index.d.ts\",\n );\n\n // Then try from js-style-kit's directory\n const packagePath = path.join(\n __dirname,\n \"..\",\n \"..\",\n \"prettier-plugin-tailwindcss\",\n \"dist\",\n \"index.d.ts\",\n );\n\n // Choose the path that exists\n if (fs.existsSync(rootPath)) {\n pluginPath = rootPath;\n } else if (fs.existsSync(packagePath)) {\n pluginPath = packagePath;\n } else {\n console.warn(\n \"js-style-kit: prettier-plugin-tailwindcss not found, skipping patch\",\n );\n return;\n }\n\n console.info(`js-style-kit: Found plugin at ${pluginPath}`);\n\n // Create backup of original file if it doesn't exist already\n const backupPath = `${pluginPath}.backup`;\n if (!fs.existsSync(backupPath)) {\n fs.writeFileSync(backupPath, fs.readFileSync(pluginPath, \"utf8\"));\n console.info(\"js-style-kit: Created backup of original declaration file\");\n }\n\n // Read the file\n const content = fs.readFileSync(pluginPath, \"utf8\");\n\n // The exact declare statement to remove\n const declareBlock = `declare module 'prettier' {\n interface RequiredOptions extends PluginOptions {\n }\n interface ParserOptions extends PluginOptions {\n }\n}`;\n\n // Replace the declare block with a comment\n const patchedContent = content.replace(\n declareBlock,\n \"// Removed unsafe declare module statement\",\n );\n\n // Only write if content has changed\n if (content !== patchedContent) {\n // Write the patched file back\n fs.writeFileSync(pluginPath, patchedContent);\n console.info(\n \"js-style-kit: Successfully patched prettier-plugin-tailwindcss declaration file\",\n );\n } else {\n console.info(\n \"js-style-kit: No patching needed, declaration block not found or already patched\",\n );\n }\n } catch (error) {\n console.error(\n \"js-style-kit: Error patching prettier-plugin-tailwindcss:\",\n error,\n );\n }\n};\n\n// Run the patch function\npatchPrettierPluginTailwindcss();\n"],"mappings":";AAAA,YAAY,QAAQ;AACpB,YAAY,UAAU;AAKtB,IAAM,iCAAiC,MAAM;AAC3C,MAAI;AACF,YAAQ,KAAK,6CAA6C;AAI1D,QAAI;AAGJ,UAAM,WAAgB;AAAA,MACpB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAGA,UAAM,cAAmB;AAAA,MACvB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAGA,QAAO,cAAW,QAAQ,GAAG;AAC3B,mBAAa;AAAA,IACf,WAAc,cAAW,WAAW,GAAG;AACrC,mBAAa;AAAA,IACf,OAAO;AACL,cAAQ;AAAA,QACN;AAAA,MACF;AACA;AAAA,IACF;AAEA,YAAQ,KAAK,iCAAiC,UAAU,EAAE;AAG1D,UAAM,aAAa,GAAG,UAAU;AAChC,QAAI,CAAI,cAAW,UAAU,GAAG;AAC9B,MAAG,iBAAc,YAAe,gBAAa,YAAY,MAAM,CAAC;AAChE,cAAQ,KAAK,2DAA2D;AAAA,IAC1E;AAGA,UAAM,UAAa,gBAAa,YAAY,MAAM;AAGlD,UAAM,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAQrB,UAAM,iBAAiB,QAAQ;AAAA,MAC7B;AAAA,MACA;AAAA,IACF;AAGA,QAAI,YAAY,gBAAgB;AAE9B,MAAG,iBAAc,YAAY,cAAc;AAC3C,cAAQ;AAAA,QACN;AAAA,MACF;AAAA,IACF,OAAO;AACL,cAAQ;AAAA,QACN;AAAA,MACF;AAAA,IACF;AAAA,EACF,SAAS,OAAO;AACd,YAAQ;AAAA,MACN;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;AAGA,+BAA+B;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "js-style-kit",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "A zero configuration style guide for ESLint and Prettier",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"dev": "tsup --watch",
|
|
33
33
|
"format": "prettier --write . --ignore-path .prettierignore.ci",
|
|
34
34
|
"format:check": "prettier --check . --ignore-path .prettierignore.ci",
|
|
35
|
-
"postinstall": "node ./dist/scripts/postinstall.
|
|
35
|
+
"postinstall": "node ./dist/scripts/postinstall.cjs",
|
|
36
36
|
"lint": "eslint .",
|
|
37
37
|
"lint:inspect": "eslint --inspect-config",
|
|
38
38
|
"test": "bun test",
|