1 line
66 KiB
Text
1 line
66 KiB
Text
|
{"version":3,"file":"upgrade.mjs","sources":["../../../../../../packages/common/upgrade/src/utils.ts","../../../../../../packages/common/upgrade/src/location_shim.ts","../../../../../../packages/common/upgrade/src/params.ts","../../../../../../packages/common/upgrade/src/location_upgrade_module.ts","../../../../../../packages/common/upgrade/public_api.ts","../../../../../../packages/common/upgrade/index.ts","../../../../../../packages/common/upgrade/upgrade.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport function stripPrefix(val: string, prefix: string): string {\n return val.startsWith(prefix) ? val.substring(prefix.length) : val;\n}\n\nexport function deepEqual(a: any, b: any): boolean {\n if (a === b) {\n return true;\n } else if (!a || !b) {\n return false;\n } else {\n try {\n if (a.prototype !== b.prototype || (Array.isArray(a) && Array.isArray(b))) {\n return false;\n }\n return JSON.stringify(a) === JSON.stringify(b);\n } catch (e) {\n return false;\n }\n }\n}\n\nexport function isAnchor(el: (Node & ParentNode) | Element | null): el is HTMLAnchorElement {\n return (<HTMLAnchorElement>el).href !== undefined;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Location, LocationStrategy, PlatformLocation} from '@angular/common';\nimport {ɵisPromise as isPromise} from '@angular/core';\nimport {UpgradeModule} from '@angular/upgrade/static';\nimport {ReplaySubject} from 'rxjs';\n\nimport {UrlCodec} from './params';\nimport {deepEqual, isAnchor} from './utils';\n\nconst PATH_MATCH = /^([^?#]*)(\\?([^#]*))?(#(.*))?$/;\nconst DOUBLE_SLASH_REGEX = /^\\s*[\\\\/]{2,}/;\nconst IGNORE_URI_REGEXP = /^\\s*(javascript|mailto):/i;\nconst DEFAULT_PORTS: {[key: string]: number} = {\n 'http:': 80,\n 'https:': 443,\n 'ftp:': 21,\n};\n\n/**\n * Location service that provides a drop-in replacement for the $location service\n * provided in AngularJS.\n *\n * @see [Using the Angular Unified Location Service](guide/upgrade#using-the-unified-angular-location-service)\n *\n * @publicApi\n */\nexport class $locationShim {\n private initializing = true;\n private updateBrowser = false;\n private $$absUrl: string = '';\n private $$url: string = '';\n private $$protocol: string;\n private $$host: string = '';\n private $$port: number | null;\n private $$replace: boolean = false;\n private $$path: string = '';\n private $$search: any = '';\n private $$hash: string = '';\n private $$state: unknown;\n private $$changeListeners: [\n (\n url: string,\n state: unknown,\n oldUrl: string,\n oldState: unknown,\n err?: (e: Error) => void,\n ) => void,\n (e: Error) => void,\n ][] = [];\n\n private cachedState: unknown = null;\n\n private urlChanges = new ReplaySubject<{newUrl: string; newState: unknown}>(1);\n\n constructor(\n $injector: any,\n private location: Location,\n private platformLocation: PlatformLocation,\n private urlCodec: UrlCodec,\n private locationStrategy: LocationStrategy,\n ) {\n const initialUrl = this.browserUrl();\n\n let parsedUrl = this.urlCodec.parse(initialUrl);\n\n if (typeof parsedUrl === 'string') {\n throw 'Invalid URL';\n }\n\n this.$$protocol = parsedUrl.protocol;\n this.$$host = parsedUrl.hostname;\n this.$$port = parseInt(parsedUrl.port) || DEFAULT_PORTS[parsedUrl.protocol] || null;\n\n this.$$parseLinkUrl(initialUrl, initialUrl);\n this.cacheState();\n this.$$state = this.browserState();\n\n this.location.onUrlChange((newUrl, newState) => {\n this.urlChanges.next({newUrl, newState});\n });\n\n if (isPromise($injector)) {\n $injector.then(($i) => this.initialize($i));\n } else {\n
|