@plaudit/webpack-extensions 2.60.2 → 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.
|
@@ -104,11 +104,11 @@ class ExtensionsConfigFileGeneratorPlugin {
|
|
|
104
104
|
finalExtensionsDest = "/" + finalExtensionsDest;
|
|
105
105
|
}
|
|
106
106
|
writer
|
|
107
|
-
.use("Plaudit\\
|
|
107
|
+
.use("Plaudit\\Common\\Lib\\GutenbergUtils")
|
|
108
108
|
.withScope(writer => writer
|
|
109
109
|
.assign("$filePathPrefix", new php_writer_1.Expr(`__DIR__.${php_writer_1.Expr.convertJsonToPHP(finalExtensionsDest)}`))
|
|
110
110
|
.call("plaudit_webpack_extensions__resolve_base_uri", [new php_writer_1.Expr("$filePathPrefix")], { assignTo: "$fileUriPrefix" })
|
|
111
|
-
.call("
|
|
111
|
+
.call("GutenbergUtils::loadExtensionsV2", [
|
|
112
112
|
new php_writer_1.Expr(`__DIR__.${php_writer_1.Expr.convertJsonToPHP(finalExtensionsDest + "mapping.config.php")}`),
|
|
113
113
|
new php_writer_1.Expr(`$filePathPrefix`), new php_writer_1.Expr("$fileUriPrefix"),
|
|
114
114
|
`${this.config.plainEntrypointsHandlePrefix || node_path_1.default.basename(process.cwd())}_extension_`
|
|
@@ -134,8 +134,8 @@ class ExtensionsConfigFileGeneratorPlugin {
|
|
|
134
134
|
compilation.hooks.processAssets.tap({ name: `${this.constructor.name}_UnifiedLoaderGeneratorIntegration`, stage: webpack_1.Compilation.PROCESS_ASSETS_STAGE_DERIVED }, () => {
|
|
135
135
|
UnifiedLoaderGenerator_1.UnifiedLoaderGenerator.semaphore.resolve(this.id, { group: `extensions-config-v1-${this.extensionsDest}`, requiresBaseURI: false, action: writer => {
|
|
136
136
|
writer
|
|
137
|
-
.use("Plaudit\\
|
|
138
|
-
.call("
|
|
137
|
+
.use("Plaudit\\Common\\Lib\\GutenbergUtils")
|
|
138
|
+
.call("GutenbergUtils::installExtensionsSupport", [new php_writer_1.Expr(`__DIR__.${php_writer_1.Expr.convertJsonToPHP(this.extensionsDest)}`)]);
|
|
139
139
|
} });
|
|
140
140
|
});
|
|
141
141
|
compilation.hooks.afterProcessAssets.tap(`${this.constructor.name}_AfterProcessAssets`, this.makeVersionOneAfterProcessAssets(compilation));
|
|
@@ -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"];
|