Updated the files.

This commit is contained in:
Batuhan Berk Başoğlu 2024-02-08 19:38:41 -05:00
parent 1553e6b971
commit 753967d4f5
23418 changed files with 3784666 additions and 0 deletions

View file

@ -0,0 +1,10 @@
/**
* @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.io/license
*/
import { defaultLinkerPlugin } from './src/babel_plugin';
export { createEs2015LinkerPlugin } from './src/es2015_linker_plugin';
export default defaultLinkerPlugin;

View file

@ -0,0 +1,47 @@
/// <reference types="@angular/compiler-cli/private/babel" />
/**
* @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.io/license
*/
import { types as t } from '@babel/core';
import { AstFactory, BinaryOperator, LeadingComment, ObjectLiteralProperty, SourceMapRange, TemplateLiteral, VariableDeclarationType } from '../../../../src/ngtsc/translator';
/**
* A Babel flavored implementation of the AstFactory.
*/
export declare class BabelAstFactory implements AstFactory<t.Statement, t.Expression> {
/** The absolute path to the source file being compiled. */
private sourceUrl;
constructor(
/** The absolute path to the source file being compiled. */
sourceUrl: string);
attachComments(statement: t.Statement, leadingComments: LeadingComment[]): void;
createArrayLiteral: typeof t.arrayExpression;
createAssignment(target: t.Expression, value: t.Expression): t.Expression;
createBinaryExpression(leftOperand: t.Expression, operator: BinaryOperator, rightOperand: t.Expression): t.Expression;
createBlock: typeof t.blockStatement;
createCallExpression(callee: t.Expression, args: t.Expression[], pure: boolean): t.Expression;
createConditional: typeof t.conditionalExpression;
createElementAccess(expression: t.Expression, element: t.Expression): t.Expression;
createExpressionStatement: typeof t.expressionStatement;
createFunctionDeclaration(functionName: string, parameters: string[], body: t.Statement): t.Statement;
createArrowFunctionExpression(parameters: string[], body: t.Statement | t.Expression): t.Expression;
createFunctionExpression(functionName: string | null, parameters: string[], body: t.Statement): t.Expression;
createIdentifier: typeof t.identifier;
createIfStatement: typeof t.ifStatement;
createDynamicImport(url: string): t.Expression;
createLiteral(value: string | number | boolean | null | undefined): t.Expression;
createNewExpression: typeof t.newExpression;
createObjectLiteral(properties: ObjectLiteralProperty<t.Expression>[]): t.Expression;
createParenthesizedExpression: typeof t.parenthesizedExpression;
createPropertyAccess(expression: t.Expression, propertyName: string): t.Expression;
createReturnStatement: typeof t.returnStatement;
createTaggedTemplate(tag: t.Expression, template: TemplateLiteral<t.Expression>): t.Expression;
createThrowStatement: typeof t.throwStatement;
createTypeOfExpression(expression: t.Expression): t.Expression;
createUnaryExpression: typeof t.unaryExpression;
createVariableDeclaration(variableName: string, initializer: t.Expression | null, type: VariableDeclarationType): t.Statement;
setSourceMapRange<T extends t.Statement | t.Expression | t.TemplateElement>(node: T, sourceMapRange: SourceMapRange | null): T;
}

View file

@ -0,0 +1,33 @@
/**
* @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.io/license
*/
/// <reference types="@angular/compiler-cli/private/babel" />
import { types as t } from '@babel/core';
import { AstHost, Range } from '../../../../linker';
/**
* This implementation of `AstHost` is able to get information from Babel AST nodes.
*/
export declare class BabelAstHost implements AstHost<t.Expression> {
getSymbolName(node: t.Expression): string | null;
isStringLiteral: typeof t.isStringLiteral;
parseStringLiteral(str: t.Expression): string;
isNumericLiteral: typeof t.isNumericLiteral;
parseNumericLiteral(num: t.Expression): number;
isBooleanLiteral(bool: t.Expression): boolean;
parseBooleanLiteral(bool: t.Expression): boolean;
isNull(node: t.Expression): boolean;
isArrayLiteral: typeof t.isArrayExpression;
parseArrayLiteral(array: t.Expression): t.Expression[];
isObjectLiteral: typeof t.isObjectExpression;
parseObjectLiteral(obj: t.Expression): Map<string, t.Expression>;
isFunctionExpression(node: t.Expression): node is Extract<t.Function, t.Expression>;
parseReturnValue(fn: t.Expression): t.Expression;
isCallExpression: typeof t.isCallExpression;
parseCallee(call: t.Expression): t.Expression;
parseArguments(call: t.Expression): t.Expression[];
getRange(node: t.Expression): Range;
}

