@adamhl8/configs 0.18.0 → 0.18.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.
@@ -1 +1 @@
1
- {"version":3,"file":"knip.d.ts","names":[],"sources":["../../src/configs/knip.ts"],"sourcesContent":[],"mappings":";;;cAca;;;IAAA,KAAA,CAAA,EAAA,MAAiF,GAAA,MAAA,EAAA,GAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;EAAvE,CAAA,GAAA,SAAA"}
1
+ {"version":3,"file":"knip.d.ts","names":[],"sources":["../../src/configs/knip.ts"],"mappings":";;;;cASM,UAAA;EAAA;;;;cAMO,UAAA,EAAY,qBAAA,CAAsB,oBAAA,SAAmB,UAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"knip.js","names":[],"sources":["../../src/configs/knip.ts"],"sourcesContent":["import type { RawConfiguration } from \"knip/dist/types/config\"\n\nimport { createMergeConfigFn } from \"./utils.ts\"\n\n// Normally, specifying the `./src/index.ts` entry would cause knip to complain about a redundant entry because it gets automatically included via the tsdown plugin.\n// However, in projects that _don't_ use tsdown, the `./src/index.ts` entry would be missing entirely.\n// To handle this, we specify it and disable the tsdown plugin. This makes knip work in both cases.\n\nconst baseConfig = {\n entry: [\"./src/index.ts\", \"**/*.test.ts\", \"./tsdown.config.ts\"],\n project: [\"**\"],\n tsdown: false,\n} as const satisfies RawConfiguration\n\nexport const knipConfig = createMergeConfigFn<RawConfiguration, typeof baseConfig>(baseConfig)\n"],"mappings":";AAcA,MAAa,aAAa,oBANP;CACjB,OAAO;EAAC;EAAkB;EAAgB;EAAqB;CAC/D,SAAS,CAAC,KAAK;CACf,QAAQ;CACT,CAE6F"}
1
+ {"version":3,"file":"knip.js","names":[],"sources":["../../src/configs/knip.ts"],"sourcesContent":["import type { KnipConfig } from \"knip\"\n\nimport type { OptionalMergeConfigFn } from \"./utils.ts\"\nimport { createMergeConfigFn } from \"./utils.ts\"\n\n// Normally, specifying the `./src/index.ts` entry would cause knip to complain about a redundant entry because it gets automatically included via the tsdown plugin.\n// However, in projects that _don't_ use tsdown, the `./src/index.ts` entry would be missing entirely.\n// To handle this, we specify it and disable the tsdown plugin. This makes knip work in both cases.\n\nconst baseConfig = {\n entry: [\"./src/index.ts\", \"**/*.test.ts\", \"./tsdown.config.ts\"],\n project: [\"**\"],\n tsdown: false,\n} as const satisfies KnipConfig\n\nexport const knipConfig: OptionalMergeConfigFn<KnipConfig, typeof baseConfig> = createMergeConfigFn(baseConfig)\n"],"mappings":";AAeA,MAAa,aAAmE,oBAN7D;CACjB,OAAO;EAAC;EAAkB;EAAgB;EAAqB;CAC/D,SAAS,CAAC,KAAK;CACf,QAAQ;CACT,CAE8G"}
@@ -1,46 +1,10 @@
1
1
  import { OptionalMergeConfigFn } from "./utils.js";
2
- import * as prettier0 from "prettier";
2
+ import { Simplify } from "type-fest";
3
+ import { Config } from "prettier";
3
4
 
4
5
  //#region src/configs/prettier.d.ts
