@brnshkr/config 0.0.1-alpha.13 → 0.0.1-alpha.15
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 +9 -3
- package/dist/eslint/index.d.mts +1184 -1639
- package/dist/eslint/index.mjs +233 -159
- package/dist/scripts/eslint.mjs +2 -4
- package/dist/scripts/stylelint.mjs +2 -4
- package/dist/shared.mjs +76 -241
- package/dist/stylelint/index.d.mts +3 -3
- package/dist/stylelint/index.mjs +85 -59
- package/package.json +74 -90
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-alpha.
|
|
13
|
-
|
|
4
|
+
var version = "0.0.1-alpha.15";
|
|
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"
|
|
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"))
|
|
57
|
+
VITEST_ESLINT_PLUGIN: "@vitest/eslint-plugin"
|
|
82
58
|
};
|
|
83
|
-
const
|
|
84
|
-
[
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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;
|
|
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"))
|
|
172
85
|
};
|
|
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,100 +97,32 @@ 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
|
-
[
|
|
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)
|
|
203
113
|
};
|
|
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: {
|
|
236
|
-
requiredAll: [PACKAGES.STYLELINT_CONFIG_STANDARD_SCSS],
|
|
237
|
-
optional: [PACKAGES.STYLELINT_PLUGIN_USE_BASELINE]
|
|
238
|
-
}
|
|
239
|
-
},
|
|
240
|
-
strict: {
|
|
241
|
-
name: "strict",
|
|
242
|
-
packages: { requiredAll: [PACKAGES.STYLELINT_DECLARATION_STRICT_VALUE] }
|
|
243
|
-
},
|
|
244
|
-
style: {
|
|
245
|
-
name: "style",
|
|
246
|
-
packages: { requiredAll: [PACKAGES.STYLISTIC_STYLELINT_CONFIG] }
|
|
247
|
-
}
|
|
248
|
-
};
|
|
249
|
-
const resolvePackages = (moduleInfo, type) => resolvePackagesSharedSynchronously(moduleInfo, type);
|
|
250
|
-
const enabledStates = {};
|
|
251
|
-
const isModuleEnabled = (moduleInfo) => enabledStates[moduleInfo.name] ?? isModuleEnabledByDefault(moduleInfo);
|
|
252
|
-
const setModuleEnabled = (moduleInfo, state) => {
|
|
253
|
-
enabledStates[moduleInfo.name] = state;
|
|
254
|
-
};
|
|
255
|
-
|
|
256
114
|
//#endregion
|
|
257
|
-
//#region src/js/shared/utils/
|
|
258
|
-
const log = (type, message, context) => {
|
|
259
|
-
console[type](`[${name}] ${message}`);
|
|
260
|
-
if (context) console[type](context);
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
//#endregion
|
|
264
|
-
//#region src/js/shared/utils/object.ts
|
|
265
|
-
const objectKeys = (object) => Object.keys(object);
|
|
266
|
-
const objectEntries = (object) => Object.entries(object);
|
|
267
|
-
const objectFromEntries = (entries) => Object.fromEntries(entries);
|
|
268
|
-
const objectFreeze = (object) => Object.freeze(object);
|
|
269
|
-
const objectAssign = (target, source) => Object.assign(target, source);
|
|
270
|
-
|
|
271
|
-
//#endregion
|
|
272
|
-
//#region src/js/shared/utils/string.ts
|
|
115
|
+
//#region ../src/js/shared/utils/string.ts
|
|
273
116
|
const joinAsQuotedList = (strings, type = "conjunction") => strings.length > 1 ? `"${strings.slice(0, -1).join("\", \"")}" ${type === "conjunction" ? "and" : "or"} "${strings.slice(-1).join("")}"` : {
|
|
274
117
|
0: "",
|
|
275
118
|
1: `"${strings[0] ?? ""}"`
|
|
276
119
|
}[strings.length] ?? "";
|
|
277
|
-
|
|
278
120
|
//#endregion
|
|
279
|
-
//#region src/js/shared/utils/module.ts
|
|
280
|
-
const
|
|
281
|
-
...
|
|
282
|
-
...
|
|
283
|
-
}
|
|
121
|
+
//#region ../src/js/shared/utils/module.ts
|
|
122
|
+
const PACKAGE_RESOLVERS = {
|
|
123
|
+
...ESLINT_PACKAGE_RESOLVERS,
|
|
124
|
+
...STYLELINT_PACKAGE_RESOLVERS
|
|
125
|
+
};
|
|
284
126
|
const warnMissingPackages = (moduleInfo, packages, type) => {
|
|
285
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.`);
|
|
286
128
|
log("log", `Run \`bun a -D -E ${packages.join(" ")}\` to install.`);
|
|
@@ -288,14 +130,13 @@ const warnMissingPackages = (moduleInfo, packages, type) => {
|
|
|
288
130
|
const packageCache = {};
|
|
289
131
|
const resolvePackagesSharedAsynchronously = async (moduleInfo, type) => {
|
|
290
132
|
if (moduleInfo.packages === void 0) return {};
|
|
291
|
-
const packageResolvers = getPackageResolvers();
|
|
292
133
|
const resolvedPackages = {};
|
|
293
134
|
const packages = type === void 0 ? moduleInfo.packages : { [type]: moduleInfo.packages[type] };
|
|
294
135
|
for (const [currentType, currentPackages] of objectEntries(packages)) {
|
|
295
136
|
if (!currentPackages || currentPackages.length === 0) continue;
|
|
296
137
|
resolvedPackages[currentType] ??= [];
|
|
297
138
|
for (const currentPackage of currentPackages) try {
|
|
298
|
-
const resolvedPackage = packageCache[currentPackage] ?? await
|
|
139
|
+
const resolvedPackage = packageCache[currentPackage] ?? await PACKAGE_RESOLVERS[currentPackage]();
|
|
299
140
|
packageCache[currentPackage] ??= resolvedPackage;
|
|
300
141
|
if (resolvedPackage === false) throw new Error("Skip to catch block.");
|
|
301
142
|
resolvedPackages[currentType].push(resolvedPackage);
|
|
@@ -312,14 +153,13 @@ const resolvePackagesSharedAsynchronously = async (moduleInfo, type) => {
|
|
|
312
153
|
};
|
|
313
154
|
const resolvePackagesSharedSynchronously = (moduleInfo, type) => {
|
|
314
155
|
if (moduleInfo.packages === void 0) return {};
|
|
315
|
-
const packageResolvers = getPackageResolvers();
|
|
316
156
|
const resolvedPackages = {};
|
|
317
157
|
const packages = type === void 0 ? moduleInfo.packages : { [type]: moduleInfo.packages[type] };
|
|
318
158
|
for (const [currentType, currentPackages] of objectEntries(packages)) {
|
|
319
159
|
if (!currentPackages || currentPackages.length === 0) continue;
|
|
320
160
|
resolvedPackages[currentType] ??= [];
|
|
321
161
|
for (const currentPackage of currentPackages) try {
|
|
322
|
-
const resolvedPackage = packageCache[currentPackage] ??
|
|
162
|
+
const resolvedPackage = packageCache[currentPackage] ?? PACKAGE_RESOLVERS[currentPackage]();
|
|
323
163
|
packageCache[currentPackage] ??= resolvedPackage;
|
|
324
164
|
if (resolvedPackage === false) throw new Error("Skip to catch block.");
|
|
325
165
|
resolvedPackages[currentType].push(resolvedPackage);
|
|
@@ -347,9 +187,8 @@ const isModuleEnabledByDefault = (moduleInfo) => {
|
|
|
347
187
|
}
|
|
348
188
|
return isEnabled;
|
|
349
189
|
};
|
|
350
|
-
|
|
351
190
|
//#endregion
|
|
352
|
-
//#region src/js/shared/utils/globs.ts
|
|
191
|
+
//#region ../src/js/shared/utils/globs.ts
|
|
353
192
|
const GLOB_IGNORES = [
|
|
354
193
|
"**/.cache/**",
|
|
355
194
|
"**/.changeset/**",
|
|
@@ -387,12 +226,8 @@ const GLOB_IGNORES = [
|
|
|
387
226
|
"**/vite.config.*.timestamp-*",
|
|
388
227
|
"**/yarn.lock"
|
|
389
228
|
];
|
|
390
|
-
|
|
391
229
|
//#endregion
|
|
392
|
-
//#region src/js/shared/utils/constants.ts
|
|
393
|
-
const INDENT = 2;
|
|
394
|
-
const MAX_LEN = 120;
|
|
230
|
+
//#region ../src/js/shared/utils/constants.ts
|
|
395
231
|
const QUOTES = "single";
|
|
396
|
-
|
|
397
232
|
//#endregion
|
|
398
|
-
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
|