Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
fb478a8d
Commit
fb478a8d
authored
Jul 06, 2020
by
aniket-engg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lint and build working for remix-solidity
parent
a1f50eb1
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
96 additions
and
85 deletions
+96
-85
.eslintrc
libs/remix-solidity/.eslintrc
+16
-0
index.ts
libs/remix-solidity/index.ts
+0
-2
package.json
libs/remix-solidity/package.json
+3
-3
compiler-input.ts
libs/remix-solidity/src/compiler/compiler-input.ts
+1
-1
compiler-worker.ts
libs/remix-solidity/src/compiler/compiler-worker.ts
+25
-23
compiler.ts
libs/remix-solidity/src/compiler/compiler.ts
+12
-10
types.ts
libs/remix-solidity/src/compiler/types.ts
+3
-3
index.ts
libs/remix-solidity/src/index.ts
+2
-0
tsconfig.json
libs/remix-solidity/tsconfig.json
+5
-23
tsconfig.lib.json
libs/remix-solidity/tsconfig.lib.json
+16
-0
workspace.json
workspace.json
+13
-20
No files found.
libs/remix-solidity/.eslintrc
0 → 100644
View file @
fb478a8d
{
"extends": "../../.eslintrc",
"rules": {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-unused-vars": "off"
},
"env": {
"browser": true,
"amd": true,
"node": true,
"es6": true
},
"ignorePatterns": ["!**/*"]
}
\ No newline at end of file
libs/remix-solidity/index.ts
deleted
100644 → 0
View file @
a1f50eb1
export
{
Compiler
}
from
'./src/compiler/compiler'
export
{
default
as
CompilerInput
}
from
'./src/compiler/compiler-input'
libs/remix-solidity/package.json
View file @
fb478a8d
{
"name"
:
"remix-solidity"
,
"name"
:
"
@remix-project/
remix-solidity"
,
"version"
:
"0.3.30"
,
"description"
:
"Tool to load and run Solidity compiler"
,
"main"
:
"./dist/index.js"
,
...
...
@@ -16,7 +16,7 @@
],
"dependencies"
:
{
"eslint-scope"
:
"^5.0.0"
,
"remix-lib"
:
"0.4.29"
,
"
@remix-project/
remix-lib"
:
"0.4.29"
,
"solc"
:
"^0.6.0"
,
"webworkify"
:
"^1.2.1"
},
...
...
@@ -37,7 +37,7 @@
"scripts"
:
{
"build"
:
"tsc"
,
"lint"
:
"standard"
,
"test"
:
"
tsc &&
tape ./test/tests.js"
"test"
:
"
./../../node_modules/.bin/
tape ./test/tests.js"
},
"standard"
:
{
"ignore"
:
[
...
...
libs/remix-solidity/src/compiler/compiler-input.ts
View file @
fb478a8d
...
...
@@ -2,7 +2,7 @@
import
{
CompilerInput
,
Source
,
CompilerInputOptions
}
from
'./types'
export
default
(
sources
:
Source
,
opts
:
CompilerInputOptions
)
=>
{
export
default
(
sources
:
Source
,
opts
:
CompilerInputOptions
)
:
string
=>
{
const
o
:
CompilerInput
=
{
language
:
'Solidity'
,
sources
:
sources
,
...
...
libs/remix-solidity/src/compiler/compiler-worker.ts
View file @
fb478a8d
...
...
@@ -2,39 +2,41 @@
import
solc
from
'solc/wrapper'
import
{
CompilerInput
,
MessageToWorker
}
from
'./types'
var
compileJSON
:
((
input
:
CompilerInput
)
=>
string
)
|
null
=
(
input
)
=>
{
return
''
}
var
missingInputs
:
string
[]
=
[]
let
compileJSON
:
((
input
:
CompilerInput
)
=>
string
)
|
null
=
(
input
)
=>
{
return
''
}
const
missingInputs
:
string
[]
=
[]
// 'DedicatedWorkerGlobalScope' object (the Worker global scope) is accessible through the self keyword
// 'dom' and 'webworker' library files can't be included together https://github.com/microsoft/TypeScript/issues/20595
export
default
(
self
)
=>
{
export
default
(
self
)
:
void
=>
{
// eslint-disable-line @typescript-eslint/explicit-module-boundary-types
self
.
addEventListener
(
'message'
,
(
e
)
=>
{
const
data
:
MessageToWorker
=
e
.
data
switch
(
data
.
cmd
)
{
case
'loadVersion'
:
delete
self
.
Module
// NOTE: workaround some browsers?
self
.
Module
=
undefined
compileJSON
=
null
//importScripts() method of synchronously imports one or more scripts into the worker's scope
self
.
importScripts
(
data
.
data
)
let
compiler
:
solc
=
solc
(
self
.
Module
)
compileJSON
=
(
input
)
=>
{
try
{
let
missingInputsCallback
=
(
path
)
=>
{
missingInputs
.
push
(
path
)
return
{
'error'
:
'Deferred import'
}
{
delete
self
.
Module
// NOTE: workaround some browsers?
self
.
Module
=
undefined
compileJSON
=
null
//importScripts() method of synchronously imports one or more scripts into the worker's scope
self
.
importScripts
(
data
.
data
)
const
compiler
:
solc
=
solc
(
self
.
Module
)
compileJSON
=
(
input
)
=>
{
try
{
const
missingInputsCallback
=
(
path
)
=>
{
missingInputs
.
push
(
path
)
return
{
'error'
:
'Deferred import'
}
}
return
compiler
.
compile
(
input
,
{
import
:
missingInputsCallback
})
}
catch
(
exception
)
{
return
JSON
.
stringify
({
error
:
'Uncaught JavaScript exception:
\
n'
+
exception
})
}
return
compiler
.
compile
(
input
,
{
import
:
missingInputsCallback
})
}
catch
(
exception
)
{
return
JSON
.
stringify
({
error
:
'Uncaught JavaScript exception:
\
n'
+
exception
})
}
self
.
postMessage
({
cmd
:
'versionLoaded'
,
data
:
compiler
.
version
()
})
break
}
self
.
postMessage
({
cmd
:
'versionLoaded'
,
data
:
compiler
.
version
()
})
break
case
'compile'
:
missingInputs
.
length
=
0
...
...
libs/remix-solidity/src/compiler/compiler.ts
View file @
fb478a8d
...
...
@@ -3,7 +3,7 @@
import
{
update
}
from
'solc/abi'
import
webworkify
from
'webworkify'
import
compilerInput
from
'./compiler-input'
import
{
EventManager
}
from
'remix-lib'
import
{
EventManager
}
from
'
@remix-project/
remix-lib'
import
{
default
as
txHelper
}
from
'./txHelper'
;
import
{
Source
,
SourceWithTarget
,
MessageFromWorker
,
CompilerState
,
CompilationResult
,
visitContractsCallbackParam
,
visitContractsCallbackInterface
,
CompilationError
,
...
...
@@ -13,10 +13,10 @@ import { Source, SourceWithTarget, MessageFromWorker, CompilerState, Compilation
trigger compilationFinished, compilerLoaded, compilationStarted, compilationDuration
*/
export
class
Compiler
{
event
:
EventManager
event
state
:
CompilerState
constructor
(
public
handleImportCall
:
(
fileurl
:
string
,
cb
:
Function
)
=>
void
)
{
constructor
(
public
handleImportCall
:
(
fileurl
:
string
,
cb
)
=>
void
)
{
this
.
event
=
new
EventManager
()
this
.
state
=
{
compileJSON
:
null
,
...
...
@@ -51,7 +51,7 @@ export class Compiler {
* @param value value of key in CompilerState
*/
set
<
K
extends
keyof
CompilerState
>
(
key
:
K
,
value
:
CompilerState
[
K
])
{
set
<
K
extends
keyof
CompilerState
>
(
key
:
K
,
value
:
CompilerState
[
K
])
:
void
{
this
.
state
[
key
]
=
value
}
...
...
@@ -101,7 +101,7 @@ export class Compiler {
if
(
this
.
state
.
worker
===
null
)
{
const
compiler
:
any
=
typeof
(
window
)
===
'undefined'
?
require
(
'solc'
)
:
require
(
'solc/wrapper'
)(
window
[
'Module'
])
this
.
state
.
compileJSON
=
(
source
:
SourceWithTarget
)
=>
{
le
t
missingInputs
:
string
[]
=
[]
cons
t
missingInputs
:
string
[]
=
[]
const
missingInputsCallback
=
(
path
:
string
)
=>
{
missingInputs
.
push
(
path
)
return
{
error
:
'Deferred import'
}
...
...
@@ -129,7 +129,7 @@ export class Compiler {
*/
onCompilationFinished
(
data
:
CompilationResult
,
missingInputs
?:
string
[],
source
?:
SourceWithTarget
):
void
{
let
noFatalErrors
:
boolean
=
true
// ie warnings are ok
let
noFatalErrors
=
true
// ie warnings are ok
const
checkIfFatalError
=
(
error
:
CompilationError
)
=>
{
// Ignore warnings and the 'Deferred import' error as those are generated by us as a workaround
...
...
@@ -192,7 +192,7 @@ export class Compiler {
this
.
state
.
compileJSON
=
(
source
:
SourceWithTarget
)
=>
{
this
.
onCompilationFinished
({
error
:
{
formattedMessage
:
'Compiler not yet loaded.'
}
})
}
le
t
newScript
:
HTMLScriptElement
=
document
.
createElement
(
'script'
)
cons
t
newScript
:
HTMLScriptElement
=
document
.
createElement
(
'script'
)
newScript
.
type
=
'text/javascript'
newScript
.
src
=
url
document
.
getElementsByTagName
(
'head'
)[
0
].
appendChild
(
newScript
)
...
...
@@ -212,7 +212,7 @@ export class Compiler {
loadWorker
(
url
:
string
):
void
{
this
.
state
.
worker
=
webworkify
(
require
(
'./compiler-worker.js'
).
default
)
le
t
jobs
:
Record
<
'sources'
,
SourceWithTarget
>
[]
=
[]
cons
t
jobs
:
Record
<
'sources'
,
SourceWithTarget
>
[]
=
[]
this
.
state
.
worker
.
addEventListener
(
'message'
,
(
msg
:
Record
<
'data'
,
MessageFromWorker
>
)
=>
{
const
data
:
MessageFromWorker
=
msg
.
data
...
...
@@ -220,7 +220,8 @@ export class Compiler {
case
'versionLoaded'
:
if
(
data
.
data
)
this
.
onCompilerLoaded
(
data
.
data
)
break
case
'compiled'
:
case
'compiled'
:
{
let
result
:
CompilationResult
if
(
data
.
data
&&
data
.
job
!==
undefined
&&
data
.
job
>=
0
)
{
try
{
...
...
@@ -236,6 +237,7 @@ export class Compiler {
this
.
onCompilationFinished
(
result
,
data
.
missingInputs
,
sources
)
}
break
}
}
})
...
...
@@ -275,7 +277,7 @@ export class Compiler {
importHints
=
importHints
||
[]
// FIXME: This will only match imports if the file begins with one '.'
// It should tokenize by lines and check each.
const
importRegex
:
RegExp
=
/^
\s
*import
\s
*
[\'\"]([^\'\"]
+
)[\'\
"]
;/g
const
importRegex
=
/^
\s
*import
\s
*
[
'"
]([^
'"
]
+
)[
'
"
]
;/g
for
(
const
fileName
in
files
)
{
let
match
:
RegExpExecArray
|
null
while
((
match
=
importRegex
.
exec
(
files
[
fileName
].
content
)))
{
...
...
libs/remix-solidity/src/compiler/types.ts
View file @
fb478a8d
...
...
@@ -273,7 +273,7 @@ export interface CompilationResult {
/////////
export
interface
AstNode
{
absolutePath
?:
string
exportedSymbols
?:
Object
exportedSymbols
?:
Record
<
string
,
unknown
>
id
:
number
nodeType
:
string
nodes
?:
Array
<
AstNode
>
...
...
@@ -302,7 +302,7 @@ export interface CompilationResult {
constant
?:
boolean
name
?:
string
public
?:
boolean
exportedSymbols
?:
Object
exportedSymbols
?:
Record
<
string
,
unknown
>
argumentTypes
?:
null
absolutePath
?:
string
[
x
:
string
]:
any
...
...
@@ -325,7 +325,7 @@ export interface CompilationResult {
/** EVM-related outputs */
evm
:
{
assembly
:
string
legacyAssembly
:
{}
legacyAssembly
:
Record
<
string
,
unknown
>
/** Bytecode and related details. */
bytecode
:
BytecodeObject
deployedBytecode
:
BytecodeObject
...
...
libs/remix-solidity/src/index.ts
0 → 100644
View file @
fb478a8d
export
{
Compiler
}
from
'./compiler/compiler'
export
{
default
as
CompilerInput
}
from
'./compiler/compiler-input'
libs/remix-solidity/tsconfig.json
View file @
fb478a8d
{
"
include"
:
[
"src"
,
"index.ts"
]
,
"
extends"
:
"../../tsconfig.json"
,
"compilerOptions"
:
{
"target"
:
"es6"
,
/*
Specify
ECMAScript
target
version
:
'ES
3
'
(default)
,
'ES
5
'
,
'ES
2015
'
,
'ES
2016
'
,
'ES
2017
'
,
'ES
2018
'
or
'ESNEXT'.
*/
"module"
:
"commonjs"
,
/*
Specify
module
code
generation
:
'none'
,
'commonjs'
,
'amd'
,
'system'
,
'umd'
,
'es
2015
'
,
or
'ESNext'.
*/
"lib"
:
[
"dom"
,
"es2018"
],
/*
Specify
library
files
to
be
included
in
the
compilation.
*/
"declaration"
:
true
,
/*
Generates
corresponding
'.d.ts'
file.
*/
"sourceMap"
:
true
,
/*
Generates
corresponding
'.map'
file.
*/
"outDir"
:
"./dist"
,
/*
Redirect
output
structure
to
the
directory.
*/
/*
Strict
Type-Checking
Options
*/
"strict"
:
true
,
/*
Enable
all
strict
type-checking
options.
*/
"noImplicitAny"
:
false
,
/*
Raise
error
on
expressions
and
declarations
with
an
implied
'any'
type.
*/
/*
Module
Resolution
Options
*/
"baseUrl"
:
"./src"
,
/*
Base
directory
to
resolve
non-absolute
module
names.
*/
"paths"
:
{
"remix-solidity"
:
[
"./"
]
},
/*
A
series
of
entries
which
re-map
imports
to
lookup
locations
relative
to
the
'baseUrl'.
*/
"typeRoots"
:
[
"./@types"
,
"./node_modules/@types"
],
"esModuleInterop"
:
true
,
/*
Enables
emit
interoperability
between
CommonJS
and
ES
Modules
via
creation
of
namespace
objects
for
all
imports.
Implies
'allowSyntheticDefaultImports'.
*/
/*
Experimental
Options
*/
"experimentalDecorators"
:
false
,
/*
Enables
experimental
support
for
ES
7
decorators.
*/
}
}
\ No newline at end of file
"types"
:
[
"node"
]
},
"include"
:
[
"**/*.ts"
]
}
libs/remix-solidity/tsconfig.lib.json
0 → 100644
View file @
fb478a8d
{
"extends"
:
"./tsconfig.json"
,
"compilerOptions"
:
{
"module"
:
"commonjs"
,
"outDir"
:
"../../dist/out-tsc"
,
"declaration"
:
true
,
"rootDir"
:
"./src"
,
"types"
:
[
"node"
]
},
"exclude"
:
[
"**/*.spec.ts"
],
"include"
:
[
"**/*.ts"
]
}
\ No newline at end of file
workspace.json
View file @
fb478a8d
...
...
@@ -269,19 +269,19 @@
},
"remix-solidity"
:
{
"root"
:
"libs/remix-solidity"
,
"sourceRoot"
:
"libs/remix-solidity/"
,
"sourceRoot"
:
"libs/remix-solidity/
src
"
,
"projectType"
:
"library"
,
"schematics"
:
{},
"architect"
:
{
"lint"
:
{
"builder"
:
"@nrwl/
workspace:run-commands
"
,
"builder"
:
"@nrwl/
linter:lint
"
,
"options"
:
{
"
commands"
:
[
{
"command"
:
"./../../node_modules/.bin/npm-run-all lint"
}
"
linter"
:
"eslint"
,
"config"
:
"libs/remix-solidity/.eslintrc"
,
"tsConfig"
:
[
"libs/remix-solidity/tsconfig.lib.json"
],
"
cwd"
:
"libs/remix-solidity"
"
exclude"
:
[
"**/node_modules/**"
]
}
},
"test"
:
{
...
...
@@ -289,9 +289,6 @@
"options"
:
{
"commands"
:
[
{
"command"
:
"rm -rf ../../dist"
},
{
"command"
:
"./../../node_modules/.bin/npm-run-all test"
}
],
...
...
@@ -299,17 +296,13 @@
}
},
"build"
:
{
"builder"
:
"@nrwl/
workspace:run-commands
"
,
"builder"
:
"@nrwl/
node:package
"
,
"options"
:
{
"commands"
:
[
{
"command"
:
"rm -rf ../../dist"
},
{
"command"
:
"./../../node_modules/.bin/npm-run-all build"
}
],
"cwd"
:
"libs/remix-solidity"
"outputPath"
:
"dist/libs/remix-solidity"
,
"tsConfig"
:
"libs/remix-solidity/tsconfig.lib.json"
,
"packageJson"
:
"libs/remix-solidity/package.json"
,
"main"
:
"libs/remix-solidity/src/index.ts"
,
"assets"
:
[
"libs/remix-solidity/*.md"
]
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment