@plaudit/webpack-extensions 2.61.0 → 2.61.1
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.
|
@@ -12,7 +12,7 @@ export type CommonPluginConfig = {
|
|
|
12
12
|
export type CommonConfigProcessingResult = {
|
|
13
13
|
entrypointFields: string[];
|
|
14
14
|
fixedRules: NonNullable<Configuration['module']>['rules'];
|
|
15
|
-
processingModules: boolean
|
|
15
|
+
processingModules: boolean;
|
|
16
16
|
scriptExtension: RegExp;
|
|
17
17
|
updateCurrentVariables: (value: VerifiedPlauditWordpressWebpackConfig['currentVariables']) => unknown;
|
|
18
18
|
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertToCSS = convertToCSS;
|
|
4
|
+
function convertToCSS(writableCSSObject, pretty = true) {
|
|
5
|
+
if (typeof pretty === 'string') {
|
|
6
|
+
return convertToCSSPretty(writableCSSObject, pretty);
|
|
7
|
+
}
|
|
8
|
+
else if (pretty) {
|
|
9
|
+
return convertToCSSPretty(writableCSSObject, "");
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
return convertToCSS(writableCSSObject);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function convertToCSSPretty(writableCSSObject, indentation) {
|
|
16
|
+
let res = "";
|
|
17
|
+
const entries = Object.entries(writableCSSObject)
|
|
18
|
+
.sort(([a], [b]) => a.localeCompare(b));
|
|
19
|
+
for (const [selectorOrAttribute, value] of entries) {
|
|
20
|
+
res += `${indentation}${selectorOrAttribute}`;
|
|
21
|
+
if (typeof value === 'string') {
|
|
22
|
+
res += `: ${value};\n`;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
res += " {\n";
|
|
26
|
+
res += convertToCSSPretty(writableCSSObject, indentation + "\t");
|
|
27
|
+
res += indentation + "}\n";
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return res;
|
|
31
|
+
}
|
|
32
|
+
function convertToCSSUgly(writableCSSObject) {
|
|
33
|
+
let res = "";
|
|
34
|
+
const entries = Object.entries(writableCSSObject)
|
|
35
|
+
.sort(([a], [b]) => a.localeCompare(b));
|
|
36
|
+
for (const [selectorOrAttribute, value] of entries) {
|
|
37
|
+
res += selectorOrAttribute;
|
|
38
|
+
if (typeof value === 'string') {
|
|
39
|
+
res += `:${value};`;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
res += "{" + convertToCSSUgly(writableCSSObject) + "}";
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return res;
|
|
46
|
+
}
|
|
@@ -403,7 +403,7 @@ function buildCommonPluginConfig(srcRoot, scriptExtension, webpackConfig, dest,
|
|
|
403
403
|
function commonConfigProcessingPrep(config, webpackConfig) {
|
|
404
404
|
let scriptExtension; // This is only used in non-block contexts. It might not actually be necessary, but it is good to have
|
|
405
405
|
let entrypointFields;
|
|
406
|
-
const processingModules = webpackConfig.output?.module;
|
|
406
|
+
const processingModules = webpackConfig.output?.module ?? false;
|
|
407
407
|
if (processingModules) {
|
|
408
408
|
scriptExtension = shared_1.scriptWithModuleExtension;
|
|
409
409
|
entrypointFields = ["viewScriptModule", "scriptModule"];
|