@moneko/core 3.9.15 → 3.9.16-beta.2
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 +1 -1
- package/lib/common.js +1 -1
- package/lib/config.js +1 -1
- package/lib/dev.js +3 -3
- package/lib/html-plugin-option.js +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/module.config.js +1 -1
- package/lib/paths.d.ts +1 -0
- package/lib/paths.js +1 -1
- package/lib/plugin/virtual-module.js +1 -1
- package/lib/plugins.config.d.ts +3 -0
- package/lib/plugins.config.js +1 -0
- package/lib/process-env.d.ts +1 -3
- package/lib/process-env.js +1 -1
- package/lib/prod.js +1 -1
- package/lib/seo.js +1 -1
- package/lib/swcrc.d.ts +1 -1
- package/lib/swcrc.js +1 -1
- package/lib/utils.js +2 -2
- package/lib/vm/coverage.d.ts +2 -2
- package/lib/vm/coverage.js +1 -1
- package/lib/vm/docs.js +1 -1
- package/lib/vm/routes.js +1 -1
- package/package.json +2 -2
- package/template/index.html +1 -1
package/lib/common.d.ts
CHANGED
package/lib/common.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
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};
|
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
|
|
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};
|
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}=t,{yellow:
|
|
2
|
-
`);function
|
|
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.
|
|
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
|
+
${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
|
|
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;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { default as paths, CUSTOMCONFIG } from './paths.js';
|
|
2
|
-
export {
|
|
2
|
+
export { PACKAGENAME, PACKAGEVERSION, coreName, isDev, isLibrary, isMicro, mainDirectory, } from './process-env.js';
|
|
3
3
|
export { realResolve, resolveNodeModulesPath, resolveProgramPath, log } from './utils.js';
|
|
4
4
|
export { getIPv4, getPort } from './net.js';
|
|
5
5
|
export { default as osTmpDir } from './os-tmp-dir.js';
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{default as paths,CUSTOMCONFIG}from"./paths.js";export{
|
|
1
|
+
export{default as paths,CUSTOMCONFIG}from"./paths.js";export{PACKAGENAME,PACKAGEVERSION,coreName,isDev,isLibrary,isMicro,mainDirectory}from"./process-env.js";export{realResolve,resolveNodeModulesPath,resolveProgramPath,log}from"./utils.js";export{getIPv4,getPort}from"./net.js";export{default as osTmpDir}from"./os-tmp-dir.js";
|
package/lib/module.config.js
CHANGED
|
@@ -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
|
|
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;
|
package/lib/paths.d.ts
CHANGED
package/lib/paths.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"url";let
|
|
1
|
+
import e from"url";let c=JSON.parse(process.env.npm_config_argv||"{}")?.original;export const yarnArgv={};c?.forEach(e=>{let c=e.split("=");Object.assign(yarnArgv,{[c[0]]:c[1]||!0})});export const CUSTOMCONFIG=process.env.npm_config_config||yarnArgv.config;let o=process.cwd(),t=`${o}/node_modules`,a=`${t}/.cache/.mo`;export default{nodeModules:t,corePath:e.fileURLToPath(new URL(".",import.meta.url)),programPath:o,webpackCachePath:`${t}/.temp_cache`,cachePath:a,httpCachePath:`${t}/.cache/http`,swcCachePath:`${t}/.swc`,configPath:`${o}/config/index.ts`,customConfigPath:`${o}/config/${CUSTOMCONFIG}.ts`,coveragePath:`${o}/coverage/clover.xml`,pagesPath:`${o}/src/pages`,componentsPath:`${o}/components`};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{join as
|
|
1
|
+
import{join as o}from"path";import{getAppEntry as t,getAppFallback as e,getAppMdxScope as p,getAppMergeRouter as r,getAppNormalizeCss as a,getAppPrefixRouter as s,getAppRem as i,getAppSuspense as m}from"@moneko/mdx";import n from"webpack-virtual-modules";import{CONFIG as f}from"../config.js";import l from"../info.js";import c from"../paths.js";import{APPTYPE as h,FRAMEWORK as d,isLibrary as g}from"../process-env.js";import{resolveNodeModulesPath as u,resolveProgramPath as x}from"../utils.js";import j from"../vm/coverage.js";import{comment as v,docs as y,docsModuleName as k}from"../vm/docs.js";import{exampleModuleName as b,examples as w}from"../vm/example.js";import{locales as O,localesModuleName as P}from"../vm/locales.js";import{route as z,routesModuleName as D}from"../vm/routes.js";export default class{constructor(o){this.options=o,this.hasTapped=!1}apply(S){let T=new n({[u("@app/info")]:`export default ${JSON.stringify(l)}`,[u("@app/entry")]:t(o(f.alias["@"],"./index.ts"),!!f.rem,!!f.normalizeCss,h,d),[u("@app/rem")]:i(f.rem?.designSize||1680),[u("@app/fallback")]:e(f.fallbackCompPath),[u("@app/coverage")]:j(c.coveragePath),[u("@app/merge-router")]:r(),[u("@app/prefix-router")]:s(),[u("@app/normalize/index.css")]:a(),[u("@app/suspense/index.tsx")]:m(h,d),[u("@app/mdx-scope")]:p(x("site/mdx-scope.ts")),[u(D)]:z.getData(D),[u(b)]:"export default []",[u(P)]:O.getData(P),[u(k)]:y.getData(k)});function C(o,t){let e=u(o);T.writeModule(e,t||"")}T.apply(S),z.on("change",C),O.on("change",C),g&&(w.on("change",C),y.on("change",C),v.on("change",C)),S.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];C(o,"string"==typeof t?t:`export default ${JSON.stringify(t)}`)}for(let o of w)C(...o);for(let o of y)C(...o);for(let o of v)C(...o)}})}}
|
|
@@ -0,0 +1 @@
|
|
|
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.js";import i from"./html-plugin-option.js";import r from"./module-federation.js";import n from"./plugin/add-entry-attribute.js";import p from"./plugin/virtual-module.js";let{AutomaticPrefetchPlugin:a,DefinePlugin:s,SourceMapDevToolPlugin:m,IgnorePlugin:c}=l,h=o.basename.split("/").filter(Boolean).length,u=`${Array(h).fill("..").join("/")+(h?"/":"")}404.html`,{pathSegmentsToKeep:f=h,path:d=u}=o.fixBrowserRouter||{},w=o.assetHtml.map(e=>({publicPath:"",...e})),g=[...r,new p(o.virtualModule),new a,o.htmlPluginOption&&new t(i),o.fixBrowserRouter&&new t({filename:d,inject:!1,templateContent:()=>`<html lang="en"><head><title>${i.title}</title><script>const pathKeep = ${f||h};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(w),new n({test:/main\.bundle\.js$/}),new s({"process.env":JSON.stringify(o.env)}),new c({resourceRegExp:/\/__tests__\//}),o.sourceMap&&new m(o.sourceMap),...o.plugins].filter(e=>!!e);export default g;
|
package/lib/process-env.d.ts
CHANGED
|
@@ -9,9 +9,6 @@ export declare const isSolid: boolean;
|
|
|
9
9
|
/** 项目主要文件夹 */
|
|
10
10
|
export declare const mainDirectory: string;
|
|
11
11
|
export declare const jsxImportSource: string;
|
|
12
|
-
export declare const createElement: string;
|
|
13
|
-
/** 框架名称 */
|
|
14
|
-
export declare const FRAMEWORKNAME: string;
|
|
15
12
|
/** 应用名称 */
|
|
16
13
|
export declare const PACKAGENAME: string;
|
|
17
14
|
/** 版本号 */
|
|
@@ -20,3 +17,4 @@ export declare const PACKAGEVERSION: string;
|
|
|
20
17
|
export declare const coreName: string;
|
|
21
18
|
/** 是否为本地开发环境 */
|
|
22
19
|
export declare const isDev: boolean;
|
|
20
|
+
export declare const routeDir: string;
|
package/lib/process-env.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
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
|
|
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;
|
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
|
|
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)});
|
package/lib/seo.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{join as
|
|
1
|
+
import{join as o}from"path";import{saveFileSync as t,scanRouter as m,sitemap as r}from"@moneko/mdx";import{outputConfig as e}from"./common.js";import{CONFIG as p}from"./config.js";import{isLibrary as i,routeDir as s}from"./process-env.js";import{resolveProgramPath as f}from"./utils.js";export default(()=>{let{domain:n,nojekyll:a,path:j}=p.seo||{},l=j&&f(j)||e?.path;if(!n||!l)return;let x=`https://${n}${p.basename}`;t(o(l,"CNAME"),n),t(o(l,"robots"),`Sitemap: ${x}/sitemap.txt`),t(o(l,"sitemap.txt"),r(s,x,m(s,i)).join("\n")),a&&t(o(l,".nojekyll"),"")});
|
package/lib/swcrc.d.ts
CHANGED
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{
|
|
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{isDev as t,isReact as n,isSolid as i,jsxImportSource as p}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};let c={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&&t,development:t,importSource:p},optimizer:{simplify:!1}},minify:t?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),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||{})],i&&["@moneko/jsx-dom-expressions",o.jsxDomExpressions||{}]].filter(Boolean)}},sourceMaps:!0,parseMap:!0};o.polyfill&&(c.jsc.target=void 0,c.env={include:s(),mode:"entry",coreJs:"3.34"});export default e(c,"function"==typeof o.swcrc?o.swcrc(t):o.swcrc||{});
|
package/lib/utils.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{resolve as t}from"path";import
|
|
2
|
-
`)}):(
|
|
1
|
+
import{resolve as t}from"path";import o from"readline";import{saveFileSync as r}from"@moneko/mdx";import{transformFileSync as e}from"@swc/core";import n from"./paths.js";import c from"./resolver-sync.js";export function esm(t,...o){let r=t.raw[0];for(let e=0;e<o.length;e++)r+=o[e]+t.raw[e+1];return`data:text/javascript;base64,${Buffer.from(r).toString("base64")}`}let p={inputSourceMap:!1,sourceMaps:!1,module:{type:"es6"},jsc:{parser:{syntax:"typescript"},loose:!1}};export function log(t){Array.isArray(t)?t.forEach(t=>{log(`${t}
|
|
2
|
+
`)}):(o.cursorTo(process.stdout,0),process.stdout.write(t))}export function tfc(t){return e(t,p).code||"{}"}export function readConf(t,o){let e=`${n.cachePath}/${o}.mjs`;return r(e,tfc(t)),import(e)}export function toUpperCaseString(t){return t?.replace(/\b\w/g,t=>t.toUpperCase()).replace(/\./g," ")}export function resolveProgramPath(o){return t(n.programPath,`./${o}`)}export const resolveNodeModulesPath=t=>`${n.nodeModules}/${t}`;export const realResolve=t=>c.resolveSync({},n.programPath,t)||t;export function isObject(t){let o=typeof t;return null!==t&&("object"==o||"function"==o)}export function isFunction(t){if(!isObject(t))return!1;let o=Object.prototype.toString.call(t);return"[object Function]"==o||"[object AsyncFunction]"==o||"[object GeneratorFunction]"==o||"[object Proxy]"==o}export function empty(){}
|
package/lib/vm/coverage.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare
|
|
2
|
-
export default
|
|
1
|
+
declare function getCoverage(coveragePath: string): string;
|
|
2
|
+
export default getCoverage;
|
package/lib/vm/coverage.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fileExists as e,loadFileSync as r}from"@moneko/mdx";import{Parser as t}from"xml2js";import
|
|
1
|
+
import{fileExists as e,loadFileSync as r}from"@moneko/mdx";import{Parser as t}from"xml2js";import{PACKAGENAME as o}from"../process-env.js";export default function(c){let a={},i="export default {}";if(e(c))try{let e=r(c);(0,new t({explicitArray:!1,async:!1}).parseString)(e,(e,r)=>{e||(Object.assign(a,{[o]:r.coverage.project.metrics.$}),r.coverage.project.package.forEach(e=>{Object.assign(a,{[e.$.name]:e.metrics.$})})),i=`export default ${JSON.stringify(a)}`})}catch(e){}return i}
|
package/lib/vm/docs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{loadFileSync as e,scanFolder as t}from"@moneko/mdx";import o from"./generate-doc.js";import{CONFIG as r}from"../config.js";import{
|
|
1
|
+
import{loadFileSync as e,scanFolder as t}from"@moneko/mdx";import o from"./generate-doc.js";import{CONFIG as r}from"../config.js";import{FRAMEWORK as n,isLibrary as a,isReact as s,isSolid as p}from"../process-env.js";import m from"../reactive-object.js";let l={react:"createElement",solid:"createComponent"}[n];export const docsModuleName="@app/docs";export const docs=new m({[docsModuleName]:"export default {}"});export const comment=new m({});export const getCommentPath=function(){let e=/^\/?(.+?)\.tsx?$/,t=r.alias["@pkg"].length;return o=>o.substring(t).replace(e,"@app/comment/$1.md")}();if(a){let a={},m=`import { ${l}${p?",Dynamic":""} } from "${{react:"react",solid:"solid-js"}[n]}${p?"/web":""}";import SuspenseComp from "@app/suspense";function call_then(res) {return {default: ${s?"() =>":""}${l}(${p?"Dynamic":"'n-md'"}, {text: res.default, ${p?"component: 'n-md', ":""}css: 'table td a {display:inline-flex;align-items:center;gap:2px;}table td a n-img{display:inline-block;overflow:hidden;border-radius:var(--border-radius);inline-size:18px;block-size:18px;}' })};}`,c=(e,t)=>{let o=e.replace(/^@app\/comment\//,"").split("/"),r=o.pop(),n=o.join("/");a[n]||(a[n]={}),t?a[n][r]&&delete a[n][r]:a[n][r]=`rr(() => ${l}(SuspenseComp, { comp: () => import(/* webpackChunkName: '${e}' */ '${e}?raw').then(call_then)}))rr`;let s={};for(let e in a)Object.prototype.hasOwnProperty.call(a,e)&&(s[e]=Object.values(a[e]));docs.setData(docsModuleName,`${m}export default ${JSON.stringify(s).replace(/"rr\((.+?)\)rr"/g,"$1")}`)};comment.on("change",(e,t)=>{c(e,t?.length<0)}),t(r.alias["@pkg"]).filter(e=>/^(?![._]).*(?<!\.test)\.(tsx?)$/i.test(e)).forEach(t=>{let r=e(t);r&&comment.setData(getCommentPath(t),o(r,t))})}
|
package/lib/vm/routes.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{generateRouter as o}from"@moneko/mdx";import{watchFiles as e}from"./utils.js";import{CONFIG as t}from"../config.js";import
|
|
1
|
+
import{generateRouter as o}from"@moneko/mdx";import{watchFiles as e}from"./utils.js";import{CONFIG as t}from"../config.js";import{FRAMEWORK as r,isDev as s,isLibrary as m,routeDir as u}from"../process-env.js";import n from"../reactive-object.js";let i=m?"@pkg":"@/pages";export const routesModuleName="@app/routes";function p(){return o(u,`${t.alias["@"]}/router/index.ts`,r,i,m)}export const route=new n({[routesModuleName]:p()});export function generatorRouter(){route.setData(routesModuleName,p())}s&&e(u,m?/(?<!README\.mdx?)$/:/(?<!index\.tsx?)$/,generatorRouter);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.16-beta.2",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"author": "moneko",
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@moneko/mdx": "0.1.
|
|
16
|
+
"@moneko/mdx": "0.1.21",
|
|
17
17
|
"@swc/core": "1.3.100",
|
|
18
18
|
"add-asset-html-webpack-plugin": "6.0.0",
|
|
19
19
|
"core-js": "3.34.0",
|
package/template/index.html
CHANGED