@moneko/core 3.8.1 → 3.8.3-beta.0

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.js CHANGED
@@ -1 +1 @@
1
- import e from"add-asset-html-webpack-plugin";import t from"html-webpack-plugin";import o from"webpack";import r from"webpackbar";import{CONFIG as l,PUBLICPATH as s}from"./config.js";import n from"./html-plugin-option.js";import{moduleFederation as a}from"./module-federation.js";import i from"./module.config.js";import p,{CUSTOMCONFIG as m}from"./paths.js";import c from"./plugin/add-entry-attribute.js";import u from"./plugin/override-resolve.js";import f from"./plugin/virtual-module.js";import{PACKAGENAME as h,PACKAGEVERSION as d,isDev as b,isLibrary as g,isMicro as y}from"./process-env.js";import{resolveNodeModulesPath as j,resolveProgramPath as w}from"./utils.js";import v from"./virtual-modules.js";let{AutomaticPrefetchPlugin:k,DefinePlugin:x,SourceMapDevToolPlugin:C,WatchIgnorePlugin:$}=o,O=l.assetHtml.map(e=>({publicPath:"",...e}));export const outputConfig={path:w(g?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:`js/[${b?"name":"chunkhash"}].js`,assetModuleFilename:e=>{let t=e.filename;return t&&t.endsWith("?url")&&/(?:webworker|worker)(\.|\b).*\.(js|ts)\b/.test(t.replace("?url",""))?"worker/[name][ext]":"assets/[name][hash][ext]"},library:{name:h,type:"window"},globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${h}`,pathinfo:b,clean:!0,publicPath:s,asyncChunks:!0,charset:!0};let P={main:j("@app/entry")};l.polyfill&&Object.assign(P,{"dom-polyfills":[`${p.corePath}/polyfills/replace-children.js`]}),l.entry&&("string"==typeof l.entry?P={main:l.entry}:Object.keys(l.entry)&&Object.assign(P,l.entry)),l.output&&("string"==typeof l.output?outputConfig.path=l.output:Object.keys(l.output)&&Object.assign(outputConfig,l.output));let M=l.basename.split("/").filter(Boolean).length,B=`${Array(M).fill("..").join("/")+(M?"/":"")}404.html`,{pathSegmentsToKeep:D=M,path:R=B}=l.fixBrowserRouter||{},A=!1;l.cacheDirectory&&(A={type:"filesystem",store:"pack",allowCollectingMemory:!0,cacheDirectory:l.cacheDirectory,memoryCacheUnaffected:!0,name:`${m||"default"}-${b?"development":"production"}`,version:d});export const clientConfig={entry:P,stats:"errors-only",cache:A,infrastructureLogging:{level:"error"},target:"web",externalsPresets:l.externalsPresets,plugins:[new f(v),new k,...a,l.htmlPluginOption&&new t(n),l.fixBrowserRouter&&new t({filename:R,inject:!1,templateContent:()=>`<html lang="en"><head><title>${n.title}</title><script>const pathKeep = ${D||M};const l = window.location;l.replace(l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') + l.pathname.split('/').slice(0, 1 + pathKeep).join('/') + '/?/' + l.pathname.slice(1).split('/').slice(pathKeep).join('/').replace(/&/g, '~and~') + (l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') + l.hash);</script></head><body></body></html>`}),new e(O),y&&new c(e=>!!(e.match(/main\.(.*)\.bundle.js$/)||e.match("main.bundle.js"))),new x({"process.env":JSON.stringify(l.env)}),new $({paths:[/\.d\.ts$/]}),l.sourceMap&&new C(l.sourceMap),l.bar&&new r(l.bar),...l.plugins].filter(e=>!!e),experiments:{topLevelAwait:!0,asyncWebAssembly:!0,cacheUnaffected:!0,layers:!0,lazyCompilation:b&&{imports:!1,entries:!1},buildHttp:l.buildHttp,backCompat:!0,futureDefaults:!1,css:!1,outputModule:!1},resolve:{extensions:[".tsx",".ts",".js",".jsx"],alias:l.alias,plugins:[l.overrideResolve&&new u({original:l.alias["@"],override:m&&w(m),...l.overrideResolve}),...l.resolvePlugins].filter(Boolean),fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},module:i,externals:l.externals,output:outputConfig};
1
+ import e from"add-asset-html-webpack-plugin";import t from"html-webpack-plugin";import o from"webpack";import r from"webpackbar";import{CONFIG as l,PUBLICPATH as s}from"./config.js";import n from"./html-plugin-option.js";import{moduleFederation as a}from"./module-federation.js";import i from"./module.config.js";import p,{CUSTOMCONFIG as c}from"./paths.js";import m from"./plugin/add-entry-attribute.js";import u from"./plugin/override-resolve.js";import f from"./plugin/virtual-module.js";import{PACKAGENAME as h,PACKAGEVERSION as d,isDev as b,isLibrary as g,isMicro as y}from"./process-env.js";import{resolveNodeModulesPath as j,resolveProgramPath as w}from"./utils.js";import v from"./virtual-modules.js";let{AutomaticPrefetchPlugin:k,DefinePlugin:x,SourceMapDevToolPlugin:C,WatchIgnorePlugin:O}=o,$=l.assetHtml.map(e=>({publicPath:"",...e}));export const outputConfig={path:w(g?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:`js/[${b?"name":"chunkhash"}].js`,assetModuleFilename:e=>{let t=e.filename;return t&&t.endsWith("?url")&&/(?:webworker|worker)(\.|\b).*\.(js|ts)\b/.test(t.replace("?url",""))?"worker/[name][ext]":"assets/[name][hash][ext]"},library:{name:h,type:"window"},globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${h}`,pathinfo:b,clean:!0,publicPath:s,asyncChunks:!0,charset:!0};let P={main:j("@app/entry")};l.polyfill&&Object.assign(P,{"dom-polyfills":[`${p.corePath}/polyfills/replace-children.js`]}),l.entry&&("string"==typeof l.entry?P={main:l.entry}:Object.keys(l.entry)&&Object.assign(P,l.entry)),l.output&&("string"==typeof l.output?outputConfig.path=l.output:Object.keys(l.output)&&Object.assign(outputConfig,l.output));let B=l.basename.split("/").filter(Boolean).length,D=`${Array(B).fill("..").join("/")+(B?"/":"")}404.html`,{pathSegmentsToKeep:M=B,path:R=D}=l.fixBrowserRouter||{},A=!1;l.cacheDirectory&&(A={type:"filesystem",store:"pack",allowCollectingMemory:!0,cacheDirectory:l.cacheDirectory,memoryCacheUnaffected:!0,name:[c,process.env.NODE_ENV].filter(Boolean).join("-"),version:d});let H=Object.assign({original:l.alias["@"],override:c&&w(c)},l.overrideResolve);export const clientConfig={entry:P,stats:"errors-only",cache:A,infrastructureLogging:{level:"error"},target:"web",externalsPresets:l.externalsPresets,plugins:[new f(v),new k,...a,l.htmlPluginOption&&new t(n),l.fixBrowserRouter&&new t({filename:R,inject:!1,templateContent:()=>`<html lang="en"><head><title>${n.title}</title><script>const pathKeep = ${M||B};const l = window.location;l.replace(l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') + l.pathname.split('/').slice(0, 1 + pathKeep).join('/') + '/?/' + l.pathname.slice(1).split('/').slice(pathKeep).join('/').replace(/&/g, '~and~') + (l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') + l.hash);</script></head><body></body></html>`}),new e($),y&&new m(e=>!!(e.match(/main\.(.*)\.bundle.js$/)||e.match("main.bundle.js"))),new x({"process.env":JSON.stringify(l.env)}),new O({paths:[/\.d\.ts$/]}),l.sourceMap&&new C(l.sourceMap),l.bar&&new r(l.bar),...l.plugins].filter(e=>!!e),experiments:{topLevelAwait:!0,asyncWebAssembly:!0,cacheUnaffected:!0,layers:!0,lazyCompilation:b&&{imports:!1,entries:!1},buildHttp:l.buildHttp,backCompat:!0,futureDefaults:!1,css:!1,outputModule:!1},resolve:{extensions:[".tsx",".ts",".js",".jsx"],alias:l.alias,plugins:[l.overrideResolve&&new u(H),...l.resolvePlugins].filter(Boolean),fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},module:i,externals:l.externals,output:outputConfig};
package/lib/index.d.ts CHANGED
@@ -2,4 +2,5 @@ export { default as paths, CUSTOMCONFIG } from './paths.js';
2
2
  export { FRAMEWORKNAME, PACKAGENAME, PACKAGEVERSION, coreName, isDev, isLibrary, isMicro, mainDirectory, } from './process-env.js';
