mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-30 03:23:48 +01:00
Converted everything to use acorn npm package. Updated acorn packages to latest version. Updated acorn parsing to use ES9
This commit is contained in:
parent
06cd584f10
commit
096f984d6b
29
package-lock.json
generated
29
package-lock.json
generated
@ -689,24 +689,9 @@
|
||||
}
|
||||
},
|
||||
"acorn": {
|
||||
"version": "5.7.3",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz",
|
||||
"integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw=="
|
||||
},
|
||||
"acorn-dynamic-import": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/acorn-dynamic-import/-/acorn-dynamic-import-2.0.2.tgz",
|
||||
"integrity": "sha1-x1K9IQvvZ5UBtsbLf8hPj0cVjMQ=",
|
||||
"requires": {
|
||||
"acorn": "4.0.13"
|
||||
},
|
||||
"dependencies": {
|
||||
"acorn": {
|
||||
"version": "4.0.13",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz",
|
||||
"integrity": "sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c="
|
||||
}
|
||||
}
|
||||
"version": "6.2.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-6.2.0.tgz",
|
||||
"integrity": "sha512-8oe72N3WPMjA+2zVG71Ia0nXZ8DpQH+QyyHO+p06jT8eg8FGG3FbcUIi8KziHlAfheJQZeoqbvq1mQSQHXKYLw=="
|
||||
},
|
||||
"acorn-globals": {
|
||||
"version": "4.3.2",
|
||||
@ -715,7 +700,7 @@
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"acorn": "6.1.1",
|
||||
"acorn-walk": "6.1.1"
|
||||
"acorn-walk": "6.2.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"acorn": {
|
||||
@ -744,9 +729,9 @@
|
||||
}
|
||||
},
|
||||
"acorn-walk": {
|
||||
"version": "6.1.1",
|
||||
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.1.1.tgz",
|
||||
"integrity": "sha512-OtUw6JUTgxA2QoqqmrmQ7F2NYqiBPi/L2jqHyFtllhOUvXYQXf0Z1CYUinIfyT4bTCGmrA7gX9FvHA81uzCoVw=="
|
||||
"version": "6.2.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.2.0.tgz",
|
||||
"integrity": "sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA=="
|
||||
},
|
||||
"ajv": {
|
||||
"version": "5.5.2",
|
||||
|
@ -9,9 +9,8 @@
|
||||
"@types/numeral": "0.0.25",
|
||||
"@types/react": "^16.8.6",
|
||||
"@types/react-dom": "^16.8.2",
|
||||
"acorn": "^5.7.3",
|
||||
"acorn-dynamic-import": "^2.0.0",
|
||||
"acorn-walk": "^6.1.1",
|
||||
"acorn": "^6.2.0",
|
||||
"acorn-walk": "^6.2.0",
|
||||
"ajv": "^5.1.5",
|
||||
"ajv-keywords": "^2.0.0",
|
||||
"async": "^2.6.1",
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { FconfSettings } from "./FconfSettings";
|
||||
|
||||
import { parse, Node } from "../../utils/acorn";
|
||||
import { parse, Node } from "acorn";
|
||||
import { dialogBoxCreate } from "../../utils/DialogBox";
|
||||
|
||||
var FconfComments = {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import * as acorn from "../utils/acorn";
|
||||
import * as acorn from "acorn";
|
||||
/**
|
||||
* @license
|
||||
* JavaScript Interpreter
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { setTimeoutRef } from "./utils/SetTimeoutRef";
|
||||
import { parse, Node } from "../utils/acorn";
|
||||
|
||||
import { isValidIPAddress } from "../utils/helpers/isValidIPAddress";
|
||||
import { isString } from "../utils/helpers/isString";
|
||||
|
@ -30,14 +30,14 @@ import { setTimeoutRef } from "./utils/SetTimeoutRef";
|
||||
|
||||
import { generate } from "escodegen";
|
||||
|
||||
import { parse, Node } from "../utils/acorn";
|
||||
import { dialogBoxCreate } from "../utils/DialogBox";
|
||||
import { compareArrays } from "../utils/helpers/compareArrays";
|
||||
import { arrayToString } from "../utils/helpers/arrayToString";
|
||||
import { roundToTwo } from "../utils/helpers/roundToTwo";
|
||||
import { isString } from "../utils/StringHelperFunctions";
|
||||
|
||||
const walk = require("acorn/dist/walk");
|
||||
import { parse, Node } from "acorn";
|
||||
const walk = require("acorn-walk");
|
||||
|
||||
// Netscript Ports are instantiated here
|
||||
export const NetscriptPorts = [];
|
||||
@ -288,7 +288,7 @@ function startNetscript1Script(workerScript) {
|
||||
*/
|
||||
function processNetscript1Imports(code, workerScript) {
|
||||
//allowReserved prevents 'import' from throwing error in ES5
|
||||
const ast = parse(code, { ecmaVersion: 6, allowReserved: true, sourceType: "module" });
|
||||
const ast = parse(code, { ecmaVersion: 9, allowReserved: true, sourceType: "module" });
|
||||
|
||||
var server = workerScript.getServer();
|
||||
if (server == null) {
|
||||
@ -319,7 +319,7 @@ function processNetscript1Imports(code, workerScript) {
|
||||
if (script == null) {
|
||||
throw new Error("'Import' failed due to invalid script: " + scriptName);
|
||||
}
|
||||
let scriptAst = parse(script.code, {ecmaVersion:5, allowReserved:true, sourceType:"module"});
|
||||
let scriptAst = parse(script.code, { ecmaVersion:9, allowReserved:true, sourceType:"module" });
|
||||
|
||||
if (node.specifiers.length === 1 && node.specifiers[0].type === "ImportNamespaceSpecifier") {
|
||||
// import * as namespace from script
|
||||
|
@ -6,11 +6,11 @@
|
||||
* the way
|
||||
*/
|
||||
import * as walk from "acorn-walk";
|
||||
import { parse, Node } from "acorn";
|
||||
|
||||
import { RamCalculationErrorCode } from "./RamCalculationErrorCodes";
|
||||
|
||||
import { RamCosts, RamCostConstants } from "../Netscript/RamCostGenerator";
|
||||
import { parse, Node } from "../../utils/acorn";
|
||||
|
||||
// These special strings are used to reference the presence of a given logical
|
||||
// construct within a user script.
|
||||
@ -215,7 +215,7 @@ async function parseOnlyRamCalculate(otherScripts, code, workerScript) {
|
||||
* that need to be parsed (i.e. are 'import'ed scripts).
|
||||
*/
|
||||
function parseOnlyCalculateDeps(code, currentModule) {
|
||||
const ast = parse(code, {sourceType:"module", ecmaVersion: 8});
|
||||
const ast = parse(code, {sourceType:"module", ecmaVersion: 9});
|
||||
|
||||
// Everything from the global scope goes in ".". Everything else goes in ".function", where only
|
||||
// the outermost layer of functions counts.
|
||||
|
@ -37,7 +37,7 @@
|
||||
if (!options.indent) // JSHint error.character actually is a column index, this fixes underlining on lines using tabs for indentation
|
||||
options.indent = 1; // JSHint default value is 4
|
||||
|
||||
options.esversion = 6;
|
||||
options.esversion = 9;
|
||||
|
||||
JSHINT(sanitizedText, options, options.globals);
|
||||
var errors = JSHINT.data().errors, result = [];
|
||||
|
3631
utils/acorn.js
3631
utils/acorn.js
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user