closure-rs 0.0.1-alpha.3 → 0.0.1-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -90,6 +90,7 @@ crates/jscomp/src/check_super.rs 74bf25295c999b5c Apache-2.0 closure:src/com/goo
90
90
  crates/jscomp/src/check_suspicious_code.rs a3dfb3a369f1d545 Apache-2.0 closure:src/com/google/javascript/jscomp/CheckSuspiciousCode.java; closure:src/com/google/javascript/jscomp/NodeTraversal.java
91
91
  crates/jscomp/src/check_type_import_code_references.rs 1c8684b5a972cc2c Apache-2.0 closure:src/com/google/javascript/jscomp/CheckTypeImportCodeReferences.java; closure:src/com/google/javascript/jscomp/NodeTraversal.java
92
92
  crates/jscomp/src/check_unreachable_code.rs 976ba2f8436db648 Apache-2.0 closure:src/com/google/javascript/jscomp/CheckUnreachableCode.java
93
+ crates/jscomp/src/chunked_vec.rs 322fc2ba37b98b96 Apache-2.0 -
93
94
  crates/jscomp/src/closure_check_module.rs 78e6e50c5a48566c Apache-2.0 closure:src/com/google/javascript/jscomp/ClosureCheckModule.java; closure:src/com/google/javascript/jscomp/NodeUtil.java
94
95
  crates/jscomp/src/closure_code_removal.rs 0e1ff4fa189b4629 Apache-2.0 closure:src/com/google/javascript/jscomp/ClosureCodeRemoval.java; closure:src/com/google/javascript/jscomp/NodeTraversal.java
95
96
  crates/jscomp/src/closure_coding_convention.rs a2056b96c91fe2c4 Apache-2.0 closure:src/com/google/javascript/jscomp/ClosureCodingConvention.java
@@ -1266,7 +1267,7 @@ crates/testing/src/replay/options_fields.rs a5e244d5c6849c54 Apache-2.0 own:orac
1266
1267
  crates/testing/src/replay/options_values.rs e74b73a18838bfd9 Apache-2.0 own:oracle/replay/src/com/google/javascript/jscomp/ReplayValues.java; own:UnitRecorder.java (oracle/patches/0002-recording-hooks.patch)
1267
1268
  crates/testing/src/replay/polyfills.rs a72b3d1b7ecbb363 Apache-2.0 own:oracle/replay/src/com/google/javascript/jscomp/ReplayDsl.java; closure:src/com/google/javascript/jscomp/PolyfillUsageFinder.java; closure:src/com/google/javascript/jscomp/RewritePolyfills.java; closure:src/com/google/javascript/jscomp/IsolatePolyfills.java; closure:test/com/google/javascript/jscomp/GuardedCallbackTest.java; closure:test/com/google/javascript/jscomp/RewritePolyfillsTest.java
1268
1269
  crates/testing/src/replay/process_closure_provides_and_requires_test_helpers.rs 1daef3870df210df Apache-2.0 own:oracle/replay/src/com/google/javascript/jscomp/ReplayDsl.java; own:oracle/replay/src/com/google/javascript/jscomp/ReplayValues.java; closure:test/com/google/javascript/jscomp/ProcessClosureProvidesAndRequiresTest.java; own:UnitRecorder.java (oracle/patches/0002-recording-hooks.patch); closure:src/com/google/javascript/jscomp/AbstractCompiler.java
1269
- crates/testing/src/replay/process_defines_test_helpers.rs d726a0b1cd12626a Apache-2.0 own:UnitRecorder.java (oracle/patches/0002-recording-hooks.patch); own:oracle/replay/src/com/google/javascript/jscomp/ReplayValues.java; closure:test/com/google/javascript/jscomp/ProcessDefinesTest.java
1270
+ crates/testing/src/replay/process_defines_test_helpers.rs f1c0994e7c3683e1 Apache-2.0 own:UnitRecorder.java (oracle/patches/0002-recording-hooks.patch); own:oracle/replay/src/com/google/javascript/jscomp/ReplayValues.java; closure:test/com/google/javascript/jscomp/ProcessDefinesTest.java; own:oracle/replay/src/com/google/javascript/jscomp/ReplayDsl.java; closure:src/com/google/javascript/jscomp/ProcessDefines.java
1270
1271
  crates/testing/src/replay/proto_values.rs e74b73a18838bfd9 Apache-2.0 own:UnitRecorder.java (oracle/patches/0002-recording-hooks.patch); own:oracle/replay/src/com/google/javascript/jscomp/ReplayValues.java
1271
1272
  crates/testing/src/replay/pure_function_identifier_helpers.rs 41d4f7c05c0146de Apache-2.0 closure:test/com/google/javascript/jscomp/PureFunctionIdentifierTest.java; closure:test/com/google/javascript/jscomp/CompilerTestCase.java; closure:src/com/google/javascript/jscomp/NodeTraversal.java; closure:src/com/google/javascript/jscomp/testing/JSCompCorrespondences.java
