Page MenuHomePhabricator

[chronik-client] Upgrade module resolution built by tsc
AbandonedPublic

Authored by tobias_ruck on Mon, Apr 29, 01:16.

Details

Reviewers
bytesofman
Fabien
Group Reviewers
Restricted Project
Summary

This uses a fairly old module resolution system, which breaks on newer system, for example on Pay2Stay.

Web bundlers will handle the new files without issues, and recent versions of node will have no issue using the import syntax.

Also bumps version to 0.27.0, as this could be a breaking change for some.

Test Plan
  1. npm run build
  2. Look at the built dist files (e.g. failoverProxy.js), and ensure it's using the import syntax, not a complex __importDefault(require(...)) construct
  3. Use this version in CashTab and make sure it still loads alright

Diff Detail

Event Timeline

Tail of the build log:

Test does not depend on mock-chronik-client, skipping mock-chronik-client dependencies...
Test does not depend on ecash-lib-wasm, skipping
Test does not depend on chronik-client
/work/modules/chronik-client /work/abc-ci-builds/chronik-client-tests

> chronik-client@0.27.0 prepublish
> npm run build


> chronik-client@0.27.0 build
> tsc


added 270 packages, and audited 271 packages in 6s

49 packages are looking for funding
  run `npm fund` for details

1 moderate severity vulnerability

To address all issues, run:
  npm audit fix

Run `npm audit` for details.
CI not configured to test build.

> chronik-client@0.27.0 test
> mocha -r ts-node/register test/test.ts --reporter mocha-junit-reporter --reporter-options mochaFile=test_results/chronik-client-junit.xml --reporter-options testsuitesTitle=Chronik Client Unit Tests --reporter-options rootSuiteTitle=Chronik Client


TypeError: Unknown file extension ".ts" for /work/modules/chronik-client/test/test.ts
    at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:160:9)
    at defaultGetFormat (node:internal/modules/esm/get_format:203:36)
    at defaultLoad (node:internal/modules/esm/load:143:22)
    at async ModuleLoader.load (node:internal/modules/esm/loader:403:7)
    at async ModuleLoader.moduleProvider (node:internal/modules/esm/loader:285:45)
    at async link (node:internal/modules/esm/module_job:78:21)
----------|---------|----------|---------|---------|-------------------
File      | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
----------|---------|----------|---------|---------|-------------------
All files |       0 |        0 |       0 |       0 |                   
----------|---------|----------|---------|---------|-------------------

##teamcity[blockOpened name='Code Coverage Summary']
##teamcity[buildStatisticValue key='CodeCoverageAbsBCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsBTotal' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsRCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsRTotal' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsMCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsMTotal' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='0']
##teamcity[blockClosed name='Code Coverage Summary']
mv: cannot stat 'test_results/chronik-client-junit.xml': No such file or directory
Build chronik-client-tests failed with exit code 1

Tail of the build log:

 Exception during run: /work/modules/ecash-lib/tests/alp.test.ts:9
import { ChronikClientNode } from 'chronik-client';
         ^

SyntaxError: The requested module 'chronik-client' does not provide an export named 'ChronikClientNode'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:134:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:217:5)
    at async ModuleLoader.import (node:internal/modules/esm/loader:323:24)
    at async formattedImport (/work/modules/ecash-lib/node_modules/mocha/lib/nodejs/esm-utils.js:9:14)
    at async exports.requireOrImport (/work/modules/ecash-lib/node_modules/mocha/lib/nodejs/esm-utils.js:42:28)
    at async exports.loadFilesAsync (/work/modules/ecash-lib/node_modules/mocha/lib/nodejs/esm-utils.js:100:20)
    at async singleRun (/work/modules/ecash-lib/node_modules/mocha/lib/cli/run-helpers.js:125:3)
    at async exports.handler (/work/modules/ecash-lib/node_modules/mocha/lib/cli/run.js:370:5)
