1 | /// <amd-module name="@angular/compiler-cli/linker/babel/src/babel_declaration_scope" />
|
---|
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 { NodePath, Scope } from '@babel/traverse';
|
---|
10 | import * as t from '@babel/types';
|
---|
11 | import { DeclarationScope } from '../../../linker';
|
---|
12 | export declare type ConstantScopePath = NodePath<t.Function | t.Program>;
|
---|
13 | /**
|
---|
14 | * This class represents the lexical scope of a partial declaration in Babel source code.
|
---|
15 | *
|
---|
16 | * Its only responsibility is to compute a reference object for the scope of shared constant
|
---|
17 | * statements that will be generated during partial linking.
|
---|
18 | */
|
---|
19 | export declare class BabelDeclarationScope implements DeclarationScope<ConstantScopePath, t.Expression> {
|
---|
20 | private declarationScope;
|
---|
21 | /**
|
---|
22 | * Construct a new `BabelDeclarationScope`.
|
---|
23 | *
|
---|
24 | * @param declarationScope the Babel scope containing the declaration call expression.
|
---|
25 | */
|
---|
26 | constructor(declarationScope: Scope);
|
---|
27 | /**
|
---|
28 | * Compute the Babel `NodePath` that can be used to reference the lexical scope where any
|
---|
29 | * shared constant statements would be inserted.
|
---|
30 | *
|
---|
31 | * There will only be a shared constant scope if the expression is in an ECMAScript module, or a
|
---|
32 | * UMD module. Otherwise `null` is returned to indicate that constant statements must be emitted
|
---|
33 | * locally to the generated linked definition, to avoid polluting the global scope.
|
---|
34 | *
|
---|
35 | * @param expression the expression that points to the Angular core framework import.
|
---|
36 | */
|
---|
37 | getConstantScopeRef(expression: t.Expression): ConstantScopePath | null;
|
---|
38 | }
|
---|