Skip to content

Commit bf7d6c7

Browse files
authored
Merge pull request #595 from stephensli/fix/commonjs-default-exporting
fix: use esModuleInterop to resolve commonjs default require
2 parents c5aae68 + 25c98cb commit bf7d6c7

18 files changed

+33
-51
lines changed

abi.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,6 @@ function update (compilerVersion, abi) {
5858
return abi;
5959
}
6060

61-
export default {
61+
export = {
6262
update
6363
};

downloadCurrentVersion.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
// This is used to download the correct binary version
44
// as part of the prepublish step.
55

6-
import * as pkg from './package.json';
76
import * as fs from 'fs';
87
import { https } from 'follow-redirects';
9-
import * as MemoryStream from 'memorystream';
8+
import MemoryStream from 'memorystream';
109
import { keccak256 } from 'js-sha3';
10+
const pkg = require('./package.json');
1111

1212
function getVersionList (cb) {
1313
console.log('Retrieving available version list...');

index.ts

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,4 @@
11
import wrapper from './wrapper';
22

33
const soljson = require('./soljson.js');
4-
const wrapped = wrapper(soljson);
5-
6-
const {
7-
version,
8-
semver,
9-
license,
10-
lowlevel,
11-
features,
12-
compile,
13-
loadRemoteVersion,
14-
setupMethods
15-
} = wrapped;
16-
17-
export {
18-
version,
19-
semver,
20-
license,
21-
lowlevel,
22-
features,
23-
compile,
24-
loadRemoteVersion,
25-
setupMethods
26-
};
4+
export = wrapper(soljson);

linker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as assert from 'assert';
1+
import assert from 'assert';
22
import { keccak256 } from 'js-sha3';
33

44
function libraryHashPlaceholder (input) {
@@ -88,7 +88,7 @@ const findLinkReferences = function (bytecode) {
8888
return linkReferences;
8989
};
9090

91-
export default {
91+
export = {
9292
linkBytecode,
9393
findLinkReferences
9494
};

smtchecker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function smtCallback (solverFunction, solver?: any) {
3636
};
3737
}
3838

39-
export default {
39+
export = {
4040
handleSMTQueries,
4141
smtCallback
4242
};

smtsolver.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function solve (query, solver) {
6767
return solverOutput;
6868
}
6969

70-
export default {
70+
export = {
7171
smtSolver: solve,
7272
availableSolvers: solvers
7373
};

solc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as commander from 'commander';
44
import * as fs from 'fs';
55
import * as os from 'os';
66
import * as path from 'path';
7-
import * as solc from './index';
7+
import solc from './index';
88
import smtchecker from './smtchecker';
99
import smtsolver from './smtsolver';
1010

test/abi.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as tape from 'tape';
1+
import tape from 'tape';
22
import abi from '../abi';
33

44
tape('ABI translator', function (t) {

test/cli.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import * as tape from 'tape';
2-
import * as spawn from 'tape-spawn';
1+
import tape from 'tape';
2+
import spawn from 'tape-spawn';
33
import * as path from 'path';
4-
import * as pkg from '../package.json';
4+
const pkg = require('../package.json');
55

66
tape('CLI', function (t) {
77
t.test('--version', function (st) {

test/compiler.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import * as assert from 'assert';
2-
import * as tape from 'tape';
1+
import assert from 'assert';
2+
import tape from 'tape';
33
import * as semver from 'semver';
4-
import * as solc from '../';
4+
import solc from '../';
55
import linker from '../linker';
66
import { execSync } from 'child_process';
77
import wrapper from '../wrapper';

0 commit comments

Comments
 (0)