---------------------|---------|----------|---------|---------|-------------------
File                 | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
---------------------|---------|----------|---------|---------|-------------------
All files            |       0 |        0 |       0 |       0 |                   
 ecash-lib           |       0 |        0 |       0 |       0 |                   
  eslint.config.js   |       0 |        0 |       0 |       0 |                   
 ecash-lib/src       |       0 |        0 |       0 |       0 |                   
  ecc.ts             |       0 |      100 |       0 |       0 | 22-35             
  hash.ts            |       0 |      100 |     100 |       0 | 7-9               
  index.ts           |       0 |        0 |       0 |       0 |                   
  init.ts            |       0 |        0 |       0 |       0 | 9-16              
  op.ts              |       0 |        0 |       0 |       0 | 33-124            
  opcode.ts          |       0 |      100 |     100 |       0 | 10-154            
  script.ts          |       0 |        0 |       0 |       0 | 26-158            
  sigHashType.ts     |       0 |        0 |       0 |       0 | 19-166            
  tx.ts              |       0 |        0 |       0 |       0 | 20-163            
  txBuilder.ts       |       0 |        0 |       0 |       0 | 67-238            
  unsignedTx.ts      |       0 |        0 |       0 |       0 | 38-229            
 ecash-lib/src/ffi   |       0 |        0 |       0 |       0 |                   
  ecash_lib_wasm.js  |       0 |        0 |       0 |       0 | 3-336             
 ecash-lib/src/io    |       0 |        0 |       0 |       0 |                   
  bytes.ts           |       0 |        0 |       0 |       0 | 13-64             
  hex.ts             |       0 |        0 |       0 |       0 | 5-68              
  int.ts             |       0 |        0 |       0 |       0 |                   
  str.ts             |       0 |      100 |       0 |       0 | 5-9               
  varsize.ts         |       0 |        0 |       0 |       0 | 14-47             
  writer.ts          |       0 |        0 |       0 |       0 |                   
  writerbytes.ts     |       0 |        0 |       0 |       0 | 21-79             
  writerlength.ts    |       0 |      100 |       0 |       0 | 16-41             
 ecash-lib/src/token |       0 |        0 |       0 |       0 |                   
  alp.ts             |       0 |        0 |       0 |       0 | 13-145            
  common.ts          |       0 |      100 |     100 |       0 | 9-12              
  empp.ts            |       0 |        0 |       0 |       0 | 11-28             
---------------------|---------|----------|---------|---------|-------------------

##teamcity[blockOpened name='Code Coverage Summary']
##teamcity[buildStatisticValue key='CodeCoverageAbsBCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsBTotal' value='796']
##teamcity[buildStatisticValue key='CodeCoverageAbsRCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsRTotal' value='275']
##teamcity[buildStatisticValue key='CodeCoverageAbsMCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsMTotal' value='127']
##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='780']
##teamcity[blockClosed name='Code Coverage Summary']
mv: cannot stat 'test_results/ecash-lib-integration-tests-junit.xml': No such file or directory
Build ecash-lib-integration-tests failed with exit code 1

Tail of the build log:

[559/565] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletview.cpp.o
[560/565] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletmodel.cpp.o
[561/565] Linking CXX static library src/qt/libbitcoin-qt-base.a
[562/565] Automatic MOC for target bitcoin-qt
[563/565] Building CXX object src/qt/CMakeFiles/bitcoin-qt.dir/bitcoin-qt_autogen/mocs_compilation.cpp.o
[564/565] Building CXX object src/qt/CMakeFiles/bitcoin-qt.dir/main.cpp.o
[565/565] Linking CXX executable src/qt/bitcoin-qt
Test does not depend on ecash-lib-wasm, skipping
Test does not depend on chronik-client
/work/modules/chronik-client /work/abc-ci-builds/chronik-client-integration-tests

> chronik-client@0.27.0 prepublish
> npm run build


> chronik-client@0.27.0 build
> tsc


added 270 packages, and audited 271 packages in 6s

49 packages are looking for funding
  run `npm fund` for details

1 moderate severity vulnerability

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

