@moneko/core 3.58.1-bate.4 → 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.
- package/lib/build/server.mjs +1 -1
- package/lib/commom/parse-module-meta.mjs +1 -1
- package/lib/commom/rule.d.mts +2 -2
- package/lib/common.mjs +1 -1
- package/lib/plugin/virtual-module.d.mts +0 -9
- package/lib/plugin/virtual-module.mjs +1 -1
- package/lib/plugins.config.mjs +1 -1
- package/lib/vm/docs.d.mts +3 -4
- package/lib/vm/docs.mjs +1 -1
- package/lib/vm/example.d.mts +1 -1
- package/lib/vm/example.mjs +1 -1
- package/lib/vm/info.mjs +1 -1
- package/lib/vm/locales.d.mts +1 -2
- package/lib/vm/locales.mjs +2 -2
- package/lib/vm/modules.d.mts +5 -2
- package/lib/vm/modules.mjs +1 -1
- package/lib/vm/render-app.mjs +1 -1
- package/lib/vm/routes.d.mts +2 -4
- package/lib/vm/routes.mjs +1 -1
- package/package.json +2 -2
package/lib/build/server.mjs
CHANGED
|
@@ -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},
|
|
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,
|
|
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}}`}}
|
package/lib/commom/rule.d.mts
CHANGED
|
@@ -18,8 +18,8 @@ declare const Rule: {
|
|
|
18
18
|
/**
|
|
19
19
|
* 提取函数字符串
|
|
20
20
|
* @example
|
|
21
|
-
* // () => import('
|
|
22
|
-
* "rr(() => import('
|
|
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
|
|
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,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
|
-
|
|
1
|
+
export{};
|
package/lib/plugins.config.mjs
CHANGED
|
@@ -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{
|
|
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
|
|
3
|
-
|
|
4
|
-
|
|
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
|
|
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)})}
|
package/lib/vm/example.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import ReactiveObject from '../commom/reactive-object.mjs';
|
|
2
|
-
export declare const exampleModuleName = "
|
|
2
|
+
export declare const exampleModuleName = "app:example";
|
|
3
3
|
export declare const examples: ReactiveObject<Record<string, string>>;
|
|
4
4
|
export declare function generatorExample(): void;
|
package/lib/vm/example.mjs
CHANGED
|
@@ -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="
|
|
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={
|
|
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;
|
package/lib/vm/locales.d.mts
CHANGED
package/lib/vm/locales.mjs
CHANGED
|
@@ -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/
|
|
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);${
|
|
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$/])}
|
package/lib/vm/modules.d.mts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 {};
|
package/lib/vm/modules.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{join as
|
|
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"));
|
package/lib/vm/render-app.mjs
CHANGED
|
@@ -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 '
|
|
5
|
+
import routes from 'app:routes';
|
|
6
6
|
import { ${c}, useRoutes } from 'react-router-dom';
|
|
7
7
|
|
|
8
8
|
${p}
|
package/lib/vm/routes.d.mts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import ReactiveObject from '../commom/reactive-object.mjs';
|
|
2
|
-
export declare
|
|
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
|
-
|
|
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
|
|
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
|
+
"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.
|
|
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",
|