-
Notifications
You must be signed in to change notification settings - Fork 104
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
Further Enhancements of Module System #1427
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Notable Changes
export from
resolutionWhen using
export from
declarations, the system will now resolve the symbol through the directives to where the symbol was defined:This change may cause snapshots that use import directives to produce different import statements when preprocessed.
Should fix #1416 by introducing support for such export declarations
Asynchronous Imports
Addresses #1348 partially by introducing a new set of functions that use
fetch
to retrieve module files. However, the interpreter does not support asynchronous operation, so the original synchronous module loading code has been left in.Import Preprocessor
The import preprocessor has been changed to treat local and source imports more uniformly:
export *
statements are not currently supported by other language features, the preprocessor has the ability to detect reexported symbols should such statements become available in the futureimport a from './a'
to be resolved toimport a from './a/index.js'
, similar to how Node and browsers resolve modules. This should help work toward the js-slang repl being able to execute multiple filesAssertions
Introduce a new
AssertionError
type that derives fromRuntimeSourceError
to gracefully handle unexpected conditions that arise during program execution, along side anassert
function. Using a custom function allows us to modify the errors assertions throw, and removes the need for polyfills for the code to work with the browser.Minor Changes
Execution Options
logTranspilerOutput
have been addedRefactoring of AST utils
src/utils/ast
. Where possible, type guards that were spread out across different parts of js-slang have been consolidated.import * as es from './utils/ast/types'
can be used to replaceimport * as es from 'estree'
. This will provide extra AST node types and reduce the amount of type checking needed when dealing with an AST. All types are compatible withestree
.