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

Allow error messages to be reported in Sass workers #121

Closed
wants to merge 2 commits into from

Conversation

BobobUnicorn
Copy link
Contributor

This upgrades the rules_nodejs version to 2.0.1, enabling us to make use
of the run_node functions provided there.

The sass_wrapper.js is modified to directly translate argv into object
arguments that are passed to the public API that is part of sass.

Minimist is also added as a dependency.

Fixes #96.

This upgrades the rules_nodejs version to 2.0.1, enabling us to make use
of the `run_node` functions provided there.

The sass_wrapper.js is modified to directly translate argv into object
arguments that are passed to the public API that is part of `sass`.

Minimist is also added as a dependency.
@BobobUnicorn BobobUnicorn marked this pull request as ready for review September 5, 2020 21:30
@BobobUnicorn
Copy link
Contributor Author

@nex3 @jelbourn please review :)

Comment on lines -242 to -245

Args:
ctx: The Bazel build context

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why these cosmetic changes?


const args = process.argv.slice(2);
if (runAsWorker(args)) {
debug('Starting Sass compiler persistent worker...');
runWorkerLoop(args => sass.cli_pkg_main_0_(args));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the goal of this change? It adds a lot of complexity and requires us to update multiple places any time we want to change which arguments are passed in to the compiler.

Copy link
Contributor Author

@BobobUnicorn BobobUnicorn Sep 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's to address #96. The issue is that the Dart _Future is not directly translatable to JS promises, so the worker loop doesn't have any idea when the compilation is actually done (or if it succeeded). At present, it just treats the unknown object as "truthy".

I couldn't find a way to wrap a Future in a Promise on the JS side; it may have to be done in Dart.

One other option could be to try and farm out to an execFile so we can just pass the arguments directly.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather fix the root cause by adding support to http://github.com/google/dart_cli_pkg for wrapping futures in Promises than make this package harder to maintain going forward.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing that's google/dart_cli_pkg#50? I'm happy to take a look there; let me shelve this for now then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Errors not properly reported in worker mode
3 participants