Skip to content

Commit

Permalink
replaced @emurgo/cardano-serialization-lib asmjs version with the bro…
Browse files Browse the repository at this point in the history
…wser one
  • Loading branch information
nhenin committed Aug 16, 2023
1 parent 884fdb4 commit 7e8f23a
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 17 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ tsconfig.tsbuildinfo
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# created by the rollup
stats.html
# created by nix
result
source
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,27 @@
"devDependencies": {
"@blockfrost/blockfrost-js": "5.2.0",
"@blockfrost/openapi": "0.1.54",
"lucid-cardano": "0.9.4",
"dotenv": "^16.0.3",
"@relmify/jest-fp-ts": "^2.0.2",
"@rollup/plugin-commonjs": "^25.0.3",
"@rollup/plugin-node-resolve": "^15.1.0",
"@rollup/plugin-wasm": "^6.1.3",
"@types/axios-curlirize": "^1.3.2",
"@types/deep-equal": "1.0.1",
"@types/jest": "^26.0.24",
"@types/json-bigint": "^1.0.1",
"@types/node": "^18.14.2",
"dotenv": "^16.0.3",
"eslint": "^7.32.0",
"http-server": "^14.1.1",
"jest": "^29.4",
"jest-serial-runner": "^1.2.1",
"lucid-cardano": "0.9.4",
"npm-run-all": "^4.1.5",
"prettier": "^2.3.2",
"rollup": "^3.27.2",
"rollup-plugin-copy": "^3.4.0",
"rollup-plugin-output-size": "^1.2.2",
"rollup-plugin-visualizer": "^5.9.2",
"shx": "^0.3.3",
"ts-jest": "^29.0.5",
"ts-node": "^10.9.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/legacy-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@
"@47ng/codec":"1.1.0",
"json-bigint": "^1.0.0",
"jsonbigint-io-ts-reporters":"2.0.1",
"@emurgo/cardano-serialization-lib-asmjs":"11.4.0"
"@emurgo/cardano-serialization-lib-browser":"11.4.0"
}
}
2 changes: 1 addition & 1 deletion packages/legacy-runtime/src/common/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { iso, Newtype } from "newtype-ts";
import { fromNewtype } from "io-ts-types";

import { pipe } from "fp-ts/lib/function.js";
import * as CSL from '@emurgo/cardano-serialization-lib-asmjs'
import * as CSL from '@emurgo/cardano-serialization-lib-browser'
import { hex } from '@47ng/codec'

export type AddressBech32 = Newtype<{ readonly AddressBech32: unique symbol }, string>
Expand Down
2 changes: 1 addition & 1 deletion packages/legacy-runtime/src/common/tx/collateral.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { pipe } from "fp-ts/lib/function.js";
import * as CSL from '@emurgo/cardano-serialization-lib-asmjs'
import * as CSL from '@emurgo/cardano-serialization-lib-browser'
import { TxOutRef, txOutRef } from "./outRef.js";
import { hex } from '@47ng/codec'

Expand Down
2 changes: 1 addition & 1 deletion packages/legacy-runtime/src/wallet/cip30/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { deserializeCollateral } from '../../common/tx/collateral.js';
import { token } from '@marlowe/language-core-v1/token';


import * as CSL from '@emurgo/cardano-serialization-lib-asmjs'
import * as CSL from '@emurgo/cardano-serialization-lib-browser'
import { TokenValue, lovelaceValue, tokenValue } from '@marlowe/language-core-v1/tokenValue';

import { hex, utf8 } from '@47ng/codec'
Expand Down
26 changes: 16 additions & 10 deletions rollup/legacy-runtime-esm.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,33 @@ import { nodeResolve } from '@rollup/plugin-node-resolve';
import copy from 'rollup-plugin-copy'
import commonjs from '@rollup/plugin-commonjs';
import outputSize from 'rollup-plugin-output-size';
import { visualizer } from "rollup-plugin-visualizer";

const outputDir = 'dist/legacy-runtime/esm';
const nodePlugin = nodeResolve({browser: true});
const nodePlugin = nodeResolve(
{ browser: true
, resolveOnly: module => !module.includes('@emurgo/cardano-serialization-lib-browser')
});

// const wasmPlugin = wasm({targetEnv: 'browser', sync: ['**/*.wasm']});

// const copyWasm = copy({
// targets: [
// { src: 'node_modules/lucid-cardano/esm/src/core/wasm_modules/cardano_multiplatform_lib_web/*.wasm', dest: `${outputDir}/wasm_modules/cardano_multiplatform_lib_web/` },
// { src: 'node_modules/lucid-cardano/esm/src/core/wasm_modules/cardano_message_signing_web/*.wasm', dest: `${outputDir}/wasm_modules/cardano_message_signing_web/` },
// ]
// });
const copyWasm = copy({
targets: [
{ src: 'node_modules/@emurgo/cardano-serialization-lib-browser/*.wasm', dest: `${outputDir}/` }
]
});
export default {
// input: 'packages/language/core/v1/dist/semantics/contract/index.js',
// input: 'packages/legacy-adapter/dist/index.js',
input: 'packages/legacy-runtime/dist/index.js',
output: {
dir: outputDir,
format: 'esm',
},
plugins:
[ nodePlugin
[ copyWasm
, nodePlugin
, commonjs()
// , copyWasm
, outputSize()],
, outputSize()
, visualizer()],
}

0 comments on commit 7e8f23a

Please sign in to comment.