@moneko/core 3.0.0-beta.5 → 3.0.0-beta.6
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/build/webpack.common.js +1 -1
- package/package.json +1 -1
package/build/webpack.common.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"fs";import{join as t}from"path";import s from"url";import n from"add-asset-html-webpack-plugin";import o from"html-webpack-plugin";import{DefinePlugin as l,WatchIgnorePlugin as i,SourceMapDevToolPlugin as r,AutomaticPrefetchPlugin as a}from"webpack";import p from"webpackbar";import{CONFIG as m,ENTRYPATH as c,PUBLICPATH as u}from"./common.js";import f from"./done.js";import d from"./envFlags.js";import g from"./html-add-entry-attr.js";import j from"./html-plugin-option.js";import{moduleFederation as h}from"./module-federation.js";import b from"./module.config.js";import{APPTYPE as y,DEV as w,hasEslintConfig as x,hasStylelintConfig as k,PACKAGENAME as C,PROGRAMPATH as v}from"./process-env";import{seo as O}from"./seo";import{resolveProgramPath as T}from"./utils";let $=[".eslintrc.js",".eslintrc.json",".eslintrc.yaml",".eslintrc.json"],B=[".stylelintrc",".stylelintrc.json",".stylelintrc.yaml",".stylelintrc.yml",".stylelintrc.js","stylelint.config.js","stylelint.config.cjs"],L=e.readdirSync(v),A=!1,R=!1;for(let e=0,t=L.length;e<t;e++)B.includes(L[e])&&(R=!0),$.includes(L[e])&&(A=!0);A||(A=x),R||(R=k);let S=R?require("stylelint-webpack-plugin"):null,F=A?require("eslint-webpack-plugin"):null,K={"@":T("src")};Object.assign(K,m.alias),"library"===y&&Object.assign(K,{"@":T("site"),"@pkg":T("components"),[C]:T("components")});let M=m.assetHtml.map(e=>({publicPath:"",...e}));export const outputConfig={path:T("library"===y?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:"js/[name].chunk.js",assetModuleFilename:"assets/[name].[hash][ext]",library:C,libraryTarget:"window",globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${C}`,pathinfo:!1,clean:!0,publicPath:u};let P=s.fileURLToPath(new URL(".",import.meta.url)),q=t(P,`../lib/packages/${c[y]}/index.js`);"single-component"===y&&(Object.assign(K,{[C]:T("umd")}),q=T(w?"example/index.ts":"src/index.ts"),outputConfig.path=T(w?"dist":"umd"),outputConfig.filename="index.js",outputConfig.library=C,outputConfig.libraryTarget="umd",outputConfig.libraryExport="default");let U={main:q};m.entry&&("string"==typeof m.entry?U=m.entry:Object.keys(m.entry)&&Object.assign(U,m.entry)),m.output&&("string"==typeof m.output?outputConfig.path=m.output:Object.keys(m.output)&&Object.assign(outputConfig,m.output));let W=m.routeBaseName.split("/").filter(Boolean).length,_=Array(W).fill("..").join("/")+(W?"/":"")+"404.html",{pathSegmentsToKeep:E=W,path:G=_}=m.fixBrowserRouter||{},H={entry:U,stats:"errors-only",infrastructureLogging:{level:"none"},target:"web",plugins:[new a,...h,F&&new F({threads:!0,extensions:["js","md","mdx","cjs","ejs","mjs","jsx","ts","tsx","json","html","coffee","vue"]}),S&&new S({fix:!0,threads:!0,extensions:["css","scss","sass","less","ts","tsx","js","jsx"],exclude:["node_modules/","es/","lib/","docs/","coverage/","dist/"]}),new o(j),m.fixBrowserRouter&&new o({filename:G,inject:!1,templateContent:()=>`<html html><head><title>${j.title}</title><script>var pathSegmentsToKeep = ${E||W};var l = window.location;l.replace(l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') + l.pathname.split('/').slice(0, 1 + pathSegmentsToKeep).join('/') + '/?/' + l.pathname.slice(1).split('/').slice(pathSegmentsToKeep).join('/').replace(/&/g, '~and~') + (l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') + l.hash);</script></head><body></body></html>`}),new n(M),"single-spa"===y&&new g(e=>!!(e.match(/main\.(.*)\.bundle.js$/)||e.match("main.bundle.js"))),new l(d),new i({paths:[/\.d\.ts$/]}),m.sourceMap&&new r(m.sourceMap),new p({name:"编译中",color:"#6f42c1"}),new f({done:()=>{!w&&m.seo&&O(),m.done?.()}}),...m.plugins].filter(Boolean),experiments:{topLevelAwait:!0,syncWebAssembly:!0,asyncWebAssembly:!0},resolve:{extensions:[".tsx",".ts",".js",".jsx"],alias:K,fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},module:b,externals:m.externals,output:outputConfig};export default H;
|
|
1
|
+
import e from"fs";import{join as t}from"path";import s from"url";import n from"add-asset-html-webpack-plugin";import o from"html-webpack-plugin";import{DefinePlugin as l,WatchIgnorePlugin as i,SourceMapDevToolPlugin as r,AutomaticPrefetchPlugin as a}from"webpack";import p from"webpackbar";import{CONFIG as m,ENTRYPATH as c,PUBLICPATH as u}from"./common.js";import f from"./done.js";import d from"./envFlags.js";import g from"./html-add-entry-attr.js";import j from"./html-plugin-option.js";import{moduleFederation as h}from"./module-federation.js";import b from"./module.config.js";import{APPTYPE as y,DEV as w,hasEslintConfig as x,hasStylelintConfig as k,PACKAGENAME as C,PROGRAMPATH as v}from"./process-env.js";import{seo as O}from"./seo.js";import{resolveProgramPath as T}from"./utils.js";let $=[".eslintrc.js",".eslintrc.json",".eslintrc.yaml",".eslintrc.json"],B=[".stylelintrc",".stylelintrc.json",".stylelintrc.yaml",".stylelintrc.yml",".stylelintrc.js","stylelint.config.js","stylelint.config.cjs"],L=e.readdirSync(v),A=!1,R=!1;for(let e=0,t=L.length;e<t;e++)B.includes(L[e])&&(R=!0),$.includes(L[e])&&(A=!0);A||(A=x),R||(R=k);let S=R?require("stylelint-webpack-plugin"):null,F=A?require("eslint-webpack-plugin"):null,K={"@":T("src")};Object.assign(K,m.alias),"library"===y&&Object.assign(K,{"@":T("site"),"@pkg":T("components"),[C]:T("components")});let M=m.assetHtml.map(e=>({publicPath:"",...e}));export const outputConfig={path:T("library"===y?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:"js/[name].chunk.js",assetModuleFilename:"assets/[name].[hash][ext]",library:C,libraryTarget:"window",globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${C}`,pathinfo:!1,clean:!0,publicPath:u};let P=s.fileURLToPath(new URL(".",import.meta.url)),q=t(P,`../lib/packages/${c[y]}/index.js`);"single-component"===y&&(Object.assign(K,{[C]:T("umd")}),q=T(w?"example/index.ts":"src/index.ts"),outputConfig.path=T(w?"dist":"umd"),outputConfig.filename="index.js",outputConfig.library=C,outputConfig.libraryTarget="umd",outputConfig.libraryExport="default");let U={main:q};m.entry&&("string"==typeof m.entry?U=m.entry:Object.keys(m.entry)&&Object.assign(U,m.entry)),m.output&&("string"==typeof m.output?outputConfig.path=m.output:Object.keys(m.output)&&Object.assign(outputConfig,m.output));let W=m.routeBaseName.split("/").filter(Boolean).length,_=Array(W).fill("..").join("/")+(W?"/":"")+"404.html",{pathSegmentsToKeep:E=W,path:G=_}=m.fixBrowserRouter||{},H={entry:U,stats:"errors-only",infrastructureLogging:{level:"none"},target:"web",plugins:[new a,...h,F&&new F({threads:!0,extensions:["js","md","mdx","cjs","ejs","mjs","jsx","ts","tsx","json","html","coffee","vue"]}),S&&new S({fix:!0,threads:!0,extensions:["css","scss","sass","less","ts","tsx","js","jsx"],exclude:["node_modules/","es/","lib/","docs/","coverage/","dist/"]}),new o(j),m.fixBrowserRouter&&new o({filename:G,inject:!1,templateContent:()=>`<html html><head><title>${j.title}</title><script>var pathSegmentsToKeep = ${E||W};var l = window.location;l.replace(l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') + l.pathname.split('/').slice(0, 1 + pathSegmentsToKeep).join('/') + '/?/' + l.pathname.slice(1).split('/').slice(pathSegmentsToKeep).join('/').replace(/&/g, '~and~') + (l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') + l.hash);</script></head><body></body></html>`}),new n(M),"single-spa"===y&&new g(e=>!!(e.match(/main\.(.*)\.bundle.js$/)||e.match("main.bundle.js"))),new l(d),new i({paths:[/\.d\.ts$/]}),m.sourceMap&&new r(m.sourceMap),new p({name:"编译中",color:"#6f42c1"}),new f({done:()=>{!w&&m.seo&&O(),m.done?.()}}),...m.plugins].filter(Boolean),experiments:{topLevelAwait:!0,syncWebAssembly:!0,asyncWebAssembly:!0},resolve:{extensions:[".tsx",".ts",".js",".jsx"],alias:K,fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},module:b,externals:m.externals,output:outputConfig};export default H;
|