@makoojs/cli 0.3.2 → 0.4.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.
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=e=>e;function t(e){return e}exports.defineInjection=e,exports.defineInjections=t;
@@ -0,0 +1,2 @@
1
+ export { defineInjection, defineInjections } from '../config/config';
2
+ export type { InjectionDefaults, InjectionFramework, InjectionListenerConfig, InjectionManifest, InjectionMatchConfig, InjectionModuleConfig, InjectionModuleListenerConfig } from '../config/types';
@@ -0,0 +1,7 @@
1
+ //#region packages/cli/src/config/config.ts
2
+ var e = (e) => e;
3
+ function t(e) {
4
+ return e;
5
+ }
6
+ //#endregion
7
+ export { e as defineInjection, t as defineInjections };
@@ -0,0 +1,14 @@
1
+ import { InjectionManifest, InjectionModuleConfig, ResolvedInjectionModule, ResolvedListener } from '../config/types';
2
+ import { ScannerManifestBindings } from './types';
3
+ type BuildManifestBindingsOptions = {
4
+ manifest: InjectionManifest;
5
+ manifestFile: string;
6
+ manifestInjections: ResolvedInjectionModule[];
7
+ moduleInjections: ResolvedInjectionModule[];
8
+ moduleInjectionConfigs: Map<string, InjectionModuleConfig>;
9
+ manifestListeners: ResolvedListener[];
10
+ enabledInjections: ResolvedInjectionModule[];
11
+ enabledListeners: ResolvedListener[];
12
+ };
13
+ export declare function buildManifestBindings(options: BuildManifestBindingsOptions): ScannerManifestBindings;
14
+ export {};
@@ -1,6 +1,7 @@
1
- import { InjectionManifest, InjectionModuleConfig, ResolvedConfig, ResolvedInjectionDefaults, ResolvedInjectionFramework, ResolvedInjectionModule } from '../config/types';
1
+ import { InjectionManifest, InjectionModuleConfig, ResolvedConfig, ResolvedInjectionDefaults, ResolvedInjectionFramework, ResolvedInjectionModule, ResolvedListener } from '../config/types';
2
2
  export type ScannerResult = {
3
3
  manifestFile: string;
4
+ manifestBindings: ScannerManifestBindings;
4
5
  manifestDependencies: string[];
5
6
  moduleManifestDependencies: string[];
6
7
  runtimeSetupFiles: string[];
@@ -8,8 +9,31 @@ export type ScannerResult = {
8
9
  config: ResolvedConfig;
9
10
  injectionDefaults: ResolvedInjectionDefaults;
10
11
  injections: ResolvedInjectionModule[];
12
+ listeners: ResolvedListener[];
11
13
  frameworks: ResolvedInjectionFramework[];
12
14
  };
15
+ export type ManifestBinding = {
16
+ manifestFile: string;
17
+ valuePath: Array<string | number>;
18
+ };
19
+ export type InjectionManifestBindings = {
20
+ hooks?: ManifestBinding;
21
+ on?: {
22
+ callback: ManifestBinding;
23
+ activitySignal?: ManifestBinding;
24
+ };
25
+ };
26
+ export type ListenerManifestBindings = {
27
+ callback: ManifestBinding;
28
+ activitySignal?: ManifestBinding;
29
+ };
30
+ export type ScannerManifestBindings = {
31
+ injectionDefaults?: {
32
+ hooks: ManifestBinding;
33
+ };
34
+ injections: Record<string, InjectionManifestBindings>;
35
+ listeners: Record<string, ListenerManifestBindings>;
36
+ };
13
37
  export type LoadManifestResult = {
14
38
  manifest: InjectionManifest;
15
39
  manifestFile: string;
@@ -1,3 +1,4 @@
1
+ import { ActivitySignalSource, ObserveHook } from '../../../../../core';
1
2
  import { z } from 'zod';
2
3
  export declare const ObserveEventNameSchema: z.ZodEnum<{
3
4
  "register:start": "register:start";
@@ -31,7 +32,7 @@ export declare const ObserveEventNameSchema: z.ZodEnum<{
31
32
  "dom:targetRemoved": "dom:targetRemoved";
32
33
  "dom:targetRestored": "dom:targetRestored";
33
34
  }>;
34
- export declare const LifecycleHookMapSchema: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>, z.ZodArray<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>]>>;
35
+ export declare const LifecycleHookMapSchema: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodCustom<ObserveHook, ObserveHook>, z.ZodArray<z.ZodCustom<ObserveHook, ObserveHook>>]>>;
35
36
  export declare const InjectionDefaultsSchema: z.ZodObject<{
36
37
  alive: z.ZodOptional<z.ZodBoolean>;
37
38
  scope: z.ZodOptional<z.ZodEnum<{
@@ -39,12 +40,18 @@ export declare const InjectionDefaultsSchema: z.ZodObject<{
39
40
  global: "global";
40
41
  }>>;
41
42
  timeout: z.ZodOptional<z.ZodNumber>;
42
- hooks: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>, z.ZodArray<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>]>>>;
43
+ hooks: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodCustom<ObserveHook, ObserveHook>, z.ZodArray<z.ZodCustom<ObserveHook, ObserveHook>>]>>>;
43
44
  }, z.core.$strip>;
