@moneko/core 3.9.17-beta.13 → 3.9.17-beta.15
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/common.mjs +1 -1
- package/lib/dev/config.mjs +3 -3
- package/lib/index.d.mts +2 -2
- package/lib/index.mjs +1 -1
- package/lib/module.config.mjs +1 -1
- package/lib/options/favicon.ico +0 -0
- package/lib/{html-plugin-option.d.mts → options/html-plugin-option.d.mts} +1 -1
- package/lib/options/html-plugin-option.mjs +10 -0
- package/lib/{minify.d.mts → options/js-minify.d.mts} +1 -1
- package/lib/{modify-vars.d.mts → options/modify-vars.d.mts} +0 -1
- package/lib/options/modify-vars.mjs +1 -0
- package/lib/options/swcrc.mjs +1 -0
- package/lib/paths.d.mts +3 -2
- package/lib/paths.mjs +1 -1
- package/lib/plugin/add-entry-attribute.mjs +1 -1
- package/lib/plugin/module-federation.mjs +1 -0
- package/lib/plugins.config.mjs +1 -1
- package/lib/process-env.d.mts +0 -1
- package/lib/process-env.mjs +1 -1
- package/lib/utils/seo.mjs +1 -1
- package/lib/vm/routes.mjs +1 -1
- package/package.json +2 -3
- package/typings/global.d.ts +40 -0
- package/lib/html-plugin-option.mjs +0 -1
- package/lib/modify-vars.mjs +0 -1
- package/lib/module-federation.mjs +0 -1
- package/lib/swcrc.mjs +0 -1
- package/template/favicon.ico +0 -0
- package/template/index.html +0 -25
- package/template/index.ssr.html +0 -25
- /package/lib/{minify.mjs → options/js-minify.mjs} +0 -0
- /package/lib/{swcrc.d.mts → options/swcrc.d.mts} +0 -0
- /package/lib/{module-federation.d.mts → plugin/module-federation.d.mts} +0 -0
package/lib/build/common.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"mini-css-extract-plugin";import i from"terser-webpack-plugin";import m from"webpack";import{BundleAnalyzerPlugin as n}from"webpack-bundle-analyzer";import{merge as r}from"webpack-merge";import{commonConfig as o}from"../common.mjs";import{CONFIG as t}from"../config.mjs";import{getMinifyOption as l}from"../minify.mjs";import p from"../plugin/lightningcss-plugin.mjs";let{optimize:{MinChunkSizePlugin:s,ModuleConcatenationPlugin:u}}=m,a=r(o,{plugins:[new u,new e({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",experimentalUseImportModule:!0}),t.splitChunk&&new s({minChunkSize:1e4}),t.bundleAnalyzer&&new n(t.bundleAnalyzer)].filter(Boolean),optimization:{splitChunks:t.splitChunk,runtimeChunk:t.runtimeChunk,chunkIds:"named",moduleIds:"named",removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,mangleWasmImports:!0,minimize:!0,minimizer:!!t.minifier&&[new i(l(t.minifier?.type||"swc",t.minifier?.options)),new p]||[]}});export default a;
|
|
1
|
+
import e from"mini-css-extract-plugin";import i from"terser-webpack-plugin";import m from"webpack";import{BundleAnalyzerPlugin as n}from"webpack-bundle-analyzer";import{merge as r}from"webpack-merge";import{commonConfig as o}from"../common.mjs";import{CONFIG as t}from"../config.mjs";import{getMinifyOption as l}from"../options/js-minify.mjs";import p from"../plugin/lightningcss-plugin.mjs";let{optimize:{MinChunkSizePlugin:s,ModuleConcatenationPlugin:u}}=m,a=r(o,{plugins:[new u,new e({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",experimentalUseImportModule:!0}),t.splitChunk&&new s({minChunkSize:1e4}),t.bundleAnalyzer&&new n(t.bundleAnalyzer)].filter(Boolean),optimization:{splitChunks:t.splitChunk,runtimeChunk:t.runtimeChunk,chunkIds:"named",moduleIds:"named",removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,mangleWasmImports:!0,minimize:!0,minimizer:!!t.minifier&&[new i(l(t.minifier?.type||"swc",t.minifier?.options)),new p]||[]}});export default a;
|
package/lib/dev/config.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
`);function g(
|
|
3
|
-
${c(" Network ")} ${$(g("net"))}`;export function devLog(t
|
|
1
|
+
import o from"chalk";import{getIPv4 as t,getPort as e}from"./net.mjs";import{CONFIG as r}from"../config.mjs";import i from"../utils/log.mjs";let{yellow:n,green:s,grey:l,gray:m,bgBlue:a,bgGreenBright:c,blueBright:p,greenBright:$}=o,u=r.devServer||{},f=u.port||3e3;export const PORT=await e(f,65535,u.host);u.port=PORT;let T="/"===r.basename?"":r.basename,d=u.port!==PORT&&m(`Port ${n(f)} is in use, trying ${s(PORT)} instead.
|
|
2
|
+
`);function g(o){return`http://${"local"===o?u.host:t()}:${PORT}${T}`}let h=m("You application is running here:"),O=`${a(" Local ")} ${p(g("local"))}
|
|
3
|
+
${c(" Network ")} ${$(g("net"))}`;export function devLog(o,t){!o&&t&&(i([h,"",O,"",l(`Compiled successfully in ${s(`${t.endTime-t.startTime}ms`)}`)]),d&&i(d))}export const headers={"Access-Control-Allow-Origin":"*"};
|
package/lib/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { default as paths, CUSTOMCONFIG } from './paths.mjs';
|
|
2
|
-
export { PACKAGENAME, PACKAGEVERSION, coreName, isDev, isLibrary, isMicro, mainDirectory, } from './process-env.mjs';
|
|
1
|
+
export { default as paths, CUSTOMCONFIG, yarnArgv, routeDir } from './paths.mjs';
|
|
2
|
+
export { APPTYPE, FRAMEWORK, PACKAGENAME, PACKAGEVERSION, coreName, isDev, isLibrary, isMicro, mainDirectory, } from './process-env.mjs';
|
|
3
3
|
export { realResolve, resolveNodeModulesPath, resolveProgramPath } from './utils/index.mjs';
|
|
4
4
|
export { default as log } from './utils/log.mjs';
|
|
5
5
|
export { default as hasPkg } from './utils/has-pkg.mjs';
|
package/lib/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{default as paths,CUSTOMCONFIG}from"./paths.mjs";export{PACKAGENAME,PACKAGEVERSION,coreName,isDev,isLibrary,isMicro,mainDirectory}from"./process-env.mjs";export{realResolve,resolveNodeModulesPath,resolveProgramPath}from"./utils/index.mjs";export{default as log}from"./utils/log.mjs";export{default as hasPkg}from"./utils/has-pkg.mjs";export{default as osTmpDir}from"./utils/os-tmp-dir.mjs";export{yApiMock,yApiSchemaMock}from"./dev/mock.mjs";export{getIPv4,getPort}from"./dev/net.mjs";
|
|
1
|
+
export{default as paths,CUSTOMCONFIG,yarnArgv,routeDir}from"./paths.mjs";export{APPTYPE,FRAMEWORK,PACKAGENAME,PACKAGEVERSION,coreName,isDev,isLibrary,isMicro,mainDirectory}from"./process-env.mjs";export{realResolve,resolveNodeModulesPath,resolveProgramPath}from"./utils/index.mjs";export{default as log}from"./utils/log.mjs";export{default as hasPkg}from"./utils/has-pkg.mjs";export{default as osTmpDir}from"./utils/os-tmp-dir.mjs";export{yApiMock,yApiSchemaMock}from"./dev/mock.mjs";export{getIPv4,getPort}from"./dev/net.mjs";
|
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 a,{CUSTOMCONFIG as
|
|
1
|
+
let e;import s from"mini-css-extract-plugin";import{CONFIG as t,PUBLICPATH as o}from"./config.mjs";import r from"./options/modify-vars.mjs";import a from"./options/swcrc.mjs";import i,{CUSTOMCONFIG as l}from"./paths.mjs";import{getLightningCssTargets as n}from"./polyfills/targets.mjs";import{FRAMEWORK as m,isDev as d,isLibrary as c,isMicro as p}from"./process-env.mjs";import u from"./utils/has-pkg.mjs";import{resolveNodeModulesPath as f,resolveProgramPath as y}from"./utils/index.mjs";import g from"./utils/svg-to-data-uri.mjs";import{comment as j,getCommentPath as $}from"./vm/docs.mjs";import v from"./vm/generate-doc.mjs";let x=p?o:"../",h={loader:s.loader,options:{publicPath:"/"!==x?x:"../"}},w={loader:`${i.corePath}/loader/lightningcss.cjs`,options:{sourceMap:!!t.sourceMap,analyzeDependencies:!1,targets:n(),drafts:{nesting:!0,customMedia:!0},errorRecovery:!1,unusedSymbols:[],rem:!!t.rem}};d&&(h="style-loader");let b=[...t.cssModules,`@moneko/${m}`,"neko-ui"].map(f),_=["components","example","mock","site","src","server"].map(y);function k(e){return _.concat(t.rulesInclude?.[e]?.map(f)||[])}l&&_.push(y(l)),t.overrideResolve&&t.overrideResolve.override&&_.push(t.overrideResolve.override);let M=k("css"),O=k("js"),R=k("media"),L=k("wasm"),P=k("font");u("sass")&&(e={loader:"sass-loader",options:{implementation:await import("sass"),sassOptions:{}}});let B=c&&d&&{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:v,getCommentPath:$}},I=[{resourceQuery:/raw/i,type:"asset/source"},{resourceQuery:/url/i,type:"asset/resource",generator:{filename:e=>{let s=e.filename;return s&&s.endsWith("wasm?url")?"wasm/[name][ext]":"assets/[name][ext]"}}},{test:/\.wasm$/i,type:"webassembly/async",include:L},{test:/\.txt$/i,type:"asset/source"},{test:/\.ico$/i,type:"asset/inline",include:R},{test:/\.svg$/i,type:"asset/inline",generator:{dataUrl:e=>g(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:P}],Q=[/jquery|lodash|prismjs|prism\.js/,/react\.min\.js$/,/marked\.min\.js$/],S=/(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i,q=/(^(?!.*node_modules))(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i,z=t.prefixJsLoader.filter(Boolean)||[];export default(s=>{let o={loader:"swc-loader",options:a(s)},l={loader:"css-loader",options:{modules:{auto:e=>{for(let s=0,t=b.length;s<t;s++)if(e&&e?.includes(b[s]))return S.test(e);return q.test(e)},localIdentName:"[path][name]_[local]",exportLocalsConvention:"dashesOnly",exportOnlyLocals:s},importLoaders:2}};return{noParse:Q,rules:[B,{oneOf:[...I,{test:/\.(cj|mj|t|j)s(|x)$/i,use:[...z,o],include:O},{test:/\.css$/i,use:[h,"css-loader",w],include:M},e&&{test:/\.(sa|sc)ss$/i,use:[h,l,w,e],include:M},{test:/\.less$/i,use:[h,l,w,{loader:"less-loader",options:{sourceMap:!!t.sourceMap,lessOptions:{modifyVars:r,javascriptEnabled:!0}}}],include:M},{test:/\.mdx?$/i,use:[...z,{loader:`${i.corePath}/loader/mdx.cjs`,options:t.mdx}],exclude:[/node_modules/]}].filter(Boolean)},...t.moduleRules].filter(e=>"object"==typeof e)}});
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import{merge as e}from"webpack-merge";import{CONFIG as t}from"../config.mjs";import{PACKAGENAME as i,coreName as o}from"../process-env.mjs";import{resolveProgramPath as m}from"../utils/index.mjs";import{description as r,keywords as a}from"../vm/info.mjs";let{favicon:n=`node_modules/${o}/lib/options/favicon.ico`,template:p,...l}=t.htmlPluginOption||{},s=e({title:t.env?.PROJECTNAME||i.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:r,keywords:a},tags:[],favicon:n?m(n):n},l,p?{template:p?m(p):void 0}:{templateContent:function({htmlWebpackPlugin:{options:e}}){let t=e.tags,i="",o="";return t&&t.map(function(e){let{tag:t="script",textContent:m="",inject:r="head",...a}=e,n="";for(let e in a)Object.prototype.hasOwnProperty.call(a,e)&&(n+=`${e}="${a[e]}" `);let p=`<${t} ${n}>${m}</${t}>`;"body"===r?o+=p:i+=p}),`<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
${i}
|
|
5
|
+
</head>
|
|
6
|
+
<body>
|
|
7
|
+
<div id="root"></div>
|
|
8
|
+
${o}
|
|
9
|
+
</body>
|
|
10
|
+
</html>`}});export default s;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import TerserPlugin from 'terser-webpack-plugin';
|
|
2
|
-
import type { MinifierType, SwcMinifyOptions, TerserMinifyOptions } from '
|
|
2
|
+
import type { MinifierType, SwcMinifyOptions, TerserMinifyOptions } from '../index.mjs';
|
|
3
3
|
type MinifyObject = {
|
|
4
4
|
terser: {
|
|
5
5
|
minify: typeof TerserPlugin.terserMinify;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{CONFIG as i}from"../config.mjs";let f=i.prefixCls||"n",e={"@prefix-cls":f,"@ant-prefix":f,"@iconfont-css-prefix":`${f}-icon`};Object.assign(e,i.modifyVars);export default e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{merge as e}from"webpack-merge";import{CONFIG as o}from"../config.mjs";import r from"../paths.mjs";import s from"../polyfills/polyfills.mjs";import{isDev as t,isReact as l,isSolid as n,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};let p=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||{}),m={include:s(),mode:"entry",coreJs:"3.34"};export default(s=>e({module:{type:"es6",resolveFully:!0},jsc:{parser:{syntax:"typescript",tsx:!0,decorators:!0,dynamicImport:!0},loose:!0,target:o.polyfill?void 0:"es2017",externalHelpers:!1,transform:{legacyDecorator:!0,decoratorMetadata:!0,react:{runtime:"automatic",throwIfNamespace:!0,refresh:l&&t,development:t,importSource:i},optimizer:{simplify:!1}},minify:t?void 0:swcMinifyOption,experimental:{emitAssertForImportAttributes:!0,cacheRoot:r.swcCachePath,plugins:[["swc-plugin-another-transform-imports",p],n&&["@moneko/jsx-dom-expressions",{...o.jsxDomExpressions,generate:s?"ssr":"dom",hydratable:!!s}]].filter(Boolean)}},env:o.polyfill?m:void 0,sourceMaps:!0,parseMap:!0},"function"==typeof o.swcrc?o.swcrc(t):o.swcrc||{}));
|
package/lib/paths.d.mts
CHANGED
|
@@ -9,7 +9,7 @@ export declare const yarnArgv: Record<string, string> & {
|
|
|
9
9
|
* ```
|
|
10
10
|
*/
|
|
11
11
|
export declare const CUSTOMCONFIG: string | undefined;
|
|
12
|
-
declare const
|
|
12
|
+
declare const paths: {
|
|
13
13
|
nodeModules: string;
|
|
14
14
|
corePath: string;
|
|
15
15
|
programPath: string;
|
|
@@ -24,4 +24,5 @@ declare const _default: {
|
|
|
24
24
|
componentsPath: string;
|
|
25
25
|
mockPath: string;
|
|
26
26
|
};
|
|
27
|
-
export
|
|
27
|
+
export declare const routeDir: string;
|
|
28
|
+
export default paths;
|
package/lib/paths.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"url";let
|
|
1
|
+
import e from"url";let o=JSON.parse(process.env.npm_config_argv||"{}")?.original;export const yarnArgv={};o?.forEach(e=>{let o=e.split("=");Object.assign(yarnArgv,{[o[0]]:o[1]||!0})});export const CUSTOMCONFIG=process.env.npm_config_config||yarnArgv.config;let t=process.cwd(),c=`${t}/node_modules`,a={nodeModules:c,corePath:e.fileURLToPath(new URL(".",import.meta.url)),programPath:t,webpackCachePath:`${c}/.temp_cache`,cachePath:`${c}/.cache/.mo`,httpCachePath:`${c}/.cache/http`,swcCachePath:`${c}/.swc`,configPath:`${t}/config/index.ts`,customConfigPath:`${t}/config/${CUSTOMCONFIG}.ts`,coveragePath:`${t}/coverage/clover.xml`,pagesPath:`${t}/src/pages`,componentsPath:`${t}/components`,mockPath:`${t}/mock`};export const routeDir="library"===process.env.APPTYPE?a.componentsPath:a.pagesPath;export default a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export default class{constructor(t){this.test=t.test}apply(t){t.hooks.compilation.tap("AddEntryAttributeWebpackPlugin",s=>{let e=t.options.plugins.find(({constructor:t})=>t&&"HtmlWebpackPlugin"===t.name);e&&e.getHooks(s).alterAssetTagGroups.tap("AddEntryAttributeWebpackPlugin",t=>(t.headTags.forEach(t=>{"script"===t.tagName&&t.attributes.src&&this.test.test(t.attributes.src)&&(t.attributes.entry=!0)}),t))})}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"webpack";import r from"./external-remotes.mjs";import{CONFIG as t}from"../config.mjs";import{realResolve as o}from"../utils/index.mjs";let{NormalModuleReplacementPlugin:s,container:{ModuleFederationPlugin:a}}=e,m={},i={},l={},n=t.moduleFederation?.map(e=>{if(Array.isArray(e.remotes))for(let r=0,t=e.remotes.length;r<t;r++){let t=e.remotes[r],o=t.alias||t.name,s=t.filename||"remote_entry.js";if(l[o]=`${t.name}@${t.host}/${s}`,Array.isArray(t.library))for(let e=0,r=t.library.length;e<r;e++)m[t.library[e]]=`${o}/${t.library[e]}`}if(Array.isArray(e.exposes))for(let r=0,t=e.exposes.length;r<t;r++){let t=e.exposes[r];"string"==typeof t?i[`./${t}`]=o(t):"[object Object]"===Object.prototype.toString.call(t)&&(i[`./${t.name}`]=o(t.path))}return new a({filename:"remote_entry.js",...e,remotes:l,exposes:i})});n.length&&(n.push(new r),n.push(new s(/(.*)/,e=>{m[e.request]&&(e.request=m[e.request])})));export default n;
|
package/lib/plugins.config.mjs
CHANGED
|
@@ -1 +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.mjs";import i from"./html-plugin-option.mjs";import
|
|
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"./options/html-plugin-option.mjs";import n from"./plugin/add-entry-attribute.mjs";import p from"./plugin/module-federation.mjs";import r 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$/]}),...p,new r(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/process-env.d.mts
CHANGED
package/lib/process-env.mjs
CHANGED
|
@@ -1 +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 SSR="true"===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;
|
package/lib/utils/seo.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{join as m}from"path";import{saveFileSync as o,scanRouter as t,sitemap as r}from"@moneko/mdx";import{resolveProgramPath as e}from"./index.mjs";import{outputConfig as p}from"../common.mjs";import{CONFIG as i}from"../config.mjs";import{
|
|
1
|
+
import{join as m}from"path";import{saveFileSync as o,scanRouter as t,sitemap as r}from"@moneko/mdx";import{resolveProgramPath as e}from"./index.mjs";import{outputConfig as p}from"../common.mjs";import{CONFIG as i}from"../config.mjs";import{routeDir as s}from"../paths.mjs";import{isLibrary as f}from"../process-env.mjs";export default(()=>{let{domain:n,nojekyll:a,path:j}=i.seo||{},l=j&&e(j)||p?.path;if(!n||!l)return;let x=`https://${n}${i.basename}`;o(m(l,"CNAME"),n),o(m(l,"robots"),`Sitemap: ${x}/sitemap.txt`),o(m(l,"sitemap.txt"),r(s,x,t(s,f)).join("\n")),a&&o(m(l,".nojekyll"),"")});
|
package/lib/vm/routes.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{generateRouter as o}from"@moneko/mdx";import{watchFiles as e}from"./utils.mjs";import{CONFIG as t}from"../config.mjs";import{
|
|
1
|
+
import{generateRouter as o}from"@moneko/mdx";import{watchFiles as e}from"./utils.mjs";import{CONFIG as t}from"../config.mjs";import{routeDir as r}from"../paths.mjs";import{FRAMEWORK as m,isDev as s,isLibrary as u}from"../process-env.mjs";import i from"../utils/reactive-object.mjs";let n=u?"@pkg":"@/pages";export const routesModuleName="@app/routes";function p(){return o(r,`${t.alias["@"]}/router/index.ts`,m,n,u)}export const route=new i({[routesModuleName]:p()});export function generatorRouter(){route.setData(routesModuleName,p())}s&&e(r,u?/(?<!README\.mdx?)$/:/(?<!index\.tsx?)$/,generatorRouter);
|
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.15",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"swc-loader": "0.2.3",
|
|
38
38
|
"swc-plugin-another-transform-imports": "0.2.7",
|
|
39
39
|
"typescript": "5.3.3",
|
|
40
|
-
"webpack": "5.
|
|
40
|
+
"webpack": "5.77.0",
|
|
41
41
|
"webpack-bundle-analyzer": "4.10.1",
|
|
42
42
|
"webpack-dev-middleware": "6.1.1",
|
|
43
43
|
"webpack-hot-middleware": "2.25.4",
|
|
@@ -60,7 +60,6 @@
|
|
|
60
60
|
},
|
|
61
61
|
"files": [
|
|
62
62
|
"lib",
|
|
63
|
-
"template",
|
|
64
63
|
"typings/global.d.ts",
|
|
65
64
|
"typings/bundle-analyzer.d.ts"
|
|
66
65
|
]
|
package/typings/global.d.ts
CHANGED
|
@@ -22,9 +22,49 @@ export type MinifierType = 'swc' | 'terser';
|
|
|
22
22
|
export declare type AppType = 'mobile' | 'site' | 'backstage' | 'micro' | 'library';
|
|
23
23
|
export declare type Framework = 'react' | 'solid';
|
|
24
24
|
export type HtmlWebpackOption = HtmlWebpackPluginOptions & {
|
|
25
|
+
/**
|
|
26
|
+
* 自定义额外的 tags, 当需要添加远程cdn时很有用
|
|
27
|
+
* @description
|
|
28
|
+
* 如果你配置了自定义的 template, 那么默认情况下 tags 将不生效, 请在你的 template 中按照下方案例进行修改
|
|
29
|
+
* @example
|
|
30
|
+
* ```html
|
|
31
|
+
* <!DOCTYPE html>
|
|
32
|
+
<html lang="en">
|
|
33
|
+
<head>
|
|
34
|
+
<title><%= htmlWebpackPlugin.options.title %></title>
|
|
35
|
+
<%
|
|
36
|
+
var customTag="";
|
|
37
|
+
if (htmlWebpackPlugin.options.tags) {
|
|
38
|
+
htmlWebpackPlugin.options.tags.forEach(function(item){
|
|
39
|
+
var { tag = "script", textContent = "", ...attrs } = item;
|
|
40
|
+
var _attrs = "";
|
|
41
|
+
for (const key in attrs) {
|
|
42
|
+
if (attrs.hasOwnProperty(key)) {
|
|
43
|
+
_attrs += `${key}="${attrs[key]}" `;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
customTag += `<${tag} ${_attrs}>${textContent}</${tag}>`;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
%>
|
|
50
|
+
<%= customTag %>
|
|
51
|
+
</head>
|
|
52
|
+
<body>
|
|
53
|
+
<div id="root"></div>
|
|
54
|
+
</body>
|
|
55
|
+
</html>
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
25
58
|
tags?: {
|
|
59
|
+
/**
|
|
60
|
+
* 标签内容
|
|
61
|
+
*/
|
|
26
62
|
textContent?: string;
|
|
63
|
+
/** 标签
|
|
64
|
+
* @default script
|
|
65
|
+
*/
|
|
27
66
|
tag?: string;
|
|
67
|
+
inject?: 'body' | 'head';
|
|
28
68
|
[key: string]: string | null | boolean | number;
|
|
29
69
|
}[];
|
|
30
70
|
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{merge as e}from"webpack-merge";import{CONFIG as t}from"./config.mjs";import{PACKAGENAME as i,coreName as o}from"./process-env.mjs";import{resolveProgramPath as m}from"./utils/index.mjs";import{description as r,keywords as a}from"./vm/info.mjs";let p=t.htmlPluginOption||{},n=p.favicon||`node_modules/${o}/template/favicon.ico`,l=p.template||`node_modules/${o}/template/index.html`,s=e({title:t.env?.PROJECTNAME||i.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:r,keywords:a},tags:[]},p,{template:m(l),favicon:m(n)});export default s;
|
package/lib/modify-vars.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{CONFIG as i}from"./config.mjs";import o from"./html-plugin-option.mjs";let f=i.prefixCls||"n",n={"@prefix-cls":f,"@ant-prefix":f,"@iconfont-css-prefix":`${f}-icon`,"@favicon":JSON.stringify(o.favicon)};Object.assign(n,i.modifyVars);export default n;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"webpack";import{CONFIG as r}from"./config.mjs";import t from"./plugin/external-remotes.mjs";import{realResolve as o}from"./utils/index.mjs";let{NormalModuleReplacementPlugin:s,container:{ModuleFederationPlugin:a}}=e,i={},m={},l={},n=r.moduleFederation?.map(e=>{if(Array.isArray(e.remotes))for(let r=0,t=e.remotes.length;r<t;r++){let t=e.remotes[r],o=t.alias||t.name,s=t.filename||"remote_entry.js";if(l[o]=`${t.name}@${t.host}/${s}`,Array.isArray(t.library))for(let e=0,r=t.library.length;e<r;e++)i[t.library[e]]=`${o}/${t.library[e]}`}if(Array.isArray(e.exposes))for(let r=0,t=e.exposes.length;r<t;r++){let t=e.exposes[r];"string"==typeof t?m[`./${t}`]=o(t):"[object Object]"===Object.prototype.toString.call(t)&&(m[`./${t.name}`]=o(t.path))}return new a({filename:"remote_entry.js",...e,remotes:l,exposes:m})});n.length&&(n.push(new t),n.push(new s(/(.*)/,e=>{i[e.request]&&(e.request=i[e.request])})));export default n;
|
package/lib/swcrc.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{merge as e}from"webpack-merge";import{CONFIG as o}from"./config.mjs";import r from"./paths.mjs";import s from"./polyfills/polyfills.mjs";import{isDev as t,isReact as l,isSolid as n,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};let p=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||{}),m={include:s(),mode:"entry",coreJs:"3.34"};export default(s=>e({module:{type:"es6",resolveFully:!0},jsc:{parser:{syntax:"typescript",tsx:!0,decorators:!0,dynamicImport:!0},loose:!0,target:o.polyfill?void 0:"es2017",externalHelpers:!1,transform:{legacyDecorator:!0,decoratorMetadata:!0,react:{runtime:"automatic",throwIfNamespace:!0,refresh:l&&t,development:t,importSource:i},optimizer:{simplify:!1}},minify:t?void 0:swcMinifyOption,experimental:{emitAssertForImportAttributes:!0,cacheRoot:r.swcCachePath,plugins:[["swc-plugin-another-transform-imports",p],n&&["@moneko/jsx-dom-expressions",{...o.jsxDomExpressions,generate:s?"ssr":"dom",hydratable:!!s}]].filter(Boolean)}},env:o.polyfill?m:void 0,sourceMaps:!0,parseMap:!0},"function"==typeof o.swcrc?o.swcrc(t):o.swcrc||{}));
|
package/template/favicon.ico
DELETED
|
Binary file
|
package/template/index.html
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
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
|
-
<div id="root"></div>
|
|
24
|
-
</body>
|
|
25
|
-
</html>
|
package/template/index.ssr.html
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
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>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|