@moneko/core 3.9.9-beta.0 → 3.9.10

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{CONFIG as l,PUBLICPATH as r}from"./config.js";import s from"./html-plugin-option.js";import n from"./module-federation.js";import a from"./module.config.js";import i,{CUSTOMCONFIG as p}from"./paths.js";import c from"./plugin/add-entry-attribute.js";import m from"./plugin/override-resolve.js";import u from"./plugin/virtual-module.js";import{PACKAGENAME as f,PACKAGEVERSION as h,isDev as d,isLibrary as g,isMicro as y}from"./process-env.js";import{resolveNodeModulesPath as b,resolveProgramPath as j}from"./utils.js";let{AutomaticPrefetchPlugin:w,DefinePlugin:v,SourceMapDevToolPlugin:k,WatchIgnorePlugin:x}=o,C=l.assetHtml.map(e=>({publicPath:"",...e}));export const outputConfig={path:j(g?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:`js/[${d?"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:f,type:"window"},globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${f}`,pathinfo:d,clean:!0,publicPath:r,asyncChunks:!0,charset:!0};let O={main:b("@app/entry")};l.polyfill&&Object.assign(O,{"dom-polyfills":[`${i.corePath}/polyfills/replace-children.js`]}),l.entry&&("string"==typeof l.entry?O={main:l.entry}:Object.keys(l.entry)&&Object.assign(O,l.entry)),l.output&&("string"==typeof l.output?outputConfig.path=l.output:Object.keys(l.output)&&Object.assign(outputConfig,l.output));let $=l.basename.split("/").filter(Boolean).length,P=`${Array($).fill("..").join("/")+($?"/":"")}404.html`,{pathSegmentsToKeep:M=$,path:B=P}=l.fixBrowserRouter||{},D=!1;l.cacheDirectory&&(D={type:"filesystem",store:"pack",allowCollectingMemory:!0,cacheDirectory:l.cacheDirectory,memoryCacheUnaffected:!0,name:[p,process.env.NODE_ENV].filter(Boolean).join("-"),version:h});let R=Object.assign({original:l.alias["@"],override:p&&j(p)},l.overrideResolve);export const clientConfig={entry:O,stats:"errors-only",cache:D,infrastructureLogging:{level:"error"},target:"web",externalsPresets:l.externalsPresets,plugins:[...n,new u(l.virtualModule||{}),new w,l.htmlPluginOption&&new t(s),l.fixBrowserRouter&&new t({filename:B,inject:!1,templateContent:()=>`<html lang="en"><head><title>${s.title}</title><script>const pathKeep = ${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(C),y&&new c(e=>!!(e.match(/main\.(.*)\.bundle.js$/)||e.match("main.bundle.js"))),new v({"process.env":JSON.stringify(l.env)}),new x({paths:[/\.d\.ts$/]}),l.sourceMap&&new k(l.sourceMap),...l.plugins].filter(e=>!!e),node:{global:!1},experiments:{topLevelAwait:!0,asyncWebAssembly:!0,cacheUnaffected:!0,layers:!0,lazyCompilation:d&&{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 m(R),...l.resolvePlugins].filter(Boolean),fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},module:a,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{CONFIG as l,PUBLICPATH as r}from"./config.js";import s from"./html-plugin-option.js";import n from"./module-federation.js";import i from"./module.config.js";import a,{CUSTOMCONFIG as p}from"./paths.js";import c from"./plugin/add-entry-attribute.js";import m from"./plugin/override-resolve.js";import u from"./plugin/virtual-module.js";import{PACKAGENAME as f,PACKAGEVERSION as h,isDev as d,isLibrary as g,isMicro as y}from"./process-env.js";import{resolveNodeModulesPath as b,resolveProgramPath as j}from"./utils.js";let{AutomaticPrefetchPlugin:w,DefinePlugin:v,SourceMapDevToolPlugin:k,WatchIgnorePlugin:x}=o,C=l.assetHtml.map(e=>({publicPath:"",...e}));export const outputConfig={path:j(g?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:`js/[${d?"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:f,type:"window"},globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${f}`,pathinfo:d,clean:!0,publicPath:r,asyncChunks:!0,charset:!0};let O={main:b("@app/entry")};l.polyfill&&Object.assign(O,{"dom-polyfills":[`${a.corePath}/polyfills/replace-children.js`]}),l.entry&&("string"==typeof l.entry?O={main:l.entry}:Object.keys(l.entry)&&Object.assign(O,l.entry)),l.output&&("string"==typeof l.output?outputConfig.path=l.output:Object.keys(l.output)&&Object.assign(outputConfig,l.output));let $=l.basename.split("/").filter(Boolean).length,P=`${Array($).fill("..").join("/")+($?"/":"")}404.html`,{pathSegmentsToKeep:M=$,path:B=P}=l.fixBrowserRouter||{},D=!1;l.cacheDirectory&&(D={type:"filesystem",store:"pack",allowCollectingMemory:!0,cacheDirectory:l.cacheDirectory,memoryCacheUnaffected:!0,name:[p,process.env.NODE_ENV].filter(Boolean).join("-"),version:h});let R=Object.assign({original:l.alias["@"],override:p&&j(p)},l.overrideResolve);export const clientConfig={entry:O,stats:"errors-only",cache:D,infrastructureLogging:{level:"error"},target:"web",externalsPresets:l.externalsPresets,plugins:[...n,new u(l.virtualModule),new w,l.htmlPluginOption&&new t(s),l.fixBrowserRouter&&new t({filename:B,inject:!1,templateContent:()=>`<html lang="en"><head><title>${s.title}</title><script>const pathKeep = ${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(C),y&&new c({test:/main\.bundle\.js$/}),new v({"process.env":JSON.stringify(l.env)}),new x({paths:[/\.d\.ts$/]}),l.sourceMap&&new k(l.sourceMap),...l.plugins].filter(e=>!!e),node:{global:!1},experiments:{topLevelAwait:!0,asyncWebAssembly:!0,cacheUnaffected:!0,layers:!0,lazyCompilation:d&&{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 m(R),...l.resolvePlugins].filter(Boolean),fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},module:i,externals:l.externals,output:outputConfig};
@@ -1,4 +1,4 @@
1
- import webpack from 'webpack';
1
+ import type { Compiler } from 'webpack';
2
2
  /**
3
3
  * 向 html-webpack-plugin 导出的 HTML 模板 script 添加属性
4
4
  * ```javascript
@@ -10,8 +10,10 @@ import webpack from 'webpack';
10
10
  * ```
11
11
  */
12
12
  declare class AddEntryAttributeWebpackPlugin {
13
- private readonly entryMatchCallback;
14
- constructor(matchCallback: (src: string) => boolean);
15
- apply(compiler: webpack.Compiler): void;
13
+ private readonly test;
14
+ constructor(opt: {
15
+ test: RegExp;
16
+ });
17
+ apply(compiler: Compiler): void;
16
18
  }
17
19
  export default AddEntryAttributeWebpackPlugin;
@@ -1 +1 @@
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);r&&r.getHooks(e).alterAssetTagGroups.tap("AddEntryAttributeWebpackPlugin",t=>(t.headTags.forEach(t=>{"script"===t.tagName&&this.entryMatchCallback(t.attributes.src)&&(t.attributes.entry=!0)}),t))})}}
1
+ export default class{constructor(t){this.test=t.test}apply(t){t.hooks.compilation.tap("AddEntryAttributeWebpackPlugin",s=>{let e=t.options.plugins.find(({constructor:t})=>t&&"HtmlWebpackPlugin"===t.name);e&&e.getHooks(s).alterAssetTagGroups.tap("AddEntryAttributeWebpackPlugin",t=>(t.headTags.forEach(t=>{"script"===t.tagName&&t.attributes.src&&this.test.test(t.attributes.src)&&(t.attributes.entry=!0)}),t))})}}
@@ -3,9 +3,9 @@ interface VirtualModulePluginOption {
3
3
  [key: string]: string | object;
4
4
  }
5
5
  declare class VirtualModuleWebpackPlugin {
6
- private readonly options;
6
+ private readonly options?;
7
7
  private hasTapped;
8
- constructor(options: VirtualModulePluginOption);
8
+ constructor(options?: VirtualModulePluginOption);
9
9
  apply(compiler: Compiler): void;
10
10
  }
11
11
  export default VirtualModuleWebpackPlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.9.9-beta.0",
3
+ "version": "3.9.10",
4
4
  "description": "core",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",
@@ -35,7 +35,7 @@
35
35
  "ts-import-plugin": "3.0.0",
36
36
  "ts-loader": "9.5.1",
37
37
  "typescript": "5.3.3",
38
- "webpack": "5.89.0",
38
+ "webpack": "5.77.0",
39
39
  "webpack-bundle-analyzer": "4.10.1",
40
40
  "webpack-cli": "5.1.4",
41
41
  "webpack-dev-server": "4.15.1",