UNPKG

1.75 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.dev/license
7 */
8import { BaseException, Path } from '@angular-devkit/core';
9export declare class UnknownActionException extends BaseException {
10 constructor(action: Action);
11}
12export type Action = CreateFileAction | OverwriteFileAction | RenameFileAction | DeleteFileAction;
13export interface ActionBase {
14 readonly id: number;
15 readonly parent: number;
16 readonly path: Path;
17}
18export declare class ActionList implements Iterable<Action> {
19 private _actions;
20 protected _action(action: Partial<Action>): void;
21 create(path: Path, content: Buffer): void;
22 overwrite(path: Path, content: Buffer): void;
23 rename(path: Path, to: Path): void;
24 delete(path: Path): void;
25 optimize(): void;
26 push(action: Action): void;
27 get(i: number): Action;
28 has(action: Action): boolean;
29 find(predicate: (value: Action) => boolean): Action | null;
30 forEach(fn: (value: Action, index: number, array: Action[]) => void, thisArg?: {}): void;
31 get length(): number;
32 [Symbol.iterator](): IterableIterator<Action>;
33}
34export declare function isContentAction(action: Action): action is CreateFileAction | OverwriteFileAction;
35export interface CreateFileAction extends ActionBase {
36 readonly kind: 'c';
37 readonly content: Buffer;
38}
39export interface OverwriteFileAction extends ActionBase {
40 readonly kind: 'o';
41 readonly content: Buffer;
42}
43export interface RenameFileAction extends ActionBase {
44 readonly kind: 'r';
45 readonly to: Path;
46}
47export interface DeleteFileAction extends ActionBase {
48 readonly kind: 'd';
49}