@cloudcannon/configuration-loader 0.0.7 → 0.0.9

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/browser.d.ts CHANGED
@@ -17,4 +17,3 @@
17
17
  export type { Configuration, StructureValue } from '@cloudcannon/configuration-types';
18
18
  export { mergeConfiguration } from './loader.ts';
19
19
  export type { GlobLoaderWarnings, GlobResult, GlobTypeKey, MergeConfigurationOptions, } from './types.ts';
20
- //# sourceMappingURL=browser.d.ts.map
@@ -14,17 +14,5 @@
14
14
  * });
15
15
  * ```
16
16
  */
17
-
18
- // Re-export useful types from configuration-types for convenience
19
- export type { Configuration, StructureValue } from '@cloudcannon/configuration-types';
20
-
21
17
  // Export the core merge function (no Node.js dependencies)
22
- export { mergeConfiguration } from './loader.ts';
23
-
24
- // Export types from dedicated types file
25
- export type {
26
- GlobLoaderWarnings,
27
- GlobResult,
28
- GlobTypeKey,
29
- MergeConfigurationOptions,
30
- } from './types.ts';
18
+ export { mergeConfiguration } from "./loader.js";
package/dist/index.d.ts CHANGED
@@ -21,4 +21,3 @@ export type { Configuration, StructureValue } from '@cloudcannon/configuration-t
21
21
  export { type LoadConfigurationOptions, loadConfiguration } from './load.ts';
22
22
  export { mergeConfiguration } from './loader.ts';
23
23
  export type { GlobLoaderWarnings, GlobResult, GlobTypeKey, MergeConfigurationOptions, } from './types.ts';
24
- //# sourceMappingURL=index.d.ts.map
@@ -17,20 +17,7 @@
17
17
  * console.log(result.config);
18
18
  * ```
19
19
  */
20
-
21
- // Re-export useful types from configuration-types for convenience
22
- export type { Configuration, StructureValue } from '@cloudcannon/configuration-types';
23
-
24
20
  // Export the simple high-level API
25
- export { type LoadConfigurationOptions, loadConfiguration } from './load.ts';
26
-
21
+ export { loadConfiguration } from "./load.js";
27
22
  // Export the lower-level API for custom implementations
