@moneko/core 3.58.1-bate.3 → 4.0.0-bate.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{env as e}from"node:process";import{CUSTOMCONFIG as m}from"../commom/paths.mjs";import o from"../module.config.mjs";import{isLibrary as s}from"../process-env.mjs";import{resolveProgram as r}from"../utils/index.mjs";let t={name:"server",target:"node",dependencies:["client"],entry:{main:r("site/ssr.tsx")},output:{path:r(`${s?"docs":"dist"}/server`),library:{type:"commonjs2",umdNamedDefine:!1},filename:"[name].cjs",chunkFilename:"[chunkhash].cjs",globalObject:"global"},cache:{type:"filesystem",name:[m,e.NODE_ENV,"server"].filter(Boolean).join("-")},externalsPresets:{node:!0},externals:[],module:o(!0)};export default t;
1
+ import{env as e}from"node:process";import{CUSTOMCONFIG as m}from"../commom/paths.mjs";import o from"../module.config.mjs";import{isLibrary as s}from"../process-env.mjs";import{resolveProgram as r}from"../utils/index.mjs";let t={name:"server",target:"node",dependencies:["client"],entry:{main:r("site/ssr.tsx")},output:{path:r(`${s?"docs":"dist"}/server`),library:{type:"commonjs2",umdNamedDefine:!1},filename:"[name].cjs",chunkFilename:"[chunkhash].cjs",globalObject:"global"},cache:{type:"filesystem",name:[m,e.NODE_ENV,"server"].filter(Boolean).join("-")},externalsPresets:{node:!0},module:o(!0)};export default t;
@@ -1 +1 @@
1
- import{resolve as e}from"node:path";import s from"./paths.mjs";export default function(n,t=1){let i=n.replace(/^\/|\/$/g,"").replace(/\\/g,"/"),a=i,o="index.ts",d=i.match(/(.+)\/index\.([^/]+)$/),m=i.match(/(.+)\.([^/]+)$/);d?(a=d[1],o=`index.${d[2]}`):m&&(a=m[1],o=`index.${m[2]}`);let r=!!a.endsWith("@app/rem")||JSON.stringify(["*.css","*.less","*.scss","*.sass"]);return{name:a,main:o,pkg:e(s.nodeModules,a,"package.json"),file:e(s.nodeModules,a,o),meta:`{"name":"${a}","main":"${o}","version":"0.0.${t}","description": "","sideEffects": ${r}}`}}
1
+ import{resolve as e}from"node:path";import s from"./paths.mjs";export default function(n,t=1){let i=n.replace(/^\/|\/$/g,"").replace(/\\/g,"/"),a=i,d="index.ts",m=i.match(/(.+)\/index\.([^/]+)$/),o=i.match(/(.+)\.([^/]+)$/);m?(a=m[1],d=`index.${m[2]}`):o&&(a=o[1],d=`index.${o[2]}`);let p=!!(a.endsWith("@app/rem")||a.endsWith("app:rem"))||JSON.stringify(["*.css","*.less","*.scss","*.sass"]);return{name:a,main:d,pkg:e(s.nodeModules,a,"package.json"),file:e(s.nodeModules,a,d),meta:`{"name":"${a}","main":"${d}","version":"0.0.${t}","description": "","sideEffects": ${p}}`}}
@@ -18,8 +18,8 @@ declare const Rule: {
18
18
  /**
19
19
  * 提取函数字符串
20
20
  * @example
21
- * // () => import('@app')
22
- * "rr(() => import('@app'))rr".replace(Rule.extract_func, '$1')
21
+ * // () => import('pkg')
22
+ * "rr(() => import('pkg'))rr".replace(Rule.extract_func, '$1')
23
23
  * */
24
24
  extract_func: RegExp;
25
25
  };
