@moneko/core 3.11.1-beta.13 → 3.11.1-beta.14

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/config.mjs CHANGED
@@ -1 +1 @@
1
- import{fileExists as e}from"@moneko/mdx";import{merge as o}from"webpack-merge";import t from"./options/jsx-dom-expressions.mjs";import s from"./options/split-chunk.mjs";import a,{CUSTOMCONFIG as i}from"./paths.mjs";import{FRAMEWORK as r,PACKAGENAME as l,isDev as n,isLibrary as m,isMobile as p,jsxImportSource as c,mainDirectory as u}from"./process-env.mjs";import{isFunction as d,resolveProgram as h}from"./utils/index.mjs";import f from"./utils/log.mjs";import g from"./utils/read-conf.mjs";let x=["@moneko","neko-ui","antd","@antv","katex","font-pingfang-sc","font-pingfang-tc","react-photo-view","react-markdown-editor-lite","schema-design","@app",".cache/http/data"],P={devtool:n?"eval-cheap-module-source-map":"cheap-module-source-map",seo:!1,mode:"csr",bundleAnalyzer:!1,polyfill:!1,entry:{},minifier:{},sourceMap:{filename:"[file].map",publicPath:""},env:{NODE_ENV:process.env.NODE_ENV},basename:"/",publicPath:"/",rem:{designSize:p?375:1680},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{"@":h(u)},moduleRules:[],prefixJsLoader:[],cssModules:[],importOnDemand:{},proxy:{},cacheDirectory:a.webpackCachePath,devServer:{host:"localhost",port:3e3},htmlPluginOption:{},assetHtml:[],routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:s,runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:x,js:x,media:x,font:x,wasm:[]},mdx:{jsx:!1,development:n,jsxImportSource:c,providerImportSource:`@moneko/${r}/mdx`},jsxDomExpressions:t,bar:{name:"Client",color:"#6f42c1"},normalizeCss:!0,externalsPresets:{},buildHttp:{allowedUris:[],lockfileLocation:`${a.httpCachePath}/http.lock`,cacheLocation:`${a.httpCachePath}/data`,upgrade:!0},virtualModule:{},cssExtract:{}};m&&(P.alias=Object.assign(P.alias,{"@pkg":a.componentsPath,[l]:a.componentsPath}));let v=P,C={},k={};if(e(a.configPath)){let e=(await g(a.configPath,"index")).default;C=d(e)?e(process):e}if(i&&e(a.customConfigPath)){let e=(await g(a.customConfigPath,i)).default;k=d(e)?e(process):e}(!1===(v=o(v,C,k)).devtool||!1===v.sourceMap)&&(v.sourceMap=!1,v.devtool=!1),v.fixBrowserRouter&&v.htmlPluginOption&&(v.htmlPluginOption.tags||(v.htmlPluginOption.tags=[]),v.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))"}));export const CONFIG=v;export const PUBLICPATH=CONFIG.publicPath||"/";global.NEKOCLICONFIG={CONFIG,CUSTOMCONFIG:i,log:f};
1
+ import{fileExists as e}from"@moneko/mdx";import{merge as o}from"webpack-merge";import t from"./options/jsx-dom-expressions.mjs";import s from"./options/split-chunk.mjs";import a,{CUSTOMCONFIG as i}from"./paths.mjs";import{APPTYPE as r,FRAMEWORK as l,NODE_ENV as n,PACKAGENAME as m,isDev as p,isLibrary as c,isMobile as u,jsxImportSource as d,mainDirectory as h}from"./process-env.mjs";import{isFunction as f,resolveProgram as g}from"./utils/index.mjs";import x from"./utils/log.mjs";import P from"./utils/read-conf.mjs";import v from"./utils/setup-env.mjs";let C=["@moneko","neko-ui","antd","@antv","katex","font-pingfang-sc","font-pingfang-tc","react-photo-view","react-markdown-editor-lite","schema-design","@app",".cache/http/data"],j={devtool:p?"eval-cheap-module-source-map":"cheap-module-source-map",seo:!1,mode:"csr",bundleAnalyzer:!1,polyfill:!1,entry:{},minifier:{},sourceMap:{filename:"[file].map",publicPath:""},env:v(n,r,l),basename:"/",publicPath:"/",rem:{designSize:u?375:1680},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{"@":g(h)},moduleRules:[],prefixJsLoader:[],cssModules:[],importOnDemand:{},proxy:{},cacheDirectory:a.webpackCachePath,devServer:{host:"localhost",port:3e3},htmlPluginOption:{},assetHtml:[],routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:s,runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:C,js:C,media:C,font:C,wasm:[]},mdx:{jsx:!1,development:p,jsxImportSource:d,providerImportSource:`@moneko/${l}/mdx`},jsxDomExpressions:t,bar:{name:"Client",color:"#6f42c1"},normalizeCss:!0,externalsPresets:{},buildHttp:{allowedUris:[],lockfileLocation:`${a.httpCachePath}/http.lock`,cacheLocation:`${a.httpCachePath}/data`,upgrade:!0},virtualModule:{},cssExtract:{}};c&&(j.alias=Object.assign(j.alias,{"@pkg":a.componentsPath,[m]:a.componentsPath}));let k=j,w={},b={};if(e(a.configPath)){let e=(await P(a.configPath,"index")).default;w=f(e)?e(process):e}if(i&&e(a.customConfigPath)){let e=(await P(a.customConfigPath,i)).default;b=f(e)?e(process):e}(!1===(k=o(k,w,b)).devtool||!1===k.sourceMap)&&(k.sourceMap=!1,k.devtool=!1),k.fixBrowserRouter&&k.htmlPluginOption&&(k.htmlPluginOption.tags||(k.htmlPluginOption.tags=[]),k.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))"}));export const CONFIG=k;export const PUBLICPATH=CONFIG.publicPath||"/";global.NEKOCLICONFIG={CONFIG,CUSTOMCONFIG:i,log:x};
package/lib/paths.d.mts CHANGED
@@ -1,3 +1,5 @@
1
+ export declare const __filename: string;
2
+ export declare const __dirname: string;
1
3
  export declare const yarnArgv: Record<string, string> & {
2
4
  config?: string;
3
5
  };
