@moneko/core 3.54.0-beta.2 → 3.54.0-beta.3
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/commit-lint.d.mts +1 -42
- package/lib/bin/commit-lint.mjs +1 -1
- package/lib/bin/file.d.mts +0 -2
- package/lib/bin/index.d.mts +1 -5
- package/lib/bin/pin.d.mts +4 -38
- package/lib/bin/pure-lint.d.mts +1 -31
- package/lib/bin/pure-lint.mjs +1 -1
- package/lib/bin/setup.d.mts +0 -3
- package/lib/bin/utils/convert-solid.d.mts +3 -6
- package/lib/bin/utils/convert-solid.mjs +1 -1
- package/lib/bin/utils/setup-swcrc.d.mts +1 -3
- package/lib/build/common.d.mts +1 -10
- package/lib/build/server.d.mts +0 -5
- package/lib/build.d.mts +1 -16
- package/lib/commom/ca.d.mts +7 -17
- package/lib/commom/ca.mjs +1 -1
- package/lib/commom/esm.d.mts +1 -1
- package/lib/commom/has-pkg.d.mts +0 -1
- package/lib/commom/is-ci-environment.d.mts +4 -2
- package/lib/commom/log.d.mts +1 -6
- package/lib/commom/match-path.d.mts +16 -1
- package/lib/commom/parse-module-meta.d.mts +0 -2
- package/lib/commom/print-log.d.mts +0 -1
- package/lib/commom/require.d.mts +0 -6
- package/lib/commom/timer.d.mts +3 -4
- package/lib/common.d.mts +1 -14
- package/lib/config.d.mts +0 -24
- package/lib/dev/generate-progress-html.d.mts +1 -1
- package/lib/dev/json-schema.d.mts +3 -3
- package/lib/dev/proxy.d.mts +3 -7
- package/lib/dev.d.mts +1 -48
- package/lib/dev.mjs +2 -2
- package/lib/file-system.d.mts +1 -1
- package/lib/loader/lightning-css/runtime/api.d.cts +5 -3
- package/lib/loader/lightning-css/runtime/get-url.cjs +1 -1
- package/lib/loader/lightning-css/runtime/get-url.d.cts +1 -9
- package/lib/module.config.d.mts +3 -49
- package/lib/module.config.mjs +1 -1
- package/lib/options/css-extract.d.mts +0 -5
- package/lib/options/modify-vars.d.mts +0 -9
- package/lib/options/split-chunk.d.mts +0 -2
- package/lib/plugin/eslint.d.mts +6 -14
- package/lib/plugin/module-federation.d.mts +1 -19
- package/lib/plugin/stylelint.d.mts +6 -14
- package/lib/plugins.config.d.mts +1 -10
- package/lib/polyfills/replace-children.d.mts +1 -1
- package/lib/process-env.d.mts +4 -8
- package/lib/utils/compile-dts.d.mts +16 -3
- package/lib/utils/create-types.d.mts +0 -13
- package/lib/utils/create-types.mjs +1 -1
- package/lib/utils/dts.d.mts +12 -5
- package/lib/utils/svg-to-data-uri.d.mts +1 -58
- package/lib/utils/vts.d.mts +14 -6
- package/lib/vm/docs.d.mts +0 -11
- package/lib/vm/docs.mjs +1 -1
- package/lib/vm/info.d.mts +0 -3
- package/lib/vm/locales.d.mts +0 -24
- package/lib/vm/modules.d.mts +0 -25
- package/lib/vm/render-app.d.mts +0 -9
- package/lib/worker/dts.d.mts +1 -2
- package/lib/worker/eslint.d.mts +0 -6
- package/lib/worker/eslint.mjs +1 -1
- package/lib/worker/react-compiler.d.mts +23 -8
- package/lib/worker/react-compiler.mjs +1 -1
- package/lib/worker/stylelint.d.mts +0 -4
- package/lib/worker/swc-minify.d.mts +1 -2
- package/package.json +3 -3
- package/lib/bin/build-app.d.mts +0 -11
- package/lib/bin/build-app.mjs +0 -1
- package/lib/bin/build.d.mts +0 -13
- package/lib/bin/build.mjs +0 -1
- package/lib/bin/changelog.d.mts +0 -12
- package/lib/bin/changelog.mjs +0 -4
- package/lib/bin/eslint.d.mts +0 -6
- package/lib/bin/eslint.mjs +0 -2
- package/lib/bin/git-hooks.d.mts +0 -5
- package/lib/bin/git-hooks.mjs +0 -2
- package/lib/bin/help.d.mts +0 -85
- package/lib/bin/help.mjs +0 -13
- package/lib/bin/lessc.d.mts +0 -10
- package/lib/bin/lessc.mjs +0 -1
- package/lib/bin/server.d.mts +0 -14
- package/lib/bin/server.mjs +0 -1
- package/lib/bin/start.d.mts +0 -5
- package/lib/bin/start.mjs +0 -1
- package/lib/bin/stylelint.d.mts +0 -7
- package/lib/bin/stylelint.mjs +0 -2
- package/lib/bin/tsc.d.mts +0 -6
- package/lib/bin/tsc.mjs +0 -1
- package/lib/bin/utils/bundle-app.d.mts +0 -7
- package/lib/bin/utils/bundle-app.mjs +0 -1
- package/lib/bin/utils/config.d.mts +0 -13
- package/lib/bin/utils/config.mjs +0 -1
- package/lib/bin/utils/get-commit-files.d.mts +0 -3
- package/lib/bin/utils/get-commit-files.mjs +0 -1
- package/lib/commom/check-npm.d.mts +0 -4
- package/lib/commom/check-npm.mjs +0 -1
- package/lib/commom/corepack.d.mts +0 -12
- package/lib/commom/corepack.mjs +0 -1
- package/lib/commom/diff-object.d.mts +0 -2
- package/lib/commom/diff-object.mjs +0 -1
- package/lib/commom/host.d.mts +0 -3
- package/lib/commom/host.mjs +0 -19
- package/lib/commom/module-resolve.d.mts +0 -3
- package/lib/commom/module-resolve.mjs +0 -1
- package/lib/commom/net.d.mts +0 -4
- package/lib/commom/net.mjs +0 -1
- package/lib/commom/open.d.mts +0 -5
- package/lib/commom/open.mjs +0 -1
- package/lib/commom/paths.d.mts +0 -36
- package/lib/commom/paths.mjs +0 -1
- package/lib/commom/reactive-object.d.mts +0 -10
- package/lib/commom/reactive-object.mjs +0 -1
- package/lib/commom/rule.d.mts +0 -20
- package/lib/commom/rule.mjs +0 -1
- package/lib/commom/setup-env.d.mts +0 -4
- package/lib/commom/setup-env.mjs +0 -1
- package/lib/commom/sigint-exit.d.mts +0 -3
- package/lib/commom/sigint-exit.mjs +0 -1
- package/lib/commom/transform-solid-js.d.mts +0 -41
- package/lib/commom/transform-solid-js.mjs +0 -1
- package/lib/dev/config.d.mts +0 -14
- package/lib/dev/config.mjs +0 -2
- package/lib/dev/get-cert.d.mts +0 -10
- package/lib/dev/get-cert.mjs +0 -1
- package/lib/dev/mock.d.mts +0 -61
- package/lib/dev/mock.mjs +0 -1
- package/lib/dev/server.d.mts +0 -34
- package/lib/dev/server.mjs +0 -1
- package/lib/loader/css-in-js-minify.cjs +0 -1
- package/lib/loader/css-in-js-minify.d.cts +0 -22
- package/lib/loader/lightning-css/codegen.cjs +0 -20
- package/lib/loader/lightning-css/codegen.d.cts +0 -36
- package/lib/loader/lightning-css/loader.cjs +0 -1
- package/lib/loader/lightning-css/loader.d.cts +0 -49
- package/lib/loader/lightning-css/utils.cjs +0 -1
- package/lib/loader/lightning-css/utils.d.cts +0 -26
- package/lib/loader/mdx.cjs +0 -1
- package/lib/loader/mdx.d.cts +0 -4
- package/lib/loader/react-compiler.cjs +0 -1
- package/lib/loader/react-compiler.d.cts +0 -21
- package/lib/loader/solid.cjs +0 -1
- package/lib/loader/solid.d.cts +0 -9
- package/lib/loader/ts-doc.cjs +0 -1
- package/lib/loader/ts-doc.d.cts +0 -11
- package/lib/options/md-to-html.d.mts +0 -5
- package/lib/options/md-to-html.mjs +0 -1
- package/lib/options/reslove.d.mts +0 -11
- package/lib/options/reslove.mjs +0 -1
- package/lib/options/swcrc.d.mts +0 -21
- package/lib/options/swcrc.mjs +0 -1
- package/lib/plugin/compression.d.mts +0 -17
- package/lib/plugin/compression.mjs +0 -1
- package/lib/plugin/copy.d.mts +0 -21
- package/lib/plugin/copy.mjs +0 -1
- package/lib/plugin/done.d.mts +0 -11
- package/lib/plugin/done.mjs +0 -1
- package/lib/plugin/exposes-declararion.d.mts +0 -20
- package/lib/plugin/exposes-declararion.mjs +0 -1
- package/lib/plugin/external-remotes.d.mts +0 -8
- package/lib/plugin/external-remotes.mjs +0 -1
- package/lib/plugin/html-plugin.d.mts +0 -48
- package/lib/plugin/html-plugin.mjs +0 -1
- package/lib/plugin/lightningcss-plugin.d.mts +0 -31
- package/lib/plugin/lightningcss-plugin.mjs +0 -1
- package/lib/plugin/manifest.d.mts +0 -43
- package/lib/plugin/manifest.mjs +0 -1
- package/lib/plugin/override-resolve.d.mts +0 -14
- package/lib/plugin/override-resolve.mjs +0 -1
- package/lib/plugin/swc-minify-plugin.d.mts +0 -13
- package/lib/plugin/swc-minify-plugin.mjs +0 -1
- package/lib/plugin/virtual-module.d.mts +0 -24
- package/lib/plugin/virtual-module.mjs +0 -1
- package/lib/polyfills/polyfills.d.mts +0 -7
- package/lib/polyfills/polyfills.mjs +0 -1
- package/lib/polyfills/targets.d.mts +0 -8
- package/lib/polyfills/targets.mjs +0 -1
- package/lib/utils/fetch-module-federation-dts.d.mts +0 -6
- package/lib/utils/fetch-module-federation-dts.mjs +0 -1
- package/lib/utils/index.d.mts +0 -12
- package/lib/utils/index.mjs +0 -1
- package/lib/utils/run.d.mts +0 -3
- package/lib/utils/run.mjs +0 -1
- package/lib/utils/seo.d.mts +0 -10
- package/lib/utils/seo.mjs +0 -4
- package/lib/vm/coverage.d.mts +0 -39
- package/lib/vm/coverage.mjs +0 -1
- package/lib/vm/example.d.mts +0 -12
- package/lib/vm/example.mjs +0 -1
- package/lib/vm/generate-doc.d.mts +0 -35
- package/lib/vm/generate-doc.mjs +0 -1
- package/lib/vm/routes.d.mts +0 -17
- package/lib/vm/routes.mjs +0 -1
- package/lib/vm/utils.d.mts +0 -5
- package/lib/vm/utils.mjs +0 -1
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Buffer } from 'node:buffer';
|
|
2
|
-
import { type Targets, transform as _transform } from 'lightningcss';
|
|
3
|
-
import webpack, { type Compilation, type Compiler, type ModuleFilenameHelpers, type sources } from 'webpack';
|
|
4
|
-
declare const encoder: TextEncoder;
|
|
5
|
-
declare const RawSource: typeof sources.RawSource;
|
|
6
|
-
declare const SourceMapSource: typeof sources.SourceMapSource;
|
|
7
|
-
declare const matchObject: typeof ModuleFilenameHelpers.matchObject;
|
|
8
|
-
declare const PLUGIN_NAME: string;
|
|
9
|
-
declare const CSS_FILE_REG: RegExp;
|
|
10
|
-
type Filter = string | RegExp;
|
|
11
|
-
type Implementation = typeof import('lightningcss');
|
|
12
|
-
interface MinifyPluginOpts {
|
|
13
|
-
implementation?: Implementation;
|
|
14
|
-
sourceMap?: boolean;
|
|
15
|
-
test?: RegExp;
|
|
16
|
-
include?: Filter | Filter[];
|
|
17
|
-
exclude?: Filter | Filter[];
|
|
18
|
-
targets?: Targets;
|
|
19
|
-
}
|
|
20
|
-
interface CacheItem {
|
|
21
|
-
source: sources.Source;
|
|
22
|
-
map?: string | object | Buffer;
|
|
23
|
-
minimized: boolean;
|
|
24
|
-
}
|
|
25
|
-
export declare class LightningCssMinifyPlugin {
|
|
26
|
-
private readonly options: Omit<MinifyPluginOpts, 'implementation'>;
|
|
27
|
-
private readonly transform: Implementation['transform'];
|
|
28
|
-
constructor(opts: MinifyPluginOpts = {});
|
|
29
|
-
apply(compiler: Compiler);
|
|
30
|
-
private async transformAssets(compilation: Compilation): Promise<void>;
|
|
31
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Buffer as s}from"node:buffer";import{transform as e}from"lightningcss";import i from"webpack";let t=new TextEncoder,o=i.sources.RawSource,n=i.sources.SourceMapSource,a=i.ModuleFilenameHelpers.matchObject,r="lightning-css-minify",m=/\.(c|le|sc|sa)ss(?:\?.*)?$/i;export class LightningCssMinifyPlugin{constructor(s={}){let{implementation:i,...t}=s;if(i&&"function"!=typeof i.transform)throw TypeError(`[LightningCssMinifyPlugin]: implementation.transform must be an 'lightningcss' transform function. Received ${typeof i.transform}`);this.transform=i?.transform??e,this.options=t}apply(s){let e=JSON.stringify({name:r,version:"0.0.1",options:this.options});s.hooks.compilation.tap(r,s=>{s.hooks.chunkHash.tap(r,(s,i)=>i.update(e)),s.hooks.processAssets.tapPromise({name:r,stage:i.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE,additionalAssets:!0},async()=>await this.transformAssets(s)),s.hooks.statsPrinter.tap(r,s=>{s.hooks.print.for("asset.info.minimized").tap(r,(s,{green:e,formatFlag:i})=>s?e(i("minimized")):void 0)})})}async transformAssets(e){let{options:{devtool:i}}=e.compiler,{include:c,exclude:p,test:f,sourceMap:l=void 0===this.options.sourceMap?!!(i&&i.includes("source-map")):this.options.sourceMap,...u}=this.options,h=e.getCache(r),d=e.getAssets().filter(s=>!s.info.minimized&&(f||m).test(s.name)&&a({include:c,exclude:p},s.name));await Promise.all(d.map(async i=>{let a;let r=h.getItemCache(JSON.stringify(i.name),h.getLazyHashedEtag(i.source)),m=await r.getPromise();if(m&&m.minimized){e.updateAsset(i.name,m.source,{...i.info,minimized:!0});return}let c=i.source.source(),p="string"==typeof c?t.encode(c):c,f=this.transform({filename:i.name,code:p,minify:!0,sourceMap:l,...u}),d=s.from(f.code),g={source:a=l?new n(d,i.name,f.map||"",c,f.map||"",!0):new o(d),minimized:!0};await r.storePromise(g),e.updateAsset(i.name,a,{...i.info,minimized:!0})}))}}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { Compilation, Compiler } from 'webpack';
|
|
2
|
-
import { packageJson } from '../process-env.mjs';
|
|
3
|
-
interface Icon {
|
|
4
|
-
src: string;
|
|
5
|
-
type: string;
|
|
6
|
-
sizes: string;
|
|
7
|
-
}
|
|
8
|
-
export interface ManifestPluginOption {
|
|
9
|
-
filename: string;
|
|
10
|
-
id?: string;
|
|
11
|
-
name?: string;
|
|
12
|
-
version?: string;
|
|
13
|
-
short_name?: string;
|
|
14
|
-
description?: string;
|
|
15
|
-
start_url?: string;
|
|
16
|
-
display?: string;
|
|
17
|
-
background_color?: string;
|
|
18
|
-
theme_color?: string;
|
|
19
|
-
icons?: Icon[];
|
|
20
|
-
shortcuts?: {
|
|
21
|
-
name: string;
|
|
22
|
-
short_name: string;
|
|
23
|
-
description: string;
|
|
24
|
-
url: string;
|
|
25
|
-
icons: Icon[];
|
|
26
|
-
}[];
|
|
27
|
-
screenshots?: {
|
|
28
|
-
src: string;
|
|
29
|
-
type: string;
|
|
30
|
-
sizes: string;
|
|
31
|
-
form_factor: string;
|
|
32
|
-
}[];
|
|
33
|
-
content_assets?: string[];
|
|
34
|
-
[key: string]: unknown;
|
|
35
|
-
}
|
|
36
|
-
declare const base: ManifestPluginOption;
|
|
37
|
-
export declare function generateManifest(override: Partial<ManifestPluginOption>, hash?: string, content_assets?: string[]);
|
|
38
|
-
export declare class ManifestPlugin {
|
|
39
|
-
private name: string;
|
|
40
|
-
private options: ManifestPluginOption;
|
|
41
|
-
constructor(options?: Partial<ManifestPluginOption>);
|
|
42
|
-
apply(compiler: Compiler);
|
|
43
|
-
}
|
package/lib/plugin/manifest.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{packageJson as s}from"../process-env.mjs";let e={filename:"manifest.json",name:s.name,short_name:s.shortName,description:s.description,start_url:s.startUrl??"/?source=pwa",display:s.display??"standalone",background_color:s.backgroundColor??"#fff",theme_color:s.themeColor,icons:[{src:"/favicon.ico",sizes:"48x48",type:"image/x-icon"}]};export function generateManifest(t,o,a){return Object.assign({},e,t,{version:`${s.version}-${o}`,hash:o,content_assets:a})}export class ManifestPlugin{constructor(s){this.name="ManifestPlugin",this.options=Object.assign({},e,s??{})}apply(s){let e=this.name,{filename:t,...o}=this.options;s.hooks.thisCompilation.tap(e,a=>{a.hooks.processAssets.tap({name:e,stage:s.webpack.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE},e=>{a.emitAsset(t,new s.webpack.sources.RawSource(JSON.stringify(generateManifest(o,a.fullHash,Object.keys(e)))),{javascriptModule:!1})})})}}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { relative } from 'node:path';
|
|
2
|
-
import { fileExists } from '@moneko/utils';
|
|
3
|
-
import type { Resolver } from 'webpack';
|
|
4
|
-
import paths from '../commom/paths.mjs';
|
|
5
|
-
export interface OverrideResolverOption {
|
|
6
|
-
original?: string;
|
|
7
|
-
override?: string;
|
|
8
|
-
}
|
|
9
|
-
declare const PLUGIN_NAME: string;
|
|
10
|
-
export declare class OverrideResolverPlugin {
|
|
11
|
-
private readonly options: Required<OverrideResolverOption>;
|
|
12
|
-
constructor(options: Required<OverrideResolverOption>);
|
|
13
|
-
apply(resolver: Resolver);
|
|
14
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{relative as e}from"node:path";import{fileExists as t}from"@moneko/utils";import r from"../commom/paths.mjs";let o="OverrideResolverPlugin";export class OverrideResolverPlugin{constructor(e){this.options=e}apply(i){let s=i.ensureHook("resolved"),{override:a,original:l}=this.options;if(a&&l){let n=`./${e(r.programPath,l)}`,p=`./${e(r.programPath,a)}`;i.getHook("existing-file").tapAsync(o,(e,r,h)=>{let m=e.request||e.path;if(m&&m.startsWith(l)&&e.relativePath){let u=m.replace(l,a);if(t(u)){let t=e.relativePath.replace(n,p);return Object.assign(e,{path:u,relativePath:t,__innerRequest_relativePath:t,__innerRequest:t}),i.doResolve(s,e,`${o} 使用目标模块${a}`,r,h)}}return h()})}}}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { type JsMinifyOptions, minify } from '@swc/core';
|
|
2
|
-
import webpack, { type Compilation, type Compiler, type sources, WebpackError } from 'webpack';
|
|
3
|
-
declare const SourceMapSource: typeof sources.SourceMapSource;
|
|
4
|
-
interface CacheItem {
|
|
5
|
-
source: sources.SourceMapSource;
|
|
6
|
-
minimized: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare class SwcMinifyPlugin {
|
|
9
|
-
private name: string;
|
|
10
|
-
private options: JsMinifyOptions;
|
|
11
|
-
constructor(options: JsMinifyOptions);
|
|
12
|
-
apply(compiler: Compiler);
|
|
13
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{minify as e}from"@swc/core";import s from"webpack";let o=s.sources.SourceMapSource;export class SwcMinifyPlugin{constructor(e){this.name="SwcMinifyPlugin",this.options={format:{comments:!1},ecma:2015,compress:{drop_console:!0,drop_debugger:!0,global_defs:{"@alert":"console.log"},pure_funcs:["console.log","console.warn","console.error","console.info"],ecma:2015,toplevel:!1,module:!1,ie8:!1,keep_classnames:void 0,keep_fnames:!1,top_retain:[],keep_infinity:!0},mangle:!0,sourceMap:!0,...e}}apply(t){t.hooks.compilation.tap(this.name,t=>{t.hooks.processAssets.tapAsync({name:this.name,stage:s.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE,additionalAssets:!0},async(s,i)=>{let a=t.getCache(this.name),n=Object.keys(s).filter(e=>e.endsWith(".js")&&!e.endsWith(".min.js"));try{await Promise.all(n.map(async s=>{let i=t.getAsset(s);if(!i||i.info.minimized)return;let n=a.getItemCache(JSON.stringify(i.name),a.getLazyHashedEtag(i.source)),r=await n.getPromise();if(r&&r.minimized){t.updateAsset(i.name,r.source,{...i.info,minimized:!0});return}let c=i.source.sourceAndMap();try{let s=await e(c.source.toString().replace(/\r\n/g,"\n"),this.options),a={sources:[i.name]};s.map&&((a=JSON.parse(s.map)).sources=[i.name],delete a.sourcesContent);let r={source:new o(s.code,i.name,a||"",c.source,c.map||"",!0),minimized:!0};await n.storePromise(r),t.updateAsset(i.name,r.source,{...i.info,minimized:!0})}catch(e){t.errors.push(e)}})),i()}catch(e){i(e)}})})}}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { Compiler, WebpackPluginInstance } from 'webpack';
|
|
2
|
-
import VirtualModulesPlugin from 'webpack-virtual-modules';
|
|
3
|
-
import parseModuleMeta from '../commom/parse-module-meta.mjs';
|
|
4
|
-
import paths from '../commom/paths.mjs';
|
|
5
|
-
import { isLibrary } from '../process-env.mjs';
|
|
6
|
-
import { node_modules, transformModule } from '../utils/index.mjs';
|
|
7
|
-
import { comment, docs } from '../vm/docs.mjs';
|
|
8
|
-
import { examples } from '../vm/example.mjs';
|
|
9
|
-
import { locales } from '../vm/locales.mjs';
|
|
10
|
-
import modules from '../vm/modules.mjs';
|
|
11
|
-
import { route } from '../vm/routes.mjs';
|
|
12
|
-
declare const defaultModules: Record<string, string>;
|
|
13
|
-
export interface VirtualModulePluginOption {
|
|
14
|
-
[key: string]: string | object;
|
|
15
|
-
}
|
|
16
|
-
declare const PLUGIN_NAME: string;
|
|
17
|
-
export declare class VirtualModuleWebpackPlugin implements WebpackPluginInstance {
|
|
18
|
-
private virtualModules: VirtualModulesPlugin;
|
|
19
|
-
private options: Record<string, string>;
|
|
20
|
-
private init: boolean;
|
|
21
|
-
constructor(options: VirtualModulePluginOption = {});
|
|
22
|
-
private modify(compiler: Compiler, key: string, moduleContents?: string);
|
|
23
|
-
apply(compiler: Compiler);
|
|
24
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import o from"webpack-virtual-modules";import t 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 m,docs as l}from"../vm/docs.mjs";import{examples as p}from"../vm/example.mjs";import{locales as n}from"../vm/locales.mjs";import a from"../vm/modules.mjs";import{route as f}from"../vm/routes.mjs";let c={};for(let o in a)if(Object.prototype.hasOwnProperty.call(a,o)){let{file:i,pkg:e,meta:s}=t(o);c[e]=s,c[i]=r(a[o])}export class VirtualModuleWebpackPlugin{constructor(i={}){this.options={},this.init=!1,this.virtualModules=new o(c);let e={};for(let o in i)if(Object.prototype.hasOwnProperty.call(i,o)){let{file:s,pkg:m,meta:l}=t(o),p=i[o],n=p;n=s.endsWith("json")?"string"==typeof p?p:JSON.stringify(p):r(p),Object.assign(e,{[s]:n,[m]:l})}this.options=e}modify(o,t,e){let r=t.startsWith(i.nodeModules)?t:s(t);this.virtualModules.writeModule(r,e||"")}apply(o){this.virtualModules.apply(o);let t=(t,i)=>{this.modify(o,t,i)};f.on("change",t),n.on("change",t),e&&(p.on("change",t),l.on("change",t),m.on("change",t)),o.hooks.compilation.tap("VirtualModuleWebpackPlugin",()=>{if(!this.init){for(let o in this.init=!0,this.options)Object.prototype.hasOwnProperty.call(this.options,o)&&t(o,this.options[o]);for(let o of p)t(o[0],o[1]);for(let o of l)t(o[0],o[1]);for(let o of m)t(o[0],o[1])}})}}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import compat from 'core-js-compat';
|
|
2
|
-
import require from '../commom/require.mjs';
|
|
3
|
-
import { getBrowsersTargets } from './targets.mjs';
|
|
4
|
-
declare const _coreJsVersion: string;
|
|
5
|
-
export declare const coreJsVersion: string;
|
|
6
|
-
declare function polyfills();
|
|
7
|
-
export default polyfills;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import r from"core-js-compat";import o from"../commom/require.mjs";import{getBrowsersTargets as e}from"./targets.mjs";let s=o("core-js/package.json").version;export const coreJsVersion=s.substring(0,s.indexOf(".",2));export default function(){return r({targets:e(),version:coreJsVersion}).list}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { env } from 'node:process';
|
|
2
|
-
import browsersList from 'browserslist';
|
|
3
|
-
import { browserslistToTargets, type Targets } from 'lightningcss';
|
|
4
|
-
import paths from '../commom/paths.mjs';
|
|
5
|
-
declare let browserTargets: string[] | undefined;
|
|
6
|
-
export declare function getBrowsersTargets();
|
|
7
|
-
declare let lightningCssTargets: Targets | undefined;
|
|
8
|
-
export declare function getLightningCssTargets();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
let r,t;import{env as o}from"node:process";import e from"browserslist";import{browserslistToTargets as s}from"lightningcss";import i from"../commom/paths.mjs";export function getBrowsersTargets(){return r||(r=e(void 0,{path:i.programPath,env:o.NODE_ENV}).filter(r=>!r.endsWith(" TP"))),r}export function getLightningCssTargets(){return t||(t=s(getBrowsersTargets())),t}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { request } from '@moneko/request';
|
|
2
|
-
import { updateFile } from '@moneko/utils';
|
|
3
|
-
import log from '../commom/log.mjs';
|
|
4
|
-
import { node_modules } from './index.mjs';
|
|
5
|
-
declare async function fetchModuleFederationDts(host: string, name: string);
|
|
6
|
-
export default fetchModuleFederationDts;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{request as t}from"@moneko/request";import{updateFile as o}from"@moneko/utils";import e from"../commom/log.mjs";import{node_modules as m}from"./index.mjs";async function r(r,i){try{let e=`${r.startsWith("//")?`http:${r}`:r}/module-federation.d.ts`,s=await t(e,{responseType:"text",rejectUnauthorized:!1});o(m(`@types/${i}/index.d.ts`),s)}catch(t){e(t)}}export default r;
|
package/lib/utils/index.d.mts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { resolve } from 'node:path';
|
|
2
|
-
import paths from '../commom/paths.mjs';
|
|
3
|
-
export declare function toCamelCase(str: string): string;
|
|
4
|
-
export declare function convertToCamelCase(name: string): string;
|
|
5
|
-
type ProgramPath<T extends string> = `${T extends string ? T : string}`;
|
|
6
|
-
export declare function resolveProgram<T extends string>(src: T): ProgramPath<T>;
|
|
7
|
-
export declare function node_modules<T extends string>(name: T): `node_modules/${T}`;
|
|
8
|
-
export declare function isObject(target: unknown): target is object;
|
|
9
|
-
type AnyFunction = (...a: any[]) => any;
|
|
10
|
-
export declare function isFunction<T>(target: T): target is T & AnyFunction;
|
|
11
|
-
export declare function transformModule(obj: object | string);
|
|
12
|
-
export declare function empty();
|
package/lib/utils/index.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
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/utils/run.d.mts
DELETED
package/lib/utils/run.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"node:vm";export default function(n,r){return e.runInThisContext(n||"",{filename:r,lineOffset:0,columnOffset:0,displayErrors:!0})}
|
package/lib/utils/seo.d.mts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { join } from 'node:path';
|
|
2
|
-
import { scanRouter, sitemap } from '@moneko/mdx';
|
|
3
|
-
import { saveFileSync } from '@moneko/utils';
|
|
4
|
-
import { routeDir } from '../commom/paths.mjs';
|
|
5
|
-
import { outputConfig } from '../common.mjs';
|
|
6
|
-
import { CONFIG } from '../config.mjs';
|
|
7
|
-
import { isLibrary } from '../process-env.mjs';
|
|
8
|
-
import { resolveProgram } from './index.mjs';
|
|
9
|
-
declare const seo: () => any;
|
|
10
|
-
export default seo;
|
package/lib/utils/seo.mjs
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{join as o}from"node:path";import{scanRouter as m,sitemap as t}from"@moneko/mdx";import{saveFileSync as r}from"@moneko/utils";import{routeDir as e}from"../commom/paths.mjs";import{outputConfig as p}from"../common.mjs";import{CONFIG as i}from"../config.mjs";import{isLibrary as s}from"../process-env.mjs";import{resolveProgram as n}from"./index.mjs";export default(()=>{let{domain:f,jekyll:a,path:l}=i.seo||{},j=l&&n(l)||p?.path;if(!f||!j)return;let x=`https://${f}${i.basename}`;r(o(j,"CNAME"),f),r(o(j,"robots.txt"),`User-agent: *
|
|
2
|
-
Allow: /
|
|
3
|
-
|
|
4
|
-
Sitemap: ${x}/sitemap.txt`),r(o(j,"sitemap.txt"),[x,...t(e,x,m(e,s))].join("\n")),a||r(o(j,".nojekyll"),"")});
|
package/lib/vm/coverage.d.mts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { fileExists, parseXml } from '@moneko/utils';
|
|
2
|
-
import { PACKAGENAME } from '../process-env.mjs';
|
|
3
|
-
type CoverageType = {
|
|
4
|
-
statements: string;
|
|
5
|
-
coveredstatements: string;
|
|
6
|
-
conditionals: string;
|
|
7
|
-
coveredconditionals: string;
|
|
8
|
-
methods: string;
|
|
9
|
-
coveredmethods: string;
|
|
10
|
-
};
|
|
11
|
-
type ProjectCoverageType = {
|
|
12
|
-
elements: string;
|
|
13
|
-
coveredelements: string;
|
|
14
|
-
complexity: string;
|
|
15
|
-
loc: string;
|
|
16
|
-
ncloc: string;
|
|
17
|
-
packages: string;
|
|
18
|
-
files: string;
|
|
19
|
-
classes: string;
|
|
20
|
-
};
|
|
21
|
-
type CoverageResult = {
|
|
22
|
-
coverage: {
|
|
23
|
-
project: {
|
|
24
|
-
metrics: {
|
|
25
|
-
$: object;
|
|
26
|
-
};
|
|
27
|
-
package: {
|
|
28
|
-
$: {
|
|
29
|
-
name: string;
|
|
30
|
-
};
|
|
31
|
-
metrics: {
|
|
32
|
-
$: string;
|
|
33
|
-
};
|
|
34
|
-
}[];
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
declare function getCoverage(coveragePath: string);
|
|
39
|
-
export default getCoverage;
|
package/lib/vm/coverage.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{fileExists as e,parseXml as t}from"@moneko/utils";import{PACKAGENAME as r}from"../process-env.mjs";export default function(o){let i="export default {}";if(e(o)){let e={},s=t(o);if(s){let{metrics:t,package:o}=JSON.parse(s).coverage.project;Object.assign(e,{[r]:t.$});for(let t=0,r=o.length;t<r;t++){let r=o[t];Object.assign(e,{[r.$.name]:r.metrics.$})}}i=`export default ${JSON.stringify(e)}`}return i}
|
package/lib/vm/example.d.mts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { generateExample } from '@moneko/mdx';
|
|
2
|
-
import parseModuleMeta from '../commom/parse-module-meta.mjs';
|
|
3
|
-
import paths from '../commom/paths.mjs';
|
|
4
|
-
import ReactiveObject from '../commom/reactive-object.mjs';
|
|
5
|
-
import Rule from '../commom/rule.mjs';
|
|
6
|
-
import { CONFIG } from '../config.mjs';
|
|
7
|
-
import { isDev, isLibrary } from '../process-env.mjs';
|
|
8
|
-
import { watchFiles } from './utils.mjs';
|
|
9
|
-
export declare const exampleModuleName: string;
|
|
10
|
-
declare function getExample();
|
|
11
|
-
export declare const examples: ReactiveObject<Record<string, string>>;
|
|
12
|
-
export declare function generatorExample();
|
package/lib/vm/example.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{generateExample as e}from"@moneko/mdx";import o from"../commom/parse-module-meta.mjs";import t from"../commom/paths.mjs";import m from"../commom/reactive-object.mjs";import r from"../commom/rule.mjs";import{CONFIG as p}from"../config.mjs";import{isDev as a,isLibrary as l}from"../process-env.mjs";import{watchFiles as n}from"./utils.mjs";export const exampleModuleName="@app/example";function s(){if(!l||!1===p.htmlPluginOption)return{};let m=JSON.parse(e(t.componentsPath,`${exampleModuleName}/`,"6")),a={};for(let e in m)Object.prototype.hasOwnProperty.call(m,e)&&Object.assign(a,{[e]:`rr(() => import('${e}'))rr`});let n={...m,[exampleModuleName]:`export default ${JSON.stringify(a).replace(r.extract_func,"$1")}`},s={};for(let e in n)if(Object.prototype.hasOwnProperty.call(n,e)){let{file:t,pkg:m,meta:r}=o(e);s[m]=r,s[t]=n[e]}return s}export const examples=new m(s());export function generatorExample(){let e=s();for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&examples.setData(o,e[o])}l&&a&&!1!==p.htmlPluginOption&&n(t.componentsPath,/(?<!\/examples\/(.+)\.md)$/,generatorExample);
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { dirname } from 'node:path';
|
|
2
|
-
import ts, { type EnumDeclaration, type EnumMember, type InterfaceDeclaration, type MethodSignature, type PropertySignature } from 'typescript';
|
|
3
|
-
import { CONFIG } from '../config.mjs';
|
|
4
|
-
import mdToHtml from '../options/md-to-html.mjs';
|
|
5
|
-
declare const ScriptKind: typeof ts.ScriptKind;
|
|
6
|
-
declare const ScriptTarget: typeof ts.ScriptTarget;
|
|
7
|
-
declare const SyntaxKind: typeof ts.SyntaxKind;
|
|
8
|
-
declare const createSourceFile: typeof ts.createSourceFile;
|
|
9
|
-
declare const forEachChild: typeof ts.forEachChild;
|
|
10
|
-
declare const getLeadingCommentRanges: typeof ts.getLeadingCommentRanges;
|
|
11
|
-
declare const isInterfaceDeclaration: typeof ts.isInterfaceDeclaration;
|
|
12
|
-
declare const isQuestionToken: typeof ts.isQuestionToken;
|
|
13
|
-
declare const isPropertySignature: typeof ts.isPropertySignature;
|
|
14
|
-
declare const isFunctionTypeNode: typeof ts.isFunctionTypeNode;
|
|
15
|
-
declare const isUnionTypeNode: typeof ts.isUnionTypeNode;
|
|
16
|
-
declare const isMethodSignature: typeof ts.isMethodSignature;
|
|
17
|
-
declare const allType: Record<string, string>;
|
|
18
|
-
declare function getPropertyComment(propertyNode: InterfaceDeclaration | PropertySignature | EnumMember | EnumDeclaration);
|
|
19
|
-
declare function getDefaultValueFromComment(commentText?: string);
|
|
20
|
-
declare function getVersionFromComment(commentText?: string);
|
|
21
|
-
declare function getExampleComment(commentText?: string);
|
|
22
|
-
declare function getAuthor(commentText?: string);
|
|
23
|
-
declare function getIgnore(commentText?: string);
|
|
24
|
-
declare const regex: RegExp;
|
|
25
|
-
declare function getTypeText(typeText?: string, hasColor?: boolean);
|
|
26
|
-
declare function getMemberValue(memberNode: EnumMember);
|
|
27
|
-
declare function replacePairedSymbols(inputString?: string);
|
|
28
|
-
declare function isFunctionTypeProperty(member: PropertySignature): boolean;
|
|
29
|
-
declare function replaceText(str?: string);
|
|
30
|
-
declare function getBaseInterfaces(interfaceNode: InterfaceDeclaration);
|
|
31
|
-
declare function getComment(comment?: string);
|
|
32
|
-
declare function getMethodText(member: PropertySignature | MethodSignature);
|
|
33
|
-
declare function generateInterfaceDocumentation(node: InterfaceDeclaration);
|
|
34
|
-
declare function generateEnumDocumentation(node: EnumDeclaration);
|
|
35
|
-
export default function generateDoc(content: string, path: string);
|
package/lib/vm/generate-doc.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{dirname as e}from"node:path";import t from"typescript";import{CONFIG as n}from"../config.mjs";import r from"../options/md-to-html.mjs";let l=t.ScriptKind,o=t.ScriptTarget,i=t.SyntaxKind,a=t.createSourceFile,c=t.forEachChild,s=t.getLeadingCommentRanges,u=t.isInterfaceDeclaration,f=t.isQuestionToken,m=t.isPropertySignature,p=t.isFunctionTypeNode,g=t.isUnionTypeNode,$=t.isMethodSignature,d={};function h(e){let t=s(e.getSourceFile().text,e.pos);if(t){let n=e.getSourceFile().text.slice(t[0].pos,t[0].end).match(/\/\*\*([\s\S]*?)\*\//);if(n)return n[1].replaceAll(/^\s*\* ?/gm,"").replace(/\s+$/,"").trim()}}function b(e){if(!e)return;let t=e.match(/@since\s+([^\n]+)/);return t?t[1].trim():void 0}function y(e){if(!e)return;let t=e.match(/@author (\w+)\s*(?:<([^>]+)>)?/);if(t&&t.length>0){let e=t[1].trim(),n=t[2]?.trim(),r=/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(n);return n?r&&(n=`mailto:${n}`):n=`https://github.com/${e}`,`[${e}](${n})`}}function x(e){if(!e)return;let t=e.match(/@ignore\s+([^\n]+)/);return t?t[1].trim():void 0}let A=/(?<!['"])(unknown|any|void|bigint|object|undefined|null|boolean|number|string|symbol)(?!['"])/g;function j(e,t){if(!e)return;let r=e.replaceAll(/\b([A-Z][a-zA-Z0-9]*)\b/g,e=>{if(d[e]){let r=`/${[n.basename,d[e]].join("/").split("/").filter(Boolean).join("/")}`;return t?`[\\color{#009688}{${e}}](${r})`:`[${e}](${r})`}return t?`\\color{#009688}{${e}}`:e});return t&&(r=r.replaceAll(A,e=>`\\color{#009688}{${e}}`)),r}function S(e){if(e)return(function(e){let t;if(!e)return;let n=[];for(;t=/\\color{([^|}]*)\|?([^|}]*)\|?([^|}]*)\|?([^}]*)}{([^}]*)}/g.exec(e);)n.push(t[0]);return e.replaceAll(/[{}[\]()=>]|keyof|typeof|true|false/g,e=>n.some(t=>t.includes(e))?e:`\\color{#569cd6}{${e}}`)})(e)?.replaceAll(/^\s*\|\s*|\s*\|\s*$/gm,"").replaceAll(/\n/g,"<br/>").replaceAll(/\*/g,"\\*").replaceAll(/\|/g,"\\|").replaceAll(/(['"])((?:(?!\1).)*)\1/g,"\\color{#ce9178}{$1$2$1}")}function T(e){if(e)return e.replaceAll(/@example\s*([\s\S]*?)(?=@[a-zA-Z]|\n*$)/g,"").replaceAll(/^@[a-z].+/gm,"").replaceAll(/(\n\s+)+/g,"<br />").replaceAll(/\n/g,"<br />").replaceAll(/(<br \/>)$/g,"")}export default function k(s,A){let k=a(A,s,o.Latest,!0,l.TS),v="";return c(k,r=>{u(r)?v+=function(r){let l=r.name.text;Object.assign(d,{[r.name.text]:e(r.getSourceFile().fileName).replace(n.alias["@pkg"],"")});let o=h(r),a=b(o),c=T(o),s=x(o)?.split("|")||[],u=s.includes("comment"),A=s.includes("initial"),k=s.includes("optional"),v=s.includes("version"),w=s.includes("author"),B=c?`\\color{|4||0.45}{${l}}`:l,z=(function(e){let n=[];if(e.heritageClauses){for(let r of e.heritageClauses)if(r.token===t.SyntaxKind.ExtendsKeyword)for(let e of r.types)n.push(e.getText())}return n})(r)?.map(e=>`<n-tag color="#4c81db" css=".tag{gap:0px;}">${j(S(e))}</n-tag>`),F=[c,B,a&&`\\color{#52c11b|1||0.9}{${a}}`,z.length>0&&`<sub>\`extends\`</sub> ${z.join(" ")}`].filter(Boolean).join(" "),N=`## ${F}`,K=r.members.filter(e=>m(e)&&e.type?.kind!==i.NeverKeyword||$(e)),C=[];if(K.length>0){for(let e=0,t=K.length;e<t;e++){let t=K[e],n=j(S($(t)?`(${t.parameters.map(e=>`${e.name.getText()}: ${e.type?.getText()||"any"}`).join(", ")}): ${t.type?.getText()||"any"}`:t.type?.getText()||"any"),!0),r=h(t),l=S(t.name.getText());!l||l.startsWith("\\color")||($(t)||function(e){if(e.type){if(!g(e.type))return p(e.type);for(let t of e.type.types)if(p(t))return!0}return!1}(t)||n?.includes("=>")?l=`\\color{#f9a913}{${l}}`:/^["'](.+)["']$/.test(l)||(l=`\\color{#4c81db}{${l}}`));let i=t.questionToken&&f(t.questionToken);C.push([l,!k&&`\\color{${i?"#f9a913":"#52c11b"}\\|\\|\\|0.9}{${i?"✘":"✔"}}`,!u&&S(T(r)),n,!A&&S(function(e){if(!e)return;let t=e.match(/@default\s+([^\n]+)/);return t?t[1].trim():void 0}(r)),!v&&S(b(r)),!w&&(y(r)||y(o)),function(e){if(!e)return;let t=e.match(/@example\s*([\s\S]*?)(?=@[a-zA-Z]|\n*$)/);return t?t[1].trim():void 0}(r)])}let e=!1,t=!1,n=!1,r=!1;for(let l=0,o=C.length;l<o;l++){let o=C[l];!u&&o[2]&&(r=!0),!A&&o[4]&&(n=!0),!v&&o[5]&&(t=!0),!w&&o[6]&&(e=!0)}N+="\n";let l=["属性",!k&&"必要",r&&"说明","类型",n&&"默认值",t&&"版本",e&&"作者"].filter(Boolean).join("|");N+=`|${l}|`;let i=[":-",!k&&":-",r&&":-",":-",n&&":-",t&&":-",e&&":-"].filter(Boolean);N+="\n";let a=i.join("|");N+=`|${a}|`;for(let l=0,o=C.length;l<o;l++){let o=C[l];N+="\n";let i=[(o[7]?`<n-popover arrow="true" trigger="click" content=${JSON.stringify(`<n-md css=.n-md-body{margin-bottom:0;padding:0.5rem;background-color:transparent;backdrop-filter:none;box-shadow:none;}>${o[7]}</n-md>`)}><n-button size="small" type="primary" circle="true" style="margin-right:8px;">?</n-button></n-popover>`:"")+(o[0]||"-"),!k&&(o[1]||"-"),r&&(o[2]||"-"),o[3]||"-",n&&(o[4]||"-"),t&&(o[5]||"-"),e&&(o[6]||"-")].filter(Boolean).join("|");N+=`|${i}|`}N+="\n"}return N+"\n"}(r):t.isEnumDeclaration(r)&&(v+=function(r){let l=r.name.text,o=h(r),i=T(o),a=b(o);Object.assign(d,{[r.name.text]:e(r.getSourceFile().fileName).replace(n.alias["@pkg"],"")});let c=i?`\\color{|4||0.45}{${l}}`:l,s=[i,c,a&&`\\color{#52c11b|1||0.9}{${a}}`].filter(Boolean).join(" "),u=x(o)?.split("|")||[],f=u.includes("comment"),m=u.includes("version"),p=u.includes("author"),g=`## ${s}`;if(r.members.length>0){let e=[];for(let n=0,l=r.members.length;n<l;n++){let l=r.members[n],i=S(l.name.getText()),a=h(l),c=S(function(e){let n=e.initializer;if(n&&t.isStringLiteral(n))return` '${n.text}'`}(l)),s=S(b(a)),u=S(T(a));!i||i.startsWith("\\color")||/^["'](.+)["']$/.test(i)||(i=`\\color{#4c81db}{${i}}`),e.push([i,!f&&u,c,!m&&s,!p&&(y(a)||y(o))])}let n=!1,l=!1,i=!1;for(let t=0,r=e.length;t<r;t++){let r=e[t];!f&&r[1]&&(i=!0),!m&&r[3]&&(l=!0),!p&&r[4]&&(n=!0)}g+="\n";let a=["属性",i&&"说明","值",l&&"版本",n&&"作者"].filter(Boolean).join("|");g+=`|${a}|`;let c=[":-",i&&":-",":-",l&&":-",n&&":-"].filter(Boolean);g+="\n";let s=c.join("|");g+=`|${s}|`;for(let t=0,r=e.length;t<r;t++){let r=e[t];g+="\n";let o=[r[0]||"-",i&&(r[1]||"-"),r[2]||"-",l&&(r[3]||"-"),n&&(r[4]||"-")].filter(Boolean).join("|");g+=`|${o}|`}}return g+"\n\n"}(r))}),r(v)}
|
package/lib/vm/routes.d.mts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { generateRouter } from '@moneko/mdx';
|
|
2
|
-
import parseModuleMeta, { type ModuleMeta } from '../commom/parse-module-meta.mjs';
|
|
3
|
-
import { routeDir } from '../commom/paths.mjs';
|
|
4
|
-
import ReactiveObject from '../commom/reactive-object.mjs';
|
|
5
|
-
import { CONFIG } from '../config.mjs';
|
|
6
|
-
import { FRAMEWORK, isDev, isLibrary } from '../process-env.mjs';
|
|
7
|
-
import { watchFiles } from './utils.mjs';
|
|
8
|
-
declare const routerAlia: '@pkg' | '@/pages';
|
|
9
|
-
declare const moduleMeta: ModuleMeta;
|
|
10
|
-
export declare const routesModuleName: string;
|
|
11
|
-
export declare const routesModulePkgJson: string;
|
|
12
|
-
export declare const routesModuleMeta: string;
|
|
13
|
-
declare function getRouter();
|
|
14
|
-
export declare const route: ReactiveObject<{
|
|
15
|
-
[x: string]: string;
|
|
16
|
-
}>;
|
|
17
|
-
export declare function generatorRouter();
|
package/lib/vm/routes.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{generateRouter as o}from"@moneko/mdx";import e from"../commom/parse-module-meta.mjs";import{routeDir as t}from"../commom/paths.mjs";import r from"../commom/reactive-object.mjs";import{CONFIG as m}from"../config.mjs";import{FRAMEWORK as s,isDev as u,isLibrary as n}from"../process-env.mjs";import{watchFiles as p}from"./utils.mjs";let a=n?"@pkg":"@/pages",i=e("@app/routes");export const routesModuleName=i.file;export const routesModulePkgJson=i.pkg;export const routesModuleMeta=i.meta;function l(){return!1===m.htmlPluginOption?"":o(t,`${m.alias["@"]}/router/index.ts`,s,a,n,"6")}export const route=new r({[routesModuleName]:l(),[routesModulePkgJson]:routesModuleMeta});export function generatorRouter(){route.setData(routesModuleName,l())}u&&p(t,n?/(?<!README\.mdx?)$/:/(?<!index\.tsx?)$/,generatorRouter);
|
package/lib/vm/utils.d.mts
DELETED
package/lib/vm/utils.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{watch as i}from"chokidar";import o from"../commom/sigint-exit.mjs";import{empty as t}from"../utils/index.mjs";export function watchFiles(n,r,e=t){let m=i(n,{ignored:(i,o)=>{if(o)return!o.isDirectory()&&r?.test(i)},persistent:!0,ignoreInitial:!0});m.on("add",e).on("change",e).on("unlink",e),o(function(){m.unwatch(n),m.close()})}
|