@moneko/core 3.56.14-beta.1 → 3.56.14-beta.2
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/utils/index.d.mts +9 -0
- 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 s,{config_files as
|
|
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";let C=f.mode??(y?"development":"production");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:!y,publicPath:f.publicPath,workerPublicPath:f.publicPath,asyncChunks:!0,charset:!0,iife:!0,crossOriginLoading:"use-credentials",enabledWasmLoadingTypes:["fetch"],uniqueName:`${d.projectName}`};let x={main:[p("@app/entry")]},k=[t(a.corePath,"./polyfills/public-path.mjs")];if(y&&f.refresh&&f.env.injectRemoteReactRefresh&&k.push(t(a.corePath,"./polyfills/inject-react-refresh.mjs")),f.polyfill&&k.push(t(a.corePath,"./polyfills/replace-children.mjs")),f.entry&&("string"==typeof f.entry?x={...x,main:[f.entry]}:Object.keys(f.entry)&&(x=Object.assign(x,f.entry))),"string"==typeof x.main?x.main=[...k,x.main]:Array.isArray(x.main)&&(x.main=[...k,...x.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 M={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:a.webpackCachePath,memoryCacheUnaffected:!0,name:`.${await m([s[2],n,v].join("-"),"SHA-256")}`,version:`${P.version}`,buildDependencies:{config:i},maxMemoryGenerations:1};!1===f.cache?M=!1:c(f.cache)&&(M=Object.assign(M,f.cache)),g&&(void 0===f.cache||f.cache&&!f.cache.cacheDirectory)&&(M.cacheDirectory=o(r,P.name));let w={},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?c(f.lazyCompilation)?Object.assign(w,O,f.lazyCompilation):Object.assign(w,O):w=!1;export const commonConfig={name:"client",target:"web",devtool:f.devtool,entry:x,mode:C,stats:"errors-only",cache:M,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:!0,lazyCompilation:w,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/utils/index.d.mts
CHANGED
|
@@ -32,4 +32,13 @@ type AnyFunction = (...a: any[]) => any;
|
|
|
32
32
|
export declare function isFunction<T>(target: T): target is T & AnyFunction;
|
|
33
33
|
export declare function transformModule(obj: object | string): string;
|
|
34
34
|
export declare function empty(): void;
|
|
35
|
+
export type AlgorithmIdentifier = 'SHA-1' | 'SHA-256' | 'SHA-384' | 'SHA-512';
|
|
36
|
+
/**
|
|
37
|
+
* 为内容生成摘要
|
|
38
|
+
* @since 1.8.0
|
|
39
|
+
* @param {String | Uint8Array} message 内容字符串
|
|
40
|
+
* @param {AlgorithmIdentifier} algorithm 摘要算法
|
|
41
|
+
* @returns {Promise<String>} 摘要字符串
|
|
42
|
+
*/
|
|
43
|
+
export declare function digest(message: string, algorithm: AlgorithmIdentifier): Promise<string>;
|
|
35
44
|
export {};
|
package/lib/utils/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolve as
|
|
1
|
+
import{resolve as t}from"node:path";import e 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(o){return t(e.programPath,`./${o}`)}export function node_modules(o){return t(e.nodeModules,`./${o}`)}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(t,e){let o=new TextEncoder().encode(t);return Array.from(new Uint8Array(await crypto.subtle.digest(e,o))).map(t=>t.toString(16).padStart(2,"0")).join("")}
|