@rocket/js 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/README.md +8 -2
  2. package/dist-types/exports/layouts/atlasBlog.d.ts +2 -0
  3. package/dist-types/exports/layouts/atlasBlog.d.ts.map +1 -0
  4. package/dist-types/exports/types/rocket.d.ts +60 -2
  5. package/dist-types/exports/types/rocket.d.ts.map +1 -1
  6. package/dist-types/exports/types.d.ts +1 -1
  7. package/dist-types/exports/types.d.ts.map +1 -1
  8. package/dist-types/src/PageData.d.ts +3 -1
  9. package/dist-types/src/PageData.d.ts.map +1 -1
  10. package/dist-types/src/RocketJsDemo.d.ts.map +1 -1
  11. package/dist-types/src/SocialPreviewPlayground.d.ts +1 -0
  12. package/dist-types/src/SocialPreviewPlayground.d.ts.map +1 -1
  13. package/dist-types/src/asyncMessage.d.ts +5 -0
  14. package/dist-types/src/asyncMessage.d.ts.map +1 -1
  15. package/dist-types/src/cli/RocketBuild.d.ts.map +1 -1
  16. package/dist-types/src/cli/RocketCli.d.ts.map +1 -1
  17. package/dist-types/src/cli/RocketStart.d.ts +6 -1
  18. package/dist-types/src/cli/RocketStart.d.ts.map +1 -1
  19. package/dist-types/src/component-hydration.d.ts.map +1 -1
  20. package/dist-types/src/components/RocketDrawer.d.ts +8 -0
  21. package/dist-types/src/components/RocketDrawer.d.ts.map +1 -1
  22. package/dist-types/src/components/RocketSocialLink.d.ts.map +1 -1
  23. package/dist-types/src/config.d.ts.map +1 -1
  24. package/dist-types/src/feeds.d.ts +38 -0
  25. package/dist-types/src/feeds.d.ts.map +1 -0
  26. package/dist-types/src/hydration/hydrationLoader.d.ts +13 -4
  27. package/dist-types/src/hydration/hydrationLoader.d.ts.map +1 -1
  28. package/dist-types/src/icons.d.ts.map +1 -1
  29. package/dist-types/src/layouts/atlas/atlasBlogLayout.d.ts +42 -0
  30. package/dist-types/src/layouts/atlas/atlasBlogLayout.d.ts.map +1 -0
  31. package/dist-types/src/layouts/atlas/atlasDocLayout.d.ts.map +1 -1
  32. package/dist-types/src/layouts/atlas/atlasHeroLayout.d.ts.map +1 -1
  33. package/dist-types/src/layouts/atlas/atlasNotFoundLayout.d.ts.map +1 -1
  34. package/dist-types/src/layouts/layout-helper.d.ts +3 -3
  35. package/dist-types/src/layouts/layout-helper.d.ts.map +1 -1
  36. package/dist-types/src/markdownHook.d.ts.map +1 -1
  37. package/dist-types/src/menu.d.ts +8 -3
  38. package/dist-types/src/menu.d.ts.map +1 -1
  39. package/dist-types/src/menus/MainMenu.d.ts.map +1 -1
  40. package/dist-types/src/{development-page-module-loader.d.ts → page-module-loader.d.ts} +7 -2
  41. package/dist-types/src/page-module-loader.d.ts.map +1 -0
  42. package/dist-types/src/page-runtime.d.ts +11 -0
  43. package/dist-types/src/page-runtime.d.ts.map +1 -1
  44. package/dist-types/src/pages.d.ts.map +1 -1
  45. package/dist-types/src/route-pattern.d.ts +10 -0
  46. package/dist-types/src/route-pattern.d.ts.map +1 -0
  47. package/dist-types/src/siteDiscoverability.d.ts +4 -0
  48. package/dist-types/src/siteDiscoverability.d.ts.map +1 -1
  49. package/dist-types/src/socialPreviewImages.d.ts +2 -1
  50. package/dist-types/src/socialPreviewImages.d.ts.map +1 -1
  51. package/dist-types/src/static-params.d.ts +33 -0
  52. package/dist-types/src/static-params.d.ts.map +1 -0
  53. package/dist-types/src/transform.d.ts +4 -0
  54. package/dist-types/src/transform.d.ts.map +1 -1
  55. package/dist-types/src/wds-plugin.d.ts.map +1 -1
  56. package/exports/layouts/atlasBlog.js +11 -0
  57. package/exports/types/rocket.test.ts +26 -0
  58. package/exports/types/rocket.ts +70 -2
  59. package/exports/types.ts +7 -0
  60. package/package.json +15 -31
  61. package/src/PageData.js +12 -2
  62. package/src/RocketJsDemo.js +1 -0
  63. package/src/SocialPreviewPlayground.js +26 -20
  64. package/src/asyncMessage.js +8 -2
  65. package/src/cli/RocketBuild.js +110 -13
  66. package/src/cli/RocketCli.js +11 -1
  67. package/src/cli/RocketStart.js +60 -16
  68. package/src/cli/cli.js +10 -1
  69. package/src/component-hydration.js +23 -3
  70. package/src/components/RocketDrawer.js +44 -10
  71. package/src/components/RocketSocialLink.js +26 -2
  72. package/src/config.js +33 -4
  73. package/src/feeds.js +212 -0
  74. package/src/hydration/hydrationLoader.js +80 -48
  75. package/src/icons.js +5 -0
  76. package/src/layouts/atlas/atlasBlog.css +143 -0
  77. package/src/layouts/atlas/atlasBlogLayout.js +234 -0
  78. package/src/layouts/atlas/atlasDocLayout.js +3 -2
  79. package/src/layouts/atlas/atlasHeroLayout.js +4 -6
  80. package/src/layouts/atlas/atlasNotFoundLayout.js +9 -21
  81. package/src/layouts/layout-helper.js +5 -5
  82. package/src/layouts/layout.js +2 -2
  83. package/src/loaded-page-module.js +3 -1
  84. package/src/markdownCompiler.js +2 -2
  85. package/src/markdownHook.js +7 -2
  86. package/src/menu.js +25 -19
  87. package/src/menus/MainMenu.js +10 -4
  88. package/src/{static-page-module-loader.js → page-module-loader.js} +6 -1
  89. package/src/page-pagination.js +2 -2
  90. package/src/page-runtime.js +48 -3
  91. package/src/pages.js +47 -56
  92. package/src/publicAssets.js +2 -2
  93. package/src/route-pattern.js +21 -0
  94. package/src/siteDiscoverability.js +14 -1
  95. package/src/socialPreviewImages.js +80 -14
  96. package/src/standalone-demo-url.js +2 -2
  97. package/src/static-params.js +114 -0
  98. package/src/transform.js +89 -22
  99. package/src/wds-plugin.js +16 -3
  100. package/dist-types/src/development-page-module-loader.d.ts.map +0 -1
  101. package/dist-types/src/static-page-module-loader.d.ts +0 -15
  102. package/dist-types/src/static-page-module-loader.d.ts.map +0 -1
  103. package/src/development-page-module-loader.js +0 -29
