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
|
@@ -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
|
*/
|
|
@@ -2262,32 +2262,24 @@ function applyTransitionStyles() {
|
|
|
2262
2262
|
* Handles:
|
|
2263
2263
|
* 1. Literal string: "fade" or "slide-down"
|
|
2264
2264
|
* 2. Expression with {}: "{transition}"
|
|
2265
|
-
* 3.
|
|
2265
|
+
* 3. Quoted literal kept for backwards compatibility: "'fade'"
|
|
2266
2266
|
*
|
|
2267
2267
|
* @param attrValue - The g-transition attribute value
|
|
2268
2268
|
* @param scope - Current scope for expression evaluation
|
|
2269
2269
|
* @returns The transition name (string)
|
|
2270
2270
|
*/
|
|
2271
2271
|
function parseTransitionName(attrValue, scope) {
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
}
|
|
2278
|
-
}
|
|
2279
|
-
// Try to evaluate as expression first (variable name)
|
|
2280
|
-
// If it fails or returns undefined, use as literal string
|
|
2281
|
-
try {
|
|
2282
|
-
const evaluated = evaluateExpression(attrValue, scope);
|
|
2283
|
-
if (evaluated !== undefined && evaluated !== null) {
|
|
2284
|
-
return evaluated;
|
|
2285
|
-
}
|
|
2272
|
+
const value = attrValue.trim();
|
|
2273
|
+
const expression = /^\{([\s\S]+)\}$/.exec(value);
|
|
2274
|
+
if (expression) {
|
|
2275
|
+
const evaluated = evaluateExpression(expression[1].trim(), scope);
|
|
2276
|
+
return evaluated == null ? '' : String(evaluated);
|
|
2286
2277
|
}
|
|
2287
|
-
|
|
2288
|
-
|
|
2278
|
+
if (value.length >= 2 && ((value.startsWith("'") && value.endsWith("'"))
|
|
2279
|
+
|| (value.startsWith('"') && value.endsWith('"')))) {
|
|
2280
|
+
return value.slice(1, -1);
|
|
2289
2281
|
}
|
|
2290
|
-
return
|
|
2282
|
+
return value;
|
|
2291
2283
|
}
|
|
2292
2284
|
/**
|
|
2293
2285
|
* Parse transition config from element's g-transition attribute
|
|
@@ -5191,6 +5183,10 @@ function processStructuralDirectives(elements, scope) {
|
|
|
5191
5183
|
const structuralElements = [];
|
|
5192
5184
|
const root = elements[0];
|
|
5193
5185
|
elements.forEach(el => {
|
|
5186
|
+
// Await branches are detached and parsed only after their alias scope exists.
|
|
5187
|
+
// Do not evaluate nested structural expressions during the parent scan.
|
|
5188
|
+
if (isAwaitBranchDescendant(el))
|
|
5189
|
+
return;
|
|
5194
5190
|
const hasIf = el.hasAttribute('*if');
|
|
5195
5191
|
const hasFor = el.hasAttribute('*for');
|
|
5196
5192
|
const hasSwitch = el.hasAttribute('*switch');
|
|
@@ -5235,6 +5231,20 @@ function processStructuralDirectives(elements, scope) {
|
|
|
5235
5231
|
}
|
|
5236
5232
|
});
|
|
5237
5233
|
}
|
|
5234
|
+
function isAwaitBranchDescendant(element) {
|
|
5235
|
+
let child = element;
|
|
5236
|
+
let parent = element.parentElement;
|
|
5237
|
+
while (parent && parent !== document.body) {
|
|
5238
|
+
if (parent.hasAttribute('*await') && (child.hasAttribute('*pending') ||
|
|
5239
|
+
child.hasAttribute('*then') ||
|
|
5240
|
+
child.hasAttribute('*catch'))) {
|
|
5241
|
+
return true;
|
|
5242
|
+
}
|
|
5243
|
+
child = parent;
|
|
5244
|
+
parent = parent.parentElement;
|
|
5245
|
+
}
|
|
5246
|
+
return false;
|
|
5247
|
+
}
|
|
5238
5248
|
const elementBelongsToAnotherScope = (el, scope) => {
|
|
5239
5249
|
const owner = getScopeFromElement(el);
|
|
5240
5250
|
return Boolean(owner && owner !== scope);
|
|
@@ -6756,7 +6766,7 @@ function hideTargetSpinner(spinner) {
|
|
|
6756
6766
|
}
|
|
6757
6767
|
|
|
6758
6768
|
let nonceSource;
|
|
6759
|
-
/** Configure the nonce used
|
|
6769
|
+
/** Configure the active document nonce used for scripts and styles during MPA navigation. */
|
|
6760
6770
|
function setCspNonce(source) {
|
|
6761
6771
|
nonceSource = source;
|
|
6762
6772
|
}
|
|
@@ -7342,9 +7352,33 @@ function handleScroll(url, trigger, savedScroll) {
|
|
|
7342
7352
|
window.scrollTo({ top: 0, behavior: 'smooth' });
|
|
7343
7353
|
}
|
|
7344
7354
|
|
|
7345
|
-
function
|
|
7346
|
-
return
|
|
7347
|
-
|
|
7355
|
+
function isNonceMeta(el) {
|
|
7356
|
+
return el.tagName === 'META' && el.getAttribute('name')?.toLowerCase() === 'csp-nonce';
|
|
7357
|
+
}
|
|
7358
|
+
function isStylesheetLink(el) {
|
|
7359
|
+
return el.tagName === 'LINK'
|
|
7360
|
+
&& (el.getAttribute('rel') || '').toLowerCase().split(/\s+/).includes('stylesheet');
|
|
7361
|
+
}
|
|
7362
|
+
function usesCspNonce(el) {
|
|
7363
|
+
return el.tagName === 'SCRIPT' || el.tagName === 'STYLE' || isStylesheetLink(el);
|
|
7364
|
+
}
|
|
7365
|
+
function serializeAttributes(el, context) {
|
|
7366
|
+
const attributes = new Map();
|
|
7367
|
+
Array.from(el.attributes).forEach(attr => {
|
|
7368
|
+
if (context.csp && usesCspNonce(el) && attr.name.toLowerCase() === 'nonce')
|
|
7369
|
+
return;
|
|
7370
|
+
if (context.csp && isNonceMeta(el) && attr.name.toLowerCase() === 'content')
|
|
7371
|
+
return;
|
|
7372
|
+
attributes.set(attr.name, attr.value);
|
|
7373
|
+
});
|
|
7374
|
+
if (context.csp && usesCspNonce(el) && context.activeNonce) {
|
|
7375
|
+
attributes.set('nonce', context.activeNonce);
|
|
7376
|
+
}
|
|
7377
|
+
if (context.csp && isNonceMeta(el) && context.activeNonce) {
|
|
7378
|
+
attributes.set('content', context.activeNonce);
|
|
7379
|
+
}
|
|
7380
|
+
return Array.from(attributes)
|
|
7381
|
+
.map(([name, value]) => `${name}=${value}`)
|
|
7348
7382
|
.sort()
|
|
7349
7383
|
.join('|');
|
|
7350
7384
|
}
|
|
@@ -7355,23 +7389,61 @@ function hashContent(content) {
|
|
|
7355
7389
|
}
|
|
7356
7390
|
return String(hash);
|
|
7357
7391
|
}
|
|
7358
|
-
function elementKey(el) {
|
|
7392
|
+
function elementKey(el, context) {
|
|
7359
7393
|
const tag = el.tagName.toLowerCase();
|
|
7360
7394
|
const content = tag === 'script' || tag === 'style' ? hashContent(el.textContent || '') : '';
|
|
7361
|
-
return `${tag}|${serializeAttributes(el)}|${content}`;
|
|
7395
|
+
return `${tag}|${serializeAttributes(el, context)}|${content}`;
|
|
7362
7396
|
}
|
|
7363
|
-
function keyedNodes(nodes) {
|
|
7397
|
+
function keyedNodes(nodes, context) {
|
|
7364
7398
|
const occurrences = new Map();
|
|
7365
7399
|
return nodes.map(node => {
|
|
7366
|
-
const baseKey = elementKey(node);
|
|
7400
|
+
const baseKey = elementKey(node, context);
|
|
7367
7401
|
const occurrence = occurrences.get(baseKey) || 0;
|
|
7368
7402
|
occurrences.set(baseKey, occurrence + 1);
|
|
7369
7403
|
return { key: `${baseKey}|${occurrence}`, node };
|
|
7370
7404
|
});
|
|
7371
7405
|
}
|
|
7406
|
+
function canInsertNode(node, context) {
|
|
7407
|
+
if (!context.csp)
|
|
7408
|
+
return true;
|
|
7409
|
+
if (isNonceMeta(node))
|
|
7410
|
+
return Boolean(context.activeNonce);
|
|
7411
|
+
if (node.tagName === 'STYLE')
|
|
7412
|
+
return Boolean(context.activeNonce);
|
|
7413
|
+
if (node.tagName === 'SCRIPT' && !node.hasAttribute('src'))
|
|
7414
|
+
return Boolean(context.activeNonce);
|
|
7415
|
+
return true;
|
|
7416
|
+
}
|
|
7417
|
+
function reconcileCspAttributes(node, context) {
|
|
7418
|
+
if (!context.csp)
|
|
7419
|
+
return;
|
|
7420
|
+
if (isNonceMeta(node)) {
|
|
7421
|
+
if (context.activeNonce)
|
|
7422
|
+
node.setAttribute('content', context.activeNonce);
|
|
7423
|
+
return;
|
|
7424
|
+
}
|
|
7425
|
+
if (!usesCspNonce(node))
|
|
7426
|
+
return;
|
|
7427
|
+
node.removeAttribute('nonce');
|
|
7428
|
+
if (context.activeNonce)
|
|
7429
|
+
node.setAttribute('nonce', context.activeNonce);
|
|
7430
|
+
}
|
|
7431
|
+
function warnSkippedNode(node) {
|
|
7432
|
+
if (node.tagName === 'STYLE') {
|
|
7433
|
+
console.warn('[GyosJS CSP] Skipped an inline MPA style because no active document nonce is configured.');
|
|
7434
|
+
}
|
|
7435
|
+
else if (node.tagName === 'SCRIPT' && !node.hasAttribute('src')) {
|
|
7436
|
+
console.warn('[GyosJS CSP] Skipped an inline MPA script because no active document nonce is configured.');
|
|
7437
|
+
}
|
|
7438
|
+
}
|
|
7372
7439
|
async function diffNodes(currentNodes, nextNodes, container = document.head, signal) {
|
|
7373
|
-
const
|
|
7374
|
-
const
|
|
7440
|
+
const csp = expressionRuntimeMode() === 'csp';
|
|
7441
|
+
const context = {
|
|
7442
|
+
csp,
|
|
7443
|
+
activeNonce: csp ? resolveCspNonce() : undefined
|
|
7444
|
+
};
|
|
7445
|
+
const current = keyedNodes(currentNodes, context);
|
|
7446
|
+
const next = keyedNodes(nextNodes, context);
|
|
7375
7447
|
const currentKeys = new Set(current.map(item => item.key));
|
|
7376
7448
|
const nextKeys = new Set(next.map(item => item.key));
|
|
7377
7449
|
// Remove nodes that are not in the new head
|
|
@@ -7385,6 +7457,20 @@ async function diffNodes(currentNodes, nextNodes, container = document.head, sig
|
|
|
7385
7457
|
if (signal?.aborted)
|
|
7386
7458
|
return;
|
|
7387
7459
|
if (!currentKeys.has(key)) {
|
|
7460
|
+
if (!canInsertNode(node, context)) {
|
|
7461
|
+
warnSkippedNode(node);
|
|
7462
|
+
continue;
|
|
7463
|
+
}
|
|
7464
|
+
if (node.tagName === 'STYLE') {
|
|
7465
|
+
const style = document.createElement('style');
|
|
7466
|
+
Array.from(node.attributes).forEach(attr => style.setAttribute(attr.name, attr.value));
|
|
7467
|
+
reconcileCspAttributes(style, context);
|
|
7468
|
+
// CSP checks inline styles as their CSS text is attached. Set the active
|
|
7469
|
+
// nonce first so a response nonce never produces a transient violation.
|
|
7470
|
+
style.textContent = node.textContent || '';
|
|
7471
|
+
container.appendChild(style);
|
|
7472
|
+
continue;
|
|
7473
|
+
}
|
|
7388
7474
|
if (node.tagName === 'SCRIPT') {
|
|
7389
7475
|
const originalScript = node;
|
|
7390
7476
|
const executionKey = getScriptExecutionKey(originalScript);
|
|
@@ -7395,6 +7481,7 @@ async function diffNodes(currentNodes, nextNodes, container = document.head, sig
|
|
|
7395
7481
|
}
|
|
7396
7482
|
const script = document.createElement('script');
|
|
7397
7483
|
Array.from(node.attributes).forEach(attr => script.setAttribute(attr.name, attr.value));
|
|
7484
|
+
reconcileCspAttributes(script, context);
|
|
7398
7485
|
script.textContent = node.hasAttribute('g-script-wrap')
|
|
7399
7486
|
? wrapScriptExecution(node.textContent || '')
|
|
7400
7487
|
: node.textContent || '';
|
|
@@ -7404,11 +7491,168 @@ async function diffNodes(currentNodes, nextNodes, container = document.head, sig
|
|
|
7404
7491
|
await completion;
|
|
7405
7492
|
continue;
|
|
7406
7493
|
}
|
|
7407
|
-
|
|
7494
|
+
const imported = document.importNode(node, true);
|
|
7495
|
+
reconcileCspAttributes(imported, context);
|
|
7496
|
+
container.appendChild(imported);
|
|
7408
7497
|
}
|
|
7409
7498
|
}
|
|
7410
7499
|
}
|
|
7411
7500
|
|
|
7501
|
+
const RAW_TEXT_ELEMENTS = new Set(['iframe', 'noembed', 'noframes', 'plaintext', 'script', 'textarea', 'title', 'xmp']);
|
|
7502
|
+
function escapeAttribute(value) {
|
|
7503
|
+
return value.replace(/&/g, '&').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>');
|
|
7504
|
+
}
|
|
7505
|
+
function findTagEnd(html, start) {
|
|
7506
|
+
let quote = '';
|
|
7507
|
+
for (let index = start; index < html.length; index += 1) {
|
|
7508
|
+
const character = html[index];
|
|
7509
|
+
if (quote) {
|
|
7510
|
+
if (character === quote)
|
|
7511
|
+
quote = '';
|
|
7512
|
+
continue;
|
|
7513
|
+
}
|
|
7514
|
+
if (character === '"' || character === "'") {
|
|
7515
|
+
quote = character;
|
|
7516
|
+
continue;
|
|
7517
|
+
}
|
|
7518
|
+
if (character === '>')
|
|
7519
|
+
return index + 1;
|
|
7520
|
+
}
|
|
7521
|
+
return html.length;
|
|
7522
|
+
}
|
|
7523
|
+
function findClosingTag(html, lowerHtml, name, start) {
|
|
7524
|
+
const needle = `</${name}`;
|
|
7525
|
+
let position = lowerHtml.indexOf(needle, start);
|
|
7526
|
+
while (position !== -1) {
|
|
7527
|
+
const boundary = lowerHtml[position + needle.length];
|
|
7528
|
+
if (boundary === '>' || /\s/.test(boundary || '')) {
|
|
7529
|
+
return {
|
|
7530
|
+
start: position,
|
|
7531
|
+
end: findTagEnd(html, position + needle.length)
|
|
7532
|
+
};
|
|
7533
|
+
}
|
|
7534
|
+
position = lowerHtml.indexOf(needle, position + needle.length);
|
|
7535
|
+
}
|
|
7536
|
+
return null;
|
|
7537
|
+
}
|
|
7538
|
+
function removeNonceAttribute(openingTag) {
|
|
7539
|
+
const prefix = /^<\s*style\b/i.exec(openingTag);
|
|
7540
|
+
if (!prefix)
|
|
7541
|
+
return openingTag;
|
|
7542
|
+
let output = prefix[0];
|
|
7543
|
+
let cursor = prefix[0].length;
|
|
7544
|
+
const limit = openingTag.length - 1;
|
|
7545
|
+
while (cursor < limit) {
|
|
7546
|
+
const attributeStart = cursor;
|
|
7547
|
+
while (cursor < limit && /\s/.test(openingTag[cursor]))
|
|
7548
|
+
cursor += 1;
|
|
7549
|
+
if (cursor >= limit || openingTag[cursor] === '>') {
|
|
7550
|
+
output += openingTag.slice(attributeStart, cursor);
|
|
7551
|
+
break;
|
|
7552
|
+
}
|
|
7553
|
+
const nameStart = cursor;
|
|
7554
|
+
while (cursor < limit && !/[\s=/>]/.test(openingTag[cursor]))
|
|
7555
|
+
cursor += 1;
|
|
7556
|
+
if (cursor === nameStart) {
|
|
7557
|
+
output += openingTag.slice(attributeStart, cursor + 1);
|
|
7558
|
+
cursor += 1;
|
|
7559
|
+
continue;
|
|
7560
|
+
}
|
|
7561
|
+
const name = openingTag.slice(nameStart, cursor).toLowerCase();
|
|
7562
|
+
while (cursor < limit && /\s/.test(openingTag[cursor]))
|
|
7563
|
+
cursor += 1;
|
|
7564
|
+
if (openingTag[cursor] === '=') {
|
|
7565
|
+
cursor += 1;
|
|
7566
|
+
while (cursor < limit && /\s/.test(openingTag[cursor]))
|
|
7567
|
+
cursor += 1;
|
|
7568
|
+
const quote = openingTag[cursor] === '"' || openingTag[cursor] === "'" ? openingTag[cursor] : '';
|
|
7569
|
+
if (quote) {
|
|
7570
|
+
cursor += 1;
|
|
7571
|
+
while (cursor < limit && openingTag[cursor] !== quote)
|
|
7572
|
+
cursor += 1;
|
|
7573
|
+
if (openingTag[cursor] === quote)
|
|
7574
|
+
cursor += 1;
|
|
7575
|
+
}
|
|
7576
|
+
else {
|
|
7577
|
+
while (cursor < limit && !/[\s>]/.test(openingTag[cursor]))
|
|
7578
|
+
cursor += 1;
|
|
7579
|
+
}
|
|
7580
|
+
}
|
|
7581
|
+
if (name !== 'nonce')
|
|
7582
|
+
output += openingTag.slice(attributeStart, cursor);
|
|
7583
|
+
}
|
|
7584
|
+
return output + openingTag.slice(limit);
|
|
7585
|
+
}
|
|
7586
|
+
function withNonce(openingTag, nonce) {
|
|
7587
|
+
const withoutNonce = removeNonceAttribute(openingTag);
|
|
7588
|
+
return `${withoutNonce.slice(0, -1)} nonce="${escapeAttribute(nonce)}">`;
|
|
7589
|
+
}
|
|
7590
|
+
function prepareNavigationHtml(html) {
|
|
7591
|
+
if (expressionRuntimeMode() !== 'csp')
|
|
7592
|
+
return html;
|
|
7593
|
+
const activeNonce = resolveCspNonce();
|
|
7594
|
+
const lowerHtml = html.toLowerCase();
|
|
7595
|
+
let output = '';
|
|
7596
|
+
let cursor = 0;
|
|
7597
|
+
let skippedStyles = 0;
|
|
7598
|
+
while (cursor < html.length) {
|
|
7599
|
+
const tagStart = html.indexOf('<', cursor);
|
|
7600
|
+
if (tagStart === -1) {
|
|
7601
|
+
output += html.slice(cursor);
|
|
7602
|
+
break;
|
|
7603
|
+
}
|
|
7604
|
+
output += html.slice(cursor, tagStart);
|
|
7605
|
+
if (html.startsWith('<!--', tagStart)) {
|
|
7606
|
+
const commentEnd = html.indexOf('-->', tagStart + 4);
|
|
7607
|
+
const end = commentEnd === -1 ? html.length : commentEnd + 3;
|
|
7608
|
+
output += html.slice(tagStart, end);
|
|
7609
|
+
cursor = end;
|
|
7610
|
+
continue;
|
|
7611
|
+
}
|
|
7612
|
+
const tagEnd = findTagEnd(html, tagStart + 1);
|
|
7613
|
+
const openingTag = html.slice(tagStart, tagEnd);
|
|
7614
|
+
const match = /^<\s*(\/?)\s*([a-z][\w:-]*)/i.exec(openingTag);
|
|
7615
|
+
if (!match || match[1]) {
|
|
7616
|
+
output += openingTag;
|
|
7617
|
+
cursor = tagEnd;
|
|
7618
|
+
continue;
|
|
7619
|
+
}
|
|
7620
|
+
const name = match[2].toLowerCase();
|
|
7621
|
+
if (name === 'plaintext') {
|
|
7622
|
+
output += html.slice(tagStart);
|
|
7623
|
+
break;
|
|
7624
|
+
}
|
|
7625
|
+
if (name === 'style' || name === 'noscript' || RAW_TEXT_ELEMENTS.has(name)) {
|
|
7626
|
+
const closingTag = findClosingTag(html, lowerHtml, name, tagEnd);
|
|
7627
|
+
const blockEnd = closingTag?.end ?? html.length;
|
|
7628
|
+
if (name === 'noscript') {
|
|
7629
|
+
cursor = blockEnd;
|
|
7630
|
+
continue;
|
|
7631
|
+
}
|
|
7632
|
+
if (name === 'style') {
|
|
7633
|
+
if (!activeNonce) {
|
|
7634
|
+
skippedStyles += 1;
|
|
7635
|
+
cursor = blockEnd;
|
|
7636
|
+
continue;
|
|
7637
|
+
}
|
|
7638
|
+
output += withNonce(openingTag, activeNonce);
|
|
7639
|
+
output += html.slice(tagEnd, blockEnd);
|
|
7640
|
+
cursor = blockEnd;
|
|
7641
|
+
continue;
|
|
7642
|
+
}
|
|
7643
|
+
output += html.slice(tagStart, blockEnd);
|
|
7644
|
+
cursor = blockEnd;
|
|
7645
|
+
continue;
|
|
7646
|
+
}
|
|
7647
|
+
output += openingTag;
|
|
7648
|
+
cursor = tagEnd;
|
|
7649
|
+
}
|
|
7650
|
+
if (skippedStyles > 0) {
|
|
7651
|
+
console.warn(`[GyosJS CSP] Skipped ${skippedStyles} inline MPA style${skippedStyles === 1 ? '' : 's'} because no active document nonce is configured.`);
|
|
7652
|
+
}
|
|
7653
|
+
return output;
|
|
7654
|
+
}
|
|
7655
|
+
|
|
7412
7656
|
/**
|
|
7413
7657
|
* GyosJs Router v0
|
|
7414
7658
|
* MPA boost navigation inspired by Turbo Drive.
|
|
@@ -7472,7 +7716,10 @@ function stripInertFallbackContent(root) {
|
|
|
7472
7716
|
root.querySelectorAll('noscript').forEach(element => element.remove());
|
|
7473
7717
|
}
|
|
7474
7718
|
function parseNavigationDocument(html) {
|
|
7475
|
-
|
|
7719
|
+
// Chromium applies the active page CSP while DOMParser creates response
|
|
7720
|
+
// styles. Reconcile their nonce before parsing to avoid transient violations;
|
|
7721
|
+
// diffNodes repeats the check before insertion into the live document.
|
|
7722
|
+
const doc = new DOMParser().parseFromString(prepareNavigationHtml(html), 'text/html');
|
|
7476
7723
|
// DOMParser disables scripting and parses noscript children as active markup.
|
|
7477
7724
|
// A boosted page runs with scripting enabled, so those fallbacks must stay inert.
|
|
7478
7725
|
stripInertFallbackContent(doc);
|
|
@@ -8308,20 +8555,20 @@ const Gyos = {
|
|
|
8308
8555
|
portalCreate,
|
|
8309
8556
|
portalDestroy,
|
|
8310
8557
|
setCspNonce,
|
|
8311
|
-
version: '0.3.
|
|
8558
|
+
version: '0.3.2'
|
|
8312
8559
|
};
|
|
8313
8560
|
|
|
8314
8561
|
// This file was generated. Do not modify manually!
|
|
8315
|
-
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,
|
|
8562
|
+
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];
|
|
8316
8563
|
|
|
8317
8564
|
// This file was generated. Do not modify manually!
|
|
8318
|
-
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,
|
|
8565
|
+
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];
|
|
8319
8566
|
|
|
8320
8567
|
// This file was generated. Do not modify manually!
|
|
8321
|
-
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-\
|
|
8568
|
+
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";
|
|
8322
8569
|
|
|
8323
8570
|
// This file was generated. Do not modify manually!
|
|
8324
|
-
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-\
|
|
8571
|
+
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";
|
|
8325
8572
|
|
|
8326
8573
|
// These are a run-length and offset encoded representation of the
|
|
8327
8574
|
// >0xffff code points that are a valid part of identifiers. The
|
|
@@ -8646,12 +8893,9 @@ var defaultOptions = {
|
|
|
8646
8893
|
// for new syntax features.
|
|
8647
8894
|
ecmaVersion: null,
|
|
8648
8895
|
// `sourceType` indicates the mode the code should be parsed in.
|
|
8649
|
-
// Can be either `"script"
|
|
8896
|
+
// Can be either `"script"` or `"module"`. This influences global
|
|
8650
8897
|
// strict mode and parsing of `import` and `export` declarations.
|
|
8651
8898
|
sourceType: "script",
|
|
8652
|
-
// When set to true, enable strict parsing mode even if `sourceType`
|
|
8653
|
-
// is `"script"`.
|
|
8654
|
-
strict: false,
|
|
8655
8899
|
// `onInsertedSemicolon` can be a callback that will be called when
|
|
8656
8900
|
// a semicolon is automatically inserted. It will be passed the
|
|
8657
8901
|
// position of the inserted semicolon as an offset, and if
|
|
@@ -8693,11 +8937,6 @@ var defaultOptions = {
|
|
|
8693
8937
|
// line being 1-based and column 0-based) will be attached to the
|
|
8694
8938
|
// nodes.
|
|
8695
8939
|
locations: false,
|
|
8696
|
-
// Pass an optional `{line, column}` object to use for the start of
|
|
8697
|
-
// the parse. This is mostly useful when using `parseExpressionAt`
|
|
8698
|
-
// with `locations: true`, to prevent the parser from having to
|
|
8699
|
-
// determine the line position at the start position.
|
|
8700
|
-
startLocation: null,
|
|
8701
8940
|
// A function can be passed as `onToken` option, which will
|
|
8702
8941
|
// cause Acorn to call that function with object in the same
|
|
8703
8942
|
// format as tokens returned from `tokenizer().getToken()`. Note
|
|
@@ -8778,9 +9017,6 @@ function getOptions(opts) {
|
|
|
8778
9017
|
if (isArray(options.onComment))
|
|
8779
9018
|
{ options.onComment = pushComment(options, options.onComment); }
|
|
8780
9019
|
|
|
8781
|
-
if (options.sourceType === "commonjs" && options.allowAwaitOutsideFunction)
|
|
8782
|
-
{ throw new Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs") }
|
|
8783
|
-
|
|
8784
9020
|
return options
|
|
8785
9021
|
}
|
|
8786
9022
|
|
|
@@ -8812,7 +9048,6 @@ var
|
|
|
8812
9048
|
SCOPE_DIRECT_SUPER = 128,
|
|
8813
9049
|
SCOPE_CLASS_STATIC_BLOCK = 256,
|
|
8814
9050
|
SCOPE_CLASS_FIELD_INIT = 512,
|
|
8815
|
-
SCOPE_SWITCH = 1024,
|
|
8816
9051
|
SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK;
|
|
8817
9052
|
|
|
8818
9053
|
function functionFlags(async, generator) {
|
|
@@ -8851,17 +9086,13 @@ var Parser = function Parser(options, input, startPos) {
|
|
|
8851
9086
|
// Set up token state
|
|
8852
9087
|
|
|
8853
9088
|
// The current position of the tokenizer in the input.
|
|
8854
|
-
|
|
8855
|
-
|
|
8856
|
-
if (options.startLocation) {
|
|
8857
|
-
this.lineStart = this.pos - options.startLocation.column;
|
|
8858
|
-
this.curLine = options.startLocation.line;
|
|
8859
|
-
} else if (startPos) {
|
|
9089
|
+
if (startPos) {
|
|
9090
|
+
this.pos = startPos;
|
|
8860
9091
|
this.lineStart = this.input.lastIndexOf("\n", startPos - 1) + 1;
|
|
8861
|
-
|
|
8862
|
-
{ this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length; }
|
|
9092
|
+
this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length;
|
|
8863
9093
|
} else {
|
|
8864
|
-
this.lineStart = 0;
|
|
9094
|
+
this.pos = this.lineStart = 0;
|
|
9095
|
+
this.curLine = 1;
|
|
8865
9096
|
}
|
|
8866
9097
|
|
|
8867
9098
|
// Properties of the current token:
|
|
@@ -8887,7 +9118,7 @@ var Parser = function Parser(options, input, startPos) {
|
|
|
8887
9118
|
|
|
8888
9119
|
// Figure out if it's a module code.
|
|
8889
9120
|
this.inModule = options.sourceType === "module";
|
|
8890
|
-
this.strict = this.inModule ||
|
|
9121
|
+
this.strict = this.inModule || this.strictDirective(this.pos);
|
|
8891
9122
|
|
|
8892
9123
|
// Used to signify the start of a potential arrow function
|
|
8893
9124
|
this.potentialArrowAt = -1;
|
|
@@ -8906,12 +9137,7 @@ var Parser = function Parser(options, input, startPos) {
|
|
|
8906
9137
|
|
|
8907
9138
|
// Scope tracking for duplicate variable names (see scope.js)
|
|
8908
9139
|
this.scopeStack = [];
|
|
8909
|
-
this.enterScope(
|
|
8910
|
-
this.options.sourceType === "commonjs"
|
|
8911
|
-
// In commonjs, the top-level scope behaves like a function scope
|
|
8912
|
-
? SCOPE_FUNCTION
|
|
8913
|
-
: SCOPE_TOP
|
|
8914
|
-
);
|
|
9140
|
+
this.enterScope(SCOPE_TOP);
|
|
8915
9141
|
|
|
8916
9142
|
// For RegExp validation
|
|
8917
9143
|
this.regexpState = null;
|
|
@@ -8922,14 +9148,12 @@ var Parser = function Parser(options, input, startPos) {
|
|
|
8922
9148
|
this.privateNameStack = [];
|
|
8923
9149
|
};
|
|
8924
9150
|
|
|
8925
|
-
var prototypeAccessors = { inFunction: { configurable: true },inGenerator: { configurable: true },inAsync: { configurable: true },canAwait: { configurable: true },
|
|
9151
|
+
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 } };
|
|
8926
9152
|
|
|
8927
9153
|
Parser.prototype.parse = function parse () {
|
|
8928
|
-
var this$1$1 = this;
|
|
8929
|
-
|
|
8930
9154
|
var node = this.options.program || this.startNode();
|
|
8931
9155
|
this.nextToken();
|
|
8932
|
-
return this.
|
|
9156
|
+
return this.parseTopLevel(node)
|
|
8933
9157
|
};
|
|
8934
9158
|
|
|
8935
9159
|
prototypeAccessors.inFunction.get = function () { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0 };
|
|
@@ -8948,12 +9172,6 @@ prototypeAccessors.canAwait.get = function () {
|
|
|
8948
9172
|
return (this.inModule && this.options.ecmaVersion >= 13) || this.options.allowAwaitOutsideFunction
|
|
8949
9173
|
};
|
|
8950
9174
|
|
|
8951
|
-
prototypeAccessors.allowReturn.get = function () {
|
|
8952
|
-
if (this.inFunction) { return true }
|
|
8953
|
-
if (this.options.allowReturnOutsideFunction && this.currentVarScope().flags & SCOPE_TOP) { return true }
|
|
8954
|
-
return false
|
|
8955
|
-
};
|
|
8956
|
-
|
|
8957
9175
|
prototypeAccessors.allowSuper.get = function () {
|
|
8958
9176
|
var ref = this.currentThisScope();
|
|
8959
9177
|
var flags = ref.flags;
|
|
@@ -8974,14 +9192,6 @@ prototypeAccessors.allowNewDotTarget.get = function () {
|
|
|
8974
9192
|
return false
|
|
8975
9193
|
};
|
|
8976
9194
|
|
|
8977
|
-
prototypeAccessors.allowUsing.get = function () {
|
|
8978
|
-
var ref = this.currentScope();
|
|
8979
|
-
var flags = ref.flags;
|
|
8980
|
-
if (flags & SCOPE_SWITCH) { return false }
|
|
8981
|
-
if (!this.inModule && flags & SCOPE_TOP) { return false }
|
|
8982
|
-
return true
|
|
8983
|
-
};
|
|
8984
|
-
|
|
8985
9195
|
prototypeAccessors.inClassStaticBlock.get = function () {
|
|
8986
9196
|
return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0
|
|
8987
9197
|
};
|
|
@@ -9068,17 +9278,6 @@ pp$9.eatContextual = function(name) {
|
|
|
9068
9278
|
return true
|
|
9069
9279
|
};
|
|
9070
9280
|
|
|
9071
|
-
pp$9.catchStackOverflow = function(f) {
|
|
9072
|
-
try {
|
|
9073
|
-
return f()
|
|
9074
|
-
} catch (e) {
|
|
9075
|
-
if (e instanceof Error && (/\bstack\b.*\b(exceeded|overflow)\b/i.test(e.message) || /\btoo much recursion\b/i.test(e.message)))
|
|
9076
|
-
{ this.raise(this.start, "Not enough stack space to parse input"); }
|
|
9077
|
-
else
|
|
9078
|
-
{ throw e }
|
|
9079
|
-
}
|
|
9080
|
-
};
|
|
9081
|
-
|
|
9082
9281
|
// Asserts that following token is given contextual keyword.
|
|
9083
9282
|
|
|
9084
9283
|
pp$9.expectContextual = function(name) {
|
|
@@ -9182,10 +9381,10 @@ var pp$8 = Parser.prototype;
|
|
|
9182
9381
|
// to its body instead of creating a new node.
|
|
9183
9382
|
|
|
9184
9383
|
pp$8.parseTopLevel = function(node) {
|
|
9185
|
-
var exports
|
|
9384
|
+
var exports = Object.create(null);
|
|
9186
9385
|
if (!node.body) { node.body = []; }
|
|
9187
9386
|
while (this.type !== types$1.eof) {
|
|
9188
|
-
var stmt = this.parseStatement(null, true, exports
|
|
9387
|
+
var stmt = this.parseStatement(null, true, exports);
|
|
9189
9388
|
node.body.push(stmt);
|
|
9190
9389
|
}
|
|
9191
9390
|
if (this.inModule)
|
|
@@ -9197,7 +9396,7 @@ pp$8.parseTopLevel = function(node) {
|
|
|
9197
9396
|
} }
|
|
9198
9397
|
this.adaptDirectivePrologue(node.body);
|
|
9199
9398
|
this.next();
|
|
9200
|
-
node.sourceType = this.options.sourceType
|
|
9399
|
+
node.sourceType = this.options.sourceType;
|
|
9201
9400
|
return this.finishNode(node, "Program")
|
|
9202
9401
|
};
|
|
9203
9402
|
|
|
@@ -9207,7 +9406,7 @@ pp$8.isLet = function(context) {
|
|
|
9207
9406
|
if (this.options.ecmaVersion < 6 || !this.isContextual("let")) { return false }
|
|
9208
9407
|
skipWhiteSpace.lastIndex = this.pos;
|
|
9209
9408
|
var skip = skipWhiteSpace.exec(this.input);
|
|
9210
|
-
var next = this.pos + skip[0].length, nextCh = this.
|
|
9409
|
+
var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
|
|
9211
9410
|
// For ambiguous cases, determine if a LexicalDeclaration (or only a
|
|
9212
9411
|
// Statement) is allowed here. If context is not empty then only a Statement
|
|
9213
9412
|
// is allowed. However, `let [` is an explicit negative lookahead for
|
|
@@ -9215,13 +9414,12 @@ pp$8.isLet = function(context) {
|
|
|
9215
9414
|
if (nextCh === 91 || nextCh === 92) { return true } // '[', '\'
|
|
9216
9415
|
if (context) { return false }
|
|
9217
9416
|
|
|
9218
|
-
if (nextCh === 123) { return true } // '{'
|
|
9219
|
-
if (isIdentifierStart(nextCh)) {
|
|
9220
|
-
var
|
|
9221
|
-
|
|
9222
|
-
|
|
9223
|
-
|
|
9224
|
-
var ident = this.input.slice(start, next);
|
|
9417
|
+
if (nextCh === 123 || nextCh > 0xd7ff && nextCh < 0xdc00) { return true } // '{', astral
|
|
9418
|
+
if (isIdentifierStart(nextCh, true)) {
|
|
9419
|
+
var pos = next + 1;
|
|
9420
|
+
while (isIdentifierChar(nextCh = this.input.charCodeAt(pos), true)) { ++pos; }
|
|
9421
|
+
if (nextCh === 92 || nextCh > 0xd7ff && nextCh < 0xdc00) { return true }
|
|
9422
|
+
var ident = this.input.slice(next, pos);
|
|
9225
9423
|
if (!keywordRelationalOperator.test(ident)) { return true }
|
|
9226
9424
|
}
|
|
9227
9425
|
return false
|
|
@@ -9240,7 +9438,7 @@ pp$8.isAsyncFunction = function() {
|
|
|
9240
9438
|
return !lineBreak.test(this.input.slice(this.pos, next)) &&
|
|
9241
9439
|
this.input.slice(next, next + 8) === "function" &&
|
|
9242
9440
|
(next + 8 === this.input.length ||
|
|
9243
|
-
!(isIdentifierChar(after = this.
|
|
9441
|
+
!(isIdentifierChar(after = this.input.charCodeAt(next + 8)) || after > 0xd7ff && after < 0xdc00))
|
|
9244
9442
|
};
|
|
9245
9443
|
|
|
9246
9444
|
pp$8.isUsingKeyword = function(isAwaitUsing, isFor) {
|
|
@@ -9254,39 +9452,28 @@ pp$8.isUsingKeyword = function(isAwaitUsing, isFor) {
|
|
|
9254
9452
|
if (lineBreak.test(this.input.slice(this.pos, next))) { return false }
|
|
9255
9453
|
|
|
9256
9454
|
if (isAwaitUsing) {
|
|
9257
|
-
var
|
|
9258
|
-
if (this.input.slice(next,
|
|
9259
|
-
|
|
9260
|
-
isIdentifierChar(after = this.
|
|
9261
|
-
after
|
|
9455
|
+
var awaitEndPos = next + 5 /* await */, after;
|
|
9456
|
+
if (this.input.slice(next, awaitEndPos) !== "using" ||
|
|
9457
|
+
awaitEndPos === this.input.length ||
|
|
9458
|
+
isIdentifierChar(after = this.input.charCodeAt(awaitEndPos)) ||
|
|
9459
|
+
(after > 0xd7ff && after < 0xdc00)
|
|
9262
9460
|
) { return false }
|
|
9263
9461
|
|
|
9264
|
-
skipWhiteSpace.lastIndex =
|
|
9462
|
+
skipWhiteSpace.lastIndex = awaitEndPos;
|
|
9265
9463
|
var skipAfterUsing = skipWhiteSpace.exec(this.input);
|
|
9266
|
-
|
|
9267
|
-
|
|
9268
|
-
|
|
9269
|
-
|
|
9270
|
-
|
|
9271
|
-
|
|
9272
|
-
|
|
9273
|
-
|
|
9274
|
-
while (isIdentifierChar(ch = this.fullCharCodeAt(next)))
|
|
9275
|
-
if (ch === 92) { return true }
|
|
9276
|
-
var id = this.input.slice(idStart, next);
|
|
9277
|
-
if (keywordRelationalOperator.test(id)) { return false }
|
|
9278
|
-
if (isFor && !isAwaitUsing && id === "of") {
|
|
9279
|
-
// Look ahead for using declaration with initializer, i.e., `for (using of = ...)`
|
|
9280
|
-
skipWhiteSpace.lastIndex = next;
|
|
9281
|
-
var skipAfterOf = skipWhiteSpace.exec(this.input);
|
|
9282
|
-
next = next + skipAfterOf[0].length;
|
|
9283
|
-
if (this.input.charCodeAt(next) !== 61 /* '=' */ ||
|
|
9284
|
-
// Check for ==, === and => operators
|
|
9285
|
-
(ch = this.input.charCodeAt(next + 1)) === 61 /* '=' */ || ch === 62 /* '>' */) {
|
|
9286
|
-
return false
|
|
9464
|
+
if (skipAfterUsing && lineBreak.test(this.input.slice(awaitEndPos, awaitEndPos + skipAfterUsing[0].length))) { return false }
|
|
9465
|
+
}
|
|
9466
|
+
|
|
9467
|
+
if (isFor) {
|
|
9468
|
+
var ofEndPos = next + 2 /* of */, after$1;
|
|
9469
|
+
if (this.input.slice(next, ofEndPos) === "of") {
|
|
9470
|
+
if (ofEndPos === this.input.length ||
|
|
9471
|
+
(!isIdentifierChar(after$1 = this.input.charCodeAt(ofEndPos)) && !(after$1 > 0xd7ff && after$1 < 0xdc00))) { return false }
|
|
9287
9472
|
}
|
|
9288
9473
|
}
|
|
9289
|
-
|
|
9474
|
+
|
|
9475
|
+
var ch = this.input.charCodeAt(next);
|
|
9476
|
+
return isIdentifierStart(ch, true) || ch === 92 // '\'
|
|
9290
9477
|
};
|
|
9291
9478
|
|
|
9292
9479
|
pp$8.isAwaitUsing = function(isFor) {
|
|
@@ -9304,7 +9491,7 @@ pp$8.isUsing = function(isFor) {
|
|
|
9304
9491
|
// `if (foo) /blah/.exec(foo)`, where looking at the previous token
|
|
9305
9492
|
// does not help.
|
|
9306
9493
|
|
|
9307
|
-
pp$8.parseStatement = function(context, topLevel, exports
|
|
9494
|
+
pp$8.parseStatement = function(context, topLevel, exports) {
|
|
9308
9495
|
var starttype = this.type, node = this.startNode(), kind;
|
|
9309
9496
|
|
|
9310
9497
|
if (this.isLet(context)) {
|
|
@@ -9359,7 +9546,7 @@ pp$8.parseStatement = function(context, topLevel, exports$1) {
|
|
|
9359
9546
|
if (!this.inModule)
|
|
9360
9547
|
{ this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'"); }
|
|
9361
9548
|
}
|
|
9362
|
-
return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports
|
|
9549
|
+
return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports)
|
|
9363
9550
|
|
|
9364
9551
|
// If the statement does not start with a statement keyword or a
|
|
9365
9552
|
// brace, it's an ExpressionStatement or LabeledStatement. We
|
|
@@ -9375,12 +9562,8 @@ pp$8.parseStatement = function(context, topLevel, exports$1) {
|
|
|
9375
9562
|
|
|
9376
9563
|
var usingKind = this.isAwaitUsing(false) ? "await using" : this.isUsing(false) ? "using" : null;
|
|
9377
9564
|
if (usingKind) {
|
|
9378
|
-
if (
|
|
9379
|
-
this.raise(this.start, "Using declaration cannot appear in the top level when source type is `script`
|
|
9380
|
-
}
|
|
9381
|
-
if (context) {
|
|
9382
|
-
// Cases like `for (;;) using x = ...;`, `if (true) await using x = ...;`, etc. are not allowed.
|
|
9383
|
-
this.raise(this.start, "Using declaration is not allowed in single-statement positions");
|
|
9565
|
+
if (topLevel && this.options.sourceType === "script") {
|
|
9566
|
+
this.raise(this.start, "Using declaration cannot appear in the top level when source type is `script`");
|
|
9384
9567
|
}
|
|
9385
9568
|
if (usingKind === "await using") {
|
|
9386
9569
|
if (!this.canAwait) {
|
|
@@ -9477,12 +9660,7 @@ pp$8.parseForStatement = function(node) {
|
|
|
9477
9660
|
if (usingKind) {
|
|
9478
9661
|
var init$2 = this.startNode();
|
|
9479
9662
|
this.next();
|
|
9480
|
-
if (usingKind === "await using") {
|
|
9481
|
-
if (!this.canAwait) {
|
|
9482
|
-
this.raise(this.start, "Await using cannot appear outside of async function");
|
|
9483
|
-
}
|
|
9484
|
-
this.next();
|
|
9485
|
-
}
|
|
9663
|
+
if (usingKind === "await using") { this.next(); }
|
|
9486
9664
|
this.parseVar(init$2, true, usingKind);
|
|
9487
9665
|
this.finishNode(init$2, "VariableDeclaration");
|
|
9488
9666
|
return this.parseForAfterInit(node, init$2, awaitAt)
|
|
@@ -9515,12 +9693,11 @@ pp$8.parseForStatement = function(node) {
|
|
|
9515
9693
|
// Helper method to parse for loop after variable initialization
|
|
9516
9694
|
pp$8.parseForAfterInit = function(node, init, awaitAt) {
|
|
9517
9695
|
if ((this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init.declarations.length === 1) {
|
|
9518
|
-
if (this.
|
|
9519
|
-
if (
|
|
9520
|
-
|
|
9521
|
-
}
|
|
9522
|
-
|
|
9523
|
-
} else if (this.options.ecmaVersion >= 9) { node.await = awaitAt > -1; }
|
|
9696
|
+
if (this.options.ecmaVersion >= 9) {
|
|
9697
|
+
if (this.type === types$1._in) {
|
|
9698
|
+
if (awaitAt > -1) { this.unexpected(awaitAt); }
|
|
9699
|
+
} else { node.await = awaitAt > -1; }
|
|
9700
|
+
}
|
|
9524
9701
|
return this.parseForIn(node, init)
|
|
9525
9702
|
}
|
|
9526
9703
|
if (awaitAt > -1) { this.unexpected(awaitAt); }
|
|
@@ -9542,7 +9719,7 @@ pp$8.parseIfStatement = function(node) {
|
|
|
9542
9719
|
};
|
|
9543
9720
|
|
|
9544
9721
|
pp$8.parseReturnStatement = function(node) {
|
|
9545
|
-
if (!this.
|
|
9722
|
+
if (!this.inFunction && !this.options.allowReturnOutsideFunction)
|
|
9546
9723
|
{ this.raise(this.start, "'return' outside of function"); }
|
|
9547
9724
|
this.next();
|
|
9548
9725
|
|
|
@@ -9561,7 +9738,7 @@ pp$8.parseSwitchStatement = function(node) {
|
|
|
9561
9738
|
node.cases = [];
|
|
9562
9739
|
this.expect(types$1.braceL);
|
|
9563
9740
|
this.labels.push(switchLabel);
|
|
9564
|
-
this.enterScope(
|
|
9741
|
+
this.enterScope(0);
|
|
9565
9742
|
|
|
9566
9743
|
// Statements under must be grouped (by label) in SwitchCase
|
|
9567
9744
|
// nodes. `cur` is used to keep the node that we are currently
|
|
@@ -10125,11 +10302,11 @@ function checkKeyName(node, name) {
|
|
|
10125
10302
|
|
|
10126
10303
|
// Parses module export declaration.
|
|
10127
10304
|
|
|
10128
|
-
pp$8.parseExportAllDeclaration = function(node, exports
|
|
10305
|
+
pp$8.parseExportAllDeclaration = function(node, exports) {
|
|
10129
10306
|
if (this.options.ecmaVersion >= 11) {
|
|
10130
10307
|
if (this.eatContextual("as")) {
|
|
10131
10308
|
node.exported = this.parseModuleExportName();
|
|
10132
|
-
this.checkExport(exports
|
|
10309
|
+
this.checkExport(exports, node.exported, this.lastTokStart);
|
|
10133
10310
|
} else {
|
|
10134
10311
|
node.exported = null;
|
|
10135
10312
|
}
|
|
@@ -10143,14 +10320,14 @@ pp$8.parseExportAllDeclaration = function(node, exports$1) {
|
|
|
10143
10320
|
return this.finishNode(node, "ExportAllDeclaration")
|
|
10144
10321
|
};
|
|
10145
10322
|
|
|
10146
|
-
pp$8.parseExport = function(node, exports
|
|
10323
|
+
pp$8.parseExport = function(node, exports) {
|
|
10147
10324
|
this.next();
|
|
10148
10325
|
// export * from '...'
|
|
10149
10326
|
if (this.eat(types$1.star)) {
|
|
10150
|
-
return this.parseExportAllDeclaration(node, exports
|
|
10327
|
+
return this.parseExportAllDeclaration(node, exports)
|
|
10151
10328
|
}
|
|
10152
10329
|
if (this.eat(types$1._default)) { // export default ...
|
|
10153
|
-
this.checkExport(exports
|
|
10330
|
+
this.checkExport(exports, "default", this.lastTokStart);
|
|
10154
10331
|
node.declaration = this.parseExportDefaultDeclaration();
|
|
10155
10332
|
return this.finishNode(node, "ExportDefaultDeclaration")
|
|
10156
10333
|
}
|
|
@@ -10158,16 +10335,16 @@ pp$8.parseExport = function(node, exports$1) {
|
|
|
10158
10335
|
if (this.shouldParseExportStatement()) {
|
|
10159
10336
|
node.declaration = this.parseExportDeclaration(node);
|
|
10160
10337
|
if (node.declaration.type === "VariableDeclaration")
|
|
10161
|
-
{ this.checkVariableExport(exports
|
|
10338
|
+
{ this.checkVariableExport(exports, node.declaration.declarations); }
|
|
10162
10339
|
else
|
|
10163
|
-
{ this.checkExport(exports
|
|
10340
|
+
{ this.checkExport(exports, node.declaration.id, node.declaration.id.start); }
|
|
10164
10341
|
node.specifiers = [];
|
|
10165
10342
|
node.source = null;
|
|
10166
10343
|
if (this.options.ecmaVersion >= 16)
|
|
10167
10344
|
{ node.attributes = []; }
|
|
10168
10345
|
} else { // export { x, y as z } [from '...']
|
|
10169
10346
|
node.declaration = null;
|
|
10170
|
-
node.specifiers = this.parseExportSpecifiers(exports
|
|
10347
|
+
node.specifiers = this.parseExportSpecifiers(exports);
|
|
10171
10348
|
if (this.eatContextual("from")) {
|
|
10172
10349
|
if (this.type !== types$1.string) { this.unexpected(); }
|
|
10173
10350
|
node.source = this.parseExprAtom();
|
|
@@ -10217,47 +10394,47 @@ pp$8.parseExportDefaultDeclaration = function() {
|
|
|
10217
10394
|
}
|
|
10218
10395
|
};
|
|
10219
10396
|
|
|
10220
|
-
pp$8.checkExport = function(exports
|
|
10221
|
-
if (!exports
|
|
10397
|
+
pp$8.checkExport = function(exports, name, pos) {
|
|
10398
|
+
if (!exports) { return }
|
|
10222
10399
|
if (typeof name !== "string")
|
|
10223
10400
|
{ name = name.type === "Identifier" ? name.name : name.value; }
|
|
10224
|
-
if (hasOwn(exports
|
|
10401
|
+
if (hasOwn(exports, name))
|
|
10225
10402
|
{ this.raiseRecoverable(pos, "Duplicate export '" + name + "'"); }
|
|
10226
|
-
exports
|
|
10403
|
+
exports[name] = true;
|
|
10227
10404
|
};
|
|
10228
10405
|
|
|
10229
|
-
pp$8.checkPatternExport = function(exports
|
|
10406
|
+
pp$8.checkPatternExport = function(exports, pat) {
|
|
10230
10407
|
var type = pat.type;
|
|
10231
10408
|
if (type === "Identifier")
|
|
10232
|
-
{ this.checkExport(exports
|
|
10409
|
+
{ this.checkExport(exports, pat, pat.start); }
|
|
10233
10410
|
else if (type === "ObjectPattern")
|
|
10234
10411
|
{ for (var i = 0, list = pat.properties; i < list.length; i += 1)
|
|
10235
10412
|
{
|
|
10236
10413
|
var prop = list[i];
|
|
10237
10414
|
|
|
10238
|
-
this.checkPatternExport(exports
|
|
10415
|
+
this.checkPatternExport(exports, prop);
|
|
10239
10416
|
} }
|
|
10240
10417
|
else if (type === "ArrayPattern")
|
|
10241
10418
|
{ for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) {
|
|
10242
10419
|
var elt = list$1[i$1];
|
|
10243
10420
|
|
|
10244
|
-
if (elt) { this.checkPatternExport(exports
|
|
10421
|
+
if (elt) { this.checkPatternExport(exports, elt); }
|
|
10245
10422
|
} }
|
|
10246
10423
|
else if (type === "Property")
|
|
10247
|
-
{ this.checkPatternExport(exports
|
|
10424
|
+
{ this.checkPatternExport(exports, pat.value); }
|
|
10248
10425
|
else if (type === "AssignmentPattern")
|
|
10249
|
-
{ this.checkPatternExport(exports
|
|
10426
|
+
{ this.checkPatternExport(exports, pat.left); }
|
|
10250
10427
|
else if (type === "RestElement")
|
|
10251
|
-
{ this.checkPatternExport(exports
|
|
10428
|
+
{ this.checkPatternExport(exports, pat.argument); }
|
|
10252
10429
|
};
|
|
10253
10430
|
|
|
10254
|
-
pp$8.checkVariableExport = function(exports
|
|
10255
|
-
if (!exports
|
|
10431
|
+
pp$8.checkVariableExport = function(exports, decls) {
|
|
10432
|
+
if (!exports) { return }
|
|
10256
10433
|
for (var i = 0, list = decls; i < list.length; i += 1)
|
|
10257
10434
|
{
|
|
10258
10435
|
var decl = list[i];
|
|
10259
10436
|
|
|
10260
|
-
this.checkPatternExport(exports
|
|
10437
|
+
this.checkPatternExport(exports, decl.id);
|
|
10261
10438
|
}
|
|
10262
10439
|
};
|
|
10263
10440
|
|
|
@@ -10272,13 +10449,13 @@ pp$8.shouldParseExportStatement = function() {
|
|
|
10272
10449
|
|
|
10273
10450
|
// Parses a comma-separated list of module exports.
|
|
10274
10451
|
|
|
10275
|
-
pp$8.parseExportSpecifier = function(exports
|
|
10452
|
+
pp$8.parseExportSpecifier = function(exports) {
|
|
10276
10453
|
var node = this.startNode();
|
|
10277
10454
|
node.local = this.parseModuleExportName();
|
|
10278
10455
|
|
|
10279
10456
|
node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
|
|
10280
10457
|
this.checkExport(
|
|
10281
|
-
exports
|
|
10458
|
+
exports,
|
|
10282
10459
|
node.exported,
|
|
10283
10460
|
node.exported.start
|
|
10284
10461
|
);
|
|
@@ -10286,7 +10463,7 @@ pp$8.parseExportSpecifier = function(exports$1) {
|
|
|
10286
10463
|
return this.finishNode(node, "ExportSpecifier")
|
|
10287
10464
|
};
|
|
10288
10465
|
|
|
10289
|
-
pp$8.parseExportSpecifiers = function(exports
|
|
10466
|
+
pp$8.parseExportSpecifiers = function(exports) {
|
|
10290
10467
|
var nodes = [], first = true;
|
|
10291
10468
|
// export { x, y as z } [from '...']
|
|
10292
10469
|
this.expect(types$1.braceL);
|
|
@@ -10296,7 +10473,7 @@ pp$8.parseExportSpecifiers = function(exports$1) {
|
|
|
10296
10473
|
if (this.afterTrailingComma(types$1.braceR)) { break }
|
|
10297
10474
|
} else { first = false; }
|
|
10298
10475
|
|
|
10299
|
-
nodes.push(this.parseExportSpecifier(exports
|
|
10476
|
+
nodes.push(this.parseExportSpecifier(exports));
|
|
10300
10477
|
}
|
|
10301
10478
|
return nodes
|
|
10302
10479
|
};
|
|
@@ -11027,19 +11204,15 @@ pp$5.checkPropClash = function(prop, propHash, refDestructuringErrors) {
|
|
|
11027
11204
|
// delayed syntax error at correct position).
|
|
11028
11205
|
|
|
11029
11206
|
pp$5.parseExpression = function(forInit, refDestructuringErrors) {
|
|
11030
|
-
var this
|
|
11031
|
-
|
|
11032
|
-
|
|
11033
|
-
var
|
|
11034
|
-
|
|
11035
|
-
|
|
11036
|
-
|
|
11037
|
-
|
|
11038
|
-
|
|
11039
|
-
return this$1$1.finishNode(node, "SequenceExpression")
|
|
11040
|
-
}
|
|
11041
|
-
return expr
|
|
11042
|
-
})
|
|
11207
|
+
var startPos = this.start, startLoc = this.startLoc;
|
|
11208
|
+
var expr = this.parseMaybeAssign(forInit, refDestructuringErrors);
|
|
11209
|
+
if (this.type === types$1.comma) {
|
|
11210
|
+
var node = this.startNodeAt(startPos, startLoc);
|
|
11211
|
+
node.expressions = [expr];
|
|
11212
|
+
while (this.eat(types$1.comma)) { node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); }
|
|
11213
|
+
return this.finishNode(node, "SequenceExpression")
|
|
11214
|
+
}
|
|
11215
|
+
return expr
|
|
11043
11216
|
};
|
|
11044
11217
|
|
|
11045
11218
|
// Parse an assignment expression. This includes applications of
|
|
@@ -11104,7 +11277,7 @@ pp$5.parseMaybeConditional = function(forInit, refDestructuringErrors) {
|
|
|
11104
11277
|
var startPos = this.start, startLoc = this.startLoc;
|
|
11105
11278
|
var expr = this.parseExprOps(forInit, refDestructuringErrors);
|
|
11106
11279
|
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
|
|
11107
|
-
if (
|
|
11280
|
+
if (this.eat(types$1.question)) {
|
|
11108
11281
|
var node = this.startNodeAt(startPos, startLoc);
|
|
11109
11282
|
node.test = expr;
|
|
11110
11283
|
node.consequent = this.parseMaybeAssign();
|
|
@@ -11204,7 +11377,7 @@ pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forIni
|
|
|
11204
11377
|
}
|
|
11205
11378
|
}
|
|
11206
11379
|
|
|
11207
|
-
if (!incDec &&
|
|
11380
|
+
if (!incDec && this.eat(types$1.starstar)) {
|
|
11208
11381
|
if (sawUnary)
|
|
11209
11382
|
{ this.unexpected(this.lastTokStart); }
|
|
11210
11383
|
else
|
|
@@ -11656,8 +11829,6 @@ pp$5.parseNew = function() {
|
|
|
11656
11829
|
}
|
|
11657
11830
|
var startPos = this.start, startLoc = this.startLoc;
|
|
11658
11831
|
node.callee = this.parseSubscripts(this.parseExprAtom(null, false, true), startPos, startLoc, true, false);
|
|
11659
|
-
if (node.callee.type === "Super")
|
|
11660
|
-
{ this.raiseRecoverable(startPos, "Invalid use of 'super'"); }
|
|
11661
11832
|
if (this.eat(types$1.parenL)) { node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); }
|
|
11662
11833
|
else { node.arguments = empty; }
|
|
11663
11834
|
return this.finishNode(node, "NewExpression")
|
|
@@ -12275,7 +12446,7 @@ pp$2.copyNode = function(node) {
|
|
|
12275
12446
|
};
|
|
12276
12447
|
|
|
12277
12448
|
// This file was generated by "bin/generate-unicode-script-values.js". Do not modify manually!
|
|
12278
|
-
var scriptValuesAddedInUnicode = "
|
|
12449
|
+
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";
|
|
12279
12450
|
|
|
12280
12451
|
// This file contains Unicode properties extracted from the ECMAScript specification.
|
|
12281
12452
|
// The lists are extracted like so:
|
|
@@ -13836,17 +14007,13 @@ pp.readToken = function(code) {
|
|
|
13836
14007
|
return this.getTokenFromCode(code)
|
|
13837
14008
|
};
|
|
13838
14009
|
|
|
13839
|
-
pp.
|
|
13840
|
-
var code = this.input.charCodeAt(pos);
|
|
14010
|
+
pp.fullCharCodeAtPos = function() {
|
|
14011
|
+
var code = this.input.charCodeAt(this.pos);
|
|
13841
14012
|
if (code <= 0xd7ff || code >= 0xdc00) { return code }
|
|
13842
|
-
var next = this.input.charCodeAt(pos + 1);
|
|
14013
|
+
var next = this.input.charCodeAt(this.pos + 1);
|
|
13843
14014
|
return next <= 0xdbff || next >= 0xe000 ? code : (code << 10) + next - 0x35fdc00
|
|
13844
14015
|
};
|
|
13845
14016
|
|
|
13846
|
-
pp.fullCharCodeAtPos = function() {
|
|
13847
|
-
return this.fullCharCodeAt(this.pos)
|
|
13848
|
-
};
|
|
13849
|
-
|
|
13850
14017
|
pp.skipBlockComment = function() {
|
|
13851
14018
|
var startLoc = this.options.onComment && this.curPosition();
|
|
13852
14019
|
var start = this.pos, end = this.input.indexOf("*/", this.pos += 2);
|
|
@@ -14574,7 +14741,7 @@ pp.readWord = function() {
|
|
|
14574
14741
|
// [ghbt]: https://github.com/acornjs/acorn/issues
|
|
14575
14742
|
|
|
14576
14743
|
|
|
14577
|
-
var version = "8.
|
|
14744
|
+
var version = "8.15.0";
|
|
14578
14745
|
|
|
14579
14746
|
Parser.acorn = {
|
|
14580
14747
|
Parser: Parser,
|