Deployed the page to Github Pages.
This commit is contained in:
parent
1d79754e93
commit
2c89899458
62797 changed files with 6551425 additions and 15279 deletions
276
node_modules/zone.js/fesm2015/async-test.js
generated
vendored
Executable file
276
node_modules/zone.js/fesm2015/async-test.js
generated
vendored
Executable file
|
@ -0,0 +1,276 @@
|
|||
'use strict';
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/
|
||||
const global$1 = globalThis;
|
||||
// __Zone_symbol_prefix global can be used to override the default zone
|
||||
// symbol prefix with a custom one if needed.
|
||||
function __symbol__(name) {
|
||||
const symbolPrefix = global$1['__Zone_symbol_prefix'] || '__zone_symbol__';
|
||||
return symbolPrefix + name;
|
||||
}
|
||||
|
||||
const __global = (typeof window !== 'undefined' && window) || (typeof self !== 'undefined' && self) || global;
|
||||
class AsyncTestZoneSpec {
|
||||
// Needs to be a getter and not a plain property in order run this just-in-time. Otherwise
|
||||
// `__symbol__` would be evaluated during top-level execution prior to the Zone prefix being
|
||||
// changed for tests.
|
||||
static get symbolParentUnresolved() {
|
||||
return __symbol__('parentUnresolved');
|
||||
}
|
||||
constructor(finishCallback, failCallback, namePrefix) {
|
||||
this.finishCallback = finishCallback;
|
||||
this.failCallback = failCallback;
|
||||
this._pendingMicroTasks = false;
|
||||
this._pendingMacroTasks = false;
|
||||
this._alreadyErrored = false;
|
||||
this._isSync = false;
|
||||
this._existingFinishTimer = null;
|
||||
this.entryFunction = null;
|
||||
this.runZone = Zone.current;
|
||||
this.unresolvedChainedPromiseCount = 0;
|
||||
this.supportWaitUnresolvedChainedPromise = false;
|
||||
this.name = 'asyncTestZone for ' + namePrefix;
|
||||
this.properties = { 'AsyncTestZoneSpec': this };
|
||||
this.supportWaitUnresolvedChainedPromise =
|
||||
__global[__symbol__('supportWaitUnResolvedChainedPromise')] === true;
|
||||
}
|
||||
isUnresolvedChainedPromisePending() {
|
||||
return this.unresolvedChainedPromiseCount > 0;
|
||||
}
|
||||
_finishCallbackIfDone() {
|
||||
// NOTE: Technically the `onHasTask` could fire together with the initial synchronous
|
||||
// completion in `onInvoke`. `onHasTask` might call this method when it captured e.g.
|
||||
// microtasks in the proxy zone that now complete as part of this async zone run.
|
||||
// Consider the following scenario:
|
||||
// 1. A test `beforeEach` schedules a microtask in the ProxyZone.
|
||||
// 2. An actual empty `it` spec executes in the AsyncTestZone` (using e.g. `waitForAsync`).
|
||||
// 3. The `onInvoke` invokes `_finishCallbackIfDone` because the spec runs synchronously.
|
||||
// 4. We wait the scheduled timeout (see below) to account for unhandled promises.
|
||||
// 5. The microtask from (1) finishes and `onHasTask` is invoked.
|
||||
// --> We register a second `_finishCallbackIfDone` even though we have scheduled a timeout.
|
||||
// If the finish timeout from below is already scheduled, terminate the existing scheduled
|
||||
// finish invocation, avoiding calling `jasmine` `done` multiple times. *Note* that we would
|
||||
// want to schedule a new finish callback in case the task state changes again.
|
||||
if (this._existingFinishTimer !== null) {
|
||||
clearTimeout(this._existingFinishTimer);
|
||||
this._existingFinishTimer = null;
|
||||
}
|
||||
if (!(this._pendingMicroTasks ||
|
||||
this._pendingMacroTasks ||
|
||||
(this.supportWaitUnresolvedChainedPromise && this.isUnresolvedChainedPromisePending()))) {
|
||||
// We wait until the next tick because we would like to catch unhandled promises which could
|
||||
// cause test logic to be executed. In such cases we cannot finish with tasks pending then.
|
||||
this.runZone.run(() => {
|
||||
this._existingFinishTimer = setTimeout(() => {
|
||||
if (!this._alreadyErrored && !(this._pendingMicroTasks || this._pendingMacroTasks)) {
|
||||
this.finishCallback();
|
||||
}
|
||||
}, 0);
|
||||
});
|
||||
}
|
||||
}
|
||||
patchPromiseForTest() {
|
||||
if (!this.supportWaitUnresolvedChainedPromise) {
|
||||
return;
|
||||
}
|
||||
const patchPromiseForTest = Promise[Zone.__symbol__('patchPromiseForTest')];
|
||||
if (patchPromiseForTest) {
|
||||
patchPromiseForTest();
|
||||
}
|
||||
}
|
||||
unPatchPromiseForTest() {
|
||||
if (!this.supportWaitUnresolvedChainedPromise) {
|
||||
return;
|
||||
}
|
||||
const unPatchPromiseForTest = Promise[Zone.__symbol__('unPatchPromiseForTest')];
|
||||
if (unPatchPromiseForTest) {
|
||||
unPatchPromiseForTest();
|
||||
}
|
||||
}
|
||||
onScheduleTask(delegate, current, target, task) {
|
||||
if (task.type !== 'eventTask') {
|
||||
this._isSync = false;
|
||||
}
|
||||
if (task.type === 'microTask' && task.data && task.data instanceof Promise) {
|
||||
// check whether the promise is a chained promise
|
||||
if (task.data[AsyncTestZoneSpec.symbolParentUnresolved] === true) {
|
||||
// chained promise is being scheduled
|
||||
this.unresolvedChainedPromiseCount--;
|
||||
}
|
||||
}
|
||||
return delegate.scheduleTask(target, task);
|
||||
}
|
||||
onInvokeTask(delegate, current, target, task, applyThis, applyArgs) {
|
||||
if (task.type !== 'eventTask') {
|
||||
this._isSync = false;
|
||||
}
|
||||
return delegate.invokeTask(target, task, applyThis, applyArgs);
|
||||
}
|
||||
onCancelTask(delegate, current, target, task) {
|
||||
if (task.type !== 'eventTask') {
|
||||
this._isSync = false;
|
||||
}
|
||||
return delegate.cancelTask(target, task);
|
||||
}
|
||||
// Note - we need to use onInvoke at the moment to call finish when a test is
|
||||
// fully synchronous. TODO(juliemr): remove this when the logic for
|
||||
// onHasTask changes and it calls whenever the task queues are dirty.
|
||||
// updated by(JiaLiPassion), only call finish callback when no task
|
||||
// was scheduled/invoked/canceled.
|
||||
onInvoke(parentZoneDelegate, currentZone, targetZone, delegate, applyThis, applyArgs, source) {
|
||||
if (!this.entryFunction) {
|
||||
this.entryFunction = delegate;
|
||||
}
|
||||
try {
|
||||
this._isSync = true;
|
||||
return parentZoneDelegate.invoke(targetZone, delegate, applyThis, applyArgs, source);
|
||||
}
|
||||
finally {
|
||||
// We need to check the delegate is the same as entryFunction or not.
|
||||
// Consider the following case.
|
||||
//
|
||||
// asyncTestZone.run(() => { // Here the delegate will be the entryFunction
|
||||
// Zone.current.run(() => { // Here the delegate will not be the entryFunction
|
||||
// });
|
||||
// });
|
||||
//
|
||||
// We only want to check whether there are async tasks scheduled
|
||||
// for the entry function.
|
||||
if (this._isSync && this.entryFunction === delegate) {
|
||||
this._finishCallbackIfDone();
|
||||
}
|
||||
}
|
||||
}
|
||||
onHandleError(parentZoneDelegate, currentZone, targetZone, error) {
|
||||
// Let the parent try to handle the error.
|
||||
const result = parentZoneDelegate.handleError(targetZone, error);
|
||||
if (result) {
|
||||
this.failCallback(error);
|
||||
this._alreadyErrored = true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
onHasTask(delegate, current, target, hasTaskState) {
|
||||
delegate.hasTask(target, hasTaskState);
|
||||
// We should only trigger finishCallback when the target zone is the AsyncTestZone
|
||||
// Consider the following cases.
|
||||
//
|
||||
// const childZone = asyncTestZone.fork({
|
||||
// name: 'child',
|
||||
// onHasTask: ...
|
||||
// });
|
||||
//
|
||||
// So we have nested zones declared the onHasTask hook, in this case,
|
||||
// the onHasTask will be triggered twice, and cause the finishCallbackIfDone()
|
||||
// is also be invoked twice. So we need to only trigger the finishCallbackIfDone()
|
||||
// when the current zone is the same as the target zone.
|
||||
if (current !== target) {
|
||||
return;
|
||||
}
|
||||
if (hasTaskState.change == 'microTask') {
|
||||
this._pendingMicroTasks = hasTaskState.microTask;
|
||||
this._finishCallbackIfDone();
|
||||
}
|
||||
else if (hasTaskState.change == 'macroTask') {
|
||||
this._pendingMacroTasks = hasTaskState.macroTask;
|
||||
this._finishCallbackIfDone();
|
||||
}
|
||||
}
|
||||
}
|
||||
function patchAsyncTest(Zone) {
|
||||
// Export the class so that new instances can be created with proper
|
||||
// constructor params.
|
||||
Zone['AsyncTestZoneSpec'] = AsyncTestZoneSpec;
|
||||
Zone.__load_patch('asynctest', (global, Zone, api) => {
|
||||
/**
|
||||
* Wraps a test function in an asynchronous test zone. The test will automatically
|
||||
* complete when all asynchronous calls within this zone are done.
|
||||
*/
|
||||
Zone[api.symbol('asyncTest')] = function asyncTest(fn) {
|
||||
// If we're running using the Jasmine test framework, adapt to call the 'done'
|
||||
// function when asynchronous activity is finished.
|
||||
if (global.jasmine) {
|
||||
// Not using an arrow function to preserve context passed from call site
|
||||
return function (done) {
|
||||
if (!done) {
|
||||
// if we run beforeEach in @angular/core/testing/testing_internal then we get no done
|
||||
// fake it here and assume sync.
|
||||
done = function () { };
|
||||
done.fail = function (e) {
|
||||
throw e;
|
||||
};
|
||||
}
|
||||
runInTestZone(fn, this, done, (err) => {
|
||||
if (typeof err === 'string') {
|
||||
return done.fail(new Error(err));
|
||||
}
|
||||
else {
|
||||
done.fail(err);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
// Otherwise, return a promise which will resolve when asynchronous activity
|
||||
// is finished. This will be correctly consumed by the Mocha framework with
|
||||
// it('...', async(myFn)); or can be used in a custom framework.
|
||||
// Not using an arrow function to preserve context passed from call site
|
||||
return function () {
|
||||
return new Promise((finishCallback, failCallback) => {
|
||||
runInTestZone(fn, this, finishCallback, failCallback);
|
||||
});
|
||||
};
|
||||
};
|
||||
function runInTestZone(fn, context, finishCallback, failCallback) {
|
||||
const currentZone = Zone.current;
|
||||
const AsyncTestZoneSpec = Zone['AsyncTestZoneSpec'];
|
||||
if (AsyncTestZoneSpec === undefined) {
|
||||
throw new Error('AsyncTestZoneSpec is needed for the async() test helper but could not be found. ' +
|
||||
'Please make sure that your environment includes zone.js/plugins/async-test');
|
||||
}
|
||||
const ProxyZoneSpec = Zone['ProxyZoneSpec'];
|
||||
if (!ProxyZoneSpec) {
|
||||
throw new Error('ProxyZoneSpec is needed for the async() test helper but could not be found. ' +
|
||||
'Please make sure that your environment includes zone.js/plugins/proxy');
|
||||
}
|
||||
const proxyZoneSpec = ProxyZoneSpec.get();
|
||||
ProxyZoneSpec.assertPresent();
|
||||
// We need to create the AsyncTestZoneSpec outside the ProxyZone.
|
||||
// If we do it in ProxyZone then we will get to infinite recursion.
|
||||
const proxyZone = Zone.current.getZoneWith('ProxyZoneSpec');
|
||||
const previousDelegate = proxyZoneSpec.getDelegate();
|
||||
proxyZone.parent.run(() => {
|
||||
const testZoneSpec = new AsyncTestZoneSpec(() => {
|
||||
// Need to restore the original zone.
|
||||
if (proxyZoneSpec.getDelegate() == testZoneSpec) {
|
||||
// Only reset the zone spec if it's
|
||||
// still this one. Otherwise, assume
|
||||
// it's OK.
|
||||
proxyZoneSpec.setDelegate(previousDelegate);
|
||||
}
|
||||
testZoneSpec.unPatchPromiseForTest();
|
||||
currentZone.run(() => {
|
||||
finishCallback();
|
||||
});
|
||||
}, (error) => {
|
||||
// Need to restore the original zone.
|
||||
if (proxyZoneSpec.getDelegate() == testZoneSpec) {
|
||||
// Only reset the zone spec if it's sill this one. Otherwise, assume it's OK.
|
||||
proxyZoneSpec.setDelegate(previousDelegate);
|
||||
}
|
||||
testZoneSpec.unPatchPromiseForTest();
|
||||
currentZone.run(() => {
|
||||
failCallback(error);
|
||||
});
|
||||
}, 'test');
|
||||
proxyZoneSpec.setDelegate(testZoneSpec);
|
||||
testZoneSpec.patchPromiseForTest();
|
||||
});
|
||||
return Zone.current.runGuarded(fn, context);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
patchAsyncTest(Zone);
|
6
node_modules/zone.js/fesm2015/async-test.min.js
generated
vendored
Executable file
6
node_modules/zone.js/fesm2015/async-test.min.js
generated
vendored
Executable file
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/const global$1=globalThis;function __symbol__(e){return(global$1.__Zone_symbol_prefix||"__zone_symbol__")+e}const __global="undefined"!=typeof window&&window||"undefined"!=typeof self&&self||global;class AsyncTestZoneSpec{static get symbolParentUnresolved(){return __symbol__("parentUnresolved")}constructor(e,n,s){this.finishCallback=e,this.failCallback=n,this._pendingMicroTasks=!1,this._pendingMacroTasks=!1,this._alreadyErrored=!1,this._isSync=!1,this._existingFinishTimer=null,this.entryFunction=null,this.runZone=Zone.current,this.unresolvedChainedPromiseCount=0,this.supportWaitUnresolvedChainedPromise=!1,this.name="asyncTestZone for "+s,this.properties={AsyncTestZoneSpec:this},this.supportWaitUnresolvedChainedPromise=!0===__global[__symbol__("supportWaitUnResolvedChainedPromise")]}isUnresolvedChainedPromisePending(){return this.unresolvedChainedPromiseCount>0}_finishCallbackIfDone(){null!==this._existingFinishTimer&&(clearTimeout(this._existingFinishTimer),this._existingFinishTimer=null),this._pendingMicroTasks||this._pendingMacroTasks||this.supportWaitUnresolvedChainedPromise&&this.isUnresolvedChainedPromisePending()||this.runZone.run((()=>{this._existingFinishTimer=setTimeout((()=>{this._alreadyErrored||this._pendingMicroTasks||this._pendingMacroTasks||this.finishCallback()}),0)}))}patchPromiseForTest(){if(!this.supportWaitUnresolvedChainedPromise)return;const e=Promise[Zone.__symbol__("patchPromiseForTest")];e&&e()}unPatchPromiseForTest(){if(!this.supportWaitUnresolvedChainedPromise)return;const e=Promise[Zone.__symbol__("unPatchPromiseForTest")];e&&e()}onScheduleTask(e,n,s,t){return"eventTask"!==t.type&&(this._isSync=!1),"microTask"===t.type&&t.data&&t.data instanceof Promise&&!0===t.data[AsyncTestZoneSpec.symbolParentUnresolved]&&this.unresolvedChainedPromiseCount--,e.scheduleTask(s,t)}onInvokeTask(e,n,s,t,i,o){return"eventTask"!==t.type&&(this._isSync=!1),e.invokeTask(s,t,i,o)}onCancelTask(e,n,s,t){return"eventTask"!==t.type&&(this._isSync=!1),e.cancelTask(s,t)}onInvoke(e,n,s,t,i,o,r){this.entryFunction||(this.entryFunction=t);try{return this._isSync=!0,e.invoke(s,t,i,o,r)}finally{this._isSync&&this.entryFunction===t&&this._finishCallbackIfDone()}}onHandleError(e,n,s,t){return e.handleError(s,t)&&(this.failCallback(t),this._alreadyErrored=!0),!1}onHasTask(e,n,s,t){e.hasTask(s,t),n===s&&("microTask"==t.change?(this._pendingMicroTasks=t.microTask,this._finishCallbackIfDone()):"macroTask"==t.change&&(this._pendingMacroTasks=t.macroTask,this._finishCallbackIfDone()))}}function patchAsyncTest(e){e.AsyncTestZoneSpec=AsyncTestZoneSpec,e.__load_patch("asynctest",((e,n,s)=>{function t(e,s,t,i){const o=n.current,r=n.AsyncTestZoneSpec;if(void 0===r)throw new Error("AsyncTestZoneSpec is needed for the async() test helper but could not be found. Please make sure that your environment includes zone.js/plugins/async-test");const a=n.ProxyZoneSpec;if(!a)throw new Error("ProxyZoneSpec is needed for the async() test helper but could not be found. Please make sure that your environment includes zone.js/plugins/proxy");const c=a.get();a.assertPresent();const h=n.current.getZoneWith("ProxyZoneSpec"),l=c.getDelegate();return h.parent.run((()=>{const e=new r((()=>{c.getDelegate()==e&&c.setDelegate(l),e.unPatchPromiseForTest(),o.run((()=>{t()}))}),(n=>{c.getDelegate()==e&&c.setDelegate(l),e.unPatchPromiseForTest(),o.run((()=>{i(n)}))}),"test");c.setDelegate(e),e.patchPromiseForTest()})),n.current.runGuarded(e,s)}n[s.symbol("asyncTest")]=function n(s){return e.jasmine?function(e){e||((e=function(){}).fail=function(e){throw e}),t(s,this,e,(n=>{if("string"==typeof n)return e.fail(new Error(n));e.fail(n)}))}:function(){return new Promise(((e,n)=>{t(s,this,e,n)}))}}}))}patchAsyncTest(Zone);
|
780
node_modules/zone.js/fesm2015/fake-async-test.js
generated
vendored
Executable file
780
node_modules/zone.js/fesm2015/fake-async-test.js
generated
vendored
Executable file
|
@ -0,0 +1,780 @@
|
|||
'use strict';
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/
|
||||
const global = (typeof window === 'object' && window) || (typeof self === 'object' && self) || globalThis.global;
|
||||
const OriginalDate = global.Date;
|
||||
// Since when we compile this file to `es2015`, and if we define
|
||||
// this `FakeDate` as `class FakeDate`, and then set `FakeDate.prototype`
|
||||
// there will be an error which is `Cannot assign to read only property 'prototype'`
|
||||
// so we need to use function implementation here.
|
||||
function FakeDate() {
|
||||
if (arguments.length === 0) {
|
||||
const d = new OriginalDate();
|
||||
d.setTime(FakeDate.now());
|
||||
return d;
|
||||
}
|
||||
else {
|
||||
const args = Array.prototype.slice.call(arguments);
|
||||
return new OriginalDate(...args);
|
||||
}
|
||||
}
|
||||
FakeDate.now = function () {
|
||||
const fakeAsyncTestZoneSpec = Zone.current.get('FakeAsyncTestZoneSpec');
|
||||
if (fakeAsyncTestZoneSpec) {
|
||||
return fakeAsyncTestZoneSpec.getFakeSystemTime();
|
||||
}
|
||||
return OriginalDate.now.apply(this, arguments);
|
||||
};
|
||||
FakeDate.UTC = OriginalDate.UTC;
|
||||
FakeDate.parse = OriginalDate.parse;
|
||||
// keep a reference for zone patched timer function
|
||||
let patchedTimers;
|
||||
const timeoutCallback = function () { };
|
||||
class Scheduler {
|
||||
// Next scheduler id.
|
||||
static { this.nextNodeJSId = 1; }
|
||||
static { this.nextId = -1; }
|
||||
constructor() {
|
||||
// Scheduler queue with the tuple of end time and callback function - sorted by end time.
|
||||
this._schedulerQueue = [];
|
||||
// Current simulated time in millis.
|
||||
this._currentTickTime = 0;
|
||||
// Current fake system base time in millis.
|
||||
this._currentFakeBaseSystemTime = OriginalDate.now();
|
||||
// track requeuePeriodicTimer
|
||||
this._currentTickRequeuePeriodicEntries = [];
|
||||
}
|
||||
static getNextId() {
|
||||
const id = patchedTimers.nativeSetTimeout.call(global, timeoutCallback, 0);
|
||||
patchedTimers.nativeClearTimeout.call(global, id);
|
||||
if (typeof id === 'number') {
|
||||
return id;
|
||||
}
|
||||
// in NodeJS, we just use a number for fakeAsync, since it will not
|
||||
// conflict with native TimeoutId
|
||||
return Scheduler.nextNodeJSId++;
|
||||
}
|
||||
getCurrentTickTime() {
|
||||
return this._currentTickTime;
|
||||
}
|
||||
getFakeSystemTime() {
|
||||
return this._currentFakeBaseSystemTime + this._currentTickTime;
|
||||
}
|
||||
setFakeBaseSystemTime(fakeBaseSystemTime) {
|
||||
this._currentFakeBaseSystemTime = fakeBaseSystemTime;
|
||||
}
|
||||
getRealSystemTime() {
|
||||
return OriginalDate.now();
|
||||
}
|
||||
scheduleFunction(cb, delay, options) {
|
||||
options = {
|
||||
...{
|
||||
args: [],
|
||||
isPeriodic: false,
|
||||
isRequestAnimationFrame: false,
|
||||
id: -1,
|
||||
isRequeuePeriodic: false,
|
||||
},
|
||||
...options,
|
||||
};
|
||||
let currentId = options.id < 0 ? Scheduler.nextId : options.id;
|
||||
Scheduler.nextId = Scheduler.getNextId();
|
||||
let endTime = this._currentTickTime + delay;
|
||||
// Insert so that scheduler queue remains sorted by end time.
|
||||
let newEntry = {
|
||||
endTime: endTime,
|
||||
id: currentId,
|
||||
func: cb,
|
||||
args: options.args,
|
||||
delay: delay,
|
||||
isPeriodic: options.isPeriodic,
|
||||
isRequestAnimationFrame: options.isRequestAnimationFrame,
|
||||
};
|
||||
if (options.isRequeuePeriodic) {
|
||||
this._currentTickRequeuePeriodicEntries.push(newEntry);
|
||||
}
|
||||
let i = 0;
|
||||
for (; i < this._schedulerQueue.length; i++) {
|
||||
let currentEntry = this._schedulerQueue[i];
|
||||
if (newEntry.endTime < currentEntry.endTime) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
this._schedulerQueue.splice(i, 0, newEntry);
|
||||
return currentId;
|
||||
}
|
||||
removeScheduledFunctionWithId(id) {
|
||||
for (let i = 0; i < this._schedulerQueue.length; i++) {
|
||||
if (this._schedulerQueue[i].id == id) {
|
||||
this._schedulerQueue.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
removeAll() {
|
||||
this._schedulerQueue = [];
|
||||
}
|
||||
getTimerCount() {
|
||||
return this._schedulerQueue.length;
|
||||
}
|
||||
tickToNext(step = 1, doTick, tickOptions) {
|
||||
if (this._schedulerQueue.length < step) {
|
||||
return;
|
||||
}
|
||||
// Find the last task currently queued in the scheduler queue and tick
|
||||
// till that time.
|
||||
const startTime = this._currentTickTime;
|
||||
const targetTask = this._schedulerQueue[step - 1];
|
||||
this.tick(targetTask.endTime - startTime, doTick, tickOptions);
|
||||
}
|
||||
tick(millis = 0, doTick, tickOptions) {
|
||||
let finalTime = this._currentTickTime + millis;
|
||||
let lastCurrentTime = 0;
|
||||
tickOptions = Object.assign({ processNewMacroTasksSynchronously: true }, tickOptions);
|
||||
// we need to copy the schedulerQueue so nested timeout
|
||||
// will not be wrongly called in the current tick
|
||||
// https://github.com/angular/angular/issues/33799
|
||||
const schedulerQueue = tickOptions.processNewMacroTasksSynchronously
|
||||
? this._schedulerQueue
|
||||
: this._schedulerQueue.slice();
|
||||
if (schedulerQueue.length === 0 && doTick) {
|
||||
doTick(millis);
|
||||
return;
|
||||
}
|
||||
while (schedulerQueue.length > 0) {
|
||||
// clear requeueEntries before each loop
|
||||
this._currentTickRequeuePeriodicEntries = [];
|
||||
let current = schedulerQueue[0];
|
||||
if (finalTime < current.endTime) {
|
||||
// Done processing the queue since it's sorted by endTime.
|
||||
break;
|
||||
}
|
||||
else {
|
||||
// Time to run scheduled function. Remove it from the head of queue.
|
||||
let current = schedulerQueue.shift();
|
||||
if (!tickOptions.processNewMacroTasksSynchronously) {
|
||||
const idx = this._schedulerQueue.indexOf(current);
|
||||
if (idx >= 0) {
|
||||
this._schedulerQueue.splice(idx, 1);
|
||||
}
|
||||
}
|
||||
lastCurrentTime = this._currentTickTime;
|
||||
this._currentTickTime = current.endTime;
|
||||
if (doTick) {
|
||||
doTick(this._currentTickTime - lastCurrentTime);
|
||||
}
|
||||
let retval = current.func.apply(global, current.isRequestAnimationFrame ? [this._currentTickTime] : current.args);
|
||||
if (!retval) {
|
||||
// Uncaught exception in the current scheduled function. Stop processing the queue.
|
||||
break;
|
||||
}
|
||||
// check is there any requeue periodic entry is added in
|
||||
// current loop, if there is, we need to add to current loop
|
||||
if (!tickOptions.processNewMacroTasksSynchronously) {
|
||||
this._currentTickRequeuePeriodicEntries.forEach((newEntry) => {
|
||||
let i = 0;
|
||||
for (; i < schedulerQueue.length; i++) {
|
||||
const currentEntry = schedulerQueue[i];
|
||||
if (newEntry.endTime < currentEntry.endTime) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
schedulerQueue.splice(i, 0, newEntry);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
lastCurrentTime = this._currentTickTime;
|
||||
this._currentTickTime = finalTime;
|
||||
if (doTick) {
|
||||
doTick(this._currentTickTime - lastCurrentTime);
|
||||
}
|
||||
}
|
||||
flushOnlyPendingTimers(doTick) {
|
||||
if (this._schedulerQueue.length === 0) {
|
||||
return 0;
|
||||
}
|
||||
// Find the last task currently queued in the scheduler queue and tick
|
||||
// till that time.
|
||||
const startTime = this._currentTickTime;
|
||||
const lastTask = this._schedulerQueue[this._schedulerQueue.length - 1];
|
||||
this.tick(lastTask.endTime - startTime, doTick, { processNewMacroTasksSynchronously: false });
|
||||
return this._currentTickTime - startTime;
|
||||
}
|
||||
flush(limit = 20, flushPeriodic = false, doTick) {
|
||||
if (flushPeriodic) {
|
||||
return this.flushPeriodic(doTick);
|
||||
}
|
||||
else {
|
||||
return this.flushNonPeriodic(limit, doTick);
|
||||
}
|
||||
}
|
||||
flushPeriodic(doTick) {
|
||||
if (this._schedulerQueue.length === 0) {
|
||||
return 0;
|
||||
}
|
||||
// Find the last task currently queued in the scheduler queue and tick
|
||||
// till that time.
|
||||
const startTime = this._currentTickTime;
|
||||
const lastTask = this._schedulerQueue[this._schedulerQueue.length - 1];
|
||||
this.tick(lastTask.endTime - startTime, doTick);
|
||||
return this._currentTickTime - startTime;
|
||||
}
|
||||
flushNonPeriodic(limit, doTick) {
|
||||
const startTime = this._currentTickTime;
|
||||
let lastCurrentTime = 0;
|
||||
let count = 0;
|
||||
while (this._schedulerQueue.length > 0) {
|
||||
count++;
|
||||
if (count > limit) {
|
||||
throw new Error('flush failed after reaching the limit of ' +
|
||||
limit +
|
||||
' tasks. Does your code use a polling timeout?');
|
||||
}
|
||||
// flush only non-periodic timers.
|
||||
// If the only remaining tasks are periodic(or requestAnimationFrame), finish flushing.
|
||||
if (this._schedulerQueue.filter((task) => !task.isPeriodic && !task.isRequestAnimationFrame)
|
||||
.length === 0) {
|
||||
break;
|
||||
}
|
||||
const current = this._schedulerQueue.shift();
|
||||
lastCurrentTime = this._currentTickTime;
|
||||
this._currentTickTime = current.endTime;
|
||||
if (doTick) {
|
||||
// Update any secondary schedulers like Jasmine mock Date.
|
||||
doTick(this._currentTickTime - lastCurrentTime);
|
||||
}
|
||||
const retval = current.func.apply(global, current.args);
|
||||
if (!retval) {
|
||||
// Uncaught exception in the current scheduled function. Stop processing the queue.
|
||||
break;
|
||||
}
|
||||
}
|
||||
return this._currentTickTime - startTime;
|
||||
}
|
||||
}
|
||||
class FakeAsyncTestZoneSpec {
|
||||
static assertInZone() {
|
||||
if (Zone.current.get('FakeAsyncTestZoneSpec') == null) {
|
||||
throw new Error('The code should be running in the fakeAsync zone to call this function');
|
||||
}
|
||||
}
|
||||
constructor(namePrefix, trackPendingRequestAnimationFrame = false, macroTaskOptions) {
|
||||
this.trackPendingRequestAnimationFrame = trackPendingRequestAnimationFrame;
|
||||
this.macroTaskOptions = macroTaskOptions;
|
||||
this._scheduler = new Scheduler();
|
||||
this._microtasks = [];
|
||||
this._lastError = null;
|
||||
this._uncaughtPromiseErrors = Promise[Zone.__symbol__('uncaughtPromiseErrors')];
|
||||
this.pendingPeriodicTimers = [];
|
||||
this.pendingTimers = [];
|
||||
this.patchDateLocked = false;
|
||||
this.properties = { 'FakeAsyncTestZoneSpec': this };
|
||||
this.name = 'fakeAsyncTestZone for ' + namePrefix;
|
||||
// in case user can't access the construction of FakeAsyncTestSpec
|
||||
// user can also define macroTaskOptions by define a global variable.
|
||||
if (!this.macroTaskOptions) {
|
||||
this.macroTaskOptions = global[Zone.__symbol__('FakeAsyncTestMacroTask')];
|
||||
}
|
||||
}
|
||||
_fnAndFlush(fn, completers) {
|
||||
return (...args) => {
|
||||
fn.apply(global, args);
|
||||
if (this._lastError === null) {
|
||||
// Success
|
||||
if (completers.onSuccess != null) {
|
||||
completers.onSuccess.apply(global);
|
||||
}
|
||||
// Flush microtasks only on success.
|
||||
this.flushMicrotasks();
|
||||
}
|
||||
else {
|
||||
// Failure
|
||||
if (completers.onError != null) {
|
||||
completers.onError.apply(global);
|
||||
}
|
||||
}
|
||||
// Return true if there were no errors, false otherwise.
|
||||
return this._lastError === null;
|
||||
};
|
||||
}
|
||||
static _removeTimer(timers, id) {
|
||||
let index = timers.indexOf(id);
|
||||
if (index > -1) {
|
||||
timers.splice(index, 1);
|
||||
}
|
||||
}
|
||||
_dequeueTimer(id) {
|
||||
return () => {
|
||||
FakeAsyncTestZoneSpec._removeTimer(this.pendingTimers, id);
|
||||
};
|
||||
}
|
||||
_requeuePeriodicTimer(fn, interval, args, id) {
|
||||
return () => {
|
||||
// Requeue the timer callback if it's not been canceled.
|
||||
if (this.pendingPeriodicTimers.indexOf(id) !== -1) {
|
||||
this._scheduler.scheduleFunction(fn, interval, {
|
||||
args,
|
||||
isPeriodic: true,
|
||||
id,
|
||||
isRequeuePeriodic: true,
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
_dequeuePeriodicTimer(id) {
|
||||
return () => {
|
||||
FakeAsyncTestZoneSpec._removeTimer(this.pendingPeriodicTimers, id);
|
||||
};
|
||||
}
|
||||
_setTimeout(fn, delay, args, isTimer = true) {
|
||||
let removeTimerFn = this._dequeueTimer(Scheduler.nextId);
|
||||
// Queue the callback and dequeue the timer on success and error.
|
||||
let cb = this._fnAndFlush(fn, { onSuccess: removeTimerFn, onError: removeTimerFn });
|
||||
let id = this._scheduler.scheduleFunction(cb, delay, { args, isRequestAnimationFrame: !isTimer });
|
||||
if (isTimer) {
|
||||
this.pendingTimers.push(id);
|
||||
}
|
||||
return id;
|
||||
}
|
||||
_clearTimeout(id) {
|
||||
FakeAsyncTestZoneSpec._removeTimer(this.pendingTimers, id);
|
||||
this._scheduler.removeScheduledFunctionWithId(id);
|
||||
}
|
||||
_setInterval(fn, interval, args) {
|
||||
let id = Scheduler.nextId;
|
||||
let completers = { onSuccess: null, onError: this._dequeuePeriodicTimer(id) };
|
||||
let cb = this._fnAndFlush(fn, completers);
|
||||
// Use the callback created above to requeue on success.
|
||||
completers.onSuccess = this._requeuePeriodicTimer(cb, interval, args, id);
|
||||
// Queue the callback and dequeue the periodic timer only on error.
|
||||
this._scheduler.scheduleFunction(cb, interval, { args, isPeriodic: true });
|
||||
this.pendingPeriodicTimers.push(id);
|
||||
return id;
|
||||
}
|
||||
_clearInterval(id) {
|
||||
FakeAsyncTestZoneSpec._removeTimer(this.pendingPeriodicTimers, id);
|
||||
this._scheduler.removeScheduledFunctionWithId(id);
|
||||
}
|
||||
_resetLastErrorAndThrow() {
|
||||
let error = this._lastError || this._uncaughtPromiseErrors[0];
|
||||
this._uncaughtPromiseErrors.length = 0;
|
||||
this._lastError = null;
|
||||
throw error;
|
||||
}
|
||||
getCurrentTickTime() {
|
||||
return this._scheduler.getCurrentTickTime();
|
||||
}
|
||||
getFakeSystemTime() {
|
||||
return this._scheduler.getFakeSystemTime();
|
||||
}
|
||||
setFakeBaseSystemTime(realTime) {
|
||||
this._scheduler.setFakeBaseSystemTime(realTime);
|
||||
}
|
||||
getRealSystemTime() {
|
||||
return this._scheduler.getRealSystemTime();
|
||||
}
|
||||
static patchDate() {
|
||||
if (!!global[Zone.__symbol__('disableDatePatching')]) {
|
||||
// we don't want to patch global Date
|
||||
// because in some case, global Date
|
||||
// is already being patched, we need to provide
|
||||
// an option to let user still use their
|
||||
// own version of Date.
|
||||
return;
|
||||
}
|
||||
if (global['Date'] === FakeDate) {
|
||||
// already patched
|
||||
return;
|
||||
}
|
||||
global['Date'] = FakeDate;
|
||||
FakeDate.prototype = OriginalDate.prototype;
|
||||
// try check and reset timers
|
||||
// because jasmine.clock().install() may
|
||||
// have replaced the global timer
|
||||
FakeAsyncTestZoneSpec.checkTimerPatch();
|
||||
}
|
||||
static resetDate() {
|
||||
if (global['Date'] === FakeDate) {
|
||||
global['Date'] = OriginalDate;
|
||||
}
|
||||
}
|
||||
static checkTimerPatch() {
|
||||
if (!patchedTimers) {
|
||||
throw new Error('Expected timers to have been patched.');
|
||||
}
|
||||
if (global.setTimeout !== patchedTimers.setTimeout) {
|
||||
global.setTimeout = patchedTimers.setTimeout;
|
||||
global.clearTimeout = patchedTimers.clearTimeout;
|
||||
}
|
||||
if (global.setInterval !== patchedTimers.setInterval) {
|
||||
global.setInterval = patchedTimers.setInterval;
|
||||
global.clearInterval = patchedTimers.clearInterval;
|
||||
}
|
||||
}
|
||||
lockDatePatch() {
|
||||
this.patchDateLocked = true;
|
||||
FakeAsyncTestZoneSpec.patchDate();
|
||||
}
|
||||
unlockDatePatch() {
|
||||
this.patchDateLocked = false;
|
||||
FakeAsyncTestZoneSpec.resetDate();
|
||||
}
|
||||
tickToNext(steps = 1, doTick, tickOptions = { processNewMacroTasksSynchronously: true }) {
|
||||
if (steps <= 0) {
|
||||
return;
|
||||
}
|
||||
FakeAsyncTestZoneSpec.assertInZone();
|
||||
this.flushMicrotasks();
|
||||
this._scheduler.tickToNext(steps, doTick, tickOptions);
|
||||
if (this._lastError !== null) {
|
||||
this._resetLastErrorAndThrow();
|
||||
}
|
||||
}
|
||||
tick(millis = 0, doTick, tickOptions = { processNewMacroTasksSynchronously: true }) {
|
||||
FakeAsyncTestZoneSpec.assertInZone();
|
||||
this.flushMicrotasks();
|
||||
this._scheduler.tick(millis, doTick, tickOptions);
|
||||
if (this._lastError !== null) {
|
||||
this._resetLastErrorAndThrow();
|
||||
}
|
||||
}
|
||||
flushMicrotasks() {
|
||||
FakeAsyncTestZoneSpec.assertInZone();
|
||||
const flushErrors = () => {
|
||||
if (this._lastError !== null || this._uncaughtPromiseErrors.length) {
|
||||
// If there is an error stop processing the microtask queue and rethrow the error.
|
||||
this._resetLastErrorAndThrow();
|
||||
}
|
||||
};
|
||||
while (this._microtasks.length > 0) {
|
||||
let microtask = this._microtasks.shift();
|
||||
microtask.func.apply(microtask.target, microtask.args);
|
||||
}
|
||||
flushErrors();
|
||||
}
|
||||
flush(limit, flushPeriodic, doTick) {
|
||||
FakeAsyncTestZoneSpec.assertInZone();
|
||||
this.flushMicrotasks();
|
||||
const elapsed = this._scheduler.flush(limit, flushPeriodic, doTick);
|
||||
if (this._lastError !== null) {
|
||||
this._resetLastErrorAndThrow();
|
||||
}
|
||||
return elapsed;
|
||||
}
|
||||
flushOnlyPendingTimers(doTick) {
|
||||
FakeAsyncTestZoneSpec.assertInZone();
|
||||
this.flushMicrotasks();
|
||||
const elapsed = this._scheduler.flushOnlyPendingTimers(doTick);
|
||||
if (this._lastError !== null) {
|
||||
this._resetLastErrorAndThrow();
|
||||
}
|
||||
return elapsed;
|
||||
}
|
||||
removeAllTimers() {
|
||||
FakeAsyncTestZoneSpec.assertInZone();
|
||||
this._scheduler.removeAll();
|
||||
this.pendingPeriodicTimers = [];
|
||||
this.pendingTimers = [];
|
||||
}
|
||||
getTimerCount() {
|
||||
return this._scheduler.getTimerCount() + this._microtasks.length;
|
||||
}
|
||||
onScheduleTask(delegate, current, target, task) {
|
||||
switch (task.type) {
|
||||
case 'microTask':
|
||||
let args = task.data && task.data.args;
|
||||
// should pass additional arguments to callback if have any
|
||||
// currently we know process.nextTick will have such additional
|
||||
// arguments
|
||||
let additionalArgs;
|
||||
if (args) {
|
||||
let callbackIndex = task.data.cbIdx;
|
||||
if (typeof args.length === 'number' && args.length > callbackIndex + 1) {
|
||||
additionalArgs = Array.prototype.slice.call(args, callbackIndex + 1);
|
||||
}
|
||||
}
|
||||
this._microtasks.push({
|
||||
func: task.invoke,
|
||||
args: additionalArgs,
|
||||
target: task.data && task.data.target,
|
||||
});
|
||||
break;
|
||||
case 'macroTask':
|
||||
switch (task.source) {
|
||||
case 'setTimeout':
|
||||
task.data['handleId'] = this._setTimeout(task.invoke, task.data['delay'], Array.prototype.slice.call(task.data['args'], 2));
|
||||
break;
|
||||
case 'setImmediate':
|
||||
task.data['handleId'] = this._setTimeout(task.invoke, 0, Array.prototype.slice.call(task.data['args'], 1));
|
||||
break;
|
||||
case 'setInterval':
|
||||
task.data['handleId'] = this._setInterval(task.invoke, task.data['delay'], Array.prototype.slice.call(task.data['args'], 2));
|
||||
break;
|
||||
case 'XMLHttpRequest.send':
|
||||
throw new Error('Cannot make XHRs from within a fake async test. Request URL: ' +
|
||||
task.data['url']);
|
||||
case 'requestAnimationFrame':
|
||||
case 'webkitRequestAnimationFrame':
|
||||
case 'mozRequestAnimationFrame':
|
||||
// Simulate a requestAnimationFrame by using a setTimeout with 16 ms.
|
||||
// (60 frames per second)
|
||||
task.data['handleId'] = this._setTimeout(task.invoke, 16, task.data['args'], this.trackPendingRequestAnimationFrame);
|
||||
break;
|
||||
default:
|
||||
// user can define which macroTask they want to support by passing
|
||||
// macroTaskOptions
|
||||
const macroTaskOption = this.findMacroTaskOption(task);
|
||||
if (macroTaskOption) {
|
||||
const args = task.data && task.data['args'];
|
||||
const delay = args && args.length > 1 ? args[1] : 0;
|
||||
let callbackArgs = macroTaskOption.callbackArgs ? macroTaskOption.callbackArgs : args;
|
||||
if (!!macroTaskOption.isPeriodic) {
|
||||
// periodic macroTask, use setInterval to simulate
|
||||
task.data['handleId'] = this._setInterval(task.invoke, delay, callbackArgs);
|
||||
task.data.isPeriodic = true;
|
||||
}
|
||||
else {
|
||||
// not periodic, use setTimeout to simulate
|
||||
task.data['handleId'] = this._setTimeout(task.invoke, delay, callbackArgs);
|
||||
}
|
||||
break;
|
||||
}
|
||||
throw new Error('Unknown macroTask scheduled in fake async test: ' + task.source);
|
||||
}
|
||||
break;
|
||||
case 'eventTask':
|
||||
task = delegate.scheduleTask(target, task);
|
||||
break;
|
||||
}
|
||||
return task;
|
||||
}
|
||||
onCancelTask(delegate, current, target, task) {
|
||||
switch (task.source) {
|
||||
case 'setTimeout':
|
||||
case 'requestAnimationFrame':
|
||||
case 'webkitRequestAnimationFrame':
|
||||
case 'mozRequestAnimationFrame':
|
||||
return this._clearTimeout(task.data['handleId']);
|
||||
case 'setInterval':
|
||||
return this._clearInterval(task.data['handleId']);
|
||||
default:
|
||||
// user can define which macroTask they want to support by passing
|
||||
// macroTaskOptions
|
||||
const macroTaskOption = this.findMacroTaskOption(task);
|
||||
if (macroTaskOption) {
|
||||
const handleId = task.data['handleId'];
|
||||
return macroTaskOption.isPeriodic
|
||||
? this._clearInterval(handleId)
|
||||
: this._clearTimeout(handleId);
|
||||
}
|
||||
return delegate.cancelTask(target, task);
|
||||
}
|
||||
}
|
||||
onInvoke(delegate, current, target, callback, applyThis, applyArgs, source) {
|
||||
try {
|
||||
FakeAsyncTestZoneSpec.patchDate();
|
||||
return delegate.invoke(target, callback, applyThis, applyArgs, source);
|
||||
}
|
||||
finally {
|
||||
if (!this.patchDateLocked) {
|
||||
FakeAsyncTestZoneSpec.resetDate();
|
||||
}
|
||||
}
|
||||
}
|
||||
findMacroTaskOption(task) {
|
||||
if (!this.macroTaskOptions) {
|
||||
return null;
|
||||
}
|
||||
for (let i = 0; i < this.macroTaskOptions.length; i++) {
|
||||
const macroTaskOption = this.macroTaskOptions[i];
|
||||
if (macroTaskOption.source === task.source) {
|
||||
return macroTaskOption;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
onHandleError(parentZoneDelegate, currentZone, targetZone, error) {
|
||||
this._lastError = error;
|
||||
return false; // Don't propagate error to parent zone.
|
||||
}
|
||||
}
|
||||
let _fakeAsyncTestZoneSpec = null;
|
||||
function getProxyZoneSpec() {
|
||||
return Zone && Zone['ProxyZoneSpec'];
|
||||
}
|
||||
/**
|
||||
* Clears out the shared fake async zone for a test.
|
||||
* To be called in a global `beforeEach`.
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
function resetFakeAsyncZone() {
|
||||
if (_fakeAsyncTestZoneSpec) {
|
||||
_fakeAsyncTestZoneSpec.unlockDatePatch();
|
||||
}
|
||||
_fakeAsyncTestZoneSpec = null;
|
||||
// in node.js testing we may not have ProxyZoneSpec in which case there is nothing to reset.
|
||||
getProxyZoneSpec() && getProxyZoneSpec().assertPresent().resetDelegate();
|
||||
}
|
||||
/**
|
||||
* Wraps a function to be executed in the fakeAsync zone:
|
||||
* - microtasks are manually executed by calling `flushMicrotasks()`,
|
||||
* - timers are synchronous, `tick()` simulates the asynchronous passage of time.
|
||||
*
|
||||
* When flush is `false`, if there are any pending timers at the end of the function,
|
||||
* an exception will be thrown.
|
||||
*
|
||||
* Can be used to wrap inject() calls.
|
||||
*
|
||||
* ## Example
|
||||
*
|
||||
* {@example core/testing/ts/fake_async.ts region='basic'}
|
||||
*
|
||||
* @param fn
|
||||
* @param options
|
||||
* flush: when true, will drain the macrotask queue after the test function completes.
|
||||
* @returns The function wrapped to be executed in the fakeAsync zone
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
function fakeAsync(fn, options = {}) {
|
||||
const { flush = false } = options;
|
||||
// Not using an arrow function to preserve context passed from call site
|
||||
const fakeAsyncFn = function (...args) {
|
||||
const ProxyZoneSpec = getProxyZoneSpec();
|
||||
if (!ProxyZoneSpec) {
|
||||
throw new Error('ProxyZoneSpec is needed for the async() test helper but could not be found. ' +
|
||||
'Please make sure that your environment includes zone.js/plugins/proxy');
|
||||
}
|
||||
const proxyZoneSpec = ProxyZoneSpec.assertPresent();
|
||||
if (Zone.current.get('FakeAsyncTestZoneSpec')) {
|
||||
throw new Error('fakeAsync() calls can not be nested');
|
||||
}
|
||||
try {
|
||||
// in case jasmine.clock init a fakeAsyncTestZoneSpec
|
||||
if (!_fakeAsyncTestZoneSpec) {
|
||||
const FakeAsyncTestZoneSpec = Zone && Zone['FakeAsyncTestZoneSpec'];
|
||||
if (proxyZoneSpec.getDelegate() instanceof FakeAsyncTestZoneSpec) {
|
||||
throw new Error('fakeAsync() calls can not be nested');
|
||||
}
|
||||
_fakeAsyncTestZoneSpec = new FakeAsyncTestZoneSpec();
|
||||
}
|
||||
let res;
|
||||
const lastProxyZoneSpec = proxyZoneSpec.getDelegate();
|
||||
proxyZoneSpec.setDelegate(_fakeAsyncTestZoneSpec);
|
||||
_fakeAsyncTestZoneSpec.lockDatePatch();
|
||||
try {
|
||||
res = fn.apply(this, args);
|
||||
if (flush) {
|
||||
_fakeAsyncTestZoneSpec.flush(20, true);
|
||||
}
|
||||
else {
|
||||
flushMicrotasks();
|
||||
}
|
||||
}
|
||||
finally {
|
||||
proxyZoneSpec.setDelegate(lastProxyZoneSpec);
|
||||
}
|
||||
if (!flush) {
|
||||
if (_fakeAsyncTestZoneSpec.pendingPeriodicTimers.length > 0) {
|
||||
throw new Error(`${_fakeAsyncTestZoneSpec.pendingPeriodicTimers.length} ` +
|
||||
`periodic timer(s) still in the queue.`);
|
||||
}
|
||||
if (_fakeAsyncTestZoneSpec.pendingTimers.length > 0) {
|
||||
throw new Error(`${_fakeAsyncTestZoneSpec.pendingTimers.length} timer(s) still in the queue.`);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
finally {
|
||||
resetFakeAsyncZone();
|
||||
}
|
||||
};
|
||||
fakeAsyncFn.isFakeAsync = true;
|
||||
return fakeAsyncFn;
|
||||
}
|
||||
function _getFakeAsyncZoneSpec() {
|
||||
if (_fakeAsyncTestZoneSpec == null) {
|
||||
_fakeAsyncTestZoneSpec = Zone.current.get('FakeAsyncTestZoneSpec');
|
||||
if (_fakeAsyncTestZoneSpec == null) {
|
||||
throw new Error('The code should be running in the fakeAsync zone to call this function');
|
||||
}
|
||||
}
|
||||
return _fakeAsyncTestZoneSpec;
|
||||
}
|
||||
/**
|
||||
* Simulates the asynchronous passage of time for the timers in the fakeAsync zone.
|
||||
*
|
||||
* The microtasks queue is drained at the very start of this function and after any timer
|
||||
* callback has been executed.
|
||||
*
|
||||
* ## Example
|
||||
*
|
||||
* {@example core/testing/ts/fake_async.ts region='basic'}
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
function tick(millis = 0, ignoreNestedTimeout = false) {
|
||||
_getFakeAsyncZoneSpec().tick(millis, null, ignoreNestedTimeout);
|
||||
}
|
||||
/**
|
||||
* Simulates the asynchronous passage of time for the timers in the fakeAsync zone by
|
||||
* draining the macrotask queue until it is empty. The returned value is the milliseconds
|
||||
* of time that would have been elapsed.
|
||||
*
|
||||
* @param maxTurns
|
||||
* @returns The simulated time elapsed, in millis.
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
function flush(maxTurns) {
|
||||
return _getFakeAsyncZoneSpec().flush(maxTurns);
|
||||
}
|
||||
/**
|
||||
* Discard all remaining periodic tasks.
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
function discardPeriodicTasks() {
|
||||
const zoneSpec = _getFakeAsyncZoneSpec();
|
||||
zoneSpec.pendingPeriodicTimers;
|
||||
zoneSpec.pendingPeriodicTimers.length = 0;
|
||||
}
|
||||
/**
|
||||
* Flush any pending microtasks.
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
function flushMicrotasks() {
|
||||
_getFakeAsyncZoneSpec().flushMicrotasks();
|
||||
}
|
||||
function patchFakeAsyncTest(Zone) {
|
||||
// Export the class so that new instances can be created with proper
|
||||
// constructor params.
|
||||
Zone['FakeAsyncTestZoneSpec'] = FakeAsyncTestZoneSpec;
|
||||
Zone.__load_patch('fakeasync', (global, Zone, api) => {
|
||||
Zone[api.symbol('fakeAsyncTest')] = {
|
||||
resetFakeAsyncZone,
|
||||
flushMicrotasks,
|
||||
discardPeriodicTasks,
|
||||
tick,
|
||||
flush,
|
||||
fakeAsync,
|
||||
};
|
||||
}, true);
|
||||
patchedTimers = {
|
||||
setTimeout: global.setTimeout,
|
||||
setInterval: global.setInterval,
|
||||
clearTimeout: global.clearTimeout,
|
||||
clearInterval: global.clearInterval,
|
||||
nativeSetTimeout: global[Zone.__symbol__('setTimeout')],
|
||||
nativeClearTimeout: global[Zone.__symbol__('clearTimeout')],
|
||||
};
|
||||
Scheduler.nextId = Scheduler.getNextId();
|
||||
}
|
||||
|
||||
patchFakeAsyncTest(Zone);
|
6
node_modules/zone.js/fesm2015/fake-async-test.min.js
generated
vendored
Executable file
6
node_modules/zone.js/fesm2015/fake-async-test.min.js
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
336
node_modules/zone.js/fesm2015/jasmine-patch.js
generated
vendored
Executable file
336
node_modules/zone.js/fesm2015/jasmine-patch.js
generated
vendored
Executable file
|
@ -0,0 +1,336 @@
|
|||
'use strict';
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/
|
||||
function patchJasmine(Zone) {
|
||||
Zone.__load_patch('jasmine', (global, Zone, api) => {
|
||||
const __extends = function (d, b) {
|
||||
for (const p in b)
|
||||
if (b.hasOwnProperty(p))
|
||||
d[p] = b[p];
|
||||
function __() {
|
||||
this.constructor = d;
|
||||
}
|
||||
d.prototype =
|
||||
b === null ? Object.create(b) : ((__.prototype = b.prototype), new __());
|
||||
};
|
||||
// Patch jasmine's describe/it/beforeEach/afterEach functions so test code always runs
|
||||
// in a testZone (ProxyZone). (See: angular/zone.js#91 & angular/angular#10503)
|
||||
if (!Zone)
|
||||
throw new Error('Missing: zone.js');
|
||||
if (typeof jest !== 'undefined') {
|
||||
// return if jasmine is a light implementation inside jest
|
||||
// in this case, we are running inside jest not jasmine
|
||||
return;
|
||||
}
|
||||
if (typeof jasmine == 'undefined' || jasmine['__zone_patch__']) {
|
||||
return;
|
||||
}
|
||||
jasmine['__zone_patch__'] = true;
|
||||
const SyncTestZoneSpec = Zone['SyncTestZoneSpec'];
|
||||
const ProxyZoneSpec = Zone['ProxyZoneSpec'];
|
||||
if (!SyncTestZoneSpec)
|
||||
throw new Error('Missing: SyncTestZoneSpec');
|
||||
if (!ProxyZoneSpec)
|
||||
throw new Error('Missing: ProxyZoneSpec');
|
||||
const ambientZone = Zone.current;
|
||||
const symbol = Zone.__symbol__;
|
||||
// whether patch jasmine clock when in fakeAsync
|
||||
const disablePatchingJasmineClock = global[symbol('fakeAsyncDisablePatchingClock')] === true;
|
||||
// the original variable name fakeAsyncPatchLock is not accurate, so the name will be
|
||||
// fakeAsyncAutoFakeAsyncWhenClockPatched and if this enablePatchingJasmineClock is false, we
|
||||
// also automatically disable the auto jump into fakeAsync feature
|
||||
const enableAutoFakeAsyncWhenClockPatched = !disablePatchingJasmineClock &&
|
||||
(global[symbol('fakeAsyncPatchLock')] === true ||
|
||||
global[symbol('fakeAsyncAutoFakeAsyncWhenClockPatched')] === true);
|
||||
const ignoreUnhandledRejection = global[symbol('ignoreUnhandledRejection')] === true;
|
||||
if (!ignoreUnhandledRejection) {
|
||||
const globalErrors = jasmine.GlobalErrors;
|
||||
if (globalErrors && !jasmine[symbol('GlobalErrors')]) {
|
||||
jasmine[symbol('GlobalErrors')] = globalErrors;
|
||||
jasmine.GlobalErrors = function () {
|
||||
const instance = new globalErrors();
|
||||
const originalInstall = instance.install;
|
||||
if (originalInstall && !instance[symbol('install')]) {
|
||||
instance[symbol('install')] = originalInstall;
|
||||
instance.install = function () {
|
||||
const isNode = typeof process !== 'undefined' && !!process.on;
|
||||
// Note: Jasmine checks internally if `process` and `process.on` is defined.
|
||||
// Otherwise, it installs the browser rejection handler through the
|
||||
// `global.addEventListener`. This code may be run in the browser environment where
|
||||
// `process` is not defined, and this will lead to a runtime exception since Webpack 5
|
||||
// removed automatic Node.js polyfills. Note, that events are named differently, it's
|
||||
// `unhandledRejection` in Node.js and `unhandledrejection` in the browser.
|
||||
const originalHandlers = isNode
|
||||
? process.listeners('unhandledRejection')
|
||||
: global.eventListeners('unhandledrejection');
|
||||
const result = originalInstall.apply(this, arguments);
|
||||
isNode
|
||||
? process.removeAllListeners('unhandledRejection')
|
||||
: global.removeAllListeners('unhandledrejection');
|
||||
if (originalHandlers) {
|
||||
originalHandlers.forEach((handler) => {
|
||||
if (isNode) {
|
||||
process.on('unhandledRejection', handler);
|
||||
}
|
||||
else {
|
||||
global.addEventListener('unhandledrejection', handler);
|
||||
}
|
||||
});
|
||||
}
|
||||
return result;
|
||||
};
|
||||
}
|
||||
return instance;
|
||||
};
|
||||
}
|
||||
}
|
||||
// Monkey patch all of the jasmine DSL so that each function runs in appropriate zone.
|
||||
const jasmineEnv = jasmine.getEnv();
|
||||
['describe', 'xdescribe', 'fdescribe'].forEach((methodName) => {
|
||||
let originalJasmineFn = jasmineEnv[methodName];
|
||||
jasmineEnv[methodName] = function (description, specDefinitions) {
|
||||
return originalJasmineFn.call(this, description, wrapDescribeInZone(description, specDefinitions));
|
||||
};
|
||||
});
|
||||
['it', 'xit', 'fit'].forEach((methodName) => {
|
||||
let originalJasmineFn = jasmineEnv[methodName];
|
||||
jasmineEnv[symbol(methodName)] = originalJasmineFn;
|
||||
jasmineEnv[methodName] = function (description, specDefinitions, timeout) {
|
||||
arguments[1] = wrapTestInZone(specDefinitions);
|
||||
return originalJasmineFn.apply(this, arguments);
|
||||
};
|
||||
});
|
||||
['beforeEach', 'afterEach', 'beforeAll', 'afterAll'].forEach((methodName) => {
|
||||
let originalJasmineFn = jasmineEnv[methodName];
|
||||
jasmineEnv[symbol(methodName)] = originalJasmineFn;
|
||||
jasmineEnv[methodName] = function (specDefinitions, timeout) {
|
||||
arguments[0] = wrapTestInZone(specDefinitions);
|
||||
return originalJasmineFn.apply(this, arguments);
|
||||
};
|
||||
});
|
||||
if (!disablePatchingJasmineClock) {
|
||||
// need to patch jasmine.clock().mockDate and jasmine.clock().tick() so
|
||||
// they can work properly in FakeAsyncTest
|
||||
const originalClockFn = (jasmine[symbol('clock')] = jasmine['clock']);
|
||||
jasmine['clock'] = function () {
|
||||
const clock = originalClockFn.apply(this, arguments);
|
||||
if (!clock[symbol('patched')]) {
|
||||
clock[symbol('patched')] = symbol('patched');
|
||||
const originalTick = (clock[symbol('tick')] = clock.tick);
|
||||
clock.tick = function () {
|
||||
const fakeAsyncZoneSpec = Zone.current.get('FakeAsyncTestZoneSpec');
|
||||
if (fakeAsyncZoneSpec) {
|
||||
return fakeAsyncZoneSpec.tick.apply(fakeAsyncZoneSpec, arguments);
|
||||
}
|
||||
return originalTick.apply(this, arguments);
|
||||
};
|
||||
const originalMockDate = (clock[symbol('mockDate')] = clock.mockDate);
|
||||
clock.mockDate = function () {
|
||||
const fakeAsyncZoneSpec = Zone.current.get('FakeAsyncTestZoneSpec');
|
||||
if (fakeAsyncZoneSpec) {
|
||||
const dateTime = arguments.length > 0 ? arguments[0] : new Date();
|
||||
return fakeAsyncZoneSpec.setFakeBaseSystemTime.apply(fakeAsyncZoneSpec, dateTime && typeof dateTime.getTime === 'function'
|
||||
? [dateTime.getTime()]
|
||||
: arguments);
|
||||
}
|
||||
return originalMockDate.apply(this, arguments);
|
||||
};
|
||||
// for auto go into fakeAsync feature, we need the flag to enable it
|
||||
if (enableAutoFakeAsyncWhenClockPatched) {
|
||||
['install', 'uninstall'].forEach((methodName) => {
|
||||
const originalClockFn = (clock[symbol(methodName)] = clock[methodName]);
|
||||
clock[methodName] = function () {
|
||||
const FakeAsyncTestZoneSpec = Zone['FakeAsyncTestZoneSpec'];
|
||||
if (FakeAsyncTestZoneSpec) {
|
||||
jasmine[symbol('clockInstalled')] = 'install' === methodName;
|
||||
return;
|
||||
}
|
||||
return originalClockFn.apply(this, arguments);
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
return clock;
|
||||
};
|
||||
}
|
||||
// monkey patch createSpyObj to make properties enumerable to true
|
||||
if (!jasmine[Zone.__symbol__('createSpyObj')]) {
|
||||
const originalCreateSpyObj = jasmine.createSpyObj;
|
||||
jasmine[Zone.__symbol__('createSpyObj')] = originalCreateSpyObj;
|
||||
jasmine.createSpyObj = function () {
|
||||
const args = Array.prototype.slice.call(arguments);
|
||||
const propertyNames = args.length >= 3 ? args[2] : null;
|
||||
let spyObj;
|
||||
if (propertyNames) {
|
||||
const defineProperty = Object.defineProperty;
|
||||
Object.defineProperty = function (obj, p, attributes) {
|
||||
return defineProperty.call(this, obj, p, {
|
||||
...attributes,
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
});
|
||||
};
|
||||
try {
|
||||
spyObj = originalCreateSpyObj.apply(this, args);
|
||||
}
|
||||
finally {
|
||||
Object.defineProperty = defineProperty;
|
||||
}
|
||||
}
|
||||
else {
|
||||
spyObj = originalCreateSpyObj.apply(this, args);
|
||||
}
|
||||
return spyObj;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Gets a function wrapping the body of a Jasmine `describe` block to execute in a
|
||||
* synchronous-only zone.
|
||||
*/
|
||||
function wrapDescribeInZone(description, describeBody) {
|
||||
return function () {
|
||||
// Create a synchronous-only zone in which to run `describe` blocks in order to raise an
|
||||
// error if any asynchronous operations are attempted inside of a `describe`.
|
||||
const syncZone = ambientZone.fork(new SyncTestZoneSpec(`jasmine.describe#${description}`));
|
||||
return syncZone.run(describeBody, this, arguments);
|
||||
};
|
||||
}
|
||||
function runInTestZone(testBody, applyThis, queueRunner, done) {
|
||||
const isClockInstalled = !!jasmine[symbol('clockInstalled')];
|
||||
queueRunner.testProxyZoneSpec;
|
||||
const testProxyZone = queueRunner.testProxyZone;
|
||||
if (isClockInstalled && enableAutoFakeAsyncWhenClockPatched) {
|
||||
// auto run a fakeAsync
|
||||
const fakeAsyncModule = Zone[Zone.__symbol__('fakeAsyncTest')];
|
||||
if (fakeAsyncModule && typeof fakeAsyncModule.fakeAsync === 'function') {
|
||||
testBody = fakeAsyncModule.fakeAsync(testBody);
|
||||
}
|
||||
}
|
||||
if (done) {
|
||||
return testProxyZone.run(testBody, applyThis, [done]);
|
||||
}
|
||||
else {
|
||||
return testProxyZone.run(testBody, applyThis);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Gets a function wrapping the body of a Jasmine `it/beforeEach/afterEach` block to
|
||||
* execute in a ProxyZone zone.
|
||||
* This will run in `testProxyZone`. The `testProxyZone` will be reset by the `ZoneQueueRunner`
|
||||
*/
|
||||
function wrapTestInZone(testBody) {
|
||||
// The `done` callback is only passed through if the function expects at least one argument.
|
||||
// Note we have to make a function with correct number of arguments, otherwise jasmine will
|
||||
// think that all functions are sync or async.
|
||||
return (testBody &&
|
||||
(testBody.length
|
||||
? function (done) {
|
||||
return runInTestZone(testBody, this, this.queueRunner, done);
|
||||
}
|
||||
: function () {
|
||||
return runInTestZone(testBody, this, this.queueRunner);
|
||||
}));
|
||||
}
|
||||
const QueueRunner = jasmine.QueueRunner;
|
||||
jasmine.QueueRunner = (function (_super) {
|
||||
__extends(ZoneQueueRunner, _super);
|
||||
function ZoneQueueRunner(attrs) {
|
||||
if (attrs.onComplete) {
|
||||
attrs.onComplete = ((fn) => () => {
|
||||
// All functions are done, clear the test zone.
|
||||
this.testProxyZone = null;
|
||||
this.testProxyZoneSpec = null;
|
||||
ambientZone.scheduleMicroTask('jasmine.onComplete', fn);
|
||||
})(attrs.onComplete);
|
||||
}
|
||||
const nativeSetTimeout = global[Zone.__symbol__('setTimeout')];
|
||||
const nativeClearTimeout = global[Zone.__symbol__('clearTimeout')];
|
||||
if (nativeSetTimeout) {
|
||||
// should run setTimeout inside jasmine outside of zone
|
||||
attrs.timeout = {
|
||||
setTimeout: nativeSetTimeout ? nativeSetTimeout : global.setTimeout,
|
||||
clearTimeout: nativeClearTimeout ? nativeClearTimeout : global.clearTimeout,
|
||||
};
|
||||
}
|
||||
// create a userContext to hold the queueRunner itself
|
||||
// so we can access the testProxy in it/xit/beforeEach ...
|
||||
if (jasmine.UserContext) {
|
||||
if (!attrs.userContext) {
|
||||
attrs.userContext = new jasmine.UserContext();
|
||||
}
|
||||
attrs.userContext.queueRunner = this;
|
||||
}
|
||||
else {
|
||||
if (!attrs.userContext) {
|
||||
attrs.userContext = {};
|
||||
}
|
||||
attrs.userContext.queueRunner = this;
|
||||
}
|
||||
// patch attrs.onException
|
||||
const onException = attrs.onException;
|
||||
attrs.onException = function (error) {
|
||||
if (error &&
|
||||
error.message ===
|
||||
'Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.') {
|
||||
// jasmine timeout, we can make the error message more
|
||||
// reasonable to tell what tasks are pending
|
||||
const proxyZoneSpec = this && this.testProxyZoneSpec;
|
||||
if (proxyZoneSpec) {
|
||||
const pendingTasksInfo = proxyZoneSpec.getAndClearPendingTasksInfo();
|
||||
try {
|
||||
// try catch here in case error.message is not writable
|
||||
error.message += pendingTasksInfo;
|
||||
}
|
||||
catch (err) { }
|
||||
}
|
||||
}
|
||||
if (onException) {
|
||||
onException.call(this, error);
|
||||
}
|
||||
};
|
||||
_super.call(this, attrs);
|
||||
}
|
||||
ZoneQueueRunner.prototype.execute = function () {
|
||||
let zone = Zone.current;
|
||||
let isChildOfAmbientZone = false;
|
||||
while (zone) {
|
||||
if (zone === ambientZone) {
|
||||
isChildOfAmbientZone = true;
|
||||
break;
|
||||
}
|
||||
zone = zone.parent;
|
||||
}
|
||||
if (!isChildOfAmbientZone)
|
||||
throw new Error('Unexpected Zone: ' + Zone.current.name);
|
||||
// This is the zone which will be used for running individual tests.
|
||||
// It will be a proxy zone, so that the tests function can retroactively install
|
||||
// different zones.
|
||||
// Example:
|
||||
// - In beforeEach() do childZone = Zone.current.fork(...);
|
||||
// - In it() try to do fakeAsync(). The issue is that because the beforeEach forked the
|
||||
// zone outside of fakeAsync it will be able to escape the fakeAsync rules.
|
||||
// - Because ProxyZone is parent fo `childZone` fakeAsync can retroactively add
|
||||
// fakeAsync behavior to the childZone.
|
||||
this.testProxyZoneSpec = new ProxyZoneSpec();
|
||||
this.testProxyZone = ambientZone.fork(this.testProxyZoneSpec);
|
||||
if (!Zone.currentTask) {
|
||||
// if we are not running in a task then if someone would register a
|
||||
// element.addEventListener and then calling element.click() the
|
||||
// addEventListener callback would think that it is the top most task and would
|
||||
// drain the microtask queue on element.click() which would be incorrect.
|
||||
// For this reason we always force a task when running jasmine tests.
|
||||
Zone.current.scheduleMicroTask('jasmine.execute().forceTask', () => QueueRunner.prototype.execute.call(this));
|
||||
}
|
||||
else {
|
||||
_super.prototype.execute.call(this);
|
||||
}
|
||||
};
|
||||
return ZoneQueueRunner;
|
||||
})(QueueRunner);
|
||||
});
|
||||
}
|
||||
|
||||
patchJasmine(Zone);
|
6
node_modules/zone.js/fesm2015/jasmine-patch.min.js
generated
vendored
Executable file
6
node_modules/zone.js/fesm2015/jasmine-patch.min.js
generated
vendored
Executable file
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/function patchJasmine(e){e.__load_patch("jasmine",((e,n,t)=>{if(!n)throw new Error("Missing: zone.js");if("undefined"!=typeof jest)return;if("undefined"==typeof jasmine||jasmine.__zone_patch__)return;jasmine.__zone_patch__=!0;const o=n.SyncTestZoneSpec,s=n.ProxyZoneSpec;if(!o)throw new Error("Missing: SyncTestZoneSpec");if(!s)throw new Error("Missing: ProxyZoneSpec");const r=n.current,c=n.__symbol__,i=!0===e[c("fakeAsyncDisablePatchingClock")],a=!i&&(!0===e[c("fakeAsyncPatchLock")]||!0===e[c("fakeAsyncAutoFakeAsyncWhenClockPatched")]);if(!0!==e[c("ignoreUnhandledRejection")]){const n=jasmine.GlobalErrors;n&&!jasmine[c("GlobalErrors")]&&(jasmine[c("GlobalErrors")]=n,jasmine.GlobalErrors=function(){const t=new n,o=t.install;return o&&!t[c("install")]&&(t[c("install")]=o,t.install=function(){const n="undefined"!=typeof process&&!!process.on,t=n?process.listeners("unhandledRejection"):e.eventListeners("unhandledrejection"),s=o.apply(this,arguments);return n?process.removeAllListeners("unhandledRejection"):e.removeAllListeners("unhandledrejection"),t&&t.forEach((t=>{n?process.on("unhandledRejection",t):e.addEventListener("unhandledrejection",t)})),s}),t})}const l=jasmine.getEnv();if(["describe","xdescribe","fdescribe"].forEach((e=>{let n=l[e];l[e]=function(e,t){return n.call(this,e,function s(e,n){return function(){return r.fork(new o(`jasmine.describe#${e}`)).run(n,this,arguments)}}(e,t))}})),["it","xit","fit"].forEach((e=>{let n=l[e];l[c(e)]=n,l[e]=function(e,t,o){return arguments[1]=p(t),n.apply(this,arguments)}})),["beforeEach","afterEach","beforeAll","afterAll"].forEach((e=>{let n=l[e];l[c(e)]=n,l[e]=function(e,t){return arguments[0]=p(e),n.apply(this,arguments)}})),!i){const e=jasmine[c("clock")]=jasmine.clock;jasmine.clock=function(){const t=e.apply(this,arguments);if(!t[c("patched")]){t[c("patched")]=c("patched");const e=t[c("tick")]=t.tick;t.tick=function(){const t=n.current.get("FakeAsyncTestZoneSpec");return t?t.tick.apply(t,arguments):e.apply(this,arguments)};const o=t[c("mockDate")]=t.mockDate;t.mockDate=function(){const e=n.current.get("FakeAsyncTestZoneSpec");if(e){const n=arguments.length>0?arguments[0]:new Date;return e.setFakeBaseSystemTime.apply(e,n&&"function"==typeof n.getTime?[n.getTime()]:arguments)}return o.apply(this,arguments)},a&&["install","uninstall"].forEach((e=>{const o=t[c(e)]=t[e];t[e]=function(){if(!n.FakeAsyncTestZoneSpec)return o.apply(this,arguments);jasmine[c("clockInstalled")]="install"===e}}))}return t}}if(!jasmine[n.__symbol__("createSpyObj")]){const e=jasmine.createSpyObj;jasmine[n.__symbol__("createSpyObj")]=e,jasmine.createSpyObj=function(){const n=Array.prototype.slice.call(arguments);let t;if(n.length>=3&&n[2]){const o=Object.defineProperty;Object.defineProperty=function(e,n,t){return o.call(this,e,n,{...t,configurable:!0,enumerable:!0})};try{t=e.apply(this,n)}finally{Object.defineProperty=o}}else t=e.apply(this,n);return t}}function u(e,t,o,s){const r=!!jasmine[c("clockInstalled")],i=o.testProxyZone;if(r&&a){const t=n[n.__symbol__("fakeAsyncTest")];t&&"function"==typeof t.fakeAsync&&(e=t.fakeAsync(e))}return s?i.run(e,t,[s]):i.run(e,t)}function p(e){return e&&(e.length?function(n){return u(e,this,this.queueRunner,n)}:function(){return u(e,this,this.queueRunner)})}const f=jasmine.QueueRunner;jasmine.QueueRunner=function(t){function o(o){o.onComplete&&(o.onComplete=(e=>()=>{this.testProxyZone=null,this.testProxyZoneSpec=null,r.scheduleMicroTask("jasmine.onComplete",e)})(o.onComplete));const s=e[n.__symbol__("setTimeout")],c=e[n.__symbol__("clearTimeout")];s&&(o.timeout={setTimeout:s||e.setTimeout,clearTimeout:c||e.clearTimeout}),jasmine.UserContext?(o.userContext||(o.userContext=new jasmine.UserContext),o.userContext.queueRunner=this):(o.userContext||(o.userContext={}),o.userContext.queueRunner=this);const i=o.onException;o.onException=function(e){if(e&&"Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL."===e.message){const n=this&&this.testProxyZoneSpec;if(n){const t=n.getAndClearPendingTasksInfo();try{e.message+=t}catch(e){}}}i&&i.call(this,e)},t.call(this,o)}return function(e,n){for(const t in n)n.hasOwnProperty(t)&&(e[t]=n[t]);function t(){this.constructor=e}e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}(o,t),o.prototype.execute=function(){let e=n.current,o=!1;for(;e;){if(e===r){o=!0;break}e=e.parent}if(!o)throw new Error("Unexpected Zone: "+n.current.name);this.testProxyZoneSpec=new s,this.testProxyZone=r.fork(this.testProxyZoneSpec),n.currentTask?t.prototype.execute.call(this):n.current.scheduleMicroTask("jasmine.execute().forceTask",(()=>f.prototype.execute.call(this)))},o}(f)}))}patchJasmine(Zone);
|
171
node_modules/zone.js/fesm2015/long-stack-trace-zone.js
generated
vendored
Executable file
171
node_modules/zone.js/fesm2015/long-stack-trace-zone.js
generated
vendored
Executable file
|
@ -0,0 +1,171 @@
|
|||
'use strict';
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/
|
||||
/**
|
||||
* @fileoverview
|
||||
* @suppress {globalThis}
|
||||
*/
|
||||
function patchLongStackTrace(Zone) {
|
||||
const NEWLINE = '\n';
|
||||
const IGNORE_FRAMES = {};
|
||||
const creationTrace = '__creationTrace__';
|
||||
const ERROR_TAG = 'STACKTRACE TRACKING';
|
||||
const SEP_TAG = '__SEP_TAG__';
|
||||
let sepTemplate = SEP_TAG + '@[native]';
|
||||
class LongStackTrace {
|
||||
constructor() {
|
||||
this.error = getStacktrace();
|
||||
this.timestamp = new Date();
|
||||
}
|
||||
}
|
||||
function getStacktraceWithUncaughtError() {
|
||||
return new Error(ERROR_TAG);
|
||||
}
|
||||
function getStacktraceWithCaughtError() {
|
||||
try {
|
||||
throw getStacktraceWithUncaughtError();
|
||||
}
|
||||
catch (err) {
|
||||
return err;
|
||||
}
|
||||
}
|
||||
// Some implementations of exception handling don't create a stack trace if the exception
|
||||
// isn't thrown, however it's faster not to actually throw the exception.
|
||||
const error = getStacktraceWithUncaughtError();
|
||||
const caughtError = getStacktraceWithCaughtError();
|
||||
const getStacktrace = error.stack
|
||||
? getStacktraceWithUncaughtError
|
||||
: caughtError.stack
|
||||
? getStacktraceWithCaughtError
|
||||
: getStacktraceWithUncaughtError;
|
||||
function getFrames(error) {
|
||||
return error.stack ? error.stack.split(NEWLINE) : [];
|
||||
}
|
||||
function addErrorStack(lines, error) {
|
||||
let trace = getFrames(error);
|
||||
for (let i = 0; i < trace.length; i++) {
|
||||
const frame = trace[i];
|
||||
// Filter out the Frames which are part of stack capturing.
|
||||
if (!IGNORE_FRAMES.hasOwnProperty(frame)) {
|
||||
lines.push(trace[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
function renderLongStackTrace(frames, stack) {
|
||||
const longTrace = [stack ? stack.trim() : ''];
|
||||
if (frames) {
|
||||
let timestamp = new Date().getTime();
|
||||
for (let i = 0; i < frames.length; i++) {
|
||||
const traceFrames = frames[i];
|
||||
const lastTime = traceFrames.timestamp;
|
||||
let separator = `____________________Elapsed ${timestamp - lastTime.getTime()} ms; At: ${lastTime}`;
|
||||
separator = separator.replace(/[^\w\d]/g, '_');
|
||||
longTrace.push(sepTemplate.replace(SEP_TAG, separator));
|
||||
addErrorStack(longTrace, traceFrames.error);
|
||||
timestamp = lastTime.getTime();
|
||||
}
|
||||
}
|
||||
return longTrace.join(NEWLINE);
|
||||
}
|
||||
// if Error.stackTraceLimit is 0, means stack trace
|
||||
// is disabled, so we don't need to generate long stack trace
|
||||
// this will improve performance in some test(some test will
|
||||
// set stackTraceLimit to 0, https://github.com/angular/zone.js/issues/698
|
||||
function stackTracesEnabled() {
|
||||
// Cast through any since this property only exists on Error in the nodejs
|
||||
// typings.
|
||||
return Error.stackTraceLimit > 0;
|
||||
}
|
||||
Zone['longStackTraceZoneSpec'] = {
|
||||
name: 'long-stack-trace',
|
||||
longStackTraceLimit: 10, // Max number of task to keep the stack trace for.
|
||||
// add a getLongStackTrace method in spec to
|
||||
// handle handled reject promise error.
|
||||
getLongStackTrace: function (error) {
|
||||
if (!error) {
|
||||
return undefined;
|
||||
}
|
||||
const trace = error[Zone.__symbol__('currentTaskTrace')];
|
||||
if (!trace) {
|
||||
return error.stack;
|
||||
}
|
||||
return renderLongStackTrace(trace, error.stack);
|
||||
},
|
||||
onScheduleTask: function (parentZoneDelegate, currentZone, targetZone, task) {
|
||||
if (stackTracesEnabled()) {
|
||||
const currentTask = Zone.currentTask;
|
||||
let trace = (currentTask && currentTask.data && currentTask.data[creationTrace]) || [];
|
||||
trace = [new LongStackTrace()].concat(trace);
|
||||
if (trace.length > this.longStackTraceLimit) {
|
||||
trace.length = this.longStackTraceLimit;
|
||||
}
|
||||
if (!task.data)
|
||||
task.data = {};
|
||||
if (task.type === 'eventTask') {
|
||||
// Fix issue https://github.com/angular/zone.js/issues/1195,
|
||||
// For event task of browser, by default, all task will share a
|
||||
// singleton instance of data object, we should create a new one here
|
||||
// The cast to `any` is required to workaround a closure bug which wrongly applies
|
||||
// URL sanitization rules to .data access.
|
||||
task.data = { ...task.data };
|
||||
}
|
||||
task.data[creationTrace] = trace;
|
||||
}
|
||||
return parentZoneDelegate.scheduleTask(targetZone, task);
|
||||
},
|
||||
onHandleError: function (parentZoneDelegate, currentZone, targetZone, error) {
|
||||
if (stackTracesEnabled()) {
|
||||
const parentTask = Zone.currentTask || error.task;
|
||||
if (error instanceof Error && parentTask) {
|
||||
const longStack = renderLongStackTrace(parentTask.data && parentTask.data[creationTrace], error.stack);
|
||||
try {
|
||||
error.stack = error.longStack = longStack;
|
||||
}
|
||||
catch (err) { }
|
||||
}
|
||||
}
|
||||
return parentZoneDelegate.handleError(targetZone, error);
|
||||
},
|
||||
};
|
||||
function captureStackTraces(stackTraces, count) {
|
||||
if (count > 0) {
|
||||
stackTraces.push(getFrames(new LongStackTrace().error));
|
||||
captureStackTraces(stackTraces, count - 1);
|
||||
}
|
||||
}
|
||||
function computeIgnoreFrames() {
|
||||
if (!stackTracesEnabled()) {
|
||||
return;
|
||||
}
|
||||
const frames = [];
|
||||
captureStackTraces(frames, 2);
|
||||
const frames1 = frames[0];
|
||||
const frames2 = frames[1];
|
||||
for (let i = 0; i < frames1.length; i++) {
|
||||
const frame1 = frames1[i];
|
||||
if (frame1.indexOf(ERROR_TAG) == -1) {
|
||||
let match = frame1.match(/^\s*at\s+/);
|
||||
if (match) {
|
||||
sepTemplate = match[0] + SEP_TAG + ' (http://localhost)';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < frames1.length; i++) {
|
||||
const frame1 = frames1[i];
|
||||
const frame2 = frames2[i];
|
||||
if (frame1 === frame2) {
|
||||
IGNORE_FRAMES[frame1] = true;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
computeIgnoreFrames();
|
||||
}
|
||||
|
||||
patchLongStackTrace(Zone);
|
6
node_modules/zone.js/fesm2015/long-stack-trace-zone.min.js
generated
vendored
Executable file
6
node_modules/zone.js/fesm2015/long-stack-trace-zone.min.js
generated
vendored
Executable file
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/function patchLongStackTrace(t){const n="\n",e={},a="__creationTrace__",r="STACKTRACE TRACKING",c="__SEP_TAG__";let o=c+"@[native]";class s{constructor(){this.error=f(),this.timestamp=new Date}}function i(){return new Error(r)}function l(){try{throw i()}catch(t){return t}}const _=i(),u=l(),f=_.stack?i:u.stack?l:i;function k(t){return t.stack?t.stack.split(n):[]}function h(t,n){let a=k(n);for(let n=0;n<a.length;n++)e.hasOwnProperty(a[n])||t.push(a[n])}function T(t,e){const a=[e?e.trim():""];if(t){let n=(new Date).getTime();for(let e=0;e<t.length;e++){const r=t[e],s=r.timestamp;let i=`____________________Elapsed ${n-s.getTime()} ms; At: ${s}`;i=i.replace(/[^\w\d]/g,"_"),a.push(o.replace(c,i)),h(a,r.error),n=s.getTime()}}return a.join(n)}function g(){return Error.stackTraceLimit>0}function d(t,n){n>0&&(t.push(k((new s).error)),d(t,n-1))}t.longStackTraceZoneSpec={name:"long-stack-trace",longStackTraceLimit:10,getLongStackTrace:function(n){if(!n)return;const e=n[t.__symbol__("currentTaskTrace")];return e?T(e,n.stack):n.stack},onScheduleTask:function(n,e,r,c){if(g()){const n=t.currentTask;let e=n&&n.data&&n.data[a]||[];e=[new s].concat(e),e.length>this.longStackTraceLimit&&(e.length=this.longStackTraceLimit),c.data||(c.data={}),"eventTask"===c.type&&(c.data={...c.data}),c.data[a]=e}return n.scheduleTask(r,c)},onHandleError:function(n,e,r,c){if(g()){const n=t.currentTask||c.task;if(c instanceof Error&&n){const t=T(n.data&&n.data[a],c.stack);try{c.stack=c.longStack=t}catch(t){}}}return n.handleError(r,c)}},function m(){if(!g())return;const t=[];d(t,2);const n=t[0],a=t[1];for(let t=0;t<n.length;t++){const e=n[t];if(-1==e.indexOf(r)){let t=e.match(/^\s*at\s+/);if(t){o=t[0]+c+" (http://localhost)";break}}}for(let t=0;t<n.length;t++){const r=n[t];if(r!==a[t])break;e[r]=!0}}()}patchLongStackTrace(Zone);
|
157
node_modules/zone.js/fesm2015/mocha-patch.js
generated
vendored
Executable file
157
node_modules/zone.js/fesm2015/mocha-patch.js
generated
vendored
Executable file
|
@ -0,0 +1,157 @@
|
|||
'use strict';
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/
|
||||
function patchMocha(Zone) {
|
||||
Zone.__load_patch('mocha', (global, Zone) => {
|
||||
const Mocha = global.Mocha;
|
||||
if (typeof Mocha === 'undefined') {
|
||||
// return if Mocha is not available, because now zone-testing
|
||||
// will load mocha patch with jasmine/jest patch
|
||||
return;
|
||||
}
|
||||
if (typeof Zone === 'undefined') {
|
||||
throw new Error('Missing Zone.js');
|
||||
}
|
||||
const ProxyZoneSpec = Zone['ProxyZoneSpec'];
|
||||
const SyncTestZoneSpec = Zone['SyncTestZoneSpec'];
|
||||
if (!ProxyZoneSpec) {
|
||||
throw new Error('Missing ProxyZoneSpec');
|
||||
}
|
||||
if (Mocha['__zone_patch__']) {
|
||||
throw new Error('"Mocha" has already been patched with "Zone".');
|
||||
}
|
||||
Mocha['__zone_patch__'] = true;
|
||||
const rootZone = Zone.current;
|
||||
const syncZone = rootZone.fork(new SyncTestZoneSpec('Mocha.describe'));
|
||||
let testZone = null;
|
||||
const suiteZone = rootZone.fork(new ProxyZoneSpec());
|
||||
const mochaOriginal = {
|
||||
after: global.after,
|
||||
afterEach: global.afterEach,
|
||||
before: global.before,
|
||||
beforeEach: global.beforeEach,
|
||||
describe: global.describe,
|
||||
it: global.it,
|
||||
};
|
||||
function modifyArguments(args, syncTest, asyncTest) {
|
||||
for (let i = 0; i < args.length; i++) {
|
||||
let arg = args[i];
|
||||
if (typeof arg === 'function') {
|
||||
// The `done` callback is only passed through if the function expects at
|
||||
// least one argument.
|
||||
// Note we have to make a function with correct number of arguments,
|
||||
// otherwise mocha will
|
||||
// think that all functions are sync or async.
|
||||
args[i] = arg.length === 0 ? syncTest(arg) : asyncTest(arg);
|
||||
// Mocha uses toString to view the test body in the result list, make sure we return the
|
||||
// correct function body
|
||||
args[i].toString = function () {
|
||||
return arg.toString();
|
||||
};
|
||||
}
|
||||
}
|
||||
return args;
|
||||
}
|
||||
function wrapDescribeInZone(args) {
|
||||
const syncTest = function (fn) {
|
||||
return function () {
|
||||
return syncZone.run(fn, this, arguments);
|
||||
};
|
||||
};
|
||||
return modifyArguments(args, syncTest);
|
||||
}
|
||||
function wrapTestInZone(args) {
|
||||
const asyncTest = function (fn) {
|
||||
return function (done) {
|
||||
return testZone.run(fn, this, [done]);
|
||||
};
|
||||
};
|
||||
const syncTest = function (fn) {
|
||||
return function () {
|
||||
return testZone.run(fn, this);
|
||||
};
|
||||
};
|
||||
return modifyArguments(args, syncTest, asyncTest);
|
||||
}
|
||||
function wrapSuiteInZone(args) {
|
||||
const asyncTest = function (fn) {
|
||||
return function (done) {
|
||||
return suiteZone.run(fn, this, [done]);
|
||||
};
|
||||
};
|
||||
const syncTest = function (fn) {
|
||||
return function () {
|
||||
return suiteZone.run(fn, this);
|
||||
};
|
||||
};
|
||||
return modifyArguments(args, syncTest, asyncTest);
|
||||
}
|
||||
global.describe = global.suite = function () {
|
||||
return mochaOriginal.describe.apply(this, wrapDescribeInZone(arguments));
|
||||
};
|
||||
global.xdescribe =
|
||||
global.suite.skip =
|
||||
global.describe.skip =
|
||||
function () {
|
||||
return mochaOriginal.describe.skip.apply(this, wrapDescribeInZone(arguments));
|
||||
};
|
||||
global.describe.only = global.suite.only = function () {
|
||||
return mochaOriginal.describe.only.apply(this, wrapDescribeInZone(arguments));
|
||||
};
|
||||
global.it =
|
||||
global.specify =
|
||||
global.test =
|
||||
function () {
|
||||
return mochaOriginal.it.apply(this, wrapTestInZone(arguments));
|
||||
};
|
||||
global.xit =
|
||||
global.xspecify =
|
||||
global.it.skip =
|
||||
function () {
|
||||
return mochaOriginal.it.skip.apply(this, wrapTestInZone(arguments));
|
||||
};
|
||||
global.it.only = global.test.only = function () {
|
||||
return mochaOriginal.it.only.apply(this, wrapTestInZone(arguments));
|
||||
};
|
||||
global.after = global.suiteTeardown = function () {
|
||||
return mochaOriginal.after.apply(this, wrapSuiteInZone(arguments));
|
||||
};
|
||||
global.afterEach = global.teardown = function () {
|
||||
return mochaOriginal.afterEach.apply(this, wrapTestInZone(arguments));
|
||||
};
|
||||
global.before = global.suiteSetup = function () {
|
||||
return mochaOriginal.before.apply(this, wrapSuiteInZone(arguments));
|
||||
};
|
||||
global.beforeEach = global.setup = function () {
|
||||
return mochaOriginal.beforeEach.apply(this, wrapTestInZone(arguments));
|
||||
};
|
||||
((originalRunTest, originalRun) => {
|
||||
Mocha.Runner.prototype.runTest = function (fn) {
|
||||
Zone.current.scheduleMicroTask('mocha.forceTask', () => {
|
||||
originalRunTest.call(this, fn);
|
||||
});
|
||||
};
|
||||
Mocha.Runner.prototype.run = function (fn) {
|
||||
this.on('test', (e) => {
|
||||
testZone = rootZone.fork(new ProxyZoneSpec());
|
||||
});
|
||||
this.on('fail', (test, err) => {
|
||||
const proxyZoneSpec = testZone && testZone.get('ProxyZoneSpec');
|
||||
if (proxyZoneSpec && err) {
|
||||
try {
|
||||
// try catch here in case err.message is not writable
|
||||
err.message += proxyZoneSpec.getAndClearPendingTasksInfo();
|
||||
}
|
||||
catch (error) { }
|
||||
}
|
||||
});
|
||||
return originalRun.call(this, fn);
|
||||
};
|
||||
})(Mocha.Runner.prototype.runTest, Mocha.Runner.prototype.run);
|
||||
});
|
||||
}
|
||||
|
||||
patchMocha(Zone);
|
6
node_modules/zone.js/fesm2015/mocha-patch.min.js
generated
vendored
Executable file
6
node_modules/zone.js/fesm2015/mocha-patch.min.js
generated
vendored
Executable file
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/function patchMocha(t){t.__load_patch("mocha",((t,n)=>{const e=t.Mocha;if(void 0===e)return;if(void 0===n)throw new Error("Missing Zone.js");const r=n.ProxyZoneSpec,o=n.SyncTestZoneSpec;if(!r)throw new Error("Missing ProxyZoneSpec");if(e.__zone_patch__)throw new Error('"Mocha" has already been patched with "Zone".');e.__zone_patch__=!0;const i=n.current,c=i.fork(new o("Mocha.describe"));let u=null;const s=i.fork(new r),f={after:t.after,afterEach:t.afterEach,before:t.before,beforeEach:t.beforeEach,describe:t.describe,it:t.it};function a(t,n,e){for(let r=0;r<t.length;r++){let o=t[r];"function"==typeof o&&(t[r]=0===o.length?n(o):e(o),t[r].toString=function(){return o.toString()})}return t}function h(t){return a(t,(function(t){return function(){return c.run(t,this,arguments)}}))}function p(t){return a(t,(function(t){return function(){return u.run(t,this)}}),(function(t){return function(n){return u.run(t,this,[n])}}))}function l(t){return a(t,(function(t){return function(){return s.run(t,this)}}),(function(t){return function(n){return s.run(t,this,[n])}}))}var y,d;t.describe=t.suite=function(){return f.describe.apply(this,h(arguments))},t.xdescribe=t.suite.skip=t.describe.skip=function(){return f.describe.skip.apply(this,h(arguments))},t.describe.only=t.suite.only=function(){return f.describe.only.apply(this,h(arguments))},t.it=t.specify=t.test=function(){return f.it.apply(this,p(arguments))},t.xit=t.xspecify=t.it.skip=function(){return f.it.skip.apply(this,p(arguments))},t.it.only=t.test.only=function(){return f.it.only.apply(this,p(arguments))},t.after=t.suiteTeardown=function(){return f.after.apply(this,l(arguments))},t.afterEach=t.teardown=function(){return f.afterEach.apply(this,p(arguments))},t.before=t.suiteSetup=function(){return f.before.apply(this,l(arguments))},t.beforeEach=t.setup=function(){return f.beforeEach.apply(this,p(arguments))},y=e.Runner.prototype.runTest,d=e.Runner.prototype.run,e.Runner.prototype.runTest=function(t){n.current.scheduleMicroTask("mocha.forceTask",(()=>{y.call(this,t)}))},e.Runner.prototype.run=function(t){return this.on("test",(t=>{u=i.fork(new r)})),this.on("fail",((t,n)=>{const e=u&&u.get("ProxyZoneSpec");if(e&&n)try{n.message+=e.getAndClearPendingTasksInfo()}catch(t){}})),d.call(this,t)}}))}patchMocha(Zone);
|
175
node_modules/zone.js/fesm2015/proxy.js
generated
vendored
Executable file
175
node_modules/zone.js/fesm2015/proxy.js
generated
vendored
Executable file
|
@ -0,0 +1,175 @@
|
|||
'use strict';
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/
|
||||
class ProxyZoneSpec {
|
||||
static get() {
|
||||
return Zone.current.get('ProxyZoneSpec');
|
||||
}
|
||||
static isLoaded() {
|
||||
return ProxyZoneSpec.get() instanceof ProxyZoneSpec;
|
||||
}
|
||||
static assertPresent() {
|
||||
if (!ProxyZoneSpec.isLoaded()) {
|
||||
throw new Error(`Expected to be running in 'ProxyZone', but it was not found.`);
|
||||
}
|
||||
return ProxyZoneSpec.get();
|
||||
}
|
||||
constructor(defaultSpecDelegate = null) {
|
||||
this.defaultSpecDelegate = defaultSpecDelegate;
|
||||
this.name = 'ProxyZone';
|
||||
this._delegateSpec = null;
|
||||
this.properties = { 'ProxyZoneSpec': this };
|
||||
this.propertyKeys = null;
|
||||
this.lastTaskState = null;
|
||||
this.isNeedToTriggerHasTask = false;
|
||||
this.tasks = [];
|
||||
this.setDelegate(defaultSpecDelegate);
|
||||
}
|
||||
setDelegate(delegateSpec) {
|
||||
const isNewDelegate = this._delegateSpec !== delegateSpec;
|
||||
this._delegateSpec = delegateSpec;
|
||||
this.propertyKeys && this.propertyKeys.forEach((key) => delete this.properties[key]);
|
||||
this.propertyKeys = null;
|
||||
if (delegateSpec && delegateSpec.properties) {
|
||||
this.propertyKeys = Object.keys(delegateSpec.properties);
|
||||
this.propertyKeys.forEach((k) => (this.properties[k] = delegateSpec.properties[k]));
|
||||
}
|
||||
// if a new delegateSpec was set, check if we need to trigger hasTask
|
||||
if (isNewDelegate &&
|
||||
this.lastTaskState &&
|
||||
(this.lastTaskState.macroTask || this.lastTaskState.microTask)) {
|
||||
this.isNeedToTriggerHasTask = true;
|
||||
}
|
||||
}
|
||||
getDelegate() {
|
||||
return this._delegateSpec;
|
||||
}
|
||||
resetDelegate() {
|
||||
this.getDelegate();
|
||||
this.setDelegate(this.defaultSpecDelegate);
|
||||
}
|
||||
tryTriggerHasTask(parentZoneDelegate, currentZone, targetZone) {
|
||||
if (this.isNeedToTriggerHasTask && this.lastTaskState) {
|
||||
// last delegateSpec has microTask or macroTask
|
||||
// should call onHasTask in current delegateSpec
|
||||
this.isNeedToTriggerHasTask = false;
|
||||
this.onHasTask(parentZoneDelegate, currentZone, targetZone, this.lastTaskState);
|
||||
}
|
||||
}
|
||||
removeFromTasks(task) {
|
||||
if (!this.tasks) {
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < this.tasks.length; i++) {
|
||||
if (this.tasks[i] === task) {
|
||||
this.tasks.splice(i, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
getAndClearPendingTasksInfo() {
|
||||
if (this.tasks.length === 0) {
|
||||
return '';
|
||||
}
|
||||
const taskInfo = this.tasks.map((task) => {
|
||||
const dataInfo = task.data &&
|
||||
Object.keys(task.data)
|
||||
.map((key) => {
|
||||
return key + ':' + task.data[key];
|
||||
})
|
||||
.join(',');
|
||||
return `type: ${task.type}, source: ${task.source}, args: {${dataInfo}}`;
|
||||
});
|
||||
const pendingTasksInfo = '--Pending async tasks are: [' + taskInfo + ']';
|
||||
// clear tasks
|
||||
this.tasks = [];
|
||||
return pendingTasksInfo;
|
||||
}
|
||||
onFork(parentZoneDelegate, currentZone, targetZone, zoneSpec) {
|
||||
if (this._delegateSpec && this._delegateSpec.onFork) {
|
||||
return this._delegateSpec.onFork(parentZoneDelegate, currentZone, targetZone, zoneSpec);
|
||||
}
|
||||
else {
|
||||
return parentZoneDelegate.fork(targetZone, zoneSpec);
|
||||
}
|
||||
}
|
||||
onIntercept(parentZoneDelegate, currentZone, targetZone, delegate, source) {
|
||||
if (this._delegateSpec && this._delegateSpec.onIntercept) {
|
||||
return this._delegateSpec.onIntercept(parentZoneDelegate, currentZone, targetZone, delegate, source);
|
||||
}
|
||||
else {
|
||||
return parentZoneDelegate.intercept(targetZone, delegate, source);
|
||||
}
|
||||
}
|
||||
onInvoke(parentZoneDelegate, currentZone, targetZone, delegate, applyThis, applyArgs, source) {
|
||||
this.tryTriggerHasTask(parentZoneDelegate, currentZone, targetZone);
|
||||
if (this._delegateSpec && this._delegateSpec.onInvoke) {
|
||||
return this._delegateSpec.onInvoke(parentZoneDelegate, currentZone, targetZone, delegate, applyThis, applyArgs, source);
|
||||
}
|
||||
else {
|
||||
return parentZoneDelegate.invoke(targetZone, delegate, applyThis, applyArgs, source);
|
||||
}
|
||||
}
|
||||
onHandleError(parentZoneDelegate, currentZone, targetZone, error) {
|
||||
if (this._delegateSpec && this._delegateSpec.onHandleError) {
|
||||
return this._delegateSpec.onHandleError(parentZoneDelegate, currentZone, targetZone, error);
|
||||
}
|
||||
else {
|
||||
return parentZoneDelegate.handleError(targetZone, error);
|
||||
}
|
||||
}
|
||||
onScheduleTask(parentZoneDelegate, currentZone, targetZone, task) {
|
||||
if (task.type !== 'eventTask') {
|
||||
this.tasks.push(task);
|
||||
}
|
||||
if (this._delegateSpec && this._delegateSpec.onScheduleTask) {
|
||||
return this._delegateSpec.onScheduleTask(parentZoneDelegate, currentZone, targetZone, task);
|
||||
}
|
||||
else {
|
||||
return parentZoneDelegate.scheduleTask(targetZone, task);
|
||||
}
|
||||
}
|
||||
onInvokeTask(parentZoneDelegate, currentZone, targetZone, task, applyThis, applyArgs) {
|
||||
if (task.type !== 'eventTask') {
|
||||
this.removeFromTasks(task);
|
||||
}
|
||||
this.tryTriggerHasTask(parentZoneDelegate, currentZone, targetZone);
|
||||
if (this._delegateSpec && this._delegateSpec.onInvokeTask) {
|
||||
return this._delegateSpec.onInvokeTask(parentZoneDelegate, currentZone, targetZone, task, applyThis, applyArgs);
|
||||
}
|
||||
else {
|
||||
return parentZoneDelegate.invokeTask(targetZone, task, applyThis, applyArgs);
|
||||
}
|
||||
}
|
||||
onCancelTask(parentZoneDelegate, currentZone, targetZone, task) {
|
||||
if (task.type !== 'eventTask') {
|
||||
this.removeFromTasks(task);
|
||||
}
|
||||
this.tryTriggerHasTask(parentZoneDelegate, currentZone, targetZone);
|
||||
if (this._delegateSpec && this._delegateSpec.onCancelTask) {
|
||||
return this._delegateSpec.onCancelTask(parentZoneDelegate, currentZone, targetZone, task);
|
||||
}
|
||||
else {
|
||||
return parentZoneDelegate.cancelTask(targetZone, task);
|
||||
}
|
||||
}
|
||||
onHasTask(delegate, current, target, hasTaskState) {
|
||||
this.lastTaskState = hasTaskState;
|
||||
if (this._delegateSpec && this._delegateSpec.onHasTask) {
|
||||
this._delegateSpec.onHasTask(delegate, current, target, hasTaskState);
|
||||
}
|
||||
else {
|
||||
delegate.hasTask(target, hasTaskState);
|
||||
}
|
||||
}
|
||||
}
|
||||
function patchProxyZoneSpec(Zone) {
|
||||
// Export the class so that new instances can be created with proper
|
||||
// constructor params.
|
||||
Zone['ProxyZoneSpec'] = ProxyZoneSpec;
|
||||
}
|
||||
|
||||
patchProxyZoneSpec(Zone);
|
6
node_modules/zone.js/fesm2015/proxy.min.js
generated
vendored
Executable file
6
node_modules/zone.js/fesm2015/proxy.min.js
generated
vendored
Executable file
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/class ProxyZoneSpec{static get(){return Zone.current.get("ProxyZoneSpec")}static isLoaded(){return ProxyZoneSpec.get()instanceof ProxyZoneSpec}static assertPresent(){if(!ProxyZoneSpec.isLoaded())throw new Error("Expected to be running in 'ProxyZone', but it was not found.");return ProxyZoneSpec.get()}constructor(e=null){this.defaultSpecDelegate=e,this.name="ProxyZone",this._delegateSpec=null,this.properties={ProxyZoneSpec:this},this.propertyKeys=null,this.lastTaskState=null,this.isNeedToTriggerHasTask=!1,this.tasks=[],this.setDelegate(e)}setDelegate(e){const t=this._delegateSpec!==e;this._delegateSpec=e,this.propertyKeys&&this.propertyKeys.forEach((e=>delete this.properties[e])),this.propertyKeys=null,e&&e.properties&&(this.propertyKeys=Object.keys(e.properties),this.propertyKeys.forEach((t=>this.properties[t]=e.properties[t]))),t&&this.lastTaskState&&(this.lastTaskState.macroTask||this.lastTaskState.microTask)&&(this.isNeedToTriggerHasTask=!0)}getDelegate(){return this._delegateSpec}resetDelegate(){this.getDelegate(),this.setDelegate(this.defaultSpecDelegate)}tryTriggerHasTask(e,t,s){this.isNeedToTriggerHasTask&&this.lastTaskState&&(this.isNeedToTriggerHasTask=!1,this.onHasTask(e,t,s,this.lastTaskState))}removeFromTasks(e){if(this.tasks)for(let t=0;t<this.tasks.length;t++)if(this.tasks[t]===e)return void this.tasks.splice(t,1)}getAndClearPendingTasksInfo(){if(0===this.tasks.length)return"";const e="--Pending async tasks are: ["+this.tasks.map((e=>{const t=e.data&&Object.keys(e.data).map((t=>t+":"+e.data[t])).join(",");return`type: ${e.type}, source: ${e.source}, args: {${t}}`}))+"]";return this.tasks=[],e}onFork(e,t,s,a){return this._delegateSpec&&this._delegateSpec.onFork?this._delegateSpec.onFork(e,t,s,a):e.fork(s,a)}onIntercept(e,t,s,a,r){return this._delegateSpec&&this._delegateSpec.onIntercept?this._delegateSpec.onIntercept(e,t,s,a,r):e.intercept(s,a,r)}onInvoke(e,t,s,a,r,o,i){return this.tryTriggerHasTask(e,t,s),this._delegateSpec&&this._delegateSpec.onInvoke?this._delegateSpec.onInvoke(e,t,s,a,r,o,i):e.invoke(s,a,r,o,i)}onHandleError(e,t,s,a){return this._delegateSpec&&this._delegateSpec.onHandleError?this._delegateSpec.onHandleError(e,t,s,a):e.handleError(s,a)}onScheduleTask(e,t,s,a){return"eventTask"!==a.type&&this.tasks.push(a),this._delegateSpec&&this._delegateSpec.onScheduleTask?this._delegateSpec.onScheduleTask(e,t,s,a):e.scheduleTask(s,a)}onInvokeTask(e,t,s,a,r,o){return"eventTask"!==a.type&&this.removeFromTasks(a),this.tryTriggerHasTask(e,t,s),this._delegateSpec&&this._delegateSpec.onInvokeTask?this._delegateSpec.onInvokeTask(e,t,s,a,r,o):e.invokeTask(s,a,r,o)}onCancelTask(e,t,s,a){return"eventTask"!==a.type&&this.removeFromTasks(a),this.tryTriggerHasTask(e,t,s),this._delegateSpec&&this._delegateSpec.onCancelTask?this._delegateSpec.onCancelTask(e,t,s,a):e.cancelTask(s,a)}onHasTask(e,t,s,a){this.lastTaskState=a,this._delegateSpec&&this._delegateSpec.onHasTask?this._delegateSpec.onHasTask(e,t,s,a):e.hasTask(s,a)}}function patchProxyZoneSpec(e){e.ProxyZoneSpec=ProxyZoneSpec}patchProxyZoneSpec(Zone);
|
30
node_modules/zone.js/fesm2015/sync-test.js
generated
vendored
Executable file
30
node_modules/zone.js/fesm2015/sync-test.js
generated
vendored
Executable file
|
@ -0,0 +1,30 @@
|
|||
'use strict';
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/
|
||||
function patchSyncTest(Zone) {
|
||||
class SyncTestZoneSpec {
|
||||
constructor(namePrefix) {
|
||||
this.runZone = Zone.current;
|
||||
this.name = 'syncTestZone for ' + namePrefix;
|
||||
}
|
||||
onScheduleTask(delegate, current, target, task) {
|
||||
switch (task.type) {
|
||||
case 'microTask':
|
||||
case 'macroTask':
|
||||
throw new Error(`Cannot call ${task.source} from within a sync test (${this.name}).`);
|
||||
case 'eventTask':
|
||||
task = delegate.scheduleTask(target, task);
|
||||
break;
|
||||
}
|
||||
return task;
|
||||
}
|
||||
}
|
||||
// Export the class so that new instances can be created with proper
|
||||
// constructor params.
|
||||
Zone['SyncTestZoneSpec'] = SyncTestZoneSpec;
|
||||
}
|
||||
|
||||
patchSyncTest(Zone);
|
6
node_modules/zone.js/fesm2015/sync-test.min.js
generated
vendored
Executable file
6
node_modules/zone.js/fesm2015/sync-test.min.js
generated
vendored
Executable file
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/function patchSyncTest(e){e.SyncTestZoneSpec=class{constructor(s){this.runZone=e.current,this.name="syncTestZone for "+s}onScheduleTask(e,s,c,t){switch(t.type){case"microTask":case"macroTask":throw new Error(`Cannot call ${t.source} from within a sync test (${this.name}).`);case"eventTask":t=e.scheduleTask(c,t)}return t}}}patchSyncTest(Zone);
|
75
node_modules/zone.js/fesm2015/task-tracking.js
generated
vendored
Executable file
75
node_modules/zone.js/fesm2015/task-tracking.js
generated
vendored
Executable file
|
@ -0,0 +1,75 @@
|
|||
'use strict';
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/
|
||||
/**
|
||||
* A `TaskTrackingZoneSpec` allows one to track all outstanding Tasks.
|
||||
*
|
||||
* This is useful in tests. For example to see which tasks are preventing a test from completing
|
||||
* or an automated way of releasing all of the event listeners at the end of the test.
|
||||
*/
|
||||
class TaskTrackingZoneSpec {
|
||||
constructor() {
|
||||
this.name = 'TaskTrackingZone';
|
||||
this.microTasks = [];
|
||||
this.macroTasks = [];
|
||||
this.eventTasks = [];
|
||||
this.properties = { 'TaskTrackingZone': this };
|
||||
}
|
||||
static get() {
|
||||
return Zone.current.get('TaskTrackingZone');
|
||||
}
|
||||
getTasksFor(type) {
|
||||
switch (type) {
|
||||
case 'microTask':
|
||||
return this.microTasks;
|
||||
case 'macroTask':
|
||||
return this.macroTasks;
|
||||
case 'eventTask':
|
||||
return this.eventTasks;
|
||||
}
|
||||
throw new Error('Unknown task format: ' + type);
|
||||
}
|
||||
onScheduleTask(parentZoneDelegate, currentZone, targetZone, task) {
|
||||
task['creationLocation'] = new Error(`Task '${task.type}' from '${task.source}'.`);
|
||||
const tasks = this.getTasksFor(task.type);
|
||||
tasks.push(task);
|
||||
return parentZoneDelegate.scheduleTask(targetZone, task);
|
||||
}
|
||||
onCancelTask(parentZoneDelegate, currentZone, targetZone, task) {
|
||||
const tasks = this.getTasksFor(task.type);
|
||||
for (let i = 0; i < tasks.length; i++) {
|
||||
if (tasks[i] == task) {
|
||||
tasks.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return parentZoneDelegate.cancelTask(targetZone, task);
|
||||
}
|
||||
onInvokeTask(parentZoneDelegate, currentZone, targetZone, task, applyThis, applyArgs) {
|
||||
if (task.type === 'eventTask' || task.data?.isPeriodic)
|
||||
return parentZoneDelegate.invokeTask(targetZone, task, applyThis, applyArgs);
|
||||
const tasks = this.getTasksFor(task.type);
|
||||
for (let i = 0; i < tasks.length; i++) {
|
||||
if (tasks[i] == task) {
|
||||
tasks.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return parentZoneDelegate.invokeTask(targetZone, task, applyThis, applyArgs);
|
||||
}
|
||||
clearEvents() {
|
||||
while (this.eventTasks.length) {
|
||||
Zone.current.cancelTask(this.eventTasks[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
function patchTaskTracking(Zone) {
|
||||
// Export the class so that new instances can be created with proper
|
||||
// constructor params.
|
||||
Zone['TaskTrackingZoneSpec'] = TaskTrackingZoneSpec;
|
||||
}
|
||||
|
||||
patchTaskTracking(Zone);
|
6
node_modules/zone.js/fesm2015/task-tracking.min.js
generated
vendored
Executable file
6
node_modules/zone.js/fesm2015/task-tracking.min.js
generated
vendored
Executable file
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/class TaskTrackingZoneSpec{constructor(){this.name="TaskTrackingZone",this.microTasks=[],this.macroTasks=[],this.eventTasks=[],this.properties={TaskTrackingZone:this}}static get(){return Zone.current.get("TaskTrackingZone")}getTasksFor(s){switch(s){case"microTask":return this.microTasks;case"macroTask":return this.macroTasks;case"eventTask":return this.eventTasks}throw new Error("Unknown task format: "+s)}onScheduleTask(s,e,t,a){return a.creationLocation=new Error(`Task '${a.type}' from '${a.source}'.`),this.getTasksFor(a.type).push(a),s.scheduleTask(t,a)}onCancelTask(s,e,t,a){const r=this.getTasksFor(a.type);for(let s=0;s<r.length;s++)if(r[s]==a){r.splice(s,1);break}return s.cancelTask(t,a)}onInvokeTask(s,e,t,a,r,n){if("eventTask"===a.type||a.data?.isPeriodic)return s.invokeTask(t,a,r,n);const k=this.getTasksFor(a.type);for(let s=0;s<k.length;s++)if(k[s]==a){k.splice(s,1);break}return s.invokeTask(t,a,r,n)}clearEvents(){for(;this.eventTasks.length;)Zone.current.cancelTask(this.eventTasks[0])}}function patchTaskTracking(s){s.TaskTrackingZoneSpec=TaskTrackingZoneSpec}patchTaskTracking(Zone);
|
71
node_modules/zone.js/fesm2015/webapis-media-query.js
generated
vendored
Executable file
71
node_modules/zone.js/fesm2015/webapis-media-query.js
generated
vendored
Executable file
|
@ -0,0 +1,71 @@
|
|||
'use strict';
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/
|
||||
function patchMediaQuery(Zone) {
|
||||
Zone.__load_patch('mediaQuery', (global, Zone, api) => {
|
||||
function patchAddListener(proto) {
|
||||
api.patchMethod(proto, 'addListener', (delegate) => (self, args) => {
|
||||
const callback = args.length > 0 ? args[0] : null;
|
||||
if (typeof callback === 'function') {
|
||||
const wrapperedCallback = Zone.current.wrap(callback, 'MediaQuery');
|
||||
callback[api.symbol('mediaQueryCallback')] = wrapperedCallback;
|
||||
return delegate.call(self, wrapperedCallback);
|
||||
}
|
||||
else {
|
||||
return delegate.apply(self, args);
|
||||
}
|
||||
});
|
||||
}
|
||||
function patchRemoveListener(proto) {
|
||||
api.patchMethod(proto, 'removeListener', (delegate) => (self, args) => {
|
||||
const callback = args.length > 0 ? args[0] : null;
|
||||
if (typeof callback === 'function') {
|
||||
const wrapperedCallback = callback[api.symbol('mediaQueryCallback')];
|
||||
if (wrapperedCallback) {
|
||||
return delegate.call(self, wrapperedCallback);
|
||||
}
|
||||
else {
|
||||
return delegate.apply(self, args);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return delegate.apply(self, args);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (global['MediaQueryList']) {
|
||||
const proto = global['MediaQueryList'].prototype;
|
||||
patchAddListener(proto);
|
||||
patchRemoveListener(proto);
|
||||
}
|
||||
else if (global['matchMedia']) {
|
||||
api.patchMethod(global, 'matchMedia', (delegate) => (self, args) => {
|
||||
const mql = delegate.apply(self, args);
|
||||
if (mql) {
|
||||
// try to patch MediaQueryList.prototype
|
||||
const proto = Object.getPrototypeOf(mql);
|
||||
if (proto && proto['addListener']) {
|
||||
// try to patch proto, don't need to worry about patch
|
||||
// multiple times, because, api.patchEventTarget will check it
|
||||
patchAddListener(proto);
|
||||
patchRemoveListener(proto);
|
||||
patchAddListener(mql);
|
||||
patchRemoveListener(mql);
|
||||
}
|
||||
else if (mql['addListener']) {
|
||||
// proto not exists, or proto has no addListener method
|
||||
// try to patch mql instance
|
||||
patchAddListener(mql);
|
||||
patchRemoveListener(mql);
|
||||
}
|
||||
}
|
||||
return mql;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
patchMediaQuery(Zone);
|
6
node_modules/zone.js/fesm2015/webapis-media-query.min.js
generated
vendored
Executable file
6
node_modules/zone.js/fesm2015/webapis-media-query.min.js
generated
vendored
Executable file
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/function patchMediaQuery(e){e.__load_patch("mediaQuery",((e,t,a)=>{function n(e){a.patchMethod(e,"addListener",(e=>(n,r)=>{const c=r.length>0?r[0]:null;if("function"==typeof c){const r=t.current.wrap(c,"MediaQuery");return c[a.symbol("mediaQueryCallback")]=r,e.call(n,r)}return e.apply(n,r)}))}function r(e){a.patchMethod(e,"removeListener",(e=>(t,n)=>{const r=n.length>0?n[0]:null;if("function"==typeof r){const c=r[a.symbol("mediaQueryCallback")];return c?e.call(t,c):e.apply(t,n)}return e.apply(t,n)}))}if(e.MediaQueryList){const t=e.MediaQueryList.prototype;n(t),r(t)}else e.matchMedia&&a.patchMethod(e,"matchMedia",(e=>(t,a)=>{const c=e.apply(t,a);if(c){const e=Object.getPrototypeOf(c);e&&e.addListener?(n(e),r(e),n(c),r(c)):c.addListener&&(n(c),r(c))}return c}))}))}patchMediaQuery(Zone);
|
21
node_modules/zone.js/fesm2015/webapis-notification.js
generated
vendored
Executable file
21
node_modules/zone.js/fesm2015/webapis-notification.js
generated
vendored
Executable file
|
@ -0,0 +1,21 @@
|
|||
'use strict';
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/
|
||||
function patchNotifications(Zone) {
|
||||
Zone.__load_patch('notification', (global, Zone, api) => {
|
||||
const Notification = global['Notification'];
|
||||
if (!Notification || !Notification.prototype) {
|
||||
return;
|
||||
}
|
||||
const desc = Object.getOwnPropertyDescriptor(Notification.prototype, 'onerror');
|
||||
if (!desc || !desc.configurable) {
|
||||
return;
|
||||
}
|
||||
api.patchOnProperties(Notification.prototype, null);
|
||||
});
|
||||
}
|
||||
|
||||
patchNotifications(Zone);
|
6
node_modules/zone.js/fesm2015/webapis-notification.min.js
generated
vendored
Executable file
6
node_modules/zone.js/fesm2015/webapis-notification.min.js
generated
vendored
Executable file
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/function patchNotifications(t){t.__load_patch("notification",((t,o,i)=>{const n=t.Notification;if(!n||!n.prototype)return;const r=Object.getOwnPropertyDescriptor(n.prototype,"onerror");r&&r.configurable&&i.patchOnProperties(n.prototype,null)}))}patchNotifications(Zone);
|
25
node_modules/zone.js/fesm2015/webapis-rtc-peer-connection.js
generated
vendored
Executable file
25
node_modules/zone.js/fesm2015/webapis-rtc-peer-connection.js
generated
vendored
Executable file
|
@ -0,0 +1,25 @@
|
|||
'use strict';
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/
|
||||
function patchRtcPeerConnection(Zone) {
|
||||
Zone.__load_patch('RTCPeerConnection', (global, Zone, api) => {
|
||||
const RTCPeerConnection = global['RTCPeerConnection'];
|
||||
if (!RTCPeerConnection) {
|
||||
return;
|
||||
}
|
||||
const addSymbol = api.symbol('addEventListener');
|
||||
const removeSymbol = api.symbol('removeEventListener');
|
||||
RTCPeerConnection.prototype.addEventListener = RTCPeerConnection.prototype[addSymbol];
|
||||
RTCPeerConnection.prototype.removeEventListener = RTCPeerConnection.prototype[removeSymbol];
|
||||
// RTCPeerConnection extends EventTarget, so we must clear the symbol
|
||||
// to allow patch RTCPeerConnection.prototype.addEventListener again
|
||||
RTCPeerConnection.prototype[addSymbol] = null;
|
||||
RTCPeerConnection.prototype[removeSymbol] = null;
|
||||
api.patchEventTarget(global, api, [RTCPeerConnection.prototype], { useG: false });
|
||||
});
|
||||
}
|
||||
|
||||
patchRtcPeerConnection(Zone);
|
6
node_modules/zone.js/fesm2015/webapis-rtc-peer-connection.min.js
generated
vendored
Executable file
6
node_modules/zone.js/fesm2015/webapis-rtc-peer-connection.min.js
generated
vendored
Executable file
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/function patchRtcPeerConnection(e){e.__load_patch("RTCPeerConnection",((e,t,o)=>{const n=e.RTCPeerConnection;if(!n)return;const r=o.symbol("addEventListener"),p=o.symbol("removeEventListener");n.prototype.addEventListener=n.prototype[r],n.prototype.removeEventListener=n.prototype[p],n.prototype[r]=null,n.prototype[p]=null,o.patchEventTarget(e,o,[n.prototype],{useG:!1})}))}patchRtcPeerConnection(Zone);
|
34
node_modules/zone.js/fesm2015/webapis-shadydom.js
generated
vendored
Executable file
34
node_modules/zone.js/fesm2015/webapis-shadydom.js
generated
vendored
Executable file
|
@ -0,0 +1,34 @@
|
|||
'use strict';
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/
|
||||
function patchShadyDom(Zone) {
|
||||
Zone.__load_patch('shadydom', (global, Zone, api) => {
|
||||
// https://github.com/angular/zone.js/issues/782
|
||||
// in web components, shadydom will patch addEventListener/removeEventListener of
|
||||
// Node.prototype and WindowPrototype, this will have conflict with zone.js
|
||||
// so zone.js need to patch them again.
|
||||
const HTMLSlotElement = global.HTMLSlotElement;
|
||||
const prototypes = [
|
||||
Object.getPrototypeOf(window),
|
||||
Node.prototype,
|
||||
Text.prototype,
|
||||
Element.prototype,
|
||||
HTMLElement.prototype,
|
||||
HTMLSlotElement && HTMLSlotElement.prototype,
|
||||
DocumentFragment.prototype,
|
||||
Document.prototype,
|
||||
];
|
||||
prototypes.forEach(function (proto) {
|
||||
if (proto && proto.hasOwnProperty('addEventListener')) {
|
||||
proto[Zone.__symbol__('addEventListener')] = null;
|
||||
proto[Zone.__symbol__('removeEventListener')] = null;
|
||||
api.patchEventTarget(global, api, [proto]);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
patchShadyDom(Zone);
|
6
node_modules/zone.js/fesm2015/webapis-shadydom.min.js
generated
vendored
Executable file
6
node_modules/zone.js/fesm2015/webapis-shadydom.min.js
generated
vendored
Executable file
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/function patchShadyDom(t){t.__load_patch("shadydom",((t,e,o)=>{const n=t.HTMLSlotElement;[Object.getPrototypeOf(window),Node.prototype,Text.prototype,Element.prototype,HTMLElement.prototype,n&&n.prototype,DocumentFragment.prototype,Document.prototype].forEach((function(n){n&&n.hasOwnProperty("addEventListener")&&(n[e.__symbol__("addEventListener")]=null,n[e.__symbol__("removeEventListener")]=null,o.patchEventTarget(t,o,[n]))}))}))}patchShadyDom(Zone);
|
117
node_modules/zone.js/fesm2015/wtf.js
generated
vendored
Executable file
117
node_modules/zone.js/fesm2015/wtf.js
generated
vendored
Executable file
|
@ -0,0 +1,117 @@
|
|||
'use strict';
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/
|
||||
/**
|
||||
* @fileoverview
|
||||
* @suppress {missingRequire}
|
||||
*/
|
||||
const _global = (typeof window === 'object' && window) || (typeof self === 'object' && self) || global;
|
||||
function patchWtf(Zone) {
|
||||
// Detect and setup WTF.
|
||||
let wtfTrace = null;
|
||||
let wtfEvents = null;
|
||||
const wtfEnabled = (function () {
|
||||
const wtf = _global['wtf'];
|
||||
if (wtf) {
|
||||
wtfTrace = wtf.trace;
|
||||
if (wtfTrace) {
|
||||
wtfEvents = wtfTrace.events;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
})();
|
||||
class WtfZoneSpec {
|
||||
constructor() {
|
||||
this.name = 'WTF';
|
||||
}
|
||||
static { this.forkInstance = wtfEnabled
|
||||
? wtfEvents.createInstance('Zone:fork(ascii zone, ascii newZone)')
|
||||
: null; }
|
||||
static { this.scheduleInstance = {}; }
|
||||
static { this.cancelInstance = {}; }
|
||||
static { this.invokeScope = {}; }
|
||||
static { this.invokeTaskScope = {}; }
|
||||
onFork(parentZoneDelegate, currentZone, targetZone, zoneSpec) {
|
||||
const retValue = parentZoneDelegate.fork(targetZone, zoneSpec);
|
||||
WtfZoneSpec.forkInstance(zonePathName(targetZone), retValue.name);
|
||||
return retValue;
|
||||
}
|
||||
onInvoke(parentZoneDelegate, currentZone, targetZone, delegate, applyThis, applyArgs, source) {
|
||||
const src = source || 'unknown';
|
||||
let scope = WtfZoneSpec.invokeScope[src];
|
||||
if (!scope) {
|
||||
scope = WtfZoneSpec.invokeScope[src] = wtfEvents.createScope(`Zone:invoke:${source}(ascii zone)`);
|
||||
}
|
||||
return wtfTrace.leaveScope(scope(zonePathName(targetZone)), parentZoneDelegate.invoke(targetZone, delegate, applyThis, applyArgs, source));
|
||||
}
|
||||
onHandleError(parentZoneDelegate, currentZone, targetZone, error) {
|
||||
return parentZoneDelegate.handleError(targetZone, error);
|
||||
}
|
||||
onScheduleTask(parentZoneDelegate, currentZone, targetZone, task) {
|
||||
const key = task.type + ':' + task.source;
|
||||
let instance = WtfZoneSpec.scheduleInstance[key];
|
||||
if (!instance) {
|
||||
instance = WtfZoneSpec.scheduleInstance[key] = wtfEvents.createInstance(`Zone:schedule:${key}(ascii zone, any data)`);
|
||||
}
|
||||
const retValue = parentZoneDelegate.scheduleTask(targetZone, task);
|
||||
instance(zonePathName(targetZone), shallowObj(task.data, 2));
|
||||
return retValue;
|
||||
}
|
||||
onInvokeTask(parentZoneDelegate, currentZone, targetZone, task, applyThis, applyArgs) {
|
||||
const source = task.source;
|
||||
let scope = WtfZoneSpec.invokeTaskScope[source];
|
||||
if (!scope) {
|
||||
scope = WtfZoneSpec.invokeTaskScope[source] = wtfEvents.createScope(`Zone:invokeTask:${source}(ascii zone)`);
|
||||
}
|
||||
return wtfTrace.leaveScope(scope(zonePathName(targetZone)), parentZoneDelegate.invokeTask(targetZone, task, applyThis, applyArgs));
|
||||
}
|
||||
onCancelTask(parentZoneDelegate, currentZone, targetZone, task) {
|
||||
const key = task.source;
|
||||
let instance = WtfZoneSpec.cancelInstance[key];
|
||||
if (!instance) {
|
||||
instance = WtfZoneSpec.cancelInstance[key] = wtfEvents.createInstance(`Zone:cancel:${key}(ascii zone, any options)`);
|
||||
}
|
||||
const retValue = parentZoneDelegate.cancelTask(targetZone, task);
|
||||
instance(zonePathName(targetZone), shallowObj(task.data, 2));
|
||||
return retValue;
|
||||
}
|
||||
}
|
||||
function shallowObj(obj, depth) {
|
||||
if (!obj || !depth)
|
||||
return null;
|
||||
const out = {};
|
||||
for (const key in obj) {
|
||||
if (obj.hasOwnProperty(key)) {
|
||||
// explicit : any due to https://github.com/microsoft/TypeScript/issues/33191
|
||||
let value = obj[key];
|
||||
switch (typeof value) {
|
||||
case 'object':
|
||||
const name = value && value.constructor && value.constructor.name;
|
||||
value = name == Object.name ? shallowObj(value, depth - 1) : name;
|
||||
break;
|
||||
case 'function':
|
||||
value = value.name || undefined;
|
||||
break;
|
||||
}
|
||||
out[key] = value;
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
function zonePathName(zone) {
|
||||
let name = zone.name;
|
||||
let localZone = zone.parent;
|
||||
while (localZone != null) {
|
||||
name = localZone.name + '::' + name;
|
||||
localZone = localZone.parent;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
Zone['wtfZoneSpec'] = !wtfEnabled ? null : new WtfZoneSpec();
|
||||
}
|
||||
|
||||
patchWtf(Zone);
|
6
node_modules/zone.js/fesm2015/wtf.min.js
generated
vendored
Executable file
6
node_modules/zone.js/fesm2015/wtf.min.js
generated
vendored
Executable file
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/const _global="object"==typeof window&&window||"object"==typeof self&&self||global;function patchWtf(e){let n=null,t=null;const c=function(){const e=_global.wtf;return!(!e||(n=e.trace,!n)||(t=n.events,0))}();class o{constructor(){this.name="WTF"}static{this.forkInstance=c?t.createInstance("Zone:fork(ascii zone, ascii newZone)"):null}static{this.scheduleInstance={}}static{this.cancelInstance={}}static{this.invokeScope={}}static{this.invokeTaskScope={}}onFork(e,n,t,c){const a=e.fork(t,c);return o.forkInstance(s(t),a.name),a}onInvoke(e,c,a,r,i,l,u){const k=u||"unknown";let f=o.invokeScope[k];return f||(f=o.invokeScope[k]=t.createScope(`Zone:invoke:${u}(ascii zone)`)),n.leaveScope(f(s(a)),e.invoke(a,r,i,l,u))}onHandleError(e,n,t,c){return e.handleError(t,c)}onScheduleTask(e,n,c,r){const i=r.type+":"+r.source;let l=o.scheduleInstance[i];l||(l=o.scheduleInstance[i]=t.createInstance(`Zone:schedule:${i}(ascii zone, any data)`));const u=e.scheduleTask(c,r);return l(s(c),a(r.data,2)),u}onInvokeTask(e,c,a,r,i,l){const u=r.source;let k=o.invokeTaskScope[u];return k||(k=o.invokeTaskScope[u]=t.createScope(`Zone:invokeTask:${u}(ascii zone)`)),n.leaveScope(k(s(a)),e.invokeTask(a,r,i,l))}onCancelTask(e,n,c,r){const i=r.source;let l=o.cancelInstance[i];l||(l=o.cancelInstance[i]=t.createInstance(`Zone:cancel:${i}(ascii zone, any options)`));const u=e.cancelTask(c,r);return l(s(c),a(r.data,2)),u}}function a(e,n){if(!e||!n)return null;const t={};for(const c in e)if(e.hasOwnProperty(c)){let o=e[c];switch(typeof o){case"object":const e=o&&o.constructor&&o.constructor.name;o=e==Object.name?a(o,n-1):e;break;case"function":o=o.name||void 0}t[c]=o}return t}function s(e){let n=e.name,t=e.parent;for(;null!=t;)n=t.name+"::"+n,t=t.parent;return n}e.wtfZoneSpec=c?new o:null}patchWtf(Zone);
|
87
node_modules/zone.js/fesm2015/zone-bluebird.js
generated
vendored
Executable file
87
node_modules/zone.js/fesm2015/zone-bluebird.js
generated
vendored
Executable file
|
@ -0,0 +1,87 @@
|
|||
'use strict';
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/
|
||||
function patchBluebird(Zone) {
|
||||
Zone.__load_patch('bluebird', (global, Zone, api) => {
|
||||
// TODO: @JiaLiPassion, we can automatically patch bluebird
|
||||
// if global.Promise = Bluebird, but sometimes in nodejs,
|
||||
// global.Promise is not Bluebird, and Bluebird is just be
|
||||
// used by other libraries such as sequelize, so I think it is
|
||||
// safe to just expose a method to patch Bluebird explicitly
|
||||
const BLUEBIRD = 'bluebird';
|
||||
Zone[Zone.__symbol__(BLUEBIRD)] = function patchBluebird(Bluebird) {
|
||||
// patch method of Bluebird.prototype which not using `then` internally
|
||||
const bluebirdApis = ['then', 'spread', 'finally'];
|
||||
bluebirdApis.forEach((bapi) => {
|
||||
api.patchMethod(Bluebird.prototype, bapi, (delegate) => (self, args) => {
|
||||
const zone = Zone.current;
|
||||
for (let i = 0; i < args.length; i++) {
|
||||
const func = args[i];
|
||||
if (typeof func === 'function') {
|
||||
args[i] = function () {
|
||||
const argSelf = this;
|
||||
const argArgs = arguments;
|
||||
return new Bluebird((res, rej) => {
|
||||
zone.scheduleMicroTask('Promise.then', () => {
|
||||
try {
|
||||
res(func.apply(argSelf, argArgs));
|
||||
}
|
||||
catch (error) {
|
||||
rej(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
return delegate.apply(self, args);
|
||||
});
|
||||
});
|
||||
if (typeof window !== 'undefined') {
|
||||
window.addEventListener('unhandledrejection', function (event) {
|
||||
const error = event.detail && event.detail.reason;
|
||||
if (error && error.isHandledByZone) {
|
||||
event.preventDefault();
|
||||
if (typeof event.stopImmediatePropagation === 'function') {
|
||||
event.stopImmediatePropagation();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (typeof process !== 'undefined') {
|
||||
process.on('unhandledRejection', (reason, p) => {
|
||||
if (reason && reason.isHandledByZone) {
|
||||
const listeners = process.listeners('unhandledRejection');
|
||||
if (listeners) {
|
||||
// remove unhandledRejection listeners so the callback
|
||||
// will not be triggered.
|
||||
process.removeAllListeners('unhandledRejection');
|
||||
process.nextTick(() => {
|
||||
listeners.forEach((listener) => process.on('unhandledRejection', listener));
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
Bluebird.onPossiblyUnhandledRejection(function (e, promise) {
|
||||
try {
|
||||
Zone.current.runGuarded(() => {
|
||||
e.isHandledByZone = true;
|
||||
throw e;
|
||||
});
|
||||
}
|
||||
catch (err) {
|
||||
err.isHandledByZone = false;
|
||||
api.onUnhandledError(err);
|
||||
}
|
||||
});
|
||||
// override global promise
|
||||
global.Promise = Bluebird;
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
patchBluebird(Zone);
|
6
node_modules/zone.js/fesm2015/zone-bluebird.min.js
generated
vendored
Executable file
6
node_modules/zone.js/fesm2015/zone-bluebird.min.js
generated
vendored
Executable file
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/function patchBluebird(e){e.__load_patch("bluebird",((e,n,o)=>{n[n.__symbol__("bluebird")]=function t(d){["then","spread","finally"].forEach((e=>{o.patchMethod(d.prototype,e,(e=>(o,t)=>{const r=n.current;for(let e=0;e<t.length;e++){const n=t[e];"function"==typeof n&&(t[e]=function(){const e=this,o=arguments;return new d(((t,d)=>{r.scheduleMicroTask("Promise.then",(()=>{try{t(n.apply(e,o))}catch(e){d(e)}}))}))})}return e.apply(o,t)}))})),"undefined"!=typeof window?window.addEventListener("unhandledrejection",(function(e){const n=e.detail&&e.detail.reason;n&&n.isHandledByZone&&(e.preventDefault(),"function"==typeof e.stopImmediatePropagation&&e.stopImmediatePropagation())})):"undefined"!=typeof process&&process.on("unhandledRejection",((e,n)=>{if(e&&e.isHandledByZone){const e=process.listeners("unhandledRejection");e&&(process.removeAllListeners("unhandledRejection"),process.nextTick((()=>{e.forEach((e=>process.on("unhandledRejection",e)))})))}})),d.onPossiblyUnhandledRejection((function(e,t){try{n.current.runGuarded((()=>{throw e.isHandledByZone=!0,e}))}catch(e){e.isHandledByZone=!1,o.onUnhandledError(e)}})),e.Promise=d}}))}patchBluebird(Zone);
|
339
node_modules/zone.js/fesm2015/zone-error.js
generated
vendored
Executable file
339
node_modules/zone.js/fesm2015/zone-error.js
generated
vendored
Executable file
|
@ -0,0 +1,339 @@
|
|||
'use strict';
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/
|
||||
/**
|
||||
* @fileoverview
|
||||
* @suppress {globalThis,undefinedVars}
|
||||
*/
|
||||
function patchError(Zone) {
|
||||
Zone.__load_patch('Error', (global, Zone, api) => {
|
||||
/*
|
||||
* This code patches Error so that:
|
||||
* - It ignores un-needed stack frames.
|
||||
* - It Shows the associated Zone for reach frame.
|
||||
*/
|
||||
const zoneJsInternalStackFramesSymbol = api.symbol('zoneJsInternalStackFrames');
|
||||
const NativeError = (global[api.symbol('Error')] = global['Error']);
|
||||
// Store the frames which should be removed from the stack frames
|
||||
const zoneJsInternalStackFrames = {};
|
||||
// We must find the frame where Error was created, otherwise we assume we don't understand stack
|
||||
let zoneAwareFrame1;
|
||||
let zoneAwareFrame2;
|
||||
let zoneAwareFrame1WithoutNew;
|
||||
let zoneAwareFrame2WithoutNew;
|
||||
let zoneAwareFrame3WithoutNew;
|
||||
global['Error'] = ZoneAwareError;
|
||||
const stackRewrite = 'stackRewrite';
|
||||
const zoneJsInternalStackFramesPolicy = global['__Zone_Error_BlacklistedStackFrames_policy'] ||
|
||||
global['__Zone_Error_ZoneJsInternalStackFrames_policy'] ||
|
||||
'default';
|
||||
function buildZoneFrameNames(zoneFrame) {
|
||||
let zoneFrameName = { zoneName: zoneFrame.zone.name };
|
||||
let result = zoneFrameName;
|
||||
while (zoneFrame.parent) {
|
||||
zoneFrame = zoneFrame.parent;
|
||||
const parentZoneFrameName = { zoneName: zoneFrame.zone.name };
|
||||
zoneFrameName.parent = parentZoneFrameName;
|
||||
zoneFrameName = parentZoneFrameName;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function buildZoneAwareStackFrames(originalStack, zoneFrame, isZoneFrame = true) {
|
||||
let frames = originalStack.split('\n');
|
||||
let i = 0;
|
||||
// Find the first frame
|
||||
while (!(frames[i] === zoneAwareFrame1 ||
|
||||
frames[i] === zoneAwareFrame2 ||
|
||||
frames[i] === zoneAwareFrame1WithoutNew ||
|
||||
frames[i] === zoneAwareFrame2WithoutNew ||
|
||||
frames[i] === zoneAwareFrame3WithoutNew) &&
|
||||
i < frames.length) {
|
||||
i++;
|
||||
}
|
||||
for (; i < frames.length && zoneFrame; i++) {
|
||||
let frame = frames[i];
|
||||
if (frame.trim()) {
|
||||
switch (zoneJsInternalStackFrames[frame]) {
|
||||
case 0 /* FrameType.zoneJsInternal */:
|
||||
frames.splice(i, 1);
|
||||
i--;
|
||||
break;
|
||||
case 1 /* FrameType.transition */:
|
||||
if (zoneFrame.parent) {
|
||||
// This is the special frame where zone changed. Print and process it accordingly
|
||||
zoneFrame = zoneFrame.parent;
|
||||
}
|
||||
else {
|
||||
zoneFrame = null;
|
||||
}
|
||||
frames.splice(i, 1);
|
||||
i--;
|
||||
break;
|
||||
default:
|
||||
frames[i] += isZoneFrame
|
||||
? ` [${zoneFrame.zone.name}]`
|
||||
: ` [${zoneFrame.zoneName}]`;
|
||||
}
|
||||
}
|
||||
}
|
||||
return frames.join('\n');
|
||||
}
|
||||
/**
|
||||
* This is ZoneAwareError which processes the stack frame and cleans up extra frames as well as
|
||||
* adds zone information to it.
|
||||
*/
|
||||
function ZoneAwareError() {
|
||||
// We always have to return native error otherwise the browser console will not work.
|
||||
let error = NativeError.apply(this, arguments);
|
||||
// Save original stack trace
|
||||
const originalStack = (error['originalStack'] = error.stack);
|
||||
// Process the stack trace and rewrite the frames.
|
||||
if (ZoneAwareError[stackRewrite] && originalStack) {
|
||||
let zoneFrame = api.currentZoneFrame();
|
||||
if (zoneJsInternalStackFramesPolicy === 'lazy') {
|
||||
// don't handle stack trace now
|
||||
error[api.symbol('zoneFrameNames')] = buildZoneFrameNames(zoneFrame);
|
||||
}
|
||||
else if (zoneJsInternalStackFramesPolicy === 'default') {
|
||||
try {
|
||||
error.stack = error.zoneAwareStack = buildZoneAwareStackFrames(originalStack, zoneFrame);
|
||||
}
|
||||
catch (e) {
|
||||
// ignore as some browsers don't allow overriding of stack
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this instanceof NativeError && this.constructor != NativeError) {
|
||||
// We got called with a `new` operator AND we are subclass of ZoneAwareError
|
||||
// in that case we have to copy all of our properties to `this`.
|
||||
Object.keys(error)
|
||||
.concat('stack', 'message')
|
||||
.forEach((key) => {
|
||||
const value = error[key];
|
||||
if (value !== undefined) {
|
||||
try {
|
||||
this[key] = value;
|
||||
}
|
||||
catch (e) {
|
||||
// ignore the assignment in case it is a setter and it throws.
|
||||
}
|
||||
}
|
||||
});
|
||||
return this;
|
||||
}
|
||||
return error;
|
||||
}
|
||||
// Copy the prototype so that instanceof operator works as expected
|
||||
ZoneAwareError.prototype = NativeError.prototype;
|
||||
ZoneAwareError[zoneJsInternalStackFramesSymbol] = zoneJsInternalStackFrames;
|
||||
ZoneAwareError[stackRewrite] = false;
|
||||
const zoneAwareStackSymbol = api.symbol('zoneAwareStack');
|
||||
// try to define zoneAwareStack property when zoneJsInternal frames policy is delay
|
||||
if (zoneJsInternalStackFramesPolicy === 'lazy') {
|
||||
Object.defineProperty(ZoneAwareError.prototype, 'zoneAwareStack', {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
if (!this[zoneAwareStackSymbol]) {
|
||||
this[zoneAwareStackSymbol] = buildZoneAwareStackFrames(this.originalStack, this[api.symbol('zoneFrameNames')], false);
|
||||
}
|
||||
return this[zoneAwareStackSymbol];
|
||||
},
|
||||
set: function (newStack) {
|
||||
this.originalStack = newStack;
|
||||
this[zoneAwareStackSymbol] = buildZoneAwareStackFrames(this.originalStack, this[api.symbol('zoneFrameNames')], false);
|
||||
},
|
||||
});
|
||||
}
|
||||
// those properties need special handling
|
||||
const specialPropertyNames = ['stackTraceLimit', 'captureStackTrace', 'prepareStackTrace'];
|
||||
// those properties of NativeError should be set to ZoneAwareError
|
||||
const nativeErrorProperties = Object.keys(NativeError);
|
||||
if (nativeErrorProperties) {
|
||||
nativeErrorProperties.forEach((prop) => {
|
||||
if (specialPropertyNames.filter((sp) => sp === prop).length === 0) {
|
||||
Object.defineProperty(ZoneAwareError, prop, {
|
||||
get: function () {
|
||||
return NativeError[prop];
|
||||
},
|
||||
set: function (value) {
|
||||
NativeError[prop] = value;
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
if (NativeError.hasOwnProperty('stackTraceLimit')) {
|
||||
// Extend default stack limit as we will be removing few frames.
|
||||
NativeError.stackTraceLimit = Math.max(NativeError.stackTraceLimit, 15);
|
||||
// make sure that ZoneAwareError has the same property which forwards to NativeError.
|
||||
Object.defineProperty(ZoneAwareError, 'stackTraceLimit', {
|
||||
get: function () {
|
||||
return NativeError.stackTraceLimit;
|
||||
},
|
||||
set: function (value) {
|
||||
return (NativeError.stackTraceLimit = value);
|
||||
},
|
||||
});
|
||||
}
|
||||
if (NativeError.hasOwnProperty('captureStackTrace')) {
|
||||
Object.defineProperty(ZoneAwareError, 'captureStackTrace', {
|
||||
// add named function here because we need to remove this
|
||||
// stack frame when prepareStackTrace below
|
||||
value: function zoneCaptureStackTrace(targetObject, constructorOpt) {
|
||||
NativeError.captureStackTrace(targetObject, constructorOpt);
|
||||
},
|
||||
});
|
||||
}
|
||||
const ZONE_CAPTURESTACKTRACE = 'zoneCaptureStackTrace';
|
||||
Object.defineProperty(ZoneAwareError, 'prepareStackTrace', {
|
||||
get: function () {
|
||||
return NativeError.prepareStackTrace;
|
||||
},
|
||||
set: function (value) {
|
||||
if (!value || typeof value !== 'function') {
|
||||
return (NativeError.prepareStackTrace = value);
|
||||
}
|
||||
return (NativeError.prepareStackTrace = function (error, structuredStackTrace) {
|
||||
// remove additional stack information from ZoneAwareError.captureStackTrace
|
||||
if (structuredStackTrace) {
|
||||
for (let i = 0; i < structuredStackTrace.length; i++) {
|
||||
const st = structuredStackTrace[i];
|
||||
// remove the first function which name is zoneCaptureStackTrace
|
||||
if (st.getFunctionName() === ZONE_CAPTURESTACKTRACE) {
|
||||
structuredStackTrace.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return value.call(this, error, structuredStackTrace);
|
||||
});
|
||||
},
|
||||
});
|
||||
if (zoneJsInternalStackFramesPolicy === 'disable') {
|
||||
// don't need to run detectZone to populate zoneJs internal stack frames
|
||||
return;
|
||||
}
|
||||
// Now we need to populate the `zoneJsInternalStackFrames` as well as find the
|
||||
// run/runGuarded/runTask frames. This is done by creating a detect zone and then threading
|
||||
// the execution through all of the above methods so that we can look at the stack trace and
|
||||
// find the frames of interest.
|
||||
let detectZone = Zone.current.fork({
|
||||
name: 'detect',
|
||||
onHandleError: function (parentZD, current, target, error) {
|
||||
if (error.originalStack && Error === ZoneAwareError) {
|
||||
let frames = error.originalStack.split(/\n/);
|
||||
let runFrame = false, runGuardedFrame = false, runTaskFrame = false;
|
||||
while (frames.length) {
|
||||
let frame = frames.shift();
|
||||
// On safari it is possible to have stack frame with no line number.
|
||||
// This check makes sure that we don't filter frames on name only (must have
|
||||
// line number or exact equals to `ZoneAwareError`)
|
||||
if (/:\d+:\d+/.test(frame) || frame === 'ZoneAwareError') {
|
||||
// Get rid of the path so that we don't accidentally find function name in path.
|
||||
// In chrome the separator is `(` and `@` in FF and safari
|
||||
// Chrome: at Zone.run (zone.js:100)
|
||||
// Chrome: at Zone.run (http://localhost:9876/base/build/lib/zone.js:100:24)
|
||||
// FireFox: Zone.prototype.run@http://localhost:9876/base/build/lib/zone.js:101:24
|
||||
// Safari: run@http://localhost:9876/base/build/lib/zone.js:101:24
|
||||
let fnName = frame.split('(')[0].split('@')[0];
|
||||
let frameType = 1 /* FrameType.transition */;
|
||||
if (fnName.indexOf('ZoneAwareError') !== -1) {
|
||||
if (fnName.indexOf('new ZoneAwareError') !== -1) {
|
||||
zoneAwareFrame1 = frame;
|
||||
zoneAwareFrame2 = frame.replace('new ZoneAwareError', 'new Error.ZoneAwareError');
|
||||
}
|
||||
else {
|
||||
zoneAwareFrame1WithoutNew = frame;
|
||||
zoneAwareFrame2WithoutNew = frame.replace('Error.', '');
|
||||
if (frame.indexOf('Error.ZoneAwareError') === -1) {
|
||||
zoneAwareFrame3WithoutNew = frame.replace('ZoneAwareError', 'Error.ZoneAwareError');
|
||||
}
|
||||
}
|
||||
zoneJsInternalStackFrames[zoneAwareFrame2] = 0 /* FrameType.zoneJsInternal */;
|
||||
}
|
||||
if (fnName.indexOf('runGuarded') !== -1) {
|
||||
runGuardedFrame = true;
|
||||
}
|
||||
else if (fnName.indexOf('runTask') !== -1) {
|
||||
runTaskFrame = true;
|
||||
}
|
||||
else if (fnName.indexOf('run') !== -1) {
|
||||
runFrame = true;
|
||||
}
|
||||
else {
|
||||
frameType = 0 /* FrameType.zoneJsInternal */;
|
||||
}
|
||||
zoneJsInternalStackFrames[frame] = frameType;
|
||||
// Once we find all of the frames we can stop looking.
|
||||
if (runFrame && runGuardedFrame && runTaskFrame) {
|
||||
ZoneAwareError[stackRewrite] = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
});
|
||||
// carefully constructor a stack frame which contains all of the frames of interest which
|
||||
// need to be detected and marked as an internal zoneJs frame.
|
||||
const childDetectZone = detectZone.fork({
|
||||
name: 'child',
|
||||
onScheduleTask: function (delegate, curr, target, task) {
|
||||
return delegate.scheduleTask(target, task);
|
||||
},
|
||||
onInvokeTask: function (delegate, curr, target, task, applyThis, applyArgs) {
|
||||
return delegate.invokeTask(target, task, applyThis, applyArgs);
|
||||
},
|
||||
onCancelTask: function (delegate, curr, target, task) {
|
||||
return delegate.cancelTask(target, task);
|
||||
},
|
||||
onInvoke: function (delegate, curr, target, callback, applyThis, applyArgs, source) {
|
||||
return delegate.invoke(target, callback, applyThis, applyArgs, source);
|
||||
},
|
||||
});
|
||||
// we need to detect all zone related frames, it will
|
||||
// exceed default stackTraceLimit, so we set it to
|
||||
// larger number here, and restore it after detect finish.
|
||||
// We cast through any so we don't need to depend on nodejs typings.
|
||||
const originalStackTraceLimit = Error.stackTraceLimit;
|
||||
Error.stackTraceLimit = 100;
|
||||
// we schedule event/micro/macro task, and invoke them
|
||||
// when onSchedule, so we can get all stack traces for
|
||||
// all kinds of tasks with one error thrown.
|
||||
childDetectZone.run(() => {
|
||||
childDetectZone.runGuarded(() => {
|
||||
const fakeTransitionTo = () => { };
|
||||
childDetectZone.scheduleEventTask(zoneJsInternalStackFramesSymbol, () => {
|
||||
childDetectZone.scheduleMacroTask(zoneJsInternalStackFramesSymbol, () => {
|
||||
childDetectZone.scheduleMicroTask(zoneJsInternalStackFramesSymbol, () => {
|
||||
throw new Error();
|
||||
}, undefined, (t) => {
|
||||
t._transitionTo = fakeTransitionTo;
|
||||
t.invoke();
|
||||
});
|
||||
childDetectZone.scheduleMicroTask(zoneJsInternalStackFramesSymbol, () => {
|
||||
throw Error();
|
||||
}, undefined, (t) => {
|
||||
t._transitionTo = fakeTransitionTo;
|
||||
t.invoke();
|
||||
});
|
||||
}, undefined, (t) => {
|
||||
t._transitionTo = fakeTransitionTo;
|
||||
t.invoke();
|
||||
}, () => { });
|
||||
}, undefined, (t) => {
|
||||
t._transitionTo = fakeTransitionTo;
|
||||
t.invoke();
|
||||
}, () => { });
|
||||
});
|
||||
});
|
||||
Error.stackTraceLimit = originalStackTraceLimit;
|
||||
});
|
||||
}
|
||||
|
||||
patchError(Zone);
|
6
node_modules/zone.js/fesm2015/zone-error.min.js
generated
vendored
Executable file
6
node_modules/zone.js/fesm2015/zone-error.min.js
generated
vendored
Executable file
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/function patchError(e){e.__load_patch("Error",((e,r,t)=>{const n=t.symbol("zoneJsInternalStackFrames"),a=e[t.symbol("Error")]=e.Error,o={};let c,i,s,l,u;e.Error=h;const k="stackRewrite",f=e.__Zone_Error_BlacklistedStackFrames_policy||e.__Zone_Error_ZoneJsInternalStackFrames_policy||"default";function p(e,r,t=!0){let n=e.split("\n"),a=0;for(;n[a]!==c&&n[a]!==i&&n[a]!==s&&n[a]!==l&&n[a]!==u&&a<n.length;)a++;for(;a<n.length&&r;a++){let e=n[a];if(e.trim())switch(o[e]){case 0:n.splice(a,1),a--;break;case 1:r=r.parent?r.parent:null,n.splice(a,1),a--;break;default:n[a]+=t?` [${r.zone.name}]`:` [${r.zoneName}]`}}return n.join("\n")}function h(){let e=a.apply(this,arguments);const r=e.originalStack=e.stack;if(h[k]&&r){let n=t.currentZoneFrame();if("lazy"===f)e[t.symbol("zoneFrameNames")]=function a(e){let r={zoneName:e.zone.name},t=r;for(;e.parent;){const t={zoneName:(e=e.parent).zone.name};r.parent=t,r=t}return t}(n);else if("default"===f)try{e.stack=e.zoneAwareStack=p(r,n)}catch(e){}}return this instanceof a&&this.constructor!=a?(Object.keys(e).concat("stack","message").forEach((r=>{const t=e[r];if(void 0!==t)try{this[r]=t}catch(e){}})),this):e}h.prototype=a.prototype,h[n]=o,h[k]=!1;const m=t.symbol("zoneAwareStack");"lazy"===f&&Object.defineProperty(h.prototype,"zoneAwareStack",{configurable:!0,enumerable:!0,get:function(){return this[m]||(this[m]=p(this.originalStack,this[t.symbol("zoneFrameNames")],!1)),this[m]},set:function(e){this.originalStack=e,this[m]=p(this.originalStack,this[t.symbol("zoneFrameNames")],!1)}});const d=["stackTraceLimit","captureStackTrace","prepareStackTrace"],T=Object.keys(a);if(T&&T.forEach((e=>{0===d.filter((r=>r===e)).length&&Object.defineProperty(h,e,{get:function(){return a[e]},set:function(r){a[e]=r}})})),a.hasOwnProperty("stackTraceLimit")&&(a.stackTraceLimit=Math.max(a.stackTraceLimit,15),Object.defineProperty(h,"stackTraceLimit",{get:function(){return a.stackTraceLimit},set:function(e){return a.stackTraceLimit=e}})),a.hasOwnProperty("captureStackTrace")&&Object.defineProperty(h,"captureStackTrace",{value:function e(r,t){a.captureStackTrace(r,t)}}),Object.defineProperty(h,"prepareStackTrace",{get:function(){return a.prepareStackTrace},set:function(e){return a.prepareStackTrace=e&&"function"==typeof e?function(r,t){if(t)for(let e=0;e<t.length;e++)if("zoneCaptureStackTrace"===t[e].getFunctionName()){t.splice(e,1);break}return e.call(this,r,t)}:e}}),"disable"===f)return;const E=r.current.fork({name:"detect",onHandleError:function(e,r,t,n){if(n.originalStack&&Error===h){let e=n.originalStack.split(/\n/),r=!1,t=!1,a=!1;for(;e.length;){let n=e.shift();if(/:\d+:\d+/.test(n)||"ZoneAwareError"===n){let e=n.split("(")[0].split("@")[0],f=1;if(-1!==e.indexOf("ZoneAwareError")&&(-1!==e.indexOf("new ZoneAwareError")?(c=n,i=n.replace("new ZoneAwareError","new Error.ZoneAwareError")):(s=n,l=n.replace("Error.",""),-1===n.indexOf("Error.ZoneAwareError")&&(u=n.replace("ZoneAwareError","Error.ZoneAwareError"))),o[i]=0),-1!==e.indexOf("runGuarded")?t=!0:-1!==e.indexOf("runTask")?a=!0:-1!==e.indexOf("run")?r=!0:f=0,o[n]=f,r&&t&&a){h[k]=!0;break}}}}return!1}}).fork({name:"child",onScheduleTask:function(e,r,t,n){return e.scheduleTask(t,n)},onInvokeTask:function(e,r,t,n,a,o){return e.invokeTask(t,n,a,o)},onCancelTask:function(e,r,t,n){return e.cancelTask(t,n)},onInvoke:function(e,r,t,n,a,o,c){return e.invoke(t,n,a,o,c)}}),y=Error.stackTraceLimit;Error.stackTraceLimit=100,E.run((()=>{E.runGuarded((()=>{const e=()=>{};E.scheduleEventTask(n,(()=>{E.scheduleMacroTask(n,(()=>{E.scheduleMicroTask(n,(()=>{throw new Error}),void 0,(r=>{r._transitionTo=e,r.invoke()})),E.scheduleMicroTask(n,(()=>{throw Error()}),void 0,(r=>{r._transitionTo=e,r.invoke()}))}),void 0,(r=>{r._transitionTo=e,r.invoke()}),(()=>{}))}),void 0,(r=>{r._transitionTo=e,r.invoke()}),(()=>{}))}))})),Error.stackTraceLimit=y}))}patchError(Zone);
|
702
node_modules/zone.js/fesm2015/zone-legacy.js
generated
vendored
Executable file
702
node_modules/zone.js/fesm2015/zone-legacy.js
generated
vendored
Executable file
|
@ -0,0 +1,702 @@
|
|||
'use strict';
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/
|
||||
/*
|
||||
* This is necessary for Chrome and Chrome mobile, to enable
|
||||
* things like redefining `createdCallback` on an element.
|
||||
*/
|
||||
let zoneSymbol;
|
||||
let _defineProperty;
|
||||
let _getOwnPropertyDescriptor;
|
||||
let _create;
|
||||
let unconfigurablesKey;
|
||||
function propertyPatch() {
|
||||
zoneSymbol = Zone.__symbol__;
|
||||
_defineProperty = Object[zoneSymbol('defineProperty')] = Object.defineProperty;
|
||||
_getOwnPropertyDescriptor = Object[zoneSymbol('getOwnPropertyDescriptor')] =
|
||||
Object.getOwnPropertyDescriptor;
|
||||
_create = Object.create;
|
||||
unconfigurablesKey = zoneSymbol('unconfigurables');
|
||||
Object.defineProperty = function (obj, prop, desc) {
|
||||
if (isUnconfigurable(obj, prop)) {
|
||||
throw new TypeError("Cannot assign to read only property '" + prop + "' of " + obj);
|
||||
}
|
||||
const originalConfigurableFlag = desc.configurable;
|
||||
if (prop !== 'prototype') {
|
||||
desc = rewriteDescriptor(obj, prop, desc);
|
||||
}
|
||||
return _tryDefineProperty(obj, prop, desc, originalConfigurableFlag);
|
||||
};
|
||||
Object.defineProperties = function (obj, props) {
|
||||
Object.keys(props).forEach(function (prop) {
|
||||
Object.defineProperty(obj, prop, props[prop]);
|
||||
});
|
||||
for (const sym of Object.getOwnPropertySymbols(props)) {
|
||||
const desc = Object.getOwnPropertyDescriptor(props, sym);
|
||||
// Since `Object.getOwnPropertySymbols` returns *all* symbols,
|
||||
// including non-enumerable ones, retrieve property descriptor and check
|
||||
// enumerability there. Proceed with the rewrite only when a property is
|
||||
// enumerable to make the logic consistent with the way regular
|
||||
// properties are retrieved (via `Object.keys`, which respects
|
||||
// `enumerable: false` flag). More information:
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Enumerability_and_ownership_of_properties#retrieval
|
||||
if (desc?.enumerable) {
|
||||
Object.defineProperty(obj, sym, props[sym]);
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
};
|
||||
Object.create = function (proto, propertiesObject) {
|
||||
if (typeof propertiesObject === 'object' && !Object.isFrozen(propertiesObject)) {
|
||||
Object.keys(propertiesObject).forEach(function (prop) {
|
||||
propertiesObject[prop] = rewriteDescriptor(proto, prop, propertiesObject[prop]);
|
||||
});
|
||||
}
|
||||
return _create(proto, propertiesObject);
|
||||
};
|
||||
Object.getOwnPropertyDescriptor = function (obj, prop) {
|
||||
const desc = _getOwnPropertyDescriptor(obj, prop);
|
||||
if (desc && isUnconfigurable(obj, prop)) {
|
||||
desc.configurable = false;
|
||||
}
|
||||
return desc;
|
||||
};
|
||||
}
|
||||
function _redefineProperty(obj, prop, desc) {
|
||||
const originalConfigurableFlag = desc.configurable;
|
||||
desc = rewriteDescriptor(obj, prop, desc);
|
||||
return _tryDefineProperty(obj, prop, desc, originalConfigurableFlag);
|
||||
}
|
||||
function isUnconfigurable(obj, prop) {
|
||||
return obj && obj[unconfigurablesKey] && obj[unconfigurablesKey][prop];
|
||||
}
|
||||
function rewriteDescriptor(obj, prop, desc) {
|
||||
// issue-927, if the desc is frozen, don't try to change the desc
|
||||
if (!Object.isFrozen(desc)) {
|
||||
desc.configurable = true;
|
||||
}
|
||||
if (!desc.configurable) {
|
||||
// issue-927, if the obj is frozen, don't try to set the desc to obj
|
||||
if (!obj[unconfigurablesKey] && !Object.isFrozen(obj)) {
|
||||
_defineProperty(obj, unconfigurablesKey, { writable: true, value: {} });
|
||||
}
|
||||
if (obj[unconfigurablesKey]) {
|
||||
obj[unconfigurablesKey][prop] = true;
|
||||
}
|
||||
}
|
||||
return desc;
|
||||
}
|
||||
function _tryDefineProperty(obj, prop, desc, originalConfigurableFlag) {
|
||||
try {
|
||||
return _defineProperty(obj, prop, desc);
|
||||
}
|
||||
catch (error) {
|
||||
if (desc.configurable) {
|
||||
// In case of errors, when the configurable flag was likely set by rewriteDescriptor(),
|
||||
// let's retry with the original flag value
|
||||
if (typeof originalConfigurableFlag == 'undefined') {
|
||||
delete desc.configurable;
|
||||
}
|
||||
else {
|
||||
desc.configurable = originalConfigurableFlag;
|
||||
}
|
||||
try {
|
||||
return _defineProperty(obj, prop, desc);
|
||||
}
|
||||
catch (error) {
|
||||
let swallowError = false;
|
||||
if (prop === 'createdCallback' ||
|
||||
prop === 'attachedCallback' ||
|
||||
prop === 'detachedCallback' ||
|
||||
prop === 'attributeChangedCallback') {
|
||||
// We only swallow the error in registerElement patch
|
||||
// this is the work around since some applications
|
||||
// fail if we throw the error
|
||||
swallowError = true;
|
||||
}
|
||||
if (!swallowError) {
|
||||
throw error;
|
||||
}
|
||||
// TODO: @JiaLiPassion, Some application such as `registerElement` patch
|
||||
// still need to swallow the error, in the future after these applications
|
||||
// are updated, the following logic can be removed.
|
||||
let descJson = null;
|
||||
try {
|
||||
descJson = JSON.stringify(desc);
|
||||
}
|
||||
catch (error) {
|
||||
descJson = desc.toString();
|
||||
}
|
||||
console.log(`Attempting to configure '${prop}' with descriptor '${descJson}' on object '${obj}' and got error, giving up: ${error}`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function eventTargetLegacyPatch(_global, api) {
|
||||
const { eventNames, globalSources, zoneSymbolEventNames, TRUE_STR, FALSE_STR, ZONE_SYMBOL_PREFIX } = api.getGlobalObjects();
|
||||
const WTF_ISSUE_555 = 'Anchor,Area,Audio,BR,Base,BaseFont,Body,Button,Canvas,Content,DList,Directory,Div,Embed,FieldSet,Font,Form,Frame,FrameSet,HR,Head,Heading,Html,IFrame,Image,Input,Keygen,LI,Label,Legend,Link,Map,Marquee,Media,Menu,Meta,Meter,Mod,OList,Object,OptGroup,Option,Output,Paragraph,Pre,Progress,Quote,Script,Select,Source,Span,Style,TableCaption,TableCell,TableCol,Table,TableRow,TableSection,TextArea,Title,Track,UList,Unknown,Video';
|
||||
const NO_EVENT_TARGET = 'ApplicationCache,EventSource,FileReader,InputMethodContext,MediaController,MessagePort,Node,Performance,SVGElementInstance,SharedWorker,TextTrack,TextTrackCue,TextTrackList,WebKitNamedFlow,Window,Worker,WorkerGlobalScope,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload,IDBRequest,IDBOpenDBRequest,IDBDatabase,IDBTransaction,IDBCursor,DBIndex,WebSocket'.split(',');
|
||||
const EVENT_TARGET = 'EventTarget';
|
||||
let apis = [];
|
||||
const isWtf = _global['wtf'];
|
||||
const WTF_ISSUE_555_ARRAY = WTF_ISSUE_555.split(',');
|
||||
if (isWtf) {
|
||||
// Workaround for: https://github.com/google/tracing-framework/issues/555
|
||||
apis = WTF_ISSUE_555_ARRAY.map((v) => 'HTML' + v + 'Element').concat(NO_EVENT_TARGET);
|
||||
}
|
||||
else if (_global[EVENT_TARGET]) {
|
||||
apis.push(EVENT_TARGET);
|
||||
}
|
||||
else {
|
||||
// Note: EventTarget is not available in all browsers,
|
||||
// if it's not available, we instead patch the APIs in the IDL that inherit from EventTarget
|
||||
apis = NO_EVENT_TARGET;
|
||||
}
|
||||
const isDisableIECheck = _global['__Zone_disable_IE_check'] || false;
|
||||
const isEnableCrossContextCheck = _global['__Zone_enable_cross_context_check'] || false;
|
||||
const ieOrEdge = api.isIEOrEdge();
|
||||
const ADD_EVENT_LISTENER_SOURCE = '.addEventListener:';
|
||||
const FUNCTION_WRAPPER = '[object FunctionWrapper]';
|
||||
const BROWSER_TOOLS = 'function __BROWSERTOOLS_CONSOLE_SAFEFUNC() { [native code] }';
|
||||
const pointerEventsMap = {
|
||||
'MSPointerCancel': 'pointercancel',
|
||||
'MSPointerDown': 'pointerdown',
|
||||
'MSPointerEnter': 'pointerenter',
|
||||
'MSPointerHover': 'pointerhover',
|
||||
'MSPointerLeave': 'pointerleave',
|
||||
'MSPointerMove': 'pointermove',
|
||||
'MSPointerOut': 'pointerout',
|
||||
'MSPointerOver': 'pointerover',
|
||||
'MSPointerUp': 'pointerup',
|
||||
};
|
||||
// predefine all __zone_symbol__ + eventName + true/false string
|
||||
for (let i = 0; i < eventNames.length; i++) {
|
||||
const eventName = eventNames[i];
|
||||
const falseEventName = eventName + FALSE_STR;
|
||||
const trueEventName = eventName + TRUE_STR;
|
||||
const symbol = ZONE_SYMBOL_PREFIX + falseEventName;
|
||||
const symbolCapture = ZONE_SYMBOL_PREFIX + trueEventName;
|
||||
zoneSymbolEventNames[eventName] = {};
|
||||
zoneSymbolEventNames[eventName][FALSE_STR] = symbol;
|
||||
zoneSymbolEventNames[eventName][TRUE_STR] = symbolCapture;
|
||||
}
|
||||
// predefine all task.source string
|
||||
for (let i = 0; i < WTF_ISSUE_555_ARRAY.length; i++) {
|
||||
const target = WTF_ISSUE_555_ARRAY[i];
|
||||
const targets = (globalSources[target] = {});
|
||||
for (let j = 0; j < eventNames.length; j++) {
|
||||
const eventName = eventNames[j];
|
||||
targets[eventName] = target + ADD_EVENT_LISTENER_SOURCE + eventName;
|
||||
}
|
||||
}
|
||||
const checkIEAndCrossContext = function (nativeDelegate, delegate, target, args) {
|
||||
if (!isDisableIECheck && ieOrEdge) {
|
||||
if (isEnableCrossContextCheck) {
|
||||
try {
|
||||
const testString = delegate.toString();
|
||||
if (testString === FUNCTION_WRAPPER || testString == BROWSER_TOOLS) {
|
||||
nativeDelegate.apply(target, args);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
nativeDelegate.apply(target, args);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
const testString = delegate.toString();
|
||||
if (testString === FUNCTION_WRAPPER || testString == BROWSER_TOOLS) {
|
||||
nativeDelegate.apply(target, args);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (isEnableCrossContextCheck) {
|
||||
try {
|
||||
delegate.toString();
|
||||
}
|
||||
catch (error) {
|
||||
nativeDelegate.apply(target, args);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
const apiTypes = [];
|
||||
for (let i = 0; i < apis.length; i++) {
|
||||
const type = _global[apis[i]];
|
||||
apiTypes.push(type && type.prototype);
|
||||
}
|
||||
// vh is validateHandler to check event handler
|
||||
// is valid or not(for security check)
|
||||
api.patchEventTarget(_global, api, apiTypes, {
|
||||
vh: checkIEAndCrossContext,
|
||||
transferEventName: (eventName) => {
|
||||
const pointerEventName = pointerEventsMap[eventName];
|
||||
return pointerEventName || eventName;
|
||||
},
|
||||
});
|
||||
Zone[api.symbol('patchEventTarget')] = !!_global[EVENT_TARGET];
|
||||
return true;
|
||||
}
|
||||
|
||||
// we have to patch the instance since the proto is non-configurable
|
||||
function apply(api, _global) {
|
||||
const { ADD_EVENT_LISTENER_STR, REMOVE_EVENT_LISTENER_STR } = api.getGlobalObjects();
|
||||
const WS = _global.WebSocket;
|
||||
// On Safari window.EventTarget doesn't exist so need to patch WS add/removeEventListener
|
||||
// On older Chrome, no need since EventTarget was already patched
|
||||
if (!_global.EventTarget) {
|
||||
api.patchEventTarget(_global, api, [WS.prototype]);
|
||||
}
|
||||
_global.WebSocket = function (x, y) {
|
||||
const socket = arguments.length > 1 ? new WS(x, y) : new WS(x);
|
||||
let proxySocket;
|
||||
let proxySocketProto;
|
||||
// Safari 7.0 has non-configurable own 'onmessage' and friends properties on the socket instance
|
||||
const onmessageDesc = api.ObjectGetOwnPropertyDescriptor(socket, 'onmessage');
|
||||
if (onmessageDesc && onmessageDesc.configurable === false) {
|
||||
proxySocket = api.ObjectCreate(socket);
|
||||
// socket have own property descriptor 'onopen', 'onmessage', 'onclose', 'onerror'
|
||||
// but proxySocket not, so we will keep socket as prototype and pass it to
|
||||
// patchOnProperties method
|
||||
proxySocketProto = socket;
|
||||
[ADD_EVENT_LISTENER_STR, REMOVE_EVENT_LISTENER_STR, 'send', 'close'].forEach(function (propName) {
|
||||
proxySocket[propName] = function () {
|
||||
const args = api.ArraySlice.call(arguments);
|
||||
if (propName === ADD_EVENT_LISTENER_STR || propName === REMOVE_EVENT_LISTENER_STR) {
|
||||
const eventName = args.length > 0 ? args[0] : undefined;
|
||||
if (eventName) {
|
||||
const propertySymbol = Zone.__symbol__('ON_PROPERTY' + eventName);
|
||||
socket[propertySymbol] = proxySocket[propertySymbol];
|
||||
}
|
||||
}
|
||||
return socket[propName].apply(socket, args);
|
||||
};
|
||||
});
|
||||
}
|
||||
else {
|
||||
// we can patch the real socket
|
||||
proxySocket = socket;
|
||||
}
|
||||
api.patchOnProperties(proxySocket, ['close', 'error', 'message', 'open'], proxySocketProto);
|
||||
return proxySocket;
|
||||
};
|
||||
const globalWebSocket = _global['WebSocket'];
|
||||
for (const prop in WS) {
|
||||
globalWebSocket[prop] = WS[prop];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @fileoverview
|
||||
* @suppress {globalThis}
|
||||
*/
|
||||
function propertyDescriptorLegacyPatch(api, _global) {
|
||||
const { isNode, isMix } = api.getGlobalObjects();
|
||||
if (isNode && !isMix) {
|
||||
return;
|
||||
}
|
||||
if (!canPatchViaPropertyDescriptor(api, _global)) {
|
||||
const supportsWebSocket = typeof WebSocket !== 'undefined';
|
||||
// Safari, Android browsers (Jelly Bean)
|
||||
patchViaCapturingAllTheEvents(api);
|
||||
api.patchClass('XMLHttpRequest');
|
||||
if (supportsWebSocket) {
|
||||
apply(api, _global);
|
||||
}
|
||||
Zone[api.symbol('patchEvents')] = true;
|
||||
}
|
||||
}
|
||||
function canPatchViaPropertyDescriptor(api, _global) {
|
||||
const { isBrowser, isMix } = api.getGlobalObjects();
|
||||
if ((isBrowser || isMix) &&
|
||||
!api.ObjectGetOwnPropertyDescriptor(HTMLElement.prototype, 'onclick') &&
|
||||
typeof Element !== 'undefined') {
|
||||
// WebKit https://bugs.webkit.org/show_bug.cgi?id=134364
|
||||
// IDL interface attributes are not configurable
|
||||
const desc = api.ObjectGetOwnPropertyDescriptor(Element.prototype, 'onclick');
|
||||
if (desc && !desc.configurable)
|
||||
return false;
|
||||
// try to use onclick to detect whether we can patch via propertyDescriptor
|
||||
// because XMLHttpRequest is not available in service worker
|
||||
if (desc) {
|
||||
api.ObjectDefineProperty(Element.prototype, 'onclick', {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
get: function () {
|
||||
return true;
|
||||
},
|
||||
});
|
||||
const div = document.createElement('div');
|
||||
const result = !!div.onclick;
|
||||
api.ObjectDefineProperty(Element.prototype, 'onclick', desc);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
const XMLHttpRequest = _global['XMLHttpRequest'];
|
||||
if (!XMLHttpRequest) {
|
||||
// XMLHttpRequest is not available in service worker
|
||||
return false;
|
||||
}
|
||||
const ON_READY_STATE_CHANGE = 'onreadystatechange';
|
||||
const XMLHttpRequestPrototype = XMLHttpRequest.prototype;
|
||||
const xhrDesc = api.ObjectGetOwnPropertyDescriptor(XMLHttpRequestPrototype, ON_READY_STATE_CHANGE);
|
||||
// add enumerable and configurable here because in opera
|
||||
// by default XMLHttpRequest.prototype.onreadystatechange is undefined
|
||||
// without adding enumerable and configurable will cause onreadystatechange
|
||||
// non-configurable
|
||||
// and if XMLHttpRequest.prototype.onreadystatechange is undefined,
|
||||
// we should set a real desc instead a fake one
|
||||
if (xhrDesc) {
|
||||
api.ObjectDefineProperty(XMLHttpRequestPrototype, ON_READY_STATE_CHANGE, {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
get: function () {
|
||||
return true;
|
||||
},
|
||||
});
|
||||
const req = new XMLHttpRequest();
|
||||
const result = !!req.onreadystatechange;
|
||||
// restore original desc
|
||||
api.ObjectDefineProperty(XMLHttpRequestPrototype, ON_READY_STATE_CHANGE, xhrDesc || {});
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
const SYMBOL_FAKE_ONREADYSTATECHANGE = api.symbol('fake');
|
||||
api.ObjectDefineProperty(XMLHttpRequestPrototype, ON_READY_STATE_CHANGE, {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
get: function () {
|
||||
return this[SYMBOL_FAKE_ONREADYSTATECHANGE];
|
||||
},
|
||||
set: function (value) {
|
||||
this[SYMBOL_FAKE_ONREADYSTATECHANGE] = value;
|
||||
},
|
||||
});
|
||||
const req = new XMLHttpRequest();
|
||||
const detectFunc = () => { };
|
||||
req.onreadystatechange = detectFunc;
|
||||
const result = req[SYMBOL_FAKE_ONREADYSTATECHANGE] === detectFunc;
|
||||
req.onreadystatechange = null;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
const globalEventHandlersEventNames = [
|
||||
'abort',
|
||||
'animationcancel',
|
||||
'animationend',
|
||||
'animationiteration',
|
||||
'auxclick',
|
||||
'beforeinput',
|
||||
'blur',
|
||||
'cancel',
|
||||
'canplay',
|
||||
'canplaythrough',
|
||||
'change',
|
||||
'compositionstart',
|
||||
'compositionupdate',
|
||||
'compositionend',
|
||||
'cuechange',
|
||||
'click',
|
||||
'close',
|
||||
'contextmenu',
|
||||
'curechange',
|
||||
'dblclick',
|
||||
'drag',
|
||||
'dragend',
|
||||
'dragenter',
|
||||
'dragexit',
|
||||
'dragleave',
|
||||
'dragover',
|
||||
'drop',
|
||||
'durationchange',
|
||||
'emptied',
|
||||
'ended',
|
||||
'error',
|
||||
'focus',
|
||||
'focusin',
|
||||
'focusout',
|
||||
'gotpointercapture',
|
||||
'input',
|
||||
'invalid',
|
||||
'keydown',
|
||||
'keypress',
|
||||
'keyup',
|
||||
'load',
|
||||
'loadstart',
|
||||
'loadeddata',
|
||||
'loadedmetadata',
|
||||
'lostpointercapture',
|
||||
'mousedown',
|
||||
'mouseenter',
|
||||
'mouseleave',
|
||||
'mousemove',
|
||||
'mouseout',
|
||||
'mouseover',
|
||||
'mouseup',
|
||||
'mousewheel',
|
||||
'orientationchange',
|
||||
'pause',
|
||||
'play',
|
||||
'playing',
|
||||
'pointercancel',
|
||||
'pointerdown',
|
||||
'pointerenter',
|
||||
'pointerleave',
|
||||
'pointerlockchange',
|
||||
'mozpointerlockchange',
|
||||
'webkitpointerlockerchange',
|
||||
'pointerlockerror',
|
||||
'mozpointerlockerror',
|
||||
'webkitpointerlockerror',
|
||||
'pointermove',
|
||||
'pointout',
|
||||
'pointerover',
|
||||
'pointerup',
|
||||
'progress',
|
||||
'ratechange',
|
||||
'reset',
|
||||
'resize',
|
||||
'scroll',
|
||||
'seeked',
|
||||
'seeking',
|
||||
'select',
|
||||
'selectionchange',
|
||||
'selectstart',
|
||||
'show',
|
||||
'sort',
|
||||
'stalled',
|
||||
'submit',
|
||||
'suspend',
|
||||
'timeupdate',
|
||||
'volumechange',
|
||||
'touchcancel',
|
||||
'touchmove',
|
||||
'touchstart',
|
||||
'touchend',
|
||||
'transitioncancel',
|
||||
'transitionend',
|
||||
'waiting',
|
||||
'wheel',
|
||||
];
|
||||
const documentEventNames = [
|
||||
'afterscriptexecute',
|
||||
'beforescriptexecute',
|
||||
'DOMContentLoaded',
|
||||
'freeze',
|
||||
'fullscreenchange',
|
||||
'mozfullscreenchange',
|
||||
'webkitfullscreenchange',
|
||||
'msfullscreenchange',
|
||||
'fullscreenerror',
|
||||
'mozfullscreenerror',
|
||||
'webkitfullscreenerror',
|
||||
'msfullscreenerror',
|
||||
'readystatechange',
|
||||
'visibilitychange',
|
||||
'resume',
|
||||
];
|
||||
const windowEventNames = [
|
||||
'absolutedeviceorientation',
|
||||
'afterinput',
|
||||
'afterprint',
|
||||
'appinstalled',
|
||||
'beforeinstallprompt',
|
||||
'beforeprint',
|
||||
'beforeunload',
|
||||
'devicelight',
|
||||
'devicemotion',
|
||||
'deviceorientation',
|
||||
'deviceorientationabsolute',
|
||||
'deviceproximity',
|
||||
'hashchange',
|
||||
'languagechange',
|
||||
'message',
|
||||
'mozbeforepaint',
|
||||
'offline',
|
||||
'online',
|
||||
'paint',
|
||||
'pageshow',
|
||||
'pagehide',
|
||||
'popstate',
|
||||
'rejectionhandled',
|
||||
'storage',
|
||||
'unhandledrejection',
|
||||
'unload',
|
||||
'userproximity',
|
||||
'vrdisplayconnected',
|
||||
'vrdisplaydisconnected',
|
||||
'vrdisplaypresentchange',
|
||||
];
|
||||
const htmlElementEventNames = [
|
||||
'beforecopy',
|
||||
'beforecut',
|
||||
'beforepaste',
|
||||
'copy',
|
||||
'cut',
|
||||
'paste',
|
||||
'dragstart',
|
||||
'loadend',
|
||||
'animationstart',
|
||||
'search',
|
||||
'transitionrun',
|
||||
'transitionstart',
|
||||
'webkitanimationend',
|
||||
'webkitanimationiteration',
|
||||
'webkitanimationstart',
|
||||
'webkittransitionend',
|
||||
];
|
||||
const ieElementEventNames = [
|
||||
'activate',
|
||||
'afterupdate',
|
||||
'ariarequest',
|
||||
'beforeactivate',
|
||||
'beforedeactivate',
|
||||
'beforeeditfocus',
|
||||
'beforeupdate',
|
||||
'cellchange',
|
||||
'controlselect',
|
||||
'dataavailable',
|
||||
'datasetchanged',
|
||||
'datasetcomplete',
|
||||
'errorupdate',
|
||||
'filterchange',
|
||||
'layoutcomplete',
|
||||
'losecapture',
|
||||
'move',
|
||||
'moveend',
|
||||
'movestart',
|
||||
'propertychange',
|
||||
'resizeend',
|
||||
'resizestart',
|
||||
'rowenter',
|
||||
'rowexit',
|
||||
'rowsdelete',
|
||||
'rowsinserted',
|
||||
'command',
|
||||
'compassneedscalibration',
|
||||
'deactivate',
|
||||
'help',
|
||||
'mscontentzoom',
|
||||
'msmanipulationstatechanged',
|
||||
'msgesturechange',
|
||||
'msgesturedoubletap',
|
||||
'msgestureend',
|
||||
'msgesturehold',
|
||||
'msgesturestart',
|
||||
'msgesturetap',
|
||||
'msgotpointercapture',
|
||||
'msinertiastart',
|
||||
'mslostpointercapture',
|
||||
'mspointercancel',
|
||||
'mspointerdown',
|
||||
'mspointerenter',
|
||||
'mspointerhover',
|
||||
'mspointerleave',
|
||||
'mspointermove',
|
||||
'mspointerout',
|
||||
'mspointerover',
|
||||
'mspointerup',
|
||||
'pointerout',
|
||||
'mssitemodejumplistitemremoved',
|
||||
'msthumbnailclick',
|
||||
'stop',
|
||||
'storagecommit',
|
||||
];
|
||||
const webglEventNames = ['webglcontextrestored', 'webglcontextlost', 'webglcontextcreationerror'];
|
||||
const formEventNames = ['autocomplete', 'autocompleteerror'];
|
||||
const detailEventNames = ['toggle'];
|
||||
const eventNames = [
|
||||
...globalEventHandlersEventNames,
|
||||
...webglEventNames,
|
||||
...formEventNames,
|
||||
...detailEventNames,
|
||||
...documentEventNames,
|
||||
...windowEventNames,
|
||||
...htmlElementEventNames,
|
||||
...ieElementEventNames,
|
||||
];
|
||||
// Whenever any eventListener fires, we check the eventListener target and all parents
|
||||
// for `onwhatever` properties and replace them with zone-bound functions
|
||||
// - Chrome (for now)
|
||||
function patchViaCapturingAllTheEvents(api) {
|
||||
const unboundKey = api.symbol('unbound');
|
||||
for (let i = 0; i < eventNames.length; i++) {
|
||||
const property = eventNames[i];
|
||||
const onproperty = 'on' + property;
|
||||
self.addEventListener(property, function (event) {
|
||||
let elt = event.target, bound, source;
|
||||
if (elt) {
|
||||
source = elt.constructor['name'] + '.' + onproperty;
|
||||
}
|
||||
else {
|
||||
source = 'unknown.' + onproperty;
|
||||
}
|
||||
while (elt) {
|
||||
if (elt[onproperty] && !elt[onproperty][unboundKey]) {
|
||||
bound = api.wrapWithCurrentZone(elt[onproperty], source);
|
||||
bound[unboundKey] = elt[onproperty];
|
||||
elt[onproperty] = bound;
|
||||
}
|
||||
elt = elt.parentElement;
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
}
|
||||
|
||||
function registerElementPatch(_global, api) {
|
||||
const { isBrowser, isMix } = api.getGlobalObjects();
|
||||
if ((!isBrowser && !isMix) || !('registerElement' in _global.document)) {
|
||||
return;
|
||||
}
|
||||
const callbacks = [
|
||||
'createdCallback',
|
||||
'attachedCallback',
|
||||
'detachedCallback',
|
||||
'attributeChangedCallback',
|
||||
];
|
||||
api.patchCallbacks(api, document, 'Document', 'registerElement', callbacks);
|
||||
}
|
||||
|
||||
/**
|
||||
* @fileoverview
|
||||
* @suppress {missingRequire}
|
||||
*/
|
||||
function patchBrowserLegacy() {
|
||||
const _global = typeof window !== 'undefined'
|
||||
? window
|
||||
: typeof global !== 'undefined'
|
||||
? global
|
||||
: typeof self !== 'undefined'
|
||||
? self
|
||||
: {};
|
||||
const symbolPrefix = _global['__Zone_symbol_prefix'] || '__zone_symbol__';
|
||||
function __symbol__(name) {
|
||||
return symbolPrefix + name;
|
||||
}
|
||||
_global[__symbol__('legacyPatch')] = function () {
|
||||
const Zone = _global['Zone'];
|
||||
Zone.__load_patch('defineProperty', (global, Zone, api) => {
|
||||
api._redefineProperty = _redefineProperty;
|
||||
propertyPatch();
|
||||
});
|
||||
Zone.__load_patch('registerElement', (global, Zone, api) => {
|
||||
registerElementPatch(global, api);
|
||||
});
|
||||
Zone.__load_patch('EventTargetLegacy', (global, Zone, api) => {
|
||||
eventTargetLegacyPatch(global, api);
|
||||
propertyDescriptorLegacyPatch(api, global);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
patchBrowserLegacy();
|
6
node_modules/zone.js/fesm2015/zone-legacy.min.js
generated
vendored
Executable file
6
node_modules/zone.js/fesm2015/zone-legacy.min.js
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
3302
node_modules/zone.js/fesm2015/zone-mix.js
generated
vendored
Executable file
3302
node_modules/zone.js/fesm2015/zone-mix.js
generated
vendored
Executable file
File diff suppressed because it is too large
Load diff
6
node_modules/zone.js/fesm2015/zone-mix.min.js
generated
vendored
Executable file
6
node_modules/zone.js/fesm2015/zone-mix.min.js
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
2678
node_modules/zone.js/fesm2015/zone-node.js
generated
vendored
Executable file
2678
node_modules/zone.js/fesm2015/zone-node.js
generated
vendored
Executable file
File diff suppressed because it is too large
Load diff
6
node_modules/zone.js/fesm2015/zone-node.min.js
generated
vendored
Executable file
6
node_modules/zone.js/fesm2015/zone-node.min.js
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
20
node_modules/zone.js/fesm2015/zone-patch-canvas.js
generated
vendored
Executable file
20
node_modules/zone.js/fesm2015/zone-patch-canvas.js
generated
vendored
Executable file
|
@ -0,0 +1,20 @@
|
|||
'use strict';
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/
|
||||
function patchCanvas(Zone) {
|
||||
Zone.__load_patch('canvas', (global, Zone, api) => {
|
||||
const HTMLCanvasElement = global['HTMLCanvasElement'];
|
||||
if (typeof HTMLCanvasElement !== 'undefined' &&
|
||||
HTMLCanvasElement.prototype &&
|
||||
HTMLCanvasElement.prototype.toBlob) {
|
||||
api.patchMacroTask(HTMLCanvasElement.prototype, 'toBlob', (self, args) => {
|
||||
return { name: 'HTMLCanvasElement.toBlob', target: self, cbIdx: 0, args: args };
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
patchCanvas(Zone);
|
6
node_modules/zone.js/fesm2015/zone-patch-canvas.min.js
generated
vendored
Executable file
6
node_modules/zone.js/fesm2015/zone-patch-canvas.min.js
generated
vendored
Executable file
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/function patchCanvas(t){t.__load_patch("canvas",((t,a,o)=>{const n=t.HTMLCanvasElement;void 0!==n&&n.prototype&&n.prototype.toBlob&&o.patchMacroTask(n.prototype,"toBlob",((t,a)=>({name:"HTMLCanvasElement.toBlob",target:t,cbIdx:0,args:a})))}))}patchCanvas(Zone);
|
42
node_modules/zone.js/fesm2015/zone-patch-cordova.js
generated
vendored
Executable file
42
node_modules/zone.js/fesm2015/zone-patch-cordova.js
generated
vendored
Executable file
|
@ -0,0 +1,42 @@
|
|||
'use strict';
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/
|
||||
function patchCordova(Zone) {
|
||||
Zone.__load_patch('cordova', (global, Zone, api) => {
|
||||
if (global.cordova) {
|
||||
const SUCCESS_SOURCE = 'cordova.exec.success';
|
||||
const ERROR_SOURCE = 'cordova.exec.error';
|
||||
const FUNCTION = 'function';
|
||||
const nativeExec = api.patchMethod(global.cordova, 'exec', () => function (self, args) {
|
||||
if (args.length > 0 && typeof args[0] === FUNCTION) {
|
||||
args[0] = Zone.current.wrap(args[0], SUCCESS_SOURCE);
|
||||
}
|
||||
if (args.length > 1 && typeof args[1] === FUNCTION) {
|
||||
args[1] = Zone.current.wrap(args[1], ERROR_SOURCE);
|
||||
}
|
||||
return nativeExec.apply(self, args);
|
||||
});
|
||||
}
|
||||
});
|
||||
Zone.__load_patch('cordova.FileReader', (global, Zone) => {
|
||||
if (global.cordova && typeof global['FileReader'] !== 'undefined') {
|
||||
document.addEventListener('deviceReady', () => {
|
||||
const FileReader = global['FileReader'];
|
||||
['abort', 'error', 'load', 'loadstart', 'loadend', 'progress'].forEach((prop) => {
|
||||
const eventNameSymbol = Zone.__symbol__('ON_PROPERTY' + prop);
|
||||
Object.defineProperty(FileReader.prototype, eventNameSymbol, {
|
||||
configurable: true,
|
||||
get: function () {
|
||||
return this._realReader && this._realReader[eventNameSymbol];
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
patchCordova(Zone);
|
6
node_modules/zone.js/fesm2015/zone-patch-cordova.min.js
generated
vendored
Executable file
6
node_modules/zone.js/fesm2015/zone-patch-cordova.min.js
generated
vendored
Executable file
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/function patchCordova(e){e.__load_patch("cordova",((e,o,r)=>{if(e.cordova){const t="cordova.exec.success",a="cordova.exec.error",c="function",d=r.patchMethod(e.cordova,"exec",(()=>function(e,r){return r.length>0&&typeof r[0]===c&&(r[0]=o.current.wrap(r[0],t)),r.length>1&&typeof r[1]===c&&(r[1]=o.current.wrap(r[1],a)),d.apply(e,r)}))}})),e.__load_patch("cordova.FileReader",((e,o)=>{e.cordova&&void 0!==e.FileReader&&document.addEventListener("deviceReady",(()=>{const r=e.FileReader;["abort","error","load","loadstart","loadend","progress"].forEach((e=>{const t=o.__symbol__("ON_PROPERTY"+e);Object.defineProperty(r.prototype,t,{configurable:!0,get:function(){return this._realReader&&this._realReader[t]}})}))}))}))}patchCordova(Zone);
|
45
node_modules/zone.js/fesm2015/zone-patch-electron.js
generated
vendored
Executable file
45
node_modules/zone.js/fesm2015/zone-patch-electron.js
generated
vendored
Executable file
|
@ -0,0 +1,45 @@
|
|||
'use strict';
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/
|
||||
function patchElectron(Zone) {
|
||||
Zone.__load_patch('electron', (global, Zone, api) => {
|
||||
function patchArguments(target, name, source) {
|
||||
return api.patchMethod(target, name, (delegate) => (self, args) => {
|
||||
return delegate && delegate.apply(self, api.bindArguments(args, source));
|
||||
});
|
||||
}
|
||||
let { desktopCapturer, shell, CallbacksRegistry, ipcRenderer } = require('electron');
|
||||
if (!CallbacksRegistry) {
|
||||
try {
|
||||
// Try to load CallbacksRegistry class from @electron/remote src
|
||||
// since from electron 14+, the CallbacksRegistry is moved to @electron/remote
|
||||
// package and not exported to outside, so this is a hack to patch CallbacksRegistry.
|
||||
CallbacksRegistry =
|
||||
require('@electron/remote/dist/src/renderer/callbacks-registry').CallbacksRegistry;
|
||||
}
|
||||
catch (err) { }
|
||||
}
|
||||
// patch api in renderer process directly
|
||||
// desktopCapturer
|
||||
if (desktopCapturer) {
|
||||
patchArguments(desktopCapturer, 'getSources', 'electron.desktopCapturer.getSources');
|
||||
}
|
||||
// shell
|
||||
if (shell) {
|
||||
patchArguments(shell, 'openExternal', 'electron.shell.openExternal');
|
||||
}
|
||||
// patch api in main process through CallbackRegistry
|
||||
if (!CallbacksRegistry) {
|
||||
if (ipcRenderer) {
|
||||
patchArguments(ipcRenderer, 'on', 'ipcRenderer.on');
|
||||
}
|
||||
return;
|
||||
}
|
||||
patchArguments(CallbacksRegistry.prototype, 'add', 'CallbackRegistry.add');
|
||||
});
|
||||
}
|
||||
|
||||
patchElectron(Zone);
|
6
node_modules/zone.js/fesm2015/zone-patch-electron.min.js
generated
vendored
Executable file
6
node_modules/zone.js/fesm2015/zone-patch-electron.min.js
generated
vendored
Executable file
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/function patchElectron(e){e.__load_patch("electron",((e,r,t)=>{function c(e,r,c){return t.patchMethod(e,r,(e=>(r,l)=>e&&e.apply(r,t.bindArguments(l,c))))}let{desktopCapturer:l,shell:n,CallbacksRegistry:o,ipcRenderer:a}=require("electron");if(!o)try{o=require("@electron/remote/dist/src/renderer/callbacks-registry").CallbacksRegistry}catch(e){}l&&c(l,"getSources","electron.desktopCapturer.getSources"),n&&c(n,"openExternal","electron.shell.openExternal"),o?c(o.prototype,"add","CallbackRegistry.add"):a&&c(a,"on","ipcRenderer.on")}))}patchElectron(Zone);
|
95
node_modules/zone.js/fesm2015/zone-patch-fetch.js
generated
vendored
Executable file
95
node_modules/zone.js/fesm2015/zone-patch-fetch.js
generated
vendored
Executable file
|
@ -0,0 +1,95 @@
|
|||
'use strict';
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/
|
||||
/**
|
||||
* @fileoverview
|
||||
* @suppress {missingRequire}
|
||||
*/
|
||||
function patchFetch(Zone) {
|
||||
Zone.__load_patch('fetch', (global, Zone, api) => {
|
||||
let fetch = global['fetch'];
|
||||
if (typeof fetch !== 'function') {
|
||||
return;
|
||||
}
|
||||
const originalFetch = global[api.symbol('fetch')];
|
||||
if (originalFetch) {
|
||||
// restore unpatched fetch first
|
||||
fetch = originalFetch;
|
||||
}
|
||||
const ZoneAwarePromise = global.Promise;
|
||||
const symbolThenPatched = api.symbol('thenPatched');
|
||||
const fetchTaskScheduling = api.symbol('fetchTaskScheduling');
|
||||
const OriginalResponse = global.Response;
|
||||
const placeholder = function () { };
|
||||
const createFetchTask = (source, data, originalImpl, self, args, ac) => new Promise((resolve, reject) => {
|
||||
const task = Zone.current.scheduleMacroTask(source, placeholder, data, () => {
|
||||
// The promise object returned by the original implementation passed into the
|
||||
// function. This might be a `fetch` promise, `Response.prototype.json` promise,
|
||||
// etc.
|
||||
let implPromise;
|
||||
let zone = Zone.current;
|
||||
try {
|
||||
zone[fetchTaskScheduling] = true;
|
||||
implPromise = originalImpl.apply(self, args);
|
||||
}
|
||||
catch (error) {
|
||||
reject(error);
|
||||
return;
|
||||
}
|
||||
finally {
|
||||
zone[fetchTaskScheduling] = false;
|
||||
}
|
||||
if (!(implPromise instanceof ZoneAwarePromise)) {
|
||||
let ctor = implPromise.constructor;
|
||||
if (!ctor[symbolThenPatched]) {
|
||||
api.patchThen(ctor);
|
||||
}
|
||||
}
|
||||
implPromise.then((resource) => {
|
||||
if (task.state !== 'notScheduled') {
|
||||
task.invoke();
|
||||
}
|
||||
resolve(resource);
|
||||
}, (error) => {
|
||||
if (task.state !== 'notScheduled') {
|
||||
task.invoke();
|
||||
}
|
||||
reject(error);
|
||||
});
|
||||
}, () => {
|
||||
ac?.abort();
|
||||
});
|
||||
});
|
||||
global['fetch'] = function () {
|
||||
const args = Array.prototype.slice.call(arguments);
|
||||
const options = args.length > 1 ? args[1] : {};
|
||||
const signal = options?.signal;
|
||||
const ac = new AbortController();
|
||||
const fetchSignal = ac.signal;
|
||||
options.signal = fetchSignal;
|
||||
args[1] = options;
|
||||
if (signal) {
|
||||
const nativeAddEventListener = signal[Zone.__symbol__('addEventListener')] ||
|
||||
signal.addEventListener;
|
||||
nativeAddEventListener.call(signal, 'abort', function () {
|
||||
ac.abort();
|
||||
}, { once: true });
|
||||
}
|
||||
return createFetchTask('fetch', { fetchArgs: args }, fetch, this, args, ac);
|
||||
};
|
||||
if (OriginalResponse?.prototype) {
|
||||
// https://fetch.spec.whatwg.org/#body-mixin
|
||||
['arrayBuffer', 'blob', 'formData', 'json', 'text']
|
||||
// Safely check whether the method exists on the `Response` prototype before patching.
|
||||
.filter((method) => typeof OriginalResponse.prototype[method] === 'function')
|
||||
.forEach((method) => {
|
||||
api.patchMethod(OriginalResponse.prototype, method, (delegate) => (self, args) => createFetchTask(`Response.${method}`, undefined, delegate, self, args, undefined));
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
patchFetch(Zone);
|
6
node_modules/zone.js/fesm2015/zone-patch-fetch.min.js
generated
vendored
Executable file
6
node_modules/zone.js/fesm2015/zone-patch-fetch.min.js
generated
vendored
Executable file
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/function patchFetch(t){t.__load_patch("fetch",((t,e,o)=>{let n=t.fetch;if("function"!=typeof n)return;const c=t[o.symbol("fetch")];c&&(n=c);const r=t.Promise,a=o.symbol("thenPatched"),s=o.symbol("fetchTaskScheduling"),l=t.Response,h=function(){},i=(t,n,c,l,i,f)=>new Promise(((p,u)=>{const d=e.current.scheduleMacroTask(t,h,n,(()=>{let t,n=e.current;try{n[s]=!0,t=c.apply(l,i)}catch(t){return void u(t)}finally{n[s]=!1}if(!(t instanceof r)){let e=t.constructor;e[a]||o.patchThen(e)}t.then((t=>{"notScheduled"!==d.state&&d.invoke(),p(t)}),(t=>{"notScheduled"!==d.state&&d.invoke(),u(t)}))}),(()=>{f?.abort()}))}));t.fetch=function(){const t=Array.prototype.slice.call(arguments),o=t.length>1?t[1]:{},c=o?.signal,r=new AbortController;return o.signal=r.signal,t[1]=o,c&&(c[e.__symbol__("addEventListener")]||c.addEventListener).call(c,"abort",(function(){r.abort()}),{once:!0}),i("fetch",{fetchArgs:t},n,this,t,r)},l?.prototype&&["arrayBuffer","blob","formData","json","text"].filter((t=>"function"==typeof l.prototype[t])).forEach((t=>{o.patchMethod(l.prototype,t,(e=>(o,n)=>i(`Response.${t}`,void 0,e,o,n,void 0)))}))}))}patchFetch(Zone);
|
77
node_modules/zone.js/fesm2015/zone-patch-jsonp.js
generated
vendored
Executable file
77
node_modules/zone.js/fesm2015/zone-patch-jsonp.js
generated
vendored
Executable file
|
@ -0,0 +1,77 @@
|
|||
'use strict';
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/
|
||||
function patchJsonp(Zone) {
|
||||
Zone.__load_patch('jsonp', (global, Zone, api) => {
|
||||
// because jsonp is not a standard api, there are a lot of
|
||||
// implementations, so zone.js just provide a helper util to
|
||||
// patch the jsonp send and onSuccess/onError callback
|
||||
// the options is an object which contains
|
||||
// - jsonp, the jsonp object which hold the send function
|
||||
// - sendFuncName, the name of the send function
|
||||
// - successFuncName, success func name
|
||||
// - failedFuncName, failed func name
|
||||
Zone[Zone.__symbol__('jsonp')] = function patchJsonp(options) {
|
||||
if (!options || !options.jsonp || !options.sendFuncName) {
|
||||
return;
|
||||
}
|
||||
const noop = function () { };
|
||||
[options.successFuncName, options.failedFuncName].forEach((methodName) => {
|
||||
if (!methodName) {
|
||||
return;
|
||||
}
|
||||
const oriFunc = global[methodName];
|
||||
if (oriFunc) {
|
||||
api.patchMethod(global, methodName, (delegate) => (self, args) => {
|
||||
const task = global[api.symbol('jsonTask')];
|
||||
if (task) {
|
||||
task.callback = delegate;
|
||||
return task.invoke.apply(self, args);
|
||||
}
|
||||
else {
|
||||
return delegate.apply(self, args);
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
Object.defineProperty(global, methodName, {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return function () {
|
||||
const task = global[api.symbol('jsonpTask')];
|
||||
const delegate = global[api.symbol(`jsonp${methodName}callback`)];
|
||||
if (task) {
|
||||
if (delegate) {
|
||||
task.callback = delegate;
|
||||
}
|
||||
global[api.symbol('jsonpTask')] = undefined;
|
||||
return task.invoke.apply(this, arguments);
|
||||
}
|
||||
else {
|
||||
if (delegate) {
|
||||
return delegate.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
},
|
||||
set: function (callback) {
|
||||
this[api.symbol(`jsonp${methodName}callback`)] = callback;
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
api.patchMethod(options.jsonp, options.sendFuncName, (delegate) => (self, args) => {
|
||||
global[api.symbol('jsonpTask')] = Zone.current.scheduleMacroTask('jsonp', noop, {}, (task) => {
|
||||
return delegate.apply(self, args);
|
||||
}, noop);
|
||||
});
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
patchJsonp(Zone);
|
6
node_modules/zone.js/fesm2015/zone-patch-jsonp.min.js
generated
vendored
Executable file
6
node_modules/zone.js/fesm2015/zone-patch-jsonp.min.js
generated
vendored
Executable file
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/function patchJsonp(n){n.__load_patch("jsonp",((n,o,s)=>{o[o.__symbol__("jsonp")]=function c(a){if(!a||!a.jsonp||!a.sendFuncName)return;const e=function(){};[a.successFuncName,a.failedFuncName].forEach((o=>{o&&(n[o]?s.patchMethod(n,o,(o=>(c,a)=>{const e=n[s.symbol("jsonTask")];return e?(e.callback=o,e.invoke.apply(c,a)):o.apply(c,a)})):Object.defineProperty(n,o,{configurable:!0,enumerable:!0,get:function(){return function(){const c=n[s.symbol("jsonpTask")],a=n[s.symbol(`jsonp${o}callback`)];return c?(a&&(c.callback=a),n[s.symbol("jsonpTask")]=void 0,c.invoke.apply(this,arguments)):a?a.apply(this,arguments):null}},set:function(n){this[s.symbol(`jsonp${o}callback`)]=n}}))})),s.patchMethod(a.jsonp,a.sendFuncName,(c=>(a,t)=>{n[s.symbol("jsonpTask")]=o.current.scheduleMacroTask("jsonp",e,{},(n=>c.apply(a,t)),e)}))}}))}patchJsonp(Zone);
|
20
node_modules/zone.js/fesm2015/zone-patch-message-port.js
generated
vendored
Executable file
20
node_modules/zone.js/fesm2015/zone-patch-message-port.js
generated
vendored
Executable file
|
@ -0,0 +1,20 @@
|
|||
'use strict';
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/
|
||||
function patchMessagePort(Zone) {
|
||||
/**
|
||||
* Monkey patch `MessagePort.prototype.onmessage` and `MessagePort.prototype.onmessageerror`
|
||||
* properties to make the callback in the zone when the value are set.
|
||||
*/
|
||||
Zone.__load_patch('MessagePort', (global, Zone, api) => {
|
||||
const MessagePort = global['MessagePort'];
|
||||
if (typeof MessagePort !== 'undefined' && MessagePort.prototype) {
|
||||
api.patchOnProperties(MessagePort.prototype, ['message', 'messageerror']);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
patchMessagePort(Zone);
|
6
node_modules/zone.js/fesm2015/zone-patch-message-port.min.js
generated
vendored
Executable file
6
node_modules/zone.js/fesm2015/zone-patch-message-port.min.js
generated
vendored
Executable file
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/function patchMessagePort(e){e.__load_patch("MessagePort",((e,t,s)=>{const o=e.MessagePort;void 0!==o&&o.prototype&&s.patchOnProperties(o.prototype,["message","messageerror"])}))}patchMessagePort(Zone);
|
68
node_modules/zone.js/fesm2015/zone-patch-promise-test.js
generated
vendored
Executable file
68
node_modules/zone.js/fesm2015/zone-patch-promise-test.js
generated
vendored
Executable file
|
@ -0,0 +1,68 @@
|
|||
'use strict';
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/
|
||||
function patchPromiseTesting(Zone) {
|
||||
/**
|
||||
* Promise for async/fakeAsync zoneSpec test
|
||||
* can support async operation which not supported by zone.js
|
||||
* such as
|
||||
* it ('test jsonp in AsyncZone', async() => {
|
||||
* new Promise(res => {
|
||||
* jsonp(url, (data) => {
|
||||
* // success callback
|
||||
* res(data);
|
||||
* });
|
||||
* }).then((jsonpResult) => {
|
||||
* // get jsonp result.
|
||||
*
|
||||
* // user will expect AsyncZoneSpec wait for
|
||||
* // then, but because jsonp is not zone aware
|
||||
* // AsyncZone will finish before then is called.
|
||||
* });
|
||||
* });
|
||||
*/
|
||||
Zone.__load_patch('promisefortest', (global, Zone, api) => {
|
||||
const symbolState = api.symbol('state');
|
||||
const UNRESOLVED = null;
|
||||
const symbolParentUnresolved = api.symbol('parentUnresolved');
|
||||
// patch Promise.prototype.then to keep an internal
|
||||
// number for tracking unresolved chained promise
|
||||
// we will decrease this number when the parent promise
|
||||
// being resolved/rejected and chained promise was
|
||||
// scheduled as a microTask.
|
||||
// so we can know such kind of chained promise still
|
||||
// not resolved in AsyncTestZone
|
||||
Promise[api.symbol('patchPromiseForTest')] = function patchPromiseForTest() {
|
||||
let oriThen = Promise[Zone.__symbol__('ZonePromiseThen')];
|
||||
if (oriThen) {
|
||||
return;
|
||||
}
|
||||
oriThen = Promise[Zone.__symbol__('ZonePromiseThen')] = Promise.prototype.then;
|
||||
Promise.prototype.then = function () {
|
||||
const chained = oriThen.apply(this, arguments);
|
||||
if (this[symbolState] === UNRESOLVED) {
|
||||
// parent promise is unresolved.
|
||||
const asyncTestZoneSpec = Zone.current.get('AsyncTestZoneSpec');
|
||||
if (asyncTestZoneSpec) {
|
||||
asyncTestZoneSpec.unresolvedChainedPromiseCount++;
|
||||
chained[symbolParentUnresolved] = true;
|
||||
}
|
||||
}
|
||||
return chained;
|
||||
};
|
||||
};
|
||||
Promise[api.symbol('unPatchPromiseForTest')] = function unpatchPromiseForTest() {
|
||||
// restore origin then
|
||||
const oriThen = Promise[Zone.__symbol__('ZonePromiseThen')];
|
||||
if (oriThen) {
|
||||
Promise.prototype.then = oriThen;
|
||||
Promise[Zone.__symbol__('ZonePromiseThen')] = undefined;
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
patchPromiseTesting(Zone);
|
6
node_modules/zone.js/fesm2015/zone-patch-promise-test.min.js
generated
vendored
Executable file
6
node_modules/zone.js/fesm2015/zone-patch-promise-test.min.js
generated
vendored
Executable file
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/function patchPromiseTesting(o){o.__load_patch("promisefortest",((o,e,s)=>{const t=s.symbol("state"),n=s.symbol("parentUnresolved");Promise[s.symbol("patchPromiseForTest")]=function o(){let s=Promise[e.__symbol__("ZonePromiseThen")];s||(s=Promise[e.__symbol__("ZonePromiseThen")]=Promise.prototype.then,Promise.prototype.then=function(){const o=s.apply(this,arguments);if(null===this[t]){const s=e.current.get("AsyncTestZoneSpec");s&&(s.unresolvedChainedPromiseCount++,o[n]=!0)}return o})},Promise[s.symbol("unPatchPromiseForTest")]=function o(){const s=Promise[e.__symbol__("ZonePromiseThen")];s&&(Promise.prototype.then=s,Promise[e.__symbol__("ZonePromiseThen")]=void 0)}}))}patchPromiseTesting(Zone);
|
87
node_modules/zone.js/fesm2015/zone-patch-resize-observer.js
generated
vendored
Executable file
87
node_modules/zone.js/fesm2015/zone-patch-resize-observer.js
generated
vendored
Executable file
|
@ -0,0 +1,87 @@
|
|||
'use strict';
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/
|
||||
function patchResizeObserver(Zone) {
|
||||
Zone.__load_patch('ResizeObserver', (global, Zone, api) => {
|
||||
const ResizeObserver = global['ResizeObserver'];
|
||||
if (!ResizeObserver) {
|
||||
return;
|
||||
}
|
||||
const resizeObserverSymbol = api.symbol('ResizeObserver');
|
||||
api.patchMethod(global, 'ResizeObserver', (delegate) => (self, args) => {
|
||||
const callback = args.length > 0 ? args[0] : null;
|
||||
if (callback) {
|
||||
args[0] = function (entries, observer) {
|
||||
const zones = {};
|
||||
const currZone = Zone.current;
|
||||
for (let entry of entries) {
|
||||
let zone = entry.target[resizeObserverSymbol];
|
||||
if (!zone) {
|
||||
zone = currZone;
|
||||
}
|
||||
let zoneEntriesInfo = zones[zone.name];
|
||||
if (!zoneEntriesInfo) {
|
||||
zones[zone.name] = zoneEntriesInfo = { entries: [], zone: zone };
|
||||
}
|
||||
zoneEntriesInfo.entries.push(entry);
|
||||
}
|
||||
Object.keys(zones).forEach((zoneName) => {
|
||||
const zoneEntriesInfo = zones[zoneName];
|
||||
if (zoneEntriesInfo.zone !== Zone.current) {
|
||||
zoneEntriesInfo.zone.run(callback, this, [zoneEntriesInfo.entries, observer], 'ResizeObserver');
|
||||
}
|
||||
else {
|
||||
callback.call(this, zoneEntriesInfo.entries, observer);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
return args.length > 0 ? new ResizeObserver(args[0]) : new ResizeObserver();
|
||||
});
|
||||
api.patchMethod(ResizeObserver.prototype, 'observe', (delegate) => (self, args) => {
|
||||
const target = args.length > 0 ? args[0] : null;
|
||||
if (!target) {
|
||||
return delegate.apply(self, args);
|
||||
}
|
||||
let targets = self[resizeObserverSymbol];
|
||||
if (!targets) {
|
||||
targets = self[resizeObserverSymbol] = [];
|
||||
}
|
||||
targets.push(target);
|
||||
target[resizeObserverSymbol] = Zone.current;
|
||||
return delegate.apply(self, args);
|
||||
});
|
||||
api.patchMethod(ResizeObserver.prototype, 'unobserve', (delegate) => (self, args) => {
|
||||
const target = args.length > 0 ? args[0] : null;
|
||||
if (!target) {
|
||||
return delegate.apply(self, args);
|
||||
}
|
||||
let targets = self[resizeObserverSymbol];
|
||||
if (targets) {
|
||||
for (let i = 0; i < targets.length; i++) {
|
||||
if (targets[i] === target) {
|
||||
targets.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
target[resizeObserverSymbol] = undefined;
|
||||
return delegate.apply(self, args);
|
||||
});
|
||||
api.patchMethod(ResizeObserver.prototype, 'disconnect', (delegate) => (self, args) => {
|
||||
const targets = self[resizeObserverSymbol];
|
||||
if (targets) {
|
||||
targets.forEach((target) => {
|
||||
target[resizeObserverSymbol] = undefined;
|
||||
});
|
||||
self[resizeObserverSymbol] = undefined;
|
||||
}
|
||||
return delegate.apply(self, args);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
patchResizeObserver(Zone);
|
6
node_modules/zone.js/fesm2015/zone-patch-resize-observer.min.js
generated
vendored
Executable file
6
node_modules/zone.js/fesm2015/zone-patch-resize-observer.min.js
generated
vendored
Executable file
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/function patchResizeObserver(e){e.__load_patch("ResizeObserver",((e,t,r)=>{const n=e.ResizeObserver;if(!n)return;const s=r.symbol("ResizeObserver");r.patchMethod(e,"ResizeObserver",(e=>(e,r)=>{const o=r.length>0?r[0]:null;return o&&(r[0]=function(e,r){const n={},c=t.current;for(let t of e){let e=t.target[s];e||(e=c);let r=n[e.name];r||(n[e.name]=r={entries:[],zone:e}),r.entries.push(t)}Object.keys(n).forEach((e=>{const s=n[e];s.zone!==t.current?s.zone.run(o,this,[s.entries,r],"ResizeObserver"):o.call(this,s.entries,r)}))}),r.length>0?new n(r[0]):new n})),r.patchMethod(n.prototype,"observe",(e=>(r,n)=>{const o=n.length>0?n[0]:null;if(!o)return e.apply(r,n);let c=r[s];return c||(c=r[s]=[]),c.push(o),o[s]=t.current,e.apply(r,n)})),r.patchMethod(n.prototype,"unobserve",(e=>(t,r)=>{const n=r.length>0?r[0]:null;if(!n)return e.apply(t,r);let o=t[s];if(o)for(let e=0;e<o.length;e++)if(o[e]===n){o.splice(e,1);break}return n[s]=void 0,e.apply(t,r)})),r.patchMethod(n.prototype,"disconnect",(e=>(t,r)=>{const n=t[s];return n&&(n.forEach((e=>{e[s]=void 0})),t[s]=void 0),e.apply(t,r)}))}))}patchResizeObserver(Zone);
|
175
node_modules/zone.js/fesm2015/zone-patch-rxjs-fake-async.js
generated
vendored
Executable file
175
node_modules/zone.js/fesm2015/zone-patch-rxjs-fake-async.js
generated
vendored
Executable file
|
@ -0,0 +1,175 @@
|
|||
'use strict';
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/
|
||||
class ProxyZoneSpec {
|
||||
static get() {
|
||||
return Zone.current.get('ProxyZoneSpec');
|
||||
}
|
||||
static isLoaded() {
|
||||
return ProxyZoneSpec.get() instanceof ProxyZoneSpec;
|
||||
}
|
||||
static assertPresent() {
|
||||
if (!ProxyZoneSpec.isLoaded()) {
|
||||
throw new Error(`Expected to be running in 'ProxyZone', but it was not found.`);
|
||||
}
|
||||
return ProxyZoneSpec.get();
|
||||
}
|
||||
constructor(defaultSpecDelegate = null) {
|
||||
this.defaultSpecDelegate = defaultSpecDelegate;
|
||||
this.name = 'ProxyZone';
|
||||
this._delegateSpec = null;
|
||||
this.properties = { 'ProxyZoneSpec': this };
|
||||
this.propertyKeys = null;
|
||||
this.lastTaskState = null;
|
||||
this.isNeedToTriggerHasTask = false;
|
||||
this.tasks = [];
|
||||
this.setDelegate(defaultSpecDelegate);
|
||||
}
|
||||
setDelegate(delegateSpec) {
|
||||
const isNewDelegate = this._delegateSpec !== delegateSpec;
|
||||
this._delegateSpec = delegateSpec;
|
||||
this.propertyKeys && this.propertyKeys.forEach((key) => delete this.properties[key]);
|
||||
this.propertyKeys = null;
|
||||
if (delegateSpec && delegateSpec.properties) {
|
||||
this.propertyKeys = Object.keys(delegateSpec.properties);
|
||||
this.propertyKeys.forEach((k) => (this.properties[k] = delegateSpec.properties[k]));
|
||||
}
|
||||
// if a new delegateSpec was set, check if we need to trigger hasTask
|
||||
if (isNewDelegate &&
|
||||
this.lastTaskState &&
|
||||
(this.lastTaskState.macroTask || this.lastTaskState.microTask)) {
|
||||
this.isNeedToTriggerHasTask = true;
|
||||
}
|
||||
}
|
||||
getDelegate() {
|
||||
return this._delegateSpec;
|
||||
}
|
||||
resetDelegate() {
|
||||
this.getDelegate();
|
||||
this.setDelegate(this.defaultSpecDelegate);
|
||||
}
|
||||
tryTriggerHasTask(parentZoneDelegate, currentZone, targetZone) {
|
||||
if (this.isNeedToTriggerHasTask && this.lastTaskState) {
|
||||
// last delegateSpec has microTask or macroTask
|
||||
// should call onHasTask in current delegateSpec
|
||||
this.isNeedToTriggerHasTask = false;
|
||||
this.onHasTask(parentZoneDelegate, currentZone, targetZone, this.lastTaskState);
|
||||
}
|
||||
}
|
||||
removeFromTasks(task) {
|
||||
if (!this.tasks) {
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < this.tasks.length; i++) {
|
||||
if (this.tasks[i] === task) {
|
||||
this.tasks.splice(i, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
getAndClearPendingTasksInfo() {
|
||||
if (this.tasks.length === 0) {
|
||||
return '';
|
||||
}
|
||||
const taskInfo = this.tasks.map((task) => {
|
||||
const dataInfo = task.data &&
|
||||
Object.keys(task.data)
|
||||
.map((key) => {
|
||||
return key + ':' + task.data[key];
|
||||
})
|
||||
.join(',');
|
||||
return `type: ${task.type}, source: ${task.source}, args: {${dataInfo}}`;
|
||||
});
|
||||
const pendingTasksInfo = '--Pending async tasks are: [' + taskInfo + ']';
|
||||
// clear tasks
|
||||
this.tasks = [];
|
||||
return pendingTasksInfo;
|
||||
}
|
||||
onFork(parentZoneDelegate, currentZone, targetZone, zoneSpec) {
|
||||
if (this._delegateSpec && this._delegateSpec.onFork) {
|
||||
return this._delegateSpec.onFork(parentZoneDelegate, currentZone, targetZone, zoneSpec);
|
||||
}
|
||||
else {
|
||||
return parentZoneDelegate.fork(targetZone, zoneSpec);
|
||||
}
|
||||
}
|
||||
onIntercept(parentZoneDelegate, currentZone, targetZone, delegate, source) {
|
||||
if (this._delegateSpec && this._delegateSpec.onIntercept) {
|
||||
return this._delegateSpec.onIntercept(parentZoneDelegate, currentZone, targetZone, delegate, source);
|
||||
}
|
||||
else {
|
||||
return parentZoneDelegate.intercept(targetZone, delegate, source);
|
||||
}
|
||||
}
|
||||
onInvoke(parentZoneDelegate, currentZone, targetZone, delegate, applyThis, applyArgs, source) {
|
||||
this.tryTriggerHasTask(parentZoneDelegate, currentZone, targetZone);
|
||||
if (this._delegateSpec && this._delegateSpec.onInvoke) {
|
||||
return this._delegateSpec.onInvoke(parentZoneDelegate, currentZone, targetZone, delegate, applyThis, applyArgs, source);
|
||||
}
|
||||
else {
|
||||
return parentZoneDelegate.invoke(targetZone, delegate, applyThis, applyArgs, source);
|
||||
}
|
||||
}
|
||||
onHandleError(parentZoneDelegate, currentZone, targetZone, error) {
|
||||
if (this._delegateSpec && this._delegateSpec.onHandleError) {
|
||||
return this._delegateSpec.onHandleError(parentZoneDelegate, currentZone, targetZone, error);
|
||||
}
|
||||
else {
|
||||
return parentZoneDelegate.handleError(targetZone, error);
|
||||
}
|
||||
}
|
||||
onScheduleTask(parentZoneDelegate, currentZone, targetZone, task) {
|
||||
if (task.type !== 'eventTask') {
|
||||
this.tasks.push(task);
|
||||
}
|
||||
if (this._delegateSpec && this._delegateSpec.onScheduleTask) {
|
||||
return this._delegateSpec.onScheduleTask(parentZoneDelegate, currentZone, targetZone, task);
|
||||
}
|
||||
else {
|
||||
return parentZoneDelegate.scheduleTask(targetZone, task);
|
||||
}
|
||||
}
|
||||
onInvokeTask(parentZoneDelegate, currentZone, targetZone, task, applyThis, applyArgs) {
|
||||
if (task.type !== 'eventTask') {
|
||||
this.removeFromTasks(task);
|
||||
}
|
||||
this.tryTriggerHasTask(parentZoneDelegate, currentZone, targetZone);
|
||||
if (this._delegateSpec && this._delegateSpec.onInvokeTask) {
|
||||
return this._delegateSpec.onInvokeTask(parentZoneDelegate, currentZone, targetZone, task, applyThis, applyArgs);
|
||||
}
|
||||
else {
|
||||
return parentZoneDelegate.invokeTask(targetZone, task, applyThis, applyArgs);
|
||||
}
|
||||
}
|
||||
onCancelTask(parentZoneDelegate, currentZone, targetZone, task) {
|
||||
if (task.type !== 'eventTask') {
|
||||
this.removeFromTasks(task);
|
||||
}
|
||||
this.tryTriggerHasTask(parentZoneDelegate, currentZone, targetZone);
|
||||
if (this._delegateSpec && this._delegateSpec.onCancelTask) {
|
||||
return this._delegateSpec.onCancelTask(parentZoneDelegate, currentZone, targetZone, task);
|
||||
}
|
||||
else {
|
||||
return parentZoneDelegate.cancelTask(targetZone, task);
|
||||
}
|
||||
}
|
||||
onHasTask(delegate, current, target, hasTaskState) {
|
||||
this.lastTaskState = hasTaskState;
|
||||
if (this._delegateSpec && this._delegateSpec.onHasTask) {
|
||||
this._delegateSpec.onHasTask(delegate, current, target, hasTaskState);
|
||||
}
|
||||
else {
|
||||
delegate.hasTask(target, hasTaskState);
|
||||
}
|
||||
}
|
||||
}
|
||||
function patchProxyZoneSpec(Zone) {
|
||||
// Export the class so that new instances can be created with proper
|
||||
// constructor params.
|
||||
Zone['ProxyZoneSpec'] = ProxyZoneSpec;
|
||||
}
|
||||
|
||||
patchProxyZoneSpec(Zone);
|
6
node_modules/zone.js/fesm2015/zone-patch-rxjs-fake-async.min.js
generated
vendored
Executable file
6
node_modules/zone.js/fesm2015/zone-patch-rxjs-fake-async.min.js
generated
vendored
Executable file
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/class ProxyZoneSpec{static get(){return Zone.current.get("ProxyZoneSpec")}static isLoaded(){return ProxyZoneSpec.get()instanceof ProxyZoneSpec}static assertPresent(){if(!ProxyZoneSpec.isLoaded())throw new Error("Expected to be running in 'ProxyZone', but it was not found.");return ProxyZoneSpec.get()}constructor(e=null){this.defaultSpecDelegate=e,this.name="ProxyZone",this._delegateSpec=null,this.properties={ProxyZoneSpec:this},this.propertyKeys=null,this.lastTaskState=null,this.isNeedToTriggerHasTask=!1,this.tasks=[],this.setDelegate(e)}setDelegate(e){const t=this._delegateSpec!==e;this._delegateSpec=e,this.propertyKeys&&this.propertyKeys.forEach((e=>delete this.properties[e])),this.propertyKeys=null,e&&e.properties&&(this.propertyKeys=Object.keys(e.properties),this.propertyKeys.forEach((t=>this.properties[t]=e.properties[t]))),t&&this.lastTaskState&&(this.lastTaskState.macroTask||this.lastTaskState.microTask)&&(this.isNeedToTriggerHasTask=!0)}getDelegate(){return this._delegateSpec}resetDelegate(){this.getDelegate(),this.setDelegate(this.defaultSpecDelegate)}tryTriggerHasTask(e,t,s){this.isNeedToTriggerHasTask&&this.lastTaskState&&(this.isNeedToTriggerHasTask=!1,this.onHasTask(e,t,s,this.lastTaskState))}removeFromTasks(e){if(this.tasks)for(let t=0;t<this.tasks.length;t++)if(this.tasks[t]===e)return void this.tasks.splice(t,1)}getAndClearPendingTasksInfo(){if(0===this.tasks.length)return"";const e="--Pending async tasks are: ["+this.tasks.map((e=>{const t=e.data&&Object.keys(e.data).map((t=>t+":"+e.data[t])).join(",");return`type: ${e.type}, source: ${e.source}, args: {${t}}`}))+"]";return this.tasks=[],e}onFork(e,t,s,a){return this._delegateSpec&&this._delegateSpec.onFork?this._delegateSpec.onFork(e,t,s,a):e.fork(s,a)}onIntercept(e,t,s,a,r){return this._delegateSpec&&this._delegateSpec.onIntercept?this._delegateSpec.onIntercept(e,t,s,a,r):e.intercept(s,a,r)}onInvoke(e,t,s,a,r,o,i){return this.tryTriggerHasTask(e,t,s),this._delegateSpec&&this._delegateSpec.onInvoke?this._delegateSpec.onInvoke(e,t,s,a,r,o,i):e.invoke(s,a,r,o,i)}onHandleError(e,t,s,a){return this._delegateSpec&&this._delegateSpec.onHandleError?this._delegateSpec.onHandleError(e,t,s,a):e.handleError(s,a)}onScheduleTask(e,t,s,a){return"eventTask"!==a.type&&this.tasks.push(a),this._delegateSpec&&this._delegateSpec.onScheduleTask?this._delegateSpec.onScheduleTask(e,t,s,a):e.scheduleTask(s,a)}onInvokeTask(e,t,s,a,r,o){return"eventTask"!==a.type&&this.removeFromTasks(a),this.tryTriggerHasTask(e,t,s),this._delegateSpec&&this._delegateSpec.onInvokeTask?this._delegateSpec.onInvokeTask(e,t,s,a,r,o):e.invokeTask(s,a,r,o)}onCancelTask(e,t,s,a){return"eventTask"!==a.type&&this.removeFromTasks(a),this.tryTriggerHasTask(e,t,s),this._delegateSpec&&this._delegateSpec.onCancelTask?this._delegateSpec.onCancelTask(e,t,s,a):e.cancelTask(s,a)}onHasTask(e,t,s,a){this.lastTaskState=a,this._delegateSpec&&this._delegateSpec.onHasTask?this._delegateSpec.onHasTask(e,t,s,a):e.hasTask(s,a)}}function patchProxyZoneSpec(e){e.ProxyZoneSpec=ProxyZoneSpec}patchProxyZoneSpec(Zone);
|
200
node_modules/zone.js/fesm2015/zone-patch-rxjs.js
generated
vendored
Executable file
200
node_modules/zone.js/fesm2015/zone-patch-rxjs.js
generated
vendored
Executable file
|
@ -0,0 +1,200 @@
|
|||
'use strict';
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/
|
||||
import { Observable, Subscription, Subscriber } from 'rxjs';
|
||||
|
||||
function patchRxJs(Zone) {
|
||||
Zone.__load_patch('rxjs', (global, Zone, api) => {
|
||||
const symbol = Zone.__symbol__;
|
||||
const nextSource = 'rxjs.Subscriber.next';
|
||||
const errorSource = 'rxjs.Subscriber.error';
|
||||
const completeSource = 'rxjs.Subscriber.complete';
|
||||
const ObjectDefineProperties = Object.defineProperties;
|
||||
const patchObservable = function () {
|
||||
const ObservablePrototype = Observable.prototype;
|
||||
const _symbolSubscribe = symbol('_subscribe');
|
||||
const _subscribe = (ObservablePrototype[_symbolSubscribe] = ObservablePrototype._subscribe);
|
||||
ObjectDefineProperties(Observable.prototype, {
|
||||
_zone: { value: null, writable: true, configurable: true },
|
||||
_zoneSource: { value: null, writable: true, configurable: true },
|
||||
_zoneSubscribe: { value: null, writable: true, configurable: true },
|
||||
source: {
|
||||
configurable: true,
|
||||
get: function () {
|
||||
return this._zoneSource;
|
||||
},
|
||||
set: function (source) {
|
||||
this._zone = Zone.current;
|
||||
this._zoneSource = source;
|
||||
},
|
||||
},
|
||||
_subscribe: {
|
||||
configurable: true,
|
||||
get: function () {
|
||||
if (this._zoneSubscribe) {
|
||||
return this._zoneSubscribe;
|
||||
}
|
||||
else if (this.constructor === Observable) {
|
||||
return _subscribe;
|
||||
}
|
||||
const proto = Object.getPrototypeOf(this);
|
||||
return proto && proto._subscribe;
|
||||
},
|
||||
set: function (subscribe) {
|
||||
this._zone = Zone.current;
|
||||
if (!subscribe) {
|
||||
this._zoneSubscribe = subscribe;
|
||||
}
|
||||
else {
|
||||
this._zoneSubscribe = function () {
|
||||
if (this._zone && this._zone !== Zone.current) {
|
||||
const tearDown = this._zone.run(subscribe, this, arguments);
|
||||
if (typeof tearDown === 'function') {
|
||||
const zone = this._zone;
|
||||
return function () {
|
||||
if (zone !== Zone.current) {
|
||||
return zone.run(tearDown, this, arguments);
|
||||
}
|
||||
return tearDown.apply(this, arguments);
|
||||
};
|
||||
}
|
||||
else {
|
||||
return tearDown;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return subscribe.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
},
|
||||
subjectFactory: {
|
||||
get: function () {
|
||||
return this._zoneSubjectFactory;
|
||||
},
|
||||
set: function (factory) {
|
||||
const zone = this._zone;
|
||||
this._zoneSubjectFactory = function () {
|
||||
if (zone && zone !== Zone.current) {
|
||||
return zone.run(factory, this, arguments);
|
||||
}
|
||||
return factory.apply(this, arguments);
|
||||
};
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
api.patchMethod(Observable.prototype, 'lift', (delegate) => (self, args) => {
|
||||
const observable = delegate.apply(self, args);
|
||||
if (observable.operator) {
|
||||
observable.operator._zone = Zone.current;
|
||||
api.patchMethod(observable.operator, 'call', (operatorDelegate) => (operatorSelf, operatorArgs) => {
|
||||
if (operatorSelf._zone && operatorSelf._zone !== Zone.current) {
|
||||
return operatorSelf._zone.run(operatorDelegate, operatorSelf, operatorArgs);
|
||||
}
|
||||
return operatorDelegate.apply(operatorSelf, operatorArgs);
|
||||
});
|
||||
}
|
||||
return observable;
|
||||
});
|
||||
const patchSubscription = function () {
|
||||
ObjectDefineProperties(Subscription.prototype, {
|
||||
_zone: { value: null, writable: true, configurable: true },
|
||||
_zoneUnsubscribe: { value: null, writable: true, configurable: true },
|
||||
_unsubscribe: {
|
||||
get: function () {
|
||||
if (this._zoneUnsubscribe || this._zoneUnsubscribeCleared) {
|
||||
return this._zoneUnsubscribe;
|
||||
}
|
||||
const proto = Object.getPrototypeOf(this);
|
||||
return proto && proto._unsubscribe;
|
||||
},
|
||||
set: function (unsubscribe) {
|
||||
this._zone = Zone.current;
|
||||
if (!unsubscribe) {
|
||||
this._zoneUnsubscribe = unsubscribe;
|
||||
// In some operator such as `retryWhen`, the _unsubscribe
|
||||
// method will be set to null, so we need to set another flag
|
||||
// to tell that we should return null instead of finding
|
||||
// in the prototype chain.
|
||||
this._zoneUnsubscribeCleared = true;
|
||||
}
|
||||
else {
|
||||
this._zoneUnsubscribeCleared = false;
|
||||
this._zoneUnsubscribe = function () {
|
||||
if (this._zone && this._zone !== Zone.current) {
|
||||
return this._zone.run(unsubscribe, this, arguments);
|
||||
}
|
||||
else {
|
||||
return unsubscribe.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
const patchSubscriber = function () {
|
||||
const next = Subscriber.prototype.next;
|
||||
const error = Subscriber.prototype.error;
|
||||
const complete = Subscriber.prototype.complete;
|
||||
Object.defineProperty(Subscriber.prototype, 'destination', {
|
||||
configurable: true,
|
||||
get: function () {
|
||||
return this._zoneDestination;
|
||||
},
|
||||
set: function (destination) {
|
||||
this._zone = Zone.current;
|
||||
this._zoneDestination = destination;
|
||||
},
|
||||
});
|
||||
// patch Subscriber.next to make sure it run
|
||||
// into SubscriptionZone
|
||||
Subscriber.prototype.next = function () {
|
||||
const currentZone = Zone.current;
|
||||
const subscriptionZone = this._zone;
|
||||
// for performance concern, check Zone.current
|
||||
// equal with this._zone(SubscriptionZone) or not
|
||||
if (subscriptionZone && subscriptionZone !== currentZone) {
|
||||
return subscriptionZone.run(next, this, arguments, nextSource);
|
||||
}
|
||||
else {
|
||||
return next.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
Subscriber.prototype.error = function () {
|
||||
const currentZone = Zone.current;
|
||||
const subscriptionZone = this._zone;
|
||||
// for performance concern, check Zone.current
|
||||
// equal with this._zone(SubscriptionZone) or not
|
||||
if (subscriptionZone && subscriptionZone !== currentZone) {
|
||||
return subscriptionZone.run(error, this, arguments, errorSource);
|
||||
}
|
||||
else {
|
||||
return error.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
Subscriber.prototype.complete = function () {
|
||||
const currentZone = Zone.current;
|
||||
const subscriptionZone = this._zone;
|
||||
// for performance concern, check Zone.current
|
||||
// equal with this._zone(SubscriptionZone) or not
|
||||
if (subscriptionZone && subscriptionZone !== currentZone) {
|
||||
return subscriptionZone.run(complete, this, arguments, completeSource);
|
||||
}
|
||||
else {
|
||||
return complete.call(this);
|
||||
}
|
||||
};
|
||||
};
|
||||
patchObservable();
|
||||
patchSubscription();
|
||||
patchSubscriber();
|
||||
});
|
||||
}
|
||||
|
||||
patchRxJs(Zone);
|
6
node_modules/zone.js/fesm2015/zone-patch-rxjs.min.js
generated
vendored
Executable file
6
node_modules/zone.js/fesm2015/zone-patch-rxjs.min.js
generated
vendored
Executable file
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/import{Observable,Subscription,Subscriber}from"rxjs";function patchRxJs(e){e.__load_patch("rxjs",((e,t,r)=>{const n=t.__symbol__,o=Object.defineProperties;r.patchMethod(Observable.prototype,"lift",(e=>(n,o)=>{const i=e.apply(n,o);return i.operator&&(i.operator._zone=t.current,r.patchMethod(i.operator,"call",(e=>(r,n)=>r._zone&&r._zone!==t.current?r._zone.run(e,r,n):e.apply(r,n)))),i})),function(){const e=Observable.prototype,r=e[n("_subscribe")]=e._subscribe;o(Observable.prototype,{_zone:{value:null,writable:!0,configurable:!0},_zoneSource:{value:null,writable:!0,configurable:!0},_zoneSubscribe:{value:null,writable:!0,configurable:!0},source:{configurable:!0,get:function(){return this._zoneSource},set:function(e){this._zone=t.current,this._zoneSource=e}},_subscribe:{configurable:!0,get:function(){if(this._zoneSubscribe)return this._zoneSubscribe;if(this.constructor===Observable)return r;const e=Object.getPrototypeOf(this);return e&&e._subscribe},set:function(e){this._zone=t.current,this._zoneSubscribe=e?function(){if(this._zone&&this._zone!==t.current){const r=this._zone.run(e,this,arguments);if("function"==typeof r){const e=this._zone;return function(){return e!==t.current?e.run(r,this,arguments):r.apply(this,arguments)}}return r}return e.apply(this,arguments)}:e}},subjectFactory:{get:function(){return this._zoneSubjectFactory},set:function(e){const r=this._zone;this._zoneSubjectFactory=function(){return r&&r!==t.current?r.run(e,this,arguments):e.apply(this,arguments)}}}})}(),o(Subscription.prototype,{_zone:{value:null,writable:!0,configurable:!0},_zoneUnsubscribe:{value:null,writable:!0,configurable:!0},_unsubscribe:{get:function(){if(this._zoneUnsubscribe||this._zoneUnsubscribeCleared)return this._zoneUnsubscribe;const e=Object.getPrototypeOf(this);return e&&e._unsubscribe},set:function(e){this._zone=t.current,e?(this._zoneUnsubscribeCleared=!1,this._zoneUnsubscribe=function(){return this._zone&&this._zone!==t.current?this._zone.run(e,this,arguments):e.apply(this,arguments)}):(this._zoneUnsubscribe=e,this._zoneUnsubscribeCleared=!0)}}}),function(){const e=Subscriber.prototype.next,r=Subscriber.prototype.error,n=Subscriber.prototype.complete;Object.defineProperty(Subscriber.prototype,"destination",{configurable:!0,get:function(){return this._zoneDestination},set:function(e){this._zone=t.current,this._zoneDestination=e}}),Subscriber.prototype.next=function(){const r=this._zone;return r&&r!==t.current?r.run(e,this,arguments,"rxjs.Subscriber.next"):e.apply(this,arguments)},Subscriber.prototype.error=function(){const e=this._zone;return e&&e!==t.current?e.run(r,this,arguments,"rxjs.Subscriber.error"):r.apply(this,arguments)},Subscriber.prototype.complete=function(){const e=this._zone;return e&&e!==t.current?e.run(n,this,arguments,"rxjs.Subscriber.complete"):n.call(this)}}()}))}patchRxJs(Zone);
|
29
node_modules/zone.js/fesm2015/zone-patch-socket-io.js
generated
vendored
Executable file
29
node_modules/zone.js/fesm2015/zone-patch-socket-io.js
generated
vendored
Executable file
|
@ -0,0 +1,29 @@
|
|||
'use strict';
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/
|
||||
function patchSocketIo(Zone) {
|
||||
Zone.__load_patch('socketio', (global, Zone, api) => {
|
||||
Zone[Zone.__symbol__('socketio')] = function patchSocketIO(io) {
|
||||
// patch io.Socket.prototype event listener related method
|
||||
api.patchEventTarget(global, api, [io.Socket.prototype], {
|
||||
useG: false,
|
||||
chkDup: false,
|
||||
rt: true,
|
||||
diff: (task, delegate) => {
|
||||
return task.callback === delegate;
|
||||
},
|
||||
});
|
||||
// also patch io.Socket.prototype.on/off/removeListener/removeAllListeners
|
||||
io.Socket.prototype.on = io.Socket.prototype.addEventListener;
|
||||
io.Socket.prototype.off =
|
||||
io.Socket.prototype.removeListener =
|
||||
io.Socket.prototype.removeAllListeners =
|
||||
io.Socket.prototype.removeEventListener;
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
patchSocketIo(Zone);
|
6
node_modules/zone.js/fesm2015/zone-patch-socket-io.min.js
generated
vendored
Executable file
6
node_modules/zone.js/fesm2015/zone-patch-socket-io.min.js
generated
vendored
Executable file
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/function patchSocketIo(t){t.__load_patch("socketio",((t,e,o)=>{e[e.__symbol__("socketio")]=function e(c){o.patchEventTarget(t,o,[c.Socket.prototype],{useG:!1,chkDup:!1,rt:!0,diff:(t,e)=>t.callback===e}),c.Socket.prototype.on=c.Socket.prototype.addEventListener,c.Socket.prototype.off=c.Socket.prototype.removeListener=c.Socket.prototype.removeAllListeners=c.Socket.prototype.removeEventListener}}))}patchSocketIo(Zone);
|
23
node_modules/zone.js/fesm2015/zone-patch-user-media.js
generated
vendored
Executable file
23
node_modules/zone.js/fesm2015/zone-patch-user-media.js
generated
vendored
Executable file
|
@ -0,0 +1,23 @@
|
|||
'use strict';
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/
|
||||
function patchUserMedia(Zone) {
|
||||
Zone.__load_patch('getUserMedia', (global, Zone, api) => {
|
||||
function wrapFunctionArgs(func, source) {
|
||||
return function () {
|
||||
const args = Array.prototype.slice.call(arguments);
|
||||
const wrappedArgs = api.bindArguments(args, source ? source : func.name);
|
||||
return func.apply(this, wrappedArgs);
|
||||
};
|
||||
}
|
||||
let navigator = global['navigator'];
|
||||
if (navigator && navigator.getUserMedia) {
|
||||
navigator.getUserMedia = wrapFunctionArgs(navigator.getUserMedia);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
patchUserMedia(Zone);
|
6
node_modules/zone.js/fesm2015/zone-patch-user-media.min.js
generated
vendored
Executable file
6
node_modules/zone.js/fesm2015/zone-patch-user-media.min.js
generated
vendored
Executable file
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license Angular v<unknown>
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/function patchUserMedia(e){e.__load_patch("getUserMedia",((e,t,a)=>{let r=e.navigator;r&&r.getUserMedia&&(r.getUserMedia=function i(e,t){return function(){const r=Array.prototype.slice.call(arguments),i=a.bindArguments(r,t||e.name);return e.apply(this,i)}}(r.getUserMedia))}))}patchUserMedia(Zone);
|
2239
node_modules/zone.js/fesm2015/zone-testing.js
generated
vendored
Executable file
2239
node_modules/zone.js/fesm2015/zone-testing.js
generated
vendored
Executable file
File diff suppressed because it is too large
Load diff
6
node_modules/zone.js/fesm2015/zone-testing.min.js
generated
vendored
Executable file
6
node_modules/zone.js/fesm2015/zone-testing.min.js
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
2964
node_modules/zone.js/fesm2015/zone.js
generated
vendored
Executable file
2964
node_modules/zone.js/fesm2015/zone.js
generated
vendored
Executable file
File diff suppressed because it is too large
Load diff
6
node_modules/zone.js/fesm2015/zone.min.js
generated
vendored
Executable file
6
node_modules/zone.js/fesm2015/zone.min.js
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue