@primate/html 0.12.0 → 0.16.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.
@@ -1,8 +1,8 @@
1
1
  import Runtime from "#Runtime";
2
- import dedent from "@rcompat/string/dedent";
2
+ import string from "@rcompat/string";
3
3
  export default class Default extends Runtime {
4
4
  compile = {
5
- server: (text) => dedent `
5
+ server: (text) => string.dedent `
6
6
  import render from "@primate/html/render";
7
7
 
8
8
  export default props => render(${JSON.stringify(text)}, props);`,
@@ -1,4 +1,4 @@
1
- import type Dict from "@rcompat/type/Dict";
1
+ import type { Dict } from "@rcompat/type";
2
2
  /**
3
3
  * Render an HTML template with ${...} interpolation outside shielded tags.
4
4
  * - Shield <script>/<style>/<template>/<textarea> so their contents are kept
@@ -1,4 +1,4 @@
1
- import escape from "@rcompat/html/escape";
1
+ import HTML from "@rcompat/html";
2
2
  const TAGS = ["script", "style", "template", "textarea"];
3
3
  const token = (i) => `__SLOT_${i}__`;
4
4
  function shield(html) {
@@ -65,7 +65,7 @@ export default function render(template, props) {
65
65
  // deep-escape all strings in props (JSON-serializable only)
66
66
  let safe;
67
67
  try {
68
- safe = JSON.parse(escape(JSON.stringify(props)));
68
+ safe = JSON.parse(HTML.escape(JSON.stringify(props)));
69
69
  }
70
70
  catch {
71
71
  throw new Error("render(): props must be JSON-serializable for escaping");
@@ -0,0 +1,3 @@
1
+ declare const _default: {};
2
+ export default _default;
3
+ //# sourceMappingURL=browser.d.ts.map
@@ -0,0 +1,2 @@
1
+ export default {};
2
+ //# sourceMappingURL=browser.js.map
package/package.json CHANGED
@@ -1,30 +1,32 @@
1
1
  {
2
2
  "name": "@primate/html",
3
- "version": "0.12.0",
4
- "description": "Primate HTML frontend",
3
+ "version": "0.16.0",
4
+ "description": "HTML for Primate",
5
5
  "homepage": "https://primate.run/docs/frontend/html",
6
6
  "bugs": "https://github.com/primate-run/primate/issues",
7
+ "type": "module",
7
8
  "license": "MIT",
8
- "files": [
9
- "/lib/**/*.js",
10
- "/lib/**/*.d.ts",
11
- "!/**/*.spec.*"
12
- ],
13
9
  "repository": {
14
10
  "type": "git",
15
11
  "url": "https://github.com/primate-run/primate",
16
12
  "directory": "packages/html"
17
13
  },
14
+ "files": [
15
+ "/lib/**/*.js",
16
+ "/lib/**/*.d.ts",
17
+ "!/**/*.spec.*"
18
+ ],
18
19
  "dependencies": {
19
- "@rcompat/assert": "^0.3.1",
20
- "@rcompat/html": "^0.6.0",
21
- "@rcompat/string": "^0.10.0",
22
- "@primate/core": "^0.3.0"
20
+ "@rcompat/html": "^0.9.0",
21
+ "@rcompat/string": "^0.13.0",
22
+ "@primate/core": "^0.5.0"
23
+ },
24
+ "devDependencies": {
25
+ "@rcompat/type": "^0.9.0"
23
26
  },
24
27
  "peerDependencies": {
25
- "primate": "^0.34.0"
28
+ "primate": "^0.36.0"
26
29
  },
27
- "type": "module",
28
30
  "imports": {
29
31
  "#*": {
30
32
  "apekit": "./src/private/*.ts",
@@ -33,6 +35,7 @@
33
35
  },
34
36
  "exports": {
35
37
  ".": {
38
+ "browser": "./lib/public/browser.js",
36
39
  "runtime": "./lib/public/runtime.js",
37
40
  "default": "./lib/public/default.js"
38
41
  },