@@ -10,6 +12,8 @@ export declare const yarnArgv: Record<string, string> & {
10
12
  */
11
13
  export declare const CUSTOMCONFIG: string | undefined;
12
14
  declare const paths: {
15
+ __dirname: string;
16
+ __filename: string;
13
17
  nodeModules: string;
14
18
  corePath: string;
15
19
  programPath: string;
package/lib/paths.mjs CHANGED
@@ -1 +1 @@
1
- import e from"url";import{resolve as o}from"path";let t=JSON.parse(process.env.npm_config_argv||'{"original":[]}').original;export const yarnArgv={};for(let e=0,o=t.length;e<o;e++){let o=t[e].split("=");Object.assign(yarnArgv,{[o[0]]:o[1]||!0})}export const CUSTOMCONFIG=process.env.npm_config_config||yarnArgv.config;let a=process.cwd(),c=o(a,"./node_modules"),r={nodeModules:c,corePath:e.fileURLToPath(new URL(".",import.meta.url)),programPath:a,webpackCachePath:o(c,"./.temp_cache"),lineCachePath:o(c,"./.cache"),cachePath:o(c,"./.cache/.mo"),httpCachePath:o(c,"./.cache/http"),swcCachePath:o(c,"./.swc"),configPath:o(a,"./config/index.ts"),customConfigPath:o(a,`./config/${CUSTOMCONFIG}.ts`),coveragePath:o(a,"./coverage/clover.xml"),pagesPath:o(a,"./src/pages"),componentsPath:o(a,"./components"),mockPath:o(a,"./mock")};export const routeDir="library"===process.env.APPTYPE?r.componentsPath:r.pagesPath;export default r;
1
+ import e from"url";import{dirname as t,resolve as o}from"path";let a=JSON.parse(process.env.npm_config_argv||'{"original":[]}').original;export const __filename=e.fileURLToPath(import.meta.url);export const __dirname=t(__filename);export const yarnArgv={};for(let e=0,t=a.length;e<t;e++){let t=a[e].split("=");Object.assign(yarnArgv,{[t[0]]:t[1]||!0})}export const CUSTOMCONFIG=process.env.npm_config_config||yarnArgv.config;let c=process.cwd(),r=o(c,"./node_modules"),n={__dirname,__filename,nodeModules:r,corePath:e.fileURLToPath(new URL(".",import.meta.url)),programPath:c,webpackCachePath:o(r,"./.temp_cache"),lineCachePath:o(r,"./.cache"),cachePath:o(r,"./.cache/.mo"),httpCachePath:o(r,"./.cache/http"),swcCachePath:o(r,"./.swc"),configPath:o(c,"./config/index.ts"),customConfigPath:o(c,`./config/${CUSTOMCONFIG}.ts`),coveragePath:o(c,"./coverage/clover.xml"),pagesPath:o(c,"./src/pages"),componentsPath:o(c,"./components"),mockPath:o(c,"./mock")};export const routeDir="library"===process.env.APPTYPE?n.componentsPath:n.pagesPath;export default n;
@@ -1,6 +1,7 @@
1
1
  import type { AppType, Framework } from './index.mjs';
2
2
  export declare const APPTYPE: AppType;
3
3
  export declare const FRAMEWORK: Framework;
4
+ export declare const NODE_ENV: string;
4
5
  export declare const isLibrary: boolean;
5
6
  export declare const isMicro: boolean;
6
7
  export declare const isMobile: boolean;
@@ -1 +1 @@
1
- export const APPTYPE=process.env.APPTYPE;export const FRAMEWORK=process.env.FRAMEWORK;export const isLibrary="library"===APPTYPE;export const isMicro="micro"===APPTYPE;export const isMobile="mobile"===APPTYPE;export const isReact="react"===FRAMEWORK;export const isSolid="solid"===FRAMEWORK;export const SSR="true"===process.env.SSR;export const mainDirectory=isLibrary?"site":"src";export const jsxImportSource={react:"react",solid:"solid-js/h"}[FRAMEWORK];export const PACKAGENAME=process.env.npm_package_name;export const PACKAGEVERSION=process.env.npm_package_version;export const coreName="@moneko/core";export const isDev="development"===process.env.NODE_ENV;
1
+ export const APPTYPE=process.env.APPTYPE;export const FRAMEWORK=process.env.FRAMEWORK;export const NODE_ENV=process.env.NODE_ENV;export const isLibrary="library"===APPTYPE;export const isMicro="micro"===APPTYPE;export const isMobile="mobile"===APPTYPE;export const isReact="react"===FRAMEWORK;export const isSolid="solid"===FRAMEWORK;export const SSR="true"===process.env.SSR;export const mainDirectory=isLibrary?"site":"src";export const jsxImportSource={react:"react",solid:"solid-js/h"}[FRAMEWORK];export const PACKAGENAME=process.env.npm_package_name;export const PACKAGEVERSION=process.env.npm_package_version;export const coreName="@moneko/core";export const isDev="development"===NODE_ENV;
@@ -0,0 +1,3 @@
1
+ import { type DotenvParseOutput } from 'dotenv';
2
+ declare function setupEnv(mode: string, type: string, framework: string): DotenvParseOutput;
3
+ export default setupEnv;
@@ -0,0 +1 @@
1
+ import{relative as r}from"path";import{config as t}from"dotenv";import o from"../paths.mjs";export default function(e,a,p){let n=[r(o.programPath,".env"),r(o.programPath,".env/.env"),r(o.programPath,`.env/.${"production"===e?"prod":"dev"}.env`)],m={NODE_ENV:e,APPTYPE:a,FRAMEWORK:p};return n.forEach(r=>{let o=t({path:r,override:!0}).parsed;o&&Object.assign(m,o)}),m}
@@ -1 +1 @@
1
- import{join as o}from"path";import{getAppEntry as m,getAppFallback as r,getAppMdxScope as e,getAppMergeRouter as p,getAppNormalizeCss as t,getAppPrefixRouter as a,getAppRem as s,getAppSuspense as i}from"@moneko/mdx";import f from"./coverage.mjs";import{docs as n,docsModuleName as l}from"./docs.mjs";import c from"./info.mjs";import{locales as d,localesModuleName as x}from"./locales.mjs";import{route as g,routesModuleName as j}from"./routes.mjs";import{CONFIG as u}from"../config.mjs";import h from"../paths.mjs";import{APPTYPE as v,FRAMEWORK as k}from"../process-env.mjs";import{node_modules as z,resolveProgram as D}from"../utils/index.mjs";let b={[z("@app/info")]:`export default ${JSON.stringify(c)}`,[z("@app/entry")]:m(o(u.alias["@"],"./index.ts"),!!u.rem,!!u.normalizeCss,v,k),[z("@app/rem")]:s(u.rem?.designSize||1680),[z("@app/fallback")]:r(u.fallbackCompPath),[z("@app/coverage")]:f(h.coveragePath),[z("@app/merge-router")]:p(),[z("@app/prefix-router")]:a(),[z("@app/normalize/index.css")]:t(),[z("@app/suspense/index.tsx")]:i(v,k),[z("@app/mdx-scope")]:e(D("site/mdx-scope.ts")),[z(j)]:g.getData(j),[z(x)]:d.getData(x),[z(l)]:n.getData(l)};export default b;
1
+ import{join as e}from"path";import{getAppEntry as o,getAppFallback as p,getAppMdxScope as r,getAppMergeRouter as m,getAppNormalizeCss as t,getAppPrefixRouter as a,getAppRem as s,getAppSuspense as i}from"@moneko/mdx";import f from"./coverage.mjs";import{docs as n,docsModuleName as l}from"./docs.mjs";import c from"./info.mjs";import{locales as d,localesModuleName as x}from"./locales.mjs";import{route as g,routesModuleName as j}from"./routes.mjs";import{CONFIG as u}from"../config.mjs";import v from"../paths.mjs";import{APPTYPE as h,FRAMEWORK as k}from"../process-env.mjs";import{node_modules as y,resolveProgram as z}from"../utils/index.mjs";let D={[y("@app/env")]:`export default ${JSON.stringify(u.env)}`,[y("@app/info")]:`export default ${JSON.stringify(c)}`,[y("@app/entry")]:o(e(u.alias["@"],"./index.ts"),!!u.rem,!!u.normalizeCss,h,k),[y("@app/rem")]:s(u.rem?.designSize||1680),[y("@app/fallback")]:p(u.fallbackCompPath),[y("@app/coverage")]:f(v.coveragePath),[y("@app/merge-router")]:m(),[y("@app/prefix-router")]:a(),[y("@app/normalize/index.css")]:t(),[y("@app/suspense/index.tsx")]:i(h,k),[y("@app/mdx-scope")]:r(z("site/mdx-scope.ts")),[y(j)]:g.getData(j),[y(x)]:d.getData(x),[y(l)]:n.getData(l)};export default D;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.11.1-beta.13",
3
+ "version": "3.11.1-beta.14",
4
4
  "description": "core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",
@@ -21,6 +21,7 @@
21
21
  "core-js": "3.36.1",
22
22
  "core-js-compat": "3.36.1",
23
23
  "css-loader": "7.1.1",
24
+ "dotenv": "16.4.5",
24
25
  "enhanced-resolve": "5.16.0",
25
26
  "express": "4.19.2",
26
27
  "html-webpack-plugin": "5.6.0",