@cara/porter
Advanced tools
Comparing version 4.0.0-beta.6 to 4.0.0-beta.7
{ | ||
"name": "@cara/porter", | ||
"description": "A middleware for web modules", | ||
"version": "4.0.0-beta.6", | ||
"version": "4.0.0-beta.7", | ||
"main": "src/porter.js", | ||
@@ -43,3 +43,3 @@ "repository": { | ||
"license": "BSD-3-Clause", | ||
"gitHead": "e5815618905195210146043f672d2f98fa9fdd50" | ||
"gitHead": "8fc85c1176a231be3dbd7f192c42348987572011" | ||
} |
@@ -68,3 +68,3 @@ 'use strict'; | ||
map = JSON.parse(result.map); | ||
map.sourceRoot = app.source.root; | ||
map.sourceRoot = '/'; | ||
map.sources = map.sources.map(source => { | ||
@@ -71,0 +71,0 @@ return path.relative(app.root, source.replace(/^file:/, '')); |
@@ -13,2 +13,3 @@ 'use strict'; | ||
const fileName = path.relative(packet.app.root, fpath); | ||
const tsconfig = packet.transpiler === 'typescript' | ||
@@ -18,9 +19,14 @@ ? packet.transpilerOpts | ||
// - https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-simple-transform-function | ||
const { compilerOptions } = tsconfig; | ||
const { outputText, diagnostics, sourceMapText } = ts.transpileModule(code, { | ||
fileName, | ||
compilerOptions: { | ||
...compilerOptions, | ||
module: ts.ModuleKind.CommonJS, | ||
sourceRoot: '/', | ||
sourceMap: true, | ||
} | ||
// ts.transpileModule() needs source map not being inlined | ||
inlineSourceMap: false, | ||
}, | ||
}); | ||
@@ -30,7 +36,5 @@ let map; | ||
if (sourceMapText) { | ||
const source = path.relative(packet.app.root, fpath); | ||
map = JSON.parse(sourceMapText); | ||
map.sources = [ source ]; | ||
map.file = source; | ||
map.sourceRoot = '/'; | ||
map.sources = [ fileName ]; | ||
map.file = fileName; | ||
} | ||
@@ -37,0 +41,0 @@ |
108928
2864