@makoojs/cli 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.CN.md +93 -351
- package/README.md +93 -351
- package/dist/bin.js +516 -1152
- package/dist/cli/commands/build.d.ts +2 -0
- package/dist/cli/commands/dev/DevTerminal.d.ts +51 -0
- package/dist/cli/commands/dev/dev.d.ts +2 -0
- package/dist/cli/commands/preview.d.ts +2 -0
- package/dist/cli/tasks/renderTasks.d.ts +2 -0
- package/dist/{shared → cli}/terminalColor.d.ts +2 -0
- package/dist/cli/version.d.ts +1 -0
- package/dist/config/defaults.d.ts +3 -24
- package/dist/config/errors.d.ts +14 -0
- package/dist/config/resolve.d.ts +6 -18
- package/dist/config/types.d.ts +8 -106
- package/dist/config/validation.d.ts +4 -7
- package/dist/index.cjs +121 -38
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1036 -3243
- package/dist/session/DevSession.d.ts +13 -0
- package/dist/session/types.d.ts +22 -0
- package/dist/vite/makoo.d.ts +3 -0
- package/dist/vite/makooDev.d.ts +7 -0
- package/package.json +8 -13
- package/dist/command/_util.d.ts +0 -8
- package/dist/command/add.d.ts +0 -1
- package/dist/command/build.d.ts +0 -1
- package/dist/command/dev.d.ts +0 -1
- package/dist/command/inspect.d.ts +0 -35
- package/dist/config/config.d.ts +0 -3
- package/dist/error/MakooCliError.d.ts +0 -58
- package/dist/generator/generator.d.ts +0 -3
- package/dist/generator/render/import/importAdapter.d.ts +0 -3
- package/dist/generator/render/import/importComp.d.ts +0 -3
- package/dist/generator/render/import/importMakooRuntime.d.ts +0 -1
- package/dist/generator/render/import/importManifest.d.ts +0 -3
- package/dist/generator/render/import/importRuntimeSetup.d.ts +0 -1
- package/dist/generator/render/init/initMakooRuntime.d.ts +0 -4
- package/dist/generator/render/init/registerComp.d.ts +0 -3
- package/dist/generator/render/init/registerListener.d.ts +0 -4
- package/dist/generator/render/run/renderMakooStart.d.ts +0 -1
- package/dist/generator/render/util/match.d.ts +0 -1
- package/dist/generator/render/util/value.d.ts +0 -1
- package/dist/generator/types.d.ts +0 -27
- package/dist/manifest/index.cjs +0 -1
- package/dist/manifest/index.d.ts +0 -2
- package/dist/manifest/index.js +0 -7
- package/dist/scanner/collectDependenics.d.ts +0 -2
- package/dist/scanner/load/loadManifes.d.ts +0 -3
- package/dist/scanner/load/loadMeta.d.ts +0 -2
- package/dist/scanner/manifestBinding.d.ts +0 -14
- package/dist/scanner/scanner.d.ts +0 -3
- package/dist/scanner/types.d.ts +0 -50
- package/dist/scanner/util.d.ts +0 -2
- package/dist/scanner/validation.d.ts +0 -190
- package/dist/vitePlugin/hmrController.d.ts +0 -6
- package/dist/vitePlugin/makoo.d.ts +0 -3
- package/dist/vitePlugin/makooMonkey.d.ts +0 -3
- package/dist/vitePlugin/types.d.ts +0 -18
- package/dist/vitePlugin/virtualModule.d.ts +0 -2
- package/dist/vitePlugin/watchList.d.ts +0 -5
- /package/dist/{command → cli}/bin.d.ts +0 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Logger, ViteDevServer } from 'vite';
|
|
2
|
+
import { DevSession } from '../../../session/DevSession';
|
|
3
|
+
type DevView = 'home' | 'tasks' | 'help' | 'logs';
|
|
4
|
+
export declare class DevTerminal {
|
|
5
|
+
private readonly server;
|
|
6
|
+
private readonly cliVersion;
|
|
7
|
+
readonly interactive: boolean;
|
|
8
|
+
private session;
|
|
9
|
+
private unsubscribe;
|
|
10
|
+
private currentView;
|
|
11
|
+
private previousView;
|
|
12
|
+
private selectedRuntime;
|
|
13
|
+
private runtimeCount;
|
|
14
|
+
private ready;
|
|
15
|
+
private restarting;
|
|
16
|
+
private actionRunning;
|
|
17
|
+
private closed;
|
|
18
|
+
private stopInput;
|
|
19
|
+
private bufferedLogs;
|
|
20
|
+
private omittedLogs;
|
|
21
|
+
private unreadErrors;
|
|
22
|
+
private readonly screenOutput;
|
|
23
|
+
readonly logger: Logger;
|
|
24
|
+
private readonly originalInfo;
|
|
25
|
+
private readonly originalWarn;
|
|
26
|
+
private readonly originalWarnOnce;
|
|
27
|
+
private readonly originalError;
|
|
28
|
+
private readonly originalClearScreen;
|
|
29
|
+
constructor(server: ViteDevServer, cliVersion: string);
|
|
30
|
+
start(): Promise<void>;
|
|
31
|
+
attachSession: (session: DevSession) => void;
|
|
32
|
+
refresh: () => void;
|
|
33
|
+
show(view: DevView): void;
|
|
34
|
+
private renderBanner;
|
|
35
|
+
private renderRuntimeStatus;
|
|
36
|
+
private renderHome;
|
|
37
|
+
private renderTasks;
|
|
38
|
+
private renderHelp;
|
|
39
|
+
private draw;
|
|
40
|
+
private hasInstallationPage;
|
|
41
|
+
private bindShortcuts;
|
|
42
|
+
private onKey;
|
|
43
|
+
private openInstallationPage;
|
|
44
|
+
private restart;
|
|
45
|
+
private shutdown;
|
|
46
|
+
close: () => void;
|
|
47
|
+
private writeLog;
|
|
48
|
+
private printLog;
|
|
49
|
+
private flushLogs;
|
|
50
|
+
}
|
|
51
|
+
export {};
|
|
@@ -4,6 +4,8 @@ export declare const ansi: {
|
|
|
4
4
|
readonly cyan: "\u001B[36m";
|
|
5
5
|
readonly deepPink: "\u001B[38;5;162m";
|
|
6
6
|
readonly green: "\u001B[32m";
|
|
7
|
+
readonly red: "\u001B[31m";
|
|
8
|
+
readonly yellow: "\u001B[33m";
|
|
7
9
|
readonly dim: "\u001B[2m";
|
|
8
10
|
};
|
|
9
11
|
export declare const colorize: (value: string, ...codes: string[]) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function loadCliVersion(cliVersionCache: string | null): Promise<string>;
|
|
@@ -1,26 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const ESM_IMPORT_RE: RegExp;
|
|
4
|
-
export declare const CJS_IMPORT_RE: RegExp;
|
|
5
|
-
export declare const VIRTUAL_MODULE_ID = "virtual:makoo/entry";
|
|
6
|
-
export declare const RESOLVED_ID = "\0virtual:makoo/entry";
|
|
7
|
-
export declare const FAKE_ENTRY = "makoo-entry.ts";
|
|
8
|
-
export declare const FAKE_RESOLVED_ID = "\0makoo-entry.ts";
|
|
9
|
-
export declare const REACT_EXTENSIONS: Set<string>;
|
|
10
|
-
export declare const VUE_EXTENSIONS: Set<string>;
|
|
11
|
-
export declare const DEFAULT_SOURCE_DIR = "injections";
|
|
12
|
-
export declare const DEFAULT_MANIFEST_FILE_NAME = "manifest";
|
|
13
|
-
export declare const DEFAULT_SOURCE_CONFIG: {
|
|
14
|
-
dir: string;
|
|
15
|
-
include: string[];
|
|
16
|
-
exclude: string[];
|
|
17
|
-
manifest: string;
|
|
18
|
-
};
|
|
19
|
-
export declare const DEFAULT_RUNTIME_CONFIG: ResolvedRuntimeConfig;
|
|
20
|
-
export declare const DEFAULT_INJECTION_DEFAULTS: Required<InjectionDefaults>;
|
|
21
|
-
export declare const DEFAULT_MONKEY_SERVER_CONFIG: Required<MonkeyServerConfig>;
|
|
1
|
+
import { MonkeyBuildConfig, MonkeyConfig, ResolvedMonkeyServerConfig } from './types';
|
|
2
|
+
export declare const DEFAULT_MONKEY_SERVER_CONFIG: ResolvedMonkeyServerConfig;
|
|
22
3
|
export declare const DEFAULT_MONKEY_BUILD_CONFIG: Pick<Required<MonkeyBuildConfig>, 'metaFileName' | 'autoGrant'>;
|
|
23
|
-
export declare const DEFAULT_MONKEY_CONFIG: Pick<MonkeyConfig, 'align' | 'styleImport'
|
|
24
|
-
clientAlias: string;
|
|
25
|
-
};
|
|
4
|
+
export declare const DEFAULT_MONKEY_CONFIG: Required<Pick<MonkeyConfig, 'align' | 'styleImport'>>;
|
|
26
5
|
export declare const DEFAULT_FILE_NAME_SUFFIX = ".user.js";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MakooError, MakooIssue } from '../../../../../core';
|
|
2
|
+
export declare const ErrorCode: {
|
|
3
|
+
readonly CLI_CONFIG_INVALID: "MAKOO_CLI_CONFIG_INVALID";
|
|
4
|
+
};
|
|
5
|
+
export type ErrorCodeValue = (typeof ErrorCode)[keyof typeof ErrorCode];
|
|
6
|
+
export interface ValidationIssue {
|
|
7
|
+
code: string;
|
|
8
|
+
path: PropertyKey[];
|
|
9
|
+
message: string;
|
|
10
|
+
}
|
|
11
|
+
export declare class ConfigValidationError extends MakooError {
|
|
12
|
+
constructor(issues: MakooIssue[], code?: string, cause?: Error);
|
|
13
|
+
}
|
|
14
|
+
export declare function toMakooIssue(issue: ValidationIssue): MakooIssue;
|
package/dist/config/resolve.d.ts
CHANGED
|
@@ -1,20 +1,8 @@
|
|
|
1
1
|
import { MonkeyOption } from 'vite-plugin-monkey';
|
|
2
|
-
import { AppConfig, CliConfig,
|
|
3
|
-
export declare const normalizeInjectionManifest: (injections: InjectionManifest | undefined) => ResolvedInjectionManifest;
|
|
4
|
-
export declare const normalizeListenerManifest: (manifest: InjectionManifest | undefined) => ResolvedListenerManifest;
|
|
2
|
+
import { AppConfig, CliConfig, MonkeyConfig, ResolvedMakooConfig, ResolvedMonkeyBuildConfig, ResolvedMonkeyConfig, ResolvedMonkeyServerConfig } from './types';
|
|
5
3
|
export declare const resolveAppConfig: (config: AppConfig) => AppConfig;
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const resolveMonkeyConfig: (app: AppConfig, config: MonkeyConfig | undefined) => ResolvedMonkeyConfig;
|
|
12
|
-
export declare const resolveInjection: (config: InjectionModuleConfig, options: ResolveInjectionOptions) => ResolvedInjectionModule;
|
|
13
|
-
export declare const resolveInjections: (injections: InjectionManifest | undefined, options: ResolveConfigOptions & {
|
|
14
|
-
source: ResolvedSourceConfig;
|
|
15
|
-
injectionDefaults: ResolvedInjectionDefaults;
|
|
16
|
-
}) => ResolvedInjectionModule[];
|
|
17
|
-
export declare const resolveListener: (config: InjectionListenerConfig, options: ResolveListenerOptions) => ResolvedListener;
|
|
18
|
-
export declare const resolveListeners: (manifest: InjectionManifest | undefined, options: ResolveConfigOptions) => ResolvedListener[];
|
|
19
|
-
export declare const resolveConfig: (config: CliConfig, root?: string) => ResolvedConfig;
|
|
20
|
-
export declare function resolveMonkeyPluginOptions(config: ResolvedConfig, override?: Partial<MonkeyOption>): MonkeyOption;
|
|
4
|
+
export declare const resolveMonkeyServerConfig: (config: MonkeyConfig) => ResolvedMonkeyServerConfig;
|
|
5
|
+
export declare const resolveMonkeyBuildConfig: (app: AppConfig, config: MonkeyConfig) => ResolvedMonkeyBuildConfig;
|
|
6
|
+
export declare const resolveMonkeyConfig: (app: AppConfig, config: MonkeyConfig) => ResolvedMonkeyConfig;
|
|
7
|
+
export declare const resolveConfig: (config: CliConfig, root?: string) => ResolvedMakooConfig;
|
|
8
|
+
export declare const resolveMonkeyPluginOptions: (config: ResolvedMakooConfig) => MonkeyOption;
|
package/dist/config/types.d.ts
CHANGED
|
@@ -1,28 +1,6 @@
|
|
|
1
|
-
import { ActivitySignalSource, LifecycleHookMap, InjectionConfig as RuntimeInjectionConfig } from '../../../../../core';
|
|
2
1
|
import { ExternalGlobals, ExternalResource, MonkeyOption, MonkeyUserScript } from 'vite-plugin-monkey';
|
|
3
|
-
export type StrictShape<Shape, Value extends Shape> = Value & Record<Exclude<keyof Value, keyof Shape>, never>;
|
|
4
2
|
export type Thenable<T> = T | Promise<T>;
|
|
5
3
|
export type MonkeyMode = 'serve' | 'build' | 'meta';
|
|
6
|
-
export type ResolveConfigOptions = {
|
|
7
|
-
root?: string;
|
|
8
|
-
};
|
|
9
|
-
export type ResolveInjectionOptions = {
|
|
10
|
-
root?: string;
|
|
11
|
-
source?: ResolvedSourceConfig;
|
|
12
|
-
injectionDefaults?: ResolvedInjectionDefaults;
|
|
13
|
-
moduleId?: string;
|
|
14
|
-
moduleDir?: string;
|
|
15
|
-
componentPath?: string;
|
|
16
|
-
moduleManifestFile?: string;
|
|
17
|
-
fallbackName?: string;
|
|
18
|
-
index?: number;
|
|
19
|
-
};
|
|
20
|
-
export type ResolveListenerOptions = {
|
|
21
|
-
root?: string;
|
|
22
|
-
listenerId?: string;
|
|
23
|
-
fallbackName?: string;
|
|
24
|
-
index?: number;
|
|
25
|
-
};
|
|
26
4
|
export type MonkeyGenerateContext = {
|
|
27
5
|
userscript: string;
|
|
28
6
|
mode: MonkeyMode;
|
|
@@ -41,7 +19,7 @@ export type MonkeyBuildConfig = {
|
|
|
41
19
|
cssSideEffects?: string | ((css: string) => void);
|
|
42
20
|
};
|
|
43
21
|
export type MonkeyConfig = {
|
|
44
|
-
userscript?: MonkeyUserScript
|
|
22
|
+
userscript?: Omit<MonkeyUserScript, 'name' | 'version' | 'description'>;
|
|
45
23
|
align?: number | false;
|
|
46
24
|
generate?: (options: MonkeyGenerateContext) => Thenable<string>;
|
|
47
25
|
styleImport?: boolean;
|
|
@@ -53,82 +31,6 @@ export type AppConfig = {
|
|
|
53
31
|
version: string;
|
|
54
32
|
description?: string;
|
|
55
33
|
};
|
|
56
|
-
export type SourceConfig = {
|
|
57
|
-
include?: string[];
|
|
58
|
-
exclude?: string[];
|
|
59
|
-
};
|
|
60
|
-
export type RuntimeConfig = {
|
|
61
|
-
setup?: string | string[];
|
|
62
|
-
};
|
|
63
|
-
export type ResolvedRuntimeConfig = {
|
|
64
|
-
setup: string[];
|
|
65
|
-
};
|
|
66
|
-
export type ResolvedSourceConfig = {
|
|
67
|
-
dir: string;
|
|
68
|
-
include: string[];
|
|
69
|
-
exclude: string[];
|
|
70
|
-
manifest: string;
|
|
71
|
-
};
|
|
72
|
-
export type InjectionDefaults = Partial<Pick<RuntimeInjectionConfig, 'alive' | 'scope' | 'timeout' | 'hooks'>>;
|
|
73
|
-
export type ResolvedInjectionDefaults = Pick<RuntimeInjectionConfig, 'alive' | 'scope' | 'timeout'> & {
|
|
74
|
-
hooks?: LifecycleHookMap;
|
|
75
|
-
};
|
|
76
|
-
export type InjectionFramework = 'auto' | 'Vue' | 'React';
|
|
77
|
-
export type ResolvedInjectionFramework = Exclude<InjectionFramework, 'auto'>;
|
|
78
|
-
export type InjectionMatchObject = {
|
|
79
|
-
include?: string[];
|
|
80
|
-
exclude?: string[];
|
|
81
|
-
};
|
|
82
|
-
export type InjectionMatchConfig = string[] | InjectionMatchObject;
|
|
83
|
-
export type InjectionModuleListenerConfig = {
|
|
84
|
-
listenAt: string;
|
|
85
|
-
type: string;
|
|
86
|
-
callback: EventListener;
|
|
87
|
-
capture?: boolean;
|
|
88
|
-
activitySignal?: () => ActivitySignalSource<boolean>;
|
|
89
|
-
};
|
|
90
|
-
export type InjectionListenerConfig = InjectionModuleListenerConfig & {
|
|
91
|
-
name?: string;
|
|
92
|
-
enabled?: boolean;
|
|
93
|
-
match?: InjectionMatchConfig;
|
|
94
|
-
};
|
|
95
|
-
export type InjectionModuleOptions = Partial<Pick<RuntimeInjectionConfig, 'alive' | 'scope' | 'timeout' | 'hooks'>> & {
|
|
96
|
-
on?: InjectionModuleListenerConfig;
|
|
97
|
-
};
|
|
98
|
-
export type InjectionModuleConfig = InjectionModuleOptions & {
|
|
99
|
-
name?: string;
|
|
100
|
-
injectAt: string;
|
|
101
|
-
component: string;
|
|
102
|
-
framework?: InjectionFramework;
|
|
103
|
-
enabled?: boolean;
|
|
104
|
-
match?: InjectionMatchConfig;
|
|
105
|
-
};
|
|
106
|
-
export type InjectionManifestRecord = Record<string, Omit<InjectionModuleConfig, 'name'>>;
|
|
107
|
-
export type InjectionListenerRecord = Record<string, Omit<InjectionListenerConfig, 'name'>>;
|
|
108
|
-
export type InjectionManifest = {
|
|
109
|
-
injectionDefaults?: InjectionDefaults;
|
|
110
|
-
injections?: InjectionModuleConfig[] | InjectionManifestRecord;
|
|
111
|
-
listeners?: InjectionListenerConfig[] | InjectionListenerRecord;
|
|
112
|
-
};
|
|
113
|
-
export type ResolvedInjectionManifest = InjectionModuleConfig[];
|
|
114
|
-
export type ResolvedListenerManifest = InjectionListenerConfig[];
|
|
115
|
-
export type ResolvedInjectionModule = Omit<InjectionModuleConfig, 'name' | 'component' | 'framework' | 'enabled' | 'alive' | 'scope' | 'timeout'> & {
|
|
116
|
-
moduleId: string;
|
|
117
|
-
componentPath: string;
|
|
118
|
-
framework: ResolvedInjectionFramework;
|
|
119
|
-
moduleDir: string;
|
|
120
|
-
moduleManifestFile?: string;
|
|
121
|
-
enabled: boolean;
|
|
122
|
-
alive: ResolvedInjectionDefaults['alive'];
|
|
123
|
-
scope: ResolvedInjectionDefaults['scope'];
|
|
124
|
-
timeout: ResolvedInjectionDefaults['timeout'];
|
|
125
|
-
match?: InjectionMatchObject;
|
|
126
|
-
};
|
|
127
|
-
export type ResolvedListener = Omit<InjectionListenerConfig, 'name' | 'enabled' | 'match'> & {
|
|
128
|
-
listenerId: string;
|
|
129
|
-
enabled: boolean;
|
|
130
|
-
match?: InjectionMatchObject;
|
|
131
|
-
};
|
|
132
34
|
export type ResolvedMonkeyServerConfig = {
|
|
133
35
|
open: boolean;
|
|
134
36
|
prefix: string | ((name: string) => string) | false;
|
|
@@ -146,22 +48,22 @@ export type ResolvedMonkeyBuildConfig = {
|
|
|
146
48
|
export type ResolvedMonkeyConfig = Omit<MonkeyConfig, 'userscript' | 'align' | 'styleImport' | 'server' | 'build'> & {
|
|
147
49
|
userscript: MonkeyUserScript;
|
|
148
50
|
align: number | false;
|
|
149
|
-
clientAlias: string;
|
|
150
51
|
styleImport: boolean;
|
|
151
52
|
server: ResolvedMonkeyServerConfig;
|
|
152
53
|
build: ResolvedMonkeyBuildConfig;
|
|
153
54
|
};
|
|
154
55
|
export type CliConfig = {
|
|
56
|
+
entry: string;
|
|
155
57
|
app: AppConfig;
|
|
156
|
-
monkey
|
|
157
|
-
|
|
158
|
-
|
|
58
|
+
monkey: MonkeyConfig;
|
|
59
|
+
};
|
|
60
|
+
export type MakooConfig = CliConfig & {
|
|
61
|
+
root?: string;
|
|
159
62
|
};
|
|
160
|
-
export type
|
|
63
|
+
export type ResolvedMakooConfig = {
|
|
161
64
|
root: string;
|
|
65
|
+
entry: string;
|
|
162
66
|
app: AppConfig;
|
|
163
67
|
monkey: ResolvedMonkeyConfig;
|
|
164
|
-
source: ResolvedSourceConfig;
|
|
165
|
-
runtime: ResolvedRuntimeConfig;
|
|
166
68
|
};
|
|
167
69
|
export type MonkeyUserscriptOption = NonNullable<MonkeyOption['userscript']>;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const CliConfigSchema: z.ZodObject<{
|
|
3
|
+
entry: z.ZodString;
|
|
3
4
|
app: z.ZodObject<{
|
|
4
5
|
name: z.ZodString;
|
|
5
6
|
version: z.ZodString;
|
|
6
7
|
description: z.ZodOptional<z.ZodString>;
|
|
7
|
-
}, z.core.$
|
|
8
|
-
monkey: z.
|
|
9
|
-
|
|
10
|
-
}, z.core.$loose>>;
|
|
11
|
-
source: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
12
|
-
runtime: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
13
|
-
}, z.core.$loose>;
|
|
8
|
+
}, z.core.$strict>;
|
|
9
|
+
monkey: z.ZodObject<{}, z.core.$loose>;
|
|
10
|
+
}, z.core.$strict>;
|
|
14
11
|
export declare function validateCliConfig(data: unknown): asserts data is z.infer<typeof CliConfigSchema>;
|