@moneko/core 3.8.3-beta.2 → 3.8.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/config.js +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/loader/mdx.cjs +1 -1
- package/lib/loader/mdx.d.cts +1 -1
- package/lib/vm/routes.js +1 -1
- package/package.json +2 -3
- package/typings/global.d.ts +1 -2
package/lib/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{accessSync as e,constants as t}from"fs";import o from"chalk";import{merge as s}from"webpack-merge";import i,{CUSTOMCONFIG as a}from"./paths.js";import{
|
|
1
|
+
import{accessSync as e,constants as t}from"fs";import o from"chalk";import{merge as s}from"webpack-merge";import i,{CUSTOMCONFIG as a}from"./paths.js";import{FRAMEWORK as n,PACKAGENAME as r,coreName as l,isDev as c,isLibrary as m,isMobile as p,jsxImportSource as u,mainDirectory as d}from"./process-env.js";import{isFunction as h,log as f,readConf as g,resolveProgramPath as x}from"./utils.js";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"],P={seo:!1,mode:"csr",compiler:"swc",bundleAnalyzer:!1,polyfill:!1,entry:{},minifier:{js:{},css:{}},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:{"@":x(d)},moduleRules:[],prefixJsLoader:[],cssModules:[],importOnDemand:{},proxy:[],cacheDirectory:i.webpackCachePath,devServer:{allowedHosts:[".baidu.com"],host:"localhost",port:3e3,https:!1,compress:!1},htmlPluginOption:{template:`node_modules/${l}/template/index.html`,favicon:`node_modules/${l}/template/favicon.ico`,tags:[]},assetHtml:[],routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:{chunks:"all",minSize:1024,minChunks:1,cacheGroups:{route:{test:/[\\/].git[\\/]router/,priority:-10,reuseExistingChunk:!0,name:"route"},example:{test:/[\\/].git[\\/]example/,priority:-10,reuseExistingChunk:!0,name:"example"}}},runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:C,js:C,media:C,font:C,wasm:[]},mdx:{jsx:!1,development:c,jsxImportSource:u,providerImportSource:`@moneko/${n}/mdx`},jsxDomExpressions:{moduleName:"solid-js/web",builtIns:["For","Show","Switch","Match","Suspense","SuspenseList","Portal","Index","Dynamic","ErrorBoundary"],contextToCustomElements:!0,wrapConditionals:!0,generate:"dom",hydratable:!1},bar:{name:"Client",color:"#6f42c1"},virtualModule:{},normalizeCss:!0,externalsPresets:{},buildHttp:{allowedUris:[],lockfileLocation:`${i.httpCachePath}/http.lock`,cacheLocation:`${i.httpCachePath}/data`,upgrade:!0}};m&&(P.alias=Object.assign(P.alias,{"@pkg":i.componentsPath,[r]:i.componentsPath}));let w=P,b={},k={};try{e(i.configPath,t.R_OK);let o=(await g(i.configPath,"index")).default;b=h(o)?o(process):o}catch(e){f(o.red(e))}if(a)try{e(i.customConfigPath,t.R_OK);let o=(await g(i.customConfigPath,a)).default;k=h(o)?o(process):o}catch(e){f(o.red(e))}"tsc"===(w=s(w,b,k)).compiler&&w.minifier&&(w.minifier.js||Object.assign(w.minifier,{js:{type:"terser"}}),w.minifier.css||Object.assign(w.minifier,{css:{type:"cssnano"}})),!1===w.devtool&&(w.sourceMap=!1),!1===w.sourceMap&&(w.devtool=!1),w.fixBrowserRouter&&w.htmlPluginOption&&(w.htmlPluginOption.tags||(w.htmlPluginOption.tags=[]),w.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=w;export const PUBLICPATH=CONFIG.publicPath||"/";global.NEKOCLICONFIG={CONFIG,CUSTOMCONFIG:a,log:f};
|
package/lib/index.d.ts
CHANGED
|
@@ -3,5 +3,6 @@ export { FRAMEWORKNAME, PACKAGENAME, PACKAGEVERSION, coreName, isDev, isLibrary,
|
|
|
3
3
|
export { realResolve, resolveNodeModulesPath, resolveProgramPath, log } from './utils.js';
|
|
4
4
|
export { getIPv4, getPort } from './net.js';
|
|
5
5
|
export { default as osTmpDir } from './os-tmp-dir.js';
|
|
6
|
+
export type { CompileOptions } from '@moneko/mdx';
|
|
6
7
|
export type { OverrideResolverOption } from './plugin/override-resolve.js';
|
|
7
8
|
export type * from '../typings/global.d.ts';
|
package/lib/loader/mdx.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return t}});const e=require("@moneko/mdx");function t(t){return(0,e.compileSync)({value:t,filepath:this.resourcePath,...this.getOptions()}).code}
|
package/lib/loader/mdx.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type CompileOptions } from '@moneko/mdx';
|
|
2
2
|
import type { LoaderContext } from 'webpack';
|
|
3
|
-
export default function (this: LoaderContext<CompileOptions
|
|
3
|
+
export default function (this: LoaderContext<Omit<CompileOptions, 'value'>>, value: string): string;
|
package/lib/vm/routes.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
let e,t,r;import{accessSync as o,constants as s,readFileSync as
|
|
1
|
+
let e,t,r;import{accessSync as o,constants as s,readFileSync as a,readdirSync as n,statSync as p}from"fs";import{join as i,relative as l}from"path";import{extractFrontmatterSync as m}from"@moneko/mdx";import{watch as c}from"chokidar";import{CONFIG as u}from"../config.js";import f from"../paths.js";import{FRAMEWORK as d,FRAMEWORKNAME as x,createElement as h,isDev as g,isLibrary as $,isReact as j,isSolid as y}from"../process-env.js";import D,{vmWriteing as N}from"../reactive-object.js";try{o(`${u.alias["@"]}/router/index.ts`,s.R_OK),e=!0}catch(t){e=!1}let O=y?"component":"element";function k(e){return e.replace(/\$/g,":").replace(/^index\.tsx?$/,"/").replace(/^README\.mdx?$/,"/")}function T(e,t){let{regex:r,alia:o,base:s=e,outputSource:c}=t;return n(e).reduce((n,u)=>{let f=i(e,u);if(p(f).isDirectory()){let e=T(f,{...t,base:s});if(e.length>0){let t={},r={path:k(u),key:k(l(s,f))};if(c)Object.assign(t,{children:e});else{let o=e.findIndex(e=>"/"===e.path||r.path===e.path),s=e.splice(o,1)[0];e.length?Object.assign(t,!y&&s,{children:[y&&{...s,path:r.path===s.path?"/":s.path},...e].filter(Boolean)}):Object.assign(t,s)}n.push(Object.assign(t,r))}}else if(r.test(f)){let{frontmatter:e,code:t}=m(a(f,{encoding:"utf-8"})),r=l(s,f),p=k(r);n.push(Object.assign({path:p.split("/").slice(-2,-1)?.join("")||"/",key:p.replace(/\/?index.tsx?$/,"/").replace(/\/?README.mdx?$/,"/").split("/").filter(Boolean).join("/"),meta:JSON.parse(e)},o&&{[O]:`rr(() => import(/* webpackChunkName: '${r}' */'${i(o,r)}'))rr`},c&&{codes:function(e){let t;let r={},o=/```(.+?)\n([\s\S]*?)\n```/g;for(;null!==(t=o.exec(e));){let[,e="jsx",o]=t;r[e.split(" ").pop()||"jsx"]=o.trim()}return Object.keys(r).length?r:{jsx:e}}(t.replace(/^\n+|\n+$/g,""))}))}return n},[])}export const routesModuleName="@app/routes";export const route=new D({[routesModuleName]:"export default []"});export const exampleModuleName="@app/example";export const examples=new D;let E=`${y?"() => ":""}${h}(SuspenseComp, { comp: $1 })`,M=`import { ${h} } from "${x}";import SuspenseComp from "@app/suspense";${j?'import prefix from "@app/prefix-router";':""}`;e&&(M+='import merge from "@app/merge-router";import customRouter from "@/router";'),["react","solid"].includes(d)||(E="$1",M="");export let routes=[];function S(t){return`${M}const routes = [{ path: "/", children: [${y?'{ path: "/" },':""} ${t}] }];const _routes = ${e?'merge([...routes, ...customRouter], "path")':"routes"};export default ${j?"prefix(_routes)":"_routes"};`}function b(e,t,r,o){N.setData(o,!0);let s=c(e,{ignored:(e,r)=>{if(r)return!r.isDirectory()&&t.test(e)},persistent:!0,ignoreInitial:!1});function a(){s.unwatch(e),s.close(),N.setData(o,!1)}s.on("add",()=>{r()}).on("change",()=>{r()}).on("unlink",()=>{r()}),s.once("ready",()=>{g||a()}),process.on("SIGINT",a)}$?(b(f.componentsPath,/(?<!README\.mdx?)$/,function(){clearTimeout(t),t=setTimeout(()=>{clearTimeout(t),routes=T(f.componentsPath,{regex:/README\.mdx?$/,alia:"@pkg"}),route.setData(routesModuleName,S(JSON.stringify(routes).replace(/"rr\((.+?)\)rr"/g,E).slice(1,-1)))},100)},"vm-router"),b(f.componentsPath,/(?<!\/examples\/(.+)\.md)$/,function(){clearTimeout(r),r=setTimeout(()=>{clearTimeout(r),T(f.componentsPath,{regex:/\/examples\/(.+)\.md$/,outputSource:!0}).forEach(e=>{let t=["@app/example",e.key].filter(Boolean).join("/"),r=e.children?.[0].children?.filter(e=>e.codes)?.map(e=>({title:e.path.replace(/.md$/,""),order:0,...e.meta,codes:e.codes})).sort((e,t)=>e.order-t.order)||[];examples.setData(t,`export default ${JSON.stringify(r)};`)})},100)},"vm-examples")):b(f.pagesPath,/(?<!index\.tsx?)$/,function(){clearTimeout(t),t=setTimeout(()=>{clearTimeout(t),routes=T(f.pagesPath,{regex:/index\.tsx?$/,alia:"@/pages"}),route.setData(routesModuleName,S(JSON.stringify(routes).replace(/"rr\((.+?)\)rr"/g,E).slice(1,-1)))},100)},"vm-router");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "3.8.3-beta.
|
|
3
|
+
"version": "3.8.3-beta.3",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -12,8 +12,7 @@
|
|
|
12
12
|
"author": "moneko",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@moneko/mdx": "0.
|
|
16
|
-
"@mdx-js/loader": "3.0.0",
|
|
15
|
+
"@moneko/mdx": "0.1.6",
|
|
17
16
|
"@swc/core": "1.3.99",
|
|
18
17
|
"@swc/css": "0.0.28",
|
|
19
18
|
"@swc/helpers": "0.5.3",
|
package/typings/global.d.ts
CHANGED
|
@@ -3,8 +3,7 @@ import { Options as HtmlWebpackPluginOptions } from 'html-webpack-plugin';
|
|
|
3
3
|
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
|
|
4
4
|
import WebpackBar from 'webpackbar';
|
|
5
5
|
import DoneWebpackPlugin from '../lib/plugin/done';
|
|
6
|
-
import type { OverrideResolverOption } from '../lib/index';
|
|
7
|
-
import type { Options as MDXOptions } from '@mdx-js/loader';
|
|
6
|
+
import type { MDXOptions, OverrideResolverOption } from '../lib/index';
|
|
8
7
|
import type { JsMinifyOptions, Config as SwcConfig } from '@swc/core';
|
|
9
8
|
import type { CssNanoOptionsExtended } from 'css-minimizer-webpack-plugin';
|
|
10
9
|
import type { MinifyOptions } from 'terser';
|