@moneko/core 3.26.7 → 3.26.8
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/build-app.d.mts +11 -16
- package/lib/bin/build.d.mts +13 -1
- package/lib/bin/build.mjs +1 -1
- package/lib/bin/changelog.d.mts +12 -1
- package/lib/bin/convert.d.mts +14 -0
- package/lib/bin/convert.mjs +1 -0
- package/lib/bin/eslint.d.mts +6 -1
- package/lib/bin/eslint.mjs +2 -1
- package/lib/bin/file.d.mts +2 -0
- package/lib/bin/git-hooks.d.mts +4 -1
- package/lib/bin/git-hooks.mjs +2 -1
- package/lib/bin/help.d.mts +2 -1
- package/lib/bin/index.d.mts +5 -1
- package/lib/bin/lessc.d.mts +10 -1
- package/lib/bin/start.d.mts +4 -1
- package/lib/bin/start.mjs +1 -1
- package/lib/bin/stylelint.d.mts +6 -1
- package/lib/bin/stylelint.mjs +2 -1
- package/lib/bin/utils/bundle-app.d.mts +6 -2
- package/lib/bin/utils/config.d.mts +8 -1
- package/lib/bin/utils/config.mjs +1 -1
- package/lib/bin/utils/setup-swcrc.d.mts +3 -2
- package/lib/bin/utils/setup-swcrc.mjs +1 -1
- package/lib/build/common.d.mts +13 -2
- package/lib/build/common.mjs +1 -1
- package/lib/build/server.d.mts +4 -0
- package/lib/build.d.mts +21 -1
- package/lib/build.mjs +1 -1
- package/lib/commom/diff-object.d.mts +1 -1
- package/lib/commom/esm.d.mts +1 -1
- package/lib/commom/has-pkg.d.mts +1 -0
- package/lib/commom/log.d.mts +4 -0
- package/lib/commom/log.mjs +3 -3
- package/lib/commom/match-path.d.mts +0 -16
- package/lib/commom/net.d.mts +4 -2
- package/lib/commom/os-tmp-dir.d.mts +0 -3
- package/lib/commom/parse-module-meta.d.mts +4 -1
- package/lib/commom/paths.d.mts +21 -39
- package/lib/commom/reactive-object.d.mts +4 -4
- package/lib/commom/require.d.mts +6 -0
- package/lib/commom/rule.d.mts +17 -23
- package/lib/commom/setup-env.d.mts +2 -5
- package/lib/commom/sigint-exit.d.mts +1 -1
- package/lib/common.d.mts +16 -1
- package/lib/config.d.mts +21 -0
- package/lib/config.mjs +1 -1
- package/lib/dev/config.d.mts +11 -1
- package/lib/dev/json-schema.d.mts +72 -3
- package/lib/dev/mock.d.mts +12 -21
- package/lib/dev/proxy.d.mts +4 -4
- package/lib/dev.d.mts +57 -1
- package/lib/dev.mjs +1 -1
- package/lib/index.d.mts +4 -4
- package/lib/loader/css-in-js-minify.d.cts +4 -1
- package/lib/loader/lightning-css/codegen.d.cts +4 -3
- package/lib/loader/lightning-css/loader.cjs +1 -1
- package/lib/loader/lightning-css/loader.d.cts +22 -3
- package/lib/loader/lightning-css/runtime/api.d.cts +3 -1
- package/lib/loader/lightning-css/runtime/get-url.d.cts +4 -1
- package/lib/loader/lightning-css/utils.d.cts +21 -11
- package/lib/loader/mdx.d.cts +3 -2
- package/lib/loader/react-compiler.d.cts +3 -1
- package/lib/loader/solid.d.cts +5 -4
- package/lib/loader/ts-doc.d.cts +6 -2
- package/lib/module.config.d.mts +48 -3
- package/lib/module.config.mjs +2 -2
- package/lib/options/css-extract.d.mts +6 -0
- package/lib/options/html-plugin-option.d.mts +9 -0
- package/lib/options/html-plugin-option.mjs +1 -1
- package/lib/options/js-minify.d.mts +12 -11
- package/lib/options/md-to-html.d.mts +3 -1
- package/lib/options/modify-vars.d.mts +7 -4
- package/lib/options/reslove.d.mts +9 -7
- package/lib/options/split-chunk.d.mts +2 -0
- package/lib/options/swcrc.d.mts +14 -3
- package/lib/plugin/add-entry-attribute.d.mts +3 -11
- package/lib/plugin/copy.d.mts +10 -21
- package/lib/plugin/copy.mjs +1 -1
- package/lib/plugin/done.d.mts +2 -1
- package/lib/plugin/exposes-declararion.d.mts +8 -4
- package/lib/plugin/external-remotes.d.mts +6 -2
- package/lib/plugin/external-remotes.mjs +1 -1
- package/lib/plugin/lightningcss-plugin.d.mts +14 -8
- package/lib/plugin/lightningcss-plugin.mjs +1 -1
- package/lib/plugin/module-federation.d.mts +19 -1
- package/lib/plugin/module-federation.mjs +1 -1
- package/lib/plugin/override-resolve.d.mts +6 -17
- package/lib/plugin/virtual-module.d.mts +18 -6
- package/lib/plugins.config.d.mts +20 -1
- package/lib/plugins.config.mjs +1 -1
- package/lib/polyfills/polyfills.d.mts +6 -2
- package/lib/polyfills/replace-children.d.mts +1 -0
- package/lib/polyfills/targets.d.mts +7 -3
- package/lib/process-env.d.mts +9 -9
- package/lib/process-env.mjs +1 -1
- package/lib/utils/create-types.d.mts +4 -1
- package/lib/utils/dts.d.mts +10 -12
- package/lib/utils/fetch-module-federation-dts.d.mts +4 -1
- package/lib/utils/index.d.mts +3 -26
- package/lib/utils/run.d.mts +2 -1
- package/lib/utils/seo.d.mts +9 -1
- package/lib/utils/svg-to-data-uri.d.mts +58 -1
- package/lib/utils/vts.d.mts +5 -13
- package/lib/vm/coverage.d.mts +38 -1
- package/lib/vm/docs.d.mts +12 -0
- package/lib/vm/docs.mjs +1 -1
- package/lib/vm/example.d.mts +10 -2
- package/lib/vm/generate-doc.d.mts +35 -1
- package/lib/vm/generate-doc.mjs +1 -1
- package/lib/vm/info.d.mts +20 -13
- package/lib/vm/locales.d.mts +24 -0
- package/lib/vm/locales.mjs +2 -2
- package/lib/vm/modules.d.mts +23 -0
- package/lib/vm/routes.d.mts +10 -1
- package/lib/vm/routes.mjs +1 -1
- package/lib/vm/utils.d.mts +5 -1
- package/package.json +11 -13
- package/typings/global.d.ts +4 -0
- package/lib/bin/runlint.d.mts +0 -2
- package/lib/bin/runlint.mjs +0 -2
- package/lib/commom/get-current-time.d.mts +0 -2
- package/lib/commom/get-current-time.mjs +0 -1
- package/lib/polyfills/replace-children.d.ts +0 -1
package/lib/bin/build-app.d.mts
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
* @param {String} sun 是否子文件夹
|
|
13
|
-
* @constructor
|
|
14
|
-
* */
|
|
15
|
-
export declare function copyFolderRecursiveSync(source: string, target: string, sun?: boolean): void;
|
|
16
|
-
export default function createApp(): Promise<void>;
|
|
1
|
+
import { execSync } from 'node:child_process';
|
|
2
|
+
import { existsSync, readdirSync, statSync } from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { argv } from 'node:process';
|
|
5
|
+
import { buildPlist, buildXml, createDir, ink, jsonToYaml, loadFileSync, parsePlist, parseXml, parseYaml, print, println, removeDir, saveFile, saveFileSync } from '@moneko/utils';
|
|
6
|
+
import { bundleApk, bundleIOS } from './utils/bundle-app.mjs';
|
|
7
|
+
import { corePkg, cwd } from './utils/config.mjs';
|
|
8
|
+
import { __dirname } from './file.mjs';
|
|
9
|
+
export declare function copyFileSync(source: string, target: string);
|
|
10
|
+
export declare function copyFolderRecursiveSync(source: string, target: string, sun?: boolean);
|
|
11
|
+
export default async function createApp();
|
package/lib/bin/build.d.mts
CHANGED
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import { spawn, type SpawnOptions } from 'node:child_process';
|
|
2
|
+
import { join, relative } from 'node:path';
|
|
3
|
+
import { argv } from 'node:process';
|
|
4
|
+
import { deleteEmptyDirs, ink, println, removeDir, removeFile, scanFolderSync, updateFileSync } from '@moneko/utils';
|
|
5
|
+
import require from '../commom/require.mjs';
|
|
6
|
+
import setupEnv from '../commom/setup-env.mjs';
|
|
7
|
+
import { cwd, runtimePath, swcCachePath } from './utils/config.mjs';
|
|
8
|
+
import { getSwcOption } from './utils/setup-swcrc.mjs';
|
|
9
|
+
import convert from './convert.mjs';
|
|
10
|
+
import { __dirname } from './file.mjs';
|
|
11
|
+
import { lesscCommonjs } from './lessc.mjs';
|
|
12
|
+
declare const spawnOptions: SpawnOptions;
|
|
13
|
+
declare async function build();
|
|
2
14
|
export default build;
|
package/lib/bin/build.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{spawn as o}from"node:child_process";import{join as e,relative as
|
|
1
|
+
import{spawn as o}from"node:child_process";import{join as e,relative as t}from"node:path";import{argv as s}from"node:process";import{deleteEmptyDirs as i,ink as m,println as r,removeDir as n,removeFile as c,scanFolderSync as l,updateFileSync as p}from"@moneko/utils";import d from"../commom/require.mjs";import f from"../commom/setup-env.mjs";import{cwd as u,runtimePath as a,swcCachePath as j}from"./utils/config.mjs";import{getSwcOption as y}from"./utils/setup-swcrc.mjs";import _ from"./convert.mjs";import{__dirname as g}from"./file.mjs";import{lesscCommonjs as x}from"./lessc.mjs";let b={stdio:"inherit",shell:!0};async function h(){let h=s[3],$=s[4],v=s.slice(5);h||(r(m(`type: 无效值 ${m(h,"245")}`,"red")),process.exit(1));let w=!v.includes("no-docs"),D=!v.includes("no-lib"),E=!v.includes("no-es"),C=!v.includes("no-dts"),S=v.filter(o=>!["no-docs","no-es","no-lib"].includes(o));if(await f("production",h,$,S),"library"===h){let{CONFIG:s}=await import("../config.mjs"),m="swc"===s.dts,r=[D&&{type:"commonjs",dir:"lib",msg:"Convert to CommonJS"},E&&{type:"es6",dir:"es",msg:"Convert to ES Module"}].filter(Boolean),f=d.resolve("typescript/bin/tsc"),h=e(g,".types.json");C&&!m&&r.length&&p(h,JSON.stringify({extends:t(g,e(u,"tsconfig.json")),include:[t(g,e(u,"components")),t(g,e(u,"typings"))],exclude:[t(g,e(u,"components/**/examples/*")),t(g,e(u,"components/**/__tests__/*")),t(g,e(u,"components/**/__mocks__/*"))]}));for(let t=0,s=r.length;t<s;t++){let s=e(u,`./${r[t].dir}`);n(s);let p=y($);"es6"===r[t].type&&(p.jsc.target="es2015"),p.jsc.experimental.emitIsolatedDts=C&&m,p.jsc.experimental.cacheRoot=j,p.module.type=r[t].type,_({outDir:r[t].dir,filenames:["components"],copyFiles:!0,ignore:["**/*.test.(js|ts)x?$"]},p,function(){l(s,["README.mdx","examples","__*__"]).forEach(c),i(s),"commonjs"===r[t].type&&x()}),C&&!m&&o(`${a} ${f} --project ${h} --outDir ${r[t].dir}`,b)}}("library"!==h||w&&"library"===h)&&import("../build.mjs")}export default h;
|
package/lib/bin/changelog.d.mts
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import { execSync } from 'node:child_process';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { argv } from 'node:process';
|
|
4
|
+
import { updateFileSync } from '@moneko/utils';
|
|
5
|
+
import log from '../commom/log.mjs';
|
|
6
|
+
import { cwd } from './utils/config.mjs';
|
|
7
|
+
declare function getRemoteUrl();
|
|
8
|
+
declare const types: Record<string, string>;
|
|
9
|
+
declare function extractCommits(text: string);
|
|
10
|
+
declare function getCommitsBetweenTags(tag1?: string, tag2?: string);
|
|
11
|
+
declare function getTags(remoteUrl: string);
|
|
12
|
+
export default function changelog();
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { swcDir } from '@swc/cli';
|
|
2
|
+
import type { Config as SwcConfig } from '@swc/core';
|
|
3
|
+
export type CliOptions = {
|
|
4
|
+
outDir: string;
|
|
5
|
+
filenames: string[];
|
|
6
|
+
extensions?: string[];
|
|
7
|
+
stripLeadingPaths?: boolean;
|
|
8
|
+
outFileExtension?: string;
|
|
9
|
+
quiet?: boolean;
|
|
10
|
+
copyFiles?: boolean;
|
|
11
|
+
ignore?: string[];
|
|
12
|
+
};
|
|
13
|
+
declare function convert(cliOptions: CliOptions, swcOptions: SwcConfig, onSuccess: VoidFunction);
|
|
14
|
+
export default convert;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{swcDir as s}from"@swc/cli";export default function(t,i,c){s({cliOptions:{extensions:[".ts",".js",".tsx",".jsx",".mts",".mjs",".cts",".cjs"],stripLeadingPaths:!0,quiet:!0,...t},swcOptions:i,callbacks:{onSuccess:c}})}
|
package/lib/bin/eslint.d.mts
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { relative } from 'node:path';
|
|
2
|
+
import { argv } from 'node:process';
|
|
3
|
+
import { ink, print } from '@moneko/utils';
|
|
4
|
+
import { ESLint } from 'eslint';
|
|
5
|
+
import { cachePath, cwd, parseBraced } from './utils/config.mjs';
|
|
6
|
+
export default async function eslint();
|
package/lib/bin/eslint.mjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{
|
|
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=await u.lintFiles(c(n).map(t=>e(a,t))),d=await u.loadFormatter("stylish"),w=await d.format(p);f&&await r.outputFixes(p),w&&process.stdout.write(w);let h=p.some(e=>e.errorCount>0);i(`${l}: ${o(`✨ ${h?"Error":"Successfully"}!
|
|
2
|
+
`,h?"red":"green")}`,!0),h&&process.exit(1)}
|
package/lib/bin/file.d.mts
CHANGED
package/lib/bin/git-hooks.d.mts
CHANGED
package/lib/bin/git-hooks.mjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{spawn as o}from"node:child_process";import{argv as e}from"node:process";import{ink as l,print as t}from"@moneko/utils";export default function s(){let s=l("githooks","cyan");t(`${s}: ${l("Runing...","yellow")}`,!0);let i="node_modules/.husky",n=e.slice(3).map(o=>{let e=o.split("=");return`echo ${e[1]} > ${i}/${e[0]}`}).join(" && ");o(`git init && husky ${i} && ${n}`,{stdio:[null],shell:!0}).on("close",function(o){let e=0!==o;t(`${s}: ${l(`✨ ${e?"Error":"Successfully"}!
|
|
2
|
+
`,e?"red":"green")}`,!0),process.exit(o)})}
|
package/lib/bin/help.d.mts
CHANGED
package/lib/bin/index.d.mts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
import { argv } from 'node:process';
|
|
3
|
+
import { ink, println } from '@moneko/utils';
|
|
4
|
+
import require from '../commom/require.mjs';
|
|
5
|
+
import sigintExit from '../commom/sigint-exit.mjs';
|
|
6
|
+
import { corePkg } from './utils/config.mjs';
|
package/lib/bin/lessc.d.mts
CHANGED
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { exec } from 'node:child_process';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { loadFile, saveFile, scanFolderSync } from '@moneko/utils';
|
|
4
|
+
import require from '../commom/require.mjs';
|
|
5
|
+
import { corePkg, runtimePath } from './utils/config.mjs';
|
|
6
|
+
declare let modifyVarBash: string;
|
|
7
|
+
declare function lessc(file: string);
|
|
8
|
+
declare const lessRegExp: RegExp;
|
|
9
|
+
declare async function lesscFile(filepath: string);
|
|
10
|
+
export declare async function lesscCommonjs();
|
package/lib/bin/start.d.mts
CHANGED
package/lib/bin/start.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{argv as e}from"node:process";import{ink as o,println as t}from"@moneko/utils";import m from"../commom/setup-env.mjs";async function i(){let i=e[3],r=e[4],p=e.slice(5);i||(t(o(`type: 无效值 ${o(i,"245")}`,"red")),process.exit(1));let s=p.indexOf("no-verify");-1!==s&&p.splice(s,1),await m("development",i,r,p),import("../dev.mjs")}export default i;
|
package/lib/bin/stylelint.d.mts
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { relative } from 'node:path';
|
|
2
|
+
import { argv } from 'node:process';
|
|
3
|
+
import { ink, print } from '@moneko/utils';
|
|
4
|
+
import stylelints from 'stylelint';
|
|
5
|
+
import { cachePath, cwd, parseBraced } from './utils/config.mjs';
|
|
6
|
+
export default async function stylelint();
|
package/lib/bin/stylelint.mjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{relative as s}from"node:path";import{argv as e}from"node:process";import{ink as t,print as r}from"@moneko/utils";import o from"stylelint";import{cachePath as i,cwd as c,parseBraced as l}from"./utils/config.mjs";export default async function n(){let n=t("stylelint","cyan");r(`${n}: ${t("Runing...","yellow")}`,!0);let a=e[3],f=e.slice(4),m=f.includes("--fix"),p=await o.lint({files:l(a).map(e=>s(c,`${e}/**/**/**/**/*.{css,scss,sass,less,ts,tsx,js,jsx}`)),fix:m,cache:!f.includes("--cache=false"),cacheLocation:`${i}/.stylelintcache`,formatter:"string"}),u=p.errored;p.report&&process.stdout.write(p.report),r(`${n}: ${t(`✨ ${u?"Error":"Successfully"}!
|
|
2
|
+
`,u?"red":"green")}`,!0),u&&process.exit(1)}
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { execSync } from 'node:child_process';
|
|
2
|
+
import { renameSync } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { bundleIpa, createDir, ink, print } from '@moneko/utils';
|
|
5
|
+
export declare function bundleApk(outputPath: string, outputBundleDir: string, type?: string);
|
|
6
|
+
export declare function bundleIOS(outputPath: string, outputBundleDir: string, type?: string);
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
import { dirname, join } from 'node:path';
|
|
2
|
+
declare const Deno: VoidFunction;
|
|
3
|
+
declare const Bun: VoidFunction;
|
|
4
|
+
declare function getRuntime();
|
|
5
|
+
declare const runtime: 'deno' | 'bun' | 'node';
|
|
6
|
+
declare let runtimeDir: string;
|
|
1
7
|
export declare const runtimePath: string;
|
|
2
|
-
export declare const corePkg
|
|
8
|
+
export declare const corePkg: string;
|
|
3
9
|
export declare const cwd: string;
|
|
4
10
|
export declare const cachePath: string;
|
|
5
11
|
export declare const swcCachePath: string;
|
|
12
|
+
export declare function parseBraced(input: string);
|
package/lib/bin/utils/config.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{dirname as e,join as o}from"node:path";let
|
|
1
|
+
import{dirname as e,join as o}from"node:path";let t="undefined"!=typeof Deno?"deno":"undefined"!=typeof Bun?"bun":"node",c=e(process.execPath);"win32"===process.platform&&c.includes(" ")&&(c=`"${c}"`);export const runtimePath=o(c,t);export const corePkg="@moneko/core";export const cwd=process.cwd();export const cachePath=o(cwd,"node_modules/.cache");export const swcCachePath=o(cachePath,".swc");export function parseBraced(e){return e.startsWith("[")&&e.endsWith("]")?e.slice(1,-1).split(","):[e]}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { Config, JscConfig } from '@swc/core';
|
|
2
|
+
import require from '../../commom/require.mjs';
|
|
3
|
+
export declare function getSwcOption(framework: string): Config;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"../../commom/require.mjs";export function getSwcOption(o){let r="solid"===o;return{module:{type:"es6"},minify:!0,jsc:{minify:{mangle:!0,compress:!0,format:{comments:"some"}},parser:{syntax:"typescript",decorators:!0,dynamicImport:!0,tsx:!0},loose:!0,target:"es2022",externalHelpers:!1,transform:{legacyDecorator:!0,decoratorMetadata:!0,react:{runtime:"automatic",throwIfNamespace:!0,useBuiltins:!0,refresh:"react"===o,development:!1,importSource:r?"solid-js/h":void 0}},experimental:{plugins:[[e.resolve("@moneko/transform-imports"),{"@moneko/common":{transform:"@moneko/common/lib/${member}"},lodash:{transform:"lodash/${member}"},"@ant-design/icons":{transform:"es/icons/${member}"},antd:{transform:"es/${member}",memberTransformers:["dashed_case"]},"neko-ui":{transform:"es/${member}",memberTransformers:["dashed_case"]}}],r&&[e.resolve("@moneko/jsx-dom-expressions"),{moduleName:"solid-js/web",builtIns:["For","Show","Switch","Match","Suspense","SuspenseList","Portal","Index","Dynamic","ErrorBoundary"],contextToCustomElements:!0,wrapConditionals:!0,generate:"dom",hydratable:!1}]].filter(Boolean)}},sourceMaps:!0,exclude:["__tests__/","examples/","\\.d\\.ts$"]}}
|
package/lib/build/common.d.mts
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
|
2
|
+
import TerserPlugin from 'terser-webpack-plugin';
|
|
3
|
+
import webpack, { type Configuration } from 'webpack';
|
|
4
|
+
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
|
|
5
|
+
import { merge } from 'webpack-merge';
|
|
6
|
+
import { commonConfig } from '../common.mjs';
|
|
7
|
+
import { CONFIG } from '../config.mjs';
|
|
8
|
+
import { getMinifyOption } from '../options/js-minify.mjs';
|
|
9
|
+
import { LightningCssMinifyPlugin } from '../plugin/lightningcss-plugin.mjs';
|
|
10
|
+
import { getLightningCssTargets } from '../polyfills/targets.mjs';
|
|
11
|
+
declare const minimizer: readonly [];
|
|
12
|
+
declare const defaultPerformance: Configuration['performance'];
|
|
13
|
+
declare const buildCommon: Configuration;
|
|
3
14
|
export default buildCommon;
|
package/lib/build/common.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"mini-css-extract-plugin";import i from"terser-webpack-plugin";import n from"webpack";import{BundleAnalyzerPlugin as m}from"webpack-bundle-analyzer";import{merge as r}from"webpack-merge";import{commonConfig as t}from"../common.mjs";import{CONFIG as o}from"../config.mjs";import{getMinifyOption as s}from"../options/js-minify.mjs";import{LightningCssMinifyPlugin as l}from"../plugin/lightningcss-plugin.mjs";import{getLightningCssTargets as p}from"../polyfills/targets.mjs";let
|
|
1
|
+
import e from"mini-css-extract-plugin";import i from"terser-webpack-plugin";import n from"webpack";import{BundleAnalyzerPlugin as m}from"webpack-bundle-analyzer";import{merge as r}from"webpack-merge";import{commonConfig as t}from"../common.mjs";import{CONFIG as o}from"../config.mjs";import{getMinifyOption as s}from"../options/js-minify.mjs";import{LightningCssMinifyPlugin as l}from"../plugin/lightningcss-plugin.mjs";import{getLightningCssTargets as p}from"../polyfills/targets.mjs";let a=[];o.minifier&&(a.push(new i(s(o.minifier.type,o.minifier.options))),a.push(new l({targets:p()})));let u={maxAssetSize:256e3,maxEntrypointSize:256e3,assetFilter:e=>!e.endsWith(".map")&&!e.endsWith("ce28377f3a428346.js"),...o.performance},c=r(t,{performance:o.performance&&u,plugins:[new e({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",ignoreOrder:!0}),o.splitChunk&&new n.optimize.MinChunkSizePlugin({minChunkSize:51200}),o.bundleAnalyzer&&new m({analyzerMode:"static",reportFilename:"report.html",openAnalyzer:!1,defaultSizes:"gzip",logLevel:"silent",...o.bundleAnalyzer})].filter(Boolean),optimization:{splitChunks:o.splitChunk,runtimeChunk:o.runtimeChunk,chunkIds:"deterministic",moduleIds:"deterministic",concatenateModules:!0,emitOnErrors:!1,removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,minimize:!0,minimizer:a}});export default c;
|
package/lib/build/server.d.mts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { type Configuration } from 'webpack';
|
|
2
|
+
import { CUSTOMCONFIG } from '../commom/paths.mjs';
|
|
3
|
+
import moduleConfig from '../module.config.mjs';
|
|
4
|
+
import { isLibrary } from '../process-env.mjs';
|
|
5
|
+
import { resolveProgram } from '../utils/index.mjs';
|
|
2
6
|
declare const serverOption: Configuration;
|
|
3
7
|
export default serverOption;
|
package/lib/build.d.mts
CHANGED
|
@@ -1 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
import { relative } from 'node:path';
|
|
2
|
+
import { analyzeBundleSize, completedInfo, ink, println, progressBar } from '@moneko/utils';
|
|
3
|
+
import webpack, { type Stats, type WebpackPluginInstance } from 'webpack';
|
|
4
|
+
import { merge } from 'webpack-merge';
|
|
5
|
+
import buildCommon from './build/common.mjs';
|
|
6
|
+
import paths from './commom/paths.mjs';
|
|
7
|
+
import DoneWebpackPlugin from './plugin/done.mjs';
|
|
8
|
+
import { empty } from './utils/index.mjs';
|
|
9
|
+
import seo from './utils/seo.mjs';
|
|
10
|
+
import { CONFIG } from './config.mjs';
|
|
11
|
+
import moduleConfig from './module.config.mjs';
|
|
12
|
+
declare const bar: {
|
|
13
|
+
name: string;
|
|
14
|
+
color: string;
|
|
15
|
+
};
|
|
16
|
+
declare const bar_name: string;
|
|
17
|
+
declare const ProgressPlugin: typeof webpack.ProgressPlugin;
|
|
18
|
+
declare const clientOption: webpack.Configuration;
|
|
19
|
+
declare const instance: webpack.Compiler;
|
|
20
|
+
declare function printCompilationMessages(stats: Stats);
|
|
21
|
+
declare async function build();
|
package/lib/build.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{relative as o}from"node:path";import{analyzeBundleSize as
|
|
1
|
+
import{relative as o}from"node:path";import{analyzeBundleSize as r,completedInfo as m,ink as i,println as t,progressBar as e}from"@moneko/utils";import n from"webpack";import{merge as s}from"webpack-merge";import a from"./build/common.mjs";import p from"./commom/paths.mjs";import l from"./plugin/done.mjs";import{empty as c}from"./utils/index.mjs";import u from"./utils/seo.mjs";import{CONFIG as f}from"./config.mjs";import d from"./module.config.mjs";let g=f.bar.name||"Build",h=n.ProgressPlugin,w=n(s(a,{module:d(!1),plugins:[f.done&&new l({done:f.done}),!!f.bar&&new h({handler(o,r,...m){e(o||0,1,g,m.length?`[${r}] ${m.join(" ")}`:""),1===o&&process.stdout.write("\r\x1b[2K")}})].filter(Boolean)}));async function j(){let e=await new Promise((o,r)=>{w.run((m,i)=>{m&&r(m),i?o(i):r(Error("编译过程中没有生成统计信息"))})});(e.hasErrors()||e.hasWarnings())&&function(o){let{warnings:r,errors:m}=o.compilation;r.forEach(o=>{t(i(o.message,"178"))}),m.forEach(o=>{t(i(o.message,"red"))})}(e),await new Promise(n=>{e.compilation.compiler.cache.shutdown(s=>{s&&t(i(s.toString(),"red")),r(e.compilation.outputOptions.path,["\\.js$"]),m(~~((e.endTime-e.startTime)/10)/100,o(p.programPath,e.compilation.outputOptions.path)),n()})}),f.seo&&u()}process.on("exit",c),await j();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ConfigType } from '../index.mjs';
|
|
2
|
-
export declare function diffObject(prev?: Partial<ConfigType>, next?: Partial<ConfigType>)
|
|
2
|
+
export declare function diffObject(prev?: Partial<ConfigType>, next?: Partial<ConfigType>);
|
package/lib/commom/esm.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function esm(templateStrings: TemplateStringsArray, ...substitutions: unknown[])
|
|
1
|
+
declare function esm(templateStrings: TemplateStringsArray, ...substitutions: unknown[]);
|
|
2
2
|
export default esm;
|
package/lib/commom/has-pkg.d.mts
CHANGED
package/lib/commom/log.d.mts
CHANGED
package/lib/commom/log.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{appendToFile as t}from"@moneko/utils";
|
|
2
|
-
${
|
|
3
|
-
`;t(`logs/${
|
|
1
|
+
import{appendToFile as t}from"@moneko/utils";let e=new Date,r=process.hrtime();export default function(n){let a=function(){let t=process.hrtime(r),n=t[0],a=t[1],i=new Date(e.getTime()+1e3*n+Math.floor(a/1e6)),g=i.getFullYear(),o=String(i.getMonth()+1).padStart(2,"0"),$=String(i.getDate()).padStart(2,"0"),S=String(i.getHours()).padStart(2,"0"),l=String(i.getMinutes()).padStart(2,"0"),p=String(i.getSeconds()).padStart(2,"0"),s=String(Math.floor(a%1e6/1e3)).padStart(3,"0"),d=String(a%1e3).padStart(3,"0");return`${g}-${o}-${$} ${S}:${l}:${p}.${s}${d}`}(),i=String(n).split("\n"),g=`[${a}] ${i[0]}`,o=" ".repeat(`[${a}] `.length),$=i.slice(1).map(t=>`${o}${t}`).join("\n"),S=`${g}${$?`
|
|
2
|
+
${$}`:""}
|
|
3
|
+
`;t(`logs/${a.substring(0,16)}.log`,S)}
|
|
@@ -2,21 +2,5 @@ type MatchPath = {
|
|
|
2
2
|
path: string;
|
|
3
3
|
params: Record<string, unknown>;
|
|
4
4
|
};
|
|
5
|
-
/**
|
|
6
|
-
* RESTful 风格api
|
|
7
|
-
* @param {String} pattern pattern
|
|
8
|
-
* @param {String} path paths
|
|
9
|
-
* @example
|
|
10
|
-
* const pattern = '/users/:id';
|
|
11
|
-
* const pathToMatch = '/users/123';
|
|
12
|
-
* const result = matchPath(pattern, pathToMatch);
|
|
13
|
-
* if (result) {
|
|
14
|
-
* console.log('Match found:', result);
|
|
15
|
-
* console.log('Params:', result.params);
|
|
16
|
-
* } else {
|
|
17
|
-
* console.log('No match found.');
|
|
18
|
-
* }
|
|
19
|
-
* @returns {MatchPath|null} MatchPath
|
|
20
|
-
*/
|
|
21
5
|
declare function matchPath(pattern: string, path: string): MatchPath | null;
|
|
22
6
|
export default matchPath;
|
package/lib/commom/net.d.mts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { createConnection } from 'node:net';
|
|
2
|
+
import { networkInterfaces } from 'node:os';
|
|
3
|
+
export declare function getIPv4();
|
|
4
|
+
export declare function getPort<T = number>(start: T, host?: string);
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import { resolve } from 'node:path';
|
|
2
|
+
import paths from './paths.mjs';
|
|
3
|
+
export type ModuleMeta = {
|
|
2
4
|
name: string;
|
|
3
5
|
main: string;
|
|
4
6
|
pkg: string;
|
|
5
7
|
file: string;
|
|
6
8
|
meta: string;
|
|
7
9
|
};
|
|
10
|
+
declare function parseModuleMeta(path: string, version?: number): ModuleMeta;
|
|
8
11
|
export default parseModuleMeta;
|
package/lib/commom/paths.d.mts
CHANGED
|
@@ -1,48 +1,30 @@
|
|
|
1
|
-
|
|
1
|
+
import { resolve } from 'node:path';
|
|
2
|
+
import url from 'node:url';
|
|
3
|
+
import { fileExists } from '@moneko/utils';
|
|
4
|
+
declare const original: string[];
|
|
2
5
|
export declare const __dirname: string;
|
|
3
|
-
/** yarn 命令行参数对象,包含配置选项 */
|
|
4
6
|
export declare const yarnArgv: Record<string, string> & {
|
|
5
7
|
config?: string;
|
|
6
8
|
};
|
|
7
|
-
/** 附加启动配置名称
|
|
8
|
-
* @example
|
|
9
|
-
* 当通过以下命令启动时, 此时 CUSTOMCONFIG 为 test
|
|
10
|
-
* ```sh
|
|
11
|
-
* npm run start --config=test
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
14
9
|
export declare const CUSTOMCONFIG: string | undefined;
|
|
10
|
+
declare const programPath: string;
|
|
11
|
+
declare const nodeModules: string;
|
|
15
12
|
declare const paths: {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
httpCachePath: string;
|
|
32
|
-
/** SWC 缓存目录路径 */
|
|
33
|
-
swcCachePath: string;
|
|
34
|
-
/** 默认配置文件路径 */
|
|
35
|
-
configPath: string;
|
|
36
|
-
/** 自定义配置文件路径 */
|
|
37
|
-
customConfigPath: string;
|
|
38
|
-
/** 测试覆盖率报告路径 */
|
|
39
|
-
coveragePath: string;
|
|
40
|
-
/** 页面目录路径 */
|
|
41
|
-
pagesPath: string;
|
|
42
|
-
/** 组件目录路径 */
|
|
43
|
-
componentsPath: string;
|
|
44
|
-
/** Mock 数据目录路径 */
|
|
45
|
-
mockPath: string;
|
|
13
|
+
readonly nodeModules;
|
|
14
|
+
readonly pnpmNodeModules;
|
|
15
|
+
readonly denoNodeModules;
|
|
16
|
+
readonly corePath;
|
|
17
|
+
readonly programPath;
|
|
18
|
+
readonly webpackCachePath;
|
|
19
|
+
readonly lintCachePath;
|
|
20
|
+
readonly httpCachePath;
|
|
21
|
+
readonly swcCachePath;
|
|
22
|
+
readonly configPath;
|
|
23
|
+
readonly customConfigPath;
|
|
24
|
+
readonly coveragePath;
|
|
25
|
+
readonly pagesPath;
|
|
26
|
+
readonly componentsPath;
|
|
27
|
+
readonly mockPath;
|
|
46
28
|
};
|
|
47
29
|
export declare const config_files: string[];
|
|
48
30
|
export declare const routeDir: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import EventEmitter from 'node:events';
|
|
2
2
|
declare class ReactiveObject<T extends object = Record<string, string | undefined>> extends EventEmitter {
|
|
3
3
|
readonly data: T;
|
|
4
|
-
constructor(props
|
|
5
|
-
setData(key: keyof T, value: T[keyof T])
|
|
6
|
-
getData(key: keyof T)
|
|
7
|
-
removeData(key: keyof T)
|
|
4
|
+
constructor(props = {} as T);
|
|
5
|
+
setData(key: keyof T, value: T[keyof T]);
|
|
6
|
+
getData(key: keyof T);
|
|
7
|
+
removeData(key: keyof T);
|
|
8
8
|
[Symbol.iterator](): Iterator<[keyof T, T[keyof T]]>;
|
|
9
9
|
}
|
|
10
10
|
export default ReactiveObject;
|
package/lib/commom/require.d.mts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import { type Options, transformFileSync } from '@swc/core';
|
|
1
3
|
declare const require: NodeRequire;
|
|
4
|
+
declare const transformOptions: Options;
|
|
5
|
+
declare function requireEsm(module: NodeJS.Module & {
|
|
6
|
+
_compile?: (code: string, filename: string) => void;
|
|
7
|
+
}, filename: string);
|
|
2
8
|
export default require;
|
package/lib/commom/rule.d.mts
CHANGED
|
@@ -1,26 +1,20 @@
|
|
|
1
1
|
declare const Rule: {
|
|
2
|
-
js: RegExp;
|
|
3
|
-
css: RegExp;
|
|
4
|
-
less: RegExp;
|
|
5
|
-
scss: RegExp;
|
|
6
|
-
wasm: RegExp;
|
|
7
|
-
txt: RegExp;
|
|
8
|
-
image: RegExp;
|
|
9
|
-
video: RegExp;
|
|
10
|
-
font: RegExp;
|
|
11
|
-
markdown: RegExp;
|
|
12
|
-
tsdoc: RegExp;
|
|
13
|
-
css_module: RegExp;
|
|
14
|
-
node_modules_css_module: RegExp;
|
|
15
|
-
node_modules: RegExp;
|
|
16
|
-
__tests__: RegExp;
|
|
17
|
-
dev_watch_ignored: RegExp;
|
|
18
|
-
|
|
19
|
-
* 提取函数字符串
|
|
20
|
-
* @example
|
|
21
|
-
* // () => import('@app')
|
|
22
|
-
* "rr(() => import('@app'))rr".replace(Rule.extract_func, '$1')
|
|
23
|
-
* */
|
|
24
|
-
extract_func: RegExp;
|
|
2
|
+
readonly js: RegExp;
|
|
3
|
+
readonly css: RegExp;
|
|
4
|
+
readonly less: RegExp;
|
|
5
|
+
readonly scss: RegExp;
|
|
6
|
+
readonly wasm: RegExp;
|
|
7
|
+
readonly txt: RegExp;
|
|
8
|
+
readonly image: RegExp;
|
|
9
|
+
readonly video: RegExp;
|
|
10
|
+
readonly font: RegExp;
|
|
11
|
+
readonly markdown: RegExp;
|
|
12
|
+
readonly tsdoc: RegExp;
|
|
13
|
+
readonly css_module: RegExp;
|
|
14
|
+
readonly node_modules_css_module: RegExp;
|
|
15
|
+
readonly node_modules: RegExp;
|
|
16
|
+
readonly __tests__: RegExp;
|
|
17
|
+
readonly dev_watch_ignored: RegExp;
|
|
18
|
+
readonly extract_func: RegExp;
|
|
25
19
|
};
|
|
26
20
|
export default Rule;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
APPTYPE: string;
|
|
4
|
-
FRAMEWORK: string;
|
|
5
|
-
}>;
|
|
1
|
+
import { loadFile } from '@moneko/utils';
|
|
2
|
+
declare async function setupEnv(mode: string, type: string, framework: string, args: string[]);
|
|
6
3
|
export default setupEnv;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function sigintExit(call: VoidFunction)
|
|
1
|
+
declare function sigintExit(call: VoidFunction);
|
|
2
2
|
export default sigintExit;
|
package/lib/common.d.mts
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { extname, join, resolve } from 'node:path';
|
|
2
|
+
import type { Configuration, FileCacheOptions, ResolvePluginInstance } from 'webpack';
|
|
3
|
+
import paths, { config_files, CUSTOMCONFIG } from './commom/paths.mjs';
|
|
4
|
+
import OverrideResolverPlugin, { type OverrideResolverOption } from './plugin/override-resolve.mjs';
|
|
5
|
+
import { isObject, node_modules, resolveProgram } from './utils/index.mjs';
|
|
6
|
+
import { exampleModuleName } from './vm/example.mjs';
|
|
7
|
+
import app from './vm/info.mjs';
|
|
8
|
+
import { CONFIG, PUBLICPATH } from './config.mjs';
|
|
9
|
+
import plugins from './plugins.config.mjs';
|
|
10
|
+
import { isDev, isLibrary, NODE_ENV, PACKAGENAME, PACKAGEVERSION } from './process-env.mjs';
|
|
2
11
|
export declare const outputConfig: Configuration['output'];
|
|
12
|
+
declare let entryMap: Configuration['entry'];
|
|
13
|
+
declare let cacheConfig: FileCacheOptions | false;
|
|
14
|
+
declare const overrideResolve: {
|
|
15
|
+
original: string;
|
|
16
|
+
override: string;
|
|
17
|
+
};
|
|
3
18
|
export declare const commonConfig: Configuration;
|