@plaudit/webpack-extensions 2.58.2 → 2.58.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.
- package/build/plugins/BlockJSONManagingPlugin.js +1 -1
- package/build/plugins/ExtensionsConfigFileGeneratorPlugin.js +21 -26
- package/build/plugins/PlainEntrypointsConfigFileGeneratorPlugin.js +1 -1
- package/build/plugins/WPMLConfigBuilder.js +1 -0
- package/build/utils/php-writer.d.ts +1 -1
- package/build/utils/php-writer.js +2 -2
- package/package.json +4 -4
|
@@ -322,7 +322,7 @@ class BlockJSONManagingPlugin {
|
|
|
322
322
|
const blockDirConfigData = {};
|
|
323
323
|
compilation.hooks.processAssets.tap({ name: `${this.constructor.name}_UnifiedLoaderGeneratorIntegration`, stage: webpack_1.Compilation.PROCESS_ASSETS_STAGE_DERIVED }, () => {
|
|
324
324
|
UnifiedLoaderGenerator_1.UnifiedLoaderGenerator.semaphore.resolve(this.id, {
|
|
325
|
-
group:
|
|
325
|
+
group: `block-json-${this.blocksDest}`,
|
|
326
326
|
action: writer => {
|
|
327
327
|
writer
|
|
328
328
|
.use("Plaudit\\Common\\ACF\\BlockManager")
|
|
@@ -59,34 +59,9 @@ class ExtensionsConfigFileGeneratorPlugin {
|
|
|
59
59
|
main.setupFiles.push(...setupFiles);
|
|
60
60
|
return main;
|
|
61
61
|
}, { assets: [], setupFiles: [] });
|
|
62
|
-
if (combinedExtensionData.assets.length > 0 || combinedExtensionData.setupFiles.length > 0) {
|
|
63
|
-
UnifiedLoaderGenerator_1.UnifiedLoaderGenerator.semaphore.resolve(this.id, {
|
|
64
|
-
group: 'extensions-config-v2',
|
|
65
|
-
action: writer => {
|
|
66
|
-
let finalExtensionsDest = this.extensionsDest.endsWith("/") ? this.extensionsDest : this.extensionsDest + "/";
|
|
67
|
-
if (!finalExtensionsDest.startsWith("/")) {
|
|
68
|
-
finalExtensionsDest = "/" + finalExtensionsDest;
|
|
69
|
-
}
|
|
70
|
-
writer
|
|
71
|
-
.use("Plaudit\\Base\\API\\ThemeUtils")
|
|
72
|
-
.withScope(writer => writer
|
|
73
|
-
.assign("$filePathPrefix", new php_writer_1.Expr(`__DIR__.${php_writer_1.Expr.convertJsonToPHP(finalExtensionsDest)}`))
|
|
74
|
-
.call("plaudit_webpack_extensions__resolve_base_uri", [new php_writer_1.Expr("$filePathPrefix")], { assignTo: "$fileUriPrefix" })
|
|
75
|
-
.call("ThemeUtils::loadExtensionsV2", [
|
|
76
|
-
new php_writer_1.Expr(`__DIR__.${php_writer_1.Expr.convertJsonToPHP(finalExtensionsDest + "mapping.config.php")}`),
|
|
77
|
-
new php_writer_1.Expr(`$filePathPrefix`), new php_writer_1.Expr("$fileUriPrefix"),
|
|
78
|
-
`${this.config.plainEntrypointsHandlePrefix || node_path_1.default.basename(process.cwd())}_extension_`
|
|
79
|
-
]));
|
|
80
|
-
}
|
|
81
|
-
});
|
|
62
|
+
if (combinedExtensionData.assets.length > 0 || combinedExtensionData.setupFiles.length > 0 || !this.config.useUnifiedLoader) {
|
|
82
63
|
this.generateVersionTwoConfigFile(compilation, combinedExtensionData);
|
|
83
64
|
}
|
|
84
|
-
else {
|
|
85
|
-
if (!this.config.useUnifiedLoader) {
|
|
86
|
-
this.generateVersionTwoConfigFile(compilation, combinedExtensionData);
|
|
87
|
-
}
|
|
88
|
-
UnifiedLoaderGenerator_1.UnifiedLoaderGenerator.semaphore.resolve(this.id, undefined);
|
|
89
|
-
}
|
|
90
65
|
});
|
|
91
66
|
}
|
|
92
67
|
});
|
|
@@ -120,9 +95,29 @@ class ExtensionsConfigFileGeneratorPlugin {
|
|
|
120
95
|
myCacheData.assets.push(assetDataSource);
|
|
121
96
|
compilation.deleteAsset("assets.json");
|
|
122
97
|
ExtensionsConfigFileGeneratorPlugin.semaphore.resolve(this.id, myCacheData);
|
|
98
|
+
UnifiedLoaderGenerator_1.UnifiedLoaderGenerator.semaphore.resolve(this.id, myCacheData.setupFiles.length > 0 || myCacheData.assets.length > 0 ? {
|
|
99
|
+
group: 'extensions-config-v2',
|
|
100
|
+
action: writer => {
|
|
101
|
+
let finalExtensionsDest = this.extensionsDest.endsWith("/") ? this.extensionsDest : this.extensionsDest + "/";
|
|
102
|
+
if (!finalExtensionsDest.startsWith("/")) {
|
|
103
|
+
finalExtensionsDest = "/" + finalExtensionsDest;
|
|
104
|
+
}
|
|
105
|
+
writer
|
|
106
|
+
.use("Plaudit\\Base\\API\\ThemeUtils")
|
|
107
|
+
.withScope(writer => writer
|
|
108
|
+
.assign("$filePathPrefix", new php_writer_1.Expr(`__DIR__.${php_writer_1.Expr.convertJsonToPHP(finalExtensionsDest)}`))
|
|
109
|
+
.call("plaudit_webpack_extensions__resolve_base_uri", [new php_writer_1.Expr("$filePathPrefix")], { assignTo: "$fileUriPrefix" })
|
|
110
|
+
.call("ThemeUtils::loadExtensionsV2", [
|
|
111
|
+
new php_writer_1.Expr(`__DIR__.${php_writer_1.Expr.convertJsonToPHP(finalExtensionsDest + "mapping.config.php")}`),
|
|
112
|
+
new php_writer_1.Expr(`$filePathPrefix`), new php_writer_1.Expr("$fileUriPrefix"),
|
|
113
|
+
`${this.config.plainEntrypointsHandlePrefix || node_path_1.default.basename(process.cwd())}_extension_`
|
|
114
|
+
]));
|
|
115
|
+
}
|
|
116
|
+
} : undefined);
|
|
123
117
|
}
|
|
124
118
|
catch (e) {
|
|
125
119
|
ExtensionsConfigFileGeneratorPlugin.semaphore.reject(this.id);
|
|
120
|
+
UnifiedLoaderGenerator_1.UnifiedLoaderGenerator.semaphore.reject(this.id);
|
|
126
121
|
if (e instanceof Error) {
|
|
127
122
|
compilation.errors.push(e);
|
|
128
123
|
return;
|
|
@@ -257,7 +257,7 @@ class PlainEntrypointsConfigFileGeneratorPlugin {
|
|
|
257
257
|
writer
|
|
258
258
|
.static("$base_uris", { initializer: [] })
|
|
259
259
|
.if("isset($base_uris[$dir])")
|
|
260
|
-
.return("$base_uris[$dir]")
|
|
260
|
+
.return(new php_writer_1.Expr("$base_uris[$dir]"))
|
|
261
261
|
.elseIf("str_starts_with($dir, ABSPATH)")
|
|
262
262
|
.append("$path = ltrim(substr($dir, strlen(ABSPATH)), '/');")
|
|
263
263
|
.elseIf("str_starts_with($dir, '/workspace/website')")
|
|
@@ -21,6 +21,7 @@ class WPMLConfigBuilderPlugin {
|
|
|
21
21
|
this.destDir = destDir;
|
|
22
22
|
}
|
|
23
23
|
apply(compiler) {
|
|
24
|
+
//TODO: Filter by library here as well
|
|
24
25
|
compiler.hooks.compilation.tap(this.constructor.name, compilation => {
|
|
25
26
|
compilation.hooks.processAssets.tapPromise({ name: `${this.constructor.name}__processXML`, stage: webpack_1.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL }, async (assets) => {
|
|
26
27
|
const entrypoint = compilation.entrypoints.get("wpml-config.xml");
|
|
@@ -33,7 +33,7 @@ export declare class PHPWriter {
|
|
|
33
33
|
chain?: boolean;
|
|
34
34
|
return?: boolean;
|
|
35
35
|
}): this;
|
|
36
|
-
return(
|
|
36
|
+
return(expression: unknown | Expr): this;
|
|
37
37
|
static(variable: string, opts?: {
|
|
38
38
|
initializer?: unknown | Expr;
|
|
39
39
|
withTest?: boolean | 'chainable';
|
|
@@ -65,8 +65,8 @@ class PHPWriter {
|
|
|
65
65
|
lineComponents.push(Expr.convertJsonToPHP(expression));
|
|
66
66
|
return this.append(!opts.chain ? lineComponents.join(" ") + ';' : lineComponents.join(" "));
|
|
67
67
|
}
|
|
68
|
-
return(
|
|
69
|
-
return this.append(`return ${
|
|
68
|
+
return(expression) {
|
|
69
|
+
return this.append(`return ${Expr.convertJsonToPHP(expression)};`);
|
|
70
70
|
}
|
|
71
71
|
static(variable, opts = {}) {
|
|
72
72
|
const initializer = opts.initializer ? Expr.convertJsonToPHP(opts.initializer) : "null";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plaudit/webpack-extensions",
|
|
3
|
-
"version": "2.58.
|
|
3
|
+
"version": "2.58.3",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"files": [
|
|
6
6
|
"/build"
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"@plaudit/postcss-silent-extend": "^3.0.0",
|
|
36
36
|
"@plaudit/postcss-strip-units": "^3.0.0",
|
|
37
37
|
"@plaudit/postcss-variables": "^1.1.0",
|
|
38
|
-
"@wordpress/dependency-extraction-webpack-plugin": "^6.
|
|
39
|
-
"@wordpress/scripts": "^30.
|
|
38
|
+
"@wordpress/dependency-extraction-webpack-plugin": "^6.29.0",
|
|
39
|
+
"@wordpress/scripts": "^30.22.0",
|
|
40
40
|
"autoprefixer": "^10.4.21",
|
|
41
41
|
"browser-sync": "^3.0.4",
|
|
42
42
|
"clean-webpack-plugin": "^4.0.0",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"postcss-url": "^10.1.3",
|
|
64
64
|
"react": "^18.3.1",
|
|
65
65
|
"react-dom": "^18.3.1",
|
|
66
|
-
"webpack": "^5.101.
|
|
66
|
+
"webpack": "^5.101.3",
|
|
67
67
|
"webpack-remove-empty-scripts": "^1.1.1",
|
|
68
68
|
"xml-formatter": "^3.6.6"
|
|
69
69
|
},
|