packageDocumentation import { loader } from 'webpack' ; import loaderUtils = require ( 'loader-utils' ) ; const loadedThemedStylesPath = require . resolve ( '@microsoft/load-themed-styles' ) ; public export interface ILoadThemedStylesLoaderOptions { /**
     * If this parameter is specified, override the name of the value exported from this loader. This is useful in
     *  exporting as the default in es6 module import scenarios. See the README for more information.
     */ namedExport ? : string ; /**
     * If this parameter is set to "true," the "loadAsync" parameter is set to true in the call to loadStyles.
     * Defaults to false.
     */ async ? : boolean ; } public export class LoadThemedStylesLoader { private static _loadedThemedStylesPath : string = loadedThemedStylesPath ; public constructor ( ) { throw new Error ( 'Constructing "LoadThemedStylesLoader" is not supported.' ) ; } public static set loadedThemedStylesPath ( value ) { LoadThemedStylesLoader . _loadedThemedStylesPath = value ; } /**
     * Use this property to override the path to the `@microsoft/load-themed-styles` package.
     */ public static get loadedThemedStylesPath ( ) : string { return LoadThemedStylesLoader . _loadedThemedStylesPath ; } /**
     * Reset the path to the `@microsoft/load-themed-styles package` to the default.
     */ public static resetLoadedThemedStylesPath ( ) { LoadThemedStylesLoader . _loadedThemedStylesPath = loadedThemedStylesPath ; } public static pitch ( this , remainingRequest ) { const { namedExport , async = false } = loaderUtils . getOptions ( this ) || { } ; let exportName = 'module.exports' ; if ( namedExport ) { exportName += `.${ namedExport }` ; } return [ `var content = require(${ loaderUtils . stringifyRequest ( this , '!!' + remainingRequest ) });` , `var loader = require(${ JSON . stringify ( LoadThemedStylesLoader . _loadedThemedStylesPath ) });` , '' , 'if(typeof content === "string") content = [[module.id, content]];' , '' , '// add the styles to the DOM' , `for (var i = 0; i < content.length; i++) loader.loadStyles(content[i][1], ${ async === true });` , '' , `if(content.locals) ${ exportName } = content.locals;` ] . join ( '\n' ) ; } }