@mavogel/cdk-vscode-server 0.0.64 → 0.0.66
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 +121 -39
- package/API.md +147 -0
- package/CLAUDE.md +46 -2
- package/README.md +63 -0
- package/examples/custom/main.ts +24 -2
- package/examples/custom-install-steps/main.ts +201 -0
- package/lib/idle-monitor/idle-monitor.js +1 -1
- package/lib/installer/installer.d.ts +7 -1
- package/lib/installer/installer.js +20 -4
- package/lib/vscode-server.d.ts +52 -0
- package/lib/vscode-server.js +4 -2
- package/node_modules/node-html-parser/CHANGELOG.md +23 -0
- package/node_modules/node-html-parser/README.md +12 -4
- package/node_modules/node-html-parser/dist/main.js +72 -8
- package/node_modules/node-html-parser/dist/nodes/html.d.ts +14 -1
- package/node_modules/node-html-parser/dist/nodes/html.js +68 -8
- package/node_modules/node-html-parser/package.json +3 -2
- package/package.json +2 -2
|
@@ -43,8 +43,8 @@ export default class HTMLElement extends Node {
|
|
|
43
43
|
private _attrs;
|
|
44
44
|
private _rawAttrs;
|
|
45
45
|
private _parseOptions;
|
|
46
|
+
private _id;
|
|
46
47
|
rawTagName: string;
|
|
47
|
-
id: string;
|
|
48
48
|
classList: DOMTokenList;
|
|
49
49
|
/**
|
|
50
50
|
* Node Type declaration.
|
|
@@ -79,6 +79,8 @@ export default class HTMLElement extends Node {
|
|
|
79
79
|
set tagName(newname: string);
|
|
80
80
|
get localName(): string;
|
|
81
81
|
get isVoidElement(): boolean;
|
|
82
|
+
get id(): string;
|
|
83
|
+
set id(newid: string);
|
|
82
84
|
/**
|
|
83
85
|
* Get escpaed (as-it) text value of current node and its children.
|
|
84
86
|
* @return {string} text content
|
|
@@ -130,6 +132,12 @@ export default class HTMLElement extends Node {
|
|
|
130
132
|
* @return {(HTMLElement|null)} matching node
|
|
131
133
|
*/
|
|
132
134
|
querySelector(selector: string): HTMLElement | null;
|
|
135
|
+
/**
|
|
136
|
+
* Tests whether the node matches a given CSS selector.
|
|
137
|
+
* @param {string} selector Simplified CSS selector
|
|
138
|
+
* @return {boolean}
|
|
139
|
+
*/
|
|
140
|
+
matches(selector: string): boolean;
|
|
133
141
|
/**
|
|
134
142
|
* find elements by their tagName
|
|
135
143
|
* @param {string} tagName the tagName of the elements to select
|
|
@@ -231,6 +239,10 @@ export interface Options {
|
|
|
231
239
|
*/
|
|
232
240
|
fixNestedATags?: boolean;
|
|
233
241
|
parseNoneClosedTags?: boolean;
|
|
242
|
+
/**
|
|
243
|
+
* When true, preserves invalid HTML nesting (e.g., <p><p>bar</p></p>) instead of auto-closing tags
|
|
244
|
+
*/
|
|
245
|
+
preserveTagNesting?: boolean;
|
|
234
246
|
blockTextElements: {
|
|
235
247
|
[tag: string]: boolean;
|
|
236
248
|
};
|
|
@@ -244,6 +256,7 @@ export interface Options {
|
|
|
244
256
|
*/
|
|
245
257
|
closingSlash?: boolean;
|
|
246
258
|
};
|
|
259
|
+
closeAllByClosing?: boolean;
|
|
247
260
|
}
|
|
248
261
|
/**
|
|
249
262
|
* Parses HTML and returns a root element
|
|
@@ -126,7 +126,7 @@ class HTMLElement extends node_1.default {
|
|
|
126
126
|
this.nodeType = type_1.default.ELEMENT_NODE;
|
|
127
127
|
this.rawTagName = tagName;
|
|
128
128
|
this.rawAttrs = rawAttrs || '';
|
|
129
|
-
this.
|
|
129
|
+
this._id = keyAttrs.id || '';
|
|
130
130
|
this.childNodes = [];
|
|
131
131
|
this._parseOptions = _parseOptions;
|
|
132
132
|
this.classList = new DOMTokenList(keyAttrs.class ? keyAttrs.class.split(/\s+/) : [], (classList) => this.setAttribute('class', classList.toString()) // eslint-disable-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
|
@@ -185,6 +185,12 @@ class HTMLElement extends node_1.default {
|
|
|
185
185
|
get isVoidElement() {
|
|
186
186
|
return this.voidTag.isVoidElement(this.localName);
|
|
187
187
|
}
|
|
188
|
+
get id() {
|
|
189
|
+
return this._id;
|
|
190
|
+
}
|
|
191
|
+
set id(newid) {
|
|
192
|
+
this.setAttribute('id', newid);
|
|
193
|
+
}
|
|
188
194
|
/**
|
|
189
195
|
* Get escpaed (as-it) text value of current node and its children.
|
|
190
196
|
* @return {string} text content
|
|
@@ -350,7 +356,7 @@ class HTMLElement extends node_1.default {
|
|
|
350
356
|
res.push(' '.repeat(indention) + str);
|
|
351
357
|
}
|
|
352
358
|
function dfs(node) {
|
|
353
|
-
const idStr = node.
|
|
359
|
+
const idStr = node._id ? `#${node._id}` : '';
|
|
354
360
|
const classStr = node.classList.length ? `.${node.classList.value.join('.')}` : ''; // eslint-disable-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-unsafe-call
|
|
355
361
|
write(`${node.rawTagName}${idStr}${classStr}`);
|
|
356
362
|
indention++;
|
|
@@ -421,6 +427,17 @@ class HTMLElement extends node_1.default {
|
|
|
421
427
|
adapter: matcher_1.default,
|
|
422
428
|
});
|
|
423
429
|
}
|
|
430
|
+
/**
|
|
431
|
+
* Tests whether the node matches a given CSS selector.
|
|
432
|
+
* @param {string} selector Simplified CSS selector
|
|
433
|
+
* @return {boolean}
|
|
434
|
+
*/
|
|
435
|
+
matches(selector) {
|
|
436
|
+
return (0, css_select_1.is)(this, selector, {
|
|
437
|
+
xmlMode: true,
|
|
438
|
+
adapter: matcher_1.default,
|
|
439
|
+
});
|
|
440
|
+
}
|
|
424
441
|
/**
|
|
425
442
|
* find elements by their tagName
|
|
426
443
|
* @param {string} tagName the tagName of the elements to select
|
|
@@ -483,7 +500,7 @@ class HTMLElement extends node_1.default {
|
|
|
483
500
|
continue;
|
|
484
501
|
}
|
|
485
502
|
if (child.nodeType === type_1.default.ELEMENT_NODE) {
|
|
486
|
-
if (child.
|
|
503
|
+
if (child._id === id) {
|
|
487
504
|
return child;
|
|
488
505
|
}
|
|
489
506
|
// if children are existing push the current status to the stack and keep searching for elements in the level below
|
|
@@ -623,9 +640,9 @@ class HTMLElement extends node_1.default {
|
|
|
623
640
|
return `${name}=${val}`;
|
|
624
641
|
})
|
|
625
642
|
.join(' ');
|
|
626
|
-
// Update this.
|
|
643
|
+
// Update this._id
|
|
627
644
|
if (key === 'id') {
|
|
628
|
-
this.
|
|
645
|
+
this._id = '';
|
|
629
646
|
}
|
|
630
647
|
return this;
|
|
631
648
|
}
|
|
@@ -670,9 +687,9 @@ class HTMLElement extends node_1.default {
|
|
|
670
687
|
return `${name}=${val}`;
|
|
671
688
|
})
|
|
672
689
|
.join(' ');
|
|
673
|
-
// Update this.
|
|
690
|
+
// Update this._id
|
|
674
691
|
if (key === 'id') {
|
|
675
|
-
this.
|
|
692
|
+
this._id = value;
|
|
676
693
|
}
|
|
677
694
|
return this;
|
|
678
695
|
}
|
|
@@ -698,6 +715,10 @@ class HTMLElement extends node_1.default {
|
|
|
698
715
|
return `${name}=${this.quoteAttribute(String(val))}`;
|
|
699
716
|
})
|
|
700
717
|
.join(' ');
|
|
718
|
+
// Update this._id
|
|
719
|
+
if ('id' in attributes) {
|
|
720
|
+
this._id = attributes['id'];
|
|
721
|
+
}
|
|
701
722
|
return this;
|
|
702
723
|
}
|
|
703
724
|
insertAdjacentHTML(where, html) {
|
|
@@ -905,6 +926,9 @@ const kElementsClosedByClosing = {
|
|
|
905
926
|
th: { tr: true, table: true, TR: true, TABLE: true },
|
|
906
927
|
TH: { tr: true, table: true, TR: true, TABLE: true },
|
|
907
928
|
};
|
|
929
|
+
const kElementsClosedByClosingExcept = {
|
|
930
|
+
p: { a: true, audio: true, del: true, ins: true, map: true, noscript: true, video: true },
|
|
931
|
+
};
|
|
908
932
|
const frameflag = 'documentfragmentcontainer';
|
|
909
933
|
/**
|
|
910
934
|
* Parses HTML and returns a root element
|
|
@@ -984,7 +1008,7 @@ function base_parse(data, options = {}) {
|
|
|
984
1008
|
attrs[key.toLowerCase()] = isQuoted ? val.slice(1, val.length - 1) : val;
|
|
985
1009
|
}
|
|
986
1010
|
const parentTagName = currentParent.rawTagName;
|
|
987
|
-
if (!closingSlash && kElementsClosedByOpening[parentTagName]) {
|
|
1011
|
+
if (!closingSlash && !options.preserveTagNesting && kElementsClosedByOpening[parentTagName]) {
|
|
988
1012
|
if (kElementsClosedByOpening[parentTagName][tagName]) {
|
|
989
1013
|
stack.pop();
|
|
990
1014
|
currentParent = (0, back_1.default)(stack);
|
|
@@ -1049,6 +1073,42 @@ function base_parse(data, options = {}) {
|
|
|
1049
1073
|
continue;
|
|
1050
1074
|
}
|
|
1051
1075
|
}
|
|
1076
|
+
const openTag = currentParent.rawTagName ?
|
|
1077
|
+
currentParent.rawTagName.toLowerCase() :
|
|
1078
|
+
'';
|
|
1079
|
+
if (kElementsClosedByClosingExcept[openTag]) {
|
|
1080
|
+
const closingTag = tagName.toLowerCase();
|
|
1081
|
+
if (stack.length > 1) {
|
|
1082
|
+
const possibleContainer = stack[stack.length - 2];
|
|
1083
|
+
if (possibleContainer &&
|
|
1084
|
+
possibleContainer.rawTagName &&
|
|
1085
|
+
possibleContainer.rawTagName.toLowerCase() === closingTag &&
|
|
1086
|
+
!kElementsClosedByClosingExcept[openTag][closingTag]) {
|
|
1087
|
+
// Update range end for closed tag
|
|
1088
|
+
currentParent.range[1] = createRange(-1, Math.max(lastTextPos, tagEndPos))[1];
|
|
1089
|
+
stack.pop();
|
|
1090
|
+
currentParent = (0, back_1.default)(stack);
|
|
1091
|
+
continue;
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
if (options.closeAllByClosing === true) {
|
|
1096
|
+
// If tag was opened, close all nested tags
|
|
1097
|
+
let i;
|
|
1098
|
+
for (i = stack.length - 2; i >= 0; i--) {
|
|
1099
|
+
if (stack[i].rawTagName === tagName)
|
|
1100
|
+
break;
|
|
1101
|
+
}
|
|
1102
|
+
if (i >= 0) {
|
|
1103
|
+
while (stack.length > i) {
|
|
1104
|
+
// Update range end for closed tag
|
|
1105
|
+
currentParent.range[1] = createRange(-1, Math.max(lastTextPos, tagEndPos))[1];
|
|
1106
|
+
stack.pop();
|
|
1107
|
+
currentParent = (0, back_1.default)(stack);
|
|
1108
|
+
}
|
|
1109
|
+
continue;
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1052
1112
|
// Use aggressive strategy to handle unmatching markups.
|
|
1053
1113
|
break;
|
|
1054
1114
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-html-parser",
|
|
3
|
-
"version": "7.0
|
|
3
|
+
"version": "7.1.0",
|
|
4
4
|
"description": "A very fast HTML parser, generating a simplified DOM, with basic element query support.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -87,7 +87,8 @@
|
|
|
87
87
|
"standard-version": "^9.5.0",
|
|
88
88
|
"travis-cov": "latest",
|
|
89
89
|
"ts-node": "^10.9.1",
|
|
90
|
-
"typescript": "latest"
|
|
90
|
+
"typescript": "latest",
|
|
91
|
+
"yarn": "^1.22.22"
|
|
91
92
|
},
|
|
92
93
|
"config": {
|
|
93
94
|
"blanket": {
|
package/package.json
CHANGED
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"publishConfig": {
|
|
113
113
|
"access": "public"
|
|
114
114
|
},
|
|
115
|
-
"version": "0.0.
|
|
115
|
+
"version": "0.0.66",
|
|
116
116
|
"jest": {
|
|
117
117
|
"coverageProvider": "v8",
|
|
118
118
|
"testMatch": [
|
|
@@ -165,7 +165,7 @@
|
|
|
165
165
|
"targets": {
|
|
166
166
|
"python": {
|
|
167
167
|
"distName": "cdk-vscode-server",
|
|
168
|
-
"module": "
|
|
168
|
+
"module": "cdk_vscode_server"
|
|
169
169
|
}
|
|
170
170
|
},
|
|
171
171
|
"tsc": {
|