-
Notifications
You must be signed in to change notification settings - Fork 5
/
rollup.config.mjs
69 lines (61 loc) · 2.17 KB
/
rollup.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// Copyright 2021-2022 @skyekiwi authors & contributors
// SPDX-License-Identifier: Apache-2.0
import path from 'path';
import { createBundle } from '@skyekiwi/dev/config/rollup.js';
const pkgs = [
'@skyekiwi/crypto',
'@skyekiwi/diff',
'@skyekiwi/driver',
'@skyekiwi/file',
'@skyekiwi/ipfs',
'@skyekiwi/metadata',
'@skyekiwi/s-contract',
'@skyekiwi/secret-registry',
'@skyekiwi/util'
];
const external = [
...pkgs
];
const entries = [].reduce((all, p) => ({
...all,
[`@skyekiwi/${p}`]: path.resolve(process.cwd(), `packages/${p}/build`)
}), {});
const overrides = {
// '@polkadot/hw-ledger': {
// // these are all in the un-shakable and unused hdDerivation stuff from the Zondax libs, ignore
// entries: {
// 'bip32-ed25519': path.resolve(process.cwd(), 'packages/x-bundle/build/empty.js'),
// bip39: path.resolve(process.cwd(), 'packages/x-bundle/build/empty.js'),
// blakejs: path.resolve(process.cwd(), 'packages/x-bundle/build/empty.js'),
// bs58: path.resolve(process.cwd(), 'packages/x-bundle/build/empty.js'),
// events: path.resolve(process.cwd(), 'packages/x-bundle/build/empty.js'),
// 'hash.js': path.resolve(process.cwd(), 'packages/x-bundle/build/empty.js')
// }
// },
// '@polkadot/util-crypto': {
// entries: {
// '@polkadot/wasm-crypto': path.resolve(process.cwd(), 'node_modules/@polkadot/wasm-crypto/bundle.js'),
// 'bn.js': path.resolve(process.cwd(), 'packages/x-bundle/build/bn.cjs'),
// buffer: path.resolve(process.cwd(), 'packages/x-bundle/build/buffer.js'),
// crypto: path.resolve(process.cwd(), 'packages/x-bundle/build/crypto.js')
// },
// inject: {
// Buffer: path.resolve(process.cwd(), 'packages/x-bundle/build/buffer.js'),
// crypto: path.resolve(process.cwd(), 'packages/x-bundle/build/crypto.js'),
// inherits: path.resolve(process.cwd(), 'packages/x-bundle/build/inherits.js')
// },
// polyfill: false
// }
};
export default pkgs.map((pkg) => {
const override = (overrides[pkg] || {});
return createBundle({
external,
pkg,
...override,
entries: {
...entries,
...(override.entries || {})
}
});
});