@plaudit/webpack-extensions 2.57.1 → 2.57.3
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.
|
@@ -54,12 +54,17 @@ class ExtensionsConfigFileGeneratorPlugin {
|
|
|
54
54
|
UnifiedLoaderGenerator_1.UnifiedLoaderGenerator.semaphore.reset(this.id);
|
|
55
55
|
compilation.hooks.processAssets.tap({ name: `${this.constructor.name}_UnifiedLoaderGeneratorIntegration`, stage: webpack_1.Compilation.PROCESS_ASSETS_STAGE_DERIVED }, () => {
|
|
56
56
|
UnifiedLoaderGenerator_1.UnifiedLoaderGenerator.semaphore.resolve(this.id, ['extensions-config-v2', writer => {
|
|
57
|
+
let finalExtensionsDest = this.extensionsDest.endsWith("/") ? this.extensionsDest : this.extensionsDest + "/";
|
|
58
|
+
if (!finalExtensionsDest.startsWith("/")) {
|
|
59
|
+
finalExtensionsDest = "/" + finalExtensionsDest;
|
|
60
|
+
}
|
|
57
61
|
writer
|
|
58
62
|
.use("Plaudit\\Base\\API\\ThemeUtils")
|
|
59
|
-
.
|
|
60
|
-
.call("plaudit_webpack_extensions__resolve_base_uri", [new php_writer_1.Expr(
|
|
63
|
+
.assign("$filePathPrefix", new php_writer_1.Expr(`__DIR__.${php_writer_1.Expr.convertJsonToPHP(finalExtensionsDest)}`))
|
|
64
|
+
.call("plaudit_webpack_extensions__resolve_base_uri", [new php_writer_1.Expr("$filePathPrefix")], { assignTo: "$fileUriPrefix" })
|
|
61
65
|
.call("ThemeUtils::loadExtensionsV2", [
|
|
62
|
-
new php_writer_1.Expr(
|
|
66
|
+
new php_writer_1.Expr(`__DIR__.${php_writer_1.Expr.convertJsonToPHP(finalExtensionsDest + "mapping.config.php")}`),
|
|
67
|
+
new php_writer_1.Expr(`$filePathPrefix`), new php_writer_1.Expr("$fileUriPrefix"),
|
|
63
68
|
`${this.handlePrefix ? this.handlePrefix : node_path_1.default.basename(process.cwd())}_extension_`
|
|
64
69
|
])
|
|
65
70
|
.call("unset", [new php_writer_1.Expr("$filePathPrefix"), new php_writer_1.Expr("$fileUriPrefix")]);
|
|
@@ -266,7 +266,7 @@ class PlainEntrypointsConfigFileGeneratorPlugin {
|
|
|
266
266
|
.call("error_log", ["UNABLE TO FIGURE OUT WHAT THE RELATIVE PATH TO THE BUILT FILES DIRECTORY SHOULD BE"])
|
|
267
267
|
.append("$path = '';")
|
|
268
268
|
.endIf()
|
|
269
|
-
.
|
|
269
|
+
.call("trailingslashit", [new php_writer_1.Expr("home_url($path)")], { return: true, assignTo: "$base_uris[$dir]" });
|
|
270
270
|
}, { returnType: "string", includeExistenceCheck: true });
|
|
271
271
|
}
|
|
272
272
|
}
|
|
@@ -28,6 +28,9 @@ export declare class PHPWriter {
|
|
|
28
28
|
indent(): this;
|
|
29
29
|
outdent(): this;
|
|
30
30
|
append(...lines: (string | Expr)[]): this;
|
|
31
|
+
assign(variable: string | string[], expression: unknown | Expr, opts?: {
|
|
32
|
+
return?: boolean;
|
|
33
|
+
}): this;
|
|
31
34
|
return(line: string | Expr): this;
|
|
32
35
|
static(variable: string, opts?: {
|
|
33
36
|
initializer?: unknown | Expr;
|
|
@@ -37,6 +40,7 @@ export declare class PHPWriter {
|
|
|
37
40
|
call(func: string, args: unknown[], opts?: {
|
|
38
41
|
chain?: boolean;
|
|
39
42
|
assignTo?: string;
|
|
43
|
+
return?: boolean;
|
|
40
44
|
}): this;
|
|
41
45
|
action(name: string | Expr, contents: (writer: this) => void, args?: ActionOrFilterArgs): this;
|
|
42
46
|
filter(name: string | Expr, contents: (writer: this) => void, args?: ActionOrFilterArgs): this;
|
|
@@ -44,6 +44,14 @@ class PHPWriter {
|
|
|
44
44
|
}
|
|
45
45
|
return this;
|
|
46
46
|
}
|
|
47
|
+
assign(variable, expression, opts = {}) {
|
|
48
|
+
const lineComponents = (typeof variable === 'string' ? [variable] : variable).map(v => `${v} =`);
|
|
49
|
+
if (opts.return) {
|
|
50
|
+
lineComponents.splice(0, 0, "return");
|
|
51
|
+
}
|
|
52
|
+
lineComponents.push(Expr.convertJsonToPHP(expression));
|
|
53
|
+
return this.append(lineComponents.join(" ") + ';');
|
|
54
|
+
}
|
|
47
55
|
return(line) {
|
|
48
56
|
return this.append(`return ${line};`);
|
|
49
57
|
}
|
|
@@ -64,8 +72,15 @@ class PHPWriter {
|
|
|
64
72
|
return this;
|
|
65
73
|
}
|
|
66
74
|
call(func, args, opts = {}) {
|
|
67
|
-
const
|
|
68
|
-
|
|
75
|
+
const lineComponents = [];
|
|
76
|
+
if (opts.return) {
|
|
77
|
+
lineComponents.push("return");
|
|
78
|
+
}
|
|
79
|
+
if (opts.assignTo) {
|
|
80
|
+
lineComponents.push(`${opts.assignTo} =`);
|
|
81
|
+
}
|
|
82
|
+
lineComponents.push(`${func}(${args.map(Expr.convertJsonToPHP).join(", ")})${opts.chain === true ? "" : ";"}`);
|
|
83
|
+
return this.append(lineComponents.join(" "));
|
|
69
84
|
}
|
|
70
85
|
action(name, contents, args = {}) {
|
|
71
86
|
return this.actionOrFilter('action', name, contents, args);
|
|
@@ -112,7 +127,7 @@ class PHPWriter {
|
|
|
112
127
|
}
|
|
113
128
|
function(name, parameters, body, args = {}) {
|
|
114
129
|
if (args.includeExistenceCheck) {
|
|
115
|
-
this.if(`!function_exists(
|
|
130
|
+
this.if(`!function_exists(${Expr.convertJsonToPHP(name)})`);
|
|
116
131
|
}
|
|
117
132
|
else {
|
|
118
133
|
this.openPHP();
|
|
@@ -169,7 +169,7 @@ function injectSupportForInliningSVGsAsStrings(rules) {
|
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
171
|
function buildVerifiedConfig(config) {
|
|
172
|
-
const { standaloneBlocks = false, stats = 'errors-warnings', variables: rawVariables, verbose = process.argv.includes('--verbose') || process.env['VERBOSE'] === 'true', postcss = {}, externals, assumeGlobalizedPlauditLibraries = true, processTranslationConfigs = true, combineAssetMetadata = true, useWebpackResourceFiltering = true, outputDir = "", extensionsVersion = 1, plainEntrypointsVersion = 1, srcDir = "", useUnifiedLoader =
|
|
172
|
+
const { standaloneBlocks = false, stats = 'errors-warnings', variables: rawVariables, verbose = process.argv.includes('--verbose') || process.env['VERBOSE'] === 'true', postcss = {}, externals, assumeGlobalizedPlauditLibraries = true, processTranslationConfigs = true, combineAssetMetadata = true, useWebpackResourceFiltering = true, outputDir = "", extensionsVersion = 1, plainEntrypointsVersion = 1, srcDir = "", useUnifiedLoader = false } = config;
|
|
173
173
|
let srcPrefixes;
|
|
174
174
|
const trailingSlashedSrcDir = srcDir && !srcDir.endsWith("/") ? srcDir + "/" : srcDir;
|
|
175
175
|
if (config.srcPrefixes === undefined) {
|