@analogjs/content 3.0.0-alpha.1 → 3.0.0-alpha.11

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.
Files changed (103) hide show
  1. package/LICENSE +21 -0
  2. package/fesm2022/__vite-browser-external.mjs +9 -0
  3. package/fesm2022/analogjs-content-md4x.mjs +290 -0
  4. package/fesm2022/analogjs-content-mdc.mjs +170 -0
  5. package/fesm2022/analogjs-content-og.mjs +34 -46
  6. package/fesm2022/analogjs-content-prism-highlighter.mjs +81 -68
  7. package/fesm2022/analogjs-content-resources.mjs +115 -124
  8. package/fesm2022/analogjs-content-shiki-highlighter.mjs +9 -14
  9. package/fesm2022/analogjs-content.mjs +18538 -621
  10. package/fesm2022/api_vite.mjs +7 -0
  11. package/fesm2022/browser.mjs +6069 -0
  12. package/fesm2022/build2.mjs +5259 -0
  13. package/fesm2022/chunk.mjs +37 -0
  14. package/fesm2022/chunk2.mjs +41 -0
  15. package/fesm2022/jiti.mjs +4477 -0
  16. package/fesm2022/lib.mjs +365 -0
  17. package/fesm2022/main.mjs +2341 -0
  18. package/fesm2022/node.mjs +791 -0
  19. package/fesm2022/postcss-import.mjs +451 -0
  20. package/fesm2022/postcss.mjs +3236 -0
  21. package/fesm2022/prompt-BYQIwEjg.mjs +847 -0
  22. package/md4x/package.json +4 -0
  23. package/mdc/package.json +4 -0
  24. package/og/package.json +2 -2
  25. package/package.json +35 -9
  26. package/prism-highlighter/package.json +2 -2
  27. package/resources/package.json +2 -2
  28. package/shiki-highlighter/package.json +2 -2
  29. package/src/lib/devtools/content-devtools-client.ts +215 -0
  30. package/src/lib/devtools/content-devtools.styles.css +194 -0
  31. package/types/md4x/src/index.d.ts +5 -0
  32. package/types/md4x/src/lib/md4x-content-renderer.service.d.ts +33 -0
  33. package/types/md4x/src/lib/md4x-wasm-content-renderer.service.d.ts +16 -0
  34. package/types/md4x/src/lib/provide-md4x.d.ts +26 -0
  35. package/types/md4x/src/lib/streaming-markdown-renderer.d.ts +21 -0
  36. package/types/mdc/src/index.d.ts +2 -0
  37. package/types/mdc/src/lib/mdc-component-registry.d.ts +25 -0
  38. package/types/mdc/src/lib/mdc-renderer.directive.d.ts +33 -0
  39. package/types/og/src/index.d.ts +2 -0
  40. package/types/og/src/lib/og.d.ts +5 -0
  41. package/types/og/src/lib/options.d.ts +11 -0
  42. package/types/prism-highlighter/src/index.d.ts +8 -0
  43. package/types/prism-highlighter/src/lib/prism/angular.d.ts +1 -0
  44. package/types/prism-highlighter/src/lib/prism-highlighter.d.ts +8 -0
  45. package/types/resources/src/content-file-resource.d.ts +37 -0
  46. package/types/resources/src/content-files-resource.d.ts +3 -0
  47. package/types/resources/src/index.d.ts +2 -0
  48. package/types/shiki-highlighter/src/index.d.ts +7 -0
  49. package/types/src/index.d.ts +18 -0
  50. package/types/src/lib/anchor-navigation.directive.d.ts +9 -0
  51. package/types/src/lib/content-file-loader.d.ts +6 -0
  52. package/types/src/lib/content-file.d.ts +8 -0
  53. package/types/src/lib/content-files-list-token.d.ts +3 -0
  54. package/types/src/lib/content-files-token.d.ts +3 -0
  55. package/types/src/lib/content-list-loader.d.ts +7 -0
  56. package/types/src/lib/content-renderer.d.ts +33 -0
  57. package/types/src/lib/content.d.ts +14 -0
  58. package/types/src/lib/devtools/content-devtools-plugin.d.ts +23 -0
  59. package/types/src/lib/devtools/content-devtools-renderer.d.ts +23 -0
  60. package/types/src/lib/devtools/index.d.ts +23 -0
  61. package/types/src/lib/get-content-files.d.ts +14 -0
  62. package/types/src/lib/inject-content-files.d.ts +4 -0
  63. package/types/src/lib/markdown-content-renderer.service.d.ts +10 -0
  64. package/types/src/lib/markdown-route.component.d.ts +15 -0
  65. package/types/src/lib/markdown.component.d.ts +26 -0
  66. package/types/src/lib/marked-content-highlighter.d.ts +17 -0
  67. package/types/src/lib/marked-setup.service.d.ts +10 -0
  68. package/types/src/lib/parse-raw-content-file.d.ts +18 -0
  69. package/types/src/lib/provide-content.d.ts +7 -0
  70. package/types/src/lib/render-task.service.d.ts +8 -0
  71. package/types/src/lib/utils/zone-wait-for.d.ts +2 -0
  72. package/fesm2022/analogjs-content-og.mjs.map +0 -1
  73. package/fesm2022/analogjs-content-prism-highlighter.mjs.map +0 -1
  74. package/fesm2022/analogjs-content-resources.mjs.map +0 -1
  75. package/fesm2022/analogjs-content-shiki-highlighter.mjs.map +0 -1
  76. package/fesm2022/analogjs-content.mjs.map +0 -1
  77. package/og/README.md +0 -3
  78. package/plugin/README.md +0 -11
  79. package/plugin/migrations.json +0 -75
  80. package/plugin/package.json +0 -23
  81. package/plugin/src/index.d.ts +0 -2
  82. package/plugin/src/index.js +0 -4
  83. package/plugin/src/index.js.map +0 -1
  84. package/plugin/src/migrations/update-markdown-renderer-feature/compat.d.ts +0 -2
  85. package/plugin/src/migrations/update-markdown-renderer-feature/compat.js +0 -6
  86. package/plugin/src/migrations/update-markdown-renderer-feature/compat.js.map +0 -1
  87. package/plugin/src/migrations/update-markdown-renderer-feature/update-markdown-renderer-feature.d.ts +0 -2
  88. package/plugin/src/migrations/update-markdown-renderer-feature/update-markdown-renderer-feature.js +0 -48
  89. package/plugin/src/migrations/update-markdown-renderer-feature/update-markdown-renderer-feature.js.map +0 -1
  90. package/plugin/src/migrations/update-markdown-version/compat.d.ts +0 -2
  91. package/plugin/src/migrations/update-markdown-version/compat.js +0 -6
  92. package/plugin/src/migrations/update-markdown-version/compat.js.map +0 -1
  93. package/plugin/src/migrations/update-markdown-version/update-markdown-version.d.ts +0 -2
  94. package/plugin/src/migrations/update-markdown-version/update-markdown-version.js +0 -23
  95. package/plugin/src/migrations/update-markdown-version/update-markdown-version.js.map +0 -1
  96. package/prism-highlighter/README.md +0 -3
  97. package/resources/README.md +0 -3
  98. package/shiki-highlighter/README.md +0 -3
  99. package/types/analogjs-content-og.d.ts +0 -19
  100. package/types/analogjs-content-prism-highlighter.d.ts +0 -15
  101. package/types/analogjs-content-resources.d.ts +0 -20
  102. package/types/analogjs-content-shiki-highlighter.d.ts +0 -11
  103. package/types/analogjs-content.d.ts +0 -168
