@theholocron/datapad 5.0.0-alpha.279 → 5.0.0-alpha.280

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
@@ -23,11 +23,13 @@ export declare function createDefineConfig<T>(): <C extends T>(config: C) => C;
23
23
  export declare class ConfigFileError extends Error {
24
24
  /** Absolute path of the offending file, when known. */
25
25
  readonly filepath?: string | undefined;
26
+ /** The error's name, `"ConfigFileError"`. */
26
27
  name: string;
27
28
  constructor(message: string,
28
29
  /** Absolute path of the offending file, when known. */
29
30
  filepath?: string | undefined);
30
31
  }
32
+ /** Options for finding and loading a config file from disk. */
31
33
  interface LoadConfigFileOptions {
32
34
  /** Directory to start looking in. */
33
35
  cwd: string;
@@ -44,7 +46,9 @@ interface LoadConfigFileOptions {
44
46
  */
45
47
  walkUp?: boolean;
46
48
  }
49
+ /** A config value together with the file it was loaded from. */
47
50
  interface Loaded<T> {
51
+ /** The loaded config value. */
48
52
  config: T;
49
53
  /** Absolute path of the file the value came from. */
50
54
  filepath: string;
@@ -57,6 +61,7 @@ interface Loaded<T> {
57
61
  * {@link ConfigFileError} when a file exists but cannot be loaded.
58
62
  */
59
63
  export declare function loadConfigFile<T>(opts: LoadConfigFileOptions): Promise<Loaded<T> | null>;
64
+ /** Options for loading a config from raw content rather than a file already on disk. */
60
65
  interface LoadConfigFromContentOptions {
61
66
  /**
62
67
  * Directory to write `<name>.config.<extension>` into before loading —
@@ -85,6 +90,7 @@ interface LoadConfigFromContentOptions {
85
90
  * included, not a re-implemented parser.
86
91
  */
87
92
  export declare function loadConfigFromContent<T>(opts: LoadConfigFromContentOptions): Promise<Loaded<T>>;
93
+ /** Options for loading a dedicated config file layered over a fallback file's key. */
88
94
  interface LoadLayeredOptions<T = unknown> extends LoadConfigFileOptions {
89
95
  /**
90
96
  * When no dedicated `<name>.config.*` exists — or in addition to it —
@@ -92,7 +98,9 @@ interface LoadLayeredOptions<T = unknown> extends LoadConfigFileOptions {
92
98
  * any) is merged on top.
93
99
  */
94
100
  fallback?: {
101
+ /** Base name of the fallback file, read as `<file>.config.*`. */
95
102
  file: string;
103
+ /** The key in the fallback file whose value is taken. */
96
104
  key: string;
97
105
  /**
98
106
  * The `<file>.config.*` already loaded by the caller (`null`: it was
@@ -109,7 +117,9 @@ interface LoadLayeredOptions<T = unknown> extends LoadConfigFileOptions {
109
117
  */
110
118
  coerce?: (raw: unknown) => T | undefined;
111
119
  }
120
+ /** The merged config from `loadLayered`, with where it came from. */
112
121
  interface LayeredResult<T> {
122
+ /** The merged config value. */
113
123
  config: T;
114
124
  /** The dedicated file path if present, else the fallback file path, else `null`. */
115
125
  filepath: string | null;
@@ -143,6 +153,7 @@ interface ConfigSource {
143
153
  /** The raw file content. */
144
154
  content: string;
145
155
  }
156
+ /** Options for fetching a config file's content from a remote source. */
146
157
  interface ReadConfigSourceOptions {
147
158
  /** Base name — `"holocron"` probes `holocron.config.{ts,js,mjs,cjs,json}`. */
148
159
  name: string;
@@ -163,6 +174,7 @@ interface ReadConfigSourceOptions {
163
174
  * `loadConfigFromContent` to execute it exactly as a local file would be.
164
175
  */
165
176
  export declare function readConfigSource(options: ReadConfigSourceOptions): Promise<ConfigSource | undefined>;
177
+ /** Options for the temporary directory a config is loaded in. */
166
178
  interface ConfigSandboxOptions {
167
179
  /**
168
180
  * A real `node_modules` directory to make visible from the sandbox. A config
package/dist/index.mjs CHANGED
@@ -39,6 +39,7 @@ function createDefineConfig() {
39
39
  */
40
40
  var ConfigFileError = class extends Error {
41
41
  filepath;
42
+ /** The error's name, `"ConfigFileError"`. */
42
43
  name = "ConfigFileError";
43
44
  constructor(message, filepath) {
44
45
  super(message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/datapad",
3
- "version": "5.0.0-alpha.279",
3
+ "version": "5.0.0-alpha.280",
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",
@@ -34,8 +34,8 @@
34
34
  "dependencies": {
35
35
  "tsx": "4.23.15",
36
36
  "@theholocron/fs-utils": "^1.16.1-alpha.3",
37
- "@theholocron/object-utils": "^1.16.1-alpha.3",
38
- "@theholocron/misc-utils": "^1.16.1-alpha.3"
37
+ "@theholocron/misc-utils": "^1.16.1-alpha.3",
38
+ "@theholocron/object-utils": "^1.16.1-alpha.3"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/node": "^26",
@@ -47,10 +47,10 @@
47
47
  "tsdown": "^0.23.3",
48
48
  "typescript": "^5.9.3",
49
49
  "vitest": "^5.0.5",
50
- "@theholocron/tsdown-config": "^8.9.0-alpha.4",
51
- "@theholocron/vitest-config": "^8.9.0-alpha.4",
50
+ "@theholocron/eslint-config": "^8.9.0-alpha.4",
52
51
  "@theholocron/tsconfig": "^8.9.0-alpha.4",
53
- "@theholocron/eslint-config": "^8.9.0-alpha.4"
52
+ "@theholocron/vitest-config": "^8.9.0-alpha.4",
53
+ "@theholocron/tsdown-config": "^8.9.0-alpha.4"
54
54
  },
55
55
  "engines": {
56
56
  "node": ">=22"