@theholocron/datapad 5.0.0-alpha.152 → 5.0.0-alpha.154

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/dist/index.d.mts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { deepMerge as mergeConfig } from "@theholocron/object-utils";
2
- //#region src/default-extensions.d.ts
2
+ //#region src/default-extensions/default-extensions.d.ts
3
3
  /** Default extension probe order, highest priority first. */
4
4
  declare const DEFAULT_EXTENSIONS: readonly ["ts", "js", "mjs", "cjs", "json"];
5
5
  //#endregion
6
- //#region src/define.d.ts
6
+ //#region src/define/define.d.ts
7
7
  /**
8
8
  * Build a typed identity `defineConfig` for a specific config shape.
9
9
  *
@@ -18,7 +18,7 @@ declare const DEFAULT_EXTENSIONS: readonly ["ts", "js", "mjs", "cjs", "json"];
18
18
  */
19
19
  declare function createDefineConfig<T>(): <C extends T>(config: C) => C;
20
20
  //#endregion
21
- //#region src/errors.d.ts
21
+ //#region src/errors/errors.d.ts
22
22
  /**
23
23
  * Thrown when a config file is found but cannot be loaded — malformed
24
24
  * JSON, a syntax error in a `.ts` / `.js` module, or no usable default
@@ -34,7 +34,7 @@ declare class ConfigFileError extends Error {
34
34
  filepath?: string | undefined);
35
35
  }
36
36
  //#endregion
37
- //#region src/load-config-file.type.d.ts
37
+ //#region src/load-config-file/load-config-file.type.d.ts
38
38
  interface LoadConfigFileOptions {
39
39
  /** Directory to start looking in. */
40
40
  cwd: string;
@@ -57,7 +57,7 @@ interface Loaded<T> {
57
57
  filepath: string;
58
58
  }
59
59
  //#endregion
60
- //#region src/load-config-file.d.ts
60
+ //#region src/load-config-file/load-config-file.d.ts
61
61
  /**
62
62
  * Load the first `<name>.config.<ext>` found starting at `cwd` — just
63
63
  * `cwd` itself by default, or walking up through ancestor directories when
@@ -67,7 +67,7 @@ interface Loaded<T> {
67
67
  */
68
68
  declare function loadConfigFile<T>(opts: LoadConfigFileOptions): Promise<Loaded<T> | null>;
69
69
  //#endregion
