customize-cra
Advanced tools
Comparing version 1.0.0-alpha.0 to 1.0.0
@@ -1,2 +0,2 @@ | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var flow=_interopDefault(require("lodash.flow"));function _defineProperty(e,s,t){return s in e?Object.defineProperty(e,s,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[s]=t,e}function _objectSpread2(e){for(var s=1;s<arguments.length;s++)if(s%2){var t=null!=arguments[s]?arguments[s]:{},r=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.forEach(function(s){_defineProperty(e,s,t[s])})}else Object.defineProperties(e,Object.getOwnPropertyDescriptors(arguments[s]));return e}const getBabelLoader=(e,s)=>{let t;t=s?e=>e.loader&&e.loader.includes("babel")&&e.exclude:e=>e.loader&&e.loader.includes("babel")&&e.include;let r=e.module.rules.find(e=>Array.isArray(e.oneOf)).oneOf,o=r.find(t);return o||(o=(r=r.reduce((e,s)=>e.concat(s.use||[]),[])).find(t)),o},tap=e=>s=>{const{message:t,dest:r}=e||{},o=[];if(t&&o.push(t),o.push(JSON.stringify(s,null,2)),r){require("fs").appendFile(r,`${o.join("\n")}\n`)}return o.forEach(e=>console.log(e)),s},addBundleVisualizer=(e={},s=!1)=>t=>{const r=require("webpack-bundle-analyzer").BundleAnalyzerPlugin;return s&&!process.argv.includes("--analyze")||t.plugins.push(new r(Object.assign({analyzerMode:"static",reportFilename:"report.html"},e))),t},disableEsLint=()=>e=>{return e.module.rules.filter(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc)).forEach(s=>{e.module.rules=e.module.rules.filter(e=>e!==s)}),e},addWebpackAlias=e=>s=>(s.resolve||(s.resolve={}),s.resolve.alias||(s.resolve.alias={}),Object.assign(s.resolve.alias,e),s),addWebpackResolve=e=>s=>(s.resolve||(s.resolve={}),Object.assign(s.resolve,e),s),addWebpackPlugin=e=>s=>(s.plugins.push(e),s),adjustWorkbox=e=>s=>(s.plugins.forEach(s=>{"GenerateSW"===s.constructor.name&&e(s.config)}),s),adjustStyleLoaders=e=>s=>{const t="prod"===("production"===process.env.NODE_ENV?"prod":"dev")?"css-extract-plugin":"style-loader";return s.module.rules.find(e=>Array.isArray(e.oneOf)).oneOf.filter(({use:e})=>e&&e[0]&&(e[0].loader||e[0]).includes(t)).forEach(s=>e(s)),s},useEslintRc=e=>s=>{const t=s.module.rules.filter(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc))[0];t.use[0].options.useEslintrc=!0,t.use[0].options.ignore=!0,t.use[0].options.configFile=e,delete t.use[0].options.baseConfig;const r=s.module.rules.map(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc)?t:e);return s.module.rules=r,s},enableEslintTypescript=()=>e=>{const s=e.module.rules.filter(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc))[0];s.test=/\.([j,t]sx?|mjs)$/;const t=e.module.rules.map(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc)?s:e);return e.module.rules=t,e},addLessLoader=(e={})=>s=>{const t=require("mini-css-extract-plugin"),r=require("postcss-normalize"),o=e.cssLoaderOptions||{},a=e.cssModules||{localIdentName:"[local]--[hash:base64:5]"},l=/\.module\.less$/,n=process.env.NODE_ENV,i="development"===n,u="production"===n,d="false"!==process.env.GENERATE_SOURCEMAP,p="./"===s.output.publicPath,c=(s,o)=>{const a=[i&&require.resolve("style-loader"),u&&{loader:t.loader,options:p?{publicPath:"../../"}:{}},{loader:require.resolve("css-loader"),options:s},{loader:require.resolve("postcss-loader"),options:{ident:"postcss",plugins:()=>[require("postcss-flexbugs-fixes"),require("postcss-preset-env")({autoprefixer:{flexbox:"no-2009"},stage:3}),r()],sourceMap:u&&d}}].filter(Boolean);return o&&a.push({loader:require.resolve("resolve-url-loader"),options:{sourceMap:u&&d}},{loader:require.resolve(o),options:Object.assign({sourceMap:!0},e)}),a},b=s.module.rules.find(e=>Array.isArray(e.oneOf)).oneOf;return b.splice(b.length-1,0,{test:/\.less$/,exclude:l,use:c(Object.assign({importLoaders:2,sourceMap:u&&d},o),"less-loader")},{test:l,use:c(Object.assign({importLoaders:2,sourceMap:u&&d},o,{modules:a}),"less-loader")}),s},watchAll=()=>e=>(process.argv.includes("--watch-all")&&delete e.watchOptions,e),disableChunk=()=>e=>(e.optimization.splitChunks={cacheGroups:{default:!1}},e.optimization.runtimeChunk=!1,e),addWebpackExternals=e=>s=>{let t=s.externals;return t?Array.isArray(e)?t=e.concat(t):Array.isArray(t)||e.constructor===Function||e.constructor===RegExp?t=[e].concat(t):e instanceof Object&&t instanceof Object&&(t=_objectSpread2({},t,{},e)):t=e,s.externals=t,s},addPostcssPlugins=e=>s=>{return s.module.rules.find(e=>Array.isArray(e.oneOf)).oneOf.forEach(s=>s.use&&s.use.forEach(s=>{if(s.options&&"postcss"===s.options.ident&&(s.options.plugins||(s.options.plugins=()=>[...e]),s.options.plugins)){const t=s.options.plugins;s.options.plugins=()=>[...t(),...e]}})),s},removeModuleScopePlugin=()=>e=>(e.resolve.plugins=e.resolve.plugins.filter(e=>"ModuleScopePlugin"!==e.constructor.name),e),addWebpackModuleRule=e=>s=>{for(let t of s.module.rules)if(t.oneOf){t.oneOf.unshift(e);break}return s},addTslintLoader=e=>s=>(s.module.rules.unshift({test:/\.(ts|tsx)$/,loader:"tslint-loader",options:e,enforce:"pre"}),s),setWebpackTarget=e=>s=>(s.target=e,s),setWebpackPublicPath=e=>s=>(e&&(e.startsWith("http")||e.startsWith("https")||e.startsWith("/")||(e="/"+e),e.endsWith("/")||(e+="/"),s.output.publicPath=e),s),setWebpackOptimizationSplitChunks=e=>s=>(e&&"object"==typeof e&&(s.optimization.splitChunks=e),s),setWebpackStats=e=>s=>(s.stats=e,s),addBabelPlugin=e=>s=>(getBabelLoader(s).options.plugins.push(e),s),addExternalBabelPlugin=e=>s=>{const t=getBabelLoader(s,!0).options;return t.plugins||(t.plugins=[]),t.plugins.push(e),s},addBabelPreset=e=>s=>(getBabelLoader(s).options.presets.push(e),s),addDecoratorsLegacy=()=>e=>addBabelPlugin(["@babel/plugin-proposal-decorators",{legacy:!0}])(e),useBabelRc=()=>e=>(getBabelLoader(e).options.babelrc=!0,e),babelInclude=e=>s=>(getBabelLoader(s).include=e,s),babelExclude=e=>s=>(getBabelLoader(s).exclude=e,s),addBabelPlugins=(...e)=>e.map(e=>addBabelPlugin(e)),addExternalBabelPlugins=(...e)=>e.map(e=>addExternalBabelPlugin(e)),addBabelPresets=(...e)=>e.map(e=>addBabelPreset(e)),fixBabelImports=(e,s)=>addBabelPlugin(["import",Object.assign({},{libraryName:e},s),`fix-${e}-imports`]),removeInternalBabelPlugin=e=>s=>(s.plugins=s.plugins.filter(s=>s.constructor.name!==e),s),override=(...e)=>flow(...e.filter(e=>e)),overrideDevServer=(...e)=>s=>(t,r)=>{const o=s(t,r);return override(...e)(o)};exports.addBabelPlugin=addBabelPlugin,exports.addBabelPlugins=addBabelPlugins,exports.addBabelPreset=addBabelPreset,exports.addBabelPresets=addBabelPresets,exports.addBundleVisualizer=addBundleVisualizer,exports.addDecoratorsLegacy=addDecoratorsLegacy,exports.addExternalBabelPlugin=addExternalBabelPlugin,exports.addExternalBabelPlugins=addExternalBabelPlugins,exports.addLessLoader=addLessLoader,exports.addPostcssPlugins=addPostcssPlugins,exports.addTslintLoader=addTslintLoader,exports.addWebpackAlias=addWebpackAlias,exports.addWebpackExternals=addWebpackExternals,exports.addWebpackModuleRule=addWebpackModuleRule,exports.addWebpackPlugin=addWebpackPlugin,exports.addWebpackResolve=addWebpackResolve,exports.adjustStyleLoaders=adjustStyleLoaders,exports.adjustWorkbox=adjustWorkbox,exports.babelExclude=babelExclude,exports.babelInclude=babelInclude,exports.disableChunk=disableChunk,exports.disableEsLint=disableEsLint,exports.enableEslintTypescript=enableEslintTypescript,exports.fixBabelImports=fixBabelImports,exports.getBabelLoader=getBabelLoader,exports.override=override,exports.overrideDevServer=overrideDevServer,exports.removeInternalBabelPlugin=removeInternalBabelPlugin,exports.removeModuleScopePlugin=removeModuleScopePlugin,exports.setWebpackOptimizationSplitChunks=setWebpackOptimizationSplitChunks,exports.setWebpackPublicPath=setWebpackPublicPath,exports.setWebpackStats=setWebpackStats,exports.setWebpackTarget=setWebpackTarget,exports.tap=tap,exports.useBabelRc=useBabelRc,exports.useEslintRc=useEslintRc,exports.watchAll=watchAll; | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var flow=_interopDefault(require("lodash.flow"));function _defineProperty(e,s,t){return s in e?Object.defineProperty(e,s,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[s]=t,e}function _objectSpread2(e){for(var s=1;s<arguments.length;s++)if(s%2){var t=null!=arguments[s]?arguments[s]:{},r=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.forEach(function(s){_defineProperty(e,s,t[s])})}else Object.defineProperties(e,Object.getOwnPropertyDescriptors(arguments[s]));return e}const getBabelLoader=(e,s)=>{let t;t=s?e=>e.loader&&e.loader.includes("babel")&&e.exclude:e=>e.loader&&e.loader.includes("babel")&&e.include;let r=e.module.rules.find(e=>Array.isArray(e.oneOf)).oneOf,o=r.find(t);return o||(o=(r=r.reduce((e,s)=>e.concat(s.use||[]),[])).find(t)),o},tap=e=>s=>{const{message:t,dest:r}=e||{},o=[];if(t&&o.push(t),o.push(JSON.stringify(s,null,2)),r){require("fs").appendFile(r,`${o.join("\n")}\n`)}return o.forEach(e=>console.log(e)),s},addBundleVisualizer=(e={},s=!1)=>t=>{const r=require("webpack-bundle-analyzer").BundleAnalyzerPlugin;return s&&!process.argv.includes("--analyze")||t.plugins.push(new r(Object.assign({analyzerMode:"static",reportFilename:"report.html"},e))),t},disableEsLint=()=>e=>{return e.module.rules.filter(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc)).forEach(s=>{e.module.rules=e.module.rules.filter(e=>e!==s)}),e},addWebpackAlias=e=>s=>(s.resolve||(s.resolve={}),s.resolve.alias||(s.resolve.alias={}),Object.assign(s.resolve.alias,e),s),addWebpackResolve=e=>s=>(s.resolve||(s.resolve={}),Object.assign(s.resolve,e),s),addWebpackPlugin=e=>s=>(s.plugins.push(e),s),adjustWorkbox=e=>s=>(s.plugins.forEach(s=>{"GenerateSW"===s.constructor.name&&e(s.config)}),s),adjustStyleLoaders=e=>s=>{const t="prod"===("production"===process.env.NODE_ENV?"prod":"dev")?"css-extract-plugin":"style-loader";return s.module.rules.find(e=>Array.isArray(e.oneOf)).oneOf.filter(({use:e})=>e&&e[0]&&(e[0].loader||e[0]).includes(t)).forEach(s=>e(s)),s},useEslintRc=e=>s=>{const t=s.module.rules.filter(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc))[0];t.use[0].options.useEslintrc=!0,t.use[0].options.ignore=!0,t.use[0].options.configFile=e,delete t.use[0].options.baseConfig;const r=s.module.rules.map(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc)?t:e);return s.module.rules=r,s},enableEslintTypescript=()=>e=>{const s=e.module.rules.filter(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc))[0];s.test=/\.([j,t]sx?|mjs)$/;const t=e.module.rules.map(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc)?s:e);return e.module.rules=t,e},addLessLoader=(e={},s={})=>t=>{const r=require("mini-css-extract-plugin"),o=require("postcss-normalize"),a=e.cssLoaderOptions||{},{localIdentName:l}=e;let n=e.cssModules||{localIdentName:l};n.localIdentName||(n=s),n.localIdentName=n.localIdentName||"[local]--[hash:base64:5]";const i=/\.module\.less$/,d=process.env.NODE_ENV,u="development"===d,p="production"===d,c="false"!==process.env.GENERATE_SOURCEMAP,b="./"===t.output.publicPath,g=(s,t)=>{const a=[u&&require.resolve("style-loader"),p&&{loader:r.loader,options:b?{publicPath:"../../"}:{}},{loader:require.resolve("css-loader"),options:s},{loader:require.resolve("postcss-loader"),options:{ident:"postcss",plugins:()=>[require("postcss-flexbugs-fixes"),require("postcss-preset-env")({autoprefixer:{flexbox:"no-2009"},stage:3}),o()],sourceMap:p&&c}}].filter(Boolean);return t&&a.push({loader:require.resolve("resolve-url-loader"),options:{sourceMap:p&&c}},{loader:require.resolve(t),options:Object.assign({sourceMap:!0},e)}),a},f=t.module.rules.find(e=>Array.isArray(e.oneOf)).oneOf;return f.splice(f.length-1,0,{test:/\.less$/,exclude:i,use:g(Object.assign({importLoaders:2,sourceMap:p&&c},a),"less-loader")},{test:i,use:g(Object.assign({importLoaders:2,sourceMap:p&&c},a,{modules:n}),"less-loader")}),t},watchAll=()=>e=>(process.argv.includes("--watch-all")&&delete e.watchOptions,e),disableChunk=()=>e=>(e.optimization.splitChunks={cacheGroups:{default:!1}},e.optimization.runtimeChunk=!1,e),addWebpackExternals=e=>s=>{let t=s.externals;return t?Array.isArray(e)?t=e.concat(t):Array.isArray(t)||e.constructor===Function||e.constructor===RegExp?t=[e].concat(t):e instanceof Object&&t instanceof Object&&(t=_objectSpread2({},t,{},e)):t=e,s.externals=t,s},addPostcssPlugins=e=>s=>{return s.module.rules.find(e=>Array.isArray(e.oneOf)).oneOf.forEach(s=>s.use&&s.use.forEach(s=>{if(s.options&&"postcss"===s.options.ident&&(s.options.plugins||(s.options.plugins=()=>[...e]),s.options.plugins)){const t=s.options.plugins;s.options.plugins=()=>[...t(),...e]}})),s},removeModuleScopePlugin=()=>e=>(e.resolve.plugins=e.resolve.plugins.filter(e=>"ModuleScopePlugin"!==e.constructor.name),e),addWebpackModuleRule=e=>s=>{for(let t of s.module.rules)if(t.oneOf){t.oneOf.unshift(e);break}return s},addTslintLoader=e=>s=>(s.module.rules.unshift({test:/\.(ts|tsx)$/,loader:"tslint-loader",options:e,enforce:"pre"}),s),setWebpackTarget=e=>s=>(s.target=e,s),setWebpackPublicPath=e=>s=>(e&&(e.startsWith("http")||e.startsWith("https")||e.startsWith("/")||(e="/"+e),e.endsWith("/")||(e+="/"),s.output.publicPath=e),s),setWebpackOptimizationSplitChunks=e=>s=>(e&&"object"==typeof e&&(s.optimization.splitChunks=e),s),setWebpackStats=e=>s=>(s.stats=e,s),addBabelPlugin=e=>s=>(getBabelLoader(s).options.plugins.push(e),s),addExternalBabelPlugin=e=>s=>{const t=getBabelLoader(s,!0).options;return t.plugins||(t.plugins=[]),t.plugins.push(e),s},addBabelPreset=e=>s=>(getBabelLoader(s).options.presets.push(e),s),addDecoratorsLegacy=()=>e=>addBabelPlugin(["@babel/plugin-proposal-decorators",{legacy:!0}])(e),useBabelRc=()=>e=>(getBabelLoader(e).options.babelrc=!0,e),babelInclude=e=>s=>(getBabelLoader(s).include=e,s),babelExclude=e=>s=>(getBabelLoader(s).exclude=e,s),addBabelPlugins=(...e)=>e.map(e=>addBabelPlugin(e)),addExternalBabelPlugins=(...e)=>e.map(e=>addExternalBabelPlugin(e)),addBabelPresets=(...e)=>e.map(e=>addBabelPreset(e)),fixBabelImports=(e,s)=>addBabelPlugin(["import",Object.assign({},{libraryName:e},s),`fix-${e}-imports`]),removeInternalBabelPlugin=e=>s=>(s.plugins=s.plugins.filter(s=>s.constructor.name!==e),s),override=(...e)=>flow(...e.filter(e=>e)),overrideDevServer=(...e)=>s=>(t,r)=>{const o=s(t,r);return override(...e)(o)};exports.addBabelPlugin=addBabelPlugin,exports.addBabelPlugins=addBabelPlugins,exports.addBabelPreset=addBabelPreset,exports.addBabelPresets=addBabelPresets,exports.addBundleVisualizer=addBundleVisualizer,exports.addDecoratorsLegacy=addDecoratorsLegacy,exports.addExternalBabelPlugin=addExternalBabelPlugin,exports.addExternalBabelPlugins=addExternalBabelPlugins,exports.addLessLoader=addLessLoader,exports.addPostcssPlugins=addPostcssPlugins,exports.addTslintLoader=addTslintLoader,exports.addWebpackAlias=addWebpackAlias,exports.addWebpackExternals=addWebpackExternals,exports.addWebpackModuleRule=addWebpackModuleRule,exports.addWebpackPlugin=addWebpackPlugin,exports.addWebpackResolve=addWebpackResolve,exports.adjustStyleLoaders=adjustStyleLoaders,exports.adjustWorkbox=adjustWorkbox,exports.babelExclude=babelExclude,exports.babelInclude=babelInclude,exports.disableChunk=disableChunk,exports.disableEsLint=disableEsLint,exports.enableEslintTypescript=enableEslintTypescript,exports.fixBabelImports=fixBabelImports,exports.getBabelLoader=getBabelLoader,exports.override=override,exports.overrideDevServer=overrideDevServer,exports.removeInternalBabelPlugin=removeInternalBabelPlugin,exports.removeModuleScopePlugin=removeModuleScopePlugin,exports.setWebpackOptimizationSplitChunks=setWebpackOptimizationSplitChunks,exports.setWebpackPublicPath=setWebpackPublicPath,exports.setWebpackStats=setWebpackStats,exports.setWebpackTarget=setWebpackTarget,exports.tap=tap,exports.useBabelRc=useBabelRc,exports.useEslintRc=useEslintRc,exports.watchAll=watchAll; | ||
//# sourceMappingURL=index.cjs.js.map |
@@ -1,2 +0,2 @@ | ||
import e from"lodash.flow";function s(e,s,o){return s in e?Object.defineProperty(e,s,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[s]=o,e}const o=(e,s)=>{let o;o=s?e=>e.loader&&e.loader.includes("babel")&&e.exclude:e=>e.loader&&e.loader.includes("babel")&&e.include;let r=e.module.rules.find(e=>Array.isArray(e.oneOf)).oneOf,t=r.find(o);return t||(t=(r=r.reduce((e,s)=>e.concat(s.use||[]),[])).find(o)),t},r=e=>s=>{const{message:o,dest:r}=e||{},t=[];if(o&&t.push(o),t.push(JSON.stringify(s,null,2)),r){require("fs").appendFile(r,`${t.join("\n")}\n`)}return t.forEach(e=>console.log(e)),s},t=(e={},s=!1)=>o=>{const r=require("webpack-bundle-analyzer").BundleAnalyzerPlugin;return s&&!process.argv.includes("--analyze")||o.plugins.push(new r(Object.assign({analyzerMode:"static",reportFilename:"report.html"},e))),o},n=()=>e=>{return e.module.rules.filter(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc)).forEach(s=>{e.module.rules=e.module.rules.filter(e=>e!==s)}),e},l=e=>s=>(s.resolve||(s.resolve={}),s.resolve.alias||(s.resolve.alias={}),Object.assign(s.resolve.alias,e),s),i=e=>s=>(s.resolve||(s.resolve={}),Object.assign(s.resolve,e),s),u=e=>s=>(s.plugins.push(e),s),a=e=>s=>(s.plugins.forEach(s=>{"GenerateSW"===s.constructor.name&&e(s.config)}),s),p=e=>s=>{const o="prod"===("production"===process.env.NODE_ENV?"prod":"dev")?"css-extract-plugin":"style-loader";return s.module.rules.find(e=>Array.isArray(e.oneOf)).oneOf.filter(({use:e})=>e&&e[0]&&(e[0].loader||e[0]).includes(o)).forEach(s=>e(s)),s},c=e=>s=>{const o=s.module.rules.filter(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc))[0];o.use[0].options.useEslintrc=!0,o.use[0].options.ignore=!0,o.use[0].options.configFile=e,delete o.use[0].options.baseConfig;const r=s.module.rules.map(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc)?o:e);return s.module.rules=r,s},d=()=>e=>{const s=e.module.rules.filter(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc))[0];s.test=/\.([j,t]sx?|mjs)$/;const o=e.module.rules.map(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc)?s:e);return e.module.rules=o,e},f=(e={})=>s=>{const o=require("mini-css-extract-plugin"),r=require("postcss-normalize"),t=e.cssLoaderOptions||{},n=e.cssModules||{localIdentName:"[local]--[hash:base64:5]"},l=/\.module\.less$/,i=process.env.NODE_ENV,u="development"===i,a="production"===i,p="false"!==process.env.GENERATE_SOURCEMAP,c="./"===s.output.publicPath,d=(s,t)=>{const n=[u&&require.resolve("style-loader"),a&&{loader:o.loader,options:c?{publicPath:"../../"}:{}},{loader:require.resolve("css-loader"),options:s},{loader:require.resolve("postcss-loader"),options:{ident:"postcss",plugins:()=>[require("postcss-flexbugs-fixes"),require("postcss-preset-env")({autoprefixer:{flexbox:"no-2009"},stage:3}),r()],sourceMap:a&&p}}].filter(Boolean);return t&&n.push({loader:require.resolve("resolve-url-loader"),options:{sourceMap:a&&p}},{loader:require.resolve(t),options:Object.assign({sourceMap:!0},e)}),n},f=s.module.rules.find(e=>Array.isArray(e.oneOf)).oneOf;return f.splice(f.length-1,0,{test:/\.less$/,exclude:l,use:d(Object.assign({importLoaders:2,sourceMap:a&&p},t),"less-loader")},{test:l,use:d(Object.assign({importLoaders:2,sourceMap:a&&p},t,{modules:n}),"less-loader")}),s},m=()=>e=>(process.argv.includes("--watch-all")&&delete e.watchOptions,e),g=()=>e=>(e.optimization.splitChunks={cacheGroups:{default:!1}},e.optimization.runtimeChunk=!1,e),b=e=>o=>{let r=o.externals;return r?Array.isArray(e)?r=e.concat(r):Array.isArray(r)||e.constructor===Function||e.constructor===RegExp?r=[e].concat(r):e instanceof Object&&r instanceof Object&&(r=function(e){for(var o=1;o<arguments.length;o++)if(o%2){var r=null!=arguments[o]?arguments[o]:{},t=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),t.forEach(function(o){s(e,o,r[o])})}else Object.defineProperties(e,Object.getOwnPropertyDescriptors(arguments[o]));return e}({},r,{},e)):r=e,o.externals=r,o},h=e=>s=>{return s.module.rules.find(e=>Array.isArray(e.oneOf)).oneOf.forEach(s=>s.use&&s.use.forEach(s=>{if(s.options&&"postcss"===s.options.ident&&(s.options.plugins||(s.options.plugins=()=>[...e]),s.options.plugins)){const o=s.options.plugins;s.options.plugins=()=>[...o(),...e]}})),s},O=()=>e=>(e.resolve.plugins=e.resolve.plugins.filter(e=>"ModuleScopePlugin"!==e.constructor.name),e),v=e=>s=>{for(let o of s.module.rules)if(o.oneOf){o.oneOf.unshift(e);break}return s},y=e=>s=>(s.module.rules.unshift({test:/\.(ts|tsx)$/,loader:"tslint-loader",options:e,enforce:"pre"}),s),E=e=>s=>(s.target=e,s),j=e=>s=>(e&&(e.startsWith("http")||e.startsWith("https")||e.startsWith("/")||(e="/"+e),e.endsWith("/")||(e+="/"),s.output.publicPath=e),s),x=e=>s=>(e&&"object"==typeof e&&(s.optimization.splitChunks=e),s),A=e=>s=>(s.stats=e,s),P=e=>s=>(o(s).options.plugins.push(e),s),q=e=>s=>{const r=o(s,!0).options;return r.plugins||(r.plugins=[]),r.plugins.push(e),s},w=e=>s=>(o(s).options.presets.push(e),s),M=()=>e=>P(["@babel/plugin-proposal-decorators",{legacy:!0}])(e),z=()=>e=>(o(e).options.babelrc=!0,e),N=e=>s=>(o(s).include=e,s),k=e=>s=>(o(s).exclude=e,s),S=(...e)=>e.map(e=>P(e)),$=(...e)=>e.map(e=>q(e)),C=(...e)=>e.map(e=>w(e)),W=(e,s)=>P(["import",Object.assign({},{libraryName:e},s),`fix-${e}-imports`]),D=e=>s=>(s.plugins=s.plugins.filter(s=>s.constructor.name!==e),s),F=(...s)=>e(...s.filter(e=>e)),G=(...e)=>s=>(o,r)=>{const t=s(o,r);return F(...e)(t)};export{P as addBabelPlugin,S as addBabelPlugins,w as addBabelPreset,C as addBabelPresets,t as addBundleVisualizer,M as addDecoratorsLegacy,q as addExternalBabelPlugin,$ as addExternalBabelPlugins,f as addLessLoader,h as addPostcssPlugins,y as addTslintLoader,l as addWebpackAlias,b as addWebpackExternals,v as addWebpackModuleRule,u as addWebpackPlugin,i as addWebpackResolve,p as adjustStyleLoaders,a as adjustWorkbox,k as babelExclude,N as babelInclude,g as disableChunk,n as disableEsLint,d as enableEslintTypescript,W as fixBabelImports,o as getBabelLoader,F as override,G as overrideDevServer,D as removeInternalBabelPlugin,O as removeModuleScopePlugin,x as setWebpackOptimizationSplitChunks,j as setWebpackPublicPath,A as setWebpackStats,E as setWebpackTarget,r as tap,z as useBabelRc,c as useEslintRc,m as watchAll}; | ||
import e from"lodash.flow";function s(e,s,o){return s in e?Object.defineProperty(e,s,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[s]=o,e}const o=(e,s)=>{let o;o=s?e=>e.loader&&e.loader.includes("babel")&&e.exclude:e=>e.loader&&e.loader.includes("babel")&&e.include;let r=e.module.rules.find(e=>Array.isArray(e.oneOf)).oneOf,t=r.find(o);return t||(t=(r=r.reduce((e,s)=>e.concat(s.use||[]),[])).find(o)),t},r=e=>s=>{const{message:o,dest:r}=e||{},t=[];if(o&&t.push(o),t.push(JSON.stringify(s,null,2)),r){require("fs").appendFile(r,`${t.join("\n")}\n`)}return t.forEach(e=>console.log(e)),s},t=(e={},s=!1)=>o=>{const r=require("webpack-bundle-analyzer").BundleAnalyzerPlugin;return s&&!process.argv.includes("--analyze")||o.plugins.push(new r(Object.assign({analyzerMode:"static",reportFilename:"report.html"},e))),o},n=()=>e=>{return e.module.rules.filter(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc)).forEach(s=>{e.module.rules=e.module.rules.filter(e=>e!==s)}),e},l=e=>s=>(s.resolve||(s.resolve={}),s.resolve.alias||(s.resolve.alias={}),Object.assign(s.resolve.alias,e),s),i=e=>s=>(s.resolve||(s.resolve={}),Object.assign(s.resolve,e),s),u=e=>s=>(s.plugins.push(e),s),a=e=>s=>(s.plugins.forEach(s=>{"GenerateSW"===s.constructor.name&&e(s.config)}),s),c=e=>s=>{const o="prod"===("production"===process.env.NODE_ENV?"prod":"dev")?"css-extract-plugin":"style-loader";return s.module.rules.find(e=>Array.isArray(e.oneOf)).oneOf.filter(({use:e})=>e&&e[0]&&(e[0].loader||e[0]).includes(o)).forEach(s=>e(s)),s},p=e=>s=>{const o=s.module.rules.filter(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc))[0];o.use[0].options.useEslintrc=!0,o.use[0].options.ignore=!0,o.use[0].options.configFile=e,delete o.use[0].options.baseConfig;const r=s.module.rules.map(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc)?o:e);return s.module.rules=r,s},d=()=>e=>{const s=e.module.rules.filter(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc))[0];s.test=/\.([j,t]sx?|mjs)$/;const o=e.module.rules.map(e=>e.use&&e.use.some(e=>e.options&&void 0!==e.options.useEslintrc)?s:e);return e.module.rules=o,e},f=(e={},s={})=>o=>{const r=require("mini-css-extract-plugin"),t=require("postcss-normalize"),n=e.cssLoaderOptions||{},{localIdentName:l}=e;let i=e.cssModules||{localIdentName:l};i.localIdentName||(i=s),i.localIdentName=i.localIdentName||"[local]--[hash:base64:5]";const u=/\.module\.less$/,a=process.env.NODE_ENV,c="development"===a,p="production"===a,d="false"!==process.env.GENERATE_SOURCEMAP,f="./"===o.output.publicPath,m=(s,o)=>{const n=[c&&require.resolve("style-loader"),p&&{loader:r.loader,options:f?{publicPath:"../../"}:{}},{loader:require.resolve("css-loader"),options:s},{loader:require.resolve("postcss-loader"),options:{ident:"postcss",plugins:()=>[require("postcss-flexbugs-fixes"),require("postcss-preset-env")({autoprefixer:{flexbox:"no-2009"},stage:3}),t()],sourceMap:p&&d}}].filter(Boolean);return o&&n.push({loader:require.resolve("resolve-url-loader"),options:{sourceMap:p&&d}},{loader:require.resolve(o),options:Object.assign({sourceMap:!0},e)}),n},g=o.module.rules.find(e=>Array.isArray(e.oneOf)).oneOf;return g.splice(g.length-1,0,{test:/\.less$/,exclude:u,use:m(Object.assign({importLoaders:2,sourceMap:p&&d},n),"less-loader")},{test:u,use:m(Object.assign({importLoaders:2,sourceMap:p&&d},n,{modules:i}),"less-loader")}),o},m=()=>e=>(process.argv.includes("--watch-all")&&delete e.watchOptions,e),g=()=>e=>(e.optimization.splitChunks={cacheGroups:{default:!1}},e.optimization.runtimeChunk=!1,e),b=e=>o=>{let r=o.externals;return r?Array.isArray(e)?r=e.concat(r):Array.isArray(r)||e.constructor===Function||e.constructor===RegExp?r=[e].concat(r):e instanceof Object&&r instanceof Object&&(r=function(e){for(var o=1;o<arguments.length;o++)if(o%2){var r=null!=arguments[o]?arguments[o]:{},t=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),t.forEach(function(o){s(e,o,r[o])})}else Object.defineProperties(e,Object.getOwnPropertyDescriptors(arguments[o]));return e}({},r,{},e)):r=e,o.externals=r,o},h=e=>s=>{return s.module.rules.find(e=>Array.isArray(e.oneOf)).oneOf.forEach(s=>s.use&&s.use.forEach(s=>{if(s.options&&"postcss"===s.options.ident&&(s.options.plugins||(s.options.plugins=()=>[...e]),s.options.plugins)){const o=s.options.plugins;s.options.plugins=()=>[...o(),...e]}})),s},O=()=>e=>(e.resolve.plugins=e.resolve.plugins.filter(e=>"ModuleScopePlugin"!==e.constructor.name),e),v=e=>s=>{for(let o of s.module.rules)if(o.oneOf){o.oneOf.unshift(e);break}return s},y=e=>s=>(s.module.rules.unshift({test:/\.(ts|tsx)$/,loader:"tslint-loader",options:e,enforce:"pre"}),s),E=e=>s=>(s.target=e,s),j=e=>s=>(e&&(e.startsWith("http")||e.startsWith("https")||e.startsWith("/")||(e="/"+e),e.endsWith("/")||(e+="/"),s.output.publicPath=e),s),x=e=>s=>(e&&"object"==typeof e&&(s.optimization.splitChunks=e),s),A=e=>s=>(s.stats=e,s),N=e=>s=>(o(s).options.plugins.push(e),s),P=e=>s=>{const r=o(s,!0).options;return r.plugins||(r.plugins=[]),r.plugins.push(e),s},q=e=>s=>(o(s).options.presets.push(e),s),w=()=>e=>N(["@babel/plugin-proposal-decorators",{legacy:!0}])(e),M=()=>e=>(o(e).options.babelrc=!0,e),z=e=>s=>(o(s).include=e,s),k=e=>s=>(o(s).exclude=e,s),S=(...e)=>e.map(e=>N(e)),$=(...e)=>e.map(e=>P(e)),C=(...e)=>e.map(e=>q(e)),I=(e,s)=>N(["import",Object.assign({},{libraryName:e},s),`fix-${e}-imports`]),W=e=>s=>(s.plugins=s.plugins.filter(s=>s.constructor.name!==e),s),D=(...s)=>e(...s.filter(e=>e)),F=(...e)=>s=>(o,r)=>{const t=s(o,r);return D(...e)(t)};export{N as addBabelPlugin,S as addBabelPlugins,q as addBabelPreset,C as addBabelPresets,t as addBundleVisualizer,w as addDecoratorsLegacy,P as addExternalBabelPlugin,$ as addExternalBabelPlugins,f as addLessLoader,h as addPostcssPlugins,y as addTslintLoader,l as addWebpackAlias,b as addWebpackExternals,v as addWebpackModuleRule,u as addWebpackPlugin,i as addWebpackResolve,c as adjustStyleLoaders,a as adjustWorkbox,k as babelExclude,z as babelInclude,g as disableChunk,n as disableEsLint,d as enableEslintTypescript,I as fixBabelImports,o as getBabelLoader,D as override,F as overrideDevServer,W as removeInternalBabelPlugin,O as removeModuleScopePlugin,x as setWebpackOptimizationSplitChunks,j as setWebpackPublicPath,A as setWebpackStats,E as setWebpackTarget,r as tap,M as useBabelRc,p as useEslintRc,m as watchAll}; | ||
//# sourceMappingURL=index.esm.js.map |
{ | ||
"name": "customize-cra", | ||
"version": "1.0.0-alpha.0", | ||
"version": "1.0.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "repository": "arackaf/customize-cra", |
@@ -5,2 +5,4 @@ # `customize-cra` | ||
ππ **Breaking change:** With the `1.0` release of customize-cra breaking changes have been made to the `addLessLoader` customizer to support the changes to `create-react-app` in [#7876](https://github.com/facebook/create-react-app/pull/7876). Please follow the migration guide in [#253](https://github.com/arackaf/customize-cra/issues/253). | ||
This project provides a set of utilities to customize [`create-react-app`](https://github.com/facebook/create-react-app) versions 2 and 3 configurations leveraging [`react-app-rewired`](https://github.com/timarney/react-app-rewired/) core functionalities. | ||
@@ -7,0 +9,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
75163
2
161
1