( modulePath: string, )
| 12 | }) |
| 13 | |
| 14 | export function createDefaultImportMeta( |
| 15 | modulePath: string, |
| 16 | ): ModuleRunnerImportMeta { |
| 17 | const href = posixPathToFileHref(modulePath) |
| 18 | const filename = modulePath |
| 19 | const dirname = posixDirname(modulePath) |
| 20 | return { |
| 21 | filename: isWindows ? toWindowsPath(filename) : filename, |
| 22 | dirname: isWindows ? toWindowsPath(dirname) : dirname, |
| 23 | url: href, |
| 24 | env: envProxy, |
| 25 | resolve(_id: string, _parent?: string) { |
| 26 | throw new Error('[module runner] "import.meta.resolve" is not supported.') |
| 27 | }, |
| 28 | // should be replaced during transformation |
| 29 | glob() { |
| 30 | throw new Error( |
| 31 | `[module runner] "import.meta.glob" is statically replaced during ` + |
| 32 | `file transformation. Make sure to reference it by the full name.`, |
| 33 | ) |
| 34 | }, |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * Create import.meta object for Node.js. |
no test coverage detected