@moneko/core 3.9.17-beta.7 → 3.9.17-beta.8
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/build.mjs +1 -1
- package/lib/common.mjs +1 -1
- package/lib/config.mjs +1 -1
- package/lib/dev-config.d.mts +6 -0
- package/lib/dev-config.mjs +3 -0
- package/lib/dev-old.d.mts +1 -0
- package/lib/dev-old.mjs +0 -0
- package/lib/dev.mjs +1 -3
- package/lib/html-plugin-option.mjs +1 -1
- package/lib/module.config.mjs +1 -1
- package/lib/plugin/virtual-module.mjs +1 -1
- package/lib/plugins.config.mjs +1 -1
- package/lib/swcrc.mjs +1 -1
- package/lib/utils.mjs +1 -1
- package/lib/vm/modules.d.mts +17 -0
- package/lib/vm/modules.mjs +1 -0
- package/package.json +2 -3
package/lib/build.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{removeDirAll as e}from"@moneko/mdx";import
|
|
1
|
+
import{removeDirAll as e}from"@moneko/mdx";import o from"mini-css-extract-plugin";import m from"terser-webpack-plugin";import n from"webpack";import{BundleAnalyzerPlugin as i}from"webpack-bundle-analyzer";import{merge as r}from"webpack-merge";import t from"webpack-node-externals";import s from"webpackbar";import{commonConfig as a}from"./common.mjs";import{CONFIG as p}from"./config.mjs";import{getMinifyOption as l}from"./minify.mjs";import c from"./module.config.mjs";import u,{CUSTOMCONFIG as f}from"./paths.mjs";import h from"./plugin/done.mjs";import d from"./plugin/lightningcss-plugin.mjs";import{SSR as k,isLibrary as g}from"./process-env.mjs";import b from"./seo.mjs";import{compilerListener as w,log as y,resolveProgramPath as j}from"./utils.mjs";let{optimize:{MinChunkSizePlugin:v,ModuleConcatenationPlugin:z}}=n,x=[];p.minifier&&(x.push(new m(l(p.minifier?.type||"swc",p.minifier?.options))),x.push(new d));let C={splitChunks:p.splitChunk,runtimeChunk:p.runtimeChunk,chunkIds:"named",moduleIds:"named",removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,mangleWasmImports:!0,minimize:!0,minimizer:x},E=[new z,new o({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",experimentalUseImportModule:!0}),p.splitChunk&&new v({minChunkSize:1e4}),p.bundleAnalyzer&&new i(p.bundleAnalyzer)].filter(Boolean),I=a.output.path;k&&(I=j(`${g?"docs":"dist"}/client`));let A=[r(a,{optimization:C,output:{path:I},module:c(!1),plugins:[...E,(p.done||p.seo)&&new h({done(e){p.done?.(e),p.seo&&b()}}),p.bar&&new s(p.bar)].filter(Boolean)})];if(k){let e=r(a,{entry:{main:j("site/ssr.tsx")},output:{path:j(`${g?"docs":"dist"}/server`),library:{type:"commonjs2",umdNamedDefine:!1},filename:"[name].cjs",chunkFilename:"[chunkhash].cjs",globalObject:"global"},cache:{type:"filesystem",name:[f,process.env.NODE_ENV,"server"].filter(Boolean).join("-")},externalsPresets:{node:!0},externals:[t()],resolve:{fallback:{path:"path",fs:"fs",crypto:"crypto",assert:"assert"}},optimization:C,module:c(!0),target:"node",plugins:[...E,new s({name:"Server"})]});A.push(e)}let[B,D]=n(A).compilers,N=[w("client",B)];D&&N.push(w("server",D)),async function(){n(A).run((e,o)=>{if(e)throw e;o&&o.stats.forEach(e=>{e.compilation.warnings.forEach(e=>y(e.message)),e.compilation.errors.forEach(e=>y(e.message))})}),await Promise.all(N)}(),process.on("exit",function(){e(u.cachePath)});
|
package/lib/common.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CONFIG as e,PUBLICPATH as t}from"./config.mjs";import o,{CUSTOMCONFIG as s}from"./paths.mjs";import r from"./plugin/override-resolve.mjs";import
|
|
1
|
+
import{CONFIG as e,PUBLICPATH as t}from"./config.mjs";import o,{CUSTOMCONFIG as s}from"./paths.mjs";import r from"./plugin/override-resolve.mjs";import n from"./plugins.config.mjs";import{PACKAGENAME as a,PACKAGEVERSION as i,isDev as l,isLibrary as p}from"./process-env.mjs";import{resolveNodeModulesPath as c,resolveProgramPath as m}from"./utils.mjs";export const outputConfig={path:m(p?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:`js/[${l?"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:a,type:"window"},globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${a}`,pathinfo:l,clean:!0,publicPath:t,asyncChunks:!0,charset:!0};let u={main:[e.polyfill&&`${o.corePath}/polyfills/replace-children.js`,c("@app/entry")].filter(Boolean)};e.entry&&("string"==typeof e.entry?u={main:[e.entry]}:Object.keys(e.entry)&&(u=Object.assign(u,e.entry))),"string"==typeof u.main&&(u.main=[u.main]),e.output&&("string"==typeof e.output?outputConfig.path=e.output:Object.keys(e.output)&&Object.assign(outputConfig,e.output));let f=!1;e.cacheDirectory&&(f={type:"filesystem",store:"pack",allowCollectingMemory:!0,cacheDirectory:e.cacheDirectory,memoryCacheUnaffected:!0,name:[s,process.env.NODE_ENV].filter(Boolean).join("-"),version:i});let d=Object.assign({original:e.alias["@"],override:s&&m(s)},e.overrideResolve);export const commonConfig={devtool:e.devtool,entry:u,mode:l?"development":"production",stats:"errors-only",cache:f,infrastructureLogging:{level:"error"},target:"web",externalsPresets:e.externalsPresets,plugins:n,node:{global:!1},experiments:{topLevelAwait:!0,asyncWebAssembly:!0,cacheUnaffected:!0,layers:!0,lazyCompilation:l&&{imports:!1,entries:!1},buildHttp:e.buildHttp,backCompat:!0,futureDefaults:!1,css:!1,outputModule:!1},resolve:{extensions:["...",".jsx",".ts",".tsx"],alias:e.alias,modules:[o.nodeModules],mainFields:["browser","module","main"],mainFiles:["index"],plugins:[e.overrideResolve&&new r(d),...e.resolvePlugins].filter(Boolean),fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},externals:e.externals,output:outputConfig};
|
package/lib/config.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fileExists as e}from"@moneko/mdx";import{merge as t}from"webpack-merge";import o,{CUSTOMCONFIG as s}from"./paths.mjs";import{FRAMEWORK as i,PACKAGENAME as n,coreName as
|
|
1
|
+
import{fileExists as e}from"@moneko/mdx";import{merge as t}from"webpack-merge";import o,{CUSTOMCONFIG as s}from"./paths.mjs";import{FRAMEWORK as i,PACKAGENAME as n,coreName as a,isDev as r,isLibrary as l,isMobile as m,isSolid as p,jsxImportSource as c,mainDirectory as u}from"./process-env.mjs";import{isFunction as d,log as h,readConf as g,resolveProgramPath as f}from"./utils.mjs";let x=["@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"],C={devtool:r?"eval-cheap-module-source-map":"cheap-module-source-map",seo:!1,mode:"csr",bundleAnalyzer:!1,polyfill:!1,entry:{},minifier:{},sourceMap:{filename:"[file].map",publicPath:""},env:{NODE_ENV:process.env.NODE_ENV},basename:"/",publicPath:"/",rem:{designSize:m?375:1680},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{"@":f(u)},moduleRules:[],prefixJsLoader:[],cssModules:[],importOnDemand:{},proxy:[],cacheDirectory:o.webpackCachePath,devServer:{allowedHosts:[".baidu.com"],host:"localhost",port:3e3,https:!1,compress:!1},htmlPluginOption:{template:`node_modules/${a}/template/index.html`,favicon:`node_modules/${a}/template/favicon.ico`,tags:[]},assetHtml:[],routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:{chunks:"all",minSize:1024,minChunks:1,cacheGroups:{CHANGELOG:{test:/CHANGELOG\.md/,priority:-10,name:"CHANGELOG",reuseExistingChunk:!0},prismjs:{test:/(prism\.js|prism\/css\.ts)/,priority:-10,name:"vendors-prismjs",reuseExistingChunk:!0},site:{test:/site/,priority:-10,reuseExistingChunk:!0},marked:{test:/marked/,priority:-10,reuseExistingChunk:!0},"n-katex":{test:/n-katex/,priority:-10,reuseExistingChunk:!0},"n-code-live":{test:/n-code-live/,priority:-10,reuseExistingChunk:!0},"@moneko":{test:/@moneko/,priority:-10,reuseExistingChunk:!0}}},runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:x,js:x,media:x,font:x,wasm:[]},mdx:{jsx:!1,development:r,jsxImportSource:c,providerImportSource:`@moneko/${i}/mdx`},jsxDomExpressions:{},bar:{name:"Client",color:"#6f42c1"},normalizeCss:!0,externalsPresets:{},buildHttp:{allowedUris:[],lockfileLocation:`${o.httpCachePath}/http.lock`,cacheLocation:`${o.httpCachePath}/data`,upgrade:!0},virtualModule:{}};p&&(C.jsxDomExpressions={moduleName:"solid-js/web",builtIns:["For","Show","Switch","Match","Suspense","SuspenseList","Portal","Index","Dynamic","ErrorBoundary"],contextToCustomElements:!0,wrapConditionals:!0,generate:"dom",hydratable:!1}),l&&(C.alias=Object.assign(C.alias,{"@pkg":o.componentsPath,[n]:o.componentsPath}));let k=C,v={},P={};if(e(o.configPath)){let e=(await g(o.configPath,"index")).default;v=d(e)?e(process):e}if(s&&e(o.customConfigPath)){let e=(await g(o.customConfigPath,s)).default;P=d(e)?e(process):e}(!1===(k=t(k,v,P)).devtool||!1===k.sourceMap)&&(k.sourceMap=!1,k.devtool=!1),k.fixBrowserRouter&&k.htmlPluginOption&&(k.htmlPluginOption.tags||(k.htmlPluginOption.tags=[]),k.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=k;export const PUBLICPATH=CONFIG.publicPath||"/";global.NEKOCLICONFIG={CONFIG,CUSTOMCONFIG:s,log:h};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import e from"chalk";import{CONFIG as t}from"./config.mjs";import{getIPv4 as r,getPort as o}from"./net.mjs";import{log as s}from"./utils.mjs";let{yellow:i,green:n,grey:l,gray:m,bgBlue:p,bgGreenBright:a,blueBright:c,greenBright:v}=e,d=t.devServer.port||3e3;export const PORT=await o(d,65535,t.devServer.host);t.devServer.port=PORT;let $="/"===t.basename,u=t.devServer.https?"https:":"http:",f=$?"":t.basename,h=t.devServer.port!==PORT&&m(`Port ${i(d)} is in use, trying ${n(PORT)} instead.
|
|
2
|
+
`);function T(e){return`${u}//${"local"===e?t.devServer.host:r()}:${PORT}${f}`}let x=m("You application is running here:"),O=`${p(" Local ")} ${c(T("local"))}
|
|
3
|
+
${a(" Network ")} ${v(T("net"))}`;export function devLog(e,t){!e&&t&&(process.stdout.write("\x1b[2J\x1b[3J\x1b[H"),s([x,"",O,"",l(`Compiled successfully in ${n(`${t.endTime-t.startTime}ms`)}`)]),h&&s(h))}export const headers={"Access-Control-Allow-Origin":"*"};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/dev-old.mjs
ADDED
|
File without changes
|
package/lib/dev.mjs
CHANGED
|
@@ -1,3 +1 @@
|
|
|
1
|
-
import e
|
|
2
|
-
`);function V(e){return`${G}//${"local"===e?p.devServer.host:u()}:${I}${H}`}let Y=B("You application is running here:"),q=`${T(" Local ")} ${E(V("local"))}
|
|
3
|
-
${D(" Network ")} ${N(V("net"))}`,z=["js","jsx","ts","tsx","json","html","vue"],A=z.join(","),K=["css","scss","sass","less","ts","tsx","js","jsx"],Q=K.join(","),R=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],W=[new x({paths:[/\.d\.ts$/]})].filter(Boolean),X=s(),Z=l(m,{entry:{main:[`webpack-hot-middleware/client?path=http://localhost:${I}/__webpack_hmr&timeout=2000`,...m.entry.main]},output:{hotUpdateMainFilename:"updates/[fullhash].hot-update.json",hotUpdateChunkFilename:"updates/[id].[fullhash].hot-update.js"},module:j(!1),plugins:[...W,new v,J&&new J,M&&new M({fix:!0,threads:!0,files:[`${p.alias["@"]}/**/*.{${A}}`,h&&`${p.alias["@pkg"]}/**/*.{${A}}`].filter(Boolean),extensions:z,exclude:R,cache:!0,lintDirtyModulesOnly:!0}),F&&new F({fix:!0,threads:!0,files:[`${p.alias["@"]}/**/*.{${Q}}`,h&&`${p.alias["@pkg"]}/**/*.{${Q}}`].filter(Boolean),extensions:K,exclude:R,cache:!0,lintDirtyModulesOnly:!0}),p.bar&&new n(p.bar)].filter(Boolean)}),ee=[Z];if(f){let e=l(m,{entry:{main:k("site/ssr.tsx")},output:{clean:!1,path:k("ssr"),library:{type:"commonjs2"},filename:"[name].cjs",chunkFilename:"[name].cjs",globalObject:"global"},cache:{type:"filesystem",name:[$,process.env.NODE_ENV,"server"].filter(Boolean).join("-")},externals:[o()],module:j(!0),target:"node",plugins:[...W,new n({name:"Server"})].filter(Boolean)});ee.push(e)}let et=t(ee),eo=et.compilers.find(e=>"web"===e.options.target),es=et.compilers.find(e=>"node"===e.options.target);X.use(r()),X.use(a(eo,{publicPath:Z.output.publicPath,stats:Z.stats,writeToDisk:!0})),X.use(i(eo,{log:!1,path:"/__webpack_hmr",heartbeat:2e3}));let er=[];eo&&er.push(b("client",eo)),es&&(es.watch({aggregateTimeout:20,ignored:/node_modules(?![\\/]@app)/,poll:1e3},function(e,t){!e&&t&&(process.stdout.write("\x1b[2J\x1b[3J\x1b[H"),g([Y,"",q,"",S(`Compiled successfully in ${_(`${t.endTime-t.startTime}ms`)}`)]),t.compilation.warnings.forEach(e=>g(e.message)),t.compilation.errors.forEach(e=>g(e.message)))}),er.push(b("server",es))),await Promise.all(er),X.listen(I,()=>{L&&g(L)}),process.on("exit",function(){}),process.on("SIGINT",()=>{process.exit()});
|
|
1
|
+
import{removeDirAll as e}from"@moneko/mdx";import o from"cors";import t from"express";import r from"webpack";import i from"webpack-dev-middleware";import s from"webpack-hot-middleware";import{merge as a}from"webpack-merge";import m from"webpack-node-externals";import n from"webpackbar";import{commonConfig as l}from"./common.mjs";import{CONFIG as p}from"./config.mjs";import{PORT as c,devLog as d,headers as f}from"./dev-config.mjs";import{hasPkg as u}from"./has-pkg.mjs";import h from"./module.config.mjs";import w,{CUSTOMCONFIG as g}from"./paths.mjs";import{SSR as k,isLibrary as b,isReact as j}from"./process-env.mjs";import{compilerListener as x,resolveProgramPath as y}from"./utils.mjs";let{HotModuleReplacementPlugin:v}=r,_=u("stylelint-webpack-plugin")&&(await import("stylelint-webpack-plugin")).default,$=u("eslint-webpack-plugin")&&(await import("eslint-webpack-plugin")).default,B=j&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,D=["js","jsx","ts","tsx","json","html","vue"],P=D.join(","),S=["css","scss","sass","less","ts","tsx","js","jsx"],O=S.join(","),E=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],I=new URLSearchParams({timeout:2e3,reload:!0,quiet:!0,noInfo:!0,overlay:!1,dynamicPublicPath:!0}).toString(),N=[a(l,{entry:{main:[`webpack-hot-middleware/client?name=client&path=//localhost:${c}/__hmr__&${I}`]},module:h(!1),plugins:[new v,B&&new B,$&&new $({fix:!0,threads:!0,files:[`${p.alias["@"]}/**/*.{${P}}`,b&&`${p.alias["@pkg"]}/**/*.{${P}}`].filter(Boolean),extensions:D,exclude:E,cache:!0,lintDirtyModulesOnly:!0}),_&&new _({fix:!0,threads:!0,files:[`${p.alias["@"]}/**/*.{${O}}`,b&&`${p.alias["@pkg"]}/**/*.{${O}}`].filter(Boolean),extensions:S,exclude:E,cache:!0,lintDirtyModulesOnly:!0}),p.bar&&new n(p.bar)].filter(Boolean)})];if(k){let e=a(l,{entry:{main:y("site/ssr.tsx")},output:{path:y("ssr"),library:{type:"commonjs2"},filename:"[name].cjs",chunkFilename:"[name].cjs",globalObject:"global"},cache:{type:"filesystem",name:[g,process.env.NODE_ENV,"server"].filter(Boolean).join("-")},externals:[m()],module:h(!0),target:"node",plugins:[new n({name:"Server"})].filter(Boolean)});N.push(e)}let[T,M]=r(N).compilers,R=t();R.use(o()),R.use(i(T,{writeToDisk:!1,index:"index.html",headers:()=>f,serverSideRender:k})),R.use(s(T,{log:!1,path:"/__hmr__",heartbeat:2e3,ignoreUnaccepted:!1,ignoreDeclined:!0,ignoreErrored:!0}));let U=[x("client",T)];M&&(U.push(x("server",M)),M.watch({aggregateTimeout:20,ignored:/node_modules(?![\\/]@app)/,poll:1e3,stdin:!0},d)),await Promise.all(U),T.hooks.done.tap("client",e=>{d(null,e)}),R.listen(c,()=>{}),u("@moneko/mock")&&import("@moneko/mock").then(e=>{e.default(R,y("mock/"))}),process.on("exit",function(){}),process.on("SIGINT",()=>{e(w.cachePath),process.exit()});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{merge as e}from"webpack-merge";import{CONFIG as t}from"./config.mjs";import{description as i,keywords as o}from"./info.mjs";import{PACKAGENAME as m,coreName as r}from"./process-env.mjs";import{resolveProgramPath as a}from"./utils.mjs";let{template:
|
|
1
|
+
import{merge as e}from"webpack-merge";import{CONFIG as t}from"./config.mjs";import{description as i,keywords as o}from"./info.mjs";import{PACKAGENAME as m,coreName as r}from"./process-env.mjs";import{resolveProgramPath as a}from"./utils.mjs";let{template:p,favicon:n,...l}=Object.assign({template:`node_modules/${r}/template/index.html`,favicon:`node_modules/${r}/template/favicon.ico`},t.htmlPluginOption||{}),s=e({title:t.env?.PROJECTNAME||m.toLocaleUpperCase()||"Title",filename:"index.html",hash:!1,minify:{minifyJS:!0,minifyCSS:!0,collapseWhitespace:!0,removeComments:!0,removeRedundantAttributes:!1,removeScriptTypeAttributes:!1,removeStyleLinkTypeAttributes:!1,removeAttributeQuotes:!0,useShortDoctype:!0},meta:{charset:"UTF-8","X-UA-Compatible":{"http-equiv":"X-UA-Compatible",content:"IE=edge,Chrome=1"},HandheldFriendly:"true",MobileOptimized:"320","screen-orientation":"portrait","x5-orientation":"portrait",browsermode:"application","x5-page-mode":"app","msapplication-tap-highlight":"no",viewport:"width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1","apple-mobile-web-app-capable":"yes",renderer:"webkit",description:i,keywords:o},tags:[],template:a(p),favicon:a(n),excludeChunks:["ssr"]},l);export default s;
|
package/lib/module.config.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
let e;import s from"mini-css-extract-plugin";import{CONFIG as t,PUBLICPATH as o}from"./config.mjs";import r from"./modify-vars.mjs";import
|
|
1
|
+
let e;import s from"mini-css-extract-plugin";import{CONFIG as t,PUBLICPATH as o}from"./config.mjs";import{hasPkg as r}from"./has-pkg.mjs";import a from"./modify-vars.mjs";import i,{CUSTOMCONFIG as l}from"./paths.mjs";import{FRAMEWORK as n,isDev as m,isLibrary as d,isMicro as c}from"./process-env.mjs";import p from"./svg-to-data-uri.mjs";import u from"./swcrc.mjs";import{getLightningCssTargets as f}from"./targets.mjs";import{resolveNodeModulesPath as y,resolveProgramPath as g}from"./utils.mjs";import{comment as j,getCommentPath as $}from"./vm/docs.mjs";import x from"./vm/generate-doc.mjs";let v=c?o:"../",h={loader:s.loader,options:{publicPath:"/"!==v?v:"../"}},w={loader:`${i.corePath}/loader/lightningcss.cjs`,options:{sourceMap:!!t.sourceMap,analyzeDependencies:!1,targets:f(),drafts:{nesting:!0,customMedia:!0},errorRecovery:!1,unusedSymbols:[],rem:!!t.rem}};m&&(h="style-loader");let b=[...t.cssModules,`@moneko/${n}`,"neko-ui"].map(y),_=["components","example","mock","site","src","server"].map(g);function k(e){return _.concat(t.rulesInclude?.[e]?.map(y)||[])}l&&_.push(g(l)),t.overrideResolve&&t.overrideResolve.override&&_.push(t.overrideResolve.override);let M=k("css"),B=k("js"),L=k("media"),O=k("wasm"),P=k("font");r("sass")&&(e={loader:"sass-loader",options:{implementation:await import("sass"),sassOptions:{}}});let R=d&&m&&{test:/^(?![._]).*(?<!\.test)\.(tsx?)$/,include:t.alias["@pkg"],exclude:[/node_modules/,/(.+)\/__tests__\/(.+)/i],enforce:"pre",loader:`${i.corePath}/loader/ts-doc.cjs`,options:{comment:j,generateDoc:x,getCommentPath:$}};export default(s=>{let o={loader:"swc-loader",options:u(s)},r={loader:"css-loader",options:{modules:{auto:e=>{for(let s=0,t=b.length;s<t;s++)if(e&&e?.includes(b[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",exportOnlyLocals:s},importLoaders:2}},l=[h,r,w,{loader:"less-loader",options:{sourceMap:!!t.sourceMap,lessOptions:{modifyVars:a,javascriptEnabled:!0}}}].filter(Boolean);return{noParse:[/jquery|lodash|prismjs|prism\.js/,/react\.min\.js$/,/marked\.min\.js$/],rules:[R,{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:O},{test:/\.txt$/i,type:"asset/source"},{test:/\.ico$/i,type:"asset/inline",include:L},{test:/\.svg$/i,type:"asset/inline",generator:{dataUrl:e=>p(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:P},{test:/\.(sa|sc)ss$/i,use:[h,r,w,e].filter(Boolean),include:M},{test:/\.less$/i,use:l,include:M},{test:/\.css$/i,use:[h,"css-loader",w].filter(Boolean),include:M},{test:/\.(cj|mj|t|j)s(|x)$/i,use:[...t.prefixJsLoader,o].filter(Boolean),include:B},{test:/\.mdx?$/i,use:[...t.prefixJsLoader,{loader:`${i.corePath}/loader/mdx.cjs`,options:t.mdx}].filter(Boolean),exclude:[/node_modules/]},{type:"asset/source",include:[/(.+)\/examples\/(.+).*?$/i]}]},...t.moduleRules].filter(e=>"object"==typeof e)}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o from"webpack-virtual-modules";import{isLibrary as t}from"../process-env.mjs";import{resolveNodeModulesPath as e}from"../utils.mjs";import{comment as s,docs as p}from"../vm/docs.mjs";import{examples as r}from"../vm/example.mjs";import{locales as i}from"../vm/locales.mjs";import m from"../vm/modules.mjs";import{route as a}from"../vm/routes.mjs";export default class{constructor(o={}){this.options=o,this.hasTapped=!1}apply(l){let n=new o(m);function f(o,t){let s=e(o);n.writeModule(s,t||"")}n.apply(l),a.on("change",f),i.on("change",f),t&&(r.on("change",f),p.on("change",f),s.on("change",f)),l.hooks.compilation.tap("VirtualModuleWebpackPlugin",()=>{if(!this.hasTapped){for(let o in this.hasTapped=!0,this.options)if(Object.prototype.hasOwnProperty.call(this.options,o)){let t=this.options[o];f(o,"string"==typeof t?t:`export default ${JSON.stringify(t)}`)}for(let o of r)f(...o);for(let o of p)f(...o);for(let o of s)f(...o)}})}}
|
package/lib/plugins.config.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"
|
|
1
|
+
import e from"add-asset-html-webpack-plugin";import t from"html-webpack-plugin";import l from"webpack";import{CONFIG as o}from"./config.mjs";import i from"./html-plugin-option.mjs";import r from"./module-federation.mjs";import n from"./plugin/add-entry-attribute.mjs";import p from"./plugin/virtual-module.mjs";import{isMicro as a}from"./process-env.mjs";let{AutomaticPrefetchPlugin:s,DefinePlugin:m,SourceMapDevToolPlugin:c,IgnorePlugin:h,WatchIgnorePlugin:u}=l,f=o.basename.split("/").filter(Boolean).length,d=`${Array(f).fill("..").join("/")+(f?"/":"")}404.html`,{pathSegmentsToKeep:w=f,path:g=d}=o.fixBrowserRouter||{},j=o.assetHtml.map(e=>({publicPath:"",...e})),b=[new u({paths:[/\.d\.ts$/]}),...r,new p(o.virtualModule),new s,o.htmlPluginOption&&new t(i),o.fixBrowserRouter&&new t({filename:g,inject:!1,templateContent:()=>`<html lang="en"><head><title>${i.title}</title><script>const pathKeep = ${w||f};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(j),a&&new n({test:/main\.bundle\.js$/}),new m({"process.env":JSON.stringify(o.env)}),new h({resourceRegExp:/\/__tests__\//}),o.sourceMap&&new c(o.sourceMap),...o.plugins].filter(e=>!!e);export default b;
|
package/lib/swcrc.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{merge as e}from"webpack-merge";import{CONFIG as o}from"./config.mjs";import r from"./paths.mjs";import t from"./polyfills.mjs";import{isDev as s,isReact as n,isSolid as a,jsxImportSource as i}from"./process-env.mjs";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(l=>{let m=o.jsxDomExpressions;l&&(m.hydratable=!0,m.generate="ssr");let p={module:{type:"es6",resolveFully:!0},jsc:{parser:{syntax:"typescript",tsx:!0,decorators:!0,dynamicImport:!0},loose:!0,target:"es2017",externalHelpers:!1,transform:{legacyDecorator:!0,decoratorMetadata:!0,react:{runtime:"automatic",throwIfNamespace:!0,refresh:n&&s,development:s,importSource:i},optimizer:{simplify:!1}},minify:s?void 0:swcMinifyOption,experimental:{emitAssertForImportAttributes:!0,cacheRoot:r.swcCachePath,plugins:[["swc-plugin-another-transform-imports",function(e){for(let o=0,r=Object.keys(e),t=r.length;o<t;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||{})],a&&["@moneko/jsx-dom-expressions",m]].filter(Boolean)}},sourceMaps:!0,parseMap:!0};return o.polyfill&&(p.jsc.target=void 0,p.env={include:t(),mode:"entry",coreJs:"3.34"}),e(p,"function"==typeof o.swcrc?o.swcrc(s):o.swcrc||{})});
|
|
1
|
+
import{merge as e}from"webpack-merge";import{CONFIG as o}from"./config.mjs";import r from"./paths.mjs";import t from"./polyfills.mjs";import{isDev as s,isReact as n,isSolid as a,jsxImportSource as i}from"./process-env.mjs";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(l=>{let m={...o.jsxDomExpressions};l&&(m.hydratable=!0,m.generate="ssr");let p={module:{type:"es6",resolveFully:!0},jsc:{parser:{syntax:"typescript",tsx:!0,decorators:!0,dynamicImport:!0},loose:!0,target:"es2017",externalHelpers:!1,transform:{legacyDecorator:!0,decoratorMetadata:!0,react:{runtime:"automatic",throwIfNamespace:!0,refresh:n&&s,development:s,importSource:i},optimizer:{simplify:!1}},minify:s?void 0:swcMinifyOption,experimental:{emitAssertForImportAttributes:!0,cacheRoot:r.swcCachePath,plugins:[["swc-plugin-another-transform-imports",function(e){for(let o=0,r=Object.keys(e),t=r.length;o<t;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||{})],a&&["@moneko/jsx-dom-expressions",m]].filter(Boolean)}},sourceMaps:!0,parseMap:!0};return o.polyfill&&(p.jsc.target=void 0,p.env={include:t(),mode:"entry",coreJs:"3.34"}),e(p,"function"==typeof o.swcrc?o.swcrc(s):o.swcrc||{})});
|
package/lib/utils.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import{resolve as o}from"path";import r from"readline";import{saveFileSync as t}from"@moneko/mdx";import{transformFileSync as e}from"@swc/core";import n from"./paths.mjs";import s from"./resolver-sync.mjs";export function esm(o,...r){let t=o.raw[0];for(let e=0;e<r.length;e++)t+=r[e]+o.raw[e+1];return`data:text/javascript;base64,${Buffer.from(t).toString("base64")}`}let c={inputSourceMap:!1,sourceMaps:!1,module:{type:"es6"},jsc:{parser:{syntax:"typescript"},loose:!1}};export function log(o){Array.isArray(o)?o.forEach(o=>{log(`${o}
|
|
2
|
-
`)}):(r.cursorTo(process.stdout,0),process.stdout.write(o))}export function tfc(o){return e(o,c).code||"{}"}export function readConf(o,r){let e=`${n.cachePath}/${r}.mjs`;return t(e,tfc(o)),import(e)}export function toUpperCaseString(o){return o?.replace(/\b\w/g,o=>o.toUpperCase()).replace(/\./g," ")}export function resolveProgramPath(r){return o(n.programPath,`./${r}`)}export const resolveNodeModulesPath=o=>`${n.nodeModules}/${o}`;export const realResolve=o=>s.resolveSync({},n.programPath,o)||o;export function isObject(o){let r=typeof o;return null!==o&&("object"==r||"function"==r)}export function isFunction(o){if(!isObject(o))return!1;let r=Object.prototype.toString.call(o);return"[object Function]"==r||"[object AsyncFunction]"==r||"[object GeneratorFunction]"==r||"[object Proxy]"==r}export function empty(){}export function compilerListener(o,r){return new Promise((t,e)=>{r.hooks.failed.tap(o,o=>{e(o)}),r.hooks.done.tap(o,
|
|
2
|
+
`)}):(r.cursorTo(process.stdout,0),process.stdout.write(o))}export function tfc(o){return e(o,c).code||"{}"}export function readConf(o,r){let e=`${n.cachePath}/${r}.mjs`;return t(e,tfc(o)),import(e)}export function toUpperCaseString(o){return o?.replace(/\b\w/g,o=>o.toUpperCase()).replace(/\./g," ")}export function resolveProgramPath(r){return o(n.programPath,`./${r}`)}export const resolveNodeModulesPath=o=>`${n.nodeModules}/${o}`;export const realResolve=o=>s.resolveSync({},n.programPath,o)||o;export function isObject(o){let r=typeof o;return null!==o&&("object"==r||"function"==r)}export function isFunction(o){if(!isObject(o))return!1;let r=Object.prototype.toString.call(o);return"[object Function]"==r||"[object AsyncFunction]"==r||"[object GeneratorFunction]"==r||"[object Proxy]"==r}export function empty(){}export function compilerListener(o,r){return new Promise((t,e)=>{r.hooks.failed.tap(o,o=>{e(o)}),r.hooks.done.tap(o,r=>{r.hasErrors()||t(!0),r.compilation.warnings.forEach(r=>log([o,r.message])),r.compilation.errors.forEach(r=>log([o,r.message]))})})}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
"node_modules/@app/info": string;
|
|
3
|
+
"node_modules/@app/entry": string;
|
|
4
|
+
"node_modules/@app/rem": string;
|
|
5
|
+
"node_modules/@app/fallback": string;
|
|
6
|
+
"node_modules/@app/coverage": string;
|
|
7
|
+
"node_modules/@app/merge-router": string;
|
|
8
|
+
"node_modules/@app/prefix-router": string;
|
|
9
|
+
"node_modules/@app/normalize/index.css": string;
|
|
10
|
+
"node_modules/@app/suspense/index.tsx": string;
|
|
11
|
+
"node_modules/@app/mdx-scope": string;
|
|
12
|
+
"node_modules/@app/routes": string;
|
|
13
|
+
"node_modules/@app/example": string;
|
|
14
|
+
"node_modules/@app/locales": string;
|
|
15
|
+
"node_modules/@app/docs": string;
|
|
16
|
+
};
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{join as m}from"path";import{getAppEntry as o,getAppFallback as r,getAppMdxScope as p,getAppMergeRouter as e,getAppNormalizeCss as t,getAppPrefixRouter as a,getAppRem as s,getAppSuspense as i}from"@moneko/mdx";import f from"./coverage.mjs";import{docs as l,docsModuleName as n}from"./docs.mjs";import{exampleModuleName as c}from"./example.mjs";import{locales as x,localesModuleName as d}from"./locales.mjs";import{route as g,routesModuleName as j}from"./routes.mjs";import{CONFIG as u}from"../config.mjs";import h from"../info.mjs";import v from"../paths.mjs";import{APPTYPE as k,FRAMEWORK as z}from"../process-env.mjs";import{resolveNodeModulesPath as D,resolveProgramPath as b}from"../utils.mjs";export default{[D("@app/info")]:`export default ${JSON.stringify(h)}`,[D("@app/entry")]:o(m(u.alias["@"],"./index.ts"),!!u.rem,!!u.normalizeCss,k,z),[D("@app/rem")]:s(u.rem?.designSize||1680),[D("@app/fallback")]:r(u.fallbackCompPath),[D("@app/coverage")]:f(v.coveragePath),[D("@app/merge-router")]:e(),[D("@app/prefix-router")]:a(),[D("@app/normalize/index.css")]:t(),[D("@app/suspense/index.tsx")]:i(k,z),[D("@app/mdx-scope")]:p(b("site/mdx-scope.ts")),[D(j)]:g.getData(j),[D(c)]:"export default []",[D(d)]:x.getData(d),[D(n)]:l.getData(n)};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "3.9.17-beta.
|
|
3
|
+
"version": "3.9.17-beta.8",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
"@swc/core": "1.3.101",
|
|
20
20
|
"add-asset-html-webpack-plugin": "6.0.0",
|
|
21
21
|
"chokidar": "3.5.3",
|
|
22
|
-
"compression": "1.7.4",
|
|
23
22
|
"core-js": "3.34.0",
|
|
24
23
|
"core-js-compat": "3.34.0",
|
|
25
24
|
"cors": "2.8.5",
|
|
@@ -47,9 +46,9 @@
|
|
|
47
46
|
},
|
|
48
47
|
"devDependencies": {
|
|
49
48
|
"@swc/cli": "0.1.63",
|
|
50
|
-
"@types/compression": "1.7.5",
|
|
51
49
|
"@types/cors": "2.8.17",
|
|
52
50
|
"@types/express": "4.17.21",
|
|
51
|
+
"eslint-config-neko": "2.3.0",
|
|
53
52
|
"eslint-webpack-plugin": "4.0.1",
|
|
54
53
|
"sass": "1.69.5",
|
|
55
54
|
"sass-loader": "13.3.2",
|