Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add REPL top level await support (#1383)
* feat: add repl top level await support * refactor: add more files as dist-raw, adjust primordial imports * refactor: add flag support for experimental repl await * refactor: add support for Typescript input in experimental repl await * refactor: conditionally await eval result * chore: update node-repl-await file * refactor: dynamically exclude TLA diagnostics when --experimental-repl-await is set * refactor: exclude sourceMap when transpiling for experimentalReplAwait * refactor: add acorn & acorn-walk as dependencies and remove them from dist-raw * refactor: allow setting experimentalReplAwait via env & tsconfig * refactor: adjust evalCode signature to avoid being a breaking change * refactor: improve top level await mechanism * refactor: adjust ignored diagnostic codes related to top level await/for await * refactor: use evalCodeInternal and revert evalCode to previous signature * refactor: await evalAndExitOnTsError result during bin `main` * refactor: adjust node-primordials * chore: remove unused require * refactor: revert to previous implementation of node-primordials, add missing methods * refactor: adjust node-repl-await to use compatible syntax up to node 12 * fix: typo in node-repl-await * refactor: add unhandledRejection listener * chore: remove node-primordials dts * fix: typo in node version comparison * test: add top level await tests * test: fix tla test * test: add upstream test suite of tla * feat: allow REPL to be configured on start * refactor: return repl server on `start` * refactor: use a different context when useGlobal = false * test: adjust upstream tests to latest changes * refactor: adjust new line placement on top level await processing * refactor: adjust ignored codes related to TLA * test: adjust TLA tests * refactor: override target when experimental repl await is set * test: adjust tla test * test: adjust tla tests * test: adjust tla tests * test: move tla upstream tests to a separate file * refactor: lazy load processTopLevelAwait * refactor: correctly handle errors for async eval result * refactor: throw error if target is not compatible with experimental repl await * refactor: adjust main call in bin * refactor: don't exclude tla diagnostic codes when mode is "entrypoint" * refactor: move new repl start implementation to startInternal * fix: typo in config * test: adjust tla tests * test: normalize object usage in commandline * test: move upstream tla deps from testlib to its file * test: fix formatObjectCommandLine * refactor: adjust type assertion * refactor: adjust _eval to iterate changes using a for loop * refactor: adjust execution implementation in nodeEval * test: add tla test * refactor: fix processTopLevelAwait return type * refactor: restore `main` to sync, implement callback mechanism * refactor: small adjustments in repl * refactor: remove TLA support from [stdin] & [eval] * refactor: adjust tla tests * refactor: improve code reuse in repl tests * Add raw/node-repl-await.js for easier diffing in the future * Rename flag to --no-experimental-repl-await to match node; enable by default when target is high enough; avoid `process.exit()` in `create()`; change `await` detection heuristic to match node's * Minimize changes to bin, since the only async possibility is in REPL, so bin.ts does not need to handle its errors * Integrate with latest `main` branch * fix test * fix tests * fix * fix * fix tests * fix test; make test-local fix linting errors instead of blocking on them * fix * normalize paths passed to diagnosticFilters to hopefully fix windows tests * force repl's virtual file to be a module, which is safe as long as node's runtime effectively does the same thing * remove extraneous prop deletion in show-config output * remove some todos * Update src/repl.ts Co-authored-by: ejose19 <[email protected]> * refactor: move forceToBeModule from createRepl to startRepl * test: adjust tests * test: set static target for TLA tests * refactor: show hint regarding tla errors when shouldReplAwait=false * test: small adjustments * Final cleanup * increase wait time in repl test to reduce flakiness Co-authored-by: Andrew Bradley <[email protected]>
- Loading branch information