@shiqianjiang/ceru-plugin-issuer 0.2.4 → 0.3.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/index.js +85 -21
- package/package.json +49 -49
package/dist/index.js
CHANGED
|
@@ -138,18 +138,42 @@ export const MANIFEST_SCHEMA = object({
|
|
|
138
138
|
}, ['hostApi', 'logicRuntime']),
|
|
139
139
|
modules: object({
|
|
140
140
|
logic: object({ entry: id, activation: strings }, ['entry']),
|
|
141
|
+
share: object({ entry: id, configKeys: strings, guestAdapterId: id, guestGlobals: strings }, [
|
|
142
|
+
'entry',
|
|
143
|
+
]),
|
|
141
144
|
surfaces: {
|
|
142
145
|
type: 'array',
|
|
143
146
|
maxItems: 64,
|
|
144
|
-
items: object({
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
items: object({
|
|
148
|
+
id,
|
|
149
|
+
kind: { enum: ['schema', 'web'] },
|
|
150
|
+
entry: id,
|
|
151
|
+
title: { type: 'string', minLength: 1, maxLength: 100 },
|
|
152
|
+
presentation: object({
|
|
153
|
+
kind: { const: 'drawer' },
|
|
154
|
+
placement: { enum: ['left', 'right', 'top', 'bottom'] },
|
|
155
|
+
size: { type: 'integer', minimum: 280, maximum: 1200 },
|
|
156
|
+
}, ['kind']),
|
|
157
|
+
lifecycle: object({ openAction: id, closeAction: id }),
|
|
158
|
+
}, ['id', 'kind', 'entry']),
|
|
149
159
|
},
|
|
150
160
|
}),
|
|
151
161
|
contributes: object({
|
|
152
|
-
lyricConverters: {
|
|
162
|
+
lyricConverters: {
|
|
163
|
+
type: 'array',
|
|
164
|
+
maxItems: 16,
|
|
165
|
+
items: object({
|
|
166
|
+
id,
|
|
167
|
+
title: string,
|
|
168
|
+
formats: {
|
|
169
|
+
type: 'array',
|
|
170
|
+
items: {
|
|
171
|
+
enum: ['auto', 'lrc', 'enhanced-lrc', 'yrc', 'qrc', 'krc', 'ttml', 'plain'],
|
|
172
|
+
},
|
|
173
|
+
uniqueItems: true,
|
|
174
|
+
},
|
|
175
|
+
}, ['id', 'title', 'formats']),
|
|
176
|
+
},
|
|
153
177
|
menus: {
|
|
154
178
|
type: 'array',
|
|
155
179
|
maxItems: 64,
|
|
@@ -157,6 +181,7 @@ export const MANIFEST_SCHEMA = object({
|
|
|
157
181
|
id,
|
|
158
182
|
title: string,
|
|
159
183
|
commandId: id,
|
|
184
|
+
description: string,
|
|
160
185
|
slot: {
|
|
161
186
|
enum: [
|
|
162
187
|
'playlist.import',
|
|
@@ -248,10 +273,19 @@ export const MANIFEST_SCHEMA = object({
|
|
|
248
273
|
playlistImporters: {
|
|
249
274
|
type: 'array',
|
|
250
275
|
maxItems: 64,
|
|
251
|
-
items: object({
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
276
|
+
items: object({
|
|
277
|
+
id,
|
|
278
|
+
title: string,
|
|
279
|
+
description: string,
|
|
280
|
+
placeholder: string,
|
|
281
|
+
providerId: id,
|
|
282
|
+
examples: {
|
|
283
|
+
type: 'array',
|
|
284
|
+
maxItems: 16,
|
|
285
|
+
items: object({ label: string, value: string }, ['label', 'value']),
|
|
286
|
+
},
|
|
287
|
+
instructions: strings,
|
|
288
|
+
}, ['id', 'title']),
|
|
255
289
|
},
|
|
256
290
|
providers: {
|
|
257
291
|
type: 'array',
|
|
@@ -273,7 +307,11 @@ export const MANIFEST_SCHEMA = object({
|
|
|
273
307
|
commands: {
|
|
274
308
|
type: 'array',
|
|
275
309
|
maxItems: 128,
|
|
276
|
-
items: object({ id, title: string, action: id, view: id }, [
|
|
310
|
+
items: object({ id, title: string, description: string, action: id, view: id }, [
|
|
311
|
+
'id',
|
|
312
|
+
'title',
|
|
313
|
+
'action',
|
|
314
|
+
]),
|
|
277
315
|
},
|
|
278
316
|
sidebarItems: {
|
|
279
317
|
type: 'array',
|
|
@@ -292,6 +330,19 @@ export const MANIFEST_SCHEMA = object({
|
|
|
292
330
|
id,
|
|
293
331
|
format: string,
|
|
294
332
|
compatibilityProfile: string,
|
|
333
|
+
title: string,
|
|
334
|
+
extensions: strings,
|
|
335
|
+
badge: object({
|
|
336
|
+
label: { type: 'string', minLength: 1, maxLength: 24 },
|
|
337
|
+
backgroundColor: {
|
|
338
|
+
type: 'string',
|
|
339
|
+
pattern: '^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$',
|
|
340
|
+
},
|
|
341
|
+
textColor: {
|
|
342
|
+
type: 'string',
|
|
343
|
+
pattern: '^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$',
|
|
344
|
+
},
|
|
345
|
+
}, ['label', 'backgroundColor', 'textColor']),
|
|
295
346
|
bootstrap: id,
|
|
296
347
|
runtime: { const: 'ceru-js@1' },
|
|
297
348
|
projectableProtocols: strings,
|
|
@@ -338,6 +389,18 @@ export function validateManifest(value) {
|
|
|
338
389
|
for (const items of Object.values(manifest.contributes ?? {}))
|
|
339
390
|
unique(items.map((p) => p.id), 'contribution id');
|
|
340
391
|
const views = new Set(manifest.modules.surfaces?.map((p) => p.id));
|
|
392
|
+
const actions = new Set(manifest.contributes?.commands?.map((command) => command.action));
|
|
393
|
+
for (const surface of manifest.modules.surfaces ?? []) {
|
|
394
|
+
for (const action of Object.values(surface.lifecycle ?? {}))
|
|
395
|
+
ensure(actions.has(action), 'Unknown surface lifecycle action: ' + action);
|
|
396
|
+
}
|
|
397
|
+
const share = manifest.modules.share;
|
|
398
|
+
if (share?.guestAdapterId)
|
|
399
|
+
ensure(manifest.contributes?.guestAdapters?.some((adapter) => adapter.id === share.guestAdapterId), 'Unknown share guest adapter: ' + share.guestAdapterId);
|
|
400
|
+
for (const name of share?.guestGlobals ?? [])
|
|
401
|
+
ensure(/^[a-zA-Z_$][\w$]*$/.test(name) && !['globalThis', 'arguments', 'eval'].includes(name), 'Invalid share guest global: ' + name);
|
|
402
|
+
for (const menu of manifest.contributes?.menus ?? [])
|
|
403
|
+
ensure(manifest.contributes?.commands?.some((command) => command.id === menu.commandId), 'Unknown menu command: ' + menu.commandId);
|
|
341
404
|
for (const items of [
|
|
342
405
|
manifest.contributes?.commands,
|
|
343
406
|
manifest.contributes?.sidebarItems,
|
|
@@ -457,9 +520,7 @@ export function resolveArtifactConfig(header) {
|
|
|
457
520
|
? personalization
|
|
458
521
|
: undefined;
|
|
459
522
|
const config = personalizationObject?.['config'];
|
|
460
|
-
const override = plain(config)
|
|
461
|
-
? config
|
|
462
|
-
: Object.create(null);
|
|
523
|
+
const override = plain(config) ? config : Object.create(null);
|
|
463
524
|
return mergeConfig(header.manifest.config ?? Object.create(null), override);
|
|
464
525
|
}
|
|
465
526
|
/** Returns customer-facing metadata without changing plugin identity or permissions. */
|
|
@@ -743,13 +804,14 @@ function inspectBody(body, manifest) {
|
|
|
743
804
|
node.params.length <= 1 &&
|
|
744
805
|
(!node.params.length || node.params[0].type === 'Identifier'), 'Module must be a function with one context parameter');
|
|
745
806
|
const generatedEntry = exportedNode.type === 'Identifier' && selfContained.has(exportedNode.name);
|
|
746
|
-
modules[key] =
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
807
|
+
modules[key] =
|
|
808
|
+
preamble.length && !generatedEntry
|
|
809
|
+
? 'async function(ctx) {\n' +
|
|
810
|
+
preamble.join('\n') +
|
|
811
|
+
'\nreturn (' +
|
|
812
|
+
body.slice(exportedNode.start, exportedNode.end) +
|
|
813
|
+
')(ctx);\n}'
|
|
814
|
+
: body.slice(node.start, node.end);
|
|
753
815
|
}
|
|
754
816
|
ensure(Object.keys(modules).length <= 128, 'Too many modules');
|
|
755
817
|
const resources = astJson(registry.get('resources'));
|
|
@@ -781,6 +843,8 @@ function inspectBody(body, manifest) {
|
|
|
781
843
|
};
|
|
782
844
|
if (manifest.modules.logic)
|
|
783
845
|
add(manifest.modules.logic.entry);
|
|
846
|
+
if (manifest.modules.share)
|
|
847
|
+
add(manifest.modules.share.entry);
|
|
784
848
|
for (const surface of manifest.modules.surfaces ?? []) {
|
|
785
849
|
if (surface.kind === 'web')
|
|
786
850
|
add(surface.entry);
|
package/package.json
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@shiqianjiang/ceru-plugin-issuer",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Static verification, Ed25519 signing and cached personalized issuance of Ceru single-JS plugins",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "./dist/index.js",
|
|
7
|
-
"types": "./dist/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"types": "./dist/index.d.ts",
|
|
11
|
-
"import": "./dist/index.js",
|
|
12
|
-
"default": "./dist/index.js"
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
"files": [
|
|
16
|
-
"dist",
|
|
17
|
-
"README.md",
|
|
18
|
-
"LICENSE"
|
|
19
|
-
],
|
|
20
|
-
"license": "MIT",
|
|
21
|
-
"author": "澜音团队",
|
|
22
|
-
"engines": {
|
|
23
|
-
"node": ">=22.12.0"
|
|
24
|
-
},
|
|
25
|
-
"dependencies": {
|
|
26
|
-
"@shiqianjiang/ceru-plugin-sdk": "0.
|
|
27
|
-
"acorn": "^8.18.0",
|
|
28
|
-
"ajv": "^8.20.0"
|
|
29
|
-
},
|
|
30
|
-
"publishConfig": {
|
|
31
|
-
"access": "public",
|
|
32
|
-
"registry": "https://registry.npmjs.org/"
|
|
33
|
-
},
|
|
34
|
-
"repository": {
|
|
35
|
-
"type": "git",
|
|
36
|
-
"url": "git+https://github.com/CeruMusic/CeruMusic-Plugin-Cli.git",
|
|
37
|
-
"directory": "packages/issuer"
|
|
38
|
-
},
|
|
39
|
-
"bugs": {
|
|
40
|
-
"url": "https://github.com/CeruMusic/CeruMusic-Plugin-Cli/issues"
|
|
41
|
-
},
|
|
42
|
-
"homepage": "https://github.com/CeruMusic/CeruMusic-Plugin-Cli#readme",
|
|
43
|
-
"keywords": [
|
|
44
|
-
"ceru-music",
|
|
45
|
-
"plugin",
|
|
46
|
-
"typescript",
|
|
47
|
-
"electron"
|
|
48
|
-
]
|
|
49
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@shiqianjiang/ceru-plugin-issuer",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Static verification, Ed25519 signing and cached personalized issuance of Ceru single-JS plugins",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md",
|
|
18
|
+
"LICENSE"
|
|
19
|
+
],
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"author": "澜音团队",
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=22.12.0"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@shiqianjiang/ceru-plugin-sdk": "0.3.0",
|
|
27
|
+
"acorn": "^8.18.0",
|
|
28
|
+
"ajv": "^8.20.0"
|
|
29
|
+
},
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public",
|
|
32
|
+
"registry": "https://registry.npmjs.org/"
|
|
33
|
+
},
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "git+https://github.com/CeruMusic/CeruMusic-Plugin-Cli.git",
|
|
37
|
+
"directory": "packages/issuer"
|
|
38
|
+
},
|
|
39
|
+
"bugs": {
|
|
40
|
+
"url": "https://github.com/CeruMusic/CeruMusic-Plugin-Cli/issues"
|
|
41
|
+
},
|
|
42
|
+
"homepage": "https://github.com/CeruMusic/CeruMusic-Plugin-Cli#readme",
|
|
43
|
+
"keywords": [
|
|
44
|
+
"ceru-music",
|
|
45
|
+
"plugin",
|
|
46
|
+
"typescript",
|
|
47
|
+
"electron"
|
|
48
|
+
]
|
|
49
|
+
}
|