@primate/svelte 0.11.1 → 0.12.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 (2) hide show
  1. package/package.json +3 -3
  2. package/src/module.js +5 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primate/svelte",
3
- "version": "0.11.1",
3
+ "version": "0.12.0",
4
4
  "description": "Primate Svelte module",
5
5
  "homepage": "https://primatejs.com/modules/svelte",
6
6
  "bugs": "https://github.com/primatejs/primate/issues",
@@ -16,8 +16,8 @@
16
16
  "directory": "packages/svelte"
17
17
  },
18
18
  "dependencies": {
19
- "runtime-compat": "^0.20.2",
20
- "svelte": "^3.59.1"
19
+ "runtime-compat": "^0.21.0",
20
+ "svelte": "^4.0.0"
21
21
  },
22
22
  "peerDependencies": {
23
23
  "primate": "0.20"
package/src/module.js CHANGED
@@ -1,6 +1,7 @@
1
+ import crypto from "runtime-compat/crypto";
1
2
  import {Path} from "runtime-compat/fs";
2
3
  import * as compiler from "svelte/compiler";
3
- import {tryreturn} from "runtime-compat/flow";
4
+ import {tryreturn} from "runtime-compat/async";
4
5
  import errors from "./errors.js";
5
6
 
6
7
  const endings = {
@@ -45,7 +46,6 @@ const handler = ({path}) => (name, props = {}, {status = 200, page} = {}) =>
45
46
  if (as_layout) {
46
47
  return make(name, props);
47
48
  }
48
- const headers = app.headers();
49
49
  const components = (await Promise.all(layouts.map(layout =>
50
50
  layout(app, {as_layout: true})
51
51
  )))
@@ -75,10 +75,9 @@ const handler = ({path}) => (name, props = {}, {status = 200, page} = {}) =>
75
75
  });
76
76
  `;
77
77
 
78
- const integrity = await app.publish({code, type, inline: true});
79
- // hacky, CSP should be a map that gets flattened in the end
80
- headers["Content-Security-Policy"] = headers["Content-Security-Policy"]
81
- .replace("script-src 'self' ", `script-src 'self' '${integrity}' `);
78
+ await app.publish({code, type, inline: true});
79
+ // needs to be called before app.render
80
+ const headers = app.headers();
82
81
 
83
82
  // -> spread into new Response()
84
83
  return [await app.render({body: html, page}), {