package/lib/common.mjs CHANGED
@@ -1 +1 @@
1
- import{extname as e,join as t,resolve as o}from"node:path";import{argv as s}from"node:process";import a,{config_files as n,CUSTOMCONFIG as i,TMP_DIR as r}from"./commom/paths.mjs";import{OverrideResolverPlugin as l}from"./plugin/override-resolve.mjs";import{isObject as m,md5 as c,node_modules as p,resolveProgram as u}from"./utils/index.mjs";import{exampleModuleName as d}from"./vm/example.mjs";import h from"./vm/info.mjs";import{CONFIG as f}from"./config.mjs";import g from"./plugins.config.mjs";import{isCI as b,isDev as y,isLibrary as j,NODE_ENV as v,packageJson as C}from"./process-env.mjs";export const outputConfig={path:u(j?"docs":"dist"),filename:e=>e.filename?.includes(".worker")?"worker/[name].js":"js/[name].[contenthash].bundle.js",chunkFilename:"js/[contenthash].chunk.js",assetModuleFilename:t=>{let o=e(t.filename||"").substring(1);return`assets/${o}/[hash][ext]`},library:{name:`${h.projectName}`,type:"umd",umdNamedDefine:!0},globalObject:"self",chunkLoadingGlobal:`webpackJsonp_${C.name}`,pathinfo:y,clean:!0,publicPath:f.publicPath,asyncChunks:!0,charset:!0,iife:!0,crossOriginLoading:"use-credentials",enabledWasmLoadingTypes:["fetch"],uniqueName:`${h.projectName}`};let P={main:[p("@app/entry")]},x=[t(a.corePath,"./polyfills/public-path.mjs")];if(y&&f.refresh&&f.env.injectRemoteReactRefresh&&x.push(t(a.corePath,"./polyfills/inject-react-refresh.mjs")),f.polyfill&&x.push(t(a.corePath,"./polyfills/replace-children.mjs")),f.entry&&("string"==typeof f.entry?P={...P,main:[f.entry]}:Object.keys(f.entry)&&(P=Object.assign(P,f.entry))),"string"==typeof P.main?P.main=[...x,P.main]:Array.isArray(P.main)&&(P.main=[...x,...P.main]),f.output){if("string"==typeof f.output)outputConfig.path=f.output;else if(Object.keys(f.output)){let e=f.output,t={...outputConfig.library};Object.assign(outputConfig,e),"object"==typeof f.output&&e.library&&(outputConfig.library=Object.assign(t,e.library))}}let k={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:a.webpackCachePath,memoryCacheUnaffected:!y,name:c(`${i}-${v}-${s[2]}`),version:`${C.version}`,buildDependencies:{config:n},maxMemoryGenerations:1};!1===f.cache?k=!1:m(f.cache)&&(k=Object.assign(k,f.cache)),b&&(void 0===f.cache||f.cache&&!f.cache.cacheDirectory)&&(k.cacheDirectory=o(r,C.name));let M={},w={imports:!0,entries:!0,test:e=>{let t=e.nameForCondition();return!!(t&&(t.startsWith(p(d))||t.startsWith(p("@app/comment"))||t.startsWith(a.pagesPath)||t.startsWith(a.componentsPath)))}};f.lazyCompilation&&y&&"true"!==process.env.IS_BUILD?m(f.lazyCompilation)?Object.assign(M,w,f.lazyCompilation):Object.assign(M,w):M=!1;export const commonConfig={name:"client",target:"web",devtool:f.devtool,entry:P,mode:f.mode??"production",stats:"errors-only",cache:k,snapshot:{immutablePaths:[a.pnpmNodeModules,a.denoNodeModules,/node_modules\/(?!(@app)\/)/],managedPaths:[a.pnpmNodeModules,a.denoNodeModules,/node_modules\/(?!(@app)\/)/],resolveBuildDependencies:{timestamp:!0,hash:!0},resolve:{timestamp:!0,hash:!0},module:{timestamp:!0,hash:!0},buildDependencies:{timestamp:!0,hash:!0},contextModule:{timestamp:!0,hash:!0}},infrastructureLogging:{level:"error"},externalsPresets:f.externalsPresets,plugins:g,node:{global:!1,__filename:!1,__dirname:!1},experiments:{asyncWebAssembly:!0,cacheUnaffected:!y,lazyCompilation:M,buildHttp:m(f.buildHttp)?{allowedUris:[],lockfileLocation:o(a.httpCachePath,"http.lock"),cacheLocation:o(a.httpCachePath,"data"),upgrade:!0,...f.buildHttp}:f.buildHttp,backCompat:!0,futureDefaults:!0,css:!1,outputModule:!1},resolve:{extensions:[".mts",".mjs",".ts",".tsx",".js",".jsx",".json",".wasm"],alias:f.alias,modules:[a.nodeModules,a.pnpmNodeModules,a.denoNodeModules],mainFields:["browser","module","main"],mainFiles:["index"],plugins:f.resolvePlugins,preferAbsolute:!0,cache:!0,fallback:{}},externals:f.externals,output:outputConfig,recordsPath:f.recordsPath?t(a.programPath,f.recordsPath):t(a.webpackCachePath,"records.json")};f.overrideResolve&&commonConfig.resolve.plugins.push(new l(Object.assign({original:f.alias["@"],override:i&&u(i)},f.overrideResolve)));
1
+ import{extname as e,join as t,resolve as o}from"node:path";import{argv as s}from"node:process";import a,{config_files as n,CUSTOMCONFIG as i,TMP_DIR as r}from"./commom/paths.mjs";import{OverrideResolverPlugin as l}from"./plugin/override-resolve.mjs";import{isObject as m,md5 as p,node_modules as c,resolveProgram as u}from"./utils/index.mjs";import d from"./vm/info.mjs";import{CONFIG as h}from"./config.mjs";import f from"./plugins.config.mjs";import{isCI as g,isDev as b,isLibrary as y,NODE_ENV as j,packageJson as v}from"./process-env.mjs";export const outputConfig={path:u(y?"docs":"dist"),filename:e=>e.filename?.includes(".worker")?"worker/[name].js":"js/[name].[contenthash].bundle.js",chunkFilename:"js/[contenthash].chunk.js",assetModuleFilename:t=>{let o=e(t.filename||"").substring(1);return`assets/${o}/[hash][ext]`},library:{name:`${d.projectName}`,type:"umd",umdNamedDefine:!0},globalObject:"self",chunkLoadingGlobal:`webpackJsonp_${v.name}`,pathinfo:b,clean:!0,publicPath:h.publicPath,asyncChunks:!0,charset:!0,iife:!0,crossOriginLoading:"use-credentials",enabledWasmLoadingTypes:["fetch"],uniqueName:`${d.projectName}`};let C={main:["app:entry"]},P=[t(a.corePath,"./polyfills/public-path.mjs")];if(b&&h.refresh&&h.env.injectRemoteReactRefresh&&P.push(t(a.corePath,"./polyfills/inject-react-refresh.mjs")),h.polyfill&&P.push(t(a.corePath,"./polyfills/replace-children.mjs")),h.entry&&("string"==typeof h.entry?C={...C,main:[h.entry]}:Object.keys(h.entry)&&(C=Object.assign(C,h.entry))),"string"==typeof C.main?C.main=[...P,C.main]:Array.isArray(C.main)&&(C.main=[...P,...C.main]),h.output){if("string"==typeof h.output)outputConfig.path=h.output;else if(Object.keys(h.output)){let e=h.output,t={...outputConfig.library};Object.assign(outputConfig,e),"object"==typeof h.output&&e.library&&(outputConfig.library=Object.assign(t,e.library))}}let x={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:a.webpackCachePath,memoryCacheUnaffected:!b,name:p(`${i}-${j}-${s[2]}`),version:`${v.version}`,buildDependencies:{config:n},maxMemoryGenerations:1};!1===h.cache?x=!1:m(h.cache)&&(x=Object.assign(x,h.cache)),g&&(void 0===h.cache||h.cache&&!h.cache.cacheDirectory)&&(x.cacheDirectory=o(r,v.name));let k={},M={imports:!0,entries:!0,test:e=>{let t=e.nameForCondition();return!!(t&&(t.startsWith(c("app:example"))||t.startsWith(c("app:comment"))||t.startsWith(a.pagesPath)||t.startsWith(a.componentsPath)))}};h.lazyCompilation&&b&&"true"!==process.env.IS_BUILD?m(h.lazyCompilation)?Object.assign(k,M,h.lazyCompilation):Object.assign(k,M):k=!1;export const commonConfig={name:"client",target:"web",devtool:h.devtool,entry:C,mode:h.mode??"production",stats:"errors-only",cache:x,snapshot:{immutablePaths:[a.pnpmNodeModules,a.denoNodeModules,/node_modules\/(?!(@app|app:)\/)/],managedPaths:[a.pnpmNodeModules,a.denoNodeModules,/node_modules\/(?!(@app|app:)\/)/],resolveBuildDependencies:{timestamp:!0,hash:!0},resolve:{timestamp:!0,hash:!0},module:{timestamp:!0,hash:!0},buildDependencies:{timestamp:!0,hash:!0},contextModule:{timestamp:!0,hash:!0}},infrastructureLogging:{level:"error"},externalsPresets:h.externalsPresets,plugins:f,node:{global:!1,__filename:!1,__dirname:!1},experiments:{asyncWebAssembly:!0,cacheUnaffected:!b,lazyCompilation:k,buildHttp:m(h.buildHttp)?{allowedUris:[],lockfileLocation:o(a.httpCachePath,"http.lock"),cacheLocation:o(a.httpCachePath,"data"),upgrade:!0,...h.buildHttp}:h.buildHttp,backCompat:!0,futureDefaults:!0,css:!1,outputModule:!1},resolve:{extensions:[".mts",".mjs",".ts",".tsx",".js",".jsx",".json",".wasm"],alias:h.alias,modules:[a.nodeModules,a.pnpmNodeModules,a.denoNodeModules],mainFields:["browser","module","main"],mainFiles:["index"],plugins:h.resolvePlugins,preferAbsolute:!0,cache:!0,fallback:{}},externals:h.externals,output:outputConfig,recordsPath:h.recordsPath?t(a.programPath,h.recordsPath):t(a.webpackCachePath,"records.json")};h.overrideResolve&&commonConfig.resolve.plugins.push(new l(Object.assign({original:h.alias["@"],override:i&&u(i)},h.overrideResolve)));
@@ -1 +1 @@
1
- import{existsSync as t,readFileSync as s}from"node:fs";import{basename as o,join as e,relative as i,resolve as r}from"node:path";import a from"webpack";import n from"../../commom/paths.mjs";import{packageJson as p}from"../../process-env.mjs";export*from"./types.mjs";export class ManifestPlugin{constructor(t){this.name="ManifestPlugin",this.options={filename:"site.webmanifest",name:p.name,short_name:p.shortName,description:p.description,start_url:p.startUrl??"/",scope:"/",display:p.display??"standalone",background_color:p.backgroundColor??"#fff",theme_color:p.themeColor,icons:[{src:i(n.programPath,`${n.corePath}/options/icon.webp`),type:"image/webp",sizes:"512x512"}]},this.options={...this.options,...t}}getPublicPath(t){if(this.options.publicPath)return this.options.publicPath;let s=t.getAssetPath(t.outputOptions.publicPath,{hash:t.hash}),o="auto"===s?"/":s;return o.length&&!o.endsWith("/")&&(o+="/"),o}apply(i){let n=this.name,{filename:c,publicPath:h,...m}=this.options;i.hooks.compilation.tap(n,l=>{l.hooks.processAssets.tap({name:n,stage:a.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL},()=>{let n={...m,icons:m.icons?.map(n=>{let p={...n};if(p.src&&!p.src.startsWith("http")){let n=r(i.context,p.src);if(t(n)){let t=o(p.src),i=s(n);l.emitAsset(t,new a.sources.RawSource(i),{javascriptModule:!1}),p.src=e(h||this.getPublicPath(l),t)}else l.warnings.push(new a.WebpackError(`Icon file ${n} does not exist`))}return p}),version:`${p.version}(${l.fullHash})`};l.emitAsset(c,new i.webpack.sources.RawSource(JSON.stringify(n)),{javascriptModule:!1})})})}}
1
+ import{existsSync as t,readFileSync as s}from"node:fs";import{basename as o,join as e,relative as i,resolve as r}from"node:path";import a from"webpack";import n from"../../commom/paths.mjs";import{packageJson as p}from"../../process-env.mjs";export*from"./types.mjs";export class ManifestPlugin{constructor(t){this.name="ManifestPlugin",this.options={filename:"site.webmanifest",name:p.name,short_name:p.shortName,description:p.description,scope:"/",display:p.display??"standalone",background_color:p.backgroundColor??"#fff",theme_color:p.themeColor,icons:[{src:i(n.programPath,`${n.corePath}/options/icon.webp`),type:"image/webp",sizes:"512x512"}]},this.options={...this.options,...t}}getPublicPath(t){if(this.options.publicPath)return this.options.publicPath;let s=t.getAssetPath(t.outputOptions.publicPath,{hash:t.hash}),o="auto"===s?"/":s;return o.length&&!o.endsWith("/")&&(o+="/"),o}apply(i){let n=this.name,{filename:c,publicPath:h,start_url:m,...l}=this.options;i.hooks.compilation.tap(n,u=>{u.hooks.processAssets.tap({name:n,stage:a.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL},()=>{let n=h||this.getPublicPath(u),f={...l,start_url:m??n,icons:l.icons?.map(p=>{let c={...p};if(c.src&&!c.src.startsWith("http")){let p=r(i.context,c.src);if(t(p)){let t=o(c.src),i=s(p);u.emitAsset(t,new a.sources.RawSource(i),{javascriptModule:!1}),c.src=e(n,t)}else u.warnings.push(new a.WebpackError(`Icon file ${p} does not exist`))}return c}),version:`${p.version}(${u.fullHash})`};u.emitAsset(c,new i.webpack.sources.RawSource(JSON.stringify(f)),{javascriptModule:!1})})})}}
@@ -1,12 +1,3 @@
1
- import type { Compiler, WebpackPluginInstance } from 'webpack';
2
1
  export interface VirtualModulePluginOption {
3
2
  [key: string]: string | object;
4
3
  }
