@utoo/pack-shared 1.1.8 → 1.1.9
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/cjs/config.d.ts +4 -1
- package/cjs/webpackCompat.js +18 -11
- package/esm/config.d.ts +4 -1
- package/esm/webpackCompat.js +18 -11
- package/package.json +1 -1
package/cjs/config.d.ts
CHANGED
|
@@ -147,7 +147,10 @@ export interface ConfigComplete {
|
|
|
147
147
|
persistentCaching?: boolean;
|
|
148
148
|
nodePolyfill?: boolean;
|
|
149
149
|
devServer?: {
|
|
150
|
-
hot
|
|
150
|
+
hot?: boolean;
|
|
151
|
+
port?: number;
|
|
152
|
+
host?: string;
|
|
153
|
+
https?: boolean;
|
|
151
154
|
};
|
|
152
155
|
cacheHandler?: string;
|
|
153
156
|
experimental?: ExperimentalConfig;
|
package/cjs/webpackCompat.js
CHANGED
|
@@ -17,7 +17,7 @@ function compatOptionsFromWebpack(webpackConfig) {
|
|
|
17
17
|
define: compatFromWebpackPlugin(plugins, compatDefine),
|
|
18
18
|
provider: compatFromWebpackPlugin(plugins, compatProvider),
|
|
19
19
|
stats: compatStats(stats),
|
|
20
|
-
|
|
20
|
+
devServer: compatDevServer(webpackConfig.devServer),
|
|
21
21
|
},
|
|
22
22
|
buildId: webpackConfig.name,
|
|
23
23
|
};
|
|
@@ -100,16 +100,6 @@ function compatFromWebpackPlugin(webpackPlugins, picker) {
|
|
|
100
100
|
const plugin = webpackPlugins === null || webpackPlugins === void 0 ? void 0 : webpackPlugins.find((p) => p && typeof p === "object" && p.constructor.name === picker.pluginName);
|
|
101
101
|
return picker(plugin);
|
|
102
102
|
}
|
|
103
|
-
function compatFromWebpackPlugins(webpackPlugins, picker) {
|
|
104
|
-
const plugins = webpackPlugins === null || webpackPlugins === void 0 ? void 0 : webpackPlugins.filter((p) => p && typeof p === "object" && p.constructor.name === picker.pluginName);
|
|
105
|
-
if (!plugins || plugins.length === 0) {
|
|
106
|
-
return undefined;
|
|
107
|
-
}
|
|
108
|
-
const results = plugins.map(picker).filter((r) => r !== undefined);
|
|
109
|
-
if (results.length === 0)
|
|
110
|
-
return undefined;
|
|
111
|
-
return results.length === 1 ? results[0] : results;
|
|
112
|
-
}
|
|
113
103
|
compatHtml.pluginName = "HtmlWebpackPlugin";
|
|
114
104
|
function compatHtml(maybeWebpackPluginInstance) {
|
|
115
105
|
if (!maybeWebpackPluginInstance) {
|
|
@@ -411,3 +401,20 @@ function compatOptimization(webpackOptimization) {
|
|
|
411
401
|
function compatStats(webpackStats) {
|
|
412
402
|
return !!webpackStats;
|
|
413
403
|
}
|
|
404
|
+
function compatDevServer(devServer) {
|
|
405
|
+
if (!devServer)
|
|
406
|
+
return undefined;
|
|
407
|
+
const result = {};
|
|
408
|
+
if (typeof devServer.hot !== "undefined")
|
|
409
|
+
result.hot = !!devServer.hot;
|
|
410
|
+
if (typeof devServer.port !== "undefined") {
|
|
411
|
+
const p = Number(devServer.port);
|
|
412
|
+
if (!Number.isNaN(p))
|
|
413
|
+
result.port = p;
|
|
414
|
+
}
|
|
415
|
+
if (typeof devServer.host !== "undefined")
|
|
416
|
+
result.host = devServer.host;
|
|
417
|
+
if (typeof devServer.https !== "undefined")
|
|
418
|
+
result.https = !!devServer.https;
|
|
419
|
+
return result;
|
|
420
|
+
}
|
package/esm/config.d.ts
CHANGED
|
@@ -147,7 +147,10 @@ export interface ConfigComplete {
|
|
|
147
147
|
persistentCaching?: boolean;
|
|
148
148
|
nodePolyfill?: boolean;
|
|
149
149
|
devServer?: {
|
|
150
|
-
hot
|
|
150
|
+
hot?: boolean;
|
|
151
|
+
port?: number;
|
|
152
|
+
host?: string;
|
|
153
|
+
https?: boolean;
|
|
151
154
|
};
|
|
152
155
|
cacheHandler?: string;
|
|
153
156
|
experimental?: ExperimentalConfig;
|
package/esm/webpackCompat.js
CHANGED
|
@@ -14,7 +14,7 @@ export function compatOptionsFromWebpack(webpackConfig) {
|
|
|
14
14
|
define: compatFromWebpackPlugin(plugins, compatDefine),
|
|
15
15
|
provider: compatFromWebpackPlugin(plugins, compatProvider),
|
|
16
16
|
stats: compatStats(stats),
|
|
17
|
-
|
|
17
|
+
devServer: compatDevServer(webpackConfig.devServer),
|
|
18
18
|
},
|
|
19
19
|
buildId: webpackConfig.name,
|
|
20
20
|
};
|
|
@@ -97,16 +97,6 @@ function compatFromWebpackPlugin(webpackPlugins, picker) {
|
|
|
97
97
|
const plugin = webpackPlugins === null || webpackPlugins === void 0 ? void 0 : webpackPlugins.find((p) => p && typeof p === "object" && p.constructor.name === picker.pluginName);
|
|
98
98
|
return picker(plugin);
|
|
99
99
|
}
|
|
100
|
-
function compatFromWebpackPlugins(webpackPlugins, picker) {
|
|
101
|
-
const plugins = webpackPlugins === null || webpackPlugins === void 0 ? void 0 : webpackPlugins.filter((p) => p && typeof p === "object" && p.constructor.name === picker.pluginName);
|
|
102
|
-
if (!plugins || plugins.length === 0) {
|
|
103
|
-
return undefined;
|
|
104
|
-
}
|
|
105
|
-
const results = plugins.map(picker).filter((r) => r !== undefined);
|
|
106
|
-
if (results.length === 0)
|
|
107
|
-
return undefined;
|
|
108
|
-
return results.length === 1 ? results[0] : results;
|
|
109
|
-
}
|
|
110
100
|
compatHtml.pluginName = "HtmlWebpackPlugin";
|
|
111
101
|
function compatHtml(maybeWebpackPluginInstance) {
|
|
112
102
|
if (!maybeWebpackPluginInstance) {
|
|
@@ -408,3 +398,20 @@ function compatOptimization(webpackOptimization) {
|
|
|
408
398
|
function compatStats(webpackStats) {
|
|
409
399
|
return !!webpackStats;
|
|
410
400
|
}
|
|
401
|
+
function compatDevServer(devServer) {
|
|
402
|
+
if (!devServer)
|
|
403
|
+
return undefined;
|
|
404
|
+
const result = {};
|
|
405
|
+
if (typeof devServer.hot !== "undefined")
|
|
406
|
+
result.hot = !!devServer.hot;
|
|
407
|
+
if (typeof devServer.port !== "undefined") {
|
|
408
|
+
const p = Number(devServer.port);
|
|
409
|
+
if (!Number.isNaN(p))
|
|
410
|
+
result.port = p;
|
|
411
|
+
}
|
|
412
|
+
if (typeof devServer.host !== "undefined")
|
|
413
|
+
result.host = devServer.host;
|
|
414
|
+
if (typeof devServer.https !== "undefined")
|
|
415
|
+
result.https = !!devServer.https;
|
|
416
|
+
return result;
|
|
417
|
+
}
|