@moneko/core 3.6.2 → 3.6.4

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 s,PUBLICPATH as n}from"./config.js";import l from"./done.js";import a from"./html-add-entry-attr.js";import i from"./html-plugin-option.js";import{moduleFederation as p}from"./module-federation.js";import m from"./module.config.js";import c,{CUSTOMCONFIG as u}from"./paths.js";import{PACKAGENAME as f,PACKAGEVERSION as h,isDev as d,isLibrary as b,isMicro as y}from"./process-env.js";import{seo as g}from"./seo.js";import{resolveNodeModulesPath as j,resolveProgramPath as w}from"./utils.js";import k from"./virtual-module-plugin.js";import x from"./virtual-modules.js";let{AutomaticPrefetchPlugin:C,DefinePlugin:v,SourceMapDevToolPlugin:$,WatchIgnorePlugin:O}=o,P=s.assetHtml.map(e=>({publicPath:"",...e}));export const outputConfig={path:w(b?"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:n,asyncChunks:!0,charset:!0};let D={main:j("@app/entry")};s.polyfill&&Object.assign(D,{"dom-polyfills":[`${c.corePath}/polyfills/replace-children.js`]}),s.entry&&("string"==typeof s.entry?D={main:s.entry}:Object.keys(s.entry)&&Object.assign(D,s.entry)),s.output&&("string"==typeof s.output?outputConfig.path=s.output:Object.keys(s.output)&&Object.assign(outputConfig,s.output));let M=s.basename.split("/").filter(Boolean).length,L=`${Array(M).fill("..").join("/")+(M?"/":"")}404.html`,{pathSegmentsToKeep:A=M,path:B=L}=s.fixBrowserRouter||{},H=!1;s.cacheDirectory&&(H={type:"filesystem",store:"pack",allowCollectingMemory:d,cacheDirectory:s.cacheDirectory,buildDependencies:{config:[new URL(".",import.meta.url).toString()]},memoryCacheUnaffected:!0,name:`${u||"default"}-${d?"development":"production"}`,version:h});export const clientConfig={entry:D,stats:"errors-only",cache:H,infrastructureLogging:{level:"error"},target:"web",externalsPresets:s.externalsPresets,plugins:[new C,...p,s.htmlPluginOption&&new t(i),s.fixBrowserRouter&&new t({filename:B,inject:!1,templateContent:()=>`<html lang="en"><head><title>${i.title}</title><script>const pathKeep = ${A||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(P),y&&new a(e=>!!(e.match(/main\.(.*)\.bundle.js$/)||e.match("main.bundle.js"))),new v({"process.env":JSON.stringify(s.env)}),new O({paths:[/\.d\.ts$/]}),s.sourceMap&&new $(s.sourceMap),s.bar&&new r(s.bar),new l({done:()=>{!d&&s.seo&&g(),s.done?.(),d||setTimeout(()=>{process.exit(0)},2e3)}}),new k(x),...s.plugins].filter(e=>!!e),experiments:{topLevelAwait:!0,asyncWebAssembly:!0,cacheUnaffected:!0,layers:!0,lazyCompilation:d&&{imports:!1,entries:!1},buildHttp:s.buildHttp,backCompat:!0,futureDefaults:!1,css:!1,outputModule:!1},resolve:{extensions:[".tsx",".ts",".js",".jsx"],alias:s.alias,fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},module:m,externals:s.externals,output:outputConfig};
1
+ let e;import t from"add-asset-html-webpack-plugin";import o from"html-webpack-plugin";import r from"webpack";import s from"webpackbar";import{CONFIG as l,PUBLICPATH as a}from"./config.js";import n from"./done.js";import i from"./html-add-entry-attr.js";import p from"./html-plugin-option.js";import{moduleFederation as m}from"./module-federation.js";import c from"./module.config.js";import u,{CUSTOMCONFIG as f}from"./paths.js";import{PACKAGENAME as h,PACKAGEVERSION as d,isDev as b,isLibrary as y,isMicro as j}from"./process-env.js";import{seo as g}from"./seo.js";import{resolveNodeModulesPath as w,resolveProgramPath as k}from"./utils.js";import x from"./virtual-module-plugin.js";import C from"./virtual-modules.js";let{AutomaticPrefetchPlugin:v,DefinePlugin:$,SourceMapDevToolPlugin:O,WatchIgnorePlugin:P}=r,M=l.assetHtml.map(e=>({publicPath:"",...e}));export const outputConfig={path:k(y?"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:a,asyncChunks:!0,charset:!0};let D={main:w("@app/entry")};l.polyfill&&Object.assign(D,{"dom-polyfills":[`${u.corePath}/polyfills/replace-children.js`]}),l.entry&&("string"==typeof l.entry?D={main:l.entry}:Object.keys(l.entry)&&Object.assign(D,l.entry)),l.output&&("string"==typeof l.output?outputConfig.path=l.output:Object.keys(l.output)&&Object.assign(outputConfig,l.output));let A=l.basename.split("/").filter(Boolean).length,B=`${Array(A).fill("..").join("/")+(A?"/":"")}404.html`,{pathSegmentsToKeep:H=A,path:K=B}=l.fixBrowserRouter||{},L=!1;l.cacheDirectory&&(L={type:"filesystem",store:"pack",allowCollectingMemory:!0,cacheDirectory:l.cacheDirectory,memoryCacheUnaffected:!0,name:`${f||"default"}-${b?"development":"production"}`,version:d});export const clientConfig={entry:D,stats:"errors-only",cache:L,infrastructureLogging:{level:"error"},target:"web",externalsPresets:l.externalsPresets,plugins:[new v,...m,l.htmlPluginOption&&new o(p),l.fixBrowserRouter&&new o({filename:K,inject:!1,templateContent:()=>`<html lang="en"><head><title>${p.title}</title><script>const pathKeep = ${H||A};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 t(M),j&&new i(e=>!!(e.match(/main\.(.*)\.bundle.js$/)||e.match("main.bundle.js"))),new $({"process.env":JSON.stringify(l.env)}),new P({paths:[/\.d\.ts$/]}),l.sourceMap&&new O(l.sourceMap),l.bar&&new s(l.bar),new x(C),new n({done:t=>{clearTimeout(e),e=setTimeout(()=>{clearTimeout(e),l.done?.(t),l.seo&&g(),process.exit(0)},3e3)}}),...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,fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},module:c,externals:l.externals,output:outputConfig};
package/lib/done.d.ts CHANGED
@@ -1,10 +1,8 @@
1
- import { type Compiler } from 'webpack';
1
+ import type { Compiler, Stats } from 'webpack';
2
2
  declare class DoneWebpackPlugin {
3
- options: {
4
- done?: () => void;
5
- };
3
+ private options;
6
4
  constructor(options: {
7
- done?: () => void;
5
+ done: (stats: Stats) => void;
8
6
  });
9
7
  apply(compiler: Compiler): void;
10
8
  }
package/lib/done.js CHANGED
@@ -1 +1 @@
1
- export default class{constructor(o){this.options=Object.assign({},o)}apply(o){o.hooks.done.tap("DoneWebpackPlugin",()=>{this.options.done?.()})}}
1
+ export default class{constructor(o){this.options=Object.assign({},o)}apply(o){o.hooks.done.tap("DoneWebpackPlugin",o=>{this.options.done(o)})}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.6.2",
3
+ "version": "3.6.4",
4
4
  "description": "core",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",
@@ -2,6 +2,7 @@ import { Options as AssetHtmlOptions } from 'add-asset-html-webpack-plugin';
2
2
  import { Options as HtmlWebpackPluginOptions } from 'html-webpack-plugin';
3
3
  import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
4
4
  import WebpackBar from 'webpackbar';
5
+ import DoneWebpackPlugin from '../lib/done';
5
6
  import type { Options as MDXOptions } from '@mdx-js/loader';
6
7
  import type { JsMinifyOptions, Config as SwcConfig } from '@swc/core';
7
8
  import type { CssNanoOptionsExtended } from 'css-minimizer-webpack-plugin';
@@ -250,7 +251,7 @@ export declare type ConfigType<T extends 'tsc' | 'swc' = 'swc'> = {
250
251
  }
251
252
  | false;
252
253
  /** 📦 打包完成 */
253
- done?: () => void;
254
+ done?: ConstructorParameters<typeof DoneWebpackPlugin>[0];
254
255
  mdx?: MDXOptions;
255
256
  jsxDomExpressions?: {
256
257
  moduleName?: string;