@pwaos.net/runtime-client-api 0.2.2 → 0.2.4

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/README.md CHANGED
@@ -100,8 +100,9 @@ At require time the runtime directory is resolved in this order:
100
100
 
101
101
  1. The installed platform subpackage
102
102
  `@pwaos.net/runtime-<platform>-<arch>/runtime` in `node_modules`
103
- (primary; on win32-x64 the `win32-x86` package is a fallback via
104
- WOW64).
103
+ (primary; on win32 the payload is the upstream 32-bit build, so the
104
+ win32-x64 package serves x64 hosts via WOW64 and the `win32-x86`
105
+ package covers ia32 hosts).
105
106
  2. An upward `node_modules` walk from this module's directory, covering
106
107
  non-standard layouts.
107
108
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pwaos.net/runtime-client-api",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "type": "module",
5
5
  "description": "Node.js native addon for the PwaOS RuntimeClient API. Automatically resolves the matching Runtime SDK for your platform.",
6
6
  "engines": {
@@ -39,7 +39,7 @@
39
39
  "./package.json": "./package.json"
40
40
  },
41
41
  "dependencies": {
42
- "@pwaos.net/runtime": "0.2.2"
42
+ "@pwaos.net/runtime": "^0.2.1"
43
43
  },
44
44
  "devDependencies": {
45
45
  "node-gyp": "^10.0.0"
@@ -30,15 +30,22 @@ const PACKAGE_PREFIX = '@pwaos.net/runtime-';
30
30
  /**
31
31
  * Platform subpackage candidates for the current process, in preference
32
32
  * order. The primary candidate is the strictly-derived
33
- * @pwaos.net/runtime-<platform>-<arch>; on win32 the only upstream runtime is
34
- * 32-bit (x86), which also runs on 64-bit Windows (WOW64), so the x86
35
- * package is a secondary candidate for x64 hosts.
33
+ * @pwaos.net/runtime-<platform>-<arch>. Windows notes:
34
+ * - win32-x64: the win32-x64 package carries the upstream 32-bit (x86)
35
+ * payload (runs via WOW64); the ia32 win32-x86 package is kept as a
36
+ * fallback for installs that predate the x64 package.
37
+ * - win32-ia32: the auto-installed package is win32-x86 (cpu ia32), while
38
+ * the strictly-derived name runtime-win32-ia32 does not exist - the x86
39
+ * package is the only candidate there.
36
40
  */
37
41
  function getPlatformPackageCandidates() {
38
42
  const primary = `${PACKAGE_PREFIX}${process.platform}-${process.arch}`;
39
43
  if (process.platform === 'win32' && process.arch === 'x64') {
40
44
  return [primary, `${PACKAGE_PREFIX}win32-x86`];
41
45
  }
46
+ if (process.platform === 'win32' && process.arch === 'ia32') {
47
+ return [`${PACKAGE_PREFIX}win32-x86`];
48
+ }
42
49
  return [primary];
43
50
  }
44
51
 
package/test/test.cjs CHANGED
@@ -380,6 +380,44 @@ describe('PwaOS Addon - surface', function() {
380
380
  });
381
381
  });
382
382
 
383
+ describe('Platform package candidates', function() {
384
+ it('derive candidates per platform/arch (win32 aliasing)', function() {
385
+ const { getPlatformPackageCandidates } =
386
+ require('../scripts/runtime-resolver.cjs');
387
+ const origPlatform =
388
+ Object.getOwnPropertyDescriptor(process, 'platform');
389
+ const origArch = Object.getOwnPropertyDescriptor(process, 'arch');
390
+ const setProp = (name, desc, value) => Object.defineProperty(
391
+ process, name, value === undefined ? desc : { ...desc, value });
392
+ try {
393
+ Object.defineProperty(process, 'platform',
394
+ { ...origPlatform, value: 'win32' });
395
+ Object.defineProperty(process, 'arch',
396
+ { ...origArch, value: 'x64' });
397
+ // x64 Windows: the x64 package first (WOW64 payload), the
398
+ // ia32 win32-x86 package as a legacy-install fallback.
399
+ assert.deepStrictEqual(getPlatformPackageCandidates(),
400
+ ['@pwaos.net/runtime-win32-x64',
401
+ '@pwaos.net/runtime-win32-x86']);
402
+ Object.defineProperty(process, 'arch',
403
+ { ...origArch, value: 'ia32' });
404
+ // 32-bit Windows: npm auto-installs win32-x86 (cpu ia32);
405
+ // runtime-win32-ia32 does not exist.
406
+ assert.deepStrictEqual(getPlatformPackageCandidates(),
407
+ ['@pwaos.net/runtime-win32-x86']);
408
+ Object.defineProperty(process, 'platform',
409
+ { ...origPlatform, value: 'linux' });
410
+ Object.defineProperty(process, 'arch',
411
+ { ...origArch, value: 'x64' });
412
+ assert.deepStrictEqual(getPlatformPackageCandidates(),
413
+ ['@pwaos.net/runtime-linux-x64']);
414
+ } finally {
415
+ setProp('platform', origPlatform);
416
+ setProp('arch', origArch);
417
+ }
418
+ });
419
+ });
420
+
383
421
  describe('Class introspection', function() {
384
422
  it('Instance class has expected methods', function() {
385
423
  const expected = [