File tree Expand file tree Collapse file tree 2 files changed +4
-17
lines changed Expand file tree Collapse file tree 2 files changed +4
-17
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ const MiniCssExtractPlugin = require("./index");
23
23
/** @typedef {import("webpack").AssetInfo } AssetInfo */
24
24
/** @typedef {import("webpack").NormalModule } NormalModule */
25
25
/** @typedef {import("./index.js").LoaderOptions } LoaderOptions */
26
- /** @typedef {{ [key: string]: string | function } | function } Locals */
26
+ /** @typedef {{ [key: string]: string | function } } Locals */
27
27
28
28
/** @typedef {any } TODO */
29
29
@@ -172,8 +172,7 @@ function pitch(request) {
172
172
locals = { } ;
173
173
}
174
174
175
- /** @type {{ [key: string]: string } } */ ( locals ) [ key ] =
176
- originalExports [ key ] ;
175
+ /** @type {Locals } */ ( locals ) [ key ] = originalExports [ key ] ;
177
176
}
178
177
} ) ;
179
178
} else {
@@ -232,15 +231,13 @@ function pitch(request) {
232
231
. map (
233
232
( key ) =>
234
233
`\nexport var ${ key } = ${ stringifyLocal (
235
- /** @type {{ [key: string]: string | function } } */ ( locals ) [
236
- key
237
- ]
234
+ /** @type {Locals } */ ( locals ) [ key ]
238
235
) } ;`
239
236
)
240
237
. join ( "" )
241
238
: `\n${
242
239
esModule ? "export default" : "module.exports ="
243
- } ${ stringifyLocal ( /** @type { function } */ ( locals ) ) } ;`
240
+ } ${ JSON . stringify ( locals ) } ;`
244
241
: esModule
245
242
? `\nexport {};`
246
243
: "" ;
Original file line number Diff line number Diff line change 1
1
import { stringifyLocal } from "../src/utils" ;
2
2
3
3
describe ( "stringifyLocal" , ( ) => {
4
- it ( `object` , async ( ) => {
5
- const testObj = { classNameA : "classA" , classNameB : "classB" } ;
6
- const actual = stringifyLocal ( testObj ) ;
7
-
8
- expect (
9
- actual === '{"classNameA":"classA","classNameB":"classB"}' ||
10
- actual === '{"classNameB":"classB","classNameA":"classA"}'
11
- ) . toBe ( true ) ;
12
- } ) ;
13
-
14
4
it ( `primitive` , async ( ) => {
15
5
const testObj = "classA" ;
16
6
You can’t perform that action at this time.
0 commit comments