@@ -1473,12 +1473,12 @@ module.exports = {
1473
1473
// synchronously write a .json mapping file in the same directory as the resource
1474
1474
const exportsJson = exports .reduce (
1475
1475
(acc , { name, value }) => ({ ... acc, [name]: value }),
1476
- {}
1476
+ {},
1477
1477
);
1478
1478
1479
1479
const outputPath = path .resolve (
1480
1480
path .dirname (resourcePath),
1481
- ` ${ path .basename (resourcePath)} .json`
1481
+ ` ${ path .basename (resourcePath)} .json` ,
1482
1482
);
1483
1483
1484
1484
const fs = require (" fs" );
@@ -1503,12 +1503,12 @@ module.exports = {
1503
1503
getJSON: async ({ resourcePath, exports }) => {
1504
1504
const exportsJson = exports .reduce (
1505
1505
(acc , { name, value }) => ({ ... acc, [name]: value }),
1506
- {}
1506
+ {},
1507
1507
);
1508
1508
1509
1509
const outputPath = path .resolve (
1510
1510
path .dirname (resourcePath),
1511
- ` ${ path .basename (resourcePath)} .json`
1511
+ ` ${ path .basename (resourcePath)} .json` ,
1512
1512
);
1513
1513
1514
1514
const fsp = require (" fs/promises" );
@@ -1548,15 +1548,15 @@ function addReplacements(resourcePath, imports, exportsJson, replacements) {
1548
1548
importReplacementsMap[resourcePath] = replacements .reduce (
1549
1549
(acc , { replacementName, importName, localName }) => {
1550
1550
const replacementImportUrl = imports .find (
1551
- (importData ) => importData .importName === importName
1551
+ (importData ) => importData .importName === importName,
1552
1552
).url ;
1553
1553
const relativePathRe = / . * !(. * )"/ ;
1554
1554
const [, relativePath ] = replacementImportUrl .match (relativePathRe);
1555
1555
const importPath = path .resolve (path .dirname (resourcePath), relativePath);
1556
1556
const identifier = generateIdentifier (importPath, localName);
1557
1557
return { ... acc, [replacementName]: ` ___REPLACEMENT${ identifier} ___` };
1558
1558
},
1559
- {}
1559
+ {},
1560
1560
);
1561
1561
1562
1562
// iterate through the raw exports and add stand-in variables
@@ -1572,7 +1572,7 @@ function addReplacements(resourcePath, imports, exportsJson, replacements) {
1572
1572
CSS_LOADER_REPLACEMENT_REGEX ,
1573
1573
(_ , replacementName ) => {
1574
1574
return importReplacementsMap[resourcePath][replacementName];
1575
- }
1575
+ },
1576
1576
);
1577
1577
} else {
1578
1578
// otherwise, no class names need replacements so we can add them to
@@ -1598,7 +1598,7 @@ function replaceReplacements(classNames) {
1598
1598
const canonicalValue = replaceReplacements (replacementsMap[identifier]);
1599
1599
canonicalValuesMap[identifier] = canonicalValue;
1600
1600
return canonicalValue;
1601
- }
1601
+ },
1602
1602
);
1603
1603
1604
1604
return adjustedClassNames;
@@ -1615,7 +1615,7 @@ module.exports = {
1615
1615
getJSON : ({ resourcePath, imports, exports , replacements }) => {
1616
1616
const exportsJson = exports .reduce (
1617
1617
(acc , { name, value }) => ({ ... acc, [name]: value }),
1618
- {}
1618
+ {},
1619
1619
);
1620
1620
1621
1621
if (replacements .length > 0 ) {
@@ -1625,7 +1625,7 @@ module.exports = {
1625
1625
resourcePath,
1626
1626
imports,
1627
1627
exportsJson,
1628
- replacements
1628
+ replacements,
1629
1629
);
1630
1630
} else {
1631
1631
// no replacements present --> add to canonicalValuesMap verbatim
@@ -1649,7 +1649,7 @@ module.exports = {
1649
1649
apply (compiler ) {
1650
1650
compiler .hooks .done .tap (" CssModulesJsonPlugin" , () => {
1651
1651
for (const [identifier , classNames ] of Object .entries (
1652
- replacementsMap
1652
+ replacementsMap,
1653
1653
)) {
1654
1654
const adjustedClassNames = replaceReplacements (classNames);
1655
1655
replacementsMap[identifier] = adjustedClassNames;
@@ -1662,7 +1662,7 @@ module.exports = {
1662
1662
fs .writeFileSync (
1663
1663
" ./output.css.json" ,
1664
1664
JSON .stringify (allExportsJson, null , 2 ),
1665
- " utf8"
1665
+ " utf8" ,
1666
1666
);
1667
1667
});
1668
1668
},
0 commit comments