@php-wasm/node 1.1.4 → 1.1.5
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/asyncify/php_7_2.js +23 -0
- package/asyncify/php_7_3.js +23 -0
- package/asyncify/php_7_4.js +23 -0
- package/asyncify/php_8_0.js +23 -0
- package/asyncify/php_8_1.js +23 -0
- package/asyncify/php_8_2.js +23 -0
- package/asyncify/php_8_3.js +23 -0
- package/asyncify/php_8_4.js +23 -0
- package/index.cjs +328 -32
- package/index.js +328 -32
- package/jspi/php_7_2.js +41 -4
- package/jspi/php_7_3.js +41 -4
- package/jspi/php_7_4.js +41 -4
- package/jspi/php_8_0.js +41 -4
- package/jspi/php_8_1.js +41 -4
- package/jspi/php_8_2.js +41 -4
- package/jspi/php_8_3.js +41 -4
- package/jspi/php_8_4.js +41 -4
- package/package.json +8 -8
package/jspi/php_7_3.js
CHANGED
|
@@ -5227,6 +5227,15 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
5227
5227
|
|
|
5228
5228
|
var PHPWASM = {
|
|
5229
5229
|
init: function () {
|
|
5230
|
+
Module['ENV'] = Module['ENV'] || {};
|
|
5231
|
+
// Ensure a platform-level bin directory for a fallback `php` binary.
|
|
5232
|
+
Module['ENV']['PATH'] = [
|
|
5233
|
+
Module['ENV']['PATH'],
|
|
5234
|
+
'/internal/shared/bin',
|
|
5235
|
+
]
|
|
5236
|
+
.filter(Boolean)
|
|
5237
|
+
.join(':');
|
|
5238
|
+
|
|
5230
5239
|
// The /internal directory is required by the C module. It's where the
|
|
5231
5240
|
// stdout, stderr, and headers information are written for the JavaScript
|
|
5232
5241
|
// code to read later on.
|
|
@@ -5237,6 +5246,20 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
5237
5246
|
// The files from the preload directory are preloaded using the
|
|
5238
5247
|
// auto_prepend_file php.ini directive.
|
|
5239
5248
|
FS.mkdir('/internal/shared/preload');
|
|
5249
|
+
// Platform-level bin directory for a fallback `php` binary. Without it,
|
|
5250
|
+
// PHP may not populate the PHP_BINARY constant.
|
|
5251
|
+
FS.mkdir('/internal/shared/bin');
|
|
5252
|
+
const originalOnRuntimeInitialized = Module['onRuntimeInitialized'];
|
|
5253
|
+
Module['onRuntimeInitialized'] = () => {
|
|
5254
|
+
// Dummy PHP binary for PHP to populate the PHP_BINARY constant.
|
|
5255
|
+
FS.writeFile(
|
|
5256
|
+
'/internal/shared/bin/php',
|
|
5257
|
+
new TextEncoder().encode('#!/bin/sh\nphp "$@"')
|
|
5258
|
+
);
|
|
5259
|
+
// It must be executable to be used by PHP.
|
|
5260
|
+
FS.chmod('/internal/shared/bin/php', 0o755);
|
|
5261
|
+
originalOnRuntimeInitialized();
|
|
5262
|
+
};
|
|
5240
5263
|
// Create stdout and stderr devices. We can't just use Emscripten's
|
|
5241
5264
|
// default stdout and stderr devices because they stop processing data
|
|
5242
5265
|
// on the first null byte. However, when dealing with binary data,
|
|
@@ -5636,13 +5659,27 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
5636
5659
|
if (node?.isSharedFS) {
|
|
5637
5660
|
return true;
|
|
5638
5661
|
}
|
|
5662
|
+
|
|
5639
5663
|
// Handle PROXYFS nodes which wrap other nodes.
|
|
5640
|
-
if (
|
|
5664
|
+
if (
|
|
5665
|
+
!node?.mount?.opts?.fs?.lookupPath ||
|
|
5666
|
+
!node?.mount?.type?.realPath
|
|
5667
|
+
) {
|
|
5668
|
+
return false;
|
|
5669
|
+
}
|
|
5670
|
+
|
|
5671
|
+
// Only NODEFS can be shared between workers at the moment.
|
|
5672
|
+
if (node.mount.type !== NODEFS) {
|
|
5673
|
+
return false;
|
|
5674
|
+
}
|
|
5675
|
+
const vfsPath = node.mount.type.realPath(node);
|
|
5676
|
+
try {
|
|
5677
|
+
const underlyingNode =
|
|
5678
|
+
node.mount.opts.fs.lookupPath(vfsPath)?.node;
|
|
5679
|
+
return !!underlyingNode?.isSharedFS;
|
|
5680
|
+
} catch (e) {
|
|
5641
5681
|
return false;
|
|
5642
5682
|
}
|
|
5643
|
-
const vfsPath = NODEFS.realPath(node);
|
|
5644
|
-
const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node;
|
|
5645
|
-
return !!underlyingNode?.isSharedFS;
|
|
5646
5683
|
},
|
|
5647
5684
|
is_path_to_shared_fs(path) {
|
|
5648
5685
|
const { node } = FS.lookupPath(path);
|
package/jspi/php_7_4.js
CHANGED
|
@@ -5227,6 +5227,15 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
5227
5227
|
|
|
5228
5228
|
var PHPWASM = {
|
|
5229
5229
|
init: function () {
|
|
5230
|
+
Module['ENV'] = Module['ENV'] || {};
|
|
5231
|
+
// Ensure a platform-level bin directory for a fallback `php` binary.
|
|
5232
|
+
Module['ENV']['PATH'] = [
|
|
5233
|
+
Module['ENV']['PATH'],
|
|
5234
|
+
'/internal/shared/bin',
|
|
5235
|
+
]
|
|
5236
|
+
.filter(Boolean)
|
|
5237
|
+
.join(':');
|
|
5238
|
+
|
|
5230
5239
|
// The /internal directory is required by the C module. It's where the
|
|
5231
5240
|
// stdout, stderr, and headers information are written for the JavaScript
|
|
5232
5241
|
// code to read later on.
|
|
@@ -5237,6 +5246,20 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
5237
5246
|
// The files from the preload directory are preloaded using the
|
|
5238
5247
|
// auto_prepend_file php.ini directive.
|
|
5239
5248
|
FS.mkdir('/internal/shared/preload');
|
|
5249
|
+
// Platform-level bin directory for a fallback `php` binary. Without it,
|
|
5250
|
+
// PHP may not populate the PHP_BINARY constant.
|
|
5251
|
+
FS.mkdir('/internal/shared/bin');
|
|
5252
|
+
const originalOnRuntimeInitialized = Module['onRuntimeInitialized'];
|
|
5253
|
+
Module['onRuntimeInitialized'] = () => {
|
|
5254
|
+
// Dummy PHP binary for PHP to populate the PHP_BINARY constant.
|
|
5255
|
+
FS.writeFile(
|
|
5256
|
+
'/internal/shared/bin/php',
|
|
5257
|
+
new TextEncoder().encode('#!/bin/sh\nphp "$@"')
|
|
5258
|
+
);
|
|
5259
|
+
// It must be executable to be used by PHP.
|
|
5260
|
+
FS.chmod('/internal/shared/bin/php', 0o755);
|
|
5261
|
+
originalOnRuntimeInitialized();
|
|
5262
|
+
};
|
|
5240
5263
|
// Create stdout and stderr devices. We can't just use Emscripten's
|
|
5241
5264
|
// default stdout and stderr devices because they stop processing data
|
|
5242
5265
|
// on the first null byte. However, when dealing with binary data,
|
|
@@ -5636,13 +5659,27 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
5636
5659
|
if (node?.isSharedFS) {
|
|
5637
5660
|
return true;
|
|
5638
5661
|
}
|
|
5662
|
+
|
|
5639
5663
|
// Handle PROXYFS nodes which wrap other nodes.
|
|
5640
|
-
if (
|
|
5664
|
+
if (
|
|
5665
|
+
!node?.mount?.opts?.fs?.lookupPath ||
|
|
5666
|
+
!node?.mount?.type?.realPath
|
|
5667
|
+
) {
|
|
5668
|
+
return false;
|
|
5669
|
+
}
|
|
5670
|
+
|
|
5671
|
+
// Only NODEFS can be shared between workers at the moment.
|
|
5672
|
+
if (node.mount.type !== NODEFS) {
|
|
5673
|
+
return false;
|
|
5674
|
+
}
|
|
5675
|
+
const vfsPath = node.mount.type.realPath(node);
|
|
5676
|
+
try {
|
|
5677
|
+
const underlyingNode =
|
|
5678
|
+
node.mount.opts.fs.lookupPath(vfsPath)?.node;
|
|
5679
|
+
return !!underlyingNode?.isSharedFS;
|
|
5680
|
+
} catch (e) {
|
|
5641
5681
|
return false;
|
|
5642
5682
|
}
|
|
5643
|
-
const vfsPath = NODEFS.realPath(node);
|
|
5644
|
-
const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node;
|
|
5645
|
-
return !!underlyingNode?.isSharedFS;
|
|
5646
5683
|
},
|
|
5647
5684
|
is_path_to_shared_fs(path) {
|
|
5648
5685
|
const { node } = FS.lookupPath(path);
|
package/jspi/php_8_0.js
CHANGED
|
@@ -5245,6 +5245,15 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
5245
5245
|
|
|
5246
5246
|
var PHPWASM = {
|
|
5247
5247
|
init: function () {
|
|
5248
|
+
Module['ENV'] = Module['ENV'] || {};
|
|
5249
|
+
// Ensure a platform-level bin directory for a fallback `php` binary.
|
|
5250
|
+
Module['ENV']['PATH'] = [
|
|
5251
|
+
Module['ENV']['PATH'],
|
|
5252
|
+
'/internal/shared/bin',
|
|
5253
|
+
]
|
|
5254
|
+
.filter(Boolean)
|
|
5255
|
+
.join(':');
|
|
5256
|
+
|
|
5248
5257
|
// The /internal directory is required by the C module. It's where the
|
|
5249
5258
|
// stdout, stderr, and headers information are written for the JavaScript
|
|
5250
5259
|
// code to read later on.
|
|
@@ -5255,6 +5264,20 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
5255
5264
|
// The files from the preload directory are preloaded using the
|
|
5256
5265
|
// auto_prepend_file php.ini directive.
|
|
5257
5266
|
FS.mkdir('/internal/shared/preload');
|
|
5267
|
+
// Platform-level bin directory for a fallback `php` binary. Without it,
|
|
5268
|
+
// PHP may not populate the PHP_BINARY constant.
|
|
5269
|
+
FS.mkdir('/internal/shared/bin');
|
|
5270
|
+
const originalOnRuntimeInitialized = Module['onRuntimeInitialized'];
|
|
5271
|
+
Module['onRuntimeInitialized'] = () => {
|
|
5272
|
+
// Dummy PHP binary for PHP to populate the PHP_BINARY constant.
|
|
5273
|
+
FS.writeFile(
|
|
5274
|
+
'/internal/shared/bin/php',
|
|
5275
|
+
new TextEncoder().encode('#!/bin/sh\nphp "$@"')
|
|
5276
|
+
);
|
|
5277
|
+
// It must be executable to be used by PHP.
|
|
5278
|
+
FS.chmod('/internal/shared/bin/php', 0o755);
|
|
5279
|
+
originalOnRuntimeInitialized();
|
|
5280
|
+
};
|
|
5258
5281
|
// Create stdout and stderr devices. We can't just use Emscripten's
|
|
5259
5282
|
// default stdout and stderr devices because they stop processing data
|
|
5260
5283
|
// on the first null byte. However, when dealing with binary data,
|
|
@@ -5654,13 +5677,27 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
5654
5677
|
if (node?.isSharedFS) {
|
|
5655
5678
|
return true;
|
|
5656
5679
|
}
|
|
5680
|
+
|
|
5657
5681
|
// Handle PROXYFS nodes which wrap other nodes.
|
|
5658
|
-
if (
|
|
5682
|
+
if (
|
|
5683
|
+
!node?.mount?.opts?.fs?.lookupPath ||
|
|
5684
|
+
!node?.mount?.type?.realPath
|
|
5685
|
+
) {
|
|
5686
|
+
return false;
|
|
5687
|
+
}
|
|
5688
|
+
|
|
5689
|
+
// Only NODEFS can be shared between workers at the moment.
|
|
5690
|
+
if (node.mount.type !== NODEFS) {
|
|
5691
|
+
return false;
|
|
5692
|
+
}
|
|
5693
|
+
const vfsPath = node.mount.type.realPath(node);
|
|
5694
|
+
try {
|
|
5695
|
+
const underlyingNode =
|
|
5696
|
+
node.mount.opts.fs.lookupPath(vfsPath)?.node;
|
|
5697
|
+
return !!underlyingNode?.isSharedFS;
|
|
5698
|
+
} catch (e) {
|
|
5659
5699
|
return false;
|
|
5660
5700
|
}
|
|
5661
|
-
const vfsPath = NODEFS.realPath(node);
|
|
5662
|
-
const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node;
|
|
5663
|
-
return !!underlyingNode?.isSharedFS;
|
|
5664
5701
|
},
|
|
5665
5702
|
is_path_to_shared_fs(path) {
|
|
5666
5703
|
const { node } = FS.lookupPath(path);
|
package/jspi/php_8_1.js
CHANGED
|
@@ -5245,6 +5245,15 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
5245
5245
|
|
|
5246
5246
|
var PHPWASM = {
|
|
5247
5247
|
init: function () {
|
|
5248
|
+
Module['ENV'] = Module['ENV'] || {};
|
|
5249
|
+
// Ensure a platform-level bin directory for a fallback `php` binary.
|
|
5250
|
+
Module['ENV']['PATH'] = [
|
|
5251
|
+
Module['ENV']['PATH'],
|
|
5252
|
+
'/internal/shared/bin',
|
|
5253
|
+
]
|
|
5254
|
+
.filter(Boolean)
|
|
5255
|
+
.join(':');
|
|
5256
|
+
|
|
5248
5257
|
// The /internal directory is required by the C module. It's where the
|
|
5249
5258
|
// stdout, stderr, and headers information are written for the JavaScript
|
|
5250
5259
|
// code to read later on.
|
|
@@ -5255,6 +5264,20 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
5255
5264
|
// The files from the preload directory are preloaded using the
|
|
5256
5265
|
// auto_prepend_file php.ini directive.
|
|
5257
5266
|
FS.mkdir('/internal/shared/preload');
|
|
5267
|
+
// Platform-level bin directory for a fallback `php` binary. Without it,
|
|
5268
|
+
// PHP may not populate the PHP_BINARY constant.
|
|
5269
|
+
FS.mkdir('/internal/shared/bin');
|
|
5270
|
+
const originalOnRuntimeInitialized = Module['onRuntimeInitialized'];
|
|
5271
|
+
Module['onRuntimeInitialized'] = () => {
|
|
5272
|
+
// Dummy PHP binary for PHP to populate the PHP_BINARY constant.
|
|
5273
|
+
FS.writeFile(
|
|
5274
|
+
'/internal/shared/bin/php',
|
|
5275
|
+
new TextEncoder().encode('#!/bin/sh\nphp "$@"')
|
|
5276
|
+
);
|
|
5277
|
+
// It must be executable to be used by PHP.
|
|
5278
|
+
FS.chmod('/internal/shared/bin/php', 0o755);
|
|
5279
|
+
originalOnRuntimeInitialized();
|
|
5280
|
+
};
|
|
5258
5281
|
// Create stdout and stderr devices. We can't just use Emscripten's
|
|
5259
5282
|
// default stdout and stderr devices because they stop processing data
|
|
5260
5283
|
// on the first null byte. However, when dealing with binary data,
|
|
@@ -5654,13 +5677,27 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
5654
5677
|
if (node?.isSharedFS) {
|
|
5655
5678
|
return true;
|
|
5656
5679
|
}
|
|
5680
|
+
|
|
5657
5681
|
// Handle PROXYFS nodes which wrap other nodes.
|
|
5658
|
-
if (
|
|
5682
|
+
if (
|
|
5683
|
+
!node?.mount?.opts?.fs?.lookupPath ||
|
|
5684
|
+
!node?.mount?.type?.realPath
|
|
5685
|
+
) {
|
|
5686
|
+
return false;
|
|
5687
|
+
}
|
|
5688
|
+
|
|
5689
|
+
// Only NODEFS can be shared between workers at the moment.
|
|
5690
|
+
if (node.mount.type !== NODEFS) {
|
|
5691
|
+
return false;
|
|
5692
|
+
}
|
|
5693
|
+
const vfsPath = node.mount.type.realPath(node);
|
|
5694
|
+
try {
|
|
5695
|
+
const underlyingNode =
|
|
5696
|
+
node.mount.opts.fs.lookupPath(vfsPath)?.node;
|
|
5697
|
+
return !!underlyingNode?.isSharedFS;
|
|
5698
|
+
} catch (e) {
|
|
5659
5699
|
return false;
|
|
5660
5700
|
}
|
|
5661
|
-
const vfsPath = NODEFS.realPath(node);
|
|
5662
|
-
const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node;
|
|
5663
|
-
return !!underlyingNode?.isSharedFS;
|
|
5664
5701
|
},
|
|
5665
5702
|
is_path_to_shared_fs(path) {
|
|
5666
5703
|
const { node } = FS.lookupPath(path);
|
package/jspi/php_8_2.js
CHANGED
|
@@ -5245,6 +5245,15 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
5245
5245
|
|
|
5246
5246
|
var PHPWASM = {
|
|
5247
5247
|
init: function () {
|
|
5248
|
+
Module['ENV'] = Module['ENV'] || {};
|
|
5249
|
+
// Ensure a platform-level bin directory for a fallback `php` binary.
|
|
5250
|
+
Module['ENV']['PATH'] = [
|
|
5251
|
+
Module['ENV']['PATH'],
|
|
5252
|
+
'/internal/shared/bin',
|
|
5253
|
+
]
|
|
5254
|
+
.filter(Boolean)
|
|
5255
|
+
.join(':');
|
|
5256
|
+
|
|
5248
5257
|
// The /internal directory is required by the C module. It's where the
|
|
5249
5258
|
// stdout, stderr, and headers information are written for the JavaScript
|
|
5250
5259
|
// code to read later on.
|
|
@@ -5255,6 +5264,20 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
5255
5264
|
// The files from the preload directory are preloaded using the
|
|
5256
5265
|
// auto_prepend_file php.ini directive.
|
|
5257
5266
|
FS.mkdir('/internal/shared/preload');
|
|
5267
|
+
// Platform-level bin directory for a fallback `php` binary. Without it,
|
|
5268
|
+
// PHP may not populate the PHP_BINARY constant.
|
|
5269
|
+
FS.mkdir('/internal/shared/bin');
|
|
5270
|
+
const originalOnRuntimeInitialized = Module['onRuntimeInitialized'];
|
|
5271
|
+
Module['onRuntimeInitialized'] = () => {
|
|
5272
|
+
// Dummy PHP binary for PHP to populate the PHP_BINARY constant.
|
|
5273
|
+
FS.writeFile(
|
|
5274
|
+
'/internal/shared/bin/php',
|
|
5275
|
+
new TextEncoder().encode('#!/bin/sh\nphp "$@"')
|
|
5276
|
+
);
|
|
5277
|
+
// It must be executable to be used by PHP.
|
|
5278
|
+
FS.chmod('/internal/shared/bin/php', 0o755);
|
|
5279
|
+
originalOnRuntimeInitialized();
|
|
5280
|
+
};
|
|
5258
5281
|
// Create stdout and stderr devices. We can't just use Emscripten's
|
|
5259
5282
|
// default stdout and stderr devices because they stop processing data
|
|
5260
5283
|
// on the first null byte. However, when dealing with binary data,
|
|
@@ -5654,13 +5677,27 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
5654
5677
|
if (node?.isSharedFS) {
|
|
5655
5678
|
return true;
|
|
5656
5679
|
}
|
|
5680
|
+
|
|
5657
5681
|
// Handle PROXYFS nodes which wrap other nodes.
|
|
5658
|
-
if (
|
|
5682
|
+
if (
|
|
5683
|
+
!node?.mount?.opts?.fs?.lookupPath ||
|
|
5684
|
+
!node?.mount?.type?.realPath
|
|
5685
|
+
) {
|
|
5686
|
+
return false;
|
|
5687
|
+
}
|
|
5688
|
+
|
|
5689
|
+
// Only NODEFS can be shared between workers at the moment.
|
|
5690
|
+
if (node.mount.type !== NODEFS) {
|
|
5691
|
+
return false;
|
|
5692
|
+
}
|
|
5693
|
+
const vfsPath = node.mount.type.realPath(node);
|
|
5694
|
+
try {
|
|
5695
|
+
const underlyingNode =
|
|
5696
|
+
node.mount.opts.fs.lookupPath(vfsPath)?.node;
|
|
5697
|
+
return !!underlyingNode?.isSharedFS;
|
|
5698
|
+
} catch (e) {
|
|
5659
5699
|
return false;
|
|
5660
5700
|
}
|
|
5661
|
-
const vfsPath = NODEFS.realPath(node);
|
|
5662
|
-
const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node;
|
|
5663
|
-
return !!underlyingNode?.isSharedFS;
|
|
5664
5701
|
},
|
|
5665
5702
|
is_path_to_shared_fs(path) {
|
|
5666
5703
|
const { node } = FS.lookupPath(path);
|
package/jspi/php_8_3.js
CHANGED
|
@@ -5245,6 +5245,15 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
5245
5245
|
|
|
5246
5246
|
var PHPWASM = {
|
|
5247
5247
|
init: function () {
|
|
5248
|
+
Module['ENV'] = Module['ENV'] || {};
|
|
5249
|
+
// Ensure a platform-level bin directory for a fallback `php` binary.
|
|
5250
|
+
Module['ENV']['PATH'] = [
|
|
5251
|
+
Module['ENV']['PATH'],
|
|
5252
|
+
'/internal/shared/bin',
|
|
5253
|
+
]
|
|
5254
|
+
.filter(Boolean)
|
|
5255
|
+
.join(':');
|
|
5256
|
+
|
|
5248
5257
|
// The /internal directory is required by the C module. It's where the
|
|
5249
5258
|
// stdout, stderr, and headers information are written for the JavaScript
|
|
5250
5259
|
// code to read later on.
|
|
@@ -5255,6 +5264,20 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
5255
5264
|
// The files from the preload directory are preloaded using the
|
|
5256
5265
|
// auto_prepend_file php.ini directive.
|
|
5257
5266
|
FS.mkdir('/internal/shared/preload');
|
|
5267
|
+
// Platform-level bin directory for a fallback `php` binary. Without it,
|
|
5268
|
+
// PHP may not populate the PHP_BINARY constant.
|
|
5269
|
+
FS.mkdir('/internal/shared/bin');
|
|
5270
|
+
const originalOnRuntimeInitialized = Module['onRuntimeInitialized'];
|
|
5271
|
+
Module['onRuntimeInitialized'] = () => {
|
|
5272
|
+
// Dummy PHP binary for PHP to populate the PHP_BINARY constant.
|
|
5273
|
+
FS.writeFile(
|
|
5274
|
+
'/internal/shared/bin/php',
|
|
5275
|
+
new TextEncoder().encode('#!/bin/sh\nphp "$@"')
|
|
5276
|
+
);
|
|
5277
|
+
// It must be executable to be used by PHP.
|
|
5278
|
+
FS.chmod('/internal/shared/bin/php', 0o755);
|
|
5279
|
+
originalOnRuntimeInitialized();
|
|
5280
|
+
};
|
|
5258
5281
|
// Create stdout and stderr devices. We can't just use Emscripten's
|
|
5259
5282
|
// default stdout and stderr devices because they stop processing data
|
|
5260
5283
|
// on the first null byte. However, when dealing with binary data,
|
|
@@ -5654,13 +5677,27 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
5654
5677
|
if (node?.isSharedFS) {
|
|
5655
5678
|
return true;
|
|
5656
5679
|
}
|
|
5680
|
+
|
|
5657
5681
|
// Handle PROXYFS nodes which wrap other nodes.
|
|
5658
|
-
if (
|
|
5682
|
+
if (
|
|
5683
|
+
!node?.mount?.opts?.fs?.lookupPath ||
|
|
5684
|
+
!node?.mount?.type?.realPath
|
|
5685
|
+
) {
|
|
5686
|
+
return false;
|
|
5687
|
+
}
|
|
5688
|
+
|
|
5689
|
+
// Only NODEFS can be shared between workers at the moment.
|
|
5690
|
+
if (node.mount.type !== NODEFS) {
|
|
5691
|
+
return false;
|
|
5692
|
+
}
|
|
5693
|
+
const vfsPath = node.mount.type.realPath(node);
|
|
5694
|
+
try {
|
|
5695
|
+
const underlyingNode =
|
|
5696
|
+
node.mount.opts.fs.lookupPath(vfsPath)?.node;
|
|
5697
|
+
return !!underlyingNode?.isSharedFS;
|
|
5698
|
+
} catch (e) {
|
|
5659
5699
|
return false;
|
|
5660
5700
|
}
|
|
5661
|
-
const vfsPath = NODEFS.realPath(node);
|
|
5662
|
-
const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node;
|
|
5663
|
-
return !!underlyingNode?.isSharedFS;
|
|
5664
5701
|
},
|
|
5665
5702
|
is_path_to_shared_fs(path) {
|
|
5666
5703
|
const { node } = FS.lookupPath(path);
|
package/jspi/php_8_4.js
CHANGED
|
@@ -5245,6 +5245,15 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
5245
5245
|
|
|
5246
5246
|
var PHPWASM = {
|
|
5247
5247
|
init: function () {
|
|
5248
|
+
Module['ENV'] = Module['ENV'] || {};
|
|
5249
|
+
// Ensure a platform-level bin directory for a fallback `php` binary.
|
|
5250
|
+
Module['ENV']['PATH'] = [
|
|
5251
|
+
Module['ENV']['PATH'],
|
|
5252
|
+
'/internal/shared/bin',
|
|
5253
|
+
]
|
|
5254
|
+
.filter(Boolean)
|
|
5255
|
+
.join(':');
|
|
5256
|
+
|
|
5248
5257
|
// The /internal directory is required by the C module. It's where the
|
|
5249
5258
|
// stdout, stderr, and headers information are written for the JavaScript
|
|
5250
5259
|
// code to read later on.
|
|
@@ -5255,6 +5264,20 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
5255
5264
|
// The files from the preload directory are preloaded using the
|
|
5256
5265
|
// auto_prepend_file php.ini directive.
|
|
5257
5266
|
FS.mkdir('/internal/shared/preload');
|
|
5267
|
+
// Platform-level bin directory for a fallback `php` binary. Without it,
|
|
5268
|
+
// PHP may not populate the PHP_BINARY constant.
|
|
5269
|
+
FS.mkdir('/internal/shared/bin');
|
|
5270
|
+
const originalOnRuntimeInitialized = Module['onRuntimeInitialized'];
|
|
5271
|
+
Module['onRuntimeInitialized'] = () => {
|
|
5272
|
+
// Dummy PHP binary for PHP to populate the PHP_BINARY constant.
|
|
5273
|
+
FS.writeFile(
|
|
5274
|
+
'/internal/shared/bin/php',
|
|
5275
|
+
new TextEncoder().encode('#!/bin/sh\nphp "$@"')
|
|
5276
|
+
);
|
|
5277
|
+
// It must be executable to be used by PHP.
|
|
5278
|
+
FS.chmod('/internal/shared/bin/php', 0o755);
|
|
5279
|
+
originalOnRuntimeInitialized();
|
|
5280
|
+
};
|
|
5258
5281
|
// Create stdout and stderr devices. We can't just use Emscripten's
|
|
5259
5282
|
// default stdout and stderr devices because they stop processing data
|
|
5260
5283
|
// on the first null byte. However, when dealing with binary data,
|
|
@@ -5654,13 +5677,27 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
5654
5677
|
if (node?.isSharedFS) {
|
|
5655
5678
|
return true;
|
|
5656
5679
|
}
|
|
5680
|
+
|
|
5657
5681
|
// Handle PROXYFS nodes which wrap other nodes.
|
|
5658
|
-
if (
|
|
5682
|
+
if (
|
|
5683
|
+
!node?.mount?.opts?.fs?.lookupPath ||
|
|
5684
|
+
!node?.mount?.type?.realPath
|
|
5685
|
+
) {
|
|
5686
|
+
return false;
|
|
5687
|
+
}
|
|
5688
|
+
|
|
5689
|
+
// Only NODEFS can be shared between workers at the moment.
|
|
5690
|
+
if (node.mount.type !== NODEFS) {
|
|
5691
|
+
return false;
|
|
5692
|
+
}
|
|
5693
|
+
const vfsPath = node.mount.type.realPath(node);
|
|
5694
|
+
try {
|
|
5695
|
+
const underlyingNode =
|
|
5696
|
+
node.mount.opts.fs.lookupPath(vfsPath)?.node;
|
|
5697
|
+
return !!underlyingNode?.isSharedFS;
|
|
5698
|
+
} catch (e) {
|
|
5659
5699
|
return false;
|
|
5660
5700
|
}
|
|
5661
|
-
const vfsPath = NODEFS.realPath(node);
|
|
5662
|
-
const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node;
|
|
5663
|
-
return !!underlyingNode?.isSharedFS;
|
|
5664
5701
|
},
|
|
5665
5702
|
is_path_to_shared_fs(path) {
|
|
5666
5703
|
const { node } = FS.lookupPath(path);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@php-wasm/node",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "PHP.wasm for Node.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"license": "GPL-2.0-or-later",
|
|
40
40
|
"types": "index.d.ts",
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "ace4bc04b9b7cf814244911d8e10b53512fb2ee4",
|
|
42
42
|
"engines": {
|
|
43
43
|
"node": ">=20.18.3",
|
|
44
44
|
"npm": ">=10.1.0"
|
|
@@ -51,12 +51,12 @@
|
|
|
51
51
|
"wasm-feature-detect": "1.8.0",
|
|
52
52
|
"ws": "8.18.1",
|
|
53
53
|
"yargs": "17.7.2",
|
|
54
|
-
"@php-wasm/node-polyfills": "1.1.
|
|
55
|
-
"@php-wasm/universal": "1.1.
|
|
56
|
-
"@php-wasm/logger": "1.1.
|
|
57
|
-
"@php-wasm/util": "1.1.
|
|
58
|
-
"@wp-playground/common": "1.1.
|
|
59
|
-
"@wp-playground/wordpress": "1.1.
|
|
54
|
+
"@php-wasm/node-polyfills": "1.1.5",
|
|
55
|
+
"@php-wasm/universal": "1.1.5",
|
|
56
|
+
"@php-wasm/logger": "1.1.5",
|
|
57
|
+
"@php-wasm/util": "1.1.5",
|
|
58
|
+
"@wp-playground/common": "1.1.5",
|
|
59
|
+
"@wp-playground/wordpress": "1.1.5"
|
|
60
60
|
},
|
|
61
61
|
"overrides": {
|
|
62
62
|
"rollup": "^4.34.6",
|