|
| 1 | +diff --git a/dist/typechain/io.js b/dist/typechain/io.js |
| 2 | +index 725231a5ab1d8cc5f68a39ba730dddccf6a30f32..cfe0150aa07d09a32dd01c0670edb48d3c3786ce 100644 |
| 3 | +--- a/dist/typechain/io.js |
| 4 | ++++ b/dist/typechain/io.js |
| 5 | +@@ -7,19 +7,25 @@ const path_1 = require("path"); |
| 6 | + const outputTransformers_1 = require("../codegen/outputTransformers"); |
| 7 | + const abiParser_1 = require("../parser/abiParser"); |
| 8 | + const debug_1 = require("../utils/debug"); |
| 9 | +-function processOutput(services, cfg, output) { |
| 10 | ++async function processOutput(services, cfg, output) { |
| 11 | + const { fs, mkdirp } = services; |
| 12 | + if (!output) { |
| 13 | + return 0; |
| 14 | + } |
| 15 | + const outputFds = (0, lodash_1.isArray)(output) ? output : [output]; |
| 16 | +- outputFds.forEach((fd) => { |
| 17 | ++ for (const fd of outputFds) { |
| 18 | + // ensure directory first |
| 19 | + mkdirp((0, path_1.dirname)(fd.path)); |
| 20 | +- const finalOutput = outputTransformers_1.outputTransformers.reduce((content, transformer) => transformer(content, services, cfg), fd.contents); |
| 21 | ++ let finalOutput = outputTransformers_1.outputTransformers.reduce((content, transformer) => transformer(content, services, cfg), fd.contents); |
| 22 | ++ |
| 23 | ++ // If finalOutput is a Promise, await it |
| 24 | ++ if (finalOutput && typeof finalOutput.then === 'function') { |
| 25 | ++ finalOutput = await finalOutput; |
| 26 | ++ } |
| 27 | ++ |
| 28 | + (0, debug_1.debug)(`Writing file: ${(0, path_1.relative)(cfg.cwd, fd.path)}`); |
| 29 | + fs.writeFileSync(fd.path, finalOutput, 'utf8'); |
| 30 | +- }); |
| 31 | ++ } |
| 32 | + return outputFds.length; |
| 33 | + } |
| 34 | + exports.processOutput = processOutput; |
| 35 | +diff --git a/dist/typechain/runTypeChain.js b/dist/typechain/runTypeChain.js |
| 36 | +index a5adce89148c1edd2bcdafe2d01d9a66ca2b57e4..b731c472b496c7639ffc531ffedd6b479b52d7f5 100644 |
| 37 | +--- a/dist/typechain/runTypeChain.js |
| 38 | ++++ b/dist/typechain/runTypeChain.js |
| 39 | +@@ -62,14 +62,14 @@ async function runTypeChain(publicConfig) { |
| 40 | + const target = (0, findTarget_1.findTarget)(config); |
| 41 | + const fileDescriptions = (0, io_1.loadFileDescriptions)(services, config.filesToProcess); |
| 42 | + (0, debug_1.debug)('Executing beforeRun()'); |
| 43 | +- filesGenerated += (0, io_1.processOutput)(services, config, await target.beforeRun()); |
| 44 | ++ filesGenerated += await (0, io_1.processOutput)(services, config, await target.beforeRun()); |
| 45 | + (0, debug_1.debug)('Executing beforeRun()'); |
| 46 | + for (const fd of fileDescriptions) { |
| 47 | + (0, debug_1.debug)(`Processing ${(0, path_1.relative)(config.cwd, fd.path)}`); |
| 48 | +- filesGenerated += (0, io_1.processOutput)(services, config, await target.transformFile(fd)); |
| 49 | ++ filesGenerated += await (0, io_1.processOutput)(services, config, await target.transformFile(fd)); |
| 50 | + } |
| 51 | + (0, debug_1.debug)('Running afterRun()'); |
| 52 | +- filesGenerated += (0, io_1.processOutput)(services, config, await target.afterRun()); |
| 53 | ++ filesGenerated += await (0, io_1.processOutput)(services, config, await target.afterRun()); |
| 54 | + return { |
| 55 | + filesGenerated, |
| 56 | + }; |
0 commit comments