@php-wasm/node 3.1.20 → 3.1.22

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.
@@ -0,0 +1,59 @@
1
+ import type { EmscriptenOptions, PHPExtensionInstallOptions, PHPWasmAsyncMode, SupportedPHPVersion } from '@php-wasm/universal';
2
+ export interface PathMapping {
3
+ hostPath: string;
4
+ vfsPath: string;
5
+ }
6
+ export interface XdebugOptions {
7
+ ideKey?: string;
8
+ pathMappings?: PathMapping[];
9
+ pathSkippings?: string[];
10
+ }
11
+ /**
12
+ * Built-in PHP extensions shipped with `@php-wasm/node`.
13
+ */
14
+ export type BuiltInPHPExtensionName = 'intl' | 'xdebug' | 'redis' | 'memcached';
15
+ /**
16
+ * External PHP extension source that can be installed before PHP starts.
17
+ *
18
+ * The runtime supplies the active PHP version and async mode before resolving
19
+ * the source, so callers only provide the artifact source and install options.
20
+ */
21
+ export type RuntimePHPExtensionSource = PHPExtensionInstallOptions;
22
+ /**
23
+ * Built-in PHP extension request accepted by `loadNodeRuntime()`.
24
+ *
25
+ * Pass a string for defaults, or an object when a built-in extension exposes
26
+ * options. Currently only `xdebug` has options.
27
+ */
28
+ export type BuiltInPHPExtension = BuiltInPHPExtensionName | {
29
+ name: 'xdebug';
30
+ options?: XdebugOptions;
31
+ } | {
32
+ name: Exclude<BuiltInPHPExtensionName, 'xdebug'>;
33
+ };
34
+ /**
35
+ * PHP extension request accepted by `loadNodeRuntime()`.
36
+ *
37
+ * The array may mix built-in extension names with external extension sources:
38
+ *
39
+ * ```ts
40
+ * await loadNodeRuntime('8.4', {
41
+ * extensions: [
42
+ * 'intl',
43
+ * { source: { format: 'manifest', manifestUrl: './manifest.json' } },
44
+ * ],
45
+ * });
46
+ * ```
47
+ *
48
+ * In Node, local manifest and artifact files work without a custom `fetch`
49
+ * implementation. Pass `manifestUrl` as a filesystem path, a `file:` URL, or
50
+ * an HTTP URL.
51
+ */
52
+ export type PHPExtension = BuiltInPHPExtension | RuntimePHPExtensionSource;
53
+ /**
54
+ * Adds PHP extensions to Emscripten options before the Node runtime starts.
55
+ *
56
+ * Extension sources are resolved in parallel so multiple manifest or artifact
57
+ * downloads do not block each other.
58
+ */
59
+ export declare function withPHPExtensions(version: SupportedPHPVersion, asyncMode: PHPWasmAsyncMode, options: EmscriptenOptions, extensions?: PHPExtension[]): Promise<EmscriptenOptions>;
@@ -0,0 +1,20 @@
1
+ import type { PHPExtensionSource } from '@php-wasm/universal';
2
+ /**
3
+ * Converts extension sources accepted by the Node runtime into URL-shaped
4
+ * resources before the universal resolver sees them.
5
+ *
6
+ * The universal resolver deals in URLs because browsers can only fetch
7
+ * extension bytes from URLs. Node callers often pass local paths instead, so
8
+ * this function rewrites direct artifact URLs, manifest URLs, and inline
9
+ * manifest base URLs into `URL` objects while leaving byte sources unchanged.
10
+ */
11
+ export declare function normalizeNodeExtensionSource(source: PHPExtensionSource): PHPExtensionSource;
12
+ /**
13
+ * Fetch implementation used by Node extension loading.
14
+ *
15
+ * It behaves like global `fetch()` for HTTP(S) resources and adds `file:`
16
+ * support for local manifests and artifacts. This lets callers use the same
17
+ * extension API for packages installed on disk and for artifacts hosted
18
+ * remotely.
19
+ */
20
+ export declare function fetchNodeExtensionResource(input: RequestInfo | URL): Promise<Response>;
@@ -1,4 +1,4 @@
1
- import type { PHPLoaderModule, SupportedPHPVersion } from '@php-wasm/universal';
1
+ import type { AllPHPVersion, PHPLoaderModule } from '@php-wasm/universal';
2
2
  /**
3
3
  * Loads the PHP loader module for the given PHP version.
4
4
  *
@@ -11,4 +11,4 @@ import type { PHPLoaderModule, SupportedPHPVersion } from '@php-wasm/universal';
11
11
  * @param version The PHP version to load.
12
12
  * @returns The PHP loader module.
13
13
  */
