@flatjs/evolve 2.0.7 → 2.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -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=async(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:await createPlugins(a,i,r),watchOptions:c,output:await createOutput(a,r,i),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),performance:createPerformance(a,s?.performance),optimization:createOptimization(a,r,i),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=async(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:await createPlugins(a,i,r),watchOptions:c,output:await createOutput(a,r,i),context:o,target:s?.target??["web","es5"],resolve:createResolve(o,s),module:{rules:m},devtool:a?"eval-source-map":s?.sourceMap||!1,externalsType:s?.externalsType,externals:createExternals(s?.externals,i),performance:createPerformance(a,s?.performance),optimization:createOptimization(a,r,i),infrastructureLogging:s?.infrastructureLogging??{level:"warn"},stats:s?.stats??{preset:"minimal"},cache:{type:"memory"}}};
@@ -1 +1 @@
1
- import{searchConfig}from"@armit/config-loader";import{mergeOptions,logger}from"@flatjs/common";import{configFileName,moduleName}from"../constants.js";import{defaultEvolveOptions}from"../default-options.js";import{normalizeResolveAlias}from"../helpers/normalize-resolve-alias.js";import{refreshEvolveMockOptions}from"../helpers/refresh-evolve-mock-options.js";export const loadEvolveConfig=async(o,e,i={},s={configFile:configFileName,esmLoaderOptions:{externals:["@flatjs/evolve","@flatjs/mock","@flatjs/common"]}})=>{const{configFile:l,esmLoaderOptions:r}=s,a=await searchConfig(l,e,{esm:{...r,projectCwd:e}});let n={};n="function"==typeof a?.config?await(a?.config(o)):a?.config||{};const t=mergeOptions(defaultEvolveOptions,n),m=mergeOptions(t,i),f=mergeOptions(m,{projectCwd:e}),c="build"===o.command?f:await refreshEvolveMockOptions(e,f,s);return logger.debug(`Load evolve config:\n${JSON.stringify(c,null,2)}`,moduleName),c.webpack?.resolve?.alias&&(c.webpack.resolve.alias=normalizeResolveAlias(e,c.webpack?.resolve?.alias)),c};
1
+ import{searchConfig}from"@armit/config-loader";import{mergeOptions,logger}from"@flatjs/common";import{configFileName,moduleName}from"../constants.js";import{defaultEvolveOptions}from"../default-options.js";import{normalizeResolveAlias}from"../helpers/normalize-resolve-alias.js";import{refreshEvolveMockOptions}from"../helpers/refresh-evolve-mock-options.js";export const loadEvolveConfig=async(o,e,i={},s={configFile:configFileName,esmLoaderOptions:{externals:[/^@flatjs\/.*/]}})=>{const{configFile:r,esmLoaderOptions:l}=s,a=await searchConfig(r,e,{esm:{...l,projectCwd:e}});let n={};n="function"==typeof a?.config?await(a?.config(o)):a?.config||{};const t=mergeOptions(defaultEvolveOptions,n),m=mergeOptions(t,i),f=mergeOptions(m,{projectCwd:e}),c="build"===o.command?f:await refreshEvolveMockOptions(e,f,s);return logger.debug(`Load evolve config:\n${JSON.stringify(c,null,2)}`,moduleName),c.webpack?.resolve?.alias&&(c.webpack.resolve.alias=normalizeResolveAlias(e,c.webpack?.resolve?.alias)),c};
@@ -1,7 +1,7 @@
1
1
  export type ConfigLoaderOptions = {
2
2
  configFile: string;
3
3
  esmLoaderOptions: {
4
- externals: string[];
4
+ externals: Array<RegExp | string>;
5
5
  projectCwd?: string;
6
6
  };
7
7
  };
@@ -27,6 +27,11 @@ export interface FlatEvolveWebpackOptions extends Pick<Configuration, 'performan
27
27
  */
28
28
  alias?: Record<string, string>;
29
29
  };
30
+ /**
31
+ * Specify the default type of externals.
32
+ * @example `externalsType: 'window'`
33
+ */
34
+ externalsType?: Configuration['externalsType'];
30
35
  /**
31
36
  * @default
32
37
  * ```json
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flatjs/evolve",
3
- "version": "2.0.7",
3
+ "version": "2.0.9",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -35,17 +35,17 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@armit/babel-merge": "^0.1.4",
38
- "@armit/config-loader": "^0.1.4",
38
+ "@armit/config-loader": "^0.1.5",
39
39
  "@armit/file-utility": "^0.1.3",
40
40
  "@armit/git": "^0.1.3",
41
- "@armit/package": "^0.1.3",
41
+ "@armit/package": "^0.1.4",
42
42
  "@armit/worker-threads": "^0.1.3",
43
43
  "@babel/core": "7.23.9",
44
- "@flatjs/common": "2.0.3",
45
- "@flatjs/evolve-preset-babel": "2.0.3",
46
- "@flatjs/forge-postcss-plugin-pixel": "2.0.3",
47
- "@flatjs/graph": "2.0.5",
48
- "@flatjs/mock": "2.0.5",
44
+ "@flatjs/common": "2.0.4",
45
+ "@flatjs/evolve-preset-babel": "2.0.4",
46
+ "@flatjs/forge-postcss-plugin-pixel": "2.0.4",
47
+ "@flatjs/graph": "2.0.6",
48
+ "@flatjs/mock": "2.0.6",
49
49
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.11",
50
50
  "@types/babel__core": "7.20.5",
51
51
  "babel-loader": "9.1.3",
@@ -80,7 +80,7 @@
80
80
  },
81
81
  "devDependencies": {
82
82
  "@armit/eslint-config-bases": "^0.1.4",
83
- "@flatjs/testing": "2.0.3",
83
+ "@flatjs/testing": "2.0.4",
84
84
  "@swc/core": "1.3.106",
85
85
  "@types/express": "4.17.21",
86
86
  "@types/listr": "0.14.9",