@rindo/core 2.17.4 → 2.18.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.
- package/cli/index.cjs +26 -16
- package/cli/index.js +26 -16
- package/cli/package.json +1 -1
- package/compiler/lib.dom.d.ts +620 -89
- package/compiler/lib.dom.iterable.d.ts +27 -3
- package/compiler/lib.es2015.core.d.ts +3 -3
- package/compiler/lib.es2015.iterable.d.ts +2 -1
- package/compiler/lib.es2015.reflect.d.ts +1 -1
- package/compiler/lib.es2020.bigint.d.ts +7 -5
- package/compiler/lib.es2020.d.ts +2 -0
- package/compiler/lib.es2020.date.d.ts +44 -0
- package/compiler/lib.es2020.intl.d.ts +51 -11
- package/compiler/lib.es2020.number.d.ts +30 -0
- package/compiler/lib.es2021.intl.d.ts +106 -4
- package/compiler/lib.es2022.array.d.ts +123 -0
- package/compiler/lib.es2022.d.ts +26 -0
- package/compiler/lib.es2022.error.d.ts +75 -0
- package/compiler/lib.es2022.full.d.ts +25 -0
- package/compiler/lib.es2022.intl.d.ts +111 -0
- package/compiler/lib.es2022.object.d.ts +28 -0
- package/compiler/lib.es2022.string.d.ts +27 -0
- package/compiler/lib.es5.d.ts +25 -19
- package/compiler/lib.esnext.d.ts +1 -1
- package/compiler/lib.esnext.intl.d.ts +4 -1
- package/compiler/lib.webworker.d.ts +236 -40
- package/compiler/lib.webworker.iterable.d.ts +10 -3
- package/compiler/package.json +1 -1
- package/compiler/rindo.js +607 -212
- package/compiler/rindo.min.js +2 -2
- package/compiler/sys/in-memory-fs.d.ts +218 -0
- package/dependencies.json +10 -1
- package/dev-server/client/index.js +1 -1
- package/dev-server/client/package.json +1 -1
- package/dev-server/connector.html +2 -2
- package/dev-server/index.js +1 -1
- package/dev-server/package.json +1 -1
- package/dev-server/server-process.js +12 -12
- package/internal/app-data/package.json +1 -1
- package/internal/client/css-shim.js +1 -1
- package/internal/client/dom.js +1 -1
- package/internal/client/index.js +337 -157
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +1 -1
- package/internal/client/patch-esm.js +1 -1
- package/internal/client/shadow-css.js +1 -1
- package/internal/hydrate/package.json +1 -1
- package/internal/package.json +1 -1
- package/internal/rindo-private.d.ts +2 -106
- package/internal/rindo-public-compiler.d.ts +42 -8
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +77 -61
- package/mock-doc/index.d.ts +13 -12
- package/mock-doc/index.js +77 -61
- package/mock-doc/package.json +1 -1
- package/package.json +2 -4
- package/screenshot/index.js +10 -10
- package/screenshot/package.json +1 -1
- package/sys/node/index.js +1 -1
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +780 -794
- package/testing/package.json +1 -1
- package/testing/testing-utils.d.ts +5 -4
package/mock-doc/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Rindo Mock Doc v2.
|
|
2
|
+
Rindo Mock Doc v2.18.0 | MIT Licensed | https://rindojs.web.app
|
|
3
3
|
*/
|
|
4
4
|
const CONTENT_REF_ID = 'r';
|
|
5
5
|
const ORG_LOCATION_ID = 'o';
|
|
@@ -279,7 +279,7 @@ const proxyElements = new WeakMap();
|
|
|
279
279
|
const upgradedElements = new WeakSet();
|
|
280
280
|
function connectNode(ownerDocument, node) {
|
|
281
281
|
node.ownerDocument = ownerDocument;
|
|
282
|
-
if (node.nodeType === 1 /* ELEMENT_NODE */) {
|
|
282
|
+
if (node.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */) {
|
|
283
283
|
if (ownerDocument != null && node.nodeName.includes('-')) {
|
|
284
284
|
const win = ownerDocument.defaultView;
|
|
285
285
|
if (win != null && typeof node.connectedCallback === 'function' && node.isConnected) {
|
|
@@ -315,7 +315,7 @@ function fireConnectedCallback(node) {
|
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
function disconnectNode(node) {
|
|
318
|
-
if (node.nodeType === 1 /* ELEMENT_NODE */) {
|
|
318
|
+
if (node.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */) {
|
|
319
319
|
if (node.nodeName.includes('-') === true && typeof node.disconnectedCallback === 'function') {
|
|
320
320
|
if (tempDisableCallbacks.has(node.ownerDocument) === false) {
|
|
321
321
|
try {
|
|
@@ -631,7 +631,7 @@ class MockEvent {
|
|
|
631
631
|
let currentElement = this.target;
|
|
632
632
|
while (currentElement) {
|
|
633
633
|
composedPath.push(currentElement);
|
|
634
|
-
if (!currentElement.parentElement && currentElement.nodeName === "#document" /* DOCUMENT_NODE */) {
|
|
634
|
+
if (!currentElement.parentElement && currentElement.nodeName === "#document" /* NODE_NAMES.DOCUMENT_NODE */) {
|
|
635
635
|
// the current element doesn't have a parent, but we've detected it's our root document node. push the window
|
|
636
636
|
// object associated with the document onto the path
|
|
637
637
|
composedPath.push(currentElement.defaultView);
|
|
@@ -753,7 +753,7 @@ function triggerEventListener(elm, ev) {
|
|
|
753
753
|
if (ev.bubbles === false) {
|
|
754
754
|
return;
|
|
755
755
|
}
|
|
756
|
-
if (elm.nodeName === "#document" /* DOCUMENT_NODE */) {
|
|
756
|
+
if (elm.nodeName === "#document" /* NODE_NAMES.DOCUMENT_NODE */) {
|
|
757
757
|
triggerEventListener(elm.defaultView, ev);
|
|
758
758
|
}
|
|
759
759
|
else {
|
|
@@ -826,7 +826,7 @@ function serializeNodeToHtml(elm, opts = {}) {
|
|
|
826
826
|
return output.text.join('');
|
|
827
827
|
}
|
|
828
828
|
function serializeToHtml(node, opts, output, isShadowRoot) {
|
|
829
|
-
if (node.nodeType === 1 /* ELEMENT_NODE */ || isShadowRoot) {
|
|
829
|
+
if (node.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */ || isShadowRoot) {
|
|
830
830
|
const tagName = isShadowRoot ? 'mock:shadow-root' : getTagName(node);
|
|
831
831
|
if (tagName === 'body') {
|
|
832
832
|
output.isWithinBody = true;
|
|
@@ -943,7 +943,7 @@ function serializeToHtml(node, opts, output, isShadowRoot) {
|
|
|
943
943
|
if (opts.newLines &&
|
|
944
944
|
(node.childNodes.length === 0 ||
|
|
945
945
|
(node.childNodes.length === 1 &&
|
|
946
|
-
node.childNodes[0].nodeType === 3 /* TEXT_NODE */ &&
|
|
946
|
+
node.childNodes[0].nodeType === 3 /* NODE_TYPES.TEXT_NODE */ &&
|
|
947
947
|
node.childNodes[0].nodeValue.trim() === ''))) {
|
|
948
948
|
output.text.push('\n');
|
|
949
949
|
output.currentLineWidth = 0;
|
|
@@ -958,7 +958,7 @@ function serializeToHtml(node, opts, output, isShadowRoot) {
|
|
|
958
958
|
const childNodeLength = childNodes.length;
|
|
959
959
|
if (childNodeLength > 0) {
|
|
960
960
|
if (childNodeLength === 1 &&
|
|
961
|
-
childNodes[0].nodeType === 3 /* TEXT_NODE */ &&
|
|
961
|
+
childNodes[0].nodeType === 3 /* NODE_TYPES.TEXT_NODE */ &&
|
|
962
962
|
(typeof childNodes[0].nodeValue !== 'string' || childNodes[0].nodeValue.trim() === '')) ;
|
|
963
963
|
else {
|
|
964
964
|
const isWithinWhitespaceSensitiveNode = opts.newLines || opts.indentSpaces > 0 ? isWithinWhitespaceSensitive(node) : false;
|
|
@@ -997,7 +997,7 @@ function serializeToHtml(node, opts, output, isShadowRoot) {
|
|
|
997
997
|
output.isWithinBody = false;
|
|
998
998
|
}
|
|
999
999
|
}
|
|
1000
|
-
else if (node.nodeType === 3 /* TEXT_NODE */) {
|
|
1000
|
+
else if (node.nodeType === 3 /* NODE_TYPES.TEXT_NODE */) {
|
|
1001
1001
|
let textContent = node.nodeValue;
|
|
1002
1002
|
if (typeof textContent === 'string') {
|
|
1003
1003
|
const trimmedTextContent = textContent.trim();
|
|
@@ -1044,7 +1044,7 @@ function serializeToHtml(node, opts, output, isShadowRoot) {
|
|
|
1044
1044
|
let textContentLength = textContent.length;
|
|
1045
1045
|
if (textContentLength > 0) {
|
|
1046
1046
|
// this text node has text content
|
|
1047
|
-
const parentTagName = node.parentNode != null && node.parentNode.nodeType === 1 /* ELEMENT_NODE */
|
|
1047
|
+
const parentTagName = node.parentNode != null && node.parentNode.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */
|
|
1048
1048
|
? node.parentNode.nodeName
|
|
1049
1049
|
: null;
|
|
1050
1050
|
if (NON_ESCAPABLE_CONTENT.has(parentTagName)) {
|
|
@@ -1099,7 +1099,7 @@ function serializeToHtml(node, opts, output, isShadowRoot) {
|
|
|
1099
1099
|
}
|
|
1100
1100
|
}
|
|
1101
1101
|
}
|
|
1102
|
-
else if (node.nodeType === 8 /* COMMENT_NODE */) {
|
|
1102
|
+
else if (node.nodeType === 8 /* NODE_TYPES.COMMENT_NODE */) {
|
|
1103
1103
|
const nodeValue = node.nodeValue;
|
|
1104
1104
|
if (opts.removeHtmlComments) {
|
|
1105
1105
|
const isHydrateAnnotation = nodeValue.startsWith(CONTENT_REF_ID + '.') ||
|
|
@@ -1124,7 +1124,7 @@ function serializeToHtml(node, opts, output, isShadowRoot) {
|
|
|
1124
1124
|
output.text.push('<!--' + nodeValue + '-->');
|
|
1125
1125
|
output.currentLineWidth += nodeValue.length + 7;
|
|
1126
1126
|
}
|
|
1127
|
-
else if (node.nodeType === 10 /* DOCUMENT_TYPE_NODE */) {
|
|
1127
|
+
else if (node.nodeType === 10 /* NODE_TYPES.DOCUMENT_TYPE_NODE */) {
|
|
1128
1128
|
output.text.push('<!doctype html>');
|
|
1129
1129
|
}
|
|
1130
1130
|
}
|
|
@@ -1284,7 +1284,7 @@ function getParser(ownerDocument) {
|
|
|
1284
1284
|
// @ts-ignore
|
|
1285
1285
|
const treeAdapter = {
|
|
1286
1286
|
createDocument() {
|
|
1287
|
-
const doc = ownerDocument.createElement("#document" /* DOCUMENT_NODE */);
|
|
1287
|
+
const doc = ownerDocument.createElement("#document" /* NODE_NAMES.DOCUMENT_NODE */);
|
|
1288
1288
|
doc['x-mode'] = 'no-quirks';
|
|
1289
1289
|
return doc;
|
|
1290
1290
|
},
|
|
@@ -1326,7 +1326,7 @@ function getParser(ownerDocument) {
|
|
|
1326
1326
|
return templateElement.content;
|
|
1327
1327
|
},
|
|
1328
1328
|
setDocumentType(doc, name, publicId, systemId) {
|
|
1329
|
-
let doctypeNode = doc.childNodes.find((n) => n.nodeType === 10 /* DOCUMENT_TYPE_NODE */);
|
|
1329
|
+
let doctypeNode = doc.childNodes.find((n) => n.nodeType === 10 /* NODE_TYPES.DOCUMENT_TYPE_NODE */);
|
|
1330
1330
|
if (doctypeNode == null) {
|
|
1331
1331
|
doctypeNode = ownerDocument.createDocumentTypeNode();
|
|
1332
1332
|
doc.insertBefore(doctypeNode, doc.firstChild);
|
|
@@ -1347,7 +1347,7 @@ function getParser(ownerDocument) {
|
|
|
1347
1347
|
},
|
|
1348
1348
|
insertText(parentNode, text) {
|
|
1349
1349
|
const lastChild = parentNode.lastChild;
|
|
1350
|
-
if (lastChild != null && lastChild.nodeType === 3 /* TEXT_NODE */) {
|
|
1350
|
+
if (lastChild != null && lastChild.nodeType === 3 /* NODE_TYPES.TEXT_NODE */) {
|
|
1351
1351
|
lastChild.nodeValue += text;
|
|
1352
1352
|
}
|
|
1353
1353
|
else {
|
|
@@ -1356,7 +1356,7 @@ function getParser(ownerDocument) {
|
|
|
1356
1356
|
},
|
|
1357
1357
|
insertTextBefore(parentNode, text, referenceNode) {
|
|
1358
1358
|
const prevNode = parentNode.childNodes[parentNode.childNodes.indexOf(referenceNode) - 1];
|
|
1359
|
-
if (prevNode != null && prevNode.nodeType === 3 /* TEXT_NODE */) {
|
|
1359
|
+
if (prevNode != null && prevNode.nodeType === 3 /* NODE_TYPES.TEXT_NODE */) {
|
|
1360
1360
|
prevNode.nodeValue += text;
|
|
1361
1361
|
}
|
|
1362
1362
|
else {
|
|
@@ -1418,16 +1418,16 @@ function getParser(ownerDocument) {
|
|
|
1418
1418
|
return doctypeNode['x-systemId'];
|
|
1419
1419
|
},
|
|
1420
1420
|
isTextNode(node) {
|
|
1421
|
-
return node.nodeType === 3 /* TEXT_NODE */;
|
|
1421
|
+
return node.nodeType === 3 /* NODE_TYPES.TEXT_NODE */;
|
|
1422
1422
|
},
|
|
1423
1423
|
isCommentNode(node) {
|
|
1424
|
-
return node.nodeType === 8 /* COMMENT_NODE */;
|
|
1424
|
+
return node.nodeType === 8 /* NODE_TYPES.COMMENT_NODE */;
|
|
1425
1425
|
},
|
|
1426
1426
|
isDocumentTypeNode(node) {
|
|
1427
|
-
return node.nodeType === 10 /* DOCUMENT_TYPE_NODE */;
|
|
1427
|
+
return node.nodeType === 10 /* NODE_TYPES.DOCUMENT_TYPE_NODE */;
|
|
1428
1428
|
},
|
|
1429
1429
|
isElementNode(node) {
|
|
1430
|
-
return node.nodeType === 1 /* ELEMENT_NODE */;
|
|
1430
|
+
return node.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */;
|
|
1431
1431
|
},
|
|
1432
1432
|
};
|
|
1433
1433
|
parseOptions = {
|
|
@@ -1447,7 +1447,7 @@ class MockNode {
|
|
|
1447
1447
|
this.childNodes = [];
|
|
1448
1448
|
}
|
|
1449
1449
|
appendChild(newNode) {
|
|
1450
|
-
if (newNode.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */) {
|
|
1450
|
+
if (newNode.nodeType === 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */) {
|
|
1451
1451
|
const nodes = newNode.childNodes.slice();
|
|
1452
1452
|
for (const child of nodes) {
|
|
1453
1453
|
this.appendChild(child);
|
|
@@ -1471,7 +1471,9 @@ class MockNode {
|
|
|
1471
1471
|
const firstChild = this.firstChild;
|
|
1472
1472
|
items.forEach((item) => {
|
|
1473
1473
|
const isNode = typeof item === 'object' && item !== null && 'nodeType' in item;
|
|
1474
|
-
|
|
1474
|
+
if (firstChild) {
|
|
1475
|
+
this.insertBefore(isNode ? item : this.ownerDocument.createTextNode(String(item)), firstChild);
|
|
1476
|
+
}
|
|
1475
1477
|
});
|
|
1476
1478
|
}
|
|
1477
1479
|
cloneNode(deep) {
|
|
@@ -1486,7 +1488,7 @@ class MockNode {
|
|
|
1486
1488
|
return this.childNodes[0] || null;
|
|
1487
1489
|
}
|
|
1488
1490
|
insertBefore(newNode, referenceNode) {
|
|
1489
|
-
if (newNode.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */) {
|
|
1491
|
+
if (newNode.nodeType === 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */) {
|
|
1490
1492
|
for (let i = 0, ii = newNode.childNodes.length; i < ii; i++) {
|
|
1491
1493
|
insertBefore(this, newNode.childNodes[i], referenceNode);
|
|
1492
1494
|
}
|
|
@@ -1499,11 +1501,11 @@ class MockNode {
|
|
|
1499
1501
|
get isConnected() {
|
|
1500
1502
|
let node = this;
|
|
1501
1503
|
while (node != null) {
|
|
1502
|
-
if (node.nodeType === 9 /* DOCUMENT_NODE */) {
|
|
1504
|
+
if (node.nodeType === 9 /* NODE_TYPES.DOCUMENT_NODE */) {
|
|
1503
1505
|
return true;
|
|
1504
1506
|
}
|
|
1505
1507
|
node = node.parentNode;
|
|
1506
|
-
if (node != null && node.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */) {
|
|
1508
|
+
if (node != null && node.nodeType === 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */) {
|
|
1507
1509
|
node = node.host;
|
|
1508
1510
|
}
|
|
1509
1511
|
}
|
|
@@ -1523,7 +1525,8 @@ class MockNode {
|
|
|
1523
1525
|
return null;
|
|
1524
1526
|
}
|
|
1525
1527
|
get nodeValue() {
|
|
1526
|
-
|
|
1528
|
+
var _a;
|
|
1529
|
+
return (_a = this._nodeValue) !== null && _a !== void 0 ? _a : '';
|
|
1527
1530
|
}
|
|
1528
1531
|
set nodeValue(value) {
|
|
1529
1532
|
this._nodeValue = value;
|
|
@@ -1555,7 +1558,7 @@ class MockNode {
|
|
|
1555
1558
|
const index = this.childNodes.indexOf(childNode);
|
|
1556
1559
|
if (index > -1) {
|
|
1557
1560
|
this.childNodes.splice(index, 1);
|
|
1558
|
-
if (this.nodeType === 1 /* ELEMENT_NODE */) {
|
|
1561
|
+
if (this.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */) {
|
|
1559
1562
|
const wasConnected = this.isConnected;
|
|
1560
1563
|
childNode.parentNode = null;
|
|
1561
1564
|
if (wasConnected === true) {
|
|
@@ -1585,7 +1588,8 @@ class MockNode {
|
|
|
1585
1588
|
return null;
|
|
1586
1589
|
}
|
|
1587
1590
|
get textContent() {
|
|
1588
|
-
|
|
1591
|
+
var _a;
|
|
1592
|
+
return (_a = this._nodeValue) !== null && _a !== void 0 ? _a : '';
|
|
1589
1593
|
}
|
|
1590
1594
|
set textContent(value) {
|
|
1591
1595
|
this._nodeValue = String(value);
|
|
@@ -1607,8 +1611,10 @@ class MockNodeList {
|
|
|
1607
1611
|
}
|
|
1608
1612
|
class MockElement extends MockNode {
|
|
1609
1613
|
constructor(ownerDocument, nodeName) {
|
|
1610
|
-
super(ownerDocument, 1 /* ELEMENT_NODE */, typeof nodeName === 'string' ? nodeName : null, null);
|
|
1614
|
+
super(ownerDocument, 1 /* NODE_TYPES.ELEMENT_NODE */, typeof nodeName === 'string' ? nodeName : null, null);
|
|
1611
1615
|
this.namespaceURI = null;
|
|
1616
|
+
this.__shadowRoot = null;
|
|
1617
|
+
this.__attributeMap = null;
|
|
1612
1618
|
}
|
|
1613
1619
|
addEventListener(type, handler) {
|
|
1614
1620
|
addEventListener(this, type, handler);
|
|
@@ -1635,7 +1641,9 @@ class MockElement extends MockNode {
|
|
|
1635
1641
|
}
|
|
1636
1642
|
get attributes() {
|
|
1637
1643
|
if (this.__attributeMap == null) {
|
|
1638
|
-
|
|
1644
|
+
const attrMap = createAttributeProxy(false);
|
|
1645
|
+
this.__attributeMap = attrMap;
|
|
1646
|
+
return attrMap;
|
|
1639
1647
|
}
|
|
1640
1648
|
return this.__attributeMap;
|
|
1641
1649
|
}
|
|
@@ -1643,10 +1651,10 @@ class MockElement extends MockNode {
|
|
|
1643
1651
|
this.__attributeMap = attrs;
|
|
1644
1652
|
}
|
|
1645
1653
|
get children() {
|
|
1646
|
-
return this.childNodes.filter((n) => n.nodeType === 1 /* ELEMENT_NODE */);
|
|
1654
|
+
return this.childNodes.filter((n) => n.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */);
|
|
1647
1655
|
}
|
|
1648
1656
|
get childElementCount() {
|
|
1649
|
-
return this.childNodes.filter((n) => n.nodeType === 1 /* ELEMENT_NODE */).length;
|
|
1657
|
+
return this.childNodes.filter((n) => n.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */).length;
|
|
1650
1658
|
}
|
|
1651
1659
|
get className() {
|
|
1652
1660
|
return this.getAttributeNS(null, 'class') || '';
|
|
@@ -1662,6 +1670,7 @@ class MockElement extends MockNode {
|
|
|
1662
1670
|
}
|
|
1663
1671
|
cloneNode(_deep) {
|
|
1664
1672
|
// implemented on MockElement.prototype from within element.ts
|
|
1673
|
+
// @ts-ignore - implemented on MockElement.prototype from within element.ts
|
|
1665
1674
|
return null;
|
|
1666
1675
|
}
|
|
1667
1676
|
closest(selector) {
|
|
@@ -1751,7 +1760,8 @@ class MockElement extends MockNode {
|
|
|
1751
1760
|
});
|
|
1752
1761
|
}
|
|
1753
1762
|
set innerHTML(html) {
|
|
1754
|
-
|
|
1763
|
+
var _a;
|
|
1764
|
+
if (NON_ESCAPABLE_CONTENT.has((_a = this.nodeName) !== null && _a !== void 0 ? _a : '') === true) {
|
|
1755
1765
|
setTextContent(this, html);
|
|
1756
1766
|
}
|
|
1757
1767
|
else {
|
|
@@ -1863,9 +1873,9 @@ class MockElement extends MockNode {
|
|
|
1863
1873
|
get nextElementSibling() {
|
|
1864
1874
|
const parentElement = this.parentElement;
|
|
1865
1875
|
if (parentElement != null &&
|
|
1866
|
-
(parentElement.nodeType === 1 /* ELEMENT_NODE */ ||
|
|
1867
|
-
parentElement.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */ ||
|
|
1868
|
-
parentElement.nodeType === 9 /* DOCUMENT_NODE */)) {
|
|
1876
|
+
(parentElement.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */ ||
|
|
1877
|
+
parentElement.nodeType === 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */ ||
|
|
1878
|
+
parentElement.nodeType === 9 /* NODE_TYPES.DOCUMENT_NODE */)) {
|
|
1869
1879
|
const children = parentElement.children;
|
|
1870
1880
|
const index = children.indexOf(this) + 1;
|
|
1871
1881
|
return parentElement.children[index] || null;
|
|
@@ -1882,9 +1892,9 @@ class MockElement extends MockNode {
|
|
|
1882
1892
|
get previousElementSibling() {
|
|
1883
1893
|
const parentElement = this.parentElement;
|
|
1884
1894
|
if (parentElement != null &&
|
|
1885
|
-
(parentElement.nodeType === 1 /* ELEMENT_NODE */ ||
|
|
1886
|
-
parentElement.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */ ||
|
|
1887
|
-
parentElement.nodeType === 9 /* DOCUMENT_NODE */)) {
|
|
1895
|
+
(parentElement.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */ ||
|
|
1896
|
+
parentElement.nodeType === 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */ ||
|
|
1897
|
+
parentElement.nodeType === 9 /* NODE_TYPES.DOCUMENT_NODE */)) {
|
|
1888
1898
|
const children = parentElement.children;
|
|
1889
1899
|
const index = children.indexOf(this) - 1;
|
|
1890
1900
|
return parentElement.children[index] || null;
|
|
@@ -2017,7 +2027,8 @@ class MockElement extends MockNode {
|
|
|
2017
2027
|
this.setAttributeNS(null, 'tabindex', value);
|
|
2018
2028
|
}
|
|
2019
2029
|
get tagName() {
|
|
2020
|
-
|
|
2030
|
+
var _a;
|
|
2031
|
+
return (_a = this.nodeName) !== null && _a !== void 0 ? _a : '';
|
|
2021
2032
|
}
|
|
2022
2033
|
set tagName(value) {
|
|
2023
2034
|
this.nodeName = value;
|
|
@@ -2332,10 +2343,11 @@ function getElementsByClassName(elm, classNames, foundElms) {
|
|
|
2332
2343
|
}
|
|
2333
2344
|
}
|
|
2334
2345
|
function getElementsByTagName(elm, tagName, foundElms) {
|
|
2346
|
+
var _a;
|
|
2335
2347
|
const children = elm.children;
|
|
2336
2348
|
for (let i = 0, ii = children.length; i < ii; i++) {
|
|
2337
2349
|
const childElm = children[i];
|
|
2338
|
-
if (tagName === '*' || childElm.nodeName.toLowerCase() === tagName) {
|
|
2350
|
+
if (tagName === '*' || ((_a = childElm.nodeName) !== null && _a !== void 0 ? _a : '').toLowerCase() === tagName) {
|
|
2339
2351
|
foundElms.push(childElm);
|
|
2340
2352
|
}
|
|
2341
2353
|
getElementsByTagName(childElm, tagName, foundElms);
|
|
@@ -2374,14 +2386,17 @@ class MockHTMLElement extends MockElement {
|
|
|
2374
2386
|
this.namespaceURI = 'http://www.w3.org/1999/xhtml';
|
|
2375
2387
|
}
|
|
2376
2388
|
get tagName() {
|
|
2377
|
-
|
|
2389
|
+
var _a;
|
|
2390
|
+
return (_a = this.nodeName) !== null && _a !== void 0 ? _a : '';
|
|
2378
2391
|
}
|
|
2379
2392
|
set tagName(value) {
|
|
2380
2393
|
this.nodeName = value;
|
|
2381
2394
|
}
|
|
2382
2395
|
get attributes() {
|
|
2383
2396
|
if (this.__attributeMap == null) {
|
|
2384
|
-
|
|
2397
|
+
const attrMap = createAttributeProxy(true);
|
|
2398
|
+
this.__attributeMap = attrMap;
|
|
2399
|
+
return attrMap;
|
|
2385
2400
|
}
|
|
2386
2401
|
return this.__attributeMap;
|
|
2387
2402
|
}
|
|
@@ -2391,7 +2406,7 @@ class MockHTMLElement extends MockElement {
|
|
|
2391
2406
|
}
|
|
2392
2407
|
class MockTextNode extends MockNode {
|
|
2393
2408
|
constructor(ownerDocument, text) {
|
|
2394
|
-
super(ownerDocument, 3 /* TEXT_NODE */, "#text" /* TEXT_NODE */, text);
|
|
2409
|
+
super(ownerDocument, 3 /* NODE_TYPES.TEXT_NODE */, "#text" /* NODE_NAMES.TEXT_NODE */, text);
|
|
2395
2410
|
}
|
|
2396
2411
|
cloneNode(_deep) {
|
|
2397
2412
|
return new MockTextNode(null, this.nodeValue);
|
|
@@ -2413,7 +2428,7 @@ class MockTextNode extends MockNode {
|
|
|
2413
2428
|
const text = [];
|
|
2414
2429
|
for (let i = 0, ii = this.parentNode.childNodes.length; i < ii; i++) {
|
|
2415
2430
|
const childNode = this.parentNode.childNodes[i];
|
|
2416
|
-
if (childNode.nodeType === 3 /* TEXT_NODE */) {
|
|
2431
|
+
if (childNode.nodeType === 3 /* NODE_TYPES.TEXT_NODE */) {
|
|
2417
2432
|
text.push(childNode.nodeValue);
|
|
2418
2433
|
}
|
|
2419
2434
|
}
|
|
@@ -2425,10 +2440,10 @@ class MockTextNode extends MockNode {
|
|
|
2425
2440
|
function getTextContent(childNodes, text) {
|
|
2426
2441
|
for (let i = 0, ii = childNodes.length; i < ii; i++) {
|
|
2427
2442
|
const childNode = childNodes[i];
|
|
2428
|
-
if (childNode.nodeType === 3 /* TEXT_NODE */) {
|
|
2443
|
+
if (childNode.nodeType === 3 /* NODE_TYPES.TEXT_NODE */) {
|
|
2429
2444
|
text.push(childNode.nodeValue);
|
|
2430
2445
|
}
|
|
2431
|
-
else if (childNode.nodeType === 1 /* ELEMENT_NODE */) {
|
|
2446
|
+
else if (childNode.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */) {
|
|
2432
2447
|
getTextContent(childNode.childNodes, text);
|
|
2433
2448
|
}
|
|
2434
2449
|
}
|
|
@@ -2443,7 +2458,7 @@ function setTextContent(elm, text) {
|
|
|
2443
2458
|
|
|
2444
2459
|
class MockComment extends MockNode {
|
|
2445
2460
|
constructor(ownerDocument, data) {
|
|
2446
|
-
super(ownerDocument, 8 /* COMMENT_NODE */, "#comment" /* COMMENT_NODE */, data);
|
|
2461
|
+
super(ownerDocument, 8 /* NODE_TYPES.COMMENT_NODE */, "#comment" /* NODE_NAMES.COMMENT_NODE */, data);
|
|
2447
2462
|
}
|
|
2448
2463
|
cloneNode(_deep) {
|
|
2449
2464
|
return new MockComment(null, this.nodeValue);
|
|
@@ -2459,8 +2474,8 @@ class MockComment extends MockNode {
|
|
|
2459
2474
|
class MockDocumentFragment extends MockHTMLElement {
|
|
2460
2475
|
constructor(ownerDocument) {
|
|
2461
2476
|
super(ownerDocument, null);
|
|
2462
|
-
this.nodeName = "#document-fragment" /* DOCUMENT_FRAGMENT_NODE */;
|
|
2463
|
-
this.nodeType = 11 /* DOCUMENT_FRAGMENT_NODE */;
|
|
2477
|
+
this.nodeName = "#document-fragment" /* NODE_NAMES.DOCUMENT_FRAGMENT_NODE */;
|
|
2478
|
+
this.nodeType = 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */;
|
|
2464
2479
|
}
|
|
2465
2480
|
getElementById(id) {
|
|
2466
2481
|
return getElementById(this, id);
|
|
@@ -2470,9 +2485,9 @@ class MockDocumentFragment extends MockHTMLElement {
|
|
|
2470
2485
|
if (deep) {
|
|
2471
2486
|
for (let i = 0, ii = this.childNodes.length; i < ii; i++) {
|
|
2472
2487
|
const childNode = this.childNodes[i];
|
|
2473
|
-
if (childNode.nodeType === 1 /* ELEMENT_NODE */ ||
|
|
2474
|
-
childNode.nodeType === 3 /* TEXT_NODE */ ||
|
|
2475
|
-
childNode.nodeType === 8 /* COMMENT_NODE */) {
|
|
2488
|
+
if (childNode.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */ ||
|
|
2489
|
+
childNode.nodeType === 3 /* NODE_TYPES.TEXT_NODE */ ||
|
|
2490
|
+
childNode.nodeType === 8 /* NODE_TYPES.COMMENT_NODE */) {
|
|
2476
2491
|
const clonedChildNode = this.childNodes[i].cloneNode(true);
|
|
2477
2492
|
cloned.appendChild(clonedChildNode);
|
|
2478
2493
|
}
|
|
@@ -2485,7 +2500,7 @@ class MockDocumentFragment extends MockHTMLElement {
|
|
|
2485
2500
|
class MockDocumentTypeNode extends MockHTMLElement {
|
|
2486
2501
|
constructor(ownerDocument) {
|
|
2487
2502
|
super(ownerDocument, '!DOCTYPE');
|
|
2488
|
-
this.nodeType = 10 /* DOCUMENT_TYPE_NODE */;
|
|
2503
|
+
this.nodeType = 10 /* NODE_TYPES.DOCUMENT_TYPE_NODE */;
|
|
2489
2504
|
this.setAttribute('html', '');
|
|
2490
2505
|
}
|
|
2491
2506
|
}
|
|
@@ -3630,6 +3645,7 @@ class MockNavigator {
|
|
|
3630
3645
|
class MockPerformance {
|
|
3631
3646
|
constructor() {
|
|
3632
3647
|
this.timeOrigin = Date.now();
|
|
3648
|
+
this.eventCounts = new Map();
|
|
3633
3649
|
}
|
|
3634
3650
|
addEventListener() {
|
|
3635
3651
|
//
|
|
@@ -4519,8 +4535,8 @@ function resetWindowDimensions(win) {
|
|
|
4519
4535
|
class MockDocument extends MockHTMLElement {
|
|
4520
4536
|
constructor(html = null, win = null) {
|
|
4521
4537
|
super(null, null);
|
|
4522
|
-
this.nodeName = "#document" /* DOCUMENT_NODE */;
|
|
4523
|
-
this.nodeType = 9 /* DOCUMENT_NODE */;
|
|
4538
|
+
this.nodeName = "#document" /* NODE_NAMES.DOCUMENT_NODE */;
|
|
4539
|
+
this.nodeType = 9 /* NODE_TYPES.DOCUMENT_NODE */;
|
|
4524
4540
|
this.defaultView = win;
|
|
4525
4541
|
this.cookie = '';
|
|
4526
4542
|
this.referrer = '';
|
|
@@ -4594,7 +4610,7 @@ class MockDocument extends MockHTMLElement {
|
|
|
4594
4610
|
}
|
|
4595
4611
|
set documentElement(documentElement) {
|
|
4596
4612
|
for (let i = this.childNodes.length - 1; i >= 0; i--) {
|
|
4597
|
-
if (this.childNodes[i].nodeType !== 10 /* DOCUMENT_TYPE_NODE */) {
|
|
4613
|
+
if (this.childNodes[i].nodeType !== 10 /* NODE_TYPES.DOCUMENT_TYPE_NODE */) {
|
|
4598
4614
|
this.childNodes[i].remove();
|
|
4599
4615
|
}
|
|
4600
4616
|
}
|
|
@@ -4665,7 +4681,7 @@ class MockDocument extends MockHTMLElement {
|
|
|
4665
4681
|
return new MockAttr(attrName, '', namespaceURI);
|
|
4666
4682
|
}
|
|
4667
4683
|
createElement(tagName) {
|
|
4668
|
-
if (tagName === "#document" /* DOCUMENT_NODE */) {
|
|
4684
|
+
if (tagName === "#document" /* NODE_NAMES.DOCUMENT_NODE */) {
|
|
4669
4685
|
const doc = new MockDocument(false);
|
|
4670
4686
|
doc.nodeName = tagName;
|
|
4671
4687
|
doc.parentNode = null;
|
|
@@ -4734,11 +4750,11 @@ function resetDocument(doc) {
|
|
|
4734
4750
|
}
|
|
4735
4751
|
}
|
|
4736
4752
|
try {
|
|
4737
|
-
doc.nodeName = "#document" /* DOCUMENT_NODE */;
|
|
4753
|
+
doc.nodeName = "#document" /* NODE_NAMES.DOCUMENT_NODE */;
|
|
4738
4754
|
}
|
|
4739
4755
|
catch (e) { }
|
|
4740
4756
|
try {
|
|
4741
|
-
doc.nodeType = 9 /* DOCUMENT_NODE */;
|
|
4757
|
+
doc.nodeType = 9 /* NODE_TYPES.DOCUMENT_NODE */;
|
|
4742
4758
|
}
|
|
4743
4759
|
catch (e) { }
|
|
4744
4760
|
try {
|
|
@@ -4788,7 +4804,7 @@ function getElementsByName(elm, elmName, foundElms = []) {
|
|
|
4788
4804
|
function setOwnerDocument(elm, ownerDocument) {
|
|
4789
4805
|
for (let i = 0, ii = elm.childNodes.length; i < ii; i++) {
|
|
4790
4806
|
elm.childNodes[i].ownerDocument = ownerDocument;
|
|
4791
|
-
if (elm.childNodes[i].nodeType === 1 /* ELEMENT_NODE */) {
|
|
4807
|
+
if (elm.childNodes[i].nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */) {
|
|
4792
4808
|
setOwnerDocument(elm.childNodes[i], ownerDocument);
|
|
4793
4809
|
}
|
|
4794
4810
|
}
|
package/mock-doc/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rindo/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.18.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./internal/rindo-core/index.cjs",
|
|
6
6
|
"module": "./internal/rindo-core/index.js",
|
|
@@ -60,7 +60,6 @@
|
|
|
60
60
|
"@types/glob": "^7.1.2",
|
|
61
61
|
"@types/graceful-fs": "^4.1.5",
|
|
62
62
|
"@types/inquirer": "^7.3.1",
|
|
63
|
-
"@types/is-glob": "^4.0.1",
|
|
64
63
|
"@types/jest": "^27.0.3",
|
|
65
64
|
"@types/listr": "^0.14.2",
|
|
66
65
|
"@types/mime-types": "^2.1.0",
|
|
@@ -121,8 +120,7 @@
|
|
|
121
120
|
"semver": "7.3.4",
|
|
122
121
|
"sizzle": "^2.3.6",
|
|
123
122
|
"terser": "5.6.1",
|
|
124
|
-
"
|
|
125
|
-
"typescript": "4.5.4",
|
|
123
|
+
"typescript": "4.7.4",
|
|
126
124
|
"webpack": "^4.46.0",
|
|
127
125
|
"ws": "7.4.6"
|
|
128
126
|
},
|
package/screenshot/index.js
CHANGED
|
@@ -500,18 +500,18 @@ const getEncodedRootLength = (path) => {
|
|
|
500
500
|
return 0;
|
|
501
501
|
const ch0 = path.charCodeAt(0);
|
|
502
502
|
// POSIX or UNC
|
|
503
|
-
if (ch0 === 47 /* slash */ || ch0 === 92 /* backslash */) {
|
|
503
|
+
if (ch0 === 47 /* CharacterCodes.slash */ || ch0 === 92 /* CharacterCodes.backslash */) {
|
|
504
504
|
if (path.charCodeAt(1) !== ch0)
|
|
505
505
|
return 1; // POSIX: "/" (or non-normalized "\")
|
|
506
|
-
const p1 = path.indexOf(ch0 === 47 /* slash */ ? '/' : altDirectorySeparator, 2);
|
|
506
|
+
const p1 = path.indexOf(ch0 === 47 /* CharacterCodes.slash */ ? '/' : altDirectorySeparator, 2);
|
|
507
507
|
if (p1 < 0)
|
|
508
508
|
return path.length; // UNC: "//server" or "\\server"
|
|
509
509
|
return p1 + 1; // UNC: "//server/" or "\\server\"
|
|
510
510
|
}
|
|
511
511
|
// DOS
|
|
512
|
-
if (isVolumeCharacter(ch0) && path.charCodeAt(1) === 58 /* colon */) {
|
|
512
|
+
if (isVolumeCharacter(ch0) && path.charCodeAt(1) === 58 /* CharacterCodes.colon */) {
|
|
513
513
|
const ch2 = path.charCodeAt(2);
|
|
514
|
-
if (ch2 === 47 /* slash */ || ch2 === 92 /* backslash */)
|
|
514
|
+
if (ch2 === 47 /* CharacterCodes.slash */ || ch2 === 92 /* CharacterCodes.backslash */)
|
|
515
515
|
return 3; // DOS: "c:/" or "c:\"
|
|
516
516
|
if (path.length === 2)
|
|
517
517
|
return 2; // DOS: "c:" (but not "c:d")
|
|
@@ -533,7 +533,7 @@ const getEncodedRootLength = (path) => {
|
|
|
533
533
|
isVolumeCharacter(path.charCodeAt(authorityEnd + 1))) {
|
|
534
534
|
const volumeSeparatorEnd = getFileUrlVolumeSeparatorEnd(path, authorityEnd + 2);
|
|
535
535
|
if (volumeSeparatorEnd !== -1) {
|
|
536
|
-
if (path.charCodeAt(volumeSeparatorEnd) === 47 /* slash */) {
|
|
536
|
+
if (path.charCodeAt(volumeSeparatorEnd) === 47 /* CharacterCodes.slash */) {
|
|
537
537
|
// URL: "file:///c:/", "file://localhost/c:/", "file:///c%3a/", "file://localhost/c%3a/"
|
|
538
538
|
return ~(volumeSeparatorEnd + 1);
|
|
539
539
|
}
|
|
@@ -551,15 +551,15 @@ const getEncodedRootLength = (path) => {
|
|
|
551
551
|
// relative
|
|
552
552
|
return 0;
|
|
553
553
|
};
|
|
554
|
-
const isVolumeCharacter = (charCode) => (charCode >= 97 /* a */ && charCode <= 122 /* z */) ||
|
|
555
|
-
(charCode >= 65 /* A */ && charCode <= 90 /* Z */);
|
|
554
|
+
const isVolumeCharacter = (charCode) => (charCode >= 97 /* CharacterCodes.a */ && charCode <= 122 /* CharacterCodes.z */) ||
|
|
555
|
+
(charCode >= 65 /* CharacterCodes.A */ && charCode <= 90 /* CharacterCodes.Z */);
|
|
556
556
|
const getFileUrlVolumeSeparatorEnd = (url, start) => {
|
|
557
557
|
const ch0 = url.charCodeAt(start);
|
|
558
|
-
if (ch0 === 58 /* colon */)
|
|
558
|
+
if (ch0 === 58 /* CharacterCodes.colon */)
|
|
559
559
|
return start + 1;
|
|
560
|
-
if (ch0 === 37 /* percent */ && url.charCodeAt(start + 1) === 51 /* _3 */) {
|
|
560
|
+
if (ch0 === 37 /* CharacterCodes.percent */ && url.charCodeAt(start + 1) === 51 /* CharacterCodes._3 */) {
|
|
561
561
|
const ch2 = url.charCodeAt(start + 2);
|
|
562
|
-
if (ch2 === 97 /* a */ || ch2 === 65 /* A */)
|
|
562
|
+
if (ch2 === 97 /* CharacterCodes.a */ || ch2 === 65 /* CharacterCodes.A */)
|
|
563
563
|
return start + 3;
|
|
564
564
|
}
|
|
565
565
|
return -1;
|
package/screenshot/package.json
CHANGED
package/sys/node/index.js
CHANGED
package/sys/node/package.json
CHANGED
package/sys/node/worker.js
CHANGED