1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 18:00:18 +01:00

fix sourcemap-validator.js warnings

This commit is contained in:
brunobar79 2018-07-02 18:56:51 -04:00
parent ffaca7971a
commit 42feca1f27

View File

@ -1,6 +1,6 @@
const fs = require('fs') const fs = require('fs')
const { SourceMapConsumer } = require('source-map') const { SourceMapConsumer } = require('source-map')
const path = require('path')
// //
// Utility to help check if sourcemaps are working // Utility to help check if sourcemaps are working
// //
@ -11,9 +11,11 @@ const { SourceMapConsumer } = require('source-map')
start() start()
async function start () { async function start () {
const rawBuild = fs.readFileSync(__dirname + '/../dist/chrome/inpage.js', 'utf8') const rawBuild = fs.readFileSync(path.join(__dirname, '/../dist/chrome/', 'inpage.js')
const rawSourceMap = fs.readFileSync(__dirname + '/../dist/sourcemaps/inpage.js.map', 'utf8') , 'utf8')
const rawSourceMap = fs.readFileSync(path.join(__dirname, '/../dist/sourcemaps/', 'inpage.js.map'), 'utf8')
const consumer = await new SourceMapConsumer(rawSourceMap) const consumer = await new SourceMapConsumer(rawSourceMap)
console.log('hasContentsOfAllSources:', consumer.hasContentsOfAllSources(), '\n') console.log('hasContentsOfAllSources:', consumer.hasContentsOfAllSources(), '\n')
@ -43,7 +45,8 @@ async function start () {
} }
function indicesOf (substring, string) { function indicesOf (substring, string) {
var a = [], i = -1 var a = []
var i = -1
while ((i = string.indexOf(substring, i + 1)) >= 0) a.push(i) while ((i = string.indexOf(substring, i + 1)) >= 0) a.push(i)
return a return a
} }