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
27 changes: 12 additions & 15 deletions build/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
import { resolve, dirname } from "path";
import url from "url";

import nodeResolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import alias from "rollup-plugin-alias";
import inject from "rollup-plugin-inject";
import replace from "rollup-plugin-replace";
import babel from "rollup-plugin-babel";
import json from "rollup-plugin-json";
import { terser } from "rollup-plugin-terser";
import alias from "@rollup/plugin-alias";
import inject from "@rollup/plugin-inject";
import replace from "@rollup/plugin-replace";
import babel from "@rollup/plugin-babel";
import json from "@rollup/plugin-json";
import terser from "@rollup/plugin-terser";

const __dirname = dirname(url.fileURLToPath(import.meta.url));
const SRC_DIR = resolve(__dirname, "..", "src");
const BUILD_DIR = resolve(__dirname, "..", "build");
const getPath = (file) => url.fileURLToPath(new URL(file, import.meta.url));

export default {
input: resolve(SRC_DIR, "index.js"),
input: getPath("../src/index.js"),
output: {
file: "standalone.js",
format: "umd",
Expand All @@ -35,18 +32,18 @@ export default {
}),
commonjs(),
alias({
entries: [
{ find: "assert", replacement: resolve(BUILD_DIR, "shims/assert.js") },
],
entries: [{ find: "assert", replacement: getPath("./shims/assert.js") }],
}),
inject({
Buffer: resolve(BUILD_DIR, "shims/buffer.js"),
Buffer: getPath("./shims/buffer.js"),
}),
replace({
preventAssignment: true,
"process.arch": JSON.stringify("x32"),
}),
json(),
babel({
babelHelpers: "bundled",
babelrc: false,
plugins: [],
compact: false,
Expand Down
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,15 @@
"php-parser": "^3.1.5"
},
"devDependencies": {
"@babel/preset-env": "^7.22.10",
"@babel/preset-env": "^7.22.14",
"@rollup/plugin-alias": "^5.0.0",
"@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-commonjs": "^25.0.4",
"@rollup/plugin-node-resolve": "^15.1.0",
"@rollup/plugin-inject": "^5.0.3",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.2.1",
"@rollup/plugin-replace": "^5.0.2",
"@rollup/plugin-terser": "^0.4.3",
"codecov": "3.8.3",
"cross-env": "^7.0.2",
"eslint": "8.47.0",
Expand All @@ -42,13 +48,7 @@
"jest-light-runner": "^0.5.0",
"jest-snapshot-serializer-raw": "^1.1.0",
"prettier": "^3.0.1",
"rollup": "^2.75.7",
"rollup-plugin-alias": "^2.0.0",
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-inject": "^3.0.1",
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-replace": "^2.1.0",
"rollup-plugin-terser": "^7.0.2",
"rollup": "^3.28.1",
"strip-ansi": "^7.1.0"
},
"peerDependencies": {
Expand All @@ -63,10 +63,10 @@
"fix:prettier": "prettier . --write",
"test": "yarn test:node && yarn test:standalone",
"test:node": "jest",
"test:standalone": "yarn run build-standalone && cross-env RUN_STANDALONE_TESTS=true yarn jest",
"test:standalone": "yarn run build && cross-env RUN_STANDALONE_TESTS=true yarn jest",
"prepublishOnly": "yarn test",
"prettier": "prettier --plugin=src/index.js --parser=php",
"build-standalone": "rollup -c build/rollup.config.js",
"build": "rollup --config build/rollup.config.js",
"debug": "node --inspect-brk node_modules/.bin/jest --runInBand"
}
}
3 changes: 0 additions & 3 deletions src/needs-parens.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import assert from "assert";
import { getPrecedence, shouldFlatten, isBitwiseOperator } from "./util.js";

function needsParens(path) {
Expand Down Expand Up @@ -92,8 +91,6 @@ function needsParens(path) {
}

if (pp === np && key === "right") {
assert.strictEqual(parent.right, node);
Comment thread
czosel marked this conversation as resolved.

return true;
}

Expand Down
Loading