@fifthbell/brokaw 0.1.63 → 0.1.66

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 (112) hide show
  1. package/README.md +64 -3
  2. package/dist/components/live-program/LiveProgram.d.ts +1 -1
  3. package/dist/components/live-program/LiveProgram.js +56 -48
  4. package/dist/components/live-program/hooks/useSSE.d.ts +4 -2
  5. package/dist/components/live-program/hooks/useSSE.js +12 -4
  6. package/dist/components/live-program/program-contract.d.ts +50 -0
  7. package/dist/components/live-program/program-contract.js +140 -0
  8. package/dist/cronkite-manifest.d.ts +80 -0
  9. package/dist/cronkite-manifest.js +124 -0
  10. package/dist/cronkite-manifest.json +139 -0
  11. package/dist/json-schema-formats.d.ts +2 -0
  12. package/dist/json-schema-formats.js +19 -0
  13. package/dist/layouts.d.ts +13 -0
  14. package/dist/layouts.js +12 -0
  15. package/dist/live-program/main.d.ts +8 -0
  16. package/dist/live-program/main.js +5 -1
  17. package/dist/live-program-page/fifthbell/fonts/LDIcapOFNxEwR-Bd1O9uYNmnUQomAgE25imKSbHhROjLsZBWTSrQGD_jZtU.ttf +0 -0
  18. package/dist/live-program-page/fifthbell/fonts/LDIcapOFNxEwR-Bd1O9uYNmnUQomAgE25imKSbHhROjLsZBWTSrQGFPjZtU.ttf +0 -0
  19. package/dist/live-program-page/fifthbell/fonts/LDIcapOFNxEwR-Bd1O9uYNmnUQomAgE25imKSbHhROjLsZBWTSrQGGHiZtU.ttf +0 -0
  20. package/dist/live-program-page/fifthbell/fonts/LDIcapOFNxEwR-Bd1O9uYNmnUQomAgE25imKSbHhROjLsZBWTSrQGGHjZtU.ttf +0 -0
  21. package/dist/live-program-page/fifthbell/fonts/LDIcapOFNxEwR-Bd1O9uYNmnUQomAgE25imKSbHhROjLsZBWTSrQGIbkZtU.ttf +0 -0
  22. package/dist/live-program-page/fifthbell/fonts/LDIcapOFNxEwR-Bd1O9uYNmnUQomAgE25imKSbHhROjLsZBWTSrQGL_kZtU.ttf +0 -0
  23. package/dist/live-program-page/fifthbell/fonts/LDIcapOFNxEwR-Bd1O9uYNmnUQomAgE25imKSbHhROjLsZBWTSrQGMjkZtU.ttf +0 -0
  24. package/dist/live-program-page/fifthbell/fonts/LDIcapOFNxEwR-Bd1O9uYNmnUQomAgE25imKSbHhROjLsZBWTSrQGOHjZtU.ttf +0 -0
  25. package/dist/live-program-page/fifthbell/fonts/LDIcapOFNxEwR-Bd1O9uYNmnUQomAgE25imKSbHhROjLsZBWTSrQGOHkZtU.ttf +0 -0
  26. package/dist/live-program-page/fifthbell/fonts/SlGDmQSNjdsmc35JDF1K5E55YMjF_7DPuGi-2fRUAw.ttf +0 -0
  27. package/dist/live-program-page/fifthbell/fonts/SlGDmQSNjdsmc35JDF1K5E55YMjF_7DPuGi-6_RUAw.ttf +0 -0
  28. package/dist/live-program-page/fifthbell/fonts/SlGDmQSNjdsmc35JDF1K5E55YMjF_7DPuGi-DPNUAw.ttf +0 -0
  29. package/dist/live-program-page/fifthbell/fonts/SlGDmQSNjdsmc35JDF1K5E55YMjF_7DPuGi-NfNUAw.ttf +0 -0
  30. package/dist/live-program-page/fifthbell/fonts/SlGDmQSNjdsmc35JDF1K5E55YMjF_7DPuGi-a_NUAw.ttf +0 -0
  31. package/dist/live-program-page/fifthbell/fonts/SlGFmQSNjdsmc35JDF1K5GRwUjcdlttVFm-rI7c8R496.ttf +0 -0
  32. package/dist/live-program-page/fifthbell/fonts/SlGFmQSNjdsmc35JDF1K5GRwUjcdlttVFm-rI7dbR496.ttf +0 -0
  33. package/dist/live-program-page/fifthbell/fonts/SlGFmQSNjdsmc35JDF1K5GRwUjcdlttVFm-rI7diR496.ttf +0 -0
  34. package/dist/live-program-page/fifthbell/fonts/SlGFmQSNjdsmc35JDF1K5GRwUjcdlttVFm-rI7e8QI96.ttf +0 -0
  35. package/dist/live-program-page/fifthbell/fonts/SlGFmQSNjdsmc35JDF1K5GRwUjcdlttVFm-rI7eOQI96.ttf +0 -0
  36. package/dist/live-program-page/fifthbell/fonts/TK3_WkUHHAIjg75cFRf3bXL8LICs13FvgUE.ttf +0 -0
  37. package/dist/live-program-page/fifthbell/fonts/TK3_WkUHHAIjg75cFRf3bXL8LICs169vgUE.ttf +0 -0
  38. package/dist/live-program-page/fifthbell/fonts/TK3_WkUHHAIjg75cFRf3bXL8LICs18NvgUE.ttf +0 -0
  39. package/dist/live-program-page/fifthbell/fonts/TK3_WkUHHAIjg75cFRf3bXL8LICs1_FvgUE.ttf +0 -0
  40. package/dist/live-program-page/fifthbell/fonts/TK3_WkUHHAIjg75cFRf3bXL8LICs1xZogUE.ttf +0 -0
  41. package/dist/live-program-page/fifthbell/fonts/TK3_WkUHHAIjg75cFRf3bXL8LICs1y9ogUE.ttf +0 -0
  42. package/dist/live-program-page/fifthbell/fonts/j8_16_LD37rqfuwxyIuaZhE6cRXOLtm2gfTGgQ.ttf +0 -0
  43. package/dist/live-program-page/fifthbell/fonts/j8_46_LD37rqfuwxyIuaZhE6cRXOLtm2gfT-BYipBw.ttf +0 -0
  44. package/dist/live-program-page/fifthbell/fonts/j8_46_LD37rqfuwxyIuaZhE6cRXOLtm2gfT-IYmpBw.ttf +0 -0
  45. package/dist/live-program-page/fifthbell/fonts/j8_46_LD37rqfuwxyIuaZhE6cRXOLtm2gfT-PYqpBw.ttf +0 -0
  46. package/dist/live-program-page/fifthbell/fonts/j8_46_LD37rqfuwxyIuaZhE6cRXOLtm2gfT-WYupBw.ttf +0 -0
  47. package/dist/live-program-page/fifthbell/fonts/jizMREVItHgc8qDIbSTKq4XkRiUawTk7f45UM9y05oYiRNDM.ttf +0 -0
  48. package/dist/live-program-page/fifthbell/fonts/jizMREVItHgc8qDIbSTKq4XkRiUawTk7f45UM9y05oZ8RNDM.ttf +0 -0
  49. package/dist/live-program-page/fifthbell/fonts/jizMREVItHgc8qDIbSTKq4XkRiUawTk7f45UM9y05oZ8RdDM.ttf +0 -0
  50. package/dist/live-program-page/fifthbell/fonts/jizMREVItHgc8qDIbSTKq4XkRiUawTk7f45UM9y05oZORNDM.ttf +0 -0
  51. package/dist/live-program-page/fifthbell/fonts/jizMREVItHgc8qDIbSTKq4XkRiUawTk7f45UM9y05oabQ9DM.ttf +0 -0
  52. package/dist/live-program-page/fifthbell/fonts/jizMREVItHgc8qDIbSTKq4XkRiUawTk7f45UM9y05oaiQ9DM.ttf +0 -0
  53. package/dist/live-program-page/fifthbell/fonts/jizMREVItHgc8qDIbSTKq4XkRiUawTk7f45UM9y05ob8Q9DM.ttf +0 -0
  54. package/dist/live-program-page/fifthbell/fonts/jizMREVItHgc8qDIbSTKq4XkRiUawTk7f45UM9y05ob8RNDM.ttf +0 -0
  55. package/dist/live-program-page/fifthbell/fonts/jizMREVItHgc8qDIbSTKq4XkRiUawTk7f45UM9y05obVQ9DM.ttf +0 -0
  56. package/dist/live-program-page/fifthbell/fonts/jizOREVItHgc8qDIbSTKq4XkRg8T88bjFuXOnduh8MKUBw.ttf +0 -0
  57. package/dist/live-program-page/fifthbell/fonts/jizOREVItHgc8qDIbSTKq4XkRg8T88bjFuXOnduhHMWUBw.ttf +0 -0
  58. package/dist/live-program-page/fifthbell/fonts/jizOREVItHgc8qDIbSTKq4XkRg8T88bjFuXOnduhLsSUBw.ttf +0 -0
  59. package/dist/live-program-page/fifthbell/fonts/jizOREVItHgc8qDIbSTKq4XkRg8T88bjFuXOnduhLsWUBw.ttf +0 -0
  60. package/dist/live-program-page/fifthbell/fonts/jizOREVItHgc8qDIbSTKq4XkRg8T88bjFuXOnduhcMWUBw.ttf +0 -0
  61. package/dist/live-program-page/fifthbell/fonts/jizOREVItHgc8qDIbSTKq4XkRg8T88bjFuXOnduhh8KUBw.ttf +0 -0
  62. package/dist/live-program-page/fifthbell/fonts/jizOREVItHgc8qDIbSTKq4XkRg8T88bjFuXOnduhrsKUBw.ttf +0 -0
  63. package/dist/live-program-page/fifthbell/fonts/jizOREVItHgc8qDIbSTKq4XkRg8T88bjFuXOnduhrsWUBw.ttf +0 -0
  64. package/dist/live-program-page/fifthbell/fonts/jizOREVItHgc8qDIbSTKq4XkRg8T88bjFuXOnduhycKUBw.ttf +0 -0
  65. package/dist/live-program-page/index.html +2 -5
  66. package/dist/live-program-page/live-program-manifest.json +408 -0
  67. package/dist/live-program-page/live-program.v0.1.66.css +3 -0
  68. package/dist/live-program-page/live-program.v0.1.66.js +76 -0
  69. package/dist/live-program-release.d.ts +3 -0
  70. package/dist/live-program-release.js +76 -0
  71. package/dist/manifest-validation.d.ts +10 -0
  72. package/dist/manifest-validation.js +27 -0
  73. package/dist/program-template-manifest.d.ts +22 -0
  74. package/dist/program-template-manifest.js +49 -0
  75. package/dist/renderer.browser.js +5 -1
  76. package/dist/renderer.core.d.ts +2 -1
  77. package/dist/renderer.core.js +4 -1
  78. package/dist/renderer.d.ts +6 -0
  79. package/dist/renderer.js +3 -0
  80. package/dist/renderer.node.js +16 -14
  81. package/dist/rum.d.ts +18 -0
  82. package/dist/rum.js +113 -0
  83. package/dist/schemas/canonical-document.schema.json +1071 -0
  84. package/dist/schemas/cronkite-manifest.schema.json +501 -0
  85. package/dist/schemas/feed-renderable-input.schema.json +16 -0
  86. package/dist/schemas/live-program-release-input.schema.json +34 -0
  87. package/dist/types/canonical-article.d.ts +8 -254
  88. package/dist/types/canonical-article.js +21 -242
  89. package/dist/types/canonical-document-schema.generated.d.ts +1634 -0
  90. package/dist/types/canonical-document-schema.generated.js +1730 -0
  91. package/dist/types/canonical-document.generated.d.ts +541 -0
  92. package/dist/types/canonical-document.generated.js +3 -0
  93. package/dist/types/cronkite-manifest.generated.d.ts +339 -0
  94. package/dist/types/cronkite-manifest.generated.js +3 -0
  95. package/dist/types/live-program-release-input.generated.d.ts +5 -0
  96. package/dist/types/live-program-release-input.generated.js +3 -0
  97. package/dist/video/Root.d.ts +1 -0
  98. package/dist/video/Root.js +40 -0
  99. package/dist/video/ShortVideo.d.ts +3 -0
  100. package/dist/video/ShortVideo.js +92 -0
  101. package/dist/video/index.d.ts +2 -0
  102. package/dist/video/index.js +4 -0
  103. package/dist/video/types.d.ts +37 -0
  104. package/dist/video/types.js +1 -0
  105. package/package.json +19 -4
  106. package/src/styles/compiled.css +1 -1
  107. package/src/templates/layouts/standalone-page.hbs +5 -0
  108. package/src/templates/partials/components/standalone-main.hbs +28 -0
  109. package/src/templates/partials/shell/doc-start-404.hbs +1 -14
  110. package/src/templates/partials/shell/doc-start-standard.hbs +1 -14
  111. package/dist/live-program-page/live-program.css +0 -3
  112. package/dist/live-program-page/live-program.js +0 -76
