@moneko/core 3.36.2-beta.0 → 3.36.3-beta.0
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/build/common.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"mini-css-extract-plugin";import i from"webpack";import{merge as n}from"webpack-merge";import{commonConfig as
|
|
1
|
+
import e from"mini-css-extract-plugin";import i from"webpack";import{merge as n}from"webpack-merge";import{commonConfig as t}from"../common.mjs";import{CONFIG as m}from"../config.mjs";import{LightningCssMinifyPlugin as r}from"../plugin/lightningcss-plugin.mjs";import s from"../plugin/swc-minify-plugin.mjs";import{getLightningCssTargets as l}from"../polyfills/targets.mjs";let o=[];m.minifier&&(o.push(new s(m.minifier)),o.push(new r({targets:l()})));let p={maxAssetSize:256e3,maxEntrypointSize:256e3,assetFilter:e=>!e.endsWith(".map")&&!e.endsWith("ce28377f3a428346.js"),...m.performance},a=n(t,{performance:m.performance&&p,plugins:[new e({filename:"style/[contenthash].css",chunkFilename:"style/[contenthash].css",ignoreOrder:!0})],optimization:{splitChunks:m.splitChunk,runtimeChunk:m.runtimeChunk,chunkIds:"deterministic",moduleIds:"deterministic",concatenateModules:!0,emitOnErrors:!1,removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,minimize:!0,minimizer:o}});if(m.splitChunk&&a.plugins?.push(new i.optimize.MinChunkSizePlugin({minChunkSize:51200})),m.bundleAnalyzer){let e=(await import("webpack-bundle-analyzer")).BundleAnalyzerPlugin;a.plugins?.push(new e({analyzerMode:"static",reportFilename:"report.html",openAnalyzer:!1,defaultSizes:"gzip",logLevel:"silent",...m.bundleAnalyzer}))}export default a;
|
package/lib/common.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{extname as e,join as t,resolve as o}from"node:path";import s,{config_files as n,CUSTOMCONFIG as a}from"./commom/paths.mjs";import i from"./commom/require.mjs";import r from"./plugin/override-resolve.mjs";import{isObject as l,node_modules as m,resolveProgram as p}from"./utils/index.mjs";import{exampleModuleName as c}from"./vm/example.mjs";import u from"./vm/info.mjs";import{CONFIG as h,PUBLICPATH as f}from"./config.mjs";import d from"./plugins.config.mjs";import{isDev as g,isLibrary as b,NODE_ENV as y,packageJson as j}from"./process-env.mjs";export const outputConfig={path:p(b?"docs":"dist"),filename:"js/[name].[contenthash].bundle.js",chunkFilename:"js/[
|
|
1
|
+
import{extname as e,join as t,resolve as o}from"node:path";import s,{config_files as n,CUSTOMCONFIG as a}from"./commom/paths.mjs";import i from"./commom/require.mjs";import r from"./plugin/override-resolve.mjs";import{isObject as l,node_modules as m,resolveProgram as p}from"./utils/index.mjs";import{exampleModuleName as c}from"./vm/example.mjs";import u from"./vm/info.mjs";import{CONFIG as h,PUBLICPATH as f}from"./config.mjs";import d from"./plugins.config.mjs";import{isDev as g,isLibrary as b,NODE_ENV as y,packageJson as j}from"./process-env.mjs";export const outputConfig={path:p(b?"docs":"dist"),filename:"js/[name].[contenthash].bundle.js",chunkFilename:"js/[contenthash].chunk.js",assetModuleFilename:t=>{let o=e(t.filename||"").substring(1);return`assets/${o}/[hash][ext]`},library:{name:`${u.projectName}`,type:"umd",umdNamedDefine:!0},globalObject:"self",chunkLoadingGlobal:`webpackJsonp_${j.name}`,pathinfo:g,clean:!0,publicPath:f,asyncChunks:!0,charset:!0,iife:!0,crossOriginLoading:"anonymous",enabledWasmLoadingTypes:["fetch"],hotUpdateChunkFilename:"[id].[fullhash].hot.js",hotUpdateMainFilename:"[runtime].[fullhash].hot.json"};let v={main:[m("@app/entry")]};if(h.polyfill&&v.main.unshift(t(s.corePath,"./polyfills/replace-children.mjs")),g&&h.refresh&&h.env.injectRemoteReactRefresh&&v.main.unshift(i.resolve("@moneko/react/lib/injectRemoteReactRefresh.js")),h.entry&&("string"==typeof h.entry?v={main:[h.entry]}:Object.keys(h.entry)&&(v=Object.assign(v,h.entry))),"string"==typeof v.main&&(v.main=[v.main]),h.output){if("string"==typeof h.output)outputConfig.path=h.output;else if(Object.keys(h.output)){let e=h.output,t={...outputConfig.library};Object.assign(outputConfig,e),"object"==typeof h.output&&e.library&&(outputConfig.library=Object.assign(t,e.library))}}let C={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:s.webpackCachePath,memoryCacheUnaffected:!0,name:`.${[a,y].filter(Boolean).join("-")}`,version:`${j.version}`,buildDependencies:{config:n}};!1===h.cache?C=!1:l(h.cache)&&(C=Object.assign(C,h.cache));export const commonConfig={name:"client",target:"web",devtool:h.devtool,entry:v,mode:g?"development":"production",stats:"errors-only",cache:C,snapshot:{immutablePaths:[/node_modules\/(?!(@app|@moneko)\/)/],managedPaths:[/^@app\/.+/,/^@moneko\/.+/],buildDependencies:{timestamp:!0,hash:!0}},infrastructureLogging:{level:"error"},externalsPresets:h.externalsPresets,plugins:d,node:{global:!1,__filename:!1,__dirname:!1},experiments:{topLevelAwait:!0,asyncWebAssembly:!0,cacheUnaffected:!0,layers:!0,lazyCompilation:h.lazyCompilation&&g&&{imports:!0,entries:!0,test:e=>{let t=e.nameForCondition();return!!(t&&(t.startsWith(m(c))||t.startsWith(m("@app/comment"))||t.startsWith(s.pagesPath)||t.startsWith(s.componentsPath)))}},buildHttp:l(h.buildHttp)?{allowedUris:[],lockfileLocation:o(s.httpCachePath,"http.lock"),cacheLocation:o(s.httpCachePath,"data"),upgrade:!0,...h.buildHttp}:h.buildHttp,backCompat:!0,futureDefaults:!0,css:!1,outputModule:!1},resolve:{extensions:[".mts",".mjs",".ts",".tsx",".js",".jsx",".json",".wasm"],alias:h.alias,modules:[s.nodeModules,s.pnpmNodeModules,s.denoNodeModules],mainFields:["browser","module","main"],mainFiles:["index"],plugins:h.resolvePlugins,preferAbsolute:!0,cache:!0,fallback:{}},externals:h.externals,output:outputConfig};h.overrideResolve&&commonConfig.resolve.plugins.push(new r(Object.assign({original:h.alias["@"],override:a&&p(a)},h.overrideResolve)));
|
package/lib/module.config.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
let e;import{join as s,sep as o}from"node:path";import{saveFileSync as t}from"@moneko/utils";import r,{CUSTOMCONFIG as a}from"./commom/paths.mjs";import n from"./commom/reactive-object.mjs";import
|
|
2
|
-
`)}:void 0},importLoaders:2}},O={loader:d.lessLoader,options:{sourceMap:!!P.sourceMap,lessOptions:{modifyVars:c,javascriptEnabled:!0}}},b=new Map;function C(e){if(b.has(e))return b.get(e);try{let s;let t=
|
|
1
|
+
let e;import{join as s,sep as o}from"node:path";import{saveFileSync as t}from"@moneko/utils";import r,{CUSTOMCONFIG as a}from"./commom/paths.mjs";import n from"./commom/reactive-object.mjs";import i from"./commom/require.mjs";import m from"./commom/rule.mjs";import l from"./options/css-extract.mjs";import c from"./options/modify-vars.mjs";import d from"./options/reslove.mjs";import p from"./options/swcrc.mjs";import{getLightningCssTargets as u}from"./polyfills/targets.mjs";import{node_modules as f,resolveProgram as h,toCamelCase as j}from"./utils/index.mjs";import y from"./utils/svg-to-data-uri.mjs";import{comment as g,getCommentPath as v}from"./vm/docs.mjs";import x from"./vm/generate-doc.mjs";import{outputConfig as w}from"./common.mjs";import{CONFIG as P}from"./config.mjs";import{FRAMEWORK as L,isDev as k,isLibrary as M}from"./process-env.mjs";let _={loader:s(r.corePath,"/loader/lightning-css/loader.cjs"),options:{sourceMap:!!P.sourceMap,targets:u(),rem:!!P.rem,esModule:!0,modules:{auto(e){if(e){if(e.endsWith(".css")&&!e.endsWith("module.css"))return!1;for(let s=0,o=I.length;s<o;s++)if(e.includes(I[s]))return m.css_module.test(e)}return m.node_modules_css_module.test(e)},localIdentName:"[hash]_[local]",namedExport:!0,exportLocalsConvention:"dashesOnly",exportOnlyLocals:!1,getJSON:P.cssModuleDefinition?function(e){q.setData(`${e.resourcePath}.d.ts`,`${e.exports.map(({name:e,value:s})=>`export const ${j(e)}: '${s}';`).join("\n")}
|
|
2
|
+
`)}:void 0},importLoaders:2}},O={loader:d.lessLoader,options:{sourceMap:!!P.sourceMap,lessOptions:{modifyVars:c,javascriptEnabled:!0}}},b=new Map;function C(e){if(b.has(e))return b.get(e);try{let s;let t=i.resolve(e).split(o),r=t.lastIndexOf("node_modules");return s=-1!==r?t.slice(0,r).join(o):t.join(o),b.set(e,[s]),[s]}catch{try{let s=i.resolve(`${e}${o}package.json`).replace(`${o}package.json`,"");b.set(e,[s])}catch{b.set(e,[f(e),f(`.pnpm/${e}`)])}return b.get(e)}}let I=[...P.cssModules,`@moneko/${L}`,"neko-ui"].map(C).flat(),$=["components","example","mock","site","src","server"].map(h);function B(e){return new Promise(s=>{s([...$,r.corePath,...P.rulesInclude?.[e]?.map(C).flat()||[]])})}a&&$.push(h(a)),P.overrideResolve&&P.overrideResolve.override&&$.push(P.overrideResolve.override);let J=await Promise.all([B("css"),B("js"),B("media"),B("wasm"),B("font")]),W=J[0],R=J[1],N=J[2],S=J[3],z=J[4];d.sassLoader&&(e={loader:d.sassLoader,options:{implementation:await import("sass"),sassOptions:{}}});let D=M&&k&&{test:m.tsdoc,include:P.alias["@pkg"],exclude:[/node_modules\/(?!(@app|@moneko)).+/,m.__tests__],enforce:"pre",loader:s(r.corePath,"/loader/ts-doc.cjs"),options:{comment:g,generateDoc:x,getCommentPath:v}},E=w.library?.type==="umd"&&!1===P.htmlPluginOption,Q=[{resourceQuery:/raw/i,type:"asset/source"},{resourceQuery:/url/i,type:"asset/resource",generator:{filename(e){let s=e.filename;return s&&s.toLocaleLowerCase().endsWith("wasm?url")?"wasm/[hash][ext]":"assets/[hash][ext]"}}},{test:m.wasm,type:"webassembly/async",include:S},{test:m.txt,type:"asset/source"},{test:m.image,type:"asset",dependency:{not:["url"]},parser:{dataUrlCondition:E?()=>!0:{maxSize:4096}},generator:{filename:e=>e.filename?.toLocaleLowerCase().endsWith(".svg")?"assets/svg/[hash][ext]":"assets/images/[hash][ext]",dataUrl:(e,s)=>s.filename.toLocaleLowerCase().endsWith(".svg")?y(e.toString()):e},include:N},{test:m.video,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/video/[hash][ext]"},include:N},{test:m.font,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/fonts/[hash][ext]"},include:z}],U=P.prefixJsLoader.filter(Boolean)||[];switch(L){case"react":P.reactCompiler&&U.unshift({loader:s(r.corePath,"/loader/react-compiler.cjs"),options:P.reactCompiler});break;case"solid":P.refresh=!1}P.cssInJs&&"object"==typeof P.cssInJs.minify&&U.unshift({loader:s(r.corePath,"/loader/css-in-js-minify.cjs"),options:Object.assign({moduleName:"@moneko/css",allowFuncs:["css","injectGlobal"]},P.cssInJs.minify)});let q=new n({});q.on("change",(e,s)=>{t(e,s)});export default(o=>{let t={loader:d.swcLoader,options:p(o)};return{parser:{javascript:{commonjsMagicComments:!0,dynamicImportMode:"lazy",dynamicImportPrefetch:!1,dynamicImportPreload:!1,importMeta:!0,importMetaContext:!0}},noParse:P.noParse,rules:[!1!==P.htmlPluginOption&&D,{oneOf:[...Q,{test:m.js,use:[...U,t].filter(Boolean),include:R},{test:m.css,use:[l,_],include:W},e&&{test:m.scss,use:[l,_,e],include:W},{test:m.less,use:[l,_,O],include:W},{test:m.markdown,use:[...U,{loader:s(r.corePath,"/loader/mdx.cjs"),options:P.mdx}].filter(Boolean),exclude:[/node_modules\/(?!(@app|@moneko)).+/]}].filter(Boolean)},...P.moduleRules].filter(Boolean)}});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { compression } from '@moneko/utils';
|
|
2
|
+
import { type AssetInfo, type Compilation, type Compiler, type sources, type WebpackError } from 'webpack';
|
|
3
|
+
type Source = sources.Source;
|
|
4
|
+
interface CompressionPluginOptions {
|
|
5
|
+
test: RegExp;
|
|
6
|
+
algorithm: 'gzip' | 'deflate' | 'brotliCompress';
|
|
7
|
+
filename: string;
|
|
8
|
+
}
|
|
9
|
+
declare class CompressionPlugin {
|
|
10
|
+
private name: string;
|
|
11
|
+
private options: CompressionPluginOptions;
|
|
12
|
+
constructor(options: CompressionPluginOptions);
|
|
13
|
+
private runCompressionAlgorithm(input: Buffer): Buffer;
|
|
14
|
+
async compress(compiler: Compiler, compilation: Compilation, assets: Record<string, Source>);
|
|
15
|
+
apply(compiler: Compiler);
|
|
16
|
+
}
|
|
17
|
+
export default CompressionPlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{compression as e}from"@moneko/utils";export default class{constructor(e){this.name="compression-plugin";let{test:s,algorithm:t="gzip",filename:o="[path][base].gz"}=e||{};this.options={test:s,algorithm:t,filename:o}}runCompressionAlgorithm(s){return Buffer.from(e(Buffer.isBuffer(s)?Array.from(s):s,this.options.algorithm))}async compress(e,s,t){let o=s.getCache(this.name),{RawSource:i}=e.webpack.sources;await Promise.all(Object.keys(t).map(async t=>{let r;let{info:a,source:m}=s.getAsset(t),p="gzip"===this.options.algorithm?"gzipped":`${this.options.algorithm}ed`;if(a.compressed||!e.webpack.ModuleFilenameHelpers.matchObject.bind(void 0,this.options)(t)||a.related&&a.related[p])return!1;let n=o.getItemCache(JSON.stringify({name:t,algorithm:this.options.algorithm}),o.getLazyHashedEtag(m)),l=await n.getPromise();if(!l.source){if("function"==typeof m.buffer)r=m.buffer();else{let e=m.source();r=Buffer.isBuffer(e)?e:Buffer.from(e)}if(!l.compressed&&r)try{l.compressed=this.runCompressionAlgorithm(r)}catch(e){s.errors.push(e);return}l.compressed&&(l.source=new i(l.compressed)),await n.storePromise(l)}let f=s.getPath(this.options.filename,{filename:t}),c={compressed:!0};a.immutable&&"string"==typeof this.options.filename&&/(\[name]|\[base]|\[file])/.test(this.options.filename)&&(c.immutable=!0),s.updateAsset(t,m,{related:{[p]:f}}),s.emitAsset(f,l.source,c)}))}apply(e){let s=this.constructor.name;e.hooks.thisCompilation.tap(s,t=>{t.hooks.processAssets.tapPromise({name:s,stage:e.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER,additionalAssets:!0},s=>this.compress(e,t,s))})}}
|
package/lib/plugins.config.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import CompressionPlugin from 'compression-webpack-plugin';
|
|
2
1
|
import webpack, { type WebpackPluginInstance } from 'webpack';
|
|
2
|
+
import CompressionPlugin from './plugin/compression.mjs';
|
|
3
3
|
import { CopyPlugin } from './plugin/copy.mjs';
|
|
4
4
|
import { HtmlMeta, HtmlPlugin } from './plugin/html-plugin.mjs';
|
|
5
5
|
import moduleFederation from './plugin/module-federation.mjs';
|
package/lib/plugins.config.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"
|
|
1
|
+
import e from"webpack";import t from"./plugin/compression.mjs";import{CopyPlugin as i}from"./plugin/copy.mjs";import{HtmlPlugin as o}from"./plugin/html-plugin.mjs";import r from"./plugin/module-federation.mjs";import{VirtualModuleWebpackPlugin as l}from"./plugin/virtual-module.mjs";import{CONFIG as n}from"./config.mjs";import{isDev as p,packageJson as a}from"./process-env.mjs";let s=[...r,new l(n.virtualModule),new i(n.copy),new e.DefinePlugin({"process.env":JSON.stringify(n.env)}),new e.IgnorePlugin({resourceRegExp:/\/(__(tests|mocks)__|test|spec|e2e)\//}),...n.plugins,p&&new t({filename:"[path][base].gz",algorithm:"gzip",test:/\.(js|css|html|svg)$/})].filter(Boolean);if(n.htmlPluginOption){let e={charset:"UTF-8","X-UA-Compatible":{"http-equiv":"X-UA-Compatible",content:"IE=edge,Chrome=1"},HandheldFriendly:"true",MobileOptimized:"320","screen-orientation":"portrait","x5-orientation":"portrait",browsermode:"application","x5-page-mode":"app","msapplication-tap-highlight":"no","mobile-web-app-capable":"yes",renderer:"webkit",description:a.description,keywords:Array.isArray(a.keywords)?a.keywords.toString():"","http-equiv":"refresh",viewport:"width=device-width, initial-scale=1"};n.seo&&(e.relCanonical={rel:"canonical",href:`https://${n.seo.domain}${n.basename}`}),n.htmlPluginOption.meta&&Object.assign(e,n.htmlPluginOption.meta),s.push(new o({...n.htmlPluginOption,meta:e}))}if(n.fixBrowserRouter){let e=n.basename.split("/").filter(Boolean).length,t=`${Array(e).fill("..").join("/")+(e?"/":"")}404.html`,i=n.fixBrowserRouter.pathSegmentsToKeep??e;s.push(new o({filename:n.fixBrowserRouter.path??t,inject:!1,templateContent:()=>`<html lang="en"><head><title>Redirect</title><script>const pathKeep = ${i};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>`}))}n.sourceMap&&s.push(new e.SourceMapDevToolPlugin(n.sourceMap));export default s;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "3.36.
|
|
3
|
+
"version": "3.36.3-beta.0",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -23,11 +23,10 @@
|
|
|
23
23
|
"@moneko/raw-import": "0.0.3",
|
|
24
24
|
"@moneko/stylelint": "1.2.1",
|
|
25
25
|
"@moneko/transform-imports": "0.6.1",
|
|
26
|
-
"@moneko/utils": "0.1
|
|
26
|
+
"@moneko/utils": "0.2.1",
|
|
27
27
|
"@swc/core": "1.6.13",
|
|
28
28
|
"browserslist": "4.24.4",
|
|
29
29
|
"chokidar": "4.0.3",
|
|
30
|
-
"compression-webpack-plugin": "11.1.0",
|
|
31
30
|
"core-js": "3.41.0",
|
|
32
31
|
"core-js-compat": "3.41.0",
|
|
33
32
|
"fastify": "4.29.0",
|