* This function is not Webpack-specific and can be used by tools wishing to mimic `stylus-loader`'s behaviour, so its signature should not be changed. * @param {LoaderContext} loaderContext loader context * @param {LoaderOptions["implementation"]} implementation stylus implementation * @returns {
(loaderContext, implementation)
| 217 | * @returns {Promise<(source: string, options: StylusOptions) => Renderer>} resolved stylus implementation |
| 218 | */ |
| 219 | async function getStylusImplementation(loaderContext, implementation) { |
| 220 | if (!implementation || typeof implementation === "string") { |
| 221 | const specifier = implementation || "stylus"; |
| 222 | const { default: resolved } = await import( |
| 223 | path.isAbsolute(specifier) ? pathToFileURL(specifier).href : specifier |
| 224 | ); |
| 225 | |
| 226 | return resolved; |
| 227 | } |
| 228 | |
| 229 | return implementation; |
| 230 | } |
| 231 | |
| 232 | /** |
| 233 | * @param {LoaderContext} loaderContext loader context |
no outgoing calls
no test coverage detected
searching dependent graphs…