@wordpress-flow/cli 1.0.24 → 1.0.26
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/dist/build/block-build-worker.js +48 -16
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -2005,11 +2005,21 @@ async function runWebpackBuild(entryPoint, outputDir, webpackConfigPath) {
|
|
|
2005
2005
|
if (!fs.existsSync(webpackConfigPath)) {
|
|
2006
2006
|
throw new Error(`Webpack config not found: ${webpackConfigPath}. Please check your wpblock.config.json settings.`);
|
|
2007
2007
|
}
|
|
2008
|
-
|
|
2009
|
-
|
|
2008
|
+
let configModule;
|
|
2009
|
+
try {
|
|
2010
|
+
delete __require.cache[__require.resolve(webpackConfigPath)];
|
|
2011
|
+
configModule = __require(webpackConfigPath);
|
|
2012
|
+
} catch (loadError) {
|
|
2013
|
+
throw new Error(`Failed to load webpack config from ${webpackConfigPath}: ${loadError.message}`);
|
|
2014
|
+
}
|
|
2010
2015
|
const configFactory = configModule.default || configModule;
|
|
2011
2016
|
const env = { entry: entryPoint, output: outputDir };
|
|
2012
|
-
|
|
2017
|
+
let baseConfig;
|
|
2018
|
+
try {
|
|
2019
|
+
baseConfig = typeof configFactory === "function" ? configFactory(env) : configFactory;
|
|
2020
|
+
} catch (configError) {
|
|
2021
|
+
throw new Error(`Failed to execute webpack config factory: ${configError.message}`);
|
|
2022
|
+
}
|
|
2013
2023
|
const config = {
|
|
2014
2024
|
...baseConfig,
|
|
2015
2025
|
mode: "production",
|
|
@@ -2020,19 +2030,41 @@ async function runWebpackBuild(entryPoint, outputDir, webpackConfigPath) {
|
|
|
2020
2030
|
}
|
|
2021
2031
|
};
|
|
2022
2032
|
return new Promise((resolve2, reject) => {
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2033
|
+
try {
|
|
2034
|
+
const compiler = webpack(config);
|
|
2035
|
+
compiler.run((err, stats) => {
|
|
2036
|
+
compiler.close((closeErr) => {
|
|
2037
|
+
if (closeErr) {
|
|
2038
|
+
console.error(`Webpack compiler close error: ${closeErr.message}`);
|
|
2039
|
+
}
|
|
2040
|
+
});
|
|
2041
|
+
if (err) {
|
|
2042
|
+
reject(new Error(`Webpack compilation error: ${err.message}
|
|
2043
|
+
Stack: ${err.stack}`));
|
|
2044
|
+
return;
|
|
2045
|
+
}
|
|
2046
|
+
if (!stats) {
|
|
2047
|
+
reject(new Error(`Webpack returned no stats object`));
|
|
2048
|
+
return;
|
|
2049
|
+
}
|
|
2050
|
+
if (stats.hasErrors()) {
|
|
2051
|
+
const info = stats.toJson();
|
|
2052
|
+
const errorMessages = info.errors?.map((e) => {
|
|
2053
|
+
if (typeof e === "string")
|
|
2054
|
+
return e;
|
|
2055
|
+
return e.message || JSON.stringify(e);
|
|
2056
|
+
}).join(`
|
|
2057
|
+
`) || "Unknown webpack error";
|
|
2058
|
+
reject(new Error(`Webpack build errors:
|
|
2059
|
+
${errorMessages}`));
|
|
2060
|
+
return;
|
|
2061
|
+
}
|
|
2062
|
+
resolve2();
|
|
2063
|
+
});
|
|
2064
|
+
} catch (webpackError) {
|
|
2065
|
+
reject(new Error(`Failed to start webpack: ${webpackError.message}
|
|
2066
|
+
Stack: ${webpackError.stack}`));
|
|
2067
|
+
}
|
|
2036
2068
|
});
|
|
2037
2069
|
}
|
|
2038
2070
|
function verifyBuildOutput(outputDir) {
|
package/dist/index.js
CHANGED
|
@@ -115779,7 +115779,7 @@ class BuildTemplatesCommand {
|
|
|
115779
115779
|
// package.json
|
|
115780
115780
|
var package_default = {
|
|
115781
115781
|
name: "@wordpress-flow/cli",
|
|
115782
|
-
version: "1.0.
|
|
115782
|
+
version: "1.0.26",
|
|
115783
115783
|
type: "module",
|
|
115784
115784
|
description: "TypeScript-based WordPress block creation system",
|
|
115785
115785
|
main: "dist/index.js",
|