@shevky/core 0.0.4 → 0.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.
@@ -517,7 +517,9 @@ export class RenderEngine {
517
517
  return;
518
518
  }
519
519
 
520
- const configKeys = Object.keys(collectionsConfig);
520
+ const configKeys = Object.keys(collectionsConfig).filter(
521
+ (key) => key !== "includeContentFile",
522
+ );
521
523
  for (const configKey of configKeys) {
522
524
  const config = collectionsConfig[configKey];
523
525
  if (!config || typeof config !== "object") {
@@ -167,4 +167,16 @@ export class ContentFile {
167
167
  get isPostTemplate() {
168
168
  return this.template === "post";
169
169
  }
170
+
171
+ toObject() {
172
+ return {
173
+ header: this._header.raw,
174
+ body: {
175
+ content: this.content,
176
+ },
177
+ content: this.content,
178
+ isValid: this.isValid,
179
+ sourcePath: this.sourcePath,
180
+ };
181
+ }
170
182
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shevky/core",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "A minimal, dependency-light static site generator.",
5
5
  "type": "module",
6
6
  "main": "shevky.js",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "homepage": "https://github.com/shevky/core#readme",
38
38
  "dependencies": {
39
- "@shevky/base": "^0.0.2",
39
+ "@shevky/base": "^0.0.3",
40
40
  "@types/node": "^20.11.30",
41
41
  "@types/mustache": "^4.2.6",
42
42
  "@types/html-minifier-terser": "^7.0.2",
@@ -1,4 +1,4 @@
1
- import { io as _io } from "@shevky/base";
1
+ import { io as _io, config as _cfg } from "@shevky/base";
2
2
  import matter from "gray-matter";
3
3
 
4
4
  import { ContentFile } from "../lib/contentFile.js";
@@ -202,6 +202,9 @@ export class ContentRegistry {
202
202
  return this.#_collectionsCache;
203
203
  }
204
204
 
205
+ const includeContentFile = Boolean(
206
+ _cfg?.content?.collections?.includeContentFile,
207
+ );
205
208
  /** @type {import("../types/index.d.ts").CollectionsByLang} */
206
209
  const pagesByLang = {};
207
210
  const contentFiles = this.files;
@@ -211,8 +214,10 @@ export class ContentRegistry {
211
214
  }
212
215
 
213
216
  const contentSummary = new ContentSummary(file);
217
+ const summaryBase = contentSummary.toObject();
214
218
  const summary = /** @type {import("../types/index.d.ts").CollectionEntry} */ ({
215
- ...contentSummary.toObject(),
219
+ ...summaryBase,
220
+ ...(includeContentFile ? file.toObject() : {}),
216
221
  canonical: this.#_metaEngine.buildContentUrl(
217
222
  file.canonical,
218
223
  file.lang,
package/types/index.d.ts CHANGED
@@ -91,6 +91,11 @@ export type CollectionEntry = ContentSummaryLike & {
91
91
  type?: string;
92
92
  seriesTitle?: string;
93
93
  canonical?: string;
94
+ header?: ContentHeaderLike;
95
+ body?: ContentBodyLike;
96
+ content?: string;
97
+ isValid?: boolean;
98
+ sourcePath?: string;
94
99
  };
95
100
 
96
101
  export type CollectionsByLang = Record<string, Record<string, CollectionEntry[]>>;