Skip to content

Commit ef6df81

Browse files
authored
Bump @solidity-parser/parser from 0.17.0 to 0.18.0 (#976)
1 parent 7c9ce8d commit ef6df81

5 files changed

Lines changed: 12 additions & 65 deletions

File tree

package-lock.json

Lines changed: 5 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@
9696
"eslint-plugin-import": "^2.28.1",
9797
"esm-utils": "^4.1.2",
9898
"esmock": "^2.3.8",
99-
"exports-loader": "^5.0.0",
10099
"jest": "^29.6.3",
101100
"jest-light-runner": "^0.6.0",
102101
"jest-snapshot-serializer-ansi": "^2.1.0",
@@ -110,9 +109,8 @@
110109
"webpack-cli": "^5.1.4"
111110
},
112111
"dependencies": {
113-
"@solidity-parser/parser": "^0.17.0",
114-
"semver": "^7.5.4",
115-
"solidity-comments-extractor": "^0.0.8"
112+
"@solidity-parser/parser": "^0.18.0",
113+
"semver": "^7.5.4"
116114
},
117115
"peerDependencies": {
118116
"prettier": ">=2.3.0"

src/comments/printer.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ function isIndentableBlockComment(comment) {
77
// we can fix the indentation of each line. The stars in the `/*` and
88
// `*/` delimiters are not included in the comment value, so add them
99
// back first.
10-
const lines = `*${comment.raw}*`.split('\n');
10+
const lines = `*${comment.value}*`.split('\n');
1111
return lines.length > 1 && lines.every((line) => line.trim()[0] === '*');
1212
}
1313

1414
function printIndentableBlockComment(comment) {
15-
const lines = comment.raw.split('\n');
15+
const lines = comment.value.split('\n');
1616

1717
return [
1818
'/*',
@@ -49,10 +49,10 @@ export function printComment(commentPath, options) {
4949
return printed;
5050
}
5151

52-
return `/*${comment.raw}*/`;
52+
return `/*${comment.value}*/`;
5353
}
5454
case 'LineComment':
55-
return `//${comment.raw.trimEnd()}`;
55+
return `//${comment.value.trimEnd()}`;
5656
default:
5757
throw new Error(`Not a comment: ${JSON.stringify(comment)}`);
5858
}

src/parser.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import extractComments from 'solidity-comments-extractor';
21
// https://prettier.io/docs/en/plugins.html#parsers
32
import parser from '@solidity-parser/parser';
43
import coerce from 'semver/functions/coerce.js';
@@ -16,8 +15,7 @@ const tryHug = (node, operators) => {
1615

1716
function parse(text, _parsers, options = _parsers) {
1817
const compiler = coerce(options.compiler);
19-
const parsed = parser.parse(text, { loc: true, range: true });
20-
parsed.comments = extractComments(text);
18+
const parsed = parser.parse(text, { loc: true, range: true, comments: true });
2119

2220
parser.visit(parsed, {
2321
PragmaDirective(ctx) {

webpack.config.js

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import path from 'node:path';
2-
import { createRequire } from 'node:module';
32
import createEsmUtils from 'esm-utils';
43

5-
const require = createRequire(import.meta.url);
64
const { __dirname } = createEsmUtils(import.meta);
75

86
// This is the production and development configuration.
@@ -29,27 +27,6 @@ export default (webpackEnv) => {
2927
bail: isEnvProduction,
3028
devtool: 'source-map',
3129

32-
// We tell webpack to use the browser friendly package.
33-
resolve: {
34-
alias: {
35-
'@solidity-parser/parser': '@solidity-parser/parser/dist/index.iife.js'
36-
}
37-
},
38-
39-
module: {
40-
rules: [
41-
{
42-
// We tell webpack to append "module.exports = SolidityParser;" at the
43-
// end of the file.
44-
test: require.resolve('@solidity-parser/parser/dist/index.iife.js'),
45-
loader: 'exports-loader',
46-
options: {
47-
type: 'commonjs',
48-
exports: 'single SolidityParser'
49-
}
50-
}
51-
]
52-
},
5330
optimization: {
5431
minimize: isEnvProduction
5532
},

0 commit comments

Comments
 (0)