@@ -1 +1 @@
1
- {"version":3,"file":"MainMenu.d.ts","sourceRoot":"","sources":["../../../src/menus/MainMenu.js"],"names":[],"mappings":"AAIA;IACE;;;;;;;MAGE;IA4CF,uCAIE;IA5CA,qDAAqD;IAErD,UAFW,OAAO,qBAAqB,EAAE,QAAQ,CAExB;IACzB,oBAAqB;IAGvB,2DAOC;IAED;;;;OAIG;IACH,WAJW,OAAO,qBAAqB,EAAE,QAAQ,UACtC,MAAM,GACJ,OAAO,KAAK,EAAE,cAAc,CAoBxC;CAOF;2BAzDqC,KAAK"}
1
+ {"version":3,"file":"MainMenu.d.ts","sourceRoot":"","sources":["../../../src/menus/MainMenu.js"],"names":[],"mappings":"AAIA;IACE;;;;;;;MAGE;IAkDF,uCAIE;IAlDA,qDAAqD;IAErD,UAFW,OAAO,qBAAqB,EAAE,QAAQ,CAExB;IACzB,oBAAqB;IAGvB,2DAOC;IAED;;;;OAIG;IACH,WAJW,OAAO,qBAAqB,EAAE,QAAQ,UACtC,MAAM,GACJ,OAAO,KAAK,EAAE,cAAc,CA0BxC;CAOF;2BA/DqC,KAAK"}
@@ -1,5 +1,10 @@
1
1
  /** @typedef {import('./page-runtime.js').PageModuleLoaderOptions} PageModuleLoaderOptions */
