diff --git a/apps/remix-ide/src/app/editor/contextView.js b/apps/remix-ide/src/app/editor/contextView.js index b94ec15245..141cc9e5a4 100644 --- a/apps/remix-ide/src/app/editor/contextView.js +++ b/apps/remix-ide/src/app/editor/contextView.js @@ -1,7 +1,6 @@ 'use strict' const yo = require('yo-yo') -const remixDebug = require('@remix-project/remix-debug') -const SourceMappingDecoder = remixDebug.SourceMappingDecoder +import { sourceMappingDecoder } from '@remix-project/remix-debug' const globalRegistry = require('../../global/registry') const css = require('./styles/contextView-styles') @@ -28,7 +27,7 @@ class ContextView { this._view = null this._nodes = null this._current = null - this.sourceMappingDecoder = SourceMappingDecoder + this.sourceMappingDecoder = sourceMappingDecoder this.previousElement = null this.contextualListener.event.register('contextChanged', nodes => { this.show() diff --git a/apps/remix-ide/src/app/editor/contextualListener.js b/apps/remix-ide/src/app/editor/contextualListener.js index 8d4957bdcb..d7b829a4c8 100644 --- a/apps/remix-ide/src/app/editor/contextualListener.js +++ b/apps/remix-ide/src/app/editor/contextualListener.js @@ -2,10 +2,9 @@ import { Plugin } from '@remixproject/engine' import * as packageJson from '../../../../../package.json' -const remixdebug = require('@remix-project/remix-debug') +import { sourceMappingDecoder } from '@remix-project/remix-debug' const { AstWalker } = require('@remix-project/remix-astwalker') const csjs = require('csjs-inject') -const SourceMappingDecoder = remixdebug.SourceMappingDecoder const EventManager = require('../../lib/events') const globalRegistry = require('../../global/registry') @@ -39,7 +38,7 @@ class ContextualListener extends Plugin { this._activeHighlights = [] this.editor.event.register('contentChanged', () => { this._stopHighlighting() }) - this.sourceMappingDecoder = SourceMappingDecoder + this.sourceMappingDecoder = sourceMappingDecoder this.astWalker = new AstWalker() } diff --git a/apps/remix-ide/src/lib/offsetToLineColumnConverter.js b/apps/remix-ide/src/lib/offsetToLineColumnConverter.js index edd2ec38ed..07f0de0ec0 100644 --- a/apps/remix-ide/src/lib/offsetToLineColumnConverter.js +++ b/apps/remix-ide/src/lib/offsetToLineColumnConverter.js @@ -1,7 +1,7 @@ 'use strict' import { Plugin } from '@remixproject/engine' import * as packageJson from '../../../../package.json' -var SourceMappingDecoder = require('@remix-project/remix-debug').SourceMappingDecoder +import { sourceMappingDecoder } from '@remix-project/remix-debug' const profile = { name: 'offsetToLineColumnConverter', @@ -14,7 +14,7 @@ export class OffsetToLineColumnConverter extends Plugin { constructor () { super(profile) this.lineBreakPositionsByContent = {} - this.sourceMappingDecoder = SourceMappingDecoder + this.sourceMappingDecoder = sourceMappingDecoder } /** diff --git a/libs/remix-debug/src/index.ts b/libs/remix-debug/src/index.ts index 50222e97cc..5814cee391 100644 --- a/libs/remix-debug/src/index.ts +++ b/libs/remix-debug/src/index.ts @@ -7,7 +7,7 @@ import { StorageViewer } from './storage/storageViewer' import { StorageResolver } from './storage/storageResolver' import * as SolidityDecoder from './solidity-decoder' import { BreakpointManager } from './code/breakpointManager' -import * as SourceMappingDecoder from './source/sourceMappingDecoder' +import * as sourceMappingDecoder from './source/sourceMappingDecoder' import * as traceHelper from './trace/traceHelper' /* @@ -21,7 +21,7 @@ import * as traceHelper from './trace/traceHelper' export = { init, traceHelper, - SourceMappingDecoder, + sourceMappingDecoder, EthDebugger, TransactionDebugger, /** diff --git a/libs/remix-debug/test/sourceMappingDecoder.ts b/libs/remix-debug/test/sourceMappingDecoder.ts index 6ae1853406..c114acf03c 100644 --- a/libs/remix-debug/test/sourceMappingDecoder.ts +++ b/libs/remix-debug/test/sourceMappingDecoder.ts @@ -5,11 +5,10 @@ import * as sourceMappingDecoder from '../src/source/sourceMappingDecoder' const compiler = require('solc') const compilerInput = require('./helpers/compilerHelper').compilerInput -tape('SourceMappingDecoder', function (t) { - t.test('SourceMappingDecoder.findNodeAtInstructionIndex', function (st) { +tape('sourceMappingDecoder', function (t) { + t.test('sourceMappingDecoder.findNodeAtInstructionIndex', function (st) { let output = compiler.compile(compilerInput(contracts)) output = JSON.parse(output) - // const sourceMappingDecoder = new SourceMappingDecoder() let node = sourceMappingDecoder.findNodeAtInstructionIndex('FunctionDefinition', 2, output.contracts['test.sol']['test'].evm.deployedBytecode.sourceMap, output.sources['test.sol']) st.equal(node, null) node = sourceMappingDecoder.findNodeAtInstructionIndex('FunctionDefinition', 80, output.contracts['test.sol']['test'].evm.deployedBytecode.sourceMap, output.sources['test.sol']) @@ -23,7 +22,6 @@ tape('SourceMappingDecoder', function (t) { const testSourceMapping = {} t.test('sourceMappingDecoder', function (st) { st.plan(36) - // const sourceMappingDecoder = new SourceMappingDecoder() console.log('test decompressAll') let result = sourceMappingDecoder.decompressAll(sourceMapping.mapping) st.equal(result[0].start, 0)