@@ -0,0 +1,3 @@
1
+ import { type LiveProgramFileEntry } from "./renderer.node.js";
2
+ import type { FifthbellLiveProgramReleaseInput } from "./types/live-program-release-input.generated.js";
3
+ export declare function liveProgramReleaseFiles(input: FifthbellLiveProgramReleaseInput): LiveProgramFileEntry[];
@@ -0,0 +1,76 @@
1
+ import { liveProgramPageFiles, } from "./renderer.node.js";
2
+ import { version } from "./version.js";
3
+ const PROGRAM_ID = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
4
+ function validateInput(input) {
5
+ if (!input || typeof input !== "object" || Array.isArray(input)) {
6
+ throw new Error("live-program release input must be an object");
7
+ }
8
+ const values = input;
9
+ const keys = Object.keys(values).sort();
10
+ if (keys.join(",") !== "apiBaseUrl,programId") {
11
+ throw new Error("live-program release input requires only apiBaseUrl and programId");
12
+ }
13
+ if (typeof values.programId !== "string" ||
14
+ !PROGRAM_ID.test(values.programId) ||
15
+ values.programId.length > 128) {
16
+ throw new Error("live-program programId is invalid");
17
+ }
18
+ if (typeof values.apiBaseUrl !== "string") {
19
+ throw new Error("live-program apiBaseUrl must be an absolute URL");
20
+ }
21
+ let apiBaseUrl;
22
+ try {
23
+ apiBaseUrl = new URL(values.apiBaseUrl);
24
+ }
25
+ catch {
26
+ throw new Error("live-program apiBaseUrl must be an absolute URL");
27
+ }
28
+ const localHttp = apiBaseUrl.protocol === "http:" &&
29
+ (apiBaseUrl.hostname === "localhost" ||
30
+ apiBaseUrl.hostname === "127.0.0.1");
31
+ if ((apiBaseUrl.protocol !== "https:" && !localHttp) ||
32
+ apiBaseUrl.username ||
33
+ apiBaseUrl.password ||
34
+ apiBaseUrl.search ||
35
+ apiBaseUrl.hash) {
36
+ throw new Error("live-program apiBaseUrl must use HTTPS outside local development and cannot contain credentials, query parameters, or a fragment");
37
+ }
38
+ return {
39
+ programId: values.programId,
40
+ apiBaseUrl: values.apiBaseUrl.replace(/\/$/, ""),
41
+ };
42
+ }
43
+ function configureCanonicalDocument(html, releasePrefix, input) {
44
+ const head = html.match(/<head(?:\s[^>]*)?>/i)?.[0];
45
+ if (!head)
46
+ throw new Error("live-program index.html is missing <head>");
47
+ const runtimeConfig = JSON.stringify(input)
48
+ .replaceAll("<", "\\u003c")
49
+ .replaceAll("\u2028", "\\u2028")
50
+ .replaceAll("\u2029", "\\u2029");
51
+ const injection = [
52
+ `<base href="./${releasePrefix}/">`,
53
+ `<script>window.__FIFTHBELL_LIVE_PROGRAM_CONFIG__=${runtimeConfig};</script>`,
54
+ ].join("\n ");
55
+ return html.replace(head, `${head}\n ${injection}`);
56
+ }
57
+ export function liveProgramReleaseFiles(input) {
58
+ const validated = validateInput(input);
59
+ const bundleFiles = liveProgramPageFiles();
60
+ const index = bundleFiles.find((file) => file.key === "index.html");
61
+ if (!index)
62
+ throw new Error("live-program bundle is missing index.html");
63
+ const relativeReleasePrefix = `live-program.v${version}`;
64
+ const releasePrefix = `html/${relativeReleasePrefix}`;
65
+ return [
66
+ ...bundleFiles.map((file) => ({
67
+ ...file,
68
+ key: `${releasePrefix}/${file.key}`,
69
+ })),
70
+ {
71
+ key: "html/program.html",
72
+ body: Buffer.from(configureCanonicalDocument(index.body.toString("utf8"), relativeReleasePrefix, validated)),
73
+ contentType: index.contentType,
74
+ },
75
+ ];
76
+ }
@@ -0,0 +1,10 @@
1
+ import type { CronkiteCLSManifest } from "./types/cronkite-manifest.generated.js";
2
+ export type ManifestAlignmentSources = {
3
+ layouts: readonly string[];
4
+ languages: readonly string[];
5
+ defaultLanguage: string;
6
+ packageName: string;
7
+ packageVersion: string;
8
+ exportedVersion: string;
9
+ };
10
+ export declare function assertManifestAlignment(manifest: CronkiteCLSManifest, sources: ManifestAlignmentSources): void;
@@ -0,0 +1,27 @@
1
+ function assertSameOrderedValues(label, manifestValues, sourceValues) {
2
+ if (manifestValues.length !== sourceValues.length ||
3
+ manifestValues.some((value, index) => value !== sourceValues[index])) {
4
+ throw new Error(`${label} drift: manifest=${JSON.stringify(manifestValues)} source=${JSON.stringify(sourceValues)}`);
5
+ }
6
+ }
7
+ export function assertManifestAlignment(manifest, sources) {
8
+ assertSameOrderedValues("layout", manifest.layouts, sources.layouts);
9
+ assertSameOrderedValues("language", manifest.languages, sources.languages);
10
+ if (manifest.package !== sources.packageName ||
11
+ manifest.version !== sources.packageVersion ||
12
+ manifest.version !== sources.exportedVersion) {
13
+ throw new Error(`package identity drift: manifest=${manifest.package}@${manifest.version} package=${sources.packageName}@${sources.packageVersion} export=${sources.exportedVersion}`);
14
+ }
15
+ if (!manifest.languages.includes(sources.defaultLanguage)) {
16
+ throw new Error("outletConfig.defaultLanguage is not declared by the manifest");
17
+ }
18
+ for (const page of manifest.systemPages ?? []) {
19
+ if (!manifest.layouts.includes(page.layout)) {
20
+ throw new Error(`system page uses undeclared layout: ${page.layout}`);
21
+ }
22
+ const expectedLanguages = page.perLanguage
23
+ ? manifest.languages
24
+ : [sources.defaultLanguage];
25
+ assertSameOrderedValues(`system page ${page.layout} copy`, Object.keys(page.copy).sort(), [...expectedLanguages].sort());
26
+ }
27
+ }
@@ -0,0 +1,22 @@
1
+ export declare const PROGRAM_TEMPLATE_KIND = "alcantara.program-template";
2
+ export declare const PROGRAM_TEMPLATE_CONTRACT_VERSION = 1;
3
+ export declare const liveProgramTemplateContract: {
4
+ readonly kind: "alcantara.program-template";
5
+ readonly contractVersion: 1;
6
+ readonly id: "fifthbell.live-program";
7
+ readonly name: "Fifthbell Live Program";
8
+ readonly entrypoint: "index.html";
9
+ readonly capabilities: readonly ["audio.mixing", "audio.playback", "media.groups", "program.reload", "scene.activation", "scene.configuration", "scene.staging", "stinger.transitions"];
10
+ readonly control: {
11
+ readonly protocol: "alcantara.program.v1";
12
+ readonly transport: "server-sent-events";
13
+ readonly snapshotPath: "state";
14
+ readonly eventsPath: "events";
15
+ readonly runtimeParameters: {
16
+ readonly programId: "programId";
17
+ readonly apiBaseUrl: "apiBaseUrl";
18
+ };
19
+ readonly signals: readonly ["audio_bus_update", "broadcast_settings_update", "heartbeat", "instant_play", "instant_stop_all", "program_media_groups_changed", "program_reload", "program_scenes_changed", "program_state_snapshot", "program_stingers_changed", "scene_change", "scene_cleared", "scene_instant_state", "scene_instant_stop", "scene_instant_take", "scene_staged", "scene_update", "song_off_air"];
20
+ };
21
+ };
22
+ export type ProgramTemplateContract = typeof liveProgramTemplateContract;
@@ -0,0 +1,49 @@
1
+ export const PROGRAM_TEMPLATE_KIND = "alcantara.program-template";
2
+ export const PROGRAM_TEMPLATE_CONTRACT_VERSION = 1;
3
+ export const liveProgramTemplateContract = {
4
+ kind: PROGRAM_TEMPLATE_KIND,
5
+ contractVersion: PROGRAM_TEMPLATE_CONTRACT_VERSION,
6
+ id: "fifthbell.live-program",
7
+ name: "Fifthbell Live Program",
8
+ entrypoint: "index.html",
9
+ capabilities: [
10
+ "audio.mixing",
11
+ "audio.playback",
12
+ "media.groups",
13
+ "program.reload",
14
+ "scene.activation",
15
+ "scene.configuration",
16
+ "scene.staging",
17
+ "stinger.transitions",
18
+ ],
19
+ control: {
20
+ protocol: "alcantara.program.v1",
21
+ transport: "server-sent-events",
22
+ snapshotPath: "state",
23
+ eventsPath: "events",
24
+ runtimeParameters: {
25
+ programId: "programId",
26
+ apiBaseUrl: "apiBaseUrl",
27
+ },
28
+ signals: [
29
+ "audio_bus_update",
30
+ "broadcast_settings_update",
31
+ "heartbeat",
32
+ "instant_play",
33
+ "instant_stop_all",
34
+ "program_media_groups_changed",
35
+ "program_reload",
36
+ "program_scenes_changed",
37
+ "program_state_snapshot",
38
+ "program_stingers_changed",
39
+ "scene_change",
40
+ "scene_cleared",
41
+ "scene_instant_state",
42
+ "scene_instant_stop",
43
+ "scene_instant_take",
44
+ "scene_staged",
45
+ "scene_update",
46
+ "song_off_air",
47
+ ],
48
+ },
49
+ };
@@ -6,6 +6,7 @@ import notFoundLayoutHbs from './templates/layouts/404.hbs?raw';
6
6
  import liveStoryLayoutHbs from './templates/layouts/live-story.hbs?raw';
