Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
go-version-file: 'go.mod'
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 18
node-version: 24
- name: Install libpcap-dev
run: sudo apt-get install -y libpcap-dev
- name: Run tests
Expand Down
20 changes: 10 additions & 10 deletions internal/staticanalysis/parsing/babel-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,10 @@
"use strict";

import fs from "fs";
import parser from "@babel/parser";
import {parseArgs} from "node:util";
import { parse } from "@babel/parser";
import { parseArgs } from "node:util";
import path from "node:path";

// See https://github.com/babel/babel/issues/13855
import _traverse from "@babel/traverse";

const traverse = _traverse.default;
import traverse from "@babel/traverse";

// used to signal to parent process that parsing could not complete due to syntax errors
const fatalSyntaxErrorMarker = "FATAL SYNTAX ERROR";
Expand Down Expand Up @@ -201,7 +197,9 @@ function traverseAst(ast, parseData, disableScope) {
},
BigIntLiteral: function(path) {
const loc = position(path.node);
this.parseData.logLiteral("Numeric", path.node.value, loc, true, path.node.extra);
const valStr = path.node.value.toString();
const extra = path.node.extra ? { ...path.node.extra, rawValue: valStr } : null;
this.parseData.logLiteral("Numeric", valStr, loc, true, extra);
},
RegExpLiteral: function(path) {
const loc = position(path.node);
Expand Down Expand Up @@ -236,7 +234,9 @@ function traverseAst(ast, parseData, disableScope) {
},
BigIntLiteral: function(path) {
const loc = position(path.node);
this.parseData.logLiteral("Numeric", path.node.value, loc, false, path.node.extra);
const valStr = path.node.value.toString();
const extra = path.node.extra ? { ...path.node.extra, rawValue: valStr } : null;
this.parseData.logLiteral("Numeric", valStr, loc, false, extra);
},
RegExpLiteral: function(path) {
const loc = position(path.node);
Expand All @@ -262,7 +262,7 @@ function parseFile(fileName, allowSyntaxErrors, includeAST) {
parseData.logInfo("InputLength", sourceCode.length.toString());

try {
const ast = parser.parse(sourceCode, {
const ast = parse(sourceCode, {
errorRecovery: allowSyntaxErrors,
sourceType: "unambiguous" // parser is allowed to parse input as either script or module
});
Expand Down
160 changes: 76 additions & 84 deletions internal/staticanalysis/parsing/package-lock.json

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

4 changes: 2 additions & 2 deletions internal/staticanalysis/parsing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0.0",
"type": "module",
"dependencies": {
"@babel/parser": "^7.29.3",
"@babel/traverse": "^7.29.0"
"@babel/parser": "^8.0.0",
"@babel/traverse": "^8.0.0"
}
}
Loading