@acala-network/chopsticks 0.9.0 → 0.9.1-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/context.js +1 -1
- package/dist/cjs/plugins/follow-chain/index.js +75 -0
- package/dist/cjs/plugins/index.js +18 -4
- package/dist/cjs/plugins/run-block/index.js +16 -1
- package/dist/cjs/utils/generate-html-diff.js +4 -4
- package/dist/esm/context.js +1 -1
- package/dist/esm/package.json +1 -0
- package/dist/esm/plugins/follow-chain/index.js +68 -0
- package/dist/esm/plugins/index.js +15 -4
- package/dist/esm/plugins/run-block/index.js +16 -1
- package/dist/esm/utils/generate-html-diff.js +4 -4
- package/dist/esm/utils/template/diff.html +304 -0
- package/dist/types/plugins/decode-key/index.d.ts +2 -2
- package/dist/types/plugins/dry-run/cli.d.ts +2 -2
- package/dist/types/plugins/follow-chain/index.d.ts +2 -0
- package/dist/types/plugins/index.d.ts +2 -2
- package/dist/types/plugins/run-block/index.d.ts +11 -5
- package/dist/types/plugins/try-runtime/index.d.ts +2 -2
- package/package.json +9 -8
- /package/{template → dist/cjs/utils/template}/diff.html +0 -0
package/dist/cjs/context.js
CHANGED
|
@@ -110,8 +110,8 @@ const setupContext = async (argv, overrideParent = false) => {
|
|
|
110
110
|
}
|
|
111
111
|
// override wasm before importing storage, in case new pallets have been
|
|
112
112
|
// added that have storage imports
|
|
113
|
-
await (0, override_1.overrideStorage)(chain, argv['import-storage'], at);
|
|
114
113
|
await (0, override_1.overrideWasm)(chain, argv['wasm-override'], at);
|
|
114
|
+
await (0, override_1.overrideStorage)(chain, argv['import-storage'], at);
|
|
115
115
|
return { chain };
|
|
116
116
|
};
|
|
117
117
|
exports.setupContext = setupContext;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.cli = void 0;
|
|
7
|
+
const chopsticks_core_1 = require("@acala-network/chopsticks-core");
|
|
8
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
9
|
+
const server_1 = require("../../server");
|
|
10
|
+
const cli_options_1 = require("../../cli-options");
|
|
11
|
+
const rpc_1 = require("../../rpc");
|
|
12
|
+
const context_1 = require("../../context");
|
|
13
|
+
const logger = chopsticks_core_1.defaultLogger.child({ name: 'follow-chain' });
|
|
14
|
+
const options = lodash_1.default.pick(cli_options_1.defaultOptions, ['endpoint', 'wasm-override', 'runtime-log-level', 'offchain-worker']);
|
|
15
|
+
const cli = (y) => {
|
|
16
|
+
y.command('follow-chain', 'Always follow the latest block on upstream', (yargs) => yargs.options({
|
|
17
|
+
...options,
|
|
18
|
+
port: {
|
|
19
|
+
desc: 'Port to listen on',
|
|
20
|
+
number: true,
|
|
21
|
+
},
|
|
22
|
+
'head-mode': {
|
|
23
|
+
desc: 'Head mode',
|
|
24
|
+
choices: ['latest', 'finalized'],
|
|
25
|
+
default: 'finalized',
|
|
26
|
+
},
|
|
27
|
+
}), async (argv) => {
|
|
28
|
+
const port = argv.port ?? 8000;
|
|
29
|
+
const endpoint = argv.endpoint;
|
|
30
|
+
if (/^(https|http):\/\//.test(endpoint || '')) {
|
|
31
|
+
throw Error('http provider is not supported');
|
|
32
|
+
}
|
|
33
|
+
const context = await (0, context_1.setupContext)(argv, true);
|
|
34
|
+
const { close, port: listenPort } = await (0, server_1.createServer)((0, rpc_1.handler)(context), port);
|
|
35
|
+
logger.info(`${await context.chain.api.getSystemChain()} RPC listening on port ${listenPort}`);
|
|
36
|
+
const chain = context.chain;
|
|
37
|
+
chain.api[argv.headMode === 'latest' ? 'subscribeRemoteNewHeads' : 'subscribeRemoteFinalizedHeads'](async (error, data) => {
|
|
38
|
+
try {
|
|
39
|
+
if (error)
|
|
40
|
+
throw error;
|
|
41
|
+
logger.info({ header: data }, `Follow ${argv.headMode} head from upstream`);
|
|
42
|
+
const parent = await chain.getBlock(data.parentHash);
|
|
43
|
+
if (!parent)
|
|
44
|
+
throw Error(`Cannot find parent', ${data.parentHash}`);
|
|
45
|
+
const registry = await parent.registry;
|
|
46
|
+
const header = registry.createType('Header', data);
|
|
47
|
+
const wasm = await parent.wasm;
|
|
48
|
+
const block = new chopsticks_core_1.Block(chain, header.number.toNumber(), header.hash.toHex(), parent);
|
|
49
|
+
await chain.setHead(block);
|
|
50
|
+
const calls = [['Core_initialize_block', [header.toHex()]]];
|
|
51
|
+
for (const extrinsic of await block.extrinsics) {
|
|
52
|
+
calls.push(['BlockBuilder_apply_extrinsic', [extrinsic]]);
|
|
53
|
+
}
|
|
54
|
+
calls.push(['BlockBuilder_finalize_block', []]);
|
|
55
|
+
const result = await (0, chopsticks_core_1.runTask)({
|
|
56
|
+
wasm,
|
|
57
|
+
calls,
|
|
58
|
+
mockSignatureHost: false,
|
|
59
|
+
allowUnresolvedImports: false,
|
|
60
|
+
runtimeLogLevel: argv.runtimeLogLevel || 0,
|
|
61
|
+
}, (0, chopsticks_core_1.taskHandler)(parent));
|
|
62
|
+
if ('Error' in result) {
|
|
63
|
+
throw new Error(result.Error);
|
|
64
|
+
}
|
|
65
|
+
(0, chopsticks_core_1.printRuntimeLogs)(result.Call.runtimeLogs);
|
|
66
|
+
}
|
|
67
|
+
catch (e) {
|
|
68
|
+
logger.error(e, 'Error when processing new head');
|
|
69
|
+
await close();
|
|
70
|
+
process.exit(1);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
exports.cli = cli;
|
|
@@ -22,19 +22,33 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
25
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
29
|
exports.pluginExtendCli = exports.pluginHandlers = void 0;
|
|
27
|
-
const lodash_1 = require("lodash");
|
|
28
|
-
const fs_1 = require("fs");
|
|
30
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
29
31
|
const logger_1 = require("../logger");
|
|
30
32
|
const logger = logger_1.defaultLogger.child({ name: 'plugin' });
|
|
31
33
|
exports.pluginHandlers = {};
|
|
32
|
-
const plugins =
|
|
34
|
+
const plugins = [
|
|
35
|
+
'decode-key',
|
|
36
|
+
'dry-run',
|
|
37
|
+
'follow-chain',
|
|
38
|
+
'new-block',
|
|
39
|
+
'run-block',
|
|
40
|
+
'set-block-build-mode',
|
|
41
|
+
'set-head',
|
|
42
|
+
'set-runtime-log-level',
|
|
43
|
+
'set-storage',
|
|
44
|
+
'time-travel',
|
|
45
|
+
'try-runtime',
|
|
46
|
+
];
|
|
33
47
|
(async () => {
|
|
34
48
|
for (const plugin of plugins) {
|
|
35
49
|
const { rpc, name } = await Promise.resolve(`${`./${plugin}`}`).then(s => __importStar(require(s)));
|
|
36
50
|
if (rpc) {
|
|
37
|
-
const methodName = name ||
|
|
51
|
+
const methodName = name || lodash_1.default.camelCase(plugin);
|
|
38
52
|
exports.pluginHandlers[`dev_${methodName}`] = rpc;
|
|
39
53
|
logger.debug(`Registered plugin ${plugin} RPC`);
|
|
40
54
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.rpc = exports.name = exports.cli = void 0;
|
|
4
|
+
const util_1 = require("@polkadot/util");
|
|
4
5
|
const node_fs_1 = require("node:fs");
|
|
5
6
|
const zod_1 = require("zod");
|
|
6
7
|
const chopsticks_core_1 = require("@acala-network/chopsticks-core");
|
|
@@ -80,6 +81,7 @@ exports.name = 'runBlock';
|
|
|
80
81
|
* Run a set of extrinsics on top of a block and get the storage diff
|
|
81
82
|
* and optionally the parsed storage diff and block details.
|
|
82
83
|
* NOTE: The extrinsics should include inherents or tranasctions may have unexpected results.
|
|
84
|
+
* NOTE: system.events and system.extrinsicData are excluded from storage diff to reduce size.
|
|
83
85
|
*
|
|
84
86
|
* This function is a dev rpc handler. Use `dev_runBlock` as the method name when calling it.
|
|
85
87
|
*/
|
|
@@ -108,6 +110,8 @@ const rpc = async ({ chain }, [params]) => {
|
|
|
108
110
|
};
|
|
109
111
|
// exclude system events because it can be stupidly large and redudant
|
|
110
112
|
const systemEventsKey = (0, chopsticks_core_1.compactHex)(meta.query.system.events());
|
|
113
|
+
// large and not really useful
|
|
114
|
+
const systemExtrinsicDataKey = (0, util_1.u8aToHex)(meta.query.system.extrinsicData.keyPrefix());
|
|
111
115
|
const run = async (fn, args) => {
|
|
112
116
|
const result = await (0, chopsticks_core_1.runTask)({
|
|
113
117
|
wasm,
|
|
@@ -126,12 +130,23 @@ const rpc = async ({ chain }, [params]) => {
|
|
|
126
130
|
if (key === systemEventsKey) {
|
|
127
131
|
continue;
|
|
128
132
|
}
|
|
133
|
+
if (key.startsWith(systemExtrinsicDataKey)) {
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
129
136
|
const obj = {};
|
|
130
137
|
if (includeRawStorage) {
|
|
131
138
|
obj.raw = { key, value };
|
|
132
139
|
}
|
|
133
140
|
if (includeParsed) {
|
|
134
|
-
|
|
141
|
+
const decoded = (0, chopsticks_core_1.decodeKeyValue)(await newBlock.meta, newBlock, key, value, false);
|
|
142
|
+
if (decoded) {
|
|
143
|
+
obj.parsed = {
|
|
144
|
+
section: decoded.section,
|
|
145
|
+
method: decoded.method,
|
|
146
|
+
key: decoded.key,
|
|
147
|
+
value: decoded.value,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
135
150
|
}
|
|
136
151
|
resp.storageDiff.push(obj);
|
|
137
152
|
}
|
|
@@ -6,12 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.generateHtmlDiffPreviewFile = exports.generateHtmlDiff = void 0;
|
|
7
7
|
const decoder_1 = require("./decoder");
|
|
8
8
|
const node_fs_1 = require("node:fs");
|
|
9
|
-
const lodash_1 = require("lodash");
|
|
10
|
-
const
|
|
9
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
10
|
+
const node_url_1 = __importDefault(require("node:url"));
|
|
11
11
|
const generateHtmlDiff = async (block, diff) => {
|
|
12
12
|
const { oldState, delta } = await (0, decoder_1.decodeStorageDiff)(block, diff);
|
|
13
|
-
const htmlTemplate = (0, node_fs_1.readFileSync)(
|
|
14
|
-
return
|
|
13
|
+
const htmlTemplate = (0, node_fs_1.readFileSync)(node_url_1.default.resolve(__filename, './template/diff.html'), 'utf-8');
|
|
14
|
+
return lodash_1.default.template(htmlTemplate)({ left: JSON.stringify(oldState), delta: JSON.stringify(delta) });
|
|
15
15
|
};
|
|
16
16
|
exports.generateHtmlDiff = generateHtmlDiff;
|
|
17
17
|
const generateHtmlDiffPreviewFile = async (block, diff, filename) => {
|
package/dist/esm/context.js
CHANGED
|
@@ -80,7 +80,7 @@ export const setupContext = async (argv, overrideParent = false) => {
|
|
|
80
80
|
}
|
|
81
81
|
// override wasm before importing storage, in case new pallets have been
|
|
82
82
|
// added that have storage imports
|
|
83
|
-
await overrideStorage(chain, argv['import-storage'], at);
|
|
84
83
|
await overrideWasm(chain, argv['wasm-override'], at);
|
|
84
|
+
await overrideStorage(chain, argv['import-storage'], at);
|
|
85
85
|
return { chain };
|
|
86
86
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type": "module"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Block, defaultLogger, printRuntimeLogs, runTask, taskHandler } from '@acala-network/chopsticks-core';
|
|
2
|
+
import _ from 'lodash';
|
|
3
|
+
import { createServer } from '../../server';
|
|
4
|
+
import { defaultOptions } from '../../cli-options';
|
|
5
|
+
import { handler } from '../../rpc';
|
|
6
|
+
import { setupContext } from '../../context';
|
|
7
|
+
const logger = defaultLogger.child({ name: 'follow-chain' });
|
|
8
|
+
const options = _.pick(defaultOptions, ['endpoint', 'wasm-override', 'runtime-log-level', 'offchain-worker']);
|
|
9
|
+
export const cli = (y) => {
|
|
10
|
+
y.command('follow-chain', 'Always follow the latest block on upstream', (yargs) => yargs.options({
|
|
11
|
+
...options,
|
|
12
|
+
port: {
|
|
13
|
+
desc: 'Port to listen on',
|
|
14
|
+
number: true,
|
|
15
|
+
},
|
|
16
|
+
'head-mode': {
|
|
17
|
+
desc: 'Head mode',
|
|
18
|
+
choices: ['latest', 'finalized'],
|
|
19
|
+
default: 'finalized',
|
|
20
|
+
},
|
|
21
|
+
}), async (argv) => {
|
|
22
|
+
const port = argv.port ?? 8000;
|
|
23
|
+
const endpoint = argv.endpoint;
|
|
24
|
+
if (/^(https|http):\/\//.test(endpoint || '')) {
|
|
25
|
+
throw Error('http provider is not supported');
|
|
26
|
+
}
|
|
27
|
+
const context = await setupContext(argv, true);
|
|
28
|
+
const { close, port: listenPort } = await createServer(handler(context), port);
|
|
29
|
+
logger.info(`${await context.chain.api.getSystemChain()} RPC listening on port ${listenPort}`);
|
|
30
|
+
const chain = context.chain;
|
|
31
|
+
chain.api[argv.headMode === 'latest' ? 'subscribeRemoteNewHeads' : 'subscribeRemoteFinalizedHeads'](async (error, data) => {
|
|
32
|
+
try {
|
|
33
|
+
if (error)
|
|
34
|
+
throw error;
|
|
35
|
+
logger.info({ header: data }, `Follow ${argv.headMode} head from upstream`);
|
|
36
|
+
const parent = await chain.getBlock(data.parentHash);
|
|
37
|
+
if (!parent)
|
|
38
|
+
throw Error(`Cannot find parent', ${data.parentHash}`);
|
|
39
|
+
const registry = await parent.registry;
|
|
40
|
+
const header = registry.createType('Header', data);
|
|
41
|
+
const wasm = await parent.wasm;
|
|
42
|
+
const block = new Block(chain, header.number.toNumber(), header.hash.toHex(), parent);
|
|
43
|
+
await chain.setHead(block);
|
|
44
|
+
const calls = [['Core_initialize_block', [header.toHex()]]];
|
|
45
|
+
for (const extrinsic of await block.extrinsics) {
|
|
46
|
+
calls.push(['BlockBuilder_apply_extrinsic', [extrinsic]]);
|
|
47
|
+
}
|
|
48
|
+
calls.push(['BlockBuilder_finalize_block', []]);
|
|
49
|
+
const result = await runTask({
|
|
50
|
+
wasm,
|
|
51
|
+
calls,
|
|
52
|
+
mockSignatureHost: false,
|
|
53
|
+
allowUnresolvedImports: false,
|
|
54
|
+
runtimeLogLevel: argv.runtimeLogLevel || 0,
|
|
55
|
+
}, taskHandler(parent));
|
|
56
|
+
if ('Error' in result) {
|
|
57
|
+
throw new Error(result.Error);
|
|
58
|
+
}
|
|
59
|
+
printRuntimeLogs(result.Call.runtimeLogs);
|
|
60
|
+
}
|
|
61
|
+
catch (e) {
|
|
62
|
+
logger.error(e, 'Error when processing new head');
|
|
63
|
+
await close();
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
};
|
|
@@ -1,14 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { lstatSync, readdirSync } from 'fs';
|
|
1
|
+
import _ from 'lodash';
|
|
3
2
|
import { defaultLogger } from '../logger';
|
|
4
3
|
const logger = defaultLogger.child({ name: 'plugin' });
|
|
5
4
|
export const pluginHandlers = {};
|
|
6
|
-
const plugins =
|
|
5
|
+
const plugins = [
|
|
6
|
+
'decode-key',
|
|
7
|
+
'dry-run',
|
|
8
|
+
'follow-chain',
|
|
9
|
+
'new-block',
|
|
10
|
+
'run-block',
|
|
11
|
+
'set-block-build-mode',
|
|
12
|
+
'set-head',
|
|
13
|
+
'set-runtime-log-level',
|
|
14
|
+
'set-storage',
|
|
15
|
+
'time-travel',
|
|
16
|
+
'try-runtime',
|
|
17
|
+
];
|
|
7
18
|
(async () => {
|
|
8
19
|
for (const plugin of plugins) {
|
|
9
20
|
const { rpc, name } = await import(`./${plugin}`);
|
|
10
21
|
if (rpc) {
|
|
11
|
-
const methodName = name || camelCase(plugin);
|
|
22
|
+
const methodName = name || _.camelCase(plugin);
|
|
12
23
|
pluginHandlers[`dev_${methodName}`] = rpc;
|
|
13
24
|
logger.debug(`Registered plugin ${plugin} RPC`);
|
|
14
25
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { u8aToHex } from '@polkadot/util';
|
|
1
2
|
import { writeFileSync } from 'node:fs';
|
|
2
3
|
import { z } from 'zod';
|
|
3
4
|
import { Block, compactHex, decodeKeyValue, printRuntimeLogs, runTask, taskHandler, } from '@acala-network/chopsticks-core';
|
|
@@ -76,6 +77,7 @@ export const name = 'runBlock';
|
|
|
76
77
|
* Run a set of extrinsics on top of a block and get the storage diff
|
|
77
78
|
* and optionally the parsed storage diff and block details.
|
|
78
79
|
* NOTE: The extrinsics should include inherents or tranasctions may have unexpected results.
|
|
80
|
+
* NOTE: system.events and system.extrinsicData are excluded from storage diff to reduce size.
|
|
79
81
|
*
|
|
80
82
|
* This function is a dev rpc handler. Use `dev_runBlock` as the method name when calling it.
|
|
81
83
|
*/
|
|
@@ -104,6 +106,8 @@ export const rpc = async ({ chain }, [params]) => {
|
|
|
104
106
|
};
|
|
105
107
|
// exclude system events because it can be stupidly large and redudant
|
|
106
108
|
const systemEventsKey = compactHex(meta.query.system.events());
|
|
109
|
+
// large and not really useful
|
|
110
|
+
const systemExtrinsicDataKey = u8aToHex(meta.query.system.extrinsicData.keyPrefix());
|
|
107
111
|
const run = async (fn, args) => {
|
|
108
112
|
const result = await runTask({
|
|
109
113
|
wasm,
|
|
@@ -122,12 +126,23 @@ export const rpc = async ({ chain }, [params]) => {
|
|
|
122
126
|
if (key === systemEventsKey) {
|
|
123
127
|
continue;
|
|
124
128
|
}
|
|
129
|
+
if (key.startsWith(systemExtrinsicDataKey)) {
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
125
132
|
const obj = {};
|
|
126
133
|
if (includeRawStorage) {
|
|
127
134
|
obj.raw = { key, value };
|
|
128
135
|
}
|
|
129
136
|
if (includeParsed) {
|
|
130
|
-
|
|
137
|
+
const decoded = decodeKeyValue(await newBlock.meta, newBlock, key, value, false);
|
|
138
|
+
if (decoded) {
|
|
139
|
+
obj.parsed = {
|
|
140
|
+
section: decoded.section,
|
|
141
|
+
method: decoded.method,
|
|
142
|
+
key: decoded.key,
|
|
143
|
+
value: decoded.value,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
131
146
|
}
|
|
132
147
|
resp.storageDiff.push(obj);
|
|
133
148
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { decodeStorageDiff } from './decoder';
|
|
2
2
|
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import _ from 'lodash';
|
|
4
|
+
import url from 'node:url';
|
|
5
5
|
export const generateHtmlDiff = async (block, diff) => {
|
|
6
6
|
const { oldState, delta } = await decodeStorageDiff(block, diff);
|
|
7
|
-
const htmlTemplate = readFileSync(
|
|
8
|
-
return template(htmlTemplate)({ left: JSON.stringify(oldState), delta: JSON.stringify(delta) });
|
|
7
|
+
const htmlTemplate = readFileSync(url.resolve(__filename, './template/diff.html'), 'utf-8');
|
|
8
|
+
return _.template(htmlTemplate)({ left: JSON.stringify(oldState), delta: JSON.stringify(delta) });
|
|
9
9
|
};
|
|
10
10
|
export const generateHtmlDiffPreviewFile = async (block, diff, filename) => {
|
|
11
11
|
const html = await generateHtmlDiff(block, diff);
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<style>
|
|
5
|
+
body {
|
|
6
|
+
font-family: ui-monospace, 'SFMono-Regular', 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
|
|
7
|
+
font-size: 14px;
|
|
8
|
+
min-width: 600px;
|
|
9
|
+
margin: 0;
|
|
10
|
+
padding: 0;
|
|
11
|
+
background-color: rgb(39, 40, 34);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
div#app {
|
|
15
|
+
margin: 0 !important;
|
|
16
|
+
padding: 0 !important;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.diff {
|
|
20
|
+
padding: 2px 4px;
|
|
21
|
+
border-radius: 4px;
|
|
22
|
+
position: relative;
|
|
23
|
+
color: white;
|
|
24
|
+
line-height: 150%;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.diff > button {
|
|
28
|
+
position: absolute;
|
|
29
|
+
display: none;
|
|
30
|
+
left: 50%;
|
|
31
|
+
top: 50%;
|
|
32
|
+
translate: -50% -50%;
|
|
33
|
+
background: #fff;
|
|
34
|
+
border: none;
|
|
35
|
+
border-radius: 50%;
|
|
36
|
+
padding: 10px;
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
opacity: 80%;
|
|
40
|
+
width: 40px;
|
|
41
|
+
height: 40px;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.diff > button > img {
|
|
45
|
+
width: 100%;
|
|
46
|
+
height: 100%;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.diff > button:hover {
|
|
50
|
+
opacity: 100%;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.diff:hover > button {
|
|
54
|
+
display: block;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.diffWrap {
|
|
58
|
+
position: relative;
|
|
59
|
+
z-index: 1;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
li:has(> span > span.diffWrap > span.diffRemove) > label {
|
|
63
|
+
color: red !important;
|
|
64
|
+
text-decoration: line-through;
|
|
65
|
+
text-decoration-thickness: 1px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.diffAdd {
|
|
69
|
+
color: darkseagreen;
|
|
70
|
+
display: inline-flex;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.diffRemove {
|
|
74
|
+
text-decoration: line-through;
|
|
75
|
+
text-decoration-thickness: 1px;
|
|
76
|
+
color: red;
|
|
77
|
+
display: inline-flex;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.diffUpdateFrom {
|
|
81
|
+
text-decoration: line-through;
|
|
82
|
+
text-decoration-thickness: 1px;
|
|
83
|
+
color: red;
|
|
84
|
+
display: inline-flex;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.diffUpdateTo {
|
|
88
|
+
color: darkseagreen;
|
|
89
|
+
display: inline-flex;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.diffUpdateArrow {
|
|
93
|
+
color: #ccc;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.unchanged {
|
|
97
|
+
color: #666;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.delta {
|
|
101
|
+
color: #ccc;
|
|
102
|
+
font-size: 12px;
|
|
103
|
+
margin: 0 10px;
|
|
104
|
+
}
|
|
105
|
+
</style>
|
|
106
|
+
<script src="https://unpkg.com/babel-standalone@6/babel.min.js" crossorigin></script>
|
|
107
|
+
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js" crossorigin></script>
|
|
108
|
+
<script src="https://unpkg.com/react@18/umd/react.production.min.js" crossorigin></script>
|
|
109
|
+
<script src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js" crossorigin></script>
|
|
110
|
+
<script src="https://unpkg.com/react-json-tree@0.18.0/lib/umd/react-json-tree.min.js" crossorigin></script>
|
|
111
|
+
</head>
|
|
112
|
+
|
|
113
|
+
<body>
|
|
114
|
+
<div id="app"></div>
|
|
115
|
+
<script type="text/babel">
|
|
116
|
+
|
|
117
|
+
const left = <%= left %>;
|
|
118
|
+
const delta = <%= delta %>;
|
|
119
|
+
|
|
120
|
+
const expandFirstLevel = (keyName, data, level) => level <= 1;
|
|
121
|
+
|
|
122
|
+
function stringifyAndShrink(val) {
|
|
123
|
+
if (val == null) return 'null';
|
|
124
|
+
if (typeof val === 'string') return val
|
|
125
|
+
return JSON.stringify(val, null, 1);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const styling = (a) => {
|
|
129
|
+
const className = Array.isArray(a) ? a : [a]
|
|
130
|
+
return { className: className.join(' ') }
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function valueRenderer(viewPartial) {
|
|
134
|
+
return function (raw, value, ...keys) {
|
|
135
|
+
const modifyPath = keys.reverse().join('.')
|
|
136
|
+
const removePath = keys.map(x => Number.isInteger(parseInt(x)) ? '_' + x : x).join('.')
|
|
137
|
+
const isDelta = _.has(delta, modifyPath) || _.has(delta, removePath)
|
|
138
|
+
|
|
139
|
+
function renderSpan(name, body, raw) {
|
|
140
|
+
return (
|
|
141
|
+
<span key={name} {...styling(['diff', name])}>
|
|
142
|
+
{body}
|
|
143
|
+
{_.isObjectLike(raw) ? <button onClick={() => viewPartial({ [modifyPath]: raw })}><img src='data:image/svg+xml;base64,PCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4KDTwhLS0gVXBsb2FkZWQgdG86IFNWRyBSZXBvLCB3d3cuc3ZncmVwby5jb20sIFRyYW5zZm9ybWVkIGJ5OiBTVkcgUmVwbyBNaXhlciBUb29scyAtLT4KPHN2ZyBmaWxsPSIjMDAwMDAwIiBoZWlnaHQ9IjY0cHgiIHdpZHRoPSI2NHB4IiB2ZXJzaW9uPSIxLjEiIGlkPSJMYXllcl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMjQyLjEzMyAyNDIuMTMzIiB4bWw6c3BhY2U9InByZXNlcnZlIiBzdHJva2U9IiMwMDAwMDAiPgoNPGcgaWQ9IlNWR1JlcG9fYmdDYXJyaWVyIiBzdHJva2Utd2lkdGg9IjAiLz4KDTxnIGlkPSJTVkdSZXBvX3RyYWNlckNhcnJpZXIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgoNPGcgaWQ9IlNWR1JlcG9faWNvbkNhcnJpZXIiPiA8ZyBpZD0iWE1MSURfMjVfIj4gPHBhdGggaWQ9IlhNTElEXzI2XyIgZD0iTTg5LjI0NywxMzEuNjczbC00Ny43MzIsNDcuNzNsLTE1LjkwOS0xNS45MWMtNC4yOS00LjI5MS0xMC43NDItNS41NzItMTYuMzQ3LTMuMjUyIEMzLjY1NCwxNjIuNTYzLDAsMTY4LjAzMywwLDE3NC4xdjUzLjAzMmMwLDguMjg0LDYuNzE2LDE1LDE1LDE1bDUzLjAzMywwLjAwMWMwLjAwNy0wLjAwMSwwLjAxMi0wLjAwMSwwLjAxOSwwIGM4LjI4NSwwLDE1LTYuNzE2LDE1LTE1YzAtNC4zNzctMS44NzUtOC4zMTYtNC44NjUtMTEuMDU5bC0xNS40NTgtMTUuNDU4bDQ3LjczLTQ3LjcyOWM1Ljg1OC01Ljg1OCw1Ljg1OC0xNS4zNTUsMC0yMS4yMTMgQzEwNC42MDMsMTI1LjgxNSw5NS4xMDQsMTI1LjgxNiw4OS4yNDcsMTMxLjY3M3oiLz4gPHBhdGggaWQ9IlhNTElEXzI4XyIgZD0iTTIyNy4xMzMsMEgxNzQuMWMtNi4wNjcsMC0xMS41MzYsMy42NTUtMTMuODU4LDkuMjZjLTIuMzIxLDUuNjA1LTEuMDM4LDEyLjA1NywzLjI1MiwxNi4zNDdsMTUuOTExLDE1LjkxMSBsLTQ3LjcyOSw0Ny43M2MtNS44NTgsNS44NTgtNS44NTgsMTUuMzU1LDAsMjEuMjEzYzIuOTI5LDIuOTI5LDYuNzY4LDQuMzkzLDEwLjYwNiw0LjM5M2MzLjgzOSwwLDcuNjc4LTEuNDY0LDEwLjYwNi00LjM5NCBsNDcuNzMtNDcuNzNsMTUuOTA5LDE1LjkxYzIuODY5LDIuODcsNi43MDYsNC4zOTQsMTAuNjA5LDQuMzk0YzEuOTMzLDAsMy44ODItMC4zNzMsNS43MzctMS4xNDIgYzUuNjA1LTIuMzIyLDkuMjYtNy43OTIsOS4yNi0xMy44NThWMTVDMjQyLjEzMyw2LjcxNiwyMzUuNDE3LDAsMjI3LjEzMywweiIvPiA8L2c+IDwvZz4KDTwvc3ZnPg==' /></button> : null}
|
|
144
|
+
</span>
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function renderDelta(value) {
|
|
149
|
+
if (/^\d+(,\d+)*$/.test(value[0]) && /^\d+(,\d+)*$/.test(value[1])) {
|
|
150
|
+
const oldValue = BigInt(value[0].replace(/,/g, ''))
|
|
151
|
+
const newValue = BigInt(value[1].replace(/,/g, ''))
|
|
152
|
+
if (oldValue > 0 && newValue > 0) {
|
|
153
|
+
const delta = newValue - oldValue
|
|
154
|
+
return (<span className="delta" >{delta > 0 ? '+' : ''}{delta.toLocaleString()}</span>)
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (isDelta && Array.isArray(value)) {
|
|
160
|
+
switch (value.length) {
|
|
161
|
+
case 0:
|
|
162
|
+
return (
|
|
163
|
+
<span {...styling('diffWrap')}>
|
|
164
|
+
{renderSpan('diff', '[]')}
|
|
165
|
+
</span>
|
|
166
|
+
)
|
|
167
|
+
case 1:
|
|
168
|
+
return (
|
|
169
|
+
<span {...styling('diffWrap')}>
|
|
170
|
+
{renderSpan(
|
|
171
|
+
'diffAdd',
|
|
172
|
+
stringifyAndShrink(value[0]),
|
|
173
|
+
value[0]
|
|
174
|
+
)}
|
|
175
|
+
</span>
|
|
176
|
+
);
|
|
177
|
+
case 2:
|
|
178
|
+
return (
|
|
179
|
+
<span {...styling('diffWrap')}>
|
|
180
|
+
{renderSpan(
|
|
181
|
+
'diffUpdateFrom',
|
|
182
|
+
stringifyAndShrink(value[0]),
|
|
183
|
+
value[0]
|
|
184
|
+
)}
|
|
185
|
+
{renderSpan('diffUpdateArrow', ' => ')}
|
|
186
|
+
{renderSpan(
|
|
187
|
+
'diffUpdateTo',
|
|
188
|
+
stringifyAndShrink(value[1]),
|
|
189
|
+
value[1]
|
|
190
|
+
)}
|
|
191
|
+
{renderDelta(value)}
|
|
192
|
+
</span>
|
|
193
|
+
);
|
|
194
|
+
case 3:
|
|
195
|
+
return (
|
|
196
|
+
<span {...styling('diffWrap')}>
|
|
197
|
+
{renderSpan('diffRemove', stringifyAndShrink(value[0]), value[0])}
|
|
198
|
+
</span>
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
return (
|
|
204
|
+
<span {...styling('diffWrap')}>
|
|
205
|
+
{renderSpan('unchanged', stringifyAndShrink(value), value)}
|
|
206
|
+
</span>
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
function prepareDelta(value) {
|
|
212
|
+
if (value && value._t === 'a') {
|
|
213
|
+
const res = {};
|
|
214
|
+
for (const key in value) {
|
|
215
|
+
if (key !== '_t') {
|
|
216
|
+
if (key[0] === '_' && !value[key.substr(1)]) {
|
|
217
|
+
res[key.substr(1)] = value[key];
|
|
218
|
+
} else if (value['_' + key]) {
|
|
219
|
+
res[key] = [value['_' + key][0], value[key][0]];
|
|
220
|
+
} else if (!value['_' + key] && key[0] !== '_') {
|
|
221
|
+
res[key] = value[key];
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return res;
|
|
226
|
+
}
|
|
227
|
+
return value;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
const theme = {
|
|
231
|
+
scheme: 'monokai',
|
|
232
|
+
base00: '#272822',
|
|
233
|
+
base01: '#383830',
|
|
234
|
+
base02: '#49483e',
|
|
235
|
+
base03: '#75715e',
|
|
236
|
+
base04: '#a59f85',
|
|
237
|
+
base05: '#f8f8f2',
|
|
238
|
+
base06: '#f5f4f1',
|
|
239
|
+
base07: '#f9f8f5',
|
|
240
|
+
base08: '#f92672',
|
|
241
|
+
base09: '#fd971f',
|
|
242
|
+
base0A: '#f4bf75',
|
|
243
|
+
base0B: '#a6e22e',
|
|
244
|
+
base0C: '#a1efe4',
|
|
245
|
+
base0D: '#66d9ef',
|
|
246
|
+
base0E: '#ae81ff',
|
|
247
|
+
base0F: '#cc6633',
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
class App extends React.Component {
|
|
251
|
+
constructor(props) {
|
|
252
|
+
super(props);
|
|
253
|
+
this.state = { showUnchanged: false, partial: null };
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
toggle = (e) => {
|
|
257
|
+
this.setState(state => {
|
|
258
|
+
return { ...state, showUnchanged: !state.showUnchanged }
|
|
259
|
+
})
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
viewPartial = (value) => {
|
|
263
|
+
this.setState(state => {
|
|
264
|
+
return { ...state, partial: _.isEqual(state.partial, value) ? null : value }
|
|
265
|
+
})
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
render() {
|
|
269
|
+
return (
|
|
270
|
+
<div>
|
|
271
|
+
<div style={{ display: 'flex', flexDirection: 'row' }}>
|
|
272
|
+
<div style={{ flex: 1, padding: '0 10px', overflow: 'hidden', overflowY: 'scroll', height: '100vh' }}>
|
|
273
|
+
<input type="checkbox" onChange={this.toggle} id="show_unchanged" />
|
|
274
|
+
<label for="show_unchanged" style={{ fontSize: '12px', color: 'white' }}>Show Unchanged</label>
|
|
275
|
+
<ReactJsonTree.JSONTree
|
|
276
|
+
theme={theme}
|
|
277
|
+
invertTheme={false}
|
|
278
|
+
data={this.state.showUnchanged ? _.merge(_.cloneDeep(left), delta) : delta}
|
|
279
|
+
valueRenderer={valueRenderer(this.viewPartial)}
|
|
280
|
+
postprocessValue={prepareDelta}
|
|
281
|
+
isCustomNode={Array.isArray}
|
|
282
|
+
shouldExpandNodeInitially={expandFirstLevel}
|
|
283
|
+
hideRoot
|
|
284
|
+
/>
|
|
285
|
+
</div>
|
|
286
|
+
{this.state.partial ? <div style={{ flex: 1, padding: '0 10px', overflow: 'hidden', overflowY: 'scroll', height: '100vh' }}>
|
|
287
|
+
<ReactJsonTree.JSONTree
|
|
288
|
+
theme={theme}
|
|
289
|
+
invertTheme={false}
|
|
290
|
+
data={this.state.partial}
|
|
291
|
+
shouldExpandNodeInitially={() => true}
|
|
292
|
+
hideRoot
|
|
293
|
+
/>
|
|
294
|
+
</div> : null}
|
|
295
|
+
</div>
|
|
296
|
+
</div>
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
ReactDOM.createRoot(document.querySelector('#app')).render(<App />);
|
|
302
|
+
</script>
|
|
303
|
+
</body>
|
|
304
|
+
</html>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export declare const cli: (y:
|
|
1
|
+
import type { Argv } from 'yargs';
|
|
2
|
+
export declare const cli: (y: Argv) => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export declare const cli: (y:
|
|
1
|
+
import type { Argv } from 'yargs';
|
|
2
|
+
export declare const cli: (y: Argv) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Handlers } from '@acala-network/chopsticks-core';
|
|
2
|
-
import type
|
|
2
|
+
import type { Argv } from 'yargs';
|
|
3
3
|
export declare const pluginHandlers: Handlers;
|
|
4
|
-
export declare const pluginExtendCli: (y:
|
|
4
|
+
export declare const pluginExtendCli: (y: Argv) => Promise<void>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { HexString } from '@polkadot/util/types';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import type
|
|
4
|
-
import { Context } from '@acala-network/chopsticks-core';
|
|
5
|
-
export declare const cli: (y:
|
|
3
|
+
import type { Argv } from 'yargs';
|
|
4
|
+
import { Context, RuntimeLog } from '@acala-network/chopsticks-core';
|
|
5
|
+
export declare const cli: (y: Argv) => void;
|
|
6
6
|
declare const schema: z.ZodObject<{
|
|
7
7
|
includeRaw: z.ZodOptional<z.ZodBoolean>;
|
|
8
8
|
includeParsed: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -88,12 +88,17 @@ export interface RunBlockResponse {
|
|
|
88
88
|
/**
|
|
89
89
|
* Decoded storage diff. Only available when `includeParsed` is true.
|
|
90
90
|
*/
|
|
91
|
-
parsed?:
|
|
91
|
+
parsed?: {
|
|
92
|
+
method: string;
|
|
93
|
+
section: string;
|
|
94
|
+
key: any[];
|
|
95
|
+
value: any;
|
|
96
|
+
};
|
|
92
97
|
}[];
|
|
93
98
|
/**
|
|
94
99
|
* Runtime logs.
|
|
95
100
|
*/
|
|
96
|
-
logs?:
|
|
101
|
+
logs?: RuntimeLog[];
|
|
97
102
|
}[];
|
|
98
103
|
/**
|
|
99
104
|
* Block details. Only available when `includeBlockDetails` is true.
|
|
@@ -128,6 +133,7 @@ export declare const name = "runBlock";
|
|
|
128
133
|
* Run a set of extrinsics on top of a block and get the storage diff
|
|
129
134
|
* and optionally the parsed storage diff and block details.
|
|
130
135
|
* NOTE: The extrinsics should include inherents or tranasctions may have unexpected results.
|
|
136
|
+
* NOTE: system.events and system.extrinsicData are excluded from storage diff to reduce size.
|
|
131
137
|
*
|
|
132
138
|
* This function is a dev rpc handler. Use `dev_runBlock` as the method name when calling it.
|
|
133
139
|
*/
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export declare const cli: (y:
|
|
1
|
+
import type { Argv } from 'yargs';
|
|
2
|
+
export declare const cli: (y: Argv) => void;
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@acala-network/chopsticks",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1-2",
|
|
4
4
|
"author": "Acala Developers <hello@acala.network>",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"bin": "./chopsticks.js",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"clean": "rm -rf dist",
|
|
9
|
-
"build": "yarn clean && tsc -p ./tsconfig.json && tsc -p ./tsconfig.esm.json",
|
|
9
|
+
"build": "yarn clean && tsc -p ./tsconfig.json && tsc -p ./tsconfig.esm.json && echo '{\"type\": \"module\"}' > ./dist/esm/package.json && yarn copyfiles",
|
|
10
|
+
"copyfiles": "cp -r src/utils/template dist/cjs/utils/ && cp -r src/utils/template dist/esm/utils/",
|
|
10
11
|
"script:start": "cd ../..; ts-node --transpile-only -r tsconfig-paths/register packages/chopsticks/src/cli.ts",
|
|
11
12
|
"script:run": "cd ../..; LOG_LEVEL=trace ts-node-dev --transpile-only -r tsconfig-paths/register --inspect --notify=false packages/chopsticks/src/cli.ts -- --config=configs/dev.yml",
|
|
12
13
|
"dev:karura": "cd ../..; ts-node-dev --transpile-only --inspect -r tsconfig-paths/register --notify=false packages/chopsticks/src/cli.ts -- --config=configs/karura.yml",
|
|
@@ -17,10 +18,10 @@
|
|
|
17
18
|
"docs:prep": "typedoc"
|
|
18
19
|
},
|
|
19
20
|
"dependencies": {
|
|
20
|
-
"@acala-network/chopsticks-core": "0.9.
|
|
21
|
-
"@acala-network/chopsticks-db": "0.9.
|
|
21
|
+
"@acala-network/chopsticks-core": "0.9.1-2",
|
|
22
|
+
"@acala-network/chopsticks-db": "0.9.1-2",
|
|
22
23
|
"@pnpm/npm-conf": "^2.2.2",
|
|
23
|
-
"axios": "^1.
|
|
24
|
+
"axios": "^1.6.0",
|
|
24
25
|
"dotenv": "^16.3.1",
|
|
25
26
|
"global-agent": "^3.0.0",
|
|
26
27
|
"js-yaml": "^4.1.0",
|
|
@@ -36,7 +37,7 @@
|
|
|
36
37
|
"@types/lodash": "^4.14.199",
|
|
37
38
|
"@types/node": "^20.5.7",
|
|
38
39
|
"@types/ws": "^8.5.6",
|
|
39
|
-
"@types/yargs": "^17.0.
|
|
40
|
+
"@types/yargs": "^17.0.29",
|
|
40
41
|
"ts-node": "^10.9.1",
|
|
41
42
|
"ts-node-dev": "^2.0.0",
|
|
42
43
|
"typescript": "^5.1.6"
|
|
@@ -45,7 +46,6 @@
|
|
|
45
46
|
"dist/esm/**",
|
|
46
47
|
"dist/cjs/**",
|
|
47
48
|
"dist/types/**",
|
|
48
|
-
"template",
|
|
49
49
|
"chopsticks.js"
|
|
50
50
|
],
|
|
51
51
|
"main": "./dist/cjs/index.js",
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
"import": "./dist/esm/plugins/*.js",
|
|
71
71
|
"default": "./dist/esm/plugins/*.js"
|
|
72
72
|
},
|
|
73
|
-
"./package.json": "./package.json"
|
|
73
|
+
"./package.json": "./package.json",
|
|
74
|
+
"./package.esm.json": "./dist/esm/package.json"
|
|
74
75
|
}
|
|
75
76
|
}
|
|
File without changes
|