7
7
  import linkInBioLayoutHbs from './templates/layouts/link-in-bio.hbs?raw';
8
8
  import mediaPageLayoutHbs from './templates/layouts/media-page.hbs?raw';
9
+ import standalonePageLayoutHbs from './templates/layouts/standalone-page.hbs?raw';
9
10
  import headerMainHbs from './templates/partials/headers/header-main.hbs?raw';
10
11
  import headerMinimalHbs from './templates/partials/headers/header-minimal.hbs?raw';
11
12
  import footerFullHbs from './templates/partials/footers/footer-full.hbs?raw';
@@ -29,6 +30,7 @@ import blockInstagramHbs from './templates/partials/blocks/instagram.hbs?raw';
29
30
  import blockTikTokHbs from './templates/partials/blocks/tiktok.hbs?raw';
30
31
  import blockPullQuoteHbs from './templates/partials/blocks/pull-quote.hbs?raw';
31
32
  import componentArticleMainHbs from './templates/partials/components/article-main.hbs?raw';
33
+ import standaloneMainHbs from './templates/partials/components/standalone-main.hbs?raw';
32
34
  import componentBreakingNewsHbs from './templates/partials/components/breaking-news.hbs?raw';
33
35
  import componentBreakingNewsLiveUpdatesColumnHbs from './templates/partials/components/breaking-news/live-updates-column.hbs?raw';
