@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 +1 -1
- package/lib/done.d.ts +3 -5
- package/lib/done.js +1 -1
- package/package.json +1 -1
- package/typings/global.d.ts +2 -1
package/lib/common.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
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 {
|
|
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
|
|
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",
|
|
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
package/typings/global.d.ts
CHANGED
|
@@ -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?:
|
|
254
|
+
done?: ConstructorParameters<typeof DoneWebpackPlugin>[0];
|
|
254
255
|
mdx?: MDXOptions;
|
|
255
256
|
jsxDomExpressions?: {
|
|
256
257
|
moduleName?: string;
|