28
- export { mergeConfiguration } from './loader.ts';
29
-
30
- // Export types from dedicated types file
31
- export type {
32
- GlobLoaderWarnings,
33
- GlobResult,
34
- GlobTypeKey,
35
- MergeConfigurationOptions,
36
- } from './types.ts';
23
+ export { mergeConfiguration } from "./loader.js";
package/dist/load.d.ts CHANGED
@@ -33,4 +33,3 @@ export interface LoadConfigurationOptions {
33
33
  * ```
34
34
  */
35
35
  export declare function loadConfiguration(configPath: string, options?: LoadConfigurationOptions): Promise<GlobResult>;
36
- //# sourceMappingURL=load.d.ts.map
package/dist/load.js ADDED
@@ -0,0 +1,103 @@
1
+ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
2
+ if (typeof path === "string" && /^\.\.?\//.test(path)) {
3
+ return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
4
+ return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
5
+ });
6
+ }
7
+ return path;
8
+ };
9
+ import { globSync } from 'node:fs';
10
+ import { readFile } from 'node:fs/promises';
11
+ import { dirname, resolve } from 'node:path';
12
+ import { mergeConfiguration } from "./loader.js";
13
+ /**
14
+ * Attempts to load the js-yaml package dynamically.
15
+ * Returns the load function if available, otherwise returns undefined.
16
+ */
17
+ async function tryLoadYamlParser() {
18
+ try {
19
+ // Use a variable to prevent TypeScript from trying to resolve the module statically
20
+ const jsYamlModuleName = 'js-yaml';
21
+ const jsYaml = (await import(__rewriteRelativeImportExtension(jsYamlModuleName)));
22
+ return jsYaml.load;
23
+ }
24
+ catch {
25
+ return undefined;
26
+ }
27
+ }
28
+ /**
29
+ * Creates a file parser that handles JSON and YAML files.
30
+ */
31
+ async function createDefaultParser() {
32
+ const yamlParse = await tryLoadYamlParser();
33
+ return (contents, filePath) => {
34
+ if (filePath.endsWith('.json')) {
35
+ return JSON.parse(contents);
36
+ }
37
+ if (filePath.endsWith('.yml') || filePath.endsWith('.yaml')) {
38
+ if (!yamlParse) {
39
+ throw new Error(`Cannot parse YAML file "${filePath}". Install js-yaml: npm install js-yaml`);
40
+ }
41
+ return yamlParse(contents);
42
+ }
43
+ // Try JSON first, then YAML if available
44
+ try {
45
+ return JSON.parse(contents);
46
+ }
47
+ catch {
48
+ if (yamlParse) {
49
+ return yamlParse(contents);
50
+ }
51
+ throw new Error(`Cannot parse file "${filePath}". Install js-yaml for YAML support: npm install js-yaml`);
52
+ }
53
+ };
54
+ }
55
+ /**
56
+ * Loads and merges a CloudCannon configuration file with all its split configuration files.
57
+ *
58
+ * This is the simplest way to load CloudCannon configuration. It handles:
59
+ * - Reading the configuration file from disk
60
+ * - Parsing YAML and JSON files
61
+ * - Finding files matching glob patterns
62
+ * - Merging all configuration into a single object
63
+ *
64
+ * @param configPath - Path to the CloudCannon configuration file (e.g., 'cloudcannon.config.yml')
65
+ * @param options - Optional configuration options
66
+ * @returns A promise resolving to the merged configuration with metadata
67
+ *
68
+ * @example
69
+ * ```typescript
70
+ * import { loadConfiguration } from '@cloudcannon/configuration-loader';
71
+ *
72
+ * const result = await loadConfiguration('cloudcannon.config.yml');
73
+ * console.log(result.config);
74
+ * ```
75
+ */
76
+ export async function loadConfiguration(configPath, options) {
77
+ const parseFile = options?.parseFile ?? (await createDefaultParser());
78
+ const absoluteConfigPath = resolve(configPath);
79
+ const configDir = dirname(absoluteConfigPath);
80
+ // Load and parse the base configuration file
81
+ const configContents = await readFile(absoluteConfigPath, 'utf8');
82
+ const config = (await parseFile(configContents, absoluteConfigPath));
83
+ // Create the merge options with default implementations
84
+ const mergeOptions = {
85
+ // Note: globSync is used here because the interface is synchronous by design.
86
+ // Glob operations are typically fast (just directory traversal), while file
87
+ // reading (handled by loadConfigFile) is the slower I/O operation.
88
+ findFilesMatchingGlobs: (globs) => {
89
+ const resolvedGlobs = globs.map((g) => {
90
+ if (g.startsWith('!')) {
91
+ return `!${resolve(configDir, g.slice(1))}`;
92
+ }
93
+ return resolve(configDir, g);
94
+ });
95
+ return globSync(resolvedGlobs);
96
+ },
97
+ loadConfigFile: async (filePath) => {
98
+ const contents = await readFile(filePath, 'utf8');
99
+ return await parseFile(contents, filePath);
100
+ },
101
+ };
102
+ return mergeConfiguration(config, mergeOptions);
103
+ }
package/dist/loader.d.ts CHANGED
@@ -30,4 +30,3 @@ export type { GlobLoaderWarnings, GlobResult, GlobTypeKey, MergeConfigurationOpt
30
30
  * ```
31
31
  */
32
32
  export declare function mergeConfiguration(config: Configuration, options: MergeConfigurationOptions): Promise<GlobResult>;
33
- //# sourceMappingURL=loader.d.ts.map
package/dist/loader.js ADDED
@@ -0,0 +1,364 @@
1
+ function isObject(maybeObject) {
2
+ return maybeObject !== null && typeof maybeObject === 'object' && !Array.isArray(maybeObject);
3
+ }
4
+ class ConfigurationLoader {
5
+ warnings;
6
+ pathsToGlobKey = {};
7
+ globKeyToPaths = {
8
+ _structures_from_glob: new Set(),
9
+ values_from_glob: new Set(),
10
+ _snippets_from_glob: new Set(),
11
+ _snippets_imports_from_glob: new Set(),
12
+ _snippets_templates_from_glob: new Set(),
13
+ _snippets_definitions_from_glob: new Set(),
14
+ _inputs_from_glob: new Set(),
15
+ _editables_from_glob: new Set(),
16
+ collections_config_from_glob: new Set(),
17
+ schemas_from_glob: new Set(),
18
+ };
19
+ globPatterns;
20
+ findFilesMatchingGlobs;
21
+ loadConfigFile;
22
+ constructor(findFilesMatchingGlobs, loadConfigFile) {
23
+ this.warnings = {
24
+ cycles: [],
25
+ multipleGlobKeys: [],
26
+ arrayValues: [],
27
+ };
28
+ this.globPatterns = new Set();
29
+ this.findFilesMatchingGlobs = findFilesMatchingGlobs;
30
+ this.loadConfigFile = loadConfigFile;
31
+ }
32
+ /**
33
+ * Loads and merges configuration from files matching glob patterns.
34
+ * Processes all *_from_glob keys in the configuration.
35
+ * Recursively processes globs in loaded files as well.
36
+ * Also extracts glob patterns from loaded files for change detection.
37
+ */
38
+ async mergeConfiguration(config) {
39
+ this.warnings = {
40
+ cycles: [],
41
+ multipleGlobKeys: [],
42
+ arrayValues: [],
43
+ };
44
+ this.globPatterns.clear();
45
+ // Process root-level glob keys in the correct order
46
+ await this.importFromGlobKey(config, '_snippets_from_glob', '_snippets', false);
47
+ await this.importFromGlobKey(config, '_snippets_imports_from_glob', '_snippets_imports', false);
48
+ await this.importFromGlobKey(config, '_snippets_templates_from_glob', '_snippets_templates', false);
49
+ await this.importFromGlobKey(config, '_snippets_definitions_from_glob', '_snippets_definitions', false);
50
+ await this.importFromGlobKey(config, 'collections_config_from_glob', 'collections_config', false);
51
+ await this.importFromGlobKey(config, '_inputs_from_glob', '_inputs', false);
52
+ await this.importFromGlobKey(config, '_editables_from_glob', '_editables', false);
53
+ await this.importFromGlobKey(config, '_structures_from_glob', '_structures', false);
54
+ await this.processInputsKey(config._inputs);
55
+ await this.processStructuresKey(config._structures);
56
+ // Process nested globs in collections_config
57
+ // Collections can have: schemas_from_glob, _inputs_from_glob, _structures_from_glob
58
+ if (config.collections_config && isObject(config.collections_config)) {
59
+ for (const [collectionKey, collectionConfig] of Object.entries(config.collections_config)) {
60
+ if (isObject(collectionConfig)) {
61
+ // Process schemas_from_glob (first in collections)
62
+ if ('schemas_from_glob' in collectionConfig) {
63
+ await this.importFromGlobKey(collectionConfig, 'schemas_from_glob', 'schemas', false);
64
+ }
65
+ const collection = config.collections_config[collectionKey];
66
+ await this.importFromGlobKey(collection, '_inputs_from_glob', '_inputs', false);
67
+ await this.importFromGlobKey(collection, '_editables_from_glob', '_editables', false);
68
+ await this.importFromGlobKey(collection, '_structures_from_glob', '_structures', false);
69
+ await this.processInputsKey(collection._inputs);
70
+ await this.processStructuresKey(collection._structures);
71
+ if (isObject(collection.create)) {
72
+ await this.importFromGlobKey(collection.create, '_inputs_from_glob', '_inputs', false);
73
+ await this.importFromGlobKey(collection.create, '_structures_from_glob', '_structures', false);
74
+ await this.processInputsKey(collection.create._inputs);
75
+ await this.processStructuresKey(collection.create._structures);
76
+ }
77
+ // Process recursive globs in schemas
78
+ if (isObject(collection.schemas)) {
79
+ for (const schemaValue of Object.values(collection.schemas)) {
80
+ if (isObject(schemaValue)) {
81
+ await this.importFromGlobKey(schemaValue, '_inputs_from_glob', '_inputs', false);
82
+ await this.importFromGlobKey(schemaValue, '_editables_from_glob', '_editables', false);
83
+ await this.importFromGlobKey(schemaValue, '_structures_from_glob', '_structures', false);
84
+ await this.processInputsKey(schemaValue._inputs);
85
+ await this.processStructuresKey(schemaValue._structures);
86
+ if (isObject(schemaValue.create)) {
87
+ await this.importFromGlobKey(schemaValue.create, '_inputs_from_glob', '_inputs', false);
88
+ await this.importFromGlobKey(schemaValue.create, '_structures_from_glob', '_structures', false);
89
+ await this.processInputsKey(schemaValue.create._inputs);
90
+ await this.processStructuresKey(schemaValue.create._structures);
91
+ }
92
+ }
93
+ }
94
+ }
95
+ }
96
+ }
97
+ }
98
+ // Process recursive globs in _snippets (can have _inputs_from_glob)
99
+ if (config._snippets && isObject(config._snippets)) {
100
+ await this.importFromGlobKey(config._snippets, '_inputs_from_glob', '_inputs', false);
101
+ for (const snippetConfig of Object.values(config._snippets)) {
102
+ if (isObject(snippetConfig)) {
103
+ await this.importFromGlobKey(snippetConfig, '_inputs_from_glob', '_inputs', false);
104
+ await this.importFromGlobKey(snippetConfig, '_structures_from_glob', '_structures', false);
105
+ await this.processInputsKey(snippetConfig._inputs);
106
+ await this.processStructuresKey(snippetConfig._structures);
107
+ }
108
+ }
109
+ }
110
+ return config;
111
+ }
112
+ /*
113
+ * Process recursive globs in _inputs (can have _structures_from_glob)
114
+ * @param inputs - The _inputs key to process
115
+ * @returns A promise that resolves when the inputs key has been processed
116
+ */
117
+ async processInputsKey(inputs, visited) {
118
+ if (inputs && isObject(inputs)) {
119
+ for (const inputValue of Object.values(inputs)) {
120
+ if (isObject(inputValue) && isObject(inputValue.options)) {
121
+ const structures = inputValue.options?.structures;
122
+ const visitedLocal = visited || new Set();
123
+ if (structures && isObject(structures)) {
124
+ if (structures.values_from_glob) {
125
+ await this.importFromGlobKey(structures, 'values_from_glob', 'values', true, visitedLocal);
126
+ }
127
+ if (Array.isArray(structures.values)) {
128
+ await Promise.all(structures.values.map(async (value) => this.processStructureValue(value, visitedLocal)));
129
+ }
130
+ }
131
+ }
132
+ }
133
+ }
134
+ }
135
+ async processStructuresKey(structures, visited) {
136
+ if (!structures || !isObject(structures)) {
137
+ return;
138
+ }
139
+ await Promise.all(Object.values(structures).map(async (structure) => {
140
+ if (!isObject(structure)) {
141
+ return;
142
+ }
143
+ const visitedLocal = visited || new Set();
144
+ await this.importFromGlobKey(structure, 'values_from_glob', 'values', true, visitedLocal);
145
+ if (structure.values && Array.isArray(structure.values)) {
146
+ await Promise.all(structure.values.map(async (value) => this.processStructureValue(value, visitedLocal)));
147
+ }
148
+ }));
149
+ }
150
+ async processStructureValue(structureValue, visited) {
151
+ if (!structureValue || !isObject(structureValue)) {
152
+ return;
153
+ }
154
+ if (structureValue._inputs_from_glob) {
155
+ await this.importFromGlobKey(structureValue, '_inputs_from_glob', '_inputs', false, visited);
156
+ }
157
+ if (structureValue._inputs) {
158
+ await this.processInputsKey(structureValue._inputs, visited);
159
+ }
160
+ }
161
+ /**
162
+ * Processes a glob key by loading files and merging them with the target key.
163
+ * Supports recursive processing with cycle detection.
164
+ */
165
+ async importFromGlobKey(config, globKey, targetKey, isArray, visited) {
166
+ const globs = config[globKey];
167
+ if (!Array.isArray(globs)) {
168
+ return;
169
+ }
170
+ globs.forEach((pattern) => {
171
+ if (typeof pattern === 'string' && !pattern.startsWith('!')) {
172
+ this.globPatterns.add(pattern);
173
+ }
174
+ });
175
+ const loadedDataWithSources = await this.loadFilesFromGlobs(globs, globKey, visited);
176
+ if (isArray) {
177
+ config[targetKey] = this.mergeArrayValues((config[targetKey] || []), loadedDataWithSources);
178
+ }
179
+ else {
180
+ config[targetKey] = this.mergeObjectValues((config[targetKey] || {}), loadedDataWithSources);
181
+ }
182
+ delete config[globKey];
183
+ }
184
+ /**
185
+ * Loads configuration data from files matching the given glob patterns.
186
+ * Returns an array of parsed configuration objects with source tracking.
187
+ */
188
+ async loadFilesFromGlobs(globs, globKey, visited) {
189
+ const matchingFiles = this.findFilesMatchingGlobs(globs);
190
+ // Sort by path to ensure consistent ordering
191
+ matchingFiles.sort((a, b) => a.localeCompare(b));
192
+ const loadedData = [];
193
+ for (const filePath of matchingFiles) {
194
+ if (visited?.has(filePath)) {
195
+ this.warnings.cycles.push({
196
+ path: filePath,
197
+ chain: Array.from(visited),
198
+ });
199
+ continue;
200
+ }
201
+ const existingGlobKey = this.pathsToGlobKey[filePath];
202
+ if (existingGlobKey && existingGlobKey !== globKey) {
203
+ this.warnings.multipleGlobKeys.push({
204
+ path: filePath,
205
+ type1: existingGlobKey,
206
+ type2: globKey,
207
+ });
208
+ continue;
209
+ }
210
+ this.pathsToGlobKey[filePath] = globKey;
211
+ this.globKeyToPaths[globKey].add(filePath);
212
+ visited?.add(filePath);
213
+ try {
214
+ const data = await this.loadConfigFile(filePath);
215
+ if (data !== undefined && data !== null) {
216
+ const clonedData = JSON.parse(JSON.stringify(data));
217
+ // Handle both single objects and arrays
218
+ if (Array.isArray(clonedData)) {
219
+ this.warnings.arrayValues.push({
220
+ path: filePath,
221
+ });
222
+ }
223
+ else {
224
+ loadedData.push({ data: clonedData, source: filePath });
225
+ }
226
+ }
227
+ }
228
+ catch {
229
+ // Log error but continue processing other files
230
+ }
231
+ }
232
+ return loadedData;
233
+ }
234
+ /**
235
+ * Merges object values from globbed files.
236
+ * Later files overwrite earlier ones for the same keys.
237
+ * Adds __source__ metadata to track where each key came from.
238
+ */
239
+ mergeObjectValues(base, loaded) {
240
+ const result = { ...base };
241
+ for (const { data: item, source } of loaded) {
242
+ if (isObject(item)) {
243
+ // For objects, merge keys (later overwrites earlier)
244
+ // Add __source__ to each key that gets added/overwritten
245
+ for (const [key, value] of Object.entries(item)) {
246
+ if (isObject(value)) {
247
+ // Add __source__ to nested objects (e.g., input definitions, schema configs)
248
+ result[key] = {
249
+ ...value,
250
+ __source__: source,
251
+ };
252
+ }
253
+ else {
254
+ // For primitive values, just assign the value
255
+ // The source is tracked at the key level via __sources__ if needed
256
+ result[key] = value;
257
+ }
258
+ }
259
+ }
260
+ }
261
+ return result;
262
+ }
263
+ /**
264
+ * Merges array values from globbed files.
265
+ * Arrays are appended (no overwriting since arrays aren't keyed).
266
+ * Adds __source__ metadata to track where each item came from.
267
+ */
268
+ mergeArrayValues(base, loaded) {
269
+ const result = [...base];
270
+ for (const { data: item, source } of loaded) {
271
+ if (Array.isArray(item)) {
272
+ // If the loaded item is an array, add source to each element
273
+ for (const element of item) {
274
+ if (isObject(element)) {
275
+ result.push({
276
+ ...element,
277
+ __source__: source,
278
+ });
279
+ }
280
+ else {
281
+ // Otherwise, add it as a single item
282
+ // This cannot be tracked with __source__ since it's not an object
283
+ result.push(element);
284
+ }
285
+ }
286
+ }
287
+ else if (isObject(item)) {
288
+ // Add __source__ to object items
289
+ result.push({
290
+ ...item,
291
+ __source__: source,
292
+ });
293
+ }
294
+ else {
295
+ // Otherwise, add it as a single item
296
+ // This cannot be tracked with __source__ since it's not an object
297
+ result.push(item);
298
+ }
299
+ }
300
+ return result;
301
+ }
302
+ }
303
+ function removeDuplicateWarnings(warnings) {
304
+ const result = {
305
+ cycles: [],
306
+ multipleGlobKeys: [],
307
+ arrayValues: [],
308
+ };
309
+ for (const warning of warnings.cycles) {
310
+ if (!result.cycles.some((w) => w.path === warning.path && w.chain.join(' → ') === warning.chain.join(' → '))) {
311
+ result.cycles.push(warning);
312
+ }
313
+ }
314
+ for (const warning of warnings.multipleGlobKeys) {
315
+ if (!result.multipleGlobKeys.some((w) => w.path === warning.path && w.type1 === warning.type1 && w.type2 === warning.type2)) {
316
+ result.multipleGlobKeys.push(warning);
317
+ }
318
+ }
319
+ for (const warning of warnings.arrayValues) {
320
+ if (!result.arrayValues.some((w) => w.path === warning.path)) {
321
+ result.arrayValues.push(warning);
322
+ }
323
+ }
324
+ return result;
325
+ }
326
+ /**
327
+ * Merges split CloudCannon configuration files into a single configuration object.
328
+ *
329
+ * This function processes `*_from_glob` keys in the configuration, loading and merging
330
+ * configuration from files matching the specified glob patterns. This allows you to
331
+ * split your CloudCannon configuration across multiple files for better organization.
332
+ *
333
+ * @param config - The base CloudCannon configuration object
334
+ * @param options - Options for loading configuration files
335
+ * @returns A promise resolving to the merged configuration with metadata
336
+ *
337
+ * @example
338
+ * ```typescript
339
+ * import { mergeConfiguration } from '@cloudcannon/configuration-loader';
340
+ * import { globSync } from 'glob';
341
+ * import { readFileSync } from 'fs';
342
+ * import YAML from 'yaml';
343
+ *
344
+ * const baseConfig = YAML.parse(readFileSync('cloudcannon.config.yml', 'utf8'));
345
+ *
346
+ * const result = await mergeConfiguration(baseConfig, {
347
+ * findFilesMatchingGlobs: (globs) => globSync(globs, { ignore: globs.filter(g => g.startsWith('!')).map(g => g.slice(1)) }),
348
+ * loadConfigFile: async (filePath) => YAML.parse(readFileSync(filePath, 'utf8'))
349
+ * });
350
+ *
351
+ * console.log(result.config); // Merged configuration
352
+ * ```
353
+ */
354
+ export async function mergeConfiguration(config, options) {
355
+ const loader = new ConfigurationLoader(options.findFilesMatchingGlobs, options.loadConfigFile);
356
+ const result = await loader.mergeConfiguration(JSON.parse(JSON.stringify(config)));
357
+ return {
358
+ config: result,
359
+ warnings: removeDuplicateWarnings(loader.warnings),
360
+ globPatterns: Array.from(loader.globPatterns),
361
+ pathsToGlobKey: loader.pathsToGlobKey,
362
+ globKeyToPaths: loader.globKeyToPaths,
363
+ };
364
+ }
package/dist/types.d.ts CHANGED
@@ -92,4 +92,3 @@ export interface MergeConfigurationOptions {
92
92
  */
93
93
  loadConfigFile: (filePath: string) => Promise<unknown>;
94
94
  }
95
- //# sourceMappingURL=types.d.ts.map
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudcannon/configuration-loader",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "description": "Load and merge CloudCannon configuration files",
5
5
  "type": "module",
6
6
  "engines": {
@@ -10,33 +10,31 @@
10
10
  ".": {
11
11
  "import": {
12
12
  "types": "./dist/index.d.ts",
13
- "default": "./src/index.ts"
13
+ "default": "./dist/index.js"
14
14
  }
15
15
  },
16
16
  "./browser": {
17
17
  "import": {
18
18
  "types": "./dist/browser.d.ts",
19
- "default": "./src/browser.ts"
19
+ "default": "./dist/browser.js"
20
20
  }
21
21
  }
22
22
  },
23
+ "main": "dist/index.js",
23
24
  "types": "./dist/index.d.ts",
24
25
  "files": [
25
- "src",
26
26
  "dist"
27
27
  ],
28
28
  "publishConfig": {
29
29
  "access": "public"
30
30
  },
31
31
  "scripts": {
32
- "typecheck": "tsc --noEmit",
33
- "build:types": "tsc --emitDeclarationOnly",
34
- "build": "npm run build:types",
32
+ "build": "tsc",
35
33
  "test": "node --experimental-strip-types --test src/**/*.test.ts",
36
34
  "test:watch": "node --experimental-strip-types --watch --test",
37
35
  "test:coverage": "node --experimental-strip-types --experimental-test-coverage --test src/**/*.test.ts",
38
- "lint": "biome check src/",
39
- "lint:fix": "biome check --write src/",
36
+ "lint": "biome check src/ && tsc --noEmit",
37
+ "lint:fix": "biome check --fix src/",
40
38
  "format": "biome format --write src/",
41
39
  "prepublishOnly": "npm run build"
42
40
  },
@@ -54,7 +52,7 @@
54
52
  },
