@moneko/core 3.56.16 → 3.56.18

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/common.mjs CHANGED
@@ -1 +1 @@
1
- import{extname as e,join as t,resolve as o}from"node:path";import{argv as s}from"node:process";import a,{config_files as i,CUSTOMCONFIG as n,TMP_DIR as r}from"./commom/paths.mjs";import{OverrideResolverPlugin as l}from"./plugin/override-resolve.mjs";import{digest as m,isObject as c,node_modules as p,resolveProgram as u}from"./utils/index.mjs";import{exampleModuleName as h}from"./vm/example.mjs";import d from"./vm/info.mjs";import{CONFIG as f}from"./config.mjs";import b from"./plugins.config.mjs";import{isCI as g,isDev as y,isLibrary as j,NODE_ENV as v,packageJson as P}from"./process-env.mjs";export const outputConfig={path:u(j?"docs":"dist"),filename:"js/[name].[contenthash].bundle.js",chunkFilename:"js/[contenthash].chunk.js",assetModuleFilename:t=>{let o=e(t.filename||"").substring(1);return`assets/${o}/[hash][ext]`},library:{name:`${d.projectName}`,type:"umd",umdNamedDefine:!0},globalObject:"self",chunkLoadingGlobal:`webpackJsonp_${P.name}`,pathinfo:y,clean:!0,publicPath:f.publicPath,workerPublicPath:f.publicPath,asyncChunks:!0,charset:!0,iife:!0,crossOriginLoading:"use-credentials",enabledWasmLoadingTypes:["fetch"],uniqueName:`${d.projectName}`};let C={main:[p("@app/entry")]},x=[t(a.corePath,"./polyfills/public-path.mjs")];if(y&&f.refresh&&f.env.injectRemoteReactRefresh&&x.push(t(a.corePath,"./polyfills/inject-react-refresh.mjs")),f.polyfill&&x.push(t(a.corePath,"./polyfills/replace-children.mjs")),f.entry&&("string"==typeof f.entry?C={...C,main:[f.entry]}:Object.keys(f.entry)&&(C=Object.assign(C,f.entry))),"string"==typeof C.main?C.main=[...x,C.main]:Array.isArray(C.main)&&(C.main=[...x,...C.main]),f.output){if("string"==typeof f.output)outputConfig.path=f.output;else if(Object.keys(f.output)){let e=f.output,t={...outputConfig.library};Object.assign(outputConfig,e),"object"==typeof f.output&&e.library&&(outputConfig.library=Object.assign(t,e.library))}}let k={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:a.webpackCachePath,memoryCacheUnaffected:!y,name:await m([s[2],n,v].join("-"),"SHA-256"),version:`${P.version}`,buildDependencies:{config:i},maxMemoryGenerations:1};!1===f.cache?k=!1:c(f.cache)&&(k=Object.assign(k,f.cache)),g&&(void 0===f.cache||f.cache&&!f.cache.cacheDirectory)&&(k.cacheDirectory=o(r,P.name));let M={},w={imports:!0,entries:!0,test:e=>{let t=e.nameForCondition();return!!(t&&(t.startsWith(p(h))||t.startsWith(p("@app/comment"))||t.startsWith(a.pagesPath)||t.startsWith(a.componentsPath)))}};f.lazyCompilation&&y&&"true"!==process.env.IS_BUILD?c(f.lazyCompilation)?Object.assign(M,w,f.lazyCompilation):Object.assign(M,w):M=!1;export const commonConfig={name:"client",target:"web",devtool:f.devtool,entry:C,mode:f.mode??"production",stats:"errors-only",cache:k,snapshot:{immutablePaths:[a.pnpmNodeModules,a.denoNodeModules,/node_modules\/(?!(@app)\/)/],managedPaths:[a.pnpmNodeModules,a.denoNodeModules,/node_modules\/(?!(@app)\/)/],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}},infrastructureLogging:{level:"error"},externalsPresets:f.externalsPresets,plugins:b,node:{global:!1,__filename:!1,__dirname:!1},experiments:{asyncWebAssembly:!0,cacheUnaffected:!y,lazyCompilation:M,buildHttp:c(f.buildHttp)?{allowedUris:[],lockfileLocation:o(a.httpCachePath,"http.lock"),cacheLocation:o(a.httpCachePath,"data"),upgrade:!0,...f.buildHttp}:f.buildHttp,backCompat:!0,futureDefaults:!0,css:!1,outputModule:!1},resolve:{extensions:[".mts",".mjs",".ts",".tsx",".js",".jsx",".json",".wasm"],alias:f.alias,modules:[a.nodeModules,a.pnpmNodeModules,a.denoNodeModules],mainFields:["browser","module","main"],mainFiles:["index"],plugins:f.resolvePlugins,preferAbsolute:!0,cache:!0,fallback:{}},externals:f.externals,output:outputConfig,recordsPath:f.recordsPath?t(a.programPath,f.recordsPath):t(a.webpackCachePath,"records.json")};f.overrideResolve&&commonConfig.resolve.plugins.push(new l(Object.assign({original:f.alias["@"],override:n&&u(n)},f.overrideResolve)));
1
+ import{extname as e,join as t,resolve as o}from"node:path";import{argv as s}from"node:process";import a,{config_files as i,CUSTOMCONFIG as n,TMP_DIR as r}from"./commom/paths.mjs";import{OverrideResolverPlugin as l}from"./plugin/override-resolve.mjs";import{digest as m,isObject as c,node_modules as p,resolveProgram as u}from"./utils/index.mjs";import{exampleModuleName as h}from"./vm/example.mjs";import d from"./vm/info.mjs";import{CONFIG as f}from"./config.mjs";import b from"./plugins.config.mjs";import{isCI as g,isDev as y,isLibrary as j,NODE_ENV as v,packageJson as P}from"./process-env.mjs";export const outputConfig={path:u(j?"docs":"dist"),filename:"js/[name].[contenthash].bundle.js",chunkFilename:"js/[contenthash].chunk.js",assetModuleFilename:t=>{let o=e(t.filename||"").substring(1);return`assets/${o}/[hash][ext]`},library:{name:`${d.projectName}`,type:"umd",umdNamedDefine:!0},globalObject:"self",chunkLoadingGlobal:`webpackJsonp_${P.name}`,pathinfo:y,clean:!0,publicPath:f.publicPath,workerPublicPath:f.publicPath,asyncChunks:!0,charset:!0,iife:!0,crossOriginLoading:"use-credentials",enabledWasmLoadingTypes:["fetch"],uniqueName:`${d.projectName}`};let C={main:[p("@app/entry")]},x=[t(a.corePath,"./polyfills/public-path.mjs")];if(y&&f.refresh&&f.env.injectRemoteReactRefresh&&x.push(t(a.corePath,"./polyfills/inject-react-refresh.mjs")),f.polyfill&&x.push(t(a.corePath,"./polyfills/replace-children.mjs")),f.entry&&("string"==typeof f.entry?C={...C,main:[f.entry]}:Object.keys(f.entry)&&(C=Object.assign(C,f.entry))),"string"==typeof C.main?C.main=[...x,C.main]:Array.isArray(C.main)&&(C.main=[...x,...C.main]),f.output){if("string"==typeof f.output)outputConfig.path=f.output;else if(Object.keys(f.output)){let e=f.output,t={...outputConfig.library};Object.assign(outputConfig,e),"object"==typeof f.output&&e.library&&(outputConfig.library=Object.assign(t,e.library))}}let k={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:a.webpackCachePath,memoryCacheUnaffected:!y,name:await m([n,v].join("-"),s[2]),version:`${P.version}`,buildDependencies:{config:i},maxMemoryGenerations:1};!1===f.cache?k=!1:c(f.cache)&&(k=Object.assign(k,f.cache)),g&&(void 0===f.cache||f.cache&&!f.cache.cacheDirectory)&&(k.cacheDirectory=o(r,P.name));let M={},w={imports:!0,entries:!0,test:e=>{let t=e.nameForCondition();return!!(t&&(t.startsWith(p(h))||t.startsWith(p("@app/comment"))||t.startsWith(a.pagesPath)||t.startsWith(a.componentsPath)))}};f.lazyCompilation&&y&&"true"!==process.env.IS_BUILD?c(f.lazyCompilation)?Object.assign(M,w,f.lazyCompilation):Object.assign(M,w):M=!1;export const commonConfig={name:"client",target:"web",devtool:f.devtool,entry:C,mode:f.mode??"production",stats:"errors-only",cache:k,snapshot:{immutablePaths:[a.pnpmNodeModules,a.denoNodeModules,/node_modules\/(?!(@app)\/)/],managedPaths:[a.pnpmNodeModules,a.denoNodeModules,/node_modules\/(?!(@app)\/)/],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}},infrastructureLogging:{level:"error"},externalsPresets:f.externalsPresets,plugins:b,node:{global:!1,__filename:!1,__dirname:!1},experiments:{asyncWebAssembly:!0,cacheUnaffected:!y,lazyCompilation:M,buildHttp:c(f.buildHttp)?{allowedUris:[],lockfileLocation:o(a.httpCachePath,"http.lock"),cacheLocation:o(a.httpCachePath,"data"),upgrade:!0,...f.buildHttp}:f.buildHttp,backCompat:!0,futureDefaults:!0,css:!1,outputModule:!1},resolve:{extensions:[".mts",".mjs",".ts",".tsx",".js",".jsx",".json",".wasm"],alias:f.alias,modules:[a.nodeModules,a.pnpmNodeModules,a.denoNodeModules],mainFields:["browser","module","main"],mainFiles:["index"],plugins:f.resolvePlugins,preferAbsolute:!0,cache:!0,fallback:{}},externals:f.externals,output:outputConfig,recordsPath:f.recordsPath?t(a.programPath,f.recordsPath):t(a.webpackCachePath,"records.json")};f.overrideResolve&&commonConfig.resolve.plugins.push(new l(Object.assign({original:f.alias["@"],override:n&&u(n)},f.overrideResolve)));
package/lib/dev/proxy.mjs CHANGED
@@ -1 +1 @@
1
- import{request as e}from"node:http";import{request as t}from"node:https";import{URL as r}from"node:url";import o from"../commom/log.mjs";import{containMockUrl as p}from"./mock.mjs";export async function setupProxy(n,i,a){if(i.writableEnded)return i;let s=n.url,h=Object.keys(a).find(e=>new RegExp(e).test(s));if(!h)return!1;let m="string"==typeof a[h]?{target:a[h],pathRewrite:void 0,changeOrigin:!0,secure:!0,ws:!1}:a[h],d=new r(m.target),l=s;if(m.pathRewrite&&"object"==typeof m.pathRewrite)for(let e in m.pathRewrite)Object.prototype.hasOwnProperty.call(m.pathRewrite,e)&&(l=s.replace(new RegExp(e),m.pathRewrite[e]));let w="https:"===d.protocol,c={method:n.method,hostname:d.hostname,port:d.port||(w?443:80),path:l,headers:{...n.headers},protocol:d.protocol};m.changeOrigin&&(c.headers.host=d.host);let f=w?t:e;return new Promise(e=>{let t=f(c,t=>{let o=t.statusCode||404,a=o>=400,s=!!p(`${n.method||"GET"} ${new r(`${d.origin}${n.url}`).pathname}`);if(i.writeHead(o,t.headers),a&&s)return e(!1);t.pipe(i),e(i)});t.on("error",t=>(o(t),i.headersSent?i.end():(i.writeHead(502,{"Content-Type":"text/plain"}),i.end(`Proxy Error: ${t.message}`)),e(!1))),n.pipe(t)})}
1
+ import{request as e}from"node:http";import{request as t}from"node:https";import{URL as r}from"node:url";import o from"../commom/log.mjs";import{containMockUrl as p}from"./mock.mjs";export async function setupProxy(n,i,a){if(i.writableEnded)return i;let s=n.url,h=Object.keys(a).find(e=>new RegExp(e).test(s));if(!h)return!1;let m="string"==typeof a[h]?{target:a[h],pathRewrite:void 0,changeOrigin:!0,secure:!0,ws:!1}:a[h],d=new r(m.target),l=s;if(m.pathRewrite&&"object"==typeof m.pathRewrite)for(let e in m.pathRewrite)Object.prototype.hasOwnProperty.call(m.pathRewrite,e)&&(l=s.replace(new RegExp(e),m.pathRewrite[e]));let w="https:"===d.protocol,c={method:n.method,hostname:d.hostname,port:d.port||(w?443:80),path:l,headers:{...n.headers},protocol:d.protocol};m.changeOrigin&&(c.headers.host=d.host);let f=w?t:e;return new Promise(e=>{let t=f(c,t=>{let o=t.statusCode||404,a=o>=400,s=!!p(`${n.method||"GET"} ${new r(`${d.origin}${n.url}`).pathname}`);if(a&&s)return e(!1);i.writeHead(o,t.headers),t.pipe(i),e(i)});t.on("error",t=>(o(t),i.headersSent?i.end():(i.writeHead(502,{"Content-Type":"text/plain"}),i.end(`Proxy Error: ${t.message}`)),e(!1))),n.pipe(t)})}
@@ -1,3 +1,4 @@
1
+ import { type BinaryLike } from 'node:crypto';
1
2
  /**
2
3
  * 将字符串转换为小驼峰命名
3
4
  * @param {string} str 需要转换的字符串
@@ -35,10 +36,9 @@ export declare function empty(): void;
35
36
  export type AlgorithmIdentifier = 'SHA-1' | 'SHA-256' | 'SHA-384' | 'SHA-512';
36
37
  /**
37
38
  * 为内容生成摘要
38
- * @since 1.8.0
39
- * @param {String | Uint8Array} message 内容字符串
40
- * @param {AlgorithmIdentifier} algorithm 摘要算法
39
+ * @param {String | Uint8Array} data 内容
40
+ * @param {AlgorithmIdentifier} secret 密钥
41
41
  * @returns {Promise<String>} 摘要字符串
42
42
  */
