@microsoft/webpack5-load-themed-styles-loader 0.3.14 → 0.4.0
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.
- package/CHANGELOG.json +26 -0
- package/CHANGELOG.md +8 -1
- package/{lib → lib-dts}/tsdoc-metadata.json +1 -1
- package/lib-esm/index.js +39 -0
- package/lib-esm/index.js.map +1 -0
- package/package.json +30 -8
- /package/{lib → lib-commonjs}/index.js +0 -0
- /package/{lib → lib-commonjs}/index.js.map +0 -0
- /package/{lib → lib-dts}/index.d.ts +0 -0
- /package/{lib → lib-dts}/index.d.ts.map +0 -0
package/CHANGELOG.json
CHANGED
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/webpack5-load-themed-styles-loader",
|
|
3
3
|
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"version": "0.4.0",
|
|
6
|
+
"tag": "@microsoft/webpack5-load-themed-styles-loader_v0.4.0",
|
|
7
|
+
"date": "Thu, 19 Feb 2026 00:04:52 GMT",
|
|
8
|
+
"comments": {
|
|
9
|
+
"minor": [
|
|
10
|
+
{
|
|
11
|
+
"comment": "Normalize package layout. CommonJS is now under `lib-commonjs`, DTS is now under `lib-dts`, and ESM is now under `lib-esm`. Imports to `lib` still work as before, handled by the `\"exports\"` field in `package.json`."
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"dependency": [
|
|
15
|
+
{
|
|
16
|
+
"comment": "Updating dependency \"@microsoft/load-themed-styles\" to `2.2.0`"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"comment": "Updating dependency \"@rushstack/heft\" to `1.2.0`"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"comment": "Updating dependency \"@rushstack/node-core-library\" to `5.20.0`"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"comment": "Updating dependency \"@microsoft/load-themed-styles\" from `^2.1.29` to `2.2.0`"
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
},
|
|
4
30
|
{
|
|
5
31
|
"version": "0.3.14",
|
|
6
32
|
"tag": "@microsoft/webpack5-load-themed-styles-loader_v0.3.14",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
# Change Log - @microsoft/webpack5-load-themed-styles-loader
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Thu, 19 Feb 2026 00:04:52 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 0.4.0
|
|
6
|
+
Thu, 19 Feb 2026 00:04:52 GMT
|
|
7
|
+
|
|
8
|
+
### Minor changes
|
|
9
|
+
|
|
10
|
+
- Normalize package layout. CommonJS is now under `lib-commonjs`, DTS is now under `lib-dts`, and ESM is now under `lib-esm`. Imports to `lib` still work as before, handled by the `"exports"` field in `package.json`.
|
|
4
11
|
|
|
5
12
|
## 0.3.14
|
|
6
13
|
Sat, 07 Feb 2026 01:13:26 GMT
|
package/lib-esm/index.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
const defaultThemedStylesPath = require.resolve('@microsoft/load-themed-styles');
|
|
4
|
+
/**
|
|
5
|
+
* This simple loader wraps the loading of CSS in script equivalent to
|
|
6
|
+
* require("load-themed-styles").loadStyles('... css text ...').
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
// eslint-disable-next-line func-style
|
|
11
|
+
export const pitch = function (remainingRequest) {
|
|
12
|
+
const loaderContext = this;
|
|
13
|
+
const options = loaderContext.getOptions() || {};
|
|
14
|
+
if (options.namedExport) {
|
|
15
|
+
throw new Error('The "namedExport" option has been removed.');
|
|
16
|
+
}
|
|
17
|
+
const { async = false, loadThemedStylesPath = defaultThemedStylesPath, esModule = false } = options;
|
|
18
|
+
const stringifiedRequest = JSON.stringify(loaderContext.utils.contextify(loaderContext.context, '!!' + remainingRequest));
|
|
19
|
+
const importCode = esModule
|
|
20
|
+
? [
|
|
21
|
+
`import content from ${stringifiedRequest};`,
|
|
22
|
+
`import { loadStyles } from ${JSON.stringify(loadThemedStylesPath)};`
|
|
23
|
+
]
|
|
24
|
+
: [
|
|
25
|
+
`var content = require(${stringifiedRequest});`,
|
|
26
|
+
`var loader = require(${JSON.stringify(loadThemedStylesPath)});`
|
|
27
|
+
];
|
|
28
|
+
return [
|
|
29
|
+
...importCode,
|
|
30
|
+
'',
|
|
31
|
+
'if(typeof content === "string") content = [[module.id, content]];',
|
|
32
|
+
'',
|
|
33
|
+
'// add the styles to the DOM',
|
|
34
|
+
`for (var i = 0; i < content.length; i++) ${esModule ? 'loadStyles' : 'loader.loadStyles'}(content[i][1], ${async === true});`,
|
|
35
|
+
'',
|
|
36
|
+
'if(content.locals) module.exports = content.locals;'
|
|
37
|
+
].join('\n');
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAU3D,MAAM,uBAAuB,GAAW,OAAO,CAAC,OAAO,CAAC,+BAA+B,CAAC,CAAC;AAiBzF;;;;;GAKG;AAEH,sCAAsC;AACtC,MAAM,CAAC,MAAM,KAAK,GAAkE,UAElF,gBAAwB;IAExB,MAAM,aAAa,GAAkD,IAAI,CAAC;IAC1E,MAAM,OAAO,GAAmC,aAAa,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC;IACjF,IAAK,OAAmC,CAAC,WAAW,EAAE,CAAC;QACrD,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,CAAC;IAED,MAAM,EAAE,KAAK,GAAG,KAAK,EAAE,oBAAoB,GAAG,uBAAuB,EAAE,QAAQ,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC;IACpG,MAAM,kBAAkB,GAAW,IAAI,CAAC,SAAS,CAC/C,aAAa,CAAC,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,OAAO,EAAE,IAAI,GAAG,gBAAgB,CAAC,CAC/E,CAAC;IAEF,MAAM,UAAU,GAAkD,QAAQ;QACxE,CAAC,CAAC;YACE,uBAAuB,kBAAkB,GAAG;YAC5C,8BAA8B,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC,GAAG;SACtE;QACH,CAAC,CAAC;YACE,yBAAyB,kBAAkB,IAAI;YAC/C,wBAAwB,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC,IAAI;SACjE,CAAC;IAEN,OAAO;QACL,GAAG,UAAU;QACb,EAAE;QACF,mEAAmE;QACnE,EAAE;QACF,8BAA8B;QAC9B,4CACE,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,mBAC5B,mBAAmB,KAAK,KAAK,IAAI,IAAI;QACrC,EAAE;QACF,qDAAqD;KACtD,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC,CAAC","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"]}
|
package/package.json
CHANGED
|
@@ -1,9 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/webpack5-load-themed-styles-loader",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
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
|
-
"main": "lib/index.js",
|
|
6
|
-
"
|
|
5
|
+
"main": "./lib-commonjs/index.js",
|
|
6
|
+
"module": "./lib-esm/index.js",
|
|
7
|
+
"types": "./lib-dts/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./lib-dts/index.d.ts",
|
|
11
|
+
"import": "./lib-esm/index.js",
|
|
12
|
+
"require": "./lib-commonjs/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./lib/*": {
|
|
15
|
+
"types": "./lib-dts/*.d.ts",
|
|
16
|
+
"import": "./lib-esm/*.js",
|
|
17
|
+
"require": "./lib-commonjs/*.js"
|
|
18
|
+
},
|
|
19
|
+
"./package.json": "./package.json"
|
|
20
|
+
},
|
|
21
|
+
"typesVersions": {
|
|
22
|
+
"*": {
|
|
23
|
+
"lib/*": [
|
|
24
|
+
"lib-dts/*"
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
},
|
|
7
28
|
"license": "MIT",
|
|
8
29
|
"repository": {
|
|
9
30
|
"type": "git",
|
|
@@ -11,7 +32,7 @@
|
|
|
11
32
|
"directory": "webpack/webpack5-loader-load-themed-styles"
|
|
12
33
|
},
|
|
13
34
|
"peerDependencies": {
|
|
14
|
-
"@microsoft/load-themed-styles": "^2.
|
|
35
|
+
"@microsoft/load-themed-styles": "^2.2.0",
|
|
15
36
|
"webpack": "^5"
|
|
16
37
|
},
|
|
17
38
|
"peerDependenciesMeta": {
|
|
@@ -23,12 +44,13 @@
|
|
|
23
44
|
"css-loader": "~6.6.0",
|
|
24
45
|
"eslint": "~9.37.0",
|
|
25
46
|
"memfs": "4.12.0",
|
|
26
|
-
"webpack": "~5.105.
|
|
27
|
-
"@microsoft/load-themed-styles": "2.
|
|
28
|
-
"@rushstack/heft": "1.
|
|
29
|
-
"@rushstack/node-core-library": "5.
|
|
47
|
+
"webpack": "~5.105.2",
|
|
48
|
+
"@microsoft/load-themed-styles": "2.2.0",
|
|
49
|
+
"@rushstack/heft": "1.2.0",
|
|
50
|
+
"@rushstack/node-core-library": "5.20.0",
|
|
30
51
|
"local-node-rig": "1.0.0"
|
|
31
52
|
},
|
|
53
|
+
"sideEffects": false,
|
|
32
54
|
"scripts": {
|
|
33
55
|
"build": "heft build --clean",
|
|
34
56
|
"_phase:build": "heft run --only build -- --clean",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|