@analogjs/content 3.0.0-beta.6 → 3.0.0-beta.60

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.
@@ -0,0 +1,17 @@
1
+ // packages/content/src/lib/frontmatter-validation-error.ts
2
+ var FrontmatterValidationError = class extends Error {
3
+ constructor(issues, filename) {
4
+ const issueMessages = issues.map((i) => {
5
+ const path = i.path ? ` at "${i.path.map((p) => typeof p === "object" ? p.key : p).join(".")}"` : "";
6
+ return ` - ${i.message}${path}`;
7
+ }).join("\n");
8
+ const prefix = filename ? `"${filename}" f` : "F";
9
+ super(`${prefix}rontmatter validation failed:\n${issueMessages}`);
10
+ this.issues = issues;
11
+ this.filename = filename;
12
+ this.name = "FrontmatterValidationError";
13
+ }
14
+ };
15
+ export { FrontmatterValidationError as t };
16
+
17
+ //# sourceMappingURL=frontmatter-validation-error.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frontmatter-validation-error.mjs","names":[],"sources":["../../src/lib/frontmatter-validation-error.ts"],"sourcesContent":["import type { StandardSchemaV1 } from '@standard-schema/spec';\n\nexport class FrontmatterValidationError extends Error {\n constructor(\n public readonly issues: ReadonlyArray<StandardSchemaV1.Issue>,\n public readonly filename?: string,\n ) {\n const issueMessages = issues\n .map((i) => {\n const path = i.path\n ? ` at \"${i.path.map((p) => (typeof p === 'object' ? p.key : p)).join('.')}\"`\n : '';\n return ` - ${i.message}${path}`;\n })\n .join('\\n');\n const prefix = filename ? `\"${filename}\" f` : 'F';\n super(`${prefix}rontmatter validation failed:\\n${issueMessages}`);\n this.name = 'FrontmatterValidationError';\n }\n}\n"],"mappings":";AAEA,IAAa,6BAAb,cAAgD,MAAK;CACnD,YACkB,QACA,UAAiB;EAEjC,MAAM,gBAAgB,OACnB,KAAK,MAAK;GACT,MAAM,OAAO,EAAE,OACX,QAAQ,EAAE,KAAK,KAAK,MAAO,OAAO,MAAM,WAAW,EAAE,MAAM,CAAE,CAAC,CAAC,KAAK,GAAG,EAAC,KACxE;GACJ,OAAO,OAAO,EAAE,UAAU;EAC5B,CAAC,CAAC,CACD,KAAK,IAAI;EACZ,MAAM,SAAS,WAAW,IAAI,SAAQ,OAAQ;EAC9C,MAAM,GAAG,OAAM,iCAAkC,eAAe;EAZhD,KAAA,SAAA;EACA,KAAA,WAAA;EAYhB,KAAK,OAAO;CACd;AACD"}
@@ -1,18 +1,21 @@
1
+ import { t as FrontmatterValidationError } from "./frontmatter-validation-error.mjs";
1
2
  import fm from "front-matter";
