preact-render-to-string 6.4.0 → 6.4.1

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/package.json CHANGED
@@ -1,153 +1,159 @@
1
1
  {
2
- "name": "preact-render-to-string",
3
- "amdName": "preactRenderToString",
4
- "version": "6.4.0",
5
- "description": "Render JSX to an HTML string, with support for Preact components.",
6
- "main": "dist/index.js",
7
- "umd:main": "dist/index.umd.js",
8
- "module": "dist/index.module.js",
9
- "jsnext:main": "dist/index.module.js",
10
- "types": "src/index.d.ts",
11
- "exports": {
12
- ".": {
13
- "types": "./src/index.d.ts",
14
- "browser": "./dist/index.module.js",
15
- "umd": "./dist/index.umd.js",
16
- "import": "./dist/index.mjs",
17
- "require": "./dist/index.js"
18
- },
19
- "./jsx": {
20
- "types": "./jsx.d.ts",
21
- "browser": "./dist/jsx.module.js",
22
- "umd": "./dist/jsx.umd.js",
23
- "import": "./dist/jsx.mjs",
24
- "require": "./dist/jsx.js"
25
- },
26
- "./package.json": "./package.json"
27
- },
28
- "scripts": {
29
- "bench": "BABEL_ENV=test node -r @babel/register benchmarks index.js",
30
- "bench:v8": "BABEL_ENV=test microbundle benchmarks/index.js -f modern --alias benchmarkjs-pretty=benchmarks/lib/benchmark-lite.js --external none --target node --no-compress --no-sourcemap --raw -o benchmarks/.v8.mjs && v8 --module benchmarks/.v8.mjs",
31
- "build": "npm run -s transpile && npm run -s transpile:jsx && npm run -s copy-typescript-definition",
32
- "postbuild": "node ./config/node-13-exports.js && node ./config/node-commonjs.js && node ./config/node-verify-exports.js",
33
- "transpile": "microbundle src/index.js -f es,cjs,umd --target web --external preact",
34
- "transpile:jsx": "microbundle src/jsx.js -o dist/jsx.js --target web --external preact && microbundle dist/jsx.js -o dist/jsx.js -f cjs --external preact",
35
- "copy-typescript-definition": "copyfiles -f src/*.d.ts dist",
36
- "test": "eslint src test && tsc && npm run test:mocha && npm run test:mocha:compat && npm run test:mocha:debug && npm run bench",
37
- "test:mocha": "BABEL_ENV=test mocha -r @babel/register -r test/setup.js test/*.test.js",
38
- "test:mocha:compat": "BABEL_ENV=test mocha -r @babel/register -r test/setup.js 'test/compat/*.test.js'",
39
- "test:mocha:debug": "BABEL_ENV=test mocha -r @babel/register -r test/setup.js 'test/debug/index.test.js'",
40
- "format": "prettier src/**/*.{d.ts,js} test/**/*.js --write",
41
- "prepublishOnly": "npm run build",
42
- "release": "npm run build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish"
43
- },
44
- "keywords": [
45
- "preact",
46
- "render",
47
- "universal",
48
- "isomorphic"
49
- ],
50
- "files": [
51
- "src",
52
- "dist",
53
- "jsx.js",
54
- "jsx.d.ts",
55
- "typings.json"
56
- ],
57
- "eslintConfig": {
58
- "extends": "developit",
59
- "rules": {
60
- "react/prefer-stateless-function": 0,
61
- "react/jsx-no-bind": 0,
62
- "react/no-danger": 0,
63
- "jest/valid-expect": 0,
64
- "new-cap": 0,
65
- "curly": "off",
66
- "brace-style": "off",
67
- "indent": "off"
68
- },
69
- "settings": {
70
- "react": {
71
- "version": "16.8"
72
- }
73
- }
74
- },
75
- "babel": {
76
- "env": {
77
- "test": {
78
- "presets": [
79
- [
80
- "@babel/preset-env",
81
- {
82
- "targets": {
83
- "node": true
84
- }
85
- }
86
- ]
87
- ],
88
- "plugins": [
89
- [
90
- "@babel/plugin-transform-react-jsx",
91
- {
92
- "pragma": "h"
93
- }
94
- ]
95
- ]
96
- }
97
- }
98
- },
99
- "minify": {
100
- "compress": {
101
- "reduce_funcs": false
102
- }
103
- },
104
- "author": "Jason Miller <jason@developit.ca>",
105
- "license": "MIT",
106
- "repository": "developit/preact-render-to-string",
107
- "bugs": "https://github.com/developit/preact-render-to-string/issues",
108
- "homepage": "https://github.com/developit/preact-render-to-string",
109
- "peerDependencies": {
110
- "preact": ">=10"
111
- },
112
- "devDependencies": {
113
- "@babel/plugin-transform-react-jsx": "^7.22.15",
114
- "@babel/preset-env": "^7.23.2",
115
- "@babel/register": "^7.22.15",
116
- "@changesets/changelog-github": "^0.4.1",
117
- "@changesets/cli": "^2.18.0",
118
- "benchmarkjs-pretty": "^2.0.1",
119
- "chai": "^4.3.10",
120
- "copyfiles": "^2.4.1",
121
- "eslint": "^7.16.0",
122
- "eslint-config-developit": "^1.2.0",
123
- "husky": "^4.3.6",
124
- "lint-staged": "^10.5.3",
125
- "microbundle": "^0.15.1",
126
- "mocha": "^10.2.0",
127
- "baseline-rts": "npm:preact-render-to-string@latest",
128
- "preact": "^10.13.0",
129
- "prettier": "^2.2.1",
130
- "sinon": "^9.2.2",
131
- "sinon-chai": "^3.5.0",
132
- "typescript": "^5.0.0"
133
- },
134
- "dependencies": {
135
- "pretty-format": "^3.8.0"
136
- },
137
- "prettier": {
138
- "singleQuote": true,
139
- "trailingComma": "none",
140
- "useTabs": true,
141
- "tabWidth": 2
142
- },
143
- "lint-staged": {
144
- "**/*.{js,jsx,ts,tsx,yml}": [
145
- "prettier --write"
146
- ]
147
- },
148
- "husky": {
149
- "hooks": {
150
- "pre-commit": "lint-staged"
151
- }
152
- }
2
+ "name": "preact-render-to-string",
3
+ "amdName": "preactRenderToString",
4
+ "version": "6.4.1",
5
+ "description": "Render JSX to an HTML string, with support for Preact components.",
6
+ "main": "dist/index.js",
7
+ "umd:main": "dist/index.umd.js",
8
+ "module": "dist/index.module.js",
9
+ "jsnext:main": "dist/index.module.js",
10
+ "types": "src/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./src/index.d.ts",
14
+ "browser": "./dist/index.module.js",
15
+ "umd": "./dist/index.umd.js",
16
+ "import": "./dist/index.mjs",
17
+ "require": "./dist/index.js"
18
+ },
19
+ "./jsx": {
20
+ "types": "./jsx.d.ts",
21
+ "browser": "./dist/jsx.module.js",
22
+ "umd": "./dist/jsx.umd.js",
23
+ "import": "./dist/jsx.mjs",
24
+ "require": "./dist/jsx.js"
25
+ },
26
+ "./package.json": "./package.json"
27
+ },
28
+ "scripts": {
29
+ "bench": "BABEL_ENV=test node -r @babel/register benchmarks index.js",
30
+ "bench:v8": "BABEL_ENV=test microbundle benchmarks/index.js -f modern --alias benchmarkjs-pretty=benchmarks/lib/benchmark-lite.js --external none --target node --no-compress --no-sourcemap --raw -o benchmarks/.v8.mjs && v8 --module benchmarks/.v8.mjs",
31
+ "build": "npm run -s transpile && npm run -s transpile:jsx && npm run -s copy-typescript-definition",
32
+ "postbuild": "node ./config/node-13-exports.js && node ./config/node-commonjs.js && node ./config/node-verify-exports.js",
33
+ "transpile": "microbundle src/index.js -f es,cjs,umd --target web --external preact",
34
+ "transpile:jsx": "microbundle src/jsx.js -o dist/jsx.js --target web --external preact && microbundle dist/jsx.js -o dist/jsx.js -f cjs --external preact",
35
+ "copy-typescript-definition": "copyfiles -f src/*.d.ts dist",
36
+ "test": "eslint src test && tsc && npm run test:mocha && npm run test:mocha:compat && npm run test:mocha:debug && npm run bench",
37
+ "test:mocha": "BABEL_ENV=test mocha -r @babel/register -r test/setup.js test/*.test.js",
38
+ "test:mocha:compat": "BABEL_ENV=test mocha -r @babel/register -r test/setup.js 'test/compat/*.test.js'",
39
+ "test:mocha:debug": "BABEL_ENV=test mocha -r @babel/register -r test/setup.js 'test/debug/index.test.js'",
40
+ "format": "prettier src/**/*.{d.ts,js} test/**/*.js --write",
41
+ "prepublishOnly": "npm run build",
42
+ "release": "npm run build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish"
43
+ },
44
+ "keywords": [
45
+ "preact",
46
+ "render",
47
+ "universal",
48
+ "isomorphic"
49
+ ],
50
+ "files": [
51
+ "src",
52
+ "dist",
53
+ "jsx.js",
54
+ "jsx.d.ts",
55
+ "typings.json"
56
+ ],
57
+ "eslintConfig": {
58
+ "extends": "developit",
59
+ "rules": {
60
+ "react/prefer-stateless-function": 0,
61
+ "react/jsx-no-bind": 0,
62
+ "react/no-danger": 0,
63
+ "jest/valid-expect": 0,
64
+ "new-cap": 0,
65
+ "curly": "off",
66
+ "brace-style": "off",
67
+ "indent": "off"
68
+ },
69
+ "settings": {
70
+ "react": {
71
+ "version": "16.8"
72
+ }
73
+ }
74
+ },
75
+ "babel": {
76
+ "env": {
77
+ "test": {
78
+ "presets": [
79
+ [
80
+ "@babel/preset-env",
81
+ {
82
+ "targets": {
83
+ "node": true
84
+ }
85
+ }
86
+ ]
87
+ ],
88
+ "plugins": [
89
+ [
90
+ "@babel/plugin-transform-react-jsx",
91
+ {
92
+ "pragma": "h"
93
+ }
94
+ ]
95
+ ]
96
+ }
97
+ }
98
+ },
99
+ "minify": {
100
+ "compress": {
101
+ "reduce_funcs": false
102
+ }
103
+ },
104
+ "author": "Jason Miller <jason@developit.ca>",
105
+ "license": "MIT",
106
+ "repository": {
107
+ "type": "git",
108
+ "url": "https://github.com/preactjs/preact-render-to-string"
109
+ },
110
+ "bugs": "https://github.com/developit/preact-render-to-string/issues",
111
+ "homepage": "https://github.com/developit/preact-render-to-string",
112
+ "peerDependencies": {
113
+ "preact": ">=10"
114
+ },
115
+ "devDependencies": {
116
+ "@babel/plugin-transform-react-jsx": "^7.22.15",
117
+ "@babel/preset-env": "^7.23.2",
118
+ "@babel/register": "^7.22.15",
119
+ "@changesets/changelog-github": "^0.4.1",
120
+ "@changesets/cli": "^2.18.0",
121
+ "benchmarkjs-pretty": "^2.0.1",
122
+ "chai": "^4.3.10",
123
+ "copyfiles": "^2.4.1",
124
+ "eslint": "^7.16.0",
125
+ "eslint-config-developit": "^1.2.0",
126
+ "husky": "^4.3.6",
127
+ "lint-staged": "^10.5.3",
128
+ "microbundle": "^0.15.1",
129
+ "mocha": "^10.2.0",
130
+ "baseline-rts": "npm:preact-render-to-string@latest",
131
+ "preact": "^10.13.0",
132
+ "prettier": "^2.2.1",
133
+ "sinon": "^9.2.2",
134
+ "sinon-chai": "^3.5.0",
135
+ "typescript": "^5.0.0"
136
+ },
137
+ "dependencies": {
138
+ "pretty-format": "^3.8.0"
139
+ },
140
+ "prettier": {
141
+ "singleQuote": true,
142
+ "trailingComma": "none",
143
+ "useTabs": true,
144
+ "tabWidth": 2
145
+ },
146
+ "lint-staged": {
147
+ "**/*.{js,jsx,ts,tsx,yml}": [
148
+ "prettier --write"
149
+ ]
150
+ },
151
+ "husky": {
152
+ "hooks": {
153
+ "pre-commit": "lint-staged"
154
+ }
155
+ },
156
+ "publishConfig": {
157
+ "provenance": true
158
+ }
153
159
  }