View file

@ -0,0 +1,37 @@
/// <reference types="@angular/compiler-cli/private/babel" />
/**
* @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.io/license
*/
import { NodePath, types as t } from '@babel/core';
import { DeclarationScope } from '../../../linker';
export type ConstantScopePath = NodePath<t.FunctionDeclaration> | NodePath<t.FunctionExpression> | NodePath<t.Program>;
/**
* This class represents the lexical scope of a partial declaration in Babel source code.
*
* Its only responsibility is to compute a reference object for the scope of shared constant
* statements that will be generated during partial linking.
*/
export declare class BabelDeclarationScope implements DeclarationScope<ConstantScopePath, t.Expression> {
private declarationScope;
/**
* Construct a new `BabelDeclarationScope`.
*
* @param declarationScope the Babel scope containing the declaration call expression.
*/
constructor(declarationScope: NodePath['scope']);
/**
* Compute the Babel `NodePath` that can be used to reference the lexical scope where any
* shared constant statements would be inserted.
*
* There will only be a shared constant scope if the expression is in an ECMAScript module, or a
* UMD module. Otherwise `null` is returned to indicate that constant statements must be emitted
* locally to the generated linked definition, to avoid polluting the global scope.
*
* @param expression the expression that points to the Angular core framework import.
*/
getConstantScopeRef(expression: t.Expression): ConstantScopePath | null;
}

View file

@ -0,0 +1,26 @@
/// <reference types="@angular/compiler-cli/private/babel" />
/**
* @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.io/license
*/
import { ConfigAPI, PluginObj } from '@babel/core';
import { LinkerOptions } from '../../src/file_linker/linker_options';
/**
* This is the Babel plugin definition that is provided as a default export from the package, such
* that the plugin can be used using the module specifier of the package. This is the recommended
* way of integrating the Angular Linker into a build pipeline other than the Angular CLI.
*
* When the module specifier `@angular/compiler-cli/linker/babel` is used as a plugin in a Babel
* configuration, Babel invokes this function (by means of the default export) to create the plugin
* instance according to the provided options.
*
* The linker plugin that is created uses the native NodeJS filesystem APIs to interact with the
* filesystem. Any logging output is printed to the console.
*
* @param api Provides access to the Babel environment that is configuring this plugin.
* @param options The plugin options that have been configured.
*/
export declare function defaultLinkerPlugin(api: ConfigAPI, options: Partial<LinkerOptions>): PluginObj;

View file

@ -0,0 +1,17 @@
/**
* @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.io/license
*/
/// <reference types="@angular/compiler-cli/private/babel" />
import { PluginObj } from '@babel/core';
import { LinkerPluginOptions } from './linker_plugin_options';
/**
* Create a Babel plugin that visits the program, identifying and linking partial declarations.
*
* The plugin delegates most of its work to a generic `FileLinker` for each file (`t.Program` in
* Babel) that is visited.
*/
export declare function createEs2015LinkerPlugin({ fileSystem, logger, ...options }: LinkerPluginOptions): PluginObj;

View file

@ -0,0 +1,20 @@
/**
* @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.io/license
*/
import { LinkerOptions } from '../..';
import { ReadonlyFileSystem } from '../../../src/ngtsc/file_system';
import { Logger } from '../../../src/ngtsc/logging';
export interface LinkerPluginOptions extends Partial<LinkerOptions> {
/**
* File-system, used to load up the input source-map and content.
*/
fileSystem: ReadonlyFileSystem;
/**
* Logger used by the linker.
*/
logger: Logger;
}