-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Use new URL(..., import.meta.url) pattern in minimal runtime if EXPORT_ES6 is enabled
#26039
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
base: main
Are you sure you want to change the base?
Changes from 3 commits
13afe52
6312129
9b19695
48605d5
fbb38c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5563,6 +5563,21 @@ def test_vite(self): | |
| self.run_process(shared.get_npm_cmd('vite') + ['build']) | ||
| self.run_browser('dist/index.html', '/report_result?exit:0') | ||
|
|
||
| @also_with_threads | ||
| @requires_dev_dependency('vite') | ||
| def test_vite_minimal_runtime(self): | ||
| copytree(test_file('vite'), '.') | ||
| self.compile_btest('hello_world.c', [ | ||
| '-sEXIT_RUNTIME', | ||
| '-sMINIMAL_RUNTIME', | ||
| '-sMINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION', | ||
| '-sEXPORT_ES6', | ||
| '-sENVIRONMENT=web', | ||
| '-o', | ||
| 'hello.mjs']) | ||
| self.run_process(shared.get_npm_cmd('vite') + ['build']) | ||
| self.run_browser('dist/index.html', '/report_result?exit:0') | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rather than adding a new test here you should be able to using Something like: (then add args to the compile_btest arguments).
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated. |
||
|
|
||
| @also_with_threads | ||
| @requires_dev_dependency('rollup') | ||
| def test_rollup(self): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1702,6 +1702,18 @@ def test_minimal_runtime_errors(self): | |
| expected = 'emcc: error: MINIMAL_RUNTIME is not compatible with --preload-file' | ||
| self.assert_fail([EMCC, test_file('hello_world.c'), '-sMINIMAL_RUNTIME', '--preload-file', 'foo'], expected) | ||
|
|
||
| def test_minimal_runtime_esm_streaming_instantiation(self): | ||
valadaptive marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| self.run_process([EMCC, '-o', 'test.mjs', | ||
| '-sMINIMAL_RUNTIME', | ||
| '-sMINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION', | ||
| '-sEXPORT_ES6', | ||
| '-sENVIRONMENT=web', | ||
| test_file('hello_world.c')]) | ||
|
|
||
| src = read_file('test.mjs') | ||
| # Verify that the generated code uses import.meta.url for the wasm URL | ||
| self.assertContained("new URL('test.wasm', import.meta.url)", src) | ||
|
||
|
|
||
| def test_export_all_and_exported_functions(self): | ||
| # EXPORT_ALL should not export library functions by default. | ||
| # This means that to export library function you also need to explicitly | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you confirm this test fails before this PR, and passes after?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Manually confirmed the (newly
@parameterized) test fails without the changes made in this PR.