@moneko/core 3.56.20 → 3.57.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/common.mjs +1 -1
- package/lib/index.d.mts +1 -1
- package/lib/index.mjs +1 -1
- package/lib/utils/index.d.mts +9 -2
- package/lib/utils/index.mjs +1 -1
- package/package.json +1 -1
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{
|
|
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{isObject as m,md5 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 g from"./plugins.config.mjs";import{isCI as b,isDev as y,isLibrary as j,NODE_ENV as v,packageJson as C}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_${C.name}`,pathinfo:y,clean:!0,publicPath:f.publicPath,asyncChunks:!0,charset:!0,iife:!0,crossOriginLoading:"use-credentials",enabledWasmLoadingTypes:["fetch"],uniqueName:`${d.projectName}`};let P={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?P={...P,main:[f.entry]}:Object.keys(f.entry)&&(P=Object.assign(P,f.entry))),"string"==typeof P.main?P.main=[...x,P.main]:Array.isArray(P.main)&&(P.main=[...x,...P.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:c(`${n}-${v}-${s[2]}`),version:`${C.version}`,buildDependencies:{config:i},maxMemoryGenerations:1};!1===f.cache?k=!1:m(f.cache)&&(k=Object.assign(k,f.cache)),b&&(void 0===f.cache||f.cache&&!f.cache.cacheDirectory)&&(k.cacheDirectory=o(r,C.name));let M={},O={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?m(f.lazyCompilation)?Object.assign(M,O,f.lazyCompilation):Object.assign(M,O):M=!1;export const commonConfig={name:"client",target:"web",devtool:f.devtool,entry:P,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:g,node:{global:!1,__filename:!1,__dirname:!1},experiments:{asyncWebAssembly:!0,cacheUnaffected:!y,lazyCompilation:M,buildHttp:m(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/index.d.mts
CHANGED
|
@@ -19,7 +19,7 @@ export type { HtmlMeta, HtmlPluginOption } from './plugin/html-plugin.mjs';
|
|
|
19
19
|
export type { OverrideResolverOption } from './plugin/override-resolve.mjs';
|
|
20
20
|
export type { VirtualModulePluginOption } from './plugin/virtual-module.mjs';
|
|
21
21
|
export { APPTYPE, coreName, FRAMEWORK, isCI, isDev, isLibrary, isMicro, mainDirectory, packageJson, PACKAGENAME, } from './process-env.mjs';
|
|
22
|
-
export { resolveProgram, toCamelCase } from './utils/index.mjs';
|
|
22
|
+
export { type AlgorithmIdentifier, digest, md5, node_modules, resolveProgram, toCamelCase, } from './utils/index.mjs';
|
|
23
23
|
export * from '@moneko/mdx';
|
|
24
24
|
export * from '@moneko/utils';
|
|
25
25
|
import webpack from 'webpack';
|
package/lib/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{default as hasPkg}from"./commom/has-pkg.mjs";export{getIPv4,getPort}from"./commom/net.mjs";export{default as open}from"./commom/open.mjs";export{default as parseArgs}from"./commom/parse-args.mjs";export{CUSTOMCONFIG,default as paths,routeDir,yarnArgv}from"./commom/paths.mjs";export{default as printLog}from"./commom/print-log.mjs";export{default as require}from"./commom/require.mjs";export{default as Rule}from"./commom/rule.mjs";export{default as timer}from"./commom/timer.mjs";export{yApiMock,yApiSchemaMock}from"./dev/mock.mjs";export{default as jsxDomExpressions}from"./options/jsx-dom-expressions.mjs";export{default as splitChunk}from"./options/split-chunk.mjs";export{APPTYPE,coreName,FRAMEWORK,isCI,isDev,isLibrary,isMicro,mainDirectory,packageJson,PACKAGENAME}from"./process-env.mjs";export{resolveProgram,toCamelCase}from"./utils/index.mjs";export*from"@moneko/mdx";export*from"@moneko/utils";import o from"webpack";export{o as webpack};
|
|
1
|
+
export{default as hasPkg}from"./commom/has-pkg.mjs";export{getIPv4,getPort}from"./commom/net.mjs";export{default as open}from"./commom/open.mjs";export{default as parseArgs}from"./commom/parse-args.mjs";export{CUSTOMCONFIG,default as paths,routeDir,yarnArgv}from"./commom/paths.mjs";export{default as printLog}from"./commom/print-log.mjs";export{default as require}from"./commom/require.mjs";export{default as Rule}from"./commom/rule.mjs";export{default as timer}from"./commom/timer.mjs";export{yApiMock,yApiSchemaMock}from"./dev/mock.mjs";export{default as jsxDomExpressions}from"./options/jsx-dom-expressions.mjs";export{default as splitChunk}from"./options/split-chunk.mjs";export{APPTYPE,coreName,FRAMEWORK,isCI,isDev,isLibrary,isMicro,mainDirectory,packageJson,PACKAGENAME}from"./process-env.mjs";export{digest,md5,node_modules,resolveProgram,toCamelCase}from"./utils/index.mjs";export*from"@moneko/mdx";export*from"@moneko/utils";import o from"webpack";export{o as webpack};
|
package/lib/utils/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type BinaryLike } from 'node:crypto';
|
|
1
|
+
import { type BinaryLike, type BinaryToTextEncoding } from 'node:crypto';
|
|
2
2
|
/**
|
|
3
3
|
* 将字符串转换为小驼峰命名
|
|
4
4
|
* @param {string} str 需要转换的字符串
|
|
@@ -40,5 +40,12 @@ export type AlgorithmIdentifier = 'SHA-1' | 'SHA-256' | 'SHA-384' | 'SHA-512';
|
|
|
40
40
|
* @param {AlgorithmIdentifier} secret 密钥
|
|
41
41
|
* @returns {Promise<String>} 摘要字符串
|
|
42
42
|
*/
|
|
43
|
-
export declare function digest(data: BinaryLike, secret: string):
|
|
43
|
+
export declare function digest(data: BinaryLike, secret: string, encoding?: BinaryToTextEncoding): string;
|
|
44
|
+
/**
|
|
45
|
+
* MD5 加密
|
|
46
|
+
* @param {BinaryLike} data - 要加密的字符串
|
|
47
|
+
* @param {BinaryToTextEncoding} encoding - 编码格式,默认 hex
|
|
48
|
+
* @returns {string} 加密后的字符串
|
|
49
|
+
*/
|
|
50
|
+
export declare function md5(data: BinaryLike, encoding?: BinaryToTextEncoding): string;
|
|
44
51
|
export {};
|
package/lib/utils/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createHmac as
|
|
1
|
+
import{createHash as e,createHmac as t}from"node:crypto";import{resolve as o}from"node:path";import r 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 o(r.programPath,`./${e}`)}export function node_modules(e){return o(r.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 function digest(e,o,r="hex"){return t("sha256",o).update(e).digest(r)}export function md5(t,o="hex"){return e("md5").update(t).digest(o)}
|