nextjs-studio 1.0.3 → 1.0.5

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.
@@ -1,135 +0,0 @@
1
- import { v as FileInfo, w as DirectoryFileEntry, t as StudioConfig, C as ContentEntry, n as Collection } from '../query-builder-KXz9cPzF.js';
2
- export { o as CollectionConfig, p as CollectionTypeMap, Q as QueryOptions, s as QueryResult, u as queryCollection } from '../query-builder-KXz9cPzF.js';
3
-
4
- /**
5
- * @context Shared layer — FS adapter interface at src/shared/fs-adapter.interface.ts
6
- * @does Defines the IFsAdapter contract so Core can perform I/O without depending on CLI
7
- * @depends src/shared/types.ts
8
- * @do Add new I/O methods here when Core needs them; keep the interface minimal
9
- * @dont Import from CLI or UI; contain implementation logic
10
- */
11
-
12
- interface IFsAdapter {
13
- readFile(filePath: string): Promise<string>;
14
- writeFile(filePath: string, content: string): Promise<void>;
15
- deleteFile(filePath: string): Promise<void>;
16
- exists(filePath: string): Promise<boolean>;
17
- getStats(filePath: string): Promise<FileInfo>;
18
- listFiles(dirPath: string, extensions?: readonly string[]): Promise<string[]>;
19
- listDirectories(dirPath: string): Promise<string[]>;
20
- readBuffer(filePath: string): Promise<Buffer>;
21
- writeBuffer(filePath: string, data: Buffer): Promise<void>;
22
- listAllFiles(dirPath: string): Promise<DirectoryFileEntry[]>;
23
- join(...segments: string[]): string;
24
- basename(filePath: string): string;
25
- extname(filePath: string): string;
26
- relative(from: string, to: string): string;
27
- normalizeSlug(relativePath: string, ext: string): string;
28
- readFileSync(filePath: string): string;
29
- existsSync(filePath: string): boolean;
30
- listFilesSync(dirPath: string, extensions?: readonly string[]): string[];
31
- listDirectoriesSync(dirPath: string): string[];
32
- }
33
-
34
- /**
35
- * @context Core layer — filesystem adapter at src/core/fs-adapter.ts
36
- * @does Implements IFsAdapter; abstracts all file read/write/list operations behind a single interface
37
- * @depends src/shared/types.ts, src/shared/constants.ts, src/shared/fs-adapter.interface.ts
38
- * @do Add new I/O operations here; all file access must go through this adapter
39
- * @dont Import UI components, run HTTP requests, or contain business logic
40
- */
41
-
42
- declare class FsAdapter implements IFsAdapter {
43
- private readonly basePath;
44
- constructor(basePath: string);
45
- private resolve;
46
- readFile(filePath: string): Promise<string>;
47
- writeFile(filePath: string, content: string): Promise<void>;
48
- deleteFile(filePath: string): Promise<void>;
49
- exists(filePath: string): Promise<boolean>;
50
- getStats(filePath: string): Promise<FileInfo>;
51
- listFiles(dirPath: string, extensions?: readonly string[]): Promise<string[]>;
52
- listDirectories(dirPath: string): Promise<string[]>;
53
- readBuffer(filePath: string): Promise<Buffer>;
54
- writeBuffer(filePath: string, data: Buffer): Promise<void>;
55
- listAllFiles(dirPath: string): Promise<DirectoryFileEntry[]>;
56
- join(...segments: string[]): string;
57
- basename(filePath: string): string;
58
- extname(filePath: string): string;
59
- relative(from: string, to: string): string;
60
- normalizeSlug(relativePath: string, ext: string): string;
61
- readFileSync(filePath: string): string;
62
- existsSync(filePath: string): boolean;
63
- listFilesSync(dirPath: string, extensions?: readonly string[]): string[];
64
- listDirectoriesSync(dirPath: string): string[];
65
- }
66
-
67
- /**
68
- * @context Core layer — content indexer at src/core/indexer.ts
69
- * @does Scans the contents directory, parses MDX/JSON files, and builds an in-memory index
70
- * @depends src/shared/types.ts, src/shared/constants.ts, src/shared/fs-adapter.interface.ts, src/core/parsers/, src/core/schema-inferrer.ts
71
- * @do Add new file type handling here; extend indexCollection for new collection behaviors
72
- * @dont Import from CLI or UI; instantiate FsAdapter; access the filesystem directly
73
- */
74
-
75
- declare class ContentIndex {
76
- private readonly entries;
77
- private readonly collections;
78
- private readonly fs;
79
- constructor(fsAdapter: IFsAdapter);
80
- build(config?: StudioConfig): Promise<void>;
81
- buildSync(config?: StudioConfig): void;
82
- getCollection(name: string): ContentEntry[];
83
- getCollections(): Collection[];
84
- clear(): void;
85
- updateEntry(collectionName: string, entry: ContentEntry): void;
86
- removeEntry(collectionName: string, slug: string): void;
87
- private updateCollectionMeta;
88
- private indexCollection;
89
- private indexCollectionSync;
90
- private scanDir;
91
- private scanDirSync;
92
- private buildMdxEntry;
93
- private buildJsonEntries;
94
- private readOrdering;
95
- private readOrderingSync;
96
- private applyOrdering;
97
- private detectCollectionType;
98
- }
99
-
100
- /**
101
- * @context Core layer — content store at src/core/content-store.ts
102
- * @does Manages a singleton ContentIndex; exposes loadContent() and getStore() for consumers
103
- * @depends src/core/indexer.ts, src/shared/types.ts
104
- * @do Use this as the single access point for in-memory indexed content
105
- * @dont Import from CLI or UI; contain parsing or I/O logic; import fs-adapter at top level
106
- */
107
-
108
- declare function loadContent(fsAdapter: IFsAdapter, config?: StudioConfig): Promise<ContentIndex>;
109
- declare function loadContentSync(fsAdapter: IFsAdapter, config?: StudioConfig): ContentIndex;
110
-
111
- /**
112
- * @context Core layer — config loader at src/core/config-loader.ts
113
- * @does Resolves and loads studio.config.ts/.js from the project root using dynamic import
114
- * @depends src/shared/constants.ts, src/shared/types.ts
115
- * @do Add new config resolution strategies or validation here
116
- * @dont Import from CLI or UI; access content files
117
- */
118
-
119
- /**
120
- * Resolves the config file path from the project root.
121
- * Returns undefined if no config file is found.
122
- */
123
- declare function resolveConfigPath(projectRoot: string): string | undefined;
124
- /**
125
- * Loads the studio config from the project root.
126
- * Tries CONFIG_FILENAMES in order, uses dynamic import().
127
- * Returns empty config if no file found or loading fails.
128
- */
129
- declare function loadStudioConfig(projectRoot: string): Promise<StudioConfig>;
130
- /**
131
- * Loads config from a specific file path.
132
- */
133
- declare function loadConfigFromPath(configPath: string): Promise<StudioConfig>;
134
-
135
- export { Collection, ContentEntry, ContentIndex, FsAdapter, StudioConfig, loadConfigFromPath, loadContent, loadContentSync, loadStudioConfig, resolveConfigPath };