File tree 3 files changed +14
-5
lines changed
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
240
240
/** Compatible TypeScript compiler options for syntax highlighting etc. */
241
241
export const tscOptions : Record < string , unknown > ;
242
242
243
- import { Program , Parser , Module } from "../src" ;
243
+ import binaryen from "../lib/binaryen" ;
244
+ import { Program , Parser } from "../src" ;
244
245
245
246
/** Compiler transform base class. */
246
247
export abstract class Transform {
247
248
248
249
/** Program reference. */
249
250
readonly program : Program ;
250
251
252
+ /** Binaryen reference. */
253
+ readonly binaryen : typeof binaryen ;
254
+
251
255
/** Base directory. */
252
256
readonly baseDir : string ;
253
257
@@ -276,5 +280,5 @@ export abstract class Transform {
276
280
afterInitialize ?( program : Program ) : void | Promise < void > ;
277
281
278
282
/** 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 > ;
280
284
}
Original file line number Diff line number Diff line change @@ -450,6 +450,7 @@ export async function main(argv, options) {
450
450
if ( typeof transform === "function" ) {
451
451
Object . assign ( transform . prototype , {
452
452
program,
453
+ binaryen,
453
454
baseDir,
454
455
stdout,
455
456
stderr,
Original file line number Diff line number Diff line change @@ -373,9 +373,13 @@ export function generateCli() {
373
373
prefix,
374
374
stdout,
375
375
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 ;
379
383
} ,
380
384
} ) ;
381
385
You can’t perform that action at this time.
0 commit comments