package/src/index.js CHANGED
@@ -425,7 +425,7 @@ function _renderToString(
425
425
  return str;
426
426
  } finally {
427
427
  if (afterDiff) afterDiff(vnode);
428
- vnode[PARENT] = undefined;
428
+ vnode[PARENT] = null;
429
429
 
430
430
  if (ummountHook) ummountHook(vnode);
431
431
  }
@@ -453,7 +453,7 @@ function _renderToString(
453
453
  const str = renderChildren();
454
454
 
455
455
  if (afterDiff) afterDiff(vnode);
456
- vnode[PARENT] = undefined;
456
+ vnode[PARENT] = null;
457
457
 
458
458
  if (ummountHook) ummountHook(vnode);
459
459
 
@@ -467,6 +467,8 @@ function _renderToString(
467
467
  try {
468
468
  return renderChildren();
469
469
  } catch (e) {
470
+ if (!e || typeof e.then !== 'function') throw e;
471
+
470
472
  return e.then(
471
473
  () => renderChildren(),
472
474
  () => renderNestedChildren()
@@ -616,7 +618,7 @@ function _renderToString(
616
618
  }
617
619
 
618
620
  if (afterDiff) afterDiff(vnode);
619
- vnode[PARENT] = undefined;
621
+ vnode[PARENT] = null;
620
622
  if (ummountHook) ummountHook(vnode);
621
623
 
622
624
  // Emit self-closing tag for empty void elements: