@moneko/core 3.4.0 → 3.5.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 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 s,PUBLICPATH as l}from"./config.js";import n from"./done.js";import a from"./html-add-entry-attr.js";import i from"./html-plugin-option.js";import{moduleFederation as p}from"./module-federation.js";import m from"./module.config.js";import c,{CUSTOMCONFIG as u}from"./paths.js";import{PACKAGENAME as f,PACKAGEVERSION as h,isDev as d,isLibrary as b,isMicro as y}from"./process-env.js";import{seo as j}from"./seo.js";import{resolveNodeModulesPath as g,resolveProgramPath as w}from"./utils.js";import k from"./virtual-module-plugin.js";import x from"./virtual-modules.js";let{AutomaticPrefetchPlugin:C,DefinePlugin:v,SourceMapDevToolPlugin:$,WatchIgnorePlugin:O}=o,P=s.assetHtml.map(e=>({publicPath:"",...e}));export const outputConfig={path:w(b?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:`js/[${d?"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:f,type:"window"},globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${f}`,pathinfo:d,clean:!0,publicPath:l,asyncChunks:!0,charset:!0};let M={main:g("@app/entry")};s.polyfill&&Object.assign(M,{"dom-polyfills":[`${c.corePath}/polyfills/replace-children.js`]}),s.entry&&("string"==typeof s.entry?M={main:s.entry}:Object.keys(s.entry)&&Object.assign(M,s.entry)),s.output&&("string"==typeof s.output?outputConfig.path=s.output:Object.keys(s.output)&&Object.assign(outputConfig,s.output));let D=s.basename.split("/").filter(Boolean).length,A=`${Array(D).fill("..").join("/")+(D?"/":"")}404.html`,{pathSegmentsToKeep:B=D,path:H=A}=s.fixBrowserRouter||{},K=!1;s.cacheDirectory&&(K={type:"filesystem",store:"pack",allowCollectingMemory:!0,cacheDirectory:s.cacheDirectory,memoryCacheUnaffected:!0,name:`${u||"default"}-${d?"development":"production"}`,version:h});let L=[new C,...p,s.htmlPluginOption&&new t(i),s.fixBrowserRouter&&new t({filename:H,inject:!1,templateContent:()=>`<html lang="en"><head><title>${i.title}</title><script>const pathKeep = ${B||D};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(P),y&&new a(e=>!!(e.match(/main\.(.*)\.bundle.js$/)||e.match("main.bundle.js"))),new v({"process.env":JSON.stringify(s.env)}),new O({paths:[/\.d\.ts$/]}),s.sourceMap&&new $(s.sourceMap),s.bar&&new r(s.bar),new n({done:()=>{!d&&s.seo&&j(),s.done?.(),d||setTimeout(()=>{process.exit(0)},2e3)}}),new k(x),...s.plugins].filter(e=>!!e);export const clientConfig={entry:M,stats:"errors-only",cache:K,infrastructureLogging:{level:"error"},target:"web",externalsPresets:s.externalsPresets,plugins:L,experiments:{topLevelAwait:!0,asyncWebAssembly:!0,cacheUnaffected:!0,layers:!0,lazyCompilation:d&&{imports:!1,entries:!1},buildHttp:s.buildHttp,backCompat:!0,futureDefaults:!1,css:!1,outputModule:!1},resolve:{extensions:[".tsx",".ts",".js",".jsx"],alias:s.alias,fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},module:m,externals:s.externals,output:outputConfig};
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 s,PUBLICPATH as l}from"./config.js";import n from"./done.js";import a from"./html-add-entry-attr.js";import i from"./html-plugin-option.js";import{moduleFederation as p}from"./module-federation.js";import m from"./module.config.js";import c,{CUSTOMCONFIG as u}from"./paths.js";import{PACKAGENAME as f,PACKAGEVERSION as h,isDev as d,isLibrary as b,isMicro as y}from"./process-env.js";import{seo as j}from"./seo.js";import{resolveNodeModulesPath as g,resolveProgramPath as w}from"./utils.js";import k from"./virtual-module-plugin.js";import x from"./virtual-modules.js";let{AutomaticPrefetchPlugin:C,DefinePlugin:v,SourceMapDevToolPlugin:$,WatchIgnorePlugin:O}=o,P=s.assetHtml.map(e=>({publicPath:"",...e}));export const outputConfig={path:w(b?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:`js/[${d?"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:f,type:"window"},globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${f}`,pathinfo:d,clean:!0,publicPath:l,asyncChunks:!0,charset:!0};let M={main:g("@app/entry")};s.polyfill&&Object.assign(M,{"dom-polyfills":[`${c.corePath}/polyfills/replace-children.js`]}),s.entry&&("string"==typeof s.entry?M={main:s.entry}:Object.keys(s.entry)&&Object.assign(M,s.entry)),s.output&&("string"==typeof s.output?outputConfig.path=s.output:Object.keys(s.output)&&Object.assign(outputConfig,s.output));let D=s.basename.split("/").filter(Boolean).length,A=`${Array(D).fill("..").join("/")+(D?"/":"")}404.html`,{pathSegmentsToKeep:B=D,path:H=A}=s.fixBrowserRouter||{},K=!1;s.cacheDirectory&&(K={type:"filesystem",store:"pack",allowCollectingMemory:!0,cacheDirectory:s.cacheDirectory,memoryCacheUnaffected:!0,name:`${u||"default"}-${d?"development":"production"}`,version:h});export const clientConfig={entry:M,stats:"errors-only",cache:K,infrastructureLogging:{level:"error"},target:"web",externalsPresets:s.externalsPresets,plugins:[new C,...p,s.htmlPluginOption&&new t(i),s.fixBrowserRouter&&new t({filename:H,inject:!1,templateContent:()=>`<html lang="en"><head><title>${i.title}</title><script>const pathKeep = ${B||D};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(P),y&&new a(e=>!!(e.match(/main\.(.*)\.bundle.js$/)||e.match("main.bundle.js"))),new v({"process.env":JSON.stringify(s.env)}),new O({paths:[/\.d\.ts$/]}),s.sourceMap&&new $(s.sourceMap),s.bar&&new r(s.bar),new n({done:()=>{!d&&s.seo&&j(),s.done?.(),d||setTimeout(()=>{process.exit(0)},2e3)}}),new k(x),...s.plugins].filter(e=>!!e),experiments:{topLevelAwait:!0,asyncWebAssembly:!0,cacheUnaffected:!0,layers:!0,lazyCompilation:d&&{imports:!1,entries:!1},buildHttp:s.buildHttp,backCompat:!0,futureDefaults:!1,css:!1,outputModule:!1},resolve:{extensions:[".tsx",".ts",".js",".jsx"],alias:s.alias,fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},module:m,externals:s.externals,output:outputConfig};
package/lib/config.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  import type { ConfigType } from '.';
2
- export declare function initConfig(): Promise<void>;
3
2
  export declare const CONFIG: ConfigType;
4
3
  export declare const PUBLICPATH: string;
package/lib/config.js CHANGED
@@ -1 +1 @@
1
- import{accessSync as e,constants as t}from"fs";import o from"chalk";import{merge as i}from"webpack-merge";import s,{CUSTOMCONFIG as a}from"./paths.js";import{APPTYPE as n,PACKAGENAME as r,coreName as l,jsxImportSource as c}from"./process-env.js";import{isFunction as m,log as p,readConf as u,resolveProgramPath as d}from"./utils.js";let h=["@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"],f={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:"mobile"===n?375:1680},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:Object.assign({"@":d("src")},{library:{"@":d("site"),"@pkg":d("components"),[r]:d("components")},mobile:{},site:{},backstage:{},micro:{}}[n]),moduleRules:[],prefixJsLoader:[],cssModules:[],importOnDemand:{},proxy:[],cacheDirectory:s.webpackCachePath,devServer:{allowedHosts:[".baidu.com"],host:"localhost",port:3e3,https:!1,compress:!1},htmlPluginOption:{template:`node_modules/${l}/template/index.html`,favicon:`node_modules/${l}/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:h,js:h,media:h,font:h,wasm:[]},mdx:{jsxImportSource:c,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:`${s.httpCachePath}/http.lock`,cacheLocation:`${s.httpCachePath}/data`,upgrade:!0}},g=f,C={},x={};export async function initConfig(){g=f;try{e(s.configPath,t.R_OK);let o=(await u(s.configPath,"index")).default;C=m(o)?o(process):o}catch(e){p(o.red(e))}if(a)try{e(s.customConfigPath,t.R_OK);let o=(await u(s.customConfigPath,a)).default;x=m(o)?o(process):o}catch(e){p(o.red(e))}"tsc"===(g=i(g,C,x)).compiler&&g.minifier&&(g.minifier.js||Object.assign(g.minifier,{js:{type:"terser"}}),g.minifier.css||Object.assign(g.minifier,{css:{type:"cssnano"}})),!1===g.devtool&&(g.sourceMap=!1),!1===g.sourceMap&&(g.devtool=!1),g.fixBrowserRouter&&g.htmlPluginOption&&(g.htmlPluginOption.tags||(g.htmlPluginOption.tags=[]),g.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))"}))}await initConfig();export const CONFIG=g;export const PUBLICPATH=CONFIG.publicPath||"/";global.NEKOCLICONFIG={CONFIG,CUSTOMCONFIG:a,log:p};
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{APPTYPE as n,PACKAGENAME as r,coreName as l,jsxImportSource as c}from"./process-env.js";import{isFunction as m,log as p,readConf as u,resolveProgramPath as d}from"./utils.js";let h=["@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"],f={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:"mobile"===n?375:1680},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:Object.assign({"@":d("src")},{library:{"@":d("site"),"@pkg":d("components"),[r]:d("components")},mobile:{},site:{},backstage:{},micro:{}}[n]),moduleRules:[],prefixJsLoader:[],cssModules:[],importOnDemand:{},proxy:[],cacheDirectory:i.webpackCachePath,devServer:{allowedHosts:[".baidu.com"],host:"localhost",port:3e3,https:!1,compress:!1},htmlPluginOption:{template:`node_modules/${l}/template/index.html`,favicon:`node_modules/${l}/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:h,js:h,media:h,font:h,wasm:[]},mdx:{jsxImportSource:c,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}},g=f,b={},x={};try{e(i.configPath,t.R_OK);let o=(await u(i.configPath,"index")).default;b=m(o)?o(process):o}catch(e){p(o.red(e))}if(a)try{e(i.customConfigPath,t.R_OK);let o=(await u(i.customConfigPath,a)).default;x=m(o)?o(process):o}catch(e){p(o.red(e))}"tsc"===(g=s(g,b,x)).compiler&&g.minifier&&(g.minifier.js||Object.assign(g.minifier,{js:{type:"terser"}}),g.minifier.css||Object.assign(g.minifier,{css:{type:"cssnano"}})),!1===g.devtool&&(g.sourceMap=!1),!1===g.sourceMap&&(g.devtool=!1),g.fixBrowserRouter&&g.htmlPluginOption&&(g.htmlPluginOption.tags||(g.htmlPluginOption.tags=[]),g.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=g;export const PUBLICPATH=CONFIG.publicPath||"/";global.NEKOCLICONFIG={CONFIG,CUSTOMCONFIG:a,log:p};
package/lib/dev.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import{readdirSync as e}from"fs";import t from"chalk";import o from"webpack";import s from"webpack-dev-server";import{merge as r}from"webpack-merge";import{cleanDir as l}from"./cleanup.js";import{clientConfig as i}from"./common.js";import{CONFIG as n}from"./config.js";import{hasPkg as a}from"./has-pkg.js";import{getIPv4 as c,getPort as m}from"./net.js";import d from"./paths.js";import{hasEslintConfig as p,hasStylelintConfig as u,isReact as f}from"./process-env.js";import{isFunction as h,log as v,resolveProgramPath as w}from"./utils.js";let{HotModuleReplacementPlugin:g}=o,{yellow:j,green:y,grey:b,gray:k,bgBlue:x,bgGreenBright:S,blueBright:$,greenBright:C}=t,T=[".eslintrc.js",".eslintrc.json",".eslintrc.yaml",".eslintrc.json"],_=[".stylelintrc",".stylelintrc.json",".stylelintrc.yaml",".stylelintrc.yml",".stylelintrc.js","stylelint.config.js","stylelint.config.cjs"],A=e(d.programPath),D=!1,E=!1;for(let e=0,t=A.length;e<t;e++)_.includes(A[e])&&(E=!0),T.includes(A[e])&&(D=!0);D||(D=p),E||(E=u);let H=E?(await import("stylelint-webpack-plugin")).default:null,M=D?(await import("eslint-webpack-plugin")).default:null,O=n.devServer.port||3e3,P=await m(O,65535,n.devServer.host),J=a("@moneko/mock"),W=J&&(await import("@moneko/mock")).default,B=f&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,F=!1===n.devtool||n.devtool?n.devtool:"eval-cheap-module-source-map";n.devServer.port=P;let L="/"===n.basename,N=n.devServer.https?"https:":"http:",R=L?"":n.basename,Y=n.devServer.port!==P&&k(`Port ${j(O)} is in use, trying ${y(P)} instead.
2
2
  `);function q(e){return`${N}//${"local"===e?n.devServer.host:c()}:${P}${R}`}let z=k("You application is running here:"),G=`${x(" Local ")} ${$(q("local"))}
3
- ${S(" Network ")} ${C(q("net"))}`,I=[new g,B&&new B,M&&new M({fix:!0,threads:!0,extensions:["js","md","mdx","cjs","ejs","mjs","jsx","ts","tsx","json","html","coffee","vue"],exclude:["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],cache:!1,cacheStrategy:"content",lintDirtyModulesOnly:!0}),H&&new H({fix:!0,threads:!0,extensions:["css","scss","sass","less","ts","tsx","js","jsx"],exclude:["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],cache:!1,cacheStrategy:"content",lintDirtyModulesOnly:!0})].filter(Boolean),K={headers:{"Access-Control-Allow-Origin":"*"},compress:n.devServer.compress,host:"0.0.0.0",port:P,historyApiFallback:L||{index:R.endsWith("/")?R:`${R}/`,disableDotRule:!0},https:n.devServer.https,proxy:n.proxy,allowedHosts:n.devServer.allowedHosts,client:{reconnect:!0,progress:!1,logging:"info",overlay:!1,webSocketTransport:"ws"},webSocketServer:"ws",static:{watch:{ignored:e=>e.endsWith(".d.ts")||e.includes("/node_modules/")}},setupMiddlewares:(e,t)=>{if(!t)throw Error("devServer is not defined");return t.app&&h(W)&&W(t.app,w("mock/")),e},open:!1,hot:!0},Q=o(r(i,{devtool:F,mode:"development",plugins:I}));Q.watch({aggregateTimeout:600,ignored:/node_modules/,stdin:!0},(e,t)=>{!e&&t&&(process.stdout.write("\x1b[2J\x1b[3J\x1b[H"),v([z,"",G,"",b(`Compiled successfully in ${y(`${t.endTime-t.startTime}ms`)}`)]),t.compilation.warnings.forEach(e=>v(e.message)),t.compilation.errors.forEach(e=>v(e.message)),Y&&v(Y))});let U=new s(K,Q);U.startCallback(e=>{e||v([z,"",G])}),U.stopCallback(e=>{e||l(d.cachePath)}),process.on("exit",function(){Q.close(()=>{}),U.invalidate(),U.stop()});
3
+ ${S(" Network ")} ${C(q("net"))}`,I=[M&&new M({fix:!0,threads:!0,extensions:["js","md","mdx","cjs","ejs","mjs","jsx","ts","tsx","json","html","coffee","vue"],exclude:["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],cache:!1,cacheStrategy:"content",lintDirtyModulesOnly:!0}),H&&new H({fix:!0,threads:!0,extensions:["css","scss","sass","less","ts","tsx","js","jsx"],exclude:["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],cache:!1,cacheStrategy:"content",lintDirtyModulesOnly:!0}),new g,B&&new B].filter(Boolean),K={headers:{"Access-Control-Allow-Origin":"*"},compress:n.devServer.compress,host:"0.0.0.0",port:P,historyApiFallback:L||{index:R.endsWith("/")?R:`${R}/`,disableDotRule:!0},https:n.devServer.https,proxy:n.proxy,allowedHosts:n.devServer.allowedHosts,client:{reconnect:!0,progress:!1,logging:"info",overlay:!1,webSocketTransport:"ws"},webSocketServer:"ws",static:{watch:{ignored:e=>e.endsWith(".d.ts")||e.includes("/node_modules/")}},setupMiddlewares:(e,t)=>{if(!t)throw Error("devServer is not defined");return t.app&&h(W)&&W(t.app,w("mock/")),e},open:!1,hot:!0},Q=o(r(i,{devtool:F,mode:"development",plugins:I}));Q.watch({aggregateTimeout:600,ignored:/node_modules/,stdin:!0},(e,t)=>{!e&&t&&(process.stdout.write("\x1b[2J\x1b[3J\x1b[H"),v([z,"",G,"",b(`Compiled successfully in ${y(`${t.endTime-t.startTime}ms`)}`)]),t.compilation.warnings.forEach(e=>v(e.message)),t.compilation.errors.forEach(e=>v(e.message)),Y&&v(Y))});let U=new s(K,Q);U.startCallback(e=>{e||v([z,"",G])}),U.stopCallback(e=>{e||l(d.cachePath)}),process.on("exit",function(){Q.close(()=>{}),U.invalidate(),U.stop()});
@@ -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 from"./paths.js";import{FRAMEWORK as i,isDev as n,isLibrary as c,isMicro as m}from"./process-env.js";import d from"./swcrc.js";import p from"./tsloader.config.js";import{resolveNodeModulesPath as u,resolveProgramPath as f}from"./utils.js";let y={loader:`${l.corePath}/loader/css-unicode.cjs`},x=m?o:"../",$={loader:e.loader,options:{publicPath:"/"!==x?x:"../"}},g=r("@moneko/postcss")&&{loader:"postcss-loader",options:{postcssOptions:(await import("@moneko/postcss")).default}};n&&($="style-loader");let j=[...t.cssModules,`@moneko/${i}`,"neko-ui"].map(u),w=[...["src/styles/variables.less","src/styles/mixins.less","site/styles/variables.less","site/styles/mixins.less"].map(f)],v=["components","example","mock","site","src","server"].map(f),b={loader:"css-loader",options:{modules:{auto:e=>{for(let s=0,t=j.length;s<t;s++)if(e&&e?.includes(j[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}},h=n&&{loader:"@teamsupercell/typings-for-css-modules-loader",options:{verifyOnly:!n}},k=[$,h,b,g,y,{loader:"less-loader",options:{sourceMap:!!t.sourceMap,lessOptions:{modifyVars:a,javascriptEnabled:!0}}},{loader:"style-resources-loader",options:{patterns:w}}].filter(Boolean),O={loader:"tsc"===t.compiler?"ts-loader":"swc-loader",options:"tsc"===t.compiler?p:d(n)};function B(e){return v.concat(t.rulesInclude?.[e]?.map(u)||[])}let L=B("media"),M={rules:[c&&{test:/\.mdx?$/i,include:[f("components")],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:B("wasm")},{test:/\.txt$/i,type:"asset/source"},{test:/\.ico$/i,type:"asset/inline",include:L},{test:/\.svg$/i,type:"asset/inline",generator:{dataUrl:e=>s(e.toString())},include:L},{test:/\.(gif|png|jpe?g|webp)$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/images/[name][ext]"},include:L},{test:/\.(webm|mp4|ogv)$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/video/[name][ext]"},include:L},{test:/\.(woff2?|eot|ttf|otf)(\?.*)?$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/fonts/[name][ext]"},include:B("font")},{test:/\.(sa|sc)ss$/i,use:[$,h,b,g,y,{loader:"sass-loader",options:{implementation:await import("sass"),sassOptions:{}}}].filter(Boolean),include:B("css")},{test:/\.less$/i,use:k,include:B("css")},{test:/\.css$/i,use:[$,"css-loader",g,y].filter(Boolean),include:B("css")},{test:/\.(cj|mj|t|j)s(|x)$/i,use:[...t.prefixJsLoader,O].filter(Boolean),include:B("js")},{test:/\.mdx?$/i,use:[...t.prefixJsLoader,O,{loader:"@mdx-js/loader",options:t.mdx}].filter(Boolean),include:v,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 M;
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 from"./paths.js";import{FRAMEWORK as i,isDev as n,isLibrary as c,isMicro as m}from"./process-env.js";import d from"./swcrc.js";import p from"./tsloader.config.js";import{resolveNodeModulesPath as u,resolveProgramPath as f}from"./utils.js";let y={loader:`${l.corePath}/loader/css-unicode.cjs`},x=m?o:"../",$={loader:e.loader,options:{publicPath:"/"!==x?x:"../"}},g=r("@moneko/postcss")&&{loader:"postcss-loader",options:{postcssOptions:(await import("@moneko/postcss")).default}};n&&($="style-loader");let j=[...t.cssModules,`@moneko/${i}`,"neko-ui"].map(u),w=[...["src/styles/variables.less","src/styles/mixins.less","site/styles/variables.less","site/styles/mixins.less"].map(f)],v=["components","example","mock","site","src","server"].map(f),b={loader:"css-loader",options:{modules:{auto:e=>{for(let s=0,t=j.length;s<t;s++)if(e&&e?.includes(j[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}},h=n&&{loader:"@teamsupercell/typings-for-css-modules-loader",options:{verifyOnly:!n}},k=[$,h,b,g,y,{loader:"less-loader",options:{sourceMap:!!t.sourceMap,lessOptions:{modifyVars:a,javascriptEnabled:!0}}},{loader:"style-resources-loader",options:{patterns:w}}].filter(Boolean),O="tsc"===t.compiler,B={loader:O?"ts-loader":"swc-loader",options:O?p:d(n)};function L(e){return v.concat(t.rulesInclude?.[e]?.map(u)||[])}let M=L("media"),P={rules:[c&&{test:/\.mdx?$/i,include:[f("components")],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:L("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:L("font")},{test:/\.(sa|sc)ss$/i,use:[$,h,b,g,y,{loader:"sass-loader",options:{implementation:await import("sass"),sassOptions:{}}}].filter(Boolean),include:L("css")},{test:/\.less$/i,use:k,include:L("css")},{test:/\.css$/i,use:[$,"css-loader",g,y].filter(Boolean),include:L("css")},{test:/\.(cj|mj|t|j)s(|x)$/i,use:[...t.prefixJsLoader,B].filter(Boolean),include:L("js")},{test:/\.mdx?$/i,use:[...t.prefixJsLoader,B,{loader:"@mdx-js/loader",options:t.mdx}].filter(Boolean),include:v,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 P;
package/lib/polyfills.js CHANGED
@@ -1 +1 @@
1
- import r from"browserslist";import t from"core-js-compat";import o from"./paths.js";export default function(){return t({targets:r(void 0,{path:o.programPath,env:process.env.NODE_ENV}).filter(r=>!r.endsWith(" TP")),version:"3.32.2"}).list}
1
+ import r from"browserslist";import t from"core-js-compat";import o from"./paths.js";export default function(){return t({targets:r(void 0,{path:o.programPath,env:process.env.NODE_ENV}).filter(r=>!r.endsWith(" TP")),version:"3.33.2"}).list}
package/lib/prod.js CHANGED
@@ -1 +1 @@
1
- import e from"css-minimizer-webpack-plugin";import i from"mini-css-extract-plugin";import n from"terser-webpack-plugin";import m from"webpack";import{BundleAnalyzerPlugin as o}from"webpack-bundle-analyzer";import{merge as s}from"webpack-merge";import{clientConfig as r}from"./common.js";import{CONFIG as t}from"./config.js";import{getMinifyOption as p}from"./minify.js";let{optimize:{MinChunkSizePlugin:l}}=m,{cssnanoMinify:c,swcMinify:u}=e,a="swc"===t.compiler,f=[];t.minifier&&(t.minifier.js&&f.push(new n(p(t.minifier.js?.type||(a?"swc":"terser"),t.minifier.js?.options))),t.minifier.css&&f.push(new e({minify:{swc:u,cssnano:c}[t.minifier.css?.type||(a?"swc":"cssnano")],minimizerOptions:t.minifier.css?.options})));let d={splitChunks:t.splitChunk,runtimeChunk:t.runtimeChunk,chunkIds:"named",moduleIds:"named",removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,mangleWasmImports:!0,minimize:!0,minimizer:f},k=s(r,{devtool:!1===t.devtool||t.devtool?t.devtool:"cheap-module-source-map",mode:"production",optimization:d,plugins:[new i({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",experimentalUseImportModule:!0}),t.bundleAnalyzer&&new o(t.bundleAnalyzer),t.splitChunk&&new l({minChunkSize:1e4})].filter(Boolean)}),h=m(k);h.run(()=>{}),process.on("exit",function(){h.close(()=>{})});
1
+ import e from"css-minimizer-webpack-plugin";import i from"mini-css-extract-plugin";import n from"terser-webpack-plugin";import m from"webpack";import{BundleAnalyzerPlugin as o}from"webpack-bundle-analyzer";import{merge as s}from"webpack-merge";import{cleanDir as r}from"./cleanup.js";import{clientConfig as t}from"./common.js";import{CONFIG as p}from"./config.js";import{getMinifyOption as l}from"./minify.js";import c from"./paths.js";let{optimize:{MinChunkSizePlugin:u}}=m,{cssnanoMinify:a,swcMinify:f}=e,d="swc"===p.compiler,h=[];p.minifier&&(p.minifier.js&&h.push(new n(l(p.minifier.js?.type||(d?"swc":"terser"),p.minifier.js?.options))),p.minifier.css&&h.push(new e({minify:{swc:f,cssnano:a}[p.minifier.css?.type||(d?"swc":"cssnano")],minimizerOptions:p.minifier.css?.options})));let k={splitChunks:p.splitChunk,runtimeChunk:p.runtimeChunk,chunkIds:"named",moduleIds:"named",removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,mangleWasmImports:!0,minimize:!0,minimizer:h},w=s(t,{devtool:!1===p.devtool||p.devtool?p.devtool:"cheap-module-source-map",mode:"production",optimization:k,plugins:[new i({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",experimentalUseImportModule:!0}),p.bundleAnalyzer&&new o(p.bundleAnalyzer),p.splitChunk&&new u({minChunkSize:1e4})].filter(Boolean)}),b=m(w);b.run(e=>{e||(r(c.cachePath),b.close(()=>{}))}),process.on("exit",function(){b.close(()=>{})});
package/lib/swcrc.js CHANGED
@@ -1 +1 @@
1
- import{merge as e}from"webpack-merge";import{CONFIG as o}from"./config.js";import r from"./paths.js";import s from"./polyfills.js";import{isReact as t,isSolid as n,jsxImportSource as c}from"./process-env.js";export const swcMinifyOption={compress:{top_retain:[],keep_infinity:!0,global_defs:{"@alert":"console.log"},pure_funcs:["console.log","console.warn","console.error","console.info"],toplevel:!1,drop_console:!0,drop_debugger:!0,module:!1,ecma:2015,ie8:!1,keep_classnames:void 0,keep_fnames:!1},mangle:!0};export default((a=!1)=>{let l={module:{type:"es6",resolveFully:!0},jsc:{parser:{syntax:"typescript",tsx:!0,decorators:!0,dynamicImport:!0},loose:!0,target:"es2017",externalHelpers:!0,transform:{legacyDecorator:!0,decoratorMetadata:!0,react:{runtime:"automatic",throwIfNamespace:!0,refresh:t&&a,development:a,importSource:c},optimizer:{simplify:!1}},experimental:{emitAssertForImportAttributes:!0,cacheRoot:r.swcCachePath,plugins:[["swc-plugin-another-transform-imports",function(e){for(let o=0,r=Object.keys(e),s=r.length;o<s;o++)e[r[o]].transform=`${r[o]}/${e[r[o]].transform}`,e[r[o]].style&&(e[r[o]].style=`${r[o]}/${e[r[o]].style}`);return e}(o.importOnDemand||{})],n&&["@moneko/jsx-dom-expressions",o.jsxDomExpressions||{}]].filter(Boolean)}},sourceMaps:!0,parseMap:!0};return(o.polyfill&&(l.jsc.target=void 0,l.env={include:s(),mode:"usage",coreJs:"3.32.2"}),o.swcrc)?e(l,"function"==typeof o.swcrc?o.swcrc(a):o.swcrc):l});
1
+ import{merge as e}from"webpack-merge";import{CONFIG as o}from"./config.js";import r from"./paths.js";import s from"./polyfills.js";import{isReact as t,isSolid as n,jsxImportSource as c}from"./process-env.js";export const swcMinifyOption={compress:{top_retain:[],keep_infinity:!0,global_defs:{"@alert":"console.log"},pure_funcs:["console.log","console.warn","console.error","console.info"],toplevel:!1,drop_console:!0,drop_debugger:!0,module:!1,ecma:2015,ie8:!1,keep_classnames:void 0,keep_fnames:!1},mangle:!0};export default((a=!1)=>{let l={module:{type:"es6",resolveFully:!0},jsc:{parser:{syntax:"typescript",tsx:!0,decorators:!0,dynamicImport:!0},loose:!0,target:"es2017",externalHelpers:!0,transform:{legacyDecorator:!0,decoratorMetadata:!0,react:{runtime:"automatic",throwIfNamespace:!0,refresh:t&&a,development:a,importSource:c},optimizer:{simplify:!1}},experimental:{emitAssertForImportAttributes:!0,cacheRoot:r.swcCachePath,plugins:[["swc-plugin-another-transform-imports",function(e){for(let o=0,r=Object.keys(e),s=r.length;o<s;o++)e[r[o]].transform=`${r[o]}/${e[r[o]].transform}`,e[r[o]].style&&(e[r[o]].style=`${r[o]}/${e[r[o]].style}`);return e}(o.importOnDemand||{})],n&&["@moneko/jsx-dom-expressions",o.jsxDomExpressions||{}]].filter(Boolean)}},sourceMaps:!0,parseMap:!0};return(o.polyfill&&(l.jsc.target=void 0,l.env={include:s(),mode:"usage",coreJs:"3.33.2"}),o.swcrc)?e(l,"function"==typeof o.swcrc?o.swcrc(a):o.swcrc):l});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.4.0",
3
+ "version": "3.5.0",
4
4
  "description": "core",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",