gyosjs 0.3.0 → 0.3.2
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/dist/core/router/csp-html.d.ts +2 -0
- package/dist/core/router/csp-html.d.ts.map +1 -0
- package/dist/core/router/diff-nodes.d.ts.map +1 -1
- package/dist/core/router/router.d.ts.map +1 -1
- package/dist/gyos.auto.esm.js +279 -32
- package/dist/gyos.auto.esm.js.map +1 -1
- package/dist/gyos.auto.js +279 -32
- package/dist/gyos.auto.js.map +1 -1
- package/dist/gyos.auto.min.js +2 -2
- package/dist/gyos.csp.auto.esm.js +375 -208
- package/dist/gyos.csp.auto.esm.js.map +1 -1
- package/dist/gyos.csp.auto.js +375 -208
- package/dist/gyos.csp.auto.js.map +1 -1
- package/dist/gyos.csp.auto.min.js +2 -2
- package/dist/gyos.csp.esm.js +375 -208
- package/dist/gyos.csp.esm.js.map +1 -1
- package/dist/gyos.csp.js +375 -208
- package/dist/gyos.csp.js.map +1 -1
- package/dist/gyos.csp.min.js +2 -2
- package/dist/gyos.esm.js +279 -32
- package/dist/gyos.esm.js.map +1 -1
- package/dist/gyos.js +279 -32
- package/dist/gyos.js.map +1 -1
- package/dist/gyos.min.js +2 -2
- package/dist/runtime/csp-nonce.d.ts +1 -1
- package/dist/runtime/csp-nonce.d.ts.map +1 -1
- package/dist/template/process.d.ts.map +1 -1
- package/dist/template/structurals/transition-helpers.d.ts +1 -1
- package/dist/template/structurals/transition-helpers.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/runtime/install-csp.d.ts +0 -2
- package/dist/runtime/install-csp.d.ts.map +0 -1
- package/dist/runtime/install-standard.d.ts +0 -2
- package/dist/runtime/install-standard.d.ts.map +0 -1
package/dist/gyos.csp.auto.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* GyosJS v0.3.
|
|
2
|
+
* GyosJS v0.3.2
|
|
3
3
|
* (c) 2026
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
@@ -2268,32 +2268,24 @@
|
|
|
2268
2268
|
* Handles:
|
|
2269
2269
|
* 1. Literal string: "fade" or "slide-down"
|
|
2270
2270
|
* 2. Expression with {}: "{transition}"
|
|
2271
|
-
* 3.
|
|
2271
|
+
* 3. Quoted literal kept for backwards compatibility: "'fade'"
|
|
2272
2272
|
*
|
|
2273
2273
|
* @param attrValue - The g-transition attribute value
|
|
2274
2274
|
* @param scope - Current scope for expression evaluation
|
|
2275
2275
|
* @returns The transition name (string)
|
|
2276
2276
|
*/
|
|
2277
2277
|
function parseTransitionName(attrValue, scope) {
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
}
|
|
2284
|
-
}
|
|
2285
|
-
// Try to evaluate as expression first (variable name)
|
|
2286
|
-
// If it fails or returns undefined, use as literal string
|
|
2287
|
-
try {
|
|
2288
|
-
const evaluated = evaluateExpression(attrValue, scope);
|
|
2289
|
-
if (evaluated !== undefined && evaluated !== null) {
|
|
2290
|
-
return evaluated;
|
|
2291
|
-
}
|
|
2278
|
+
const value = attrValue.trim();
|
|
2279
|
+
const expression = /^\{([\s\S]+)\}$/.exec(value);
|
|
2280
|
+
if (expression) {
|
|
2281
|
+
const evaluated = evaluateExpression(expression[1].trim(), scope);
|
|
2282
|
+
return evaluated == null ? '' : String(evaluated);
|
|
2292
2283
|
}
|
|
2293
|
-
|
|
2294
|
-
|
|
2284
|
+
if (value.length >= 2 && ((value.startsWith("'") && value.endsWith("'"))
|
|
2285
|
+
|| (value.startsWith('"') && value.endsWith('"')))) {
|
|
2286
|
+
return value.slice(1, -1);
|
|
2295
2287
|
}
|
|
2296
|
-
return
|
|
2288
|
+
return value;
|
|
2297
2289
|
}
|
|
2298
2290
|
/**
|
|
2299
2291
|
* Parse transition config from element's g-transition attribute
|
|
@@ -5197,6 +5189,10 @@
|
|
|
5197
5189
|
const structuralElements = [];
|
|
5198
5190
|
const root = elements[0];
|
|
5199
5191
|
elements.forEach(el => {
|
|
5192
|
+
// Await branches are detached and parsed only after their alias scope exists.
|
|
5193
|
+
// Do not evaluate nested structural expressions during the parent scan.
|
|
5194
|
+
if (isAwaitBranchDescendant(el))
|
|
5195
|
+
return;
|
|
5200
5196
|
const hasIf = el.hasAttribute('*if');
|
|
5201
5197
|
const hasFor = el.hasAttribute('*for');
|
|
5202
5198
|
const hasSwitch = el.hasAttribute('*switch');
|
|
@@ -5241,6 +5237,20 @@
|
|
|
5241
5237
|
}
|
|
5242
5238
|
});
|
|
5243
5239
|
}
|
|
5240
|
+
function isAwaitBranchDescendant(element) {
|
|
5241
|
+
let child = element;
|
|
5242
|
+
let parent = element.parentElement;
|
|
5243
|
+
while (parent && parent !== document.body) {
|
|
5244
|
+
if (parent.hasAttribute('*await') && (child.hasAttribute('*pending') ||
|
|
5245
|
+
child.hasAttribute('*then') ||
|
|
5246
|
+
child.hasAttribute('*catch'))) {
|
|
5247
|
+
return true;
|
|
5248
|
+
}
|
|
5249
|
+
child = parent;
|
|
5250
|
+
parent = parent.parentElement;
|
|
5251
|
+
}
|
|
5252
|
+
return false;
|
|
5253
|
+
}
|
|
5244
5254
|
const elementBelongsToAnotherScope = (el, scope) => {
|
|
5245
5255
|
const owner = getScopeFromElement(el);
|
|
5246
5256
|
return Boolean(owner && owner !== scope);
|
|
@@ -6762,7 +6772,7 @@
|
|
|
6762
6772
|
}
|
|
6763
6773
|
|
|
6764
6774
|
let nonceSource;
|
|
6765
|
-
/** Configure the nonce used
|
|
6775
|
+
/** Configure the active document nonce used for scripts and styles during MPA navigation. */
|
|
6766
6776
|
function setCspNonce(source) {
|
|
6767
6777
|
nonceSource = source;
|
|
6768
6778
|
}
|
|
@@ -7348,9 +7358,33 @@
|
|
|
7348
7358
|
window.scrollTo({ top: 0, behavior: 'smooth' });
|
|
7349
7359
|
}
|
|
7350
7360
|
|
|
7351
|
-
function
|
|
7352
|
-
return
|
|
7353
|
-
|
|
7361
|
+
function isNonceMeta(el) {
|
|
7362
|
+
return el.tagName === 'META' && el.getAttribute('name')?.toLowerCase() === 'csp-nonce';
|
|
7363
|
+
}
|
|
7364
|
+
function isStylesheetLink(el) {
|
|
7365
|
+
return el.tagName === 'LINK'
|
|
7366
|
+
&& (el.getAttribute('rel') || '').toLowerCase().split(/\s+/).includes('stylesheet');
|
|
7367
|
+
}
|
|
7368
|
+
function usesCspNonce(el) {
|
|
7369
|
+
return el.tagName === 'SCRIPT' || el.tagName === 'STYLE' || isStylesheetLink(el);
|
|
7370
|
+
}
|
|
7371
|
+
function serializeAttributes(el, context) {
|
|
7372
|
+
const attributes = new Map();
|
|
7373
|
+
Array.from(el.attributes).forEach(attr => {
|
|
7374
|
+
if (context.csp && usesCspNonce(el) && attr.name.toLowerCase() === 'nonce')
|
|
7375
|
+
return;
|
|
7376
|
+
if (context.csp && isNonceMeta(el) && attr.name.toLowerCase() === 'content')
|
|
7377
|
+
return;
|
|
7378
|
+
attributes.set(attr.name, attr.value);
|
|
7379
|
+
});
|
|
7380
|
+
if (context.csp && usesCspNonce(el) && context.activeNonce) {
|
|
7381
|
+
attributes.set('nonce', context.activeNonce);
|
|
7382
|
+
}
|
|
7383
|
+
if (context.csp && isNonceMeta(el) && context.activeNonce) {
|
|
7384
|
+
attributes.set('content', context.activeNonce);
|
|
7385
|
+
}
|
|
7386
|
+
return Array.from(attributes)
|
|
7387
|
+
.map(([name, value]) => `${name}=${value}`)
|
|
7354
7388
|
.sort()
|
|
7355
7389
|
.join('|');
|
|
7356
7390
|
}
|
|
@@ -7361,23 +7395,61 @@
|
|
|
7361
7395
|
}
|
|
7362
7396
|
return String(hash);
|
|
7363
7397
|
}
|
|
7364
|
-
function elementKey(el) {
|
|
7398
|
+
function elementKey(el, context) {
|
|
7365
7399
|
const tag = el.tagName.toLowerCase();
|
|
7366
7400
|
const content = tag === 'script' || tag === 'style' ? hashContent(el.textContent || '') : '';
|
|
7367
|
-
return `${tag}|${serializeAttributes(el)}|${content}`;
|
|
7401
|
+
return `${tag}|${serializeAttributes(el, context)}|${content}`;
|
|
7368
7402
|
}
|
|
7369
|
-
function keyedNodes(nodes) {
|
|
7403
|
+
function keyedNodes(nodes, context) {
|
|
7370
7404
|
const occurrences = new Map();
|
|
7371
7405
|
return nodes.map(node => {
|
|
7372
|
-
const baseKey = elementKey(node);
|
|
7406
|
+
const baseKey = elementKey(node, context);
|
|
7373
7407
|
const occurrence = occurrences.get(baseKey) || 0;
|
|
7374
7408
|
occurrences.set(baseKey, occurrence + 1);
|
|
7375
7409
|
return { key: `${baseKey}|${occurrence}`, node };
|
|
7376
7410
|
});
|
|
7377
7411
|
}
|
|
7412
|
+
function canInsertNode(node, context) {
|
|
7413
|
+
if (!context.csp)
|
|
7414
|
+
return true;
|
|
7415
|
+
if (isNonceMeta(node))
|
|
7416
|
+
return Boolean(context.activeNonce);
|
|
7417
|
+
if (node.tagName === 'STYLE')
|
|
7418
|
+
return Boolean(context.activeNonce);
|
|
7419
|
+
if (node.tagName === 'SCRIPT' && !node.hasAttribute('src'))
|
|
7420
|
+
return Boolean(context.activeNonce);
|
|
7421
|
+
return true;
|
|
7422
|
+
}
|
|
7423
|
+
function reconcileCspAttributes(node, context) {
|
|
7424
|
+
if (!context.csp)
|
|
7425
|
+
return;
|
|
7426
|
+
if (isNonceMeta(node)) {
|
|
7427
|
+
if (context.activeNonce)
|
|
7428
|
+
node.setAttribute('content', context.activeNonce);
|
|
7429
|
+
return;
|
|
7430
|
+
}
|
|
7431
|
+
if (!usesCspNonce(node))
|
|
7432
|
+
return;
|
|
7433
|
+
node.removeAttribute('nonce');
|
|
7434
|
+
if (context.activeNonce)
|
|
7435
|
+
node.setAttribute('nonce', context.activeNonce);
|
|
7436
|
+
}
|
|
7437
|
+
function warnSkippedNode(node) {
|
|
7438
|
+
if (node.tagName === 'STYLE') {
|
|
7439
|
+
console.warn('[GyosJS CSP] Skipped an inline MPA style because no active document nonce is configured.');
|
|
7440
|
+
}
|
|
7441
|
+
else if (node.tagName === 'SCRIPT' && !node.hasAttribute('src')) {
|
|
7442
|
+
console.warn('[GyosJS CSP] Skipped an inline MPA script because no active document nonce is configured.');
|
|
7443
|
+
}
|
|
7444
|
+
}
|
|
7378
7445
|
async function diffNodes(currentNodes, nextNodes, container = document.head, signal) {
|
|
7379
|
-
const
|
|
7380
|
-
const
|
|
7446
|
+
const csp = expressionRuntimeMode() === 'csp';
|
|
7447
|
+
const context = {
|
|
7448
|
+
csp,
|
|
7449
|
+
activeNonce: csp ? resolveCspNonce() : undefined
|
|
7450
|
+
};
|
|
7451
|
+
const current = keyedNodes(currentNodes, context);
|
|
7452
|
+
const next = keyedNodes(nextNodes, context);
|
|
7381
7453
|
const currentKeys = new Set(current.map(item => item.key));
|
|
7382
7454
|
const nextKeys = new Set(next.map(item => item.key));
|
|
7383
7455
|
// Remove nodes that are not in the new head
|
|
@@ -7391,6 +7463,20 @@
|
|
|
7391
7463
|
if (signal?.aborted)
|
|
7392
7464
|
return;
|
|
7393
7465
|
if (!currentKeys.has(key)) {
|
|
7466
|
+
if (!canInsertNode(node, context)) {
|
|
7467
|
+
warnSkippedNode(node);
|
|
7468
|
+
continue;
|
|
7469
|
+
}
|
|
7470
|
+
if (node.tagName === 'STYLE') {
|
|
7471
|
+
const style = document.createElement('style');
|
|
7472
|
+
Array.from(node.attributes).forEach(attr => style.setAttribute(attr.name, attr.value));
|
|
7473
|
+
reconcileCspAttributes(style, context);
|
|
7474
|
+
// CSP checks inline styles as their CSS text is attached. Set the active
|
|
7475
|
+
// nonce first so a response nonce never produces a transient violation.
|
|
7476
|
+
style.textContent = node.textContent || '';
|
|
7477
|
+
container.appendChild(style);
|
|
7478
|
+
continue;
|
|
7479
|
+
}
|
|
7394
7480
|
if (node.tagName === 'SCRIPT') {
|
|
7395
7481
|
const originalScript = node;
|
|
7396
7482
|
const executionKey = getScriptExecutionKey(originalScript);
|
|
@@ -7401,6 +7487,7 @@
|
|
|
7401
7487
|
}
|
|
7402
7488
|
const script = document.createElement('script');
|
|
7403
7489
|
Array.from(node.attributes).forEach(attr => script.setAttribute(attr.name, attr.value));
|
|
7490
|
+
reconcileCspAttributes(script, context);
|
|
7404
7491
|
script.textContent = node.hasAttribute('g-script-wrap')
|
|
7405
7492
|
? wrapScriptExecution(node.textContent || '')
|
|
7406
7493
|
: node.textContent || '';
|
|
@@ -7410,11 +7497,168 @@
|
|
|
7410
7497
|
await completion;
|
|
7411
7498
|
continue;
|
|
7412
7499
|
}
|
|
7413
|
-
|
|
7500
|
+
const imported = document.importNode(node, true);
|
|
7501
|
+
reconcileCspAttributes(imported, context);
|
|
7502
|
+
container.appendChild(imported);
|
|
7414
7503
|
}
|
|
7415
7504
|
}
|
|
7416
7505
|
}
|
|
7417
7506
|
|
|
7507
|
+
const RAW_TEXT_ELEMENTS = new Set(['iframe', 'noembed', 'noframes', 'plaintext', 'script', 'textarea', 'title', 'xmp']);
|
|
7508
|
+
function escapeAttribute(value) {
|
|
7509
|
+
return value.replace(/&/g, '&').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>');
|
|
7510
|
+
}
|
|
7511
|
+
function findTagEnd(html, start) {
|
|
7512
|
+
let quote = '';
|
|
7513
|
+
for (let index = start; index < html.length; index += 1) {
|
|
7514
|
+
const character = html[index];
|
|
7515
|
+
if (quote) {
|
|
7516
|
+
if (character === quote)
|
|
7517
|
+
quote = '';
|
|
7518
|
+
continue;
|
|
7519
|
+
}
|
|
7520
|
+
if (character === '"' || character === "'") {
|
|
7521
|
+
quote = character;
|
|
7522
|
+
continue;
|
|
7523
|
+
}
|
|
7524
|
+
if (character === '>')
|
|
7525
|
+
return index + 1;
|
|
7526
|
+
}
|
|
7527
|
+
return html.length;
|
|
7528
|
+
}
|
|
7529
|
+
function findClosingTag(html, lowerHtml, name, start) {
|
|
7530
|
+
const needle = `</${name}`;
|
|
7531
|
+
let position = lowerHtml.indexOf(needle, start);
|
|
7532
|
+
while (position !== -1) {
|
|
7533
|
+
const boundary = lowerHtml[position + needle.length];
|
|
7534
|
+
if (boundary === '>' || /\s/.test(boundary || '')) {
|
|
7535
|
+
return {
|
|
7536
|
+
start: position,
|
|
7537
|
+
end: findTagEnd(html, position + needle.length)
|
|
7538
|
+
};
|
|
7539
|
+
}
|
|
7540
|
+
position = lowerHtml.indexOf(needle, position + needle.length);
|
|
7541
|
+
}
|
|
7542
|
+
return null;
|
|
7543
|
+
}
|
|
7544
|
+
function removeNonceAttribute(openingTag) {
|
|
7545
|
+
const prefix = /^<\s*style\b/i.exec(openingTag);
|
|
7546
|
+
if (!prefix)
|
|
7547
|
+
return openingTag;
|
|
7548
|
+
let output = prefix[0];
|
|
7549
|
+
let cursor = prefix[0].length;
|
|
7550
|
+
const limit = openingTag.length - 1;
|
|
7551
|
+
while (cursor < limit) {
|
|
7552
|
+
const attributeStart = cursor;
|
|
7553
|
+
while (cursor < limit && /\s/.test(openingTag[cursor]))
|
|
7554
|
+
cursor += 1;
|
|
7555
|
+
if (cursor >= limit || openingTag[cursor] === '>') {
|
|
7556
|
+
output += openingTag.slice(attributeStart, cursor);
|
|
7557
|
+
break;
|
|
7558
|
+
}
|
|
7559
|
+
const nameStart = cursor;
|
|
7560
|
+
while (cursor < limit && !/[\s=/>]/.test(openingTag[cursor]))
|
|
7561
|
+
cursor += 1;
|
|
7562
|
+
if (cursor === nameStart) {
|
|
7563
|
+
output += openingTag.slice(attributeStart, cursor + 1);
|
|
7564
|
+
cursor += 1;
|
|
7565
|
+
continue;
|
|
7566
|
+
}
|
|
7567
|
+
const name = openingTag.slice(nameStart, cursor).toLowerCase();
|
|
7568
|
+
while (cursor < limit && /\s/.test(openingTag[cursor]))
|
|
7569
|
+
cursor += 1;
|
|
7570
|
+
if (openingTag[cursor] === '=') {
|
|
7571
|
+
cursor += 1;
|
|
7572
|
+
while (cursor < limit && /\s/.test(openingTag[cursor]))
|
|
7573
|
+
cursor += 1;
|
|
7574
|
+
const quote = openingTag[cursor] === '"' || openingTag[cursor] === "'" ? openingTag[cursor] : '';
|
|
7575
|
+
if (quote) {
|
|
7576
|
+
cursor += 1;
|
|
7577
|
+
while (cursor < limit && openingTag[cursor] !== quote)
|
|
7578
|
+
cursor += 1;
|
|
7579
|
+
if (openingTag[cursor] === quote)
|
|
7580
|
+
cursor += 1;
|
|
7581
|
+
}
|
|
7582
|
+
else {
|
|
7583
|
+
while (cursor < limit && !/[\s>]/.test(openingTag[cursor]))
|
|
7584
|
+
cursor += 1;
|
|
7585
|
+
}
|
|
7586
|
+
}
|
|
7587
|
+
if (name !== 'nonce')
|
|
7588
|
+
output += openingTag.slice(attributeStart, cursor);
|
|
7589
|
+
}
|
|
7590
|
+
return output + openingTag.slice(limit);
|
|
7591
|
+
}
|
|
7592
|
+
function withNonce(openingTag, nonce) {
|
|
7593
|
+
const withoutNonce = removeNonceAttribute(openingTag);
|
|
7594
|
+
return `${withoutNonce.slice(0, -1)} nonce="${escapeAttribute(nonce)}">`;
|
|
7595
|
+
}
|
|
7596
|
+
function prepareNavigationHtml(html) {
|
|
7597
|
+
if (expressionRuntimeMode() !== 'csp')
|
|
7598
|
+
return html;
|
|
7599
|
+
const activeNonce = resolveCspNonce();
|
|
7600
|
+
const lowerHtml = html.toLowerCase();
|
|
7601
|
+
let output = '';
|
|
7602
|
+
let cursor = 0;
|
|
7603
|
+
let skippedStyles = 0;
|
|
7604
|
+
while (cursor < html.length) {
|
|
7605
|
+
const tagStart = html.indexOf('<', cursor);
|
|
7606
|
+
if (tagStart === -1) {
|
|
7607
|
+
output += html.slice(cursor);
|
|
7608
|
+
break;
|
|
7609
|
+
}
|
|
7610
|
+
output += html.slice(cursor, tagStart);
|
|
7611
|
+
if (html.startsWith('<!--', tagStart)) {
|
|
7612
|
+
const commentEnd = html.indexOf('-->', tagStart + 4);
|
|
7613
|
+
const end = commentEnd === -1 ? html.length : commentEnd + 3;
|
|
7614
|
+
output += html.slice(tagStart, end);
|
|
7615
|
+
cursor = end;
|
|
7616
|
+
continue;
|
|
7617
|
+
}
|
|
7618
|
+
const tagEnd = findTagEnd(html, tagStart + 1);
|
|
7619
|
+
const openingTag = html.slice(tagStart, tagEnd);
|
|
7620
|
+
const match = /^<\s*(\/?)\s*([a-z][\w:-]*)/i.exec(openingTag);
|
|
7621
|
+
if (!match || match[1]) {
|
|
7622
|
+
output += openingTag;
|
|
7623
|
+
cursor = tagEnd;
|
|
7624
|
+
continue;
|
|
7625
|
+
}
|
|
7626
|
+
const name = match[2].toLowerCase();
|
|
7627
|
+
if (name === 'plaintext') {
|
|
7628
|
+
output += html.slice(tagStart);
|
|
7629
|
+
break;
|
|
7630
|
+
}
|
|
7631
|
+
if (name === 'style' || name === 'noscript' || RAW_TEXT_ELEMENTS.has(name)) {
|
|
7632
|
+
const closingTag = findClosingTag(html, lowerHtml, name, tagEnd);
|
|
7633
|
+
const blockEnd = closingTag?.end ?? html.length;
|
|
7634
|
+
if (name === 'noscript') {
|
|
7635
|
+
cursor = blockEnd;
|
|
7636
|
+
continue;
|
|
7637
|
+
}
|
|
7638
|
+
if (name === 'style') {
|
|
7639
|
+
if (!activeNonce) {
|
|
7640
|
+
skippedStyles += 1;
|
|
7641
|
+
cursor = blockEnd;
|
|
7642
|
+
continue;
|
|
7643
|
+
}
|
|
7644
|
+
output += withNonce(openingTag, activeNonce);
|
|
7645
|
+
output += html.slice(tagEnd, blockEnd);
|
|
7646
|
+
cursor = blockEnd;
|
|
7647
|
+
continue;
|
|
7648
|
+
}
|
|
7649
|
+
output += html.slice(tagStart, blockEnd);
|
|
7650
|
+
cursor = blockEnd;
|
|
7651
|
+
continue;
|
|
7652
|
+
}
|
|
7653
|
+
output += openingTag;
|
|
7654
|
+
cursor = tagEnd;
|
|
7655
|
+
}
|
|
7656
|
+
if (skippedStyles > 0) {
|
|
7657
|
+
console.warn(`[GyosJS CSP] Skipped ${skippedStyles} inline MPA style${skippedStyles === 1 ? '' : 's'} because no active document nonce is configured.`);
|
|
7658
|
+
}
|
|
7659
|
+
return output;
|
|
7660
|
+
}
|
|
7661
|
+
|
|
7418
7662
|
/**
|
|
7419
7663
|
* GyosJs Router v0
|
|
7420
7664
|
* MPA boost navigation inspired by Turbo Drive.
|
|
@@ -7478,7 +7722,10 @@
|
|
|
7478
7722
|
root.querySelectorAll('noscript').forEach(element => element.remove());
|
|
7479
7723
|
}
|
|
7480
7724
|
function parseNavigationDocument(html) {
|
|
7481
|
-
|
|
7725
|
+
// Chromium applies the active page CSP while DOMParser creates response
|
|
7726
|
+
// styles. Reconcile their nonce before parsing to avoid transient violations;
|
|
7727
|
+
// diffNodes repeats the check before insertion into the live document.
|
|
7728
|
+
const doc = new DOMParser().parseFromString(prepareNavigationHtml(html), 'text/html');
|
|
7482
7729
|
// DOMParser disables scripting and parses noscript children as active markup.
|
|
7483
7730
|
// A boosted page runs with scripting enabled, so those fallbacks must stay inert.
|
|
7484
7731
|
stripInertFallbackContent(doc);
|
|
@@ -8314,20 +8561,20 @@
|
|
|
8314
8561
|
portalCreate,
|
|
8315
8562
|
portalDestroy,
|
|
8316
8563
|
setCspNonce,
|
|
8317
|
-
version: '0.3.
|
|
8564
|
+
version: '0.3.2'
|
|
8318
8565
|
};
|
|
8319
8566
|
|
|
8320
8567
|
// This file was generated. Do not modify manually!
|
|
8321
|
-
var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 7, 9, 32, 4, 318, 1,
|
|
8568
|
+
var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 7, 9, 32, 4, 318, 1, 80, 3, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 68, 8, 2, 0, 3, 0, 2, 3, 2, 4, 2, 0, 15, 1, 83, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 7, 19, 58, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 343, 9, 54, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 10, 5350, 0, 7, 14, 11465, 27, 2343, 9, 87, 9, 39, 4, 60, 6, 26, 9, 535, 9, 470, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4178, 9, 519, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 245, 1, 2, 9, 726, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
|
|
8322
8569
|
|
|
8323
8570
|
// This file was generated. Do not modify manually!
|
|
8324
|
-
var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 4, 51, 13, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25,
|
|
8571
|
+
var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 4, 51, 13, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 39, 27, 10, 22, 251, 41, 7, 1, 17, 2, 60, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 31, 9, 2, 0, 3, 0, 2, 37, 2, 0, 26, 0, 2, 0, 45, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 200, 32, 32, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 26, 3994, 6, 582, 6842, 29, 1763, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 433, 44, 212, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 42, 9, 8936, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 229, 29, 3, 0, 496, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4153, 7, 221, 3, 5761, 15, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 4191];
|
|
8325
8572
|
|
|
8326
8573
|
// This file was generated. Do not modify manually!
|
|
8327
|
-
var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0897-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0cf3\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ece\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\
|
|
8574
|
+
var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0897-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0cf3\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ece\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1ace\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u200c\u200d\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\u30fb\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f\uff65";
|
|
8328
8575
|
|
|
8329
8576
|
// This file was generated. Do not modify manually!
|
|
8330
|
-
var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\
|
|
8577
|
+
var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088e\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c8a\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\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\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7cd\ua7d0\ua7d1\ua7d3\ua7d5-\ua7dc\ua7f2-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
|
|
8331
8578
|
|
|
8332
8579
|
// These are a run-length and offset encoded representation of the
|
|
8333
8580
|
// >0xffff code points that are a valid part of identifiers. The
|
|
@@ -8652,12 +8899,9 @@
|
|
|
8652
8899
|
// for new syntax features.
|
|
8653
8900
|
ecmaVersion: null,
|
|
8654
8901
|
// `sourceType` indicates the mode the code should be parsed in.
|
|
8655
|
-
// Can be either `"script"
|
|
8902
|
+
// Can be either `"script"` or `"module"`. This influences global
|
|
8656
8903
|
// strict mode and parsing of `import` and `export` declarations.
|
|
8657
8904
|
sourceType: "script",
|
|
8658
|
-
// When set to true, enable strict parsing mode even if `sourceType`
|
|
8659
|
-
// is `"script"`.
|
|
8660
|
-
strict: false,
|
|
8661
8905
|
// `onInsertedSemicolon` can be a callback that will be called when
|
|
8662
8906
|
// a semicolon is automatically inserted. It will be passed the
|
|
8663
8907
|
// position of the inserted semicolon as an offset, and if
|
|
@@ -8699,11 +8943,6 @@
|
|
|
8699
8943
|
// line being 1-based and column 0-based) will be attached to the
|
|
8700
8944
|
// nodes.
|
|
8701
8945
|
locations: false,
|
|
8702
|
-
// Pass an optional `{line, column}` object to use for the start of
|
|
8703
|
-
// the parse. This is mostly useful when using `parseExpressionAt`
|
|
8704
|
-
// with `locations: true`, to prevent the parser from having to
|
|
8705
|
-
// determine the line position at the start position.
|
|
8706
|
-
startLocation: null,
|
|
8707
8946
|
// A function can be passed as `onToken` option, which will
|
|
8708
8947
|
// cause Acorn to call that function with object in the same
|
|
8709
8948
|
// format as tokens returned from `tokenizer().getToken()`. Note
|
|
@@ -8784,9 +9023,6 @@
|
|
|
8784
9023
|
if (isArray(options.onComment))
|
|
8785
9024
|
{ options.onComment = pushComment(options, options.onComment); }
|
|
8786
9025
|
|
|
8787
|
-
if (options.sourceType === "commonjs" && options.allowAwaitOutsideFunction)
|
|
8788
|
-
{ throw new Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs") }
|
|
8789
|
-
|
|
8790
9026
|
return options
|
|
8791
9027
|
}
|
|
8792
9028
|
|
|
@@ -8818,7 +9054,6 @@
|
|
|
8818
9054
|
SCOPE_DIRECT_SUPER = 128,
|
|
8819
9055
|
SCOPE_CLASS_STATIC_BLOCK = 256,
|
|
8820
9056
|
SCOPE_CLASS_FIELD_INIT = 512,
|
|
8821
|
-
SCOPE_SWITCH = 1024,
|
|
8822
9057
|
SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK;
|
|
8823
9058
|
|
|
8824
9059
|
function functionFlags(async, generator) {
|
|
@@ -8857,17 +9092,13 @@
|
|
|
8857
9092
|
// Set up token state
|
|
8858
9093
|
|
|
8859
9094
|
// The current position of the tokenizer in the input.
|
|
8860
|
-
|
|
8861
|
-
|
|
8862
|
-
if (options.startLocation) {
|
|
8863
|
-
this.lineStart = this.pos - options.startLocation.column;
|
|
8864
|
-
this.curLine = options.startLocation.line;
|
|
8865
|
-
} else if (startPos) {
|
|
9095
|
+
if (startPos) {
|
|
9096
|
+
this.pos = startPos;
|
|
8866
9097
|
this.lineStart = this.input.lastIndexOf("\n", startPos - 1) + 1;
|
|
8867
|
-
|
|
8868
|
-
{ this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length; }
|
|
9098
|
+
this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length;
|
|
8869
9099
|
} else {
|
|
8870
|
-
this.lineStart = 0;
|
|
9100
|
+
this.pos = this.lineStart = 0;
|
|
9101
|
+
this.curLine = 1;
|
|
8871
9102
|
}
|
|
8872
9103
|
|
|
8873
9104
|
// Properties of the current token:
|
|
@@ -8893,7 +9124,7 @@
|
|
|
8893
9124
|
|
|
8894
9125
|
// Figure out if it's a module code.
|
|
8895
9126
|
this.inModule = options.sourceType === "module";
|
|
8896
|
-
this.strict = this.inModule ||
|
|
9127
|
+
this.strict = this.inModule || this.strictDirective(this.pos);
|
|
8897
9128
|
|
|
8898
9129
|
// Used to signify the start of a potential arrow function
|
|
8899
9130
|
this.potentialArrowAt = -1;
|
|
@@ -8912,12 +9143,7 @@
|
|
|
8912
9143
|
|
|
8913
9144
|
// Scope tracking for duplicate variable names (see scope.js)
|
|
8914
9145
|
this.scopeStack = [];
|
|
8915
|
-
this.enterScope(
|
|
8916
|
-
this.options.sourceType === "commonjs"
|
|
8917
|
-
// In commonjs, the top-level scope behaves like a function scope
|
|
8918
|
-
? SCOPE_FUNCTION
|
|
8919
|
-
: SCOPE_TOP
|
|
8920
|
-
);
|
|
9146
|
+
this.enterScope(SCOPE_TOP);
|
|
8921
9147
|
|
|
8922
9148
|
// For RegExp validation
|
|
8923
9149
|
this.regexpState = null;
|
|
@@ -8928,14 +9154,12 @@
|
|
|
8928
9154
|
this.privateNameStack = [];
|
|
8929
9155
|
};
|
|
8930
9156
|
|
|
8931
|
-
var prototypeAccessors = { inFunction: { configurable: true },inGenerator: { configurable: true },inAsync: { configurable: true },canAwait: { configurable: true },
|
|
9157
|
+
var prototypeAccessors = { inFunction: { configurable: true },inGenerator: { configurable: true },inAsync: { configurable: true },canAwait: { configurable: true },allowSuper: { configurable: true },allowDirectSuper: { configurable: true },treatFunctionsAsVar: { configurable: true },allowNewDotTarget: { configurable: true },inClassStaticBlock: { configurable: true } };
|
|
8932
9158
|
|
|
8933
9159
|
Parser.prototype.parse = function parse () {
|
|
8934
|
-
var this$1$1 = this;
|
|
8935
|
-
|
|
8936
9160
|
var node = this.options.program || this.startNode();
|
|
8937
9161
|
this.nextToken();
|
|
8938
|
-
return this.
|
|
9162
|
+
return this.parseTopLevel(node)
|
|
8939
9163
|
};
|
|
8940
9164
|
|
|
8941
9165
|
prototypeAccessors.inFunction.get = function () { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0 };
|
|
@@ -8954,12 +9178,6 @@
|
|
|
8954
9178
|
return (this.inModule && this.options.ecmaVersion >= 13) || this.options.allowAwaitOutsideFunction
|
|
8955
9179
|
};
|
|
8956
9180
|
|
|
8957
|
-
prototypeAccessors.allowReturn.get = function () {
|
|
8958
|
-
if (this.inFunction) { return true }
|
|
8959
|
-
if (this.options.allowReturnOutsideFunction && this.currentVarScope().flags & SCOPE_TOP) { return true }
|
|
8960
|
-
return false
|
|
8961
|
-
};
|
|
8962
|
-
|
|
8963
9181
|
prototypeAccessors.allowSuper.get = function () {
|
|
8964
9182
|
var ref = this.currentThisScope();
|
|
8965
9183
|
var flags = ref.flags;
|
|
@@ -8980,14 +9198,6 @@
|
|
|
8980
9198
|
return false
|
|
8981
9199
|
};
|
|
8982
9200
|
|
|
8983
|
-
prototypeAccessors.allowUsing.get = function () {
|
|
8984
|
-
var ref = this.currentScope();
|
|
8985
|
-
var flags = ref.flags;
|
|
8986
|
-
if (flags & SCOPE_SWITCH) { return false }
|
|
8987
|
-
if (!this.inModule && flags & SCOPE_TOP) { return false }
|
|
8988
|
-
return true
|
|
8989
|
-
};
|
|
8990
|
-
|
|
8991
9201
|
prototypeAccessors.inClassStaticBlock.get = function () {
|
|
8992
9202
|
return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0
|
|
8993
9203
|
};
|
|
@@ -9074,17 +9284,6 @@
|
|
|
9074
9284
|
return true
|
|
9075
9285
|
};
|
|
9076
9286
|
|
|
9077
|
-
pp$9.catchStackOverflow = function(f) {
|
|
9078
|
-
try {
|
|
9079
|
-
return f()
|
|
9080
|
-
} catch (e) {
|
|
9081
|
-
if (e instanceof Error && (/\bstack\b.*\b(exceeded|overflow)\b/i.test(e.message) || /\btoo much recursion\b/i.test(e.message)))
|
|
9082
|
-
{ this.raise(this.start, "Not enough stack space to parse input"); }
|
|
9083
|
-
else
|
|
9084
|
-
{ throw e }
|
|
9085
|
-
}
|
|
9086
|
-
};
|
|
9087
|
-
|
|
9088
9287
|
// Asserts that following token is given contextual keyword.
|
|
9089
9288
|
|
|
9090
9289
|
pp$9.expectContextual = function(name) {
|
|
@@ -9188,10 +9387,10 @@
|
|
|
9188
9387
|
// to its body instead of creating a new node.
|
|
9189
9388
|
|
|
9190
9389
|
pp$8.parseTopLevel = function(node) {
|
|
9191
|
-
var exports
|
|
9390
|
+
var exports = Object.create(null);
|
|
9192
9391
|
if (!node.body) { node.body = []; }
|
|
9193
9392
|
while (this.type !== types$1.eof) {
|
|
9194
|
-
var stmt = this.parseStatement(null, true, exports
|
|
9393
|
+
var stmt = this.parseStatement(null, true, exports);
|
|
9195
9394
|
node.body.push(stmt);
|
|
9196
9395
|
}
|
|
9197
9396
|
if (this.inModule)
|
|
@@ -9203,7 +9402,7 @@
|
|
|
9203
9402
|
} }
|
|
9204
9403
|
this.adaptDirectivePrologue(node.body);
|
|
9205
9404
|
this.next();
|
|
9206
|
-
node.sourceType = this.options.sourceType
|
|
9405
|
+
node.sourceType = this.options.sourceType;
|
|
9207
9406
|
return this.finishNode(node, "Program")
|
|
9208
9407
|
};
|
|
9209
9408
|
|
|
@@ -9213,7 +9412,7 @@
|
|
|
9213
9412
|
if (this.options.ecmaVersion < 6 || !this.isContextual("let")) { return false }
|
|
9214
9413
|
skipWhiteSpace.lastIndex = this.pos;
|
|
9215
9414
|
var skip = skipWhiteSpace.exec(this.input);
|
|
9216
|
-
var next = this.pos + skip[0].length, nextCh = this.
|
|
9415
|
+
var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
|
|
9217
9416
|
// For ambiguous cases, determine if a LexicalDeclaration (or only a
|
|
9218
9417
|
// Statement) is allowed here. If context is not empty then only a Statement
|
|
9219
9418
|
// is allowed. However, `let [` is an explicit negative lookahead for
|
|
@@ -9221,13 +9420,12 @@
|
|
|
9221
9420
|
if (nextCh === 91 || nextCh === 92) { return true } // '[', '\'
|
|
9222
9421
|
if (context) { return false }
|
|
9223
9422
|
|
|
9224
|
-
if (nextCh === 123) { return true } // '{'
|
|
9225
|
-
if (isIdentifierStart(nextCh)) {
|
|
9226
|
-
var
|
|
9227
|
-
|
|
9228
|
-
|
|
9229
|
-
|
|
9230
|
-
var ident = this.input.slice(start, next);
|
|
9423
|
+
if (nextCh === 123 || nextCh > 0xd7ff && nextCh < 0xdc00) { return true } // '{', astral
|
|
9424
|
+
if (isIdentifierStart(nextCh, true)) {
|
|
9425
|
+
var pos = next + 1;
|
|
9426
|
+
while (isIdentifierChar(nextCh = this.input.charCodeAt(pos), true)) { ++pos; }
|
|
9427
|
+
if (nextCh === 92 || nextCh > 0xd7ff && nextCh < 0xdc00) { return true }
|
|
9428
|
+
var ident = this.input.slice(next, pos);
|
|
9231
9429
|
if (!keywordRelationalOperator.test(ident)) { return true }
|
|
9232
9430
|
}
|
|
9233
9431
|
return false
|
|
@@ -9246,7 +9444,7 @@
|
|
|
9246
9444
|
return !lineBreak.test(this.input.slice(this.pos, next)) &&
|
|
9247
9445
|
this.input.slice(next, next + 8) === "function" &&
|
|
9248
9446
|
(next + 8 === this.input.length ||
|
|
9249
|
-
!(isIdentifierChar(after = this.
|
|
9447
|
+
!(isIdentifierChar(after = this.input.charCodeAt(next + 8)) || after > 0xd7ff && after < 0xdc00))
|
|
9250
9448
|
};
|
|
9251
9449
|
|
|
9252
9450
|
pp$8.isUsingKeyword = function(isAwaitUsing, isFor) {
|
|
@@ -9260,39 +9458,28 @@
|
|
|
9260
9458
|
if (lineBreak.test(this.input.slice(this.pos, next))) { return false }
|
|
9261
9459
|
|
|
9262
9460
|
if (isAwaitUsing) {
|
|
9263
|
-
var
|
|
9264
|
-
if (this.input.slice(next,
|
|
9265
|
-
|
|
9266
|
-
isIdentifierChar(after = this.
|
|
9267
|
-
after
|
|
9461
|
+
var awaitEndPos = next + 5 /* await */, after;
|
|
9462
|
+
if (this.input.slice(next, awaitEndPos) !== "using" ||
|
|
9463
|
+
awaitEndPos === this.input.length ||
|
|
9464
|
+
isIdentifierChar(after = this.input.charCodeAt(awaitEndPos)) ||
|
|
9465
|
+
(after > 0xd7ff && after < 0xdc00)
|
|
9268
9466
|
) { return false }
|
|
9269
9467
|
|
|
9270
|
-
skipWhiteSpace.lastIndex =
|
|
9468
|
+
skipWhiteSpace.lastIndex = awaitEndPos;
|
|
9271
9469
|
var skipAfterUsing = skipWhiteSpace.exec(this.input);
|
|
9272
|
-
|
|
9273
|
-
|
|
9274
|
-
|
|
9275
|
-
|
|
9276
|
-
|
|
9277
|
-
|
|
9278
|
-
|
|
9279
|
-
|
|
9280
|
-
while (isIdentifierChar(ch = this.fullCharCodeAt(next)))
|
|
9281
|
-
if (ch === 92) { return true }
|
|
9282
|
-
var id = this.input.slice(idStart, next);
|
|
9283
|
-
if (keywordRelationalOperator.test(id)) { return false }
|
|
9284
|
-
if (isFor && !isAwaitUsing && id === "of") {
|
|
9285
|
-
// Look ahead for using declaration with initializer, i.e., `for (using of = ...)`
|
|
9286
|
-
skipWhiteSpace.lastIndex = next;
|
|
9287
|
-
var skipAfterOf = skipWhiteSpace.exec(this.input);
|
|
9288
|
-
next = next + skipAfterOf[0].length;
|
|
9289
|
-
if (this.input.charCodeAt(next) !== 61 /* '=' */ ||
|
|
9290
|
-
// Check for ==, === and => operators
|
|
9291
|
-
(ch = this.input.charCodeAt(next + 1)) === 61 /* '=' */ || ch === 62 /* '>' */) {
|
|
9292
|
-
return false
|
|
9470
|
+
if (skipAfterUsing && lineBreak.test(this.input.slice(awaitEndPos, awaitEndPos + skipAfterUsing[0].length))) { return false }
|
|
9471
|
+
}
|
|
9472
|
+
|
|
9473
|
+
if (isFor) {
|
|
9474
|
+
var ofEndPos = next + 2 /* of */, after$1;
|
|
9475
|
+
if (this.input.slice(next, ofEndPos) === "of") {
|
|
9476
|
+
if (ofEndPos === this.input.length ||
|
|
9477
|
+
(!isIdentifierChar(after$1 = this.input.charCodeAt(ofEndPos)) && !(after$1 > 0xd7ff && after$1 < 0xdc00))) { return false }
|
|
9293
9478
|
}
|
|
9294
9479
|
}
|
|
9295
|
-
|
|
9480
|
+
|
|
9481
|
+
var ch = this.input.charCodeAt(next);
|
|
9482
|
+
return isIdentifierStart(ch, true) || ch === 92 // '\'
|
|
9296
9483
|
};
|
|
9297
9484
|
|
|
9298
9485
|
pp$8.isAwaitUsing = function(isFor) {
|
|
@@ -9310,7 +9497,7 @@
|
|
|
9310
9497
|
// `if (foo) /blah/.exec(foo)`, where looking at the previous token
|
|
9311
9498
|
// does not help.
|
|
9312
9499
|
|
|
9313
|
-
pp$8.parseStatement = function(context, topLevel, exports
|
|
9500
|
+
pp$8.parseStatement = function(context, topLevel, exports) {
|
|
9314
9501
|
var starttype = this.type, node = this.startNode(), kind;
|
|
9315
9502
|
|
|
9316
9503
|
if (this.isLet(context)) {
|
|
@@ -9365,7 +9552,7 @@
|
|
|
9365
9552
|
if (!this.inModule)
|
|
9366
9553
|
{ this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'"); }
|
|
9367
9554
|
}
|
|
9368
|
-
return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports
|
|
9555
|
+
return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports)
|
|
9369
9556
|
|
|
9370
9557
|
// If the statement does not start with a statement keyword or a
|
|
9371
9558
|
// brace, it's an ExpressionStatement or LabeledStatement. We
|
|
@@ -9381,12 +9568,8 @@
|
|
|
9381
9568
|
|
|
9382
9569
|
var usingKind = this.isAwaitUsing(false) ? "await using" : this.isUsing(false) ? "using" : null;
|
|
9383
9570
|
if (usingKind) {
|
|
9384
|
-
if (
|
|
9385
|
-
this.raise(this.start, "Using declaration cannot appear in the top level when source type is `script`
|
|
9386
|
-
}
|
|
9387
|
-
if (context) {
|
|
9388
|
-
// Cases like `for (;;) using x = ...;`, `if (true) await using x = ...;`, etc. are not allowed.
|
|
9389
|
-
this.raise(this.start, "Using declaration is not allowed in single-statement positions");
|
|
9571
|
+
if (topLevel && this.options.sourceType === "script") {
|
|
9572
|
+
this.raise(this.start, "Using declaration cannot appear in the top level when source type is `script`");
|
|
9390
9573
|
}
|
|
9391
9574
|
if (usingKind === "await using") {
|
|
9392
9575
|
if (!this.canAwait) {
|
|
@@ -9483,12 +9666,7 @@
|
|
|
9483
9666
|
if (usingKind) {
|
|
9484
9667
|
var init$2 = this.startNode();
|
|
9485
9668
|
this.next();
|
|
9486
|
-
if (usingKind === "await using") {
|
|
9487
|
-
if (!this.canAwait) {
|
|
9488
|
-
this.raise(this.start, "Await using cannot appear outside of async function");
|
|
9489
|
-
}
|
|
9490
|
-
this.next();
|
|
9491
|
-
}
|
|
9669
|
+
if (usingKind === "await using") { this.next(); }
|
|
9492
9670
|
this.parseVar(init$2, true, usingKind);
|
|
9493
9671
|
this.finishNode(init$2, "VariableDeclaration");
|
|
9494
9672
|
return this.parseForAfterInit(node, init$2, awaitAt)
|
|
@@ -9521,12 +9699,11 @@
|
|
|
9521
9699
|
// Helper method to parse for loop after variable initialization
|
|
9522
9700
|
pp$8.parseForAfterInit = function(node, init, awaitAt) {
|
|
9523
9701
|
if ((this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init.declarations.length === 1) {
|
|
9524
|
-
if (this.
|
|
9525
|
-
if (
|
|
9526
|
-
|
|
9527
|
-
}
|
|
9528
|
-
|
|
9529
|
-
} else if (this.options.ecmaVersion >= 9) { node.await = awaitAt > -1; }
|
|
9702
|
+
if (this.options.ecmaVersion >= 9) {
|
|
9703
|
+
if (this.type === types$1._in) {
|
|
9704
|
+
if (awaitAt > -1) { this.unexpected(awaitAt); }
|
|
9705
|
+
} else { node.await = awaitAt > -1; }
|
|
9706
|
+
}
|
|
9530
9707
|
return this.parseForIn(node, init)
|
|
9531
9708
|
}
|
|
9532
9709
|
if (awaitAt > -1) { this.unexpected(awaitAt); }
|
|
@@ -9548,7 +9725,7 @@
|
|
|
9548
9725
|
};
|
|
9549
9726
|
|
|
9550
9727
|
pp$8.parseReturnStatement = function(node) {
|
|
9551
|
-
if (!this.
|
|
9728
|
+
if (!this.inFunction && !this.options.allowReturnOutsideFunction)
|
|
9552
9729
|
{ this.raise(this.start, "'return' outside of function"); }
|
|
9553
9730
|
this.next();
|
|
9554
9731
|
|
|
@@ -9567,7 +9744,7 @@
|
|
|
9567
9744
|
node.cases = [];
|
|
9568
9745
|
this.expect(types$1.braceL);
|
|
9569
9746
|
this.labels.push(switchLabel);
|
|
9570
|
-
this.enterScope(
|
|
9747
|
+
this.enterScope(0);
|
|
9571
9748
|
|
|
9572
9749
|
// Statements under must be grouped (by label) in SwitchCase
|
|
9573
9750
|
// nodes. `cur` is used to keep the node that we are currently
|
|
@@ -10131,11 +10308,11 @@
|
|
|
10131
10308
|
|
|
10132
10309
|
// Parses module export declaration.
|
|
10133
10310
|
|
|
10134
|
-
pp$8.parseExportAllDeclaration = function(node, exports
|
|
10311
|
+
pp$8.parseExportAllDeclaration = function(node, exports) {
|
|
10135
10312
|
if (this.options.ecmaVersion >= 11) {
|
|
10136
10313
|
if (this.eatContextual("as")) {
|
|
10137
10314
|
node.exported = this.parseModuleExportName();
|
|
10138
|
-
this.checkExport(exports
|
|
10315
|
+
this.checkExport(exports, node.exported, this.lastTokStart);
|
|
10139
10316
|
} else {
|
|
10140
10317
|
node.exported = null;
|
|
10141
10318
|
}
|
|
@@ -10149,14 +10326,14 @@
|
|
|
10149
10326
|
return this.finishNode(node, "ExportAllDeclaration")
|
|
10150
10327
|
};
|
|
10151
10328
|
|
|
10152
|
-
pp$8.parseExport = function(node, exports
|
|
10329
|
+
pp$8.parseExport = function(node, exports) {
|
|
10153
10330
|
this.next();
|
|
10154
10331
|
// export * from '...'
|
|
10155
10332
|
if (this.eat(types$1.star)) {
|
|
10156
|
-
return this.parseExportAllDeclaration(node, exports
|
|
10333
|
+
return this.parseExportAllDeclaration(node, exports)
|
|
10157
10334
|
}
|
|
10158
10335
|
if (this.eat(types$1._default)) { // export default ...
|
|
10159
|
-
this.checkExport(exports
|
|
10336
|
+
this.checkExport(exports, "default", this.lastTokStart);
|
|
10160
10337
|
node.declaration = this.parseExportDefaultDeclaration();
|
|
10161
10338
|
return this.finishNode(node, "ExportDefaultDeclaration")
|
|
10162
10339
|
}
|
|
@@ -10164,16 +10341,16 @@
|
|
|
10164
10341
|
if (this.shouldParseExportStatement()) {
|
|
10165
10342
|
node.declaration = this.parseExportDeclaration(node);
|
|
10166
10343
|
if (node.declaration.type === "VariableDeclaration")
|
|
10167
|
-
{ this.checkVariableExport(exports
|
|
10344
|
+
{ this.checkVariableExport(exports, node.declaration.declarations); }
|
|
10168
10345
|
else
|
|
10169
|
-
{ this.checkExport(exports
|
|
10346
|
+
{ this.checkExport(exports, node.declaration.id, node.declaration.id.start); }
|
|
10170
10347
|
node.specifiers = [];
|
|
10171
10348
|
node.source = null;
|
|
10172
10349
|
if (this.options.ecmaVersion >= 16)
|
|
10173
10350
|
{ node.attributes = []; }
|
|
10174
10351
|
} else { // export { x, y as z } [from '...']
|
|
10175
10352
|
node.declaration = null;
|
|
10176
|
-
node.specifiers = this.parseExportSpecifiers(exports
|
|
10353
|
+
node.specifiers = this.parseExportSpecifiers(exports);
|
|
10177
10354
|
if (this.eatContextual("from")) {
|
|
10178
10355
|
if (this.type !== types$1.string) { this.unexpected(); }
|
|
10179
10356
|
node.source = this.parseExprAtom();
|
|
@@ -10223,47 +10400,47 @@
|
|
|
10223
10400
|
}
|
|
10224
10401
|
};
|
|
10225
10402
|
|
|
10226
|
-
pp$8.checkExport = function(exports
|
|
10227
|
-
if (!exports
|
|
10403
|
+
pp$8.checkExport = function(exports, name, pos) {
|
|
10404
|
+
if (!exports) { return }
|
|
10228
10405
|
if (typeof name !== "string")
|
|
10229
10406
|
{ name = name.type === "Identifier" ? name.name : name.value; }
|
|
10230
|
-
if (hasOwn(exports
|
|
10407
|
+
if (hasOwn(exports, name))
|
|
10231
10408
|
{ this.raiseRecoverable(pos, "Duplicate export '" + name + "'"); }
|
|
10232
|
-
exports
|
|
10409
|
+
exports[name] = true;
|
|
10233
10410
|
};
|
|
10234
10411
|
|
|
10235
|
-
pp$8.checkPatternExport = function(exports
|
|
10412
|
+
pp$8.checkPatternExport = function(exports, pat) {
|
|
10236
10413
|
var type = pat.type;
|
|
10237
10414
|
if (type === "Identifier")
|
|
10238
|
-
{ this.checkExport(exports
|
|
10415
|
+
{ this.checkExport(exports, pat, pat.start); }
|
|
10239
10416
|
else if (type === "ObjectPattern")
|
|
10240
10417
|
{ for (var i = 0, list = pat.properties; i < list.length; i += 1)
|
|
10241
10418
|
{
|
|
10242
10419
|
var prop = list[i];
|
|
10243
10420
|
|
|
10244
|
-
this.checkPatternExport(exports
|
|
10421
|
+
this.checkPatternExport(exports, prop);
|
|
10245
10422
|
} }
|
|
10246
10423
|
else if (type === "ArrayPattern")
|
|
10247
10424
|
{ for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) {
|
|
10248
10425
|
var elt = list$1[i$1];
|
|
10249
10426
|
|
|
10250
|
-
if (elt) { this.checkPatternExport(exports
|
|
10427
|
+
if (elt) { this.checkPatternExport(exports, elt); }
|
|
10251
10428
|
} }
|
|
10252
10429
|
else if (type === "Property")
|
|
10253
|
-
{ this.checkPatternExport(exports
|
|
10430
|
+
{ this.checkPatternExport(exports, pat.value); }
|
|
10254
10431
|
else if (type === "AssignmentPattern")
|
|
10255
|
-
{ this.checkPatternExport(exports
|
|
10432
|
+
{ this.checkPatternExport(exports, pat.left); }
|
|
10256
10433
|
else if (type === "RestElement")
|
|
10257
|
-
{ this.checkPatternExport(exports
|
|
10434
|
+
{ this.checkPatternExport(exports, pat.argument); }
|
|
10258
10435
|
};
|
|
10259
10436
|
|
|
10260
|
-
pp$8.checkVariableExport = function(exports
|
|
10261
|
-
if (!exports
|
|
10437
|
+
pp$8.checkVariableExport = function(exports, decls) {
|
|
10438
|
+
if (!exports) { return }
|
|
10262
10439
|
for (var i = 0, list = decls; i < list.length; i += 1)
|
|
10263
10440
|
{
|
|
10264
10441
|
var decl = list[i];
|
|
10265
10442
|
|
|
10266
|
-
this.checkPatternExport(exports
|
|
10443
|
+
this.checkPatternExport(exports, decl.id);
|
|
10267
10444
|
}
|
|
10268
10445
|
};
|
|
10269
10446
|
|
|
@@ -10278,13 +10455,13 @@
|
|
|
10278
10455
|
|
|
10279
10456
|
// Parses a comma-separated list of module exports.
|
|
10280
10457
|
|
|
10281
|
-
pp$8.parseExportSpecifier = function(exports
|
|
10458
|
+
pp$8.parseExportSpecifier = function(exports) {
|
|
10282
10459
|
var node = this.startNode();
|
|
10283
10460
|
node.local = this.parseModuleExportName();
|
|
10284
10461
|
|
|
10285
10462
|
node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
|
|
10286
10463
|
this.checkExport(
|
|
10287
|
-
exports
|
|
10464
|
+
exports,
|
|
10288
10465
|
node.exported,
|
|
10289
10466
|
node.exported.start
|
|
10290
10467
|
);
|
|
@@ -10292,7 +10469,7 @@
|
|
|
10292
10469
|
return this.finishNode(node, "ExportSpecifier")
|
|
10293
10470
|
};
|
|
10294
10471
|
|
|
10295
|
-
pp$8.parseExportSpecifiers = function(exports
|
|
10472
|
+
pp$8.parseExportSpecifiers = function(exports) {
|
|
10296
10473
|
var nodes = [], first = true;
|
|
10297
10474
|
// export { x, y as z } [from '...']
|
|
10298
10475
|
this.expect(types$1.braceL);
|
|
@@ -10302,7 +10479,7 @@
|
|
|
10302
10479
|
if (this.afterTrailingComma(types$1.braceR)) { break }
|
|
10303
10480
|
} else { first = false; }
|
|
10304
10481
|
|
|
10305
|
-
nodes.push(this.parseExportSpecifier(exports
|
|
10482
|
+
nodes.push(this.parseExportSpecifier(exports));
|
|
10306
10483
|
}
|
|
10307
10484
|
return nodes
|
|
10308
10485
|
};
|
|
@@ -11033,19 +11210,15 @@
|
|
|
11033
11210
|
// delayed syntax error at correct position).
|
|
11034
11211
|
|
|
11035
11212
|
pp$5.parseExpression = function(forInit, refDestructuringErrors) {
|
|
11036
|
-
var this
|
|
11037
|
-
|
|
11038
|
-
|
|
11039
|
-
var
|
|
11040
|
-
|
|
11041
|
-
|
|
11042
|
-
|
|
11043
|
-
|
|
11044
|
-
|
|
11045
|
-
return this$1$1.finishNode(node, "SequenceExpression")
|
|
11046
|
-
}
|
|
11047
|
-
return expr
|
|
11048
|
-
})
|
|
11213
|
+
var startPos = this.start, startLoc = this.startLoc;
|
|
11214
|
+
var expr = this.parseMaybeAssign(forInit, refDestructuringErrors);
|
|
11215
|
+
if (this.type === types$1.comma) {
|
|
11216
|
+
var node = this.startNodeAt(startPos, startLoc);
|
|
11217
|
+
node.expressions = [expr];
|
|
11218
|
+
while (this.eat(types$1.comma)) { node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); }
|
|
11219
|
+
return this.finishNode(node, "SequenceExpression")
|
|
11220
|
+
}
|
|
11221
|
+
return expr
|
|
11049
11222
|
};
|
|
11050
11223
|
|
|
11051
11224
|
// Parse an assignment expression. This includes applications of
|
|
@@ -11110,7 +11283,7 @@
|
|
|
11110
11283
|
var startPos = this.start, startLoc = this.startLoc;
|
|
11111
11284
|
var expr = this.parseExprOps(forInit, refDestructuringErrors);
|
|
11112
11285
|
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
|
|
11113
|
-
if (
|
|
11286
|
+
if (this.eat(types$1.question)) {
|
|
11114
11287
|
var node = this.startNodeAt(startPos, startLoc);
|
|
11115
11288
|
node.test = expr;
|
|
11116
11289
|
node.consequent = this.parseMaybeAssign();
|
|
@@ -11210,7 +11383,7 @@
|
|
|
11210
11383
|
}
|
|
11211
11384
|
}
|
|
11212
11385
|
|
|
11213
|
-
if (!incDec &&
|
|
11386
|
+
if (!incDec && this.eat(types$1.starstar)) {
|
|
11214
11387
|
if (sawUnary)
|
|
11215
11388
|
{ this.unexpected(this.lastTokStart); }
|
|
11216
11389
|
else
|
|
@@ -11662,8 +11835,6 @@
|
|
|
11662
11835
|
}
|
|
11663
11836
|
var startPos = this.start, startLoc = this.startLoc;
|
|
11664
11837
|
node.callee = this.parseSubscripts(this.parseExprAtom(null, false, true), startPos, startLoc, true, false);
|
|
11665
|
-
if (node.callee.type === "Super")
|
|
11666
|
-
{ this.raiseRecoverable(startPos, "Invalid use of 'super'"); }
|
|
11667
11838
|
if (this.eat(types$1.parenL)) { node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); }
|
|
11668
11839
|
else { node.arguments = empty; }
|
|
11669
11840
|
return this.finishNode(node, "NewExpression")
|
|
@@ -12281,7 +12452,7 @@
|
|
|
12281
12452
|
};
|
|
12282
12453
|
|
|
12283
12454
|
// This file was generated by "bin/generate-unicode-script-values.js". Do not modify manually!
|
|
12284
|
-
var scriptValuesAddedInUnicode = "
|
|
12455
|
+
var scriptValuesAddedInUnicode = "Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz";
|
|
12285
12456
|
|
|
12286
12457
|
// This file contains Unicode properties extracted from the ECMAScript specification.
|
|
12287
12458
|
// The lists are extracted like so:
|
|
@@ -13842,17 +14013,13 @@
|
|
|
13842
14013
|
return this.getTokenFromCode(code)
|
|
13843
14014
|
};
|
|
13844
14015
|
|
|
13845
|
-
pp.
|
|
13846
|
-
var code = this.input.charCodeAt(pos);
|
|
14016
|
+
pp.fullCharCodeAtPos = function() {
|
|
14017
|
+
var code = this.input.charCodeAt(this.pos);
|
|
13847
14018
|
if (code <= 0xd7ff || code >= 0xdc00) { return code }
|
|
13848
|
-
var next = this.input.charCodeAt(pos + 1);
|
|
14019
|
+
var next = this.input.charCodeAt(this.pos + 1);
|
|
13849
14020
|
return next <= 0xdbff || next >= 0xe000 ? code : (code << 10) + next - 0x35fdc00
|
|
13850
14021
|
};
|
|
13851
14022
|
|
|
13852
|
-
pp.fullCharCodeAtPos = function() {
|
|
13853
|
-
return this.fullCharCodeAt(this.pos)
|
|
13854
|
-
};
|
|
13855
|
-
|
|
13856
14023
|
pp.skipBlockComment = function() {
|
|
13857
14024
|
var startLoc = this.options.onComment && this.curPosition();
|
|
13858
14025
|
var start = this.pos, end = this.input.indexOf("*/", this.pos += 2);
|
|
@@ -14580,7 +14747,7 @@
|
|
|
14580
14747
|
// [ghbt]: https://github.com/acornjs/acorn/issues
|
|
14581
14748
|
|
|
14582
14749
|
|
|
14583
|
-
var version = "8.
|
|
14750
|
+
var version = "8.15.0";
|
|
14584
14751
|
|
|
14585
14752
|
Parser.acorn = {
|
|
14586
14753
|
Parser: Parser,
|