@microsoft/webpack5-load-themed-styles-loader 0.2.3 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AAEH,OAAO,KAAK,EAAiB,6BAA6B,EAAE,MAAM,SAAS,CAAC;AAI5E;;;;GAIG;AACH,MAAM,WAAW,8BAA8B;IAC7C;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;GAKG;AAEH,eAAO,MAAM,KAAK,EAAE,6BAA6B,CAAC,8BAA8B,CAqC/E,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AAEH,OAAO,KAAK,EAAiB,6BAA6B,EAAE,MAAM,SAAS,CAAC;AAI5E;;;;GAIG;AACH,MAAM,WAAW,8BAA8B;IAC7C;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;GAKG;AAGH,eAAO,MAAM,KAAK,EAAE,6BAA6B,CAAC,8BAA8B,CAqC/E,CAAC"}
package/lib/index.js CHANGED
@@ -10,6 +10,7 @@ const defaultThemedStylesPath = require.resolve('@microsoft/load-themed-styles')
10
10
  *
11
11
  * @public
12
12
  */
13
+ // eslint-disable-next-line func-style
13
14
  const pitch = function (remainingRequest) {
14
15
  const loaderContext = this;
15
16
  const options = loaderContext.getOptions() || {};
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";A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.\n// See LICENSE in the project root for license information.\n\n/**\n * This simple loader wraps the loading of CSS in script equivalent to\n * require(\"\\@microsoft/load-themed-styles\").loadStyles('... css text ...').\n * @packageDocumentation\n */\n\nimport type { LoaderContext, PitchLoaderDefinitionFunction } from 'webpack';\n\nconst defaultThemedStylesPath: string = require.resolve('@microsoft/load-themed-styles');\n\n/**\n * Options for the loader.\n *\n * @public\n */\nexport interface ILoadThemedStylesLoaderOptions {\n /**\n * If this parameter is set to \"true,\" the \"loadAsync\" parameter is set to true in the call to loadStyles.\n * Defaults to false.\n */\n async?: boolean;\n loadThemedStylesPath?: string;\n esModule?: boolean;\n}\n\n/**\n * This simple loader wraps the loading of CSS in script equivalent to\n * require(\"load-themed-styles\").loadStyles('... css text ...').\n *\n * @public\n */\n\nexport const pitch: PitchLoaderDefinitionFunction<ILoadThemedStylesLoaderOptions> = function (\n this: LoaderContext<ILoadThemedStylesLoaderOptions>,\n remainingRequest: string\n): string {\n const loaderContext: LoaderContext<ILoadThemedStylesLoaderOptions> = this;\n const options: ILoadThemedStylesLoaderOptions = loaderContext.getOptions() || {};\n if ((options as Record<string, unknown>).namedExport) {\n throw new Error('The \"namedExport\" option has been removed.');\n }\n\n const { async = false, loadThemedStylesPath = defaultThemedStylesPath, esModule = false } = options;\n const stringifiedRequest: string = JSON.stringify(\n loaderContext.utils.contextify(loaderContext.context, '!!' + remainingRequest)\n );\n\n const importCode: [contentImport: string, loaderImport: string] = esModule\n ? [\n `import content from ${stringifiedRequest};`,\n `import { loadStyles } from ${JSON.stringify(loadThemedStylesPath)};`\n ]\n : [\n `var content = require(${stringifiedRequest});`,\n `var loader = require(${JSON.stringify(loadThemedStylesPath)});`\n ];\n\n return [\n ...importCode,\n '',\n 'if(typeof content === \"string\") content = [[module.id, content]];',\n '',\n '// add the styles to the DOM',\n `for (var i = 0; i < content.length; i++) ${\n esModule ? 'loadStyles' : 'loader.loadStyles'\n }(content[i][1], ${async === true});`,\n '',\n 'if(content.locals) module.exports = content.locals;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C,CAAC;AACf,CAAC,CAAC;AArCW,QAAA,KAAK,SAqChB","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\n/**\n * This simple loader wraps the loading of CSS in script equivalent to\n * require(\"\\@microsoft/load-themed-styles\").loadStyles('... css text ...').\n * @packageDocumentation\n */\n\nimport type { LoaderContext, PitchLoaderDefinitionFunction } from 'webpack';\n\nconst defaultThemedStylesPath: string = require.resolve('@microsoft/load-themed-styles');\n\n/**\n * Options for the loader.\n *\n * @public\n */\nexport interface ILoadThemedStylesLoaderOptions {\n /**\n * If this parameter is set to \"true,\" the \"loadAsync\" parameter is set to true in the call to loadStyles.\n * Defaults to false.\n */\n async?: boolean;\n loadThemedStylesPath?: string;\n esModule?: boolean;\n}\n\n/**\n * This simple loader wraps the loading of CSS in script equivalent to\n * require(\"load-themed-styles\").loadStyles('... css text ...').\n *\n * @public\n */\n\n// eslint-disable-next-line func-style\nexport const pitch: PitchLoaderDefinitionFunction<ILoadThemedStylesLoaderOptions> = function (\n this: LoaderContext<ILoadThemedStylesLoaderOptions>,\n remainingRequest: string\n): string {\n const loaderContext: LoaderContext<ILoadThemedStylesLoaderOptions> = this;\n const options: ILoadThemedStylesLoaderOptions = loaderContext.getOptions() || {};\n if ((options as Record<string, unknown>).namedExport) {\n throw new Error('The \"namedExport\" option has been removed.');\n }\n\n const { async = false, loadThemedStylesPath = defaultThemedStylesPath, esModule = false } = options;\n const stringifiedRequest: string = JSON.stringify(\n loaderContext.utils.contextify(loaderContext.context, '!!' + remainingRequest)\n );\n\n const importCode: [contentImport: string, loaderImport: string] = esModule\n ? [\n `import content from ${stringifiedRequest};`,\n `import { loadStyles } from ${JSON.stringify(loadThemedStylesPath)};`\n ]\n : [\n `var content = require(${stringifiedRequest});`,\n `var loader = require(${JSON.stringify(loadThemedStylesPath)});`\n ];\n\n return [\n ...importCode,\n '',\n 'if(typeof content === \"string\") content = [[module.id, content]];',\n '',\n '// add the styles to the DOM',\n `for (var i = 0; i < content.length; i++) ${\n esModule ? 'loadStyles' : 'loader.loadStyles'\n }(content[i][1], ${async === true});`,\n '',\n 'if(content.locals) module.exports = content.locals;'\n ].join('\\n');\n};\n"]}
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.37.0"
8
+ "packageVersion": "7.37.1"
9
9
  }
