fib-typify
Advanced tools
Comparing version
@@ -65,3 +65,4 @@ const fs = require('fs') | ||
const SOURCEMAP_RUNTIME_SCRIPT = path.resolve(__dirname, './runtime/source-map-install.js') | ||
const SOURCEMAP_RUNTIME_SCRIPT = path.resolve(__dirname, './runtime/source-map-install.js'); | ||
const LINE_MARKER = '//# sourceMappingURL='; | ||
@@ -79,3 +80,4 @@ | ||
stream.rewind(); | ||
fs.setZipFS(`${filename}.zip`, stream.readAll()); | ||
const buf = stream.readAll(); | ||
fs.setZipFS(`${filename}.zip`, buf); | ||
} | ||
@@ -90,4 +92,5 @@ | ||
if (useSourceMap) | ||
if (useSourceMap) { | ||
sandbox.require(SOURCEMAP_RUNTIME_SCRIPT, __dirname) | ||
} | ||
@@ -100,3 +103,3 @@ ;[ | ||
const compiledModule = compileCallback(buf, args, { | ||
compilerOptions: {...tsCompilerOptions, sourceMap: false, inlineSourceMap: true } | ||
compilerOptions: { ...tsCompilerOptions, sourceMap: false, inlineSourceMap: true } | ||
}) | ||
@@ -108,3 +111,3 @@ | ||
) | ||
saveCacheMap(args.filename, LINE_MARKER + sourceMapDataURL) | ||
saveCacheMap(args.filename, sourceMapDataURL) | ||
} | ||
@@ -119,3 +122,3 @@ | ||
if (typeof tsRaw !== 'string') | ||
throw 'tsRaw must be string!' | ||
throw new Error('[fixTsRaw] tsRaw must be string!'); | ||
@@ -138,14 +141,14 @@ if (tsRaw.length > 2 && tsRaw.indexOf('#!') === 0) { | ||
*/ | ||
function compileCallback (buf, args, moduleOptions) { | ||
function compileCallback(buf, args, moduleOptions) { | ||
let tsScriptString = buf + '' | ||
if (!tsScriptString) return undefined | ||
if (!tsScriptString) return undefined | ||
const compiledModule = compileModule(tsScriptString, { | ||
...moduleOptions, | ||
fileName: args.filename, | ||
moduleName: args.filename | ||
}) | ||
return compiledModule | ||
} | ||
const compiledModule = compileModule(tsScriptString, { | ||
...moduleOptions, | ||
fileName: args.filename, | ||
moduleName: args.filename | ||
}) | ||
return compiledModule | ||
} | ||
@@ -152,0 +155,0 @@ exports.replaceSuffix = function (target = '', { |
{ | ||
"name": "fib-typify", | ||
"version": "0.11.4", | ||
"version": "0.11.5", | ||
"description": "just write fibjs with typescript : )", | ||
@@ -5,0 +5,0 @@ "main": "./lib", |
1758
0.11%115366
-0.12%