@flatjs/evolve 1.8.1-next.109 → 1.8.1-next.110

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @flatjs/evolve
2
2
 
3
+ ## 1.8.1-next.110
4
+
5
+ ### Patch Changes
6
+
7
+ - 0508747: Force client websocketURL hostname to local publicIp for `webpack-dev-server`
8
+ - Updated dependencies [0508747]
9
+ - @flatjs/mock@1.8.1-next.83
10
+
3
11
  ## 1.8.1-next.109
4
12
 
5
13
  ### Patch Changes
@@ -5,6 +5,7 @@ import { type FlatEvolveOptions } from '../types/types-options.js';
5
5
  * @param compiler Webpack compiler(s)
6
6
  * @param enableHmr Value indicates if we need to liveReload or `HMR`
7
7
  * @param devPort The port number of `@flatjs/mock`
8
+ * @param publicIp The public ip address of local server
8
9
  * @param evolveOptions The configuration of `@flatjs/evolve` (FlatEvolveOptions)
9
10
  */
10
- export declare const addCompilerToDevServer: (compiler: Compiler, enableHmr: boolean, devPort: number, evolveOptions: FlatEvolveOptions) => Promise<boolean>;
11
+ export declare const addCompilerToDevServer: (compiler: Compiler, enableHmr: boolean, devPort: number, publicIp: string, evolveOptions: FlatEvolveOptions) => Promise<boolean>;
@@ -1 +1 @@
1
- import{join}from"node:path";import WebpackDevServer from"webpack-dev-server";export const addCompilerToDevServer=(e,r,t,o)=>{const{projectCwd:p,devServer:s}=o,l=new WebpackDevServer({server:{type:s?.https?"https":"http",options:{...s?.https}},open:!1,compress:!0,port:t,hot:r,liveReload:!r,allowedHosts:"all",static:{directory:`${join(p,"/public")}`},headers:{"Access-Control-Allow-Origin":"*"},client:{progress:!0,overlay:s?.clientOverlay}},e);return new Promise(((e,r)=>{l.startCallback((t=>{if(t)return r(t);e(!0)}))}))};
1
+ import{join}from"node:path";import WebpackDevServer from"webpack-dev-server";export const addCompilerToDevServer=(e,r,o,t,s)=>{const{projectCwd:p,devServer:i}=s,l=new WebpackDevServer({server:{type:i?.https?"https":"http",options:{...i?.https}},open:!1,compress:!0,port:o,hot:r,liveReload:!r,allowedHosts:"all",static:{directory:`${join(p,"/public")}`},headers:{"Access-Control-Allow-Origin":"*"},client:{progress:!0,overlay:i?.clientOverlay,webSocketURL:{hostname:t||void 0}}},e);return new Promise(((e,r)=>{l.startCallback((o=>{if(o)return r(o);e(!0)}))}))};
@@ -1,3 +1,3 @@
1
1
  import { type FlatEvolveOptions } from '../types/types-options.js';
2
2
  import { type EvolveDevServerEntryMap } from './middlewares/create-page-middleware.js';
3
- export declare const createDevServerCompilerTasks: (projectCwd: string, mainPage: string, servedDevServerEntries: EvolveDevServerEntryMap, evolveOptions: FlatEvolveOptions) => Promise<Promise<boolean>[]>;
3
+ export declare const createDevServerCompilerTasks: (projectCwd: string, mainPage: string, publicIp: string, servedDevServerEntries: EvolveDevServerEntryMap, evolveOptions: FlatEvolveOptions) => Promise<Promise<boolean>[]>;
@@ -1 +1 @@
1
- import{relative}from"node:path";import{chalk,logger,mergeOptions,urlJoin}from"@flatjs/common";import webpack from"webpack";import{loadWebpackConfig}from"../create-webpack/load-webpack-config.js";import{shouldEnableReactFastRefresh}from"../helpers/should-enable-react-fast-refresh.js";import{splitToMultiCompilerConfigs}from"../helpers/split-to-multi-compiler.js";import{addCompilerToDevServer}from"./add-compiler-to-dev-server.js";export const createDevServerCompilerTasks=async(e,o,r,t)=>{const a=[];for(const[i,n]of Object.entries(r)){const l=n.entryConfig,s=l.options?.moduleFederation,p=shouldEnableReactFastRefresh(!0,[i,l],t);(s?.remotes||[]).forEach((e=>{e.endpoint=e=>{const o=r[e];if(!o)throw new Error(`No servedDevServerEntry found via "${e}"`);return urlJoin(o?.devServerHostUri,["/public"])}}));const{devServerPort:c,devServerHostUri:m}=r[i],f={[i]:l},d=urlJoin(m,["public"]),h=await loadWebpackConfig("development",f,mergeOptions(t,{webpack:{publicPath:d}})),v=shouldEnableReactFastRefresh(!0,[i,l],t),u=webpack(splitToMultiCompilerConfigs(f,h,t,v)[0]);a.push(addCompilerToDevServer(u,p,c,t));const g=u.name||"";u.hooks.invalid.tap("fileChange",(o=>{const r=relative(e,o||"");logger.info(`file change ➩ ${chalk(["cyan"])(r)}`,g)})),u.hooks.done.tap("compileDone",(()=>{logger.info(`debug page ➩ ${chalk(["cyan"])(o)}`,g)}))}return a};
1
+ import{relative}from"node:path";import{chalk,logger,mergeOptions,urlJoin}from"@flatjs/common";import webpack from"webpack";import{loadWebpackConfig}from"../create-webpack/load-webpack-config.js";import{shouldEnableReactFastRefresh}from"../helpers/should-enable-react-fast-refresh.js";import{splitToMultiCompilerConfigs}from"../helpers/split-to-multi-compiler.js";import{addCompilerToDevServer}from"./add-compiler-to-dev-server.js";export const createDevServerCompilerTasks=async(e,o,r,t,a)=>{const i=[];for(const[n,l]of Object.entries(t)){const s=l.entryConfig,p=s.options?.moduleFederation,c=shouldEnableReactFastRefresh(!0,[n,s],a);(p?.remotes||[]).forEach((e=>{e.endpoint=e=>{const o=t[e];if(!o)throw new Error(`No servedDevServerEntry found via "${e}"`);return urlJoin(o?.devServerHostUri,["/public"])}}));const{devServerPort:m,devServerHostUri:f}=t[n],d={[n]:s},h=urlJoin(f,["public"]),v=await loadWebpackConfig("development",d,mergeOptions(a,{webpack:{publicPath:h}})),u=shouldEnableReactFastRefresh(!0,[n,s],a),g=webpack(splitToMultiCompilerConfigs(d,v,a,u)[0]);i.push(addCompilerToDevServer(g,c,m,r,a));const b=g.name||"";g.hooks.invalid.tap("fileChange",(o=>{const r=relative(e,o||"");logger.info(`file change ➩ ${chalk(["cyan"])(r)}`,b)})),g.hooks.done.tap("compileDone",(()=>{logger.info(`debug page ➩ ${chalk(["cyan"])(o)}`,b)}))}return i};
@@ -2,5 +2,6 @@ import { type FlatEvolveOptions } from '../types/index.js';
2
2
  export declare const createDevServer: (evolveOptions: FlatEvolveOptions) => Promise<{
3
3
  devPort: number;
4
4
  devHostUri: string;
5
+ publicIp: string;
5
6
  app: import("express-serve-static-core").Express;
6
7
  }>;
