@mavogel/cdk-vscode-server 0.1.30 → 0.1.32

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/.jsii CHANGED
@@ -8,7 +8,7 @@
8
8
  ]
9
9
  },
10
10
  "bundled": {
11
- "node-html-parser": "^9.0.5"
11
+ "node-html-parser": "^9.0.6"
12
12
  },
13
13
  "dependencies": {
14
14
  "@mavogel/mvc-projen": "^0.0.67",
@@ -10766,6 +10766,6 @@
10766
10766
  "symbolId": "src/vscode-server:VSCodeServerProps"
10767
10767
  }
10768
10768
  },
10769
- "version": "0.1.30",
10770
- "fingerprint": "kwiGS73HvtsZJCceui5C/f5O40853/xPlAhHCYZRVbI="
10769
+ "version": "0.1.32",
10770
+ "fingerprint": "xq9fOSk8paLyq2HeLsUIapyiZU4zTpuvoXaMy7uQjb0="
10771
10771
  }
@@ -47,7 +47,7 @@ const log_groups_1 = require("../log-groups");
47
47
  * Construct that monitors CloudFront request metrics and stops the EC2 instance when idle
48
48
  */
49
49
  class IdleMonitor extends constructs_1.Construct {
50
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@mavogel/cdk-vscode-server.IdleMonitor", version: "0.1.30" };
50
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@mavogel/cdk-vscode-server.IdleMonitor", version: "0.1.32" };
51
51
  /**
52
52
  * The Lambda function that performs idle monitoring
53
53
  */
@@ -91,7 +91,7 @@ var LinuxArchitectureType;
91
91
  * VSCodeServer - spin it up in under 10 minutes
92
92
  */
93
93
  class VSCodeServer extends constructs_1.Construct {
94
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@mavogel/cdk-vscode-server.VSCodeServer", version: "0.1.30" };
94
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@mavogel/cdk-vscode-server.VSCodeServer", version: "0.1.32" };
95
95
  /**
96
96
  * The name of the domain the server is reachable
97
97
  */
@@ -2,6 +2,16 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [9.0.6](https://github.com/taoqf/node-fast-html-parser/compare/v9.0.5...v9.0.6) (2026-10-30)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * decode attribute values with the HTML attribute rules for character references ([41b773c](https://github.com/taoqf/node-fast-html-parser/commit/41b773c01b9299e27b61d9727c877c5b1ba9f614))
11
+ * don't indent structuredText blocks that follow whitespace-only text ([5ce4d8d](https://github.com/taoqf/node-fast-html-parser/commit/5ce4d8d1e5b6e84e31c525963c66a8ee3f53270f))
12
+ * keep a trailing slash in an unquoted attribute value ([b512399](https://github.com/taoqf/node-fast-html-parser/commit/b5123999722908830e32e52b2bc600084dd0e44f))
13
+ * serialize elements iteratively so deep nesting does not overflow the stack ([75286bc](https://github.com/taoqf/node-fast-html-parser/commit/75286bc23ffd39b472651df97f79174e31d14c95)), closes [#324](https://github.com/taoqf/node-fast-html-parser/issues/324)
14
+
5
15
  ### [9.0.5](https://github.com/taoqf/node-fast-html-parser/compare/v9.0.4...v9.0.5) (2026-10-19)
6
16
 
7
17
 
@@ -565,6 +565,14 @@ const htmlDecoder = /* #__PURE__ */ getDecoder(htmlDecodeTree);
565
565
  function decodeHTML(htmlString, mode = DecodingMode.Legacy) {
566
566
  return htmlDecoder(htmlString, mode);
567
567
  }
568
+ /**
569
+ * Decodes an HTML string in an attribute.
570
+ * @param htmlAttribute The string to decode.
571
+ * @returns The decoded string.
572
+ */
573
+ function decodeHTMLAttribute(htmlAttribute) {
574
+ return htmlDecoder(htmlAttribute, DecodingMode.Attribute);
575
+ }
568
576
  //#endregion
569
577
  //#region node_modules/entities/dist/escape.js
570
578
  const xmlCodeMap$1 = /* @__PURE__ */ new Map([
@@ -3855,6 +3863,9 @@ function trimText(text) {
3855
3863
  function decode(val) {
3856
3864
  return decodeHTML(val);
3857
3865
  }
3866
+ function decodeAttribute(val) {
3867
+ return decodeHTMLAttribute(val);
3868
+ }
3858
3869
  const Htags = [
3859
3870
  "h1",
3860
3871
  "h2",
@@ -4084,8 +4095,9 @@ var HTMLElement = class HTMLElement extends Node {
4084
4095
  if (currentBlock.length > 0) blocks.push(currentBlock = []);
4085
4096
  } else node.childNodes.forEach(dfs);
4086
4097
  } else if (node.nodeType === 3) {
4087
- if (node.isWhitespace) currentBlock.prependWhitespace = true;
4088
- else {
4098
+ if (node.isWhitespace) {
4099
+ if (currentBlock.length > 0) currentBlock.prependWhitespace = true;
4100
+ } else {
4089
4101
  let text = node.trimmedText;
4090
4102
  if (currentBlock.prependWhitespace) {
4091
4103
  text = ` ${text}`;
@@ -4097,21 +4109,36 @@ var HTMLElement = class HTMLElement extends Node {
4097
4109
  }
4098
4110
  dfs(this);
4099
4111
  return blocks.map((block) => {
4100
- return block.join("").replace(/\s{2,}/g, " ");
4112
+ return block.join("").replace(/\s{2,}/g, " ").trim();
4101
4113
  }).join("\n").replace(/\s+$/, "");
4102
4114
  }
4103
4115
  toString() {
4104
- const tag = this.rawTagName;
4105
- if (tag) {
4106
- const attrs = this.rawAttrs ? ` ${this.rawAttrs}` : "";
4107
- return this.voidTag.formatNode(tag, attrs, this.innerHTML);
4108
- }
4109
- return this.innerHTML;
4116
+ return this.serialize([this]);
4110
4117
  }
4111
4118
  get innerHTML() {
4112
- return this.childNodes.map((child) => {
4113
- return child.toString();
4114
- }).join("");
4119
+ return this.serialize(this.childNodes);
4120
+ }
4121
+ serialize(nodes) {
4122
+ const out = [];
4123
+ const stack = [...nodes].reverse();
4124
+ while (stack.length > 0) {
4125
+ const item = stack.pop();
4126
+ if (typeof item === "string") out.push(item);
4127
+ else if (item instanceof HTMLElement) {
4128
+ const tag = item.rawTagName;
4129
+ if (tag) {
4130
+ const attrs = item.rawAttrs ? ` ${item.rawAttrs}` : "";
4131
+ if (item.voidTag.isVoidElement(tag.toLowerCase())) {
4132
+ out.push(item.voidTag.formatNode(tag, attrs, ""));
4133
+ continue;
4134
+ }
4135
+ out.push(`<${tag}${attrs}>`);
4136
+ stack.push(`</${tag}>`);
4137
+ }
4138
+ for (let i = item.childNodes.length - 1; i >= 0; i--) stack.push(item.childNodes[i]);
4139
+ } else out.push(item.toString());
4140
+ }
4141
+ return out.join("");
4115
4142
  }
4116
4143
  set innerHTML(content) {
4117
4144
  const r = parse$1(content, this._parseOptions);
@@ -4387,14 +4414,14 @@ var HTMLElement = class HTMLElement extends Node {
4387
4414
  const attrs = this.rawAttributes;
4388
4415
  for (const key in attrs) {
4389
4416
  const val = attrs[key] || "";
4390
- this._attrs[key.toLowerCase()] = decode(val);
4417
+ this._attrs[key.toLowerCase()] = decodeAttribute(val);
4391
4418
  }
4392
4419
  return this._attrs;
4393
4420
  }
4394
4421
  get attributes() {
4395
4422
  const ret_attrs = {};
4396
4423
  const attrs = this.rawAttributes;
4397
- for (const key in attrs) ret_attrs[key] = decode(attrs[key] || "");
4424
+ for (const key in attrs) ret_attrs[key] = decodeAttribute(attrs[key] || "");
4398
4425
  return ret_attrs;
4399
4426
  }
4400
4427
  /**
@@ -4454,7 +4481,7 @@ var HTMLElement = class HTMLElement extends Node {
4454
4481
  break;
4455
4482
  }
4456
4483
  attrs[key] = String(value);
4457
- if (this._attrs) this._attrs[k2] = decode(attrs[key]);
4484
+ if (this._attrs) this._attrs[k2] = decodeAttribute(attrs[key]);
4458
4485
  this.rawAttrs = Object.keys(attrs).map((name) => {
4459
4486
  const val = this.quoteAttribute(attrs[name]);
4460
4487
  if (val === "null" || val === "\"\"") return name;
@@ -4611,6 +4638,7 @@ var HTMLElement = class HTMLElement extends Node {
4611
4638
  };
4612
4639
  const kMarkupPattern = /<!--[\s\S]*?-->|<(\/?)([a-zA-Z][-.:0-9_a-zA-Z@\xB7\xC0-\xD6\xD8-\xF6\u00F8-\u03A1\u03A3-\u03D9\u03DB-\u03EF\u03F7-\u03FF\u0400-\u04FF\u0500-\u052F\u1D00-\u1D2B\u1D6B-\u1D77\u1D79-\u1D9A\u1E00-\u1E9B\u1F00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2126\u212A-\u212B\u2132\u214E\u2160-\u2188\u2C60-\u2C7F\uA722-\uA787\uA78B-\uA78E\uA790-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA7FF\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64-\uAB65\uFB00-\uFB06\uFB13-\uFB17\uFF21-\uFF3A\uFF41-\uFF5A\x37F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]*)((?:\s+[^>]*?(?:(?:'[^']*')|(?:"[^"]*"))?)*)\s*(\/?)>/gu;
4613
4640
  const kMarkupPatternWithCDATA = /<!--[\s\S]*?-->|<!\[CDATA\[[\s\S]*?\]\]>|<(\/?)([a-zA-Z][-.:0-9_a-zA-Z@\xB7\xC0-\xD6\xD8-\xF6\u00F8-\u03A1\u03A3-\u03D9\u03DB-\u03EF\u03F7-\u03FF\u0400-\u04FF\u0500-\u052F\u1D00-\u1D2B\u1D6B-\u1D77\u1D79-\u1D9A\u1E00-\u1E9B\u1F00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2126\u212A-\u212B\u2132\u214E\u2160-\u2188\u2C60-\u2C7F\uA722-\uA787\uA78B-\uA78E\uA790-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA7FF\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64-\uAB65\uFB00-\uFB06\uFB13-\uFB17\uFF21-\uFF3A\uFF41-\uFF5A\x37F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]*)((?:\s+[^>]*?(?:(?:'[^']*')|(?:"[^"]*"))?)*)\s*(\/?)>/gu;
4641
+ const kUnquotedAttributeValueAtEnd = /(?:^|\s)[^\s"'<>=\/]+\s*=\s*[^\s"'<>`]+$/;
4614
4642
  const kAttributePattern = /(?:^|\s)(id|class)\s*=\s*((?:'[^']*')|(?:"[^"]*")|\S+)/gi;
4615
4643
  const kElementsClosedByOpening = {
4616
4644
  li: {
@@ -5017,6 +5045,10 @@ function base_parse(data, options = {}) {
5017
5045
  const matchLength = matchText.length;
5018
5046
  const tagStartPos = markupPattern.lastIndex - matchLength;
5019
5047
  const tagEndPos = markupPattern.lastIndex;
5048
+ if (closingSlash && !leadingSlash && kUnquotedAttributeValueAtEnd.test(attributes) && !voidTag.isVoidElement(tagName)) {
5049
+ attributes += closingSlash;
5050
+ closingSlash = "";
5051
+ }
5020
5052
  if (lastTextPos > -1) {
5021
5053
  if (lastTextPos + matchLength < tagEndPos) {
5022
5054
  const text = data.substring(lastTextPos, tagStartPos);
@@ -561,6 +561,14 @@ const htmlDecoder = /* #__PURE__ */ getDecoder(htmlDecodeTree);
561
561
  function decodeHTML(htmlString, mode = DecodingMode.Legacy) {
562
562
  return htmlDecoder(htmlString, mode);
563
563
  }
564
+ /**
565
+ * Decodes an HTML string in an attribute.
566
+ * @param htmlAttribute The string to decode.
567
+ * @returns The decoded string.
568
+ */
569
+ function decodeHTMLAttribute(htmlAttribute) {
570
+ return htmlDecoder(htmlAttribute, DecodingMode.Attribute);
571
+ }
564
572
  //#endregion
565
573
  //#region node_modules/entities/dist/escape.js
566
574
  const xmlCodeMap$1 = /* @__PURE__ */ new Map([
@@ -3851,6 +3859,9 @@ function trimText(text) {
3851
3859
  function decode(val) {
3852
3860
  return decodeHTML(val);
3853
3861
  }
3862
+ function decodeAttribute(val) {
3863
+ return decodeHTMLAttribute(val);
3864
+ }
3854
3865
  const Htags = [
3855
3866
  "h1",
3856
3867
  "h2",
@@ -4080,8 +4091,9 @@ var HTMLElement = class HTMLElement extends Node {
4080
4091
  if (currentBlock.length > 0) blocks.push(currentBlock = []);
4081
4092
  } else node.childNodes.forEach(dfs);
4082
4093
  } else if (node.nodeType === 3) {
4083
- if (node.isWhitespace) currentBlock.prependWhitespace = true;
4084
- else {
4094
+ if (node.isWhitespace) {
4095
+ if (currentBlock.length > 0) currentBlock.prependWhitespace = true;
4096
+ } else {
4085
4097
  let text = node.trimmedText;
4086
4098
  if (currentBlock.prependWhitespace) {
4087
4099
  text = ` ${text}`;
@@ -4093,21 +4105,36 @@ var HTMLElement = class HTMLElement extends Node {
4093
4105
  }
4094
4106
  dfs(this);
4095
4107
  return blocks.map((block) => {
4096
- return block.join("").replace(/\s{2,}/g, " ");
4108
+ return block.join("").replace(/\s{2,}/g, " ").trim();
4097
4109
  }).join("\n").replace(/\s+$/, "");
4098
4110
  }
4099
4111
  toString() {
4100
- const tag = this.rawTagName;
4101
- if (tag) {
4102
- const attrs = this.rawAttrs ? ` ${this.rawAttrs}` : "";
4103
- return this.voidTag.formatNode(tag, attrs, this.innerHTML);
4104
- }
4105
- return this.innerHTML;
4112
+ return this.serialize([this]);
4106
4113
  }
4107
4114
  get innerHTML() {
4108
- return this.childNodes.map((child) => {
4109
- return child.toString();
4110
- }).join("");
4115
+ return this.serialize(this.childNodes);
4116
+ }
4117
+ serialize(nodes) {
4118
+ const out = [];
4119
+ const stack = [...nodes].reverse();
4120
+ while (stack.length > 0) {
4121
+ const item = stack.pop();
4122
+ if (typeof item === "string") out.push(item);
4123
+ else if (item instanceof HTMLElement) {
4124
+ const tag = item.rawTagName;
4125
+ if (tag) {
4126
+ const attrs = item.rawAttrs ? ` ${item.rawAttrs}` : "";
4127
+ if (item.voidTag.isVoidElement(tag.toLowerCase())) {
4128
+ out.push(item.voidTag.formatNode(tag, attrs, ""));
4129
+ continue;
4130
+ }
4131
+ out.push(`<${tag}${attrs}>`);
4132
+ stack.push(`</${tag}>`);
4133
+ }
4134
+ for (let i = item.childNodes.length - 1; i >= 0; i--) stack.push(item.childNodes[i]);
4135
+ } else out.push(item.toString());
4136
+ }
4137
+ return out.join("");
4111
4138
  }
4112
4139
  set innerHTML(content) {
4113
4140
  const r = parse$1(content, this._parseOptions);
@@ -4383,14 +4410,14 @@ var HTMLElement = class HTMLElement extends Node {
4383
4410
  const attrs = this.rawAttributes;
4384
4411
  for (const key in attrs) {
4385
4412
  const val = attrs[key] || "";
4386
- this._attrs[key.toLowerCase()] = decode(val);
4413
+ this._attrs[key.toLowerCase()] = decodeAttribute(val);
4387
4414
  }
4388
4415
  return this._attrs;
4389
4416
  }
4390
4417
  get attributes() {
4391
4418
  const ret_attrs = {};
4392
4419
  const attrs = this.rawAttributes;
4393
- for (const key in attrs) ret_attrs[key] = decode(attrs[key] || "");
4420
+ for (const key in attrs) ret_attrs[key] = decodeAttribute(attrs[key] || "");
4394
4421
  return ret_attrs;
4395
4422
  }
4396
4423
  /**
@@ -4450,7 +4477,7 @@ var HTMLElement = class HTMLElement extends Node {
4450
4477
  break;
4451
4478
  }
4452
4479
  attrs[key] = String(value);
4453
- if (this._attrs) this._attrs[k2] = decode(attrs[key]);
4480
+ if (this._attrs) this._attrs[k2] = decodeAttribute(attrs[key]);
4454
4481
  this.rawAttrs = Object.keys(attrs).map((name) => {
4455
4482
  const val = this.quoteAttribute(attrs[name]);
4456
4483
  if (val === "null" || val === "\"\"") return name;
@@ -4607,6 +4634,7 @@ var HTMLElement = class HTMLElement extends Node {
4607
4634
  };
4608
4635
  const kMarkupPattern = /<!--[\s\S]*?-->|<(\/?)([a-zA-Z][-.:0-9_a-zA-Z@\xB7\xC0-\xD6\xD8-\xF6\u00F8-\u03A1\u03A3-\u03D9\u03DB-\u03EF\u03F7-\u03FF\u0400-\u04FF\u0500-\u052F\u1D00-\u1D2B\u1D6B-\u1D77\u1D79-\u1D9A\u1E00-\u1E9B\u1F00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2126\u212A-\u212B\u2132\u214E\u2160-\u2188\u2C60-\u2C7F\uA722-\uA787\uA78B-\uA78E\uA790-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA7FF\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64-\uAB65\uFB00-\uFB06\uFB13-\uFB17\uFF21-\uFF3A\uFF41-\uFF5A\x37F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]*)((?:\s+[^>]*?(?:(?:'[^']*')|(?:"[^"]*"))?)*)\s*(\/?)>/gu;
4609
4636
  const kMarkupPatternWithCDATA = /<!--[\s\S]*?-->|<!\[CDATA\[[\s\S]*?\]\]>|<(\/?)([a-zA-Z][-.:0-9_a-zA-Z@\xB7\xC0-\xD6\xD8-\xF6\u00F8-\u03A1\u03A3-\u03D9\u03DB-\u03EF\u03F7-\u03FF\u0400-\u04FF\u0500-\u052F\u1D00-\u1D2B\u1D6B-\u1D77\u1D79-\u1D9A\u1E00-\u1E9B\u1F00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2126\u212A-\u212B\u2132\u214E\u2160-\u2188\u2C60-\u2C7F\uA722-\uA787\uA78B-\uA78E\uA790-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA7FF\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64-\uAB65\uFB00-\uFB06\uFB13-\uFB17\uFF21-\uFF3A\uFF41-\uFF5A\x37F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]*)((?:\s+[^>]*?(?:(?:'[^']*')|(?:"[^"]*"))?)*)\s*(\/?)>/gu;
4637
+ const kUnquotedAttributeValueAtEnd = /(?:^|\s)[^\s"'<>=\/]+\s*=\s*[^\s"'<>`]+$/;
4610
4638
  const kAttributePattern = /(?:^|\s)(id|class)\s*=\s*((?:'[^']*')|(?:"[^"]*")|\S+)/gi;
4611
4639
  const kElementsClosedByOpening = {
4612
4640
  li: {
@@ -5013,6 +5041,10 @@ function base_parse(data, options = {}) {
5013
5041
  const matchLength = matchText.length;
5014
5042
  const tagStartPos = markupPattern.lastIndex - matchLength;
5015
5043
  const tagEndPos = markupPattern.lastIndex;
5044
+ if (closingSlash && !leadingSlash && kUnquotedAttributeValueAtEnd.test(attributes) && !voidTag.isVoidElement(tagName)) {
5045
+ attributes += closingSlash;
5046
+ closingSlash = "";
5047
+ }
5016
5048
  if (lastTextPos > -1) {
5017
5049
  if (lastTextPos + matchLength < tagEndPos) {
5018
5050
  const text = data.substring(lastTextPos, tagStartPos);
@@ -568,6 +568,14 @@
568
568
  function decodeHTML(htmlString, mode = DecodingMode.Legacy) {
569
569
  return htmlDecoder(htmlString, mode);
570
570
  }
571
+ /**
572
+ * Decodes an HTML string in an attribute.
573
+ * @param htmlAttribute The string to decode.
574
+ * @returns The decoded string.
575
+ */
576
+ function decodeHTMLAttribute(htmlAttribute) {
577
+ return htmlDecoder(htmlAttribute, DecodingMode.Attribute);
578
+ }
571
579
  //#endregion
572
580
  //#region node_modules/entities/dist/escape.js
573
581
  const xmlCodeMap$1 = /* @__PURE__ */ new Map([
@@ -3858,6 +3866,9 @@
3858
3866
  function decode(val) {
3859
3867
  return decodeHTML(val);
3860
3868
  }
3869
+ function decodeAttribute(val) {
3870
+ return decodeHTMLAttribute(val);
3871
+ }
3861
3872
  const Htags = [
3862
3873
  "h1",
3863
3874
  "h2",
@@ -4087,8 +4098,9 @@
4087
4098
  if (currentBlock.length > 0) blocks.push(currentBlock = []);
4088
4099
  } else node.childNodes.forEach(dfs);
4089
4100
  } else if (node.nodeType === 3) {
4090
- if (node.isWhitespace) currentBlock.prependWhitespace = true;
4091
- else {
4101
+ if (node.isWhitespace) {
4102
+ if (currentBlock.length > 0) currentBlock.prependWhitespace = true;
4103
+ } else {
4092
4104
  let text = node.trimmedText;
4093
4105
  if (currentBlock.prependWhitespace) {
4094
4106
  text = ` ${text}`;
@@ -4100,21 +4112,36 @@
4100
4112
  }
4101
4113
  dfs(this);
4102
4114
  return blocks.map((block) => {
4103
- return block.join("").replace(/\s{2,}/g, " ");
4115
+ return block.join("").replace(/\s{2,}/g, " ").trim();
4104
4116
  }).join("\n").replace(/\s+$/, "");
4105
4117
  }
4106
4118
  toString() {
4107
- const tag = this.rawTagName;
4108
- if (tag) {
4109
- const attrs = this.rawAttrs ? ` ${this.rawAttrs}` : "";
4110
- return this.voidTag.formatNode(tag, attrs, this.innerHTML);
4111
- }
4112
- return this.innerHTML;
4119
+ return this.serialize([this]);
4113
4120
  }
4114
4121
  get innerHTML() {
4115
- return this.childNodes.map((child) => {
4116
- return child.toString();
4117
- }).join("");
4122
+ return this.serialize(this.childNodes);
4123
+ }
4124
+ serialize(nodes) {
4125
+ const out = [];
4126
+ const stack = [...nodes].reverse();
4127
+ while (stack.length > 0) {
4128
+ const item = stack.pop();
4129
+ if (typeof item === "string") out.push(item);
4130
+ else if (item instanceof HTMLElement) {
4131
+ const tag = item.rawTagName;
4132
+ if (tag) {
4133
+ const attrs = item.rawAttrs ? ` ${item.rawAttrs}` : "";
4134
+ if (item.voidTag.isVoidElement(tag.toLowerCase())) {
4135
+ out.push(item.voidTag.formatNode(tag, attrs, ""));
4136
+ continue;
4137
+ }
4138
+ out.push(`<${tag}${attrs}>`);
4139
+ stack.push(`</${tag}>`);
4140
+ }
4141
+ for (let i = item.childNodes.length - 1; i >= 0; i--) stack.push(item.childNodes[i]);
4142
+ } else out.push(item.toString());
4143
+ }
4144
+ return out.join("");
4118
4145
  }
4119
4146
  set innerHTML(content) {
4120
4147
  const r = parse$1(content, this._parseOptions);
@@ -4390,14 +4417,14 @@
4390
4417
  const attrs = this.rawAttributes;
4391
4418
  for (const key in attrs) {
4392
4419
  const val = attrs[key] || "";
4393
- this._attrs[key.toLowerCase()] = decode(val);
4420
+ this._attrs[key.toLowerCase()] = decodeAttribute(val);
4394
4421
  }
4395
4422
  return this._attrs;
4396
4423
  }
4397
4424
  get attributes() {
4398
4425
  const ret_attrs = {};
4399
4426
  const attrs = this.rawAttributes;
4400
- for (const key in attrs) ret_attrs[key] = decode(attrs[key] || "");
4427
+ for (const key in attrs) ret_attrs[key] = decodeAttribute(attrs[key] || "");
4401
4428
  return ret_attrs;
4402
4429
  }
4403
4430
  /**
@@ -4457,7 +4484,7 @@
4457
4484
  break;
4458
4485
  }
4459
4486
  attrs[key] = String(value);
4460
- if (this._attrs) this._attrs[k2] = decode(attrs[key]);
4487
+ if (this._attrs) this._attrs[k2] = decodeAttribute(attrs[key]);
4461
4488
  this.rawAttrs = Object.keys(attrs).map((name) => {
4462
4489
  const val = this.quoteAttribute(attrs[name]);
4463
4490
  if (val === "null" || val === "\"\"") return name;
@@ -4614,6 +4641,7 @@
4614
4641
  };
4615
4642
  const kMarkupPattern = /<!--[\s\S]*?-->|<(\/?)([a-zA-Z][-.:0-9_a-zA-Z@\xB7\xC0-\xD6\xD8-\xF6\u00F8-\u03A1\u03A3-\u03D9\u03DB-\u03EF\u03F7-\u03FF\u0400-\u04FF\u0500-\u052F\u1D00-\u1D2B\u1D6B-\u1D77\u1D79-\u1D9A\u1E00-\u1E9B\u1F00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2126\u212A-\u212B\u2132\u214E\u2160-\u2188\u2C60-\u2C7F\uA722-\uA787\uA78B-\uA78E\uA790-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA7FF\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64-\uAB65\uFB00-\uFB06\uFB13-\uFB17\uFF21-\uFF3A\uFF41-\uFF5A\x37F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]*)((?:\s+[^>]*?(?:(?:'[^']*')|(?:"[^"]*"))?)*)\s*(\/?)>/gu;
4616
4643
  const kMarkupPatternWithCDATA = /<!--[\s\S]*?-->|<!\[CDATA\[[\s\S]*?\]\]>|<(\/?)([a-zA-Z][-.:0-9_a-zA-Z@\xB7\xC0-\xD6\xD8-\xF6\u00F8-\u03A1\u03A3-\u03D9\u03DB-\u03EF\u03F7-\u03FF\u0400-\u04FF\u0500-\u052F\u1D00-\u1D2B\u1D6B-\u1D77\u1D79-\u1D9A\u1E00-\u1E9B\u1F00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2126\u212A-\u212B\u2132\u214E\u2160-\u2188\u2C60-\u2C7F\uA722-\uA787\uA78B-\uA78E\uA790-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA7FF\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64-\uAB65\uFB00-\uFB06\uFB13-\uFB17\uFF21-\uFF3A\uFF41-\uFF5A\x37F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]*)((?:\s+[^>]*?(?:(?:'[^']*')|(?:"[^"]*"))?)*)\s*(\/?)>/gu;
4644
+ const kUnquotedAttributeValueAtEnd = /(?:^|\s)[^\s"'<>=\/]+\s*=\s*[^\s"'<>`]+$/;
4617
4645
  const kAttributePattern = /(?:^|\s)(id|class)\s*=\s*((?:'[^']*')|(?:"[^"]*")|\S+)/gi;
4618
4646
  const kElementsClosedByOpening = {
4619
4647
  li: {
@@ -5020,6 +5048,10 @@
5020
5048
  const matchLength = matchText.length;
5021
5049
  const tagStartPos = markupPattern.lastIndex - matchLength;
5022
5050
  const tagEndPos = markupPattern.lastIndex;
5051
+ if (closingSlash && !leadingSlash && kUnquotedAttributeValueAtEnd.test(attributes) && !voidTag.isVoidElement(tagName)) {
5052
+ attributes += closingSlash;
5053
+ closingSlash = "";
5054
+ }
5023
5055
  if (lastTextPos > -1) {
5024
5056
  if (lastTextPos + matchLength < tagEndPos) {
5025
5057
  const text = data.substring(lastTextPos, tagStartPos);
@@ -100,6 +100,7 @@ export default class HTMLElement extends Node {
100
100
  get structuredText(): string;
101
101
  toString(): string;
102
102
  get innerHTML(): string;
103
+ private serialize;
103
104
  set innerHTML(content: string);
104
105
  set_content(content: string | Node | Node[], options?: Partial<Options>): this;
105
106
  replaceWith(...nodes: (string | Node)[]): this;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-html-parser",
3
- "version": "9.0.5",
3
+ "version": "9.0.6",
4
4
  "description": "A very fast HTML parser, generating a simplified DOM, with basic element query support.",
5
5
  "main": "dist/index.cjs",
6
6
  "types": "dist/index.d.ts",
package/package.json CHANGED
@@ -51,13 +51,13 @@
51
51
  "devDependencies": {
52
52
  "@aws-cdk/integ-runner": "2.205.8",
53
53
  "@aws-cdk/integ-tests-alpha": "2.269.0-alpha.0",
54
- "@aws-sdk/client-cloudwatch": "^3.1159.0",
55
- "@aws-sdk/client-dynamodb": "^3.1159.0",
56
- "@aws-sdk/client-ec2": "^3.1159.0",
57
- "@aws-sdk/client-eventbridge": "^3.1159.0",
58
- "@aws-sdk/client-secrets-manager": "^3.1159.0",
59
- "@aws-sdk/client-ssm": "^3.1159.0",
60
- "@aws-sdk/lib-dynamodb": "^3.1159.0",
54
+ "@aws-sdk/client-cloudwatch": "^3.1161.0",
55
+ "@aws-sdk/client-dynamodb": "^3.1161.0",
56
+ "@aws-sdk/client-ec2": "^3.1161.0",
57
+ "@aws-sdk/client-eventbridge": "^3.1161.0",
58
+ "@aws-sdk/client-secrets-manager": "^3.1161.0",
59
+ "@aws-sdk/client-ssm": "^3.1161.0",
60
+ "@aws-sdk/lib-dynamodb": "^3.1161.0",
61
61
  "@commitlint/cli": "^20.1.0",
62
62
  "@commitlint/config-conventional": "^20.0.0",
63
63
  "@stylistic/eslint-plugin": "^2",
@@ -96,7 +96,7 @@
96
96
  "@mavogel/mvc-projen": "^0.0.67",
97
97
  "cdk-nag": "^3.0.1",
98
98
  "constructs": "^10.5.1",
99
- "node-html-parser": "^9.0.5"
99
+ "node-html-parser": "^9.0.6"
100
100
  },
101
101
  "bundledDependencies": [
102
102
  "node-html-parser"
@@ -123,7 +123,7 @@
123
123
  "publishConfig": {
124
124
  "access": "public"
125
125
  },
126
- "version": "0.1.30",
126
+ "version": "0.1.32",
127
127
  "jest": {
128
128
  "coverageProvider": "v8",
129
129
  "testMatch": [