* Import and register custom/user-defined module loader hook(s). * @param {string} urlOrSpecifier * @param {string} parentURL * @param {any} [data] Arbitrary data to be passed from the custom * loader (user-land) to the worker.
(urlOrSpecifier, parentURL, data, isInternal)
| 171 | * loader (user-land) to the worker. |
| 172 | */ |
| 173 | async register(urlOrSpecifier, parentURL, data, isInternal) { |
| 174 | const cascadedLoader = require('internal/modules/esm/loader').getOrInitializeCascadedLoader(); |
| 175 | const keyedExports = isInternal ? |
| 176 | require(urlOrSpecifier) : |
| 177 | await cascadedLoader.import( |
| 178 | urlOrSpecifier, |
| 179 | parentURL, |
| 180 | kEmptyObject, |
| 181 | ); |
| 182 | await this.addCustomLoader(urlOrSpecifier, keyedExports, data); |
| 183 | } |
| 184 | |
| 185 | /** |
| 186 | * Collect custom/user-defined module loader hook(s). |
no test coverage detected