1272
1273
  crates/testing/src/replay/reference_collector_test_helpers.rs 7d5ff723a72fc8bc Apache-2.0 own:oracle/replay/src/com/google/javascript/jscomp/ReplayDsl.java; own:oracle/replay/src/com/google/javascript/jscomp/ReplayValues.java; closure:src/com/google/javascript/jscomp/ReferenceCollector.java; own:oracle/replay/helpers/com/google/javascript/jscomp/ReferenceCollectorTest_Helpers.java; closure:src/com/google/javascript/jscomp/AbstractVar.java; closure:src/com/google/javascript/jscomp/ReferenceCollection.java; closure:src/com/google/javascript/jscomp/Reference.java; closure:src/com/google/javascript/jscomp/Scope.java; closure:src/com/google/javascript/jscomp/ReferenceMap.java
@@ -1274,7 +1275,7 @@ crates/testing/src/replay/registry.rs 6c5cf44fa82bab44 Apache-2.0 own:oracle/rep
1274
1275
  crates/testing/src/replay/remove_unused_code_helpers.rs f9ba8b6cf6b9b31c Apache-2.0 own:oracle/replay/src/com/google/javascript/jscomp/ReplayDsl.java; closure:src/com/google/javascript/jscomp/RemoveUnusedCode.java; closure:test/com/google/javascript/jscomp/RemoveUnusedCodeTest.java; closure:src/com/google/javascript/jscomp/CompilerPass.java; closure:test/com/google/javascript/jscomp/RemoveUnusedCodeNameAnalyzerTest.java
1275
1276
  crates/testing/src/replay/replace_css_names_test_helpers.rs 9e24a97aba5846db Apache-2.0 closure:test/com/google/javascript/jscomp/ReplaceCssNamesTest.java; closure:src/com/google/javascript/jscomp/CssRenamingMap.java; own:UnitRecorder.java (oracle/patches/0002-recording-hooks.patch); own:oracle/replay/src/com/google/javascript/jscomp/ReplayValues.java; closure:src/com/google/javascript/jscomp/ReplaceCssNames.java
1276
1277
  crates/testing/src/replay/replace_id_generators_test_helpers.rs b4a8188ea4524080 Apache-2.0 closure:test/com/google/javascript/jscomp/ReplaceIdGeneratorsTest.java; own:UnitRecorder.java (oracle/patches/0002-recording-hooks.patch); closure:src/com/google/javascript/jscomp/ReplaceIdGenerators.java; own:oracle/replay/src/com/google/javascript/jscomp/ReplayDsl.java
1277
- crates/testing/src/replay/replace_messages_helpers.rs 418b9c47143d44be Apache-2.0 own:oracle/replay/src/com/google/javascript/jscomp/ReplayValues.java; closure:test/com/google/javascript/jscomp/ReplaceMessagesTest.java; own:oracle/replay/src/com/google/javascript/jscomp/ReplayDsl.java; own:UnitRecorder.java (oracle/patches/0002-recording-hooks.patch); closure:src/com/google/javascript/jscomp/ReplaceMessages.java
1278
+ crates/testing/src/replay/replace_messages_helpers.rs 426d6d7b398ea42c Apache-2.0 own:oracle/replay/src/com/google/javascript/jscomp/ReplayValues.java; closure:test/com/google/javascript/jscomp/ReplaceMessagesTest.java; own:oracle/replay/src/com/google/javascript/jscomp/ReplayDsl.java; own:UnitRecorder.java (oracle/patches/0002-recording-hooks.patch); closure:src/com/google/javascript/jscomp/ReplaceMessages.java; closure:src/com/google/javascript/jscomp/GoogleJsMessageIdGenerator.java
1278
1279
  crates/testing/src/replay/replace_strings_test_helpers.rs 20daf97a04f52270 Apache-2.0 own:oracle/replay/src/com/google/javascript/jscomp/ReplayValues.java; own:UnitRecorder.java (oracle/patches/0002-recording-hooks.patch); closure:src/com/google/javascript/jscomp/ReplaceStrings.java; own:oracle/replay/src/com/google/javascript/jscomp/ReplayDsl.java; closure:src/com/google/javascript/jscomp/NodeTraversal.java; closure:test/com/google/javascript/jscomp/ReplaceStringsTest.java
1279
1280
  crates/testing/src/replay/replay_bridge.rs 51a99d6cd730fad9 Apache-2.0 own:oracle/replay/src/com/google/javascript/jscomp/ReplayBridge.java
1280
1281
  crates/testing/src/replay/replay_compiler_test.rs 3fd5ee14fa767ad8 Apache-2.0 own:oracle/replay/src/com/google/javascript/jscomp/ReplayCompilerTest.java; own:oracle/replay/src/com/google/javascript/jscomp/ReplayDsl.java
package/README.md CHANGED
@@ -69,7 +69,9 @@ No shell is involved, so values need no quoting. The flags are the Java compiler
69
69
 
