@moneko/core 3.45.0 → 3.46.0-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.
@@ -4,6 +4,7 @@ import { platform } from 'node:process';
4
4
  import { promisify } from 'node:util';
5
5
  import { type CertificateResult, fileExists, generateCert, loadFile, normalCertificateAuthority, println, saveFile } from '@moneko/utils';
6
6
  import log from './log.mjs';
7
+ import { getIPv4 } from './net.mjs';
7
8
  import paths from './paths.mjs';
8
9
  type ExecPromise = (command: string) => PromiseWithChild<{
9
10
  stdout: string;
package/lib/commom/ca.mjs CHANGED
@@ -1 +1 @@
1
- import{exec as t}from"node:child_process";import{join as e,relative as r}from"node:path";import{platform as o}from"node:process";import{promisify as i}from"node:util";import{fileExists as a,generateCert as n,loadFile as c,normalCertificateAuthority as l,println as s,saveFile as m}from"@moneko/utils";import u from"./log.mjs";import f from"./paths.mjs";let p=i(t);async function d(t){try{if("darwin"===o){let{stdout:e}=await p(`security find-certificate -c "${t}" -a`);return e.length>0}if("win32"===o){let{stdout:e}=await p(`certutil -store -user Root | findstr /C:"${t}"`);return e.length>0}}catch(t){u(t)}return!1}function y(t,e,r){if(t&&!r.includes("already exists")){u(t);return}}export function installCA(e){return"darwin"===o?t(`sudo security add-trusted-cert -d -r trustRoot -k "/Library/Keychains/System.keychain" "${e}"`,y):"win32"===o?t(`certutil -addstore -user "Root" "${e}"`,y):void s(`⚠️ 暂不支持自动安装 CA 的平台: ${o}`)}export async function setupCert(t="localhost",o=!0){let i=r(f.programPath,`${f.corePath}/cert/cert.pem`),s=r(f.programPath,`${f.corePath}/cert/key.pem`),u=!a(i)||!a(s);if(u){let t=l();await Promise.all([m(i,t.cert),m(s,t.key)])}o&&(!await d("Local Root Certificate Authority - Moneko")||u)&&installCA(i);let p=e(f.CA_DIR,`${t}_cert.pem`),y=e(f.CA_DIR,`${t}_key.pem`);if(u||!a(p)||!a(y)){let e=await Promise.all([c(i),c(s)]),r=n(e[0],e[1],t);await Promise.all([m(p,r.cert),m(y,r.key)])}let h=await Promise.all([c(p),c(y)]);return{cert:h[0],key:h[1]}}
1
+ import{exec as t}from"node:child_process";import{join as e,relative as r}from"node:path";import{platform as o}from"node:process";import{promisify as i}from"node:util";import{fileExists as a,generateCert as n,loadFile as l,normalCertificateAuthority as c,println as s,saveFile as m}from"@moneko/utils";import u from"./log.mjs";import{getIPv4 as f}from"./net.mjs";import p from"./paths.mjs";let d=i(t);async function y(t){try{if("darwin"===o){let{stdout:e}=await d(`security find-certificate -c "${t}" -a`);return e.length>0}if("win32"===o){let{stdout:e}=await d(`certutil -store -user Root | findstr /C:"${t}"`);return e.length>0}}catch(t){u(t)}return!1}function h(t,e,r){if(t&&!r.includes("already exists")){u(t);return}}export function installCA(e){return"darwin"===o?t(`sudo security add-trusted-cert -d -r trustRoot -k "/Library/Keychains/System.keychain" "${e}"`,h):"win32"===o?t(`certutil -addstore -user "Root" "${e}"`,h):void s(`⚠️ 暂不支持自动安装 CA 的平台: ${o}`)}export async function setupCert(t="localhost",o=!0){let i=r(p.programPath,`${p.corePath}/cert/cert.pem`),s=r(p.programPath,`${p.corePath}/cert/key.pem`),u=!a(i)||!a(s);if(u){let t=c();await Promise.all([m(i,t.cert),m(s,t.key)])}o&&(!await y("Local Root Certificate Authority - Moneko")||u)&&installCA(i);let d=e(p.CA_DIR,`${t}_cert.pem`),h=e(p.CA_DIR,`${t}_key.pem`);if(u||!a(d)||!a(h)){let e=await Promise.all([l(i),l(s)]),r=n(e[0],e[1],[...new Set([t,"localhost","127.0.0.1",f()].filter(Boolean))]);await Promise.all([m(d,r.cert),m(h,r.key)])}let w=await Promise.all([l(d),l(h)]);return{cert:w[0],key:w[1]}}
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 a,CUSTOMCONFIG as n,TMP_DIR as i}from"./commom/paths.mjs";import r from"./commom/require.mjs";import l from"./plugin/override-resolve.mjs";import{isObject as m,node_modules as c,resolveProgram as p}from"./utils/index.mjs";import{exampleModuleName as u}from"./vm/example.mjs";import d from"./vm/info.mjs";import{CONFIG as h,PUBLICPATH as f}from"./config.mjs";import g from"./plugins.config.mjs";import{isCI as b,isDev as y,isLibrary as j,NODE_ENV as v,packageJson as C}from"./process-env.mjs";export const outputConfig={path:p(j?"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:`${d.projectName}`,type:"umd",umdNamedDefine:!0},globalObject:"self",chunkLoadingGlobal:`webpackJsonp_${C.name}`,pathinfo:y,clean:!y,publicPath:f,asyncChunks:!0,charset:!0,iife:!0,crossOriginLoading:"use-credentials",enabledWasmLoadingTypes:["fetch"]};let x={main:[c("@app/entry")]};if(h.polyfill&&x.main.unshift(t(s.corePath,"./polyfills/replace-children.mjs")),y&&h.refresh&&h.env.injectRemoteReactRefresh&&x.main.unshift(r.resolve("@moneko/react/lib/injectRemoteReactRefresh.js")),h.entry&&("string"==typeof h.entry?x={main:[h.entry]}:Object.keys(h.entry)&&(x=Object.assign(x,h.entry))),"string"==typeof x.main&&(x.main=[x.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 k={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:s.webpackCachePath,memoryCacheUnaffected:!0,name:`.${[n,v].filter(Boolean).join("-")}`,version:`${C.version}`,buildDependencies:{config:a},maxMemoryGenerations:1};!1===h.cache?k=!1:m(h.cache)&&(k=Object.assign(k,h.cache)),b&&(void 0===h.cache||h.cache&&!h.cache.cacheDirectory)&&(k.cacheDirectory=o(i,C.name));export const commonConfig={name:"client",target:"web",devtool:h.devtool,entry:x,mode:y?"development":"production",stats:"errors-only",cache:k,snapshot:{immutablePaths:[s.pnpmNodeModules,s.denoNodeModules,/node_modules\/(?!(@app)\/)/],managedPaths:[s.pnpmNodeModules,s.denoNodeModules,/node_modules\/(?!(@app)\/)/],resolveBuildDependencies:{timestamp:!0,hash:!0},resolve:{timestamp:!0,hash:!0},module:{timestamp:!0,hash:!0},buildDependencies:{timestamp:!0,hash:!0}},infrastructureLogging:{level:"error"},externalsPresets:h.externalsPresets,plugins:g,node:{global:!1,__filename:!1,__dirname:!1},experiments:{topLevelAwait:!0,asyncWebAssembly:!0,cacheUnaffected:!0,layers:!0,lazyCompilation:h.lazyCompilation&&y&&{imports:!0,entries:!0,test:e=>{let t=e.nameForCondition();return!!(t&&(t.startsWith(c(u))||t.startsWith(c("@app/comment"))||t.startsWith(s.pagesPath)||t.startsWith(s.componentsPath)))}},buildHttp:m(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,recordsPath:t(s.webpackCachePath,"records.json")};h.overrideResolve&&commonConfig.resolve.plugins.push(new l(Object.assign({original:h.alias["@"],override:n&&p(n)},h.overrideResolve)));
1
+ import{extname as e,join as t,resolve as o}from"node:path";import s,{config_files as a,CUSTOMCONFIG as n,TMP_DIR as i}from"./commom/paths.mjs";import r from"./commom/require.mjs";import l from"./plugin/override-resolve.mjs";import{isObject as m,node_modules as c,resolveProgram as p}from"./utils/index.mjs";import{exampleModuleName as u}from"./vm/example.mjs";import d from"./vm/info.mjs";import{CONFIG as h,PUBLICPATH as f}from"./config.mjs";import g from"./plugins.config.mjs";import{isCI as b,isDev as y,isLibrary as j,NODE_ENV as v,packageJson as C}from"./process-env.mjs";export const outputConfig={path:p(j?"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:`${d.projectName}`,type:"umd",umdNamedDefine:!0},globalObject:"self",chunkLoadingGlobal:`webpackJsonp_${C.name}`,pathinfo:y,clean:!y,publicPath:f,asyncChunks:!0,charset:!0,iife:!0,crossOriginLoading:"use-credentials",enabledWasmLoadingTypes:["fetch"]};let P={main:[c("@app/entry")]};if(h.polyfill&&P.main.unshift(t(s.corePath,"./polyfills/replace-children.mjs")),y&&h.refresh&&h.env.injectRemoteReactRefresh&&P.main.unshift(r.resolve("@moneko/react/lib/injectRemoteReactRefresh.js")),h.entry&&("string"==typeof h.entry?P={main:[h.entry]}:Object.keys(h.entry)&&(P=Object.assign(P,h.entry))),"string"==typeof P.main&&(P.main=[P.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 x={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:s.webpackCachePath,memoryCacheUnaffected:!0,name:`.${[n,v].filter(Boolean).join("-")}`,version:`${C.version}`,buildDependencies:{config:a},maxMemoryGenerations:1};!1===h.cache?x=!1:m(h.cache)&&(x=Object.assign(x,h.cache)),b&&(void 0===h.cache||h.cache&&!h.cache.cacheDirectory)&&(x.cacheDirectory=o(i,C.name));export const commonConfig={name:"client",target:"web",devtool:h.devtool,entry:P,mode:y?"development":"production",stats:"errors-only",cache:x,snapshot:{immutablePaths:[s.pnpmNodeModules,s.denoNodeModules,/node_modules\/(?!(@app)\/)/],managedPaths:[s.pnpmNodeModules,s.denoNodeModules,/node_modules\/(?!(@app)\/)/],resolveBuildDependencies:{timestamp:!0,hash:!0},resolve:{timestamp:!0,hash:!0},module:{timestamp:!0,hash:!0},buildDependencies:{timestamp:!0,hash:!0}},infrastructureLogging:{level:"error"},externalsPresets:h.externalsPresets,plugins:g,node:{global:!1,__filename:!1,__dirname:!1},experiments:{topLevelAwait:!0,asyncWebAssembly:!0,cacheUnaffected:!0,layers:!0,lazyCompilation:h.lazyCompilation&&y&&{imports:!0,entries:!0,test:e=>{let t=e.nameForCondition();return!!(t&&(t.startsWith(c(u))||t.startsWith(c("@app/comment"))||t.startsWith(s.pagesPath)||t.startsWith(s.componentsPath)))}},buildHttp:m(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,recordsPath:h.recordsPath?t(s.programPath,h.recordsPath):t(s.webpackCachePath,"records.json")};h.overrideResolve&&commonConfig.resolve.plugins.push(new l(Object.assign({original:h.alias["@"],override:n&&p(n)},h.overrideResolve)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.45.0",
3
+ "version": "3.46.0-beta.0",
4
4
  "description": "core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",
@@ -111,11 +111,11 @@
111
111
  "@moneko/eslint": "1.5.0",
112
112
  "@moneko/mdx": "0.1.44",
113
113
  "@moneko/raw-import": "0.0.3",
114
- "@moneko/stylelint": "1.3.0",
114
+ "@moneko/stylelint": "1.4.0",
115
115
  "@moneko/transform-imports": "0.6.1",
116
- "@moneko/utils": "0.3.2",
116
+ "@moneko/utils": "0.3.3",
117
117
  "@swc/core": "1.6.13",
118
- "browserslist": "4.24.5",
118
+ "browserslist": "4.25.0 ",
119
119
  "chokidar": "4.0.3",
120
120
  "core-js": "3.42.0",
121
121
  "core-js-compat": "3.42.0",
@@ -129,7 +129,7 @@
129
129
  "style-loader": "4.0.0",
130
130
  "swc-loader": "0.2.6",
131
131
  "typescript": "5.8.3",
132
- "webpack": "5.99.8",
132
+ "webpack": "5.99.9",
133
133
  "webpack-hot-middleware": "2.26.1",
134
134
  "webpack-merge": "6.0.1",
135
135
  "webpack-virtual-modules": "0.6.2"
@@ -140,7 +140,7 @@
140
140
  "@types/stylis": "4.2.7",
141
141
  "@types/webpack-bundle-analyzer": "4.7.0",
142
142
  "@types/webpack-hot-middleware": "2.25.9",
143
- "sass": "1.89.0",
143
+ "sass": "1.89.1",
144
144
  "sass-loader": "16.0.5",
145
145
  "solid-refresh": "0.7.5",
146
146
  "stylis": "4.3.6",
@@ -154,4 +154,4 @@
154
154
  "lib",
155
155
  "typings"
156
156
  ]
157
- }
157
+ }
@@ -526,6 +526,7 @@ export declare type ConfigType = {
526
526
  * 是否进行压缩
527
527
  */
528
528
  compression?: boolean | Partial<CompressionPluginOptions>;
529
+ recordsPath?: string;
529
530
  };
530
531
 
531
532
  /**