MCPcopy Create free account
hub / github.com/webpack/stylus-loader / getStylusImplementation

Function getStylusImplementation

src/utils.js:219–230  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

217 * @returns {Promise<(source: string, options: StylusOptions) => Renderer>} resolved stylus implementation
218 */
219async 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

Callers 1

stylusLoaderFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…