14
- export declare function getPHPLoaderModule(version?: SupportedPHPVersion | string): Promise<PHPLoaderModule>;
14
+ export declare function getPHPLoaderModule(version?: AllPHPVersion): Promise<PHPLoaderModule>;
package/lib/index.d.ts CHANGED
@@ -5,6 +5,6 @@ export * from './use-host-filesystem';
5
5
  export * from './node-fs-mount';
6
6
  export * from './file-lock-manager-for-posix';
7
7
  export * from './file-lock-manager-for-windows';
8
- export * from './extensions/xdebug/with-xdebug';
8
+ export type { BuiltInPHPExtension, BuiltInPHPExtensionName, PathMapping, PHPExtension, RuntimePHPExtensionSource, XdebugOptions, } from './extensions/load-extensions';
9
9
  export * from './wasm-user-space';
10
10
  export * from './wasm-kernel-space';
@@ -1,11 +1,31 @@
1
- import { type SupportedPHPVersion, type EmscriptenOptions, type FileLockManager } from '@php-wasm/universal';
1
+ import { type AllPHPVersion, type EmscriptenOptions, type FileLockManager } from '@php-wasm/universal';
2
2
  import type { WasmUserSpaceAPI, WasmUserSpaceContext } from './wasm-user-space';
3
- import { type XdebugOptions } from './extensions/xdebug/with-xdebug';
3
+ import { type PHPExtension, type XdebugOptions } from './extensions/load-extensions';
4
4
  export interface PHPLoaderOptions {
5
5
  followSymlinks?: boolean;
6
+ /**
7
+ * PHP extensions to install before the runtime starts.
8
+ *
9
+ * Use built-in names such as `intl`, `xdebug`, `redis`, and `memcached`,
10
+ * or pass an external extension source such as a manifest.
11
+ */
12
+ extensions?: PHPExtension[];
13
+ /**
14
+ * @deprecated Use `extensions: ['xdebug']` or
15
+ * `extensions: [{ name: 'xdebug', options }]` instead.
16
+ */
6
17
  withXdebug?: boolean | XdebugOptions;
18
+ /**
19
+ * @deprecated Use `extensions: ['intl']` instead.
20
+ */
7
21
  withIntl?: boolean;
22
+ /**
23
+ * @deprecated Use `extensions: ['redis']` instead.
24
+ */
8
25
  withRedis?: boolean;
26
+ /**
27
+ * @deprecated Use `extensions: ['memcached']` instead.
28
+ */
9
29
  withMemcached?: boolean;
10
30
  }