44
45
  export declare const InjectionMatchSchema: z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodObject<{
45
46
  include: z.ZodOptional<z.ZodArray<z.ZodString>>;
46
47
  exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
47
48
  }, z.core.$strip>]>;
49
+ export declare const InjectionModuleListenerSchema: z.ZodObject<{
50
+ listenAt: z.ZodString;
51
+ type: z.ZodString;
52
+ callback: z.ZodCustom<EventListener, EventListener>;
53
+ activitySignal: z.ZodOptional<z.ZodCustom<() => ActivitySignalSource<boolean>, () => ActivitySignalSource<boolean>>>;
54
+ }, z.core.$strip>;
48
55
  export declare const InjectionModuleSchema: z.ZodObject<{
49
56
  name: z.ZodOptional<z.ZodString>;
50
57
  injectAt: z.ZodString;
@@ -65,6 +72,25 @@ export declare const InjectionModuleSchema: z.ZodObject<{
65
72
  global: "global";
66
73
  }>>;
67
74
  timeout: z.ZodOptional<z.ZodNumber>;
75
+ hooks: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodCustom<ObserveHook, ObserveHook>, z.ZodArray<z.ZodCustom<ObserveHook, ObserveHook>>]>>>;
76
+ on: z.ZodOptional<z.ZodObject<{
77
+ listenAt: z.ZodString;
78
+ type: z.ZodString;
79
+ callback: z.ZodCustom<EventListener, EventListener>;
80
+ activitySignal: z.ZodOptional<z.ZodCustom<() => ActivitySignalSource<boolean>, () => ActivitySignalSource<boolean>>>;
81
+ }, z.core.$strip>>;
82
+ }, z.core.$strip>;
83
+ export declare const InjectionListenerSchema: z.ZodObject<{
84
+ listenAt: z.ZodString;
85
+ type: z.ZodString;
86
+ callback: z.ZodCustom<EventListener, EventListener>;
87
+ activitySignal: z.ZodOptional<z.ZodCustom<() => ActivitySignalSource<boolean>, () => ActivitySignalSource<boolean>>>;
88
+ name: z.ZodOptional<z.ZodString>;
89
+ enabled: z.ZodOptional<z.ZodBoolean>;
90
+ match: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodObject<{
91
+ include: z.ZodOptional<z.ZodArray<z.ZodString>>;
92
+ exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
93
+ }, z.core.$strip>]>>;
68
94
  }, z.core.$strip>;
69
95
  export declare const InjectionManifestSchema: z.ZodObject<{
70
96
  injectionDefaults: z.ZodOptional<z.ZodObject<{
@@ -74,9 +100,9 @@ export declare const InjectionManifestSchema: z.ZodObject<{
74
100
  global: "global";
75
101
  }>>;
76
102
  timeout: z.ZodOptional<z.ZodNumber>;
77
- hooks: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>, z.ZodArray<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>]>>>;
103
+ hooks: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodCustom<ObserveHook, ObserveHook>, z.ZodArray<z.ZodCustom<ObserveHook, ObserveHook>>]>>>;
78
104
  }, z.core.$strip>>;
79
- injections: z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
105
+ injections: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
80
106
  name: z.ZodOptional<z.ZodString>;
81
107
  injectAt: z.ZodString;
82
108
  component: z.ZodString;
@@ -96,6 +122,13 @@ export declare const InjectionManifestSchema: z.ZodObject<{
96
122
  global: "global";
97
123
  }>>;
98
124
  timeout: z.ZodOptional<z.ZodNumber>;
