@moneko/core 4.8.4 → 4.8.5-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{join as e,parse as t,relative as r,sep as o}from"node:path";import s from"webpack";import m from"../commom/module-resolve.mjs";import a from"../commom/paths.mjs";import{CONFIG as l}from"../config.mjs";import n from"../utils/fetch-module-federation-dts.mjs";import{resolveProgram as p}from"../utils/index.mjs";import{mf_vm as i}from"../vm/mf.mjs";import{ModuleFederationExposesDeclarationPlugin as f}from"./exposes-declararion.mjs";import{ExternalRemotesPlugin as h}from"./external-remotes.mjs";let u=s.NormalModuleReplacementPlugin,c=s.container.ModuleFederationPlugin,d={},$=[];function x(e,r){let s=e.replaceAll(o,"/").replace(/\.tsx?$/i,""),m=t(r);i.setData(s,{type:".tsx",source:()=>{if(r.startsWith(a.nodeModules)){let e=r.substring(a.nodeModules.length).split("node_modules").pop()?.replaceAll(o,"/").replace(/^\//,"");return`export * from '${e}';`}return r.startsWith(l.alias["@"])?`export * from '@/${t(m.dir).name}/${m.name}'`:"export {};"}})}let y=l.moduleFederation?.map(t=>{let o={},s={},l={};if(Array.isArray(t.remotes))for(let e=0,r=t.remotes.length;e<r;e++){let r=t.remotes[e],o=r.alias||r.name,m=r.filename||"remote_entry.js";if(s[o]=`${r.name}@${r.host}/${m}`,Array.isArray(r.library))for(let e=0,t=r.library.length;e<t;e++)d[r.library[e]]=`${o}/${r.library[e]}`;n(r.host,r.name)}if(Array.isArray(t.exposes)){t.exposes.length>0&&!t.exposes.find(e=>"public-path"===e)&&t.exposes.push({name:"public-path",path:`./${r(a.programPath,e(a.corePath,"./polyfills/public-path.mjs"))}`});for(let e=0,r=t.exposes.length;e<r;e++){let r=t.exposes[e];if("string"==typeof r){let e=r.startsWith(".");o[`./${r}`]=m(e?p(r):r),e&&(l[r]=o[`./${r}`],x(`${t.name}/${r}`,l[r]))}else if("[object Object]"===Object.prototype.toString.call(r)){let e=r.path.startsWith(".");o[`./${r.name}`]=m(e?p(r.path):r.path),e&&(l[`./${r.name}`]=o[`./${r.name}`],x(`${t.name}/${r.name}`,l[`./${r.name}`]))}}t.exposes?.length&&$.push(new f({exposes:l,name:t.name}))}return new c({filename:"remote_entry.js",...t,remotes:s,exposes:o})});y.length>0&&(y.push(new h),y.push(new u(/(.*)/,e=>{d[e.request]&&(e.request=d[e.request])})),$.forEach(e=>y.push(e))),l.env.injectRemoteReactRefresh=Object.keys(d).includes("react-dom");export default y;
1
+ import{join as e,parse as t,relative as r,sep as o}from"node:path";import s from"webpack";import m from"../commom/module-resolve.mjs";import a from"../commom/paths.mjs";import{CONFIG as l}from"../config.mjs";import{re_export_schema as p}from"../process-env.mjs";import n from"../utils/fetch-module-federation-dts.mjs";import{resolveProgram as i}from"../utils/index.mjs";import{mf_vm as f}from"../vm/mf.mjs";import{re_export_vm as h}from"../vm/re-export.mjs";import{ModuleFederationExposesDeclarationPlugin as u}from"./exposes-declararion.mjs";import{ExternalRemotesPlugin as c}from"./external-remotes.mjs";let d=s.NormalModuleReplacementPlugin,$=s.container.ModuleFederationPlugin,x={},j=[];function y(e,r){let s=e.replaceAll(o,"/").replace(/\.tsx?$/i,""),m=t(r);f.setData(s,{type:".tsx",source:()=>{if(r.startsWith(a.nodeModules)){let e=r.substring(a.nodeModules.length).split("node_modules").pop()?.replaceAll(o,"/").replace(/^\//,"");return`export * from '${e}';`}return r.startsWith(l.alias["@"])?`export * from '@/${t(m.dir).name}/${m.name}'`:"export {};"}})}let g=l.moduleFederation?.map(t=>{let o={},s={},l={};if(Array.isArray(t.remotes))for(let e=0,r=t.remotes.length;e<r;e++){let r=t.remotes[e],o=r.alias||r.name,m=r.filename||"remote_entry.js";if(s[o]=`${r.name}@${r.host}/${m}`,Array.isArray(r.library))for(let e=0,t=r.library.length;e<t;e++)x[r.library[e]]=`${o}/${r.library[e]}`;n(r.host,r.name)}if(Array.isArray(t.exposes)){t.exposes.length>0&&!t.exposes.find(e=>"public-path"===e)&&t.exposes.push({name:"public-path",path:`./${r(a.programPath,e(a.corePath,"./polyfills/public-path.mjs"))}`});for(let e=0,r=t.exposes.length;e<r;e++){let r=t.exposes[e];if("string"==typeof r){let e=r,s=r.startsWith(".");!s&&h.has(r)&&(e=`${p}:${r}`),o[`./${r}`]=m(s?i(e):e),s&&(l[r]=o[`./${r}`],y(`${t.name}/${r}`,l[r]))}else if("[object Object]"===Object.prototype.toString.call(r)){let e=r.path.startsWith(".");o[`./${r.name}`]=m(e?i(r.path):r.path),e&&(l[`./${r.name}`]=o[`./${r.name}`],y(`${t.name}/${r.name}`,l[`./${r.name}`]))}}t.exposes?.length&&j.push(new u({exposes:l,name:t.name}))}return new $({filename:"remote_entry.js",...t,remotes:s,exposes:o})});g.length>0&&(g.push(new c),g.push(new d(/(.*)/,e=>{x[e.request]&&(e.request=x[e.request])})),j.forEach(e=>g.push(e))),l.env.injectRemoteReactRefresh=Object.keys(x).includes("react-dom");export default g;
@@ -1 +1 @@
1
- import e from"webpack";import{CompressionPlugin as t}from"./plugin/compression.mjs";import{CopyPlugin as o}from"./plugin/copy.mjs";import{CssModuleDtsPlugin as i}from"./plugin/css-module-dts.mjs";import{HtmlPlugin as r}from"./plugin/html-plugin.mjs";import{ManifestPlugin as n}from"./plugin/manifest/index.mjs";import p from"./plugin/module-federation.mjs";import{VirtualModulePlugin as m}from"./plugin/virtual-module.mjs";import{app_vm as s}from"./vm/app.mjs";import{docs_vm as l}from"./vm/docs.mjs";import{example_vm as a}from"./vm/example.mjs";import{mf_vm as c}from"./vm/mf.mjs";import{scope_vm as h}from"./vm/scope.mjs";import{sw_vm as f}from"./vm/sw.mjs";import{virtual_vm as u}from"./vm/virtual.mjs";import{CONFIG as g}from"./config.mjs";import{app_schema as d,docs_schema as w,example_schema as j,isLibrary as v,module_federation_schema as b,packageJson as y,scope_schema as x,service_worker_schema as P,virtual_schema as O}from"./process-env.mjs";let k="object"==typeof g.compression?g.compression:{},R=[...p,new m(c,b),new m(s,d),new m(f,P),v&&new m(l,w),v&&new m(a,j),v&&new m(h,x),g.virtualModule&&new m(u,O),new o(g.copy),new e.EnvironmentPlugin(g.env),new e.DefinePlugin({"process.env":JSON.stringify(g.env)}),new e.IgnorePlugin({resourceRegExp:/\.d\.tsx?$/,contextRegExp:/\/(__(tests|mocks)__|test|spec|e2e)\//}),new i,...g.plugins].filter(Boolean);if(g.compression&&R.push(new t({algorithm:g.devServer.https?"brotli":"gzip",test:/\.(js|css|html|svg|ttf|woff|woff2|png|jpg|jpeg)$/,...k})),g.manifest&&R.push(new n(g.manifest)),g.htmlPluginOption){let e={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","mobile-web-app-capable":"yes",renderer:"webkit",description:y.description,keywords:Array.isArray(y.keywords)?y.keywords.toString():"","http-equiv":"refresh",viewport:"width=device-width, initial-scale=1"};g.seo&&(e.relCanonical={rel:"canonical",href:`https://${g.seo.domain}${g.basename}`}),g.htmlPluginOption.meta&&Object.assign(e,g.htmlPluginOption.meta),R.push(new r({...g.htmlPluginOption,meta:e}))}if(g.fixBrowserRouter){let e=g.basename.split("/").filter(Boolean).length,t=`${Array(e).fill("..").join("/")+(e?"/":"")}404.html`,o=g.fixBrowserRouter.pathSegmentsToKeep??e;R.push(new r({filename:g.fixBrowserRouter.path??t,inject:!1,templateContent:()=>`<html lang="en"><head><title>Redirect</title><script>const pathKeep = ${o};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>`}))}g.sourceMap&&R.push(new e.SourceMapDevToolPlugin(g.sourceMap));export default R;
1
+ import e from"webpack";import{CompressionPlugin as t}from"./plugin/compression.mjs";import{CopyPlugin as o}from"./plugin/copy.mjs";import{CssModuleDtsPlugin as i}from"./plugin/css-module-dts.mjs";import{HtmlPlugin as r}from"./plugin/html-plugin.mjs";import{ManifestPlugin as n}from"./plugin/manifest/index.mjs";import p from"./plugin/module-federation.mjs";import{VirtualModulePlugin as m}from"./plugin/virtual-module.mjs";import{app_vm as s}from"./vm/app.mjs";import{docs_vm as l}from"./vm/docs.mjs";import{example_vm as a}from"./vm/example.mjs";import{mf_vm as c}from"./vm/mf.mjs";import{re_export_vm as f}from"./vm/re-export.mjs";import{scope_vm as h}from"./vm/scope.mjs";import{sw_vm as u}from"./vm/sw.mjs";import{virtual_vm as g}from"./vm/virtual.mjs";import{CONFIG as d}from"./config.mjs";import{app_schema as w,docs_schema as j,example_schema as v,isLibrary as b,module_federation_schema as y,packageJson as x,re_export_schema as P,scope_schema as O,service_worker_schema as k,virtual_schema as R}from"./process-env.mjs";let $="object"==typeof d.compression?d.compression:{},A=[...p,new m(c,y),new m(s,w),new m(u,k),new m(f,P),b&&new m(l,j),b&&new m(a,v),b&&new m(h,O),d.virtualModule&&new m(g,R),new o(d.copy),new e.EnvironmentPlugin(d.env),new e.DefinePlugin({"process.env":JSON.stringify(d.env)}),new e.IgnorePlugin({resourceRegExp:/\.d\.tsx?$/,contextRegExp:/\/(__(tests|mocks)__|test|spec|e2e)\//}),new i,...d.plugins].filter(Boolean);if(d.compression&&A.push(new t({algorithm:d.devServer.https?"brotli":"gzip",test:/\.(js|css|html|svg|ttf|woff|woff2|png|jpg|jpeg)$/,...$})),d.manifest&&A.push(new n(d.manifest)),d.htmlPluginOption){let e={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","mobile-web-app-capable":"yes",renderer:"webkit",description:x.description,keywords:Array.isArray(x.keywords)?x.keywords.toString():"","http-equiv":"refresh",viewport:"width=device-width, initial-scale=1"};d.seo&&(e.relCanonical={rel:"canonical",href:`https://${d.seo.domain}${d.basename}`}),d.htmlPluginOption.meta&&Object.assign(e,d.htmlPluginOption.meta),A.push(new r({...d.htmlPluginOption,meta:e}))}if(d.fixBrowserRouter){let e=d.basename.split("/").filter(Boolean).length,t=`${Array(e).fill("..").join("/")+(e?"/":"")}404.html`,o=d.fixBrowserRouter.pathSegmentsToKeep??e;A.push(new r({filename:d.fixBrowserRouter.path??t,inject:!1,templateContent:()=>`<html lang="en"><head><title>Redirect</title><script>const pathKeep = ${o};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>`}))}d.sourceMap&&A.push(new e.SourceMapDevToolPlugin(d.sourceMap));export default A;
@@ -19,6 +19,7 @@ export declare const docs_schema = 'docs';
19
19
  export declare const example_schema = 'example';
20
20
  export declare const scope_schema = 'scope';
21
21
  export declare const service_worker_schema = 'sw';
22
+ export declare const re_export_schema = 're-export';
22
23
  export declare const module_federation_schema = 'mf';
23
24
  /** 项目主要文件夹 */ export declare const mainDirectory: 'site' | 'src';
24
25
  export declare const jsxImportSource: string;
@@ -1 +1 @@
1
- import o from"node:process";import e from"./commom/has-pkg.mjs";import r from"./commom/is-ci-environment.mjs";import{CUSTOMCONFIG as s}from"./commom/paths.mjs";import{readJson as t}from"./commom/read-json.mjs";import{convertToCamelCase as c,digest as m}from"./utils/index.mjs";export const packageJson=t(`${o.cwd()}/package.json`);delete packageJson.scripts;export const IS_WINDOW="win32"===o.platform;export const APPTYPE=o.env.APPTYPE;export const FRAMEWORK=o.env.FRAMEWORK??"react";export const NODE_ENV=o.env.NODE_ENV;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"===o.env.SSR;export const app_schema="app";export const virtual_schema="vm";export const docs_schema="docs";export const example_schema="example";export const scope_schema="scope";export const service_worker_schema="sw";export const module_federation_schema="mf";export const mainDirectory=isLibrary?"site":"src";export const jsxImportSource={react:"react",solid:"solid-js/h"}[FRAMEWORK];export const framework={react:"react",solid:"solid-js"}[FRAMEWORK];export const frameworkVersionStr=framework?t(`${framework}/package.json`).version:19;export const frameworkVersion=parseFloat(frameworkVersionStr);export const PACKAGENAME=packageJson.name;export const projectNameCamelCase=c(PACKAGENAME);export const coreName="@moneko/core";export const isDev="development"===NODE_ENV;export const refresh=!!(isDev&&e("solid"===FRAMEWORK?"solid-refresh":"react-refresh"));export const isCI=r();export const CACHE_NAME=m(`${PACKAGENAME}${s}${NODE_ENV}${o.argv[2]}`);
1
+ import o from"node:process";import e from"./commom/has-pkg.mjs";import r from"./commom/is-ci-environment.mjs";import{CUSTOMCONFIG as t}from"./commom/paths.mjs";import{readJson as s}from"./commom/read-json.mjs";import{convertToCamelCase as c,digest as p}from"./utils/index.mjs";export const packageJson=s(`${o.cwd()}/package.json`);delete packageJson.scripts;export const IS_WINDOW="win32"===o.platform;export const APPTYPE=o.env.APPTYPE;export const FRAMEWORK=o.env.FRAMEWORK??"react";export const NODE_ENV=o.env.NODE_ENV;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"===o.env.SSR;export const app_schema="app";export const virtual_schema="vm";export const docs_schema="docs";export const example_schema="example";export const scope_schema="scope";export const service_worker_schema="sw";export const re_export_schema="re-export";export const module_federation_schema="mf";export const mainDirectory=isLibrary?"site":"src";export const jsxImportSource={react:"react",solid:"solid-js/h"}[FRAMEWORK];export const framework={react:"react",solid:"solid-js"}[FRAMEWORK];export const frameworkVersionStr=framework?s(`${framework}/package.json`).version:19;export const frameworkVersion=parseFloat(frameworkVersionStr);export const PACKAGENAME=packageJson.name;export const projectNameCamelCase=c(PACKAGENAME);export const coreName="@moneko/core";export const isDev="development"===NODE_ENV;export const refresh=!!(isDev&&e("solid"===FRAMEWORK?"solid-refresh":"react-refresh"));export const isCI=r();export const CACHE_NAME=p(`${PACKAGENAME}${t}${NODE_ENV}${o.argv[2]}`);
@@ -0,0 +1,4 @@
1
+ import dayjs from 'dayjs';
2
+ import 'dayjs/locale/zh-cn';
3
+ export { extend, isDayjs, locale, unix } from 'dayjs';
4
+ export default dayjs;
@@ -0,0 +1 @@
1
+ import o from"dayjs";import"dayjs/locale/zh-cn";o.locale("zh-cn");export{extend,isDayjs,locale,unix}from"dayjs";export default o;
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ export{};
@@ -0,0 +1,4 @@
1
+ import ReactiveObject from '../commom/reactive-object.mjs';
2
+ import type { VirtualModules } from '../plugin/virtual-module.mjs';
3
+ export declare function reExport(name: string): string;
4
+ export declare const re_export_vm: ReactiveObject<VirtualModules>;
@@ -0,0 +1 @@
1
+ import{join as r}from"node:path";import{loadFileSync as t}from"@moneko/utils";import e from"../commom/paths.mjs";import o from"../commom/reactive-object.mjs";export function reExport(r){return`import * as Pkg from '${r}';export * from '${r}';export default Pkg;`}export const re_export_vm=new o({react:{type:".ts",source:()=>t(r(e.corePath,"./re-export/react.js"))||""},dayjs:{type:".ts",source:()=>t(r(e.corePath,"./re-export/dayjs.js"))||""},"react/jsx-runtime":{type:".ts",source:()=>reExport("react/jsx-runtime")},"react/jsx-dev-runtime":{type:".ts",source:()=>reExport("react/jsx-dev-runtime")},"react-dom":{type:".ts",source:()=>reExport("react-dom")},"react-dom/client":{type:".ts",source:()=>reExport("react-dom/client")},"react-router":{type:".ts",source:()=>reExport("react-router")},"react-router-dom":{type:".ts",source:()=>reExport("react-router-dom")},"neko-ui":{type:".ts",source:()=>reExport("neko-ui")},antd:{type:".ts",source:()=>reExport("antd")},"@ant-design/pro-components":{type:".ts",source:()=>reExport("@ant-design/pro-components")}});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "4.8.4",
3
+ "version": "4.8.5-beta.0",
4
4
  "description": "@moneko/core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",