@primate/htmx 0.20.0 → 0.22.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.
@@ -22,12 +22,16 @@ export default class Default extends Runtime {
22
22
  !empty(this.#templates);
23
23
  }
24
24
  publish(app) {
25
- app.export(`export { default as htmx } from "${htmx_esm}";`);
26
- this.#extensions.map(extension => app.export(`${_export}/${extension}";`));
25
+ app.entrypoint(`export { default as htmx } from "${htmx_esm}";`);
26
+ this.#extensions.forEach(extension => {
27
+ app.entrypoint(`export * from "${htmx_esm}/${extension}";`);
28
+ });
27
29
  if (this.#has_templates) {
28
30
  this.#templates
29
31
  .filter(template => template !== "xslt")
30
- .map(template => app.export(`${_export}/templates/${template}";`));
32
+ .forEach(template => {
33
+ app.entrypoint(`export * from "${htmx_esm}/templates/${template}";`);
34
+ });
31
35
  }
32
36
  }
33
37
  }
@@ -1,5 +1,5 @@
1
+ import fail from "@primate/core/fail";
1
2
  import FrontendModule from "@primate/core/frontend/Module";
2
- import inline from "@primate/core/inline";
3
3
  import response from "@primate/html/response";
4
4
  export default class Runtime extends FrontendModule {
5
5
  name = "htmx";
@@ -8,12 +8,12 @@ export default class Runtime extends FrontendModule {
8
8
  client = false;
9
9
  respond = (name, props, options = {}) => {
10
10
  return async (app, _, request) => {
11
- const code = "import { htmx } from \"app\";";
12
- const { head, integrity } = await inline(code, "module");
13
- const script_src = [integrity];
11
+ const app_js = app.assets.find(asset => asset.src?.includes("app") && asset.src.endsWith(".js"));
12
+ if (!app_js)
13
+ throw fail("Could not find app.js in assets");
14
+ const script = `<script type="module" src="${app_js.src}"></script>`;
14
15
  return response(this)(name, props, {
15
- csp: { script_src },
16
- head,
16
+ head: script,
17
17
  partial: Boolean(request.headers.try("hx-request")),
18
18
  ...options,
19
19
  })(app, _, request);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primate/htmx",
3
- "version": "0.20.0",
3
+ "version": "0.22.0",
4
4
  "description": "Primate HTMX frontend",
5
5
  "homepage": "https://primate.run/docs/frontend/htmx",
6
6
  "bugs": "https://github.com/primate-run/primate/issues",
@@ -17,16 +17,16 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "@rcompat/assert": "^0.3.1",
20
- "@rcompat/fs": "^0.21.1",
20
+ "@rcompat/fs": "^0.22.3",
21
21
  "@rcompat/html": "^0.6.0",
22
22
  "@rcompat/record": "^0.9.1",
23
23
  "@rcompat/string": "^0.10.0",
24
24
  "htmx-esm": "^0.2.1910",
25
- "@primate/html": "^0.11.0",
26
- "@primate/core": "^0.2.0"
25
+ "@primate/core": "^0.4.0",
26
+ "@primate/html": "^0.15.0"
27
27
  },
28
28
  "peerDependencies": {
29
- "primate": "^0.33.0"
29
+ "primate": "^0.35.0"
30
30
  },
31
31
  "type": "module",
32
32
  "imports": {