@flatjs/evolve 1.8.1-next.33 → 1.8.1-next.35
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +12 -0
- package/dist/create-webpack/create-plugins.js +1 -1
- package/dist/create-webpack/create-resolve.d.ts +1 -1
- package/dist/create-webpack/create-resolve.js +1 -1
- package/dist/create-webpack/load-webpack-config.js +1 -1
- package/dist/helpers/refresh-evolve-mock-options.js +1 -1
- package/dist/load-config/load-evolve-config.js +1 -1
- package/dist/main/prepare-build.js +1 -1
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# @flatjs/evolve
|
2
2
|
|
3
|
+
## 1.8.1-next.35
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- 3414589: fix load mock config missed `@flatjs/mock` as esmloader externals
|
8
|
+
|
9
|
+
## 1.8.1-next.34
|
10
|
+
|
11
|
+
### Patch Changes
|
12
|
+
|
13
|
+
- 51339d5: add `tsconfig-paths` & `extensionAlias`
|
14
|
+
|
3
15
|
## 1.8.1-next.33
|
4
16
|
|
5
17
|
### Patch Changes
|
@@ -1 +1 @@
|
|
1
|
-
import{logger}from"@flatjs/common";import ReactRefreshWebpackPlugin from"@pmmmwh/react-refresh-webpack-plugin";import CaseSensitivePathsPlugin from"case-sensitive-paths-webpack-plugin";import ForkTsCheckerWebpackPlugin from"fork-ts-checker-webpack-plugin";import MiniCssExtractPlugin from"mini-css-extract-plugin";import{BundleAnalyzerPlugin}from"webpack-bundle-analyzer";import{moduleName}from"../constants.js";import{enableBundleHashNameForModule}from"../helpers/enable-bundle-hashname-for-module.js";import{getBundleFileName}from"../helpers/get-bundle-file-name.js";import{shouldEnableReactFastRefresh}from"../helpers/should-enable-react-fast-refresh.js";import{createCleanWebpackPlugin}from"../plugins/clean-webpack/index.js";import{createModuleFederationPlugin}from"../plugins/module-federation/index.js";import{createHtmlPlugins}from"../plugins/multi-html/index.js";export const createPlugins=(e,n,r)=>{const[t,
|
1
|
+
import{logger}from"@flatjs/common";import ReactRefreshWebpackPlugin from"@pmmmwh/react-refresh-webpack-plugin";import CaseSensitivePathsPlugin from"case-sensitive-paths-webpack-plugin";import ForkTsCheckerWebpackPlugin from"fork-ts-checker-webpack-plugin";import MiniCssExtractPlugin from"mini-css-extract-plugin";import webpack from"webpack";import{BundleAnalyzerPlugin}from"webpack-bundle-analyzer";import{moduleName}from"../constants.js";import{enableBundleHashNameForModule}from"../helpers/enable-bundle-hashname-for-module.js";import{getBundleFileName}from"../helpers/get-bundle-file-name.js";import{shouldEnableReactFastRefresh}from"../helpers/should-enable-react-fast-refresh.js";import{createCleanWebpackPlugin}from"../plugins/clean-webpack/index.js";import{createModuleFederationPlugin}from"../plugins/module-federation/index.js";import{createHtmlPlugins}from"../plugins/multi-html/index.js";export const createPlugins=(e,n,r)=>{const[t,a]=n,s=enableBundleHashNameForModule(r,a?.options),l=[new webpack.WatchIgnorePlugin({paths:[/\.d\.[cm]ts$/]}),new CaseSensitivePathsPlugin,new MiniCssExtractPlugin({filename:`[name]/${getBundleFileName("css",e,s)}`,chunkFilename:"[id].[contenthash].css"}),...createCleanWebpackPlugin(e,n,r),...createModuleFederationPlugin(e,n,r),...createHtmlPlugins(e,n,r)],{analyzer:i,loaderOptions:o}=r,c=n[1].entry||[],u=c.find((e=>/.vue$/.test(e)));if(o.runTsChecker&&!u){const n=c.reduce(((e,n)=>{const r=/\.(?:ts|tsx|js|jsx)$/.test(n)?[n]:[".ts",".tsx","jsx",".js"].map((e=>n+e));return e.concat(r)}),[]);logger.debug(`ForkTsCheckerWebpackPlugin: include: ${JSON.stringify(n)}`,moduleName),l.push(new ForkTsCheckerWebpackPlugin({async:e,typescript:{context:r.projectCwd,memoryLimit:8192,configOverwrite:{include:[...n,"./*.d.ts"]}}}))}i&&l.push(new BundleAnalyzerPlugin({analyzerPort:"auto",analyzerMode:"server",...i}));const m=shouldEnableReactFastRefresh(e,n,r);m&&l.push(new ReactRefreshWebpackPlugin({overlay:!1})),!m&&e&&logger.warn(`The HMR has disabled cause of ("${t}":"moduleFederation")`);const p=r.webpack?.plugins||[];return l.concat(p)};
|
@@ -1,2 +1,2 @@
|
|
1
1
|
import { type FlatEvolveWebpackOptions } from '../types/types-webpack.js';
|
2
|
-
export declare const createResolve: (webpackOptions?: FlatEvolveWebpackOptions) => import("webpack").ResolveOptions;
|
2
|
+
export declare const createResolve: (projectCwd: string, webpackOptions?: FlatEvolveWebpackOptions) => import("webpack").ResolveOptions;
|
@@ -1 +1 @@
|
|
1
|
-
import{mergeOptions}from"@flatjs/common";export const createResolve=
|
1
|
+
import{join}from"node:path";import{mergeOptions}from"@flatjs/common";import{TsconfigPathsPlugin}from"tsconfig-paths-webpack-plugin";export const createResolve=(s,o)=>{const n={mainFields:["browser","module","main"],extensions:[".ts",".tsx",".js",".json"],extensionAlias:{".js":[".js",".ts"],".cjs":[".cjs",".cts"],".mjs":[".mjs",".mts"],".jsx":[".jsx",".tsx"]},plugins:[new TsconfigPathsPlugin({configFile:join(s,"tsconfig.json"),extensions:[".ts",".tsx",".js"]})]};return mergeOptions(n,o?.resolve||{})};
|
@@ -1 +1 @@
|
|
1
|
-
import{assertOnlySingleEntryItem}from"../helpers/assert-only-single-entry-item.js";import{createExternals}from"./create-externals.js";import{createOptimization}from"./create-optimization.js";import{createOutput}from"./create-output.js";import{createPerformance}from"./create-performance.js";import{createPlugins}from"./create-plugins.js";import{createResolve}from"./create-resolve.js";import{createRuleSets}from"./create-rule-sets.js";export const loadWebpackConfig=(e,t,r)=>{const a="development"===e,{projectCwd:o,webpack:s,devServer:n}=r,c=n?.watchOptions,i=assertOnlySingleEntryItem(t,r),m=createRuleSets(a,i,r);return{mode:e,plugins:createPlugins(a,i,r),watchOptions:c,context:o,target:s?.target??["web","es5"],resolve:createResolve(s),module:{rules:m},devtool:a?"eval-source-map":s?.sourceMap||!1,externals:createExternals(s?.externals,i),output:createOutput(a,r),performance:createPerformance(a,s?.performance),optimization:createOptimization(a,s),infrastructureLogging:s?.infrastructureLogging??{level:"warn"},stats:s?.stats??{preset:"minimal"},cache:{type:"memory"}}};
|
1
|
+
import{assertOnlySingleEntryItem}from"../helpers/assert-only-single-entry-item.js";import{createExternals}from"./create-externals.js";import{createOptimization}from"./create-optimization.js";import{createOutput}from"./create-output.js";import{createPerformance}from"./create-performance.js";import{createPlugins}from"./create-plugins.js";import{createResolve}from"./create-resolve.js";import{createRuleSets}from"./create-rule-sets.js";export const loadWebpackConfig=(e,t,r)=>{const a="development"===e,{projectCwd:o,webpack:s,devServer:n}=r,c=n?.watchOptions,i=assertOnlySingleEntryItem(t,r),m=createRuleSets(a,i,r);return{mode:e,plugins:createPlugins(a,i,r),watchOptions:c,context:o,target:s?.target??["web","es5"],resolve:createResolve(o,s),module:{rules:m},devtool:a?"eval-source-map":s?.sourceMap||!1,externals:createExternals(s?.externals,i),output:createOutput(a,r),performance:createPerformance(a,s?.performance),optimization:createOptimization(a,s),infrastructureLogging:s?.infrastructureLogging??{level:"warn"},stats:s?.stats??{preset:"minimal"},cache:{type:"memory"}}};
|
@@ -1 +1 @@
|
|
1
|
-
import{loadMockConfig}from"@flatjs/mock";import _ from"lodash";export const refreshEvolveMockOptions=async(o,t,s)=>{const
|
1
|
+
import{loadMockConfig}from"@flatjs/mock";import _ from"lodash";export const refreshEvolveMockOptions=async(o,t,s)=>{const e=t.devServer,n=s?.esmLoaderOptions,r=n?.externals||[],c=await loadMockConfig(o,e?.mockOptions||{},_.merge({},s,{configFile:"flatjs-mock",esmLoaderOptions:{externals:[...r,"@flatjs/mock"]}}));return e&&(e.mockOptions=c||{},e.mockOptions&&!e.mockOptions.https&&(e.mockOptions.https=e?.https)),t};
|
@@ -1 +1 @@
|
|
1
|
-
import{mergeOptions,logger,searchConfig}from"@flatjs/common";import{configFileName,moduleName}from"../constants.js";import{defaultEvolveOptions}from"../default-options.js";import{refreshEvolveMockOptions}from"../helpers/refresh-evolve-mock-options.js";export const loadEvolveConfig=async(o,e,t={},
|
1
|
+
import{mergeOptions,logger,searchConfig}from"@flatjs/common";import{configFileName,moduleName}from"../constants.js";import{defaultEvolveOptions}from"../default-options.js";import{refreshEvolveMockOptions}from"../helpers/refresh-evolve-mock-options.js";export const loadEvolveConfig=async(o,e,t={},s={configFile:configFileName,esmLoaderOptions:{externals:["@flatjs/evolve","@flatjs/mock"]}})=>{const{configFile:i,esmLoaderOptions:n}=s,r=await searchConfig(i,e,{esm:{...n,projectCwd:e}});let f={};f="function"==typeof r?.config?r?.config(o):r?.config||{};const l=mergeOptions(defaultEvolveOptions,f),m=mergeOptions(l,t),a=mergeOptions(m,{projectCwd:e}),c=await refreshEvolveMockOptions(e,a,s);return logger.debug(c,moduleName),c};
|
@@ -1 +1 @@
|
|
1
|
-
import{cpus}from"node:os";import{ensureSlash,logger,mergeOptions}from"@flatjs/common";import webpack from"webpack";import{moduleName}from"../constants.js";import{loadWebpackConfig}from"../create-webpack/load-webpack-config.js";import{chunkEntryMap}from"../helpers/chunk-entry-map.js";import{splitToMultiCompilerConfigs}from"../helpers/split-to-multi-compiler.js";import{envVerify}from"./env-verify.js";const getMaxProcessTasks=(e
|
1
|
+
import{cpus}from"node:os";import{chalk,ensureSlash,logger,mergeOptions}from"@flatjs/common";import webpack from"webpack";import{moduleName}from"../constants.js";import{loadWebpackConfig}from"../create-webpack/load-webpack-config.js";import{chunkEntryMap}from"../helpers/chunk-entry-map.js";import{splitToMultiCompilerConfigs}from"../helpers/split-to-multi-compiler.js";import{envVerify}from"./env-verify.js";const getMaxProcessTasks=(t,e)=>Math.max(1,"string"==typeof e&&e.endsWith("%")?Math.round(cpus().length*Number(e.slice(0,-1))/100):Number(e)||t),startSingleEntryBuild=(t,e)=>{const r=loadWebpackConfig("production",t,e),o=splitToMultiCompilerConfigs(t,r,e);if(o.length>1)throw new Error("startSingleEntryBuild() only support `compiler` at a time");const n=o[0];return new Promise(((t,r)=>{webpack(n,((o,s)=>{if(o)return r(o);const i=s?.toJson();return i?.errors?.length?r(i.errors):e.rejectWarnings&&i?.warnings?.length?r(i.warnings):void t({name:n.name,warningStats:i?.warnings})}))}))};export const prepareBuild=async(t,e,r)=>{await envVerify(t,r);const o=r.multiHtmlCdn?.prod||[];if(!o.length)throw new Error('No CDN configuration for env: "prod"');const n=ensureSlash(o[Math.floor(Math.random()*o.length)],!0),s=[],i=chunkEntryMap(e,(a=Object.keys(e).length,l=r.maxProcesses,Math.max(1,"string"==typeof l&&l.endsWith("%")?Math.round(cpus().length*Number(l.slice(0,-1))/100):Number(l)||a)));var a,l;for(const t of i){logger.info(`Build task processing...\n ${chalk(["magenta"])(JSON.stringify(Object.keys(t),null,2))}`,moduleName);const e=[];for(const[o,s]of Object.entries(t)){const t={[o]:s},i=s.options?.useRelativeAssetPath;e.push(startSingleEntryBuild(t,mergeOptions(r,{webpack:{publicPath:i?"auto":n}})))}const o=await Promise.all(e);s.push(...o)}return s};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@flatjs/evolve",
|
3
|
-
"version": "1.8.1-next.
|
3
|
+
"version": "1.8.1-next.35",
|
4
4
|
"license": "MIT",
|
5
5
|
"type": "module",
|
6
6
|
"exports": {
|
@@ -67,6 +67,7 @@
|
|
67
67
|
"react-refresh": "0.14.0",
|
68
68
|
"svgo": "3.0.2",
|
69
69
|
"terser-webpack-plugin": "5.3.9",
|
70
|
+
"tsconfig-paths-webpack-plugin": "4.0.1",
|
70
71
|
"type-fest": "^3.11.0",
|
71
72
|
"webpack": "5.83.1",
|
72
73
|
"webpack-bundle-analyzer": "4.8.0",
|