@moneko/core 3.9.17-beta.2 → 3.9.17-beta.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/lib/common.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import type { Configuration } from 'webpack';
2
2
  export declare const outputConfig: Configuration['output'];
3
- export declare const clientConfig: Configuration;
3
+ export declare const commonConfig: Configuration;
package/lib/common.js CHANGED
@@ -1 +1 @@
1
- import{CONFIG as e,PUBLICPATH as t}from"./config.js";import o from"./module.config.js";import s,{CUSTOMCONFIG as r}from"./paths.js";import n from"./plugin/override-resolve.js";import l from"./plugins.config.js";import{PACKAGENAME as i,PACKAGEVERSION as a,isDev as p,isLibrary as c}from"./process-env.js";import{resolveNodeModulesPath as u,resolveProgramPath as m}from"./utils.js";export const outputConfig={path:m(c?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:`js/[${p?"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:i,type:"window"},globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${i}`,pathinfo:p,clean:!0,publicPath:t,asyncChunks:!0,charset:!0};let f={main:u("@app/entry")};e.polyfill&&Object.assign(f,{"dom-polyfills":[`${s.corePath}/polyfills/replace-children.js`]}),e.entry&&("string"==typeof e.entry?f={main:e.entry}:Object.keys(e.entry)&&Object.assign(f,e.entry)),e.output&&("string"==typeof e.output?outputConfig.path=e.output:Object.keys(e.output)&&Object.assign(outputConfig,e.output));let y=!1;e.cacheDirectory&&(y=p?{type:"memory"}:{type:"filesystem",store:"pack",allowCollectingMemory:!0,cacheDirectory:e.cacheDirectory,memoryCacheUnaffected:!0,name:[r,process.env.NODE_ENV].filter(Boolean).join("-"),version:a});let d=Object.assign({original:e.alias["@"],override:r&&m(r)},e.overrideResolve);export const clientConfig={entry:f,stats:"errors-only",cache:y,infrastructureLogging:{level:"error"},target:"web",externalsPresets:e.externalsPresets,plugins:l,node:{global:!1},experiments:{topLevelAwait:!0,asyncWebAssembly:!0,cacheUnaffected:!0,layers:!0,lazyCompilation:p&&{imports:!1,entries:!1},buildHttp:e.buildHttp,backCompat:!0,futureDefaults:!1,css:!1,outputModule:!1},resolve:{extensions:["...",".jsx",".ts",".tsx"],alias:e.alias,modules:[s.nodeModules],mainFields:["browser","module","main"],mainFiles:["index"],plugins:[e.overrideResolve&&new n(d),...e.resolvePlugins].filter(Boolean),fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},module:o,externals:e.externals,output:outputConfig};
1
+ import{CONFIG as e,PUBLICPATH as t}from"./config.js";import o from"./module.config.js";import s,{CUSTOMCONFIG as r}from"./paths.js";import n from"./plugin/override-resolve.js";import l from"./plugins.config.js";import{PACKAGENAME as i,PACKAGEVERSION as a,isDev as p,isLibrary as c}from"./process-env.js";import{resolveNodeModulesPath as u,resolveProgramPath as m}from"./utils.js";export const outputConfig={path:m(c?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:`js/[${p?"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:i,type:"window"},globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${i}`,pathinfo:p,clean:!0,publicPath:t,asyncChunks:!0,charset:!0};let f={main:u("@app/entry")};e.polyfill&&Object.assign(f,{"dom-polyfills":[`${s.corePath}/polyfills/replace-children.js`]}),e.entry&&("string"==typeof e.entry?f={main:e.entry}:Object.keys(e.entry)&&Object.assign(f,e.entry)),e.output&&("string"==typeof e.output?outputConfig.path=e.output:Object.keys(e.output)&&Object.assign(outputConfig,e.output));let y=!1;e.cacheDirectory&&(y=p?{type:"memory"}:{type:"filesystem",store:"pack",allowCollectingMemory:!0,cacheDirectory:e.cacheDirectory,memoryCacheUnaffected:!0,name:[r,process.env.NODE_ENV].filter(Boolean).join("-"),version:a});let d=Object.assign({original:e.alias["@"],override:r&&m(r)},e.overrideResolve);export const commonConfig={entry:f,stats:"errors-only",cache:y,infrastructureLogging:{level:"error"},target:"web",externalsPresets:e.externalsPresets,plugins:l,node:{global:!1},experiments:{topLevelAwait:!0,asyncWebAssembly:!0,cacheUnaffected:!0,layers:!0,lazyCompilation:p&&{imports:!1,entries:!1},buildHttp:e.buildHttp,backCompat:!0,futureDefaults:!1,css:!1,outputModule:!1},resolve:{extensions:["...",".jsx",".ts",".tsx"],alias:e.alias,modules:[s.nodeModules],mainFields:["browser","module","main"],mainFiles:["index"],plugins:[e.overrideResolve&&new n(d),...e.resolvePlugins].filter(Boolean),fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},module:o,externals:e.externals,output:outputConfig};
package/lib/config.js 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.js";import{FRAMEWORK as i,PACKAGENAME as n,coreName as r,isDev as a,isLibrary as l,isMobile as m,isSolid as p,jsxImportSource as c,mainDirectory as u}from"./process-env.js";import{isFunction as d,log as h,readConf as f,resolveProgramPath as g}from"./utils.js";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={seo:!1,mode:"csr",compiler:"swc",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:{"@":g(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/${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:{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:a,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}};p&&Object.assign(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,P={},v={};if(e(o.configPath)){let e=(await f(o.configPath,"index")).default;P=d(e)?e(process):e}if(s&&e(o.customConfigPath)){let e=(await f(o.customConfigPath,s)).default;v=d(e)?e(process):e}"tsc"===(k=t(k,P,v)).compiler&&k.minifier&&void 0===k.minifier.type&&(k.minifier.type="terser"),(!1===k.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};
1
+ import{fileExists as e}from"@moneko/mdx";import{merge as t}from"webpack-merge";import o,{CUSTOMCONFIG as s}from"./paths.js";import{FRAMEWORK as i,PACKAGENAME as n,SSR as r,coreName as a,isDev as l,isLibrary as m,isMobile as p,isSolid as c,jsxImportSource as u,mainDirectory as d}from"./process-env.js";import{isFunction as h,log as f,readConf as g,resolveProgramPath as x}from"./utils.js";let C=["@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"],k={seo:!1,mode:"csr",compiler:"swc",bundleAnalyzer:!1,polyfill:!1,entry:{},minifier:{},sourceMap:{filename:"[file].map",publicPath:""},env:{NODE_ENV:process.env.NODE_ENV},basename:"/",publicPath:"/",rem:{designSize:p?375:1680},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{"@":x(d)},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:C,js:C,media:C,font:C,wasm:[]},mdx:{jsx:!1,development:l,jsxImportSource:u,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}};c&&(k.jsxDomExpressions={moduleName:"solid-js/web",builtIns:["For","Show","Switch","Match","Suspense","SuspenseList","Portal","Index","Dynamic","ErrorBoundary"],contextToCustomElements:!0,wrapConditionals:!0,generate:r?"ssr":"dom",hydratable:!!r}),m&&(k.alias=Object.assign(k.alias,{"@pkg":o.componentsPath,[n]:o.componentsPath}));let P=k,v={},w={};if(e(o.configPath)){let e=(await g(o.configPath,"index")).default;v=h(e)?e(process):e}if(s&&e(o.customConfigPath)){let e=(await g(o.customConfigPath,s)).default;w=h(e)?e(process):e}"tsc"===(P=t(P,v,w)).compiler&&P.minifier&&void 0===P.minifier.type&&(P.minifier.type="terser"),(!1===P.devtool||!1===P.sourceMap)&&(P.sourceMap=!1,P.devtool=!1),P.fixBrowserRouter&&P.htmlPluginOption&&(P.htmlPluginOption.tags||(P.htmlPluginOption.tags=[]),P.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=P;export const PUBLICPATH=CONFIG.publicPath||"/";global.NEKOCLICONFIG={CONFIG,CUSTOMCONFIG:s,log:f};
package/lib/dev.js CHANGED
@@ -1,3 +1,3 @@
1
- import{removeDirAll as e}from"@moneko/mdx";import o from"chalk";import t from"webpack";import s from"webpack-dev-server";import{merge as r}from"webpack-merge";import i from"webpackbar";import{clientConfig as a}from"./common.js";import{CONFIG as l}from"./config.js";import{hasPkg as n}from"./has-pkg.js";import{getIPv4 as p,getPort as m}from"./net.js";import c from"./paths.js";import{isLibrary as d,isReact as u}from"./process-env.js";import{isFunction as w,log as f,resolveProgramPath as v}from"./utils.js";let{HotModuleReplacementPlugin:h,WatchIgnorePlugin:g}=t,{yellow:k,green:b,grey:$,gray:x,bgBlue:j,bgGreenBright:S,blueBright:y,greenBright:T}=o,C=n("eslint-webpack-plugin"),A=n("stylelint-webpack-plugin"),B=n("@moneko/mock"),D=A?(await import("stylelint-webpack-plugin")).default:null,E=C?(await import("eslint-webpack-plugin")).default:null,H=l.devServer.port||3e3,M=await m(H,65535,l.devServer.host),O=B&&(await import("@moneko/mock")).default,_=u&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,I=!1===l.devtool||l.devtool?l.devtool:"eval-cheap-module-source-map";l.devServer.port=M;let J="/"===l.basename,N=l.devServer.https?"https:":"http:",P=J?"":l.basename,W=l.devServer.port!==M&&x(`Port ${k(H)} is in use, trying ${b(M)} instead.
1
+ import{removeDirAll as e}from"@moneko/mdx";import o from"chalk";import t from"webpack";import s from"webpack-dev-server";import{merge as r}from"webpack-merge";import i from"webpackbar";import{commonConfig as a}from"./common.js";import{CONFIG as l}from"./config.js";import{hasPkg as n}from"./has-pkg.js";import{getIPv4 as p,getPort as m}from"./net.js";import c from"./paths.js";import{isLibrary as d,isReact as u}from"./process-env.js";import{isFunction as w,log as f,resolveProgramPath as v}from"./utils.js";let{HotModuleReplacementPlugin:h,WatchIgnorePlugin:g}=t,{yellow:k,green:b,grey:$,gray:x,bgBlue:j,bgGreenBright:S,blueBright:y,greenBright:T}=o,C=n("eslint-webpack-plugin"),A=n("stylelint-webpack-plugin"),B=n("@moneko/mock"),D=A?(await import("stylelint-webpack-plugin")).default:null,E=C?(await import("eslint-webpack-plugin")).default:null,H=l.devServer.port||3e3,M=await m(H,65535,l.devServer.host),O=B&&(await import("@moneko/mock")).default,_=u&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,I=!1===l.devtool||l.devtool?l.devtool:"eval-cheap-module-source-map";l.devServer.port=M;let J="/"===l.basename,N=l.devServer.https?"https:":"http:",P=J?"":l.basename,W=l.devServer.port!==M&&x(`Port ${k(H)} is in use, trying ${b(M)} instead.
2
2
  `);function F(e){return`${N}//${"local"===e?l.devServer.host:p()}:${M}${P}`}let G=x("You application is running here:"),L=`${j(" Local ")} ${y(F("local"))}
3
3
  ${S(" Network ")} ${T(F("net"))}`,R=["js","jsx","ts","tsx","json","html","vue"],Y=R.join(","),q=["css","scss","sass","less","ts","tsx","js","jsx"],z=q.join(","),K=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],Q=[new g({paths:[/\.d\.ts$/]}),new h,_&&new _,E&&new E({fix:!0,threads:!0,files:[`${l.alias["@"]}/**/*.{${Y}}`,d&&`${l.alias["@pkg"]}/**/*.{${Y}}`].filter(Boolean),extensions:R,exclude:K,cache:!0,lintDirtyModulesOnly:!0}),D&&new D({fix:!0,threads:!0,files:[`${l.alias["@"]}/**/*.{${z}}`,d&&`${l.alias["@pkg"]}/**/*.{${z}}`].filter(Boolean),extensions:q,exclude:K,cache:!0,lintDirtyModulesOnly:!0}),l.bar&&new i(l.bar)].filter(Boolean),U={headers:{"Access-Control-Allow-Origin":"*"},compress:l.devServer.compress,host:"0.0.0.0",port:M,historyApiFallback:J||{index:P.endsWith("/")?P:`${P}/`,disableDotRule:!0},https:l.devServer.https,proxy:l.proxy,allowedHosts:l.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,o)=>{if(!o)throw Error("devServer is not defined");return o.app&&w(O)&&O(o.app,v("mock/")),e},open:!1,hot:!0},V=t(r(a,{devtool:I,mode:"development",plugins:Q}));V.watch({aggregateTimeout:20,ignored:/node_modules(?![\\/]@app)/,poll:1e3,stdin:!0},(e,o)=>{!e&&o&&(process.stdout.write("\x1b[2J\x1b[3J\x1b[H"),f([G,"",L,"",$(`Compiled successfully in ${b(`${o.endTime-o.startTime}ms`)}`)]),o.compilation.warnings.forEach(e=>f(e.message)),o.compilation.errors.forEach(e=>f(e.message)),W&&f(W))});let X=new s(U,V);X.startCallback(e=>{e||f([G,"",L])}),X.stopCallback(o=>{o||e(c.cachePath)}),process.on("exit",function(){V.close(()=>{}),X.invalidate(),X.stop()}),process.on("SIGINT",()=>{process.exit()});
@@ -1 +1 @@
1
- import{merge as e}from"webpack-merge";import{CONFIG as t}from"./config.js";import{description as i,keywords as o}from"./info.js";import{PACKAGENAME as r,coreName as m}from"./process-env.js";import{resolveProgramPath as a}from"./utils.js";let{template:p,favicon:n,...l}=Object.assign({template:`node_modules/${m}/template/index.html`,favicon:`node_modules/${m}/template/favicon.ico`},t.htmlPluginOption||{}),s=e({title:t.env?.PROJECTNAME||r.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"},CSP:{"http-equiv":"Content-Security-Policy",content:"script-src 'self' 'unsafe-eval'"},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)},l);export default s;
1
+ import{merge as e}from"webpack-merge";import{CONFIG as t}from"./config.js";import{description as i,keywords as o}from"./info.js";import{PACKAGENAME as r,coreName as m}from"./process-env.js";import{resolveProgramPath as a}from"./utils.js";let{template:n,favicon:p,...l}=Object.assign({template:`node_modules/${m}/template/index.html`,favicon:`node_modules/${m}/template/favicon.ico`},t.htmlPluginOption||{}),s=e({title:t.env?.PROJECTNAME||r.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"},CSP:{"http-equiv":"Content-Security-Policy",content:"script-src 'self' 'unsafe-eval'"},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(n),favicon:a(p),excludeChunks:["ssr"]},l);export default s;
@@ -1 +1 @@
1
- import e from"mini-css-extract-plugin";import{CONFIG as s,PUBLICPATH as t}from"./config.js";import o from"./modify-vars.js";import r,{CUSTOMCONFIG as a}from"./paths.js";import{FRAMEWORK as i,isDev as l,isLibrary as n,isMicro as d}from"./process-env.js";import m from"./svg-to-data-uri.js";import c from"./swcrc.js";import{getLightningCssTargets as p}from"./targets.js";import u from"./tsloader.config.js";import{resolveNodeModulesPath as f,resolveProgramPath as y}from"./utils.js";import{comment as g,getCommentPath as j}from"./vm/docs.js";import v from"./vm/generate-doc.js";let x=d?t:"../",$={loader:e.loader,options:{publicPath:"/"!==x?x:"../"}},h={loader:`${r.corePath}/loader/lightningcss.cjs`,options:{sourceMap:!!s.sourceMap,analyzeDependencies:!1,targets:p(),drafts:{nesting:!0,customMedia:!0},errorRecovery:!1,unusedSymbols:[],rem:!!s.rem}};l&&($="style-loader");let b=[...s.cssModules,`@moneko/${i}`,"neko-ui"].map(f),w=["components","example","mock","site","src","server"].map(y);a&&w.push(y(a)),s.overrideResolve&&s.overrideResolve.override&&w.push(s.overrideResolve.override);let _={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"},importLoaders:2}},M=[$,_,h,{loader:"less-loader",options:{sourceMap:!!s.sourceMap,lessOptions:{modifyVars:o,javascriptEnabled:!0}}},{loader:"style-resources-loader",options:{patterns:["src/styles/variables.less","src/styles/mixins.less","site/styles/variables.less","site/styles/mixins.less"].map(y)}}].filter(Boolean),k="tsc"===s.compiler;function B(e){return w.concat(s.rulesInclude?.[e]?.map(f)||[])}let P=B("css"),R=B("js"),L=B("media"),O=B("wasm"),I=B("font"),J={noParse:[/jquery|lodash|prismjs|prism\.js/,/react\.min\.js$/,/marked\.min\.js$/],rules:[n&&l&&{test:/^(?![._]).*(?<!\.test)\.(tsx?)$/,include:s.alias["@pkg"],exclude:[/node_modules/,/(.+)\/__tests__\/(.+)/i],enforce:"pre",loader:`${r.corePath}/loader/ts-doc.cjs`,options:{comment:g,generateDoc:v,getCommentPath:j}},{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=>m(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:I},{test:/\.(sa|sc)ss$/i,use:[$,_,h,{loader:"sass-loader",options:{implementation:await import("sass"),sassOptions:{}}}].filter(Boolean),include:P},{test:/\.less$/i,use:M,include:P},{test:/\.css$/i,use:[$,"css-loader",h].filter(Boolean),include:P},{test:/\.(cj|mj|t|j)s(|x)$/i,use:[...s.prefixJsLoader,{loader:k?"ts-loader":"swc-loader",options:k?u:c}].filter(Boolean),include:R},{test:/\.mdx?$/i,use:[...s.prefixJsLoader,{loader:`${r.corePath}/loader/mdx.cjs`,options:s.mdx}].filter(Boolean),exclude:[/node_modules/]},{type:"asset/source",include:[/(.+)\/examples\/(.+).*?$/i]}]},...s.moduleRules].filter(e=>"object"==typeof e)};export default J;
1
+ import e from"mini-css-extract-plugin";import{CONFIG as s,PUBLICPATH as t}from"./config.js";import o from"./modify-vars.js";import r,{CUSTOMCONFIG as a}from"./paths.js";import{FRAMEWORK as l,SSR as i,isDev as n,isLibrary as d,isMicro as m}from"./process-env.js";import c from"./svg-to-data-uri.js";import p from"./swcrc.js";import{getLightningCssTargets as u}from"./targets.js";import f from"./tsloader.config.js";import{resolveNodeModulesPath as y,resolveProgramPath as g}from"./utils.js";import{comment as j,getCommentPath as x}from"./vm/docs.js";import v from"./vm/generate-doc.js";let $=m?t:"../",h={loader:e.loader,options:{publicPath:"/"!==$?$:"../"}},b={loader:`${r.corePath}/loader/lightningcss.cjs`,options:{sourceMap:!!s.sourceMap,analyzeDependencies:!1,targets:u(),drafts:{nesting:!0,customMedia:!0},errorRecovery:!1,unusedSymbols:[],rem:!!s.rem}};n&&(h="style-loader");let w=[...s.cssModules,`@moneko/${l}`,"neko-ui"].map(y),_=["components","example","mock","site","src","server"].map(g);a&&_.push(g(a)),s.overrideResolve&&s.overrideResolve.override&&_.push(s.overrideResolve.override);let M={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",exportOnlyLocals:i},importLoaders:2}},k=[h,M,b,{loader:"less-loader",options:{sourceMap:!!s.sourceMap,lessOptions:{modifyVars:o,javascriptEnabled:!0}}},{loader:"style-resources-loader",options:{patterns:["src/styles/variables.less","src/styles/mixins.less","site/styles/variables.less","site/styles/mixins.less"].map(g)}}].filter(Boolean),B="tsc"===s.compiler;function L(e){return _.concat(s.rulesInclude?.[e]?.map(y)||[])}let O=L("css"),P=L("js"),R=L("media"),I=L("wasm"),J=L("font"),Q={noParse:[/jquery|lodash|prismjs|prism\.js/,/react\.min\.js$/,/marked\.min\.js$/],rules:[d&&n&&{test:/^(?![._]).*(?<!\.test)\.(tsx?)$/,include:s.alias["@pkg"],exclude:[/node_modules/,/(.+)\/__tests__\/(.+)/i],enforce:"pre",loader:`${r.corePath}/loader/ts-doc.cjs`,options:{comment:j,generateDoc:v,getCommentPath:x}},{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:I},{test:/\.txt$/i,type:"asset/source"},{test:/\.ico$/i,type:"asset/inline",include:R},{test:/\.svg$/i,type:"asset/inline",generator:{dataUrl:e=>c(e.toString())},include:R},{test:/\.(gif|png|jpe?g|webp)$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/images/[name][ext]"},include:R},{test:/\.(webm|mp4|ogv)$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/video/[name][ext]"},include:R},{test:/\.(woff2?|eot|ttf|otf)(\?.*)?$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/fonts/[name][ext]"},include:J},{test:/\.(sa|sc)ss$/i,use:[h,M,b,{loader:"sass-loader",options:{implementation:await import("sass"),sassOptions:{}}}].filter(Boolean),include:O},{test:/\.less$/i,use:k,include:O},{test:/\.css$/i,use:[h,"css-loader",b].filter(Boolean),include:O},{test:/\.(cj|mj|t|j)s(|x)$/i,use:[...s.prefixJsLoader,{loader:B?"ts-loader":"swc-loader",options:B?f:p}].filter(Boolean),include:P},{test:/\.mdx?$/i,use:[...s.prefixJsLoader,{loader:`${r.corePath}/loader/mdx.cjs`,options:s.mdx}].filter(Boolean),exclude:[/node_modules/]},{type:"asset/source",include:[/(.+)\/examples\/(.+).*?$/i]}]},...s.moduleRules].filter(e=>"object"==typeof e)};export default Q;
@@ -1 +1 @@
1
- import e from"webpack";let{sources:t}=e,r="ExternalRemotesPlugin";export default class{apply(e){e.hooks.make.tap(r,e=>{let n=[];e.hooks.buildModule.tap(r,e=>{"ExternalModule"===e.constructor.name&&"script"===e.externalType&&n.push(e)}),e.hooks.afterCodeGeneration.tap(r,function(){n.map(r=>{let n=function(e){let t=e.indexOf("@");if(t<=0||t===e.length-1)throw Error(`Invalid request "${e}"`);return[e.substring(t+1),e.substring(0,t)]}(r.request)[0],o=function(e){let t=[],r=[],n=!1,o=!1;for(let l of e)if("["===l){if(n){o=!0;break}n=!0,r.length&&(t.push(`"${r.join("")}"`),r.length=0)}else if("]"===l){if(!n){o=!0;break}n=!1,r.length&&(t.push(`${r.join("")}`),r.length=0),r.length=0}else r.push(l);if(n||o)throw Error(`Invalid template URL "${e}"`);return r.length&&t.push(`"${r.join("")}"`),t.join(" + ")}(n),l=e.codeGenerationResults.get(r,void 0).sources;l.set("javascript",new t.RawSource(l.get("javascript")?.source().replace(`"${n}"`,o)))})})})}}
1
+ import e from"webpack";let{sources:t}=e,r="ExternalRemotesPlugin";export default class{apply(e){e.hooks.make.tap(r,e=>{let n=[];e.hooks.buildModule.tap(r,e=>{"ExternalModule"===e.constructor.name&&"script"===e.externalType&&n.push(e)}),e.hooks.afterCodeGeneration.tap(r,function(){n.map(r=>{let n=function(e){let t=e.indexOf("@");if(t<=0||t===e.length-1)throw Error(`Invalid request "${e}"`);return[e.substring(t+1),e.substring(0,t)]}(r.request)[0],o=function(e){let t=[],r=[],n=!1,o=!1;for(let l of e)if("["===l){if(n){o=!0;break}n=!0,r.length&&(t.push(`"${r.join("")}"`),r.length=0)}else if("]"===l){if(!n){o=!0;break}n=!1,r.length&&(t.push(`${r.join("")}`),r.length=0),r.length=0}else r.push(l);if(n||o)throw Error(`Invalid template URL "${e}"`);return r.length&&t.push(`"${r.join("")}"`),t.join(" + ")}(n),l=e.codeGenerationResults.get(r,void 0).sources;l.set("javascript",new t.RawSource((l.get("javascript")?.source()).replace(`"${n}"`,o)))})})})}}
@@ -6,6 +6,7 @@ export declare const isMicro: boolean;
6
6
  export declare const isMobile: boolean;
7
7
  export declare const isReact: boolean;
8
8
  export declare const isSolid: boolean;
9
+ export declare const SSR: boolean;
9
10
  /** 项目主要文件夹 */
10
11
  export declare const mainDirectory: string;
11
12
  export declare const jsxImportSource: string;
@@ -1 +1 @@
1
- import o from"./paths.js";export const APPTYPE=process.env.APPTYPE;export const FRAMEWORK=process.env.FRAMEWORK;export const isLibrary="library"===APPTYPE;export const isMicro="micro"===APPTYPE;export const isMobile="mobile"===APPTYPE;export const isReact="react"===FRAMEWORK;export const isSolid="solid"===FRAMEWORK;export const mainDirectory=isLibrary?"site":"src";export const jsxImportSource={react:"react",solid:"solid-js/h"}[FRAMEWORK];export const PACKAGENAME=process.env.npm_package_name;export const PACKAGEVERSION=process.env.npm_package_version;export const coreName="@moneko/core";export const isDev="development"===process.env.NODE_ENV;export const routeDir=isLibrary?o.componentsPath:o.pagesPath;
1
+ import o from"./paths.js";export const APPTYPE=process.env.APPTYPE;export const FRAMEWORK=process.env.FRAMEWORK;export const isLibrary="library"===APPTYPE;export const isMicro="micro"===APPTYPE;export const isMobile="mobile"===APPTYPE;export const isReact="react"===FRAMEWORK;export const isSolid="solid"===FRAMEWORK;export const SSR=!!process.env.SSR;export const mainDirectory=isLibrary?"site":"src";export const jsxImportSource={react:"react",solid:"solid-js/h"}[FRAMEWORK];export const PACKAGENAME=process.env.npm_package_name;export const PACKAGEVERSION=process.env.npm_package_version;export const coreName="@moneko/core";export const isDev="development"===process.env.NODE_ENV;export const routeDir=isLibrary?o.componentsPath:o.pagesPath;
package/lib/prod.js CHANGED
@@ -1 +1 @@
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"webpackbar";import{clientConfig as p}from"./common.js";import{CONFIG as s}from"./config.js";import{getMinifyOption as l}from"./minify.js";import u from"./paths.js";import a from"./plugin/done.js";import c from"./plugin/lightningcss-plugin.js";import f from"./seo.js";let{optimize:{MinChunkSizePlugin:d,ModuleConcatenationPlugin:h}}=n,k=[];s.minifier&&(k.push(new m(l(s.minifier?.type||"swc",s.minifier?.options))),k.push(new c));let w={splitChunks:s.splitChunk,runtimeChunk:s.runtimeChunk,chunkIds:"named",moduleIds:"named",removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,mangleWasmImports:!0,minimize:!0,minimizer:k};n(r(p,{devtool:!1===s.devtool||s.devtool?s.devtool:"cheap-module-source-map",mode:"production",optimization:w,plugins:[new h,new o({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",experimentalUseImportModule:!0}),s.splitChunk&&new d({minChunkSize:1e4}),s.bundleAnalyzer&&new i(s.bundleAnalyzer),s.bar&&new t(s.bar),new a({done:e=>{s.done?.(e),s.seo&&f()}})].filter(Boolean)})).run(e=>{if(e)throw e}),process.on("exit",function(){e(u.cachePath)});
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"webpackbar";import{commonConfig as p}from"./common.js";import{CONFIG as s}from"./config.js";import{getMinifyOption as l}from"./minify.js";import u from"./paths.js";import a from"./plugin/done.js";import c from"./plugin/lightningcss-plugin.js";import f from"./seo.js";let{optimize:{MinChunkSizePlugin:d,ModuleConcatenationPlugin:h}}=n,k=[];s.minifier&&(k.push(new m(l(s.minifier?.type||"swc",s.minifier?.options))),k.push(new c));let w={splitChunks:s.splitChunk,runtimeChunk:s.runtimeChunk,chunkIds:"named",moduleIds:"named",removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,mangleWasmImports:!0,minimize:!0,minimizer:k};n(r(p,{devtool:!1===s.devtool||s.devtool?s.devtool:"cheap-module-source-map",mode:"production",optimization:w,plugins:[new h,new o({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",experimentalUseImportModule:!0}),s.splitChunk&&new d({minChunkSize:1e4}),s.bundleAnalyzer&&new i(s.bundleAnalyzer),s.bar&&new t(s.bar),new a({done:e=>{s.done?.(e),s.seo&&f()}})].filter(Boolean)})).run(e=>{if(e)throw e}),process.on("exit",function(){e(u.cachePath)});
package/lib/server.js CHANGED
@@ -1 +1 @@
1
- import e from"mini-css-extract-plugin";import m from"terser-webpack-plugin";import o from"webpack";import{merge as i}from"webpack-merge";import r from"webpack-node-externals";import n from"webpackbar";import{clientConfig as t}from"./common.js";import{CONFIG as s}from"./config.js";import{getMinifyOption as p}from"./minify.js";import a from"./paths.js";import l from"./plugin/lightningcss-plugin.js";let{optimize:{ModuleConcatenationPlugin:u}}=o,c=[];s.minifier&&(c.push(new m(p(s.minifier?.type||"swc",s.minifier?.options))),c.push(new l));let f={splitChunks:s.splitChunk,runtimeChunk:s.runtimeChunk,chunkIds:"named",moduleIds:"named",removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,mangleWasmImports:!0,minimize:!0,minimizer:c};o(i(t,{entry:{main:`${a.programPath}/site/ssr.tsx`},output:{path:`${process.cwd()}/ssr`,library:{type:"commonjs2"}},devtool:!1===s.devtool||s.devtool?s.devtool:"cheap-module-source-map",mode:"production",optimization:f,externals:r,target:"node",plugins:[new u,new e({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",experimentalUseImportModule:!0}),s.bar&&new n(s.bar)].filter(Boolean)})).run(e=>{if(e)throw e});
1
+ import{join as e}from"path";import o from"@loadable/webpack-plugin";import r from"mini-css-extract-plugin";import m from"webpack";import{merge as t}from"webpack-merge";import n from"webpack-node-externals";import a from"webpackbar";import{commonConfig as i}from"./common.js";import{CONFIG as s}from"./config.js";import p from"./paths.js";i.entry={},m(t(i,{entry:{ssr:e(p.programPath,"./site/ssr.tsx")},output:{path:e(p.programPath,"./ssr"),library:{type:"commonjs2"},filename:"[name].js",chunkFilename:"[name].js",globalObject:void 0,chunkLoadingGlobal:void 0},devtool:!1,mode:"production",plugins:[new o,new r({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",experimentalUseImportModule:!0}),new a({name:"Server"})].filter(Boolean),externals:[...n()].concat(s.externals||[]),target:"node"})).run((e,o)=>{if(e)throw e;o?.compilation.errors&&console.error(...o.compilation.errors)});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.9.17-beta.2",
3
+ "version": "3.9.17-beta.3",
4
4
  "description": "core",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",
@@ -13,11 +13,13 @@
13
13
  "author": "moneko",
14
14
  "license": "MIT",
15
15
  "dependencies": {
16
+ "@loadable/webpack-plugin": "5.15.2",
16
17
  "@moneko/mdx": "0.1.23",
17
18
  "@swc/core": "1.3.101",
18
19
  "add-asset-html-webpack-plugin": "6.0.0",
19
20
  "core-js": "3.34.0",
20
21
  "core-js-compat": "3.34.0",
22
+ "cors": "2.8.5",
21
23
  "cross-env": "7.0.3",
22
24
  "css-loader": "6.8.1",
23
25
  "html-webpack-plugin": "5.5.4",
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <title><%= htmlWebpackPlugin.options.title %></title>
5
+ <%
6
+ var customTag="";
7
+ if (htmlWebpackPlugin.options.tags) {
8
+ htmlWebpackPlugin.options.tags.forEach(function(item){
9
+ var { tag = "script", textContent = "", ...attrs } = item;
10
+ var _attrs = "";
11
+ for (const key in attrs) {
12
+ if (attrs.hasOwnProperty(key)) {
13
+ _attrs += `${key}="${attrs[key]}" `;
14
+ }
15
+ }
16
+ customTag += `<${tag} ${_attrs}>${textContent}</${tag}>`;
17
+ });
18
+ }
19
+ %>
20
+ <%= customTag %>
21
+ </head>
22
+ <body>
23
+ <!--ssr-outlet-->
24
+ </body>
25
+ </html>