5
- export declare class VirtualModuleWebpackPlugin implements WebpackPluginInstance {
6
- private virtualModules;
7
- private options;
8
- private init;
9
- constructor(options?: VirtualModulePluginOption);
10
- private modify;
11
- apply(compiler: Compiler): void;
12
- }
@@ -1 +1 @@
1
- import t from"webpack-virtual-modules";import o from"../commom/parse-module-meta.mjs";import i from"../commom/paths.mjs";import{isLibrary as e}from"../process-env.mjs";import{node_modules as s,transformModule as r}from"../utils/index.mjs";import{comment as l,docs as m}from"../vm/docs.mjs";import{examples as n}from"../vm/example.mjs";import{locales as p}from"../vm/locales.mjs";import a from"../vm/modules.mjs";import{route as f}from"../vm/routes.mjs";let c={};for(let t in a)if(Object.prototype.hasOwnProperty.call(a,t)){let{file:i,pkg:e,meta:s}=o(t);c[e]=s,c[i]=r(a[t])}export class VirtualModuleWebpackPlugin{constructor(i={}){this.options={},this.init=!1,this.virtualModules=new t(c);let e={};for(let t in i)if(Object.prototype.hasOwnProperty.call(i,t)){let{file:s,pkg:l,meta:m}=o(t),n=i[t],p=n;p=s.endsWith("json")?"string"==typeof n?n:JSON.stringify(n):r(n),Object.assign(e,{[s]:p,[l]:m})}this.options=e}modify(t,o,e){let r=e||"",l=o.startsWith(i.nodeModules)?o:s(o),m=t.inputFileSystem;for(;m&&m._inputFileSystem;)m=m._inputFileSystem;let n=m?._virtualFiles?.[l];n&&n.contents===r||(this.virtualModules.writeModule(l,r),t.watching?.invalidate())}apply(t){this.virtualModules.apply(t);let o=(o,i)=>{this.modify(t,o,i)};f.on("change",o),p.on("change",o),e&&(n.on("change",o),m.on("change",o),l.on("change",o)),t.hooks.compilation.tap("VirtualModuleWebpackPlugin",()=>{if(!this.init){for(let t in this.init=!0,this.options)Object.prototype.hasOwnProperty.call(this.options,t)&&o(t,this.options[t]);for(let t of n)o(t[0],t[1]);for(let t of m)o(t[0],t[1]);for(let t of l)o(t[0],t[1])}})}}
1
+ export{};
@@ -1 +1 @@
1
- import e from"webpack";import{CompressionPlugin as t}from"./plugin/compression.mjs";import{CopyPlugin as i}from"./plugin/copy.mjs";import{HtmlPlugin as o}from"./plugin/html-plugin.mjs";import{ManifestPlugin as r}from"./plugin/manifest/index.mjs";import n from"./plugin/module-federation.mjs";import{VirtualModuleWebpackPlugin as p}from"./plugin/virtual-module.mjs";import{CONFIG as l}from"./config.mjs";import{packageJson as s}from"./process-env.mjs";let a="object"==typeof l.compression?l.compression:{},m=[...n,new p(l.virtualModule),new i(l.copy),new e.DefinePlugin({"process.env":JSON.stringify(l.env)}),new e.IgnorePlugin({resourceRegExp:/\/(__(tests|mocks)__|test|spec|e2e)\//}),...l.plugins].filter(Boolean);if(l.compression&&m.push(new t({algorithm:l.devServer.https?"brotli":"gzip",test:/\.(js|css|html|svg|ttf|woff|woff2|png|jpg|jpeg)$/,...a})),l.manifest&&m.push(new r(l.manifest)),l.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:s.description,keywords:Array.isArray(s.keywords)?s.keywords.toString():"","http-equiv":"refresh",viewport:"width=device-width, initial-scale=1"};l.seo&&(e.relCanonical={rel:"canonical",href:`https://${l.seo.domain}${l.basename}`}),l.htmlPluginOption.meta&&Object.assign(e,l.htmlPluginOption.meta),m.push(new o({...l.htmlPluginOption,meta:e}))}if(l.fixBrowserRouter){let e=l.basename.split("/").filter(Boolean).length,t=`${Array(e).fill("..").join("/")+(e?"/":"")}404.html`,i=l.fixBrowserRouter.pathSegmentsToKeep??e;m.push(new o({filename:l.fixBrowserRouter.path??t,inject:!1,templateContent:()=>`<html lang="en"><head><title>Redirect</title><script>const pathKeep = ${i};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>`}))}l.sourceMap&&m.push(new e.SourceMapDevToolPlugin(l.sourceMap));export default m;
1
+ import e from"webpack";import{CompressionPlugin as t}from"./plugin/compression.mjs";import{CopyPlugin as i}from"./plugin/copy.mjs";import{HtmlPlugin as o}from"./plugin/html-plugin.mjs";import{ManifestPlugin as r}from"./plugin/manifest/index.mjs";import n from"./plugin/module-federation.mjs";import{vm as p,vm_schema as s}from"./vm/modules.mjs";import{CONFIG as l}from"./config.mjs";import{packageJson as a}from"./process-env.mjs";let m="object"==typeof l.compression?l.compression:{},c=[...n,new e.experiments.schemes.VirtualUrlPlugin(p,s),new i(l.copy),new e.DefinePlugin({"process.env":JSON.stringify(l.env)}),new e.IgnorePlugin({resourceRegExp:/\/(__(tests|mocks)__|test|spec|e2e)\//}),...l.plugins].filter(Boolean);if(l.compression&&c.push(new t({algorithm:l.devServer.https?"brotli":"gzip",test:/\.(js|css|html|svg|ttf|woff|woff2|png|jpg|jpeg)$/,...m})),l.manifest&&c.push(new r(l.manifest)),l.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:a.description,keywords:Array.isArray(a.keywords)?a.keywords.toString():"","http-equiv":"refresh",viewport:"width=device-width, initial-scale=1"};l.seo&&(e.relCanonical={rel:"canonical",href:`https://${l.seo.domain}${l.basename}`}),l.htmlPluginOption.meta&&Object.assign(e,l.htmlPluginOption.meta),c.push(new o({...l.htmlPluginOption,meta:e}))}if(l.fixBrowserRouter){let e=l.basename.split("/").filter(Boolean).length,t=`${Array(e).fill("..").join("/")+(e?"/":"")}404.html`,i=l.fixBrowserRouter.pathSegmentsToKeep??e;c.push(new o({filename:l.fixBrowserRouter.path??t,inject:!1,templateContent:()=>`<html lang="en"><head><title>Redirect</title><script>const pathKeep = ${i};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>`}))}l.sourceMap&&c.push(new e.SourceMapDevToolPlugin(l.sourceMap));export default c;
package/lib/vm/docs.d.mts CHANGED
@@ -1,7 +1,6 @@
1
1
  import ReactiveObject from '../commom/reactive-object.mjs';
2
- export declare const docsModuleName: string;
3
- export declare const docsModulePkgJson: string;
4
- export declare const docsModuleMeta: string;
5
- export declare const docs: ReactiveObject<Record<string, string>>;
2
+ export declare const docs: ReactiveObject<{
3
+ 'app:docs': string;
4
+ }>;
6
5
  export declare const comment: ReactiveObject<Record<string, string>>;
7
6
  export declare const getCommentPath: (file: string) => string;
package/lib/vm/docs.mjs CHANGED
@@ -1 +1 @@
1
- import{relative as e,sep as t}from"node:path";import{loadFile as o,scanFolderSync as m}from"@moneko/utils";import a from"../commom/parse-module-meta.mjs";import r from"../commom/paths.mjs";import n from"../commom/reactive-object.mjs";import s from"../commom/rule.mjs";import{CONFIG as l}from"../config.mjs";import{FRAMEWORK as c,framework as p,isLibrary as i,isReact as d,isSolid as f}from"../process-env.mjs";import u from"./generate-doc.mjs";let g={react:"createElement",solid:"createComponent"}[c],$=a("@app/docs");export const docsModuleName=$.file;export const docsModulePkgJson=$.pkg;export const docsModuleMeta=$.meta;export const docs=new n({[docsModuleName]:"export default {}",[docsModulePkgJson]:docsModuleMeta});export const comment=new n({});export const getCommentPath=function(){let e=/\/(.+?)\.tsx?$/,t=l.alias["@pkg"]?.length;return o=>o.substring(t).replace(/\\/g,"/").replace(e,"@app/comment/$1.md")}();if(i&&!1!==l.htmlPluginOption){let n={},c=`import { ${g}${f?",Dynamic":""} } from "${p}${f?"/web":""}";import SuspenseComp from "@app/suspense";function call_then(res) {return {default: ${d?"() =>":""}${g}(${f?"Dynamic":"'div'"}, {${f?"innerHTML: res.default, component: 'div', class: 'n-md-box' ":"dangerouslySetInnerHTML: {__html:res.default}, className: 'n-md-box'"} })};}`;comment.on("change",(o,m)=>{((e,o)=>{if(!e.endsWith("package.json")){let m=e.replace(/@app[/\\]comment[/\\]/,"").split(t),a=m.pop(),r=m.join("/");n[r]||(n[r]={}),o?n[r][a]&&delete n[r][a]:n[r][a]=`rr(() => ${g}(SuspenseComp, { comp: () => import(/* webpackChunkName: '${e}' */ '${e}?raw').then(call_then)}))rr`;let l={};for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&(l[e]=Object.values(n[e]));docs.setData(docsModuleName,`${c}export default ${JSON.stringify(l).replace(s.extract_func,"$1")}`)}})(e(r.nodeModules,o),m?.length<0)});let i=m(l.alias["@pkg"],["\\.tsx?$"]).filter(e=>!/(^|\/)\.[^\\/\\.]|\.test\./i.test(e)),$=await Promise.all(i.map(async e=>({data:await o(e),file:e})));for(let e=0;e<$.length;e++){let t=$[e];if(t.data){let{file:e,pkg:o,meta:m}=a(getCommentPath(t.file));comment.setData(e,u(t.data,t.file)),comment.setData(o,m)}}}
1
+ import{relative as e,sep as t}from"node:path";import o from"../commom/paths.mjs";import m from"../commom/reactive-object.mjs";import n from"../commom/rule.mjs";import{CONFIG as r}from"../config.mjs";import{FRAMEWORK as p,framework as a,isLibrary as c,isReact as s,isSolid as l}from"../process-env.mjs";let i={react:"createElement",solid:"createComponent"}[p];export const docs=new m({"app:docs":"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(/\\/g,"/").replace(e,"app:comment/$1.md")}();if(c&&!1!==r.htmlPluginOption){let m={},r=`import { ${i}${l?",Dynamic":""} } from "${a}${l?"/web":""}";import SuspenseComp from "app:suspense";function call_then(res) {return {default: ${s?"() =>":""}${i}(${l?"Dynamic":"'div'"}, {${l?"innerHTML: res.default, component: 'div', class: 'n-md-box' ":"dangerouslySetInnerHTML: {__html:res.default}, className: 'n-md-box'"} })};}`;comment.on("change",(p,a)=>{((e,o)=>{if(!e.endsWith("package.json")){let p=e.replace(/app:comment[/\\]/,"").split(t),a=p.pop(),c=p.join("/");m[c]||(m[c]={}),o?m[c][a]&&delete m[c][a]:m[c][a]=`rr(() => ${i}(SuspenseComp, { comp: () => import(/* webpackChunkName: '${e}' */ '${e}?raw').then(call_then)}))rr`;let s={};for(let e in m)Object.prototype.hasOwnProperty.call(m,e)&&(s[e]=Object.values(m[e]));docs.setData("app:docs",`${r}export default ${JSON.stringify(s).replace(n.extract_func,"$1")}`)}})(e(o.nodeModules,p),a?.length<0)})}
@@ -1,4 +1,4 @@
1
1
  import ReactiveObject from '../commom/reactive-object.mjs';
2
- export declare const exampleModuleName = "@app/example";
2
+ export declare const exampleModuleName = "app:example";
3
3
  export declare const examples: ReactiveObject<Record<string, string>>;
4
4
  export declare function generatorExample(): void;
@@ -1 +1 @@
1
- import{generateExample as e}from"@moneko/mdx";import o from"../commom/parse-module-meta.mjs";import t from"../commom/paths.mjs";import m from"../commom/reactive-object.mjs";import r from"../commom/rule.mjs";import{CONFIG as p}from"../config.mjs";import{isDev as a,isLibrary as l}from"../process-env.mjs";import{watchFiles as n}from"./utils.mjs";export const exampleModuleName="@app/example";function s(){if(!l||!1===p.htmlPluginOption)return{};let m=JSON.parse(e(t.componentsPath,`${exampleModuleName}/`,"6")),a={};for(let e in m)Object.prototype.hasOwnProperty.call(m,e)&&Object.assign(a,{[e]:`rr(() => import('${e}'))rr`});let n={...m,[exampleModuleName]:`export default ${JSON.stringify(a).replace(r.extract_func,"$1")}`},s={};for(let e in n)if(Object.prototype.hasOwnProperty.call(n,e)){let{file:t,pkg:m,meta:r}=o(e);s[m]=r,s[t]=n[e]}return s}export const examples=new m(s());export function generatorExample(){let e=s();for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&examples.setData(o,e[o])}l&&a&&!1!==p.htmlPluginOption&&"true"!==process.env.IS_BUILD&&n(t.componentsPath,/(?<!\/examples\/(.+)\.md)$/,generatorExample);
1
+ import{generateExample as e}from"@moneko/mdx";import o from"../commom/parse-module-meta.mjs";import t from"../commom/paths.mjs";import m from"../commom/reactive-object.mjs";import r from"../commom/rule.mjs";import{CONFIG as p}from"../config.mjs";import{isDev as a,isLibrary as l}from"../process-env.mjs";import{watchFiles as n}from"./utils.mjs";export const exampleModuleName="app:example";function s(){if(!l||!1===p.htmlPluginOption)return{};let m=JSON.parse(e(t.componentsPath,`${exampleModuleName}/`,"6")),a={};for(let e in m)Object.prototype.hasOwnProperty.call(m,e)&&Object.assign(a,{[e]:`rr(() => import('${e}'))rr`});let n={...m,[exampleModuleName]:`export default ${JSON.stringify(a).replace(r.extract_func,"$1")}`},s={};for(let e in n)if(Object.prototype.hasOwnProperty.call(n,e)){let{file:t,pkg:m,meta:r}=o(e);s[m]=r,s[t]=n[e]}return s}export const examples=new m(s());export function generatorExample(){let e=s();for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&examples.setData(o,e[o])}l&&a&&!1!==p.htmlPluginOption&&"true"!==process.env.IS_BUILD&&n(t.componentsPath,/(?<!\/examples\/(.+)\.md)$/,generatorExample);
package/lib/vm/info.mjs CHANGED
@@ -1 +1 @@
1
- import{CONFIG as e}from"../config.mjs";import{APPTYPE as r,framework as o,frameworkVersionStr as m,packageJson as s,SSR as t}from"../process-env.mjs";import{convertToCamelCase as f}from"../utils/index.mjs";let i={...s,projectName:f(s.name),ssr:t,base:e.basename,type:r,routerMode:e.routerMode,prefixCls:e.prefixCls,theme:e.theme,frameworkVersion:m,framework:o};export default i;
1
+ import{CONFIG as e}from"../config.mjs";import{APPTYPE as r,framework as o,frameworkVersionStr as m,packageJson as s,SSR as t}from"../process-env.mjs";import{convertToCamelCase as f}from"../utils/index.mjs";let i={projectName:f(s.name),ssr:t,base:e.basename,type:r,routerMode:e.routerMode,prefixCls:e.prefixCls,theme:e.theme,frameworkVersion:m,framework:o};export default i;
@@ -1,5 +1,4 @@
1
1
  import ReactiveObject from '../commom/reactive-object.mjs';
2
- export declare const localesModuleName: string;
3
2
  export declare const locales: ReactiveObject<{
4
- [x: string]: string;
3
+ 'app:locales': string;
5
4
  }>;
@@ -1,2 +1,2 @@
1
- import{basename as e,join as t}from"node:path";import{directoryExists as a,scanFolderSync as o}from"@moneko/utils";import{watch as l}from"chokidar";import r from"../commom/log.mjs";import n from"../commom/parse-module-meta.mjs";import s from"../commom/reactive-object.mjs";import c from"../commom/require.mjs";import i from"../commom/sigint-exit.mjs";import{CONFIG as g}from"../config.mjs";import{FRAMEWORK as m,isDev as u}from"../process-env.mjs";let p={react:'import sso from "shared-store-object";',solid:'import { createEffect, createRoot, getOwner } from "solid-js";import { createStore } from "solid-js/store";'},f={react:'let storageKey="localizable.language",language=localStorage.getItem(storageKey)||navigator.language,{translation:a,...defaultLocale}=Object.assign({title:"简体中文",language:navigator.language,translation:{}},resources[language]||resources[navigator.language]),localizable=sso({lang:defaultLocale,t:a});export function setLang(a){let{translation:e,...l}=resources[a]||{};e&&(localizable.lang=l,localizable.t=e,localStorage.setItem(storageKey,l.language))}export default localizable;',solid:'let locale=createRoot(()=>{let e="localizable.language",a=localStorage.getItem(e)||navigator.language,{translation:l,...o}=Object.assign({title:"简体中文",language:navigator.language,translation:{}},resources[a]||resources[navigator.language]),[n,c]=createStore({lang:o,t:l});return createEffect(()=>{let a=resources[n.lang.language]?.translation;a&&(c("t",a),localStorage.setItem(e,n.lang.language))}),{localizable:n,setLocalizable:c,setLang:function(e){let{translation:a,...l}=resources[e]||{};a&&c("lang",l)}}},getOwner());export const setLocalizable=locale.setLocalizable;export const t=locale.localizable.t;export const lang=locale.localizable.lang;export const setLang=locale.setLang;'}[m];function d(e,t){return`${p[m]}
2
- export function template(r,n){return r.replace(/\\\${\\w+}/g,function(r){var t=r.slice(2,-1);var e=n[t];return e!==void 0?e.toString():""})}function deepFreeze(o) { const p = Reflect.ownKeys(o);for (const k of p) {const v = o[k];if ((v && typeof v === "object") || typeof v === "function") {deepFreeze(v);}}return Object.freeze(o);}export const locales = ${JSON.stringify(e)};const _res = ${JSON.stringify(t)};const resources = deepFreeze(_res);${f}`}let b=n("@app/locales");export const localesModuleName=b.file;export const locales=new s({[localesModuleName]:d([],{}),[b.pkg]:b.meta});let v={};async function j(t,a){let o=e(t).replace(/\.[^.]+$/,"");try{"deleted"===a?delete v[o]:(delete c.cache[t],Object.assign(v,{[o]:c(t).default}));let e=[],l={};for(let t in v)if(Object.prototype.hasOwnProperty.call(v,t)){let{language:a=o,title:r=a,icon:n,translation:s={}}=v[t];e.push({language:a,title:r,icon:n}),l[a]={language:a,title:r,icon:n,translation:s}}locales.setData(localesModuleName,d(e,l)),locales.setData(b.pkg,b.meta)}catch(e){r(e)}}let z=t(g.alias["@"],"./locales");if(a(z)&&!1!==g.htmlPluginOption){let e=o(z,[".ts$"]).filter(e=>!/^\..*|\.d\.ts$/.test(e));await Promise.allSettled(e.map(e=>j(e,"added"))),u&&"true"!==process.env.IS_BUILD&&function(e,t){let a=l(e,{ignored:t,persistent:!0,ignoreInitial:!0});function o(){a.unwatch(e),a.close()}a.on("add",e=>{j(e,"added")}),a.on("change",e=>{j(e,"change")}),a.on("unlink",e=>{j(e,"deleted")}),a.once("ready",()=>{u&&"true"!==process.env.IS_BUILD||o()}),i(o)}(z,[/^\..*/,/!\.ts$/,/\.d\.ts$/])}
1
+ import{basename as e,join as t}from"node:path";import{directoryExists as a,scanFolderSync as o}from"@moneko/utils";import{watch as l}from"chokidar";import r from"../commom/log.mjs";import n from"../commom/reactive-object.mjs";import c from"../commom/require.mjs";import s from"../commom/sigint-exit.mjs";import{CONFIG as i}from"../config.mjs";import{FRAMEWORK as g,isDev as m}from"../process-env.mjs";let u={react:'import sso from "shared-store-object";',solid:'import { createEffect, createRoot, getOwner } from "solid-js";import { createStore } from "solid-js/store";'},p={react:'let storageKey="localizable.language",language=localStorage.getItem(storageKey)||navigator.language,{translation:a,...defaultLocale}=Object.assign({title:"简体中文",language:navigator.language,translation:{}},resources[language]||resources[navigator.language]),localizable=sso({lang:defaultLocale,t:a});export function setLang(a){let{translation:e,...l}=resources[a]||{};e&&(localizable.lang=l,localizable.t=e,localStorage.setItem(storageKey,l.language))}export default localizable;',solid:'let locale=createRoot(()=>{let e="localizable.language",a=localStorage.getItem(e)||navigator.language,{translation:l,...o}=Object.assign({title:"简体中文",language:navigator.language,translation:{}},resources[a]||resources[navigator.language]),[n,c]=createStore({lang:o,t:l});return createEffect(()=>{let a=resources[n.lang.language]?.translation;a&&(c("t",a),localStorage.setItem(e,n.lang.language))}),{localizable:n,setLocalizable:c,setLang:function(e){let{translation:a,...l}=resources[e]||{};a&&c("lang",l)}}},getOwner());export const setLocalizable=locale.setLocalizable;export const t=locale.localizable.t;export const lang=locale.localizable.lang;export const setLang=locale.setLang;'}[g];function f(e,t){return`${u[g]}
2
+ export function template(r,n){return r.replace(/\\\${\\w+}/g,function(r){var t=r.slice(2,-1);var e=n[t];return e!==void 0?e.toString():""})}function deepFreeze(o) { const p = Reflect.ownKeys(o);for (const k of p) {const v = o[k];if ((v && typeof v === "object") || typeof v === "function") {deepFreeze(v);}}return Object.freeze(o);}export const locales = ${JSON.stringify(e)};const _res = ${JSON.stringify(t)};const resources = deepFreeze(_res);${p}`}export const locales=new n({"app:locales":f([],{})});let d={};async function b(t,a){let o=e(t).replace(/\.[^.]+$/,"");try{"deleted"===a?delete d[o]:(delete c.cache[t],Object.assign(d,{[o]:c(t).default}));let e=[],l={};for(let t in d)if(Object.prototype.hasOwnProperty.call(d,t)){let{language:a=o,title:r=a,icon:n,translation:c={}}=d[t];e.push({language:a,title:r,icon:n}),l[a]={language:a,title:r,icon:n,translation:c}}locales.setData("app:locales",f(e,l))}catch(e){r(e)}}let v=t(i.alias["@"],"./locales");if(a(v)&&!1!==i.htmlPluginOption){let e=o(v,[".ts$"]).filter(e=>!/^\..*|\.d\.ts$/.test(e));await Promise.allSettled(e.map(e=>b(e,"added"))),m&&"true"!==process.env.IS_BUILD&&function(e,t){let a=l(e,{ignored:t,persistent:!0,ignoreInitial:!0});function o(){a.unwatch(e),a.close()}a.on("add",e=>{b(e,"added")}),a.on("change",e=>{b(e,"change")}),a.on("unlink",e=>{b(e,"deleted")}),a.once("ready",()=>{m&&"true"!==process.env.IS_BUILD||o()}),s(o)}(v,[/^\..*/,/!\.ts$/,/\.d\.ts$/])}
@@ -1,2 +1,5 @@
1
- declare const normalModules: Record<string, string | object>;
2
- export default normalModules;
1
+ import webpack from 'webpack';
2
+ type VirtualModules = ConstructorParameters<typeof webpack.experiments.schemes.VirtualUrlPlugin>[0];
3
+ export declare const vm_schema = "app";
4
+ export declare const vm: VirtualModules;
5
+ export {};
@@ -1 +1 @@
1
- import{join as p}from"node:path";import{getAppEntry as m,getAppFallback as o,getAppMdxScope as e,getAppMergeRouter as t,getAppNormalizeCss as r,getAppPrefixRouter as s,getAppRem as a,getAppSuspense as i}from"@moneko/mdx";import{updateFileSync as n}from"@moneko/utils";import f from"../commom/has-pkg.mjs";import l from"../commom/paths.mjs";import d from"../commom/rule.mjs";import{CONFIG as c}from"../config.mjs";import j from"../plugin/module-federation.mjs";import{APPTYPE as x,FRAMEWORK as u}from"../process-env.mjs";import g from"../utils/create-types.mjs";import{generateDeclaration as v}from"../utils/dts.mjs";import{node_modules as h,transformModule as k}from"../utils/index.mjs";import y from"./coverage.mjs";import{docs as b,docsModuleName as z}from"./docs.mjs";import D from"./info.mjs";import{locales as C,localesModuleName as P}from"./locales.mjs";import M from"./render-app.mjs";import{route as O,routesModuleName as S}from"./routes.mjs";let q=f(p(c.alias["@"],"./mdx-scope.tsx"))||f(p(c.alias["@"],"./mdx-scope.ts")),w={"@app/env.ts":c.env,"@app/info.ts":D,"@app/render.tsx":"react"===u?M:"","@app/entry.ts":m(p(c.alias["@"],"./index.ts"),!!j.length,!!c.rem,!!c.normalizeCss,x,u),"@app/rem":a(c.rem?.designSize||1680),"@app/fallback":o(c.fallbackCompPath),"@app/coverage":y(l.coveragePath),"@app/merge-router":t(),"@app/prefix-router":s(),"@app/normalize/index.css":r(),"@app/suspense/index.tsx":i(x,u),"@app/mdx-scope.tsx":q?e(q):"export default {}","@app/routes":O.getData(S),"@app/locales":C.getData(P),"@app/docs":b.getData(z)};n(h("@types/@app/index.d.ts"),["@app/env.ts","@app/info.ts","@app/entry.ts","@app/mdx-scope.tsx"].map(p=>g(p.replace(d.js,""),v(k(w[p]),p))).join("\n"));let A=h("@types/@vm/index.d.ts"),B=c.virtualModule||{};n(A,Object.keys(B).map(p=>g(p,v(k(B[p]),p))).join("\n"));export default w;
1
+ import{join as e}from"node:path";import{getAppEntry as t,getAppFallback as o,getAppMdxScope as r,getAppMergeRouter as s,getAppNormalizeCss as m,getAppPrefixRouter as p,getAppRem as a,getAppSuspense as c}from"@moneko/mdx";import{updateFileSync as i}from"@moneko/utils";import n from"../commom/has-pkg.mjs";import l from"../commom/paths.mjs";import u from"../commom/reactive-object.mjs";import f from"../commom/require.mjs";import{CONFIG as d}from"../config.mjs";import x from"../plugin/module-federation.mjs";import{APPTYPE as y,FRAMEWORK as j}from"../process-env.mjs";import g from"../utils/create-types.mjs";import{generateDeclaration as v}from"../utils/dts.mjs";import{node_modules as h,transformModule as D}from"../utils/index.mjs";import k from"./coverage.mjs";import{comment as b,docs as z}from"./docs.mjs";import{examples as O}from"./example.mjs";import w from"./info.mjs";import{locales as C}from"./locales.mjs";import P from"./render-app.mjs";import{route as S}from"./routes.mjs";let q=n(e(d.alias["@"],"./mdx-scope.tsx"))||n(e(d.alias["@"],"./mdx-scope.ts"));export const vm_schema="app";let J=new u({});J.on("change",()=>{i(h("@types/vm/index.d.ts"),Object.values(J.data).join("\n"))});export const vm={env:{type:".ts",source:()=>{let e="app:env",t=D(d.env);return J.setData(e,g(e,v(t,e))),t}},info:{type:".ts",source:()=>{let e="app:info",t=`${process.cwd()}/package.json`;delete f.cache[t];let o=D({...f(t),...w});return J.setData(e,g(e,v(o,e))),o}},render:{type:".tsx",source:()=>"react"===j?P:""},entry:{type:".tsx",source:()=>{let o="app:entry",r=t(e(d.alias["@"],"./index.ts"),!!x.length,!!d.rem,!!d.normalizeCss,y,j);return J.setData(o,g(o,v(r,o))),r}},rem:{type:".tsx",source:()=>a(d.rem?.designSize||1680)},fallback:{type:".tsx",source:()=>{let e="app:fallback",t=o(d.fallbackCompPath);return J.setData(e,g(e,v(t,e))),t}},coverage:{type:".tsx",source:()=>k(l.coveragePath)},"merge-router":{type:".tsx",source:()=>s()},"prefix-router":{type:".tsx",source:()=>p()},normalize:{type:".css",source:()=>m()},suspense:{type:".tsx",source:()=>c(y,j)},"mdx-scope":{type:".tsx",source:()=>{let e="app:mdx-scope",t=q?r(q):"export default {}";return J.setData(e,g(e,v(t,e))),t}},routes:{type:".tsx",source:()=>S.getData("app:routes")},locals:{type:".tsx",source:()=>C.getData("app:locales")},docs:{type:".tsx",source:()=>z.getData("app:docs")},example:{type:".md",source:()=>O.getData("app:example")},comment:{type:".md",source:()=>JSON.stringify(b.data)}};let M=h("@types/@vm/index.d.ts"),N=d.virtualModule||{},$=Object.keys(N).map(e=>g(e,v(D(N[e]),e)));$.length&&i(M,$.join("\n"));
@@ -2,7 +2,7 @@ import{CONFIG as e}from"../config.mjs";import{APPTYPE as r,frameworkVersion as t
2
2
  import ReactDOM from '${n?"react-dom":"react-dom/client"}';
3
3
  import React, { StrictMode, type ReactElement } from 'react';
4
4
  import { ErrorBoundary } from '@moneko/react';
5
- import routes from '@app/routes';
5
+ import routes from 'app:routes';
6
6
  import { ${c}, useRoutes } from 'react-router-dom';
7
7
 
8
8
  ${p}
@@ -1,8 +1,6 @@
1
1
  import ReactiveObject from '../commom/reactive-object.mjs';
2
- export declare const routesModuleName: string;
3
- export declare const routesModulePkgJson: string;
4
- export declare const routesModuleMeta: string;
2
+ export declare function getRouter(): string;
5
3
  export declare const route: ReactiveObject<{
6
- [x: string]: string;
4
+ 'app:routes': string;
7
5
  }>;
8
6
  export declare function generatorRouter(): void;
package/lib/vm/routes.mjs CHANGED
@@ -1 +1 @@
1
- import{generateRouter as o}from"@moneko/mdx";import e from"../commom/parse-module-meta.mjs";import{routeDir as t}from"../commom/paths.mjs";import r from"../commom/reactive-object.mjs";import{CONFIG as m}from"../config.mjs";import{FRAMEWORK as s,isDev as u,isLibrary as n}from"../process-env.mjs";import{watchFiles as p}from"./utils.mjs";let a=n?"@pkg":"@/pages",i=e("@app/routes");export const routesModuleName=i.file;export const routesModulePkgJson=i.pkg;export const routesModuleMeta=i.meta;function c(){return!1===m.htmlPluginOption?"":o(t,`${m.alias["@"]}/router/index.ts`,s,a,n,"6")}export const route=new r({[routesModuleName]:c(),[routesModulePkgJson]:routesModuleMeta});export function generatorRouter(){route.setData(routesModuleName,c())}u&&"true"!==process.env.IS_BUILD&&p(t,n?/(?<!README\.mdx?)$/:/(?<!index\.tsx?)$/,generatorRouter);
1
+ import{generateRouter as o}from"@moneko/mdx";import{routeDir as t}from"../commom/paths.mjs";import e from"../commom/reactive-object.mjs";import{CONFIG as r}from"../config.mjs";import{FRAMEWORK as m,isDev as p,isLibrary as s}from"../process-env.mjs";import{watchFiles as n}from"./utils.mjs";let i=s?"@pkg":"@/pages";export function getRouter(){return!1===r.htmlPluginOption?"":o(t,`${r.alias["@"]}/router/index.ts`,m,i,s,"6")}export const route=new e({"app:routes":getRouter()});export function generatorRouter(){route.setData("app:routes",getRouter())}p&&"true"!==process.env.IS_BUILD&&n(t,s?/(?<!README\.mdx?)$/:/(?<!index\.tsx?)$/,generatorRouter);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.58.1-bate.3",
3
+ "version": "4.0.0-bate.0",
4
4
  "description": "core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",
@@ -130,7 +130,7 @@
130
130
  "dependencies": {
131
131
  "@moneko/convert": "1.1.3",
132
132
  "@moneko/eslint": "1.9.14",
133
- "@moneko/mdx": "0.1.44",
133
+ "@moneko/mdx": "1.0.0-beta.2",
134
134
  "@moneko/raw-import": "1.1.1",
135
135
  "@moneko/request": "1.6.2",
136
136
  "@moneko/stylelint": "1.6.0",