@@ -0,0 +1,25 @@
1
+ import { InjectionToken, Type, Provider } from '@angular/core';
2
+ /**
3
+ * Registry mapping MDC component names to lazy-loaded Angular components.
4
+ *
5
+ * @experimental MDC component support is experimental and may change in future releases.
6
+ */
7
+ export declare const MDC_COMPONENTS: InjectionToken<Map<string, () => Promise<Type<unknown>>>>;
8
+ /**
9
+ * Provides a registry of Angular components that can be used in MDC
10
+ * (Markdown Components) syntax within markdown content.
11
+ *
12
+ * @experimental MDC component support is experimental and may change in future releases.
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * provideContent(
17
+ * withMd4xRenderer(),
18
+ * withMdcComponents({
19
+ * alert: () => import('./components/alert.component').then(m => m.AlertComponent),
20
+ * card: () => import('./components/card.component').then(m => m.CardComponent),
21
+ * }),
22
+ * );
23
+ * ```
24
+ */
25
+ export declare function withMdcComponents(components: Record<string, () => Promise<Type<unknown>>>): Provider;
@@ -0,0 +1,33 @@
1
+ import { InputSignal } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ type ComarkNode = string | [string | null, Record<string, unknown>, ...ComarkNode[]];
4
+ /**
5
+ * Directive that renders MDC (Markdown Components) AST nodes as Angular components.
6
+ *
7
+ * Walks the ComarkTree AST from md4x's `parseAST()`, matches component nodes
8
+ * to the registered MDC_COMPONENTS map, and instantiates them via
9
+ * `ViewContainerRef.createComponent()` with MDC attributes bound as inputs.
10
+ *
11
+ * @experimental MDC component support is experimental and may change in future releases.
12
+ *
13
+ * @example
14
+ * ```html
15
+ * <div [mdcAst]="parsedAst"></div>
16
+ * ```
17
+ */
18
+ export declare class MdcRendererDirective {
19
+ readonly ast: InputSignal<{
20
+ nodes: ComarkNode[];
21
+ } | null>;
22
+ private readonly viewContainer;
23
+ private readonly renderer;
24
+ private readonly el;
25
+ private readonly components;
26
+ private renderId;
27
+ constructor();
28
+ private renderNodes;
29
+ private renderNode;
30
+ static ɵfac: i0.ɵɵFactoryDeclaration<MdcRendererDirective, never>;
31
+ static ɵdir: i0.ɵɵDirectiveDeclaration<MdcRendererDirective, "[mdcAst]", never, { "ast": { "alias": "mdcAst"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
32
+ }
33
+ export {};
@@ -0,0 +1,2 @@
1
+ export { ImageResponse } from './lib/og';
2
+ export { ImageResponseOptions } from './lib/options';
@@ -0,0 +1,5 @@
1
+ import { ImageResponseOptions } from './options';
2
+ export declare const generateImage: (element: string, options: ImageResponseOptions) => Promise<Buffer>;
3
+ export declare class ImageResponse extends Response {
4
+ constructor(element: string, options?: ImageResponseOptions);
5
+ }
@@ -0,0 +1,11 @@
1
+ import type { SatoriOptions } from 'satori';
2
+ export interface ImageResponseOptions {
3
+ width?: number;
4
+ height?: number;
5
+ fonts?: SatoriOptions['fonts'];
6
+ debug?: boolean;
7
+ status?: number;
8
+ statusText?: string;
9
+ headers?: Record<string, string>;
10
+ tailwindConfig?: SatoriOptions['tailwindConfig'];
11
+ }
@@ -0,0 +1,8 @@
1
+ import { Provider } from '@angular/core';
2
+ import { PrismHighlighter } from './lib/prism-highlighter';
3
+ import 'prismjs';
4
+ import 'prismjs/plugins/toolbar/prism-toolbar';
5
+ import 'prismjs/plugins/copy-to-clipboard/prism-copy-to-clipboard';
6
+ import './lib/prism/angular';
7
+ export { PrismHighlighter };
8
+ export declare function withPrismHighlighter(): Provider[];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ import { MarkedContentHighlighter } from '@analogjs/content';
2
+ import * as i0 from "@angular/core";
3
+ export declare class PrismHighlighter extends MarkedContentHighlighter {
4
+ augmentCodeBlock(code: string, lang: string): string;
5
+ getHighlightExtension(): import('marked').MarkedExtension;
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<PrismHighlighter, never>;
7
+ static ɵprov: i0.ɵɵInjectableDeclaration<PrismHighlighter>;
8
+ }
@@ -0,0 +1,37 @@
1
+ import type { StandardSchemaV1 } from '@standard-schema/spec';
2
+ import { Signal, type ResourceRef } from '@angular/core';
3
+ import { ContentFile } from '@analogjs/content';
4
+ export interface ContentFileResourceResult<Attributes extends Record<string, any> = Record<string, any>> extends ContentFile<Attributes | Record<string, never>> {
5
+ toc: Array<{
6
+ id: string;
7
+ level: number;
8
+ text: string;
9
+ }>;
10
+ }
11
+ type ContentFileParams = Signal<string | {
12
+ customFilename: string;
13
+ }>;
14
+ /**
15
+ * Resource for requesting an individual content file.
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * // Without schema (existing behavior)
20
+ * const post = contentFileResource<BlogAttributes>();
21
+ *
22
+ * // With schema validation
23
+ * import * as v from 'valibot';
24
+ * const BlogSchema = v.object({
25
+ * title: v.string(),
26
+ * date: v.pipe(v.string(), v.isoDate()),
27
+ * });
28
+ * const post = contentFileResource({ schema: BlogSchema });
29
+ * ```
30
+ */
31
+ export declare function contentFileResource<Attributes extends Record<string, any> = Record<string, any>>(params?: ContentFileParams, fallback?: string): ResourceRef<ContentFileResourceResult<Attributes> | undefined>;
32
+ export declare function contentFileResource<TSchema extends StandardSchemaV1>(options: {
33
+ params?: ContentFileParams;
34
+ fallback?: string;
35
+ schema: TSchema;
36
+ }): ResourceRef<ContentFileResourceResult<StandardSchemaV1.InferOutput<TSchema> & Record<string, any>> | undefined>;
37
+ export {};
@@ -0,0 +1,3 @@
1
+ import { ResourceRef } from '@angular/core';
2
+ import { ContentFile, InjectContentFilesFilterFunction } from '@analogjs/content';
3
+ export declare function contentFilesResource<Attributes extends Record<string, any>>(filterFn?: InjectContentFilesFilterFunction<Attributes> | undefined): ResourceRef<ContentFile<Attributes>[] | undefined>;
@@ -0,0 +1,2 @@
1
+ export { contentFilesResource } from './content-files-resource';
2
+ export { contentFileResource } from './content-file-resource';
@@ -0,0 +1,7 @@
1
+ import { Provider } from '@angular/core';
2
+ import type { BundledLanguage, BundledTheme, CodeOptionsMeta, CodeOptionsMultipleThemes, CodeOptionsSingleTheme, CodeToHastOptionsCommon } from 'shiki';
3
+ export type ShikiHighlightOptions = Partial<Omit<CodeToHastOptionsCommon<BundledLanguage>, 'lang'>> & CodeOptionsMeta & Partial<CodeOptionsSingleTheme<BundledTheme>> & Partial<CodeOptionsMultipleThemes<BundledTheme>>;
4
+ export type WithShikiHighlighterOptions = ShikiHighlightOptions & {
5
+ container?: string;
6
+ };
7
+ export declare function withShikiHighlighter(_opts?: WithShikiHighlighterOptions): Provider[];
@@ -0,0 +1,18 @@
1
+ export { AnchorNavigationDirective } from './lib/anchor-navigation.directive';
2
+ export { injectContent } from './lib/content';
3
+ export type { ContentFile } from './lib/content-file';
4
+ export { ContentRenderer, NoopContentRenderer } from './lib/content-renderer';
5
+ export type { RenderedContent, TableOfContentItem, } from './lib/content-renderer';
6
+ export { injectContentFiles } from './lib/inject-content-files';
7
+ export type { InjectContentFilesFilterFunction } from './lib/inject-content-files';
8
+ export { MarkdownContentRendererService } from './lib/markdown-content-renderer.service';
9
+ export { provideContent, withMarkdownRenderer, MERMAID_IMPORT_TOKEN, } from './lib/provide-content';
10
+ export { default as MarkdownRouteComponent } from './lib/markdown-route.component';
11
+ export { default as MarkdownComponent } from './lib/markdown.component';
12
+ export { parseRawContentFile, parseRawContentFileAsync, FrontmatterValidationError, } from './lib/parse-raw-content-file';
13
+ export { MarkedSetupService } from './lib/marked-setup.service';
14
+ export { MarkedContentHighlighter, withHighlighter, } from './lib/marked-content-highlighter';
15
+ export { injectContentFilesMap } from './lib/inject-content-files';
16
+ export { injectContentListLoader, withContentListLoader, CONTENT_LIST_LOADER, } from './lib/content-list-loader';
17
+ export { injectContentFileLoader, withContentFileLoader, CONTENT_FILE_LOADER, } from './lib/content-file-loader';
18
+ export { contentDevToolsPlugin, DevToolsContentRenderer, withContentDevTools, } from './lib/devtools/index';
@@ -0,0 +1,9 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class AnchorNavigationDirective {
3
+ private readonly document;
4
+ private readonly location;
5
+ private readonly router;
6
+ handleNavigation(element: EventTarget | null): boolean;
7
+ static ɵfac: i0.ɵɵFactoryDeclaration<AnchorNavigationDirective, never>;
8
+ static ɵdir: i0.ɵɵDirectiveDeclaration<AnchorNavigationDirective, "[analogAnchorNavigation]", never, {}, {}, never, never, true, never>;
9
+ }
@@ -0,0 +1,6 @@
1
+ import { InjectionToken, Provider } from '@angular/core';
2
+ type ContentFileLoaderFunction = () => Promise<Record<string, () => Promise<string>>>;
3
+ export declare const CONTENT_FILE_LOADER: InjectionToken<ContentFileLoaderFunction>;
4
+ export declare function injectContentFileLoader(): ContentFileLoaderFunction;
5
+ export declare function withContentFileLoader(): Provider;
6
+ export {};
@@ -0,0 +1,8 @@
1
+ import { TableOfContentItem } from './content-renderer';
2
+ export interface ContentFile<Attributes extends Record<string, any> = Record<string, any>> {
3
+ filename: string;
4
+ slug: string;
5
+ content?: string | object;
6
+ attributes: Attributes;
7
+ toc?: TableOfContentItem[];
8
+ }
@@ -0,0 +1,3 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ import { ContentFile } from './content-file';
3
+ export declare const CONTENT_FILES_LIST_TOKEN: InjectionToken<ContentFile[]>;
@@ -0,0 +1,3 @@
1
+ import { InjectionToken, Signal } from '@angular/core';
2
+ export declare const CONTENT_FILES_TOKEN: InjectionToken<Record<string, () => Promise<string>>>;
3
+ export declare const CONTENT_FILES_MAP_TOKEN: InjectionToken<Signal<Record<string, () => Promise<string>>>>;
@@ -0,0 +1,7 @@
1
+ import { InjectionToken, Provider } from '@angular/core';
2
+ import { ContentFile } from './content-file';
3
+ type ContentListLoaderFunction<Attributes extends Record<string, any>> = () => Promise<ContentFile<Attributes>[]>;
4
+ export declare const CONTENT_LIST_LOADER: InjectionToken<ContentListLoaderFunction<any>>;
5
+ export declare function injectContentListLoader<Attributes extends Record<string, any>>(): ContentListLoaderFunction<Attributes>;
6
+ export declare function withContentListLoader(): Provider;
7
+ export {};
@@ -0,0 +1,33 @@
1
+ import * as i0 from "@angular/core";
2
+ export type TableOfContentItem = {
3
+ id: string;
4
+ level: number;
5
+ text: string;
6
+ };
7
+ export type RenderedContent = {
8
+ content: string;
9
+ toc: TableOfContentItem[];
10
+ };
11
+ export declare abstract class ContentRenderer {
12
+ render(content: string): Promise<RenderedContent>;
13
+ getContentHeadings(_content: string): TableOfContentItem[];
14
+ enhance(): void;
15
+ static ɵfac: i0.ɵɵFactoryDeclaration<ContentRenderer, never>;
16
+ static ɵprov: i0.ɵɵInjectableDeclaration<ContentRenderer>;
17
+ }
18
+ export declare class NoopContentRenderer implements ContentRenderer {
19
+ private readonly transferState;
20
+ private contentId;
21
+ /**
22
+ * Generates a hash from the content string
23
+ * to be used with the transfer state
24
+ */
25
+ private generateHash;
26
+ render(content: string): Promise<RenderedContent>;
27
+ enhance(): void;
28
+ getContentHeadings(content: string): TableOfContentItem[];
29
+ private extractHeadings;
30
+ private extractHeadingsFromMarkdown;
31
+ private extractHeadingsFromHtml;
32
+ private makeSlug;
33
+ }
@@ -0,0 +1,14 @@
1
+ import { Observable } from 'rxjs';
2
+ import { ContentFile } from './content-file';
3
+ /**
4
+ * Retrieves the static content using the provided param and/or prefix.
5
+ *
6
+ * @param param route parameter (default: 'slug')
7
+ * @param fallback fallback text if content file is not found (default: 'No Content Found')
8
+ */
9
+ export declare function injectContent<Attributes extends Record<string, any> = Record<string, any>>(param?: string | {
10
+ param: string;
11
+ subdirectory: string;
12
+ } | {
13
+ customFilename: string;
14
+ }, fallback?: string): Observable<ContentFile<Attributes | Record<string, never>>>;
@@ -0,0 +1,23 @@
1
+ import type { Plugin } from 'vite';
2
+ /**
3
+ * Vite plugin that injects the Analog Content DevTools panel in dev mode.
4
+ *
5
+ * Shows render time, frontmatter data, TOC, and content stats in a floating
6
+ * panel. Dev-only — completely stripped from production builds.
7
+ *
8
+ * @experimental Content DevTools is experimental and may change in future releases.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * // vite.config.ts
13
+ * import { contentDevToolsPlugin } from '@analogjs/content/devtools';
14
+ *
15
+ * export default defineConfig({
16
+ * plugins: [
17
+ * analog({ ... }),
18
+ * contentDevToolsPlugin(),
19
+ * ],
20
+ * });
21
+ * ```
22
+ */
23
+ export declare function contentDevToolsPlugin(): Plugin;
@@ -0,0 +1,23 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ import { ContentRenderer, RenderedContent, TableOfContentItem } from '../content-renderer';
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * Token for the wrapped renderer that DevTools delegates to.
6
+ * @internal
7
+ */
8
+ export declare const DEVTOOLS_INNER_RENDERER: InjectionToken<ContentRenderer>;
9
+ /**
10
+ * Wraps an existing ContentRenderer to collect timing and metadata for the
11
+ * Content DevTools panel. Dispatches a custom event on the window after
12
+ * each render so the devtools client can update.
13
+ *
14
+ * @experimental Content DevTools is experimental and may change in future releases.
15
+ */
16
+ export declare class DevToolsContentRenderer extends ContentRenderer {
17
+ private readonly inner;
18
+ render(content: string): Promise<RenderedContent>;
19
+ getContentHeadings(content: string): TableOfContentItem[];
20
+ enhance(): void;
21
+ static ɵfac: i0.ɵɵFactoryDeclaration<DevToolsContentRenderer, never>;
22
+ static ɵprov: i0.ɵɵInjectableDeclaration<DevToolsContentRenderer>;
23
+ }
@@ -0,0 +1,23 @@
1
+ import { Provider, Type } from '@angular/core';
2
+ import { ContentRenderer } from '../content-renderer';
3
+ export { contentDevToolsPlugin } from './content-devtools-plugin';
4
+ export { DevToolsContentRenderer, DEVTOOLS_INNER_RENDERER, } from './content-devtools-renderer';
5
+ /**
6
+ * Wraps the given ContentRenderer with DevTools instrumentation.
7
+ *
8
+ * The supplied renderer class is provided under DEVTOOLS_INNER_RENDERER and
9
+ * DevToolsContentRenderer becomes the new ContentRenderer, delegating
10
+ * all calls and collecting timing data.
11
+ *
12
+ * @param innerRenderer The renderer class to wrap with devtools instrumentation.
13
+ *
14
+ * @experimental Content DevTools is experimental and may change in future releases.
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * provideContent(
19
+ * withContentDevTools(NoopContentRenderer),
20
+ * );
21
+ * ```
22
+ */
23
+ export declare function withContentDevTools(innerRenderer: Type<ContentRenderer>): Provider;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Returns the list of content files by filename with ?analog-content-list=true.
3
+ * We use the query param to transform the return into an array of
4
+ * just front matter attributes.
5
+ *
6
+ * @returns
7
+ */
8
+ export declare const getContentFilesList: () => Record<string, Record<string, any>>;
9
+ /**
10
+ * Returns the lazy loaded content files for lookups.
11
+ *
12
+ * @returns
13
+ */
14
+ export declare const getContentFiles: () => Record<string, () => Promise<string>>;
@@ -0,0 +1,4 @@
1
+ import { ContentFile } from './content-file';
2
+ export declare function injectContentFiles<Attributes extends Record<string, any>>(filterFn?: InjectContentFilesFilterFunction<Attributes>): ContentFile<Attributes>[];
3
+ export type InjectContentFilesFilterFunction<T extends Record<string, any>> = (value: ContentFile<T>, index: number, array: ContentFile<T>[]) => boolean;
4
+ export declare function injectContentFilesMap(): Record<string, () => Promise<string>>;
@@ -0,0 +1,10 @@
1
+ import { ContentRenderer, RenderedContent, TableOfContentItem } from './content-renderer';
2
+ import * as i0 from "@angular/core";
3
+ export declare class MarkdownContentRendererService implements ContentRenderer {
4
+ #private;
5
+ render(content: string): Promise<RenderedContent>;
6
+ getContentHeadings(content: string): TableOfContentItem[];
7
+ enhance(): void;
8
+ static ɵfac: i0.ɵɵFactoryDeclaration<MarkdownContentRendererService, never>;
9
+ static ɵprov: i0.ɵɵInjectableDeclaration<MarkdownContentRendererService>;
10
+ }
@@ -0,0 +1,15 @@
1
+ import { AfterViewChecked } from '@angular/core';
2
+ import { SafeHtml } from '@angular/platform-browser';
3
+ import { ContentRenderer } from './content-renderer';
4
+ import * as i0 from "@angular/core";
5
+ import * as i1 from "./anchor-navigation.directive";
6
+ export default class AnalogMarkdownRouteComponent implements AfterViewChecked {
7
+ private sanitizer;
8
+ private route;
9
+ contentRenderer: ContentRenderer;
10
+ protected content: SafeHtml;
11
+ classes: string;
12
+ ngAfterViewChecked(): void;
13
+ static ɵfac: i0.ɵɵFactoryDeclaration<AnalogMarkdownRouteComponent, never>;
14
+ static ɵcmp: i0.ɵɵComponentDeclaration<AnalogMarkdownRouteComponent, "analog-markdown-route", never, { "classes": { "alias": "classes"; "required": false; }; }, {}, never, never, true, [{ directive: typeof i1.AnchorNavigationDirective; inputs: {}; outputs: {}; }]>;
15
+ }
@@ -0,0 +1,26 @@
1
+ import { AfterViewChecked, InputSignal, Signal } from '@angular/core';
2
+ import { SafeHtml } from '@angular/platform-browser';
3
+ import { Observable } from 'rxjs';
4
+ import { ContentRenderer } from './content-renderer';
5
+ import * as i0 from "@angular/core";
6
+ import * as i1 from "./anchor-navigation.directive";
7
+ export default class AnalogMarkdownComponent implements AfterViewChecked {
8
+ private sanitizer;
9
+ private route;
10
+ private zone;
11
+ private readonly platformId;
12
+ private readonly mermaidImport;
13
+ private mermaid;
14
+ private contentSource;
15
+ readonly htmlContent: Signal<SafeHtml | string | undefined>;
16
+ readonly content: InputSignal<string | object | null | undefined>;
17
+ readonly classes: InputSignal<string>;
18
+ contentRenderer: ContentRenderer;
19
+ constructor();
20
+ getContentSource(): Observable<SafeHtml | string>;
21
+ renderContent(content: string): Promise<string>;
22
+ ngAfterViewChecked(): void;
23
+ private loadMermaid;
24
+ static ɵfac: i0.ɵɵFactoryDeclaration<AnalogMarkdownComponent, never>;
25
+ static ɵcmp: i0.ɵɵComponentDeclaration<AnalogMarkdownComponent, "analog-markdown", never, { "content": { "alias": "content"; "required": false; "isSignal": true; }; "classes": { "alias": "classes"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.AnchorNavigationDirective; inputs: {}; outputs: {}; }]>;
26
+ }
@@ -0,0 +1,17 @@
1
+ import { AbstractType, Provider, ProviderToken, Type } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ export declare abstract class MarkedContentHighlighter {
4
+ augmentCodeBlock?(code: string, lang: string): string;
5
+ abstract getHighlightExtension(): import('marked').MarkedExtension;
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<MarkedContentHighlighter, never>;
7
+ static ɵprov: i0.ɵɵInjectableDeclaration<MarkedContentHighlighter>;
8
+ }
9
+ export declare function withHighlighter(provider: ({
10
+ useValue: MarkedContentHighlighter;
11
+ } | {
12
+ useClass: Type<MarkedContentHighlighter> | AbstractType<MarkedContentHighlighter>;
13
+ } | {
14
+ useFactory: (...deps: any[]) => MarkedContentHighlighter;
15
+ }) & {
16
+ deps?: ProviderToken<any>[];
17
+ }): Provider;
@@ -0,0 +1,10 @@
1
+ import { marked } from 'marked';
2
+ import * as i0 from "@angular/core";
3
+ export declare class MarkedSetupService {
4
+ private readonly marked;
5
+ private readonly highlighter;
6
+ constructor();
7
+ getMarkedInstance(): typeof marked;
8
+ static ɵfac: i0.ɵɵFactoryDeclaration<MarkedSetupService, never>;
9
+ static ɵprov: i0.ɵɵInjectableDeclaration<MarkedSetupService>;
10
+ }
@@ -0,0 +1,18 @@
1
+ import type { StandardSchemaV1 } from '@standard-schema/spec';
2
+ export declare class FrontmatterValidationError extends Error {
3
+ readonly issues: ReadonlyArray<StandardSchemaV1.Issue>;
4
+ readonly filename?: string | undefined;
5
+ constructor(issues: ReadonlyArray<StandardSchemaV1.Issue>, filename?: string | undefined);
6
+ }
7
+ export declare function parseRawContentFile<Attributes extends Record<string, any> = Record<string, any>>(rawContentFile: string): {
8
+ content: string;
9
+ attributes: Attributes;
10
+ };
11
+ export declare function parseRawContentFile<TSchema extends StandardSchemaV1>(rawContentFile: string, schema: TSchema, filename?: string): {
12
+ content: string;
13
+ attributes: StandardSchemaV1.InferOutput<TSchema>;
14
+ };
15
+ export declare function parseRawContentFileAsync<TSchema extends StandardSchemaV1>(rawContentFile: string, schema: TSchema, filename?: string): Promise<{
16
+ content: string;
17
+ attributes: StandardSchemaV1.InferOutput<TSchema>;
18
+ }>;
@@ -0,0 +1,7 @@
1
+ import { Provider, InjectionToken } from '@angular/core';
2
+ export interface MarkdownRendererOptions {
3
+ loadMermaid?: () => Promise<typeof import('mermaid')>;
4
+ }
5
+ export declare function withMarkdownRenderer(options?: MarkdownRendererOptions): Provider;
6
+ export declare function provideContent(...features: Provider[]): Provider[];
7
+ export declare const MERMAID_IMPORT_TOKEN: InjectionToken<Promise<typeof import('mermaid')>>;
@@ -0,0 +1,8 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class RenderTaskService {
3
+ #private;
4
+ addRenderTask(): number;
5
+ clearRenderTask(clear: number | (() => void)): void;
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<RenderTaskService, never>;
7
+ static ɵprov: i0.ɵɵInjectableDeclaration<RenderTaskService>;
8
+ }
@@ -0,0 +1,2 @@
1
+ import { Observable } from 'rxjs';
2
+ export declare function waitFor<T>(prom: Promise<T> | Observable<T>): Promise<T>;
@@ -1 +0,0 @@
1
- {"version":3,"file":"analogjs-content-og.mjs","sources":["../../../../packages/content/og/src/lib/og.ts","../../../../packages/content/og/src/analogjs-content-og.ts"],"sourcesContent":["// Credit for modified source: https://github.com/etherCorps/sveltekit-og/blob/main/src/lib/api.ts\n\nimport satori from 'satori';\nimport { html as toReactElement } from 'satori-html';\nimport sharp from 'sharp';\n\nimport { ImageResponseOptions } from './options';\n\nexport const generateImage = async (\n element: string,\n options: ImageResponseOptions,\n) => {\n const elementHtml = toReactElement(element);\n const svg = await satori(elementHtml as any, {\n width: options.width || 1200,\n height: options.height || 630,\n fonts: options.fonts?.length ? options.fonts : [],\n tailwindConfig: options.tailwindConfig,\n });\n const svgBuffer = Buffer.from(svg);\n const png = sharp(svgBuffer).png().toBuffer();\n\n const pngBuffer = await png;\n\n return pngBuffer;\n};\n\nexport class ImageResponse extends Response {\n constructor(element: string, options: ImageResponseOptions = {}) {\n super();\n\n const body = new ReadableStream({\n async start(controller) {\n const buffer = await generateImage(element, options);\n controller.enqueue(buffer);\n controller.close();\n },\n });\n\n return new Response(body, {\n headers: {\n 'Content-Type': 'image/png',\n 'Cache-Control': options.debug\n ? 'no-cache, no-store'\n : 'public, immutable, no-transform, max-age=31536000',\n ...options.headers,\n },\n status: options.status || 200,\n statusText: options.statusText,\n });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["toReactElement"],"mappings":";;;;AAAA;AAQO,MAAM,aAAa,GAAG,OAC3B,OAAe,EACf,OAA6B,KAC3B;AACF,IAAA,MAAM,WAAW,GAAGA,IAAc,CAAC,OAAO,CAAC;AAC3C,IAAA,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,WAAkB,EAAE;AAC3C,QAAA,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,IAAI;AAC5B,QAAA,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,GAAG;AAC7B,QAAA,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,GAAG,EAAE;QACjD,cAAc,EAAE,OAAO,CAAC,cAAc;AACvC,KAAA,CAAC;IACF,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;AAClC,IAAA,MAAM,GAAG,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;AAE7C,IAAA,MAAM,SAAS,GAAG,MAAM,GAAG;AAE3B,IAAA,OAAO,SAAS;AAClB,CAAC;AAEK,MAAO,aAAc,SAAQ,QAAQ,CAAA;IACzC,WAAA,CAAY,OAAe,EAAE,OAAA,GAAgC,EAAE,EAAA;AAC7D,QAAA,KAAK,EAAE;AAEP,QAAA,MAAM,IAAI,GAAG,IAAI,cAAc,CAAC;YAC9B,MAAM,KAAK,CAAC,UAAU,EAAA;gBACpB,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC;AACpD,gBAAA,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC;gBAC1B,UAAU,CAAC,KAAK,EAAE;YACpB,CAAC;AACF,SAAA,CAAC;AAEF,QAAA,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE;AACxB,YAAA,OAAO,EAAE;AACP,gBAAA,cAAc,EAAE,WAAW;gBAC3B,eAAe,EAAE,OAAO,CAAC;AACvB,sBAAE;AACF,sBAAE,mDAAmD;gBACvD,GAAG,OAAO,CAAC,OAAO;AACnB,aAAA;AACD,YAAA,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,GAAG;YAC7B,UAAU,EAAE,OAAO,CAAC,UAAU;AAC/B,SAAA,CAAC;IACJ;AACD;;ACnDD;;AAEG;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"analogjs-content-prism-highlighter.mjs","sources":["../../../../packages/content/prism-highlighter/src/lib/prism-highlighter.ts","../../../../packages/content/prism-highlighter/src/lib/prism/angular.js","../../../../packages/content/prism-highlighter/src/index.ts","../../../../packages/content/prism-highlighter/src/analogjs-content-prism-highlighter.ts"],"sourcesContent":["import { MarkedContentHighlighter } from '@analogjs/content';\nimport { Injectable } from '@angular/core';\nimport { markedHighlight } from 'marked-highlight';\n\ndeclare const Prism: typeof import('prismjs');\n\n@Injectable()\nexport class PrismHighlighter extends MarkedContentHighlighter {\n override augmentCodeBlock(code: string, lang: string): string {\n const classes =\n lang.startsWith('diff') && Prism.languages['diff']\n ? `language-${lang} diff-highlight`\n : `language-${lang.replace('diff-', '')}`;\n return `<pre class=\"${classes}\"><code class=\"${classes}\">${code}</code></pre>`;\n }\n\n override getHighlightExtension() {\n return markedHighlight({\n async: true,\n highlight: (code: string, lang: string) => {\n let diff = lang?.startsWith('diff-');\n lang = diff ? lang.replace('diff-', '') : lang || 'typescript';\n\n if (diff && !Prism.languages['diff']) {\n diff = false;\n console.warn(`Notice:\n ---------------------------------------------------------------------------------------\n The \\`diff\\` language and plugin are not available in the provided setup.\n To enable it, add the following imports your \\`app.config.ts\\`:\n import 'prismjs/components/prism-diff';\n import 'prismjs/plugins/diff-highlight/prism-diff-highlight';\n ---------------------------------------------------------------------------------------\n `);\n }\n\n if (!Prism.languages[lang]) {\n if (lang !== 'mermaid') {\n console.warn(`Notice:\n ---------------------------------------------------------------------------------------\n The requested language '${lang}' is not available in the provided setup.\n To enable it, add the following import your \\`app.config.ts\\`:\n import 'prismjs/components/prism-${lang}';\n ---------------------------------------------------------------------------------------\n `);\n }\n return code;\n }\n return Prism.highlight(\n code,\n diff ? Prism.languages['diff'] : Prism.languages[lang],\n lang,\n );\n },\n });\n }\n}\n","(function () {\n if (typeof Prism === 'undefined') {\n return;\n }\n\n Prism.languages.angular = Prism.languages.extend('markup', {\n keyword:\n /(?:@if|@for|@switch|@defer|@loading|@error|@placeholder|prefetch)\\b/,\n operator: /\\b(?:on|when)\\b/,\n number: {\n pattern: /\\b(minimum|after)\\s+\\d+(?:s|ms|)/gi,\n lookbehind: true,\n },\n builtin: {\n pattern:\n /\\b(?:viewport|timer|minimum|after|hover|idle|immediate|interaction)/,\n },\n function:\n /#?(?!\\s)[_$a-zA-Z\\xA0-\\uFFFF](?:(?!\\s)[$\\w\\xA0-\\uFFFF])*(?=\\s*(?:\\.\\s*(?:apply|bind|call)\\s*)?\\()/,\n });\n\n Prism.languages.ng = Prism.languages.angular;\n})();\n","import { ContentRenderer, NoopContentRenderer } from '@analogjs/content';\nimport { Provider } from '@angular/core';\nimport { PrismHighlighter } from './lib/prism-highlighter';\n\nimport 'prismjs';\nimport 'prismjs/plugins/toolbar/prism-toolbar';\nimport 'prismjs/plugins/copy-to-clipboard/prism-copy-to-clipboard';\nimport './lib/prism/angular';\n\nexport { PrismHighlighter };\n\nexport function withPrismHighlighter(): Provider[] {\n return [{ provide: ContentRenderer, useClass: NoopContentRenderer }];\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAOM,MAAO,gBAAiB,SAAQ,wBAAwB,CAAA;IACnD,gBAAgB,CAAC,IAAY,EAAE,IAAY,EAAA;AAClD,QAAA,MAAM,OAAO,GACX,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,SAAS,CAAC,MAAM;cAC7C,CAAA,SAAA,EAAY,IAA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gB,EAAA,CAAA,CAAA;;2FAAhB,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAD5B;;;;ACND,CAAC,YAAA;AACC,IAAA,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;QAChC;IACF;AAEA,IAAA,KAAK,CAAC,SAAS,CAAC,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,EAAE;AACzD,QAAA,OAAO,EACL,qEAAqE;AACvE,QAAA,QAAQ,EAAE,iBAAiB;AAC3B,QAAA,MAAM,EAAE;AACN,YAAA,OAAO,EAAE,oCAAoC;AAC7C,YAAA,UAAU,EAAE,IAAI;AACjB,SAAA;AACD,QAAA,OAAO,EAAE;AACP,YAAA,OAAO,EACL,qEAAqE;AACxE,SAAA;AACD,QAAA,QAAQ,EACN,mGAAmG;AACtG,KAAA,CAAC;IAEF,KAAK,CAAC,SAAS,CAAC,EAAE,GAAG,KAAK,CAAC,SAAS,CAAC,OAAO;AAC9C,CAAC,GAAG;;SCXY,oBAAoB,GAAA;IAClC,OAAO,CAAC,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,mBAAmB,EAAE,CAAC;AACtE;;ACbA;;AAEG;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"analogjs-content-resources.mjs","sources":["../../../../packages/content/resources/src/content-files-resource.ts","../../../../packages/content/resources/src/content-file-resource.ts","../../../../packages/content/resources/src/analogjs-content-resources.ts"],"sourcesContent":["import { resource } from '@angular/core';\nimport {\n injectContentListLoader,\n InjectContentFilesFilterFunction,\n} from '@analogjs/content';\n\nexport function contentFilesResource<Attributes extends Record<string, any>>(\n filterFn?: InjectContentFilesFilterFunction<Attributes> | undefined,\n) {\n const contentListLoader = injectContentListLoader<Attributes>();\n const contentList = contentListLoader().then((items) =>\n filterFn ? items.filter(filterFn) : items,\n );\n\n return resource({\n loader: () => contentList,\n });\n}\n","import { computed, inject, resource, Signal } from '@angular/core';\nimport {\n ContentFile,\n ContentRenderer,\n parseRawContentFile,\n injectContentFileLoader,\n} from '@analogjs/content';\nimport { ActivatedRoute } from '@angular/router';\n\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { from } from 'rxjs';\nimport { map } from 'rxjs/operators';\n\ntype ContentFileParams = Signal<\n | string\n | {\n customFilename: string;\n }\n>;\n\nasync function getContentFile<\n Attributes extends Record<string, any> = Record<string, any>,\n>(\n contentFiles: Record<string, () => Promise<string>>,\n slug: string,\n fallback: string,\n): Promise<ContentFile<Attributes | Record<string, never>>> {\n // Normalize file keys so both \"/src/content/...\" and \"/<project>/src/content/...\" resolve.\n // This mirrors normalization used elsewhere in the content pipeline.\n const normalizedFiles: Record<string, () => Promise<string>> = {};\n for (const [key, resolver] of Object.entries(contentFiles)) {\n const normalizedKey = key\n // replace any prefix up to the content directory with /src/content\n // use a non-greedy match so nested paths containing \"/content\" are preserved\n .replace(/^(?:.*?)\\/content(?=\\/)/, '/src/content')\n // normalize duplicate slashes\n .replace(/\\/{2,}/g, '/');\n normalizedFiles[normalizedKey] = resolver;\n }\n\n // Try direct file first, then directory index variants\n const base = `/src/content/${slug}`.replace(/\\/{2,}/g, '/');\n const candidates = [\n `${base}.md`,\n `${base}.agx`,\n `${base}/index.md`,\n `${base}/index.agx`,\n ];\n\n const matchKey = candidates.find((k) => k in normalizedFiles);\n const contentFile = matchKey ? normalizedFiles[matchKey] : undefined;\n\n if (!contentFile) {\n return {\n filename: base,\n attributes: {},\n slug: '',\n content: fallback,\n } as ContentFile<Attributes | Record<string, never>>;\n }\n\n const resolvedBase = matchKey!.replace(/\\.(md|agx)$/, '');\n\n return contentFile().then(\n (contentFile: string | { default: any; metadata: any }) => {\n if (typeof contentFile === 'string') {\n const { content, attributes } =\n parseRawContentFile<Attributes>(contentFile);\n\n return {\n filename: resolvedBase,\n slug,\n attributes,\n content,\n } as ContentFile<Attributes | Record<string, never>>;\n }\n\n return {\n filename: resolvedBase,\n slug,\n attributes: contentFile.metadata,\n content: contentFile.default,\n } as ContentFile<Attributes | Record<string, never>>;\n },\n );\n}\n\n/**\n * Resource for requesting an individual content file\n *\n * @param params\n * @param fallback\n * @returns\n */\nexport function contentFileResource<\n Attributes extends Record<string, any> = Record<string, any>,\n>(params?: ContentFileParams, fallback = 'No Content Found') {\n const loaderPromise = injectContentFileLoader();\n const contentRenderer = inject(ContentRenderer);\n const contentFilesMap = toSignal(from(loaderPromise()));\n const input =\n params ||\n toSignal(\n inject(ActivatedRoute).paramMap.pipe(\n map((params) => params.get('slug') as string),\n ),\n { requireSync: true },\n );\n\n return resource({\n params: computed(() => ({ input: input(), files: contentFilesMap() })),\n loader: async ({ params }) => {\n const { input: param, files } = params;\n\n if (typeof param === 'string') {\n if (param) {\n const file = await getContentFile<Attributes>(\n files!,\n param,\n fallback,\n );\n if (typeof file.content === 'string') {\n const rendered = (await contentRenderer.render(file.content)) as {\n toc?: Array<{ id: string; level: number; text: string }>;\n };\n return {\n ...file,\n toc: rendered.toc ?? [],\n };\n }\n return {\n ...file,\n toc: [],\n };\n }\n\n return {\n filename: '',\n slug: '',\n attributes: {},\n content: fallback,\n toc: [],\n } as ContentFile<Attributes | Record<string, never>>;\n } else {\n const file = await getContentFile<Attributes>(\n files!,\n param.customFilename,\n fallback,\n );\n if (typeof file.content === 'string') {\n const rendered = (await contentRenderer.render(file.content)) as {\n toc?: Array<{ id: string; level: number; text: string }>;\n };\n return {\n ...file,\n toc: rendered.toc ?? [],\n };\n }\n return {\n ...file,\n toc: [],\n };\n }\n },\n });\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAMM,SAAU,oBAAoB,CAClC,QAAmE,EAAA;AAEnE,IAAA,MAAM,iBAAiB,GAAG,uBAAuB,EAAc;IAC/D,MAAM,WAAW,GAAG,iBAAiB,EAAE,CAAC,IAAI,CAAC,CAAC,KAAK,KACjD,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,KAAK,CAC1C;AAED,I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AAK,QAAQ,EAAE;gBAC7B,IAAI,KAAK,EAAE;oBACT,MAAM,IAAI,GAAG,MAAM,cAAc,CAC/B,KAAM,EACN,KAAK,EACL,QAAQ,CACT;AACD,oBAAA,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,EAAE;AACpC,wBAAA,MAAM,QAAQ,IAAI,MAAM,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAE3D;wBACD,OAAO;AACL,4BAAA,GAAG,IAAI;AACP,4BAAA,GAAG,EAAE,QAAQ,CAAC,GAAG,IAAI,EAAE;yBACxB;oBACH;oBACA,OAAO;AACL,wBAAA,GAAG,IAAI;AACP,wBAAA,GAAG,EAAE,EAAE;qBACR;gBACH;gBAEA,OAAO;AACL,oBAAA,QAAQ,EAAE,EAAE;AACZ,oBAAA,IAAI,EAAE,EAAE;AACR,oBAAA,UAAU,EAAE,EAAE;AACd,oBAAA,OAAO,EAAE,QAAQ;AACjB,oBAAA,GAAG,EAAE,EAAE;iBAC2C;YACtD;iBAAO;AACL,gBAAA,MAAM,IAAI,GAAG,MAAM,cAAc,CAC/B,KAAM,EACN,KAAK,CAAC,cAAc,EACpB,QAAQ,CACT;AACD,gBAAA,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,EAAE;AACpC,oBAAA,MAAM,QAAQ,IAAI,MAAM,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAE3D;oBACD,OAAO;AACL,wBAAA,GAAG,IAAI;AACP,wBAAA,GAAG,EAAE,QAAQ,CAAC,GAAG,IAAI,EAAE;qBACxB;gBACH;gBACA,OAAO;AACL,oBAAA,GAAG,IAAI;AACP,oBAAA,GAAG,EAAE,EAAE;iBACR;YACH;QACF,CAAC;AACF,KAAA,CAAC;AACJ;;ACrKA;;AAEG;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"analogjs-content-shiki-highlighter.mjs","sources":["../../../../packages/content/shiki-highlighter/src/index.ts","../../../../packages/content/shiki-highlighter/src/analogjs-content-shiki-highlighter.ts"],"sourcesContent":["import { ContentRenderer, NoopContentRenderer } from '@analogjs/content';\nimport { Provider } from '@angular/core';\nimport type {\n BundledLanguage,\n BundledTheme,\n CodeOptionsMeta,\n CodeOptionsMultipleThemes,\n CodeOptionsSingleTheme,\n CodeToHastOptionsCommon,\n} from 'shiki';\n\nexport type ShikiHighlightOptions = Partial<\n Omit<CodeToHastOptionsCommon<BundledLanguage>, 'lang'>\n> &\n CodeOptionsMeta &\n Partial<CodeOptionsSingleTheme<BundledTheme>> &\n Partial<CodeOptionsMultipleThemes<BundledTheme>>;\n\nexport type WithShikiHighlighterOptions = ShikiHighlightOptions & {\n container?: string;\n};\n\nexport function withShikiHighlighter(\n _opts: WithShikiHighlighterOptions = {},\n): Provider[] {\n return [\n {\n provide: ContentRenderer,\n useClass: NoopContentRenderer,\n },\n ];\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAsBM,SAAU,oBAAoB,CAClC,KAAA,GAAqC,EAAE,EAAA;IAEvC,OAAO;AACL,QAAA;AACE,YAAA,OAAO,EAAE,eAAe;AACxB,YAAA,QAAQ,EAAE,mBAAmB;AAC9B,SAAA;KACF;AACH;;AC/BA;;AAEG;;;;"}