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

Update dependencies. Fix weird pnpm reinstall issue. #537

Merged
merged 1 commit into from
Jul 16, 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
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ tools
tsconfig*.json
web-test/
yarn.lock
pnpm-workspace.yaml
34 changes: 17 additions & 17 deletions bin/peggy-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,11 @@ function readStream(inputStream) {
}

function readFile(name) {
let f = null;
try {
f = fs.readFileSync(name, "utf8");
return fs.readFileSync(name, "utf8");
} catch (e) {
throw new InvalidArgumentError(`Can't read from file "${name}".`, e);
}
return f;
}

async function ensureDirectoryExists(filename) {
Expand Down Expand Up @@ -161,13 +159,12 @@ class PeggyCLI extends Command {
"-D, --dependencies <json>",
"Dependencies, in JSON object format with variable:module pairs. (Can be specified multiple times).",
(val, prev = {}) => {
let v = null;
try {
v = JSON.parse(val);
const v = JSON.parse(val);
return Object.assign(prev, v);
} catch (e) {
throw new InvalidArgumentError(`Error parsing JSON: ${e.message}`);
}
return Object.assign(prev, v);
}
)
.option(
Expand Down Expand Up @@ -477,15 +474,12 @@ class PeggyCLI extends Command {
* @returns {peggy.BuildOptionsBase}
*/
addExtraOptionsJSON(json, source) {
let extraOptions = undefined;

try {
extraOptions = JSON.parse(json);
const extraOptions = JSON.parse(json);
return this.addExtraOptions(extraOptions, source);
} catch (e) {
throw new InvalidArgumentError(`Error parsing JSON: ${e.message}`);
}

return this.addExtraOptions(extraOptions, source);
}

/**
Expand Down Expand Up @@ -667,7 +661,8 @@ class PeggyCLI extends Command {
try {
for (const source of this.inputFiles) {
const input = { source, text: null };
this.verbose("CLI", errorText = `reading input "${source}"`);
errorText = `reading input "${source}"`;
this.verbose("CLI", errorText);
if (source === "-") {
input.source = "stdin";
this.std.in.resume();
Expand All @@ -687,25 +682,30 @@ class PeggyCLI extends Command {
// This is wrong. It's a hack in place until source generation is fixed.
this.argv.grammarSource = sources[0].source;

this.verbose("CLI", errorText = "parsing grammar");
errorText = "parsing grammar";
this.verbose("CLI", errorText);
const source = peggy.generate(sources, this.argv); // All of the real work.

this.verbose("CLI", errorText = "opening output stream");
errorText = "opening output stream";
this.verbose("CLI", errorText);
const outputStream = await this.openOutputStream();

// If option `--ast` is specified, `generate()` returns an AST object
if (this.progOptions.ast) {
this.verbose("CLI", errorText = "writing AST");
await this.writeOutput(outputStream, JSON.stringify(source, null, 2));
} else {
this.verbose("CLI", errorText = "writing sourceMap");
errorText = "writing sourceMap";
this.verbose("CLI", errorText);
const mappedSource = await this.writeSourceMap(source);

this.verbose("CLI", errorText = "writing parser");
errorText = "writing parser";
this.verbose("CLI", errorText);
await this.writeOutput(outputStream, mappedSource);

exitCode = 2;
this.verbose("CLI", errorText = "running test");
errorText = "running test";
this.verbose("CLI", errorText);
await this.test(mappedSource);
}
} catch (error) {
Expand Down
1 change: 0 additions & 1 deletion bin/watcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class Watcher extends EventEmitter {
this.watchers = [];

for (const dir of dirs) {
// eslint-disable-next-line func-style -- Needs "this"
const changed = (_typ, fn) => {
if (typeof this.timeout === "symbol") {
return;
Expand Down
2 changes: 1 addition & 1 deletion docs/js/benchmark-bundle.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/js/test-bundle.min.js

Large diffs are not rendered by default.

Loading