@ecopages/content-processor 0.2.0-beta.40 → 0.2.0-beta.42
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 +2 -0
- package/package.json +3 -3
- package/src/plugin.d.ts +9 -0
- package/src/plugin.js +14 -2
package/README.md
CHANGED
|
@@ -29,6 +29,8 @@ The processor gives you a typed manifest and MDX components at build time. Wire
|
|
|
29
29
|
- **Multiple collections** — docs, blog, changelog, or any keyed collection you configure.
|
|
30
30
|
- **`ContentScanner`** — reuse the same scan logic in one-off build scripts (for example, `llms.txt` generation).
|
|
31
31
|
|
|
32
|
+
During development, edits to an entry's MDX body invalidate its compiled server collection bundle even when its frontmatter and generated manifest are unchanged. The next request rebuilds that bundle and renders the new body.
|
|
33
|
+
|
|
32
34
|
## Installation
|
|
33
35
|
|
|
34
36
|
```bash
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecopages/content-processor",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.42",
|
|
4
4
|
"description": "Scan MDX collections at build time and expose typed ecopages:content/* virtual modules for pages and scripts",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"content",
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
"directory": "packages/processors/content-processor"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"@ecopages/core": "0.2.0-beta.
|
|
20
|
+
"@ecopages/core": "0.2.0-beta.42"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@ecopages/file-system": "0.2.0-beta.
|
|
23
|
+
"@ecopages/file-system": "0.2.0-beta.42",
|
|
24
24
|
"@ecopages/logger": "^0.2.3",
|
|
25
25
|
"remark-frontmatter": "^5.0.0",
|
|
26
26
|
"unified": "^11.0.5",
|
package/src/plugin.d.ts
CHANGED
|
@@ -34,6 +34,15 @@ export declare class ContentProcessorPlugin extends Processor<ContentProcessorCo
|
|
|
34
34
|
private writeGeneratedFile;
|
|
35
35
|
private getOrCreateScanner;
|
|
36
36
|
private regenerateCollectionModule;
|
|
37
|
+
/**
|
|
38
|
+
* Discards the compiled collection bundle after one of its MDX sources changes.
|
|
39
|
+
*
|
|
40
|
+
* @remarks
|
|
41
|
+
* A body-only edit leaves the generated manifest unchanged, but the compiled
|
|
42
|
+
* server collection embeds every entry's MDX module. Bumping the generation
|
|
43
|
+
* also prevents an already-running compilation from publishing stale output.
|
|
44
|
+
*/
|
|
45
|
+
private invalidateCollectionServerArtifact;
|
|
37
46
|
private regenerateCollectionEntriesModule;
|
|
38
47
|
private regenerateCollections;
|
|
39
48
|
private regenerateAllCollections;
|
package/src/plugin.js
CHANGED
|
@@ -129,8 +129,7 @@ export class ContentProcessorPlugin extends Processor {
|
|
|
129
129
|
this.writeGeneratedFile(serverOutputFile, componentsOutput);
|
|
130
130
|
this.collectionModules[collectionName] = outputFile;
|
|
131
131
|
this.collectionServerModules[collectionName] = serverOutputFile;
|
|
132
|
-
|
|
133
|
-
this.collectionGenerations.set(collectionName, (this.collectionGenerations.get(collectionName) ?? 0) + 1);
|
|
132
|
+
this.invalidateCollectionServerArtifact(collectionName);
|
|
134
133
|
logger.debug('Generated content collection module', {
|
|
135
134
|
collectionName,
|
|
136
135
|
outputFile,
|
|
@@ -138,6 +137,18 @@ export class ContentProcessorPlugin extends Processor {
|
|
|
138
137
|
entryCount: manifest.length,
|
|
139
138
|
});
|
|
140
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* Discards the compiled collection bundle after one of its MDX sources changes.
|
|
142
|
+
*
|
|
143
|
+
* @remarks
|
|
144
|
+
* A body-only edit leaves the generated manifest unchanged, but the compiled
|
|
145
|
+
* server collection embeds every entry's MDX module. Bumping the generation
|
|
146
|
+
* also prevents an already-running compilation from publishing stale output.
|
|
147
|
+
*/
|
|
148
|
+
invalidateCollectionServerArtifact(collectionName) {
|
|
149
|
+
delete this.collectionServerCompiledModules[collectionName];
|
|
150
|
+
this.collectionGenerations.set(collectionName, (this.collectionGenerations.get(collectionName) ?? 0) + 1);
|
|
151
|
+
}
|
|
141
152
|
async regenerateCollectionEntriesModule(collectionName) {
|
|
142
153
|
if (!this.context?.cache) {
|
|
143
154
|
throw new Error('Content processor requires context to be set');
|
|
@@ -181,6 +192,7 @@ export class ContentProcessorPlugin extends Processor {
|
|
|
181
192
|
const scanner = this.getOrCreateScanner(collectionName);
|
|
182
193
|
const updateResult = await scanner.updateEntryForPath(normalizedPath, event);
|
|
183
194
|
if (updateResult === 'no-op') {
|
|
195
|
+
this.invalidateCollectionServerArtifact(collectionName);
|
|
184
196
|
continue;
|
|
185
197
|
}
|
|
186
198
|
if (updateResult === 'manifest') {
|