5
- declare const prettierConfig: OptionalMergeConfigFn<{
6
- [x: string]: unknown;
7
- overrides?: Array<{
8
- files: string | string[];
9
- excludeFiles?: string | string[];
10
- options?: prettier0.Options;
11
- }>;
12
- semi?: boolean;
13
- singleQuote?: boolean;
14
- jsxSingleQuote?: boolean;
15
- trailingComma?: "none" | "es5" | "all";
16
- bracketSpacing?: boolean;
17
- objectWrap?: "preserve" | "collapse";
18
- bracketSameLine?: boolean;
19
- rangeStart?: number;
20
- rangeEnd?: number;
21
- parser?: prettier0.LiteralUnion<prettier0.BuiltInParserName>;
22
- filepath?: string;
23
- requirePragma?: boolean;
24
- insertPragma?: boolean;
25
- checkIgnorePragma?: boolean;
26
- proseWrap?: "always" | "never" | "preserve";
27
- arrowParens?: "avoid" | "always";
28
- plugins?: Array<string | URL | prettier0.Plugin>;
29
- htmlWhitespaceSensitivity?: "css" | "strict" | "ignore";
30
- endOfLine?: "auto" | "lf" | "crlf" | "cr";
31
- quoteProps?: "as-needed" | "consistent" | "preserve";
32
- vueIndentScriptAndStyle?: boolean;
33
- embeddedLanguageFormatting?: "auto" | "off";
34
- singleAttributePerLine?: boolean;
35
- experimentalOperatorPosition?: "start" | "end";
36
- experimentalTernaries?: boolean;
37
- jsxBracketSameLine?: boolean;
38
- printWidth?: number;
39
- tabWidth?: number;
40
- useTabs?: boolean;
41
- parentParser?: string | undefined | undefined;
42
- __embeddedInHtml?: boolean | undefined | undefined;
43
- }, {
6
+ type PrettierConfig = Simplify<Config>;
7
+ declare const baseConfig: {
44
8
  readonly printWidth: 120;
45
9
  readonly semi: false;
46
10
  readonly plugins: ["@prettier/plugin-xml", "prettier-plugin-sh", "prettier-plugin-toml", "prettier-plugin-astro", "prettier-plugin-tailwindcss"];
@@ -56,7 +20,8 @@ declare const prettierConfig: OptionalMergeConfigFn<{
56
20
  readonly parser: "astro";
57
21
  };
58
22
  }];
59
- }>;
23
+ };
24
+ declare const prettierConfig: OptionalMergeConfigFn<PrettierConfig, typeof baseConfig>;
60
25
  //#endregion
61
26
  export { prettierConfig };
62
27
  //# sourceMappingURL=prettier.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prettier.d.ts","names":[],"sources":["../../src/configs/prettier.ts"],"sourcesContent":[],"mappings":";;;;cAoCa;;;;IAAA,YAAA,CAAmF,EAAA,MAAA,GAAA,MAAA,EAAA;IAAA,OACwpP,CAAA,EADxpP,SAAA,CACwpP,OAAA;;;;;;;;EAD7tP,eAAA,CAAA,EAAA,OAAA"}
1
+ {"version":3,"file":"prettier.d.ts","names":[],"sources":["../../src/configs/prettier.ts"],"mappings":";;;;;KAOK,cAAA,GAAiB,QAAA,CAAS,MAAA;AAAA,cAEzB,UAAA;EAAA;;;;;;;;;;;;;;;;cA4BO,cAAA,EAAgB,qBAAA,CAAsB,cAAA,SAAuB,UAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"prettier.js","names":[],"sources":["../../src/configs/prettier.ts"],"sourcesContent":["import type { Config } from \"prettier\"\nimport type { Simplify } from \"type-fest\"\n\nimport { createMergeConfigFn } from \"./utils.ts\"\n\n// for some reason the Config type from prettier doesn't satisfy AnyObj unless we simplify it\ntype PrettierConfig = Simplify<Config>\n\nconst baseConfig = {\n printWidth: 120,\n semi: false,\n plugins: [\n \"@prettier/plugin-xml\",\n \"prettier-plugin-sh\",\n \"prettier-plugin-toml\",\n \"prettier-plugin-astro\",\n \"prettier-plugin-tailwindcss\",\n ],\n tailwindStylesheet: \"./src/global.css\",\n overrides: [\n {\n // https://github.com/prettier/prettier/issues/15956\n files: \"*.jsonc\",\n options: {\n trailingComma: \"none\",\n },\n },\n {\n files: \"*.astro\",\n options: {\n parser: \"astro\",\n },\n },\n ],\n} as const satisfies PrettierConfig\n\nexport const prettierConfig = createMergeConfigFn<PrettierConfig, typeof baseConfig>(baseConfig)\n"],"mappings":";AAoCA,MAAa,iBAAiB,oBA5BX;CACjB,YAAY;CACZ,MAAM;CACN,SAAS;EACP;EACA;EACA;EACA;EACA;EACD;CACD,oBAAoB;CACpB,WAAW,CACT;EAEE,OAAO;EACP,SAAS,EACP,eAAe,QAChB;EACF,EACD;EACE,OAAO;EACP,SAAS,EACP,QAAQ,SACT;EACF,CACF;CACF,CAE+F"}
1
+ {"version":3,"file":"prettier.js","names":[],"sources":["../../src/configs/prettier.ts"],"sourcesContent":["import type { Config } from \"prettier\"\nimport type { Simplify } from \"type-fest\"\n\nimport type { OptionalMergeConfigFn } from \"./utils.ts\"\nimport { createMergeConfigFn } from \"./utils.ts\"\n\n// for some reason the Config type from prettier doesn't satisfy AnyObj unless we simplify it\ntype PrettierConfig = Simplify<Config>\n\nconst baseConfig = {\n printWidth: 120,\n semi: false,\n plugins: [\n \"@prettier/plugin-xml\",\n \"prettier-plugin-sh\",\n \"prettier-plugin-toml\",\n \"prettier-plugin-astro\",\n \"prettier-plugin-tailwindcss\",\n ],\n tailwindStylesheet: \"./src/global.css\",\n overrides: [\n {\n // https://github.com/prettier/prettier/issues/15956\n files: \"*.jsonc\",\n options: {\n trailingComma: \"none\",\n },\n },\n {\n files: \"*.astro\",\n options: {\n parser: \"astro\",\n },\n },\n ],\n} as const satisfies PrettierConfig\n\nexport const prettierConfig: OptionalMergeConfigFn<PrettierConfig, typeof baseConfig> = createMergeConfigFn(baseConfig)\n"],"mappings":";AAqCA,MAAa,iBAA2E,oBA5BrE;CACjB,YAAY;CACZ,MAAM;CACN,SAAS;EACP;EACA;EACA;EACA;EACA;EACD;CACD,oBAAoB;CACpB,WAAW,CACT;EAEE,OAAO;EACP,SAAS,EACP,eAAe,QAChB;EACF,EACD;EACE,OAAO;EACP,SAAS,EACP,QAAQ,SACT;EACF,CACF;CACF,CAEsH"}
@@ -1,74 +1,10 @@
1
1
  import { MergeConfigFn, OptionalMergeConfigFn } from "./utils.js";
