Joyee Cheung
ad0bcb9c02
vm: support using the default loader to handle dynamic import()
...
This patch adds support for using
`vm.constants.USE_MAIN_CONTEXT_DEFAULT_LOADER` as
`importModuleDynamically` in all APIs that take the option
except `vm.SourceTextModule`. This allows users to have a shortcut
to support dynamic import() in the compiled code without missing
the compilation cache if they don't need customization of the
loading process. We emit an experimental warning when the
`import()` is actually handled by the default loader through
this option instead of requiring `--experimental-vm-modules`.
In addition this refactors the documentation for
`importModuleDynamically` and adds a dedicated section for it
with examples.
`vm.SourceTextModule` is not supported in this patch because
it needs additional refactoring to handle `initializeImportMeta`,
which can be done in a follow-up.
PR-URL: https://github.com/nodejs/node/pull/51244
Fixes: https://github.com/nodejs/node/issues/51154
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2024-02-01 11:45:42 +00:00
..
2023-10-21 15:54:28 +00:00
2023-09-15 05:13:54 +00:00
2023-08-17 18:39:04 +00:00
2023-08-01 20:05:51 +00:00
2022-10-27 20:09:07 +00:00
2023-09-14 15:42:24 +00:00
2020-06-25 08:37:48 -07:00
2023-10-14 03:52:38 +00:00
2022-03-14 16:30:26 +01:00
2021-12-30 05:59:49 -08:00
2022-07-29 10:42:55 +02:00
2022-08-03 23:48:09 +02:00
2022-07-29 10:42:55 +02:00
2022-07-29 10:42:55 +02:00
2023-10-23 17:55:50 +00:00
2021-05-25 15:13:36 +02:00
2019-11-12 14:04:55 -08:00
2023-10-14 03:52:38 +00:00
2019-11-12 14:04:55 -08:00
2023-12-03 23:45:57 +00:00
2020-09-11 17:54:42 +03:00
2019-11-12 14:04:55 -08:00
2023-10-14 03:52:38 +00:00
2023-10-14 03:52:38 +00:00
2023-11-29 09:21:54 +00:00
2023-11-29 09:21:54 +00:00
2023-08-21 16:42:03 +00:00
2023-08-21 16:42:03 +00:00
2023-11-01 06:05:13 +00:00
2022-07-29 10:42:55 +02:00
2021-10-21 14:55:00 +00:00
2020-07-20 18:13:28 +02:00
2021-09-11 18:08:35 -07:00
2023-09-19 03:59:50 +00:00
2022-07-29 10:42:55 +02:00
2022-09-11 12:01:37 +02:00
2022-09-11 12:01:37 +02:00
2023-08-21 16:41:53 +00:00
2023-10-03 12:31:21 +08:00
2019-11-12 14:04:55 -08:00
2020-02-18 22:15:50 -08:00
2023-10-14 03:52:38 +00:00
2023-10-14 03:52:38 +00:00
2023-10-14 03:52:38 +00:00
2023-10-14 03:52:38 +00:00
2023-11-19 21:22:49 +00:00
2023-11-19 21:22:49 +00:00
2023-10-18 14:27:55 +00:00
2023-11-01 12:38:01 +00:00
2022-07-29 10:42:55 +02:00
2024-01-31 23:22:18 +01:00
2023-10-31 21:11:15 +00:00
2022-10-13 07:31:31 -07:00
2022-10-13 07:31:31 -07:00
2023-07-29 09:51:10 +00:00
2023-08-13 23:24:22 +02:00
2023-11-17 00:16:38 +00:00
2023-10-14 03:52:38 +00:00
2023-12-20 17:47:39 +00:00
2019-11-12 14:04:55 -08:00
2019-11-12 14:04:55 -08:00
2023-07-19 10:33:47 +00:00
2020-12-12 20:58:01 +00:00
2023-09-23 05:41:26 +00:00
2019-11-12 14:04:55 -08:00
2023-02-18 14:26:36 +00:00
2023-12-13 05:53:19 +00:00
2022-07-31 04:08:02 +01:00
2020-01-07 01:31:05 +02:00
2022-05-04 16:51:12 +01:00
2023-09-05 01:13:40 +00:00
2023-07-26 20:34:20 +00:00
2022-07-29 10:42:55 +02:00
2023-08-03 05:10:59 +00:00
2023-12-20 18:17:31 +00:00
2023-04-13 09:35:17 +02:00
2023-07-31 13:09:07 +00:00
2021-09-11 18:08:35 -07:00
2022-07-29 10:42:55 +02:00
2023-11-29 09:21:54 +00:00
2023-04-13 09:35:17 +02:00
2023-12-05 19:54:01 +01:00
2023-08-11 06:29:14 +00:00
2023-12-23 20:38:08 +00:00
2023-09-06 22:30:08 +00:00
2023-09-06 22:30:08 +00:00
2019-11-12 14:04:55 -08:00
2021-09-10 10:54:39 -05:00
2022-07-29 10:42:55 +02:00
2022-07-29 10:42:55 +02:00
2020-10-20 14:27:31 +00:00
2020-10-20 14:27:31 +00:00
2021-10-21 14:55:00 +00:00
2024-01-10 23:26:07 +01:00
2019-11-12 14:04:55 -08:00
2019-11-12 14:04:55 -08:00
2019-11-12 14:04:55 -08:00
2022-02-23 18:37:55 +02:00
2022-10-27 20:09:07 +00:00
2023-09-06 10:12:14 +00:00
2023-03-05 09:42:29 +02:00
2021-04-01 23:14:29 -07:00
2019-11-12 14:04:55 -08:00
2023-12-25 11:44:26 +00:00
2019-11-12 14:04:55 -08:00
2019-11-12 14:04:55 -08:00
2019-11-12 14:04:55 -08:00
2020-07-30 14:55:45 -05:00
2023-08-21 16:41:53 +00:00
2021-04-01 23:14:29 -07:00
2019-11-12 14:04:55 -08:00
2022-07-29 10:42:55 +02:00
2019-11-12 14:04:55 -08:00
2022-07-29 10:42:55 +02:00
2020-08-03 14:27:28 -04:00
2023-09-29 06:18:44 +00:00
2023-09-29 06:18:44 +00:00
2023-12-23 20:38:08 +00:00
2023-11-10 09:20:46 +01:00
2023-09-29 06:18:44 +00:00
2023-10-03 12:31:21 +08:00
2023-09-29 06:18:44 +00:00
2020-04-29 22:10:35 -07:00
2021-04-13 19:06:48 +02:00
2023-10-03 12:31:21 +08:00
2023-09-29 06:18:44 +00:00
2020-10-21 01:26:34 +02:00
2023-10-14 03:52:38 +00:00
2023-10-13 18:03:52 -03:00
2023-08-21 16:41:53 +00:00
2022-07-29 10:42:55 +02:00
2023-10-30 16:51:52 +00:00
2023-06-09 15:32:55 +02:00
2023-02-18 14:26:36 +00:00
2023-10-19 10:44:46 +02:00
2023-09-18 23:00:53 +02:00
2023-10-06 14:33:46 +00:00
2023-09-23 03:46:22 +00:00
2024-02-01 11:45:42 +00:00
2024-01-22 11:53:11 +00:00
2023-09-18 23:00:53 +02:00
2023-09-29 06:18:44 +00:00
2023-09-29 06:18:44 +00:00
2023-09-29 06:18:44 +00:00
2018-08-04 18:14:13 +02:00