70
70
  `run(callback)` starts the process and returns it. The callback receives `(exitCode, stdout,
71
71
  stderr)` once the process has closed; for a non-zero exit code `stderr` starts with the full
72
- command line. Without `--js` the compiler reads the input from stdin: write it to the returned
72
+ command line. If the process is ended by a signal (for example killed by the out-of-memory
73
+ killer), `exitCode` is 128 + the signal number, as a shell reports it (137 for `SIGKILL`), and
74
+ `stderr` names the signal. The official package passes `null` in that case. Without `--js` the compiler reads the input from stdin: write it to the returned
73
75
  process's `stdin` and end it.
74
76
 
75
77
  ### Types
Binary file
Binary file
package/cli.js CHANGED
@@ -28,7 +28,13 @@ getFirstSupportedPlatform(platforms);
28
28
 
29
29
  const compiler = new Compiler(args);
30
30
  compiler.spawnOptions = {stdio: 'inherit'};
31
- const child = compiler.run((exitCode) => {
31
+ const child = compiler.run((exitCode, stdout, stderr) => {
32
+ // stdio is inherited, so the binary's own output is already on the terminal; only the wrapper's
33
+ // note about a process ended by a signal (exit code 128 + signal number) is printed here.
34
+ const signal = /closure-rs was terminated by signal .*/.exec(stderr);
35
+ if (signal) {
36
+ process.stderr.write(`${signal[0]}\n`);
37
+ }
32
38
  process.exitCode = exitCode;
33
39
  });
34
40
  child.on('error', (e) => {
package/lib/node/index.js CHANGED
@@ -7,14 +7,28 @@
7
7
  // - `JAR_PATH` defaults to null, so no JVM arguments are added and `extraCommandArgs` (JVM
8
8
  // arguments in the official package) are ignored unless a caller sets JAR_PATH itself;
9
9
  // - a spawn failure calls the callback once; the official class also calls it a second time
10
- // from the 'close' event (Node emits 'error' and then 'close' with a negative code).
10
+ // from the 'close' event (Node emits 'error' and then 'close' with a negative code);
11
+ // - a process ended by a signal gives the callback 128 + the signal number (as a shell reports
12
+ // it) instead of null, and stderr names the signal: the official class passes null on, which
13
+ // an `if (exitCode)` check takes for success.
11
14
  import {spawn} from 'node:child_process';
15
+ import {constants as osConstants} from 'node:os';
12
16
  import path from 'node:path';
13
17
  import {fileURLToPath} from 'node:url';
14
- import {getNativeImagePath, platformPackageName} from '../utils.js';
18
+ import {getNativeImagePath} from '../utils.js';
15
19
 
16
20
  const resolved = getNativeImagePath();
17
21
 
22
+ /** The usual cause of a signal, appended to the message for a process ended by one. */
23
+ const SIGNAL_HINTS = {
24
+ SIGKILL: ' (on Linux usually the out-of-memory killer: check the memory limit of the machine or ' +
25
+ 'container, and how many compiles run at once)',
26
+ SIGILL: ' (an instruction this CPU does not support)',
27
+ SIGSEGV: ' (a crash)',
28
+ SIGBUS: ' (a crash)',
29
+ SIGABRT: ' (an abort)',
30
+ SIGSYS: ' (a system call blocked by a seccomp profile, for example in a container)',
31
+ };
18
32
  /**
19
33
  * The executable `run()` spawns: the closure-rs binary from the platform package (or
20
34
  * CLOSURE_RS_BINARY). When neither exists, 'closure-rs' is looked up on PATH, just as the official
@@ -111,13 +125,19 @@ export default class Compiler {
111
125
  err += chunk;
112
126
  });
113
127
  }
114
- child.on('close', (code) => {
128
+ child.on('close', (code, signal) => {
129
+ if (code === null && signal) {
130
+ const number = osConstants.signals[signal] || 0;
131
+ finish(128 + number, this.prependFullCommand(
132
+ `${err}closure-rs was terminated by signal ${signal}${SIGNAL_HINTS[signal] || ''}.`));
133
+ return;
134
+ }
115
135
  finish(code, code !== 0 ? this.prependFullCommand(err) : err);
116
136
  });
117
137
  child.on('error', (e) => {
118
138
  finish(1, this.prependFullCommand(
119
- 'Process spawn error. Is the closure-rs binary installed? It comes from the optional ' +
120
- `package ${platformPackageName}; CLOSURE_RS_BINARY can point at a binary instead.\n` +
139
+ 'Process spawn error. Is the closure-rs binary installed? It ships in this package under ' +
140
+ `bin/${process.platform}-${process.arch}/; CLOSURE_RS_BINARY can point at a binary instead.\n` +
121
141
  e.message));
122
142
  });
123
143
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "closure-rs",
3
- "version": "0.0.1-alpha.3",
3
+ "version": "0.0.1-alpha.5",
4
4
  "description": "Rust port of the Closure Compiler CLI. Not affiliated with or published by Google.",
5
5
  "repository": {
6
6
  "type": "git",