@php-wasm/node 0.1.56 → 0.1.59
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/index.cjs +12 -3
- package/index.d.ts +10 -2
- package/package.json +4 -4
package/index.cjs
CHANGED
|
@@ -67703,8 +67703,12 @@ var BasePHP2 = class {
|
|
|
67703
67703
|
);
|
|
67704
67704
|
}
|
|
67705
67705
|
for (const name in headers) {
|
|
67706
|
+
let HTTP_prefix = "HTTP_";
|
|
67707
|
+
if (["content-type", "content-length"].includes(name.toLowerCase())) {
|
|
67708
|
+
HTTP_prefix = "";
|
|
67709
|
+
}
|
|
67706
67710
|
this.addServerGlobalEntry(
|
|
67707
|
-
|
|
67711
|
+
`${HTTP_prefix}${name.toUpperCase().replace(/-/g, "_")}`,
|
|
67708
67712
|
headers[name]
|
|
67709
67713
|
);
|
|
67710
67714
|
}
|
|
@@ -67862,14 +67866,19 @@ var BasePHP2 = class {
|
|
|
67862
67866
|
}
|
|
67863
67867
|
this[__private__dont__use].FS.rmdir(path);
|
|
67864
67868
|
}
|
|
67865
|
-
listFiles(path) {
|
|
67869
|
+
listFiles(path, options = { prependPath: false }) {
|
|
67866
67870
|
if (!this.fileExists(path)) {
|
|
67867
67871
|
return [];
|
|
67868
67872
|
}
|
|
67869
67873
|
try {
|
|
67870
|
-
|
|
67874
|
+
const files = this[__private__dont__use].FS.readdir(path).filter(
|
|
67871
67875
|
(name) => name !== "." && name !== ".."
|
|
67872
67876
|
);
|
|
67877
|
+
if (options.prependPath) {
|
|
67878
|
+
const prepend = path.replace(/\/$/, "");
|
|
67879
|
+
return files.map((name) => `${prepend}/${name}`);
|
|
67880
|
+
}
|
|
67881
|
+
return files;
|
|
67873
67882
|
} catch (e) {
|
|
67874
67883
|
console.error(e, { path });
|
|
67875
67884
|
return [];
|
package/index.d.ts
CHANGED
|
@@ -253,9 +253,10 @@ export interface IsomorphicLocalPHP extends RequestHandler {
|
|
|
253
253
|
* Lists the files and directories in the given directory.
|
|
254
254
|
*
|
|
255
255
|
* @param path - The directory path to list.
|
|
256
|
+
* @param options - Options for the listing.
|
|
256
257
|
* @returns The list of files and directories in the given directory.
|
|
257
258
|
*/
|
|
258
|
-
listFiles(path: string): string[];
|
|
259
|
+
listFiles(path: string, options?: ListFilesOptions): string[];
|
|
259
260
|
/**
|
|
260
261
|
* Checks if a directory exists in the PHP filesystem.
|
|
261
262
|
*
|
|
@@ -426,6 +427,13 @@ export interface RmDirOptions {
|
|
|
426
427
|
*/
|
|
427
428
|
recursive?: boolean;
|
|
428
429
|
}
|
|
430
|
+
export interface ListFilesOptions {
|
|
431
|
+
/**
|
|
432
|
+
* If true, prepend given folder path to all file names.
|
|
433
|
+
* Default: false.
|
|
434
|
+
*/
|
|
435
|
+
prependPath: boolean;
|
|
436
|
+
}
|
|
429
437
|
declare const SupportedPHPVersions: readonly [
|
|
430
438
|
"8.2",
|
|
431
439
|
"8.1",
|
|
@@ -593,7 +601,7 @@ declare abstract class BasePHP implements IsomorphicLocalPHP {
|
|
|
593
601
|
/** @inheritDoc */
|
|
594
602
|
rmdir(path: string, options?: RmDirOptions): void;
|
|
595
603
|
/** @inheritDoc */
|
|
596
|
-
listFiles(path: string): string[];
|
|
604
|
+
listFiles(path: string, options?: ListFilesOptions): string[];
|
|
597
605
|
/** @inheritDoc */
|
|
598
606
|
isDir(path: string): boolean;
|
|
599
607
|
/** @inheritDoc */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@php-wasm/node",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.59",
|
|
4
4
|
"description": "PHP.wasm for Node.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
"license": "GPL-2.0-or-later",
|
|
29
29
|
"main": "index.cjs",
|
|
30
30
|
"types": "index.d.ts",
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "2bc229b001da476da85d98d1b130ef86ea8e685b",
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"comlink": "^4.4.1",
|
|
34
34
|
"express": "4.18.2",
|
|
35
35
|
"ws": "8.13.0",
|
|
36
36
|
"yargs": "17.7.2",
|
|
37
|
-
"@php-wasm/universal": "0.1.
|
|
38
|
-
"@php-wasm/util": "0.1.
|
|
37
|
+
"@php-wasm/universal": "0.1.59",
|
|
38
|
+
"@php-wasm/util": "0.1.59"
|
|
39
39
|
}
|
|
40
40
|
}
|