2
- import * as rolldown0 from "rolldown";
3
- import * as tsdown0 from "tsdown";
2
+ import { SetRequired } from "type-fest";
4
3
  import { UserConfig } from "tsdown";
5
- import * as rolldown_plugin_dts0 from "rolldown-plugin-dts";
6
- import * as publint0 from "publint";
7
- import * as hookable0 from "hookable";
8
4
 
9
5
  //#region src/configs/tsdown.d.ts
10
- declare const tsdownConfig: MergeConfigFn<{
11
- entry?: rolldown0.InputOption;
12
- external?: rolldown0.ExternalOption;
13
- noExternal?: (string | RegExp | (string | RegExp)[]) | tsdown0.NoExternalFn;
14
- inlineOnly?: string | RegExp | (string | RegExp)[];
15
- skipNodeModulesBundle?: boolean;
16
- alias?: Record<string, string>;
17
- tsconfig?: string | boolean;
18
- target?: string | string[] | false;
19
- env?: Record<string, any>;
20
- define?: Record<string, string>;
21
- shims?: boolean;
22
- treeshake?: boolean | rolldown0.TreeshakingOptions;
23
- loader?: rolldown0.ModuleTypes;
24
- removeNodeProtocol?: boolean;
25
- nodeProtocol?: "strip" | boolean;
26
- plugins?: rolldown0.RolldownPluginOption<any>;
27
- inputOptions?: rolldown0.InputOptions | ((options: rolldown0.InputOptions, format: tsdown0.NormalizedFormat, context: {
28
- cjsDts: boolean;
29
- }) => void | rolldown0.InputOptions | Promise<void | rolldown0.InputOptions | null> | null);
30
- format?: tsdown0.Format | tsdown0.Format[] | Partial<Record<tsdown0.Format, Partial<tsdown0.ResolvedConfig>>>;
31
- globalName?: string;
32
- outDir?: string;
33
- write?: boolean;
34
- sourcemap?: tsdown0.Sourcemap;
35
- clean?: boolean | string[];
36
- minify?: boolean | "dce-only" | rolldown0.MinifyOptions;
37
- footer?: tsdown0.ChunkAddon;
38
- banner?: tsdown0.ChunkAddon;
39
- unbundle?: boolean;
40
- bundle?: boolean;
41
- fixedExtension?: boolean;
42
- outExtensions?: tsdown0.OutExtensionFactory;
43
- hash?: boolean;
44
- cjsDefault?: boolean;
45
- outputOptions?: rolldown0.OutputOptions | ((options: rolldown0.OutputOptions, format: tsdown0.NormalizedFormat, context: {
46
- cjsDts: boolean;
47
- }) => void | rolldown0.OutputOptions | Promise<void | rolldown0.OutputOptions | null> | null);
48
- cwd?: string;
49
- name?: string;
50
- silent?: boolean;
51
- logLevel?: "silent" | ("error" | "warn" | "info");
52
- failOnWarn?: boolean | tsdown0.CIOption;
53
- customLogger?: tsdown0.Logger;
54
- fromVite?: boolean | "vitest";
55
- watch?: boolean | (string | string[]);
56
- ignoreWatch?: string | RegExp | (string | RegExp)[];
57
- debug?: tsdown0.WithEnabled<tsdown0.DebugOptions>;
58
- onSuccess?: string | ((config: tsdown0.ResolvedConfig, signal: AbortSignal) => void | Promise<void>);
59
- dts?: tsdown0.WithEnabled<rolldown_plugin_dts0.Options>;
60
- unused?: tsdown0.WithEnabled<UnusedOptions>;
61
- publint?: tsdown0.WithEnabled<publint0.Options>;
62
- attw?: tsdown0.WithEnabled<tsdown0.AttwOptions>;
63
- report?: tsdown0.WithEnabled<tsdown0.ReportOptions>;
64
- globImport?: boolean;
65
- exports?: tsdown0.WithEnabled<tsdown0.ExportsOptions>;
66
- publicDir?: tsdown0.CopyOptions | tsdown0.CopyOptionsFn;
67
- copy?: tsdown0.CopyOptions | tsdown0.CopyOptionsFn;
68
- hooks?: Partial<tsdown0.TsdownHooks> | ((hooks: hookable0.Hookable<tsdown0.TsdownHooks>) => void | Promise<void>);
69
- workspace?: tsdown0.Workspace | (string | string[]) | true;
70
- platform: "node" | "neutral" | "browser";
71
- }, {
6
+ type StrictUserConfig = SetRequired<UserConfig, "platform">;
7
+ declare const baseConfig: {
72
8
  readonly entry: ["./src/index.ts"];
73
9
  readonly unbundle: true;
74
10
  readonly target: false;
@@ -78,6 +14,7 @@ declare const tsdownConfig: MergeConfigFn<{
78
14
  readonly sourcemap: true;
79
15
  readonly hash: false;
80
16
  readonly dts: {
17
+ readonly resolver: "tsc";
81
18
  readonly newContext: true;
82
19
  readonly sourcemap: true;
83
20
  };
@@ -87,14 +24,13 @@ declare const tsdownConfig: MergeConfigFn<{
87
24
  };
88
25
  readonly publint: true;
89
26
  readonly failOnWarn: true;
90
- }>;
91
- declare const tsdownBinConfig: OptionalMergeConfigFn<UserConfig, {
27
+ };
28
+ declare const binConfig: {
92
29
  readonly entry: [];
93
30
  readonly platform: "node";
94
31
  readonly outExtensions: () => {
95
32
  js: string;
96
33
  };
97
- readonly copy: [];
98
34
  readonly unbundle: false;
99
35
  readonly sourcemap: false;
100
36
  readonly dts: false;
@@ -105,7 +41,9 @@ declare const tsdownBinConfig: OptionalMergeConfigFn<UserConfig, {
105
41
  readonly minify: "dce-only";
106
42
  readonly hash: false;
107
43
  readonly failOnWarn: true;
108
- }>;
44
+ };
45
+ declare const tsdownConfig: MergeConfigFn<StrictUserConfig, typeof baseConfig>;
46
+ declare const tsdownBinConfig: OptionalMergeConfigFn<UserConfig, typeof binConfig>;
109
47
  //#endregion
110
48
  export { tsdownBinConfig, tsdownConfig };
111
49
  //# sourceMappingURL=tsdown.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tsdown.d.ts","names":[],"sources":["../../src/configs/tsdown.ts"],"sourcesContent":[],"mappings":";;;;;;;;;cA0Ca;UAAyF,SAAA,CAAA;;;;;;;EAAzF,MAAA,CAAA,EAAA,MAAyF,GAAA,MAAA,EAAA,GAAA,KAAA;EAAA,GAAA,CAAA,QAAA,CAAA,MAAA,EAAA,GAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA7E,SAAA,OAAA,EAAA,IAAA;EACZ,SAAA,UAA8E,EAAA,IAAA;;cAA9E,iBAAe,sBAAA"}
1
+ {"version":3,"file":"tsdown.d.ts","names":[],"sources":["../../src/configs/tsdown.ts"],"mappings":";;;;;KAOK,gBAAA,GAAmB,WAAA,CAAY,UAAA;AAAA,cAE9B,UAAA;EAAA;;;;;;;;;;;;;;;;;;;;cAsBA,SAAA;EAAA;;;;;;;;;;;;;;;;cAYO,YAAA,EAAc,aAAA,CAAc,gBAAA,SAAyB,UAAA;AAAA,cACrD,eAAA,EAAiB,qBAAA,CAAsB,UAAA,SAAmB,SAAA"}
@@ -9,6 +9,7 @@ const baseConfig = {
9
9
  sourcemap: true,
10
10
  hash: false,
11
11
  dts: {
12
+ resolver: "tsc",
12
13
  newContext: true,
13
14
  sourcemap: true
14
15
  },
@@ -24,7 +25,6 @@ const binConfig = {
24
25
  entry: [],
25
26
  platform: "node",
26
27
  outExtensions: () => ({ js: "" }),
27
- copy: [],
28
28
  unbundle: false,
29
29
  sourcemap: false,
30
30
  dts: false,
@@ -1 +1 @@
1
- {"version":3,"file":"tsdown.js","names":[],"sources":["../../src/configs/tsdown.ts"],"sourcesContent":["import type { UserConfig } from \"tsdown\"\nimport type { SetRequired } from \"type-fest\"\n\nimport { createMergeConfigFn } from \"./utils.ts\"\n\n// force projects to specify platform\ntype StrictUserConfig = SetRequired<UserConfig, \"platform\">\n\nconst baseConfig = {\n entry: [\"./src/index.ts\"],\n unbundle: true,\n target: false,\n platform: \"neutral\",\n fixedExtension: false,\n minify: \"dce-only\",\n sourcemap: true,\n hash: false,\n dts: {\n newContext: true,\n sourcemap: true,\n },\n attw: {\n level: \"error\",\n profile: \"esm-only\",\n },\n publint: true,\n failOnWarn: true,\n} as const satisfies StrictUserConfig\n\nconst binConfig = {\n ...baseConfig,\n entry: [],\n platform: \"node\",\n outExtensions: () => ({ js: \"\" }),\n copy: [],\n unbundle: false,\n sourcemap: false,\n dts: false,\n attw: false,\n publint: false,\n} as const satisfies UserConfig\n\nexport const tsdownConfig = createMergeConfigFn<StrictUserConfig, typeof baseConfig, true>(baseConfig)\nexport const tsdownBinConfig = createMergeConfigFn<UserConfig, typeof binConfig>(binConfig)\n"],"mappings":";AAQA,MAAM,aAAa;CACjB,OAAO,CAAC,iBAAiB;CACzB,UAAU;CACV,QAAQ;CACR,UAAU;CACV,gBAAgB;CAChB,QAAQ;CACR,WAAW;CACX,MAAM;CACN,KAAK;EACH,YAAY;EACZ,WAAW;EACZ;CACD,MAAM;EACJ,OAAO;EACP,SAAS;EACV;CACD,SAAS;CACT,YAAY;CACb;AAED,MAAM,YAAY;CAChB,GAAG;CACH,OAAO,EAAE;CACT,UAAU;CACV,sBAAsB,EAAE,IAAI,IAAI;CAChC,MAAM,EAAE;CACR,UAAU;CACV,WAAW;CACX,KAAK;CACL,MAAM;CACN,SAAS;CACV;AAED,MAAa,eAAe,oBAA+D,WAAW;AACtG,MAAa,kBAAkB,oBAAkD,UAAU"}
1
+ {"version":3,"file":"tsdown.js","names":[],"sources":["../../src/configs/tsdown.ts"],"sourcesContent":["import type { UserConfig } from \"tsdown\"\nimport type { SetRequired } from \"type-fest\"\n\nimport type { MergeConfigFn, OptionalMergeConfigFn } from \"./utils.ts\"\nimport { createMergeConfigFn } from \"./utils.ts\"\n\n// force projects to specify platform\ntype StrictUserConfig = SetRequired<UserConfig, \"platform\">\n\nconst baseConfig = {\n entry: [\"./src/index.ts\"],\n unbundle: true,\n target: false,\n platform: \"neutral\",\n fixedExtension: false,\n minify: \"dce-only\",\n sourcemap: true,\n hash: false,\n dts: {\n resolver: \"tsc\",\n newContext: true,\n sourcemap: true,\n },\n attw: {\n level: \"error\",\n profile: \"esm-only\",\n },\n publint: true,\n failOnWarn: true,\n} as const satisfies StrictUserConfig\n\nconst binConfig = {\n ...baseConfig,\n entry: [],\n platform: \"node\",\n outExtensions: () => ({ js: \"\" }),\n unbundle: false,\n sourcemap: false,\n dts: false,\n attw: false,\n publint: false,\n} as const satisfies UserConfig\n\nexport const tsdownConfig: MergeConfigFn<StrictUserConfig, typeof baseConfig> = createMergeConfigFn(baseConfig)\nexport const tsdownBinConfig: OptionalMergeConfigFn<UserConfig, typeof binConfig> = createMergeConfigFn(binConfig)\n"],"mappings":";AASA,MAAM,aAAa;CACjB,OAAO,CAAC,iBAAiB;CACzB,UAAU;CACV,QAAQ;CACR,UAAU;CACV,gBAAgB;CAChB,QAAQ;CACR,WAAW;CACX,MAAM;CACN,KAAK;EACH,UAAU;EACV,YAAY;EACZ,WAAW;EACZ;CACD,MAAM;EACJ,OAAO;EACP,SAAS;EACV;CACD,SAAS;CACT,YAAY;CACb;AAED,MAAM,YAAY;CAChB,GAAG;CACH,OAAO,EAAE;CACT,UAAU;CACV,sBAAsB,EAAE,IAAI,IAAI;CAChC,UAAU;CACV,WAAW;CACX,KAAK;CACL,MAAM;CACN,SAAS;CACV;AAED,MAAa,eAAmE,oBAAoB,WAAW;AAC/G,MAAa,kBAAuE,oBAAoB,UAAU"}
@@ -1,9 +1,8 @@
1
1
  import { MergeDeep } from "type-fest";
2
2
 
3
3
  //#region src/configs/utils.d.ts
4
-
5
4
  /**
6
- * Type representing a merge config function, where the `UserConfig` passed in is merged with `BaseConfig`.
5
+ * The merge config function, where the `UserConfig` passed in is merged with `BaseConfig`.
7
6
  */
8
7
  interface MergeConfigFn<UserConfig, BaseConfig> {
9
8
  <UserConfigToMerge extends UserConfig>(userConfig: UserConfigToMerge): MergeDeep<BaseConfig, UserConfigToMerge, {
@@ -11,12 +10,10 @@ interface MergeConfigFn<UserConfig, BaseConfig> {
11
10
  }>;
12
11
  }
13
12
  /**
14
- * Type representing an overloaded function signature for MergeConfigFn:
13
+ * The optional merge config function, where the `userConfig` argument is optional.
15
14
  * - if `UserConfig` is not provided, the return type is `BaseConfig`
16
15
  * - if `UserConfig` is provided, the return type is the merged type of `BaseConfig` and `UserConfig`.
17
16
  *
18
- * This is needed to handle the fact that the `userConfig` argument is optional.
19
- *
20
17
  * Note that this extends `MergeConfigFn`, so this type has both function signatures on it.
21
18
  */
22
19
  interface OptionalMergeConfigFn<UserConfig, BaseConfig> extends MergeConfigFn<UserConfig, BaseConfig> {
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","names":[],"sources":["../../src/configs/utils.ts"],"sourcesContent":[],"mappings":";;;;;AAkBA;;AAGgB,UAHC,aAGD,CAAA,UAAA,EAAA,UAAA,CAAA,CAAA;EACD,CAAA,0BAFc,UAEd,CAAA,CAAA,UAAA,EADC,iBACD,CAAA,EAAV,SAAU,CAAA,UAAA,EAAY,iBAAZ,EAAA;IAAY,cAAA,EAAA,QAAA;EAAtB,CAAA,CAAA;;AAaL;;;;;;;;;UAAiB,sDAAsD,cAAc,YAAY;MAC3F"}
1
+ {"version":3,"file":"utils.d.ts","names":[],"sources":["../../src/configs/utils.ts"],"mappings":";;;;AAkBA;;UAAiB,aAAA;EAAA,2BAEY,UAAA,EACzB,UAAA,EAAY,iBAAA,GACX,SAAA,CAAU,UAAA,EAAY,iBAAA;IAAqB,cAAA;EAAA;AAAA;;;;;;;;UAW/B,qBAAA,iCAAsD,aAAA,CAAc,UAAA,EAAY,UAAA;EAAA,IAC3F,UAAA;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":[],"sources":["../../src/configs/utils.ts"],"sourcesContent":["import { mergeWith } from \"es-toolkit\"\nimport { clone } from \"remeda\"\nimport type { MergeDeep } from \"type-fest\"\n\ntype AnyObj = object\n\n/**\n * A wrapper around es-toolkit's `mergeWith` with a custom merge function that concatenates arrays.\n */\nfunction merge<T extends AnyObj, S extends AnyObj>(target: T, source: S): T & S {\n return mergeWith(target, source, (objValue: unknown, srcValue: unknown) =>\n Array.isArray(objValue) ? objValue.concat(srcValue) : undefined,\n )\n}\n\n/**\n * Type representing a merge config function, where the `UserConfig` passed in is merged with `BaseConfig`.\n */\nexport interface MergeConfigFn<UserConfig, BaseConfig> {\n // biome-ignore lint/style/useShorthandFunctionType: need to use call signature type\n <UserConfigToMerge extends UserConfig>(\n userConfig: UserConfigToMerge,\n ): MergeDeep<BaseConfig, UserConfigToMerge, { arrayMergeMode: \"spread\" }>\n // instead of returning `BaseConfig & UserConfig` (from `merge`), return a more friendly type using `MergeDeep`\n}\n\n/**\n * Type representing an overloaded function signature for MergeConfigFn:\n * - if `UserConfig` is not provided, the return type is `BaseConfig`\n * - if `UserConfig` is provided, the return type is the merged type of `BaseConfig` and `UserConfig`.\n *\n * This is needed to handle the fact that the `userConfig` argument is optional.\n *\n * Note that this extends `MergeConfigFn`, so this type has both function signatures on it.\n */\nexport interface OptionalMergeConfigFn<UserConfig, BaseConfig> extends MergeConfigFn<UserConfig, BaseConfig> {\n (): BaseConfig\n}\n\n/**\n * Creates a config merge function with proper type overloads for merging with a base config.\n */\nexport function createMergeConfigFn<\n UserConfig extends AnyObj,\n BaseConfig extends UserConfig,\n Required extends boolean = false, // if true, the created merge config function requires a userConfig to be passed in\n>(baseConfig: BaseConfig) {\n // we don't care about the specific type of userConfig here because we assert mergeConfigFn as the correct type below\n const mergeConfigFn = (userConfig?: AnyObj) => {\n if (userConfig === undefined) return baseConfig\n // clone both target and source so we never mutate the original objects\n return merge(clone(baseConfig), clone(userConfig))\n }\n\n return mergeConfigFn as Required extends true // if Required is true\n ? MergeConfigFn<UserConfig, BaseConfig> // then the merge config function requires a userConfig to be passed in\n : OptionalMergeConfigFn<UserConfig, BaseConfig> // else, userConfig is optional\n}\n"],"mappings":";;AASA,SAAS,MAA0C,QAAW,QAAkB;AAC9E,QAAO,UAAU,QAAQ,SAAS,UAAmB,aACnD,MAAM,QAAQ,SAAS,GAAG,SAAS,OAAO,SAAS,GAAG,KAAA,EACvD;;AA8BH,SAAgB,oBAId,YAAwB;CAExB,MAAM,iBAAiB,eAAwB;AAC7C,MAAI,eAAe,KAAA,EAAW,QAAO;AAErC,SAAO,MAAM,MAAM,WAAW,EAAE,MAAM,WAAW,CAAC;;AAGpD,QAAO"}
1
+ {"version":3,"file":"utils.js","names":[],"sources":["../../src/configs/utils.ts"],"sourcesContent":["import { mergeWith } from \"es-toolkit\"\nimport { clone } from \"remeda\"\nimport type { MergeDeep } from \"type-fest\"\n\ntype AnyObj = object\n\n/**\n * A wrapper around es-toolkit's `mergeWith` with a custom merge function that concatenates arrays.\n */\nfunction merge<T extends AnyObj, S extends AnyObj>(target: T, source: S): T & S {\n return mergeWith(target, source, (objValue: unknown, srcValue: unknown) =>\n Array.isArray(objValue) ? objValue.concat(srcValue) : undefined,\n )\n}\n\n/**\n * The merge config function, where the `UserConfig` passed in is merged with `BaseConfig`.\n */\nexport interface MergeConfigFn<UserConfig, BaseConfig> {\n // biome-ignore lint/style/useShorthandFunctionType: need to use call signature type\n <UserConfigToMerge extends UserConfig>(\n userConfig: UserConfigToMerge,\n ): MergeDeep<BaseConfig, UserConfigToMerge, { arrayMergeMode: \"spread\" }>\n // instead of returning `BaseConfig & UserConfig` (from `merge`), return a more friendly type using `MergeDeep`\n}\n\n/**\n * The optional merge config function, where the `userConfig` argument is optional.\n * - if `UserConfig` is not provided, the return type is `BaseConfig`\n * - if `UserConfig` is provided, the return type is the merged type of `BaseConfig` and `UserConfig`.\n *\n * Note that this extends `MergeConfigFn`, so this type has both function signatures on it.\n */\nexport interface OptionalMergeConfigFn<UserConfig, BaseConfig> extends MergeConfigFn<UserConfig, BaseConfig> {\n (): BaseConfig\n}\n\n/**\n * Creates a config merge function with proper type overloads for merging with a base config.\n */\nexport function createMergeConfigFn<UserConfig extends AnyObj, BaseConfig extends UserConfig>(baseConfig: BaseConfig) {\n // we don't care about the specific type of userConfig here because we assert mergeConfigFn as the correct type below\n const mergeConfigFn = (userConfig?: AnyObj) => {\n if (userConfig === undefined) return baseConfig\n // clone both target and source so we never mutate the original objects\n return merge(clone(baseConfig), clone(userConfig))\n }\n\n return mergeConfigFn as MergeConfigFn<UserConfig, BaseConfig> & OptionalMergeConfigFn<UserConfig, BaseConfig>\n}\n"],"mappings":";;AASA,SAAS,MAA0C,QAAW,QAAkB;AAC9E,QAAO,UAAU,QAAQ,SAAS,UAAmB,aACnD,MAAM,QAAQ,SAAS,GAAG,SAAS,OAAO,SAAS,GAAG,KAAA,EACvD;;AA4BH,SAAgB,oBAA8E,YAAwB;CAEpH,MAAM,iBAAiB,eAAwB;AAC7C,MAAI,eAAe,KAAA,EAAW,QAAO;AAErC,SAAO,MAAM,MAAM,WAAW,EAAE,MAAM,WAAW,CAAC;;AAGpD,QAAO"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adamhl8/configs",
3
- "version": "0.18.0",
3
+ "version": "0.18.1",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -39,29 +39,29 @@
39
39
  "typescript": "^5.0.0"
40
40
  },
41
41
  "dependencies": {
42
- "@optique/core": "^0.8.0",
43
- "@optique/run": "^0.8.0",
42
+ "@optique/core": "^0.9.1",
43
+ "@optique/run": "^0.9.1",
44
44
  "@prettier/plugin-xml": "^3.4.2",
45
- "es-toolkit": "^1.42.0",
45
+ "es-toolkit": "^1.44.0",
46
46
  "get-tsconfig": "^4.13.0",
47
47
  "picocolors": "^1.1.1",
48
48
  "prettier-plugin-astro": "^0.14.1",
49
49
  "prettier-plugin-sh": "^0.18.0",
50
50
  "prettier-plugin-tailwindcss": "^0.7.2",
51
51
  "prettier-plugin-toml": "^2.0.6",
52
- "remeda": "^2.32.0",
53
- "ts-explicit-errors": "^4.0.1",
54
- "tsdown": "^0.17.2",
55
- "type-fest": "^5.3.1"
52
+ "remeda": "^2.33.4",
53
+ "ts-explicit-errors": "^4.1.1",
54
+ "type-fest": "^5.4.1"
56
55
  },
57
56
  "devDependencies": {
58
57
  "@arethetypeswrong/core": "^0.18.2",
59
- "@biomejs/biome": "^2.3.8",
60
- "@types/bun": "^1.3.4",
61
- "knip": "^5.73.1",
58
+ "@biomejs/biome": "^2.3.12",
59
+ "@types/bun": "^1.3.6",
60
+ "knip": "^5.82.1",
62
61
  "markdown-toc": "^1.2.0",
63
- "prettier": "^3.7.4",
64
- "publint": "^0.3.16",
62
+ "prettier": "^3.8.1",
63
+ "publint": "^0.3.17",
64
+ "tsdown": "^0.20.1",
65
65
  "typescript": "^5.9.3"
66
66
  },
67
67
  "publishConfig": {