@primate/core 0.9.15 → 0.9.16

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,3 @@
1
+ import type Asset from "#asset/Asset";
2
+ export default function client_app_asset(asset: Asset): boolean;
3
+ //# sourceMappingURL=client-app-asset.d.ts.map
@@ -0,0 +1,6 @@
1
+ const app = /^app(?:-[A-Z0-9]+)?\.js$/i;
2
+ export default function client_app_asset(asset) {
3
+ const file = asset.src?.split("/").at(-1);
4
+ return file !== undefined && app.test(file);
5
+ }
6
+ //# sourceMappingURL=client-app-asset.js.map
@@ -1,3 +1,4 @@
1
+ import client_app_asset from "#client-app-asset";
1
2
  import E from "#errors";
2
3
  import html_safe_json from "#html-safe-json";
3
4
  import inline from "#inline";
@@ -44,7 +45,7 @@ export default function frontend_module(init) {
44
45
  : { body: "", head: "" };
45
46
  if (!init.client) {
46
47
  if (app.mode === "development") {
47
- const asset = app.assets.find(a => a.src?.includes("app") && a.src.endsWith(".js"));
48
+ const asset = app.assets.find(client_app_asset);
48
49
  if (asset === undefined)
49
50
  throw E.frontend_missing_app_js();
50
51
  const app_script = `<script type="module" src="${asset.src}"></script>`;
@@ -55,7 +56,7 @@ export default function frontend_module(init) {
55
56
  const interactive = !ssr() || csr;
56
57
  if (!interactive)
57
58
  return { body, head, headers };
58
- const app_asset = app.assets.find(asset => asset.src?.includes("app") && asset.src.endsWith(".js"));
59
+ const app_asset = app.assets.find(client_app_asset);
59
60
  if (app_asset === undefined)
60
61
  throw E.frontend_missing_app_js();
61
62
  const app_script = `<script type="module" src="${app_asset.src}"></script>`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primate/core",
3
- "version": "0.9.15",
3
+ "version": "0.9.16",
4
4
  "description": "The universal web framework",
5
5
  "homepage": "https://primate.run",
6
6
  "bugs": "https://github.com/primate-run/primate/issues",