@angular/platform-browser-dynamic
Version:
Angular - library for using Angular in a web browser with JIT compilation
1 lines • 10.2 kB
Source Map (JSON)
{"version":3,"file":"platform-browser-dynamic.mjs","sources":["../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/platform-browser-dynamic/src/version.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/platform-browser-dynamic/src/compiler_factory.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/platform-browser-dynamic/src/resource_loader/resource_loader_impl.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/platform-browser-dynamic/src/platform_providers.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.dev/license\n */\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of the platform-browser-dynamic package.\n */\n\nimport {Version} from '@angular/core';\n\n/**\n * @publicApi\n */\nexport const VERSION = /* @__PURE__ */ new Version('21.0.8');\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.dev/license\n */\n\nimport {CompilerConfig} from '@angular/compiler';\nimport {\n Compiler,\n CompilerFactory,\n CompilerOptions,\n Injector,\n StaticProvider,\n ViewEncapsulation,\n} from '@angular/core';\n\nexport const COMPILER_PROVIDERS = <StaticProvider[]>[\n {provide: Compiler, useFactory: () => new Compiler()},\n];\n/**\n * @publicApi\n *\n * @deprecated\n * Ivy JIT mode doesn't require accessing this symbol.\n */\nexport class JitCompilerFactory implements CompilerFactory {\n private _defaultOptions: CompilerOptions[];\n\n /** @internal */\n constructor(defaultOptions: CompilerOptions[]) {\n const compilerOptions: CompilerOptions = {\n defaultEncapsulation: ViewEncapsulation.Emulated,\n };\n\n this._defaultOptions = [compilerOptions, ...defaultOptions];\n }\n\n createCompiler(options: CompilerOptions[] = []): Compiler {\n const opts = _mergeOptions(this._defaultOptions.concat(options));\n const injector = Injector.create({\n providers: [\n COMPILER_PROVIDERS,\n {\n provide: CompilerConfig,\n useFactory: () => {\n return new CompilerConfig({\n defaultEncapsulation: opts.defaultEncapsulation,\n preserveWhitespaces: opts.preserveWhitespaces,\n });\n },\n deps: [],\n },\n opts.providers!,\n ],\n });\n return injector.get(Compiler);\n }\n}\n\nfunction _mergeOptions(optionsArr: CompilerOptions[]): CompilerOptions {\n return {\n defaultEncapsulation: _lastDefined(optionsArr.map((options) => options.defaultEncapsulation)),\n providers: _mergeArrays(optionsArr.map((options) => options.providers!)),\n preserveWhitespaces: _lastDefined(optionsArr.map((options) => options.preserveWhitespaces)),\n };\n}\n\nfunction _lastDefined<T>(args: T[]): T | undefined {\n for (let i = args.length - 1; i >= 0; i--) {\n if (args[i] !== undefined) {\n return args[i];\n }\n }\n return undefined;\n}\n\nfunction _mergeArrays(parts: any[][]): any[] {\n const result: any[] = [];\n parts.forEach((part) => part && result.push(...part));\n return result;\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.dev/license\n */\nimport {ResourceLoader} from '@angular/compiler';\nimport {Injectable} from '@angular/core';\n\n@Injectable()\nexport class ResourceLoaderImpl extends ResourceLoader {\n override get(url: string): Promise<string> {\n let resolve: (result: any) => void;\n let reject: (error: any) => void;\n const promise = new Promise<string>((res, rej) => {\n resolve = res;\n reject = rej;\n });\n const xhr = new XMLHttpRequest();\n xhr.open('GET', url, true);\n xhr.responseType = 'text';\n\n xhr.onload = function () {\n const response = xhr.response;\n\n let status = xhr.status;\n\n // fix status code when it is 0 (0 status is undocumented).\n // Occurs when accessing file resources or on Android 4.1 stock browser\n // while retrieving files from application cache.\n if (status === 0) {\n status = response ? 200 : 0;\n }\n\n if (200 <= status && status <= 300) {\n resolve(response);\n } else {\n reject(`Failed to load ${url}`);\n }\n };\n\n xhr.onerror = function () {\n reject(`Failed to load ${url}`);\n };\n\n xhr.send();\n return promise;\n }\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.dev/license\n */\n\nimport {\n COMPILER_OPTIONS,\n CompilerFactory,\n createPlatformFactory,\n PlatformRef,\n StaticProvider,\n} from '@angular/core';\nimport {platformBrowser} from '@angular/platform-browser';\nimport {ResourceLoader} from '@angular/compiler';\nimport {ResourceLoaderImpl} from './resource_loader/resource_loader_impl';\nimport {JitCompilerFactory} from './compiler_factory';\n\nconst INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS: StaticProvider[] = [\n {\n provide: COMPILER_OPTIONS,\n useValue: {providers: [{provide: ResourceLoader, useClass: ResourceLoaderImpl, deps: []}]},\n multi: true,\n },\n {provide: CompilerFactory, useClass: JitCompilerFactory, deps: [COMPILER_OPTIONS]},\n];\n\n/**\n * @deprecated Use the `platformBrowser` function instead from `@angular/platform-browser`.\n * In case you are not in a CLI app and rely on JIT compilation, you will also need to import `@angular/compiler`\n */\nexport const platformBrowserDynamic: (extraProviders?: StaticProvider[]) => PlatformRef =\n createPlatformFactory(\n platformBrowser,\n 'browserDynamic',\n INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,\n );\n"],"names":["VERSION","Version","COMPILER_PROVIDERS","provide","Compiler","useFactory","JitCompilerFactory","_defaultOptions","constructor","defaultOptions","compilerOptions","defaultEncapsulation","ViewEncapsulation","Emulated","createCompiler","options","opts","_mergeOptions","concat","injector","Injector","create","providers","CompilerConfig","preserveWhitespaces","deps","get","optionsArr","_lastDefined","map","_mergeArrays","args","i","length","undefined","parts","result","forEach","part","push","ResourceLoaderImpl","ResourceLoader","url","resolve","reject","promise","Promise","res","rej","xhr","XMLHttpRequest","open","responseType","onload","response","status","onerror","send","target","i0","ɵɵFactoryTarget","Injectable","decorators","INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS","COMPILER_OPTIONS","useValue","useClass","multi","CompilerFactory","platformBrow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