Skip to content

Commit 108af83

Browse files
author
Cédric Belin
committed
Add the Transformer interface
1 parent 73c24a6 commit 108af83

File tree

4 files changed

+25
-2
lines changed

4 files changed

+25
-2
lines changed

lib/fast_transformer.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
import {Transformer} from "./transformer.js";
2+
13
/**
24
* Removes comments and whitespace from a PHP script, by calling a Web service.
35
*/
4-
export class FastTransformer {
6+
export class FastTransformer implements Transformer {
57

68
/**
79
* Creates a new fast transformer.

lib/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {GulpPlugin, GulpPluginOptions} from "./gulp_plugin.js";
33
export * from "./fast_transformer.js";
44
export * from "./gulp_plugin.js";
55
export * from "./safe_transformer.js";
6+
export * from "./transformer.js";
67

78
/**
89
* Creates a new Gulp plugin.

lib/safe_transformer.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
import {Transformer} from "./transformer.js";
2+
13
/**
24
* Removes comments and whitespace from a PHP script, by calling a PHP process.
35
*/
4-
export class SafeTransformer {
6+
export class SafeTransformer implements Transformer {
57

68
/**
79
* Creates a new safe transformer.

lib/transformer.d.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* Removes comments and whitespace from a PHP script.
3+
*/
4+
export interface Transformer {
5+
6+
/**
7+
* Closes this transformer and releases any resources associated with it.
8+
* @returns Resolves when the transformer is finally disposed.
9+
*/
10+
close(): Promise<void>;
11+
12+
/**
13+
* Processes a PHP script.
14+
* @param file The path to the PHP script.
15+
* @returns The transformed script.
16+
*/
17+
transform(file: string): Promise<string>;
18+
}

0 commit comments

Comments
 (0)