@primate/core 0.9.15 → 0.9.17

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.
@@ -51,8 +51,8 @@ export default (frontend, u) => {
51
51
  event.preventDefault();
52
52
  const target = event.target;
53
53
  const { enctype } = target;
54
- const action = target.action ?? location.pathname;
55
- const url = new URL(action);
54
+ const action = target.getAttribute("action") ?? location.href;
55
+ const url = new URL(action, location.href);
56
56
  const data = new FormData(target);
57
57
  const form = enctype === http.MIME.MULTIPART_FORM_DATA
58
58
  ? data
@@ -119,7 +119,9 @@ function createForm(init) {
119
119
  const method = init.method
120
120
  ?? form_element.method.toUpperCase()
121
121
  ?? "POST";
122
- const url = init.url ?? form_element.action;
122
+ const url = init.url
123
+ ?? form_element.getAttribute("action")
124
+ ?? globalThis.location.href;
123
125
  const form_data = new FormData(form_element);
124
126
  setSubmitting(true);
125
127
  try {
@@ -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.17",
4
4
  "description": "The universal web framework",
5
5
  "homepage": "https://primate.run",
6
6
  "bugs": "https://github.com/primate-run/primate/issues",
@@ -35,7 +35,7 @@
35
35
  "@rcompat/symbol": "^0.3.0",
36
36
  "@rcompat/type": "^0.18.0",
37
37
  "esbuild": "^0.28.1",
38
- "pema": "^0.9.1"
38
+ "pema": "^0.9.2"
39
39
  },
40
40
  "imports": {
41
41
  "#i18n/config": {