1 | /// <amd-module name="@angular/compiler-cli/ngcc/src/rendering/umd_rendering_formatter" />
|
---|
2 | /**
|
---|
3 | * @license
|
---|
4 | * Copyright Google LLC All Rights Reserved.
|
---|
5 | *
|
---|
6 | * Use of this source code is governed by an MIT-style license that can be
|
---|
7 | * found in the LICENSE file at https://angular.io/license
|
---|
8 | */
|
---|
9 | import MagicString from 'magic-string';
|
---|
10 | import * as ts from 'typescript';
|
---|
11 | import { PathManipulation } from '../../../src/ngtsc/file_system';
|
---|
12 | import { Reexport } from '../../../src/ngtsc/imports';
|
---|
13 | import { Import, ImportManager } from '../../../src/ngtsc/translator';
|
---|
14 | import { ExportInfo } from '../analysis/private_declarations_analyzer';
|
---|
15 | import { UmdReflectionHost } from '../host/umd_host';
|
---|
16 | import { Esm5RenderingFormatter } from './esm5_rendering_formatter';
|
---|
17 | /**
|
---|
18 | * A RenderingFormatter that works with UMD files, instead of `import` and `export` statements
|
---|
19 | * the module is an IIFE with a factory function call with dependencies, which are defined in a
|
---|
20 | * wrapper function for AMD, CommonJS and global module formats.
|
---|
21 | */
|
---|
22 | export declare class UmdRenderingFormatter extends Esm5RenderingFormatter {
|
---|
23 | protected umdHost: UmdReflectionHost;
|
---|
24 | constructor(fs: PathManipulation, umdHost: UmdReflectionHost, isCore: boolean);
|
---|
25 | /**
|
---|
26 | * Add the imports to the UMD module IIFE.
|
---|
27 | *
|
---|
28 | * Note that imports at "prepended" to the start of the parameter list of the factory function,
|
---|
29 | * and so also to the arguments passed to it when it is called.
|
---|
30 | * This is because there are scenarios where the factory function does not accept as many
|
---|
31 | * parameters as are passed as argument in the call. For example:
|
---|
32 | *
|
---|
33 | * ```
|
---|
34 | * (function (global, factory) {
|
---|
35 | * typeof exports === 'object' && typeof module !== 'undefined' ?
|
---|
36 | * factory(exports,require('x'),require('z')) :
|
---|
37 | * typeof define === 'function' && define.amd ?
|
---|
38 | * define(['exports', 'x', 'z'], factory) :
|
---|
39 | * (global = global || self, factory(global.myBundle = {}, global.x));
|
---|
40 | * }(this, (function (exports, x) { ... }
|
---|
41 | * ```
|
---|
42 | *
|
---|
43 | * (See that the `z` import is not being used by the factory function.)
|
---|
44 | */
|
---|
45 | addImports(output: MagicString, imports: Import[], file: ts.SourceFile): void;
|
---|
46 | /**
|
---|
47 | * Add the exports to the bottom of the UMD module factory function.
|
---|
48 | */
|
---|
49 | addExports(output: MagicString, entryPointBasePath: string, exports: ExportInfo[], importManager: ImportManager, file: ts.SourceFile): void;
|
---|
50 | addDirectExports(output: MagicString, exports: Reexport[], importManager: ImportManager, file: ts.SourceFile): void;
|
---|
51 | /**
|
---|
52 | * Add the constants to the top of the UMD factory function.
|
---|
53 | */
|
---|
54 | addConstants(output: MagicString, constants: string, file: ts.SourceFile): void;
|
---|
55 | }
|
---|