@flatjs/evolve 2.1.0-next.25 → 2.1.0-next.27

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- import{join}from"node:path";import WebpackDevServer from"webpack-dev-server";export const addCompilerToDevServer=(e,o,r,t,s)=>{const{projectCwd:p,devServer:c}=s,l=new WebpackDevServer({server:{type:c?.https?"https":"http",options:{...c?.https}},open:!1,compress:!0,port:r,hot:o,liveReload:!o,allowedHosts:"all",static:{directory:`${join(p,"/public")}`},headers:{"Access-Control-Allow-Origin":"*"},client:{progress:!0,overlay:c?.clientOverlay,webSocketURL:"localIp"===c?.webSocketURL?{hostname:t||void 0}:{hostname:"0.0.0.0",...c?.webSocketURL}}},e);return new Promise(((e,o)=>{l.startCallback((r=>{if(r)return o(r);e(!0)}))}))};
1
+ import{join}from"node:path";import WebpackDevServer from"webpack-dev-server";export const addCompilerToDevServer=(e,r,t,o,s)=>{const{projectCwd:d,devServer:l}=s,a=new WebpackDevServer({server:{type:l?.https?"https":"http",options:{...l?.https}},open:!1,compress:!0,port:t,hot:r,liveReload:!r,allowedHosts:"all",static:{directory:`${join(d,"/public")}`},headers:{"Access-Control-Allow-Origin":"*"},setupMiddlewares:e=>(l?.devBeforeMiddlewares&&e.unshift(...l.devBeforeMiddlewares),l?.devAfterMiddlewares&&e.push(...l.devAfterMiddlewares),e),client:{progress:!0,overlay:l?.clientOverlay,webSocketURL:"localIp"===l?.webSocketURL?{hostname:o||void 0}:{hostname:"0.0.0.0",...l?.webSocketURL}}},e);return new Promise(((e,r)=>{a.startCallback((t=>{if(t)return r(t);e(!0)}))}))};
@@ -1 +1 @@
1
- import{resolve}from"node:path";import{ensureSlash}from"@flatjs/common";export const normalizeEntryModuleAbsolutePath=(e,o)=>{const{projectCwd:s}=e,t=[];for(const[,e]of Object.entries(o)){const{entryModuleBase:o,entry:r}=e;if(o)for(const e of o){const o=ensureSlash(resolve(s,e),!0);t.push(o)}else for(const e of r){let o=resolve(s,e);/\.(ts|tsx|js|jsx)$/.test(o)&&(o=o.replace(/\/[^/]*$/,""));const r=ensureSlash(o,!0);t.push(r)}}return Array.from(new Set(t))};
1
+ import{resolve}from"node:path";import{ensureSlash}from"@flatjs/common";export const normalizeEntryModuleAbsolutePath=(e,o)=>{const{projectCwd:s}=e,t=[];for(const[,e]of Object.entries(o)){const{entryModuleBase:o,entry:r}=e;if(o)for(const e of o){const o=ensureSlash(resolve(s,e),!0);t.push(o)}else for(const e of r){let o=resolve(s,e);(/\.(ts|tsx|js|jsx)$/.test(o)||o.endsWith("/index"))&&(o=o.replace(/\/[^/]*$/,""));const r=ensureSlash(o,!0);t.push(r)}}return Array.from(new Set(t))};
@@ -1,5 +1,5 @@
1
1
  import { type RequestHandler } from 'express';
2
- import { type ClientConfiguration, type WebSocketURL } from 'webpack-dev-server';
2
+ import { type ClientConfiguration, Middleware, type WebSocketURL } from 'webpack-dev-server';
3
3
  import { type FlatMockOptions, type SecureContextHttps } from '@flatjs/mock';
4
4
  import { type EvolveEntryMapContent } from './types-entry-map.js';
5
5
  export interface WebpackWatchOptions {
@@ -36,6 +36,18 @@ export type FlatEvolveDevServerOptions = {
36
36
  * This configuration will be merged into `webpack-dev-server`
37
37
  */
38
38
  watchOptions?: WebpackWatchOptions;
39
+ /**
40
+ * Provides the ability to execute a custom function and apply custom middleware(s).
41
+ * https://webpack.js.org/configuration/dev-server/#devserversetupmiddlewares
42
+ * @default []
43
+ */
44
+ devBeforeMiddlewares?: Middleware[];
45
+ /**
46
+ * Provides the ability to execute a custom function and apply custom middleware(s).
47
+ * https://webpack.js.org/configuration/dev-server/#devserversetupmiddlewares
48
+ * @default []
49
+ */
50
+ devAfterMiddlewares?: Middleware[];
39
51
  /**
40
52
  * Allow us costomized global serve data injected into `window.GLOBAL = {...globalData}`
41
53
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flatjs/evolve",
3
- "version": "2.1.0-next.25",
3
+ "version": "2.1.0-next.27",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -42,10 +42,10 @@
42
42
  "@babel/core": "^7.24.7",
43
43
  "@flatjs/babel-plugin-import": "2.1.0-next.9",
44
44
  "@flatjs/common": "2.1.0-next.8",
45
- "@flatjs/evolve-preset-babel": "2.1.0-next.8",
45
+ "@flatjs/evolve-preset-babel": "2.1.0-next.9",
46
46
  "@flatjs/forge-postcss-plugin-pixel": "2.1.0-next.8",
47
- "@flatjs/graph": "2.1.0-next.11",
48
- "@flatjs/mock": "2.1.0-next.12",
47
+ "@flatjs/graph": "2.1.0-next.12",
48
+ "@flatjs/mock": "2.1.0-next.13",
49
49
  "@pmmmwh/react-refresh-webpack-plugin": "^0.5.15",
50
50
  "@types/babel__core": "^7.20.5",
51
51
  "babel-loader": "^9.1.3",