@moneko/core 3.29.2 → 3.29.4
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/bin/eslint.mjs +2 -2
- package/lib/bin/lint-stage-git.d.mts +29 -0
- package/lib/bin/lint-stage-git.mjs +1 -0
- package/lib/bin/utils/get-commit-files.d.mts +3 -0
- package/lib/bin/utils/get-commit-files.mjs +1 -0
- package/lib/commom/parse-args.d.mts +2 -0
- package/lib/commom/parse-args.mjs +1 -0
- package/lib/vm/locales.mjs +2 -2
- package/lib/vm/modules.d.mts +0 -1
- package/lib/vm/modules.mjs +1 -1
- package/package.json +7 -7
package/lib/bin/eslint.mjs
CHANGED
|
@@ -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=
|
|
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"}!
|
|
2
|
+
`,$?"red":"green")}`,!0),$&&process.exit(1)}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { spawnSync, type SpawnSyncReturns } from 'node:child_process';
|
|
2
|
+
import { readFile } from 'node:fs/promises';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { argv } from 'node:process';
|
|
5
|
+
import { stylelint as Stylelint } from '@moneko/stylelint';
|
|
6
|
+
import { ESLint } from 'eslint';
|
|
7
|
+
declare function parseArgs<T>(args: string[]): T;
|
|
8
|
+
type Args = {
|
|
9
|
+
fix?: boolean;
|
|
10
|
+
cache?: boolean;
|
|
11
|
+
mode?: 'ci' | 'commit';
|
|
12
|
+
};
|
|
13
|
+
declare const args: Args;
|
|
14
|
+
declare const fix: boolean | undefined;
|
|
15
|
+
declare const cache: boolean;
|
|
16
|
+
declare const cwd: string;
|
|
17
|
+
declare const cachePath: string;
|
|
18
|
+
declare const cmd: {
|
|
19
|
+
readonly ci: readonly ['diff', '--name-only', 'HEAD^', 'HEAD'];
|
|
20
|
+
readonly commit: readonly ['diff', '--cached', '--name-only', '--diff-filter=ACMR'];
|
|
21
|
+
};
|
|
22
|
+
declare const scriptRegExp: RegExp;
|
|
23
|
+
declare const vueRegExp: RegExp;
|
|
24
|
+
declare const styleRegExp: RegExp;
|
|
25
|
+
declare const child: SpawnSyncReturns<Buffer<ArrayBufferLike>>;
|
|
26
|
+
declare const lintFiles: string[];
|
|
27
|
+
export declare async function eslint();
|
|
28
|
+
declare const styleFiles: string[];
|
|
29
|
+
export declare async function stylelint();
|
|
@@ -0,0 +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)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{spawn as t}from"node:child_process";export default function(){return new Promise(function(n,o){let r=t("git",["diff","--name-only","HEAD^","HEAD"]),i="",e="";r.stdout.on("data",function(t){i+=t.toString()}),r.stderr.on("data",function(t){e+=t.toString()}),r.on("close",function(t){0===t?n(i.trim().split("\n")):o({code:t,error:e})})})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function(e){return Object.fromEntries(e.map(function(e){let t=e.split("="),r=t[1];return void 0===r||"true"===r?r=!0:"false"===r?r=!1:/-?\d+(\.\d+)?([eE][+-]?\d+)?/.test(r)&&(r=parseFloat(r)),[t[0].replace(/^--/,""),r]}))}
|
package/lib/vm/locales.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{basename as e,join as t}from"node:path";import{directoryExists as
|
|
2
|
-
export function template(r,n){return r.replace(/\\\${\\w+}/g,function(r){var t=r.slice(2,-1);var e=n[t];return e!==void 0?e.toString():""})}function deepFreeze(o) { const p = Reflect.ownKeys(o);for (const k of p) {const v = o[k];if ((v && typeof v === "object") || typeof v === "function") {deepFreeze(v);}}return Object.freeze(o);}export const locales = ${JSON.stringify(e)};const _res = ${JSON.stringify(t)};const resources = deepFreeze(_res);${
|
|
1
|
+
import{basename as e,join as t}from"node:path";import{directoryExists as a,scanFolderSync as o}from"@moneko/utils";import{watch as l}from"chokidar";import r from"../commom/log.mjs";import n from"../commom/parse-module-meta.mjs";import c from"../commom/reactive-object.mjs";import s from"../commom/require.mjs";import i from"../commom/sigint-exit.mjs";import{CONFIG as g}from"../config.mjs";import{FRAMEWORK as m,isDev as u}from"../process-env.mjs";let p={react:'import sso from "shared-store-object";',solid:'import { createEffect, createRoot, getOwner } from "solid-js";import { createStore } from "solid-js/store";'},f={react:'let storageKey="localizable.language",language=localStorage.getItem(storageKey)||navigator.language,{translation:a,...defaultLocale}=Object.assign({title:"简体中文",language:navigator.language,translation:{}},resources[language]||resources[navigator.language]),localizable=sso({lang:defaultLocale,t:a});export function setLang(a){let{translation:e,...l}=resources[a]||{};e&&(localizable.lang=l,localizable.t=e,localStorage.setItem(storageKey,l.language))}export default localizable;',solid:'let locale=createRoot(()=>{let e="localizable.language",a=localStorage.getItem(e)||navigator.language,{translation:l,...o}=Object.assign({title:"简体中文",language:navigator.language,translation:{}},resources[a]||resources[navigator.language]),[n,c]=createStore({lang:o,t:l});return createEffect(()=>{let a=resources[n.lang.language]?.translation;a&&(c("t",a),localStorage.setItem(e,n.lang.language))}),{localizable:n,setLocalizable:c,setLang:function(e){let{translation:a,...l}=resources[e]||{};a&&c("lang",l)}}},getOwner());export const setLocalizable=locale.setLocalizable;export const t=locale.localizable.t;export const lang=locale.localizable.lang;export const setLang=locale.setLang;'}[m];function d(e,t){return`${p[m]}
|
|
2
|
+
export function template(r,n){return r.replace(/\\\${\\w+}/g,function(r){var t=r.slice(2,-1);var e=n[t];return e!==void 0?e.toString():""})}function deepFreeze(o) { const p = Reflect.ownKeys(o);for (const k of p) {const v = o[k];if ((v && typeof v === "object") || typeof v === "function") {deepFreeze(v);}}return Object.freeze(o);}export const locales = ${JSON.stringify(e)};const _res = ${JSON.stringify(t)};const resources = deepFreeze(_res);${f}`}let b=n("@app/locales");export const localesModuleName=b.file;export const locales=new c({[localesModuleName]:d([],{}),[b.pkg]:b.meta});let j={};async function v(t,a){let o=e(t).replace(/\.[^.]+$/,"");try{"deleted"===a?delete j[o]:(delete s.cache[t],Object.assign(j,{[o]:s(t).default}));let e=[],l={};for(let t in j)if(Object.prototype.hasOwnProperty.call(j,t)){let{language:a=o,title:r=a,icon:n,translation:c={}}=j[t];e.push({language:a,title:r,icon:n}),l[a]={language:a,title:r,icon:n,translation:c}}locales.setData(localesModuleName,d(e,l)),locales.setData(b.pkg,b.meta)}catch(e){r(e)}}let z=t(g.alias["@"],"./locales");if(a(z)&&!1!==g.htmlPluginOption){let e=o(z,[".ts$"]).filter(e=>!/^\..*|\.d\.ts$/.test(e));await Promise.all(e.map(e=>v(e,"added"))),u&&function(e,t){let a=l(e,{ignored:t,persistent:!0,ignoreInitial:!0});function o(){a.unwatch(e),a.close()}a.on("add",e=>{v(e,"added")}),a.on("change",e=>{v(e,"change")}),a.on("unlink",e=>{v(e,"deleted")}),a.once("ready",()=>{u||o()}),i(o)}(z,[/^\..*/,/!\.ts$/,/\.d\.ts$/])}
|
package/lib/vm/modules.d.mts
CHANGED
|
@@ -2,7 +2,6 @@ import { join } from 'node:path';
|
|
|
2
2
|
import { getAppEntry, getAppFallback, getAppMdxScope, getAppMergeRouter, getAppNormalizeCss, getAppPrefixRouter, getAppRem, getAppSuspense } from '@moneko/mdx';
|
|
3
3
|
import { updateFileSync } from '@moneko/utils';
|
|
4
4
|
import hasPkg from '../commom/has-pkg.mjs';
|
|
5
|
-
import parseModuleMeta from '../commom/parse-module-meta.mjs';
|
|
6
5
|
import paths from '../commom/paths.mjs';
|
|
7
6
|
import Rule from '../commom/rule.mjs';
|
|
8
7
|
import { CONFIG } from '../config.mjs';
|
package/lib/vm/modules.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{join as
|
|
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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "3.29.
|
|
3
|
+
"version": "3.29.4",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"style-loader": "4.0.0",
|
|
39
39
|
"swc-loader": "0.2.6",
|
|
40
40
|
"typescript": "5.5.4",
|
|
41
|
-
"webpack": "5.
|
|
41
|
+
"webpack": "5.98.0",
|
|
42
42
|
"webpack-dev-middleware": "7.4.2",
|
|
43
43
|
"webpack-hot-middleware": "2.26.1",
|
|
44
44
|
"webpack-merge": "6.0.1",
|
|
@@ -50,12 +50,12 @@
|
|
|
50
50
|
"@types/stylis": "4.2.7",
|
|
51
51
|
"@types/webpack-bundle-analyzer": "4.7.0",
|
|
52
52
|
"@types/webpack-hot-middleware": "2.25.9",
|
|
53
|
-
"babel-plugin-react-compiler": "19.0.0-beta-
|
|
54
|
-
"eslint-config-neko": "3.0.
|
|
55
|
-
"sass": "1.
|
|
56
|
-
"sass-loader": "16.0.
|
|
53
|
+
"babel-plugin-react-compiler": "19.0.0-beta-e1e972c-20250221",
|
|
54
|
+
"eslint-config-neko": "3.0.5",
|
|
55
|
+
"sass": "1.85.1",
|
|
56
|
+
"sass-loader": "16.0.5",
|
|
57
57
|
"solid-refresh": "0.7.5",
|
|
58
|
-
"stylis": "4.3.
|
|
58
|
+
"stylis": "4.3.6",
|
|
59
59
|
"webpack-bundle-analyzer": "4.10.2"
|
|
60
60
|
},
|
|
61
61
|
"files": [
|