_id
stringlengths
21
254
text
stringlengths
1
93.7k
metadata
dict
angular/packages/service-worker/worker/test/idle_spec.ts_0_6737
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {IdleScheduler} from '../src/idle'; import {SwTestHarness, SwTestHarnessBuilder} from '../testing/scope'; import {envIsSupported} from '../testing/utils'; (function () { // Skip environments that don't support the minimum APIs needed to run the SW tests. if (!envIsSupported()) { return; } describe('IdleScheduler', () => { let scope: SwTestHarness; let idle: IdleScheduler; beforeEach(() => { scope = new SwTestHarnessBuilder().build(); idle = new IdleScheduler(scope, 1000, 3000, { log: (v, context) => console.error(v, context), }); }); // Validate that a single idle task executes when trigger() // is called and the idle timeout passes. it('executes scheduled work on time', async () => { // Set up a single idle task to set the completed flag to true when it runs. let completed: boolean = false; idle.schedule('work', async () => { completed = true; }); // Simply scheduling the task should not cause it to execute. expect(completed).toEqual(false); // Trigger the idle mechanism. This returns a Promise that should resolve // once the idle timeout has passed. const trigger = idle.trigger(); // Advance the clock beyond the idle timeout, causing the idle tasks to run. scope.advance(1100); // It should now be possible to wait for the trigger, and for the idle queue // to be empty. await trigger; await idle.empty; // The task should now have run. expect(completed).toEqual(true); }); it('waits for multiple tasks to complete serially', async () => { // Schedule several tasks that will increase a counter according to its // current value. If these tasks execute in parallel, the writes to the counter // will race, and the test will fail. let counter: number = 2; idle.schedule('double counter', async () => { let local = counter; await Promise.resolve(); local *= 2; await Promise.resolve(); counter = local * 2; }); idle.schedule('triple counter', async () => { // If this expect fails, it comes out of the 'await trigger' below. expect(counter).toEqual(8); // Multiply the counter by 3 twice. let local = counter; await Promise.resolve(); local *= 3; await Promise.resolve(); counter = local * 3; }); // Trigger the idle mechanism once. const trigger = idle.trigger(); // Advance the clock beyond the idle timeout, causing the idle tasks to run, and // wait for them to complete. scope.advance(1100); await trigger; await idle.empty; // Assert that both tasks executed in the correct serial sequence by validating // that the counter reached the correct value. expect(counter).toEqual(2 * 2 * 2 * 3 * 3); }); // Validate that a single idle task does not execute until trigger() has been called // and sufficient time passes without it being called again. it('does not execute work until timeout passes with no triggers', async () => { // Set up a single idle task to set the completed flag to true when it runs. let completed: boolean = false; idle.schedule('work', async () => { completed = true; }); // Trigger the queue once. This trigger will start a timer for the idle timeout, // but another trigger() will be called before that timeout passes. const firstTrigger = idle.trigger(); // Advance the clock a little, but not enough to actually cause tasks to execute. scope.advance(500); // Assert that the task has not yet run. expect(completed).toEqual(false); // Next, trigger the queue again. const secondTrigger = idle.trigger(); // Advance the clock beyond the timeout for the first trigger, but not the second. // This should cause the first trigger to resolve, but without running the task. scope.advance(600); await firstTrigger; expect(completed).toEqual(false); // Schedule a third trigger. This is the one that will eventually resolve the task. const thirdTrigger = idle.trigger(); // Again, advance beyond the second trigger and verify it didn't resolve the task. scope.advance(500); await secondTrigger; expect(completed).toEqual(false); // Finally, advance beyond the third trigger, which should cause the task to be // executed finally. scope.advance(600); await thirdTrigger; await idle.empty; // The task should have executed. expect(completed).toEqual(true); }); it('executes tasks after max delay even with newer triggers', async () => { // Set up a single idle task to set the completed flag to true when it runs. let completed: boolean = false; idle.schedule('work', async () => { completed = true; }); // Trigger the queue once. This trigger will start a timer for the idle timeout, // but another `trigger()` will be called before that timeout passes. const firstTrigger = idle.trigger(); // Advance the clock a little, but not enough to actually cause tasks to execute. scope.advance(999); expect(completed).toBe(false); // Next, trigger the queue again. const secondTrigger = idle.trigger(); // Advance the clock beyond the timeout for the first trigger, but not the second. // This should cause the first trigger to resolve, but without running the task. scope.advance(999); await firstTrigger; expect(completed).toBe(false); // Next, trigger the queue again. const thirdTrigger = idle.trigger(); // Advance the clock beyond the timeout for the second trigger, but not the third. // This should cause the second trigger to resolve, but without running the task. scope.advance(999); await secondTrigger; expect(completed).toBe(false); // Next, trigger the queue again. const forthTrigger = idle.trigger(); // Finally, advance the clock beyond `maxDelay` (3000) from the first trigger, but not beyond // the timeout for the forth. This should cause the task to be executed nonetheless. scope.advance(3); await Promise.all([thirdTrigger, forthTrigger]); // The task should have executed. expect(completed).toBe(true); }); }); })();
{ "end_byte": 6737, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/test/idle_spec.ts" }
angular/packages/service-worker/worker/testing/mock.ts_0_8012
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {Manifest} from '../src/manifest'; import {sha1} from '../src/sha1'; import {MockResponse} from './fetch'; export type HeaderMap = { [key: string]: string; }; export class MockFile { constructor( readonly path: string, readonly contents: string, readonly headers = {}, readonly hashThisFile: boolean, ) {} get hash(): string { return sha1(this.contents); } } export class MockFileSystemBuilder { private resources = new Map<string, MockFile>(); addFile(path: string, contents: string, headers?: HeaderMap): MockFileSystemBuilder { this.resources.set(path, new MockFile(path, contents, headers, true)); return this; } addUnhashedFile(path: string, contents: string, headers?: HeaderMap): MockFileSystemBuilder { this.resources.set(path, new MockFile(path, contents, headers, false)); return this; } build(): MockFileSystem { return new MockFileSystem(this.resources); } } export class MockFileSystem { constructor(private resources: Map<string, MockFile>) {} lookup(path: string): MockFile | undefined { return this.resources.get(path); } extend(): MockFileSystemBuilder { const builder = new MockFileSystemBuilder(); Array.from(this.resources.keys()).forEach((path) => { const res = this.resources.get(path)!; if (res.hashThisFile) { builder.addFile(path, res.contents, res.headers); } else { builder.addUnhashedFile(path, res.contents, res.headers); } }); return builder; } list(): string[] { return Array.from(this.resources.keys()); } } export class MockServerStateBuilder { private rootDir = '/'; private resources = new Map<string, Response>(); private errors = new Set<string>(); withRootDirectory(newRootDir: string): MockServerStateBuilder { // Update existing resources/errors. const oldRootDir = this.rootDir; const updateRootDir = (path: string) => path.startsWith(oldRootDir) ? joinPaths(newRootDir, path.slice(oldRootDir.length)) : path; this.resources = new Map( [...this.resources].map(([path, contents]) => [updateRootDir(path), contents.clone()]), ); this.errors = new Set([...this.errors].map((url) => updateRootDir(url))); // Set `rootDir` for future resource/error additions. this.rootDir = newRootDir; return this; } withStaticFiles(dir: MockFileSystem): MockServerStateBuilder { dir.list().forEach((path) => { const file = dir.lookup(path)!; this.resources.set( joinPaths(this.rootDir, path), new MockResponse(file.contents, {headers: file.headers}), ); }); return this; } withManifest(manifest: Manifest): MockServerStateBuilder { const manifestPath = joinPaths(this.rootDir, 'ngsw.json'); this.resources.set(manifestPath, new MockResponse(JSON.stringify(manifest))); return this; } withRedirect(from: string, to: string): MockServerStateBuilder { this.resources.set(from, new MockResponse('', {redirected: true, url: to})); return this; } withError(url: string): MockServerStateBuilder { this.errors.add(url); return this; } build(): MockServerState { // Take a "snapshot" of the current `resources` and `errors`. const resources = new Map(this.resources.entries()); const errors = new Set(this.errors.values()); return new MockServerState(resources, errors); } } export class MockServerState { private requests: Request[] = []; private gate: Promise<void> = Promise.resolve(); private resolve: Function | null = null; private resolveNextRequest?: Function; online = true; nextRequest: Promise<Request>; constructor( private resources: Map<string, Response>, private errors: Set<string>, ) { this.nextRequest = new Promise((resolve) => { this.resolveNextRequest = resolve; }); } async fetch(req: Request): Promise<Response> { this.resolveNextRequest?.(req); this.nextRequest = new Promise((resolve) => { this.resolveNextRequest = resolve; }); await this.gate; if (!this.online) { throw new Error('Offline.'); } this.requests.push(req); if (req.credentials === 'include' || req.mode === 'no-cors') { return new MockResponse(null, {status: 0, statusText: '', type: 'opaque'}); } const url = req.url.split('?')[0]; if (this.resources.has(url)) { return this.resources.get(url)!.clone(); } if (this.errors.has(url)) { throw new Error('Intentional failure!'); } return new MockResponse(null, {status: 404, statusText: 'Not Found'}); } pause(): void { this.gate = new Promise((resolve) => { this.resolve = resolve; }); } unpause(): void { if (this.resolve === null) { return; } this.resolve(); this.resolve = null; } getRequestsFor(url: string): Request[] { return this.requests.filter((req) => req.url.split('?')[0] === url); } assertSawRequestFor(url: string): void { if (!this.sawRequestFor(url)) { throw new Error(`Expected request for ${url}, got none.`); } } assertNoRequestFor(url: string): void { if (this.sawRequestFor(url)) { throw new Error(`Expected no request for ${url} but saw one.`); } } sawRequestFor(url: string): boolean { const matching = this.getRequestsFor(url); if (matching.length > 0) { this.requests = this.requests.filter((req) => req !== matching[0]); return true; } return false; } assertNoOtherRequests(): void { if (!this.noOtherRequests()) { throw new Error( `Expected no other requests, got requests for ${this.requests .map((req) => req.url.split('?')[0]) .join(', ')}`, ); } } noOtherRequests(): boolean { return this.requests.length === 0; } clearRequests(): void { this.requests = []; } reset(): void { this.clearRequests(); this.nextRequest = new Promise((resolve) => { this.resolveNextRequest = resolve; }); this.gate = Promise.resolve(); this.resolve = null; this.online = true; } } export function tmpManifestSingleAssetGroup(fs: MockFileSystem): Manifest { const files = fs.list(); const hashTable: {[url: string]: string} = {}; files.forEach((path) => { hashTable[path] = fs.lookup(path)!.hash; }); return { configVersion: 1, timestamp: 1234567890123, index: '/index.html', assetGroups: [ { name: 'group', installMode: 'prefetch', updateMode: 'prefetch', urls: files, patterns: [], cacheQueryOptions: {ignoreVary: true}, }, ], navigationUrls: [], navigationRequestStrategy: 'performance', hashTable, }; } export function tmpHashTableForFs( fs: MockFileSystem, breakHashes: {[url: string]: boolean} = {}, baseHref = '/', ): {[url: string]: string} { const table: {[url: string]: string} = {}; fs.list().forEach((filePath) => { const urlPath = joinPaths(baseHref, filePath); const file = fs.lookup(filePath)!; if (file.hashThisFile) { table[urlPath] = file.hash; if (breakHashes[filePath]) { table[urlPath] = table[urlPath].split('').reverse().join(''); } } }); return table; } export function tmpHashTable(manifest: Manifest): Map<string, string> { const map = new Map<string, string>(); Object.keys(manifest.hashTable).forEach((url) => { const hash = manifest.hashTable[url]; map.set(url, hash); }); return map; } // Helpers /** * Join two path segments, ensuring that there is exactly one slash (`/`) between them. */ function joinPaths(path1: string, path2: string): string { return `${path1.replace(/\/$/, '')}/${path2.replace(/^\//, '')}`; }
{ "end_byte": 8012, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/testing/mock.ts" }
angular/packages/service-worker/worker/testing/scope.ts_0_8491
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {Adapter} from '../src/adapter'; import {AssetGroupConfig, Manifest} from '../src/manifest'; import {sha1} from '../src/sha1'; import {MockCacheStorage} from './cache'; import {MockClient, MockClients} from './clients'; import { MockActivateEvent, MockExtendableMessageEvent, MockFetchEvent, MockInstallEvent, MockNotificationEvent, MockPushEvent, } from './events'; import {MockHeaders, MockRequest, MockResponse} from './fetch'; import {MockServerState, MockServerStateBuilder} from './mock'; import {normalizeUrl, parseUrl} from './utils'; const EMPTY_SERVER_STATE = new MockServerStateBuilder().build(); export class SwTestHarnessBuilder { private origin: string; private server = EMPTY_SERVER_STATE; private caches: MockCacheStorage; constructor(private scopeUrl = 'http://localhost/') { this.origin = parseUrl(this.scopeUrl).origin; this.caches = new MockCacheStorage(this.origin); } withCacheState(cache: string): SwTestHarnessBuilder { this.caches = new MockCacheStorage(this.origin, cache); return this; } withServerState(state: MockServerState): SwTestHarnessBuilder { this.server = state; return this; } build(): SwTestHarness { return new SwTestHarnessImpl(this.server, this.caches, this.scopeUrl) as SwTestHarness; } } export type SwTestHarness = SwTestHarnessImpl & ServiceWorkerGlobalScope; export class SwTestHarnessImpl extends Adapter<MockCacheStorage> implements Partial<ServiceWorkerGlobalScope> { readonly clients = new MockClients(); private eventHandlers = new Map<string, EventListener>(); private skippedWaiting = false; private selfMessageQueue: any[] = []; autoAdvanceTime = false; unregistered: boolean = false; readonly notifications: {title: string; options: Object}[] = []; readonly registration: ServiceWorkerRegistration = { active: { postMessage: (msg: any) => { this.selfMessageQueue.push(msg); }, }, scope: this.scopeUrl, showNotification: (title: string, options: Object) => { this.notifications.push({title, options}); }, unregister: () => { this.unregistered = true; }, } as any; override get time() { return this.mockTime; } private mockTime = Date.now(); private timers: { at: number; duration: number; fn: Function; fired: boolean; }[] = []; override parseUrl = parseUrl; constructor( private server: MockServerState, caches: MockCacheStorage, scopeUrl: string, ) { super(scopeUrl, caches); } async resolveSelfMessages(): Promise<void> { while (this.selfMessageQueue.length > 0) { const queue = this.selfMessageQueue; this.selfMessageQueue = []; await queue.reduce(async (previous, msg) => { await previous; await this.handleMessage(msg, null); }, Promise.resolve()); } } async startup(firstTime: boolean = false): Promise<boolean | null> { if (!firstTime) { return null; } let skippedWaiting: boolean = false; if (this.eventHandlers.has('install')) { const installEvent = new MockInstallEvent(); this.eventHandlers.get('install')!(installEvent); await installEvent.ready; skippedWaiting = this.skippedWaiting; } if (this.eventHandlers.has('activate')) { const activateEvent = new MockActivateEvent(); this.eventHandlers.get('activate')!(activateEvent); await activateEvent.ready; } return skippedWaiting; } updateServerState(server?: MockServerState): void { this.server = server || EMPTY_SERVER_STATE; } fetch(req: RequestInfo): Promise<Response> { if (typeof req === 'string') { return this.server.fetch(new MockRequest(normalizeUrl(req, this.scopeUrl))); } else { const mockReq = req.clone() as MockRequest; mockReq.url = normalizeUrl(mockReq.url, this.scopeUrl); return this.server.fetch(mockReq); } } addEventListener( type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions, ): void { if (options !== undefined) { throw new Error('Mock `addEventListener()` does not support `options`.'); } const handler: EventListener = typeof listener === 'function' ? listener : (evt) => listener.handleEvent(evt); this.eventHandlers.set(type, handler); } removeEventListener( type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions, ): void { if (options !== undefined) { throw new Error('Mock `removeEventListener()` does not support `options`.'); } this.eventHandlers.delete(type); } override newRequest(url: string, init: Object = {}): Request { return new MockRequest(normalizeUrl(url, this.scopeUrl), init); } override newResponse(body: string, init: Object = {}): Response { return new MockResponse(body, init); } override newHeaders(headers: {[name: string]: string}): Headers { return Object.keys(headers).reduce((mock, name) => { mock.set(name, headers[name]); return mock; }, new MockHeaders()); } async skipWaiting(): Promise<void> { this.skippedWaiting = true; } handleFetch(req: Request, clientId = ''): [Promise<Response | undefined>, Promise<void>] { if (!this.eventHandlers.has('fetch')) { throw new Error('No fetch handler registered'); } const isNavigation = req.mode === 'navigate'; if (clientId && !this.clients.getMock(clientId)) { this.clients.add(clientId, isNavigation ? req.url : this.scopeUrl); } const event = isNavigation ? new MockFetchEvent(req, '', clientId) : new MockFetchEvent(req, clientId, ''); this.eventHandlers.get('fetch')!.call(this, event); return [event.response, event.ready]; } handleMessage(data: Object, clientId: string | null): Promise<void> { if (!this.eventHandlers.has('message')) { throw new Error('No message handler registered'); } if (clientId && !this.clients.getMock(clientId)) { this.clients.add(clientId, this.scopeUrl); } const event = new MockExtendableMessageEvent( data, (clientId && this.clients.getMock(clientId)) || null, ); this.eventHandlers.get('message')!.call(this, event); return event.ready; } handlePush(data: Object): Promise<void> { if (!this.eventHandlers.has('push')) { throw new Error('No push handler registered'); } const event = new MockPushEvent(data); this.eventHandlers.get('push')!.call(this, event); return event.ready; } handleClick(notification: Object, action?: string): Promise<void> { if (!this.eventHandlers.has('notificationclick')) { throw new Error('No notificationclick handler registered'); } const event = new MockNotificationEvent(notification, action); this.eventHandlers.get('notificationclick')!.call(this, event); return event.ready; } override timeout(ms: number): Promise<void> { const promise = new Promise<void>((resolve) => { this.timers.push({ at: this.mockTime + ms, duration: ms, fn: resolve, fired: false, }); }); if (this.autoAdvanceTime) { this.advance(ms); } return promise; } advance(by: number): void { this.mockTime += by; this.timers .filter((timer) => !timer.fired) .filter((timer) => timer.at <= this.mockTime) .forEach((timer) => { timer.fired = true; timer.fn(); }); } override isClient(obj: any): obj is Client { return obj instanceof MockClient; } } interface StaticFile { url: string; contents: string; hash?: string; } export class AssetGroupBuilder { constructor( private up: ConfigBuilder, readonly name: string, ) {} private files: StaticFile[] = []; addFile(url: string, contents: string, hashed: boolean = true): AssetGroupBuilder { const file: StaticFile = {url, contents, hash: undefined}; if (hashed) { file.hash = sha1(contents); } this.files.push(file); return this; } finish(): ConfigBuilder { return this.up; } toManifestGroup(): AssetGroupConfig { return null!; } }
{ "end_byte": 8491, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/testing/scope.ts" }
angular/packages/service-worker/worker/testing/scope.ts_8493_9125
export class ConfigBuilder { assetGroups = new Map<string, AssetGroupBuilder>(); addAssetGroup(name: string): ConfigBuilder { const builder = new AssetGroupBuilder(this, name); this.assetGroups.set(name, builder); return this; } finish(): Manifest { const assetGroups = Array.from(this.assetGroups.values()).map((group) => group.toManifestGroup(), ); const hashTable = {}; return { configVersion: 1, timestamp: 1234567890123, index: '/index.html', assetGroups, navigationUrls: [], navigationRequestStrategy: 'performance', hashTable, }; } }
{ "end_byte": 9125, "start_byte": 8493, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/testing/scope.ts" }
angular/packages/service-worker/worker/testing/clients.ts_0_3443
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {Subject} from 'rxjs'; export class MockClient implements Client { readonly messages: any[] = []; readonly queue = new Subject<any>(); lastFocusedAt = 0; constructor( readonly id: string, readonly url: string, readonly type: ClientTypes = 'all', readonly frameType: FrameType = 'top-level', ) {} postMessage(message: any): void { this.messages.push(message); this.queue.next(message); } } export class MockWindowClient extends MockClient implements WindowClient { readonly focused: boolean = false; readonly visibilityState: DocumentVisibilityState = 'visible'; constructor(id: string, url: string, frameType: FrameType = 'top-level') { super(id, url, 'window', frameType); } async focus(): Promise<WindowClient> { // This is only used for relatively ordering clients based on focus order, so we don't need to // use `Adapter#time`. this.lastFocusedAt = Date.now(); (this.focused as boolean) = true; return this; } async navigate(url: string): Promise<WindowClient | null> { (this.url as string) = url; return this; } } export class MockClients implements Clients { private clients = new Map<string, MockClient>(); add(clientId: string, url: string, type: ClientTypes = 'window'): void { if (this.clients.has(clientId)) { const existingClient = this.clients.get(clientId)!; if (existingClient.url === url) { return; } throw new Error( `Trying to add mock client with same ID (${existingClient.id}) and different URL ` + `(${existingClient.url} --> ${url})`, ); } const client = type === 'window' ? new MockWindowClient(clientId, url) : new MockClient(clientId, url, type); this.clients.set(clientId, client); } remove(clientId: string): void { this.clients.delete(clientId); } async get(id: string): Promise<Client> { return this.clients.get(id)!; } getMock(id: string): MockClient | undefined { return this.clients.get(id); } async matchAll<T extends ClientQueryOptions>( options?: T, ): Promise<ReadonlyArray<T['type'] extends 'window' ? WindowClient : Client>> { const type = options?.type ?? 'window'; const allClients = Array.from(this.clients.values()); const matchedClients = type === 'all' ? allClients : allClients.filter((client) => client.type === type); // Order clients according to the [spec](https://w3c.github.io/ServiceWorker/#clients-matchall): // In most recently focused then most recently created order, with windows clients before other // clients. return ( matchedClients // Sort in most recently created order. .reverse() // Sort in most recently focused order. .sort((a, b) => b.lastFocusedAt - a.lastFocusedAt) // Sort windows clients before other clients (otherwise leave existing order). .sort((a, b) => { const aScore = a.type === 'window' ? 1 : 0; const bScore = b.type === 'window' ? 1 : 0; return bScore - aScore; }) as any ); } async openWindow(url: string): Promise<WindowClient | null> { return null; } async claim(): Promise<any> {} }
{ "end_byte": 3443, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/testing/clients.ts" }
angular/packages/service-worker/worker/testing/utils.ts_0_1784
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {NormalizedUrl} from '../src/api'; /** * Determine whether the current environment provides all necessary APIs to run ServiceWorker tests. * * @return Whether ServiceWorker tests can be run in the current environment. */ export function envIsSupported(): boolean { return typeof URL === 'function'; } /** * Get a normalized representation of a URL relative to a provided base URL. * * More specifically: * 1. Resolve the URL relative to the provided base URL. * 2. If the URL is relative to the base URL, then strip the origin (and only return the path and * search parts). Otherwise, return the full URL. * * @param url The raw URL. * @param relativeTo The base URL to resolve `url` relative to. * (This is usually the ServiceWorker's origin or registration scope). * @return A normalized representation of the URL. */ export function normalizeUrl(url: string, relativeTo: string): NormalizedUrl { const {origin, path, search} = parseUrl(url, relativeTo); const {origin: relativeToOrigin} = parseUrl(relativeTo); return (origin === relativeToOrigin ? path + search : url) as NormalizedUrl; } /** * Parse a URL into its different parts, such as `origin`, `path` and `search`. */ export function parseUrl( url: string, relativeTo?: string, ): {origin: string; path: string; search: string} { const parsedUrl: URL = !relativeTo ? new URL(url) : new URL(url, relativeTo); return { origin: parsedUrl.origin || `${parsedUrl.protocol}//${parsedUrl.host}`, path: parsedUrl.pathname, search: parsedUrl.search || '', }; }
{ "end_byte": 1784, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/testing/utils.ts" }
angular/packages/service-worker/worker/testing/cache.ts_0_6477
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {MockResponse} from './fetch'; import {normalizeUrl} from './utils'; export interface DehydratedResponse { body: string | null; status: number; statusText: string; headers: {[name: string]: string}; } export type DehydratedCache = { [url: string]: DehydratedResponse; }; export type DehydratedCacheStorage = { [name: string]: DehydratedCache; }; export class MockCacheStorage implements CacheStorage { private caches = new Map<string, MockCache>(); constructor( private origin: string, hydrateFrom?: string, ) { if (hydrateFrom !== undefined) { const hydrated = JSON.parse(hydrateFrom) as DehydratedCacheStorage; Object.keys(hydrated).forEach((name) => { this.caches.set(name, new MockCache(this.origin, hydrated[name])); }); } } async has(name: string): Promise<boolean> { return this.caches.has(name); } async keys(): Promise<string[]> { return Array.from(this.caches.keys()); } async open(name: string): Promise<Cache> { if (!this.caches.has(name)) { this.caches.set(name, new MockCache(this.origin)); } return this.caches.get(name) as any; } async match(req: Request): Promise<Response | undefined> { return await Array.from(this.caches.values()).reduce<Promise<Response | undefined>>( async (answer, cache): Promise<Response | undefined> => { const curr = await answer; if (curr !== undefined) { return curr; } return cache.match(req); }, Promise.resolve<Response | undefined>(undefined), ); } async 'delete'(name: string): Promise<boolean> { if (this.caches.has(name)) { this.caches.delete(name); return true; } return false; } dehydrate(): string { const dehydrated: DehydratedCacheStorage = {}; Array.from(this.caches.keys()).forEach((name) => { const cache = this.caches.get(name)!; dehydrated[name] = cache.dehydrate(); }); return JSON.stringify(dehydrated); } } export class MockCache { private cache = new Map<string, Response>(); constructor( private origin: string, hydrated?: DehydratedCache, ) { if (hydrated !== undefined) { Object.keys(hydrated).forEach((url) => { const resp = hydrated[url]; this.cache.set( url, new MockResponse(resp.body, { status: resp.status, statusText: resp.statusText, headers: resp.headers, }), ); }); } } async add(request: RequestInfo): Promise<void> { throw 'Not implemented'; } async addAll(requests: RequestInfo[]): Promise<void> { throw 'Not implemented'; } async 'delete'(request: RequestInfo, options?: CacheQueryOptions): Promise<boolean> { let url = this.getRequestUrl(request); if (this.cache.has(url)) { this.cache.delete(url); return true; } else if (options?.ignoreSearch) { url = this.stripQueryAndHash(url); const cachedUrl = [...this.cache.keys()].find((key) => url === this.stripQueryAndHash(key)); if (cachedUrl) { this.cache.delete(cachedUrl); return true; } } return false; } async keys(match?: Request | string): Promise<string[]> { if (match !== undefined) { throw 'Not implemented'; } return Array.from(this.cache.keys()); } async match(request: RequestInfo, options?: CacheQueryOptions): Promise<Response> { let url = this.getRequestUrl(request); let res = this.cache.get(url); if (!res && options?.ignoreSearch) { // check if cache has url by ignoring search url = this.stripQueryAndHash(url); const matchingReq = [...this.cache.keys()].find((key) => url === this.stripQueryAndHash(key)); if (matchingReq !== undefined) res = this.cache.get(matchingReq); } if (res !== undefined) { res = res.clone(); } return res!; } async matchAll(request?: Request | string, options?: CacheQueryOptions): Promise<Response[]> { if (request === undefined) { return Array.from(this.cache.values()); } const res = await this.match(request, options); if (res) { return [res]; } else { return []; } } async put(request: RequestInfo, response: Response): Promise<void> { const url = this.getRequestUrl(request); this.cache.set(url, response.clone()); // Even though the body above is cloned, consume it here because the // real cache consumes the body. await response.text(); return; } dehydrate(): DehydratedCache { const dehydrated: DehydratedCache = {}; Array.from(this.cache.keys()).forEach((url) => { const resp = this.cache.get(url) as MockResponse; const dehydratedResp = { body: resp._body, status: resp.status, statusText: resp.statusText, headers: {}, } as DehydratedResponse; resp.headers.forEach((value: string, name: string) => { dehydratedResp.headers[name] = value; }); dehydrated[url] = dehydratedResp; }); return dehydrated; } /** Get the normalized URL from a `RequestInfo` value. */ private getRequestUrl(request: RequestInfo): string { const url = typeof request === 'string' ? request : request.url; return normalizeUrl(url, this.origin); } /** remove the query/hash part from a url*/ private stripQueryAndHash(url: string): string { return url.replace(/[?#].*/, ''); } } // This can be used to simulate a situation (bug?), where the user clears the caches from DevTools, // while the SW is still running (e.g. serving another tab) and keeps references to the deleted // caches. export async function clearAllCaches(caches: CacheStorage): Promise<void> { const cacheNames = await caches.keys(); const cacheInstances = await Promise.all(cacheNames.map((name) => caches.open(name))); // Delete all cache instances from `CacheStorage`. await Promise.all(cacheNames.map((name) => caches.delete(name))); // Delete all entries from each cache instance. await Promise.all( cacheInstances.map(async (cache) => { const keys = await cache.keys(); await Promise.all(keys.map((key) => cache.delete(key))); }), ); }
{ "end_byte": 6477, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/testing/cache.ts" }
angular/packages/service-worker/worker/testing/events.ts_0_3267
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ export class MockEvent implements Event { readonly AT_TARGET = 2; readonly BUBBLING_PHASE = 3; readonly CAPTURING_PHASE = 1; readonly NONE = 0; readonly bubbles = false; cancelBubble = false; readonly cancelable = false; readonly composed = false; readonly currentTarget = null; readonly defaultPrevented = false; readonly eventPhase = -1; readonly isTrusted = false; returnValue = false; readonly srcElement = null; readonly target = null; readonly timeStamp = Date.now(); constructor(readonly type: string) {} composedPath(): EventTarget[] { this.notImplemented(); } initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void { this.notImplemented(); } preventDefault(): void { this.notImplemented(); } stopImmediatePropagation(): void { this.notImplemented(); } stopPropagation(): void { this.notImplemented(); } private notImplemented(): never { throw new Error('Method not implemented in `MockEvent`.'); } } export class MockExtendableEvent extends MockEvent implements ExtendableEvent { private queue: Promise<unknown>[] = []; get ready(): Promise<void> { return (async () => { while (this.queue.length > 0) { await this.queue.shift(); } })(); } waitUntil(promise: Promise<unknown>): void { this.queue.push(promise); } } export class MockActivateEvent extends MockExtendableEvent { constructor() { super('activate'); } } export class MockFetchEvent extends MockExtendableEvent implements FetchEvent { readonly preloadResponse = Promise.resolve(); handled = Promise.resolve(undefined); response: Promise<Response | undefined> = Promise.resolve(undefined); constructor( readonly request: Request, readonly clientId: string, readonly resultingClientId: string, ) { super('fetch'); } respondWith(r: Response | Promise<Response>): void { this.response = Promise.resolve(r); } } export class MockInstallEvent extends MockExtendableEvent { constructor() { super('install'); } } export class MockExtendableMessageEvent extends MockExtendableEvent implements ExtendableMessageEvent { readonly lastEventId = ''; readonly origin = ''; readonly ports: ReadonlyArray<MessagePort> = []; constructor( readonly data: any, readonly source: Client | MessagePort | ServiceWorker | null, ) { super('message'); } } export class MockNotificationEvent extends MockExtendableEvent implements NotificationEvent { readonly notification: Notification; constructor( private _notification: Partial<Notification>, readonly action = '', ) { super('notification'); this.notification = { ...this._notification, close: () => undefined, } as Notification; } } export class MockPushEvent extends MockExtendableEvent implements PushEvent { readonly data = { json: () => this._data, text: () => JSON.stringify(this._data), } as PushMessageData; constructor(private _data: object) { super('push'); } }
{ "end_byte": 3267, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/testing/events.ts" }
angular/packages/service-worker/worker/testing/BUILD.bazel_0_327
load("//tools:defaults.bzl", "ts_library") package(default_visibility = ["//visibility:public"]) ts_library( name = "testing", testonly = True, srcs = glob(["**/*.ts"]), deps = [ "//packages:types", "//packages/core", "//packages/service-worker/worker", "@npm//rxjs", ], )
{ "end_byte": 327, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/testing/BUILD.bazel" }
angular/packages/service-worker/worker/testing/fetch.ts_0_5615
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ export class MockBody implements Body { readonly body!: ReadableStream; bodyUsed: boolean = false; constructor(public _body: string | null) {} async arrayBuffer(): Promise<ArrayBuffer> { const body = this.getBody(); const buffer = new ArrayBuffer(body.length); const view = new Uint8Array(buffer); for (let i = 0; i < body.length; i++) { view[i] = body.charCodeAt(i); } return buffer; } async blob(): Promise<Blob> { throw 'Not implemented'; } async json(): Promise<any> { return JSON.parse(this.getBody()) as any; } async text(): Promise<string> { return this.getBody(); } async formData(): Promise<FormData> { throw 'Not implemented'; } private getBody(): string { if (this.bodyUsed === true) { throw new Error('Cannot reuse body without cloning.'); } this.bodyUsed = true; // According to the spec, a `null` body results in an empty `ReadableStream` (which for our // needs is equivalent to `''`). See https://fetch.spec.whatwg.org/#concept-body-consume-body. return this._body || ''; } } export class MockHeaders implements Headers { map = new Map<string, string>(); [Symbol.iterator]() { return this.map[Symbol.iterator](); } append(name: string, value: string): void { this.map.set(name.toLowerCase(), value); } delete(name: string): void { this.map.delete(name.toLowerCase()); } entries() { return this.map.entries(); } forEach(callback: Function): void { this.map.forEach(callback as any); } get(name: string): string | null { return this.map.get(name.toLowerCase()) || null; } has(name: string): boolean { return this.map.has(name.toLowerCase()); } keys() { return this.map.keys(); } set(name: string, value: string): void { this.map.set(name.toLowerCase(), value); } values() { return this.map.values(); } getSetCookie(): string[] { return []; } } export class MockRequest extends MockBody implements Request { readonly isHistoryNavigation: boolean = false; readonly isReloadNavigation: boolean = false; readonly cache: RequestCache = 'default'; readonly credentials: RequestCredentials = 'same-origin'; readonly destination: RequestDestination = 'document'; readonly headers: Headers = new MockHeaders(); readonly integrity: string = ''; readonly keepalive: boolean = true; readonly method: string = 'GET'; readonly mode: RequestMode = 'cors'; readonly redirect: RequestRedirect = 'error'; readonly referrer: string = ''; readonly referrerPolicy: ReferrerPolicy = 'no-referrer'; readonly signal: AbortSignal = null as any; url: string; constructor(input: string | Request, init: RequestInit = {}) { super((init.body as string | null) ?? null); if (typeof input !== 'string') { throw 'Not implemented'; } this.url = input; const headers = init.headers as {[key: string]: string}; if (headers !== undefined) { if (headers instanceof MockHeaders) { this.headers = headers; } else { Object.keys(headers).forEach((header) => { this.headers.set(header, headers[header]); }); } } if (init.cache !== undefined) { this.cache = init.cache; } if (init.mode !== undefined) { this.mode = init.mode; } if (init.credentials !== undefined) { this.credentials = init.credentials; } if (init.method !== undefined) { this.method = init.method; } } clone(): Request { if (this.bodyUsed) { throw 'Body already consumed'; } return new MockRequest(this.url, { body: this._body, mode: this.mode, credentials: this.credentials, headers: this.headers, }); } } export class MockResponse extends MockBody implements Response { readonly trailer: Promise<Headers> = Promise.resolve(new MockHeaders()); readonly headers: Headers = new MockHeaders(); get ok(): boolean { return this.status >= 200 && this.status < 300; } readonly status: number; readonly statusText: string; readonly type: ResponseType = 'basic'; readonly url: string = ''; readonly redirected: boolean = false; constructor( body?: any, init: ResponseInit & {type?: ResponseType; redirected?: boolean; url?: string} = {}, ) { super(typeof body === 'string' ? body : null); this.status = init.status !== undefined ? init.status : 200; this.statusText = init.statusText !== undefined ? init.statusText : 'OK'; const headers = init.headers as {[key: string]: string}; if (headers !== undefined) { if (headers instanceof MockHeaders) { this.headers = headers; } else { Object.keys(headers).forEach((header) => { this.headers.set(header, headers[header]); }); } } if (init.type !== undefined) { this.type = init.type; } if (init.redirected !== undefined) { this.redirected = init.redirected; } if (init.url !== undefined) { this.url = init.url; } } clone(): Response { if (this.bodyUsed) { throw 'Body already consumed'; } return new MockResponse(this._body, { status: this.status, statusText: this.statusText, headers: this.headers, type: this.type, redirected: this.redirected, url: this.url, }); } }
{ "end_byte": 5615, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/testing/fetch.ts" }
angular/packages/service-worker/worker/src/data.ts_0_6128
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {Adapter} from './adapter'; import {Database, Table} from './database'; import {CacheTable} from './db-cache'; import {DebugHandler} from './debug'; import {DataGroupConfig} from './manifest'; import {NamedCache} from './named-cache-storage'; /** * A metadata record of how old a particular cached resource is. */ interface AgeRecord { age: number; } /** * A node in the LRU chain for a given `DataGroup`. * * Serializable as previous/next are identified by their URL and are not references. */ interface LruNode { /** * The URL tracked by this node. */ url: string; /** * The previous (more recent) node in the chain, or null if this is the head. */ previous: string | null; /** * The next (less recent) node in the chain, or null if this is the tail. */ next: string | null; } /** * Serializable state of an entire LRU chain. * * Essentially a doubly linked list of URLs. */ interface LruState { /** * URL of the head node, or null if the chain is empty. */ head: string | null; /** * URL of the tail node, or null if the chain is empty. */ tail: string | null; /** * Map of URLs to data for each URL (including next/prev pointers). */ map: {[url: string]: LruNode | undefined}; /** * Count of the number of nodes in the chain. */ count: number; } /** * Manages an instance of `LruState` and moves URLs to the head of the * chain when requested. */ class LruList { state: LruState; constructor(state?: LruState) { if (state === undefined) { state = { head: null, tail: null, map: {}, count: 0, }; } this.state = state; } /** * The current count of URLs in the list. */ get size(): number { return this.state.count; } /** * Remove the tail. */ pop(): string | null { // If there is no tail, return null. if (this.state.tail === null) { return null; } const url = this.state.tail; this.remove(url); // This URL has been successfully evicted. return url; } remove(url: string): boolean { const node = this.state.map[url]; if (node === undefined) { return false; } // Special case if removing the current head. if (this.state.head === url) { // The node is the current head. Special case the removal. if (node.next === null) { // This is the only node. Reset the cache to be empty. this.state.head = null; this.state.tail = null; this.state.map = {}; this.state.count = 0; return true; } // There is at least one other node. Make the next node the new head. const next = this.state.map[node.next!]!; next.previous = null; this.state.head = next.url; node.next = null; delete this.state.map[url]; this.state.count--; return true; } // The node is not the head, so it has a previous. It may or may not be the tail. // If it is not, then it has a next. First, grab the previous node. const previous = this.state.map[node.previous!]!; // Fix the forward pointer to skip over node and go directly to node.next. previous.next = node.next; // node.next may or may not be set. If it is, fix the back pointer to skip over node. // If it's not set, then this node happened to be the tail, and the tail needs to be // updated to point to the previous node (removing the tail). if (node.next !== null) { // There is a next node, fix its back pointer to skip this node. this.state.map[node.next]!.previous = node.previous!; } else { // There is no next node - the accessed node must be the tail. Move the tail pointer. this.state.tail = node.previous!; } node.next = null; node.previous = null; delete this.state.map[url]; // Count the removal. this.state.count--; return true; } accessed(url: string): void { // When a URL is accessed, its node needs to be moved to the head of the chain. // This is accomplished in two steps: // // 1) remove the node from its position within the chain. // 2) insert the node as the new head. // // Sometimes, a URL is accessed which has not been seen before. In this case, step 1 can // be skipped completely (which will grow the chain by one). Of course, if the node is // already the head, this whole operation can be skipped. if (this.state.head === url) { // The URL is already in the head position, accessing it is a no-op. return; } // Look up the node in the map, and construct a new entry if it's const node = this.state.map[url] || {url, next: null, previous: null}; // Step 1: remove the node from its position within the chain, if it is in the chain. if (this.state.map[url] !== undefined) { this.remove(url); } // Step 2: insert the node at the head of the chain. // First, check if there's an existing head node. If there is, it has previous: null. // Its previous pointer should be set to the node we're inserting. if (this.state.head !== null) { this.state.map[this.state.head]!.previous = url; } // The next pointer of the node being inserted gets set to the old head, before the head // pointer is updated to this node. node.next = this.state.head; // The new head is the new node. this.state.head = url; // If there is no tail, then this is the first node, and is both the head and the tail. if (this.state.tail === null) { this.state.tail = url; } // Set the node in the map of nodes (if the URL has been seen before, this is a no-op) // and count the insertion. this.state.map[url] = node; this.state.count++; } } /** * A group of cached resources determined by a set of URL patterns which follow a LRU policy * for caching. */
{ "end_byte": 6128, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/src/data.ts" }
angular/packages/service-worker/worker/src/data.ts_6129_13374
export class DataGroup { /** * Compiled regular expression set used to determine which resources fall under the purview * of this group. */ private readonly patterns: RegExp[]; /** * The `Cache` instance in which resources belonging to this group are cached. */ private readonly cache: Promise<NamedCache>; /** * Tracks the LRU state of resources in this cache. */ private _lru: LruList | null = null; /** * Database table used to store the state of the LRU cache. */ private readonly lruTable: Promise<Table>; /** * Database table used to store metadata for resources in the cache. */ private readonly ageTable: Promise<Table>; constructor( private scope: ServiceWorkerGlobalScope, private adapter: Adapter, private config: DataGroupConfig, private db: Database, private debugHandler: DebugHandler, cacheNamePrefix: string, ) { this.patterns = config.patterns.map((pattern) => new RegExp(pattern)); this.cache = adapter.caches.open(`${cacheNamePrefix}:${config.name}:cache`); this.lruTable = this.db.open(`${cacheNamePrefix}:${config.name}:lru`, config.cacheQueryOptions); this.ageTable = this.db.open(`${cacheNamePrefix}:${config.name}:age`, config.cacheQueryOptions); } /** * Lazily initialize/load the LRU chain. */ private async lru(): Promise<LruList> { if (this._lru === null) { const table = await this.lruTable; try { this._lru = new LruList(await table.read<LruState>('lru')); } catch { this._lru = new LruList(); } } return this._lru; } /** * Sync the LRU chain to non-volatile storage. */ async syncLru(): Promise<void> { if (this._lru === null) { return; } const table = await this.lruTable; try { return table.write('lru', this._lru!.state); } catch (err) { // Writing lru cache table failed. This could be a result of a full storage. // Continue serving clients as usual. this.debugHandler.log( err as Error, `DataGroup(${this.config.name}@${this.config.version}).syncLru()`, ); // TODO: Better detect/handle full storage; e.g. using // [navigator.storage](https://developer.mozilla.org/en-US/docs/Web/API/NavigatorStorage/storage). } } /** * Process a fetch event and return a `Response` if the resource is covered by this group, * or `null` otherwise. */ async handleFetch(req: Request, event: ExtendableEvent): Promise<Response | null> { // Do nothing if (!this.patterns.some((pattern) => pattern.test(req.url))) { return null; } // Lazily initialize the LRU cache. const lru = await this.lru(); // The URL matches this cache. First, check whether this is a mutating request or not. switch (req.method) { case 'OPTIONS': // Don't try to cache this - it's non-mutating, but is part of a mutating request. // Most likely SWs don't even see this, but this guard is here just in case. return null; case 'GET': case 'HEAD': // Handle the request with whatever strategy was selected. switch (this.config.strategy) { case 'freshness': return this.handleFetchWithFreshness(req, event, lru); case 'performance': return this.handleFetchWithPerformance(req, event, lru); default: throw new Error(`Unknown strategy: ${this.config.strategy}`); } default: // This was a mutating request. Assume the cache for this URL is no longer valid. const wasCached = lru.remove(req.url); // If there was a cached entry, remove it. if (wasCached) { await this.clearCacheForUrl(req.url); } // Sync the LRU chain to non-volatile storage. await this.syncLru(); // Finally, fall back on the network. return this.safeFetch(req); } } private async handleFetchWithPerformance( req: Request, event: ExtendableEvent, lru: LruList, ): Promise<Response | null> { // The 'performance' strategy prioritizes cached response. Prefer to avoid caching opaque // responses to avoid caching an error response. const okToCacheOpaque = this.config.cacheOpaqueResponses ?? false; let res: Response | null | undefined = null; // Check the cache first. If the resource exists there (and is not expired), the cached // version can be used. const fromCache = await this.loadFromCache(req, lru); if (fromCache !== null) { res = fromCache.res; // Check the age of the resource. if (this.config.refreshAheadMs !== undefined && fromCache.age >= this.config.refreshAheadMs) { event.waitUntil(this.safeCacheResponse(req, this.safeFetch(req), lru, okToCacheOpaque)); } } if (res !== null) { return res; } // No match from the cache. Go to the network. Note that this is not an 'await' // call, networkFetch is the actual Promise. This is due to timeout handling. const [timeoutFetch, networkFetch] = this.networkFetchWithTimeout(req); res = await timeoutFetch; // Since fetch() will always return a response, undefined indicates a timeout. if (res === undefined) { // The request timed out. Return a Gateway Timeout error. res = this.adapter.newResponse(null, {status: 504, statusText: 'Gateway Timeout'}); // Cache the network response eventually. event.waitUntil(this.safeCacheResponse(req, networkFetch, lru, okToCacheOpaque)); } else { // The request completed in time, so cache it inline with the response flow. await this.safeCacheResponse(req, res, lru, okToCacheOpaque); } return res; } private async handleFetchWithFreshness( req: Request, event: ExtendableEvent, lru: LruList, ): Promise<Response | null> { // The 'freshness' strategy prioritizes responses from the network. Therefore, it is OK to cache // an opaque response, even if it is an error response. const okToCacheOpaque = this.config.cacheOpaqueResponses ?? true; // Start with a network fetch. const [timeoutFetch, networkFetch] = this.networkFetchWithTimeout(req); let res: Response | null | undefined; // If that fetch errors, treat it as a timed out request. try { res = await timeoutFetch; } catch { res = undefined; } // If the network fetch times out or errors, fall back on the cache. if (res === undefined) { event.waitUntil(this.safeCacheResponse(req, networkFetch, lru, okToCacheOpaque)); // Ignore the age, the network response will be cached anyway due to the // behavior of freshness. const fromCache = await this.loadFromCache(req, lru); res = fromCache !== null ? fromCache.res : null; } else { await this.safeCacheResponse(req, res, lru, okToCacheOpaque); } // Either the network fetch didn't time out, or the cache yielded a usable response. // In either case, use it. if (res !== null) { return res; } // No response in the cache. No choice but to fall back on the full network fetch. return networkFetch; }
{ "end_byte": 13374, "start_byte": 6129, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/src/data.ts" }
angular/packages/service-worker/worker/src/data.ts_13378_20395
private networkFetchWithTimeout( req: Request, ): [Promise<Response | undefined>, Promise<Response>] { // If there is a timeout configured, race a timeout Promise with the network fetch. // Otherwise, just fetch from the network directly. if (this.config.timeoutMs !== undefined) { const networkFetch = this.scope.fetch(req); const safeNetworkFetch = (async () => { try { return await networkFetch; } catch { return this.adapter.newResponse(null, { status: 504, statusText: 'Gateway Timeout', }); } })(); const networkFetchUndefinedError = (async () => { try { return await networkFetch; } catch { return undefined; } })(); // Construct a Promise<undefined> for the timeout. const timeout = this.adapter.timeout(this.config.timeoutMs) as Promise<undefined>; // Race that with the network fetch. This will either be a Response, or `undefined` // in the event that the request errored or timed out. return [Promise.race([networkFetchUndefinedError, timeout]), safeNetworkFetch]; } else { const networkFetch = this.safeFetch(req); // Do a plain fetch. return [networkFetch, networkFetch]; } } private async safeCacheResponse( req: Request, resOrPromise: Promise<Response> | Response, lru: LruList, okToCacheOpaque?: boolean, ): Promise<void> { try { const res = await resOrPromise; try { await this.cacheResponse(req, res, lru, okToCacheOpaque); } catch (err) { // Saving the API response failed. This could be a result of a full storage. // Since this data is cached lazily and temporarily, continue serving clients as usual. this.debugHandler.log( err as Error, `DataGroup(${this.config.name}@${this.config.version}).safeCacheResponse(${req.url}, status: ${res.status})`, ); // TODO: Better detect/handle full storage; e.g. using // [navigator.storage](https://developer.mozilla.org/en-US/docs/Web/API/NavigatorStorage/storage). } } catch { // Request failed // TODO: Handle this error somehow? } } private async loadFromCache( req: Request, lru: LruList, ): Promise<{res: Response; age: number} | null> { // Look for a response in the cache. If one exists, return it. const cache = await this.cache; let res = await cache.match(req, this.config.cacheQueryOptions); if (res !== undefined) { // A response was found in the cache, but its age is not yet known. Look it up. try { const ageTable = await this.ageTable; const age = this.adapter.time - (await ageTable.read<AgeRecord>(req.url)).age; // If the response is young enough, use it. if (age <= this.config.maxAge) { // Successful match from the cache. Use the response, after marking it as having // been accessed. lru.accessed(req.url); return {res, age}; } // Otherwise, or if there was an error, assume the response is expired, and evict it. } catch { // Some error getting the age for the response. Assume it's expired. } lru.remove(req.url); await this.clearCacheForUrl(req.url); // TODO: avoid duplicate in event of network timeout, maybe. await this.syncLru(); } return null; } /** * Operation for caching the response from the server. This has to happen all * at once, so that the cache and LRU tracking remain in sync. If the network request * completes before the timeout, this logic will be run inline with the response flow. * If the request times out on the server, an error will be returned but the real network * request will still be running in the background, to be cached when it completes. */ private async cacheResponse( req: Request, res: Response, lru: LruList, okToCacheOpaque = false, ): Promise<void> { // Only cache successful responses. if (!(res.ok || (okToCacheOpaque && res.type === 'opaque'))) { return; } // If caching this response would make the cache exceed its maximum size, evict something // first. if (lru.size >= this.config.maxSize) { // The cache is too big, evict something. const evictedUrl = lru.pop(); if (evictedUrl !== null) { await this.clearCacheForUrl(evictedUrl); } } // TODO: evaluate for possible race conditions during flaky network periods. // Mark this resource as having been accessed recently. This ensures it won't be evicted // until enough other resources are requested that it falls off the end of the LRU chain. lru.accessed(req.url); // Store the response in the cache (cloning because the browser will consume // the body during the caching operation). await (await this.cache).put(req, res.clone()); // Store the age of the cache. const ageTable = await this.ageTable; await ageTable.write(req.url, {age: this.adapter.time}); // Sync the LRU chain to non-volatile storage. await this.syncLru(); } /** * Delete all of the saved state which this group uses to track resources. */ async cleanup(): Promise<void> { // Remove both the cache and the database entries which track LRU stats. await Promise.all([ this.cache.then((cache) => this.adapter.caches.delete(cache.name)), this.ageTable.then((table) => this.db.delete(table.name)), this.lruTable.then((table) => this.db.delete(table.name)), ]); } /** * Return a list of the names of all caches used by this group. */ async getCacheNames(): Promise<string[]> { const [cache, ageTable, lruTable] = await Promise.all([ this.cache, this.ageTable as Promise<CacheTable>, this.lruTable as Promise<CacheTable>, ]); return [cache.name, ageTable.cacheName, lruTable.cacheName]; } /** * Clear the state of the cache for a particular resource. * * This doesn't remove the resource from the LRU table, that is assumed to have * been done already. This clears the GET and HEAD versions of the request from * the cache itself, as well as the metadata stored in the age table. */ private async clearCacheForUrl(url: string): Promise<void> { const [cache, ageTable] = await Promise.all([this.cache, this.ageTable]); await Promise.all([ cache.delete(this.adapter.newRequest(url, {method: 'GET'}), this.config.cacheQueryOptions), cache.delete(this.adapter.newRequest(url, {method: 'HEAD'}), this.config.cacheQueryOptions), ageTable.delete(url), ]); } private async safeFetch(req: Request): Promise<Response> { try { return this.scope.fetch(req); } catch { return this.adapter.newResponse(null, { status: 504, statusText: 'Gateway Timeout', }); } } }
{ "end_byte": 20395, "start_byte": 13378, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/src/data.ts" }
angular/packages/service-worker/worker/src/driver.ts_0_1786
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {Adapter} from './adapter'; import { CacheState, Debuggable, DebugIdleState, DebugState, DebugVersion, NormalizedUrl, UpdateCacheStatus, UpdateSource, } from './api'; import {AppVersion} from './app-version'; import {Database, Table} from './database'; import {CacheTable} from './db-cache'; import {DebugHandler} from './debug'; import {errorToString} from './error'; import {IdleScheduler} from './idle'; import {hashManifest, Manifest, ManifestHash} from './manifest'; import {isMsgActivateUpdate, isMsgCheckForUpdates, MsgAny} from './msg'; type ClientId = string; type ManifestMap = { [hash: string]: Manifest; }; type ClientAssignments = { [id: string]: ManifestHash; }; const IDLE_DELAY = 5000; const MAX_IDLE_DELAY = 30000; const SUPPORTED_CONFIG_VERSION = 1; const NOTIFICATION_OPTION_NAMES = [ 'actions', 'badge', 'body', 'data', 'dir', 'icon', 'image', 'lang', 'renotify', 'requireInteraction', 'silent', 'tag', 'timestamp', 'title', 'vibrate', ] as (keyof Notification)[]; interface LatestEntry { latest: string; } export enum DriverReadyState { // The SW is operating in a normal mode, responding to all traffic. NORMAL, // The SW does not have a clean installation of the latest version of the app, but older // cached versions are safe to use so long as they don't try to fetch new dependencies. // This is a degraded state. EXISTING_CLIENTS_ONLY, // The SW has decided that caching is completely unreliable, and is forgoing request // handling until the next restart. SAFE_MODE, }
{ "end_byte": 1786, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/src/driver.ts" }
angular/packages/service-worker/worker/src/driver.ts_1788_9894
export class Driver implements Debuggable, UpdateSource { /** * Tracks the current readiness condition under which the SW is operating. This controls * whether the SW attempts to respond to some or all requests. */ state: DriverReadyState = DriverReadyState.NORMAL; private stateMessage: string = '(nominal)'; /** * Tracks whether the SW is in an initialized state or not. Before initialization, * it's not legal to respond to requests. */ initialized: Promise<void> | null = null; /** * Maps client IDs to the manifest hash of the application version being used to serve * them. If a client ID is not present here, it has not yet been assigned a version. * * If a ManifestHash appears here, it is also present in the `versions` map below. */ private clientVersionMap = new Map<ClientId, ManifestHash>(); /** * Maps manifest hashes to instances of `AppVersion` for those manifests. */ private versions = new Map<ManifestHash, AppVersion>(); /** * The latest version fetched from the server. * * Valid after initialization has completed. */ private latestHash: ManifestHash | null = null; private lastUpdateCheck: number | null = null; /** * Whether there is a check for updates currently scheduled due to navigation. */ private scheduledNavUpdateCheck: boolean = false; /** * Keep track of whether we have logged an invalid `only-if-cached` request. * (See `.onFetch()` for details.) */ private loggedInvalidOnlyIfCachedRequest: boolean = false; private ngswStatePath: string; /** * A scheduler which manages a queue of tasks that need to be executed when the SW is * not doing any other work (not processing any other requests). */ idle: IdleScheduler; debugger: DebugHandler; // A promise resolving to the control DB table. private controlTable: Promise<Table>; constructor( private scope: ServiceWorkerGlobalScope, private adapter: Adapter, private db: Database, ) { this.controlTable = this.db.open('control'); this.ngswStatePath = this.adapter.parseUrl('ngsw/state', this.scope.registration.scope).path; // Set up all the event handlers that the SW needs. // The install event is triggered when the service worker is first installed. this.scope.addEventListener('install', (event) => { // SW code updates are separate from application updates, so code updates are // almost as straightforward as restarting the SW. Because of this, it's always // safe to skip waiting until application tabs are closed, and activate the new // SW version immediately. event!.waitUntil(this.scope.skipWaiting()); }); // The activate event is triggered when this version of the service worker is // first activated. this.scope.addEventListener('activate', (event) => { event!.waitUntil( (async () => { // As above, it's safe to take over from existing clients immediately, since the new SW // version will continue to serve the old application. await this.scope.clients.claim(); })(), ); // Rather than wait for the first fetch event, which may not arrive until // the next time the application is loaded, the SW takes advantage of the // activation event to schedule initialization. However, if this were run // in the context of the 'activate' event, waitUntil() here would cause fetch // events to block until initialization completed. Thus, the SW does a // postMessage() to itself, to schedule a new event loop iteration with an // entirely separate event context. The SW will be kept alive by waitUntil() // within that separate context while initialization proceeds, while at the // same time the activation event is allowed to resolve and traffic starts // being served. if (this.scope.registration.active !== null) { this.scope.registration.active.postMessage({action: 'INITIALIZE'}); } }); // Handle the fetch, message, and push events. this.scope.addEventListener('fetch', (event) => this.onFetch(event!)); this.scope.addEventListener('message', (event) => this.onMessage(event!)); this.scope.addEventListener('push', (event) => this.onPush(event!)); this.scope.addEventListener('notificationclick', (event) => this.onClick(event!)); // The debugger generates debug pages in response to debugging requests. this.debugger = new DebugHandler(this, this.adapter); // The IdleScheduler will execute idle tasks after a given delay. this.idle = new IdleScheduler(this.adapter, IDLE_DELAY, MAX_IDLE_DELAY, this.debugger); } /** * The handler for fetch events. * * This is the transition point between the synchronous event handler and the * asynchronous execution that eventually resolves for respondWith() and waitUntil(). */ private onFetch(event: FetchEvent): void { const req = event.request; const scopeUrl = this.scope.registration.scope; const requestUrlObj = this.adapter.parseUrl(req.url, scopeUrl); if (req.headers.has('ngsw-bypass') || /[?&]ngsw-bypass(?:[=&]|$)/i.test(requestUrlObj.search)) { return; } // The only thing that is served unconditionally is the debug page. if (requestUrlObj.path === this.ngswStatePath) { // Allow the debugger to handle the request, but don't affect SW state in any other way. event.respondWith(this.debugger.handleFetch(req)); return; } // If the SW is in a broken state where it's not safe to handle requests at all, // returning causes the request to fall back on the network. This is preferred over // `respondWith(fetch(req))` because the latter still shows in DevTools that the // request was handled by the SW. if (this.state === DriverReadyState.SAFE_MODE) { // Even though the worker is in safe mode, idle tasks still need to happen so // things like update checks, etc. can take place. event.waitUntil(this.idle.trigger()); return; } // Although "passive mixed content" (like images) only produces a warning without a // ServiceWorker, fetching it via a ServiceWorker results in an error. Let such requests be // handled by the browser, since handling with the ServiceWorker would fail anyway. // See https://github.com/angular/angular/issues/23012#issuecomment-376430187 for more details. if (requestUrlObj.origin.startsWith('http:') && scopeUrl.startsWith('https:')) { // Still, log the incident for debugging purposes. this.debugger.log(`Ignoring passive mixed content request: Driver.fetch(${req.url})`); return; } // When opening DevTools in Chrome, a request is made for the current URL (and possibly related // resources, e.g. scripts) with `cache: 'only-if-cached'` and `mode: 'no-cors'`. These request // will eventually fail, because `only-if-cached` is only allowed to be used with // `mode: 'same-origin'`. // This is likely a bug in Chrome DevTools. Avoid handling such requests. // (See also https://github.com/angular/angular/issues/22362.) // TODO(gkalpak): Remove once no longer necessary (i.e. fixed in Chrome DevTools). if (req.cache === 'only-if-cached' && req.mode !== 'same-origin') { // Log the incident only the first time it happens, to avoid spamming the logs. if (!this.loggedInvalidOnlyIfCachedRequest) { this.loggedInvalidOnlyIfCachedRequest = true; this.debugger.log( `Ignoring invalid request: 'only-if-cached' can be set only with 'same-origin' mode`, `Driver.fetch(${req.url}, cache: ${req.cache}, mode: ${req.mode})`, ); } return; } // Past this point, the SW commits to handling the request itself. This could still // fail (and result in `state` being set to `SAFE_MODE`), but even in that case the // SW will still deliver a response. event.respondWith(this.handleFetch(event)); } /** * The handler for message events. */
{ "end_byte": 9894, "start_byte": 1788, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/src/driver.ts" }
angular/packages/service-worker/worker/src/driver.ts_9897_17068
private onMessage(event: ExtendableMessageEvent): void { // Ignore message events when the SW is in safe mode, for now. if (this.state === DriverReadyState.SAFE_MODE) { return; } // If the message doesn't have the expected signature, ignore it. const data = event.data; if (!data || !data.action) { return; } event.waitUntil( (async () => { // Initialization is the only event which is sent directly from the SW to itself, and thus // `event.source` is not a `Client`. Handle it here, before the check for `Client` sources. if (data.action === 'INITIALIZE') { return this.ensureInitialized(event); } // Only messages from true clients are accepted past this point. // This is essentially a typecast. if (!this.adapter.isClient(event.source)) { return; } // Handle the message and keep the SW alive until it's handled. await this.ensureInitialized(event); await this.handleMessage(data, event.source); })(), ); } private onPush(msg: PushEvent): void { // Push notifications without data have no effect. if (!msg.data) { return; } // Handle the push and keep the SW alive until it's handled. msg.waitUntil(this.handlePush(msg.data.json())); } private onClick(event: NotificationEvent): void { // Handle the click event and keep the SW alive until it's handled. event.waitUntil(this.handleClick(event.notification, event.action)); } private async ensureInitialized(event: ExtendableEvent): Promise<void> { // Since the SW may have just been started, it may or may not have been initialized already. // `this.initialized` will be `null` if initialization has not yet been attempted, or will be a // `Promise` which will resolve (successfully or unsuccessfully) if it has. if (this.initialized !== null) { return this.initialized; } // Initialization has not yet been attempted, so attempt it. This should only ever happen once // per SW instantiation. try { this.initialized = this.initialize(); await this.initialized; } catch (error) { // If initialization fails, the SW needs to enter a safe state, where it declines to respond // to network requests. this.state = DriverReadyState.SAFE_MODE; this.stateMessage = `Initialization failed due to error: ${errorToString(error)}`; throw error; } finally { // Regardless if initialization succeeded, background tasks still need to happen. event.waitUntil(this.idle.trigger()); } } private async handleMessage(msg: MsgAny & {action: string}, from: Client): Promise<void> { if (isMsgCheckForUpdates(msg)) { const action = this.checkForUpdate(); await this.completeOperation(from, action, msg.nonce); } else if (isMsgActivateUpdate(msg)) { const action = this.updateClient(from); await this.completeOperation(from, action, msg.nonce); } } private async handlePush(data: any): Promise<void> { await this.broadcast({ type: 'PUSH', data, }); if (!data.notification || !data.notification.title) { return; } const desc = data.notification as {[key: string]: string | undefined}; let options: {[key: string]: string | undefined} = {}; NOTIFICATION_OPTION_NAMES.filter((name) => desc.hasOwnProperty(name)).forEach( (name) => (options[name] = desc[name]), ); await this.scope.registration.showNotification(desc['title']!, options); } private async handleClick(notification: Notification, action?: string): Promise<void> { notification.close(); const options: {-readonly [K in keyof Notification]?: Notification[K]} = {}; // The filter uses `name in notification` because the properties are on the prototype so // hasOwnProperty does not work here NOTIFICATION_OPTION_NAMES.filter((name) => name in notification).forEach( (name) => (options[name] = notification[name]), ); const notificationAction = action === '' || action === undefined ? 'default' : action; const onActionClick = notification?.data?.onActionClick?.[notificationAction]; const urlToOpen = new URL(onActionClick?.url ?? '', this.scope.registration.scope).href; switch (onActionClick?.operation) { case 'openWindow': await this.scope.clients.openWindow(urlToOpen); break; case 'focusLastFocusedOrOpen': { let matchingClient = await this.getLastFocusedMatchingClient(this.scope); if (matchingClient) { await matchingClient?.focus(); } else { await this.scope.clients.openWindow(urlToOpen); } break; } case 'navigateLastFocusedOrOpen': { let matchingClient = await this.getLastFocusedMatchingClient(this.scope); if (matchingClient) { matchingClient = await matchingClient.navigate(urlToOpen); await matchingClient?.focus(); } else { await this.scope.clients.openWindow(urlToOpen); } break; } case 'sendRequest': { await this.scope.fetch(urlToOpen); break; } default: break; } await this.broadcast({ type: 'NOTIFICATION_CLICK', data: {action, notification: options}, }); } private async getLastFocusedMatchingClient( scope: ServiceWorkerGlobalScope, ): Promise<WindowClient | null> { const windowClients = await scope.clients.matchAll({type: 'window'}); // As per the spec windowClients are `sorted in the most recently focused order` return windowClients[0]; } private async completeOperation( client: Client, promise: Promise<boolean>, nonce: number, ): Promise<void> { const response = {type: 'OPERATION_COMPLETED', nonce}; try { client.postMessage({ ...response, result: await promise, }); } catch (e) { client.postMessage({ ...response, error: (e as Error).toString(), }); } } async updateClient(client: Client): Promise<boolean> { // Figure out which version the client is on. If it's not on the latest, // it needs to be moved. const existing = this.clientVersionMap.get(client.id); if (existing === this.latestHash) { // Nothing to do, this client is already on the latest version. return false; } // Switch the client over. let previous: Object | undefined = undefined; // Look up the application data associated with the existing version. If there // isn't any, fall back on using the hash. if (existing !== undefined) { const existingVersion = this.versions.get(existing)!; previous = this.mergeHashWithAppData(existingVersion.manifest, existing); } // Set the current version used by the client, and sync the mapping to disk. this.clientVersionMap.set(client.id, this.latestHash!); await this.sync(); // Notify the client about this activation. const current = this.versions.get(this.latestHash!)!; return true; }
{ "end_byte": 17068, "start_byte": 9897, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/src/driver.ts" }
angular/packages/service-worker/worker/src/driver.ts_17072_26054
private async handleFetch(event: FetchEvent): Promise<Response> { try { // Ensure the SW instance has been initialized. await this.ensureInitialized(event); } catch { // Since the SW is already committed to responding to the currently active request, // respond with a network fetch. return this.safeFetch(event.request); } // On navigation requests, check for new updates. if (event.request.mode === 'navigate' && !this.scheduledNavUpdateCheck) { this.scheduledNavUpdateCheck = true; this.idle.schedule('check-updates-on-navigation', async () => { this.scheduledNavUpdateCheck = false; await this.checkForUpdate(); }); } // Decide which version of the app to use to serve this request. This is asynchronous as in // some cases, a record will need to be written to disk about the assignment that is made. const appVersion = await this.assignVersion(event); // If there's a configured max age, check whether this version is within that age. const isVersionWithinMaxAge = appVersion?.manifest.applicationMaxAge === undefined || this.adapter.time - appVersion.manifest.timestamp < appVersion.manifest.applicationMaxAge; let res: Response | null = null; try { if (appVersion !== null && isVersionWithinMaxAge) { try { // Handle the request. First try the AppVersion. If that doesn't work, fall back on the // network. res = await appVersion.handleFetch(event.request, event); } catch (err: any) { if (err.isUnrecoverableState) { await this.notifyClientsAboutUnrecoverableState(appVersion, err.message); } if (err.isCritical) { // Something went wrong with handling the request from this version. this.debugger.log(err, `Driver.handleFetch(version: ${appVersion.manifestHash})`); await this.versionFailed(appVersion, err); return this.safeFetch(event.request); } throw err; } } // The response will be `null` only if no `AppVersion` can be assigned to the request or if // the assigned `AppVersion`'s manifest doesn't specify what to do about the request. // In that case, just fall back on the network. if (res === null) { return this.safeFetch(event.request); } // The `AppVersion` returned a usable response, so return it. return res; } finally { // Trigger the idle scheduling system. The Promise returned by `trigger()` will resolve after // a specific amount of time has passed. If `trigger()` hasn't been called again by then (e.g. // on a subsequent request), the idle task queue will be drained and the `Promise` won't // be resolved until that operation is complete as well. event.waitUntil(this.idle.trigger()); } } /** * Attempt to quickly reach a state where it's safe to serve responses. */ private async initialize(): Promise<void> { // On initialization, all of the serialized state is read out of the 'control' // table. This includes: // - map of hashes to manifests of currently loaded application versions // - map of client IDs to their pinned versions // - record of the most recently fetched manifest hash // // If these values don't exist in the DB, then this is the either the first time // the SW has run or the DB state has been wiped or is inconsistent. In that case, // load a fresh copy of the manifest and reset the state from scratch. const table = await this.controlTable; // Attempt to load the needed state from the DB. If this fails, the catch {} block // will populate these variables with freshly constructed values. let manifests: ManifestMap, assignments: ClientAssignments, latest: LatestEntry; try { // Read them from the DB simultaneously. [manifests, assignments, latest] = await Promise.all([ table.read<ManifestMap>('manifests'), table.read<ClientAssignments>('assignments'), table.read<LatestEntry>('latest'), ]); // Make sure latest manifest is correctly installed. If not (e.g. corrupted data), // it could stay locked in EXISTING_CLIENTS_ONLY or SAFE_MODE state. if (!this.versions.has(latest.latest) && !manifests.hasOwnProperty(latest.latest)) { this.debugger.log( `Missing manifest for latest version hash ${latest.latest}`, 'initialize: read from DB', ); throw new Error(`Missing manifest for latest hash ${latest.latest}`); } // Successfully loaded from saved state. This implies a manifest exists, so // the update check needs to happen in the background. this.idle.schedule('init post-load (update)', async () => { await this.checkForUpdate(); }); } catch (_) { // Something went wrong. Try to start over by fetching a new manifest from the // server and building up an empty initial state. const manifest = await this.fetchLatestManifest(); const hash = hashManifest(manifest); manifests = {[hash]: manifest}; assignments = {}; latest = {latest: hash}; // Save the initial state to the DB. await Promise.all([ table.write('manifests', manifests), table.write('assignments', assignments), table.write('latest', latest), ]); } // At this point, either the state has been loaded successfully, or fresh state // with a new copy of the manifest has been produced. At this point, the `Driver` // can have its internals hydrated from the state. // Schedule cleaning up obsolete caches in the background. this.idle.schedule('init post-load (cleanup)', async () => { await this.cleanupCaches(); }); // Initialize the `versions` map by setting each hash to a new `AppVersion` instance // for that manifest. Object.keys(manifests).forEach((hash: ManifestHash) => { const manifest = manifests[hash]; // If the manifest is newly initialized, an AppVersion may have already been // created for it. if (!this.versions.has(hash)) { this.versions.set( hash, new AppVersion( this.scope, this.adapter, this.db, this.idle, this.debugger, manifest, hash, ), ); } }); // Map each client ID to its associated hash. Along the way, verify that the hash // is still valid for that client ID. It should not be possible for a client to // still be associated with a hash that was since removed from the state. Object.keys(assignments).forEach((clientId: ClientId) => { const hash = assignments[clientId]; if (this.versions.has(hash)) { this.clientVersionMap.set(clientId, hash); } else { this.clientVersionMap.set(clientId, latest.latest); this.debugger.log( `Unknown version ${hash} mapped for client ${clientId}, using latest instead`, `initialize: map assignments`, ); } }); // Set the latest version. this.latestHash = latest.latest; // Finally, assert that the latest version is in fact loaded. if (!this.versions.has(latest.latest)) { throw new Error( `Invariant violated (initialize): latest hash ${latest.latest} has no known manifest`, ); } // Finally, wait for the scheduling of initialization of all versions in the // manifest. Ordinarily this just schedules the initializations to happen during // the next idle period, but in development mode this might actually wait for the // full initialization. // If any of these initializations fail, versionFailed() will be called either // synchronously or asynchronously to handle the failure and re-map clients. await Promise.all( Object.keys(manifests).map(async (hash: ManifestHash) => { try { // Attempt to schedule or initialize this version. If this operation is // successful, then initialization either succeeded or was scheduled. If // it fails, then full initialization was attempted and failed. await this.scheduleInitialization(this.versions.get(hash)!); } catch (err) { this.debugger.log(err as Error, `initialize: schedule init of ${hash}`); } }), ); } private lookupVersionByHash( hash: ManifestHash, debugName: string = 'lookupVersionByHash', ): AppVersion { // The version should exist, but check just in case. if (!this.versions.has(hash)) { throw new Error( `Invariant violated (${debugName}): want AppVersion for ${hash} but not loaded`, ); } return this.versions.get(hash)!; } /** * Decide which version of the manifest to use for the event. */
{ "end_byte": 26054, "start_byte": 17072, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/src/driver.ts" }
angular/packages/service-worker/worker/src/driver.ts_26057_34264
private async assignVersion(event: FetchEvent): Promise<AppVersion | null> { // First, check whether the event has a (non empty) client ID. If it does, the version may // already be associated. // // NOTE: For navigation requests, we care about the `resultingClientId`. If it is undefined or // the empty string (which is the case for sub-resource requests), we look at `clientId`. const clientId = event.resultingClientId || event.clientId; if (clientId) { // Check if there is an assigned client id. if (this.clientVersionMap.has(clientId)) { // There is an assignment for this client already. const hash = this.clientVersionMap.get(clientId)!; let appVersion = this.lookupVersionByHash(hash, 'assignVersion'); // Ordinarily, this client would be served from its assigned version. But, if this // request is a navigation request, this client can be updated to the latest // version immediately. if ( this.state === DriverReadyState.NORMAL && hash !== this.latestHash && appVersion.isNavigationRequest(event.request) ) { // Update this client to the latest version immediately. if (this.latestHash === null) { throw new Error(`Invariant violated (assignVersion): latestHash was null`); } const client = await this.scope.clients.get(clientId); if (client) { await this.updateClient(client); } appVersion = this.lookupVersionByHash(this.latestHash, 'assignVersion'); } // TODO: make sure the version is valid. return appVersion; } else { // This is the first time this client ID has been seen. Whether the SW is in a // state to handle new clients depends on the current readiness state, so check // that first. if (this.state !== DriverReadyState.NORMAL) { // It's not safe to serve new clients in the current state. It's possible that // this is an existing client which has not been mapped yet (see below) but // even if that is the case, it's invalid to make an assignment to a known // invalid version, even if that assignment was previously implicit. Return // undefined here to let the caller know that no assignment is possible at // this time. return null; } // It's safe to handle this request. Two cases apply. Either: // 1) the browser assigned a client ID at the time of the navigation request, and // this is truly the first time seeing this client, or // 2) a navigation request came previously from the same client, but with no client // ID attached. Browsers do this to avoid creating a client under the origin in // the event the navigation request is just redirected. // // In case 1, the latest version can safely be used. // In case 2, the latest version can be used, with the assumption that the previous // navigation request was answered under the same version. This assumption relies // on the fact that it's unlikely an update will come in between the navigation // request and requests for subsequent resources on that page. // First validate the current state. if (this.latestHash === null) { throw new Error(`Invariant violated (assignVersion): latestHash was null`); } // Pin this client ID to the current latest version, indefinitely. this.clientVersionMap.set(clientId, this.latestHash); await this.sync(); // Return the latest `AppVersion`. return this.lookupVersionByHash(this.latestHash, 'assignVersion'); } } else { // No client ID was associated with the request. This must be a navigation request // for a new client. First check that the SW is accepting new clients. if (this.state !== DriverReadyState.NORMAL) { return null; } // Serve it with the latest version, and assume that the client will actually get // associated with that version on the next request. // First validate the current state. if (this.latestHash === null) { throw new Error(`Invariant violated (assignVersion): latestHash was null`); } // Return the latest `AppVersion`. return this.lookupVersionByHash(this.latestHash, 'assignVersion'); } } /** * Retrieve a copy of the latest manifest from the server. * Return `null` if `ignoreOfflineError` is true (default: false) and the server or client are * offline (detected as response status 503 (service unavailable) or 504 (gateway timeout)). */ private async fetchLatestManifest(ignoreOfflineError?: false): Promise<Manifest>; private async fetchLatestManifest(ignoreOfflineError: true): Promise<Manifest | null>; private async fetchLatestManifest(ignoreOfflineError = false): Promise<Manifest | null> { const res = await this.safeFetch( this.adapter.newRequest('ngsw.json?ngsw-cache-bust=' + Math.random()), ); if (!res.ok) { if (res.status === 404) { await this.deleteAllCaches(); await this.scope.registration.unregister(); } else if ((res.status === 503 || res.status === 504) && ignoreOfflineError) { return null; } throw new Error(`Manifest fetch failed! (status: ${res.status})`); } this.lastUpdateCheck = this.adapter.time; return res.json(); } private async deleteAllCaches(): Promise<void> { const cacheNames = await this.adapter.caches.keys(); await Promise.all(cacheNames.map((name) => this.adapter.caches.delete(name))); } /** * Schedule the SW's attempt to reach a fully prefetched state for the given AppVersion * when the SW is not busy and has connectivity. This returns a Promise which must be * awaited, as under some conditions the AppVersion might be initialized immediately. */ private async scheduleInitialization(appVersion: AppVersion): Promise<void> { const initialize = async () => { try { await appVersion.initializeFully(); } catch (err: any) { this.debugger.log(err, `initializeFully for ${appVersion.manifestHash}`); await this.versionFailed(appVersion, err); } }; // TODO: better logic for detecting localhost. if (this.scope.registration.scope.indexOf('://localhost') > -1) { return initialize(); } this.idle.schedule(`initialization(${appVersion.manifestHash})`, initialize); } private async versionFailed(appVersion: AppVersion, err: Error): Promise<void> { // This particular AppVersion is broken. First, find the manifest hash. const broken = Array.from(this.versions.entries()).find( ([hash, version]) => version === appVersion, ); if (broken === undefined) { // This version is no longer in use anyway, so nobody cares. return; } const brokenHash = broken[0]; // The specified version is broken and new clients should not be served from it. However, it is // deemed even riskier to switch the existing clients to a different version or to the network. // Therefore, we keep clients on their current version (even if broken) and ensure that no new // clients will be assigned to it. // TODO: notify affected apps. // The action taken depends on whether the broken manifest is the active (latest) or not. // - If the broken version is not the latest, no further action is necessary, since new clients // will be assigned to the latest version anyway. // - If the broken version is the latest, the SW cannot accept new clients (but can continue to // service old ones). if (this.latestHash === brokenHash) { // The latest manifest is broken. This means that new clients are at the mercy of the network, // but caches continue to be valid for previous versions. This is unfortunate but unavoidable. this.state = DriverReadyState.EXISTING_CLIENTS_ONLY; this.stateMessage = `Degraded due to: ${errorToString(err)}`; } }
{ "end_byte": 34264, "start_byte": 26057, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/src/driver.ts" }
angular/packages/service-worker/worker/src/driver.ts_34268_43100
private async setupUpdate(manifest: Manifest, hash: string): Promise<void> { try { const newVersion = new AppVersion( this.scope, this.adapter, this.db, this.idle, this.debugger, manifest, hash, ); // Firstly, check if the manifest version is correct. if (manifest.configVersion !== SUPPORTED_CONFIG_VERSION) { await this.deleteAllCaches(); await this.scope.registration.unregister(); throw new Error( `Invalid config version: expected ${SUPPORTED_CONFIG_VERSION}, got ${manifest.configVersion}.`, ); } // Cause the new version to become fully initialized. If this fails, then the // version will not be available for use. await newVersion.initializeFully(this); // Install this as an active version of the app. this.versions.set(hash, newVersion); // Future new clients will use this hash as the latest version. this.latestHash = hash; // If we are in `EXISTING_CLIENTS_ONLY` mode (meaning we didn't have a clean copy of the last // latest version), we can now recover to `NORMAL` mode and start accepting new clients. if (this.state === DriverReadyState.EXISTING_CLIENTS_ONLY) { this.state = DriverReadyState.NORMAL; this.stateMessage = '(nominal)'; } await this.sync(); await this.notifyClientsAboutVersionReady(manifest, hash); } catch (e) { await this.notifyClientsAboutVersionInstallationFailed(manifest, hash, e); throw e; } } async checkForUpdate(): Promise<boolean> { let hash: string = '(unknown)'; try { const manifest = await this.fetchLatestManifest(true); if (manifest === null) { // Client or server offline. Unable to check for updates at this time. // Continue to service clients (existing and new). this.debugger.log('Check for update aborted. (Client or server offline.)'); return false; } hash = hashManifest(manifest); // Check whether this is really an update. if (this.versions.has(hash)) { await this.notifyClientsAboutNoNewVersionDetected(manifest, hash); return false; } await this.notifyClientsAboutVersionDetected(manifest, hash); await this.setupUpdate(manifest, hash); return true; } catch (err) { this.debugger.log(err as Error, `Error occurred while updating to manifest ${hash}`); this.state = DriverReadyState.EXISTING_CLIENTS_ONLY; this.stateMessage = `Degraded due to failed initialization: ${errorToString(err)}`; return false; } } /** * Synchronize the existing state to the underlying database. */ private async sync(): Promise<void> { const table = await this.controlTable; // Construct a serializable map of hashes to manifests. const manifests: ManifestMap = {}; this.versions.forEach((version, hash) => { manifests[hash] = version.manifest; }); // Construct a serializable map of client ids to version hashes. const assignments: ClientAssignments = {}; this.clientVersionMap.forEach((hash, clientId) => { assignments[clientId] = hash; }); // Record the latest entry. Since this is a sync which is necessarily happening after // initialization, latestHash should always be valid. const latest: LatestEntry = { latest: this.latestHash!, }; // Synchronize all of these. await Promise.all([ table.write('manifests', manifests), table.write('assignments', assignments), table.write('latest', latest), ]); } async cleanupCaches(): Promise<void> { try { // Query for all currently active clients, and list the client IDs. This may skip some clients // in the browser back-forward cache, but not much can be done about that. const activeClients = new Set<ClientId>( (await this.scope.clients.matchAll()).map((client) => client.id), ); // A simple list of client IDs that the SW has kept track of. Subtracting `activeClients` from // this list will result in the set of client IDs which are being tracked but are no longer // used in the browser, and thus can be cleaned up. const knownClients: ClientId[] = Array.from(this.clientVersionMap.keys()); // Remove clients in the `clientVersionMap` that are no longer active. const obsoleteClients = knownClients.filter((id) => !activeClients.has(id)); obsoleteClients.forEach((id) => this.clientVersionMap.delete(id)); // Next, determine the set of versions which are still used. All others can be removed. const usedVersions = new Set(this.clientVersionMap.values()); // Collect all obsolete versions by filtering out used versions from the set of all versions. const obsoleteVersions = Array.from(this.versions.keys()).filter( (version) => !usedVersions.has(version) && version !== this.latestHash, ); // Remove all the versions which are no longer used. obsoleteVersions.forEach((version) => this.versions.delete(version)); // Commit all the changes to the saved state. await this.sync(); // Delete all caches that are no longer needed. const allCaches = await this.adapter.caches.keys(); const usedCaches = new Set(await this.getCacheNames()); const cachesToDelete = allCaches.filter((name) => !usedCaches.has(name)); await Promise.all(cachesToDelete.map((name) => this.adapter.caches.delete(name))); } catch (err) { // Oh well? Not much that can be done here. These caches will be removed on the next attempt // or when the SW revs its format version, which happens from time to time. this.debugger.log(err as Error, 'cleanupCaches'); } } /** * Determine if a specific version of the given resource is cached anywhere within the SW, * and fetch it if so. */ lookupResourceWithHash(url: NormalizedUrl, hash: string): Promise<Response | null> { return ( Array // Scan through the set of all cached versions, valid or otherwise. It's safe to do such // lookups even for invalid versions as the cached version of a resource will have the // same hash regardless. .from(this.versions.values()) // Reduce the set of versions to a single potential result. At any point along the // reduction, if a response has already been identified, then pass it through, as no // future operation could change the response. If no response has been found yet, keep // checking versions until one is or until all versions have been exhausted. .reduce(async (prev, version) => { // First, check the previous result. If a non-null result has been found already, just // return it. if ((await prev) !== null) { return prev; } // No result has been found yet. Try the next `AppVersion`. return version.lookupResourceWithHash(url, hash); }, Promise.resolve<Response | null>(null)) ); } async lookupResourceWithoutHash(url: NormalizedUrl): Promise<CacheState | null> { await this.initialized; const version = this.versions.get(this.latestHash!); return version ? version.lookupResourceWithoutHash(url) : null; } async previouslyCachedResources(): Promise<NormalizedUrl[]> { await this.initialized; const version = this.versions.get(this.latestHash!); return version ? version.previouslyCachedResources() : []; } async recentCacheStatus(url: string): Promise<UpdateCacheStatus> { const version = this.versions.get(this.latestHash!); return version ? version.recentCacheStatus(url) : UpdateCacheStatus.NOT_CACHED; } private mergeHashWithAppData(manifest: Manifest, hash: string): {hash: string; appData: Object} { return { hash, appData: manifest.appData as Object, }; } async notifyClientsAboutUnrecoverableState( appVersion: AppVersion, reason: string, ): Promise<void> { const broken = Array.from(this.versions.entries()).find( ([hash, version]) => version === appVersion, ); if (broken === undefined) { // This version is no longer in use anyway, so nobody cares. return; } const brokenHash = broken[0]; const affectedClients = Array.from(this.clientVersionMap.entries()) .filter(([clientId, hash]) => hash === brokenHash) .map(([clientId]) => clientId); await Promise.all( affectedClients.map(async (clientId) => { const client = await this.scope.clients.get(clientId); if (client) { client.postMessage({type: 'UNRECOVERABLE_STATE', reason}); } }), ); }
{ "end_byte": 43100, "start_byte": 34268, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/src/driver.ts" }
angular/packages/service-worker/worker/src/driver.ts_43104_47506
async notifyClientsAboutVersionInstallationFailed( manifest: Manifest, hash: string, error: any, ): Promise<void> { await this.initialized; const clients = await this.scope.clients.matchAll(); await Promise.all( clients.map(async (client) => { // Send a notice. client.postMessage({ type: 'VERSION_INSTALLATION_FAILED', version: this.mergeHashWithAppData(manifest, hash), error: errorToString(error), }); }), ); } async notifyClientsAboutNoNewVersionDetected(manifest: Manifest, hash: string): Promise<void> { await this.initialized; const clients = await this.scope.clients.matchAll(); await Promise.all( clients.map(async (client) => { // Send a notice. client.postMessage({ type: 'NO_NEW_VERSION_DETECTED', version: this.mergeHashWithAppData(manifest, hash), }); }), ); } async notifyClientsAboutVersionDetected(manifest: Manifest, hash: string): Promise<void> { await this.initialized; const clients = await this.scope.clients.matchAll(); await Promise.all( clients.map(async (client) => { // Firstly, determine which version this client is on. const version = this.clientVersionMap.get(client.id); if (version === undefined) { // Unmapped client - assume it's the latest. return; } // Send a notice. client.postMessage({ type: 'VERSION_DETECTED', version: this.mergeHashWithAppData(manifest, hash), }); }), ); } async notifyClientsAboutVersionReady(manifest: Manifest, hash: string): Promise<void> { await this.initialized; const clients = await this.scope.clients.matchAll(); await Promise.all( clients.map(async (client) => { // Firstly, determine which version this client is on. const version = this.clientVersionMap.get(client.id); if (version === undefined) { // Unmapped client - assume it's the latest. return; } if (version === this.latestHash) { // Client is already on the latest version, no need for a notification. return; } const current = this.versions.get(version)!; // Send a notice. const notice = { type: 'VERSION_READY', currentVersion: this.mergeHashWithAppData(current.manifest, version), latestVersion: this.mergeHashWithAppData(manifest, hash), }; client.postMessage(notice); }), ); } async broadcast(msg: Object): Promise<void> { const clients = await this.scope.clients.matchAll(); clients.forEach((client) => { client.postMessage(msg); }); } async debugState(): Promise<DebugState> { return { state: DriverReadyState[this.state], why: this.stateMessage, latestHash: this.latestHash, lastUpdateCheck: this.lastUpdateCheck, }; } async debugVersions(): Promise<DebugVersion[]> { // Build list of versions. return Array.from(this.versions.keys()).map((hash) => { const version = this.versions.get(hash)!; const clients = Array.from(this.clientVersionMap.entries()) .filter(([clientId, version]) => version === hash) .map(([clientId, version]) => clientId); return { hash, manifest: version.manifest, clients, status: '', }; }); } async debugIdleState(): Promise<DebugIdleState> { return { queue: this.idle.taskDescriptions, lastTrigger: this.idle.lastTrigger, lastRun: this.idle.lastRun, }; } async safeFetch(req: Request): Promise<Response> { try { return await this.scope.fetch(req); } catch (err) { this.debugger.log(err as Error, `Driver.fetch(${req.url})`); return this.adapter.newResponse(null, { status: 504, statusText: 'Gateway Timeout', }); } } private async getCacheNames(): Promise<string[]> { const controlTable = (await this.controlTable) as CacheTable; const appVersions = Array.from(this.versions.values()); const appVersionCacheNames = await Promise.all( appVersions.map((version) => version.getCacheNames()), ); return [controlTable.cacheName].concat(...appVersionCacheNames); } }
{ "end_byte": 47506, "start_byte": 43104, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/src/driver.ts" }
angular/packages/service-worker/worker/src/msg.ts_0_874
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ export interface MsgAny { action: string; } export interface MsgCheckForUpdates { action: 'CHECK_FOR_UPDATES'; nonce: number; } export function isMsgCheckForUpdates(msg: MsgAny): msg is MsgCheckForUpdates { return msg.action === 'CHECK_FOR_UPDATES'; } export interface MsgActivateUpdate { action: 'ACTIVATE_UPDATE'; nonce: number; } export function isMsgActivateUpdate(msg: MsgAny): msg is MsgActivateUpdate { return msg.action === 'ACTIVATE_UPDATE'; } export interface MsgCheckVersion { action: 'CHECK_VERSION'; nonce: number; } export function isMsgCheckVersion(msg: MsgAny): msg is MsgCheckVersion { return msg.action === 'CHECK_VERSION'; }
{ "end_byte": 874, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/src/msg.ts" }
angular/packages/service-worker/worker/src/db-cache.ts_0_2733
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {Adapter} from './adapter'; import {Database, NotFound, Table} from './database'; import {NamedCache} from './named-cache-storage'; /** * An implementation of a `Database` that uses the `CacheStorage` API to serialize * state within mock `Response` objects. */ export class CacheDatabase implements Database { private cacheNamePrefix = 'db'; private tables = new Map<string, CacheTable>(); constructor(private adapter: Adapter) {} 'delete'(name: string): Promise<boolean> { if (this.tables.has(name)) { this.tables.delete(name); } return this.adapter.caches.delete(`${this.cacheNamePrefix}:${name}`); } async list(): Promise<string[]> { const prefix = `${this.cacheNamePrefix}:`; const allCacheNames = await this.adapter.caches.keys(); const dbCacheNames = allCacheNames.filter((name) => name.startsWith(prefix)); // Return the un-prefixed table names, so they can be used with other `CacheDatabase` methods // (for example, for opening/deleting a table). return dbCacheNames.map((name) => name.slice(prefix.length)); } async open(name: string, cacheQueryOptions?: CacheQueryOptions): Promise<Table> { if (!this.tables.has(name)) { const cache = await this.adapter.caches.open(`${this.cacheNamePrefix}:${name}`); const table = new CacheTable(name, cache, this.adapter, cacheQueryOptions); this.tables.set(name, table); } return this.tables.get(name)!; } } /** * A `Table` backed by a `Cache`. */ export class CacheTable implements Table { cacheName: string; constructor( readonly name: string, private cache: NamedCache, private adapter: Adapter, private cacheQueryOptions?: CacheQueryOptions, ) { this.cacheName = this.cache.name; } private request(key: string): Request { return this.adapter.newRequest('/' + key); } 'delete'(key: string): Promise<boolean> { return this.cache.delete(this.request(key), this.cacheQueryOptions); } keys(): Promise<string[]> { return this.cache.keys().then((requests) => requests.map((req) => req.url.slice(1))); } read(key: string): Promise<any> { return this.cache.match(this.request(key), this.cacheQueryOptions).then((res) => { if (res === undefined) { return Promise.reject(new NotFound(this.name, key)); } return res.json(); }); } write(key: string, value: Object): Promise<void> { return this.cache.put(this.request(key), this.adapter.newResponse(JSON.stringify(value))); } }
{ "end_byte": 2733, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/src/db-cache.ts" }
angular/packages/service-worker/worker/src/debug.ts_0_3581
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {Adapter} from './adapter'; import {Debuggable, DebugLogger} from './api'; const SW_VERSION = '0.0.0-PLACEHOLDER'; const DEBUG_LOG_BUFFER_SIZE = 100; interface DebugMessage { time: number; value: string; context: string; } export class DebugHandler implements DebugLogger { // There are two debug log message arrays. debugLogA records new debugging messages. // Once it reaches DEBUG_LOG_BUFFER_SIZE, the array is moved to debugLogB and a new // array is assigned to debugLogA. This ensures that insertion to the debug log is // always O(1) no matter the number of logged messages, and that the total number // of messages in the log never exceeds 2 * DEBUG_LOG_BUFFER_SIZE. private debugLogA: DebugMessage[] = []; private debugLogB: DebugMessage[] = []; constructor( readonly driver: Debuggable, readonly adapter: Adapter, ) {} async handleFetch(req: Request): Promise<Response> { const [state, versions, idle] = await Promise.all([ this.driver.debugState(), this.driver.debugVersions(), this.driver.debugIdleState(), ]); const msgState = `NGSW Debug Info: Driver version: ${SW_VERSION} Driver state: ${state.state} (${state.why}) Latest manifest hash: ${state.latestHash || 'none'} Last update check: ${this.since(state.lastUpdateCheck)}`; const msgVersions = versions .map( (version) => `=== Version ${version.hash} === Clients: ${version.clients.join(', ')}`, ) .join('\n\n'); const msgIdle = `=== Idle Task Queue === Last update tick: ${this.since(idle.lastTrigger)} Last update run: ${this.since(idle.lastRun)} Task queue: ${idle.queue.map((v) => ' * ' + v).join('\n')} Debug log: ${this.formatDebugLog(this.debugLogB)} ${this.formatDebugLog(this.debugLogA)} `; return this.adapter.newResponse( `${msgState} ${msgVersions} ${msgIdle}`, {headers: this.adapter.newHeaders({'Content-Type': 'text/plain'})}, ); } since(time: number | null): string { if (time === null) { return 'never'; } let age = this.adapter.time - time; const days = Math.floor(age / 86400000); age = age % 86400000; const hours = Math.floor(age / 3600000); age = age % 3600000; const minutes = Math.floor(age / 60000); age = age % 60000; const seconds = Math.floor(age / 1000); const millis = age % 1000; return ( '' + (days > 0 ? `${days}d` : '') + (hours > 0 ? `${hours}h` : '') + (minutes > 0 ? `${minutes}m` : '') + (seconds > 0 ? `${seconds}s` : '') + (millis > 0 ? `${millis}u` : '') ); } log(value: string | Error, context: string = ''): void { // Rotate the buffers if debugLogA has grown too large. if (this.debugLogA.length === DEBUG_LOG_BUFFER_SIZE) { this.debugLogB = this.debugLogA; this.debugLogA = []; } // Convert errors to string for logging. if (typeof value !== 'string') { value = this.errorToString(value); } // Log the message. this.debugLogA.push({value, time: this.adapter.time, context}); } private errorToString(err: Error): string { return `${err.name}(${err.message}, ${err.stack})`; } private formatDebugLog(log: DebugMessage[]): string { return log .map((entry) => `[${this.since(entry.time)}] ${entry.value} ${entry.context}`) .join('\n'); } }
{ "end_byte": 3581, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/src/debug.ts" }
angular/packages/service-worker/worker/src/assets.ts_0_6856
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {Adapter} from './adapter'; import {CacheState, NormalizedUrl, UpdateCacheStatus, UpdateSource, UrlMetadata} from './api'; import {Database, Table} from './database'; import {CacheTable} from './db-cache'; import {errorToString, SwCriticalError, SwUnrecoverableStateError} from './error'; import {IdleScheduler} from './idle'; import {AssetGroupConfig} from './manifest'; import {NamedCache} from './named-cache-storage'; import {sha1Binary} from './sha1'; /** * A group of assets that are cached in a `Cache` and managed by a given policy. * * Concrete classes derive from this base and specify the exact caching policy. */ export abstract class AssetGroup { /** * A deduplication cache, to make sure the SW never makes two network requests * for the same resource at once. Managed by `fetchAndCacheOnce`. */ private inFlightRequests = new Map<string, Promise<Response>>(); /** * Normalized resource URLs. */ protected urls: NormalizedUrl[] = []; /** * Regular expression patterns. */ protected patterns: RegExp[] = []; /** * A Promise which resolves to the `Cache` used to back this asset group. This * is opened from the constructor. */ protected cache: Promise<NamedCache>; /** * Group name from the configuration. */ readonly name: string; /** * Metadata associated with specific cache entries. */ protected metadata: Promise<Table>; constructor( protected scope: ServiceWorkerGlobalScope, protected adapter: Adapter, protected idle: IdleScheduler, protected config: AssetGroupConfig, protected hashes: Map<string, string>, protected db: Database, cacheNamePrefix: string, ) { this.name = config.name; // Normalize the config's URLs to take the ServiceWorker's scope into account. this.urls = config.urls.map((url) => adapter.normalizeUrl(url)); // Patterns in the config are regular expressions disguised as strings. Breathe life into them. this.patterns = config.patterns.map((pattern) => new RegExp(pattern)); // This is the primary cache, which holds all of the cached requests for this group. If a // resource isn't in this cache, it hasn't been fetched yet. this.cache = adapter.caches.open(`${cacheNamePrefix}:${config.name}:cache`); // This is the metadata table, which holds specific information for each cached URL, such as // the timestamp of when it was added to the cache. this.metadata = this.db.open( `${cacheNamePrefix}:${config.name}:meta`, config.cacheQueryOptions, ); } async cacheStatus(url: string): Promise<UpdateCacheStatus> { const cache = await this.cache; const meta = await this.metadata; const req = this.adapter.newRequest(url); const res = await cache.match(req, this.config.cacheQueryOptions); if (res === undefined) { return UpdateCacheStatus.NOT_CACHED; } try { const data = await meta.read<UrlMetadata>(req.url); if (!data.used) { return UpdateCacheStatus.CACHED_BUT_UNUSED; } } catch (_) { // Error on the side of safety and assume cached. } return UpdateCacheStatus.CACHED; } /** * Initialize this asset group, updating from the given source if available. */ abstract initializeFully(updateFrom?: UpdateSource): Promise<void>; /** * Return a list of the names of all caches used by this group. */ async getCacheNames(): Promise<string[]> { const [cache, metadata] = await Promise.all([this.cache, this.metadata as Promise<CacheTable>]); return [cache.name, metadata.cacheName]; } /** * Process a request for a given resource and return it, or return null if it's not available. */ async handleFetch(req: Request, _event: ExtendableEvent): Promise<Response | null> { const url = this.adapter.normalizeUrl(req.url); // Either the request matches one of the known resource URLs, one of the patterns for // dynamically matched URLs, or neither. Determine which is the case for this request in // order to decide how to handle it. if (this.urls.indexOf(url) !== -1 || this.patterns.some((pattern) => pattern.test(url))) { // This URL matches a known resource. Either it's been cached already or it's missing, in // which case it needs to be loaded from the network. // Open the cache to check whether this resource is present. const cache = await this.cache; // Look for a cached response. If one exists, it can be used to resolve the fetch // operation. let cachedResponse: Response | undefined; try { // Safari 16.4/17 is known to sometimes throw an unexpected internal error on cache access // This try/catch is here as a workaround to prevent a failure of the handleFetch // as the Driver falls back to safeFetch on critical errors. // See #50378 cachedResponse = await cache.match(req, this.config.cacheQueryOptions); } catch (error) { throw new SwCriticalError(`Cache is throwing while looking for a match: ${error}`); } if (cachedResponse !== undefined) { // A response has already been cached (which presumably matches the hash for this // resource). Check whether it's safe to serve this resource from cache. if (this.hashes.has(url)) { // This resource has a hash, and thus is versioned by the manifest. It's safe to return // the response. return cachedResponse; } else { // This resource has no hash, and yet exists in the cache. Check how old this request is // to make sure it's still usable. if (await this.needToRevalidate(req, cachedResponse)) { this.idle.schedule(`revalidate(${cache.name}): ${req.url}`, async () => { await this.fetchAndCacheOnce(req); }); } // In either case (revalidation or not), the cached response must be good. return cachedResponse; } } // No already-cached response exists, so attempt a fetch/cache operation. const res = await this.fetchAndCacheOnce(this.newRequestWithMetadata(req.url, req)); // If this is successful, the response needs to be cloned as it might be used to respond to // multiple fetch operations at the same time. return res.clone(); } else { return null; } } /** * Some resources are cached without a hash, meaning that their expiration is controlled * by HTTP caching headers. Check whether the given request/response pair is still valid * per the caching headers. */
{ "end_byte": 6856, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/src/assets.ts" }
angular/packages/service-worker/worker/src/assets.ts_6859_15432
private async needToRevalidate(req: Request, res: Response): Promise<boolean> { // Three different strategies apply here: // 1) The request has a Cache-Control header, and thus expiration needs to be based on its age. // 2) The request has an Expires header, and expiration is based on the current timestamp. // 3) The request has no applicable caching headers, and must be revalidated. if (res.headers.has('Cache-Control')) { // Figure out if there is a max-age directive in the Cache-Control header. const cacheControl = res.headers.get('Cache-Control')!; const cacheDirectives = cacheControl // Directives are comma-separated within the Cache-Control header value. .split(',') // Make sure each directive doesn't have extraneous whitespace. .map((v) => v.trim()) // Some directives have values (like maxage and s-maxage) .map((v) => v.split('=')); // Lowercase all the directive names. cacheDirectives.forEach((v) => (v[0] = v[0].toLowerCase())); // Find the max-age directive, if one exists. const maxAgeDirective = cacheDirectives.find((v) => v[0] === 'max-age'); const cacheAge = maxAgeDirective ? maxAgeDirective[1] : undefined; if (!cacheAge) { // No usable TTL defined. Must assume that the response is stale. return true; } try { const maxAge = 1000 * parseInt(cacheAge); // Determine the origin time of this request. If the SW has metadata on the request (which // it // should), it will have the time the request was added to the cache. If it doesn't for some // reason, the request may have a Date header which will serve the same purpose. let ts: number; try { // Check the metadata table. If a timestamp is there, use it. const metaTable = await this.metadata; ts = (await metaTable.read<UrlMetadata>(req.url)).ts; } catch { // Otherwise, look for a Date header. const date = res.headers.get('Date'); if (date === null) { // Unable to determine when this response was created. Assume that it's stale, and // revalidate it. return true; } ts = Date.parse(date); } const age = this.adapter.time - ts; return age < 0 || age > maxAge; } catch { // Assume stale. return true; } } else if (res.headers.has('Expires')) { // Determine if the expiration time has passed. const expiresStr = res.headers.get('Expires')!; try { // The request needs to be revalidated if the current time is later than the expiration // time, if it parses correctly. return this.adapter.time > Date.parse(expiresStr); } catch { // The expiration date failed to parse, so revalidate as a precaution. return true; } } else { // No way to evaluate staleness, so assume the response is already stale. return true; } } /** * Fetch the complete state of a cached resource, or return null if it's not found. */ async fetchFromCacheOnly(url: string): Promise<CacheState | null> { const cache = await this.cache; const metaTable = await this.metadata; // Lookup the response in the cache. const request = this.adapter.newRequest(url); const response = await cache.match(request, this.config.cacheQueryOptions); if (response === undefined) { // It's not found, return null. return null; } // Next, lookup the cached metadata. let metadata: UrlMetadata | undefined = undefined; try { metadata = await metaTable.read<UrlMetadata>(request.url); } catch { // Do nothing, not found. This shouldn't happen, but it can be handled. } // Return both the response and any available metadata. return {response, metadata}; } /** * Lookup all resources currently stored in the cache which have no associated hash. */ async unhashedResources(): Promise<NormalizedUrl[]> { const cache = await this.cache; // Start with the set of all cached requests. return ( (await cache.keys()) // Normalize their URLs. .map((request) => this.adapter.normalizeUrl(request.url)) // Exclude the URLs which have hashes. .filter((url) => !this.hashes.has(url)) ); } /** * Fetch the given resource from the network, and cache it if able. */ protected async fetchAndCacheOnce(req: Request, used: boolean = true): Promise<Response> { // The `inFlightRequests` map holds information about which caching operations are currently // underway for known resources. If this request appears there, another "thread" is already // in the process of caching it, and this work should not be duplicated. if (this.inFlightRequests.has(req.url)) { // There is a caching operation already in progress for this request. Wait for it to // complete, and hopefully it will have yielded a useful response. return this.inFlightRequests.get(req.url)!; } // No other caching operation is being attempted for this resource, so it will be owned here. // Go to the network and get the correct version. const fetchOp = this.fetchFromNetwork(req); // Save this operation in `inFlightRequests` so any other "thread" attempting to cache it // will block on this chain instead of duplicating effort. this.inFlightRequests.set(req.url, fetchOp); // Make sure this attempt is cleaned up properly on failure. try { // Wait for a response. If this fails, the request will remain in `inFlightRequests` // indefinitely. const res = await fetchOp; // It's very important that only successful responses are cached. Unsuccessful responses // should never be cached as this can completely break applications. if (!res.ok) { throw new Error( `Response not Ok (fetchAndCacheOnce): request for ${req.url} returned response ${res.status} ${res.statusText}`, ); } try { // This response is safe to cache (as long as it's cloned). Wait until the cache operation // is complete. const cache = await this.cache; await cache.put(req, res.clone()); // If the request is not hashed, update its metadata, especially the timestamp. This is // needed for future determination of whether this cached response is stale or not. if (!this.hashes.has(this.adapter.normalizeUrl(req.url))) { // Metadata is tracked for requests that are unhashed. const meta: UrlMetadata = {ts: this.adapter.time, used}; const metaTable = await this.metadata; await metaTable.write(req.url, meta); } return res; } catch (err) { // Among other cases, this can happen when the user clears all data through the DevTools, // but the SW is still running and serving another tab. In that case, trying to write to the // caches throws an `Entry was not found` error. // If this happens the SW can no longer work correctly. This situation is unrecoverable. throw new SwCriticalError( `Failed to update the caches for request to '${ req.url }' (fetchAndCacheOnce): ${errorToString(err)}`, ); } } finally { // Finally, it can be removed from `inFlightRequests`. This might result in a double-remove // if some other chain was already making this request too, but that won't hurt anything. this.inFlightRequests.delete(req.url); } } protected async fetchFromNetwork(req: Request, redirectLimit: number = 3): Promise<Response> { // Make a cache-busted request for the resource. const res = await this.cacheBustedFetchFromNetwork(req); // Check for redirected responses, and follow the redirects. if ((res as any)['redirected'] && !!res.url) { // If the redirect limit is exhausted, fail with an error. if (redirectLimit === 0) { throw new SwCriticalError( `Response hit redirect limit (fetchFromNetwork): request redirected too many times, next is ${res.url}`, ); } // Unwrap the redirect directly. return this.fetchFromNetwork(this.newRequestWithMetadata(res.url, req), redirectLimit - 1); } return res; } /** * Load a particular asset from the network, accounting for hash validation. */
{ "end_byte": 15432, "start_byte": 6859, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/src/assets.ts" }
angular/packages/service-worker/worker/src/assets.ts_15435_22201
protected async cacheBustedFetchFromNetwork(req: Request): Promise<Response> { const url = this.adapter.normalizeUrl(req.url); // If a hash is available for this resource, then compare the fetched version with the // canonical hash. Otherwise, the network version will have to be trusted. if (this.hashes.has(url)) { // It turns out this resource does have a hash. Look it up. Unless the fetched version // matches this hash, it's invalid and the whole manifest may need to be thrown out. const canonicalHash = this.hashes.get(url)!; // Ideally, the resource would be requested with cache-busting to guarantee the SW gets // the freshest version. However, doing this would eliminate any chance of the response // being in the HTTP cache. Given that the browser has recently actively loaded the page, // it's likely that many of the responses the SW needs to cache are in the HTTP cache and // are fresh enough to use. In the future, this could be done by setting cacheMode to // *only* check the browser cache for a cached version of the resource, when cacheMode is // fully supported. For now, the resource is fetched directly, without cache-busting, and // if the hash test fails a cache-busted request is tried before concluding that the // resource isn't correct. This gives the benefit of acceleration via the HTTP cache // without the risk of stale data, at the expense of a duplicate request in the event of // a stale response. // Fetch the resource from the network (possibly hitting the HTTP cache). let response = await this.safeFetch(req); // Decide whether a cache-busted request is necessary. A cache-busted request is necessary // only if the request was successful but the hash of the retrieved contents does not match // the canonical hash from the manifest. let makeCacheBustedRequest = response.ok; if (makeCacheBustedRequest) { // The request was successful. A cache-busted request is only necessary if the hashes // don't match. // (Make sure to clone the response so it can be used later if it proves to be valid.) const fetchedHash = sha1Binary(await response.clone().arrayBuffer()); makeCacheBustedRequest = fetchedHash !== canonicalHash; } // Make a cache busted request to the network, if necessary. if (makeCacheBustedRequest) { // Hash failure, the version that was retrieved under the default URL did not have the // hash expected. This could be because the HTTP cache got in the way and returned stale // data, or because the version on the server really doesn't match. A cache-busting // request will differentiate these two situations. // TODO: handle case where the URL has parameters already (unlikely for assets). const cacheBustReq = this.newRequestWithMetadata(this.cacheBust(req.url), req); response = await this.safeFetch(cacheBustReq); // If the response was successful, check the contents against the canonical hash. if (response.ok) { // Hash the contents. // (Make sure to clone the response so it can be used later if it proves to be valid.) const cacheBustedHash = sha1Binary(await response.clone().arrayBuffer()); // If the cache-busted version doesn't match, then the manifest is not an accurate // representation of the server's current set of files, and the SW should give up. if (canonicalHash !== cacheBustedHash) { throw new SwCriticalError( `Hash mismatch (cacheBustedFetchFromNetwork): ${req.url}: expected ${canonicalHash}, got ${cacheBustedHash} (after cache busting)`, ); } } } // At this point, `response` is either successful with a matching hash or is unsuccessful. // Before returning it, check whether it failed with a 404 status. This would signify an // unrecoverable state. if (!response.ok && response.status === 404) { throw new SwUnrecoverableStateError( `Failed to retrieve hashed resource from the server. (AssetGroup: ${this.config.name} | URL: ${url})`, ); } // Return the response (successful or unsuccessful). return response; } else { // This URL doesn't exist in our hash database, so it must be requested directly. return this.safeFetch(req); } } /** * Possibly update a resource, if it's expired and needs to be updated. A no-op otherwise. */ protected async maybeUpdate( updateFrom: UpdateSource, req: Request, cache: Cache, ): Promise<boolean> { const url = this.adapter.normalizeUrl(req.url); // Check if this resource is hashed and already exists in the cache of a prior version. if (this.hashes.has(url)) { const hash = this.hashes.get(url)!; // Check the caches of prior versions, using the hash to ensure the correct version of // the resource is loaded. const res = await updateFrom.lookupResourceWithHash(url, hash); // If a previously cached version was available, copy it over to this cache. if (res !== null) { // Copy to this cache. await cache.put(req, res); // No need to do anything further with this resource, it's now cached properly. return true; } } // No up-to-date version of this resource could be found. return false; } /** * Create a new `Request` based on the specified URL and `RequestInit` options, preserving only * metadata that are known to be safe. * * Currently, only headers are preserved. * * NOTE: * Things like credential inclusion are intentionally omitted to avoid issues with opaque * responses. * * TODO(gkalpak): * Investigate preserving more metadata. See, also, discussion on preserving `mode`: * https://github.com/angular/angular/issues/41931#issuecomment-1227601347 */ private newRequestWithMetadata(url: string, options: RequestInit): Request { return this.adapter.newRequest(url, {headers: options.headers}); } /** * Construct a cache-busting URL for a given URL. */ private cacheBust(url: string): string { return url + (url.indexOf('?') === -1 ? '?' : '&') + 'ngsw-cache-bust=' + Math.random(); } protected async safeFetch(req: Request): Promise<Response> { try { return await this.scope.fetch(req); } catch { return this.adapter.newResponse('', { status: 504, statusText: 'Gateway Timeout', }); } } } /** * An `AssetGroup` that prefetches all of its resources during initialization. */
{ "end_byte": 22201, "start_byte": 15435, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/src/assets.ts" }
angular/packages/service-worker/worker/src/assets.ts_22202_28282
export class PrefetchAssetGroup extends AssetGroup { override async initializeFully(updateFrom?: UpdateSource): Promise<void> { // Open the cache which actually holds requests. const cache = await this.cache; // Cache all known resources serially. As this reduce proceeds, each Promise waits // on the last before starting the fetch/cache operation for the next request. Any // errors cause fall-through to the final Promise which rejects. await this.urls.reduce(async (previous: Promise<void>, url: string) => { // Wait on all previous operations to complete. await previous; // Construct the Request for this url. const req = this.adapter.newRequest(url); let alreadyCached = false; try { // Safari 16.4/17 is known to sometimes throw an unexpected internal error on cache access // This try/catch is here as a workaround to prevent a failure of the handleFetch // as the Driver falls back to safeFetch on critical errors. // See #50378 // First, check the cache to see if there is already a copy of this resource. alreadyCached = (await cache.match(req, this.config.cacheQueryOptions)) !== undefined; } catch (error) { throw new SwCriticalError( `Cache is throwing while looking for a match in a PrefetchAssetGroup: ${error}`, ); } // If the resource is in the cache already, it can be skipped. if (alreadyCached) { return; } // If an update source is available. if (updateFrom !== undefined && (await this.maybeUpdate(updateFrom, req, cache))) { return; } // Otherwise, go to the network and hopefully cache the response (if successful). await this.fetchAndCacheOnce(req, false); }, Promise.resolve()); // Handle updating of unknown (unhashed) resources. This is only possible if there's // a source to update from. if (updateFrom !== undefined) { const metaTable = await this.metadata; // Select all of the previously cached resources. These are cached unhashed resources // from previous versions of the app, in any asset group. await ( await updateFrom.previouslyCachedResources() ) // First, narrow down the set of resources to those which are handled by this group. // Either it's a known URL, or it matches a given pattern. .filter( (url) => this.urls.indexOf(url) !== -1 || this.patterns.some((pattern) => pattern.test(url)), ) // Finally, process each resource in turn. .reduce(async (previous, url) => { await previous; const req = this.adapter.newRequest(url); // It's possible that the resource in question is already cached. If so, // continue to the next one. const alreadyCached = (await cache.match(req, this.config.cacheQueryOptions)) !== undefined; if (alreadyCached) { return; } // Get the most recent old version of the resource. const res = await updateFrom.lookupResourceWithoutHash(url); if (res === null || res.metadata === undefined) { // Unexpected, but not harmful. return; } // Write it into the cache. It may already be expired, but it can still serve // traffic until it's updated (stale-while-revalidate approach). await cache.put(req, res.response); await metaTable.write(req.url, {...res.metadata, used: false} as UrlMetadata); }, Promise.resolve()); } } } export class LazyAssetGroup extends AssetGroup { override async initializeFully(updateFrom?: UpdateSource): Promise<void> { // No action necessary if no update source is available - resources managed in this group // are all lazily loaded, so there's nothing to initialize. if (updateFrom === undefined) { return; } // Open the cache which actually holds requests. const cache = await this.cache; // Loop through the listed resources, caching any which are available. await this.urls.reduce(async (previous: Promise<void>, url: string) => { // Wait on all previous operations to complete. await previous; // Construct the Request for this url. const req = this.adapter.newRequest(url); let alreadyCached = false; try { // Safari 16.4/17 is known to sometimes throw an unexpected internal error on cache access // This try/catch is here as a workaround to prevent a failure of the handleFetch // as the Driver falls back to safeFetch on critical errors. // See #50378 // First, check the cache to see if there is already a copy of this resource. alreadyCached = (await cache.match(req, this.config.cacheQueryOptions)) !== undefined; } catch (error) { throw new SwCriticalError( `Cache is throwing while looking for a match in a LazyAssetGroup: ${error}`, ); } // If the resource is in the cache already, it can be skipped. if (alreadyCached) { return; } const updated = await this.maybeUpdate(updateFrom, req, cache); if (this.config.updateMode === 'prefetch' && !updated) { // If the resource was not updated, either it was not cached before or // the previously cached version didn't match the updated hash. In that // case, prefetch update mode dictates that the resource will be updated, // except if it was not previously utilized. Check the status of the // cached resource to see. const cacheStatus = await updateFrom.recentCacheStatus(url); // If the resource is not cached, or was cached but unused, then it will be // loaded lazily. if (cacheStatus !== UpdateCacheStatus.CACHED) { return; } // Update from the network. await this.fetchAndCacheOnce(req, false); } }, Promise.resolve()); } }
{ "end_byte": 28282, "start_byte": 22202, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/src/assets.ts" }
angular/packages/service-worker/worker/src/named-cache-storage.ts_0_1665
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ export interface NamedCache extends Cache { readonly name: string; } /** * A wrapper around `CacheStorage` to allow interacting with caches more easily and consistently by: * - Adding a `name` property to all opened caches, which can be used to easily perform other * operations that require the cache name. * - Name-spacing cache names to avoid conflicts with other caches on the same domain. */ export class NamedCacheStorage<T extends CacheStorage> implements CacheStorage { constructor( readonly original: T, private cacheNamePrefix: string, ) {} delete(cacheName: string): Promise<boolean> { return this.original.delete(`${this.cacheNamePrefix}:${cacheName}`); } has(cacheName: string): Promise<boolean> { return this.original.has(`${this.cacheNamePrefix}:${cacheName}`); } async keys(): Promise<string[]> { const prefix = `${this.cacheNamePrefix}:`; const allCacheNames = await this.original.keys(); const ownCacheNames = allCacheNames.filter((name) => name.startsWith(prefix)); return ownCacheNames.map((name) => name.slice(prefix.length)); } match(request: RequestInfo, options?: MultiCacheQueryOptions): Promise<Response | undefined> { return this.original.match(request, options); } async open(cacheName: string): Promise<NamedCache> { const cache = await this.original.open(`${this.cacheNamePrefix}:${cacheName}`); return Object.assign(cache, {name: cacheName}); } }
{ "end_byte": 1665, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/src/named-cache-storage.ts" }
angular/packages/service-worker/worker/src/api.ts_0_3505
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ export enum UpdateCacheStatus { NOT_CACHED, CACHED_BUT_UNUSED, CACHED, } /** * A `string` representing a URL that has been normalized relative to an origin (usually that of the * ServiceWorker). * * If the URL is relative to the origin, then it is represented by the path part only. Otherwise, * the full URL is used. * * NOTE: A `string` is not assignable to a `NormalizedUrl`, but a `NormalizedUrl` is assignable to a * `string`. */ export type NormalizedUrl = string & {_brand: 'normalizedUrl'}; /** * A source for old versions of URL contents and other resources. * * Used to abstract away the fetching of old contents, to avoid a * circular dependency between the `Driver` and `AppVersion`. Without * this interface, `AppVersion` would need a reference to the `Driver` * to access information from other versions. */ export interface UpdateSource { /** * Lookup an older version of a resource for which the hash is known. * * If an old version of the resource doesn't exist, or exists but does * not match the hash given, this returns null. */ lookupResourceWithHash(url: NormalizedUrl, hash: string): Promise<Response | null>; /** * Lookup an older version of a resource for which the hash is not known. * * This will return the most recent previous version of the resource, if * it exists. It returns a `CacheState` object which encodes not only the * `Response`, but the cache metadata needed to re-cache the resource in * a newer `AppVersion`. */ lookupResourceWithoutHash(url: NormalizedUrl): Promise<CacheState | null>; /** * List the URLs of all of the resources which were previously cached. * * This allows for the discovery of resources which are not listed in the * manifest but which were picked up because they matched URL patterns. */ previouslyCachedResources(): Promise<NormalizedUrl[]>; /** * Check whether a particular resource exists in the most recent cache. * * This returns a state value which indicates whether the resource was * cached at all and whether that cache was utilized. */ recentCacheStatus(url: string): Promise<UpdateCacheStatus>; } /** * Metadata cached along with a URL. */ export interface UrlMetadata { /** * The timestamp, in UNIX time in milliseconds, of when this URL was stored * in the cache. */ ts: number; /** * Whether the resource was requested before for this particular cached * instance. */ used: boolean; } /** * The fully cached state of a resource, including both the `Response` itself * and the cache metadata. */ export interface CacheState { response: Response; metadata?: UrlMetadata; } export interface DebugLogger { log(value: string | Error, context?: string): void; } export interface DebugState { state: string; why: string; latestHash: string | null; lastUpdateCheck: number | null; } export interface DebugVersion { hash: string; manifest: Object; clients: string[]; status: string; } export interface DebugIdleState { queue: string[]; lastTrigger: number | null; lastRun: number | null; } export interface Debuggable { debugState(): Promise<DebugState>; debugVersions(): Promise<DebugVersion[]>; debugIdleState(): Promise<DebugIdleState>; }
{ "end_byte": 3505, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/src/api.ts" }
angular/packages/service-worker/worker/src/sha1.ts_0_5713
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ /** * Compute the SHA1 of the given string * * see https://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf * * WARNING: this function has not been designed not tested with security in mind. * DO NOT USE IT IN A SECURITY SENSITIVE CONTEXT. * * Borrowed from @angular/compiler/src/i18n/digest.ts */ export function sha1(str: string): string { const utf8 = str; const words32 = stringToWords32(utf8, Endian.Big); return _sha1(words32, utf8.length * 8); } export function sha1Binary(buffer: ArrayBuffer): string { const words32 = arrayBufferToWords32(buffer, Endian.Big); return _sha1(words32, buffer.byteLength * 8); } function _sha1(words32: number[], len: number): string { const w: number[] = []; let [a, b, c, d, e]: number[] = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0]; words32[len >> 5] |= 0x80 << (24 - (len % 32)); words32[(((len + 64) >> 9) << 4) + 15] = len; for (let i = 0; i < words32.length; i += 16) { const [h0, h1, h2, h3, h4]: number[] = [a, b, c, d, e]; for (let j = 0; j < 80; j++) { if (j < 16) { w[j] = words32[i + j]; } else { w[j] = rol32(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1); } const [f, k] = fk(j, b, c, d); const temp = [rol32(a, 5), f, e, k, w[j]].reduce(add32); [e, d, c, b, a] = [d, c, rol32(b, 30), a, temp]; } [a, b, c, d, e] = [add32(a, h0), add32(b, h1), add32(c, h2), add32(d, h3), add32(e, h4)]; } return byteStringToHexString(words32ToByteString([a, b, c, d, e])); } function add32(a: number, b: number): number { return add32to64(a, b)[1]; } function add32to64(a: number, b: number): [number, number] { const low = (a & 0xffff) + (b & 0xffff); const high = (a >>> 16) + (b >>> 16) + (low >>> 16); return [high >>> 16, (high << 16) | (low & 0xffff)]; } function add64([ah, al]: [number, number], [bh, bl]: [number, number]): [number, number] { const [carry, l] = add32to64(al, bl); const h = add32(add32(ah, bh), carry); return [h, l]; } function sub32(a: number, b: number): number { const low = (a & 0xffff) - (b & 0xffff); const high = (a >> 16) - (b >> 16) + (low >> 16); return (high << 16) | (low & 0xffff); } // Rotate a 32b number left `count` position function rol32(a: number, count: number): number { return (a << count) | (a >>> (32 - count)); } // Rotate a 64b number left `count` position function rol64([hi, lo]: [number, number], count: number): [number, number] { const h = (hi << count) | (lo >>> (32 - count)); const l = (lo << count) | (hi >>> (32 - count)); return [h, l]; } enum Endian { Little, Big, } function fk(index: number, b: number, c: number, d: number): [number, number] { if (index < 20) { return [(b & c) | (~b & d), 0x5a827999]; } if (index < 40) { return [b ^ c ^ d, 0x6ed9eba1]; } if (index < 60) { return [(b & c) | (b & d) | (c & d), 0x8f1bbcdc]; } return [b ^ c ^ d, 0xca62c1d6]; } function stringToWords32(str: string, endian: Endian): number[] { const size = (str.length + 3) >>> 2; const words32 = []; for (let i = 0; i < size; i++) { words32[i] = wordAt(str, i * 4, endian); } return words32; } function arrayBufferToWords32(buffer: ArrayBuffer, endian: Endian): number[] { const size = (buffer.byteLength + 3) >>> 2; const words32: number[] = []; const view = new Uint8Array(buffer); for (let i = 0; i < size; i++) { words32[i] = wordAt(view, i * 4, endian); } return words32; } function byteAt(str: string | Uint8Array, index: number): number { if (typeof str === 'string') { return index >= str.length ? 0 : str.charCodeAt(index) & 0xff; } else { return index >= str.byteLength ? 0 : str[index] & 0xff; } } function wordAt(str: string | Uint8Array, index: number, endian: Endian): number { let word = 0; if (endian === Endian.Big) { for (let i = 0; i < 4; i++) { word += byteAt(str, index + i) << (24 - 8 * i); } } else { for (let i = 0; i < 4; i++) { word += byteAt(str, index + i) << (8 * i); } } return word; } function words32ToByteString(words32: number[]): string { return words32.reduce((str, word) => str + word32ToByteString(word), ''); } function word32ToByteString(word: number): string { let str = ''; for (let i = 0; i < 4; i++) { str += String.fromCharCode((word >>> (8 * (3 - i))) & 0xff); } return str; } function byteStringToHexString(str: string): string { let hex: string = ''; for (let i = 0; i < str.length; i++) { const b = byteAt(str, i); hex += (b >>> 4).toString(16) + (b & 0x0f).toString(16); } return hex.toLowerCase(); } // based on https://www.danvk.org/hex2dec.html (JS can not handle more than 56b) function byteStringToDecString(str: string): string { let decimal = ''; let toThePower = '1'; for (let i = str.length - 1; i >= 0; i--) { decimal = addBigInt(decimal, numberTimesBigInt(byteAt(str, i), toThePower)); toThePower = numberTimesBigInt(256, toThePower); } return decimal.split('').reverse().join(''); } // x and y decimal, lowest significant digit first function addBigInt(x: string, y: string): string { let sum = ''; const len = Math.max(x.length, y.length); for (let i = 0, carry = 0; i < len || carry; i++) { const tmpSum = carry + +(x[i] || 0) + +(y[i] || 0); if (tmpSum >= 10) { carry = 1; sum += tmpSum - 10; } else { carry = 0; sum += tmpSum; } } return sum; }
{ "end_byte": 5713, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/src/sha1.ts" }
angular/packages/service-worker/worker/src/sha1.ts_5715_5996
function numberTimesBigInt(num: number, b: string): string { let product = ''; let bToThePower = b; for (; num !== 0; num = num >>> 1) { if (num & 1) product = addBigInt(product, bToThePower); bToThePower = addBigInt(bToThePower, bToThePower); } return product; }
{ "end_byte": 5996, "start_byte": 5715, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/src/sha1.ts" }
angular/packages/service-worker/worker/src/app-version.ts_0_842
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {Adapter} from './adapter'; import {CacheState, NormalizedUrl, UpdateCacheStatus, UpdateSource} from './api'; import {AssetGroup, LazyAssetGroup, PrefetchAssetGroup} from './assets'; import {DataGroup} from './data'; import {Database} from './database'; import {DebugHandler} from './debug'; import {IdleScheduler} from './idle'; import {Manifest} from './manifest'; /** * A specific version of the application, identified by a unique manifest * as determined by its hash. * * Each `AppVersion` can be thought of as a published version of the app * that can be installed as an update to any previously installed versions. */
{ "end_byte": 842, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/src/app-version.ts" }
angular/packages/service-worker/worker/src/app-version.ts_843_9249
export class AppVersion implements UpdateSource { /** * A Map of absolute URL paths (`/foo.txt`) to the known hash of their contents (if available). */ private hashTable = new Map<NormalizedUrl, string>(); /** * All of the asset groups active in this version of the app. */ private assetGroups: AssetGroup[]; /** * All of the data groups active in this version of the app. */ private dataGroups: DataGroup[]; /** * Requests to URLs that match any of the `include` RegExps and none of the `exclude` RegExps * are considered navigation requests and handled accordingly. */ private navigationUrls: {include: RegExp[]; exclude: RegExp[]}; /** * The normalized URL to the file that serves as the index page to satisfy navigation requests. * Usually this is `/index.html`. */ private indexUrl: NormalizedUrl; /** * Tracks whether the manifest has encountered any inconsistencies. */ private _okay = true; get okay(): boolean { return this._okay; } constructor( private scope: ServiceWorkerGlobalScope, private adapter: Adapter, private database: Database, idle: IdleScheduler, private debugHandler: DebugHandler, readonly manifest: Manifest, readonly manifestHash: string, ) { this.indexUrl = this.adapter.normalizeUrl(this.manifest.index); // The hashTable within the manifest is an Object - convert it to a Map for easier lookups. Object.keys(manifest.hashTable).forEach((url) => { this.hashTable.set(adapter.normalizeUrl(url), manifest.hashTable[url]); }); // Process each `AssetGroup` declared in the manifest. Each declared group gets an `AssetGroup` // instance created for it, of a type that depends on the configuration mode. const assetCacheNamePrefix = `${manifestHash}:assets`; this.assetGroups = (manifest.assetGroups || []).map((config) => { // Check the caching mode, which determines when resources will be fetched/updated. switch (config.installMode) { case 'prefetch': return new PrefetchAssetGroup( scope, adapter, idle, config, this.hashTable, database, assetCacheNamePrefix, ); case 'lazy': return new LazyAssetGroup( scope, adapter, idle, config, this.hashTable, database, assetCacheNamePrefix, ); } }); // Process each `DataGroup` declared in the manifest. this.dataGroups = (manifest.dataGroups || []).map( (config) => new DataGroup(scope, adapter, config, database, debugHandler, `${config.version}:data`), ); // Create `include`/`exclude` RegExps for the `navigationUrls` declared in the manifest. const includeUrls = manifest.navigationUrls.filter((spec) => spec.positive); const excludeUrls = manifest.navigationUrls.filter((spec) => !spec.positive); this.navigationUrls = { include: includeUrls.map((spec) => new RegExp(spec.regex)), exclude: excludeUrls.map((spec) => new RegExp(spec.regex)), }; } /** * Fully initialize this version of the application. If this Promise resolves successfully, all * required * data has been safely downloaded. */ async initializeFully(updateFrom?: UpdateSource): Promise<void> { try { // Fully initialize each asset group, in series. Starts with an empty Promise, // and waits for the previous groups to have been initialized before initializing // the next one in turn. await this.assetGroups.reduce<Promise<void>>(async (previous, group) => { // Wait for the previous groups to complete initialization. If there is a // failure, this will throw, and each subsequent group will throw, until the // whole sequence fails. await previous; // Initialize this group. return group.initializeFully(updateFrom); }, Promise.resolve()); } catch (err) { this._okay = false; throw err; } } async handleFetch(req: Request, event: ExtendableEvent): Promise<Response | null> { // Check the request against each `AssetGroup` in sequence. If an `AssetGroup` can't handle the // request, // it will return `null`. Thus, the first non-null response is the SW's answer to the request. // So reduce // the group list, keeping track of a possible response. If there is one, it gets passed // through, and if // not the next group is consulted to produce a candidate response. const asset = await this.assetGroups.reduce(async (potentialResponse, group) => { // Wait on the previous potential response. If it's not null, it should just be passed // through. const resp = await potentialResponse; if (resp !== null) { return resp; } // No response has been found yet. Maybe this group will have one. return group.handleFetch(req, event); }, Promise.resolve<Response | null>(null)); // The result of the above is the asset response, if there is any, or null otherwise. Return the // asset // response if there was one. If not, check with the data caching groups. if (asset !== null) { return asset; } // Perform the same reduction operation as above, but this time processing // the data caching groups. const data = await this.dataGroups.reduce(async (potentialResponse, group) => { const resp = await potentialResponse; if (resp !== null) { return resp; } return group.handleFetch(req, event); }, Promise.resolve<Response | null>(null)); // If the data caching group returned a response, go with it. if (data !== null) { return data; } // Next, check if this is a navigation request for a route. Detect circular // navigations by checking if the request URL is the same as the index URL. if (this.adapter.normalizeUrl(req.url) !== this.indexUrl && this.isNavigationRequest(req)) { if (this.manifest.navigationRequestStrategy === 'freshness') { // For navigation requests the freshness was configured. The request will always go trough // the network and fallback to default `handleFetch` behavior in case of failure. try { return await this.scope.fetch(req); } catch { // Navigation request failed - application is likely offline. // Proceed forward to the default `handleFetch` behavior, where // `indexUrl` will be requested and it should be available in the cache. } } // This was a navigation request. Re-enter `handleFetch` with a request for // the index URL. return this.handleFetch(this.adapter.newRequest(this.indexUrl), event); } return null; } /** * Determine whether the request is a navigation request. * Takes into account: Request method and mode, `Accept` header, `navigationUrls` patterns. */ isNavigationRequest(req: Request): boolean { if (req.method !== 'GET' || req.mode !== 'navigate') { return false; } if (!this.acceptsTextHtml(req)) { return false; } const urlPrefix = this.scope.registration.scope.replace(/\/$/, ''); const url = req.url.startsWith(urlPrefix) ? req.url.slice(urlPrefix.length) : req.url; const urlWithoutQueryOrHash = url.replace(/[?#].*$/, ''); return ( this.navigationUrls.include.some((regex) => regex.test(urlWithoutQueryOrHash)) && !this.navigationUrls.exclude.some((regex) => regex.test(urlWithoutQueryOrHash)) ); } /** * Check this version for a given resource with a particular hash. */ async lookupResourceWithHash(url: NormalizedUrl, hash: string): Promise<Response | null> { // Verify that this version has the requested resource cached. If not, // there's no point in trying. if (!this.hashTable.has(url)) { return null; } // Next, check whether the resource has the correct hash. If not, any cached // response isn't usable. if (this.hashTable.get(url) !== hash) { return null; } const cacheState = await this.lookupResourceWithoutHash(url); return cacheState && cacheState.response; } /** * Check this version for a given resource regardless of its hash. */
{ "end_byte": 9249, "start_byte": 843, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/src/app-version.ts" }
angular/packages/service-worker/worker/src/app-version.ts_9252_11542
lookupResourceWithoutHash(url: NormalizedUrl): Promise<CacheState | null> { // Limit the search to asset groups, and only scan the cache, don't // load resources from the network. return this.assetGroups.reduce(async (potentialResponse, group) => { const resp = await potentialResponse; if (resp !== null) { return resp; } // fetchFromCacheOnly() avoids any network fetches, and returns the // full set of cache data, not just the Response. return group.fetchFromCacheOnly(url); }, Promise.resolve<CacheState | null>(null)); } /** * List all unhashed resources from all asset groups. */ previouslyCachedResources(): Promise<NormalizedUrl[]> { return this.assetGroups.reduce( async (resources, group) => (await resources).concat(await group.unhashedResources()), Promise.resolve<NormalizedUrl[]>([]), ); } async recentCacheStatus(url: string): Promise<UpdateCacheStatus> { return this.assetGroups.reduce(async (current, group) => { const status = await current; if (status === UpdateCacheStatus.CACHED) { return status; } const groupStatus = await group.cacheStatus(url); if (groupStatus === UpdateCacheStatus.NOT_CACHED) { return status; } return groupStatus; }, Promise.resolve(UpdateCacheStatus.NOT_CACHED)); } /** * Return a list of the names of all caches used by this version. */ async getCacheNames(): Promise<string[]> { const allGroupCacheNames = await Promise.all([ ...this.assetGroups.map((group) => group.getCacheNames()), ...this.dataGroups.map((group) => group.getCacheNames()), ]); return ([] as string[]).concat(...allGroupCacheNames); } /** * Get the opaque application data which was provided with the manifest. */ get appData(): Object | null { return this.manifest.appData || null; } /** * Check whether a request accepts `text/html` (based on the `Accept` header). */ private acceptsTextHtml(req: Request): boolean { const accept = req.headers.get('Accept'); if (accept === null) { return false; } const values = accept.split(','); return values.some((value) => value.trim().toLowerCase() === 'text/html'); } }
{ "end_byte": 11542, "start_byte": 9252, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/src/app-version.ts" }
angular/packages/service-worker/worker/src/database.ts_0_1478
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ /** * An abstract table, with the ability to read/write objects stored under keys. */ export interface Table { /** * The name of this table in the database. */ name: string; /** * Delete a key from the table. */ 'delete'(key: string): Promise<boolean>; /** * List all the keys currently stored in the table. */ keys(): Promise<string[]>; /** * Read a key from a table, either as an Object or with a given type. */ read(key: string): Promise<Object>; read<T>(key: string): Promise<T>; /** * Write a new value for a key to the table, overwriting any previous value. */ write(key: string, value: Object): Promise<void>; } /** * An abstract database, consisting of multiple named `Table`s. */ export interface Database { /** * Delete an entire `Table` from the database, by name. */ 'delete'(table: string): Promise<boolean>; /** * List all `Table`s by name. */ list(): Promise<string[]>; /** * Open a `Table`. */ open(table: string, cacheQueryOptions?: CacheQueryOptions): Promise<Table>; } /** * An error returned in rejected promises if the given key is not found in the table. */ export class NotFound { constructor( public table: string, public key: string, ) {} }
{ "end_byte": 1478, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/src/database.ts" }
angular/packages/service-worker/worker/src/service-worker.d.ts_0_504
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ /// <reference lib="webworker" /> export declare global { interface ServiceWorkerGlobalScope { /** * Disallow accessing `CacheStorage APIs directly to ensure that all accesses go through a * `NamedCacheStorage` instance (exposed by the `Adapter`). */ caches: unknown; } }
{ "end_byte": 504, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/src/service-worker.d.ts" }
angular/packages/service-worker/worker/src/adapter.ts_0_3247
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {NormalizedUrl} from './api'; import {NamedCacheStorage} from './named-cache-storage'; /** * Adapts the service worker to its runtime environment. * * Mostly, this is used to mock out identifiers which are otherwise read * from the global scope. */ export class Adapter<T extends CacheStorage = CacheStorage> { readonly caches: NamedCacheStorage<T>; readonly origin: string; constructor( protected readonly scopeUrl: string, caches: T, ) { const parsedScopeUrl = this.parseUrl(this.scopeUrl); // Determine the origin from the registration scope. This is used to differentiate between // relative and absolute URLs. this.origin = parsedScopeUrl.origin; // Use the baseHref in the cache name prefix to avoid clash of cache names for SWs with // different scopes on the same domain. this.caches = new NamedCacheStorage(caches, `ngsw:${parsedScopeUrl.path}`); } /** * Wrapper around the `Request` constructor. */ newRequest(input: string | Request, init?: RequestInit): Request { return new Request(input, init); } /** * Wrapper around the `Response` constructor. */ newResponse(body: any, init?: ResponseInit) { return new Response(body, init); } /** * Wrapper around the `Headers` constructor. */ newHeaders(headers: {[name: string]: string}): Headers { return new Headers(headers); } /** * Test if a given object is an instance of `Client`. */ isClient(source: any): source is Client { return source instanceof Client; } /** * Read the current UNIX time in milliseconds. */ get time(): number { return Date.now(); } /** * Get a normalized representation of a URL such as those found in the ServiceWorker's `ngsw.json` * configuration. * * More specifically: * 1. Resolve the URL relative to the ServiceWorker's scope. * 2. If the URL is relative to the ServiceWorker's own origin, then only return the path part. * Otherwise, return the full URL. * * @param url The raw request URL. * @return A normalized representation of the URL. */ normalizeUrl(url: string): NormalizedUrl { // Check the URL's origin against the ServiceWorker's. const parsed = this.parseUrl(url, this.scopeUrl); return (parsed.origin === this.origin ? parsed.path : url) as NormalizedUrl; } /** * Parse a URL into its different parts, such as `origin`, `path` and `search`. */ parseUrl(url: string, relativeTo?: string): {origin: string; path: string; search: string} { // Workaround a Safari bug, see // https://github.com/angular/angular/issues/31061#issuecomment-503637978 const parsed = !relativeTo ? new URL(url) : new URL(url, relativeTo); return {origin: parsed.origin, path: parsed.pathname, search: parsed.search}; } /** * Wait for a given amount of time before completing a Promise. */ timeout(ms: number): Promise<void> { return new Promise<void>((resolve) => { setTimeout(() => resolve(), ms); }); } }
{ "end_byte": 3247, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/src/adapter.ts" }
angular/packages/service-worker/worker/src/manifest.ts_0_1265
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {sha1} from './sha1'; export type ManifestHash = string; export interface Manifest { configVersion: number; timestamp: number; appData?: {[key: string]: string}; index: string; assetGroups?: AssetGroupConfig[]; dataGroups?: DataGroupConfig[]; navigationUrls: {positive: boolean; regex: string}[]; navigationRequestStrategy: 'freshness' | 'performance'; applicationMaxAge?: number; hashTable: {[url: string]: string}; } export interface AssetGroupConfig { name: string; installMode: 'prefetch' | 'lazy'; updateMode: 'prefetch' | 'lazy'; urls: string[]; patterns: string[]; cacheQueryOptions?: CacheQueryOptions; } export interface DataGroupConfig { name: string; version: number; strategy: 'freshness' | 'performance'; patterns: string[]; maxSize: number; maxAge: number; timeoutMs?: number; refreshAheadMs?: number; cacheOpaqueResponses?: boolean; cacheQueryOptions?: CacheQueryOptions; } export function hashManifest(manifest: Manifest): ManifestHash { return sha1(JSON.stringify(manifest)); }
{ "end_byte": 1265, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/src/manifest.ts" }
angular/packages/service-worker/worker/src/error.ts_0_579
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ export class SwCriticalError extends Error { readonly isCritical: boolean = true; } export function errorToString(error: any): string { if (error instanceof Error) { return `${error.message}\n${error.stack}`; } else { return `${error}`; } } export class SwUnrecoverableStateError extends SwCriticalError { readonly isUnrecoverableState: boolean = true; }
{ "end_byte": 579, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/src/error.ts" }
angular/packages/service-worker/worker/src/idle.ts_0_2653
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {Adapter} from './adapter'; import {DebugLogger} from './api'; export interface IdleTask { run: () => Promise<void>; desc: string; } interface ScheduledRun { cancel: boolean; } export class IdleScheduler { private queue: IdleTask[] = []; private scheduled: ScheduledRun | null = null; empty: Promise<void> = Promise.resolve(); private emptyResolve: Function | null = null; lastTrigger: number | null = null; lastRun: number | null = null; oldestScheduledAt: number | null = null; constructor( private adapter: Adapter, private delay: number, private maxDelay: number, private debug: DebugLogger, ) {} async trigger(): Promise<void> { this.lastTrigger = this.adapter.time; if (this.queue.length === 0) { return; } if (this.scheduled !== null) { this.scheduled.cancel = true; } const scheduled = { cancel: false, }; this.scheduled = scheduled; // Ensure that no task remains pending for longer than `this.maxDelay` ms. const now = this.adapter.time; const maxDelay = Math.max(0, (this.oldestScheduledAt ?? now) + this.maxDelay - now); const delay = Math.min(maxDelay, this.delay); await this.adapter.timeout(delay); if (scheduled.cancel) { return; } this.scheduled = null; await this.execute(); } async execute(): Promise<void> { this.lastRun = this.adapter.time; while (this.queue.length > 0) { const queue = this.queue; this.queue = []; await queue.reduce(async (previous, task) => { await previous; try { await task.run(); } catch (err) { this.debug.log(err as Error, `while running idle task ${task.desc}`); } }, Promise.resolve()); } if (this.emptyResolve !== null) { this.emptyResolve(); this.emptyResolve = null; } this.empty = Promise.resolve(); this.oldestScheduledAt = null; } schedule(desc: string, run: () => Promise<void>): void { this.queue.push({desc, run}); if (this.emptyResolve === null) { this.empty = new Promise((resolve) => { this.emptyResolve = resolve; }); } if (this.oldestScheduledAt === null) { this.oldestScheduledAt = this.adapter.time; } } get size(): number { return this.queue.length; } get taskDescriptions(): string[] { return this.queue.map((task) => task.desc); } }
{ "end_byte": 2653, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/worker/src/idle.ts" }
angular/packages/service-worker/src/push.ts_0_7731
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {Injectable} from '@angular/core'; import {merge, NEVER, Observable, Subject} from 'rxjs'; import {map, switchMap, take} from 'rxjs/operators'; import {ERR_SW_NOT_SUPPORTED, NgswCommChannel, PushEvent} from './low_level'; /** * Subscribe and listen to * [Web Push * Notifications](https://developer.mozilla.org/en-US/docs/Web/API/Push_API/Best_Practices) through * Angular Service Worker. * * @usageNotes * * You can inject a `SwPush` instance into any component or service * as a dependency. * * <code-example path="service-worker/push/module.ts" region="inject-sw-push" * header="app.component.ts"></code-example> * * To subscribe, call `SwPush.requestSubscription()`, which asks the user for permission. * The call returns a `Promise` with a new * [`PushSubscription`](https://developer.mozilla.org/en-US/docs/Web/API/PushSubscription) * instance. * * <code-example path="service-worker/push/module.ts" region="subscribe-to-push" * header="app.component.ts"></code-example> * * A request is rejected if the user denies permission, or if the browser * blocks or does not support the Push API or ServiceWorkers. * Check `SwPush.isEnabled` to confirm status. * * Invoke Push Notifications by pushing a message with the following payload. * * ```ts * { * "notification": { * "actions": NotificationAction[], * "badge": USVString, * "body": DOMString, * "data": any, * "dir": "auto"|"ltr"|"rtl", * "icon": USVString, * "image": USVString, * "lang": DOMString, * "renotify": boolean, * "requireInteraction": boolean, * "silent": boolean, * "tag": DOMString, * "timestamp": DOMTimeStamp, * "title": DOMString, * "vibrate": number[] * } * } * ``` * * Only `title` is required. See `Notification` * [instance * properties](https://developer.mozilla.org/en-US/docs/Web/API/Notification#Instance_properties). * * While the subscription is active, Service Worker listens for * [PushEvent](https://developer.mozilla.org/en-US/docs/Web/API/PushEvent) * occurrences and creates * [Notification](https://developer.mozilla.org/en-US/docs/Web/API/Notification) * instances in response. * * Unsubscribe using `SwPush.unsubscribe()`. * * An application can subscribe to `SwPush.notificationClicks` observable to be notified when a user * clicks on a notification. For example: * * <code-example path="service-worker/push/module.ts" region="subscribe-to-notification-clicks" * header="app.component.ts"></code-example> * * You can read more on handling notification clicks in the [Service worker notifications * guide](ecosystem/service-workers/push-notifications). * * @see [Push Notifications](https://developers.google.com/web/fundamentals/codelabs/push-notifications/) * @see [Angular Push Notifications](https://blog.angular-university.io/angular-push-notifications/) * @see [MDN: Push API](https://developer.mozilla.org/en-US/docs/Web/API/Push_API) * @see [MDN: Notifications API](https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API) * @see [MDN: Web Push API Notifications best practices](https://developer.mozilla.org/en-US/docs/Web/API/Push_API/Best_Practices) * * @publicApi */ @Injectable() export class SwPush { /** * Emits the payloads of the received push notification messages. */ readonly messages: Observable<object>; /** * Emits the payloads of the received push notification messages as well as the action the user * interacted with. If no action was used the `action` property contains an empty string `''`. * * Note that the `notification` property does **not** contain a * [Notification][Mozilla Notification] object but rather a * [NotificationOptions](https://notifications.spec.whatwg.org/#dictdef-notificationoptions) * object that also includes the `title` of the [Notification][Mozilla Notification] object. * * [Mozilla Notification]: https://developer.mozilla.org/en-US/docs/Web/API/Notification */ readonly notificationClicks: Observable<{ action: string; notification: NotificationOptions & { title: string; }; }>; /** * Emits the currently active * [PushSubscription](https://developer.mozilla.org/en-US/docs/Web/API/PushSubscription) * associated to the Service Worker registration or `null` if there is no subscription. */ readonly subscription: Observable<PushSubscription | null>; /** * True if the Service Worker is enabled (supported by the browser and enabled via * `ServiceWorkerModule`). */ get isEnabled(): boolean { return this.sw.isEnabled; } private pushManager: Observable<PushManager> | null = null; private subscriptionChanges = new Subject<PushSubscription | null>(); constructor(private sw: NgswCommChannel) { if (!sw.isEnabled) { this.messages = NEVER; this.notificationClicks = NEVER; this.subscription = NEVER; return; } this.messages = this.sw.eventsOfType<PushEvent>('PUSH').pipe(map((message) => message.data)); this.notificationClicks = this.sw .eventsOfType('NOTIFICATION_CLICK') .pipe(map((message: any) => message.data)); this.pushManager = this.sw.registration.pipe(map((registration) => registration.pushManager)); const workerDrivenSubscriptions = this.pushManager.pipe( switchMap((pm) => pm.getSubscription()), ); this.subscription = merge(workerDrivenSubscriptions, this.subscriptionChanges); } /** * Subscribes to Web Push Notifications, * after requesting and receiving user permission. * * @param options An object containing the `serverPublicKey` string. * @returns A Promise that resolves to the new subscription object. */ requestSubscription(options: {serverPublicKey: string}): Promise<PushSubscription> { if (!this.sw.isEnabled || this.pushManager === null) { return Promise.reject(new Error(ERR_SW_NOT_SUPPORTED)); } const pushOptions: PushSubscriptionOptionsInit = {userVisibleOnly: true}; let key = this.decodeBase64(options.serverPublicKey.replace(/_/g, '/').replace(/-/g, '+')); let applicationServerKey = new Uint8Array(new ArrayBuffer(key.length)); for (let i = 0; i < key.length; i++) { applicationServerKey[i] = key.charCodeAt(i); } pushOptions.applicationServerKey = applicationServerKey; return this.pushManager .pipe( switchMap((pm) => pm.subscribe(pushOptions)), take(1), ) .toPromise() .then((sub) => { this.subscriptionChanges.next(sub!); return sub!; }); } /** * Unsubscribes from Service Worker push notifications. * * @returns A Promise that is resolved when the operation succeeds, or is rejected if there is no * active subscription or the unsubscribe operation fails. */ unsubscribe(): Promise<void> { if (!this.sw.isEnabled) { return Promise.reject(new Error(ERR_SW_NOT_SUPPORTED)); } const doUnsubscribe = (sub: PushSubscription | null) => { if (sub === null) { throw new Error('Not subscribed to push notifications.'); } return sub.unsubscribe().then((success) => { if (!success) { throw new Error('Unsubscribe failed!'); } this.subscriptionChanges.next(null); }); }; return this.subscription.pipe(take(1), switchMap(doUnsubscribe)).toPromise(); } private decodeBase64(input: string): string { return atob(input); } }
{ "end_byte": 7731, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/src/push.ts" }
angular/packages/service-worker/src/module.ts_0_1015
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {ModuleWithProviders, NgModule} from '@angular/core'; import {provideServiceWorker, SwRegistrationOptions} from './provider'; import {SwPush} from './push'; import {SwUpdate} from './update'; /** * @publicApi */ @NgModule({providers: [SwPush, SwUpdate]}) export class ServiceWorkerModule { /** * Register the given Angular Service Worker script. * * If `enabled` is set to `false` in the given options, the module will behave as if service * workers are not supported by the browser, and the service worker will not be registered. */ static register( script: string, options: SwRegistrationOptions = {}, ): ModuleWithProviders<ServiceWorkerModule> { return { ngModule: ServiceWorkerModule, providers: [provideServiceWorker(script, options)], }; } }
{ "end_byte": 1015, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/src/module.ts" }
angular/packages/service-worker/src/low_level.ts_0_6811
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {concat, ConnectableObservable, defer, fromEvent, Observable, of, throwError} from 'rxjs'; import {filter, map, publish, switchMap, take, tap} from 'rxjs/operators'; export const ERR_SW_NOT_SUPPORTED = 'Service workers are disabled or not supported by this browser'; /** * An event emitted when the service worker has checked the version of the app on the server and it * didn't find a new version that it doesn't have already downloaded. * * @see {@link ecosystem/service-workers/communications Service worker communication guide} * * @publicApi */ export interface NoNewVersionDetectedEvent { type: 'NO_NEW_VERSION_DETECTED'; version: {hash: string; appData?: Object}; } /** * An event emitted when the service worker has detected a new version of the app on the server and * is about to start downloading it. * * @see {@link ecosystem/service-workers/communications Service worker communication guide} * * @publicApi */ export interface VersionDetectedEvent { type: 'VERSION_DETECTED'; version: {hash: string; appData?: object}; } /** * An event emitted when the installation of a new version failed. * It may be used for logging/monitoring purposes. * * @see {@link ecosystem/service-workers/communications Service worker communication guide} * * @publicApi */ export interface VersionInstallationFailedEvent { type: 'VERSION_INSTALLATION_FAILED'; version: {hash: string; appData?: object}; error: string; } /** * An event emitted when a new version of the app is available. * * @see {@link ecosystem/service-workers/communications Service worker communication guide} * * @publicApi */ export interface VersionReadyEvent { type: 'VERSION_READY'; currentVersion: {hash: string; appData?: object}; latestVersion: {hash: string; appData?: object}; } /** * A union of all event types that can be emitted by * {@link SwUpdate#versionUpdates}. * * @publicApi */ export type VersionEvent = | VersionDetectedEvent | VersionInstallationFailedEvent | VersionReadyEvent | NoNewVersionDetectedEvent; /** * An event emitted when the version of the app used by the service worker to serve this client is * in a broken state that cannot be recovered from and a full page reload is required. * * For example, the service worker may not be able to retrieve a required resource, neither from the * cache nor from the server. This could happen if a new version is deployed to the server and the * service worker cache has been partially cleaned by the browser, removing some files of a previous * app version but not all. * * @see {@link ecosystem/service-workers/communications Service worker communication guide} * * @publicApi */ export interface UnrecoverableStateEvent { type: 'UNRECOVERABLE_STATE'; reason: string; } /** * An event emitted when a `PushEvent` is received by the service worker. */ export interface PushEvent { type: 'PUSH'; data: any; } export type IncomingEvent = UnrecoverableStateEvent | VersionEvent; export interface TypedEvent { type: string; } type OperationCompletedEvent = | { type: 'OPERATION_COMPLETED'; nonce: number; result: boolean; } | { type: 'OPERATION_COMPLETED'; nonce: number; result?: undefined; error: string; }; function errorObservable(message: string): Observable<any> { return defer(() => throwError(new Error(message))); } /** * @publicApi */ export class NgswCommChannel { readonly worker: Observable<ServiceWorker>; readonly registration: Observable<ServiceWorkerRegistration>; readonly events: Observable<TypedEvent>; constructor(private serviceWorker: ServiceWorkerContainer | undefined) { if (!serviceWorker) { this.worker = this.events = this.registration = errorObservable(ERR_SW_NOT_SUPPORTED); } else { const controllerChangeEvents = fromEvent(serviceWorker, 'controllerchange'); const controllerChanges = controllerChangeEvents.pipe(map(() => serviceWorker.controller)); const currentController = defer(() => of(serviceWorker.controller)); const controllerWithChanges = concat(currentController, controllerChanges); this.worker = controllerWithChanges.pipe(filter((c): c is ServiceWorker => !!c)); this.registration = <Observable<ServiceWorkerRegistration>>( this.worker.pipe(switchMap(() => serviceWorker.getRegistration())) ); const rawEvents = fromEvent<MessageEvent>(serviceWorker, 'message'); const rawEventPayload = rawEvents.pipe(map((event) => event.data)); const eventsUnconnected = rawEventPayload.pipe(filter((event) => event && event.type)); const events = eventsUnconnected.pipe(publish()) as ConnectableObservable<IncomingEvent>; events.connect(); this.events = events; } } postMessage(action: string, payload: Object): Promise<void> { return this.worker .pipe( take(1), tap((sw: ServiceWorker) => { sw.postMessage({ action, ...payload, }); }), ) .toPromise() .then(() => undefined); } postMessageWithOperation( type: string, payload: Object, operationNonce: number, ): Promise<boolean> { const waitForOperationCompleted = this.waitForOperationCompleted(operationNonce); const postMessage = this.postMessage(type, payload); return Promise.all([postMessage, waitForOperationCompleted]).then(([, result]) => result); } generateNonce(): number { return Math.round(Math.random() * 10000000); } eventsOfType<T extends TypedEvent>(type: T['type'] | T['type'][]): Observable<T> { let filterFn: (event: TypedEvent) => event is T; if (typeof type === 'string') { filterFn = (event: TypedEvent): event is T => event.type === type; } else { filterFn = (event: TypedEvent): event is T => type.includes(event.type); } return this.events.pipe(filter(filterFn)); } nextEventOfType<T extends TypedEvent>(type: T['type']): Observable<T> { return this.eventsOfType(type).pipe(take(1)); } waitForOperationCompleted(nonce: number): Promise<boolean> { return this.eventsOfType<OperationCompletedEvent>('OPERATION_COMPLETED') .pipe( filter((event) => event.nonce === nonce), take(1), map((event) => { if (event.result !== undefined) { return event.result; } throw new Error(event.error!); }), ) .toPromise() as Promise<boolean>; } get isEnabled(): boolean { return !!this.serviceWorker; } }
{ "end_byte": 6811, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/src/low_level.ts" }
angular/packages/service-worker/src/index.ts_0_570
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ export { NoNewVersionDetectedEvent, UnrecoverableStateEvent, VersionDetectedEvent, VersionEvent, VersionInstallationFailedEvent, VersionReadyEvent, } from './low_level'; export {ServiceWorkerModule} from './module'; export {provideServiceWorker, SwRegistrationOptions} from './provider'; export {SwPush} from './push'; export {SwUpdate} from './update';
{ "end_byte": 570, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/src/index.ts" }
angular/packages/service-worker/src/provider.ts_0_7830
/*! * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {isPlatformBrowser} from '@angular/common'; import { APP_INITIALIZER, ApplicationRef, EnvironmentProviders, InjectionToken, Injector, makeEnvironmentProviders, NgZone, PLATFORM_ID, } from '@angular/core'; import {merge, from, Observable, of} from 'rxjs'; import {delay, take} from 'rxjs/operators'; import {NgswCommChannel} from './low_level'; import {SwPush} from './push'; import {SwUpdate} from './update'; export const SCRIPT = new InjectionToken<string>(ngDevMode ? 'NGSW_REGISTER_SCRIPT' : ''); export function ngswAppInitializer( injector: Injector, script: string, options: SwRegistrationOptions, platformId: string, ): Function { return () => { if ( !(isPlatformBrowser(platformId) && 'serviceWorker' in navigator && options.enabled !== false) ) { return; } const ngZone = injector.get(NgZone); const appRef = injector.get(ApplicationRef); // Set up the `controllerchange` event listener outside of // the Angular zone to avoid unnecessary change detections, // as this event has no impact on view updates. ngZone.runOutsideAngular(() => { // Wait for service worker controller changes, and fire an INITIALIZE action when a new SW // becomes active. This allows the SW to initialize itself even if there is no application // traffic. const sw = navigator.serviceWorker; const onControllerChange = () => sw.controller?.postMessage({action: 'INITIALIZE'}); sw.addEventListener('controllerchange', onControllerChange); appRef.onDestroy(() => { sw.removeEventListener('controllerchange', onControllerChange); }); }); let readyToRegister$: Observable<unknown>; if (typeof options.registrationStrategy === 'function') { readyToRegister$ = options.registrationStrategy(); } else { const [strategy, ...args] = ( options.registrationStrategy || 'registerWhenStable:30000' ).split(':'); switch (strategy) { case 'registerImmediately': readyToRegister$ = of(null); break; case 'registerWithDelay': readyToRegister$ = delayWithTimeout(+args[0] || 0); break; case 'registerWhenStable': const whenStable$ = from(injector.get(ApplicationRef).whenStable()); readyToRegister$ = !args[0] ? whenStable$ : merge(whenStable$, delayWithTimeout(+args[0])); break; default: // Unknown strategy. throw new Error( `Unknown ServiceWorker registration strategy: ${options.registrationStrategy}`, ); } } // Don't return anything to avoid blocking the application until the SW is registered. // Also, run outside the Angular zone to avoid preventing the app from stabilizing (especially // given that some registration strategies wait for the app to stabilize). // Catch and log the error if SW registration fails to avoid uncaught rejection warning. ngZone.runOutsideAngular(() => readyToRegister$ .pipe(take(1)) .subscribe(() => navigator.serviceWorker .register(script, {scope: options.scope}) .catch((err) => console.error('Service worker registration failed with:', err)), ), ); }; } function delayWithTimeout(timeout: number): Observable<unknown> { return of(null).pipe(delay(timeout)); } export function ngswCommChannelFactory( opts: SwRegistrationOptions, platformId: string, ): NgswCommChannel { return new NgswCommChannel( isPlatformBrowser(platformId) && opts.enabled !== false ? navigator.serviceWorker : undefined, ); } /** * Token that can be used to provide options for `ServiceWorkerModule` outside of * `ServiceWorkerModule.register()`. * * You can use this token to define a provider that generates the registration options at runtime, * for example via a function call: * * {@example service-worker/registration-options/module.ts region="registration-options" * header="app.module.ts"} * * @publicApi */ export abstract class SwRegistrationOptions { /** * Whether the ServiceWorker will be registered and the related services (such as `SwPush` and * `SwUpdate`) will attempt to communicate and interact with it. * * Default: true */ enabled?: boolean; /** * A URL that defines the ServiceWorker's registration scope; that is, what range of URLs it can * control. It will be used when calling * [ServiceWorkerContainer#register()](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register). */ scope?: string; /** * Defines the ServiceWorker registration strategy, which determines when it will be registered * with the browser. * * The default behavior of registering once the application stabilizes (i.e. as soon as there are * no pending micro- and macro-tasks) is designed to register the ServiceWorker as soon as * possible but without affecting the application's first time load. * * Still, there might be cases where you want more control over when the ServiceWorker is * registered (for example, there might be a long-running timeout or polling interval, preventing * the app from stabilizing). The available option are: * * - `registerWhenStable:<timeout>`: Register as soon as the application stabilizes (no pending * micro-/macro-tasks) but no later than `<timeout>` milliseconds. If the app hasn't * stabilized after `<timeout>` milliseconds (for example, due to a recurrent asynchronous * task), the ServiceWorker will be registered anyway. * If `<timeout>` is omitted, the ServiceWorker will only be registered once the app * stabilizes. * - `registerImmediately`: Register immediately. * - `registerWithDelay:<timeout>`: Register with a delay of `<timeout>` milliseconds. For * example, use `registerWithDelay:5000` to register the ServiceWorker after 5 seconds. If * `<timeout>` is omitted, is defaults to `0`, which will register the ServiceWorker as soon * as possible but still asynchronously, once all pending micro-tasks are completed. * - An Observable factory function: A function that returns an `Observable`. * The function will be used at runtime to obtain and subscribe to the `Observable` and the * ServiceWorker will be registered as soon as the first value is emitted. * * Default: 'registerWhenStable:30000' */ registrationStrategy?: string | (() => Observable<unknown>); } /** * @publicApi * * Sets up providers to register the given Angular Service Worker script. * * If `enabled` is set to `false` in the given options, the module will behave as if service * workers are not supported by the browser, and the service worker will not be registered. * * Example usage: * ```ts * bootstrapApplication(AppComponent, { * providers: [ * provideServiceWorker('ngsw-worker.js') * ], * }); * ``` */ export function provideServiceWorker( script: string, options: SwRegistrationOptions = {}, ): EnvironmentProviders { return makeEnvironmentProviders([ SwPush, SwUpdate, {provide: SCRIPT, useValue: script}, {provide: SwRegistrationOptions, useValue: options}, { provide: NgswCommChannel, useFactory: ngswCommChannelFactory, deps: [SwRegistrationOptions, PLATFORM_ID], }, { provide: APP_INITIALIZER, useFactory: ngswAppInitializer, deps: [Injector, SCRIPT, SwRegistrationOptions, PLATFORM_ID], multi: true, }, ]); }
{ "end_byte": 7830, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/src/provider.ts" }
angular/packages/service-worker/src/update.ts_0_3790
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {Injectable} from '@angular/core'; import {NEVER, Observable} from 'rxjs'; import { ERR_SW_NOT_SUPPORTED, NgswCommChannel, UnrecoverableStateEvent, VersionEvent, } from './low_level'; /** * Subscribe to update notifications from the Service Worker, trigger update * checks, and forcibly activate updates. * * @see {@link ecosystem/service-workers/communications Service worker communication guide} * * @publicApi */ @Injectable() export class SwUpdate { /** * Emits a `VersionDetectedEvent` event whenever a new version is detected on the server. * * Emits a `VersionInstallationFailedEvent` event whenever checking for or downloading a new * version fails. * * Emits a `VersionReadyEvent` event whenever a new version has been downloaded and is ready for * activation. */ readonly versionUpdates: Observable<VersionEvent>; /** * Emits an `UnrecoverableStateEvent` event whenever the version of the app used by the service * worker to serve this client is in a broken state that cannot be recovered from without a full * page reload. */ readonly unrecoverable: Observable<UnrecoverableStateEvent>; /** * True if the Service Worker is enabled (supported by the browser and enabled via * `ServiceWorkerModule`). */ get isEnabled(): boolean { return this.sw.isEnabled; } constructor(private sw: NgswCommChannel) { if (!sw.isEnabled) { this.versionUpdates = NEVER; this.unrecoverable = NEVER; return; } this.versionUpdates = this.sw.eventsOfType<VersionEvent>([ 'VERSION_DETECTED', 'VERSION_INSTALLATION_FAILED', 'VERSION_READY', 'NO_NEW_VERSION_DETECTED', ]); this.unrecoverable = this.sw.eventsOfType<UnrecoverableStateEvent>('UNRECOVERABLE_STATE'); } /** * Checks for an update and waits until the new version is downloaded from the server and ready * for activation. * * @returns a promise that * - resolves to `true` if a new version was found and is ready to be activated. * - resolves to `false` if no new version was found * - rejects if any error occurs */ checkForUpdate(): Promise<boolean> { if (!this.sw.isEnabled) { return Promise.reject(new Error(ERR_SW_NOT_SUPPORTED)); } const nonce = this.sw.generateNonce(); return this.sw.postMessageWithOperation('CHECK_FOR_UPDATES', {nonce}, nonce); } /** * Updates the current client (i.e. browser tab) to the latest version that is ready for * activation. * * In most cases, you should not use this method and instead should update a client by reloading * the page. * * <div class="alert is-important"> * * Updating a client without reloading can easily result in a broken application due to a version * mismatch between the application shell and other page resources, * such as lazy-loaded chunks, whose filenames may change between * versions. * * Only use this method, if you are certain it is safe for your specific use case. * * </div> * * @returns a promise that * - resolves to `true` if an update was activated successfully * - resolves to `false` if no update was available (for example, the client was already on the * latest version). * - rejects if any error occurs */ activateUpdate(): Promise<boolean> { if (!this.sw.isEnabled) { return Promise.reject(new Error(ERR_SW_NOT_SUPPORTED)); } const nonce = this.sw.generateNonce(); return this.sw.postMessageWithOperation('ACTIVATE_UPDATE', {nonce}, nonce); } }
{ "end_byte": 3790, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/service-worker/src/update.ts" }
angular/packages/zone.js/karma-dist-mocha.conf.js_0_780
module.exports = function (config) { require('./karma-dist.conf.js')(config); for (let i = 0; i < config.files.length; i++) { if (config.files[i] === 'dist/zone-testing.js') { config.files.splice(i, 1); break; } } config.files.push('dist/long-stack-trace-zone.js'); config.files.push('dist/proxy.js'); config.files.push('dist/sync-test.js'); config.files.push('dist/async-test.js'); config.files.push('dist/fake-async-test.js'); config.files.push('dist/zone-patch-promise-test.js'); config.plugins.push(require('karma-mocha')); config.frameworks.push('mocha'); config.client.mocha = { timeout: 5000, // copied timeout for Jasmine in WebSocket.spec (otherwise Mochas default timeout // at 2 sec is to low for the tests) }; };
{ "end_byte": 780, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/karma-dist-mocha.conf.js" }
angular/packages/zone.js/sauce.es2015.conf.js_0_1523
// Sauce configuration module.exports = function (config, ignoredLaunchers) { // The WS server is not available with Sauce config.files.unshift('test/saucelabs.js'); var basicLaunchers = { 'SL_CHROME_66': {base: 'SauceLabs', browserName: 'chrome', version: '66'}, }; var customLaunchers = {}; if (!ignoredLaunchers) { customLaunchers = basicLaunchers; } else { Object.keys(basicLaunchers).forEach(function (key) { if ( ignoredLaunchers.filter(function (ignore) { return ignore === key; }).length === 0 ) { customLaunchers[key] = basicLaunchers[key]; } }); } config.set({ captureTimeout: 120000, browserNoActivityTimeout: 240000, sauceLabs: { testName: 'Zone.js', startConnect: false, recordVideo: false, recordScreenshots: false, options: { 'selenium-version': '2.53.0', 'command-timeout': 600, 'idle-timeout': 600, 'max-duration': 5400, }, }, customLaunchers: customLaunchers, browsers: Object.keys(customLaunchers), reporters: ['dots', 'saucelabs'], singleRun: true, plugins: ['karma-*'], }); if (process.env.TRAVIS) { config.sauceLabs.build = 'TRAVIS #' + process.env.TRAVIS_BUILD_NUMBER + ' (' + process.env.TRAVIS_BUILD_ID + ')'; config.sauceLabs.tunnelIdentifier = process.env.TRAVIS_JOB_NUMBER; process.env.SAUCE_ACCESS_KEY = process.env.SAUCE_ACCESS_KEY.split('').reverse().join(''); } };
{ "end_byte": 1523, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/sauce.es2015.conf.js" }
angular/packages/zone.js/karma-dist-sauce-jasmine.conf.js_0_343
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ module.exports = function (config) { require('./karma-dist-jasmine.conf.js')(config); require('./sauce.conf')(config, ['SL_IOS9']); };
{ "end_byte": 343, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/karma-dist-sauce-jasmine.conf.js" }
angular/packages/zone.js/karma-evergreen-dist.conf.js_0_1152
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ module.exports = function (config) { require('./karma-base.conf.js')(config); config.files.push('build/test/browser-env-setup.js'); config.files.push('build/test/wtf_mock.js'); config.files.push('build/test/test_fake_polyfill.js'); config.files.push('build/test/custom_error.js'); config.files.push({pattern: 'dist/zone-evergreen.js', type: 'module'}); config.files.push('dist/zone-patch-canvas.js'); config.files.push('dist/zone-patch-fetch.js'); config.files.push('dist/webapis-media-query.js'); config.files.push('dist/webapis-notification.js'); config.files.push('dist/zone-patch-user-media.js'); config.files.push('dist/zone-patch-resize-observer.js'); config.files.push('dist/task-tracking.js'); config.files.push('dist/wtf.js'); config.files.push('dist/zone-testing.js'); config.files.push({pattern: 'build/test/browser/custom-element.spec.js', type: 'module'}); config.files.push('build/test/main.js'); };
{ "end_byte": 1152, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/karma-evergreen-dist.conf.js" }
angular/packages/zone.js/SAMPLE.md_0_704
# Sample ### Basic Sample use `zone.js` and `long-stack-trace-zone.js` to display longStackTrace information in html. [basic](https://stackblitz.com/edit/zonejs-basic?file=index.js) ### Async Task Counting Sample use `zone.js` to monitor async tasks and print the count info. [counting](https://stackblitz.com/edit/zonejs-counting?file=index.js) ### Profiling Sample use `zone.js` to profiling sort algorithm. [profiling](https://stackblitz.com/edit/zonejs-profiling?file=index.js) ### Throttle with longStackTrace use `long-stack-trace-zone` to display full flow of complex async operations such as throttle XHR requests. [throttle](https://stackblitz.com/edit/zonejs-throttle?file=index.js)
{ "end_byte": 704, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/SAMPLE.md" }
angular/packages/zone.js/NON-STANDARD-APIS.md_0_6824
# Zone.js's support for non standard apis Zone.js patched most standard APIs such as DOM event listeners, XMLHttpRequest in Browser, EventEmitter and fs API in Node.js so they can be in zone. But there are still a lot of non-standard APIs that are not patched by default, such as MediaQuery, Notification, WebAudio and so on. This page provides updates on the current state of zone support for Angular APIs. ## Currently supported non-standard Web APIs * MediaQuery * Notification ## Currently supported polyfills * webcomponents Usage: ``` <script src="webcomponents-lite.js"></script> <script src="node_modules/zone.js/bundles/zone.umd.js"></script> <script src="node_modules/zone.js/bundles/webapis-shadydom.umd.js"></script> ``` ## Currently supported non standard node APIs ## Currently supported non standard common APIs * [Bluebird](http://bluebirdjs.com/docs/getting-started.html) Promise Browser Usage: ``` <script src="zone.js"></script> <script src="bluebird.js"></script> <script src="zone-bluebird.js"></script> <script> Zone[Zone['__symbol__']('bluebird')](Promise); </script> ``` After those steps, window.Promise becomes Bluebird Promise and will also be zone awareness. Angular Usage: in polyfills.ts, import the `zone-bluebird` package. ``` import 'zone.js'; // Included with Angular CLI. import 'zone.js/plugins/zone-bluebird'; ``` in main.ts, patch bluebird. ``` platformBrowserDynamic() .bootstrapModule(AppModule) .then(_ => { import('bluebird').then(Bluebird => {const Zone = (window as any)['Zone']; Zone[Zone['__symbol__']('bluebird')](Bluebird.default);}); }) .catch(err => console.error(err)); ``` After this step, the `window.Promise` will be the Bluebird `Promise`, and the callback of `Bluebird.then` will be executed in the Angular zone. Node Sample Usage: ``` require('zone.js'); const Bluebird = require('bluebird'); require('zone.js/plugins/zone-bluebird'); Zone[Zone['__symbol__']('bluebird')](Bluebird); Zone.current.fork({ name: 'bluebird' }).run(() => { Bluebird.resolve(1).then(r => { console.log('result ', r, 'Zone', Zone.current.name); }); }); ``` In NodeJS environment, you can choose to use Bluebird Promise as global.Promise or use ZoneAwarePromise as global.Promise. To run the jasmine test cases of bluebird ``` npm install bluebird ``` then modify test/node_tests.ts remove the comment of the following line ``` //import './extra/bluebird.spec'; ``` ## Others * Cordova patch `cordova.exec` API `cordova.exec(success, error, service, action, args);` `success` and `error` will be patched with `Zone.wrap`. to load the patch, you should load in the following order. ``` <script src="zone.js"></script> <script src="cordova.js"></script> <script src="zone-patch-cordova.js"></script> ``` ## Usage By default, those APIs' support will not be loaded in zone.js or zone-node.js, so if you want to load those API's support, you should load those files by yourself. For example, if you want to add MediaQuery patch, you should do like this: ``` <script src="path/zone.js"></script> <script src="path/webapis-media-query.js"></script> ``` * rxjs `zone.js` also provide a `rxjs` patch to make sure rxjs Observable/Subscription/Operator run in correct zone. For details please refer to [pull request 843](https://github.com/angular/zone.js/pull/843). The following sample code describes the idea. ``` const constructorZone = Zone.current.fork({name: 'constructor'}); const subscriptionZone = Zone.current.fork({name: 'subscription'}); const operatorZone = Zone.current.fork({name: 'operator'}); let observable; let subscriber; constructorZone.run(() => { observable = new Observable((_subscriber) => { subscriber = _subscriber; console.log('current zone when construct observable:', Zone.current.name); // will output constructor. return () => { console.log('current zone when unsubscribe observable:', Zone.current.name); // will output constructor. } }); }); subscriptionZone.run(() => { observable.subscribe(() => { console.log('current zone when subscription next', Zone.current.name); // will output subscription. }, () => { console.log('current zone when subscription error', Zone.current.name); // will output subscription. }, () => { console.log('current zone when subscription complete', Zone.current.name); // will output subscription. }); }); operatorZone.run(() => { observable.map(() => { console.log('current zone when map operator', Zone.current.name); // will output operator. }); }); ``` Currently basically everything the `rxjs` API includes - Observable - Subscription - Subscriber - Operators - Scheduler is patched, so each asynchronous call will run in the correct zone. ## Usage. For example, in an Angular application, you can load this patch in your `app.module.ts`. ``` import 'zone.js/plugins/zone-patch-rxjs'; ``` * electron In electron, we patched the following APIs with `zone.js` 1. Browser API 2. NodeJS 3. Electron Native API ## Usage. add following line into `polyfill.ts` after loading zone-mix. ``` //import 'zone.js'; // originally added by angular-cli, comment it out import 'zone.js/mix'; // add zone-mix to patch both Browser and Nodejs import 'zone.js/plugins/zone-patch-electron'; // add zone-patch-electron to patch Electron native API ``` there is a sample repo [zone-electron](https://github.com/JiaLiPassion/zone-electron). * socket.io-client user need to patch `io` themselves just like following code. ```javascript <script src="socket.io-client/dist/socket.io.js"></script> <script src="zone.js/bundles/zone.umd.js"></script> <script src="zone.js/bundles/zone-patch-socket-io.js"></script> <script> // patch io here Zone[Zone.__symbol__('socketio')](io); </script> ``` please reference the sample repo [zone-socketio](https://github.com/JiaLiPassion/zone-socketio) about detail usage. * jsonp ## Usage. provide a helper method to patch jsonp. Because jsonp has a lot of implementation, so user need to provide the information to let json `send` and `callback` in zone. there is a sample repo [zone-jsonp](https://github.com/JiaLiPassion/test-zone-js-with-jsonp) here, sample usage is: ```javascript import 'zone.js/plugins/zone-patch-jsonp'; Zone['__zone_symbol__jsonp']({ jsonp: getJSONP, sendFuncName: 'send', successFuncName: 'jsonpSuccessCallback', failedFuncName: 'jsonpFailedCallback' }); ``` * ResizeObserver Currently only `Chrome 64` native support this feature. you can add the following line into `polyfill.ts` after loading `zone.js`. ``` import 'zone.js'; import 'zone.js/plugins/zone-patch-resize-observer'; ``` there is a sample repo [zone-resize-observer](https://github.com/JiaLiPassion/zone-resize-observer) here
{ "end_byte": 6824, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/NON-STANDARD-APIS.md" }
angular/packages/zone.js/karma-build-jasmine.es2015.conf.js_0_151
module.exports = function (config) { require('./karma-build-jasmine.conf.js')(config); config.client.entrypoint = 'browser_es2015_entry_point'; };
{ "end_byte": 151, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/karma-build-jasmine.es2015.conf.js" }
angular/packages/zone.js/karma-build-sauce-selenium3-mocha.conf.js_0_338
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ module.exports = function (config) { require('./karma-dist-mocha.conf.js')(config); require('./sauce-selenium3.conf')(config); };
{ "end_byte": 338, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/karma-build-sauce-selenium3-mocha.conf.js" }
angular/packages/zone.js/CHANGELOG.md_0_5549
# [0.15.0](https://github.com/angular/angular/compare/zone.js-0.14.10...zone.js-0.15.0) (2024-08-15) ### Bug Fixes * **zone.js:** Add support for addition jest functions. ([#57280](https://github.com/angular/angular/issues/57280)) ([e1240c6](https://github.com/angular/angular/commit/e1240c6f5d9a3d68ccef7ffbf0a0646ad1164cd8)), closes [#57277](https://github.com/angular/angular/issues/57277) * **zone.js:** Update the default behavior of fakeAsync to flush after the test ([#57240](https://github.com/angular/angular/issues/57240)) ([70e8b40](https://github.com/angular/angular/commit/70e8b40750e894bc1439713cd508d8bd9fafb7a4)) ### BREAKING CHANGES * **zone.js:** `fakeAsync` will now flush pending timers at the end of the given function by default. To opt-out of this, you can use `{flush: false}` in options parameter of `fakeAsync` ## [0.14.10](https://github.com/angular/angular/compare/zone.js-0.14.8...zone.js-0.14.10) (2024-08-05) ### Features * **zone.js:** Add 'flush' parameter option to fakeAsync to flush after the test ([#57137](https://github.com/angular/angular/issues/57137)) ([99d679d](https://github.com/angular/angular/commit/99d679d6061d731a04930824e92f247bb94f21e7)) ## [0.14.8](https://github.com/angular/angular/compare/zone.js-0.14.7...zone.js-0.14.8) (2024-07-17) ### Bug Fixes * **zone.js:** allow enabling default `beforeunload` handling ([#55875](https://github.com/angular/angular/issues/55875)) ([b8d5882](https://github.com/angular/angular/commit/b8d5882127a6e9944d30a7e0c87c2e2c59b352e6)), closes [#47579](https://github.com/angular/angular/issues/47579) * **zone.js:** support `Timeout.refresh` in Node.js ([#56852](https://github.com/angular/angular/issues/56852)) ([982f1b1](https://github.com/angular/angular/commit/982f1b125147e4292716f9524bef75423b70c71c)), closes [#56586](https://github.com/angular/angular/issues/56586) ## [0.14.7](https://github.com/angular/angular/compare/zone.js-0.14.6...zone.js-0.14.7) (2024-06-06) ### Bug Fixes * **zone.js:** do not mutate event listener options (may be readonly) ([#55796](https://github.com/angular/angular/issues/55796)) ([85c1719](https://github.com/angular/angular/commit/85c171920ae2b1861896fa6c2d5d7dc8f030a445)), closes [#54142](https://github.com/angular/angular/issues/54142) * **zone.js:** store remove abort listener on the scheduled task ([#56160](https://github.com/angular/angular/issues/56160)) ([4a3800a](https://github.com/angular/angular/commit/4a3800a6a0ae9d667dd961c6e4029c01c6819988)), closes [#56148](https://github.com/angular/angular/issues/56148) ## [0.14.6](https://github.com/angular/angular/compare/zone.js-0.14.4...zone.js-0.14.6) (2024-05-16) ### Bug Fixes * **zone.js:** add missing APIs to Node.js `fs` patch ([#54396](https://github.com/angular/angular/issues/54396)) ([9e07b62](https://github.com/angular/angular/commit/9e07b621ead050d27d36cde0549b01ac3f1e9e73)) * **zone.js:** correctly bundle `zone-patch-rxjs` ([#55826](https://github.com/angular/angular/issues/55826)) ([20a530a](https://github.com/angular/angular/commit/20a530acb6ca6efe73cb97c64e9d23a0f5d912c8)), closes [#55825](https://github.com/angular/angular/issues/55825) * **zone.js:** remove `abort` listener on a signal when actual event is removed ([#55339](https://github.com/angular/angular/issues/55339)) ([a9460d0](https://github.com/angular/angular/commit/a9460d08a0e95dcd8fcd0ea7eca8470af921bfe2)), closes [#54739](https://github.com/angular/angular/issues/54739) ## [0.14.5](https://github.com/angular/angular/compare/zone.js-0.14.4...zone.js-0.14.5) (2024-04-30) ### Bug Fixes * **zone.js:** Add 'declare' to each interface to prevent renaming ([#54966](https://github.com/angular/angular/issues/54966)) ([b3d045b](https://github.com/angular/angular/commit/b3d045b9a4383d97ea3c5d770d9413ffed35d760)) * **zone.js:** make sure fakeasync use the same id pool with native ([#54600](https://github.com/angular/angular/issues/54600)) ([ddbf6bb](https://github.com/angular/angular/commit/ddbf6bb038d101daf5280abbd2a0efaa0b7fd3a0)), closes [#54323](https://github.com/angular/angular/issues/54323) * **zone.js:** should not clear onhandler when remove capture listener ([#54602](https://github.com/angular/angular/issues/54602)) ([e44b077](https://github.com/angular/angular/commit/e44b077cbd4fc1ac16b3edd0fea758842ce6e29f)), closes [#54581](https://github.com/angular/angular/issues/54581) ## [0.14.4](https://github.com/angular/angular/compare/zone.js-0.14.3...zone.js-0.14.4) (2024-02-13) ### Bug Fixes * **zone.js:** add `__Zone_ignore_on_properties` to `ZoneGlobalConfigurations` ([#50737](https://github.com/angular/angular/issues/50737)) ([f87f058](https://github.com/angular/angular/commit/f87f058a69443d9427530c979b39e3630190a7fd)) * **zone.js:** patch `fs.realpath.native` as macrotask ([#54208](https://github.com/angular/angular/issues/54208)) ([19fae76](https://github.com/angular/angular/commit/19fae76bada7146e8993fb672b8d321fb08967f2)), closes [#45546](https://github.com/angular/angular/issues/45546) * **zone.js:** patch `Response` methods returned by `fetch` ([#50653](https://github.com/angular/angular/issues/50653)) ([260d3ed](https://github.com/angular/angular/commit/260d3ed0d91648d3ba75d7d9896f38195093c7e4)), closes [#50327](https://github.com/angular/angular/issues/50327) * **zone.js:** patch form-associated custom element callbacks ([#50686](https://github.com/angular/angular/issues/50686)) ([1c990cd](https://github.com/angular/angular/commit/1c990cdb2962fa879762d5e26f87f547a00e1795))
{ "end_byte": 5549, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/CHANGELOG.md" }
angular/packages/zone.js/CHANGELOG.md_5549_10851
## [0.14.3](https://github.com/angular/angular/compare/zone.js-0.14.2...zone.js-0.14.3) (2023-12-19) ### Bug Fixes * **zone.js:** handle fetch with AbortSignal ([#49595](https://github.com/angular/angular/issues/49595)) ([b06b24b](https://github.com/angular/angular/commit/b06b24b5049c07fbc18c76fd2a10e49fc93870be)) * **zone.js:** Promise.resolve(subPromise) should return subPromise ([#53423](https://github.com/angular/angular/issues/53423)) ([08b0c87](https://github.com/angular/angular/commit/08b0c87a948007e086a2c5a5c17ccca5fd7a24c4)), closes [/promisesaplus.com/#point-51](https://github.com//promisesaplus.com//issues/point-51) * **zone.js:** support addEventListener with signal option. ([#49595](https://github.com/angular/angular/issues/49595)) ([d4973ff](https://github.com/angular/angular/commit/d4973ff9b074f4db918f71163e79b7d112c309f5)), closes [#49591](https://github.com/angular/angular/issues/49591) ### Features * **zone.js:** implement Promise.withResolvers() ([#53514](https://github.com/angular/angular/issues/53514)) ([7a28f50](https://github.com/angular/angular/commit/7a28f50711535fcc285c7ee9021e8e7dc34a655d)) ## [0.14.2](https://github.com/angular/angular/compare/zone.js-0.14.1...zone.js-0.14.2) (2023-11-03) ### Bug Fixes * **zone.js:** disable wrapping unhandled promise error by default ([6d7eb35](https://github.com/angular/angular/commit/6d7eb3548c5fc3aedb4a52ff2010141343748e90)) ## [14.0.1](https://github.com/angular/angular/compare/zone.js-0.14.0...zone.js-14.0.1) (2023-10-25) ### Bug Fixes * **zone.js:** use `globalThis` instead of `global` and `window` ([#52367](https://github.com/angular/angular/issues/52367)) ([def719e](https://github.com/angular/angular/commit/def719e2cac50bbf1cda4a2c4bf96de2d4ba4bfd)) # [0.14.0](https://github.com/angular/angular/compare/zone.js-0.13.3...zone.js-0.14.0) (2023-09-14) ### Features * **zone.js:** remove legacy files and access to deep imports ([#51752](https://github.com/angular/angular/issues/51752)) ([a8efc60](https://github.com/angular/angular/commit/a8efc605ea9c3cf03d85b5c567218202e304fef9)) ### BREAKING CHANGES * **zone.js:** Deep and legacy `dist/` imports like `zone.js/bundles/zone-testing.js` and `zone.js/dist/zone` are no longer allowed. `zone-testing-bundle` and `zone-testing-node-bundle` are also no longer part of the package. The proper way to import `zone.js` and `zone.js/testing` is: ```js import 'zone.js'; import 'zone.js/testing'; ``` ## [0.13.3](https://github.com/angular/angular/compare/zone.js-0.13.2...zone.js-0.13.3) (2023-09-12) ### Bug Fixes * **zone.js:** rename `typings` conditional export to `types` ([#51737](https://github.com/angular/angular/issues/51737)) ([74755c4](https://github.com/angular/angular/commit/74755c4b5e6d4d62d2c81f35e6152bb8649fbb5c)) * **zone.js:** temporary allow deep imports ([#51737](https://github.com/angular/angular/issues/51737)) ([e86d6db](https://github.com/angular/angular/commit/e86d6dba27997cb2cad13c43ac5e94eeb7a67725)) ## [0.13.2](https://github.com/angular/angular/compare/zone.js-0.13.1...zone.js-0.13.2) (2023-09-07) ### Bug Fixes * **zone.js:** add conditional exports to zone.js package ([#51652](https://github.com/angular/angular/issues/51652)) ([4798ec4](https://github.com/angular/angular/commit/4798ec41668d47fd5e1504c61d96d5e56dcff345)) ## [v0.13.1](https://github.com/angular/angular/compare/zone.js-0.13.0...zone.js-v0.13.1) (2023-06-09) ### Bug Fixes * **zone.js:** enable monkey patching of the `queueMicrotask()` API in node.js ([#50467](https://github.com/angular/angular/issues/50467)) ([381cb98](https://github.com/angular/angular/commit/381cb982264d30e8c79e77e9186acd6da006e718)) * **zone.js:** enable monkey patching of the `queueMicrotask()` API in node.js ([#50530](https://github.com/angular/angular/issues/50530)) ([7837f71](https://github.com/angular/angular/commit/7837f7119f8cdfb0ae95551f48608f156985113a)) * **zone.js:** patch entire promise in node ([#50552](https://github.com/angular/angular/issues/50552)) ([cb31dbc](https://github.com/angular/angular/commit/cb31dbc75ca4141d61cec3ba6e60505198208a0a)), closes [#50513](https://github.com/angular/angular/issues/50513) [#50457](https://github.com/angular/angular/issues/50457) [#50414](https://github.com/angular/angular/issues/50414) [#49930](https://github.com/angular/angular/issues/49930) * **zone.js:** revert Mocha it.skip, describe.skip method patch ([#49329](https://github.com/angular/angular/issues/49329)) ([5a2b622](https://github.com/angular/angular/commit/5a2b6227b30a4d3f2090077e8881c753db00798c)) ### Features * **zone.js:** jest 29 should ignore uncaught error console log ([#49325](https://github.com/angular/angular/issues/49325)) ([bc412fd](https://github.com/angular/angular/commit/bc412fd537f965b20dce69232ef66f152962dc06)), closes [#49110](https://github.com/angular/angular/issues/49110) ### Reverts * Revert "fix(zone.js): enable monkey patching of the `queueMicrotask()` API in node.js (#50467)" (#50529) ([7567348](https://github.com/angular/angular/commit/7567348c54917b2f881d6c68d45f7c15d101954b)), closes [#50467](https://github.com/angular/angular/issues/50467) [#50529](https://github.com/angular/angular/issues/50529) [#50529](https://github.com/angular/angular/issues/50529)
{ "end_byte": 10851, "start_byte": 5549, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/CHANGELOG.md" }
angular/packages/zone.js/CHANGELOG.md_10851_15793
# [0.13](https://github.com/angular/angular/compare/zone.js-0.12.0...zone.js-0.13) (2023-02-28) ### Bug Fixes - **zone.js:** cancel tasks only when they are scheduled or running ([#46435](https://github.com/angular/angular/issues/46435)) ([b618b5a](https://github.com/angular/angular/commit/b618b5aa86138c900055c5496967e3348a7b98fc)), closes [#45711](https://github.com/angular/angular/issues/45711) - **zone.js:** Fix ConsoleTask interface typo ([#47090](https://github.com/angular/angular/issues/47090)) ([91954cf](https://github.com/angular/angular/commit/91954cf20e17a386d71cc8ea25d1d17b9ae1e31c)) - **zone.js:** zone-node only patch Promise.prototype.then ([#49144](https://github.com/angular/angular/issues/49144)) ([d1ac3aa](https://github.com/angular/angular/commit/d1ac3aa14e5d3c5415937199a6fb63437ddee0b8)), closes [#47872](https://github.com/angular/angular/issues/47872) # [0.12.0](https://github.com/angular/angular/compare/zone.js-0.11.8...zone.js-0.12.0) (2022-10-27) ### Bug Fixes - **zone.js:** cancel tasks only when they are scheduled or running ([#46435](https://github.com/angular/angular/issues/46435)) ([b618b5a](https://github.com/angular/angular/commit/b618b5aa86138c900055c5496967e3348a7b98fc)), closes [#45711](https://github.com/angular/angular/issues/45711) - **zone.js:** Fix ConsoleTask interface typo ([#47090](https://github.com/angular/angular/issues/47090)) ([91954cf](https://github.com/angular/angular/commit/91954cf20e17a386d71cc8ea25d1d17b9ae1e31c)) ## [0.11.8](https://github.com/angular/angular/compare/zone.js-0.11.7...zone.js-0.11.8) (2022-08-08) ### Features - **zone.js:** Update to the simpler Async Stack Tagging v2 API ([#46958](https://github.com/angular/angular/issues/46958)) ([f23232f](https://github.com/angular/angular/commit/f23232ff66559ddc28aec26d461355568c25530d)) ## [0.11.7](https://github.com/angular/angular/compare/zone.js-0.11.6...zone.js-0.11.7) (2022-07-20) ### Bug Fixes - **zone.js:** do not invoke jasmine done callback multiple times with `waitForAsync` ([4e77c7fbf38](https://github.com/angular/angular/commit/4e77c7fbf38f27741617303165068e1cb1ef6354)) ### Features - **zone.js:** add AsyncStackTaggingZoneSpec implementation ([#46693](https://github.com/angular/angular/issues/46693)) ([848a009](https://github.com/angular/angular/commit/848a00956e693ba8ab648c86cca034ed2e3c807c)) - **zone.js:** include jasmine `describe` block name when raising unexpected task error ([de86285](https://github.com/angular/angular/commit/de86285f2ee1c3a78489c8c40a15fc78f75e2620)) - **zone.js:** include zone name when sync-test zone reports tasks ([72c2567](https://github.com/angular/angular/commit/72c2567847c37b07e468a501a4b13edc791ae9ed)) ## [0.11.6](https://github.com/angular/angular/compare/zone.js-0.11.5...zone.js-0.11.6) (2022-06-02) ### Bug Fixes - **zone.js:** check if `process` is defined when patching the `GlobalErrors.install` ([#45392](https://github.com/angular/angular/issues/45392)) ([c7bcc1b](https://github.com/angular/angular/commit/c7bcc1b50182e5378756aa4528a24075b5be026e)), closes [#42260](https://github.com/angular/angular/issues/42260) - **zone.js:** in TaskTrackingZoneSpec track a periodic task until it is cancelled ([#45391](https://github.com/angular/angular/issues/45391)) ([f19b36f](https://github.com/angular/angular/commit/f19b36f462803b3b3b9410391c039649541b10bc)) - **zone.js:** read `Symbol.species` safely ([#45369](https://github.com/angular/angular/issues/45369)) ([e2eaac3](https://github.com/angular/angular/commit/e2eaac34b06a558145be41853f1d3585c1108880)) - **zone.js:** should ignore multiple resolve call ([#45283](https://github.com/angular/angular/issues/45283)) ([aebf165](https://github.com/angular/angular/commit/aebf165359ad6de5a8bacd9cb91651fc4175aaad)), closes [#44913](https://github.com/angular/angular/issues/44913) - **zone.js:** swallow the error when the element callback is not patchable ([#45400](https://github.com/angular/angular/issues/45400)) ([4ea70e3](https://github.com/angular/angular/commit/4ea70e36b998208302183f78088637f3de86323d)), closes [lwc/engine-core/src/framework/base-bridge-element.ts#L180-L186](https://github.com/lwc/engine-core/src/framework/base-bridge-element.ts/issues/L180-L186) [#42546](https://github.com/angular/angular/issues/42546) ### BREAKING CHANGES - **zone.js:** in TaskTrackingZoneSpec track a periodic task until it is cancelled The breaking change is scoped only to the plugin `zone.js/plugins/task-tracking`. If you used `TaskTrackingZoneSpec` and checked the pending macroTasks e.g. using `(this.ngZone as any)._inner ._parent._properties.TaskTrackingZone.getTasksFor('macroTask')`, then its behavior slightly changed for periodic macrotasks. For example, previously the `setInterval` macrotask was no longer tracked after its callback was executed for the first time. Now it's tracked until the task is explicitly cancelled, e.g with `clearInterval(id)`.
{ "end_byte": 15793, "start_byte": 10851, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/CHANGELOG.md" }
angular/packages/zone.js/CHANGELOG.md_15793_20392
## [0.11.5](https://github.com/angular/angular/compare/zone.js-0.11.4...zone.js-0.11.5) (2022-03-03) ### Bug Fixes - **zone.js:** async-test should only call done once ([#45025](https://github.com/angular/angular/issues/45025)) ([dea7234](https://github.com/angular/angular/commit/dea7234a76f652c8e9d9b79719e2b170a5a50777)) - **zone.js:** defineProperties should also set symbol props ([#45098](https://github.com/angular/angular/issues/45098)) ([b437d12](https://github.com/angular/angular/commit/b437d1238d9006baa0cf749adbd7cc3270de3040)), closes [#44095](https://github.com/angular/angular/issues/44095) - **zone.js:** fix several test cases which trigger `done()` multiple times ([#45025](https://github.com/angular/angular/issues/45025)) ([d5565cc](https://github.com/angular/angular/commit/d5565ccdb4573a47eb329b09c6852c1ae39672a6)) - **zone.js:** only one listener should also re-throw an error correctly ([#41868](https://github.com/angular/angular/issues/41868)) ([299f92c](https://github.com/angular/angular/commit/299f92c3b62a43c94cff4a204f9e41c46a159efc)), closes [#41867](https://github.com/angular/angular/issues/41867) [/github.com/angular/angular/pull/41562#issuecomment-822696973](https://github.com//github.com/angular/angular/pull/41562/issues/issuecomment-822696973) - **zone.js:** patch global instead of Mocha object ([#45047](https://github.com/angular/angular/issues/45047)) ([8efbdb5](https://github.com/angular/angular/commit/8efbdb57c11a6c632f69d7e142a632b6a853fa46)), closes [#42834](https://github.com/angular/angular/issues/42834) - **zone.js:** should continue to execute listeners when throw error ([#41562](https://github.com/angular/angular/issues/41562)) ([008eaf3](https://github.com/angular/angular/commit/008eaf3b7df90b2cdd9c83e229d23d4014d6dbc9)), closes [#41522](https://github.com/angular/angular/issues/41522) - **zone.js:** update several flaky cases ([#41526](https://github.com/angular/angular/issues/41526)) ([25a83eb](https://github.com/angular/angular/commit/25a83eb264aa19fc4616cea45e04d790b9bcd777)), closes [#41434](https://github.com/angular/angular/issues/41434) ### Features - **zone.js:** add Promise.any() implementation ([#45064](https://github.com/angular/angular/issues/45064)) ([4d494d2](https://github.com/angular/angular/commit/4d494d24ccb69b40a477b0bccd97baf6af66accf)), closes [#44393](https://github.com/angular/angular/issues/44393) - **zone.js:** update electron patch to support electron/remote 14 ([#45073](https://github.com/angular/angular/issues/45073)) ([d65706a](https://github.com/angular/angular/commit/d65706a3b225ccb88d719478c19a379aef1b6047)), closes [#43346](https://github.com/angular/angular/issues/43346) <a name="0.11.4"></a> ## [0.11.4](https://github.com/angular/angular/compare/zone.js-0.11.3...zone.js-0.11.4) (2021-02-10) ### Bug Fixes - **zone.js:** fesm2015 bundle should also be strict module. ([#40456](https://github.com/angular/angular/issues/40456)) ([f35f7c6](https://github.com/angular/angular/commit/f35f7c6)), closes [#40215](https://github.com/angular/angular/issues/40215) [#40215](https://github.com/angular/angular/issues/40215) - **zone.js:** fix typo in zone_externs ([#40348](https://github.com/angular/angular/issues/40348)) ([8116edb](https://github.com/angular/angular/commit/8116edb)) - **zone.js:** patch child method that overrides an already patched method ([#39850](https://github.com/angular/angular/issues/39850)) ([82e3f54](https://github.com/angular/angular/commit/82e3f54)) - **zone.js:** setTimeout patch should clean tasksByHandleId cache. ([#40586](https://github.com/angular/angular/issues/40586)) ([0652b29](https://github.com/angular/angular/commit/0652b29)), closes [#40387](https://github.com/angular/angular/issues/40387) - **zone.js:** update build tooling for latest changes in rules_nodejs ([#40710](https://github.com/angular/angular/issues/40710)) ([2827845](https://github.com/angular/angular/commit/2827845)) ### Features - **zone.js:** monkey patches queueMicrotask() ([#38904](https://github.com/angular/angular/issues/38904)) ([27358eb](https://github.com/angular/angular/commit/27358eb)), closes [#38863](https://github.com/angular/angular/issues/38863) <a name="0.11.3"></a> ## [0.11.3](https://github.com/angular/angular/compare/zone.js-0.11.2...zone.js-0.11.3) (2020-10-27) ### Bug Fixes - **zone.js:** remove global declaration ([#37861](https://github.com/angular/angular/issues/37861)) ([90c0772](https://github.com/angular/angular/commit/90c0772)), closes [#37531](https://github.com/angular/angular/issues/37531) <a name="0.11.2"></a>
{ "end_byte": 20392, "start_byte": 15793, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/CHANGELOG.md" }
angular/packages/zone.js/CHANGELOG.md_20392_25269
## [0.11.2](https://github.com/angular/angular/compare/zone.js-0.11.0...zone.js-0.11.2) (2020-09-19) ### Bug Fixes - **zone.js:** jest getRealSystemTime should return native time ([#39127](https://github.com/angular/angular/issues/39127)) ([ffc3332](https://github.com/angular/angular/commit/ffc3332)) - **zone.js:** add missing types field in package.json ([#38585](https://github.com/angular/angular/issues/38585)) ([27cc56b](https://github.com/angular/angular/commit/27cc56b)), closes [#38584](https://github.com/angular/angular/issues/38584) - **zone.js:** defineProperty patch should not swallow error ([#37582](https://github.com/angular/angular/issues/37582)) ([45a73dd](https://github.com/angular/angular/commit/45a73dd)), closes [#37432](https://github.com/angular/angular/issues/37432) - **zone.js:** run tests in umd format ([#37582](https://github.com/angular/angular/issues/37582)) ([40096be](https://github.com/angular/angular/commit/40096be)) - **zone.js:** should have better backward compatibilities ([#38797](https://github.com/angular/angular/issues/38797)) ([a33d630](https://github.com/angular/angular/commit/a33d630)), closes [#38561](https://github.com/angular/angular/issues/38561) [#38669](https://github.com/angular/angular/issues/38669) - **zone.js:** should invoke xhr send task when no response error occurs ([#38836](https://github.com/angular/angular/issues/38836)) ([d92a0dd](https://github.com/angular/angular/commit/d92a0dd)), closes [#38795](https://github.com/angular/angular/issues/38795) - **zone.js:** zone.js toString patch should check typeof Promise is function ([#38350](https://github.com/angular/angular/issues/38350)) ([18e474f](https://github.com/angular/angular/commit/18e474f)), closes [#38361](https://github.com/angular/angular/issues/38361) ### Features - **zone.js:** add jest fakeTimers support ([#39016](https://github.com/angular/angular/issues/39016)) ([82d54fe](https://github.com/angular/angular/commit/82d54fe)), closes [#38851](https://github.com/angular/angular/issues/38851) ### Refactor - **zone.js:** refactor(zone.js): rename several internal apis in fake async zone spec ([#39127](https://github.com/angular/angular/issues/39127)) ([8a68669](https://github.com/angular/angular/commit/8a68669)) ### Build - **zone.js:** build(zone.js): zone.js should output esm format for fesm2015 bundles ([#39203](https://github.com/angular/angular/issues/39203)) ([822b838](https://github.com/angular/angular/commit/822b838)) ### BREAKING CHANGES - **zone.js:** ZoneJS no longer swallows errors produced by `Object.defineProperty` calls. Prior to this change, ZoneJS monkey patched `Object.defineProperty` and if there is an error (such as the property is not configurable or not writable) the patched logic swallowed it and only console.log was produced. This behavior used to hide real errors, so the logic is now updated to trigger original errors (if any). One exception where the patch remains in place is `document.registerElement` (to allow smooth transition for code/polyfills that rely on old behavior in legacy browsers). If your code relies on the old behavior (where errors were not thrown before), you may need to update the logic to handle the errors that are no longer masked by ZoneJS patch. <a name="0.11.1"></a> ## [0.11.1](https://github.com/angular/angular/compare/zone.js-0.11.0...zone.js-0.11.1) (2020-08-19) ### Bug Fixes - **zone.js:** zone.js package.json should not include files/directories field ([#38528](https://github.com/angular/angular/issues/38528)) ([6b662d1](https://github.com/angular/angular/commit/6b662d1)), closes [#38526](https://github.com/angular/angular/issues/38526) [#38516](https://github.com/angular/angular/issues/38516) [#38513](https://github.com/angular/angular/issues/38513) # BREAKING CHANGES since Zone.js v0.11.1 Prior to `v0.11.1`, Zone.js provided two distribution bundle formats in the `dist` folder. They were (1) `ES5` bundle distributed as `zone.js` and (2) `ES2015` bundle distributed as `zone-evergreen.js`. These bundles are used for Angular's differential-loading mechanism. Prior to `v0.11.11` the following code ``` import 'zone.js'; ``` would load the `ES5` bundle from `dist/zone.js`. Starting with `v0.11.1`, Zone.js follows the [Angular Package Format](https://docs.google.com/document/d/1CZC2rcpxffTDfRDs6p1cfbmKNLA6x5O-NtkJglDaBVs), so the folder structure of the Zone.js bundles is updated to match `Angular Package Format`. So the same code ``` import 'zone.js'; ``` now loads the `ES2015` bundle instead. This is a breaking change for legacy browsers such as `IE11`. For backwards compatibility `zone.js` continues to distribute the same bundles under `dist`. To restore the old behavior change the `polyfills.ts` generated by `Angular CLI` to import like so: ``` import 'zone.js/dist/zone'; ``` <a name="0.11.0"></a>
{ "end_byte": 25269, "start_byte": 20392, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/CHANGELOG.md" }
angular/packages/zone.js/CHANGELOG.md_25269_28652
# [0.11.0](https://github.com/angular/angular/compare/zone.js-0.10.3...zone.js-0.11.0) (2020-08-14) ### Bug Fixes - **zone.js:** add issue numbers of `[@types](https://github.com/types)/jasmine` to the test cases ([#34625](https://github.com/angular/angular/issues/34625)) ([41667de](https://github.com/angular/angular/commit/41667de)) - **zone.js:** clearTimeout/clearInterval should call on object global ([#37858](https://github.com/angular/angular/issues/37858)) ([a71f114](https://github.com/angular/angular/commit/a71f114)), closes [#37333](https://github.com/angular/angular/issues/37333) - **zone.js:** fix 2 bluebird test cases for each/mapSeries ([#36295](https://github.com/angular/angular/issues/36295)) ([b44f7b5](https://github.com/angular/angular/commit/b44f7b5)) - **zone.js:** patch nodejs EventEmtter.prototype.off ([#37863](https://github.com/angular/angular/issues/37863)) ([1822cbc](https://github.com/angular/angular/commit/1822cbc)), closes [#35473](https://github.com/angular/angular/issues/35473) - **zone.js:** remove unused Promise overwritten setter logic ([#36851](https://github.com/angular/angular/issues/36851)) ([31796e8](https://github.com/angular/angular/commit/31796e8)) - **zone.js:** should not try to patch fetch if it is not writable ([#36311](https://github.com/angular/angular/issues/36311)) ([416c786](https://github.com/angular/angular/commit/416c786)), closes [#36142](https://github.com/angular/angular/issues/36142) - **zone.js:** UNPATCHED_EVENTS and PASSIVE_EVENTS should be string[] not boolean ([#36258](https://github.com/angular/angular/issues/36258)) ([36e927a](https://github.com/angular/angular/commit/36e927a)) - **zone.js:** zone patch rxjs should return null \_unsubscribe correctly. ([#37091](https://github.com/angular/angular/issues/37091)) ([96aa14d](https://github.com/angular/angular/commit/96aa14d)), closes [#31684](https://github.com/angular/angular/issues/31684) - **zone.js:** zone.js patch jest should handle done correctly ([#36022](https://github.com/angular/angular/issues/36022)) ([4374931](https://github.com/angular/angular/commit/4374931)) ### Features - **zone.js:** move all zone optional bundles to plugins folders ([#36540](https://github.com/angular/angular/issues/36540)) ([b199ef6](https://github.com/angular/angular/commit/b199ef6)) - **zone.js:** move MutationObserver/FileReader to different module ([#31657](https://github.com/angular/angular/issues/31657)) ([253337d](https://github.com/angular/angular/commit/253337d)) - **zone.js:** patch jasmine.createSpyObj to make properties enumerable to be true ([#34624](https://github.com/angular/angular/issues/34624)) ([c2b4d92](https://github.com/angular/angular/commit/c2b4d92)), closes [#33657](https://github.com/angular/angular/issues/33657) - **zone.js:** upgrade zone.js to angular package format(APF) ([#36540](https://github.com/angular/angular/issues/36540)) ([583a9d3](https://github.com/angular/angular/commit/583a9d3)), closes [#35157](https://github.com/angular/angular/issues/35157) [/github.com/angular/angular-cli/blob/5376a8b1392ac7bd252782d8474161ce03a4d1cb/packages/schematics/angular/application/files/src/polyfills.ts.template#L55-L58](https://github.com//github.com/angular/angular-cli/blob/5376a8b1392ac7bd252782d8474161ce03a4d1cb/packages/schematics/angular/application/files/src/polyfills.ts.template/issues/L55-L58)
{ "end_byte": 28652, "start_byte": 25269, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/CHANGELOG.md" }
angular/packages/zone.js/CHANGELOG.md_28652_33915
## [0.10.3](https://github.com/angular/angular/compare/zone.js-0.10.2...zone.js-0.10.3) (2020-02-27) ### Bug Fixes - **zone.js:** a path traversal attack in test ([#32392](https://github.com/angular/angular/issues/32392)) ([d498314](https://github.com/angular/angular/commit/d4983148508a7ddaeb095ab01db6b3bf995ee23f)) - **zone.js:** work around TS3.7 issue ([#33294](https://github.com/angular/angular/issues/33294)) ([0953642](https://github.com/angular/angular/commit/09536423e83892e716de13b2d14f12fff757f5a0)) - fixes typo of zone.js patch vrdisplaydisconnected property ([#33581](https://github.com/angular/angular/issues/33581)) ([71b8e27](https://github.com/angular/angular/commit/71b8e271b352b80519f1b8bbd786d78b49a2012b)), closes [#33579](https://github.com/angular/angular/issues/33579) - should also allow subclass Promise without Symbol.species ([#34533](https://github.com/angular/angular/issues/34533)) ([58b29f1](https://github.com/angular/angular/commit/58b29f1503a180fdfb8feb73a30d0c4448afad9a)) - **zone.js:** fix `zone-patch-rxjs` bundle to refer to `rxjs` (rather than include) it. ([#35983](https://github.com/angular/angular/issues/35983)) ([99ea5d7](https://github.com/angular/angular/commit/99ea5d7)), closes [#35878](https://github.com/angular/angular/issues/35878) - **zone.js:** Make `EventTarget` methods optional in `zone.js` extension API ([#35954](https://github.com/angular/angular/issues/35954)) ([5463462](https://github.com/angular/angular/commit/5463462)) - **zone.js:** zone.js patches rxjs should check null for unsubscribe ([#35990](https://github.com/angular/angular/issues/35990)) ([3fa8952](https://github.com/angular/angular/commit/3fa8952)), closes [#31687](https://github.com/angular/angular/issues/31687) [#31684](https://github.com/angular/angular/issues/31684) ### Features - implement Symbol.specics of Promise ([#34162](https://github.com/angular/angular/issues/34162)) ([539d8f0](https://github.com/angular/angular/commit/539d8f09e01fb4c577bc8a289d2e124360d4c6b1)), closes [#34105](https://github.com/angular/angular/issues/34105) [#33989](https://github.com/angular/angular/issues/33989) - define all zone.js configurations to typescript interfaces ([#35329](https://github.com/angular/angular/issues/35329)) ([03d88c7](https://github.com/angular/angular/commit/03d88c7965eb8b1310a1b50675fee66986a9ebac)) - add a temp solution to support passive event listeners. ([#34503](https://github.com/angular/angular/issues/34503)) ([f9d483e](https://github.com/angular/angular/commit/f9d483e76ea9992e3fe3e2b7c8c415c264de4679)) - add an tickOptions parameter with property processNewMacroTasksSynchronously. ([#33838](https://github.com/angular/angular/issues/33838)) ([17b862c](https://github.com/angular/angular/commit/17b862cf82a18490329d88b37d3e86e3245d5759)), closes [#33799](https://github.com/angular/angular/issues/33799) - add interface definitions which zone extends EventTarget ([#35304](https://github.com/angular/angular/issues/35304)) ([4acb676](https://github.com/angular/angular/commit/4acb676f2e9ba3a9ea33dd020e23534d702f988b)), closes [#35173](https://github.com/angular/angular/issues/35173) - make jasmine patch as zone module ([#34676](https://github.com/angular/angular/issues/34676)) ([e1160f1](https://github.com/angular/angular/commit/e1160f19beb2399581ae36aa498ec0dc23dfed53)) - make mocha a zone module. ([#34719](https://github.com/angular/angular/issues/34719)) ([332937e](https://github.com/angular/angular/commit/332937ef2471ab039cac1eceda42f80f94912f68)) - add basic jest support ([#35080](https://github.com/angular/angular/issues/35080)) ([daac33c](https://github.com/angular/angular/commit/daac33cdc84c6a882ec04c3009e6a230153716b0)) - **zone.js:** add a zone config to allow user disable wrapping uncaught promise rejection ([#35873](https://github.com/angular/angular/issues/35873)) ([8456c5e](https://github.com/angular/angular/commit/8456c5e)), closes [#27840](https://github.com/angular/angular/issues/27840) - **zone.js:** Monkey patch MessagePort.prototype onproperties ([#34610](https://github.com/angular/angular/issues/34610)) ([0f8e710](https://github.com/angular/angular/commit/0f8e710)) ### Performance Improvements - performance improvement for eventListeners ([#34613](https://github.com/angular/angular/issues/34613)) ([a3c7ab9](https://github.com/angular/angular/commit/a3c7ab99b79cd63965fcce847d35fb2314676f53)) <a name="0.10.2"></a> ## [0.10.2](https://github.com/angular/angular/compare/zone.js-0.10.1...zone.js-0.10.2) (2019-08-13) ### Features - **zone.js:** support Promise.allSettled ([#31849](https://github.com/angular/angular/issues/31849)) ([96cbcd6](https://github.com/angular/angular/commit/96cbcd6)) <a name="0.10.1"></a> ## [0.10.1](https://github.com/angular/angular/compare/zone.js-0.10.0...zone.js-0.10.1) (2019-08-02) ### Bug Fixes - **zone.js:** don't rely on global node typings outside of node/ directory ([#31783](https://github.com/angular/angular/issues/31783)) ([5c9a896](https://github.com/angular/angular/commit/5c9a896)) - **zone.js:** should expose some other internal intefaces ([#31866](https://github.com/angular/angular/issues/31866)) ([f5c605b](https://github.com/angular/angular/commit/f5c605b)) <a name="0.10.0"></a>
{ "end_byte": 33915, "start_byte": 28652, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/CHANGELOG.md" }
angular/packages/zone.js/CHANGELOG.md_33915_38069
# [0.10.0](https://github.com/angular/angular/compare/7b3bcc2...174770e) (2019-07-26) ### Bug Fixes - **zone.js:** **load_patch and **symbol\_\_ should be in zone_extern for closure compiler ([#31350](https://github.com/angular/angular/issues/31350)) ([6b51ed2](https://github.com/angular/angular/commit/6b51ed2)) - **zone.js:** don't fire unhandledrejection if Zone handled error ([#31718](https://github.com/angular/angular/issues/31718)) ([c7542a1](https://github.com/angular/angular/commit/c7542a1)), closes [#31701](https://github.com/angular/angular/issues/31701) - **zone.js:** don't wrap uncaught promise error. ([#31443](https://github.com/angular/angular/issues/31443)) ([2bb9a65](https://github.com/angular/angular/commit/2bb9a65)), closes [#27840](https://github.com/angular/angular/issues/27840) - **zone.js:** fix zone for Jasmine 3.3. ([#31497](https://github.com/angular/angular/issues/31497)) ([c4c340a](https://github.com/angular/angular/commit/c4c340a)) - **zone.js:** handle MSPointer event correctly ([#31722](https://github.com/angular/angular/issues/31722)) ([2c402d5](https://github.com/angular/angular/commit/2c402d5)), closes [#31699](https://github.com/angular/angular/issues/31699) - **zone.js:** handle new api of electron 4 ([#31669](https://github.com/angular/angular/issues/31669)) ([a445826](https://github.com/angular/angular/commit/a445826)), closes [#31668](https://github.com/angular/angular/issues/31668) - **zone.js:** hook should set correct current zone ([#31642](https://github.com/angular/angular/issues/31642)) ([17b32b5](https://github.com/angular/angular/commit/17b32b5)), closes [#31641](https://github.com/angular/angular/issues/31641) - **zone.js:** move property patch to legacy ([#31660](https://github.com/angular/angular/issues/31660)) ([716af10](https://github.com/angular/angular/commit/716af10)), closes [#31659](https://github.com/angular/angular/issues/31659) - **zone.js:** patch shadydom ([#31717](https://github.com/angular/angular/issues/31717)) ([35a025f](https://github.com/angular/angular/commit/35a025f)), closes [#31686](https://github.com/angular/angular/issues/31686) - **zone.js:** restore definition of global ([#31453](https://github.com/angular/angular/issues/31453)) ([e6f1b04](https://github.com/angular/angular/commit/e6f1b04)), closes [/github.com/angular/zone.js/commit/71b93711806000d7788e79451478e20d6086aa8a#diff-dd469785fca8680a5b33b1e81c5cfd91R1420](https://github.com//github.com/angular/zone.js/commit/71b93711806000d7788e79451478e20d6086aa8a/issues/diff-dd469785fca8680a5b33b1e81c5cfd91R1420) - **zone.js:** should remove on symbol property after removeAllListeners ([#31644](https://github.com/angular/angular/issues/31644)) ([a182714](https://github.com/angular/angular/commit/a182714)), closes [#31643](https://github.com/angular/angular/issues/31643) - **zone.js:** update dart zone link ([#31646](https://github.com/angular/angular/issues/31646)) ([7f7033b](https://github.com/angular/angular/commit/7f7033b)), closes [#31645](https://github.com/angular/angular/issues/31645) - **zone.js:** zone-mix should import correct browser module ([#31628](https://github.com/angular/angular/issues/31628)) ([87ce4e9](https://github.com/angular/angular/commit/87ce4e9)), closes [#31626](https://github.com/angular/angular/issues/31626) <a name="0.9.1"></a> ## [0.9.1](https://github.com/angular/zone.js/compare/v0.9.0...0.9.1) (2019-04-30) ### Bug Fixes - ensure that EventTarget is patched prior to legacy property descriptor patch ([#1214](https://github.com/angular/zone.js/issues/1214)) ([aca4728](https://github.com/angular/zone.js/commit/aca4728)) - fakeAsyncTest requestAnimationFrame should pass timestamp as parameter ([#1220](https://github.com/angular/zone.js/issues/1220)) ([62b8525](https://github.com/angular/zone.js/commit/62b8525)), closes [#1216](https://github.com/angular/zone.js/issues/1216) ### Features - add option to disable jasmine clock patch, also rename the flag of auto jump in FakeAsyncTest ([#1222](https://github.com/angular/zone.js/issues/1222)) ([10e1b0c](https://github.com/angular/zone.js/commit/10e1b0c)) <a name="0.9.0"></a>
{ "end_byte": 38069, "start_byte": 33915, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/CHANGELOG.md" }
angular/packages/zone.js/CHANGELOG.md_38069_41414
# [0.9.0](https://github.com/angular/zone.js/compare/v0.8.29...0.9.0) (2019-03-12) ### Bug Fixes - **lint:** fix [#1168](https://github.com/angular/zone.js/issues/1168), remove unused = null code ([#1171](https://github.com/angular/zone.js/issues/1171)) ([917e2af](https://github.com/angular/zone.js/commit/917e2af)) - **test:** fix [#1155](https://github.com/angular/zone.js/issues/1155), try/catch modify error.message ([#1157](https://github.com/angular/zone.js/issues/1157)) ([7e983d1](https://github.com/angular/zone.js/commit/7e983d1)) - **test:** fix: make fakeAsync test spec timer id global ([d32e79b](https://github.com/angular/zone.js/commit/d32e79b)) - **build:** fix: closure related fixes ([2a8415d](https://github.com/angular/zone.js/commit/2a8415d)) - **compile:** fix: remove finally definition from Promise interface ([47dd3f4](https://github.com/angular/zone.js/commit/47dd3f4)) ### Doc - **doc:** [#1181](https://github.com/angular/zone.js/pull/1181), Fix the typo in timer module documentation ([8f78b55](https://github.com/angular/zone.js/commit/8f78b55)) - **doc:** [#1163](https://github.com/angular/zone.js/pull/1163), Update YouTube video link ([f171821](https://github.com/angular/zone.js/commit/f171821)) - **doc:** [#1151](https://github.com/angular/zone.js/pull/1151), Re-phrase the lines for better understanding ([2a6444b](https://github.com/angular/zone.js/commit/2a6444b)) - **doc:** [#1152](https://github.com/angular/zone.js/pull/1152), change the word TimerTask to MacroTask ([f3995de](https://github.com/angular/zone.js/commit/f3995de)) ### Features - **test:** add benchmark page ([#1076](https://github.com/angular/zone.js/issues/1076)) ([128649a](https://github.com/angular/zone.js/commit/128649a)) - **test:** test(promise): add test cases for Promise.all with sync then operation ([#1158](https://github.com/angular/zone.js/issues/1158)) ([0b44e83](https://github.com/angular/zone.js/commit/0b44e83)) - **test:** feat: add an option **zone_symbol**disableDatePatching to allow disabling Date patching ([c378f87](https://github.com/angular/zone.js/commit/c378f87)) ### Env - **env:** change BLACK_LISTED_EVENTS to DISABLE_EVENTS ([9c65d25](https://github.com/angular/zone.js/commit/9c65d25)) ### Build - **build:** build zone-evergreen.js in es2015, add terser minify support ([2ad936b](https://github.com/angular/zone.js/commit/2ad936b)) - **build:** upgrade to pass jasmine 3.3 test ([82dfd75](https://github.com/angular/zone.js/commit/82dfd75)) - **build:** upgrade to typescript 3.2.2 ([fcdd559](https://github.com/angular/zone.js/commit/fcdd559)) - **build:** separate zone.js into evergreen only and legacy included bundles ([ac3851e](https://github.com/angular/zone.js/commit/ac3851e)) - **build:** make legacy standalone bundle ([a5fe09b](https://github.com/angular/zone.js/commit/a5fe09b)) <a name="0.8.29"></a> ## [0.8.29](https://github.com/angular/zone.js/compare/v0.8.28...0.8.29) (2019-01-22) ### Bug Fixes - **core:** fix for tests in angular repo ([fd069db](https://github.com/angular/zone.js/commit/fd069db)) <a name="0.8.28"></a> ## [0.8.28](https://github.com/angular/zone.js/compare/v0.8.27...0.8.28) (2019-01-16) ### Bug Fixes - **jasmine:** patch jasmine beforeAll/afterAll ([9d27abc4](https://github.com/angular/zone.js/commit/9d27abc4)) <a name="0.8.27"></a>
{ "end_byte": 41414, "start_byte": 38069, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/CHANGELOG.md" }
angular/packages/zone.js/CHANGELOG.md_41414_47718
## [0.8.27](https://github.com/angular/zone.js/compare/v0.8.26...0.8.27) (2019-01-08) ### Bug Fixes - **bluebird:** fix [#1112](https://github.com/angular/zone.js/issues/1112), bluebird chained callback should return a Bluebird Promise ([#1114](https://github.com/angular/zone.js/issues/1114)) ([6ba3169](https://github.com/angular/zone.js/commit/6ba3169)) - **core:** fix [#1108](https://github.com/angular/zone.js/issues/1108), window.onerror should have (message, source, lineno, colno, error) signiture ([#1109](https://github.com/angular/zone.js/issues/1109)) ([49e0548](https://github.com/angular/zone.js/commit/49e0548)) - **core:** fix [#1153](https://github.com/angular/zone.js/issues/1153), ZoneTask.toString should always be a string ([#1166](https://github.com/angular/zone.js/issues/1166)) ([afa1363](https://github.com/angular/zone.js/commit/afa1363)) - **core:** fix interval will still run after cancelled error ([#1156](https://github.com/angular/zone.js/issues/1156)) ([eb72ff4](https://github.com/angular/zone.js/commit/eb72ff4)) - **core:** use then directly when promise is not patchable ([#1079](https://github.com/angular/zone.js/issues/1079)) ([d7e0a31](https://github.com/angular/zone.js/commit/d7e0a31)) - **duplicate:** fix [#1081](https://github.com/angular/zone.js/issues/1081), load patch should also check the duplicate flag ([#1121](https://github.com/angular/zone.js/issues/1121)) ([8ce5e33](https://github.com/angular/zone.js/commit/8ce5e33)) - **event:** fix [#1110](https://github.com/angular/zone.js/issues/1110), nodejs EventEmitter should support Symbol eventName ([#1113](https://github.com/angular/zone.js/issues/1113)) ([96420d6](https://github.com/angular/zone.js/commit/96420d6)) - **event:** should pass boolean to addEventListener if not support passive ([#1053](https://github.com/angular/zone.js/issues/1053)) ([e9536ec](https://github.com/angular/zone.js/commit/e9536ec)) - **format:** update clang-format to 1.2.3 ([f238908](https://github.com/angular/zone.js/commit/f238908)) - **memory:** Add protection against excessive on prop patching ([#1106](https://github.com/angular/zone.js/issues/1106)) ([875086f](https://github.com/angular/zone.js/commit/875086f)) - **node:** fix [#1164](https://github.com/angular/zone.js/issues/1164), don't patch uncaughtException to prevent endless loop ([#1170](https://github.com/angular/zone.js/issues/1170)) ([33a0ad6](https://github.com/angular/zone.js/commit/33a0ad6)) - **node:** node patched method should copy original delegate's symbol properties ([#1095](https://github.com/angular/zone.js/issues/1095)) ([0a2f6ff](https://github.com/angular/zone.js/commit/0a2f6ff)) - **onProperty:** user quoted access for \_\_Zone_ignore_on_properties ([#1134](https://github.com/angular/zone.js/issues/1134)) ([7201d44](https://github.com/angular/zone.js/commit/7201d44)) - **test:** karma-dist should test bundle under dist ([#1049](https://github.com/angular/zone.js/issues/1049)) ([0720d79](https://github.com/angular/zone.js/commit/0720d79)) - **tsc:** tsconfig.json strict:true ([915042d](https://github.com/angular/zone.js/commit/915042d)) - **xhr:** fix [#1072](https://github.com/angular/zone.js/issues/1072), should set scheduled flag to target ([#1074](https://github.com/angular/zone.js/issues/1074)) ([34c12e5](https://github.com/angular/zone.js/commit/34c12e5)) - **xhr:** should invoke xhr task after onload is triggered ([#1055](https://github.com/angular/zone.js/issues/1055)) ([2aab9c8](https://github.com/angular/zone.js/commit/2aab9c8)) ### Features - **build:** Upgrade to TypeScript 2.9 and rxjs6 ([#1122](https://github.com/angular/zone.js/issues/1122)) ([31fc127](https://github.com/angular/zone.js/commit/31fc127)) - **core:** upgrade to typescript 3.0.3 ([#1132](https://github.com/angular/zone.js/issues/1132)) ([60adc9c](https://github.com/angular/zone.js/commit/60adc9c)) - **Core:** fix [#910](https://github.com/angular/zone.js/issues/910), add a flag to allow user to ignore duplicate Zone error ([#1093](https://github.com/angular/zone.js/issues/1093)) ([a86c6d5](https://github.com/angular/zone.js/commit/a86c6d5)) - **custom-element:** patch customElement v1 APIs ([#1133](https://github.com/angular/zone.js/issues/1133)) ([427705f](https://github.com/angular/zone.js/commit/427705f)) - **error:** fix [#975](https://github.com/angular/zone.js/issues/975), can config how to load blacklist zone stack frames ([#1045](https://github.com/angular/zone.js/issues/1045)) ([ff3d545](https://github.com/angular/zone.js/commit/ff3d545)) - **fetch:** schedule macroTask when fetch ([#1075](https://github.com/angular/zone.js/issues/1075)) ([bf88c34](https://github.com/angular/zone.js/commit/bf88c34)) <a name="0.8.26"></a> ## [0.8.26](https://github.com/angular/zone.js/compare/v0.8.25...0.8.26) (2018-04-08) ### Bug Fixes - **test:** fix [#1069](https://github.com/angular/zone.js/issues/1069), FakeDate should handle constructor parameter ([#1070](https://github.com/angular/zone.js/issues/1070)) ([b3fdd7e](https://github.com/angular/zone.js/commit/b3fdd7e)) <a name="0.8.25"></a> ## [0.8.25](https://github.com/angular/zone.js/compare/v0.8.24...0.8.25) (2018-04-04) ### Bug Fixes - **test:** add async/fakeAsync into zone-testing bundle ([#1068](https://github.com/angular/zone.js/issues/1068)) ([3bdfdad](https://github.com/angular/zone.js/commit/3bdfdad)) <a name="0.8.24"></a> ## [0.8.24](https://github.com/angular/zone.js/compare/v0.8.23...0.8.24) (2018-04-02) ### Bug Fixes - **test:** add flag to patch jasmine.clock, move fakeAsync/async into original bundle ([#1067](https://github.com/angular/zone.js/issues/1067)) ([389762c](https://github.com/angular/zone.js/commit/389762c)) <a name="0.8.24"></a> ## [0.8.24](https://github.com/angular/zone.js/compare/v0.8.23...0.8.24) (2018-04-02) ### Bug Fixes - **test:** add flag to patch jasmine.clock, move fakeAsync/async into original bundle ([#1067](https://github.com/angular/zone.js/issues/1067)) ([389762c](https://github.com/angular/zone.js/commit/389762c)) <a name="0.8.23"></a> ## [0.8.23](https://github.com/angular/zone.js/compare/v0.8.22...0.8.23) (2018-04-01) ### Bug Fixes - **test:** check setImmediate supports ([6c7e45b](https://github.com/angular/zone.js/commit/6c7e45b)) <a name="0.8.22"></a>
{ "end_byte": 47718, "start_byte": 41414, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/CHANGELOG.md" }
angular/packages/zone.js/CHANGELOG.md_47718_53927
## [0.8.22](https://github.com/angular/zone.js/compare/v0.8.21...0.8.22) (2018-03-31) ### Bug Fixes - **fakeAsync:** fix [#1050](https://github.com/angular/zone.js/issues/1050), should only reset patched Date.now until fakeAsync exit ([#1051](https://github.com/angular/zone.js/issues/1051)) ([e15d735](https://github.com/angular/zone.js/commit/e15d735)) - **fakeAsyncTest:** fix [#1061](https://github.com/angular/zone.js/issues/1061), fakeAsync should support setImmediate ([#1062](https://github.com/angular/zone.js/issues/1062)) ([66c6f97](https://github.com/angular/zone.js/commit/66c6f97)) <a name="0.8.21"></a> ## [0.8.21](https://github.com/angular/zone.js/compare/v0.8.20...0.8.21) (2018-03-30) ### Bug Fixes - add OriginalDelegate prop to Function::toString ([#993](https://github.com/angular/zone.js/issues/993)) ([2dc7e5c](https://github.com/angular/zone.js/commit/2dc7e5c)) - **core:** fix [#1000](https://github.com/angular/zone.js/issues/1000), check target is null or not when patchOnProperty ([#1004](https://github.com/angular/zone.js/issues/1004)) ([5c139e5](https://github.com/angular/zone.js/commit/5c139e5)) - **core:** fix [#946](https://github.com/angular/zone.js/issues/946), don't patch promise if it is not writable ([#1041](https://github.com/angular/zone.js/issues/1041)) ([c8c5990](https://github.com/angular/zone.js/commit/c8c5990)) - **event:** fix [#1021](https://github.com/angular/zone.js/issues/1021), removeListener/removeAllListeners should return eventEmitter ([#1022](https://github.com/angular/zone.js/issues/1022)) ([ab72df6](https://github.com/angular/zone.js/commit/ab72df6)) - **fakeAsync:** fix [#1056](https://github.com/angular/zone.js/issues/1056), fakeAsync timerId should not be zero ([#1057](https://github.com/angular/zone.js/issues/1057)) ([68682cd](https://github.com/angular/zone.js/commit/68682cd)) - **jasmine:** fix [#1015](https://github.com/angular/zone.js/issues/1015), make jasmine patch compatible to jasmine 3.x ([#1016](https://github.com/angular/zone.js/issues/1016)) ([e1df4bc](https://github.com/angular/zone.js/commit/e1df4bc)) - **patch:** fix [#998](https://github.com/angular/zone.js/issues/998), patch mediaQuery for new Safari ([#1003](https://github.com/angular/zone.js/issues/1003)) ([c7c7db5](https://github.com/angular/zone.js/commit/c7c7db5)) - **proxy:** proxyZone should call onHasTask when change delegate ([#1030](https://github.com/angular/zone.js/issues/1030)) ([40b110d](https://github.com/angular/zone.js/commit/40b110d)) - **test:** fix mocha compatible issue ([#1028](https://github.com/angular/zone.js/issues/1028)) ([c554e9f](https://github.com/angular/zone.js/commit/c554e9f)) - **testing:** fix [#1032](https://github.com/angular/zone.js/issues/1032), fakeAsync should pass parameters correctly ([#1033](https://github.com/angular/zone.js/issues/1033)) ([eefe983](https://github.com/angular/zone.js/commit/eefe983)) ### Features - **bluebird:** fix [#921](https://github.com/angular/zone.js/issues/921), [#977](https://github.com/angular/zone.js/issues/977), support bluebird ([#1039](https://github.com/angular/zone.js/issues/1039)) ([438210c](https://github.com/angular/zone.js/commit/438210c)) - **build:** use yarn instead of npm ([#1025](https://github.com/angular/zone.js/issues/1025)) ([ebd348c](https://github.com/angular/zone.js/commit/ebd348c)) - **core:** fix [#996](https://github.com/angular/zone.js/issues/996), expose UncaughtPromiseError ([#1040](https://github.com/angular/zone.js/issues/1040)) ([7f178b1](https://github.com/angular/zone.js/commit/7f178b1)) - **jasmine:** support Date.now in fakeAsyncTest ([#1009](https://github.com/angular/zone.js/issues/1009)) ([f22065e](https://github.com/angular/zone.js/commit/f22065e)) - **jsonp:** provide a help method to patch jsonp ([#997](https://github.com/angular/zone.js/issues/997)) ([008fd43](https://github.com/angular/zone.js/commit/008fd43)) - **patch:** fix [#1011](https://github.com/angular/zone.js/issues/1011), patch ResizeObserver ([#1012](https://github.com/angular/zone.js/issues/1012)) ([8ee88da](https://github.com/angular/zone.js/commit/8ee88da)) - **patch:** fix [#828](https://github.com/angular/zone.js/issues/828), patch socket.io client ([b3db9f4](https://github.com/angular/zone.js/commit/b3db9f4)) - **promise:** support Promise.prototype.finally ([#1005](https://github.com/angular/zone.js/issues/1005)) ([6a1a830](https://github.com/angular/zone.js/commit/6a1a830)) - **rollup:** use new rollup config to prevent warning ([#1006](https://github.com/angular/zone.js/issues/1006)) ([6b6b38a](https://github.com/angular/zone.js/commit/6b6b38a)) - **test:** can handle non zone aware task in promise ([#1014](https://github.com/angular/zone.js/issues/1014)) ([6852f1d](https://github.com/angular/zone.js/commit/6852f1d)) - **test:** move async/fakeAsync from angular to zone.js ([#1048](https://github.com/angular/zone.js/issues/1048)) ([a4b42cd](https://github.com/angular/zone.js/commit/a4b42cd)) - **testing:** can display pending tasks info when test timeout in jasmine/mocha ([#1038](https://github.com/angular/zone.js/issues/1038)) ([57bc80c](https://github.com/angular/zone.js/commit/57bc80c)) <a name="0.8.20"></a> ## [0.8.20](https://github.com/angular/zone.js/compare/v0.8.19...0.8.20) (2018-01-10) ### Bug Fixes - **core:** add comment for shorter var/function name ([67e8178](https://github.com/angular/zone.js/commit/67e8178)) - **core:** add file check script in travis build ([615a6c1](https://github.com/angular/zone.js/commit/615a6c1)) - **core:** add helper method in util.ts to shorter zone.wrap/scehduleMacroTask ([8293c37](https://github.com/angular/zone.js/commit/8293c37)) - **core:** add rxjs test ([31832a7](https://github.com/angular/zone.js/commit/31832a7)) - **core:** fix [#989](https://github.com/angular/zone.js/issues/989), remove unuse code, use shorter name to reduce bundle size ([73b0061](https://github.com/angular/zone.js/commit/73b0061)) - **core:** fix shorter name closure conflict ([00a4e31](https://github.com/angular/zone.js/commit/00a4e31)) - **core:** remove unreadable short names ([957351e](https://github.com/angular/zone.js/commit/957351e)) <a name="0.8.18"></a>
{ "end_byte": 53927, "start_byte": 47718, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/CHANGELOG.md" }
angular/packages/zone.js/CHANGELOG.md_53927_60502
## [0.8.18](https://github.com/angular/zone.js/compare/v0.8.17...0.8.18) (2017-09-27) ### Bug Fixes - **event:** EventTarget of SourceBuffer in samsung tv will have null context ([#904](https://github.com/angular/zone.js/issues/904)) ([8718e07](https://github.com/angular/zone.js/commit/8718e07)) - **event:** fix [#883](https://github.com/angular/zone.js/issues/883), fix RTCPeerConnection Safari event not triggered issue ([#905](https://github.com/angular/zone.js/issues/905)) ([6f74efb](https://github.com/angular/zone.js/commit/6f74efb)) - **event:** fix [#911](https://github.com/angular/zone.js/issues/911), in IE, event handler event maybe undefined ([#913](https://github.com/angular/zone.js/issues/913)) ([4ba5d97](https://github.com/angular/zone.js/commit/4ba5d97)) - **event:** should handle event.stopImmediatePropagration ([#903](https://github.com/angular/zone.js/issues/903)) ([dcc285a](https://github.com/angular/zone.js/commit/dcc285a)) - **patch:** patchOnProperty getter should return original listener ([#887](https://github.com/angular/zone.js/issues/887)) ([d4e5ae8](https://github.com/angular/zone.js/commit/d4e5ae8)) - **patch:** Worker should patch onProperties ([#915](https://github.com/angular/zone.js/issues/915)) ([418a583](https://github.com/angular/zone.js/commit/418a583)) - **promise:** can set native promise after loading zone.js ([#899](https://github.com/angular/zone.js/issues/899)) ([956c729](https://github.com/angular/zone.js/commit/956c729)) - **timer:** fix [#314](https://github.com/angular/zone.js/issues/314), setTimeout/interval should return original timerId ([#894](https://github.com/angular/zone.js/issues/894)) ([aec4bd4](https://github.com/angular/zone.js/commit/aec4bd4)) ### Features - **compile:** fix [#892](https://github.com/angular/zone.js/issues/892), upgrade to typescript 2.3.4, support for...of when build zone-node ([#897](https://github.com/angular/zone.js/issues/897)) ([e999593](https://github.com/angular/zone.js/commit/e999593)) - **spec:** log URL in error when attempting XHR from FakeAsyncTestZone ([#893](https://github.com/angular/zone.js/issues/893)) ([874bfdc](https://github.com/angular/zone.js/commit/874bfdc)) <a name="0.8.17"></a> ## [0.8.17](https://github.com/angular/zone.js/compare/v0.8.16...0.8.17) (2017-08-23) ### Bug Fixes - readonly property should not be patched ([#860](https://github.com/angular/zone.js/issues/860)) ([7fbd655](https://github.com/angular/zone.js/commit/7fbd655)) - suppress closure warnings/errors ([#861](https://github.com/angular/zone.js/issues/861)) ([deae751](https://github.com/angular/zone.js/commit/deae751)) - **module:** fix [#875](https://github.com/angular/zone.js/issues/875), can disable requestAnimationFrame ([#876](https://github.com/angular/zone.js/issues/876)) ([fcf187c](https://github.com/angular/zone.js/commit/fcf187c)) - **node:** remove reference to 'noop' ([#865](https://github.com/angular/zone.js/issues/865)) ([4032ddf](https://github.com/angular/zone.js/commit/4032ddf)) - **patch:** fix [#869](https://github.com/angular/zone.js/issues/869), should not patch readonly method ([#871](https://github.com/angular/zone.js/issues/871)) ([31d38c1](https://github.com/angular/zone.js/commit/31d38c1)) - **rxjs:** asap should runGuarded to let error inZone ([#884](https://github.com/angular/zone.js/issues/884)) ([ce3f12f](https://github.com/angular/zone.js/commit/ce3f12f)) - **rxjs:** fix [#863](https://github.com/angular/zone.js/issues/863), fix asap scheduler issue, add testcases ([#848](https://github.com/angular/zone.js/issues/848)) ([cbc58c1](https://github.com/angular/zone.js/commit/cbc58c1)) - **spec:** fix flush() behavior in handling periodic timers ([#881](https://github.com/angular/zone.js/issues/881)) ([eed776c](https://github.com/angular/zone.js/commit/eed776c)) - **task:** fix closure compatibility issue with ZoneDelegate.\_updateTaskCount ([#878](https://github.com/angular/zone.js/issues/878)) ([a03b84b](https://github.com/angular/zone.js/commit/a03b84b)) ### Features - **cordova:** fix [#868](https://github.com/angular/zone.js/issues/868), patch cordova FileReader ([#879](https://github.com/angular/zone.js/issues/879)) ([b1e5970](https://github.com/angular/zone.js/commit/b1e5970)) - **onProperty:** fix [#875](https://github.com/angular/zone.js/issues/875), can disable patch specified onProperties ([#877](https://github.com/angular/zone.js/issues/877)) ([a733688](https://github.com/angular/zone.js/commit/a733688)) - **patch:** fix [#833](https://github.com/angular/zone.js/issues/833), add IntersectionObserver support ([#880](https://github.com/angular/zone.js/issues/880)) ([f27ff14](https://github.com/angular/zone.js/commit/f27ff14)) - **performance:** onProperty handler use global wrapFn, other performance improve. ([#872](https://github.com/angular/zone.js/issues/872)) ([a66595a](https://github.com/angular/zone.js/commit/a66595a)) - **performance:** reuse microTaskQueue native promise ([#874](https://github.com/angular/zone.js/issues/874)) ([7ee8bcd](https://github.com/angular/zone.js/commit/7ee8bcd)) - **spec:** add a 'tick' callback to flush() ([#866](https://github.com/angular/zone.js/issues/866)) ([02cd40e](https://github.com/angular/zone.js/commit/02cd40e)) <a name="0.8.16"></a> ## [0.8.16](https://github.com/angular/zone.js/compare/v0.8.15...0.8.16) (2017-07-27) ### Bug Fixes - **console:** console.log in nodejs should run in root Zone ([#855](https://github.com/angular/zone.js/issues/855)) ([5900d3a](https://github.com/angular/zone.js/commit/5900d3a)) - **promise:** fix [#850](https://github.com/angular/zone.js/issues/850), check Promise.then writable ([#851](https://github.com/angular/zone.js/issues/851)) ([6e44cab](https://github.com/angular/zone.js/commit/6e44cab)) - **spec:** do not count requestAnimationFrame as a pending timer ([#854](https://github.com/angular/zone.js/issues/854)) ([eca04b0](https://github.com/angular/zone.js/commit/eca04b0)) ### Features - **spec:** add an option to FakeAsyncTestZoneSpec to flush periodic timers ([#857](https://github.com/angular/zone.js/issues/857)) ([5c5ca1a](https://github.com/angular/zone.js/commit/5c5ca1a)) <a name="0.8.15"></a> ## [0.8.15](https://github.com/angular/zone.js/compare/v0.8.13...0.8.15) (2017-07-27) ### Features - **rxjs:** fix [#830](https://github.com/angular/zone.js/issues/830), monkey patch rxjs to make rxjs run in correct zone ([#843](https://github.com/angular/zone.js/issues/843)) ([1ed83d0](https://github.com/angular/zone.js/commit/1ed83d0)) <a name="0.8.14"></a>
{ "end_byte": 60502, "start_byte": 53927, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/CHANGELOG.md" }
angular/packages/zone.js/CHANGELOG.md_60502_66492
## [0.8.14](https://github.com/angular/zone.js/compare/v0.8.13...0.8.14) (2017-07-20) ### Bug Fixes - **event:** fix [#836](https://github.com/angular/zone.js/issues/836), handle event callback call removeEventListener case ([#839](https://github.com/angular/zone.js/issues/839)) ([f301fa2](https://github.com/angular/zone.js/commit/f301fa2)) - **event:** fix memory leak for once, add more test cases ([#841](https://github.com/angular/zone.js/issues/841)) ([2143d9c](https://github.com/angular/zone.js/commit/2143d9c)) - **task:** fix [#832](https://github.com/angular/zone.js/issues/832), fix [#835](https://github.com/angular/zone.js/issues/835), task.data should be an object ([#834](https://github.com/angular/zone.js/issues/834)) ([3a4bfbd](https://github.com/angular/zone.js/commit/3a4bfbd)) ### Features - **rxjs:** fix [#830](https://github.com/angular/zone.js/issues/830), monkey patch rxjs to make rxjs run in correct zone ([#843](https://github.com/angular/zone.js/issues/843)) ([1ed83d0](https://github.com/angular/zone.js/commit/1ed83d0)) <a name="0.8.14"></a> ## [0.8.14](https://github.com/angular/zone.js/compare/v0.8.13...0.8.14) (2017-07-18) ### Bug Fixes - **event:** fix [#836](https://github.com/angular/zone.js/issues/836), handle event callback call removeEventListener case ([#839](https://github.com/angular/zone.js/issues/839)) ([f301fa2](https://github.com/angular/zone.js/commit/f301fa2)) - **event:** fix memory leak for once, add more test cases ([#841](https://github.com/angular/zone.js/issues/841)) ([2143d9c](https://github.com/angular/zone.js/commit/2143d9c)) - **task:** fix [#832](https://github.com/angular/zone.js/issues/832), fix [#835](https://github.com/angular/zone.js/issues/835), task.data should be an object ([#834](https://github.com/angular/zone.js/issues/834)) ([3a4bfbd](https://github.com/angular/zone.js/commit/3a4bfbd)) <a name="0.8.13"></a> ## [0.8.13](https://github.com/angular/zone.js/compare/v0.8.12...0.8.13) (2017-07-12) ### Bug Fixes - **promise:** fix [#806](https://github.com/angular/zone.js/issues/806), remove duplicate consolelog ([#807](https://github.com/angular/zone.js/issues/807)) ([f439fe2](https://github.com/angular/zone.js/commit/f439fe2)) - **spec:** fakeAsyncTestSpec should handle requestAnimationFrame ([#805](https://github.com/angular/zone.js/issues/805)) ([8260f1d](https://github.com/angular/zone.js/commit/8260f1d)), closes [#804](https://github.com/angular/zone.js/issues/804) - **websocket:** fix [#824](https://github.com/angular/zone.js/issues/824), patch websocket onproperties correctly in PhantomJS ([#826](https://github.com/angular/zone.js/issues/826)) ([273cb85](https://github.com/angular/zone.js/commit/273cb85)) ### Features - **FakeAsyncTestZoneSpec:** FakeAsyncTestZoneSpec.flush() passes limit along to scheduler ([#831](https://github.com/angular/zone.js/issues/831)) ([667cd6f](https://github.com/angular/zone.js/commit/667cd6f)) ### Performance Improvements - **eventListener:** fix [#798](https://github.com/angular/zone.js/issues/798), improve EventTarget.addEventListener performance ([#812](https://github.com/angular/zone.js/issues/812)) ([b3a76d3](https://github.com/angular/zone.js/commit/b3a76d3)) <a name="0.8.12"></a> ## [0.8.12](https://github.com/angular/zone.js/compare/v0.8.11...0.8.12) (2017-06-07) ### Bug Fixes - **doc:** fix [#793](https://github.com/angular/zone.js/issues/793), fix confuseing bluebird patch doc ([#794](https://github.com/angular/zone.js/issues/794)) ([0c5da04](https://github.com/angular/zone.js/commit/0c5da04)) - **patch:** fix [#791](https://github.com/angular/zone.js/issues/791), fix mediaQuery/Notification patch uses wrong global ([#792](https://github.com/angular/zone.js/issues/792)) ([67634ae](https://github.com/angular/zone.js/commit/67634ae)) - **toString:** fix [#802](https://github.com/angular/zone.js/issues/802), fix ios 9 MutationObserver toString error ([#803](https://github.com/angular/zone.js/issues/803)) ([68aa03e](https://github.com/angular/zone.js/commit/68aa03e)) - **xhr:** inner onreadystatechange should not triigger Zone callback ([#800](https://github.com/angular/zone.js/issues/800)) ([7bd1418](https://github.com/angular/zone.js/commit/7bd1418)) ### Features - **patch:** fix [#696](https://github.com/angular/zone.js/issues/696), patch HTMLCanvasElement.toBlob as MacroTask ([#788](https://github.com/angular/zone.js/issues/788)) ([7ca3995](https://github.com/angular/zone.js/commit/7ca3995)) - **patch:** fix [#758](https://github.com/angular/zone.js/issues/758), patch cordova.exec success/error with zone.wrap ([#789](https://github.com/angular/zone.js/issues/789)) ([857929d](https://github.com/angular/zone.js/commit/857929d)) <a name="0.8.11"></a> ## [0.8.11](https://github.com/angular/zone.js/compare/v0.8.10...0.8.11) (2017-05-19) ### Bug Fixes - **closure:** patchOnProperty with exact eventNames as possible ([#768](https://github.com/angular/zone.js/issues/768)) ([582ff7b](https://github.com/angular/zone.js/commit/582ff7b)) - **patch:** fix [#744](https://github.com/angular/zone.js/issues/744), add namespace to load patch name ([#774](https://github.com/angular/zone.js/issues/774)) ([89f990a](https://github.com/angular/zone.js/commit/89f990a)) - **task:** fix [#778](https://github.com/angular/zone.js/issues/778), sometimes task will run after being canceled ([#780](https://github.com/angular/zone.js/issues/780)) ([b7238c8](https://github.com/angular/zone.js/commit/b7238c8)) - **webcomponents:** fix [#782](https://github.com/angular/zone.js/issues/782), fix conflicts with shadydom of webcomponents ([#784](https://github.com/angular/zone.js/issues/784)) ([245f8e9](https://github.com/angular/zone.js/commit/245f8e9)) - **webpack:** access `process` through `_global` so that WebPack does not accidentally browserify ([#786](https://github.com/angular/zone.js/issues/786)) ([1919b36](https://github.com/angular/zone.js/commit/1919b36)) <a name="0.8.10"></a>
{ "end_byte": 66492, "start_byte": 60502, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/CHANGELOG.md" }
angular/packages/zone.js/CHANGELOG.md_66492_72485
## [0.8.10](https://github.com/angular/zone.js/compare/v0.8.9...0.8.10) (2017-05-03) ### Bug Fixes - **showError:** fix ignoreConsoleErrorUncaughtError may change during drain microtask ([#763](https://github.com/angular/zone.js/issues/763)) ([4baeb5c](https://github.com/angular/zone.js/commit/4baeb5c)) - **spec:** fix [#760](https://github.com/angular/zone.js/issues/760), fakeAsyncTestSpec should handle microtask with additional args ([#762](https://github.com/angular/zone.js/issues/762)) ([f8d17ac](https://github.com/angular/zone.js/commit/f8d17ac)) - Package Error stack rewriting as a separate bundle. ([#770](https://github.com/angular/zone.js/issues/770)) ([b5e33fd](https://github.com/angular/zone.js/commit/b5e33fd)) - **timer:** fix [#437](https://github.com/angular/zone.js/issues/437), [#744](https://github.com/angular/zone.js/issues/744), fix nativescript timer issue, fix nodejs v0.10.x timer issue ([#772](https://github.com/angular/zone.js/issues/772)) ([3218b5a](https://github.com/angular/zone.js/commit/3218b5a)) ### Features - make codebase more modular so that only parts of it can be loaded ([#748](https://github.com/angular/zone.js/issues/748)) ([e933cbd](https://github.com/angular/zone.js/commit/e933cbd)) - **patch:** load non standard api with new load module method ([#764](https://github.com/angular/zone.js/issues/764)) ([97c03b5](https://github.com/angular/zone.js/commit/97c03b5)) <a name="0.8.9"></a> ## [0.8.9](https://github.com/angular/zone.js/compare/v0.8.8...0.8.9) (2017-04-25) ### Bug Fixes - **patch:** fix [#746](https://github.com/angular/zone.js/issues/746), check desc get is null and only patch window.resize additionally ([#747](https://github.com/angular/zone.js/issues/747)) ([e598310](https://github.com/angular/zone.js/commit/e598310)) <a name="0.8.8"></a> ## [0.8.8](https://github.com/angular/zone.js/compare/v0.8.7...0.8.8) (2017-04-21) ### Bug Fixes - on<property> handling broken in v0.8.7 ([fbe7b13](https://github.com/angular/zone.js/commit/fbe7b13)) <a name="0.8.7"></a> ## [0.8.7](https://github.com/angular/zone.js/compare/v0.8.5...0.8.7) (2017-04-21) ### Bug Fixes - **doc:** fix typo in document, fix a typescript warning in test ([#732](https://github.com/angular/zone.js/issues/732)) ([55cf064](https://github.com/angular/zone.js/commit/55cf064)) - **error:** fix [#706](https://github.com/angular/zone.js/issues/706), handleError when onHasTask throw error ([#709](https://github.com/angular/zone.js/issues/709)) ([06d1ac0](https://github.com/angular/zone.js/commit/06d1ac0)) - **error:** remove throw in Error constructor to improve performance in IE11 ([#704](https://github.com/angular/zone.js/issues/704)) ([88d1a49](https://github.com/angular/zone.js/commit/88d1a49)), closes [#698](https://github.com/angular/zone.js/issues/698) - **listener:** fix [#616](https://github.com/angular/zone.js/issues/616), webdriver removeEventListener throw permission denied error ([#699](https://github.com/angular/zone.js/issues/699)) ([e02960d](https://github.com/angular/zone.js/commit/e02960d)) - **patch:** fix [#707](https://github.com/angular/zone.js/issues/707), should not try to patch non configurable property ([#717](https://github.com/angular/zone.js/issues/717)) ([e422fb1](https://github.com/angular/zone.js/commit/e422fb1)) - **patch:** fix [#708](https://github.com/angular/zone.js/issues/708), modify the canPatchDescriptor logic when browser don't provide onreadystatechange ([#711](https://github.com/angular/zone.js/issues/711)) ([7d4d07f](https://github.com/angular/zone.js/commit/7d4d07f)) - **patch:** fix [#719](https://github.com/angular/zone.js/issues/719), window onproperty callback this is undefined ([#723](https://github.com/angular/zone.js/issues/723)) ([160531b](https://github.com/angular/zone.js/commit/160531b)) - **task:** fix [#705](https://github.com/angular/zone.js/issues/705), don't json task.data to prevent cyclic error ([#712](https://github.com/angular/zone.js/issues/712)) ([92a39e2](https://github.com/angular/zone.js/commit/92a39e2)) - **test:** fix [#718](https://github.com/angular/zone.js/issues/718), use async test to do unhandle promise rejection test ([#726](https://github.com/angular/zone.js/issues/726)) ([0a06874](https://github.com/angular/zone.js/commit/0a06874)) - **test:** fix websocket test server will crash when test in chrome ([#733](https://github.com/angular/zone.js/issues/733)) ([5090cf9](https://github.com/angular/zone.js/commit/5090cf9)) - **toString:** fix [#666](https://github.com/angular/zone.js/issues/666), Zone patched method toString should like before patched ([#686](https://github.com/angular/zone.js/issues/686)) ([0d0ee53](https://github.com/angular/zone.js/commit/0d0ee53)) - resolve errors with closure ([#722](https://github.com/angular/zone.js/issues/722)) ([51e7ffe](https://github.com/angular/zone.js/commit/51e7ffe)) - **typo:** fix typo, remove extra semicolons, unify api doc ([#697](https://github.com/angular/zone.js/issues/697)) ([967a991](https://github.com/angular/zone.js/commit/967a991)) ### Features - **closure:** fix [#727](https://github.com/angular/zone.js/issues/727), add zone_externs.js for closure compiler ([#731](https://github.com/angular/zone.js/issues/731)) ([b60e9e6](https://github.com/angular/zone.js/commit/b60e9e6)) - **error:** Remove all Zone frames from stack ([#693](https://github.com/angular/zone.js/issues/693)) ([681a017](https://github.com/angular/zone.js/commit/681a017)) - **EventListenerOptions:** fix [#737](https://github.com/angular/zone.js/issues/737), add support to EventListenerOptions ([#738](https://github.com/angular/zone.js/issues/738)) ([a89830d](https://github.com/angular/zone.js/commit/a89830d)) - **patch:** fix [#499](https://github.com/angular/zone.js/issues/499), let promise instance toString active like native ([#734](https://github.com/angular/zone.js/issues/734)) ([2f11e67](https://github.com/angular/zone.js/commit/2f11e67)) <a name="0.8.5"></a>
{ "end_byte": 72485, "start_byte": 66492, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/CHANGELOG.md" }
angular/packages/zone.js/CHANGELOG.md_72485_75587
## [0.8.5](https://github.com/angular/zone.js/compare/v0.8.4...0.8.5) (2017-03-21) ### Bug Fixes - add support for subclassing of Errors ([81297ee](https://github.com/angular/zone.js/commit/81297ee)) - improve long-stack-trace stack format detection ([6010557](https://github.com/angular/zone.js/commit/6010557)) - remove left over console.log ([eeaab91](https://github.com/angular/zone.js/commit/eeaab91)) - **event:** fix [#667](https://github.com/angular/zone.js/issues/667), eventHandler should return result ([#682](https://github.com/angular/zone.js/issues/682)) ([5c4e24d](https://github.com/angular/zone.js/commit/5c4e24d)) - **jasmine:** modify jasmine test ifEnvSupports message ([#689](https://github.com/angular/zone.js/issues/689)) ([5635ac0](https://github.com/angular/zone.js/commit/5635ac0)) - **REVERT:** remove zone internal stack frames in error.stack ([#632](https://github.com/angular/zone.js/issues/632)) ([#690](https://github.com/angular/zone.js/issues/690)) ([291d5a0](https://github.com/angular/zone.js/commit/291d5a0)) ### Features - **dom:** fix [#664](https://github.com/angular/zone.js/issues/664), patch window,document,SVGElement onProperties ([#687](https://github.com/angular/zone.js/issues/687)) ([61aee2e](https://github.com/angular/zone.js/commit/61aee2e)) <a name="0.8.4"></a> ## [0.8.4](https://github.com/angular/zone.js/compare/v0.8.3...0.8.4) (2017-03-16) ### Bug Fixes - correct declaration which breaks closure ([0e19304](https://github.com/angular/zone.js/commit/0e19304)) - stack rewriting now works with source maps ([bcd09a0](https://github.com/angular/zone.js/commit/bcd09a0)) <a name="0.8.3"></a> ## [0.8.3](https://github.com/angular/zone.js/compare/v0.8.1...0.8.3) (2017-03-15) ### Bug Fixes - **zone:** consistent access to **symbol** to work with closure ([f742394](https://github.com/angular/zone.js/commit/f742394)) <a name="0.8.2"></a> ## [0.8.2](https://github.com/angular/zone.js/compare/v0.8.1...0.8.2) (2017-03-14) ### Bug Fixes - **zone:** fix [#674](https://github.com/angular/zone.js/issues/674), handle error.stack readonly case ([#675](https://github.com/angular/zone.js/issues/675)) ([8322be8](https://github.com/angular/zone.js/commit/8322be8)) <a name="0.8.1"></a> ## [0.8.1](https://github.com/angular/zone.js/compare/v0.8.0...0.8.1) (2017-03-13) ### Bug Fixes - **example:** Update counting.html ([#648](https://github.com/angular/zone.js/issues/648)) ([a63ae5f](https://github.com/angular/zone.js/commit/a63ae5f)) - **XHR:** fix [#671](https://github.com/angular/zone.js/issues/671), patch XMLHttpRequestEventTarget prototype ([300dc36](https://github.com/angular/zone.js/commit/300dc36)) ### Features - **error:** remove zone internal stack frames in error.stack ([#632](https://github.com/angular/zone.js/issues/632)) ([76fa891](https://github.com/angular/zone.js/commit/76fa891)) - **task:** add task lifecycle doc and testcases to explain task state transition. ([#651](https://github.com/angular/zone.js/issues/651)) ([ef39a44](https://github.com/angular/zone.js/commit/ef39a44)) <a name="0.8.0"></a>
{ "end_byte": 75587, "start_byte": 72485, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/CHANGELOG.md" }
angular/packages/zone.js/CHANGELOG.md_75587_81895
# [0.8.0](https://github.com/angular/zone.js/compare/v0.7.8...0.8.0) (2017-03-10) ### Features - Upgrade TypeScript to v2.2.1 <a name="0.7.8"></a> ## [0.7.8](https://github.com/angular/zone.js/compare/v0.7.6...0.7.8) (2017-03-10) ### Bug Fixes - **core:** remove debugger ([#639](https://github.com/angular/zone.js/issues/639)) ([0534b19](https://github.com/angular/zone.js/commit/0534b19)) - **error:** fix [#618](https://github.com/angular/zone.js/issues/618), ZoneAwareError should copy Error's static propeties ([#647](https://github.com/angular/zone.js/issues/647)) ([2d30914](https://github.com/angular/zone.js/commit/2d30914)) - **jasmine:** support "pending" `it` clauses with no test body ([96cb3d0](https://github.com/angular/zone.js/commit/96cb3d0)), closes [#659](https://github.com/angular/zone.js/issues/659) - **minification:** fix [#607](https://github.com/angular/zone.js/issues/607) to change catch variable name to error/err ([#609](https://github.com/angular/zone.js/issues/609)) ([33d0d8d](https://github.com/angular/zone.js/commit/33d0d8d)) - **node:** patch crypto as macroTask and add test cases for crypto, remove http patch ([#612](https://github.com/angular/zone.js/issues/612)) ([9e81037](https://github.com/angular/zone.js/commit/9e81037)) - **package:** use fixed version typescript,clang-format and jasmine ([#650](https://github.com/angular/zone.js/issues/650)) ([84459f1](https://github.com/angular/zone.js/commit/84459f1)) - **patch:** check timer patch return undefined ([#628](https://github.com/angular/zone.js/issues/628)) ([47962df](https://github.com/angular/zone.js/commit/47962df)) - **patch:** fix [#618](https://github.com/angular/zone.js/issues/618), use zoneSymbol as property name to avoid name conflict ([#645](https://github.com/angular/zone.js/issues/645)) ([fcd8be5](https://github.com/angular/zone.js/commit/fcd8be5)) - **task:** findEventTask should return Task array ([#633](https://github.com/angular/zone.js/issues/633)) ([14c7a6f](https://github.com/angular/zone.js/commit/14c7a6f)) - **task:** fix [#638](https://github.com/angular/zone.js/issues/638), eventTask/Periodical task should not be reset after cancel in running state ([#642](https://github.com/angular/zone.js/issues/642)) ([eb9250d](https://github.com/angular/zone.js/commit/eb9250d)) - **timers:** cleanup task reference when exception ([#637](https://github.com/angular/zone.js/issues/637)) ([2594940](https://github.com/angular/zone.js/commit/2594940)) - **webapi:** refactor webapi to not import util.ts directly ([8b2543e](https://github.com/angular/zone.js/commit/8b2543e)), closes [#652](https://github.com/angular/zone.js/issues/652) - **xhr:** fix [#657](https://github.com/angular/zone.js/issues/657), sometimes xhr will fire onreadystatechange with done twice ([#658](https://github.com/angular/zone.js/issues/658)) ([36c0899](https://github.com/angular/zone.js/commit/36c0899)) - **zonespec:** don't throw and exception when setInterval is called within a async test zone ([#641](https://github.com/angular/zone.js/issues/641)) ([c07560f](https://github.com/angular/zone.js/commit/c07560f)) ### Features - add Zone.root api ([#601](https://github.com/angular/zone.js/issues/601)) ([9818139](https://github.com/angular/zone.js/commit/9818139)) - allow tasks to be canceled and rescheduled on different zone in a zone delegate ([#629](https://github.com/angular/zone.js/issues/629)) ([76c6ebf](https://github.com/angular/zone.js/commit/76c6ebf)) - make fetch() zone-aware without triggering extra requests or uncatchable errors. ([#622](https://github.com/angular/zone.js/issues/622)) ([6731ad0](https://github.com/angular/zone.js/commit/6731ad0)) - **bluebird:** patch bluebird promise and treat it as microtask ([#655](https://github.com/angular/zone.js/issues/655)) ([e783bfa](https://github.com/angular/zone.js/commit/e783bfa)) - **electron/nw:** fix [#533](https://github.com/angular/zone.js/issues/533), in electron/nw.js, we may need to patch both browser API and nodejs API, so we need a zone-mix.js to contains both patched API. ([6d31734](https://github.com/angular/zone.js/commit/6d31734)) - **longStackTraceSpec:** handled promise rejection can also render longstacktrace ([#631](https://github.com/angular/zone.js/issues/631)) ([a4c6525](https://github.com/angular/zone.js/commit/a4c6525)) - **promise:** fix [#621](https://github.com/angular/zone.js/issues/621), add unhandledRejection handler and ignore consoleError ([#627](https://github.com/angular/zone.js/issues/627)) ([f3547cc](https://github.com/angular/zone.js/commit/f3547cc)) <a name="0.7.6"></a> ## [0.7.6](https://github.com/angular/zone.js/compare/v0.7.4...0.7.6) (2017-01-17) ### Bug Fixes - **doc:** typo in comment and reformat README.md ([#590](https://github.com/angular/zone.js/issues/590)) ([95ad315](https://github.com/angular/zone.js/commit/95ad315)) - **ZoneAwareError:** Error should keep prototype chain and can be called without new ([82722c3](https://github.com/angular/zone.js/commit/82722c3)), closes [#546](https://github.com/angular/zone.js/issues/546) [#554](https://github.com/angular/zone.js/issues/554) [#555](https://github.com/angular/zone.js/issues/555) - [#536](https://github.com/angular/zone.js/issues/536), add notification api patch ([#599](https://github.com/angular/zone.js/issues/599)) ([83dfa97](https://github.com/angular/zone.js/commit/83dfa97)) - [#593](https://github.com/angular/zone.js/issues/593), only call removeAttribute when have the method ([#594](https://github.com/angular/zone.js/issues/594)) ([1401d60](https://github.com/angular/zone.js/commit/1401d60)) - [#595](https://github.com/angular/zone.js/issues/595), refactor ZoneAwareError property copy ([#597](https://github.com/angular/zone.js/issues/597)) ([f7330de](https://github.com/angular/zone.js/commit/f7330de)) - [#604](https://github.com/angular/zone.js/issues/604), sometimes setInterval test spec will fail on Android 4.4 ([#605](https://github.com/angular/zone.js/issues/605)) ([e3cd1f4](https://github.com/angular/zone.js/commit/e3cd1f4)) - add missing test MutationObserver ([5c7bc01](https://github.com/angular/zone.js/commit/5c7bc01)) - Promise.toString() to look like native function ([f854ce0](https://github.com/angular/zone.js/commit/f854ce0)) <a name="0.7.5"></a>
{ "end_byte": 81895, "start_byte": 75587, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/CHANGELOG.md" }
angular/packages/zone.js/CHANGELOG.md_81895_87570
## [0.7.5](https://github.com/angular/zone.js/compare/v0.7.4...0.7.5) (2017-01-12) ### Bug Fixes - patch fs methods as macrotask, add test cases of fs watcher ([#572](https://github.com/angular/zone.js/issues/572)) ([e1d3240](https://github.com/angular/zone.js/commit/e1d3240)) - fix [#577](https://github.com/angular/zone.js/issues/577), canPatchViaPropertyDescriptor test should add configurable to XMLHttpRequest.prototype ([#578](https://github.com/angular/zone.js/issues/578)) ([c297752](https://github.com/angular/zone.js/commit/c297752)) - fix [#551](https://github.com/angular/zone.js/issues/551), add toJSON to ZoneTask to prevent cyclic error ([#576](https://github.com/angular/zone.js/issues/576)) ([03d19f9](https://github.com/angular/zone.js/commit/03d19f9)) - fix [#574](https://github.com/angular/zone.js/issues/574), captureStackTrace will have additional stackframe from Zone will break binding.js ([#575](https://github.com/angular/zone.js/issues/575)) ([41f5306](https://github.com/angular/zone.js/commit/41f5306)) - fix [#569](https://github.com/angular/zone.js/issues/569), request will cause updateTaskCount failed if we call abort multipletimes ([#570](https://github.com/angular/zone.js/issues/570)) ([62f1449](https://github.com/angular/zone.js/commit/62f1449)) - add web-api.ts to patch mediaQuery ([#571](https://github.com/angular/zone.js/issues/571)) ([e92f934](https://github.com/angular/zone.js/commit/e92f934)) - fix [#584](https://github.com/angular/zone.js/issues/584), remove android 4.1~4.3, add no-ssl options to make android 4.4 pass test ([#586](https://github.com/angular/zone.js/issues/586)) ([7cd570e](https://github.com/angular/zone.js/commit/7cd570e)) - Fix [#532](https://github.com/angular/zone.js/issues/532), Fix [#566](https://github.com/angular/zone.js/issues/566), add tslint in ci, add tslint/format/test/karma in precommit of git ([#565](https://github.com/angular/zone.js/issues/565)) ([fb8d51c](https://github.com/angular/zone.js/commit/fb8d51c)) - docs(zone.ts): fix typo ([#583](https://github.com/angular/zone.js/issues/583)) ([ecbef87](https://github.com/angular/zone.js/commit/ecbef87)) - add missing test MutationObserver ([5c7bc01](https://github.com/angular/zone.js/commit/5c7bc01)) - Promise.toString() to look like native function ([f854ce0](https://github.com/angular/zone.js/commit/f854ce0)) - **ZoneAwareError:** Error should keep prototype chain and can be called without new ([82722c3](https://github.com/angular/zone.js/commit/82722c3)), closes [#546](https://github.com/angular/zone.js/issues/546) [#554](https://github.com/angular/zone.js/issues/554) [#555](https://github.com/angular/zone.js/issues/555) <a name="0.7.4"></a> ## [0.7.4](https://github.com/angular/zone.js/compare/v0.7.1...0.7.4) (2016-12-31) ### Bug Fixes - add better Type safety ([610649b](https://github.com/angular/zone.js/commit/610649b)) - add missing test MutationObserver ([5c7bc01](https://github.com/angular/zone.js/commit/5c7bc01)) - correct currentZone passed into delegate methods ([dc12d8e](https://github.com/angular/zone.js/commit/dc12d8e)), closes [#587](https://github.com/angular/zone.js/issues/587) [#539](https://github.com/angular/zone.js/issues/539) - correct zone.min.js not including zone ([384f5ec](https://github.com/angular/zone.js/commit/384f5ec)) - Correct ZoneAwareError prototype chain ([ba7858c](https://github.com/angular/zone.js/commit/ba7858c)), closes [#546](https://github.com/angular/zone.js/issues/546) [#547](https://github.com/angular/zone.js/issues/547) - formatting issue. ([c70e9ec](https://github.com/angular/zone.js/commit/c70e9ec)) - inline event handler issue ([20b5a5d](https://github.com/angular/zone.js/commit/20b5a5d)), closes [#525](https://github.com/angular/zone.js/issues/525) [#540](https://github.com/angular/zone.js/issues/540) - parameterize `wrap` method on `Zone` ([#542](https://github.com/angular/zone.js/issues/542)) ([f522e1b](https://github.com/angular/zone.js/commit/f522e1b)) - **closure:** avoid property renaming on globals ([af14646](https://github.com/angular/zone.js/commit/af14646)) - Prevent adding listener for xhrhttprequest multiple times ([9509747](https://github.com/angular/zone.js/commit/9509747)), closes [#529](https://github.com/angular/zone.js/issues/529) [#527](https://github.com/angular/zone.js/issues/527) [#287](https://github.com/angular/zone.js/issues/287) [#530](https://github.com/angular/zone.js/issues/530) - Promise.toString() to look like native function ([f854ce0](https://github.com/angular/zone.js/commit/f854ce0)) - **closure:** Fix closure error suppression comment. ([#552](https://github.com/angular/zone.js/issues/552)) ([2643783](https://github.com/angular/zone.js/commit/2643783)) - Run tests on both the build as well as the dist folder ([#514](https://github.com/angular/zone.js/issues/514)) ([c0604f5](https://github.com/angular/zone.js/commit/c0604f5)) - support nw.js environment ([486010b](https://github.com/angular/zone.js/commit/486010b)), closes [#524](https://github.com/angular/zone.js/issues/524) ### Features - Patch captureStackTrace/prepareStackTrace to ZoneAwareError, patch process.nextTick, fix removeAllListeners bug ([#516](https://github.com/angular/zone.js/issues/516)) ([c36c0bc](https://github.com/angular/zone.js/commit/c36c0bc)), closes [#484](https://github.com/angular/zone.js/issues/484) [#491](https://github.com/angular/zone.js/issues/491) <a name="0.7.1"></a> ## [0.7.1](https://github.com/angular/zone.js/compare/v0.7.0...v0.7.1) (2016-11-22) ### Bug Fixes - missing zone from the build file ([e961833](https://github.com/angular/zone.js/commit/e961833)) <a name="0.7.0"></a>
{ "end_byte": 87570, "start_byte": 81895, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/CHANGELOG.md" }
angular/packages/zone.js/CHANGELOG.md_87570_93027
# [0.7.0](https://github.com/angular/zone.js/compare/0.6.25...v0.7.0) (2016-11-22) ### Bug Fixes - **node:** crash when calling listeners() for event with no listeners ([431f6f0](https://github.com/angular/zone.js/commit/431f6f0)) - support clearing the timeouts with numeric IDs ([fea6d68](https://github.com/angular/zone.js/commit/fea6d68)), closes [#461](https://github.com/angular/zone.js/issues/461) - **promise:** include stack trace in an unhandlerd promise ([#463](https://github.com/angular/zone.js/issues/463)) ([737f8d8](https://github.com/angular/zone.js/commit/737f8d8)) - **property-descriptor:** do not use document object in Safari web worker ([51f2e1f](https://github.com/angular/zone.js/commit/51f2e1f)) - Add WebSocket to the NO_EVENT_TARGET list to be patched as well ([#493](https://github.com/angular/zone.js/issues/493)) ([d8c15eb](https://github.com/angular/zone.js/commit/d8c15eb)) - fix wrong usage of == caught by closure compiler ([#510](https://github.com/angular/zone.js/issues/510)) ([d7d8eb5](https://github.com/angular/zone.js/commit/d7d8eb5)) - fluent interface for EventEmitter ([#475](https://github.com/angular/zone.js/issues/475)) ([c5130a6](https://github.com/angular/zone.js/commit/c5130a6)) - lint errors ([ed87c26](https://github.com/angular/zone.js/commit/ed87c26)) - make fetch promise patching safe ([16be7f9](https://github.com/angular/zone.js/commit/16be7f9)), closes [#451](https://github.com/angular/zone.js/issues/451) - Make the check for ZoneAwarePromise more stringent ([#495](https://github.com/angular/zone.js/issues/495)) ([c69df25](https://github.com/angular/zone.js/commit/c69df25)) - run all timers in passage of time in a single fakeAsync's tick call ([a85db4c](https://github.com/angular/zone.js/commit/a85db4c)), closes [#454](https://github.com/angular/zone.js/issues/454) - stop using class extends as it breaks rollup ([b52cf02](https://github.com/angular/zone.js/commit/b52cf02)) - use strict equality in scheduleQueueDrain ([#504](https://github.com/angular/zone.js/issues/504)) ([4b4249c](https://github.com/angular/zone.js/commit/4b4249c)) ### Features - add mocha support ([41a9047](https://github.com/angular/zone.js/commit/41a9047)) - **Error:** Rewrite Error stack frames to include zone ([e1c2a02](https://github.com/angular/zone.js/commit/e1c2a02)) <a name="0.6.25"></a> ## [0.6.25](https://github.com/angular/zone.js/compare/0.6.24...0.6.25) (2016-09-20) ### Bug Fixes - **zonespecs:** revert unwrapping of zonespecs which actually require global ([#460](https://github.com/angular/zone.js/issues/460)) ([28a14f8](https://github.com/angular/zone.js/commit/28a14f8)) <a name="0.6.24"></a> ## [0.6.24](https://github.com/angular/zone.js/compare/v0.6.23...0.6.24) (2016-09-19) ### Bug Fixes - **bundling:** switch to using umd bundles ([#457](https://github.com/angular/zone.js/issues/457)) ([8dd06e5](https://github.com/angular/zone.js/commit/8dd06e5)), closes [#456](https://github.com/angular/zone.js/issues/456) <a name="0.6.23"></a> ## [0.6.23](https://github.com/angular/zone.js/compare/v0.6.22...v0.6.23) (2016-09-14) ### Bug Fixes - **fetch:** correct chrome not able to load about://blank ([3844435](https://github.com/angular/zone.js/commit/3844435)), closes [#444](https://github.com/angular/zone.js/issues/444) <a name="0.6.22"></a> ## [0.6.22](https://github.com/angular/zone.js/compare/v0.6.21...v0.6.22) (2016-09-14) ### Bug Fixes - use fetch(about://blank) to prevent exception on MS Edge ([#442](https://github.com/angular/zone.js/issues/442)) ([8b81537](https://github.com/angular/zone.js/commit/8b81537)), closes [#436](https://github.com/angular/zone.js/issues/436) [#439](https://github.com/angular/zone.js/issues/439) ### Features - **node:** patch most fs methods ([#438](https://github.com/angular/zone.js/issues/438)) ([4c8a155](https://github.com/angular/zone.js/commit/4c8a155)) - **node:** patch outgoing http requests to capture the zone ([#430](https://github.com/angular/zone.js/issues/430)) ([100b82b](https://github.com/angular/zone.js/commit/100b82b)) <a name="0.6.21"></a> ## [0.6.21](https://github.com/angular/zone.js/compare/v0.6.20...v0.6.21) (2016-09-11) ### Bug Fixes - proper detection of global in WebWorker ([0a7a155](https://github.com/angular/zone.js/commit/0a7a155)) <a name="0.6.20"></a> ## [0.6.20](https://github.com/angular/zone.js/compare/v0.6.19...v0.6.20) (2016-09-10) <a name="0.6.19"></a> ## [0.6.19](https://github.com/angular/zone.js/compare/v0.6.17...v0.6.19) (2016-09-10) ### Bug Fixes - provide a more useful error when configuring properties ([1fe4df0](https://github.com/angular/zone.js/commit/1fe4df0)) - **jasmine:** propagate all arguments of it/describe/etc... ([a85fd68](https://github.com/angular/zone.js/commit/a85fd68)) - **long-stack:** Safer writing of stack traces. ([6767ff5](https://github.com/angular/zone.js/commit/6767ff5)) - **promise:** support more aggressive optimization. ([#431](https://github.com/angular/zone.js/issues/431)) ([26fc3da](https://github.com/angular/zone.js/commit/26fc3da)) - **XHR:** Don't send sync XHR through ZONE ([6e2f13c](https://github.com/angular/zone.js/commit/6e2f13c)), closes [#377](https://github.com/angular/zone.js/issues/377) ### Features - assert that right ZoneAwarePromise is available ([#420](https://github.com/angular/zone.js/issues/420)) ([4c35e5b](https://github.com/angular/zone.js/commit/4c35e5b)) <a name="0.6.17"></a>
{ "end_byte": 93027, "start_byte": 87570, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/CHANGELOG.md" }
angular/packages/zone.js/CHANGELOG.md_93027_99288
## [0.6.17](https://github.com/angular/zone.js/compare/v0.6.15...v0.6.17) (2016-08-22) ### Bug Fixes - **browser:** use XMLHttpRequest.DONE constant on target instead of the global interface ([#395](https://github.com/angular/zone.js/issues/395)) ([3b4c20b](https://github.com/angular/zone.js/commit/3b4c20b)), closes [#394](https://github.com/angular/zone.js/issues/394) - **jasmine:** spelling error of 'describe' in jasmine patch prevented application of sync zone ([d38ccde](https://github.com/angular/zone.js/commit/d38ccde)), closes [#412](https://github.com/angular/zone.js/issues/412) - **patchProperty:** return null as the default value ([#413](https://github.com/angular/zone.js/issues/413)) ([396942b](https://github.com/angular/zone.js/commit/396942b)), closes [#319](https://github.com/angular/zone.js/issues/319) - IE10/11 timeout issues. ([382182c](https://github.com/angular/zone.js/commit/382182c)) <a name="0.6.15"></a> ## [0.6.15](https://github.com/angular/zone.js/compare/v0.6.14...v0.6.15) (2016-08-19) ### Bug Fixes - broken build. ([#406](https://github.com/angular/zone.js/issues/406)) ([5e3c207](https://github.com/angular/zone.js/commit/5e3c207)) - **tasks:** do not drain the microtask queue early. ([ff88bb4](https://github.com/angular/zone.js/commit/ff88bb4)) - **tasks:** do not drain the microtask queue early. ([d4a1436](https://github.com/angular/zone.js/commit/d4a1436)) <a name="0.6.14"></a> ## [0.6.14](https://github.com/angular/zone.js/compare/v0.6.13...v0.6.14) (2016-08-17) ### Features - **jasmine:** patch jasmine to understand zones. ([3a054be](https://github.com/angular/zone.js/commit/3a054be)) - **trackingZone:** Keep track of tasks to see outstanding tasks. ([4942b4a](https://github.com/angular/zone.js/commit/4942b4a)) <a name="0.6.13"></a> ## [0.6.13](https://github.com/angular/zone.js/compare/v0.6.12...v0.6.13) (2016-08-15) ### Bug Fixes - **browser:** make Object.defineProperty patch safer ([#392](https://github.com/angular/zone.js/issues/392)) ([597c634](https://github.com/angular/zone.js/commit/597c634)), closes [#391](https://github.com/angular/zone.js/issues/391) - **browser:** patch Window when EventTarget is missing. ([#368](https://github.com/angular/zone.js/issues/368)) ([fcef80d](https://github.com/angular/zone.js/commit/fcef80d)), closes [#367](https://github.com/angular/zone.js/issues/367) - **browser:** patchTimer cancelAnimationFrame ([#353](https://github.com/angular/zone.js/issues/353)) ([bf77fbb](https://github.com/angular/zone.js/commit/bf77fbb)), closes [#326](https://github.com/angular/zone.js/issues/326) [Leaflet/Leaflet#4588](https://github.com/Leaflet/Leaflet/issues/4588) - **browser:** should not throw with frozen prototypes ([#351](https://github.com/angular/zone.js/issues/351)) ([27ca2a9](https://github.com/angular/zone.js/commit/27ca2a9)) - **build:** fix broken master due to setTimeout not returning a number on node ([d43b4b8](https://github.com/angular/zone.js/commit/d43b4b8)) - **doc:** Fixed the home page example. ([#348](https://github.com/angular/zone.js/issues/348)) ([9a0aa4a](https://github.com/angular/zone.js/commit/9a0aa4a)) - throw if trying to load zone more then once. ([6df5f93](https://github.com/angular/zone.js/commit/6df5f93)) - **fakeAsync:** throw error on rejected promisees. ([fd1dfcc](https://github.com/angular/zone.js/commit/fd1dfcc)) - **promise:** allow Promise subclassing ([dafad98](https://github.com/angular/zone.js/commit/dafad98)) - **XHR.responseBlob:** don't access XHR.responseBlob on old android webkit ([#329](https://github.com/angular/zone.js/issues/329)) ([ed69756](https://github.com/angular/zone.js/commit/ed69756)) ### Features - return timeout Id in ZoneTask.toString (fixes [#341](https://github.com/angular/zone.js/issues/341)) ([80ae6a8](https://github.com/angular/zone.js/commit/80ae6a8)), closes [#375](https://github.com/angular/zone.js/issues/375) - **jasmine:** Switch jasmine patch to use microtask and preserve zone. ([5f519de](https://github.com/angular/zone.js/commit/5f519de)) - **ProxySpec:** create a ProxySpec which can proxy to other ZoneSpecs. ([2d02e39](https://github.com/angular/zone.js/commit/2d02e39)) - **zone:** Add Zone.getZone api ([0621014](https://github.com/angular/zone.js/commit/0621014)) <a name="0.6.12"></a> ## [0.6.12](https://github.com/angular/zone.js/compare/v0.6.11...v0.6.12) (2016-04-19) ### Bug Fixes - **property-descriptor:** do not fail for events without targets ([3a8deef](https://github.com/angular/zone.js/commit/3a8deef)) ### Features - Add a zone spec for fake async test zone. ([#330](https://github.com/angular/zone.js/issues/330)) ([34159b4](https://github.com/angular/zone.js/commit/34159b4)) <a name="0.6.11"></a> ## [0.6.11](https://github.com/angular/zone.js/compare/v0.6.9...v0.6.11) (2016-04-14) ### Bug Fixes - Suppress closure compiler warnings about unknown 'process' variable. ([e125173](https://github.com/angular/zone.js/commit/e125173)), closes [#295](https://github.com/angular/zone.js/issues/295) - **setTimeout:** fix for [#290](https://github.com/angular/zone.js/issues/290), allow clearTimeout to be called in setTimeout callback ([a6967ad](https://github.com/angular/zone.js/commit/a6967ad)), closes [#301](https://github.com/angular/zone.js/issues/301) - **WebSocket patch:** fix WebSocket constants copy ([#299](https://github.com/angular/zone.js/issues/299)) ([5dc4339](https://github.com/angular/zone.js/commit/5dc4339)) - **xhr:** XHR macrotasks allow abort after XHR has completed ([#311](https://github.com/angular/zone.js/issues/311)) ([c70f011](https://github.com/angular/zone.js/commit/c70f011)) - **zone:** remove debugger statement ([#292](https://github.com/angular/zone.js/issues/292)) ([01cec16](https://github.com/angular/zone.js/commit/01cec16)) - window undefined in node environments ([f8d5dc7](https://github.com/angular/zone.js/commit/f8d5dc7)), closes [#305](https://github.com/angular/zone.js/issues/305) ### Features - **zonespec:** add a spec for synchronous tests ([#294](https://github.com/angular/zone.js/issues/294)) ([55da3d8](https://github.com/angular/zone.js/commit/55da3d8)) - node/node ([29fc5d2](https://github.com/angular/zone.js/commit/29fc5d2)) <a name="0.6.9"></a>
{ "end_byte": 99288, "start_byte": 93027, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/CHANGELOG.md" }
angular/packages/zone.js/CHANGELOG.md_99288_102170
## [0.6.9](https://github.com/angular/zone.js/compare/v0.6.5...v0.6.9) (2016-04-04) ### Bug Fixes - Allow calling clearTimeout from within the setTimeout callback ([a8ea55d](https://github.com/angular/zone.js/commit/a8ea55d)), closes [#302](https://github.com/angular/zone.js/issues/302) - Canceling already run task should not double decrement task counter ([faa3485](https://github.com/angular/zone.js/commit/faa3485)), closes [#290](https://github.com/angular/zone.js/issues/290) - **xhr:** don't throw on an xhr which is aborted before sending ([8827e1e](https://github.com/angular/zone.js/commit/8827e1e)) - **zone:** remove debugger statement ([d7c116b](https://github.com/angular/zone.js/commit/d7c116b)) ### Features - **zonespec:** add a spec for synchronous tests ([0a6a434](https://github.com/angular/zone.js/commit/0a6a434)) - treat XHRs as macrotasks ([fd39f97](https://github.com/angular/zone.js/commit/fd39f97)) <a name="0.6.5"></a> ## [0.6.5](https://github.com/angular/zone.js/compare/v0.6.2...v0.6.5) (2016-03-21) ### Bug Fixes - disable safari 7 ([4a4d4f6](https://github.com/angular/zone.js/commit/4a4d4f6)) - **browser/utils:** calling removeEventListener twice with the same args should not cause errors ([1787339](https://github.com/angular/zone.js/commit/1787339)), closes [#283](https://github.com/angular/zone.js/issues/283) [#284](https://github.com/angular/zone.js/issues/284) - **patching:** call native cancel method ([5783663](https://github.com/angular/zone.js/commit/5783663)), closes [#278](https://github.com/angular/zone.js/issues/278) [#279](https://github.com/angular/zone.js/issues/279) - **utils:** add the ability to prevent the default action of onEvent (onclick, onpaste,etc..) by returning false. ([99940c3](https://github.com/angular/zone.js/commit/99940c3)), closes [#236](https://github.com/angular/zone.js/issues/236) - **WebSocket patch:** keep WebSocket constants ([f25b087](https://github.com/angular/zone.js/commit/f25b087)), closes [#267](https://github.com/angular/zone.js/issues/267) - **zonespec:** Do not crash on error if last task had no data ([0dba019](https://github.com/angular/zone.js/commit/0dba019)), closes [#281](https://github.com/angular/zone.js/issues/281) ### Features - **indexdb:** Added property patches and event target methods as well as tests for Indexed DB ([84a251f](https://github.com/angular/zone.js/commit/84a251f)), closes [#204](https://github.com/angular/zone.js/issues/204) - **zonespec:** add a spec for asynchronous tests ([aeeb05c](https://github.com/angular/zone.js/commit/aeeb05c)), closes [#275](https://github.com/angular/zone.js/issues/275) <a name="0.6.2"></a> ## [0.6.2](https://github.com/angular/zone.js/compare/v0.6.1...v0.6.2) (2016-03-03) <a name="0.6.1"></a> ## [0.6.1](https://github.com/angular/zone.js/compare/v0.6.0...v0.6.1) (2016-02-29) <a name="0.6.0"></a>
{ "end_byte": 102170, "start_byte": 99288, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/CHANGELOG.md" }
angular/packages/zone.js/CHANGELOG.md_102170_108313
# [0.6.0](https://github.com/angular/zone.js/compare/v0.5.15...v0.6.0) (2016-02-29) ### Chores - **everything:** Major Zone Rewrite/Reimplementation ([63d4552](https://github.com/angular/zone.js/commit/63d4552)) ### BREAKING CHANGES - everything: This is a brand new implementation which is not backwards compatible. <a name="0.5.15"></a> ## [0.5.15](https://github.com/angular/zone.js/compare/v0.5.14...v0.5.15) (2016-02-17) ### Bug Fixes - **WebWorker:** Patch WebSockets and XMLHttpRequest in WebWorker ([45a6bc1](https://github.com/angular/zone.js/commit/45a6bc1)), closes [#249](https://github.com/angular/zone.js/issues/249) - **WebWorker:** Patch WebSockets and XMLHttpRequest in WebWorker ([9041a3a](https://github.com/angular/zone.js/commit/9041a3a)), closes [#249](https://github.com/angular/zone.js/issues/249) <a name="0.5.14"></a> ## [0.5.14](https://github.com/angular/zone.js/compare/v0.5.11...v0.5.14) (2016-02-11) <a name="0.5.11"></a> ## [0.5.11](https://github.com/angular/zone.js/compare/v0.5.10...v0.5.11) (2016-01-27) ### Bug Fixes - correct incorrect example path in karma config ([b0a624d](https://github.com/angular/zone.js/commit/b0a624d)) - correct test relaying on jasmine timeout ([4f7d6ae](https://github.com/angular/zone.js/commit/4f7d6ae)) - **WebSocket:** don't patch EventTarget methods twice ([345e56c](https://github.com/angular/zone.js/commit/345e56c)), closes [#235](https://github.com/angular/zone.js/issues/235) ### Features - **wtf:** add wtf support to (set/clear)Timeout/Interval/Immediate ([6659fd5](https://github.com/angular/zone.js/commit/6659fd5)) <a name="0.5.10"></a> ## [0.5.10](https://github.com/angular/zone.js/compare/v0.5.9...v0.5.10) (2015-12-11) ### Bug Fixes - **keys:** Do not use Symbol which are broken in Chrome 39.0.2171 (Dartium) ([c48301b](https://github.com/angular/zone.js/commit/c48301b)) - **Promise:** Make sure we check for native Promise before es6-promise gets a chance to polyfill ([fa18d4c](https://github.com/angular/zone.js/commit/fa18d4c)) <a name="0.5.9"></a> ## [0.5.9](https://github.com/angular/zone.js/compare/v0.5.8...v0.5.9) (2015-12-09) ### Bug Fixes - **keys:** do not declare functions inside blocks ([d44d699](https://github.com/angular/zone.js/commit/d44d699)), closes [#194](https://github.com/angular/zone.js/issues/194) - **keys:** Symbol is being checked for type of function ([6714be6](https://github.com/angular/zone.js/commit/6714be6)) - **mutation-observe:** output of typeof operator should be string ([19703e3](https://github.com/angular/zone.js/commit/19703e3)) - **util:** origin addEventListener/removeEventListener should be called without eventListener ([26e7f51](https://github.com/angular/zone.js/commit/26e7f51)), closes [#198](https://github.com/angular/zone.js/issues/198) - **utils:** should have no effect when called addEventListener/removeEventListener without eventListener. ([5bcc6ae](https://github.com/angular/zone.js/commit/5bcc6ae)) <a name="0.5.8"></a> ## [0.5.8](https://github.com/angular/zone.js/compare/v0.5.7...v0.5.8) (2015-10-06) ### Bug Fixes - **addEventListener:** when called from the global scope ([a23d61a](https://github.com/angular/zone.js/commit/a23d61a)), closes [#190](https://github.com/angular/zone.js/issues/190) - **EventTarget:** apply the patch even if `Window` is not defined ([32c6df9](https://github.com/angular/zone.js/commit/32c6df9)) <a name="0.5.7"></a> ## [0.5.7](https://github.com/angular/zone.js/compare/v0.5.6...v0.5.7) (2015-09-29) ### Bug Fixes - **RequestAnimationFrame:** pass the timestamp to the callback ([79a37c0](https://github.com/angular/zone.js/commit/79a37c0)), closes [#187](https://github.com/angular/zone.js/issues/187) <a name="0.5.6"></a> ## [0.5.6](https://github.com/angular/zone.js/compare/v0.5.5...v0.5.6) (2015-09-25) ### Bug Fixes - **Jasmine:** add support for jasmine 2 done.fail() ([1d4370b](https://github.com/angular/zone.js/commit/1d4370b)), closes [#180](https://github.com/angular/zone.js/issues/180) - **utils:** fixes event target patch in web workers ([ad5c0c8](https://github.com/angular/zone.js/commit/ad5c0c8)) <a name="0.5.5"></a> ## [0.5.5](https://github.com/angular/zone.js/compare/v0.5.4...v0.5.5) (2015-09-11) ### Bug Fixes - **lib/utils:** adds compliant handling of useCapturing param for EventTarget methods ([dd2e1bf](https://github.com/angular/zone.js/commit/dd2e1bf)) - **lib/utils:** fixes incorrect behaviour when re-adding the same event listener fn ([1b804cf](https://github.com/angular/zone.js/commit/1b804cf)) - **longStackTraceZone:** modifies stackFramesFilter to exclude zone.js frames ([50ce9f3](https://github.com/angular/zone.js/commit/50ce9f3)) ### Features - **lib/core:** add/removeEventListener hooks ([1897440](https://github.com/angular/zone.js/commit/1897440)) - **lib/patch/file-reader:** zone-binds FileReader#onEventName listeners ([ce589b9](https://github.com/angular/zone.js/commit/ce589b9)), closes [#137](https://github.com/angular/zone.js/issues/137) <a name="0.5.4"></a> ## [0.5.4](https://github.com/angular/zone.js/compare/v0.5.3...v0.5.4) (2015-08-31) ### Bug Fixes - js path in examples ([c7a2ed9](https://github.com/angular/zone.js/commit/c7a2ed9)) - **zone:** fix conflict with Polymer elements ([77b4c0d](https://github.com/angular/zone.js/commit/77b4c0d)) ### Features - **patch:** support requestAnimationFrame time loops ([3d6dc08](https://github.com/angular/zone.js/commit/3d6dc08)) <a name="0.5.3"></a> ## [0.5.3](https://github.com/angular/zone.js/compare/v0.5.2...v0.5.3) (2015-08-21) ### Bug Fixes - **addEventListener patch:** ignore FunctionWrapper for IE11 & Edge dev tools ([3b0ca3f](https://github.com/angular/zone.js/commit/3b0ca3f)) - **utils:** event listener patches break when passed an object implementing EventListener ([af88ff8](https://github.com/angular/zone.js/commit/af88ff8)) - **WebWorker:** Fix patching in WebWorker ([2cc59d8](https://github.com/angular/zone.js/commit/2cc59d8)) ### Features - **zone.js:** support Android browser ([93b5555](https://github.com/angular/zone.js/commit/93b5555)) <a name="0.5.2"></a>
{ "end_byte": 108313, "start_byte": 102170, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/CHANGELOG.md" }
angular/packages/zone.js/CHANGELOG.md_108313_114792
## [0.5.2](https://github.com/angular/zone.js/compare/v0.5.1...v0.5.2) (2015-07-01) ### Bug Fixes - **jasmine patch:** forward timeout ([2dde717](https://github.com/angular/zone.js/commit/2dde717)) - **zone.bind:** throw an error if arg is not a function ([ee4262a](https://github.com/angular/zone.js/commit/ee4262a)) <a name="0.5.1"></a> ## [0.5.1](https://github.com/angular/zone.js/compare/v0.5.0...v0.5.1) (2015-06-10) ### Bug Fixes - **PatchClass:** copy static properties ([b91f8fe](https://github.com/angular/zone.js/commit/b91f8fe)), closes [#127](https://github.com/angular/zone.js/issues/127) - **register-element:** add check for callback being own property of opts ([8bce00e](https://github.com/angular/zone.js/commit/8bce00e)), closes [#52](https://github.com/angular/zone.js/issues/52) ### Features - **fetch:** patch the fetch API ([4d3d524](https://github.com/angular/zone.js/commit/4d3d524)), closes [#108](https://github.com/angular/zone.js/issues/108) - **geolocation:** patch the API ([cd13da1](https://github.com/angular/zone.js/commit/cd13da1)), closes [#113](https://github.com/angular/zone.js/issues/113) - **jasmine:** export the jasmine patch ([639d5e7](https://github.com/angular/zone.js/commit/639d5e7)) - **test:** serve lib/ files instead of dist/ ([f835213](https://github.com/angular/zone.js/commit/f835213)) - **zone.js:** support IE9+ ([554fae0](https://github.com/angular/zone.js/commit/554fae0)) <a name="0.5.0"></a> # [0.5.0](https://github.com/angular/zone.js/compare/v0.4.4...v0.5.0) (2015-05-08) ### Bug Fixes - always run jasmine's done callbacks for async tests in jasmine's zone ([b7f3d04](https://github.com/angular/zone.js/commit/b7f3d04)), closes [#91](https://github.com/angular/zone.js/issues/91) - don't fork new zones for callbacks from the root zone ([531d0ec](https://github.com/angular/zone.js/commit/531d0ec)), closes [#92](https://github.com/angular/zone.js/issues/92) - **MutationObserver:** executes hooks in the creation zone ([3122a48](https://github.com/angular/zone.js/commit/3122a48)) - **test:** fix an ineffective assertion ([d85d2cf](https://github.com/angular/zone.js/commit/d85d2cf)) - minor fixes ([18f5511](https://github.com/angular/zone.js/commit/18f5511)) ### Code Refactoring - split zone.js into CJS modules, add zone-microtask.js ([2e52900](https://github.com/angular/zone.js/commit/2e52900)) ### Features - **scheduling:** Prefer MutationObserver over Promise in FF ([038bdd9](https://github.com/angular/zone.js/commit/038bdd9)) - **scheduling:** Support Promise.then() fallbacks to enqueue a microtask ([74eff1c](https://github.com/angular/zone.js/commit/74eff1c)) - add isRootZone api ([bf925bf](https://github.com/angular/zone.js/commit/bf925bf)) - make root zone id to be 1 ([605e213](https://github.com/angular/zone.js/commit/605e213)) ### BREAKING CHANGES - New child zones are now created only from a async task that installed a custom zone. Previously even without a custom zone installed (e.g. LongStacktracesZone), we would spawn new child zones for all asynchronous events. This is undesirable and generally not useful. It does not make sense for us to create new zones for callbacks from the root zone since we care only about callbacks from installed custom zones. This reduces the overhead of zones. This primarily means that LongStackTraces zone won't be able to trace events back to Zone.init(), but instead the starting point will be the installation of the LongStacktracesZone. In all practical situations this should be sufficient. - zone.js as well as \*-zone.js files are moved from / to dist/ <a name="0.4.4"></a> ## [0.4.4](https://github.com/angular/zone.js/compare/v0.4.3...v0.4.4) (2015-05-07) ### Bug Fixes - commonjs wrapper ([7b4fdde](https://github.com/angular/zone.js/commit/7b4fdde)), closes [#19](https://github.com/angular/zone.js/issues/19) - fork the zone in first example (README) ([7b6e8ed](https://github.com/angular/zone.js/commit/7b6e8ed)) - prevent aliasing original window reference ([63b42bd](https://github.com/angular/zone.js/commit/63b42bd)) - use strcit mode for the zone.js code only ([16855e5](https://github.com/angular/zone.js/commit/16855e5)) - **test:** use console.log rather than dump in tests ([490e6dd](https://github.com/angular/zone.js/commit/490e6dd)) - **websockets:** patch websockets via descriptors ([d725f46](https://github.com/angular/zone.js/commit/d725f46)), closes [#81](https://github.com/angular/zone.js/issues/81) - **websockets:** properly patch websockets in Safari 7.0 ([3ba6fa1](https://github.com/angular/zone.js/commit/3ba6fa1)), closes [#88](https://github.com/angular/zone.js/issues/88) - **websockets:** properly patch websockets on Safari 7.1 ([1799a20](https://github.com/angular/zone.js/commit/1799a20)) ### Features - add websockets example ([edb17d2](https://github.com/angular/zone.js/commit/edb17d2)) - log a warning if we suspect duplicate Zone install ([657f6fe](https://github.com/angular/zone.js/commit/657f6fe)) <a name="0.4.3"></a> ## [0.4.3](https://github.com/angular/zone.js/compare/v0.4.2...v0.4.3) (2015-04-08) ### Bug Fixes - **zone:** keep argument[0] refs around. ([48573ff](https://github.com/angular/zone.js/commit/48573ff)) <a name="0.4.2"></a> ## [0.4.2](https://github.com/angular/zone.js/compare/v0.4.1...v0.4.2) (2015-03-27) ### Bug Fixes - **zone.js:** don't make function declaration in block scope ([229fd8f](https://github.com/angular/zone.js/commit/229fd8f)), closes [#53](https://github.com/angular/zone.js/issues/53) [#54](https://github.com/angular/zone.js/issues/54) ### Features - **bindPromiseFn:** add bindPromiseFn method ([643f2ac](https://github.com/angular/zone.js/commit/643f2ac)), closes [#49](https://github.com/angular/zone.js/issues/49) - **lstz:** allow getLongStacktrace to be called with zero args ([26a4dc2](https://github.com/angular/zone.js/commit/26a4dc2)), closes [#47](https://github.com/angular/zone.js/issues/47) - **Zone:** add unique id to each zone ([fb338b6](https://github.com/angular/zone.js/commit/fb338b6)), closes [#45](https://github.com/angular/zone.js/issues/45) <a name="0.4.1"></a> ## [0.4.1](https://github.com/angular/zone.js/compare/v0.4.0...v0.4.1) (2015-02-20) ### Bug Fixes - **patchViaPropertyDescriptor:** disable if properties are not configurable ([fb5e644](https://github.com/angular/zone.js/commit/fb5e644)), closes [#42](https://github.com/angular/zone.js/issues/42) <a name="0.4.0"></a>
{ "end_byte": 114792, "start_byte": 108313, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/CHANGELOG.md" }
angular/packages/zone.js/CHANGELOG.md_114792_119897
# [0.4.0](https://github.com/angular/zone.js/compare/v0.3.0...v0.4.0) (2015-02-04) ### Bug Fixes - **WebSocket:** patch WebSocket instance ([7b8e1e6](https://github.com/angular/zone.js/commit/7b8e1e6)) <a name="0.3.0"></a> # [0.3.0](https://github.com/angular/zone.js/compare/v0.2.4...v0.3.0) (2014-06-12) ### Bug Fixes - add events for webgl contexts ([4b6e411](https://github.com/angular/zone.js/commit/4b6e411)) - bind prototype chain callback of custom element descriptor ([136e518](https://github.com/angular/zone.js/commit/136e518)) - dequeue tasks from the zone that enqueued it ([f127fd4](https://github.com/angular/zone.js/commit/f127fd4)) - do not reconfig property descriptors of prototypes ([e9dfbed](https://github.com/angular/zone.js/commit/e9dfbed)) - patch property descriptors in Object.create ([7b7258b](https://github.com/angular/zone.js/commit/7b7258b)), closes [#24](https://github.com/angular/zone.js/issues/24) - support mozRequestAnimationFrame ([886f67d](https://github.com/angular/zone.js/commit/886f67d)) - wrap non-configurable custom element callbacks ([383b479](https://github.com/angular/zone.js/commit/383b479)), closes [#24](https://github.com/angular/zone.js/issues/24) - wrap Object.defineProperties ([f587f17](https://github.com/angular/zone.js/commit/f587f17)), closes [#24](https://github.com/angular/zone.js/issues/24) <a name="0.2.4"></a> ## [0.2.4](https://github.com/angular/zone.js/compare/v0.2.3...v0.2.4) (2014-05-23) <a name="0.2.3"></a> ## [0.2.3](https://github.com/angular/zone.js/compare/v0.2.2...v0.2.3) (2014-05-23) ### Bug Fixes - remove dump ([45fb7ba](https://github.com/angular/zone.js/commit/45fb7ba)) <a name="0.2.2"></a> ## [0.2.2](https://github.com/angular/zone.js/compare/v0.2.1...v0.2.2) (2014-05-22) ### Bug Fixes - correctly detect support for document.registerElement ([ab1d487](https://github.com/angular/zone.js/commit/ab1d487)) - dont automagically dequeue on setInterval ([da99e15](https://github.com/angular/zone.js/commit/da99e15)) - fork should deep clone objects ([21b47ae](https://github.com/angular/zone.js/commit/21b47ae)) - support MutationObserver.disconnect ([ad711b8](https://github.com/angular/zone.js/commit/ad711b8)) ### Features - add stackFramesFilter to longStackTraceZone ([7133de0](https://github.com/angular/zone.js/commit/7133de0)) - expose hooks for enqueuing and dequing tasks ([ba72f34](https://github.com/angular/zone.js/commit/ba72f34)) - improve countingZone and example ([86328fb](https://github.com/angular/zone.js/commit/86328fb)) - support document.registerElement ([d3c785a](https://github.com/angular/zone.js/commit/d3c785a)), closes [#18](https://github.com/angular/zone.js/issues/18) <a name="0.2.1"></a> ## [0.2.1](https://github.com/angular/zone.js/compare/v0.2.0...v0.2.1) (2014-04-24) ### Bug Fixes - add support for WebKitMutationObserver ([d1a2c8e](https://github.com/angular/zone.js/commit/d1a2c8e)) - preserve setters when wrapping XMLHttpRequest ([fb46688](https://github.com/angular/zone.js/commit/fb46688)), closes [#17](https://github.com/angular/zone.js/issues/17) <a name="0.2.0"></a> # [0.2.0](https://github.com/angular/zone.js/compare/v0.1.1...v0.2.0) (2014-04-17) ### Bug Fixes - patch all properties on the proto chain ([b6d76f0](https://github.com/angular/zone.js/commit/b6d76f0)) - patch MutationObserver ([1c4e85e](https://github.com/angular/zone.js/commit/1c4e85e)) - wrap XMLHttpRequest when we cant patch protos ([76de58e](https://github.com/angular/zone.js/commit/76de58e)) ### Features - add exceptZone ([b134391](https://github.com/angular/zone.js/commit/b134391)) <a name="0.1.1"></a> ## [0.1.1](https://github.com/angular/zone.js/compare/v0.1.0...v0.1.1) (2014-03-31) ### Features - add commonjs support ([0fe349e](https://github.com/angular/zone.js/commit/0fe349e)) <a name="0.1.0"></a> # [0.1.0](https://github.com/angular/zone.js/compare/v0.0.0...v0.1.0) (2014-03-31) ### Bug Fixes - improve patching browsers with EventTarget ([7d3a8b1](https://github.com/angular/zone.js/commit/7d3a8b1)) - improve stacktrace capture on Safari ([46a6fbc](https://github.com/angular/zone.js/commit/46a6fbc)) - long stack trace test ([01ce3b3](https://github.com/angular/zone.js/commit/01ce3b3)) - prevent calling addEventListener on non-functions ([7acebca](https://github.com/angular/zone.js/commit/7acebca)) - throw if a zone does not define an onError hook ([81d5f49](https://github.com/angular/zone.js/commit/81d5f49)) - throw if a zone does not define an onError hook ([3485c1b](https://github.com/angular/zone.js/commit/3485c1b)) ### Features - add decorator syntax ([c6202a1](https://github.com/angular/zone.js/commit/c6202a1)) - add onZoneCreated hook ([f7badb6](https://github.com/angular/zone.js/commit/f7badb6)) - patch onclick in Chrome and Safari ([7205295](https://github.com/angular/zone.js/commit/7205295)) - refactor and test counting zone ([648a95d](https://github.com/angular/zone.js/commit/648a95d)) - support Promise ([091f44e](https://github.com/angular/zone.js/commit/091f44e)) <a name="0.0.0"></a> # 0.0.0 (2013-09-18)
{ "end_byte": 119897, "start_byte": 114792, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/CHANGELOG.md" }
angular/packages/zone.js/sauce.conf.js_0_4084
// Sauce configuration module.exports = function (config, ignoredLaunchers) { // The WS server is not available with Sauce config.files.unshift('test/saucelabs.js'); var basicLaunchers = { 'SL_CHROME': {base: 'SauceLabs', browserName: 'chrome', version: '48'}, 'SL_CHROME_65': {base: 'SauceLabs', browserName: 'chrome', version: '60'}, 'SL_FIREFOX': {base: 'SauceLabs', browserName: 'firefox', version: '52'}, 'SL_FIREFOX_59': {base: 'SauceLabs', browserName: 'firefox', version: '54'}, /*'SL_SAFARI7': { base: 'SauceLabs', browserName: 'safari', platform: 'OS X 10.9', version: '7.0' },*/ //'SL_SAFARI8': // {base: 'SauceLabs', browserName: 'safari', platform: 'OS X 10.10', version: '8.0'}, 'SL_SAFARI9': { base: 'SauceLabs', browserName: 'safari', platform: 'OS X 10.11', version: '9.0', }, 'SL_SAFARI10': { base: 'SauceLabs', browserName: 'safari', platform: 'OS X 10.11', version: '10.0', }, /* no longer supported in SauceLabs 'SL_IOS7': { base: 'SauceLabs', browserName: 'iphone', platform: 'OS X 10.10', version: '7.1' },*/ /*'SL_IOS8': { base: 'SauceLabs', browserName: 'iphone', platform: 'OS X 10.10', version: '8.4' },*/ // 'SL_IOS9': {base: 'SauceLabs', browserName: 'iphone', platform: 'OS X 10.10', version: // '9.3'}, 'SL_IOS10': {base: 'SauceLabs', browserName: 'iphone', platform: 'OS X 10.10', version: '10.3'}, 'SL_MSEDGE': { base: 'SauceLabs', browserName: 'MicrosoftEdge', platform: 'Windows 10', version: '14.14393', }, 'SL_MSEDGE15': { base: 'SauceLabs', browserName: 'MicrosoftEdge', platform: 'Windows 10', version: '15.15063', }, /* fix issue #584, Android 4.1~4.3 are not supported 'SL_ANDROID4.1': { base: 'SauceLabs', browserName: 'android', platform: 'Linux', version: '4.1' }, 'SL_ANDROID4.2': { base: 'SauceLabs', browserName: 'android', platform: 'Linux', version: '4.2' }, 'SL_ANDROID4.3': { base: 'SauceLabs', browserName: 'android', platform: 'Linux', version: '4.3' },*/ // 'SL_ANDROID4.4': {base: 'SauceLabs', browserName: 'android', platform: 'Linux', version: // '4.4'}, 'SL_ANDROID5.1': {base: 'SauceLabs', browserName: 'android', platform: 'Linux', version: '5.1'}, 'SL_ANDROID6.0': {base: 'SauceLabs', browserName: 'android', platform: 'Linux', version: '6.0'}, 'SL_ANDROID8.0': { base: 'SauceLabs', browserName: 'Chrome', appiumVersion: '1.12.1', platformName: 'Android', deviceName: 'Android GoogleAPI Emulator', platformVersion: '8.0', }, }; var customLaunchers = {}; if (!ignoredLaunchers) { customLaunchers = basicLaunchers; } else { Object.keys(basicLaunchers).forEach(function (key) { if ( ignoredLaunchers.filter(function (ignore) { return ignore === key; }).length === 0 ) { customLaunchers[key] = basicLaunchers[key]; } }); } config.set({ captureTimeout: 120000, browserNoActivityTimeout: 240000, sauceLabs: { testName: 'Zone.js', startConnect: false, recordVideo: false, recordScreenshots: false, options: { 'selenium-version': '2.53.0', 'command-timeout': 600, 'idle-timeout': 600, 'max-duration': 5400, }, }, customLaunchers: customLaunchers, browsers: Object.keys(customLaunchers), reporters: ['dots', 'saucelabs'], singleRun: true, plugins: ['karma-*'], }); if (process.env.TRAVIS) { config.sauceLabs.build = 'TRAVIS #' + process.env.TRAVIS_BUILD_NUMBER + ' (' + process.env.TRAVIS_BUILD_ID + ')'; config.sauceLabs.tunnelIdentifier = process.env.TRAVIS_JOB_NUMBER; process.env.SAUCE_ACCESS_KEY = process.env.SAUCE_ACCESS_KEY.split('').reverse().join(''); } };
{ "end_byte": 4084, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/sauce.conf.js" }
angular/packages/zone.js/karma-dist-sauce-jasmine.es2015.conf.js_0_991
module.exports = function (config) { require('./karma-dist-jasmine.conf.js')(config); require('./sauce.es2015.conf')(config); config.files.push('build/test/wtf_mock.js'); config.files.push('build/test/test_fake_polyfill.js'); config.files.push('build/test/custom_error.js'); config.files.push({pattern: 'dist/zone-evergreen.js', type: 'module'}); config.files.push('dist/zone-patch-canvas.js'); config.files.push('dist/zone-patch-fetch.js'); config.files.push('dist/webapis-media-query.js'); config.files.push('dist/webapis-notification.js'); config.files.push('dist/zone-patch-user-media.js'); config.files.push('dist/zone-patch-resize-observer.js'); config.files.push('dist/task-tracking.js'); config.files.push('dist/wtf.js'); config.files.push('dist/zone-testing.js'); config.files.push('build/test/test-env-setup-jasmine.js'); config.files.push('build/lib/common/error-rewrite.js'); config.files.push('build/test/browser/custom-element.spec.js'); };
{ "end_byte": 991, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/karma-dist-sauce-jasmine.es2015.conf.js" }
angular/packages/zone.js/zone.ts_0_97
import './lib/zone'; import './lib/zone.api.extensions'; import './lib/zone.configurations.api';
{ "end_byte": 97, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/zone.ts" }
angular/packages/zone.js/MODULE.md_0_8989
# Modules Starting from zone.js v0.8.9, you can choose which web API modules you want to patch as to reduce overhead introduced by the patching of these modules. For example, the below samples show how to disable some modules. You just need to define a few global variables before loading zone.js. ```html <script> __Zone_disable_Error = true; // Zone will not patch Error __Zone_disable_on_property = true; // Zone will not patch `on` properties such as button.onclick __Zone_disable_geolocation = true; // Zone will not patch geolocation API __Zone_disable_toString = true; // Zone will not patch Function.prototype.toString __Zone_disable_blocking = true; // Zone will not patch alert/prompt/confirm __Zone_disable_PromiseRejectionEvent = true; // Zone will not patch PromiseRejectionEventHandler </script> <script src="../bundles/zone.umd.js"></script> ``` Below is the full list of currently supported modules. ### Common | Module Name | Behavior with zone.js patch | How to disable | | ---------------- | ----------------------------------------------------------------------------------------------------------------------- | ---------------------------------------- | | Error | stack frames will have the Zone's name information, (By default, Error patch will not be loaded by zone.js) | \_\_Zone_disable_Error = true | | toString | Function.toString will be patched to return native version of toString | \_\_Zone_disable_toString = true | | ZoneAwarePromise | Promise.then will be patched as Zone aware MicroTask | \_\_Zone_disable_ZoneAwarePromise = true | | bluebird | Bluebird will use Zone.scheduleMicroTask as async scheduler. (By default, bluebird patch will not be loaded by zone.js) | \_\_Zone_disable_bluebird = true | ### Browser | Module Name | Behavior with zone.js patch | How to disable | | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------- | | on_property | target.onProp will become zone aware target.addEventListener(prop) | \_\_Zone_disable_on_property = true | | timers | setTimeout/setInterval/setImmediate will be patched as Zone MacroTask | \_\_Zone_disable_timers = true | | requestAnimationFrame | requestAnimationFrame will be patched as Zone MacroTask | \_\_Zone_disable_requestAnimationFrame = true | | blocking | alert/prompt/confirm will be patched as Zone.run | \_\_Zone_disable_blocking = true | | EventTarget | target.addEventListener will be patched as Zone aware EventTask | \_\_Zone_disable_EventTarget = true | | MutationObserver | MutationObserver will be patched as Zone aware operation | \_\_Zone_disable_MutationObserver = true | | IntersectionObserver | Intersection will be patched as Zone aware operation | \_\_Zone_disable_IntersectionObserver = true | | FileReader | FileReader will be patched as Zone aware operation | \_\_Zone_disable_FileReader = true | | canvas | HTMLCanvasElement.toBlob will be patched as Zone aware operation | \_\_Zone_disable_canvas = true | | IE BrowserTools check | in IE, browser tool will not use zone patched eventListener | \_\_Zone_disable_IE_check = true | | CrossContext check | in webdriver, enable check event listener is cross context | \_\_Zone_enable_cross_context_check = true | | `beforeunload` | enable the default `beforeunload` handling behavior, where event handlers return strings to prompt the user | **zone_symbol**enable_beforeunload = true | | XHR | XMLHttpRequest will be patched as Zone aware MacroTask | \_\_Zone_disable_XHR = true | | geolocation | navigator.geolocation's prototype will be patched as Zone.run | \_\_Zone_disable_geolocation = true | | PromiseRejectionEvent | PromiseRejectEvent will fire when ZoneAwarePromise has unhandled error | \_\_Zone_disable_PromiseRejectionEvent = true | | mediaQuery | mediaQuery addListener API will be patched as Zone aware EventTask. (By default, mediaQuery patch will not be loaded by zone.js) | \_\_Zone_disable_mediaQuery = true | | notification | notification onProperties API will be patched as Zone aware EventTask. (By default, notification patch will not be loaded by zone.js) | \_\_Zone_disable_notification = true | | MessagePort | MessagePort onProperties APIs will be patched as Zone aware EventTask. (By default, MessagePort patch will not be loaded by zone.js) | \_\_Zone_disable_MessagePort = true | ### Node.js | Module Name | Behavior with zone.js patch | How to disable | | ------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------- | | node_timers | NodeJS patch timer | \_\_Zone_disable_node_timers = true | | fs | NodeJS patch fs function as macroTask | \_\_Zone_disable_fs = true | | EventEmitter | NodeJS patch EventEmitter as Zone aware EventTask | \_\_Zone_disable_EventEmitter = true | | nextTick | NodeJS patch process.nextTick as microTask | \_\_Zone_disable_nextTick = true | | handleUnhandledPromiseRejection | NodeJS handle unhandledPromiseRejection from ZoneAwarePromise | \_\_Zone_disable_handleUnhandledPromiseRejection = true | | crypto | NodeJS patch crypto function as macroTask | \_\_Zone_disable_crypto = true | ### Test Framework | Module Name | Behavior with zone.js patch | How to disable | | ----------- | --------------------------- | ------------------------------- | | Jasmine | Jasmine APIs patch | \_\_Zone_disable_jasmine = true | | Mocha | Mocha APIs patch | \_\_Zone_disable_mocha = true | ### `on` properties You can also disable specific `on` properties by setting `__Zone_ignore_on_properties` as follows. For example, if you want to disable `window.onmessage` and `HTMLElement.prototype.onclick` from zone.js patching, you can do so like this: ```html <script> __Zone_ignore_on_properties = [ { target: window, ignoreProperties: ['message'], }, { target: HTMLElement.prototype, ignoreProperties: ['click'], }, ]; </script> <script src="../bundles/zone.umd.js"></script> ``` Excluding `on` properties from being patched means that callbacks will always be invoked within the root context, regardless of where the `on` callback has been set. Even if `onclick` is set within a child zone, the callback will be called inside the root zone: ```ts Zone.current.fork({ name: 'child' }).run(() => { document.body.onclick = () => { console.log(Zone.current); // <root> }; }); ``` You can find more information on adding unpatched events via `addEventListener`, please refer to [UnpatchedEvents](./STANDARD-APIS.md#unpatchedevents).
{ "end_byte": 8989, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/MODULE.md" }
angular/packages/zone.js/MODULE.md_8989_11565
### Error By default, `zone.js/plugins/zone-error` will not be loaded for performance reasons. This package provides the following functionality: 1. **Error Inheritance:** Handle the `extend Error` issue: ```ts class MyError extends Error {} const myError = new MyError(); console.log('is MyError instanceof Error', (myError instanceof Error)); ``` Without the `zone-error` patch, the example above will output `false`. With the patch, the result will be `true`. 2. **ZoneJsInternalStackFrames:** Remove the zone.js stack from `stackTrace` and add `zone` information. Without this patch, many `zone.js` invocation stacks will be displayed in the stack frames. ``` at zone.run (polyfill.bundle.js: 3424) at zoneDelegate.invokeTask (polyfill.bundle.js: 3424) at zoneDelegate.runTask (polyfill.bundle.js: 3424) at zone.drainMicroTaskQueue (polyfill.bundle.js: 3424) at a.b.c (vendor.bundle.js: 12345 <angular>) at d.e.f (main.bundle.js: 23456) ``` With this patch, those zone frames will be removed, and the zone information `<angular>/<root>` will be added. ``` at a.b.c (vendor.bundle.js: 12345 <angular>) at d.e.f (main.bundle.js: 23456 <root>) ``` The second feature may slow down `Error` performance, so `zone.js` provides a flag that allows you to control this behavior. The flag is `__Zone_Error_ZoneJsInternalStackFrames_policy`. The available options are: 1. **default:** This is the default setting. If you load `zone.js/plugins/zone-error` without setting the flag, `default` will be used. In this case, `ZoneJsInternalStackFrames` will be available when using `new Error()`, allowing you to obtain an `error.stack` that is zone-stack-free. However, this may slightly slow down the performance of new `Error()`. 2. **disable:** This option will disable the `ZoneJsInternalStackFrames` feature. If you load `zone.js/plugins/zone-error`, you will only receive a wrapped `Error`, which can handle the `Error` inheritance issue. 3. **lazy:** This feature allows you to access `ZoneJsInternalStackFrames` without impacting performance. However, as a trade-off, you won't be able to obtain the zone-free stack frames via `error.stack`. You can only access them through `error.zoneAwareStack`. ### Angular Angular uses zone.js to manage asynchronous operations and determine when to perform change detection. Therefore, in Angular, the following APIs should be patched; otherwise, Angular may not work as expected: 1. ZoneAwarePromise 2. timer 3. on_property 4. EventTarget 5. XHR
{ "end_byte": 11565, "start_byte": 8989, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/MODULE.md" }
angular/packages/zone.js/karma-base.conf.js_0_1701
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ module.exports = function (config) { config.set({ basePath: '', client: {errorpolicy: config.errorpolicy}, files: [ 'node_modules/systemjs/dist/system-polyfills.js', 'node_modules/systemjs/dist/system.src.js', 'node_modules/whatwg-fetch/fetch.js', {pattern: 'node_modules/rxjs/**/**/*.js', included: false, watched: false}, {pattern: 'node_modules/rxjs/**/**/*.js.map', included: false, watched: false}, {pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false}, {pattern: 'node_modules/es6-promise/**/*.js', included: false, watched: false}, {pattern: 'node_modules/core-js/**/*.js', included: false, watched: false}, {pattern: 'node_modules/rxjs/**/*.js.map', included: false, watched: false}, {pattern: 'test/assets/**/*.*', watched: true, served: true, included: false}, {pattern: 'build/**/*.js.map', watched: true, served: true, included: false}, {pattern: 'build/**/*.js', watched: true, served: true, included: false}, ], plugins: [ require('karma-chrome-launcher'), require('karma-firefox-launcher'), require('karma-sourcemap-loader'), ], preprocessors: {'**/*.js': ['sourcemap']}, exclude: ['test/microtasks.spec.ts'], reporters: ['progress'], // port: 9876, colors: true, logLevel: config.LOG_INFO, browsers: ['Chrome'], captureTimeout: 60000, retryLimit: 4, autoWatch: true, singleRun: false, }); };
{ "end_byte": 1701, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/karma-base.conf.js" }
angular/packages/zone.js/tools.bzl_0_2710
"""Provides the rollup and dist file generation macro.""" load("//tools:defaults.bzl", "rollup_bundle") def zone_rollup_bundle(module_name, entry_point): config_file = "//packages/zone.js:rollup.config.js" rollup_bundle( name = module_name + "-rollup", config_file = config_file, entry_point = entry_point + ".ts", silent = True, sourcemap = "false", deps = [ "//packages/zone.js/lib", "@npm//@rollup/plugin-commonjs", "@npm//@rollup/plugin-node-resolve", "@npm//magic-string", ], ) def copy_dist(module_name, module_format, output_module_name, suffix, umd): umd_output = umd suffix_output = suffix if umd == "umd": umd_output = "umd." if suffix == "min": suffix_output = "min." native.genrule( name = module_name + "." + suffix_output + "dist", srcs = [ "//packages/zone.js:" + module_name + "-rollup." + suffix_output + module_format, ], outs = [ output_module_name + "." + umd_output + suffix_output + "js", ], visibility = ["//visibility:public"], cmd = "cp $< $@", ) def generate_rollup_bundle(bundles): for b in bundles.items(): module_name = b[0] rollup_config = b[1] if rollup_config.get("entrypoint") != None: entry_point = rollup_config.get("entrypoint") zone_rollup_bundle( module_name = module_name + "-es5", entry_point = entry_point, ) zone_rollup_bundle( module_name = module_name + "-es2015", entry_point = entry_point, ) else: zone_rollup_bundle( module_name = module_name + "-es5", entry_point = rollup_config.get("es5"), ) zone_rollup_bundle( module_name = module_name + "-es2015", entry_point = rollup_config.get("es2015"), ) def generate_dist(bundles, output_format, umd): module_format = "esm.js" if output_format == "es5": module_format = "es5umd.js" for b in bundles: module_name = b[0] copy_dist( module_name = module_name + "-" + output_format, module_format = module_format, output_module_name = module_name, suffix = "", umd = umd, ) copy_dist( module_name = module_name + "-" + output_format, module_format = module_format, output_module_name = module_name, suffix = "min.", umd = umd, )
{ "end_byte": 2710, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/tools.bzl" }
angular/packages/zone.js/DEVELOPER.md_0_3079
To run tests ------------ *Note*: some of these tests no longer run. Be sure to check that CI is green. Make sure your environment is set up with: `yarn` In a separate process, run the WebSockets server: `yarn ws-server` Run the browser tests using Karma: `yarn test` Run the node.js tests: `yarn test-node` Run tslint: `yarn lint` Run format with prettier: `yarn format` Run all checks (lint/format/browser test/test-node): `yarn ci` Before Commit ------------ Please make sure you pass all following checks before commit - yarn gulp lint (tslint) - yarn gulp format (prettier) - yarn promisetest (promise a+ test) - yarn bazel test //packages/zone.js/... (all tests) Webdriver Test -------------- `zone.js` also supports running webdriver e2e tests. 1. run locally ``` yarn webdriver-start yarn webdriver-http yarn webdriver-test ``` 2. run locally with sauce connect ``` // export SAUCE_USERNAME and SAUCE_ACCESS_KEY export SAUCE_USERNAME=XXXX export SAUCE_ACCESS_KEY=XXX sc -u $SAUCE_USERNAME -k $SAUCE_ACCESS_KEY yarn webdriver-http yarn webdriver-sauce-test ``` Releasing --------- Releasing `zone.js` is a two step process. 1. Create a PR which updates the changelog, and get it merged using normal merge process. 2. Once the PR is merged check out the merge SHA of the PR and release `zone.js` from that SHA and tag it. #### 1. Creating a PR for release ``` rm -rf node_modules && yarn install export PREVIOUS_ZONE_TAG=`git tag -l 'zone.js-0.15.*' | tail -n1` export VERSION=`(cd packages/zone.js; npm version patch --no-git-tag-version)` export VERSION=${VERSION#v} export TAG="zone.js-${VERSION}" echo "Releasing zone.js version ${TAG}. Last release was ${PREVIOUS_ZONE_TAG}." yarn gulp changelog:zonejs ``` Inspect the `packages/zone.js/CHANGELOG.md` for any issues and than commit it with this command. Create a dry run build to make sure everything is ready. ``` yarn bazel --output_base=$(mktemp -d) run //packages/zone.js:npm_package.pack --workspace_status_command="echo STABLE_PROJECT_VERSION $VERSION" ``` If everything looks good, commit the changes and push them to your origin to create a PR. ``` git checkout -b "release_${TAG}" git add packages/zone.js/CHANGELOG.md packages/zone.js/package.json git commit -m "release: cut the ${TAG} release" git push origin "release_${TAG}" ``` #### 2. Cutting a release Check out the SHA on main which has the changelog commit of the zone.js ``` git fetch upstream git checkout upstream/main rm -rf node_modules && yarn install export VERSION=`(node -e "console.log(require('./packages/zone.js/package.json').version)")` export TAG="zone.js-${VERSION}" export SHA=`git log upstream/main --oneline -n 1000 | grep "release: cut the ${TAG} release" | cut -f 1 -d " "` echo "Releasing '$VERSION' which will be tagged as '$TAG' from SHA '$SHA'." git checkout ${SHA} npm login --registry https://wombat-dressing-room.appspot.com yarn bazel -- run --config=release -- //packages/zone.js:npm_package.publish --access public --tag latest git tag ${TAG} ${SHA} git push upstream ${TAG} ```
{ "end_byte": 3079, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/DEVELOPER.md" }
angular/packages/zone.js/karma-evergreen-dist-jasmine.conf.js_0_180
module.exports = function (config) { require('./karma-evergreen-dist.conf.js')(config); config.plugins.push(require('karma-jasmine')); config.frameworks.push('jasmine'); };
{ "end_byte": 180, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/karma-evergreen-dist-jasmine.conf.js" }
angular/packages/zone.js/karma-evergreen-dist-sauce-jasmine.conf.js_0_350
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ module.exports = function (config) { require('./karma-evergreen-dist-jasmine.conf.js')(config); require('./sauce-evergreen.conf')(config); };
{ "end_byte": 350, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/karma-evergreen-dist-sauce-jasmine.conf.js" }
angular/packages/zone.js/karma-build.conf.js_0_584
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ module.exports = function (config) { require('./karma-base.conf.js')(config); config.files.push('build/test/browser-env-setup.js'); config.files.push('build/test/wtf_mock.js'); config.files.push('build/test/test_fake_polyfill.js'); config.files.push('build/lib/zone.js'); config.files.push('build/lib/common/promise.js'); config.files.push('build/test/main.js'); };
{ "end_byte": 584, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/karma-build.conf.js" }
angular/packages/zone.js/bundles.bzl_0_3094
""" Describe all the output bundles in the zone.js npm package by mapping the bundle name to the source location. """ _DIR = "//packages/zone.js/lib:" BUNDLES_ENTRY_POINTS = { "zone": { "es5": _DIR + "browser/rollup-main", "es2015": _DIR + "browser/rollup-main", }, "zone-mix": { "entrypoint": _DIR + "mix/rollup-mix", }, "zone-node": { "entrypoint": _DIR + "node/rollup-main", }, "async-test": { "entrypoint": _DIR + "testing/async-testing", }, "fake-async-test": { "entrypoint": _DIR + "testing/fake-async", }, "long-stack-trace-zone": { "entrypoint": _DIR + "zone-spec/rollup-long-stack-trace", }, "proxy": { "entrypoint": _DIR + "zone-spec/rollup-proxy", }, "zone-patch-rxjs-fake-async": { "entrypoint": _DIR + "zone-spec/rollup-proxy", }, "sync-test": { "entrypoint": _DIR + "zone-spec/rollup-sync-test", }, "task-tracking": { "entrypoint": _DIR + "zone-spec/rollup-task-tracking", }, "wtf": { "entrypoint": _DIR + "zone-spec/rollup-wtf", }, "zone-error": { "entrypoint": _DIR + "common/rollup-error-rewrite", }, "zone-legacy": { "entrypoint": _DIR + "browser/rollup-browser-legacy", }, "zone-bluebird": { "entrypoint": _DIR + "extra/rollup-bluebird", }, "zone-patch-canvas": { "entrypoint": _DIR + "browser/rollup-canvas", }, "zone-patch-cordova": { "entrypoint": _DIR + "extra/rollup-cordova", }, "zone-patch-electron": { "entrypoint": _DIR + "extra/rollup-electron", }, "zone-patch-fetch": { "entrypoint": _DIR + "common/rollup-fetch", }, "jasmine-patch": { "entrypoint": _DIR + "jasmine/rollup-jasmine", }, "zone-patch-jsonp": { "entrypoint": _DIR + "extra/rollup-jsonp", }, "webapis-media-query": { "entrypoint": _DIR + "browser/rollup-webapis-media-query", }, "mocha-patch": { "entrypoint": _DIR + "mocha/rollup-mocha", }, "webapis-notification": { "entrypoint": _DIR + "browser/rollup-webapis-notification", }, "zone-patch-promise-test": { "entrypoint": _DIR + "testing/rollup-promise-testing", }, "zone-patch-resize-observer": { "entrypoint": _DIR + "browser/rollup-webapis-resize-observer", }, "webapis-rtc-peer-connection": { "entrypoint": _DIR + "browser/rollup-webapis-rtc-peer-connection", }, "zone-patch-rxjs": { "entrypoint": _DIR + "rxjs/rollup-rxjs", }, "webapis-shadydom": { "entrypoint": _DIR + "browser/rollup-shadydom", }, "zone-patch-socket-io": { "entrypoint": _DIR + "extra/rollup-socket-io", }, "zone-patch-message-port": { "entrypoint": _DIR + "browser/rollup-message-port", }, "zone-patch-user-media": { "entrypoint": _DIR + "browser/rollup-webapis-user-media", }, "zone-testing": { "entrypoint": _DIR + "testing/rollup-zone-testing", }, }
{ "end_byte": 3094, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/bundles.bzl" }
angular/packages/zone.js/README.md_0_6593
# Zone.js [![CDNJS](https://img.shields.io/cdnjs/v/zone.js.svg)](https://cdnjs.com/libraries/zone.js) Implements _Zones_ for JavaScript, inspired by [Dart](https://dart.dev/articles/archive/zones). > If you're using zone.js via unpkg (i.e. using `https://unpkg.com/zone.js`) > and you're using any of the following libraries, make sure you import them first > * 'newrelic' as it patches global.Promise before zone.js does > * 'async-listener' as it patches global.setTimeout, global.setInterval before zone.js does > * 'continuation-local-storage' as it uses async-listener ## Development Status of Zone.js As Angular moves towards a zoneless application development model, Zone.js is no longer accepting new features, including additional patches for native platform APIs. The team will also not be accepting any low priority bug fixes. Any critical bug fixes that relate to Angular's direct use of Zone.js will still be accepted. While still a supported part of Angular, the Angular team strongly discourages using Zone.js outside of Angular application contexts. ## NEW Zone.js POST-v0.6.0 See the new API [here](./lib/zone.ts). Read up on [Zone Primer](https://docs.google.com/document/d/1F5Ug0jcrm031vhSMJEOgp1l-Is-Vf0UCNDY-LsQtAIY). ## BREAKING CHANGES since Zone.js v0.11.1 Prior to `v0.11.1`, Zone.js provided two distribution bundle formats in the `dist` folder. They were (1) `ES5` bundle distributed as `zone.js` and (2) `ES2015` bundle distributed as `zone-evergreen.js`. Both of these bundles were in `UMD` format, and are used for Angular's differential-loading mechanism. Starting with `v0.11.1`, Zone.js follows the [Angular Package Format](https://docs.google.com/document/d/1CZC2rcpxffTDfRDs6p1cfbmKNLA6x5O-NtkJglDaBVs). Therefor the new Zone.js file layout is: - `bundles`: `ES5` bundle in `UMD` format. - `fesm2015`: `ES5` bundle in `ESM` format. - `dist`: `ES5` bundle in `UMD` format. This directory is present to keep backward compatibility. If you are using `Angular CLI`, the `polyfills.ts` file will contain: ``` import 'zone.js/dist/zone'; ``` Starting with Zone.js `v0.11.1+` the import changes to: ``` import 'zone.js'; ``` Prior to `v0.11.1` the import would load the `ES5` bundle in `UMD` format from `dist/zone.js`. Starting with `v0.11.1` the import loads the `ES2015` bundle in `ESM` format instead. This is a breaking change for legacy browsers such as `IE11`. For backwards compatibility `zone.js` continues to distribute the same bundles under `dist`. To restore the old behavior import from the `dist` directory instead like so: ``` import 'zone.js/dist/zone'; ``` For details, please refer the [changelog](./CHANGELOG.md) and the [PR](https://github.com/angular/angular/pull/36540). ## What's a Zone? A Zone is an execution context that persists across async tasks. You can think of it as [thread-local storage](https://en.wikipedia.org/wiki/Thread-local_storage) for JavaScript VMs. See this video from ng-conf 2014 for a detailed explanation: [![screenshot of the zone.js presentation and ng-conf 2014](./presentation.png)](//www.youtube.com/watch?v=3IqtmUscE_U&t=150) ## See also * [async-listener](https://github.com/othiym23/async-listener) - a similar library for node * [Async stack traces in Chrome](https://www.html5rocks.com/en/tutorials/developertools/async-call-stack/) * [strongloop/zone](https://github.com/strongloop/zone) (Deprecated) * [vizone](https://github.com/gilbox/vizone) - control flow visualizer that uses zone.js ## Standard API support zone.js patched most standard web APIs (such as DOM events, `XMLHttpRequest`, ...) and nodejs APIs (`EventEmitter`, `fs`, ...), for more details, please see [STANDARD-APIS.md](STANDARD-APIS.md). ## Nonstandard API support We are adding support to some nonstandard APIs, such as MediaQuery and Notification. Please see [NON-STANDARD-APIS.md](NON-STANDARD-APIS.md) for more details. ## Examples You can find some samples to describe how to use zone.js in [SAMPLE.md](SAMPLE.md). ## Modules zone.js patches the async APIs described above, but those patches will have some overhead. Starting from zone.js v0.8.9, you can choose which web API module you want to patch. For more details, please see [MODULE.md](MODULE.md). ## Bundles Starting with `v0.11.0`, `zone.js` uses `Angular Package Format` for bundle distribution. (For backwards compatibility, all bundles can still be accessed from `dist` folder.) |Bundle|Summary| |---|---| |`zone.js`| The default bundle. Contains the most used APIs such as `setTimeout/Promise/EventTarget...`, it also supports differential loading by importing this bundle using `import zone.js`. In legacy browsers it includes some additional patches such as `registerElement` and `EventTarget` like APIs.| |`zone-testing.js`| The bundle for zone testing support of `jasmine` / `mocha` / `jest`. Also includes test utility functions `async` / `fakeAsync` / `sync`.| |`zone-node.js`|The NodeJS support bundle.| |`zone-mix.js`|A mixed bundle which supports both browser and NodeJS. Useful for mixed environment such as Electron.| |`zone-externs.js`|the API definitions for `closure compiler`.| Additional optional patches not included in the `zone.js` bundles which extend functionality. The additional bundles can be found under `zone.js/plugins` folder. To use these bundles, add the following code after importing zone.js bundle. ``` import 'zone.js'; // For example, import canvas patch import 'zone.js/plugins/zone-patch-canvas'; ``` |Patch|Summary| |---|---| |`webapis-media-query.js`|patch for `MediaQuery APIs`| |`webapis-notification.js`|patch for `Notification APIs`| |`webapis-rtc-peer-connection.js`|patch for `RTCPeerConnection APIs`| |`webapis-shadydom.js`|patch for `Shady DOM APIs`| |`zone-bluebird.js`|patch for `Bluebird APIs`| |`zone-error.js`|patch for `Error Global Object`, supports adding zone information to stack frame, and also removing unrelated stack frames from `zone.js` internally| |`zone-patch-canvas.js`|patch for `Canvas API`| |`zone-patch-cordova.js`|patch for `Cordova API`| |`zone-patch-electron.js`|patch for `Electron API`| |`zone-patch-fetch.js`|patch for `Fetch API`| |`zone-patch-jsonp.js`|helper utility for `jsonp API`| |`zone-patch-resize-observer.js`|patch for `ResizeObserver API`| |`zone-patch-rxjs.js`|patch for `rxjs API`| |`zone-patch-rxjs-fake-async.js`|patch for `rxjs fakeasync test`| |`zone-patch-socket-io.js`|patch for `socket-io`| |`zone-patch-user-media.js`|patch for `UserMedia API`| |`zone-patch-message-port.js`|patch for `MessagePort API`| ## License MIT
{ "end_byte": 6593, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/README.md" }
angular/packages/zone.js/check-file-size.js_0_797
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ const fs = require('fs'); module.exports = function (config) { let chkResult = true; config.targets.forEach((target) => { if (target.checkTarget) { try { const stats = fs.statSync(target.path); if (stats.size > target.limit) { console.error( `file ${target.path} size over limit, limit is ${target.limit}, actual is ${stats.size}`, ); chkResult = false; } } catch (err) { console.error(`failed to get filesize: ${target.path}`); chkResult = false; } } }); return chkResult; };
{ "end_byte": 797, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/check-file-size.js" }
angular/packages/zone.js/karma-dist.conf.js_0_1022
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ module.exports = function (config) { require('./karma-base.conf.js')(config); config.files.push('build/test/browser-env-setup.js'); config.files.push('build/test/wtf_mock.js'); config.files.push('build/test/test_fake_polyfill.js'); config.files.push('build/test/custom_error.js'); config.files.push('dist/zone.js'); config.files.push('dist/zone-patch-fetch.js'); config.files.push('dist/zone-patch-canvas.js'); config.files.push('dist/webapis-media-query.js'); config.files.push('dist/webapis-notification.js'); config.files.push('dist/zone-patch-user-media.js'); config.files.push('dist/zone-patch-resize-observer.js'); config.files.push('dist/task-tracking.js'); config.files.push('dist/wtf.js'); config.files.push('dist/zone-testing.js'); config.files.push('build/test/main.js'); };
{ "end_byte": 1022, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/karma-dist.conf.js" }
angular/packages/zone.js/rollup.config.js_0_2658
const node = require('@rollup/plugin-node-resolve').default; const commonjs = require('@rollup/plugin-commonjs'); const MagicString = require('magic-string'); // Parse the stamp file produced by Bazel from the version control system let version = '<unknown>'; if (bazel_version_file) { const versionTag = require('fs') .readFileSync(bazel_version_file, {encoding: 'utf-8'}) .split('\n') .find((s) => s.startsWith('STABLE_PROJECT_VERSION')); // Don't assume STABLE_PROJECT_VERSION exists if (versionTag) { version = versionTag.split(' ')[1].trim(); } } /** Removed license banners from input files. */ const stripBannerPlugin = { name: 'strip-license-banner', transform(code, _filePath) { const banner = /(\/\**\s+\*\s@license.*?\*\/)/s.exec(code); if (!banner) { return; } const [bannerContent] = banner; const magicString = new MagicString(code); const pos = code.indexOf(bannerContent); magicString.remove(pos, pos + bannerContent.length).trimStart(); return { code: magicString.toString(), map: magicString.generateMap({ hires: true, }), }; }, }; // Add 'use strict' to the bundle, https://github.com/angular/angular/pull/40456 // When rollup build esm bundle of zone.js, there will be no 'use strict' // since all esm bundles are `strict`, but when webpack load the esm bundle, // because zone.js is a module without export and import, webpack is unable // to determine the bundle is `esm` module or not, so it doesn't add the 'use strict' // which webpack does to all other `esm` modules which has export or import. // And it causes issues such as https://github.com/angular/angular/issues/40215 // `this` should be `undefined` but is assigned with `Window` instead. const banner = `'use strict'; /** * @license Angular v${version} * (c) 2010-2024 Google LLC. https://angular.io/ * License: MIT */`; module.exports = { external: (id) => { if (id[0] === '.') { // Relative paths are always non external. return false; } if (/zone\.js[\\/]lib/.test(id)) { return false; } return /rxjs|electron/.test(id); }, plugins: [ node({ mainFields: ['es2015', 'module', 'jsnext:main', 'main'], }), commonjs(), stripBannerPlugin, ], output: { globals: { electron: 'electron', 'rxjs/Observable': 'Rx', 'rxjs/Subscriber': 'Rx', 'rxjs/Subscription': 'Rx', 'rxjs/Scheduler': 'Rx.Scheduler', 'rxjs/scheduler/asap': 'Rx.Scheduler', 'rxjs/scheduler/async': 'Rx.Scheduler', 'rxjs/symbol/rxSubscriber': 'Rx.Symbol', }, banner, }, };
{ "end_byte": 2658, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/rollup.config.js" }
angular/packages/zone.js/yarn.lock_0_83
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. # yarn lockfile v1
{ "end_byte": 83, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/yarn.lock" }
angular/packages/zone.js/yarn.lock_86_4705
"@ampproject/remapping@^2.2.0": version "2.3.0" resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.3.0.tgz#ed441b6fa600072520ce18b43d2c8cc8caecc7f4" integrity sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw== dependencies: "@jridgewell/gen-mapping" "^0.3.5" "@jridgewell/trace-mapping" "^0.3.24" "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.24.7": version "7.24.7" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.24.7.tgz#882fd9e09e8ee324e496bd040401c6f046ef4465" integrity sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA== dependencies: "@babel/highlight" "^7.24.7" picocolors "^1.0.0" "@babel/compat-data@^7.25.2": version "7.25.2" resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.25.2.tgz#e41928bd33475305c586f6acbbb7e3ade7a6f7f5" integrity sha512-bYcppcpKBvX4znYaPEeFau03bp89ShqNMLs+rmdptMw+heSZh9+z84d2YG+K7cYLbWwzdjtDoW/uqZmPjulClQ== "@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.23.9": version "7.25.2" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.25.2.tgz#ed8eec275118d7613e77a352894cd12ded8eba77" integrity sha512-BBt3opiCOxUr9euZ5/ro/Xv8/V7yJ5bjYMqG/C1YAo8MIKAnumZalCN+msbci3Pigy4lIQfPUpfMM27HMGaYEA== dependencies: "@ampproject/remapping" "^2.2.0" "@babel/code-frame" "^7.24.7" "@babel/generator" "^7.25.0" "@babel/helper-compilation-targets" "^7.25.2" "@babel/helper-module-transforms" "^7.25.2" "@babel/helpers" "^7.25.0" "@babel/parser" "^7.25.0" "@babel/template" "^7.25.0" "@babel/traverse" "^7.25.2" "@babel/types" "^7.25.2" convert-source-map "^2.0.0" debug "^4.1.0" gensync "^1.0.0-beta.2" json5 "^2.2.3" semver "^6.3.1" "@babel/generator@^7.25.0", "@babel/generator@^7.7.2": version "7.25.0" resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.25.0.tgz#f858ddfa984350bc3d3b7f125073c9af6988f18e" integrity sha512-3LEEcj3PVW8pW2R1SR1M89g/qrYk/m/mB/tLqn7dn4sbBUQyTqnlod+II2U4dqiGtUmkcnAmkMDralTFZttRiw== dependencies: "@babel/types" "^7.25.0" "@jridgewell/gen-mapping" "^0.3.5" "@jridgewell/trace-mapping" "^0.3.25" jsesc "^2.5.1" "@babel/helper-compilation-targets@^7.25.2": version "7.25.2" resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.25.2.tgz#e1d9410a90974a3a5a66e84ff55ef62e3c02d06c" integrity sha512-U2U5LsSaZ7TAt3cfaymQ8WHh0pxvdHoEk6HVpaexxixjyEquMh0L0YNJNM6CTGKMXV1iksi0iZkGw4AcFkPaaw== dependencies: "@babel/compat-data" "^7.25.2" "@babel/helper-validator-option" "^7.24.8" browserslist "^4.23.1" lru-cache "^5.1.1" semver "^6.3.1" "@babel/helper-module-imports@^7.24.7": version "7.24.7" resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.24.7.tgz#f2f980392de5b84c3328fc71d38bd81bbb83042b" integrity sha512-8AyH3C+74cgCVVXow/myrynrAGv+nTVg5vKu2nZph9x7RcRwzmh0VFallJuFTZ9mx6u4eSdXZfcOzSqTUm0HCA== dependencies: "@babel/traverse" "^7.24.7" "@babel/types" "^7.24.7" "@babel/helper-module-transforms@^7.25.2": version "7.25.2" resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.25.2.tgz#ee713c29768100f2776edf04d4eb23b8d27a66e6" integrity sha512-BjyRAbix6j/wv83ftcVJmBt72QtHI56C7JXZoG2xATiLpmoC7dpd8WnkikExHDVPpi/3qCmO6WY1EaXOluiecQ== dependencies: "@babel/helper-module-imports" "^7.24.7" "@babel/helper-simple-access" "^7.24.7" "@babel/helper-validator-identifier" "^7.24.7" "@babel/traverse" "^7.25.2" "@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.24.7", "@babel/helper-plugin-utils@^7.8.0": version "7.24.8" resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.8.tgz#94ee67e8ec0e5d44ea7baeb51e571bd26af07878" integrity sha512-FFWx5142D8h2Mgr/iPVGH5G7w6jDn4jUSpZTyDnQO0Yn7Ks2Kuz6Pci8H6MPCoUJegd/UZQ3tAvfLCxQSnWWwg== "@babel/helper-simple-access@^7.24.7": version "7.24.7" resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.24.7.tgz#bcade8da3aec8ed16b9c4953b74e506b51b5edb3" integrity sha512-zBAIvbCMh5Ts+b86r/CjU+4XGYIs+R1j951gxI3KmmxBMhCg4oQMsv6ZXQ64XOm/cvzfU1FmoCyt6+owc5QMYg== dependencies: "@babel/traverse" "^7.24.7" "@babel/types" "^7.24.7"
{ "end_byte": 4705, "start_byte": 86, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/yarn.lock" }
angular/packages/zone.js/yarn.lock_4707_9170
"@babel/helper-string-parser@^7.24.8": version "7.24.8" resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.24.8.tgz#5b3329c9a58803d5df425e5785865881a81ca48d" integrity sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ== "@babel/helper-validator-identifier@^7.24.7": version "7.24.7" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz#75b889cfaf9e35c2aaf42cf0d72c8e91719251db" integrity sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w== "@babel/helper-validator-option@^7.24.8": version "7.24.8" resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.24.8.tgz#3725cdeea8b480e86d34df15304806a06975e33d" integrity sha512-xb8t9tD1MHLungh/AIoWYN+gVHaB9kwlu8gffXGSt3FFEIT7RjS+xWbc2vUD1UTZdIpKj/ab3rdqJ7ufngyi2Q== "@babel/helpers@^7.25.0": version "7.25.0" resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.25.0.tgz#e69beb7841cb93a6505531ede34f34e6a073650a" integrity sha512-MjgLZ42aCm0oGjJj8CtSM3DB8NOOf8h2l7DCTePJs29u+v7yO/RBX9nShlKMgFnRks/Q4tBAe7Hxnov9VkGwLw== dependencies: "@babel/template" "^7.25.0" "@babel/types" "^7.25.0" "@babel/highlight@^7.24.7": version "7.24.7" resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.24.7.tgz#a05ab1df134b286558aae0ed41e6c5f731bf409d" integrity sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw== dependencies: "@babel/helper-validator-identifier" "^7.24.7" chalk "^2.4.2" js-tokens "^4.0.0" picocolors "^1.0.0" "@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.25.0", "@babel/parser@^7.25.3": version "7.25.3" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.25.3.tgz#91fb126768d944966263f0657ab222a642b82065" integrity sha512-iLTJKDbJ4hMvFPgQwwsVoxtHyWpKKPBrxkANrSYewDPaPpT5py5yeVkgPIJ7XYXhndxJpaA3PyALSXQ7u8e/Dw== dependencies: "@babel/types" "^7.25.2" "@babel/plugin-syntax-async-generators@^7.8.4": version "7.8.4" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz#a983fb1aeb2ec3f6ed042a210f640e90e786fe0d" integrity sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw== dependencies: "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-bigint@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz#4c9a6f669f5d0cdf1b90a1671e9a146be5300cea" integrity sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg== dependencies: "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-class-properties@^7.8.3": version "7.12.13" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz#b5c987274c4a3a82b89714796931a6b53544ae10" integrity sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA== dependencies: "@babel/helper-plugin-utils" "^7.12.13" "@babel/plugin-syntax-import-meta@^7.8.3": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz#ee601348c370fa334d2207be158777496521fd51" integrity sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g== dependencies: "@babel/helper-plugin-utils" "^7.10.4" "@babel/plugin-syntax-json-strings@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz#01ca21b668cd8218c9e640cb6dd88c5412b2c96a" integrity sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA== dependencies: "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-jsx@^7.7.2": version "7.24.7" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.24.7.tgz#39a1fa4a7e3d3d7f34e2acc6be585b718d30e02d" integrity sha512-6ddciUPe/mpMnOKv/U+RSd2vvVy+Yw/JfBB0ZHYjEZt9NLHmCUylNYlsbqCCS1Bffjlb0fCwC9Vqz+sBz6PsiQ== dependencies: "@babel/helper-plugin-utils" "^7.24.7"
{ "end_byte": 9170, "start_byte": 4707, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/yarn.lock" }
angular/packages/zone.js/yarn.lock_9172_13893
"@babel/plugin-syntax-logical-assignment-operators@^7.8.3": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz#ca91ef46303530448b906652bac2e9fe9941f699" integrity sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig== dependencies: "@babel/helper-plugin-utils" "^7.10.4" "@babel/plugin-syntax-nullish-coalescing-operator@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz#167ed70368886081f74b5c36c65a88c03b66d1a9" integrity sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ== dependencies: "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-numeric-separator@^7.8.3": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz#b9b070b3e33570cd9fd07ba7fa91c0dd37b9af97" integrity sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug== dependencies: "@babel/helper-plugin-utils" "^7.10.4" "@babel/plugin-syntax-object-rest-spread@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz#60e225edcbd98a640332a2e72dd3e66f1af55871" integrity sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA== dependencies: "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-optional-catch-binding@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz#6111a265bcfb020eb9efd0fdfd7d26402b9ed6c1" integrity sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q== dependencies: "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-optional-chaining@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz#4f69c2ab95167e0180cd5336613f8c5788f7d48a" integrity sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg== dependencies: "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-top-level-await@^7.8.3": version "7.14.5" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz#c1cfdadc35a646240001f06138247b741c34d94c" integrity sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw== dependencies: "@babel/helper-plugin-utils" "^7.14.5" "@babel/plugin-syntax-typescript@^7.7.2": version "7.24.7" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.24.7.tgz#58d458271b4d3b6bb27ee6ac9525acbb259bad1c" integrity sha512-c/+fVeJBB0FeKsFvwytYiUD+LBvhHjGSI0g446PRGdSVGZLRNArBUno2PETbAly3tpiNAQR5XaZ+JslxkotsbA== dependencies: "@babel/helper-plugin-utils" "^7.24.7" "@babel/template@^7.25.0", "@babel/template@^7.3.3": version "7.25.0" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.25.0.tgz#e733dc3134b4fede528c15bc95e89cb98c52592a" integrity sha512-aOOgh1/5XzKvg1jvVz7AVrx2piJ2XBi227DHmbY6y+bM9H2FlN+IfecYu4Xl0cNiiVejlsCri89LUsbj8vJD9Q== dependencies: "@babel/code-frame" "^7.24.7" "@babel/parser" "^7.25.0" "@babel/types" "^7.25.0" "@babel/traverse@^7.24.7", "@babel/traverse@^7.25.2": version "7.25.3" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.25.3.tgz#f1b901951c83eda2f3e29450ce92743783373490" integrity sha512-HefgyP1x754oGCsKmV5reSmtV7IXj/kpaE1XYY+D9G5PvKKoFfSbiS4M77MdjuwlZKDIKFCffq9rPU+H/s3ZdQ== dependencies: "@babel/code-frame" "^7.24.7" "@babel/generator" "^7.25.0" "@babel/parser" "^7.25.3" "@babel/template" "^7.25.0" "@babel/types" "^7.25.2" debug "^4.3.1" globals "^11.1.0" "@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.24.7", "@babel/types@^7.25.0", "@babel/types@^7.25.2", "@babel/types@^7.3.3": version "7.25.2" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.25.2.tgz#55fb231f7dc958cd69ea141a4c2997e819646125" integrity sha512-YTnYtra7W9e6/oAZEHj0bJehPRUlLH9/fbpT5LfB0NhQXyALCRkRs3zH9v07IYhkgpqX6Z78FnuccZr/l4Fs4Q== dependencies: "@babel/helper-string-parser" "^7.24.8" "@babel/helper-validator-identifier" "^7.24.7" to-fast-properties "^2.0.0"
{ "end_byte": 13893, "start_byte": 9172, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/yarn.lock" }
angular/packages/zone.js/yarn.lock_13895_18196
"@bcoe/v8-coverage@^0.2.3": version "0.2.3" resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== "@externs/nodejs@^1.5.0": version "1.5.0" resolved "https://registry.yarnpkg.com/@externs/nodejs/-/nodejs-1.5.0.tgz#88ff9e7a03c53d19101ee49768e598ff0f39c9ad" integrity sha512-2J+FRDjGfKKldTQ5YqLmhQ04/sA9swTQ6OTtPzo4xhg41u1+eiufciXiqW6u3UXEcmm413a27NakgnLbzfp0wQ== "@istanbuljs/load-nyc-config@^1.0.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" integrity sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ== dependencies: camelcase "^5.3.1" find-up "^4.1.0" get-package-type "^0.1.0" js-yaml "^3.13.1" resolve-from "^5.0.0" "@istanbuljs/schema@^0.1.2", "@istanbuljs/schema@^0.1.3": version "0.1.3" resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== "@jest/console@^29.7.0": version "29.7.0" resolved "https://registry.yarnpkg.com/@jest/console/-/console-29.7.0.tgz#cd4822dbdb84529265c5a2bdb529a3c9cc950ffc" integrity sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg== dependencies: "@jest/types" "^29.6.3" "@types/node" "*" chalk "^4.0.0" jest-message-util "^29.7.0" jest-util "^29.7.0" slash "^3.0.0" "@jest/core@^29.7.0": version "29.7.0" resolved "https://registry.yarnpkg.com/@jest/core/-/core-29.7.0.tgz#b6cccc239f30ff36609658c5a5e2291757ce448f" integrity sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg== dependencies: "@jest/console" "^29.7.0" "@jest/reporters" "^29.7.0" "@jest/test-result" "^29.7.0" "@jest/transform" "^29.7.0" "@jest/types" "^29.6.3" "@types/node" "*" ansi-escapes "^4.2.1" chalk "^4.0.0" ci-info "^3.2.0" exit "^0.1.2" graceful-fs "^4.2.9" jest-changed-files "^29.7.0" jest-config "^29.7.0" jest-haste-map "^29.7.0" jest-message-util "^29.7.0" jest-regex-util "^29.6.3" jest-resolve "^29.7.0" jest-resolve-dependencies "^29.7.0" jest-runner "^29.7.0" jest-runtime "^29.7.0" jest-snapshot "^29.7.0" jest-util "^29.7.0" jest-validate "^29.7.0" jest-watcher "^29.7.0" micromatch "^4.0.4" pretty-format "^29.7.0" slash "^3.0.0" strip-ansi "^6.0.0" "@jest/environment@^29.7.0": version "29.7.0" resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-29.7.0.tgz#24d61f54ff1f786f3cd4073b4b94416383baf2a7" integrity sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw== dependencies: "@jest/fake-timers" "^29.7.0" "@jest/types" "^29.6.3" "@types/node" "*" jest-mock "^29.7.0" "@jest/expect-utils@^29.7.0": version "29.7.0" resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-29.7.0.tgz#023efe5d26a8a70f21677d0a1afc0f0a44e3a1c6" integrity sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA== dependencies: jest-get-type "^29.6.3" "@jest/expect@^29.7.0": version "29.7.0" resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-29.7.0.tgz#76a3edb0cb753b70dfbfe23283510d3d45432bf2" integrity sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ== dependencies: expect "^29.7.0" jest-snapshot "^29.7.0" "@jest/fake-timers@^29.7.0": version "29.7.0" resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-29.7.0.tgz#fd91bf1fffb16d7d0d24a426ab1a47a49881a565" integrity sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ== dependencies: "@jest/types" "^29.6.3" "@sinonjs/fake-timers" "^10.0.2" "@types/node" "*" jest-message-util "^29.7.0" jest-mock "^29.7.0" jest-util "^29.7.0"
{ "end_byte": 18196, "start_byte": 13895, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/yarn.lock" }
angular/packages/zone.js/yarn.lock_18198_22318
"@jest/globals@^29.7.0": version "29.7.0" resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-29.7.0.tgz#8d9290f9ec47ff772607fa864ca1d5a2efae1d4d" integrity sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ== dependencies: "@jest/environment" "^29.7.0" "@jest/expect" "^29.7.0" "@jest/types" "^29.6.3" jest-mock "^29.7.0" "@jest/reporters@^29.7.0": version "29.7.0" resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-29.7.0.tgz#04b262ecb3b8faa83b0b3d321623972393e8f4c7" integrity sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg== dependencies: "@bcoe/v8-coverage" "^0.2.3" "@jest/console" "^29.7.0" "@jest/test-result" "^29.7.0" "@jest/transform" "^29.7.0" "@jest/types" "^29.6.3" "@jridgewell/trace-mapping" "^0.3.18" "@types/node" "*" chalk "^4.0.0" collect-v8-coverage "^1.0.0" exit "^0.1.2" glob "^7.1.3" graceful-fs "^4.2.9" istanbul-lib-coverage "^3.0.0" istanbul-lib-instrument "^6.0.0" istanbul-lib-report "^3.0.0" istanbul-lib-source-maps "^4.0.0" istanbul-reports "^3.1.3" jest-message-util "^29.7.0" jest-util "^29.7.0" jest-worker "^29.7.0" slash "^3.0.0" string-length "^4.0.1" strip-ansi "^6.0.0" v8-to-istanbul "^9.0.1" "@jest/schemas@^29.6.3": version "29.6.3" resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.6.3.tgz#430b5ce8a4e0044a7e3819663305a7b3091c8e03" integrity sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA== dependencies: "@sinclair/typebox" "^0.27.8" "@jest/source-map@^29.6.3": version "29.6.3" resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-29.6.3.tgz#d90ba772095cf37a34a5eb9413f1b562a08554c4" integrity sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw== dependencies: "@jridgewell/trace-mapping" "^0.3.18" callsites "^3.0.0" graceful-fs "^4.2.9" "@jest/test-result@^29.7.0": version "29.7.0" resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-29.7.0.tgz#8db9a80aa1a097bb2262572686734baed9b1657c" integrity sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA== dependencies: "@jest/console" "^29.7.0" "@jest/types" "^29.6.3" "@types/istanbul-lib-coverage" "^2.0.0" collect-v8-coverage "^1.0.0" "@jest/test-sequencer@^29.7.0": version "29.7.0" resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-29.7.0.tgz#6cef977ce1d39834a3aea887a1726628a6f072ce" integrity sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw== dependencies: "@jest/test-result" "^29.7.0" graceful-fs "^4.2.9" jest-haste-map "^29.7.0" slash "^3.0.0" "@jest/transform@^29.7.0": version "29.7.0" resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-29.7.0.tgz#df2dd9c346c7d7768b8a06639994640c642e284c" integrity sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw== dependencies: "@babel/core" "^7.11.6" "@jest/types" "^29.6.3" "@jridgewell/trace-mapping" "^0.3.18" babel-plugin-istanbul "^6.1.1" chalk "^4.0.0" convert-source-map "^2.0.0" fast-json-stable-stringify "^2.1.0" graceful-fs "^4.2.9" jest-haste-map "^29.7.0" jest-regex-util "^29.6.3" jest-util "^29.7.0" micromatch "^4.0.4" pirates "^4.0.4" slash "^3.0.0" write-file-atomic "^4.0.2" "@jest/types@^29.6.3": version "29.6.3" resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.6.3.tgz#1131f8cf634e7e84c5e77bab12f052af585fba59" integrity sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw== dependencies: "@jest/schemas" "^29.6.3" "@types/istanbul-lib-coverage" "^2.0.0" "@types/istanbul-reports" "^3.0.0" "@types/node" "*" "@types/yargs" "^17.0.8" chalk "^4.0.0"
{ "end_byte": 22318, "start_byte": 18198, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/yarn.lock" }
angular/packages/zone.js/yarn.lock_22320_26176
"@jridgewell/gen-mapping@^0.3.5": version "0.3.5" resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz#dcce6aff74bdf6dad1a95802b69b04a2fcb1fb36" integrity sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg== dependencies: "@jridgewell/set-array" "^1.2.1" "@jridgewell/sourcemap-codec" "^1.4.10" "@jridgewell/trace-mapping" "^0.3.24" "@jridgewell/resolve-uri@^3.1.0": version "3.1.2" resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz#7a0ee601f60f99a20c7c7c5ff0c80388c1189bd6" integrity sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw== "@jridgewell/set-array@^1.2.1": version "1.2.1" resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.2.1.tgz#558fb6472ed16a4c850b889530e6b36438c49280" integrity sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A== "@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14": version "1.5.0" resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz#3188bcb273a414b0d215fd22a58540b989b9409a" integrity sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ== "@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.18", "@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25": version "0.3.25" resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz#15f190e98895f3fc23276ee14bc76b675c2e50f0" integrity sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ== dependencies: "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" "@sinclair/typebox@^0.27.8": version "0.27.8" resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" integrity sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA== "@sinonjs/commons@^3.0.0": version "3.0.1" resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-3.0.1.tgz#1029357e44ca901a615585f6d27738dbc89084cd" integrity sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ== dependencies: type-detect "4.0.8" "@sinonjs/fake-timers@^10.0.2": version "10.3.0" resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz#55fdff1ecab9f354019129daf4df0dd4d923ea66" integrity sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA== dependencies: "@sinonjs/commons" "^3.0.0" "@tootallnate/once@2": version "2.0.0" resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-2.0.0.tgz#f544a148d3ab35801c1f633a7441fd87c2e484bf" integrity sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A== "@types/babel__core@^7.1.14": version "7.20.5" resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.5.tgz#3df15f27ba85319caa07ba08d0721889bb39c017" integrity sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA== dependencies: "@babel/parser" "^7.20.7" "@babel/types" "^7.20.7" "@types/babel__generator" "*" "@types/babel__template" "*" "@types/babel__traverse" "*" "@types/babel__generator@*": version "7.6.8" resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.6.8.tgz#f836c61f48b1346e7d2b0d93c6dacc5b9535d3ab" integrity sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw== dependencies: "@babel/types" "^7.0.0"
{ "end_byte": 26176, "start_byte": 22320, "url": "https://github.com/angular/angular/blob/main/packages/zone.js/yarn.lock" }