@@ -1 +1 @@
1
- import https from"node:https";import{prepareMockDomain}from"@flatjs/mock";import express from"express";export const createDevServer=async e=>{const r=express(),t=e.devServer?.mockOptions,{mockPort:o,hostUri:s}=await prepareMockDomain(t||{});return new Promise((t=>{const p=e.devServer?.https?https.createServer(e.devServer?.https,r):r;r.set("hostUri",s),p.listen(o,(()=>{t({app:r,devHostUri:s,devPort:o})}))}))};
1
+ import https from"node:https";import{prepareMockDomain}from"@flatjs/mock";import express from"express";export const createDevServer=async e=>{const r=express(),t=e.devServer?.mockOptions,{mockPort:o,hostUri:p,publicIp:s}=await prepareMockDomain(t||{});return new Promise((t=>{const i=e.devServer?.https?https.createServer(e.devServer?.https,r):r;r.set("hostUri",p),i.listen(o,(()=>{t({app:r,publicIp:s,devHostUri:p,devPort:o})}))}))};
@@ -1 +1 @@
1
- import{arrayUnique,urlJoin}from"@flatjs/common";import{attachMockMiddlewares}from"@flatjs/mock";import{createAppPageRoute,createDevServer,createDevServerCompilerTasks,createDevServerEntries}from"../dev-server/index.js";import{openPage}from"../helpers/index.js";import{envVerify}from"./env-verify.js";export const prepareServe=async(e,r,t)=>{await envVerify(e,t);const{app:o,devPort:a,devHostUri:i}=await createDevServer(t),s=t.devServer?.mockOptions?.mockFilters||[];for(const[,e]of Object.entries(r))s.push(...e.options?.mockFilters||[]);await attachMockMiddlewares(o,{...t.devServer?.mockOptions,mockFilters:arrayUnique(s),projectCwd:e});const c=await createDevServerEntries(a,r,t);createAppPageRoute(e,o,i,c,t);const n=urlJoin(i,["/pages"]);t.devServer?.autoOpen&&openPage(n);const v=await createDevServerCompilerTasks(e,n,c,t);return Promise.all(v).then((()=>o))};
1
+ import{arrayUnique,urlJoin}from"@flatjs/common";import{attachMockMiddlewares}from"@flatjs/mock";import{createAppPageRoute,createDevServer,createDevServerCompilerTasks,createDevServerEntries}from"../dev-server/index.js";import{openPage}from"../helpers/index.js";import{envVerify}from"./env-verify.js";export const prepareServe=async(e,r,t)=>{await envVerify(e,t);const{app:o,devPort:a,devHostUri:i,publicIp:s}=await createDevServer(t),c=t.devServer?.mockOptions?.mockFilters||[];for(const[,e]of Object.entries(r))c.push(...e.options?.mockFilters||[]);await attachMockMiddlewares(o,{...t.devServer?.mockOptions,mockFilters:arrayUnique(c),projectCwd:e});const n=await createDevServerEntries(a,r,t);createAppPageRoute(e,o,i,n,t);const p=urlJoin(i,["/pages"]);t.devServer?.autoOpen&&openPage(p);const v=await createDevServerCompilerTasks(e,p,s,n,t);return Promise.all(v).then((()=>o))};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flatjs/evolve",
3
- "version": "1.8.1-next.109",
3
+ "version": "1.8.1-next.110",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -47,7 +47,7 @@
47
47
  "@flatjs/evolve-preset-babel": "1.8.1-next.24",
48
48
  "@flatjs/forge-postcss-plugin-pixel": "1.8.1-next.39",
49
49
  "@flatjs/graph": "1.8.1-next.58",
50
- "@flatjs/mock": "1.8.1-next.82",
50
+ "@flatjs/mock": "1.8.1-next.83",
51
51
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.11",
52
52
  "@types/babel__core": "7.20.1",
53
53
  "babel-loader": "9.1.3",