bb-relay 0.0.4 → 0.0.5
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/index.d.mts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +35 -2
- package/dist/index.mjs +33 -1
- package/package.json +1 -1
- package/src/index.ts +5 -2
- package/src/lib/validate-manifest.ts +37 -0
package/dist/index.d.mts
CHANGED
|
@@ -549,4 +549,10 @@ interface Zip {
|
|
|
549
549
|
totalSize: number;
|
|
550
550
|
}
|
|
551
551
|
|
|
552
|
-
|
|
552
|
+
type ValidateManifestProp = {
|
|
553
|
+
text: string;
|
|
554
|
+
id: string;
|
|
555
|
+
};
|
|
556
|
+
declare const validateManifest: (manifestContent: string) => ValidateManifestProp[];
|
|
557
|
+
|
|
558
|
+
export { type BBEvent, type BBRequest, type Checkpoint, type CopyArg, type DirInfo, type DirectoryContents, type DirectoryStats, type EventReturn, type FileContent, type FileInfo, type GitFileStatus, type IconArg, type Language, type Load, type Locale, type MenuContent, type Nav, type Plugin, type Project, type Release, type RenameType, type RequestReturn, type Result, type Route, type Settings, type TutorialHeader, type User, type ValidateManifestProp, type WatchFSEvent, type Zip, BBRelay as default, enGB, frFR, injectStyles, registerEvent, registerRequest, validateManifest };
|
package/dist/index.d.ts
CHANGED
|
@@ -549,4 +549,10 @@ interface Zip {
|
|
|
549
549
|
totalSize: number;
|
|
550
550
|
}
|
|
551
551
|
|
|
552
|
-
|
|
552
|
+
type ValidateManifestProp = {
|
|
553
|
+
text: string;
|
|
554
|
+
id: string;
|
|
555
|
+
};
|
|
556
|
+
declare const validateManifest: (manifestContent: string) => ValidateManifestProp[];
|
|
557
|
+
|
|
558
|
+
export { type BBEvent, type BBRequest, type Checkpoint, type CopyArg, type DirInfo, type DirectoryContents, type DirectoryStats, type EventReturn, type FileContent, type FileInfo, type GitFileStatus, type IconArg, type Language, type Load, type Locale, type MenuContent, type Nav, type Plugin, type Project, type Release, type RenameType, type RequestReturn, type Result, type Route, type Settings, type TutorialHeader, type User, type ValidateManifestProp, type WatchFSEvent, type Zip, BBRelay as default, enGB, frFR, injectStyles, registerEvent, registerRequest, validateManifest };
|
package/dist/index.js
CHANGED
|
@@ -25,7 +25,8 @@ __export(src_exports, {
|
|
|
25
25
|
frFR: () => fr_FR_default,
|
|
26
26
|
injectStyles: () => injectStyles,
|
|
27
27
|
registerEvent: () => registerEvent,
|
|
28
|
-
registerRequest: () => registerRequest
|
|
28
|
+
registerRequest: () => registerRequest,
|
|
29
|
+
validateManifest: () => validate_manifest_default
|
|
29
30
|
});
|
|
30
31
|
module.exports = __toCommonJS(src_exports);
|
|
31
32
|
|
|
@@ -393,6 +394,37 @@ var frFR = {
|
|
|
393
394
|
};
|
|
394
395
|
var fr_FR_default = frFR;
|
|
395
396
|
|
|
397
|
+
// src/lib/validate-manifest.ts
|
|
398
|
+
var validateManifest = (manifestContent) => {
|
|
399
|
+
const checks = [];
|
|
400
|
+
const content = JSON.parse(manifestContent);
|
|
401
|
+
if (!content.id) {
|
|
402
|
+
checks.push({
|
|
403
|
+
text: "Manifest id is missing",
|
|
404
|
+
id: "manifest-id"
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
if (!content.manifest_version) {
|
|
408
|
+
checks.push({
|
|
409
|
+
text: "Manifest manifest_version is missing",
|
|
410
|
+
id: "manifest-version"
|
|
411
|
+
});
|
|
412
|
+
} else if (content.manifest_version !== 1) {
|
|
413
|
+
checks.push({
|
|
414
|
+
text: "Manifest manifest_version should be 1",
|
|
415
|
+
id: "manifest-version"
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
if (!content.version) {
|
|
419
|
+
checks.push({
|
|
420
|
+
text: "Plugin version not provided",
|
|
421
|
+
id: "plugin-version"
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
return checks;
|
|
425
|
+
};
|
|
426
|
+
var validate_manifest_default = validateManifest;
|
|
427
|
+
|
|
396
428
|
// src/index.ts
|
|
397
429
|
var src_default = BBRelay;
|
|
398
430
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -401,5 +433,6 @@ var src_default = BBRelay;
|
|
|
401
433
|
frFR,
|
|
402
434
|
injectStyles,
|
|
403
435
|
registerEvent,
|
|
404
|
-
registerRequest
|
|
436
|
+
registerRequest,
|
|
437
|
+
validateManifest
|
|
405
438
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -364,6 +364,37 @@ var frFR = {
|
|
|
364
364
|
};
|
|
365
365
|
var fr_FR_default = frFR;
|
|
366
366
|
|
|
367
|
+
// src/lib/validate-manifest.ts
|
|
368
|
+
var validateManifest = (manifestContent) => {
|
|
369
|
+
const checks = [];
|
|
370
|
+
const content = JSON.parse(manifestContent);
|
|
371
|
+
if (!content.id) {
|
|
372
|
+
checks.push({
|
|
373
|
+
text: "Manifest id is missing",
|
|
374
|
+
id: "manifest-id"
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
if (!content.manifest_version) {
|
|
378
|
+
checks.push({
|
|
379
|
+
text: "Manifest manifest_version is missing",
|
|
380
|
+
id: "manifest-version"
|
|
381
|
+
});
|
|
382
|
+
} else if (content.manifest_version !== 1) {
|
|
383
|
+
checks.push({
|
|
384
|
+
text: "Manifest manifest_version should be 1",
|
|
385
|
+
id: "manifest-version"
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
if (!content.version) {
|
|
389
|
+
checks.push({
|
|
390
|
+
text: "Plugin version not provided",
|
|
391
|
+
id: "plugin-version"
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
return checks;
|
|
395
|
+
};
|
|
396
|
+
var validate_manifest_default = validateManifest;
|
|
397
|
+
|
|
367
398
|
// src/index.ts
|
|
368
399
|
var src_default = BBRelay;
|
|
369
400
|
export {
|
|
@@ -372,5 +403,6 @@ export {
|
|
|
372
403
|
fr_FR_default as frFR,
|
|
373
404
|
injectStyles,
|
|
374
405
|
registerEvent,
|
|
375
|
-
registerRequest
|
|
406
|
+
registerRequest,
|
|
407
|
+
validate_manifest_default as validateManifest
|
|
376
408
|
};
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -33,11 +33,14 @@ import frFR from "./locales/fr-FR";
|
|
|
33
33
|
import { Release } from "./types/plugins/Release";
|
|
34
34
|
import { Plugin } from "./types/plugins/Plugin";
|
|
35
35
|
import { Zip } from "./types/Zip";
|
|
36
|
+
import validateManifest, {
|
|
37
|
+
ValidateManifestProp,
|
|
38
|
+
} from "./lib/validate-manifest";
|
|
36
39
|
|
|
37
40
|
export default BBRelay;
|
|
38
41
|
|
|
39
42
|
export { registerRequest, injectStyles, registerEvent };
|
|
40
|
-
|
|
43
|
+
export { validateManifest };
|
|
41
44
|
export type {
|
|
42
45
|
BBRequest,
|
|
43
46
|
DirInfo,
|
|
@@ -70,5 +73,5 @@ export type {
|
|
|
70
73
|
WatchFSEvent,
|
|
71
74
|
};
|
|
72
75
|
|
|
73
|
-
export type { Release, Plugin, Zip };
|
|
76
|
+
export type { Release, Plugin, Zip, ValidateManifestProp };
|
|
74
77
|
export { enGB, frFR };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export type ValidateManifestProp = {
|
|
2
|
+
text: string;
|
|
3
|
+
id: string;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
const validateManifest = (manifestContent: string) => {
|
|
7
|
+
const checks: ValidateManifestProp[] = [];
|
|
8
|
+
const content: Record<string, unknown> = JSON.parse(manifestContent);
|
|
9
|
+
|
|
10
|
+
if (!content.id) {
|
|
11
|
+
checks.push({
|
|
12
|
+
text: "Manifest id is missing",
|
|
13
|
+
id: "manifest-id",
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
if (!content.manifest_version) {
|
|
17
|
+
checks.push({
|
|
18
|
+
text: "Manifest manifest_version is missing",
|
|
19
|
+
id: "manifest-version",
|
|
20
|
+
});
|
|
21
|
+
} else if (content.manifest_version !== 1) {
|
|
22
|
+
checks.push({
|
|
23
|
+
text: "Manifest manifest_version should be 1",
|
|
24
|
+
id: "manifest-version",
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
if (!content.version) {
|
|
28
|
+
checks.push({
|
|
29
|
+
text: "Plugin version not provided",
|
|
30
|
+
id: "plugin-version",
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return checks;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default validateManifest;
|