@notion-headless-cms/core 0.3.8 → 0.3.10
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/cache/memory.d.mts +2 -50
- package/dist/cache/memory.mjs +59 -45
- package/dist/cache/memory.mjs.map +1 -1
- package/dist/{content-DyrOwjbA.d.mts → content-Bffid8da.d.mts} +6 -16
- package/dist/{hooks-CPRRo9IN.d.mts → hooks-CqqVxrYg.d.mts} +2 -2
- package/dist/hooks.d.mts +1 -1
- package/dist/index.d.mts +158 -306
- package/dist/index.mjs +262 -364
- package/dist/index.mjs.map +1 -1
- package/dist/memory-CA1uTRbr.d.mts +146 -0
- package/package.json +4 -8
- package/dist/cache/noop.d.mts +0 -11
- package/dist/cache/noop.mjs +0 -50
- package/dist/cache/noop.mjs.map +0 -1
- package/dist/cache-QrXdXYMs.d.mts +0 -170
package/dist/cache/memory.d.mts
CHANGED
|
@@ -1,50 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
//#region src/cache/memory.d.ts
|
|
5
|
-
interface MemoryDocumentCacheOptions {
|
|
6
|
-
/** アイテム保持上限。未指定時は上限なし。超過時は LRU で古いものから削除。 */
|
|
7
|
-
maxItems?: number;
|
|
8
|
-
}
|
|
9
|
-
interface MemoryImageCacheOptions {
|
|
10
|
-
/** エントリ保持上限。未指定時は上限なし。超過時は LRU で古いものから削除。 */
|
|
11
|
-
maxItems?: number;
|
|
12
|
-
/** 合計保持サイズ上限(バイト)。未指定時は上限なし。超過時は LRU で古いものから削除。 */
|
|
13
|
-
maxSizeBytes?: number;
|
|
14
|
-
}
|
|
15
|
-
/** インメモリのドキュメントキャッシュ実装。プロセス再起動でクリアされる。ローカル開発向け。 */
|
|
16
|
-
declare class MemoryDocumentCache<T extends BaseContentItem = BaseContentItem> implements DocumentCacheAdapter<T> {
|
|
17
|
-
readonly name = "memory-document";
|
|
18
|
-
private list;
|
|
19
|
-
private metas;
|
|
20
|
-
private contents;
|
|
21
|
-
private readonly maxItems;
|
|
22
|
-
constructor(options?: MemoryDocumentCacheOptions);
|
|
23
|
-
getList(): Promise<CachedItemList<T> | null>;
|
|
24
|
-
setList(data: CachedItemList<T>): Promise<void>;
|
|
25
|
-
getItemMeta(slug: string): Promise<CachedItemMeta<T> | null>;
|
|
26
|
-
setItemMeta(slug: string, data: CachedItemMeta<T>): Promise<void>;
|
|
27
|
-
getItemContent(slug: string): Promise<CachedItemContent | null>;
|
|
28
|
-
setItemContent(slug: string, data: CachedItemContent): Promise<void>;
|
|
29
|
-
invalidate(scope: InvalidateScope): Promise<void>;
|
|
30
|
-
private enforceLimit;
|
|
31
|
-
}
|
|
32
|
-
/** インメモリの画像キャッシュ実装。プロセス再起動でクリアされる。ローカル開発向け。 */
|
|
33
|
-
declare class MemoryImageCache implements ImageCacheAdapter {
|
|
34
|
-
readonly name = "memory-image";
|
|
35
|
-
private store;
|
|
36
|
-
private totalBytes;
|
|
37
|
-
private readonly maxItems;
|
|
38
|
-
private readonly maxSizeBytes;
|
|
39
|
-
constructor(options?: MemoryImageCacheOptions);
|
|
40
|
-
get(hash: string): Promise<StorageBinary | null>;
|
|
41
|
-
set(hash: string, data: ArrayBuffer, contentType: string): Promise<void>;
|
|
42
|
-
private enforceLimit;
|
|
43
|
-
}
|
|
44
|
-
/** インメモリキャッシュ(ドキュメント用)を生成する。 */
|
|
45
|
-
declare function memoryDocumentCache<T extends BaseContentItem = BaseContentItem>(options?: MemoryDocumentCacheOptions): DocumentCacheAdapter<T>;
|
|
46
|
-
/** インメモリキャッシュ(画像用)を生成する。 */
|
|
47
|
-
declare function memoryImageCache(options?: MemoryImageCacheOptions): ImageCacheAdapter;
|
|
48
|
-
//#endregion
|
|
49
|
-
export { MemoryDocumentCache, MemoryDocumentCacheOptions, MemoryImageCache, MemoryImageCacheOptions, memoryDocumentCache, memoryImageCache };
|
|
50
|
-
//# sourceMappingURL=memory.d.mts.map
|
|
1
|
+
import { i as memoryCache, n as MemoryDocumentOptions, r as MemoryImageOptions, t as MemoryCacheOptions } from "../memory-CA1uTRbr.mjs";
|
|
2
|
+
export { MemoryCacheOptions, MemoryDocumentOptions, MemoryImageOptions, memoryCache };
|
package/dist/cache/memory.mjs
CHANGED
|
@@ -9,66 +9,74 @@ function touch(map, key) {
|
|
|
9
9
|
map.delete(key);
|
|
10
10
|
map.set(key, v);
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
const itemKey = (collection, slug) => `${collection}:${slug}`;
|
|
13
|
+
/** インメモリのドキュメントオペレーション実装。プロセス再起動でクリアされる。 */
|
|
14
|
+
var MemoryDocumentOps = class {
|
|
15
|
+
lists = /* @__PURE__ */ new Map();
|
|
16
16
|
metas = /* @__PURE__ */ new Map();
|
|
17
17
|
contents = /* @__PURE__ */ new Map();
|
|
18
18
|
maxItems;
|
|
19
19
|
constructor(options) {
|
|
20
20
|
this.maxItems = options?.maxItems;
|
|
21
21
|
}
|
|
22
|
-
getList() {
|
|
23
|
-
return Promise.resolve(this.
|
|
22
|
+
getList(collection) {
|
|
23
|
+
return Promise.resolve(this.lists.get(collection) ?? null);
|
|
24
24
|
}
|
|
25
|
-
setList(data) {
|
|
26
|
-
this.
|
|
25
|
+
setList(collection, data) {
|
|
26
|
+
this.lists.set(collection, data);
|
|
27
27
|
return Promise.resolve();
|
|
28
28
|
}
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
29
|
+
getMeta(collection, slug) {
|
|
30
|
+
const key = itemKey(collection, slug);
|
|
31
|
+
const entry = this.metas.get(key);
|
|
32
|
+
if (entry) touch(this.metas, key);
|
|
32
33
|
return Promise.resolve(entry ?? null);
|
|
33
34
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
this.metas.
|
|
35
|
+
setMeta(collection, slug, data) {
|
|
36
|
+
const key = itemKey(collection, slug);
|
|
37
|
+
if (this.metas.has(key)) this.metas.delete(key);
|
|
38
|
+
this.metas.set(key, data);
|
|
37
39
|
this.enforceLimit();
|
|
38
40
|
return Promise.resolve();
|
|
39
41
|
}
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
|
|
42
|
+
getContent(collection, slug) {
|
|
43
|
+
const key = itemKey(collection, slug);
|
|
44
|
+
const entry = this.contents.get(key);
|
|
45
|
+
if (entry) touch(this.contents, key);
|
|
43
46
|
return Promise.resolve(entry ?? null);
|
|
44
47
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
this.contents.
|
|
48
|
+
setContent(collection, slug, data) {
|
|
49
|
+
const key = itemKey(collection, slug);
|
|
50
|
+
if (this.contents.has(key)) this.contents.delete(key);
|
|
51
|
+
this.contents.set(key, data);
|
|
48
52
|
this.enforceLimit();
|
|
49
53
|
return Promise.resolve();
|
|
50
54
|
}
|
|
51
|
-
|
|
55
|
+
invalidate(scope) {
|
|
52
56
|
if (scope === "all") {
|
|
53
|
-
this.
|
|
57
|
+
this.lists.clear();
|
|
54
58
|
this.metas.clear();
|
|
55
59
|
this.contents.clear();
|
|
56
|
-
return;
|
|
60
|
+
return Promise.resolve();
|
|
57
61
|
}
|
|
58
62
|
const kind = scope.kind ?? "all";
|
|
59
|
-
|
|
63
|
+
const collection = scope.collection;
|
|
60
64
|
if ("slug" in scope) {
|
|
61
|
-
|
|
62
|
-
if (kind === "all" || kind === "
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if (kind === "all" || kind === "meta") {
|
|
66
|
-
for (const key of [...this.metas.keys()]) if (key.startsWith(prefix)) this.metas.delete(key);
|
|
67
|
-
}
|
|
68
|
-
if (kind === "all" || kind === "content") {
|
|
69
|
-
for (const key of [...this.contents.keys()]) if (key.startsWith(prefix)) this.contents.delete(key);
|
|
70
|
-
}
|
|
65
|
+
const key = itemKey(collection, scope.slug);
|
|
66
|
+
if (kind === "all" || kind === "meta") this.metas.delete(key);
|
|
67
|
+
if (kind === "all" || kind === "content") this.contents.delete(key);
|
|
68
|
+
return Promise.resolve();
|
|
71
69
|
}
|
|
70
|
+
if (kind === "all" || kind === "meta") {
|
|
71
|
+
this.lists.delete(collection);
|
|
72
|
+
const prefix = `${collection}:`;
|
|
73
|
+
for (const key of [...this.metas.keys()]) if (key.startsWith(prefix)) this.metas.delete(key);
|
|
74
|
+
}
|
|
75
|
+
if (kind === "all" || kind === "content") {
|
|
76
|
+
const prefix = `${collection}:`;
|
|
77
|
+
for (const key of [...this.contents.keys()]) if (key.startsWith(prefix)) this.contents.delete(key);
|
|
78
|
+
}
|
|
79
|
+
return Promise.resolve();
|
|
72
80
|
}
|
|
73
81
|
enforceLimit() {
|
|
74
82
|
if (this.maxItems === void 0) return;
|
|
@@ -84,9 +92,8 @@ var MemoryDocumentCache = class {
|
|
|
84
92
|
}
|
|
85
93
|
}
|
|
86
94
|
};
|
|
87
|
-
/**
|
|
88
|
-
var
|
|
89
|
-
name = "memory-image";
|
|
95
|
+
/** インメモリの画像オペレーション実装。 */
|
|
96
|
+
var MemoryImageOps = class {
|
|
90
97
|
store = /* @__PURE__ */ new Map();
|
|
91
98
|
totalBytes = 0;
|
|
92
99
|
maxItems;
|
|
@@ -124,15 +131,22 @@ var MemoryImageCache = class {
|
|
|
124
131
|
}
|
|
125
132
|
}
|
|
126
133
|
};
|
|
127
|
-
/**
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
+
/**
|
|
135
|
+
* インメモリのキャッシュアダプタ。document + image 両方を担当する。
|
|
136
|
+
* プロセス再起動でクリアされるため、ローカル開発・SSG ビルド・テスト用途。
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* cache: memoryCache({ ttlMs: 5 * 60_000, maxItems: 1000 })
|
|
140
|
+
*/
|
|
141
|
+
function memoryCache(options) {
|
|
142
|
+
return {
|
|
143
|
+
name: "memory",
|
|
144
|
+
handles: ["document", "image"],
|
|
145
|
+
doc: new MemoryDocumentOps(options),
|
|
146
|
+
img: new MemoryImageOps(options)
|
|
147
|
+
};
|
|
134
148
|
}
|
|
135
149
|
//#endregion
|
|
136
|
-
export {
|
|
150
|
+
export { memoryCache };
|
|
137
151
|
|
|
138
152
|
//# sourceMappingURL=memory.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.mjs","names":[],"sources":["../../src/cache/memory.ts"],"sourcesContent":["import type {\n\tBaseContentItem,\n\tCachedItemContent,\n\tCachedItemList,\n\tCachedItemMeta,\n\
|
|
1
|
+
{"version":3,"file":"memory.mjs","names":[],"sources":["../../src/cache/memory.ts"],"sourcesContent":["import type {\n\tBaseContentItem,\n\tCacheAdapter,\n\tCachedItemContent,\n\tCachedItemList,\n\tCachedItemMeta,\n\tDocumentCacheOps,\n\tImageCacheOps,\n\tInvalidateScope,\n\tStorageBinary,\n} from \"../types/index\";\n\nexport interface MemoryDocumentOptions {\n\t/** アイテム保持上限。未指定時は上限なし。超過時は LRU で古いものから削除。 */\n\tmaxItems?: number;\n}\n\nexport interface MemoryImageOptions {\n\t/** エントリ保持上限。未指定時は上限なし。超過時は LRU で古いものから削除。 */\n\tmaxItems?: number;\n\t/** 合計保持サイズ上限(バイト)。未指定時は上限なし。超過時は LRU で古いものから削除。 */\n\tmaxSizeBytes?: number;\n}\n\nexport interface MemoryCacheOptions\n\textends MemoryDocumentOptions,\n\t\tMemoryImageOptions {}\n\n/**\n * Map の挿入順を LRU として扱う軽量実装。\n * `touch` で既存キーを末尾に移動、`enforceLimit` で古いキー(先頭)から削除する。\n */\nfunction touch<K, V>(map: Map<K, V>, key: K): void {\n\tconst v = map.get(key);\n\tif (v === undefined) return;\n\tmap.delete(key);\n\tmap.set(key, v);\n}\n\nconst itemKey = (collection: string, slug: string): string =>\n\t`${collection}:${slug}`;\n\n/** インメモリのドキュメントオペレーション実装。プロセス再起動でクリアされる。 */\nclass MemoryDocumentOps implements DocumentCacheOps {\n\t// biome-ignore lint/suspicious/noExplicitAny: 複数コレクション分の T を一括保持\n\tprivate lists = new Map<string, CachedItemList<any>>();\n\t// biome-ignore lint/suspicious/noExplicitAny: 同上\n\tprivate metas = new Map<string, CachedItemMeta<any>>();\n\tprivate contents = new Map<string, CachedItemContent>();\n\tprivate readonly maxItems: number | undefined;\n\n\tconstructor(options?: MemoryDocumentOptions) {\n\t\tthis.maxItems = options?.maxItems;\n\t}\n\n\tgetList<T extends BaseContentItem>(\n\t\tcollection: string,\n\t): Promise<CachedItemList<T> | null> {\n\t\treturn Promise.resolve(\n\t\t\t(this.lists.get(collection) as CachedItemList<T> | undefined) ?? null,\n\t\t);\n\t}\n\n\tsetList<T extends BaseContentItem>(\n\t\tcollection: string,\n\t\tdata: CachedItemList<T>,\n\t): Promise<void> {\n\t\tthis.lists.set(collection, data);\n\t\treturn Promise.resolve();\n\t}\n\n\tgetMeta<T extends BaseContentItem>(\n\t\tcollection: string,\n\t\tslug: string,\n\t): Promise<CachedItemMeta<T> | null> {\n\t\tconst key = itemKey(collection, slug);\n\t\tconst entry = this.metas.get(key) as CachedItemMeta<T> | undefined;\n\t\tif (entry) touch(this.metas, key);\n\t\treturn Promise.resolve(entry ?? null);\n\t}\n\n\tsetMeta<T extends BaseContentItem>(\n\t\tcollection: string,\n\t\tslug: string,\n\t\tdata: CachedItemMeta<T>,\n\t): Promise<void> {\n\t\tconst key = itemKey(collection, slug);\n\t\tif (this.metas.has(key)) this.metas.delete(key);\n\t\tthis.metas.set(key, data);\n\t\tthis.enforceLimit();\n\t\treturn Promise.resolve();\n\t}\n\n\tgetContent(\n\t\tcollection: string,\n\t\tslug: string,\n\t): Promise<CachedItemContent | null> {\n\t\tconst key = itemKey(collection, slug);\n\t\tconst entry = this.contents.get(key);\n\t\tif (entry) touch(this.contents, key);\n\t\treturn Promise.resolve(entry ?? null);\n\t}\n\n\tsetContent(\n\t\tcollection: string,\n\t\tslug: string,\n\t\tdata: CachedItemContent,\n\t): Promise<void> {\n\t\tconst key = itemKey(collection, slug);\n\t\tif (this.contents.has(key)) this.contents.delete(key);\n\t\tthis.contents.set(key, data);\n\t\tthis.enforceLimit();\n\t\treturn Promise.resolve();\n\t}\n\n\tinvalidate(scope: InvalidateScope): Promise<void> {\n\t\tif (scope === \"all\") {\n\t\t\tthis.lists.clear();\n\t\t\tthis.metas.clear();\n\t\t\tthis.contents.clear();\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\tconst kind = scope.kind ?? \"all\";\n\t\tconst collection = scope.collection;\n\t\tif (\"slug\" in scope) {\n\t\t\tconst key = itemKey(collection, scope.slug);\n\t\t\tif (kind === \"all\" || kind === \"meta\") this.metas.delete(key);\n\t\t\tif (kind === \"all\" || kind === \"content\") this.contents.delete(key);\n\t\t\t// 単一スラッグ無効化ではリストは触らない(リスト全体の整合は別管理)\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\t// コレクション全体\n\t\tif (kind === \"all\" || kind === \"meta\") {\n\t\t\tthis.lists.delete(collection);\n\t\t\tconst prefix = `${collection}:`;\n\t\t\tfor (const key of [...this.metas.keys()]) {\n\t\t\t\tif (key.startsWith(prefix)) this.metas.delete(key);\n\t\t\t}\n\t\t}\n\t\tif (kind === \"all\" || kind === \"content\") {\n\t\t\tconst prefix = `${collection}:`;\n\t\t\tfor (const key of [...this.contents.keys()]) {\n\t\t\t\tif (key.startsWith(prefix)) this.contents.delete(key);\n\t\t\t}\n\t\t}\n\t\treturn Promise.resolve();\n\t}\n\n\tprivate enforceLimit(): void {\n\t\tif (this.maxItems === undefined) return;\n\t\twhile (this.metas.size > this.maxItems) {\n\t\t\tconst firstKey = this.metas.keys().next().value;\n\t\t\tif (firstKey === undefined) break;\n\t\t\tthis.metas.delete(firstKey);\n\t\t}\n\t\twhile (this.contents.size > this.maxItems) {\n\t\t\tconst firstKey = this.contents.keys().next().value;\n\t\t\tif (firstKey === undefined) break;\n\t\t\tthis.contents.delete(firstKey);\n\t\t}\n\t}\n}\n\n/** インメモリの画像オペレーション実装。 */\nclass MemoryImageOps implements ImageCacheOps {\n\tprivate store = new Map<string, StorageBinary>();\n\tprivate totalBytes = 0;\n\tprivate readonly maxItems: number | undefined;\n\tprivate readonly maxSizeBytes: number | undefined;\n\n\tconstructor(options?: MemoryImageOptions) {\n\t\tthis.maxItems = options?.maxItems;\n\t\tthis.maxSizeBytes = options?.maxSizeBytes;\n\t}\n\n\tget(hash: string): Promise<StorageBinary | null> {\n\t\tconst entry = this.store.get(hash);\n\t\tif (entry) touch(this.store, hash);\n\t\treturn Promise.resolve(entry ?? null);\n\t}\n\n\tset(hash: string, data: ArrayBuffer, contentType: string): Promise<void> {\n\t\tconst existing = this.store.get(hash);\n\t\tif (existing) {\n\t\t\tthis.totalBytes -= existing.data.byteLength;\n\t\t\tthis.store.delete(hash);\n\t\t}\n\t\tthis.store.set(hash, { data, contentType });\n\t\tthis.totalBytes += data.byteLength;\n\t\tthis.enforceLimit();\n\t\treturn Promise.resolve();\n\t}\n\n\tprivate enforceLimit(): void {\n\t\twhile (\n\t\t\t(this.maxItems !== undefined && this.store.size > this.maxItems) ||\n\t\t\t(this.maxSizeBytes !== undefined && this.totalBytes > this.maxSizeBytes)\n\t\t) {\n\t\t\tconst firstKey = this.store.keys().next().value;\n\t\t\tif (firstKey === undefined) break;\n\t\t\tconst victim = this.store.get(firstKey);\n\t\t\tif (victim) this.totalBytes -= victim.data.byteLength;\n\t\t\tthis.store.delete(firstKey);\n\t\t}\n\t}\n}\n\n/**\n * インメモリのキャッシュアダプタ。document + image 両方を担当する。\n * プロセス再起動でクリアされるため、ローカル開発・SSG ビルド・テスト用途。\n *\n * @example\n * cache: memoryCache({ ttlMs: 5 * 60_000, maxItems: 1000 })\n */\nexport function memoryCache(options?: MemoryCacheOptions): CacheAdapter {\n\treturn {\n\t\tname: \"memory\",\n\t\thandles: [\"document\", \"image\"] as const,\n\t\tdoc: new MemoryDocumentOps(options),\n\t\timg: new MemoryImageOps(options),\n\t};\n}\n"],"mappings":";;;;;AAgCA,SAAS,MAAY,KAAgB,KAAc;CAClD,MAAM,I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に必須)。 */
|
|
96
96
|
updatedAt: string;
|
|
97
|
-
/** コンテンツのステータス。ステータスのない DB では省略可能。 */
|
|
98
|
-
status?: string;
|
|
99
|
-
/** 公開日時。日付プロパティのない DB では省略可能。 */
|
|
100
|
-
publishedAt?: string;
|
|
97
|
+
/** コンテンツのステータス。ステータスのない DB では省略可能。Notion の select 型は null を返す場合がある。 */
|
|
98
|
+
status?: string | null;
|
|
99
|
+
/** 公開日時。日付プロパティのない DB では省略可能。Notion の date 型は null を返す場合がある。 */
|
|
100
|
+
publishedAt?: string | null;
|
|
101
101
|
}
|
|
102
102
|
/**
|
|
103
103
|
* メタデータのみの軽量キャッシュエントリ。
|
|
@@ -122,16 +122,6 @@ interface CachedItemContent {
|
|
|
122
122
|
notionUpdatedAt: string;
|
|
123
123
|
cachedAt: number;
|
|
124
124
|
}
|
|
125
|
-
/**
|
|
126
|
-
* 本文クライアント送信用 DTO(cachedAt を除いた `CachedItemContent`)。
|
|
127
|
-
* `useSWR` の cache に格納できるよう関数を含まない pure JSON。
|
|
128
|
-
*/
|
|
129
|
-
interface ItemContentPayload {
|
|
130
|
-
html: string;
|
|
131
|
-
markdown: string;
|
|
132
|
-
blocks: ContentBlock[];
|
|
133
|
-
notionUpdatedAt: string;
|
|
134
|
-
}
|
|
135
125
|
/** ストレージにキャッシュされたコンテンツ一覧。 */
|
|
136
126
|
interface CachedItemList<T extends BaseContentItem = BaseContentItem> {
|
|
137
127
|
items: T[];
|
|
@@ -152,5 +142,5 @@ interface CMSSchemaProperties {
|
|
|
152
142
|
date?: string;
|
|
153
143
|
}
|
|
154
144
|
//#endregion
|
|
155
|
-
export { CachedItemMeta as a,
|
|
156
|
-
//# sourceMappingURL=content-
|
|
145
|
+
export { CachedItemMeta as a, ContentResult as c, CachedItemList as i, ImageRef as l, CMSSchemaProperties as n, StorageBinary as o, CachedItemContent as r, ContentBlock as s, BaseContentItem as t, InlineNode as u };
|
|
146
|
+
//# sourceMappingURL=content-Bffid8da.d.mts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as CachedItemMeta, i as CachedItemList, r as CachedItemContent, t as BaseContentItem } from "./content-
|
|
1
|
+
import { a as CachedItemMeta, i as CachedItemList, r as CachedItemContent, t as BaseContentItem } from "./content-Bffid8da.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/types/hooks.d.ts
|
|
4
4
|
type MaybePromise<T> = T | Promise<T>;
|
|
@@ -75,4 +75,4 @@ declare function mergeLoggers(plugins: Array<{
|
|
|
75
75
|
}>, directLogger?: Logger): Logger | undefined;
|
|
76
76
|
//#endregion
|
|
77
77
|
export { Logger as a, definePlugin as i, mergeLoggers as n, CMSHooks as o, CMSPlugin as r, MaybePromise as s, mergeHooks as t };
|
|
78
|
-
//# sourceMappingURL=hooks-
|
|
78
|
+
//# sourceMappingURL=hooks-CqqVxrYg.d.mts.map
|
package/dist/hooks.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as mergeLoggers, t as mergeHooks } from "./hooks-
|
|
1
|
+
import { n as mergeLoggers, t as mergeHooks } from "./hooks-CqqVxrYg.mjs";
|
|
2
2
|
export { mergeHooks, mergeLoggers };
|