@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../protocol-D8uLFi4g.cjs");let t=require("@makoojs/core"),n=require("devframe/client");var r=1e3,i=new Set,a=5;function o(){for(let e of[...i])e.close()}function s(e){return(0,n.connectDevframe)({authToken:e.token,connection:{authToken:e.token,connectionMeta:{backend:`websocket`,websocket:`ws://${e.host}:${e.port}/__ws`},metaBaseUrl:`http://${e.host}:${e.port}/`},otpParam:!1,simpleAuth:!1})}function c(t,n={}){let a=n.connect??s,o=n.reconnectDelayMs??r,c,l=!1,u=!1,d=!1,f=!1,p,m,h=e=>{let t=c;c=void 0,u=!1,f=!1,t?.close?.(),e&&y()},g=()=>{if(l||!u||f||!d||!p||c===void 0)return;let t=c,n=p;d=!1,f=!0;let r=()=>{c===t&&(f=!1,g())};try{t.call(e.t,n).then(r,r)}catch{r()}},_=(e,t)=>{if(c===e){if(t===`connected`){u=!0,d=!0,g();return}t===`unauthorized`&&h(!1),(t===`disconnected`||t===`error`)&&h(!0)}},v=async()=>{let e;try{e=await a(t)}catch{y();return}if(l){e.close?.();return}c=e,e.events.on(`connection:status`,t=>_(e,t)),_(e,e.status)},y=()=>{l||m!==void 0||(m=setTimeout(()=>{m=void 0,v()},o))};v();let b={close(){l=!0,m!==void 0&&(clearTimeout(m),m=void 0),h(!1),i.delete(b)},submit(e){p=e,d=!0,g()}};return i.add(b),b}function l(e,t,n=c(t)){let r=1,i=new Map,o=new Map,s=()=>{try{l()}catch(e){console.error(e)}},l=()=>{let e=new Set,t=t=>(e.add(t),t.status),r=[...i].map(([e,n])=>({diagnostics:n.diagnostics,injections:[...n.injections].map(([e,n])=>f(e,n,t)),runtimeId:e}));for(let t of e)o.has(t)||o.set(t,t.subscribe(s));for(let[t,n]of o)e.has(t)||(n(),o.delete(t));n.submit(r)};return function(){let t=e(),n=r++,o={diagnostics:[],injections:new Map};return i.set(n,o),s(),t.observe(e=>{e.type===`injection-removed`?o.injections.get(e.name)===e.injection&&o.injections.delete(e.name):e.type===`instance-disposed`?i.delete(n):(o.diagnostics.push({error:u(e.error),name:e.name,type:`diagnostic`}),o.diagnostics.length>a&&o.diagnostics.shift()),s()}),{...t,apply(e){t.apply(e);for(let{kind:n,name:r}of e)try{o.injections.set(r,n===`listener`?t.listener(r):t.injection(r))}catch{}s()}}}}function u(e){if(e!==void 0)return{...d(e),code:e.code}}function d(e,n=new Set){if(e instanceof Error){if(n.has(e))return{message:`[circular] ${e.message}`,name:e.name};let r=new Set([...n,e]),i={message:e.message,name:e.name};return(0,t.isMakooError)(e)?(e.category!==void 0&&(i.category=e.category),i.code=e.code,e.details!==void 0&&(i.details=e.details),e.errors!==void 0&&(i.errors=e.errors.map(e=>d(e,r)))):e instanceof AggregateError&&(i.errors=e.errors.map(e=>d(e,r))),e.cause!==void 0&&(i.cause=d(e.cause,r)),i}return{message:String(e)}}function f(e,t,n){switch(t.kind){case`component`:return{attachedListeners:Object.entries(t.attachedListeners).flatMap(([e,t])=>t?[{name:e,status:n(t)}]:[]),kind:`component`,lastError:u(t.lastError),name:e,status:n(t)};case`component-each`:return{children:t.children.map(e=>({lastError:u(e.lastError),status:n(e)})),kind:`component-each`,lastError:u(t.lastError),name:e,status:n(t)};case`listener`:return{kind:`standalone-listener`,lastError:u(t.lastError),name:e,status:n(t)}}}exports.closePageReporters=o,exports.createDevframeReporter=c,exports.instrument=l;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { createMakoo } from '../../../../../core';
|
|
2
|
+
import { DevEndpoint, PageRuntimeRow } from './protocol';
|
|
3
|
+
export type CreateMakooFn = typeof createMakoo;
|
|
4
|
+
type DevframeClientLike = {
|
|
5
|
+
call(method: string, ...args: unknown[]): Promise<unknown>;
|
|
6
|
+
close?(): void;
|
|
7
|
+
readonly events: {
|
|
8
|
+
on(event: 'connection:status', listener: (status: string) => void): unknown;
|
|
9
|
+
};
|
|
10
|
+
readonly status: string;
|
|
11
|
+
};
|
|
12
|
+
export type DevframeReporterDeps = {
|
|
13
|
+
/** Test seam: fake the devframe client factory. */
|
|
14
|
+
connect?: (endpoint: DevEndpoint) => Promise<DevframeClientLike>;
|
|
15
|
+
reconnectDelayMs?: number;
|
|
16
|
+
};
|
|
17
|
+
/** The page-side half of the bridge: accepts whole-table submissions. */
|
|
18
|
+
export type PageReporter = {
|
|
19
|
+
close(): void;
|
|
20
|
+
submit(rows: PageRuntimeRow[]): void;
|
|
21
|
+
};
|
|
22
|
+
/** Closes every reporter created on this page. Test/teardown hook (e.g. SSR runners). */
|
|
23
|
+
export declare function closePageReporters(): void;
|
|
24
|
+
/**
|
|
25
|
+
* Page-level reporter: one devframe client per page, whole-table submissions.
|
|
26
|
+
*
|
|
27
|
+
* devframe has no automatic reconnect: on `disconnected` the client is discarded and a new
|
|
28
|
+
* one is created after `reconnectDelayMs`. Every `connected` transition resends the latest
|
|
29
|
+
* table, which is also how a restarted bridge relearns the page. Submissions that arrive
|
|
30
|
+
* while a call is in flight are merged: only the newest pending table is sent next.
|
|
31
|
+
*/
|
|
32
|
+
export declare function createDevframeReporter(endpoint: DevEndpoint, deps?: DevframeReporterDeps): PageReporter;
|
|
33
|
+
/**
|
|
34
|
+
* Wraps `createMakoo` so every Core Instance on the page reports its complete injection
|
|
35
|
+
* table through `reporter`. Pure: no globals, no knowledge of the virtual module.
|
|
36
|
+
*/
|
|
37
|
+
export declare function instrument(base: CreateMakooFn, endpoint: DevEndpoint, reporter?: PageReporter): CreateMakooFn;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { t as e } from "../protocol-ZRHs80xs.js";
|
|
2
|
+
import { isMakooError as t } from "@makoojs/core";
|
|
3
|
+
import { connectDevframe as n } from "devframe/client";
|
|
4
|
+
//#region packages/cli/src/bridge/runtime.ts
|
|
5
|
+
var r = 1e3, i = /* @__PURE__ */ new Set(), a = 5;
|
|
6
|
+
function o() {
|
|
7
|
+
for (let e of [...i]) e.close();
|
|
8
|
+
}
|
|
9
|
+
function s(e) {
|
|
10
|
+
return n({
|
|
11
|
+
authToken: e.token,
|
|
12
|
+
connection: {
|
|
13
|
+
authToken: e.token,
|
|
14
|
+
connectionMeta: {
|
|
15
|
+
backend: "websocket",
|
|
16
|
+
websocket: `ws://${e.host}:${e.port}/__ws`
|
|
17
|
+
},
|
|
18
|
+
metaBaseUrl: `http://${e.host}:${e.port}/`
|
|
19
|
+
},
|
|
20
|
+
otpParam: !1,
|
|
21
|
+
simpleAuth: !1
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function c(t, n = {}) {
|
|
25
|
+
let a = n.connect ?? s, o = n.reconnectDelayMs ?? r, c, l = !1, u = !1, d = !1, f = !1, p, m, h = (e) => {
|
|
26
|
+
let t = c;
|
|
27
|
+
c = void 0, u = !1, f = !1, t?.close?.(), e && y();
|
|
28
|
+
}, g = () => {
|
|
29
|
+
if (l || !u || f || !d || !p || c === void 0) return;
|
|
30
|
+
let t = c, n = p;
|
|
31
|
+
d = !1, f = !0;
|
|
32
|
+
let r = () => {
|
|
33
|
+
c === t && (f = !1, g());
|
|
34
|
+
};
|
|
35
|
+
try {
|
|
36
|
+
t.call(e, n).then(r, r);
|
|
37
|
+
} catch {
|
|
38
|
+
r();
|
|
39
|
+
}
|
|
40
|
+
}, _ = (e, t) => {
|
|
41
|
+
if (c === e) {
|
|
42
|
+
if (t === "connected") {
|
|
43
|
+
u = !0, d = !0, g();
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
t === "unauthorized" && h(!1), (t === "disconnected" || t === "error") && h(!0);
|
|
47
|
+
}
|
|
48
|
+
}, v = async () => {
|
|
49
|
+
let e;
|
|
50
|
+
try {
|
|
51
|
+
e = await a(t);
|
|
52
|
+
} catch {
|
|
53
|
+
y();
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (l) {
|
|
57
|
+
e.close?.();
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
c = e, e.events.on("connection:status", (t) => _(e, t)), _(e, e.status);
|
|
61
|
+
}, y = () => {
|
|
62
|
+
l || m !== void 0 || (m = setTimeout(() => {
|
|
63
|
+
m = void 0, v();
|
|
64
|
+
}, o));
|
|
65
|
+
};
|
|
66
|
+
v();
|
|
67
|
+
let b = {
|
|
68
|
+
close() {
|
|
69
|
+
l = !0, m !== void 0 && (clearTimeout(m), m = void 0), h(!1), i.delete(b);
|
|
70
|
+
},
|
|
71
|
+
submit(e) {
|
|
72
|
+
p = e, d = !0, g();
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
return i.add(b), b;
|
|
76
|
+
}
|
|
77
|
+
function l(e, t, n = c(t)) {
|
|
78
|
+
let r = 1, i = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = () => {
|
|
79
|
+
try {
|
|
80
|
+
l();
|
|
81
|
+
} catch (e) {
|
|
82
|
+
console.error(e);
|
|
83
|
+
}
|
|
84
|
+
}, l = () => {
|
|
85
|
+
let e = /* @__PURE__ */ new Set(), t = (t) => (e.add(t), t.status), r = [...i].map(([e, n]) => ({
|
|
86
|
+
diagnostics: n.diagnostics,
|
|
87
|
+
injections: [...n.injections].map(([e, n]) => f(e, n, t)),
|
|
88
|
+
runtimeId: e
|
|
89
|
+
}));
|
|
90
|
+
for (let t of e) o.has(t) || o.set(t, t.subscribe(s));
|
|
91
|
+
for (let [t, n] of o) e.has(t) || (n(), o.delete(t));
|
|
92
|
+
n.submit(r);
|
|
93
|
+
};
|
|
94
|
+
return function() {
|
|
95
|
+
let t = e(), n = r++, o = {
|
|
96
|
+
diagnostics: [],
|
|
97
|
+
injections: /* @__PURE__ */ new Map()
|
|
98
|
+
};
|
|
99
|
+
return i.set(n, o), s(), t.observe((e) => {
|
|
100
|
+
e.type === "injection-removed" ? o.injections.get(e.name) === e.injection && o.injections.delete(e.name) : e.type === "instance-disposed" ? i.delete(n) : (o.diagnostics.push({
|
|
101
|
+
error: u(e.error),
|
|
102
|
+
name: e.name,
|
|
103
|
+
type: "diagnostic"
|
|
104
|
+
}), o.diagnostics.length > a && o.diagnostics.shift()), s();
|
|
105
|
+
}), {
|
|
106
|
+
...t,
|
|
107
|
+
apply(e) {
|
|
108
|
+
t.apply(e);
|
|
109
|
+
for (let { kind: n, name: r } of e) try {
|
|
110
|
+
o.injections.set(r, n === "listener" ? t.listener(r) : t.injection(r));
|
|
111
|
+
} catch {}
|
|
112
|
+
s();
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function u(e) {
|
|
118
|
+
if (e !== void 0) return {
|
|
119
|
+
...d(e),
|
|
120
|
+
code: e.code
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function d(e, n = /* @__PURE__ */ new Set()) {
|
|
124
|
+
if (e instanceof Error) {
|
|
125
|
+
if (n.has(e)) return {
|
|
126
|
+
message: `[circular] ${e.message}`,
|
|
127
|
+
name: e.name
|
|
128
|
+
};
|
|
129
|
+
let r = /* @__PURE__ */ new Set([...n, e]), i = {
|
|
130
|
+
message: e.message,
|
|
131
|
+
name: e.name
|
|
132
|
+
};
|
|
133
|
+
return t(e) ? (e.category !== void 0 && (i.category = e.category), i.code = e.code, e.details !== void 0 && (i.details = e.details), e.errors !== void 0 && (i.errors = e.errors.map((e) => d(e, r)))) : e instanceof AggregateError && (i.errors = e.errors.map((e) => d(e, r))), e.cause !== void 0 && (i.cause = d(e.cause, r)), i;
|
|
134
|
+
}
|
|
135
|
+
return { message: String(e) };
|
|
136
|
+
}
|
|
137
|
+
function f(e, t, n) {
|
|
138
|
+
switch (t.kind) {
|
|
139
|
+
case "component": return {
|
|
140
|
+
attachedListeners: Object.entries(t.attachedListeners).flatMap(([e, t]) => t ? [{
|
|
141
|
+
name: e,
|
|
142
|
+
status: n(t)
|
|
143
|
+
}] : []),
|
|
144
|
+
kind: "component",
|
|
145
|
+
lastError: u(t.lastError),
|
|
146
|
+
name: e,
|
|
147
|
+
status: n(t)
|
|
148
|
+
};
|
|
149
|
+
case "component-each": return {
|
|
150
|
+
children: t.children.map((e) => ({
|
|
151
|
+
lastError: u(e.lastError),
|
|
152
|
+
status: n(e)
|
|
153
|
+
})),
|
|
154
|
+
kind: "component-each",
|
|
155
|
+
lastError: u(t.lastError),
|
|
156
|
+
name: e,
|
|
157
|
+
status: n(t)
|
|
158
|
+
};
|
|
159
|
+
case "listener": return {
|
|
160
|
+
kind: "standalone-listener",
|
|
161
|
+
lastError: u(t.lastError),
|
|
162
|
+
name: e,
|
|
163
|
+
status: n(t)
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
//#endregion
|
|
168
|
+
export { o as closePageReporters, c as createDevframeReporter, l as instrument };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DevEndpoint } from './protocol';
|
|
2
|
+
import { RuntimeStore } from './store';
|
|
3
|
+
export type BridgeAddress = {
|
|
4
|
+
host: string;
|
|
5
|
+
port: number;
|
|
6
|
+
};
|
|
7
|
+
export type DevBridge = {
|
|
8
|
+
endpoint: DevEndpoint;
|
|
9
|
+
close: () => Promise<void>;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Start the devframe bridge (bridge mode: `__connection.json` + WS only).
|
|
13
|
+
* devframe itself is loaded lazily so build/preview paths never pull it in.
|
|
14
|
+
*/
|
|
15
|
+
export declare function startDevBridge(store: RuntimeStore, address: BridgeAddress): Promise<DevBridge>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PageRuntimeRow } from './protocol';
|
|
2
|
+
/** One row the terminal renders: a page row stamped with its connection id. */
|
|
3
|
+
export type RuntimeSnapshot = PageRuntimeRow & {
|
|
4
|
+
clientId: number;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Node-side table of per-page runtime state. The devframe bridge writes whole
|
|
8
|
+
* page tables keyed by connection id; the terminal reads the projection.
|
|
9
|
+
*/
|
|
10
|
+
export declare class RuntimeStore {
|
|
11
|
+
private readonly pages;
|
|
12
|
+
private onChange;
|
|
13
|
+
replacePage(connectionId: number, rows: PageRuntimeRow[]): void;
|
|
14
|
+
disconnect(connectionId: number): void;
|
|
15
|
+
subscribe(onChange: () => void): () => void;
|
|
16
|
+
getRuntimeSnapshots(): RuntimeSnapshot[];
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function loadCliVersion(): Promise<string>;
|
package/dist/config/resolve.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import { MonkeyOption } from 'vite-plugin-monkey';
|
|
2
|
-
import {
|
|
3
|
-
export declare const resolveAppConfig: (config: AppConfig) => AppConfig;
|
|
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;
|
|
2
|
+
import { CliConfig, ResolvedMakooConfig } from './types';
|
|
7
3
|
export declare const resolveConfig: (config: CliConfig, root?: string) => ResolvedMakooConfig;
|
|
8
4
|
export declare const resolveMonkeyPluginOptions: (config: ResolvedMakooConfig) => MonkeyOption;
|
package/dist/config/types.d.ts
CHANGED
|
@@ -5,32 +5,72 @@ export type MonkeyGenerateContext = {
|
|
|
5
5
|
userscript: string;
|
|
6
6
|
mode: MonkeyMode;
|
|
7
7
|
};
|
|
8
|
+
/** Dev server options for vite-plugin-monkey. */
|
|
8
9
|
export type MonkeyServerConfig = {
|
|
10
|
+
/** Open the install URL in the browser when the dev server starts. Defaults to true on Windows and macOS. */
|
|
9
11
|
open?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Name of the dev script in the script manager: a function maps `app.name` to the name, a
|
|
14
|
+
* string replaces the whole name, and `false` keeps `app.name`. Defaults to `server:${name}`.
|
|
15
|
+
*/
|
|
10
16
|
prefix?: string | ((name: string) => string) | false;
|
|
11
17
|
};
|
|
18
|
+
/** Build options for vite-plugin-monkey. */
|
|
12
19
|
export type MonkeyBuildConfig = {
|
|
20
|
+
/** Output file name. Defaults to `${app.name}.user.js`. */
|
|
13
21
|
fileName?: string;
|
|
22
|
+
/**
|
|
23
|
+
* File name of a metadata-only script, usable as `@updateURL`. `true` replaces the trailing
|
|
24
|
+
* `.user.js` of `fileName` with `.meta.js`; `false` skips the file. Defaults to false.
|
|
25
|
+
*/
|
|
14
26
|
metaFileName?: string | boolean | ((fileName: string) => string);
|
|
27
|
+
/** Modules loaded from a CDN as globals instead of being bundled. */
|
|
15
28
|
externalGlobals?: ExternalGlobals;
|
|
29
|
+
/** Add `@grant` entries for the GM APIs used by the bundle. Defaults to true. */
|
|
16
30
|
autoGrant?: boolean;
|
|
31
|
+
/** Resources, such as CSS files, loaded through `@resource` instead of being bundled. */
|
|
17
32
|
externalResource?: ExternalResource;
|
|
33
|
+
/** Where SystemJS comes from when the code uses dynamic import: inlined, or a URL builder. */
|
|
18
34
|
systemjs?: 'inline' | ((version: string, packageName: string, importName?: string, resolveName?: string) => string);
|
|
35
|
+
/** Code that injects the bundled CSS into the page; defaults to `GM_addStyle` when available. */
|
|
19
36
|
cssSideEffects?: string | ((css: string) => void);
|
|
20
37
|
};
|
|
38
|
+
/** Userscript options. Fields not listed here are passed to vite-plugin-monkey as-is. */
|
|
21
39
|
export type MonkeyConfig = {
|
|
40
|
+
/** Userscript metadata; `name`, `version`, and `description` always come from {@link AppConfig}. */
|
|
22
41
|
userscript?: Omit<MonkeyUserScript, 'name' | 'version' | 'description'>;
|
|
42
|
+
/** Column alignment of the metadata block, or `false` for none. Defaults to 2. */
|
|
23
43
|
align?: number | false;
|
|
44
|
+
/** Rewrites the generated metadata block. */
|
|
24
45
|
generate?: (options: MonkeyGenerateContext) => Thenable<string>;
|
|
46
|
+
/** Passed to vite-plugin-monkey's `styleImport`. Defaults to true. */
|
|
25
47
|
styleImport?: boolean;
|
|
26
48
|
server?: MonkeyServerConfig;
|
|
27
49
|
build?: MonkeyBuildConfig;
|
|
28
50
|
};
|
|
51
|
+
/** Identity of the userscript. */
|
|
29
52
|
export type AppConfig = {
|
|
53
|
+
/** Required; becomes the userscript `@name`. */
|
|
30
54
|
name: string;
|
|
55
|
+
/** Required; becomes the userscript `@version`. */
|
|
31
56
|
version: string;
|
|
57
|
+
/** Becomes the userscript `@description`. */
|
|
32
58
|
description?: string;
|
|
33
59
|
};
|
|
60
|
+
/** The validated part of the Makoo configuration; unknown top-level fields are rejected. */
|
|
61
|
+
export type CliConfig = {
|
|
62
|
+
/** Path of the userscript entry file, resolved relative to `root`. */
|
|
63
|
+
entry: string;
|
|
64
|
+
app: AppConfig;
|
|
65
|
+
/** Required; may be an empty object. */
|
|
66
|
+
monkey: MonkeyConfig;
|
|
67
|
+
};
|
|
68
|
+
/** Options for `makoo()`. */
|
|
69
|
+
export type MakooConfig = CliConfig & {
|
|
70
|
+
/** Project root. Defaults to the current working directory. */
|
|
71
|
+
root?: string;
|
|
72
|
+
};
|
|
73
|
+
export type MonkeyUserscriptOption = NonNullable<MonkeyOption['userscript']>;
|
|
34
74
|
export type ResolvedMonkeyServerConfig = {
|
|
35
75
|
open: boolean;
|
|
36
76
|
prefix: string | ((name: string) => string) | false;
|
|
@@ -52,18 +92,9 @@ export type ResolvedMonkeyConfig = Omit<MonkeyConfig, 'userscript' | 'align' | '
|
|
|
52
92
|
server: ResolvedMonkeyServerConfig;
|
|
53
93
|
build: ResolvedMonkeyBuildConfig;
|
|
54
94
|
};
|
|
55
|
-
export type CliConfig = {
|
|
56
|
-
entry: string;
|
|
57
|
-
app: AppConfig;
|
|
58
|
-
monkey: MonkeyConfig;
|
|
59
|
-
};
|
|
60
|
-
export type MakooConfig = CliConfig & {
|
|
61
|
-
root?: string;
|
|
62
|
-
};
|
|
63
95
|
export type ResolvedMakooConfig = {
|
|
64
96
|
root: string;
|
|
65
97
|
entry: string;
|
|
66
98
|
app: AppConfig;
|
|
67
99
|
monkey: ResolvedMonkeyConfig;
|
|
68
100
|
};
|
|
69
|
-
export type MonkeyUserscriptOption = NonNullable<MonkeyOption['userscript']>;
|