@moneko/core 4.4.0 → 4.4.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.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{extname as e,join as t,resolve as s}from"node:path";import o,{config_files as
|
|
1
|
+
import{extname as e,join as t,resolve as s}from"node:path";import o from"./commom/has-pkg.mjs";import a,{config_files as n,CUSTOMCONFIG as i}from"./commom/paths.mjs";import r from"./commom/rule.mjs";import{OverrideResolverPlugin as l}from"./plugin/override-resolve.mjs";import{isObject as m,resolveProgram as c}from"./utils/index.mjs";import{CONFIG as p}from"./config.mjs";import u from"./plugins.config.mjs";import{app_schema as h,CACHE_NAME as d,isDev as f,isLibrary as g,packageJson as y,projectNameCamelCase as b}from"./process-env.mjs";export const outputConfig={path:c(g?"docs":"dist"),filename:e=>e.filename?.includes(".worker")?"worker/[name].js":"js/[name].[contenthash].bundle.js",chunkFilename:"js/[contenthash].chunk.js",cssFilename:"style/[contenthash].css",cssChunkFilename:"style/[contenthash].chunk.css",assetModuleFilename:t=>{let s=e(t.filename||"").substring(1);return`assets/${s}/[hash][ext]`},library:{name:`${b}`,type:"umd",umdNamedDefine:!0},globalObject:"self",chunkLoadingGlobal:`webpackJsonp_${y.name}`,pathinfo:f,clean:!0,publicPath:p.publicPath,asyncChunks:!0,charset:!0,iife:!0,crossOriginLoading:"use-credentials",enabledWasmLoadingTypes:["fetch"],uniqueName:`${b}`};let j={main:[o(t(p.alias["@"],"service-worker")),`${h}:entry`].filter(Boolean)},v=[t(a.corePath,"./polyfills/public-path.mjs")];if(f&&p.refresh&&p.env.injectRemoteReactRefresh&&v.push(t(a.corePath,"./polyfills/inject-react-refresh.mjs")),p.polyfill&&v.push(t(a.corePath,"./polyfills/replace-children.mjs")),p.entry&&("string"==typeof p.entry?j={...j,main:[p.entry]}:Object.keys(p.entry)&&(j=Object.assign(j,p.entry))),"string"==typeof j.main?j.main=[...v,j.main]:Array.isArray(j.main)&&(j.main=[...v,...j.main]),p.output){if("string"==typeof p.output)outputConfig.path=p.output;else if(Object.keys(p.output)){let e=p.output,t={...outputConfig.library};Object.assign(outputConfig,e),"object"==typeof p.output&&e.library&&(outputConfig.library=Object.assign(t,e.library))}}let C={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:a.webpackCachePath,memoryCacheUnaffected:!0,name:d,version:`${y.version}`,buildDependencies:{config:n},maxMemoryGenerations:1};!1===p.cache?C=!1:m(p.cache)&&(C=Object.assign(C,p.cache));let k={},P={imports:!0,entries:!0,test:e=>{let s=e.nameForCondition();return!!(s&&(/^[a-z][a-z0-9]*:.+$/.test(s)||s?.startsWith(t(a.programPath,"src"))||s?.startsWith(t(a.programPath,"site"))||s?.startsWith(a.componentsPath)))}};p.lazyCompilation&&f&&"true"!==process.env.IS_BUILD?m(p.lazyCompilation)?Object.assign(k,P,p.lazyCompilation):Object.assign(k,P):k=!1;export const commonConfig={name:"client",target:"web",devtool:p.devtool,entry:j,mode:p.mode??"production",cache:C,snapshot:{immutablePaths:[a.pnpmNodeModules,a.denoNodeModules,r.node_modules],managedPaths:[a.pnpmNodeModules,a.denoNodeModules,r.node_modules],resolveBuildDependencies:{timestamp:!0,hash:!0},resolve:{timestamp:!0,hash:!0},module:{timestamp:!0,hash:!0},buildDependencies:{timestamp:!0,hash:!0},contextModule:{timestamp:!0,hash:!0}},stats:"errors-only",infrastructureLogging:{level:"error"},externalsPresets:p.externalsPresets,plugins:u,node:{global:!1,__filename:!1,__dirname:!1},experiments:{asyncWebAssembly:!0,cacheUnaffected:!0,lazyCompilation:k,buildHttp:m(p.buildHttp)?{allowedUris:[],lockfileLocation:s(a.httpCachePath,"http.lock"),cacheLocation:s(a.httpCachePath,"data"),upgrade:!0,...p.buildHttp}:p.buildHttp,backCompat:!0,futureDefaults:!0,css:!0,outputModule:!1,deferImport:!0},resolve:{extensions:[".mts",".mjs",".ts",".tsx",".js",".jsx",".json",".wasm"],alias:p.alias,modules:[a.nodeModules,a.pnpmNodeModules,a.denoNodeModules],mainFields:["browser","module","main"],mainFiles:["index"],plugins:p.resolvePlugins,preferAbsolute:!0,cache:!0,fallback:{}},externals:p.externals,output:outputConfig,recordsPath:p.recordsPath};p.overrideResolve&&commonConfig.resolve.plugins.push(new l(Object.assign({original:p.alias["@"],override:i&&c(i)},p.overrideResolve)));
|
package/lib/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{default as hasPkg}from"./commom/has-pkg.mjs";export{getIPv4,getPort}from"./commom/net.mjs";export{default as open}from"./commom/open.mjs";export{default as parseArgs}from"./commom/parse-args.mjs";export{CUSTOMCONFIG,default as paths,routeDir,yarnArgv}from"./commom/paths.mjs";export{default as printLog}from"./commom/print-log.mjs";export{default as require}from"./commom/require.mjs";export{default as Rule}from"./commom/rule.mjs";export{default as timer}from"./commom/timer.mjs";export{yApiMock,yApiSchemaMock}from"./dev/mock.mjs";export{default as jsxDomExpressions}from"./options/jsx-dom-expressions.mjs";export{default as splitChunk}from"./options/split-chunk.mjs";export*from"./plugin/manifest/index.mjs";export{APPTYPE,coreName,FRAMEWORK,isCI,isDev,isLibrary,isMicro,mainDirectory,packageJson,PACKAGENAME}from"./process-env.mjs";export{digest,md5,node_modules,resolveProgram,toCamelCase}from"./utils/index.mjs";export*from"@moneko/mdx";export*from"@moneko/utils";import o from"webpack";export{o as webpack};
|
|
1
|
+
export{default as hasPkg}from"./commom/has-pkg.mjs";export{getIPv4,getPort}from"./commom/net.mjs";export{default as open}from"./commom/open.mjs";export{default as parseArgs}from"./commom/parse-args.mjs";export{CUSTOMCONFIG,default as paths,routeDir,yarnArgv}from"./commom/paths.mjs";export{default as printLog}from"./commom/print-log.mjs";export{default as require}from"./commom/require.mjs";export{default as Rule}from"./commom/rule.mjs";export{default as timer}from"./commom/timer.mjs";export{yApiMock,yApiSchemaMock}from"./dev/mock.mjs";export{default as jsxDomExpressions}from"./options/jsx-dom-expressions.mjs";export{default as splitChunk}from"./options/split-chunk.mjs";export{HtmlPlugin}from"./plugin/html-plugin.mjs";export*from"./plugin/manifest/index.mjs";export{APPTYPE,coreName,FRAMEWORK,isCI,isDev,isLibrary,isMicro,mainDirectory,packageJson,PACKAGENAME}from"./process-env.mjs";export{digest,md5,node_modules,resolveProgram,toCamelCase}from"./utils/index.mjs";export*from"@moneko/mdx";export*from"@moneko/utils";import o from"webpack";export{o as webpack};
|
package/lib/index.mjs.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export type { ReactCompilerOption } from './loader/react-compiler.cjs';
|
|
|
16
16
|
export { type JsxDomExpressions, default as jsxDomExpressions } from './options/jsx-dom-expressions.mjs';
|
|
17
17
|
export { type OptimizationSplitChunksOptions, default as splitChunk } from './options/split-chunk.mjs';
|
|
18
18
|
export type { CompressionPluginOptions } from './plugin/compression.mjs';
|
|
19
|
-
export type
|
|
19
|
+
export { type HtmlMeta, HtmlPlugin, type HtmlPluginOption } from './plugin/html-plugin.mjs';
|
|
20
20
|
export * from './plugin/manifest/index.mjs';
|
|
21
21
|
export type { OverrideResolverOption } from './plugin/override-resolve.mjs';
|
|
22
22
|
export type { VirtualModules } from './plugin/virtual-module.mjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{projectName as t,version as e}from"app:info";let a=`${t}-core-${e}`,i=`${t}-runtime-${e}`,n=self;async function s(t){let e=await caches.open(i),a=await e.match(t);if(a)return a;let n=await fetch(t);return n.ok&&"basic"===n.type&&e.put(t,n.clone()),n}async function c(t){let e=await caches.open(i);try{let a=await fetch(t);return a.ok&&"basic"===a.type&&e.put(t,a.clone()),a}catch{let a=await e.match(t);if(a)return a;return new Response("Offline",{status:503,statusText:"Offline"})}}n.addEventListener("install",t=>{t.waitUntil((async()=>{let t=await caches.open(a),e=await fetch("/app-resource.json").then(t=>t.json()),i=(await Promise.allSettled(e.map(t=>t.startsWith("/")?t:`/${t}`).map(e=>t.add(e)))).filter(t=>"fulfilled"===t.status).length;console.info(`[SW] Precaching ${i}/${e.length} assets`),await n.skipWaiting()})())}),n.addEventListener("activate",t=>{t.waitUntil((async()=>{let t=await caches.keys();await Promise.all(t.filter(t=>![a,i].includes(t)).map(t=>caches.delete(t))),await n.clients.claim(),(await n.clients.matchAll({type:"window"})).forEach(t=>{t.postMessage({type:"SW_UPDATED",version:e})})})())}),n.addEventListener("fetch",t=>{let{request:e}=t;if("GET"!==e.method)return;let a=new URL(e.url);"navigate"===e.mode?t.respondWith(c(e)):a.origin===location.origin&&/\.(js|css|png|jpg|jpeg|svg|webp|woff2?)$/.test(a.pathname)&&t.respondWith(s(e))}),n.addEventListener("message",t=>{t.data?.type==="SKIP_WAITING"&&n.skipWaiting()});
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* 预缓存资源列表
|
|
3
|
-
* @param name 缓存名称
|
|
4
|
-
* @param requests 预缓存请求列表
|
|
5
|
-
* @example
|
|
6
|
-
* precaching('my-cache-v1', [
|
|
7
|
-
* '/index.html',
|
|
8
|
-
* '/styles.css',
|
|
9
|
-
* '/script.js',
|
|
10
|
-
* ]);
|
|
11
|
-
*/ declare function precaching(name: string, requests: RequestInfo[]): void;
|
|
12
|
-
export default precaching;
|
|
1
|
+
export { };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.1",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
"less": "4.5.1",
|
|
145
145
|
"less-loader": "12.3.0",
|
|
146
146
|
"lightningcss": "1.30.2",
|
|
147
|
-
"marked-completed": "1.2.
|
|
147
|
+
"marked-completed": "1.2.15",
|
|
148
148
|
"memfs": "4.51.1",
|
|
149
149
|
"swc-loader": "0.2.6",
|
|
150
150
|
"typescript": "5.9.3",
|
|
@@ -169,5 +169,5 @@
|
|
|
169
169
|
"lib",
|
|
170
170
|
"typings"
|
|
171
171
|
],
|
|
172
|
-
"packageManager": "pnpm@10.26.
|
|
172
|
+
"packageManager": "pnpm@10.26.2"
|
|
173
173
|
}
|
package/typings/typings.d.ts
CHANGED
|
@@ -2,13 +2,10 @@ declare module '*?raw';
|
|
|
2
2
|
declare module '*.cjs';
|
|
3
3
|
declare module '@pmmmwh/react-refresh-webpack-plugin';
|
|
4
4
|
declare module 'package.json';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
declare module 'app:resource' {
|
|
11
|
-
const resource: string[];
|
|
12
|
-
export default resource;
|
|
5
|
+
|
|
6
|
+
declare module 'app:info' {
|
|
7
|
+
export const projectName: string;
|
|
8
|
+
export const version: string;
|
|
9
|
+
|
|
13
10
|
}
|
|
14
11
|
declare let __webpack_public_path__: string;
|