34
36
  import componentSnackHbs from './templates/partials/components/snack.hbs?raw';
@@ -68,7 +70,8 @@ const assets = {
68
70
  '404': notFoundLayoutHbs,
69
71
  'live-story': liveStoryLayoutHbs,
70
72
  'link-in-bio': linkInBioLayoutHbs,
71
- 'media-page': mediaPageLayoutHbs
73
+ 'media-page': mediaPageLayoutHbs,
74
+ 'standalone-page': standalonePageLayoutHbs
72
75
  },
73
76
  partials: {
74
77
  'headers/header-main': headerMainHbs,
@@ -94,6 +97,7 @@ const assets = {
94
97
  'blocks/tiktok': blockTikTokHbs,
95
98
  'blocks/pull-quote': blockPullQuoteHbs,
96
99
  'components/article-main': componentArticleMainHbs,
100
+ 'components/standalone-main': standaloneMainHbs,
97
101
  'components/breaking-news': componentBreakingNewsHbs,
98
102
  'components/breaking-news/live-updates-column': componentBreakingNewsLiveUpdatesColumnHbs,
99
103
  'components/snack': componentSnackHbs,
@@ -1,5 +1,6 @@
1
+ import { type LayoutName } from './layouts.js';
1
2
  import { type CanonicalDocument } from './types/canonical-article.js';
2
- export type LayoutName = CanonicalDocument['layout'];
3
+ export type { LayoutName } from './layouts.js';
3
4
  export type RendererAssets = {
4
5
  layouts: Record<LayoutName, string>;
5
6
  partials: Record<string, string>;
@@ -1,7 +1,9 @@
1
1
  import Handlebars from 'handlebars';
2
+ import { layoutNames } from './layouts.js';
2
3
  import { canonicalArticleSchema } from './types/canonical-article.js';
3
4
  import { distributeHomepageArticles } from './homepage-distributor.js';
4
5
  import { buildSofascoreAttackMomentumUrl, buildSofascoreMatchUrl } from './utils/sofascore.js';
6
+ import { renderRumLoader } from './rum.js';
5
7
  let initialized = false;
6
8
  const layoutCache = new Map();
7
9
  let runtimeStyles = '';
@@ -230,6 +232,7 @@ function registerHelpers() {
230
232
  return 'null';
231
233
  return JSON.stringify(value);
232
234
  });
235
+ Handlebars.registerHelper('rumLoader', renderRumLoader);
233
236
  Handlebars.registerHelper('resolveHeadTitle', (doc) => {
234
237
  if (!doc || typeof doc !== 'object')
235
238
  return 'fifthbell';
@@ -333,7 +336,7 @@ export function renderWithAssets(doc, assets) {
333
336
  }
334
337
  const requestedLayout = doc.layout;
335
338
  if (!requestedLayout || !layoutCache.has(requestedLayout)) {
336
- throw new Error(`Unknown layout "${requestedLayout ?? 'undefined'}". Expected one of: article-page, homepage, category-page, search-page, 404, live-story, link-in-bio, media-page`);
339
+ throw new Error(`Unknown layout "${requestedLayout ?? 'undefined'}". Expected one of: ${layoutNames.join(', ')}`);
337
340
  }
338
341
  const parsed = canonicalArticleSchema.parse(normalizeDocument(doc));
339
342
  const template = layoutCache.get(parsed.layout);
@@ -1,6 +1,12 @@
1
1
  export { render, liveProgramPageHtml, liveProgramPageAsset, liveProgramPageFiles, fontFiles } from './renderer.node.js';
2
2
  export type { LiveProgramFileEntry, FontFileEntry } from './renderer.node.js';
3
+ export { liveProgramReleaseFiles } from './live-program-release.js';
3
4
  export { buildInstagramImageHtml, registerInstagramImageHelpers, type InstagramImageTemplateParams } from './instagram-image-template.js';
4
5
  export { outletConfig } from './outlet-config.js';
5
6
  export { version } from './version.js';
7
+ export { cronkiteManifest } from './cronkite-manifest.js';
8
+ export { PROGRAM_TEMPLATE_CONTRACT_VERSION, PROGRAM_TEMPLATE_KIND, liveProgramTemplateContract } from './program-template-manifest.js';
9
+ export type { ProgramTemplateContract } from './program-template-manifest.js';
6
10
  export type { CanonicalDocument } from './types/canonical-article.js';
11
+ export type { RumConfig } from './types/canonical-article.js';
12
+ export type { LayoutName } from './layouts.js';
package/dist/renderer.js CHANGED
@@ -1,4 +1,7 @@
1
1
  export { render, liveProgramPageHtml, liveProgramPageAsset, liveProgramPageFiles, fontFiles } from './renderer.node.js';
2
+ export { liveProgramReleaseFiles } from './live-program-release.js';
2
3
  export { buildInstagramImageHtml, registerInstagramImageHelpers } from './instagram-image-template.js';
3
4
  export { outletConfig } from './outlet-config.js';
4
5
  export { version } from './version.js';
6
+ export { cronkiteManifest } from './cronkite-manifest.js';
7
+ export { PROGRAM_TEMPLATE_CONTRACT_VERSION, PROGRAM_TEMPLATE_KIND, liveProgramTemplateContract } from './program-template-manifest.js';
@@ -1,17 +1,8 @@
1
1
  import fs from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
+ import { layoutFiles } from './layouts.js';
4
5
  import { renderWithAssets } from './renderer.core.js';
5
- const layoutFiles = {
6
- 'article-page': 'article-page.hbs',
7
- homepage: 'homepage.hbs',
8
- 'category-page': 'category-page.hbs',
9
- 'search-page': 'search-page.hbs',
10
- '404': '404.hbs',
11
- 'live-story': 'live-story.hbs',
12
- 'link-in-bio': 'link-in-bio.hbs',
13
- 'media-page': 'media-page.hbs'
14
- };
15
6
  function getPaths() {
16
7
  const currentFile = fileURLToPath(import.meta.url);
17
8
  const currentDir = path.dirname(currentFile);
@@ -73,7 +64,12 @@ export function render(document) {
73
64
  function liveProgramPageDir() {
74
65
  const currentFile = fileURLToPath(import.meta.url);
75
66
  const currentDir = path.dirname(currentFile);
76
- return path.join(currentDir, 'live-program-page');
67
+ const colocated = path.join(currentDir, 'live-program-page');
68
+ if (fs.existsSync(colocated))
69
+ return colocated;
70
+ // Source-level verification runs after Vite has emitted the package bundle.
71
+ // Published code resolves the colocated dist directory above.
72
+ return path.join(path.resolve(currentDir, '..'), 'dist', 'live-program-page');
77
73
  }
78
74
  export function liveProgramPageHtml() {
79
75
  const pageDir = liveProgramPageDir();
@@ -126,13 +122,19 @@ export function liveProgramPageAsset(filename) {
126
122
  }
127
123
  const CONTENT_TYPE_MAP = {
128
124
  '.html': 'text/html; charset=utf-8',
129
- '.js': 'application/javascript',
130
- '.css': 'text/css',
125
+ '.js': 'application/javascript; charset=utf-8',
126
+ '.css': 'text/css; charset=utf-8',
127
+ '.json': 'application/json; charset=utf-8',
131
128
  '.jpg': 'image/jpeg',
132
129
  '.jpeg': 'image/jpeg',
133
130
  '.png': 'image/png',
134
131
  '.ogg': 'audio/ogg',
135
132
  '.mp3': 'audio/mpeg',
133
+ '.ttf': 'font/ttf',
134
+ '.woff': 'font/woff',
135
+ '.woff2': 'font/woff2',
136
+ '.svg': 'image/svg+xml',
137
+ '.webp': 'image/webp',
136
138
  };
137
139
  function contentTypeForFile(filename) {
138
140
  const ext = path.extname(filename).toLowerCase();
@@ -145,7 +147,7 @@ export function liveProgramPageFiles() {
145
147
  }
146
148
  const entries = [];
147
149
  function walk(dir, prefix) {
148
- const items = fs.readdirSync(dir, { withFileTypes: true });
150
+ const items = fs.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name));
149
151
  for (const item of items) {
150
152
  const fullPath = path.join(dir, item.name);
151
153
  const relativeKey = prefix ? `${prefix}/${item.name}` : item.name;
package/dist/rum.d.ts ADDED
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ export declare const rumConfigSchema: z.ZodObject<{
3
+ appMonitorId: z.ZodString;
4
+ applicationVersion: z.ZodString;
5
+ region: z.ZodString;
6
+ identityPoolId: z.ZodString;
7
+ guestRoleArn: z.ZodString;
8
+ }, z.core.$strict>;
9
+ export type RumConfig = z.infer<typeof rumConfigSchema>;
10
+ type RumPageType = 'article-page' | 'homepage' | 'category-page' | 'search-page' | '404' | 'live-story' | 'link-in-bio' | 'media-page';
11
+ type ContentLanguage = 'en' | 'es' | 'it';
12
+ /**
13
+ * Produces the tenant-neutral loader shared by every public page shell.
14
+ * Configuration values are public deployment identifiers supplied by the
15
+ * renderer caller; no tenant-specific values are embedded in Brokaw.
16
+ */
17
+ export declare function renderRumLoader(config: RumConfig, pageType: RumPageType, language: ContentLanguage): string;
18
+ export {};
package/dist/rum.js ADDED
@@ -0,0 +1,113 @@
1
+ import { z } from 'zod';
2
+ const awsRegion = z.string().regex(/^[a-z]{2}(?:-gov)?-[a-z]+-\d$/);
3
+ const uuid = z.string().uuid();
4
+ export const rumConfigSchema = z
5
+ .object({
6
+ appMonitorId: uuid,
7
+ applicationVersion: z.string().regex(/^[A-Za-z0-9._:/-]{1,200}$/),
8
+ region: awsRegion,
9
+ identityPoolId: z.string().regex(/^[a-z]{2}(?:-gov)?-[a-z]+-\d:[0-9a-fA-F-]{36}$/),
10
+ guestRoleArn: z
11
+ .string()
12
+ .regex(/^arn:(?:aws|aws-us-gov|aws-cn):iam::\d{12}:role\/[A-Za-z0-9+=,.@_\/-]{1,512}$/)
13
+ })
14
+ .strict()
15
+ .superRefine((config, context) => {
16
+ if (!config.identityPoolId.startsWith(`${config.region}:`)) {
17
+ context.addIssue({
18
+ code: 'custom',
19
+ path: ['identityPoolId'],
20
+ message: 'identityPoolId region must match region'
21
+ });
22
+ }
23
+ });
24
+ const jsonForInlineScript = (value) => JSON.stringify(value)
25
+ .replace(/</g, '\\u003c')
26
+ .replace(/>/g, '\\u003e')
27
+ .replace(/&/g, '\\u0026')
28
+ .replace(/\u2028/g, '\\u2028')
29
+ .replace(/\u2029/g, '\\u2029');
30
+ /**
31
+ * Produces the tenant-neutral loader shared by every public page shell.
32
+ * Configuration values are public deployment identifiers supplied by the
33
+ * renderer caller; no tenant-specific values are embedded in Brokaw.
34
+ */
35
+ export function renderRumLoader(config, pageType, language) {
36
+ const parsed = rumConfigSchema.parse(config);
37
+ const endpoint = `https://dataplane.rum.${parsed.region}.amazonaws.com`;
38
+ return `<script data-brokaw-rum-loader>
39
+ (function () {
40
+ try {
41
+ function containsSensitiveErrorData(event) {
42
+ var reason = event && event.reason;
43
+ var error = event && event.error;
44
+ var candidate = [
45
+ event && event.message,
46
+ event && event.filename,
47
+ typeof reason === 'string' ? reason : reason && reason.message,
48
+ error && error.message
49
+ ].filter(Boolean).join(' ');
50
+ return candidate.length > 256 || /(?:https?:\\/\\/|[?#]|authorization|bearer|credential|password|passcode|api[_-]?key|access[_-]?token|refresh[_-]?token|<[^>]+>|[{}][^{}]{8,}[{}])/i.test(candidate);
51
+ }
52
+
53
+ (function (namespace, appMonitorId, applicationVersion, region, source, clientConfig, client, script) {
54
+ client = window.AwsRumClient = {
55
+ q: [],
56
+ n: namespace,
57
+ i: appMonitorId,
58
+ v: applicationVersion,
59
+ r: region,
60
+ c: clientConfig
61
+ };
62
+ window[namespace] = function (command, payload) {
63
+ client.q.push({ c: command, p: payload });
64
+ };
65
+ script = document.createElement('script');
66
+ script.async = true;
67
+ script.crossOrigin = 'anonymous';
68
+ script.src = source;
69
+ script.onerror = function () {
70
+ client.q = [];
71
+ window[namespace] = function () {};
72
+ };
73
+ document.head.appendChild(script);
74
+ })(
75
+ 'cwr',
76
+ ${jsonForInlineScript(parsed.appMonitorId)},
77
+ ${jsonForInlineScript(parsed.applicationVersion)},
78
+ ${jsonForInlineScript(parsed.region)},
79
+ 'https://client.rum.us-east-1.amazonaws.com/3.0.0/cwr.js',
80
+ {
81
+ identityPoolId: ${jsonForInlineScript(parsed.identityPoolId)},
82
+ guestRoleArn: ${jsonForInlineScript(parsed.guestRoleArn)},
83
+ sessionSampleRate: 1,
84
+ endpoint: ${jsonForInlineScript(endpoint)},
85
+ telemetries: [
86
+ ['errors', { stackTraceLength: 0, ignore: containsSensitiveErrorData }],
87
+ ['performance', {
88
+ ignore: function (entry) { return entry && entry.entryType === 'resource'; },
89
+ recordAllTypes: [],
90
+ sampleTypes: []
91
+ }]
92
+ ],
93
+ allowCookies: false,
94
+ enableXRay: false,
95
+ recordResourceUrl: false,
96
+ pageIdFormat: 'PATH',
97
+ disableAutoPageView: true
98
+ }
99
+ );
100
+
101
+ window.cwr('recordPageView', {
102
+ pageId: window.location.pathname,
103
+ pageAttributes: {
104
+ page_type: ${jsonForInlineScript(pageType)},
105
+ content_language: ${jsonForInlineScript(language)}
106
+ }
107
+ });
108
+ } catch (_rumError) {
109
+ // Monitoring is optional and must never block rendering or navigation.
110
+ }
111
+ })();
112
+ </script>`;
113
+ }