@moneko/core 3.56.10 → 3.56.12

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,2 +1,2 @@
1
- import{relative as e}from"node:path";import{argv as o,exit as t,stdout as i}from"node:process";import{ESLint as r}from"@moneko/eslint";import{ink as a,print as l}from"@moneko/utils";import{cachePath as n,cwd as s,parseBraced as c}from"./utils/config.mjs";export default async function m(){let m=a("eslint","cyan");l(`${m}: ${a("Runing...","yellow")}`,!0);let f=o[3],u=o.slice(4),p=u.includes("--fix"),d=new r({cache:!u.includes("--cache=false"),cacheLocation:`${n}/.eslintcache`,fix:p}),w=c(f).map(o=>e(s,o)),h=await d.lintFiles(w),$=await d.loadFormatter("stylish"),y=await $.format(h);p&&await r.outputFixes(h),y&&i.write(y);let x=h.some(e=>e.errorCount>0);l(`${m}: ${a(`✨ ${x?"Error":"Successfully"}!
1
+ import{relative as e}from"node:path";import{argv as o,exit as t,stdout as i}from"node:process";import{ESLint as r}from"@moneko/eslint";import{ink as a,print as s}from"@moneko/utils";import{cachePath as c,cwd as l,parseBraced as n}from"./utils/config.mjs";export default async function m(){let m=a("eslint","cyan");s(`${m}: ${a("Runing...","yellow")}`,!0);let f=o[3],u=o.slice(4),p=u.includes("--fix"),d=new r({cache:!u.includes("--cache=false"),cacheLocation:`${c}/.eslintcache`,fix:p}),w=n(f).map(o=>e(l,o)),h=await d.lintFiles(w),$=await d.loadFormatter("stylish"),y=await $.format(h,{cwd:process.cwd(),rulesMeta:{}});p&&await r.outputFixes(h),y&&i.write(y);let x=h.some(e=>e.errorCount>0);s(`${m}: ${a(`✨ ${x?"Error":"Successfully"}!
2
2
  `,x?"red":"green")}`,!0),x&&t(1)}
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{spawnSync as t}from"node:child_process";import{join as e}from"node:path";import{argv as o,cwd as i,exit as r,stdout as l}from"node:process";import{ESLint as n}from"@moneko/eslint";import{stylelint as a}from"@moneko/stylelint";import{ink as m,loadFile as s,println as c}from"@moneko/utils";import d from"../commom/log.mjs";import f from"../commom/parse-args.mjs";import u from"../commom/timer.mjs";let p=f(o.slice(2)),y=p.fix,h=p.cache||!0,w=e(i(),"node_modules/.cache"),S={ci:["diff","--name-only","HEAD^","HEAD"],commit:["diff","--cached","--name-only","--diff-filter=ACM"]},g=/.*(?<!\.d)\.(j|t|mj|mt|cj|ct)sx?$/,v=/.*(?<!\.d)\.vue$/,$=/.*(?<!\.d)\.(c|sc|sa|le)ss$/,E=t("git",S[p.mode||"ci"]||S.ci).stdout.toString().trim().split("\n");async function j(){let t=m("ESLint","cyan");c(`${t}: ${m("runing...","yellow")}`,!0);try{u.start("ESLint");let t=E.filter(t=>g.test(t)||v.test(t));if(0===t.length)return void u.end("ESLint");let e=new n({cache:h,cacheLocation:`${w}/.eslintcache`,fix:y}),o=await e.lintFiles(t),i=await e.loadFormatter("stylish"),a=await i.format(o);y&&await n.outputFixes(o),a&&l.write(a);let m=o.some(t=>t.errorCount>0);u.end("ESLint"),m&&r(1)}catch(t){d(t)}}let L=E.filter(t=>$.test(t)||v.test(t));async function k(){let t=m("Stylelint","cyan");if(c(`${t}: ${m("runing...","yellow")}`,!0),u.start("Stylelint"),0===L.length)return void u.end("Stylelint");let e=await Promise.allSettled(L.map(async t=>{let e=await s(t);return await a.lint({codeFilename:t,code:e,cache:h,cacheLocation:`${w}/.stylelintcache`,fix:y,formatter:"string"}).catch(d)})),o=!1;e.forEach(t=>{"fulfilled"===t.status?t.value&&(t.value.report&&l.write(t.value.report),t.value.errored&&(o=!!t.value.errored)):t.reason&&(l.write(t.reason),o=!1)}),u.end("Stylelint"),o&&r(1)}await Promise.allSettled([j(),k()]);
2
+ import{spawnSync as t}from"node:child_process";import{join as e}from"node:path";import{argv as i,cwd as o,exit as r,stdout as n}from"node:process";import{ESLint as l}from"@moneko/eslint";import{stylelint as a}from"@moneko/stylelint";import{ink as s,loadFile as m,println as c}from"@moneko/utils";import d from"../commom/log.mjs";import f from"../commom/parse-args.mjs";import u from"../commom/timer.mjs";let p=f(i.slice(2)),y=p.fix,w=p.cache||!0,h=e(o(),"node_modules/.cache"),S={ci:["diff","--name-only","HEAD^","HEAD"],commit:["diff","--cached","--name-only","--diff-filter=ACM"]},j=/.*(?<!\.d)\.(j|t|mj|mt|cj|ct)sx?$/i,$=/.*(?<!\.d)\.vue$/i,g=/.*(?<!\.d)\.(c|sc|sa|le)ss$/i,v=/\.min\.(j|t|mj|mt|cj|ct)sx?$/i,E=t("git",S[p.mode||"ci"]||S.ci).stdout.toString().trim().split("\n");async function L(){let t=s("ESLint","cyan");c(`${t}: ${s("runing...","yellow")}`,!0);try{u.start("ESLint");let t=E.filter(t=>!(t.endsWith("iconfont.js")||v.test(t))&&(j.test(t)||$.test(t)));if(0===t.length)return void u.end("ESLint");let e=new l({cache:w,cacheLocation:`${h}/.eslintcache`,fix:y}),i=await e.lintFiles(t),o=await e.loadFormatter("stylish"),a=await o.format(i,{cwd:process.cwd(),rulesMeta:{}});y&&await l.outputFixes(i),a&&n.write(a);let s=i.some(t=>t.errorCount>0);u.end("ESLint"),s&&r(1)}catch(t){d(t)}}let x=E.filter(t=>g.test(t)||$.test(t));async function k(){let t=s("Stylelint","cyan");if(c(`${t}: ${s("runing...","yellow")}`,!0),u.start("Stylelint"),0===x.length)return void u.end("Stylelint");let e=await Promise.allSettled(x.map(async t=>{let e=await m(t);if(e)return await a.lint({codeFilename:t,code:e,cache:w,cacheLocation:`${h}/.stylelintcache`,fix:y,formatter:"string"}).catch(d)})),i=!1;e.forEach(t=>{"fulfilled"===t.status?t.value&&(t.value.report&&n.write(t.value.report),t.value.errored&&(i=!!t.value.errored)):t.reason&&(n.write(t.reason),i=!1)}),u.end("Stylelint"),i&&r(1)}await Promise.allSettled([L(),k()]);
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{OverrideResolverPlugin as r}from"./plugin/override-resolve.mjs";import{isObject as l,node_modules as m,resolveProgram as c}from"./utils/index.mjs";import{exampleModuleName as p}from"./vm/example.mjs";import u from"./vm/info.mjs";import{CONFIG as h}from"./config.mjs";import d from"./plugins.config.mjs";import{isCI as f,isDev as g,isLibrary as b,NODE_ENV as y,packageJson as j}from"./process-env.mjs";export const outputConfig={path:c(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:!g,publicPath:h.publicPath,asyncChunks:!0,charset:!0,iife:!0,crossOriginLoading:"use-credentials",enabledWasmLoadingTypes:["fetch"],uniqueName:`${u.projectName}`};let v={main:[m("@app/entry")]},P=[t(s.corePath,"./polyfills/public-path.mjs")];if(g&&h.refresh&&h.env.injectRemoteReactRefresh&&P.push(t(s.corePath,"./polyfills/inject-react-refresh.mjs")),h.polyfill&&P.push(t(s.corePath,"./polyfills/replace-children.mjs")),h.entry&&("string"==typeof h.entry?v={...v,main:[h.entry]}:Object.keys(h.entry)&&(v=Object.assign(v,h.entry))),"string"==typeof v.main?v.main=[...P,v.main]:Array.isArray(v.main)&&(v.main=[...P,...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:`.${[n,y].filter(Boolean).join("-")}`,version:`${j.version}`,buildDependencies:{config:a},maxMemoryGenerations:1};!1===h.cache?C=!1:l(h.cache)&&(C=Object.assign(C,h.cache)),f&&(void 0===h.cache||h.cache&&!h.cache.cacheDirectory)&&(C.cacheDirectory=o(i,j.name));export const commonConfig={name:"client",target:"web",devtool:h.devtool,entry:v,mode:g?"development":"production",stats:"errors-only",cache:C,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},contextModule:{timestamp:!0,hash:!0}},infrastructureLogging:{level:"error"},externalsPresets:h.externalsPresets,plugins:d,node:{global:!1,__filename:!1,__dirname:!1},experiments:{asyncWebAssembly:!0,cacheUnaffected:!0,lazyCompilation:h.lazyCompilation&&g&&{imports:!0,entries:!0,test:e=>{let t=e.nameForCondition();return!!(t&&(t.startsWith(m(p))||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,recordsPath:h.recordsPath?t(s.programPath,h.recordsPath):t(s.webpackCachePath,"records.json")};h.overrideResolve&&commonConfig.resolve.plugins.push(new r(Object.assign({original:h.alias["@"],override:n&&c(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 i,TMP_DIR as n}from"./commom/paths.mjs";import{OverrideResolverPlugin as r}from"./plugin/override-resolve.mjs";import{isObject as l,node_modules as m,resolveProgram as c}from"./utils/index.mjs";import{exampleModuleName as p}from"./vm/example.mjs";import u from"./vm/info.mjs";import{CONFIG as h}from"./config.mjs";import d from"./plugins.config.mjs";import{isCI as f,isDev as b,isLibrary as g,NODE_ENV as y,packageJson as j}from"./process-env.mjs";export const outputConfig={path:c(g?"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:b,clean:!b,publicPath:h.publicPath,workerPublicPath:h.publicPath,asyncChunks:!0,charset:!0,iife:!0,crossOriginLoading:"use-credentials",enabledWasmLoadingTypes:["fetch"],uniqueName:`${u.projectName}`};let v={main:[m("@app/entry")]},P=[t(s.corePath,"./polyfills/public-path.mjs")];if(b&&h.refresh&&h.env.injectRemoteReactRefresh&&P.push(t(s.corePath,"./polyfills/inject-react-refresh.mjs")),h.polyfill&&P.push(t(s.corePath,"./polyfills/replace-children.mjs")),h.entry&&("string"==typeof h.entry?v={...v,main:[h.entry]}:Object.keys(h.entry)&&(v=Object.assign(v,h.entry))),"string"==typeof v.main?v.main=[...P,v.main]:Array.isArray(v.main)&&(v.main=[...P,...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:`.${[i,y].filter(Boolean).join("-")}`,version:`${j.version}`,buildDependencies:{config:a},maxMemoryGenerations:1};!1===h.cache?C=!1:l(h.cache)&&(C=Object.assign(C,h.cache)),f&&(void 0===h.cache||h.cache&&!h.cache.cacheDirectory)&&(C.cacheDirectory=o(n,j.name));export const commonConfig={name:"client",target:"web",devtool:h.devtool,entry:v,mode:b?"development":"production",stats:"errors-only",cache:C,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},contextModule:{timestamp:!0,hash:!0}},infrastructureLogging:{level:"error"},externalsPresets:h.externalsPresets,plugins:d,node:{global:!1,__filename:!1,__dirname:!1},experiments:{asyncWebAssembly:!0,cacheUnaffected:!0,lazyCompilation:h.lazyCompilation&&b&&{imports:!0,entries:!0,test:e=>{let t=e.nameForCondition();return!!(t&&(t.startsWith(m(p))||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,recordsPath:h.recordsPath?t(s.programPath,h.recordsPath):t(s.webpackCachePath,"records.json")};h.overrideResolve&&commonConfig.resolve.plugins.push(new r(Object.assign({original:h.alias["@"],override:i&&c(i)},h.overrideResolve)));
@@ -1,2 +1,2 @@
1
1
  export type { AST, Linter, Rule, RuleTester, Scope, SourceCode } from '@moneko/eslint';
2
- export { ESLint, loadESLint } from '@moneko/eslint';
2
+ export { ESLint, globalIgnores, loadESLint } from '@moneko/eslint';
@@ -1 +1 @@
1
- export{ESLint,loadESLint}from"@moneko/eslint";
1
+ export{ESLint,globalIgnores,loadESLint}from"@moneko/eslint";
@@ -1 +1 @@
1
- import{isUint8Array as e}from"node:util/types";import{parentPort as r}from"node:worker_threads";import{compression as o}from"@moneko/utils";r?.setMaxListeners(0),r?.on("message",async({input:s,filename:t,algorithm:m})=>{let f=o(Buffer.isBuffer(s)||e(s)?Array.from(s):s,m);r?.postMessage([t,f])});
1
+ import{isUint8Array as e}from"node:util/types";import{parentPort as r}from"node:worker_threads";import{compression as s}from"@moneko/utils";r?.setMaxListeners(0),r?.on("message",async({input:o,filename:t,algorithm:m})=>{try{let a=s(Buffer.isBuffer(o)||e(o)?Array.from(o):o,m);r?.postMessage([t,a])}catch{r?.postMessage([t,o])}});
@@ -1 +1 @@
1
- let a,e;import{relative as t}from"node:path";import{parentPort as r}from"node:worker_threads";import{ESLint as o}from"@moneko/eslint";import i from"../commom/paths.mjs";if(!r)throw Error("This file must be run as a worker");r?.setMaxListeners(0),r.on("message",async({options:s})=>{a||(a=new o({cache:s.cache,cacheLocation:s.cacheLocation,cacheStrategy:s.cacheStrategy,fix:s.fix}),e=await a.loadFormatter("stylish"));let m=s.files.map(a=>(s.lintDirtyModulesOnly?t(i.programPath,a):a).replace(/\\/g,"/")),n=await a.lintFiles(m),c=[],l=[];s.fix&&await o.outputFixes(n),n.forEach(a=>{a.errorCount?l.push(a):a.warningCount&&c.push(a)});let h=await Promise.all([e.format(c),e.format(l)]);r.postMessage(h.map(a=>a.replace(/[^\r\n]*(\r?\n)*$/,"")))});
1
+ let a,t;import{relative as e}from"node:path";import{parentPort as r}from"node:worker_threads";import{ESLint as o}from"@moneko/eslint";import s from"../commom/paths.mjs";if(!r)throw Error("This file must be run as a worker");r?.setMaxListeners(0),r.on("message",async({options:i})=>{try{a||(a=new o({cache:i.cache,cacheLocation:i.cacheLocation,cacheStrategy:i.cacheStrategy,fix:i.fix}),t=await a.loadFormatter("stylish"));let m=i.files.map(a=>(i.lintDirtyModulesOnly?e(s.programPath,a):a).replace(/\\/g,"/")),c=await a.lintFiles(m),n=[],h=[];i.fix&&await o.outputFixes(c),c.forEach(a=>{a.errorCount?h.push(a):a.warningCount&&n.push(a)});let l=await Promise.all([t.format(n,{cwd:s.programPath,rulesMeta:{}}),t.format(h,{cwd:s.programPath,rulesMeta:{}})]);r.postMessage(l.map(a=>a.replace(/[^\r\n]*(\r?\n)*$/,"")))}catch{r.postMessage(["",""])}});
@@ -1 +1 @@
1
- import{parentPort as e}from"node:worker_threads";import{stylelint as r}from"@moneko/stylelint";if(!e)throw Error("This file must be run as a worker");let t=await r.formatters.string;e?.setMaxListeners(0),e.on("message",async({options:i})=>{let n=await r.lint({cache:i.cache,cacheLocation:i.cacheLocation,fix:i.fix,files:i.files.map(e=>e.replace(/\\/g,"/")),quietDeprecationWarnings:i.quietDeprecationWarnings,quiet:i.quiet});delete n.output;let a=[],s=[];n.results.forEach(e=>{if(!e.ignored&&(e.errored||e.parseErrors.length||e.invalidOptionWarnings.length||e.deprecations.length)){let r=[],t=[];e.warnings.forEach(e=>{"error"===e.severity?r.push(e):"warning"===e.severity&&t.push(e)}),r.length>0&&a.push({...e,warnings:r}),t.length>0&&s.push({...e,warnings:t})}});let o=[t(s,n),t(a,n)];e.postMessage(o.map(e=>e.replace(/[^\r\n]*(\r?\n)*$/,"")))});
1
+ import{parentPort as e}from"node:worker_threads";import{stylelint as r}from"@moneko/stylelint";if(!e)throw Error("This file must be run as a worker");let t=await r.formatters.string;e?.setMaxListeners(0),e.on("message",async({options:a})=>{try{let i=await r.lint({cache:a.cache,cacheLocation:a.cacheLocation,fix:a.fix,files:a.files.map(e=>e.replace(/\\/g,"/")),quietDeprecationWarnings:a.quietDeprecationWarnings,quiet:a.quiet});delete i.output;let n=[],s=[];i.results.forEach(e=>{if(!e.ignored&&(e.errored||e.parseErrors.length||e.invalidOptionWarnings.length||e.deprecations.length)){let r=[],t=[];e.warnings.forEach(e=>{"error"===e.severity?r.push(e):"warning"===e.severity&&t.push(e)}),r.length>0&&n.push({...e,warnings:r}),t.length>0&&s.push({...e,warnings:t})}});let o=[t(s,i),t(n,i)];e.postMessage(o.map(e=>e.replace(/[^\r\n]*(\r?\n)*$/,"")))}catch{e.postMessage(["",""])}});
@@ -1 +1 @@
1
- import{parentPort as r}from"node:worker_threads";import{minify as e}from"@swc/core";if(!r)throw Error("This file must be run as a worker");r?.setMaxListeners(0),r.on("message",async({buffer:o,options:s})=>{let{code:t}=await e(Buffer.from(o).toString().replace(/\r\n/g,"\n"),s);r.postMessage(t)});
1
+ import{parentPort as r}from"node:worker_threads";import{minify as e}from"@swc/core";if(!r)throw Error("This file must be run as a worker");r?.setMaxListeners(0),r.on("message",async({buffer:o,options:s})=>{try{let t=Buffer.from(o).toString().replace(/\r\n/g,"\n"),{code:a}=await e(t,s);r.postMessage(a)}catch{r.postMessage(Buffer.from(o).toString())}});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.56.10",
3
+ "version": "3.56.12",
4
4
  "description": "core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",
@@ -129,7 +129,7 @@
129
129
  "license": "MIT",
130
130
  "dependencies": {
131
131
  "@moneko/convert": "1.1.3",
132
- "@moneko/eslint": "1.9.12",
132
+ "@moneko/eslint": "1.9.13",
133
133
  "@moneko/mdx": "0.1.44",
134
134
  "@moneko/raw-import": "1.1.1",
135
135
  "@moneko/request": "1.6.2",