@wp-playground/client 3.1.25 → 3.1.27
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.d.ts +63 -100
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -1852,139 +1852,94 @@ export type AllPHPVersion = SupportedPHPVersion | LegacyPHPVersion;
|
|
|
1852
1852
|
export interface FileTree extends Record<string, Uint8Array | string | FileTree> {
|
|
1853
1853
|
}
|
|
1854
1854
|
/**
|
|
1855
|
-
* The php.ini directive used to load the extension.
|
|
1856
|
-
*
|
|
1857
|
-
* Use `extension` for regular PHP extensions and `zend_extension` for Zend
|
|
1858
|
-
* extensions such as Xdebug.
|
|
1855
|
+
* The php.ini directive used to load the extension. Use `extension` for
|
|
1856
|
+
* regular PHP extensions and `zend_extension` for Zend extensions like Xdebug.
|
|
1859
1857
|
*/
|
|
1860
1858
|
export type PHPExtensionIniDirective = "extension" | "zend_extension";
|
|
1861
1859
|
/**
|
|
1862
|
-
*
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
/**
|
|
1866
|
-
* PHP major/minor version the artifact was compiled against, e.g. `8.4`.
|
|
1867
|
-
*/
|
|
1868
|
-
phpVersion: string;
|
|
1869
|
-
/**
|
|
1870
|
-
* Relative to the manifest URL/base URL, or an absolute URL.
|
|
1871
|
-
*/
|
|
1872
|
-
file: string;
|
|
1873
|
-
/**
|
|
1874
|
-
* Optional SHA-256 checksum for the fetched `.so` artifact.
|
|
1875
|
-
*/
|
|
1876
|
-
sha256?: string;
|
|
1877
|
-
}
|
|
1878
|
-
/**
|
|
1879
|
-
* Extension artifact manifest.
|
|
1880
|
-
*
|
|
1881
|
-
* A manifest lets callers publish a matrix of `.so` files and lets
|
|
1882
|
-
* `resolvePHPExtension()` select the artifact that matches the current PHP
|
|
1883
|
-
* version. External extension artifacts are JSPI-only.
|
|
1860
|
+
* Extension artifact manifest. Lets callers publish a matrix of `.so` files
|
|
1861
|
+
* and lets `resolvePHPExtension()` select the artifact matching the current
|
|
1862
|
+
* PHP version. External extension artifacts are JSPI-only.
|
|
1884
1863
|
*/
|
|
1885
1864
|
export interface PHPExtensionManifest {
|
|
1886
1865
|
name: string;
|
|
1887
1866
|
version?: string;
|
|
1888
1867
|
mode?: "php-extension";
|
|
1889
|
-
artifacts:
|
|
1868
|
+
artifacts: Array<{
|
|
1869
|
+
/** PHP major/minor version, e.g. `8.4`. */
|
|
1870
|
+
phpVersion: string;
|
|
1871
|
+
/** Relative to the manifest URL/base URL, or an absolute URL. */
|
|
1872
|
+
sourcePath: string;
|
|
1873
|
+
/** URL-backed files needed only by this artifact. */
|
|
1874
|
+
extraFiles?: PHPExtensionManifestExtraFiles;
|
|
1875
|
+
}>;
|
|
1876
|
+
/** URL-backed files shared by every artifact in this manifest. */
|
|
1877
|
+
extraFiles?: PHPExtensionManifestExtraFiles;
|
|
1878
|
+
}
|
|
1879
|
+
export interface PHPExtensionManifestExtraFiles {
|
|
1880
|
+
/**
|
|
1881
|
+
* Absolute VFS path where files and directories are written. When a
|
|
1882
|
+
* manifest declares both top-level and per-artifact `extraFiles`, the
|
|
1883
|
+
* first declared `targetPath` wins. Defaults to
|
|
1884
|
+
* `<extensionDir>/<name>-assets`.
|
|
1885
|
+
*/
|
|
1886
|
+
vfsRoot?: string;
|
|
1887
|
+
nodes?: Array<{
|
|
1888
|
+
/** Joined with the group's `vfsRoot` to form the final VFS path. */
|
|
1889
|
+
vfsPath: string;
|
|
1890
|
+
/** Defaults to "file". Only file nodes need a `sourcePath`. */
|
|
1891
|
+
type?: "file" | "directory";
|
|
1892
|
+
/** Relative to the manifest URL/base URL, or an absolute URL. */
|
|
1893
|
+
sourcePath?: string;
|
|
1894
|
+
}>;
|
|
1890
1895
|
}
|
|
1891
1896
|
/**
|
|
1892
|
-
* Source for a PHP extension `.so`.
|
|
1893
|
-
*
|
|
1894
|
-
*
|
|
1895
|
-
* direct artifact URL, and `format: 'manifest'` when PHP.wasm should select
|
|
1896
|
-
* the right artifact from a manifest.
|
|
1897
|
+
* Source for a PHP extension `.so`. Use `format: 'so'` when the caller has
|
|
1898
|
+
* bytes, `format: 'url'` for a direct artifact URL, and `format: 'manifest'`
|
|
1899
|
+
* when PHP.wasm should select the right artifact from a manifest.
|
|
1897
1900
|
*/
|
|
1898
1901
|
export type PHPExtensionSource = {
|
|
1899
1902
|
format: "so";
|
|
1900
|
-
/**
|
|
1901
|
-
* Required when `PHPExtensionInstallOptions.name` is not set.
|
|
1902
|
-
*/
|
|
1903
1903
|
name?: string;
|
|
1904
1904
|
bytes: Uint8Array | ArrayBuffer;
|
|
1905
|
-
sha256?: string;
|
|
1906
1905
|
} | {
|
|
1907
1906
|
format: "url";
|
|
1908
|
-
/**
|
|
1909
|
-
* Optional extension name. If omitted, PHP.wasm infers the name
|
|
1910
|
-
* from a `.so` filename in the URL.
|
|
1911
|
-
*/
|
|
1912
1907
|
name?: string;
|
|
1913
1908
|
url: string | URL;
|
|
1914
|
-
sha256?: string;
|
|
1915
1909
|
} | {
|
|
1916
1910
|
format: "manifest";
|
|
1917
1911
|
/**
|
|
1918
|
-
*
|
|
1919
|
-
*
|
|
1920
|
-
* In `@php-wasm/universal`, string values must be absolute URLs.
|
|
1921
|
-
* In `@php-wasm/node`, this may also be a filesystem path or a
|
|
1922
|
-
* `file:` URL; `@php-wasm/node` resolves local paths before fetching.
|
|
1912
|
+
* In `@php-wasm/universal`, must be an absolute URL. `@php-wasm/node`
|
|
1913
|
+
* also accepts filesystem paths and `file:` URLs.
|
|
1923
1914
|
*/
|
|
1924
1915
|
manifestUrl: string | URL;
|
|
1925
1916
|
} | {
|
|
1926
1917
|
format: "manifest";
|
|
1927
1918
|
manifest: PHPExtensionManifest;
|
|
1928
|
-
/**
|
|
1929
|
-
* Base URL used to resolve relative artifact paths in an inline
|
|
1930
|
-
* manifest.
|
|
1931
|
-
*/
|
|
1919
|
+
/** Base URL for resolving relative artifact paths. */
|
|
1932
1920
|
baseUrl?: string | URL;
|
|
1933
1921
|
};
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
* Use this for sidecar data files such as ICU data or native-library assets
|
|
1938
|
-
* that the extension expects to find at runtime.
|
|
1939
|
-
*/
|
|
1940
|
-
export interface PHPExtensionExtraFiles {
|
|
1941
|
-
/**
|
|
1942
|
-
* Files are written here. Defaults to
|
|
1943
|
-
* `/internal/shared/extensions/<name>-assets`.
|
|
1944
|
-
*/
|
|
1945
|
-
targetPath?: string;
|
|
1946
|
-
files: FileTree;
|
|
1947
|
-
}
|
|
1948
|
-
/**
|
|
1949
|
-
* Options for staging a PHP extension before startup.
|
|
1950
|
-
*/
|
|
1951
|
-
export interface PHPExtensionInstallOptions {
|
|
1952
|
-
/**
|
|
1953
|
-
* The extension artifact bytes, URL, or manifest.
|
|
1954
|
-
*/
|
|
1922
|
+
export interface ResolvedInstallOptions {
|
|
1923
|
+
/** PHP major/minor version the active runtime is initializing for. */
|
|
1924
|
+
phpVersion: string;
|
|
1955
1925
|
source: PHPExtensionSource;
|
|
1956
|
-
/**
|
|
1957
|
-
* Extension name used for staged file names and the first ini directive.
|
|
1958
|
-
*
|
|
1959
|
-
* This overrides a name inferred from `source`.
|
|
1960
|
-
*/
|
|
1926
|
+
/** Overrides the name inferred from `source`. */
|
|
1961
1927
|
name?: string;
|
|
1962
1928
|
/**
|
|
1963
|
-
* The directive
|
|
1964
|
-
*
|
|
1965
|
-
*
|
|
1966
|
-
* Regular PHP extensions need `extension=/path/to/name.so`. Zend
|
|
1967
|
-
* extensions, such as Xdebug, need `zend_extension=/path/to/name.so`.
|
|
1968
|
-
* This does not edit the main `php.ini`; it controls the generated
|
|
1969
|
-
* per-extension `.ini` file PHP reads while starting.
|
|
1929
|
+
* The first directive of the generated startup `.ini` file. Regular
|
|
1930
|
+
* extensions need `extension=...`; Zend extensions like Xdebug need
|
|
1931
|
+
* `zend_extension=...`.
|
|
1970
1932
|
*/
|
|
1971
1933
|
loadWithIniDirective?: PHPExtensionIniDirective;
|
|
1972
|
-
/**
|
|
1973
|
-
* Additional `key=value` lines written to the generated startup `.ini`
|
|
1974
|
-
* file after the `extension=` or `zend_extension=` directive.
|
|
1975
|
-
*/
|
|
1934
|
+
/** Additional `key=value` lines for the generated startup `.ini` file. */
|
|
1976
1935
|
iniEntries?: Record<string, string>;
|
|
1977
1936
|
/**
|
|
1978
1937
|
* Sidecar files to write into the PHP VFS before the extension is loaded.
|
|
1979
|
-
*
|
|
1980
1938
|
* Use this for data files or dependency assets the extension expects at
|
|
1981
1939
|
* runtime.
|
|
1982
1940
|
*/
|
|
1983
|
-
extraFiles?:
|
|
1984
|
-
/**
|
|
1985
|
-
* Environment variables to add to the PHP runtime before the extension is
|
|
1986
|
-
* loaded.
|
|
1987
|
-
*/
|
|
1941
|
+
extraFiles?: ResolvedExtraFiles;
|
|
1942
|
+
/** Environment variables added before the extension is loaded. */
|
|
1988
1943
|
env?: Record<string, string>;
|
|
1989
1944
|
/**
|
|
1990
1945
|
* VFS directory where PHP.wasm writes the extension `.so` file and its
|
|
@@ -1992,15 +1947,23 @@ export interface PHPExtensionInstallOptions {
|
|
|
1992
1947
|
*/
|
|
1993
1948
|
extensionDir?: string;
|
|
1994
1949
|
/**
|
|
1995
|
-
* Fetch implementation used for
|
|
1996
|
-
*
|
|
1997
|
-
*
|
|
1998
|
-
* Runtimes may provide environment-specific defaults. For example,
|
|
1999
|
-
* `@php-wasm/node` provides local file support for extension manifests and
|
|
2000
|
-
* artifacts.
|
|
1950
|
+
* Fetch implementation used for URL and manifest sources. Runtimes may
|
|
1951
|
+
* provide environment-specific defaults; for example, `@php-wasm/node`
|
|
1952
|
+
* adds local file support.
|
|
2001
1953
|
*/
|
|
2002
1954
|
fetch?: typeof fetch;
|
|
2003
1955
|
}
|
|
1956
|
+
/**
|
|
1957
|
+
* Sidecar files to stage next to an extension. Use this for data files or
|
|
1958
|
+
* native-library assets the extension expects at runtime. All paths are
|
|
1959
|
+
* absolute VFS paths.
|
|
1960
|
+
*/
|
|
1961
|
+
export interface ResolvedExtraFiles {
|
|
1962
|
+
/** Absolute VFS paths to create as empty directories. */
|
|
1963
|
+
directories?: string[];
|
|
1964
|
+
/** Map of absolute VFS paths to file contents. */
|
|
1965
|
+
files: Record<string, Uint8Array | string>;
|
|
1966
|
+
}
|
|
2004
1967
|
export type WithAPIState = {
|
|
2005
1968
|
/**
|
|
2006
1969
|
* Resolves to true when the remote API is ready for
|
|
@@ -5266,7 +5229,7 @@ export type BuiltInPHPWebExtensionName = "intl";
|
|
|
5266
5229
|
* External sources are supported in JSPI runtimes only. Asyncify support is
|
|
5267
5230
|
* limited to bundled extensions shipped with this package.
|
|
5268
5231
|
*/
|
|
5269
|
-
export type RuntimePHPWebExtensionSource =
|
|
5232
|
+
export type RuntimePHPWebExtensionSource = Omit<ResolvedInstallOptions, "phpVersion">;
|
|
5270
5233
|
/**
|
|
5271
5234
|
* PHP extension request accepted by `loadWebRuntime()`.
|
|
5272
5235
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wp-playground/client",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.27",
|
|
4
4
|
"description": "WordPress Playground client",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"main": "./index.cjs",
|
|
39
39
|
"module": "./index.js",
|
|
40
40
|
"types": "index.d.ts",
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "fd598fe315657fd276d7e14d5251c1127d495766",
|
|
42
42
|
"engines": {
|
|
43
43
|
"node": ">=20.10.0",
|
|
44
44
|
"npm": ">=10.2.3"
|