2
- export function createDevelopmentPageModuleLoader(): {
2
+ /**
3
+ * The Page Module Loader used by both the development server and static builds.
4
+ * Loading goes through Rocket's import hooks, which behave the same in both
5
+ * runtime environments.
6
+ */
7
+ export function createPageModuleLoader(): {
3
8
  /**
4
9
  * @param {PageModuleLoaderOptions} options
5
10
  */
@@ -12,4 +17,4 @@ export function createDevelopmentPageModuleLoader(): {
12
17
  }>;
13
18
  };
14
19
  export type PageModuleLoaderOptions = import("./page-runtime.js").PageModuleLoaderOptions;
15
- //# sourceMappingURL=development-page-module-loader.d.ts.map
20
+ //# sourceMappingURL=page-module-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-module-loader.d.ts","sourceRoot":"","sources":["../../src/page-module-loader.js"],"names":[],"mappings":"AAGA,6FAA6F;AAE7F;;;;GAIG;AACH;IAEI;;OAEG;4BADQ,uBAAuB;;;;;;;EAoBrC;sCA9Ba,OAAO,mBAAmB,EAAE,uBAAuB"}
@@ -71,6 +71,17 @@ export class PageRuntime {
71
71
  render(request: Request, { adapterContext }?: {
72
72
  adapterContext?: unknown;
73
73
  }): Promise<Response>;
74
+ /**
75
+ * Development falls back to the request origin so Page Feeds work before a
76
+ * Site Origin is configured; builds always pass the configured Site Origin.
77
+ *
78
+ * @param {{ page: Page; routePath: string }} feedMatch
79
+ * @param {string} requestOrigin
80
+ */
81
+ renderPageFeed(feedMatch: {
82
+ page: Page;
83
+ routePath: string;
84
+ }, requestOrigin: string): Response;
74
85
  }
75
86
  export type PageRegistry = import("@rocket/js/types.js").PageRegistry;
76
87
  export type Page = {
@@ -1 +1 @@
1
- {"version":3,"file":"page-runtime.d.ts","sourceRoot":"","sources":["../../src/page-runtime.js"],"names":[],"mappings":"AAmTA;;;GAGG;AACH,sDAHW,OAAO,GACL,QAAQ,CAepB;AA5TD,yEAAyE;AACzE,iKAAiK;AACjK,2IAA2I;AAC3I,kFAAkF;AAClF,mFAAmF;AACnF,wFAAwF;AACxF,mHAAmH;AACnH,2HAA2H;AAC3H,qFAAqF;AACrF,6EAA6E;AAC7E,mFAAmF;AAEnF;IACE;;;;OAIG;IACH,kBAJW,oBAAoB,WACpB,MAAM,YACN;QAAE,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,IAAI,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,EAQ9D;IAHC,2BAAgB;IAChB,uBAAwB;IACxB,8BAAkC;CAErC;AAED;IACE;;;;;;;;;;;;OAYG;IACH,qKAZW;QACN,KAAK,EAAE,YAAY,CAAC;QACpB,gBAAgB,EAAE,gBAAgB,CAAC;QACnC,YAAY,CAAC,EAAE,kBAAkB,CAAC;QAClC,gBAAgB,CAAC,EAAE,OAAO,qBAAqB,EAAE,sBAAsB,CAAC;QACxE,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,0BAA0B,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACjD,aAAa,CAAC,EAAE,OAAO,qBAAqB,EA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,MAAM,EAAE,WACR,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,uDA6D7B;2BAtEa,OAAO,qBAAqB,EAAE,YAAY;iCAC1C,OAAO,qBAAqB,EAAE,kBAAkB;iCAChD,OAAO,qBAAqB,EAAE,kBAAkB"}
1
+ {"version":3,"file":"pages.d.ts","sourceRoot":"","sources":["../../src/pages.js"],"names":[],"mappings":"AAWA;;;;GAIG;AACH,+BAJW,MAAM,WACN,MAAM,EAAE,WACR,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,uDAsD7B;2BA/Da,OAAO,qBAAqB,EAAE,YAAY;iCAC1C,OAAO,qBAAqB,EAAE,kBAAkB;iCAChD,OAAO,qBAAqB,EAAE,kBAAkB"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Compiling a URLPattern is comparatively expensive and route paths repeat on
3
+ * every request, so compiled patterns are cached per route path.
4
+ *
5
+ * @param {string} routePath
6
+ * @returns {URLPattern}
7
+ */
8
+ export function routePattern(routePath: string): URLPattern;
9
+ import { URLPattern } from 'urlpattern-polyfill';
10
+ //# sourceMappingURL=route-pattern.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-pattern.d.ts","sourceRoot":"","sources":["../../src/route-pattern.js"],"names":[],"mappings":"AAMA;;;;;;GAMG;AACH,wCAHW,MAAM,GACJ,UAAU,CAStB;2BAnB0B,qBAAqB"}
@@ -21,6 +21,10 @@ export function createSitemap({ pages, siteOrigin }: {
21
21
  siteOrigin: string;
22
22
  }): string;
23
23
  /**
24
+ * The Robots File always references the canonical Sitemap URL, even when
25
+ * Rocket does not generate `sitemap.xml` itself — this is documented behavior
26
+ * so projects can supply a sitemap through other tooling.
27
+ *
24
28
  * @param {{
25
29
  * pages?: import('@rocket/js/types.js').PageRegistry;
26
30
  * siteOrigin: string;
@@ -1 +1 @@
1
- {"version":3,"file":"siteDiscoverability.d.ts","sourceRoot":"","sources":["../../src/siteDiscoverability.js"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,2EANW;IACN,KAAK,EAAE,OAAO,qBAAqB,EAAE,YAAY,CAAC;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,OAAO,qBAAqB,EAAE,oBAAoB,CAAC;CAC5D,QAoBH;AAED;;;;;GAKG;AACH,qDALW;IACN,KAAK,EAAE,OAAO,qBAAqB,EAAE,YAAY,CAAC;IAClD,UAAU,EAAE,MAAM,CAAC;CACpB,UAeH;AAED;;;;;GAKG;AACH,wDALW;IACN,KAAK,CAAC,EAAE,OAAO,qBAAqB,EAAE,YAAY,CAAC;IACnD,UAAU,EAAE,MAAM,CAAC;CACpB,UAaH"}
1
+ {"version":3,"file":"siteDiscoverability.d.ts","sourceRoot":"","sources":["../../src/siteDiscoverability.js"],"names":[],"mappings":"AASA;;;;;;GAMG;AACH,2EANW;IACN,KAAK,EAAE,OAAO,qBAAqB,EAAE,YAAY,CAAC;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,OAAO,qBAAqB,EAAE,oBAAoB,CAAC;CAC5D,QAoBH;AAED;;;;;GAKG;AACH,qDALW;IACN,KAAK,EAAE,OAAO,qBAAqB,EAAE,YAAY,CAAC;IAClD,UAAU,EAAE,MAAM,CAAC;CACpB,UAeH;AAED;;;;;;;;;GASG;AACH,wDALW;IACN,KAAK,CAAC,EAAE,OAAO,qBAAqB,EAAE,YAAY,CAAC;IACnD,UAAU,EAAE,MAAM,CAAC;CACpB,UAaH"}
@@ -134,9 +134,10 @@ export function createSocialPreviewTemplateData({ metadata, pageMetadata, pathna
134
134
  export function captureSocialPreviewImageWithBrowser({ html }: SocialPreviewCaptureOptions): Promise<Buffer<ArrayBufferLike>>;
135
135
  /**
136
136
  * @param {string} html
137
+ * @param {import('puppeteer-core').Browser} [existingBrowser] reused across captures; the caller owns closing it
137
138
  * @returns {Promise<Buffer>}
138
139
  */
139
- export function renderSocialPreviewImage(html: string): Promise<Buffer>;
140
+ export function renderSocialPreviewImage(html: string, existingBrowser?: import("puppeteer-core").Browser): Promise<Buffer>;
140
141
  /**
141
142
  * @param {{
142
143
  * platform?: NodeJS.Platform;
@@ -1 +1 @@
1
- {"version":3,"file":"socialPreviewImages.d.ts","sourceRoot":"","sources":["../../src/socialPreviewImages.js"],"names":[],"mappings":"AAuBA;;;;;;;GAOG;AAEH;;GAEG;AAEH;;;;;;GAMG;AAEH;;;;;;;;;GASG;AACH,8IATW;IACN,KAAK,EAAE,OAAO,qBAAqB,EAAE,YAAY,CAAC;IAClD,gBAAgB,CAAC,EAAE,OAAO,qBAAqB,EAAE,sBAAsB,CAAC;IACxE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,yBAAyB,CAAC,EAAE,oBAAoB,CAAC;CAClD,GACS,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,+BAA+B,CAAC,CAAC,CAwEjE;AAED;;;GAGG;AACH,4DAHW,OAAO,qBAAqB,EAAE,YAAY,GACxC,OAAO,qBAAqB,EAAE,YAAY,CAYtD;AAED;;;GAGG;AACH,gDAHW,OAAO,qBAAqB,EAAE,YAAY,GACxC,OAAO,qBAAqB,EAAE,YAAY,CAYtD;AAED;;;;;;GAMG;AACH,qFANW;IACN,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,OAAO,qBAAqB,EAAE,IAAI,CAAC;IACzC,gBAAgB,CAAC,EAAE,OAAO,qBAAqB,EAAE,sBAAsB,CAAC;CACzE,WAQH;AAED;;GAEG;AACH,iEAFW,OAAO,qBAAqB,EAAE,sBAAsB,GAAG,SAAS,WAO1E;AAED;;GAEG;AACH,qEAFW,MAAM,UAOhB;AAiED;;;;;;;;GAQG;AACH,8GARW;IACN,IAAI,EAAE,OAAO,qBAAqB,EAAE,IAAI,CAAC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,OAAO,qBAAqB,EAAE,sBAAsB,CAAC;IACvE,UAAU,EAAE,MAAM,CAAC;IACnB,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R,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,UAAU,CAAC;CAClB;6CAhCG,mCAAmC"}
1
+ {"version":3,"file":"socialPreviewImages.d.ts","sourceRoot":"","sources":["../../src/socialPreviewImages.js"],"names":[],"mappings":"AAuBA;;;;;;;GAOG;AAEH;;GAEG;AAEH;;;;;;GAMG;AAEH;;;;;;;;;GASG;AACH,8IATW;IACN,KAAK,EAAE,OAAO,qBAAqB,EAAE,YAAY,CAAC;IAClD,gBAAgB,CAAC,EAAE,OAAO,qBAAqB,EAAE,sBAAsB,CAAC;IACxE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,yBAAyB,CAAC,EAAE,oBAAoB,CAAC;CAClD,GACS,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,+BAA+B,CAAC,CAAC,CAsCjE;AAwED;;;GAGG;AACH,4DAHW,OAAO,qBAAqB,EAAE,YAAY,GACxC,OAAO,qBAAqB,EAAE,YAAY,CAYtD;AAED;;;GAGG;AACH,gDAHW,OAAO,qBAAqB,EAAE,YAAY,GACxC,OAAO,qBAAqB,EAAE,YAAY,CAYtD;AAED;;;;;;GAMG;AACH,qFANW;IACN,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,OAAO,qBAAqB,EAAE,IAAI,CAAC;IACzC,gBAAgB,CAAC,EAAE,OAAO,qBAAqB,EAAE,sBAAsB,CAAC;CACzE,WAQH;AAED;;GAEG;AACH,iEAFW,OAAO,qBAAqB,EAAE,sBAAsB,GAAG,SAAS,WAO1E;AAED;;GAEG;AACH,qEAFW,MAAM,UAOhB;AAiED;;;;;;;;GAQG;AACH,8GARW;IACN,IAAI,EAAE,OAAO,qBAAqB,EAAE,IAAI,CAAC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,OAAO,qBAAqB,EAAE,sBAAsB,CAAC;IACvE,UAAU,E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AA2B,KAAK,OAAO,CAAC,UAAU,CAAC,GAAG,UAAU;8CAI1E;IACR,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,UAAU,CAAC;CAClB;6CAhCG,mCAAmC"}
@@ -0,0 +1,33 @@
1
+ /** @typedef {import('@rocket/js/types.js').Page} Page */
2
+ /** @typedef {import('@rocket/js/types.js').PageRegistry} PageRegistry */
3
+ /** @typedef {import('@rocket/js/types.js').PageStaticParams} PageStaticParams */
4
+ /** @typedef {import('@rocket/js/types.js').PageStaticParamsDeclaration} PageStaticParamsDeclaration */
5
+ /**
6
+ * @param {Page} page
7
+ */
8
+ export function hasStaticParams(page: Page): boolean;
9
+ /**
10
+ * @param {string} pagePath
11
+ */
12
+ export function hasPathParameter(pagePath: string): boolean;
13
+ /**
14
+ * Enumerates the concrete output paths of a parameterized static JavaScript
15
+ * Page from its `staticParams` export.
16
+ *
17
+ * @param {{
18
+ * pages: PageRegistry;
19
+ * page: Page;
20
+ * pagePath: string;
21
+ * }} options
22
+ * @returns {string[]}
23
+ */
24
+ export function staticParamsPagePaths({ pages, page, pagePath }: {
25
+ pages: PageRegistry;
26
+ page: Page;
27
+ pagePath: string;
28
+ }): string[];
29
+ export type Page = import("@rocket/js/types.js").Page;
30
+ export type PageRegistry = import("@rocket/js/types.js").PageRegistry;
31
+ export type PageStaticParams = import("@rocket/js/types.js").PageStaticParams;
32
+ export type PageStaticParamsDeclaration = import("@rocket/js/types.js").PageStaticParamsDeclaration;
33
+ //# sourceMappingURL=static-params.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"static-params.d.ts","sourceRoot":"","sources":["../../src/static-params.js"],"names":[],"mappings":"AAEA,yDAAyD;AACzD,yEAAyE;AACzE,iFAAiF;AACjF,uGAAuG;AAEvG;;GAEG;AACH,sCAFW,IAAI,WAId;AAED;;GAEG;AACH,2CAFW,MAAM,WAIhB;AAED;;;;;;;;;;GAUG;AACH,iEAPW;IACN,KAAK,EAAE,YAAY,CAAC;IACpB,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;CAClB,GACS,MAAM,EAAE,CA8BpB;mBA1Da,OAAO,qBAAqB,EAAE,IAAI;2BAClC,OAAO,qBAAqB,EAAE,YAAY;+BAC1C,OAAO,qBAAqB,EAAE,gBAAgB;0CAC9C,OAAO,qBAAqB,EAAE,2BAA2B"}
@@ -7,4 +7,8 @@ export function mdToJs(md: string): Promise<string>;
7
7
  * @param {string} demo
8
8
  */
9
9
  export function mdToJsSingleDemo(md: string, demo: string): Promise<string>;
10
+ /**
11
+ * @param {import('mdast').Code} node
12
+ */
13
+ export function isDemoCodeNode(node: import("mdast").Code): boolean;
10
14
  //# sourceMappingURL=transform.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../src/transform.js"],"names":[],"mappings":"AA8BA;;GAEG;AACH,2BAFW,MAAM,mBAoChB;AAED;;;GAGG;AACH,qCAHW,MAAM,QACN,MAAM,mBAwChB"}
1
+ {"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../src/transform.js"],"names":[],"mappings":"AA8BA;;GAEG;AACH,2BAFW,MAAM,mBAoChB;AAED;;;GAGG;AACH,qCAHW,MAAM,QACN,MAAM,mBAqChB;AAqSD;;GAEG;AACH,qCAFW,OAAO,OAAO,EAAE,IAAI,WAI9B"}
@@ -1 +1 @@
1
- {"version":3,"file":"wds-plugin.d.ts","sourceRoot":"","sources":["../../src/wds-plugin.js"],"names":[],"mappings":"yBA8BgB,iBAAO,EAAE,4BAAO,EAAE,kDAAY,EAAE,gDAAY,KADmG,OAAO,sBAAsB,EAAE,MAAM;;iCAJtL,OAAO,qBAAqB,EAAE,kBAAkB;2CAChD;IAAE,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAAC,gBAAgB,CAAC,EAAE,OAAO,qBAAqB,EAAE,sBAAsB,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,mBAAmB,CAAC,EAAE,OAAO,qBAAqB,EAAE,yBAAyB,CAAC;IAAC,aAAa,CAAC,EAAE,OAAO,qBAAqB,EAAE,mBAAmB,CAAC;IAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAAC,yBAAyB,CAAC,EAAE,OAAO,0BAA0B,EAAE,oBAAoB,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE;yCACxZ,4BAA4B,GAAG,kBAAkB"}
1
+ {"version":3,"file":"wds-plugin.d.ts","sourceRoot":"","sources":["../../src/wds-plugin.js"],"names":[],"mappings":"yBAkCgB,iBAAO,EAAE,4BAAO,EAAE,kDAAY,EAAE,gDAAY,KADmG,OAAO,sBAAsB,EAAE,MAAM;;iCAJtL,OAAO,qBAAqB,EAAE,kBAAkB;2CAChD;IAAE,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAAC,gBAAgB,CAAC,EAAE,OAAO,qBAAqB,EAAE,sBAAsB,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,mBAAmB,CAAC,EAAE,OAAO,qBAAqB,EAAE,yBAAyB,CAAC;IAAC,aAAa,CAAC,EAAE,OAAO,qBAAqB,EAAE,mBAAmB,CAAC;IAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAAC,yBAAyB,CAAC,EAAE,OAAO,0BAA0B,EAAE,oBAAoB,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE;yCACxZ,4BAA4B,GAAG,kBAAkB"}
@@ -0,0 +1,11 @@
1
+ export {
2
+ atlasBlogComponents,
3
+ atlasBlogIndexLayout,
4
+ atlasPostLayout,
5
+ blogTagPath,
6
+ formatBlogDate,
7
+ renderBlogByline,
8
+ renderBlogPagination,
9
+ renderBlogPostList,
10
+ renderBlogTags,
11
+ } from '../../src/layouts/atlas/atlasBlogLayout.js';
@@ -0,0 +1,26 @@
1
+ import { html } from 'lit';
2
+ import type { AtlasLayoutHeadContent, BlogData, DocData, HeroData } from './rocket.js';
3
+
4
+ const pageAwareHeadContent: AtlasLayoutHeadContent = ({ pageData }) =>
5
+ html`<meta name="page-url" content=${pageData.url} />`;
6
+
7
+ const siteWideHeadContent: AtlasLayoutHeadContent = () =>
8
+ html`<meta name="site-extension" content="enabled" />`;
9
+
10
+ function sharedAtlasHeadContent(data: DocData | HeroData | BlogData) {
11
+ return data.headContent;
12
+ }
13
+
14
+ // @ts-expect-error Atlas Layout Head Content requires a Lit template result.
15
+ const rawStringHeadContent: AtlasLayoutHeadContent = () => '<meta name="raw-string" />';
16
+
17
+ // @ts-expect-error Atlas Layout Head Content is synchronous.
18
+ const asyncHeadContent: AtlasLayoutHeadContent = async () => html`<meta name="async" />`;
19
+
20
+ export {
21
+ asyncHeadContent,
22
+ pageAwareHeadContent,
23
+ rawStringHeadContent,
24
+ sharedAtlasHeadContent,
25
+ siteWideHeadContent,
26
+ };
@@ -322,6 +322,8 @@ export type JsPage = (
322
322
  export type Module = {
323
323
  config: PageConfig;
324
324
  pagination?: PagePaginationDeclaration;
325
+ feed?: PageFeedDeclaration;
326
+ staticParams?: PageStaticParamsDeclaration;
325
327
  components?: Components;
326
328
  _$title$?: string;
327
329
  _$menuLinkText$?: string;
@@ -411,6 +413,37 @@ export type PagePagination = {
411
413
  previousPath?: string;
412
414
  };
413
415
 
416
+ export type PageFeedConfig = {
417
+ /**
418
+ * Feed display title.
419
+ */
420
+ title: string;
421
+ /**
422
+ * Optional feed subtitle text.
423
+ */
424
+ description?: string;
425
+ /**
426
+ * Page Collection entries included as feed entries, in collection order.
427
+ */
428
+ collection: PageCollectionEntry[];
429
+ /**
430
+ * Optional maximum number of feed entries taken from the start of the collection.
431
+ */
432
+ limit?: number;
433
+ };
434
+
435
+ export type PageFeedDeclaration = PageFeedConfig | ((pageData: PageData) => PageFeedConfig);
436
+
437
+ /**
438
+ * Concrete param values for one generated output document of a parameterized static
439
+ * JavaScript Page. Every route param in the Page path must be present.
440
+ */
441
+ export type PageStaticParams = Record<string, string>;
442
+
443
+ export type PageStaticParamsDeclaration =
444
+ | PageStaticParams[]
445
+ | ((pageData: PageData) => PageStaticParams[]);
446
+
414
447
  export type PageRegistrySortDirection = 'asc' | 'desc';
415
448
 
416
449
  export type PageRegistryQueryOptions = {
@@ -569,7 +602,24 @@ export type WorkflowData = {
569
602
  steps: WorkflowStep[];
570
603
  };
571
604
 
572
- export type HeroData = {
605
+ export type AtlasLayoutHeadContentContext = {
606
+ /** The current PageData for this Page render. */
607
+ pageData: PageData;
608
+ };
609
+
610
+ /**
611
+ * Returns trusted Site Author markup appended after Atlas-owned document head content.
612
+ */
613
+ export type AtlasLayoutHeadContent = (context: AtlasLayoutHeadContentContext) => TemplateResult;
614
+
615
+ type AtlasLayoutHeadContentData = {
616
+ /**
617
+ * Trusted Site Author markup evaluated once and appended after Atlas-owned document head content.
618
+ */
619
+ headContent?: AtlasLayoutHeadContent;
620
+ };
621
+
622
+ export type HeroData = AtlasLayoutHeadContentData & {
573
623
  headerData: HeaderData;
574
624
  footerData: FooterSection[];
575
625
  /**
@@ -584,13 +634,31 @@ export type HeroData = {
584
634
  secondaryLinksData?: FooterLink[];
585
635
  };
586
636
 
637
+ export type BlogData = AtlasLayoutHeadContentData & {
638
+ headerData: HeaderData;
639
+ /**
640
+ * Project-owned stylesheet URLs loaded after the package Atlas layout stylesheets.
641
+ */
642
+ stylesheets?: string[];
643
+ /**
644
+ * Site-root path prefix for tag archive links, e.g. '/blog/tags/'. Tags render as
645
+ * plain text when omitted.
646
+ */
647
+ tagPathPrefix?: string;
648
+ /**
649
+ * Site-root path of the blog's Page Feed, e.g. '/blog/feed.xml'. Adds a feed
650
+ * alternate link to the document head and a visible feed link on the index.
651
+ */
652
+ feedPath?: string;
653
+ };
654
+
587
655
  export type AtlasDocAsideTip = {
588
656
  title?: string;
589
657
  description: string;
590
658
  iconName?: string;
591
659
  };
592
660
 
593
- export type DocData = {
661
+ export type DocData = AtlasLayoutHeadContentData & {
594
662
  headerData: HeaderData;
595
663
  footerData: FooterSection[];
596
664
  /**
package/exports/types.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  export type {
2
+ AtlasLayoutHeadContent,
3
+ AtlasLayoutHeadContentContext,
2
4
  AtlasDocAsideTip,
5
+ BlogData,
3
6
  Components,
4
7
  DocData,
5
8
  Feature,
@@ -27,6 +30,8 @@ export type {
27
30
  PageCollectionEntry,
28
31
  PageDiscoverabilityConfig,
29
32
  PageConfig,
33
+ PageFeedConfig,
34
+ PageFeedDeclaration,
30
35
  PageMetadata,
31
36
  PageMetadataConfig,
32
37
  PageMetadataCustom,
@@ -38,6 +43,8 @@ export type {
38
43
  PageRegistryQuery,
39
44
  PageRegistryQueryOptions,
40
45
  PageRegistrySortDirection,
46
+ PageStaticParams,
47
+ PageStaticParamsDeclaration,
41
48
  PageTree,
42
49
  PackageIconLibrarySource,
43
50
  PathIconLibrarySource,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rocket/js",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "HTML-first static-site metaframework for content sites and Web Component docs.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -16,6 +16,7 @@
16
16
  "types": "./dist-types/exports/*",
17
17
  "default": "./exports/*"
18
18
  },
19
+ "./layouts/atlasBlog.css": "./src/layouts/atlas/atlasBlog.css",
19
20
  "./layouts/atlasDoc.css": "./src/layouts/atlas/atlasDoc.css",
20
21
  "./layouts/atlasHero.css": "./src/layouts/atlas/atlasHero.css",
21
22
  "./layouts/atlasNotFound.css": "./src/layouts/atlas/atlasNotFound.css",
@@ -51,7 +52,7 @@
51
52
  "build": "rm -rf dist && npx rocket build",
52
53
  "build:start": "npx http-server dist -o",
53
54
  "ai:do": "node scripts/codex-issue-loop.js",
54
- "ai:do:loop": "node scripts/codex-issue-loop.js --max 6",
55
+ "ai:do-loop": "node scripts/codex-issue-loop.js --max 6",
55
56
  "ai:check": "node scripts/codex-issue-loop.js --dry-run",
56
57
  "lint": "eslint . --ignore-pattern .gitignore && prettier \"**/*.{ts,js,json,md}\" --check --ignore-path .gitignore --ignore-path .prettierignore",
57
58
  "format": "eslint . --ignore-pattern .gitignore --fix && prettier \"**/*.{ts,js,json,md}\" --write --ignore-path .gitignore --ignore-path .prettierignore",
@@ -65,31 +66,19 @@
65
66
  "prepack": "npm run types",
66
67
  "release": "changeset publish"
67
68
  },
68
- "eslintConfig": {
69
- "overrides": [
70
- {
71
- "files": [
72
- "*.demo.js"
73
- ],
74
- "rules": {
75
- "no-console": "off"
76
- }
77
- }
78
- ]
79
- },
80
69
  "bin": {
81
70
  "rocket": "src/cli/cli.js"
82
71
  },
83
72
  "dependencies": {
84
73
  "@awesome.me/webawesome": "^3.7.0",
85
74
  "@lit-labs/ssr": "^4.1.0",
86
- "@sparticuz/chromium": "^148.0.0",
75
+ "@sparticuz/chromium": "^149.0.0",
87
76
  "@web/dev-server": "^0.4.6",
88
77
  "bootstrap-icons": "^1.13.1",
89
- "commander": "14.0.3",
78
+ "commander": "^15.0.0",
90
79
  "es-module-lexer": "^2.1.0",
91
80
  "lit": "^3.3.3",
92
- "parse5": "^7.3.0",
81
+ "parse5": "^8.0.1",
93
82
  "puppeteer-core": "^25.1.0",
94
83
  "rehype-autolink-headings": "^7.1.0",
95
84
  "rehype-prism-plus": "^2.0.2",
@@ -98,40 +87,33 @@
98
87
  "rehype-stringify": "^10.0.1",
99
88
  "remark-gfm": "^4.0.1",
100
89
  "remark-rehype": "^11.1.2",
101
- "typescript": "6.0.3",
90
+ "typescript": "^6.0.3",
102
91
  "unified": "^11.0.5",
103
- "unist-util-inspect": "8.1.0",
104
92
  "unist-util-remove": "^4.0.0",
105
93
  "unist-util-visit": "^5.1.0",
106
- "urlpattern-polyfill": "10.1.0",
94
+ "urlpattern-polyfill": "^10.1.0",
107
95
  "vite": "^8.0.14"
108
96
  },
109
97
  "devDependencies": {
110
98
  "@changesets/cli": "^2.31.0",
111
99
  "@eslint/eslintrc": "^3.3.5",
112
100
  "@eslint/js": "^10.0.1",
113
- "@netlify/functions": "^5.2.2",
114
101
  "@open-wc/testing": "^4.0.0",
115
102
  "@types/hast": "^3.0.4",
116
- "@types/mdast": "4.0.4",
117
- "@types/node": "^24.12.4",
103
+ "@types/mdast": "^4.0.4",
104
+ "@types/node": "^24.13.3",
118
105
  "@typescript-eslint/eslint-plugin": "^8.59.4",
119
106
  "@typescript-eslint/parser": "^8.59.4",
120
- "@web/mocks": "^2.0.0",
121
107
  "@web/test-runner": "^0.20.2",
122
- "@web/test-runner-playwright": "^0.11.1",
123
- "dotenv": "^17.4.2",
124
108
  "eslint": "^10.4.0",
125
109
  "eslint-config-prettier": "^10.1.8",
126
110
  "eslint-plugin-no-only-tests": "^3.4.0",
127
111
  "globals": "^17.6.0",
128
112
  "netlify-cli": "^26.0.2",
129
- "patch-package": "^8.0.1",
130
113
  "prettier": "^3.8.3",
131
114
  "prettier-plugin-packagejson": "^3.0.2",
132
- "typescript": "6.0.3",
133
115
  "typescript-eslint": "^8.59.4",
134
- "vfile": "6.0.3",
116
+ "vfile": "^6.0.3",
135
117
  "wireit": "^0.14.12"
136
118
  },
137
119
  "engines": {
@@ -145,7 +127,7 @@
145
127
  },
146
128
  "wireit": {
147
129
  "deploy": {
148
- "command": "rm -f ../../node_modules/ssh2/lib/protocol/crypto/build/Release/sshcrypto.node && netlify deploy --prod --site 2439aca3-b7d1-495c-bb8a-478ce089b666 --no-build",
130
+ "command": "netlify deploy --prod --site 2439aca3-b7d1-495c-bb8a-478ce089b666 --no-build",
149
131
  "files": [
150
132
  "dist/**/*"
151
133
  ],
@@ -159,7 +141,8 @@
159
141
  "command": "tsc --build --pretty",
160
142
  "files": [
161
143
  "src/**/*",
162
- "types/**/*",
144
+ "exports/**/*",
145
+ "docs/**/*.js",
163
146
  "tsconfig.json"
164
147
  ],
165
148
  "output": [
@@ -186,6 +169,7 @@
186
169
  "files": [
187
170
  "exports/**/*",
188
171
  "src/**/*",
172
+ "scripts/**/*.js",
189
173
  "!src/**/*.test-browser.js"
190
174
  ],
191
175
  "output": []
package/src/PageData.js CHANGED
@@ -26,11 +26,14 @@ export class PageData {
26
26
  url,
27
27
  { siteHeadMetadata, pageSiteHeadMetadata, defaultSocialPreviewImage, siteOrigin } = {},
28
28
  ) {
29
- const pageMetadata = typeof metadata === 'string' ? { title: metadata } : metadata;
29
+ // Copy so layout/page writes (e.g. the title setter) never mutate the
30
+ // shared Page Registry across renders.
31
+ const pageMetadata = typeof metadata === 'string' ? { title: metadata } : { ...metadata };
30
32
  this.pageRegistry = pageRegistry;
31
33
  /** @type {import('@rocket/js/types.js').PageRegistryQuery} */
32
34
  this.pages = new PageRegistryQuery(pageRegistry);
33
- this.pageTree = treeFromPages(pageRegistry);
35
+ /** @type {import('@rocket/js/types.js').PageTree | undefined} */
36
+ this._pageTree = undefined;
34
37
  this._clientCode = '';
35
38
  this._hydrationScript = '';
36
39
  /** @type {boolean} */
@@ -64,6 +67,13 @@ export class PageData {
64
67
  : undefined;
65
68
  }
66
69
 
70
+ get pageTree() {
71
+ if (!this._pageTree) {
72
+ this._pageTree = treeFromPages(this.pageRegistry);
73
+ }
74
+ return this._pageTree;
75
+ }
76
+
67
77
  get title() {
68
78
  return this.metadata.title;
69
79
  }
@@ -250,6 +250,7 @@ export class RocketJsDemo extends LitElement {
250
250
  background-color: #eee;
251
251
  width: 100%;
252
252
  overflow: hidden;
253
+ z-index: 0;
253
254
  }
254
255
 
255
256
  #resize {
@@ -3,6 +3,7 @@ import {
3
3
  DEFAULT_SOCIAL_PREVIEW_IMAGE_WIDTH,
4
4
  defaultSocialPreviewTemplate,
5
5
  } from './defaultSocialPreviewTemplate.js';
6
+ import { debounce } from './debounce.js';
6
7
 
7
8
  const DEFAULT_TITLE = 'Runtime Guide';
8
9
  const DEFAULT_DESCRIPTION = 'Learn how Acme UI components load, render, and ship with Rocket.';
@@ -81,22 +82,23 @@ export class SocialPreviewPlayground extends HTMLElement {
81
82
  this.templateFrame = null;
82
83
  /** @type {HTMLAnchorElement | null} */
83
84
  this.pngLink = null;
85
+ // Typing reloads the preview iframe and rewrites history, so batch keystrokes.
86
+ this.schedulePreviewUpdate = debounce(() => this.updatePreviewResources(), 150);
84
87
  }
85
88
 
86
89
  connectedCallback() {
87
- if (this.shadowRoot) {
88
- return;
90
+ if (!this.shadowRoot) {
91
+ this.config = this.readConfig();
92
+ this.state = this.initialState(this.config);
93
+ this.attachShadow({ mode: 'open' });
94
+ this.render();
95
+ this.connectControls();
96
+ this.updatePreviewResources();
89
97
  }
90
- this.config = this.readConfig();
91
- this.state = this.initialState(this.config);
92
- const shadowRoot = this.attachShadow({ mode: 'open' });
93
- this.render();
94
- this.connectControls();
95
- this.updatePreviewResources();
96
98
  this.resizePreviewFrame();
97
- const frame = shadowRoot.querySelector('[data-social-preview-frame-shell]');
99
+ const frame = this.shadowRoot?.querySelector('[data-social-preview-frame-shell]');
98
100
  if (frame && 'ResizeObserver' in window) {
99
- this.resizeObserver = new ResizeObserver(() => this.resizePreviewFrame());
101
+ this.resizeObserver ??= new ResizeObserver(() => this.resizePreviewFrame());
100
102
  this.resizeObserver.observe(frame);
101
103
  }
102
104
  }
@@ -160,8 +162,8 @@ export class SocialPreviewPlayground extends HTMLElement {
160
162
  const page = config.pages.find(candidate => candidate.path === config.selectedPath);
161
163
  return {
162
164
  selectedPath: page?.path ?? config.selectedPath,
163
- title: config.defaultTitle || page?.title || DEFAULT_TITLE,
164
- description: config.defaultDescription || page?.description || DEFAULT_DESCRIPTION,
165
+ title: page?.title || config.defaultTitle,
166
+ description: page?.description || config.defaultDescription,
165
167
  };
166
168
  }
167
169
 
@@ -423,11 +425,11 @@ export class SocialPreviewPlayground extends HTMLElement {
423
425
  });
424
426
  titleInput?.addEventListener('input', () => {
425
427
  this.state.title = titleInput.value;
426
- this.updatePreviewResources();
428
+ this.schedulePreviewUpdate();
427
429
  });
428
430
  descriptionInput?.addEventListener('input', () => {
429
431
  this.state.description = descriptionInput.value;
430
- this.updatePreviewResources();
432
+ this.schedulePreviewUpdate();
431
433
  });
432
434
  shadowRoot
433
435
  .querySelector('button[data-social-preview-previous-page]')
@@ -506,7 +508,11 @@ export class SocialPreviewPlayground extends HTMLElement {
506
508
  return;
507
509
  }
508
510
  if (this.config.templateUrl) {
509
- this.templateFrame.src = this.socialPreviewResourcePath(this.config.templateUrl);
511
+ const templateSrc = this.socialPreviewResourcePath(this.config.templateUrl);
512
+ // assigning an unchanged src still reloads the iframe, so compare first
513
+ if (this.templateFrame.getAttribute('src') !== templateSrc) {
514
+ this.templateFrame.src = templateSrc;
515
+ }
510
516
  } else {
511
517
  this.templateFrame.srcdoc = this.previewHtml();
512
518
  }
@@ -515,11 +521,11 @@ export class SocialPreviewPlayground extends HTMLElement {
515
521
  this.pngLink.download = this.selectedPage()?.downloadFilename ?? 'social-preview.png';
516
522
  }
517
523
  if (this.config.syncHistory && this.config.workflowUrl) {
518
- window.history.replaceState(
519
- null,
520
- '',
521
- this.socialPreviewResourcePath(this.config.workflowUrl),
522
- );
524
+ const workflowPath = this.socialPreviewResourcePath(this.config.workflowUrl);
525
+ const currentPath = `${window.location.pathname}${window.location.search}`;
526
+ if (workflowPath !== currentPath) {
527
+ window.history.replaceState(null, '', workflowPath);
528
+ }
523
529
  }
524
530
  }
525
531
 
@@ -3,6 +3,11 @@
3
3
 
4
4
  /**
5
5
  * Turns a MessagePort into an AsyncPort, which can wait for responses.
6
+ *
7
+ * Do not use sendAndWait from inside module customization hooks: the main
8
+ * thread may be blocked in Atomics.wait (e.g. during a nested
9
+ * module.register() call) and unable to reply, which deadlocks the hook.
10
+ *
6
11
  * @param {MessagePort} port
7
12
  * @returns {AsyncPort}
8
13
  */
@@ -13,9 +18,10 @@ export function makeAsyncPort(port) {
13
18
  p._wait.resolve(message);
14
19
  p._wait = Promise.withResolvers();
15
20
  });
16
- p.sendAndWait = async message => {
21
+ p.sendAndWait = message => {
22
+ const wait = p._wait;
17
23
  p.postMessage(message);
18
- return p._wait;
24
+ return wait.promise;
19
25
  };
20
26
  return p;
21
27
  }