@moneko/core 4.3.0 → 4.3.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.
@@ -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 p}from"./plugin/manifest/index.mjs";import n from"./plugin/module-federation.mjs";import{VirtualModulePlugin as s}from"./plugin/virtual-module.mjs";import{app_vm as m}from"./vm/app.mjs";import{docs_vm as l}from"./vm/docs.mjs";import{example_vm as a}from"./vm/example.mjs";import{scope_vm as c}from"./vm/scope.mjs";import{sw_vm as h}from"./vm/sw.mjs";import{virtual_vm as f}from"./vm/virtual.mjs";import{CONFIG as u}from"./config.mjs";import{app_schema as g,docs_schema as d,example_schema as w,isLibrary as j,packageJson as v,scope_schema as b,service_worker_schema as y,virtual_schema as x}from"./process-env.mjs";let O="object"==typeof u.compression?u.compression:{},P=[...n,new s(m,g),new s(h,y),j&&new s(l,d),j&&new s(a,w),j&&new s(c,b),u.virtualModule&&new s(f,x),new o(u.copy),new e.DefinePlugin({"process.env":JSON.stringify(u.env)}),new e.IgnorePlugin({resourceRegExp:/\.d\.tsx?$/,contextRegExp:/\/(__(tests|mocks)__|test|spec|e2e)\//}),new i,...u.plugins].filter(Boolean);if(u.compression&&P.push(new t({algorithm:u.devServer.https?"brotli":"gzip",test:/\.(js|css|html|svg|ttf|woff|woff2|png|jpg|jpeg)$/,...O})),u.manifest&&P.push(new p(u.manifest)),u.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:v.description,keywords:Array.isArray(v.keywords)?v.keywords.toString():"","http-equiv":"refresh",viewport:"width=device-width, initial-scale=1"};u.seo&&(e.relCanonical={rel:"canonical",href:`https://${u.seo.domain}${u.basename}`}),u.htmlPluginOption.meta&&Object.assign(e,u.htmlPluginOption.meta),P.push(new r({...u.htmlPluginOption,meta:e}))}if(u.fixBrowserRouter){let e=u.basename.split("/").filter(Boolean).length,t=`${Array(e).fill("..").join("/")+(e?"/":"")}404.html`,o=u.fixBrowserRouter.pathSegmentsToKeep??e;P.push(new r({filename:u.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>`}))}u.sourceMap&&P.push(new e.SourceMapDevToolPlugin(u.sourceMap));export default P;
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 s}from"./plugin/virtual-module.mjs";import{app_vm as m}from"./vm/app.mjs";import{docs_vm as l}from"./vm/docs.mjs";import{example_vm as a}from"./vm/example.mjs";import{scope_vm as c}from"./vm/scope.mjs";import{sw_vm as h}from"./vm/sw.mjs";import{virtual_vm as f}from"./vm/virtual.mjs";import{CONFIG as u}from"./config.mjs";import{app_schema as g,docs_schema as d,example_schema as w,isLibrary as j,packageJson as v,scope_schema as b,service_worker_schema as y,virtual_schema as x}from"./process-env.mjs";let P="object"==typeof u.compression?u.compression:{},O=[...p,new s(m,g),new s(h,y),j&&new s(l,d),j&&new s(a,w),j&&new s(c,b),u.virtualModule&&new s(f,x),new o(u.copy),new e.EnvironmentPlugin(u.env),new e.DefinePlugin({"process.env":JSON.stringify(u.env)}),new e.IgnorePlugin({resourceRegExp:/\.d\.tsx?$/,contextRegExp:/\/(__(tests|mocks)__|test|spec|e2e)\//}),new i,...u.plugins].filter(Boolean);if(u.compression&&O.push(new t({algorithm:u.devServer.https?"brotli":"gzip",test:/\.(js|css|html|svg|ttf|woff|woff2|png|jpg|jpeg)$/,...P})),u.manifest&&O.push(new n(u.manifest)),u.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:v.description,keywords:Array.isArray(v.keywords)?v.keywords.toString():"","http-equiv":"refresh",viewport:"width=device-width, initial-scale=1"};u.seo&&(e.relCanonical={rel:"canonical",href:`https://${u.seo.domain}${u.basename}`}),u.htmlPluginOption.meta&&Object.assign(e,u.htmlPluginOption.meta),O.push(new r({...u.htmlPluginOption,meta:e}))}if(u.fixBrowserRouter){let e=u.basename.split("/").filter(Boolean).length,t=`${Array(e).fill("..").join("/")+(e?"/":"")}404.html`,o=u.fixBrowserRouter.pathSegmentsToKeep??e;O.push(new r({filename:u.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>`}))}u.sourceMap&&O.push(new e.SourceMapDevToolPlugin(u.sourceMap));export default O;
package/lib/vm/app.mjs CHANGED
@@ -1 +1 @@
1
- import{join as e}from"node:path";import{getAppEntry as r,getAppFallback as o,getAppMergeRouter as t,getAppNormalizeCss as m,getAppPrefixRouter as s,getAppRem as a,getAppSuspense as n}from"@moneko/mdx";import i,{routeDir as p}from"../commom/paths.mjs";import f from"../commom/reactive-object.mjs";import{readJson as d}from"../commom/read-json.mjs";import{CONFIG as c}from"../config.mjs";import l from"../plugin/module-federation.mjs";import{app_schema as u,APPTYPE as j,FRAMEWORK as x,framework as y,frameworkVersionStr as g,SSR as D}from"../process-env.mjs";import C from"../utils/create-types.mjs";import{generateDeclaration as h}from"../utils/dts.mjs";import{convertToCamelCase as b,transformModule as k}from"../utils/index.mjs";import{app_basic as v}from"./basic.mjs";import{vm_dts as $}from"./dts.mjs";import{generateLocales as w}from"./locales.mjs";import z from"./render-app.mjs";import{getRouter as N}from"./routes.mjs";export const app_vm=new f({env:()=>{let e=`${u}:env`,r=k(c.env);return $.setData(e,C(e,h(r,e))),r},info:r=>{let o=e(i.programPath,"package.json"),t=d(o),m=k({...t,projectName:b(t.name),ssr:D,base:c.basename,type:j,routerMode:c.routerMode,prefixCls:c.prefixCls,theme:c.theme,frameworkVersion:g,framework:y}),s=`${u}:info`;return r?.addDependency(o),$.setData(s,C(s,h(m,s))),m},render:{type:".tsx",source:()=>"react"===x?z:""},entry:()=>r(e(c.alias["@"],"./index.ts"),!!l.length,!!c.rem,!!c.normalizeCss,j,x),fallback:()=>o(c.fallbackCompPath),"merge-router":()=>t(),"prefix-router":()=>s(),suspense:{type:".tsx",source:()=>n(j,x)},routes:e=>(e.addContextDependency(p),N()),locals:r=>{let o=e(c.alias["@"],"./locales");return r.addContextDependency(o),w()},normalize:{type:".css",source:()=>m()},rem:()=>a(c.rem?.designSize||1680),manifest:e=>(e.addContextDependency(c.alias["@"]),`export default ${JSON.stringify(v.getData("manifest"))};`),resource:e=>(e.addContextDependency(c.alias["@"]),`export default ${JSON.stringify(v.getData("resource"))};`)});
1
+ import{join as e}from"node:path";import{getAppEntry as r,getAppFallback as o,getAppMergeRouter as t,getAppNormalizeCss as m,getAppPrefixRouter as s,getAppRem as a,getAppSuspense as n}from"@moneko/mdx";import p,{routeDir as i}from"../commom/paths.mjs";import d from"../commom/reactive-object.mjs";import{readJson as f}from"../commom/read-json.mjs";import{CONFIG as l}from"../config.mjs";import c from"../plugin/module-federation.mjs";import{app_schema as u,APPTYPE as y,FRAMEWORK as j,framework as x,frameworkVersionStr as g,SSR as v}from"../process-env.mjs";import b from"../utils/create-types.mjs";import{generateDeclaration as D}from"../utils/dts.mjs";import{convertToCamelCase as C,transformModule as h}from"../utils/index.mjs";import{app_basic as k}from"./basic.mjs";import{vm_dts as E}from"./dts.mjs";import{generateLocales as M}from"./locales.mjs";import $ from"./render-app.mjs";import{getRouter as I}from"./routes.mjs";export const app_vm=new d({env:()=>{let e=`${u}:env`,r=`${h(l.env)}declare global {import AppEnv from '${e}';type ImportMetaEnv = Readonly<typeof AppEnv>;interface ImportMeta {readonly env: ImportMetaEnv;}namespace NodeJS {interface ProcessEnv extends ImportMetaEnv {readonly [key: string]: string | number | boolean | undefined;}}}`;return E.setData(e,b(e,D(r,e))),r},info:r=>{let o=e(p.programPath,"package.json"),t=f(o),m=h({...t,projectName:C(t.name),ssr:v,base:l.basename,type:y,routerMode:l.routerMode,prefixCls:l.prefixCls,theme:l.theme,frameworkVersion:g,framework:x}),s=`${u}:info`;return r?.addDependency(o),E.setData(s,b(s,D(m,s))),m},render:{type:".tsx",source:()=>"react"===j?$:""},entry:()=>r(e(l.alias["@"],"./index.ts"),!!c.length,!!l.rem,!!l.normalizeCss,y,j),fallback:()=>o(l.fallbackCompPath),"merge-router":()=>t(),"prefix-router":()=>s(),suspense:{type:".tsx",source:()=>n(y,j)},routes:e=>(e.addContextDependency(i),I()),locals:r=>{let o=e(l.alias["@"],"./locales");return r.addContextDependency(o),M()},normalize:{type:".css",source:()=>m()},rem:()=>a(l.rem?.designSize||1680),manifest:e=>(e.addContextDependency(l.alias["@"]),`export default ${JSON.stringify(k.getData("manifest"))};`),resource:e=>(e.addContextDependency(l.alias["@"]),`export default ${JSON.stringify(k.getData("resource"))};`)});
package/lib/vm/dts.mjs CHANGED
@@ -1 +1 @@
1
- import{join as e}from"node:path";import{loadFileSync as t,updateFile as o,updateFileSync as s}from"@moneko/utils";import r from"../commom/paths.mjs";import m from"../commom/reactive-object.mjs";import{readJson as a}from"../commom/read-json.mjs";import{app_schema as n,APPTYPE as i,CACHE_NAME as p,FRAMEWORK as d,framework as c,frameworkVersionStr as f,packageJson as l,service_worker_schema as u,SSR as v,virtual_schema as $}from"../process-env.mjs";import j from"../utils/create-types.mjs";import{generateDeclaration as h}from"../utils/dts.mjs";import{convertToCamelCase as _,transformModule as x}from"../utils/index.mjs";export const dts_path=e(r.nodeModules,"@types",p,"index.d.ts");export const vm_dts=new m({});vm_dts.on("change",()=>{let e=Object.values(vm_dts.data).join("\n");o(dts_path,e)});export function initDts(o){let m=j(`${n}:env`,h(x(o.env),`${n}:env`));vm_dts.setData(`${n}:env`,m);let y=j(`${n}:info`,h(x({...a(e(r.programPath,"package.json")),projectName:_(l.name),ssr:v,type:i,frameworkVersion:f,framework:c,base:o.basename,routerMode:o.routerMode,prefixCls:o.prefixCls,theme:o.theme}),`${n}:info`));vm_dts.setData(`${n}:info`,y),vm_dts.setData(`${n}:resource`,j(`${n}:resource`,"const resource: string[];export default resource;")),vm_dts.setData(`${n}:manifest`,j(`${n}:manifest`,'import type { WebManifest } from "@moneko/core";const manifest: WebManifest;export default manifest;')),vm_dts.setData(`${u}:precaching`,j(`${u}:precaching`,t(e(r.corePath,"./service-worker/precaching.js.d.ts"))||"")),o.virtualModule&&Object.keys(o.virtualModule).map(e=>{let t=x(o.virtualModule[e]),s=`${$}:${e}`;vm_dts.setData(s,j(s,h(t,s)))});let k=o.moduleFederation?.flatMap(e=>Array.isArray(e.remotes)?e.remotes.map(e=>e.name):[]).filter(Boolean);s(dts_path,Object.values(vm_dts.data).join("\n")),s(e(r.nodeModules,"@moneko/init.d.json"),JSON.stringify({extends:`@moneko/${d}/base`,compilerOptions:{types:[`@moneko/${d}/env.d.ts`,`@types/${p}/index.d.ts`,...k.map(e=>`@types/${p}/${e}.d.ts`)]}}))}
1
+ import{join as e}from"node:path";import{loadFileSync as t,updateFile as o,updateFileSync as s}from"@moneko/utils";import r from"../commom/paths.mjs";import m from"../commom/reactive-object.mjs";import{readJson as a}from"../commom/read-json.mjs";import{app_schema as n,APPTYPE as i,CACHE_NAME as p,FRAMEWORK as d,framework as c,frameworkVersionStr as l,packageJson as f,service_worker_schema as v,SSR as u,virtual_schema as $}from"../process-env.mjs";import j from"../utils/create-types.mjs";import{generateDeclaration as y}from"../utils/dts.mjs";import{convertToCamelCase as M,transformModule as h}from"../utils/index.mjs";export const dts_path=e(r.nodeModules,"@types",p,"index.d.ts");export const vm_dts=new m({});vm_dts.on("change",()=>{let e=Object.values(vm_dts.data).join("\n");o(dts_path,e)});export function initDts(o){let m=j(`${n}:env`,y(`${h(o.env)}declare global {import AppEnv from '${n}:env';type ImportMetaEnv = Readonly<typeof AppEnv>;interface ImportMeta {readonly env: ImportMetaEnv;}namespace NodeJS {interface ProcessEnv extends ImportMetaEnv {readonly [key: string]: string | number | boolean | undefined;}}}`,`${n}:env`));vm_dts.setData(`${n}:env`,m);let _=j(`${n}:info`,y(h({...a(e(r.programPath,"package.json")),projectName:M(f.name),ssr:u,type:i,frameworkVersion:l,framework:c,base:o.basename,routerMode:o.routerMode,prefixCls:o.prefixCls,theme:o.theme}),`${n}:info`));vm_dts.setData(`${n}:info`,_),vm_dts.setData(`${n}:resource`,j(`${n}:resource`,"const resource: string[];export default resource;")),vm_dts.setData(`${n}:manifest`,j(`${n}:manifest`,'import type { WebManifest } from "@moneko/core";const manifest: WebManifest;export default manifest;')),vm_dts.setData(`${v}:precaching`,j(`${v}:precaching`,t(e(r.corePath,"./service-worker/precaching.js.d.ts"))||"")),o.virtualModule&&Object.keys(o.virtualModule).map(e=>{let t=h(o.virtualModule[e]),s=`${$}:${e}`;vm_dts.setData(s,j(s,y(t,s)))});let b=o.moduleFederation?.flatMap(e=>Array.isArray(e.remotes)?e.remotes.map(e=>e.name):[]).filter(Boolean);s(dts_path,Object.values(vm_dts.data).join("\n")),s(e(r.nodeModules,"@moneko/init.d.json"),JSON.stringify({extends:`@moneko/${d}/base`,compilerOptions:{types:[`@moneko/${d}/env.d.ts`,`@types/${p}/index.d.ts`,...b.map(e=>`@types/${p}/${e}.d.ts`)]}}))}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "4.3.0",
3
+ "version": "4.3.2",
4
4
  "description": "core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",