MCPcopy Create free account
hub / github.com/alangpierce/sucrase / evaluateModule

Method evaluateModule

test/util.ts:85–98  ·  view source on GitHub ↗
(filename: string)

Source from the content-addressed store, hash-verified

83 constructor(readonly codeByFilename: {[filename: string]: string}) {}
84
85 evaluateModule(filename: string): unknown {
86 if (filename in this.moduleExportsCache) {
87 return this.moduleExportsCache[filename];
88 }
89 const exports = {};
90 this.moduleExportsCache[filename] = exports;
91 const code = this.codeByFilename[filename];
92 if (!code) {
93 throw new Error(`Did not find file ${filename}`);
94 }
95 const compiledCode = transform(code, {transforms: ["imports"]}).code;
96 vm.runInNewContext(compiledCode, {require: this.evaluateModule.bind(this), exports});
97 return exports;
98 }
99}

Callers 1

assertMultiFileOutputFunction · 0.80

Calls 1

transformFunction · 0.90

Tested by

no test coverage detected