UNPKG

@graphql-tools/code-file-loader

Version:

A set of utils for faster development of GraphQL tools

15 lines (14 loc) 623 B
/** * Convert a module specifier for use with dynamic `import()`. * * Absolute filesystem paths must be `file://` URLs when `import()` is a real * ESM import — on Windows a bare `C:\...` path is parsed as a `c:` protocol * scheme and rejected with `ERR_UNSUPPORTED_ESM_URL_SCHEME`. * * Bob's CJS build rewrites `import()` to `require()`, which needs a filesystem * path (not a `file://` URL). Detect CJS via `__filename` and leave absolute * paths unchanged there. Bare package / relative specifiers are always unchanged. * * @internal */ export declare function toImportSpecifier(specifier: string): string;