@plaudit/webpack-extensions 2.55.0 → 2.55.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.
|
@@ -22,7 +22,7 @@ class Expr {
|
|
|
22
22
|
exports.Expr = Expr;
|
|
23
23
|
class PHPWriter {
|
|
24
24
|
inlineFirstLine;
|
|
25
|
-
buffer =
|
|
25
|
+
buffer = [];
|
|
26
26
|
indentation = "";
|
|
27
27
|
printingInPHP = true;
|
|
28
28
|
fileNamespace = "";
|
|
@@ -40,7 +40,7 @@ class PHPWriter {
|
|
|
40
40
|
}
|
|
41
41
|
append(...lines) {
|
|
42
42
|
for (const line of lines) {
|
|
43
|
-
this.buffer
|
|
43
|
+
this.buffer.push(`${this.indentation}${line}`);
|
|
44
44
|
}
|
|
45
45
|
return this;
|
|
46
46
|
}
|
|
@@ -57,7 +57,7 @@ class PHPWriter {
|
|
|
57
57
|
return this;
|
|
58
58
|
}
|
|
59
59
|
linebreak() {
|
|
60
|
-
this.buffer
|
|
60
|
+
this.buffer.push("");
|
|
61
61
|
return this;
|
|
62
62
|
}
|
|
63
63
|
call(func, args, opts = {}) {
|
|
@@ -166,21 +166,25 @@ class PHPWriter {
|
|
|
166
166
|
return this;
|
|
167
167
|
}
|
|
168
168
|
toString() {
|
|
169
|
-
|
|
169
|
+
const fileContents = [];
|
|
170
|
+
let canInline = true;
|
|
170
171
|
if (this.fileNamespace) {
|
|
171
|
-
|
|
172
|
+
canInline = false;
|
|
173
|
+
fileContents.push(`namespace ${this.fileNamespace};`);
|
|
172
174
|
}
|
|
173
|
-
if (this.useList) {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
175
|
+
if (this.useList.length) {
|
|
176
|
+
canInline = false;
|
|
177
|
+
fileContents.push(...this.useList.map(use => `use ${use};`));
|
|
178
|
+
}
|
|
179
|
+
fileContents.push(...this.buffer);
|
|
180
|
+
if (this.inlineFirstLine && canInline) {
|
|
181
|
+
return `<?php ${fileContents.join("\n")}`;
|
|
178
182
|
}
|
|
179
|
-
if (
|
|
180
|
-
return
|
|
183
|
+
else if (fileContents.find(line => line.length > 0)) {
|
|
184
|
+
return "<?php\n" + fileContents.join("\n");
|
|
181
185
|
}
|
|
182
186
|
else {
|
|
183
|
-
return "<?php"
|
|
187
|
+
return "<?php";
|
|
184
188
|
}
|
|
185
189
|
}
|
|
186
190
|
emitAsset(compilation, file, assetInfo) {
|
|
@@ -333,6 +333,7 @@ function commonConfigProcessingPrep(config, webpackConfig) {
|
|
|
333
333
|
updateCurrentVariables: (value) => currentVariables = value
|
|
334
334
|
};
|
|
335
335
|
}
|
|
336
|
+
//TODO: Implement path deduplication w/ the same code we use for block.json (only for plain v2 w/ specified handles
|
|
336
337
|
//TODO: Try using context to avoid needing to cobble dest paths together?
|
|
337
338
|
function processIndividualWebpackConfig(config, webpackConfig, sources) {
|
|
338
339
|
const commonConfig = commonConfigProcessingPrep(config, webpackConfig);
|