@moneko/core 3.29.4 → 3.30.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.
@@ -1,6 +1,6 @@
1
1
  import { relative } from 'node:path';
2
2
  import { argv } from 'node:process';
3
+ import { ESLint } from '@moneko/eslint';
3
4
  import { ink, print } from '@moneko/utils';
4
- import { ESLint } from 'eslint';
5
5
  import { cachePath, cwd, parseBraced } from './utils/config.mjs';
6
6
  export default async function eslint();
@@ -1,2 +1,2 @@
1
- import{relative as e}from"node:path";import{argv as t}from"node:process";import{ink as o,print as i}from"@moneko/utils";import{ESLint as r}from"eslint";import{cachePath as s,cwd as a,parseBraced as c}from"./utils/config.mjs";export default async function l(){let l=o("eslint","cyan");i(`${l}: ${o("Runing...","yellow")}`,!0);let n=t[3],m=t.slice(4),f=m.includes("--fix"),u=new r({cache:!m.includes("--cache=false"),cacheLocation:`${s}/.eslintcache`,fix:f}),p=c(n).map(t=>e(a,t)),d=await u.lintFiles(p),w=await u.loadFormatter("stylish"),h=await w.format(d);f&&await r.outputFixes(d),h&&process.stdout.write(h);let $=d.some(e=>e.errorCount>0);i(`${l}: ${o(`✨ ${$?"Error":"Successfully"}!
1
+ import{relative as e}from"node:path";import{argv as o}from"node:process";import{ESLint as t}from"@moneko/eslint";import{ink as i,print as r}from"@moneko/utils";import{cachePath as s,cwd as a,parseBraced as c}from"./utils/config.mjs";export default async function l(){let l=i("eslint","cyan");r(`${l}: ${i("Runing...","yellow")}`,!0);let n=o[3],m=o.slice(4),f=m.includes("--fix"),u=new t({cache:!m.includes("--cache=false"),cacheLocation:`${s}/.eslintcache`,fix:f}),p=c(n).map(o=>e(a,o)),d=await u.lintFiles(p),w=await u.loadFormatter("stylish"),h=await w.format(d);f&&await t.outputFixes(d),h&&process.stdout.write(h);let $=d.some(e=>e.errorCount>0);r(`${l}: ${i(`✨ ${$?"Error":"Successfully"}!
2
2
  `,$?"red":"green")}`,!0),$&&process.exit(1)}
@@ -2,8 +2,8 @@ import { spawnSync, type SpawnSyncReturns } from 'node:child_process';
2
2
  import { readFile } from 'node:fs/promises';
3
3
  import { join } from 'node:path';
4
4
  import { argv } from 'node:process';
5
+ import { ESLint } from '@moneko/eslint';
5
6
  import { stylelint as Stylelint } from '@moneko/stylelint';
6
- import { ESLint } from 'eslint';
7
7
  declare function parseArgs<T>(args: string[]): T;
8
8
  type Args = {
9
9
  fix?: boolean;
@@ -22,7 +22,7 @@ declare const cmd: {
22
22
  declare const scriptRegExp: RegExp;
23
23
  declare const vueRegExp: RegExp;
24
24
  declare const styleRegExp: RegExp;
25
- declare const child: SpawnSyncReturns<Buffer<ArrayBufferLike>>;
25
+ declare const child: SpawnSyncReturns<Buffer>;
26
26
  declare const lintFiles: string[];
27
27
  export declare async function eslint();
28
28
  declare const styleFiles: string[];
@@ -1 +1 @@
1
- import{spawnSync as t}from"node:child_process";import{readFile as e}from"node:fs/promises";import{join as o}from"node:path";import{argv as i}from"node:process";import{stylelint as s}from"@moneko/stylelint";import{ESLint as r}from"eslint";let n=Object.fromEntries(i.slice(2).map(function(t){let e=t.split("="),o=e[1];return void 0===o||"true"===o?o=!0:"false"===o?o=!1:/-?\d+(\.\d+)?([eE][+-]?\d+)?/.test(o)&&(o=parseFloat(o)),[e[0].replace(/^--/,""),o]})),l=n.fix,c=n.cache||!0,a=o(process.cwd(),"node_modules/.cache"),m={ci:["diff","--name-only","HEAD^","HEAD"],commit:["diff","--cached","--name-only","--diff-filter=ACMR"]},d=/.*(?<!\.d)\.(j|t|mj|mt|cj|ct)sx?$/,f=/.*(?<!\.d)\.vue$/,p=/.*(?<!\.d)\.(c|sc|sa|le)ss$/,u=t("git",m[n.mode||"ci"]||m.ci).stdout.toString().trim().split("\n");export async function eslint(){console.log("ESLint runing..."),console.time("ESLint");let t=new r({cache:c,cacheLocation:`${a}/.eslintcache`,fix:l}),e=u.filter(t=>d.test(t)||f.test(t)),o=await t.lintFiles(e),i=await t.loadFormatter("stylish"),s=await i.format(o);l&&await r.outputFixes(o),s&&process.stdout.write(s);let n=o.some(t=>t.errorCount>0);console.timeEnd("ESLint"),n&&process.exit(1)}let y=u.filter(t=>p.test(t)||f.test(t));export async function stylelint(){console.log("Stylelint runing..."),console.time("Stylelint");let t=await Promise.all(y.map(async t=>{let o=await e(t,{encoding:"utf-8"});return await s.lint({codeFilename:t,code:o,cache:c,cacheLocation:`${a}/.stylelintcache`,fix:l,formatter:"string"}).catch(console.log)})),o=!1;t.forEach(t=>{t&&(t.report&&process.stdout.write(t.report),t.errored&&(o=!!t.errored))}),console.timeEnd("Stylelint"),o&&process.exit(1)}
1
+ import{spawnSync as t}from"node:child_process";import{readFile as e}from"node:fs/promises";import{join as o}from"node:path";import{argv as i}from"node:process";import{ESLint as r}from"@moneko/eslint";import{stylelint as s}from"@moneko/stylelint";let n=Object.fromEntries(i.slice(2).map(function(t){let e=t.split("="),o=e[1];return void 0===o||"true"===o?o=!0:"false"===o?o=!1:/-?\d+(\.\d+)?([eE][+-]?\d+)?/.test(o)&&(o=parseFloat(o)),[e[0].replace(/^--/,""),o]})),c=n.fix,l=n.cache||!0,a=o(process.cwd(),"node_modules/.cache"),m={ci:["diff","--name-only","HEAD^","HEAD"],commit:["diff","--cached","--name-only","--diff-filter=ACMR"]},d=/.*(?<!\.d)\.(j|t|mj|mt|cj|ct)sx?$/,f=/.*(?<!\.d)\.vue$/,p=/.*(?<!\.d)\.(c|sc|sa|le)ss$/,u=t("git",m[n.mode||"ci"]||m.ci).stdout.toString().trim().split("\n");export async function eslint(){console.log("ESLint runing...");try{console.time("ESLint");let t=new r({cache:l,cacheLocation:`${a}/.eslintcache`,fix:c}),e=u.filter(t=>d.test(t)||f.test(t)),o=await t.lintFiles(e),i=await t.loadFormatter("stylish"),s=await i.format(o);c&&await r.outputFixes(o),s&&process.stdout.write(s);let n=o.some(t=>t.errorCount>0);console.timeEnd("ESLint"),n&&process.exit(1)}catch(t){console.error(t)}}let y=u.filter(t=>p.test(t)||f.test(t));export async function stylelint(){console.log("Stylelint runing..."),console.time("Stylelint");let t=await Promise.all(y.map(async t=>{let o=await e(t,{encoding:"utf-8"});return await s.lint({codeFilename:t,code:o,cache:l,cacheLocation:`${a}/.stylelintcache`,fix:c,formatter:"string"}).catch(console.log)})),o=!1;t.forEach(t=>{t&&(t.report&&process.stdout.write(t.report),t.errored&&(o=!!t.errored))}),console.timeEnd("Stylelint"),o&&process.exit(1)}
package/lib/common.d.mts CHANGED
@@ -8,7 +8,7 @@ import { exampleModuleName } from './vm/example.mjs';
8
8
  import app from './vm/info.mjs';
9
9
  import { CONFIG, PUBLICPATH } from './config.mjs';
10
10
  import plugins from './plugins.config.mjs';
11
- import { isDev, isLibrary, NODE_ENV, PACKAGENAME, PACKAGEVERSION } from './process-env.mjs';
11
+ import { isDev, isLibrary, NODE_ENV, packageJson } from './process-env.mjs';
12
12
  export declare const outputConfig: Configuration['output'];
13
13
  declare let entryMap: {
14
14
  readonly main: string[];
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 d}from"./config.mjs";import f from"./plugins.config.mjs";import{isDev as g,isLibrary as b,NODE_ENV as y,PACKAGENAME as j,PACKAGEVERSION as v}from"./process-env.mjs";export const outputConfig={path:p(b?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:`js/[${g?"name":"contenthash"}].js`,assetModuleFilename:t=>{let o=e(t.filename||"").substring(1);return`assets/${o}/[name][hash][ext]`},library:{name:`${u.projectName}`,type:"umd",umdNamedDefine:!0},globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${j}`,pathinfo:g,clean:!0,publicPath:d,asyncChunks:!0,charset:!0,iife:!0,crossOriginLoading:"anonymous",enabledWasmLoadingTypes:["fetch"],hotUpdateChunkFilename:"[id].[fullhash].hot.js",hotUpdateMainFilename:"[runtime].[fullhash].hot.json"};let C={main:[m("@app/entry")]};if(h.polyfill&&C.main.unshift(t(s.corePath,"./polyfills/replace-children.mjs")),g&&h.refresh&&h.env.injectRemoteReactRefresh&&C.main.unshift(i.resolve("@moneko/react/lib/injectRemoteReactRefresh.js")),h.entry&&("string"==typeof h.entry?C={main:[h.entry]}:Object.keys(h.entry)&&(C=Object.assign(C,h.entry))),"string"==typeof C.main&&(C.main=[C.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:`.${[a,y].filter(Boolean).join("-")}`,version:`${v}`,buildDependencies:{config:n}};!1===h.cache?k=!1:l(h.cache)&&(k=Object.assign(k,h.cache));export const commonConfig={name:"client",target:"web",devtool:h.devtool,entry:C,mode:g?"development":"production",stats:"errors-only",cache:k,snapshot:{immutablePaths:[/node_modules\/(?!(@app|@moneko)\/)/],managedPaths:[/^@app\/.+/,/^@moneko\/.+/],buildDependencies:{timestamp:!0,hash:!0}},infrastructureLogging:{level:"error"},externalsPresets:h.externalsPresets,plugins:f,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)));
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 d}from"./config.mjs";import f 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].bundle.js",chunkFilename:`js/[${g?"name":"contenthash"}].js`,assetModuleFilename:t=>{let o=e(t.filename||"").substring(1);return`assets/${o}/[name][hash][ext]`},library:{name:`${u.projectName}`,type:"umd",umdNamedDefine:!0},globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${j.name}`,pathinfo:g,clean:!0,publicPath:d,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:f,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/index.d.mts CHANGED
@@ -13,6 +13,6 @@ export { type OptimizationSplitChunksOptions, default as splitChunk } from './op
13
13
  export type { HtmlMeta, HtmlPluginOption } from './plugin/html-plugin.mjs';
14
14
  export type { OverrideResolverOption } from './plugin/override-resolve.mjs';
15
15
  export type { VirtualModulePluginOption } from './plugin/virtual-module.mjs';
16
- export { APPTYPE, coreName, FRAMEWORK, isDev, isLibrary, isMicro, mainDirectory, PACKAGENAME, PACKAGEVERSION } from './process-env.mjs';
16
+ export { APPTYPE, coreName, FRAMEWORK, isDev, isLibrary, isMicro, mainDirectory, packageJson, PACKAGENAME } from './process-env.mjs';
17
17
  export { resolveProgram, toCamelCase } from './utils/index.mjs';
18
18
  export type { MdxOptions } from '@moneko/mdx';
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{CUSTOMCONFIG,default as paths,routeDir,yarnArgv}from"./commom/paths.mjs";export{default as require}from"./commom/require.mjs";export{default as Rule}from"./commom/rule.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{APPTYPE,coreName,FRAMEWORK,isDev,isLibrary,isMicro,mainDirectory,PACKAGENAME,PACKAGEVERSION}from"./process-env.mjs";export{resolveProgram,toCamelCase}from"./utils/index.mjs";
1
+ export{default as hasPkg}from"./commom/has-pkg.mjs";export{getIPv4,getPort}from"./commom/net.mjs";export{CUSTOMCONFIG,default as paths,routeDir,yarnArgv}from"./commom/paths.mjs";export{default as require}from"./commom/require.mjs";export{default as Rule}from"./commom/rule.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{APPTYPE,coreName,FRAMEWORK,isDev,isLibrary,isMicro,mainDirectory,packageJson,PACKAGENAME}from"./process-env.mjs";export{resolveProgram,toCamelCase}from"./utils/index.mjs";
@@ -3,7 +3,7 @@ import VirtualModulesPlugin from 'webpack-virtual-modules';
3
3
  import parseModuleMeta from '../commom/parse-module-meta.mjs';
4
4
  import paths from '../commom/paths.mjs';
5
5
  import { isLibrary } from '../process-env.mjs';
6
- import { node_modules } from '../utils/index.mjs';
6
+ import { node_modules, transformModule } from '../utils/index.mjs';
7
7
  import { comment, docs } from '../vm/docs.mjs';
8
8
  import { examples } from '../vm/example.mjs';
9
9
  import { locales } from '../vm/locales.mjs';
@@ -1 +1 @@
1
- import t from"webpack-virtual-modules";import o from"../commom/parse-module-meta.mjs";import i from"../commom/paths.mjs";import{isLibrary as e}from"../process-env.mjs";import{node_modules as s}from"../utils/index.mjs";import{comment as r,docs as l}from"../vm/docs.mjs";import{examples as m}from"../vm/example.mjs";import{locales as n}from"../vm/locales.mjs";import p from"../vm/modules.mjs";import{route as a}from"../vm/routes.mjs";let f={};for(let t in p)if(Object.prototype.hasOwnProperty.call(p,t)){let{file:i,pkg:e,meta:s}=o(t);f[e]=s,f[i]=p[t]}export class VirtualModuleWebpackPlugin{constructor(i={}){this.options={},this.init=!1,this.virtualModules=new t(f);let e={};for(let t in i)if(Object.prototype.hasOwnProperty.call(i,t)){let{file:s,pkg:r,meta:l}=o(t),m=i[t],n=m;n=s.endsWith("json")?"string"==typeof m?m:JSON.stringify(m):"string"==typeof m?m:`export default ${JSON.stringify(m)}`,Object.assign(e,{[s]:n,[r]:l})}this.options=e}modify(t,o,e){let r=e||"",l=o.startsWith(i.nodeModules)?o:s(o),m=t.inputFileSystem;for(;m&&m._inputFileSystem;)m=m._inputFileSystem;let n=m?._virtualFiles?.[l];n&&n.contents===r||(this.virtualModules.writeModule(l,r),t.watching?.invalidate())}apply(t){this.virtualModules.apply(t);let o=(o,i)=>{this.modify(t,o,i)};a.on("change",o),n.on("change",o),e&&(m.on("change",o),l.on("change",o),r.on("change",o)),t.hooks.compilation.tap("VirtualModuleWebpackPlugin",()=>{if(!this.init){for(let t in this.init=!0,this.options)Object.prototype.hasOwnProperty.call(this.options,t)&&o(t,this.options[t]);for(let t of m)o(t[0],t[1]);for(let t of l)o(t[0],t[1]);for(let t of r)o(t[0],t[1])}})}}
1
+ import t from"webpack-virtual-modules";import o from"../commom/parse-module-meta.mjs";import i from"../commom/paths.mjs";import{isLibrary as e}from"../process-env.mjs";import{node_modules as s,transformModule as r}from"../utils/index.mjs";import{comment as l,docs as m}from"../vm/docs.mjs";import{examples as n}from"../vm/example.mjs";import{locales as p}from"../vm/locales.mjs";import a from"../vm/modules.mjs";import{route as f}from"../vm/routes.mjs";let c={};for(let t in a)if(Object.prototype.hasOwnProperty.call(a,t)){let{file:i,pkg:e,meta:s}=o(t);c[e]=s,c[i]=r(a[t])}export class VirtualModuleWebpackPlugin{constructor(i={}){this.options={},this.init=!1,this.virtualModules=new t(c);let e={};for(let t in i)if(Object.prototype.hasOwnProperty.call(i,t)){let{file:s,pkg:l,meta:m}=o(t),n=i[t],p=n;p=s.endsWith("json")?"string"==typeof n?n:JSON.stringify(n):r(n),Object.assign(e,{[s]:p,[l]:m})}this.options=e}modify(t,o,e){let r=e||"",l=o.startsWith(i.nodeModules)?o:s(o),m=t.inputFileSystem;for(;m&&m._inputFileSystem;)m=m._inputFileSystem;let n=m?._virtualFiles?.[l];n&&n.contents===r||(this.virtualModules.writeModule(l,r),t.watching?.invalidate())}apply(t){this.virtualModules.apply(t);let o=(o,i)=>{this.modify(t,o,i)};f.on("change",o),p.on("change",o),e&&(n.on("change",o),m.on("change",o),l.on("change",o)),t.hooks.compilation.tap("VirtualModuleWebpackPlugin",()=>{if(!this.init){for(let t in this.init=!0,this.options)Object.prototype.hasOwnProperty.call(this.options,t)&&o(t,this.options[t]);for(let t of n)o(t[0],t[1]);for(let t of m)o(t[0],t[1]);for(let t of l)o(t[0],t[1])}})}}
@@ -0,0 +1,2 @@
1
+ import { ESLint } from '@moneko/eslint';
2
+ import { parentPort } from 'worker_threads';
@@ -0,0 +1 @@
1
+ import{ESLint as e}from"@moneko/eslint";import{parentPort as a}from"worker_threads";if(!a)throw Error("This file must be run as a worker");a.on("message",async({options:t})=>{try{let o=new e({cache:t.cache,cacheLocation:t.cacheLocation,fix:t.fix}),r=t.files.map(e=>e.replace(/\\/g,"/")),i=await o.lintFiles(r),s=await o.loadFormatter("json"),c=await s.format(i);t.fix&&await e.outputFixes(i),c&&process.stdout.write(c),a.postMessage({linter:i})}catch(e){a.postMessage(e)}});
@@ -4,6 +4,6 @@ import { HtmlMeta, HtmlPlugin } from './plugin/html-plugin.mjs';
4
4
  import moduleFederation from './plugin/module-federation.mjs';
5
5
  import { VirtualModuleWebpackPlugin } from './plugin/virtual-module.mjs';
6
6
  import { CONFIG } from './config.mjs';
7
- import { description, keywords } from './process-env.mjs';
7
+ import { packageJson } from './process-env.mjs';
8
8
  declare const plugins: WebpackPluginInstance[];
9
9
  export default plugins;
@@ -1 +1 @@
1
- import e from"webpack";import{CopyPlugin as t}from"./plugin/copy.mjs";import{HtmlPlugin as i}from"./plugin/html-plugin.mjs";import o from"./plugin/module-federation.mjs";import{VirtualModuleWebpackPlugin as l}from"./plugin/virtual-module.mjs";import{CONFIG as r}from"./config.mjs";import{description as n,keywords as p}from"./process-env.mjs";let a=[...o,new l(r.virtualModule),new t(r.copy),new e.DefinePlugin({"process.env":JSON.stringify(r.env)}),new e.IgnorePlugin({resourceRegExp:/\/(__(tests|mocks)__|test|spec|e2e)\//}),...r.plugins].filter(Boolean);if(r.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:n,keywords:Array.isArray(p)?p.toString():"","http-equiv":"refresh",viewport:"width=device-width, initial-scale=1"};r.seo&&(e.relCanonical={rel:"canonical",href:`https://${r.seo.domain}${r.basename}`}),r.htmlPluginOption.meta&&Object.assign(e,r.htmlPluginOption.meta),a.push(new i({...r.htmlPluginOption,meta:e}))}if(r.fixBrowserRouter){let e=r.basename.split("/").filter(Boolean).length,t=`${Array(e).fill("..").join("/")+(e?"/":"")}404.html`,o=r.fixBrowserRouter.pathSegmentsToKeep??e;a.push(new i({filename:r.fixBrowserRouter.path??t,inject:!1,templateContent:()=>`<html lang="en"><head><title>Redirect</title><script>const pathKeep = ${o};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>`}))}r.sourceMap&&a.push(new e.SourceMapDevToolPlugin(r.sourceMap));export default a;
1
+ import e from"webpack";import{CopyPlugin as t}from"./plugin/copy.mjs";import{HtmlPlugin as i}from"./plugin/html-plugin.mjs";import o from"./plugin/module-federation.mjs";import{VirtualModuleWebpackPlugin as r}from"./plugin/virtual-module.mjs";import{CONFIG as l}from"./config.mjs";import{packageJson as n}from"./process-env.mjs";let p=[...o,new r(l.virtualModule),new t(l.copy),new e.DefinePlugin({"process.env":JSON.stringify(l.env)}),new e.IgnorePlugin({resourceRegExp:/\/(__(tests|mocks)__|test|spec|e2e)\//}),...l.plugins].filter(Boolean);if(l.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:n.description,keywords:Array.isArray(n.keywords)?n.keywords.toString():"","http-equiv":"refresh",viewport:"width=device-width, initial-scale=1"};l.seo&&(e.relCanonical={rel:"canonical",href:`https://${l.seo.domain}${l.basename}`}),l.htmlPluginOption.meta&&Object.assign(e,l.htmlPluginOption.meta),p.push(new i({...l.htmlPluginOption,meta:e}))}if(l.fixBrowserRouter){let e=l.basename.split("/").filter(Boolean).length,t=`${Array(e).fill("..").join("/")+(e?"/":"")}404.html`,o=l.fixBrowserRouter.pathSegmentsToKeep??e;p.push(new i({filename:l.fixBrowserRouter.path??t,inject:!1,templateContent:()=>`<html lang="en"><head><title>Redirect</title><script>const pathKeep = ${o};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>`}))}l.sourceMap&&p.push(new e.SourceMapDevToolPlugin(l.sourceMap));export default p;
@@ -17,13 +17,8 @@ export declare const jsxImportSource: string;
17
17
  export declare const framework: 'react' | 'solid-js';
18
18
  export declare const frameworkVersionStr: string;
19
19
  export declare const frameworkVersion: number;
20
- declare const info: Record<string, unknown>;
21
- export declare const description: string;
22
- export declare const author: string | Record<string, string>;
23
- export declare const repository: string;
24
- export declare const keywords: string[];
20
+ export declare const packageJson: Record<string, unknown>;
25
21
  export declare const PACKAGENAME: string;
26
- export declare const PACKAGEVERSION: string;
27
22
  export declare const coreName: string;
28
23
  export declare const isDev: boolean;
29
24
  export declare const refresh: boolean;
@@ -1 +1 @@
1
- import{platform as o}from"node:process";import r from"./commom/has-pkg.mjs";import e from"./commom/require.mjs";export const IS_WINDOW="win32"===o;export const APPTYPE=process.env.APPTYPE;export const FRAMEWORK=process.env.FRAMEWORK;export const NODE_ENV=process.env.NODE_ENV;export const isLibrary="library"===APPTYPE;export const isMicro="micro"===APPTYPE;export const isMobile="mobile"===APPTYPE;export const isReact="react"===FRAMEWORK;export const isSolid="solid"===FRAMEWORK;export const SSR="true"===process.env.SSR;export const mainDirectory=isLibrary?"site":"src";export const jsxImportSource={react:"react",solid:"solid-js/h"}[FRAMEWORK];export const framework={react:"react",solid:"solid-js"}[FRAMEWORK];export const frameworkVersionStr=e(`${framework}/package.json`).version;export const frameworkVersion=parseFloat(frameworkVersionStr);let s=e(`${process.cwd()}/package.json`);export const description=s.description;export const author=s.author;export const repository=s.repository;export const keywords=s.keywords;export const PACKAGENAME=s.name;export const PACKAGEVERSION=s.version;export const coreName="@moneko/core";export const isDev="development"===NODE_ENV;export const refresh=!!(isDev&&(r("solid-refresh")||r("react-refresh")));
1
+ import{platform as o}from"node:process";import e from"./commom/has-pkg.mjs";import r from"./commom/require.mjs";export const IS_WINDOW="win32"===o;export const APPTYPE=process.env.APPTYPE;export const FRAMEWORK=process.env.FRAMEWORK;export const NODE_ENV=process.env.NODE_ENV;export const isLibrary="library"===APPTYPE;export const isMicro="micro"===APPTYPE;export const isMobile="mobile"===APPTYPE;export const isReact="react"===FRAMEWORK;export const isSolid="solid"===FRAMEWORK;export const SSR="true"===process.env.SSR;export const mainDirectory=isLibrary?"site":"src";export const jsxImportSource={react:"react",solid:"solid-js/h"}[FRAMEWORK];export const framework={react:"react",solid:"solid-js"}[FRAMEWORK];export const frameworkVersionStr=r(`${framework}/package.json`).version;export const frameworkVersion=parseFloat(frameworkVersionStr);export const packageJson=r(`${process.cwd()}/package.json`);delete packageJson.scripts;export const PACKAGENAME=packageJson.name;export const coreName="@moneko/core";export const isDev="development"===NODE_ENV;export const refresh=!!(isDev&&(e("solid-refresh")||e("react-refresh")));
@@ -8,4 +8,5 @@ export declare function node_modules<T extends string>(name: T): `node_modules/$
8
8
  export declare function isObject(target: unknown): target is object;
9
9
  type AnyFunction = (...a: any[]) => any;
10
10
  export declare function isFunction<T>(target: T): target is T & AnyFunction;
11
+ export declare function transformModule(obj: object | string);
11
12
  export declare function empty();
@@ -1 +1 @@
1
- import{resolve as e}from"node:path";import o from"../commom/paths.mjs";export function toCamelCase(e){return e.replace(/-./g,e=>e.charAt(1).toUpperCase())}export function convertToCamelCase(e){return e.toLowerCase().replace(/-(\w)/g,(e,o)=>o?o.toUpperCase():"").replace(/^./,e=>e.toUpperCase()).replace(/Ui$/,"UI")}export function resolveProgram(t){return e(o.programPath,`./${t}`)}export function node_modules(t){return e(o.nodeModules,`./${t}`)}export function isObject(e){let o=typeof e;return null!==e&&("object"===o||"function"===o)}export function isFunction(e){return["[object Function]","[object AsyncFunction]","[object GeneratorFunction]","[object Proxy]"].includes(Object.prototype.toString.call(e))}export function empty(){}
1
+ import{resolve as e}from"node:path";import t from"../commom/paths.mjs";export function toCamelCase(e){return e.replace(/-./g,e=>e.charAt(1).toUpperCase())}export function convertToCamelCase(e){return e.toLowerCase().replace(/-(\w)/g,(e,t)=>t?t.toUpperCase():"").replace(/^./,e=>e.toUpperCase()).replace(/Ui$/,"UI")}export function resolveProgram(o){return e(t.programPath,`./${o}`)}export function node_modules(o){return e(t.nodeModules,`./${o}`)}export function isObject(e){let t=typeof e;return null!==e&&("object"===t||"function"===t)}export function isFunction(e){return["[object Function]","[object AsyncFunction]","[object GeneratorFunction]"].includes(Object.prototype.toString.call(e))}export function transformModule(e){let t="";if("string"==typeof e)t=e;else for(let[o,r]of Object.entries(e))t+=`export const ${o} = ${isFunction(r)?r:JSON.stringify(r)};`;return t}export function empty(){}
package/lib/vm/info.d.mts CHANGED
@@ -1,21 +1,5 @@
1
1
  import { CONFIG } from '../config.mjs';
2
- import { APPTYPE, author, description, framework, frameworkVersionStr, PACKAGENAME, PACKAGEVERSION, repository, SSR } from '../process-env.mjs';
2
+ import { APPTYPE, framework, frameworkVersionStr, packageJson, SSR } from '../process-env.mjs';
3
3
  import { convertToCamelCase } from '../utils/index.mjs';
4
- declare const iStr: boolean;
5
- declare const app: {
6
- readonly name;
7
- readonly projectName;
8
- readonly ssr;
9
- readonly version;
10
- readonly base;
11
- readonly type;
12
- readonly routerMode;
13
- readonly prefixCls;
14
- readonly theme;
15
- readonly description;
16
- readonly author;
17
- readonly repository;
18
- readonly frameworkVersion;
19
- readonly framework;
20
- };
4
+ declare const app: Record<string, unknown>;
21
5
  export default app;
package/lib/vm/info.mjs CHANGED
@@ -1 +1 @@
1
- import{CONFIG as e}from"../config.mjs";import{APPTYPE as r,author as o,description as t,framework as m,frameworkVersionStr as s,PACKAGENAME as i,PACKAGEVERSION as p,repository as a,SSR as f}from"../process-env.mjs";import{convertToCamelCase as n}from"../utils/index.mjs";let l="string"==typeof o,u={name:i,projectName:n(i),ssr:f,version:p,base:e.basename,type:r,routerMode:e.routerMode,prefixCls:e.prefixCls,theme:e.theme,description:t,author:l?{name:o}:o,repository:l?{url:a}:a,frameworkVersion:s,framework:m};export default u;
1
+ import{CONFIG as e}from"../config.mjs";import{APPTYPE as r,framework as o,frameworkVersionStr as m,packageJson as s,SSR as t}from"../process-env.mjs";import{convertToCamelCase as f}from"../utils/index.mjs";let i={...s,projectName:f(s.name),ssr:t,base:e.basename,type:r,routerMode:e.routerMode,prefixCls:e.prefixCls,theme:e.theme,frameworkVersion:m,framework:o};export default i;
@@ -10,7 +10,7 @@ import type { VirtualModulePluginOption } from '../plugin/virtual-module.mjs';
10
10
  import { APPTYPE, FRAMEWORK } from '../process-env.mjs';
11
11
  import createTypes from '../utils/create-types.mjs';
12
12
  import { generateDeclaration } from '../utils/dts.mjs';
13
- import { node_modules } from '../utils/index.mjs';
13
+ import { node_modules, transformModule } from '../utils/index.mjs';
14
14
  import getCoverage from './coverage.mjs';
15
15
  import { docs, docsModuleName } from './docs.mjs';
16
16
  import info from './info.mjs';
@@ -18,7 +18,7 @@ import { locales, localesModuleName } from './locales.mjs';
18
18
  import renderApp from './render-app.mjs';
19
19
  import { route, routesModuleName } from './routes.mjs';
20
20
  declare const mdxScope: string | false;
21
- declare const normalModules: Record<string, string>;
21
+ declare const normalModules: Record<string, string | object>;
22
22
  declare const appDtsPath: string;
23
23
  declare const appDts: string[];
24
24
  declare const vmDtsPath: string;
@@ -1 +1 @@
1
- import{join as p}from"node:path";import{getAppEntry as e,getAppFallback as t,getAppMdxScope as o,getAppMergeRouter as m,getAppNormalizeCss as r,getAppPrefixRouter as s,getAppRem as a,getAppSuspense as i}from"@moneko/mdx";import{updateFileSync as n}from"@moneko/utils";import f from"../commom/has-pkg.mjs";import l from"../commom/paths.mjs";import d from"../commom/rule.mjs";import{CONFIG as c}from"../config.mjs";import x from"../plugin/module-federation.mjs";import{APPTYPE as u,FRAMEWORK as j}from"../process-env.mjs";import g from"../utils/create-types.mjs";import{generateDeclaration as y}from"../utils/dts.mjs";import{node_modules as v}from"../utils/index.mjs";import h from"./coverage.mjs";import{docs as k,docsModuleName as O}from"./docs.mjs";import S from"./info.mjs";import{locales as b,localesModuleName as z}from"./locales.mjs";import D from"./render-app.mjs";import{route as J,routesModuleName as N}from"./routes.mjs";let $=f(p(c.alias["@"],"./mdx-scope.tsx"))||f(p(c.alias["@"],"./mdx-scope.ts")),C={"@app/env.ts":`export default ${JSON.stringify(c.env)}`,"@app/info.ts":`export default ${JSON.stringify(S)}`,"@app/render.tsx":"react"===j?D:"","@app/entry.ts":e(p(c.alias["@"],"./index.ts"),!!x.length,!!c.rem,!!c.normalizeCss,u,j),"@app/rem":a(c.rem?.designSize||1680),"@app/fallback":t(c.fallbackCompPath),"@app/coverage":h(l.coveragePath),"@app/merge-router":m(),"@app/prefix-router":s(),"@app/normalize/index.css":r(),"@app/suspense/index.tsx":i(u,j),"@app/mdx-scope.tsx":$?o($):"export default {}","@app/routes":J.getData(N),"@app/locales":b.getData(z),"@app/docs":k.getData(O)};n(v("@types/@app/index.d.ts"),["@app/env.ts","@app/info.ts","@app/entry.ts","@app/mdx-scope.tsx"].map(p=>g(p.replace(d.js,""),y(C[p],p))).join("\n"));let P=v("@types/@vm/index.d.ts"),M=c.virtualModule||{};n(P,Object.keys(M).map(p=>{let e=M[p];return g(p,y("string"==typeof e?e:`export default ${JSON.stringify(e)}`,p))}).join("\n"));export default C;
1
+ import{join as p}from"node:path";import{getAppEntry as m,getAppFallback as o,getAppMdxScope as e,getAppMergeRouter as t,getAppNormalizeCss as r,getAppPrefixRouter as s,getAppRem as a,getAppSuspense as i}from"@moneko/mdx";import{updateFileSync as n}from"@moneko/utils";import f from"../commom/has-pkg.mjs";import l from"../commom/paths.mjs";import d from"../commom/rule.mjs";import{CONFIG as c}from"../config.mjs";import j from"../plugin/module-federation.mjs";import{APPTYPE as x,FRAMEWORK as u}from"../process-env.mjs";import g from"../utils/create-types.mjs";import{generateDeclaration as v}from"../utils/dts.mjs";import{node_modules as h,transformModule as k}from"../utils/index.mjs";import y from"./coverage.mjs";import{docs as b,docsModuleName as z}from"./docs.mjs";import D from"./info.mjs";import{locales as C,localesModuleName as P}from"./locales.mjs";import M from"./render-app.mjs";import{route as O,routesModuleName as S}from"./routes.mjs";let q=f(p(c.alias["@"],"./mdx-scope.tsx"))||f(p(c.alias["@"],"./mdx-scope.ts")),w={"@app/env.ts":c.env,"@app/info.ts":D,"@app/render.tsx":"react"===u?M:"","@app/entry.ts":m(p(c.alias["@"],"./index.ts"),!!j.length,!!c.rem,!!c.normalizeCss,x,u),"@app/rem":a(c.rem?.designSize||1680),"@app/fallback":o(c.fallbackCompPath),"@app/coverage":y(l.coveragePath),"@app/merge-router":t(),"@app/prefix-router":s(),"@app/normalize/index.css":r(),"@app/suspense/index.tsx":i(x,u),"@app/mdx-scope.tsx":q?e(q):"export {}","@app/routes":O.getData(S),"@app/locales":C.getData(P),"@app/docs":b.getData(z)};n(h("@types/@app/index.d.ts"),["@app/env.ts","@app/info.ts","@app/entry.ts","@app/mdx-scope.tsx"].map(p=>g(p.replace(d.js,""),v(k(w[p]),p))).join("\n"));let A=h("@types/@vm/index.d.ts"),B=c.virtualModule||{};n(A,Object.keys(B).map(p=>g(p,v(k(B[p]),p))).join("\n"));export default w;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.29.4",
3
+ "version": "3.30.0-beta.0",
4
4
  "description": "core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",
@@ -21,23 +21,24 @@
21
21
  "@moneko/convert": "1.0.0",
22
22
  "@moneko/mdx": "0.1.43",
23
23
  "@moneko/raw-import": "0.0.3",
24
+ "@moneko/eslint": "1.0.1",
24
25
  "@moneko/stylelint": "1.0.2",
25
26
  "@moneko/transform-imports": "0.6.1",
26
27
  "@moneko/utils": "0.1.22",
27
28
  "@swc/core": "1.6.13",
28
29
  "browserslist": "4.24.4",
29
30
  "chokidar": "4.0.3",
30
- "core-js": "3.40.0",
31
- "core-js-compat": "3.40.0",
31
+ "core-js": "3.41.0",
32
+ "core-js-compat": "3.41.0",
32
33
  "fastify": "4.29.0",
33
34
  "less": "4.2.2",
34
35
  "less-loader": "12.2.0",
35
- "lightningcss": "1.29.1",
36
+ "lightningcss": "1.29.2",
36
37
  "marked-completed": "1.2.14",
37
38
  "mini-css-extract-plugin": "2.9.2",
38
39
  "style-loader": "4.0.0",
39
40
  "swc-loader": "0.2.6",
40
- "typescript": "5.5.4",
41
+ "typescript": "5.8.2",
41
42
  "webpack": "5.98.0",
42
43
  "webpack-dev-middleware": "7.4.2",
43
44
  "webpack-hot-middleware": "2.26.1",
@@ -50,8 +51,7 @@
50
51
  "@types/stylis": "4.2.7",
51
52
  "@types/webpack-bundle-analyzer": "4.7.0",
52
53
  "@types/webpack-hot-middleware": "2.25.9",
53
- "babel-plugin-react-compiler": "19.0.0-beta-e1e972c-20250221",
54
- "eslint-config-neko": "3.0.5",
54
+ "babel-plugin-react-compiler": "19.0.0-beta-bafa41b-20250307",
55
55
  "sass": "1.85.1",
56
56
  "sass-loader": "16.0.5",
57
57
  "solid-refresh": "0.7.5",