10
10
  ]
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/webpack5-load-themed-styles-loader",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "This simple loader wraps the loading of CSS in script equivalent to `require('load-themed-styles').loadStyles( /* css text */ )`. It is designed to be a replacement for style-loader.",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -11,7 +11,7 @@
11
11
  "directory": "webpack/webpack5-loader-load-themed-styles"
12
12
  },
13
13
  "peerDependencies": {
14
- "@microsoft/load-themed-styles": "^2.0.79",
14
+ "@microsoft/load-themed-styles": "^2.0.81",
15
15
  "webpack": "^5"
16
16
  },
17
17
  "peerDependenciesMeta": {
@@ -23,11 +23,10 @@
23
23
  "webpack": "~5.82.1",
24
24
  "memfs": "3.4.3",
25
25
  "css-loader": "~6.6.0",
26
- "@microsoft/load-themed-styles": "2.0.79",
27
- "@rushstack/eslint-config": "3.3.4",
26
+ "@microsoft/load-themed-styles": "2.0.81",
28
27
  "local-node-rig": "1.0.0",
29
- "@rushstack/heft": "0.61.1",
30
- "@rushstack/node-core-library": "3.60.0"
28
+ "@rushstack/heft": "0.61.3",
29
+ "@rushstack/node-core-library": "3.60.1"
31
30
  },
32
31
  "scripts": {
33
32
  "build": "heft build --clean",