phptest 0.0.4 → 0.0.7

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.4",
2
+ "version": "0.0.7",
3
3
  "name": "phptest",
4
4
  "description": "Test helper library for PHP core runtime components",
5
5
  "keywords": [
@@ -32,13 +32,13 @@
32
32
  "source-map": "^0.8.0-beta.0"
33
33
  },
34
34
  "devDependencies": {
35
- "phpcore": "^7.1.0"
35
+ "phpcore": "^7.2.0"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "core-js-pure": "^3.21.1",
39
- "mocha": "^9.2.2",
39
+ "mocha": "^10.0.0",
40
40
  "phptoast": "^9.0.1",
41
- "phptojs": "^9.0.0"
41
+ "phptojs": "^9.0.1"
42
42
  },
43
43
  "engines": {
44
44
  "node": ">=12"
@@ -28,11 +28,12 @@ var _ = require('microdash'),
28
28
  */
29
29
  module.exports = function (phpCorePath, initRuntime) {
30
30
  var
31
- OpcodeExecutor = require(phpCorePath + '/src/Core/Opcode/Handler/OpcodeExecutor'),
32
- Reference = require(phpCorePath + '/src/Reference/Reference'),
33
- Value = require(phpCorePath + '/src/Value').sync(),
34
- Variable = require(phpCorePath + '/src/Variable').sync(),
35
- runtimeFactory = require(phpCorePath + '/src/shared/runtimeFactory'),
31
+ resolvedPHPCorePath = path.resolve(phpCorePath),
32
+ OpcodeExecutor = require(resolvedPHPCorePath + '/src/Core/Opcode/Handler/OpcodeExecutor'),
33
+ Reference = require(resolvedPHPCorePath + '/src/Reference/Reference'),
34
+ Value = require(resolvedPHPCorePath + '/src/Value').sync(),
35
+ Variable = require(resolvedPHPCorePath + '/src/Variable').sync(),
36
+ runtimeFactory = require(resolvedPHPCorePath + '/src/shared/runtimeFactory'),
36
37
 
37
38
  // A map that allows looking up the source map data for a module later on.
38
39
  moduleDataMap = new WeakMap(),
@@ -109,6 +110,8 @@ module.exports = function (phpCorePath, initRuntime) {
109
110
  return phpCore;
110
111
  });
111
112
 
113
+ // Note that we do not support setting additional module options for PHPCore,
114
+ // because module-level options are deprecated in favour of environment-level ones.
112
115
  if (path !== null) {
113
116
  module = module.using({
114
117
  path: path
@@ -180,7 +183,7 @@ module.exports = function (phpCorePath, initRuntime) {
180
183
  result.setValue(value).next(resolve, reject);
181
184
  });
182
185
  }, function (reference) {
183
- return result.setReference(reference);
186
+ return result.setReference(reference.getReference());
184
187
  });
185
188
  }
186
189
 
@@ -243,7 +246,7 @@ module.exports = function (phpCorePath, initRuntime) {
243
246
  stack = stack.replace(
244
247
  // Find stack frames for the transpiled PHP code - source maps would not be handled natively
245
248
  // even if we embedded them in the generated JS, so we need to perform manual mapping
246
- /\(eval at transpile \(.*\/test\/integration\/tools.js:\d+:\d+\), <anonymous>:(\d+):(\d+)\)/g,
249
+ /\(eval at transpile \(.*\/phptest\/src\/createIntegrationTools\.js:\d+:\d+\), <anonymous>:(\d+):(\d+)\)/g,
247
250
  function (all, line, column) {
248
251
  var mappedPosition = sourceMapConsumer.originalPositionFor({
249
252
  // Note: These number casts are required, the source-map library
@@ -272,7 +275,7 @@ module.exports = function (phpCorePath, initRuntime) {
272
275
  stack = stack.replace(/(?:(?:.*\/path\/to\/internal.*)([\r\n]*))+/mg, ' at [Node.js internals]$1');
273
276
 
274
277
  // Normalise PHPCore frames
275
- stack = stack.replace(new RegExp(escapeRegex(phpCorePath), 'g'), '/path/to/phpcore');
278
+ stack = stack.replace(new RegExp(escapeRegex(resolvedPHPCorePath), 'g'), '/path/to/phpcore');
276
279
 
277
280
  return stack;
278
281
  });