@kaliber/build 0.0.127 → 0.0.128

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,5 @@
1
1
  import ReactDom from 'react-dom'
2
+ import { safeJsonStringify } from '@kaliber/safe-json-stringify'
2
3
 
3
4
  const containerMarker = 'data-kaliber-component-container'
4
5
 
@@ -83,10 +84,11 @@ function groupComponentsByName(allComponents) {
83
84
  }
84
85
 
85
86
  function restructureDomNodes(componentInfo) {
87
+ const safeComponentInfo = safeJsonStringify(componentInfo)
86
88
  return `|var d=document,s=d.currentScript,p=s.parentNode,c=s.previousSibling;
87
89
  |p.setAttribute('${containerMarker}',''); // set marker on container so we can retrieve nodes that contain components
88
90
  |p.replaceChild(d.createComment('start'),c); // replace kaliber-component-container element with a 'start' comment
89
- |p.insertBefore(d.createComment(JSON.stringify(${componentInfo})),s); // create a comment containing the component info
91
+ |p.insertBefore(d.createComment(${safeComponentInfo}),s); // create a comment containing the component info
90
92
  |Array.from(c.childNodes).forEach(x=>{p.insertBefore(x,s)}); // insert all children from the kaliber-component-container element
91
93
  |p.replaceChild(d.createComment('end'),s); // create an 'end' comment
92
94
  |`.replace(/^\s*\|/gm, '').replace(/\s*\/\/[^;]*?$/gm, '').replace(/\n/g, '')
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.127",
2
+ "version": "0.0.128",
3
3
  "name": "@kaliber/build",
4
4
  "description": "Zero configuration, opinionated webpack / react build setup",
5
5
  "scripts": {
@@ -29,6 +29,7 @@
29
29
  "@babel/runtime": "^7.11.2",
30
30
  "@kaliber/config": "^0.0.8",
31
31
  "@kaliber/eslint-plugin": "*",
32
+ "@kaliber/safe-json-stringify": "^1.1.0",
32
33
  "ansi-regex": "^5.0.0",
33
34
  "babel-loader": "^8.0.6",
34
35
  "cache-loader": "^4.1.0",