fix: readSourceMap split error

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
MiaoWoo 2020-07-26 21:33:58 +08:00
parent 9367e8c2c9
commit e3bceda06b
2 changed files with 15 additions and 11 deletions

View File

@ -97,10 +97,11 @@ export class MiaoScriptConsole implements Console {
MiaoScriptConsole.sourceMaps[fileName] = null
let sourceLine = base.read(fileName).split('\n')
let lastLine = sourceLine[sourceLine.length - 1]
// lastLine is similar //# sourceMappingURL=data:application/json;base64,
if (lastLine.startsWith('//# sourceMappingURL=')) {
let sourceContent = null
let sourceMappingURL = lastLine.split('sourceMappingURL=', 2)[1]
if (sourceMappingURL.startsWith('data:application/jsonbase64,')) {
if (sourceMappingURL.startsWith('data:application/json;base64,')) {
sourceContent = String.fromCharCode(...Array.from(base64.toByteArray(sourceMappingURL.split(',', 2)[1])))
} else if (sourceMappingURL.startsWith('http')) {
// TODO
@ -122,6 +123,9 @@ export class MiaoScriptConsole implements Console {
}
} catch (error) {
console.debug('search source map', fileName, 'line', lineNumber, 'error:', error)
if (global.debug) {
console.ex(error)
}
}
return {
fileName,

View File

@ -504,22 +504,22 @@ export enum QRErrorCorrectLevel {
// QRMaskPattern
//---------------------------------------------------------------------
var QRMaskPattern = {
PATTERN000: 0,
PATTERN001: 1,
PATTERN010: 2,
PATTERN011: 3,
PATTERN100: 4,
PATTERN101: 5,
PATTERN110: 6,
PATTERN111: 7
export enum QRMaskPattern {
PATTERN000 = 0,
PATTERN001 = 1,
PATTERN010 = 2,
PATTERN011 = 3,
PATTERN100 = 4,
PATTERN101 = 5,
PATTERN110 = 6,
PATTERN111 = 7
}
//---------------------------------------------------------------------
// QRUtil
//---------------------------------------------------------------------
var QRUtil = {
export const QRUtil = {
PATTERN_POSITION_TABLE: [
[],