@flatjs/evolve 1.8.1-next.54 → 1.8.1-next.56

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @flatjs/evolve
2
2
 
3
+ ## 1.8.1-next.56
4
+
5
+ ### Patch Changes
6
+
7
+ - 08499ec: Allow pass customized options of `postcss-loader`
8
+ - 87013ff: bump version
9
+ - Updated dependencies [87013ff]
10
+ - @flatjs/forge-postcss-plugin-pixel@1.8.1-next.26
11
+ - @flatjs/evolve-preset-babel@1.8.1-next.12
12
+ - @flatjs/common@1.8.1-next.26
13
+ - @flatjs/graph@1.8.1-next.30
14
+ - @flatjs/mock@1.8.1-next.48
15
+
16
+ ## 1.8.1-next.55
17
+
18
+ ### Patch Changes
19
+
20
+ - 97d839c: Fix ForkTsChecker incorrect `include` of tsconfig.json
21
+
3
22
  ## 1.8.1-next.54
4
23
 
5
24
  ### 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 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{createBuiltinDefineVariables}from"../plugins/define-variable/index.js";import{createModuleFederationPlugin}from"../plugins/module-federation/index.js";import{createHtmlPlugins}from"../plugins/multi-html/index.js";export const createPlugins=async(e,n,a)=>{const[r,t]=n,s=enableBundleHashNameForModule(a,t?.options),i=[new webpack.WatchIgnorePlugin({paths:[/\.d\.[cm]ts$/]}),new CaseSensitivePathsPlugin,new MiniCssExtractPlugin({filename:`[name]/${getBundleFileName("css",e,s)}`,chunkFilename:"[id].[contenthash].css"}),...await createBuiltinDefineVariables(e,a),...createCleanWebpackPlugin(e,n,a),...createModuleFederationPlugin(e,n,a),...createHtmlPlugins(e,n,a)],{analyzer:l,loaderOptions:o}=a,c=n[1].entry||[],u=c.find((e=>/.vue$/.test(e)));if(o.runTsChecker&&!u){const n=c.reduce(((e,n)=>{const a=/\.(?:ts|tsx|js|jsx)$/.test(n)?[n]:[".ts",".tsx","jsx",".js"].map((e=>n+e));return e.concat(a)}),[]);logger.debug(`ForkTsCheckerWebpackPlugin: include: ${JSON.stringify(n)}`,moduleName),i.push(new ForkTsCheckerWebpackPlugin({async:e,typescript:{context:a.projectCwd,memoryLimit:8192,configOverwrite:{include:[...n,"./*.d.ts"]}}}))}l&&i.push(new BundleAnalyzerPlugin({analyzerPort:"auto",analyzerMode:"server",...l}));const m=shouldEnableReactFastRefresh(e,n,a);m&&i.push(new ReactRefreshWebpackPlugin({overlay:!1})),!m&&e&&logger.warn(`The HMR has disabled cause of ("${r}":"moduleFederation")`);const p=a.webpack?.plugins||[];return i.concat(p)};
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{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{createBuiltinDefineVariables}from"../plugins/define-variable/index.js";import{createModuleFederationPlugin}from"../plugins/module-federation/index.js";import{createHtmlPlugins}from"../plugins/multi-html/index.js";export const createPlugins=async(e,n,a)=>{const[r,i]=n,t=enableBundleHashNameForModule(a,i?.options),l=[new webpack.WatchIgnorePlugin({paths:[/\.d\.[cm]ts$/]}),new CaseSensitivePathsPlugin,new MiniCssExtractPlugin({filename:`[name]/${getBundleFileName("css",e,t)}`,chunkFilename:"[id].[contenthash].css"}),...await createBuiltinDefineVariables(e,a),...createCleanWebpackPlugin(e,n,a),...createModuleFederationPlugin(e,n,a),...createHtmlPlugins(e,n,a)],{analyzer:s,loaderOptions:o}=a,c=(n[1].entry||[]).find((e=>/.vue$/.test(e)));o.runTsChecker&&!c&&l.push(new ForkTsCheckerWebpackPlugin({async:e,typescript:{context:a.projectCwd,memoryLimit:8192}})),s&&l.push(new BundleAnalyzerPlugin({analyzerPort:"auto",analyzerMode:"server",...s}));const u=shouldEnableReactFastRefresh(e,n,a);u&&l.push(new ReactRefreshWebpackPlugin({overlay:!1})),!u&&e&&logger.warn(`The HMR has disabled cause of ("${r}":"moduleFederation")`);const m=a.webpack?.plugins||[];return l.concat(m)};
@@ -1 +1 @@
1
- import{forgePostcssPluginPixel}from"@flatjs/forge-postcss-plugin-pixel";import cssnano from"cssnano";import MiniCssExtractPlugin from"mini-css-extract-plugin";import{allowPx2remForModule}from"../../helpers/allow-px2rem-for-module.js";const getPostcssOptions=(s,o={},e={})=>{const r=[cssnano({preset:["default",{discardComments:{removeAll:!s},reduceInitial:!1,normalizeWhitespace:!s,...e}]})];return!1!==o&&r.push(forgePostcssPluginPixel(o)),{plugins:r}};export const ruleCss=(s,o,e)=>{const r={test:/\.css$/i,use:[{loader:MiniCssExtractPlugin.loader,options:{esModule:!0}},{loader:"css-loader",options:{sourceMap:s}}]},{pixelOptions:t,cssnanoOptions:i}=e.loaderOptions,l=allowPx2remForModule(o,e);return Array.isArray(r.use)&&r.use.push({loader:"postcss-loader",options:{postcssOptions:getPostcssOptions(s,!!l&&t,i),sourceMap:s}}),r};
1
+ import{forgePostcssPluginPixel}from"@flatjs/forge-postcss-plugin-pixel";import cssnano from"cssnano";import MiniCssExtractPlugin from"mini-css-extract-plugin";import{allowPx2remForModule}from"../../helpers/allow-px2rem-for-module.js";const getPostcssOptions=(s,o={},e={})=>{const r=[...e.plugins||[],cssnano({preset:["default",{discardComments:{removeAll:!s},reduceInitial:!1,normalizeWhitespace:!s,...e.cssnanoOptions}]})];return!1!==o&&r.push(forgePostcssPluginPixel(o)),{plugins:r}};export const ruleCss=(s,o,e)=>{const r={test:/\.css$/i,use:[{loader:MiniCssExtractPlugin.loader,options:{esModule:!0}},{loader:"css-loader",options:{sourceMap:s}}]},{pixelOptions:t,postcssOptions:i}=e.loaderOptions,n=allowPx2remForModule(o,e);return Array.isArray(r.use)&&r.use.push({loader:"postcss-loader",options:{postcssOptions:getPostcssOptions(s,!!n&&t,i),sourceMap:s}}),r};
@@ -1 +1 @@
1
- export const defaultEvolveOptions={projectCwd:process.cwd(),projectVirtualPath:"flatjs/evolve",rejectWarnings:!1,devServer:{autoOpen:!0,mockOptions:{mockBaseDir:"mocks"},clientOverlay:{errors:!0,warnings:!1},middlewares:[],watchOptions:{poll:1e3,ignored:/node_modules/,aggregateTimeout:500},defaultServeGlobalData:()=>Promise.resolve({})},webpack:{target:["web","es5"],plugins:[],ruleSets:[],publicPath:"auto",externals:{vue:"Vue",react:"React","react-dom":"ReactDOM"},outputDir:"public",enableBundleHashName:!0},pluginOptions:{},loaderOptions:{assetDataUrlMaxSize:4096,babelOptions:{usePreset:"react",plugins:[],presets:[]},runTsChecker:!0,lessOptions:{},cssnanoOptions:{},pixelOptions:{rootValue:{px:100,rpx:1},outputUnit:"rem"},modularImports:[]},entryMap:{},multiHtmlCdn:{},multiHtmlCdnEnvResolver:function cdnResolver(){},needVerifyPackages:{},packageInstallChecker:{enabled:!1,detectModules:["@dimjs/*"],throwError:!1,showAllInstalledGraph:!0},maxProcesses:"50%",ci:{basedBranch:"master"}};
1
+ export const defaultEvolveOptions={projectCwd:process.cwd(),projectVirtualPath:"flatjs/evolve",rejectWarnings:!1,devServer:{autoOpen:!0,mockOptions:{mockBaseDir:"mocks"},clientOverlay:{errors:!0,warnings:!1},middlewares:[],watchOptions:{poll:1e3,ignored:/node_modules/,aggregateTimeout:500},defaultServeGlobalData:()=>Promise.resolve({})},webpack:{target:["web","es5"],plugins:[],ruleSets:[],publicPath:"auto",externals:{vue:"Vue",react:"React","react-dom":"ReactDOM"},outputDir:"public",enableBundleHashName:!0},pluginOptions:{},loaderOptions:{assetDataUrlMaxSize:4096,babelOptions:{usePreset:"react",plugins:[],presets:[]},runTsChecker:!0,lessOptions:{},postcssOptions:{cssnanoOptions:{}},pixelOptions:{rootValue:{px:100,rpx:1},outputUnit:"rem"},modularImports:[]},entryMap:{},multiHtmlCdn:{},multiHtmlCdnEnvResolver:function cdnResolver(){},needVerifyPackages:{},packageInstallChecker:{enabled:!1,detectModules:["@dimjs/*"],throwError:!1,showAllInstalledGraph:!0},maxProcesses:"50%",ci:{basedBranch:"master"}};
@@ -1,6 +1,7 @@
1
1
  import { type TransformOptions } from '@babel/core';
2
2
  import { type PostcssPluginPixelOptions } from '@flatjs/forge-postcss-plugin-pixel';
3
3
  import { type Options } from 'cssnano';
4
+ import { type AcceptedPlugin } from 'postcss';
4
5
  import { type ModularImportOption } from './types-modular-import.js';
5
6
  export type BabelInputOptions = Pick<TransformOptions, 'presets' | 'plugins'>;
6
7
  /**
@@ -40,15 +41,25 @@ export interface RuleSetLoaderOptions {
40
41
  */
41
42
  runTsChecker?: boolean;
42
43
  /**
43
- * The overrided configurations of `cssnano-preset-default`
44
- * sometimes we need to disabled some rules for `default cssnano preset`
45
- * @example
46
- * disable `postcss-minify-font-values` rule to avoid transitions from `font-weight:bold` to `font-weight:700`
47
- * ```json
48
- * cssnanoOptions: { minifyFontValues: false }
49
- * ```
44
+ * The configration options of `postcss-loader`
50
45
  */
51
- cssnanoOptions?: Options;
46
+ postcssOptions?: {
47
+ /**
48
+ * The overrided configurations of `cssnano-preset-default`
49
+ * sometimes we need to disabled some rules for `default cssnano preset`
50
+ * @example
51
+ * disable `postcss-minify-font-values` rule to avoid transitions from `font-weight:bold` to `font-weight:700`
52
+ * ```json
53
+ * cssnanoOptions: { minifyFontValues: false }
54
+ * ```
55
+ */
56
+ cssnanoOptions?: Options;
57
+ /**
58
+ * Allow to extends extra plugins of `postcss-loader`
59
+ * @example `['tailwindcss', {}]`
60
+ */
61
+ plugins?: Array<AcceptedPlugin | string | [string, Record<string, unknown>]>;
62
+ };
52
63
  /**
53
64
  * The babel options for `babel-loader`
54
65
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flatjs/evolve",
3
- "version": "1.8.1-next.54",
3
+ "version": "1.8.1-next.56",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -37,15 +37,15 @@
37
37
  "typecheck": "tsc --project ./tsconfig.json --noEmit"
38
38
  },
39
39
  "dependencies": {
40
- "@armit/file-utility": "^0.0.23",
41
- "@armit/git": "^0.0.28",
42
- "@armit/package": "^0.0.38",
40
+ "@armit/file-utility": "^0.0.25",
41
+ "@armit/git": "^0.0.29",
42
+ "@armit/package": "^0.0.40",
43
43
  "@babel/core": "7.22.1",
44
- "@flatjs/common": "1.8.1-next.25",
45
- "@flatjs/evolve-preset-babel": "1.8.1-next.11",
46
- "@flatjs/forge-postcss-plugin-pixel": "1.8.1-next.25",
47
- "@flatjs/graph": "1.8.1-next.29",
48
- "@flatjs/mock": "1.8.1-next.47",
44
+ "@flatjs/common": "1.8.1-next.26",
45
+ "@flatjs/evolve-preset-babel": "1.8.1-next.12",
46
+ "@flatjs/forge-postcss-plugin-pixel": "1.8.1-next.26",
47
+ "@flatjs/graph": "1.8.1-next.30",
48
+ "@flatjs/mock": "1.8.1-next.48",
49
49
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.10",
50
50
  "@types/babel__core": "7.20.1",
51
51
  "babel-loader": "9.1.2",
@@ -72,20 +72,20 @@
72
72
  "terser-webpack-plugin": "5.3.9",
73
73
  "tsconfig-paths-webpack-plugin": "4.0.1",
74
74
  "type-fest": "^3.11.1",
75
- "webpack": "5.85.0",
75
+ "webpack": "5.86.0",
76
76
  "webpack-bundle-analyzer": "4.9.0",
77
77
  "webpack-dev-server": "4.15.0",
78
78
  "webpack-sources": "3.2.3"
79
79
  },
80
80
  "devDependencies": {
81
- "@armit/eslint-config-bases": "^0.0.19",
82
- "@flatjs/testing": "1.8.1-next.26",
83
- "@swc/core": "1.3.61",
81
+ "@armit/eslint-config-bases": "^0.0.20",
82
+ "@flatjs/testing": "1.8.1-next.27",
83
+ "@swc/core": "1.3.62",
84
84
  "@types/express": "4.17.17",
85
85
  "@types/node": "20.2.5",
86
- "@vitest/coverage-istanbul": "0.31.4",
87
- "@vitest/ui": "0.31.4",
88
- "eslint": "8.41.0",
86
+ "@vitest/coverage-istanbul": "0.32.0",
87
+ "@vitest/ui": "0.32.0",
88
+ "eslint": "8.42.0",
89
89
  "imagemin-gifsicle": "7.0.0",
90
90
  "imagemin-jpegtran": "7.0.0",
91
91
  "imagemin-pngquant": "9.0.2",
@@ -97,7 +97,7 @@
97
97
  "swc-unplugin-ts": "1.0.2",
98
98
  "ts-node": "10.9.1",
99
99
  "vite-tsconfig-paths": "4.2.0",
100
- "vitest": "0.31.4",
100
+ "vitest": "0.32.0",
101
101
  "vue-loader": "17.2.2"
102
102
  },
103
103
  "peerDependencies": {