@jay-framework/compiler-jay-html 0.15.6 → 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.
Files changed (2) hide show
  1. package/dist/index.js +11 -8
  2. package/package.json +9 -9
package/dist/index.js CHANGED
@@ -14359,6 +14359,9 @@ function filterContentNodes(childNodes, onlyIfMultiple = false) {
14359
14359
  function textEscape$1(s) {
14360
14360
  return s.replace(/'/g, "\\'");
14361
14361
  }
14362
+ function escapeForJsString(s) {
14363
+ return s.replace(/\\/g, "\\\\").replace(/'/g, "\\'").replace(/\n/g, "\\n").replace(/\r/g, "\\r");
14364
+ }
14362
14365
  const PROPERTY = 1;
14363
14366
  const BOOLEAN_ATTRIBUTE = 3;
14364
14367
  const propertyMapping = {
@@ -22411,7 +22414,7 @@ function renderServerAttributes(element, context) {
22411
22414
  )
22412
22415
  );
22413
22416
  } else {
22414
- const escaped = attrValue.replace(/\\/g, "\\\\").replace(/'/g, "\\'");
22417
+ const escaped = escapeForJsString(attrValue);
22415
22418
  parts.push(w(indent, `' ${attrCanonical}="${escaped}"'`));
22416
22419
  }
22417
22420
  } else if (attrCanonical === "class") {
@@ -22426,7 +22429,7 @@ function renderServerAttributes(element, context) {
22426
22429
  )
22427
22430
  );
22428
22431
  } else {
22429
- const escaped = attrValue.replace(/\\/g, "\\\\").replace(/'/g, "\\'");
22432
+ const escaped = escapeForJsString(attrValue);
22430
22433
  parts.push(w(indent, `' class="${escaped}"'`));
22431
22434
  }
22432
22435
  } else if (attrCanonical === "style") {
@@ -22443,7 +22446,7 @@ function renderServerAttributes(element, context) {
22443
22446
  )
22444
22447
  );
22445
22448
  } else {
22446
- const escaped = attrValue.replace(/\\/g, "\\\\").replace(/'/g, "\\'");
22449
+ const escaped = escapeForJsString(attrValue);
22447
22450
  parts.push(w(indent, `' style="${escaped}"'`));
22448
22451
  }
22449
22452
  } else {
@@ -22460,7 +22463,7 @@ function renderServerAttributes(element, context) {
22460
22463
  )
22461
22464
  );
22462
22465
  } else {
22463
- const escaped = attrValue.replace(/\\/g, "\\\\").replace(/'/g, "\\'");
22466
+ const escaped = escapeForJsString(attrValue);
22464
22467
  parts.push(w(indent, `' ${attrCanonical}="${escaped}"'`));
22465
22468
  }
22466
22469
  }
@@ -22609,7 +22612,7 @@ function renderServerAttributesAsString(element, context) {
22609
22612
  )
22610
22613
  );
22611
22614
  } else {
22612
- const escaped = attrValue.replace(/\\/g, "\\\\").replace(/'/g, "\\'");
22615
+ const escaped = escapeForJsString(attrValue);
22613
22616
  parts.push(new RenderFragment(`' ${attrCanonical}="${escaped}"'`));
22614
22617
  }
22615
22618
  } else if (attrCanonical === "class") {
@@ -22623,7 +22626,7 @@ function renderServerAttributesAsString(element, context) {
22623
22626
  )
22624
22627
  );
22625
22628
  } else {
22626
- const escaped = attrValue.replace(/\\/g, "\\\\").replace(/'/g, "\\'");
22629
+ const escaped = escapeForJsString(attrValue);
22627
22630
  parts.push(new RenderFragment(`' class="${escaped}"'`));
22628
22631
  }
22629
22632
  } else if (attrCanonical === "style") {
@@ -22639,7 +22642,7 @@ function renderServerAttributesAsString(element, context) {
22639
22642
  )
22640
22643
  );
22641
22644
  } else {
22642
- const escaped = attrValue.replace(/\\/g, "\\\\").replace(/'/g, "\\'");
22645
+ const escaped = escapeForJsString(attrValue);
22643
22646
  parts.push(new RenderFragment(`' style="${escaped}"'`));
22644
22647
  }
22645
22648
  } else {
@@ -22655,7 +22658,7 @@ function renderServerAttributesAsString(element, context) {
22655
22658
  )
22656
22659
  );
22657
22660
  } else {
22658
- const escaped = attrValue.replace(/\\/g, "\\\\").replace(/'/g, "\\'");
22661
+ const escaped = escapeForJsString(attrValue);
22659
22662
  parts.push(new RenderFragment(`' ${attrCanonical}="${escaped}"'`));
22660
22663
  }
22661
22664
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jay-framework/compiler-jay-html",
3
- "version": "0.15.6",
3
+ "version": "0.16.0",
4
4
  "description": "",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/index.js",
@@ -34,12 +34,12 @@
34
34
  },
35
35
  "author": "",
36
36
  "dependencies": {
37
- "@jay-framework/compiler-analyze-exported-types": "^0.15.6",
38
- "@jay-framework/compiler-shared": "^0.15.6",
39
- "@jay-framework/component": "^0.15.6",
40
- "@jay-framework/logger": "^0.15.6",
41
- "@jay-framework/runtime": "^0.15.6",
42
- "@jay-framework/secure": "^0.15.6",
37
+ "@jay-framework/compiler-analyze-exported-types": "^0.16.0",
38
+ "@jay-framework/compiler-shared": "^0.16.0",
39
+ "@jay-framework/component": "^0.16.0",
40
+ "@jay-framework/logger": "^0.16.0",
41
+ "@jay-framework/runtime": "^0.16.0",
42
+ "@jay-framework/secure": "^0.16.0",
43
43
  "@types/js-yaml": "^4.0.9",
44
44
  "change-case": "^4.1.2",
45
45
  "js-yaml": "^4.1.0",
@@ -51,8 +51,8 @@
51
51
  },
52
52
  "devDependencies": {
53
53
  "@caiogondim/strip-margin": "^1.0.0",
54
- "@jay-framework/4-react": "^0.15.6",
55
- "@jay-framework/dev-environment": "^0.15.6",
54
+ "@jay-framework/4-react": "^0.16.0",
55
+ "@jay-framework/dev-environment": "^0.16.0",
56
56
  "@testing-library/jest-dom": "^6.2.0",
57
57
  "@types/js-beautify": "^1",
58
58
  "@types/node": "^20.11.5",