@makoojs/cli 0.5.1 → 0.6.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/dist/DevTerminal-BtHO2wRA.js +2396 -0
- package/dist/DevTerminal-DNh8U_O4.cjs +30 -0
- package/dist/bin.js +29 -580
- package/dist/bridge/protocol.d.ts +64 -0
- package/dist/bridge/runtime.cjs +1 -0
- package/dist/bridge/runtime.d.ts +38 -0
- package/dist/bridge/runtime.js +168 -0
- package/dist/bridge/server.d.ts +15 -0
- package/dist/bridge/store.d.ts +17 -0
- package/dist/commands/version.d.ts +1 -0
- package/dist/config/resolve.d.ts +1 -5
- package/dist/config/types.d.ts +40 -9
- package/dist/errors.d.ts +766 -0
- package/dist/index.cjs +2 -149
- package/dist/index.d.ts +1 -1
- package/dist/index.js +216 -2934
- package/dist/monkey/clipboard.d.ts +2 -0
- package/dist/monkey/download.d.ts +2 -0
- package/dist/monkey/index.d.ts +1 -0
- package/dist/monkey/info.d.ts +3 -0
- package/dist/monkey/menu.d.ts +3 -0
- package/dist/monkey/notification.d.ts +2 -0
- package/dist/monkey/request.d.ts +8 -0
- package/dist/monkey/resource.d.ts +3 -0
- package/dist/monkey/storage.d.ts +10 -0
- package/dist/monkey/style.d.ts +3 -0
- package/dist/monkey/tab.d.ts +5 -0
- package/dist/protocol-D8uLFi4g.cjs +1 -0
- package/dist/protocol-ZRHs80xs.js +4 -0
- package/dist/{cli/commands/dev → tui}/DevTerminal.d.ts +12 -6
- package/dist/{cli/injections → tui}/renderInjections.d.ts +1 -1
- package/dist/version-DiRsgSMp.js +19 -0
- package/dist/version-ENbM57wf.cjs +1 -0
- package/dist/vite/makoo.d.ts +3 -0
- package/dist/vite/makooDev.d.ts +28 -6
- package/package.json +5 -6
- package/dist/cli/version.d.ts +0 -1
- package/dist/config/defaults.d.ts +0 -5
- package/dist/config/errors.d.ts +0 -3
- package/dist/config/validation.d.ts +0 -11
- package/dist/session/DevSession.d.ts +0 -14
- package/dist/session/types.d.ts +0 -47
- /package/dist/{cli → commands}/bin.d.ts +0 -0
- /package/dist/{cli/commands → commands}/build.d.ts +0 -0
- /package/dist/{cli/commands/dev → commands}/dev.d.ts +0 -0
- /package/dist/{cli/commands → commands}/preview.d.ts +0 -0
- /package/dist/{cli → tui}/terminalColor.d.ts +0 -0
package/dist/monkey/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export { gmResource } from './resource';
|
|
|
9
9
|
export { gmStorage } from './storage';
|
|
10
10
|
export { gmStyle } from './style';
|
|
11
11
|
export { gmTab } from './tab';
|
|
12
|
+
/** Every GM wrapper in one object; `raw` is the promise-based `GM` object. */
|
|
12
13
|
export declare const GMapi: {
|
|
13
14
|
raw: import('vite-plugin-monkey/dist/client').GmType;
|
|
14
15
|
info: import('vite-plugin-monkey/dist/client').GmInfoType;
|
package/dist/monkey/info.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { monkeyWindow, unsafeWindow } from 'vite-plugin-monkey/dist/client';
|
|
2
|
+
/** The promise-based `GM` object. */
|
|
2
3
|
export declare const gm: import('vite-plugin-monkey/dist/client').GmType;
|
|
4
|
+
/** `GM_info`: details about the script and the script manager. */
|
|
3
5
|
export declare const gmInfo: import('vite-plugin-monkey/dist/client').GmInfoType;
|
|
6
|
+
/** `GM_log`. */
|
|
4
7
|
export declare const gmLog: import('vite-plugin-monkey/dist/client').GmLogType;
|
|
5
8
|
export { monkeyWindow, unsafeWindow };
|
package/dist/monkey/menu.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
/** Commands in the script manager's menu. */
|
|
1
2
|
export declare const gmMenu: {
|
|
3
|
+
/** `GM_registerMenuCommand`. */
|
|
2
4
|
register: import('vite-plugin-monkey/dist/client').GmRegisterMenuCommandType;
|
|
5
|
+
/** `GM_unregisterMenuCommand`. */
|
|
3
6
|
unregister: import('vite-plugin-monkey/dist/client').GmUnregisterMenuCommandType;
|
|
4
7
|
};
|
package/dist/monkey/request.d.ts
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { GmResponseType, GmXmlhttpRequestOption } from 'vite-plugin-monkey/dist/client';
|
|
2
|
+
/** `GM_xmlhttpRequest` options without `url` and `method`, which the shortcut sets. */
|
|
2
3
|
export type GmRequestOptions<R extends GmResponseType = 'text', C = unknown> = Omit<GmXmlhttpRequestOption<R, C>, 'url' | 'method'>;
|
|
4
|
+
/**
|
|
5
|
+
* Cross-origin requests through the script manager. Responses arrive through callbacks such as
|
|
6
|
+
* `onload`; allow the target domains with `monkey.userscript.connect`.
|
|
7
|
+
*/
|
|
3
8
|
export declare const gmRequest: {
|
|
9
|
+
/** `GM_xmlhttpRequest`. */
|
|
4
10
|
send: import('vite-plugin-monkey/dist/client').GmXmlhttpRequestType;
|
|
11
|
+
/** Sends a `GET` request; returns a handle whose `abort()` cancels it. */
|
|
5
12
|
get<R extends GmResponseType = "text", C = unknown>(url: string, options?: GmRequestOptions<R, C>): import('vite-plugin-monkey/dist/client').GmAbortHandle<void>;
|
|
13
|
+
/** Sends a `POST` request; returns a handle whose `abort()` cancels it. */
|
|
6
14
|
post<R extends GmResponseType = "text", C = unknown>(url: string, options?: GmRequestOptions<R, C>): import('vite-plugin-monkey/dist/client').GmAbortHandle<void>;
|
|
7
15
|
};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
/** Resources declared with `@resource`. */
|
|
1
2
|
export declare const gmResource: {
|
|
3
|
+
/** `GM_getResourceText`. */
|
|
2
4
|
text: import('vite-plugin-monkey/dist/client').GmGetResourceTextType;
|
|
5
|
+
/** `GM_getResourceURL`. */
|
|
3
6
|
url: import('vite-plugin-monkey/dist/client').GmGetResourceURLType;
|
|
4
7
|
};
|
package/dist/monkey/storage.d.ts
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
|
+
/** Persistent values stored by the script manager. */
|
|
1
2
|
export declare const gmStorage: {
|
|
3
|
+
/** `GM_getValue`. */
|
|
2
4
|
get: import('vite-plugin-monkey/dist/client').GmGetValueType;
|
|
5
|
+
/** `GM_getValues`. */
|
|
3
6
|
getMany: import('vite-plugin-monkey/dist/client').GmGetValuesType;
|
|
7
|
+
/** `GM_setValue`. */
|
|
4
8
|
set: import('vite-plugin-monkey/dist/client').GmSetValueType;
|
|
9
|
+
/** `GM_setValues`. */
|
|
5
10
|
setMany: import('vite-plugin-monkey/dist/client').GmSetValuesType;
|
|
11
|
+
/** `GM_deleteValue`. */
|
|
6
12
|
remove: import('vite-plugin-monkey/dist/client').GmDeleteValueType;
|
|
13
|
+
/** `GM_deleteValues`. */
|
|
7
14
|
removeMany: import('vite-plugin-monkey/dist/client').GmDeleteValuesType;
|
|
15
|
+
/** `GM_listValues`. */
|
|
8
16
|
keys: import('vite-plugin-monkey/dist/client').GmListValuesType;
|
|
17
|
+
/** `GM_addValueChangeListener`. */
|
|
9
18
|
watch: import('vite-plugin-monkey/dist/client').GmAddValueChangeListenerType;
|
|
19
|
+
/** `GM_removeValueChangeListener`. */
|
|
10
20
|
unwatch: import('vite-plugin-monkey/dist/client').GmRemoveValueChangeListenerType;
|
|
11
21
|
};
|
package/dist/monkey/style.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
/** Styles and elements added through the script manager. */
|
|
1
2
|
export declare const gmStyle: {
|
|
3
|
+
/** `GM_addStyle`. */
|
|
2
4
|
add: import('vite-plugin-monkey/dist/client').GmAddStyleType;
|
|
5
|
+
/** `GM_addElement`. */
|
|
3
6
|
element: import('vite-plugin-monkey/dist/client').GmAddElementType;
|
|
4
7
|
};
|
package/dist/monkey/tab.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
/** Browser tabs and per-tab data. */
|
|
1
2
|
export declare const gmTab: {
|
|
3
|
+
/** `GM_openInTab`. */
|
|
2
4
|
open: import('vite-plugin-monkey/dist/client').GmOpenInTabType;
|
|
5
|
+
/** `GM_getTab`. */
|
|
3
6
|
get: import('vite-plugin-monkey/dist/client').GmGetTabType;
|
|
7
|
+
/** `GM_getTabs`. */
|
|
4
8
|
getAll: import('vite-plugin-monkey/dist/client').GmGetTabsType;
|
|
9
|
+
/** `GM_saveTab`. */
|
|
5
10
|
save: import('vite-plugin-monkey/dist/client').GmSaveTab;
|
|
6
11
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return`makoo:submit-page`}});
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { Logger, ViteDevServer } from 'vite';
|
|
2
|
-
import {
|
|
2
|
+
import { RuntimeSnapshot } from '../bridge/store';
|
|
3
3
|
type DevView = 'home' | 'injections' | 'help' | 'logs';
|
|
4
|
+
/** The slice of a runtime store the terminal reads. */
|
|
5
|
+
export type RuntimeSource = {
|
|
6
|
+
getRuntimeSnapshots(): RuntimeSnapshot[];
|
|
7
|
+
subscribe(onChange: () => void): () => void;
|
|
8
|
+
};
|
|
4
9
|
export declare class DevTerminal {
|
|
5
10
|
private readonly server;
|
|
6
|
-
private readonly
|
|
11
|
+
private readonly store;
|
|
7
12
|
readonly interactive: boolean;
|
|
8
|
-
private session;
|
|
9
13
|
private unsubscribe;
|
|
10
14
|
private currentView;
|
|
11
15
|
private previousView;
|
|
@@ -26,9 +30,11 @@ export declare class DevTerminal {
|
|
|
26
30
|
private readonly originalWarnOnce;
|
|
27
31
|
private readonly originalError;
|
|
28
32
|
private readonly originalClearScreen;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
private cliVersion;
|
|
34
|
+
private readonly cliVersionReady;
|
|
35
|
+
constructor(server: ViteDevServer, store: RuntimeSource);
|
|
36
|
+
showHome(): Promise<void>;
|
|
37
|
+
activate(): void;
|
|
32
38
|
refresh: () => void;
|
|
33
39
|
show(view: DevView): void;
|
|
34
40
|
private renderBanner;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { RuntimeSnapshot } from '
|
|
1
|
+
import { RuntimeSnapshot } from '../bridge/store';
|
|
2
2
|
export declare function renderInjectionsTable(snapshots: RuntimeSnapshot[]): string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { dirname as e, join as t } from "node:path";
|
|
2
|
+
import { readFile as n } from "node:fs/promises";
|
|
3
|
+
//#region packages/cli/src/commands/version.ts
|
|
4
|
+
async function r() {
|
|
5
|
+
let r = import.meta.dirname ?? (typeof __dirname < "u" ? __dirname : process.cwd());
|
|
6
|
+
for (;;) {
|
|
7
|
+
let i = t(r, "package.json");
|
|
8
|
+
try {
|
|
9
|
+
let e = await n(i, "utf-8"), t = JSON.parse(e);
|
|
10
|
+
if (t.name === "@makoojs/cli" && t.version) return t.version;
|
|
11
|
+
} catch {}
|
|
12
|
+
let a = e(r);
|
|
13
|
+
if (a === r) break;
|
|
14
|
+
r = a;
|
|
15
|
+
}
|
|
16
|
+
return "0.0.0";
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { r as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));let c=require("node:path"),l=require("node:fs/promises");async function u(){let e={}.dirname??(typeof __dirname<`u`?__dirname:process.cwd());for(;;){let t=(0,c.join)(e,`package.json`);try{let e=await(0,l.readFile)(t,`utf-8`),n=JSON.parse(e);if(n.name===`@makoojs/cli`&&n.version)return n.version}catch{}let n=(0,c.dirname)(e);if(n===e)break;e=n}return`0.0.0`}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return u}});
|
package/dist/vite/makoo.d.ts
CHANGED
package/dist/vite/makooDev.d.ts
CHANGED
|
@@ -1,7 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { Plugin, ViteDevServer } from 'vite';
|
|
2
|
+
import { BridgeAddress, DevBridge } from '../bridge/server';
|
|
3
|
+
import { RuntimeStore } from '../bridge/store';
|
|
4
|
+
import { DevTerminal, RuntimeSource } from '../tui/DevTerminal';
|
|
5
|
+
export type MakooDevOptions = {
|
|
6
|
+
/** Bridge listen port, fixed (no scanning). Default 9999. */
|
|
7
|
+
port?: number;
|
|
8
|
+
/** Bridge listen host: an IPv4/IPv6 literal or 'localhost'. Default '127.0.0.1'. */
|
|
9
|
+
host?: string;
|
|
6
10
|
};
|
|
7
|
-
export
|
|
11
|
+
export type MakooDevDeps = {
|
|
12
|
+
address: BridgeAddress;
|
|
13
|
+
/**
|
|
14
|
+
* Absolute path to the page-side instrument module imported by the virtual
|
|
15
|
+
* module; undefined = instrumentation unavailable, the module stays a pure
|
|
16
|
+
* re-export of core.
|
|
17
|
+
*/
|
|
18
|
+
runtimeFile: string | undefined;
|
|
19
|
+
startBridge: (store: RuntimeStore, address: BridgeAddress) => Promise<DevBridge>;
|
|
20
|
+
createTerminal: (server: ViteDevServer, store: RuntimeSource) => Promise<DevTerminal>;
|
|
21
|
+
/** Resolves 'devframe/client' to an absolute path; throws when unresolvable. */
|
|
22
|
+
resolveDevframeClient: () => string;
|
|
23
|
+
};
|
|
24
|
+
export declare function createMakooDev(deps: MakooDevDeps): Plugin;
|
|
25
|
+
/**
|
|
26
|
+
* Reports the Core Instances on the page, and the status and errors of each injection, to the
|
|
27
|
+
* `makoo dev` terminal. Only active in the dev server; it never controls injections.
|
|
28
|
+
*/
|
|
29
|
+
export declare function makooDev(options?: MakooDevOptions): Plugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@makoojs/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "CLI and Vite integration for the Makoo userscript development framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,17 +39,16 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"cac": "^7.0.0",
|
|
42
|
-
"
|
|
42
|
+
"devframe": "~1.2.6",
|
|
43
43
|
"log-update": "^7.2.0",
|
|
44
|
-
"vite-plugin-monkey": "^8.1.0"
|
|
45
|
-
"zod": "^4.4.3"
|
|
44
|
+
"vite-plugin-monkey": "^8.1.0"
|
|
46
45
|
},
|
|
47
46
|
"devDependencies": {
|
|
48
|
-
"@makoojs/core": "0.
|
|
47
|
+
"@makoojs/core": "0.6.0",
|
|
49
48
|
"vite": "^8.2.2"
|
|
50
49
|
},
|
|
51
50
|
"peerDependencies": {
|
|
52
|
-
"@makoojs/core": "
|
|
51
|
+
"@makoojs/core": "^0.6.0",
|
|
53
52
|
"vite": "^8.2.2"
|
|
54
53
|
}
|
|
55
54
|
}
|
package/dist/cli/version.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function loadCliVersion(cliVersionCache: string | null): Promise<string>;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { MonkeyBuildConfig, MonkeyConfig, ResolvedMonkeyServerConfig } from './types';
|
|
2
|
-
export declare const DEFAULT_MONKEY_SERVER_CONFIG: ResolvedMonkeyServerConfig;
|
|
3
|
-
export declare const DEFAULT_MONKEY_BUILD_CONFIG: Pick<Required<MonkeyBuildConfig>, 'metaFileName' | 'autoGrant'>;
|
|
4
|
-
export declare const DEFAULT_MONKEY_CONFIG: Required<Pick<MonkeyConfig, 'align' | 'styleImport'>>;
|
|
5
|
-
export declare const DEFAULT_FILE_NAME_SUFFIX = ".user.js";
|
package/dist/config/errors.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const CliConfigSchema: z.ZodObject<{
|
|
3
|
-
entry: z.ZodString;
|
|
4
|
-
app: z.ZodObject<{
|
|
5
|
-
name: z.ZodString;
|
|
6
|
-
version: z.ZodString;
|
|
7
|
-
description: z.ZodOptional<z.ZodString>;
|
|
8
|
-
}, z.core.$strict>;
|
|
9
|
-
monkey: z.ZodObject<{}, z.core.$loose>;
|
|
10
|
-
}, z.core.$strict>;
|
|
11
|
-
export declare function validateCliConfig(data: unknown): asserts data is z.infer<typeof CliConfigSchema>;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { NormalizedHotChannelClient } from 'vite';
|
|
2
|
-
import { RuntimeInjection, RuntimeNotice, RuntimeOpen, RuntimeSnapshot } from './types';
|
|
3
|
-
export declare class DevSession {
|
|
4
|
-
private readonly clients;
|
|
5
|
-
private nextClientId;
|
|
6
|
-
private onChange;
|
|
7
|
-
subscribe(onChange: () => void): () => void;
|
|
8
|
-
open(client: NormalizedHotChannelClient, payload: RuntimeOpen): void;
|
|
9
|
-
updateInjection(client: NormalizedHotChannelClient, payload: RuntimeInjection): void;
|
|
10
|
-
applyNotice(client: NormalizedHotChannelClient, payload: RuntimeNotice): void;
|
|
11
|
-
disconnect(client: NormalizedHotChannelClient): void;
|
|
12
|
-
isEmpty(): boolean;
|
|
13
|
-
getRuntimeSnapshots(): RuntimeSnapshot[];
|
|
14
|
-
}
|
package/dist/session/types.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { ComponentStatus, ListenerStatus, ObservationNotice } from '../../../../../core';
|
|
2
|
-
export type RuntimeOpen = {
|
|
3
|
-
runtimeId: number;
|
|
4
|
-
};
|
|
5
|
-
export type SerializedMakooError = {
|
|
6
|
-
code: string;
|
|
7
|
-
message: string;
|
|
8
|
-
cause?: string;
|
|
9
|
-
};
|
|
10
|
-
export type AttachedListenerSnapshot = {
|
|
11
|
-
name: string;
|
|
12
|
-
status: ListenerStatus;
|
|
13
|
-
};
|
|
14
|
-
export type InjectionSnapshot = {
|
|
15
|
-
name: string;
|
|
16
|
-
kind: 'component';
|
|
17
|
-
status: ComponentStatus;
|
|
18
|
-
lastError?: SerializedMakooError;
|
|
19
|
-
attachedListeners: AttachedListenerSnapshot[];
|
|
20
|
-
} | {
|
|
21
|
-
name: string;
|
|
22
|
-
kind: 'standalone-listener';
|
|
23
|
-
status: ListenerStatus;
|
|
24
|
-
lastError?: SerializedMakooError;
|
|
25
|
-
};
|
|
26
|
-
export type SerializedDiagnostic = {
|
|
27
|
-
type: 'diagnostic';
|
|
28
|
-
name?: string;
|
|
29
|
-
error: SerializedMakooError;
|
|
30
|
-
};
|
|
31
|
-
export type SerializedObservationNotice = Exclude<ObservationNotice, {
|
|
32
|
-
type: 'diagnostic';
|
|
33
|
-
}> | SerializedDiagnostic;
|
|
34
|
-
export type RuntimeInjection = {
|
|
35
|
-
runtimeId: number;
|
|
36
|
-
injection: InjectionSnapshot;
|
|
37
|
-
};
|
|
38
|
-
export type RuntimeNotice = {
|
|
39
|
-
runtimeId: number;
|
|
40
|
-
notice: SerializedObservationNotice;
|
|
41
|
-
};
|
|
42
|
-
export type RuntimeSnapshot = {
|
|
43
|
-
clientId: number;
|
|
44
|
-
runtimeId: number;
|
|
45
|
-
injections: InjectionSnapshot[];
|
|
46
|
-
diagnostics: SerializedDiagnostic[];
|
|
47
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|