70
- //#region src/load-config-from-content.type.d.ts
70
+ //#region src/load-config-from-content/load-config-from-content.type.d.ts
71
71
  interface LoadConfigFromContentOptions {
72
72
  /**
73
73
  * Directory to write `<name>.config.<extension>` into before loading —
@@ -86,7 +86,7 @@ interface LoadConfigFromContentOptions {
86
86
  extension: string;
87
87
  }
88
88
  //#endregion
89
- //#region src/load-config-from-content.d.ts
89
+ //#region src/load-config-from-content/load-config-from-content.d.ts
90
90
  /**
91
91
  * Load config from content that didn't come from a file already on disk —
92
92
  * writes it to `<dir>/<name>.config.<extension>` first, then loads it
@@ -99,7 +99,7 @@ interface LoadConfigFromContentOptions {
99
99
  */
100
100
  declare function loadConfigFromContent<T>(opts: LoadConfigFromContentOptions): Promise<Loaded<T>>;
101
101
  //#endregion
102
- //#region src/load-layered.type.d.ts
102
+ //#region src/load-layered/load-layered.type.d.ts
103
103
  interface LoadLayeredOptions<T = unknown> extends LoadConfigFileOptions {
104
104
  /**
105
105
  * When no dedicated `<name>.config.*` exists — or in addition to it —
@@ -132,7 +132,7 @@ interface LayeredResult<T> {
132
132
  sources: string[];
133
133
  }
134
134
  //#endregion
135
- //#region src/load-layered.d.ts
135
+ //#region src/load-layered/load-layered.d.ts
136
136
  /**
137
137
  * `<name>.config.*` layered over the `[fallback.key]` of
138
138
  * `<fallback.file>.config.*`. Either, both, or neither may be present;
@@ -141,7 +141,7 @@ interface LayeredResult<T> {
141
141
  */
142
142
  declare function loadLayered<T>(opts: LoadLayeredOptions<T>): Promise<LayeredResult<T> | null>;
143
143
  //#endregion
144
- //#region src/merge-layers.d.ts
144
+ //#region src/merge-layers/merge-layers.d.ts
145
145
  /**
146
146
  * Deep-merges config layers, lowest priority first (a later layer wins on
147
147
  * scalars; arrays concatenate; nested objects merge). `undefined` layers are
@@ -154,7 +154,7 @@ declare function loadLayered<T>(opts: LoadLayeredOptions<T>): Promise<LayeredRes
154
154
  */
155
155
  declare function mergeLayers<T>(layers: readonly (T | undefined)[]): T | undefined;
156
156
  //#endregion
157
- //#region src/read-config-source.type.d.ts
157
+ //#region src/read-config-source/read-config-source.type.d.ts
158
158
  /** A config file's content fetched from somewhere other than the local disk. */
159
159
  interface ConfigSource {
160
160
  /** The file name probed, e.g. `holocron.config.ts` — relative, as `fetch` was asked for it. */
@@ -177,7 +177,7 @@ interface ReadConfigSourceOptions {
177
177
  extensions?: readonly string[];
178
178
  }
179
179
  //#endregion
180
- //#region src/read-config-source.d.ts
180
+ //#region src/read-config-source/read-config-source.d.ts
181
181
  /**
182
182
  * {@link probeExtensions} for a config that lives somewhere other than the
183
183
  * local disk (a GitHub API, a git blob): probes `<name>.config.<ext>` in
@@ -187,7 +187,7 @@ interface ReadConfigSourceOptions {
187
187
  */
188
188
  declare function readConfigSource(options: ReadConfigSourceOptions): Promise<ConfigSource | undefined>;
189
189
  //#endregion
190
- //#region src/with-config-sandbox.type.d.ts
190
+ //#region src/with-config-sandbox/with-config-sandbox.type.d.ts
191
191
  interface ConfigSandboxOptions {
192
192
  /**
193
193
  * A real `node_modules` directory to make visible from the sandbox. A config
@@ -203,7 +203,7 @@ interface ConfigSandboxOptions {
203
203
  prefix?: string;
204
204
  }
205
205
  //#endregion
206
- //#region src/with-config-sandbox.d.ts
206
+ //#region src/with-config-sandbox/with-config-sandbox.d.ts
207
207
  /**
208
208
  * Runs `run` with a throwaway directory prepared for
209
209
  * {@link loadConfigFromContent}'s `dir`, and removes it afterwards (also when
package/dist/index.mjs CHANGED
@@ -5,7 +5,7 @@ import { pathToFileURL } from "node:url";
5
5
  import { errorMessage } from "@theholocron/misc-utils";
6
6
  import { deepMerge, deepMerge as mergeConfig } from "@theholocron/object-utils";
7
7
  import { tmpdir } from "node:os";
8
- //#region src/default-extensions.ts
8
+ //#region src/default-extensions/default-extensions.ts
9
9
  /** Default extension probe order, highest priority first. */
10
10
  const DEFAULT_EXTENSIONS = [
11
11
  "ts",
@@ -15,7 +15,7 @@ const DEFAULT_EXTENSIONS = [
15
15
  "json"
16
16
  ];
17
17
  //#endregion
18
- //#region src/define.ts
18
+ //#region src/define/define.ts
19
19
  /**
20
20
  * Build a typed identity `defineConfig` for a specific config shape.
21
21
  *
@@ -32,7 +32,7 @@ function createDefineConfig() {
32
32
  return (config) => config;
33
33
  }
34
34
  //#endregion
35
- //#region src/errors.ts
35
+ //#region src/errors/errors.ts
36
36
  /**
37
37
  * Thrown when a config file is found but cannot be loaded — malformed
38
38
  * JSON, a syntax error in a `.ts` / `.js` module, or no usable default
@@ -48,7 +48,7 @@ var ConfigFileError = class extends Error {
48
48
  }
49
49
  };
50
50
  //#endregion
51
- //#region src/is-file.ts
51
+ //#region src/is-file/is-file.ts
52
52
  async function isFile(path) {
53
53
  try {
54
54
  return (await stat(path)).isFile();
@@ -57,7 +57,7 @@ async function isFile(path) {
57
57
  }
58
58
  }
59
59
  //#endregion
60
- //#region src/load-file.ts
60
+ //#region src/load-file/load-file.ts
61
61
  /**
62
62
  * The actual file-loading mechanics `load.ts`'s exported functions share:
63
63
  * JSON parsing, dynamic `import()` (TS via `tsx`'s persistent ESM loader,
@@ -115,7 +115,7 @@ function extractDefault(filepath, mod) {
115
115
  return raw;
116
116
  }
117
117
  //#endregion
118
- //#region src/probe-extensions.ts
118
+ //#region src/probe-extensions/probe-extensions.ts
119
119
  /**
120
120
  * Probe `dir` for `<name>.config.<ext>` in extension-priority order,
121
121
  * loading and returning the first match. The one piece of per-directory
@@ -134,7 +134,7 @@ async function probeExtensions(dir, name, extensions) {
134
134
  }
135
135
  }
136
136
  //#endregion
137
- //#region src/load-config-file.ts
137
+ //#region src/load-config-file/load-config-file.ts
138
138
  /**
139
139
  * Discover and load `<name>.config.*` files, or load one from content that
140
140
  * didn't come from a file at all ({@link loadConfigFromContent}).
@@ -170,7 +170,7 @@ async function loadConfigFile(opts) {
170
170
  return await findUpward(opts.cwd, checkDir, hasGitEntry) ?? null;
171
171
  }
172
172
  //#endregion
173
- //#region src/load-config-from-content.ts
173
+ //#region src/load-config-from-content/load-config-from-content.ts
174
174
  /**
175
175
  * Load config from content that didn't come from a file already on disk —
176
176
  * writes it to `<dir>/<name>.config.<extension>` first, then loads it
@@ -190,7 +190,7 @@ async function loadConfigFromContent(opts) {
190
190
  };
191
191
  }
192
192
  //#endregion
193
- //#region src/merge-layers.ts
193
+ //#region src/merge-layers/merge-layers.ts
194
194
  /**
195
195
  * Deep-merges config layers, lowest priority first (a later layer wins on
196
196
  * scalars; arrays concatenate; nested objects merge). `undefined` layers are
@@ -207,7 +207,7 @@ function mergeLayers(layers) {
207
207
  return present.reduce((acc, layer) => deepMerge(acc, layer), {});
208
208
  }
209
209
  //#endregion
210
- //#region src/load-layered.ts
210
+ //#region src/load-layered/load-layered.ts
211
211
  /**
212
212
  * `<name>.config.*` layered over the `[fallback.key]` of
213
213
  * `<fallback.file>.config.*`. Either, both, or neither may be present;
@@ -248,7 +248,7 @@ async function loadLayered(opts) {
248
248
  };
249
249
  }
250
250
  //#endregion
251
- //#region src/read-config-source.ts
251
+ //#region src/read-config-source/read-config-source.ts
252
252
  /**
253
253
  * {@link probeExtensions} for a config that lives somewhere other than the
254
254
  * local disk (a GitHub API, a git blob): probes `<name>.config.<ext>` in
@@ -268,7 +268,7 @@ async function readConfigSource(options) {
268
268
  }
269
269
  }
270
270
  //#endregion
271
- //#region src/with-config-sandbox.ts
271
+ //#region src/with-config-sandbox/with-config-sandbox.ts
272
272
  /**
273
273
  * Runs `run` with a throwaway directory prepared for
274
274
  * {@link loadConfigFromContent}'s `dir`, and removes it afterwards (also when
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/datapad",
3
- "version": "5.0.0-alpha.152",
3
+ "version": "5.0.0-alpha.154",
4
4
  "description": "Generic config-file loading for Holocron — discover, load (JSON/JS/TS/ESM/CJS), and merge <name>.config.* files with a typed defineConfig.",
5
5
  "keywords": [
6
6
  "config",
@@ -32,9 +32,9 @@
32
32
  "dist"
33
33
  ],
34
34
  "dependencies": {
35
- "@theholocron/fs-utils": "^1.13.0",
36
- "@theholocron/misc-utils": "^1.13.0",
37
- "@theholocron/object-utils": "^1.13.0",
35
+ "@theholocron/fs-utils": "^1.15.1",
36
+ "@theholocron/misc-utils": "^1.15.1",
37
+ "@theholocron/object-utils": "^1.15.1",
38
38
  "tsx": "4.23.12"
39
39
  },
40
40
  "devDependencies": {