@moneko/core 3.9.17-beta.10 → 3.9.17-beta.11
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.common.d.mts +3 -0
- package/lib/build.common.mjs +1 -0
- package/lib/build.mjs +1 -1
- package/lib/build.server.d.mts +3 -0
- package/lib/build.server.mjs +1 -0
- package/lib/config.mjs +1 -1
- package/lib/dev-config.mjs +3 -3
- package/lib/dev-mock.d.mts +40 -0
- package/lib/dev-mock.mjs +1 -0
- package/lib/dev-proxy.d.mts +4 -0
- package/lib/dev-proxy.mjs +1 -0
- package/lib/dev.mjs +1 -1
- package/lib/html-plugin-option.mjs +1 -1
- package/lib/paths.d.mts +1 -0
- package/lib/paths.mjs +1 -1
- package/lib/swcrc.mjs +1 -1
- package/package.json +7 -4
- package/typings/global.d.ts +9 -10
- package/lib/dev-old.d.mts +0 -1
- package/lib/dev-old.mjs +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"mini-css-extract-plugin";import i from"terser-webpack-plugin";import m from"webpack";import{BundleAnalyzerPlugin as n}from"webpack-bundle-analyzer";import{merge as r}from"webpack-merge";import{commonConfig as o}from"./common.mjs";import{CONFIG as t}from"./config.mjs";import{getMinifyOption as l}from"./minify.mjs";import p from"./plugin/lightningcss-plugin.mjs";let{optimize:{MinChunkSizePlugin:s,ModuleConcatenationPlugin:u}}=m,a=r(o,{plugins:[new u,new e({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",experimentalUseImportModule:!0}),t.splitChunk&&new s({minChunkSize:1e4}),t.bundleAnalyzer&&new n(t.bundleAnalyzer)].filter(Boolean),optimization:{splitChunks:t.splitChunk,runtimeChunk:t.runtimeChunk,chunkIds:"named",moduleIds:"named",removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,mangleWasmImports:!0,minimize:!0,minimizer:!!t.minifier&&[new i(l(t.minifier?.type||"swc",t.minifier?.options)),new p]||[]}});export default a;
|
package/lib/build.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{removeDirAll as
|
|
1
|
+
import{removeDirAll as o}from"@moneko/mdx";import m from"webpack";import{merge as r}from"webpack-merge";import e from"webpackbar";import i from"./build.common.mjs";import s from"./build.server.mjs";import{CONFIG as t}from"./config.mjs";import n from"./module.config.mjs";import p from"./paths.mjs";import a from"./plugin/done.mjs";import{SSR as f}from"./process-env.mjs";import c from"./seo.mjs";import{compilerListener as l,log as u}from"./utils.mjs";let d=[r(i,{module:n(!1),plugins:[t.done&&new a({done:t.done}),t.bar&&new e(t.bar)].filter(Boolean)})];f&&d.push(r(i,s));let[h,j]=m(d).compilers,w=[l("client",h)];async function b(){m(d).run((o,m)=>{if(o)throw o;m&&m.stats.forEach(o=>{o.compilation.warnings.forEach(o=>u(o.message)),o.compilation.errors.forEach(o=>u(o.message))})}),await Promise.all(w),t.seo&&c()}j&&w.push(l("server",j)),await b(),process.on("exit",function(){o(p.cachePath)});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"webpack-node-externals";import o from"webpackbar";import r from"./module.config.mjs";import{CUSTOMCONFIG as s}from"./paths.mjs";import{isLibrary as t}from"./process-env.mjs";import{resolveProgramPath as m}from"./utils.mjs";let a={entry:{main:m("site/ssr.tsx")},output:{path:m(`${t?"docs":"dist"}/server`),library:{type:"commonjs2",umdNamedDefine:!1},filename:"[name].cjs",chunkFilename:"[chunkhash].cjs",globalObject:"global"},cache:{type:"filesystem",name:[s,process.env.NODE_ENV,"server"].filter(Boolean).join("-")},externalsPresets:{node:!0},externals:[e({allowlist:["react","react-dom","solid-js","@app","@moneko"]})],plugins:[new o({name:"Server"})],module:r(!0),target:"node"};export default a;
|
package/lib/config.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fileExists as e}from"@moneko/mdx";import{merge as t}from"webpack-merge";import o,{CUSTOMCONFIG as s}from"./paths.mjs";import{FRAMEWORK as i,PACKAGENAME as n,
|
|
1
|
+
import{fileExists as e}from"@moneko/mdx";import{merge as t}from"webpack-merge";import o,{CUSTOMCONFIG as s}from"./paths.mjs";import{FRAMEWORK as i,PACKAGENAME as n,isDev as r,isLibrary as a,isMobile as l,isSolid as p,jsxImportSource as m,mainDirectory as c}from"./process-env.mjs";import{isFunction as u,log as d,readConf as h,resolveProgramPath as g}from"./utils.mjs";let f=["@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"],x={devtool:r?"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:l?375:1680},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{"@":g(c)},moduleRules:[],prefixJsLoader:[],cssModules:[],importOnDemand:{},proxy:{},cacheDirectory:o.webpackCachePath,devServer:{host:"localhost",port:3e3},htmlPluginOption:{},assetHtml:[],routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:{chunks:"all",minSize:1024,minChunks:1,cacheGroups:{CHANGELOG:{test:/CHANGELOG\.md/,priority:-10,name:"CHANGELOG",reuseExistingChunk:!0},prismjs:{test:/(prism\.js|prism\/css\.ts)/,priority:-10,name:"vendors-prismjs",reuseExistingChunk:!0},site:{test:/site/,priority:-10,reuseExistingChunk:!0},marked:{test:/marked/,priority:-10,reuseExistingChunk:!0},"n-katex":{test:/n-katex/,priority:-10,reuseExistingChunk:!0},"n-code-live":{test:/n-code-live/,priority:-10,reuseExistingChunk:!0},"@moneko":{test:/@moneko/,priority:-10,reuseExistingChunk:!0}}},runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:f,js:f,media:f,font:f,wasm:[]},mdx:{jsx:!1,development:r,jsxImportSource:m,providerImportSource:`@moneko/${i}/mdx`},jsxDomExpressions:{},bar:{name:"Client",color:"#6f42c1"},normalizeCss:!0,externalsPresets:{},buildHttp:{allowedUris:[],lockfileLocation:`${o.httpCachePath}/http.lock`,cacheLocation:`${o.httpCachePath}/data`,upgrade:!0},virtualModule:{}};p&&(x.jsxDomExpressions={moduleName:"solid-js/web",builtIns:["For","Show","Switch","Match","Suspense","SuspenseList","Portal","Index","Dynamic","ErrorBoundary"],contextToCustomElements:!0,wrapConditionals:!0,generate:"dom",hydratable:!1}),a&&(x.alias=Object.assign(x.alias,{"@pkg":o.componentsPath,[n]:o.componentsPath}));let C=x,k={},P={};if(e(o.configPath)){let e=(await h(o.configPath,"index")).default;k=u(e)?e(process):e}if(s&&e(o.customConfigPath)){let e=(await h(o.customConfigPath,s)).default;P=u(e)?e(process):e}(!1===(C=t(C,k,P)).devtool||!1===C.sourceMap)&&(C.sourceMap=!1,C.devtool=!1),C.fixBrowserRouter&&C.htmlPluginOption&&(C.htmlPluginOption.tags||(C.htmlPluginOption.tags=[]),C.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=C;export const PUBLICPATH=CONFIG.publicPath||"/";global.NEKOCLICONFIG={CONFIG,CUSTOMCONFIG:s,log:d};
|
package/lib/dev-config.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
`);function
|
|
3
|
-
${
|
|
1
|
+
import t from"chalk";import{CONFIG as o}from"./config.mjs";import{getIPv4 as e,getPort as r}from"./net.mjs";import{log as s}from"./utils.mjs";let{yellow:i,green:n,grey:l,gray:m,bgBlue:a,bgGreenBright:c,blueBright:p,greenBright:$}=t,u=o.devServer||{},f=u.port||3e3;export const PORT=await r(f,65535,u.host);u.port=PORT;let d="/"===o.basename?"":o.basename,T=u.port!==PORT&&m(`Port ${i(f)} is in use, trying ${n(PORT)} instead.
|
|
2
|
+
`);function h(t){return`http://${"local"===t?u.host:e()}:${PORT}${d}`}let x=m("You application is running here:"),O=`${a(" Local ")} ${p(h("local"))}
|
|
3
|
+
${c(" Network ")} ${$(h("net"))}`;export function devLog(t,o){!t&&o&&(process.stdout.write("\x1b[2J\x1b[3J\x1b[H"),s([x,"",O,"",l(`Compiled successfully in ${n(`${o.endTime-o.startTime}ms`)}`)]),T&&s(T))}export const headers={"Access-Control-Allow-Origin":"*"};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/// <reference types="multer" />
|
|
2
|
+
import { type NextFunction, type Request, type Response } from 'express';
|
|
3
|
+
export interface RequestFormData extends Request {
|
|
4
|
+
files: Express.Multer.File[];
|
|
5
|
+
}
|
|
6
|
+
export type ProxyFuncType = (req: RequestFormData, res: Response, next: NextFunction) => void;
|
|
7
|
+
export type MockConfiguration = Record<string, ProxyFuncType | Record<string, any> | null>;
|
|
8
|
+
export type YApiOptionBySchema = {
|
|
9
|
+
/** YApi host */
|
|
10
|
+
host: string;
|
|
11
|
+
/** 接口id */
|
|
12
|
+
id: string;
|
|
13
|
+
/** YApi开放接口token */
|
|
14
|
+
token: string;
|
|
15
|
+
};
|
|
16
|
+
type Any = any;
|
|
17
|
+
/**
|
|
18
|
+
* 通过 YApi 接口对应的响应JSON Schema生成默认的数据
|
|
19
|
+
* @param {YApiOptionBySchema} option Schema
|
|
20
|
+
* @param {T} data data
|
|
21
|
+
* @returns {Promise} mockData
|
|
22
|
+
*/
|
|
23
|
+
export declare const yApiSchemaMock: <T extends unknown>(option: YApiOptionBySchema, data?: T | undefined) => Promise<T>;
|
|
24
|
+
export type YApiOption = {
|
|
25
|
+
/** YApi host */
|
|
26
|
+
host: string;
|
|
27
|
+
/** YApi 项目ID */
|
|
28
|
+
projectId: number;
|
|
29
|
+
/** 重写请求路径, 例如:'^/api/' */
|
|
30
|
+
pathRewrite: string;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* 请求YApi高级mock接口数据
|
|
34
|
+
* @param {RequestFormData} req req
|
|
35
|
+
* @param {YApiOption} yapi YApiOption
|
|
36
|
+
* @returns {Promise} data
|
|
37
|
+
*/
|
|
38
|
+
export declare const yApiMock: (req: RequestFormData, yapi: YApiOption) => Promise<Any>;
|
|
39
|
+
declare const mockMiddlewares: (directory: string) => (req: Request, res: Response, next: VoidFunction) => void;
|
|
40
|
+
export default mockMiddlewares;
|
package/lib/dev-mock.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"http";import{watch as t}from"chokidar";import o from"express";import{mock as r}from"mock-json-schema";import{match as a}from"path-to-regexp";import{merge as n}from"webpack-merge";import{esm as s,log as i,tfc as c}from"./utils.mjs";function p(e,t,o){if(o[t]){for(let r in o[t])Object.prototype.hasOwnProperty.call(o[t],r)&&delete e[r];o[t]=null,delete o[t]}}export const yApiSchemaMock=(t,o)=>new Promise((a,s)=>{e.get(`${t.host}/api/interface/get?id=${t.id}&token=${t.token}`,e=>{e.setEncoding("utf8");let t="";e.on("data",e=>{t+=e}),e.on("end",()=>{try{let e=JSON.parse(t);if(e?.data?.res_body_is_json_schema){let t=JSON.parse(e.data.res_body),s=r(t);void 0!==o?a(n(s,o)):a(s)}}catch(e){s(e)}})})});export const yApiMock=(t,o)=>new Promise((r,a)=>{let n=new URL(o.host),s={hostname:n.hostname,port:n.port,path:t.path.replace(new RegExp(o.pathRewrite),`/mock/${o.projectId}/`),method:t.method,headers:t.headers,query:t.query},i=e.request(s,e=>{e.setEncoding("utf8");let t="";e.on("data",e=>{t+=e}),e.on("end",()=>{try{r(JSON.parse(t))}catch(e){a(e)}})});i.on("error",e=>{a(e.message)}),i.write(JSON.stringify(t.body)),i.end()});export default(e=>{let r={},n={};return t(e).on("all",async function(e,t){process.stdout.write("update mock...");let o={};switch(e){case"add":case"change":p(n,t,r),o=(await import(s`${c(t)}`)).default,r[t]=o,n=Object.assign(n,o);break;case"unlink":p(n,t,r)}i("update mock success")}),function(e,t,r){let s=`${e.method} ${e.path}`,i=Object.keys(n).filter(function(e){return RegExp(`^${e.replace(/(:\w*)[^/]/g,"((?!/).)")}*$`).test(s)});if(!n[s]&&(!i||!(i.length>0)))return r();{let c;let p=e.get("Content-Type");switch(p){case"text/plain":c=o.raw({type:"text/plain"});break;case"text/html":c=o.text({type:"text/html"});break;case"application/x-www-form-urlencoded":c=o.urlencoded({extended:!1});break;default:c=o.json()}p?.startsWith("multipart/form-data;")&&(c=o.static("./public")),c(e,t,function(){let o=n[s]||n[i[0]];if("function"==typeof o){let n=a(i[0].split(" ")[1])(e.url);n&&Object.assign(e.params,n.params),o(e,t,r)}else t.json(o)})}}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createProxyMiddleware as e}from"http-proxy-middleware";export default((t,r)=>{Object.keys(r).forEach(o=>{let p=r[o],a=e(o,p);t.use(o,a)})});
|
package/lib/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{removeDirAll as
|
|
1
|
+
import{directoryExists as e,removeDirAll as o}from"@moneko/mdx";import t from"cors";import i from"express";import r from"multer";import s from"webpack";import m from"webpack-dev-middleware";import l from"webpack-hot-middleware";import{merge as a}from"webpack-merge";import n from"webpackbar";import p from"./build.server.mjs";import{commonConfig as c}from"./common.mjs";import{CONFIG as d}from"./config.mjs";import{PORT as u,devLog as f,headers as h}from"./dev-config.mjs";import w from"./dev-mock.mjs";import g from"./dev-proxy.mjs";import{hasPkg as x}from"./has-pkg.mjs";import k from"./module.config.mjs";import b from"./paths.mjs";import{SSR as j,isLibrary as y,isReact as $}from"./process-env.mjs";import{compilerListener as v,resolveProgramPath as _}from"./utils.mjs";let{HotModuleReplacementPlugin:P}=s,S=x("stylelint-webpack-plugin")&&(await import("stylelint-webpack-plugin")).default,D=x("eslint-webpack-plugin")&&(await import("eslint-webpack-plugin")).default,T=$&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,B=["js","jsx","ts","tsx","json","html","vue"],I=B.join(","),E=["css","scss","sass","less","ts","tsx","js","jsx"],F=E.join(","),G=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],M=new URLSearchParams({timeout:2e3,reload:!0,quiet:!0,noInfo:!0,overlay:!1,dynamicPublicPath:!0}).toString(),O=c.output.path;j&&(O=_(`${y?"docs":"dist"}/client`));let R=a(c,{entry:{main:[`webpack-hot-middleware/client?name=client&path=//localhost:${u}/__hmr__&${M}`]},output:{path:O},module:k(!1),plugins:[new P,T&&new T,D&&new D({fix:!0,threads:!0,files:[`${d.alias["@"]}/**/*.{${I}}`,y&&`${d.alias["@pkg"]}/**/*.{${I}}`].filter(Boolean),extensions:B,exclude:G,cache:!0,lintDirtyModulesOnly:!0}),S&&new S({fix:!0,threads:!0,files:[`${d.alias["@"]}/**/*.{${F}}`,y&&`${d.alias["@pkg"]}/**/*.{${F}}`].filter(Boolean),extensions:E,exclude:G,cache:!0,lintDirtyModulesOnly:!0}),d.bar&&new n(d.bar)].filter(Boolean)}),U=[R];j&&U.push(a(c,p));let[q,L]=s(U).compilers;q.hooks.done.tap("client",e=>{f(null,e)});let N=i(),z=r(),A=m(q,{writeToDisk:!1,index:"index.html",headers:()=>h,serverSideRender:j});if(N.use(t()),N.use(A),N.use(l(q,{log:!1,path:"/__hmr__",heartbeat:2e3,ignoreUnaccepted:!1,ignoreDeclined:!0,ignoreErrored:!0})),d.proxy&&g(N,d.proxy),e(b.mockPath)){let e=w(b.mockPath);N.use(e)}let C=`${R.output.path}/index.html`;N.all("/*",z.any(),function(e,o,t){if("GET"!==e.method)return t();{let e=A.context.outputFileSystem,t=e?.readFileSync?.(C);o.end(t)}});let H=[v("client",q)];L&&(L.watch({aggregateTimeout:20,ignored:/node_modules(?![\\/]@app)/,poll:1e3,stdin:!0},f),H.push(v("server",L))),await Promise.all(H),N.listen(u,()=>{}),process.on("exit",function(){o(b.cachePath)}),process.on("SIGINT",function(){process.exit()});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{merge as e}from"webpack-merge";import{CONFIG as t}from"./config.mjs";import{description as i,keywords as o}from"./info.mjs";import{PACKAGENAME as m,coreName as r}from"./process-env.mjs";import{resolveProgramPath as a}from"./utils.mjs";let{
|
|
1
|
+
import{merge as e}from"webpack-merge";import{CONFIG as t}from"./config.mjs";import{description as i,keywords as o}from"./info.mjs";import{PACKAGENAME as m,coreName as r}from"./process-env.mjs";import{resolveProgramPath as a}from"./utils.mjs";let p=t.htmlPluginOption||{},n=p.favicon||`node_modules/${r}/template/favicon.ico`,l=p.template||`node_modules/${r}/template/index.html`,s=e({title:t.env?.PROJECTNAME||m.toLocaleUpperCase()||"Title",filename:"index.html",hash:!1,minify:{minifyJS:!0,minifyCSS:!0,collapseWhitespace:!0,removeComments:!0,removeRedundantAttributes:!1,removeScriptTypeAttributes:!1,removeStyleLinkTypeAttributes:!1,removeAttributeQuotes:!0,useShortDoctype:!0},meta:{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",viewport:"width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1","apple-mobile-web-app-capable":"yes",renderer:"webkit",description:i,keywords:o},tags:[]},p,{template:a(l),favicon:a(n)});export default s;
|
package/lib/paths.d.mts
CHANGED
package/lib/paths.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"url";let c=JSON.parse(process.env.npm_config_argv||"{}")?.original;export const yarnArgv={};c?.forEach(e=>{let c=e.split("=");Object.assign(yarnArgv,{[c[0]]:c[1]||!0})});export const CUSTOMCONFIG=process.env.npm_config_config||yarnArgv.config;let o=process.cwd(),t=`${o}/node_modules`,a=`${t}/.cache/.mo`;export default{nodeModules:t,corePath:e.fileURLToPath(new URL(".",import.meta.url)),programPath:o,webpackCachePath:`${t}/.temp_cache`,cachePath:a,httpCachePath:`${t}/.cache/http`,swcCachePath:`${t}/.swc`,configPath:`${o}/config/index.ts`,customConfigPath:`${o}/config/${CUSTOMCONFIG}.ts`,coveragePath:`${o}/coverage/clover.xml`,pagesPath:`${o}/src/pages`,componentsPath:`${o}/components`};
|
|
1
|
+
import e from"url";let c=JSON.parse(process.env.npm_config_argv||"{}")?.original;export const yarnArgv={};c?.forEach(e=>{let c=e.split("=");Object.assign(yarnArgv,{[c[0]]:c[1]||!0})});export const CUSTOMCONFIG=process.env.npm_config_config||yarnArgv.config;let o=process.cwd(),t=`${o}/node_modules`,a=`${t}/.cache/.mo`;export default{nodeModules:t,corePath:e.fileURLToPath(new URL(".",import.meta.url)),programPath:o,webpackCachePath:`${t}/.temp_cache`,cachePath:a,httpCachePath:`${t}/.cache/http`,swcCachePath:`${t}/.swc`,configPath:`${o}/config/index.ts`,customConfigPath:`${o}/config/${CUSTOMCONFIG}.ts`,coveragePath:`${o}/coverage/clover.xml`,pagesPath:`${o}/src/pages`,componentsPath:`${o}/components`,mockPath:`${o}/mock`};
|
package/lib/swcrc.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{merge as e}from"webpack-merge";import{CONFIG as o}from"./config.mjs";import r from"./paths.mjs";import
|
|
1
|
+
import{merge as e}from"webpack-merge";import{CONFIG as o}from"./config.mjs";import r from"./paths.mjs";import s from"./polyfills.mjs";import{isDev as t,isReact as n,isSolid as i,jsxImportSource as l}from"./process-env.mjs";export const swcMinifyOption={compress:{top_retain:[],keep_infinity:!0,global_defs:{"@alert":"console.log"},pure_funcs:["console.log","console.warn","console.error","console.info"],toplevel:!1,drop_console:!0,drop_debugger:!0,module:!1,ecma:2015,ie8:!1,keep_classnames:void 0,keep_fnames:!1},mangle:!0};let m=function(e){for(let o=0,r=Object.keys(e),s=r.length;o<s;o++)e[r[o]].transform=`${r[o]}/${e[r[o]].transform}`,e[r[o]].style&&(e[r[o]].style=`${r[o]}/${e[r[o]].style}`);return e}(o.importOnDemand||{}),p={include:s(),mode:"entry",coreJs:"3.34"};export default(s=>e({module:{type:"es6",resolveFully:!0},jsc:{parser:{syntax:"typescript",tsx:!0,decorators:!0,dynamicImport:!0},loose:!0,target:o.polyfill?void 0:"es2017",externalHelpers:!1,transform:{legacyDecorator:!0,decoratorMetadata:!0,react:{runtime:"automatic",throwIfNamespace:!0,refresh:n&&t,development:t,importSource:l},optimizer:{simplify:!1}},minify:t?void 0:swcMinifyOption,experimental:{emitAssertForImportAttributes:!0,cacheRoot:r.swcCachePath,plugins:[["swc-plugin-another-transform-imports",m],i&&["@moneko/jsx-dom-expressions",{...o.jsxDomExpressions,generate:s?"ssr":"dom",hydratable:!!s}]].filter(Boolean)}},env:o.polyfill?p:void 0,sourceMaps:!0,parseMap:!0},"function"==typeof o.swcrc?o.swcrc(t):o.swcrc||{}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "3.9.17-beta.
|
|
3
|
+
"version": "3.9.17-beta.11",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
"author": "moneko",
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@loadable/webpack-plugin": "5.15.2",
|
|
18
17
|
"@moneko/mdx": "0.1.23",
|
|
19
18
|
"@swc/core": "1.3.101",
|
|
20
19
|
"add-asset-html-webpack-plugin": "6.0.0",
|
|
@@ -25,11 +24,15 @@
|
|
|
25
24
|
"cross-env": "7.0.3",
|
|
26
25
|
"css-loader": "6.8.1",
|
|
27
26
|
"express": "4.18.2",
|
|
28
|
-
"html-webpack-plugin": "5.
|
|
27
|
+
"html-webpack-plugin": "5.6.0",
|
|
28
|
+
"http-proxy-middleware": "2.0.6",
|
|
29
29
|
"less": "4.2.0",
|
|
30
30
|
"less-loader": "11.1.3",
|
|
31
31
|
"lightningcss": "1.22.1",
|
|
32
32
|
"mini-css-extract-plugin": "2.7.6",
|
|
33
|
+
"mock-json-schema": "1.1.1",
|
|
34
|
+
"multer": "1.4.5-lts.1",
|
|
35
|
+
"path-to-regexp": "6.2.1",
|
|
33
36
|
"style-loader": "3.3.3",
|
|
34
37
|
"swc-loader": "0.2.3",
|
|
35
38
|
"swc-plugin-another-transform-imports": "0.2.7",
|
|
@@ -48,7 +51,7 @@
|
|
|
48
51
|
"@swc/cli": "0.1.63",
|
|
49
52
|
"@types/cors": "2.8.17",
|
|
50
53
|
"@types/express": "4.17.21",
|
|
51
|
-
"@types/
|
|
54
|
+
"@types/multer": "1.4.11",
|
|
52
55
|
"eslint-config-neko": "2.3.0",
|
|
53
56
|
"eslint-webpack-plugin": "4.0.1",
|
|
54
57
|
"sass": "1.69.5",
|
package/typings/global.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import type { MdxOptions } from '@moneko/mdx';
|
|
|
7
7
|
import type { Config as SwcConfig, JsMinifyOptions as SwcMinifyOptions } from '@swc/core';
|
|
8
8
|
import type { Options as AssetHtmlOptions } from 'add-asset-html-webpack-plugin';
|
|
9
9
|
import type { Options as HtmlWebpackPluginOptions } from 'html-webpack-plugin';
|
|
10
|
+
import type { Options as ProxyConfig } from 'http-proxy-middleware';
|
|
10
11
|
import type { MinifyOptions as TerserMinifyOptions } from 'terser';
|
|
11
12
|
import type {
|
|
12
13
|
Configuration,
|
|
@@ -15,12 +16,6 @@ import type {
|
|
|
15
16
|
RuleSetRule,
|
|
16
17
|
WebpackPluginInstance,
|
|
17
18
|
} from 'webpack';
|
|
18
|
-
import type {
|
|
19
|
-
Configuration as DevServerConfiguration,
|
|
20
|
-
ProxyArray,
|
|
21
|
-
ProxyConfigArray,
|
|
22
|
-
ProxyConfigMap,
|
|
23
|
-
} from 'webpack-dev-server';
|
|
24
19
|
|
|
25
20
|
export type { TerserMinifyOptions, SwcMinifyOptions };
|
|
26
21
|
export type WebpackBarOptions = ConstructorParameters<typeof WebpackBar>[0];
|
|
@@ -168,13 +163,17 @@ export declare type ConfigType = {
|
|
|
168
163
|
/** node_modules中, 需要开启 cssModules 的模块 */
|
|
169
164
|
cssModules: string[];
|
|
170
165
|
/** 按需引入 */
|
|
171
|
-
importOnDemand
|
|
166
|
+
importOnDemand?: SwcImportOnDemandTransform;
|
|
172
167
|
/** 开发服务器代理 */
|
|
173
|
-
proxy
|
|
168
|
+
proxy?: Record<string, ProxyConfig>;
|
|
174
169
|
/** 自定义缓存目录,为 false 时,不使用缓存 */
|
|
175
|
-
cacheDirectory
|
|
170
|
+
cacheDirectory?: string | false;
|
|
176
171
|
/** 开发服务器设置 */
|
|
177
|
-
devServer
|
|
172
|
+
devServer?: {
|
|
173
|
+
headers?: Record<string, string>;
|
|
174
|
+
host?: string;
|
|
175
|
+
port?: number;
|
|
176
|
+
};
|
|
178
177
|
/** HtmlWebpackPlugin Option */
|
|
179
178
|
htmlPluginOption: HtmlWebpackOption | false;
|
|
180
179
|
/** 自定义插入 html 的 js 和 css
|
package/lib/dev-old.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/dev-old.mjs
DELETED
|
File without changes
|