@php-wasm/util 0.9.19 → 0.9.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/index.d.ts +0 -146
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@php-wasm/util",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.20",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"typedoc": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"access": "public",
|
|
14
14
|
"directory": "../../../dist/packages/php-wasm/util"
|
|
15
15
|
},
|
|
16
|
-
"gitHead": "
|
|
16
|
+
"gitHead": "f619fcb719128d247bec296b9339aff52101e948",
|
|
17
17
|
"engines": {
|
|
18
18
|
"node": ">=18.18.0",
|
|
19
19
|
"npm": ">=8.11.0"
|
package/index.d.ts
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
// Generated by dts-bundle-generator v7.2.0
|
|
2
|
-
|
|
3
|
-
export interface SemaphoreOptions {
|
|
4
|
-
/**
|
|
5
|
-
* The maximum number of concurrent locks.
|
|
6
|
-
*/
|
|
7
|
-
concurrency: number;
|
|
8
|
-
/**
|
|
9
|
-
* The maximum time to wait for a lock to become available.
|
|
10
|
-
*/
|
|
11
|
-
timeout?: number;
|
|
12
|
-
}
|
|
13
|
-
export declare class AcquireTimeoutError extends Error {
|
|
14
|
-
constructor();
|
|
15
|
-
}
|
|
16
|
-
export declare class Semaphore {
|
|
17
|
-
private _running;
|
|
18
|
-
private concurrency;
|
|
19
|
-
private timeout?;
|
|
20
|
-
private queue;
|
|
21
|
-
constructor({ concurrency, timeout }: SemaphoreOptions);
|
|
22
|
-
get remaining(): number;
|
|
23
|
-
get running(): number;
|
|
24
|
-
acquire(): Promise<() => void>;
|
|
25
|
-
run<T>(fn: () => T | Promise<T>): Promise<T>;
|
|
26
|
-
}
|
|
27
|
-
export declare class PhpWasmError extends Error {
|
|
28
|
-
userFriendlyMessage?: string | undefined;
|
|
29
|
-
constructor(message: string, userFriendlyMessage?: string | undefined);
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* The functions in this module are mostly copied from the generated
|
|
33
|
-
* Emscripten PHP module. This enables features like filesystem journaling,
|
|
34
|
-
* which use some low-level Emscripten APIs and need access to the
|
|
35
|
-
* same path helpers.
|
|
36
|
-
*/
|
|
37
|
-
/**
|
|
38
|
-
* Joins paths together.
|
|
39
|
-
*
|
|
40
|
-
* For example:
|
|
41
|
-
*
|
|
42
|
-
* > joinPaths('wordpress', 'wp-content')
|
|
43
|
-
* 'wordpress/wp-content'
|
|
44
|
-
*
|
|
45
|
-
* Use this for all PHP paths and **do not** use path.join().
|
|
46
|
-
* This is important because Emscripten paths are **always**
|
|
47
|
-
* POSIX-style paths. Imagine joining paths on Windows:
|
|
48
|
-
*
|
|
49
|
-
* > path.join('wordpress', 'wp-content')
|
|
50
|
-
* '\\wordpress\\wp-content' // invalid in PHP.wasm
|
|
51
|
-
*
|
|
52
|
-
* See the path.join issue for more details:
|
|
53
|
-
*
|
|
54
|
-
* https://github.com/WordPress/playground-tools/issues/11#issuecomment-1579074763
|
|
55
|
-
*
|
|
56
|
-
* @param paths Paths segments to join
|
|
57
|
-
* @returns A joined path
|
|
58
|
-
*/
|
|
59
|
-
export declare function joinPaths(...paths: string[]): string;
|
|
60
|
-
/**
|
|
61
|
-
* Returns the directory name of a path.
|
|
62
|
-
*
|
|
63
|
-
* @param path
|
|
64
|
-
* @returns
|
|
65
|
-
*/
|
|
66
|
-
export declare function dirname(path: string): string;
|
|
67
|
-
/**
|
|
68
|
-
* Returns the last portion of a path.
|
|
69
|
-
*
|
|
70
|
-
* @param path - The path to extract the basename from.
|
|
71
|
-
* @returns The basename of the path.
|
|
72
|
-
*/
|
|
73
|
-
export declare function basename(path: string): string;
|
|
74
|
-
/**
|
|
75
|
-
* Normalizes a path.
|
|
76
|
-
*
|
|
77
|
-
* For example:
|
|
78
|
-
*
|
|
79
|
-
* > normalizePath('wordpress/wp-content/../')
|
|
80
|
-
* 'wordpress'
|
|
81
|
-
*
|
|
82
|
-
* @param path
|
|
83
|
-
* @returns
|
|
84
|
-
*/
|
|
85
|
-
export declare function normalizePath(path: string): string;
|
|
86
|
-
/**
|
|
87
|
-
* Checks if the given parent path is an ancestor of the given child path.
|
|
88
|
-
*
|
|
89
|
-
* @param parent The parent path to check.
|
|
90
|
-
* @param child The child path to verify against the parent.
|
|
91
|
-
* @returns Whether the `parent` path is an ancestor of the `child` path.
|
|
92
|
-
*/
|
|
93
|
-
export declare function isParentOf(parent: string, child: string): boolean;
|
|
94
|
-
export type Listener = (...args: any[]) => any;
|
|
95
|
-
export interface ProcessOptions {
|
|
96
|
-
cwd?: string;
|
|
97
|
-
env?: Record<string, string>;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Usage:
|
|
101
|
-
* ```ts
|
|
102
|
-
* php.setSpawnHandler(
|
|
103
|
-
* createSpawnHandler(function (command, processApi) {
|
|
104
|
-
* console.log(processApi.flushStdin());
|
|
105
|
-
* processApi.stdout('/\n/tmp\n/home');
|
|
106
|
-
* processApi.exit(0);
|
|
107
|
-
* })
|
|
108
|
-
* );
|
|
109
|
-
* ```
|
|
110
|
-
* @param program
|
|
111
|
-
* @returns
|
|
112
|
-
*/
|
|
113
|
-
export declare function createSpawnHandler(program: (command: string[], processApi: ProcessApi, options: ProcessOptions) => void | Promise<void>): any;
|
|
114
|
-
declare class EventEmitter {
|
|
115
|
-
listeners: Record<string, Listener[]>;
|
|
116
|
-
emit(eventName: string, data: any): void;
|
|
117
|
-
on(eventName: string, listener: Listener): void;
|
|
118
|
-
}
|
|
119
|
-
declare class ProcessApi extends EventEmitter {
|
|
120
|
-
private childProcess;
|
|
121
|
-
private exited;
|
|
122
|
-
private stdinData;
|
|
123
|
-
constructor(childProcess: ChildProcess);
|
|
124
|
-
stdout(data: string | ArrayBuffer): void;
|
|
125
|
-
stdoutEnd(): void;
|
|
126
|
-
stderr(data: string | ArrayBuffer): void;
|
|
127
|
-
stderrEnd(): void;
|
|
128
|
-
exit(code: number): void;
|
|
129
|
-
flushStdin(): void;
|
|
130
|
-
}
|
|
131
|
-
export type StdIn = {
|
|
132
|
-
write: (data: string) => void;
|
|
133
|
-
};
|
|
134
|
-
declare class ChildProcess extends EventEmitter {
|
|
135
|
-
pid: number;
|
|
136
|
-
stdout: EventEmitter;
|
|
137
|
-
stderr: EventEmitter;
|
|
138
|
-
stdin: StdIn;
|
|
139
|
-
constructor(pid?: number);
|
|
140
|
-
}
|
|
141
|
-
export declare function randomString(length?: number, specialChars?: string): string;
|
|
142
|
-
export declare function randomFilename(): string;
|
|
143
|
-
export declare function phpVar(value: unknown): string;
|
|
144
|
-
export declare function phpVars<T extends Record<string, unknown>>(vars: T): Record<keyof T, string>;
|
|
145
|
-
|
|
146
|
-
export {};
|