@zayne-labs/prettier-config 0.11.21 → 0.11.22
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/constants/defaults.js +1 -1
- package/dist/{defaults-BGD0jRl9.js → defaults-DE3W8xWm.js} +1 -1
- package/dist/{defaults-BGD0jRl9.js.map → defaults-DE3W8xWm.js.map} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/plugins/safe-sort-imports.js +1 -1
- package/dist/{types-0mdoYUET.d.ts → types-CwUGQodF.d.ts} +1 -1
- package/dist/{utils-C8dA6Mzd.js → utils-C92UdaUE.js} +1 -1
- package/dist/{utils-C8dA6Mzd.js.map → utils-C92UdaUE.js.map} +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/package.json +7 -7
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as getDefaultTailwindSettings, t as getDefaultImportSortingOrder } from "../defaults-
|
|
1
|
+
import { n as getDefaultTailwindSettings, t as getDefaultImportSortingOrder } from "../defaults-DE3W8xWm.js";
|
|
2
2
|
|
|
3
3
|
export { getDefaultImportSortingOrder, getDefaultTailwindSettings };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults-
|
|
1
|
+
{"version":3,"file":"defaults-DE3W8xWm.js","names":[],"sources":["../src/constants/defaults.ts"],"sourcesContent":["import { defineEnumDeep } from \"@zayne-labs/toolkit-type-helpers\";\n\nexport const getDefaultTailwindSettings = () => {\n\treturn defineEnumDeep({\n\t\ttailwindAttributes: [\"classNames\", \"classes\"],\n\t\ttailwindFunctions: [\"cnMerge\", \"cnJoin\", \"cn\", \"tv\", \"tw\"],\n\t\ttailwindStylesheet: \"./tailwind.css\",\n\t});\n};\n\nexport const getDefaultImportSortingOrder = () => {\n\treturn defineEnumDeep({\n\t\t// CSS files (always last)\n\t\tcss: \".css$\",\n\n\t\tmain: [\n\t\t\t// URLs (e.g., https://example.org)\n\t\t\t\"^https?://\",\n\t\t\t// Protocol imports (node:, bun:, jsr:, npm:, etc.)\n\t\t\t\"<BUILTIN_MODULES>\",\n\t\t\t\"^(bun|jsr|npm):\",\n\t\t\t// Third-party packages\n\t\t\t\"<THIRD_PARTY_MODULES>\",\n\t\t\t// Aliases (@/, #, ~, $, %)\n\t\t\t\"^(@/|[#~$%])\",\n\t\t\t// Relative and absolute paths (excluding CSS)\n\t\t\t\"^(?!.*[.]css$)[./].*$\",\n\t\t],\n\t});\n};\n"],"mappings":";;;AAEA,MAAa,mCAAmC;AAC/C,QAAO,eAAe;EACrB,oBAAoB,CAAC,cAAc,UAAU;EAC7C,mBAAmB;GAAC;GAAW;GAAU;GAAM;GAAM;GAAK;EAC1D,oBAAoB;EACpB,CAAC;;AAGH,MAAa,qCAAqC;AACjD,QAAO,eAAe;EAErB,KAAK;EAEL,MAAM;GAEL;GAEA;GACA;GAEA;GAEA;GAEA;GACA;EACD,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as OptionsTailwindCss, i as OptionsSortImports, n as OptionsAstro, o as ResolvedPrettierConfig, r as OptionsPrettierConfig, t as ExtractOptions } from "./types-
|
|
1
|
+
import { a as OptionsTailwindCss, i as OptionsSortImports, n as OptionsAstro, o as ResolvedPrettierConfig, r as OptionsPrettierConfig, t as ExtractOptions } from "./types-CwUGQodF.js";
|
|
2
2
|
|
|
3
3
|
//#region src/configs/astro.d.ts
|
|
4
4
|
declare const astro: (options: ExtractOptions<OptionsPrettierConfig["astro"]>) => Promise<typeof options>;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as ensurePackages, o as resolveOptions, t as combineConfigs } from "./utils-
|
|
2
|
-
import { n as getDefaultTailwindSettings, t as getDefaultImportSortingOrder } from "./defaults-
|
|
1
|
+
import { n as ensurePackages, o as resolveOptions, t as combineConfigs } from "./utils-C92UdaUE.js";
|
|
2
|
+
import { n as getDefaultTailwindSettings, t as getDefaultImportSortingOrder } from "./defaults-DE3W8xWm.js";
|
|
3
3
|
|
|
4
4
|
//#region src/configs/astro.ts
|
|
5
5
|
const astro = async (options) => {
|
|
@@ -176,4 +176,4 @@ type ResolvedPrettierConfig = Omit<Config & OptionsAstro & OptionsSortImports &
|
|
|
176
176
|
type ExtractOptions<TUnion> = Extract<TUnion, object>;
|
|
177
177
|
//#endregion
|
|
178
178
|
export { OptionsTailwindCss as a, OptionsSortImports as i, OptionsAstro as n, ResolvedPrettierConfig as o, OptionsPrettierConfig as r, ExtractOptions as t };
|
|
179
|
-
//# sourceMappingURL=types-
|
|
179
|
+
//# sourceMappingURL=types-CwUGQodF.d.ts.map
|
|
@@ -56,4 +56,4 @@ const ensurePackages = async (packages) => {
|
|
|
56
56
|
|
|
57
57
|
//#endregion
|
|
58
58
|
export { mergeTwoConfigs as a, isPackageInScope as i, ensurePackages as n, resolveOptions as o, interopDefault as r, combineConfigs as t };
|
|
59
|
-
//# sourceMappingURL=utils-
|
|
59
|
+
//# sourceMappingURL=utils-C92UdaUE.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-
|
|
1
|
+
{"version":3,"file":"utils-C92UdaUE.js","names":[],"sources":["../src/utils.ts"],"sourcesContent":["import { fileURLToPath } from \"node:url\";\nimport { isArray, isObject, type Awaitable } from \"@zayne-labs/toolkit-type-helpers\";\nimport { isPackageExists } from \"local-pkg\";\nimport type { ResolvedPrettierConfig } from \"./types\";\n\n/**\n * @description Resolves a boolean or object option to an object.\n * If the option is an object, it returns it as-is. Otherwise, returns an empty object.\n */\nexport const resolveOptions = <TObject>(option: boolean | TObject | undefined) => {\n\treturn isObject(option) ? option : ({} as TObject);\n};\n\n/**\n * @description Merges two Prettier configurations.\n * Array values (like `plugins` or `overrides`) are concatenated, while other values from the latter config overwrite the former.\n */\nexport const mergeTwoConfigs = (\n\tformerConfig: ResolvedPrettierConfig,\n\tlatterConfig: ResolvedPrettierConfig\n): ResolvedPrettierConfig => {\n\tconst configAccumulator: ResolvedPrettierConfig = {\n\t\t...formerConfig,\n\t};\n\n\tfor (const [latterConfigKey, latterConfigValue] of Object.entries(latterConfig)) {\n\t\tconst accumulatedConfigValue = configAccumulator[latterConfigKey];\n\n\t\tconfigAccumulator[latterConfigKey] =\n\t\t\tisArray(latterConfigValue) && isArray(accumulatedConfigValue) ?\n\t\t\t\t[...accumulatedConfigValue, ...latterConfigValue]\n\t\t\t:\tlatterConfigValue;\n\t}\n\n\treturn configAccumulator;\n};\n\nexport const interopDefault = async <TModule>(\n\tmodule: Awaitable<TModule>\n): Promise<TModule extends { default: infer TDefaultExport } ? TDefaultExport : TModule> => {\n\tconst resolved = await module;\n\n\t// eslint-disable-next-line ts-eslint/no-unnecessary-condition -- casting is necessary to prevent assignability ts issues at call-site\n\treturn (resolved as { default: never }).default ?? resolved;\n};\n\nexport const combineConfigs = async (\n\tconfigArray: Array<Awaitable<ResolvedPrettierConfig | undefined>>\n): Promise<ResolvedPrettierConfig> => {\n\t// eslint-disable-next-line ts-eslint/await-thenable -- Ignore\n\tconst resolvedConfigArray = await Promise.all(configArray);\n\n\tlet accumulatedConfig: ResolvedPrettierConfig = {};\n\n\tfor (const config of resolvedConfigArray) {\n\t\tif (!config) continue;\n\n\t\taccumulatedConfig = mergeTwoConfigs(accumulatedConfig, config);\n\t}\n\n\treturn accumulatedConfig;\n};\n\nconst scopeUrl = fileURLToPath(new URL(\".\", import.meta.url));\nconst isCwdInScope = isPackageExists(\"@zayne-labs/prettier-config\");\n\nexport const isPackageInScope = (name: string): boolean => isPackageExists(name, { paths: [scopeUrl] });\n\n/**\n * @description\n * - Ensures that packages are installed in the current scope.\n * - If they are not installed, and the user is in a TTY, and the user is not in a CI environment,\n * and the user is in the same scope as this package, then prompt the user to\n * install the packages.\n *\n * @param packages - The packages to ensure are installed.\n */\nexport const ensurePackages = async (packages: Array<string | undefined>): Promise<void> => {\n\tif (process.env.CI || !process.stdout.isTTY || !isCwdInScope) return;\n\n\tconst nonExistingPackages = packages.filter((pkg) => pkg && !isPackageInScope(pkg));\n\n\tif (nonExistingPackages.length === 0) return;\n\n\tconst clackPrompt = await import(\"@clack/prompts\");\n\n\tconst result = await clackPrompt.confirm({\n\t\tmessage: `${nonExistingPackages.length === 1 ? \"Package is\" : \"Packages are\"} required for this config: ${nonExistingPackages.join(\", \")}. Do you want to install them?`,\n\t});\n\n\tif (result) {\n\t\tconst antfuPkg = await import(\"@antfu/install-pkg\");\n\n\t\tawait antfuPkg.installPackage(nonExistingPackages as string[], { dev: true });\n\t}\n};\n"],"mappings":";;;;;;;;;AASA,MAAa,kBAA2B,WAA0C;AACjF,QAAO,SAAS,OAAO,GAAG,SAAU,EAAE;;;;;;AAOvC,MAAa,mBACZ,cACA,iBAC4B;CAC5B,MAAM,oBAA4C,EACjD,GAAG,cACH;AAED,MAAK,MAAM,CAAC,iBAAiB,sBAAsB,OAAO,QAAQ,aAAa,EAAE;EAChF,MAAM,yBAAyB,kBAAkB;AAEjD,oBAAkB,mBACjB,QAAQ,kBAAkB,IAAI,QAAQ,uBAAuB,GAC5D,CAAC,GAAG,wBAAwB,GAAG,kBAAkB,GAChD;;AAGJ,QAAO;;AAGR,MAAa,iBAAiB,OAC7B,WAC2F;CAC3F,MAAM,WAAW,MAAM;AAGvB,QAAQ,SAAgC,WAAW;;AAGpD,MAAa,iBAAiB,OAC7B,gBACqC;CAErC,MAAM,sBAAsB,MAAM,QAAQ,IAAI,YAAY;CAE1D,IAAI,oBAA4C,EAAE;AAElD,MAAK,MAAM,UAAU,qBAAqB;AACzC,MAAI,CAAC,OAAQ;AAEb,sBAAoB,gBAAgB,mBAAmB,OAAO;;AAG/D,QAAO;;AAGR,MAAM,WAAW,cAAc,IAAI,IAAI,KAAK,OAAO,KAAK,IAAI,CAAC;AAC7D,MAAM,eAAe,gBAAgB,8BAA8B;AAEnE,MAAa,oBAAoB,SAA0B,gBAAgB,MAAM,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC;;;;;;;;;;AAWvG,MAAa,iBAAiB,OAAO,aAAuD;AAC3F,KAAI,QAAQ,IAAI,MAAM,CAAC,QAAQ,OAAO,SAAS,CAAC,aAAc;CAE9D,MAAM,sBAAsB,SAAS,QAAQ,QAAQ,OAAO,CAAC,iBAAiB,IAAI,CAAC;AAEnF,KAAI,oBAAoB,WAAW,EAAG;AAQtC,KAJe,OAFK,MAAM,OAAO,mBAEA,QAAQ,EACxC,SAAS,GAAG,oBAAoB,WAAW,IAAI,eAAe,eAAe,6BAA6B,oBAAoB,KAAK,KAAK,CAAC,iCACzI,CAAC,CAKD,QAFiB,MAAM,OAAO,uBAEf,eAAe,qBAAiC,EAAE,KAAK,MAAM,CAAC"}
|
package/dist/utils.d.ts
CHANGED
package/dist/utils.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as mergeTwoConfigs, i as isPackageInScope, n as ensurePackages, o as resolveOptions, r as interopDefault, t as combineConfigs } from "./utils-
|
|
1
|
+
import { a as mergeTwoConfigs, i as isPackageInScope, n as ensurePackages, o as resolveOptions, r as interopDefault, t as combineConfigs } from "./utils-C92UdaUE.js";
|
|
2
2
|
|
|
3
3
|
export { combineConfigs, ensurePackages, interopDefault, isPackageInScope, mergeTwoConfigs, resolveOptions };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zayne-labs/prettier-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.11.
|
|
4
|
+
"version": "0.11.22",
|
|
5
5
|
"description": "Zayne Labs' Prettier config",
|
|
6
6
|
"author": "Ryan Zayne",
|
|
7
7
|
"license": "MIT",
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@antfu/install-pkg": "1.1.0",
|
|
58
|
-
"@clack/prompts": "0.
|
|
59
|
-
"@zayne-labs/toolkit-type-helpers": "0.12.
|
|
58
|
+
"@clack/prompts": "1.0.0",
|
|
59
|
+
"@zayne-labs/toolkit-type-helpers": "0.12.30",
|
|
60
60
|
"local-pkg": "1.1.2"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
@@ -64,15 +64,15 @@
|
|
|
64
64
|
"@total-typescript/ts-reset": "0.6.1",
|
|
65
65
|
"concurrently": "9.2.1",
|
|
66
66
|
"cross-env": "10.1.0",
|
|
67
|
-
"prettier": "3.8.
|
|
67
|
+
"prettier": "3.8.1",
|
|
68
68
|
"prettier-plugin-astro": "0.14.1",
|
|
69
69
|
"prettier-plugin-classnames": "0.9.0",
|
|
70
70
|
"prettier-plugin-merge": "0.9.0",
|
|
71
71
|
"prettier-plugin-tailwindcss": "0.7.2",
|
|
72
|
-
"publint": "0.3.
|
|
73
|
-
"tsdown": "0.20.
|
|
72
|
+
"publint": "0.3.17",
|
|
73
|
+
"tsdown": "0.20.1",
|
|
74
74
|
"typescript": "5.9.3",
|
|
75
|
-
"@zayne-labs/tsconfig": "0.11.
|
|
75
|
+
"@zayne-labs/tsconfig": "0.11.22"
|
|
76
76
|
},
|
|
77
77
|
"publishConfig": {
|
|
78
78
|
"access": "public",
|