mirror of
https://github.com/fluencelabs/fluence-js.git
synced 2025-04-25 01:42:13 +00:00
fix: nodenext
moduleResolution for js peer (#271)
This commit is contained in:
parent
96fa90affe
commit
78d98f15c1
@ -27,7 +27,7 @@
|
|||||||
"@types/jest": "28.1.0",
|
"@types/jest": "28.1.0",
|
||||||
"jest": "28.1.0",
|
"jest": "28.1.0",
|
||||||
"ts-jest": "28.0.2",
|
"ts-jest": "28.0.2",
|
||||||
"js-base64": "3.7.2",
|
"js-base64": "3.7.5",
|
||||||
"@rollup/plugin-inject": "5.0.3",
|
"@rollup/plugin-inject": "5.0.3",
|
||||||
"vite-plugin-replace": "0.1.1",
|
"vite-plugin-replace": "0.1.1",
|
||||||
"vite": "4.0.4",
|
"vite": "4.0.4",
|
||||||
|
@ -1,16 +1,17 @@
|
|||||||
/** @type {import('ts-jest').JestConfigWithTsJest} */
|
/** @type {import('ts-jest').JestConfigWithTsJest} */
|
||||||
module.exports = {
|
module.exports = {
|
||||||
extensionsToTreatAsEsm: ['.ts'],
|
extensionsToTreatAsEsm: ['.ts'],
|
||||||
moduleNameMapper: {
|
"preset": "ts-jest/presets/default-esm",
|
||||||
'^(\\.{1,2}/.*)\\.js$': '$1',
|
"moduleNameMapper": {
|
||||||
|
"^(\\.{1,2}/.*)\\.js$": "$1"
|
||||||
},
|
},
|
||||||
testPathIgnorePatterns: ['dist'],
|
"transform": {
|
||||||
transform: {
|
"^.+\\.tsx?$": [
|
||||||
'^.+\\.tsx?$': [
|
"ts-jest",
|
||||||
'ts-jest',
|
|
||||||
{
|
{
|
||||||
useESM: true,
|
"useESM": true
|
||||||
},
|
}
|
||||||
],
|
]
|
||||||
},
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
"@libp2p/peer-id-factory": "2.0.1",
|
"@libp2p/peer-id-factory": "2.0.1",
|
||||||
"@libp2p/interface-peer-id": "2.0.1",
|
"@libp2p/interface-peer-id": "2.0.1",
|
||||||
"@libp2p/interface-keys": "1.0.7",
|
"@libp2p/interface-keys": "1.0.7",
|
||||||
"js-base64": "3.7.2",
|
"js-base64": "3.7.5",
|
||||||
"it-length-prefixed": "8.0.4",
|
"it-length-prefixed": "8.0.4",
|
||||||
"it-pipe": "2.0.5",
|
"it-pipe": "2.0.5",
|
||||||
"it-map": "2.0.0",
|
"it-map": "2.0.0",
|
||||||
@ -60,6 +60,6 @@
|
|||||||
"@types/uuid": "8.3.2",
|
"@types/uuid": "8.3.2",
|
||||||
"@types/jest": "29.4.0",
|
"@types/jest": "29.4.0",
|
||||||
"jest": "29.4.1",
|
"jest": "29.4.1",
|
||||||
"ts-jest": "29.0.5"
|
"ts-jest": "next"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
import type { PeerIdB58 } from '@fluencelabs/interfaces';
|
import type { PeerIdB58 } from '@fluencelabs/interfaces';
|
||||||
import type { JSONArray, JSONObject, LogLevel } from '@fluencelabs/marine-js/dist/types';
|
import type { JSONArray, JSONObject, LogLevel } from '@fluencelabs/marine-js/dist/types';
|
||||||
import type { RunParameters, CallResultsArray, InterpreterResult } from '@fluencelabs/avm';
|
import type { RunParameters, CallResultsArray, InterpreterResult } from '@fluencelabs/avm';
|
||||||
|
// @ts-ignore
|
||||||
import type { WorkerImplementation } from 'threads/dist/types/master';
|
import type { WorkerImplementation } from 'threads/dist/types/master';
|
||||||
|
|
||||||
export type ParticleHandler = (particle: string) => void;
|
export type ParticleHandler = (particle: string) => void;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import { CallParams } from '@fluencelabs/interfaces';
|
import { CallParams } from '@fluencelabs/interfaces';
|
||||||
import { toUint8Array } from 'js-base64';
|
import { toUint8Array } from 'js-base64';
|
||||||
import { CallServiceData } from '../../../interfaces/commonTypes.js';
|
import { CallServiceData } from '../../../interfaces/commonTypes.js';
|
||||||
import { builtInServices } from '../../builtins/common.js';
|
|
||||||
import { KeyPair } from '../../../keypair/index.js';
|
import { KeyPair } from '../../../keypair/index.js';
|
||||||
import { Sig, defaultSigGuard } from '../../builtins/Sig.js';
|
import { Sig, defaultSigGuard } from '../../builtins/Sig.js';
|
||||||
import { allowServiceFn } from '../../builtins/securityGuard.js';
|
import { allowServiceFn } from '../../builtins/securityGuard.js';
|
||||||
|
import { builtInServices } from '../../builtins/common.js';
|
||||||
|
|
||||||
const a10b20 = `{
|
const a10b20 = `{
|
||||||
"a": 10,
|
"a": 10,
|
||||||
|
@ -3,9 +3,9 @@ import { FluenceConnection, ParticleHandler } from '../interfaces/index.js';
|
|||||||
import { fromBase64Sk } from '../keypair/index.js';
|
import { fromBase64Sk } from '../keypair/index.js';
|
||||||
import { FluencePeer } from './FluencePeer.js';
|
import { FluencePeer } from './FluencePeer.js';
|
||||||
import { MarineBackgroundRunner } from '../marine/worker/index.js';
|
import { MarineBackgroundRunner } from '../marine/worker/index.js';
|
||||||
import { avmModuleLoader, controlModuleLoader } from './utilsForNode';
|
import { avmModuleLoader, controlModuleLoader } from './utilsForNode.js';
|
||||||
import { marineLogFunction } from './utils';
|
import { marineLogFunction } from './utils.js';
|
||||||
import { MarineBasedAvmRunner } from './avm';
|
import { MarineBasedAvmRunner } from './avm.js';
|
||||||
|
|
||||||
import log from 'loglevel';
|
import log from 'loglevel';
|
||||||
import { WorkerLoaderFromFs } from '../marine/deps-loader/node.js';
|
import { WorkerLoaderFromFs } from '../marine/deps-loader/node.js';
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
|
// @ts-ignore
|
||||||
import { BlobWorker } from 'threads';
|
import { BlobWorker } from 'threads';
|
||||||
import { fromBase64, toUint8Array } from 'js-base64';
|
import { fromBase64, toUint8Array } from 'js-base64';
|
||||||
|
// @ts-ignore
|
||||||
import type { WorkerImplementation } from 'threads/dist/types/master';
|
import type { WorkerImplementation } from 'threads/dist/types/master';
|
||||||
import { LazyLoader } from '../../interfaces/index.js';
|
import { LazyLoader } from '../../interfaces/index.js';
|
||||||
import { Buffer } from 'buffer';
|
import { Buffer } from 'buffer';
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
import { createRequire } from 'module';
|
import { createRequire } from 'module';
|
||||||
import { LazyLoader } from '../../interfaces/index.js';
|
import { LazyLoader } from '../../interfaces/index.js';
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
import type { WorkerImplementation } from 'threads/dist/types/master';
|
import type { WorkerImplementation } from 'threads/dist/types/master';
|
||||||
|
// @ts-ignore
|
||||||
import { Worker } from 'threads';
|
import { Worker } from 'threads';
|
||||||
import { Buffer } from 'buffer';
|
import { Buffer } from 'buffer';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
|
@ -17,7 +17,9 @@
|
|||||||
import { MarineService } from '@fluencelabs/marine-js/dist/MarineService';
|
import { MarineService } from '@fluencelabs/marine-js/dist/MarineService';
|
||||||
import type { Env, MarineServiceConfig } from '@fluencelabs/marine-js/dist/config';
|
import type { Env, MarineServiceConfig } from '@fluencelabs/marine-js/dist/config';
|
||||||
import type { JSONArray, JSONObject, LogMessage } from '@fluencelabs/marine-js/dist/types';
|
import type { JSONArray, JSONObject, LogMessage } from '@fluencelabs/marine-js/dist/types';
|
||||||
|
// @ts-ignore
|
||||||
import { Observable, Subject } from 'threads/observable';
|
import { Observable, Subject } from 'threads/observable';
|
||||||
|
// @ts-ignore
|
||||||
import { expose } from 'threads/worker';
|
import { expose } from 'threads/worker';
|
||||||
|
|
||||||
let marineServices = new Map<string, MarineService>();
|
let marineServices = new Map<string, MarineService>();
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
import { LazyLoader } from '../../interfaces/index.js';
|
import { LazyLoader } from '../../interfaces/index.js';
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
import type { WorkerImplementation } from 'threads/dist/types/master';
|
import type { WorkerImplementation } from 'threads/dist/types/master';
|
||||||
|
// @ts-ignore
|
||||||
import { Worker } from 'threads';
|
import { Worker } from 'threads';
|
||||||
|
|
||||||
export class WorkerLoader extends LazyLoader<WorkerImplementation> {
|
export class WorkerLoader extends LazyLoader<WorkerImplementation> {
|
||||||
|
@ -18,7 +18,9 @@ import type { JSONArray, JSONObject, LogLevel } from '@fluencelabs/marine-js/dis
|
|||||||
import { LogFunction, logLevelToEnv } from '@fluencelabs/marine-js/dist/types';
|
import { LogFunction, logLevelToEnv } from '@fluencelabs/marine-js/dist/types';
|
||||||
import type { IMarine, IWorkerLoader, IWasmLoader } from '../../interfaces/index.js';
|
import type { IMarine, IWorkerLoader, IWasmLoader } from '../../interfaces/index.js';
|
||||||
import type { MarineBackgroundInterface } from '../worker-script/index.js';
|
import type { MarineBackgroundInterface } from '../worker-script/index.js';
|
||||||
|
// @ts-ignore
|
||||||
import { spawn, Thread } from 'threads';
|
import { spawn, Thread } from 'threads';
|
||||||
|
// @ts-ignore
|
||||||
import type { ModuleThread } from 'threads';
|
import type { ModuleThread } from 'threads';
|
||||||
|
|
||||||
export class MarineBackgroundRunner implements IMarine {
|
export class MarineBackgroundRunner implements IMarine {
|
||||||
|
@ -2,8 +2,9 @@
|
|||||||
"extends": "../../../tsconfig.json",
|
"extends": "../../../tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./dist",
|
"outDir": "./dist",
|
||||||
"moduleResolution": "node"
|
"moduleResolution": "nodenext"
|
||||||
},
|
},
|
||||||
"include": ["src/**/*"],
|
"include": ["src/**/*"],
|
||||||
"exclude": ["node_modules", "dist"]
|
"exclude": ["node_modules", "dist"],
|
||||||
|
"esModuleInterop": true
|
||||||
}
|
}
|
||||||
|
20
pnpm-lock.yaml
generated
20
pnpm-lock.yaml
generated
@ -123,7 +123,7 @@ importers:
|
|||||||
'@types/node': 16.11.59
|
'@types/node': 16.11.59
|
||||||
buffer: 6.0.3
|
buffer: 6.0.3
|
||||||
jest: 28.1.0
|
jest: 28.1.0
|
||||||
js-base64: 3.7.2
|
js-base64: 3.7.5
|
||||||
process: 0.11.10
|
process: 0.11.10
|
||||||
ts-jest: 28.0.2
|
ts-jest: 28.0.2
|
||||||
vite: 4.0.4
|
vite: 4.0.4
|
||||||
@ -140,7 +140,7 @@ importers:
|
|||||||
'@types/jest': 28.1.0
|
'@types/jest': 28.1.0
|
||||||
'@types/node': 16.11.59
|
'@types/node': 16.11.59
|
||||||
jest: 28.1.0_@types+node@16.11.59
|
jest: 28.1.0_@types+node@16.11.59
|
||||||
js-base64: 3.7.2
|
js-base64: 3.7.5
|
||||||
ts-jest: 28.0.2_byf75w6xilfwy3ncjzlldwxox4
|
ts-jest: 28.0.2_byf75w6xilfwy3ncjzlldwxox4
|
||||||
vite: 4.0.4_@types+node@16.11.59
|
vite: 4.0.4_@types+node@16.11.59
|
||||||
vite-plugin-replace: 0.1.1_vite@4.0.4
|
vite-plugin-replace: 0.1.1_vite@4.0.4
|
||||||
@ -192,13 +192,13 @@ importers:
|
|||||||
it-map: 2.0.0
|
it-map: 2.0.0
|
||||||
it-pipe: 2.0.5
|
it-pipe: 2.0.5
|
||||||
jest: 29.4.1
|
jest: 29.4.1
|
||||||
js-base64: 3.7.2
|
js-base64: 3.7.5
|
||||||
libp2p: 0.42.2
|
libp2p: 0.42.2
|
||||||
loglevel: 1.8.1
|
loglevel: 1.8.1
|
||||||
multiformats: 11.0.1
|
multiformats: 11.0.1
|
||||||
rxjs: 7.5.5
|
rxjs: 7.5.5
|
||||||
threads: 1.7.0
|
threads: 1.7.0
|
||||||
ts-jest: 29.0.5
|
ts-jest: next
|
||||||
ts-pattern: 3.3.3
|
ts-pattern: 3.3.3
|
||||||
uint8arrays: 4.0.3
|
uint8arrays: 4.0.3
|
||||||
uuid: 8.3.2
|
uuid: 8.3.2
|
||||||
@ -223,7 +223,7 @@ importers:
|
|||||||
it-length-prefixed: 8.0.4
|
it-length-prefixed: 8.0.4
|
||||||
it-map: 2.0.0
|
it-map: 2.0.0
|
||||||
it-pipe: 2.0.5
|
it-pipe: 2.0.5
|
||||||
js-base64: 3.7.2
|
js-base64: 3.7.5
|
||||||
libp2p: 0.42.2
|
libp2p: 0.42.2
|
||||||
loglevel: 1.8.1
|
loglevel: 1.8.1
|
||||||
multiformats: 11.0.1
|
multiformats: 11.0.1
|
||||||
@ -241,7 +241,7 @@ importers:
|
|||||||
'@types/jest': 29.4.0
|
'@types/jest': 29.4.0
|
||||||
'@types/uuid': 8.3.2
|
'@types/uuid': 8.3.2
|
||||||
jest: 29.4.1
|
jest: 29.4.1
|
||||||
ts-jest: 29.0.5_knhdxpg4pvwuf6vrybjt5d2q5i
|
ts-jest: 29.0.0-next.1_knhdxpg4pvwuf6vrybjt5d2q5i
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
|
|
||||||
@ -10331,12 +10331,8 @@ packages:
|
|||||||
- ts-node
|
- ts-node
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/js-base64/3.7.2:
|
|
||||||
resolution: {integrity: sha512-NnRs6dsyqUXejqk/yv2aiXlAvOs56sLkX6nUdeaNezI5LFFLlsZjOThmwnrcwh5ZZRwZlCMnVAY3CvhIhoVEKQ==}
|
|
||||||
|
|
||||||
/js-base64/3.7.5:
|
/js-base64/3.7.5:
|
||||||
resolution: {integrity: sha512-3MEt5DTINKqfScXKfJFrRbxkrnk2AxPWGBL/ycjz4dK8iqiSJ06UxD8jh8xuh6p10TX4t2+7FsBYVxxQbMg+qA==}
|
resolution: {integrity: sha512-3MEt5DTINKqfScXKfJFrRbxkrnk2AxPWGBL/ycjz4dK8iqiSJ06UxD8jh8xuh6p10TX4t2+7FsBYVxxQbMg+qA==}
|
||||||
dev: true
|
|
||||||
|
|
||||||
/js-sdsl/4.3.0:
|
/js-sdsl/4.3.0:
|
||||||
resolution: {integrity: sha512-mifzlm2+5nZ+lEcLJMoBK0/IH/bDg8XnJfd/Wq6IP+xoCjLZsTOnV2QpxlVbX9bMnkl5PdEjNtBJ9Cj1NjifhQ==}
|
resolution: {integrity: sha512-mifzlm2+5nZ+lEcLJMoBK0/IH/bDg8XnJfd/Wq6IP+xoCjLZsTOnV2QpxlVbX9bMnkl5PdEjNtBJ9Cj1NjifhQ==}
|
||||||
@ -14497,8 +14493,8 @@ packages:
|
|||||||
yargs-parser: 20.2.9
|
yargs-parser: 20.2.9
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/ts-jest/29.0.5_knhdxpg4pvwuf6vrybjt5d2q5i:
|
/ts-jest/29.0.0-next.1_knhdxpg4pvwuf6vrybjt5d2q5i:
|
||||||
resolution: {integrity: sha512-PL3UciSgIpQ7f6XjVOmbi96vmDHUqAyqDr8YxzopDqX3kfgYtX1cuNeBjP+L9sFXi6nzsGGA6R3fP3DDDJyrxA==}
|
resolution: {integrity: sha512-bVo2GDuJiV+cWEYB72tdz2Ips4JDKa04bcKikPULxxUHT4fsoY1zB2zvsrJym18qrFpXyVrIdgJFLfEx2YTkbg==}
|
||||||
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
"strict": true,
|
"strict": true,
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"moduleResolution": "nodenext"
|
"moduleResolution": "nodenext"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user