@enact/cli 5.0.1 → 5.0.2

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/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 5.0.2 (September 16, 2022)
2
+
3
+ * Pinned versions of dependencies as same as 5.0.0.
4
+
5
+ ### serve
6
+
7
+ * Fixed deprecation warning regarding middleware.
8
+
1
9
  ## 5.0.1 (August 30, 2022)
2
10
 
3
11
  ### pack
package/commands/serve.js CHANGED
@@ -211,22 +211,31 @@ function devServerConfig(host, port, protocol, publicPath, proxy, allowedHost) {
211
211
  },
212
212
  // `proxy` is run between `before` and `after` `webpack-dev-server` hooks
213
213
  proxy,
214
- onBeforeSetupMiddleware(devServer) {
215
- // Keep `evalSourceMapMiddleware`
216
- // middlewares before `redirectServedPath` otherwise will not have any effect
217
- // This lets us fetch source contents from webpack for the error overlay
218
- devServer.app.use(evalSourceMapMiddleware(devServer));
214
+ setupMiddlewares(middlewares, devServer) {
215
+ if (!devServer) {
216
+ throw new Error('webpack-dev-server is not defined');
217
+ }
219
218
 
220
219
  // Optionally register app-side proxy middleware if it exists
221
220
  const proxySetup = path.join(process.cwd(), 'src', 'setupProxy.js');
222
221
  if (fs.existsSync(proxySetup)) {
223
222
  require(proxySetup)(devServer.app);
224
223
  }
225
- },
226
- onAfterSetupMiddleware(devServer) {
227
- // Redirect to `PUBLIC_URL` or `homepage`/`enact.publicUrl` from `package.json`
228
- // if url not match
229
- devServer.app.use(redirectServedPathMiddleware(publicPath));
224
+
225
+ middlewares.unshift(
226
+ // Keep `evalSourceMapMiddleware`
227
+ // middlewares before `redirectServedPath` otherwise will not have any effect
228
+ // This lets us fetch source contents from webpack for the error overlay
229
+ evalSourceMapMiddleware(devServer)
230
+ );
231
+
232
+ middlewares.push(
233
+ // Redirect to `PUBLIC_URL` or `homepage`/`enact.publicUrl` from `package.json`
234
+ // if url not match
235
+ redirectServedPathMiddleware(publicPath)
236
+ );
237
+
238
+ return middlewares;
230
239
  }
231
240
  };
232
241
  }