* A simple module loader from a function
This will be the foundation for having a combinatoric module loader
system.
* Add more utility module loader types
* clippies
* Remove convenience functions and allow AsRef<Path> for constructing fs
* clippies
* Move FnModuleLoader to return a result, and add a new simpler loader
* Address comment
* Add a way to add setters/getters in js_class!
* Address cargo clippies
* Add new interface and update doc
* Setters can now return a value, which can be a JsResult
* Remove clippy warning
* Fix having both get and set with a return type fails to match
* Add a js_class to implement the Class trait without boilerplate
This also adds a JsInstance that verifies that `this` is of the proper
class, and an `Ignore` that ignore arguments.
The syntax is a bit special because of limitations of macro_rules. For
example, the way fields are defined. It was impossible to keep both
assignments (e.g. `public field = 123;`) and dynamic fields.
This reduces significantly the boilerplate for declaring classes. The
example in class.rs is more than twice as long (if you remove comments)
than the macro is.
* clippies
* Fix usage of macros
* Fix some imports issues
* Fix some imports issues, again
* Add a way to alias a function, e.g. change case
* Address comment and get rid of unwraps
* Add more utility traits and funtions to boa_interop
* cargo clippy
* Readd the safe version for Fn which also implements Copy
* Use a new trait for converting a Rust type to a JsResult<JsValue>
* cargo clippy
* Add a test for returning result and Fn()
* Seal both IntoJsFunction and IntoJsFunctionUnsafe
* Try Borrowing and return a nice error instead of panicking
* Address comments
* Rename into_js_function to into_js_function_copied
* Move TryIntoJsResult to boa_engine
* Move JsRest to be at the end only of arguments and add JsAll
* use from_copy_closure and remove unsafe
* Add a HostDefined struct to grab host defined in the argument list
* cargo fmt and clippy
* Explain why we need Clone
* Remove the vector from JsRest<> and use a reference
* Add HostDefined to context as Data, and rename the injector in boa_interop
* Use TypeError instead if the type was not found in context
* Update core/interop/src/lib.rs
Co-authored-by: José Julián Espina <jedel0124@gmail.com>
* cargo fmt
* cargo fmt
---------
Co-authored-by: José Julián Espina <jedel0124@gmail.com>
* Add an embed_module!() macro to boa_interop
The macro creates a ModuleLoader that includes all JS files from a directory.
* Add description of function
* Run prettier
* Remove reference to a unaccessible crate
* Remove one more reference to a unaccessible crate
* Disable test that plays with paths on Windows
* Block the whole test module instead of just the fn
* This is a bit insane
* Replace path separators into JavaScript specifier separators
* cargo fmt
* cargo fmt part deux
* fix some issues with relative path and pathing on windows
* fix module resolver when there are no base path
* use the platform's path separator
* cargo fmt
* prettier
* Remove caching of the error
* Pedantic clippy gonna pedant
* Add more utility traits and funtions to boa_interop
* cargo clippy
* Readd the safe version for Fn which also implements Copy
* Use a new trait for converting a Rust type to a JsResult<JsValue>
* cargo clippy
* Add a test for returning result and Fn()
* Seal both IntoJsFunction and IntoJsFunctionUnsafe
* Try Borrowing and return a nice error instead of panicking
* Address comments
* Rename into_js_function to into_js_function_copied
* Move TryIntoJsResult to boa_engine
* Move JsRest to be at the end only of arguments and add JsAll
* use from_copy_closure and remove unsafe
* Add an integration test for relative imports on SimpleModuleLoader
* Add a path to Module (and expose it in Referrer)
This allows SimpleModuleLoader to resolve relative to the current
file (which this commit also does).
Fixes#3782
* cargo clippy and fmt
* prettier
* Fix merge error
* Add a boa_interop crate
This crate will contain types and functions to help integrating
boa in Rust projects, making it easier to interop between the
host and the JavaScript code.
See https://github.com/boa-dev/boa/discussions/3770
* Remove unnecessary into_iter()
* cargo fmt
* cargo clippy
* Make IntoJsFunction unsafe
* Remove unused code