diff options
author | davidot <davidot@serenityos.org> | 2022-01-18 19:39:36 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-01-22 01:21:18 +0000 |
commit | 7cbf4b90e872776adcd05ac9150b6f745606aaae (patch) | |
tree | 6622fc7fef053fdf810fbc7d2d4a331c7c1bf435 /Meta | |
parent | 023968a489fdc281ec2bd7f1f04a8bc5a1065cbc (diff) | |
download | serenity-7cbf4b90e872776adcd05ac9150b6f745606aaae.zip |
LibJS: Implement ImportCall and HostImportModuleDynamically
This allows us to load modules from scripts.
This can be dangerous as it can load arbitrary files. Because of that it
fails and throws by default. Currently, only js and JavaScriptTestRunner
enable the default hook.
This also adds tests to test-js which test module code. Because we
form a spec perspective can't "enter" a module this is the easiest way
to run tests without having to modify test-js to have special cases for
modules.
To specify modules in test-js we use the extension '.mjs' this is to
ensure the files are not executed. We do still want to lint these files
so the prettier scripts have changed to look for '.mjs' files as well.
Diffstat (limited to 'Meta')
-rwxr-xr-x | Meta/lint-prettier.sh | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Meta/lint-prettier.sh b/Meta/lint-prettier.sh index 7a6701e8ee..00f0f70b4e 100755 --- a/Meta/lint-prettier.sh +++ b/Meta/lint-prettier.sh @@ -10,12 +10,12 @@ if [ "$#" -eq "0" ]; then git ls-files \ --exclude-from .prettierignore \ -- \ - '*.js' + '*.js' '*.mjs' ) else files=() for file in "$@"; do - if [[ "${file}" == *".js" ]]; then + if [[ "${file}" == *".js" ]] || [[ "${file}" == *".mjs" ]]; then files+=("${file}") fi done @@ -34,5 +34,5 @@ if (( ${#files[@]} )); then prettier --check "${files[@]}" else - echo "No .js files to check." + echo "No .js or .mjs files to check." fi |