43
- export declare function digest(message: string, algorithm: AlgorithmIdentifier): Promise<string>;
43
+ export declare function digest(data: BinaryLike, secret: string): Promise<string>;
44
44
  export {};
@@ -1 +1 @@
1
- import t from"node:crypto";import{resolve as e}from"node:path";import o from"../commom/paths.mjs";export function toCamelCase(t){return t.replace(/-./g,t=>t.charAt(1).toUpperCase())}export function convertToCamelCase(t){return t.toLowerCase().replace(/-(\w)/g,(t,e)=>e?e.toUpperCase():"").replace(/^./,t=>t.toUpperCase()).replace(/Ui$/,"UI")}export function resolveProgram(t){return e(o.programPath,`./${t}`)}export function node_modules(t){return e(o.nodeModules,`./${t}`)}export function isObject(t){let e=typeof t;return null!==t&&("object"===e||"function"===e)}export function isFunction(t){return["[object Function]","[object AsyncFunction]","[object GeneratorFunction]"].includes(Object.prototype.toString.call(t))}export function transformModule(t){let e="";if("string"==typeof t)e=t;else for(let[o,r]of Object.entries(t))e+=`export const ${o} = ${isFunction(r)?r:JSON.stringify(r)};`;return e}export function empty(){}export async function digest(e,o){let r=new TextEncoder().encode(e);return Array.from(new Uint8Array(await t.subtle.digest(o,r))).map(t=>t.toString(16).padStart(2,"0")).join("")}
1
+ import{createHmac as e}from"node:crypto";import{resolve as t}from"node:path";import o from"../commom/paths.mjs";export function toCamelCase(e){return e.replace(/-./g,e=>e.charAt(1).toUpperCase())}export function convertToCamelCase(e){return e.toLowerCase().replace(/-(\w)/g,(e,t)=>t?t.toUpperCase():"").replace(/^./,e=>e.toUpperCase()).replace(/Ui$/,"UI")}export function resolveProgram(e){return t(o.programPath,`./${e}`)}export function node_modules(e){return t(o.nodeModules,`./${e}`)}export function isObject(e){let t=typeof e;return null!==e&&("object"===t||"function"===t)}export function isFunction(e){return["[object Function]","[object AsyncFunction]","[object GeneratorFunction]"].includes(Object.prototype.toString.call(e))}export function transformModule(e){let t="";if("string"==typeof e)t=e;else for(let[o,r]of Object.entries(e))t+=`export const ${o} = ${isFunction(r)?r:JSON.stringify(r)};`;return t}export function empty(){}export async function digest(t,o){return e("sha256",o).update(t).digest("hex")}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.56.16",
3
+ "version": "3.56.18",
4
4
  "description": "core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",