mirror of
https://github.com/blyssprivacy/sdk.git
synced 2026-01-11 08:07:59 -05:00
* bucket check and async setup clients perform direct setup by default * (python) more consistent json for internal api all requests and response are JSON. all binary payloads are explicitly encoded as base64 within api.py, and decoded back to bytes before leaving api.py. User-facing code, e.g. bucket.py and bucket_service.py, should not see base64 wrangling. * Support async for all ops refactor api.py to be async-first use new asyncio loops to support non-async interface; cannot call non-async methods from async context * [js] update client to work with unified service bump both versions to 0.2.1 disable npm/pypi publish except on manual workflow run * disable request compression * fix workflow tests update standalone Spiral test server to use new JSON interface
112 lines
2.2 KiB
JavaScript
112 lines
2.2 KiB
JavaScript
import WasmPackPlugin from '@wasm-tool/wasm-pack-plugin';
|
|
import path from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
import CopyPlugin from 'copy-webpack-plugin';
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
|
|
const dist = path.resolve(__dirname, 'dist');
|
|
const distLib = path.resolve(dist, 'lib');
|
|
const distCjs = path.resolve(dist, 'cjs');
|
|
|
|
const config = {
|
|
name: 'web',
|
|
mode: 'development',
|
|
context: path.resolve(__dirname, 'js'),
|
|
entry: {
|
|
index: './index'
|
|
},
|
|
devtool: 'source-map',
|
|
performance: {
|
|
maxEntrypointSize: 512000,
|
|
maxAssetSize: 512000
|
|
},
|
|
output: {
|
|
path: dist,
|
|
filename: 'index.js',
|
|
chunkFormat: 'module',
|
|
library: {
|
|
type: 'module'
|
|
}
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.tsx?$/,
|
|
use: {
|
|
loader: 'ts-loader'
|
|
},
|
|
exclude: [/node_modules/, path.resolve(__dirname, 'examples')]
|
|
},
|
|
{
|
|
test: /\.wasm$/,
|
|
type: 'asset/inline'
|
|
}
|
|
]
|
|
},
|
|
resolve: {
|
|
extensions: ['.tsx', '.ts', '.js']
|
|
},
|
|
externals: {
|
|
'node:crypto': 'commonjs2 node:crypto'
|
|
},
|
|
devServer: {
|
|
static: dist
|
|
},
|
|
experiments: {
|
|
asyncWebAssembly: true,
|
|
outputModule: true
|
|
},
|
|
plugins: [
|
|
new WasmPackPlugin({
|
|
crateDirectory: path.resolve(__dirname, 'js/bridge'),
|
|
outDir: distLib,
|
|
extraArgs: '--target web',
|
|
outName: 'lib',
|
|
forceMode: 'production'
|
|
})
|
|
],
|
|
target: 'web'
|
|
};
|
|
|
|
const webTarget = config;
|
|
|
|
const webSingleFileTarget = {
|
|
...config,
|
|
name: 'web-single-file',
|
|
dependencies: ['web'],
|
|
output: {
|
|
path: dist,
|
|
filename: 'blyss-bundle.min.js',
|
|
library: {
|
|
type: 'window',
|
|
name: 'blyss'
|
|
}
|
|
}
|
|
};
|
|
|
|
const nodeTarget = {
|
|
...config,
|
|
name: 'node',
|
|
dependencies: ['web'],
|
|
output: {
|
|
path: dist + '/cjs',
|
|
filename: 'index.cjs',
|
|
library: {
|
|
type: 'commonjs'
|
|
}
|
|
},
|
|
externals: {},
|
|
experiments: {
|
|
asyncWebAssembly: true
|
|
},
|
|
target: 'node',
|
|
plugins: [
|
|
new CopyPlugin({
|
|
patterns: [{ from: '../cjs-package.json', to: distCjs + '/package.json' }]
|
|
})
|
|
]
|
|
};
|
|
export default [webTarget, webSingleFileTarget, nodeTarget];
|