@primate/html 0.15.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.
- package/lib/private/Default.js +2 -2
- package/lib/private/render.d.ts +1 -1
- package/lib/private/render.js +2 -2
- package/lib/public/browser.d.ts +3 -0
- package/lib/public/browser.js +2 -0
- package/package.json +16 -13
package/lib/private/Default.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import Runtime from "#Runtime";
|
|
2
|
-
import
|
|
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);`,
|
package/lib/private/render.d.ts
CHANGED
package/lib/private/render.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
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");
|
package/package.json
CHANGED
|
@@ -1,30 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primate/html",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
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/
|
|
20
|
-
"@rcompat/
|
|
21
|
-
"@
|
|
22
|
-
|
|
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.
|
|
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
|
},
|