55
53
  "homepage": "https://cloudcannon.com/documentation/articles/why-split-your-configuration-file/",
56
54
  "dependencies": {
57
- "@cloudcannon/configuration-types": "0.0.56"
55
+ "@cloudcannon/configuration-types": "0.0.58"
58
56
  },
59
57
  "peerDependencies": {
60
58
  "js-yaml": "^4.0.0"
@@ -1 +0,0 @@
1
- {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAGtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGjD,YAAY,EACX,kBAAkB,EAClB,UAAU,EACV,WAAW,EACX,yBAAyB,GACzB,MAAM,YAAY,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAGtF,OAAO,EAAE,KAAK,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAG7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGjD,YAAY,EACX,kBAAkB,EAClB,UAAU,EACV,WAAW,EACX,yBAAyB,GACzB,MAAM,YAAY,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../src/load.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAA6B,MAAM,YAAY,CAAC;AAExE;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACxC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC/E;AAmDD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,iBAAiB,CACtC,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,wBAAwB,GAChC,OAAO,CAAC,UAAU,CAAC,CA+BrB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAkB,MAAM,kCAAkC,CAAC;AACtF,OAAO,KAAK,EACX,kBAAkB,EAClB,UAAU,EACV,WAAW,EACX,yBAAyB,EACzB,MAAM,YAAY,CAAC;AAEpB,YAAY,EAAE,kBAAkB,EAAE,UAAU,EAAE,WAAW,EAAE,yBAAyB,EAAE,CAAC;AAwdvF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,kBAAkB,CACvC,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,yBAAyB,GAChC,OAAO,CAAC,UAAU,CAAC,CAarB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEtE;;GAEG;AACH,MAAM,MAAM,WAAW,GACpB,uBAAuB,GACvB,kBAAkB,GAClB,qBAAqB,GACrB,6BAA6B,GAC7B,+BAA+B,GAC/B,iCAAiC,GACjC,mBAAmB,GACnB,sBAAsB,GACtB,8BAA8B,GAC9B,mBAAmB,CAAC;AAEvB;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IAClC;;;;;;;;;;;;OAYG;IACH,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,EAAE,CAAC;IAE5C;;;;;;;;;;;;;;OAcG;IACH,gBAAgB,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,WAAW,CAAC;QAAC,KAAK,EAAE,WAAW,CAAA;KAAE,EAAE,CAAC;IAE7E;;;;;;;;;;;OAWG;IACH,WAAW,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B,sCAAsC;IACtC,MAAM,EAAE,aAAa,CAAC;IACtB,iEAAiE;IACjE,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,yDAAyD;IACzD,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,oEAAoE;IACpE,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC5C,uEAAuE;IACvE,cAAc,EAAE,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;CACjD;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACzC;;;;OAIG;IACH,sBAAsB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,MAAM,EAAE,CAAC;IACtD;;;OAGG;IACH,cAAc,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACvD"}