@php-wasm/node
Advanced tools
+49
-20
@@ -48,23 +48,52 @@ "use strict"; | ||
| async function getPHPLoaderModule(version = import_universal.LatestSupportedPHPVersion) { | ||
| switch (version) { | ||
| case "8.5": | ||
| return (await import("@php-wasm/node-8-5")).getPHPLoaderModule(); | ||
| case "8.4": | ||
| return (await import("@php-wasm/node-8-4")).getPHPLoaderModule(); | ||
| case "8.3": | ||
| return (await import("@php-wasm/node-8-3")).getPHPLoaderModule(); | ||
| case "8.2": | ||
| return (await import("@php-wasm/node-8-2")).getPHPLoaderModule(); | ||
| case "8.1": | ||
| return (await import("@php-wasm/node-8-1")).getPHPLoaderModule(); | ||
| case "8.0": | ||
| return (await import("@php-wasm/node-8-0")).getPHPLoaderModule(); | ||
| case "7.4": | ||
| return (await import("@php-wasm/node-7-4")).getPHPLoaderModule(); | ||
| case "7.3": | ||
| return (await import("@php-wasm/node-7-3")).getPHPLoaderModule(); | ||
| case "7.2": | ||
| return (await import("@php-wasm/node-7-2")).getPHPLoaderModule(); | ||
| try { | ||
| switch (version) { | ||
| case "8.5": | ||
| return (await import("@php-wasm/node-8-5")).getPHPLoaderModule(); | ||
| case "8.4": | ||
| return (await import("@php-wasm/node-8-4")).getPHPLoaderModule(); | ||
| case "8.3": | ||
| return (await import("@php-wasm/node-8-3")).getPHPLoaderModule(); | ||
| case "8.2": | ||
| return (await import("@php-wasm/node-8-2")).getPHPLoaderModule(); | ||
| case "8.1": | ||
| return (await import("@php-wasm/node-8-1")).getPHPLoaderModule(); | ||
| case "8.0": | ||
| return (await import("@php-wasm/node-8-0")).getPHPLoaderModule(); | ||
| case "7.4": | ||
| return (await import("@php-wasm/node-7-4")).getPHPLoaderModule(); | ||
| case "7.3": | ||
| return (await import("@php-wasm/node-7-3")).getPHPLoaderModule(); | ||
| case "7.2": | ||
| return (await import("@php-wasm/node-7-2")).getPHPLoaderModule(); | ||
| } | ||
| throw new Error(`Unsupported PHP version ${version}`); | ||
| } catch (errorCandidate) { | ||
| if (!errorCandidate || typeof errorCandidate !== "object") { | ||
| throw errorCandidate; | ||
| } | ||
| const error = errorCandidate; | ||
| if (error.message?.includes( | ||
| `SyntaxError: Cannot use 'import.meta' outside a module` | ||
| )) { | ||
| throw new Error( | ||
| `Node.js crashed on a 'import.meta' statement. This happens when running in a node:vm context. Some testing libraries like Jest use heavily customized runtime contexts, involving node:vm, jest-runtime, and custom require() implementations. These contexts do not support 'import.meta' statements and, by extension, cannot run the @php-wasm/node package. Consider using the --experimental-vm-modules flag or switching to a different test runner such as vitest.`, | ||
| { | ||
| cause: error | ||
| } | ||
| ); | ||
| } else if (error?.code === `ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING` || error?.code === `ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING_FLAG` || error?.message?.includes( | ||
| `A dynamic import callback was invoked without --experimental-vm-modules` | ||
| ) || error?.message?.includes( | ||
| `A dynamic import callback was not specified` | ||
| ) || error?.message?.includes(`Must use import to load ES Module`)) { | ||
| throw new Error( | ||
| `Node.js crashed on a 'import()' statement. This happens when running in a node:vm context. Some testing libraries like Jest use runtime contexts, involving node:vm, jest-runtime, or other custom require() implementations. These contexts do not support import() statements and, by extension, cannot run the @php-wasm/node package. Consider using the --experimental-vm-modules flag or switching to a different test runner such as vitest.`, | ||
| { | ||
| cause: error | ||
| } | ||
| ); | ||
| } | ||
| throw error; | ||
| } | ||
| throw new Error(`Unsupported PHP version ${version}`); | ||
| } | ||
@@ -71,0 +100,0 @@ |
+49
-20
@@ -15,23 +15,52 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { | ||
| async function getPHPLoaderModule(version = LatestSupportedPHPVersion) { | ||
| switch (version) { | ||
| case "8.5": | ||
| return (await import("@php-wasm/node-8-5")).getPHPLoaderModule(); | ||
| case "8.4": | ||
| return (await import("@php-wasm/node-8-4")).getPHPLoaderModule(); | ||
| case "8.3": | ||
| return (await import("@php-wasm/node-8-3")).getPHPLoaderModule(); | ||
| case "8.2": | ||
| return (await import("@php-wasm/node-8-2")).getPHPLoaderModule(); | ||
| case "8.1": | ||
| return (await import("@php-wasm/node-8-1")).getPHPLoaderModule(); | ||
| case "8.0": | ||
| return (await import("@php-wasm/node-8-0")).getPHPLoaderModule(); | ||
| case "7.4": | ||
| return (await import("@php-wasm/node-7-4")).getPHPLoaderModule(); | ||
| case "7.3": | ||
| return (await import("@php-wasm/node-7-3")).getPHPLoaderModule(); | ||
| case "7.2": | ||
| return (await import("@php-wasm/node-7-2")).getPHPLoaderModule(); | ||
| try { | ||
| switch (version) { | ||
| case "8.5": | ||
| return (await import("@php-wasm/node-8-5")).getPHPLoaderModule(); | ||
| case "8.4": | ||
| return (await import("@php-wasm/node-8-4")).getPHPLoaderModule(); | ||
| case "8.3": | ||
| return (await import("@php-wasm/node-8-3")).getPHPLoaderModule(); | ||
| case "8.2": | ||
| return (await import("@php-wasm/node-8-2")).getPHPLoaderModule(); | ||
| case "8.1": | ||
| return (await import("@php-wasm/node-8-1")).getPHPLoaderModule(); | ||
| case "8.0": | ||
| return (await import("@php-wasm/node-8-0")).getPHPLoaderModule(); | ||
| case "7.4": | ||
| return (await import("@php-wasm/node-7-4")).getPHPLoaderModule(); | ||
| case "7.3": | ||
| return (await import("@php-wasm/node-7-3")).getPHPLoaderModule(); | ||
| case "7.2": | ||
| return (await import("@php-wasm/node-7-2")).getPHPLoaderModule(); | ||
| } | ||
| throw new Error(`Unsupported PHP version ${version}`); | ||
| } catch (errorCandidate) { | ||
| if (!errorCandidate || typeof errorCandidate !== "object") { | ||
| throw errorCandidate; | ||
| } | ||
| const error = errorCandidate; | ||
| if (error.message?.includes( | ||
| `SyntaxError: Cannot use 'import.meta' outside a module` | ||
| )) { | ||
| throw new Error( | ||
| `Node.js crashed on a 'import.meta' statement. This happens when running in a node:vm context. Some testing libraries like Jest use heavily customized runtime contexts, involving node:vm, jest-runtime, and custom require() implementations. These contexts do not support 'import.meta' statements and, by extension, cannot run the @php-wasm/node package. Consider using the --experimental-vm-modules flag or switching to a different test runner such as vitest.`, | ||
| { | ||
| cause: error | ||
| } | ||
| ); | ||
| } else if (error?.code === `ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING` || error?.code === `ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING_FLAG` || error?.message?.includes( | ||
| `A dynamic import callback was invoked without --experimental-vm-modules` | ||
| ) || error?.message?.includes( | ||
| `A dynamic import callback was not specified` | ||
| ) || error?.message?.includes(`Must use import to load ES Module`)) { | ||
| throw new Error( | ||
| `Node.js crashed on a 'import()' statement. This happens when running in a node:vm context. Some testing libraries like Jest use runtime contexts, involving node:vm, jest-runtime, or other custom require() implementations. These contexts do not support import() statements and, by extension, cannot run the @php-wasm/node package. Consider using the --experimental-vm-modules flag or switching to a different test runner such as vitest.`, | ||
| { | ||
| cause: error | ||
| } | ||
| ); | ||
| } | ||
| throw error; | ||
| } | ||
| throw new Error(`Unsupported PHP version ${version}`); | ||
| } | ||
@@ -38,0 +67,0 @@ |
@@ -14,2 +14,2 @@ import type { PHPLoaderModule, SupportedPHPVersion } from '@php-wasm/universal'; | ||
| */ | ||
| export declare function getPHPLoaderModule(version?: SupportedPHPVersion): Promise<PHPLoaderModule>; | ||
| export declare function getPHPLoaderModule(version?: SupportedPHPVersion | string): Promise<PHPLoaderModule>; |
+16
-16
| { | ||
| "name": "@php-wasm/node", | ||
| "version": "3.0.40", | ||
| "version": "3.0.41", | ||
| "description": "PHP.wasm for Node.js", | ||
@@ -41,3 +41,3 @@ "repository": { | ||
| "types": "index.d.ts", | ||
| "gitHead": "9f0041161949833466bbf857eacfa0ca7776e53e", | ||
| "gitHead": "638b025343c1cfee4f1b1732c0e05d286e67e136", | ||
| "engines": { | ||
@@ -53,16 +53,16 @@ "node": ">=20.18.3", | ||
| "yargs": "17.7.2", | ||
| "@php-wasm/node-polyfills": "3.0.40", | ||
| "@php-wasm/universal": "3.0.40", | ||
| "@php-wasm/node-8-5": "3.0.40", | ||
| "@php-wasm/node-8-4": "3.0.40", | ||
| "@php-wasm/node-8-3": "3.0.40", | ||
| "@php-wasm/node-8-2": "3.0.40", | ||
| "@php-wasm/node-8-1": "3.0.40", | ||
| "@php-wasm/node-8-0": "3.0.40", | ||
| "@php-wasm/node-7-4": "3.0.40", | ||
| "@php-wasm/node-7-3": "3.0.40", | ||
| "@php-wasm/node-7-2": "3.0.40", | ||
| "@php-wasm/logger": "3.0.40", | ||
| "@php-wasm/util": "3.0.40", | ||
| "@wp-playground/common": "3.0.40" | ||
| "@php-wasm/node-polyfills": "3.0.41", | ||
| "@php-wasm/universal": "3.0.41", | ||
| "@php-wasm/node-8-5": "3.0.41", | ||
| "@php-wasm/node-8-4": "3.0.41", | ||
| "@php-wasm/node-8-3": "3.0.41", | ||
| "@php-wasm/node-8-2": "3.0.41", | ||
| "@php-wasm/node-8-1": "3.0.41", | ||
| "@php-wasm/node-8-0": "3.0.41", | ||
| "@php-wasm/node-7-4": "3.0.41", | ||
| "@php-wasm/node-7-3": "3.0.41", | ||
| "@php-wasm/node-7-2": "3.0.41", | ||
| "@php-wasm/logger": "3.0.41", | ||
| "@php-wasm/util": "3.0.41", | ||
| "@wp-playground/common": "3.0.41" | ||
| }, | ||
@@ -69,0 +69,0 @@ "packageManager": "npm@10.9.2", |
Network access
Supply chain riskThis module accesses the network.
Found 3 instances in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 3 instances in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
30915408
0.01%3239
1.95%24
20%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated
Updated
Updated
Updated
Updated
Updated
Updated
Updated
Updated
Updated
Updated
Updated