@moneko/core 3.7.0 → 3.8.0
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/lib/common.js +1 -1
- package/lib/config.js +1 -1
- package/lib/module.config.js +1 -1
- package/lib/plugin/override-resolve.d.ts +26 -0
- package/lib/plugin/override-resolve.js +1 -0
- package/lib/polyfills/replace-children.js +1 -1
- package/lib/reactive-object.d.ts +1 -0
- package/lib/reactive-object.js +1 -1
- package/package.json +2 -2
- package/typings/global.d.ts +26 -2
- package/lib/loader/override.cjs +0 -1
- package/lib/loader/override.d.cts +0 -6
package/lib/common.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"add-asset-html-webpack-plugin";import t from"html-webpack-plugin";import o from"webpack";import r from"webpackbar";import{CONFIG as l,PUBLICPATH as s}from"./config.js";import
|
|
1
|
+
import e from"add-asset-html-webpack-plugin";import t from"html-webpack-plugin";import o from"webpack";import r from"webpackbar";import{CONFIG as l,PUBLICPATH as s}from"./config.js";import n from"./html-plugin-option.js";import{moduleFederation as a}from"./module-federation.js";import i from"./module.config.js";import p,{CUSTOMCONFIG as m}from"./paths.js";import c from"./plugin/add-entry-attribute.js";import u from"./plugin/override-resolve.js";import f from"./plugin/virtual-module.js";import{PACKAGENAME as h,PACKAGEVERSION as d,isDev as b,isLibrary as g,isMicro as y}from"./process-env.js";import{resolveNodeModulesPath as j,resolveProgramPath as w}from"./utils.js";import v from"./virtual-modules.js";let{AutomaticPrefetchPlugin:k,DefinePlugin:x,SourceMapDevToolPlugin:C,WatchIgnorePlugin:$}=o,O=l.assetHtml.map(e=>({publicPath:"",...e}));export const outputConfig={path:w(g?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:`js/[${b?"name":"chunkhash"}].js`,assetModuleFilename:e=>{let t=e.filename;return t&&t.endsWith("?url")&&/(?:webworker|worker)(\.|\b).*\.(js|ts)\b/.test(t.replace("?url",""))?"worker/[name][ext]":"assets/[name][hash][ext]"},library:{name:h,type:"window"},globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${h}`,pathinfo:b,clean:!0,publicPath:s,asyncChunks:!0,charset:!0};let P={main:j("@app/entry")};l.polyfill&&Object.assign(P,{"dom-polyfills":[`${p.corePath}/polyfills/replace-children.js`]}),l.entry&&("string"==typeof l.entry?P={main:l.entry}:Object.keys(l.entry)&&Object.assign(P,l.entry)),l.output&&("string"==typeof l.output?outputConfig.path=l.output:Object.keys(l.output)&&Object.assign(outputConfig,l.output));let M=l.basename.split("/").filter(Boolean).length,B=`${Array(M).fill("..").join("/")+(M?"/":"")}404.html`,{pathSegmentsToKeep:D=M,path:R=B}=l.fixBrowserRouter||{},A=!1;l.cacheDirectory&&(A={type:"filesystem",store:"pack",allowCollectingMemory:!0,cacheDirectory:l.cacheDirectory,memoryCacheUnaffected:!0,name:`${m||"default"}-${b?"development":"production"}`,version:d});export const clientConfig={entry:P,stats:"errors-only",cache:A,infrastructureLogging:{level:"error"},target:"web",externalsPresets:l.externalsPresets,plugins:[new f(v),new k,...a,l.htmlPluginOption&&new t(n),l.fixBrowserRouter&&new t({filename:R,inject:!1,templateContent:()=>`<html lang="en"><head><title>${n.title}</title><script>const pathKeep = ${D||M};const l = window.location;l.replace(l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') + l.pathname.split('/').slice(0, 1 + pathKeep).join('/') + '/?/' + l.pathname.slice(1).split('/').slice(pathKeep).join('/').replace(/&/g, '~and~') + (l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') + l.hash);</script></head><body></body></html>`}),new e(O),y&&new c(e=>!!(e.match(/main\.(.*)\.bundle.js$/)||e.match("main.bundle.js"))),new x({"process.env":JSON.stringify(l.env)}),new $({paths:[/\.d\.ts$/]}),l.sourceMap&&new C(l.sourceMap),l.bar&&new r(l.bar),...l.plugins].filter(e=>!!e),experiments:{topLevelAwait:!0,asyncWebAssembly:!0,cacheUnaffected:!0,layers:!0,lazyCompilation:b&&{imports:!1,entries:!1},buildHttp:l.buildHttp,backCompat:!0,futureDefaults:!1,css:!1,outputModule:!1},resolve:{extensions:[".tsx",".ts",".js",".jsx"],alias:l.alias,plugins:[l.overrideResolve&&new u({original:l.alias["@"],override:m&&w(m),...l.overrideResolve}),...l.resolvePlugins].filter(Boolean),fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},module:i,externals:l.externals,output:outputConfig};
|
package/lib/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{accessSync as e,constants as t}from"fs";import o from"chalk";import{merge as s}from"webpack-merge";import i,{CUSTOMCONFIG as a}from"./paths.js";import{PACKAGENAME as n,coreName as r,isLibrary as l,isMobile as c,jsxImportSource as m,mainDirectory as p}from"./process-env.js";import{isFunction as u,log as h,readConf as d,resolveProgramPath as f}from"./utils.js";let g=["@moneko","neko-ui","antd","@antv","katex","font-pingfang-sc","font-pingfang-tc","react-photo-view","react-markdown-editor-lite","schema-design","@app",".cache/http/data"],P={seo:!1,mode:"csr",compiler:"swc",bundleAnalyzer:!1,polyfill:!1,entry:{},minifier:{js:{},css:{}},sourceMap:{filename:"[file].map",publicPath:""},env:{NODE_ENV:process.env.NODE_ENV},basename:"/",publicPath:"/",rem:{designSize:c?375:1680},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{"@":f(p)},moduleRules:[],prefixJsLoader:[],cssModules:[],importOnDemand:{},proxy:[],cacheDirectory:i.webpackCachePath,devServer:{allowedHosts:[".baidu.com"],host:"localhost",port:3e3,https:!1,compress:!1},htmlPluginOption:{template:`node_modules/${r}/template/index.html`,favicon:`node_modules/${r}/template/favicon.ico`,tags:[]},assetHtml:[],routerMode:"browser",fixBrowserRouter:!1,plugins:[],splitChunk:{chunks:"all",minSize:1024,minChunks:1,cacheGroups:{route:{test:/[\\/].git[\\/]router/,priority:-10,reuseExistingChunk:!0,name:"route"},example:{test:/[\\/].git[\\/]example/,priority:-10,reuseExistingChunk:!0,name:"example"}}},runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:g,js:g,media:g,font:g,wasm:[]},mdx:{jsxImportSource:m,useDynamicImport:!0,remarkPlugins:[],rehypePlugins:[]},jsxDomExpressions:{moduleName:"solid-js/web",builtIns:["For","Show","Switch","Match","Suspense","SuspenseList","Portal","Index","Dynamic","ErrorBoundary"],contextToCustomElements:!0,wrapConditionals:!0,generate:"dom",hydratable:!1},bar:{name:"Client",color:"#6f42c1"},virtualModule:{},normalizeCss:!0,externalsPresets:{},buildHttp:{allowedUris:[],lockfileLocation:`${i.httpCachePath}/http.lock`,cacheLocation:`${i.httpCachePath}/data`,upgrade:!0}};l&&(P.alias=Object.assign(P.alias,{"@pkg":i.componentsPath,[n]:i.componentsPath}));let x=P,C={},w={};try{e(i.configPath,t.R_OK);let o=(await d(i.configPath,"index")).default;C=u(o)?o(process):o}catch(e){h(o.red(e))}if(a)try{e(i.customConfigPath,t.R_OK);let o=(await d(i.customConfigPath,a)).default;w=u(o)?o(process):o}catch(e){h(o.red(e))}"tsc"===(x=s(x,C,w)).compiler&&x.minifier&&(x.minifier.js||Object.assign(x.minifier,{js:{type:"terser"}}),x.minifier.css||Object.assign(x.minifier,{css:{type:"cssnano"}})),!1===x.devtool&&(x.sourceMap=!1),!1===x.sourceMap&&(x.devtool=!1),x.fixBrowserRouter&&x.htmlPluginOption&&(x.htmlPluginOption.tags||(x.htmlPluginOption.tags=[]),x.htmlPluginOption.tags.push({textContent:"(function(l) {if (l.search[1] === '/' ) {var decoded = l.search.slice(1).split('&').map(function(s) {return s.replace(/~and~/g, '&')}).join('?');window.history.replaceState(null, null,l.pathname.slice(0, -1) + decoded + l.hash);}}(window.location))"}));export const CONFIG=x;export const PUBLICPATH=CONFIG.publicPath||"/";global.NEKOCLICONFIG={CONFIG,CUSTOMCONFIG:a,log:h};
|
|
1
|
+
import{accessSync as e,constants as t}from"fs";import o from"chalk";import{merge as s}from"webpack-merge";import i,{CUSTOMCONFIG as a}from"./paths.js";import{PACKAGENAME as n,coreName as r,isLibrary as l,isMobile as c,jsxImportSource as m,mainDirectory as p}from"./process-env.js";import{isFunction as u,log as h,readConf as d,resolveProgramPath as f}from"./utils.js";let g=["@moneko","neko-ui","antd","@antv","katex","font-pingfang-sc","font-pingfang-tc","react-photo-view","react-markdown-editor-lite","schema-design","@app",".cache/http/data"],P={seo:!1,mode:"csr",compiler:"swc",bundleAnalyzer:!1,polyfill:!1,entry:{},minifier:{js:{},css:{}},sourceMap:{filename:"[file].map",publicPath:""},env:{NODE_ENV:process.env.NODE_ENV},basename:"/",publicPath:"/",rem:{designSize:c?375:1680},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{"@":f(p)},moduleRules:[],prefixJsLoader:[],cssModules:[],importOnDemand:{},proxy:[],cacheDirectory:i.webpackCachePath,devServer:{allowedHosts:[".baidu.com"],host:"localhost",port:3e3,https:!1,compress:!1},htmlPluginOption:{template:`node_modules/${r}/template/index.html`,favicon:`node_modules/${r}/template/favicon.ico`,tags:[]},assetHtml:[],routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:{chunks:"all",minSize:1024,minChunks:1,cacheGroups:{route:{test:/[\\/].git[\\/]router/,priority:-10,reuseExistingChunk:!0,name:"route"},example:{test:/[\\/].git[\\/]example/,priority:-10,reuseExistingChunk:!0,name:"example"}}},runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:g,js:g,media:g,font:g,wasm:[]},mdx:{jsxImportSource:m,useDynamicImport:!0,remarkPlugins:[],rehypePlugins:[]},jsxDomExpressions:{moduleName:"solid-js/web",builtIns:["For","Show","Switch","Match","Suspense","SuspenseList","Portal","Index","Dynamic","ErrorBoundary"],contextToCustomElements:!0,wrapConditionals:!0,generate:"dom",hydratable:!1},bar:{name:"Client",color:"#6f42c1"},virtualModule:{},normalizeCss:!0,externalsPresets:{},buildHttp:{allowedUris:[],lockfileLocation:`${i.httpCachePath}/http.lock`,cacheLocation:`${i.httpCachePath}/data`,upgrade:!0}};l&&(P.alias=Object.assign(P.alias,{"@pkg":i.componentsPath,[n]:i.componentsPath}));let x=P,C={},w={};try{e(i.configPath,t.R_OK);let o=(await d(i.configPath,"index")).default;C=u(o)?o(process):o}catch(e){h(o.red(e))}if(a)try{e(i.customConfigPath,t.R_OK);let o=(await d(i.customConfigPath,a)).default;w=u(o)?o(process):o}catch(e){h(o.red(e))}"tsc"===(x=s(x,C,w)).compiler&&x.minifier&&(x.minifier.js||Object.assign(x.minifier,{js:{type:"terser"}}),x.minifier.css||Object.assign(x.minifier,{css:{type:"cssnano"}})),!1===x.devtool&&(x.sourceMap=!1),!1===x.sourceMap&&(x.devtool=!1),x.fixBrowserRouter&&x.htmlPluginOption&&(x.htmlPluginOption.tags||(x.htmlPluginOption.tags=[]),x.htmlPluginOption.tags.push({textContent:"(function(l) {if (l.search[1] === '/' ) {var decoded = l.search.slice(1).split('&').map(function(s) {return s.replace(/~and~/g, '&')}).join('?');window.history.replaceState(null, null,l.pathname.slice(0, -1) + decoded + l.hash);}}(window.location))"}));export const CONFIG=x;export const PUBLICPATH=CONFIG.publicPath||"/";global.NEKOCLICONFIG={CONFIG,CUSTOMCONFIG:a,log:h};
|
package/lib/module.config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"mini-css-extract-plugin";import s from"mini-svg-data-uri";import{CONFIG as t,PUBLICPATH as o}from"./config.js";import{hasPkg as r}from"./has-pkg.js";import a from"./modify-vars.js";import l,{CUSTOMCONFIG as i}from"./paths.js";import{FRAMEWORK as n,isDev as c,isLibrary as
|
|
1
|
+
import e from"mini-css-extract-plugin";import s from"mini-svg-data-uri";import{CONFIG as t,PUBLICPATH as o}from"./config.js";import{hasPkg as r}from"./has-pkg.js";import a from"./modify-vars.js";import l,{CUSTOMCONFIG as i}from"./paths.js";import{FRAMEWORK as n,isDev as c,isLibrary as m,isMicro as d}from"./process-env.js";import p from"./swcrc.js";import u from"./tsloader.config.js";import{resolveNodeModulesPath as f,resolveProgramPath as y}from"./utils.js";let x={loader:`${l.corePath}/loader/css-unicode.cjs`},$=d?o:"../",g={loader:e.loader,options:{publicPath:"/"!==$?$:"../"}},j=r("@moneko/postcss")&&{loader:"postcss-loader",options:{postcssOptions:(await import("@moneko/postcss")).default}};c&&(g="style-loader");let w=[...t.cssModules,`@moneko/${n}`,"neko-ui"].map(f),v=[...["src/styles/variables.less","src/styles/mixins.less","site/styles/variables.less","site/styles/mixins.less"].map(y)],b=["components","example","mock","site","src","server"].map(y);i&&b.push(y(i));let h={loader:"css-loader",options:{modules:{auto:e=>{for(let s=0,t=w.length;s<t;s++)if(e&&e?.includes(w[s]))return/(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i.test(e);return/(^(?!.*node_modules))(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i.test(e)},localIdentName:"[path][name]__[local]",exportLocalsConvention:"dashesOnly"},importLoaders:2}},k=c&&{loader:"@teamsupercell/typings-for-css-modules-loader",options:{verifyOnly:!c}},O=[g,k,h,j,x,{loader:"less-loader",options:{sourceMap:!!t.sourceMap,lessOptions:{modifyVars:a,javascriptEnabled:!0}}},{loader:"style-resources-loader",options:{patterns:v}}].filter(Boolean),B="tsc"===t.compiler,L={loader:B?"ts-loader":"swc-loader",options:B?u:p(c)};function P(e){return b.concat(t.rulesInclude?.[e]?.map(f)||[])}let M=P("media"),_={rules:[m&&{test:/\.mdx?$/i,include:[l.componentsPath],exclude:[/(.+)\/examples\/(.+).mdx?$/i],enforce:"pre",use:[{loader:`${l.corePath}/loader/frontmatter.cjs`}]},{oneOf:[{resourceQuery:/raw/i,type:"asset/source"},{resourceQuery:/url/i,type:"asset/resource",generator:{filename:e=>{let s=e.filename;return s&&s.endsWith("wasm?url")?"wasm/[name][ext]":"assets/[name][ext]"}}},{test:/\.wasm$/i,type:"webassembly/async",include:P("wasm")},{test:/\.txt$/i,type:"asset/source"},{test:/\.ico$/i,type:"asset/inline",include:M},{test:/\.svg$/i,type:"asset/inline",generator:{dataUrl:e=>s(e.toString())},include:M},{test:/\.(gif|png|jpe?g|webp)$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/images/[name][ext]"},include:M},{test:/\.(webm|mp4|ogv)$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/video/[name][ext]"},include:M},{test:/\.(woff2?|eot|ttf|otf)(\?.*)?$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/fonts/[name][ext]"},include:P("font")},{test:/\.(sa|sc)ss$/i,use:[g,k,h,j,x,{loader:"sass-loader",options:{implementation:await import("sass"),sassOptions:{}}}].filter(Boolean),include:P("css")},{test:/\.less$/i,use:O,include:P("css")},{test:/\.css$/i,use:[g,"css-loader",j,x].filter(Boolean),include:P("css")},{test:/\.(cj|mj|t|j)s(|x)$/i,use:[...t.prefixJsLoader,L].filter(Boolean),include:P("js")},{test:/\.mdx?$/i,use:[...t.prefixJsLoader,L,{loader:"@mdx-js/loader",options:t.mdx}].filter(Boolean),include:b,exclude:[/(.+)\/examples\/(.+).mdx?$/i]},{test:/\.mdx?$/i,type:"asset/source",include:[/(.+)\/examples\/(.+).mdx?$/i]},{type:"asset/source",include:[/(.+)\/examples\/(.+).*?$/i]}]},...t.moduleRules].filter(e=>"object"==typeof e)};export default _;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Resolver } from 'webpack';
|
|
2
|
+
export interface OverrideResolverOption {
|
|
3
|
+
/** 源文件夹地址
|
|
4
|
+
* @default src 默认
|
|
5
|
+
* @default site 组件库
|
|
6
|
+
*/
|
|
7
|
+
original?: string;
|
|
8
|
+
/** 用于覆盖的文件夹地址
|
|
9
|
+
* @default CUSTOMCONFIG 启动命令的 config 值
|
|
10
|
+
* // 当运行下面的命令启动时
|
|
11
|
+
* @example
|
|
12
|
+
* ```sh
|
|
13
|
+
* npm run start --config=fix-1131
|
|
14
|
+
* # or
|
|
15
|
+
* yarn start config=fix-1131
|
|
16
|
+
* ```
|
|
17
|
+
* override 默认为 config 的值, 即 fix-1131 目录
|
|
18
|
+
*/
|
|
19
|
+
override?: string;
|
|
20
|
+
}
|
|
21
|
+
declare class OverrideResolverPlugin {
|
|
22
|
+
private readonly options;
|
|
23
|
+
constructor(options: Required<OverrideResolverOption>);
|
|
24
|
+
apply(resolver: Resolver): void;
|
|
25
|
+
}
|
|
26
|
+
export default OverrideResolverPlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as e}from"fs";import{relative as t}from"path";import r from"../paths.js";export default class{constructor(e){this.options=e}apply(a){let{override:i,original:o}=this.options;if(i&&o){let s=`./${t(r.programPath,o)}`,l=`./${t(r.programPath,i)}`;a.getHook("file").tapAsync("OverrideResolverPlugin",(t,r,p)=>{let h=t.request||t.path;if(h&&h.startsWith(o)&&t.relativePath){let n=h.replace(o,i);if(e(n)){let e=t.relativePath.replace(s,l);return Object.assign(t,{path:n,relativePath:e,__innerRequest_relativePath:e,__innerRequest:e}),a.doResolve("resolved",t,`OverrideResolverPlugin 使用目标模块${i}`,r,p)}}return p()})}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(...t){let o=this,r=t.length,l=Array(r);for(let e=0;e<r;e++)l[e]=t[e];for(;o.firstChild;)o.removeChild(o.firstChild);l.forEach(function(e){"string"==typeof e?
|
|
1
|
+
function e(...t){let o=this,r=t.length,l=Array(r);for(let e=0;e<r;e++)l[e]=t[e];for(;o.firstChild;)o.removeChild(o.firstChild);l.forEach(function(e){o.appendChild("string"==typeof e?document.createTextNode(e):e)})}Element.prototype.replaceChildren||(Element.prototype.replaceChildren=e),ShadowRoot.prototype.replaceChildren||(ShadowRoot.prototype.replaceChildren=e);
|
package/lib/reactive-object.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ declare class WriteingReactiveObject<T extends object = Record<string, string |
|
|
|
5
5
|
constructor(props?: T);
|
|
6
6
|
setData(key: keyof T, value: T[keyof T]): void;
|
|
7
7
|
getData(key: keyof T): T[keyof T];
|
|
8
|
+
removeData(key: keyof T): void;
|
|
8
9
|
[Symbol.iterator](): Iterator<[keyof T, T[keyof T]]>;
|
|
9
10
|
}
|
|
10
11
|
export declare const vmWriteing: WriteingReactiveObject<Record<string, boolean>>;
|
package/lib/reactive-object.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"events";import{isDev as e}from"./process-env.js";class a extends t{constructor(t={}){super(),this.data=t}setData(t,a){e||a===this.data[t]||(this.data[t]=a,this.emit("change",t,a))}getData(t){return this.data[t]}[Symbol.iterator](){let t=Object.keys(this.data),e=0;return{next:()=>{if(e<t.length){let a=t[e++];return{value:[a,this.data[a]],done:!1}}return{value:void 0,done:!0}}}}}export const vmWriteing=new a({done:!0});export default class extends a{constructor(t={}){super(),this.data=t}setData(t,e){e!==this.data[t]&&(this.data[t]=e,vmWriteing.setData(t,!0),this.emit("change",t,e))}}
|
|
1
|
+
import t from"events";import{isDev as e}from"./process-env.js";class a extends t{constructor(t={}){super(),this.data=t}setData(t,a){e||a===this.data[t]||(this.data[t]=a,this.emit("change",t,a))}getData(t){return this.data[t]}removeData(t){Object.prototype.hasOwnProperty.call(this.data,t)&&(delete this.data[t],this.emit("change",t,null))}[Symbol.iterator](){let t=Object.keys(this.data),e=0;return{next:()=>{if(e<t.length){let a=t[e++];return{value:[a,this.data[a]],done:!1}}return{value:void 0,done:!0}}}}}export const vmWriteing=new a({done:!0});export default class extends a{constructor(t={}){super(),this.data=t}setData(t,e){e!==this.data[t]&&(this.data[t]=e,vmWriteing.setData(t,!0),this.emit("change",t,e))}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@mdx-js/loader": "3.0.0",
|
|
16
|
-
"@swc/core": "1.3.
|
|
16
|
+
"@swc/core": "1.3.96",
|
|
17
17
|
"@swc/css": "0.0.28",
|
|
18
18
|
"@swc/helpers": "0.5.3",
|
|
19
19
|
"@teamsupercell/typings-for-css-modules-loader": "2.5.2",
|
package/typings/global.d.ts
CHANGED
|
@@ -2,13 +2,20 @@ import { Options as AssetHtmlOptions } from 'add-asset-html-webpack-plugin';
|
|
|
2
2
|
import { Options as HtmlWebpackPluginOptions } from 'html-webpack-plugin';
|
|
3
3
|
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
|
|
4
4
|
import WebpackBar from 'webpackbar';
|
|
5
|
-
import DoneWebpackPlugin from '../lib/done';
|
|
5
|
+
import DoneWebpackPlugin from '../lib/plugin/done';
|
|
6
|
+
import type { OverrideResolverOption } from '../lib/plugin/override-resolve';
|
|
6
7
|
import type { Options as MDXOptions } from '@mdx-js/loader';
|
|
7
8
|
import type { JsMinifyOptions, Config as SwcConfig } from '@swc/core';
|
|
8
9
|
import type { CssNanoOptionsExtended } from 'css-minimizer-webpack-plugin';
|
|
9
10
|
import type { MinifyOptions } from 'terser';
|
|
10
11
|
import type { Options } from 'ts-import-plugin';
|
|
11
|
-
import type {
|
|
12
|
+
import type {
|
|
13
|
+
Configuration,
|
|
14
|
+
ExternalsPresets,
|
|
15
|
+
ResolvePluginInstance,
|
|
16
|
+
RuleSetRule,
|
|
17
|
+
WebpackPluginInstance,
|
|
18
|
+
} from 'webpack';
|
|
12
19
|
import type {
|
|
13
20
|
Configuration as DevServerConfiguration,
|
|
14
21
|
ProxyArray,
|
|
@@ -226,6 +233,23 @@ export declare type ConfigType<T extends 'tsc' | 'swc' = 'swc'> = {
|
|
|
226
233
|
};
|
|
227
234
|
/** webpack 插件 */
|
|
228
235
|
plugins: WebpackPluginInstance[];
|
|
236
|
+
/** resolve 插件 */
|
|
237
|
+
resolvePlugins: ResolvePluginInstance[];
|
|
238
|
+
/** 覆盖解析插件配置, 当设置为 `{}` 时为启用
|
|
239
|
+
* @default false
|
|
240
|
+
* @example
|
|
241
|
+
* import { resolveProgramPath } from '@moneko/core';
|
|
242
|
+
*
|
|
243
|
+
* // 此时当 src 和 src-test 目录下有相同相对路径的文件时,
|
|
244
|
+
* // 将优先使用 src-test 下的文件进行解析
|
|
245
|
+
* const conf = {
|
|
246
|
+
* overrideResolve: {
|
|
247
|
+
* original: resolveProgramPath('src'),
|
|
248
|
+
* override: resolveProgramPath('src-test'),
|
|
249
|
+
* }
|
|
250
|
+
* }
|
|
251
|
+
*/
|
|
252
|
+
overrideResolve: OverrideResolverOption | false;
|
|
229
253
|
/** 对生产chunk进行拆分 */
|
|
230
254
|
splitChunk?: false | OptimizationSplitChunksOptions;
|
|
231
255
|
/** 拆分 runtime 代码
|
package/lib/loader/override.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return t}});const e=require("fs");function t(t){let{original:s,override:r}=this.getOptions(),i=this.resourcePath.replace(s,r);if(this.resourcePath.startsWith(s)&&(0,e.existsSync)(i)){let t=this.async();(0,e.readFile)(i,{encoding:"utf-8"},(e,s)=>{t(null,s)})}else this.callback(null,t)}
|