@analogjs/content 3.0.0-beta.9 → 3.0.0
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/fesm2022/analogjs-content-md4x.mjs +35 -73
- package/fesm2022/analogjs-content-md4x.mjs.map +1 -1
- package/fesm2022/analogjs-content-mdc.mjs +5 -7
- package/fesm2022/analogjs-content-mdc.mjs.map +1 -1
- package/fesm2022/analogjs-content-og.mjs +21 -4
- package/fesm2022/analogjs-content-og.mjs.map +1 -1
- package/fesm2022/analogjs-content-resources.mjs +10 -18
- package/fesm2022/analogjs-content-resources.mjs.map +1 -1
- package/fesm2022/analogjs-content.mjs +28 -29
- package/fesm2022/analogjs-content.mjs.map +1 -1
- package/fesm2022/content-list-loader.mjs +22 -30
- package/fesm2022/content-list-loader.mjs.map +1 -1
- package/fesm2022/frontmatter-validation-error.mjs +1 -2
- package/fesm2022/parse-raw-content-file.mjs +2 -5
- package/fesm2022/parse-raw-content-file.mjs.map +1 -1
- package/package.json +7 -5
- package/types/og/src/lib/parse-html.d.ts +10 -0
- package/types/src/lib/anchor-navigation.directive.d.ts +2 -1
- package/types/src/lib/render-task.service.d.ts +2 -2
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
import { n as parseRawContentFileAsync, t as parseRawContentFile } from "./parse-raw-content-file.mjs";
|
|
2
1
|
import { _ as NoopContentRenderer, a as injectContentFileLoader, c as injectContentFilesMap, d as CONTENT_LOCALE, f as filterByLocale, g as ContentRenderer, h as withLocaleCandidates, i as CONTENT_FILE_LOADER, l as RenderTaskService, m as withLocale, n as injectContentListLoader, o as withContentFileLoader, p as injectContentLocale, r as withContentListLoader, s as injectContentFiles, t as CONTENT_LIST_LOADER, u as CONTENT_FILES_TOKEN } from "./content-list-loader.mjs";
|
|
2
|
+
import { n as parseRawContentFileAsync, t as parseRawContentFile } from "./parse-raw-content-file.mjs";
|
|
3
3
|
import { t as FrontmatterValidationError } from "./frontmatter-validation-error.mjs";
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
|
-
import { Component, Directive, HostListener, InjectionToken, Input, NgZone, PLATFORM_ID, ViewEncapsulation, computed, inject, input } from "@angular/core";
|
|
5
|
+
import { Component, Directive, ElementRef, HostListener, InjectionToken, Input, NgZone, PLATFORM_ID, ViewEncapsulation, computed, inject, input } from "@angular/core";
|
|
6
6
|
import { DOCUMENT, Location, isPlatformBrowser } from "@angular/common";
|
|
7
7
|
import { ActivatedRoute, Router } from "@angular/router";
|
|
8
8
|
import { Observable, firstValueFrom, from, isObservable, of } from "rxjs";
|
|
9
9
|
import { catchError, finalize, map, switchMap, tap } from "rxjs/operators";
|
|
10
10
|
import { DomSanitizer } from "@angular/platform-browser";
|
|
11
11
|
import { takeUntilDestroyed, toSignal } from "@angular/core/rxjs-interop";
|
|
12
|
-
|
|
12
|
+
// packages/content/src/lib/anchor-navigation.directive.ts
|
|
13
13
|
var AnchorNavigationDirective = class AnchorNavigationDirective {
|
|
14
14
|
constructor() {
|
|
15
15
|
this.document = inject(DOCUMENT);
|
|
16
|
+
this.host = inject(ElementRef);
|
|
16
17
|
this.location = inject(Location);
|
|
17
18
|
this.router = inject(Router);
|
|
18
19
|
}
|
|
19
|
-
handleNavigation(
|
|
20
|
-
if (
|
|
20
|
+
handleNavigation(target, event) {
|
|
21
|
+
if (event && shouldSkipClick(event)) return true;
|
|
22
|
+
const element = target instanceof Element ? target.closest("a") : null;
|
|
23
|
+
if (element && this.host.nativeElement.contains(element) && isInternalUrl(element, this.document) && hasTargetSelf(element) && !hasDownloadAttribute(element)) {
|
|
21
24
|
const { pathname, search, hash } = element;
|
|
22
25
|
const isFragmentOnly = element.getAttribute("href")?.startsWith("#");
|
|
23
26
|
const resolvedPathname = isFragmentOnly ? this.document.location.pathname : pathname;
|
|
@@ -31,7 +34,7 @@ var AnchorNavigationDirective = class AnchorNavigationDirective {
|
|
|
31
34
|
static {
|
|
32
35
|
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
33
36
|
minVersion: "12.0.0",
|
|
34
|
-
version: "22.
|
|
37
|
+
version: "22.3.0",
|
|
35
38
|
ngImport: i0,
|
|
36
39
|
type: AnchorNavigationDirective,
|
|
37
40
|
deps: [],
|
|
@@ -41,18 +44,18 @@ var AnchorNavigationDirective = class AnchorNavigationDirective {
|
|
|
41
44
|
static {
|
|
42
45
|
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
43
46
|
minVersion: "14.0.0",
|
|
44
|
-
version: "22.
|
|
47
|
+
version: "22.3.0",
|
|
45
48
|
type: AnchorNavigationDirective,
|
|
46
49
|
isStandalone: true,
|
|
47
50
|
selector: "[analogAnchorNavigation]",
|
|
48
|
-
host: { listeners: { "click": "handleNavigation($event.target)" } },
|
|
51
|
+
host: { listeners: { "click": "handleNavigation($event.target,$event)" } },
|
|
49
52
|
ngImport: i0
|
|
50
53
|
});
|
|
51
54
|
}
|
|
52
55
|
};
|
|
53
56
|
i0.ɵɵngDeclareClassMetadata({
|
|
54
57
|
minVersion: "12.0.0",
|
|
55
|
-
version: "22.
|
|
58
|
+
version: "22.3.0",
|
|
56
59
|
ngImport: i0,
|
|
57
60
|
type: AnchorNavigationDirective,
|
|
58
61
|
decorators: [{
|
|
@@ -64,9 +67,12 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
64
67
|
}],
|
|
65
68
|
propDecorators: { handleNavigation: [{
|
|
66
69
|
type: HostListener,
|
|
67
|
-
args: ["click", ["$event.target"]]
|
|
70
|
+
args: ["click", ["$event.target", "$event"]]
|
|
68
71
|
}] }
|
|
69
72
|
});
|
|
73
|
+
function shouldSkipClick(event) {
|
|
74
|
+
return event.defaultPrevented || event.button !== 0 || event.ctrlKey || event.metaKey || event.shiftKey || event.altKey;
|
|
75
|
+
}
|
|
70
76
|
function hasDownloadAttribute(anchorElement) {
|
|
71
77
|
return anchorElement.getAttribute("download") !== null;
|
|
72
78
|
}
|
|
@@ -76,8 +82,7 @@ function hasTargetSelf(anchorElement) {
|
|
|
76
82
|
function isInternalUrl(anchorElement, document) {
|
|
77
83
|
return anchorElement.host === document.location.host && anchorElement.protocol === document.location.protocol;
|
|
78
84
|
}
|
|
79
|
-
|
|
80
|
-
//#region packages/content/src/lib/parse-content-file.ts
|
|
85
|
+
// packages/content/src/lib/parse-content-file.ts
|
|
81
86
|
/**
|
|
82
87
|
* Reads a loaded content file. Build-time content modules carry their
|
|
83
88
|
* frontmatter as `metadata`; raw strings from custom loaders are parsed
|
|
@@ -91,8 +96,7 @@ async function parseContentFile(file) {
|
|
|
91
96
|
const { parseRawContentFile } = await import("./parse-raw-content-file.mjs").then((n) => n.r);
|
|
92
97
|
return parseRawContentFile(file);
|
|
93
98
|
}
|
|
94
|
-
|
|
95
|
-
//#region packages/content/src/lib/utils/zone-wait-for.ts
|
|
99
|
+
// packages/content/src/lib/utils/zone-wait-for.ts
|
|
96
100
|
async function waitFor(prom) {
|
|
97
101
|
if (isObservable(prom)) prom = firstValueFrom(prom);
|
|
98
102
|
if (typeof Zone === "undefined") return prom;
|
|
@@ -102,8 +106,7 @@ async function waitFor(prom) {
|
|
|
102
106
|
return p;
|
|
103
107
|
});
|
|
104
108
|
}
|
|
105
|
-
|
|
106
|
-
//#region packages/content/src/lib/content.ts
|
|
109
|
+
// packages/content/src/lib/content.ts
|
|
107
110
|
function getContentFile(contentFiles, prefix, slug, fallback, renderTaskService, contentRenderer, locale) {
|
|
108
111
|
const normalizedFiles = {};
|
|
109
112
|
for (const [key, resolver] of Object.entries(contentFiles)) {
|
|
@@ -167,8 +170,7 @@ function injectContent(param = "slug", fallback = "No Content Found") {
|
|
|
167
170
|
}), tap(() => renderTaskService.clearRenderTask(task)));
|
|
168
171
|
} else return getContentFile(contentFiles, "", param.customFilename, fallback, renderTaskService, contentRenderer, locale).pipe(tap(() => renderTaskService.clearRenderTask(task)));
|
|
169
172
|
}
|
|
170
|
-
|
|
171
|
-
//#region packages/content/src/lib/provide-content.ts
|
|
173
|
+
// packages/content/src/lib/provide-content.ts
|
|
172
174
|
var CONTENT_RENDERER_PROVIDERS = [
|
|
173
175
|
{
|
|
174
176
|
provide: ContentRenderer,
|
|
@@ -190,8 +192,7 @@ function provideContent(...features) {
|
|
|
190
192
|
}, ...features];
|
|
191
193
|
}
|
|
192
194
|
var MERMAID_IMPORT_TOKEN = new InjectionToken("mermaid_import");
|
|
193
|
-
|
|
194
|
-
//#region packages/content/src/lib/markdown-route.component.ts
|
|
195
|
+
// packages/content/src/lib/markdown-route.component.ts
|
|
195
196
|
var AnalogMarkdownRouteComponent = class AnalogMarkdownRouteComponent {
|
|
196
197
|
constructor() {
|
|
197
198
|
this.sanitizer = inject(DomSanitizer);
|
|
@@ -206,7 +207,7 @@ var AnalogMarkdownRouteComponent = class AnalogMarkdownRouteComponent {
|
|
|
206
207
|
static {
|
|
207
208
|
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
208
209
|
minVersion: "12.0.0",
|
|
209
|
-
version: "22.
|
|
210
|
+
version: "22.3.0",
|
|
210
211
|
ngImport: i0,
|
|
211
212
|
type: AnalogMarkdownRouteComponent,
|
|
212
213
|
deps: [],
|
|
@@ -216,7 +217,7 @@ var AnalogMarkdownRouteComponent = class AnalogMarkdownRouteComponent {
|
|
|
216
217
|
static {
|
|
217
218
|
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
218
219
|
minVersion: "14.0.0",
|
|
219
|
-
version: "22.
|
|
220
|
+
version: "22.3.0",
|
|
220
221
|
type: AnalogMarkdownRouteComponent,
|
|
221
222
|
isStandalone: true,
|
|
222
223
|
selector: "analog-markdown-route",
|
|
@@ -232,7 +233,7 @@ var AnalogMarkdownRouteComponent = class AnalogMarkdownRouteComponent {
|
|
|
232
233
|
};
|
|
233
234
|
i0.ɵɵngDeclareClassMetadata({
|
|
234
235
|
minVersion: "12.0.0",
|
|
235
|
-
version: "22.
|
|
236
|
+
version: "22.3.0",
|
|
236
237
|
ngImport: i0,
|
|
237
238
|
type: AnalogMarkdownRouteComponent,
|
|
238
239
|
decorators: [{
|
|
@@ -249,8 +250,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
249
250
|
}],
|
|
250
251
|
propDecorators: { classes: [{ type: Input }] }
|
|
251
252
|
});
|
|
252
|
-
|
|
253
|
-
//#region packages/content/src/lib/markdown.component.ts
|
|
253
|
+
// packages/content/src/lib/markdown.component.ts
|
|
254
254
|
var AnalogMarkdownComponent = class AnalogMarkdownComponent {
|
|
255
255
|
constructor() {
|
|
256
256
|
this.sanitizer = inject(DomSanitizer);
|
|
@@ -289,7 +289,7 @@ var AnalogMarkdownComponent = class AnalogMarkdownComponent {
|
|
|
289
289
|
static {
|
|
290
290
|
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
291
291
|
minVersion: "12.0.0",
|
|
292
|
-
version: "22.
|
|
292
|
+
version: "22.3.0",
|
|
293
293
|
ngImport: i0,
|
|
294
294
|
type: AnalogMarkdownComponent,
|
|
295
295
|
deps: [],
|
|
@@ -299,7 +299,7 @@ var AnalogMarkdownComponent = class AnalogMarkdownComponent {
|
|
|
299
299
|
static {
|
|
300
300
|
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
301
301
|
minVersion: "17.1.0",
|
|
302
|
-
version: "22.
|
|
302
|
+
version: "22.3.0",
|
|
303
303
|
type: AnalogMarkdownComponent,
|
|
304
304
|
isStandalone: true,
|
|
305
305
|
selector: "analog-markdown",
|
|
@@ -330,7 +330,7 @@ var AnalogMarkdownComponent = class AnalogMarkdownComponent {
|
|
|
330
330
|
};
|
|
331
331
|
i0.ɵɵngDeclareClassMetadata({
|
|
332
332
|
minVersion: "12.0.0",
|
|
333
|
-
version: "22.
|
|
333
|
+
version: "22.3.0",
|
|
334
334
|
ngImport: i0,
|
|
335
335
|
type: AnalogMarkdownComponent,
|
|
336
336
|
decorators: [{
|
|
@@ -364,7 +364,6 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
364
364
|
}]
|
|
365
365
|
}
|
|
366
366
|
});
|
|
367
|
-
//#endregion
|
|
368
367
|
export { AnchorNavigationDirective, CONTENT_FILE_LOADER, CONTENT_LIST_LOADER, CONTENT_LOCALE, ContentRenderer, FrontmatterValidationError, AnalogMarkdownComponent as MarkdownComponent, AnalogMarkdownRouteComponent as MarkdownRouteComponent, NoopContentRenderer, filterByLocale, injectContent, injectContentFileLoader, injectContentFiles, injectContentFilesMap, injectContentListLoader, injectContentLocale, parseContentFile, parseRawContentFile, parseRawContentFileAsync, provideContent, withContentFileLoader, withContentListLoader, withLocale, withLocaleCandidates, withMarkdownRenderer };
|
|
369
368
|
|
|
370
369
|
//# sourceMappingURL=analogjs-content.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analogjs-content.mjs","names":[],"sources":["../../src/lib/anchor-navigation.directive.ts","../../src/lib/parse-content-file.ts","../../src/lib/utils/zone-wait-for.ts","../../src/lib/content.ts","../../src/lib/provide-content.ts","../../src/lib/markdown-route.component.ts","../../src/lib/markdown.component.ts"],"sourcesContent":["import { Directive, HostListener, inject } from '@angular/core';\nimport { DOCUMENT, Location } from '@angular/common';\nimport { Router } from '@angular/router';\n\n@Directive({\n selector: '[analogAnchorNavigation]',\n standalone: true,\n})\nexport class AnchorNavigationDirective {\n private readonly document = inject(DOCUMENT);\n private readonly location = inject(Location);\n private readonly router = inject(Router);\n\n @HostListener('click', ['$event.target'])\n handleNavigation(element: EventTarget | null): boolean {\n if (\n element instanceof HTMLAnchorElement &&\n isInternalUrl(element, this.document) &&\n hasTargetSelf(element) &&\n !hasDownloadAttribute(element)\n ) {\n const { pathname, search, hash } = element;\n // A `<base>` element makes the browser resolve fragment-only hrefs\n // (e.g. `href=\"#some-id\"`) against the base URL rather than the\n // current document, so `pathname`/`search` come back as the base's\n // rather than the current page's. Fall back to the document's own\n // location in that case, or an in-page anchor link would navigate\n // to the base route and lose the fragment there.\n const isFragmentOnly = element.getAttribute('href')?.startsWith('#');\n const resolvedPathname = isFragmentOnly\n ? this.document.location.pathname\n : pathname;\n const resolvedSearch = isFragmentOnly\n ? this.document.location.search\n : search;\n const url = this.location.normalize(\n `${resolvedPathname}${resolvedSearch}${hash}`,\n );\n this.router.navigateByUrl(url);\n\n return false;\n }\n\n return true;\n }\n}\n\nfunction hasDownloadAttribute(anchorElement: HTMLAnchorElement): boolean {\n return anchorElement.getAttribute('download') !== null;\n}\n\nfunction hasTargetSelf(anchorElement: HTMLAnchorElement): boolean {\n return !anchorElement.target || anchorElement.target === '_self';\n}\n\nfunction isInternalUrl(\n anchorElement: HTMLAnchorElement,\n document: Document,\n): boolean {\n return (\n anchorElement.host === document.location.host &&\n anchorElement.protocol === document.location.protocol\n );\n}\n","export type ContentFileModule<\n Attributes extends Record<string, any> = Record<string, any>,\n> = {\n default: string;\n metadata: Attributes;\n};\n\nexport type ContentFileLoader = () => Promise<string | ContentFileModule>;\n\n/**\n * Reads a loaded content file. Build-time content modules carry their\n * frontmatter as `metadata`; raw strings from custom loaders are parsed\n * with a lazily loaded frontmatter parser.\n */\nexport async function parseContentFile<\n Attributes extends Record<string, any> = Record<string, any>,\n>(\n file: string | ContentFileModule,\n): Promise<{ content: string; attributes: Attributes }> {\n if (typeof file !== 'string') {\n return { content: file.default, attributes: file.metadata as Attributes };\n }\n\n const { parseRawContentFile } = await import('./parse-raw-content-file');\n return parseRawContentFile<Attributes>(file);\n}\n","import { firstValueFrom, isObservable, Observable } from 'rxjs';\n\ndeclare const Zone: any;\n\nexport async function waitFor<T>(prom: Promise<T> | Observable<T>): Promise<T> {\n if (isObservable(prom)) {\n prom = firstValueFrom(prom);\n }\n\n if (typeof Zone === 'undefined') {\n return prom;\n }\n\n const macroTask = Zone.current.scheduleMacroTask(\n `AnalogContentResolve-${Math.random()}`,\n () => {\n /* noop */\n },\n {},\n () => {\n /* noop */\n },\n );\n return prom.then((p: T) => {\n macroTask.invoke();\n return p;\n });\n}\n","/// <reference types=\"vite/client\" />\n\nimport { inject } from '@angular/core';\nimport { ActivatedRoute } from '@angular/router';\nimport { from, Observable, of } from 'rxjs';\nimport { finalize, map, switchMap, tap } from 'rxjs/operators';\n\nimport { ContentFile } from './content-file';\nimport { ContentRenderer } from './content-renderer';\nimport { CONTENT_LOCALE, withLocaleCandidates } from './content-locale';\nimport { CONTENT_FILES_TOKEN } from './content-files-token';\nimport {\n type ContentFileLoader,\n type ContentFileModule,\n parseContentFile,\n} from './parse-content-file';\nimport { waitFor } from './utils/zone-wait-for';\nimport { RenderTaskService } from './render-task.service';\n\nfunction getContentFile<\n Attributes extends Record<string, any> = Record<string, any>,\n>(\n contentFiles: Record<string, ContentFileLoader>,\n prefix: string,\n slug: string,\n fallback: string,\n renderTaskService: RenderTaskService,\n contentRenderer: ContentRenderer,\n locale?: string | null,\n): Observable<ContentFile<Attributes | Record<string, never>>> {\n // Normalize file keys so both \"/src/content/...\" and \"/<project>/src/content/...\" resolve.\n const normalizedFiles: Record<string, ContentFileLoader> = {};\n for (const [key, resolver] of Object.entries(contentFiles)) {\n const normalizedKey = key\n .replace(/^(?:.*?)\\/content(?=\\/)/, '/src/content')\n .replace(/\\/{2,}/g, '/');\n normalizedFiles[normalizedKey] = resolver;\n }\n\n const base = `/src/content/${prefix}${slug}`.replace(/\\/{2,}/g, '/');\n const candidates = [`${base}.md`, `${base}/index.md`];\n\n const allCandidates = withLocaleCandidates(candidates, locale);\n const matchKey = allCandidates.find((k) => k in normalizedFiles);\n const contentFile = matchKey ? normalizedFiles[matchKey] : undefined;\n const resolvedBase = (matchKey || `${base}.md`).replace(/\\.md$/, '');\n\n if (!contentFile) {\n return of({\n filename: resolvedBase,\n attributes: {},\n slug: '',\n content: fallback,\n toc: [],\n });\n }\n\n const contentTask = renderTaskService.addRenderTask();\n return new Observable<string | ContentFileModule>((observer) => {\n // `waitFor` is a no-op in non-Zone environments (browser without zone.js),\n // so this branch works for both SSR and client. Keeping a single path also\n // avoids Rolldown evaluating `import.meta.env.SSR` at library-build time\n // and eliminating the task-clearing branch, which caused SSR to hang once\n // the content map resolved a real lazy import.\n waitFor(contentFile()).then((content) => {\n observer.next(content);\n observer.complete();\n\n setTimeout(() => renderTaskService.clearRenderTask(contentTask), 10);\n });\n }).pipe(\n switchMap((contentFile) => parseContentFile<Attributes>(contentFile)),\n switchMap(({ content, attributes }) =>\n from(contentRenderer.render(content)).pipe(\n map((rendered) => ({\n filename: resolvedBase,\n slug,\n attributes,\n content,\n toc: rendered.toc ?? [],\n })),\n ),\n ),\n finalize(() => {\n if (import.meta.env.SSR !== true) {\n renderTaskService.clearRenderTask(contentTask);\n }\n }),\n );\n}\n\n/**\n * Retrieves the static content using the provided param and/or prefix.\n *\n * @param param route parameter (default: 'slug')\n * @param fallback fallback text if content file is not found (default: 'No Content Found')\n */\nexport function injectContent<\n Attributes extends Record<string, any> = Record<string, any>,\n>(\n param:\n | string\n | {\n param: string;\n subdirectory: string;\n }\n | {\n customFilename: string;\n } = 'slug',\n fallback = 'No Content Found',\n): Observable<ContentFile<Attributes | Record<string, never>>> {\n const contentFiles = inject(CONTENT_FILES_TOKEN);\n const contentRenderer = inject(ContentRenderer);\n const renderTaskService = inject(RenderTaskService);\n const locale = inject(CONTENT_LOCALE, { optional: true });\n const task = renderTaskService.addRenderTask();\n\n if (typeof param === 'string' || 'param' in param) {\n const prefix = typeof param === 'string' ? '' : `${param.subdirectory}/`;\n const route = inject(ActivatedRoute);\n const paramKey = typeof param === 'string' ? param : param.param;\n return route.paramMap.pipe(\n map((params) => params.get(paramKey)),\n switchMap((slug) => {\n if (slug) {\n return getContentFile<Attributes>(\n contentFiles,\n prefix,\n slug,\n fallback,\n renderTaskService,\n contentRenderer,\n locale,\n );\n }\n return of({\n filename: '',\n slug: '',\n attributes: {},\n content: fallback,\n toc: [],\n });\n }),\n tap(() => renderTaskService.clearRenderTask(task)),\n );\n } else {\n return getContentFile<Attributes>(\n contentFiles,\n '',\n param.customFilename,\n fallback,\n renderTaskService,\n contentRenderer,\n locale,\n ).pipe(tap(() => renderTaskService.clearRenderTask(task)));\n }\n}\n","import { Provider, InjectionToken } from '@angular/core';\nimport { ContentRenderer, NoopContentRenderer } from './content-renderer';\nimport { RenderTaskService } from './render-task.service';\nimport { withContentFileLoader } from './content-file-loader';\nimport { withContentListLoader } from './content-list-loader';\n\nexport interface MarkdownRendererOptions {\n loadMermaid?: () => Promise<typeof import('mermaid')>;\n}\n\nconst CONTENT_RENDERER_PROVIDERS: Provider[] = [\n {\n provide: ContentRenderer,\n useClass: NoopContentRenderer,\n },\n withContentFileLoader(),\n withContentListLoader(),\n];\n\nexport function withMarkdownRenderer(\n options?: MarkdownRendererOptions,\n): Provider {\n return [\n CONTENT_RENDERER_PROVIDERS,\n options?.loadMermaid\n ? [\n {\n provide: MERMAID_IMPORT_TOKEN,\n useFactory: options.loadMermaid,\n },\n ]\n : [],\n ];\n}\n\nexport function provideContent(...features: Provider[]): Provider[] {\n return [\n { provide: RenderTaskService, useClass: RenderTaskService },\n ...features,\n ];\n}\n\nexport const MERMAID_IMPORT_TOKEN: InjectionToken<\n Promise<typeof import('mermaid')>\n> = new InjectionToken<Promise<typeof import('mermaid')>>('mermaid_import');\n","import {\n AfterViewChecked,\n Component,\n inject,\n Input,\n ViewEncapsulation,\n} from '@angular/core';\nimport { DomSanitizer, SafeHtml } from '@angular/platform-browser';\nimport { ActivatedRoute } from '@angular/router';\n\nimport { ContentRenderer } from './content-renderer';\nimport { AnchorNavigationDirective } from './anchor-navigation.directive';\n\n@Component({\n selector: 'analog-markdown-route',\n standalone: true,\n imports: [],\n hostDirectives: [AnchorNavigationDirective],\n preserveWhitespaces: true,\n encapsulation: ViewEncapsulation.None,\n template: `<div [innerHTML]=\"content\" [class]=\"classes\"></div>`,\n})\nexport default class AnalogMarkdownRouteComponent implements AfterViewChecked {\n private sanitizer = inject(DomSanitizer);\n private route = inject(ActivatedRoute);\n contentRenderer: ContentRenderer = inject(ContentRenderer);\n\n protected content: SafeHtml = this.sanitizer.bypassSecurityTrustHtml(\n this.route.snapshot.data['renderedAnalogContent'],\n );\n\n @Input() classes = 'analog-markdown-route';\n\n ngAfterViewChecked(): void {\n this.contentRenderer.enhance();\n }\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n AfterViewChecked,\n Component,\n InputSignal,\n NgZone,\n PLATFORM_ID,\n Signal,\n ViewEncapsulation,\n computed,\n inject,\n input,\n} from '@angular/core';\nimport { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';\nimport { DomSanitizer, SafeHtml } from '@angular/platform-browser';\nimport { ActivatedRoute, Data } from '@angular/router';\nimport { from, Observable, of } from 'rxjs';\nimport { catchError, map, switchMap } from 'rxjs/operators';\n\nimport { AnchorNavigationDirective } from './anchor-navigation.directive';\nimport { ContentRenderer } from './content-renderer';\nimport { MERMAID_IMPORT_TOKEN } from './provide-content';\n\n@Component({\n selector: 'analog-markdown',\n standalone: true,\n hostDirectives: [AnchorNavigationDirective],\n preserveWhitespaces: true,\n encapsulation: ViewEncapsulation.None,\n template: ` <div [innerHTML]=\"htmlContent()\" [class]=\"classes()\"></div> `,\n})\nexport default class AnalogMarkdownComponent implements AfterViewChecked {\n private sanitizer = inject(DomSanitizer);\n private route = inject(ActivatedRoute);\n private zone = inject(NgZone);\n private readonly platformId = inject(PLATFORM_ID);\n private readonly mermaidImport = inject(MERMAID_IMPORT_TOKEN, {\n optional: true,\n });\n private mermaid: typeof import('mermaid') | undefined;\n\n private contentSource: Signal<SafeHtml | string | undefined> = toSignal(\n this.getContentSource(),\n );\n readonly htmlContent: Signal<SafeHtml | string | undefined> = computed(() => {\n const inputContent = this.content();\n\n if (inputContent) {\n return this.sanitizer.bypassSecurityTrustHtml(inputContent as string);\n }\n\n return this.contentSource();\n });\n readonly content: InputSignal<string | object | null | undefined> = input<\n string | object | null\n >();\n readonly classes: InputSignal<string> = input('analog-markdown');\n\n contentRenderer: ContentRenderer = inject(ContentRenderer);\n\n constructor() {\n if (isPlatformBrowser(this.platformId) && this.mermaidImport) {\n // Mermaid can only be loaded on client side\n this.loadMermaid(this.mermaidImport);\n }\n }\n\n getContentSource(): Observable<SafeHtml | string> {\n return this.route.data.pipe(\n map<Data, string>((data) => data['_analogContent'] ?? ''),\n switchMap((contentString) => this.renderContent(contentString)),\n map((content) => this.sanitizer.bypassSecurityTrustHtml(content)),\n catchError((e) => of(`There was an error ${e}`)),\n );\n }\n\n async renderContent(content: string): Promise<string> {\n const rendered = await this.contentRenderer.render(content);\n return rendered.content;\n }\n\n ngAfterViewChecked(): void {\n this.contentRenderer.enhance();\n this.zone.runOutsideAngular(() => this.mermaid?.default.run());\n }\n\n private loadMermaid(mermaidImport: Promise<typeof import('mermaid')>) {\n this.zone.runOutsideAngular(() =>\n // Wrap into an observable to avoid redundant initialization once\n // the markdown component is destroyed before the promise is resolved.\n from(mermaidImport)\n .pipe(takeUntilDestroyed())\n .subscribe((mermaid) => {\n this.mermaid = mermaid;\n this.mermaid.default.initialize({ startOnLoad: false });\n // Explicitly running mermaid as ngAfterViewChecked\n // has probably already been called\n this.mermaid?.default.run();\n }),\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;AAQA,IAAa,4BAAb,MAAa,0BAAyB;CAJtC,cAAA;EAKmB,KAAA,WAAW,OAAO,QAAQ;EAC1B,KAAA,WAAW,OAAO,QAAQ;EAC1B,KAAA,SAAS,OAAO,MAAM;CAkCxC;CA/BC,iBAAiB,SAA2B;EAC1C,IACE,mBAAmB,qBACnB,cAAc,SAAS,KAAK,QAAQ,KACpC,cAAc,OAAO,KACrB,CAAC,qBAAqB,OAAO,GAC7B;GACA,MAAM,EAAE,UAAU,QAAQ,SAAS;GAOnC,MAAM,iBAAiB,QAAQ,aAAa,MAAM,CAAC,EAAE,WAAW,GAAG;GACnE,MAAM,mBAAmB,iBACrB,KAAK,SAAS,SAAS,WACvB;GACJ,MAAM,iBAAiB,iBACnB,KAAK,SAAS,SAAS,SACvB;GACJ,MAAM,MAAM,KAAK,SAAS,UACxB,GAAG,mBAAmB,iBAAiB,MAAM;GAE/C,KAAK,OAAO,cAAc,GAAG;GAE7B,OAAO;EACT;EAEA,OAAO;CACT;C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;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAuB,MAAA,CAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAAvB;EAAA,KAAA,OAAA,GAAA,qBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,MAAA;GAAuB,cAAA;GAAA,UAAA;GAAA,QAAA;IAAA,SAAA;KAAA,mBAAA;KAAA,YAAA;KAAA,UAAA;KAAA,YAAA;KAAA,mBAAA;IAAA;IAAA,SAAA;KAAA,mBAAA;KAAA,YAAA;KAAA,UAAA;KAAA,YAAA;KAAA,mBAAA;IAAA;GAAA;GAAA,gBAAA,CAAA,EAAA,WAAA,0BAAA,CAAA;GAAA,UAAA;GAAA,UAFhC;GAA+D,UAAA;GAAA,eAAA,GAAA,kBAAA;GAAA,qBAAA;EAAA,CAAA;CAAA;;AAEtD,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAuB,YAAA,CAAA;EAR3C,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,YAAY;GACZ,gBAAgB,CAAC,yBAAyB;GAC1C,qBAAqB;GACrB,eAAe,kBAAkB;GACjC,UAAU;EACX,CAAA"}
|
|
1
|
+
{"version":3,"file":"analogjs-content.mjs","names":["i1.AnchorNavigationDirective","i1.AnchorNavigationDirective"],"sources":["../../src/lib/anchor-navigation.directive.ts","../../src/lib/parse-content-file.ts","../../src/lib/utils/zone-wait-for.ts","../../src/lib/content.ts","../../src/lib/provide-content.ts","../../src/lib/markdown-route.component.ts","../../src/lib/markdown.component.ts"],"sourcesContent":["import { Directive, ElementRef, HostListener, inject } from '@angular/core';\nimport { DOCUMENT, Location } from '@angular/common';\nimport { Router } from '@angular/router';\n\n@Directive({\n selector: '[analogAnchorNavigation]',\n standalone: true,\n})\nexport class AnchorNavigationDirective {\n private readonly document = inject(DOCUMENT);\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly location = inject(Location);\n private readonly router = inject(Router);\n\n @HostListener('click', ['$event.target', '$event'])\n handleNavigation(target: EventTarget | null, event?: MouseEvent): boolean {\n if (event && shouldSkipClick(event)) {\n return true;\n }\n\n const element = target instanceof Element ? target.closest('a') : null;\n if (\n element &&\n this.host.nativeElement.contains(element) &&\n isInternalUrl(element, this.document) &&\n hasTargetSelf(element) &&\n !hasDownloadAttribute(element)\n ) {\n const { pathname, search, hash } = element;\n // A `<base>` element makes the browser resolve fragment-only hrefs\n // (e.g. `href=\"#some-id\"`) against the base URL rather than the\n // current document, so `pathname`/`search` come back as the base's\n // rather than the current page's. Fall back to the document's own\n // location in that case, or an in-page anchor link would navigate\n // to the base route and lose the fragment there.\n const isFragmentOnly = element.getAttribute('href')?.startsWith('#');\n const resolvedPathname = isFragmentOnly\n ? this.document.location.pathname\n : pathname;\n const resolvedSearch = isFragmentOnly\n ? this.document.location.search\n : search;\n const url = this.location.normalize(\n `${resolvedPathname}${resolvedSearch}${hash}`,\n );\n this.router.navigateByUrl(url);\n\n return false;\n }\n\n return true;\n }\n}\n\nfunction shouldSkipClick(event: MouseEvent): boolean {\n return (\n event.defaultPrevented ||\n event.button !== 0 ||\n event.ctrlKey ||\n event.metaKey ||\n event.shiftKey ||\n event.altKey\n );\n}\n\nfunction hasDownloadAttribute(anchorElement: HTMLAnchorElement): boolean {\n return anchorElement.getAttribute('download') !== null;\n}\n\nfunction hasTargetSelf(anchorElement: HTMLAnchorElement): boolean {\n return !anchorElement.target || anchorElement.target === '_self';\n}\n\nfunction isInternalUrl(\n anchorElement: HTMLAnchorElement,\n document: Document,\n): boolean {\n return (\n anchorElement.host === document.location.host &&\n anchorElement.protocol === document.location.protocol\n );\n}\n","export type ContentFileModule<\n Attributes extends Record<string, any> = Record<string, any>,\n> = {\n default: string;\n metadata: Attributes;\n};\n\nexport type ContentFileLoader = () => Promise<string | ContentFileModule>;\n\n/**\n * Reads a loaded content file. Build-time content modules carry their\n * frontmatter as `metadata`; raw strings from custom loaders are parsed\n * with a lazily loaded frontmatter parser.\n */\nexport async function parseContentFile<\n Attributes extends Record<string, any> = Record<string, any>,\n>(\n file: string | ContentFileModule,\n): Promise<{ content: string; attributes: Attributes }> {\n if (typeof file !== 'string') {\n return { content: file.default, attributes: file.metadata as Attributes };\n }\n\n const { parseRawContentFile } = await import('./parse-raw-content-file');\n return parseRawContentFile<Attributes>(file);\n}\n","import { firstValueFrom, isObservable, Observable } from 'rxjs';\n\ndeclare const Zone: any;\n\nexport async function waitFor<T>(prom: Promise<T> | Observable<T>): Promise<T> {\n if (isObservable(prom)) {\n prom = firstValueFrom(prom);\n }\n\n if (typeof Zone === 'undefined') {\n return prom;\n }\n\n const macroTask = Zone.current.scheduleMacroTask(\n `AnalogContentResolve-${Math.random()}`,\n () => {\n /* noop */\n },\n {},\n () => {\n /* noop */\n },\n );\n return prom.then((p: T) => {\n macroTask.invoke();\n return p;\n });\n}\n","/// <reference types=\"vite/client\" />\n\nimport { inject } from '@angular/core';\nimport { ActivatedRoute } from '@angular/router';\nimport { from, Observable, of } from 'rxjs';\nimport { finalize, map, switchMap, tap } from 'rxjs/operators';\n\nimport { ContentFile } from './content-file';\nimport { ContentRenderer } from './content-renderer';\nimport { CONTENT_LOCALE, withLocaleCandidates } from './content-locale';\nimport { CONTENT_FILES_TOKEN } from './content-files-token';\nimport {\n type ContentFileLoader,\n type ContentFileModule,\n parseContentFile,\n} from './parse-content-file';\nimport { waitFor } from './utils/zone-wait-for';\nimport { RenderTaskService } from './render-task.service';\n\nfunction getContentFile<\n Attributes extends Record<string, any> = Record<string, any>,\n>(\n contentFiles: Record<string, ContentFileLoader>,\n prefix: string,\n slug: string,\n fallback: string,\n renderTaskService: RenderTaskService,\n contentRenderer: ContentRenderer,\n locale?: string | null,\n): Observable<ContentFile<Attributes | Record<string, never>>> {\n // Normalize file keys so both \"/src/content/...\" and \"/<project>/src/content/...\" resolve.\n const normalizedFiles: Record<string, ContentFileLoader> = {};\n for (const [key, resolver] of Object.entries(contentFiles)) {\n const normalizedKey = key\n .replace(/^(?:.*?)\\/content(?=\\/)/, '/src/content')\n .replace(/\\/{2,}/g, '/');\n normalizedFiles[normalizedKey] = resolver;\n }\n\n const base = `/src/content/${prefix}${slug}`.replace(/\\/{2,}/g, '/');\n const candidates = [`${base}.md`, `${base}/index.md`];\n\n const allCandidates = withLocaleCandidates(candidates, locale);\n const matchKey = allCandidates.find((k) => k in normalizedFiles);\n const contentFile = matchKey ? normalizedFiles[matchKey] : undefined;\n const resolvedBase = (matchKey || `${base}.md`).replace(/\\.md$/, '');\n\n if (!contentFile) {\n return of({\n filename: resolvedBase,\n attributes: {},\n slug: '',\n content: fallback,\n toc: [],\n });\n }\n\n const contentTask = renderTaskService.addRenderTask();\n return new Observable<string | ContentFileModule>((observer) => {\n // `waitFor` is a no-op in non-Zone environments (browser without zone.js),\n // so this branch works for both SSR and client. Keeping a single path also\n // avoids Rolldown evaluating `import.meta.env.SSR` at library-build time\n // and eliminating the task-clearing branch, which caused SSR to hang once\n // the content map resolved a real lazy import.\n waitFor(contentFile()).then((content) => {\n observer.next(content);\n observer.complete();\n\n setTimeout(() => renderTaskService.clearRenderTask(contentTask), 10);\n });\n }).pipe(\n switchMap((contentFile) => parseContentFile<Attributes>(contentFile)),\n switchMap(({ content, attributes }) =>\n from(contentRenderer.render(content)).pipe(\n map((rendered) => ({\n filename: resolvedBase,\n slug,\n attributes,\n content,\n toc: rendered.toc ?? [],\n })),\n ),\n ),\n finalize(() => {\n if (import.meta.env.SSR !== true) {\n renderTaskService.clearRenderTask(contentTask);\n }\n }),\n );\n}\n\n/**\n * Retrieves the static content using the provided param and/or prefix.\n *\n * @param param route parameter (default: 'slug')\n * @param fallback fallback text if content file is not found (default: 'No Content Found')\n */\nexport function injectContent<\n Attributes extends Record<string, any> = Record<string, any>,\n>(\n param:\n | string\n | {\n param: string;\n subdirectory: string;\n }\n | {\n customFilename: string;\n } = 'slug',\n fallback = 'No Content Found',\n): Observable<ContentFile<Attributes | Record<string, never>>> {\n const contentFiles = inject(CONTENT_FILES_TOKEN);\n const contentRenderer = inject(ContentRenderer);\n const renderTaskService = inject(RenderTaskService);\n const locale = inject(CONTENT_LOCALE, { optional: true });\n const task = renderTaskService.addRenderTask();\n\n if (typeof param === 'string' || 'param' in param) {\n const prefix = typeof param === 'string' ? '' : `${param.subdirectory}/`;\n const route = inject(ActivatedRoute);\n const paramKey = typeof param === 'string' ? param : param.param;\n return route.paramMap.pipe(\n map((params) => params.get(paramKey)),\n switchMap((slug) => {\n if (slug) {\n return getContentFile<Attributes>(\n contentFiles,\n prefix,\n slug,\n fallback,\n renderTaskService,\n contentRenderer,\n locale,\n );\n }\n return of({\n filename: '',\n slug: '',\n attributes: {},\n content: fallback,\n toc: [],\n });\n }),\n tap(() => renderTaskService.clearRenderTask(task)),\n );\n } else {\n return getContentFile<Attributes>(\n contentFiles,\n '',\n param.customFilename,\n fallback,\n renderTaskService,\n contentRenderer,\n locale,\n ).pipe(tap(() => renderTaskService.clearRenderTask(task)));\n }\n}\n","import { Provider, InjectionToken } from '@angular/core';\nimport { ContentRenderer, NoopContentRenderer } from './content-renderer';\nimport { RenderTaskService } from './render-task.service';\nimport { withContentFileLoader } from './content-file-loader';\nimport { withContentListLoader } from './content-list-loader';\n\nexport interface MarkdownRendererOptions {\n loadMermaid?: () => Promise<typeof import('mermaid')>;\n}\n\nconst CONTENT_RENDERER_PROVIDERS: Provider[] = [\n {\n provide: ContentRenderer,\n useClass: NoopContentRenderer,\n },\n withContentFileLoader(),\n withContentListLoader(),\n];\n\nexport function withMarkdownRenderer(\n options?: MarkdownRendererOptions,\n): Provider {\n return [\n CONTENT_RENDERER_PROVIDERS,\n options?.loadMermaid\n ? [\n {\n provide: MERMAID_IMPORT_TOKEN,\n useFactory: options.loadMermaid,\n },\n ]\n : [],\n ];\n}\n\nexport function provideContent(...features: Provider[]): Provider[] {\n return [\n { provide: RenderTaskService, useClass: RenderTaskService },\n ...features,\n ];\n}\n\nexport const MERMAID_IMPORT_TOKEN: InjectionToken<\n Promise<typeof import('mermaid')>\n> = new InjectionToken<Promise<typeof import('mermaid')>>('mermaid_import');\n","import {\n AfterViewChecked,\n Component,\n inject,\n Input,\n ViewEncapsulation,\n} from '@angular/core';\nimport { DomSanitizer, SafeHtml } from '@angular/platform-browser';\nimport { ActivatedRoute } from '@angular/router';\n\nimport { ContentRenderer } from './content-renderer';\nimport { AnchorNavigationDirective } from './anchor-navigation.directive';\n\n@Component({\n selector: 'analog-markdown-route',\n standalone: true,\n imports: [],\n hostDirectives: [AnchorNavigationDirective],\n preserveWhitespaces: true,\n encapsulation: ViewEncapsulation.None,\n template: `<div [innerHTML]=\"content\" [class]=\"classes\"></div>`,\n})\nexport default class AnalogMarkdownRouteComponent implements AfterViewChecked {\n private sanitizer = inject(DomSanitizer);\n private route = inject(ActivatedRoute);\n contentRenderer: ContentRenderer = inject(ContentRenderer);\n\n protected content: SafeHtml = this.sanitizer.bypassSecurityTrustHtml(\n this.route.snapshot.data['renderedAnalogContent'],\n );\n\n @Input() classes = 'analog-markdown-route';\n\n ngAfterViewChecked(): void {\n this.contentRenderer.enhance();\n }\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n AfterViewChecked,\n Component,\n InputSignal,\n NgZone,\n PLATFORM_ID,\n Signal,\n ViewEncapsulation,\n computed,\n inject,\n input,\n} from '@angular/core';\nimport { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';\nimport { DomSanitizer, SafeHtml } from '@angular/platform-browser';\nimport { ActivatedRoute, Data } from '@angular/router';\nimport { from, Observable, of } from 'rxjs';\nimport { catchError, map, switchMap } from 'rxjs/operators';\n\nimport { AnchorNavigationDirective } from './anchor-navigation.directive';\nimport { ContentRenderer } from './content-renderer';\nimport { MERMAID_IMPORT_TOKEN } from './provide-content';\n\n@Component({\n selector: 'analog-markdown',\n standalone: true,\n hostDirectives: [AnchorNavigationDirective],\n preserveWhitespaces: true,\n encapsulation: ViewEncapsulation.None,\n template: ` <div [innerHTML]=\"htmlContent()\" [class]=\"classes()\"></div> `,\n})\nexport default class AnalogMarkdownComponent implements AfterViewChecked {\n private sanitizer = inject(DomSanitizer);\n private route = inject(ActivatedRoute);\n private zone = inject(NgZone);\n private readonly platformId = inject(PLATFORM_ID);\n private readonly mermaidImport = inject(MERMAID_IMPORT_TOKEN, {\n optional: true,\n });\n private mermaid: typeof import('mermaid') | undefined;\n\n private contentSource: Signal<SafeHtml | string | undefined> = toSignal(\n this.getContentSource(),\n );\n readonly htmlContent: Signal<SafeHtml | string | undefined> = computed(() => {\n const inputContent = this.content();\n\n if (inputContent) {\n return this.sanitizer.bypassSecurityTrustHtml(inputContent as string);\n }\n\n return this.contentSource();\n });\n readonly content: InputSignal<string | object | null | undefined> = input<\n string | object | null\n >();\n readonly classes: InputSignal<string> = input('analog-markdown');\n\n contentRenderer: ContentRenderer = inject(ContentRenderer);\n\n constructor() {\n if (isPlatformBrowser(this.platformId) && this.mermaidImport) {\n // Mermaid can only be loaded on client side\n this.loadMermaid(this.mermaidImport);\n }\n }\n\n getContentSource(): Observable<SafeHtml | string> {\n return this.route.data.pipe(\n map<Data, string>((data) => data['_analogContent'] ?? ''),\n switchMap((contentString) => this.renderContent(contentString)),\n map((content) => this.sanitizer.bypassSecurityTrustHtml(content)),\n catchError((e) => of(`There was an error ${e}`)),\n );\n }\n\n async renderContent(content: string): Promise<string> {\n const rendered = await this.contentRenderer.render(content);\n return rendered.content;\n }\n\n ngAfterViewChecked(): void {\n this.contentRenderer.enhance();\n this.zone.runOutsideAngular(() => this.mermaid?.default.run());\n }\n\n private loadMermaid(mermaidImport: Promise<typeof import('mermaid')>) {\n this.zone.runOutsideAngular(() =>\n // Wrap into an observable to avoid redundant initialization once\n // the markdown component is destroyed before the promise is resolved.\n from(mermaidImport)\n .pipe(takeUntilDestroyed())\n .subscribe((mermaid) => {\n this.mermaid = mermaid;\n this.mermaid.default.initialize({ startOnLoad: false });\n // Explicitly running mermaid as ngAfterViewChecked\n // has probably already been called\n this.mermaid?.default.run();\n }),\n );\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AA,YAAA;KAAA,mBAAA;IAAA;GAAA;GAAA,gBAAA,CAAA,EAAA,WAAAC,0BAAA,CAAA;GAAA,UAAA;GAAA,UAFhC;GAA+D,UAAA;GAAA,eAAA,GAAA,kBAAA;GAAA,qBAAA;EAAA,CAAA;CAAA;;AAEtD,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAuB,YAAA,CAAA;EAR3C,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,YAAY;GACZ,gBAAgB,CAAC,yBAAyB;GAC1C,qBAAqB;GACrB,eAAe,kBAAkB;GACjC,UAAU;EACX,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
-
import { Injectable, InjectionToken, TransferState, inject, makeStateKey, signal
|
|
3
|
-
|
|
2
|
+
import { Injectable, InjectionToken, PendingTasks, TransferState, inject, makeStateKey, signal } from "@angular/core";
|
|
3
|
+
// packages/content/src/lib/content-renderer.ts
|
|
4
4
|
var ContentRenderer = class ContentRenderer {
|
|
5
5
|
async render(content) {
|
|
6
6
|
return {
|
|
@@ -12,7 +12,7 @@ var ContentRenderer = class ContentRenderer {
|
|
|
12
12
|
static {
|
|
13
13
|
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
14
14
|
minVersion: "12.0.0",
|
|
15
|
-
version: "22.
|
|
15
|
+
version: "22.3.0",
|
|
16
16
|
ngImport: i0,
|
|
17
17
|
type: ContentRenderer,
|
|
18
18
|
deps: [],
|
|
@@ -22,7 +22,7 @@ var ContentRenderer = class ContentRenderer {
|
|
|
22
22
|
static {
|
|
23
23
|
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
24
24
|
minVersion: "12.0.0",
|
|
25
|
-
version: "22.
|
|
25
|
+
version: "22.3.0",
|
|
26
26
|
ngImport: i0,
|
|
27
27
|
type: ContentRenderer
|
|
28
28
|
});
|
|
@@ -30,7 +30,7 @@ var ContentRenderer = class ContentRenderer {
|
|
|
30
30
|
};
|
|
31
31
|
i0.ɵɵngDeclareClassMetadata({
|
|
32
32
|
minVersion: "12.0.0",
|
|
33
|
-
version: "22.
|
|
33
|
+
version: "22.3.0",
|
|
34
34
|
ngImport: i0,
|
|
35
35
|
type: ContentRenderer,
|
|
36
36
|
decorators: [{ type: Injectable }]
|
|
@@ -116,8 +116,7 @@ var NoopContentRenderer = class {
|
|
|
116
116
|
return count === 0 ? baseSlug : `${baseSlug}-${count}`;
|
|
117
117
|
}
|
|
118
118
|
};
|
|
119
|
-
|
|
120
|
-
//#region packages/content/src/lib/content-locale.ts
|
|
119
|
+
// packages/content/src/lib/content-locale.ts
|
|
121
120
|
/**
|
|
122
121
|
* Token for the active content locale.
|
|
123
122
|
* Provided via `withLocale()` in `provideContent()`.
|
|
@@ -200,8 +199,7 @@ function withLocaleCandidates(candidates, locale) {
|
|
|
200
199
|
if (!locale) return candidates;
|
|
201
200
|
return [...candidates.map((c) => c.replace("/src/content/", `/src/content/${locale}/`)), ...candidates];
|
|
202
201
|
}
|
|
203
|
-
|
|
204
|
-
//#region packages/content/src/lib/get-content-files.ts
|
|
202
|
+
// packages/content/src/lib/get-content-files.ts
|
|
205
203
|
/**
|
|
206
204
|
* These bindings are rewritten at build time:
|
|
207
205
|
* - `ANALOG_CONTENT_FILE_LIST` by `@analogjs/platform`'s content plugin,
|
|
@@ -231,8 +229,7 @@ var getContentFilesList = () => ANALOG_CONTENT_FILE_LIST;
|
|
|
231
229
|
* Returns the lazy loaded content files for lookups.
|
|
232
230
|
*/
|
|
233
231
|
var getContentFiles = () => ANALOG_CONTENT_ROUTE_FILES;
|
|
234
|
-
|
|
235
|
-
//#region packages/content/src/lib/content-files-list-token.ts
|
|
232
|
+
// packages/content/src/lib/content-files-list-token.ts
|
|
236
233
|
function getSlug(filename) {
|
|
237
234
|
const base = (filename.split(/[/\\]/).pop() || "").trim().replace(/\.[^./\\]+$/, "");
|
|
238
235
|
return base === "index" ? "" : base;
|
|
@@ -252,8 +249,7 @@ var CONTENT_FILES_LIST_TOKEN = new InjectionToken("@analogjs/content Content Fil
|
|
|
252
249
|
});
|
|
253
250
|
}
|
|
254
251
|
});
|
|
255
|
-
|
|
256
|
-
//#region packages/content/src/lib/content-files-token.ts
|
|
252
|
+
// packages/content/src/lib/content-files-token.ts
|
|
257
253
|
var CONTENT_FILES_TOKEN = new InjectionToken("@analogjs/content Content Files", {
|
|
258
254
|
providedIn: "root",
|
|
259
255
|
factory() {
|
|
@@ -292,21 +288,19 @@ new InjectionToken("@analogjs/content Content Files", {
|
|
|
292
288
|
return signal(inject(CONTENT_FILES_TOKEN));
|
|
293
289
|
}
|
|
294
290
|
});
|
|
295
|
-
|
|
296
|
-
//#region packages/content/src/lib/render-task.service.ts
|
|
291
|
+
// packages/content/src/lib/render-task.service.ts
|
|
297
292
|
var RenderTaskService = class RenderTaskService {
|
|
298
|
-
#pendingTasks = inject(
|
|
293
|
+
#pendingTasks = inject(PendingTasks);
|
|
299
294
|
addRenderTask() {
|
|
300
295
|
return this.#pendingTasks.add();
|
|
301
296
|
}
|
|
302
297
|
clearRenderTask(clear) {
|
|
303
|
-
|
|
304
|
-
else if (typeof this.#pendingTasks.remove === "function") this.#pendingTasks.remove(clear);
|
|
298
|
+
clear();
|
|
305
299
|
}
|
|
306
300
|
static {
|
|
307
301
|
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
308
302
|
minVersion: "12.0.0",
|
|
309
|
-
version: "22.
|
|
303
|
+
version: "22.3.0",
|
|
310
304
|
ngImport: i0,
|
|
311
305
|
type: RenderTaskService,
|
|
312
306
|
deps: [],
|
|
@@ -316,7 +310,7 @@ var RenderTaskService = class RenderTaskService {
|
|
|
316
310
|
static {
|
|
317
311
|
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
318
312
|
minVersion: "12.0.0",
|
|
319
|
-
version: "22.
|
|
313
|
+
version: "22.3.0",
|
|
320
314
|
ngImport: i0,
|
|
321
315
|
type: RenderTaskService
|
|
322
316
|
});
|
|
@@ -324,13 +318,12 @@ var RenderTaskService = class RenderTaskService {
|
|
|
324
318
|
};
|
|
325
319
|
i0.ɵɵngDeclareClassMetadata({
|
|
326
320
|
minVersion: "12.0.0",
|
|
327
|
-
version: "22.
|
|
321
|
+
version: "22.3.0",
|
|
328
322
|
ngImport: i0,
|
|
329
323
|
type: RenderTaskService,
|
|
330
324
|
decorators: [{ type: Injectable }]
|
|
331
325
|
});
|
|
332
|
-
|
|
333
|
-
//#region packages/content/src/lib/inject-content-files.ts
|
|
326
|
+
// packages/content/src/lib/inject-content-files.ts
|
|
334
327
|
function injectContentFiles(filterFn) {
|
|
335
328
|
const renderTaskService = inject(RenderTaskService);
|
|
336
329
|
const task = renderTaskService.addRenderTask();
|
|
@@ -345,8 +338,7 @@ function injectContentFiles(filterFn) {
|
|
|
345
338
|
function injectContentFilesMap() {
|
|
346
339
|
return inject(CONTENT_FILES_TOKEN);
|
|
347
340
|
}
|
|
348
|
-
|
|
349
|
-
//#region packages/content/src/lib/content-file-loader.ts
|
|
341
|
+
// packages/content/src/lib/content-file-loader.ts
|
|
350
342
|
var CONTENT_FILE_LOADER = new InjectionToken("@analogjs/content/resource File Loader");
|
|
351
343
|
function injectContentFileLoader() {
|
|
352
344
|
return inject(CONTENT_FILE_LOADER);
|
|
@@ -355,12 +347,12 @@ function withContentFileLoader() {
|
|
|
355
347
|
return {
|
|
356
348
|
provide: CONTENT_FILE_LOADER,
|
|
357
349
|
useFactory() {
|
|
358
|
-
|
|
350
|
+
const files = injectContentFilesMap();
|
|
351
|
+
return async () => files;
|
|
359
352
|
}
|
|
360
353
|
};
|
|
361
354
|
}
|
|
362
|
-
|
|
363
|
-
//#region packages/content/src/lib/content-list-loader.ts
|
|
355
|
+
// packages/content/src/lib/content-list-loader.ts
|
|
364
356
|
var CONTENT_LIST_LOADER = new InjectionToken("@analogjs/content/resource List Loader");
|
|
365
357
|
function injectContentListLoader() {
|
|
366
358
|
return inject(CONTENT_LIST_LOADER);
|
|
@@ -369,11 +361,11 @@ function withContentListLoader() {
|
|
|
369
361
|
return {
|
|
370
362
|
provide: CONTENT_LIST_LOADER,
|
|
371
363
|
useFactory() {
|
|
372
|
-
|
|
364
|
+
const files = injectContentFiles();
|
|
365
|
+
return async () => files;
|
|
373
366
|
}
|
|
374
367
|
};
|
|
375
368
|
}
|
|
376
|
-
//#endregion
|
|
377
369
|
export { NoopContentRenderer as _, injectContentFileLoader as a, injectContentFilesMap as c, CONTENT_LOCALE as d, filterByLocale as f, ContentRenderer as g, withLocaleCandidates as h, CONTENT_FILE_LOADER as i, RenderTaskService as l, withLocale as m, injectContentListLoader as n, withContentFileLoader as o, injectContentLocale as p, withContentListLoader as r, injectContentFiles as s, CONTENT_LIST_LOADER as t, CONTENT_FILES_TOKEN as u };
|
|
378
370
|
|
|
379
371
|
//# sourceMappingURL=content-list-loader.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-list-loader.mjs","names":[],"sources":["../../src/lib/content-renderer.ts","../../src/lib/content-locale.ts","../../src/lib/get-content-files.ts","../../src/lib/content-files-list-token.ts","../../src/lib/content-files-token.ts","../../src/lib/render-task.service.ts","../../src/lib/inject-content-files.ts","../../src/lib/content-file-loader.ts","../../src/lib/content-list-loader.ts"],"sourcesContent":["/// <reference types=\"vite/client\" />\n\nimport { Injectable, TransferState, inject, makeStateKey } from '@angular/core';\n\nexport type TableOfContentItem = {\n id: string;\n level: number; // starts at 1\n text: string;\n};\n\nexport type RenderedContent = {\n content: string;\n toc: TableOfContentItem[];\n};\n\n@Injectable()\nexport abstract class ContentRenderer {\n async render(content: string): Promise<RenderedContent> {\n return { content, toc: [] };\n }\n\n // eslint-disable-next-line\n enhance(): void {}\n}\n\nexport class NoopContentRenderer implements ContentRenderer {\n private readonly transferState = inject(TransferState);\n private contentId = 0;\n\n /**\n * Generates a hash from the content string\n * to be used with the transfer state\n */\n private generateHash(str: string) {\n let hash = 0;\n for (let i = 0, len = str.length; i < len; i++) {\n const chr = str.charCodeAt(i);\n hash = (hash << 5) - hash + chr;\n hash |= 0; // Convert to 32bit integer\n }\n return hash;\n }\n\n async render(content: string): Promise<RenderedContent> {\n this.contentId = this.generateHash(content);\n const toc = this.extractHeadings(content);\n const key = makeStateKey<TableOfContentItem[]>(\n `content-headings-${this.contentId}`,\n );\n\n if (import.meta.env.SSR === true) {\n this.transferState.set(key, toc);\n return { content, toc };\n }\n\n return {\n content,\n toc: this.transferState.get(key, toc),\n };\n }\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n enhance(): void {}\n\n private extractHeadings(content: string): TableOfContentItem[] {\n const markdownHeadings = this.extractHeadingsFromMarkdown(content);\n if (markdownHeadings.length > 0) {\n return markdownHeadings;\n }\n\n const htmlHeadings = this.extractHeadingsFromHtml(content);\n return htmlHeadings;\n }\n\n private extractHeadingsFromMarkdown(content: string): TableOfContentItem[] {\n const lines = content.split('\\n');\n const toc: TableOfContentItem[] = [];\n const slugCounts = new Map<string, number>();\n\n for (const line of lines) {\n const match = /^(#{1,6})\\s+(.+?)\\s*$/.exec(line);\n if (!match) {\n continue;\n }\n\n const level = match[1].length;\n const text = match[2].trim();\n if (!text) {\n continue;\n }\n\n const baseSlug = text\n .toLowerCase()\n .replace(/[^\\w\\s-]/g, '')\n .trim()\n .replace(/\\s+/g, '-');\n const count = slugCounts.get(baseSlug) ?? 0;\n slugCounts.set(baseSlug, count + 1);\n const id = count === 0 ? baseSlug : `${baseSlug}-${count}`;\n\n toc.push({ id, level, text });\n }\n\n return toc;\n }\n\n private extractHeadingsFromHtml(content: string): TableOfContentItem[] {\n const toc: TableOfContentItem[] = [];\n const slugCounts = new Map<string, number>();\n const headingRegex = /<h([1-6])([^>]*)>([\\s\\S]*?)<\\/h\\1>/gi;\n\n for (const match of content.matchAll(headingRegex)) {\n const level = Number(match[1]);\n const attrs = match[2] ?? '';\n const rawInner = match[3] ?? '';\n const text = rawInner.replace(/<[^>]+>/g, '').trim();\n if (!text) {\n continue;\n }\n\n const idMatch =\n /\\sid=(['\"])(.*?)\\1/i.exec(attrs) ?? /\\sid=([^\\s>]+)/i.exec(attrs);\n let id = idMatch?.[2] ?? idMatch?.[1] ?? '';\n if (!id) {\n id = this.makeSlug(text, slugCounts);\n }\n\n toc.push({ id, level, text });\n }\n\n return toc;\n }\n\n private makeSlug(text: string, slugCounts: Map<string, number>): string {\n const baseSlug = text\n .toLowerCase()\n .replace(/[^\\w\\s-]/g, '')\n .trim()\n .replace(/\\s+/g, '-');\n const count = slugCounts.get(baseSlug) ?? 0;\n slugCounts.set(baseSlug, count + 1);\n return count === 0 ? baseSlug : `${baseSlug}-${count}`;\n }\n}\n","import { InjectionToken, inject, Provider } from '@angular/core';\n\nimport { ContentFile } from './content-file';\n\n/**\n * Token for the active content locale.\n * Provided via `withLocale()` in `provideContent()`.\n *\n * When set, `injectContentFiles()` filters to content matching this locale,\n * and `injectContent()` resolves locale-prefixed content paths first.\n */\nexport const CONTENT_LOCALE: InjectionToken<string> =\n new InjectionToken<string>('@analogjs/content Locale');\n\n/**\n * Injects the content locale, returning null if not configured.\n */\nexport function injectContentLocale(): string | null {\n return inject(CONTENT_LOCALE, { optional: true });\n}\n\nexport interface ContentLocaleOptions {\n /**\n * Function that returns the active locale.\n * Runs in injection context so `inject()` can be used to read\n * from other tokens (e.g., a LOCALE token from a router package).\n *\n * ```typescript\n * withLocale({ loadLocale: injectLocale })\n * withLocale({ loadLocale: () => navigator.language.split('-')[0] })\n * ```\n */\n loadLocale: () => string | null;\n}\n\n/**\n * Content feature that sets the active locale for content resolution.\n *\n * When provided, content APIs become locale-aware:\n * - `injectContentFiles()` filters to files in the locale subdirectory\n * or with a matching `locale` frontmatter attribute.\n * - `injectContent()` tries locale-prefixed paths first\n * (e.g., `content/fr/blog/post.md` before `content/blog/post.md`).\n *\n * Usage:\n * ```typescript\n * // With loader — runs in injection context\n * provideContent(\n * withMarkdownRenderer(),\n * withLocale({ loadLocale: injectLocale }),\n * )\n *\n * // Static locale\n * provideContent(\n * withMarkdownRenderer(),\n * withLocale('fr'),\n * )\n * ```\n */\nexport function withLocale(locale: string | ContentLocaleOptions): Provider {\n if (typeof locale === 'string') {\n return { provide: CONTENT_LOCALE, useValue: locale };\n }\n\n return { provide: CONTENT_LOCALE, useFactory: locale.loadLocale };\n}\n\n/**\n * Filters content files by locale using map-based key lookup.\n *\n * Matching rules:\n * 1. Frontmatter `locale` attribute matches the active locale.\n * 2. File is in the active locale subdirectory (e.g., `/content/fr/blog/post`).\n * 3. File has no locale marker and no localized variant exists — included as universal content.\n *\n * Files in a different locale's subdirectory are always excluded.\n */\nexport function filterByLocale<T extends Record<string, any>>(\n files: ContentFile<T>[],\n locale: string,\n): ContentFile<T>[] {\n const localePrefix = `/content/${locale}/`;\n\n // Collect all locale prefixes present in the file set\n const allLocalePrefixes = new Set<string>();\n for (const file of files) {\n const match = file.filename.match(/\\/content\\/([a-z]{2}(?:-[a-zA-Z]+)?)\\//);\n if (match) {\n allLocalePrefixes.add(`/content/${match[1]}/`);\n }\n }\n\n // Build set of base paths that have a localized variant for the active locale\n const localizedBasePaths = new Set<string>();\n for (const file of files) {\n if (file.filename.includes(localePrefix)) {\n localizedBasePaths.add(file.filename.replace(localePrefix, '/content/'));\n }\n }\n\n return files.filter((file) => {\n // Frontmatter locale attribute takes priority\n if (file.attributes['locale']) {\n return file.attributes['locale'] === locale;\n }\n // File is in the active locale subdirectory — include\n if (file.filename.includes(localePrefix)) {\n return true;\n }\n // File is in a different locale's subdirectory — exclude\n for (const prefix of allLocalePrefixes) {\n if (prefix !== localePrefix && file.filename.includes(prefix)) {\n return false;\n }\n }\n // Universal content — include only if no localized variant exists\n return !localizedBasePaths.has(file.filename);\n });\n}\n\n/**\n * Prepends locale-prefixed candidates before the standard candidates\n * for content file map key lookup.\n */\nexport function withLocaleCandidates(\n candidates: string[],\n locale: string | null | undefined,\n): string[] {\n if (!locale) {\n return candidates;\n }\n const localeCandidates = candidates.map((c) =>\n c.replace('/src/content/', `/src/content/${locale}/`),\n );\n return [...localeCandidates, ...candidates];\n}\n","import type { ContentFileLoader } from './parse-content-file';\n\n/**\n * These bindings are rewritten at build time:\n * - `ANALOG_CONTENT_FILE_LIST` by `@analogjs/platform`'s content plugin,\n * which substitutes the empty-object initializer with the frontmatter\n * map for discovered content files.\n * - `ANALOG_CONTENT_ROUTE_FILES` by `@analogjs/platform`'s router plugin,\n * which substitutes the empty-object initializer with the lazy-import\n * map for discovered content files. The router plugin already rewrites\n * a same-named binding exported from `@analogjs/router/content`; it\n * matches this module for free because its filter keys off `_ROUTE_FILES`.\n *\n * They are declared as `export const` at module scope so the bundler treats\n * them as public module bindings and cannot constant-fold them away during\n * library build. Previously these lived as local consts inside each getter,\n * and Rolldown collapsed `const X = {}; return X;` into `return {};`, which\n * erased the rewrite target the platform plugins rely on.\n */\n\nexport const ANALOG_CONTENT_FILE_LIST = {};\nexport const ANALOG_CONTENT_ROUTE_FILES = {};\n\n/**\n * Returns the list of content files by filename with ?analog-content-list=true.\n * We use the query param to transform the return into an array of\n * just front matter attributes.\n */\nexport const getContentFilesList = () =>\n ANALOG_CONTENT_FILE_LIST as Record<string, Record<string, any>>;\n\n/**\n * Returns the lazy loaded content files for lookups.\n */\nexport const getContentFiles = () =>\n ANALOG_CONTENT_ROUTE_FILES as Record<string, ContentFileLoader>;\n","import { InjectionToken } from '@angular/core';\nimport { ContentFile } from './content-file';\nimport { getContentFilesList } from './get-content-files';\n\nfunction getSlug(filename: string) {\n // Extract the last path segment without its extension.\n // Handles names with dots like [[...slug]].md by stripping only the final extension.\n const lastSegment = (filename.split(/[/\\\\]/).pop() || '').trim();\n const base = lastSegment.replace(/\\.[^./\\\\]+$/, ''); // strip only the final extension\n // Treat index.md as index route => empty slug\n return base === 'index' ? '' : base;\n}\n\nexport const CONTENT_FILES_LIST_TOKEN: InjectionToken<ContentFile[]> =\n new InjectionToken<ContentFile[]>('@analogjs/content Content Files List', {\n providedIn: 'root',\n factory() {\n const contentFiles = getContentFilesList();\n\n return Object.keys(contentFiles).map((filename) => {\n const attributes = contentFiles[filename];\n const slug = attributes['slug'];\n\n return {\n filename,\n attributes,\n slug: slug ? encodeURI(slug) : encodeURI(getSlug(filename)),\n };\n });\n },\n });\n","import { InjectionToken, Signal, inject, signal } from '@angular/core';\n\nimport { getContentFiles } from './get-content-files';\nimport { CONTENT_FILES_LIST_TOKEN } from './content-files-list-token';\nimport type { ContentFileLoader } from './parse-content-file';\n\nexport const CONTENT_FILES_TOKEN: InjectionToken<\n Record<string, ContentFileLoader>\n> = new InjectionToken<Record<string, ContentFileLoader>>(\n '@analogjs/content Content Files',\n {\n providedIn: 'root',\n factory() {\n const contentFiles = getContentFiles();\n const allFiles = { ...contentFiles };\n const contentFilesList = inject(CONTENT_FILES_LIST_TOKEN);\n\n const lookup: Record<string, string> = {};\n contentFilesList.forEach((item) => {\n const contentFilename = item.filename.replace(\n /(.*?)\\/content/,\n '/src/content',\n );\n const fileParts = contentFilename.split('/');\n const filePath = fileParts.slice(0, fileParts.length - 1).join('/');\n const fileNameParts = fileParts[fileParts.length - 1].split('.');\n const ext = fileNameParts[fileNameParts.length - 1];\n let slug = (item.slug ?? '') as string;\n // Default empty slug to 'index'\n if (slug === '') {\n slug = 'index';\n }\n // Slugs with path separators are scoped to the file's top-level\n // subdirectory (e.g. `/src/content/docs`) rather than absolute root,\n // so nested files keep resolving through `subdirectory` lookups.\n // Files directly under `/src/content` keep the original root-relative\n // behavior since they have no subdirectory of their own.\n const subdirRoot =\n fileParts.length > 4\n ? fileParts.slice(0, 4).join('/')\n : '/src/content';\n const newBase = slug.includes('/')\n ? `${subdirRoot}/${slug}`\n : `${filePath}/${slug}`;\n lookup[contentFilename] = `${newBase}.${ext}`.replace(/\\/{2,}/g, '/');\n });\n\n const objectUsingSlugAttribute: Record<string, ContentFileLoader> = {};\n Object.entries(allFiles).forEach((entry) => {\n const filename = entry[0];\n const value = entry[1];\n const strippedFilename = filename.replace(\n /^\\/(.*?)\\/content/,\n '/src/content',\n );\n\n const newFilename = lookup[strippedFilename];\n if (newFilename !== undefined) {\n const objectFilename = newFilename.replace(\n /^\\/(.*?)\\/content/,\n '/src/content',\n );\n objectUsingSlugAttribute[objectFilename] = value as ContentFileLoader;\n }\n });\n\n return objectUsingSlugAttribute;\n },\n },\n);\n\nexport const CONTENT_FILES_MAP_TOKEN: InjectionToken<\n Signal<Record<string, ContentFileLoader>>\n> = new InjectionToken<Signal<Record<string, ContentFileLoader>>>(\n '@analogjs/content Content Files',\n {\n providedIn: 'root',\n factory() {\n return signal(inject(CONTENT_FILES_TOKEN));\n },\n },\n);\n","import { Injectable, inject } from '@angular/core';\nimport { ɵPendingTasksInternal as ɵPendingTasks } from '@angular/core';\n\n@Injectable()\nexport class RenderTaskService {\n #pendingTasks = inject(ɵPendingTasks);\n\n addRenderTask(): number {\n return this.#pendingTasks.add();\n }\n\n clearRenderTask(clear: number | (() => void)): void {\n if (typeof clear === 'function') {\n clear();\n } else if (typeof (this.#pendingTasks as any).remove === 'function') {\n (this.#pendingTasks as any).remove(clear);\n }\n }\n}\n","import { inject } from '@angular/core';\n\nimport { ContentFile } from './content-file';\nimport { CONTENT_FILES_LIST_TOKEN } from './content-files-list-token';\nimport { CONTENT_FILES_TOKEN } from './content-files-token';\nimport type { ContentFileLoader } from './parse-content-file';\nimport { CONTENT_LOCALE, filterByLocale } from './content-locale';\nimport { RenderTaskService } from './render-task.service';\n\nexport function injectContentFiles<Attributes extends Record<string, any>>(\n filterFn?: InjectContentFilesFilterFunction<Attributes>,\n): ContentFile<Attributes>[] {\n const renderTaskService = inject(RenderTaskService);\n const task = renderTaskService.addRenderTask();\n const allContentFiles = inject(\n CONTENT_FILES_LIST_TOKEN,\n ) as ContentFile<Attributes>[];\n const locale = inject(CONTENT_LOCALE, { optional: true });\n renderTaskService.clearRenderTask(task);\n\n let results = allContentFiles;\n\n if (locale) {\n results = filterByLocale(results, locale);\n }\n\n if (filterFn) {\n results = results.filter(filterFn);\n }\n\n return results;\n}\n\nexport type InjectContentFilesFilterFunction<T extends Record<string, any>> = (\n value: ContentFile<T>,\n index: number,\n array: ContentFile<T>[],\n) => boolean;\n\nexport function injectContentFilesMap(): Record<string, ContentFileLoader> {\n return inject(CONTENT_FILES_TOKEN);\n}\n","import { InjectionToken, Provider } from '@angular/core';\nimport { inject } from '@angular/core';\n\nimport { injectContentFilesMap } from './inject-content-files';\nimport type { ContentFileLoader } from './parse-content-file';\n\ntype ContentFileLoaderFunction = () => Promise<\n Record<string, ContentFileLoader>\n>;\n\nexport const CONTENT_FILE_LOADER: InjectionToken<ContentFileLoaderFunction> =\n new InjectionToken<ContentFileLoaderFunction>(\n '@analogjs/content/resource File Loader',\n );\n\nexport function injectContentFileLoader() {\n return inject(CONTENT_FILE_LOADER) as ContentFileLoaderFunction;\n}\n\nexport function withContentFileLoader(): Provider {\n return {\n provide: CONTENT_FILE_LOADER,\n useFactory() {\n return async () => injectContentFilesMap();\n },\n };\n}\n","import { InjectionToken, Provider } from '@angular/core';\nimport { inject } from '@angular/core';\n\nimport { ContentFile } from './content-file';\nimport { injectContentFiles } from './inject-content-files';\n\ntype ContentListLoaderFunction<Attributes extends Record<string, any>> =\n () => Promise<ContentFile<Attributes>[]>;\n\nexport const CONTENT_LIST_LOADER: InjectionToken<\n ContentListLoaderFunction<any>\n> = new InjectionToken<ContentListLoaderFunction<any>>(\n '@analogjs/content/resource List Loader',\n);\n\nexport function injectContentListLoader<\n Attributes extends Record<string, any>,\n>() {\n return inject(CONTENT_LIST_LOADER) as ContentListLoaderFunction<Attributes>;\n}\n\nexport function withContentListLoader(): Provider {\n return {\n provide: CONTENT_LIST_LOADER,\n useFactory() {\n return async () => injectContentFiles();\n },\n };\n}\n"],"mappings":";;;AAgBA,IAAsB,kBAAtB,MAAsB,gBAAe;CACnC,MAAM,OAAO,SAAe;EAC1B,OAAO;GAAE;GAAS,KAAK,CAAA;EAAE;CAC3B;CAGA,UAAO,CAAU;CANG;EAAA,KAAA,OAAA,GAAA,mBAAA;GAAA,Y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,MAAM,OAAO,kBAAkB,cAAa;CAC5C,MAAM,kBAAkB,OACtB,wBAAwB;CAE1B,MAAM,SAAS,OAAO,gBAAgB,EAAE,UAAU,KAAI,CAAE;CACxD,kBAAkB,gBAAgB,IAAI;CAEtC,IAAI,UAAU;CAEd,IAAI,QACF,UAAU,eAAe,SAAS,MAAM;CAG1C,IAAI,UACF,UAAU,QAAQ,OAAO,QAAQ;CAGnC,OAAO;AACT;AAQA,SAAgB,wBAAqB;CACnC,OAAO,OAAO,mBAAmB;AACnC;;;AC/BA,IAAa,sBACX,IAAI,eACF,wCAAwC;AAG5C,SAAgB,0BAAuB;CACrC,OAAO,OAAO,mBAAmB;AACnC;AAEA,SAAgB,wBAAqB;CACnC,OAAO;EACL,SAAS;EACT,aAAU;GACR,OAAO,YAAY,sBAAqB;EAC1C;CACD;AACH;;;ACjBA,IAAa,sBAET,IAAI,eACN,wCAAwC;AAG1C,SAAgB,0BAAuB;CAGrC,OAAO,OAAO,mBAAmB;AACnC;AAEA,SAAgB,wBAAqB;CACnC,OAAO;EACL,SAAS;EACT,aAAU;GACR,OAAO,YAAY,mBAAkB;EACvC;CACD;AACH"}
|
|
1
|
+
{"version":3,"file":"content-list-loader.mjs","names":[],"sources":["../../src/lib/content-renderer.ts","../../src/lib/content-locale.ts","../../src/lib/get-content-files.ts","../../src/lib/content-files-list-token.ts","../../src/lib/content-files-token.ts","../../src/lib/render-task.service.ts","../../src/lib/inject-content-files.ts","../../src/lib/content-file-loader.ts","../../src/lib/content-list-loader.ts"],"sourcesContent":["/// <reference types=\"vite/client\" />\n\nimport { Injectable, TransferState, inject, makeStateKey } from '@angular/core';\n\nexport type TableOfContentItem = {\n id: string;\n level: number; // starts at 1\n text: string;\n};\n\nexport type RenderedContent = {\n content: string;\n toc: TableOfContentItem[];\n};\n\n@Injectable()\nexport abstract class ContentRenderer {\n async render(content: string): Promise<RenderedContent> {\n return { content, toc: [] };\n }\n\n // eslint-disable-next-line\n enhance(): void {}\n}\n\nexport class NoopContentRenderer implements ContentRenderer {\n private readonly transferState = inject(TransferState);\n private contentId = 0;\n\n /**\n * Generates a hash from the content string\n * to be used with the transfer state\n */\n private generateHash(str: string) {\n let hash = 0;\n for (let i = 0, len = str.length; i < len; i++) {\n const chr = str.charCodeAt(i);\n hash = (hash << 5) - hash + chr;\n hash |= 0; // Convert to 32bit integer\n }\n return hash;\n }\n\n async render(content: string): Promise<RenderedContent> {\n this.contentId = this.generateHash(content);\n const toc = this.extractHeadings(content);\n const key = makeStateKey<TableOfContentItem[]>(\n `content-headings-${this.contentId}`,\n );\n\n if (import.meta.env.SSR === true) {\n this.transferState.set(key, toc);\n return { content, toc };\n }\n\n return {\n content,\n toc: this.transferState.get(key, toc),\n };\n }\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n enhance(): void {}\n\n private extractHeadings(content: string): TableOfContentItem[] {\n const markdownHeadings = this.extractHeadingsFromMarkdown(content);\n if (markdownHeadings.length > 0) {\n return markdownHeadings;\n }\n\n const htmlHeadings = this.extractHeadingsFromHtml(content);\n return htmlHeadings;\n }\n\n private extractHeadingsFromMarkdown(content: string): TableOfContentItem[] {\n const lines = content.split('\\n');\n const toc: TableOfContentItem[] = [];\n const slugCounts = new Map<string, number>();\n\n for (const line of lines) {\n const match = /^(#{1,6})\\s+(.+?)\\s*$/.exec(line);\n if (!match) {\n continue;\n }\n\n const level = match[1].length;\n const text = match[2].trim();\n if (!text) {\n continue;\n }\n\n const baseSlug = text\n .toLowerCase()\n .replace(/[^\\w\\s-]/g, '')\n .trim()\n .replace(/\\s+/g, '-');\n const count = slugCounts.get(baseSlug) ?? 0;\n slugCounts.set(baseSlug, count + 1);\n const id = count === 0 ? baseSlug : `${baseSlug}-${count}`;\n\n toc.push({ id, level, text });\n }\n\n return toc;\n }\n\n private extractHeadingsFromHtml(content: string): TableOfContentItem[] {\n const toc: TableOfContentItem[] = [];\n const slugCounts = new Map<string, number>();\n const headingRegex = /<h([1-6])([^>]*)>([\\s\\S]*?)<\\/h\\1>/gi;\n\n for (const match of content.matchAll(headingRegex)) {\n const level = Number(match[1]);\n const attrs = match[2] ?? '';\n const rawInner = match[3] ?? '';\n const text = rawInner.replace(/<[^>]+>/g, '').trim();\n if (!text) {\n continue;\n }\n\n const idMatch =\n /\\sid=(['\"])(.*?)\\1/i.exec(attrs) ?? /\\sid=([^\\s>]+)/i.exec(attrs);\n let id = idMatch?.[2] ?? idMatch?.[1] ?? '';\n if (!id) {\n id = this.makeSlug(text, slugCounts);\n }\n\n toc.push({ id, level, text });\n }\n\n return toc;\n }\n\n private makeSlug(text: string, slugCounts: Map<string, number>): string {\n const baseSlug = text\n .toLowerCase()\n .replace(/[^\\w\\s-]/g, '')\n .trim()\n .replace(/\\s+/g, '-');\n const count = slugCounts.get(baseSlug) ?? 0;\n slugCounts.set(baseSlug, count + 1);\n return count === 0 ? baseSlug : `${baseSlug}-${count}`;\n }\n}\n","import { InjectionToken, inject, Provider } from '@angular/core';\n\nimport { ContentFile } from './content-file';\n\n/**\n * Token for the active content locale.\n * Provided via `withLocale()` in `provideContent()`.\n *\n * When set, `injectContentFiles()` filters to content matching this locale,\n * and `injectContent()` resolves locale-prefixed content paths first.\n */\nexport const CONTENT_LOCALE: InjectionToken<string> =\n new InjectionToken<string>('@analogjs/content Locale');\n\n/**\n * Injects the content locale, returning null if not configured.\n */\nexport function injectContentLocale(): string | null {\n return inject(CONTENT_LOCALE, { optional: true });\n}\n\nexport interface ContentLocaleOptions {\n /**\n * Function that returns the active locale.\n * Runs in injection context so `inject()` can be used to read\n * from other tokens (e.g., a LOCALE token from a router package).\n *\n * ```typescript\n * withLocale({ loadLocale: injectLocale })\n * withLocale({ loadLocale: () => navigator.language.split('-')[0] })\n * ```\n */\n loadLocale: () => string | null;\n}\n\n/**\n * Content feature that sets the active locale for content resolution.\n *\n * When provided, content APIs become locale-aware:\n * - `injectContentFiles()` filters to files in the locale subdirectory\n * or with a matching `locale` frontmatter attribute.\n * - `injectContent()` tries locale-prefixed paths first\n * (e.g., `content/fr/blog/post.md` before `content/blog/post.md`).\n *\n * Usage:\n * ```typescript\n * // With loader — runs in injection context\n * provideContent(\n * withMarkdownRenderer(),\n * withLocale({ loadLocale: injectLocale }),\n * )\n *\n * // Static locale\n * provideContent(\n * withMarkdownRenderer(),\n * withLocale('fr'),\n * )\n * ```\n */\nexport function withLocale(locale: string | ContentLocaleOptions): Provider {\n if (typeof locale === 'string') {\n return { provide: CONTENT_LOCALE, useValue: locale };\n }\n\n return { provide: CONTENT_LOCALE, useFactory: locale.loadLocale };\n}\n\n/**\n * Filters content files by locale using map-based key lookup.\n *\n * Matching rules:\n * 1. Frontmatter `locale` attribute matches the active locale.\n * 2. File is in the active locale subdirectory (e.g., `/content/fr/blog/post`).\n * 3. File has no locale marker and no localized variant exists — included as universal content.\n *\n * Files in a different locale's subdirectory are always excluded.\n */\nexport function filterByLocale<T extends Record<string, any>>(\n files: ContentFile<T>[],\n locale: string,\n): ContentFile<T>[] {\n const localePrefix = `/content/${locale}/`;\n\n // Collect all locale prefixes present in the file set\n const allLocalePrefixes = new Set<string>();\n for (const file of files) {\n const match = file.filename.match(/\\/content\\/([a-z]{2}(?:-[a-zA-Z]+)?)\\//);\n if (match) {\n allLocalePrefixes.add(`/content/${match[1]}/`);\n }\n }\n\n // Build set of base paths that have a localized variant for the active locale\n const localizedBasePaths = new Set<string>();\n for (const file of files) {\n if (file.filename.includes(localePrefix)) {\n localizedBasePaths.add(file.filename.replace(localePrefix, '/content/'));\n }\n }\n\n return files.filter((file) => {\n // Frontmatter locale attribute takes priority\n if (file.attributes['locale']) {\n return file.attributes['locale'] === locale;\n }\n // File is in the active locale subdirectory — include\n if (file.filename.includes(localePrefix)) {\n return true;\n }\n // File is in a different locale's subdirectory — exclude\n for (const prefix of allLocalePrefixes) {\n if (prefix !== localePrefix && file.filename.includes(prefix)) {\n return false;\n }\n }\n // Universal content — include only if no localized variant exists\n return !localizedBasePaths.has(file.filename);\n });\n}\n\n/**\n * Prepends locale-prefixed candidates before the standard candidates\n * for content file map key lookup.\n */\nexport function withLocaleCandidates(\n candidates: string[],\n locale: string | null | undefined,\n): string[] {\n if (!locale) {\n return candidates;\n }\n const localeCandidates = candidates.map((c) =>\n c.replace('/src/content/', `/src/content/${locale}/`),\n );\n return [...localeCandidates, ...candidates];\n}\n","import type { ContentFileLoader } from './parse-content-file';\n\n/**\n * These bindings are rewritten at build time:\n * - `ANALOG_CONTENT_FILE_LIST` by `@analogjs/platform`'s content plugin,\n * which substitutes the empty-object initializer with the frontmatter\n * map for discovered content files.\n * - `ANALOG_CONTENT_ROUTE_FILES` by `@analogjs/platform`'s router plugin,\n * which substitutes the empty-object initializer with the lazy-import\n * map for discovered content files. The router plugin already rewrites\n * a same-named binding exported from `@analogjs/router/content`; it\n * matches this module for free because its filter keys off `_ROUTE_FILES`.\n *\n * They are declared as `export const` at module scope so the bundler treats\n * them as public module bindings and cannot constant-fold them away during\n * library build. Previously these lived as local consts inside each getter,\n * and Rolldown collapsed `const X = {}; return X;` into `return {};`, which\n * erased the rewrite target the platform plugins rely on.\n */\n\nexport const ANALOG_CONTENT_FILE_LIST = {};\nexport const ANALOG_CONTENT_ROUTE_FILES = {};\n\n/**\n * Returns the list of content files by filename with ?analog-content-list=true.\n * We use the query param to transform the return into an array of\n * just front matter attributes.\n */\nexport const getContentFilesList = () =>\n ANALOG_CONTENT_FILE_LIST as Record<string, Record<string, any>>;\n\n/**\n * Returns the lazy loaded content files for lookups.\n */\nexport const getContentFiles = () =>\n ANALOG_CONTENT_ROUTE_FILES as Record<string, ContentFileLoader>;\n","import { InjectionToken } from '@angular/core';\nimport { ContentFile } from './content-file';\nimport { getContentFilesList } from './get-content-files';\n\nfunction getSlug(filename: string) {\n // Extract the last path segment without its extension.\n // Handles names with dots like [[...slug]].md by stripping only the final extension.\n const lastSegment = (filename.split(/[/\\\\]/).pop() || '').trim();\n const base = lastSegment.replace(/\\.[^./\\\\]+$/, ''); // strip only the final extension\n // Treat index.md as index route => empty slug\n return base === 'index' ? '' : base;\n}\n\nexport const CONTENT_FILES_LIST_TOKEN: InjectionToken<ContentFile[]> =\n new InjectionToken<ContentFile[]>('@analogjs/content Content Files List', {\n providedIn: 'root',\n factory() {\n const contentFiles = getContentFilesList();\n\n return Object.keys(contentFiles).map((filename) => {\n const attributes = contentFiles[filename];\n const slug = attributes['slug'];\n\n return {\n filename,\n attributes,\n slug: slug ? encodeURI(slug) : encodeURI(getSlug(filename)),\n };\n });\n },\n });\n","import { InjectionToken, Signal, inject, signal } from '@angular/core';\n\nimport { getContentFiles } from './get-content-files';\nimport { CONTENT_FILES_LIST_TOKEN } from './content-files-list-token';\nimport type { ContentFileLoader } from './parse-content-file';\n\nexport const CONTENT_FILES_TOKEN: InjectionToken<\n Record<string, ContentFileLoader>\n> = new InjectionToken<Record<string, ContentFileLoader>>(\n '@analogjs/content Content Files',\n {\n providedIn: 'root',\n factory() {\n const contentFiles = getContentFiles();\n const allFiles = { ...contentFiles };\n const contentFilesList = inject(CONTENT_FILES_LIST_TOKEN);\n\n const lookup: Record<string, string> = {};\n contentFilesList.forEach((item) => {\n const contentFilename = item.filename.replace(\n /(.*?)\\/content/,\n '/src/content',\n );\n const fileParts = contentFilename.split('/');\n const filePath = fileParts.slice(0, fileParts.length - 1).join('/');\n const fileNameParts = fileParts[fileParts.length - 1].split('.');\n const ext = fileNameParts[fileNameParts.length - 1];\n let slug = (item.slug ?? '') as string;\n // Default empty slug to 'index'\n if (slug === '') {\n slug = 'index';\n }\n // Slugs with path separators are scoped to the file's top-level\n // subdirectory (e.g. `/src/content/docs`) rather than absolute root,\n // so nested files keep resolving through `subdirectory` lookups.\n // Files directly under `/src/content` keep the original root-relative\n // behavior since they have no subdirectory of their own.\n const subdirRoot =\n fileParts.length > 4\n ? fileParts.slice(0, 4).join('/')\n : '/src/content';\n const newBase = slug.includes('/')\n ? `${subdirRoot}/${slug}`\n : `${filePath}/${slug}`;\n lookup[contentFilename] = `${newBase}.${ext}`.replace(/\\/{2,}/g, '/');\n });\n\n const objectUsingSlugAttribute: Record<string, ContentFileLoader> = {};\n Object.entries(allFiles).forEach((entry) => {\n const filename = entry[0];\n const value = entry[1];\n const strippedFilename = filename.replace(\n /^\\/(.*?)\\/content/,\n '/src/content',\n );\n\n const newFilename = lookup[strippedFilename];\n if (newFilename !== undefined) {\n const objectFilename = newFilename.replace(\n /^\\/(.*?)\\/content/,\n '/src/content',\n );\n objectUsingSlugAttribute[objectFilename] = value as ContentFileLoader;\n }\n });\n\n return objectUsingSlugAttribute;\n },\n },\n);\n\nexport const CONTENT_FILES_MAP_TOKEN: InjectionToken<\n Signal<Record<string, ContentFileLoader>>\n> = new InjectionToken<Signal<Record<string, ContentFileLoader>>>(\n '@analogjs/content Content Files',\n {\n providedIn: 'root',\n factory() {\n return signal(inject(CONTENT_FILES_TOKEN));\n },\n },\n);\n","import { Injectable, PendingTasks, inject } from '@angular/core';\n\n@Injectable()\nexport class RenderTaskService {\n #pendingTasks = inject(PendingTasks);\n\n addRenderTask(): () => void {\n return this.#pendingTasks.add();\n }\n\n clearRenderTask(clear: () => void): void {\n clear();\n }\n}\n","import { inject } from '@angular/core';\n\nimport { ContentFile } from './content-file';\nimport { CONTENT_FILES_LIST_TOKEN } from './content-files-list-token';\nimport { CONTENT_FILES_TOKEN } from './content-files-token';\nimport type { ContentFileLoader } from './parse-content-file';\nimport { CONTENT_LOCALE, filterByLocale } from './content-locale';\nimport { RenderTaskService } from './render-task.service';\n\nexport function injectContentFiles<Attributes extends Record<string, any>>(\n filterFn?: InjectContentFilesFilterFunction<Attributes>,\n): ContentFile<Attributes>[] {\n const renderTaskService = inject(RenderTaskService);\n const task = renderTaskService.addRenderTask();\n const allContentFiles = inject(\n CONTENT_FILES_LIST_TOKEN,\n ) as ContentFile<Attributes>[];\n const locale = inject(CONTENT_LOCALE, { optional: true });\n renderTaskService.clearRenderTask(task);\n\n let results = allContentFiles;\n\n if (locale) {\n results = filterByLocale(results, locale);\n }\n\n if (filterFn) {\n results = results.filter(filterFn);\n }\n\n return results;\n}\n\nexport type InjectContentFilesFilterFunction<T extends Record<string, any>> = (\n value: ContentFile<T>,\n index: number,\n array: ContentFile<T>[],\n) => boolean;\n\nexport function injectContentFilesMap(): Record<string, ContentFileLoader> {\n return inject(CONTENT_FILES_TOKEN);\n}\n","import { InjectionToken, Provider } from '@angular/core';\nimport { inject } from '@angular/core';\n\nimport { injectContentFilesMap } from './inject-content-files';\nimport type { ContentFileLoader } from './parse-content-file';\n\ntype ContentFileLoaderFunction = () => Promise<\n Record<string, ContentFileLoader>\n>;\n\nexport const CONTENT_FILE_LOADER: InjectionToken<ContentFileLoaderFunction> =\n new InjectionToken<ContentFileLoaderFunction>(\n '@analogjs/content/resource File Loader',\n );\n\nexport function injectContentFileLoader() {\n return inject(CONTENT_FILE_LOADER) as ContentFileLoaderFunction;\n}\n\nexport function withContentFileLoader(): Provider {\n return {\n provide: CONTENT_FILE_LOADER,\n useFactory() {\n const files = injectContentFilesMap();\n return async () => files;\n },\n };\n}\n","import { InjectionToken, Provider } from '@angular/core';\nimport { inject } from '@angular/core';\n\nimport { ContentFile } from './content-file';\nimport { injectContentFiles } from './inject-content-files';\n\ntype ContentListLoaderFunction<Attributes extends Record<string, any>> =\n () => Promise<ContentFile<Attributes>[]>;\n\nexport const CONTENT_LIST_LOADER: InjectionToken<\n ContentListLoaderFunction<any>\n> = new InjectionToken<ContentListLoaderFunction<any>>(\n '@analogjs/content/resource List Loader',\n);\n\nexport function injectContentListLoader<\n Attributes extends Record<string, any>,\n>() {\n return inject(CONTENT_LIST_LOADER) as ContentListLoaderFunction<Attributes>;\n}\n\nexport function withContentListLoader(): Provider {\n return {\n provide: CONTENT_LIST_LOADER,\n useFactory() {\n const files = injectContentFiles();\n return async () => files;\n },\n };\n}\n"],"mappings":";;;AAgBA,IAAsB,kBAAtB,MAAsB,gBAAe;CACnC,MAAM,OAAO,SAAe;EAC1B,OAAO;GAAE;GAAS,KAAK,CAAA;EAAE;CAC3B;CAGA,UAAO,CAA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AAS,OAAO,gBAAgB,EAAE,UAAU,KAAI,CAAE;CACxD,kBAAkB,gBAAgB,IAAI;CAEtC,IAAI,UAAU;CAEd,IAAI,QACF,UAAU,eAAe,SAAS,MAAM;CAG1C,IAAI,UACF,UAAU,QAAQ,OAAO,QAAQ;CAGnC,OAAO;AACT;AAQA,SAAgB,wBAAqB;CACnC,OAAO,OAAO,mBAAmB;AACnC;;AC/BA,IAAa,sBACX,IAAI,eACF,wCAAwC;AAG5C,SAAgB,0BAAuB;CACrC,OAAO,OAAO,mBAAmB;AACnC;AAEA,SAAgB,wBAAqB;CACnC,OAAO;EACL,SAAS;EACT,aAAU;GACR,MAAM,QAAQ,sBAAqB;GACnC,OAAO,YAAY;EACrB;CACD;AACH;;AClBA,IAAa,sBAET,IAAI,eACN,wCAAwC;AAG1C,SAAgB,0BAAuB;CAGrC,OAAO,OAAO,mBAAmB;AACnC;AAEA,SAAgB,wBAAqB;CACnC,OAAO;EACL,SAAS;EACT,aAAU;GACR,MAAM,QAAQ,mBAAkB;GAChC,OAAO,YAAY;EACrB;CACD;AACH"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/content/src/lib/frontmatter-validation-error.ts
|
|
2
2
|
var FrontmatterValidationError = class extends Error {
|
|
3
3
|
constructor(issues, filename) {
|
|
4
4
|
const issueMessages = issues.map((i) => {
|
|
@@ -12,7 +12,6 @@ var FrontmatterValidationError = class extends Error {
|
|
|
12
12
|
this.name = "FrontmatterValidationError";
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
|
-
//#endregion
|
|
16
15
|
export { FrontmatterValidationError as t };
|
|
17
16
|
|
|
18
17
|
//# sourceMappingURL=frontmatter-validation-error.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as FrontmatterValidationError } from "./frontmatter-validation-error.mjs";
|
|
2
2
|
import fm from "front-matter";
|
|
3
|
-
|
|
3
|
+
// \0rolldown/runtime.js
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __exportAll = (all, no_symbols) => {
|
|
6
6
|
let target = {};
|
|
@@ -11,10 +11,8 @@ var __exportAll = (all, no_symbols) => {
|
|
|
11
11
|
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
12
12
|
return target;
|
|
13
13
|
};
|
|
14
|
-
|
|
15
|
-
//#region packages/content/src/lib/parse-raw-content-file.ts
|
|
14
|
+
// packages/content/src/lib/parse-raw-content-file.ts
|
|
16
15
|
var parse_raw_content_file_exports = /* @__PURE__ */ __exportAll({
|
|
17
|
-
FrontmatterValidationError: () => FrontmatterValidationError,
|
|
18
16
|
parseRawContentFile: () => parseRawContentFile,
|
|
19
17
|
parseRawContentFileAsync: () => parseRawContentFileAsync
|
|
20
18
|
});
|
|
@@ -44,7 +42,6 @@ async function parseRawContentFileAsync(rawContentFile, schema, filename) {
|
|
|
44
42
|
attributes: result.value
|
|
45
43
|
};
|
|
46
44
|
}
|
|
47
|
-
//#endregion
|
|
48
45
|
export { parseRawContentFileAsync as n, parse_raw_content_file_exports as r, parseRawContentFile as t };
|
|
49
46
|
|
|
50
47
|
//# sourceMappingURL=parse-raw-content-file.mjs.map
|