@moneko/core 4.5.3-beta.2 → 4.5.3-beta.3
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/bin/build-dev.mjs +1 -1
- package/lib/bin/build.mjs +1 -1
- package/lib/bin/start.mjs +1 -1
- package/lib/bin/utils/bundle-app.mjs +1 -1
- package/lib/bin/utils/config.mjs +1 -1
- package/lib/bin/utils/convert-react.d.mts +2 -1
- package/lib/commom/custom-config.d.mts +7 -0
- package/lib/commom/custom-config.mjs +1 -0
- package/lib/commom/paths.d.mts +2 -17
- package/lib/commom/paths.mjs +1 -1
- package/lib/commom/posix.d.mts +10 -0
- package/lib/commom/posix.mjs +1 -0
- package/lib/commom/rule.d.mts +0 -1
- package/lib/commom/rule.mjs +1 -1
- package/lib/commom/setup-env.mjs +1 -1
- package/lib/common.mjs +1 -1
- package/lib/config.mjs +1 -1
- package/lib/module.config.mjs +1 -1
- package/lib/vm/docs.mjs +1 -1
- package/package.json +1 -1
package/lib/bin/build-dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{argv as
|
|
1
|
+
import{argv as e,exit as o}from"node:process";import{ink as r,println as t}from"@moneko/utils";import m from"../commom/setup-env.mjs";export async function build(){let i=e[3],s=e[4],p=e.slice(5);i||(t(r(`type: 无效值 ${r(i,"245")}`,"red")),o(1));let n=p.indexOf("no-verify");-1!==n&&p.splice(n,1),await m("development",i,s,p,!0);try{await import("../build-dev.mjs")}catch(e){t(r(Error(e).message,"red")),o(1)}}
|
package/lib/bin/build.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{argv as o,exit as t}from"node:process";import{ink as e,println as s,removeDir as i}from"@moneko/utils";import{
|
|
1
|
+
import{argv as o,exit as t}from"node:process";import{ink as e,println as s,removeDir as i}from"@moneko/utils";import{join as r}from"../commom/posix.mjs";import m from"../commom/setup-env.mjs";import{cwd as n,swcCachePath as c}from"./utils/config.mjs";import{getSwcOption as l}from"./utils/setup-swcrc.mjs";import{lesscCommonjs as p}from"./lessc.mjs";import d from"./tsc.mjs";export async function build(){let a=o[3],j=o[4],u=o.slice(5);a||(s(e(`type: 无效值 ${e(a,"245")}`,"red")),t(1));let f=!u.includes("no-docs"),x=!u.includes("no-lib"),y=!u.includes("no-es"),_=!u.includes("no-dts"),g=u.filter(o=>!["no-docs","no-es","no-lib"].includes(o));if(await m("production",a,j,g,!0),"library"===a){let o="solid"===j?await import("@moneko/convert/solid"):await import("@moneko/convert"),{CONFIG:t}=await import("../config.mjs"),e="swc"===t.dts,s=[x&&{type:"commonjs",dir:"lib",msg:"Convert to CommonJS"},y&&{type:"es6",dir:"es",msg:"Convert to ES Module"}].filter(Boolean);for(let m=0,a=s.length;m<a;m++){if(i(r(n,`./${s[m].dir}`)),"react"===j){let t=await l();"es6"===s[m].type&&(t.jsc.target="es2015"),t.jsc.experimental.emitIsolatedDts=_&&e,t.jsc.experimental.cacheRoot=c,t.module.type=s[m].type,o.convert({outDir:s[m].dir,inputDir:"components",ignore:[/^.*\/__*__\//,/\.test\.(js|ts)x?$/,/\.DS_Store/,/\.mdx?$/,/^.*\/examples\//,/\.d\.(cj|mj|j|t|ct|mt)sx?$/],options:t})}else if("solid"===j){let e={jsxOptions:t.jsxDomExpressions,presetEnvOption:{modules:"commonjs"}};"es6"===s[m].type&&(e.presetEnvOption.modules=!1),o.convertSolid({outDir:s[m].dir,inputDir:"components",ignore:[/^.*\/__*__\//,/\.test\.(js|ts)x?$/,/\.DS_Store/,/\.mdx?$/,/^.*\/examples\//,/\.d\.(cj|mj|j|t|ct|mt)sx?$/],options:e})}"commonjs"===s[m].type&&p(),_&&!e&&d(s[m].dir)}}if("library"!==a||f&&"library"===a)try{await import("../build.mjs")}catch(o){s(e(Error(o).message,"red")),t(1)}}
|
package/lib/bin/start.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{argv as e,exit as o}from"node:process";import{ink as
|
|
1
|
+
import{argv as e,exit as o}from"node:process";import{ink as r,println as t}from"@moneko/utils";import m from"../commom/setup-env.mjs";async function i(){let i=e[3],s=e[4],p=e.slice(5);i||(t(r(`type: 无效值 ${r(i,"245")}`,"red")),o(1));let n=p.indexOf("no-verify");-1!==n&&p.splice(n,1),await m("development",i,s,p,!1);try{await import("../dev.mjs")}catch(e){t(r(Error(e).message,"red")),o(1)}}export default i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{execSync as
|
|
1
|
+
import{execSync as e}from"node:child_process";import{renameSync as o}from"node:fs";import{posix as n}from"node:path";import{bundleIpa as p,createDir as t,ink as a,print as l}from"@moneko/utils";import r from"../../commom/timer.mjs";let i=n.join;export function bundleApk(n,p,u="-release"){l(a("正在编译 apk...","yellow"),!0),r.start(`bundle apk ${u}`),e(`flutter build apk -${u}`),r.end(`bundle apk ${u}`),t(p),o(i(n,`build/app/outputs/flutter-apk/app${u}.apk`),p),l(`✨ ${a("Apk 编译","cyan")}: ${a("完成","cyan")}`,!0)}export function bundleIOS(n,u,d="-release"){l(a("正在编译 ipa...","yellow"),!0),r.start(`bundle ipa ${d}`);let m=i(u,"Runner/Payload");e(`flutter build ios -${d} --no-codesign`),t(m),o(i(n,"build/ios/iphoneos/Runner.app"),m),p(i(u,"Runner"),u,d),r.end(`bundle ipa ${d}`),l(`✨ ${a("ipa 编译","cyan")}: ${a("完成","cyan")}`,!0)}
|
package/lib/bin/utils/config.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cwd as o,execPath as
|
|
1
|
+
import{posix as e}from"node:path";import{cwd as o,execPath as t,platform as c}from"node:process";let{dirname:n,join:r}=e,s="u">typeof Deno?"deno":"u">typeof Bun?"bun":"node",p=n(t);"win32"===c&&p.includes(" ")&&(p=`"${p}"`);export const runtimePath=r(p,s);export const corePkg="@moneko/core";export const cwd=o();export const cachePath=r(cwd,"node_modules/.cache");export const swcCachePath=r(cachePath,".swc");export function parseBraced(e){return e.startsWith("[")&&e.endsWith("]")?e.slice(1,-1).split(","):[e]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
// import {
|
|
1
|
+
// import { posix } from 'node:path';
|
|
2
|
+
// const { join, sep, extname, normalize } = posix;
|
|
2
3
|
// import { copyFile, ink, println, scanFolderSync, updateFile } from '@moneko/utils';
|
|
3
4
|
// import { JsMinifyOptions, type Options, type Output, transformFile } from '@swc/core';
|
|
4
5
|
// function getOutfilePath(outDir: string, file: string, outFileExtension?: string) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{argv as o,env as i}from"node:process";import n from"./parse-args.mjs";let r=JSON.parse(i.npm_config_argv||'{"original":[]}').original,g={};for(let o=0,i=r.length;o<i;o++){let i=r[o].split("=");Object.assign(g,{[i[0]]:i[1]||!0})}export const CUSTOMCONFIG=i.npm_config_config||g.config||i.__args__config__||n(o.slice(2)).config;
|
package/lib/commom/paths.d.mts
CHANGED
|
@@ -1,24 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function join(...segments: string[]): string;
|
|
3
|
-
export declare const basename: typeof posix.basename;
|
|
4
|
-
export declare const dirname: typeof posix.dirname;
|
|
5
|
-
export declare const extname: typeof posix.extname;
|
|
6
|
-
export declare const normalize: typeof posix.normalize;
|
|
7
|
-
export declare const parse: typeof posix.parse;
|
|
8
|
-
export declare const relative: typeof posix.relative;
|
|
9
|
-
export declare const resolve: typeof posix.resolve;
|
|
10
|
-
export declare const sep: typeof path.sep;
|
|
1
|
+
export * from './posix.mjs';
|
|
11
2
|
/** 当前文件所在目录的绝对路径 */ export declare const __dirname: string;
|
|
12
3
|
/** yarn 命令行参数对象,包含配置选项 */ export declare const yarnArgv: Record<string, string> & {
|
|
13
4
|
config?: string;
|
|
14
5
|
};
|
|
15
|
-
|
|
16
|
-
* @example
|
|
17
|
-
* 当通过以下命令启动时, 此时 CUSTOMCONFIG 为 test
|
|
18
|
-
* ```sh
|
|
19
|
-
* npm run start --config=test
|
|
20
|
-
* ```
|
|
21
|
-
*/ export declare const CUSTOMCONFIG: string | undefined;
|
|
6
|
+
export { CUSTOMCONFIG } from './custom-config.mjs';
|
|
22
7
|
export declare const TMP_DIR: string;
|
|
23
8
|
declare const paths: {
|
|
24
9
|
/** node_modules 目录路径 */ readonly nodeModules: string;
|
package/lib/commom/paths.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{tmpdir as
|
|
1
|
+
import{tmpdir as o}from"node:os";import{cwd as t,env as e}from"node:process";import{fileURLToPath as r,URL as n}from"node:url";import{fileExists as a}from"@moneko/utils";import{CUSTOMCONFIG as c}from"./custom-config.mjs";import{resolve as m}from"./posix.mjs";export*from"./posix.mjs";let s=JSON.parse(e.npm_config_argv||'{"original":[]}').original;export const __dirname=r(new n("..",import.meta.url));export const yarnArgv={};for(let o=0,t=s.length;o<t;o++){let t=s[o].split("=");Object.assign(yarnArgv,{[t[0]]:t[1]||!0})}export{CUSTOMCONFIG}from"./custom-config.mjs";let i=t(),p=m(i,"node_modules");export const TMP_DIR=m(o(),"@moneko");let h={nodeModules:p,pnpmNodeModules:m(p,".pnpm/node_modules"),denoNodeModules:m(p,".deno"),corePath:__dirname,programPath:i,CA_DIR:m(TMP_DIR,".ca"),webpackCachePath:m(p,".cache"),lintCachePath:m(p,".cache"),httpCachePath:m(p,".cache/http"),swcCachePath:m(p,".cache/.swc"),configPath:m(i,"config/index.ts"),customConfigPath:m(i,`config/${c}.ts`),coveragePath:m(i,"coverage/clover.xml"),pagesPath:m(i,"src/pages"),componentsPath:m(i,"components"),mockPath:m(i,"mock")};export const config_files=[a(h.configPath)&&h.configPath,a(h.customConfigPath)&&h.customConfigPath].filter(Boolean);export const routeDir="library"===e.APPTYPE?h.componentsPath:h.pagesPath;export default h;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { posix, win32 } from 'node:path';
|
|
2
|
+
export declare const basename: typeof posix.basename;
|
|
3
|
+
export declare const dirname: typeof posix.dirname;
|
|
4
|
+
export declare const extname: typeof posix.extname;
|
|
5
|
+
export declare const normalize: typeof posix.normalize;
|
|
6
|
+
export declare const parse: typeof posix.parse;
|
|
7
|
+
export declare const relative: typeof posix.relative;
|
|
8
|
+
export declare const resolve: typeof posix.resolve;
|
|
9
|
+
export declare const sep: typeof win32.sep;
|
|
10
|
+
export declare function join(...segments: string[]): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{posix as e,win32 as t}from"node:path";import{URL as o}from"node:url";let r=/^https?:\/\//;export const basename=e.basename;export const dirname=e.dirname;export const extname=e.extname;export const normalize=e.normalize;export const parse=e.parse;export const relative=e.relative;export const resolve=e.resolve;export const sep=t.sep;export function join(...t){let n=t[0];if(r.test(n)){let e=n;for(let r=1;r<t.length;r++)e=new o(t[r],e).href;return e}return e.join(...t)}
|
package/lib/commom/rule.d.mts
CHANGED
package/lib/commom/rule.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const js=/\.(cj|mj|t|j)s(|x)$/i;export const css=/\.css$/i;export const less=/\.less$/i;export const scss=/\.(sa|sc)ss$/i;export const wasm=/\.wasm$/i;export const txt=/\.txt$/i;export const image=/\.(gif|png|jpe?g|webp|svg|ico)$/i;export const video=/\.(webm|mp4|ogv)$/i;export const font=/\.(woff2?|eot|ttf|otf)(\?.*)?$/i;export const markdown=/\.mdx?$/i;export const tsdoc=/^(?![._]).*(?<!\.test)\.(tsx?)$/;export const css_module=/(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i;export const less_global=/global\.less$/i;export const sass_global=/global\.(sc|sa)ss$/i;export const node_modules_css_module=/(^(?!.*node_modules))(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i;export const node_modules=/[\\/]node_modules[\\/]/;export const __tests__=/(.+)\/__tests__\/(.+)/;export const extract_func=/"rr\((.+?)\)rr"/g;
|
|
1
|
+
export const js=/\.(cj|mj|t|j)s(|x)$/i;export const css=/\.css$/i;export const less=/\.less$/i;export const scss=/\.(sa|sc)ss$/i;export const wasm=/\.wasm$/i;export const txt=/\.txt$/i;export const image=/\.(gif|png|jpe?g|webp|svg|ico)$/i;export const video=/\.(webm|mp4|ogv)$/i;export const font=/\.(woff2?|eot|ttf|otf)(\?.*)?$/i;export const markdown=/\.mdx?$/i;export const tsdoc=/^(?![._]).*(?<!\.test)\.(tsx?)$/;export const css_module=/(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i;export const less_global=/global\.less$/i;export const sass_global=/global\.(sc|sa)ss$/i;export const node_modules_css_module=/(^(?!.*node_modules))(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i;export const node_modules=/[\\/]node_modules[\\/]/;export const __tests__=/(.+)\/__tests__\/(.+)/;export const extract_func=/"rr\((.+?)\)rr"/g;
|
package/lib/commom/setup-env.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{env as e}from"node:process";import{fileExists as t,loadFile as r}from"@moneko/utils";async function
|
|
1
|
+
import{env as e}from"node:process";import{fileExists as t,loadFile as r}from"@moneko/utils";import{CUSTOMCONFIG as n}from"./custom-config.mjs";async function i(i,o,s,a,l,c){let m=c||n,f=[".env",".env/.env",`.${i}.env`,`.env/.${i}.env`,`.${m}.env`,`.env/.${m}.env`].filter(t),p={NODE_ENV:i,APPTYPE:o,FRAMEWORK:s,IS_BUILD:l};return a.forEach(e=>{let[t,r]=e.replace(/^--/,"").split("=");Object.assign(p,{[`__args__${t}__`]:r||!0})}),(await Promise.all(f.map(r))).forEach(e=>{e&&Object.assign(p,e.split("\n").reduce((e,t)=>{if(!t||t.trim().startsWith("#"))return e;let[r,...n]=t.split("=");if(!r)return e;let i=n.join("=").trim();return e[r.trim()]=i.replace(/^["']|["']$/g,""),e},{}))}),Object.keys(p).forEach(t=>{let r=p[t];e[t]!==r&&(e[t]=p[t])}),p}export default i;
|
package/lib/common.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./commom/has-pkg.mjs";import t,{config_files as s,CUSTOMCONFIG as o
|
|
1
|
+
import e from"./commom/has-pkg.mjs";import t,{config_files as s,CUSTOMCONFIG as o}from"./commom/paths.mjs";import{extname as a,join as n,resolve as i}from"./commom/posix.mjs";import*as r from"./commom/rule.mjs";import{OverrideResolverPlugin as l}from"./plugin/override-resolve.mjs";import{isObject as m,resolveProgram as c}from"./utils/index.mjs";import{CONFIG as p}from"./config.mjs";import u from"./plugins.config.mjs";import{app_schema as h,CACHE_NAME as d,isDev as f,isLibrary as g,packageJson as y,projectNameCamelCase as b}from"./process-env.mjs";export const outputConfig={path:c(g?"docs":"dist"),filename:e=>e.filename?.includes(".worker")?"worker/[name].js":"js/[name].[contenthash].bundle.js",chunkFilename:"js/[contenthash].chunk.js",cssFilename:"style/[contenthash].css",cssChunkFilename:"style/[contenthash].chunk.css",assetModuleFilename:e=>{let t=a(e.filename||"").substring(1);return`assets/${t}/[hash][ext]`},library:{name:`${b}`,type:"umd",umdNamedDefine:!0},globalObject:"self",chunkLoadingGlobal:`webpackJsonp_${y.name}`,pathinfo:f,clean:!0,publicPath:p.publicPath,asyncChunks:!0,charset:!0,iife:!0,crossOriginLoading:"use-credentials",enabledWasmLoadingTypes:["fetch"],uniqueName:`${b}`};let j={main:[e(n(p.alias["@"],"service-worker")),`${h}:entry`].filter(Boolean)},v=[n(t.corePath,"./polyfills/public-path.mjs")];if(f&&p.refresh&&p.env.injectRemoteReactRefresh&&v.push(n(t.corePath,"./polyfills/inject-react-refresh.mjs")),p.polyfill&&v.push(n(t.corePath,"./polyfills/replace-children.mjs")),p.entry&&("string"==typeof p.entry?j={...j,main:[p.entry]}:Object.keys(p.entry)&&(j=Object.assign(j,p.entry))),"string"==typeof j.main?j.main=[...v,j.main]:Array.isArray(j.main)&&(j.main=[...v,...j.main]),p.output){if("string"==typeof p.output)outputConfig.path=p.output;else if(Object.keys(p.output)){let e=p.output,t={...outputConfig.library};Object.assign(outputConfig,e),"object"==typeof p.output&&e.library&&(outputConfig.library=Object.assign(t,e.library))}}let C={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:t.webpackCachePath,memoryCacheUnaffected:!0,name:d,version:`${y.version}`,buildDependencies:{config:s},maxMemoryGenerations:1};!1===p.cache?C=!1:m(p.cache)&&(C=Object.assign(C,p.cache));let k={},P={imports:!0,entries:!0,test:e=>{let s=e.nameForCondition();return!!(s&&(/^[a-z][a-z0-9]*:.+$/.test(s)||s?.startsWith(n(t.programPath,"src"))||s?.startsWith(n(t.programPath,"site"))||s?.startsWith(t.componentsPath)))}};p.lazyCompilation&&f&&"true"!==process.env.IS_BUILD?m(p.lazyCompilation)?Object.assign(k,P,p.lazyCompilation):Object.assign(k,P):k=!1;export const commonConfig={name:"client",target:"web",devtool:p.devtool,entry:j,mode:p.mode??"production",cache:C,snapshot:{immutablePaths:[t.pnpmNodeModules,t.denoNodeModules,r.node_modules],managedPaths:[t.pnpmNodeModules,t.denoNodeModules,r.node_modules],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}},stats:"errors-only",infrastructureLogging:{level:"error"},externalsPresets:p.externalsPresets,plugins:u,node:{global:!1,__filename:!1,__dirname:!1},experiments:{asyncWebAssembly:!0,cacheUnaffected:!0,lazyCompilation:k,buildHttp:m(p.buildHttp)?{allowedUris:[],lockfileLocation:i(t.httpCachePath,"http.lock"),cacheLocation:i(t.httpCachePath,"data"),upgrade:!0,...p.buildHttp}:p.buildHttp,backCompat:!0,futureDefaults:!0,css:!0,outputModule:!1,deferImport:!0},resolve:{extensions:[".mts",".mjs",".ts",".tsx",".js",".jsx",".json",".wasm"],alias:p.alias,modules:[t.nodeModules,t.pnpmNodeModules,t.denoNodeModules],mainFields:["browser","module","main"],mainFiles:["index"],plugins:p.resolvePlugins,preferAbsolute:!0,cache:!0,fallback:{}},externals:p.externals,output:outputConfig,recordsPath:p.recordsPath};p.overrideResolve&&commonConfig.resolve.plugins.push(new l(Object.assign({original:p.alias["@"],override:o&&c(o)},p.overrideResolve)));
|
package/lib/config.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"node:process";import{merge as o}from"webpack-merge";import
|
|
1
|
+
import e from"node:process";import{merge as o}from"webpack-merge";import{CUSTOMCONFIG as t}from"./commom/custom-config.mjs";import a from"./commom/paths.mjs";import{join as s,relative as n}from"./commom/posix.mjs";import r from"./commom/setup-env.mjs";import i from"./options/jsx-dom-expressions.mjs";import m from"./options/split-chunk.mjs";import{getConfigWithTypescript as l,isFunction as p,node_modules as c,resolveProgram as u}from"./utils/index.mjs";import{initDts as d}from"./vm/dts.mjs";import{APPTYPE as f,FRAMEWORK as h,frameworkVersion as g,isCI as v,isDev as x,isLibrary as j,isMobile as C,isReact as P,jsxImportSource as b,mainDirectory as k,NODE_ENV as w,PACKAGENAME as O}from"./process-env.mjs";let I=[/(app|vm|docs|example):[a-zA-Z_0-9]/,"@moneko","neko-ui",".cache/http/data","@element-plus","ant-design-vue","element-plus","element-ui","ng-zorro-antd","@mui","@du","@fontsource","@fortawesome","font-pingfang-sc","font-pingfang-tc","katex","react-markdown-editor-lite","react-photo-view","schema-design","monaco-editor"];export async function getConfig(o){let t=l(o).default;return(p(t)?await t(e):t)??{}}let S=await r(w,f,h,[],"true"===e.env.IS_BUILD,t),[y,M]=await Promise.all([getConfig(a.configPath),getConfig(a.customConfigPath)]),z={mode:w,strict:!1,devtool:"true"!==e.env.IS_BUILD&&x?"eval-cheap-module-source-map":"cheap-module-source-map",seo:!1,bundleAnalyzer:!1,polyfill:!1,entry:{},minifier:{},sourceMap:{filename:"[file].map",publicPath:"",namespace:O,moduleFilenameTemplate:"moneko://[namespace]/[resource-path]?[loaders]",fallbackModuleFilenameTemplate:"moneko://[namespace]/[resource-path]?[loaders]"},env:S,basename:"/",publicPath:"auto",rem:{designSize:C?375:1920},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:Object.assign({"@":u(k)},P&&g<18?{"react/package.json":c("react/package.json"),"react/jsx-runtime":c("react/jsx-runtime.js"),"react/jsx-dev-runtime":c("react/jsx-dev-runtime.js")}:{}),moduleRules:[],prefixJsLoader:[],cssModules:[],cssModuleDefinition:!0,importOnDemand:{},proxy:{},devServer:{host:"localhost",port:3e3,open:!0},htmlPluginOption:{title:O.toLocaleUpperCase(),favicon:n(a.programPath,`${a.corePath}/options/favicon.ico`)},copy:{},routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:m,runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:I,js:I,media:I,font:I,wasm:[]},mdx:{jsx:!1,development:x,jsxImportSource:b,providerImportSource:`@moneko/${h}/mdx`},jsxDomExpressions:i,bar:{name:"Client",nameColor:"68",msgColor:"242",barBgColor:"15",barColor:"69",quiet:v},normalizeCss:!0,externalsPresets:{},buildHttp:void 0,virtualModule:{},cssExtract:{},externals:["@swc/core"],lazyCompilation:!1,performance:!1,refresh:"solid"!==h,bundleId:"com.moneko.bid",bundles:[],stylelint:{},eslint:{lintDirtyModulesOnly:!1},minChunkSize:1e3,compression:!1,manifest:{filename:"site.webmanifest"},corepack:!0,reactJsxRuntime:"automatic"};j&&(z.alias=Object.assign(z.alias,{"@pkg":a.componentsPath,[O]:a.componentsPath}));let D=z;if((!1===(D=o(D,y,M)).devtool||!1===D.sourceMap)&&(D.sourceMap=!1,D.devtool=!1),"true"===e.env.CODESPACES&&(D.devServer.https=!1),!1===D.devServer.https&&"darwin"===e.platform&&(D.devServer.open=!1),D.htmlPluginOption&&(D.htmlPluginOption.tags||(D.htmlPluginOption.tags=[]),D.fixBrowserRouter&&D.htmlPluginOption.tags.push({textContent:"(function(l) {if (l.search[1] === '/' ) {var decoded = l.search.slice(1).split('&').map(function(s) {return s.replace(/~and~/g, '&')}).join('?');window.history.replaceState(null, null,l.pathname.slice(0, -1) + decoded + l.hash);}}(window.location))"}),D.manifest)){let e=D.manifest.publicPath??D.publicPath??"/";D.htmlPluginOption.tags.push({href:s("auto"===e?"/":e,D.manifest.filename),tag:"link",rel:"manifest"})}export const CONFIG=D;export const PUBLICPATH="auto"===CONFIG.publicPath?"":CONFIG.publicPath;d(CONFIG);
|
package/lib/module.config.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
let e;import s,{CUSTOMCONFIG as o
|
|
1
|
+
let e;import s,{CUSTOMCONFIG as o}from"./commom/paths.mjs";import{join as t,sep as r}from"./commom/posix.mjs";import a from"./commom/require.mjs";import*as l from"./commom/rule.mjs";import i from"./options/modify-vars.mjs";import n from"./options/reslove.mjs";import m from"./options/swcrc.mjs";import{getLightningCssTargets as c}from"./polyfills/targets.mjs";import{node_modules as p,resolveProgram as d}from"./utils/index.mjs";import u from"./utils/svg-to-data-uri.mjs";import{outputConfig as f}from"./common.mjs";import{CONFIG as y}from"./config.mjs";import{app_schema as h,FRAMEWORK as j,isDev as g,virtual_schema as x}from"./process-env.mjs";let v={loader:t(s.corePath,"/loader/lightning-css.cjs"),options:{sourceMap:!!y.sourceMap,targets:c(),rem:!!y.rem,importLoaders:2}},w={loader:n.lessLoader,options:{sourceMap:!!y.sourceMap,lessOptions:{modifyVars:i,javascriptEnabled:!0}}},P=new Map,L=["components","example","mock","site","src","server"].map(d);function M(e){return new Promise(o=>{o([...L,s.corePath,...y.rulesInclude?.[e]?.map(e=>"string"==typeof e?function(e){if(P.has(e))return P.get(e);try{let s,o=a.resolve(e).split(r),t=o.lastIndexOf("node_modules");return s=-1!==t?o.slice(0,t).join(r):o.join(r),P.set(e,[s]),[s]}catch{try{let s=a.resolve(`${e}${r}package.json`).replace(`${r}package.json`,"");P.set(e,[s])}catch{P.set(e,[p(e),p(`.pnpm/${e}`)])}return P.get(e)}}(e):e).flat()||[]])})}o&&L.push(d(o)),y.overrideResolve&&y.overrideResolve.override&&L.push(y.overrideResolve.override);let _=await Promise.all([M("css"),M("js"),M("media"),M("wasm"),M("font")]),C=_[0],I=_[1],O=_[2],b=_[3],N=_[4];n.sassLoader&&(e={loader:n.sassLoader,options:{implementation:await import("sass"),sassOptions:{}}});let $=f.library?.type==="umd"&&!1===y.htmlPluginOption,k=[{resourceQuery:/raw/i,type:"asset/source"},{resourceQuery:/url/i,type:"asset/resource",generator:{filename(e){let s=e.filename;return s&&s.toLocaleLowerCase().endsWith("wasm?url")?"wasm/[hash][ext]":"assets/[hash][ext]"}}},{test:l.wasm,type:"webassembly/async",include:b},{test:l.txt,type:"asset/source"},{test:l.image,type:"asset",dependency:{not:["url"]},parser:{dataUrlCondition:$?()=>!0:{maxSize:4096}},generator:{filename:e=>e.filename?.toLocaleLowerCase().endsWith(".svg")?"assets/svg/[hash][ext]":"assets/images/[hash][ext]",dataUrl:(e,s)=>s.filename.toLocaleLowerCase().endsWith(".svg")?u(e.toString()):e},include:O},{test:l.video,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/video/[hash][ext]"},include:O},{test:l.font,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/fonts/[hash][ext]"},include:N}],B=y.prefixJsLoader.filter(Boolean)||[];"react"===j&&y.reactCompiler&&B.unshift({loader:t(s.corePath,"/loader/react-compiler.cjs"),options:{panicThreshold:g?void 0:"NONE",...y.reactCompiler}}),y.cssInJs&&"object"==typeof y.cssInJs.minify&&B.unshift({loader:t(s.corePath,"/loader/css-in-js-minify.cjs"),options:Object.assign({moduleName:"@moneko/css",allowFuncs:["css","injectGlobal"]},y.cssInJs.minify)});export default(o=>{let r={react:{loader:n.swcLoader,options:m(o)},solid:{loader:t(s.corePath,"/loader/solid.cjs"),options:{jsxOptions:y.jsxDomExpressions,refresh:y.refresh}}}[j];return{generator:{"css/auto":{exportsOnly:!1,exportsConvention:"camel-case-only",localIdentName:"[uniqueName]_[id]_[local]",esModule:!0},"css/module":{exportsOnly:!1,exportsConvention:"camel-case-only",localIdentName:"[uniqueName]_[id]_[local]",esModule:!0}},parser:{javascript:{commonjsMagicComments:!0,dynamicImportMode:"lazy",dynamicImportPrefetch:!1,dynamicImportPreload:!1,importMeta:!0,importMetaContext:!0},css:{import:!0,namedExports:!0,url:!0},json:{exportsDepth:1}},noParse:y.noParse,rules:[{oneOf:[...k,{test:l.js,use:[...B,r].filter(Boolean),include:I},...y.cssModules.map(e=>({test:s=>l.node_modules_css_module.test(s)&&s.includes(e),use:[v],type:"css/module"})),{test:l.css,use:[v],type:"css/auto",include:C},e&&{test:l.sass_global,use:[v,e],type:"css/auto",include:C},e&&{test:l.scss,use:[v,e],type:"css/module",include:C},{test:l.less_global,use:[v,w],type:"css/auto",include:C},{test:l.less,use:[v,w],type:"css/module",include:C},{test:l.markdown,use:[...B,{loader:t(s.corePath,"/loader/mdx.cjs"),options:y.mdx}].filter(Boolean),exclude:[l.node_modules,e=>e.startsWith(`${h}:`)||e.startsWith(`${x}:`)]}].filter(Boolean)},...y.moduleRules].filter(Boolean)}});
|
package/lib/vm/docs.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
let e;import{
|
|
1
|
+
let e;import{join as t,sep as o}from"node:path";import{loadFile as r,scanFolderSync as m}from"@moneko/utils";import n from"../commom/paths.mjs";import s from"../commom/reactive-object.mjs";import*as a from"../commom/rule.mjs";import{CONFIG as c}from"../config.mjs";import{app_schema as p,docs_schema as l,FRAMEWORK as i,framework as d,isLibrary as u,isReact as f,isSolid as $}from"../process-env.mjs";import g from"./coverage.mjs";import{generatorExample as h}from"./example.mjs";import x from"./generate-doc.mjs";let j={react:"createElement",solid:"createComponent"}[i],v=()=>u?m(c.alias["@pkg"],["\\.tsx?$"]).filter(e=>!/(^|\/)\.[^\\/\\.]|\.test\./i.test(e)).map(e=>{let t=getCommentPath(e),o=t.replace(`${l}:`,"");return docs_vm.has(o)||docs_vm.setData(o,{type:".txt",source:async t=>{let o=await r(e);return t.addDependency(e),x(o,e)}}),t}):[];export const docs_vm=new s({coverage:{source:e=>(e.addDependency(n.coveragePath),g(n.coveragePath))},docs:{source:async e=>{e.addContextDependency(n.componentsPath);let t=v();return getDocs(t)}},example:{source:e=>(e.addContextDependency(n.componentsPath),h())}});export const getCommentPath=(e=c.alias["@pkg"]?.length,o=>t(`${l}:comment`,o.substring(e)).replace(/\\/g,"/"));export const getDocs=e=>{let t=`import { ${j}${$?",Dynamic":""} } from "${d}${$?"/web":""}";import SuspenseComp from "${p}:suspense";function call_then(res) {return {default: ${f?"() =>":""}${j}(${$?"Dynamic":"'div'"}, {${$?"innerHTML: res.default, component: 'div', class: 'n-md-box' ":"dangerouslySetInnerHTML: {__html:res.default}, className: 'n-md-box'"} })};}`,r={};e.forEach(e=>{let t=e.replace(/docs:comment[/\\]/,"").split(o),m=t.pop(),n=t.join("/");r[n]||(r[n]={}),r[n][m]=`rr(() => ${j}(SuspenseComp, { comp: () => import(/* webpackChunkName: '${e}' */ '${e}').then(call_then)}))rr`});let m={};for(let e in r)Object.hasOwn(r,e)&&(m[e]=Object.values(r[e]));return`${t}export default ${JSON.stringify(m).replace(a.extract_func,"$1")}`};v();
|