Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump @solidity-parser/parser from 0.17.0 to 0.18.0 #976

Merged
merged 1 commit into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 5 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@
"eslint-plugin-import": "^2.28.1",
"esm-utils": "^4.1.2",
"esmock": "^2.3.8",
"exports-loader": "^5.0.0",
"jest": "^29.6.3",
"jest-light-runner": "^0.6.0",
"jest-snapshot-serializer-ansi": "^2.1.0",
Expand All @@ -110,9 +109,8 @@
"webpack-cli": "^5.1.4"
},
"dependencies": {
"@solidity-parser/parser": "^0.17.0",
"semver": "^7.5.4",
"solidity-comments-extractor": "^0.0.8"
"@solidity-parser/parser": "^0.18.0",
"semver": "^7.5.4"
},
"peerDependencies": {
"prettier": ">=2.3.0"
Expand Down
8 changes: 4 additions & 4 deletions src/comments/printer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ function isIndentableBlockComment(comment) {
// we can fix the indentation of each line. The stars in the `/*` and
// `*/` delimiters are not included in the comment value, so add them
// back first.
const lines = `*${comment.raw}*`.split('\n');
const lines = `*${comment.value}*`.split('\n');
return lines.length > 1 && lines.every((line) => line.trim()[0] === '*');
}

function printIndentableBlockComment(comment) {
const lines = comment.raw.split('\n');
const lines = comment.value.split('\n');

return [
'/*',
Expand Down Expand Up @@ -49,10 +49,10 @@ export function printComment(commentPath, options) {
return printed;
}

return `/*${comment.raw}*/`;
return `/*${comment.value}*/`;
}
case 'LineComment':
return `//${comment.raw.trimEnd()}`;
return `//${comment.value.trimEnd()}`;
default:
throw new Error(`Not a comment: ${JSON.stringify(comment)}`);
}
Expand Down
4 changes: 1 addition & 3 deletions src/parser.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import extractComments from 'solidity-comments-extractor';
// https://prettier.io/docs/en/plugins.html#parsers
import parser from '@solidity-parser/parser';
import coerce from 'semver/functions/coerce.js';
Expand All @@ -16,8 +15,7 @@ const tryHug = (node, operators) => {

function parse(text, _parsers, options = _parsers) {
const compiler = coerce(options.compiler);
const parsed = parser.parse(text, { loc: true, range: true });
parsed.comments = extractComments(text);
const parsed = parser.parse(text, { loc: true, range: true, comments: true });

parser.visit(parsed, {
PragmaDirective(ctx) {
Expand Down
23 changes: 0 additions & 23 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import path from 'node:path';
import { createRequire } from 'node:module';
import createEsmUtils from 'esm-utils';

const require = createRequire(import.meta.url);
const { __dirname } = createEsmUtils(import.meta);

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

// We tell webpack to use the browser friendly package.
resolve: {
alias: {
'@solidity-parser/parser': '@solidity-parser/parser/dist/index.iife.js'
}
},

module: {
rules: [
{
// We tell webpack to append "module.exports = SolidityParser;" at the
// end of the file.
test: require.resolve('@solidity-parser/parser/dist/index.iife.js'),
loader: 'exports-loader',
options: {
type: 'commonjs',
exports: 'single SolidityParser'
}
}
]
},
optimization: {
minimize: isEnvProduction
},
Expand Down