mirror of
https://github.com/GetOpenScript/OpenScript.git
synced 2026-09-18 09:45:43 +00:00
Add optional script version metadata
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// Parse OpenScript's deliberately small metadata format.
|
||||
|
||||
const SINGLE_KEYS = new Set(['name', 'description', 'run-at']);
|
||||
const SINGLE_KEYS = new Set(['name', 'version', 'description', 'run-at']);
|
||||
const MULTI_KEYS = new Set(['match', 'require']);
|
||||
|
||||
export const parseMeta = code => {
|
||||
@@ -20,6 +20,7 @@ export const parseMeta = code => {
|
||||
|
||||
return {
|
||||
name: meta.name || 'Untitled Script',
|
||||
version: meta.version || '',
|
||||
description: meta.description || '',
|
||||
matches: meta.match.length ? meta.match : ['*://*/*'],
|
||||
runAt: (meta['run-at'] || 'document_idle').replace('-', '_'),
|
||||
|
||||
Reference in New Issue
Block a user