125
+ hooks: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodCustom<ObserveHook, ObserveHook>, z.ZodArray<z.ZodCustom<ObserveHook, ObserveHook>>]>>>;
126
+ on: z.ZodOptional<z.ZodObject<{
127
+ listenAt: z.ZodString;
128
+ type: z.ZodString;
129
+ callback: z.ZodCustom<EventListener, EventListener>;
130
+ activitySignal: z.ZodOptional<z.ZodCustom<() => ActivitySignalSource<boolean>, () => ActivitySignalSource<boolean>>>;
131
+ }, z.core.$strip>>;
99
132
  }, z.core.$strip>>, z.ZodRecord<z.ZodString, z.ZodObject<{
100
133
  alive: z.ZodOptional<z.ZodBoolean>;
101
134
  scope: z.ZodOptional<z.ZodEnum<{
@@ -103,6 +136,13 @@ export declare const InjectionManifestSchema: z.ZodObject<{
103
136
  global: "global";
104
137
  }>>;
105
138
  timeout: z.ZodOptional<z.ZodNumber>;
139
+ hooks: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodCustom<ObserveHook, ObserveHook>, z.ZodArray<z.ZodCustom<ObserveHook, ObserveHook>>]>>>;
140
+ on: z.ZodOptional<z.ZodObject<{
141
+ listenAt: z.ZodString;
142
+ type: z.ZodString;
143
+ callback: z.ZodCustom<EventListener, EventListener>;
144
+ activitySignal: z.ZodOptional<z.ZodCustom<() => ActivitySignalSource<boolean>, () => ActivitySignalSource<boolean>>>;
145
+ }, z.core.$strip>>;
106
146
  injectAt: z.ZodString;
107
147
  component: z.ZodString;
108
148
  framework: z.ZodOptional<z.ZodEnum<{
@@ -115,7 +155,29 @@ export declare const InjectionManifestSchema: z.ZodObject<{
115
155
  include: z.ZodOptional<z.ZodArray<z.ZodString>>;
116
156
  exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
117
157
  }, z.core.$strip>]>>;
118
- }, z.core.$strip>>]>;
158
+ }, z.core.$strip>>]>>;
159
+ listeners: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
160
+ listenAt: z.ZodString;
161
+ type: z.ZodString;
162
+ callback: z.ZodCustom<EventListener, EventListener>;
163
+ activitySignal: z.ZodOptional<z.ZodCustom<() => ActivitySignalSource<boolean>, () => ActivitySignalSource<boolean>>>;
164
+ name: z.ZodOptional<z.ZodString>;
165
+ enabled: z.ZodOptional<z.ZodBoolean>;
166
+ match: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodObject<{
167
+ include: z.ZodOptional<z.ZodArray<z.ZodString>>;
168
+ exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
169
+ }, z.core.$strip>]>>;
170
+ }, z.core.$strip>>, z.ZodRecord<z.ZodString, z.ZodObject<{
171
+ enabled: z.ZodOptional<z.ZodBoolean>;
172
+ match: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodObject<{
173
+ include: z.ZodOptional<z.ZodArray<z.ZodString>>;
174
+ exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
175
+ }, z.core.$strip>]>>;
176
+ listenAt: z.ZodString;
177
+ type: z.ZodString;
178
+ callback: z.ZodCustom<EventListener, EventListener>;
179
+ activitySignal: z.ZodOptional<z.ZodCustom<() => ActivitySignalSource<boolean>, () => ActivitySignalSource<boolean>>>;
180
+ }, z.core.$strip>>]>>;
119
181
  }, z.core.$strict>;
120
182
  export declare function validateManifest(data: unknown, file: string): z.infer<typeof InjectionManifestSchema>;
121
183
  export declare function validateModuleMeta(data: unknown, file: string): z.infer<typeof InjectionModuleSchema>;
@@ -2,6 +2,7 @@ export declare const ansi: {
2
2
  readonly reset: "\u001B[0m";
3
3
  readonly bold: "\u001B[1m";
4
4
  readonly cyan: "\u001B[36m";
5
+ readonly deepPink: "\u001B[38;5;162m";
5
6
  readonly green: "\u001B[32m";
6
7
  readonly dim: "\u001B[2m";
7
8
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makoojs/cli",
3
- "version": "0.3.2",
3
+ "version": "0.4.0",
4
4
  "description": "CLI and Vite integration for the Makoo userscript development framework",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -31,6 +31,11 @@
31
31
  "import": "./dist/index.js",
32
32
  "require": "./dist/index.cjs"
33
33
  },
34
+ "./manifest": {
35
+ "types": "./dist/manifest/index.d.ts",
36
+ "import": "./dist/manifest/index.js",
37
+ "require": "./dist/manifest/index.cjs"
38
+ },
34
39
  "./monkey": {
35
40
  "types": "./dist/monkey/index.d.ts",
36
41
  "import": "./dist/monkey/index.js",
@@ -46,10 +51,10 @@
46
51
  "devDependencies": {
47
52
  "@types/picomatch": "^4.0.3",
48
53
  "cac": "^7.0.0",
49
- "@makoojs/core": "0.2.1"
54
+ "@makoojs/core": "0.3.0"
50
55
  },
51
56
  "peerDependencies": {
52
- "vite": ">=7",
53
- "@makoojs/core": "^0.2.1"
57
+ "@makoojs/core": "*",
58
+ "vite": ">=7"
54
59
  }
55
60
  }