From abab464e146e383f269e95636c4dba504a726f28 Mon Sep 17 00:00:00 2001 From: Kosala Hemachandra <10602065+kvhnuke@users.noreply.github.com> Date: Tue, 8 Feb 2022 11:38:06 -0800 Subject: [PATCH 001/217] revert and add only changed files --- .../workspace/src/lib/actions/workspace.ts | 49 ++++++++++++------- .../remix-ui/workspace/src/lib/types/index.ts | 11 ++++- 2 files changed, 40 insertions(+), 20 deletions(-) diff --git a/libs/remix-ui/workspace/src/lib/actions/workspace.ts b/libs/remix-ui/workspace/src/lib/actions/workspace.ts index 3dd6b16bbb..f2221a7e17 100644 --- a/libs/remix-ui/workspace/src/lib/actions/workspace.ts +++ b/libs/remix-ui/workspace/src/lib/actions/workspace.ts @@ -3,7 +3,7 @@ import { bufferToHex, keccakFromString } from 'ethereumjs-util' import axios, { AxiosResponse } from 'axios' import { addInputFieldSuccess, createWorkspaceError, createWorkspaceRequest, createWorkspaceSuccess, displayNotification, fetchWorkspaceDirectoryError, fetchWorkspaceDirectoryRequest, fetchWorkspaceDirectorySuccess, hideNotification, setCurrentWorkspace, setDeleteWorkspace, setMode, setReadOnlyMode, setRenameWorkspace } from './payload' import { checkSlash, checkSpecialChars } from '@remix-ui/helper' - +import { JSONStandardInput } from '../types' const examples = require('../../../../../../apps/remix-ide/src/app/editor/examples') const QueryParams = require('../../../../../../apps/remix-ide/src/lib/query-params') @@ -75,29 +75,40 @@ export const loadWorkspacePreset = async (template: 'gist-template' | 'code-temp switch (template) { case 'code-template': - // creates a new workspace code-sample and loads code from url params. - try { - let path = ''; let content = '' - - if (params.code) { - const hash = bufferToHex(keccakFromString(params.code)) + // creates a new workspace code-sample and loads code from url params. + try { + let path = ''; let content = '' - path = 'contract-' + hash.replace('0x', '').substring(0, 10) + '.sol' - content = atob(params.code) - workspaceProvider.set(path, content) - } - if (params.url) { - const data = await plugin.call('contentImport', 'resolve', params.url) + if (params.code) { + const hash = bufferToHex(keccakFromString(params.code)) - path = data.cleanUrl - content = data.content + path = 'contract-' + hash.replace('0x', '').substring(0, 10) + '.sol' + content = atob(params.code) + workspaceProvider.set(path, content) + } + if (params.url) { + const data = await plugin.call('contentImport', 'resolve', params.url) + + path = data.cleanUrl + content = data.content + if (typeof content === 'object') { + const standardInput = content as JSONStandardInput + if (standardInput.language && standardInput.language === "Solidity" && standardInput.sources) { + const obj = standardInput.sources as any + for (let [fname, source] of Object.entries(standardInput.sources)) { + await workspaceProvider.set(fname, source.content) + } + } + return Object.keys(standardInput.sources)[0] + } else { workspaceProvider.set(path, content) } - return path - } catch (e) { - console.error(e) } - break + return path + } catch (e) { + console.error(e) + } + break case 'gist-template': // creates a new workspace gist-sample and get the file from gist diff --git a/libs/remix-ui/workspace/src/lib/types/index.ts b/libs/remix-ui/workspace/src/lib/types/index.ts index bf4b24d661..d7ce409d72 100644 --- a/libs/remix-ui/workspace/src/lib/types/index.ts +++ b/libs/remix-ui/workspace/src/lib/types/index.ts @@ -2,7 +2,16 @@ import React from 'react' import { customAction } from '@remixproject/plugin-api/lib/file-system/file-panel' export type action = { name: string, type?: Array<'folder' | 'gist' | 'file'>, path?: string[], extension?: string[], pattern?: string[], id: string, multiselect: boolean, label: string, sticky?: boolean } - +export interface JSONStandardInput { + language: "Solidity"; + settings?: any, + sources: { + [globalName: string]: { + keccak256?: string; + content: string; + }, + }; +} export type MenuItems = action[] export interface WorkspaceProps { plugin: { From f706ad00ebd4e38a5205f8381db0a7950d00b135 Mon Sep 17 00:00:00 2001 From: David Disu Date: Thu, 10 Feb 2022 12:18:13 +0100 Subject: [PATCH 002/217] Show create icon when all workspaces are deleted --- libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index ceb6899c9b..a51224f86c 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -127,7 +127,7 @@ export function Workspace () { ) + +export const storageFullMessage = () => ( +
+ + + Cannot save this file due full LocalStorage. Backup existing files and free up some space. + +
+) From 4f2153f616ae3bfe2e23a05b606d9f8f28ef7a58 Mon Sep 17 00:00:00 2001 From: David Disu Date: Mon, 14 Feb 2022 11:17:35 +0100 Subject: [PATCH 031/217] Update toaster message --- libs/remix-ui/helper/src/lib/helper-components.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-ui/helper/src/lib/helper-components.tsx b/libs/remix-ui/helper/src/lib/helper-components.tsx index 67ff3cae03..a71950315e 100644 --- a/libs/remix-ui/helper/src/lib/helper-components.tsx +++ b/libs/remix-ui/helper/src/lib/helper-components.tsx @@ -74,7 +74,7 @@ export const storageFullMessage = () => (
- Cannot save this file due full LocalStorage. Backup existing files and free up some space. + Cannot save this file due to full LocalStorage. Backup existing files and free up some space.
) From 96a694f971d3ee7fbcca367e999e27435f4c2a7d Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 17 Dec 2021 11:15:23 +0100 Subject: [PATCH 032/217] add editor stress e2e --- apps/remix-ide-e2e/src/tests/stress.editor.ts | 195 ++++++++++++++++++ package.json | 1 + 2 files changed, 196 insertions(+) create mode 100644 apps/remix-ide-e2e/src/tests/stress.editor.ts diff --git a/apps/remix-ide-e2e/src/tests/stress.editor.ts b/apps/remix-ide-e2e/src/tests/stress.editor.ts new file mode 100644 index 0000000000..57a047da8f --- /dev/null +++ b/apps/remix-ide-e2e/src/tests/stress.editor.ts @@ -0,0 +1,195 @@ +'use strict' + +import { NightwatchBrowser } from 'nightwatch' +import init from '../helpers/init' + +module.exports = { + + before: function (browser: NightwatchBrowser, done: VoidFunction) { + init(browser, done) + }, + + 'Should create 10 files, reload, and check if the files are saved': function (browser: NightwatchBrowser) { + const contents = {} + const checkContent = function (i, done) { + const name = 'test_' + i + '.sol' + browser + .openFile(name) + .pause(500) + .getEditorValue((content) => { + browser.assert.ok(content === contents[i]) + done() + }) + } + browser.clickLaunchIcon('filePanel').perform((done) => { + let contentEditSet = content.slice() + for (let i = 0; i < 10; i++) { + contentEditSet += contentEditSet + contents[i] = contentEditSet + const name = 'test_' + i + '.sol' + browser.click('[data-id="fileExplorerNewFilecreateNewFile"]') + .waitForElementContainsText('*[data-id$="/blank"]', '', 60000) + .sendKeys('*[data-id$="/blank"] .remixui_items', name) + .sendKeys('*[data-id$="/blank"] .remixui_items', browser.Keys.ENTER) + .waitForElementVisible(`li[data-id="treeViewLitreeViewItem${name}"]`, 60000) + .setEditorValue(contentEditSet) + } + done() + }).pause(10000).refresh() + .perform(done => checkContent(0, done)) + .perform(done => checkContent(1, done)) + .perform(done => checkContent(2, done)) + .perform(done => checkContent(3, done)) + .perform(done => checkContent(4, done)) + .perform(done => checkContent(5, done)) + .perform(done => checkContent(6, done)) + .perform(done => checkContent(7, done)) + .perform(done => checkContent(8, done)) + .perform(done => checkContent(9, done)) + .end() + } +} + +const content: string = ` +// SPDX-License-Identifier: GPL-3.0 + +pragma solidity >=0.7.0 <0.9.0; + +/** + * @title Ballot + * @dev Implements voting process along with vote delegation| + */ +contract Ballot { + + struct Voter { + uint weight; // weight is accumulated by delegation + bool voted; // if true, that person already voted + address delegate; // person delegated to + uint vote; // index of the voted proposal + } + + struct Proposal { + // If you can limit the length to a certain number of bytes, + // always use one of bytes1 to bytes32 because they are much cheaper + bytes32 name; // short name (up to 32 bytes) + uint voteCount; // number of accumulated votes + } + + address public chairperson; + + mapping(address => Voter) public voters; + + Proposal[] public proposals; + +function () test { + + /** + * @dev Create a new ballot to choose one of 'proposalNames'. + * @param proposalNames names of proposals + */ + constructor(bytes32[] memory proposalNames) { + chairperson = msg.sender; + voters[chairperson].weight = 1; + + for (uint i = 0; i < proposalNames.length; i++) { + // 'Proposal({...})' creates a temporary + // Proposal object and 'proposals.push(...)' + // appends it to the end of 'proposals'. + proposals.push(Proposal({ + name: proposalNames[i], + voteCount: 0 + })); + } + } + + /** + * @dev Give 'voter' the right to vote on this ballot. May only be called by 'chairperson'. + * @param voter address of voter + */ + function giveRightToVote(address voter) public { + require( + msg.sender == chairperson, + "Only chairperson can give right to vote." + ); + require( + !voters[voter].voted, + "The voter already voted." + ); + require(voters[voter].weight == 0); + voters[voter].weight = 1; + } + + /** + * @dev Delegate your vote to the voter 'to'. + * @param to address to which vote is delegated + */ + function delegate(address to) public { + Voter storage sender = voters[msg.sender]; + require(!sender.voted, "You already voted."); + require(to != msg.sender, "Self-delegation is disallowed."); + + while (voters[to].delegate != address(0)) { + to = voters[to].delegate; + + // We found a loop in the delegation, not allowed. + require(to != msg.sender, "Found loop in delegation."); + } + sender.voted = true; + sender.delegate = to; + Voter storage delegate_ = voters[to]; + if (delegate_.voted) { + // If the delegate already voted, + // directly add to the number of votes + proposals[delegate_.vote].voteCount += sender.weight; + } else { + // If the delegate did not vote yet, + // add to her weight. + delegate_.weight += sender.weight; + } + } + + /** + * @dev Give your vote (including votes delegated to you) to proposal 'proposals[proposal].name'. + * @param proposal index of proposal in the proposals array + */ + function vote(uint proposal) public { + Voter storage sender = voters[msg.sender]; + require(sender.weight != 0, "Has no right to vote"); + require(!sender.voted, "Already voted."); + sender.voted = true; + sender.vote = proposal; + + // If 'proposal' is out of the range of the array, + // this will throw automatically and revert all + // changes. + proposals[proposal].voteCount += sender.weight; + } + + /** + * @dev Computes the winning proposal taking all previous votes into account. + * @return winningProposal_ index of winning proposal in the proposals array + */ + function winningProposal() public view + returns (uint winningProposal_) + { + uint winningVoteCount = 0; + for (uint p = 0; p < proposals.length; p++) { + if (proposals[p].voteCount > winningVoteCount) { + winningVoteCount = proposals[p].voteCount; + winningProposal_ = p; + } + } + } + + /** + * @dev Calls winningProposal() function to get the index of the winner contained in the proposals array and then + * @return winnerName_ the name of the winner + */ + function winnerName() public view + returns (bytes32 winnerName_) + { + winnerName_ = proposals[winningProposal()].name; + } +} + +` diff --git a/package.json b/package.json index dc47278bd3..b37e2a9cb8 100644 --- a/package.json +++ b/package.json @@ -96,6 +96,7 @@ "nightwatch_local_verticalIconscontextmenu": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/verticalIconsPanel.test.js --env=chrome", "nightwatch_local_pluginApi": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/plugin_api_*.js --env=chrome", "nightwatch_local_migrate_filesystem": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/migrateFileSystem.test.js --env=chrome", + "nightwatch_local_stress_editor": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/stress.editor.js --env=chromeDesktop", "onchange": "onchange apps/remix-ide/build/app.js -- npm-run-all lint", "remixd": "nx build remixd && chmod +x dist/libs/remixd/src/bin/remixd.js && dist/libs/remixd/src/bin/remixd.js -s ./apps/remix-ide/contracts --remix-ide http://127.0.0.1:8080", "selenium": "selenium-standalone start", From a3baa31654205f94c15b81a49675133dcd4de449 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 16 Feb 2022 14:03:47 +0100 Subject: [PATCH 033/217] fix linting --- apps/remix-ide-e2e/src/tests/stress.editor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/tests/stress.editor.ts b/apps/remix-ide-e2e/src/tests/stress.editor.ts index 57a047da8f..ddb007b12a 100644 --- a/apps/remix-ide-e2e/src/tests/stress.editor.ts +++ b/apps/remix-ide-e2e/src/tests/stress.editor.ts @@ -50,7 +50,7 @@ module.exports = { } } -const content: string = ` +const content = ` // SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.7.0 <0.9.0; From 61304156b9b1b1f5005107adfaa3bf8b6d888c5a Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Fri, 11 Feb 2022 18:45:58 +0530 Subject: [PATCH 034/217] Run with mocha option in context menu --- apps/remix-ide/src/remixAppManager.js | 1 + libs/remix-ui/workspace/src/lib/actions/index.ts | 11 +++++++++++ .../src/lib/components/file-explorer-context-menu.tsx | 6 +++++- .../workspace/src/lib/components/file-explorer.tsx | 9 +++++++++ libs/remix-ui/workspace/src/lib/contexts/index.ts | 1 + .../src/lib/providers/FileSystemProvider.tsx | 7 ++++++- .../remix-ui/workspace/src/lib/remix-ui-workspace.tsx | 2 ++ libs/remix-ui/workspace/src/lib/types/index.ts | 2 ++ libs/remix-ui/workspace/src/lib/utils/index.ts | 6 ++++++ 9 files changed, 43 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide/src/remixAppManager.js b/apps/remix-ide/src/remixAppManager.js index ce7ea97b27..24814eb43d 100644 --- a/apps/remix-ide/src/remixAppManager.js +++ b/apps/remix-ide/src/remixAppManager.js @@ -114,6 +114,7 @@ export class RemixAppManager extends PluginManager { const res = await fetch(this.pluginsDirectory) plugins = await res.json() plugins = plugins.filter((plugin) => { + if (plugin.name === 'scriptRunner') plugin.url = 'http://127.0.0.1:8081' if (plugin.targets && Array.isArray(plugin.targets) && plugin.targets.length > 0) { return (plugin.targets.includes('remix')) } diff --git a/libs/remix-ui/workspace/src/lib/actions/index.ts b/libs/remix-ui/workspace/src/lib/actions/index.ts index ae248d6fa8..12f178348c 100644 --- a/libs/remix-ui/workspace/src/lib/actions/index.ts +++ b/libs/remix-ui/workspace/src/lib/actions/index.ts @@ -256,6 +256,17 @@ export const runScript = async (path: string) => { }) } +export const runScriptWithMocha = async (path: string) => { + const provider = plugin.fileManager.currentFileProvider() + provider.get(path, (error, content: string) => { + if (error) { + return dispatch(displayPopUp(error)) + } + if (content) content = content + '\n' + 'mocha.run()' + plugin.call('scriptRunner', 'execute', content) + }) +} + export const emitContextMenuEvent = async (cmd: customAction) => { await plugin.call(cmd.id, cmd.name, cmd) } diff --git a/libs/remix-ui/workspace/src/lib/components/file-explorer-context-menu.tsx b/libs/remix-ui/workspace/src/lib/components/file-explorer-context-menu.tsx index 5e6518c2de..b9bad4b170 100644 --- a/libs/remix-ui/workspace/src/lib/components/file-explorer-context-menu.tsx +++ b/libs/remix-ui/workspace/src/lib/components/file-explorer-context-menu.tsx @@ -12,7 +12,7 @@ declare global { const _paq = window._paq = window._paq || [] //eslint-disable-line export const FileExplorerContextMenu = (props: FileExplorerContextMenuProps) => { - const { actions, createNewFile, createNewFolder, deletePath, renamePath, hideContextMenu, pushChangesToGist, publishFileToGist, publishFolderToGist, copy, paste, runScript, emit, pageX, pageY, path, type, focus, ...otherProps } = props + const { actions, createNewFile, createNewFolder, deletePath, renamePath, hideContextMenu, pushChangesToGist, publishFileToGist, publishFolderToGist, copy, paste, runScript, runScriptWithMocha, emit, pageX, pageY, path, type, focus, ...otherProps } = props const contextMenuRef = useRef(null) useEffect(() => { contextMenuRef.current.focus() @@ -98,6 +98,10 @@ export const FileExplorerContextMenu = (props: FileExplorerContextMenuProps) => _paq.push(['trackEvent', 'fileExplorer', 'runScript']) runScript(path) break + case 'Run with Mocha': + _paq.push(['trackEvent', 'fileExplorer', 'runScriptWithMocha']) + runScriptWithMocha(path) + break case 'Copy': copy(path, type) break diff --git a/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx b/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx index 5ae7de8d05..d5c0fa8f75 100644 --- a/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx +++ b/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx @@ -221,6 +221,14 @@ export const FileExplorer = (props: FileExplorerProps) => { } } + const runScriptWithMocha = async (path: string) => { + try { + props.dispatchRunScriptWithMocha(path) + } catch (error) { + props.toast('Run script with Mocha failed') + } + } + const emitContextMenuEvent = (cmd: customAction) => { try { props.dispatchEmitContextMenuEvent(cmd) @@ -454,6 +462,7 @@ export const FileExplorer = (props: FileExplorerProps) => { deletePath={deletePath} renamePath={editModeOn} runScript={runScript} + runScriptWithMocha={runScriptWithMocha} copy={handleCopyClick} paste={handlePasteClick} emit={emitContextMenuEvent} diff --git a/libs/remix-ui/workspace/src/lib/contexts/index.ts b/libs/remix-ui/workspace/src/lib/contexts/index.ts index 1aedce98b5..20c9b46633 100644 --- a/libs/remix-ui/workspace/src/lib/contexts/index.ts +++ b/libs/remix-ui/workspace/src/lib/contexts/index.ts @@ -25,6 +25,7 @@ export const FileSystemContext = createContext<{ dispatchCopyFile: (src: string, dest: string) => Promise, dispatchCopyFolder: (src: string, dest: string) => Promise, dispatchRunScript: (path: string) => Promise, + dispatchRunScriptWithMocha: (path: string) => Promise, dispatchEmitContextMenuEvent: (cmd: customAction) => Promise, dispatchHandleClickFile: (path: string, type: 'file' | 'folder' | 'gist') => Promise dispatchHandleExpandPath: (paths: string[]) => Promise diff --git a/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx b/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx index 904ed7cade..330270cf5e 100644 --- a/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx +++ b/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx @@ -5,7 +5,7 @@ import { Toaster } from '@remix-ui/toaster' // eslint-disable-line // eslint-disable-next-line @typescript-eslint/no-unused-vars import { FileSystemContext } from '../contexts' import { browserReducer, browserInitialState } from '../reducers/workspace' -import { initWorkspace, fetchDirectory, removeInputField, deleteWorkspace, clearPopUp, publishToGist, createNewFile, setFocusElement, createNewFolder, deletePath, renamePath, copyFile, copyFolder, runScript, emitContextMenuEvent, handleClickFile, handleExpandPath, addInputField, createWorkspace, fetchWorkspaceDirectory, renameWorkspace, switchToWorkspace, uploadFile } from '../actions' +import { initWorkspace, fetchDirectory, removeInputField, deleteWorkspace, clearPopUp, publishToGist, createNewFile, setFocusElement, createNewFolder, deletePath, renamePath, copyFile, copyFolder, runScript, runScriptWithMocha, emitContextMenuEvent, handleClickFile, handleExpandPath, addInputField, createWorkspace, fetchWorkspaceDirectory, renameWorkspace, switchToWorkspace, uploadFile } from '../actions' import { Modal, WorkspaceProps } from '../types' // eslint-disable-next-line @typescript-eslint/no-unused-vars import { Workspace } from '../remix-ui-workspace' @@ -103,6 +103,10 @@ export const FileSystemProvider = (props: WorkspaceProps) => { await runScript(path) } + const dispatchRunScriptWithMocha = async (path: string) => { + await runScriptWithMocha(path) + } + const dispatchEmitContextMenuEvent = async (cmd: customAction) => { await emitContextMenuEvent(cmd) } @@ -212,6 +216,7 @@ export const FileSystemProvider = (props: WorkspaceProps) => { dispatchCopyFile, dispatchCopyFolder, dispatchRunScript, + dispatchRunScriptWithMocha, dispatchEmitContextMenuEvent, dispatchHandleClickFile, dispatchHandleExpandPath diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index a51224f86c..a5a84e1e1f 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -198,6 +198,7 @@ export function Workspace () { dispatchCopyFolder={global.dispatchCopyFolder} dispatchPublishToGist={global.dispatchPublishToGist} dispatchRunScript={global.dispatchRunScript} + dispatchRunScriptWithMocha={global.dispatchRunScriptWithMocha} dispatchEmitContextMenuEvent={global.dispatchEmitContextMenuEvent} dispatchHandleClickFile={global.dispatchHandleClickFile} dispatchSetFocusElement={global.dispatchSetFocusElement} @@ -233,6 +234,7 @@ export function Workspace () { dispatchCopyFolder={global.dispatchCopyFolder} dispatchPublishToGist={global.dispatchPublishToGist} dispatchRunScript={global.dispatchRunScript} + dispatchRunScriptWithMocha={global.dispatchRunScriptWithMocha} dispatchEmitContextMenuEvent={global.dispatchEmitContextMenuEvent} dispatchHandleClickFile={global.dispatchHandleClickFile} dispatchSetFocusElement={global.dispatchSetFocusElement} diff --git a/libs/remix-ui/workspace/src/lib/types/index.ts b/libs/remix-ui/workspace/src/lib/types/index.ts index bf4b24d661..5db5bd0a99 100644 --- a/libs/remix-ui/workspace/src/lib/types/index.ts +++ b/libs/remix-ui/workspace/src/lib/types/index.ts @@ -78,6 +78,7 @@ export interface FileExplorerProps { dispatchCopyFile: (src: string, dest: string) => Promise, dispatchCopyFolder: (src: string, dest: string) => Promise, dispatchRunScript: (path: string) => Promise, + dispatchRunScriptWithMocha: (path: string) => Promise, dispatchPublishToGist: (path?: string, type?: string) => Promise, dispatchEmitContextMenuEvent: (cmd: customAction) => Promise, dispatchHandleClickFile: (path: string, type: 'file' | 'folder' | 'gist') => Promise, @@ -108,6 +109,7 @@ export interface FileExplorerContextMenuProps { publishFolderToGist?: (path?: string, type?: string) => void, publishFileToGist?: (path?: string, type?: string) => void, runScript?: (path: string) => void, + runScriptWithMocha?: (path: string) => void, emit?: (cmd: customAction) => void, pageX: number, pageY: number, diff --git a/libs/remix-ui/workspace/src/lib/utils/index.ts b/libs/remix-ui/workspace/src/lib/utils/index.ts index 0dd70b14bc..f2558c1b2c 100644 --- a/libs/remix-ui/workspace/src/lib/utils/index.ts +++ b/libs/remix-ui/workspace/src/lib/utils/index.ts @@ -30,6 +30,12 @@ export const contextMenuActions: MenuItems = [{ extension: ['.js'], multiselect: false, label: '' +}, { + id: 'runWithMocha', + name: 'Run with Mocha', + extension: ['.js'], + multiselect: false, + label: '' }, { id: 'pushChangesToGist', name: 'Push changes to gist', From b4e702e7ee041b7f207624f1e87186433546d68f Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 15 Feb 2022 13:59:27 +0530 Subject: [PATCH 035/217] getArtefactsByContractName added --- libs/remix-core-plugin/src/lib/compiler-artefacts.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/libs/remix-core-plugin/src/lib/compiler-artefacts.ts b/libs/remix-core-plugin/src/lib/compiler-artefacts.ts index 1198a012db..1732337394 100644 --- a/libs/remix-core-plugin/src/lib/compiler-artefacts.ts +++ b/libs/remix-core-plugin/src/lib/compiler-artefacts.ts @@ -4,7 +4,7 @@ import { CompilerAbstract } from '@remix-project/remix-solidity' const profile = { name: 'compilerArtefacts', - methods: ['get', 'addResolvedContract', 'getCompilerAbstract', 'getAllContractDatas', 'getLastCompilationResult'], + methods: ['get', 'addResolvedContract', 'getCompilerAbstract', 'getAllContractDatas', 'getLastCompilationResult', 'getArtefactsByContractName'], events: [], version: '0.0.1' } @@ -72,6 +72,16 @@ export class CompilerArtefacts extends Plugin { return contractsData } + getArtefactsByContractName (contractName) { + const contractsDataByFilename = this.getAllContractDatas() + const contractsData = Object.values(contractsDataByFilename) + if(contractsData && contractsData.length) { + const index = contractsData.findIndex((contractsObj) => Object.keys(contractsObj).includes(contractName)) + if (index != -1) return contractsData[index][contractName] + else throw new Error(`Could not find artifacts for ${contractName}. Make sure it is compiled.`) + } else throw new Error(`No contract compiled`) + } + getCompilerAbstract (file) { return this.compilersArtefactsPerFile[file] } From 36c936be0a023a83f6608e620d46c41cbca5b1fd Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 15 Feb 2022 14:41:15 +0530 Subject: [PATCH 036/217] linting fix --- libs/remix-core-plugin/src/lib/compiler-artefacts.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/remix-core-plugin/src/lib/compiler-artefacts.ts b/libs/remix-core-plugin/src/lib/compiler-artefacts.ts index 1732337394..041b98199e 100644 --- a/libs/remix-core-plugin/src/lib/compiler-artefacts.ts +++ b/libs/remix-core-plugin/src/lib/compiler-artefacts.ts @@ -75,11 +75,11 @@ export class CompilerArtefacts extends Plugin { getArtefactsByContractName (contractName) { const contractsDataByFilename = this.getAllContractDatas() const contractsData = Object.values(contractsDataByFilename) - if(contractsData && contractsData.length) { + if (contractsData && contractsData.length) { const index = contractsData.findIndex((contractsObj) => Object.keys(contractsObj).includes(contractName)) - if (index != -1) return contractsData[index][contractName] + if (index !== -1) return contractsData[index][contractName] else throw new Error(`Could not find artifacts for ${contractName}. Make sure it is compiled.`) - } else throw new Error(`No contract compiled`) + } else throw new Error('No contract compiled') } getCompilerAbstract (file) { From e23d824c338c9194a49082700f78c0a23c7e4bef Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Thu, 17 Feb 2022 13:20:29 +0530 Subject: [PATCH 037/217] fileList --- apps/remix-ide/src/app/files/fileManager.ts | 9 ++++++++- libs/remix-core-plugin/src/lib/compiler-artefacts.ts | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide/src/app/files/fileManager.ts b/apps/remix-ide/src/app/files/fileManager.ts index d9789f4512..aff574f5a8 100644 --- a/apps/remix-ide/src/app/files/fileManager.ts +++ b/apps/remix-ide/src/app/files/fileManager.ts @@ -704,7 +704,14 @@ class FileManager extends Plugin { return collectList(path) } - isRemixDActive() { + async fileList (dirPath) { + const paths: any = await this.readdir(dirPath) + for( const path in paths) + if(paths[path].isDirectory) delete paths[path] + return paths + } + + isRemixDActive () { return this.appManager.isActive('remixd') } diff --git a/libs/remix-core-plugin/src/lib/compiler-artefacts.ts b/libs/remix-core-plugin/src/lib/compiler-artefacts.ts index 041b98199e..99abe5b7d8 100644 --- a/libs/remix-core-plugin/src/lib/compiler-artefacts.ts +++ b/libs/remix-core-plugin/src/lib/compiler-artefacts.ts @@ -77,7 +77,7 @@ export class CompilerArtefacts extends Plugin { const contractsData = Object.values(contractsDataByFilename) if (contractsData && contractsData.length) { const index = contractsData.findIndex((contractsObj) => Object.keys(contractsObj).includes(contractName)) - if (index !== -1) return contractsData[index][contractName] + if (index !== -1) return { abi: contractsData[index][contractName].abi, bytecode: contractsData[index][contractName].evm.bytecode.object } else throw new Error(`Could not find artifacts for ${contractName}. Make sure it is compiled.`) } else throw new Error('No contract compiled') } From 9a9e34df2a3d9232eeb428b11245a8d10968da26 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Thu, 17 Feb 2022 13:54:17 +0530 Subject: [PATCH 038/217] get artifacts from file explorer --- apps/remix-ide/src/app/files/fileManager.ts | 4 ++-- .../src/lib/compiler-artefacts.ts | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/apps/remix-ide/src/app/files/fileManager.ts b/apps/remix-ide/src/app/files/fileManager.ts index aff574f5a8..df40820b27 100644 --- a/apps/remix-ide/src/app/files/fileManager.ts +++ b/apps/remix-ide/src/app/files/fileManager.ts @@ -19,7 +19,7 @@ const profile = { icon: 'assets/img/fileManager.webp', permission: true, version: packageJson.version, - methods: ['closeAllFiles', 'closeFile', 'file', 'exists', 'open', 'writeFile', 'readFile', 'copyFile', 'copyDir', 'rename', 'mkdir', 'readdir', 'remove', 'getCurrentFile', 'getFile', 'getFolder', 'setFile', 'switchFile', 'refresh', 'getProviderOf', 'getProviderByName', 'getPathFromUrl', 'getUrlFromPath', 'saveCurrentFile', 'setBatchFiles'], + methods: ['closeAllFiles', 'closeFile', 'file', 'exists', 'open', 'writeFile', 'readFile', 'copyFile', 'copyDir', 'rename', 'mkdir', 'readdir', 'dirList', 'fileList', 'remove', 'getCurrentFile', 'getFile', 'getFolder', 'setFile', 'switchFile', 'refresh', 'getProviderOf', 'getProviderByName', 'getPathFromUrl', 'getUrlFromPath', 'saveCurrentFile', 'setBatchFiles'], kind: 'file-system' } const errorMsg = { @@ -708,7 +708,7 @@ class FileManager extends Plugin { const paths: any = await this.readdir(dirPath) for( const path in paths) if(paths[path].isDirectory) delete paths[path] - return paths + return Object.keys(paths) } isRemixDActive () { diff --git a/libs/remix-core-plugin/src/lib/compiler-artefacts.ts b/libs/remix-core-plugin/src/lib/compiler-artefacts.ts index 99abe5b7d8..21f2d29b1a 100644 --- a/libs/remix-core-plugin/src/lib/compiler-artefacts.ts +++ b/libs/remix-core-plugin/src/lib/compiler-artefacts.ts @@ -72,14 +72,29 @@ export class CompilerArtefacts extends Plugin { return contractsData } - getArtefactsByContractName (contractName) { + async getArtefactsFromFE (path, contractName) { + const dirList = await this.call('fileManager', 'dirList', path) + if(dirList.includes(path + '/artifacts')) { + const fileList = await this.call('fileManager', 'fileList', path + '/artifacts') + const artefactsFilePaths = fileList.filter(filePath => { + const filenameArr = filePath.split('/') + const filename = filenameArr[filenameArr.length - 1] + if (filename === `${contractName}.json` || filename === `${contractName}_metadata.json`) return true + }) + const content = await this.call('fileManager', 'readFile', artefactsFilePaths[1]) + const artifacts = JSON.parse(content) + return { abi: artifacts.abi, bytecode: artifacts.data.bytecode.object } + } + } + + async getArtefactsByContractName (contractName) { const contractsDataByFilename = this.getAllContractDatas() const contractsData = Object.values(contractsDataByFilename) if (contractsData && contractsData.length) { const index = contractsData.findIndex((contractsObj) => Object.keys(contractsObj).includes(contractName)) if (index !== -1) return { abi: contractsData[index][contractName].abi, bytecode: contractsData[index][contractName].evm.bytecode.object } else throw new Error(`Could not find artifacts for ${contractName}. Make sure it is compiled.`) - } else throw new Error('No contract compiled') + } else await this.getArtefactsFromFE ('contracts', contractName) } getCompilerAbstract (file) { From f13ccf1822ac92092253ce29d9add3685797fa2f Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Thu, 17 Feb 2022 17:02:12 +0530 Subject: [PATCH 039/217] check for artifacts in all dirs --- .../src/lib/compiler-artefacts.ts | 48 ++++++++++++++----- 1 file changed, 35 insertions(+), 13 deletions(-) diff --git a/libs/remix-core-plugin/src/lib/compiler-artefacts.ts b/libs/remix-core-plugin/src/lib/compiler-artefacts.ts index 21f2d29b1a..d35fa36141 100644 --- a/libs/remix-core-plugin/src/lib/compiler-artefacts.ts +++ b/libs/remix-core-plugin/src/lib/compiler-artefacts.ts @@ -74,17 +74,31 @@ export class CompilerArtefacts extends Plugin { async getArtefactsFromFE (path, contractName) { const dirList = await this.call('fileManager', 'dirList', path) - if(dirList.includes(path + '/artifacts')) { - const fileList = await this.call('fileManager', 'fileList', path + '/artifacts') - const artefactsFilePaths = fileList.filter(filePath => { - const filenameArr = filePath.split('/') - const filename = filenameArr[filenameArr.length - 1] - if (filename === `${contractName}.json` || filename === `${contractName}_metadata.json`) return true - }) - const content = await this.call('fileManager', 'readFile', artefactsFilePaths[1]) - const artifacts = JSON.parse(content) - return { abi: artifacts.abi, bytecode: artifacts.data.bytecode.object } - } + if(dirList && dirList.length) { + if(dirList.includes(path + '/artifacts')) { + const fileList = await this.call('fileManager', 'fileList', path + '/artifacts') + const artefactsFilePaths = fileList.filter(filePath => { + const filenameArr = filePath.split('/') + const filename = filenameArr[filenameArr.length - 1] + if (filename === `${contractName}.json` || filename === `${contractName}_metadata.json`) return true + }) + if (artefactsFilePaths && artefactsFilePaths.length) { + const content = await this.call('fileManager', 'readFile', artefactsFilePaths[1]) + const artifacts = JSON.parse(content) + return { abi: artifacts.abi, bytecode: artifacts.data.bytecode.object } + } else { + for (const dirPath of dirList) { + const result = await this.getArtefactsFromFE (dirPath, contractName) + if (result) return result + } + } + } else { + for (const dirPath of dirList) { + const result = await this.getArtefactsFromFE (dirPath, contractName) + if (result) return result + } + } + } else return } async getArtefactsByContractName (contractName) { @@ -93,8 +107,16 @@ export class CompilerArtefacts extends Plugin { if (contractsData && contractsData.length) { const index = contractsData.findIndex((contractsObj) => Object.keys(contractsObj).includes(contractName)) if (index !== -1) return { abi: contractsData[index][contractName].abi, bytecode: contractsData[index][contractName].evm.bytecode.object } - else throw new Error(`Could not find artifacts for ${contractName}. Make sure it is compiled.`) - } else await this.getArtefactsFromFE ('contracts', contractName) + else { + const result = await this.getArtefactsFromFE ('contracts', contractName) + if (result) return result + else throw new Error(`Could not find artifacts for ${contractName}. Compile contract to generate artifacts.`) + } + } else { + const result = await this.getArtefactsFromFE ('contracts', contractName) + if (result) return result + else throw new Error(`Could not find artifacts for ${contractName}. Compile contract to generate artifacts.`) + } } getCompilerAbstract (file) { From 6cc3af041a6a6eff42e844143e0b1c183528918c Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Thu, 17 Feb 2022 17:12:35 +0530 Subject: [PATCH 040/217] removed local link --- apps/remix-ide/src/remixAppManager.js | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/remix-ide/src/remixAppManager.js b/apps/remix-ide/src/remixAppManager.js index 24814eb43d..ce7ea97b27 100644 --- a/apps/remix-ide/src/remixAppManager.js +++ b/apps/remix-ide/src/remixAppManager.js @@ -114,7 +114,6 @@ export class RemixAppManager extends PluginManager { const res = await fetch(this.pluginsDirectory) plugins = await res.json() plugins = plugins.filter((plugin) => { - if (plugin.name === 'scriptRunner') plugin.url = 'http://127.0.0.1:8081' if (plugin.targets && Array.isArray(plugin.targets) && plugin.targets.length > 0) { return (plugin.targets.includes('remix')) } From c9dd9fb9ab3397b221d77302ea4816141420a452 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Fri, 18 Feb 2022 12:55:41 +0100 Subject: [PATCH 041/217] first steps --- apps/remix-ide/src/app.js | 9 +- apps/remix-ide/src/app/files/fileManager.ts | 10 ++- apps/remix-ide/src/app/tabs/search.tsx | 34 +++++++ apps/remix-ide/src/assets/img/Search_Icon.svg | 77 ++++++++++++++++ libs/remix-ui/search/.babelrc | 4 + libs/remix-ui/search/.eslintrc.json | 19 ++++ libs/remix-ui/search/.prettierrc | 5 ++ libs/remix-ui/search/README.md | 7 ++ libs/remix-ui/search/src/index.ts | 1 + .../search/src/lib/components/Exclude.tsx | 0 .../search/src/lib/components/Find.tsx | 17 ++++ .../search/src/lib/components/Include.tsx | 0 .../search/src/lib/components/Replace.tsx | 16 ++++ .../search/src/lib/components/Search.tsx | 25 ++++++ .../lib/components/results/ResultFileName.tsx | 0 .../src/lib/components/results/ResultItem.tsx | 0 .../lib/components/results/ResultSummary.tsx | 0 .../src/lib/components/results/Results.tsx | 81 +++++++++++++++++ .../search/src/lib/context/context.tsx | 88 +++++++++++++++++++ .../search/src/lib/reducers/Reducer.ts | 70 +++++++++++++++ libs/remix-ui/search/tsconfig.json | 19 ++++ libs/remix-ui/search/tsconfig.lib.json | 13 +++ nx.json | 3 + package-lock.json | 70 +++++++-------- tsconfig.base.json | 1 + workspace.json | 15 ++++ 26 files changed, 546 insertions(+), 38 deletions(-) create mode 100644 apps/remix-ide/src/app/tabs/search.tsx create mode 100644 apps/remix-ide/src/assets/img/Search_Icon.svg create mode 100644 libs/remix-ui/search/.babelrc create mode 100644 libs/remix-ui/search/.eslintrc.json create mode 100644 libs/remix-ui/search/.prettierrc create mode 100644 libs/remix-ui/search/README.md create mode 100644 libs/remix-ui/search/src/index.ts create mode 100644 libs/remix-ui/search/src/lib/components/Exclude.tsx create mode 100644 libs/remix-ui/search/src/lib/components/Find.tsx create mode 100644 libs/remix-ui/search/src/lib/components/Include.tsx create mode 100644 libs/remix-ui/search/src/lib/components/Replace.tsx create mode 100644 libs/remix-ui/search/src/lib/components/Search.tsx create mode 100644 libs/remix-ui/search/src/lib/components/results/ResultFileName.tsx create mode 100644 libs/remix-ui/search/src/lib/components/results/ResultItem.tsx create mode 100644 libs/remix-ui/search/src/lib/components/results/ResultSummary.tsx create mode 100644 libs/remix-ui/search/src/lib/components/results/Results.tsx create mode 100644 libs/remix-ui/search/src/lib/context/context.tsx create mode 100644 libs/remix-ui/search/src/lib/reducers/Reducer.ts create mode 100644 libs/remix-ui/search/tsconfig.json create mode 100644 libs/remix-ui/search/tsconfig.lib.json diff --git a/apps/remix-ide/src/app.js b/apps/remix-ide/src/app.js index 033c1b1bb0..732ef24c4a 100644 --- a/apps/remix-ide/src/app.js +++ b/apps/remix-ide/src/app.js @@ -30,6 +30,7 @@ const isElectron = require('is-electron') const remixLib = require('@remix-project/remix-lib') import { QueryParams } from '@remix-project/remix-lib' +import { SearchPlugin } from './app/tabs/search' const Storage = remixLib.Storage const RemixDProvider = require('./app/files/remixDProvider') const Config = require('./config') @@ -147,6 +148,9 @@ class AppComponent { // ----------------- Storage plugin --------------------------------- const storagePlugin = new StoragePlugin() + //----- search + const search = new SearchPlugin() + // ----------------- import content service ------------------------ const contentImport = new CompilerImports() @@ -221,7 +225,8 @@ class AppComponent { dGitProvider, storagePlugin, hardhatProvider, - this.walkthroughService + this.walkthroughService, + search ]) // LAYOUT & SYSTEM VIEWS @@ -332,7 +337,7 @@ class AppComponent { await this.appManager.activatePlugin(['settings', 'config']) await this.appManager.activatePlugin(['hiddenPanel', 'pluginManager', 'contextualListener', 'terminal', 'blockchain', 'fetchAndCompile', 'contentImport', 'gistHandler']) await this.appManager.activatePlugin(['settings']) - await this.appManager.activatePlugin(['walkthrough','storage']) + await this.appManager.activatePlugin(['walkthrough','storage', 'search']) this.appManager.on( 'filePanel', diff --git a/apps/remix-ide/src/app/files/fileManager.ts b/apps/remix-ide/src/app/files/fileManager.ts index d9789f4512..263d583093 100644 --- a/apps/remix-ide/src/app/files/fileManager.ts +++ b/apps/remix-ide/src/app/files/fileManager.ts @@ -19,7 +19,7 @@ const profile = { icon: 'assets/img/fileManager.webp', permission: true, version: packageJson.version, - methods: ['closeAllFiles', 'closeFile', 'file', 'exists', 'open', 'writeFile', 'readFile', 'copyFile', 'copyDir', 'rename', 'mkdir', 'readdir', 'remove', 'getCurrentFile', 'getFile', 'getFolder', 'setFile', 'switchFile', 'refresh', 'getProviderOf', 'getProviderByName', 'getPathFromUrl', 'getUrlFromPath', 'saveCurrentFile', 'setBatchFiles'], + methods: ['closeAllFiles', 'closeFile', 'file', 'exists', 'open', 'writeFile', 'readFile', 'copyFile', 'copyDir', 'rename', 'mkdir', 'readdir', 'remove', 'getCurrentFile', 'getFile', 'getFolder', 'setFile', 'switchFile', 'refresh', 'getProviderOf', 'getProviderByName', 'getPathFromUrl', 'getUrlFromPath', 'saveCurrentFile', 'setBatchFiles', 'findInFile'], kind: 'file-system' } const errorMsg = { @@ -396,6 +396,14 @@ class FileManager extends Plugin { } } + + async findInFile(query) { + const browserProvider = this.getProvider('browser') + await browserProvider.copyFolderToJson('/.workspaces/default_workspace', ({ path, content }) => { + console.log(path, content) + }) + } + init() { this._deps = { config: this._components.registry.get('config').api, diff --git a/apps/remix-ide/src/app/tabs/search.tsx b/apps/remix-ide/src/app/tabs/search.tsx new file mode 100644 index 0000000000..267396181a --- /dev/null +++ b/apps/remix-ide/src/app/tabs/search.tsx @@ -0,0 +1,34 @@ +import { ViewPlugin } from '@remixproject/engine-web' +import * as packageJson from '../../../../../package.json' +import React from 'react' // eslint-disable-line +import { PluginViewWrapper } from '@remix-ui/helper' +import { SearchTab } from '@remix-ui/search' +const profile = { + name: 'search', + displayName: 'Search', + methods: [''], + events: [], + icon: 'assets/img/Search_Icon.svg', + description: '', + kind: '', + location: 'sidePanel', + documentation: '', + version: packageJson.version + } + +export class SearchPlugin extends ViewPlugin { + dispatch: React.Dispatch = () => {} + constructor () { + super(profile) + } + + + render() { + return ( +
+ +
+ ); + } + +} \ No newline at end of file diff --git a/apps/remix-ide/src/assets/img/Search_Icon.svg b/apps/remix-ide/src/assets/img/Search_Icon.svg new file mode 100644 index 0000000000..00a6fcde04 --- /dev/null +++ b/apps/remix-ide/src/assets/img/Search_Icon.svg @@ -0,0 +1,77 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/libs/remix-ui/search/.babelrc b/libs/remix-ui/search/.babelrc new file mode 100644 index 0000000000..64a3748691 --- /dev/null +++ b/libs/remix-ui/search/.babelrc @@ -0,0 +1,4 @@ +{ + "presets": ["@nrwl/react/babel"], + "plugins": [] +} \ No newline at end of file diff --git a/libs/remix-ui/search/.eslintrc.json b/libs/remix-ui/search/.eslintrc.json new file mode 100644 index 0000000000..1587c6172a --- /dev/null +++ b/libs/remix-ui/search/.eslintrc.json @@ -0,0 +1,19 @@ +{ + "env": { + "browser": true, + "es6": true + }, + "ignorePatterns": ["!**/*"], + "extends": "../../../.eslintrc.json", + "globals": { + "Atomics": "readonly", + "SharedArrayBuffer": "readonly" + }, + "parserOptions": { + "ecmaVersion": 11, + "sourceType": "module" + }, + "rules": { + "standard/no-callback-literal": "off" + } +} \ No newline at end of file diff --git a/libs/remix-ui/search/.prettierrc b/libs/remix-ui/search/.prettierrc new file mode 100644 index 0000000000..591b168cb7 --- /dev/null +++ b/libs/remix-ui/search/.prettierrc @@ -0,0 +1,5 @@ +{ + "tabWidth": 2, + "singleQuote": true, + "semi": false +} \ No newline at end of file diff --git a/libs/remix-ui/search/README.md b/libs/remix-ui/search/README.md new file mode 100644 index 0000000000..cf9595a10e --- /dev/null +++ b/libs/remix-ui/search/README.md @@ -0,0 +1,7 @@ +# remix-ui-vertical-icons-panel + +React library for RemixIde vertical icons Panel + +## Running unit tests + +Run `nx test remix-ui-vertical-icons-panel` to execute the unit tests via [Jest](https://jestjs.io). diff --git a/libs/remix-ui/search/src/index.ts b/libs/remix-ui/search/src/index.ts new file mode 100644 index 0000000000..8617e2ddff --- /dev/null +++ b/libs/remix-ui/search/src/index.ts @@ -0,0 +1 @@ +export { SearchTab } from './lib/components/Search'; \ No newline at end of file diff --git a/libs/remix-ui/search/src/lib/components/Exclude.tsx b/libs/remix-ui/search/src/lib/components/Exclude.tsx new file mode 100644 index 0000000000..e69de29bb2 diff --git a/libs/remix-ui/search/src/lib/components/Find.tsx b/libs/remix-ui/search/src/lib/components/Find.tsx new file mode 100644 index 0000000000..db8cb94463 --- /dev/null +++ b/libs/remix-ui/search/src/lib/components/Find.tsx @@ -0,0 +1,17 @@ +import React, { useContext, useReducer } from "react" +import { SearchContext } from "../context/context" +import { SearchingInitialState, SearchReducer } from "../reducers/Reducer" + + + +export const Find = props => { + + const { setFind } = useContext(SearchContext) + const change = (e) => { + setFind(e.target.value) + } + + return(<> + + ) +} \ No newline at end of file diff --git a/libs/remix-ui/search/src/lib/components/Include.tsx b/libs/remix-ui/search/src/lib/components/Include.tsx new file mode 100644 index 0000000000..e69de29bb2 diff --git a/libs/remix-ui/search/src/lib/components/Replace.tsx b/libs/remix-ui/search/src/lib/components/Replace.tsx new file mode 100644 index 0000000000..fc60d3d73a --- /dev/null +++ b/libs/remix-ui/search/src/lib/components/Replace.tsx @@ -0,0 +1,16 @@ +import React, { useContext, useEffect } from 'react' +import { SearchContext } from '../context/context' + +export const Replace = props => { + const { state, setReplace } = useContext(SearchContext) + + const change = e => { + setReplace(e.target.value) + } + + return ( + <> + + + ) +} diff --git a/libs/remix-ui/search/src/lib/components/Search.tsx b/libs/remix-ui/search/src/lib/components/Search.tsx new file mode 100644 index 0000000000..e9d2df1097 --- /dev/null +++ b/libs/remix-ui/search/src/lib/components/Search.tsx @@ -0,0 +1,25 @@ +import React, { useContext, useEffect, useReducer } from 'react' +import { SearchContext, SearchProvider } from '../context/context' +import { SearchingInitialState, SearchReducer } from '../reducers/Reducer' +import { Find } from './Find' +import { Replace } from './Replace' +import { Results } from './results/Results' + +export const SearchTab = props => { + +const plugin = props.plugin + +useEffect(() => { + console.log (plugin) +},[]) + +return ( + <> + + + + + + + ) +} diff --git a/libs/remix-ui/search/src/lib/components/results/ResultFileName.tsx b/libs/remix-ui/search/src/lib/components/results/ResultFileName.tsx new file mode 100644 index 0000000000..e69de29bb2 diff --git a/libs/remix-ui/search/src/lib/components/results/ResultItem.tsx b/libs/remix-ui/search/src/lib/components/results/ResultItem.tsx new file mode 100644 index 0000000000..e69de29bb2 diff --git a/libs/remix-ui/search/src/lib/components/results/ResultSummary.tsx b/libs/remix-ui/search/src/lib/components/results/ResultSummary.tsx new file mode 100644 index 0000000000..e69de29bb2 diff --git a/libs/remix-ui/search/src/lib/components/results/Results.tsx b/libs/remix-ui/search/src/lib/components/results/Results.tsx new file mode 100644 index 0000000000..7514c51e98 --- /dev/null +++ b/libs/remix-ui/search/src/lib/components/results/Results.tsx @@ -0,0 +1,81 @@ +import { ViewPlugin } from "@remixproject/engine-web" +import React, { useContext, useEffect } from "react" +import { SearchContext } from "../../context/context" +import { SearchResult } from "../../reducers/Reducer" + +interface ResultsProps { + plugin: ViewPlugin +} + +export const Results = (props: ResultsProps) => { + + const { state, setSearchResults } = useContext(SearchContext) + + const { plugin } = props + + const getDirectory = async (dir) => { + let result = [] + const files = await plugin.call('fileManager', 'readdir', dir) + const fileArray = normalize(files) + for (const fi of fileArray) { + if (fi) { + const type = fi.data.isDirectory + if (type === true) { + result = [ + ...result, + ...(await getDirectory( + `${fi.filename}` + )) + ] + } else { + result = [...result, fi.filename] + } + } + } + return result + } + + const normalize = (filesList) => { + const folders = [] + const files = [] + Object.keys(filesList || {}).forEach(key => { + if (filesList[key].isDirectory) { + folders.push({ + filename: key, + data: filesList[key] + }) + } else { + files.push({ + filename: key, + data: filesList[key] + }) + } + }) + return [...folders, ...files] + } + + useEffect(() => { + if (state.find) { + getDirectory('/').then(res => { + const ob = res.map(file => { + const r:SearchResult = { + filename: file, + lines: [], + path: file, + searchComplete: false + } + return r + }) + console.log(ob) + setSearchResults(ob) + }) + } + },[state.find]) + + + useEffect(() => { + console.log(state.searchResults) + },[state.searchResults]) + + return(<>) +} \ No newline at end of file diff --git a/libs/remix-ui/search/src/lib/context/context.tsx b/libs/remix-ui/search/src/lib/context/context.tsx new file mode 100644 index 0000000000..4b696f948e --- /dev/null +++ b/libs/remix-ui/search/src/lib/context/context.tsx @@ -0,0 +1,88 @@ +import React from 'react' +import { createContext, useReducer } from 'react' +import { + SearchingInitialState, + SearchReducer, + SearchResult, + SearchState +} from '../reducers/Reducer' + +export interface SearchingStateInterface { + state: SearchState + setFind: (value: string) => void + setReplace: (value: string) => void + setInclude: (value: string) => void, + setExclude: (value: string) => void, + setCaseSensitive: (value: boolean) => void, + setRegex: (value: boolean) => void, + setWholeWord: (value: boolean) => void, + setSearchResults: (value: SearchResult[]) => void, +} + +export const SearchContext = createContext(null) + +export const SearchProvider = ({ + children = [], + reducer = SearchReducer, + initialState = SearchingInitialState +} = {}) => { + const [state, dispatch] = useReducer(reducer, initialState) + + const value = { + state, + setFind: (value: string) => { + dispatch({ + type: 'SET_FIND', + payload: value + }) + }, + setReplace: (value: string) => { + dispatch({ + type: 'SET_REPLACE', + payload: value + }) + }, + setInclude: (value: string) => { + dispatch({ + type: 'SET_INCLUDE', + payload: value + }) + }, + setExclude(value: string) { + dispatch({ + type: 'SET_EXCLUDE', + payload: value + }) + }, + setCaseSensitive(value: boolean) { + dispatch({ + type: 'SET_CASE_SENSITIVE', + payload: value + }) + }, + setWholeWord(value: boolean) { + dispatch({ + type: 'SET_WHOLE_WORD', + payload: value + }) + }, + setRegex(value: boolean) { + dispatch({ + type: 'SET_REGEX', + payload: value + }) + }, + setSearchResults(value: SearchResult[]) { + dispatch({ + type: 'SET_SEARCH_RESULTS', + payload: value + }) + } + } + + return ( + <> + {children} + + ) +} diff --git a/libs/remix-ui/search/src/lib/reducers/Reducer.ts b/libs/remix-ui/search/src/lib/reducers/Reducer.ts new file mode 100644 index 0000000000..e0cc2a4b0c --- /dev/null +++ b/libs/remix-ui/search/src/lib/reducers/Reducer.ts @@ -0,0 +1,70 @@ + +interface Action { + type: string + payload: any +} + +export interface SearchResultLine { + lineNumber: number + text: string +} + +export interface SearchResult { + filename: string, + path: string, + lines: SearchResultLine[], + searchComplete: boolean +} + +export interface SearchState { + find: string, + searchResults: SearchResult[], + replace: string, + include: string, + exclude: string, +} + +export const SearchingInitialState: SearchState = { + find: '', + replace: '', + include: '', + exclude: '', + searchResults: [] +} + +export const SearchReducer = (state: SearchState = SearchingInitialState, action: Action) => { + console.log(state) + switch (action.type) { + case 'SET_FIND': + return { + ...state, + find: action.payload, + } + break; + case 'SET_REPLACE': + return { + ...state, + replace: action.payload, + } + break; + case 'SET_INCLUDE': + return { + ...state, + include: action.payload, + } + break; + case 'SET_EXCLUDE': + return { + ...state, + exclude: action.payload, + } + break; + case 'SET_SEARCH_RESULTS': + return { + ...state, + searchResults: action.payload, + } + break; + default: + } +} \ No newline at end of file diff --git a/libs/remix-ui/search/tsconfig.json b/libs/remix-ui/search/tsconfig.json new file mode 100644 index 0000000000..a7180ef589 --- /dev/null +++ b/libs/remix-ui/search/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "jsx": "react", + "allowJs": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] +} diff --git a/libs/remix-ui/search/tsconfig.lib.json b/libs/remix-ui/search/tsconfig.lib.json new file mode 100644 index 0000000000..b560bc4dec --- /dev/null +++ b/libs/remix-ui/search/tsconfig.lib.json @@ -0,0 +1,13 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../../dist/out-tsc", + "types": ["node"] + }, + "files": [ + "../../../node_modules/@nrwl/react/typings/cssmodule.d.ts", + "../../../node_modules/@nrwl/react/typings/image.d.ts" + ], + "exclude": ["**/*.spec.ts", "**/*.spec.tsx"], + "include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"] +} diff --git a/nx.json b/nx.json index 7f7de57643..bbf5b08f6f 100644 --- a/nx.json +++ b/nx.json @@ -139,6 +139,9 @@ "remix-ui-vertical-icons-panel": { "tags": [] }, + "remix-ui-search": { + "tags": [] + }, "remix-ui-home-tab": { "tags": [] }, diff --git a/package-lock.json b/package-lock.json index 18feb9d161..c72f9cbe60 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9782,46 +9782,46 @@ "integrity": "sha512-IXf3XA7+XyN7CP9gGh/XB0UxVMlvARGEgGXLubFICsUMGz6Q+DU+i4gGlpOxTjKvXjkJDJC8YdqdKkDj9qZHEQ==" }, "@remixproject/engine": { - "version": "0.3.26", - "resolved": "https://registry.npmjs.org/@remixproject/engine/-/engine-0.3.26.tgz", - "integrity": "sha512-6Rq6aTUyhtXAaoQamAI8ocFSVy2txpGwu1aoYZGrqova/p/tRWn4/+PU713sffyiAQVBCk7C1z/5VKLm7tUYrQ==", + "version": "0.3.28", + "resolved": "https://registry.npmjs.org/@remixproject/engine/-/engine-0.3.28.tgz", + "integrity": "sha512-27SHaCrG3KrPfMa1MYud4tE9xUIJKITEUsql99fhN7x12lOmgGZFjiqIG/WWjCMmT7OMG3vtLayiZrsYkzHCVw==", "requires": { - "@remixproject/plugin-api": "0.3.26", - "@remixproject/plugin-utils": "0.3.26" + "@remixproject/plugin-api": "0.3.28", + "@remixproject/plugin-utils": "0.3.28" } }, "@remixproject/engine-web": { - "version": "0.3.26", - "resolved": "https://registry.npmjs.org/@remixproject/engine-web/-/engine-web-0.3.26.tgz", - "integrity": "sha512-QSW9KVOgHWuRDNqTZIp1jjBeDOXlXQZWYABgljTsC+Nig8EwlyRTfIza9PuCb+MDYT/kID8VgSPXnMrlOtvhjQ==", + "version": "0.3.28", + "resolved": "https://registry.npmjs.org/@remixproject/engine-web/-/engine-web-0.3.28.tgz", + "integrity": "sha512-JTwTuonW+pI7WsSsgGHAzPynGjIdG34VnPrspR9XKBQO4+NX7m3lbNIMUUviyrbqIoGiGtgYd/ry98uLpTHr4g==", "requires": { - "@remixproject/engine": "0.3.26", - "@remixproject/plugin-api": "0.3.26", - "@remixproject/plugin-utils": "0.3.26" + "@remixproject/engine": "0.3.28", + "@remixproject/plugin-api": "0.3.28", + "@remixproject/plugin-utils": "0.3.28" } }, "@remixproject/plugin": { - "version": "0.3.26", - "resolved": "https://registry.npmjs.org/@remixproject/plugin/-/plugin-0.3.26.tgz", - "integrity": "sha512-j0sgl4yDOVJLCuRWOEb/Wo9/fumrWlIpsO0MrtficuhVc1FGhZxKVv8Vdu3x3HgWhXkuhLUMs8VoJ1Ntd9ZkUQ==", + "version": "0.3.28", + "resolved": "https://registry.npmjs.org/@remixproject/plugin/-/plugin-0.3.28.tgz", + "integrity": "sha512-sw+cow3GKAcEacXLvdJwtHHIphPty4KRMZ6tcQHdtx/iCKTMNdw2hribKPnvTO+6mXE+4oAKCrFqeTdVp/rd1w==", "requires": { - "@remixproject/plugin-api": "0.3.26", - "@remixproject/plugin-utils": "0.3.26", + "@remixproject/plugin-api": "0.3.28", + "@remixproject/plugin-utils": "0.3.28", "events": "3.2.0" } }, "@remixproject/plugin-api": { - "version": "0.3.26", - "resolved": "https://registry.npmjs.org/@remixproject/plugin-api/-/plugin-api-0.3.26.tgz", - "integrity": "sha512-6vR9nVF4EfXDHA0r8MrlLyVYRMJMG7J3Y3jzpaAumetW+YpvfJqgE/uhGgm2me2ypDM8vW0POQGhRaGeZTGwFg==", + "version": "0.3.28", + "resolved": "https://registry.npmjs.org/@remixproject/plugin-api/-/plugin-api-0.3.28.tgz", + "integrity": "sha512-tOzVFR504037weEkNHQGZsk+Ebxcu/xnBsVCkJaQaBMb+H/i6YevKQmoR1aGcH+JfQxc8eS8LGC65MaV8zmcWg==", "requires": { - "@remixproject/plugin-utils": "0.3.26" + "@remixproject/plugin-utils": "0.3.28" } }, "@remixproject/plugin-utils": { - "version": "0.3.26", - "resolved": "https://registry.npmjs.org/@remixproject/plugin-utils/-/plugin-utils-0.3.26.tgz", - "integrity": "sha512-K/v+TXYOMV13dLf1LEgiF7CfqbOc105hC/2oapkSoHKSf3WVyWIUDlBsChRQl7osfUs/zT93q2+jNlLofWQUxg==", + "version": "0.3.28", + "resolved": "https://registry.npmjs.org/@remixproject/plugin-utils/-/plugin-utils-0.3.28.tgz", + "integrity": "sha512-5CayTgMqRiOguanTy6kpuRgCmjEFLUu2K4Rs7Zmt+GOzHucmwkDxYQO+3hFv0Jz/M/6yC5wkKYTx8vfPLLdEBQ==", "requires": { "tslib": "2.0.1" }, @@ -9834,13 +9834,13 @@ } }, "@remixproject/plugin-webview": { - "version": "0.3.26", - "resolved": "https://registry.npmjs.org/@remixproject/plugin-webview/-/plugin-webview-0.3.26.tgz", - "integrity": "sha512-hqWaFapUfcAX2Odsj0ANKvLXQbkzZ/xNONMqE0wRxFRYTIhFGZqFzJVzwSD+U4bSehP1JtzkrxwKBqNyjz5GxQ==", + "version": "0.3.28", + "resolved": "https://registry.npmjs.org/@remixproject/plugin-webview/-/plugin-webview-0.3.28.tgz", + "integrity": "sha512-DodSkN0vMSo2DEEoBOWyKxC/ElvBA826vhX+JVGXA8HGS45aavplZIN967hsc+SdzjV1UZfSNKEHttLGwM1BIw==", "requires": { - "@remixproject/plugin": "0.3.26", - "@remixproject/plugin-api": "0.3.26", - "@remixproject/plugin-utils": "0.3.26", + "@remixproject/plugin": "0.3.28", + "@remixproject/plugin-api": "0.3.28", + "@remixproject/plugin-utils": "0.3.28", "axios": "^0.21.1" }, "dependencies": { @@ -9855,13 +9855,13 @@ } }, "@remixproject/plugin-ws": { - "version": "0.3.26", - "resolved": "https://registry.npmjs.org/@remixproject/plugin-ws/-/plugin-ws-0.3.26.tgz", - "integrity": "sha512-Nerd/2vGb96G6B8pGRCRNAGlO97KnJpbFmpa47SYipgjaq5Yj5iCUY+fbQzMWdGW2W4BrUPE+YBZCkq/KlfbGw==", + "version": "0.3.28", + "resolved": "https://registry.npmjs.org/@remixproject/plugin-ws/-/plugin-ws-0.3.28.tgz", + "integrity": "sha512-i3He9t4qvcBQxzshFx66D6drqLlySmV7Cb+NeYtMOYlWxQSJtUakp/Px1Tl3IDFQXDfpXxvDvYhn2w0AWPBOqw==", "requires": { - "@remixproject/plugin": "0.3.26", - "@remixproject/plugin-api": "0.3.26", - "@remixproject/plugin-utils": "0.3.26" + "@remixproject/plugin": "0.3.28", + "@remixproject/plugin-api": "0.3.28", + "@remixproject/plugin-utils": "0.3.28" } }, "@restart/context": { diff --git a/tsconfig.base.json b/tsconfig.base.json index 8105a813ef..d9e148acdb 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -40,6 +40,7 @@ ], "@remix-project/remixd": ["dist/libs/remixd/index.js"], "@remix-ui/tree-view": ["libs/remix-ui/tree-view/src/index.ts"], + "@remix-ui/search": ["libs/remix-ui/search/src/index.ts"], "@remix-ui/debugger-ui": ["libs/remix-ui/debugger-ui/src/index.ts"], "@remix-ui/utils": ["libs/remix-ui/utils/src/index.ts"], "@remix-ui/clipboard": ["libs/remix-ui/clipboard/src/index.ts"], diff --git a/workspace.json b/workspace.json index dc00725dc8..98dcecd3ff 100644 --- a/workspace.json +++ b/workspace.json @@ -1108,6 +1108,21 @@ } } }, + "remix-ui-search": { + "root": "libs/remix-ui/search", + "sourceRoot": "libs/remix-ui/search/src", + "projectType": "library", + "architect": { + "lint": { + "builder": "@nrwl/linter:lint", + "options": { + "linter": "eslint", + "tsConfig": ["libs/remix-ui/search/tsconfig.lib.json"], + "exclude": ["**/node_modules/**", "!libs/remix-ui/search/**/*"] + } + } + } + }, "remix-ui-panel": { "root": "libs/remix-ui/panel", "sourceRoot": "libs/remix-ui/panel/src", From fe21ad5b6496322feea65536f78ca9a9a4401ae7 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Sat, 19 Feb 2022 15:38:09 +0100 Subject: [PATCH 042/217] components --- .../search/src/lib/components/Exclude.tsx | 26 +++ .../search/src/lib/components/Find.tsx | 51 ++++-- .../search/src/lib/components/Include.tsx | 22 +++ .../search/src/lib/components/Replace.tsx | 16 +- .../search/src/lib/components/Search.tsx | 18 +-- .../lib/components/results/ResultFileName.tsx | 20 +++ .../src/lib/components/results/ResultItem.tsx | 64 ++++++++ .../lib/components/results/ResultSummary.tsx | 34 ++++ .../src/lib/components/results/Results.tsx | 151 ++++++++++-------- .../lib/components/results/SearchHelper.ts | 45 ++++++ .../search/src/lib/context/context.tsx | 27 +++- .../search/src/lib/reducers/Reducer.ts | 31 +++- libs/remix-ui/search/src/lib/search.css | 26 +++ package.json | 1 + 14 files changed, 426 insertions(+), 106 deletions(-) create mode 100644 libs/remix-ui/search/src/lib/components/results/SearchHelper.ts create mode 100644 libs/remix-ui/search/src/lib/search.css diff --git a/libs/remix-ui/search/src/lib/components/Exclude.tsx b/libs/remix-ui/search/src/lib/components/Exclude.tsx index e69de29bb2..e755f1370e 100644 --- a/libs/remix-ui/search/src/lib/components/Exclude.tsx +++ b/libs/remix-ui/search/src/lib/components/Exclude.tsx @@ -0,0 +1,26 @@ +import React, { useContext, useEffect } from 'react' +import { SearchContext } from '../context/context' + +export const Exclude = props => { + const { setExclude } = useContext(SearchContext) + const change = e => { + const timeOutId = setTimeout(() => setExclude(e.target.value), 500) + return () => clearTimeout(timeOutId) + } + + useEffect(() => { + setExclude('.git/**') + }, []) + + return ( + <> +
+ +
+ + ) +} diff --git a/libs/remix-ui/search/src/lib/components/Find.tsx b/libs/remix-ui/search/src/lib/components/Find.tsx index db8cb94463..ef15cb1c81 100644 --- a/libs/remix-ui/search/src/lib/components/Find.tsx +++ b/libs/remix-ui/search/src/lib/components/Find.tsx @@ -1,17 +1,40 @@ -import React, { useContext, useReducer } from "react" -import { SearchContext } from "../context/context" -import { SearchingInitialState, SearchReducer } from "../reducers/Reducer" - - +import React, { useContext } from 'react' +import { SearchContext } from '../context/context' export const Find = props => { + const { setFind } = useContext(SearchContext) + const change = e => { + const timeOutId = setTimeout(() => setFind(e.target.value), 500) + return () => clearTimeout(timeOutId) + } - const { setFind } = useContext(SearchContext) - const change = (e) => { - setFind(e.target.value) - } - - return(<> - - ) -} \ No newline at end of file + return ( + <> +
+ + {/*
+
+
+
*/} +
+ + ) +} diff --git a/libs/remix-ui/search/src/lib/components/Include.tsx b/libs/remix-ui/search/src/lib/components/Include.tsx index e69de29bb2..bea364a6c9 100644 --- a/libs/remix-ui/search/src/lib/components/Include.tsx +++ b/libs/remix-ui/search/src/lib/components/Include.tsx @@ -0,0 +1,22 @@ +import React, { useContext } from 'react' +import { SearchContext } from '../context/context' + +export const Include = props => { + const { setInclude } = useContext(SearchContext) + const change = e => { + const timeOutId = setTimeout(() => setInclude(e.target.value), 500) + return () => clearTimeout(timeOutId) + } + + return ( + <> +
+ +
+ + ) +} diff --git a/libs/remix-ui/search/src/lib/components/Replace.tsx b/libs/remix-ui/search/src/lib/components/Replace.tsx index fc60d3d73a..28712774ca 100644 --- a/libs/remix-ui/search/src/lib/components/Replace.tsx +++ b/libs/remix-ui/search/src/lib/components/Replace.tsx @@ -1,16 +1,22 @@ -import React, { useContext, useEffect } from 'react' +import React, { useContext } from 'react' import { SearchContext } from '../context/context' export const Replace = props => { - const { state, setReplace } = useContext(SearchContext) - + const { setReplace } = useContext(SearchContext) const change = e => { - setReplace(e.target.value) + const timeOutId = setTimeout(() => setReplace(e.target.value), 500) + return () => clearTimeout(timeOutId) } return ( <> - +
+ +
) } diff --git a/libs/remix-ui/search/src/lib/components/Search.tsx b/libs/remix-ui/search/src/lib/components/Search.tsx index e9d2df1097..913e00eab2 100644 --- a/libs/remix-ui/search/src/lib/components/Search.tsx +++ b/libs/remix-ui/search/src/lib/components/Search.tsx @@ -1,23 +1,21 @@ -import React, { useContext, useEffect, useReducer } from 'react' -import { SearchContext, SearchProvider } from '../context/context' -import { SearchingInitialState, SearchReducer } from '../reducers/Reducer' +import React from 'react' +import { SearchProvider } from '../context/context' import { Find } from './Find' -import { Replace } from './Replace' import { Results } from './results/Results' +import '../search.css' +import { Include } from './Include' +import { Exclude } from './Exclude' export const SearchTab = props => { const plugin = props.plugin -useEffect(() => { - console.log (plugin) -},[]) - return ( <> - + - + + diff --git a/libs/remix-ui/search/src/lib/components/results/ResultFileName.tsx b/libs/remix-ui/search/src/lib/components/results/ResultFileName.tsx index e69de29bb2..2d297a078a 100644 --- a/libs/remix-ui/search/src/lib/components/results/ResultFileName.tsx +++ b/libs/remix-ui/search/src/lib/components/results/ResultFileName.tsx @@ -0,0 +1,20 @@ +import { ViewPlugin } from '@remixproject/engine-web' +import React, { useContext, useEffect } from 'react' +import { SearchContext } from '../../context/context' +import { SearchResult } from '../../reducers/Reducer' + +interface ResultItemProps { + file: SearchResult +} + +export const ResultFileName = (props: ResultItemProps) => { + return ( +
+
+ + {props.file.filename} + +
+
+ ) +} diff --git a/libs/remix-ui/search/src/lib/components/results/ResultItem.tsx b/libs/remix-ui/search/src/lib/components/results/ResultItem.tsx index e69de29bb2..54785a714d 100644 --- a/libs/remix-ui/search/src/lib/components/results/ResultItem.tsx +++ b/libs/remix-ui/search/src/lib/components/results/ResultItem.tsx @@ -0,0 +1,64 @@ +import { ViewPlugin } from '@remixproject/engine-web' +import React, { useContext, useEffect, useState } from 'react' +import { SearchContext } from '../../context/context' +import { SearchResult, SearchResultLine } from '../../reducers/Reducer' +import { ResultFileName } from './ResultFileName' +import { ResultSummary } from './ResultSummary' + +interface ResultItemProps { + file: SearchResult +} + +export const ResultItem = (props: ResultItemProps) => { + const { state, findText } = useContext(SearchContext) + + const [lines, setLines] = useState([]) + const [toggleExpander, setToggleExpander] = useState(false) + + useEffect(() => { + if (!props.file.searchComplete) { + // console.log('searching for: ' + props.file.filename) + } + }, [props.file.searchComplete]) + + const toggleClass = () => { + setToggleExpander(!toggleExpander) + } + + useEffect(() => { + if (!props.file.searchComplete) { + findText(props.file.filename).then(res => { + setLines(res) + }) + } + }, [state.find]) + + return ( + <> + {lines && lines.length ? ( + <> +
+ {' '} + +
+ {!toggleExpander ? ( +
    + {lines.map((line, index) => ( + + ))} +
+ ) : null} + + ) : ( + <> + )} + + ) +} diff --git a/libs/remix-ui/search/src/lib/components/results/ResultSummary.tsx b/libs/remix-ui/search/src/lib/components/results/ResultSummary.tsx index e69de29bb2..f86d842212 100644 --- a/libs/remix-ui/search/src/lib/components/results/ResultSummary.tsx +++ b/libs/remix-ui/search/src/lib/components/results/ResultSummary.tsx @@ -0,0 +1,34 @@ +import { ViewPlugin } from '@remixproject/engine-web' +import React, { useContext, useEffect, useState } from 'react' +import { SearchContext } from '../../context/context' +import { SearchResult, SearchResultLine, SearchResultLineLine } from '../../reducers/Reducer' +import { ResultFileName } from './ResultFileName' + +interface ResultSummaryProps { + searchResult: SearchResult + line: SearchResultLine +} + +export const ResultSummary = (props: ResultSummaryProps) => { + const { hightLightInPath } = useContext(SearchContext) + const selectLine = async (line: SearchResultLineLine) => { + console.log(line, props.searchResult) + await hightLightInPath(props.searchResult, line) + } + return ( +
  • + {props.line.lines.map((lineItem, index) => ( +
    { + selectLine(lineItem) + }} + key={index} + > + {lineItem.left.substring(lineItem.left.length - 20)} + {lineItem.center} + {lineItem.right.substring(0, 100)} +
    + ))} +
  • + ) +} diff --git a/libs/remix-ui/search/src/lib/components/results/Results.tsx b/libs/remix-ui/search/src/lib/components/results/Results.tsx index 7514c51e98..ca109573fb 100644 --- a/libs/remix-ui/search/src/lib/components/results/Results.tsx +++ b/libs/remix-ui/search/src/lib/components/results/Results.tsx @@ -1,81 +1,98 @@ -import { ViewPlugin } from "@remixproject/engine-web" -import React, { useContext, useEffect } from "react" -import { SearchContext } from "../../context/context" -import { SearchResult } from "../../reducers/Reducer" +import { ViewPlugin } from '@remixproject/engine-web' +import { matches } from 'lodash' +import React, { useContext, useEffect, useState } from 'react' +import { SearchContext } from '../../context/context' +import { SearchResult, SearchResultLine } from '../../reducers/Reducer' +import { ResultItem } from './ResultItem' +import { findLinesInStringWithMatch } from './SearchHelper' +const filePathFilter = require('@jsdevtools/file-path-filter') interface ResultsProps { - plugin: ViewPlugin + plugin: ViewPlugin } export const Results = (props: ResultsProps) => { + const { state, setSearchResults, setFind } = useContext(SearchContext) + const [ alertText, setAlertText ] = useState('') + const { plugin } = props - const { state, setSearchResults } = useContext(SearchContext) - - const { plugin } = props - - const getDirectory = async (dir) => { - let result = [] - const files = await plugin.call('fileManager', 'readdir', dir) - const fileArray = normalize(files) - for (const fi of fileArray) { - if (fi) { - const type = fi.data.isDirectory - if (type === true) { - result = [ - ...result, - ...(await getDirectory( - `${fi.filename}` - )) - ] - } else { - result = [...result, fi.filename] - } - } + const getDirectory = async (dir: string) => { + let result = [] + const files = await plugin.call('fileManager', 'readdir', dir) + const fileArray = normalize(files) + for (const fi of fileArray) { + if (fi) { + const type = fi.data.isDirectory + if (type === true) { + result = [...result, ...(await getDirectory(`${fi.filename}`))] + } else { + result = [...result, fi.filename] } - return result + } } + return result + } - const normalize = (filesList) => { - const folders = [] - const files = [] - Object.keys(filesList || {}).forEach(key => { - if (filesList[key].isDirectory) { - folders.push({ - filename: key, - data: filesList[key] - }) - } else { - files.push({ - filename: key, - data: filesList[key] - }) - } + const normalize = filesList => { + const folders = [] + const files = [] + Object.keys(filesList || {}).forEach(key => { + if (filesList[key].isDirectory) { + folders.push({ + filename: key, + data: filesList[key] + }) + } else { + files.push({ + filename: key, + data: filesList[key] }) - return [...folders, ...files] } + }) + return [...folders, ...files] + } - useEffect(() => { - if (state.find) { - getDirectory('/').then(res => { - const ob = res.map(file => { - const r:SearchResult = { - filename: file, - lines: [], - path: file, - searchComplete: false - } - return r - }) - console.log(ob) - setSearchResults(ob) - }) - } - },[state.find]) + useEffect(() => { + plugin.on('filePanel', 'setWorkspace', () => { + setSearchResults(null) + }) + return () => plugin.off('filePanel', 'setWorkspace') + }, []) + useEffect(() => { + if (state.find) { + (async () => { + const res = await getDirectory('/') + const pathFilter: any = {} + if (state.include) + pathFilter.include = state.include.split(',').map(i => i.trim()) + if (state.exclude) + pathFilter.exclude = state.exclude.split(',').map(i => i.trim()) + const ob = res.filter(filePathFilter(pathFilter)).map(file => { + const r: SearchResult = { + filename: file, + lines: [], + path: file, + searchComplete: false + } + return r + }) + setSearchResults(ob) + })() + } + }, [state.find, state.replace, state.include, state.exclude]) - useEffect(() => { - console.log(state.searchResults) - },[state.searchResults]) - - return(<>) -} \ No newline at end of file + return ( + <> + {alertText ? ( +
    + {alertText} +
    + ) : null} + {state.searchResults && + state.searchResults.map((result, index) => { + return + })} + + ) +} diff --git a/libs/remix-ui/search/src/lib/components/results/SearchHelper.ts b/libs/remix-ui/search/src/lib/components/results/SearchHelper.ts new file mode 100644 index 0000000000..3e41e418ca --- /dev/null +++ b/libs/remix-ui/search/src/lib/components/results/SearchHelper.ts @@ -0,0 +1,45 @@ +import { SearchResultLineLine } from "../../reducers/Reducer" + +export const findLinesInStringWithMatch = (str: string, re: RegExp) => { + return str + .split(/\r?\n/) + .map(function (line, i) { + const matchResult = matchesInString(line, re) + if (matchResult.length) { + return { + lines: splitLines(matchResult, i), + } + } + }) + .filter(Boolean) +} + +const matchesInString = (str: string, re: RegExp) => { + let a: RegExpExecArray + let results:RegExpExecArray[] = []; + while ((a = re.exec(str || '')) !== null) { + results.push(a); + } + return results +} + +const splitLines = (matchResult: RegExpExecArray[], lineNumber: number) => { + return matchResult.map((matchResultPart, i) => { + const result:SearchResultLineLine = { + left: matchResultPart.input.substring(0, matchResultPart.index), + right: matchResultPart.input.substring(matchResultPart.index + matchResultPart[0].length), + center: matchResultPart[0], + position : { + start: { + line: lineNumber, + column: matchResultPart.index, + }, + end: { + line: lineNumber, + column: matchResultPart.index + matchResultPart[0].length, + }, + }, + } + return result + }) +} diff --git a/libs/remix-ui/search/src/lib/context/context.tsx b/libs/remix-ui/search/src/lib/context/context.tsx index 4b696f948e..1762d7c367 100644 --- a/libs/remix-ui/search/src/lib/context/context.tsx +++ b/libs/remix-ui/search/src/lib/context/context.tsx @@ -1,9 +1,12 @@ import React from 'react' import { createContext, useReducer } from 'react' +import { findLinesInStringWithMatch } from '../components/results/SearchHelper' import { SearchingInitialState, SearchReducer, SearchResult, + SearchResultLine, + SearchResultLineLine, SearchState } from '../reducers/Reducer' @@ -17,6 +20,8 @@ export interface SearchingStateInterface { setRegex: (value: boolean) => void, setWholeWord: (value: boolean) => void, setSearchResults: (value: SearchResult[]) => void, + findText: (path: string) => Promise, + hightLightInPath: (path:SearchResult, line:SearchResultLineLine) => void, } export const SearchContext = createContext(null) @@ -24,13 +29,15 @@ export const SearchContext = createContext(null) export const SearchProvider = ({ children = [], reducer = SearchReducer, - initialState = SearchingInitialState + initialState = SearchingInitialState, + plugin = undefined } = {}) => { const [state, dispatch] = useReducer(reducer, initialState) const value = { state, setFind: (value: string) => { + console.log('setFind: ' + value) dispatch({ type: 'SET_FIND', payload: value @@ -77,7 +84,23 @@ export const SearchProvider = ({ type: 'SET_SEARCH_RESULTS', payload: value }) - } + }, + findText : async (path: string) => { + if(!plugin) return + try { + if(state.find.length < 3) return + const text = await plugin.call('fileManager', 'readFile', path) + const re = new RegExp(state.find, 'gi') + const result: SearchResultLine[] = findLinesInStringWithMatch(text, re) + // console.log(result, path) + return result + } catch (e) {} + }, + hightLightInPath: async(result: SearchResult, line: SearchResultLineLine) => { + await plugin.call('editor', 'discardHighlight') + await plugin.call('editor', 'highlight', line.position, result.path) + } + } return ( diff --git a/libs/remix-ui/search/src/lib/reducers/Reducer.ts b/libs/remix-ui/search/src/lib/reducers/Reducer.ts index e0cc2a4b0c..c4a6742a08 100644 --- a/libs/remix-ui/search/src/lib/reducers/Reducer.ts +++ b/libs/remix-ui/search/src/lib/reducers/Reducer.ts @@ -4,9 +4,25 @@ interface Action { payload: any } +interface position { + start: { + line: number + column: number + }, + end: { + line: number + column: number + } + } + +export interface SearchResultLineLine { + left: any, + center: any, + right: any, + position: position +} export interface SearchResultLine { - lineNumber: number - text: string + lines: SearchResultLineLine[] } export interface SearchResult { @@ -33,38 +49,37 @@ export const SearchingInitialState: SearchState = { } export const SearchReducer = (state: SearchState = SearchingInitialState, action: Action) => { - console.log(state) switch (action.type) { case 'SET_FIND': return { ...state, find: action.payload, } - break; + case 'SET_REPLACE': return { ...state, replace: action.payload, } - break; + case 'SET_INCLUDE': return { ...state, include: action.payload, } - break; + case 'SET_EXCLUDE': return { ...state, exclude: action.payload, } - break; + case 'SET_SEARCH_RESULTS': return { ...state, searchResults: action.payload, } - break; + default: } } \ No newline at end of file diff --git a/libs/remix-ui/search/src/lib/search.css b/libs/remix-ui/search/src/lib/search.css new file mode 100644 index 0000000000..a7b9326785 --- /dev/null +++ b/libs/remix-ui/search/src/lib/search.css @@ -0,0 +1,26 @@ +.search_result_item_title { + display: flex; + -webkit-user-select: none; /* Safari */ + -moz-user-select: none; /* Firefox */ + -ms-user-select: none; /* IE10+/Edge */ + user-select: none; /* Standard */ + cursor: pointer; +} + +.wrap_summary { + overflow: hidden; + white-space: nowrap; + -webkit-user-select: none; /* Safari */ + -moz-user-select: none; /* Firefox */ + -ms-user-select: none; /* IE10+/Edge */ + user-select: none; /* Standard */ + cursor: pointer; +} + +.find-part { + display: flex; +} + +.controls { + display: flex; +} \ No newline at end of file diff --git a/package.json b/package.json index 3585888453..a38866094a 100644 --- a/package.json +++ b/package.json @@ -171,6 +171,7 @@ "ethers": "^5.4.2", "ethjs-util": "^0.1.6", "express-ws": "^4.0.0", + "file-path-filter": "^3.0.2", "file-saver": "^2.0.5", "form-data": "^4.0.0", "fs-extra": "^3.0.1", From 658cff4810f01ddf260dbd6dd363e3a6220adc48 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Sun, 20 Feb 2022 15:13:26 +0100 Subject: [PATCH 043/217] tools ready to test --- .../contracts/app/ethereum/constitution.sol | 2 +- .../search/src/lib/components/Exclude.tsx | 10 +- .../search/src/lib/components/Find.tsx | 62 +++++++----- .../search/src/lib/components/Include.tsx | 1 + .../search/src/lib/components/Replace.tsx | 1 + .../search/src/lib/components/Search.tsx | 6 +- .../lib/components/results/ResultFileName.tsx | 8 +- .../src/lib/components/results/ResultItem.tsx | 40 ++++---- .../lib/components/results/ResultSummary.tsx | 38 +++++--- .../src/lib/components/results/Results.tsx | 78 +-------------- .../lib/components/results/SearchHelper.ts | 65 ++++++++++++- .../search/src/lib/context/context.tsx | 94 ++++++++++++++++--- .../search/src/lib/reducers/Reducer.ts | 77 ++++++--------- libs/remix-ui/search/src/lib/search.css | 62 ++++++++++++ libs/remix-ui/search/src/lib/types/index.ts | 55 +++++++++++ 15 files changed, 396 insertions(+), 203 deletions(-) create mode 100644 libs/remix-ui/search/src/lib/types/index.ts diff --git a/apps/remix-ide/contracts/app/ethereum/constitution.sol b/apps/remix-ide/contracts/app/ethereum/constitution.sol index 8c2c9e0da9..ff36bdb9c8 100644 --- a/apps/remix-ide/contracts/app/ethereum/constitution.sol +++ b/apps/remix-ide/contracts/app/ethereum/constitution.sol @@ -1,4 +1,4 @@ -contract Constitution { + Constitution { function Found(uint8 _numProposals) { proposals.length = _numProposals; diff --git a/libs/remix-ui/search/src/lib/components/Exclude.tsx b/libs/remix-ui/search/src/lib/components/Exclude.tsx index e755f1370e..c836183157 100644 --- a/libs/remix-ui/search/src/lib/components/Exclude.tsx +++ b/libs/remix-ui/search/src/lib/components/Exclude.tsx @@ -1,9 +1,11 @@ -import React, { useContext, useEffect } from 'react' +import React, { useContext, useEffect, useState } from 'react' import { SearchContext } from '../context/context' export const Exclude = props => { - const { setExclude } = useContext(SearchContext) + const { setExclude, state } = useContext(SearchContext) + const [str, setStr] = useState('.git/**/*,.deps/**/*') const change = e => { + setStr(e.target.value) const timeOutId = setTimeout(() => setExclude(e.target.value), 500) return () => clearTimeout(timeOutId) } @@ -15,10 +17,12 @@ export const Exclude = props => { return ( <>
    +
    diff --git a/libs/remix-ui/search/src/lib/components/Find.tsx b/libs/remix-ui/search/src/lib/components/Find.tsx index ef15cb1c81..e1e861b620 100644 --- a/libs/remix-ui/search/src/lib/components/Find.tsx +++ b/libs/remix-ui/search/src/lib/components/Find.tsx @@ -2,38 +2,48 @@ import React, { useContext } from 'react' import { SearchContext } from '../context/context' export const Find = props => { - const { setFind } = useContext(SearchContext) + const { setFind, state, toggleCaseSensitive, toggleMatchWholeWord } = useContext(SearchContext) + let timeOutId: any = null const change = e => { - const timeOutId = setTimeout(() => setFind(e.target.value), 500) - return () => clearTimeout(timeOutId) + clearTimeout(timeOutId) + timeOutId = setTimeout(() => setFind(e.target.value), 500) } return ( <>
    - - {/*
    -
    -
    -
    */} + +
    + +
    +
    { + toggleCaseSensitive() + }} + >
    +
    { + toggleMatchWholeWord() + }} + >
    +
    +
    ) diff --git a/libs/remix-ui/search/src/lib/components/Include.tsx b/libs/remix-ui/search/src/lib/components/Include.tsx index bea364a6c9..a59dd11988 100644 --- a/libs/remix-ui/search/src/lib/components/Include.tsx +++ b/libs/remix-ui/search/src/lib/components/Include.tsx @@ -11,6 +11,7 @@ export const Include = props => { return ( <>
    + { return ( <>
    + { @@ -12,12 +13,15 @@ const plugin = props.plugin return ( <> +
    + - + +
    ) } diff --git a/libs/remix-ui/search/src/lib/components/results/ResultFileName.tsx b/libs/remix-ui/search/src/lib/components/results/ResultFileName.tsx index 2d297a078a..8df5162bbe 100644 --- a/libs/remix-ui/search/src/lib/components/results/ResultFileName.tsx +++ b/libs/remix-ui/search/src/lib/components/results/ResultFileName.tsx @@ -1,7 +1,5 @@ -import { ViewPlugin } from '@remixproject/engine-web' -import React, { useContext, useEffect } from 'react' -import { SearchContext } from '../../context/context' -import { SearchResult } from '../../reducers/Reducer' +import React from 'react' +import { SearchResult } from '../../types' interface ResultItemProps { file: SearchResult @@ -9,7 +7,7 @@ interface ResultItemProps { export const ResultFileName = (props: ResultItemProps) => { return ( -
    +
    {props.file.filename} diff --git a/libs/remix-ui/search/src/lib/components/results/ResultItem.tsx b/libs/remix-ui/search/src/lib/components/results/ResultItem.tsx index 54785a714d..baf61ecaca 100644 --- a/libs/remix-ui/search/src/lib/components/results/ResultItem.tsx +++ b/libs/remix-ui/search/src/lib/components/results/ResultItem.tsx @@ -1,7 +1,6 @@ -import { ViewPlugin } from '@remixproject/engine-web' import React, { useContext, useEffect, useState } from 'react' import { SearchContext } from '../../context/context' -import { SearchResult, SearchResultLine } from '../../reducers/Reducer' +import { SearchResult, SearchResultLine } from '../../types' import { ResultFileName } from './ResultFileName' import { ResultSummary } from './ResultSummary' @@ -11,34 +10,35 @@ interface ResultItemProps { export const ResultItem = (props: ResultItemProps) => { const { state, findText } = useContext(SearchContext) - + const [loading, setLoading] = useState(false) const [lines, setLines] = useState([]) const [toggleExpander, setToggleExpander] = useState(false) useEffect(() => { - if (!props.file.searchComplete) { - // console.log('searching for: ' + props.file.filename) - } - }, [props.file.searchComplete]) + reload() + }, [props.file.timeStamp]) const toggleClass = () => { setToggleExpander(!toggleExpander) } useEffect(() => { - if (!props.file.searchComplete) { - findText(props.file.filename).then(res => { - setLines(res) - }) - } + reload() }, [state.find]) + const reload = () => { + findText(props.file.filename).then(res => { + setLines(res) + setLoading(false) + }) + } + return ( <> {lines && lines.length ? ( <>
    - {' '}
    - {!toggleExpander ? ( -
      + {loading ?
      Loading...
      : null} + {!toggleExpander && !loading ? ( +
      {lines.map((line, index) => ( - + ))} -
    +
    ) : null} ) : ( diff --git a/libs/remix-ui/search/src/lib/components/results/ResultSummary.tsx b/libs/remix-ui/search/src/lib/components/results/ResultSummary.tsx index f86d842212..f215e8c50e 100644 --- a/libs/remix-ui/search/src/lib/components/results/ResultSummary.tsx +++ b/libs/remix-ui/search/src/lib/components/results/ResultSummary.tsx @@ -1,34 +1,48 @@ -import { ViewPlugin } from '@remixproject/engine-web' -import React, { useContext, useEffect, useState } from 'react' +import React, { useContext } from 'react' import { SearchContext } from '../../context/context' -import { SearchResult, SearchResultLine, SearchResultLineLine } from '../../reducers/Reducer' -import { ResultFileName } from './ResultFileName' +import { SearchResult, SearchResultLine, SearchResultLineLine } from '../../types' interface ResultSummaryProps { searchResult: SearchResult line: SearchResultLine + setLoading: (value: boolean) => void } export const ResultSummary = (props: ResultSummaryProps) => { - const { hightLightInPath } = useContext(SearchContext) + const { hightLightInPath, replaceText, state } = useContext(SearchContext) + const selectLine = async (line: SearchResultLineLine) => { - console.log(line, props.searchResult) await hightLightInPath(props.searchResult, line) } + + const replace = async (line: SearchResultLineLine) => { + props.setLoading(true) + await replaceText(props.searchResult, line) + } + return ( -
  • + <> {props.line.lines.map((lineItem, index) => ( +
    { selectLine(lineItem) }} - key={index} + key={props.searchResult.filename} + className='search_line pb-1' > - {lineItem.left.substring(lineItem.left.length - 20)} - {lineItem.center} - {lineItem.right.substring(0, 100)} +
    {lineItem.left.substring(lineItem.left.length - 20)}
    + {lineItem.center} + {state.replace? {state.replace}:<>} +
    {lineItem.right.substring(0, 100)}
    +
    +
    +
    { + replace(lineItem) + }} className="codicon codicon-find-replace" role="button" aria-label="Replace" aria-disabled="false">
    +
    ))} -
  • + ) } diff --git a/libs/remix-ui/search/src/lib/components/results/Results.tsx b/libs/remix-ui/search/src/lib/components/results/Results.tsx index ca109573fb..32efca1484 100644 --- a/libs/remix-ui/search/src/lib/components/results/Results.tsx +++ b/libs/remix-ui/search/src/lib/components/results/Results.tsx @@ -1,86 +1,12 @@ -import { ViewPlugin } from '@remixproject/engine-web' -import { matches } from 'lodash' import React, { useContext, useEffect, useState } from 'react' import { SearchContext } from '../../context/context' -import { SearchResult, SearchResultLine } from '../../reducers/Reducer' import { ResultItem } from './ResultItem' -import { findLinesInStringWithMatch } from './SearchHelper' -const filePathFilter = require('@jsdevtools/file-path-filter') - interface ResultsProps { - plugin: ViewPlugin } export const Results = (props: ResultsProps) => { - const { state, setSearchResults, setFind } = useContext(SearchContext) - const [ alertText, setAlertText ] = useState('') - const { plugin } = props - - const getDirectory = async (dir: string) => { - let result = [] - const files = await plugin.call('fileManager', 'readdir', dir) - const fileArray = normalize(files) - for (const fi of fileArray) { - if (fi) { - const type = fi.data.isDirectory - if (type === true) { - result = [...result, ...(await getDirectory(`${fi.filename}`))] - } else { - result = [...result, fi.filename] - } - } - } - return result - } - - const normalize = filesList => { - const folders = [] - const files = [] - Object.keys(filesList || {}).forEach(key => { - if (filesList[key].isDirectory) { - folders.push({ - filename: key, - data: filesList[key] - }) - } else { - files.push({ - filename: key, - data: filesList[key] - }) - } - }) - return [...folders, ...files] - } - - useEffect(() => { - plugin.on('filePanel', 'setWorkspace', () => { - setSearchResults(null) - }) - return () => plugin.off('filePanel', 'setWorkspace') - }, []) - - useEffect(() => { - if (state.find) { - (async () => { - const res = await getDirectory('/') - const pathFilter: any = {} - if (state.include) - pathFilter.include = state.include.split(',').map(i => i.trim()) - if (state.exclude) - pathFilter.exclude = state.exclude.split(',').map(i => i.trim()) - const ob = res.filter(filePathFilter(pathFilter)).map(file => { - const r: SearchResult = { - filename: file, - lines: [], - path: file, - searchComplete: false - } - return r - }) - setSearchResults(ob) - })() - } - }, [state.find, state.replace, state.include, state.exclude]) + const { state} = useContext(SearchContext) + const [alertText, setAlertText] = useState('') return ( <> diff --git a/libs/remix-ui/search/src/lib/components/results/SearchHelper.ts b/libs/remix-ui/search/src/lib/components/results/SearchHelper.ts index 3e41e418ca..8cd3c0fe36 100644 --- a/libs/remix-ui/search/src/lib/components/results/SearchHelper.ts +++ b/libs/remix-ui/search/src/lib/components/results/SearchHelper.ts @@ -1,4 +1,42 @@ -import { SearchResultLineLine } from "../../reducers/Reducer" +import { EOL } from 'os' +import { SearchResultLineLine } from '../../types' + + +export const getDirectory = async (dir: string, plugin: any) => { + let result = [] + const files = await plugin.call('fileManager', 'readdir', dir) + const fileArray = normalize(files) + for (const fi of fileArray) { + if (fi) { + const type = fi.data.isDirectory + if (type === true) { + result = [...result, ...(await getDirectory(`${fi.filename}`, plugin))] + } else { + result = [...result, fi.filename] + } + } + } + return result + } + + const normalize = filesList => { + const folders = [] + const files = [] + Object.keys(filesList || {}).forEach(key => { + if (filesList[key].isDirectory) { + folders.push({ + filename: key, + data: filesList[key] + }) + } else { + files.push({ + filename: key, + data: filesList[key] + }) + } + }) + return [...folders, ...files] + } export const findLinesInStringWithMatch = (str: string, re: RegExp) => { return str @@ -43,3 +81,28 @@ const splitLines = (matchResult: RegExpExecArray[], lineNumber: number) => { return result }) } + +function getEOL(text) { + const m = text.match(/\r\n|\n/g); + const u = m && m.filter(a => a === '\n').length; + const w = m && m.length - u; + if (u === w) { + return EOL; // use the OS default + } + return u > w ? '\n' : '\r\n'; +} + + +export const replaceTextInLine = (str: string, searchResultLine: SearchResultLineLine, newText: string) => { + return str + .split(/\r?\n/) + .map(function (line, i) { + if (i === searchResultLine.position.start.line) { + return searchResultLine.left + newText + searchResultLine.right + } + return line + }).join(getEOL(str)) +} + + + diff --git a/libs/remix-ui/search/src/lib/context/context.tsx b/libs/remix-ui/search/src/lib/context/context.tsx index 1762d7c367..2b03c54df0 100644 --- a/libs/remix-ui/search/src/lib/context/context.tsx +++ b/libs/remix-ui/search/src/lib/context/context.tsx @@ -1,14 +1,11 @@ -import React from 'react' +import React, { useEffect } from 'react' import { createContext, useReducer } from 'react' -import { findLinesInStringWithMatch } from '../components/results/SearchHelper' +import { findLinesInStringWithMatch, getDirectory, replaceTextInLine } from '../components/results/SearchHelper' import { - SearchingInitialState, SearchReducer, - SearchResult, - SearchResultLine, - SearchResultLineLine, - SearchState } from '../reducers/Reducer' +import { SearchState, SearchResult, SearchResultLine, SearchResultLineLine, SearchingInitialState } from '../types' +const filePathFilter = require('@jsdevtools/file-path-filter') export interface SearchingStateInterface { state: SearchState @@ -21,7 +18,11 @@ export interface SearchingStateInterface { setWholeWord: (value: boolean) => void, setSearchResults: (value: SearchResult[]) => void, findText: (path: string) => Promise, - hightLightInPath: (path:SearchResult, line:SearchResultLineLine) => void, + hightLightInPath: (result:SearchResult, line:SearchResultLineLine) => void, + replaceText: (result: SearchResult, line: SearchResultLineLine) => void, + reloadFile: (file:string) => void, + toggleCaseSensitive: () => void, + toggleMatchWholeWord: () => void, } export const SearchContext = createContext(null) @@ -33,11 +34,11 @@ export const SearchProvider = ({ plugin = undefined } = {}) => { const [state, dispatch] = useReducer(reducer, initialState) + let reloadTimeOut: any = null const value = { state, setFind: (value: string) => { - console.log('setFind: ' + value) dispatch({ type: 'SET_FIND', payload: value @@ -85,24 +86,95 @@ export const SearchProvider = ({ payload: value }) }, + reloadFile: async (file:string) => { + dispatch({ + type: 'RELOAD_FILE', + payload: file + }) + }, + toggleCaseSensitive: () => { + dispatch({ + type: 'TOGGLE_CASE_SENSITIVE', + payload: undefined + }) + }, + toggleMatchWholeWord: () => { + dispatch({ + type: 'TOGGLE_MATCH_WHOLE_WORD', + payload: undefined + }) + }, findText : async (path: string) => { if(!plugin) return try { if(state.find.length < 3) return const text = await plugin.call('fileManager', 'readFile', path) - const re = new RegExp(state.find, 'gi') + let flags = 'g' + let find = state.find + if(!state.casesensitive) flags += 'i' + if(state.matchWord) find = `\\b${find}\\b` + const re = new RegExp(find, flags) const result: SearchResultLine[] = findLinesInStringWithMatch(text, re) - // console.log(result, path) return result } catch (e) {} }, hightLightInPath: async(result: SearchResult, line: SearchResultLineLine) => { await plugin.call('editor', 'discardHighlight') await plugin.call('editor', 'highlight', line.position, result.path) + }, + replaceText: async(result: SearchResult, line: SearchResultLineLine) => { + await plugin.call('editor', 'discardHighlight') + await plugin.call('editor', 'highlight', line.position, result.path) + let content = await plugin.call('fileManager', 'readFile', result.path) + await plugin.call('fileManager','setFile', result.path, replaceTextInLine(content, line, state.replace)) } + } + const reloadStateForFile = async (file: string) => { + clearTimeout(reloadTimeOut) + reloadTimeOut = setTimeout(async () => { + await value.reloadFile(file) + }, 1000) } + useEffect(() => { + plugin.on('filePanel', 'setWorkspace', () => { + value.setSearchResults(null) + }) + plugin.on('fileManager', 'fileSaved', async file => { + await reloadStateForFile(file) + }) + return () => { + plugin.off('fileManager', 'fileChanged') + plugin.off('filePanel', 'setWorkspace') + } + }, []) + + useEffect(() => { + if (state.find) { + (async () => { + const res = await getDirectory('/', plugin) + const pathFilter: any = {} + if (state.include) + pathFilter.include = state.include.split(',').map(i => i.trim()) + if (state.exclude) + pathFilter.exclude = state.exclude.split(',').map(i => i.trim()) + const ob = res.filter(filePathFilter(pathFilter)).map(file => { + const r: SearchResult = { + filename: file, + lines: [], + path: file, + timeStamp: Date.now() + } + return r + }) + value.setSearchResults(ob) + })() + } + }, [state.timeStamp]) + + + return ( <> {children} diff --git a/libs/remix-ui/search/src/lib/reducers/Reducer.ts b/libs/remix-ui/search/src/lib/reducers/Reducer.ts index c4a6742a08..907a57b8c8 100644 --- a/libs/remix-ui/search/src/lib/reducers/Reducer.ts +++ b/libs/remix-ui/search/src/lib/reducers/Reducer.ts @@ -1,52 +1,4 @@ - -interface Action { - type: string - payload: any -} - -interface position { - start: { - line: number - column: number - }, - end: { - line: number - column: number - } - } - -export interface SearchResultLineLine { - left: any, - center: any, - right: any, - position: position -} -export interface SearchResultLine { - lines: SearchResultLineLine[] -} - -export interface SearchResult { - filename: string, - path: string, - lines: SearchResultLine[], - searchComplete: boolean -} - -export interface SearchState { - find: string, - searchResults: SearchResult[], - replace: string, - include: string, - exclude: string, -} - -export const SearchingInitialState: SearchState = { - find: '', - replace: '', - include: '', - exclude: '', - searchResults: [] -} +import { Action, SearchingInitialState, SearchState } from "../types" export const SearchReducer = (state: SearchState = SearchingInitialState, action: Action) => { switch (action.type) { @@ -54,6 +6,7 @@ export const SearchReducer = (state: SearchState = SearchingInitialState, action return { ...state, find: action.payload, + timeStamp: Date.now() } case 'SET_REPLACE': @@ -66,12 +19,14 @@ export const SearchReducer = (state: SearchState = SearchingInitialState, action return { ...state, include: action.payload, + timeStamp: Date.now() } case 'SET_EXCLUDE': return { ...state, exclude: action.payload, + timeStamp: Date.now() } case 'SET_SEARCH_RESULTS': @@ -79,7 +34,29 @@ export const SearchReducer = (state: SearchState = SearchingInitialState, action ...state, searchResults: action.payload, } - + case 'TOGGLE_CASE_SENSITIVE': + return { + ...state, + casesensitive: !state.casesensitive, + timeStamp: Date.now() + } + case 'TOGGLE_MATCH_WHOLE_WORD': + return { + ...state, + matchWord: !state.matchWord, + timeStamp: Date.now() + } + case 'RELOAD_FILE': + if (state.searchResults) { + const findFile = state.searchResults.find(file => file.filename === action.payload) + if (findFile) findFile.timeStamp = Date.now() + } + return { + ...state, + } default: + return { + ...state, + } } } \ No newline at end of file diff --git a/libs/remix-ui/search/src/lib/search.css b/libs/remix-ui/search/src/lib/search.css index a7b9326785..089cae82ed 100644 --- a/libs/remix-ui/search/src/lib/search.css +++ b/libs/remix-ui/search/src/lib/search.css @@ -19,8 +19,70 @@ .find-part { display: flex; + flex-direction: column; + padding: 2px; } .controls { display: flex; +} + +.search_tab .search_line_container { + display: flex; + flex-direction: row; + position: relative; +} + +.search_tab .search_line { + width: 100%; + overflow: hidden; + display: flex; +} + +.search_tab .search_control { + flex-grow: 0; + position: absolute; + right: 0px; + top: 0px; +} + +.summary_right { + min-width: 0; + white-space: pre; + text-overflow: ellipsis; + overflow: hidden; +} + +.search_tab .replace_strike { + text-decoration: line-through; +} + +.summary_left { + white-space: pre; +} + +.search_tab mark { + padding: 0; +} + +.search_tab .search_line_container .search_control { + display: none; +} + +.search_tab .search_line_container:hover .search_control { + display: block; +} + +.search_tab .search_line_container:hover .search_line { + width: 93%; +} + +.search-input { + display: flex; + flex-direction: row; + align-items: center; +} + +.search_tab .checked { + background-color: var(--secondary); } \ No newline at end of file diff --git a/libs/remix-ui/search/src/lib/types/index.ts b/libs/remix-ui/search/src/lib/types/index.ts new file mode 100644 index 0000000000..7b558085f5 --- /dev/null +++ b/libs/remix-ui/search/src/lib/types/index.ts @@ -0,0 +1,55 @@ + +export interface Action { + type: string + payload: any +} + +interface position { + start: { + line: number + column: number + }, + end: { + line: number + column: number + } +} + +export interface SearchResultLineLine { + left: any, + center: any, + right: any, + position: position +} +export interface SearchResultLine { + lines: SearchResultLineLine[] +} + +export interface SearchResult { + filename: string, + path: string, + lines: SearchResultLine[], + timeStamp: number +} + +export interface SearchState { + find: string, + searchResults: SearchResult[], + replace: string, + include: string, + exclude: string, + casesensitive: boolean, + matchWord: boolean, + timeStamp: number +} + +export const SearchingInitialState: SearchState = { + find: '', + replace: '', + include: '', + exclude: '', + searchResults: [], + casesensitive: false, + matchWord: false, + timeStamp: 0 +} \ No newline at end of file From e5ebc8926acc7b751ef06730da7ce405d5d8457c Mon Sep 17 00:00:00 2001 From: filip mertens Date: Sun, 20 Feb 2022 15:23:05 +0100 Subject: [PATCH 044/217] fix lint --- libs/remix-ui/search/src/lib/components/results/Results.tsx | 4 +--- .../search/src/lib/components/results/SearchHelper.ts | 2 +- libs/remix-ui/search/src/lib/context/context.tsx | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/libs/remix-ui/search/src/lib/components/results/Results.tsx b/libs/remix-ui/search/src/lib/components/results/Results.tsx index 32efca1484..810b2351fd 100644 --- a/libs/remix-ui/search/src/lib/components/results/Results.tsx +++ b/libs/remix-ui/search/src/lib/components/results/Results.tsx @@ -1,10 +1,8 @@ import React, { useContext, useEffect, useState } from 'react' import { SearchContext } from '../../context/context' import { ResultItem } from './ResultItem' -interface ResultsProps { -} -export const Results = (props: ResultsProps) => { +export const Results = () => { const { state} = useContext(SearchContext) const [alertText, setAlertText] = useState('') diff --git a/libs/remix-ui/search/src/lib/components/results/SearchHelper.ts b/libs/remix-ui/search/src/lib/components/results/SearchHelper.ts index 8cd3c0fe36..88ae6b1de1 100644 --- a/libs/remix-ui/search/src/lib/components/results/SearchHelper.ts +++ b/libs/remix-ui/search/src/lib/components/results/SearchHelper.ts @@ -54,7 +54,7 @@ export const findLinesInStringWithMatch = (str: string, re: RegExp) => { const matchesInString = (str: string, re: RegExp) => { let a: RegExpExecArray - let results:RegExpExecArray[] = []; + const results:RegExpExecArray[] = []; while ((a = re.exec(str || '')) !== null) { results.push(a); } diff --git a/libs/remix-ui/search/src/lib/context/context.tsx b/libs/remix-ui/search/src/lib/context/context.tsx index 2b03c54df0..c3f387857c 100644 --- a/libs/remix-ui/search/src/lib/context/context.tsx +++ b/libs/remix-ui/search/src/lib/context/context.tsx @@ -5,7 +5,7 @@ import { SearchReducer, } from '../reducers/Reducer' import { SearchState, SearchResult, SearchResultLine, SearchResultLineLine, SearchingInitialState } from '../types' -const filePathFilter = require('@jsdevtools/file-path-filter') +import { filePathFilter } from '@jsdevtools/file-path-filter' export interface SearchingStateInterface { state: SearchState @@ -125,7 +125,7 @@ export const SearchProvider = ({ replaceText: async(result: SearchResult, line: SearchResultLineLine) => { await plugin.call('editor', 'discardHighlight') await plugin.call('editor', 'highlight', line.position, result.path) - let content = await plugin.call('fileManager', 'readFile', result.path) + const content = await plugin.call('fileManager', 'readFile', result.path) await plugin.call('fileManager','setFile', result.path, replaceTextInLine(content, line, state.replace)) } } From 554b439d14717b1f4cd187e6d3e263f772a370c4 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Sun, 20 Feb 2022 16:09:50 +0100 Subject: [PATCH 045/217] trim left --- .../search/src/lib/components/results/ResultSummary.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-ui/search/src/lib/components/results/ResultSummary.tsx b/libs/remix-ui/search/src/lib/components/results/ResultSummary.tsx index f215e8c50e..18b76950f6 100644 --- a/libs/remix-ui/search/src/lib/components/results/ResultSummary.tsx +++ b/libs/remix-ui/search/src/lib/components/results/ResultSummary.tsx @@ -31,7 +31,7 @@ export const ResultSummary = (props: ResultSummaryProps) => { key={props.searchResult.filename} className='search_line pb-1' > -
    {lineItem.left.substring(lineItem.left.length - 20)}
    +
    {lineItem.left.substring(lineItem.left.length - 20).trimStart()}
    {lineItem.center} {state.replace? {state.replace}:<>}
    {lineItem.right.substring(0, 100)}
    From 6dc72846fa832e22e583689d3785cbb9993e7b6f Mon Sep 17 00:00:00 2001 From: filip mertens Date: Mon, 21 Feb 2022 13:12:06 +0100 Subject: [PATCH 046/217] regex support --- .../search/src/lib/components/Find.tsx | 33 ++++++- .../search/src/lib/components/Search.tsx | 2 +- .../lib/components/results/ResultFileName.tsx | 23 +++-- .../lib/components/results/ResultSummary.tsx | 6 +- .../lib/components/results/SearchHelper.ts | 3 + .../search/src/lib/context/context.tsx | 92 +++++++++++++------ .../search/src/lib/reducers/Reducer.ts | 6 ++ libs/remix-ui/search/src/lib/search.css | 7 ++ libs/remix-ui/search/src/lib/types/index.ts | 2 + 9 files changed, 129 insertions(+), 45 deletions(-) diff --git a/libs/remix-ui/search/src/lib/components/Find.tsx b/libs/remix-ui/search/src/lib/components/Find.tsx index e1e861b620..c8949ec34c 100644 --- a/libs/remix-ui/search/src/lib/components/Find.tsx +++ b/libs/remix-ui/search/src/lib/components/Find.tsx @@ -2,7 +2,13 @@ import React, { useContext } from 'react' import { SearchContext } from '../context/context' export const Find = props => { - const { setFind, state, toggleCaseSensitive, toggleMatchWholeWord } = useContext(SearchContext) + const { + setFind, + state, + toggleCaseSensitive, + toggleMatchWholeWord, + toggleUseRegex + } = useContext(SearchContext) let timeOutId: any = null const change = e => { clearTimeout(timeOutId) @@ -21,11 +27,13 @@ export const Find = props => { >
    { toggleCaseSensitive() @@ -33,7 +41,9 @@ export const Find = props => { >
    { toggleMatchWholeWord() }} >
    +
    { + toggleUseRegex() + }} + >
    diff --git a/libs/remix-ui/search/src/lib/components/Search.tsx b/libs/remix-ui/search/src/lib/components/Search.tsx index 5bddd417c8..05a856832e 100644 --- a/libs/remix-ui/search/src/lib/components/Search.tsx +++ b/libs/remix-ui/search/src/lib/components/Search.tsx @@ -13,7 +13,7 @@ const plugin = props.plugin return ( <> -
    +
    diff --git a/libs/remix-ui/search/src/lib/components/results/ResultFileName.tsx b/libs/remix-ui/search/src/lib/components/results/ResultFileName.tsx index 8df5162bbe..45257371e2 100644 --- a/libs/remix-ui/search/src/lib/components/results/ResultFileName.tsx +++ b/libs/remix-ui/search/src/lib/components/results/ResultFileName.tsx @@ -1,18 +1,25 @@ -import React from 'react' +import React, { useEffect, useState } from 'react' import { SearchResult } from '../../types' - +import { getPathIcon } from '@remix-ui/helper' interface ResultItemProps { file: SearchResult } export const ResultFileName = (props: ResultItemProps) => { + const [icon, setIcon] = useState('') + + useEffect(() => { + if (props.file && props.file.path) { + setIcon(getPathIcon(props.file.path)) + } + }, [props.file]) + return ( -
    -
    - - {props.file.filename} - + <> + {icon ?
    : null} +
    + {props.file.filename}
    -
    + ) } diff --git a/libs/remix-ui/search/src/lib/components/results/ResultSummary.tsx b/libs/remix-ui/search/src/lib/components/results/ResultSummary.tsx index 18b76950f6..7fca1a87ac 100644 --- a/libs/remix-ui/search/src/lib/components/results/ResultSummary.tsx +++ b/libs/remix-ui/search/src/lib/components/results/ResultSummary.tsx @@ -17,7 +17,11 @@ export const ResultSummary = (props: ResultSummaryProps) => { const replace = async (line: SearchResultLineLine) => { props.setLoading(true) - await replaceText(props.searchResult, line) + try{ + await replaceText(props.searchResult, line) + }catch(e){ + props.setLoading(false) + } } return ( diff --git a/libs/remix-ui/search/src/lib/components/results/SearchHelper.ts b/libs/remix-ui/search/src/lib/components/results/SearchHelper.ts index 88ae6b1de1..3daa49f4bf 100644 --- a/libs/remix-ui/search/src/lib/components/results/SearchHelper.ts +++ b/libs/remix-ui/search/src/lib/components/results/SearchHelper.ts @@ -104,5 +104,8 @@ export const replaceTextInLine = (str: string, searchResultLine: SearchResultLin }).join(getEOL(str)) } +export function escapeRegExp(string) { + return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string +} diff --git a/libs/remix-ui/search/src/lib/context/context.tsx b/libs/remix-ui/search/src/lib/context/context.tsx index c3f387857c..6ba9ba86c1 100644 --- a/libs/remix-ui/search/src/lib/context/context.tsx +++ b/libs/remix-ui/search/src/lib/context/context.tsx @@ -1,28 +1,38 @@ import React, { useEffect } from 'react' import { createContext, useReducer } from 'react' -import { findLinesInStringWithMatch, getDirectory, replaceTextInLine } from '../components/results/SearchHelper' import { - SearchReducer, -} from '../reducers/Reducer' -import { SearchState, SearchResult, SearchResultLine, SearchResultLineLine, SearchingInitialState } from '../types' + findLinesInStringWithMatch, + getDirectory, + replaceTextInLine +} from '../components/results/SearchHelper' +import { SearchReducer } from '../reducers/Reducer' +import { + SearchState, + SearchResult, + SearchResultLine, + SearchResultLineLine, + SearchingInitialState +} from '../types' import { filePathFilter } from '@jsdevtools/file-path-filter' +import { escapeRegExp } from 'lodash' export interface SearchingStateInterface { state: SearchState setFind: (value: string) => void setReplace: (value: string) => void - setInclude: (value: string) => void, - setExclude: (value: string) => void, - setCaseSensitive: (value: boolean) => void, - setRegex: (value: boolean) => void, - setWholeWord: (value: boolean) => void, - setSearchResults: (value: SearchResult[]) => void, - findText: (path: string) => Promise, - hightLightInPath: (result:SearchResult, line:SearchResultLineLine) => void, - replaceText: (result: SearchResult, line: SearchResultLineLine) => void, - reloadFile: (file:string) => void, - toggleCaseSensitive: () => void, - toggleMatchWholeWord: () => void, + setInclude: (value: string) => void + setExclude: (value: string) => void + setCaseSensitive: (value: boolean) => void + setRegex: (value: boolean) => void + setWholeWord: (value: boolean) => void + setSearchResults: (value: SearchResult[]) => void + findText: (path: string) => Promise + hightLightInPath: (result: SearchResult, line: SearchResultLineLine) => void + replaceText: (result: SearchResult, line: SearchResultLineLine) => void + reloadFile: (file: string) => void + toggleCaseSensitive: () => void + toggleMatchWholeWord: () => void + toggleUseRegex: () => void } export const SearchContext = createContext(null) @@ -86,12 +96,18 @@ export const SearchProvider = ({ payload: value }) }, - reloadFile: async (file:string) => { + reloadFile: async (file: string) => { dispatch({ type: 'RELOAD_FILE', payload: file }) }, + toggleUseRegex: () => { + dispatch({ + type: 'TOGGLE_USE_REGEX', + payload: undefined + }) + }, toggleCaseSensitive: () => { dispatch({ type: 'TOGGLE_CASE_SENSITIVE', @@ -104,29 +120,47 @@ export const SearchProvider = ({ payload: undefined }) }, - findText : async (path: string) => { - if(!plugin) return + findText: async (path: string) => { + if (!plugin) return try { - if(state.find.length < 3) return + if (state.find.length < 3) return const text = await plugin.call('fileManager', 'readFile', path) let flags = 'g' let find = state.find - if(!state.casesensitive) flags += 'i' - if(state.matchWord) find = `\\b${find}\\b` + if (!state.casesensitive) flags += 'i' + if (state.matchWord) find = `\\b${find}\\b` + if (!state.useRegExp) find = escapeRegExp(find) const re = new RegExp(find, flags) const result: SearchResultLine[] = findLinesInStringWithMatch(text, re) return result } catch (e) {} }, - hightLightInPath: async(result: SearchResult, line: SearchResultLineLine) => { + hightLightInPath: async ( + result: SearchResult, + line: SearchResultLineLine + ) => { await plugin.call('editor', 'discardHighlight') await plugin.call('editor', 'highlight', line.position, result.path) }, - replaceText: async(result: SearchResult, line: SearchResultLineLine) => { - await plugin.call('editor', 'discardHighlight') - await plugin.call('editor', 'highlight', line.position, result.path) - const content = await plugin.call('fileManager', 'readFile', result.path) - await plugin.call('fileManager','setFile', result.path, replaceTextInLine(content, line, state.replace)) + replaceText: async (result: SearchResult, line: SearchResultLineLine) => { + try { + await plugin.call('editor', 'discardHighlight') + await plugin.call('editor', 'highlight', line.position, result.path) + const content = await plugin.call( + 'fileManager', + 'readFile', + result.path + ) + + await plugin.call( + 'fileManager', + 'setFile', + result.path, + replaceTextInLine(content, line, state.replace) + ) + } catch (e) { + throw new Error(e) + } } } @@ -173,8 +207,6 @@ export const SearchProvider = ({ } }, [state.timeStamp]) - - return ( <> {children} diff --git a/libs/remix-ui/search/src/lib/reducers/Reducer.ts b/libs/remix-ui/search/src/lib/reducers/Reducer.ts index 907a57b8c8..2738caa95f 100644 --- a/libs/remix-ui/search/src/lib/reducers/Reducer.ts +++ b/libs/remix-ui/search/src/lib/reducers/Reducer.ts @@ -40,6 +40,12 @@ export const SearchReducer = (state: SearchState = SearchingInitialState, action casesensitive: !state.casesensitive, timeStamp: Date.now() } + case 'TOGGLE_USE_REGEX': + return { + ...state, + useRegExp: !state.useRegExp, + timeStamp: Date.now() + } case 'TOGGLE_MATCH_WHOLE_WORD': return { ...state, diff --git a/libs/remix-ui/search/src/lib/search.css b/libs/remix-ui/search/src/lib/search.css index 089cae82ed..4f4dfbd5bb 100644 --- a/libs/remix-ui/search/src/lib/search.css +++ b/libs/remix-ui/search/src/lib/search.css @@ -5,6 +5,7 @@ -ms-user-select: none; /* IE10+/Edge */ user-select: none; /* Standard */ cursor: pointer; + align-items: center; } .wrap_summary { @@ -85,4 +86,10 @@ .search_tab .checked { background-color: var(--secondary); +} + +.search_tab .search_file_name { + text-overflow: ellipsis; + overflow: hidden; + text-transform: uppercase; } \ No newline at end of file diff --git a/libs/remix-ui/search/src/lib/types/index.ts b/libs/remix-ui/search/src/lib/types/index.ts index 7b558085f5..4521bfb658 100644 --- a/libs/remix-ui/search/src/lib/types/index.ts +++ b/libs/remix-ui/search/src/lib/types/index.ts @@ -40,6 +40,7 @@ export interface SearchState { exclude: string, casesensitive: boolean, matchWord: boolean, + useRegExp: boolean, timeStamp: number } @@ -51,5 +52,6 @@ export const SearchingInitialState: SearchState = { searchResults: [], casesensitive: false, matchWord: false, + useRegExp: false, timeStamp: 0 } \ No newline at end of file From 5355f9a8eeb36d546ef550280e991ca53e612a02 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Mon, 21 Feb 2022 13:14:02 +0100 Subject: [PATCH 047/217] rm regx from heklper --- libs/remix-ui/search/README.md | 7 ------- .../search/src/lib/components/results/SearchHelper.ts | 3 --- 2 files changed, 10 deletions(-) delete mode 100644 libs/remix-ui/search/README.md diff --git a/libs/remix-ui/search/README.md b/libs/remix-ui/search/README.md deleted file mode 100644 index cf9595a10e..0000000000 --- a/libs/remix-ui/search/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# remix-ui-vertical-icons-panel - -React library for RemixIde vertical icons Panel - -## Running unit tests - -Run `nx test remix-ui-vertical-icons-panel` to execute the unit tests via [Jest](https://jestjs.io). diff --git a/libs/remix-ui/search/src/lib/components/results/SearchHelper.ts b/libs/remix-ui/search/src/lib/components/results/SearchHelper.ts index 3daa49f4bf..88ae6b1de1 100644 --- a/libs/remix-ui/search/src/lib/components/results/SearchHelper.ts +++ b/libs/remix-ui/search/src/lib/components/results/SearchHelper.ts @@ -104,8 +104,5 @@ export const replaceTextInLine = (str: string, searchResultLine: SearchResultLin }).join(getEOL(str)) } -export function escapeRegExp(string) { - return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string -} From ebf5510ca2aeebecdec2e339622b9afb403b87b8 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Mon, 21 Feb 2022 13:15:07 +0100 Subject: [PATCH 048/217] Constitution --- apps/remix-ide/contracts/app/ethereum/constitution.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide/contracts/app/ethereum/constitution.sol b/apps/remix-ide/contracts/app/ethereum/constitution.sol index ff36bdb9c8..0f60164e97 100644 --- a/apps/remix-ide/contracts/app/ethereum/constitution.sol +++ b/apps/remix-ide/contracts/app/ethereum/constitution.sol @@ -1,4 +1,4 @@ - Constitution { + contract Constitution { function Found(uint8 _numProposals) { proposals.length = _numProposals; From 00557e19f160076aed224335f5cf86deddb21c56 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Mon, 21 Feb 2022 13:15:30 +0100 Subject: [PATCH 049/217] white space --- apps/remix-ide/contracts/app/ethereum/constitution.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide/contracts/app/ethereum/constitution.sol b/apps/remix-ide/contracts/app/ethereum/constitution.sol index 0f60164e97..8c2c9e0da9 100644 --- a/apps/remix-ide/contracts/app/ethereum/constitution.sol +++ b/apps/remix-ide/contracts/app/ethereum/constitution.sol @@ -1,4 +1,4 @@ - contract Constitution { +contract Constitution { function Found(uint8 _numProposals) { proposals.length = _numProposals; From 35ac6dddb94e6eb7b2fbccf3894b738fb42366c3 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Mon, 21 Feb 2022 13:19:46 +0100 Subject: [PATCH 050/217] fix timeouts --- libs/remix-ui/search/src/lib/components/Exclude.tsx | 5 +++-- libs/remix-ui/search/src/lib/components/Include.tsx | 5 +++-- libs/remix-ui/search/src/lib/components/Replace.tsx | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/libs/remix-ui/search/src/lib/components/Exclude.tsx b/libs/remix-ui/search/src/lib/components/Exclude.tsx index c836183157..c6bdef48e2 100644 --- a/libs/remix-ui/search/src/lib/components/Exclude.tsx +++ b/libs/remix-ui/search/src/lib/components/Exclude.tsx @@ -4,10 +4,11 @@ import { SearchContext } from '../context/context' export const Exclude = props => { const { setExclude, state } = useContext(SearchContext) const [str, setStr] = useState('.git/**/*,.deps/**/*') + let timeOutId: any = null const change = e => { setStr(e.target.value) - const timeOutId = setTimeout(() => setExclude(e.target.value), 500) - return () => clearTimeout(timeOutId) + clearTimeout(timeOutId) + timeOutId = setTimeout(() => setExclude(e.target.value), 500) } useEffect(() => { diff --git a/libs/remix-ui/search/src/lib/components/Include.tsx b/libs/remix-ui/search/src/lib/components/Include.tsx index a59dd11988..00bf266deb 100644 --- a/libs/remix-ui/search/src/lib/components/Include.tsx +++ b/libs/remix-ui/search/src/lib/components/Include.tsx @@ -3,9 +3,10 @@ import { SearchContext } from '../context/context' export const Include = props => { const { setInclude } = useContext(SearchContext) + let timeOutId: any = null const change = e => { - const timeOutId = setTimeout(() => setInclude(e.target.value), 500) - return () => clearTimeout(timeOutId) + clearTimeout(timeOutId) + timeOutId = setTimeout(() => setInclude(e.target.value), 500) } return ( diff --git a/libs/remix-ui/search/src/lib/components/Replace.tsx b/libs/remix-ui/search/src/lib/components/Replace.tsx index 504261cfa9..33b9ba2539 100644 --- a/libs/remix-ui/search/src/lib/components/Replace.tsx +++ b/libs/remix-ui/search/src/lib/components/Replace.tsx @@ -3,9 +3,10 @@ import { SearchContext } from '../context/context' export const Replace = props => { const { setReplace } = useContext(SearchContext) + let timeOutId: any = null const change = e => { - const timeOutId = setTimeout(() => setReplace(e.target.value), 500) - return () => clearTimeout(timeOutId) + clearTimeout(timeOutId) + timeOutId = setTimeout(() => setReplace(e.target.value), 500) } return ( From 7e309057774f48c0c361c12d3cb5314c00c6bb85 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Mon, 21 Feb 2022 13:23:30 +0100 Subject: [PATCH 051/217] move icon --- apps/remix-ide/src/app/components/vertical-icons.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide/src/app/components/vertical-icons.tsx b/apps/remix-ide/src/app/components/vertical-icons.tsx index bc70fd812c..d8fe5706f8 100644 --- a/apps/remix-ide/src/app/components/vertical-icons.tsx +++ b/apps/remix-ide/src/app/components/vertical-icons.tsx @@ -29,7 +29,7 @@ export class VerticalIcons extends Plugin { } renderComponent () { - const fixedOrder = ['filePanel', 'solidity','udapp', 'debugger', 'solidityStaticAnalysis', 'solidityUnitTesting', 'pluginManager'] + const fixedOrder = ['filePanel', 'search', 'solidity','udapp', 'debugger', 'solidityStaticAnalysis', 'solidityUnitTesting', 'pluginManager'] const divived = Object.values(this.icons).map((value) => { return { ...value, From ffd47328e9ccca2d5b31b733ef2a01ecf211d7b0 Mon Sep 17 00:00:00 2001 From: lianahus Date: Wed, 16 Feb 2022 10:11:24 +0100 Subject: [PATCH 052/217] fixed layout of home --- libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.tsx b/libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.tsx index 1fa810ef79..e13ed5c28b 100644 --- a/libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.tsx +++ b/libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.tsx @@ -297,7 +297,7 @@ export const RemixUiHomeTab = (props: RemixUiHomeTabProps) => {
    -
    +

    Featured Plugins

    From 6d2531654cd28b077ed9a78c9cfcf0a8448600de Mon Sep 17 00:00:00 2001 From: lianahus Date: Wed, 16 Feb 2022 11:06:03 +0100 Subject: [PATCH 053/217] fix the gap between icon sections --- .../src/lib/remix-ui-vertical-icons-panel.css | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/remix-ui/vertical-icons-panel/src/lib/remix-ui-vertical-icons-panel.css b/libs/remix-ui/vertical-icons-panel/src/lib/remix-ui-vertical-icons-panel.css index 5fd6e085ee..393ee84773 100644 --- a/libs/remix-ui/vertical-icons-panel/src/lib/remix-ui-vertical-icons-panel.css +++ b/libs/remix-ui/vertical-icons-panel/src/lib/remix-ui-vertical-icons-panel.css @@ -111,6 +111,7 @@ flex-basis: 510px; flex-grow: 2; text-align: center; + margin-top: -6px; /* border-bottom: 3px solid #3f4455; */ } .remixui_scrollbar::-webkit-scrollbar { /* Chrome, Safari and other Webkit browsers*/ From 70919be2e89b886f87047af3ccc97ba380874ff7 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Mon, 21 Feb 2022 13:44:07 +0100 Subject: [PATCH 054/217] rm un --- .../search/src/lib/components/results/Results.tsx | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/libs/remix-ui/search/src/lib/components/results/Results.tsx b/libs/remix-ui/search/src/lib/components/results/Results.tsx index 810b2351fd..f398a43143 100644 --- a/libs/remix-ui/search/src/lib/components/results/Results.tsx +++ b/libs/remix-ui/search/src/lib/components/results/Results.tsx @@ -3,16 +3,10 @@ import { SearchContext } from '../../context/context' import { ResultItem } from './ResultItem' export const Results = () => { - const { state} = useContext(SearchContext) - const [alertText, setAlertText] = useState('') + const { state } = useContext(SearchContext) return ( <> - {alertText ? ( -
    - {alertText} -
    - ) : null} {state.searchResults && state.searchResults.map((result, index) => { return From 3b4788e8d15ec1871644bada612150c996323381 Mon Sep 17 00:00:00 2001 From: lianahus Date: Thu, 17 Feb 2022 12:06:14 +0100 Subject: [PATCH 055/217] autocomplete commands after 1 symbol instead of 3 --- libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx b/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx index f5a2a8868a..73b5b3e424 100644 --- a/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx +++ b/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx @@ -382,7 +382,7 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => { const handleAutoComplete = () => (
    2)) && autoCompletState.data._options.length > 0 ? 'block' : 'none' }} + style={{ display: (autoCompletState.showSuggestions && autoCompletState.userInput !== '' && (autoCompletState.userInput.length > 0)) && autoCompletState.data._options.length > 0 ? 'block' : 'none' }} >
    {autoCompletState.data._options.map((item, index) => { From de2f10ba099c1561b834580da0d62000ae7c2ade Mon Sep 17 00:00:00 2001 From: lianahus Date: Fri, 18 Feb 2022 11:51:24 +0100 Subject: [PATCH 056/217] edited terminal's welcome text --- apps/remix-ide/src/lib/commands.js | 57 ------------------- libs/remix-ui/terminal/src/lib/commands.ts | 1 - .../terminal/src/lib/terminalWelcome.tsx | 4 +- 3 files changed, 3 insertions(+), 59 deletions(-) delete mode 100644 apps/remix-ide/src/lib/commands.js diff --git a/apps/remix-ide/src/lib/commands.js b/apps/remix-ide/src/lib/commands.js deleted file mode 100644 index 0f6ca3f897..0000000000 --- a/apps/remix-ide/src/lib/commands.js +++ /dev/null @@ -1,57 +0,0 @@ -const allPrograms = [ - { ethers: 'The ethers.js library is a compact and complete JavaScript library for Ethereum.' }, - { remix: 'Ethereum IDE and tools for the web.' }, - { web3: 'The web3.js library is a collection of modules which contain specific functionality for the ethereum ecosystem.' }, - { swarmgw: 'This library can be used to upload/download files to Swarm via https://swarm-gateways.net/.' } -] - -const allCommands = [ - { 'remix.execute(filepath)': 'Run the script specified by file path. If filepath is empty, script currently displayed in the editor is executed.' }, - { 'remix.exeCurrent()': 'Run the script currently displayed in the editor.' }, - { 'remix.help()': 'Display this help message.' }, - { 'remix.loadgist(id)': 'Load a gist in the file explorer.' }, - { 'remix.loadurl(url)': 'Load the given url in the file explorer. The url can be of type github, swarm or ipfs.' }, - - { 'swarmgw.get(url, cb)': 'Download files from Swarm via https://swarm-gateways.net/' }, - { 'swarmgw.put(content, cb)': 'Upload files to Swarm via https://swarm-gateways.net/' }, - - { 'ethers.Contract': 'This API provides a graceful connection to a contract deployed on the blockchain, simplifying calling and querying its functions and handling all the binary protocol and conversion as necessarily.' }, - { 'ethers.HDNode': 'A Hierarchical Deterministic Wallet represents a large tree of private keys which can reliably be reproduced from an initial seed.' }, - { 'ethers.Interface': 'The Interface Object is a meta-class that accepts a Solidity (or compatible) Application Binary Interface (ABI) and populates functions to deal with encoding and decoding the parameters to pass in and results returned.' }, - { 'ethers.providers': 'A Provider abstracts a connection to the Ethereum blockchain, for issuing queries and sending state changing transactions.' }, - { 'ethers.SigningKey': 'The SigningKey interface provides an abstraction around the secp256k1 elliptic curve cryptography library.' }, - { 'ethers.utils': 'The utility functions exposed in both the ethers umbrella package and the ethers-utils.' }, - { 'ethers.utils.AbiCoder': 'Create a new ABI Coder object' }, - { 'ethers.utils.RLP': 'This encoding method is used internally for several aspects of Ethereum, such as encoding transactions and determining contract addresses.' }, - { 'ethers.Wallet': 'A wallet manages a private/public key pair which is used to cryptographically sign transactions and prove ownership on the Ethereum network.' }, - { 'ethers.version': 'Contains the version of the ethers container object.' }, - - { 'web3.eth': 'Eth module for interacting with the Ethereum network.' }, - { 'web3.eth.accounts': 'The web3.eth.accounts contains functions to generate Ethereum accounts and sign transactions and data.' }, - { 'web3.eth.abi': 'The web3.eth.abi functions let you de- and encode parameters to ABI (Application Binary Interface) for function calls to the EVM (Ethereum Virtual Machine).' }, - { 'web3.eth.ens': 'The web3.eth.ens functions let you interacting with ENS.' }, - { 'web3.eth.Iban': 'The web3.eth.Iban function lets convert Ethereum addresses from and to IBAN and BBAN.' }, - { 'web3.eth.net': 'Net module for interacting with network properties.' }, - { 'web3.eth.personal': 'Personal module for interacting with the Ethereum accounts.' }, - { 'web3.eth.subscribe': 'The web3.eth.subscribe function lets you subscribe to specific events in the blockchain.' }, - { 'web3.givenProvider': 'When using web3.js in an Ethereum compatible browser, it will set with the current native provider by that browser. Will return the given provider by the (browser) environment, otherwise null.' }, - { 'web3.modules': 'Contains the version of the web3 container object.' }, - { 'web3.providers': 'Contains the current available providers.' }, - { 'web3.shh': 'Shh module for interacting with the whisper protocol' }, - { 'web3.utils': 'This package provides utility functions for Ethereum dapps and other web3.js packages.' }, - { 'web3.version': 'Contains the version of the web3 container object.' }, - - { 'web3.eth.clearSubscriptions();': 'Resets subscriptions.' }, - { 'web3.eth.Contract(jsonInterface[, address][, options])': 'The web3.eth.Contract object makes it easy to interact with smart contracts on the ethereum blockchain.' }, - { 'web3.eth.accounts.create([entropy]);': 'The web3.eth.accounts contains functions to generate Ethereum accounts and sign transactions and data.' }, - { 'web3.eth.getAccounts();': 'Retrieve the list of accounts' }, - { 'web3.eth.accounts.privateKeyToAccount(privateKey [, ignoreLength ]);': 'Get the account from the private key' }, - { 'web3.eth.accounts.signTransaction(tx, privateKey [, callback]);': 'Sign Transaction' }, - { 'web3.eth.accounts.recoverTransaction(rawTransaction);': 'Sign Transaction' }, - { 'web3.eth.accounts.hashMessage(message);': 'Hash message' } -] - -module.exports = { - allPrograms, - allCommands -} diff --git a/libs/remix-ui/terminal/src/lib/commands.ts b/libs/remix-ui/terminal/src/lib/commands.ts index cc3b5e6963..0dc02b371b 100644 --- a/libs/remix-ui/terminal/src/lib/commands.ts +++ b/libs/remix-ui/terminal/src/lib/commands.ts @@ -8,7 +8,6 @@ export const allPrograms = [ export const allCommands = [ { 'remix.execute(filepath)': 'Run the script specified by file path. If filepath is empty, script currently displayed in the editor is executed.' }, { 'remix.exeCurrent()': 'Run the script currently displayed in the editor.' }, - // { 'remix.help()': 'Display this help message.' }, { 'remix.loadgist(id)': 'Load a gist in the file explorer.' }, // { 'remix.loadurl(url)': 'Load the given url in the file explorer. The url can be of type github, swarm or ipfs.' }, diff --git a/libs/remix-ui/terminal/src/lib/terminalWelcome.tsx b/libs/remix-ui/terminal/src/lib/terminalWelcome.tsx index f222aca38e..2b2eba1c86 100644 --- a/libs/remix-ui/terminal/src/lib/terminalWelcome.tsx +++ b/libs/remix-ui/terminal/src/lib/terminalWelcome.tsx @@ -16,12 +16,14 @@ const TerminalWelcomeMessage = ({ packageJson }) => { - Right click on a JavaScript file in the file explorer and then click \`Run\` +
    The following libraries are accessible:
    +
    Type the library name to see available commands.
    ) } From c4068ce358c7127057d30135e2dfa1d5f4523f46 Mon Sep 17 00:00:00 2001 From: lianahus Date: Fri, 18 Feb 2022 12:06:04 +0100 Subject: [PATCH 057/217] style --- libs/remix-ui/terminal/src/lib/remix-ui-terminal.css | 3 +++ libs/remix-ui/terminal/src/lib/terminalWelcome.tsx | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/libs/remix-ui/terminal/src/lib/remix-ui-terminal.css b/libs/remix-ui/terminal/src/lib/remix-ui-terminal.css index 0ffe440548..13402e45ee 100644 --- a/libs/remix-ui/terminal/src/lib/remix-ui-terminal.css +++ b/libs/remix-ui/terminal/src/lib/remix-ui-terminal.css @@ -53,6 +53,9 @@ element.style { .remix_ui_terminal_block > pre { max-height : 200px; } +.remix_ui_terminal_welcome { + font-weight: bold; +} .remix_ui_terminal_cli { white-space : nowrap; line-height : 1.7em; diff --git a/libs/remix-ui/terminal/src/lib/terminalWelcome.tsx b/libs/remix-ui/terminal/src/lib/terminalWelcome.tsx index 2b2eba1c86..8a18545f67 100644 --- a/libs/remix-ui/terminal/src/lib/terminalWelcome.tsx +++ b/libs/remix-ui/terminal/src/lib/terminalWelcome.tsx @@ -3,7 +3,7 @@ import React from 'react' // eslint-disable-line const TerminalWelcomeMessage = ({ packageJson }) => { return (
    -
    - Welcome to Remix {packageJson} -

    +
    Welcome to Remix {packageJson}

    You can use this terminal to:
    • Check transactions details and start debugging.
    • From 73ed0d81bf0e45db5d1042057894cd6bd18a5350 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Mon, 21 Feb 2022 13:56:43 +0100 Subject: [PATCH 058/217] clean up --- libs/remix-ui/search/src/lib/components/results/Results.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-ui/search/src/lib/components/results/Results.tsx b/libs/remix-ui/search/src/lib/components/results/Results.tsx index f398a43143..abb8d8ac1b 100644 --- a/libs/remix-ui/search/src/lib/components/results/Results.tsx +++ b/libs/remix-ui/search/src/lib/components/results/Results.tsx @@ -1,4 +1,4 @@ -import React, { useContext, useEffect, useState } from 'react' +import React, { useContext } from 'react' import { SearchContext } from '../../context/context' import { ResultItem } from './ResultItem' From 0806aea4b18ecec73834b8f933c504a625d01c4f Mon Sep 17 00:00:00 2001 From: filip mertens Date: Mon, 21 Feb 2022 14:01:19 +0100 Subject: [PATCH 059/217] required --- apps/remix-ide/src/remixAppManager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide/src/remixAppManager.js b/apps/remix-ide/src/remixAppManager.js index ce7ea97b27..7598190e3f 100644 --- a/apps/remix-ide/src/remixAppManager.js +++ b/apps/remix-ide/src/remixAppManager.js @@ -7,7 +7,7 @@ const _paq = window._paq = window._paq || [] const requiredModules = [ // services + layout views + system views 'manager', 'config', 'compilerArtefacts', 'compilerMetadata', 'contextualListener', 'editor', 'offsetToLineColumnConverter', 'network', 'theme', 'fileManager', 'contentImport', 'blockchain', 'web3Provider', 'scriptRunner', 'fetchAndCompile', 'mainPanel', 'hiddenPanel', 'sidePanel', 'menuicons', - 'filePanel', 'terminal', 'settings', 'pluginManager', 'tabs', 'udapp', 'dGitProvider', 'solidity-logic', 'gistHandler', 'layout', 'notification', 'permissionhandler', 'walkthrough', 'storage'] + 'filePanel', 'terminal', 'settings', 'pluginManager', 'tabs', 'udapp', 'dGitProvider', 'solidity-logic', 'gistHandler', 'layout', 'notification', 'permissionhandler', 'walkthrough', 'storage', 'search'] const dependentModules = ['git', 'hardhat', 'slither'] // module which shouldn't be manually activated (e.g git is activated by remixd) From 21b7036447a5b9b93830d18d297436ef305cf117 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Mon, 21 Feb 2022 14:02:36 +0100 Subject: [PATCH 060/217] cleanup --- apps/remix-ide/src/app/tabs/search.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/search.tsx b/apps/remix-ide/src/app/tabs/search.tsx index 267396181a..6914ed0150 100644 --- a/apps/remix-ide/src/app/tabs/search.tsx +++ b/apps/remix-ide/src/app/tabs/search.tsx @@ -1,7 +1,6 @@ import { ViewPlugin } from '@remixproject/engine-web' import * as packageJson from '../../../../../package.json' import React from 'react' // eslint-disable-line -import { PluginViewWrapper } from '@remix-ui/helper' import { SearchTab } from '@remix-ui/search' const profile = { name: 'search', @@ -17,12 +16,11 @@ const profile = { } export class SearchPlugin extends ViewPlugin { - dispatch: React.Dispatch = () => {} + constructor () { super(profile) } - render() { return (
      From e4c6b1496e987cd3b73d4ec5a5b6abde98ddb8b8 Mon Sep 17 00:00:00 2001 From: David Disu Date: Mon, 21 Feb 2022 17:38:04 +0100 Subject: [PATCH 061/217] Clear error message when switching tabs --- apps/remix-ide/src/app/tabs/compile-tab.js | 4 ++++ apps/solidity-compiler/src/app/compiler-api.ts | 7 +++++++ libs/remix-lib/src/types/ICompilerApi.ts | 1 + .../solidity-compiler/src/lib/solidity-compiler.tsx | 12 ++++++++++-- .../solidity-compiler/src/lib/types/index.ts | 11 +++++++++++ 5 files changed, 33 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/compile-tab.js b/apps/remix-ide/src/app/tabs/compile-tab.js index 4718b4dee6..262d64f6e5 100644 --- a/apps/remix-ide/src/app/tabs/compile-tab.js +++ b/apps/remix-ide/src/app/tabs/compile-tab.js @@ -63,6 +63,10 @@ class CompileTab extends CompilerApiMixin(ViewPlugin) { // implements ICompilerA this.renderComponent() } + onFileClosed () { + this.renderComponent() + } + onCompilationFinished () { this.renderComponent() } diff --git a/apps/solidity-compiler/src/app/compiler-api.ts b/apps/solidity-compiler/src/app/compiler-api.ts index 2e81d08ba1..b3d46a4712 100644 --- a/apps/solidity-compiler/src/app/compiler-api.ts +++ b/apps/solidity-compiler/src/app/compiler-api.ts @@ -21,6 +21,7 @@ export const CompilerApiMixin = (Base) => class extends Base { onCompilationFinished: (contractsDetails: any, contractMap: any) => void onSessionSwitched: () => void onContentChanged: () => void + onFileClosed: (name: string) => void initCompilerApi () { this.configurationSettings = null @@ -249,6 +250,12 @@ export const CompilerApiMixin = (Base) => class extends Base { } this.on('fileManager', 'noFileSelected', this.data.eventHandlers.onNoFileSelected) + this.data.eventHandlers.onFileClosed = (name: string) => { + this.onFileClosed(name) + } + + this.on('fileManager', 'fileClosed', this.data.eventHandlers.onFileClosed) + this.data.eventHandlers.onCompilationFinished = (success, data, source) => { this.compileErrors = data if (success) { diff --git a/libs/remix-lib/src/types/ICompilerApi.ts b/libs/remix-lib/src/types/ICompilerApi.ts index 62f86b5652..4cdea95799 100644 --- a/libs/remix-lib/src/types/ICompilerApi.ts +++ b/libs/remix-lib/src/types/ICompilerApi.ts @@ -26,6 +26,7 @@ export interface ICompilerApi { onCompilationFinished: (contractsDetails: any, contractMap: any) => void onSessionSwitched: () => void onContentChanged: () => void + onFileClosed: (name: string) => void resolveContentAndSave: (url: string) => Promise fileExists: (file: string) => Promise diff --git a/libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx b/libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx index dcc86f387f..18ded67061 100644 --- a/libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx +++ b/libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx @@ -1,5 +1,5 @@ import React, { useEffect, useState } from 'react' // eslint-disable-line -import { SolidityCompilerProps } from './types' +import { CompileErrors, SolidityCompilerProps } from './types' import { CompilerContainer } from './compiler-container' // eslint-disable-line import { ContractSelection } from './contract-selection' // eslint-disable-line import { Toaster } from '@remix-ui/toaster' // eslint-disable-line @@ -9,7 +9,7 @@ import { Renderer } from '@remix-ui/renderer' // eslint-disable-line import './css/style.css' export const SolidityCompiler = (props: SolidityCompilerProps) => { - const { api, api: { currentFile, compileTabLogic, contractsDetails, contractMap, compileErrors, configurationSettings } } = props + const { api, api: { currentFile, compileTabLogic, contractsDetails, contractMap, configurationSettings } } = props const [state, setState] = useState({ isHardhatProject: false, currentFile, @@ -32,6 +32,7 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => { }) const [currentVersion, setCurrentVersion] = useState('') const [hideWarnings, setHideWarnings] = useState(false) + const [compileErrors, setCompileErrors] = useState(api.compileErrors) useEffect(() => { (async () => { @@ -63,12 +64,19 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => { setState(prevState => { return { ...prevState, currentFile: '' } }) + setCompileErrors({} as CompileErrors) } api.onCompilationFinished = (contractsDetails: any, contractMap: any) => { setState(prevState => { return { ...prevState, contractsDetails, contractMap } }) + setCompileErrors(api.compileErrors) + } + + api.onFileClosed = (name) => { + console.log('path/name: ', name, currentFile) + if (name === currentFile) setCompileErrors({} as CompileErrors) } const toast = (message: string) => { diff --git a/libs/remix-ui/solidity-compiler/src/lib/types/index.ts b/libs/remix-ui/solidity-compiler/src/lib/types/index.ts index 4932b1456c..eefc8c69ab 100644 --- a/libs/remix-ui/solidity-compiler/src/lib/types/index.ts +++ b/libs/remix-ui/solidity-compiler/src/lib/types/index.ts @@ -24,3 +24,14 @@ export interface ContractSelectionProps { modal: (title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => void, contractsDetails: Record } + +interface CompileError { + mode?: string, + severity?: string, + formattedMessage?: string, + type?: string +} +export interface CompileErrors { + error: CompileError, + errors: CompileError[] +} From 6147ef036919bda06ed3a95120b0d5cdccad593f Mon Sep 17 00:00:00 2001 From: filip mertens Date: Mon, 21 Feb 2022 18:11:08 +0100 Subject: [PATCH 062/217] e2e --- apps/remix-ide-e2e/src/tests/search.test.ts | 103 ++++++++++++++++++ .../search/src/lib/components/Exclude.tsx | 1 + .../search/src/lib/components/Find.tsx | 4 + .../search/src/lib/components/Include.tsx | 6 +- .../search/src/lib/components/Replace.tsx | 1 + .../lib/components/results/ResultSummary.tsx | 4 +- .../src/lib/components/results/Results.tsx | 4 +- .../search/src/lib/context/context.tsx | 2 +- package.json | 3 +- 9 files changed, 121 insertions(+), 7 deletions(-) create mode 100644 apps/remix-ide-e2e/src/tests/search.test.ts diff --git a/apps/remix-ide-e2e/src/tests/search.test.ts b/apps/remix-ide-e2e/src/tests/search.test.ts new file mode 100644 index 0000000000..626778851d --- /dev/null +++ b/apps/remix-ide-e2e/src/tests/search.test.ts @@ -0,0 +1,103 @@ +'use strict' + +import { NightwatchBrowser } from 'nightwatch' +import init from '../helpers/init' + +module.exports = { + + before: function (browser: NightwatchBrowser, done: VoidFunction) { + init(browser, done, 'http://127.0.0.1:8080', true) + }, + 'Should find text': function (browser: NightwatchBrowser) { + browser.waitForElementVisible('*[data-id="remixIdeSidePanel"]') + .click('*[plugin="search"]').waitForElementVisible('*[id="search_input"]') + .setValue('*[id="search_input"]', 'read').pause(1000) + .waitForElementContainsText('*[data-id="search_results"]', 'CONTRACTS/3_BALLOT.SOL', 60000) + .waitForElementContainsText('*[data-id="search_results"]', 'README.TXT', 60000) + .waitForElementContainsText('*[data-id="search_results"]', 'file must') + .waitForElementContainsText('*[data-id="search_results"]', 'be compiled') + .waitForElementContainsText('*[data-id="search_results"]', 'that person al') + .waitForElementContainsText('*[data-id="search_results"]', 'sender.voted') + .waitForElementContainsText('*[data-id="search_results"]', 'read') + .elements('css selector','.search_line', (res) => { + Array.isArray(res.value) && browser.assert.equal(res.value.length, 6) + }) + }, + 'Should find regex': function (browser: NightwatchBrowser) { + browser + .waitForElementVisible('*[data-id="search_use_regex"]').click('*[data-id="search_use_regex"]') + .waitForElementVisible('*[id="search_input"]') + .clearValue('*[id="search_input"]') + .setValue('*[id="search_input"]', '^contract').pause(1000) + .waitForElementContainsText('*[data-id="search_results"]', 'CONTRACTS/3_BALLOT.SOL', 60000) + .waitForElementContainsText('*[data-id="search_results"]', 'CONTRACTS/2_OWNER.SOL', 60000) + .waitForElementContainsText('*[data-id="search_results"]', 'CONTRACTS/1_STORAGE.SOL', 60000) + .waitForElementContainsText('*[data-id="search_results"]', 'TESTS/4_BALLOT_TEST.SOL', 60000) + .elements('css selector','.search_line', (res) => { + Array.isArray(res.value) && browser.assert.equal(res.value.length, 4) + }) + }, + 'Should find matchcase': function (browser: NightwatchBrowser) { + browser + .waitForElementVisible('*[data-id="search_use_regex"]').click('*[data-id="search_use_regex"]') + .waitForElementVisible('*[data-id="search_case_sensitive"]').click('*[data-id="search_case_sensitive"]') + .elements('css selector','.search_line', (res) => { + Array.isArray(res.value) && browser.assert.equal(res.value.length, 0) + }) + .clearValue('*[id="search_input"]') + .setValue('*[id="search_input"]', 'Contract').pause(1000) + .elements('css selector','.search_line', (res) => { + Array.isArray(res.value) && browser.assert.equal(res.value.length, 6) + }) + .waitForElementContainsText('*[data-id="search_results"]', 'SCRIPTS/DEPLOY_ETHERS.JS', 60000) + .waitForElementContainsText('*[data-id="search_results"]', 'SCRIPTS/DEPLOY_WEB3.JS', 60000) + }, + 'Should find matchword': function (browser: NightwatchBrowser) { + browser + .waitForElementVisible('*[data-id="search_case_sensitive"]').click('*[data-id="search_case_sensitive"]') + .waitForElementVisible('*[data-id="search_whole_word"]').click('*[data-id="search_whole_word"]') + .clearValue('*[id="search_input"]') + .setValue('*[id="search_input"]', 'contract').pause(1000) + .elements('css selector','.search_line', (res) => { + Array.isArray(res.value) && browser.assert.equal(res.value.length, 27) + }) + }, + 'Should replace text': function (browser: NightwatchBrowser) { + browser + .setValue('*[id="search_replace"]', 'replacing').pause(1000) + .waitForElementVisible('*[data-id="contracts/2_Owner.sol-30-71"]') + .moveToElement('*[data-id="contracts/2_Owner.sol-30-71"]', 10, 10) + .waitForElementVisible('*[data-id="replace-contracts/2_Owner.sol-30-71"]') + .click('*[data-id="replace-contracts/2_Owner.sol-30-71"]').pause(2000). + getEditorValue((content) => { + browser.assert.ok(content.includes('replacing deployer for a constructor'), 'should replace text ok') + }) + }, + 'Should find text with include': function (browser: NightwatchBrowser) { + browser + .setValue('*[id="search_include"]', 'contracts/**').pause(2000) + .elements('css selector','.search_line', (res) => { + Array.isArray(res.value) && browser.assert.equal(res.value.length, 4) + }) + }, + 'Should find text with exclude': function (browser: NightwatchBrowser) { + browser + .clearValue('*[id="search_include"]').pause(2000) + .setValue('*[id="search_include"]', '**').pause(2000) + .elements('css selector','.search_line', (res) => { + Array.isArray(res.value) && browser.assert.equal(res.value.length, 26) + }) + .setValue('*[id="search_exclude"]', ',contracts/**').pause(2000) + .elements('css selector','.search_line', (res) => { + Array.isArray(res.value) && browser.assert.equal(res.value.length, 22) + }) + }, + 'should clear search': function (browser: NightwatchBrowser) { + browser + .waitForElementVisible('*[id="search_input"]') + .setValue('*[id="search_input"]', 'nodata').pause(1000) + .elements('css selector','.search_line', (res) => { + Array.isArray(res.value) && browser.assert.equal(res.value.length, 0) + }) + } +} \ No newline at end of file diff --git a/libs/remix-ui/search/src/lib/components/Exclude.tsx b/libs/remix-ui/search/src/lib/components/Exclude.tsx index c6bdef48e2..4de9a0f30a 100644 --- a/libs/remix-ui/search/src/lib/components/Exclude.tsx +++ b/libs/remix-ui/search/src/lib/components/Exclude.tsx @@ -20,6 +20,7 @@ export const Exclude = props => {
      {
      { }} >
      { }} >
      { const { setInclude } = useContext(SearchContext) + const [str, setStr] = useState('') let timeOutId: any = null const change = e => { + setStr(e.target.value) clearTimeout(timeOutId) timeOutId = setTimeout(() => setInclude(e.target.value), 500) } @@ -14,9 +16,11 @@ export const Include = props => {
      diff --git a/libs/remix-ui/search/src/lib/components/Replace.tsx b/libs/remix-ui/search/src/lib/components/Replace.tsx index 33b9ba2539..a6ecf39887 100644 --- a/libs/remix-ui/search/src/lib/components/Replace.tsx +++ b/libs/remix-ui/search/src/lib/components/Replace.tsx @@ -14,6 +14,7 @@ export const Replace = props => {
      { const { hightLightInPath, replaceText, state } = useContext(SearchContext) - const selectLine = async (line: SearchResultLineLine) => { await hightLightInPath(props.searchResult, line) } @@ -32,6 +31,7 @@ export const ResultSummary = (props: ResultSummaryProps) => { onClick={async () => { selectLine(lineItem) }} + data-id={`${props.searchResult.filename}-${lineItem.position.start.line}-${lineItem.position.start.column}`} key={props.searchResult.filename} className='search_line pb-1' > @@ -41,7 +41,7 @@ export const ResultSummary = (props: ResultSummaryProps) => {
      {lineItem.right.substring(0, 100)}
      -
      { +
      { replace(lineItem) }} className="codicon codicon-find-replace" role="button" aria-label="Replace" aria-disabled="false">
      diff --git a/libs/remix-ui/search/src/lib/components/results/Results.tsx b/libs/remix-ui/search/src/lib/components/results/Results.tsx index abb8d8ac1b..9a1b717cca 100644 --- a/libs/remix-ui/search/src/lib/components/results/Results.tsx +++ b/libs/remix-ui/search/src/lib/components/results/Results.tsx @@ -6,11 +6,11 @@ export const Results = () => { const { state } = useContext(SearchContext) return ( - <> +
      {state.searchResults && state.searchResults.map((result, index) => { return })} - +
      ) } diff --git a/libs/remix-ui/search/src/lib/context/context.tsx b/libs/remix-ui/search/src/lib/context/context.tsx index 6ba9ba86c1..7ae00dc66e 100644 --- a/libs/remix-ui/search/src/lib/context/context.tsx +++ b/libs/remix-ui/search/src/lib/context/context.tsx @@ -128,8 +128,8 @@ export const SearchProvider = ({ let flags = 'g' let find = state.find if (!state.casesensitive) flags += 'i' - if (state.matchWord) find = `\\b${find}\\b` if (!state.useRegExp) find = escapeRegExp(find) + if (state.matchWord) find = `\\b${find}\\b` const re = new RegExp(find, flags) const result: SearchResultLine[] = findLinesInStringWithMatch(text, re) return result diff --git a/package.json b/package.json index a38866094a..6abfafa406 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "workspace-schematic": "nx workspace-schematic", "dep-graph": "nx dep-graph", "help": "nx help", - "lint:libs": "nx run-many --target=lint --projects=remix-analyzer,remix-astwalker,remix-debug,remix-lib,remix-simulator,remix-solidity,remix-tests,remix-url-resolver,remixd,remix-ui-tree-view,remix-ui-modal-dialog,remix-ui-toaster,remix-ui-helper,remix-ui-debugger-ui,remix-ui-workspace,remix-ui-static-analyser,remix-ui-checkbox,remix-ui-settings,remix-core-plugin,remix-ui-renderer,remix-ui-publish-to-storage,remix-ui-solidity-compiler,solidity-unit-testing,remix-ui-plugin-manager,remix-ui-terminal,remix-ui-editor,remix-ui-app,remix-ui-tabs,remix-ui-panel,remix-ui-run-tab,remix-ui-permission-handler", + "lint:libs": "nx run-many --target=lint --projects=remix-analyzer,remix-astwalker,remix-debug,remix-lib,remix-simulator,remix-solidity,remix-tests,remix-url-resolver,remixd,remix-ui-tree-view,remix-ui-modal-dialog,remix-ui-toaster,remix-ui-helper,remix-ui-debugger-ui,remix-ui-workspace,remix-ui-static-analyser,remix-ui-checkbox,remix-ui-settings,remix-core-plugin,remix-ui-renderer,remix-ui-publish-to-storage,remix-ui-solidity-compiler,solidity-unit-testing,remix-ui-plugin-manager,remix-ui-terminal,remix-ui-editor,remix-ui-app,remix-ui-tabs,remix-ui-panel,remix-ui-run-tab,remix-ui-permission-handler,remix-ui-search", "build:libs": "nx run-many --target=build --parallel=false --with-deps=true --projects=remix-analyzer,remix-astwalker,remix-debug,remix-lib,remix-simulator,remix-solidity,remix-tests,remix-url-resolver,remixd", "test:libs": "nx run-many --target=test --projects=remix-analyzer,remix-astwalker,remix-debug,remix-lib,remix-simulator,remix-solidity,remix-tests,remix-url-resolver,remixd", "publish:libs": "npm run build:libs && lerna publish --skip-git && npm run bumpVersion:libs", @@ -97,6 +97,7 @@ "nightwatch_local_pluginApi": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/plugin_api_*.js --env=chrome", "nightwatch_local_migrate_filesystem": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/migrateFileSystem.test.js --env=chrome", "nightwatch_local_stress_editor": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/stress.editor.js --env=chromeDesktop", + "nightwatch_local_search": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/search.test.js --env=chromeDesktop", "onchange": "onchange apps/remix-ide/build/app.js -- npm-run-all lint", "remixd": "nx build remixd && chmod +x dist/libs/remixd/src/bin/remixd.js && dist/libs/remixd/src/bin/remixd.js -s ./apps/remix-ide/contracts --remix-ide http://127.0.0.1:8080", "selenium": "selenium-standalone start", From 1ecc4fc2b88818aefcca289caef5353699e90f7f Mon Sep 17 00:00:00 2001 From: filip mertens Date: Mon, 21 Feb 2022 18:12:00 +0100 Subject: [PATCH 063/217] master package --- package-lock.json | 70 +++++++++++++++++++++++------------------------ 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/package-lock.json b/package-lock.json index c72f9cbe60..18feb9d161 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9782,46 +9782,46 @@ "integrity": "sha512-IXf3XA7+XyN7CP9gGh/XB0UxVMlvARGEgGXLubFICsUMGz6Q+DU+i4gGlpOxTjKvXjkJDJC8YdqdKkDj9qZHEQ==" }, "@remixproject/engine": { - "version": "0.3.28", - "resolved": "https://registry.npmjs.org/@remixproject/engine/-/engine-0.3.28.tgz", - "integrity": "sha512-27SHaCrG3KrPfMa1MYud4tE9xUIJKITEUsql99fhN7x12lOmgGZFjiqIG/WWjCMmT7OMG3vtLayiZrsYkzHCVw==", + "version": "0.3.26", + "resolved": "https://registry.npmjs.org/@remixproject/engine/-/engine-0.3.26.tgz", + "integrity": "sha512-6Rq6aTUyhtXAaoQamAI8ocFSVy2txpGwu1aoYZGrqova/p/tRWn4/+PU713sffyiAQVBCk7C1z/5VKLm7tUYrQ==", "requires": { - "@remixproject/plugin-api": "0.3.28", - "@remixproject/plugin-utils": "0.3.28" + "@remixproject/plugin-api": "0.3.26", + "@remixproject/plugin-utils": "0.3.26" } }, "@remixproject/engine-web": { - "version": "0.3.28", - "resolved": "https://registry.npmjs.org/@remixproject/engine-web/-/engine-web-0.3.28.tgz", - "integrity": "sha512-JTwTuonW+pI7WsSsgGHAzPynGjIdG34VnPrspR9XKBQO4+NX7m3lbNIMUUviyrbqIoGiGtgYd/ry98uLpTHr4g==", + "version": "0.3.26", + "resolved": "https://registry.npmjs.org/@remixproject/engine-web/-/engine-web-0.3.26.tgz", + "integrity": "sha512-QSW9KVOgHWuRDNqTZIp1jjBeDOXlXQZWYABgljTsC+Nig8EwlyRTfIza9PuCb+MDYT/kID8VgSPXnMrlOtvhjQ==", "requires": { - "@remixproject/engine": "0.3.28", - "@remixproject/plugin-api": "0.3.28", - "@remixproject/plugin-utils": "0.3.28" + "@remixproject/engine": "0.3.26", + "@remixproject/plugin-api": "0.3.26", + "@remixproject/plugin-utils": "0.3.26" } }, "@remixproject/plugin": { - "version": "0.3.28", - "resolved": "https://registry.npmjs.org/@remixproject/plugin/-/plugin-0.3.28.tgz", - "integrity": "sha512-sw+cow3GKAcEacXLvdJwtHHIphPty4KRMZ6tcQHdtx/iCKTMNdw2hribKPnvTO+6mXE+4oAKCrFqeTdVp/rd1w==", + "version": "0.3.26", + "resolved": "https://registry.npmjs.org/@remixproject/plugin/-/plugin-0.3.26.tgz", + "integrity": "sha512-j0sgl4yDOVJLCuRWOEb/Wo9/fumrWlIpsO0MrtficuhVc1FGhZxKVv8Vdu3x3HgWhXkuhLUMs8VoJ1Ntd9ZkUQ==", "requires": { - "@remixproject/plugin-api": "0.3.28", - "@remixproject/plugin-utils": "0.3.28", + "@remixproject/plugin-api": "0.3.26", + "@remixproject/plugin-utils": "0.3.26", "events": "3.2.0" } }, "@remixproject/plugin-api": { - "version": "0.3.28", - "resolved": "https://registry.npmjs.org/@remixproject/plugin-api/-/plugin-api-0.3.28.tgz", - "integrity": "sha512-tOzVFR504037weEkNHQGZsk+Ebxcu/xnBsVCkJaQaBMb+H/i6YevKQmoR1aGcH+JfQxc8eS8LGC65MaV8zmcWg==", + "version": "0.3.26", + "resolved": "https://registry.npmjs.org/@remixproject/plugin-api/-/plugin-api-0.3.26.tgz", + "integrity": "sha512-6vR9nVF4EfXDHA0r8MrlLyVYRMJMG7J3Y3jzpaAumetW+YpvfJqgE/uhGgm2me2ypDM8vW0POQGhRaGeZTGwFg==", "requires": { - "@remixproject/plugin-utils": "0.3.28" + "@remixproject/plugin-utils": "0.3.26" } }, "@remixproject/plugin-utils": { - "version": "0.3.28", - "resolved": "https://registry.npmjs.org/@remixproject/plugin-utils/-/plugin-utils-0.3.28.tgz", - "integrity": "sha512-5CayTgMqRiOguanTy6kpuRgCmjEFLUu2K4Rs7Zmt+GOzHucmwkDxYQO+3hFv0Jz/M/6yC5wkKYTx8vfPLLdEBQ==", + "version": "0.3.26", + "resolved": "https://registry.npmjs.org/@remixproject/plugin-utils/-/plugin-utils-0.3.26.tgz", + "integrity": "sha512-K/v+TXYOMV13dLf1LEgiF7CfqbOc105hC/2oapkSoHKSf3WVyWIUDlBsChRQl7osfUs/zT93q2+jNlLofWQUxg==", "requires": { "tslib": "2.0.1" }, @@ -9834,13 +9834,13 @@ } }, "@remixproject/plugin-webview": { - "version": "0.3.28", - "resolved": "https://registry.npmjs.org/@remixproject/plugin-webview/-/plugin-webview-0.3.28.tgz", - "integrity": "sha512-DodSkN0vMSo2DEEoBOWyKxC/ElvBA826vhX+JVGXA8HGS45aavplZIN967hsc+SdzjV1UZfSNKEHttLGwM1BIw==", + "version": "0.3.26", + "resolved": "https://registry.npmjs.org/@remixproject/plugin-webview/-/plugin-webview-0.3.26.tgz", + "integrity": "sha512-hqWaFapUfcAX2Odsj0ANKvLXQbkzZ/xNONMqE0wRxFRYTIhFGZqFzJVzwSD+U4bSehP1JtzkrxwKBqNyjz5GxQ==", "requires": { - "@remixproject/plugin": "0.3.28", - "@remixproject/plugin-api": "0.3.28", - "@remixproject/plugin-utils": "0.3.28", + "@remixproject/plugin": "0.3.26", + "@remixproject/plugin-api": "0.3.26", + "@remixproject/plugin-utils": "0.3.26", "axios": "^0.21.1" }, "dependencies": { @@ -9855,13 +9855,13 @@ } }, "@remixproject/plugin-ws": { - "version": "0.3.28", - "resolved": "https://registry.npmjs.org/@remixproject/plugin-ws/-/plugin-ws-0.3.28.tgz", - "integrity": "sha512-i3He9t4qvcBQxzshFx66D6drqLlySmV7Cb+NeYtMOYlWxQSJtUakp/Px1Tl3IDFQXDfpXxvDvYhn2w0AWPBOqw==", + "version": "0.3.26", + "resolved": "https://registry.npmjs.org/@remixproject/plugin-ws/-/plugin-ws-0.3.26.tgz", + "integrity": "sha512-Nerd/2vGb96G6B8pGRCRNAGlO97KnJpbFmpa47SYipgjaq5Yj5iCUY+fbQzMWdGW2W4BrUPE+YBZCkq/KlfbGw==", "requires": { - "@remixproject/plugin": "0.3.28", - "@remixproject/plugin-api": "0.3.28", - "@remixproject/plugin-utils": "0.3.28" + "@remixproject/plugin": "0.3.26", + "@remixproject/plugin-api": "0.3.26", + "@remixproject/plugin-utils": "0.3.26" } }, "@restart/context": { From 00fbf04214050a855a337f4554cd2bf868010daa Mon Sep 17 00:00:00 2001 From: filip mertens Date: Mon, 21 Feb 2022 18:17:57 +0100 Subject: [PATCH 064/217] fix --- libs/remix-ui/search/src/lib/components/Exclude.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-ui/search/src/lib/components/Exclude.tsx b/libs/remix-ui/search/src/lib/components/Exclude.tsx index 4de9a0f30a..962a9cefaf 100644 --- a/libs/remix-ui/search/src/lib/components/Exclude.tsx +++ b/libs/remix-ui/search/src/lib/components/Exclude.tsx @@ -12,7 +12,7 @@ export const Exclude = props => { } useEffect(() => { - setExclude('.git/**') + setExclude(str) }, []) return ( From 3631fbbe4a99fb2730419e4826e9e91a9cd94dfb Mon Sep 17 00:00:00 2001 From: filip mertens Date: Mon, 21 Feb 2022 18:25:34 +0100 Subject: [PATCH 065/217] show title --- .../search/src/lib/components/results/ResultFileName.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-ui/search/src/lib/components/results/ResultFileName.tsx b/libs/remix-ui/search/src/lib/components/results/ResultFileName.tsx index 45257371e2..60c950e457 100644 --- a/libs/remix-ui/search/src/lib/components/results/ResultFileName.tsx +++ b/libs/remix-ui/search/src/lib/components/results/ResultFileName.tsx @@ -17,7 +17,7 @@ export const ResultFileName = (props: ResultItemProps) => { return ( <> {icon ?
      : null} -
      +
      {props.file.filename}
      From de42bcbc97ea64582b0d91a0cd57497f24fb9437 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Mon, 21 Feb 2022 18:44:21 +0100 Subject: [PATCH 066/217] path filename --- apps/remix-ide-e2e/src/tests/search.test.ts | 17 ++++++++++------- .../lib/components/results/ResultFileName.tsx | 6 +++++- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/search.test.ts b/apps/remix-ide-e2e/src/tests/search.test.ts index 626778851d..cfcbe506af 100644 --- a/apps/remix-ide-e2e/src/tests/search.test.ts +++ b/apps/remix-ide-e2e/src/tests/search.test.ts @@ -12,7 +12,8 @@ module.exports = { browser.waitForElementVisible('*[data-id="remixIdeSidePanel"]') .click('*[plugin="search"]').waitForElementVisible('*[id="search_input"]') .setValue('*[id="search_input"]', 'read').pause(1000) - .waitForElementContainsText('*[data-id="search_results"]', 'CONTRACTS/3_BALLOT.SOL', 60000) + .waitForElementContainsText('*[data-id="search_results"]', '3_BALLOT.SOL', 60000) + .waitForElementContainsText('*[data-id="search_results"]', 'contracts', 60000) .waitForElementContainsText('*[data-id="search_results"]', 'README.TXT', 60000) .waitForElementContainsText('*[data-id="search_results"]', 'file must') .waitForElementContainsText('*[data-id="search_results"]', 'be compiled') @@ -29,10 +30,11 @@ module.exports = { .waitForElementVisible('*[id="search_input"]') .clearValue('*[id="search_input"]') .setValue('*[id="search_input"]', '^contract').pause(1000) - .waitForElementContainsText('*[data-id="search_results"]', 'CONTRACTS/3_BALLOT.SOL', 60000) - .waitForElementContainsText('*[data-id="search_results"]', 'CONTRACTS/2_OWNER.SOL', 60000) - .waitForElementContainsText('*[data-id="search_results"]', 'CONTRACTS/1_STORAGE.SOL', 60000) - .waitForElementContainsText('*[data-id="search_results"]', 'TESTS/4_BALLOT_TEST.SOL', 60000) + .waitForElementContainsText('*[data-id="search_results"]', '3_BALLOT.SOL', 60000) + .waitForElementContainsText('*[data-id="search_results"]', '2_OWNER.SOL', 60000) + .waitForElementContainsText('*[data-id="search_results"]', '1_STORAGE.SOL', 60000) + .waitForElementContainsText('*[data-id="search_results"]', '4_BALLOT_TEST.SOL', 60000) + .waitForElementContainsText('*[data-id="search_results"]', 'tests', 60000) .elements('css selector','.search_line', (res) => { Array.isArray(res.value) && browser.assert.equal(res.value.length, 4) }) @@ -49,8 +51,9 @@ module.exports = { .elements('css selector','.search_line', (res) => { Array.isArray(res.value) && browser.assert.equal(res.value.length, 6) }) - .waitForElementContainsText('*[data-id="search_results"]', 'SCRIPTS/DEPLOY_ETHERS.JS', 60000) - .waitForElementContainsText('*[data-id="search_results"]', 'SCRIPTS/DEPLOY_WEB3.JS', 60000) + .waitForElementContainsText('*[data-id="search_results"]', 'DEPLOY_ETHERS.JS', 60000) + .waitForElementContainsText('*[data-id="search_results"]', 'DEPLOY_WEB3.JS', 60000) + .waitForElementContainsText('*[data-id="search_results"]', 'scripts', 60000) }, 'Should find matchword': function (browser: NightwatchBrowser) { browser diff --git a/libs/remix-ui/search/src/lib/components/results/ResultFileName.tsx b/libs/remix-ui/search/src/lib/components/results/ResultFileName.tsx index 60c950e457..d4cf2e4304 100644 --- a/libs/remix-ui/search/src/lib/components/results/ResultFileName.tsx +++ b/libs/remix-ui/search/src/lib/components/results/ResultFileName.tsx @@ -1,6 +1,7 @@ import React, { useEffect, useState } from 'react' import { SearchResult } from '../../types' import { getPathIcon } from '@remix-ui/helper' +import * as path from 'path' interface ResultItemProps { file: SearchResult } @@ -12,13 +13,16 @@ export const ResultFileName = (props: ResultItemProps) => { if (props.file && props.file.path) { setIcon(getPathIcon(props.file.path)) } + // remove path from string + // const path = props.file.path.split('/').slice(0, -1).join('/') }, [props.file]) return ( <> {icon ?
      : null}
      - {props.file.filename} + {path.basename(props.file.path)} + {path.dirname(props.file.path)}
      ) From 6bc2c5523e3988a390d17f0d7c4356241d037738 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Mon, 21 Feb 2022 18:59:26 +0100 Subject: [PATCH 067/217] use refs --- libs/remix-ui/search/src/lib/components/Exclude.tsx | 8 ++++---- libs/remix-ui/search/src/lib/components/Find.tsx | 8 ++++---- libs/remix-ui/search/src/lib/components/Include.tsx | 8 ++++---- libs/remix-ui/search/src/lib/components/Replace.tsx | 8 ++++---- libs/remix-ui/search/src/lib/context/context.tsx | 8 ++++---- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/libs/remix-ui/search/src/lib/components/Exclude.tsx b/libs/remix-ui/search/src/lib/components/Exclude.tsx index 962a9cefaf..be6f0054fb 100644 --- a/libs/remix-ui/search/src/lib/components/Exclude.tsx +++ b/libs/remix-ui/search/src/lib/components/Exclude.tsx @@ -1,14 +1,14 @@ -import React, { useContext, useEffect, useState } from 'react' +import React, { useContext, useEffect, useRef, useState } from 'react' import { SearchContext } from '../context/context' export const Exclude = props => { const { setExclude, state } = useContext(SearchContext) const [str, setStr] = useState('.git/**/*,.deps/**/*') - let timeOutId: any = null + const timeOutId = useRef(null) const change = e => { setStr(e.target.value) - clearTimeout(timeOutId) - timeOutId = setTimeout(() => setExclude(e.target.value), 500) + clearTimeout(timeOutId.current) + timeOutId.current = setTimeout(() => setExclude(e.target.value), 500) } useEffect(() => { diff --git a/libs/remix-ui/search/src/lib/components/Find.tsx b/libs/remix-ui/search/src/lib/components/Find.tsx index f83cf9c797..d89f797f51 100644 --- a/libs/remix-ui/search/src/lib/components/Find.tsx +++ b/libs/remix-ui/search/src/lib/components/Find.tsx @@ -1,4 +1,4 @@ -import React, { useContext } from 'react' +import React, { useContext, useRef } from 'react' import { SearchContext } from '../context/context' export const Find = props => { @@ -9,10 +9,10 @@ export const Find = props => { toggleMatchWholeWord, toggleUseRegex } = useContext(SearchContext) - let timeOutId: any = null + const timeOutId = useRef(null) const change = e => { - clearTimeout(timeOutId) - timeOutId = setTimeout(() => setFind(e.target.value), 500) + clearTimeout(timeOutId.current) + timeOutId.current = setTimeout(() => setFind(e.target.value), 500) } return ( diff --git a/libs/remix-ui/search/src/lib/components/Include.tsx b/libs/remix-ui/search/src/lib/components/Include.tsx index da3096b4ce..8ade1c963a 100644 --- a/libs/remix-ui/search/src/lib/components/Include.tsx +++ b/libs/remix-ui/search/src/lib/components/Include.tsx @@ -1,14 +1,14 @@ -import React, { useContext, useState } from 'react' +import React, { useContext, useRef, useState } from 'react' import { SearchContext } from '../context/context' export const Include = props => { const { setInclude } = useContext(SearchContext) const [str, setStr] = useState('') - let timeOutId: any = null + const timeOutId = useRef(null) const change = e => { setStr(e.target.value) - clearTimeout(timeOutId) - timeOutId = setTimeout(() => setInclude(e.target.value), 500) + clearTimeout(timeOutId.current) + timeOutId.current = setTimeout(() => setInclude(e.target.value), 500) } return ( diff --git a/libs/remix-ui/search/src/lib/components/Replace.tsx b/libs/remix-ui/search/src/lib/components/Replace.tsx index a6ecf39887..50ddd4e436 100644 --- a/libs/remix-ui/search/src/lib/components/Replace.tsx +++ b/libs/remix-ui/search/src/lib/components/Replace.tsx @@ -1,12 +1,12 @@ -import React, { useContext } from 'react' +import React, { useContext, useRef } from 'react' import { SearchContext } from '../context/context' export const Replace = props => { const { setReplace } = useContext(SearchContext) - let timeOutId: any = null + const timeOutId = useRef(null) const change = e => { - clearTimeout(timeOutId) - timeOutId = setTimeout(() => setReplace(e.target.value), 500) + clearTimeout(timeOutId.current) + timeOutId.current = setTimeout(() => setReplace(e.target.value), 500) } return ( diff --git a/libs/remix-ui/search/src/lib/context/context.tsx b/libs/remix-ui/search/src/lib/context/context.tsx index 7ae00dc66e..7d5b13c71e 100644 --- a/libs/remix-ui/search/src/lib/context/context.tsx +++ b/libs/remix-ui/search/src/lib/context/context.tsx @@ -1,4 +1,4 @@ -import React, { useEffect } from 'react' +import React, { useEffect, useRef } from 'react' import { createContext, useReducer } from 'react' import { findLinesInStringWithMatch, @@ -44,8 +44,8 @@ export const SearchProvider = ({ plugin = undefined } = {}) => { const [state, dispatch] = useReducer(reducer, initialState) - let reloadTimeOut: any = null + const reloadTimeOut = useRef(null) const value = { state, setFind: (value: string) => { @@ -165,8 +165,8 @@ export const SearchProvider = ({ } const reloadStateForFile = async (file: string) => { - clearTimeout(reloadTimeOut) - reloadTimeOut = setTimeout(async () => { + clearTimeout(reloadTimeOut.current) + reloadTimeOut.current = setTimeout(async () => { await value.reloadFile(file) }, 1000) } From 3e512e0e49e5a3d5f741ef42d9ebf8c67046de06 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Mon, 21 Feb 2022 19:18:38 +0100 Subject: [PATCH 068/217] Update ResultFileName.tsx --- .../search/src/lib/components/results/ResultFileName.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/libs/remix-ui/search/src/lib/components/results/ResultFileName.tsx b/libs/remix-ui/search/src/lib/components/results/ResultFileName.tsx index d4cf2e4304..5d6412af25 100644 --- a/libs/remix-ui/search/src/lib/components/results/ResultFileName.tsx +++ b/libs/remix-ui/search/src/lib/components/results/ResultFileName.tsx @@ -13,8 +13,6 @@ export const ResultFileName = (props: ResultItemProps) => { if (props.file && props.file.path) { setIcon(getPathIcon(props.file.path)) } - // remove path from string - // const path = props.file.path.split('/').slice(0, -1).join('/') }, [props.file]) return ( From 29814a7efd43d682dbabe1a0ba17727b8f325fb9 Mon Sep 17 00:00:00 2001 From: David Disu Date: Tue, 22 Feb 2022 06:05:13 +0100 Subject: [PATCH 069/217] Store compile errors for opened files --- .../src/lib/solidity-compiler.tsx | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx b/libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx index 18ded67061..a478b592cd 100644 --- a/libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx +++ b/libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx @@ -32,7 +32,7 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => { }) const [currentVersion, setCurrentVersion] = useState('') const [hideWarnings, setHideWarnings] = useState(false) - const [compileErrors, setCompileErrors] = useState(api.compileErrors) + const [compileErrors, setCompileErrors] = useState>({ [currentFile]: api.compileErrors }) useEffect(() => { (async () => { @@ -64,19 +64,18 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => { setState(prevState => { return { ...prevState, currentFile: '' } }) - setCompileErrors({} as CompileErrors) + setCompileErrors({} as Record) } api.onCompilationFinished = (contractsDetails: any, contractMap: any) => { setState(prevState => { return { ...prevState, contractsDetails, contractMap } }) - setCompileErrors(api.compileErrors) + setCompileErrors({ ...compileErrors, [currentFile]: api.compileErrors }) } api.onFileClosed = (name) => { - console.log('path/name: ', name, currentFile) - if (name === currentFile) setCompileErrors({} as CompileErrors) + if (name === currentFile) setCompileErrors({ ...compileErrors, [currentFile]: {} as CompileErrors }) } const toast = (message: string) => { @@ -129,20 +128,22 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => {
      -
      - - { compileErrors.error && } - { compileErrors.error && (compileErrors.error.mode === 'panic') && modal('Error', panicMessage(compileErrors.error.formattedMessage), 'Close', null) } - { compileErrors.errors && compileErrors.errors.length && compileErrors.errors.map((err, index) => { - if (hideWarnings) { - if (err.severity !== 'warning') { + { compileErrors[currentFile] && +
      + + { compileErrors[currentFile].error && } + { compileErrors[currentFile].error && (compileErrors[currentFile].error.mode === 'panic') && modal('Error', panicMessage(compileErrors[currentFile].error.formattedMessage), 'Close', null) } + { compileErrors[currentFile].errors && compileErrors[currentFile].errors.length && compileErrors[currentFile].errors.map((err, index) => { + if (hideWarnings) { + if (err.severity !== 'warning') { + return + } + } else { return } - } else { - return - } - }) } -
      + }) } +
      + }
      Date: Tue, 22 Feb 2022 09:23:52 +0100 Subject: [PATCH 070/217] replace without confirming --- .../components/modals/modal-wrapper.tsx | 4 ++- .../src/lib/remix-app/context/provider.tsx | 10 +++--- .../app/src/lib/remix-app/interface/index.ts | 3 +- .../app/src/lib/remix-app/reducer/modals.ts | 3 +- .../modal-dialog/src/lib/types/index.ts | 3 +- .../src/lib/components/OverWriteCheck.tsx | 33 +++++++++++++++++++ .../search/src/lib/components/Search.tsx | 2 ++ .../src/lib/components/results/ResultItem.tsx | 13 ++++++-- .../lib/components/results/ResultSummary.tsx | 12 ++++++- .../search/src/lib/context/context.tsx | 25 +++++++++++--- .../search/src/lib/reducers/Reducer.ts | 17 ++++++++-- libs/remix-ui/search/src/lib/types/index.ts | 7 ++-- 12 files changed, 112 insertions(+), 20 deletions(-) create mode 100644 libs/remix-ui/search/src/lib/components/OverWriteCheck.tsx diff --git a/libs/remix-ui/app/src/lib/remix-app/components/modals/modal-wrapper.tsx b/libs/remix-ui/app/src/lib/remix-app/components/modals/modal-wrapper.tsx index cf5456dc38..12644f5fa7 100644 --- a/libs/remix-ui/app/src/lib/remix-app/components/modals/modal-wrapper.tsx +++ b/libs/remix-ui/app/src/lib/remix-app/components/modals/modal-wrapper.tsx @@ -10,6 +10,7 @@ interface ModalWrapperProps extends ModalDialogProps { const ModalWrapper = (props: ModalWrapperProps) => { const [state, setState] = useState() const ref = useRef() + const data = useRef() const onFinishPrompt = async () => { if (ref.current === undefined) { @@ -21,7 +22,7 @@ const ModalWrapper = (props: ModalWrapperProps) => { } const onOkFn = async () => { - (props.okFn) ? props.okFn() : props.resolve(true) + (props.okFn) ? props.okFn(data.current) : props.resolve(data.current || true) } const onCancelFn = async () => { @@ -37,6 +38,7 @@ const ModalWrapper = (props: ModalWrapperProps) => { } useEffect(() => { + data.current = props.data if (props.modalType) { switch (props.modalType) { case ModalTypes.prompt: diff --git a/libs/remix-ui/app/src/lib/remix-app/context/provider.tsx b/libs/remix-ui/app/src/lib/remix-app/context/provider.tsx index 5d9a3a5815..2aca27c1be 100644 --- a/libs/remix-ui/app/src/lib/remix-app/context/provider.tsx +++ b/libs/remix-ui/app/src/lib/remix-app/context/provider.tsx @@ -15,18 +15,18 @@ export const ModalProvider = ({ children = [], reducer = modalReducer, initialSt }) } - const modal = (data: AppModal) => { - const { id, title, message, okLabel, okFn, cancelLabel, cancelFn, modalType, defaultValue, hideFn } = data + const modal = (modalData: AppModal) => { + const { id, title, message, okLabel, okFn, cancelLabel, cancelFn, modalType, defaultValue, hideFn, data } = modalData return new Promise((resolve, reject) => { dispatch({ type: modalActionTypes.setModal, - payload: { id, title, message, okLabel, okFn, cancelLabel, cancelFn, modalType: modalType || ModalTypes.default, defaultValue: defaultValue, hideFn, resolve, next: onNextFn } + payload: { id, title, message, okLabel, okFn, cancelLabel, cancelFn, modalType: modalType || ModalTypes.default, defaultValue: defaultValue, hideFn, resolve, next: onNextFn, data } }) }) } - const alert = (data: AlertModal) => { - return modal({ id: data.id, title: data.title || 'Alert', message: data.message || data.title, okLabel: 'OK', okFn: (value?:any) => {}, cancelLabel: '', cancelFn: () => {} }) + const alert = (modalData: AlertModal) => { + return modal({ id: modalData.id, title: modalData.title || 'Alert', message: modalData.message || modalData.title, okLabel: 'OK', okFn: (value?:any) => {}, cancelLabel: '', cancelFn: () => {} }) } const handleHideModal = () => { diff --git a/libs/remix-ui/app/src/lib/remix-app/interface/index.ts b/libs/remix-ui/app/src/lib/remix-app/interface/index.ts index af25ce13b9..f31536678e 100644 --- a/libs/remix-ui/app/src/lib/remix-app/interface/index.ts +++ b/libs/remix-ui/app/src/lib/remix-app/interface/index.ts @@ -15,7 +15,8 @@ export interface AppModal { defaultValue?: string hideFn?: () => void, resolve?: (value?:any) => void, - next?: () => void + next?: () => void, + data?: any } export interface AlertModal { diff --git a/libs/remix-ui/app/src/lib/remix-app/reducer/modals.ts b/libs/remix-ui/app/src/lib/remix-app/reducer/modals.ts index 8a1c89ac79..a50a3dbd66 100644 --- a/libs/remix-ui/app/src/lib/remix-app/reducer/modals.ts +++ b/libs/remix-ui/app/src/lib/remix-app/reducer/modals.ts @@ -20,7 +20,8 @@ export const modalReducer = (state: ModalState = ModalInitialState, action: Moda defaultValue: action.payload.defaultValue, hideFn: action.payload.hideFn, resolve: action.payload.resolve, - next: action.payload.next + next: action.payload.next, + data: action.payload.data } const modalList: AppModal[] = state.modals.slice() diff --git a/libs/remix-ui/modal-dialog/src/lib/types/index.ts b/libs/remix-ui/modal-dialog/src/lib/types/index.ts index db473683d1..a8793971d7 100644 --- a/libs/remix-ui/modal-dialog/src/lib/types/index.ts +++ b/libs/remix-ui/modal-dialog/src/lib/types/index.ts @@ -14,5 +14,6 @@ export interface ModalDialogProps { handleHide: (hideState?: boolean) => void, children?: React.ReactNode, resolve?: (value?:any) => void, - next?: () => void + next?: () => void, + data?: any } diff --git a/libs/remix-ui/search/src/lib/components/OverWriteCheck.tsx b/libs/remix-ui/search/src/lib/components/OverWriteCheck.tsx new file mode 100644 index 0000000000..dfe193ca9e --- /dev/null +++ b/libs/remix-ui/search/src/lib/components/OverWriteCheck.tsx @@ -0,0 +1,33 @@ +import React, { useContext, useEffect, useRef, useState } from 'react' +import { SearchContext } from '../context/context' + +export const OverWriteCheck = props => { + const { setReplaceWithoutConfirmation } = useContext(SearchContext) + + const change = e => { + console.log(e.target.checked) + setReplaceWithoutConfirmation(e.target.checked) + } + + return ( + <> +
      +
      + + +
      +
      + + ) +} diff --git a/libs/remix-ui/search/src/lib/components/Search.tsx b/libs/remix-ui/search/src/lib/components/Search.tsx index 05a856832e..3df0d37a4a 100644 --- a/libs/remix-ui/search/src/lib/components/Search.tsx +++ b/libs/remix-ui/search/src/lib/components/Search.tsx @@ -6,6 +6,7 @@ import '../search.css' import { Include } from './Include' import { Exclude } from './Exclude' import { Replace } from './Replace' +import { OverWriteCheck } from './OverWriteCheck' export const SearchTab = props => { @@ -19,6 +20,7 @@ return ( +
      diff --git a/libs/remix-ui/search/src/lib/components/results/ResultItem.tsx b/libs/remix-ui/search/src/lib/components/results/ResultItem.tsx index baf61ecaca..b9522ed1c1 100644 --- a/libs/remix-ui/search/src/lib/components/results/ResultItem.tsx +++ b/libs/remix-ui/search/src/lib/components/results/ResultItem.tsx @@ -1,4 +1,4 @@ -import React, { useContext, useEffect, useState } from 'react' +import React, { useContext, useEffect, useRef, useState } from 'react' import { SearchContext } from '../../context/context' import { SearchResult, SearchResultLine } from '../../types' import { ResultFileName } from './ResultFileName' @@ -9,15 +9,23 @@ interface ResultItemProps { } export const ResultItem = (props: ResultItemProps) => { - const { state, findText } = useContext(SearchContext) + const { state, findText, disableForceReload } = useContext(SearchContext) const [loading, setLoading] = useState(false) const [lines, setLines] = useState([]) const [toggleExpander, setToggleExpander] = useState(false) + const reloadTimeOut = useRef(null) useEffect(() => { reload() }, [props.file.timeStamp]) + useEffect(() => { + if(props.file.forceReload){ + clearTimeout(reloadTimeOut.current) + reloadTimeOut.current = setTimeout(() => reload(), 1000) + } + }, [props.file.forceReload]) + const toggleClass = () => { setToggleExpander(!toggleExpander) } @@ -30,6 +38,7 @@ export const ResultItem = (props: ResultItemProps) => { findText(props.file.filename).then(res => { setLines(res) setLoading(false) + disableForceReload(props.file.filename) }) } diff --git a/libs/remix-ui/search/src/lib/components/results/ResultSummary.tsx b/libs/remix-ui/search/src/lib/components/results/ResultSummary.tsx index e9b468b019..90f03991a7 100644 --- a/libs/remix-ui/search/src/lib/components/results/ResultSummary.tsx +++ b/libs/remix-ui/search/src/lib/components/results/ResultSummary.tsx @@ -1,3 +1,4 @@ +import { useDialogDispatchers } from 'libs/remix-ui/app/src/lib/remix-app/context/provider' import React, { useContext } from 'react' import { SearchContext } from '../../context/context' import { SearchResult, SearchResultLine, SearchResultLineLine } from '../../types' @@ -10,11 +11,12 @@ interface ResultSummaryProps { export const ResultSummary = (props: ResultSummaryProps) => { const { hightLightInPath, replaceText, state } = useContext(SearchContext) + const { modal } = useDialogDispatchers() const selectLine = async (line: SearchResultLineLine) => { await hightLightInPath(props.searchResult, line) } - const replace = async (line: SearchResultLineLine) => { + const confirmReplace = async (line: SearchResultLineLine) => { props.setLoading(true) try{ await replaceText(props.searchResult, line) @@ -23,6 +25,14 @@ export const ResultSummary = (props: ResultSummaryProps) => { } } + const replace = async (line: SearchResultLineLine) => { + if(state.replaceWithOutConfirmation){ + confirmReplace(line) + }else{ + modal({ id: 'matomoModal', title: 'Replace', message: `Are you sure you want to replace '${line.center}' by '${state.replace}' in ${props.searchResult.filename}?`, okLabel: 'Yes', okFn: confirmReplace, cancelLabel: 'No', cancelFn: ()=>{}, data: line }) + } + } + return ( <> {props.line.lines.map((lineItem, index) => ( diff --git a/libs/remix-ui/search/src/lib/context/context.tsx b/libs/remix-ui/search/src/lib/context/context.tsx index 7d5b13c71e..d4e50f3814 100644 --- a/libs/remix-ui/search/src/lib/context/context.tsx +++ b/libs/remix-ui/search/src/lib/context/context.tsx @@ -33,6 +33,8 @@ export interface SearchingStateInterface { toggleCaseSensitive: () => void toggleMatchWholeWord: () => void toggleUseRegex: () => void + setReplaceWithoutConfirmation: (value: boolean) => void + disableForceReload: (file: string) => void } export const SearchContext = createContext(null) @@ -120,6 +122,18 @@ export const SearchProvider = ({ payload: undefined }) }, + setReplaceWithoutConfirmation: (value: boolean) => { + dispatch({ + type: 'SET_REPLACE_WITHOUT_CONFIRMATION', + payload: value + }) + }, + disableForceReload: (file: string) => { + dispatch({ + type: 'DISABLE_FORCE_RELOAD', + payload: file + }) + }, findText: async (path: string) => { if (!plugin) return try { @@ -165,10 +179,12 @@ export const SearchProvider = ({ } const reloadStateForFile = async (file: string) => { - clearTimeout(reloadTimeOut.current) - reloadTimeOut.current = setTimeout(async () => { + //clearTimeout(reloadTimeOut.current) + console.log('reload file', file) + //reloadTimeOut.current = setTimeout(async () => { + console.log('calling file', file) await value.reloadFile(file) - }, 1000) + //}, 1000) } useEffect(() => { @@ -198,7 +214,8 @@ export const SearchProvider = ({ filename: file, lines: [], path: file, - timeStamp: Date.now() + timeStamp: Date.now(), + forceReload: false } return r }) diff --git a/libs/remix-ui/search/src/lib/reducers/Reducer.ts b/libs/remix-ui/search/src/lib/reducers/Reducer.ts index 2738caa95f..0ead0fac4d 100644 --- a/libs/remix-ui/search/src/lib/reducers/Reducer.ts +++ b/libs/remix-ui/search/src/lib/reducers/Reducer.ts @@ -51,11 +51,24 @@ export const SearchReducer = (state: SearchState = SearchingInitialState, action ...state, matchWord: !state.matchWord, timeStamp: Date.now() - } + } + case 'SET_REPLACE_WITHOUT_CONFIRMATION': + return { + ...state, + replaceWithOutConfirmation: action.payload, + } + case 'DISABLE_FORCE_RELOAD': + if (state.searchResults) { + const findFile = state.searchResults.find(file => file.filename === action.payload) + if (findFile) findFile.forceReload = false + } + return { + ...state, + } case 'RELOAD_FILE': if (state.searchResults) { const findFile = state.searchResults.find(file => file.filename === action.payload) - if (findFile) findFile.timeStamp = Date.now() + if (findFile) findFile.forceReload = true } return { ...state, diff --git a/libs/remix-ui/search/src/lib/types/index.ts b/libs/remix-ui/search/src/lib/types/index.ts index 4521bfb658..7b3d06e1b3 100644 --- a/libs/remix-ui/search/src/lib/types/index.ts +++ b/libs/remix-ui/search/src/lib/types/index.ts @@ -29,7 +29,8 @@ export interface SearchResult { filename: string, path: string, lines: SearchResultLine[], - timeStamp: number + timeStamp: number, + forceReload: boolean } export interface SearchState { @@ -40,8 +41,9 @@ export interface SearchState { exclude: string, casesensitive: boolean, matchWord: boolean, + replaceWithOutConfirmation: boolean, useRegExp: boolean, - timeStamp: number + timeStamp: number, } export const SearchingInitialState: SearchState = { @@ -53,5 +55,6 @@ export const SearchingInitialState: SearchState = { casesensitive: false, matchWord: false, useRegExp: false, + replaceWithOutConfirmation: false, timeStamp: 0 } \ No newline at end of file From 513e670fd0996f08fe5a2cc0d60f64846344a16b Mon Sep 17 00:00:00 2001 From: filip mertens Date: Tue, 22 Feb 2022 09:37:31 +0100 Subject: [PATCH 071/217] update tests --- apps/remix-ide-e2e/src/tests/search.test.ts | 16 ++++++++++++++++ .../search/src/lib/components/OverWriteCheck.tsx | 2 +- .../src/lib/components/results/ResultSummary.tsx | 2 +- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/search.test.ts b/apps/remix-ide-e2e/src/tests/search.test.ts index cfcbe506af..ea6249adcb 100644 --- a/apps/remix-ide-e2e/src/tests/search.test.ts +++ b/apps/remix-ide-e2e/src/tests/search.test.ts @@ -72,12 +72,28 @@ module.exports = { .moveToElement('*[data-id="contracts/2_Owner.sol-30-71"]', 10, 10) .waitForElementVisible('*[data-id="replace-contracts/2_Owner.sol-30-71"]') .click('*[data-id="replace-contracts/2_Owner.sol-30-71"]').pause(2000). + modalFooterOKClick('confirmreplace').pause(2000). getEditorValue((content) => { browser.assert.ok(content.includes('replacing deployer for a constructor'), 'should replace text ok') }) }, + 'Should replace text without confirmation': function (browser: NightwatchBrowser) { + browser.click('*[data-id="confirm_replace_label"]').pause(500) + .clearValue('*[id="search_input"]') + .setValue('*[id="search_input"]', 'replacing').pause(1000) + .setValue('*[id="search_replace"]', '2').pause(1000) + .waitForElementVisible('*[data-id="contracts/2_Owner.sol-30-71"]') + .moveToElement('*[data-id="contracts/2_Owner.sol-30-71"]', 10, 10) + .waitForElementVisible('*[data-id="replace-contracts/2_Owner.sol-30-71"]') + .click('*[data-id="replace-contracts/2_Owner.sol-30-71"]').pause(2000). + getEditorValue((content) => { + browser.assert.ok(content.includes('replacing2 deployer for a constructor'), 'should replace text ok') + }) + }, 'Should find text with include': function (browser: NightwatchBrowser) { browser + .clearValue('*[id="search_input"]') + .setValue('*[id="search_input"]', 'contract').pause(1000) .setValue('*[id="search_include"]', 'contracts/**').pause(2000) .elements('css selector','.search_line', (res) => { Array.isArray(res.value) && browser.assert.equal(res.value.length, 4) diff --git a/libs/remix-ui/search/src/lib/components/OverWriteCheck.tsx b/libs/remix-ui/search/src/lib/components/OverWriteCheck.tsx index dfe193ca9e..2c3e0300c1 100644 --- a/libs/remix-ui/search/src/lib/components/OverWriteCheck.tsx +++ b/libs/remix-ui/search/src/lib/components/OverWriteCheck.tsx @@ -21,7 +21,7 @@ export const OverWriteCheck = props => { />
      + { state.debugging && state.sourceLocationStatus &&
      {state.sourceLocationStatus}
      } { state.debugging && } { state.debugging && }
      From 34dd9cedfd8685201b3afc55ddbdadc531f52493 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 16 Feb 2022 13:50:49 +0100 Subject: [PATCH 079/217] fix displaying reverted calls in debugger --- libs/remix-debug/src/debugger/stepManager.ts | 13 ++++++++----- .../src/lib/button-navigator/button-navigator.css | 4 ++++ .../src/lib/button-navigator/button-navigator.tsx | 9 ++++----- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/libs/remix-debug/src/debugger/stepManager.ts b/libs/remix-debug/src/debugger/stepManager.ts index 1a64977e97..6fd2e5fa22 100644 --- a/libs/remix-debug/src/debugger/stepManager.ts +++ b/libs/remix-debug/src/debugger/stepManager.ts @@ -51,15 +51,18 @@ export class DebuggerStepManager { this.traceManager.buildCallPath(index).then((callsPath) => { this.currentCall = callsPath[callsPath.length - 1] if (this.currentCall.reverted) { - const revertedReason = this.currentCall.outofgas ? 'outofgas' : '' + const revertedReason = this.currentCall.outofgas ? 'outofgas' : 'reverted' this.revertionPoint = this.currentCall.return - return this.event.trigger('revertWarning', [revertedReason]) + this.event.trigger('revertWarning', [revertedReason]) + return } for (let k = callsPath.length - 2; k >= 0; k--) { const parent = callsPath[k] - if (!parent.reverted) continue - this.revertionPoint = parent.return - this.event.trigger('revertWarning', ['parenthasthrown']) + if (parent.reverted) { + this.revertionPoint = parent.return + this.event.trigger('revertWarning', ['parenthasthrown']) + return + } } this.event.trigger('revertWarning', ['']) }).catch((error) => { diff --git a/libs/remix-ui/debugger-ui/src/lib/button-navigator/button-navigator.css b/libs/remix-ui/debugger-ui/src/lib/button-navigator/button-navigator.css index 8990810a9e..835b54615b 100644 --- a/libs/remix-ui/debugger-ui/src/lib/button-navigator/button-navigator.css +++ b/libs/remix-ui/debugger-ui/src/lib/button-navigator/button-navigator.css @@ -19,4 +19,8 @@ .navigator { } .navigator:hover { +} + +.cursorPointerRemixDebugger { + cursor: pointer; } \ No newline at end of file diff --git a/libs/remix-ui/debugger-ui/src/lib/button-navigator/button-navigator.tsx b/libs/remix-ui/debugger-ui/src/lib/button-navigator/button-navigator.tsx index 680c3b9ef8..5200de41f7 100644 --- a/libs/remix-ui/debugger-ui/src/lib/button-navigator/button-navigator.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/button-navigator/button-navigator.tsx @@ -65,11 +65,10 @@ export const ButtonNavigation = ({ stepOverBack, stepIntoBack, stepIntoForward,
      - - State changes made during this call will be reverted. - This call will run out of gas. - The parent call will throw an exception + This call has reverted, state changes made during the call will be reverted. + This call will run out of gas. + The parent call will throw an exception +
      Click { jumpToException && jumpToException() }}>here to jump where the call reverted.
      ) From d76d77b083af05ce391fa6cfd737bf77ac883d4c Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 17 Feb 2022 10:36:06 +0100 Subject: [PATCH 080/217] stop updating the debugger for every slider update --- .../debugger-ui/src/lib/slider/slider.tsx | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/libs/remix-ui/debugger-ui/src/lib/slider/slider.tsx b/libs/remix-ui/debugger-ui/src/lib/slider/slider.tsx index 81e036a8b8..06fe05e949 100644 --- a/libs/remix-ui/debugger-ui/src/lib/slider/slider.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/slider/slider.tsx @@ -1,10 +1,12 @@ -import React, { useState, useEffect } from 'react' // eslint-disable-line +import React, { useState, useEffect, useRef } from 'react' // eslint-disable-line export const Slider = ({ jumpTo, sliderValue, traceLength }) => { const [state, setState] = useState({ currentValue: 0 }) + const onChangeId = useRef(null) + useEffect(() => { setValue(sliderValue) }, [sliderValue]) @@ -18,9 +20,16 @@ export const Slider = ({ jumpTo, sliderValue, traceLength }) => { } const handleChange = (e) => { - const value = parseInt(e.target.value) - - setValue(value) + if (onChangeId.current) { + window.clearTimeout(onChangeId.current) + } + ((value) => { + onChangeId.current = setTimeout(() => { + console.log(value) + value = parseInt(value) + setValue(value) + }, 100) + })(e.target.value) } return ( From 164715c3e25ccfde3f869d4af82da6bba5c9d16a Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 17 Feb 2022 11:13:13 +0100 Subject: [PATCH 081/217] fix e2e --- apps/remix-ide-e2e/src/commands/goToVMTraceStep.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/remix-ide-e2e/src/commands/goToVMTraceStep.ts b/apps/remix-ide-e2e/src/commands/goToVMTraceStep.ts index e84ab52367..688ac7a635 100644 --- a/apps/remix-ide-e2e/src/commands/goToVMTraceStep.ts +++ b/apps/remix-ide-e2e/src/commands/goToVMTraceStep.ts @@ -12,6 +12,7 @@ class GoToVmTraceStep extends EventEmitter { function goToVMtraceStep (browser: NightwatchBrowser, step: number, incr: number, done: VoidFunction) { browser.execute(function (step) { (document.getElementById('slider') as HTMLInputElement).value = (step - 1).toString() }, [step]) .setValue('*[data-id="slider"]', new Array(1).fill(browser.Keys.RIGHT_ARROW)) + .pause(500) .perform(() => { done() }) From 526ed2aacb97d59185309f29e84f7e4f11058b38 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 17 Feb 2022 16:34:37 +0100 Subject: [PATCH 082/217] refactor Web3VmProvider to VmProxy --- apps/remix-ide-e2e/src/tests/debugger.test.ts | 20 +------ .../src/tests/solidityUnittests.test.ts | 16 ++---- libs/remix-debug/src/Ethdebugger.ts | 1 - libs/remix-lib/README.md | 5 -- libs/remix-lib/src/index.ts | 11 +--- .../src/web3Provider/dummyProvider.ts | 55 ------------------- .../src/web3Provider/web3Providers.ts | 38 ------------- .../src/VmProxy.ts} | 49 ++++++++++------- libs/remix-simulator/src/vm-context.ts | 40 +++++++++----- 9 files changed, 65 insertions(+), 170 deletions(-) delete mode 100644 libs/remix-lib/src/web3Provider/dummyProvider.ts delete mode 100644 libs/remix-lib/src/web3Provider/web3Providers.ts rename libs/{remix-lib/src/web3Provider/web3VmProvider.ts => remix-simulator/src/VmProxy.ts} (89%) diff --git a/apps/remix-ide-e2e/src/tests/debugger.test.ts b/apps/remix-ide-e2e/src/tests/debugger.test.ts index cd3fafc3b3..e9292689e8 100644 --- a/apps/remix-ide-e2e/src/tests/debugger.test.ts +++ b/apps/remix-ide-e2e/src/tests/debugger.test.ts @@ -39,10 +39,7 @@ module.exports = { 'Should debug transaction using slider #group1': function (browser: NightwatchBrowser) { browser.waitForElementVisible('*[data-id="verticalIconsKindudapp"]') .waitForElementVisible('*[data-id="slider"]') - // eslint-disable-next-line dot-notation - .execute(function () { document.getElementById('slider')['value'] = '50' }) // It only moves slider to 50 but vm traces are not updated - .setValue('*[data-id="slider"]', new Array(1).fill(browser.Keys.RIGHT_ARROW)) - .pause(2000) + .goToVMTraceStep(51) .click('*[data-id="dropdownPanelSolidityLocals"]') .waitForElementContainsText('*[data-id="solidityLocals"]', 'no locals', 60000) .waitForElementContainsText('*[data-id="stepdetail"]', 'vm trace step:\n51', 60000) @@ -159,10 +156,7 @@ module.exports = { .pause(2000) .debugTransaction(0) .waitForElementVisible('*[data-id="slider"]').pause(2000) - // .setValue('*[data-id="slider"]', '5000') // Like this, setValue doesn't work properly for input type = range - // eslint-disable-next-line dot-notation - .execute(function () { document.getElementById('slider')['value'] = '7450' }).pause(10000) // It only moves slider to 7450 but vm traces are not updated - .setValue('*[data-id="slider"]', new Array(3).fill(browser.Keys.RIGHT_ARROW)) // This will press NEXT 3 times and will update the trace details + .goToVMTraceStep(7453) .waitForElementPresent('*[data-id="treeViewDivtreeViewItemarray"]') .click('*[data-id="treeViewDivtreeViewItemarray"]') .waitForElementPresent('*[data-id="treeViewDivtreeViewLoadMore"]') @@ -210,15 +204,7 @@ module.exports = { .pause(3000) .clickLaunchIcon('debugger') .waitForElementVisible('*[data-id="slider"]') - // eslint-disable-next-line dot-notation - .execute(function () { document.getElementById('slider')['value'] = '153' }) // It only moves slider to 153 but vm traces are not updated - .setValue('*[data-id="slider"]', new Array(1).fill(browser.Keys.RIGHT_ARROW)) - .pause(1000) - /* - setting the slider to 5 leads to "vm trace step: 91" for chrome and "vm trace step: 92" for firefox - => There is something going wrong with the nightwatch API here. - As we are only testing if debugger is active, this is ok to keep that for now. - */ + .goToVMTraceStep(154) .waitForElementContainsText('*[data-id="stepdetail"]', 'vm trace step:\n154', 60000) }, diff --git a/apps/remix-ide-e2e/src/tests/solidityUnittests.test.ts b/apps/remix-ide-e2e/src/tests/solidityUnittests.test.ts index 30d1a2c83c..bc1bb12cd7 100644 --- a/apps/remix-ide-e2e/src/tests/solidityUnittests.test.ts +++ b/apps/remix-ide-e2e/src/tests/solidityUnittests.test.ts @@ -283,9 +283,7 @@ module.exports = { .waitForElementVisible('*[data-id="dropdownPanelSolidityLocals"]').pause(1000) .click('*[data-id="dropdownPanelSolidityLocals"]') .waitForElementContainsText('*[data-id="solidityLocals"]', 'no locals', 60000) - // eslint-disable-next-line dot-notation - .execute(function () { document.getElementById('slider')['value'] = '315' }) // It only moves slider to 315 but vm traces are not updated - .setValue('*[data-id="slider"]', new Array(1).fill(browser.Keys.RIGHT_ARROW)) + .goToVMTraceStep(316) .waitForElementContainsText('*[data-id="functionPanel"]', 'checkWinningProposalFailed()', 60000) .waitForElementContainsText('*[data-id="functionPanel"]', 'vote(proposal)', 60000) .pause(5000) @@ -295,9 +293,7 @@ module.exports = { .scrollAndClick('#Check_winning_proposal_passed') .waitForElementContainsText('*[data-id="sidePanelSwapitTitle"]', 'DEBUGGER', 60000) .waitForElementContainsText('*[data-id="functionPanel"]', 'checkWinningProposalPassed()', 60000) - // eslint-disable-next-line dot-notation - .execute(function () { document.getElementById('slider')['value'] = '1450' }) - .setValue('*[data-id="slider"]', new Array(1).fill(browser.Keys.RIGHT_ARROW)) + .goToVMTraceStep(1451) .waitForElementContainsText('*[data-id="functionPanel"]', 'equal(a, b, message)', 60000) .waitForElementContainsText('*[data-id="functionPanel"]', 'checkWinningProposalPassed()', 60000) // remix_test.sol should be opened in editor @@ -307,9 +303,7 @@ module.exports = { .scrollAndClick('#Check_winning_proposal_again') .waitForElementContainsText('*[data-id="sidePanelSwapitTitle"]', 'DEBUGGER', 60000) .waitForElementContainsText('*[data-id="functionPanel"]', 'checkWinningProposalAgain()', 60000) - // eslint-disable-next-line dot-notation - .execute(function () { document.getElementById('slider')['value'] = '1150' }) - .setValue('*[data-id="slider"]', new Array(1).fill(browser.Keys.RIGHT_ARROW)) + .goToVMTraceStep(1151) .waitForElementContainsText('*[data-id="functionPanel"]', 'equal(a, b, message)', 60000) .waitForElementContainsText('*[data-id="functionPanel"]', 'checkWinningProposalAgain()', 60000) .pause(5000) @@ -317,9 +311,7 @@ module.exports = { .scrollAndClick('#Check_winnin_proposal_with_return_value').pause(5000) .waitForElementContainsText('*[data-id="sidePanelSwapitTitle"]', 'DEBUGGER', 60000) .waitForElementContainsText('*[data-id="functionPanel"]', 'checkWinninProposalWithReturnValue()', 60000) - // eslint-disable-next-line dot-notation - .execute(function () { document.getElementById('slider')['value'] = '320' }) - .setValue('*[data-id="slider"]', new Array(1).fill(browser.Keys.RIGHT_ARROW)) + .goToVMTraceStep(321) .waitForElementContainsText('*[data-id="functionPanel"]', 'checkWinninProposalWithReturnValue()', 60000) .clickLaunchIcon('filePanel') .pause(2000) diff --git a/libs/remix-debug/src/Ethdebugger.ts b/libs/remix-debug/src/Ethdebugger.ts index 0026c97ee9..e0f1a92ab5 100644 --- a/libs/remix-debug/src/Ethdebugger.ts +++ b/libs/remix-debug/src/Ethdebugger.ts @@ -11,7 +11,6 @@ import { SolidityProxy, stateDecoder, localDecoder, InternalCallTree } from './s /** * Ethdebugger is a wrapper around a few classes that helps debugging a transaction * - * - Web3Providers - define which environment (web3) the transaction will be retrieved from * - TraceManager - Load / Analyze the trace and retrieve details of specific test * - CodeManager - Retrieve loaded byte code and help to resolve AST item from vmtrace index * - SolidityProxy - Basically used to extract state variable from AST diff --git a/libs/remix-lib/README.md b/libs/remix-lib/README.md index 35be57053c..31075ad154 100644 --- a/libs/remix-lib/README.md +++ b/libs/remix-lib/README.md @@ -23,11 +23,6 @@ ui: uiHelper, compiler: compilerHelper }, - vm: { - Web3Providers: Web3Providers, - DummyProvider: DummyProvider, - Web3VMProvider: Web3VmProvider - }, Storage: Storage, util: util, execution: { diff --git a/libs/remix-lib/src/index.ts b/libs/remix-lib/src/index.ts index 54646e326e..1f2cdb6676 100644 --- a/libs/remix-lib/src/index.ts +++ b/libs/remix-lib/src/index.ts @@ -2,9 +2,6 @@ import { EventManager } from './eventManager' import * as uiHelper from './helpers/uiHelper' import * as compilerHelper from './helpers/compilerHelper' import * as util from './util' -import { Web3Providers } from './web3Provider/web3Providers' -import { DummyProvider } from './web3Provider/dummyProvider' -import { Web3VmProvider } from './web3Provider/web3VmProvider' import { Storage } from './storage' import { EventsDecoder } from './execution/eventsDecoder' import * as txExecution from './execution/txExecution' @@ -18,6 +15,7 @@ import * as typeConversion from './execution/typeConversion' import { TxRunnerVM } from './execution/txRunnerVM' import { TxRunnerWeb3 } from './execution/txRunnerWeb3' import * as txResultHelper from './helpers/txResultHelper' +export { ConsoleLogs } from './helpers/hhconsoleSigs' export { ICompilerApi, ConfigurationSettings } from './types/ICompilerApi' export { QueryParams } from './query-params' @@ -26,11 +24,6 @@ const helpers = { compiler: compilerHelper, txResultHelper } -const vm = { - Web3Providers: Web3Providers, - DummyProvider: DummyProvider, - Web3VMProvider: Web3VmProvider -} const execution = { EventsDecoder: EventsDecoder, txExecution: txExecution, @@ -44,4 +37,4 @@ const execution = { LogsManager, forkAt } -export { EventManager, helpers, vm, Storage, util, execution } +export { EventManager, helpers, Storage, util, execution } diff --git a/libs/remix-lib/src/web3Provider/dummyProvider.ts b/libs/remix-lib/src/web3Provider/dummyProvider.ts deleted file mode 100644 index c6e4ec8d82..0000000000 --- a/libs/remix-lib/src/web3Provider/dummyProvider.ts +++ /dev/null @@ -1,55 +0,0 @@ -export class DummyProvider { - eth - debug - providers - currentProvider - - constructor () { - this.eth = {} - this.debug = {} - this.eth.getCode = (address, cb) => { return this.getCode(address, cb) } - this.eth.getTransaction = (hash, cb) => { return this.getTransaction(hash, cb) } - this.eth.getTransactionFromBlock = (blockNumber, txIndex, cb) => { return this.getTransactionFromBlock(blockNumber, txIndex, cb) } - this.eth.getBlockNumber = (cb) => { return this.getBlockNumber(cb) } - this.debug.traceTransaction = (hash, options, cb) => { return this.traceTransaction(hash, options, cb) } - this.debug.storageRangeAt = (blockNumber, txIndex, address, start, end, maxLength, cb) => { return this.storageRangeAt(blockNumber, txIndex, address, start, end, maxLength, cb) } - this.providers = { HttpProvider: function (url) {} } - this.currentProvider = { host: '' } - } - - getCode (address, cb) { - cb(null, '') - } - - setProvider (provider) {} - - traceTransaction (txHash, options, cb) { - if (cb) { - cb(null, {}) - } - return {} - } - - storageRangeAt (blockNumber, txIndex, address, start, end, maxLength, cb) { - if (cb) { - cb(null, {}) - } - return {} - } - - getBlockNumber (cb) { cb(null, '') } - - getTransaction (txHash, cb) { - if (cb) { - cb(null, {}) - } - return {} - } - - getTransactionFromBlock (blockNumber, txIndex, cb) { - if (cb) { - cb(null, {}) - } - return {} - } -} diff --git a/libs/remix-lib/src/web3Provider/web3Providers.ts b/libs/remix-lib/src/web3Provider/web3Providers.ts deleted file mode 100644 index dc68edb434..0000000000 --- a/libs/remix-lib/src/web3Provider/web3Providers.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { Web3VmProvider } from './web3VmProvider' -import { loadWeb3, extendWeb3 } from '../init' - -export class Web3Providers { - modes - constructor () { - this.modes = {} - } - - addProvider (type, obj) { - if (type === 'INTERNAL') { - const web3 = loadWeb3() - this.addWeb3(type, web3) - } else if (type === 'vm') { - this.addVM(type, obj) - } else { - extendWeb3(obj) - this.addWeb3(type, obj) - } - } - - get (type, cb) { - if (this.modes[type]) { - return cb(null, this.modes[type]) - } - cb('error: this provider has not been setup (' + type + ')', null) - } - - addWeb3 (type, web3) { - this.modes[type] = web3 - } - - addVM (type, vm) { - const vmProvider = new Web3VmProvider() - vmProvider.setVM(vm) - this.modes[type] = vmProvider - } -} diff --git a/libs/remix-lib/src/web3Provider/web3VmProvider.ts b/libs/remix-simulator/src/VmProxy.ts similarity index 89% rename from libs/remix-lib/src/web3Provider/web3VmProvider.ts rename to libs/remix-simulator/src/VmProxy.ts index ecc006da9e..f7090d8b1d 100644 --- a/libs/remix-lib/src/web3Provider/web3VmProvider.ts +++ b/libs/remix-simulator/src/VmProxy.ts @@ -1,12 +1,16 @@ -import { hexListFromBNs, formatMemory } from '../util' -import { normalizeHexAddress } from '../helpers/uiHelper' -import { ConsoleLogs } from '../helpers/hhconsoleSigs' +import { util } from '@remix-project/remix-lib' +const { hexListFromBNs, formatMemory } = util +import { helpers } from '@remix-project/remix-lib' +const { normalizeHexAddress } = helpers.ui +import { ConsoleLogs } from '@remix-project/remix-lib' import { toChecksumAddress, BN, bufferToHex, Address } from 'ethereumjs-util' import Web3 from 'web3' import { ethers } from 'ethers' +import { VMContext } from './vm-context' -export class Web3VmProvider { - web3 +export class VmProxy { + vmContext: VMContext + web3: Web3 vm vmTraces txs @@ -38,7 +42,8 @@ export class Web3VmProvider { blocks latestBlockNumber - constructor () { + constructor (vmContext: VMContext) { + this.vmContext = vmContext this.web3 = new Web3() this.vm = null this.vmTraces = {} @@ -66,15 +71,15 @@ export class Web3VmProvider { this.lastProcessedStorageTxHash = {} this.sha3Preimages = {} // util - this.sha3 = (...args) => this.web3.utils.sha3(...args) - this.toHex = (...args) => this.web3.utils.toHex(...args) - this.toAscii = (...args) => this.web3.utils.hexToAscii(...args) - this.fromAscii = (...args) => this.web3.utils.asciiToHex(...args) - this.fromDecimal = (...args) => this.web3.utils.numberToHex(...args) - this.fromWei = (...args) => this.web3.utils.fromWei(...args) - this.toWei = (...args) => this.web3.utils.toWei(...args) - this.toBigNumber = (...args) => this.web3.utils.toBN(...args) - this.isAddress = (...args) => this.web3.utils.isAddress(...args) + this.sha3 = (...args) => this.web3.utils.sha3.apply(this, args) + this.toHex = (...args) => this.web3.utils.toHex.apply(this, args) + this.toAscii = (...args) => this.web3.utils.toAscii.apply(this, args) + this.fromAscii = (...args) => this.web3.utils.fromAscii.apply(this, args) + this.fromDecimal = (...args) => this.web3.utils.fromDecimal.apply(this, args) + this.fromWei = (...args) => this.web3.utils.fromWei.apply(this, args) + this.toWei = (...args) => this.web3.utils.toWei.apply(this, args) + this.toBigNumber = (...args) => this.web3.utils.toBN.apply(this, args) + this.isAddress = (...args) => this.web3.utils.isAddress.apply(this, args) this.utils = Web3.utils || [] this.txsMapBlock = {} this.blocks = {} @@ -289,16 +294,22 @@ export class Web3VmProvider { } } - storageRangeAt (blockNumber, txIndex, address, start, maxLength, cb) { // txIndex is the hash in the case of the VM + storageRangeAt (blockNumber, txIndex, address, start, maxLength, cb) { // we don't use the range params here address = toChecksumAddress(address) + let txHash if (txIndex === 'latest') { - txIndex = this.lastProcessedStorageTxHash[address] + txHash = this.lastProcessedStorageTxHash[address] + } else { + const block = this.vmContext.blocks[blockNumber] + txHash = '0x' + block.transactions[txIndex].hash().toString('hex') } + + - if (this.storageCache[txIndex] && this.storageCache[txIndex][address]) { - const storage = this.storageCache[txIndex][address] + if (this.storageCache[txHash] && this.storageCache[txHash][address]) { + const storage = this.storageCache[txHash][address] return cb(null, { storage: JSON.parse(JSON.stringify(storage)), nextKey: null diff --git a/libs/remix-simulator/src/vm-context.ts b/libs/remix-simulator/src/vm-context.ts index e862fd0e3f..9e9afdef0a 100644 --- a/libs/remix-simulator/src/vm-context.ts +++ b/libs/remix-simulator/src/vm-context.ts @@ -2,11 +2,15 @@ 'use strict' import Web3 from 'web3' import { rlp, keccak, bufferToHex } from 'ethereumjs-util' -import { vm as remixLibVm, execution } from '@remix-project/remix-lib' +import { execution } from '@remix-project/remix-lib' +const { LogsManager } = execution +import { VmProxy } from './VmProxy' import VM from '@ethereumjs/vm' import Common from '@ethereumjs/common' import StateManager from '@ethereumjs/vm/dist/state/stateManager' import { StorageDump } from '@ethereumjs/vm/dist/state/interface' +import { Block } from '@ethereumjs/block' +import { Transaction } from '@ethereumjs/tx' /* extend vm state manager and instanciate VM @@ -75,6 +79,13 @@ class StateManagerCommonStorageDump extends StateManager { } } +export type CurrentVm = { + vm: VM, + web3vm: VmProxy, + stateManager: StateManagerCommonStorageDump, + common: Common +} + /* trigger contextChanged, web3EndpointChanged */ @@ -82,15 +93,14 @@ export class VMContext { currentFork: string blockGasLimitDefault: number blockGasLimit: number - customNetWorks - blocks - latestBlockNumber - blockByTxHash - txByHash - currentVm - web3vm - logsManager - exeResults + blocks: Record + latestBlockNumber: string + blockByTxHash: Record + txByHash: Record + currentVm: CurrentVm + web3vm: VmProxy + logsManager: any // LogsManager + exeResults: Record constructor (fork?) { this.blockGasLimitDefault = 4300000 @@ -98,11 +108,11 @@ export class VMContext { this.currentFork = fork || 'london' this.currentVm = this.createVm(this.currentFork) this.blocks = {} - this.latestBlockNumber = 0 + this.latestBlockNumber = "0x0" this.blockByTxHash = {} this.txByHash = {} this.exeResults = {} - this.logsManager = new execution.LogsManager() + this.logsManager = new LogsManager() } createVm (hardfork) { @@ -115,7 +125,9 @@ export class VMContext { allowUnlimitedContractSize: true }) - const web3vm = new remixLibVm.Web3VMProvider() + // VmProxy and VMContext are very intricated. + // VmProxy is used to track the EVM execution (to listen on opcode execution, in order for instance to generate the VM trace) + const web3vm = new VmProxy(this) web3vm.setVM(vm) return { vm, web3vm, stateManager, common } } @@ -140,7 +152,7 @@ export class VMContext { return this.currentVm } - addBlock (block) { + addBlock (block: Block) { let blockNumber = '0x' + block.header.number.toString('hex') if (blockNumber === '0x') { blockNumber = '0x0' From b4ea409a97844d2ed7e28500d63f91c6ca22c2c5 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 17 Feb 2022 20:35:43 +0100 Subject: [PATCH 083/217] fix e2e --- apps/remix-ide-e2e/src/commands/goToVMTraceStep.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/commands/goToVMTraceStep.ts b/apps/remix-ide-e2e/src/commands/goToVMTraceStep.ts index 688ac7a635..56616f1ac9 100644 --- a/apps/remix-ide-e2e/src/commands/goToVMTraceStep.ts +++ b/apps/remix-ide-e2e/src/commands/goToVMTraceStep.ts @@ -12,7 +12,7 @@ class GoToVmTraceStep extends EventEmitter { function goToVMtraceStep (browser: NightwatchBrowser, step: number, incr: number, done: VoidFunction) { browser.execute(function (step) { (document.getElementById('slider') as HTMLInputElement).value = (step - 1).toString() }, [step]) .setValue('*[data-id="slider"]', new Array(1).fill(browser.Keys.RIGHT_ARROW)) - .pause(500) + .pause(1000) .perform(() => { done() }) From 13d77e44f8820f335cdb45f09ac72bd98c5ecbad Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 21 Feb 2022 10:35:25 +0100 Subject: [PATCH 084/217] e2e test revert --- apps/remix-ide-e2e/src/tests/debugger.test.ts | 63 +++++++++++++++++-- .../lib/button-navigator/button-navigator.tsx | 2 +- .../src/lib/vm-debugger/assembly-items.tsx | 2 +- 3 files changed, 61 insertions(+), 6 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/debugger.test.ts b/apps/remix-ide-e2e/src/tests/debugger.test.ts index e9292689e8..56a1174521 100644 --- a/apps/remix-ide-e2e/src/tests/debugger.test.ts +++ b/apps/remix-ide-e2e/src/tests/debugger.test.ts @@ -40,8 +40,8 @@ module.exports = { browser.waitForElementVisible('*[data-id="verticalIconsKindudapp"]') .waitForElementVisible('*[data-id="slider"]') .goToVMTraceStep(51) - .click('*[data-id="dropdownPanelSolidityLocals"]') - .waitForElementContainsText('*[data-id="solidityLocals"]', 'no locals', 60000) + .waitForElementContainsText('*[data-id="solidityLocals"]', 'toast', 60000) + .waitForElementContainsText('*[data-id="solidityLocals"]', '999', 60000) .waitForElementContainsText('*[data-id="stepdetail"]', 'vm trace step:\n51', 60000) }, @@ -227,8 +227,23 @@ module.exports = { .waitForElementVisible('*[data-id="solidityLocals"]', 60000) .pause(10000) .checkVariableDebug('soliditylocals', { num: { value: '2', type: 'uint256' } }) - .checkVariableDebug('soliditystate', { number: { value: '0', type: 'uint256', constant: false, immutable: false } }) - .end() + .checkVariableDebug('soliditystate', { number: { value: '0', type: 'uint256', constant: false, immutable: false } }) + }, + + 'Should debug reverted transactions #group5': function (browser: NightwatchBrowser) { + browser + .testContracts('reverted.sol', sources[6]['reverted.sol'], ['A', 'B', 'C']) + .clickLaunchIcon('udapp') + .selectContract('A') + .createContract('') + .pause(500) + .clickInstance(0) + .clickFunction('callA - transact (not payable)') + .debugTransaction(1) + .goToVMTraceStep(79) + .waitForElementVisible('*[data-id="debugGoToRevert"]', 60000) + .click('*[data-id="debugGoToRevert"]') + .waitForElementContainsText('*[data-id="asmitems"] div[selected="selected"]', '117 REVERT') } } @@ -352,6 +367,46 @@ const sources = [ } ` } + }, + { + 'reverted.sol': { + content: `contract A { + B b; + uint p; + constructor () { + b = new B(); + } + function callA() public { + p = 123; + try b.callB() { + + } + catch (bytes memory reason) { + + } + } + } + + contract B { + C c; + uint p; + constructor () { + c = new C(); + } + function callB() public { + p = 124; + revert("revert!"); + c.callC(); + } + } + + contract C { + uint p; + function callC() public { + p = 125; + } + }` + } } ] diff --git a/libs/remix-ui/debugger-ui/src/lib/button-navigator/button-navigator.tsx b/libs/remix-ui/debugger-ui/src/lib/button-navigator/button-navigator.tsx index 5200de41f7..2db94f72cc 100644 --- a/libs/remix-ui/debugger-ui/src/lib/button-navigator/button-navigator.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/button-navigator/button-navigator.tsx @@ -68,7 +68,7 @@ export const ButtonNavigation = ({ stepOverBack, stepIntoBack, stepIntoForward, This call has reverted, state changes made during the call will be reverted. This call will run out of gas. The parent call will throw an exception -
      Click { jumpToException && jumpToException() }}>here to jump where the call reverted.
      +
      Click { jumpToException && jumpToException() }}>here to jump where the call reverted.
      ) diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx index eb57159048..b32b229f0b 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx @@ -125,7 +125,7 @@ export const AssemblyItems = ({ registerEvent }) => {
      -
      +
      { assemblyItems.display.map((item, i) => { return
      { refs.current[i] = ref }}>{item}
      From 12ff823213d4c2fca59c432cb119d7c9097be792 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Tue, 22 Feb 2022 11:49:41 +0100 Subject: [PATCH 085/217] rm console --- libs/remix-ui/search/src/lib/context/context.tsx | 5 ----- 1 file changed, 5 deletions(-) diff --git a/libs/remix-ui/search/src/lib/context/context.tsx b/libs/remix-ui/search/src/lib/context/context.tsx index d4e50f3814..8da91e53c7 100644 --- a/libs/remix-ui/search/src/lib/context/context.tsx +++ b/libs/remix-ui/search/src/lib/context/context.tsx @@ -179,12 +179,7 @@ export const SearchProvider = ({ } const reloadStateForFile = async (file: string) => { - //clearTimeout(reloadTimeOut.current) - console.log('reload file', file) - //reloadTimeOut.current = setTimeout(async () => { - console.log('calling file', file) await value.reloadFile(file) - //}, 1000) } useEffect(() => { From 4827668030a6006d7a9d53d512cb2d08b71ec46c Mon Sep 17 00:00:00 2001 From: filip mertens Date: Tue, 22 Feb 2022 11:52:36 +0100 Subject: [PATCH 086/217] rm console --- libs/remix-ui/search/src/lib/components/OverWriteCheck.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/libs/remix-ui/search/src/lib/components/OverWriteCheck.tsx b/libs/remix-ui/search/src/lib/components/OverWriteCheck.tsx index 2c3e0300c1..4c3a6d7f22 100644 --- a/libs/remix-ui/search/src/lib/components/OverWriteCheck.tsx +++ b/libs/remix-ui/search/src/lib/components/OverWriteCheck.tsx @@ -5,7 +5,6 @@ export const OverWriteCheck = props => { const { setReplaceWithoutConfirmation } = useContext(SearchContext) const change = e => { - console.log(e.target.checked) setReplaceWithoutConfirmation(e.target.checked) } From c15e7cd9d8cd8dacf15f972f90846baf0cac9591 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Tue, 22 Feb 2022 11:52:57 +0100 Subject: [PATCH 087/217] cleanup --- libs/remix-ui/search/src/lib/components/OverWriteCheck.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-ui/search/src/lib/components/OverWriteCheck.tsx b/libs/remix-ui/search/src/lib/components/OverWriteCheck.tsx index 4c3a6d7f22..315a1caf70 100644 --- a/libs/remix-ui/search/src/lib/components/OverWriteCheck.tsx +++ b/libs/remix-ui/search/src/lib/components/OverWriteCheck.tsx @@ -1,4 +1,4 @@ -import React, { useContext, useEffect, useRef, useState } from 'react' +import React, { useContext } from 'react' import { SearchContext } from '../context/context' export const OverWriteCheck = props => { From bf1df587bb5ccdb89ed8fd34d02bcd115f145c6c Mon Sep 17 00:00:00 2001 From: filip mertens Date: Tue, 22 Feb 2022 13:03:45 +0100 Subject: [PATCH 088/217] convert non global patterns --- libs/remix-ui/search/src/lib/context/context.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libs/remix-ui/search/src/lib/context/context.tsx b/libs/remix-ui/search/src/lib/context/context.tsx index 8da91e53c7..b17d2d9708 100644 --- a/libs/remix-ui/search/src/lib/context/context.tsx +++ b/libs/remix-ui/search/src/lib/context/context.tsx @@ -200,10 +200,14 @@ export const SearchProvider = ({ (async () => { const res = await getDirectory('/', plugin) const pathFilter: any = {} - if (state.include) - pathFilter.include = state.include.split(',').map(i => i.trim()) - if (state.exclude) + if (state.include){ + const inc = state.include.replaceAll(/(? i.trim()) + } + if (state.exclude){ + const exc = state.exclude.replaceAll(/(? i.trim()) + } const ob = res.filter(filePathFilter(pathFilter)).map(file => { const r: SearchResult = { filename: file, From 3b376ce7386cb28dfd6055a4f349835c15b48c30 Mon Sep 17 00:00:00 2001 From: David Disu Date: Tue, 22 Feb 2022 13:15:47 +0100 Subject: [PATCH 089/217] Store badge info for opened files --- apps/remix-ide/src/app/tabs/compile-tab.js | 1 + apps/solidity-compiler/src/app/compiler-api.ts | 17 +++++++++-------- libs/remix-lib/src/types/ICompilerApi.ts | 2 ++ .../src/lib/solidity-compiler.tsx | 18 +++++++++++++++++- 4 files changed, 29 insertions(+), 9 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/compile-tab.js b/apps/remix-ide/src/app/tabs/compile-tab.js index 262d64f6e5..9e7094317e 100644 --- a/apps/remix-ide/src/app/tabs/compile-tab.js +++ b/apps/remix-ide/src/app/tabs/compile-tab.js @@ -86,6 +86,7 @@ class CompileTab extends CompilerApiMixin(ViewPlugin) { // implements ICompilerA } getFileManagerMode () { + this.emit() return this.fileManager.mode } diff --git a/apps/solidity-compiler/src/app/compiler-api.ts b/apps/solidity-compiler/src/app/compiler-api.ts index b3d46a4712..a4fe434ef1 100644 --- a/apps/solidity-compiler/src/app/compiler-api.ts +++ b/apps/solidity-compiler/src/app/compiler-api.ts @@ -22,6 +22,7 @@ export const CompilerApiMixin = (Base) => class extends Base { onSessionSwitched: () => void onContentChanged: () => void onFileClosed: (name: string) => void + statusChanged: (data: { key: string, title?: string, type?: string }) => void initCompilerApi () { this.configurationSettings = null @@ -190,31 +191,31 @@ export const CompilerApiMixin = (Base) => class extends Base { resetResults () { this.currentFile = '' this.contractsDetails = {} - this.emit('statusChanged', { key: 'none' }) + this.statusChanged({ key: 'none' }) if (this.onResetResults) this.onResetResults() } listenToEvents () { this.on('editor', 'contentChanged', () => { - this.emit('statusChanged', { key: 'edited', title: 'the content has changed, needs recompilation', type: 'info' }) + this.statusChanged({ key: 'edited', title: 'the content has changed, needs recompilation', type: 'info' }) if (this.onContentChanged) this.onContentChanged() }) this.data.eventHandlers.onLoadingCompiler = (url) => { this.data.loading = true this.data.loadingUrl = url - this.emit('statusChanged', { key: 'loading', title: 'loading compiler...', type: 'info' }) + this.statusChanged({ key: 'loading', title: 'loading compiler...', type: 'info' }) } this.compiler.event.register('loadingCompiler', this.data.eventHandlers.onLoadingCompiler) this.data.eventHandlers.onCompilerLoaded = () => { this.data.loading = false - this.emit('statusChanged', { key: 'none' }) + this.statusChanged({ key: 'none' }) } this.compiler.event.register('compilerLoaded', this.data.eventHandlers.onCompilerLoaded) this.data.eventHandlers.onStartingCompilation = () => { - this.emit('statusChanged', { key: 'loading', title: 'compiling...', type: 'info' }) + this.statusChanged({ key: 'loading', title: 'compiling...', type: 'info' }) } this.data.eventHandlers.onRemoveAnnotations = () => { @@ -262,12 +263,12 @@ export const CompilerApiMixin = (Base) => class extends Base { // forwarding the event to the appManager infra this.emit('compilationFinished', source.target, source, 'soljson', data) if (data.errors && data.errors.length > 0) { - this.emit('statusChanged', { + this.statusChanged({ key: data.errors.length, title: `compilation finished successful with warning${data.errors.length > 1 ? 's' : ''}`, type: 'warning' }) - } else this.emit('statusChanged', { key: 'succeed', title: 'compilation successful', type: 'success' }) + } else this.statusChanged({ key: 'succeed', title: 'compilation successful', type: 'success' }) // Store the contracts this.contractsDetails = {} this.compiler.visitContracts((contract) => { @@ -279,7 +280,7 @@ export const CompilerApiMixin = (Base) => class extends Base { }) } else { const count = (data.errors ? data.errors.filter(error => error.severity === 'error').length : 0 + (data.error ? 1 : 0)) - this.emit('statusChanged', { key: count, title: `compilation failed with ${count} error${count > 1 ? 's' : ''}`, type: 'error' }) + this.statusChanged({ key: count, title: `compilation failed with ${count} error${count > 1 ? 's' : ''}`, type: 'error' }) } // Update contract Selection this.contractMap = {} diff --git a/libs/remix-lib/src/types/ICompilerApi.ts b/libs/remix-lib/src/types/ICompilerApi.ts index 4cdea95799..7daa74e7cf 100644 --- a/libs/remix-lib/src/types/ICompilerApi.ts +++ b/libs/remix-lib/src/types/ICompilerApi.ts @@ -38,6 +38,8 @@ export interface ICompilerApi { logToTerminal: (log: terminalLog) => void compileWithHardhat: (configPath: string) => Promise + statusChanged: (data: { key: string, title?: string, type?: string }) => void, + emit: (key: string, ...payload: any) => void } export type terminalLog = { diff --git a/libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx b/libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx index a478b592cd..d60ce9c0d9 100644 --- a/libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx +++ b/libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx @@ -33,6 +33,7 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => { const [currentVersion, setCurrentVersion] = useState('') const [hideWarnings, setHideWarnings] = useState(false) const [compileErrors, setCompileErrors] = useState>({ [currentFile]: api.compileErrors }) + const [badgeStatus, setBadgeStatus] = useState>({}) useEffect(() => { (async () => { @@ -41,6 +42,14 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => { })() }, []) + useEffect(() => { + if (badgeStatus[currentFile]) { + api.emit('statusChanged', badgeStatus[currentFile]) + } else { + api.emit('statusChanged', { key: 'none' }) + } + }, [badgeStatus[currentFile], currentFile]) + api.onCurrentFileChanged = (currentFile: string) => { setState(prevState => { return { ...prevState, currentFile } @@ -75,7 +84,14 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => { } api.onFileClosed = (name) => { - if (name === currentFile) setCompileErrors({ ...compileErrors, [currentFile]: {} as CompileErrors }) + if (name === currentFile) { + setCompileErrors({ ...compileErrors, [currentFile]: {} as CompileErrors }) + setBadgeStatus({ ...badgeStatus, [currentFile]: { key: 'none' } }) + } + } + + api.statusChanged = (data: { key: string, title?: string, type?: string }) => { + setBadgeStatus({ ...badgeStatus, [currentFile]: data }) } const toast = (message: string) => { From d6e6c0350ece54a50de5b2a50f62d9f83a3ec67b Mon Sep 17 00:00:00 2001 From: filip mertens Date: Wed, 23 Feb 2022 11:00:14 +0100 Subject: [PATCH 090/217] counting --- .../src/lib/components/results/ResultItem.tsx | 28 +++++++++++++++---- .../src/lib/components/results/Results.tsx | 7 +++-- .../search/src/lib/context/context.tsx | 9 +++++- .../search/src/lib/reducers/Reducer.ts | 6 ++++ libs/remix-ui/search/src/lib/search.css | 11 ++++++++ libs/remix-ui/search/src/lib/types/index.ts | 9 ++++-- 6 files changed, 59 insertions(+), 11 deletions(-) diff --git a/libs/remix-ui/search/src/lib/components/results/ResultItem.tsx b/libs/remix-ui/search/src/lib/components/results/ResultItem.tsx index b9522ed1c1..e257c4900a 100644 --- a/libs/remix-ui/search/src/lib/components/results/ResultItem.tsx +++ b/libs/remix-ui/search/src/lib/components/results/ResultItem.tsx @@ -9,18 +9,21 @@ interface ResultItemProps { } export const ResultItem = (props: ResultItemProps) => { - const { state, findText, disableForceReload } = useContext(SearchContext) + const { state, findText, disableForceReload, updateCount } = useContext( + SearchContext + ) const [loading, setLoading] = useState(false) const [lines, setLines] = useState([]) const [toggleExpander, setToggleExpander] = useState(false) const reloadTimeOut = useRef(null) + const subscribed = useRef(true) useEffect(() => { reload() }, [props.file.timeStamp]) useEffect(() => { - if(props.file.forceReload){ + if (props.file.forceReload) { clearTimeout(reloadTimeOut.current) reloadTimeOut.current = setTimeout(() => reload(), 1000) } @@ -34,11 +37,21 @@ export const ResultItem = (props: ResultItemProps) => { reload() }, [state.find]) + useEffect(() => { + subscribed.current = true + return () => { + subscribed.current = false + } + }, []) + const reload = () => { findText(props.file.filename).then(res => { - setLines(res) - setLoading(false) - disableForceReload(props.file.filename) + if (subscribed.current) { + setLines(res) + if (res) updateCount(res.length) + setLoading(false) + disableForceReload(props.file.filename) + } }) } @@ -56,6 +69,11 @@ export const ResultItem = (props: ResultItemProps) => { > {' '} +
      +
      + {lines.length} +
      +
      {loading ?
      Loading...
      : null} {!toggleExpander && !loading ? ( diff --git a/libs/remix-ui/search/src/lib/components/results/Results.tsx b/libs/remix-ui/search/src/lib/components/results/Results.tsx index 9a1b717cca..1c5521cfeb 100644 --- a/libs/remix-ui/search/src/lib/components/results/Results.tsx +++ b/libs/remix-ui/search/src/lib/components/results/Results.tsx @@ -1,16 +1,17 @@ -import React, { useContext } from 'react' +import React, { useContext, useEffect } from 'react' import { SearchContext } from '../../context/context' import { ResultItem } from './ResultItem' export const Results = () => { const { state } = useContext(SearchContext) - return (
      - {state.searchResults && + {state.find ?
      {state.count} results
      : null} + {state.count < state.maxResults && state.searchResults && state.searchResults.map((result, index) => { return })} + {state.find && state.count >= state.maxResults?
      Too many results to display.

      Please narrow your search.
      : null}
      ) } diff --git a/libs/remix-ui/search/src/lib/context/context.tsx b/libs/remix-ui/search/src/lib/context/context.tsx index b17d2d9708..1f7dfe9417 100644 --- a/libs/remix-ui/search/src/lib/context/context.tsx +++ b/libs/remix-ui/search/src/lib/context/context.tsx @@ -35,6 +35,7 @@ export interface SearchingStateInterface { toggleUseRegex: () => void setReplaceWithoutConfirmation: (value: boolean) => void disableForceReload: (file: string) => void + updateCount: (count: number) => void } export const SearchContext = createContext(null) @@ -134,6 +135,12 @@ export const SearchProvider = ({ payload: file }) }, + updateCount: (count: number) => { + dispatch({ + type: 'UPDATE_COUNT', + payload: count + }) + }, findText: async (path: string) => { if (!plugin) return try { @@ -214,7 +221,7 @@ export const SearchProvider = ({ lines: [], path: file, timeStamp: Date.now(), - forceReload: false + forceReload: false, } return r }) diff --git a/libs/remix-ui/search/src/lib/reducers/Reducer.ts b/libs/remix-ui/search/src/lib/reducers/Reducer.ts index 0ead0fac4d..e5f0318bc5 100644 --- a/libs/remix-ui/search/src/lib/reducers/Reducer.ts +++ b/libs/remix-ui/search/src/lib/reducers/Reducer.ts @@ -33,6 +33,12 @@ export const SearchReducer = (state: SearchState = SearchingInitialState, action return { ...state, searchResults: action.payload, + count: 0 + } + case 'UPDATE_COUNT': + return { + ...state, + count: state.count + parseInt(action.payload) } case 'TOGGLE_CASE_SENSITIVE': return { diff --git a/libs/remix-ui/search/src/lib/search.css b/libs/remix-ui/search/src/lib/search.css index 4f4dfbd5bb..88f62ab5b2 100644 --- a/libs/remix-ui/search/src/lib/search.css +++ b/libs/remix-ui/search/src/lib/search.css @@ -92,4 +92,15 @@ text-overflow: ellipsis; overflow: hidden; text-transform: uppercase; +} + +.search_tab .result_count { + flex-grow: 1; + text-align: right; + display: flex; + justify-content: flex-end; +} + +.search_tab .result_count_number { + font-size: x-small; } \ No newline at end of file diff --git a/libs/remix-ui/search/src/lib/types/index.ts b/libs/remix-ui/search/src/lib/types/index.ts index 7b3d06e1b3..3d7fe96a32 100644 --- a/libs/remix-ui/search/src/lib/types/index.ts +++ b/libs/remix-ui/search/src/lib/types/index.ts @@ -1,3 +1,4 @@ +import { count } from "console"; export interface Action { type: string @@ -30,7 +31,7 @@ export interface SearchResult { path: string, lines: SearchResultLine[], timeStamp: number, - forceReload: boolean + forceReload: boolean, } export interface SearchState { @@ -44,6 +45,8 @@ export interface SearchState { replaceWithOutConfirmation: boolean, useRegExp: boolean, timeStamp: number, + count: number, + maxResults: number } export const SearchingInitialState: SearchState = { @@ -56,5 +59,7 @@ export const SearchingInitialState: SearchState = { matchWord: false, useRegExp: false, replaceWithOutConfirmation: false, - timeStamp: 0 + timeStamp: 0, + count: 0, + maxResults: 500 } \ No newline at end of file From fe8f8114c854a9103cc06e40bd54c9f79dd981fb Mon Sep 17 00:00:00 2001 From: filip mertens Date: Wed, 23 Feb 2022 11:17:26 +0100 Subject: [PATCH 091/217] counting better --- .../search/src/lib/components/results/ResultItem.tsx | 11 +++++++++-- libs/remix-ui/search/src/lib/context/context.tsx | 7 ++++--- libs/remix-ui/search/src/lib/reducers/Reducer.ts | 12 +++++++++++- libs/remix-ui/search/src/lib/types/index.ts | 1 + 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/libs/remix-ui/search/src/lib/components/results/ResultItem.tsx b/libs/remix-ui/search/src/lib/components/results/ResultItem.tsx index e257c4900a..3534321e7e 100644 --- a/libs/remix-ui/search/src/lib/components/results/ResultItem.tsx +++ b/libs/remix-ui/search/src/lib/components/results/ResultItem.tsx @@ -18,6 +18,7 @@ export const ResultItem = (props: ResultItemProps) => { const reloadTimeOut = useRef(null) const subscribed = useRef(true) + useEffect(() => { reload() }, [props.file.timeStamp]) @@ -48,7 +49,13 @@ export const ResultItem = (props: ResultItemProps) => { findText(props.file.filename).then(res => { if (subscribed.current) { setLines(res) - if (res) updateCount(res.length) + if (res) { + let count = 0 + res.forEach(line => { + count += line.lines.length + }) + updateCount(count, props.file.filename) + } setLoading(false) disableForceReload(props.file.filename) } @@ -71,7 +78,7 @@ export const ResultItem = (props: ResultItemProps) => {
      - {lines.length} + {props.file.count}
      diff --git a/libs/remix-ui/search/src/lib/context/context.tsx b/libs/remix-ui/search/src/lib/context/context.tsx index 1f7dfe9417..0cc748e6d4 100644 --- a/libs/remix-ui/search/src/lib/context/context.tsx +++ b/libs/remix-ui/search/src/lib/context/context.tsx @@ -35,7 +35,7 @@ export interface SearchingStateInterface { toggleUseRegex: () => void setReplaceWithoutConfirmation: (value: boolean) => void disableForceReload: (file: string) => void - updateCount: (count: number) => void + updateCount: (count: number, file: string) => void } export const SearchContext = createContext(null) @@ -135,10 +135,10 @@ export const SearchProvider = ({ payload: file }) }, - updateCount: (count: number) => { + updateCount: (count: number, file: string) => { dispatch({ type: 'UPDATE_COUNT', - payload: count + payload: {count, file} }) }, findText: async (path: string) => { @@ -222,6 +222,7 @@ export const SearchProvider = ({ path: file, timeStamp: Date.now(), forceReload: false, + count: 0 } return r }) diff --git a/libs/remix-ui/search/src/lib/reducers/Reducer.ts b/libs/remix-ui/search/src/lib/reducers/Reducer.ts index e5f0318bc5..0841b2b424 100644 --- a/libs/remix-ui/search/src/lib/reducers/Reducer.ts +++ b/libs/remix-ui/search/src/lib/reducers/Reducer.ts @@ -36,9 +36,19 @@ export const SearchReducer = (state: SearchState = SearchingInitialState, action count: 0 } case 'UPDATE_COUNT': + const findFile = state.searchResults.find(file => file.filename === action.payload.file) + let count = 0 + if (findFile) { + findFile.count = action.payload.count + } + state.searchResults.forEach(file => { + if (file.count) { + count += file.count + } + }) return { ...state, - count: state.count + parseInt(action.payload) + count: count } case 'TOGGLE_CASE_SENSITIVE': return { diff --git a/libs/remix-ui/search/src/lib/types/index.ts b/libs/remix-ui/search/src/lib/types/index.ts index 3d7fe96a32..af76487c51 100644 --- a/libs/remix-ui/search/src/lib/types/index.ts +++ b/libs/remix-ui/search/src/lib/types/index.ts @@ -32,6 +32,7 @@ export interface SearchResult { lines: SearchResultLine[], timeStamp: number, forceReload: boolean, + count: number } export interface SearchState { From a510ba9ab2b3f6e50ffb9c7e2a1a453302a68c7a Mon Sep 17 00:00:00 2001 From: filip mertens Date: Wed, 23 Feb 2022 11:26:40 +0100 Subject: [PATCH 092/217] linting --- .../search/src/lib/reducers/Reducer.ts | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/libs/remix-ui/search/src/lib/reducers/Reducer.ts b/libs/remix-ui/search/src/lib/reducers/Reducer.ts index 0841b2b424..05e9efaecb 100644 --- a/libs/remix-ui/search/src/lib/reducers/Reducer.ts +++ b/libs/remix-ui/search/src/lib/reducers/Reducer.ts @@ -36,19 +36,23 @@ export const SearchReducer = (state: SearchState = SearchingInitialState, action count: 0 } case 'UPDATE_COUNT': - const findFile = state.searchResults.find(file => file.filename === action.payload.file) - let count = 0 - if (findFile) { - findFile.count = action.payload.count - } - state.searchResults.forEach(file => { - if (file.count) { - count += file.count + if (state.searchResults) { + const findFile = state.searchResults.find(file => file.filename === action.payload.file) + let count = 0 + if (findFile) { + findFile.count = action.payload.count } - }) - return { - ...state, - count: count + state.searchResults.forEach(file => { + if (file.count) { + count += file.count + } + }) + return { + ...state, + count: count + } + } else { + return state } case 'TOGGLE_CASE_SENSITIVE': return { @@ -68,7 +72,7 @@ export const SearchReducer = (state: SearchState = SearchingInitialState, action matchWord: !state.matchWord, timeStamp: Date.now() } - case 'SET_REPLACE_WITHOUT_CONFIRMATION': + case 'SET_REPLACE_WITHOUT_CONFIRMATION': return { ...state, replaceWithOutConfirmation: action.payload, From c9cff0f1a4c1cb5d81d147bf6cdafbf543bc874b Mon Sep 17 00:00:00 2001 From: David Disu Date: Wed, 23 Feb 2022 13:46:06 +0100 Subject: [PATCH 093/217] Store compilation details for opened files --- apps/remix-ide/src/app/tabs/compile-tab.js | 7 ++- .../solidity-compiler/src/app/compiler-api.ts | 43 +++++++++++-------- libs/remix-lib/src/types/ICompilerApi.ts | 15 ++++--- .../src/lib/remix-ui-modal-dialog.tsx | 2 +- .../src/lib/contract-selection.tsx | 22 ++-------- .../src/lib/solidity-compiler.tsx | 36 +++++++++------- .../solidity-compiler/src/lib/types/index.ts | 16 +++++-- 7 files changed, 75 insertions(+), 66 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/compile-tab.js b/apps/remix-ide/src/app/tabs/compile-tab.js index 9e7094317e..c57a51d089 100644 --- a/apps/remix-ide/src/app/tabs/compile-tab.js +++ b/apps/remix-ide/src/app/tabs/compile-tab.js @@ -51,9 +51,9 @@ class CompileTab extends CompilerApiMixin(ViewPlugin) { // implements ICompilerA this.renderComponent() } - onResetResults () { - this.renderComponent() - } + // onResetResults () { + // this.renderComponent() + // } onSetWorkspace () { this.renderComponent() @@ -86,7 +86,6 @@ class CompileTab extends CompilerApiMixin(ViewPlugin) { // implements ICompilerA } getFileManagerMode () { - this.emit() return this.fileManager.mode } diff --git a/apps/solidity-compiler/src/app/compiler-api.ts b/apps/solidity-compiler/src/app/compiler-api.ts index a4fe434ef1..abfe0b377b 100644 --- a/apps/solidity-compiler/src/app/compiler-api.ts +++ b/apps/solidity-compiler/src/app/compiler-api.ts @@ -4,21 +4,22 @@ import type { ConfigurationSettings } from '@remix-project/remix-lib-ts' export const CompilerApiMixin = (Base) => class extends Base { currentFile: string - contractMap: { - file: string - } | Record - + compilationDetails: { + contractMap: { + file: string + } | Record, + contractsDetails: Record, + target?: string + } compileErrors: any compileTabLogic: CompileTabLogic - contractsDetails: Record - configurationSettings: ConfigurationSettings onCurrentFileChanged: (fileName: string) => void - onResetResults: () => void + // onResetResults: () => void onSetWorkspace: (workspace: any) => void onNoFileSelected: () => void - onCompilationFinished: (contractsDetails: any, contractMap: any) => void + onCompilationFinished: (compilationDetails: { contractMap: { file: string } | Record, contractsDetails: Record }) => void onSessionSwitched: () => void onContentChanged: () => void onFileClosed: (name: string) => void @@ -33,15 +34,15 @@ export const CompilerApiMixin = (Base) => class extends Base { contractEl: null } - this.contractsDetails = {} + this.compilationDetails = { + contractsDetails:{}, + contractMap: {} + } this.data = { eventHandlers: {}, loading: false } - this.contractMap = {} - this.contractsDetails = {} - this.compileErrors = {} this.compiledFileName = '' this.currentFile = '' @@ -190,9 +191,12 @@ export const CompilerApiMixin = (Base) => class extends Base { resetResults () { this.currentFile = '' - this.contractsDetails = {} + this.compilationDetails = { + contractsDetails: {}, + contractMap: {} + } this.statusChanged({ key: 'none' }) - if (this.onResetResults) this.onResetResults() + // if (this.onResetResults) this.onResetResults() } listenToEvents () { @@ -270,9 +274,9 @@ export const CompilerApiMixin = (Base) => class extends Base { }) } else this.statusChanged({ key: 'succeed', title: 'compilation successful', type: 'success' }) // Store the contracts - this.contractsDetails = {} + this.compilationDetails.contractsDetails = {} this.compiler.visitContracts((contract) => { - this.contractsDetails[contract.name] = parseContracts( + this.compilationDetails.contractsDetails[contract.name] = parseContracts( contract.name, contract.object, this.compiler.getSource(contract.file) @@ -283,9 +287,10 @@ export const CompilerApiMixin = (Base) => class extends Base { this.statusChanged({ key: count, title: `compilation failed with ${count} error${count > 1 ? 's' : ''}`, type: 'error' }) } // Update contract Selection - this.contractMap = {} - if (success) this.compiler.visitContracts((contract) => { this.contractMap[contract.name] = contract }) - if (this.onCompilationFinished) this.onCompilationFinished(this.contractsDetails, this.contractMap) + this.compilationDetails.contractMap = {} + if (success) this.compiler.visitContracts((contract) => { this.compilationDetails.contractMap[contract.name] = contract }) + this.compilationDetails.target = source.target + if (this.onCompilationFinished) this.onCompilationFinished(this.compilationDetails) } this.compiler.event.register('compilationFinished', this.data.eventHandlers.onCompilationFinished) diff --git a/libs/remix-lib/src/types/ICompilerApi.ts b/libs/remix-lib/src/types/ICompilerApi.ts index 7daa74e7cf..4c796ee3c1 100644 --- a/libs/remix-lib/src/types/ICompilerApi.ts +++ b/libs/remix-lib/src/types/ICompilerApi.ts @@ -1,11 +1,14 @@ export interface ICompilerApi { currentFile: string - contractMap: { - file: string - } | Record + compilationDetails: { + contractMap: { + file: string + } | Record, + contractsDetails: Record, + target?: string + } compileErrors: any compileTabLogic: any - contractsDetails: Record configurationSettings: ConfigurationSettings getCompilerParameters: () => ConfigurationSettings @@ -20,7 +23,7 @@ export interface ICompilerApi { getCompilationResult: () => any onCurrentFileChanged: (fileName: string) => void - onResetResults: () => void, + // onResetResults: () => void, onSetWorkspace: (workspace: any) => void onNoFileSelected: () => void onCompilationFinished: (contractsDetails: any, contractMap: any) => void @@ -39,7 +42,7 @@ export interface ICompilerApi { compileWithHardhat: (configPath: string) => Promise statusChanged: (data: { key: string, title?: string, type?: string }) => void, - emit: (key: string, ...payload: any) => void + emit?: (key: string, ...payload: any) => void } export type terminalLog = { diff --git a/libs/remix-ui/modal-dialog/src/lib/remix-ui-modal-dialog.tsx b/libs/remix-ui/modal-dialog/src/lib/remix-ui-modal-dialog.tsx index 714255aa93..38df2fd8b8 100644 --- a/libs/remix-ui/modal-dialog/src/lib/remix-ui-modal-dialog.tsx +++ b/libs/remix-ui/modal-dialog/src/lib/remix-ui-modal-dialog.tsx @@ -37,7 +37,7 @@ export const ModalDialog = (props: ModalDialogProps) => { modal.current.addEventListener('blur', handleBlur) } return () => { - modal.current.removeEventListener('blur', handleBlur) + modal.current && modal.current.removeEventListener('blur', handleBlur) } }, [modal.current]) diff --git a/libs/remix-ui/solidity-compiler/src/lib/contract-selection.tsx b/libs/remix-ui/solidity-compiler/src/lib/contract-selection.tsx index efac0765ec..338fe7fd7e 100644 --- a/libs/remix-ui/solidity-compiler/src/lib/contract-selection.tsx +++ b/libs/remix-ui/solidity-compiler/src/lib/contract-selection.tsx @@ -7,32 +7,18 @@ import { CopyToClipboard } from '@remix-ui/clipboard' // eslint-disable-line import './css/style.css' export const ContractSelection = (props: ContractSelectionProps) => { - const { api, contractMap, contractsDetails, modal } = props - const [contractList, setContractList] = useState([]) + const { api, contractsDetails, contractList, modal } = props const [selectedContract, setSelectedContract] = useState('') const [storage, setStorage] = useState(null) useEffect(() => { - const contractList = contractMap ? Object.keys(contractMap).map((key) => ({ - name: key, - file: getFileName(contractMap[key].file) - })) : [] - - setContractList(contractList) if (contractList.length) setSelectedContract(contractList[0].name) - }, [contractMap, contractsDetails]) + }, [contractList]) const resetStorage = () => { setStorage('') } - // Return the file name of a path: ex "browser/ballot.sol" -> "ballot.sol" - const getFileName = (path) => { - const part = path.split('/') - - return part[part.length - 1] - } - const handleContractChange = (contractName: string) => { setSelectedContract(contractName) } @@ -214,13 +200,13 @@ export const ContractSelection = (props: ContractSelectionProps) => {
      - + - + {' '} -
      -
      +
      +
      {props.file.count}
      {loading ?
      Loading...
      : null} {!toggleExpander && !loading ? ( -
      +
      {lines.map((line, index) => ( { return ( <> {props.line.lines.map((lineItem, index) => ( -
      +
      { selectLine(lineItem) }} data-id={`${props.searchResult.filename}-${lineItem.position.start.line}-${lineItem.position.start.column}`} key={props.searchResult.filename} - className='search_line pb-1' + className='search_plugin_search_line pb-1' > -
      {lineItem.left.substring(lineItem.left.length - 20).trimStart()}
      - {lineItem.center} - {state.replace? {state.replace}:<>} -
      {lineItem.right.substring(0, 100)}
      +
      {lineItem.left.substring(lineItem.left.length - 20).trimStart()}
      + {lineItem.center} + {state.replace? {state.replace}:<>} +
      {lineItem.right.substring(0, 100)}
      -
      +
      { replace(lineItem) }} className="codicon codicon-find-replace" role="button" aria-label="Replace" aria-disabled="false">
      diff --git a/libs/remix-ui/search/src/lib/components/results/Results.tsx b/libs/remix-ui/search/src/lib/components/results/Results.tsx index 1c5521cfeb..b2094d23c9 100644 --- a/libs/remix-ui/search/src/lib/components/results/Results.tsx +++ b/libs/remix-ui/search/src/lib/components/results/Results.tsx @@ -6,7 +6,7 @@ export const Results = () => { const { state } = useContext(SearchContext) return (
      - {state.find ?
      {state.count} results
      : null} + {state.find ?
      {state.count} results
      : null} {state.count < state.maxResults && state.searchResults && state.searchResults.map((result, index) => { return diff --git a/libs/remix-ui/search/src/lib/search.css b/libs/remix-ui/search/src/lib/search.css index 88f62ab5b2..895ce83e7f 100644 --- a/libs/remix-ui/search/src/lib/search.css +++ b/libs/remix-ui/search/src/lib/search.css @@ -1,4 +1,4 @@ -.search_result_item_title { +.search_plugin_search_result_item_title { display: flex; -webkit-user-select: none; /* Safari */ -moz-user-select: none; /* Firefox */ @@ -8,7 +8,7 @@ align-items: center; } -.wrap_summary { +.search_plugin_wrap_summary { overflow: hidden; white-space: nowrap; -webkit-user-select: none; /* Safari */ @@ -18,89 +18,89 @@ cursor: pointer; } -.find-part { +.search_plugin_find-part { display: flex; flex-direction: column; padding: 2px; } -.controls { +.search_plugin_controls { display: flex; } -.search_tab .search_line_container { +.search_plugin_search_tab .search_plugin_search_line_container { display: flex; flex-direction: row; position: relative; } -.search_tab .search_line { +.search_plugin_search_tab .search_plugin_search_line { width: 100%; overflow: hidden; display: flex; } -.search_tab .search_control { +.search_plugin_search_tab .search_plugin_search_control { flex-grow: 0; position: absolute; right: 0px; top: 0px; } -.summary_right { +.search_plugin_summary_right { min-width: 0; white-space: pre; text-overflow: ellipsis; overflow: hidden; } -.search_tab .replace_strike { +.search_plugin_search_tab .search_plugin_replace_strike { text-decoration: line-through; } -.summary_left { +.search_plugin_summary_left { white-space: pre; } -.search_tab mark { +.search_plugin_search_tab mark { padding: 0; } -.search_tab .search_line_container .search_control { +.search_plugin_search_tab .search_plugin_search_line_container .search_plugin_search_control { display: none; } -.search_tab .search_line_container:hover .search_control { +.search_plugin_search_tab .search_plugin_search_line_container:hover .search_plugin_search_control { display: block; } -.search_tab .search_line_container:hover .search_line { +.search_plugin_search_tab .search_plugin_search_line_container:hover .search_plugin_search_line { width: 93%; } -.search-input { +.search_plugin_search-input { display: flex; flex-direction: row; align-items: center; } -.search_tab .checked { +.search_plugin_search_tab .checked { background-color: var(--secondary); } -.search_tab .search_file_name { +.search_plugin_search_tab .search_plugin_search_file_name { text-overflow: ellipsis; overflow: hidden; text-transform: uppercase; } -.search_tab .result_count { +.search_plugin_search_tab .search_plugin_result_count { flex-grow: 1; text-align: right; display: flex; justify-content: flex-end; } -.search_tab .result_count_number { +.search_plugin_search_tab .search_plugin_result_count_number { font-size: x-small; } \ No newline at end of file From 21ad2ea3553066d0667c43a1e9eda4b31d78ac85 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Thu, 24 Feb 2022 11:09:52 +0100 Subject: [PATCH 095/217] tests --- apps/remix-ide-e2e/src/tests/search.test.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/search.test.ts b/apps/remix-ide-e2e/src/tests/search.test.ts index ea6249adcb..19fe83da3c 100644 --- a/apps/remix-ide-e2e/src/tests/search.test.ts +++ b/apps/remix-ide-e2e/src/tests/search.test.ts @@ -20,7 +20,7 @@ module.exports = { .waitForElementContainsText('*[data-id="search_results"]', 'that person al') .waitForElementContainsText('*[data-id="search_results"]', 'sender.voted') .waitForElementContainsText('*[data-id="search_results"]', 'read') - .elements('css selector','.search_line', (res) => { + .elements('css selector','.search_plugin_search_line', (res) => { Array.isArray(res.value) && browser.assert.equal(res.value.length, 6) }) }, @@ -35,7 +35,7 @@ module.exports = { .waitForElementContainsText('*[data-id="search_results"]', '1_STORAGE.SOL', 60000) .waitForElementContainsText('*[data-id="search_results"]', '4_BALLOT_TEST.SOL', 60000) .waitForElementContainsText('*[data-id="search_results"]', 'tests', 60000) - .elements('css selector','.search_line', (res) => { + .elements('css selector','.search_plugin_search_line', (res) => { Array.isArray(res.value) && browser.assert.equal(res.value.length, 4) }) }, @@ -43,12 +43,12 @@ module.exports = { browser .waitForElementVisible('*[data-id="search_use_regex"]').click('*[data-id="search_use_regex"]') .waitForElementVisible('*[data-id="search_case_sensitive"]').click('*[data-id="search_case_sensitive"]') - .elements('css selector','.search_line', (res) => { + .elements('css selector','.search_plugin_search_line', (res) => { Array.isArray(res.value) && browser.assert.equal(res.value.length, 0) }) .clearValue('*[id="search_input"]') .setValue('*[id="search_input"]', 'Contract').pause(1000) - .elements('css selector','.search_line', (res) => { + .elements('css selector','.search_plugin_search_line', (res) => { Array.isArray(res.value) && browser.assert.equal(res.value.length, 6) }) .waitForElementContainsText('*[data-id="search_results"]', 'DEPLOY_ETHERS.JS', 60000) @@ -61,7 +61,7 @@ module.exports = { .waitForElementVisible('*[data-id="search_whole_word"]').click('*[data-id="search_whole_word"]') .clearValue('*[id="search_input"]') .setValue('*[id="search_input"]', 'contract').pause(1000) - .elements('css selector','.search_line', (res) => { + .elements('css selector','.search_plugin_search_line', (res) => { Array.isArray(res.value) && browser.assert.equal(res.value.length, 27) }) }, @@ -95,7 +95,7 @@ module.exports = { .clearValue('*[id="search_input"]') .setValue('*[id="search_input"]', 'contract').pause(1000) .setValue('*[id="search_include"]', 'contracts/**').pause(2000) - .elements('css selector','.search_line', (res) => { + .elements('css selector','.search_plugin_search_line', (res) => { Array.isArray(res.value) && browser.assert.equal(res.value.length, 4) }) }, @@ -103,11 +103,11 @@ module.exports = { browser .clearValue('*[id="search_include"]').pause(2000) .setValue('*[id="search_include"]', '**').pause(2000) - .elements('css selector','.search_line', (res) => { + .elements('css selector','.search_plugin_search_line', (res) => { Array.isArray(res.value) && browser.assert.equal(res.value.length, 26) }) .setValue('*[id="search_exclude"]', ',contracts/**').pause(2000) - .elements('css selector','.search_line', (res) => { + .elements('css selector','.search_plugin_search_line', (res) => { Array.isArray(res.value) && browser.assert.equal(res.value.length, 22) }) }, @@ -115,7 +115,7 @@ module.exports = { browser .waitForElementVisible('*[id="search_input"]') .setValue('*[id="search_input"]', 'nodata').pause(1000) - .elements('css selector','.search_line', (res) => { + .elements('css selector','.search_plugin_search_line', (res) => { Array.isArray(res.value) && browser.assert.equal(res.value.length, 0) }) } From f81e661b2b1aae9179e0280db1f8b7f37f4842a7 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Thu, 24 Feb 2022 11:22:54 +0100 Subject: [PATCH 096/217] rm comma rm --- libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx b/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx index 73b5b3e424..1e99f8583a 100644 --- a/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx +++ b/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx @@ -544,7 +544,7 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => { ) } else { return ( -
      { msg ? msg.toString().replace(/,/g, '') : msg }
      +
      {msg}
      ) } }) From 047836d7735c42ab4a047e85c7c711c57cfc14f4 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Thu, 24 Feb 2022 12:19:09 +0100 Subject: [PATCH 097/217] fix async method --- apps/remix-ide/src/app/files/fileManager.ts | 2 +- .../remix-ide/src/app/files/remixDProvider.js | 23 +++++++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/apps/remix-ide/src/app/files/fileManager.ts b/apps/remix-ide/src/app/files/fileManager.ts index 5ac6f8dd30..9c11b5863d 100644 --- a/apps/remix-ide/src/app/files/fileManager.ts +++ b/apps/remix-ide/src/app/files/fileManager.ts @@ -752,7 +752,7 @@ class FileManager extends Plugin { if (provider) { try{ const content = await provider.get(currentFile) - this.editor.setText(content) + if(content) this.editor.setText(content) }catch(error){ console.log(error) } diff --git a/apps/remix-ide/src/app/files/remixDProvider.js b/apps/remix-ide/src/app/files/remixDProvider.js index a36b6d8ec9..0e8f1223cf 100644 --- a/apps/remix-ide/src/app/files/remixDProvider.js +++ b/apps/remix-ide/src/app/files/remixDProvider.js @@ -98,20 +98,19 @@ module.exports = class RemixDProvider extends FileProvider { }) } - get (path, cb) { + async get (path, cb) { if (!this._isReady) return cb && cb('provider not ready') var unprefixedpath = this.removePrefix(path) - this._appManager.call('remixd', 'get', { path: unprefixedpath }) - .then((file) => { - this.filesContent[path] = file.content - if (file.readonly) { this._readOnlyFiles[path] = 1 } - cb(null, file.content) - }).catch((error) => { - if (error) console.log(error) - // display the last known content. - // TODO should perhaps better warn the user that the file is not synced. - return cb(null, this.filesContent[path]) - }) + try{ + const file = await this._appManager.call('remixd', 'get', { path: unprefixedpath }) + this.filesContent[path] = file.content + if (file.readonly) { this._readOnlyFiles[path] = 1 } + if(cb) return cb(null, file.content) + return file.content + } catch(error) { + if (error) console.log(error) + if(cb) return cb(null, this.filesContent[path]) + } } async set (path, content, cb) { From 51b8bd6814d2e1a205f08e0343223b77a6f5fc80 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Thu, 24 Feb 2022 12:35:02 +0100 Subject: [PATCH 098/217] fix msg string --- libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx b/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx index 1e99f8583a..904685f7a5 100644 --- a/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx +++ b/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx @@ -544,7 +544,7 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => { ) } else { return ( -
      {msg}
      +
      {msg? msg.toString() : null}
      ) } }) From 73472bba9f49673489998fed223ab44f630730fb Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Thu, 24 Feb 2022 12:45:15 +0100 Subject: [PATCH 099/217] Update remixDProvider.js --- apps/remix-ide/src/app/files/remixDProvider.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide/src/app/files/remixDProvider.js b/apps/remix-ide/src/app/files/remixDProvider.js index 0e8f1223cf..c52055e04f 100644 --- a/apps/remix-ide/src/app/files/remixDProvider.js +++ b/apps/remix-ide/src/app/files/remixDProvider.js @@ -105,7 +105,7 @@ module.exports = class RemixDProvider extends FileProvider { const file = await this._appManager.call('remixd', 'get', { path: unprefixedpath }) this.filesContent[path] = file.content if (file.readonly) { this._readOnlyFiles[path] = 1 } - if(cb) return cb(null, file.content) + if(cb) cb(null, file.content) return file.content } catch(error) { if (error) console.log(error) From 40a291b4e43a69a37dac91ebff46ebfaa1c029f5 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Fri, 25 Feb 2022 11:06:16 +0100 Subject: [PATCH 100/217] testing fs --- apps/remix-ide/src/assets/js/init.js | 98 +++++++++++++++++++++++----- 1 file changed, 83 insertions(+), 15 deletions(-) diff --git a/apps/remix-ide/src/assets/js/init.js b/apps/remix-ide/src/assets/js/init.js index f3cd64d79f..460d9b565e 100644 --- a/apps/remix-ide/src/assets/js/init.js +++ b/apps/remix-ide/src/assets/js/init.js @@ -1,5 +1,5 @@ /* eslint-disable prefer-promise-reject-errors */ -function urlParams () { +function urlParams() { var qs = window.location.hash.substr(1) if (window.location.search.length > 0) { @@ -42,8 +42,8 @@ for (const k in assets[versionToLoad]) { window.onload = () => { // eslint-disable-next-line no-undef - class RemixFileSystem extends LightningFS { - constructor (...t) { + class IndexedDBFS extends LightningFS { + constructor(...t) { super(...t) this.addSlash = (file) => { if (!file.startsWith('/')) file = '/' + file @@ -86,22 +86,90 @@ window.onload = () => { } } - function loadApp () { + function loadApp() { const app = document.createElement('script') app.setAttribute('src', versions[versionToLoad]) document.body.appendChild(app) } - window.remixFileSystemCallback = new RemixFileSystem() - window.remixFileSystemCallback.init('RemixFileSystem').then(() => { - window.remixFileSystem = window.remixFileSystemCallback.promises - // check if .workspaces is present in indexeddb - window.remixFileSystem.stat('.workspaces').then((dir) => { - if (dir.isDirectory()) loadApp() - }).catch(() => { - // no indexeddb .workspaces -> run migration - // eslint-disable-next-line no-undef - migrateFilesFromLocalStorage(loadApp) + async function ReadWriteTest(fs) { + try { + console.log(await fs.readdir('/')) + const str = 'Hello World' + await fs.writeFile('/test.txt', str , 'utf8') + if(await fs.readFile('/test.txt', 'utf8') === str){ + console.log('Read/Write Test Passed') + } + } catch (e) { + console.log(e) + } + } + + try { + // localStorage + // eslint-disable-next-line no-undef + BrowserFS.install(window) + // eslint-disable-next-line no-undef + BrowserFS.configure({ + fs: 'LocalStorage' + }, async function (e) { + if (e) { + console.log('BROWSEFS Error: ' + e) + } else { + window.remixLocalStorage = { ...window.require('fs') } + window.remixLocalStorageCallBack = window.require('fs') + window.remixLocalStorage.readdir = window.remixLocalStorage.readdirSync + window.remixLocalStorage.readFile = window.remixLocalStorage.readFileSync + window.remixLocalStorage.writeFile = window.remixLocalStorage.writeFileSync + window.remixLocalStorage.stat = window.remixLocalStorage.statSync + window.remixLocalStorage.unlink = window.remixLocalStorage.unlinkSync + window.remixLocalStorage.rmdir = window.remixLocalStorage.rmdirSync + window.remixLocalStorage.mkdir = window.remixLocalStorage.mkdirSync + window.remixLocalStorage.rename = window.remixLocalStorage.renameSync + window.remixLocalStorage.exists = window.remixLocalStorage.existsSync + //loadApp() + console.log('BrowserFS is ready!') + await ReadWriteTest(window.remixLocalStorage) + } }) - }) + } catch (e) { + console.log('BrowserFS is not ready!') + } + if (!window.indexedDB) { + console.log("Your browser doesn't support a stable version of IndexedDB. Such and such feature will not be available."); + } + var request = window.indexedDB.open("RemixTestDataBase", 3); + console.log(request) + request.onerror = event => { + // Do something with request.errorCode! + console.log('INDEEDDB ERROR') + }; + request.onsuccess = event => { + // Do something with request.result! + console.log("INDEEDDB SUCCESS") + window.indexedDB.deleteDatabase("RemixTestDataBase"); + activateIndexedDB() + }; + + function activateIndexedDB() { + // indexedDB + window.remixIndexedDBCallBack = new IndexedDBFS() + window.remixIndexedDBCallBack.init('RemixFileSystem').then(async () => { + window.remixIndexedDB = window.remixIndexedDBCallBack.promises + // check if .workspaces is present in indexeddb + console.log('indexeddb ready') + await ReadWriteTest(window.remixIndexedDB) + window.remixIndexedDB.stat('.workspaces').then((dir) => { + console.log(dir) + // if (dir.isDirectory()) loadApp() + }).catch((e) => { + console.log('error creating .workspaces', e) + // no indexeddb .workspaces -> run migration + // eslint-disable-next-line no-undef + //migrateFilesFromLocalStorage(loadApp) + }) + }).catch((e) => { + console.log('INDEEDDB ERROR: ' + e) + }) + } } From 73fe5a08d6b1265a51c9bd1059e1f5e2dc148b04 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 21 Feb 2022 12:16:10 +0000 Subject: [PATCH 101/217] Bump url-parse from 1.5.3 to 1.5.9 Bumps [url-parse](https://github.com/unshiftio/url-parse) from 1.5.3 to 1.5.9. - [Release notes](https://github.com/unshiftio/url-parse/releases) - [Commits](https://github.com/unshiftio/url-parse/compare/1.5.3...1.5.9) --- updated-dependencies: - dependency-name: url-parse dependency-type: indirect ... Signed-off-by: dependabot[bot] --- package-lock.json | 76 +++++++++++++++++++++++------------------------ 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/package-lock.json b/package-lock.json index 18feb9d161..d82c694b0b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9782,46 +9782,46 @@ "integrity": "sha512-IXf3XA7+XyN7CP9gGh/XB0UxVMlvARGEgGXLubFICsUMGz6Q+DU+i4gGlpOxTjKvXjkJDJC8YdqdKkDj9qZHEQ==" }, "@remixproject/engine": { - "version": "0.3.26", - "resolved": "https://registry.npmjs.org/@remixproject/engine/-/engine-0.3.26.tgz", - "integrity": "sha512-6Rq6aTUyhtXAaoQamAI8ocFSVy2txpGwu1aoYZGrqova/p/tRWn4/+PU713sffyiAQVBCk7C1z/5VKLm7tUYrQ==", + "version": "0.3.28", + "resolved": "https://registry.npmjs.org/@remixproject/engine/-/engine-0.3.28.tgz", + "integrity": "sha512-27SHaCrG3KrPfMa1MYud4tE9xUIJKITEUsql99fhN7x12lOmgGZFjiqIG/WWjCMmT7OMG3vtLayiZrsYkzHCVw==", "requires": { - "@remixproject/plugin-api": "0.3.26", - "@remixproject/plugin-utils": "0.3.26" + "@remixproject/plugin-api": "0.3.28", + "@remixproject/plugin-utils": "0.3.28" } }, "@remixproject/engine-web": { - "version": "0.3.26", - "resolved": "https://registry.npmjs.org/@remixproject/engine-web/-/engine-web-0.3.26.tgz", - "integrity": "sha512-QSW9KVOgHWuRDNqTZIp1jjBeDOXlXQZWYABgljTsC+Nig8EwlyRTfIza9PuCb+MDYT/kID8VgSPXnMrlOtvhjQ==", + "version": "0.3.28", + "resolved": "https://registry.npmjs.org/@remixproject/engine-web/-/engine-web-0.3.28.tgz", + "integrity": "sha512-JTwTuonW+pI7WsSsgGHAzPynGjIdG34VnPrspR9XKBQO4+NX7m3lbNIMUUviyrbqIoGiGtgYd/ry98uLpTHr4g==", "requires": { - "@remixproject/engine": "0.3.26", - "@remixproject/plugin-api": "0.3.26", - "@remixproject/plugin-utils": "0.3.26" + "@remixproject/engine": "0.3.28", + "@remixproject/plugin-api": "0.3.28", + "@remixproject/plugin-utils": "0.3.28" } }, "@remixproject/plugin": { - "version": "0.3.26", - "resolved": "https://registry.npmjs.org/@remixproject/plugin/-/plugin-0.3.26.tgz", - "integrity": "sha512-j0sgl4yDOVJLCuRWOEb/Wo9/fumrWlIpsO0MrtficuhVc1FGhZxKVv8Vdu3x3HgWhXkuhLUMs8VoJ1Ntd9ZkUQ==", + "version": "0.3.28", + "resolved": "https://registry.npmjs.org/@remixproject/plugin/-/plugin-0.3.28.tgz", + "integrity": "sha512-sw+cow3GKAcEacXLvdJwtHHIphPty4KRMZ6tcQHdtx/iCKTMNdw2hribKPnvTO+6mXE+4oAKCrFqeTdVp/rd1w==", "requires": { - "@remixproject/plugin-api": "0.3.26", - "@remixproject/plugin-utils": "0.3.26", + "@remixproject/plugin-api": "0.3.28", + "@remixproject/plugin-utils": "0.3.28", "events": "3.2.0" } }, "@remixproject/plugin-api": { - "version": "0.3.26", - "resolved": "https://registry.npmjs.org/@remixproject/plugin-api/-/plugin-api-0.3.26.tgz", - "integrity": "sha512-6vR9nVF4EfXDHA0r8MrlLyVYRMJMG7J3Y3jzpaAumetW+YpvfJqgE/uhGgm2me2ypDM8vW0POQGhRaGeZTGwFg==", + "version": "0.3.28", + "resolved": "https://registry.npmjs.org/@remixproject/plugin-api/-/plugin-api-0.3.28.tgz", + "integrity": "sha512-tOzVFR504037weEkNHQGZsk+Ebxcu/xnBsVCkJaQaBMb+H/i6YevKQmoR1aGcH+JfQxc8eS8LGC65MaV8zmcWg==", "requires": { - "@remixproject/plugin-utils": "0.3.26" + "@remixproject/plugin-utils": "0.3.28" } }, "@remixproject/plugin-utils": { - "version": "0.3.26", - "resolved": "https://registry.npmjs.org/@remixproject/plugin-utils/-/plugin-utils-0.3.26.tgz", - "integrity": "sha512-K/v+TXYOMV13dLf1LEgiF7CfqbOc105hC/2oapkSoHKSf3WVyWIUDlBsChRQl7osfUs/zT93q2+jNlLofWQUxg==", + "version": "0.3.28", + "resolved": "https://registry.npmjs.org/@remixproject/plugin-utils/-/plugin-utils-0.3.28.tgz", + "integrity": "sha512-5CayTgMqRiOguanTy6kpuRgCmjEFLUu2K4Rs7Zmt+GOzHucmwkDxYQO+3hFv0Jz/M/6yC5wkKYTx8vfPLLdEBQ==", "requires": { "tslib": "2.0.1" }, @@ -9834,13 +9834,13 @@ } }, "@remixproject/plugin-webview": { - "version": "0.3.26", - "resolved": "https://registry.npmjs.org/@remixproject/plugin-webview/-/plugin-webview-0.3.26.tgz", - "integrity": "sha512-hqWaFapUfcAX2Odsj0ANKvLXQbkzZ/xNONMqE0wRxFRYTIhFGZqFzJVzwSD+U4bSehP1JtzkrxwKBqNyjz5GxQ==", + "version": "0.3.28", + "resolved": "https://registry.npmjs.org/@remixproject/plugin-webview/-/plugin-webview-0.3.28.tgz", + "integrity": "sha512-DodSkN0vMSo2DEEoBOWyKxC/ElvBA826vhX+JVGXA8HGS45aavplZIN967hsc+SdzjV1UZfSNKEHttLGwM1BIw==", "requires": { - "@remixproject/plugin": "0.3.26", - "@remixproject/plugin-api": "0.3.26", - "@remixproject/plugin-utils": "0.3.26", + "@remixproject/plugin": "0.3.28", + "@remixproject/plugin-api": "0.3.28", + "@remixproject/plugin-utils": "0.3.28", "axios": "^0.21.1" }, "dependencies": { @@ -9855,13 +9855,13 @@ } }, "@remixproject/plugin-ws": { - "version": "0.3.26", - "resolved": "https://registry.npmjs.org/@remixproject/plugin-ws/-/plugin-ws-0.3.26.tgz", - "integrity": "sha512-Nerd/2vGb96G6B8pGRCRNAGlO97KnJpbFmpa47SYipgjaq5Yj5iCUY+fbQzMWdGW2W4BrUPE+YBZCkq/KlfbGw==", + "version": "0.3.28", + "resolved": "https://registry.npmjs.org/@remixproject/plugin-ws/-/plugin-ws-0.3.28.tgz", + "integrity": "sha512-i3He9t4qvcBQxzshFx66D6drqLlySmV7Cb+NeYtMOYlWxQSJtUakp/Px1Tl3IDFQXDfpXxvDvYhn2w0AWPBOqw==", "requires": { - "@remixproject/plugin": "0.3.26", - "@remixproject/plugin-api": "0.3.26", - "@remixproject/plugin-utils": "0.3.26" + "@remixproject/plugin": "0.3.28", + "@remixproject/plugin-api": "0.3.28", + "@remixproject/plugin-utils": "0.3.28" } }, "@restart/context": { @@ -45704,9 +45704,9 @@ } }, "url-parse": { - "version": "1.5.3", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.3.tgz", - "integrity": "sha512-IIORyIQD9rvj0A4CLWsHkBBJuNqWpFQe224b6j9t/ABmquIS0qDU2pY6kl6AuOrL5OkCXHMCFNe1jBcuAggjvQ==", + "version": "1.5.9", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.9.tgz", + "integrity": "sha512-HpOvhKBvre8wYez+QhHcYiVvVmeF6DVnuSOOPhe3cTum3BnqHhvKaZm8FU5yTiOu/Jut2ZpB2rA/SbBA1JIGlQ==", "dev": true, "requires": { "querystringify": "^2.1.1", From 4c3295f932460dfb2c0399aa9212a6c814a0a2d6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 25 Feb 2022 10:18:17 +0000 Subject: [PATCH 102/217] Bump vm2 from 3.9.5 to 3.9.9 Bumps [vm2](https://github.com/patriksimek/vm2) from 3.9.5 to 3.9.9. - [Release notes](https://github.com/patriksimek/vm2/releases) - [Changelog](https://github.com/patriksimek/vm2/blob/master/CHANGELOG.md) - [Commits](https://github.com/patriksimek/vm2/compare/3.9.5...3.9.9) --- updated-dependencies: - dependency-name: vm2 dependency-type: indirect ... Signed-off-by: dependabot[bot] --- package-lock.json | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index d82c694b0b..80c1116747 100644 --- a/package-lock.json +++ b/package-lock.json @@ -46007,10 +46007,28 @@ } }, "vm2": { - "version": "3.9.5", - "resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.5.tgz", - "integrity": "sha512-LuCAHZN75H9tdrAiLFf030oW7nJV5xwNMuk1ymOZwopmuK3d2H4L1Kv4+GFHgarKiLfXXLFU+7LDABHnwOkWng==", - "dev": true + "version": "3.9.9", + "resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.9.tgz", + "integrity": "sha512-xwTm7NLh/uOjARRBs8/95H0e8fT3Ukw5D/JJWhxMbhKzNh1Nu981jQKvkep9iKYNxzlVrdzD0mlBGkDKZWprlw==", + "dev": true, + "requires": { + "acorn": "^8.7.0", + "acorn-walk": "^8.2.0" + }, + "dependencies": { + "acorn": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", + "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", + "dev": true + }, + "acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true + } + } }, "void-elements": { "version": "2.0.1", From a7d7a2cd1e2bf1ba06b13c022813c25e757547b2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 25 Feb 2022 11:10:46 +0000 Subject: [PATCH 103/217] Bump follow-redirects from 1.14.5 to 1.14.9 Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.5 to 1.14.9. - [Release notes](https://github.com/follow-redirects/follow-redirects/releases) - [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.14.5...v1.14.9) --- updated-dependencies: - dependency-name: follow-redirects dependency-type: indirect ... Signed-off-by: dependabot[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 80c1116747..bc7e96daac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19491,9 +19491,9 @@ "dev": true }, "follow-redirects": { - "version": "1.14.5", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.5.tgz", - "integrity": "sha512-wtphSXy7d4/OR+MvIFbCVBDzZ5520qV8XfPklSN5QtxuMUJZ+b0Wnst1e1lCDocfzuCkHqj8k0FpZqO+UIaKNA==" + "version": "1.14.9", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.9.tgz", + "integrity": "sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w==" }, "for-each": { "version": "0.3.3", From 7afc35ae40a4c338e2caf250b9094b0c4ed098c3 Mon Sep 17 00:00:00 2001 From: David Disu Date: Mon, 21 Feb 2022 11:39:59 +0100 Subject: [PATCH 104/217] Add e2e for json import via url parameter. --- apps/remix-ide-e2e/src/tests/url.spec.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/apps/remix-ide-e2e/src/tests/url.spec.ts b/apps/remix-ide-e2e/src/tests/url.spec.ts index 13227238f7..56a94e34a9 100644 --- a/apps/remix-ide-e2e/src/tests/url.spec.ts +++ b/apps/remix-ide-e2e/src/tests/url.spec.ts @@ -104,6 +104,21 @@ module.exports = { .verify.elementPresent('#runs:disabled') .click('[for="optimize"') .verify.attributeEquals('#runs', 'value', '200') + }, + + 'Should load json files from link passed in remix URL': function (browser: NightwatchBrowser) { + browser + .url('http://localhost:8080/#optimize=false&runs=200&evmVersion=null&version=soljson-v0.6.12+commit.27d51765.js&url=https://raw.githubusercontent.com/EthVM/evm-source-verification/main/contracts/1/0x011e5846975c6463a8c6337eecf3cbf64e328884/input.json') + .refresh() + .pause(5000) + .waitForElementPresent('*[data-id="workspacesSelect"] option[value="code-sample"]') + .openFile('@openzeppelin') + .openFile('@openzeppelin/contracts') + .openFile('@openzeppelin/contracts/access') + .openFile('@openzeppelin/contracts/access/AccessControl.sol') + .openFile('contracts') + .openFile('contracts/governance') + .openFile('contracts/governance/UnionGovernor.sol') .end() } } From 9dacd0ab349bc10554d628d2971599f46540b267 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 23 Feb 2022 17:36:13 +0100 Subject: [PATCH 105/217] fix editor blinking --- apps/remix-ide/src/app/editor/editor.js | 43 +- apps/remix-ide/src/app/tabs/settings-tab.tsx | 4 +- .../editor/src/lib/remix-ui-editor.tsx | 160 ++++--- package-lock.json | 438 +++++++++--------- package.json | 4 +- 5 files changed, 327 insertions(+), 322 deletions(-) diff --git a/apps/remix-ide/src/app/editor/editor.js b/apps/remix-ide/src/app/editor/editor.js index e7887df7e2..dcbe03bcc7 100644 --- a/apps/remix-ide/src/app/editor/editor.js +++ b/apps/remix-ide/src/app/editor/editor.js @@ -28,8 +28,6 @@ class Editor extends Plugin { // Init this.event = new EventManager() this.sessions = {} - this.sourceAnnotationsPerFile = {} - this.markerPerFile = {} this.readOnlySessions = {} this.previousInput = '' this.saveTimeout = null @@ -74,8 +72,6 @@ class Editor extends Plugin { editorAPI={state.api} themeType={state.currentThemeType} currentFile={state.currentFile} - sourceAnnotationsPerFile={state.sourceAnnotationsPerFile} - markerPerFile={state.markerPerFile} events={state.events} plugin={state.plugin} /> @@ -108,6 +104,10 @@ class Editor extends Plugin { } this.ref.gotoLine = (line, column) => this.gotoLine(line, column || 0) this.ref.getCursorPosition = () => this.getCursorPosition() + this.ref.addMarkerPerFile = (marker, filePath) => this.addMarkerPerFile(marker, filePath) + this.ref.addSourceAnnotationsPerFile = (annotation, filePath) => this.addSourceAnnotationsPerFile(annotation, filePath) + this.ref.clearDecorationsByPlugin = (filePath, plugin, typeOfDecoration) => this.clearDecorationsByPlugin(filePath, plugin, typeOfDecoration) + this.ref.keepDecorationsFor = (name, typeOfDecoration) => this.keepDecorationsFor(name, typeOfDecoration) }} id='editorView'>
      @@ -118,8 +118,6 @@ class Editor extends Plugin { api: this.api, currentThemeType: this.currentThemeType, currentFile: this.currentFile, - sourceAnnotationsPerFile: this.sourceAnnotationsPerFile, - markerPerFile: this.markerPerFile, events: this.events, plugin: this }) @@ -410,27 +408,12 @@ class Editor extends Plugin { if (filePath && !this.sessions[filePath]) throw new Error('file not found' + filePath) const path = filePath || this.currentFile - const currentAnnotations = this[typeOfDecoration][path] - if (!currentAnnotations) return - - const newAnnotations = [] - for (const annotation of currentAnnotations) { - if (annotation.from !== plugin) newAnnotations.push(annotation) - } - - this[typeOfDecoration][path] = newAnnotations - this.renderComponent() + this.api.clearDecorationsByPlugin(path, plugin, typeOfDecoration) } - keepDecorationsFor (name, typeOfDecoration) { + keepDecorationsFor (plugin, typeOfDecoration) { if (!this.currentFile) return - if (!this[typeOfDecoration][this.currentFile]) return - - const annotations = this[typeOfDecoration][this.currentFile] - for (const annotation of annotations) { - annotation.hide = annotation.from !== name - } - this.renderComponent() + this.api.keepDecorationsFor(this.currentFile, plugin, typeOfDecoration) } /** @@ -473,10 +456,16 @@ class Editor extends Plugin { const path = filePath || this.currentFile const { from } = this.currentRequest - if (!this[typeOfDecoration][path]) this[typeOfDecoration][path] = [] decoration.from = from - this[typeOfDecoration][path].push(decoration) - this.renderComponent() + + if (typeOfDecoration === 'markerPerFile') { + this.api.addMarkerPerFile(decoration, path) + return + } + if (typeOfDecoration === 'sourceAnnotationsPerFile') { + this.api.addSourceAnnotationsPerFile(decoration, path) + return + } } /** diff --git a/apps/remix-ide/src/app/tabs/settings-tab.tsx b/apps/remix-ide/src/app/tabs/settings-tab.tsx index 25ea5fb934..8440ffbfa7 100644 --- a/apps/remix-ide/src/app/tabs/settings-tab.tsx +++ b/apps/remix-ide/src/app/tabs/settings-tab.tsx @@ -47,11 +47,9 @@ module.exports = class SettingsTab extends ViewPlugin { } render() { - return ( -
      + return
      - ); } updateComponent(state: any){ diff --git a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx index f268b16a71..df1134feee 100644 --- a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx +++ b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx @@ -38,14 +38,6 @@ type sourceMarker = { hide: boolean } -type sourceAnnotationMap = { - [key: string]: [sourceAnnotation]; -} - -type sourceMarkerMap = { - [key: string]: [sourceMarker]; -} - loader.config({ paths: { vs: 'assets/js/monaco-editor/dev/vs' } }) /* eslint-disable-next-line */ @@ -54,8 +46,6 @@ export interface EditorUIProps { activated: boolean themeType: string currentFile: string - sourceAnnotationsPerFile: sourceAnnotationMap - markerPerFile: sourceMarkerMap events: { onBreakPointAdded: (file: string, line: number) => void onBreakPointCleared: (file: string, line: number) => void @@ -71,17 +61,21 @@ export interface EditorUIProps { getFontSize: () => number, getValue: (uri: string) => string getCursorPosition: () => cursorPosition + addMarkerPerFile: (marker: sourceMarker, filePath: string) => void + addSourceAnnotationsPerFile: (annotations: sourceAnnotation, filePath: string) => void + clearDecorationsByPlugin: (filePath: string, plugin: string, typeOfDecoration: string) => void + keepDecorationsFor: (filePath: string, plugin: string, typeOfDecoration: string) => void } } export const EditorUI = (props: EditorUIProps) => { const [, setCurrentBreakpoints] = useState({}) - const [currentAnnotations, setCurrentAnnotations] = useState({}) - const [currentMarkers, setCurrentMarkers] = useState({}) const editorRef = useRef(null) const monacoRef = useRef(null) const currentFileRef = useRef('') - + const currentDecorations = useRef({ sourceAnnotationsPerFile: {}, markerPerFile: {} }) // decorations that are currently in use by the editor + const registeredDecorations = useRef({}) // registered decorations + const [editorModelsState, dispatch] = useReducer(reducerActions, initialState) const formatColor = (name) => { @@ -226,55 +220,6 @@ export const EditorUI = (props: EditorUIProps) => { defineAndSetTheme(monacoRef.current) }) - const setAnnotationsbyFile = (uri) => { - if (props.sourceAnnotationsPerFile[uri]) { - const model = editorModelsState[uri]?.model - const newAnnotations = [] - for (const annotation of props.sourceAnnotationsPerFile[uri]) { - if (!annotation.hide) { - newAnnotations.push({ - range: new monacoRef.current.Range(annotation.row + 1, 1, annotation.row + 1, 1), - options: { - isWholeLine: false, - glyphMarginHoverMessage: { value: (annotation.from ? `from ${annotation.from}:\n` : '') + annotation.text }, - glyphMarginClassName: `fal fa-exclamation-square text-${annotation.type === 'error' ? 'danger' : (annotation.type === 'warning' ? 'warning' : 'info')}` - } - }) - } - } - setCurrentAnnotations(prevState => { - prevState[uri] = model.deltaDecorations(currentAnnotations[uri] || [], newAnnotations) - return prevState - }) - } - } - - const setMarkerbyFile = (uri) => { - if (props.markerPerFile[uri]) { - const model = editorModelsState[uri]?.model - const newMarkers = [] - for (const marker of props.markerPerFile[uri]) { - if (!marker.hide) { - let isWholeLine = false - if (marker.position.start.line === marker.position.end.line && marker.position.end.column - marker.position.start.column < 3) { - // in this case we force highlighting the whole line (doesn't make sense to highlight 2 chars) - isWholeLine = true - } - newMarkers.push({ - range: new monacoRef.current.Range(marker.position.start.line + 1, marker.position.start.column + 1, marker.position.end.line + 1, marker.position.end.column + 1), - options: { - isWholeLine, - inlineClassName: `alert-info border-0 highlightLine${marker.position.start.line + 1}` - } - }) - } - } - setCurrentMarkers(prevState => { - prevState[uri] = model.deltaDecorations(currentMarkers[uri] || [], newMarkers) - return prevState - }) - } - } useEffect(() => { if (!editorRef.current) return @@ -286,18 +231,91 @@ export const EditorUI = (props: EditorUIProps) => { monacoRef.current.editor.setModelLanguage(file.model, 'remix-solidity') } else if (file.language === 'cairo') { monacoRef.current.editor.setModelLanguage(file.model, 'remix-cairo') - } - setAnnotationsbyFile(props.currentFile) - setMarkerbyFile(props.currentFile) + } }, [props.currentFile]) - useEffect(() => { - setAnnotationsbyFile(props.currentFile) - }, [JSON.stringify(props.sourceAnnotationsPerFile)]) + const convertToMonacoDecoration = (decoration: sourceAnnotation | sourceMarker, typeOfDecoration: string) => { + if (typeOfDecoration === 'sourceAnnotationsPerFile') { + decoration = decoration as sourceAnnotation + return { + type: typeOfDecoration, + range: new monacoRef.current.Range(decoration.row + 1, 1, decoration.row + 1, 1), + options: { + isWholeLine: false, + glyphMarginHoverMessage: { value: (decoration.from ? `from ${decoration.from}:\n` : '') + decoration.text }, + glyphMarginClassName: `fal fa-exclamation-square text-${decoration.type === 'error' ? 'danger' : (decoration.type === 'warning' ? 'warning' : 'info')}` + } + } + } + if (typeOfDecoration === 'markerPerFile') { + decoration = decoration as sourceMarker + let isWholeLine = false + if (decoration.position.start.line === decoration.position.end.line && decoration.position.end.column - decoration.position.start.column < 3) { + // in this case we force highlighting the whole line (doesn't make sense to highlight 2 chars) + isWholeLine = true + } + return { + type: typeOfDecoration, + range: new monacoRef.current.Range(decoration.position.start.line + 1, decoration.position.start.column + 1, decoration.position.end.line + 1, decoration.position.end.column + 1), + options: { + isWholeLine, + inlineClassName: `alert-info border-top border-bottom highlightLine${decoration.position.start.line + 1}` + } + } + } + } + + props.editorAPI.clearDecorationsByPlugin = (filePath: string, plugin: string, typeOfDecoration: string) => { + const model = editorModelsState[filePath]?.model + if (!model) return + const decorations = [] + const newRegisteredDecorations = [] + if (registeredDecorations.current[filePath]) { + for (const decoration of registeredDecorations.current[filePath]) { + if (decoration.type === typeOfDecoration && decoration.value.from !== plugin) { + decorations.push(convertToMonacoDecoration(decoration.value, typeOfDecoration)) + newRegisteredDecorations.push(decoration) + } + } + } + currentDecorations.current[typeOfDecoration][filePath] = model.deltaDecorations(currentDecorations.current[typeOfDecoration][filePath], decorations) + registeredDecorations.current[filePath] = newRegisteredDecorations + } + + props.editorAPI.keepDecorationsFor = (filePath: string, plugin: string, typeOfDecoration: string) => { + const model = editorModelsState[filePath]?.model + if (!model) return + const decorations = [] + if (registeredDecorations.current[filePath]) { + for (const decoration of registeredDecorations.current[filePath]) { + if (decoration.type === typeOfDecoration && decoration.value.from === plugin) { + decorations.push(convertToMonacoDecoration(decoration.value, typeOfDecoration)) + } + } + } + currentDecorations.current[typeOfDecoration][filePath] = model.deltaDecorations(currentDecorations.current[typeOfDecoration][filePath], decorations) + } + + const addDecoration = (decoration: sourceAnnotation | sourceMarker, filePath: string, typeOfDecoration: string) => { + const model = editorModelsState[filePath]?.model + if (!model) return + const monacoDecoration = convertToMonacoDecoration(decoration, typeOfDecoration) + + if (!registeredDecorations.current[filePath]) registeredDecorations.current[filePath] = [] + registeredDecorations.current[filePath].push({ value: decoration, type: typeOfDecoration }) + if (!currentDecorations.current[typeOfDecoration][filePath]) currentDecorations.current[typeOfDecoration][filePath] = [] + + currentDecorations.current[typeOfDecoration][filePath].push(...model.deltaDecorations([], [monacoDecoration])) + } + + props.editorAPI.addSourceAnnotationsPerFile = (annotation: sourceAnnotation, filePath: string) => { + addDecoration(annotation, filePath, 'sourceAnnotationsPerFile') + } + + props.editorAPI.addMarkerPerFile = (marker: sourceMarker, filePath: string) => { + addDecoration(marker, filePath, 'markerPerFile') + } - useEffect(() => { - setMarkerbyFile(props.currentFile) - }, [JSON.stringify(props.markerPerFile)]) props.editorAPI.findMatches = (uri: string, value: string) => { if (!editorRef.current) return diff --git a/package-lock.json b/package-lock.json index bc7e96daac..60a67766f0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3320,7 +3320,7 @@ "@evocateur/libnpmaccess": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/@evocateur/libnpmaccess/-/libnpmaccess-3.1.2.tgz", - "integrity": "sha1-7Pf2zmsATp+UKwmNkiAL5KSxyEU=", + "integrity": "sha512-KSCAHwNWro0CF2ukxufCitT9K5LjL/KuMmNzSu8wuwN2rjyKHD8+cmOsiybK+W5hdnwc5M1SmRlVCaMHQo+3rg==", "dev": true, "requires": { "@evocateur/npm-registry-fetch": "^4.0.0", @@ -3333,13 +3333,13 @@ "aproba": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz", - "integrity": "sha1-UlILiuW1aSFbNU78DKo/4eRaitw=", + "integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==", "dev": true }, "npm-package-arg": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-6.1.1.tgz", - "integrity": "sha1-AhaMsKSaK3W/mIooaY3ntSnfXLc=", + "integrity": "sha512-qBpssaL3IOZWi5vEKUKW0cO7kzLeT+EQO9W8RsLOZf76KF9E/K9+wH0C7t06HXPpaH8WH5xF1MExLuCwbTqRUg==", "dev": true, "requires": { "hosted-git-info": "^2.7.1", @@ -3351,7 +3351,7 @@ "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha1-qVT5Ma66UI0we78Gnv8MAclhFvc=", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true } } @@ -3359,7 +3359,7 @@ "@evocateur/libnpmpublish": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/@evocateur/libnpmpublish/-/libnpmpublish-1.2.2.tgz", - "integrity": "sha1-Vd8J0tyhNq+6nIjHWconIZjbnxo=", + "integrity": "sha512-MJrrk9ct1FeY9zRlyeoyMieBjGDG9ihyyD9/Ft6MMrTxql9NyoEx2hw9casTIP4CdqEVu+3nQ2nXxoJ8RCXyFg==", "dev": true, "requires": { "@evocateur/npm-registry-fetch": "^4.0.0", @@ -3376,13 +3376,13 @@ "aproba": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz", - "integrity": "sha1-UlILiuW1aSFbNU78DKo/4eRaitw=", + "integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==", "dev": true }, "npm-package-arg": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-6.1.1.tgz", - "integrity": "sha1-AhaMsKSaK3W/mIooaY3ntSnfXLc=", + "integrity": "sha512-qBpssaL3IOZWi5vEKUKW0cO7kzLeT+EQO9W8RsLOZf76KF9E/K9+wH0C7t06HXPpaH8WH5xF1MExLuCwbTqRUg==", "dev": true, "requires": { "hosted-git-info": "^2.7.1", @@ -3394,7 +3394,7 @@ "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha1-qVT5Ma66UI0we78Gnv8MAclhFvc=", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true }, "ssri": { @@ -3411,7 +3411,7 @@ "@evocateur/npm-registry-fetch": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@evocateur/npm-registry-fetch/-/npm-registry-fetch-4.0.0.tgz", - "integrity": "sha1-jEw4dm2NMtMgD8sKg/BktXNl7WY=", + "integrity": "sha512-k1WGfKRQyhJpIr+P17O5vLIo2ko1PFLKwoetatdduUSt/aQ4J2sJrJwwatdI5Z3SiYk/mRH9S3JpdmMFd/IK4g==", "dev": true, "requires": { "JSONStream": "^1.3.4", @@ -3435,7 +3435,7 @@ "agentkeepalive": { "version": "3.5.2", "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-3.5.2.tgz", - "integrity": "sha1-oROSTdP6JKC8O3gQjEUMKr7gD2c=", + "integrity": "sha512-e0L/HNe6qkQ7H19kTlRRqUibEAwDK5AFk6y3PtMsuut2VAH6+Q4xZml1tNDJD7kSAyqmbG/K08K5WEJYtUrSlQ==", "dev": true, "requires": { "humanize-ms": "^1.2.1" @@ -3482,7 +3482,7 @@ "http-cache-semantics": { "version": "3.8.1", "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz", - "integrity": "sha1-ObDhat2bYFvwqe89nar0hDtMrNI=", + "integrity": "sha512-5ai2iksyV8ZXmnZhHH4rWPoxxistEexSi5936zIQ1bnNTW5VnA85B6P/VpXiRM017IgRvb2kKo1a//y+0wSp3w==", "dev": true }, "http-proxy-agent": { @@ -3498,7 +3498,7 @@ "https-proxy-agent": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz", - "integrity": "sha1-TuenN6vZJniik9mzShr00NCMeHs=", + "integrity": "sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==", "dev": true, "requires": { "agent-base": "^4.3.0", @@ -3508,7 +3508,7 @@ "make-fetch-happen": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-5.0.2.tgz", - "integrity": "sha1-qoOHEE8mh+3KAchofuRQE9AtGb0=", + "integrity": "sha512-07JHC0r1ykIoruKO8ifMXu+xEU8qOXDFETylktdug6vJDACnP+HKevOu3PXyNPzFyTSlz8vrBYlBO1JZRe8Cag==", "dev": true, "requires": { "agentkeepalive": "^3.4.1", @@ -3533,7 +3533,7 @@ "npm-package-arg": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-6.1.1.tgz", - "integrity": "sha1-AhaMsKSaK3W/mIooaY3ntSnfXLc=", + "integrity": "sha512-qBpssaL3IOZWi5vEKUKW0cO7kzLeT+EQO9W8RsLOZf76KF9E/K9+wH0C7t06HXPpaH8WH5xF1MExLuCwbTqRUg==", "dev": true, "requires": { "hosted-git-info": "^2.7.1", @@ -3561,7 +3561,7 @@ "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha1-qVT5Ma66UI0we78Gnv8MAclhFvc=", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true }, "socks": { @@ -3609,7 +3609,7 @@ "@evocateur/pacote": { "version": "9.6.5", "resolved": "https://registry.npmjs.org/@evocateur/pacote/-/pacote-9.6.5.tgz", - "integrity": "sha1-M94yuiELbxfCDrq01JfvxnVfSuU=", + "integrity": "sha512-EI552lf0aG2nOV8NnZpTxNo2PcXKPmDbF9K8eCBFQdIZwHNGN/mi815fxtmUMa2wTa1yndotICIDt/V0vpEx2w==", "dev": true, "requires": { "@evocateur/npm-registry-fetch": "^4.0.0", @@ -3655,7 +3655,7 @@ "agentkeepalive": { "version": "3.5.2", "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-3.5.2.tgz", - "integrity": "sha1-oROSTdP6JKC8O3gQjEUMKr7gD2c=", + "integrity": "sha512-e0L/HNe6qkQ7H19kTlRRqUibEAwDK5AFk6y3PtMsuut2VAH6+Q4xZml1tNDJD7kSAyqmbG/K08K5WEJYtUrSlQ==", "dev": true, "requires": { "humanize-ms": "^1.2.1" @@ -3702,7 +3702,7 @@ "http-cache-semantics": { "version": "3.8.1", "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz", - "integrity": "sha1-ObDhat2bYFvwqe89nar0hDtMrNI=", + "integrity": "sha512-5ai2iksyV8ZXmnZhHH4rWPoxxistEexSi5936zIQ1bnNTW5VnA85B6P/VpXiRM017IgRvb2kKo1a//y+0wSp3w==", "dev": true }, "http-proxy-agent": { @@ -3718,7 +3718,7 @@ "https-proxy-agent": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz", - "integrity": "sha1-TuenN6vZJniik9mzShr00NCMeHs=", + "integrity": "sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==", "dev": true, "requires": { "agent-base": "^4.3.0", @@ -3728,7 +3728,7 @@ "make-fetch-happen": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-5.0.2.tgz", - "integrity": "sha1-qoOHEE8mh+3KAchofuRQE9AtGb0=", + "integrity": "sha512-07JHC0r1ykIoruKO8ifMXu+xEU8qOXDFETylktdug6vJDACnP+HKevOu3PXyNPzFyTSlz8vrBYlBO1JZRe8Cag==", "dev": true, "requires": { "agentkeepalive": "^3.4.1", @@ -3753,7 +3753,7 @@ "npm-package-arg": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-6.1.1.tgz", - "integrity": "sha1-AhaMsKSaK3W/mIooaY3ntSnfXLc=", + "integrity": "sha512-qBpssaL3IOZWi5vEKUKW0cO7kzLeT+EQO9W8RsLOZf76KF9E/K9+wH0C7t06HXPpaH8WH5xF1MExLuCwbTqRUg==", "dev": true, "requires": { "hosted-git-info": "^2.7.1", @@ -3765,7 +3765,7 @@ "npm-packlist": { "version": "1.4.8", "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.4.8.tgz", - "integrity": "sha1-Vu5swTW5+YrT1Rwcldoiu7my7z4=", + "integrity": "sha512-5+AZgwru5IevF5ZdnFglB5wNlHG1AOOuw28WhUq8/8emhBmLv6jX5by4WJCh7lW0uSYZYS6DXqIsyZVIXRZU9A==", "dev": true, "requires": { "ignore-walk": "^3.0.1", @@ -3776,7 +3776,7 @@ "npm-pick-manifest": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/npm-pick-manifest/-/npm-pick-manifest-3.0.2.tgz", - "integrity": "sha1-9Nnl/UviFT5fTl+be+jcQZqZq7c=", + "integrity": "sha512-wNprTNg+X5nf+tDi+hbjdHhM4bX+mKqv6XmPh7B5eG+QY9VARfQPfCEH013H5GqfNj6ee8Ij2fg8yk0mzps1Vw==", "dev": true, "requires": { "figgy-pudding": "^3.5.1", @@ -3803,7 +3803,7 @@ "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha1-qVT5Ma66UI0we78Gnv8MAclhFvc=", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true }, "socks": { @@ -5620,7 +5620,7 @@ "@lerna/add": { "version": "3.21.0", "resolved": "https://registry.npmjs.org/@lerna/add/-/add-3.21.0.tgz", - "integrity": "sha1-JwB73nHMewopaas8LwrkFXi0V3s=", + "integrity": "sha512-vhUXXF6SpufBE1EkNEXwz1VLW03f177G9uMOFMQkp6OJ30/PWg4Ekifuz9/3YfgB2/GH8Tu4Lk3O51P2Hskg/A==", "dev": true, "requires": { "@evocateur/pacote": "^9.6.3", @@ -5638,7 +5638,7 @@ "npm-package-arg": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-6.1.1.tgz", - "integrity": "sha1-AhaMsKSaK3W/mIooaY3ntSnfXLc=", + "integrity": "sha512-qBpssaL3IOZWi5vEKUKW0cO7kzLeT+EQO9W8RsLOZf76KF9E/K9+wH0C7t06HXPpaH8WH5xF1MExLuCwbTqRUg==", "dev": true, "requires": { "hosted-git-info": "^2.7.1", @@ -5650,7 +5650,7 @@ "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha1-qVT5Ma66UI0we78Gnv8MAclhFvc=", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true } } @@ -5666,7 +5666,7 @@ "@lerna/bootstrap": { "version": "3.21.0", "resolved": "https://registry.npmjs.org/@lerna/bootstrap/-/bootstrap-3.21.0.tgz", - "integrity": "sha1-vNG2Ub5bCXCyDY+uBMhkVIEjrtY=", + "integrity": "sha512-mtNHlXpmvJn6JTu0KcuTTPl2jLsDNud0QacV/h++qsaKbhAaJr/FElNZ5s7MwZFUM3XaDmvWzHKaszeBMHIbBw==", "dev": true, "requires": { "@lerna/command": "3.21.0", @@ -5697,7 +5697,7 @@ "npm-package-arg": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-6.1.1.tgz", - "integrity": "sha1-AhaMsKSaK3W/mIooaY3ntSnfXLc=", + "integrity": "sha512-qBpssaL3IOZWi5vEKUKW0cO7kzLeT+EQO9W8RsLOZf76KF9E/K9+wH0C7t06HXPpaH8WH5xF1MExLuCwbTqRUg==", "dev": true, "requires": { "hosted-git-info": "^2.7.1", @@ -5709,7 +5709,7 @@ "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha1-qVT5Ma66UI0we78Gnv8MAclhFvc=", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true } } @@ -5725,7 +5725,7 @@ "@lerna/changed": { "version": "3.21.0", "resolved": "https://registry.npmjs.org/@lerna/changed/-/changed-3.21.0.tgz", - "integrity": "sha1-EI4V9nm/4HevUA9YJIxjTxBE6gs=", + "integrity": "sha512-hzqoyf8MSHVjZp0gfJ7G8jaz+++mgXYiNs9iViQGA8JlN/dnWLI5sWDptEH3/B30Izo+fdVz0S0s7ydVE3pWIw==", "dev": true, "requires": { "@lerna/collect-updates": "3.20.0", @@ -5737,7 +5737,7 @@ "@lerna/check-working-tree": { "version": "3.16.5", "resolved": "https://registry.npmjs.org/@lerna/check-working-tree/-/check-working-tree-3.16.5.tgz", - "integrity": "sha1-tPiuYbtFI1Yd+5+PjYdN1Gu0S6o=", + "integrity": "sha512-xWjVBcuhvB8+UmCSb5tKVLB5OuzSpw96WEhS2uz6hkWVa/Euh1A0/HJwn2cemyK47wUrCQXtczBUiqnq9yX5VQ==", "dev": true, "requires": { "@lerna/collect-uncommitted": "3.16.5", @@ -5748,7 +5748,7 @@ "@lerna/child-process": { "version": "3.16.5", "resolved": "https://registry.npmjs.org/@lerna/child-process/-/child-process-3.16.5.tgz", - "integrity": "sha1-OPo8GAZKpKwHVK2AEUd2p7NqabI=", + "integrity": "sha512-vdcI7mzei9ERRV4oO8Y1LHBZ3A5+ampRKg1wq5nutLsUA4mEBN6H7JqjWOMY9xZemv6+kATm2ofjJ3lW5TszQg==", "dev": true, "requires": { "chalk": "^2.3.1", @@ -5759,7 +5759,7 @@ "@lerna/clean": { "version": "3.21.0", "resolved": "https://registry.npmjs.org/@lerna/clean/-/clean-3.21.0.tgz", - "integrity": "sha1-wLRrUwDMPa4s2jvsFLgDCC2jhW0=", + "integrity": "sha512-b/L9l+MDgE/7oGbrav6rG8RTQvRiZLO1zTcG17zgJAAuhlsPxJExMlh2DFwJEVi2les70vMhHfST3Ue1IMMjpg==", "dev": true, "requires": { "@lerna/command": "3.21.0", @@ -5783,7 +5783,7 @@ "@lerna/cli": { "version": "3.18.5", "resolved": "https://registry.npmjs.org/@lerna/cli/-/cli-3.18.5.tgz", - "integrity": "sha1-yQxGFUL801ttWwFaKQ+w2/tB0kI=", + "integrity": "sha512-erkbxkj9jfc89vVs/jBLY/fM0I80oLmJkFUV3Q3wk9J3miYhP14zgVEBsPZY68IZlEjT6T3Xlq2xO1AVaatHsA==", "dev": true, "requires": { "@lerna/global-options": "3.13.0", @@ -5795,13 +5795,13 @@ "ansi-regex": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha1-i5+PCM8ay4Q3Vqg5yox+MWjFGZc=", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", "dev": true }, "cliui": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", - "integrity": "sha1-3u/P2y6AB4SqNPRvoI4GhRx7u8U=", + "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", "dev": true, "requires": { "string-width": "^3.1.0", @@ -5818,7 +5818,7 @@ "find-up": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha1-SRafHXmTQwZG2mHsxa41XCHJe3M=", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", "dev": true, "requires": { "locate-path": "^3.0.0" @@ -5833,7 +5833,7 @@ "locate-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha1-2+w7OrdZdYBxtY/ln8QYca8hQA4=", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", "dev": true, "requires": { "p-locate": "^3.0.0", @@ -5843,7 +5843,7 @@ "p-limit": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha1-PdM8ZHohT9//2DWTPrCG2g3CHbE=", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", "dev": true, "requires": { "p-try": "^2.0.0" @@ -5852,7 +5852,7 @@ "p-locate": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha1-Mi1poFwCZLJZl9n0DNiokasAZKQ=", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", "dev": true, "requires": { "p-limit": "^2.0.0" @@ -5861,13 +5861,13 @@ "p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha1-yyhoVA4xPWHeWPr741zpAE1VQOY=", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true }, "string-width": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha1-InZ74htirxCBV0MG9prFG2IgOWE=", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", "dev": true, "requires": { "emoji-regex": "^7.0.1", @@ -5878,7 +5878,7 @@ "strip-ansi": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha1-jJpTb+tq/JYr36WxBKUJHBrZwK4=", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", "dev": true, "requires": { "ansi-regex": "^4.1.0" @@ -5887,7 +5887,7 @@ "wrap-ansi": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", - "integrity": "sha1-H9H2cjXVttD+54EFYAG/tpTAOwk=", + "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", "dev": true, "requires": { "ansi-styles": "^3.2.0", @@ -5898,7 +5898,7 @@ "yargs": { "version": "14.2.3", "resolved": "https://registry.npmjs.org/yargs/-/yargs-14.2.3.tgz", - "integrity": "sha1-Ghw+3O0a+yov6jNgS8bR2NaIpBQ=", + "integrity": "sha512-ZbotRWhF+lkjijC/VhmOT9wSgyBQ7+zr13+YLkhfsSiTriYsMzkTUFP18pFhWwBeMa5gUc1MzbhrO6/VB7c9Xg==", "dev": true, "requires": { "cliui": "^5.0.0", @@ -5929,7 +5929,7 @@ "@lerna/collect-uncommitted": { "version": "3.16.5", "resolved": "https://registry.npmjs.org/@lerna/collect-uncommitted/-/collect-uncommitted-3.16.5.tgz", - "integrity": "sha1-pJTWGqwxzceuxLvlLJZVAnQTLmM=", + "integrity": "sha512-ZgqnGwpDZiWyzIQVZtQaj9tRizsL4dUOhuOStWgTAw1EMe47cvAY2kL709DzxFhjr6JpJSjXV5rZEAeU3VE0Hg==", "dev": true, "requires": { "@lerna/child-process": "3.16.5", @@ -5941,7 +5941,7 @@ "@lerna/collect-updates": { "version": "3.20.0", "resolved": "https://registry.npmjs.org/@lerna/collect-updates/-/collect-updates-3.20.0.tgz", - "integrity": "sha1-YvnXa6IaJbfZ+/McAt6IdEpWS9E=", + "integrity": "sha512-qBTVT5g4fupVhBFuY4nI/3FSJtQVcDh7/gEPOpRxoXB/yCSnT38MFHXWl+y4einLciCjt/+0x6/4AG80fjay2Q==", "dev": true, "requires": { "@lerna/child-process": "3.16.5", @@ -5954,7 +5954,7 @@ "slash": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", - "integrity": "sha1-3lUoUaF1nfOo8gZTVEL17E3eq0Q=", + "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", "dev": true } } @@ -5962,7 +5962,7 @@ "@lerna/command": { "version": "3.21.0", "resolved": "https://registry.npmjs.org/@lerna/command/-/command-3.21.0.tgz", - "integrity": "sha1-miODdZ3HtwDaz6iiKy86bhkBIfc=", + "integrity": "sha512-T2bu6R8R3KkH5YoCKdutKv123iUgUbW8efVjdGCDnCMthAQzoentOJfDeodBwn0P2OqCl3ohsiNVtSn9h78fyQ==", "dev": true, "requires": { "@lerna/child-process": "3.16.5", @@ -5980,7 +5980,7 @@ "@lerna/conventional-commits": { "version": "3.22.0", "resolved": "https://registry.npmjs.org/@lerna/conventional-commits/-/conventional-commits-3.22.0.tgz", - "integrity": "sha1-J5j0iB7i70V72uAnq30L8K9vHgk=", + "integrity": "sha512-z4ZZk1e8Mhz7+IS8NxHr64wyklHctCJyWpJKEZZPJiLFJ8yKto/x38O80R10pIzC0rr8Sy/OsjSH4bl0TbbgqA==", "dev": true, "requires": { "@lerna/validation-error": "3.13.0", @@ -6019,7 +6019,7 @@ "npm-package-arg": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-6.1.1.tgz", - "integrity": "sha1-AhaMsKSaK3W/mIooaY3ntSnfXLc=", + "integrity": "sha512-qBpssaL3IOZWi5vEKUKW0cO7kzLeT+EQO9W8RsLOZf76KF9E/K9+wH0C7t06HXPpaH8WH5xF1MExLuCwbTqRUg==", "dev": true, "requires": { "hosted-git-info": "^2.7.1", @@ -6031,7 +6031,7 @@ "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha1-qVT5Ma66UI0we78Gnv8MAclhFvc=", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true } } @@ -6041,7 +6041,7 @@ "@lerna/create": { "version": "3.22.0", "resolved": "https://registry.npmjs.org/@lerna/create/-/create-3.22.0.tgz", - "integrity": "sha1-1rvQN8PcW0Jf5fbRuBcFfCePdhk=", + "integrity": "sha512-MdiQQzCcB4E9fBF1TyMOaAEz9lUjIHp1Ju9H7f3lXze5JK6Fl5NYkouAvsLgY6YSIhXMY8AHW2zzXeBDY4yWkw==", "dev": true, "requires": { "@evocateur/pacote": "^9.6.3", @@ -6067,7 +6067,7 @@ "@nodelib/fs.stat": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz", - "integrity": "sha1-K1o6s/kYzKSKjHVMCBaOPwPrphs=", + "integrity": "sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==", "dev": true }, "array-union": { @@ -6091,7 +6091,7 @@ "fast-glob": { "version": "2.2.7", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-2.2.7.tgz", - "integrity": "sha1-aVOFfDr6R1//ku5gFdUtpwpM050=", + "integrity": "sha512-g1KuQwHOZAmOZMuBtHdxDtju+T2RT8jgCC9aANsbpdiDDTSnjgfuVsIBNKbUeJI3oKMRExcfNDtJl4OhbffMsw==", "dev": true, "requires": { "@mrmlnc/readdir-enhanced": "^2.2.1", @@ -6116,7 +6116,7 @@ "globby": { "version": "9.2.0", "resolved": "https://registry.npmjs.org/globby/-/globby-9.2.0.tgz", - "integrity": "sha1-/QKacGxwPSm90XD0tts6P3p8tj0=", + "integrity": "sha512-ollPHROa5mcxDEkwg6bPt3QbEf4pDQSNtd6JPL1YvOvAo/7/0VAm9TccUeoTmarjPw4pfUthSCqcyfNB1I3ZSg==", "dev": true, "requires": { "@types/glob": "^7.1.1", @@ -6132,7 +6132,7 @@ "ignore": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha1-dQ49tYYgh7RzfrrIIH/9HvJ7Jfw=", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", "dev": true }, "jsonfile": { @@ -6147,7 +6147,7 @@ "npm-package-arg": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-6.1.1.tgz", - "integrity": "sha1-AhaMsKSaK3W/mIooaY3ntSnfXLc=", + "integrity": "sha512-qBpssaL3IOZWi5vEKUKW0cO7kzLeT+EQO9W8RsLOZf76KF9E/K9+wH0C7t06HXPpaH8WH5xF1MExLuCwbTqRUg==", "dev": true, "requires": { "hosted-git-info": "^2.7.1", @@ -6159,7 +6159,7 @@ "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha1-qVT5Ma66UI0we78Gnv8MAclhFvc=", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true } } @@ -6167,7 +6167,7 @@ "slash": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", - "integrity": "sha1-3lUoUaF1nfOo8gZTVEL17E3eq0Q=", + "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", "dev": true }, "tr46": { @@ -6201,7 +6201,7 @@ "@lerna/create-symlink": { "version": "3.16.2", "resolved": "https://registry.npmjs.org/@lerna/create-symlink/-/create-symlink-3.16.2.tgz", - "integrity": "sha1-QSy45Zpy9afZRj5ORyGtIHAUmWc=", + "integrity": "sha512-pzXIJp6av15P325sgiIRpsPXLFmkisLhMBCy4764d+7yjf2bzrJ4gkWVMhsv4AdF0NN3OyZ5jjzzTtLNqfR+Jw==", "dev": true, "requires": { "@zkochan/cmd-shim": "^3.1.0", @@ -6234,7 +6234,7 @@ "@lerna/describe-ref": { "version": "3.16.5", "resolved": "https://registry.npmjs.org/@lerna/describe-ref/-/describe-ref-3.16.5.tgz", - "integrity": "sha1-ozjCWq7YN9PccLinLER8XGY0asA=", + "integrity": "sha512-c01+4gUF0saOOtDBzbLMFOTJDHTKbDFNErEY6q6i9QaXuzy9LNN62z+Hw4acAAZuJQhrVWncVathcmkkjvSVGw==", "dev": true, "requires": { "@lerna/child-process": "3.16.5", @@ -6244,7 +6244,7 @@ "@lerna/diff": { "version": "3.21.0", "resolved": "https://registry.npmjs.org/@lerna/diff/-/diff-3.21.0.tgz", - "integrity": "sha1-5t8Ni5kWFn/1pJ/LAqwGQkKApo0=", + "integrity": "sha512-5viTR33QV3S7O+bjruo1SaR40m7F2aUHJaDAC7fL9Ca6xji+aw1KFkpCtVlISS0G8vikUREGMJh+c/VMSc8Usw==", "dev": true, "requires": { "@lerna/child-process": "3.16.5", @@ -6256,7 +6256,7 @@ "@lerna/exec": { "version": "3.21.0", "resolved": "https://registry.npmjs.org/@lerna/exec/-/exec-3.21.0.tgz", - "integrity": "sha1-F/B1M4k8uRihe0G8xWbcQ3AW2yY=", + "integrity": "sha512-iLvDBrIE6rpdd4GIKTY9mkXyhwsJ2RvQdB9ZU+/NhR3okXfqKc6py/24tV111jqpXTtZUW6HNydT4dMao2hi1Q==", "dev": true, "requires": { "@lerna/child-process": "3.16.5", @@ -6279,7 +6279,7 @@ "@lerna/filter-options": { "version": "3.20.0", "resolved": "https://registry.npmjs.org/@lerna/filter-options/-/filter-options-3.20.0.tgz", - "integrity": "sha1-Dw9dWkeDhW7s5CBHCMyQLLyK9Zs=", + "integrity": "sha512-bmcHtvxn7SIl/R9gpiNMVG7yjx7WyT0HSGw34YVZ9B+3xF/83N3r5Rgtjh4hheLZ+Q91Or0Jyu5O3Nr+AwZe2g==", "dev": true, "requires": { "@lerna/collect-updates": "3.20.0", @@ -6292,7 +6292,7 @@ "@lerna/filter-packages": { "version": "3.18.0", "resolved": "https://registry.npmjs.org/@lerna/filter-packages/-/filter-packages-3.18.0.tgz", - "integrity": "sha1-ano3bShSCNsDqClYz7gXLhebTnA=", + "integrity": "sha512-6/0pMM04bCHNATIOkouuYmPg6KH3VkPCIgTfQmdkPJTullERyEQfNUKikrefjxo1vHOoCACDpy65JYyKiAbdwQ==", "dev": true, "requires": { "@lerna/validation-error": "3.13.0", @@ -6303,7 +6303,7 @@ "@lerna/get-npm-exec-opts": { "version": "3.13.0", "resolved": "https://registry.npmjs.org/@lerna/get-npm-exec-opts/-/get-npm-exec-opts-3.13.0.tgz", - "integrity": "sha1-0bVSywCIGZ/D5+Em+RTjmgjfnqU=", + "integrity": "sha512-Y0xWL0rg3boVyJk6An/vurKzubyJKtrxYv2sj4bB8Mc5zZ3tqtv0ccbOkmkXKqbzvNNF7VeUt1OJ3DRgtC/QZw==", "dev": true, "requires": { "npmlog": "^4.1.2" @@ -6312,7 +6312,7 @@ "@lerna/get-packed": { "version": "3.16.0", "resolved": "https://registry.npmjs.org/@lerna/get-packed/-/get-packed-3.16.0.tgz", - "integrity": "sha1-GzFrcG3O6Gx7qlXlCwh5WUR4Uv8=", + "integrity": "sha512-AjsFiaJzo1GCPnJUJZiTW6J1EihrPkc2y3nMu6m3uWFxoleklsSCyImumzVZJssxMi3CPpztj8LmADLedl9kXw==", "dev": true, "requires": { "fs-extra": "^8.1.0", @@ -6354,7 +6354,7 @@ "@lerna/github-client": { "version": "3.22.0", "resolved": "https://registry.npmjs.org/@lerna/github-client/-/github-client-3.22.0.tgz", - "integrity": "sha1-XYFqpPdnR+1zauZP+WK48Vw1TZU=", + "integrity": "sha512-O/GwPW+Gzr3Eb5bk+nTzTJ3uv+jh5jGho9BOqKlajXaOkMYGBELEAqV5+uARNGWZFvYAiF4PgqHb6aCUu7XdXg==", "dev": true, "requires": { "@lerna/child-process": "3.16.5", @@ -6367,7 +6367,7 @@ "@lerna/gitlab-client": { "version": "3.15.0", "resolved": "https://registry.npmjs.org/@lerna/gitlab-client/-/gitlab-client-3.15.0.tgz", - "integrity": "sha1-kfTsjGl7WsV/fyW9UP5lnSSqlqY=", + "integrity": "sha512-OsBvRSejHXUBMgwWQqNoioB8sgzL/Pf1pOUhHKtkiMl6aAWjklaaq5HPMvTIsZPfS6DJ9L5OK2GGZuooP/5c8Q==", "dev": true, "requires": { "node-fetch": "^2.5.0", @@ -6406,13 +6406,13 @@ "@lerna/global-options": { "version": "3.13.0", "resolved": "https://registry.npmjs.org/@lerna/global-options/-/global-options-3.13.0.tgz", - "integrity": "sha1-IXZiKQ2watnPLEnY4xAO4o6uuuE=", + "integrity": "sha512-SlZvh1gVRRzYLVluz9fryY1nJpZ0FHDGB66U9tFfvnnxmueckRQxLopn3tXj3NU1kc3QANT2I5BsQkOqZ4TEFQ==", "dev": true }, "@lerna/has-npm-version": { "version": "3.16.5", "resolved": "https://registry.npmjs.org/@lerna/has-npm-version/-/has-npm-version-3.16.5.tgz", - "integrity": "sha1-q4OVbyEdiSPqav6bl5s4zHOxUyY=", + "integrity": "sha512-WL7LycR9bkftyqbYop5rEGJ9sRFIV55tSGmbN1HLrF9idwOCD7CLrT64t235t3t4O5gehDnwKI5h2U3oxTrF8Q==", "dev": true, "requires": { "@lerna/child-process": "3.16.5", @@ -6422,7 +6422,7 @@ "@lerna/import": { "version": "3.22.0", "resolved": "https://registry.npmjs.org/@lerna/import/-/import-3.22.0.tgz", - "integrity": "sha1-Gl8DlPOOI8T2QqEj5eFRfnDQaNI=", + "integrity": "sha512-uWOlexasM5XR6tXi4YehODtH9Y3OZrFht3mGUFFT3OIl2s+V85xIGFfqFGMTipMPAGb2oF1UBLL48kR43hRsOg==", "dev": true, "requires": { "@lerna/child-process": "3.16.5", @@ -6460,7 +6460,7 @@ "@lerna/info": { "version": "3.21.0", "resolved": "https://registry.npmjs.org/@lerna/info/-/info-3.21.0.tgz", - "integrity": "sha1-dmlrZ2/bDzXUjIPGPB4yu143gU8=", + "integrity": "sha512-0XDqGYVBgWxUquFaIptW2bYSIu6jOs1BtkvRTWDDhw4zyEdp6q4eaMvqdSap1CG+7wM5jeLCi6z94wS0AuiuwA==", "dev": true, "requires": { "@lerna/command": "3.21.0", @@ -6471,7 +6471,7 @@ "@lerna/init": { "version": "3.21.0", "resolved": "https://registry.npmjs.org/@lerna/init/-/init-3.21.0.tgz", - "integrity": "sha1-HoEJNNyL9OU4bAMQQYgdO0CWqlw=", + "integrity": "sha512-6CM0z+EFUkFfurwdJCR+LQQF6MqHbYDCBPyhu/d086LRf58GtYZYj49J8mKG9ktayp/TOIxL/pKKjgLD8QBPOg==", "dev": true, "requires": { "@lerna/child-process": "3.16.5", @@ -6512,7 +6512,7 @@ "@lerna/link": { "version": "3.21.0", "resolved": "https://registry.npmjs.org/@lerna/link/-/link-3.21.0.tgz", - "integrity": "sha1-i+aP8MzuEEsXS1u9YGMCwvBunZs=", + "integrity": "sha512-tGu9GxrX7Ivs+Wl3w1+jrLi1nQ36kNI32dcOssij6bg0oZ2M2MDEFI9UF2gmoypTaN9uO5TSsjCFS7aR79HbdQ==", "dev": true, "requires": { "@lerna/command": "3.21.0", @@ -6531,7 +6531,7 @@ "slash": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", - "integrity": "sha1-3lUoUaF1nfOo8gZTVEL17E3eq0Q=", + "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", "dev": true } } @@ -6539,7 +6539,7 @@ "@lerna/list": { "version": "3.21.0", "resolved": "https://registry.npmjs.org/@lerna/list/-/list-3.21.0.tgz", - "integrity": "sha1-Qvdvr6Vt6hO2keyMqxODJpHWHaI=", + "integrity": "sha512-KehRjE83B1VaAbRRkRy6jLX1Cin8ltsrQ7FHf2bhwhRHK0S54YuA6LOoBnY/NtA8bHDX/Z+G5sMY78X30NS9tg==", "dev": true, "requires": { "@lerna/command": "3.21.0", @@ -6551,7 +6551,7 @@ "@lerna/listable": { "version": "3.18.5", "resolved": "https://registry.npmjs.org/@lerna/listable/-/listable-3.18.5.tgz", - "integrity": "sha1-6CeYQFte2PxRhDyO8eeg5Jc4iho=", + "integrity": "sha512-Sdr3pVyaEv5A7ZkGGYR7zN+tTl2iDcinryBPvtuv20VJrXBE8wYcOks1edBTcOWsPjCE/rMP4bo1pseyk3UTsg==", "dev": true, "requires": { "@lerna/query-graph": "3.18.5", @@ -6562,7 +6562,7 @@ "@lerna/log-packed": { "version": "3.16.0", "resolved": "https://registry.npmjs.org/@lerna/log-packed/-/log-packed-3.16.0.tgz", - "integrity": "sha1-+DmRBB7neySVY04URwtCJZ/SvBY=", + "integrity": "sha512-Fp+McSNBV/P2mnLUYTaSlG8GSmpXM7krKWcllqElGxvAqv6chk2K3c2k80MeVB4WvJ9tRjUUf+i7HUTiQ9/ckQ==", "dev": true, "requires": { "byte-size": "^5.0.1", @@ -6574,7 +6574,7 @@ "@lerna/npm-conf": { "version": "3.16.0", "resolved": "https://registry.npmjs.org/@lerna/npm-conf/-/npm-conf-3.16.0.tgz", - "integrity": "sha1-HBComuL2wu6WliVXc4aFMA03aCc=", + "integrity": "sha512-HbO3DUrTkCAn2iQ9+FF/eisDpWY5POQAOF1m7q//CZjdC2HSW3UYbKEGsSisFxSfaF9Z4jtrV+F/wX6qWs3CuA==", "dev": true, "requires": { "config-chain": "^1.1.11", @@ -6584,7 +6584,7 @@ "@lerna/npm-dist-tag": { "version": "3.18.5", "resolved": "https://registry.npmjs.org/@lerna/npm-dist-tag/-/npm-dist-tag-3.18.5.tgz", - "integrity": "sha1-nvmrt8EEB3sx9vqyLMc7MU1UrFU=", + "integrity": "sha512-xw0HDoIG6HreVsJND9/dGls1c+lf6vhu7yJoo56Sz5bvncTloYGLUppIfDHQr4ZvmPCK8rsh0euCVh2giPxzKQ==", "dev": true, "requires": { "@evocateur/npm-registry-fetch": "^4.0.0", @@ -6597,7 +6597,7 @@ "npm-package-arg": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-6.1.1.tgz", - "integrity": "sha1-AhaMsKSaK3W/mIooaY3ntSnfXLc=", + "integrity": "sha512-qBpssaL3IOZWi5vEKUKW0cO7kzLeT+EQO9W8RsLOZf76KF9E/K9+wH0C7t06HXPpaH8WH5xF1MExLuCwbTqRUg==", "dev": true, "requires": { "hosted-git-info": "^2.7.1", @@ -6609,7 +6609,7 @@ "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha1-qVT5Ma66UI0we78Gnv8MAclhFvc=", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true } } @@ -6617,7 +6617,7 @@ "@lerna/npm-install": { "version": "3.16.5", "resolved": "https://registry.npmjs.org/@lerna/npm-install/-/npm-install-3.16.5.tgz", - "integrity": "sha1-1r/cFvgShdpmUVrkeSTW4njWN9M=", + "integrity": "sha512-hfiKk8Eku6rB9uApqsalHHTHY+mOrrHeWEs+gtg7+meQZMTS3kzv4oVp5cBZigndQr3knTLjwthT/FX4KvseFg==", "dev": true, "requires": { "@lerna/child-process": "3.16.5", @@ -6652,7 +6652,7 @@ "npm-package-arg": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-6.1.1.tgz", - "integrity": "sha1-AhaMsKSaK3W/mIooaY3ntSnfXLc=", + "integrity": "sha512-qBpssaL3IOZWi5vEKUKW0cO7kzLeT+EQO9W8RsLOZf76KF9E/K9+wH0C7t06HXPpaH8WH5xF1MExLuCwbTqRUg==", "dev": true, "requires": { "hosted-git-info": "^2.7.1", @@ -6664,7 +6664,7 @@ "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha1-qVT5Ma66UI0we78Gnv8MAclhFvc=", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true } } @@ -6672,7 +6672,7 @@ "@lerna/npm-publish": { "version": "3.18.5", "resolved": "https://registry.npmjs.org/@lerna/npm-publish/-/npm-publish-3.18.5.tgz", - "integrity": "sha1-JA5AOZWf2YFrScWwdCHhG1ywAK8=", + "integrity": "sha512-3etLT9+2L8JAx5F8uf7qp6iAtOLSMj+ZYWY6oUgozPi/uLqU0/gsMsEXh3F0+YVW33q0M61RpduBoAlOOZnaTg==", "dev": true, "requires": { "@evocateur/libnpmpublish": "^1.2.2", @@ -6709,7 +6709,7 @@ "npm-package-arg": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-6.1.1.tgz", - "integrity": "sha1-AhaMsKSaK3W/mIooaY3ntSnfXLc=", + "integrity": "sha512-qBpssaL3IOZWi5vEKUKW0cO7kzLeT+EQO9W8RsLOZf76KF9E/K9+wH0C7t06HXPpaH8WH5xF1MExLuCwbTqRUg==", "dev": true, "requires": { "hosted-git-info": "^2.7.1", @@ -6721,7 +6721,7 @@ "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha1-qVT5Ma66UI0we78Gnv8MAclhFvc=", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true } } @@ -6729,7 +6729,7 @@ "@lerna/npm-run-script": { "version": "3.16.5", "resolved": "https://registry.npmjs.org/@lerna/npm-run-script/-/npm-run-script-3.16.5.tgz", - "integrity": "sha1-nC7IJFOibAtG7cC7fBWBbIIfXBU=", + "integrity": "sha512-1asRi+LjmVn3pMjEdpqKJZFT/3ZNpb+VVeJMwrJaV/3DivdNg7XlPK9LTrORuKU4PSvhdEZvJmSlxCKyDpiXsQ==", "dev": true, "requires": { "@lerna/child-process": "3.16.5", @@ -6740,7 +6740,7 @@ "@lerna/otplease": { "version": "3.18.5", "resolved": "https://registry.npmjs.org/@lerna/otplease/-/otplease-3.18.5.tgz", - "integrity": "sha1-t3uOdgtAq62fdljZiPPqd9T9AjE=", + "integrity": "sha512-S+SldXAbcXTEDhzdxYLU0ZBKuYyURP/ND2/dK6IpKgLxQYh/z4ScljPDMyKymmEvgiEJmBsPZAAPfmNPEzxjog==", "dev": true, "requires": { "@lerna/prompt": "3.18.5", @@ -6750,7 +6750,7 @@ "@lerna/output": { "version": "3.13.0", "resolved": "https://registry.npmjs.org/@lerna/output/-/output-3.13.0.tgz", - "integrity": "sha1-Pe18yQiyephyIopjDZUK7a56SYk=", + "integrity": "sha512-7ZnQ9nvUDu/WD+bNsypmPG5MwZBwu86iRoiW6C1WBuXXDxM5cnIAC1m2WxHeFnjyMrYlRXM9PzOQ9VDD+C15Rg==", "dev": true, "requires": { "npmlog": "^4.1.2" @@ -6759,7 +6759,7 @@ "@lerna/pack-directory": { "version": "3.16.4", "resolved": "https://registry.npmjs.org/@lerna/pack-directory/-/pack-directory-3.16.4.tgz", - "integrity": "sha1-Pq5fkb31rP4DhFEO1T+t3EwHRpM=", + "integrity": "sha512-uxSF0HZeGyKaaVHz5FroDY9A5NDDiCibrbYR6+khmrhZtY0Bgn6hWq8Gswl9iIlymA+VzCbshWIMX4o2O8C8ng==", "dev": true, "requires": { "@lerna/get-packed": "3.16.0", @@ -6775,7 +6775,7 @@ "npm-packlist": { "version": "1.4.8", "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.4.8.tgz", - "integrity": "sha1-Vu5swTW5+YrT1Rwcldoiu7my7z4=", + "integrity": "sha512-5+AZgwru5IevF5ZdnFglB5wNlHG1AOOuw28WhUq8/8emhBmLv6jX5by4WJCh7lW0uSYZYS6DXqIsyZVIXRZU9A==", "dev": true, "requires": { "ignore-walk": "^3.0.1", @@ -6788,7 +6788,7 @@ "@lerna/package": { "version": "3.16.0", "resolved": "https://registry.npmjs.org/@lerna/package/-/package-3.16.0.tgz", - "integrity": "sha1-fgpG5Gl+2LipwU1Zx/iQ4NOLoTw=", + "integrity": "sha512-2lHBWpaxcBoiNVbtyLtPUuTYEaB/Z+eEqRS9duxpZs6D+mTTZMNy6/5vpEVSCBmzvdYpyqhqaYjjSLvjjr5Riw==", "dev": true, "requires": { "load-json-file": "^5.3.0", @@ -6799,7 +6799,7 @@ "load-json-file": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-5.3.0.tgz", - "integrity": "sha1-TTweAfocA+p4pgrHr5MsnOU0A/M=", + "integrity": "sha512-cJGP40Jc/VXUsp8/OrnyKyTZ1y6v/dphm3bioS+RrKXjK2BB6wHUd6JptZEFDGgGahMT+InnZO5i1Ei9mpC8Bw==", "dev": true, "requires": { "graceful-fs": "^4.1.15", @@ -6812,7 +6812,7 @@ "npm-package-arg": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-6.1.1.tgz", - "integrity": "sha1-AhaMsKSaK3W/mIooaY3ntSnfXLc=", + "integrity": "sha512-qBpssaL3IOZWi5vEKUKW0cO7kzLeT+EQO9W8RsLOZf76KF9E/K9+wH0C7t06HXPpaH8WH5xF1MExLuCwbTqRUg==", "dev": true, "requires": { "hosted-git-info": "^2.7.1", @@ -6824,13 +6824,13 @@ "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha1-qVT5Ma66UI0we78Gnv8MAclhFvc=", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true }, "type-fest": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.3.1.tgz", - "integrity": "sha1-Y9ANIE4FlHT+Xht8ARESu9HcKeE=", + "integrity": "sha512-cUGJnCdr4STbePCgqNFbpVNCepa+kAVohJs1sLhxzdH+gnEoOd8VhbYa7pD3zZYGiURWM2xzEII3fQcRizDkYQ==", "dev": true } } @@ -6838,7 +6838,7 @@ "@lerna/package-graph": { "version": "3.18.5", "resolved": "https://registry.npmjs.org/@lerna/package-graph/-/package-graph-3.18.5.tgz", - "integrity": "sha1-x0Di6jV40FnlUWM+lQaQgxuUH2s=", + "integrity": "sha512-8QDrR9T+dBegjeLr+n9WZTVxUYUhIUjUgZ0gvNxUBN8S1WB9r6H5Yk56/MVaB64tA3oGAN9IIxX6w0WvTfFudA==", "dev": true, "requires": { "@lerna/prerelease-id-from-version": "3.16.0", @@ -6851,7 +6851,7 @@ "npm-package-arg": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-6.1.1.tgz", - "integrity": "sha1-AhaMsKSaK3W/mIooaY3ntSnfXLc=", + "integrity": "sha512-qBpssaL3IOZWi5vEKUKW0cO7kzLeT+EQO9W8RsLOZf76KF9E/K9+wH0C7t06HXPpaH8WH5xF1MExLuCwbTqRUg==", "dev": true, "requires": { "hosted-git-info": "^2.7.1", @@ -6863,7 +6863,7 @@ "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha1-qVT5Ma66UI0we78Gnv8MAclhFvc=", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true } } @@ -6873,7 +6873,7 @@ "@lerna/prerelease-id-from-version": { "version": "3.16.0", "resolved": "https://registry.npmjs.org/@lerna/prerelease-id-from-version/-/prerelease-id-from-version-3.16.0.tgz", - "integrity": "sha1-skv6eJ9eG6q5FNewi6rpt719g6E=", + "integrity": "sha512-qZyeUyrE59uOK8rKdGn7jQz+9uOpAaF/3hbslJVFL1NqF9ELDTqjCPXivuejMX/lN4OgD6BugTO4cR7UTq/sZA==", "dev": true, "requires": { "semver": "^6.2.0" @@ -6882,7 +6882,7 @@ "@lerna/profiler": { "version": "3.20.0", "resolved": "https://registry.npmjs.org/@lerna/profiler/-/profiler-3.20.0.tgz", - "integrity": "sha1-D23CNvTqj56l81jGcDMFpPMq0FE=", + "integrity": "sha512-bh8hKxAlm6yu8WEOvbLENm42i2v9SsR4WbrCWSbsmOElx3foRnMlYk7NkGECa+U5c3K4C6GeBbwgqs54PP7Ljg==", "dev": true, "requires": { "figgy-pudding": "^3.5.1", @@ -6916,7 +6916,7 @@ "@lerna/project": { "version": "3.21.0", "resolved": "https://registry.npmjs.org/@lerna/project/-/project-3.21.0.tgz", - "integrity": "sha1-XXhNLRDFYaAPIDILzbBAmXwQUC0=", + "integrity": "sha512-xT1mrpET2BF11CY32uypV2GPtPVm6Hgtha7D81GQP9iAitk9EccrdNjYGt5UBYASl4CIDXBRxwmTTVGfrCx82A==", "dev": true, "requires": { "@lerna/package": "3.16.0", @@ -6936,7 +6936,7 @@ "@nodelib/fs.stat": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz", - "integrity": "sha1-K1o6s/kYzKSKjHVMCBaOPwPrphs=", + "integrity": "sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==", "dev": true }, "array-union": { @@ -6951,7 +6951,7 @@ "cosmiconfig": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-5.2.1.tgz", - "integrity": "sha1-BA9yaAnFked6F8CjYmykW08Wixo=", + "integrity": "sha512-H65gsXo1SKjf8zmrJ67eJk8aIRKV5ff2D4uKZIBZShbhGSpEmsQOPW/SKMKYhSTrqR7ufy6RP69rPogdaPh/kA==", "dev": true, "requires": { "import-fresh": "^2.0.0", @@ -6972,7 +6972,7 @@ "fast-glob": { "version": "2.2.7", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-2.2.7.tgz", - "integrity": "sha1-aVOFfDr6R1//ku5gFdUtpwpM050=", + "integrity": "sha512-g1KuQwHOZAmOZMuBtHdxDtju+T2RT8jgCC9aANsbpdiDDTSnjgfuVsIBNKbUeJI3oKMRExcfNDtJl4OhbffMsw==", "dev": true, "requires": { "@mrmlnc/readdir-enhanced": "^2.2.1", @@ -7018,7 +7018,7 @@ "globby": { "version": "9.2.0", "resolved": "https://registry.npmjs.org/globby/-/globby-9.2.0.tgz", - "integrity": "sha1-/QKacGxwPSm90XD0tts6P3p8tj0=", + "integrity": "sha512-ollPHROa5mcxDEkwg6bPt3QbEf4pDQSNtd6JPL1YvOvAo/7/0VAm9TccUeoTmarjPw4pfUthSCqcyfNB1I3ZSg==", "dev": true, "requires": { "@types/glob": "^7.1.1", @@ -7034,7 +7034,7 @@ "ignore": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha1-dQ49tYYgh7RzfrrIIH/9HvJ7Jfw=", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", "dev": true }, "import-fresh": { @@ -7058,7 +7058,7 @@ "load-json-file": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-5.3.0.tgz", - "integrity": "sha1-TTweAfocA+p4pgrHr5MsnOU0A/M=", + "integrity": "sha512-cJGP40Jc/VXUsp8/OrnyKyTZ1y6v/dphm3bioS+RrKXjK2BB6wHUd6JptZEFDGgGahMT+InnZO5i1Ei9mpC8Bw==", "dev": true, "requires": { "graceful-fs": "^4.1.15", @@ -7077,13 +7077,13 @@ "slash": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", - "integrity": "sha1-3lUoUaF1nfOo8gZTVEL17E3eq0Q=", + "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", "dev": true }, "type-fest": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.3.1.tgz", - "integrity": "sha1-Y9ANIE4FlHT+Xht8ARESu9HcKeE=", + "integrity": "sha512-cUGJnCdr4STbePCgqNFbpVNCepa+kAVohJs1sLhxzdH+gnEoOd8VhbYa7pD3zZYGiURWM2xzEII3fQcRizDkYQ==", "dev": true } } @@ -7091,7 +7091,7 @@ "@lerna/prompt": { "version": "3.18.5", "resolved": "https://registry.npmjs.org/@lerna/prompt/-/prompt-3.18.5.tgz", - "integrity": "sha1-YozVRfIliH0GBJGrld+JnPxSGKE=", + "integrity": "sha512-rkKj4nm1twSbBEb69+Em/2jAERK8htUuV8/xSjN0NPC+6UjzAwY52/x9n5cfmpa9lyKf/uItp7chCI7eDmNTKQ==", "dev": true, "requires": { "inquirer": "^6.2.0", @@ -7214,7 +7214,7 @@ "@lerna/publish": { "version": "3.22.1", "resolved": "https://registry.npmjs.org/@lerna/publish/-/publish-3.22.1.tgz", - "integrity": "sha1-tPfOP7oemvsovkofPYgiImm6lRk=", + "integrity": "sha512-PG9CM9HUYDreb1FbJwFg90TCBQooGjj+n/pb3gw/eH5mEDq0p8wKdLFe0qkiqUkm/Ub5C8DbVFertIo0Vd0zcw==", "dev": true, "requires": { "@evocateur/libnpmaccess": "^3.1.2", @@ -7272,7 +7272,7 @@ "npm-package-arg": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-6.1.1.tgz", - "integrity": "sha1-AhaMsKSaK3W/mIooaY3ntSnfXLc=", + "integrity": "sha512-qBpssaL3IOZWi5vEKUKW0cO7kzLeT+EQO9W8RsLOZf76KF9E/K9+wH0C7t06HXPpaH8WH5xF1MExLuCwbTqRUg==", "dev": true, "requires": { "hosted-git-info": "^2.7.1", @@ -7284,7 +7284,7 @@ "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha1-qVT5Ma66UI0we78Gnv8MAclhFvc=", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true } } @@ -7300,7 +7300,7 @@ "@lerna/pulse-till-done": { "version": "3.13.0", "resolved": "https://registry.npmjs.org/@lerna/pulse-till-done/-/pulse-till-done-3.13.0.tgz", - "integrity": "sha1-yOnOW6+vENkwpn1+0My12Vj+ARA=", + "integrity": "sha512-1SOHpy7ZNTPulzIbargrgaJX387csN7cF1cLOGZiJQA6VqnS5eWs2CIrG8i8wmaUavj2QlQ5oEbRMVVXSsGrzA==", "dev": true, "requires": { "npmlog": "^4.1.2" @@ -7309,7 +7309,7 @@ "@lerna/query-graph": { "version": "3.18.5", "resolved": "https://registry.npmjs.org/@lerna/query-graph/-/query-graph-3.18.5.tgz", - "integrity": "sha1-30gwu1FVJzADvzXo3aHDLQknvYY=", + "integrity": "sha512-50Lf4uuMpMWvJ306be3oQDHrWV42nai9gbIVByPBYJuVW8dT8O8pA3EzitNYBUdLL9/qEVbrR0ry1HD7EXwtRA==", "dev": true, "requires": { "@lerna/package-graph": "3.18.5", @@ -7319,7 +7319,7 @@ "@lerna/resolve-symlink": { "version": "3.16.0", "resolved": "https://registry.npmjs.org/@lerna/resolve-symlink/-/resolve-symlink-3.16.0.tgz", - "integrity": "sha1-N/xwlfq9vPMXwm63Tg0L3o79I4Y=", + "integrity": "sha512-Ibj5e7njVHNJ/NOqT4HlEgPFPtPLWsO7iu59AM5bJDcAJcR96mLZ7KGVIsS2tvaO7akMEJvt2P+ErwCdloG3jQ==", "dev": true, "requires": { "fs-extra": "^8.1.0", @@ -7352,7 +7352,7 @@ "@lerna/rimraf-dir": { "version": "3.16.5", "resolved": "https://registry.npmjs.org/@lerna/rimraf-dir/-/rimraf-dir-3.16.5.tgz", - "integrity": "sha1-BDFqtf/SkJZXqvOI6lAsuMLyCgk=", + "integrity": "sha512-bQlKmO0pXUsXoF8lOLknhyQjOZsCc0bosQDoX4lujBXSWxHVTg1VxURtWf2lUjz/ACsJVDfvHZbDm8kyBk5okA==", "dev": true, "requires": { "@lerna/child-process": "3.16.5", @@ -7364,7 +7364,7 @@ "@lerna/run": { "version": "3.21.0", "resolved": "https://registry.npmjs.org/@lerna/run/-/run-3.21.0.tgz", - "integrity": "sha1-KjXshJeeTW5CR0/hSNMuXeHKyJE=", + "integrity": "sha512-fJF68rT3veh+hkToFsBmUJ9MHc9yGXA7LSDvhziAojzOb0AI/jBDp6cEcDQyJ7dbnplba2Lj02IH61QUf9oW0Q==", "dev": true, "requires": { "@lerna/command": "3.21.0", @@ -7389,7 +7389,7 @@ "@lerna/run-lifecycle": { "version": "3.16.2", "resolved": "https://registry.npmjs.org/@lerna/run-lifecycle/-/run-lifecycle-3.16.2.tgz", - "integrity": "sha1-Z7KI+OqWTbnqT7H7x3FdW7sLzgA=", + "integrity": "sha512-RqFoznE8rDpyyF0rOJy3+KjZCeTkO8y/OB9orPauR7G2xQ7PTdCpgo7EO6ZNdz3Al+k1BydClZz/j78gNCmL2A==", "dev": true, "requires": { "@lerna/npm-conf": "3.16.0", @@ -7401,7 +7401,7 @@ "@lerna/run-topologically": { "version": "3.18.5", "resolved": "https://registry.npmjs.org/@lerna/run-topologically/-/run-topologically-3.18.5.tgz", - "integrity": "sha1-PNY52iDpZ9dnLLiNsPdWuS8v38M=", + "integrity": "sha512-6N1I+6wf4hLOnPW+XDZqwufyIQ6gqoPfHZFkfWlvTQ+Ue7CuF8qIVQ1Eddw5HKQMkxqN10thKOFfq/9NQZ4NUg==", "dev": true, "requires": { "@lerna/query-graph": "3.18.5", @@ -7412,13 +7412,13 @@ "eventemitter3": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.2.tgz", - "integrity": "sha1-LT1I+cNGaY/Og6hdfWZOmFNd9uc=", + "integrity": "sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q==", "dev": true }, "p-queue": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-4.0.0.tgz", - "integrity": "sha1-7Q7uh5iSftbywvX1t3/bIGGl00Y=", + "integrity": "sha512-3cRXXn3/O0o3+eVmUroJPSj/esxoEFIm0ZOno/T+NzG/VZgPOqQ8WKmlNqubSEpZmCIngEy34unkHGg83ZIBmg==", "dev": true, "requires": { "eventemitter3": "^3.1.0" @@ -7429,7 +7429,7 @@ "@lerna/symlink-binary": { "version": "3.17.0", "resolved": "https://registry.npmjs.org/@lerna/symlink-binary/-/symlink-binary-3.17.0.tgz", - "integrity": "sha1-j4AxswmGOBSIPT8AmHf4Ljiu9Fo=", + "integrity": "sha512-RLpy9UY6+3nT5J+5jkM5MZyMmjNHxZIZvXLV+Q3MXrf7Eaa1hNqyynyj4RO95fxbS+EZc4XVSk25DGFQbcRNSQ==", "dev": true, "requires": { "@lerna/create-symlink": "3.16.2", @@ -7469,7 +7469,7 @@ "@lerna/symlink-dependencies": { "version": "3.17.0", "resolved": "https://registry.npmjs.org/@lerna/symlink-dependencies/-/symlink-dependencies-3.17.0.tgz", - "integrity": "sha1-SNY2DphYZaDlbNi1GzCKUmMIeEo=", + "integrity": "sha512-KmjU5YT1bpt6coOmdFueTJ7DFJL4H1w5eF8yAQ2zsGNTtZ+i5SGFBWpb9AQaw168dydc3s4eu0W0Sirda+F59Q==", "dev": true, "requires": { "@lerna/create-symlink": "3.16.2", @@ -7512,13 +7512,13 @@ "@lerna/timer": { "version": "3.13.0", "resolved": "https://registry.npmjs.org/@lerna/timer/-/timer-3.13.0.tgz", - "integrity": "sha1-vNCQRVHbFuCDZNbBjl4hYPyHB4E=", + "integrity": "sha512-RHWrDl8U4XNPqY5MQHkToWS9jHPnkLZEt5VD+uunCKTfzlxGnRCr3/zVr8VGy/uENMYpVP3wJa4RKGY6M0vkRw==", "dev": true }, "@lerna/validation-error": { "version": "3.13.0", "resolved": "https://registry.npmjs.org/@lerna/validation-error/-/validation-error-3.13.0.tgz", - "integrity": "sha1-yGuPB8WrlTn3db2KVJdukm83WcM=", + "integrity": "sha512-SiJP75nwB8GhgwLKQfdkSnDufAaCbkZWJqEDlKOUPUvVOplRGnfL+BPQZH5nvq2BYSRXsksXWZ4UHVnQZI/HYA==", "dev": true, "requires": { "npmlog": "^4.1.2" @@ -7527,7 +7527,7 @@ "@lerna/version": { "version": "3.22.1", "resolved": "https://registry.npmjs.org/@lerna/version/-/version-3.22.1.tgz", - "integrity": "sha1-mAWpJHpH7mLWuBvZ+l+3KLJLWeI=", + "integrity": "sha512-PSGt/K1hVqreAFoi3zjD0VEDupQ2WZVlVIwesrE5GbrL2BjXowjCsTDPqblahDUPy0hp6h7E2kG855yLTp62+g==", "dev": true, "requires": { "@lerna/check-working-tree": "3.16.5", @@ -7561,7 +7561,7 @@ "load-json-file": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-5.3.0.tgz", - "integrity": "sha1-TTweAfocA+p4pgrHr5MsnOU0A/M=", + "integrity": "sha512-cJGP40Jc/VXUsp8/OrnyKyTZ1y6v/dphm3bioS+RrKXjK2BB6wHUd6JptZEFDGgGahMT+InnZO5i1Ei9mpC8Bw==", "dev": true, "requires": { "graceful-fs": "^4.1.15", @@ -7580,13 +7580,13 @@ "slash": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", - "integrity": "sha1-3lUoUaF1nfOo8gZTVEL17E3eq0Q=", + "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", "dev": true }, "type-fest": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.3.1.tgz", - "integrity": "sha1-Y9ANIE4FlHT+Xht8ARESu9HcKeE=", + "integrity": "sha512-cUGJnCdr4STbePCgqNFbpVNCepa+kAVohJs1sLhxzdH+gnEoOd8VhbYa7pD3zZYGiURWM2xzEII3fQcRizDkYQ==", "dev": true } } @@ -7594,7 +7594,7 @@ "@lerna/write-log-file": { "version": "3.13.0", "resolved": "https://registry.npmjs.org/@lerna/write-log-file/-/write-log-file-3.13.0.tgz", - "integrity": "sha1-t42eTPwTSai+ZNkTJMTIGZ6CKiY=", + "integrity": "sha512-RibeMnDPvlL8bFYW5C8cs4mbI3AHfQef73tnJCQ/SgrXZHehmHnsyWUiE7qDQCAo+B1RfTapvSyFF69iPj326A==", "dev": true, "requires": { "npmlog": "^4.1.2", @@ -7604,7 +7604,7 @@ "write-file-atomic": { "version": "2.4.3", "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.4.3.tgz", - "integrity": "sha1-H9Lprh3z51uNjDZ0Q8aS1MqB9IE=", + "integrity": "sha512-GaETH5wwsX+GcnzhPgKcKjJ6M2Cq3/iZp1WyY/X1CSqrW+jVNM9Y7D8EC2sM4ZG/V8wZlSniJnCKWPmBYAucRQ==", "dev": true, "requires": { "graceful-fs": "^4.1.11", @@ -7634,7 +7634,7 @@ "@mrmlnc/readdir-enhanced": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz", - "integrity": "sha1-UkryQNGjYFJ7cwR17PoTRKpUDd4=", + "integrity": "sha512-bPHp6Ji8b41szTOcaP63VlnbbO5Ny6dwAATtY6JTjh5N2OLrb5Qk/Th5cRkRQhkWCt+EJsYrNB0MiL+Gpn6e3g==", "dev": true, "requires": { "call-me-maybe": "^1.0.1", @@ -9610,13 +9610,13 @@ "@octokit/plugin-enterprise-rest": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/@octokit/plugin-enterprise-rest/-/plugin-enterprise-rest-6.0.1.tgz", - "integrity": "sha1-4HiWc5YY2rjafUB3xlgAN3X5VDc=", + "integrity": "sha512-93uGjlhUD+iNg1iWhUENAtJata6w5nE+V4urXOAlIXdco6xNZtUSfYY8dzp3Udy74aqO/B5UZL80x/YMa5PKRw==", "dev": true }, "@octokit/plugin-paginate-rest": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-1.1.2.tgz", - "integrity": "sha1-AEFwrPjCvlNauiZyeGfWkve0iPw=", + "integrity": "sha512-jbsSoi5Q1pj63sC16XIUboklNw+8tL9VOnJsWycWYR78TKss5PVpIPb1TUUcMQ+bBh7cY579cVAWmf5qG+dw+Q==", "dev": true, "requires": { "@octokit/types": "^2.0.1" @@ -9625,7 +9625,7 @@ "@octokit/types": { "version": "2.16.2", "resolved": "https://registry.npmjs.org/@octokit/types/-/types-2.16.2.tgz", - "integrity": "sha1-TF+No8b+zz2hgRrvZ4/aA+2sNdI=", + "integrity": "sha512-O75k56TYvJ8WpAakWwYRN8Bgu60KrmX0z1KqFp1kNiFNkgW+JW+9EBKZ+S33PU6SLvbihqd+3drvPxKK68Ee8Q==", "dev": true, "requires": { "@types/node": ">= 8" @@ -9642,7 +9642,7 @@ "@octokit/plugin-rest-endpoint-methods": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-2.4.0.tgz", - "integrity": "sha1-Mojs9UgfaMSU3QYC/BVAeln69h4=", + "integrity": "sha512-EZi/AWhtkdfAYi01obpX0DF7U6b1VRr30QNQ5xSFPITMdLSfhcBqjamE3F+sKcxPbD7eZuMHu3Qkk2V+JGxBDQ==", "dev": true, "requires": { "@octokit/types": "^2.0.1", @@ -9652,7 +9652,7 @@ "@octokit/types": { "version": "2.16.2", "resolved": "https://registry.npmjs.org/@octokit/types/-/types-2.16.2.tgz", - "integrity": "sha1-TF+No8b+zz2hgRrvZ4/aA+2sNdI=", + "integrity": "sha512-O75k56TYvJ8WpAakWwYRN8Bgu60KrmX0z1KqFp1kNiFNkgW+JW+9EBKZ+S33PU6SLvbihqd+3drvPxKK68Ee8Q==", "dev": true, "requires": { "@types/node": ">= 8" @@ -9702,7 +9702,7 @@ "@octokit/request-error": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-1.2.1.tgz", - "integrity": "sha1-7eBxTHc/MjR1dsJWSdwBOuazGAE=", + "integrity": "sha512-+6yDyk1EES6WK+l3viRDElw96MvwfJxCt45GvmjDUKWjYIb3PJZQkq3i46TwGwoPD4h8NmTrENmtyA1FwbmhRA==", "dev": true, "requires": { "@octokit/types": "^2.0.0", @@ -9713,7 +9713,7 @@ "@octokit/types": { "version": "2.16.2", "resolved": "https://registry.npmjs.org/@octokit/types/-/types-2.16.2.tgz", - "integrity": "sha1-TF+No8b+zz2hgRrvZ4/aA+2sNdI=", + "integrity": "sha512-O75k56TYvJ8WpAakWwYRN8Bgu60KrmX0z1KqFp1kNiFNkgW+JW+9EBKZ+S33PU6SLvbihqd+3drvPxKK68Ee8Q==", "dev": true, "requires": { "@types/node": ">= 8" @@ -9724,7 +9724,7 @@ "@octokit/rest": { "version": "16.43.2", "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-16.43.2.tgz", - "integrity": "sha1-xTQm8eHRBE3ulnAj4yecUJk92Rs=", + "integrity": "sha512-ngDBevLbBTFfrHZeiS7SAMAZ6ssuVmXuya+F/7RaVvlysgGa1JKJkKWY+jV6TCJYcW0OALfJ7nTIGXcBXzycfQ==", "dev": true, "requires": { "@octokit/auth-token": "^2.4.0", @@ -9867,7 +9867,7 @@ "@restart/context": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/@restart/context/-/context-2.1.4.tgz", - "integrity": "sha1-qZ2HwpmjTCi9hbtInLB7/SMUnAI=" + "integrity": "sha512-INJYZQJP7g+IoDUh/475NlGiTeMfwTXUEr3tmRneckHIxNolGOW9CTq83S8cxq0CgJwwcMzMJFchxvlwe7Rk8Q==" }, "@restart/hooks": { "version": "0.3.27", @@ -11321,7 +11321,7 @@ "@zkochan/cmd-shim": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/@zkochan/cmd-shim/-/cmd-shim-3.1.0.tgz", - "integrity": "sha1-KrjtgfW7VFKoXyV1jrm4aBmC/S4=", + "integrity": "sha512-o8l0+x7C7sMZU3v9GuJIAU10qQLtwR1dtRQIOmlNMtyaqhmpXOzx1HWiYoWfmmf9HHZoAkXpc9TM9PQYF9d4Jg==", "dev": true, "requires": { "is-windows": "^1.0.0", @@ -11775,7 +11775,7 @@ "array-differ": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-2.1.0.tgz", - "integrity": "sha1-S5wcPxS5BnVwgpJXaeirkE9IAbE=", + "integrity": "sha512-KbUpJgx909ZscOc/7CLATBFam7P1Z1QRQInvgT0UztM9Q72aGKCunKASAl7WNW0tnPmPyEMeMhdsfWhfmW037w==", "dev": true }, "array-each": { @@ -12376,7 +12376,7 @@ "babel-jest": { "version": "25.1.0", "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-25.1.0.tgz", - "integrity": "sha1-IGCTrDgKS3jEQEoFsydzkSePgPs=", + "integrity": "sha512-tz0VxUhhOE2y+g8R2oFrO/2VtVjA1lkJeavlhExuRBg3LdNJY9gwQ+Vcvqt9+cqy71MCTJhewvTB7Qtnnr9SWg==", "dev": true, "requires": { "@jest/transform": "^25.1.0", @@ -12422,7 +12422,7 @@ "chalk": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha1-P3PCv1JlkfV0zEksUeJFY0n4ROQ=", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", "dev": true, "requires": { "ansi-styles": "^4.1.0", @@ -12432,7 +12432,7 @@ "color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha1-ctOmjVmMm9s68q0ehPIdiWq9TeM=", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, "requires": { "color-name": "~1.1.4" @@ -12441,19 +12441,19 @@ "color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha1-wqCah6y95pVD3m9j+jmVyCbFNqI=", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha1-lEdx/ZyByBJlxNaUGGDaBrtZR5s=", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, "supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha1-G33NyzK4E4gBs+R4umpRyqiWSNo=", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, "requires": { "has-flag": "^4.0.0" @@ -14448,7 +14448,7 @@ "byte-size": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/byte-size/-/byte-size-5.0.1.tgz", - "integrity": "sha1-S2UQOaXs2Wdn5xo9ftOA5IvtQZE=", + "integrity": "sha512-/XuKeqWocKsYa/cBY1YbSJSWWqTi4cFgr9S6OyM7PBaPbr9zvNGwWP33vt0uqGhwDdN+y3yhbXVILEUpnwEWGw==", "dev": true }, "bytes": { @@ -14683,7 +14683,7 @@ "camelcase-keys": { "version": "6.2.2", "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-6.2.2.tgz", - "integrity": "sha1-XnVda6UaoiPsfT1S8ld4IQ+dw8A=", + "integrity": "sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg==", "dev": true, "requires": { "camelcase": "^5.3.1", @@ -15292,7 +15292,7 @@ "command-exists": { "version": "1.2.9", "resolved": "https://registry.npmjs.org/command-exists/-/command-exists-1.2.9.tgz", - "integrity": "sha1-xQclrzgIyKsCYP1gsB+/oluVT2k=", + "integrity": "sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w==", "dev": true }, "commander": { @@ -15602,7 +15602,7 @@ "conventional-changelog-core": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/conventional-changelog-core/-/conventional-changelog-core-3.2.3.tgz", - "integrity": "sha1-sxQQhW9DHIRwhqfctNLKGEp9iPs=", + "integrity": "sha512-LMMX1JlxPIq/Ez5aYAYS5CpuwbOk6QFp8O4HLAcZxe3vxoCtABkhfjetk8IYdRB9CDQGwJFLR3Dr55Za6XKgUQ==", "dev": true, "requires": { "conventional-changelog-writer": "^4.0.6", @@ -15644,7 +15644,7 @@ "through2": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/through2/-/through2-3.0.2.tgz", - "integrity": "sha1-mfiJMc/HYex2eLQdXXM2tbage/Q=", + "integrity": "sha512-enaDQ4MUyP2W6ZyT6EsMzqBPZaM/avg8iuo+l2d3QCs0J+6RaqkHV/2/lOwDTueBHeJ/2LG9lrLW3d5rWPucuQ==", "dev": true, "requires": { "inherits": "^2.0.4", @@ -15656,7 +15656,7 @@ "conventional-changelog-preset-loader": { "version": "2.3.4", "resolved": "https://registry.npmjs.org/conventional-changelog-preset-loader/-/conventional-changelog-preset-loader-2.3.4.tgz", - "integrity": "sha1-FKhVq7/9WQJ/1gJYHx802YYupEw=", + "integrity": "sha512-GEKRWkrSAZeTq5+YjUZOYxdHq+ci4dNwHvpaBC3+ENalzFWuCWa9EZXSuZBpkr72sMdKB+1fyDV4takK1Lf58g==", "dev": true }, "conventional-changelog-writer": { @@ -15726,7 +15726,7 @@ "conventional-recommended-bump": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/conventional-recommended-bump/-/conventional-recommended-bump-5.0.1.tgz", - "integrity": "sha1-WvY5A5R7bgied3Z2ActZLKuxBro=", + "integrity": "sha512-RVdt0elRcCxL90IrNP0fYCpq1uGt2MALko0eyeQ+zQuDVWtMGAy9ng6yYn3kax42lCj9+XBxQ8ZN6S9bdKxDhQ==", "dev": true, "requires": { "concat-stream": "^2.0.0", @@ -15759,7 +15759,7 @@ "concat-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-2.0.0.tgz", - "integrity": "sha1-QUz1r3kKSMYKub5FJ9VtXkETPLE=", + "integrity": "sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A==", "dev": true, "requires": { "buffer-from": "^1.0.0", @@ -15783,7 +15783,7 @@ "meow": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/meow/-/meow-4.0.1.tgz", - "integrity": "sha1-1IWY9vSxRy81v2MXqVlFrONH+XU=", + "integrity": "sha512-xcSBHD5Z86zaOc+781KrupuHAzeGXSLtiAOmBsiLDiPSaYSB6hdew2ng9EBAnZ62jagG9MHAOdxpDi/lWBFJ/A==", "dev": true, "requires": { "camelcase-keys": "^4.0.0", @@ -15800,7 +15800,7 @@ "minimist-options": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-3.0.2.tgz", - "integrity": "sha1-+6TIGRM54T7PTWG+sD8HAQPz2VQ=", + "integrity": "sha512-FyBrT/d0d4+uiZRbqznPXqw3IpZZG3gl3wKWiX784FycUKVwBt0uLBFkQrtE4tZOrgo78nZp2jnKz3L65T5LdQ==", "dev": true, "requires": { "arrify": "^1.0.1", @@ -16575,7 +16575,7 @@ "dateformat": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz", - "integrity": "sha1-puN0maTZqc+F71hyBE1ikByYia4=", + "integrity": "sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==", "dev": true }, "deasync": { @@ -16945,7 +16945,7 @@ "deprecation": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", - "integrity": "sha1-Y2jL20Cr8zc7UlrIfkomDDpwCRk=", + "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==", "dev": true }, "deps-sort": { @@ -18851,7 +18851,7 @@ "express-ws": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/express-ws/-/express-ws-4.0.0.tgz", - "integrity": "sha1-2r2NyXRRZBiQKkH+bjDtlJtNNsQ=", + "integrity": "sha512-KEyUw8AwRET2iFjFsI1EJQrJ/fHeGiJtgpYgEWG3yDv4l/To/m3a2GaYfeGyB3lsWdvbesjF5XCMx+SVBgAAYw==", "requires": { "ws": "^5.2.0" }, @@ -20827,7 +20827,7 @@ "genfun": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/genfun/-/genfun-5.0.0.tgz", - "integrity": "sha1-ndlxCgaQClxKW/V6yl2k5S/nZTc=", + "integrity": "sha512-KGDOARWVga7+rnB3z9Sd2Letx515owfk0hSxHGuqjANb1M+x2bGZGqHLiozPsYMdM2OubeMni/Hpwmjq6qIUhA==", "dev": true }, "gensync": { @@ -21054,7 +21054,7 @@ "get-port": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/get-port/-/get-port-4.2.0.tgz", - "integrity": "sha1-43Nosehjt2KcQ8WjI2Jflc8ksRk=", + "integrity": "sha512-/b3jarXkH8KJoOMQc3uVGHASwGLPq3gSFJ7tgJm2diza+bydJPTGOibin2steecKeOylE8oY2JERlVWkAJO6yw==", "dev": true }, "get-stdin": { @@ -21147,7 +21147,7 @@ "git-raw-commits": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/git-raw-commits/-/git-raw-commits-2.0.0.tgz", - "integrity": "sha1-2Srd90RAwUvMXIPszj+3+KeRGLU=", + "integrity": "sha512-w4jFEJFgKXMQJ0H0ikBk2S+4KP2VEjhCvLCNqbNRQC8BgGWgLKNCO7a9K9LI+TVT7Gfoloje502sEnctibffgg==", "dev": true, "requires": { "dargs": "^4.0.1", @@ -21189,7 +21189,7 @@ "meow": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/meow/-/meow-4.0.1.tgz", - "integrity": "sha1-1IWY9vSxRy81v2MXqVlFrONH+XU=", + "integrity": "sha512-xcSBHD5Z86zaOc+781KrupuHAzeGXSLtiAOmBsiLDiPSaYSB6hdew2ng9EBAnZ62jagG9MHAOdxpDi/lWBFJ/A==", "dev": true, "requires": { "camelcase-keys": "^4.0.0", @@ -21206,7 +21206,7 @@ "minimist-options": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-3.0.2.tgz", - "integrity": "sha1-+6TIGRM54T7PTWG+sD8HAQPz2VQ=", + "integrity": "sha512-FyBrT/d0d4+uiZRbqznPXqw3IpZZG3gl3wKWiX784FycUKVwBt0uLBFkQrtE4tZOrgo78nZp2jnKz3L65T5LdQ==", "dev": true, "requires": { "arrify": "^1.0.1", @@ -21294,7 +21294,7 @@ "git-semver-tags": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/git-semver-tags/-/git-semver-tags-2.0.3.tgz", - "integrity": "sha1-SJiKcYrPWTgA+ZYiqVKnfEBb+jQ=", + "integrity": "sha512-tj4FD4ww2RX2ae//jSrXZzrocla9db5h0V7ikPl1P/WwoZar9epdUhwR7XHXSgc+ZkNq72BEEerqQuicoEQfzA==", "dev": true, "requires": { "meow": "^4.0.0", @@ -21333,7 +21333,7 @@ "meow": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/meow/-/meow-4.0.1.tgz", - "integrity": "sha1-1IWY9vSxRy81v2MXqVlFrONH+XU=", + "integrity": "sha512-xcSBHD5Z86zaOc+781KrupuHAzeGXSLtiAOmBsiLDiPSaYSB6hdew2ng9EBAnZ62jagG9MHAOdxpDi/lWBFJ/A==", "dev": true, "requires": { "camelcase-keys": "^4.0.0", @@ -21350,7 +21350,7 @@ "minimist-options": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-3.0.2.tgz", - "integrity": "sha1-+6TIGRM54T7PTWG+sD8HAQPz2VQ=", + "integrity": "sha512-FyBrT/d0d4+uiZRbqznPXqw3IpZZG3gl3wKWiX784FycUKVwBt0uLBFkQrtE4tZOrgo78nZp2jnKz3L65T5LdQ==", "dev": true, "requires": { "arrify": "^1.0.1", @@ -22086,7 +22086,7 @@ "hard-rejection": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz", - "integrity": "sha1-HG7aXBaFxjlCdm15u0Cudzzs2IM=", + "integrity": "sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==", "dev": true }, "harmony-reflect": { @@ -22739,7 +22739,7 @@ "init-package-json": { "version": "1.10.3", "resolved": "https://registry.npmjs.org/init-package-json/-/init-package-json-1.10.3.tgz", - "integrity": "sha1-Rf/i9hCoyhNPK9HbVjeyNQcPbL4=", + "integrity": "sha512-zKSiXKhQveNteyhcj1CoOP8tqp1QuxPIPBl8Bid99DGLFqA1p87M6lNgfjJHSBoWJJlidGOv5rWjyYKEB3g2Jw==", "dev": true, "requires": { "glob": "^7.1.1", @@ -22755,7 +22755,7 @@ "npm-package-arg": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-6.1.1.tgz", - "integrity": "sha1-AhaMsKSaK3W/mIooaY3ntSnfXLc=", + "integrity": "sha512-qBpssaL3IOZWi5vEKUKW0cO7kzLeT+EQO9W8RsLOZf76KF9E/K9+wH0C7t06HXPpaH8WH5xF1MExLuCwbTqRUg==", "dev": true, "requires": { "hosted-git-info": "^2.7.1", @@ -22767,7 +22767,7 @@ "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha1-qVT5Ma66UI0we78Gnv8MAclhFvc=", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true } } @@ -29208,7 +29208,7 @@ "lerna": { "version": "3.22.1", "resolved": "https://registry.npmjs.org/lerna/-/lerna-3.22.1.tgz", - "integrity": "sha1-ggJ6w9qcYn/YvwLM/v+AapjmW2I=", + "integrity": "sha512-vk1lfVRFm+UuEFA7wkLKeSF7Iz13W+N/vFd48aW2yuS7Kv0RbNm2/qcDPV863056LMfkRlsEe+QYOw3palj5Lg==", "dev": true, "requires": { "@lerna/add": "3.21.0", @@ -29671,7 +29671,7 @@ "lodash.template": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-4.5.0.tgz", - "integrity": "sha1-+XYZXPPzR9DV9SSDVp/oAxzM6Ks=", + "integrity": "sha512-84vYFxIkmidUiFxidA/KjjH9pAycqW+h980j7Fuz5qxRtO9pgB7MDFTdys1N7A5mcucRiDyEq4fusljItR1T/A==", "dev": true, "requires": { "lodash._reinterpolate": "^3.0.0", @@ -29681,7 +29681,7 @@ "lodash.templatesettings": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-4.2.0.tgz", - "integrity": "sha1-5IExDwSdPPbUfpEq0JMTsVTw+zM=", + "integrity": "sha512-stgLz+i3Aa9mZgnjr/O+v9ruKZsPsndy7qPZOchbqk2cnTU1ZaldKK+v7m54WoKIyxiuMZTKT2H81F8BeAc3ZQ==", "dev": true, "requires": { "lodash._reinterpolate": "^3.0.0" @@ -30366,7 +30366,7 @@ "min-indent": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", - "integrity": "sha1-pj9oFnOzBXH76LwlaGrnRu76mGk=", + "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", "dev": true }, "mini-css-extract-plugin": { @@ -30474,7 +30474,7 @@ "minimist-options": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz", - "integrity": "sha1-wGVXE8U6ii69d/+iR9NCxA8BBhk=", + "integrity": "sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==", "dev": true, "requires": { "arrify": "^1.0.1", @@ -31281,7 +31281,7 @@ "modify-values": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/modify-values/-/modify-values-1.0.1.tgz", - "integrity": "sha1-s5OfpgVUZHTj4+PGPWS9Q7TuYCI=", + "integrity": "sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw==", "dev": true }, "module-deps": { @@ -31628,7 +31628,7 @@ "multimatch": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/multimatch/-/multimatch-3.0.0.tgz", - "integrity": "sha1-DiU0zGvCONmrZ+G5zV/Nhabb9ws=", + "integrity": "sha512-22foS/gqQfANZ3o+W7ST2x25ueHDVNWl/b9OlGcLpy/iKxjCpvcNCM51YCenUi7Mt/jAjjqv8JwZRs8YP5sRjA==", "dev": true, "requires": { "array-differ": "^2.0.3", @@ -31675,7 +31675,7 @@ "mz": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", - "integrity": "sha1-lQCAV6Vsr63CvGPd5/n/aVWUjjI=", + "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", "dev": true, "requires": { "any-promise": "^1.0.0", @@ -32348,7 +32348,7 @@ "node-fetch-npm": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/node-fetch-npm/-/node-fetch-npm-2.0.4.tgz", - "integrity": "sha1-ZQfQ4XqewL477FFpWKSXzsVL9aQ=", + "integrity": "sha512-iOuIQDWDyjhv9qSDrj9aq/klt6F9z1p2otB3AV7v3zBDcL/x+OfGsvGQZZCcMZbUf4Ujw1xGNQkjvGnVT22cKg==", "dev": true, "requires": { "encoding": "^0.1.11", @@ -35386,7 +35386,7 @@ "npm-lifecycle": { "version": "3.1.5", "resolved": "https://registry.npmjs.org/npm-lifecycle/-/npm-lifecycle-3.1.5.tgz", - "integrity": "sha1-mILTZCuMgsgVeCoS5qG/7tACYwk=", + "integrity": "sha512-lDLVkjfZmvmfvpvBzA4vzee9cn+Me4orq0QF8glbswJVEbIcSNWib7qGOffolysc3teCqbbPZZkzbr3GQZTL1g==", "dev": true, "requires": { "byline": "^5.0.0", @@ -35402,7 +35402,7 @@ "node-gyp": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-5.1.1.tgz", - "integrity": "sha1-65Ffe2Mck30oLjOu1Ey3oCX2Kj4=", + "integrity": "sha512-WH0WKGi+a4i4DUt2mHnvocex/xPLp9pYt5R6M2JdFB7pJ7Z34hveZ4nDTGTiLXCkitA9T8HFZjhinBCiVHYcWw==", "dev": true, "requires": { "env-paths": "^2.2.0", @@ -35421,7 +35421,7 @@ "nopt": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.3.tgz", - "integrity": "sha1-o3XK2dAv2SEnjZVMIlTVqlfhXkg=", + "integrity": "sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==", "dev": true, "requires": { "abbrev": "1", @@ -35431,7 +35431,7 @@ "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha1-qVT5Ma66UI0we78Gnv8MAclhFvc=", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true } } @@ -37523,7 +37523,7 @@ "octokit-pagination-methods": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/octokit-pagination-methods/-/octokit-pagination-methods-1.1.0.tgz", - "integrity": "sha1-z0cu3J1VEFX573P25CtNu0yAvqQ=", + "integrity": "sha512-fZ4qZdQ2nxJvtcasX7Ghl+WlWS/d9IgnBIwFZXVNNZUmzpno91SX5bc5vuxiuKoCtK78XxGGNuSCrDC7xYB3OQ==", "dev": true }, "on-finished": { @@ -38029,7 +38029,7 @@ "os-name": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/os-name/-/os-name-3.1.0.tgz", - "integrity": "sha1-3sGdlmKW4c1i1wGlpm7h3ernCAE=", + "integrity": "sha512-h8L+8aNjNcMpo/mAIBPn5PXCM16iyPGjHNWo6U1YO8sJTMHtEtyczI6QJnLoplswm6goopQkqc7OAnjhWcugVg==", "dev": true, "requires": { "macos-release": "^2.2.0", @@ -39670,7 +39670,7 @@ "prop-types-extra": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/prop-types-extra/-/prop-types-extra-1.1.1.tgz", - "integrity": "sha1-WMO3TL+7ldMEYll1qi8ISDKaAQs=", + "integrity": "sha512-59+AHNnHYCdiC+vMwY52WmvP5dM3QLeoumYuEyceQDi9aEhtwN9zIQ2ZNo25sMyXnbh32h+P1ezDsUpUH3JAew==", "requires": { "react-is": "^16.3.2", "warning": "^4.0.0" @@ -39697,7 +39697,7 @@ "protoduck": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/protoduck/-/protoduck-5.0.1.tgz", - "integrity": "sha1-A8NlnKGAB7aaUP2Cp+vMUWJhFR8=", + "integrity": "sha512-WxoCeDCoCBY55BMvj4cAEjdVUFGRWed9ZxPlqTKYyw1nDDTQ4pqmnIMAGfJlg7Dx35uB/M+PHJPTmGOvaCaPTg==", "dev": true, "requires": { "genfun": "^5.0.0" @@ -39909,7 +39909,7 @@ "quick-lru": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz", - "integrity": "sha1-W4h48ROlgheEjGSCAmxz4bpXcn8=", + "integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==", "dev": true }, "raf-schd": { @@ -40092,7 +40092,7 @@ "react-lifecycles-compat": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz", - "integrity": "sha1-TxonOv38jzSIqMUWv9p4+HI1I2I=" + "integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==" }, "react-overlays": { "version": "5.1.1", @@ -40200,7 +40200,7 @@ "read-cmd-shim": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/read-cmd-shim/-/read-cmd-shim-1.0.5.tgz", - "integrity": "sha1-h+Q+ulAJi6WjLQzrWDq45DuWHBY=", + "integrity": "sha512-v5yCqQ/7okKoZZkBQUAfTsQ3sVJtXdNfbPnI5cceppoxEVLYA3k+VtV2omkeo8MS94JCy4fSiUwlRBAwCVRPUA==", "dev": true, "requires": { "graceful-fs": "^4.1.2" @@ -40272,7 +40272,7 @@ "read-package-tree": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/read-package-tree/-/read-package-tree-5.3.1.tgz", - "integrity": "sha1-oyy2TH8x64pvMe8G+c7fdAaP5jY=", + "integrity": "sha512-mLUDsD5JVtlZxjSlPPx1RETkNjjvQYuweKwNVt1Sn8kP5Jh44pvYuUHCp6xSVDZWbNxVxG5lyZJ921aJH61sTw==", "dev": true, "requires": { "read-package-json": "^2.0.0", @@ -40461,7 +40461,7 @@ "redent": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", - "integrity": "sha1-5Ve3mYMWu1PJ8fVvpiY1LGljBZ8=", + "integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==", "dev": true, "requires": { "indent-string": "^4.0.0", @@ -42502,7 +42502,7 @@ "solc": { "version": "0.7.4", "resolved": "https://registry.npmjs.org/solc/-/solc-0.7.4.tgz", - "integrity": "sha1-nF7YGuBpLj5hTkfNW1ALD5SFuY0=", + "integrity": "sha512-IVLqAfUkJqgTS0JIgFPeC50ehUeBXu2eE+iU+rqb6UeOyf6w/BB/EsNcTSTpjtUti8BTG/sCd2qVhrWVYy7p0g==", "dev": true, "requires": { "command-exists": "^1.2.8", @@ -42519,7 +42519,7 @@ "commander": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/commander/-/commander-3.0.2.tgz", - "integrity": "sha1-aDfD+2d62ZM9HPukLdFNURfWs54=", + "integrity": "sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow==", "dev": true }, "fs-extra": { @@ -42547,7 +42547,7 @@ "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha1-qVT5Ma66UI0we78Gnv8MAclhFvc=", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true }, "tmp": { @@ -42728,7 +42728,7 @@ "split": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz", - "integrity": "sha1-YFvZvjA6pZ+zX5Ip++oN3snqB9k=", + "integrity": "sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==", "dev": true, "requires": { "through": "2" @@ -43213,7 +43213,7 @@ "strip-indent": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", - "integrity": "sha1-wy4c7pQLazQyx3G8LFS8znPNMAE=", + "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==", "dev": true, "requires": { "min-indent": "^1.0.0" @@ -43227,7 +43227,7 @@ "strong-log-transformer": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/strong-log-transformer/-/strong-log-transformer-2.1.0.tgz", - "integrity": "sha1-D17XjTJeBCGsb5D38Q5pHWrjrhA=", + "integrity": "sha512-B3Hgul+z0L9a236FAUC9iZsL+nVHgoCJnqCbN588DjYxvGXaXaaFbfmQ/JhvKjZwsOukuR72XbHv71Qkug0HxA==", "dev": true, "requires": { "duplexer": "^0.1.1", @@ -44072,7 +44072,7 @@ "make-dir": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", - "integrity": "sha1-ecEDO4BRW9bSTsmTPoYMp17ifww=", + "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", "dev": true, "requires": { "pify": "^3.0.0" @@ -44324,7 +44324,7 @@ "text-extensions": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/text-extensions/-/text-extensions-1.9.0.tgz", - "integrity": "sha1-GFPkX+45yUXOb2w2stZZtaq8KiY=", + "integrity": "sha512-wiBrwC1EhBelW12Zy26JeOUkQ5mRu+5o8rpsJk5+2t+Y5vE7e842qtZDQ2g1NpX/29HdyFeJ4nSIhI47ENSxlQ==", "dev": true }, "text-hex": { @@ -44341,7 +44341,7 @@ "thenify": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", - "integrity": "sha1-iTLmhqQGYDigFt2eLKRq3Zg4qV8=", + "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==", "dev": true, "requires": { "any-promise": "^1.0.0" @@ -45421,7 +45421,7 @@ "universal-user-agent": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-4.0.1.tgz", - "integrity": "sha1-/Y1st3OmeacJ6WfvgoijH8wD5Vc=", + "integrity": "sha512-LnST3ebHwVL2aNe4mejI9IQh2HfZ1RLo8Io2HugSif8ekzD1TlWpHpColOB/eh8JHMLkGH3Akqf040I+4ylNxg==", "dev": true, "requires": { "os-name": "^3.1.0" @@ -46078,7 +46078,7 @@ "warning": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/warning/-/warning-4.0.3.tgz", - "integrity": "sha1-Fungd+uKhtavfWSqHgX9hbRnjKM=", + "integrity": "sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w==", "requires": { "loose-envify": "^1.0.0" } @@ -47576,7 +47576,7 @@ "write-json-file": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/write-json-file/-/write-json-file-3.2.0.tgz", - "integrity": "sha1-Zbvcns2KFFjhWVJ3DMut/P9f5io=", + "integrity": "sha512-3xZqT7Byc2uORAatYiP3DHUUAVEkNOswEWNs9H5KXiicRTvzYzYqKjYc4G7p+8pltvAw641lVByKVtMpf+4sYQ==", "dev": true, "requires": { "detect-indent": "^5.0.0", @@ -47599,7 +47599,7 @@ "write-file-atomic": { "version": "2.4.3", "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.4.3.tgz", - "integrity": "sha1-H9Lprh3z51uNjDZ0Q8aS1MqB9IE=", + "integrity": "sha512-GaETH5wwsX+GcnzhPgKcKjJ6M2Cq3/iZp1WyY/X1CSqrW+jVNM9Y7D8EC2sM4ZG/V8wZlSniJnCKWPmBYAucRQ==", "dev": true, "requires": { "graceful-fs": "^4.1.11", @@ -47612,7 +47612,7 @@ "write-pkg": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/write-pkg/-/write-pkg-3.2.0.tgz", - "integrity": "sha1-DheP6Xgg04mokovHlTXb5ows/yE=", + "integrity": "sha512-tX2ifZ0YqEFOF1wjRW2Pk93NLsj02+n1UP5RvO6rCs0K6R2g1padvf006cY74PQJKMGS2r42NK7FD0dG6Y6paw==", "dev": true, "requires": { "sort-keys": "^2.0.0", @@ -47622,7 +47622,7 @@ "make-dir": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", - "integrity": "sha1-ecEDO4BRW9bSTsmTPoYMp17ifww=", + "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", "dev": true, "requires": { "pify": "^3.0.0" @@ -47646,7 +47646,7 @@ "write-file-atomic": { "version": "2.4.3", "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.4.3.tgz", - "integrity": "sha1-H9Lprh3z51uNjDZ0Q8aS1MqB9IE=", + "integrity": "sha512-GaETH5wwsX+GcnzhPgKcKjJ6M2Cq3/iZp1WyY/X1CSqrW+jVNM9Y7D8EC2sM4ZG/V8wZlSniJnCKWPmBYAucRQ==", "dev": true, "requires": { "graceful-fs": "^4.1.11", diff --git a/package.json b/package.json index 3585888453..4c321497db 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "nightwatch_local_staticAnalysis": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/staticAnalysis.test.js --env=chrome", "nightwatch_local_signingMessage": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/signingMessage.test.js --env=chrome", "nightwatch_local_specialFunctions": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/specialFunctions_*.test.js --env=chrome", - "nightwatch_local_solidityUnitTests": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/solidityUnittests_*.test.js --env=chrome", + "nightwatch_local_solidityUnitTests": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/solidityUnittests_*.test.js --env=firefoxDesktop", "nightwatch_local_remixd": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/remixd.test.js --env=chrome", "nightwatch_local_terminal": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/terminal_*.test.js --env=chrome", "nightwatch_local_gist": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/gist.test.js --env=chrome", @@ -86,7 +86,7 @@ "nightwatch_local_generalSettings": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/generalSettings.test.js --env=chrome", "nightwatch_local_fileExplorer": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/fileExplorer.test.js --env=chrome", "nightwatch_local_debugger": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/debugger_*.test.js --env=chrome", - "nightwatch_local_editor": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/editor.test.js --env=chrome", + "nightwatch_local_editor": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/editor.test.js --env=firefoxDesktop", "nightwatch_local_importFromGithub": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/importFromGithub.test.js --env=chrome", "nightwatch_local_compiler": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/compiler_api.test.js --env=chrome", "nightwatch_local_txListener": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/txListener.test.js --env=chrome", From fe48c4737996542e92ac3099ed414a40db7dec96 Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 25 Feb 2022 10:33:28 +0100 Subject: [PATCH 106/217] rollback --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 4c321497db..3585888453 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "nightwatch_local_staticAnalysis": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/staticAnalysis.test.js --env=chrome", "nightwatch_local_signingMessage": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/signingMessage.test.js --env=chrome", "nightwatch_local_specialFunctions": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/specialFunctions_*.test.js --env=chrome", - "nightwatch_local_solidityUnitTests": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/solidityUnittests_*.test.js --env=firefoxDesktop", + "nightwatch_local_solidityUnitTests": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/solidityUnittests_*.test.js --env=chrome", "nightwatch_local_remixd": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/remixd.test.js --env=chrome", "nightwatch_local_terminal": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/terminal_*.test.js --env=chrome", "nightwatch_local_gist": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/gist.test.js --env=chrome", @@ -86,7 +86,7 @@ "nightwatch_local_generalSettings": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/generalSettings.test.js --env=chrome", "nightwatch_local_fileExplorer": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/fileExplorer.test.js --env=chrome", "nightwatch_local_debugger": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/debugger_*.test.js --env=chrome", - "nightwatch_local_editor": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/editor.test.js --env=firefoxDesktop", + "nightwatch_local_editor": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/editor.test.js --env=chrome", "nightwatch_local_importFromGithub": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/importFromGithub.test.js --env=chrome", "nightwatch_local_compiler": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/compiler_api.test.js --env=chrome", "nightwatch_local_txListener": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/txListener.test.js --env=chrome", From cf88e90f4a47a65eb5a017f1c7ce6169e8fefa9b Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 25 Feb 2022 11:09:45 +0100 Subject: [PATCH 107/217] rollback css --- libs/remix-ui/editor/src/lib/remix-ui-editor.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx index df1134feee..8452fa2124 100644 --- a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx +++ b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx @@ -259,7 +259,7 @@ export const EditorUI = (props: EditorUIProps) => { range: new monacoRef.current.Range(decoration.position.start.line + 1, decoration.position.start.column + 1, decoration.position.end.line + 1, decoration.position.end.column + 1), options: { isWholeLine, - inlineClassName: `alert-info border-top border-bottom highlightLine${decoration.position.start.line + 1}` + inlineClassName: `alert-info border-0 highlightLine${decoration.position.start.line + 1}` } } } From dbfbb98647b59797c855b5d6871a18d2a3c87256 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Fri, 18 Feb 2022 14:24:06 +0530 Subject: [PATCH 108/217] save compilation result in file --- .../src/lib/compiler-metadata.ts | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/libs/remix-core-plugin/src/lib/compiler-metadata.ts b/libs/remix-core-plugin/src/lib/compiler-metadata.ts index dfd4ade1dd..bf83805509 100644 --- a/libs/remix-core-plugin/src/lib/compiler-metadata.ts +++ b/libs/remix-core-plugin/src/lib/compiler-metadata.ts @@ -23,7 +23,7 @@ export class CompilerMetadata extends Plugin { } _MetadataFileName (path, contractName) { - return this.joinPath(path, this.innerPath, contractName + '_metadata.json') + return this.joinPath(path, this.innerPath, contractName + '_compResult.json') } onActivation () { @@ -51,28 +51,22 @@ export class CompilerMetadata extends Plugin { async _setArtefacts (content, contract, path) { content = content || '{}' + const fileName = this._JSONFileName(path, contract.name) + const metadataFileName = this._MetadataFileName(path, contract.name) + + if (contract && contract.object) await this.call('fileManager', 'writeFile', metadataFileName, JSON.stringify(contract.object, null, '\t')) + let metadata try { metadata = JSON.parse(content) } catch (e) { console.log(e) } - const fileName = this._JSONFileName(path, contract.name) - const metadataFileName = this._MetadataFileName(path, contract.name) - const deploy = metadata.deploy || {} this.networks.forEach((network) => { deploy[network] = this._syncContext(contract, deploy[network] || {}) }) - let parsedMetadata - try { - parsedMetadata = JSON.parse(contract.object.metadata) - } catch (e) { - console.log(e) - } - if (parsedMetadata) await this.call('fileManager', 'writeFile', metadataFileName, JSON.stringify(parsedMetadata, null, '\t')) - const data = { deploy, data: { From 9f7396e4076355d6828514ed265e966dc5779925 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Fri, 18 Feb 2022 16:49:24 +0530 Subject: [PATCH 109/217] full output in third file --- .../src/lib/compiler-metadata.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/libs/remix-core-plugin/src/lib/compiler-metadata.ts b/libs/remix-core-plugin/src/lib/compiler-metadata.ts index bf83805509..7fb555ea0b 100644 --- a/libs/remix-core-plugin/src/lib/compiler-metadata.ts +++ b/libs/remix-core-plugin/src/lib/compiler-metadata.ts @@ -23,7 +23,11 @@ export class CompilerMetadata extends Plugin { } _MetadataFileName (path, contractName) { - return this.joinPath(path, this.innerPath, contractName + '_compResult.json') + return this.joinPath(path, this.innerPath, contractName + '_metadata.json') + } + + _OutputFileName (path, contractName) { + return this.joinPath(path, this.innerPath, contractName + '_fullOP.json') } onActivation () { @@ -53,8 +57,9 @@ export class CompilerMetadata extends Plugin { content = content || '{}' const fileName = this._JSONFileName(path, contract.name) const metadataFileName = this._MetadataFileName(path, contract.name) + const opFileName = this._OutputFileName(path, contract.name) - if (contract && contract.object) await this.call('fileManager', 'writeFile', metadataFileName, JSON.stringify(contract.object, null, '\t')) + if (contract && contract.object) await this.call('fileManager', 'writeFile', opFileName, JSON.stringify(contract.object, null, '\t')) let metadata try { @@ -62,11 +67,20 @@ export class CompilerMetadata extends Plugin { } catch (e) { console.log(e) } + const deploy = metadata.deploy || {} this.networks.forEach((network) => { deploy[network] = this._syncContext(contract, deploy[network] || {}) }) + let parsedMetadata + try { + parsedMetadata = JSON.parse(contract.object.metadata) + } catch (e) { + console.log(e) + } + if (parsedMetadata) await this.call('fileManager', 'writeFile', metadataFileName, JSON.stringify(parsedMetadata, null, '\t')) + const data = { deploy, data: { From a124296dfcab1484bdb85a8541100787239403f8 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Fri, 18 Feb 2022 17:31:52 +0530 Subject: [PATCH 110/217] get artifacts from file --- apps/remix-ide/src/remixAppManager.js | 1 + libs/remix-core-plugin/src/lib/compiler-artefacts.ts | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/remix-ide/src/remixAppManager.js b/apps/remix-ide/src/remixAppManager.js index ce7ea97b27..966621491f 100644 --- a/apps/remix-ide/src/remixAppManager.js +++ b/apps/remix-ide/src/remixAppManager.js @@ -114,6 +114,7 @@ export class RemixAppManager extends PluginManager { const res = await fetch(this.pluginsDirectory) plugins = await res.json() plugins = plugins.filter((plugin) => { + if(plugin.name === 'scriptRunner') plugin.url = 'http://127.0.0.1:8081' if (plugin.targets && Array.isArray(plugin.targets) && plugin.targets.length > 0) { return (plugin.targets.includes('remix')) } diff --git a/libs/remix-core-plugin/src/lib/compiler-artefacts.ts b/libs/remix-core-plugin/src/lib/compiler-artefacts.ts index d35fa36141..638ae9972e 100644 --- a/libs/remix-core-plugin/src/lib/compiler-artefacts.ts +++ b/libs/remix-core-plugin/src/lib/compiler-artefacts.ts @@ -80,12 +80,12 @@ export class CompilerArtefacts extends Plugin { const artefactsFilePaths = fileList.filter(filePath => { const filenameArr = filePath.split('/') const filename = filenameArr[filenameArr.length - 1] - if (filename === `${contractName}.json` || filename === `${contractName}_metadata.json`) return true + if (filename === `${contractName}_fullOP.json`) return true }) if (artefactsFilePaths && artefactsFilePaths.length) { - const content = await this.call('fileManager', 'readFile', artefactsFilePaths[1]) + const content = await this.call('fileManager', 'readFile', artefactsFilePaths[0]) const artifacts = JSON.parse(content) - return { abi: artifacts.abi, bytecode: artifacts.data.bytecode.object } + return artifacts } else { for (const dirPath of dirList) { const result = await this.getArtefactsFromFE (dirPath, contractName) @@ -106,7 +106,7 @@ export class CompilerArtefacts extends Plugin { const contractsData = Object.values(contractsDataByFilename) if (contractsData && contractsData.length) { const index = contractsData.findIndex((contractsObj) => Object.keys(contractsObj).includes(contractName)) - if (index !== -1) return { abi: contractsData[index][contractName].abi, bytecode: contractsData[index][contractName].evm.bytecode.object } + if (index !== -1) return contractsData[index][contractName] else { const result = await this.getArtefactsFromFE ('contracts', contractName) if (result) return result From 543abf0a7fb3a1dcd03b0aa1055e1a7c51f9b638 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Fri, 18 Feb 2022 17:35:34 +0530 Subject: [PATCH 111/217] remove local link --- apps/remix-ide/src/remixAppManager.js | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/remix-ide/src/remixAppManager.js b/apps/remix-ide/src/remixAppManager.js index 966621491f..ce7ea97b27 100644 --- a/apps/remix-ide/src/remixAppManager.js +++ b/apps/remix-ide/src/remixAppManager.js @@ -114,7 +114,6 @@ export class RemixAppManager extends PluginManager { const res = await fetch(this.pluginsDirectory) plugins = await res.json() plugins = plugins.filter((plugin) => { - if(plugin.name === 'scriptRunner') plugin.url = 'http://127.0.0.1:8081' if (plugin.targets && Array.isArray(plugin.targets) && plugin.targets.length > 0) { return (plugin.targets.includes('remix')) } From d506809b42216c6caaecf2cd206041e7a7f1235e Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 22 Feb 2022 13:28:55 +0530 Subject: [PATCH 112/217] full compilation output in file --- libs/remix-core-plugin/src/lib/compiler-metadata.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libs/remix-core-plugin/src/lib/compiler-metadata.ts b/libs/remix-core-plugin/src/lib/compiler-metadata.ts index 7fb555ea0b..b217d8984f 100644 --- a/libs/remix-core-plugin/src/lib/compiler-metadata.ts +++ b/libs/remix-core-plugin/src/lib/compiler-metadata.ts @@ -26,8 +26,8 @@ export class CompilerMetadata extends Plugin { return this.joinPath(path, this.innerPath, contractName + '_metadata.json') } - _OutputFileName (path, contractName) { - return this.joinPath(path, this.innerPath, contractName + '_fullOP.json') + _OutputFileName (path, target) { + return this.joinPath(path, this.innerPath, 'output/' + target.replace('/', '_') + '.json') } onActivation () { @@ -36,6 +36,8 @@ export class CompilerMetadata extends Plugin { if (!await this.call('settings', 'get', 'settings/generate-contract-metadata')) return const compiler = new CompilerAbstract(languageVersion, data, source) const path = self._extractPathOf(source.target) + const outputFileName = this._OutputFileName(path, source.target) + await this.call('fileManager', 'writeFile', outputFileName, JSON.stringify(data, null, '\t')) compiler.visitContracts((contract) => { if (contract.file !== source.target) return (async () => { @@ -57,9 +59,6 @@ export class CompilerMetadata extends Plugin { content = content || '{}' const fileName = this._JSONFileName(path, contract.name) const metadataFileName = this._MetadataFileName(path, contract.name) - const opFileName = this._OutputFileName(path, contract.name) - - if (contract && contract.object) await this.call('fileManager', 'writeFile', opFileName, JSON.stringify(contract.object, null, '\t')) let metadata try { From 7f4a47afffe78d59a0b636ec3dce37a5b09759a5 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 22 Feb 2022 14:41:13 +0530 Subject: [PATCH 113/217] file name fix --- libs/remix-core-plugin/src/lib/compiler-metadata.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-core-plugin/src/lib/compiler-metadata.ts b/libs/remix-core-plugin/src/lib/compiler-metadata.ts index b217d8984f..d26de28367 100644 --- a/libs/remix-core-plugin/src/lib/compiler-metadata.ts +++ b/libs/remix-core-plugin/src/lib/compiler-metadata.ts @@ -27,7 +27,7 @@ export class CompilerMetadata extends Plugin { } _OutputFileName (path, target) { - return this.joinPath(path, this.innerPath, 'output/' + target.replace('/', '_') + '.json') + return this.joinPath(path, this.innerPath, 'output/' + target.replace(/\//g, '_') + '.json') } onActivation () { From 52f5e76898094216e0a12b6c44ba6c3d53112f22 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 22 Feb 2022 18:15:35 +0530 Subject: [PATCH 114/217] only fileName as path --- libs/remix-core-plugin/src/lib/compiler-metadata.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/remix-core-plugin/src/lib/compiler-metadata.ts b/libs/remix-core-plugin/src/lib/compiler-metadata.ts index d26de28367..63c3932bb0 100644 --- a/libs/remix-core-plugin/src/lib/compiler-metadata.ts +++ b/libs/remix-core-plugin/src/lib/compiler-metadata.ts @@ -27,7 +27,9 @@ export class CompilerMetadata extends Plugin { } _OutputFileName (path, target) { - return this.joinPath(path, this.innerPath, 'output/' + target.replace(/\//g, '_') + '.json') + const paths = target.split('/') + const fileName = paths[paths.length - 1] + return this.joinPath(path, this.innerPath, 'output/' + fileName + '.json') } onActivation () { From 9ffe002b8c207d36fc9c05036af1ba22e8de1223 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 22 Feb 2022 19:30:48 +0530 Subject: [PATCH 115/217] update dir name --- libs/remix-core-plugin/src/lib/compiler-metadata.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-core-plugin/src/lib/compiler-metadata.ts b/libs/remix-core-plugin/src/lib/compiler-metadata.ts index 63c3932bb0..ac308a89b2 100644 --- a/libs/remix-core-plugin/src/lib/compiler-metadata.ts +++ b/libs/remix-core-plugin/src/lib/compiler-metadata.ts @@ -29,7 +29,7 @@ export class CompilerMetadata extends Plugin { _OutputFileName (path, target) { const paths = target.split('/') const fileName = paths[paths.length - 1] - return this.joinPath(path, this.innerPath, 'output/' + fileName + '.json') + return this.joinPath(path, this.innerPath, 'build-info/' + fileName + '.json') } onActivation () { From 93862b55c2257889f79855d0326e42a51966dc58 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 22 Feb 2022 20:55:09 +0530 Subject: [PATCH 116/217] output as a key --- libs/remix-core-plugin/src/lib/compiler-metadata.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/remix-core-plugin/src/lib/compiler-metadata.ts b/libs/remix-core-plugin/src/lib/compiler-metadata.ts index ac308a89b2..117e906530 100644 --- a/libs/remix-core-plugin/src/lib/compiler-metadata.ts +++ b/libs/remix-core-plugin/src/lib/compiler-metadata.ts @@ -39,7 +39,8 @@ export class CompilerMetadata extends Plugin { const compiler = new CompilerAbstract(languageVersion, data, source) const path = self._extractPathOf(source.target) const outputFileName = this._OutputFileName(path, source.target) - await this.call('fileManager', 'writeFile', outputFileName, JSON.stringify(data, null, '\t')) + const buildData = { output: data } + await this.call('fileManager', 'writeFile', outputFileName, JSON.stringify(buildData, null, '\t')) compiler.visitContracts((contract) => { if (contract.file !== source.target) return (async () => { From 2e4b8520cc422dcb1a93d4b3b6712e4ec96b07c2 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Wed, 23 Feb 2022 14:56:56 +0530 Subject: [PATCH 117/217] emit version and input too --- apps/solidity-compiler/src/app/compiler-api.ts | 4 ++-- .../src/compiler/compiler-worker.ts | 1 + libs/remix-solidity/src/compiler/compiler.ts | 16 +++++++++------- libs/remix-solidity/src/compiler/types.ts | 1 + 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/apps/solidity-compiler/src/app/compiler-api.ts b/apps/solidity-compiler/src/app/compiler-api.ts index abfe0b377b..174d40f910 100644 --- a/apps/solidity-compiler/src/app/compiler-api.ts +++ b/apps/solidity-compiler/src/app/compiler-api.ts @@ -261,11 +261,11 @@ export const CompilerApiMixin = (Base) => class extends Base { this.on('fileManager', 'fileClosed', this.data.eventHandlers.onFileClosed) - this.data.eventHandlers.onCompilationFinished = (success, data, source) => { + this.data.eventHandlers.onCompilationFinished = (success, data, source, input, version) => { this.compileErrors = data if (success) { // forwarding the event to the appManager infra - this.emit('compilationFinished', source.target, source, 'soljson', data) + this.emit('compilationFinished', source.target, source, 'soljson', data, input, version) if (data.errors && data.errors.length > 0) { this.statusChanged({ key: data.errors.length, diff --git a/libs/remix-solidity/src/compiler/compiler-worker.ts b/libs/remix-solidity/src/compiler/compiler-worker.ts index 7685a766f3..662a03ec06 100644 --- a/libs/remix-solidity/src/compiler/compiler-worker.ts +++ b/libs/remix-solidity/src/compiler/compiler-worker.ts @@ -45,6 +45,7 @@ export default function (self) { // eslint-disable-line @typescript-eslint/expli cmd: 'compiled', job: data.job, data: compileJSON(data.input), + input: data.input, missingInputs: missingInputs }) } diff --git a/libs/remix-solidity/src/compiler/compiler.ts b/libs/remix-solidity/src/compiler/compiler.ts index 4a7903f5f5..ab2510b950 100644 --- a/libs/remix-solidity/src/compiler/compiler.ts +++ b/libs/remix-solidity/src/compiler/compiler.ts @@ -111,16 +111,17 @@ export class Compiler { return { error: 'Deferred import' } } let result: CompilationResult = {} + let input try { if (source && source.sources) { const { optimize, runs, evmVersion, language } = this.state - const input = compilerInput(source.sources, { optimize, runs, evmVersion, language }) + input = compilerInput(source.sources, { optimize, runs, evmVersion, language }) result = JSON.parse(compiler.compile(input, { import: missingInputsCallback })) } } catch (exception) { result = { error: { formattedMessage: 'Uncaught JavaScript exception:\n' + exception, severity: 'error', mode: 'panic' } } } - this.onCompilationFinished(result, missingInputs, source) + this.onCompilationFinished(result, missingInputs, source, input, this.state.currentVersion) } this.onCompilerLoaded(compiler.version()) } @@ -133,7 +134,7 @@ export class Compiler { * @param source Source */ - onCompilationFinished (data: CompilationResult, missingInputs?: string[], source?: SourceWithTarget): void { + onCompilationFinished (data: CompilationResult, missingInputs?: string[], source?: SourceWithTarget, input?, version?): void { let noFatalErrors = true // ie warnings are ok const checkIfFatalError = (error: CompilationError) => { @@ -159,7 +160,7 @@ export class Compiler { source: source } } - this.event.trigger('compilationFinished', [true, data, source]) + this.event.trigger('compilationFinished', [true, data, source, input, version]) } } @@ -182,16 +183,17 @@ export class Compiler { return { error: 'Deferred import' } } let result: CompilationResult = {} + let input try { if (source && source.sources) { const { optimize, runs, evmVersion, language } = this.state - const input = compilerInput(source.sources, { optimize, runs, evmVersion, language }) + input = compilerInput(source.sources, { optimize, runs, evmVersion, language }) result = JSON.parse(remoteCompiler.compile(input, { import: missingInputsCallback })) } } catch (exception) { result = { error: { formattedMessage: 'Uncaught JavaScript exception:\n' + exception, severity: 'error', mode: 'panic' } } } - this.onCompilationFinished(result, missingInputs, source) + this.onCompilationFinished(result, missingInputs, source, input, version) } this.onCompilerLoaded(version) } @@ -273,7 +275,7 @@ export class Compiler { sources = jobs[data.job].sources delete jobs[data.job] } - this.onCompilationFinished(result, data.missingInputs, sources) + this.onCompilationFinished(result, data.missingInputs, sources, data.input, this.state.currentVersion) } break } diff --git a/libs/remix-solidity/src/compiler/types.ts b/libs/remix-solidity/src/compiler/types.ts index 14751cfabc..709c0c97df 100644 --- a/libs/remix-solidity/src/compiler/types.ts +++ b/libs/remix-solidity/src/compiler/types.ts @@ -186,6 +186,7 @@ export interface MessageFromWorker { cmd: string, job?: number, missingInputs?: string[], + input?: any, data?: string } From 3c3229f5f926cc38207aea26ea779d7df0b02cbb Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Wed, 23 Feb 2022 18:44:39 +0530 Subject: [PATCH 118/217] hh compatible build info --- .../src/lib/compiler-metadata.ts | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/libs/remix-core-plugin/src/lib/compiler-metadata.ts b/libs/remix-core-plugin/src/lib/compiler-metadata.ts index 117e906530..3f2e2430bd 100644 --- a/libs/remix-core-plugin/src/lib/compiler-metadata.ts +++ b/libs/remix-core-plugin/src/lib/compiler-metadata.ts @@ -1,6 +1,7 @@ 'use strict' import { Plugin } from '@remixproject/engine' import { CompilerAbstract } from '@remix-project/remix-solidity' +import { createHash } from 'crypto' const profile = { name: 'compilerMetadata', @@ -26,21 +27,13 @@ export class CompilerMetadata extends Plugin { return this.joinPath(path, this.innerPath, contractName + '_metadata.json') } - _OutputFileName (path, target) { - const paths = target.split('/') - const fileName = paths[paths.length - 1] - return this.joinPath(path, this.innerPath, 'build-info/' + fileName + '.json') - } - onActivation () { const self = this - this.on('solidity', 'compilationFinished', async (file, source, languageVersion, data) => { + this.on('solidity', 'compilationFinished', async (file, source, languageVersion, data, input, version) => { if (!await this.call('settings', 'get', 'settings/generate-contract-metadata')) return const compiler = new CompilerAbstract(languageVersion, data, source) const path = self._extractPathOf(source.target) - const outputFileName = this._OutputFileName(path, source.target) - const buildData = { output: data } - await this.call('fileManager', 'writeFile', outputFileName, JSON.stringify(buildData, null, '\t')) + await this.setBuildInfo(version, input, data, path) compiler.visitContracts((contract) => { if (contract.file !== source.target) return (async () => { @@ -52,6 +45,23 @@ export class CompilerMetadata extends Plugin { }) } + async setBuildInfo (version, input, output, path) { + input = JSON.parse(input) + const solcLongVersion = version.replace('.Emscripten.clang', '') + const solcVersion = solcLongVersion.substring(0, solcLongVersion.indexOf('+commit')) + const format = 'hh-sol-build-info-1' + const json = JSON.stringify({ + _format: format, + solcVersion, + solcLongVersion, + input + }) + const id = createHash('md5').update(Buffer.from(json)).digest().toString('hex') + const buildFilename = this.joinPath(path, this.innerPath, 'build-info/' + id + '.json') + const buildData = {id, _format: format, solcVersion, solcLongVersion, input, output} + await this.call('fileManager', 'writeFile', buildFilename, JSON.stringify(buildData, null, '\t')) + } + _extractPathOf (file) { const reg = /(.*)(\/).*/ const path = reg.exec(file) From 486231913a70f559ed5ec59bb9208edfd703195f Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Thu, 24 Feb 2022 13:48:21 +0530 Subject: [PATCH 119/217] read artifacts for all contracts --- .../src/lib/compiler-artefacts.ts | 75 +++++++++---------- 1 file changed, 36 insertions(+), 39 deletions(-) diff --git a/libs/remix-core-plugin/src/lib/compiler-artefacts.ts b/libs/remix-core-plugin/src/lib/compiler-artefacts.ts index 638ae9972e..ab24267a4b 100644 --- a/libs/remix-core-plugin/src/lib/compiler-artefacts.ts +++ b/libs/remix-core-plugin/src/lib/compiler-artefacts.ts @@ -72,51 +72,48 @@ export class CompilerArtefacts extends Plugin { return contractsData } - async getArtefactsFromFE (path, contractName) { + getAllContractArtefactsfromOutput (contractsOutput, contractName) { + let contractArtefacts = {} + for (const filename in contractsOutput) { + if(Object.keys(contractsOutput[filename]).includes(contractName)) contractArtefacts[filename + ':' + contractName] = contractsOutput[filename][contractName] + } + return contractArtefacts + } + + async getArtefactsFromFE (path, contractName, contractArtefacts) { const dirList = await this.call('fileManager', 'dirList', path) if(dirList && dirList.length) { - if(dirList.includes(path + '/artifacts')) { - const fileList = await this.call('fileManager', 'fileList', path + '/artifacts') - const artefactsFilePaths = fileList.filter(filePath => { - const filenameArr = filePath.split('/') - const filename = filenameArr[filenameArr.length - 1] - if (filename === `${contractName}_fullOP.json`) return true - }) - if (artefactsFilePaths && artefactsFilePaths.length) { - const content = await this.call('fileManager', 'readFile', artefactsFilePaths[0]) - const artifacts = JSON.parse(content) - return artifacts - } else { - for (const dirPath of dirList) { - const result = await this.getArtefactsFromFE (dirPath, contractName) - if (result) return result + for (const dirPath of dirList) { + if(dirPath === path + '/artifacts' && await this.call('fileManager', 'exists', dirPath + '/build-info')) { + const buildFileList = await this.call('fileManager', 'fileList', dirPath + '/build-info') + for (const buildFile of buildFileList) { + let content = await this.call('fileManager', 'readFile', buildFile) + if (content) content = JSON.parse(content) + const contracts = content.output.contracts + const artefacts = this.getAllContractArtefactsfromOutput(contracts, contractName) + Object.assign(contractArtefacts, artefacts) } - } - } else { - for (const dirPath of dirList) { - const result = await this.getArtefactsFromFE (dirPath, contractName) - if (result) return result - } - } - } else return - } + } else await this.getArtefactsFromFE (dirPath, contractName, contractArtefacts) + } + } else return +} async getArtefactsByContractName (contractName) { const contractsDataByFilename = this.getAllContractDatas() - const contractsData = Object.values(contractsDataByFilename) - if (contractsData && contractsData.length) { - const index = contractsData.findIndex((contractsObj) => Object.keys(contractsObj).includes(contractName)) - if (index !== -1) return contractsData[index][contractName] - else { - const result = await this.getArtefactsFromFE ('contracts', contractName) - if (result) return result - else throw new Error(`Could not find artifacts for ${contractName}. Compile contract to generate artifacts.`) - } - } else { - const result = await this.getArtefactsFromFE ('contracts', contractName) - if (result) return result - else throw new Error(`Could not find artifacts for ${contractName}. Compile contract to generate artifacts.`) - } + let contractArtefacts + contractArtefacts = this.getAllContractArtefactsfromOutput(contractsDataByFilename, contractName) + let keys = Object.keys(contractArtefacts) + if (!keys.length) { + await this.getArtefactsFromFE ('contracts', contractName, contractArtefacts) + keys = Object.keys(contractArtefacts) + } + if (keys.length === 1) return contractArtefacts[keys[0]] + else { + throw new Error(`There are multiple artifacts for contract "${contractName}", please use a fully qualified name.\n + Please replace ${contractName} for one of these options wherever you are trying to read its artifact: \n + ${keys.join()}\n + OR just compile the required contract again`) + } } getCompilerAbstract (file) { From 00a5a4b4d3e9a91468266f6a4a954f20f138ee96 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Thu, 24 Feb 2022 14:06:34 +0530 Subject: [PATCH 120/217] error on wrong contract name --- libs/remix-core-plugin/src/lib/compiler-artefacts.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/remix-core-plugin/src/lib/compiler-artefacts.ts b/libs/remix-core-plugin/src/lib/compiler-artefacts.ts index ab24267a4b..c544179950 100644 --- a/libs/remix-core-plugin/src/lib/compiler-artefacts.ts +++ b/libs/remix-core-plugin/src/lib/compiler-artefacts.ts @@ -108,12 +108,12 @@ export class CompilerArtefacts extends Plugin { keys = Object.keys(contractArtefacts) } if (keys.length === 1) return contractArtefacts[keys[0]] - else { + else if (keys.length > 1) { throw new Error(`There are multiple artifacts for contract "${contractName}", please use a fully qualified name.\n Please replace ${contractName} for one of these options wherever you are trying to read its artifact: \n ${keys.join()}\n OR just compile the required contract again`) - } + } else throw new Error(`Could not find artifacts for ${contractName}. Compile contract to generate artifacts.`) } getCompilerAbstract (file) { From dd4b937cd50a4a29cbb12b974d35c6736abcf6e0 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Thu, 24 Feb 2022 14:14:22 +0530 Subject: [PATCH 121/217] linting fix --- libs/remix-core-plugin/src/lib/compiler-artefacts.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/remix-core-plugin/src/lib/compiler-artefacts.ts b/libs/remix-core-plugin/src/lib/compiler-artefacts.ts index c544179950..aeede49839 100644 --- a/libs/remix-core-plugin/src/lib/compiler-artefacts.ts +++ b/libs/remix-core-plugin/src/lib/compiler-artefacts.ts @@ -73,7 +73,7 @@ export class CompilerArtefacts extends Plugin { } getAllContractArtefactsfromOutput (contractsOutput, contractName) { - let contractArtefacts = {} + const contractArtefacts = {} for (const filename in contractsOutput) { if(Object.keys(contractsOutput[filename]).includes(contractName)) contractArtefacts[filename + ':' + contractName] = contractsOutput[filename][contractName] } @@ -100,8 +100,8 @@ export class CompilerArtefacts extends Plugin { async getArtefactsByContractName (contractName) { const contractsDataByFilename = this.getAllContractDatas() - let contractArtefacts - contractArtefacts = this.getAllContractArtefactsfromOutput(contractsDataByFilename, contractName) + // let contractArtefacts + const contractArtefacts = this.getAllContractArtefactsfromOutput(contractsDataByFilename, contractName) let keys = Object.keys(contractArtefacts) if (!keys.length) { await this.getArtefactsFromFE ('contracts', contractName, contractArtefacts) From cd3a3c4b462e6dd2cd01448d704b024ef96c6c10 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Thu, 24 Feb 2022 14:43:28 +0530 Subject: [PATCH 122/217] get artefacts using fully qualified name --- .../src/lib/compiler-artefacts.ts | 39 ++++++++++++------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/libs/remix-core-plugin/src/lib/compiler-artefacts.ts b/libs/remix-core-plugin/src/lib/compiler-artefacts.ts index aeede49839..f2b3535f65 100644 --- a/libs/remix-core-plugin/src/lib/compiler-artefacts.ts +++ b/libs/remix-core-plugin/src/lib/compiler-artefacts.ts @@ -100,20 +100,33 @@ export class CompilerArtefacts extends Plugin { async getArtefactsByContractName (contractName) { const contractsDataByFilename = this.getAllContractDatas() - // let contractArtefacts - const contractArtefacts = this.getAllContractArtefactsfromOutput(contractsDataByFilename, contractName) - let keys = Object.keys(contractArtefacts) - if (!keys.length) { - await this.getArtefactsFromFE ('contracts', contractName, contractArtefacts) - keys = Object.keys(contractArtefacts) + if (contractName.includes(':')) { + const nameArr = contractName.split(':') + const filename = nameArr[0] + const contract = nameArr[1] + if(Object.keys(contractsDataByFilename).includes(filename) && contractsDataByFilename[filename][contract]) + return contractsDataByFilename[filename][contract] + else { + let allContractsData = {} + await this.getArtefactsFromFE ('contracts', contract, allContractsData) + if(allContractsData[contractName]) return allContractsData[contractName] + else throw new Error(`Could not find artifacts for ${contractName}. Compile contract to generate artifacts.`) + } + } else { + const contractArtefacts = this.getAllContractArtefactsfromOutput(contractsDataByFilename, contractName) + let keys = Object.keys(contractArtefacts) + if (!keys.length) { + await this.getArtefactsFromFE ('contracts', contractName, contractArtefacts) + keys = Object.keys(contractArtefacts) + } + if (keys.length === 1) return contractArtefacts[keys[0]] + else if (keys.length > 1) { + throw new Error(`There are multiple artifacts for contract "${contractName}", please use a fully qualified name.\n + Please replace ${contractName} for one of these options wherever you are trying to read its artifact: \n + ${keys.join()}\n + OR just compile the required contract again`) + } else throw new Error(`Could not find artifacts for ${contractName}. Compile contract to generate artifacts.`) } - if (keys.length === 1) return contractArtefacts[keys[0]] - else if (keys.length > 1) { - throw new Error(`There are multiple artifacts for contract "${contractName}", please use a fully qualified name.\n - Please replace ${contractName} for one of these options wherever you are trying to read its artifact: \n - ${keys.join()}\n - OR just compile the required contract again`) - } else throw new Error(`Could not find artifacts for ${contractName}. Compile contract to generate artifacts.`) } getCompilerAbstract (file) { From 9cc0705b199a7e82235affb02cb45dc1adaf6d35 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Thu, 24 Feb 2022 15:52:20 +0530 Subject: [PATCH 123/217] linting fix --- libs/remix-core-plugin/src/lib/compiler-artefacts.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-core-plugin/src/lib/compiler-artefacts.ts b/libs/remix-core-plugin/src/lib/compiler-artefacts.ts index f2b3535f65..ebd9a85f30 100644 --- a/libs/remix-core-plugin/src/lib/compiler-artefacts.ts +++ b/libs/remix-core-plugin/src/lib/compiler-artefacts.ts @@ -107,7 +107,7 @@ export class CompilerArtefacts extends Plugin { if(Object.keys(contractsDataByFilename).includes(filename) && contractsDataByFilename[filename][contract]) return contractsDataByFilename[filename][contract] else { - let allContractsData = {} + const allContractsData = {} await this.getArtefactsFromFE ('contracts', contract, allContractsData) if(allContractsData[contractName]) return allContractsData[contractName] else throw new Error(`Could not find artifacts for ${contractName}. Compile contract to generate artifacts.`) From 5da0623ca7acfdbfe0123878db63aa08efab4115 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Thu, 24 Feb 2022 16:09:17 +0530 Subject: [PATCH 124/217] types --- libs/remix-solidity/src/compiler/compiler.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libs/remix-solidity/src/compiler/compiler.ts b/libs/remix-solidity/src/compiler/compiler.ts index ab2510b950..428ff5a765 100644 --- a/libs/remix-solidity/src/compiler/compiler.ts +++ b/libs/remix-solidity/src/compiler/compiler.ts @@ -9,7 +9,8 @@ import { Source, SourceWithTarget, MessageFromWorker, CompilerState, CompilationResult, visitContractsCallbackParam, visitContractsCallbackInterface, CompilationError, gatherImportsCallbackInterface, - isFunctionDescription + isFunctionDescription, + CompilerInput } from './types' /* @@ -134,7 +135,7 @@ export class Compiler { * @param source Source */ - onCompilationFinished (data: CompilationResult, missingInputs?: string[], source?: SourceWithTarget, input?, version?): void { + onCompilationFinished (data: CompilationResult, missingInputs?: string[], source?: SourceWithTarget, input?: string, version?: string): void { let noFatalErrors = true // ie warnings are ok const checkIfFatalError = (error: CompilationError) => { @@ -183,7 +184,7 @@ export class Compiler { return { error: 'Deferred import' } } let result: CompilationResult = {} - let input + let input: string try { if (source && source.sources) { const { optimize, runs, evmVersion, language } = this.state From a86acd861a29ae34767f5f7e98adaf269b830355 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Thu, 24 Feb 2022 16:23:27 +0530 Subject: [PATCH 125/217] private methods --- .../src/lib/compiler-artefacts.ts | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/libs/remix-core-plugin/src/lib/compiler-artefacts.ts b/libs/remix-core-plugin/src/lib/compiler-artefacts.ts index ebd9a85f30..01a8e23f4a 100644 --- a/libs/remix-core-plugin/src/lib/compiler-artefacts.ts +++ b/libs/remix-core-plugin/src/lib/compiler-artefacts.ts @@ -72,7 +72,7 @@ export class CompilerArtefacts extends Plugin { return contractsData } - getAllContractArtefactsfromOutput (contractsOutput, contractName) { + _getAllContractArtefactsfromOutput (contractsOutput, contractName) { const contractArtefacts = {} for (const filename in contractsOutput) { if(Object.keys(contractsOutput[filename]).includes(contractName)) contractArtefacts[filename + ':' + contractName] = contractsOutput[filename][contractName] @@ -80,7 +80,7 @@ export class CompilerArtefacts extends Plugin { return contractArtefacts } - async getArtefactsFromFE (path, contractName, contractArtefacts) { + async _getArtefactsFromFE (path, contractName, contractArtefacts) { const dirList = await this.call('fileManager', 'dirList', path) if(dirList && dirList.length) { for (const dirPath of dirList) { @@ -90,13 +90,13 @@ export class CompilerArtefacts extends Plugin { let content = await this.call('fileManager', 'readFile', buildFile) if (content) content = JSON.parse(content) const contracts = content.output.contracts - const artefacts = this.getAllContractArtefactsfromOutput(contracts, contractName) + const artefacts = this._getAllContractArtefactsfromOutput(contracts, contractName) Object.assign(contractArtefacts, artefacts) } - } else await this.getArtefactsFromFE (dirPath, contractName, contractArtefacts) - } - } else return -} + } else await this._getArtefactsFromFE (dirPath, contractName, contractArtefacts) + } + } else return + } async getArtefactsByContractName (contractName) { const contractsDataByFilename = this.getAllContractDatas() @@ -108,15 +108,15 @@ export class CompilerArtefacts extends Plugin { return contractsDataByFilename[filename][contract] else { const allContractsData = {} - await this.getArtefactsFromFE ('contracts', contract, allContractsData) + await this._getArtefactsFromFE ('contracts', contract, allContractsData) if(allContractsData[contractName]) return allContractsData[contractName] else throw new Error(`Could not find artifacts for ${contractName}. Compile contract to generate artifacts.`) } } else { - const contractArtefacts = this.getAllContractArtefactsfromOutput(contractsDataByFilename, contractName) + const contractArtefacts = this._getAllContractArtefactsfromOutput(contractsDataByFilename, contractName) let keys = Object.keys(contractArtefacts) if (!keys.length) { - await this.getArtefactsFromFE ('contracts', contractName, contractArtefacts) + await this._getArtefactsFromFE ('contracts', contractName, contractArtefacts) keys = Object.keys(contractArtefacts) } if (keys.length === 1) return contractArtefacts[keys[0]] From f20c384d861ce8c04a8a0a6de7f015ef562b38fd Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Thu, 24 Feb 2022 20:31:27 +0530 Subject: [PATCH 126/217] added missed params --- libs/remix-solidity/src/compiler/compiler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-solidity/src/compiler/compiler.ts b/libs/remix-solidity/src/compiler/compiler.ts index 428ff5a765..62172c0a8a 100644 --- a/libs/remix-solidity/src/compiler/compiler.ts +++ b/libs/remix-solidity/src/compiler/compiler.ts @@ -148,7 +148,7 @@ export class Compiler { if (!noFatalErrors) { // There are fatal errors, abort here this.state.lastCompilationResult = null - this.event.trigger('compilationFinished', [false, data, source]) + this.event.trigger('compilationFinished', [false, data, source, input, version]) } else if (missingInputs !== undefined && missingInputs.length > 0 && source && source.sources) { // try compiling again with the new set of inputs this.internalCompile(source.sources, missingInputs) From bb251e9f9d96c2f3f6261dceee97b714d491c545 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Thu, 24 Feb 2022 21:31:55 +0530 Subject: [PATCH 127/217] CompilerAbstract updated --- libs/remix-core-plugin/src/lib/compiler-metadata.ts | 2 +- libs/remix-solidity/src/compiler/compiler-abstract.ts | 8 +++++++- libs/remix-solidity/src/compiler/compiler-helpers.ts | 4 ++-- libs/remix-ui/run-tab/src/lib/actions/index.ts | 6 +++--- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/libs/remix-core-plugin/src/lib/compiler-metadata.ts b/libs/remix-core-plugin/src/lib/compiler-metadata.ts index 3f2e2430bd..e7c5f3eec6 100644 --- a/libs/remix-core-plugin/src/lib/compiler-metadata.ts +++ b/libs/remix-core-plugin/src/lib/compiler-metadata.ts @@ -31,7 +31,7 @@ export class CompilerMetadata extends Plugin { const self = this this.on('solidity', 'compilationFinished', async (file, source, languageVersion, data, input, version) => { if (!await this.call('settings', 'get', 'settings/generate-contract-metadata')) return - const compiler = new CompilerAbstract(languageVersion, data, source) + const compiler = new CompilerAbstract(languageVersion, data, source, input) const path = self._extractPathOf(source.target) await this.setBuildInfo(version, input, data, path) compiler.visitContracts((contract) => { diff --git a/libs/remix-solidity/src/compiler/compiler-abstract.ts b/libs/remix-solidity/src/compiler/compiler-abstract.ts index 81cd33db28..8a7c25f72f 100644 --- a/libs/remix-solidity/src/compiler/compiler-abstract.ts +++ b/libs/remix-solidity/src/compiler/compiler-abstract.ts @@ -5,10 +5,12 @@ export class CompilerAbstract { languageversion: any data: any source: any - constructor (languageversion, data, source) { + input: any + constructor (languageversion, data, source, input?) { this.languageversion = languageversion this.data = data this.source = source // source code + this.input = input // source code } getContracts () { @@ -27,6 +29,10 @@ export class CompilerAbstract { return this.data } + getInput () { + return this.input + } + getAsts () { return this.data.sources // ast } diff --git a/libs/remix-solidity/src/compiler/compiler-helpers.ts b/libs/remix-solidity/src/compiler/compiler-helpers.ts index 8a70e6be4f..ae7af0e0f1 100644 --- a/libs/remix-solidity/src/compiler/compiler-helpers.ts +++ b/libs/remix-solidity/src/compiler/compiler-helpers.ts @@ -12,8 +12,8 @@ export const compile = async (compilationTargets, settings, contentResolverCallb compiler.set('language', settings.language) compiler.set('runs', settings.runs) compiler.loadVersion(canUseWorker(settings.version), urlFromVersion(settings.version)) - compiler.event.register('compilationFinished', (success, compilationData, source) => { - resolve(new CompilerAbstract(settings.version, compilationData, source)) + compiler.event.register('compilationFinished', (success, compilationData, source, input, version) => { + resolve(new CompilerAbstract(settings.version, compilationData, source, input)) }) compiler.event.register('compilerLoaded', _ => compiler.compile(compilationTargets, '')) }) diff --git a/libs/remix-ui/run-tab/src/lib/actions/index.ts b/libs/remix-ui/run-tab/src/lib/actions/index.ts index 18635bb1d7..464a68eed0 100644 --- a/libs/remix-ui/run-tab/src/lib/actions/index.ts +++ b/libs/remix-ui/run-tab/src/lib/actions/index.ts @@ -66,7 +66,7 @@ const setupEvents = () => { plugin.on('manager', 'pluginDeactivated', removePluginProvider.bind(plugin)) - plugin.on('solidity', 'compilationFinished', (file, source, languageVersion, data) => broadcastCompilationResult(file, source, languageVersion, data)) + plugin.on('solidity', 'compilationFinished', (file, source, languageVersion, data, input, version) => broadcastCompilationResult(file, source, languageVersion, data, input)) plugin.on('vyper', 'compilationFinished', (file, source, languageVersion, data) => broadcastCompilationResult(file, source, languageVersion, data)) @@ -301,9 +301,9 @@ export const signMessageWithAddress = (account: string, message: string, modalCo }) } -const broadcastCompilationResult = (file, source, languageVersion, data) => { +const broadcastCompilationResult = (file, source, languageVersion, data, input?) => { // TODO check whether the tab is configured - const compiler = new CompilerAbstract(languageVersion, data, source) + const compiler = new CompilerAbstract(languageVersion, data, source, input) plugin.compilersArtefacts[languageVersion] = compiler plugin.compilersArtefacts.__last = compiler From abbb4a1d4e9cbaa184ae650b89bba76e91a31e25 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Fri, 25 Feb 2022 11:37:35 +0530 Subject: [PATCH 128/217] update compilationFinished --- apps/remix-ide/src/app/tabs/test-tab.js | 4 ++-- .../src/lib/compiler-artefacts.ts | 14 +++++++------- .../src/lib/editor-context-listener.ts | 2 +- .../src/lib/offset-line-to-column-converter.ts | 2 +- .../src/source/offsetToLineColumnConverter.ts | 2 +- libs/remix-solidity/src/compiler/compiler.ts | 7 +++---- libs/remix-tests/src/compiler.ts | 6 +++--- .../solidity-compiler/src/lib/actions/compiler.ts | 4 ++-- .../src/lib/actions/staticAnalysisActions.ts | 4 ++-- .../src/lib/reducers/staticAnalysisReducer.ts | 4 +++- 10 files changed, 25 insertions(+), 24 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/test-tab.js b/apps/remix-ide/src/app/tabs/test-tab.js index c2af5ce7a7..7f634bd9d1 100644 --- a/apps/remix-ide/src/app/tabs/test-tab.js +++ b/apps/remix-ide/src/app/tabs/test-tab.js @@ -89,12 +89,12 @@ module.exports = class TestTab extends ViewPlugin { this.createTestLibs() }) - this.testRunner.event.on('compilationFinished', (success, data, source) => { + this.testRunner.event.on('compilationFinished', (success, data, source, input, version) => { if (success) { this.allFilesInvolved.push(...Object.keys(data.sources)) // forwarding the event to the appManager infra // This is listened by compilerArtefacts to show data while debugging - this.emit('compilationFinished', source.target, source, 'soljson', data) + this.emit('compilationFinished', source.target, source, 'soljson', data, input, version) } }) } diff --git a/libs/remix-core-plugin/src/lib/compiler-artefacts.ts b/libs/remix-core-plugin/src/lib/compiler-artefacts.ts index 01a8e23f4a..3659038a7a 100644 --- a/libs/remix-core-plugin/src/lib/compiler-artefacts.ts +++ b/libs/remix-core-plugin/src/lib/compiler-artefacts.ts @@ -24,12 +24,12 @@ export class CompilerArtefacts extends Plugin { } onActivation () { - const saveCompilationPerFileResult = (file, source, languageVersion, data) => { - this.compilersArtefactsPerFile[file] = new CompilerAbstract(languageVersion, data, source) + const saveCompilationPerFileResult = (file, source, languageVersion, data, input?) => { + this.compilersArtefactsPerFile[file] = new CompilerAbstract(languageVersion, data, source, input) } - this.on('solidity', 'compilationFinished', (file, source, languageVersion, data) => { - this.compilersArtefacts.__last = new CompilerAbstract(languageVersion, data, source) + this.on('solidity', 'compilationFinished', (file, source, languageVersion, data, input, version) => { + this.compilersArtefacts.__last = new CompilerAbstract(languageVersion, data, source, input) saveCompilationPerFileResult(file, source, languageVersion, data) }) @@ -48,9 +48,9 @@ export class CompilerArtefacts extends Plugin { saveCompilationPerFileResult(file, source, languageVersion, data) }) - this.on('solidityUnitTesting', 'compilationFinished', (file, source, languageVersion, data) => { - this.compilersArtefacts.__last = new CompilerAbstract(languageVersion, data, source) - saveCompilationPerFileResult(file, source, languageVersion, data) + this.on('solidityUnitTesting', 'compilationFinished', (file, source, languageVersion, data, input, version) => { + this.compilersArtefacts.__last = new CompilerAbstract(languageVersion, data, source, input) + saveCompilationPerFileResult(file, source, languageVersion, data, input) }) } diff --git a/libs/remix-core-plugin/src/lib/editor-context-listener.ts b/libs/remix-core-plugin/src/lib/editor-context-listener.ts index b20eb6e855..39b33e17b4 100644 --- a/libs/remix-core-plugin/src/lib/editor-context-listener.ts +++ b/libs/remix-core-plugin/src/lib/editor-context-listener.ts @@ -42,7 +42,7 @@ export class EditorContextListener extends Plugin { onActivation () { this.on('editor', 'contentChanged', () => { this._stopHighlighting() }) - this.on('solidity', 'compilationFinished', (file, source, languageVersion, data) => { + this.on('solidity', 'compilationFinished', (file, source, languageVersion, data, input, version) => { if (languageVersion.indexOf('soljson') !== 0) return this._stopHighlighting() this._index = { diff --git a/libs/remix-core-plugin/src/lib/offset-line-to-column-converter.ts b/libs/remix-core-plugin/src/lib/offset-line-to-column-converter.ts index ccb201aa47..b6e02bbcdd 100644 --- a/libs/remix-core-plugin/src/lib/offset-line-to-column-converter.ts +++ b/libs/remix-core-plugin/src/lib/offset-line-to-column-converter.ts @@ -70,7 +70,7 @@ export class OffsetToLineColumnConverter extends Plugin { * called by plugin API */ activate () { - this.on('solidity', 'compilationFinished', () => { + this.on('solidity', 'compilationFinished', (success, data, source, input, version) => { this.clear() }) } diff --git a/libs/remix-debug/src/source/offsetToLineColumnConverter.ts b/libs/remix-debug/src/source/offsetToLineColumnConverter.ts index 298feaa1c6..6605b660b9 100644 --- a/libs/remix-debug/src/source/offsetToLineColumnConverter.ts +++ b/libs/remix-debug/src/source/offsetToLineColumnConverter.ts @@ -8,7 +8,7 @@ export class OffsetToColumnConverter { constructor (compilerEvent) { this.lineBreakPositionsByContent = {} if (compilerEvent) { - compilerEvent.register('compilationFinished', (success, data, source) => { + compilerEvent.register('compilationFinished', (success, data, source, input, version) => { this.clear() }) } diff --git a/libs/remix-solidity/src/compiler/compiler.ts b/libs/remix-solidity/src/compiler/compiler.ts index 62172c0a8a..dc2421ff9c 100644 --- a/libs/remix-solidity/src/compiler/compiler.ts +++ b/libs/remix-solidity/src/compiler/compiler.ts @@ -9,8 +9,7 @@ import { Source, SourceWithTarget, MessageFromWorker, CompilerState, CompilationResult, visitContractsCallbackParam, visitContractsCallbackInterface, CompilationError, gatherImportsCallbackInterface, - isFunctionDescription, - CompilerInput + isFunctionDescription } from './types' /* @@ -38,7 +37,7 @@ export class Compiler { } } - this.event.register('compilationFinished', (success: boolean, data: CompilationResult, source: SourceWithTarget) => { + this.event.register('compilationFinished', (success: boolean, data: CompilationResult, source: SourceWithTarget, input: string, version: string) => { if (success && this.state.compilationStartTime) { this.event.trigger('compilationDuration', [(new Date().getTime()) - this.state.compilationStartTime]) } @@ -71,7 +70,7 @@ export class Compiler { this.gatherImports(files, missingInputs, (error, input) => { if (error) { this.state.lastCompilationResult = null - this.event.trigger('compilationFinished', [false, { error: { formattedMessage: error, severity: 'error' } }, files]) + this.event.trigger('compilationFinished', [false, { error: { formattedMessage: error, severity: 'error' } }, files, input, this.state.currentVersion]) } else if (this.state.compileJSON && input) { this.state.compileJSON(input) } }) } diff --git a/libs/remix-tests/src/compiler.ts b/libs/remix-tests/src/compiler.ts index 70487c97f3..697483d593 100644 --- a/libs/remix-tests/src/compiler.ts +++ b/libs/remix-tests/src/compiler.ts @@ -142,7 +142,7 @@ export function compileFileOrFiles (filename: string, isDirectory: boolean, opts }, function doCompilation (next) { // @ts-ignore - compiler.event.register('compilationFinished', this, (success, data, source) => { + compiler.event.register('compilationFinished', this, (success, data, source, input, version) => { next(null, data) }) compiler.compile(sources, filepath) @@ -201,10 +201,10 @@ export function compileContractSources (sources: SrcIfc, newCompConfig: any, imp } }, (next) => { - const compilationFinishedCb = (success, data, source) => { + const compilationFinishedCb = (success, data, source, input, version) => { // data.error usually exists for exceptions like worker error etc. if (!data.error) UTRunner.compiler = compiler - if (opts && opts.event) opts.event.emit('compilationFinished', success, data, source) + if (opts && opts.event) opts.event.emit('compilationFinished', success, data, source, input, version) next(null, data) } compiler.event.unregister('compilationFinished', compilationFinishedCb) diff --git a/libs/remix-ui/solidity-compiler/src/lib/actions/compiler.ts b/libs/remix-ui/solidity-compiler/src/lib/actions/compiler.ts index bc43ed73b1..c67aee6ddb 100644 --- a/libs/remix-ui/solidity-compiler/src/lib/actions/compiler.ts +++ b/libs/remix-ui/solidity-compiler/src/lib/actions/compiler.ts @@ -50,7 +50,7 @@ export const listenToEvents = (compileTabLogic: CompileTabLogic, api) => (dispat dispatch(setCompilerMode('compilerLoaded')) }) - compileTabLogic.compiler.event.register('compilationFinished', (success, data, source) => { - dispatch(setCompilerMode('compilationFinished', success, data, source)) + compileTabLogic.compiler.event.register('compilationFinished', (success, data, source, input, version) => { + dispatch(setCompilerMode('compilationFinished', success, data, source, input, version)) }) } diff --git a/libs/remix-ui/static-analyser/src/lib/actions/staticAnalysisActions.ts b/libs/remix-ui/static-analyser/src/lib/actions/staticAnalysisActions.ts index 4f55437cb6..c8ce131cee 100644 --- a/libs/remix-ui/static-analyser/src/lib/actions/staticAnalysisActions.ts +++ b/libs/remix-ui/static-analyser/src/lib/actions/staticAnalysisActions.ts @@ -5,9 +5,9 @@ export const compilation = (analysisModule, dispatch) => { analysisModule.on( 'solidity', 'compilationFinished', - (file, source, languageVersion, data) => { + (file, source, languageVersion, data, input, version) => { if (languageVersion.indexOf('soljson') !== 0) return - dispatch({ type: 'compilationFinished', payload: { file, source, languageVersion, data } }) + dispatch({ type: 'compilationFinished', payload: { file, source, languageVersion, data, input, version } }) } ) } diff --git a/libs/remix-ui/static-analyser/src/lib/reducers/staticAnalysisReducer.ts b/libs/remix-ui/static-analyser/src/lib/reducers/staticAnalysisReducer.ts index eb59ca7872..24c9a25868 100644 --- a/libs/remix-ui/static-analyser/src/lib/reducers/staticAnalysisReducer.ts +++ b/libs/remix-ui/static-analyser/src/lib/reducers/staticAnalysisReducer.ts @@ -13,7 +13,9 @@ export const analysisReducer = (state, action) => { file: action.payload.file, source: action.payload.source, languageVersion: action.payload.languageVersion, - data: action.payload.data + data: action.payload.data, + input: action.payload.input, + version: action.payload.version } default: return initialState From 614f726d94384a846a4c8cac81d5c802ff42ba12 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Fri, 25 Feb 2022 18:57:36 +0530 Subject: [PATCH 129/217] comments and naming --- .../src/lib/compiler-artefacts.ts | 62 ++++++++++++++----- 1 file changed, 47 insertions(+), 15 deletions(-) diff --git a/libs/remix-core-plugin/src/lib/compiler-artefacts.ts b/libs/remix-core-plugin/src/lib/compiler-artefacts.ts index 3659038a7a..96fe7358e5 100644 --- a/libs/remix-core-plugin/src/lib/compiler-artefacts.ts +++ b/libs/remix-core-plugin/src/lib/compiler-artefacts.ts @@ -53,11 +53,19 @@ export class CompilerArtefacts extends Plugin { saveCompilationPerFileResult(file, source, languageVersion, data, input) }) } - + + /** + * Get artefacts for last compiled contract + * * @returns last compiled contract compiler abstract + */ getLastCompilationResult () { return this.compilersArtefacts.__last } + /** + * Get compilation output for contracts compiled during a session of Remix IDE + * @returns compilatin output + */ getAllContractDatas () { const contractsData = {} Object.keys(this.compilersArtefactsPerFile).map((targetFile) => { @@ -72,51 +80,75 @@ export class CompilerArtefacts extends Plugin { return contractsData } - _getAllContractArtefactsfromOutput (contractsOutput, contractName) { + /** + * Get a particular contract output/artefacts from a compiler output of a Solidity file compilation + * @param compilerOutput compiler output + * @param contractName contract name + * @returns arefacts object, with fully qualified name (e.g; contracts/1_Storage.sol:Storage) as key + */ + _getAllContractArtefactsfromOutput (compilerOutput, contractName) { const contractArtefacts = {} - for (const filename in contractsOutput) { - if(Object.keys(contractsOutput[filename]).includes(contractName)) contractArtefacts[filename + ':' + contractName] = contractsOutput[filename][contractName] + for (const filename in compilerOutput) { + if(Object.keys(compilerOutput[filename]).includes(contractName)) contractArtefacts[filename + ':' + contractName] = compilerOutput[filename][contractName] } return contractArtefacts } - async _getArtefactsFromFE (path, contractName, contractArtefacts) { + /** + * Populate resultant object with a particular contract output/artefacts by processing all the artifacts stored in file explorer + * @param path path to start looking from + * @param contractName contract to be looked for + * @param contractArtefacts populated resultant artefacts object, with fully qualified name (e.g: contracts/1_Storage.sol:Storage) as key + * Once method execution completes, contractArtefacts object will hold all possible artefacts for contract + */ + async _populateAllContractArtefactsFromFE (path, contractName, contractArtefacts) { const dirList = await this.call('fileManager', 'dirList', path) if(dirList && dirList.length) { for (const dirPath of dirList) { + // check if directory contains an 'artifacts' folder and a 'build-info' folder inside 'artifacts' if(dirPath === path + '/artifacts' && await this.call('fileManager', 'exists', dirPath + '/build-info')) { const buildFileList = await this.call('fileManager', 'fileList', dirPath + '/build-info') + // process each build-info file to populate the artefacts for contractName for (const buildFile of buildFileList) { let content = await this.call('fileManager', 'readFile', buildFile) if (content) content = JSON.parse(content) - const contracts = content.output.contracts - const artefacts = this._getAllContractArtefactsfromOutput(contracts, contractName) + const compilerOutput = content.output.contracts + const artefacts = this._getAllContractArtefactsfromOutput(compilerOutput, contractName) + // populate the resultant object with artefacts Object.assign(contractArtefacts, artefacts) } - } else await this._getArtefactsFromFE (dirPath, contractName, contractArtefacts) + } else await this._populateAllContractArtefactsFromFE (dirPath, contractName, contractArtefacts) } } else return } - async getArtefactsByContractName (contractName) { + /** + * Get artefacts for a contract (called by script-runner) + * @param name contract name or fully qualified name i.e. : e.g: contracts/1_Storage.sol:Storage + * @returns artefacts for the contract + */ + async getArtefactsByContractName (name) { const contractsDataByFilename = this.getAllContractDatas() - if (contractName.includes(':')) { - const nameArr = contractName.split(':') + // check if name is a fully qualified name + if (name.includes(':')) { + const fullyQualifiedName = name + const nameArr = fullyQualifiedName.split(':') const filename = nameArr[0] const contract = nameArr[1] if(Object.keys(contractsDataByFilename).includes(filename) && contractsDataByFilename[filename][contract]) return contractsDataByFilename[filename][contract] else { const allContractsData = {} - await this._getArtefactsFromFE ('contracts', contract, allContractsData) - if(allContractsData[contractName]) return allContractsData[contractName] - else throw new Error(`Could not find artifacts for ${contractName}. Compile contract to generate artifacts.`) + await this._populateAllContractArtefactsFromFE ('contracts', contract, allContractsData) + if(allContractsData[fullyQualifiedName]) return allContractsData[fullyQualifiedName] + else throw new Error(`Could not find artifacts for ${fullyQualifiedName}. Compile contract to generate artifacts.`) } } else { + const contractName = name const contractArtefacts = this._getAllContractArtefactsfromOutput(contractsDataByFilename, contractName) let keys = Object.keys(contractArtefacts) if (!keys.length) { - await this._getArtefactsFromFE ('contracts', contractName, contractArtefacts) + await this._populateAllContractArtefactsFromFE ('contracts', contractName, contractArtefacts) keys = Object.keys(contractArtefacts) } if (keys.length === 1) return contractArtefacts[keys[0]] From 41f441748a8832b34b8159bf02e5788c3a386cf9 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Sun, 27 Feb 2022 16:57:12 +0100 Subject: [PATCH 130/217] move to components --- apps/remix-ide/src/app/components/preload.tsx | 115 + apps/remix-ide/src/app/files/fileSystem.ts | 85 + .../src/app/files/filesystems/indexedDB.ts | 91 + .../src/app/files/filesystems/localStorage.ts | 58 + .../files/filesystems/migrateFileSystem.ts | 189 + apps/remix-ide/src/app/tabs/theme-module.js | 16 +- apps/remix-ide/src/assets/js/init.js | 127 +- apps/remix-ide/src/index.html | 2 - apps/remix-ide/src/index.tsx | 50 +- package-lock.json | 63327 +++++++++++++++- package.json | 5 + 11 files changed, 62298 insertions(+), 1767 deletions(-) create mode 100644 apps/remix-ide/src/app/components/preload.tsx create mode 100644 apps/remix-ide/src/app/files/fileSystem.ts create mode 100644 apps/remix-ide/src/app/files/filesystems/indexedDB.ts create mode 100644 apps/remix-ide/src/app/files/filesystems/localStorage.ts create mode 100644 apps/remix-ide/src/app/files/filesystems/migrateFileSystem.ts diff --git a/apps/remix-ide/src/app/components/preload.tsx b/apps/remix-ide/src/app/components/preload.tsx new file mode 100644 index 0000000000..0e17efa214 --- /dev/null +++ b/apps/remix-ide/src/app/components/preload.tsx @@ -0,0 +1,115 @@ +import { RemixApp } from '@remix-ui/app' +import React, { useEffect, useRef, useState } from 'react' +import { render } from 'react-dom' +import * as packageJson from '../../../../../package.json' +import { fileSystems } from '../files/fileSystem' +import { indexedDBFileSystem } from '../files/filesystems/indexedDB' +import { localStorageFS } from '../files/filesystems/localStorage' +import { fileSystemUtility } from '../files/filesystems/migrateFileSystem' + +export const Preload = () => { + + const [supported, setSupported] = useState(true) + const [error, setError] = useState(false) + const [showDownloader, setShowDownloader] = useState(false) + const remixFileSystems = useRef(new fileSystems()) + + const logo = + + + + + + function loadAppComponent() { + import('../../app').then((AppComponent) => { + const appComponent = new AppComponent.default() + appComponent.run().then(() => { + render( + <> + + , + document.getElementById('root') + ) + }) + }).catch(err => { + console.log('Error loading Remix:', err) + setError(true) + }) + } + + + + const downloadBackup = async () =>{ + const migrator = new fileSystemUtility() + migrator.downloadBackup(remixFileSystems.current.fileSystems['localstorage']) + loadAppComponent() + } + + const skipBackup = async() => { + loadAppComponent() + } + + useEffect(() => { + + + async function loadStorage() { + const remixIndexedDB = new indexedDBFileSystem() + const localStorageFileSystem = new localStorageFS() + + + await remixFileSystems.current.addFileSystem(remixIndexedDB) + await remixFileSystems.current.addFileSystem(localStorageFileSystem) + + setShowDownloader(true) + + const migrator = new fileSystemUtility() + await migrator.migrate(localStorageFileSystem, remixIndexedDB) + const fsLoaded = await remixFileSystems.current.setFileSystem([remixIndexedDB, localStorageFileSystem]) + + if (fsLoaded) { + console.log(fsLoaded.name + ' activated') + console.log(localStorageFileSystem) + // migrator.downloadBackup(localStorageFileSystem) + //loadAppComponent() + } else { + console.log('No filesystem could be loaded') + setSupported(false) + // displayBrowserNotSupported() + } + } + + loadStorage() + }, []) + + return <> +
      + {logo} +
      + REMIX IDE +
      + v{packageJson.version} +
      + {!supported ? +
      + Your browser does not support any of the filesytems required by Remix. + Either change the settings in your browser or use a supported browser. +
      : null} + {error ? +
      + An unknown error has occured loading the application. +
      : null} + {showDownloader ? +
      + This app will be updated now. Please download a backup of your files now to make sure you don't lose your work. +

      + You don't need to do anything else, your files will be available when the app loads. +
      {await downloadBackup()}} className='btn btn-primary mt-1'>download backup
      +
      {await skipBackup()}}className='btn btn-primary mt-1'>skip backup
      +
      : null} + {(supported && !error && !showDownloader) ? +
      + +
      : null} +
      + +} \ No newline at end of file diff --git a/apps/remix-ide/src/app/files/fileSystem.ts b/apps/remix-ide/src/app/files/fileSystem.ts new file mode 100644 index 0000000000..8e37260de1 --- /dev/null +++ b/apps/remix-ide/src/app/files/fileSystem.ts @@ -0,0 +1,85 @@ +export class fileSystem { + name: string + enabled: boolean + available: boolean + fs: any + fsCallBack: any; + hasWorkSpaces: boolean + loaded: boolean + load: () => Promise + test: () => Promise + + constructor() { + this.available = false + this.enabled = false + this.hasWorkSpaces = false + this.loaded = false + } + ReadWriteTest = async () => { + try { + const str = 'Hello World' + await this.fs.writeFile('/test.txt', str, 'utf8') + if (await this.fs.readFile('/test.txt', 'utf8') === str) { + console.log('Read/Write Test Passed') + return true + } + await this.fs.remove('/test.txt', 'utf8') + } catch (e) { + console.log(e) + } + return false + } + + checkWorkspaces = async () => { + try { + await this.fs.stat('.workspaces') + this.hasWorkSpaces = true + } catch (e) { + + } + } + + set = async () => { + const w = (window as any) + if (!this.loaded) return false + w.remixFileSystem = this.fs + w.remixFileSystemCallback = this.fsCallBack + return true + } +} + +export class fileSystems { + fileSystems: Record + constructor() { + this.fileSystems = {} + } + + addFileSystem = async (fs: fileSystem) => { + try { + this.fileSystems[fs.name] = fs + if (await fs.test()) await fs.load() + console.log(fs.name + ' is loaded...') + return true + } catch (e) { + console.log(fs.name + ' not available...') + return false + } + } + /** + * sets filesystem using list as fallback + * @param {string[]} names + * @returns {Promise} + */ + setFileSystem = async (filesystems?: fileSystem[]): Promise => { + for (const fs of filesystems) { + if (this.fileSystems[fs.name]) { + const result = await this.fileSystems[fs.name].set() + if (result) return this.fileSystems[fs.name] + } + } + return null + } + + +} + diff --git a/apps/remix-ide/src/app/files/filesystems/indexedDB.ts b/apps/remix-ide/src/app/files/filesystems/indexedDB.ts new file mode 100644 index 0000000000..b62032cf25 --- /dev/null +++ b/apps/remix-ide/src/app/files/filesystems/indexedDB.ts @@ -0,0 +1,91 @@ +import LightningFS from "@isomorphic-git/lightning-fs" +import { fileSystem } from "../fileSystem" + +export class IndexedDBStorage extends LightningFS { + base: LightningFS.PromisifedFS + addSlash: (file: string) => string + extended: { exists: (path: string) => Promise; rmdir: (path: any) => Promise; readdir: (path: any) => Promise; unlink: (path: any) => Promise; mkdir: (path: any) => Promise; readFile: (path: any, options: any) => Promise; rename: (from: any, to: any) => Promise; writeFile: (path: any, content: any, options: any) => Promise; stat: (path: any) => Promise; init(name: string, opt?: LightningFS.FSConstructorOptions): void; activate(): Promise; deactivate(): Promise; lstat(filePath: string): Promise; readlink(filePath: string): Promise; symlink(target: string, filePath: string): Promise } + constructor(name: string) { + super(name) + this.addSlash = (file) => { + if (!file.startsWith('/')) file = '/' + file + return file + } + this.base = this.promises + this.extended = { + ...this.promises, + exists: async (path: string) => { + return new Promise((resolve) => { + this.base.stat(this.addSlash(path)).then(() => resolve(true)).catch(() => resolve(false)) + }) + }, + rmdir: async (path) => { + return this.base.rmdir(this.addSlash(path)) + }, + readdir: async (path) => { + return this.base.readdir(this.addSlash(path)) + }, + unlink: async (path) => { + return this.base.unlink(this.addSlash(path)) + }, + mkdir: async (path) => { + return this.base.mkdir(this.addSlash(path)) + }, + readFile: async (path, options) => { + return this.base.readFile(this.addSlash(path), options) + }, + rename: async (from, to) => { + return this.base.rename(this.addSlash(from), this.addSlash(to)) + }, + writeFile: async (path, content, options) => { + return this.base.writeFile(this.addSlash(path), content, options) + }, + stat: async (path) => { + return this.base.stat(this.addSlash(path)) + } + } + } +} + + +export class indexedDBFileSystem extends fileSystem { + constructor() { + super() + this.name = 'indexedDB' + } + + load = async () => { + return new Promise((resolve, reject) => { + try { + const fs = new IndexedDBStorage('RemixFileSystem') + fs.init('RemixFileSystem') + this.fs = fs.extended + this.fsCallBack = fs + this.loaded = true + resolve(true) + } catch (e) { + reject(e) + } + }) + } + + test = async () => { + return new Promise((resolve, reject) => { + if (!window.indexedDB) { + this.available = false + reject('No indexedDB on window') + } + const request = window.indexedDB.open("RemixTestDataBase", 3); + request.onerror = () => { + this.available = false + reject('Error creating test database') + }; + request.onsuccess = () => { + window.indexedDB.deleteDatabase("RemixTestDataBase"); + this.available = true + resolve(true) + }; + }) + } + +} \ No newline at end of file diff --git a/apps/remix-ide/src/app/files/filesystems/localStorage.ts b/apps/remix-ide/src/app/files/filesystems/localStorage.ts new file mode 100644 index 0000000000..dc757bd7f2 --- /dev/null +++ b/apps/remix-ide/src/app/files/filesystems/localStorage.ts @@ -0,0 +1,58 @@ +import { fileSystem } from "../fileSystem"; + +export class localStorageFS extends fileSystem { + + constructor() { + super() + this.name = 'localstorage' + } + load = async () => { + const me = this + return new Promise((resolve, reject) => { + try { + // eslint-disable-next-line no-undef + BrowserFS.install(window) + // eslint-disable-next-line no-undef + BrowserFS.configure({ + fs: 'LocalStorage' + }, async function (e) { + if (e) { + console.log('BROWSEFS Error: ' + e) + reject(e) + } else { + me.fs = { ...window.require('fs') } + me.fsCallBack = window.require('fs') + me.fs.readdir = me.fs.readdirSync + me.fs.readFile = me.fs.readFileSync + me.fs.writeFile = me.fs.writeFileSync + me.fs.stat = me.fs.statSync + me.fs.unlink = me.fs.unlinkSync + me.fs.rmdir = me.fs.rmdirSync + me.fs.mkdir = me.fs.mkdirSync + me.fs.rename = me.fs.renameSync + me.fs.exists = me.fs.existsSync + me.loaded = true + resolve(true) + } + }) + } catch (e) { + console.log('BrowserFS is not ready!') + reject(e) + } + }) + } + + test = async () => { + return new Promise((resolve, reject) => { + const test = 'test'; + try { + localStorage.setItem(test, test); + localStorage.removeItem(test); + resolve(true) + } catch(e) { + reject(e) + } + }) + } + +} \ No newline at end of file diff --git a/apps/remix-ide/src/app/files/filesystems/migrateFileSystem.ts b/apps/remix-ide/src/app/files/filesystems/migrateFileSystem.ts new file mode 100644 index 0000000000..9e5e43b80a --- /dev/null +++ b/apps/remix-ide/src/app/files/filesystems/migrateFileSystem.ts @@ -0,0 +1,189 @@ +import { hashMessage } from "ethers/lib/utils" +import JSZip from "jszip" +import { fileSystem } from "../fileSystem" + +export class fileSystemUtility { + migrate = async (fsFrom: fileSystem, fsTo: fileSystem) => { + try { + await fsFrom.checkWorkspaces() + await fsTo.checkWorkspaces() + + if (fsTo.hasWorkSpaces) { + console.log(`${fsTo.name} already has files`) + return true + } + + if (!fsFrom.hasWorkSpaces) { + console.log('no files to migrate') + return true + } + + await this.populateWorkspace(testData, fsFrom.fs) + const fromFiles = await this.copyFolderToJson('/', null, null, fsFrom.fs) + console.log(fsFrom.name, hashMessage(JSON.stringify(fromFiles)), fromFiles) + await this.populateWorkspace(fromFiles, fsTo.fs) + const toFiles = await this.copyFolderToJson('/', null, null, fsTo.fs) + + if (hashMessage(JSON.stringify(toFiles)) === hashMessage(JSON.stringify(fromFiles))) { + console.log('file migration successful') + return true + } else { + console.log('file migration failed falling back to ' + fsFrom.name) + fsTo.loaded = false + return false + } + } catch (e) { + console.log(e) + console.log('file migration failed falling back to ' + fsFrom.name) + fsTo.loaded = false + return false + } + } + + downloadBackup = async (fs: fileSystem) => { + try { + const zip = new JSZip() + await fs.checkWorkspaces() + await this.copyFolderToJson('/', null, null, fs.fs, ({ path, content }) => { + zip.file(path, content) + }) + const blob = await zip.generateAsync({ type: 'blob' }) + const today = new Date() + const date = today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate() + const time = today.getHours() + 'h' + today.getMinutes() + 'min' + this.saveAs(blob, `remix-backup-at-${time}-${date}.zip`) + + } catch (e) { + console.log(e) + } + } + + populateWorkspace = async (json, fs) => { + for (const item in json) { + const isFolder = json[item].content === undefined + if (isFolder) { + await this.createDir(item, fs) + await this.populateWorkspace(json[item].children, fs) + } else { + await fs.writeFile(item, json[item].content, 'utf8') + } + } + } + + + /** + * copy the folder recursively + * @param {string} path is the folder to be copied over + * @param {Function} visitFile is a function called for each visited files + * @param {Function} visitFolder is a function called for each visited folders + */ + copyFolderToJson = async (path, visitFile, visitFolder, fs, cb = null) => { + visitFile = visitFile || (() => { }) + visitFolder = visitFolder || (() => { }) + return await this._copyFolderToJsonInternal(path, visitFile, visitFolder, fs, cb) + } + + /** + * copy the folder recursively (internal use) + * @param {string} path is the folder to be copied over + * @param {Function} visitFile is a function called for each visited files + * @param {Function} visitFolder is a function called for each visited folders + */ + async _copyFolderToJsonInternal(path, visitFile, visitFolder, fs, cb) { + visitFile = visitFile || function () { /* do nothing. */ } + visitFolder = visitFolder || function () { /* do nothing. */ } + + const json = {} + // path = this.removePrefix(path) + if (await fs.exists(path)) { + const items = await fs.readdir(path) + visitFolder({ path }) + if (items.length !== 0) { + for (const item of items) { + const file: any = {} + const curPath = `${path}${path.endsWith('/') ? '' : '/'}${item}` + if ((await fs.stat(curPath)).isDirectory()) { + file.children = await this._copyFolderToJsonInternal(curPath, visitFile, visitFolder, fs, cb) + } else { + file.content = await fs.readFile(curPath, 'utf8') + if (cb) cb({ path: curPath, content: file.content }) + visitFile({ path: curPath, content: file.content }) + + } + json[curPath] = file + } + } + } + return json + } + + createDir = async (path, fs) => { + const paths = path.split('/') + if (paths.length && paths[0] === '') paths.shift() + let currentCheck = '' + for (const value of paths) { + currentCheck = currentCheck + (currentCheck ? '/' : '') + value + if (!await fs.exists(currentCheck)) { + await fs.mkdir(currentCheck) + } + } + } + + saveAs = (blob, name) => { + const node = document.createElement('a') + node.download = name + node.rel = 'noopener' + node.href = URL.createObjectURL(blob) + setTimeout(function () { URL.revokeObjectURL(node.href) }, 4E4) // 40s + setTimeout(function () { + try { + node.dispatchEvent(new MouseEvent('click')) + } catch (e) { + const evt = document.createEvent('MouseEvents') + evt.initMouseEvent('click', true, true, window, 0, 0, 0, 80, + 20, false, false, false, false, 0, null) + node.dispatchEvent(evt) + } + }, 0) // 40s + } +} + + +/* eslint-disable no-template-curly-in-string */ +const testData = { + '.workspaces': { + children: { + '.workspaces/default_workspace': { + children: { + '.workspaces/default_workspace/README.txt': { + content: 'TEST README' + } + } + }, + '.workspaces/emptyspace': { + + }, + '.workspaces/workspace_test': { + children: { + '.workspaces/workspace_test/TEST_README.txt': { + content: 'TEST README' + }, + '.workspaces/workspace_test/test_contracts': { + children: { + '.workspaces/workspace_test/test_contracts/1_Storage.sol': { + content: 'testing' + }, + '.workspaces/workspace_test/test_contracts/artifacts': { + children: { + '.workspaces/workspace_test/test_contracts/artifacts/Storage_metadata.json': { + content: '{ "test": "data" }' + } + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/apps/remix-ide/src/app/tabs/theme-module.js b/apps/remix-ide/src/app/tabs/theme-module.js index 78c8f1788d..c17eaa95c3 100644 --- a/apps/remix-ide/src/app/tabs/theme-module.js +++ b/apps/remix-ide/src/app/tabs/theme-module.js @@ -33,10 +33,13 @@ export class ThemeModule extends Plugin { this._deps = { config: Registry.getInstance().get('config').api } - this.themes = themes.reduce((acc, theme) => { - theme.url = window.location.origin + window.location.pathname + theme.url - return { ...acc, [theme.name.toLocaleLowerCase()]: theme } - }, {}) + this.themes = {} + themes.map((theme) => { + this.themes[theme.name.toLocaleLowerCase()] = { + ...theme, + url: window.location.origin + window.location.pathname + theme.url + } + }) this._paq = _paq let queryTheme = (new QueryParams()).get().theme queryTheme = queryTheme && queryTheme.toLocaleLowerCase() @@ -65,6 +68,7 @@ export class ThemeModule extends Plugin { initTheme (callback) { // callback is setTimeOut in app.js which is always passed if (callback) this.initCallback = callback if (this.active) { + document.getElementById('theme-link') ? document.getElementById('theme-link').remove():null const nextTheme = this.themes[this.active] // Theme document.documentElement.style.setProperty('--theme', nextTheme.quality) @@ -93,9 +97,9 @@ export class ThemeModule extends Plugin { _paq.push(['trackEvent', 'themeModule', 'switchTo', next]) const nextTheme = this.themes[next] // Theme if (!this.forced) this._deps.config.set('settings/theme', next) - document.getElementById('theme-link').remove() - const theme = document.createElement('link') + document.getElementById('theme-link') ? document.getElementById('theme-link').remove():null + const theme = document.createElement('link') theme.setAttribute('rel', 'stylesheet') theme.setAttribute('href', nextTheme.url) theme.setAttribute('id', 'theme-link') diff --git a/apps/remix-ide/src/assets/js/init.js b/apps/remix-ide/src/assets/js/init.js index 460d9b565e..8265067b82 100644 --- a/apps/remix-ide/src/assets/js/init.js +++ b/apps/remix-ide/src/assets/js/init.js @@ -41,135 +41,12 @@ for (const k in assets[versionToLoad]) { } window.onload = () => { - // eslint-disable-next-line no-undef - class IndexedDBFS extends LightningFS { - constructor(...t) { - super(...t) - this.addSlash = (file) => { - if (!file.startsWith('/')) file = '/' + file - return file - } - this.base = this.promises - this.promises = { - ...this.promises, - - exists: async (path) => { - return new Promise((resolve, reject) => { - this.base.stat(this.addSlash(path)).then(() => resolve(true)).catch(() => resolve(false)) - }) - }, - rmdir: async (path) => { - return this.base.rmdir(this.addSlash(path)) - }, - readdir: async (path) => { - return this.base.readdir(this.addSlash(path)) - }, - unlink: async (path) => { - return this.base.unlink(this.addSlash(path)) - }, - mkdir: async (path) => { - return this.base.mkdir(this.addSlash(path)) - }, - readFile: async (path, options) => { - return this.base.readFile(this.addSlash(path), options) - }, - rename: async (from, to) => { - return this.base.rename(this.addSlash(from), this.addSlash(to)) - }, - writeFile: async (path, content, options) => { - return this.base.writeFile(this.addSlash(path), content, options) - }, - stat: async (path) => { - return this.base.stat(this.addSlash(path)) - } - } - } - } - function loadApp() { const app = document.createElement('script') app.setAttribute('src', versions[versionToLoad]) document.body.appendChild(app) } - async function ReadWriteTest(fs) { - try { - console.log(await fs.readdir('/')) - const str = 'Hello World' - await fs.writeFile('/test.txt', str , 'utf8') - if(await fs.readFile('/test.txt', 'utf8') === str){ - console.log('Read/Write Test Passed') - } - } catch (e) { - console.log(e) - } - } - - try { - // localStorage - // eslint-disable-next-line no-undef - BrowserFS.install(window) - // eslint-disable-next-line no-undef - BrowserFS.configure({ - fs: 'LocalStorage' - }, async function (e) { - if (e) { - console.log('BROWSEFS Error: ' + e) - } else { - window.remixLocalStorage = { ...window.require('fs') } - window.remixLocalStorageCallBack = window.require('fs') - window.remixLocalStorage.readdir = window.remixLocalStorage.readdirSync - window.remixLocalStorage.readFile = window.remixLocalStorage.readFileSync - window.remixLocalStorage.writeFile = window.remixLocalStorage.writeFileSync - window.remixLocalStorage.stat = window.remixLocalStorage.statSync - window.remixLocalStorage.unlink = window.remixLocalStorage.unlinkSync - window.remixLocalStorage.rmdir = window.remixLocalStorage.rmdirSync - window.remixLocalStorage.mkdir = window.remixLocalStorage.mkdirSync - window.remixLocalStorage.rename = window.remixLocalStorage.renameSync - window.remixLocalStorage.exists = window.remixLocalStorage.existsSync - //loadApp() - console.log('BrowserFS is ready!') - await ReadWriteTest(window.remixLocalStorage) - } - }) - } catch (e) { - console.log('BrowserFS is not ready!') - } - if (!window.indexedDB) { - console.log("Your browser doesn't support a stable version of IndexedDB. Such and such feature will not be available."); - } - var request = window.indexedDB.open("RemixTestDataBase", 3); - console.log(request) - request.onerror = event => { - // Do something with request.errorCode! - console.log('INDEEDDB ERROR') - }; - request.onsuccess = event => { - // Do something with request.result! - console.log("INDEEDDB SUCCESS") - window.indexedDB.deleteDatabase("RemixTestDataBase"); - activateIndexedDB() - }; - - function activateIndexedDB() { - // indexedDB - window.remixIndexedDBCallBack = new IndexedDBFS() - window.remixIndexedDBCallBack.init('RemixFileSystem').then(async () => { - window.remixIndexedDB = window.remixIndexedDBCallBack.promises - // check if .workspaces is present in indexeddb - console.log('indexeddb ready') - await ReadWriteTest(window.remixIndexedDB) - window.remixIndexedDB.stat('.workspaces').then((dir) => { - console.log(dir) - // if (dir.isDirectory()) loadApp() - }).catch((e) => { - console.log('error creating .workspaces', e) - // no indexeddb .workspaces -> run migration - // eslint-disable-next-line no-undef - //migrateFilesFromLocalStorage(loadApp) - }) - }).catch((e) => { - console.log('INDEEDDB ERROR: ' + e) - }) - } + loadApp() + return } diff --git a/apps/remix-ide/src/index.html b/apps/remix-ide/src/index.html index 3587ad1233..f2573bc29b 100644 --- a/apps/remix-ide/src/index.html +++ b/apps/remix-ide/src/index.html @@ -28,8 +28,6 @@ - - - -