@adamhl8/configs 3.0.3 → 3.1.1
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 +17 -5
- package/dist/adamhl8-bunfig/index +1 -0
- package/dist/adamhl8-gitignore/index +1 -0
- package/dist/configs/bask.base.d.ts +0 -2
- package/dist/configs/bask.base.d.ts.map +1 -1
- package/dist/configs/bask.base.js +5 -2
- package/dist/configs/bask.base.js.map +1 -1
- package/dist/configs/commitlint.base.d.ts +0 -2
- package/dist/configs/commitlint.base.d.ts.map +1 -1
- package/dist/configs/commitlint.base.js +1 -2
- package/dist/configs/knip.base.d.ts +0 -2
- package/dist/configs/knip.base.d.ts.map +1 -1
- package/dist/configs/knip.base.js +0 -1
- package/dist/configs/oxfmt.base.d.ts +10 -3
- package/dist/configs/oxfmt.base.d.ts.map +1 -1
- package/dist/configs/oxfmt.base.js +7 -2
- package/dist/configs/oxfmt.base.js.map +1 -1
- package/dist/configs/oxlint.base.d.ts +104 -91
- package/dist/configs/oxlint.base.d.ts.map +1 -1
- package/dist/configs/oxlint.base.js +172 -24
- package/dist/configs/oxlint.base.js.map +1 -1
- package/dist/configs/release-it.base.d.ts +0 -2
- package/dist/configs/release-it.base.d.ts.map +1 -1
- package/dist/configs/release-it.base.js +1 -2
- package/dist/configs/release-it.base.js.map +1 -1
- package/dist/configs/tsconfig.base.json +2 -0
- package/dist/configs/tsdown.base.d.ts +3 -7
- package/dist/configs/tsdown.base.d.ts.map +1 -1
- package/dist/configs/tsdown.base.js +3 -8
- package/dist/configs/tsdown.base.js.map +1 -1
- package/dist/env/index.d.ts +0 -2
- package/dist/env/index.d.ts.map +1 -1
- package/dist/env/index.js +1 -2
- package/dist/env/utils.d.ts +0 -2
- package/dist/env/utils.d.ts.map +1 -1
- package/dist/env/utils.js +1 -2
- package/dist/env/utils.js.map +1 -1
- package/dist/merge-config/merge-config.d.ts +0 -2
- package/dist/merge-config/merge-config.d.ts.map +1 -1
- package/dist/merge-config/merge-config.js +1 -2
- package/dist/merge-config/merge-config.js.map +1 -1
- package/dist/merge-config/merge.types.d.ts +0 -2
- package/dist/merge-config/merge.types.d.ts.map +1 -1
- package/dist/utils.js +32 -4
- package/dist/utils.js.map +1 -1
- package/package.json +43 -24
|
@@ -1,7 +1,123 @@
|
|
|
1
1
|
import { createMergeConfigFn } from "../merge-config/merge-config.js";
|
|
2
|
-
import { resolvePackagePath } from "../utils.js";
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { readProjectPackageJson, resolvePackagePath, resolveProjectTailwind } from "../utils.js";
|
|
3
|
+
import cleanModulesPlugin from "@adamhl8/eslint-plugin-clean-modules";
|
|
4
|
+
import e18ePlugin from "@e18e/eslint-plugin";
|
|
5
|
+
import bunismsPlugin from "eslint-plugin-bunisms";
|
|
6
|
+
import honoPlugin from "eslint-plugin-hono";
|
|
7
|
+
import reactWebApiPlugin from "eslint-plugin-react-web-api";
|
|
8
|
+
import reactEffectPlugin from "eslint-plugin-react-you-might-not-need-an-effect";
|
|
9
|
+
import { rules } from "eslint-plugin-regexp";
|
|
10
|
+
import { rules as rules$1 } from "oxlint-plugin-directive-comments";
|
|
11
|
+
import tailwindcssPlugin from "oxlint-tailwindcss";
|
|
12
|
+
// src/configs/oxlint.base.ts
|
|
13
|
+
/** Sets every rule in a JS plugin to `severity`, because `categories` doesn't apply to JS plugins. */
|
|
14
|
+
const setAllPluginRules = (name, rules, severity) => Object.fromEntries(Object.keys(rules).map((rule) => [`${name}/${rule}`, severity]));
|
|
15
|
+
const { dependencies, engines } = readProjectPackageJson();
|
|
16
|
+
const tailwindStylesheet = resolveProjectTailwind();
|
|
17
|
+
const plugins = {
|
|
18
|
+
bunisms: {
|
|
19
|
+
overrides: [{
|
|
20
|
+
excludeFiles: [
|
|
21
|
+
"src/**/__tests__/**",
|
|
22
|
+
"src/**/*.test.{ts,tsx}",
|
|
23
|
+
"src/**/test-setup.ts",
|
|
24
|
+
"src/**/test-utils.ts"
|
|
25
|
+
],
|
|
26
|
+
files: engines.has("node") ? ["src/**"] : [],
|
|
27
|
+
rules: setAllPluginRules("bunisms", bunismsPlugin.rules, "off")
|
|
28
|
+
}],
|
|
29
|
+
package: "eslint-plugin-bunisms",
|
|
30
|
+
pluginRules: bunismsPlugin.rules,
|
|
31
|
+
rules: { "bunisms/prefer-mock-restore-in-after-each": "off" }
|
|
32
|
+
},
|
|
33
|
+
"clean-modules": {
|
|
34
|
+
package: "@adamhl8/eslint-plugin-clean-modules",
|
|
35
|
+
pluginRules: cleanModulesPlugin.rules
|
|
36
|
+
},
|
|
37
|
+
"directive-comments": {
|
|
38
|
+
package: "oxlint-plugin-directive-comments",
|
|
39
|
+
pluginRules: rules$1,
|
|
40
|
+
rules: {
|
|
41
|
+
"directive-comments/disable-enable-pair": ["error", { allowWholeFile: true }],
|
|
42
|
+
"directive-comments/no-use": "off"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
e18e: {
|
|
46
|
+
package: "@e18e/eslint-plugin",
|
|
47
|
+
pluginRules: e18ePlugin.rules,
|
|
48
|
+
rules: {
|
|
49
|
+
"e18e/no-indexof-equality": "off",
|
|
50
|
+
"e18e/no-spread-in-reduce": "off",
|
|
51
|
+
"e18e/prefer-array-at": "off",
|
|
52
|
+
"e18e/prefer-array-some": "off",
|
|
53
|
+
"e18e/prefer-array-to-reversed": "off",
|
|
54
|
+
"e18e/prefer-array-to-sorted": "off",
|
|
55
|
+
"e18e/prefer-date-now": "off",
|
|
56
|
+
"e18e/prefer-exponentiation-operator": "off",
|
|
57
|
+
"e18e/prefer-flatmap-over-map-flat": "off",
|
|
58
|
+
"e18e/prefer-includes": "off",
|
|
59
|
+
"e18e/prefer-nullish-coalescing": "off",
|
|
60
|
+
"e18e/prefer-object-has-own": "off",
|
|
61
|
+
"e18e/prefer-slice-over-split-index": "off",
|
|
62
|
+
"e18e/prefer-spread-syntax": "off"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
hono: {
|
|
66
|
+
enabled: dependencies.has("hono"),
|
|
67
|
+
package: "eslint-plugin-hono",
|
|
68
|
+
pluginRules: honoPlugin.rules,
|
|
69
|
+
rules: { "hono/no-process-env": "off" }
|
|
70
|
+
},
|
|
71
|
+
"react-web-api": {
|
|
72
|
+
enabled: dependencies.has("react"),
|
|
73
|
+
package: "eslint-plugin-react-web-api",
|
|
74
|
+
pluginRules: reactWebApiPlugin.rules
|
|
75
|
+
},
|
|
76
|
+
"react-you-might-not-need-an-effect": {
|
|
77
|
+
enabled: dependencies.has("react"),
|
|
78
|
+
package: "eslint-plugin-react-you-might-not-need-an-effect",
|
|
79
|
+
pluginRules: reactEffectPlugin.rules,
|
|
80
|
+
rules: {
|
|
81
|
+
"react-you-might-not-need-an-effect/no-adjust-state-on-prop-change": "off",
|
|
82
|
+
"react-you-might-not-need-an-effect/no-chain-state-updates": "off",
|
|
83
|
+
"react-you-might-not-need-an-effect/no-derived-state": "off",
|
|
84
|
+
"react-you-might-not-need-an-effect/no-initialize-state": "off",
|
|
85
|
+
"react-you-might-not-need-an-effect/no-reset-all-state-on-prop-change": "off"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
regexp: {
|
|
89
|
+
package: "eslint-plugin-regexp",
|
|
90
|
+
pluginRules: rules,
|
|
91
|
+
rules: {
|
|
92
|
+
"regexp/letter-case": ["error", {
|
|
93
|
+
hexadecimalEscape: "uppercase",
|
|
94
|
+
unicodeEscape: "uppercase"
|
|
95
|
+
}],
|
|
96
|
+
"regexp/no-control-character": "off",
|
|
97
|
+
"regexp/no-empty-character-class": "off",
|
|
98
|
+
"regexp/no-invalid-regexp": "off",
|
|
99
|
+
"regexp/no-super-linear-move": "off",
|
|
100
|
+
"regexp/no-useless-escape": "off",
|
|
101
|
+
"regexp/prefer-named-capture-group": "off",
|
|
102
|
+
"regexp/require-unicode-regexp": "off",
|
|
103
|
+
"regexp/require-unicode-sets-regexp": "off",
|
|
104
|
+
"regexp/sort-alternatives": "off"
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
tailwindcss: {
|
|
108
|
+
enabled: Boolean(tailwindStylesheet),
|
|
109
|
+
package: "oxlint-tailwindcss",
|
|
110
|
+
pluginRules: tailwindcssPlugin.rules,
|
|
111
|
+
rules: {
|
|
112
|
+
"tailwindcss/enforce-consistent-line-wrapping": "off",
|
|
113
|
+
"tailwindcss/enforce-logical": "off",
|
|
114
|
+
"tailwindcss/enforce-sort-order": "off",
|
|
115
|
+
"tailwindcss/max-class-count": "off"
|
|
116
|
+
},
|
|
117
|
+
settings: { tailwindcss: { entryPoint: tailwindStylesheet } }
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
const nativeConfig = {
|
|
5
121
|
options: {
|
|
6
122
|
reportUnusedDisableDirectives: "error",
|
|
7
123
|
typeAware: true,
|
|
@@ -30,7 +146,6 @@ const baseConfig = {
|
|
|
30
146
|
"promise",
|
|
31
147
|
"node"
|
|
32
148
|
],
|
|
33
|
-
jsPlugins: [resolvePackagePath("@adamhl8/eslint-plugin-clean-modules")],
|
|
34
149
|
overrides: [
|
|
35
150
|
{
|
|
36
151
|
files: [
|
|
@@ -60,23 +175,24 @@ const baseConfig = {
|
|
|
60
175
|
files: ["**/*.tsx"],
|
|
61
176
|
rules: { "func-style": [
|
|
62
177
|
"error",
|
|
63
|
-
"
|
|
64
|
-
{
|
|
178
|
+
"declaration",
|
|
179
|
+
{ allowArrowFunctions: true }
|
|
65
180
|
] }
|
|
66
181
|
}
|
|
67
182
|
],
|
|
68
183
|
rules: {
|
|
69
|
-
"clean-modules/require-direct-exports": "error",
|
|
70
|
-
"clean-modules/require-import-extensions": "error",
|
|
71
|
-
"clean-modules/require-subpath-imports": "error",
|
|
72
184
|
curly: ["error", "multi-or-nest"],
|
|
73
185
|
"func-style": ["error", "expression"],
|
|
186
|
+
"require-unicode-regexp": ["error", { requireFlag: "v" }],
|
|
187
|
+
"react/function-component-definition": ["error", {
|
|
188
|
+
namedComponents: "function-declaration",
|
|
189
|
+
unnamedComponents: "arrow-function"
|
|
190
|
+
}],
|
|
74
191
|
"react/jsx-curly-brace-presence": ["error", {
|
|
75
192
|
children: "never",
|
|
76
193
|
propElementValues: "always",
|
|
77
194
|
props: "never"
|
|
78
195
|
}],
|
|
79
|
-
"require-unicode-regexp": ["error", { requireFlag: "v" }],
|
|
80
196
|
"unicorn/filename-case": ["error", { cases: {
|
|
81
197
|
kebabCase: true,
|
|
82
198
|
pascalCase: true
|
|
@@ -84,16 +200,7 @@ const baseConfig = {
|
|
|
84
200
|
"unicorn/no-useless-undefined": ["error", { checkArguments: false }],
|
|
85
201
|
"capitalized-comments": "off",
|
|
86
202
|
"id-length": "off",
|
|
87
|
-
"import/exports-last": "off",
|
|
88
|
-
"import/group-exports": "off",
|
|
89
|
-
"import/max-dependencies": "off",
|
|
90
|
-
"import/no-named-export": "off",
|
|
91
|
-
"import/no-nodejs-modules": "off",
|
|
92
|
-
"import/no-unassigned-import": "off",
|
|
93
|
-
"import/prefer-default-export": "off",
|
|
94
203
|
"init-declarations": "off",
|
|
95
|
-
"jsdoc/require-param": "off",
|
|
96
|
-
"jsdoc/require-returns": "off",
|
|
97
204
|
"max-classes-per-file": "off",
|
|
98
205
|
"max-lines": "off",
|
|
99
206
|
"max-lines-per-function": "off",
|
|
@@ -104,26 +211,44 @@ const baseConfig = {
|
|
|
104
211
|
"no-inline-comments": "off",
|
|
105
212
|
"no-magic-numbers": "off",
|
|
106
213
|
"no-plusplus": "off",
|
|
214
|
+
"no-regex-spaces": "off",
|
|
107
215
|
"no-ternary": "off",
|
|
108
216
|
"no-undef": "off",
|
|
109
217
|
"no-undefined": "off",
|
|
110
218
|
"no-useless-return": "off",
|
|
111
219
|
"no-void": "off",
|
|
220
|
+
"one-var": "off",
|
|
221
|
+
"require-await": "off",
|
|
222
|
+
"sort-imports": "off",
|
|
223
|
+
"sort-keys": "off",
|
|
224
|
+
"import/exports-last": "off",
|
|
225
|
+
"import/group-exports": "off",
|
|
226
|
+
"import/max-dependencies": "off",
|
|
227
|
+
"import/no-named-export": "off",
|
|
228
|
+
"import/no-nodejs-modules": "off",
|
|
229
|
+
"import/no-unassigned-import": "off",
|
|
230
|
+
"import/prefer-default-export": "off",
|
|
231
|
+
"jsdoc/require-param": "off",
|
|
232
|
+
"jsdoc/require-returns": "off",
|
|
112
233
|
"node/callback-return": "off",
|
|
234
|
+
"node/no-process-env": "off",
|
|
113
235
|
"node/no-sync": "off",
|
|
114
236
|
"node/no-top-level-await": "off",
|
|
115
|
-
"one-var": "off",
|
|
116
237
|
"oxc/no-async-await": "off",
|
|
117
238
|
"oxc/no-optional-chaining": "off",
|
|
118
239
|
"oxc/no-rest-spread-properties": "off",
|
|
240
|
+
"react/exhaustive-effect-dependencies": "off",
|
|
119
241
|
"react/forbid-component-props": "off",
|
|
242
|
+
"react/hooks": "off",
|
|
243
|
+
"react/invariant": "off",
|
|
120
244
|
"react/jsx-filename-extension": "off",
|
|
121
245
|
"react/jsx-max-depth": "off",
|
|
122
246
|
"react/jsx-no-literals": "off",
|
|
247
|
+
"react/memo-dependencies": "off",
|
|
248
|
+
"react/no-deriving-state-in-effects": "off",
|
|
123
249
|
"react/react-in-jsx-scope": "off",
|
|
124
|
-
"
|
|
125
|
-
"
|
|
126
|
-
"sort-keys": "off",
|
|
250
|
+
"react/rule-suppression": "off",
|
|
251
|
+
"react/todo": "off",
|
|
127
252
|
"typescript/consistent-return": "off",
|
|
128
253
|
"typescript/explicit-function-return-type": "off",
|
|
129
254
|
"typescript/explicit-module-boundary-types": "off",
|
|
@@ -147,8 +272,31 @@ const baseConfig = {
|
|
|
147
272
|
"vitest/require-test-timeout": "off"
|
|
148
273
|
}
|
|
149
274
|
};
|
|
275
|
+
const enabledPluginEntries = Object.entries(plugins).filter(([, plugin]) => plugin.enabled ?? true);
|
|
276
|
+
const enabledPlugins = enabledPluginEntries.map(([, plugin]) => plugin);
|
|
277
|
+
const resolvedPluginPackages = enabledPlugins.map((plugin) => resolvePackagePath(plugin.package));
|
|
278
|
+
const pluginOverrides = enabledPlugins.flatMap((plugin) => plugin.overrides ?? []);
|
|
279
|
+
const pluginSettings = Object.fromEntries(enabledPlugins.flatMap((plugin) => Object.entries(plugin.settings ?? {})));
|
|
280
|
+
/** Lists a plugin's rules as entries */
|
|
281
|
+
const toPluginRuleEntries = ([name, { pluginRules = {}, rules }]) => {
|
|
282
|
+
const defaultRules = setAllPluginRules(name, pluginRules, "error");
|
|
283
|
+
return Object.entries({
|
|
284
|
+
...defaultRules,
|
|
285
|
+
...rules
|
|
286
|
+
});
|
|
287
|
+
};
|
|
288
|
+
const resolvedPluginRules = Object.fromEntries(enabledPluginEntries.flatMap(toPluginRuleEntries));
|
|
289
|
+
const baseConfig = {
|
|
290
|
+
...nativeConfig,
|
|
291
|
+
jsPlugins: resolvedPluginPackages,
|
|
292
|
+
overrides: [...nativeConfig.overrides, ...pluginOverrides],
|
|
293
|
+
rules: {
|
|
294
|
+
...resolvedPluginRules,
|
|
295
|
+
...nativeConfig.rules
|
|
296
|
+
},
|
|
297
|
+
settings: pluginSettings
|
|
298
|
+
};
|
|
150
299
|
const oxlintConfig = createMergeConfigFn(baseConfig);
|
|
151
|
-
//#endregion
|
|
152
300
|
export { oxlintConfig };
|
|
153
301
|
|
|
154
302
|
//# sourceMappingURL=oxlint.base.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oxlint.base.js","names":[],"sources":["../../src/configs/oxlint.base.ts"],"sourcesContent":["import type { OxlintConfig } from \"oxlint\"\n\nimport { createMergeConfigFn } from \"#merge-config/merge-config.ts\"\nimport { resolvePackagePath } from \"#utils.ts\"\n\nconst baseConfig = {\n options: {\n reportUnusedDisableDirectives: \"error\",\n typeAware: true,\n typeCheck: true,\n },\n\n categories: {\n correctness: \"error\",\n nursery: \"error\",\n pedantic: \"error\",\n perf: \"error\",\n restriction: \"error\",\n style: \"error\",\n suspicious: \"error\",\n },\n\n plugins: [\n \"eslint\",\n \"react\",\n \"unicorn\",\n \"typescript\",\n \"oxc\",\n \"import\",\n \"jsdoc\",\n \"vitest\",\n \"jsx-a11y\",\n \"react-perf\",\n \"promise\",\n \"node\",\n ],\n\n // Resolve to an absolute path so consumers load it from this package's own deps.\n jsPlugins: [resolvePackagePath(\"@adamhl8/eslint-plugin-clean-modules\")],\n\n overrides: [\n {\n files: [\n \".release-it.ts\",\n \"astro.config.ts\",\n \"commitlint.config.ts\",\n \"knip.ts\",\n \"oxfmt.config.ts\",\n \"oxlint.config.ts\",\n \"prisma.config.ts\",\n \"tsdown.config.ts\",\n ],\n rules: {\n \"import/no-default-export\": \"off\",\n },\n },\n {\n files: [\"bask.ts\"],\n rules: {\n \"clean-modules/require-direct-exports\": \"off\",\n \"import/export\": \"off\",\n },\n },\n {\n files: [\".release-it.ts\"],\n rules: {\n \"no-template-curly-in-string\": \"off\",\n },\n },\n {\n files: [\"**/*.tsx\"],\n rules: {\n \"func-style\": [\"error\", \"expression\", { overrides: { namedExports: \"ignore\" } }],\n },\n },\n ],\n\n rules: {\n \"clean-modules/require-direct-exports\": \"error\",\n \"clean-modules/require-import-extensions\": \"error\",\n \"clean-modules/require-subpath-imports\": \"error\",\n\n curly: [\"error\", \"multi-or-nest\"],\n \"func-style\": [\"error\", \"expression\"],\n \"react/jsx-curly-brace-presence\": [\"error\", { children: \"never\", propElementValues: \"always\", props: \"never\" }],\n \"require-unicode-regexp\": [\"error\", { requireFlag: \"v\" }],\n \"unicorn/filename-case\": [\n \"error\",\n {\n cases: { kebabCase: true, pascalCase: true },\n },\n ],\n \"unicorn/no-useless-undefined\": [\"error\", { checkArguments: false }],\n\n \"capitalized-comments\": \"off\",\n \"id-length\": \"off\",\n \"import/exports-last\": \"off\",\n \"import/group-exports\": \"off\",\n \"import/max-dependencies\": \"off\",\n \"import/no-named-export\": \"off\",\n \"import/no-nodejs-modules\": \"off\",\n \"import/no-unassigned-import\": \"off\",\n \"import/prefer-default-export\": \"off\",\n \"init-declarations\": \"off\",\n \"jsdoc/require-param\": \"off\",\n \"jsdoc/require-returns\": \"off\",\n \"max-classes-per-file\": \"off\",\n \"max-lines\": \"off\",\n \"max-lines-per-function\": \"off\",\n \"max-statements\": \"off\",\n \"no-console\": \"off\",\n \"no-continue\": \"off\",\n \"no-duplicate-imports\": \"off\",\n \"no-inline-comments\": \"off\",\n \"no-magic-numbers\": \"off\",\n \"no-plusplus\": \"off\",\n \"no-ternary\": \"off\",\n \"no-undef\": \"off\",\n \"no-undefined\": \"off\",\n \"no-useless-return\": \"off\",\n \"no-void\": \"off\",\n \"node/callback-return\": \"off\",\n \"node/no-sync\": \"off\",\n \"node/no-top-level-await\": \"off\",\n \"one-var\": \"off\",\n \"oxc/no-async-await\": \"off\",\n \"oxc/no-optional-chaining\": \"off\",\n \"oxc/no-rest-spread-properties\": \"off\",\n \"react/forbid-component-props\": \"off\",\n \"react/jsx-filename-extension\": \"off\",\n \"react/jsx-max-depth\": \"off\",\n \"react/jsx-no-literals\": \"off\",\n \"react/react-in-jsx-scope\": \"off\",\n \"require-await\": \"off\",\n \"sort-imports\": \"off\",\n \"sort-keys\": \"off\",\n \"typescript/consistent-return\": \"off\",\n \"typescript/explicit-function-return-type\": \"off\",\n \"typescript/explicit-module-boundary-types\": \"off\",\n \"typescript/prefer-readonly-parameter-types\": \"off\",\n \"typescript/strict-boolean-expressions\": \"off\",\n \"unicorn/no-array-callback-reference\": \"off\",\n \"unicorn/no-array-method-this-argument\": \"off\",\n \"unicorn/no-await-expression-member\": \"off\",\n \"unicorn/no-process-exit\": \"off\",\n \"unicorn/number-literal-case\": \"off\",\n \"unicorn/switch-case-braces\": \"off\",\n \"vitest/no-hooks\": \"off\",\n \"vitest/no-importing-vitest-globals\": \"off\",\n \"vitest/prefer-describe-function-title\": \"off\",\n \"vitest/prefer-expect-assertions\": \"off\",\n \"vitest/prefer-importing-vitest-globals\": \"off\",\n \"vitest/prefer-lowercase-title\": \"off\",\n \"vitest/prefer-to-be-falsy\": \"off\",\n \"vitest/prefer-to-be-truthy\": \"off\",\n \"vitest/require-hook\": \"off\", // reenable when false positives are fixed?\n \"vitest/require-test-timeout\": \"off\",\n },\n} as const satisfies OxlintConfig\n\nexport const oxlintConfig = createMergeConfigFn<OxlintConfig, typeof baseConfig>(baseConfig)\n"],"mappings":";;;AAKA,MAAM,aAAa;CACjB,SAAS;EACP,+BAA+B;EAC/B,WAAW;EACX,WAAW;CACb;CAEA,YAAY;EACV,aAAa;EACb,SAAS;EACT,UAAU;EACV,MAAM;EACN,aAAa;EACb,OAAO;EACP,YAAY;CACd;CAEA,SAAS;EACP;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CAGA,WAAW,CAAC,mBAAmB,sCAAsC,CAAC;CAEtE,WAAW;EACT;GACE,OAAO;IACL;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACF;GACA,OAAO,EACL,4BAA4B,MAC9B;EACF;EACA;GACE,OAAO,CAAC,SAAS;GACjB,OAAO;IACL,wCAAwC;IACxC,iBAAiB;GACnB;EACF;EACA;GACE,OAAO,CAAC,gBAAgB;GACxB,OAAO,EACL,+BAA+B,MACjC;EACF;EACA;GACE,OAAO,CAAC,UAAU;GAClB,OAAO,EACL,cAAc;IAAC;IAAS;IAAc,EAAE,WAAW,EAAE,cAAc,SAAS,EAAE;GAAC,EACjF;EACF;CACF;CAEA,OAAO;EACL,wCAAwC;EACxC,2CAA2C;EAC3C,yCAAyC;EAEzC,OAAO,CAAC,SAAS,eAAe;EAChC,cAAc,CAAC,SAAS,YAAY;EACpC,kCAAkC,CAAC,SAAS;GAAE,UAAU;GAAS,mBAAmB;GAAU,OAAO;EAAQ,CAAC;EAC9G,0BAA0B,CAAC,SAAS,EAAE,aAAa,IAAI,CAAC;EACxD,yBAAyB,CACvB,SACA,EACE,OAAO;GAAE,WAAW;GAAM,YAAY;EAAK,EAC7C,CACF;EACA,gCAAgC,CAAC,SAAS,EAAE,gBAAgB,MAAM,CAAC;EAEnE,wBAAwB;EACxB,aAAa;EACb,uBAAuB;EACvB,wBAAwB;EACxB,2BAA2B;EAC3B,0BAA0B;EAC1B,4BAA4B;EAC5B,+BAA+B;EAC/B,gCAAgC;EAChC,qBAAqB;EACrB,uBAAuB;EACvB,yBAAyB;EACzB,wBAAwB;EACxB,aAAa;EACb,0BAA0B;EAC1B,kBAAkB;EAClB,cAAc;EACd,eAAe;EACf,wBAAwB;EACxB,sBAAsB;EACtB,oBAAoB;EACpB,eAAe;EACf,cAAc;EACd,YAAY;EACZ,gBAAgB;EAChB,qBAAqB;EACrB,WAAW;EACX,wBAAwB;EACxB,gBAAgB;EAChB,2BAA2B;EAC3B,WAAW;EACX,sBAAsB;EACtB,4BAA4B;EAC5B,iCAAiC;EACjC,gCAAgC;EAChC,gCAAgC;EAChC,uBAAuB;EACvB,yBAAyB;EACzB,4BAA4B;EAC5B,iBAAiB;EACjB,gBAAgB;EAChB,aAAa;EACb,gCAAgC;EAChC,4CAA4C;EAC5C,6CAA6C;EAC7C,8CAA8C;EAC9C,yCAAyC;EACzC,uCAAuC;EACvC,yCAAyC;EACzC,sCAAsC;EACtC,2BAA2B;EAC3B,+BAA+B;EAC/B,8BAA8B;EAC9B,mBAAmB;EACnB,sCAAsC;EACtC,yCAAyC;EACzC,mCAAmC;EACnC,0CAA0C;EAC1C,iCAAiC;EACjC,6BAA6B;EAC7B,8BAA8B;EAC9B,uBAAuB;EACvB,+BAA+B;CACjC;AACF;AAEA,MAAa,eAAe,oBAAqD,UAAU"}
|
|
1
|
+
{"version":3,"file":"oxlint.base.js","names":["directiveCommentsPluginRules","regexpPluginRules"],"sources":["../../src/configs/oxlint.base.ts"],"sourcesContent":["import cleanModulesPlugin from \"@adamhl8/eslint-plugin-clean-modules\"\nimport e18ePlugin from \"@e18e/eslint-plugin\"\nimport bunismsPlugin from \"eslint-plugin-bunisms\"\nimport honoPlugin from \"eslint-plugin-hono\"\nimport reactWebApiPlugin from \"eslint-plugin-react-web-api\"\nimport reactEffectPlugin from \"eslint-plugin-react-you-might-not-need-an-effect\"\nimport { rules as regexpPluginRules } from \"eslint-plugin-regexp\"\nimport type { DummyRule, OxlintConfig, OxlintOverride } from \"oxlint\"\nimport { rules as directiveCommentsPluginRules } from \"oxlint-plugin-directive-comments\"\nimport tailwindcssPlugin from \"oxlint-tailwindcss\"\n\nimport { createMergeConfigFn } from \"#merge-config/merge-config.ts\"\nimport { readProjectPackageJson, resolvePackagePath, resolveProjectTailwind } from \"#utils.ts\"\n\n/** Sets every rule in a JS plugin to `severity`, because `categories` doesn't apply to JS plugins. */\nconst setAllPluginRules = (name: string, rules: Record<string, unknown>, severity: \"error\" | \"off\") =>\n Object.fromEntries(Object.keys(rules).map((rule) => [`${name}/${rule}`, severity] as const))\n\n// Type plugin rules with oxlint's generic `DummyRule` because its per-rule config types aren't exported, which breaks declaration emit.\ntype PluginRules = Record<string, DummyRule>\n\n/** A JS plugin and the slice of oxlint config that goes with it. Each one is merged into the base config. */\ninterface PluginPart extends Omit<OxlintConfig, \"jsPlugins\" | \"overrides\" | \"rules\"> {\n overrides?: (Omit<OxlintOverride, \"rules\"> & { rules?: PluginRules })[]\n rules?: PluginRules\n /** Loads the plugin only when true. Defaults to true. */\n enabled?: boolean\n package: string\n /** The plugin's rule definitions, used to set every rule to \"error\". The part's own `rules` then take precedence. */\n pluginRules: Record<string, unknown> | undefined\n}\n\nconst { dependencies, engines } = readProjectPackageJson()\nconst tailwindStylesheet = resolveProjectTailwind()\n\n// Key each part by the rule namespace its plugin registers.\nconst plugins: Record<string, PluginPart> = {\n bunisms: {\n overrides: [\n {\n excludeFiles: [\"src/**/__tests__/**\", \"src/**/*.test.{ts,tsx}\", \"src/**/test-setup.ts\", \"src/**/test-utils.ts\"],\n // Turn off Bun suggestions in Node runtime code. Tests and tooling still run on Bun.\n files: engines.has(\"node\") ? [\"src/**\"] : [],\n rules: setAllPluginRules(\"bunisms\", bunismsPlugin.rules, \"off\"),\n },\n ],\n package: \"eslint-plugin-bunisms\",\n pluginRules: bunismsPlugin.rules,\n rules: {\n \"bunisms/prefer-mock-restore-in-after-each\": \"off\", // `test-setup.ts` preloads restore mocks globally\n },\n },\n \"clean-modules\": {\n package: \"@adamhl8/eslint-plugin-clean-modules\",\n pluginRules: cleanModulesPlugin.rules,\n },\n \"directive-comments\": {\n package: \"oxlint-plugin-directive-comments\",\n pluginRules: directiveCommentsPluginRules,\n rules: {\n \"directive-comments/disable-enable-pair\": [\"error\", { allowWholeFile: true }],\n \"directive-comments/no-use\": \"off\", // bans every directive comment\n },\n },\n e18e: {\n package: \"@e18e/eslint-plugin\",\n pluginRules: e18ePlugin.rules,\n rules: {\n \"e18e/no-indexof-equality\": \"off\", // needs type information, which JS plugins don't get\n \"e18e/no-spread-in-reduce\": \"off\", // `oxc/no-accumulating-spread` covers this\n \"e18e/prefer-array-at\": \"off\", // `unicorn/prefer-at` covers this\n \"e18e/prefer-array-some\": \"off\", // `unicorn/prefer-array-some` covers this\n \"e18e/prefer-array-to-reversed\": \"off\", // `unicorn/no-array-reverse` covers this\n \"e18e/prefer-array-to-sorted\": \"off\", // `unicorn/no-array-sort` covers this\n \"e18e/prefer-date-now\": \"off\", // `unicorn/prefer-date-now` covers this\n \"e18e/prefer-exponentiation-operator\": \"off\", // `prefer-exponentiation-operator` covers this\n \"e18e/prefer-flatmap-over-map-flat\": \"off\", // `unicorn/prefer-array-flat-map` covers this\n \"e18e/prefer-includes\": \"off\", // `unicorn/prefer-includes` covers this\n \"e18e/prefer-nullish-coalescing\": \"off\", // `typescript/prefer-nullish-coalescing` covers this\n \"e18e/prefer-object-has-own\": \"off\", // `prefer-object-has-own` covers this\n \"e18e/prefer-slice-over-split-index\": \"off\",\n \"e18e/prefer-spread-syntax\": \"off\", // `unicorn/prefer-spread` and `prefer-object-spread` cover this\n },\n },\n hono: {\n enabled: dependencies.has(\"hono\"),\n package: \"eslint-plugin-hono\",\n pluginRules: honoPlugin.rules,\n rules: {\n \"hono/no-process-env\": \"off\", // tools and tests legitimately read the raw environment\n },\n },\n \"react-web-api\": {\n enabled: dependencies.has(\"react\"),\n package: \"eslint-plugin-react-web-api\",\n pluginRules: reactWebApiPlugin.rules,\n },\n \"react-you-might-not-need-an-effect\": {\n enabled: dependencies.has(\"react\"),\n package: \"eslint-plugin-react-you-might-not-need-an-effect\",\n pluginRules: reactEffectPlugin.rules,\n rules: {\n \"react-you-might-not-need-an-effect/no-adjust-state-on-prop-change\": \"off\", // `react/set-state-in-effect` covers this\n \"react-you-might-not-need-an-effect/no-chain-state-updates\": \"off\", // `react/set-state-in-effect` covers this\n \"react-you-might-not-need-an-effect/no-derived-state\": \"off\", // `react/set-state-in-effect` covers this\n \"react-you-might-not-need-an-effect/no-initialize-state\": \"off\", // `react/set-state-in-effect` covers this\n \"react-you-might-not-need-an-effect/no-reset-all-state-on-prop-change\": \"off\", // `react/set-state-in-effect` covers this\n },\n },\n regexp: {\n package: \"eslint-plugin-regexp\",\n pluginRules: regexpPluginRules,\n rules: {\n \"regexp/letter-case\": [\"error\", { hexadecimalEscape: \"uppercase\", unicodeEscape: \"uppercase\" }], // match `unicorn/escape-case`\n \"regexp/no-control-character\": \"off\", // `no-control-regex` covers this\n \"regexp/no-empty-character-class\": \"off\", // `no-empty-character-class` covers this\n \"regexp/no-invalid-regexp\": \"off\", // `no-invalid-regexp` covers this\n \"regexp/no-super-linear-move\": \"off\",\n \"regexp/no-useless-escape\": \"off\", // `no-useless-escape` covers this\n \"regexp/prefer-named-capture-group\": \"off\", // `prefer-named-capture-group` covers this\n \"regexp/require-unicode-regexp\": \"off\", // `require-unicode-regexp` covers this\n \"regexp/require-unicode-sets-regexp\": \"off\", // `require-unicode-regexp` covers this\n \"regexp/sort-alternatives\": \"off\",\n },\n },\n tailwindcss: {\n // Load the Tailwind plugin only with a stylesheet because it reports every class string without one.\n enabled: Boolean(tailwindStylesheet),\n package: \"oxlint-tailwindcss\",\n pluginRules: tailwindcssPlugin.rules,\n rules: {\n \"tailwindcss/enforce-consistent-line-wrapping\": \"off\", // oxfmt handles line width\n \"tailwindcss/enforce-logical\": \"off\", // conflicts with `tailwindcss/enforce-physical`\n \"tailwindcss/enforce-sort-order\": \"off\", // oxfmt sorts classes\n \"tailwindcss/max-class-count\": \"off\",\n },\n // Keep `entryPoint` relative because the plugin resolves it against the directory of the project's oxlint config.\n settings: { tailwindcss: { entryPoint: tailwindStylesheet } },\n },\n}\n\nconst nativeConfig = {\n options: {\n reportUnusedDisableDirectives: \"error\",\n typeAware: true,\n typeCheck: true,\n },\n\n categories: {\n correctness: \"error\",\n nursery: \"error\",\n pedantic: \"error\",\n perf: \"error\",\n restriction: \"error\",\n style: \"error\",\n suspicious: \"error\",\n },\n\n plugins: [\n \"eslint\",\n \"react\",\n \"unicorn\",\n \"typescript\",\n \"oxc\",\n \"import\",\n \"jsdoc\",\n \"vitest\",\n \"jsx-a11y\",\n \"react-perf\",\n \"promise\",\n \"node\",\n ],\n\n overrides: [\n {\n files: [\n \".release-it.ts\",\n \"astro.config.ts\",\n \"commitlint.config.ts\",\n \"knip.ts\",\n \"oxfmt.config.ts\",\n \"oxlint.config.ts\",\n \"prisma.config.ts\",\n \"tsdown.config.ts\",\n ],\n rules: {\n \"import/no-default-export\": \"off\",\n },\n },\n {\n files: [\"bask.ts\"],\n rules: {\n \"clean-modules/require-direct-exports\": \"off\",\n \"import/export\": \"off\",\n },\n },\n {\n files: [\".release-it.ts\"],\n rules: {\n \"no-template-curly-in-string\": \"off\",\n },\n },\n {\n files: [\"**/*.tsx\"],\n rules: {\n \"func-style\": [\"error\", \"declaration\", { allowArrowFunctions: true }],\n },\n },\n ],\n\n rules: {\n /* Modified rules */\n\n curly: [\"error\", \"multi-or-nest\"],\n \"func-style\": [\"error\", \"expression\"],\n \"require-unicode-regexp\": [\"error\", { requireFlag: \"v\" }],\n\n \"react/function-component-definition\": [\n \"error\",\n { namedComponents: \"function-declaration\", unnamedComponents: \"arrow-function\" },\n ],\n \"react/jsx-curly-brace-presence\": [\"error\", { children: \"never\", propElementValues: \"always\", props: \"never\" }],\n\n \"unicorn/filename-case\": [\n \"error\",\n {\n cases: { kebabCase: true, pascalCase: true },\n },\n ],\n \"unicorn/no-useless-undefined\": [\"error\", { checkArguments: false }],\n\n /* Disabled rules */\n\n \"capitalized-comments\": \"off\",\n \"id-length\": \"off\",\n \"init-declarations\": \"off\",\n \"max-classes-per-file\": \"off\",\n \"max-lines\": \"off\",\n \"max-lines-per-function\": \"off\",\n \"max-statements\": \"off\",\n \"no-console\": \"off\",\n \"no-continue\": \"off\",\n \"no-duplicate-imports\": \"off\",\n \"no-inline-comments\": \"off\",\n \"no-magic-numbers\": \"off\",\n \"no-plusplus\": \"off\",\n \"no-regex-spaces\": \"off\", // `regexp/prefer-quantifier` covers this\n \"no-ternary\": \"off\",\n \"no-undef\": \"off\",\n \"no-undefined\": \"off\",\n \"no-useless-return\": \"off\",\n \"no-void\": \"off\",\n \"one-var\": \"off\",\n \"require-await\": \"off\",\n \"sort-imports\": \"off\",\n \"sort-keys\": \"off\",\n\n \"import/exports-last\": \"off\",\n \"import/group-exports\": \"off\",\n \"import/max-dependencies\": \"off\",\n \"import/no-named-export\": \"off\",\n \"import/no-nodejs-modules\": \"off\",\n \"import/no-unassigned-import\": \"off\",\n \"import/prefer-default-export\": \"off\",\n\n \"jsdoc/require-param\": \"off\",\n \"jsdoc/require-returns\": \"off\",\n\n \"node/callback-return\": \"off\",\n \"node/no-process-env\": \"off\", // tools and tests legitimately read the raw environment\n \"node/no-sync\": \"off\",\n \"node/no-top-level-await\": \"off\",\n\n \"oxc/no-async-await\": \"off\",\n \"oxc/no-optional-chaining\": \"off\",\n \"oxc/no-rest-spread-properties\": \"off\",\n\n \"react/exhaustive-effect-dependencies\": \"off\", // `react/exhaustive-deps` covers this\n \"react/forbid-component-props\": \"off\",\n \"react/hooks\": \"off\", // `react/rules-of-hooks` covers this\n \"react/invariant\": \"off\",\n \"react/jsx-filename-extension\": \"off\",\n \"react/jsx-max-depth\": \"off\",\n \"react/jsx-no-literals\": \"off\",\n \"react/memo-dependencies\": \"off\", // `react/exhaustive-deps` covers this\n \"react/no-deriving-state-in-effects\": \"off\", // `react/set-state-in-effect` covers this\n \"react/react-in-jsx-scope\": \"off\",\n \"react/rule-suppression\": \"off\",\n \"react/todo\": \"off\",\n\n \"typescript/consistent-return\": \"off\",\n \"typescript/explicit-function-return-type\": \"off\",\n \"typescript/explicit-module-boundary-types\": \"off\",\n \"typescript/prefer-readonly-parameter-types\": \"off\",\n \"typescript/strict-boolean-expressions\": \"off\",\n\n \"unicorn/no-array-callback-reference\": \"off\",\n \"unicorn/no-array-method-this-argument\": \"off\",\n \"unicorn/no-await-expression-member\": \"off\",\n \"unicorn/no-process-exit\": \"off\",\n \"unicorn/number-literal-case\": \"off\",\n \"unicorn/switch-case-braces\": \"off\",\n\n \"vitest/no-hooks\": \"off\",\n \"vitest/no-importing-vitest-globals\": \"off\",\n \"vitest/prefer-describe-function-title\": \"off\",\n \"vitest/prefer-expect-assertions\": \"off\",\n \"vitest/prefer-importing-vitest-globals\": \"off\",\n \"vitest/prefer-lowercase-title\": \"off\",\n \"vitest/prefer-to-be-falsy\": \"off\",\n \"vitest/prefer-to-be-truthy\": \"off\",\n \"vitest/require-hook\": \"off\", // reenable when false positives are fixed?\n \"vitest/require-test-timeout\": \"off\",\n },\n} as const satisfies OxlintConfig\n\nconst enabledPluginEntries = Object.entries(plugins).filter(([, plugin]) => plugin.enabled ?? true)\nconst enabledPlugins = enabledPluginEntries.map(([, plugin]) => plugin)\n// Resolve JS plugins to absolute paths so consumers load them from this package's own deps.\nconst resolvedPluginPackages = enabledPlugins.map((plugin) => resolvePackagePath(plugin.package))\nconst pluginOverrides = enabledPlugins.flatMap((plugin) => plugin.overrides ?? [])\nconst pluginSettings = Object.fromEntries(enabledPlugins.flatMap((plugin) => Object.entries(plugin.settings ?? {})))\n\n/** Lists a plugin's rules as entries */\nconst toPluginRuleEntries = ([name, { pluginRules = {}, rules }]: [string, PluginPart]) => {\n const defaultRules = setAllPluginRules(name, pluginRules, \"error\")\n const pluginRuleEntries = Object.entries({ ...defaultRules, ...rules })\n return pluginRuleEntries\n}\n\nconst resolvedPluginRules = Object.fromEntries(enabledPluginEntries.flatMap(toPluginRuleEntries))\n\nconst baseConfig = {\n ...nativeConfig,\n jsPlugins: resolvedPluginPackages,\n overrides: [...nativeConfig.overrides, ...pluginOverrides],\n rules: {\n ...resolvedPluginRules,\n ...nativeConfig.rules,\n },\n settings: pluginSettings,\n} satisfies OxlintConfig\n\nexport const oxlintConfig = createMergeConfigFn<OxlintConfig, typeof baseConfig>(baseConfig)\n"],"mappings":"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"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { OptionalMergeConfigFn } from "../merge-config/merge-config.js";
|
|
2
2
|
import { Config } from "release-it";
|
|
3
|
-
//#region src/configs/release-it.base.d.ts
|
|
4
3
|
type PluginHooks = Partial<Record<`${"before" | "after"}:${string}`, string | string[]>>;
|
|
5
4
|
type ReleaseItConfig = Config & {
|
|
6
5
|
hooks?: PluginHooks;
|
|
@@ -32,6 +31,5 @@ export declare const releaseItConfig: OptionalMergeConfigFn<ReleaseItConfig, {
|
|
|
32
31
|
readonly publishArgs: ["--ignore-scripts"];
|
|
33
32
|
};
|
|
34
33
|
}>;
|
|
35
|
-
//#endregion
|
|
36
34
|
export {};
|
|
37
35
|
//# sourceMappingURL=release-it.base.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"release-it.base.d.ts","names":["_$_merge_config_merge_config_ts0.OptionalMergeConfigFn"],"sources":["../../src/configs/release-it.base.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"release-it.base.d.ts","names":["_$_merge_config_merge_config_ts0.OptionalMergeConfigFn"],"sources":["../../src/configs/release-it.base.ts"],"mappings":";;KAOK,cAAc,QAAQ;KACtB,kBAAkB;EAAW,QAAQ;;qBA+B7B,iBAAeA,sBAAA;;aA3BxB;aACA;;;aAGA;eACE;eACA;;;;aAIF;aAEA;aACA;aACA;;;aAGA;aACA;;;aAGA;aACA;aACA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createMergeConfigFn } from "../merge-config/merge-config.js";
|
|
2
2
|
import { configFilePath } from "../utils.js";
|
|
3
|
-
|
|
3
|
+
// src/configs/release-it.base.ts
|
|
4
4
|
const baseConfig = {
|
|
5
5
|
hooks: {
|
|
6
6
|
"before:init": "bunx bask build",
|
|
@@ -27,7 +27,6 @@ const baseConfig = {
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
const releaseItConfig = createMergeConfigFn(baseConfig);
|
|
30
|
-
//#endregion
|
|
31
30
|
export { releaseItConfig };
|
|
32
31
|
|
|
33
32
|
//# sourceMappingURL=release-it.base.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"release-it.base.js","names":[],"sources":["../../src/configs/release-it.base.ts"],"sourcesContent":["// oxlint-disable no-template-curly-in-string\nimport type { Config } from \"release-it\"\n\nimport { createMergeConfigFn } from \"#merge-config/merge-config.ts\"\nimport { configFilePath } from \"#utils.ts\"\n\n// release-it's `Hooks` type only lists the hooks of its built-in plugins.\ntype PluginHooks = Partial<Record<`${\"before\" | \"after\"}:${string}`, string | string[]>>\ntype ReleaseItConfig = Config & { hooks?: PluginHooks }\n\nconst baseConfig = {\n hooks: {\n \"before:init\": \"bunx bask build\",\n \"after:release-it-git-cliff:beforeRelease\": \"bun oxfmt CHANGELOG.md\",\n },\n plugins: {\n \"release-it-git-cliff\": {\n config: configFilePath(\"cliff.base.toml\"),\n output: \"CHANGELOG.md\",\n },\n },\n git: {\n commitMessage: \"release: ${tagName}\",\n // Set the `v` explicitly because release-it only detects it from an existing tag.\n tagName: \"v${version}\",\n tagAnnotation: \"release ${tagName}\",\n addUntrackedFiles: true,\n },\n github: {\n release: true,\n releaseName: \"${tagName}\",\n },\n npm: {\n publishPackageManager: \"bun\",\n publishPath: \"\",\n publishArgs: [\"--ignore-scripts\"],\n },\n} as const satisfies ReleaseItConfig\n\nexport const releaseItConfig = createMergeConfigFn<ReleaseItConfig, typeof baseConfig>(baseConfig)\n"],"mappings":";;;AAUA,MAAM,aAAa;CACjB,OAAO;EACL,eAAe;EACf,4CAA4C;CAC9C;CACA,SAAS,EACP,wBAAwB;EACtB,QAAQ,eAAe,iBAAiB;EACxC,QAAQ;CACV,EACF;CACA,KAAK;EACH,eAAe;EAEf,SAAS;EACT,eAAe;EACf,mBAAmB;CACrB;CACA,QAAQ;EACN,SAAS;EACT,aAAa;CACf;CACA,KAAK;EACH,uBAAuB;EACvB,aAAa;EACb,aAAa,CAAC,kBAAkB;CAClC;AACF;AAEA,MAAa,kBAAkB,oBAAwD,UAAU"}
|
|
1
|
+
{"version":3,"file":"release-it.base.js","names":[],"sources":["../../src/configs/release-it.base.ts"],"sourcesContent":["// oxlint-disable no-template-curly-in-string - These aren't real string templates, they are templates replaced by release-it\nimport type { Config } from \"release-it\"\n\nimport { createMergeConfigFn } from \"#merge-config/merge-config.ts\"\nimport { configFilePath } from \"#utils.ts\"\n\n// release-it's `Hooks` type only lists the hooks of its built-in plugins.\ntype PluginHooks = Partial<Record<`${\"before\" | \"after\"}:${string}`, string | string[]>>\ntype ReleaseItConfig = Config & { hooks?: PluginHooks }\n\nconst baseConfig = {\n hooks: {\n \"before:init\": \"bunx bask build\",\n \"after:release-it-git-cliff:beforeRelease\": \"bun oxfmt CHANGELOG.md\",\n },\n plugins: {\n \"release-it-git-cliff\": {\n config: configFilePath(\"cliff.base.toml\"),\n output: \"CHANGELOG.md\",\n },\n },\n git: {\n commitMessage: \"release: ${tagName}\",\n // Set the `v` explicitly because release-it only detects it from an existing tag.\n tagName: \"v${version}\",\n tagAnnotation: \"release ${tagName}\",\n addUntrackedFiles: true,\n },\n github: {\n release: true,\n releaseName: \"${tagName}\",\n },\n npm: {\n publishPackageManager: \"bun\",\n publishPath: \"\",\n publishArgs: [\"--ignore-scripts\"],\n },\n} as const satisfies ReleaseItConfig\n\nexport const releaseItConfig = createMergeConfigFn<ReleaseItConfig, typeof baseConfig>(baseConfig)\n"],"mappings":";;;AAUA,MAAM,aAAa;CACjB,OAAO;EACL,eAAe;EACf,4CAA4C;CAC9C;CACA,SAAS,EACP,wBAAwB;EACtB,QAAQ,eAAe,iBAAiB;EACxC,QAAQ;CACV,EACF;CACA,KAAK;EACH,eAAe;EAEf,SAAS;EACT,eAAe;EACf,mBAAmB;CACrB;CACA,QAAQ;EACN,SAAS;EACT,aAAa;CACf;CACA,KAAK;EACH,uBAAuB;EACvB,aAAa;EACb,aAAa,CAAC,kBAAkB;CAClC;AACF;AAEA,MAAa,kBAAkB,oBAAwD,UAAU"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { MergeConfigFn } from "../merge-config/merge-config.js";
|
|
2
2
|
import { SetRequired } from "type-fest";
|
|
3
3
|
import { UserConfig } from "tsdown";
|
|
4
|
-
//#region src/configs/tsdown.base.d.ts
|
|
5
4
|
type StrictConfig = SetRequired<UserConfig, "platform">;
|
|
6
5
|
declare const baseConfig: {
|
|
7
6
|
readonly entry: ["./src/index.ts"];
|
|
@@ -14,8 +13,6 @@ declare const baseConfig: {
|
|
|
14
13
|
readonly hash: false;
|
|
15
14
|
readonly dts: {
|
|
16
15
|
readonly generator: "tsgo";
|
|
17
|
-
readonly newContext: true;
|
|
18
|
-
readonly sourcemap: true;
|
|
19
16
|
};
|
|
20
17
|
readonly deps: {
|
|
21
18
|
readonly neverBundle: ["bun"];
|
|
@@ -26,7 +23,7 @@ declare const baseConfig: {
|
|
|
26
23
|
};
|
|
27
24
|
readonly publint: true;
|
|
28
25
|
readonly failOnWarn: true;
|
|
29
|
-
readonly suppressWarnings: ["
|
|
26
|
+
readonly suppressWarnings: ["TypeScript Go is experimental"];
|
|
30
27
|
};
|
|
31
28
|
type StrictBundleConfig = SetRequired<UserConfig, "platform" | "entry">;
|
|
32
29
|
declare const bundleConfig: {
|
|
@@ -39,7 +36,7 @@ declare const bundleConfig: {
|
|
|
39
36
|
readonly neverBundle: ["bun"];
|
|
40
37
|
};
|
|
41
38
|
readonly failOnWarn: true;
|
|
42
|
-
readonly suppressWarnings: ["
|
|
39
|
+
readonly suppressWarnings: ["TypeScript Go is experimental"];
|
|
43
40
|
readonly entry: [];
|
|
44
41
|
readonly unbundle: false;
|
|
45
42
|
readonly sourcemap: false;
|
|
@@ -62,7 +59,7 @@ declare const binConfig: {
|
|
|
62
59
|
readonly neverBundle: ["bun"];
|
|
63
60
|
};
|
|
64
61
|
readonly failOnWarn: true;
|
|
65
|
-
readonly suppressWarnings: ["
|
|
62
|
+
readonly suppressWarnings: ["TypeScript Go is experimental"];
|
|
66
63
|
readonly entry: [];
|
|
67
64
|
readonly unbundle: false;
|
|
68
65
|
readonly sourcemap: false;
|
|
@@ -82,6 +79,5 @@ declare const binConfig: {
|
|
|
82
79
|
export declare const tsdownConfig: MergeConfigFn<StrictConfig, typeof baseConfig>;
|
|
83
80
|
export declare const tsdownBundleConfig: MergeConfigFn<StrictBundleConfig, typeof bundleConfig>;
|
|
84
81
|
export declare const tsdownBinConfig: MergeConfigFn<StrictBinConfig, typeof binConfig>;
|
|
85
|
-
//#endregion
|
|
86
82
|
export {};
|
|
87
83
|
//# sourceMappingURL=tsdown.base.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsdown.base.d.ts","names":[],"sources":["../../src/configs/tsdown.base.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"tsdown.base.d.ts","names":[],"sources":["../../src/configs/tsdown.base.ts"],"mappings":";;;KAOK,eAAe,YAAY;cAE1B;;WAEM;;;;WAIF;;;;aAIN;;;aAGA;;;aAGA;aACA;;;;;;KAQC,qBAAqB,YAAY;cAGhC;WA1BM;;WAIF;;;;aAON;;;;;;;;;;;aAwBA;eACE;;;;KAMD,kBAAkB,YAAY;cAG7B;;WAzCI;;;;aAON;;;;;;;;;;;aAwBA;eACE;;;WAWM;;aACkB;;;qBAKjB,cAAc,cAAc,qBAAqB;qBAKjD,oBAAoB,cAAc,2BAA2B;qBAK7D,iBAAiB,cAAc,wBAAwB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createMergeConfigFn } from "../merge-config/merge-config.js";
|
|
2
|
-
|
|
2
|
+
// src/configs/tsdown.base.ts
|
|
3
3
|
const baseConfig = {
|
|
4
4
|
entry: ["./src/index.ts"],
|
|
5
5
|
platform: "neutral",
|
|
@@ -9,11 +9,7 @@ const baseConfig = {
|
|
|
9
9
|
minify: "dce-only",
|
|
10
10
|
fixedExtension: false,
|
|
11
11
|
hash: false,
|
|
12
|
-
dts: {
|
|
13
|
-
generator: "tsgo",
|
|
14
|
-
newContext: true,
|
|
15
|
-
sourcemap: true
|
|
16
|
-
},
|
|
12
|
+
dts: { generator: "tsgo" },
|
|
17
13
|
deps: { neverBundle: ["bun"] },
|
|
18
14
|
attw: {
|
|
19
15
|
level: "error",
|
|
@@ -21,7 +17,7 @@ const baseConfig = {
|
|
|
21
17
|
},
|
|
22
18
|
publint: true,
|
|
23
19
|
failOnWarn: true,
|
|
24
|
-
suppressWarnings: ["
|
|
20
|
+
suppressWarnings: ["TypeScript Go is experimental"]
|
|
25
21
|
};
|
|
26
22
|
const bundleConfig = {
|
|
27
23
|
...baseConfig,
|
|
@@ -41,7 +37,6 @@ const binConfig = {
|
|
|
41
37
|
const tsdownConfig = createMergeConfigFn(baseConfig);
|
|
42
38
|
const tsdownBundleConfig = createMergeConfigFn(bundleConfig);
|
|
43
39
|
const tsdownBinConfig = createMergeConfigFn(binConfig);
|
|
44
|
-
//#endregion
|
|
45
40
|
export { tsdownBinConfig, tsdownBundleConfig, tsdownConfig };
|
|
46
41
|
|
|
47
42
|
//# sourceMappingURL=tsdown.base.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsdown.base.js","names":[],"sources":["../../src/configs/tsdown.base.ts"],"sourcesContent":["import type { UserConfig } from \"tsdown\"\nimport type { SetRequired } from \"type-fest\"\n\nimport type { MergeConfigFn } from \"#merge-config/merge-config.ts\"\nimport { createMergeConfigFn } from \"#merge-config/merge-config.ts\"\n\n// Force projects to specify platform\ntype StrictConfig = SetRequired<UserConfig, \"platform\">\n\nconst baseConfig = {\n entry: [\"./src/index.ts\"],\n platform: \"neutral\",\n target: false,\n unbundle: true,\n sourcemap: true,\n minify: \"dce-only\",\n fixedExtension: false,\n hash: false,\n dts: {\n generator: \"tsgo\",\n
|
|
1
|
+
{"version":3,"file":"tsdown.base.js","names":[],"sources":["../../src/configs/tsdown.base.ts"],"sourcesContent":["import type { UserConfig } from \"tsdown\"\nimport type { SetRequired } from \"type-fest\"\n\nimport type { MergeConfigFn } from \"#merge-config/merge-config.ts\"\nimport { createMergeConfigFn } from \"#merge-config/merge-config.ts\"\n\n// Force projects to specify platform\ntype StrictConfig = SetRequired<UserConfig, \"platform\">\n\nconst baseConfig = {\n entry: [\"./src/index.ts\"],\n platform: \"neutral\",\n target: false,\n unbundle: true,\n sourcemap: true,\n minify: \"dce-only\",\n fixedExtension: false,\n hash: false,\n dts: {\n generator: \"tsgo\",\n },\n deps: {\n neverBundle: [\"bun\"],\n },\n attw: {\n level: \"error\",\n profile: \"esm-only\",\n },\n publint: true,\n failOnWarn: true,\n suppressWarnings: [\"TypeScript Go is experimental\"],\n} as const satisfies StrictConfig\n\n// Force projects to specify platform and entry\ntype StrictBundleConfig = SetRequired<UserConfig, \"platform\" | \"entry\">\n\n// Single-file bundle (not a published library): bundle everything, drop types/lint/sourcemap.\nconst bundleConfig = {\n ...baseConfig,\n entry: [],\n unbundle: false,\n sourcemap: false,\n dts: false,\n attw: false,\n publint: false,\n inputOptions: {\n experimental: {\n attachDebugInfo: \"none\", // remove region comments from bundled output\n },\n },\n} as const satisfies StrictBundleConfig\n\n// Force projects to specify platform and entry\ntype StrictBinConfig = SetRequired<UserConfig, \"entry\">\n\n// A bin is a node bundle with no output file extension.\nconst binConfig = {\n ...bundleConfig,\n platform: \"node\",\n outExtensions: () => ({ js: \"\" }) as const,\n} as const satisfies StrictBinConfig\n\n// The export annotations forbid the no-arg call (platform/entry must be provided) and are load-bearing for\n// declaration emit: without one, tsgo synthesizes the type and fails with TS2883 on tsdown's non-exported internals.\nexport const tsdownConfig: MergeConfigFn<StrictConfig, typeof baseConfig> = createMergeConfigFn<\n StrictConfig,\n typeof baseConfig\n>(baseConfig)\n\nexport const tsdownBundleConfig: MergeConfigFn<StrictBundleConfig, typeof bundleConfig> = createMergeConfigFn<\n StrictBundleConfig,\n typeof bundleConfig\n>(bundleConfig)\n\nexport const tsdownBinConfig: MergeConfigFn<StrictBinConfig, typeof binConfig> = createMergeConfigFn<\n StrictBinConfig,\n typeof binConfig\n>(binConfig)\n"],"mappings":";;AASA,MAAM,aAAa;CACjB,OAAO,CAAC,gBAAgB;CACxB,UAAU;CACV,QAAQ;CACR,UAAU;CACV,WAAW;CACX,QAAQ;CACR,gBAAgB;CAChB,MAAM;CACN,KAAK,EACH,WAAW,OACb;CACA,MAAM,EACJ,aAAa,CAAC,KAAK,EACrB;CACA,MAAM;EACJ,OAAO;EACP,SAAS;CACX;CACA,SAAS;CACT,YAAY;CACZ,kBAAkB,CAAC,+BAA+B;AACpD;AAMA,MAAM,eAAe;CACnB,GAAG;CACH,OAAO,CAAC;CACR,UAAU;CACV,WAAW;CACX,KAAK;CACL,MAAM;CACN,SAAS;CACT,cAAc,EACZ,cAAc,EACZ,iBAAiB,OACnB,EACF;AACF;AAMA,MAAM,YAAY;CAChB,GAAG;CACH,UAAU;CACV,sBAAsB,EAAE,IAAI,GAAG;AACjC;AAIA,MAAa,eAA+D,oBAG1E,UAAU;AAEZ,MAAa,qBAA6E,oBAGxF,YAAY;AAEd,MAAa,kBAAoE,oBAG/E,SAAS"}
|
package/dist/env/index.d.ts
CHANGED
package/dist/env/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/env/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/env/index.ts"],"mappings":";;KAKK,gBAAgB;qBAER,UAOP"}
|
package/dist/env/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { requireWhen } from "./utils.js";
|
|
|
2
2
|
import process from "node:process";
|
|
3
3
|
import arkenv from "arkenv";
|
|
4
4
|
import { attempt, isErr } from "ts-explicit-errors";
|
|
5
|
-
|
|
5
|
+
// src/env/index.ts
|
|
6
6
|
const parseEnv = ((...args) => {
|
|
7
7
|
const env = attempt(() => arkenv(...args));
|
|
8
8
|
if (isErr(env)) {
|
|
@@ -11,7 +11,6 @@ const parseEnv = ((...args) => {
|
|
|
11
11
|
}
|
|
12
12
|
return env;
|
|
13
13
|
});
|
|
14
|
-
//#endregion
|
|
15
14
|
export { parseEnv, requireWhen };
|
|
16
15
|
|
|
17
16
|
//# sourceMappingURL=index.js.map
|
package/dist/env/utils.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type } from "arktype";
|
|
2
|
-
//#region src/env/utils.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Makes an env var required while `when` is true, otherwise optional.
|
|
5
4
|
*
|
|
@@ -8,5 +7,4 @@ import { type } from "arktype";
|
|
|
8
7
|
*/
|
|
9
8
|
export declare function requireWhen<const def>(when: boolean, type: type.validate<def>): ReturnType<type.instantiate<def>["optional"]>;
|
|
10
9
|
export declare function requireWhen<const def>(when: boolean, type: type.validate<def>, fallback: type.infer<def>): type.instantiate<def>;
|
|
11
|
-
//#endregion
|
|
12
10
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/env/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","names":["arktype"],"sources":["../../src/env/utils.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","names":["arktype"],"sources":["../../src/env/utils.ts"],"mappings":";;;;;;;wBASgB,kBAAkB,KAChC,eACA,MAAMA,KAAQ,SAAS,OACtB,WAAWA,KAAQ,YAAY;wBAClB,kBAAkB,KAChC,eACA,MAAMA,KAAQ,SAAS,MACvB,UAAUA,KAAQ,MAAM,OACvBA,KAAQ,YAAY"}
|
package/dist/env/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type } from "arkenv";
|
|
2
|
-
|
|
2
|
+
// src/env/utils.ts
|
|
3
3
|
function requireWhen(when, type$1, ...rest) {
|
|
4
4
|
const t = type.raw(type$1);
|
|
5
5
|
if (when) return t;
|
|
@@ -8,7 +8,6 @@ function requireWhen(when, type$1, ...rest) {
|
|
|
8
8
|
const unset = Symbol("unset");
|
|
9
9
|
return t.or(type.unit(unset)).pipe((v) => v === unset ? fallback : v).default(unset);
|
|
10
10
|
}
|
|
11
|
-
//#endregion
|
|
12
11
|
export { requireWhen };
|
|
13
12
|
|
|
14
13
|
//# sourceMappingURL=utils.js.map
|
package/dist/env/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["arkenvType","type"],"sources":["../../src/env/utils.ts"],"sourcesContent":["import { type as arkenvType } from \"arkenv\"\nimport type { type as arktype } from \"arktype\"\n\n/**\n * Makes an env var required while `when` is true, otherwise optional.\n *\n * A set value must always satisfy `def`. An unset var takes `fallback` (exempt from `def` validation), or the key is\n * omitted entirely if no fallback is given.\n */\nexport function requireWhen<const def>(\n when: boolean,\n type: arktype.validate<def>,\n): ReturnType<arktype.instantiate<def>[\"optional\"]>\nexport function requireWhen<const def>(\n when: boolean,\n type: arktype.validate<def>,\n fallback: arktype.infer<def>,\n): arktype.instantiate<def>\n/* oxlint-disable typescript/no-unsafe-type-assertion */\nexport function requireWhen(when: boolean, type: unknown, ...rest: [unknown?]): never {\n const t = arkenvType.raw(type)\n if (when) return t as never\n if (rest.length === 0) return t.optional() as never\n const [fallback] = rest\n // defaulting to a sentinel keeps the fallback exempt from def validation without\n // letting an explicitly set value bypass it (env values can never be a symbol)\n const unset = Symbol(\"unset\")\n return t\n .or(arkenvType.unit(unset))\n .pipe((v: unknown) => (v === unset ? fallback : v))\n .default(unset as never) as never\n}\n"],"mappings":";;AAmBA,SAAgB,YAAY,MAAe,QAAe,GAAG,MAAyB;CACpF,MAAM,IAAIA,KAAW,IAAIC,MAAI;CAC7B,IAAI,MAAM,OAAO;CACjB,IAAI,KAAK,WAAW,GAAG,OAAO,EAAE,SAAS;CACzC,MAAM,CAAC,YAAY;CAGnB,MAAM,QAAQ,OAAO,OAAO;CAC5B,OAAO,EACJ,GAAGD,KAAW,KAAK,KAAK,CAAC,CAAC,CAC1B,MAAM,MAAgB,MAAM,QAAQ,WAAW,CAAE,CAAC,CAClD,QAAQ,KAAc;AAC3B"}
|
|
1
|
+
{"version":3,"file":"utils.js","names":["arkenvType","type"],"sources":["../../src/env/utils.ts"],"sourcesContent":["import { type as arkenvType } from \"arkenv\"\nimport type { type as arktype } from \"arktype\"\n\n/**\n * Makes an env var required while `when` is true, otherwise optional.\n *\n * A set value must always satisfy `def`. An unset var takes `fallback` (exempt from `def` validation), or the key is\n * omitted entirely if no fallback is given.\n */\nexport function requireWhen<const def>(\n when: boolean,\n type: arktype.validate<def>,\n): ReturnType<arktype.instantiate<def>[\"optional\"]>\nexport function requireWhen<const def>(\n when: boolean,\n type: arktype.validate<def>,\n fallback: arktype.infer<def>,\n): arktype.instantiate<def>\n/* oxlint-disable typescript/no-unsafe-type-assertion - cast to the types the overload signatures declare */\nexport function requireWhen(when: boolean, type: unknown, ...rest: [unknown?]): never {\n const t = arkenvType.raw(type)\n if (when) return t as never\n if (rest.length === 0) return t.optional() as never\n const [fallback] = rest\n // defaulting to a sentinel keeps the fallback exempt from def validation without\n // letting an explicitly set value bypass it (env values can never be a symbol)\n const unset = Symbol(\"unset\")\n return t\n .or(arkenvType.unit(unset))\n .pipe((v: unknown) => (v === unset ? fallback : v))\n .default(unset as never) as never\n}\n/* oxlint-enable typescript/no-unsafe-type-assertion - limit the exemption to `requireWhen` */\n"],"mappings":";;AAmBA,SAAgB,YAAY,MAAe,QAAe,GAAG,MAAyB;CACpF,MAAM,IAAIA,KAAW,IAAIC,MAAI;CAC7B,IAAI,MAAM,OAAO;CACjB,IAAI,KAAK,WAAW,GAAG,OAAO,EAAE,SAAS;CACzC,MAAM,CAAC,YAAY;CAGnB,MAAM,QAAQ,OAAO,OAAO;CAC5B,OAAO,EACJ,GAAGD,KAAW,KAAK,KAAK,CAAC,CAAC,CAC1B,MAAM,MAAgB,MAAM,QAAQ,WAAW,CAAE,CAAC,CAClD,QAAQ,KAAc;AAC3B"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Clean, MergedConfig } from "./merge.types.js";
|
|
2
2
|
import { ReadonlyDeep } from "type-fest";
|
|
3
|
-
//#region src/merge-config/merge-config.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* The merge config function. `userConfig` is deep merged into `BaseConfig` with arrays appended to the base array. The
|
|
6
5
|
* optional `replaceConfig` is then deep merged into that result with arrays used as-is, so putting an array there
|
|
@@ -14,5 +13,4 @@ import { ReadonlyDeep } from "type-fest";
|
|
|
14
13
|
export type MergeConfigFn<UserConfig, BaseConfig> = (<const UserConfigToMerge extends ReadonlyDeep<UserConfig>>(userConfig: UserConfigToMerge) => MergedConfig<BaseConfig, UserConfigToMerge>) & (<const UserConfigToMerge extends ReadonlyDeep<UserConfig>, const ReplaceConfigToMerge extends ReadonlyDeep<Partial<UserConfig>>>(userConfig: UserConfigToMerge, replaceConfig: ReplaceConfigToMerge) => MergedConfig<MergedConfig<BaseConfig, UserConfigToMerge>, ReplaceConfigToMerge, "replace">);
|
|
15
14
|
/** A MergeConfigFn that can also be called with no arguments, returning a writable clone of the base config. */
|
|
16
15
|
export type OptionalMergeConfigFn<UserConfig, BaseConfig> = MergeConfigFn<UserConfig, BaseConfig> & (() => Clean<BaseConfig>);
|
|
17
|
-
//#endregion
|
|
18
16
|
//# sourceMappingURL=merge-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge-config.d.ts","names":[],"sources":["../../src/merge-config/merge-config.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"merge-config.d.ts","names":[],"sources":["../../src/merge-config/merge-config.ts"],"mappings":";;;;;;;;;;;;YAgCY,cAAc,YAAY,sBAAsB,0BAA0B,aAAa,aACjG,YAAY,sBACT,aAAa,YAAY,8BAEpB,0BAA0B,aAAa,mBACvC,6BAA6B,aAAa,QAAQ,cAExD,YAAY,mBACZ,eAAe,yBACZ,aAAa,aAAa,YAAY,oBAAoB;;YAGrD,sBAAsB,YAAY,cAAc,cAAc,YAAY,qBAC3E,MAAM"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cloneDeep, mergeWith } from "es-toolkit";
|
|
2
|
-
|
|
2
|
+
// src/merge-config/merge-config.ts
|
|
3
3
|
/**
|
|
4
4
|
* The runtime counterpart of MergedConfig in merge.types.ts: a deep merge whose customizer applies the array mode. The
|
|
5
5
|
* source is pre-cloned so the result never aliases the caller's objects. The merge visits string keys only, so
|
|
@@ -24,7 +24,6 @@ const createMergeConfigFn = (baseConfig) => {
|
|
|
24
24
|
};
|
|
25
25
|
return mergeConfigFn;
|
|
26
26
|
};
|
|
27
|
-
//#endregion
|
|
28
27
|
export { createMergeConfigFn };
|
|
29
28
|
|
|
30
29
|
//# sourceMappingURL=merge-config.js.map
|