@brnshkr/config 0.0.1-alpha.9 → 0.0.1-beta.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/README.md +92 -36
- package/conf/tsconfig.json +4 -7
- package/dist/eslint/index.d.mts +1351 -1643
- package/dist/eslint/index.mjs +255 -176
- package/dist/scripts/eslint.mjs +2 -4
- package/dist/scripts/stylelint.mjs +2 -4
- package/dist/shared.mjs +79 -240
- package/dist/stylelint/index.d.mts +3 -3
- package/dist/stylelint/index.mjs +103 -67
- package/package.json +80 -96
package/dist/scripts/eslint.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
|
-
|
|
3
|
-
//#region scripts/eslint.ts
|
|
2
|
+
//#region ../scripts/eslint.ts
|
|
4
3
|
spawn("bun", [
|
|
5
4
|
"eslint",
|
|
6
5
|
"--config",
|
|
@@ -13,6 +12,5 @@ spawn("bun", [
|
|
|
13
12
|
stdio: "inherit",
|
|
14
13
|
env: import.meta.env
|
|
15
14
|
});
|
|
16
|
-
|
|
17
15
|
//#endregion
|
|
18
|
-
export {
|
|
16
|
+
export {};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
|
-
|
|
3
|
-
//#region scripts/stylelint.ts
|
|
2
|
+
//#region ../scripts/stylelint.ts
|
|
4
3
|
const EXTENSIONS = [
|
|
5
4
|
"css",
|
|
6
5
|
"ejs",
|
|
@@ -26,6 +25,5 @@ spawn("bun", [
|
|
|
26
25
|
stdio: "inherit",
|
|
27
26
|
env: import.meta.env
|
|
28
27
|
});
|
|
29
|
-
|
|
30
28
|
//#endregion
|
|
31
|
-
export {
|
|
29
|
+
export {};
|
package/dist/shared.mjs
CHANGED
|
@@ -1,26 +1,35 @@
|
|
|
1
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
|
|
2
|
+
//#region ../package.json
|
|
11
3
|
var name = "@brnshkr/config";
|
|
12
|
-
var version = "0.0.1-
|
|
13
|
-
|
|
4
|
+
var version = "0.0.1-beta.2";
|
|
14
5
|
//#endregion
|
|
15
|
-
//#region src/js/shared/utils/package-json.ts
|
|
6
|
+
//#region ../src/js/shared/utils/package-json.ts
|
|
16
7
|
const packageOrganizationInternal = name.split("/").at(0)?.replace(/^@/v, "");
|
|
17
8
|
if (packageOrganizationInternal === void 0 || packageOrganizationInternal.length === 0) throw new Error("Failed to read package organization from package.json file.");
|
|
18
9
|
const packageOrganization = packageOrganizationInternal;
|
|
19
10
|
const packageOrganizationUpper = packageOrganizationInternal.toUpperCase();
|
|
20
|
-
|
|
21
11
|
//#endregion
|
|
22
|
-
//#region src/js/
|
|
23
|
-
const
|
|
12
|
+
//#region ../src/js/shared/utils/log.ts
|
|
13
|
+
const log = (type, message, context) => {
|
|
14
|
+
console[type](`[${name}] ${message}`);
|
|
15
|
+
if (context) console[type](context);
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region ../src/js/shared/utils/object.ts
|
|
19
|
+
const objectKeys = (object) => Object.keys(object);
|
|
20
|
+
const objectEntries = (object) => Object.entries(object);
|
|
21
|
+
const objectFromEntries = (entries) => Object.fromEntries(entries);
|
|
22
|
+
const objectFreeze = (object) => Object.freeze(object);
|
|
23
|
+
const objectAssign = (target, source) => Object.assign(target, source);
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region ../src/js/shared/utils/interop-import.ts
|
|
26
|
+
const interopImport = async (thePackage) => {
|
|
27
|
+
const resolved = await thePackage;
|
|
28
|
+
return typeof resolved === "object" && resolved !== null && "default" in resolved ? resolved.default : resolved;
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region ../src/js/shared/utils/package-resolvers.ts
|
|
32
|
+
const ESLINT_PACKAGES = {
|
|
24
33
|
ESLINT_CSS: "@eslint/css",
|
|
25
34
|
ESLINT_FLAT_CONFIG_GITIGNORE: "eslint-config-flat-gitignore",
|
|
26
35
|
ESLINT_IMPORT_RESOVLER_TYPESCRIPT: "eslint-import-resolver-typescript",
|
|
@@ -42,138 +51,39 @@ const PACKAGES$1 = {
|
|
|
42
51
|
ESLINT_PLUGIN_UNICORN: "eslint-plugin-unicorn",
|
|
43
52
|
ESLINT_PLUGIN_UNUSED_IMPORTS: "eslint-plugin-unused-imports",
|
|
44
53
|
ESLINT_PLUGIN_YML: "eslint-plugin-yml",
|
|
45
|
-
JSONC_ESLINT_PARSER: "jsonc-eslint-parser",
|
|
46
54
|
SVELTE: "svelte",
|
|
47
|
-
TOML_ESLINT_PARSER: "toml-eslint-parser",
|
|
48
55
|
TYPESCRIPT: "typescript",
|
|
49
56
|
TYPESCRIPT_ESLINT: "typescript-eslint",
|
|
50
|
-
VITEST_ESLINT_PLUGIN: "@vitest/eslint-plugin"
|
|
51
|
-
YAML_ESLINT_PARSER: "yaml-eslint-parser"
|
|
57
|
+
VITEST_ESLINT_PLUGIN: "@vitest/eslint-plugin"
|
|
52
58
|
};
|
|
53
|
-
const
|
|
54
|
-
[
|
|
55
|
-
[
|
|
56
|
-
[
|
|
57
|
-
[
|
|
58
|
-
[
|
|
59
|
-
[
|
|
60
|
-
[
|
|
61
|
-
[
|
|
62
|
-
[
|
|
63
|
-
[
|
|
64
|
-
[
|
|
65
|
-
[
|
|
66
|
-
[
|
|
67
|
-
[
|
|
68
|
-
[
|
|
69
|
-
[
|
|
70
|
-
[
|
|
71
|
-
[
|
|
72
|
-
[
|
|
73
|
-
[
|
|
74
|
-
[
|
|
75
|
-
[
|
|
76
|
-
[
|
|
77
|
-
[
|
|
78
|
-
[
|
|
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"))
|
|
59
|
+
const ESLINT_PACKAGE_RESOLVERS = {
|
|
60
|
+
[ESLINT_PACKAGES.ESLINT_CSS]: async () => await interopImport(import("@eslint/css")),
|
|
61
|
+
[ESLINT_PACKAGES.ESLINT_FLAT_CONFIG_GITIGNORE]: async () => await interopImport(import("eslint-config-flat-gitignore")),
|
|
62
|
+
[ESLINT_PACKAGES.ESLINT_JSON]: async () => await interopImport(import("@eslint/json")),
|
|
63
|
+
[ESLINT_PACKAGES.ESLINT_IMPORT_RESOVLER_TYPESCRIPT]: async () => await interopImport(import("eslint-import-resolver-typescript")),
|
|
64
|
+
[ESLINT_PACKAGES.ESLINT_PLUGIN_ANTFU]: async () => await interopImport(import("eslint-plugin-antfu")),
|
|
65
|
+
[ESLINT_PACKAGES.ESLINT_PLUGIN_ESLINT_COMMENTS]: async () => await interopImport(import("@eslint-community/eslint-plugin-eslint-comments")),
|
|
66
|
+
[ESLINT_PACKAGES.ESLINT_PLUGIN_IMPORT_X]: async () => await interopImport(import("eslint-plugin-import-x")),
|
|
67
|
+
[ESLINT_PACKAGES.ESLINT_PLUGIN_JSDOC]: async () => await interopImport(import("eslint-plugin-jsdoc")),
|
|
68
|
+
[ESLINT_PACKAGES.ESLINT_PLUGIN_JSONC]: async () => await interopImport(import("eslint-plugin-jsonc")),
|
|
69
|
+
[ESLINT_PACKAGES.ESLINT_PLUGIN_JSDOC_PROCESSOR]: async () => await interopImport(import("eslint-plugin-jsdoc/getJsdocProcessorPlugin.js")),
|
|
70
|
+
[ESLINT_PACKAGES.ESLINT_MARKDOWN]: async () => await interopImport(import("@eslint/markdown")),
|
|
71
|
+
[ESLINT_PACKAGES.ESLINT_MERGE_PROCESSORS]: async () => await interopImport(import("eslint-merge-processors")),
|
|
72
|
+
[ESLINT_PACKAGES.ESLINT_PLUGIN_N]: async () => await interopImport(import("eslint-plugin-n")),
|
|
73
|
+
[ESLINT_PACKAGES.ESLINT_PLUGIN_PERFECTIONIST]: async () => await interopImport(import("eslint-plugin-perfectionist")),
|
|
74
|
+
[ESLINT_PACKAGES.ESLINT_PLUGIN_REGEXP]: async () => await interopImport(import("eslint-plugin-regexp")),
|
|
75
|
+
[ESLINT_PACKAGES.ESLINT_PLUGIN_STYLISTIC]: async () => await interopImport(import("@stylistic/eslint-plugin")),
|
|
76
|
+
[ESLINT_PACKAGES.ESLINT_PLUGIN_SVELTE]: async () => await interopImport(import("eslint-plugin-svelte")),
|
|
77
|
+
[ESLINT_PACKAGES.ESLINT_PLUGIN_TOML]: async () => await interopImport(import("eslint-plugin-toml")),
|
|
78
|
+
[ESLINT_PACKAGES.ESLINT_PLUGIN_UNICORN]: async () => await interopImport(import("eslint-plugin-unicorn")),
|
|
79
|
+
[ESLINT_PACKAGES.ESLINT_PLUGIN_UNUSED_IMPORTS]: async () => await interopImport(import("eslint-plugin-unused-imports")),
|
|
80
|
+
[ESLINT_PACKAGES.ESLINT_PLUGIN_YML]: async () => await interopImport(import("eslint-plugin-yml")),
|
|
81
|
+
[ESLINT_PACKAGES.SVELTE]: () => isPackageExists(ESLINT_PACKAGES.SVELTE),
|
|
82
|
+
[ESLINT_PACKAGES.TYPESCRIPT]: () => isPackageExists(ESLINT_PACKAGES.TYPESCRIPT),
|
|
83
|
+
[ESLINT_PACKAGES.TYPESCRIPT_ESLINT]: async () => await interopImport(import("typescript-eslint")),
|
|
84
|
+
[ESLINT_PACKAGES.VITEST_ESLINT_PLUGIN]: async () => await interopImport(import("@vitest/eslint-plugin"))
|
|
82
85
|
};
|
|
83
|
-
const
|
|
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 = {
|
|
86
|
+
const STYLELINT_PACKAGES = {
|
|
177
87
|
POSTCSS_HTML: "postcss-html",
|
|
178
88
|
STYLELINT_CONFIG_CSS_MODULES: "stylelint-config-css-modules",
|
|
179
89
|
STYLELINT_CONFIG_HTML: "stylelint-config-html",
|
|
@@ -187,112 +97,46 @@ const PACKAGES = {
|
|
|
187
97
|
STYLELINT_USE_NESTING: "stylelint-use-nesting",
|
|
188
98
|
STYLISTIC_STYLELINT_CONFIG: "@stylistic/stylelint-config"
|
|
189
99
|
};
|
|
190
|
-
const
|
|
191
|
-
[
|
|
192
|
-
[
|
|
193
|
-
[
|
|
194
|
-
[
|
|
195
|
-
[
|
|
196
|
-
[
|
|
197
|
-
[
|
|
198
|
-
[
|
|
199
|
-
[
|
|
200
|
-
[
|
|
201
|
-
[
|
|
202
|
-
[
|
|
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);
|
|
100
|
+
const STYLELINT_PACKAGE_RESOLVERS = {
|
|
101
|
+
[STYLELINT_PACKAGES.POSTCSS_HTML]: () => isPackageExists(STYLELINT_PACKAGES.POSTCSS_HTML),
|
|
102
|
+
[STYLELINT_PACKAGES.STYLELINT_CONFIG_CSS_MODULES]: () => isPackageExists(STYLELINT_PACKAGES.STYLELINT_CONFIG_CSS_MODULES),
|
|
103
|
+
[STYLELINT_PACKAGES.STYLELINT_CONFIG_HTML]: () => isPackageExists(STYLELINT_PACKAGES.STYLELINT_CONFIG_HTML),
|
|
104
|
+
[STYLELINT_PACKAGES.STYLELINT_CONFIG_RECESS_ORDER]: () => isPackageExists(STYLELINT_PACKAGES.STYLELINT_CONFIG_RECESS_ORDER),
|
|
105
|
+
[STYLELINT_PACKAGES.STYLELINT_CONFIG_STANDARD_SCSS]: () => isPackageExists(STYLELINT_PACKAGES.STYLELINT_CONFIG_STANDARD_SCSS),
|
|
106
|
+
[STYLELINT_PACKAGES.STYLELINT_DECLARATION_STRICT_VALUE]: () => isPackageExists(STYLELINT_PACKAGES.STYLELINT_DECLARATION_STRICT_VALUE),
|
|
107
|
+
[STYLELINT_PACKAGES.STYLELINT_ORDER]: () => isPackageExists(STYLELINT_PACKAGES.STYLELINT_ORDER),
|
|
108
|
+
[STYLELINT_PACKAGES.STYLELINT_PLUGIN_DEFENSIVE_CSS]: () => isPackageExists(STYLELINT_PACKAGES.STYLELINT_PLUGIN_DEFENSIVE_CSS),
|
|
109
|
+
[STYLELINT_PACKAGES.STYLELINT_PLUGIN_LOGICAL_CSS]: () => isPackageExists(STYLELINT_PACKAGES.STYLELINT_PLUGIN_LOGICAL_CSS),
|
|
110
|
+
[STYLELINT_PACKAGES.STYLELINT_PLUGIN_USE_BASELINE]: () => isPackageExists(STYLELINT_PACKAGES.STYLELINT_PLUGIN_USE_BASELINE),
|
|
111
|
+
[STYLELINT_PACKAGES.STYLELINT_USE_NESTING]: () => isPackageExists(STYLELINT_PACKAGES.STYLELINT_USE_NESTING),
|
|
112
|
+
[STYLELINT_PACKAGES.STYLISTIC_STYLELINT_CONFIG]: () => isPackageExists(STYLELINT_PACKAGES.STYLISTIC_STYLELINT_CONFIG)
|
|
258
113
|
};
|
|
259
|
-
|
|
260
114
|
//#endregion
|
|
261
|
-
//#region src/js/shared/utils/
|
|
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
|
|
115
|
+
//#region ../src/js/shared/utils/string.ts
|
|
270
116
|
const joinAsQuotedList = (strings, type = "conjunction") => strings.length > 1 ? `"${strings.slice(0, -1).join("\", \"")}" ${type === "conjunction" ? "and" : "or"} "${strings.slice(-1).join("")}"` : {
|
|
271
117
|
0: "",
|
|
272
118
|
1: `"${strings[0] ?? ""}"`
|
|
273
119
|
}[strings.length] ?? "";
|
|
274
|
-
|
|
275
120
|
//#endregion
|
|
276
|
-
//#region src/js/shared/utils/module.ts
|
|
277
|
-
const
|
|
278
|
-
...
|
|
279
|
-
...
|
|
280
|
-
}
|
|
121
|
+
//#region ../src/js/shared/utils/module.ts
|
|
122
|
+
const PACKAGE_RESOLVERS = {
|
|
123
|
+
...ESLINT_PACKAGE_RESOLVERS,
|
|
124
|
+
...STYLELINT_PACKAGE_RESOLVERS
|
|
125
|
+
};
|
|
281
126
|
const warnMissingPackages = (moduleInfo, packages, type) => {
|
|
282
|
-
log("
|
|
283
|
-
log("log", `Run \`bun a -D ${packages.join(" ")}\` to install.`);
|
|
127
|
+
log("error", `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.`);
|
|
128
|
+
log("log", `Run \`bun a -D -E ${packages.join(" ")}\` to install.`);
|
|
284
129
|
};
|
|
285
130
|
const packageCache = {};
|
|
286
131
|
const resolvePackagesSharedAsynchronously = async (moduleInfo, type) => {
|
|
287
132
|
if (moduleInfo.packages === void 0) return {};
|
|
288
|
-
const packageResolvers = getPackageResolvers();
|
|
289
133
|
const resolvedPackages = {};
|
|
290
134
|
const packages = type === void 0 ? moduleInfo.packages : { [type]: moduleInfo.packages[type] };
|
|
291
135
|
for (const [currentType, currentPackages] of objectEntries(packages)) {
|
|
292
136
|
if (!currentPackages || currentPackages.length === 0) continue;
|
|
293
137
|
resolvedPackages[currentType] ??= [];
|
|
294
138
|
for (const currentPackage of currentPackages) try {
|
|
295
|
-
const resolvedPackage = packageCache[currentPackage] ?? await
|
|
139
|
+
const resolvedPackage = packageCache[currentPackage] ?? await PACKAGE_RESOLVERS[currentPackage]();
|
|
296
140
|
packageCache[currentPackage] ??= resolvedPackage;
|
|
297
141
|
if (resolvedPackage === false) throw new Error("Skip to catch block.");
|
|
298
142
|
resolvedPackages[currentType].push(resolvedPackage);
|
|
@@ -309,14 +153,13 @@ const resolvePackagesSharedAsynchronously = async (moduleInfo, type) => {
|
|
|
309
153
|
};
|
|
310
154
|
const resolvePackagesSharedSynchronously = (moduleInfo, type) => {
|
|
311
155
|
if (moduleInfo.packages === void 0) return {};
|
|
312
|
-
const packageResolvers = getPackageResolvers();
|
|
313
156
|
const resolvedPackages = {};
|
|
314
157
|
const packages = type === void 0 ? moduleInfo.packages : { [type]: moduleInfo.packages[type] };
|
|
315
158
|
for (const [currentType, currentPackages] of objectEntries(packages)) {
|
|
316
159
|
if (!currentPackages || currentPackages.length === 0) continue;
|
|
317
160
|
resolvedPackages[currentType] ??= [];
|
|
318
161
|
for (const currentPackage of currentPackages) try {
|
|
319
|
-
const resolvedPackage = packageCache[currentPackage] ??
|
|
162
|
+
const resolvedPackage = packageCache[currentPackage] ?? PACKAGE_RESOLVERS[currentPackage]();
|
|
320
163
|
packageCache[currentPackage] ??= resolvedPackage;
|
|
321
164
|
if (resolvedPackage === false) throw new Error("Skip to catch block.");
|
|
322
165
|
resolvedPackages[currentType].push(resolvedPackage);
|
|
@@ -344,9 +187,8 @@ const isModuleEnabledByDefault = (moduleInfo) => {
|
|
|
344
187
|
}
|
|
345
188
|
return isEnabled;
|
|
346
189
|
};
|
|
347
|
-
|
|
348
190
|
//#endregion
|
|
349
|
-
//#region src/js/shared/utils/globs.ts
|
|
191
|
+
//#region ../src/js/shared/utils/globs.ts
|
|
350
192
|
const GLOB_IGNORES = [
|
|
351
193
|
"**/.cache/**",
|
|
352
194
|
"**/.changeset/**",
|
|
@@ -384,11 +226,8 @@ const GLOB_IGNORES = [
|
|
|
384
226
|
"**/vite.config.*.timestamp-*",
|
|
385
227
|
"**/yarn.lock"
|
|
386
228
|
];
|
|
387
|
-
|
|
388
229
|
//#endregion
|
|
389
|
-
//#region src/js/shared/utils/constants.ts
|
|
390
|
-
const
|
|
391
|
-
const MAX_LEN = 120;
|
|
392
|
-
|
|
230
|
+
//#region ../src/js/shared/utils/constants.ts
|
|
231
|
+
const QUOTES = "single";
|
|
393
232
|
//#endregion
|
|
394
|
-
export {
|
|
233
|
+
export { resolvePackagesSharedSynchronously as a, objectAssign as c, objectFromEntries as d, objectKeys as f, version as h, resolvePackagesSharedAsynchronously as i, objectEntries as l, packageOrganizationUpper as m, GLOB_IGNORES as n, ESLINT_PACKAGES as o, packageOrganization as p, isModuleEnabledByDefault as r, STYLELINT_PACKAGES as s, QUOTES as t, objectFreeze as u };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Config } from "stylelint";
|
|
2
2
|
|
|
3
|
-
//#region src/js/stylelint/types/config.d.ts
|
|
3
|
+
//#region ../src/js/stylelint/types/config.d.ts
|
|
4
4
|
type Config$1 = { [Key in keyof Config]: Config[Key] };
|
|
5
5
|
//#endregion
|
|
6
|
-
//#region src/js/stylelint/types/options.d.ts
|
|
6
|
+
//#region ../src/js/stylelint/types/options.d.ts
|
|
7
7
|
interface ConfigOptions {
|
|
8
8
|
/**
|
|
9
9
|
* Enables `stylelint-plugin-use-baseline`.
|
|
@@ -90,7 +90,7 @@ interface ConfigOptions {
|
|
|
90
90
|
}
|
|
91
91
|
type UserOptions = Partial<ConfigOptions> & Omit<Config$1, 'ignorePatterns' | '_processorFunctions'>;
|
|
92
92
|
//#endregion
|
|
93
|
-
//#region src/js/stylelint/index.d.ts
|
|
93
|
+
//#region ../src/js/stylelint/index.d.ts
|
|
94
94
|
declare const getConfig: (optionsAndGlobalConfig?: UserOptions, ...additionalConfigs: Config$1[]) => Config$1;
|
|
95
95
|
declare const _default: Config$1;
|
|
96
96
|
//#endregion
|