@moneko/core 4.1.4 → 4.2.0-beta.1
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-app.mjs.d.ts +17 -0
- package/lib/bin/{commit-lint.d.mts → commit-lint.mjs.d.ts} +5 -8
- package/lib/bin/help.mjs +1 -1
- package/lib/bin/{index.d.mts → index.mjs.d.ts} +1 -1
- package/lib/bin/{pin.d.mts → pin.mjs.d.ts} +1 -2
- package/lib/bin/{pure-lint.d.mts → pure-lint.mjs.d.ts} +1 -1
- package/lib/bin/server.mjs +1 -1
- package/lib/bin/server.mjs.d.ts +2 -0
- package/lib/bin/setup.mjs +1 -1
- package/lib/bin/tsc.mjs.d.ts +2 -0
- package/lib/bin/utils/{bundle-app.d.mts → bundle-app.mjs.d.ts} +2 -0
- package/lib/bin/utils/config.mjs +1 -1
- package/lib/bin/utils/convert-react.mjs.d.ts +174 -0
- package/lib/bin/utils/get-commit-files.mjs +1 -1
- package/lib/bin/utils/get-commit-files.mjs.d.ts +2 -0
- package/lib/build-dev.mjs.d.ts +1 -0
- package/lib/build.mjs.d.ts +1 -0
- package/lib/commom/{ca.d.mts → ca.mjs.d.ts} +3 -5
- package/lib/commom/check-npm.mjs +1 -1
- package/lib/commom/{check-npm.d.mts → check-npm.mjs.d.ts} +1 -2
- package/lib/commom/{corepack.d.mts → corepack.mjs.d.ts} +1 -2
- package/lib/commom/css-in-js-minify.mjs.d.ts +12 -0
- package/lib/commom/esm.mjs +1 -1
- package/lib/commom/has-pkg.mjs +1 -1
- package/lib/commom/is-ci-environment.mjs +1 -1
- package/lib/commom/{is-ci-environment.d.mts → is-ci-environment.mjs.d.ts} +1 -2
- package/lib/commom/match-path.mjs +1 -1
- package/lib/commom/{match-path.d.mts → match-path.mjs.d.ts} +1 -2
- package/lib/commom/module-resolve.mjs +1 -1
- package/lib/commom/open.mjs +1 -1
- package/lib/commom/{package-manager.d.mts → package-manager.mjs.d.ts} +2 -3
- package/lib/commom/parse-args.mjs +1 -1
- package/lib/commom/paths.mjs.d.ts +33 -0
- package/lib/commom/print-log.mjs +1 -1
- package/lib/commom/{reactive-object.d.mts → reactive-object.mjs.d.ts} +1 -0
- package/lib/commom/rule.mjs.d.ts +2 -0
- package/lib/commom/{setup-env.d.mts → setup-env.mjs.d.ts} +4 -2
- package/lib/commom/sigint-exit.mjs +1 -1
- package/lib/commom/{timer.d.mts → timer.mjs.d.ts} +1 -2
- package/lib/commom/transfer-import-on-demand.mjs.d.ts +54 -0
- package/lib/create-development-configuration.mjs.d.ts +2 -0
- package/lib/dev/config.mjs.d.ts +9 -0
- package/lib/dev/generate-progress-html.mjs +1 -1
- package/lib/dev/get-cert.mjs.d.ts +10 -0
- package/lib/dev/{json-schema.d.mts → json-schema.mjs.d.ts} +3 -1
- package/lib/dev/mock.mjs +1 -1
- package/lib/dev/{mock.d.mts → mock.mjs.d.ts} +17 -21
- package/lib/dev/{proxy.d.mts → proxy.mjs.d.ts} +1 -1
- package/lib/dev.mjs.d.ts +1 -0
- package/lib/{index.d.mts → index.mjs.d.ts} +5 -5
- package/lib/lint/stylelint/{index.d.mts → index.mjs.d.ts} +1 -1
- package/lib/loader/{css-in-js-minify.d.cts → css-in-js-minify.cjs.d.ts} +3 -1
- package/lib/loader/{lightning-css.d.cts → lightning-css.cjs.d.ts} +2 -0
- package/lib/loader/mdx.cjs.d.ts +5 -0
- package/lib/loader/react-compiler.cjs.d.ts +27 -0
- package/lib/loader/{solid.d.cts → solid.cjs.d.ts} +1 -1
- package/lib/module.config.mjs.d.ts +3 -0
- package/lib/options/md-to-html.mjs +1 -1
- package/lib/options/reslove.mjs.d.ts +10 -0
- package/lib/options/{swcrc.d.mts → swcrc.mjs.d.ts} +2 -2
- package/lib/plugin/{compression.d.mts → compression.mjs.d.ts} +1 -1
- package/lib/plugin/{copy.d.mts → copy.mjs.d.ts} +3 -6
- package/lib/plugin/{exposes-declararion.d.mts → exposes-declararion.mjs.d.ts} +1 -1
- package/lib/plugin/{html-plugin.d.mts → html-plugin.mjs.d.ts} +20 -29
- package/lib/plugin/{lightningcss-plugin.d.mts → lightningcss-plugin.mjs.d.ts} +1 -1
- package/lib/plugin/manifest/index.mjs +1 -1
- package/lib/plugin/manifest/{index.d.mts → index.mjs.d.ts} +1 -1
- package/lib/plugin/manifest/types.mjs.d.ts +508 -0
- package/lib/plugin/override-resolve.mjs.d.ts +23 -0
- package/lib/plugin/{virtual-module.d.mts → virtual-module.mjs.d.ts} +1 -1
- package/lib/polyfills/inject-react-refresh.mjs.d.ts +1 -0
- package/lib/polyfills/polyfills.mjs +1 -1
- package/lib/polyfills/replace-children.mjs.d.ts +1 -0
- package/lib/{process-env.d.mts → process-env.mjs.d.ts} +14 -14
- package/lib/utils/{compile-dts.d.mts → compile-dts.mjs.d.ts} +2 -3
- package/lib/utils/create-types.mjs +1 -1
- package/lib/utils/{dts.d.mts → dts.mjs.d.ts} +2 -4
- package/lib/utils/{index.d.mts → index.mjs.d.ts} +9 -15
- package/lib/utils/run.mjs +1 -1
- package/lib/utils/run.mjs.d.ts +2 -0
- package/lib/utils/seo.mjs +2 -2
- package/lib/utils/seo.mjs.d.ts +2 -0
- package/lib/utils/svg-to-data-uri.mjs +1 -1
- package/lib/utils/{vts.d.mts → vts.mjs.d.ts} +3 -3
- package/lib/vm/coverage.mjs +1 -1
- package/lib/vm/{docs.d.mts → docs.mjs.d.ts} +1 -0
- package/lib/vm/generate-doc.mjs +1 -1
- package/lib/vm/{locales.d.mts → locales.mjs.d.ts} +1 -0
- package/lib/worker/compression.mjs.d.ts +1 -0
- package/lib/worker/css-in-js-minify.mjs.d.ts +1 -0
- package/lib/worker/dts.mjs.d.ts +1 -0
- package/lib/worker/react-compiler.mjs.d.ts +1 -0
- package/lib/worker/solid.mjs.d.ts +1 -0
- package/lib/worker/swc-minify.mjs.d.ts +1 -0
- package/package.json +13 -16
- package/lib/bin/build-app.d.mts +0 -16
- package/lib/bin/server.d.mts +0 -2
- package/lib/bin/tsc.d.mts +0 -2
- package/lib/bin/utils/convert-react.d.mts +0 -1
- package/lib/bin/utils/get-commit-files.d.mts +0 -2
- package/lib/build-dev.d.mts +0 -1
- package/lib/build.d.mts +0 -1
- package/lib/commom/css-in-js-minify.d.mts +0 -13
- package/lib/commom/paths.d.mts +0 -52
- package/lib/commom/rule.d.mts +0 -27
- package/lib/commom/transfer-import-on-demand.d.mts +0 -78
- package/lib/create-development-configuration.d.mts +0 -2
- package/lib/dev/config.d.mts +0 -4
- package/lib/dev/get-cert.d.mts +0 -8
- package/lib/dev.d.mts +0 -1
- package/lib/loader/mdx.d.cts +0 -3
- package/lib/loader/react-compiler.d.cts +0 -29
- package/lib/module.config.d.mts +0 -3
- package/lib/options/reslove.d.mts +0 -9
- package/lib/plugin/manifest/types.d.mts +0 -576
- package/lib/plugin/override-resolve.d.mts +0 -25
- package/lib/polyfills/inject-react-refresh.d.mts +0 -1
- package/lib/polyfills/replace-children.d.mts +0 -1
- package/lib/utils/run.d.mts +0 -2
- package/lib/utils/seo.d.mts +0 -2
- package/lib/worker/compression.d.mts +0 -1
- package/lib/worker/css-in-js-minify.d.mts +0 -1
- package/lib/worker/dts.d.mts +0 -1
- package/lib/worker/react-compiler.d.mts +0 -1
- package/lib/worker/solid.d.mts +0 -1
- package/lib/worker/swc-minify.d.mts +0 -1
- /package/lib/bin/{build-dev.d.mts → build-dev.mjs.d.ts} +0 -0
- /package/lib/bin/{build.d.mts → build.mjs.d.ts} +0 -0
- /package/lib/bin/{changelog.d.mts → changelog.mjs.d.ts} +0 -0
- /package/lib/bin/{eslint.d.mts → eslint.mjs.d.ts} +0 -0
- /package/lib/bin/{file.d.mts → file.mjs.d.ts} +0 -0
- /package/lib/bin/{git-hooks.d.mts → git-hooks.mjs.d.ts} +0 -0
- /package/lib/bin/{help.d.mts → help.mjs.d.ts} +0 -0
- /package/lib/bin/{lessc.d.mts → lessc.mjs.d.ts} +0 -0
- /package/lib/bin/{setup.d.mts → setup.mjs.d.ts} +0 -0
- /package/lib/bin/{start.d.mts → start.mjs.d.ts} +0 -0
- /package/lib/bin/{stylelint.d.mts → stylelint.mjs.d.ts} +0 -0
- /package/lib/bin/utils/{config.d.mts → config.mjs.d.ts} +0 -0
- /package/lib/bin/utils/{setup-swcrc.d.mts → setup-swcrc.mjs.d.ts} +0 -0
- /package/lib/build/{common.d.mts → common.mjs.d.ts} +0 -0
- /package/lib/build/{server.d.mts → server.mjs.d.ts} +0 -0
- /package/lib/commom/{diff-object.d.mts → diff-object.mjs.d.ts} +0 -0
- /package/lib/commom/{esm.d.mts → esm.mjs.d.ts} +0 -0
- /package/lib/commom/{has-pkg.d.mts → has-pkg.mjs.d.ts} +0 -0
- /package/lib/commom/{host.d.mts → host.mjs.d.ts} +0 -0
- /package/lib/commom/{log.d.mts → log.mjs.d.ts} +0 -0
- /package/lib/commom/{mime.d.mts → mime.mjs.d.ts} +0 -0
- /package/lib/commom/{module-resolve.d.mts → module-resolve.mjs.d.ts} +0 -0
- /package/lib/commom/{net.d.mts → net.mjs.d.ts} +0 -0
- /package/lib/commom/{open.d.mts → open.mjs.d.ts} +0 -0
- /package/lib/commom/{parse-args.d.mts → parse-args.mjs.d.ts} +0 -0
- /package/lib/commom/{print-log.d.mts → print-log.mjs.d.ts} +0 -0
- /package/lib/commom/{read-json.d.mts → read-json.mjs.d.ts} +0 -0
- /package/lib/commom/{require.d.mts → require.mjs.d.ts} +0 -0
- /package/lib/commom/{sigint-exit.d.mts → sigint-exit.mjs.d.ts} +0 -0
- /package/lib/commom/{transform-solid-js.d.mts → transform-solid-js.mjs.d.ts} +0 -0
- /package/lib/{common.d.mts → common.mjs.d.ts} +0 -0
- /package/lib/{config.d.mts → config.mjs.d.ts} +0 -0
- /package/lib/dev/{generate-progress-html.d.mts → generate-progress-html.mjs.d.ts} +0 -0
- /package/lib/dev/{server.d.mts → server.mjs.d.ts} +0 -0
- /package/lib/{file-system.d.mts → file-system.mjs.d.ts} +0 -0
- /package/lib/lint/eslint/{base.d.mts → base.mjs.d.ts} +0 -0
- /package/lib/lint/eslint/{index.d.mts → index.mjs.d.ts} +0 -0
- /package/lib/lint/eslint/{react-jsx.d.mts → react-jsx.mjs.d.ts} +0 -0
- /package/lib/lint/eslint/{react-legacy.d.mts → react-legacy.mjs.d.ts} +0 -0
- /package/lib/lint/eslint/{react.d.mts → react.mjs.d.ts} +0 -0
- /package/lib/lint/eslint/{solid.d.mts → solid.mjs.d.ts} +0 -0
- /package/lib/lint/eslint/{vue.d.mts → vue.mjs.d.ts} +0 -0
- /package/lib/lint/stylelint/{config.d.mts → config.mjs.d.ts} +0 -0
- /package/lib/options/{jsx-dom-expressions.d.mts → jsx-dom-expressions.mjs.d.ts} +0 -0
- /package/lib/options/{md-to-html.d.mts → md-to-html.mjs.d.ts} +0 -0
- /package/lib/options/{modify-vars.d.mts → modify-vars.mjs.d.ts} +0 -0
- /package/lib/options/{split-chunk.d.mts → split-chunk.mjs.d.ts} +0 -0
- /package/lib/plugin/{css-module-dts.d.mts → css-module-dts.mjs.d.ts} +0 -0
- /package/lib/plugin/{done.d.mts → done.mjs.d.ts} +0 -0
- /package/lib/plugin/{eslint.d.mts → eslint.mjs.d.ts} +0 -0
- /package/lib/plugin/{external-remotes.d.mts → external-remotes.mjs.d.ts} +0 -0
- /package/lib/plugin/{module-federation.d.mts → module-federation.mjs.d.ts} +0 -0
- /package/lib/plugin/{stylelint.d.mts → stylelint.mjs.d.ts} +0 -0
- /package/lib/plugin/{swc-minify-plugin.d.mts → swc-minify-plugin.mjs.d.ts} +0 -0
- /package/lib/{plugins.config.d.mts → plugins.config.mjs.d.ts} +0 -0
- /package/lib/polyfills/{polyfills.d.mts → polyfills.mjs.d.ts} +0 -0
- /package/lib/polyfills/{public-path.d.mts → public-path.mjs.d.ts} +0 -0
- /package/lib/polyfills/{targets.d.mts → targets.mjs.d.ts} +0 -0
- /package/lib/utils/{create-types.d.mts → create-types.mjs.d.ts} +0 -0
- /package/lib/utils/{fetch-module-federation-dts.d.mts → fetch-module-federation-dts.mjs.d.ts} +0 -0
- /package/lib/utils/{svg-to-data-uri.d.mts → svg-to-data-uri.mjs.d.ts} +0 -0
- /package/lib/vm/{app.d.mts → app.mjs.d.ts} +0 -0
- /package/lib/vm/{coverage.d.mts → coverage.mjs.d.ts} +0 -0
- /package/lib/vm/{dts.d.mts → dts.mjs.d.ts} +0 -0
- /package/lib/vm/{example.d.mts → example.mjs.d.ts} +0 -0
- /package/lib/vm/{generate-doc.d.mts → generate-doc.mjs.d.ts} +0 -0
- /package/lib/vm/{render-app.d.mts → render-app.mjs.d.ts} +0 -0
- /package/lib/vm/{routes.d.mts → routes.mjs.d.ts} +0 -0
- /package/lib/vm/{scope.d.mts → scope.mjs.d.ts} +0 -0
- /package/lib/vm/{virtual.d.mts → virtual.mjs.d.ts} +0 -0
- /package/lib/worker/{eslint.d.mts → eslint.mjs.d.ts} +0 -0
- /package/lib/worker/{stylelint.d.mts → stylelint.mjs.d.ts} +0 -0
package/lib/dev/mock.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{watch as e}from"node:fs";import t from"node:http";import{join as r}from"node:path";import{StringDecoder as o}from"node:string_decoder";import{URL as n}from"node:url";import{directoryExists as a,ink as i,print as c,scanFolderSync as s}from"@moneko/utils";import{merge as m}from"webpack-merge";import d from"../commom/log.mjs";import l from"../commom/match-path.mjs";import p from"../commom/paths.mjs";import u,{METHOD_COLOR as f}from"../commom/print-log.mjs";import h from"../commom/require.mjs";import g from"../commom/sigint-exit.mjs";import{jsonSchema as y}from"./json-schema.mjs";function b(e){return!["GET","HEAD","OPTIONS"].includes(e.method?.toUpperCase()||"")}export function cacheBody(e){if(!e._bodyCached&&b(e)&&!e.readableEnded){e._bodyCached=!0;try{let t=[],r=e.on.bind(e),o=e.emit.bind(e),n=!1;e.on=function(e,o){return"data"!==e||n||(n=!0,r("data",e=>{t.push(e)})),r(e,o)};let a=!1;e.emit=function(r,...n){return"end"===r&&!a&&(a=!0,t.length>0&&(e._dataChunks=t)),o.call(this,r,...n)}}catch(e){d(e)}}}function k(e,t){try{let r=Buffer.concat(e);if(t.includes("application/json")){let e=new o("utf-8").write(r);return JSON.parse(e)}if(t.includes("application/octet-stream")||t.startsWith("image/"));else if(t.includes("text/"))return r.toString("utf-8");else if(t.includes("application/x-www-form-urlencoded"))return Object.fromEntries(new URLSearchParams(r.toString("utf8")));return r}catch(e){return d(e),null}}async function j(e){return new Promise(t=>{if(!b(e))return void t(null);let r=e.headers["content-type"]||"",o=e.headers["content-length"],n=e.headers["transfer-encoding"],a=[];void 0!==e._dataChunks?t(k(e._dataChunks,r)):o||n?(e.on("data",e=>{a.push(e)}),e.on("end",()=>{t(k(a,r))}),e.on("error",e=>{t(null),d(e)})):t(null)})}export const yApiSchemaMock=(e,r)=>new Promise(o=>{t.get(`${e.host}/api/interface/get?id=${e.id}&token=${e.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),n=y(t);void 0!==r?o(m(n,r)):o(n)}}catch(e){d(e)}})})});export const yApiMock=(e,r)=>new Promise((o,a)=>{let i=new n(r.host),c={hostname:i.hostname,port:i.port,path:e.url?.replace(new RegExp(r.pathRewrite),`/mock/${r.projectId}/`),method:e.method,headers:e.headers,query:Object.fromEntries(i.searchParams)},s=t.request(c,e=>{e.setEncoding("utf8");let t="";e.on("data",e=>{t+=e}),e.on("end",()=>{try{o(JSON.parse(t))}catch(e){d(e)}})});s.on("error",e=>{a(e.message)}),s.write(JSON.stringify(e.body)),s.end()});let w=()=>{if(!a(p.mockPath)){O={};return}let e={},t=s(p.mockPath,["\\.(t|j)s$"]);c(i("Updating mock...","245"),!0),t.forEach(t=>{try{Object.assign(e,h(t).default)}catch(e){d(e)}}),c(i("Mock update successful","245"),!0),O=e},O={};w();export function containMockUrl(e){return Object.keys(O).find(t=>RegExp(`^${t.replace(/(:\w*)[^/]/g,"((?!/).)")}*$`).test(e))}
|
|
1
|
+
import{watch as e}from"node:fs";import t from"node:http";import{join as r}from"node:path";import{StringDecoder as o}from"node:string_decoder";import{URL as n}from"node:url";import{directoryExists as a,ink as i,print as c,scanFolderSync as s}from"@moneko/utils";import{merge as m}from"webpack-merge";import d from"../commom/log.mjs";import l from"../commom/match-path.mjs";import p from"../commom/paths.mjs";import u,{METHOD_COLOR as f}from"../commom/print-log.mjs";import h from"../commom/require.mjs";import g from"../commom/sigint-exit.mjs";import{jsonSchema as y}from"./json-schema.mjs";function b(e){return!["GET","HEAD","OPTIONS"].includes(e.method?.toUpperCase()||"")}export function cacheBody(e){if(!e._bodyCached&&b(e)&&!e.readableEnded){e._bodyCached=!0;try{let t=[],r=e.on.bind(e),o=e.emit.bind(e),n=!1;e.on=function(e,o){return"data"!==e||n||(n=!0,r("data",e=>{t.push(e)})),r(e,o)};let a=!1;e.emit=function(r,...n){return"end"===r&&!a&&(a=!0,t.length>0&&(e._dataChunks=t)),o.call(this,r,...n)}}catch(e){d(e)}}}function k(e,t){try{let r=Buffer.concat(e);if(t.includes("application/json")){let e=new o("utf-8").write(r);return JSON.parse(e)}if(t.includes("application/octet-stream")||t.startsWith("image/"));else if(t.includes("text/"))return r.toString("utf-8");else if(t.includes("application/x-www-form-urlencoded"))return Object.fromEntries(new URLSearchParams(r.toString("utf8")));return r}catch(e){return d(e),null}}async function j(e){return new Promise(t=>{if(!b(e))return void t(null);let r=e.headers["content-type"]||"",o=e.headers["content-length"],n=e.headers["transfer-encoding"],a=[];void 0!==e._dataChunks?t(k(e._dataChunks,r)):o||n?(e.on("data",e=>{a.push(e)}),e.on("end",()=>{t(k(a,r))}),e.on("error",e=>{t(null),d(e)})):t(null)})}export const yApiSchemaMock=(e,r)=>new Promise(o=>{t.get(`${e.host}/api/interface/get?id=${e.id}&token=${e.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),n=y(t);void 0!==r?o(m(n,r)):o(n)}}catch(e){d(e)}})})});export const yApiMock=(e,r)=>new Promise((o,a)=>{let i=new n(r.host),c={hostname:i.hostname,port:i.port,path:e.url?.replace(new RegExp(r.pathRewrite),`/mock/${r.projectId}/`),method:e.method,headers:e.headers,query:Object.fromEntries(i.searchParams)},s=t.request(c,e=>{e.setEncoding("utf8");let t="";e.on("data",e=>{t+=e}),e.on("end",()=>{try{o(JSON.parse(t))}catch(e){d(e)}})});s.on("error",e=>{a(e.message)}),s.write(JSON.stringify(e.body)),s.end()});let w=()=>{if(!a(p.mockPath)){O={};return}let e={},t=s(p.mockPath,["\\.(t|j)s$"]);c(i("Updating mock...","245"),!0),t.forEach(t=>{try{Object.assign(e,h(t).default)}catch(e){d(e)}}),c(i("Mock update successful","245"),!0),O=e},O={};w();export function containMockUrl(e){return Object.keys(O).find(t=>RegExp(`^${t.replace(/(:\w*)[^/]/g,"((?!/).)")}*$`).test(e))}function E(e,t){if(t.writableEnded)return t;let r=new n(`http://localhost:3000${e.url}`),o=e.method||"GET",a=`${o} ${r.pathname}`,i=containMockUrl(a)||a,c=O[i];if(c){if(u(o,r.pathname,{note:"MOCK",labelAlign:"center",labelLen:8,labelForegroundColor:f[o].fg,labelBackgroundColor:f[o].bg}),t.send=e=>t.end("string"==typeof e?e:JSON.stringify(e)),t.writeHead(200,{"Content-Type":e.headers["content-type"]}),"function"==typeof c){let o=l(i.split(" ")[1],r.pathname);r.searchParams&&Object.assign(e,{query:Object.fromEntries(r.searchParams)}),o&&Object.assign(e,{params:o.params}),e.body=j(e);try{c(e,t)}catch(e){d(e)}return!0}return t.end("string"==typeof c?c:JSON.stringify(c)),!0}return!1}export default(()=>{if(!a(p.mockPath))return;let t=e(p.mockPath,(e,t)=>{if(t){let e=r(p.mockPath,t);delete h.cache[e]}w()});return g(()=>{t.close()}),E});
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
2
|
export declare function cacheBody(req: RequestFormData & {
|
|
3
3
|
_bodyCached?: boolean;
|
|
4
4
|
_dataChunks?: Uint8Array[];
|
|
5
5
|
}): void;
|
|
6
|
+
// 更新请求类型定义
|
|
6
7
|
export interface RequestFormData extends IncomingMessage {
|
|
7
8
|
files?: {
|
|
8
9
|
fieldname: string;
|
|
@@ -20,43 +21,38 @@ export interface MockServerResponse extends ServerResponse<IncomingMessage> {
|
|
|
20
21
|
req: IncomingMessage;
|
|
21
22
|
send<T>(chunk: T): ReturnType<ServerResponse<IncomingMessage>['end']>;
|
|
22
23
|
}
|
|
24
|
+
// 更新处理函数类型
|
|
23
25
|
export type ProxyFuncType = (req: RequestFormData, res: MockServerResponse) => void | Promise<void>;
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24
27
|
export type MockConfiguration = Record<string, ProxyFuncType | Record<string, any> | null>;
|
|
25
28
|
export type YApiOptionBySchema = {
|
|
26
|
-
/** YApi host */
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
id: string;
|
|
30
|
-
/** YApi开放接口token */
|
|
31
|
-
token: string;
|
|
29
|
+
/** YApi host */ host: string;
|
|
30
|
+
/** 接口id */ id: string;
|
|
31
|
+
/** YApi开放接口token */ token: string;
|
|
32
32
|
};
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
33
34
|
type Any = any;
|
|
34
35
|
/**
|
|
35
36
|
* 通过 YApi 接口对应的响应JSON Schema生成默认的数据
|
|
36
37
|
* @param {YApiOptionBySchema} option Schema
|
|
37
38
|
* @param {T} data data
|
|
38
39
|
* @returns {Promise} mockData
|
|
39
|
-
*/
|
|
40
|
-
export declare const yApiSchemaMock: <T extends Any>(option: YApiOptionBySchema, data?: T) => Promise<T>;
|
|
40
|
+
*/ export declare const yApiSchemaMock: <T extends Any>(option: YApiOptionBySchema, data?: T) => Promise<T>;
|
|
41
41
|
export type YApiOption = {
|
|
42
|
-
/** YApi host */
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
projectId: number;
|
|
46
|
-
/** 重写请求路径, 例如:'^/api/' */
|
|
47
|
-
pathRewrite: string;
|
|
42
|
+
/** YApi host */ host: string;
|
|
43
|
+
/** YApi 项目ID */ projectId: number;
|
|
44
|
+
/** 重写请求路径, 例如:'^/api/' */ pathRewrite: string;
|
|
48
45
|
};
|
|
49
46
|
/**
|
|
50
47
|
* 请求YApi高级mock接口数据
|
|
51
48
|
* @param {RequestFormData} req req
|
|
52
49
|
* @param {YApiOption} yapi YApiOption
|
|
53
50
|
* @returns {Promise} data
|
|
54
|
-
*/
|
|
55
|
-
export declare const yApiMock: (req: RequestFormData, yapi: YApiOption) => Promise<Any>;
|
|
51
|
+
*/ export declare const yApiMock: (req: RequestFormData, yapi: YApiOption) => Promise<Any>;
|
|
56
52
|
export declare function containMockUrl(url: string): string | undefined;
|
|
57
|
-
|
|
53
|
+
type MockResponse = ServerResponse<IncomingMessage> & {
|
|
58
54
|
req: IncomingMessage;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
};
|
|
56
|
+
declare function mockPlugin(req: RequestFormData, res: MockResponse): boolean | MockResponse;
|
|
57
|
+
declare const setupMock: () => typeof mockPlugin | void;
|
|
62
58
|
export default setupMock;
|
package/lib/dev.mjs.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -10,18 +10,18 @@ export { default as printLog } from './commom/print-log.mjs';
|
|
|
10
10
|
export { default as require } from './commom/require.mjs';
|
|
11
11
|
export { default as Rule } from './commom/rule.mjs';
|
|
12
12
|
export { default as timer } from './commom/timer.mjs';
|
|
13
|
-
export { type MockConfiguration, type ProxyFuncType, type RequestFormData, yApiMock, type YApiOption, type YApiOptionBySchema, yApiSchemaMock
|
|
13
|
+
export { type MockConfiguration, type ProxyFuncType, type RequestFormData, yApiMock, type YApiOption, type YApiOptionBySchema, yApiSchemaMock } from './dev/mock.mjs';
|
|
14
14
|
export type { ProxyConfig } from './dev/proxy.mjs';
|
|
15
15
|
export type { ReactCompilerOption } from './loader/react-compiler.cjs';
|
|
16
|
-
export { type JsxDomExpressions, default as jsxDomExpressions
|
|
17
|
-
export { type OptimizationSplitChunksOptions, default as splitChunk
|
|
16
|
+
export { type JsxDomExpressions, default as jsxDomExpressions } from './options/jsx-dom-expressions.mjs';
|
|
17
|
+
export { type OptimizationSplitChunksOptions, default as splitChunk } from './options/split-chunk.mjs';
|
|
18
18
|
export type { CompressionPluginOptions } from './plugin/compression.mjs';
|
|
19
19
|
export type { HtmlMeta, HtmlPluginOption } from './plugin/html-plugin.mjs';
|
|
20
20
|
export * from './plugin/manifest/index.mjs';
|
|
21
21
|
export type { OverrideResolverOption } from './plugin/override-resolve.mjs';
|
|
22
22
|
export type { VirtualModules } from './plugin/virtual-module.mjs';
|
|
23
|
-
export { APPTYPE, coreName, FRAMEWORK, isCI, isDev, isLibrary, isMicro, mainDirectory, packageJson, PACKAGENAME
|
|
24
|
-
export { type AlgorithmIdentifier, digest, md5, node_modules, resolveProgram, toCamelCase
|
|
23
|
+
export { APPTYPE, coreName, FRAMEWORK, isCI, isDev, isLibrary, isMicro, mainDirectory, packageJson, PACKAGENAME } from './process-env.mjs';
|
|
24
|
+
export { type AlgorithmIdentifier, digest, md5, node_modules, resolveProgram, toCamelCase } from './utils/index.mjs';
|
|
25
25
|
export * from '@moneko/mdx';
|
|
26
26
|
export * from '@moneko/utils';
|
|
27
27
|
import webpack from 'webpack';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { type Config, type ConfigRuleSettings, type CoreRules, type CosmiconfigResult, type CssSyntaxError, type CustomSyntax, type DisabledRange, type DisabledRangeObject, type DisabledWarning, type DisableOptions, type DisableOptionsReport, type DisablePropertyName, type DisableReportRange, type EditInfo, type FixCallback, type FixMode, type FixObject, type Formatter, type FormatterType, type GetLintSourceOptions, type GetPostcssOptions, type InternalApi, type LinterOptions, type LinterResult, type LintResult, type LonghandSubPropertiesOfShorthandProperties, type Plugin, type PostcssPluginOptions, type PostcssResult, type Problem, type Processor, type PublicApi, type Range, type Rule, type RuleBase, type RuleContext, type RuleMessage, type RuleMessages, type RuleMeta, type RuleOptions, type RuleOptionsPossible, type Severity, type ShorthandProperties, stylelint, type StylelintPostcssResult, type Utils, type Warning, type WarningOptions
|
|
1
|
+
export { type Config, type ConfigRuleSettings, type CoreRules, type CosmiconfigResult, type CssSyntaxError, type CustomSyntax, type DisabledRange, type DisabledRangeObject, type DisabledWarning, type DisableOptions, type DisableOptionsReport, type DisablePropertyName, type DisableReportRange, type EditInfo, type FixCallback, type FixMode, type FixObject, type Formatter, type FormatterType, type GetLintSourceOptions, type GetPostcssOptions, type InternalApi, type LinterOptions, type LinterResult, type LintResult, type LonghandSubPropertiesOfShorthandProperties, type Plugin, type PostcssPluginOptions, type PostcssResult, type Problem, type Processor, type PublicApi, type Range, type Rule, type RuleBase, type RuleContext, type RuleMessage, type RuleMessages, type RuleMeta, type RuleOptions, type RuleOptionsPossible, type Severity, type ShorthandProperties, stylelint, type StylelintPostcssResult, type Utils, type Warning, type WarningOptions } from '@moneko/stylelint';
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { LoaderContext } from 'webpack';
|
|
2
|
-
import type { CssInJsMinifyOption } from '../commom/css-in-js-minify.mjs' with {
|
|
2
|
+
import type { CssInJsMinifyOption } from '../commom/css-in-js-minify.mjs' with {
|
|
3
|
+
'resolution-mode': 'import'
|
|
4
|
+
};
|
|
3
5
|
export default function cssInJsMinifyLoader(this: LoaderContext<CssInJsMinifyOption>, sourceCode: string): Promise<void>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2
|
+
// @ts-nocheck
|
|
1
3
|
import { type CustomAtRules, type TransformOptions } from 'lightningcss';
|
|
2
4
|
import type { LoaderContext } from 'webpack';
|
|
3
5
|
export interface LightningCssLoaderOption extends Omit<TransformOptions<CustomAtRules>, 'filename' | 'code' | 'inputSourceMap' | 'cssModules'> {
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
import { type MdxOptions } from '@moneko/mdx';
|
|
4
|
+
import type { LoaderContext } from 'webpack';
|
|
5
|
+
export default function(this: LoaderContext<Omit<MdxOptions, 'value'>>, value: string): Promise<void>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { TransformOptions } from '@moneko/eslint/babel-core';
|
|
2
|
+
import type { PluginOptions } from '@moneko/eslint/react-compiler';
|
|
3
|
+
import type { LoaderContext } from 'webpack';
|
|
4
|
+
export interface ReactCompilerOption extends Partial<PluginOptions> {
|
|
5
|
+
/**
|
|
6
|
+
* 指定 React 的主要版本
|
|
7
|
+
* @description
|
|
8
|
+
* ReactCompiler 与 React 19+ 配合使用效果最佳;
|
|
9
|
+
*
|
|
10
|
+
* 将 ReactCompiler 与 React 17、18 一起使用需要安装额外的 `react-compiler-runtime` 依赖项;
|
|
11
|
+
*/ target: '17' | '18' | '19';
|
|
12
|
+
/** 编译模式
|
|
13
|
+
* @description annotation 注释模式: 通过 "use memo"、"use no memo" 手动指定启用优化
|
|
14
|
+
* @example
|
|
15
|
+
* export default function Home() {
|
|
16
|
+
* 'use memo';
|
|
17
|
+
* // ...
|
|
18
|
+
* }
|
|
19
|
+
* export default function About() {
|
|
20
|
+
* 'use no memo';
|
|
21
|
+
* // ...
|
|
22
|
+
* }
|
|
23
|
+
*/ compilationMode: 'annotation' | 'infer' | 'syntax' | 'all';
|
|
24
|
+
}
|
|
25
|
+
declare function reactCompilerLoader(this: LoaderContext<ReactCompilerOption>, sourceCode: string, inputSourceMap?: TransformOptions['inputSourceMap']): string | Buffer | void;
|
|
26
|
+
export declare function custom(this: LoaderContext<ReactCompilerOption>, sourceCode: string, inputSourceMap?: TransformOptions['inputSourceMap']): typeof reactCompilerLoader;
|
|
27
|
+
export default reactCompilerLoader;
|
|
@@ -2,5 +2,5 @@ import { type TransformSolidJsOption } from '@moneko/convert/solid';
|
|
|
2
2
|
import type { TransformOptions } from '@moneko/eslint/babel-core';
|
|
3
3
|
import type { LoaderContext } from 'webpack';
|
|
4
4
|
declare function solidLoader(this: LoaderContext<TransformSolidJsOption>, sourceCode: string, inputSourceMap?: TransformOptions['inputSourceMap']): Promise<void>;
|
|
5
|
-
export declare function custom(this: LoaderContext<TransformSolidJsOption>, sourceCode: string, inputSourceMap?: TransformOptions['inputSourceMap']):
|
|
5
|
+
export declare function custom(this: LoaderContext<TransformSolidJsOption>, sourceCode: string, inputSourceMap?: TransformOptions['inputSourceMap']): typeof solidLoader;
|
|
6
6
|
export default solidLoader;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"marked-completed";let r=!0;export default function(t){if(r){let t;r=!1,(t=new e.Renderer).code=(e,r)=>"treeview"===r?`<n-tree data="${e}" />`:`<n-code class="n-code" toolbar="${JSON.stringify(["copy"])}" language="${r}" line-number="true">${encodeURIComponent(e)}</n-code>`,t.image=(e,r,t)=>`<n-img lazy="true" role="img" src="${e}" alt="${t}" ${r?`title="${r}"`:""}></n-img>`,e.use({langToolbar:["copy"],headerPrefix:"# ",breaks:!0,pedantic:!1,smartLists:!0,smartypants:!0,xhtml:!0,renderer:t})}return e.parse(t)}
|
|
1
|
+
import e from"marked-completed";let r=!0;export default function(t){if(r){let t;r=!1,(t=new e.Renderer).code=(e,r)=>"treeview"===r?`<n-tree data="${e}" />`:`<n-code class="n-code" toolbar="${JSON.stringify(["copy"])}" language="${r}" line-number="true">${encodeURIComponent(e)}</n-code>`,t.image=(e,r,t)=>`<n-img lazy="true" role="img" src="${e}" alt="${t}" ${r?`title="${r}"`:""}></n-img>`,e.use({langToolbar:["copy"],headerPrefix:"# ",breaks:!0,pedantic:!1,smartLists:!0,smartypants:!0,xhtml:!0,renderer:t})}return e.parse(t)};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare const reslove: {
|
|
2
|
+
readonly sassLoader: string;
|
|
3
|
+
readonly lessLoader: string;
|
|
4
|
+
readonly swcLoader: string;
|
|
5
|
+
readonly transformImports: string;
|
|
6
|
+
readonly rawImport: string;
|
|
7
|
+
// jsxDomExpressions: hasPkg('@moneko/jsx-dom-expressions'),
|
|
8
|
+
readonly hotMiddlewareClient: string;
|
|
9
|
+
};
|
|
10
|
+
export default reslove;
|
|
@@ -6,5 +6,5 @@ export type SwcOption = SwcConfig & {
|
|
|
6
6
|
parseMap?: boolean;
|
|
7
7
|
sync?: boolean;
|
|
8
8
|
};
|
|
9
|
-
declare const
|
|
10
|
-
export default
|
|
9
|
+
declare const _default_1: (ssr: boolean, other?: SwcConfig) => SwcConfig;
|
|
10
|
+
export default _default_1;
|
|
@@ -11,12 +11,9 @@ import { type Compiler } from 'webpack';
|
|
|
11
11
|
* }
|
|
12
12
|
* }
|
|
13
13
|
* ```
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
files?: string[];
|
|
18
|
-
/** 需要拷贝的文件夹 */
|
|
19
|
-
dirs?: string[];
|
|
14
|
+
*/ export interface CopyPluginOption {
|
|
15
|
+
/** 需要拷贝的文件列表 */ files?: string[];
|
|
16
|
+
/** 需要拷贝的文件夹 */ dirs?: string[];
|
|
20
17
|
}
|
|
21
18
|
export declare class CopyPlugin {
|
|
22
19
|
private readonly baseFiles;
|
|
@@ -4,44 +4,35 @@ export interface HtmlMeta {
|
|
|
4
4
|
}
|
|
5
5
|
export interface HtmlPluginOption {
|
|
6
6
|
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
publicPath?: string;
|
|
7
|
+
* 公共路径, 默认使用 主配置的 publicPath
|
|
8
|
+
*/ publicPath?: string;
|
|
10
9
|
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
favicon?: string | false;
|
|
10
|
+
* 网站图标
|
|
11
|
+
*/ favicon?: string | false;
|
|
14
12
|
/**
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
title?: string;
|
|
13
|
+
* 页面标题
|
|
14
|
+
*/ title?: string;
|
|
18
15
|
/**
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
template?: string;
|
|
16
|
+
* 模板文件
|
|
17
|
+
*/ template?: string;
|
|
22
18
|
/**
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
filename?: string | ((entryName: string) => string);
|
|
19
|
+
* 输出文件名
|
|
20
|
+
* @default index.html
|
|
21
|
+
*/ filename?: string | ((entryName: string) => string);
|
|
27
22
|
/**
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
inject?: boolean | 'head' | 'body';
|
|
23
|
+
* 注入位置
|
|
24
|
+
* @default head
|
|
25
|
+
*/ inject?: boolean | 'head' | 'body';
|
|
32
26
|
templateContent?: (options: HtmlPluginOption) => string;
|
|
33
27
|
/**
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
tags?: {
|
|
28
|
+
* 自定义额外的 tags, 当需要添加远程cdn时很有用
|
|
29
|
+
* */ tags?: {
|
|
37
30
|
/**
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
textContent?: string;
|
|
31
|
+
* 标签内容
|
|
32
|
+
*/ textContent?: string;
|
|
41
33
|
/** 标签
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
tag?: string;
|
|
34
|
+
* @default script
|
|
35
|
+
*/ tag?: string;
|
|
45
36
|
inject?: 'body' | 'head';
|
|
46
37
|
[key: string]: string | null | boolean | number | undefined;
|
|
47
38
|
}[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as t,readFileSync as s}from"node:fs";import{basename as e,join as
|
|
1
|
+
import{existsSync as t,readFileSync as s}from"node:fs";import{basename as e,join as i,resolve as o}from"node:path";import n from"webpack";import{isDev as r,packageJson as a}from"../../process-env.mjs";export*from"./types.mjs";export class ManifestPlugin{constructor(t){this.name="ManifestPlugin",this.options={filename:"site.webmanifest",name:a.name,description:a.description,scope:"/",display:"standalone",background_color:"#fff",icons:[{src:"https://h5static.dewucdn.com/node-common/718d5e10-576d-8b14-b0b1-e4c58c3b3f40.webp",type:"image/webp",sizes:"512x512"}]},this.options={...this.options,...t}}getPublicPath(t){if(this.options.publicPath)return this.options.publicPath;let s=t.getAssetPath(t.outputOptions.publicPath,{hash:t.hash}),e="auto"===s?"/":s;return e.length&&!e.endsWith("/")&&(e+="/"),e}addAsset(r,a,p){if(!p)return;let c=this.getPublicPath(a);return p.map(p=>{let h={...p};if(h.src&&!h.src.startsWith("http")){let p=o(r.context,h.src);if(t(p)){let t=e(h.src),o=s(p);a.emitAsset(t,new n.sources.RawSource(o),{javascriptModule:!1}),h.src=i(c,t)}else a.warnings.push(new n.WebpackError(`Asset file ${p} does not exist`))}return h})}apply(t){let s=this.name,{filename:e,start_url:i,icons:o,screenshots:p,...c}=this.options;t.hooks.compilation.tap(s,h=>{h.hooks.processAssets.tap({name:s,stage:n.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL},()=>{let s={...c,start_url:i??this.getPublicPath(h),screenshots:this.addAsset(t,h,p),icons:this.addAsset(t,h,o),version:`${a.version}(${r?"Dev":h.fullHash})`};h.emitAsset(e,new t.webpack.sources.RawSource(JSON.stringify(s)),{javascriptModule:!1})})})}}
|
|
@@ -8,6 +8,6 @@ export declare class ManifestPlugin {
|
|
|
8
8
|
getPublicPath(compilation: Compilation): string;
|
|
9
9
|
addAsset<T extends {
|
|
10
10
|
src: string;
|
|
11
|
-
}>(compiler: Compiler, compilation: Compilation, assets?: T[]): T[] |
|
|
11
|
+
}>(compiler: Compiler, compilation: Compilation, assets?: T[]): T[] | void;
|
|
12
12
|
apply(compiler: Compiler): void;
|
|
13
13
|
}
|