2
- //#region packages/content/src/lib/parse-raw-content-file.ts
3
- var FrontmatterValidationError = class extends Error {
4
- constructor(issues, filename) {
5
- const issueMessages = issues.map((i) => {
6
- const path = i.path ? ` at "${i.path.map((p) => typeof p === "object" ? p.key : p).join(".")}"` : "";
7
- return ` - ${i.message}${path}`;
8
- }).join("\n");
9
- const prefix = filename ? `"${filename}" f` : "F";
10
- super(`${prefix}rontmatter validation failed:\n${issueMessages}`);
11
- this.issues = issues;
12
- this.filename = filename;
13
- this.name = "FrontmatterValidationError";
14
- }
3
+ // \0rolldown/runtime.js
4
+ var __defProp = Object.defineProperty;
5
+ var __exportAll = (all, no_symbols) => {
6
+ let target = {};
7
+ for (var name in all) __defProp(target, name, {
8
+ get: all[name],
9
+ enumerable: true
10
+ });
11
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
12
+ return target;
15
13
  };
14
+ // packages/content/src/lib/parse-raw-content-file.ts
15
+ var parse_raw_content_file_exports = /* @__PURE__ */ __exportAll({
16
+ parseRawContentFile: () => parseRawContentFile,
17
+ parseRawContentFileAsync: () => parseRawContentFileAsync
18
+ });
16
19
  function parseRawContentFile(rawContentFile, schema, filename) {
17
20
  const { body, attributes } = fm(rawContentFile);
18
21
  if (schema) {
@@ -39,7 +42,6 @@ async function parseRawContentFileAsync(rawContentFile, schema, filename) {
39
42
  attributes: result.value
40
43
  };
41
44
  }
42
- //#endregion
43
- export { parseRawContentFile as n, parseRawContentFileAsync as r, FrontmatterValidationError as t };
45
+ export { parseRawContentFileAsync as n, parse_raw_content_file_exports as r, parseRawContentFile as t };
44
46
 
45
47
  //# sourceMappingURL=parse-raw-content-file.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"parse-raw-content-file.mjs","names":[],"sources":["../../src/lib/parse-raw-content-file.ts"],"sourcesContent":["import type { StandardSchemaV1 } from '@standard-schema/spec';\nimport fm from 'front-matter';\n\nexport class FrontmatterValidationError extends Error {\n constructor(\n public readonly issues: ReadonlyArray<StandardSchemaV1.Issue>,\n public readonly filename?: string,\n ) {\n const issueMessages = issues\n .map((i) => {\n const path = i.path\n ? ` at \"${i.path.map((p) => (typeof p === 'object' ? p.key : p)).join('.')}\"`\n : '';\n return ` - ${i.message}${path}`;\n })\n .join('\\n');\n const prefix = filename ? `\"${filename}\" f` : 'F';\n super(`${prefix}rontmatter validation failed:\\n${issueMessages}`);\n this.name = 'FrontmatterValidationError';\n }\n}\n\nexport function parseRawContentFile<\n Attributes extends Record<string, any> = Record<string, any>,\n>(rawContentFile: string): { content: string; attributes: Attributes };\n\nexport function parseRawContentFile<TSchema extends StandardSchemaV1>(\n rawContentFile: string,\n schema: TSchema,\n filename?: string,\n): { content: string; attributes: StandardSchemaV1.InferOutput<TSchema> };\n\nexport function parseRawContentFile(\n rawContentFile: string,\n schema?: StandardSchemaV1,\n filename?: string,\n): { content: string; attributes: unknown } {\n const { body, attributes } = fm(rawContentFile);\n\n if (schema) {\n const result = schema['~standard'].validate(attributes);\n if (\n result != null &&\n typeof (result as PromiseLike<unknown>).then === 'function'\n ) {\n throw new Error(\n 'parseRawContentFile does not support async schema validation. ' +\n 'Use parseRawContentFileAsync() for async schemas.',\n );\n }\n const syncResult = result as StandardSchemaV1.Result<\n StandardSchemaV1.InferOutput<typeof schema>\n >;\n if (syncResult.issues) {\n throw new FrontmatterValidationError(syncResult.issues, filename);\n }\n return { content: body, attributes: syncResult.value };\n }\n\n return { content: body, attributes };\n}\n\nexport async function parseRawContentFileAsync<\n TSchema extends StandardSchemaV1,\n>(\n rawContentFile: string,\n schema: TSchema,\n filename?: string,\n): Promise<{\n content: string;\n attributes: StandardSchemaV1.InferOutput<TSchema>;\n}> {\n const { body, attributes } = fm(rawContentFile);\n const result = await schema['~standard'].validate(attributes);\n if (result.issues) {\n throw new FrontmatterValidationError(result.issues, filename);\n }\n return { content: body, attributes: result.value };\n}\n"],"mappings":";;AAGA,IAAa,6BAAb,cAAgD,MAAK;CACnD,YACkB,QACA,UAAiB;EAEjC,MAAM,gBAAgB,OACnB,KAAK,MAAK;GACT,MAAM,OAAO,EAAE,OACX,QAAQ,EAAE,KAAK,KAAK,MAAO,OAAO,MAAM,WAAW,EAAE,MAAM,CAAE,CAAC,CAAC,KAAK,GAAG,EAAC,KACxE;GACJ,OAAO,OAAO,EAAE,UAAU;EAC5B,CAAC,CAAC,CACD,KAAK,IAAI;EACZ,MAAM,SAAS,WAAW,IAAI,SAAQ,OAAQ;EAC9C,MAAM,GAAG,OAAM,iCAAkC,eAAe;EAZhD,KAAA,SAAA;EACA,KAAA,WAAA;EAYhB,KAAK,OAAO;CACd;AACD;AAYD,SAAgB,oBACd,gBACA,QACA,UAAiB;CAEjB,MAAM,EAAE,MAAM,eAAe,GAAG,cAAc;CAE9C,IAAI,QAAQ;EACV,MAAM,SAAS,OAAO,YAAY,CAAC,SAAS,UAAU;EACtD,IACE,UAAU,QACV,OAAQ,OAAgC,SAAS,YAEjD,MAAM,IAAI,MACR,iHACqD;EAGzD,MAAM,aAAa;EAGnB,IAAI,WAAW,QACb,MAAM,IAAI,2BAA2B,WAAW,QAAQ,QAAQ;EAElE,OAAO;GAAE,SAAS;GAAM,YAAY,WAAW;EAAK;CACtD;CAEA,OAAO;EAAE,SAAS;EAAM;CAAU;AACpC;AAEA,eAAsB,yBAGpB,gBACA,QACA,UAAiB;CAKjB,MAAM,EAAE,MAAM,eAAe,GAAG,cAAc;CAC9C,MAAM,SAAS,MAAM,OAAO,YAAY,CAAC,SAAS,UAAU;CAC5D,IAAI,OAAO,QACT,MAAM,IAAI,2BAA2B,OAAO,QAAQ,QAAQ;CAE9D,OAAO;EAAE,SAAS;EAAM,YAAY,OAAO;CAAK;AAClD"}
1
+ {"version":3,"file":"parse-raw-content-file.mjs","names":[],"sources":["../../src/lib/parse-raw-content-file.ts"],"sourcesContent":["import type { StandardSchemaV1 } from '@standard-schema/spec';\nimport fm from 'front-matter';\n\nimport { FrontmatterValidationError } from './frontmatter-validation-error';\n\nexport { FrontmatterValidationError };\n\nexport function parseRawContentFile<\n Attributes extends Record<string, any> = Record<string, any>,\n>(rawContentFile: string): { content: string; attributes: Attributes };\n\nexport function parseRawContentFile<TSchema extends StandardSchemaV1>(\n rawContentFile: string,\n schema: TSchema,\n filename?: string,\n): { content: string; attributes: StandardSchemaV1.InferOutput<TSchema> };\n\nexport function parseRawContentFile(\n rawContentFile: string,\n schema?: StandardSchemaV1,\n filename?: string,\n): { content: string; attributes: unknown } {\n const { body, attributes } = fm(rawContentFile);\n\n if (schema) {\n const result = schema['~standard'].validate(attributes);\n if (\n result != null &&\n typeof (result as PromiseLike<unknown>).then === 'function'\n ) {\n throw new Error(\n 'parseRawContentFile does not support async schema validation. ' +\n 'Use parseRawContentFileAsync() for async schemas.',\n );\n }\n const syncResult = result as StandardSchemaV1.Result<\n StandardSchemaV1.InferOutput<typeof schema>\n >;\n if (syncResult.issues) {\n throw new FrontmatterValidationError(syncResult.issues, filename);\n }\n return { content: body, attributes: syncResult.value };\n }\n\n return { content: body, attributes };\n}\n\nexport async function parseRawContentFileAsync<\n TSchema extends StandardSchemaV1,\n>(\n rawContentFile: string,\n schema: TSchema,\n filename?: string,\n): Promise<{\n content: string;\n attributes: StandardSchemaV1.InferOutput<TSchema>;\n}> {\n const { body, attributes } = fm(rawContentFile);\n const result = await schema['~standard'].validate(attributes);\n if (result.issues) {\n throw new FrontmatterValidationError(result.issues, filename);\n }\n return { content: body, attributes: result.value };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,SAAgB,oBACd,gBACA,QACA,UAAiB;CAEjB,MAAM,EAAE,MAAM,eAAe,GAAG,cAAc;CAE9C,IAAI,QAAQ;EACV,MAAM,SAAS,OAAO,YAAY,CAAC,SAAS,UAAU;EACtD,IACE,UAAU,QACV,OAAQ,OAAgC,SAAS,YAEjD,MAAM,IAAI,MACR,iHACqD;EAGzD,MAAM,aAAa;EAGnB,IAAI,WAAW,QACb,MAAM,IAAI,2BAA2B,WAAW,QAAQ,QAAQ;EAElE,OAAO;GAAE,SAAS;GAAM,YAAY,WAAW;EAAK;CACtD;CAEA,OAAO;EAAE,SAAS;EAAM;CAAU;AACpC;AAEA,eAAsB,yBAGpB,gBACA,QACA,UAAiB;CAKjB,MAAM,EAAE,MAAM,eAAe,GAAG,cAAc;CAC9C,MAAM,SAAS,MAAM,OAAO,YAAY,CAAC,SAAS,UAAU;CAC5D,IAAI,OAAO,QACT,MAAM,IAAI,2BAA2B,OAAO,QAAQ,QAAQ;CAE9D,OAAO;EAAE,SAAS;EAAM,YAAY,OAAO;CAAK;AAClD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@analogjs/content",
3
- "version": "3.0.0-beta.6",
3
+ "version": "3.0.0-beta.60",
4
4
  "description": "Content Rendering for Analog",
5
5
  "type": "module",
6
6
  "author": "Brandon Roberts <robertsbt@gmail.com>",
@@ -27,14 +27,14 @@
27
27
  "@angular/core": "^20.0.0 || ^21.0.0 || ^22.0.0",
28
28
  "@angular/platform-browser": "^20.0.0 || ^21.0.0 || ^22.0.0",
29
29
  "@angular/router": "^20.0.0 || ^21.0.0 || ^22.0.0",
30
- "@nx/devkit": "^23.2.0",
30
+ "@nx/devkit": "^21.2.0 || ^22.0.0 || ^23.0.0 || ^24.0.0",
31
31
  "front-matter": "^4.0.2",
32
32
  "rxjs": "^6.5.0 || ^7.5.0",
33
33
  "@standard-schema/spec": "^1.1.0",
34
34
  "satori": "^0.10.14",
35
35
  "satori-html": "^0.3.2",
36
36
  "sharp": "^0.34.5",
37
- "md4x": ">=0.0.20"
37
+ "md4x": ">=0.0.29"
38
38
  },
39
39
  "peerDependenciesMeta": {
40
40
  "@nx/devkit": {
@@ -87,11 +87,13 @@
87
87
  }
88
88
  },
89
89
  "dependencies": {
90
+ "entities": "^8.0.0",
90
91
  "tslib": "^2.3.0"
91
92
  },
92
93
  "devDependencies": {
93
- "@analogjs/vite-plugin-angular": "3.0.0-beta.6",
94
- "@analogjs/vitest-angular": "3.0.0-beta.6"
94
+ "@analogjs/vite-plugin-angular": "3.0.0-beta.60",
95
+ "@analogjs/vitest-angular": "3.0.0-beta.60",
96
+ "@nx/devkit": "24.0.0"
95
97
  },
96
98
  "ng-update": {
97
99
  "packageGroup": [
@@ -0,0 +1,10 @@
1
+ interface ParsedNode {
2
+ type: string;
3
+ props: {
4
+ children?: ParsedChild | ParsedChild[];
5
+ [prop: string]: unknown;
6
+ };
7
+ }
8
+ type ParsedChild = string | ParsedNode;
9
+ export declare function parseHtml(element: string): ParsedNode;
10
+ export {};
@@ -8,7 +8,10 @@ export type { InjectContentFilesFilterFunction } from './lib/inject-content-file
8
8
  export { provideContent, withMarkdownRenderer } from './lib/provide-content';
9
9
  export { default as MarkdownRouteComponent } from './lib/markdown-route.component';
10
10
  export { default as MarkdownComponent } from './lib/markdown.component';
11
- export { parseRawContentFile, parseRawContentFileAsync, FrontmatterValidationError, } from './lib/parse-raw-content-file';
11
+ export { parseRawContentFile, parseRawContentFileAsync, } from './lib/parse-raw-content-file';
12
+ export { FrontmatterValidationError } from './lib/frontmatter-validation-error';
13
+ export { parseContentFile } from './lib/parse-content-file';
14
+ export type { ContentFileLoader, ContentFileModule, } from './lib/parse-content-file';
12
15
  export { injectContentFilesMap } from './lib/inject-content-files';
13
16
  export { injectContentListLoader, withContentListLoader, CONTENT_LIST_LOADER, } from './lib/content-list-loader';
14
17
  export { injectContentFileLoader, withContentFileLoader, CONTENT_FILE_LOADER, } from './lib/content-file-loader';
@@ -1,9 +1,10 @@
1
1
  import * as i0 from "@angular/core";
2
2
  export declare class AnchorNavigationDirective {
3
3
  private readonly document;
4
+ private readonly host;
4
5
  private readonly location;
5
6
  private readonly router;
6
- handleNavigation(element: EventTarget | null): boolean;
7
+ handleNavigation(target: EventTarget | null, event?: MouseEvent): boolean;
7
8
  static ɵfac: i0.ɵɵFactoryDeclaration<AnchorNavigationDirective, never>;
8
9
  static ɵdir: i0.ɵɵDirectiveDeclaration<AnchorNavigationDirective, "[analogAnchorNavigation]", never, {}, {}, never, never, true, never>;
9
10
  }
@@ -1,5 +1,6 @@
1
1
  import { InjectionToken, Provider } from '@angular/core';
2
- type ContentFileLoaderFunction = () => Promise<Record<string, () => Promise<string>>>;
2
+ import type { ContentFileLoader } from './parse-content-file';
3
+ type ContentFileLoaderFunction = () => Promise<Record<string, ContentFileLoader>>;
3
4
  export declare const CONTENT_FILE_LOADER: InjectionToken<ContentFileLoaderFunction>;
4
5
  export declare function injectContentFileLoader(): ContentFileLoaderFunction;
5
6
  export declare function withContentFileLoader(): Provider;
@@ -1,3 +1,4 @@
1
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>>>>;
2
+ import type { ContentFileLoader } from './parse-content-file';
3
+ export declare const CONTENT_FILES_TOKEN: InjectionToken<Record<string, ContentFileLoader>>;
4
+ export declare const CONTENT_FILES_MAP_TOKEN: InjectionToken<Signal<Record<string, ContentFileLoader>>>;
@@ -0,0 +1,6 @@
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
+ }
@@ -1,3 +1,4 @@
1
+ import type { ContentFileLoader } from './parse-content-file';
1
2
  /**
2
3
  * These bindings are rewritten at build time:
3
4
  * - `ANALOG_CONTENT_FILE_LIST` by `@analogjs/platform`'s content plugin,
@@ -26,4 +27,4 @@ export declare const getContentFilesList: () => Record<string, Record<string, an
26
27
  /**
27
28
  * Returns the lazy loaded content files for lookups.
28
29
  */
29
- export declare const getContentFiles: () => Record<string, () => Promise<string>>;
30
+ export declare const getContentFiles: () => Record<string, ContentFileLoader>;
@@ -1,4 +1,5 @@
1
1
  import { ContentFile } from './content-file';
2
+ import type { ContentFileLoader } from './parse-content-file';
2
3
  export declare function injectContentFiles<Attributes extends Record<string, any>>(filterFn?: InjectContentFilesFilterFunction<Attributes>): ContentFile<Attributes>[];
3
4
  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>>;
5
+ export declare function injectContentFilesMap(): Record<string, ContentFileLoader>;
@@ -0,0 +1,14 @@
1
+ export type ContentFileModule<Attributes extends Record<string, any> = Record<string, any>> = {
2
+ default: string;
3
+ metadata: Attributes;
4
+ };
5
+ export type ContentFileLoader = () => Promise<string | ContentFileModule>;
6
+ /**
7
+ * Reads a loaded content file. Build-time content modules carry their
8
+ * frontmatter as `metadata`; raw strings from custom loaders are parsed
9
+ * with a lazily loaded frontmatter parser.
10
+ */
11
+ export declare function parseContentFile<Attributes extends Record<string, any> = Record<string, any>>(file: string | ContentFileModule): Promise<{
12
+ content: string;
13
+ attributes: Attributes;
14
+ }>;
@@ -1,9 +1,6 @@
1
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
- }
2
+ import { FrontmatterValidationError } from './frontmatter-validation-error';
3
+ export { FrontmatterValidationError };
7
4
  export declare function parseRawContentFile<Attributes extends Record<string, any> = Record<string, any>>(rawContentFile: string): {
8
5
  content: string;
9
6
  attributes: Attributes;
@@ -1,8 +1,8 @@
1
1
  import * as i0 from "@angular/core";
2
2
  export declare class RenderTaskService {
3
3
  #private;
4
- addRenderTask(): number;
5
- clearRenderTask(clear: number | (() => void)): void;
4
+ addRenderTask(): () => void;
5
+ clearRenderTask(clear: () => void): void;
6
6
  static ɵfac: i0.ɵɵFactoryDeclaration<RenderTaskService, never>;
7
7
  static ɵprov: i0.ɵɵInjectableDeclaration<any>;
8
8
  }