bb-relay 0.0.38 → 0.0.40
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/editor.d.mts +2 -0
- package/dist/editor.d.ts +2 -0
- package/dist/index.d.mts +8 -9
- package/dist/index.d.ts +8 -9
- package/dist/index.js +22 -15
- package/dist/index.mjs +22 -15
- package/dist/plugin.d.mts +2 -3
- package/dist/plugin.d.ts +2 -3
- package/dist/plugin.js +12 -22
- package/dist/plugin.mjs +10 -20
- package/package.json +1 -1
- package/src/lib/plugin/RenderStatusType.ts +1 -1
- package/src/lib/plugin/index.ts +15 -24
- package/src/lib/validate-manifest/index.ts +23 -15
- package/src/types/editor/Manifest.ts +8 -9
- package/src/types/editor/Settings.ts +2 -0
package/dist/editor.d.mts
CHANGED
package/dist/editor.d.ts
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -17,10 +17,15 @@ type Manifest = {
|
|
|
17
17
|
name: string;
|
|
18
18
|
description?: string;
|
|
19
19
|
keyword?: string[];
|
|
20
|
+
permissions: Permission[];
|
|
21
|
+
manifest_version: 1;
|
|
22
|
+
version: string;
|
|
23
|
+
author?: string;
|
|
24
|
+
homepage?: string;
|
|
25
|
+
repository?: string;
|
|
20
26
|
sidebar?: {
|
|
21
27
|
icon: string;
|
|
22
28
|
title: string;
|
|
23
|
-
path: string;
|
|
24
29
|
};
|
|
25
30
|
main?: {
|
|
26
31
|
path: string;
|
|
@@ -28,16 +33,10 @@ type Manifest = {
|
|
|
28
33
|
extensions: string[];
|
|
29
34
|
icon?: string;
|
|
30
35
|
};
|
|
31
|
-
|
|
32
|
-
iconsPath?: string;
|
|
33
|
-
manifest_version: 1;
|
|
34
|
-
version: string;
|
|
35
|
-
author?: string;
|
|
36
|
-
homepage?: string;
|
|
37
|
-
repository?: string;
|
|
36
|
+
icons?: string;
|
|
38
37
|
theme?: string;
|
|
38
|
+
entry?: string;
|
|
39
39
|
[key: string]: unknown;
|
|
40
|
-
status?: string;
|
|
41
40
|
};
|
|
42
41
|
|
|
43
42
|
declare const validateManifest: (manifestContent: string) => {
|
package/dist/index.d.ts
CHANGED
|
@@ -17,10 +17,15 @@ type Manifest = {
|
|
|
17
17
|
name: string;
|
|
18
18
|
description?: string;
|
|
19
19
|
keyword?: string[];
|
|
20
|
+
permissions: Permission[];
|
|
21
|
+
manifest_version: 1;
|
|
22
|
+
version: string;
|
|
23
|
+
author?: string;
|
|
24
|
+
homepage?: string;
|
|
25
|
+
repository?: string;
|
|
20
26
|
sidebar?: {
|
|
21
27
|
icon: string;
|
|
22
28
|
title: string;
|
|
23
|
-
path: string;
|
|
24
29
|
};
|
|
25
30
|
main?: {
|
|
26
31
|
path: string;
|
|
@@ -28,16 +33,10 @@ type Manifest = {
|
|
|
28
33
|
extensions: string[];
|
|
29
34
|
icon?: string;
|
|
30
35
|
};
|
|
31
|
-
|
|
32
|
-
iconsPath?: string;
|
|
33
|
-
manifest_version: 1;
|
|
34
|
-
version: string;
|
|
35
|
-
author?: string;
|
|
36
|
-
homepage?: string;
|
|
37
|
-
repository?: string;
|
|
36
|
+
icons?: string;
|
|
38
37
|
theme?: string;
|
|
38
|
+
entry?: string;
|
|
39
39
|
[key: string]: unknown;
|
|
40
|
-
status?: string;
|
|
41
40
|
};
|
|
42
41
|
|
|
43
42
|
declare const validateManifest: (manifestContent: string) => {
|
package/dist/index.js
CHANGED
|
@@ -36,39 +36,46 @@ var validateManifest = (manifestContent) => {
|
|
|
36
36
|
if (content.main) {
|
|
37
37
|
if (!content.main.path) {
|
|
38
38
|
errors.push("Manifest main path is missing");
|
|
39
|
-
} else
|
|
39
|
+
} else {
|
|
40
|
+
fileChecks.push(content.main.path);
|
|
41
|
+
}
|
|
42
|
+
if (!content.main.type) {
|
|
40
43
|
errors.push("Manifest main type is missing");
|
|
41
|
-
}
|
|
44
|
+
}
|
|
45
|
+
if (!content.main.extensions) {
|
|
42
46
|
errors.push("Manifest main extensions is missing");
|
|
43
47
|
} else if (!Array.isArray(content.main.extensions)) {
|
|
44
48
|
errors.push("Manifest main extensions is not an array");
|
|
45
49
|
} else if (content.main.extensions.length === 0) {
|
|
46
50
|
errors.push("Manifest main extensions is empty");
|
|
47
|
-
} else {
|
|
48
|
-
fileChecks.push(content.main.path);
|
|
49
51
|
}
|
|
50
52
|
}
|
|
51
53
|
if (content.sidebar) {
|
|
52
54
|
if (!content.sidebar.icon) {
|
|
53
55
|
errors.push("Manifest sidebar icon is missing");
|
|
54
|
-
} else if (!content.sidebar.title) {
|
|
55
|
-
errors.push("Manifest sidebar title is missing");
|
|
56
|
-
} else if (content.sidebar.path) {
|
|
57
|
-
if (!content.sidebar.path.endsWith(".js")) {
|
|
58
|
-
errors.push("Manifest sidebar path must be a js file");
|
|
59
|
-
} else fileChecks.push(content.sidebar.path);
|
|
60
56
|
} else {
|
|
61
57
|
fileChecks.push(content.sidebar.icon);
|
|
62
58
|
}
|
|
59
|
+
if (!content.sidebar.title) {
|
|
60
|
+
errors.push("Manifest sidebar title is missing");
|
|
61
|
+
}
|
|
63
62
|
}
|
|
64
|
-
if (content.
|
|
65
|
-
|
|
63
|
+
if (content.entry) {
|
|
64
|
+
if (!content.entry.endsWith(".js"))
|
|
65
|
+
errors.push("Entry file is not a javascript file");
|
|
66
|
+
else fileChecks.push(content.entry);
|
|
66
67
|
}
|
|
67
|
-
if (content.
|
|
68
|
-
fileChecks.push(content.
|
|
68
|
+
if (content.icons) {
|
|
69
|
+
fileChecks.push(content.icons + "/bb.png");
|
|
70
|
+
fileChecks.push(content.icons + "/bbe.png");
|
|
71
|
+
fileChecks.push(content.icons + "/default.png");
|
|
72
|
+
fileChecks.push(content.icons + "/folder.png");
|
|
73
|
+
fileChecks.push(content.icons + "/folder-open.png");
|
|
69
74
|
}
|
|
70
75
|
if (content.theme) {
|
|
71
|
-
|
|
76
|
+
if (!content.theme.endsWith(".css"))
|
|
77
|
+
errors.push("Theme file is not a css file");
|
|
78
|
+
else fileChecks.push(content.theme);
|
|
72
79
|
}
|
|
73
80
|
return {
|
|
74
81
|
errors,
|
package/dist/index.mjs
CHANGED
|
@@ -36,39 +36,46 @@ var validateManifest = (manifestContent) => {
|
|
|
36
36
|
if (content.main) {
|
|
37
37
|
if (!content.main.path) {
|
|
38
38
|
errors.push("Manifest main path is missing");
|
|
39
|
-
} else
|
|
39
|
+
} else {
|
|
40
|
+
fileChecks.push(content.main.path);
|
|
41
|
+
}
|
|
42
|
+
if (!content.main.type) {
|
|
40
43
|
errors.push("Manifest main type is missing");
|
|
41
|
-
}
|
|
44
|
+
}
|
|
45
|
+
if (!content.main.extensions) {
|
|
42
46
|
errors.push("Manifest main extensions is missing");
|
|
43
47
|
} else if (!Array.isArray(content.main.extensions)) {
|
|
44
48
|
errors.push("Manifest main extensions is not an array");
|
|
45
49
|
} else if (content.main.extensions.length === 0) {
|
|
46
50
|
errors.push("Manifest main extensions is empty");
|
|
47
|
-
} else {
|
|
48
|
-
fileChecks.push(content.main.path);
|
|
49
51
|
}
|
|
50
52
|
}
|
|
51
53
|
if (content.sidebar) {
|
|
52
54
|
if (!content.sidebar.icon) {
|
|
53
55
|
errors.push("Manifest sidebar icon is missing");
|
|
54
|
-
} else if (!content.sidebar.title) {
|
|
55
|
-
errors.push("Manifest sidebar title is missing");
|
|
56
|
-
} else if (content.sidebar.path) {
|
|
57
|
-
if (!content.sidebar.path.endsWith(".js")) {
|
|
58
|
-
errors.push("Manifest sidebar path must be a js file");
|
|
59
|
-
} else fileChecks.push(content.sidebar.path);
|
|
60
56
|
} else {
|
|
61
57
|
fileChecks.push(content.sidebar.icon);
|
|
62
58
|
}
|
|
59
|
+
if (!content.sidebar.title) {
|
|
60
|
+
errors.push("Manifest sidebar title is missing");
|
|
61
|
+
}
|
|
63
62
|
}
|
|
64
|
-
if (content.
|
|
65
|
-
|
|
63
|
+
if (content.entry) {
|
|
64
|
+
if (!content.entry.endsWith(".js"))
|
|
65
|
+
errors.push("Entry file is not a javascript file");
|
|
66
|
+
else fileChecks.push(content.entry);
|
|
66
67
|
}
|
|
67
|
-
if (content.
|
|
68
|
-
fileChecks.push(content.
|
|
68
|
+
if (content.icons) {
|
|
69
|
+
fileChecks.push(content.icons + "/bb.png");
|
|
70
|
+
fileChecks.push(content.icons + "/bbe.png");
|
|
71
|
+
fileChecks.push(content.icons + "/default.png");
|
|
72
|
+
fileChecks.push(content.icons + "/folder.png");
|
|
73
|
+
fileChecks.push(content.icons + "/folder-open.png");
|
|
69
74
|
}
|
|
70
75
|
if (content.theme) {
|
|
71
|
-
|
|
76
|
+
if (!content.theme.endsWith(".css"))
|
|
77
|
+
errors.push("Theme file is not a css file");
|
|
78
|
+
else fileChecks.push(content.theme);
|
|
72
79
|
}
|
|
73
80
|
return {
|
|
74
81
|
errors,
|
package/dist/plugin.d.mts
CHANGED
|
@@ -156,7 +156,7 @@ type StatusElement = {
|
|
|
156
156
|
iconLeft?: IconName;
|
|
157
157
|
iconRight?: IconName;
|
|
158
158
|
message?: string;
|
|
159
|
-
text?: string;
|
|
159
|
+
text?: string | number;
|
|
160
160
|
};
|
|
161
161
|
type RenderStatusType = {
|
|
162
162
|
element: StatusElement[];
|
|
@@ -229,7 +229,7 @@ declare abstract class Plugin<T extends Record<string, unknown>> {
|
|
|
229
229
|
* You will also need to set initial state here
|
|
230
230
|
*/
|
|
231
231
|
abstract init(): T;
|
|
232
|
-
protected
|
|
232
|
+
protected updateRender(): void;
|
|
233
233
|
/**
|
|
234
234
|
* Used to determine what will be shown at the sidebar whenever a user navigates
|
|
235
235
|
* to it.
|
|
@@ -283,7 +283,6 @@ declare abstract class Plugin<T extends Record<string, unknown>> {
|
|
|
283
283
|
protected on(event: "ping", callback: (arg: unknown) => void): void;
|
|
284
284
|
renderStatusBar?(): RenderStatusType | null;
|
|
285
285
|
private registerStatus;
|
|
286
|
-
private onStatusLoad;
|
|
287
286
|
protected setState(param: SetState<T>): void;
|
|
288
287
|
protected getState(): T;
|
|
289
288
|
protected log(message: string): void;
|
package/dist/plugin.d.ts
CHANGED
|
@@ -156,7 +156,7 @@ type StatusElement = {
|
|
|
156
156
|
iconLeft?: IconName;
|
|
157
157
|
iconRight?: IconName;
|
|
158
158
|
message?: string;
|
|
159
|
-
text?: string;
|
|
159
|
+
text?: string | number;
|
|
160
160
|
};
|
|
161
161
|
type RenderStatusType = {
|
|
162
162
|
element: StatusElement[];
|
|
@@ -229,7 +229,7 @@ declare abstract class Plugin<T extends Record<string, unknown>> {
|
|
|
229
229
|
* You will also need to set initial state here
|
|
230
230
|
*/
|
|
231
231
|
abstract init(): T;
|
|
232
|
-
protected
|
|
232
|
+
protected updateRender(): void;
|
|
233
233
|
/**
|
|
234
234
|
* Used to determine what will be shown at the sidebar whenever a user navigates
|
|
235
235
|
* to it.
|
|
@@ -283,7 +283,6 @@ declare abstract class Plugin<T extends Record<string, unknown>> {
|
|
|
283
283
|
protected on(event: "ping", callback: (arg: unknown) => void): void;
|
|
284
284
|
renderStatusBar?(): RenderStatusType | null;
|
|
285
285
|
private registerStatus;
|
|
286
|
-
private onStatusLoad;
|
|
287
286
|
protected setState(param: SetState<T>): void;
|
|
288
287
|
protected getState(): T;
|
|
289
288
|
protected log(message: string): void;
|
package/dist/plugin.js
CHANGED
|
@@ -56,13 +56,11 @@ var Plugin = class {
|
|
|
56
56
|
this.index = -1;
|
|
57
57
|
this.eventIds.forEach((event) => this.off(event));
|
|
58
58
|
this.eventIds = [];
|
|
59
|
-
|
|
60
|
-
if (sidebar) this.render("sidebar", sidebar);
|
|
61
|
-
const status = _optionalChain([this, 'access', _3 => _3.renderStatusBar, 'optionalCall', _4 => _4()]) || null;
|
|
62
|
-
if (status) this.registerStatus();
|
|
59
|
+
this.updateRender();
|
|
63
60
|
});
|
|
64
61
|
this.onSidebarLoad();
|
|
65
|
-
this.
|
|
62
|
+
this.registerStatus();
|
|
63
|
+
this.registerSubscription("destroy", this.destroy);
|
|
66
64
|
}
|
|
67
65
|
// -----------------------------
|
|
68
66
|
// Element Factory
|
|
@@ -89,13 +87,18 @@ var Plugin = class {
|
|
|
89
87
|
}
|
|
90
88
|
};
|
|
91
89
|
}
|
|
92
|
-
|
|
93
|
-
this.
|
|
90
|
+
updateRender() {
|
|
91
|
+
this.index = -1;
|
|
92
|
+
this.sendMessage({
|
|
93
|
+
type: "sidebar-update",
|
|
94
|
+
arg: _optionalChain([this, 'access', _ => _.renderSidebar, 'optionalCall', _2 => _2()]) || null
|
|
95
|
+
});
|
|
96
|
+
this.registerStatus();
|
|
94
97
|
}
|
|
95
98
|
onSidebarLoad() {
|
|
96
99
|
this.index = -1;
|
|
97
100
|
this.registerHandler("sidebar-load", () => {
|
|
98
|
-
return _optionalChain([this, 'access',
|
|
101
|
+
return _optionalChain([this, 'access', _3 => _3.renderSidebar, 'optionalCall', _4 => _4()]) || null;
|
|
99
102
|
});
|
|
100
103
|
}
|
|
101
104
|
// -----------------------------
|
|
@@ -169,7 +172,7 @@ var Plugin = class {
|
|
|
169
172
|
this.registerSubscription(event, callback);
|
|
170
173
|
}
|
|
171
174
|
registerStatus() {
|
|
172
|
-
const arg = _optionalChain([this, 'access',
|
|
175
|
+
const arg = _optionalChain([this, 'access', _5 => _5.renderStatusBar, 'optionalCall', _6 => _6()]);
|
|
173
176
|
if (!arg) return;
|
|
174
177
|
const { onClick, ...rest } = arg;
|
|
175
178
|
if (arg) {
|
|
@@ -181,19 +184,6 @@ var Plugin = class {
|
|
|
181
184
|
if (onClick) this.registerSubscription("status-click", onClick);
|
|
182
185
|
}
|
|
183
186
|
}
|
|
184
|
-
onStatusLoad() {
|
|
185
|
-
this.registerHandler("status-load", () => {
|
|
186
|
-
const statusBar = _optionalChain([this, 'access', _9 => _9.renderStatusBar, 'optionalCall', _10 => _10()]);
|
|
187
|
-
if (statusBar) {
|
|
188
|
-
const { onClick, ...rest } = statusBar;
|
|
189
|
-
if (onClick) {
|
|
190
|
-
this.registerSubscription("status-click", onClick);
|
|
191
|
-
}
|
|
192
|
-
return rest;
|
|
193
|
-
}
|
|
194
|
-
return null;
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
187
|
// -----------------------------
|
|
198
188
|
// State
|
|
199
189
|
// -----------------------------
|
package/dist/plugin.mjs
CHANGED
|
@@ -56,13 +56,11 @@ var Plugin = class {
|
|
|
56
56
|
this.index = -1;
|
|
57
57
|
this.eventIds.forEach((event) => this.off(event));
|
|
58
58
|
this.eventIds = [];
|
|
59
|
-
|
|
60
|
-
if (sidebar) this.render("sidebar", sidebar);
|
|
61
|
-
const status = this.renderStatusBar?.() || null;
|
|
62
|
-
if (status) this.registerStatus();
|
|
59
|
+
this.updateRender();
|
|
63
60
|
});
|
|
64
61
|
this.onSidebarLoad();
|
|
65
|
-
this.
|
|
62
|
+
this.registerStatus();
|
|
63
|
+
this.registerSubscription("destroy", this.destroy);
|
|
66
64
|
}
|
|
67
65
|
// -----------------------------
|
|
68
66
|
// Element Factory
|
|
@@ -89,8 +87,13 @@ var Plugin = class {
|
|
|
89
87
|
}
|
|
90
88
|
};
|
|
91
89
|
}
|
|
92
|
-
|
|
93
|
-
this.
|
|
90
|
+
updateRender() {
|
|
91
|
+
this.index = -1;
|
|
92
|
+
this.sendMessage({
|
|
93
|
+
type: "sidebar-update",
|
|
94
|
+
arg: this.renderSidebar?.() || null
|
|
95
|
+
});
|
|
96
|
+
this.registerStatus();
|
|
94
97
|
}
|
|
95
98
|
onSidebarLoad() {
|
|
96
99
|
this.index = -1;
|
|
@@ -181,19 +184,6 @@ var Plugin = class {
|
|
|
181
184
|
if (onClick) this.registerSubscription("status-click", onClick);
|
|
182
185
|
}
|
|
183
186
|
}
|
|
184
|
-
onStatusLoad() {
|
|
185
|
-
this.registerHandler("status-load", () => {
|
|
186
|
-
const statusBar = this.renderStatusBar?.();
|
|
187
|
-
if (statusBar) {
|
|
188
|
-
const { onClick, ...rest } = statusBar;
|
|
189
|
-
if (onClick) {
|
|
190
|
-
this.registerSubscription("status-click", onClick);
|
|
191
|
-
}
|
|
192
|
-
return rest;
|
|
193
|
-
}
|
|
194
|
-
return null;
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
187
|
// -----------------------------
|
|
198
188
|
// State
|
|
199
189
|
// -----------------------------
|
package/package.json
CHANGED
package/src/lib/plugin/index.ts
CHANGED
|
@@ -111,6 +111,7 @@ export abstract class Plugin<T extends Record<string, unknown>> {
|
|
|
111
111
|
store: Store<T>;
|
|
112
112
|
notify: (message: string) => void;
|
|
113
113
|
}) {
|
|
114
|
+
// supply functions from the main app
|
|
114
115
|
this.notify = notify;
|
|
115
116
|
this.sendMessage = (arg) => sendMessage({ ...arg, pluginId });
|
|
116
117
|
this.subscribe = subscribe;
|
|
@@ -119,24 +120,24 @@ export abstract class Plugin<T extends Record<string, unknown>> {
|
|
|
119
120
|
this.pluginId = pluginId;
|
|
120
121
|
this.editor = editor;
|
|
121
122
|
|
|
123
|
+
// Sync local state
|
|
122
124
|
this.store = store;
|
|
123
125
|
const value = store.get();
|
|
124
126
|
this.setState({ ...this.init(), ...value });
|
|
125
127
|
|
|
128
|
+
// Store changes will trigger updates in sidebar and status if implemented
|
|
126
129
|
this.store.subscribe((curr, prev) => {
|
|
127
130
|
const isEqual = equal(curr, prev);
|
|
128
131
|
if (isEqual) return;
|
|
129
132
|
this.index = -1;
|
|
130
133
|
this.eventIds.forEach((event) => this.off(event));
|
|
131
134
|
this.eventIds = [];
|
|
132
|
-
|
|
133
|
-
if (sidebar) this.render("sidebar", sidebar);
|
|
134
|
-
const status = this.renderStatusBar?.() || null;
|
|
135
|
-
if (status) this.registerStatus();
|
|
135
|
+
this.updateRender();
|
|
136
136
|
});
|
|
137
137
|
|
|
138
138
|
this.onSidebarLoad();
|
|
139
|
-
this.
|
|
139
|
+
this.registerStatus();
|
|
140
|
+
this.registerSubscription("destroy", this.destroy);
|
|
140
141
|
}
|
|
141
142
|
|
|
142
143
|
// -----------------------------
|
|
@@ -196,12 +197,16 @@ export abstract class Plugin<T extends Record<string, unknown>> {
|
|
|
196
197
|
|
|
197
198
|
abstract init(): T;
|
|
198
199
|
|
|
199
|
-
protected
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
200
|
+
protected updateRender(): void {
|
|
201
|
+
this.index = -1;
|
|
202
|
+
this.sendMessage({
|
|
203
|
+
type: "sidebar-update",
|
|
204
|
+
arg: this.renderSidebar?.() || null,
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
this.registerStatus();
|
|
204
208
|
}
|
|
209
|
+
|
|
205
210
|
// -----------------------------
|
|
206
211
|
// Sidebar
|
|
207
212
|
// -----------------------------
|
|
@@ -368,20 +373,6 @@ export abstract class Plugin<T extends Record<string, unknown>> {
|
|
|
368
373
|
}
|
|
369
374
|
}
|
|
370
375
|
|
|
371
|
-
private onStatusLoad(): void {
|
|
372
|
-
this.registerHandler("status-load", () => {
|
|
373
|
-
const statusBar = this.renderStatusBar?.();
|
|
374
|
-
if (statusBar) {
|
|
375
|
-
const { onClick, ...rest } = statusBar;
|
|
376
|
-
if (onClick) {
|
|
377
|
-
this.registerSubscription("status-click", onClick);
|
|
378
|
-
}
|
|
379
|
-
return rest;
|
|
380
|
-
}
|
|
381
|
-
return null;
|
|
382
|
-
});
|
|
383
|
-
}
|
|
384
|
-
|
|
385
376
|
// -----------------------------
|
|
386
377
|
// State
|
|
387
378
|
// -----------------------------
|
|
@@ -30,44 +30,52 @@ const validateManifest = (manifestContent: string) => {
|
|
|
30
30
|
if (content.main) {
|
|
31
31
|
if (!content.main.path) {
|
|
32
32
|
errors.push("Manifest main path is missing");
|
|
33
|
-
} else
|
|
33
|
+
} else {
|
|
34
|
+
fileChecks.push(content.main.path);
|
|
35
|
+
}
|
|
36
|
+
if (!content.main.type) {
|
|
34
37
|
errors.push("Manifest main type is missing");
|
|
35
|
-
}
|
|
38
|
+
}
|
|
39
|
+
if (!content.main.extensions) {
|
|
36
40
|
errors.push("Manifest main extensions is missing");
|
|
37
41
|
} else if (!Array.isArray(content.main.extensions)) {
|
|
38
42
|
errors.push("Manifest main extensions is not an array");
|
|
39
43
|
} else if (content.main.extensions.length === 0) {
|
|
40
44
|
errors.push("Manifest main extensions is empty");
|
|
41
|
-
} else {
|
|
42
|
-
fileChecks.push(content.main.path);
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
if (content.sidebar) {
|
|
47
49
|
if (!content.sidebar.icon) {
|
|
48
50
|
errors.push("Manifest sidebar icon is missing");
|
|
49
|
-
} else if (!content.sidebar.title) {
|
|
50
|
-
errors.push("Manifest sidebar title is missing");
|
|
51
|
-
} else if (content.sidebar.path) {
|
|
52
|
-
if (!content.sidebar.path.endsWith(".js")) {
|
|
53
|
-
errors.push("Manifest sidebar path must be a js file");
|
|
54
|
-
} else fileChecks.push(content.sidebar.path);
|
|
55
51
|
} else {
|
|
56
52
|
fileChecks.push(content.sidebar.icon);
|
|
57
53
|
}
|
|
54
|
+
if (!content.sidebar.title) {
|
|
55
|
+
errors.push("Manifest sidebar title is missing");
|
|
56
|
+
}
|
|
58
57
|
}
|
|
59
58
|
|
|
60
|
-
if (content.
|
|
61
|
-
|
|
59
|
+
if (content.entry) {
|
|
60
|
+
if (!content.entry.endsWith(".js"))
|
|
61
|
+
errors.push("Entry file is not a javascript file");
|
|
62
|
+
else fileChecks.push(content.entry);
|
|
62
63
|
}
|
|
63
64
|
|
|
64
|
-
if (content.
|
|
65
|
-
fileChecks.push(content.
|
|
65
|
+
if (content.icons) {
|
|
66
|
+
fileChecks.push(content.icons + "/bb.png");
|
|
67
|
+
fileChecks.push(content.icons + "/bbe.png");
|
|
68
|
+
fileChecks.push(content.icons + "/default.png");
|
|
69
|
+
fileChecks.push(content.icons + "/folder.png");
|
|
70
|
+
fileChecks.push(content.icons + "/folder-open.png");
|
|
66
71
|
}
|
|
67
72
|
|
|
68
73
|
if (content.theme) {
|
|
69
|
-
|
|
74
|
+
if (!content.theme.endsWith(".css"))
|
|
75
|
+
errors.push("Theme file is not a css file");
|
|
76
|
+
else fileChecks.push(content.theme);
|
|
70
77
|
}
|
|
78
|
+
|
|
71
79
|
return {
|
|
72
80
|
errors,
|
|
73
81
|
fileChecks,
|
|
@@ -14,10 +14,15 @@ export type Manifest = {
|
|
|
14
14
|
name: string;
|
|
15
15
|
description?: string;
|
|
16
16
|
keyword?: string[];
|
|
17
|
+
permissions: Permission[];
|
|
18
|
+
manifest_version: 1;
|
|
19
|
+
version: string;
|
|
20
|
+
author?: string;
|
|
21
|
+
homepage?: string;
|
|
22
|
+
repository?: string;
|
|
17
23
|
sidebar?: {
|
|
18
24
|
icon: string;
|
|
19
25
|
title: string;
|
|
20
|
-
path: string;
|
|
21
26
|
};
|
|
22
27
|
main?: {
|
|
23
28
|
path: string;
|
|
@@ -25,14 +30,8 @@ export type Manifest = {
|
|
|
25
30
|
extensions: string[];
|
|
26
31
|
icon?: string;
|
|
27
32
|
};
|
|
28
|
-
|
|
29
|
-
iconsPath?: string;
|
|
30
|
-
manifest_version: 1;
|
|
31
|
-
version: string;
|
|
32
|
-
author?: string;
|
|
33
|
-
homepage?: string;
|
|
34
|
-
repository?: string;
|
|
33
|
+
icons?: string;
|
|
35
34
|
theme?: string;
|
|
35
|
+
entry?: string;
|
|
36
36
|
[key: string]: unknown;
|
|
37
|
-
status?: string;
|
|
38
37
|
};
|