-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # package.json # yarn.lock
- Loading branch information
Showing
325 changed files
with
6,347 additions
and
2,785 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,12 @@ | ||
{ | ||
"presets": [ | ||
"env", | ||
"react" | ||
"@babel/preset-env", | ||
"@babel/preset-react", | ||
"@babel/preset-flow" | ||
], | ||
"plugins": [ | ||
"transform-object-rest-spread", | ||
"transform-class-properties", | ||
"transform-runtime" | ||
], | ||
"env": { | ||
"test": { | ||
"presets": [ | ||
"es2015", | ||
"./babel" | ||
] | ||
} | ||
} | ||
"@babel/plugin-proposal-object-rest-spread", | ||
"@babel/plugin-proposal-class-properties", | ||
"@babel/plugin-transform-runtime" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[ignore] | ||
<PROJECT_ROOT>/examples/.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('./dist/lib/app') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// @flow | ||
import fetch from 'unfetch' | ||
const filenameRE = /\(([^)]+\.js):(\d+):(\d+)\)$/ | ||
|
||
export async function applySourcemaps (e: any): Promise<void> { | ||
if (!e || typeof e.stack !== 'string' || e.sourceMapsApplied) { | ||
return | ||
} | ||
|
||
const lines = e.stack.split('\n') | ||
|
||
const result = await Promise.all(lines.map((line) => { | ||
return rewriteTraceLine(line) | ||
})) | ||
|
||
e.stack = result.join('\n') | ||
// This is to make sure we don't apply the sourcemaps twice on the same object | ||
e.sourceMapsApplied = true | ||
} | ||
|
||
async function rewriteTraceLine (trace: string): Promise<string> { | ||
const m = trace.match(filenameRE) | ||
if (m == null) { | ||
return trace | ||
} | ||
|
||
const filePath = m[1] | ||
if (filePath.match(/node_modules/)) { | ||
return trace | ||
} | ||
|
||
const mapPath = `${filePath}.map` | ||
|
||
const res = await fetch(mapPath) | ||
if (res.status !== 200) { | ||
return trace | ||
} | ||
|
||
const mapContents = await res.json() | ||
const {SourceMapConsumer} = require('source-map') | ||
const map = new SourceMapConsumer(mapContents) | ||
const originalPosition = map.originalPositionFor({ | ||
line: Number(m[2]), | ||
column: Number(m[3]) | ||
}) | ||
|
||
if (originalPosition.source != null) { | ||
const { source, line, column } = originalPosition | ||
const mappedPosition = `(${source.replace(/^webpack:\/\/\//, '')}:${String(line)}:${String(column)})` | ||
return trace.replace(filenameRE, mappedPosition) | ||
} | ||
|
||
return trace | ||
} |
Oops, something went wrong.