@moneko/core 3.5.0 → 3.6.1
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/dev.js +3 -3
- package/lib/polyfills.js +1 -1
- package/lib/prod.js +1 -1
- package/lib/swcrc.js +1 -1
- package/package.json +4 -10
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
|
|
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};
|
package/lib/dev.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{readdirSync as e}from"fs";import t from"chalk";import o from"webpack";import s from"webpack-dev-server";import{merge as r}from"webpack-merge";import{cleanDir as l}from"./cleanup.js";import{clientConfig as i}from"./common.js";import{CONFIG as n}from"./config.js";import{hasPkg as a}from"./has-pkg.js";import{getIPv4 as c,getPort as
|
|
2
|
-
`);function
|
|
3
|
-
${S(" Network ")} ${
|
|
1
|
+
import{readdirSync as e}from"fs";import t from"chalk";import o from"webpack";import s from"webpack-dev-server";import{merge as r}from"webpack-merge";import{cleanDir as l}from"./cleanup.js";import{clientConfig as i}from"./common.js";import{CONFIG as n}from"./config.js";import{hasPkg as a}from"./has-pkg.js";import{getIPv4 as c,getPort as p}from"./net.js";import m from"./paths.js";import{hasEslintConfig as d,hasStylelintConfig as u,isLibrary as f,isReact as h}from"./process-env.js";import{isFunction as v,log as w,resolveProgramPath as g}from"./utils.js";let{HotModuleReplacementPlugin:j}=o,{yellow:k,green:y,grey:$,gray:b,bgBlue:x,bgGreenBright:S,blueBright:C,greenBright:T}=t,A=[".eslintrc.js",".eslintrc.json",".eslintrc.yaml",".eslintrc.json"],B=[".stylelintrc",".stylelintrc.json",".stylelintrc.yaml",".stylelintrc.yml",".stylelintrc.js","stylelint.config.js","stylelint.config.cjs"],D=e(m.programPath),E=!1,H=!1;for(let e=0,t=D.length;e<t;e++)B.includes(D[e])&&(H=!0),A.includes(D[e])&&(E=!0);E||(E=d),H||(H=u);let M=H?(await import("stylelint-webpack-plugin")).default:null,O=E?(await import("eslint-webpack-plugin")).default:null,P=n.devServer.port||3e3,_=await p(P,65535,n.devServer.host),J=a("@moneko/mock"),W=J&&(await import("@moneko/mock")).default,F=h&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,L=!1===n.devtool||n.devtool?n.devtool:"eval-cheap-module-source-map";n.devServer.port=_;let N="/"===n.basename,R=n.devServer.https?"https:":"http:",Y=N?"":n.basename,q=n.devServer.port!==_&&b(`Port ${k(P)} is in use, trying ${y(_)} instead.
|
|
2
|
+
`);function z(e){return`${R}//${"local"===e?n.devServer.host:c()}:${_}${Y}`}let G=b("You application is running here:"),I=`${x(" Local ")} ${C(z("local"))}
|
|
3
|
+
${S(" Network ")} ${T(z("net"))}`,K=["js","md","mdx","jsx","ts","tsx","json","html","vue"],Q=K.join(","),U=["css","scss","sass","less","ts","tsx","js","jsx"],V=U.join(","),X=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],Z=[O&&new O({fix:!0,threads:!0,files:[`${n.alias["@"]}/**/*.{${Q}}`,f&&`${n.alias["@pkg"]}/**/*.{${Q}}`].filter(Boolean),extensions:K,exclude:X,cache:!1,lintDirtyModulesOnly:!0}),M&&new M({fix:!0,threads:!0,files:[`${n.alias["@"]}/**/*.{${V}}`,f&&`${n.alias["@pkg"]}/**/*.{${V}}`].filter(Boolean),extensions:U,exclude:X,cache:!1,lintDirtyModulesOnly:!0}),new j,F&&new F].filter(Boolean),ee={headers:{"Access-Control-Allow-Origin":"*"},compress:n.devServer.compress,host:"0.0.0.0",port:_,historyApiFallback:N||{index:Y.endsWith("/")?Y:`${Y}/`,disableDotRule:!0},https:n.devServer.https,proxy:n.proxy,allowedHosts:n.devServer.allowedHosts,client:{reconnect:!0,progress:!1,logging:"info",overlay:!1,webSocketTransport:"ws"},webSocketServer:"ws",static:{watch:{ignored:e=>e.endsWith(".d.ts")||e.includes("/node_modules/")}},setupMiddlewares:(e,t)=>{if(!t)throw Error("devServer is not defined");return t.app&&v(W)&&W(t.app,g("mock/")),e},open:!1,hot:!0},et=o(r(i,{devtool:L,mode:"development",plugins:Z}));et.watch({aggregateTimeout:600,ignored:/node_modules/,stdin:!0,poll:!0},(e,t)=>{!e&&t&&(process.stdout.write("\x1b[2J\x1b[3J\x1b[H"),w([G,"",I,"",$(`Compiled successfully in ${y(`${t.endTime-t.startTime}ms`)}`)]),t.compilation.warnings.forEach(e=>w(e.message)),t.compilation.errors.forEach(e=>w(e.message)),q&&w(q))});let eo=new s(ee,et);eo.startCallback(e=>{e||w([G,"",I])}),eo.stopCallback(e=>{e||l(m.cachePath)}),process.on("exit",function(){et.close(()=>{}),eo.invalidate(),eo.stop()});
|
package/lib/polyfills.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import r from"browserslist";import t from"core-js-compat";import o from"./paths.js";export default function(){return t({targets:r(void 0,{path:o.programPath,env:process.env.NODE_ENV}).filter(r=>!r.endsWith(" TP")),version:"3.33
|
|
1
|
+
import r from"browserslist";import t from"core-js-compat";import o from"./paths.js";export default function(){return t({targets:r(void 0,{path:o.programPath,env:process.env.NODE_ENV}).filter(r=>!r.endsWith(" TP")),version:"3.33"}).list}
|
package/lib/prod.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"css-minimizer-webpack-plugin";import i from"mini-css-extract-plugin";import n from"terser-webpack-plugin";import m from"webpack";import{BundleAnalyzerPlugin as o}from"webpack-bundle-analyzer";import{merge as s}from"webpack-merge";import{cleanDir as r}from"./cleanup.js";import{clientConfig as t}from"./common.js";import{CONFIG as p}from"./config.js";import{getMinifyOption as l}from"./minify.js";import c from"./paths.js";let{optimize:{MinChunkSizePlugin:u}}=m,{cssnanoMinify:a,swcMinify:f}=e,d="swc"===p.compiler,h=[];p.minifier&&(p.minifier.js&&h.push(new n(l(p.minifier.js?.type||(d?"swc":"terser"),p.minifier.js?.options))),p.minifier.css&&h.push(new e({minify:{swc:f,cssnano:a}[p.minifier.css?.type||(d?"swc":"cssnano")],minimizerOptions:p.minifier.css?.options})));let k={splitChunks:p.splitChunk,runtimeChunk:p.runtimeChunk,chunkIds:"named",moduleIds:"named",removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,mangleWasmImports:!0,minimize:!0,minimizer:h},w=s(t,{devtool:!1===p.devtool||p.devtool?p.devtool:"cheap-module-source-map",mode:"production",optimization:k,plugins:[new i({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",experimentalUseImportModule:!0}),p.bundleAnalyzer&&new o(p.bundleAnalyzer),p.splitChunk&&new u({minChunkSize:1e4})].filter(Boolean)}),b=m(w);b.run(
|
|
1
|
+
import e from"css-minimizer-webpack-plugin";import i from"mini-css-extract-plugin";import n from"terser-webpack-plugin";import m from"webpack";import{BundleAnalyzerPlugin as o}from"webpack-bundle-analyzer";import{merge as s}from"webpack-merge";import{cleanDir as r}from"./cleanup.js";import{clientConfig as t}from"./common.js";import{CONFIG as p}from"./config.js";import{getMinifyOption as l}from"./minify.js";import c from"./paths.js";let{optimize:{MinChunkSizePlugin:u}}=m,{cssnanoMinify:a,swcMinify:f}=e,d="swc"===p.compiler,h=[];p.minifier&&(p.minifier.js&&h.push(new n(l(p.minifier.js?.type||(d?"swc":"terser"),p.minifier.js?.options))),p.minifier.css&&h.push(new e({minify:{swc:f,cssnano:a}[p.minifier.css?.type||(d?"swc":"cssnano")],minimizerOptions:p.minifier.css?.options})));let k={splitChunks:p.splitChunk,runtimeChunk:p.runtimeChunk,chunkIds:"named",moduleIds:"named",removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,mangleWasmImports:!0,minimize:!0,minimizer:h},w=s(t,{devtool:!1===p.devtool||p.devtool?p.devtool:"cheap-module-source-map",mode:"production",optimization:k,plugins:[new i({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",experimentalUseImportModule:!0}),p.bundleAnalyzer&&new o(p.bundleAnalyzer),p.splitChunk&&new u({minChunkSize:1e4})].filter(Boolean)}),b=m(w);b.run(()=>{}),process.on("exit",function(){b.close(()=>{}),r(c.cachePath)});
|
package/lib/swcrc.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{merge as e}from"webpack-merge";import{CONFIG as o}from"./config.js";import r from"./paths.js";import s from"./polyfills.js";import{isReact as t,isSolid as n,jsxImportSource as c}from"./process-env.js";export const swcMinifyOption={compress:{top_retain:[],keep_infinity:!0,global_defs:{"@alert":"console.log"},pure_funcs:["console.log","console.warn","console.error","console.info"],toplevel:!1,drop_console:!0,drop_debugger:!0,module:!1,ecma:2015,ie8:!1,keep_classnames:void 0,keep_fnames:!1},mangle:!0};export default((a=!1)=>{let l={module:{type:"es6",resolveFully:!0},jsc:{parser:{syntax:"typescript",tsx:!0,decorators:!0,dynamicImport:!0},loose:!0,target:"es2017",externalHelpers:!0,transform:{legacyDecorator:!0,decoratorMetadata:!0,react:{runtime:"automatic",throwIfNamespace:!0,refresh:t&&a,development:a,importSource:c},optimizer:{simplify:!1}},experimental:{emitAssertForImportAttributes:!0,cacheRoot:r.swcCachePath,plugins:[["swc-plugin-another-transform-imports",function(e){for(let o=0,r=Object.keys(e),s=r.length;o<s;o++)e[r[o]].transform=`${r[o]}/${e[r[o]].transform}`,e[r[o]].style&&(e[r[o]].style=`${r[o]}/${e[r[o]].style}`);return e}(o.importOnDemand||{})],n&&["@moneko/jsx-dom-expressions",o.jsxDomExpressions||{}]].filter(Boolean)}},sourceMaps:!0,parseMap:!0};return(o.polyfill&&(l.jsc.target=void 0,l.env={include:s(),mode:"usage",coreJs:"3.33
|
|
1
|
+
import{merge as e}from"webpack-merge";import{CONFIG as o}from"./config.js";import r from"./paths.js";import s from"./polyfills.js";import{isReact as t,isSolid as n,jsxImportSource as c}from"./process-env.js";export const swcMinifyOption={compress:{top_retain:[],keep_infinity:!0,global_defs:{"@alert":"console.log"},pure_funcs:["console.log","console.warn","console.error","console.info"],toplevel:!1,drop_console:!0,drop_debugger:!0,module:!1,ecma:2015,ie8:!1,keep_classnames:void 0,keep_fnames:!1},mangle:!0};export default((a=!1)=>{let l={module:{type:"es6",resolveFully:!0},jsc:{parser:{syntax:"typescript",tsx:!0,decorators:!0,dynamicImport:!0},loose:!0,target:"es2017",externalHelpers:!0,transform:{legacyDecorator:!0,decoratorMetadata:!0,react:{runtime:"automatic",throwIfNamespace:!0,refresh:t&&a,development:a,importSource:c},optimizer:{simplify:!1}},experimental:{emitAssertForImportAttributes:!0,cacheRoot:r.swcCachePath,plugins:[["swc-plugin-another-transform-imports",function(e){for(let o=0,r=Object.keys(e),s=r.length;o<s;o++)e[r[o]].transform=`${r[o]}/${e[r[o]].transform}`,e[r[o]].style&&(e[r[o]].style=`${r[o]}/${e[r[o]].style}`);return e}(o.importOnDemand||{})],n&&["@moneko/jsx-dom-expressions",o.jsxDomExpressions||{}]].filter(Boolean)}},sourceMaps:!0,parseMap:!0};return(o.polyfill&&(l.jsc.target=void 0,l.env={include:s(),mode:"usage",coreJs:"3.33"}),o.swcrc)?e(l,"function"==typeof o.swcrc?o.swcrc(a):o.swcrc):l});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.1",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@mdx-js/loader": "3.0.0",
|
|
16
|
-
"@soda/friendly-errors-webpack-plugin": "1.8.1",
|
|
17
16
|
"@swc/core": "1.3.95",
|
|
18
17
|
"@swc/css": "0.0.28",
|
|
19
18
|
"@swc/helpers": "0.5.3",
|
|
20
19
|
"@teamsupercell/typings-for-css-modules-loader": "2.5.2",
|
|
20
|
+
"@types/webpack-bundle-analyzer": "4.6.2",
|
|
21
21
|
"add-asset-html-webpack-plugin": "6.0.0",
|
|
22
22
|
"core-js": "3.33.2",
|
|
23
23
|
"core-js-compat": "3.33.2",
|
|
@@ -50,14 +50,8 @@
|
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@swc/cli": "0.1.62",
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"@types/shelljs": "0.8.14",
|
|
56
|
-
"@types/webpack-bundle-analyzer": "4.6.2",
|
|
57
|
-
"@types/webpack-env": "1.18.3",
|
|
58
|
-
"eslint-config-neko": "2.0.2",
|
|
59
|
-
"shelljs": "0.8.5",
|
|
60
|
-
"stylelint-config-moneko": "1.0.18"
|
|
53
|
+
"eslint-config-neko": "2.1.0",
|
|
54
|
+
"stylelint-config-moneko": "1.2.0"
|
|
61
55
|
},
|
|
62
56
|
"files": [
|
|
63
57
|
"lib",
|