gyosjs 0.3.2 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +126 -126
- package/dist/core/router/diff-nodes.d.ts +2 -1
- package/dist/core/router/diff-nodes.d.ts.map +1 -1
- package/dist/core/router/router.d.ts +30 -2
- package/dist/core/router/router.d.ts.map +1 -1
- package/dist/gyos.auto.esm.js +297 -132
- package/dist/gyos.auto.esm.js.map +1 -1
- package/dist/gyos.auto.js +297 -132
- package/dist/gyos.auto.js.map +1 -1
- package/dist/gyos.auto.min.js +2 -2
- package/dist/gyos.csp.auto.esm.js +473 -228
- package/dist/gyos.csp.auto.esm.js.map +1 -1
- package/dist/gyos.csp.auto.js +473 -228
- package/dist/gyos.csp.auto.js.map +1 -1
- package/dist/gyos.csp.auto.min.js +2 -2
- package/dist/gyos.csp.esm.js +474 -229
- package/dist/gyos.csp.esm.js.map +1 -1
- package/dist/gyos.csp.js +475 -228
- package/dist/gyos.csp.js.map +1 -1
- package/dist/gyos.csp.min.js +2 -2
- package/dist/gyos.esm.js +298 -133
- package/dist/gyos.esm.js.map +1 -1
- package/dist/gyos.js +299 -132
- package/dist/gyos.js.map +1 -1
- package/dist/gyos.min.js +2 -2
- package/dist/public-api.d.ts +5 -2
- package/dist/public-api.d.ts.map +1 -1
- package/dist/utils/progress-bar.d.ts +1 -0
- package/dist/utils/progress-bar.d.ts.map +1 -1
- package/package.json +89 -89
package/dist/gyos.csp.auto.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* GyosJS v0.
|
|
2
|
+
* GyosJS v0.4.0
|
|
3
3
|
* (c) 2026
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
@@ -2202,59 +2202,59 @@
|
|
|
2202
2202
|
return;
|
|
2203
2203
|
const style = document.createElement('style');
|
|
2204
2204
|
style.id = styleId;
|
|
2205
|
-
style.textContent = `
|
|
2206
|
-
/* Opacity utilities */
|
|
2205
|
+
style.textContent = `
|
|
2206
|
+
/* Opacity utilities */
|
|
2207
2207
|
.gyos-t-opacity-0 { opacity: 0; }
|
|
2208
2208
|
.gyos-t-opacity-100 { opacity: 1; }
|
|
2209
|
-
|
|
2210
|
-
/* Transform - Translate Y */
|
|
2209
|
+
|
|
2210
|
+
/* Transform - Translate Y */
|
|
2211
2211
|
.gyos-t-translate-y-0 { transform: translateY(0); }
|
|
2212
2212
|
.gyos-t-translate-y--100 { transform: translateY(-100%); }
|
|
2213
2213
|
.gyos-t-translate-y-100 { transform: translateY(100%); }
|
|
2214
|
-
|
|
2215
|
-
/* Transform - Translate X */
|
|
2214
|
+
|
|
2215
|
+
/* Transform - Translate X */
|
|
2216
2216
|
.gyos-t-translate-x-0 { transform: translateX(0); }
|
|
2217
2217
|
.gyos-t-translate-x--100 { transform: translateX(-100%); }
|
|
2218
2218
|
.gyos-t-translate-x-100 { transform: translateX(100%); }
|
|
2219
|
-
|
|
2220
|
-
/* Transform - Scale */
|
|
2219
|
+
|
|
2220
|
+
/* Transform - Scale */
|
|
2221
2221
|
.gyos-t-scale-0 { transform: scale(0); }
|
|
2222
2222
|
.gyos-t-scale-50 { transform: scale(0.5); }
|
|
2223
2223
|
.gyos-t-scale-100 { transform: scale(1); }
|
|
2224
|
-
|
|
2225
|
-
/* Animation Keyframes */
|
|
2226
|
-
@keyframes gyos-fade-in {
|
|
2227
|
-
from { opacity: 0; }
|
|
2228
|
-
to { opacity: 1; }
|
|
2229
|
-
}
|
|
2230
|
-
|
|
2231
|
-
@keyframes gyos-fade-out {
|
|
2232
|
-
from { opacity: 1; }
|
|
2233
|
-
to { opacity: 0; }
|
|
2234
|
-
}
|
|
2235
|
-
|
|
2236
|
-
@keyframes gyos-slide-down {
|
|
2237
|
-
from { transform: translateY(-100%); opacity: 0; }
|
|
2238
|
-
to { transform: translateY(0); opacity: 1; }
|
|
2239
|
-
}
|
|
2240
|
-
|
|
2241
|
-
@keyframes gyos-slide-up {
|
|
2242
|
-
from { transform: translateY(100%); opacity: 0; }
|
|
2243
|
-
to { transform: translateY(0); opacity: 1; }
|
|
2244
|
-
}
|
|
2245
|
-
|
|
2246
|
-
@keyframes gyos-scale-in {
|
|
2247
|
-
from { transform: scale(0); opacity: 0; }
|
|
2248
|
-
to { transform: scale(1); opacity: 1; }
|
|
2249
|
-
}
|
|
2250
|
-
|
|
2251
|
-
@keyframes gyos-scale-out {
|
|
2252
|
-
from { transform: scale(1); opacity: 1; }
|
|
2253
|
-
to { transform: scale(0); opacity: 0; }
|
|
2254
|
-
}
|
|
2255
|
-
|
|
2256
|
-
[g-cloak] {
|
|
2257
|
-
display: none !important;
|
|
2224
|
+
|
|
2225
|
+
/* Animation Keyframes */
|
|
2226
|
+
@keyframes gyos-fade-in {
|
|
2227
|
+
from { opacity: 0; }
|
|
2228
|
+
to { opacity: 1; }
|
|
2229
|
+
}
|
|
2230
|
+
|
|
2231
|
+
@keyframes gyos-fade-out {
|
|
2232
|
+
from { opacity: 1; }
|
|
2233
|
+
to { opacity: 0; }
|
|
2234
|
+
}
|
|
2235
|
+
|
|
2236
|
+
@keyframes gyos-slide-down {
|
|
2237
|
+
from { transform: translateY(-100%); opacity: 0; }
|
|
2238
|
+
to { transform: translateY(0); opacity: 1; }
|
|
2239
|
+
}
|
|
2240
|
+
|
|
2241
|
+
@keyframes gyos-slide-up {
|
|
2242
|
+
from { transform: translateY(100%); opacity: 0; }
|
|
2243
|
+
to { transform: translateY(0); opacity: 1; }
|
|
2244
|
+
}
|
|
2245
|
+
|
|
2246
|
+
@keyframes gyos-scale-in {
|
|
2247
|
+
from { transform: scale(0); opacity: 0; }
|
|
2248
|
+
to { transform: scale(1); opacity: 1; }
|
|
2249
|
+
}
|
|
2250
|
+
|
|
2251
|
+
@keyframes gyos-scale-out {
|
|
2252
|
+
from { transform: scale(1); opacity: 1; }
|
|
2253
|
+
to { transform: scale(0); opacity: 0; }
|
|
2254
|
+
}
|
|
2255
|
+
|
|
2256
|
+
[g-cloak] {
|
|
2257
|
+
display: none !important;
|
|
2258
2258
|
}`;
|
|
2259
2259
|
document.head.appendChild(style);
|
|
2260
2260
|
}
|
|
@@ -6611,33 +6611,44 @@
|
|
|
6611
6611
|
getCurrentProgress() {
|
|
6612
6612
|
return this.currentProgress;
|
|
6613
6613
|
}
|
|
6614
|
+
reconnect() {
|
|
6615
|
+
if (!this.element || !this.progressBarEnabled || !document.body)
|
|
6616
|
+
return;
|
|
6617
|
+
// Snapshots may contain a clone of the runtime bar. Keep this instance.
|
|
6618
|
+
document.querySelectorAll('#gyos-progress-bar').forEach(node => {
|
|
6619
|
+
if (node !== this.element)
|
|
6620
|
+
node.remove();
|
|
6621
|
+
});
|
|
6622
|
+
if (!this.element.isConnected)
|
|
6623
|
+
document.body.appendChild(this.element);
|
|
6624
|
+
}
|
|
6614
6625
|
createBar() {
|
|
6615
6626
|
if (typeof document === 'undefined')
|
|
6616
6627
|
return;
|
|
6617
6628
|
// Create progress bar element
|
|
6618
6629
|
this.element = document.createElement('div');
|
|
6619
6630
|
this.element.id = 'gyos-progress-bar';
|
|
6620
|
-
this.element.style.cssText = `
|
|
6621
|
-
position: fixed;
|
|
6622
|
-
top: 0;
|
|
6623
|
-
left: 0;
|
|
6624
|
-
width: 0%;
|
|
6625
|
-
height: 6px;
|
|
6626
|
-
background: var(--gyos-progress-color, linear-gradient(90deg, #aab9ff, #77889f));
|
|
6627
|
-
z-index: 999999;
|
|
6628
|
-
transition: width 0.3s linear, opacity 0.3s linear;
|
|
6629
|
-
opacity: 0;
|
|
6630
|
-
pointer-events: none;
|
|
6631
|
-
box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
|
|
6631
|
+
this.element.style.cssText = `
|
|
6632
|
+
position: fixed;
|
|
6633
|
+
top: 0;
|
|
6634
|
+
left: 0;
|
|
6635
|
+
width: 0%;
|
|
6636
|
+
height: 6px;
|
|
6637
|
+
background: var(--gyos-progress-color, linear-gradient(90deg, #aab9ff, #77889f));
|
|
6638
|
+
z-index: 999999;
|
|
6639
|
+
transition: width 0.3s linear, opacity 0.3s linear;
|
|
6640
|
+
opacity: 0;
|
|
6641
|
+
pointer-events: none;
|
|
6642
|
+
box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
|
|
6632
6643
|
`;
|
|
6633
6644
|
// Insert into DOM when ready
|
|
6634
6645
|
if (document.readyState === 'loading') {
|
|
6635
6646
|
document.addEventListener('DOMContentLoaded', () => {
|
|
6636
|
-
|
|
6637
|
-
});
|
|
6647
|
+
this.reconnect();
|
|
6648
|
+
}, { once: true });
|
|
6638
6649
|
}
|
|
6639
6650
|
else {
|
|
6640
|
-
|
|
6651
|
+
this.reconnect();
|
|
6641
6652
|
}
|
|
6642
6653
|
}
|
|
6643
6654
|
start() {
|
|
@@ -6661,6 +6672,7 @@
|
|
|
6661
6672
|
setProgress(percent) {
|
|
6662
6673
|
if (!this.element || !this.progressBarEnabled)
|
|
6663
6674
|
return;
|
|
6675
|
+
this.reconnect();
|
|
6664
6676
|
// Clamp between 0-100
|
|
6665
6677
|
percent = Math.min(100, Math.max(0, percent));
|
|
6666
6678
|
this.currentProgress = percent;
|
|
@@ -6709,41 +6721,41 @@
|
|
|
6709
6721
|
function createTargetSpinner() {
|
|
6710
6722
|
const spinner = document.createElement('div');
|
|
6711
6723
|
spinner.className = 'gyos-target-spinner';
|
|
6712
|
-
spinner.innerHTML = `
|
|
6713
|
-
<div class="gyos-spinner-content">
|
|
6714
|
-
<svg class="gyos-spinner-icon" viewBox="0 0 50 50">
|
|
6715
|
-
<circle cx="25" cy="25" r="20" fill="none" stroke="currentColor" stroke-width="4" stroke-dasharray="31.4 31.4" />
|
|
6716
|
-
</svg>
|
|
6717
|
-
</div>
|
|
6724
|
+
spinner.innerHTML = `
|
|
6725
|
+
<div class="gyos-spinner-content">
|
|
6726
|
+
<svg class="gyos-spinner-icon" viewBox="0 0 50 50">
|
|
6727
|
+
<circle cx="25" cy="25" r="20" fill="none" stroke="currentColor" stroke-width="4" stroke-dasharray="31.4 31.4" />
|
|
6728
|
+
</svg>
|
|
6729
|
+
</div>
|
|
6718
6730
|
`;
|
|
6719
6731
|
// Inject styles if not already present
|
|
6720
6732
|
if (expressionRuntimeMode() === 'standard' && !document.getElementById('gyos-target-spinner-styles')) {
|
|
6721
6733
|
const style = document.createElement('style');
|
|
6722
6734
|
style.id = 'gyos-target-spinner-styles';
|
|
6723
|
-
style.textContent = `
|
|
6724
|
-
.gyos-target-spinner {
|
|
6725
|
-
display: flex;
|
|
6726
|
-
align-items: center;
|
|
6727
|
-
justify-content: center;
|
|
6728
|
-
padding: 20px;
|
|
6729
|
-
min-height: 60px;
|
|
6730
|
-
}
|
|
6731
|
-
.gyos-spinner-content {
|
|
6732
|
-
display: flex;
|
|
6733
|
-
align-items: center;
|
|
6734
|
-
gap: 10px;
|
|
6735
|
-
color: var(--gyos-spinner-color, #667eea);
|
|
6736
|
-
font-size: 14px;
|
|
6737
|
-
}
|
|
6738
|
-
.gyos-spinner-icon {
|
|
6739
|
-
width: 24px;
|
|
6740
|
-
height: 24px;
|
|
6741
|
-
animation: gyos-spin 1s linear infinite;
|
|
6742
|
-
}
|
|
6743
|
-
@keyframes gyos-spin {
|
|
6744
|
-
0% { transform: rotate(0deg); }
|
|
6745
|
-
100% { transform: rotate(360deg); }
|
|
6746
|
-
}
|
|
6735
|
+
style.textContent = `
|
|
6736
|
+
.gyos-target-spinner {
|
|
6737
|
+
display: flex;
|
|
6738
|
+
align-items: center;
|
|
6739
|
+
justify-content: center;
|
|
6740
|
+
padding: 20px;
|
|
6741
|
+
min-height: 60px;
|
|
6742
|
+
}
|
|
6743
|
+
.gyos-spinner-content {
|
|
6744
|
+
display: flex;
|
|
6745
|
+
align-items: center;
|
|
6746
|
+
gap: 10px;
|
|
6747
|
+
color: var(--gyos-spinner-color, #667eea);
|
|
6748
|
+
font-size: 14px;
|
|
6749
|
+
}
|
|
6750
|
+
.gyos-spinner-icon {
|
|
6751
|
+
width: 24px;
|
|
6752
|
+
height: 24px;
|
|
6753
|
+
animation: gyos-spin 1s linear infinite;
|
|
6754
|
+
}
|
|
6755
|
+
@keyframes gyos-spin {
|
|
6756
|
+
0% { transform: rotate(0deg); }
|
|
6757
|
+
100% { transform: rotate(360deg); }
|
|
6758
|
+
}
|
|
6747
6759
|
`;
|
|
6748
6760
|
document.head.appendChild(style);
|
|
6749
6761
|
}
|
|
@@ -7117,8 +7129,8 @@
|
|
|
7117
7129
|
}
|
|
7118
7130
|
result = target;
|
|
7119
7131
|
}
|
|
7120
|
-
await options.beforeScripts?.();
|
|
7121
7132
|
options.onCommitted?.(result, normalized === 'append' || normalized === 'prepend' ? incomingChildren : [result]);
|
|
7133
|
+
await options.beforeScripts?.();
|
|
7122
7134
|
// Additive swaps must not re-run scripts that already existed in the target.
|
|
7123
7135
|
if (normalized === 'append' || normalized === 'prepend') {
|
|
7124
7136
|
await executeScriptsInNodes(incomingChildren, options.signal);
|
|
@@ -7358,6 +7370,21 @@
|
|
|
7358
7370
|
window.scrollTo({ top: 0, behavior: 'smooth' });
|
|
7359
7371
|
}
|
|
7360
7372
|
|
|
7373
|
+
// A retained relative URL still identifies the resource loaded on its original
|
|
7374
|
+
// page, even after pushState changes document.baseURI.
|
|
7375
|
+
const resourceUrls = new WeakMap();
|
|
7376
|
+
function rememberResourceUrls(root, baseUrl) {
|
|
7377
|
+
root.querySelectorAll('script[src], link[href]').forEach(node => {
|
|
7378
|
+
const attribute = node.tagName === 'SCRIPT' ? 'src' : 'href';
|
|
7379
|
+
const source = node.getAttribute(attribute);
|
|
7380
|
+
if (resourceUrls.get(node)?.source === source)
|
|
7381
|
+
return;
|
|
7382
|
+
try {
|
|
7383
|
+
resourceUrls.set(node, { source, url: new URL(source, baseUrl).href });
|
|
7384
|
+
}
|
|
7385
|
+
catch { /* Invalid resource URLs retain their literal identity. */ }
|
|
7386
|
+
});
|
|
7387
|
+
}
|
|
7361
7388
|
function isNonceMeta(el) {
|
|
7362
7389
|
return el.tagName === 'META' && el.getAttribute('name')?.toLowerCase() === 'csp-nonce';
|
|
7363
7390
|
}
|
|
@@ -7375,7 +7402,20 @@
|
|
|
7375
7402
|
return;
|
|
7376
7403
|
if (context.csp && isNonceMeta(el) && attr.name.toLowerCase() === 'content')
|
|
7377
7404
|
return;
|
|
7378
|
-
|
|
7405
|
+
let value = attr.value;
|
|
7406
|
+
if ((el.tagName === 'SCRIPT' && attr.name === 'src') || (el.tagName === 'LINK' && attr.name === 'href')) {
|
|
7407
|
+
const cached = resourceUrls.get(el);
|
|
7408
|
+
if (cached?.source === value)
|
|
7409
|
+
value = cached.url;
|
|
7410
|
+
else {
|
|
7411
|
+
try {
|
|
7412
|
+
value = new URL(value, context.baseUrl || el.baseURI).href;
|
|
7413
|
+
resourceUrls.set(el, { source: attr.value, url: value });
|
|
7414
|
+
}
|
|
7415
|
+
catch { /* Keep invalid URLs distinct. */ }
|
|
7416
|
+
}
|
|
7417
|
+
}
|
|
7418
|
+
attributes.set(attr.name, value);
|
|
7379
7419
|
});
|
|
7380
7420
|
if (context.csp && usesCspNonce(el) && context.activeNonce) {
|
|
7381
7421
|
attributes.set('nonce', context.activeNonce);
|
|
@@ -7442,19 +7482,21 @@
|
|
|
7442
7482
|
console.warn('[GyosJS CSP] Skipped an inline MPA script because no active document nonce is configured.');
|
|
7443
7483
|
}
|
|
7444
7484
|
}
|
|
7445
|
-
async function diffNodes(currentNodes, nextNodes, container = document.head, signal) {
|
|
7485
|
+
async function diffNodes(currentNodes, nextNodes, container = document.head, signal, currentBaseUrl = document.baseURI) {
|
|
7446
7486
|
const csp = expressionRuntimeMode() === 'csp';
|
|
7447
7487
|
const context = {
|
|
7448
7488
|
csp,
|
|
7449
7489
|
activeNonce: csp ? resolveCspNonce() : undefined
|
|
7450
7490
|
};
|
|
7451
|
-
const current = keyedNodes(currentNodes, context);
|
|
7491
|
+
const current = keyedNodes(currentNodes, { ...context, baseUrl: currentBaseUrl });
|
|
7452
7492
|
const next = keyedNodes(nextNodes, context);
|
|
7493
|
+
const persistentKey = (node) => container === document.head ? node.getAttribute('g-head-persist') : null;
|
|
7494
|
+
const persistent = new Set(currentNodes.map(persistentKey).filter(Boolean));
|
|
7453
7495
|
const currentKeys = new Set(current.map(item => item.key));
|
|
7454
7496
|
const nextKeys = new Set(next.map(item => item.key));
|
|
7455
7497
|
// Remove nodes that are not in the new head
|
|
7456
7498
|
current.forEach(({ key, node }) => {
|
|
7457
|
-
if (!nextKeys.has(key)) {
|
|
7499
|
+
if (!nextKeys.has(key) && !persistentKey(node)) {
|
|
7458
7500
|
node.remove();
|
|
7459
7501
|
}
|
|
7460
7502
|
});
|
|
@@ -7462,6 +7504,8 @@
|
|
|
7462
7504
|
for (const { key, node } of next) {
|
|
7463
7505
|
if (signal?.aborted)
|
|
7464
7506
|
return;
|
|
7507
|
+
if (persistent.has(persistentKey(node)))
|
|
7508
|
+
continue;
|
|
7465
7509
|
if (!currentKeys.has(key)) {
|
|
7466
7510
|
if (!canInsertNode(node, context)) {
|
|
7467
7511
|
warnSkippedNode(node);
|
|
@@ -7664,6 +7708,7 @@
|
|
|
7664
7708
|
* MPA boost navigation inspired by Turbo Drive.
|
|
7665
7709
|
* Implements attribute-driven routing, snapshot caching, and persistent islands.
|
|
7666
7710
|
*/
|
|
7711
|
+
const submittingForms = new WeakSet();
|
|
7667
7712
|
const snapshots = new Map();
|
|
7668
7713
|
const preloadCache = new Map();
|
|
7669
7714
|
const preloadControllers = new Map();
|
|
@@ -7680,12 +7725,30 @@
|
|
|
7680
7725
|
let progressBar = null;
|
|
7681
7726
|
const beforeNavigate = [];
|
|
7682
7727
|
const afterNavigate = [];
|
|
7728
|
+
const beforeSwap = [];
|
|
7729
|
+
const navigationEnd = [];
|
|
7730
|
+
function registerNavigationHook(hooks, callback) {
|
|
7731
|
+
// A wrapper gives each registration its own unsubscribe identity.
|
|
7732
|
+
const entry = (url, context) => callback(url, context);
|
|
7733
|
+
hooks.push(entry);
|
|
7734
|
+
return () => {
|
|
7735
|
+
const index = hooks.indexOf(entry);
|
|
7736
|
+
if (index !== -1)
|
|
7737
|
+
hooks.splice(index, 1);
|
|
7738
|
+
};
|
|
7739
|
+
}
|
|
7683
7740
|
// Expose hooks to register before/after navigation callbacks
|
|
7684
7741
|
function onBeforeNavigate(callback) {
|
|
7685
|
-
beforeNavigate
|
|
7742
|
+
return registerNavigationHook(beforeNavigate, callback);
|
|
7686
7743
|
}
|
|
7687
7744
|
function onAfterNavigate(callback) {
|
|
7688
|
-
afterNavigate
|
|
7745
|
+
return registerNavigationHook(afterNavigate, callback);
|
|
7746
|
+
}
|
|
7747
|
+
function onBeforeSwap(callback) {
|
|
7748
|
+
return registerNavigationHook(beforeSwap, callback);
|
|
7749
|
+
}
|
|
7750
|
+
function onNavigationEnd(callback) {
|
|
7751
|
+
return registerNavigationHook(navigationEnd, (_url, context) => callback(context));
|
|
7689
7752
|
}
|
|
7690
7753
|
function startRouter(options) {
|
|
7691
7754
|
// If not has g-boost attribute, do not start router
|
|
@@ -7709,6 +7772,7 @@
|
|
|
7709
7772
|
}
|
|
7710
7773
|
// Cache scripts from initial page to prevent re-execution on first navigation back
|
|
7711
7774
|
cacheInitialPageScripts();
|
|
7775
|
+
rememberResourceUrls(document, document.baseURI);
|
|
7712
7776
|
routerStarted = true;
|
|
7713
7777
|
log('[GyosRouter] started');
|
|
7714
7778
|
}
|
|
@@ -7765,9 +7829,13 @@
|
|
|
7765
7829
|
const outlet = findGlobalOutlet();
|
|
7766
7830
|
return outlet instanceof HTMLElement ? outlet : null;
|
|
7767
7831
|
}
|
|
7832
|
+
function isFullDocument(html) {
|
|
7833
|
+
return /^\s*(?:<!--[^]*?-->\s*)*(?:<!doctype\s+html\b|<html(?:\s|>))/i.test(html);
|
|
7834
|
+
}
|
|
7768
7835
|
function saveSnapshot(url, html) {
|
|
7769
7836
|
// create HTMLElement by html string to remove scripts and get clean snapshot
|
|
7770
7837
|
const doc = parseNavigationDocument(html);
|
|
7838
|
+
doc.querySelectorAll('#gyos-progress-bar').forEach(node => node.remove());
|
|
7771
7839
|
// Ignore hash for snapshot keys
|
|
7772
7840
|
if (url.includes('#'))
|
|
7773
7841
|
url = url.split('#')[0];
|
|
@@ -7776,7 +7844,7 @@
|
|
|
7776
7844
|
if (s.hasAttribute('g-script-once'))
|
|
7777
7845
|
s.textContent = '';
|
|
7778
7846
|
});
|
|
7779
|
-
snapshots.set(url, { html: doc.documentElement.outerHTML });
|
|
7847
|
+
snapshots.set(url, { html: doc.documentElement.outerHTML, fullDocument: isFullDocument(html) });
|
|
7780
7848
|
log('[GyosRouter] snapshot saved for', url);
|
|
7781
7849
|
}
|
|
7782
7850
|
function getOutletIndex(root, target) {
|
|
@@ -7888,10 +7956,10 @@
|
|
|
7888
7956
|
// update callback remains the navigation source of truth and is awaited below.
|
|
7889
7957
|
void promise?.catch(() => undefined);
|
|
7890
7958
|
}
|
|
7891
|
-
function runNavigationHooks(callbacks, url) {
|
|
7892
|
-
callbacks.forEach(callback => {
|
|
7959
|
+
function runNavigationHooks(callbacks, url, context) {
|
|
7960
|
+
[...callbacks].forEach(callback => {
|
|
7893
7961
|
try {
|
|
7894
|
-
callback(url);
|
|
7962
|
+
callback(url, { ...context });
|
|
7895
7963
|
}
|
|
7896
7964
|
catch (error) {
|
|
7897
7965
|
console.error('[GyosRouter] navigation hook error', error);
|
|
@@ -7929,7 +7997,13 @@
|
|
|
7929
7997
|
url = mergeFormDataIntoUrl(url, opts.formData);
|
|
7930
7998
|
}
|
|
7931
7999
|
else {
|
|
7932
|
-
|
|
8000
|
+
if (opts.formEncoding === 'application/x-www-form-urlencoded') {
|
|
8001
|
+
const encoded = new URLSearchParams();
|
|
8002
|
+
opts.formData.forEach((value, name) => encoded.append(name, typeof value === 'string' ? value : value.name));
|
|
8003
|
+
init.body = encoded;
|
|
8004
|
+
}
|
|
8005
|
+
else
|
|
8006
|
+
init.body = opts.formData;
|
|
7933
8007
|
}
|
|
7934
8008
|
}
|
|
7935
8009
|
else if (opts.jsonData) {
|
|
@@ -7972,25 +8046,26 @@
|
|
|
7972
8046
|
preloadControllers.delete(cacheKey);
|
|
7973
8047
|
});
|
|
7974
8048
|
}
|
|
7975
|
-
async function updateHead(fromDoc, signal) {
|
|
8049
|
+
async function updateHead(fromDoc, signal, currentBaseUrl) {
|
|
7976
8050
|
const allowedSelector = 'meta, link, style:not(#gyos-transitions), script';
|
|
7977
8051
|
const currentNodes = Array.from(document.head.querySelectorAll(allowedSelector));
|
|
7978
8052
|
const nextNodes = Array.from(fromDoc.head.querySelectorAll(allowedSelector));
|
|
7979
|
-
await diffNodes(currentNodes, nextNodes, document.head, signal);
|
|
8053
|
+
await diffNodes(currentNodes, nextNodes, document.head, signal, currentBaseUrl);
|
|
7980
8054
|
}
|
|
7981
|
-
async function scriptNotInOutletTarget(fromDoc, target, source, signal) {
|
|
8055
|
+
async function scriptNotInOutletTarget(fromDoc, target, source, signal, currentBaseUrl) {
|
|
7982
8056
|
// scripts in current document and it not in target outlet
|
|
7983
8057
|
const currentScripts = Array.from(document.scripts).filter(s => !target.contains(s) && !document.head.contains(s));
|
|
7984
8058
|
// scripts in fromDoc and it not in source outlet
|
|
7985
8059
|
const incomingScripts = Array.from(fromDoc.scripts).filter(s => !source.contains(s) && !fromDoc.head.contains(s));
|
|
7986
8060
|
// Diff and update scripts not in outlet/target
|
|
7987
|
-
await diffNodes(currentScripts, incomingScripts, document.body, signal);
|
|
8061
|
+
await diffNodes(currentScripts, incomingScripts, document.body, signal, currentBaseUrl);
|
|
7988
8062
|
}
|
|
7989
8063
|
function resolveIncomingScriptUrls(root, baseUrl) {
|
|
7990
|
-
root.querySelectorAll('script[src]').forEach(
|
|
7991
|
-
const
|
|
8064
|
+
root.querySelectorAll('script[src], link[href]').forEach(node => {
|
|
8065
|
+
const attribute = node.tagName === 'SCRIPT' ? 'src' : 'href';
|
|
8066
|
+
const source = node.getAttribute(attribute);
|
|
7992
8067
|
if (source)
|
|
7993
|
-
|
|
8068
|
+
node.setAttribute(attribute, new URL(source, baseUrl).href);
|
|
7994
8069
|
});
|
|
7995
8070
|
}
|
|
7996
8071
|
function isNavigableHtmlResponse(response) {
|
|
@@ -8044,6 +8119,22 @@
|
|
|
8044
8119
|
resolveDone
|
|
8045
8120
|
};
|
|
8046
8121
|
activeNavigation = transaction;
|
|
8122
|
+
const currentBaseUrl = document.baseURI;
|
|
8123
|
+
rememberResourceUrls(document, currentBaseUrl);
|
|
8124
|
+
const context = {
|
|
8125
|
+
from: currentUrl, url: opts.url, method: opts.method.toUpperCase(),
|
|
8126
|
+
trigger: opts.trigger || null, target: null, form: opts.form || null,
|
|
8127
|
+
popstate: opts.popstate === true, signal: transaction.controller.signal,
|
|
8128
|
+
status: null, committed: false, fallback: false, outcome: null
|
|
8129
|
+
};
|
|
8130
|
+
const formEvent = opts.form
|
|
8131
|
+
? { form: opts.form, url: opts.url, status: null, outcome: null, committed: false, fallback: false }
|
|
8132
|
+
: null;
|
|
8133
|
+
const fallback = (url, requestSent) => {
|
|
8134
|
+
context.fallback = context.method === 'GET' || (!requestSent && !!opts.form);
|
|
8135
|
+
context.outcome ?? (context.outcome = context.fallback ? 'fallback' : 'invalid-response');
|
|
8136
|
+
fallbackFromBoost(opts, url, requestSent);
|
|
8137
|
+
};
|
|
8047
8138
|
const hasTargetSpinner = opts.trigger?.hasAttribute('g-router-spin');
|
|
8048
8139
|
const setRand = () => {
|
|
8049
8140
|
if (isActiveNavigation(transaction) && progressBar?.getCurrentProgress() < 70) {
|
|
@@ -8051,7 +8142,10 @@
|
|
|
8051
8142
|
}
|
|
8052
8143
|
};
|
|
8053
8144
|
try {
|
|
8054
|
-
|
|
8145
|
+
if (formEvent)
|
|
8146
|
+
document.dispatchEvent(new CustomEvent('gyos:form-start', { detail: { ...formEvent } }));
|
|
8147
|
+
runNavigationHooks(beforeNavigate, opts.url, context);
|
|
8148
|
+
assertActiveNavigation(transaction);
|
|
8055
8149
|
progressBar?.start();
|
|
8056
8150
|
// popstate already points history at the destination entry. Keep the visible
|
|
8057
8151
|
// page's position under currentUrl without overwriting that destination state.
|
|
@@ -8060,9 +8154,10 @@
|
|
|
8060
8154
|
saveScrollPosition();
|
|
8061
8155
|
// Pick target element to swap
|
|
8062
8156
|
let target = resolveTarget(opts.trigger, opts.targetSelector, opts.targetOutletIndex);
|
|
8157
|
+
context.target = target;
|
|
8063
8158
|
if (!target) {
|
|
8064
8159
|
if (isActiveNavigation(transaction))
|
|
8065
|
-
|
|
8160
|
+
fallback(opts.url, false);
|
|
8066
8161
|
return;
|
|
8067
8162
|
}
|
|
8068
8163
|
const swapMode = (opts.swapMode || opts.trigger?.getAttribute('g-swap') || 'inner').toLowerCase();
|
|
@@ -8087,6 +8182,7 @@
|
|
|
8087
8182
|
if (hasTargetSpinner)
|
|
8088
8183
|
transaction.spinner = showTargetSpinner(target, swapMode);
|
|
8089
8184
|
const { finalUrl, init } = buildRequest(opts);
|
|
8185
|
+
context.url = finalUrl;
|
|
8090
8186
|
// Add abort signal to request
|
|
8091
8187
|
init.signal = transaction.controller.signal;
|
|
8092
8188
|
let html;
|
|
@@ -8114,7 +8210,8 @@
|
|
|
8114
8210
|
if (error.name === 'AbortError')
|
|
8115
8211
|
throw error;
|
|
8116
8212
|
assertActiveNavigation(transaction);
|
|
8117
|
-
|
|
8213
|
+
context.outcome = 'network-error';
|
|
8214
|
+
fallback(finalUrl, true);
|
|
8118
8215
|
return;
|
|
8119
8216
|
}
|
|
8120
8217
|
preloadCache.delete(preloadKey); // consume cache
|
|
@@ -8139,28 +8236,46 @@
|
|
|
8139
8236
|
log('[GyosRouter] Navigation cancelled');
|
|
8140
8237
|
return;
|
|
8141
8238
|
}
|
|
8239
|
+
context.outcome = 'network-error';
|
|
8142
8240
|
if (isActiveNavigation(transaction))
|
|
8143
|
-
|
|
8241
|
+
fallback(finalUrl, true);
|
|
8144
8242
|
return;
|
|
8145
8243
|
}
|
|
8146
8244
|
}
|
|
8147
8245
|
assertActiveNavigation(transaction);
|
|
8148
|
-
|
|
8149
|
-
|
|
8246
|
+
context.status = response?.status ?? null;
|
|
8247
|
+
context.url = response?.url || finalUrl;
|
|
8248
|
+
const acceptedErrors = (opts.trigger?.getAttribute('g-boost-errors') || '').split(/[\s,]+/);
|
|
8249
|
+
const renderHttpError = !!response && response.status >= 400 && response.status <= 599
|
|
8250
|
+
&& acceptedErrors.includes(String(response.status));
|
|
8251
|
+
if (response && !response.ok)
|
|
8252
|
+
context.outcome = 'http-error';
|
|
8253
|
+
if (!response || (!response.ok && !renderHttpError) || !isNavigableHtmlResponse(response)) {
|
|
8254
|
+
context.outcome ?? (context.outcome = 'invalid-response');
|
|
8150
8255
|
if (isActiveNavigation(transaction))
|
|
8151
|
-
|
|
8256
|
+
fallback(finalUrl, true);
|
|
8152
8257
|
return;
|
|
8153
8258
|
}
|
|
8154
8259
|
html = await response.text();
|
|
8155
8260
|
assertActiveNavigation(transaction);
|
|
8156
|
-
if (!opts.popstate && target.hasAttribute('g-snapshot')) {
|
|
8157
|
-
saveSnapshot(canonicalUrl(response.url || finalUrl), html);
|
|
8158
|
-
}
|
|
8159
8261
|
}
|
|
8160
8262
|
// Parse HTML
|
|
8161
8263
|
const doc = html
|
|
8162
8264
|
? parseNavigationDocument(html)
|
|
8163
8265
|
: document.implementation.createHTMLDocument();
|
|
8266
|
+
// Detached parsing cannot tell whether the live CSP permits an incoming base.
|
|
8267
|
+
// Let native navigation enforce base-uri instead of authorizing its URLs ourselves.
|
|
8268
|
+
if (doc.querySelector('base[href]') || opts.historyFragment?.querySelector('base[href]')) {
|
|
8269
|
+
context.outcome = 'invalid-response';
|
|
8270
|
+
fallback(response?.url || finalUrl, true);
|
|
8271
|
+
return;
|
|
8272
|
+
}
|
|
8273
|
+
if (response?.ok && !opts.popstate && target.hasAttribute('g-snapshot')) {
|
|
8274
|
+
saveSnapshot(canonicalUrl(response.url || finalUrl), html);
|
|
8275
|
+
}
|
|
8276
|
+
const syncDocumentAttributes = isFullOutletNavigation && destructiveSwap && !currentHead
|
|
8277
|
+
&& !opts.historyFragment && (opts.popstate && snapshots.has(urlWithoutHash)
|
|
8278
|
+
? snapshots.get(urlWithoutHash).fullDocument : isFullDocument(html || ''));
|
|
8164
8279
|
// Pick source fragment
|
|
8165
8280
|
const src = opts.historyFragment || pickSourceFragment(doc, target, targetOutletIndex);
|
|
8166
8281
|
stripInertFallbackContent(src);
|
|
@@ -8172,15 +8287,18 @@
|
|
|
8172
8287
|
targetUrl += finalUrl.substring(finalUrl.indexOf('#'));
|
|
8173
8288
|
}
|
|
8174
8289
|
resolveIncomingScriptUrls(doc, targetUrl);
|
|
8290
|
+
context.url = targetUrl;
|
|
8175
8291
|
if (opts.historyFragment)
|
|
8176
8292
|
resolveIncomingScriptUrls(src, targetUrl);
|
|
8177
8293
|
const triggerChangesState = opts.trigger?.hasAttribute('g-change-state') || false;
|
|
8178
8294
|
const keepsCurrentState = opts.trigger?.hasAttribute('g-current-state') || false;
|
|
8179
8295
|
const redirectedSubmission = opts.method.toUpperCase() !== 'GET' && response?.redirected === true;
|
|
8180
|
-
const changesState = !keepsCurrentState && (opts.changeState === true || triggerChangesState || redirectedSubmission);
|
|
8296
|
+
const changesState = context.outcome !== 'http-error' && !keepsCurrentState && (opts.changeState === true || triggerChangesState || redirectedSubmission);
|
|
8181
8297
|
const performUpdate = async () => {
|
|
8182
8298
|
assertActiveNavigation(transaction);
|
|
8183
8299
|
transaction.committing = true;
|
|
8300
|
+
runNavigationHooks(beforeSwap, targetUrl, context);
|
|
8301
|
+
assertActiveNavigation(transaction);
|
|
8184
8302
|
// Update progress to rand 80 - 90% before swap
|
|
8185
8303
|
progressBar?.setProgress(Math.random() * 10 + 80);
|
|
8186
8304
|
const outgoingHistoryFragment = changesState && !opts.replace && !isFullOutletNavigation
|
|
@@ -8251,21 +8369,34 @@
|
|
|
8251
8369
|
beforeScripts: async () => {
|
|
8252
8370
|
if (!isFullOutletNavigation || currentHead)
|
|
8253
8371
|
return;
|
|
8372
|
+
if (syncDocumentAttributes) {
|
|
8373
|
+
for (const name of ['lang', 'dir']) {
|
|
8374
|
+
const value = doc.documentElement.getAttribute(name);
|
|
8375
|
+
if (value === null)
|
|
8376
|
+
document.documentElement.removeAttribute(name);
|
|
8377
|
+
else
|
|
8378
|
+
document.documentElement.setAttribute(name, value);
|
|
8379
|
+
}
|
|
8380
|
+
}
|
|
8254
8381
|
const incomingTitle = doc.querySelector('title');
|
|
8255
8382
|
if (incomingTitle) {
|
|
8256
8383
|
document.title = incomingTitle.textContent || document.title;
|
|
8257
8384
|
}
|
|
8258
|
-
await updateHead(doc, transaction.controller.signal);
|
|
8385
|
+
await updateHead(doc, transaction.controller.signal, currentBaseUrl);
|
|
8259
8386
|
assertActiveNavigation(transaction);
|
|
8260
8387
|
},
|
|
8261
8388
|
onCommitted: (committedTarget, roots) => {
|
|
8262
8389
|
target = committedTarget;
|
|
8390
|
+
context.target = committedTarget;
|
|
8391
|
+
context.committed = true;
|
|
8392
|
+
progressBar?.reconnect();
|
|
8263
8393
|
committedRoots = roots;
|
|
8264
8394
|
}
|
|
8265
8395
|
});
|
|
8396
|
+
context.committed = true;
|
|
8266
8397
|
assertActiveNavigation(transaction);
|
|
8267
8398
|
if (isFullOutletNavigation) {
|
|
8268
|
-
await scriptNotInOutletTarget(doc, target, src, transaction.controller.signal);
|
|
8399
|
+
await scriptNotInOutletTarget(doc, target, src, transaction.controller.signal, currentBaseUrl);
|
|
8269
8400
|
assertActiveNavigation(transaction);
|
|
8270
8401
|
}
|
|
8271
8402
|
}
|
|
@@ -8299,14 +8430,15 @@
|
|
|
8299
8430
|
await performUpdate();
|
|
8300
8431
|
}
|
|
8301
8432
|
assertActiveNavigation(transaction);
|
|
8302
|
-
if (removeTriggerAfterCommit && opts.trigger instanceof HTMLElement && opts.trigger.isConnected) {
|
|
8433
|
+
if (removeTriggerAfterCommit && context.outcome !== 'http-error' && opts.trigger instanceof HTMLElement && opts.trigger.isConnected) {
|
|
8303
8434
|
disposeEffects(opts.trigger);
|
|
8304
8435
|
opts.trigger.remove();
|
|
8305
8436
|
}
|
|
8306
8437
|
if (hasTargetSpinner)
|
|
8307
8438
|
hideTargetSpinner(transaction.spinner);
|
|
8308
8439
|
transaction.spinner = null;
|
|
8309
|
-
|
|
8440
|
+
context.outcome ?? (context.outcome = 'success');
|
|
8441
|
+
runNavigationHooks(afterNavigate, targetUrl, context);
|
|
8310
8442
|
log('[GyosRouter] navigated to', targetUrl);
|
|
8311
8443
|
currentUrl = changesState
|
|
8312
8444
|
? canonicalUrl(targetUrl, true)
|
|
@@ -8322,11 +8454,15 @@
|
|
|
8322
8454
|
return;
|
|
8323
8455
|
}
|
|
8324
8456
|
if (isActiveNavigation(transaction)) {
|
|
8457
|
+
context.outcome ?? (context.outcome = 'error');
|
|
8325
8458
|
console.error('[GyosRouter] navigation error', error);
|
|
8326
|
-
|
|
8459
|
+
fallback(opts.url, true);
|
|
8327
8460
|
}
|
|
8328
8461
|
}
|
|
8329
8462
|
finally {
|
|
8463
|
+
if (transaction.controller.signal.aborted)
|
|
8464
|
+
context.outcome = 'aborted';
|
|
8465
|
+
context.outcome ?? (context.outcome = 'aborted');
|
|
8330
8466
|
if (transaction.interval)
|
|
8331
8467
|
clearInterval(transaction.interval);
|
|
8332
8468
|
if (transaction.spinner)
|
|
@@ -8336,6 +8472,15 @@
|
|
|
8336
8472
|
progressBar?.complete();
|
|
8337
8473
|
}
|
|
8338
8474
|
transaction.resolveDone();
|
|
8475
|
+
if (formEvent)
|
|
8476
|
+
submittingForms.delete(formEvent.form);
|
|
8477
|
+
runNavigationHooks(navigationEnd, context.url, context);
|
|
8478
|
+
if (formEvent) {
|
|
8479
|
+
const { url, status, outcome, committed, fallback } = context;
|
|
8480
|
+
document.dispatchEvent(new CustomEvent('gyos:form-end', {
|
|
8481
|
+
detail: { ...formEvent, url, status, outcome, committed, fallback }
|
|
8482
|
+
}));
|
|
8483
|
+
}
|
|
8339
8484
|
}
|
|
8340
8485
|
}
|
|
8341
8486
|
function shouldBoost(el) {
|
|
@@ -8444,16 +8589,34 @@
|
|
|
8444
8589
|
return;
|
|
8445
8590
|
if (shouldDeferToFormValidation(form))
|
|
8446
8591
|
return;
|
|
8447
|
-
event.
|
|
8448
|
-
const
|
|
8449
|
-
const
|
|
8450
|
-
const
|
|
8451
|
-
|
|
8452
|
-
|
|
8592
|
+
const submitter = event.submitter;
|
|
8593
|
+
const override = (name) => submitter?.getAttribute(`form${name}`) ?? form.getAttribute(name);
|
|
8594
|
+
const target = override('target') ?? document.querySelector('base[target]')?.getAttribute('target');
|
|
8595
|
+
const declaredMethod = (override('method') || 'GET').toUpperCase();
|
|
8596
|
+
const method = ['GET', 'POST', 'DIALOG'].includes(declaredMethod) ? declaredMethod : 'GET';
|
|
8597
|
+
const formEncoding = override('enctype')?.toLowerCase();
|
|
8598
|
+
if ((target && target.toLowerCase() !== '_self') || method === 'DIALOG' || formEncoding === 'text/plain')
|
|
8599
|
+
return;
|
|
8600
|
+
if (!resolveTarget(form))
|
|
8601
|
+
return;
|
|
8602
|
+
// Image submitters carry click coordinates which SubmitEvent does not expose.
|
|
8603
|
+
if (submitter instanceof HTMLInputElement && submitter.type === 'image')
|
|
8453
8604
|
return;
|
|
8605
|
+
let url;
|
|
8606
|
+
try {
|
|
8607
|
+
url = new URL(override('action') || window.location.href, document.baseURI);
|
|
8454
8608
|
}
|
|
8455
|
-
|
|
8456
|
-
|
|
8609
|
+
catch {
|
|
8610
|
+
return;
|
|
8611
|
+
}
|
|
8612
|
+
if (url.origin !== window.location.origin)
|
|
8613
|
+
return;
|
|
8614
|
+
event.preventDefault();
|
|
8615
|
+
if (submittingForms.has(form))
|
|
8616
|
+
return;
|
|
8617
|
+
const formData = new FormData(form, submitter);
|
|
8618
|
+
submittingForms.add(form);
|
|
8619
|
+
void navigate({ url: url.toString(), method, trigger: form, form, formData, formEncoding, changeState: method === 'GET' });
|
|
8457
8620
|
}
|
|
8458
8621
|
function onPopState(event) {
|
|
8459
8622
|
const url = window.location.href;
|
|
@@ -8558,23 +8721,25 @@
|
|
|
8558
8721
|
startRouter,
|
|
8559
8722
|
onBeforeNavigate,
|
|
8560
8723
|
onAfterNavigate,
|
|
8724
|
+
onBeforeSwap,
|
|
8725
|
+
onNavigationEnd,
|
|
8561
8726
|
portalCreate,
|
|
8562
8727
|
portalDestroy,
|
|
8563
8728
|
setCspNonce,
|
|
8564
|
-
version: '0.
|
|
8729
|
+
version: '0.4.0'
|
|
8565
8730
|
};
|
|
8566
8731
|
|
|
8567
8732
|
// This file was generated. Do not modify manually!
|
|
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,
|
|
8733
|
+
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, 78, 5, 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, 199, 7, 137, 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, 55, 9, 266, 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, 233, 0, 3, 0, 8, 1, 6, 0, 475, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
|
|
8569
8734
|
|
|
8570
8735
|
// This file was generated. Do not modify manually!
|
|
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,
|
|
8736
|
+
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, 7, 25, 39, 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, 5, 57, 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, 24, 43, 261, 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, 33, 24, 3, 24, 45, 74, 6, 0, 67, 12, 65, 1, 2, 0, 15, 4, 10, 7381, 42, 31, 98, 114, 8702, 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, 208, 30, 2, 2, 2, 1, 2, 6, 3, 4, 10, 1, 225, 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, 4381, 3, 5773, 3, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 8489];
|
|
8572
8737
|
|
|
8573
8738
|
// This file was generated. Do not modify manually!
|
|
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-\
|
|
8739
|
+
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-\u1add\u1ae0-\u1aeb\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";
|
|
8575
8740
|
|
|
8576
8741
|
// This file was generated. Do not modify manually!
|
|
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-\
|
|
8742
|
+
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-\u088f\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\u0c5c\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdc-\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-\ua7dc\ua7f1-\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";
|
|
8578
8743
|
|
|
8579
8744
|
// These are a run-length and offset encoded representation of the
|
|
8580
8745
|
// >0xffff code points that are a valid part of identifiers. The
|
|
@@ -8899,9 +9064,12 @@
|
|
|
8899
9064
|
// for new syntax features.
|
|
8900
9065
|
ecmaVersion: null,
|
|
8901
9066
|
// `sourceType` indicates the mode the code should be parsed in.
|
|
8902
|
-
// Can be either `"script"` or `"
|
|
9067
|
+
// Can be either `"script"`, `"module"` or `"commonjs"`. This influences global
|
|
8903
9068
|
// strict mode and parsing of `import` and `export` declarations.
|
|
8904
9069
|
sourceType: "script",
|
|
9070
|
+
// When set to true, enable strict parsing mode even if `sourceType`
|
|
9071
|
+
// is `"script"`.
|
|
9072
|
+
strict: false,
|
|
8905
9073
|
// `onInsertedSemicolon` can be a callback that will be called when
|
|
8906
9074
|
// a semicolon is automatically inserted. It will be passed the
|
|
8907
9075
|
// position of the inserted semicolon as an offset, and if
|
|
@@ -8943,6 +9111,11 @@
|
|
|
8943
9111
|
// line being 1-based and column 0-based) will be attached to the
|
|
8944
9112
|
// nodes.
|
|
8945
9113
|
locations: false,
|
|
9114
|
+
// Pass an optional `{line, column}` object to use for the start of
|
|
9115
|
+
// the parse. This is mostly useful when using `parseExpressionAt`
|
|
9116
|
+
// with `locations: true`, to prevent the parser from having to
|
|
9117
|
+
// determine the line position at the start position.
|
|
9118
|
+
startLocation: null,
|
|
8946
9119
|
// A function can be passed as `onToken` option, which will
|
|
8947
9120
|
// cause Acorn to call that function with object in the same
|
|
8948
9121
|
// format as tokens returned from `tokenizer().getToken()`. Note
|
|
@@ -9023,6 +9196,9 @@
|
|
|
9023
9196
|
if (isArray(options.onComment))
|
|
9024
9197
|
{ options.onComment = pushComment(options, options.onComment); }
|
|
9025
9198
|
|
|
9199
|
+
if (options.sourceType === "commonjs" && options.allowAwaitOutsideFunction)
|
|
9200
|
+
{ throw new Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs") }
|
|
9201
|
+
|
|
9026
9202
|
return options
|
|
9027
9203
|
}
|
|
9028
9204
|
|
|
@@ -9054,6 +9230,7 @@
|
|
|
9054
9230
|
SCOPE_DIRECT_SUPER = 128,
|
|
9055
9231
|
SCOPE_CLASS_STATIC_BLOCK = 256,
|
|
9056
9232
|
SCOPE_CLASS_FIELD_INIT = 512,
|
|
9233
|
+
SCOPE_SWITCH = 1024,
|
|
9057
9234
|
SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK;
|
|
9058
9235
|
|
|
9059
9236
|
function functionFlags(async, generator) {
|
|
@@ -9092,13 +9269,17 @@
|
|
|
9092
9269
|
// Set up token state
|
|
9093
9270
|
|
|
9094
9271
|
// The current position of the tokenizer in the input.
|
|
9095
|
-
|
|
9096
|
-
|
|
9272
|
+
this.pos = startPos || 0;
|
|
9273
|
+
this.curLine = 1;
|
|
9274
|
+
if (options.startLocation) {
|
|
9275
|
+
this.lineStart = this.pos - options.startLocation.column;
|
|
9276
|
+
this.curLine = options.startLocation.line;
|
|
9277
|
+
} else if (startPos) {
|
|
9097
9278
|
this.lineStart = this.input.lastIndexOf("\n", startPos - 1) + 1;
|
|
9098
|
-
|
|
9279
|
+
if (this.options.locations)
|
|
9280
|
+
{ this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length; }
|
|
9099
9281
|
} else {
|
|
9100
|
-
this.
|
|
9101
|
-
this.curLine = 1;
|
|
9282
|
+
this.lineStart = 0;
|
|
9102
9283
|
}
|
|
9103
9284
|
|
|
9104
9285
|
// Properties of the current token:
|
|
@@ -9124,7 +9305,7 @@
|
|
|
9124
9305
|
|
|
9125
9306
|
// Figure out if it's a module code.
|
|
9126
9307
|
this.inModule = options.sourceType === "module";
|
|
9127
|
-
this.strict = this.inModule || this.strictDirective(this.pos);
|
|
9308
|
+
this.strict = this.inModule || options.strict === true || this.strictDirective(this.pos);
|
|
9128
9309
|
|
|
9129
9310
|
// Used to signify the start of a potential arrow function
|
|
9130
9311
|
this.potentialArrowAt = -1;
|
|
@@ -9143,7 +9324,12 @@
|
|
|
9143
9324
|
|
|
9144
9325
|
// Scope tracking for duplicate variable names (see scope.js)
|
|
9145
9326
|
this.scopeStack = [];
|
|
9146
|
-
this.enterScope(
|
|
9327
|
+
this.enterScope(
|
|
9328
|
+
this.options.sourceType === "commonjs"
|
|
9329
|
+
// In commonjs, the top-level scope behaves like a function scope
|
|
9330
|
+
? SCOPE_FUNCTION
|
|
9331
|
+
: SCOPE_TOP
|
|
9332
|
+
);
|
|
9147
9333
|
|
|
9148
9334
|
// For RegExp validation
|
|
9149
9335
|
this.regexpState = null;
|
|
@@ -9154,12 +9340,14 @@
|
|
|
9154
9340
|
this.privateNameStack = [];
|
|
9155
9341
|
};
|
|
9156
9342
|
|
|
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 } };
|
|
9343
|
+
var prototypeAccessors = { inFunction: { configurable: true },inGenerator: { configurable: true },inAsync: { configurable: true },canAwait: { configurable: true },allowReturn: { configurable: true },allowSuper: { configurable: true },allowDirectSuper: { configurable: true },treatFunctionsAsVar: { configurable: true },allowNewDotTarget: { configurable: true },allowUsing: { configurable: true },inClassStaticBlock: { configurable: true } };
|
|
9158
9344
|
|
|
9159
9345
|
Parser.prototype.parse = function parse () {
|
|
9346
|
+
var this$1$1 = this;
|
|
9347
|
+
|
|
9160
9348
|
var node = this.options.program || this.startNode();
|
|
9161
9349
|
this.nextToken();
|
|
9162
|
-
return this.parseTopLevel(node)
|
|
9350
|
+
return this.catchStackOverflow(function () { return this$1$1.parseTopLevel(node); })
|
|
9163
9351
|
};
|
|
9164
9352
|
|
|
9165
9353
|
prototypeAccessors.inFunction.get = function () { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0 };
|
|
@@ -9178,6 +9366,12 @@
|
|
|
9178
9366
|
return (this.inModule && this.options.ecmaVersion >= 13) || this.options.allowAwaitOutsideFunction
|
|
9179
9367
|
};
|
|
9180
9368
|
|
|
9369
|
+
prototypeAccessors.allowReturn.get = function () {
|
|
9370
|
+
if (this.inFunction) { return true }
|
|
9371
|
+
if (this.options.allowReturnOutsideFunction && this.currentVarScope().flags & SCOPE_TOP) { return true }
|
|
9372
|
+
return false
|
|
9373
|
+
};
|
|
9374
|
+
|
|
9181
9375
|
prototypeAccessors.allowSuper.get = function () {
|
|
9182
9376
|
var ref = this.currentThisScope();
|
|
9183
9377
|
var flags = ref.flags;
|
|
@@ -9198,6 +9392,14 @@
|
|
|
9198
9392
|
return false
|
|
9199
9393
|
};
|
|
9200
9394
|
|
|
9395
|
+
prototypeAccessors.allowUsing.get = function () {
|
|
9396
|
+
var ref = this.currentScope();
|
|
9397
|
+
var flags = ref.flags;
|
|
9398
|
+
if (flags & SCOPE_SWITCH) { return false }
|
|
9399
|
+
if (!this.inModule && flags & SCOPE_TOP) { return false }
|
|
9400
|
+
return true
|
|
9401
|
+
};
|
|
9402
|
+
|
|
9201
9403
|
prototypeAccessors.inClassStaticBlock.get = function () {
|
|
9202
9404
|
return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0
|
|
9203
9405
|
};
|
|
@@ -9284,6 +9486,17 @@
|
|
|
9284
9486
|
return true
|
|
9285
9487
|
};
|
|
9286
9488
|
|
|
9489
|
+
pp$9.catchStackOverflow = function(f) {
|
|
9490
|
+
try {
|
|
9491
|
+
return f()
|
|
9492
|
+
} catch (e) {
|
|
9493
|
+
if (e instanceof Error && (/\bstack\b.*\b(exceeded|overflow)\b/i.test(e.message) || /\btoo much recursion\b/i.test(e.message)))
|
|
9494
|
+
{ this.raise(this.start, "Not enough stack space to parse input"); }
|
|
9495
|
+
else
|
|
9496
|
+
{ throw e }
|
|
9497
|
+
}
|
|
9498
|
+
};
|
|
9499
|
+
|
|
9287
9500
|
// Asserts that following token is given contextual keyword.
|
|
9288
9501
|
|
|
9289
9502
|
pp$9.expectContextual = function(name) {
|
|
@@ -9387,10 +9600,10 @@
|
|
|
9387
9600
|
// to its body instead of creating a new node.
|
|
9388
9601
|
|
|
9389
9602
|
pp$8.parseTopLevel = function(node) {
|
|
9390
|
-
var exports = Object.create(null);
|
|
9603
|
+
var exports$1 = Object.create(null);
|
|
9391
9604
|
if (!node.body) { node.body = []; }
|
|
9392
9605
|
while (this.type !== types$1.eof) {
|
|
9393
|
-
var stmt = this.parseStatement(null, true, exports);
|
|
9606
|
+
var stmt = this.parseStatement(null, true, exports$1);
|
|
9394
9607
|
node.body.push(stmt);
|
|
9395
9608
|
}
|
|
9396
9609
|
if (this.inModule)
|
|
@@ -9402,7 +9615,7 @@
|
|
|
9402
9615
|
} }
|
|
9403
9616
|
this.adaptDirectivePrologue(node.body);
|
|
9404
9617
|
this.next();
|
|
9405
|
-
node.sourceType = this.options.sourceType;
|
|
9618
|
+
node.sourceType = this.options.sourceType === "commonjs" ? "script" : this.options.sourceType;
|
|
9406
9619
|
return this.finishNode(node, "Program")
|
|
9407
9620
|
};
|
|
9408
9621
|
|
|
@@ -9412,7 +9625,7 @@
|
|
|
9412
9625
|
if (this.options.ecmaVersion < 6 || !this.isContextual("let")) { return false }
|
|
9413
9626
|
skipWhiteSpace.lastIndex = this.pos;
|
|
9414
9627
|
var skip = skipWhiteSpace.exec(this.input);
|
|
9415
|
-
var next = this.pos + skip[0].length, nextCh = this.
|
|
9628
|
+
var next = this.pos + skip[0].length, nextCh = this.fullCharCodeAt(next);
|
|
9416
9629
|
// For ambiguous cases, determine if a LexicalDeclaration (or only a
|
|
9417
9630
|
// Statement) is allowed here. If context is not empty then only a Statement
|
|
9418
9631
|
// is allowed. However, `let [` is an explicit negative lookahead for
|
|
@@ -9420,12 +9633,13 @@
|
|
|
9420
9633
|
if (nextCh === 91 || nextCh === 92) { return true } // '[', '\'
|
|
9421
9634
|
if (context) { return false }
|
|
9422
9635
|
|
|
9423
|
-
if (nextCh === 123
|
|
9424
|
-
if (isIdentifierStart(nextCh
|
|
9425
|
-
var
|
|
9426
|
-
|
|
9427
|
-
|
|
9428
|
-
|
|
9636
|
+
if (nextCh === 123) { return true } // '{'
|
|
9637
|
+
if (isIdentifierStart(nextCh)) {
|
|
9638
|
+
var start = next;
|
|
9639
|
+
do { next += nextCh <= 0xffff ? 1 : 2; }
|
|
9640
|
+
while (isIdentifierChar(nextCh = this.fullCharCodeAt(next)))
|
|
9641
|
+
if (nextCh === 92) { return true }
|
|
9642
|
+
var ident = this.input.slice(start, next);
|
|
9429
9643
|
if (!keywordRelationalOperator.test(ident)) { return true }
|
|
9430
9644
|
}
|
|
9431
9645
|
return false
|
|
@@ -9444,7 +9658,7 @@
|
|
|
9444
9658
|
return !lineBreak.test(this.input.slice(this.pos, next)) &&
|
|
9445
9659
|
this.input.slice(next, next + 8) === "function" &&
|
|
9446
9660
|
(next + 8 === this.input.length ||
|
|
9447
|
-
!(isIdentifierChar(after = this.
|
|
9661
|
+
!(isIdentifierChar(after = this.fullCharCodeAt(next + 8)) || after === 92 /* '\' */))
|
|
9448
9662
|
};
|
|
9449
9663
|
|
|
9450
9664
|
pp$8.isUsingKeyword = function(isAwaitUsing, isFor) {
|
|
@@ -9458,28 +9672,39 @@
|
|
|
9458
9672
|
if (lineBreak.test(this.input.slice(this.pos, next))) { return false }
|
|
9459
9673
|
|
|
9460
9674
|
if (isAwaitUsing) {
|
|
9461
|
-
var
|
|
9462
|
-
if (this.input.slice(next,
|
|
9463
|
-
|
|
9464
|
-
isIdentifierChar(after = this.
|
|
9465
|
-
|
|
9675
|
+
var usingEndPos = next + 5 /* using */, after;
|
|
9676
|
+
if (this.input.slice(next, usingEndPos) !== "using" ||
|
|
9677
|
+
usingEndPos === this.input.length ||
|
|
9678
|
+
isIdentifierChar(after = this.fullCharCodeAt(usingEndPos)) ||
|
|
9679
|
+
after === 92 /* '\' */
|
|
9466
9680
|
) { return false }
|
|
9467
9681
|
|
|
9468
|
-
skipWhiteSpace.lastIndex =
|
|
9682
|
+
skipWhiteSpace.lastIndex = usingEndPos;
|
|
9469
9683
|
var skipAfterUsing = skipWhiteSpace.exec(this.input);
|
|
9470
|
-
|
|
9471
|
-
|
|
9472
|
-
|
|
9473
|
-
|
|
9474
|
-
|
|
9475
|
-
|
|
9476
|
-
|
|
9477
|
-
|
|
9684
|
+
next = usingEndPos + skipAfterUsing[0].length;
|
|
9685
|
+
if (skipAfterUsing && lineBreak.test(this.input.slice(usingEndPos, next))) { return false }
|
|
9686
|
+
}
|
|
9687
|
+
|
|
9688
|
+
var ch = this.fullCharCodeAt(next);
|
|
9689
|
+
if (!isIdentifierStart(ch) && ch !== 92 /* '\' */) { return false }
|
|
9690
|
+
var idStart = next;
|
|
9691
|
+
do { next += ch <= 0xffff ? 1 : 2; }
|
|
9692
|
+
while (isIdentifierChar(ch = this.fullCharCodeAt(next)))
|
|
9693
|
+
if (ch === 92) { return true }
|
|
9694
|
+
var id = this.input.slice(idStart, next);
|
|
9695
|
+
if (keywordRelationalOperator.test(id)) { return false }
|
|
9696
|
+
if (isFor && !isAwaitUsing && id === "of") {
|
|
9697
|
+
// Look ahead for using declaration with initializer, i.e., `for (using of = ...)`
|
|
9698
|
+
skipWhiteSpace.lastIndex = next;
|
|
9699
|
+
var skipAfterOf = skipWhiteSpace.exec(this.input);
|
|
9700
|
+
next = next + skipAfterOf[0].length;
|
|
9701
|
+
if (this.input.charCodeAt(next) !== 61 /* '=' */ ||
|
|
9702
|
+
// Check for ==, === and => operators
|
|
9703
|
+
(ch = this.input.charCodeAt(next + 1)) === 61 /* '=' */ || ch === 62 /* '>' */) {
|
|
9704
|
+
return false
|
|
9478
9705
|
}
|
|
9479
9706
|
}
|
|
9480
|
-
|
|
9481
|
-
var ch = this.input.charCodeAt(next);
|
|
9482
|
-
return isIdentifierStart(ch, true) || ch === 92 // '\'
|
|
9707
|
+
return true
|
|
9483
9708
|
};
|
|
9484
9709
|
|
|
9485
9710
|
pp$8.isAwaitUsing = function(isFor) {
|
|
@@ -9497,7 +9722,7 @@
|
|
|
9497
9722
|
// `if (foo) /blah/.exec(foo)`, where looking at the previous token
|
|
9498
9723
|
// does not help.
|
|
9499
9724
|
|
|
9500
|
-
pp$8.parseStatement = function(context, topLevel, exports) {
|
|
9725
|
+
pp$8.parseStatement = function(context, topLevel, exports$1) {
|
|
9501
9726
|
var starttype = this.type, node = this.startNode(), kind;
|
|
9502
9727
|
|
|
9503
9728
|
if (this.isLet(context)) {
|
|
@@ -9552,7 +9777,7 @@
|
|
|
9552
9777
|
if (!this.inModule)
|
|
9553
9778
|
{ this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'"); }
|
|
9554
9779
|
}
|
|
9555
|
-
return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports)
|
|
9780
|
+
return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports$1)
|
|
9556
9781
|
|
|
9557
9782
|
// If the statement does not start with a statement keyword or a
|
|
9558
9783
|
// brace, it's an ExpressionStatement or LabeledStatement. We
|
|
@@ -9568,8 +9793,12 @@
|
|
|
9568
9793
|
|
|
9569
9794
|
var usingKind = this.isAwaitUsing(false) ? "await using" : this.isUsing(false) ? "using" : null;
|
|
9570
9795
|
if (usingKind) {
|
|
9571
|
-
if (
|
|
9572
|
-
this.raise(this.start, "Using declaration cannot appear in the top level when source type is `script`");
|
|
9796
|
+
if (!this.allowUsing) {
|
|
9797
|
+
this.raise(this.start, "Using declaration cannot appear in the top level when source type is `script` or in the bare case statement");
|
|
9798
|
+
}
|
|
9799
|
+
if (context) {
|
|
9800
|
+
// Cases like `for (;;) using x = ...;`, `if (true) await using x = ...;`, etc. are not allowed.
|
|
9801
|
+
this.raise(this.start, "Using declaration is not allowed in single-statement positions");
|
|
9573
9802
|
}
|
|
9574
9803
|
if (usingKind === "await using") {
|
|
9575
9804
|
if (!this.canAwait) {
|
|
@@ -9666,7 +9895,12 @@
|
|
|
9666
9895
|
if (usingKind) {
|
|
9667
9896
|
var init$2 = this.startNode();
|
|
9668
9897
|
this.next();
|
|
9669
|
-
if (usingKind === "await using") {
|
|
9898
|
+
if (usingKind === "await using") {
|
|
9899
|
+
if (!this.canAwait) {
|
|
9900
|
+
this.raise(this.start, "Await using cannot appear outside of async function");
|
|
9901
|
+
}
|
|
9902
|
+
this.next();
|
|
9903
|
+
}
|
|
9670
9904
|
this.parseVar(init$2, true, usingKind);
|
|
9671
9905
|
this.finishNode(init$2, "VariableDeclaration");
|
|
9672
9906
|
return this.parseForAfterInit(node, init$2, awaitAt)
|
|
@@ -9699,11 +9933,12 @@
|
|
|
9699
9933
|
// Helper method to parse for loop after variable initialization
|
|
9700
9934
|
pp$8.parseForAfterInit = function(node, init, awaitAt) {
|
|
9701
9935
|
if ((this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init.declarations.length === 1) {
|
|
9702
|
-
if (this.
|
|
9703
|
-
if (
|
|
9704
|
-
|
|
9705
|
-
}
|
|
9706
|
-
|
|
9936
|
+
if (this.type === types$1._in) {
|
|
9937
|
+
if ((init.kind === "using" || init.kind === "await using") && !init.declarations[0].init) {
|
|
9938
|
+
this.raise(this.start, "Using declaration is not allowed in for-in loops");
|
|
9939
|
+
}
|
|
9940
|
+
if (this.options.ecmaVersion >= 9 && awaitAt > -1) { this.unexpected(awaitAt); }
|
|
9941
|
+
} else if (this.options.ecmaVersion >= 9) { node.await = awaitAt > -1; }
|
|
9707
9942
|
return this.parseForIn(node, init)
|
|
9708
9943
|
}
|
|
9709
9944
|
if (awaitAt > -1) { this.unexpected(awaitAt); }
|
|
@@ -9725,7 +9960,7 @@
|
|
|
9725
9960
|
};
|
|
9726
9961
|
|
|
9727
9962
|
pp$8.parseReturnStatement = function(node) {
|
|
9728
|
-
if (!this.
|
|
9963
|
+
if (!this.allowReturn)
|
|
9729
9964
|
{ this.raise(this.start, "'return' outside of function"); }
|
|
9730
9965
|
this.next();
|
|
9731
9966
|
|
|
@@ -9744,7 +9979,7 @@
|
|
|
9744
9979
|
node.cases = [];
|
|
9745
9980
|
this.expect(types$1.braceL);
|
|
9746
9981
|
this.labels.push(switchLabel);
|
|
9747
|
-
this.enterScope(
|
|
9982
|
+
this.enterScope(SCOPE_SWITCH);
|
|
9748
9983
|
|
|
9749
9984
|
// Statements under must be grouped (by label) in SwitchCase
|
|
9750
9985
|
// nodes. `cur` is used to keep the node that we are currently
|
|
@@ -10308,11 +10543,11 @@
|
|
|
10308
10543
|
|
|
10309
10544
|
// Parses module export declaration.
|
|
10310
10545
|
|
|
10311
|
-
pp$8.parseExportAllDeclaration = function(node, exports) {
|
|
10546
|
+
pp$8.parseExportAllDeclaration = function(node, exports$1) {
|
|
10312
10547
|
if (this.options.ecmaVersion >= 11) {
|
|
10313
10548
|
if (this.eatContextual("as")) {
|
|
10314
10549
|
node.exported = this.parseModuleExportName();
|
|
10315
|
-
this.checkExport(exports, node.exported, this.lastTokStart);
|
|
10550
|
+
this.checkExport(exports$1, node.exported, this.lastTokStart);
|
|
10316
10551
|
} else {
|
|
10317
10552
|
node.exported = null;
|
|
10318
10553
|
}
|
|
@@ -10326,14 +10561,14 @@
|
|
|
10326
10561
|
return this.finishNode(node, "ExportAllDeclaration")
|
|
10327
10562
|
};
|
|
10328
10563
|
|
|
10329
|
-
pp$8.parseExport = function(node, exports) {
|
|
10564
|
+
pp$8.parseExport = function(node, exports$1) {
|
|
10330
10565
|
this.next();
|
|
10331
10566
|
// export * from '...'
|
|
10332
10567
|
if (this.eat(types$1.star)) {
|
|
10333
|
-
return this.parseExportAllDeclaration(node, exports)
|
|
10568
|
+
return this.parseExportAllDeclaration(node, exports$1)
|
|
10334
10569
|
}
|
|
10335
10570
|
if (this.eat(types$1._default)) { // export default ...
|
|
10336
|
-
this.checkExport(exports, "default", this.lastTokStart);
|
|
10571
|
+
this.checkExport(exports$1, "default", this.lastTokStart);
|
|
10337
10572
|
node.declaration = this.parseExportDefaultDeclaration();
|
|
10338
10573
|
return this.finishNode(node, "ExportDefaultDeclaration")
|
|
10339
10574
|
}
|
|
@@ -10341,16 +10576,16 @@
|
|
|
10341
10576
|
if (this.shouldParseExportStatement()) {
|
|
10342
10577
|
node.declaration = this.parseExportDeclaration(node);
|
|
10343
10578
|
if (node.declaration.type === "VariableDeclaration")
|
|
10344
|
-
{ this.checkVariableExport(exports, node.declaration.declarations); }
|
|
10579
|
+
{ this.checkVariableExport(exports$1, node.declaration.declarations); }
|
|
10345
10580
|
else
|
|
10346
|
-
{ this.checkExport(exports, node.declaration.id, node.declaration.id.start); }
|
|
10581
|
+
{ this.checkExport(exports$1, node.declaration.id, node.declaration.id.start); }
|
|
10347
10582
|
node.specifiers = [];
|
|
10348
10583
|
node.source = null;
|
|
10349
10584
|
if (this.options.ecmaVersion >= 16)
|
|
10350
10585
|
{ node.attributes = []; }
|
|
10351
10586
|
} else { // export { x, y as z } [from '...']
|
|
10352
10587
|
node.declaration = null;
|
|
10353
|
-
node.specifiers = this.parseExportSpecifiers(exports);
|
|
10588
|
+
node.specifiers = this.parseExportSpecifiers(exports$1);
|
|
10354
10589
|
if (this.eatContextual("from")) {
|
|
10355
10590
|
if (this.type !== types$1.string) { this.unexpected(); }
|
|
10356
10591
|
node.source = this.parseExprAtom();
|
|
@@ -10400,47 +10635,47 @@
|
|
|
10400
10635
|
}
|
|
10401
10636
|
};
|
|
10402
10637
|
|
|
10403
|
-
pp$8.checkExport = function(exports, name, pos) {
|
|
10404
|
-
if (!exports) { return }
|
|
10638
|
+
pp$8.checkExport = function(exports$1, name, pos) {
|
|
10639
|
+
if (!exports$1) { return }
|
|
10405
10640
|
if (typeof name !== "string")
|
|
10406
10641
|
{ name = name.type === "Identifier" ? name.name : name.value; }
|
|
10407
|
-
if (hasOwn(exports, name))
|
|
10642
|
+
if (hasOwn(exports$1, name))
|
|
10408
10643
|
{ this.raiseRecoverable(pos, "Duplicate export '" + name + "'"); }
|
|
10409
|
-
exports[name] = true;
|
|
10644
|
+
exports$1[name] = true;
|
|
10410
10645
|
};
|
|
10411
10646
|
|
|
10412
|
-
pp$8.checkPatternExport = function(exports, pat) {
|
|
10647
|
+
pp$8.checkPatternExport = function(exports$1, pat) {
|
|
10413
10648
|
var type = pat.type;
|
|
10414
10649
|
if (type === "Identifier")
|
|
10415
|
-
{ this.checkExport(exports, pat, pat.start); }
|
|
10650
|
+
{ this.checkExport(exports$1, pat, pat.start); }
|
|
10416
10651
|
else if (type === "ObjectPattern")
|
|
10417
10652
|
{ for (var i = 0, list = pat.properties; i < list.length; i += 1)
|
|
10418
10653
|
{
|
|
10419
10654
|
var prop = list[i];
|
|
10420
10655
|
|
|
10421
|
-
this.checkPatternExport(exports, prop);
|
|
10656
|
+
this.checkPatternExport(exports$1, prop);
|
|
10422
10657
|
} }
|
|
10423
10658
|
else if (type === "ArrayPattern")
|
|
10424
10659
|
{ for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) {
|
|
10425
10660
|
var elt = list$1[i$1];
|
|
10426
10661
|
|
|
10427
|
-
if (elt) { this.checkPatternExport(exports, elt); }
|
|
10662
|
+
if (elt) { this.checkPatternExport(exports$1, elt); }
|
|
10428
10663
|
} }
|
|
10429
10664
|
else if (type === "Property")
|
|
10430
|
-
{ this.checkPatternExport(exports, pat.value); }
|
|
10665
|
+
{ this.checkPatternExport(exports$1, pat.value); }
|
|
10431
10666
|
else if (type === "AssignmentPattern")
|
|
10432
|
-
{ this.checkPatternExport(exports, pat.left); }
|
|
10667
|
+
{ this.checkPatternExport(exports$1, pat.left); }
|
|
10433
10668
|
else if (type === "RestElement")
|
|
10434
|
-
{ this.checkPatternExport(exports, pat.argument); }
|
|
10669
|
+
{ this.checkPatternExport(exports$1, pat.argument); }
|
|
10435
10670
|
};
|
|
10436
10671
|
|
|
10437
|
-
pp$8.checkVariableExport = function(exports, decls) {
|
|
10438
|
-
if (!exports) { return }
|
|
10672
|
+
pp$8.checkVariableExport = function(exports$1, decls) {
|
|
10673
|
+
if (!exports$1) { return }
|
|
10439
10674
|
for (var i = 0, list = decls; i < list.length; i += 1)
|
|
10440
10675
|
{
|
|
10441
10676
|
var decl = list[i];
|
|
10442
10677
|
|
|
10443
|
-
this.checkPatternExport(exports, decl.id);
|
|
10678
|
+
this.checkPatternExport(exports$1, decl.id);
|
|
10444
10679
|
}
|
|
10445
10680
|
};
|
|
10446
10681
|
|
|
@@ -10455,13 +10690,13 @@
|
|
|
10455
10690
|
|
|
10456
10691
|
// Parses a comma-separated list of module exports.
|
|
10457
10692
|
|
|
10458
|
-
pp$8.parseExportSpecifier = function(exports) {
|
|
10693
|
+
pp$8.parseExportSpecifier = function(exports$1) {
|
|
10459
10694
|
var node = this.startNode();
|
|
10460
10695
|
node.local = this.parseModuleExportName();
|
|
10461
10696
|
|
|
10462
10697
|
node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
|
|
10463
10698
|
this.checkExport(
|
|
10464
|
-
exports,
|
|
10699
|
+
exports$1,
|
|
10465
10700
|
node.exported,
|
|
10466
10701
|
node.exported.start
|
|
10467
10702
|
);
|
|
@@ -10469,7 +10704,7 @@
|
|
|
10469
10704
|
return this.finishNode(node, "ExportSpecifier")
|
|
10470
10705
|
};
|
|
10471
10706
|
|
|
10472
|
-
pp$8.parseExportSpecifiers = function(exports) {
|
|
10707
|
+
pp$8.parseExportSpecifiers = function(exports$1) {
|
|
10473
10708
|
var nodes = [], first = true;
|
|
10474
10709
|
// export { x, y as z } [from '...']
|
|
10475
10710
|
this.expect(types$1.braceL);
|
|
@@ -10479,7 +10714,7 @@
|
|
|
10479
10714
|
if (this.afterTrailingComma(types$1.braceR)) { break }
|
|
10480
10715
|
} else { first = false; }
|
|
10481
10716
|
|
|
10482
|
-
nodes.push(this.parseExportSpecifier(exports));
|
|
10717
|
+
nodes.push(this.parseExportSpecifier(exports$1));
|
|
10483
10718
|
}
|
|
10484
10719
|
return nodes
|
|
10485
10720
|
};
|
|
@@ -11210,15 +11445,19 @@
|
|
|
11210
11445
|
// delayed syntax error at correct position).
|
|
11211
11446
|
|
|
11212
11447
|
pp$5.parseExpression = function(forInit, refDestructuringErrors) {
|
|
11213
|
-
var
|
|
11214
|
-
|
|
11215
|
-
|
|
11216
|
-
var
|
|
11217
|
-
|
|
11218
|
-
|
|
11219
|
-
|
|
11220
|
-
|
|
11221
|
-
|
|
11448
|
+
var this$1$1 = this;
|
|
11449
|
+
|
|
11450
|
+
return this.catchStackOverflow(function () {
|
|
11451
|
+
var startPos = this$1$1.start, startLoc = this$1$1.startLoc;
|
|
11452
|
+
var expr = this$1$1.parseMaybeAssign(forInit, refDestructuringErrors);
|
|
11453
|
+
if (this$1$1.type === types$1.comma) {
|
|
11454
|
+
var node = this$1$1.startNodeAt(startPos, startLoc);
|
|
11455
|
+
node.expressions = [expr];
|
|
11456
|
+
while (this$1$1.eat(types$1.comma)) { node.expressions.push(this$1$1.parseMaybeAssign(forInit, refDestructuringErrors)); }
|
|
11457
|
+
return this$1$1.finishNode(node, "SequenceExpression")
|
|
11458
|
+
}
|
|
11459
|
+
return expr
|
|
11460
|
+
})
|
|
11222
11461
|
};
|
|
11223
11462
|
|
|
11224
11463
|
// Parse an assignment expression. This includes applications of
|
|
@@ -11283,7 +11522,7 @@
|
|
|
11283
11522
|
var startPos = this.start, startLoc = this.startLoc;
|
|
11284
11523
|
var expr = this.parseExprOps(forInit, refDestructuringErrors);
|
|
11285
11524
|
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
|
|
11286
|
-
if (this.eat(types$1.question)) {
|
|
11525
|
+
if (!(expr.type === "ArrowFunctionExpression" && expr.start === startPos) && this.eat(types$1.question)) {
|
|
11287
11526
|
var node = this.startNodeAt(startPos, startLoc);
|
|
11288
11527
|
node.test = expr;
|
|
11289
11528
|
node.consequent = this.parseMaybeAssign();
|
|
@@ -11383,7 +11622,7 @@
|
|
|
11383
11622
|
}
|
|
11384
11623
|
}
|
|
11385
11624
|
|
|
11386
|
-
if (!incDec && this.eat(types$1.starstar)) {
|
|
11625
|
+
if (!incDec && !(expr.type === "ArrowFunctionExpression" && expr.start === startPos) && this.eat(types$1.starstar)) {
|
|
11387
11626
|
if (sawUnary)
|
|
11388
11627
|
{ this.unexpected(this.lastTokStart); }
|
|
11389
11628
|
else
|
|
@@ -11835,6 +12074,8 @@
|
|
|
11835
12074
|
}
|
|
11836
12075
|
var startPos = this.start, startLoc = this.startLoc;
|
|
11837
12076
|
node.callee = this.parseSubscripts(this.parseExprAtom(null, false, true), startPos, startLoc, true, false);
|
|
12077
|
+
if (node.callee.type === "Super")
|
|
12078
|
+
{ this.raiseRecoverable(startPos, "Invalid use of 'super'"); }
|
|
11838
12079
|
if (this.eat(types$1.parenL)) { node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); }
|
|
11839
12080
|
else { node.arguments = empty; }
|
|
11840
12081
|
return this.finishNode(node, "NewExpression")
|
|
@@ -12452,7 +12693,7 @@
|
|
|
12452
12693
|
};
|
|
12453
12694
|
|
|
12454
12695
|
// This file was generated by "bin/generate-unicode-script-values.js". Do not modify manually!
|
|
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";
|
|
12696
|
+
var scriptValuesAddedInUnicode = "Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz";
|
|
12456
12697
|
|
|
12457
12698
|
// This file contains Unicode properties extracted from the ECMAScript specification.
|
|
12458
12699
|
// The lists are extracted like so:
|
|
@@ -14013,13 +14254,17 @@
|
|
|
14013
14254
|
return this.getTokenFromCode(code)
|
|
14014
14255
|
};
|
|
14015
14256
|
|
|
14016
|
-
pp.
|
|
14017
|
-
var code = this.input.charCodeAt(
|
|
14257
|
+
pp.fullCharCodeAt = function(pos) {
|
|
14258
|
+
var code = this.input.charCodeAt(pos);
|
|
14018
14259
|
if (code <= 0xd7ff || code >= 0xdc00) { return code }
|
|
14019
|
-
var next = this.input.charCodeAt(
|
|
14260
|
+
var next = this.input.charCodeAt(pos + 1);
|
|
14020
14261
|
return next <= 0xdbff || next >= 0xe000 ? code : (code << 10) + next - 0x35fdc00
|
|
14021
14262
|
};
|
|
14022
14263
|
|
|
14264
|
+
pp.fullCharCodeAtPos = function() {
|
|
14265
|
+
return this.fullCharCodeAt(this.pos)
|
|
14266
|
+
};
|
|
14267
|
+
|
|
14023
14268
|
pp.skipBlockComment = function() {
|
|
14024
14269
|
var startLoc = this.options.onComment && this.curPosition();
|
|
14025
14270
|
var start = this.pos, end = this.input.indexOf("*/", this.pos += 2);
|
|
@@ -14747,7 +14992,7 @@
|
|
|
14747
14992
|
// [ghbt]: https://github.com/acornjs/acorn/issues
|
|
14748
14993
|
|
|
14749
14994
|
|
|
14750
|
-
var version = "8.
|
|
14995
|
+
var version = "8.18.0";
|
|
14751
14996
|
|
|
14752
14997
|
Parser.acorn = {
|
|
14753
14998
|
Parser: Parser,
|