File tree Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -240,14 +240,18 @@ export function createMemoryStream(fn?: (chunk: Uint8Array | string) => void): M
240240/** Compatible TypeScript compiler options for syntax highlighting etc. */
241241export const tscOptions : Record < string , unknown > ;
242242
243- import { Program , Parser , Module } from "../src" ;
243+ import binaryen from "../lib/binaryen" ;
244+ import { Program , Parser } from "../src" ;
244245
245246/** Compiler transform base class. */
246247export abstract class Transform {
247248
248249 /** Program reference. */
249250 readonly program : Program ;
250251
252+ /** Binaryen reference. */
253+ readonly binaryen : typeof binaryen ;
254+
251255 /** Base directory. */
252256 readonly baseDir : string ;
253257
@@ -276,5 +280,5 @@ export abstract class Transform {
276280 afterInitialize ?( program : Program ) : void | Promise < void > ;
277281
278282 /** Called when compilation is complete, before the module is being validated. */
279- afterCompile ?( module : Module ) : void | Promise < void > ;
283+ afterCompile ?( module : binaryen . Module ) : void | Promise < void > ;
280284}
Original file line number Diff line number Diff line change @@ -450,6 +450,7 @@ export async function main(argv, options) {
450450 if ( typeof transform === "function" ) {
451451 Object . assign ( transform . prototype , {
452452 program,
453+ binaryen,
453454 baseDir,
454455 stdout,
455456 stderr,
Original file line number Diff line number Diff line change @@ -373,9 +373,13 @@ export function generateCli() {
373373 prefix,
374374 stdout,
375375 resolveModuleImport : ( { importedModuleId, currentModuleId } ) => {
376- return currentModuleId == "cli/index" && importedModuleId == "../src"
377- ? prefix + "/src/index"
378- : null ;
376+ if ( currentModuleId == "cli/index" && importedModuleId == "../src" )
377+ return prefix + "/src/index" ;
378+
379+ if ( importedModuleId == "binaryen" )
380+ return "binaryen" ;
381+
382+ return null ;
379383 } ,
380384 } ) ;
381385
You can’t perform that action at this time.
0 commit comments