@brnshkr/config 0.0.1-alpha.2
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/LICENSE +21 -0
- package/README.md +659 -0
- package/conf/eslint.config.mjs.example +1 -0
- package/conf/stylelint.config.mjs.example +1 -0
- package/conf/tsconfig.json +74 -0
- package/conf/tsconfig.json.example +3 -0
- package/dist/eslint/index.d.mts +15518 -0
- package/dist/eslint/index.mjs +2574 -0
- package/dist/scripts/eslint.mjs +18 -0
- package/dist/scripts/stylelint.mjs +31 -0
- package/dist/shared.mjs +394 -0
- package/dist/stylelint/index.d.mts +97 -0
- package/dist/stylelint/index.mjs +402 -0
- package/package.json +289 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
|
|
3
|
+
//#region scripts/eslint.ts
|
|
4
|
+
spawn("bun", [
|
|
5
|
+
"eslint",
|
|
6
|
+
"--config",
|
|
7
|
+
"./conf/eslint.config.ts",
|
|
8
|
+
"--cache",
|
|
9
|
+
"--cache-location",
|
|
10
|
+
"./.cache/eslint.cache.json",
|
|
11
|
+
...process.argv.slice(2)
|
|
12
|
+
], {
|
|
13
|
+
stdio: "inherit",
|
|
14
|
+
env: import.meta.env
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
|
|
3
|
+
//#region scripts/stylelint.ts
|
|
4
|
+
const EXTENSIONS = [
|
|
5
|
+
"css",
|
|
6
|
+
"ejs",
|
|
7
|
+
"html",
|
|
8
|
+
"less",
|
|
9
|
+
"postcss",
|
|
10
|
+
"scss",
|
|
11
|
+
"svelte",
|
|
12
|
+
"svg",
|
|
13
|
+
"vue"
|
|
14
|
+
];
|
|
15
|
+
const argv = process.argv.slice(2);
|
|
16
|
+
spawn("bun", [
|
|
17
|
+
"stylelint",
|
|
18
|
+
"--config",
|
|
19
|
+
"./conf/stylelint.config.mjs",
|
|
20
|
+
"--cache",
|
|
21
|
+
"--cache-location",
|
|
22
|
+
"./.cache/stylelint.cache.json",
|
|
23
|
+
argv.includes("--print-config") ? "" : `**/*.{${EXTENSIONS.join(",")}}`,
|
|
24
|
+
...argv
|
|
25
|
+
].filter(Boolean), {
|
|
26
|
+
stdio: "inherit",
|
|
27
|
+
env: import.meta.env
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
export { };
|
package/dist/shared.mjs
ADDED
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
import { isPackageExists } from "local-pkg";
|
|
2
|
+
|
|
3
|
+
//#region src/js/shared/utils/interop-import.ts
|
|
4
|
+
const interopImport = async (thePackage) => {
|
|
5
|
+
const resolved = await thePackage;
|
|
6
|
+
return typeof resolved === "object" && resolved !== null && "default" in resolved ? resolved.default : resolved;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region package.json
|
|
11
|
+
var name = "@brnshkr/config";
|
|
12
|
+
var version = "0.0.1-alpha.2";
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/js/shared/utils/package-json.ts
|
|
16
|
+
const packageOrganizationInternal = name.split("/").at(0)?.replace(/^@/v, "");
|
|
17
|
+
if (packageOrganizationInternal === void 0 || packageOrganizationInternal.length === 0) throw new Error("Failed to read package organization from package.json file.");
|
|
18
|
+
const packageOrganization = packageOrganizationInternal;
|
|
19
|
+
const packageOrganizationUpper = packageOrganizationInternal.toUpperCase();
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/js/eslint/utils/module.ts
|
|
23
|
+
const PACKAGES$1 = {
|
|
24
|
+
ESLINT_CSS: "@eslint/css",
|
|
25
|
+
ESLINT_FLAT_CONFIG_GITIGNORE: "eslint-config-flat-gitignore",
|
|
26
|
+
ESLINT_IMPORT_RESOVLER_TYPESCRIPT: "eslint-import-resolver-typescript",
|
|
27
|
+
ESLINT_JSON: "@eslint/json",
|
|
28
|
+
ESLINT_MARKDOWN: "@eslint/markdown",
|
|
29
|
+
ESLINT_MERGE_PROCESSORS: "eslint-merge-processors",
|
|
30
|
+
ESLINT_PLUGIN_ANTFU: "eslint-plugin-antfu",
|
|
31
|
+
ESLINT_PLUGIN_ESLINT_COMMENTS: "@eslint-community/eslint-plugin-eslint-comments",
|
|
32
|
+
ESLINT_PLUGIN_IMPORT_X: "eslint-plugin-import-x",
|
|
33
|
+
ESLINT_PLUGIN_JSDOC: "eslint-plugin-jsdoc",
|
|
34
|
+
ESLINT_PLUGIN_JSDOC_PROCESSOR: "eslint-plugin-jsdoc/getJsdocProcessorPlugin.js",
|
|
35
|
+
ESLINT_PLUGIN_JSONC: "eslint-plugin-jsonc",
|
|
36
|
+
ESLINT_PLUGIN_N: "eslint-plugin-n",
|
|
37
|
+
ESLINT_PLUGIN_PERFECTIONIST: "eslint-plugin-perfectionist",
|
|
38
|
+
ESLINT_PLUGIN_REGEXP: "eslint-plugin-regexp",
|
|
39
|
+
ESLINT_PLUGIN_STYLISTIC: "@stylistic/eslint-plugin",
|
|
40
|
+
ESLINT_PLUGIN_SVELTE: "eslint-plugin-svelte",
|
|
41
|
+
ESLINT_PLUGIN_TOML: "eslint-plugin-toml",
|
|
42
|
+
ESLINT_PLUGIN_UNICORN: "eslint-plugin-unicorn",
|
|
43
|
+
ESLINT_PLUGIN_UNUSED_IMPORTS: "eslint-plugin-unused-imports",
|
|
44
|
+
ESLINT_PLUGIN_YML: "eslint-plugin-yml",
|
|
45
|
+
JSONC_ESLINT_PARSER: "jsonc-eslint-parser",
|
|
46
|
+
SVELTE: "svelte",
|
|
47
|
+
TOML_ESLINT_PARSER: "toml-eslint-parser",
|
|
48
|
+
TYPESCRIPT: "typescript",
|
|
49
|
+
TYPESCRIPT_ESLINT: "typescript-eslint",
|
|
50
|
+
VITEST_ESLINT_PLUGIN: "@vitest/eslint-plugin",
|
|
51
|
+
YAML_ESLINT_PARSER: "yaml-eslint-parser"
|
|
52
|
+
};
|
|
53
|
+
const PACKAGE_RESOLVERS = {
|
|
54
|
+
[PACKAGES$1.ESLINT_CSS]: async () => await interopImport(import("@eslint/css")),
|
|
55
|
+
[PACKAGES$1.ESLINT_FLAT_CONFIG_GITIGNORE]: async () => await interopImport(import("eslint-config-flat-gitignore")),
|
|
56
|
+
[PACKAGES$1.ESLINT_JSON]: async () => await interopImport(import("@eslint/json")),
|
|
57
|
+
[PACKAGES$1.ESLINT_IMPORT_RESOVLER_TYPESCRIPT]: async () => await interopImport(import("eslint-import-resolver-typescript")),
|
|
58
|
+
[PACKAGES$1.ESLINT_PLUGIN_ANTFU]: async () => await interopImport(import("eslint-plugin-antfu")),
|
|
59
|
+
[PACKAGES$1.ESLINT_PLUGIN_ESLINT_COMMENTS]: async () => await interopImport(import("@eslint-community/eslint-plugin-eslint-comments")),
|
|
60
|
+
[PACKAGES$1.ESLINT_PLUGIN_IMPORT_X]: async () => await interopImport(import("eslint-plugin-import-x")),
|
|
61
|
+
[PACKAGES$1.ESLINT_PLUGIN_JSDOC]: async () => await interopImport(import("eslint-plugin-jsdoc")),
|
|
62
|
+
[PACKAGES$1.ESLINT_PLUGIN_JSONC]: async () => await interopImport(import("eslint-plugin-jsonc")),
|
|
63
|
+
[PACKAGES$1.ESLINT_PLUGIN_JSDOC_PROCESSOR]: async () => await interopImport(import("eslint-plugin-jsdoc/getJsdocProcessorPlugin.js")),
|
|
64
|
+
[PACKAGES$1.ESLINT_MARKDOWN]: async () => await interopImport(import("@eslint/markdown")),
|
|
65
|
+
[PACKAGES$1.ESLINT_MERGE_PROCESSORS]: async () => await interopImport(import("eslint-merge-processors")),
|
|
66
|
+
[PACKAGES$1.ESLINT_PLUGIN_N]: async () => await interopImport(import("eslint-plugin-n")),
|
|
67
|
+
[PACKAGES$1.ESLINT_PLUGIN_PERFECTIONIST]: async () => await interopImport(import("eslint-plugin-perfectionist")),
|
|
68
|
+
[PACKAGES$1.ESLINT_PLUGIN_REGEXP]: async () => await interopImport(import("eslint-plugin-regexp")),
|
|
69
|
+
[PACKAGES$1.ESLINT_PLUGIN_STYLISTIC]: async () => await interopImport(import("@stylistic/eslint-plugin")),
|
|
70
|
+
[PACKAGES$1.ESLINT_PLUGIN_SVELTE]: async () => await interopImport(import("eslint-plugin-svelte")),
|
|
71
|
+
[PACKAGES$1.ESLINT_PLUGIN_TOML]: async () => await interopImport(import("eslint-plugin-toml")),
|
|
72
|
+
[PACKAGES$1.ESLINT_PLUGIN_UNICORN]: async () => await interopImport(import("eslint-plugin-unicorn")),
|
|
73
|
+
[PACKAGES$1.ESLINT_PLUGIN_UNUSED_IMPORTS]: async () => await interopImport(import("eslint-plugin-unused-imports")),
|
|
74
|
+
[PACKAGES$1.ESLINT_PLUGIN_YML]: async () => await interopImport(import("eslint-plugin-yml")),
|
|
75
|
+
[PACKAGES$1.JSONC_ESLINT_PARSER]: async () => await interopImport(import("jsonc-eslint-parser")),
|
|
76
|
+
[PACKAGES$1.TOML_ESLINT_PARSER]: async () => await interopImport(import("toml-eslint-parser")),
|
|
77
|
+
[PACKAGES$1.SVELTE]: () => isPackageExists(PACKAGES$1.SVELTE),
|
|
78
|
+
[PACKAGES$1.TYPESCRIPT]: () => isPackageExists(PACKAGES$1.TYPESCRIPT),
|
|
79
|
+
[PACKAGES$1.TYPESCRIPT_ESLINT]: async () => await interopImport(import("typescript-eslint")),
|
|
80
|
+
[PACKAGES$1.VITEST_ESLINT_PLUGIN]: async () => await interopImport(import("@vitest/eslint-plugin")),
|
|
81
|
+
[PACKAGES$1.YAML_ESLINT_PARSER]: async () => await interopImport(import("yaml-eslint-parser"))
|
|
82
|
+
};
|
|
83
|
+
const MODULES$1 = {
|
|
84
|
+
[packageOrganization]: { name: packageOrganization },
|
|
85
|
+
comments: {
|
|
86
|
+
name: "comments",
|
|
87
|
+
packages: { requiredAll: [PACKAGES$1.ESLINT_PLUGIN_ESLINT_COMMENTS] }
|
|
88
|
+
},
|
|
89
|
+
css: {
|
|
90
|
+
name: "css",
|
|
91
|
+
packages: { requiredAll: [PACKAGES$1.ESLINT_CSS] }
|
|
92
|
+
},
|
|
93
|
+
gitignore: {
|
|
94
|
+
name: "gitignore",
|
|
95
|
+
packages: { requiredAll: [PACKAGES$1.ESLINT_FLAT_CONFIG_GITIGNORE] }
|
|
96
|
+
},
|
|
97
|
+
import: {
|
|
98
|
+
name: "import",
|
|
99
|
+
packages: {
|
|
100
|
+
requiredAny: [PACKAGES$1.ESLINT_PLUGIN_IMPORT_X, PACKAGES$1.ESLINT_PLUGIN_ANTFU],
|
|
101
|
+
optional: [PACKAGES$1.ESLINT_IMPORT_RESOVLER_TYPESCRIPT]
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
javascript: {
|
|
105
|
+
name: "javascript",
|
|
106
|
+
packages: { optional: [PACKAGES$1.ESLINT_PLUGIN_ANTFU, PACKAGES$1.ESLINT_PLUGIN_UNUSED_IMPORTS] }
|
|
107
|
+
},
|
|
108
|
+
jsdoc: {
|
|
109
|
+
name: "jsdoc",
|
|
110
|
+
packages: {
|
|
111
|
+
requiredAll: [PACKAGES$1.ESLINT_PLUGIN_JSDOC],
|
|
112
|
+
optional: [PACKAGES$1.ESLINT_PLUGIN_JSDOC_PROCESSOR]
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
json: {
|
|
116
|
+
name: "json",
|
|
117
|
+
packages: {
|
|
118
|
+
requiredAll: [PACKAGES$1.ESLINT_JSON],
|
|
119
|
+
optional: [PACKAGES$1.ESLINT_PLUGIN_JSONC, PACKAGES$1.JSONC_ESLINT_PARSER]
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
markdown: {
|
|
123
|
+
name: "markdown",
|
|
124
|
+
packages: { requiredAll: [PACKAGES$1.ESLINT_MARKDOWN, PACKAGES$1.ESLINT_MERGE_PROCESSORS] }
|
|
125
|
+
},
|
|
126
|
+
node: {
|
|
127
|
+
name: "node",
|
|
128
|
+
packages: { requiredAll: [PACKAGES$1.ESLINT_PLUGIN_N] }
|
|
129
|
+
},
|
|
130
|
+
perfectionist: {
|
|
131
|
+
name: "perfectionist",
|
|
132
|
+
packages: { requiredAll: [PACKAGES$1.ESLINT_PLUGIN_PERFECTIONIST] }
|
|
133
|
+
},
|
|
134
|
+
regexp: {
|
|
135
|
+
name: "regexp",
|
|
136
|
+
packages: { requiredAll: [PACKAGES$1.ESLINT_PLUGIN_REGEXP] }
|
|
137
|
+
},
|
|
138
|
+
style: {
|
|
139
|
+
name: "style",
|
|
140
|
+
packages: { requiredAll: [PACKAGES$1.ESLINT_PLUGIN_STYLISTIC] }
|
|
141
|
+
},
|
|
142
|
+
svelte: {
|
|
143
|
+
name: "svelte",
|
|
144
|
+
packages: { requiredAll: [PACKAGES$1.SVELTE, PACKAGES$1.ESLINT_PLUGIN_SVELTE] }
|
|
145
|
+
},
|
|
146
|
+
test: {
|
|
147
|
+
name: "test",
|
|
148
|
+
packages: { requiredAll: [PACKAGES$1.VITEST_ESLINT_PLUGIN] }
|
|
149
|
+
},
|
|
150
|
+
toml: {
|
|
151
|
+
name: "toml",
|
|
152
|
+
packages: { requiredAll: [PACKAGES$1.ESLINT_PLUGIN_TOML, PACKAGES$1.TOML_ESLINT_PARSER] }
|
|
153
|
+
},
|
|
154
|
+
typescript: {
|
|
155
|
+
name: "typescript",
|
|
156
|
+
packages: { requiredAll: [PACKAGES$1.TYPESCRIPT, PACKAGES$1.TYPESCRIPT_ESLINT] }
|
|
157
|
+
},
|
|
158
|
+
unicorn: {
|
|
159
|
+
name: "unicorn",
|
|
160
|
+
packages: { requiredAll: [PACKAGES$1.ESLINT_PLUGIN_UNICORN] }
|
|
161
|
+
},
|
|
162
|
+
yaml: {
|
|
163
|
+
name: "yaml",
|
|
164
|
+
packages: { requiredAll: [PACKAGES$1.ESLINT_PLUGIN_YML, PACKAGES$1.YAML_ESLINT_PARSER] }
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
const resolvePackages$1 = async (moduleInfo, type) => resolvePackagesSharedAsynchronously(moduleInfo, type);
|
|
168
|
+
const enabledStates$1 = {};
|
|
169
|
+
const isModuleEnabled$1 = (moduleInfo) => enabledStates$1[moduleInfo.name] ?? isModuleEnabledByDefault(moduleInfo);
|
|
170
|
+
const setModuleEnabled$1 = (moduleInfo, state) => {
|
|
171
|
+
enabledStates$1[moduleInfo.name] = state;
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
//#endregion
|
|
175
|
+
//#region src/js/stylelint/utils/module.ts
|
|
176
|
+
const PACKAGES = {
|
|
177
|
+
POSTCSS_HTML: "postcss-html",
|
|
178
|
+
STYLELINT_CONFIG_CSS_MODULES: "stylelint-config-css-modules",
|
|
179
|
+
STYLELINT_CONFIG_HTML: "stylelint-config-html",
|
|
180
|
+
STYLELINT_CONFIG_RECESS_ORDER: "stylelint-config-recess-order",
|
|
181
|
+
STYLELINT_CONFIG_STANDARD_SCSS: "stylelint-config-standard-scss",
|
|
182
|
+
STYLELINT_DECLARATION_STRICT_VALUE: "stylelint-declaration-strict-value",
|
|
183
|
+
STYLELINT_ORDER: "stylelint-order",
|
|
184
|
+
STYLELINT_PLUGIN_DEFENSIVE_CSS: "stylelint-plugin-defensive-css",
|
|
185
|
+
STYLELINT_PLUGIN_LOGICAL_CSS: "stylelint-plugin-logical-css",
|
|
186
|
+
STYLELINT_PLUGIN_USE_BASELINE: "stylelint-plugin-use-baseline",
|
|
187
|
+
STYLELINT_USE_NESTING: "stylelint-use-nesting",
|
|
188
|
+
STYLISTIC_STYLELINT_CONFIG: "@stylistic/stylelint-config"
|
|
189
|
+
};
|
|
190
|
+
const PACKAGE_RESOLVERS$1 = {
|
|
191
|
+
[PACKAGES.POSTCSS_HTML]: () => isPackageExists(PACKAGES.POSTCSS_HTML),
|
|
192
|
+
[PACKAGES.STYLELINT_CONFIG_CSS_MODULES]: () => isPackageExists(PACKAGES.STYLELINT_CONFIG_CSS_MODULES),
|
|
193
|
+
[PACKAGES.STYLELINT_CONFIG_HTML]: () => isPackageExists(PACKAGES.STYLELINT_CONFIG_HTML),
|
|
194
|
+
[PACKAGES.STYLELINT_CONFIG_RECESS_ORDER]: () => isPackageExists(PACKAGES.STYLELINT_CONFIG_RECESS_ORDER),
|
|
195
|
+
[PACKAGES.STYLELINT_CONFIG_STANDARD_SCSS]: () => isPackageExists(PACKAGES.STYLELINT_CONFIG_STANDARD_SCSS),
|
|
196
|
+
[PACKAGES.STYLELINT_DECLARATION_STRICT_VALUE]: () => isPackageExists(PACKAGES.STYLELINT_DECLARATION_STRICT_VALUE),
|
|
197
|
+
[PACKAGES.STYLELINT_ORDER]: () => isPackageExists(PACKAGES.STYLELINT_ORDER),
|
|
198
|
+
[PACKAGES.STYLELINT_PLUGIN_DEFENSIVE_CSS]: () => isPackageExists(PACKAGES.STYLELINT_PLUGIN_DEFENSIVE_CSS),
|
|
199
|
+
[PACKAGES.STYLELINT_PLUGIN_LOGICAL_CSS]: () => isPackageExists(PACKAGES.STYLELINT_PLUGIN_LOGICAL_CSS),
|
|
200
|
+
[PACKAGES.STYLELINT_PLUGIN_USE_BASELINE]: () => isPackageExists(PACKAGES.STYLELINT_PLUGIN_USE_BASELINE),
|
|
201
|
+
[PACKAGES.STYLELINT_USE_NESTING]: () => isPackageExists(PACKAGES.STYLELINT_USE_NESTING),
|
|
202
|
+
[PACKAGES.STYLISTIC_STYLELINT_CONFIG]: () => isPackageExists(PACKAGES.STYLISTIC_STYLELINT_CONFIG)
|
|
203
|
+
};
|
|
204
|
+
const MODULES = {
|
|
205
|
+
baseline: {
|
|
206
|
+
name: "baseline",
|
|
207
|
+
packages: { requiredAll: [PACKAGES.STYLELINT_PLUGIN_USE_BASELINE] }
|
|
208
|
+
},
|
|
209
|
+
defensive: {
|
|
210
|
+
name: "defensive",
|
|
211
|
+
packages: { requiredAll: [PACKAGES.STYLELINT_PLUGIN_DEFENSIVE_CSS] }
|
|
212
|
+
},
|
|
213
|
+
html: {
|
|
214
|
+
name: "html",
|
|
215
|
+
packages: { requiredAll: [PACKAGES.POSTCSS_HTML, PACKAGES.STYLELINT_CONFIG_HTML] }
|
|
216
|
+
},
|
|
217
|
+
logical: {
|
|
218
|
+
name: "logical",
|
|
219
|
+
packages: { requiredAll: [PACKAGES.STYLELINT_PLUGIN_LOGICAL_CSS] }
|
|
220
|
+
},
|
|
221
|
+
modules: {
|
|
222
|
+
name: "modules",
|
|
223
|
+
packages: { requiredAll: [PACKAGES.STYLELINT_CONFIG_CSS_MODULES] }
|
|
224
|
+
},
|
|
225
|
+
nesting: {
|
|
226
|
+
name: "nesting",
|
|
227
|
+
packages: { requiredAll: [PACKAGES.STYLELINT_USE_NESTING] }
|
|
228
|
+
},
|
|
229
|
+
order: {
|
|
230
|
+
name: "order",
|
|
231
|
+
packages: { requiredAll: [PACKAGES.STYLELINT_ORDER, PACKAGES.STYLELINT_CONFIG_RECESS_ORDER] }
|
|
232
|
+
},
|
|
233
|
+
scss: {
|
|
234
|
+
name: "scss",
|
|
235
|
+
packages: { requiredAll: [PACKAGES.STYLELINT_CONFIG_STANDARD_SCSS] }
|
|
236
|
+
},
|
|
237
|
+
strict: {
|
|
238
|
+
name: "strict",
|
|
239
|
+
packages: { requiredAll: [PACKAGES.STYLELINT_DECLARATION_STRICT_VALUE] }
|
|
240
|
+
},
|
|
241
|
+
style: {
|
|
242
|
+
name: "style",
|
|
243
|
+
packages: { requiredAll: [PACKAGES.STYLISTIC_STYLELINT_CONFIG] }
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
const resolvePackages = (moduleInfo, type) => resolvePackagesSharedSynchronously(moduleInfo, type);
|
|
247
|
+
const enabledStates = {};
|
|
248
|
+
const isModuleEnabled = (moduleInfo) => enabledStates[moduleInfo.name] ?? isModuleEnabledByDefault(moduleInfo);
|
|
249
|
+
const setModuleEnabled = (moduleInfo, state) => {
|
|
250
|
+
enabledStates[moduleInfo.name] = state;
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
//#endregion
|
|
254
|
+
//#region src/js/shared/utils/log.ts
|
|
255
|
+
const log = (type, message, context) => {
|
|
256
|
+
console[type](`[${name}] ${message}`);
|
|
257
|
+
if (context) console[type](context);
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
//#endregion
|
|
261
|
+
//#region src/js/shared/utils/object.ts
|
|
262
|
+
const objectKeys = (object) => Object.keys(object);
|
|
263
|
+
const objectEntries = (object) => Object.entries(object);
|
|
264
|
+
const objectFromEntries = (entries) => Object.fromEntries(entries);
|
|
265
|
+
const objectFreeze = (object) => Object.freeze(object);
|
|
266
|
+
const objectAssign = (target, source) => Object.assign(target, source);
|
|
267
|
+
|
|
268
|
+
//#endregion
|
|
269
|
+
//#region src/js/shared/utils/string.ts
|
|
270
|
+
const joinAsQuotedList = (strings, type = "conjunction") => strings.length > 1 ? `"${strings.slice(0, -1).join("\", \"")}" ${type === "conjunction" ? "and" : "or"} "${strings.slice(-1).join("")}"` : {
|
|
271
|
+
0: "",
|
|
272
|
+
1: `"${strings[0] ?? ""}"`
|
|
273
|
+
}[strings.length] ?? "";
|
|
274
|
+
|
|
275
|
+
//#endregion
|
|
276
|
+
//#region src/js/shared/utils/module.ts
|
|
277
|
+
const getPackageResolvers = () => ({
|
|
278
|
+
...PACKAGE_RESOLVERS,
|
|
279
|
+
...PACKAGE_RESOLVERS$1
|
|
280
|
+
});
|
|
281
|
+
const warnMissingPackages = (moduleInfo, packages, type) => {
|
|
282
|
+
log("warn", `Failed resolving required dependencies for module "${moduleInfo.name}". Please install ${joinAsQuotedList([...packages], type === "requiredAny" ? "disjunction" : "conjunction")} or disable the ${moduleInfo.name} module in the config.`);
|
|
283
|
+
log("log", `Run \`bun a -D ${packages.join(" ")}\` to install.`);
|
|
284
|
+
};
|
|
285
|
+
const packageCache = {};
|
|
286
|
+
const resolvePackagesSharedAsynchronously = async (moduleInfo, type) => {
|
|
287
|
+
if (moduleInfo.packages === void 0) return {};
|
|
288
|
+
const packageResolvers = getPackageResolvers();
|
|
289
|
+
const resolvedPackages = {};
|
|
290
|
+
const packages = type === void 0 ? moduleInfo.packages : { [type]: moduleInfo.packages[type] };
|
|
291
|
+
for (const [currentType, currentPackages] of objectEntries(packages)) {
|
|
292
|
+
if (!currentPackages || currentPackages.length === 0) continue;
|
|
293
|
+
resolvedPackages[currentType] ??= [];
|
|
294
|
+
for (const currentPackage of currentPackages) try {
|
|
295
|
+
const resolvedPackage = packageCache[currentPackage] ?? await packageResolvers[currentPackage]();
|
|
296
|
+
packageCache[currentPackage] ??= resolvedPackage;
|
|
297
|
+
if (resolvedPackage === false) throw new Error("Skip to catch block.");
|
|
298
|
+
resolvedPackages[currentType].push(resolvedPackage);
|
|
299
|
+
} catch {
|
|
300
|
+
if (currentType === "requiredAll") {
|
|
301
|
+
warnMissingPackages(moduleInfo, currentPackages, currentType);
|
|
302
|
+
break;
|
|
303
|
+
}
|
|
304
|
+
resolvedPackages[currentType].push(void 0);
|
|
305
|
+
}
|
|
306
|
+
if (currentType === "requiredAny" && resolvedPackages[currentType].filter((thePackage) => thePackage !== void 0).length === 0) warnMissingPackages(moduleInfo, currentPackages, currentType);
|
|
307
|
+
}
|
|
308
|
+
return type === void 0 ? resolvedPackages : resolvedPackages[type] ?? [];
|
|
309
|
+
};
|
|
310
|
+
const resolvePackagesSharedSynchronously = (moduleInfo, type) => {
|
|
311
|
+
if (moduleInfo.packages === void 0) return {};
|
|
312
|
+
const packageResolvers = getPackageResolvers();
|
|
313
|
+
const resolvedPackages = {};
|
|
314
|
+
const packages = type === void 0 ? moduleInfo.packages : { [type]: moduleInfo.packages[type] };
|
|
315
|
+
for (const [currentType, currentPackages] of objectEntries(packages)) {
|
|
316
|
+
if (!currentPackages || currentPackages.length === 0) continue;
|
|
317
|
+
resolvedPackages[currentType] ??= [];
|
|
318
|
+
for (const currentPackage of currentPackages) try {
|
|
319
|
+
const resolvedPackage = packageCache[currentPackage] ?? packageResolvers[currentPackage]();
|
|
320
|
+
packageCache[currentPackage] ??= resolvedPackage;
|
|
321
|
+
if (resolvedPackage === false) throw new Error("Skip to catch block.");
|
|
322
|
+
resolvedPackages[currentType].push(resolvedPackage);
|
|
323
|
+
} catch {
|
|
324
|
+
if (currentType === "requiredAll") {
|
|
325
|
+
warnMissingPackages(moduleInfo, currentPackages, currentType);
|
|
326
|
+
break;
|
|
327
|
+
}
|
|
328
|
+
resolvedPackages[currentType].push(void 0);
|
|
329
|
+
}
|
|
330
|
+
if (currentType === "requiredAny" && resolvedPackages[currentType].filter((thePackage) => thePackage !== void 0).length === 0) warnMissingPackages(moduleInfo, currentPackages, currentType);
|
|
331
|
+
}
|
|
332
|
+
return type === void 0 ? resolvedPackages : resolvedPackages[type] ?? [];
|
|
333
|
+
};
|
|
334
|
+
const doAllPackagesExist = (packages) => packages.every((thePackage) => isPackageExists(thePackage));
|
|
335
|
+
const doesAnyPackageExist = (packages) => packages.some((thePackage) => isPackageExists(thePackage));
|
|
336
|
+
const isModuleEnabledByDefault = (moduleInfo) => {
|
|
337
|
+
const { packages } = moduleInfo;
|
|
338
|
+
if (packages === void 0) return true;
|
|
339
|
+
let isEnabled = false;
|
|
340
|
+
for (const [currentType, currentPackages] of objectEntries(packages)) {
|
|
341
|
+
if (currentType === "optional") continue;
|
|
342
|
+
if (currentPackages && currentPackages.length > 0) isEnabled = currentType === "requiredAll" ? doAllPackagesExist(currentPackages) : doesAnyPackageExist(currentPackages);
|
|
343
|
+
if (isEnabled) break;
|
|
344
|
+
}
|
|
345
|
+
return isEnabled;
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
//#endregion
|
|
349
|
+
//#region src/js/shared/utils/globs.ts
|
|
350
|
+
const GLOB_IGNORES = [
|
|
351
|
+
"**/.cache/**",
|
|
352
|
+
"**/.changeset/**",
|
|
353
|
+
"**/.git/objects/**",
|
|
354
|
+
"**/.git/subtree-cache/**",
|
|
355
|
+
"**/.hg/store/**",
|
|
356
|
+
"**/.history/**",
|
|
357
|
+
"**/.idea/**",
|
|
358
|
+
"**/.next/**",
|
|
359
|
+
"**/.nuxt/**",
|
|
360
|
+
"**/.output/**",
|
|
361
|
+
"**/.svelte-kit/**",
|
|
362
|
+
"**/.temp/**",
|
|
363
|
+
"**/.tmp/**",
|
|
364
|
+
"**/.vercel/**",
|
|
365
|
+
"**/.vite-inspect/**",
|
|
366
|
+
"**/.vitepress/cache/**",
|
|
367
|
+
"**/.yarn/**",
|
|
368
|
+
"**/__snapshots__/**",
|
|
369
|
+
"**/*.code-search",
|
|
370
|
+
"**/*.example",
|
|
371
|
+
"**/*.min.*",
|
|
372
|
+
"**/bower_components/**",
|
|
373
|
+
"**/bun.lock",
|
|
374
|
+
"**/composer.lock",
|
|
375
|
+
"**/coverage/**",
|
|
376
|
+
"**/dist/**",
|
|
377
|
+
"**/node_modules/**",
|
|
378
|
+
"**/output/**",
|
|
379
|
+
"**/package-lock.json",
|
|
380
|
+
"**/pnpm-lock.yaml",
|
|
381
|
+
"**/temp/**",
|
|
382
|
+
"**/tmp/**",
|
|
383
|
+
"**/vendor/**",
|
|
384
|
+
"**/vite.config.*.timestamp-*",
|
|
385
|
+
"**/yarn.lock"
|
|
386
|
+
];
|
|
387
|
+
|
|
388
|
+
//#endregion
|
|
389
|
+
//#region src/js/shared/utils/constants.ts
|
|
390
|
+
const INDENT = 2;
|
|
391
|
+
const MAX_LEN = 120;
|
|
392
|
+
|
|
393
|
+
//#endregion
|
|
394
|
+
export { resolvePackages$1 as _, objectAssign as a, packageOrganizationUpper as b, objectFromEntries as c, PACKAGES as d, isModuleEnabled as f, isModuleEnabled$1 as g, MODULES$1 as h, isModuleEnabledByDefault as i, objectKeys as l, setModuleEnabled as m, MAX_LEN as n, objectEntries as o, resolvePackages as p, GLOB_IGNORES as r, objectFreeze as s, INDENT as t, MODULES as u, setModuleEnabled$1 as v, version as x, packageOrganization as y };
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Config } from "stylelint";
|
|
2
|
+
|
|
3
|
+
//#region src/js/stylelint/types/config.d.ts
|
|
4
|
+
type Config$1 = { [Key in keyof Config]: Config[Key] };
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region src/js/stylelint/types/options.d.ts
|
|
7
|
+
interface ConfigOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Enables `stylelint-plugin-use-baseline`.
|
|
10
|
+
*
|
|
11
|
+
* @default `Enabled when "stylelint-plugin-use-baseline" is installed.`
|
|
12
|
+
*
|
|
13
|
+
* @see https://github.com/ryo-manba/stylelint-plugin-use-baseline
|
|
14
|
+
*/
|
|
15
|
+
baseline: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Enables `stylelint-plugin-defensive-css`.
|
|
18
|
+
*
|
|
19
|
+
* @default `Enabled when "stylelint-plugin-defensive-css" is installed.`
|
|
20
|
+
*
|
|
21
|
+
* @see https://github.com/yuschick/stylelint-plugin-defensive-css
|
|
22
|
+
*/
|
|
23
|
+
defensive: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Enables `stylelint-config-html`.
|
|
26
|
+
*
|
|
27
|
+
* @default `Enabled when "stylelint-config-html" and "postcss-html" are installed.`
|
|
28
|
+
*
|
|
29
|
+
* @see https://github.com/ota-meshi/stylelint-config-html
|
|
30
|
+
* @see https://github.com/ota-meshi/postcss-html
|
|
31
|
+
*/
|
|
32
|
+
html: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Enables `stylelint-plugin-logical-css`.
|
|
35
|
+
*
|
|
36
|
+
* @default `Enabled when "stylelint-plugin-logical-css" is installed.`
|
|
37
|
+
*
|
|
38
|
+
* @see https://github.com/yuschick/stylelint-plugin-logical-css
|
|
39
|
+
*/
|
|
40
|
+
logical: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Enables `stylelint-config-css-modules`.
|
|
43
|
+
*
|
|
44
|
+
* @default `Enabled when "stylelint-config-css-modules" is installed.`
|
|
45
|
+
*
|
|
46
|
+
* @see https://github.com/pascalduez/stylelint-config-css-modules
|
|
47
|
+
*/
|
|
48
|
+
modules: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Enables `stylelint-use-nesting`.
|
|
51
|
+
*
|
|
52
|
+
* @default `Enabled when "stylelint-use-nesting" is installed.`
|
|
53
|
+
*
|
|
54
|
+
* @see https://github.com/csstools/stylelint-use-nesting
|
|
55
|
+
*/
|
|
56
|
+
nesting: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Enables `stylelint-config-recess-order`.
|
|
59
|
+
*
|
|
60
|
+
* @default `Enabled when "stylelint-config-recess-order" and "stylelint-order" are installed.`
|
|
61
|
+
*
|
|
62
|
+
* @see https://github.com/stormwarning/stylelint-config-recess-order
|
|
63
|
+
* @see https://github.com/hudochenkov/stylelint-order
|
|
64
|
+
*/
|
|
65
|
+
order: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Enables `stylelint-config-standard-scss`.
|
|
68
|
+
*
|
|
69
|
+
* @default `Enabled when "stylelint-config-standard-scss" is installed.`
|
|
70
|
+
*
|
|
71
|
+
* @see https://github.com/stylelint-scss/stylelint-config-standard-scss
|
|
72
|
+
*/
|
|
73
|
+
scss: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Enables `stylelint-declaration-strict-value`.
|
|
76
|
+
*
|
|
77
|
+
* @default `Enabled when "stylelint-declaration-strict-value" is installed.`
|
|
78
|
+
*
|
|
79
|
+
* @see https://github.com/AndyOGo/stylelint-declaration-strict-value
|
|
80
|
+
*/
|
|
81
|
+
strict: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Enables `@stylistic/stylelint-config`.
|
|
84
|
+
*
|
|
85
|
+
* @default `Enabled when "@stylistic/stylelint-config" is installed.`
|
|
86
|
+
*
|
|
87
|
+
* @see https://github.com/stylelint-stylistic/stylelint-config
|
|
88
|
+
*/
|
|
89
|
+
style: boolean;
|
|
90
|
+
}
|
|
91
|
+
type UserOptions = Partial<ConfigOptions> & Omit<Config$1, 'ignorePatterns' | '_processorFunctions'>;
|
|
92
|
+
//#endregion
|
|
93
|
+
//#region src/js/stylelint/index.d.ts
|
|
94
|
+
declare const getConfig: (optionsAndGlobalConfig?: UserOptions, ...additionalConfigs: Config$1[]) => Config$1;
|
|
95
|
+
declare const _default: Config$1;
|
|
96
|
+
//#endregion
|
|
97
|
+
export { _default as default, getConfig };
|