@c-time/frelio-dependency-map 1.0.0 → 1.2.0
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/guards.d.ts +5 -5
- package/dist/guards.js +4 -4
- package/dist/index.d.ts +8 -8
- package/dist/index.js +6 -6
- package/dist/schema.d.ts +3 -3
- package/dist/schema.js +2 -2
- package/dist/types.d.ts +1 -1
- package/dist/utils.d.ts +9 -9
- package/dist/utils.js +2 -2
- package/package.json +1 -1
package/dist/guards.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FrelioDependencyMap, ValidationResult } from './types.js';
|
|
2
2
|
/**
|
|
3
|
-
* Type guard to check if a value is a valid
|
|
3
|
+
* Type guard to check if a value is a valid FrelioDependencyMap
|
|
4
4
|
*/
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function isFrelioDependencyMap(value: unknown): value is FrelioDependencyMap;
|
|
6
6
|
/**
|
|
7
|
-
* Validates a value as a
|
|
7
|
+
* Validates a value as a FrelioDependencyMap and returns detailed errors
|
|
8
8
|
*/
|
|
9
|
-
export declare function
|
|
9
|
+
export declare function validateFrelioDependencyMap(value: unknown): ValidationResult;
|
package/dist/guards.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Type guard to check if a value is a valid
|
|
2
|
+
* Type guard to check if a value is a valid FrelioDependencyMap
|
|
3
3
|
*/
|
|
4
|
-
export function
|
|
4
|
+
export function isFrelioDependencyMap(value) {
|
|
5
5
|
if (value === null || typeof value !== 'object') {
|
|
6
6
|
return false;
|
|
7
7
|
}
|
|
@@ -24,9 +24,9 @@ export function isDependencyMap(value) {
|
|
|
24
24
|
return true;
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
|
-
* Validates a value as a
|
|
27
|
+
* Validates a value as a FrelioDependencyMap and returns detailed errors
|
|
28
28
|
*/
|
|
29
|
-
export function
|
|
29
|
+
export function validateFrelioDependencyMap(value) {
|
|
30
30
|
const errors = [];
|
|
31
31
|
if (value === null) {
|
|
32
32
|
errors.push({ path: '', message: 'Value is null' });
|
package/dist/index.d.ts
CHANGED
|
@@ -6,16 +6,16 @@
|
|
|
6
6
|
* @example
|
|
7
7
|
* ```typescript
|
|
8
8
|
* import {
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* FrelioDependencyMap,
|
|
10
|
+
* isFrelioDependencyMap,
|
|
11
|
+
* validateFrelioDependencyMap,
|
|
12
12
|
* findAffectedOutputs
|
|
13
13
|
* } from 'frelio-dependency-map'
|
|
14
14
|
*
|
|
15
15
|
* // Load and validate a dependency map
|
|
16
16
|
* const data = JSON.parse(fs.readFileSync('_dependency-map.json', 'utf-8'))
|
|
17
17
|
*
|
|
18
|
-
* if (
|
|
18
|
+
* if (isFrelioDependencyMap(data)) {
|
|
19
19
|
* // Type-safe access
|
|
20
20
|
* const affected = findAffectedOutputs(data, 'contents/published/article/my-post.json')
|
|
21
21
|
* console.log('Affected outputs:', affected)
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
*
|
|
25
25
|
* @packageDocumentation
|
|
26
26
|
*/
|
|
27
|
-
export type {
|
|
27
|
+
export type { FrelioDependencyMap, OutputPath, DependencyPath, DependencyPathPrefix, ValidationResult, ValidationError, } from './types.js';
|
|
28
28
|
export { DEPENDENCY_PATH_PREFIXES } from './types.js';
|
|
29
29
|
export { dependencyMapSchema } from './schema.js';
|
|
30
|
-
export type {
|
|
31
|
-
export {
|
|
32
|
-
export { getDependencyPaths, getOutputPaths, getAllDependencyPaths,
|
|
30
|
+
export type { FrelioDependencyMapSchema } from './schema.js';
|
|
31
|
+
export { isFrelioDependencyMap, validateFrelioDependencyMap } from './guards.js';
|
|
32
|
+
export { getDependencyPaths, getOutputPaths, getAllDependencyPaths, mergeFrelioDependencyMaps, findAffectedOutputs, createFrelioDependencyMap, setDependencies, removeDependencies, } from './utils.js';
|
package/dist/index.js
CHANGED
|
@@ -6,16 +6,16 @@
|
|
|
6
6
|
* @example
|
|
7
7
|
* ```typescript
|
|
8
8
|
* import {
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* FrelioDependencyMap,
|
|
10
|
+
* isFrelioDependencyMap,
|
|
11
|
+
* validateFrelioDependencyMap,
|
|
12
12
|
* findAffectedOutputs
|
|
13
13
|
* } from 'frelio-dependency-map'
|
|
14
14
|
*
|
|
15
15
|
* // Load and validate a dependency map
|
|
16
16
|
* const data = JSON.parse(fs.readFileSync('_dependency-map.json', 'utf-8'))
|
|
17
17
|
*
|
|
18
|
-
* if (
|
|
18
|
+
* if (isFrelioDependencyMap(data)) {
|
|
19
19
|
* // Type-safe access
|
|
20
20
|
* const affected = findAffectedOutputs(data, 'contents/published/article/my-post.json')
|
|
21
21
|
* console.log('Affected outputs:', affected)
|
|
@@ -28,6 +28,6 @@ export { DEPENDENCY_PATH_PREFIXES } from './types.js';
|
|
|
28
28
|
// Schema
|
|
29
29
|
export { dependencyMapSchema } from './schema.js';
|
|
30
30
|
// Type guards & validation
|
|
31
|
-
export {
|
|
31
|
+
export { isFrelioDependencyMap, validateFrelioDependencyMap } from './guards.js';
|
|
32
32
|
// Utilities
|
|
33
|
-
export { getDependencyPaths, getOutputPaths, getAllDependencyPaths,
|
|
33
|
+
export { getDependencyPaths, getOutputPaths, getAllDependencyPaths, mergeFrelioDependencyMaps, findAffectedOutputs, createFrelioDependencyMap, setDependencies, removeDependencies, } from './utils.js';
|
package/dist/schema.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* JSON Schema for
|
|
2
|
+
* JSON Schema for FrelioDependencyMap validation
|
|
3
3
|
*/
|
|
4
4
|
export declare const dependencyMapSchema: {
|
|
5
5
|
readonly $schema: "http://json-schema.org/draft-07/schema#";
|
|
6
|
-
readonly title: "
|
|
6
|
+
readonly title: "FrelioDependencyMap";
|
|
7
7
|
readonly description: "Maps output file paths to arrays of dependency paths for incremental builds";
|
|
8
8
|
readonly type: "object";
|
|
9
9
|
readonly additionalProperties: {
|
|
@@ -19,4 +19,4 @@ export declare const dependencyMapSchema: {
|
|
|
19
19
|
readonly '/articles/index.json': readonly ["content_types/article", "templates/article/list.html", "contents/*/article/*"];
|
|
20
20
|
}];
|
|
21
21
|
};
|
|
22
|
-
export type
|
|
22
|
+
export type FrelioDependencyMapSchema = typeof dependencyMapSchema;
|
package/dist/schema.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* JSON Schema for
|
|
2
|
+
* JSON Schema for FrelioDependencyMap validation
|
|
3
3
|
*/
|
|
4
4
|
export const dependencyMapSchema = {
|
|
5
5
|
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
6
|
-
title: '
|
|
6
|
+
title: 'FrelioDependencyMap',
|
|
7
7
|
description: 'Maps output file paths to arrays of dependency paths for incremental builds',
|
|
8
8
|
type: 'object',
|
|
9
9
|
additionalProperties: {
|
package/dist/types.d.ts
CHANGED
package/dist/utils.d.ts
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FrelioDependencyMap, DependencyPath, OutputPath } from './types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Gets the dependency paths for a specific output path
|
|
4
4
|
* Returns an empty array if the output path is not found
|
|
5
5
|
*/
|
|
6
|
-
export declare function getDependencyPaths(map:
|
|
6
|
+
export declare function getDependencyPaths(map: FrelioDependencyMap, outputPath: OutputPath): DependencyPath[];
|
|
7
7
|
/**
|
|
8
8
|
* Gets all output paths defined in the dependency map
|
|
9
9
|
*/
|
|
10
|
-
export declare function getOutputPaths(map:
|
|
10
|
+
export declare function getOutputPaths(map: FrelioDependencyMap): OutputPath[];
|
|
11
11
|
/**
|
|
12
12
|
* Gets all unique dependency paths across all outputs
|
|
13
13
|
*/
|
|
14
|
-
export declare function getAllDependencyPaths(map:
|
|
14
|
+
export declare function getAllDependencyPaths(map: FrelioDependencyMap): DependencyPath[];
|
|
15
15
|
/**
|
|
16
16
|
* Merges multiple dependency maps into one
|
|
17
17
|
* Later maps override earlier ones for the same output path
|
|
18
18
|
*/
|
|
19
|
-
export declare function
|
|
19
|
+
export declare function mergeFrelioDependencyMaps(...maps: FrelioDependencyMap[]): FrelioDependencyMap;
|
|
20
20
|
/**
|
|
21
21
|
* Finds all output paths that depend on a given dependency path
|
|
22
22
|
* Supports exact match and simple glob pattern matching
|
|
23
23
|
*/
|
|
24
|
-
export declare function findAffectedOutputs(map:
|
|
24
|
+
export declare function findAffectedOutputs(map: FrelioDependencyMap, changedPath: DependencyPath): OutputPath[];
|
|
25
25
|
/**
|
|
26
26
|
* Creates an empty dependency map
|
|
27
27
|
*/
|
|
28
|
-
export declare function
|
|
28
|
+
export declare function createFrelioDependencyMap(): FrelioDependencyMap;
|
|
29
29
|
/**
|
|
30
30
|
* Adds or updates dependencies for an output path
|
|
31
31
|
*/
|
|
32
|
-
export declare function setDependencies(map:
|
|
32
|
+
export declare function setDependencies(map: FrelioDependencyMap, outputPath: OutputPath, dependencies: DependencyPath[]): FrelioDependencyMap;
|
|
33
33
|
/**
|
|
34
34
|
* Removes an output path from the dependency map
|
|
35
35
|
*/
|
|
36
|
-
export declare function removeDependencies(map:
|
|
36
|
+
export declare function removeDependencies(map: FrelioDependencyMap, outputPath: OutputPath): FrelioDependencyMap;
|
package/dist/utils.js
CHANGED
|
@@ -27,7 +27,7 @@ export function getAllDependencyPaths(map) {
|
|
|
27
27
|
* Merges multiple dependency maps into one
|
|
28
28
|
* Later maps override earlier ones for the same output path
|
|
29
29
|
*/
|
|
30
|
-
export function
|
|
30
|
+
export function mergeFrelioDependencyMaps(...maps) {
|
|
31
31
|
const result = {};
|
|
32
32
|
for (const map of maps) {
|
|
33
33
|
for (const [outputPath, deps] of Object.entries(map)) {
|
|
@@ -78,7 +78,7 @@ function matchesDependencyPath(pattern, path) {
|
|
|
78
78
|
/**
|
|
79
79
|
* Creates an empty dependency map
|
|
80
80
|
*/
|
|
81
|
-
export function
|
|
81
|
+
export function createFrelioDependencyMap() {
|
|
82
82
|
return {};
|
|
83
83
|
}
|
|
84
84
|
/**
|