UNPKG

1.79 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.io/license
7 */
8/// <reference types="node" />
9import { BaseException, Path } from '@angular-devkit/core';
10export declare class UnknownActionException extends BaseException {
11 constructor(action: Action);
12}
13export declare type Action = CreateFileAction | OverwriteFileAction | RenameFileAction | DeleteFileAction;
14export interface ActionBase {
15 readonly id: number;
16 readonly parent: number;
17 readonly path: Path;
18}
19export declare class ActionList implements Iterable<Action> {
20 private _actions;
21 protected _action(action: Partial<Action>): void;
22 create(path: Path, content: Buffer): void;
23 overwrite(path: Path, content: Buffer): void;
24 rename(path: Path, to: Path): void;
25 delete(path: Path): void;
26 optimize(): void;
27 push(action: Action): void;
28 get(i: number): Action;
29 has(action: Action): boolean;
30 find(predicate: (value: Action) => boolean): Action | null;
31 forEach(fn: (value: Action, index: number, array: Action[]) => void, thisArg?: {}): void;
32 get length(): number;
33 [Symbol.iterator](): IterableIterator<Action>;
34}
35export declare function isContentAction(action: Action): action is CreateFileAction | OverwriteFileAction;
36export interface CreateFileAction extends ActionBase {
37 readonly kind: 'c';
38 readonly content: Buffer;
39}
40export interface OverwriteFileAction extends ActionBase {
41 readonly kind: 'o';
42 readonly content: Buffer;
43}
44export interface RenameFileAction extends ActionBase {
45 readonly kind: 'r';
46 readonly to: Path;
47}
48export interface DeleteFileAction extends ActionBase {
49 readonly kind: 'd';
50}