@c-time/frelio-dependency-map 1.2.1 → 1.3.17
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/README.md +86 -0
- package/package.json +5 -2
package/README.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# @c-time/frelio-dependency-map
|
|
2
|
+
|
|
3
|
+
Frelio SSG の依存マップ(dependency-map)の型定義とユーティリティ。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 概要
|
|
8
|
+
|
|
9
|
+
依存マップは、各出力ファイルがどのソースファイル(テンプレート、コンテンツタイプ定義、コンテンツデータ)に依存しているかを追跡する。これにより、ソースファイルの変更時に影響を受ける出力のみを再生成する差分ビルドが可能になる。
|
|
10
|
+
|
|
11
|
+
ランタイム依存なし。
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## インストール
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @c-time/frelio-dependency-map
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 使用例
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import {
|
|
27
|
+
createFrelioDependencyMap,
|
|
28
|
+
setDependencies,
|
|
29
|
+
findAffectedOutputs,
|
|
30
|
+
mergeFrelioDependencyMaps,
|
|
31
|
+
isFrelioDependencyMap,
|
|
32
|
+
} from '@c-time/frelio-dependency-map'
|
|
33
|
+
import type { FrelioDependencyMap } from '@c-time/frelio-dependency-map'
|
|
34
|
+
|
|
35
|
+
// 依存マップの作成
|
|
36
|
+
let map = createFrelioDependencyMap()
|
|
37
|
+
|
|
38
|
+
// 出力ファイルの依存を設定
|
|
39
|
+
map = setDependencies(map, '/news/hello.html', [
|
|
40
|
+
'content_types/news.json',
|
|
41
|
+
'templates/news/detail/index.html',
|
|
42
|
+
'contents/published/news/hello.json',
|
|
43
|
+
])
|
|
44
|
+
|
|
45
|
+
// ソースファイル変更時に影響を受ける出力を検索(glob パターン対応)
|
|
46
|
+
const affected = findAffectedOutputs(map, 'templates/news/detail/index.html')
|
|
47
|
+
// => ['/news/hello.html']
|
|
48
|
+
|
|
49
|
+
// 複数マップのマージ
|
|
50
|
+
const merged = mergeFrelioDependencyMaps(map1, map2)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## API
|
|
56
|
+
|
|
57
|
+
### 型
|
|
58
|
+
|
|
59
|
+
| 型 | 説明 |
|
|
60
|
+
|----|------|
|
|
61
|
+
| `FrelioDependencyMap` | 出力パス → 依存パス配列のマッピング |
|
|
62
|
+
| `OutputPath` | 出力ファイルパス |
|
|
63
|
+
| `DependencyPath` | 依存ファイルパス(glob パターン対応) |
|
|
64
|
+
| `DependencyPathPrefix` | 依存パスのプレフィックス定数(`CONTENT_TYPES`, `TEMPLATES`, `CONTENTS`) |
|
|
65
|
+
| `ValidationResult` / `ValidationError` | バリデーション結果 |
|
|
66
|
+
|
|
67
|
+
### 関数
|
|
68
|
+
|
|
69
|
+
| 関数 | 説明 |
|
|
70
|
+
|------|------|
|
|
71
|
+
| `createFrelioDependencyMap()` | 空の依存マップを作成 |
|
|
72
|
+
| `setDependencies(map, output, deps)` | 出力ファイルの依存を設定 |
|
|
73
|
+
| `removeDependencies(map, output)` | 出力ファイルの依存を削除 |
|
|
74
|
+
| `getDependencyPaths(map, output)` | 出力ファイルの依存パスを取得 |
|
|
75
|
+
| `getOutputPaths(map)` | 全出力パスを取得 |
|
|
76
|
+
| `getAllDependencyPaths(map)` | 全依存パスを取得 |
|
|
77
|
+
| `findAffectedOutputs(map, changed)` | 変更されたファイルに影響を受ける出力を検索 |
|
|
78
|
+
| `mergeFrelioDependencyMaps(...maps)` | 複数の依存マップをマージ |
|
|
79
|
+
| `isFrelioDependencyMap(value)` | 型ガード |
|
|
80
|
+
| `validateFrelioDependencyMap(value)` | バリデーション |
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## ライセンス
|
|
85
|
+
|
|
86
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c-time/frelio-dependency-map",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.17",
|
|
4
4
|
"description": "Type definitions and utilities for frelio dependency map files",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -23,6 +23,8 @@
|
|
|
23
23
|
"scripts": {
|
|
24
24
|
"build": "tsup",
|
|
25
25
|
"dev": "tsup --watch",
|
|
26
|
+
"test": "vitest run",
|
|
27
|
+
"test:watch": "vitest",
|
|
26
28
|
"prepublishOnly": "npm run build"
|
|
27
29
|
},
|
|
28
30
|
"publishConfig": {
|
|
@@ -43,7 +45,8 @@
|
|
|
43
45
|
"license": "MIT",
|
|
44
46
|
"devDependencies": {
|
|
45
47
|
"tsup": "^8.5.0",
|
|
46
|
-
"typescript": "^5.7.0"
|
|
48
|
+
"typescript": "^5.7.0",
|
|
49
|
+
"vitest": "^4.0.18"
|
|
47
50
|
},
|
|
48
51
|
"engines": {
|
|
49
52
|
"node": ">=18"
|