@angular/ssr 19.1.0-next.2 → 19.1.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/LICENSE +1 -1
- package/fesm2022/node.mjs.map +1 -1
- package/fesm2022/ssr.mjs +10 -13
- package/fesm2022/ssr.mjs.map +1 -1
- package/index.d.ts +0 -1
- package/package.json +11 -11
- package/schematics/ng-add/schema.d.ts +12 -4
- package/schematics/ng-add/schema.json +4 -3
- package/third_party/beasties/index.js +107 -96
- package/third_party/beasties/index.js.map +1 -1
- package/schematics/ng-add/index.mjs +0 -9
- package/schematics/ng-add/schema.mjs +0 -3
- package/schematics/schematics.externs.js +0 -0
- package/third_party/beasties/index.d.ts +0 -9
|
@@ -48,7 +48,7 @@ function notImplementedAsync(name) {
|
|
|
48
48
|
function callbackify(fn) {
|
|
49
49
|
const fnc = function(...args) {
|
|
50
50
|
const cb = args.pop();
|
|
51
|
-
fn().catch((error) => cb(error)).then((val) => cb(
|
|
51
|
+
fn().catch((error) => cb(error)).then((val) => cb(undefined, val));
|
|
52
52
|
};
|
|
53
53
|
fnc.__promisify__ = fn;
|
|
54
54
|
fnc.native = fnc;
|
|
@@ -197,14 +197,14 @@ const join = function(...arguments_) {
|
|
|
197
197
|
let joined;
|
|
198
198
|
for (const argument of arguments_) {
|
|
199
199
|
if (argument && argument.length > 0) {
|
|
200
|
-
if (joined ===
|
|
200
|
+
if (joined === undefined) {
|
|
201
201
|
joined = argument;
|
|
202
202
|
} else {
|
|
203
203
|
joined += `/${argument}`;
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
if (joined ===
|
|
207
|
+
if (joined === undefined) {
|
|
208
208
|
return ".";
|
|
209
209
|
}
|
|
210
210
|
return normalize(joined.replace(/\/\/+/g, "/"));
|
|
@@ -389,8 +389,8 @@ var _path = /*#__PURE__*/Object.freeze({
|
|
|
389
389
|
const _pathModule = {
|
|
390
390
|
..._path,
|
|
391
391
|
platform: "posix",
|
|
392
|
-
posix:
|
|
393
|
-
win32:
|
|
392
|
+
posix: undefined,
|
|
393
|
+
win32: undefined
|
|
394
394
|
};
|
|
395
395
|
_pathModule.posix = _pathModule;
|
|
396
396
|
_pathModule.win32 = _pathModule;
|
|
@@ -5314,7 +5314,7 @@ function requireParsers () {
|
|
|
5314
5314
|
// Has any keyword, media type, media feature expression or interpolation
|
|
5315
5315
|
// ('element' hereafter) started
|
|
5316
5316
|
var insideSomeValue = false;
|
|
5317
|
-
var node =
|
|
5317
|
+
var node = undefined;
|
|
5318
5318
|
|
|
5319
5319
|
function resetNode() {
|
|
5320
5320
|
return {
|
|
@@ -5777,7 +5777,7 @@ class NodeWithChildren extends Node {
|
|
|
5777
5777
|
/** First child of the node. */
|
|
5778
5778
|
get firstChild() {
|
|
5779
5779
|
var _a;
|
|
5780
|
-
return (_a = this.children[0]) !== null && _a !==
|
|
5780
|
+
return (_a = this.children[0]) !== null && _a !== undefined ? _a : null;
|
|
5781
5781
|
}
|
|
5782
5782
|
/** Last child of the node. */
|
|
5783
5783
|
get lastChild() {
|
|
@@ -5856,8 +5856,8 @@ class Element extends NodeWithChildren {
|
|
|
5856
5856
|
return ({
|
|
5857
5857
|
name,
|
|
5858
5858
|
value: this.attribs[name],
|
|
5859
|
-
namespace: (_a = this["x-attribsNamespace"]) === null || _a ===
|
|
5860
|
-
prefix: (_b = this["x-attribsPrefix"]) === null || _b ===
|
|
5859
|
+
namespace: (_a = this["x-attribsNamespace"]) === null || _a === undefined ? undefined : _a[name],
|
|
5860
|
+
prefix: (_b = this["x-attribsPrefix"]) === null || _b === undefined ? undefined : _b[name],
|
|
5861
5861
|
});
|
|
5862
5862
|
});
|
|
5863
5863
|
}
|
|
@@ -6017,9 +6017,9 @@ class DomHandler {
|
|
|
6017
6017
|
options = callback;
|
|
6018
6018
|
callback = undefined;
|
|
6019
6019
|
}
|
|
6020
|
-
this.callback = callback !== null && callback !==
|
|
6021
|
-
this.options = options !== null && options !==
|
|
6022
|
-
this.elementCB = elementCB !== null && elementCB !==
|
|
6020
|
+
this.callback = callback !== null && callback !== undefined ? callback : null;
|
|
6021
|
+
this.options = options !== null && options !== undefined ? options : defaultOpts;
|
|
6022
|
+
this.elementCB = elementCB !== null && elementCB !== undefined ? elementCB : null;
|
|
6023
6023
|
}
|
|
6024
6024
|
onparserinit(parser) {
|
|
6025
6025
|
this.parser = parser;
|
|
@@ -6178,7 +6178,7 @@ const decodeMap = new Map([
|
|
|
6178
6178
|
*/
|
|
6179
6179
|
const fromCodePoint =
|
|
6180
6180
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, node/no-unsupported-features/es-builtins
|
|
6181
|
-
(_a = String.fromCodePoint) !== null && _a !==
|
|
6181
|
+
(_a = String.fromCodePoint) !== null && _a !== undefined ? _a : function (codePoint) {
|
|
6182
6182
|
let output = "";
|
|
6183
6183
|
if (codePoint > 0xffff) {
|
|
6184
6184
|
codePoint -= 0x10000;
|
|
@@ -6198,7 +6198,7 @@ function replaceCodePoint(codePoint) {
|
|
|
6198
6198
|
if ((codePoint >= 0xd800 && codePoint <= 0xdfff) || codePoint > 0x10ffff) {
|
|
6199
6199
|
return 0xfffd;
|
|
6200
6200
|
}
|
|
6201
|
-
return (_a = decodeMap.get(codePoint)) !== null && _a !==
|
|
6201
|
+
return (_a = decodeMap.get(codePoint)) !== null && _a !== undefined ? _a : codePoint;
|
|
6202
6202
|
}
|
|
6203
6203
|
|
|
6204
6204
|
var CharCodes$1;
|
|
@@ -6442,7 +6442,7 @@ class EntityDecoder {
|
|
|
6442
6442
|
var _a;
|
|
6443
6443
|
// Ensure we consumed at least one digit.
|
|
6444
6444
|
if (this.consumed <= expectedLength) {
|
|
6445
|
-
(_a = this.errors) === null || _a ===
|
|
6445
|
+
(_a = this.errors) === null || _a === undefined ? undefined : _a.absenceOfDigitsInNumericCharacterReference(this.consumed);
|
|
6446
6446
|
return 0;
|
|
6447
6447
|
}
|
|
6448
6448
|
// Figure out if this is a legit end of the entity
|
|
@@ -6517,7 +6517,7 @@ class EntityDecoder {
|
|
|
6517
6517
|
const { result, decodeTree } = this;
|
|
6518
6518
|
const valueLength = (decodeTree[result] & BinTrieFlags.VALUE_LENGTH) >> 14;
|
|
6519
6519
|
this.emitNamedEntityData(result, valueLength, this.consumed);
|
|
6520
|
-
(_a = this.errors) === null || _a ===
|
|
6520
|
+
(_a = this.errors) === null || _a === undefined ? undefined : _a.missingSemicolonAfterCharacterReference();
|
|
6521
6521
|
return this.consumed;
|
|
6522
6522
|
}
|
|
6523
6523
|
/**
|
|
@@ -6566,7 +6566,7 @@ class EntityDecoder {
|
|
|
6566
6566
|
return this.emitNumericEntity(0, 3);
|
|
6567
6567
|
}
|
|
6568
6568
|
case EntityDecoderState.NumericStart: {
|
|
6569
|
-
(_a = this.errors) === null || _a ===
|
|
6569
|
+
(_a = this.errors) === null || _a === undefined ? undefined : _a.absenceOfDigitsInNumericCharacterReference(this.consumed);
|
|
6570
6570
|
return 0;
|
|
6571
6571
|
}
|
|
6572
6572
|
case EntityDecoderState.EntityStart: {
|
|
@@ -6924,7 +6924,7 @@ function formatAttributes(attributes, opts) {
|
|
|
6924
6924
|
var _a;
|
|
6925
6925
|
if (!attributes)
|
|
6926
6926
|
return;
|
|
6927
|
-
const encode = ((_a = opts.encodeEntities) !== null && _a !==
|
|
6927
|
+
const encode = ((_a = opts.encodeEntities) !== null && _a !== undefined ? _a : opts.decodeEntities) === false
|
|
6928
6928
|
? replaceQuotes
|
|
6929
6929
|
: opts.xmlMode || opts.encodeEntities !== "utf8"
|
|
6930
6930
|
? encodeXML
|
|
@@ -6932,10 +6932,10 @@ function formatAttributes(attributes, opts) {
|
|
|
6932
6932
|
return Object.keys(attributes)
|
|
6933
6933
|
.map((key) => {
|
|
6934
6934
|
var _a, _b;
|
|
6935
|
-
const value = (_a = attributes[key]) !== null && _a !==
|
|
6935
|
+
const value = (_a = attributes[key]) !== null && _a !== undefined ? _a : "";
|
|
6936
6936
|
if (opts.xmlMode === "foreign") {
|
|
6937
6937
|
/* Fix up mixed-case attribute names */
|
|
6938
|
-
key = (_b = attributeNames.get(key)) !== null && _b !==
|
|
6938
|
+
key = (_b = attributeNames.get(key)) !== null && _b !== undefined ? _b : key;
|
|
6939
6939
|
}
|
|
6940
6940
|
if (!opts.emptyAttrs && !opts.xmlMode && value === "") {
|
|
6941
6941
|
return key;
|
|
@@ -7021,7 +7021,7 @@ function renderTag(elem, opts) {
|
|
|
7021
7021
|
// Handle SVG / MathML in HTML
|
|
7022
7022
|
if (opts.xmlMode === "foreign") {
|
|
7023
7023
|
/* Fix up mixed-case element names */
|
|
7024
|
-
elem.name = (_a = elementNames.get(elem.name)) !== null && _a !==
|
|
7024
|
+
elem.name = (_a = elementNames.get(elem.name)) !== null && _a !== undefined ? _a : elem.name;
|
|
7025
7025
|
/* Exit foreign mode at integration points */
|
|
7026
7026
|
if (elem.parent &&
|
|
7027
7027
|
foreignModeIntegrationPoints.has(elem.parent.name)) {
|
|
@@ -7064,7 +7064,7 @@ function renderText(elem, opts) {
|
|
|
7064
7064
|
var _a;
|
|
7065
7065
|
let data = elem.data || "";
|
|
7066
7066
|
// If entities weren't decoded, no need to encode them back
|
|
7067
|
-
if (((_a = opts.encodeEntities) !== null && _a !==
|
|
7067
|
+
if (((_a = opts.encodeEntities) !== null && _a !== undefined ? _a : opts.decodeEntities) !== false &&
|
|
7068
7068
|
!(!opts.xmlMode &&
|
|
7069
7069
|
elem.parent &&
|
|
7070
7070
|
unencodedElements.has(elem.parent.name))) {
|
|
@@ -7217,7 +7217,7 @@ function getSiblings(elem) {
|
|
|
7217
7217
|
*/
|
|
7218
7218
|
function getAttributeValue(elem, name) {
|
|
7219
7219
|
var _a;
|
|
7220
|
-
return (_a = elem.attribs) === null || _a ===
|
|
7220
|
+
return (_a = elem.attribs) === null || _a === undefined ? undefined : _a[name];
|
|
7221
7221
|
}
|
|
7222
7222
|
/**
|
|
7223
7223
|
* Checks whether an element has an attribute.
|
|
@@ -7431,7 +7431,7 @@ function filter(test, node, recurse = true, limit = Infinity) {
|
|
|
7431
7431
|
function find(test, nodes, recurse, limit) {
|
|
7432
7432
|
const result = [];
|
|
7433
7433
|
/** Stack of the arrays we are looking at. */
|
|
7434
|
-
const nodeStack = [nodes];
|
|
7434
|
+
const nodeStack = [Array.isArray(nodes) ? nodes : [nodes]];
|
|
7435
7435
|
/** Stack of the indices within the arrays. */
|
|
7436
7436
|
const indexStack = [0];
|
|
7437
7437
|
for (;;) {
|
|
@@ -7485,20 +7485,19 @@ function findOneChild(test, nodes) {
|
|
|
7485
7485
|
* @returns The first node that passes `test`.
|
|
7486
7486
|
*/
|
|
7487
7487
|
function findOne(test, nodes, recurse = true) {
|
|
7488
|
-
|
|
7489
|
-
for (let i = 0; i <
|
|
7490
|
-
const node =
|
|
7491
|
-
if (
|
|
7492
|
-
|
|
7493
|
-
}
|
|
7494
|
-
else if (test(node)) {
|
|
7495
|
-
elem = node;
|
|
7488
|
+
const searchedNodes = Array.isArray(nodes) ? nodes : [nodes];
|
|
7489
|
+
for (let i = 0; i < searchedNodes.length; i++) {
|
|
7490
|
+
const node = searchedNodes[i];
|
|
7491
|
+
if (isTag(node) && test(node)) {
|
|
7492
|
+
return node;
|
|
7496
7493
|
}
|
|
7497
|
-
|
|
7498
|
-
|
|
7494
|
+
if (recurse && hasChildren(node) && node.children.length > 0) {
|
|
7495
|
+
const found = findOne(test, node.children, true);
|
|
7496
|
+
if (found)
|
|
7497
|
+
return found;
|
|
7499
7498
|
}
|
|
7500
7499
|
}
|
|
7501
|
-
return
|
|
7500
|
+
return null;
|
|
7502
7501
|
}
|
|
7503
7502
|
/**
|
|
7504
7503
|
* Checks if a tree of nodes contains at least one node passing a test.
|
|
@@ -7509,8 +7508,8 @@ function findOne(test, nodes, recurse = true) {
|
|
|
7509
7508
|
* @returns Whether a tree of nodes contains at least one node passing the test.
|
|
7510
7509
|
*/
|
|
7511
7510
|
function existsOne(test, nodes) {
|
|
7512
|
-
return nodes.some((
|
|
7513
|
-
(
|
|
7511
|
+
return (Array.isArray(nodes) ? nodes : [nodes]).some((node) => (isTag(node) && test(node)) ||
|
|
7512
|
+
(hasChildren(node) && existsOne(test, node.children)));
|
|
7514
7513
|
}
|
|
7515
7514
|
/**
|
|
7516
7515
|
* Search an array of nodes and their children for elements passing a test function.
|
|
@@ -7524,7 +7523,7 @@ function existsOne(test, nodes) {
|
|
|
7524
7523
|
*/
|
|
7525
7524
|
function findAll(test, nodes) {
|
|
7526
7525
|
const result = [];
|
|
7527
|
-
const nodeStack = [nodes];
|
|
7526
|
+
const nodeStack = [Array.isArray(nodes) ? nodes : [nodes]];
|
|
7528
7527
|
const indexStack = [0];
|
|
7529
7528
|
for (;;) {
|
|
7530
7529
|
if (indexStack[0] >= nodeStack[0].length) {
|
|
@@ -7538,11 +7537,9 @@ function findAll(test, nodes) {
|
|
|
7538
7537
|
continue;
|
|
7539
7538
|
}
|
|
7540
7539
|
const elem = nodeStack[0][indexStack[0]++];
|
|
7541
|
-
if (
|
|
7542
|
-
continue;
|
|
7543
|
-
if (test(elem))
|
|
7540
|
+
if (isTag(elem) && test(elem))
|
|
7544
7541
|
result.push(elem);
|
|
7545
|
-
if (elem.children.length > 0) {
|
|
7542
|
+
if (hasChildren(elem) && elem.children.length > 0) {
|
|
7546
7543
|
indexStack.unshift(0);
|
|
7547
7544
|
nodeStack.unshift(elem.children);
|
|
7548
7545
|
}
|
|
@@ -7672,6 +7669,19 @@ function getElementById(id, nodes, recurse = true) {
|
|
|
7672
7669
|
function getElementsByTagName(tagName, nodes, recurse = true, limit = Infinity) {
|
|
7673
7670
|
return filter(Checks["tag_name"](tagName), nodes, recurse, limit);
|
|
7674
7671
|
}
|
|
7672
|
+
/**
|
|
7673
|
+
* Returns all nodes with the supplied `className`.
|
|
7674
|
+
*
|
|
7675
|
+
* @category Legacy Query Functions
|
|
7676
|
+
* @param className Class name to search for.
|
|
7677
|
+
* @param nodes Nodes to search through.
|
|
7678
|
+
* @param recurse Also consider child nodes.
|
|
7679
|
+
* @param limit Maximum number of nodes to return.
|
|
7680
|
+
* @returns All nodes with the supplied `className`.
|
|
7681
|
+
*/
|
|
7682
|
+
function getElementsByClassName(className, nodes, recurse = true, limit = Infinity) {
|
|
7683
|
+
return filter(getAttribCheck("class", className), nodes, recurse, limit);
|
|
7684
|
+
}
|
|
7675
7685
|
/**
|
|
7676
7686
|
* Returns all nodes with the supplied `type`.
|
|
7677
7687
|
*
|
|
@@ -7853,7 +7863,7 @@ function getAtomFeed(feedRoot) {
|
|
|
7853
7863
|
const entry = { media: getMediaElements(children) };
|
|
7854
7864
|
addConditionally(entry, "id", "id", children);
|
|
7855
7865
|
addConditionally(entry, "title", "title", children);
|
|
7856
|
-
const href = (_a = getOneElement("link", children)) === null || _a ===
|
|
7866
|
+
const href = (_a = getOneElement("link", children)) === null || _a === undefined ? undefined : _a.attribs["href"];
|
|
7857
7867
|
if (href) {
|
|
7858
7868
|
entry.link = href;
|
|
7859
7869
|
}
|
|
@@ -7870,7 +7880,7 @@ function getAtomFeed(feedRoot) {
|
|
|
7870
7880
|
};
|
|
7871
7881
|
addConditionally(feed, "id", "id", childs);
|
|
7872
7882
|
addConditionally(feed, "title", "title", childs);
|
|
7873
|
-
const href = (_a = getOneElement("link", childs)) === null || _a ===
|
|
7883
|
+
const href = (_a = getOneElement("link", childs)) === null || _a === undefined ? undefined : _a.attribs["href"];
|
|
7874
7884
|
if (href) {
|
|
7875
7885
|
feed.link = href;
|
|
7876
7886
|
}
|
|
@@ -7890,7 +7900,7 @@ function getAtomFeed(feedRoot) {
|
|
|
7890
7900
|
*/
|
|
7891
7901
|
function getRssFeed(feedRoot) {
|
|
7892
7902
|
var _a, _b;
|
|
7893
|
-
const childs = (_b = (_a = getOneElement("channel", feedRoot.children)) === null || _a ===
|
|
7903
|
+
const childs = (_b = (_a = getOneElement("channel", feedRoot.children)) === null || _a === undefined ? undefined : _a.children) !== null && _b !== undefined ? _b : [];
|
|
7894
7904
|
const feed = {
|
|
7895
7905
|
type: feedRoot.name.substr(0, 3),
|
|
7896
7906
|
id: "",
|
|
@@ -8018,6 +8028,7 @@ var DomUtils = /*#__PURE__*/Object.freeze({
|
|
|
8018
8028
|
getChildren: getChildren,
|
|
8019
8029
|
getElementById: getElementById,
|
|
8020
8030
|
getElements: getElements,
|
|
8031
|
+
getElementsByClassName: getElementsByClassName,
|
|
8021
8032
|
getElementsByTagName: getElementsByTagName,
|
|
8022
8033
|
getElementsByTagType: getElementsByTagType,
|
|
8023
8034
|
getFeed: getFeed,
|
|
@@ -8575,9 +8586,9 @@ function sortByProcedure(arr) {
|
|
|
8575
8586
|
}
|
|
8576
8587
|
function getProcedure(token) {
|
|
8577
8588
|
var _a, _b;
|
|
8578
|
-
let proc = (_a = procedure.get(token.type)) !== null && _a !==
|
|
8589
|
+
let proc = (_a = procedure.get(token.type)) !== null && _a !== undefined ? _a : -1;
|
|
8579
8590
|
if (token.type === SelectorType.Attribute) {
|
|
8580
|
-
proc = (_b = attributes.get(token.action)) !== null && _b !==
|
|
8591
|
+
proc = (_b = attributes.get(token.action)) !== null && _b !== undefined ? _b : 4;
|
|
8581
8592
|
if (token.action === AttributeAction.Equals && token.name === "id") {
|
|
8582
8593
|
// Prefer ID selectors (eg. #ID)
|
|
8583
8594
|
proc = 9;
|
|
@@ -8764,7 +8775,7 @@ const attributeRules = {
|
|
|
8764
8775
|
}
|
|
8765
8776
|
return (elem) => {
|
|
8766
8777
|
var _a;
|
|
8767
|
-
return !!((_a = adapter.getAttributeValue(elem, name)) === null || _a ===
|
|
8778
|
+
return !!((_a = adapter.getAttributeValue(elem, name)) === null || _a === undefined ? undefined : _a.startsWith(value)) &&
|
|
8768
8779
|
next(elem);
|
|
8769
8780
|
};
|
|
8770
8781
|
},
|
|
@@ -8781,12 +8792,12 @@ const attributeRules = {
|
|
|
8781
8792
|
return (elem) => {
|
|
8782
8793
|
var _a;
|
|
8783
8794
|
return ((_a = adapter
|
|
8784
|
-
.getAttributeValue(elem, name)) === null || _a ===
|
|
8795
|
+
.getAttributeValue(elem, name)) === null || _a === undefined ? undefined : _a.substr(len).toLowerCase()) === value && next(elem);
|
|
8785
8796
|
};
|
|
8786
8797
|
}
|
|
8787
8798
|
return (elem) => {
|
|
8788
8799
|
var _a;
|
|
8789
|
-
return !!((_a = adapter.getAttributeValue(elem, name)) === null || _a ===
|
|
8800
|
+
return !!((_a = adapter.getAttributeValue(elem, name)) === null || _a === undefined ? undefined : _a.endsWith(value)) &&
|
|
8790
8801
|
next(elem);
|
|
8791
8802
|
};
|
|
8792
8803
|
},
|
|
@@ -8808,7 +8819,7 @@ const attributeRules = {
|
|
|
8808
8819
|
}
|
|
8809
8820
|
return (elem) => {
|
|
8810
8821
|
var _a;
|
|
8811
|
-
return !!((_a = adapter.getAttributeValue(elem, name)) === null || _a ===
|
|
8822
|
+
return !!((_a = adapter.getAttributeValue(elem, name)) === null || _a === undefined ? undefined : _a.includes(value)) &&
|
|
8812
8823
|
next(elem);
|
|
8813
8824
|
};
|
|
8814
8825
|
},
|
|
@@ -8860,7 +8871,7 @@ function parse(formula) {
|
|
|
8860
8871
|
let number = readNumber();
|
|
8861
8872
|
if (idx < formula.length && formula.charAt(idx) === "n") {
|
|
8862
8873
|
idx++;
|
|
8863
|
-
a = sign * (number !== null && number !==
|
|
8874
|
+
a = sign * (number !== null && number !== undefined ? number : 1);
|
|
8864
8875
|
skipWhitespace();
|
|
8865
8876
|
if (idx < formula.length) {
|
|
8866
8877
|
sign = readSign();
|
|
@@ -9343,7 +9354,7 @@ function compilePseudoSelector(next, selector, options, context, compileToken) {
|
|
|
9343
9354
|
}
|
|
9344
9355
|
return subselects[name](next, data, options, context, compileToken);
|
|
9345
9356
|
}
|
|
9346
|
-
const userPseudo = (_a = options.pseudos) === null || _a ===
|
|
9357
|
+
const userPseudo = (_a = options.pseudos) === null || _a === undefined ? undefined : _a[name];
|
|
9347
9358
|
const stringPseudo = typeof userPseudo === "string" ? userPseudo : aliases[name];
|
|
9348
9359
|
if (typeof stringPseudo === "string") {
|
|
9349
9360
|
if (data != null) {
|
|
@@ -9534,7 +9545,7 @@ const SCOPE_TOKEN = {
|
|
|
9534
9545
|
*/
|
|
9535
9546
|
function absolutize(token, { adapter }, context) {
|
|
9536
9547
|
// TODO Use better check if the context is a document
|
|
9537
|
-
const hasContext = !!(context === null || context ===
|
|
9548
|
+
const hasContext = !!(context === null || context === undefined ? undefined : context.every((e) => {
|
|
9538
9549
|
const parent = adapter.isTag(e) && adapter.getParent(e);
|
|
9539
9550
|
return e === PLACEHOLDER_ELEMENT || (parent && adapter.isTag(parent));
|
|
9540
9551
|
}));
|
|
@@ -9554,7 +9565,7 @@ function absolutize(token, { adapter }, context) {
|
|
|
9554
9565
|
function compileToken(token, options, context) {
|
|
9555
9566
|
var _a;
|
|
9556
9567
|
token.forEach(sortByProcedure);
|
|
9557
|
-
context = (_a = options.context) !== null && _a !==
|
|
9568
|
+
context = (_a = options.context) !== null && _a !== undefined ? _a : context;
|
|
9558
9569
|
const isArrayContext = Array.isArray(context);
|
|
9559
9570
|
const finalContext = context && (Array.isArray(context) ? context : [context]);
|
|
9560
9571
|
// Check if the selector is relative
|
|
@@ -9590,7 +9601,7 @@ function compileRules(rules, options, context) {
|
|
|
9590
9601
|
var _a;
|
|
9591
9602
|
return rules.reduce((previous, rule) => previous === boolbase.falseFunc
|
|
9592
9603
|
? boolbase.falseFunc
|
|
9593
|
-
: compileGeneralSelector(previous, rule, options, context, compileToken), (_a = options.rootFunc) !== null && _a !==
|
|
9604
|
+
: compileGeneralSelector(previous, rule, options, context, compileToken), (_a = options.rootFunc) !== null && _a !== undefined ? _a : boolbase.trueFunc);
|
|
9594
9605
|
}
|
|
9595
9606
|
function reduceRules(a, b) {
|
|
9596
9607
|
if (b === boolbase.falseFunc || a === boolbase.trueFunc) {
|
|
@@ -9615,11 +9626,11 @@ function convertOptionFormats(options) {
|
|
|
9615
9626
|
* We force one format of options to the other one.
|
|
9616
9627
|
*/
|
|
9617
9628
|
// @ts-expect-error Default options may have incompatible `Node` / `ElementNode`.
|
|
9618
|
-
const opts = options !== null && options !==
|
|
9629
|
+
const opts = options !== null && options !== undefined ? options : defaultOptions;
|
|
9619
9630
|
// @ts-expect-error Same as above.
|
|
9620
|
-
(_a = opts.adapter) !== null && _a !==
|
|
9631
|
+
(_a = opts.adapter) !== null && _a !== undefined ? _a : (opts.adapter = DomUtils);
|
|
9621
9632
|
// @ts-expect-error `equals` does not exist on `Options`
|
|
9622
|
-
(_b = opts.equals) !== null && _b !==
|
|
9633
|
+
(_b = opts.equals) !== null && _b !== undefined ? _b : (opts.equals = (_d = (_c = opts.adapter) === null || _c === undefined ? undefined : _c.equals) !== null && _d !== undefined ? _d : defaultEquals);
|
|
9623
9634
|
return opts;
|
|
9624
9635
|
}
|
|
9625
9636
|
function getSelectorFunc(searchFunc) {
|
|
@@ -10576,16 +10587,16 @@ class Parser {
|
|
|
10576
10587
|
this.writeIndex = 0;
|
|
10577
10588
|
/** Indicates whether the parser has finished running / `.end` has been called. */
|
|
10578
10589
|
this.ended = false;
|
|
10579
|
-
this.cbs = cbs !== null && cbs !==
|
|
10590
|
+
this.cbs = cbs !== null && cbs !== undefined ? cbs : {};
|
|
10580
10591
|
this.htmlMode = !this.options.xmlMode;
|
|
10581
|
-
this.lowerCaseTagNames = (_a = options.lowerCaseTags) !== null && _a !==
|
|
10592
|
+
this.lowerCaseTagNames = (_a = options.lowerCaseTags) !== null && _a !== undefined ? _a : this.htmlMode;
|
|
10582
10593
|
this.lowerCaseAttributeNames =
|
|
10583
|
-
(_b = options.lowerCaseAttributeNames) !== null && _b !==
|
|
10594
|
+
(_b = options.lowerCaseAttributeNames) !== null && _b !== undefined ? _b : this.htmlMode;
|
|
10584
10595
|
this.recognizeSelfClosing =
|
|
10585
|
-
(_c = options.recognizeSelfClosing) !== null && _c !==
|
|
10586
|
-
this.tokenizer = new ((_d = options.Tokenizer) !== null && _d !==
|
|
10596
|
+
(_c = options.recognizeSelfClosing) !== null && _c !== undefined ? _c : !this.htmlMode;
|
|
10597
|
+
this.tokenizer = new ((_d = options.Tokenizer) !== null && _d !== undefined ? _d : Tokenizer)(this.options, this);
|
|
10587
10598
|
this.foreignContext = [!this.htmlMode];
|
|
10588
|
-
(_f = (_e = this.cbs).onparserinit) === null || _f ===
|
|
10599
|
+
(_f = (_e = this.cbs).onparserinit) === null || _f === undefined ? undefined : _f.call(_e, this);
|
|
10589
10600
|
}
|
|
10590
10601
|
// Tokenizer event handlers
|
|
10591
10602
|
/** @internal */
|
|
@@ -10593,14 +10604,14 @@ class Parser {
|
|
|
10593
10604
|
var _a, _b;
|
|
10594
10605
|
const data = this.getSlice(start, endIndex);
|
|
10595
10606
|
this.endIndex = endIndex - 1;
|
|
10596
|
-
(_b = (_a = this.cbs).ontext) === null || _b ===
|
|
10607
|
+
(_b = (_a = this.cbs).ontext) === null || _b === undefined ? undefined : _b.call(_a, data);
|
|
10597
10608
|
this.startIndex = endIndex;
|
|
10598
10609
|
}
|
|
10599
10610
|
/** @internal */
|
|
10600
10611
|
ontextentity(cp, endIndex) {
|
|
10601
10612
|
var _a, _b;
|
|
10602
10613
|
this.endIndex = endIndex - 1;
|
|
10603
|
-
(_b = (_a = this.cbs).ontext) === null || _b ===
|
|
10614
|
+
(_b = (_a = this.cbs).ontext) === null || _b === undefined ? undefined : _b.call(_a, fromCodePoint(cp));
|
|
10604
10615
|
this.startIndex = endIndex;
|
|
10605
10616
|
}
|
|
10606
10617
|
/**
|
|
@@ -10627,7 +10638,7 @@ class Parser {
|
|
|
10627
10638
|
if (impliesClose) {
|
|
10628
10639
|
while (this.stack.length > 0 && impliesClose.has(this.stack[0])) {
|
|
10629
10640
|
const element = this.stack.shift();
|
|
10630
|
-
(_b = (_a = this.cbs).onclosetag) === null || _b ===
|
|
10641
|
+
(_b = (_a = this.cbs).onclosetag) === null || _b === undefined ? undefined : _b.call(_a, element, true);
|
|
10631
10642
|
}
|
|
10632
10643
|
}
|
|
10633
10644
|
if (!this.isVoidElement(name)) {
|
|
@@ -10641,7 +10652,7 @@ class Parser {
|
|
|
10641
10652
|
}
|
|
10642
10653
|
}
|
|
10643
10654
|
}
|
|
10644
|
-
(_d = (_c = this.cbs).onopentagname) === null || _d ===
|
|
10655
|
+
(_d = (_c = this.cbs).onopentagname) === null || _d === undefined ? undefined : _d.call(_c, name);
|
|
10645
10656
|
if (this.cbs.onopentag)
|
|
10646
10657
|
this.attribs = {};
|
|
10647
10658
|
}
|
|
@@ -10649,7 +10660,7 @@ class Parser {
|
|
|
10649
10660
|
var _a, _b;
|
|
10650
10661
|
this.startIndex = this.openTagStart;
|
|
10651
10662
|
if (this.attribs) {
|
|
10652
|
-
(_b = (_a = this.cbs).onopentag) === null || _b ===
|
|
10663
|
+
(_b = (_a = this.cbs).onopentag) === null || _b === undefined ? undefined : _b.call(_a, this.tagname, this.attribs, isImplied);
|
|
10653
10664
|
this.attribs = null;
|
|
10654
10665
|
}
|
|
10655
10666
|
if (this.cbs.onclosetag && this.isVoidElement(this.tagname)) {
|
|
@@ -10683,7 +10694,7 @@ class Parser {
|
|
|
10683
10694
|
for (let index = 0; index <= pos; index++) {
|
|
10684
10695
|
const element = this.stack.shift();
|
|
10685
10696
|
// We know the stack has sufficient elements.
|
|
10686
|
-
(_b = (_a = this.cbs).onclosetag) === null || _b ===
|
|
10697
|
+
(_b = (_a = this.cbs).onclosetag) === null || _b === undefined ? undefined : _b.call(_a, element, index !== pos);
|
|
10687
10698
|
}
|
|
10688
10699
|
}
|
|
10689
10700
|
else if (this.htmlMode && name === "p") {
|
|
@@ -10694,9 +10705,9 @@ class Parser {
|
|
|
10694
10705
|
}
|
|
10695
10706
|
else if (this.htmlMode && name === "br") {
|
|
10696
10707
|
// We can't use `emitOpenTag` for implicit open, as `br` would be implicitly closed.
|
|
10697
|
-
(_d = (_c = this.cbs).onopentagname) === null || _d ===
|
|
10698
|
-
(_f = (_e = this.cbs).onopentag) === null || _f ===
|
|
10699
|
-
(_h = (_g = this.cbs).onclosetag) === null || _h ===
|
|
10708
|
+
(_d = (_c = this.cbs).onopentagname) === null || _d === undefined ? undefined : _d.call(_c, "br");
|
|
10709
|
+
(_f = (_e = this.cbs).onopentag) === null || _f === undefined ? undefined : _f.call(_e, "br", {}, true);
|
|
10710
|
+
(_h = (_g = this.cbs).onclosetag) === null || _h === undefined ? undefined : _h.call(_g, "br", false);
|
|
10700
10711
|
}
|
|
10701
10712
|
// Set `startIndex` for next node
|
|
10702
10713
|
this.startIndex = endIndex + 1;
|
|
@@ -10721,7 +10732,7 @@ class Parser {
|
|
|
10721
10732
|
// Self-closing tags will be on the top of the stack
|
|
10722
10733
|
if (this.stack[0] === name) {
|
|
10723
10734
|
// If the opening tag isn't implied, the closing tag has to be implied.
|
|
10724
|
-
(_b = (_a = this.cbs).onclosetag) === null || _b ===
|
|
10735
|
+
(_b = (_a = this.cbs).onclosetag) === null || _b === undefined ? undefined : _b.call(_a, name, !isOpenImplied);
|
|
10725
10736
|
this.stack.shift();
|
|
10726
10737
|
}
|
|
10727
10738
|
}
|
|
@@ -10745,7 +10756,7 @@ class Parser {
|
|
|
10745
10756
|
onattribend(quote, endIndex) {
|
|
10746
10757
|
var _a, _b;
|
|
10747
10758
|
this.endIndex = endIndex;
|
|
10748
|
-
(_b = (_a = this.cbs).onattribute) === null || _b ===
|
|
10759
|
+
(_b = (_a = this.cbs).onattribute) === null || _b === undefined ? undefined : _b.call(_a, this.attribname, this.attribvalue, quote === QuoteType.Double
|
|
10749
10760
|
? '"'
|
|
10750
10761
|
: quote === QuoteType.Single
|
|
10751
10762
|
? "'"
|
|
@@ -10792,8 +10803,8 @@ class Parser {
|
|
|
10792
10803
|
oncomment(start, endIndex, offset) {
|
|
10793
10804
|
var _a, _b, _c, _d;
|
|
10794
10805
|
this.endIndex = endIndex;
|
|
10795
|
-
(_b = (_a = this.cbs).oncomment) === null || _b ===
|
|
10796
|
-
(_d = (_c = this.cbs).oncommentend) === null || _d ===
|
|
10806
|
+
(_b = (_a = this.cbs).oncomment) === null || _b === undefined ? undefined : _b.call(_a, this.getSlice(start, endIndex - offset));
|
|
10807
|
+
(_d = (_c = this.cbs).oncommentend) === null || _d === undefined ? undefined : _d.call(_c);
|
|
10797
10808
|
// Set `startIndex` for next node
|
|
10798
10809
|
this.startIndex = endIndex + 1;
|
|
10799
10810
|
}
|
|
@@ -10803,13 +10814,13 @@ class Parser {
|
|
|
10803
10814
|
this.endIndex = endIndex;
|
|
10804
10815
|
const value = this.getSlice(start, endIndex - offset);
|
|
10805
10816
|
if (!this.htmlMode || this.options.recognizeCDATA) {
|
|
10806
|
-
(_b = (_a = this.cbs).oncdatastart) === null || _b ===
|
|
10807
|
-
(_d = (_c = this.cbs).ontext) === null || _d ===
|
|
10808
|
-
(_f = (_e = this.cbs).oncdataend) === null || _f ===
|
|
10817
|
+
(_b = (_a = this.cbs).oncdatastart) === null || _b === undefined ? undefined : _b.call(_a);
|
|
10818
|
+
(_d = (_c = this.cbs).ontext) === null || _d === undefined ? undefined : _d.call(_c, value);
|
|
10819
|
+
(_f = (_e = this.cbs).oncdataend) === null || _f === undefined ? undefined : _f.call(_e);
|
|
10809
10820
|
}
|
|
10810
10821
|
else {
|
|
10811
|
-
(_h = (_g = this.cbs).oncomment) === null || _h ===
|
|
10812
|
-
(_k = (_j = this.cbs).oncommentend) === null || _k ===
|
|
10822
|
+
(_h = (_g = this.cbs).oncomment) === null || _h === undefined ? undefined : _h.call(_g, `[CDATA[${value}]]`);
|
|
10823
|
+
(_k = (_j = this.cbs).oncommentend) === null || _k === undefined ? undefined : _k.call(_j);
|
|
10813
10824
|
}
|
|
10814
10825
|
// Set `startIndex` for next node
|
|
10815
10826
|
this.startIndex = endIndex + 1;
|
|
@@ -10824,14 +10835,14 @@ class Parser {
|
|
|
10824
10835
|
this.cbs.onclosetag(this.stack[index], true);
|
|
10825
10836
|
}
|
|
10826
10837
|
}
|
|
10827
|
-
(_b = (_a = this.cbs).onend) === null || _b ===
|
|
10838
|
+
(_b = (_a = this.cbs).onend) === null || _b === undefined ? undefined : _b.call(_a);
|
|
10828
10839
|
}
|
|
10829
10840
|
/**
|
|
10830
10841
|
* Resets the parser to a blank state, ready to parse a new HTML document
|
|
10831
10842
|
*/
|
|
10832
10843
|
reset() {
|
|
10833
10844
|
var _a, _b, _c, _d;
|
|
10834
|
-
(_b = (_a = this.cbs).onreset) === null || _b ===
|
|
10845
|
+
(_b = (_a = this.cbs).onreset) === null || _b === undefined ? undefined : _b.call(_a);
|
|
10835
10846
|
this.tokenizer.reset();
|
|
10836
10847
|
this.tagname = "";
|
|
10837
10848
|
this.attribname = "";
|
|
@@ -10839,7 +10850,7 @@ class Parser {
|
|
|
10839
10850
|
this.stack.length = 0;
|
|
10840
10851
|
this.startIndex = 0;
|
|
10841
10852
|
this.endIndex = 0;
|
|
10842
|
-
(_d = (_c = this.cbs).onparserinit) === null || _d ===
|
|
10853
|
+
(_d = (_c = this.cbs).onparserinit) === null || _d === undefined ? undefined : _d.call(_c, this);
|
|
10843
10854
|
this.buffers.length = 0;
|
|
10844
10855
|
this.foreignContext.length = 0;
|
|
10845
10856
|
this.foreignContext.unshift(!this.htmlMode);
|
|
@@ -10881,7 +10892,7 @@ class Parser {
|
|
|
10881
10892
|
write(chunk) {
|
|
10882
10893
|
var _a, _b;
|
|
10883
10894
|
if (this.ended) {
|
|
10884
|
-
(_b = (_a = this.cbs).onerror) === null || _b ===
|
|
10895
|
+
(_b = (_a = this.cbs).onerror) === null || _b === undefined ? undefined : _b.call(_a, new Error(".write() after done!"));
|
|
10885
10896
|
return;
|
|
10886
10897
|
}
|
|
10887
10898
|
this.buffers.push(chunk);
|
|
@@ -10898,7 +10909,7 @@ class Parser {
|
|
|
10898
10909
|
end(chunk) {
|
|
10899
10910
|
var _a, _b;
|
|
10900
10911
|
if (this.ended) {
|
|
10901
|
-
(_b = (_a = this.cbs).onerror) === null || _b ===
|
|
10912
|
+
(_b = (_a = this.cbs).onerror) === null || _b === undefined ? undefined : _b.call(_a, new Error(".end() after done!"));
|
|
10902
10913
|
return;
|
|
10903
10914
|
}
|
|
10904
10915
|
if (chunk)
|
|
@@ -11004,7 +11015,7 @@ function serializeStylesheet(ast, options) {
|
|
|
11004
11015
|
}
|
|
11005
11016
|
function markOnly(predicate) {
|
|
11006
11017
|
return (rule) => {
|
|
11007
|
-
const sel = "selectors" in rule ? rule.selectors :
|
|
11018
|
+
const sel = "selectors" in rule ? rule.selectors : undefined;
|
|
11008
11019
|
if (predicate(rule) === false) {
|
|
11009
11020
|
rule.$$remove = true;
|
|
11010
11021
|
}
|
|
@@ -11033,7 +11044,7 @@ function walkStyleRules(node, iterator) {
|
|
|
11033
11044
|
if (hasNestedRules(rule)) {
|
|
11034
11045
|
walkStyleRules(rule, iterator);
|
|
11035
11046
|
}
|
|
11036
|
-
rule._other =
|
|
11047
|
+
rule._other = undefined;
|
|
11037
11048
|
rule.filterSelectors = filterSelectors;
|
|
11038
11049
|
return iterator(rule) !== false;
|
|
11039
11050
|
});
|
|
@@ -11346,7 +11357,7 @@ function extendDocument(document) {
|
|
|
11346
11357
|
const selectorTokensCache = /* @__PURE__ */ new Map();
|
|
11347
11358
|
function cachedQuerySelector(sel, node) {
|
|
11348
11359
|
let selectorTokens = selectorTokensCache.get(sel);
|
|
11349
|
-
if (selectorTokens ===
|
|
11360
|
+
if (selectorTokens === undefined) {
|
|
11350
11361
|
selectorTokens = parseRelevantSelectors(sel);
|
|
11351
11362
|
selectorTokensCache.set(sel, selectorTokens);
|
|
11352
11363
|
}
|
|
@@ -11537,11 +11548,11 @@ class Beasties {
|
|
|
11537
11548
|
normalizedPath = normalizedPath.substring(pathPrefix.length).replace(/^\//, "");
|
|
11538
11549
|
}
|
|
11539
11550
|
if (/^https?:\/\//.test(normalizedPath) || href.startsWith("//")) {
|
|
11540
|
-
return
|
|
11551
|
+
return undefined;
|
|
11541
11552
|
}
|
|
11542
11553
|
const filename = _pathModule.resolve(outputPath, normalizedPath);
|
|
11543
11554
|
if (!isSubpath(outputPath, filename)) {
|
|
11544
|
-
return
|
|
11555
|
+
return undefined;
|
|
11545
11556
|
}
|
|
11546
11557
|
let sheet;
|
|
11547
11558
|
try {
|
|
@@ -11593,11 +11604,11 @@ class Beasties {
|
|
|
11593
11604
|
const href = link.getAttribute("href");
|
|
11594
11605
|
let media = link.getAttribute("media");
|
|
11595
11606
|
if (media && !validateMediaQuery(media)) {
|
|
11596
|
-
media =
|
|
11607
|
+
media = undefined;
|
|
11597
11608
|
}
|
|
11598
11609
|
const preloadMode = this.options.preload;
|
|
11599
11610
|
if (!href?.endsWith(".css")) {
|
|
11600
|
-
return
|
|
11611
|
+
return undefined;
|
|
11601
11612
|
}
|
|
11602
11613
|
const style = document.createElement("style");
|
|
11603
11614
|
style.$$external = true;
|
|
@@ -11895,7 +11906,7 @@ class Beasties {
|
|
|
11895
11906
|
}
|
|
11896
11907
|
normalizeCssSelector(sel) {
|
|
11897
11908
|
let normalizedSelector = __privateGet(this, _selectorCache).get(sel);
|
|
11898
|
-
if (normalizedSelector !==
|
|
11909
|
+
if (normalizedSelector !== undefined) {
|
|
11899
11910
|
return normalizedSelector;
|
|
11900
11911
|
}
|
|
11901
11912
|
normalizedSelector = sel.replace(removePseudoClassesAndElementsPattern, "").replace(removeTrailingCommasPattern, (match) => match.includes("(") ? "(" : ")").trim();
|