> chronik-client@0.27.0 integration-tests
> mocha -j1 -r ts-node/register test/integration/*.ts --reporter mocha-junit-reporter --reporter-options mochaFile=test_results/chronik-client-integration-tests-junit.xml --reporter-options testsuitesTitle=Chronik Client Integration Tests --reporter-options rootSuiteTitle=Chronik Client


TypeError: Unknown file extension ".ts" for /work/modules/chronik-client/test/integration/block_and_blocks.ts
    at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:160:9)
    at defaultGetFormat (node:internal/modules/esm/get_format:203:36)
    at defaultLoad (node:internal/modules/esm/load:143:22)
    at async ModuleLoader.load (node:internal/modules/esm/loader:403:7)
    at async ModuleLoader.moduleProvider (node:internal/modules/esm/loader:285:45)
    at async link (node:internal/modules/esm/module_job:78:21)
----------|---------|----------|---------|---------|-------------------
File      | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
----------|---------|----------|---------|---------|-------------------
All files |       0 |        0 |       0 |       0 |                   
----------|---------|----------|---------|---------|-------------------

##teamcity[blockOpened name='Code Coverage Summary']
##teamcity[buildStatisticValue key='CodeCoverageAbsBCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsBTotal' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsRCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsRTotal' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsMCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsMTotal' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='0']
##teamcity[blockClosed name='Code Coverage Summary']
mv: cannot stat 'test_results/chronik-client-integration-tests-junit.xml': No such file or directory
Build chronik-client-integration-tests failed with exit code 1

Tail of the build log:

 Exception during run: /work/modules/ecash-lib/tests/alp.test.ts:9
import { ChronikClientNode } from 'chronik-client';
         ^

SyntaxError: The requested module 'chronik-client' does not provide an export named 'ChronikClientNode'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:134:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:217:5)
    at async ModuleLoader.import (node:internal/modules/esm/loader:323:24)
    at async formattedImport (/work/modules/ecash-lib/node_modules/mocha/lib/nodejs/esm-utils.js:9:14)
    at async exports.requireOrImport (/work/modules/ecash-lib/node_modules/mocha/lib/nodejs/esm-utils.js:42:28)
    at async exports.loadFilesAsync (/work/modules/ecash-lib/node_modules/mocha/lib/nodejs/esm-utils.js:100:20)
    at async singleRun (/work/modules/ecash-lib/node_modules/mocha/lib/cli/run-helpers.js:125:3)
    at async exports.handler (/work/modules/ecash-lib/node_modules/mocha/lib/cli/run.js:370:5)
---------------------|---------|----------|---------|---------|-------------------
File                 | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
---------------------|---------|----------|---------|---------|-------------------
All files            |       0 |        0 |       0 |       0 |                   
 ecash-lib           |       0 |        0 |       0 |       0 |                   
  eslint.config.js   |       0 |        0 |       0 |       0 |                   
 ecash-lib/src       |       0 |        0 |       0 |       0 |                   
  ecc.ts             |       0 |      100 |       0 |       0 | 22-35             
  hash.ts            |       0 |      100 |     100 |       0 | 7-9               
  index.ts           |       0 |        0 |       0 |       0 |                   
  init.ts            |       0 |        0 |       0 |       0 | 9-16              
  op.ts              |       0 |        0 |       0 |       0 | 33-124            
  opcode.ts          |       0 |      100 |     100 |       0 | 10-154            
  script.ts          |       0 |        0 |       0 |       0 | 26-158            
  sigHashType.ts     |       0 |        0 |       0 |       0 | 19-166            
  tx.ts              |       0 |        0 |       0 |       0 | 20-163            
  txBuilder.ts       |       0 |        0 |       0 |       0 | 67-238            
  unsignedTx.ts      |       0 |        0 |       0 |       0 | 38-229            
 ecash-lib/src/ffi   |       0 |        0 |       0 |       0 |                   
  ecash_lib_wasm.js  |       0 |        0 |       0 |       0 | 3-336             
 ecash-lib/src/io    |       0 |        0 |       0 |       0 |                   
  bytes.ts           |       0 |        0 |       0 |       0 | 13-64             
  hex.ts             |       0 |        0 |       0 |       0 | 5-68              
  int.ts             |       0 |        0 |       0 |       0 |                   
  str.ts             |       0 |      100 |       0 |       0 | 5-9               
  varsize.ts         |       0 |        0 |       0 |       0 | 14-47             
  writer.ts          |       0 |        0 |       0 |       0 |                   
  writerbytes.ts     |       0 |        0 |       0 |       0 | 21-79             
  writerlength.ts    |       0 |      100 |       0 |       0 | 16-41             
 ecash-lib/src/token |       0 |        0 |       0 |       0 |                   
  alp.ts             |       0 |        0 |       0 |       0 | 13-145            
  common.ts          |       0 |      100 |     100 |       0 | 9-12              
  empp.ts            |       0 |        0 |       0 |       0 | 11-28             
---------------------|---------|----------|---------|---------|-------------------

##teamcity[blockOpened name='Code Coverage Summary']
##teamcity[buildStatisticValue key='CodeCoverageAbsBCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsBTotal' value='796']
##teamcity[buildStatisticValue key='CodeCoverageAbsRCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsRTotal' value='275']
##teamcity[buildStatisticValue key='CodeCoverageAbsMCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsMTotal' value='127']
##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='780']
##teamcity[blockClosed name='Code Coverage Summary']
mv: cannot stat 'test_results/ecash-lib-integration-tests-junit.xml': No such file or directory
Build ecash-lib-integration-tests failed with exit code 1
Fabien requested changes to this revision.Mon, Apr 29, 07:39
Fabien added a subscriber: Fabien.

This is breaking CI

This revision now requires changes to proceed.Mon, Apr 29, 07:39