@flatjs/evolve 2.0.4 → 2.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- import{ruleAssets}from"./rule-sets/rule-assets.js";import{ruleCss}from"./rule-sets/rule-css.js";import{ruleLess}from"./rule-sets/rule-less.js";import{ruleScripts}from"./rule-sets/rule-scripts.js";import{ruleSvgIcon}from"./rule-sets/rule-svg-icon.js";export const createRuleSets=(s,e,r)=>{const t=[ruleSvgIcon(),ruleAssets(e,r),ruleCss(s,e,r),ruleLess(s,e,r),ruleScripts(s,e,r)],l=r.webpack?.ruleSets||[];return t.concat(l)};
1
+ import{ruleAssets}from"./rule-sets/rule-assets.js";import{ruleCss}from"./rule-sets/rule-css.js";import{ruleLess}from"./rule-sets/rule-less.js";import{ruleScripts}from"./rule-sets/rule-scripts.js";import{ruleSvgIcon}from"./rule-sets/rule-svg-icon.js";export const createRuleSets=(s,e,r)=>{const l=[ruleSvgIcon(),ruleAssets(e,r),ruleCss(s,e,r,!1),ruleCss(s,e,r,!0),ruleLess(s,e,r),ruleScripts(s,e,r)],t=r.webpack?.ruleSets||[];return l.concat(t)};
@@ -8,4 +8,4 @@ import { type FlatEvolveOptions } from '../../types/types-options.js';
8
8
  * @param entryMapItem
9
9
  * @param evolveOptions `builtin` loaders
10
10
  */
11
- export declare const ruleCss: (serveMode: boolean, entryMapItem: EntryMapItem, evolveOptions: FlatEvolveOptions) => RuleSetRule;
11
+ export declare const ruleCss: (serveMode: boolean, entryMapItem: EntryMapItem, evolveOptions: FlatEvolveOptions, useCssModule?: boolean) => RuleSetRule;
@@ -1 +1 @@
1
- import{requireResolve}from"@flatjs/common";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{pixelOptions:r,cssLoaderOptions:t,postcssOptions:i}=e.loaderOptions,l={test:/\.css$/i,use:[{loader:MiniCssExtractPlugin.loader,options:{esModule:!0}},{loader:requireResolve(import.meta.url,"css-loader"),options:{sourceMap:s,...t}}]},n=allowPx2remForModule(o,e);if(Array.isArray(l.use)){const o=getPostcssOptions(s,!!n&&r,i);l.use.push({loader:requireResolve(import.meta.url,"postcss-loader"),options:{postcssOptions:{...o,config:!1},sourceMap:s}})}return l};
1
+ import{requireResolve}from"@flatjs/common";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,r=!1)=>{const{pixelOptions:t,cssLoaderOptions:i={},postcssOptions:l}=e.loaderOptions,n=r?{}:{modules:!1},p={test:/\.css$/i,use:[{loader:MiniCssExtractPlugin.loader,options:{esModule:!0}},{loader:requireResolve(import.meta.url,"css-loader"),options:{sourceMap:s,...i,...n}}]};r?p.include=/\.module\.css$/i:p.exclude=/\.module\.css$/i;const c=allowPx2remForModule(o,e);if(Array.isArray(p.use)){const o=getPostcssOptions(s,!!c&&t,l);p.use.push({loader:requireResolve(import.meta.url,"postcss-loader"),options:{postcssOptions:{...o,config:!1},sourceMap:s}})}return p};
@@ -26,8 +26,11 @@ export interface RuleSetLoaderOptions {
26
26
  assetDataUrlMaxSize?: number;
27
27
  /**
28
28
  * The configurations of `css-loader`
29
+ * https://github.com/webpack-contrib/css-loader/blob/master/README.md#modules
29
30
  */
30
- cssLoaderOptions?: Record<string, unknown>;
31
+ cssLoaderOptions?: {
32
+ modules?: Record<string, unknown>;
33
+ } & Record<string, unknown>;
31
34
  /**
32
35
  * The config for `Less`
33
36
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flatjs/evolve",
3
- "version": "2.0.4",
3
+ "version": "2.0.6",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -43,8 +43,8 @@
43
43
  "@flatjs/common": "2.0.3",
44
44
  "@flatjs/evolve-preset-babel": "2.0.3",
45
45
  "@flatjs/forge-postcss-plugin-pixel": "2.0.3",
46
- "@flatjs/graph": "2.0.3",
47
- "@flatjs/mock": "2.0.3",
46
+ "@flatjs/graph": "2.0.4",
47
+ "@flatjs/mock": "2.0.4",
48
48
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.11",
49
49
  "@types/babel__core": "7.20.5",
50
50
  "babel-loader": "9.1.3",