11
31
  export type PHPLoaderOptionsForNode = PHPLoaderOptions & {
@@ -54,4 +74,4 @@ export type PHPLoaderOptionsForNode = PHPLoaderOptions & {
54
74
  *
55
75
  * @see load
56
76
  */
57
- export declare function loadNodeRuntime(phpVersion: SupportedPHPVersion, options?: PHPLoaderOptionsForNode): Promise<number>;
77
+ export declare function loadNodeRuntime(phpVersion: AllPHPVersion, options?: PHPLoaderOptionsForNode): Promise<number>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@php-wasm/node",
3
- "version": "3.1.20",
3
+ "version": "3.1.22",
4
4
  "description": "PHP.wasm for Node.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -38,11 +38,6 @@
38
38
  },
39
39
  "license": "GPL-2.0-or-later",
40
40
  "types": "index.d.ts",
41
- "gitHead": "98cfca0a050ef1dacce25710d6ebdf816e80b764",
42
- "engines": {
43
- "node": ">=20.10.0",
44
- "npm": ">=10.2.3"
45
- },
46
41
  "dependencies": {
47
42
  "express": "4.22.0",
48
43
  "fast-xml-parser": "^5.5.1",
@@ -52,18 +47,24 @@
52
47
  "wasm-feature-detect": "1.8.0",
53
48
  "ws": "8.18.0",
54
49
  "yargs": "17.7.2",
55
- "@php-wasm/universal": "3.1.20",
56
- "@php-wasm/node-8-5": "3.1.20",
57
- "@php-wasm/node-8-4": "3.1.20",
58
- "@php-wasm/node-8-3": "3.1.20",
59
- "@php-wasm/node-8-2": "3.1.20",
60
- "@php-wasm/node-8-1": "3.1.20",
61
- "@php-wasm/node-8-0": "3.1.20",
62
- "@php-wasm/node-7-4": "3.1.20",
63
- "@php-wasm/cli-util": "3.1.20",
64
- "@php-wasm/logger": "3.1.20",
65
- "@php-wasm/util": "3.1.20",
66
- "@wp-playground/common": "3.1.20"
50
+ "@php-wasm/universal": "3.1.22",
51
+ "@php-wasm/node-8-5": "3.1.22",
52
+ "@php-wasm/node-8-4": "3.1.22",
53
+ "@php-wasm/node-8-3": "3.1.22",
54
+ "@php-wasm/node-8-2": "3.1.22",
55
+ "@php-wasm/node-8-1": "3.1.22",
56
+ "@php-wasm/node-8-0": "3.1.22",
57
+ "@php-wasm/node-7-4": "3.1.22",
58
+ "@php-wasm/cli-util": "3.1.22",
59
+ "@php-wasm/logger": "3.1.22",
60
+ "@php-wasm/node-5-2": "3.1.22",
61
+ "@php-wasm/util": "3.1.22",
62
+ "@wp-playground/common": "3.1.22"
63
+ },
64
+ "gitHead": "04c986b63dd56fe74e4ed0cf04d00cae7ac050bf",
65
+ "engines": {
66
+ "node": ">=20.10.0",
67
+ "npm": ">=10.2.3"
67
68
  },
68
69
  "packageManager": "npm@10.9.2",
69
70
  "overrides": {
@@ -1,2 +0,0 @@
1
- import type { EmscriptenOptions } from '@php-wasm/universal';
2
- export declare function withIntl(version: "8.5" | "8.4" | "8.3" | "8.2" | "8.1" | "8.0" | "7.4" | undefined, options: EmscriptenOptions): Promise<EmscriptenOptions>;
@@ -1,2 +0,0 @@
1
- import type { EmscriptenOptions } from '@php-wasm/universal';
2
- export declare function withMemcached(version: "8.5" | "8.4" | "8.3" | "8.2" | "8.1" | "8.0" | "7.4" | undefined, options: EmscriptenOptions): Promise<EmscriptenOptions>;
@@ -1,2 +0,0 @@
1
- import type { EmscriptenOptions } from '@php-wasm/universal';
2
- export declare function withRedis(version: "8.5" | "8.4" | "8.3" | "8.2" | "8.1" | "8.0" | "7.4" | undefined, options: EmscriptenOptions): Promise<EmscriptenOptions>;
@@ -1,11 +0,0 @@
1
- import { type EmscriptenOptions } from '@php-wasm/universal';
2
- export interface PathMapping {
3
- hostPath: string;
4
- vfsPath: string;
5
- }
6
- export interface XdebugOptions {
7
- ideKey?: string;
8
- pathMappings?: PathMapping[];
9
- pathSkippings?: string[];
10
- }
11
- export declare function withXdebug(version: "8.5" | "8.4" | "8.3" | "8.2" | "8.1" | "8.0" | "7.4" | undefined, options: EmscriptenOptions, xdebugOptions: XdebugOptions): Promise<EmscriptenOptions>;