@flatjs/evolve 2.3.2-next.1 → 2.3.2-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build-server/compiler-server-manager.d.ts +1 -1
- package/dist/compiler/create-build-server-compiler.js +1 -1
- package/dist/constants.d.ts +7 -0
- package/dist/constants.js +1 -1
- package/dist/core/rspack/create-externals.d.ts +4 -0
- package/dist/core/rspack/create-optimization.d.ts +4 -0
- package/dist/core/rspack/create-optimization.js +1 -0
- package/dist/core/rspack/create-performance.d.ts +2 -0
- package/dist/core/rspack/create-plugins.d.ts +5 -0
- package/dist/core/rspack/create-plugins.js +1 -0
- package/dist/core/rspack/create-resolve.d.ts +2 -0
- package/dist/core/rspack/create-resolve.js +1 -0
- package/dist/core/rspack/create-rspack-output.d.ts +4 -0
- package/dist/core/rspack/create-rspack-output.js +1 -0
- package/dist/core/rspack/create-rspack-rule-sets.d.ts +4 -0
- package/dist/core/rspack/create-rspack-rule-sets.js +1 -0
- package/dist/core/rspack/dev-serve/add-rspack-compiler-to-dev-server.d.ts +11 -0
- package/dist/core/rspack/dev-serve/add-rspack-compiler-to-dev-server.js +1 -0
- package/dist/core/rspack/dev-serve/create-rspack-compiler-task.d.ts +3 -0
- package/dist/core/rspack/dev-serve/create-rspack-compiler-task.js +1 -0
- package/dist/core/rspack/load-rspack-config.d.ts +11 -0
- package/dist/core/rspack/load-rspack-config.js +1 -0
- package/dist/core/rspack/load-rspack-watch-options.d.ts +12 -0
- package/dist/core/rspack/load-rspack-watch-options.js +1 -0
- package/dist/core/rspack/start-rspack-build.d.ts +12 -0
- package/dist/core/rspack/start-rspack-build.js +1 -0
- package/dist/{create-webpack → core/webpack}/create-externals.d.ts +2 -2
- package/dist/core/webpack/create-externals.js +1 -0
- package/dist/{create-webpack → core/webpack}/create-optimization.d.ts +2 -2
- package/dist/core/webpack/create-optimization.js +1 -0
- package/dist/{create-webpack → core/webpack}/create-output.d.ts +2 -2
- package/dist/core/webpack/create-output.js +1 -0
- package/dist/{create-webpack → core/webpack}/create-performance.d.ts +1 -1
- package/dist/core/webpack/create-performance.js +1 -0
- package/dist/core/webpack/create-plugins.d.ts +5 -0
- package/dist/core/webpack/create-plugins.js +1 -0
- package/dist/{create-webpack → core/webpack}/create-resolve.d.ts +1 -1
- package/dist/{create-webpack → core/webpack}/create-rule-sets.d.ts +2 -2
- package/dist/core/webpack/create-rule-sets.js +1 -0
- package/dist/{dev-server/add-compiler-to-dev-server.d.ts → core/webpack/dev-serve/add-webpack-compiler-to-dev-server.d.ts} +2 -2
- package/dist/core/webpack/dev-serve/add-webpack-compiler-to-dev-server.js +1 -0
- package/dist/core/webpack/dev-serve/create-webpack-compiler-task.d.ts +3 -0
- package/dist/core/webpack/dev-serve/create-webpack-compiler-task.js +1 -0
- package/dist/core/webpack/index.d.ts +2 -0
- package/dist/core/webpack/index.js +1 -0
- package/dist/{create-webpack → core/webpack}/load-watch-options.d.ts +3 -3
- package/dist/core/webpack/load-watch-options.js +1 -0
- package/dist/{create-webpack → core/webpack}/load-webpack-config.d.ts +3 -3
- package/dist/core/webpack/load-webpack-config.js +1 -0
- package/dist/core/webpack/start-webpack-build.d.ts +12 -0
- package/dist/core/webpack/start-webpack-build.js +1 -0
- package/dist/default-options.js +1 -1
- package/dist/dev-server/create-app-page-route.d.ts +1 -1
- package/dist/dev-server/create-dev-server-entries.d.ts +1 -1
- package/dist/dev-server/index.d.ts +0 -2
- package/dist/dev-server/index.js +1 -1
- package/dist/dev-server/middlewares/create-page-middleware.d.ts +1 -1
- package/dist/dev-server/middlewares/get-all-sorted-modules.d.ts +1 -1
- package/dist/dev-server/middlewares/get-dev-server-host-uri.d.ts +1 -1
- package/dist/dev-server/middlewares/get-hmr-runtime-chunks.d.ts +1 -1
- package/dist/dev-server/middlewares/get-normalized-entry-name.d.ts +1 -1
- package/dist/dev-server/middlewares/get-page-main-html.d.ts +1 -1
- package/dist/dev-server/middlewares/get-page-module-html.d.ts +1 -1
- package/dist/dev-server/middlewares/get-runtime-manifest.d.ts +1 -1
- package/dist/helpers/assert-single-compiler.d.ts +14 -1
- package/dist/helpers/assert-single-compiler.js +1 -1
- package/dist/helpers/custom-listr-renderer.js +1 -1
- package/dist/helpers/flat-entry-map.d.ts +1 -1
- package/dist/helpers/format-spinner-text.d.ts +3 -1
- package/dist/helpers/format-spinner-text.js +1 -1
- package/dist/helpers/print-promotion.d.ts +2 -0
- package/dist/helpers/print-promotion.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/main/create-build-server.d.ts +1 -1
- package/dist/main/create-thread-worker.d.ts +1 -1
- package/dist/main/index.d.ts +0 -1
- package/dist/main/index.js +1 -1
- package/dist/main/prepare-build.d.ts +1 -1
- package/dist/main/prepare-build.js +1 -1
- package/dist/main/prepare-serve.d.ts +2 -1
- package/dist/main/prepare-serve.js +1 -1
- package/dist/main/start-build-dynamic.d.ts +5 -3
- package/dist/main/start-build-dynamic.js +1 -1
- package/dist/main/start-build-worker.d.ts +1 -3
- package/dist/main/start-build-worker.js +1 -1
- package/dist/main/start-build.d.ts +1 -1
- package/dist/main/start-build.js +1 -1
- package/dist/main/start-serve.d.ts +2 -1
- package/dist/main/start-serve.js +1 -1
- package/dist/minimizer/default-options.d.ts +2 -0
- package/dist/minimizer/default-options.js +1 -1
- package/dist/minimizer/index.d.ts +2 -1
- package/dist/minimizer/index.js +1 -1
- package/dist/minimizer/rspack/create-minimizers.d.ts +3 -0
- package/dist/minimizer/rspack/create-minimizers.js +1 -0
- package/dist/minimizer/{image-minimizer.d.ts → rspack/image-minimizer.d.ts} +1 -1
- package/dist/minimizer/rspack/image-minimizer.js +1 -0
- package/dist/minimizer/rspack/terser-minimizer.d.ts +6 -0
- package/dist/minimizer/rspack/terser-minimizer.js +1 -0
- package/dist/minimizer/webpack/create-minimizers.d.ts +3 -0
- package/dist/minimizer/webpack/create-minimizers.js +1 -0
- package/dist/minimizer/webpack/image-minimizer.d.ts +16 -0
- package/dist/minimizer/webpack/image-minimizer.js +1 -0
- package/dist/minimizer/webpack/terser-minimizer.d.ts +6 -0
- package/dist/minimizer/{terser-minimizer.js → webpack/terser-minimizer.js} +1 -1
- package/dist/plugins/{define-variable/define-variable-plugin.d.ts → rspack/define-variable/index.d.ts} +3 -3
- package/dist/plugins/rspack/define-variable/index.js +1 -0
- package/dist/plugins/rspack/module-federation/external-template-remotes-rspack-plugin.d.ts +4 -0
- package/dist/plugins/rspack/module-federation/external-template-remotes-rspack-plugin.js +1 -0
- package/dist/plugins/rspack/module-federation/index.d.ts +4 -0
- package/dist/plugins/rspack/module-federation/index.js +1 -0
- package/dist/plugins/rspack/multi-html/index.d.ts +4 -0
- package/dist/plugins/rspack/multi-html/index.js +1 -0
- package/dist/plugins/rspack/multi-html/multi-html-cdn-rspack-plugin.d.ts +18 -0
- package/dist/plugins/rspack/multi-html/multi-html-cdn-rspack-plugin.js +1 -0
- package/dist/plugins/{multi-html/multi-html-modify-plugin.d.ts → rspack/multi-html/multi-html-modify--rspack-plugin.d.ts} +2 -2
- package/dist/plugins/rspack/multi-html/multi-html-modify--rspack-plugin.js +1 -0
- package/dist/plugins/rspack/multi-html/multi-html-rspack-plugin.d.ts +11 -0
- package/dist/plugins/rspack/multi-html/multi-html-rspack-plugin.js +1 -0
- package/dist/plugins/rspack/progress-plugin/index.d.ts +4 -0
- package/dist/plugins/rspack/progress-plugin/index.js +1 -0
- package/dist/plugins/rspack/progress-plugin/progress-handler.d.ts +3 -0
- package/dist/plugins/rspack/progress-plugin/progress-handler.js +1 -0
- package/dist/plugins/rspack/progress-plugin/progress-worker.d.ts +7 -0
- package/dist/plugins/rspack/progress-plugin/progress-worker.js +1 -0
- package/dist/plugins/{circular-dependency/circular-dependency-plugin.d.ts → webpack/circular-dependency/circular-dependency-webpack-plugin.d.ts} +1 -1
- package/dist/plugins/webpack/circular-dependency/circular-dependency-webpack-plugin.js +1 -0
- package/dist/plugins/webpack/circular-dependency/index.d.ts +9 -0
- package/dist/plugins/webpack/circular-dependency/index.js +1 -0
- package/dist/plugins/webpack/clean-webpack/clean-webpack-plugin.js +1 -0
- package/dist/plugins/webpack/clean-webpack/index.d.ts +9 -0
- package/dist/plugins/webpack/clean-webpack/index.js +1 -0
- package/dist/plugins/webpack/define-variable/index.d.ts +16 -0
- package/dist/plugins/webpack/define-variable/index.js +1 -0
- package/dist/plugins/{html-inject-scripts/plugin-html-inject-script.d.ts → webpack/html-inject-scripts/html-inject-script-webpack-plugin.d.ts} +1 -1
- package/dist/plugins/webpack/html-inject-scripts/html-inject-script-webpack-plugin.js +1 -0
- package/dist/plugins/webpack/html-inject-scripts/html-inline-script-webpack-plugin.d.ts +12 -0
- package/dist/plugins/webpack/html-inject-scripts/html-inline-script-webpack-plugin.js +1 -0
- package/dist/plugins/webpack/html-inject-scripts/index.d.ts +2 -0
- package/dist/plugins/webpack/html-inject-scripts/index.js +1 -0
- package/dist/plugins/{module-federation/external-template-remotes.d.ts → webpack/module-federation/external-template-remotes-webpack-plugin.d.ts} +1 -1
- package/dist/plugins/webpack/module-federation/external-template-remotes-webpack-plugin.js +1 -0
- package/dist/plugins/webpack/module-federation/index.d.ts +4 -0
- package/dist/plugins/webpack/module-federation/index.js +1 -0
- package/dist/plugins/webpack/multi-html/index.d.ts +4 -0
- package/dist/plugins/webpack/multi-html/index.js +1 -0
- package/dist/plugins/{multi-html/multi-html-cdn-plugin.d.ts → webpack/multi-html/multi-html-cdn-webpack-plugin.d.ts} +2 -2
- package/dist/plugins/webpack/multi-html/multi-html-cdn-webpack-plugin.js +1 -0
- package/dist/plugins/webpack/multi-html/multi-html-modify-webpack-plugin.d.ts +12 -0
- package/dist/plugins/webpack/multi-html/multi-html-modify-webpack-plugin.js +1 -0
- package/dist/plugins/webpack/multi-html/multi-html-webpack-plugins.d.ts +11 -0
- package/dist/plugins/webpack/multi-html/multi-html-webpack-plugins.js +1 -0
- package/dist/plugins/webpack/stats-webpack/index.d.ts +12 -0
- package/dist/plugins/webpack/stats-webpack/index.js +1 -0
- package/dist/plugins/webpack/stats-webpack/stats-webpack-plugin.js +1 -0
- package/dist/rules/index.d.ts +2 -0
- package/dist/rules/index.js +1 -0
- package/dist/rules/rspack/index.d.ts +5 -0
- package/dist/rules/rspack/index.js +1 -0
- package/dist/rules/rspack/rule-assets.d.ts +10 -0
- package/dist/rules/rspack/rule-assets.js +1 -0
- package/dist/rules/rspack/rule-css.d.ts +11 -0
- package/dist/rules/rspack/rule-css.js +1 -0
- package/dist/rules/rspack/rule-less.d.ts +26 -0
- package/dist/rules/rspack/rule-less.js +1 -0
- package/dist/rules/rspack/rule-scripts.d.ts +3 -0
- package/dist/rules/rspack/rule-scripts.js +1 -0
- package/dist/rules/rspack/rule-svg-icon.d.ts +6 -0
- package/dist/rules/rspack/rule-svg-icon.js +1 -0
- package/dist/rules/rule-utils.d.ts +19 -0
- package/dist/rules/rule-utils.js +1 -0
- package/dist/rules/wepack/index.d.ts +5 -0
- package/dist/rules/wepack/index.js +1 -0
- package/dist/{create-webpack/rule-sets → rules/wepack}/rule-assets.d.ts +1 -1
- package/dist/rules/wepack/rule-assets.js +1 -0
- package/dist/{create-webpack/rule-sets → rules/wepack}/rule-css.d.ts +1 -1
- package/dist/rules/wepack/rule-css.js +1 -0
- package/dist/{create-webpack/rule-sets → rules/wepack}/rule-less.d.ts +1 -1
- package/dist/rules/wepack/rule-less.js +1 -0
- package/dist/{create-webpack/rule-sets → rules/wepack}/rule-scripts.d.ts +1 -1
- package/dist/rules/wepack/rule-scripts.js +1 -0
- package/dist/{create-webpack/rule-sets → rules/wepack}/rule-svg-icon.d.ts +1 -1
- package/dist/rules/wepack/rule-svg-icon.js +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +1 -1
- package/dist/types/types-build.d.ts +4 -0
- package/dist/types/types-cli-options.d.ts +5 -0
- package/dist/types/types-dev-server.d.ts +23 -0
- package/dist/types/types-options.d.ts +5 -0
- package/dist/types/types-webpack.d.ts +42 -3
- package/package.json +21 -9
- package/dist/create-webpack/create-optimization.js +0 -1
- package/dist/create-webpack/create-output.js +0 -1
- package/dist/create-webpack/create-plugins.d.ts +0 -5
- package/dist/create-webpack/create-plugins.js +0 -1
- package/dist/create-webpack/create-rule-sets.js +0 -1
- package/dist/create-webpack/load-watch-options.js +0 -1
- package/dist/create-webpack/load-webpack-config.js +0 -1
- package/dist/create-webpack/rule-sets/rule-assets.js +0 -1
- package/dist/create-webpack/rule-sets/rule-css.js +0 -1
- package/dist/create-webpack/rule-sets/rule-less.js +0 -1
- package/dist/create-webpack/rule-sets/rule-scripts.js +0 -1
- package/dist/create-webpack/rule-sets/rule-svg-icon.js +0 -1
- package/dist/create-webpack/rule-sets/rule-utils.d.ts +0 -7
- package/dist/create-webpack/rule-sets/rule-utils.js +0 -1
- package/dist/create-webpack/types.d.ts +0 -2
- package/dist/dev-server/add-compiler-to-dev-server.js +0 -1
- package/dist/dev-server/create-dev-server-compiler-task.d.ts +0 -3
- package/dist/dev-server/create-dev-server-compiler-task.js +0 -1
- package/dist/dev-server/middlewares/types.d.ts +0 -24
- package/dist/dev-server/middlewares/types.js +0 -1
- package/dist/main/start-group-entry-build.d.ts +0 -15
- package/dist/main/start-group-entry-build.js +0 -1
- package/dist/minimizer/create-minimizers.d.ts +0 -3
- package/dist/minimizer/create-minimizers.js +0 -1
- package/dist/minimizer/image-minimizer.js +0 -1
- package/dist/minimizer/terser-minimizer.d.ts +0 -6
- package/dist/plugins/circular-dependency/circular-dependency-plugin.js +0 -1
- package/dist/plugins/circular-dependency/index.d.ts +0 -7
- package/dist/plugins/circular-dependency/index.js +0 -1
- package/dist/plugins/clean-webpack/clean-webpack-plugin.js +0 -1
- package/dist/plugins/clean-webpack/index.d.ts +0 -9
- package/dist/plugins/clean-webpack/index.js +0 -1
- package/dist/plugins/define-variable/define-variable-plugin.js +0 -1
- package/dist/plugins/define-variable/index.d.ts +0 -1
- package/dist/plugins/define-variable/index.js +0 -1
- package/dist/plugins/html-inject-scripts/plugin-html-inject-script.js +0 -1
- package/dist/plugins/module-federation/external-template-remotes.js +0 -1
- package/dist/plugins/module-federation/index.d.ts +0 -1
- package/dist/plugins/module-federation/index.js +0 -1
- package/dist/plugins/module-federation/module-federation.d.ts +0 -4
- package/dist/plugins/module-federation/module-federation.js +0 -1
- package/dist/plugins/multi-html/index.d.ts +0 -4
- package/dist/plugins/multi-html/index.js +0 -1
- package/dist/plugins/multi-html/multi-html-cdn-plugin.js +0 -1
- package/dist/plugins/multi-html/multi-html-modify-plugin.js +0 -1
- package/dist/plugins/multi-html/multi-html-plugin.d.ts +0 -11
- package/dist/plugins/multi-html/multi-html-plugin.js +0 -1
- package/dist/plugins/stats-webpack/index.d.ts +0 -12
- package/dist/plugins/stats-webpack/index.js +0 -1
- package/dist/plugins/stats-webpack/stats-webpack-plugin.js +0 -1
- /package/dist/{create-webpack → core/rspack}/create-externals.js +0 -0
- /package/dist/{create-webpack → core/rspack}/create-performance.js +0 -0
- /package/dist/{create-webpack → core/webpack}/create-resolve.js +0 -0
- /package/dist/{create-webpack → helpers}/resolve-public-path.d.ts +0 -0
- /package/dist/{create-webpack → helpers}/resolve-public-path.js +0 -0
- /package/dist/plugins/{clean-webpack → webpack/clean-webpack}/clean-webpack-plugin.d.ts +0 -0
- /package/dist/plugins/{stats-webpack → webpack/stats-webpack}/helper-write-stats.d.ts +0 -0
- /package/dist/plugins/{stats-webpack → webpack/stats-webpack}/helper-write-stats.js +0 -0
- /package/dist/plugins/{stats-webpack → webpack/stats-webpack}/stats-webpack-plugin.d.ts +0 -0
- /package/dist/{create-webpack/rule-sets → rules}/constants.d.ts +0 -0
- /package/dist/{create-webpack/rule-sets → rules}/constants.js +0 -0
- /package/dist/{create-webpack/types.js → types/types-build.js} +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
import htmlWebpackPlugin from"html-webpack-plugin";import webpack from"webpack";const{Compilation:Compilation}=webpack,PLUGIN_PREFIX="HtmlInlineScriptWebpackPlugin";export class HtmlInlineScriptWebpackPlugin{constructor(t){this.tests=t||[/.+\.js$/]}isFileNeedsToBeInlined(t){return this.tests.some((e=>e.exec(t)))}processScriptTag(t,e,s){if("script"!==s.tagName||!s.attributes?.src)return s;const i=s.attributes.src.replace(t,"");if(!this.isFileNeedsToBeInlined(i))return s;const a=e[i];if(!s)return s;const{src:p,...r}=s.attributes;return{tagName:"script",innerHTML:a.source(),voidTag:!1,attributes:r,meta:{plugin:"html-inline-script-webpack-plugin"}}}apply(t){let e=t.options?.output?.publicPath||"";e&&!e.endsWith("/")&&(e+="/"),t.hooks.compilation.tap(`${PLUGIN_PREFIX}_compilation`,(t=>{htmlWebpackPlugin.getHooks(t).alterAssetTags.tap(`${PLUGIN_PREFIX}_alterAssetTags`,(s=>(s.assetTags.scripts=s.assetTags.scripts.map((s=>this.processScriptTag(e,t.assets,s))),s))),t.hooks.processAssets.tap({name:`${PLUGIN_PREFIX}_PROCESS_ASSETS_STAGE_SUMMARIZE`,stage:Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE},(t=>{Object.keys(t).forEach((e=>{this.isFileNeedsToBeInlined(e)&&delete t[e]}))}))}))}}
|
@@ -0,0 +1 @@
|
|
1
|
+
export*from"./html-inject-script-webpack-plugin.js";export*from"./html-inline-script-webpack-plugin.js";
|
@@ -0,0 +1 @@
|
|
1
|
+
import webpackSources from"webpack-sources";const PLUGIN_NAME="ExternalTemplateRemotesWebpackPlugin",isExternalModule=e=>"ExternalModule"===e.constructor.name;function extractUrlAndGlobal(e){const t=e.indexOf("@");if(t<=0||t===e.length-1)throw new Error(`Invalid request "${e}"`);return[e.substring(t+1),e.substring(0,t)]}export class ExternalTemplateRemotesWebpackPlugin{apply(e){e.hooks.make.tap(PLUGIN_NAME,(e=>{const t=[];e.hooks.buildModule.tap(PLUGIN_NAME,(e=>{isExternalModule(e)&&"script"===e.externalType&&t.push(e)})),e.hooks.afterCodeGeneration.tap(PLUGIN_NAME,(()=>{t.forEach((t=>{const o=extractUrlAndGlobal(t.request)[0],n=toExpression(o),r=e.codeGenerationResults.get(t,void 0).sources,s=r.get("javascript");if(s){const e=new webpackSources.RawSource(s.source().toString().replace(`"${o}"`,n));r.set("javascript",e)}}))}))}))}}function toExpression(e){const t=[],o=[];let n=!1,r=!1;for(const s of e)if("["===s){if(n){r=!0;break}n=!0,o.length&&(t.push(`"${o.join("")}"`),o.length=0)}else if("]"===s){if(!n){r=!0;break}n=!1,o.length&&(t.push(`${o.join("")}`),o.length=0),o.length=0}else o.push(s);if(n||r)throw new Error(`Invalid template URL "${e}"`);return o.length&&t.push(`"${o.join("")}"`),t.join(" + ")}
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { type WebpackPluginInstance } from 'webpack';
|
2
|
+
import { type EntryMapItem } from '../../../types/types-entry-map.js';
|
3
|
+
import { type FlatEvolveOptions } from '../../../types/types-options.js';
|
4
|
+
export declare const createModuleFederationWebpackPlugins: (serveMode: boolean, entryMapItemList: EntryMapItem[], evolveOptions: FlatEvolveOptions) => WebpackPluginInstance[];
|
@@ -0,0 +1 @@
|
|
1
|
+
import{join}from"node:path";import webpack from"webpack";import{ensureSlash}from"@flatjs/common";import{normalizeEvolveEntryName}from"../../../helpers/normalize-entry-map.js";import{injectFederationScripts}from"../../../helpers/script-injects.js";import{HtmlInjectScriptWebpackPlugin}from"../html-inject-scripts/index.js";import{ExternalTemplateRemotesWebpackPlugin}from"./external-template-remotes-webpack-plugin.js";const normalizeWidgetName=(e="")=>e.replace(/[/-]/g,"_").toLowerCase(),remoteFileName=e=>join(e,"micro-remote-module.js");export const createModuleFederationWebpackPlugins=(e,t,o)=>{const r=o.projectVirtualPath,n=o.multiHtmlCdn,i=o.multiHtmlCdnEnvResolver,m=[];for(const o of t){const[t,a]=o,l=a.options?.moduleFederation;if(l){const{remotes:o,exposes:a,...s}=l,p=remoteFileName(t),c=normalizeWidgetName(t),u=(a?Array.isArray(a)?a:[a]:[]).map((e=>{const o={};for(const[r,n]of Object.entries(e))o[r]={...n,name:join(t,n.name.replace(/^\//,""))};return o})),d=(o||[]).map((({name:e,endpoint:t})=>{const o=normalizeEvolveEntryName(e,r),n=normalizeWidgetName(o),i=remoteFileName(o),m=t?ensureSlash(t(e,o),!1):"[window.evolveFetchMicroWidgets()]";return{[n]:`${n}@${m}/${i}`}}));m.push(new webpack.container.ModuleFederationPlugin({...s,name:c,filename:p,remotes:d,exposes:u}),new ExternalTemplateRemotesWebpackPlugin),e||m.unshift(new HtmlInjectScriptWebpackPlugin([injectFederationScripts(n,i)]))}}return m};
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { type EntryMapItem } from '../../../types/types-entry-map.js';
|
2
|
+
import { type FlatEvolveOptions } from '../../../types/types-options.js';
|
3
|
+
import type { WebpackPlugin } from '../../../types/types-webpack.js';
|
4
|
+
export declare const createHtmlWebpackPlugins: (serveMode: boolean, entryMapItemList: EntryMapItem[], evolveOptions: FlatEvolveOptions) => WebpackPlugin[];
|
@@ -0,0 +1 @@
|
|
1
|
+
import{FlatEvolveMultiCdnWebpackPlugin}from"./multi-html-cdn-webpack-plugin.js";import{createMultiHtmlWebpackPlugins}from"./multi-html-webpack-plugins.js";export const createHtmlWebpackPlugins=(t,l,e)=>{const u=[],i=l[0];if(t||i[1]?.options?.output?.library)return u;const n=Object.keys(e.multiHtmlCdn);return u.push(...createMultiHtmlWebpackPlugins(t,e,l,n)),u.push(new FlatEvolveMultiCdnWebpackPlugin(e)),u};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { type Compiler } from 'webpack';
|
2
|
-
import { type FlatEvolveOptions } from '
|
3
|
-
export declare class
|
2
|
+
import { type FlatEvolveOptions } from '../../../types/index.js';
|
3
|
+
export declare class FlatEvolveMultiCdnWebpackPlugin {
|
4
4
|
private pluginName;
|
5
5
|
private requireFn;
|
6
6
|
private config;
|
@@ -0,0 +1 @@
|
|
1
|
+
import HtmlWebpackPlugin from"html-webpack-plugin";import{basename}from"node:path";import webpack from"webpack";import{ensureSlash}from"@flatjs/common";import{getRuntimeCDNBase}from"../../../helpers/get-runtime-cdn-base.js";import{findEnvCdn,httpUrlJoin}from"../../../helpers/script-injects.js";export class FlatEvolveMultiCdnWebpackPlugin{constructor(e){if(this.pluginName="FlatEvolveMultiCdnWebpackPlugin",this.requireFn=webpack.RuntimeGlobals.publicPath,this.config=e.multiHtmlCdn,this.cdnResolver=e.multiHtmlCdnEnvResolver||function cdnResolver(){},!this.config?.prod)throw new Error("We must setup `prod` for each CDN config node!")}apply(e){e.hooks.thisCompilation.tap(this.pluginName,(e=>{e.mainTemplate.hooks.requireExtensions.tap(this.pluginName,((t,n)=>{const s=[];s.push("// Dynamic assets path override(`@flatjs/evolve`) plugin-multi-html-cdn`)");const i=e.chunkGraph?.getTreeRuntimeRequirements(n);return i&&i.has(webpack.RuntimeGlobals.requireScope)&&s.push(webpack.Template.indent(getRuntimeCDNBase(this.config,this.cdnResolver,this.requireFn))),webpack.Template.asString(s)}))})),e.hooks.compilation.tap(this.pluginName,(e=>{HtmlWebpackPlugin.getHooks(e).beforeAssetTagGeneration.tap(this.pluginName,(e=>{const{assets:t,plugin:n,outputName:s}=e,i=n?.options?.chunks||[],r=Array.isArray(i)?i.find((e=>s.includes(ensureSlash(e,!0)))):i,{userOptions:a}=e.plugin;if(!r)throw new Error("We must have current chunk!");const o=t.js.filter((e=>e.includes(ensureSlash(r,!0)))),l=t.css.filter((e=>e.includes(ensureSlash(r,!0)))),p=a.multiCdn,u=t.publicPath,c=o.map((e=>{if(p.disabled)return basename(e);const t=findEnvCdn(this.config,p.env);return httpUrlJoin(t,e.replace(u,""))})),m=l.map((e=>{if(p.disabled)return basename(e);const t=findEnvCdn(this.config,p.env);return httpUrlJoin(t,e.replace(u,""))}));return e.assets.js=c,e.assets.css=m,e}))}))}}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import type { Compiler } from 'webpack';
|
2
|
+
import type { EntryMapItem } from '../../../types/types-entry-map.js';
|
3
|
+
/**
|
4
|
+
* The MultiHtmlModifyPlugin class is responsible for modifying the HTML output of the webpack compiler.
|
5
|
+
* It hooks into the compilation process and replaces occurrences of "<%= title %>" with the title specified in the options.
|
6
|
+
*/
|
7
|
+
export declare class MultiHtmlModifyWebpackPlugin {
|
8
|
+
private pluginName;
|
9
|
+
private entryMapItemList;
|
10
|
+
constructor(list: EntryMapItem[]);
|
11
|
+
apply(compiler: Compiler): void;
|
12
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
import HtmlWebpackPlugin from"html-webpack-plugin";import{ensureSlash}from"@flatjs/common";const getCurrentEntryOptions=(t=[],e)=>{const i=t.find((t=>e.includes(ensureSlash(t[0],!0))));return i?i[1]?.options:void 0};export class MultiHtmlModifyWebpackPlugin{constructor(t){this.pluginName="MultiHtmlModifyWebpackPlugin",this.entryMapItemList=t}apply(t){t.hooks.compilation.tap(this.pluginName,(t=>{HtmlWebpackPlugin.getHooks(t).beforeEmit.tapAsync(this.pluginName,((t,e)=>{const i=getCurrentEntryOptions(this.entryMapItemList,t.outputName);/<%= title %>/.test(t.html)&&(t.html=t.html.replace(/<%= title %>/g,i?.title||"")),e(null,t)}))}))}}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { type EntryMapItem } from '../../../types/types-entry-map.js';
|
2
|
+
import { type EvolveMultiCdnEnvType } from '../../../types/types-multi-html.js';
|
3
|
+
import { type FlatEvolveOptions } from '../../../types/types-options.js';
|
4
|
+
import type { WebpackPlugin } from '../../../types/types-webpack.js';
|
5
|
+
/**
|
6
|
+
* Create `html-webpack-plugin` for this build, refer to best practices
|
7
|
+
* We'd better pass only one entry for each `build` cycle
|
8
|
+
* @param buildEntryItem the entries for this `build`
|
9
|
+
* @param allEnv
|
10
|
+
*/
|
11
|
+
export declare const createMultiHtmlWebpackPlugins: (serveMode: boolean, evolveOptions: FlatEvolveOptions, entryMapItemList: EntryMapItem[], allEnv: Array<EvolveMultiCdnEnvType>) => WebpackPlugin[];
|
@@ -0,0 +1 @@
|
|
1
|
+
import HtmlWebpackPlugin from"html-webpack-plugin";import{existsSync}from"node:fs";import{logger}from"@flatjs/common";import{allowPx2remForModule}from"../../../helpers/allow-px2rem-for-module.js";import{getHtmlPluginConfig}from"../../../helpers/get-html-plugin-config.js";import{normalizeTemplateInjectTokens}from"../../../helpers/normalize-template-inject-tokens.js";import{findEnvCdn}from"../../../helpers/script-injects.js";import{MultiHtmlModifyWebpackPlugin}from"./multi-html-modify-webpack-plugin.js";const minifyOpts={minifyJS:!0,removeComments:!0,collapseWhitespace:!0,collapseBooleanAttributes:!1};export const createMultiHtmlWebpackPlugins=(e,t,l,i)=>{const n=l[0],[,o]=n,m=[new MultiHtmlModifyWebpackPlugin(l)],{options:p}=o,r=e?"development":"production",s=l.map((e=>e[0]));for(const e of i){const l={mode:r,envCdn:findEnvCdn(t.multiHtmlCdn,e)},i=normalizeTemplateInjectTokens(l,p);let o=getHtmlPluginConfig("templatePath",l,p?.templatePath).replace("{0}",e.trim());existsSync(o)||(logger.warn(`The template file ${o} is not exists, use \`prod\` instead!`),o=getHtmlPluginConfig("templatePath",l,p?.templatePath).replace("{0}","prod")),m.push(new HtmlWebpackPlugin({inject:"body",title:getHtmlPluginConfig("title",l,p?.title),chunks:s,minify:!1!==p?.htmlMinify&&!["me","dev"].includes(e)&&minifyOpts,filename:t=>`${t}/index${"prod"===e?"":`-${e}`}.html`,template:o,templateParameters:{title:"<%= title %>",favicon:getHtmlPluginConfig("favicon",l,p?.favicon),viewport:allowPx2remForModule(n,t)?getHtmlPluginConfig("viewport",l,p?.viewport):"",...i},multiCdn:{env:e,disabled:(p?.excludeCdnEnvs||["me","dev","ntv"]).includes(e)}}))}return m};
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import type { FlatCliOptions } from '../../../types/types-cli-options.js';
|
2
|
+
import { type FlatEvolveOptions } from '../../../types/types-options.js';
|
3
|
+
import type { WebpackPlugin } from '../../../types/types-webpack.js';
|
4
|
+
/**
|
5
|
+
* Creates an array of Webpack plugins for generating stats files.
|
6
|
+
*
|
7
|
+
* @param serveMode - A boolean indicating whether the application is running in serve mode.
|
8
|
+
* @param evolveOptions - The options for the evolve package.
|
9
|
+
* @param cliOptions - The options passed through the command-line interface.
|
10
|
+
* @returns An array of Webpack plugins.
|
11
|
+
*/
|
12
|
+
export declare const createStatsWebpackPlugins: (serveMode: boolean, evolveOptions: FlatEvolveOptions, cliOptions?: FlatCliOptions) => WebpackPlugin[];
|
@@ -0,0 +1 @@
|
|
1
|
+
import{StatsWebpackPlugin}from"./stats-webpack-plugin.js";export const createStatsWebpackPlugins=(t,e,a={})=>{const{analyzer:r=!1}=a;return t||!r?[]:[new StatsWebpackPlugin({verbose:!0,projectCwd:e.projectCwd})]};
|
@@ -0,0 +1 @@
|
|
1
|
+
import{rmSync}from"node:fs";import{mkdir}from"node:fs/promises";import{dirname,join,resolve}from"node:path";import{logger}from"@flatjs/common";import{webpackStatsDir}from"../../../constants.js";import{getStatsFileName}from"../../../helpers/get-stats-file-name.js";import{writeStats}from"./helper-write-stats.js";export class StatsWebpackPlugin{constructor(t={}){this.verbose=!0===t.verbose||!1,this.projectCwd=t.projectCwd||process.cwd(),this.outputPath=join(this.projectCwd,webpackStatsDir)}apply(t){this.handleBeforeClean();t.hooks.done.tapAsync("stats-webpack-plugin",((t,e)=>{this.statsFilename=getStatsFileName(t),this.handleDone(t,e)}))}handleBeforeClean(){rmSync(this.outputPath,{force:!0,recursive:!0})}async handleDone(t,e){try{await this.generateStatsFile(t.toJson()),e()}catch(t){e(t)}}async generateStatsFile(t){const e=resolve(this.outputPath,this.statsFilename);await mkdir(dirname(e),{recursive:!0});try{await writeStats(t,e),this.verbose&&logger.debug(`stats-webpack-plugin: saved stats file to ${e}`)}catch(t){this.verbose&&logger.error(`stats-webpack-plugin: error saving stats file to ${e}: ${t}`)}}}
|
@@ -0,0 +1 @@
|
|
1
|
+
export*from"./rspack/index.js";export*from"./wepack/index.js";
|
@@ -0,0 +1 @@
|
|
1
|
+
export*from"./rule-assets.js";export*from"./rule-css.js";export*from"./rule-less.js";export*from"./rule-scripts.js";export*from"./rule-svg-icon.js";
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import type { RuleSetRule } from '@rspack/core';
|
2
|
+
import { type EntryMapItem } from '../../types/types-entry-map.js';
|
3
|
+
import { type FlatEvolveOptions } from '../../types/types-options.js';
|
4
|
+
/**
|
5
|
+
* Preparing image loader for normal pictures except stored in folder `icons`
|
6
|
+
* Webpack@5 don't need `file-loader`, `raw-loader`, `url-loader` provider us `asset-modules`
|
7
|
+
* https://webpack.js.org/guides/asset-modules/
|
8
|
+
* @param entryMapItemList The available entries, `development` it contains multiple enties, `production`
|
9
|
+
*/
|
10
|
+
export declare const rspackRuleAssets: (entryMapItemList: EntryMapItem[], evolveOptions: FlatEvolveOptions) => RuleSetRule;
|
@@ -0,0 +1 @@
|
|
1
|
+
import{resolvePublicPath}from"../../helpers/resolve-public-path.js";import{FONT_PATH_REGEX,IMAGE_PATH_REGEX}from"../constants.js";import{getEntryAssetFileName,isIconSvg}from"../rule-utils.js";export const rspackRuleAssets=(e,t)=>{const s=resolvePublicPath(t);return{type:"asset",test:e=>FONT_PATH_REGEX.test(e)||IMAGE_PATH_REGEX.test(e)&&!isIconSvg(e),generator:{filename:({filename:s})=>getEntryAssetFileName(s,e,t),publicPath:"auto"===s?void 0:s},parser:{dataUrlCondition:{maxSize:t.loaderOptions.assetDataUrlMaxSize}}}};
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { type RuleSetRule } from '@rspack/core';
|
2
|
+
import { type EntryMapItem } from '../../types/types-entry-map.js';
|
3
|
+
import { type FlatEvolveOptions } from '../../types/types-options.js';
|
4
|
+
/**
|
5
|
+
* Actually, style-loader is the one that is responsible for CSS HMR
|
6
|
+
* https://github.com/webpack-contrib/style-loader/blob/master/src/index.js#L31-L42
|
7
|
+
* @param serveMode
|
8
|
+
* @param entryMapItem
|
9
|
+
* @param evolveOptions `builtin` loaders
|
10
|
+
*/
|
11
|
+
export declare const rspackRuleCss: (serveMode: boolean, entryMapItem: EntryMapItem, evolveOptions: FlatEvolveOptions, useCssModule?: boolean) => RuleSetRule;
|
@@ -0,0 +1 @@
|
|
1
|
+
import{requireResolve}from"@flatjs/common";import{forgePostcssPluginPixel}from"@flatjs/forge-postcss-plugin-pixel";import{CssExtractRspackPlugin}from"@rspack/core";import{allowPx2remForModule}from"../../helpers/allow-px2rem-for-module.js";const getPostcssOptions=(s={},o={})=>{const e=o.plugins||[];return!1!==s&&e.push(forgePostcssPluginPixel(s)),{plugins:e}};export const rspackRuleCss=(s,o,e,r=!1)=>{const{pixelOptions:t,cssLoaderOptions:l={},postcssOptions:i}=e.loaderOptions,{modules:p,...c}=l,u=r?{modules:Object.assign({namedExport:!1},p)}:{modules:!1},n={test:/\.css$/i,use:[{loader:CssExtractRspackPlugin.loader,options:{esModule:!0}},{loader:requireResolve(import.meta.url,"css-loader"),options:{sourceMap:s,...u,...c}}]};r?n.include=/\.module\.css$/i:n.exclude=/\.module\.css$/i;const a=allowPx2remForModule(o,e);if(Array.isArray(n.use)){const o=getPostcssOptions(!!a&&t,i);n.use.push({loader:requireResolve(import.meta.url,"postcss-loader"),options:{postcssOptions:{...o,config:!1},sourceMap:s}})}return n};
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import type { RuleSetRule } from '@rspack/core';
|
2
|
+
import { type EntryMapItem } from '../../types/types-entry-map.js';
|
3
|
+
import { type FlatEvolveOptions } from '../../types/types-options.js';
|
4
|
+
/**
|
5
|
+
* Preparing configurations for `less-loader`
|
6
|
+
* @param serveMode The value indicates if we are in `built` or `serve` mode.
|
7
|
+
* @param pluginLoaderOptions `builtin` loaders
|
8
|
+
* @example
|
9
|
+
* ```ts
|
10
|
+
* `~` makes the url an module
|
11
|
+
* webpack: {
|
12
|
+
* externals: {
|
13
|
+
* antd: 'antd',
|
14
|
+
* dayjs: 'dayjs',
|
15
|
+
* },
|
16
|
+
* resolve: {
|
17
|
+
* alias: {
|
18
|
+
* '@': resolve(projectCwd, './src'),
|
19
|
+
* },
|
20
|
+
* },
|
21
|
+
* },
|
22
|
+
* `@import '~@/theme/default.less';` at `src/theme/default.less`
|
23
|
+
*
|
24
|
+
* ```
|
25
|
+
*/
|
26
|
+
export declare const rspackRuleLess: (serveMode: boolean, entryMapItem: EntryMapItem, evolveOptions: FlatEvolveOptions) => RuleSetRule;
|
@@ -0,0 +1 @@
|
|
1
|
+
import{requireResolve}from"@flatjs/common";import{rspackRuleCss}from"./rule-css.js";export const rspackRuleLess=(s,e,r)=>{const o=rspackRuleCss(s,e,r);o.test=/\.less$/i;const t=r.loaderOptions.lessOptions;return Array.isArray(o.use)&&o.use.push({loader:requireResolve(import.meta.url,"less-loader"),options:{sourceMap:s,lessOptions:{sourceMap:s,javascriptEnabled:!0,...t}}}),o};
|
@@ -0,0 +1 @@
|
|
1
|
+
import{assertSwcImportOptions}from"@flatjs/babel-plugin-import/helpers";import{requireResolve}from"@flatjs/common";import{shouldEnableReactFastRefresh}from"../../helpers/should-enable-react-fast-refresh.js";export const rspackRuleScripts=(e,r,t)=>{const{loaderOptions:s,projectCwd:a}=t,{modularImports:o=[]}=s,p=assertSwcImportOptions(a,o),l=shouldEnableReactFastRefresh(e,r,t);return{test:/\.(jsx|tsx|ts|js|mjs|cjs|mts|cts)$/,exclude:/node_modules/,use:[{loader:"builtin:swc-loader",options:{jsc:{parser:{decorators:!0,syntax:"typescript",tsx:!0},externalHelpers:!0,experimental:{keepImportAttributes:!0,plugins:[[requireResolve(import.meta.url,"@flatjs/swc-plugin-import"),{modularImports:p}]]},transform:{legacyDecorator:!0,react:{runtime:"automatic",pragma:"React.createElement",pragmaFrag:"React.Fragment",throwIfNamespace:!0,development:l,refresh:l}}},env:{mode:"entry",targets:{browsers:["ie >= 11","safari > 10"]}}}}]}};
|
@@ -0,0 +1 @@
|
|
1
|
+
import{getDirname}from"@armit/file-utility";import{isIconSvg}from"../rule-utils.js";export const rspackRuleSvgIcon=()=>({test:e=>isIconSvg(e),use:[{loader:getDirname(import.meta.url,"../../loaders/loader-icon.cjs"),options:{svgo:{plugins:[{name:"removeTitle"},{name:"removeDimensions"}]}}}]});
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import type { EntryMapItem } from '../types/types-entry-map.js';
|
2
|
+
import type { FlatEvolveOptions } from '../types/types-options.js';
|
3
|
+
/**
|
4
|
+
* Causeof we expose a component <Icon /> from `@wove/react` it can be optimized via icon-loader.
|
5
|
+
* limitation assets match `svg-icons/**\/*.svg` to icon loader resolver.
|
6
|
+
* @param resource
|
7
|
+
* @returns
|
8
|
+
*/
|
9
|
+
export declare const isIconSvg: (resource: string) => boolean;
|
10
|
+
/**
|
11
|
+
* Get the asset filename based on the entry configuration.
|
12
|
+
* This function determines the output path for assets by matching them against entry points.
|
13
|
+
*
|
14
|
+
* @param filename - The original filename of the asset
|
15
|
+
* @param entryMapItemList - List of entry configurations
|
16
|
+
* @param evolveOptions - Configuration options containing project paths
|
17
|
+
* @returns The formatted asset filename with content hash
|
18
|
+
*/
|
19
|
+
export declare const getEntryAssetFileName: (filename: string, entryMapItemList: EntryMapItem[], evolveOptions: FlatEvolveOptions) => string;
|
@@ -0,0 +1 @@
|
|
1
|
+
import{dirname,join,relative,resolve}from"node:path";import{ensureSlash,normalizePlatformPath}from"@flatjs/common";import{ICON_PATH_REGEX}from"./constants.js";export const isIconSvg=t=>ICON_PATH_REGEX.test(t)&&t.endsWith(".svg");export const getEntryAssetFileName=(t,e,r)=>{const{projectCwd:o,projectVirtualPath:n}=r;let s=dirname(join(n,t.replace(/^src/,"")));const a=[];for(const[t,r]of e)for(const e of r.entry)a.push({entryName:t,entry:e});a.sort(((t,e)=>e.entry.length-t.entry.length));for(const e of a){const{entryName:r,entry:n}=e,a=dirname(join(o,n)),i=resolve(o,t);if(i.startsWith(ensureSlash(a,!0,!0))){s=dirname(join(r,relative(a,i)));break}}return`${normalizePlatformPath(s)}/[name]-[contenthash:8][ext]`};
|
@@ -0,0 +1 @@
|
|
1
|
+
export*from"./rule-assets.js";export*from"./rule-css.js";export*from"./rule-less.js";export*from"./rule-scripts.js";export*from"./rule-svg-icon.js";
|
@@ -7,4 +7,4 @@ import { type FlatEvolveOptions } from '../../types/types-options.js';
|
|
7
7
|
* https://webpack.js.org/guides/asset-modules/
|
8
8
|
* @param entryMapItemList The available entries, `development` it contains multiple enties, `production`
|
9
9
|
*/
|
10
|
-
export declare const
|
10
|
+
export declare const webpackRuleAssets: (entryMapItemList: EntryMapItem[], evolveOptions: FlatEvolveOptions) => RuleSetRule;
|
@@ -0,0 +1 @@
|
|
1
|
+
import{resolvePublicPath}from"../../helpers/resolve-public-path.js";import{FONT_PATH_REGEX,IMAGE_PATH_REGEX}from"../constants.js";import{getEntryAssetFileName,isIconSvg}from"../rule-utils.js";export const webpackRuleAssets=(e,t)=>{const s=resolvePublicPath(t);return{type:"asset",test:e=>FONT_PATH_REGEX.test(e)||IMAGE_PATH_REGEX.test(e)&&!isIconSvg(e),generator:{filename:({filename:s})=>getEntryAssetFileName(s,e,t),publicPath:"auto"===s?void 0:s},parser:{dataUrlCondition:{maxSize:t.loaderOptions.assetDataUrlMaxSize}}}};
|
@@ -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
|
11
|
+
export declare const webpackRuleCss: (serveMode: boolean, entryMapItem: EntryMapItem, evolveOptions: FlatEvolveOptions, useCssModule?: boolean) => RuleSetRule;
|
@@ -0,0 +1 @@
|
|
1
|
+
import cssnano from"cssnano";import MiniCssExtractPlugin from"mini-css-extract-plugin";import{requireResolve}from"@flatjs/common";import{forgePostcssPluginPixel}from"@flatjs/forge-postcss-plugin-pixel";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 webpackRuleCss=(s,o,e,r=!1)=>{const{pixelOptions:t,cssLoaderOptions:i={},postcssOptions:l}=e.loaderOptions,{modules:n,...p}=i,c=r?{modules:Object.assign({namedExport:!1},n)}:{modules:!1},u={test:/\.css$/i,use:[{loader:MiniCssExtractPlugin.loader,options:{esModule:!0}},{loader:requireResolve(import.meta.url,"css-loader"),options:{sourceMap:s,...c,...p}}]};r?u.include=/\.module\.css$/i:u.exclude=/\.module\.css$/i;const a=allowPx2remForModule(o,e);if(Array.isArray(u.use)){const o=getPostcssOptions(s,!!a&&t,l);u.use.push({loader:requireResolve(import.meta.url,"postcss-loader"),options:{postcssOptions:{...o,config:!1},sourceMap:s}})}return u};
|
@@ -23,4 +23,4 @@ import { type FlatEvolveOptions } from '../../types/types-options.js';
|
|
23
23
|
*
|
24
24
|
* ```
|
25
25
|
*/
|
26
|
-
export declare const
|
26
|
+
export declare const webpackRuleLess: (serveMode: boolean, entryMapItem: EntryMapItem, evolveOptions: FlatEvolveOptions) => RuleSetRule;
|
@@ -0,0 +1 @@
|
|
1
|
+
import{requireResolve}from"@flatjs/common";import{webpackRuleCss}from"./rule-css.js";export const webpackRuleLess=(s,e,r)=>{const o=webpackRuleCss(s,e,r);o.test=/\.less$/i;const t=r.loaderOptions.lessOptions;return Array.isArray(o.use)&&o.use.push({loader:requireResolve(import.meta.url,"less-loader"),options:{sourceMap:s,lessOptions:{sourceMap:s,javascriptEnabled:!0,...t}}}),o};
|
@@ -2,4 +2,4 @@ import { type RuleSetRule } from 'webpack';
|
|
2
2
|
import { type TransformOptions } from '@babel/core';
|
3
3
|
import { type EntryMapItem, type FlatEvolveOptions } from '../../types/index.js';
|
4
4
|
export declare const ruleBabel: (options: TransformOptions) => RuleSetRule;
|
5
|
-
export declare const
|
5
|
+
export declare const webpackRuleScripts: (serveMode: boolean, entryMapItem: EntryMapItem, evolveOptions: FlatEvolveOptions) => RuleSetRule;
|
@@ -0,0 +1 @@
|
|
1
|
+
import{requireResolve}from"@flatjs/common";import{mergeBabelOption}from"../../helpers/merge-babel-options.js";import{shouldEnableReactFastRefresh}from"../../helpers/should-enable-react-fast-refresh.js";export const ruleBabel=e=>({test:/\.(tsx|ts|js|jsx|mjs|cjs|mts|cts)$/,use:[{loader:requireResolve(import.meta.url,"babel-loader"),options:e}]});export const webpackRuleScripts=(e,r,s)=>{const{projectCwd:t}=s,{babelOptions:o={},modularImports:l=[]}=s.loaderOptions,a=mergeBabelOption(e,l,o,t);return shouldEnableReactFastRefresh(e,r,s)&&(a.plugins?a.plugins.push(requireResolve(import.meta.url,"react-refresh/babel")):a.plugins=[requireResolve(import.meta.url,"react-refresh/babel")]),ruleBabel(a)};
|
@@ -0,0 +1 @@
|
|
1
|
+
import{getDirname}from"@armit/file-utility";import{isIconSvg}from"../rule-utils.js";export const webpackRuleSvgIcon=()=>({test:e=>isIconSvg(e),use:[{loader:getDirname(import.meta.url,"../../loaders/loader-icon.cjs"),options:{svgo:{plugins:[{name:"removeTitle"},{name:"removeDimensions"}]}}}]});
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export*from"./types-analyzer.js";export*from"./types-dev-server.js";export*from"./types-entry-map.js";export*from"./types-federation.js";export*from"./types-global-compiler-options.js";export*from"./types-loader-options.js";export*from"./types-modular-import.js";export*from"./types-multi-html.js";export*from"./types-options.js";export*from"./types-webpack.js";
|
1
|
+
export*from"./types-analyzer.js";export*from"./types-build.js";export*from"./types-cli-options.js";export*from"./types-dev-server.js";export*from"./types-entry-map.js";export*from"./types-federation.js";export*from"./types-global-compiler-options.js";export*from"./types-loader-options.js";export*from"./types-modular-import.js";export*from"./types-multi-html.js";export*from"./types-options.js";export*from"./types-webpack.js";
|
@@ -115,3 +115,26 @@ export type FlatEvolveDevServerOptions = {
|
|
115
115
|
*/
|
116
116
|
https?: SecureContextHttps;
|
117
117
|
};
|
118
|
+
export type EvolveDevServerEntryMap = {
|
119
|
+
/**
|
120
|
+
* entryName: `home`
|
121
|
+
*/
|
122
|
+
[entryName: string]: {
|
123
|
+
/**
|
124
|
+
* entryMapItem config options.
|
125
|
+
*/
|
126
|
+
entryConfig: EvolveEntryMapContent;
|
127
|
+
/**
|
128
|
+
* dev server port number
|
129
|
+
*/
|
130
|
+
devServerPort: number;
|
131
|
+
/**
|
132
|
+
* dev server host uri.
|
133
|
+
*/
|
134
|
+
devServerHostUri: string;
|
135
|
+
/**
|
136
|
+
* entryName: `home` should be normallized to ${`projectVirtualPath`}/home
|
137
|
+
*/
|
138
|
+
normalizedEntryName: string;
|
139
|
+
};
|
140
|
+
};
|
@@ -1,17 +1,48 @@
|
|
1
|
+
import type { Compiler, WebpackPluginInstance } from 'webpack';
|
1
2
|
import { type Configuration, type RuleSetRule } from 'webpack';
|
2
|
-
import { type WebpackPlugin } from '../create-webpack/types.js';
|
3
3
|
import { type TerserMinimizerOptions } from '../minimizer/types.js';
|
4
|
+
export type WebpackPlugin = ((this: Compiler, compiler: Compiler) => void) | WebpackPluginInstance;
|
4
5
|
/**
|
5
6
|
* The webpack entry configuration.
|
6
7
|
*/
|
7
8
|
export interface WebpackEntryObject {
|
8
9
|
[index: string]: string | [string, ...string[]];
|
9
10
|
}
|
10
|
-
export interface FlatEvolveWebpackOptions extends Pick<Configuration, '
|
11
|
+
export interface FlatEvolveWebpackOptions extends Pick<Configuration, 'infrastructureLogging'> {
|
12
|
+
/**
|
13
|
+
* Options for the performance hints.
|
14
|
+
*/
|
15
|
+
performance?: false | {
|
16
|
+
/**
|
17
|
+
* Filter function to select assets that are checked.
|
18
|
+
*/
|
19
|
+
assetFilter?: (name: string, source?: any, assetInfo?: any) => boolean;
|
20
|
+
/**
|
21
|
+
* Sets the format of the hints: warnings, errors or nothing at all.
|
22
|
+
*/
|
23
|
+
hints?: false | 'error' | 'warning';
|
24
|
+
/**
|
25
|
+
* File size limit (in bytes) when exceeded, that webpack will provide performance hints.
|
26
|
+
*/
|
27
|
+
maxAssetSize?: number;
|
28
|
+
/**
|
29
|
+
* Total size of an entry point (in bytes).
|
30
|
+
*/
|
31
|
+
maxEntrypointSize?: number;
|
32
|
+
};
|
33
|
+
/**
|
34
|
+
* Options for the stats.
|
35
|
+
*/
|
36
|
+
stats?: Omit<Configuration['stats'], 'preset'> & {
|
37
|
+
/**
|
38
|
+
* Sets the preset for stats or enables/disables them.
|
39
|
+
*/
|
40
|
+
preset?: boolean | 'normal' | 'none' | 'verbose' | 'errors-only' | 'errors-warnings' | 'minimal' | 'detailed' | 'summary';
|
41
|
+
};
|
11
42
|
/**
|
12
43
|
* These options change how modules are resolved.
|
13
44
|
*/
|
14
|
-
resolve?: Configuration['resolve'] & {
|
45
|
+
resolve?: Omit<Configuration['resolve'], 'fallback'> & {
|
15
46
|
/**
|
16
47
|
* Only allow pass `key:value` alias `{'@xxx':'./src/xxx'}`
|
17
48
|
* Note: Usually you don't need to specify an alias, the framework will auto support `paths` alias of tsconfig.json
|
@@ -26,6 +57,14 @@ export interface FlatEvolveWebpackOptions extends Pick<Configuration, 'performan
|
|
26
57
|
* ```
|
27
58
|
*/
|
28
59
|
alias?: Record<string, string>;
|
60
|
+
/**
|
61
|
+
* Redirect module requests when normal resolving fails.
|
62
|
+
*
|
63
|
+
* Compatible with both rspack and webpack, using intersection of their types.
|
64
|
+
*/
|
65
|
+
fallback?: {
|
66
|
+
[x: string]: string | false | string[];
|
67
|
+
};
|
29
68
|
};
|
30
69
|
/**
|
31
70
|
* Specify the default type of externals.
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@flatjs/evolve",
|
3
|
-
"version": "2.3.2-next.
|
3
|
+
"version": "2.3.2-next.3",
|
4
4
|
"license": "MIT",
|
5
5
|
"type": "module",
|
6
6
|
"exports": {
|
@@ -25,12 +25,18 @@
|
|
25
25
|
"build-release": "yarn build && rimraf ./_release && yarn pack && mkdir ./_release && tar zxvf ./package.tgz --directory ./_release && rm ./package.tgz",
|
26
26
|
"minify": "node ../../scripts/minify.mjs --dest=dist",
|
27
27
|
"codegen": "graphql-codegen --config ./codegen.cjs",
|
28
|
-
"clean": "rimraf --no-glob ./dist ./coverage ./__data__ ./config/__data__ ./_release ./tsconfig.tsbuildinfo",
|
28
|
+
"clean": "rimraf --no-glob ./dist ./node_modules ./coverage ./__data__ ./config/__data__ ./_release ./tsconfig.tsbuildinfo",
|
29
29
|
"lint": "eslint . --cache --cache-location ../../.cache/eslint/evolve.eslintcache",
|
30
30
|
"test": "run-s test-unit",
|
31
|
-
"test-task": "
|
32
|
-
"test-unit": "
|
33
|
-
"test-watch": "
|
31
|
+
"test-task": "run-s test-task:webpack && run-s test-task:rspack",
|
32
|
+
"test-unit": "run-s test-unit:webpack && run-s test-unit:rspack",
|
33
|
+
"test-watch": "run-s test-watch:webpack && run-s test-watch:rspack",
|
34
|
+
"test-task:webpack": "COMPILER_TYPE=webpack vitest run --exclude **/rspack-main",
|
35
|
+
"test-unit:webpack": "COMPILER_TYPE=webpack vitest run --passWithNoTests --exclude **/rspack-main",
|
36
|
+
"test-watch:webpack": "COMPILER_TYPE=webpack vitest watch --ui --exclude **/rspack-main",
|
37
|
+
"test-task:rspack": "COMPILER_TYPE=rspack vitest run --exclude **/webpack-main",
|
38
|
+
"test-unit:rspack": "COMPILER_TYPE=rspack vitest run --passWithNoTests --exclude **/webpack-main",
|
39
|
+
"test-watch:rspack": "COMPILER_TYPE=rspack vitest watch --ui --exclude **/webpack-main",
|
34
40
|
"fix-all-files": "eslint . --fix",
|
35
41
|
"typecheck": "tsc --project ./tsconfig.json --noEmit"
|
36
42
|
},
|
@@ -43,14 +49,20 @@
|
|
43
49
|
"@babel/core": "^7.26.10",
|
44
50
|
"@clack/prompts": "^0.10.1",
|
45
51
|
"@discoveryjs/json-ext": "0.6.3",
|
46
|
-
"@flatjs/babel-plugin-import": "2.2.9-next.
|
52
|
+
"@flatjs/babel-plugin-import": "2.2.9-next.2",
|
47
53
|
"@flatjs/common": "2.2.4-next.0",
|
48
54
|
"@flatjs/evolve-preset-babel": "2.2.4-next.0",
|
49
55
|
"@flatjs/forge-postcss-plugin-pixel": "2.2.4-next.0",
|
50
56
|
"@flatjs/forge-ts-checker": "1.1.2-next.0",
|
51
|
-
"@flatjs/graph": "2.2.9-next.
|
52
|
-
"@flatjs/mock": "2.4.1-next.
|
57
|
+
"@flatjs/graph": "2.2.9-next.2",
|
58
|
+
"@flatjs/mock": "2.4.1-next.2",
|
59
|
+
"@flatjs/swc-plugin-import": "1.0.0-next.3",
|
53
60
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.16",
|
61
|
+
"@rsdoctor/rspack-plugin": "^1.1.2",
|
62
|
+
"@rspack/core": "^1.3.10",
|
63
|
+
"@rspack/dev-server": "^1.1.1",
|
64
|
+
"@rspack/plugin-react-refresh": "^1.4.3",
|
65
|
+
"@swc/helpers": "^0.5.17",
|
54
66
|
"@types/babel__core": "^7.20.5",
|
55
67
|
"babel-loader": "^10.0.0",
|
56
68
|
"better-opn": "^3.0.2",
|
@@ -105,7 +117,7 @@
|
|
105
117
|
"react": "19.1.0",
|
106
118
|
"rimraf": "6.0.1",
|
107
119
|
"vite-tsconfig-paths": "5.1.4",
|
108
|
-
"vitest": "3.1.
|
120
|
+
"vitest": "3.1.4",
|
109
121
|
"vue-loader": "17.4.2"
|
110
122
|
},
|
111
123
|
"peerDependencies": {
|
@@ -1 +0,0 @@
|
|
1
|
-
import{posix}from"node:path";import{devReactFastRefresh}from"../constants.js";import{shouldEnableReactFastRefresh}from"../helpers/should-enable-react-fast-refresh.js";import{createMinimizers}from"../minimizer/index.js";export const createOptimization=(e,i,n)=>({nodeEnv:e?"development":"production",chunkIds:"named",moduleIds:"named",runtimeChunk:!!shouldEnableReactFastRefresh(e,n,i)&&{name:e=>posix.join(e.name,devReactFastRefresh.runtime)},minimize:!1!==i.webpack?.minimizer&&!e,minimizer:createMinimizers(e,i.webpack),splitChunks:{name:!1,chunks:"all",minSize:25e5,cacheGroups:{default:!1,defaultVendors:!1}}});
|
@@ -1 +0,0 @@
|
|
1
|
-
import{join}from"node:path";import{enableBundleHashNameForModule}from"../helpers/enable-bundle-hashname-for-module.js";import{getBundleFileName}from"../helpers/get-bundle-file-name.js";import{resolvePublicPath}from"./resolve-public-path.js";export const createOutput=async(e,o,t)=>{const{projectCwd:n,webpack:a}=o,l=t[1],i=enableBundleHashNameForModule(o,l?.options),u=resolvePublicPath(o),p="function"==typeof a?.outputDir?await a.outputDir():a?.outputDir||"public";return{devtoolModuleFilenameTemplate:({namespace:e,resourcePath:o})=>`webpack:///${join(e,o)}`,environment:{},pathinfo:!1,path:join(n,p),publicPath:u,filename:`[name]/${getBundleFileName("js",e,i)}`,chunkFilename:i?"[id].[contenthash].js":"[id].js",...l.options?.output}};
|
@@ -1,5 +0,0 @@
|
|
1
|
-
import type { FlatCliOptions } from '../types/types-cli-options.js';
|
2
|
-
import { type EntryMapItem } from '../types/types-entry-map.js';
|
3
|
-
import { type FlatEvolveOptions } from '../types/types-options.js';
|
4
|
-
import { type FlatEvolveWebpackOptions } from '../types/types-webpack.js';
|
5
|
-
export declare const createPlugins: (serveMode: boolean, entryMapItemList: EntryMapItem[], evolveOptions: FlatEvolveOptions, cliOptions?: FlatCliOptions) => Promise<FlatEvolveWebpackOptions["plugins"]>;
|
@@ -1 +0,0 @@
|
|
1
|
-
import CaseSensitivePathsPlugin from"case-sensitive-paths-webpack-plugin";import MiniCssExtractPlugin from"mini-css-extract-plugin";import webpack from"webpack";import{logger}from"@flatjs/common";import ReactRefreshWebpackPlugin from"@pmmmwh/react-refresh-webpack-plugin";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{createCircularDependencyPlugin}from"../plugins/circular-dependency/index.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";import{createStatsWebpackPlugin}from"../plugins/stats-webpack/index.js";export const createPlugins=async(e,a,i,n)=>{const r=a[0],[l,t]=r,s=enableBundleHashNameForModule(i,t?.options),c=[new webpack.WatchIgnorePlugin({paths:[/\.d\.[cm]ts$/]}),new CaseSensitivePathsPlugin,...createCircularDependencyPlugin(e,i),new MiniCssExtractPlugin({filename:`[name]/${getBundleFileName("css",e,s)}`,chunkFilename:s?"[id].[contenthash].css":"[id].css"}),...await createBuiltinDefineVariables(e,i),...createCleanWebpackPlugin(e,a,i),...createModuleFederationPlugin(e,a,i),...createHtmlPlugins(e,a,i),...createStatsWebpackPlugin(e,i,n)],o=shouldEnableReactFastRefresh(e,r,i);o&&c.push(new ReactRefreshWebpackPlugin({overlay:!1})),!o&&e&&(i.devServer?.liveReload?logger.warn('The HMR disabled cause of "liveReload" specificed'):logger.warn(`The HMR disabled cause of \`"moduleFederation":"${l}"\``));const u=i.webpack?.plugins||[];return c.concat(u)};
|
@@ -1 +0,0 @@
|
|
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=e[0],t=[ruleSvgIcon(),ruleAssets(e,r),ruleCss(s,l,r,!1),ruleCss(s,l,r,!0),ruleLess(s,l,r),ruleScripts(s,l,r)],u=r.webpack?.ruleSets||[];return t.concat(u)};
|
@@ -1 +0,0 @@
|
|
1
|
-
import fg from"fast-glob";import{existsSync}from"node:fs";import{posix}from"node:path";import{logger}from"@flatjs/common";import{normalizeEntryModuleAbsolutePath}from"../helpers/normalize-entry-module-absolute-path.js";export const loadWatchOptions=(o,t,e={})=>{const{ignored:r=[]}=e,{entryMap:n}=t,s=normalizeEntryModuleAbsolutePath(t,o),a=normalizeEntryModuleAbsolutePath(t,n);for(const o of a){existsSync(o)||logger.warn(`The module path does not exist. Check ${o}`);s.findIndex((t=>t===o))<0&&r.push(posix.join("**",fg.convertPathToPattern(o),"**/*"))}return{...e,ignored:r}};
|
@@ -1 +0,0 @@
|
|
1
|
-
import{assertGroupEntryItem}from"../helpers/assert-group-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";import{loadWatchOptions}from"./load-watch-options.js";export const loadWebpackConfig=async(e,t,r,a)=>{const o="development"===e,{projectCwd:s,webpack:c,devServer:n}=r,p=loadWatchOptions(t,r,n?.watchOptions),i=assertGroupEntryItem(t,r),m=createRuleSets(o,i,r),l=await createPlugins(o,i,r,a),u=i[0];return{mode:e,plugins:l,watchOptions:p,output:await createOutput(o,r,u),context:s,target:c?.target??["web","es5"],resolve:createResolve(s,c),module:{rules:m},devtool:o?"eval-source-map":c?.sourceMap||!1,externalsType:c?.externalsType,externals:createExternals(c?.externals,u),performance:createPerformance(o,c?.performance),optimization:createOptimization(o,r,u),infrastructureLogging:c?.infrastructureLogging??{level:"warn"},stats:c?.stats??{preset:"errors-warnings"},cache:{type:"memory"}}};
|
@@ -1 +0,0 @@
|
|
1
|
-
import{dirname,join,relative,resolve}from"node:path";import{ensureSlash,normalizePlatformPath}from"@flatjs/common";import{resolvePublicPath}from"../resolve-public-path.js";import{FONT_PATH_REGEX,IMAGE_PATH_REGEX}from"./constants.js";import{isIconSvg}from"./rule-utils.js";const getEntryAssetFileName=(e,t,r)=>{const{projectCwd:o,projectVirtualPath:n}=r;let s=dirname(join(n,e.replace(/^src/,"")));const a=[];for(const[e,r]of t)for(const t of r.entry)a.push({entryName:e,entry:t});a.sort(((e,t)=>t.entry.length-e.entry.length));for(const t of a){const{entryName:r,entry:n}=t,a=dirname(join(o,n)),i=resolve(o,e);if(i.startsWith(ensureSlash(a,!0,!0))){s=dirname(join(r,relative(a,i)));break}}return`${normalizePlatformPath(s)}/[name]-[contenthash:8][ext]`};export const ruleAssets=(e,t)=>{const r=resolvePublicPath(t);return{type:"asset",test:e=>FONT_PATH_REGEX.test(e)||IMAGE_PATH_REGEX.test(e)&&!isIconSvg(e),generator:{filename:({filename:r})=>getEntryAssetFileName(r,e,t),publicPath:"auto"===r?void 0:r},parser:{dataUrlCondition:{maxSize:t.loaderOptions.assetDataUrlMaxSize}}}};
|
@@ -1 +0,0 @@
|
|
1
|
-
import cssnano from"cssnano";import MiniCssExtractPlugin from"mini-css-extract-plugin";import{requireResolve}from"@flatjs/common";import{forgePostcssPluginPixel}from"@flatjs/forge-postcss-plugin-pixel";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,{modules:n,...p}=i,c=r?{modules:Object.assign({namedExport:!1},n)}:{modules:!1},u={test:/\.css$/i,use:[{loader:MiniCssExtractPlugin.loader,options:{esModule:!0}},{loader:requireResolve(import.meta.url,"css-loader"),options:{sourceMap:s,...c,...p}}]};r?u.include=/\.module\.css$/i:u.exclude=/\.module\.css$/i;const a=allowPx2remForModule(o,e);if(Array.isArray(u.use)){const o=getPostcssOptions(s,!!a&&t,l);u.use.push({loader:requireResolve(import.meta.url,"postcss-loader"),options:{postcssOptions:{...o,config:!1},sourceMap:s}})}return u};
|
@@ -1 +0,0 @@
|
|
1
|
-
import{requireResolve}from"@flatjs/common";import{ruleCss}from"./rule-css.js";export const ruleLess=(s,e,r)=>{const o=ruleCss(s,e,r);o.test=/\.less$/i;const t=r.loaderOptions.lessOptions;return Array.isArray(o.use)&&o.use.push({loader:requireResolve(import.meta.url,"less-loader"),options:{sourceMap:s,lessOptions:{sourceMap:s,javascriptEnabled:!0,...t}}}),o};
|
@@ -1 +0,0 @@
|
|
1
|
-
import{requireResolve}from"@flatjs/common";import{mergeBabelOption}from"../../helpers/merge-babel-options.js";import{shouldEnableReactFastRefresh}from"../../helpers/should-enable-react-fast-refresh.js";export const ruleBabel=e=>({test:/\.(tsx|ts|js|jsx|mjs|cjs|mts|cts)$/,use:[{loader:requireResolve(import.meta.url,"babel-loader"),options:e}]});export const ruleScripts=(e,r,s)=>{const{projectCwd:t}=s,{babelOptions:o={},modularImports:l=[]}=s.loaderOptions,a=mergeBabelOption(e,l,o,t);return shouldEnableReactFastRefresh(e,r,s)&&(a.plugins?a.plugins.push(requireResolve(import.meta.url,"react-refresh/babel")):a.plugins=[requireResolve(import.meta.url,"react-refresh/babel")]),ruleBabel(a)};
|
@@ -1 +0,0 @@
|
|
1
|
-
import{getDirname}from"@armit/file-utility";import{isIconSvg}from"./rule-utils.js";export const ruleSvgIcon=()=>({test:e=>isIconSvg(e),use:[{loader:getDirname(import.meta.url,"../../loaders/loader-icon.cjs"),options:{svgo:{plugins:[{name:"removeTitle"},{name:"removeDimensions"}]}}}]});
|