Move non-relevant code from Marine repo into FluenceJS (#227)

1. Move marine-related part into FJS repo (DXJ184)
2. Move towards component-oriented architecture (DXJ183)
3. Different JS Client distros for node.js and web (DXJ185)
This commit is contained in:
Pavel
2023-01-09 15:51:15 +03:00
committed by GitHub
parent dcb15b7d3c
commit 267ebb687f
220 changed files with 7421 additions and 6362 deletions

View File

@ -0,0 +1,21 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
bundle/
dist
esm
types
# Dependency directories
node_modules/
jspm_packages/
.idea

View File

@ -0,0 +1 @@
/dist/

View File

@ -0,0 +1,8 @@
module.exports = {
semi: true,
trailingComma: "all",
singleQuote: true,
printWidth: 120,
tabWidth: 4,
useTabs: false
};

View File

@ -0,0 +1,11 @@
# JS Client node
This package is a part of FluenceJS, the official implementation of the Fluence Peer in typescript. See the [FluenceJS repo](https://github.com/fluencelabs/fluence-js) for more info
## Contributing
While the project is still in the early stages of development, you are welcome to track progress and contribute. As the project is undergoing rapid changes, interested contributors should contact the team before embarking on larger pieces of work. All contributors should consult with and agree to our [basic contributing rules](CONTRIBUTING.md).
## License
[Apache 2.0](LICENSE)

View File

@ -0,0 +1,30 @@
{
"name": "@fluencelabs/js-client.node",
"version": "0.1.0",
"description": "TypeScript implementation of Fluence Peer",
"main": "./dist/index.js",
"typings": "./dist/index.d.ts",
"engines": {
"node": ">=10",
"pnpm": ">=3"
},
"scripts": {
"build": "tsc"
},
"repository": "https://github.com/fluencelabs/fluence-js",
"author": "Fluence Labs",
"license": "Apache-2.0",
"dependencies": {
"@fluencelabs/js-peer": "workspace:0.1.0",
"@fluencelabs/marine.deps-loader.node": "workspace:0.1.0",
"@fluencelabs/marine.background-runner": "workspace:0.1.0"
},
"devDependencies": {
"@types/node": "16.11.59",
"@types/jest": "28.1.0",
"jest": "28.1.0",
"ts-jest": "28.0.2",
"ts-node": "10.9.1",
"typescript": "4.6.4"
}
}

View File

@ -0,0 +1,29 @@
import { MarineBackgroundRunner } from '@fluencelabs/marine.background-runner';
import { MarineBasedAvmRunner } from '@fluencelabs/js-peer/dist/avm';
import { marineLogFunction } from '@fluencelabs/js-peer/dist/utils';
import { FluencePeer } from '@fluencelabs/js-peer/dist/FluencePeer';
import { InlinedWorkerLoader, WasmNpmLoader } from '@fluencelabs/marine.deps-loader.node';
export const defaultNames = {
avm: {
file: 'avm.wasm',
package: '@fluencelabs/avm',
},
marine: {
file: 'marine-js.wasm',
package: '@fluencelabs/marine-js',
},
};
export const makeDefaultPeer = () => {
const workerLoader = new InlinedWorkerLoader();
const controlModuleLoader = new WasmNpmLoader(defaultNames.marine.package, defaultNames.marine.file);
const avmModuleLoader = new WasmNpmLoader(defaultNames.avm.package, defaultNames.avm.file);
const marine = new MarineBackgroundRunner(workerLoader, controlModuleLoader, marineLogFunction);
const avm = new MarineBasedAvmRunner(marine, avmModuleLoader, undefined);
return new FluencePeer(marine, avm);
};
// @ts-ignore
globalThis.defaultPeer = makeDefaultPeer();

View File

@ -0,0 +1,21 @@
{
"compilerOptions": {
"outDir": "./dist/",
"baseUrl": ".",
"downlevelIteration": true,
"sourceMap": true,
"inlineSources": true,
"allowSyntheticDefaultImports": true,
"resolveJsonModule": true,
"target": "ES5",
"module": "commonjs",
"moduleResolution": "node",
"declaration": true,
"esModuleInterop": true,
"declarationMap": true,
"strict": true,
"skipLibCheck": true
},
"exclude": ["node_modules", "dist", "bundle"],
"include": ["src/**/*"]
}