3
3
  export { realResolve, resolveNodeModulesPath, resolveProgramPath, log } from './utils.js';
4
4
  export { getIPv4, getPort } from './net.js';
5
+ export { default as osTmpDir } from './os-tmp-dir.js';
5
6
  export type * from '../typings/global.d.ts';
package/lib/index.js CHANGED
@@ -1 +1 @@
1
- export{default as paths,CUSTOMCONFIG}from"./paths.js";export{FRAMEWORKNAME,PACKAGENAME,PACKAGEVERSION,coreName,isDev,isLibrary,isMicro,mainDirectory}from"./process-env.js";export{realResolve,resolveNodeModulesPath,resolveProgramPath,log}from"./utils.js";export{getIPv4,getPort}from"./net.js";
1
+ export{default as paths,CUSTOMCONFIG}from"./paths.js";export{FRAMEWORKNAME,PACKAGENAME,PACKAGEVERSION,coreName,isDev,isLibrary,isMicro,mainDirectory}from"./process-env.js";export{realResolve,resolveNodeModulesPath,resolveProgramPath,log}from"./utils.js";export{getIPv4,getPort}from"./net.js";export{default as osTmpDir}from"./os-tmp-dir.js";
@@ -0,0 +1,5 @@
1
+ /** 获取系统临时缓存文件目录
2
+ * @returns {String} 系统临时缓存目录
3
+ */
4
+ declare function osTmpDir(): string;
5
+ export default osTmpDir;
@@ -0,0 +1 @@
1
+ let e="win32"===process.platform,s=e?/[^:]\\$/:/.\/$/;export default function(){let o;return o=e?process.env.TEMP||process.env.TMP||`${process.env.SystemRoot||process.env.windir}\\temp`:process.env.TMPDIR||process.env.TMP||process.env.TEMP||"/tmp",s.test(o)&&(o=o.slice(0,-1)),o}
@@ -1 +1 @@
1
- export default class{constructor(t){this.entryMatchCallback=t}apply(t){t.hooks.compilation.tap("AddEntryAttributeWebpackPlugin",a=>{let e=t.options.plugins.map(({constructor:t})=>t).find(t=>t&&"HtmlWebpackPlugin"===t.name);if(e){let t=e.getHooks(a);t.alterAssetTagGroups.tap("AddEntryAttributeWebpackPlugin",t=>(t.headTags.forEach(t=>{"script"===t.tagName&&this.entryMatchCallback(t.attributes.src)&&(t.attributes.entry=!0)}),t))}})}}
1
+ import t from"html-webpack-plugin";export default class{constructor(t){this.entryMatchCallback=t}apply(a){a.hooks.compilation.tap("AddEntryAttributeWebpackPlugin",e=>{let r=a.options.plugins.find(a=>a instanceof t);if(r){let t=r.getHooks(e);t.alterAssetTagGroups.tap("AddEntryAttributeWebpackPlugin",t=>(t.headTags.forEach(t=>{"script"===t.tagName&&this.entryMatchCallback(t.attributes.src)&&(t.attributes.entry=!0)}),t))}})}}
@@ -1 +1 @@
1
- import{existsSync as e}from"fs";import{relative as t}from"path";import r from"../paths.js";export default class{constructor(e){this.options=e}apply(a){let{override:i,original:o}=this.options;if(i&&o){let s=`./${t(r.programPath,o)}`,l=`./${t(r.programPath,i)}`;a.getHook("file").tapAsync("OverrideResolverPlugin",(t,r,p)=>{let h=t.request||t.path;if(h&&h.startsWith(o)&&t.relativePath){let n=h.replace(o,i);if(e(n)){let e=t.relativePath.replace(s,l);return Object.assign(t,{path:n,relativePath:e,__innerRequest_relativePath:e,__innerRequest:e}),a.doResolve("resolved",t,`OverrideResolverPlugin 使用目标模块${i}`,r,p)}}return p()})}}}
1
+ import{existsSync as e}from"fs";import{relative as t}from"path";import r from"../paths.js";export default class{constructor(e){this.options=e}apply(i){let{override:a,original:s}=this.options;if(a&&s){let o=`./${t(r.programPath,s)}`,l=`./${t(r.programPath,a)}`;i.getHook("existing-file").tapAsync("OverrideResolverPlugin",(t,r,p)=>{let n=t.request||t.path;if(n&&n.startsWith(s)&&t.relativePath){let h=n.replace(s,a);if(e(h)){let e=t.relativePath.replace(o,l);return Object.assign(t,{path:h,relativePath:e,__innerRequest_relativePath:e,__innerRequest:e}),i.doResolve("resolved",t,`OverrideResolverPlugin 使用目标模块${a}`,r,p)}}return p()})}}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.8.1",
3
+ "version": "3.8.3-beta.0",
4
4
  "description": "core",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",
@@ -39,7 +39,7 @@
39
39
  "ts-import-plugin": "3.0.0",
40
40
  "ts-loader": "9.5.0",
41
41
  "typescript": "5.2.2",
42
- "webpack": "5.77.0",
42
+ "webpack": "5.89.0",
43
43
  "webpack-bundle-analyzer": "4.9.1",
44
44
  "webpack-cli": "5.1.4",
45
45
  "webpack-dev-server": "4.15.1",
@@ -299,7 +299,7 @@ export declare type ConfigType<T extends 'tsc' | 'swc' = 'swc'> = {
299
299
  }
300
300
  | false;
301
301
  /** 📦 打包完成 */
302
- done?: ConstructorParameters<typeof DoneWebpackPlugin>[0];
302
+ done?: ConstructorParameters<typeof DoneWebpackPlugin>[0]['done'];
303
303
  mdx?: MDXOptions;
304
304
  jsxDomExpressions?: {
305
305
  moduleName?: string;