Skip to content

Proposal: new and better UserScript metadata block #825

Open
@ACTCD

Description

@ACTCD

Once I have the above issue, I have to think, why can't we do the same thing in UserScript?

I think this makes a lot of things easier, especially as a JS developer, writing them is definitely easier and natural.

And parsing object literal strings is much easier than custom format, which JSON5 natively supports it.

Not to mention the benefits of natively adapting to various toolchains such as code highlighting, formatting, linting, etc.

It should also not affect JS runs by default (just an unused variable) and will also be stripped by the manager.

// ==UserScript==
// @name               DEMO.Alert-URL
// @description        Demo user script alert URL.
// @author             Userscripts
// @version            1.0.0
// @match              *://*/*
// @grant              none
// @inject-into        content
// @run-at             document-start
// ==/UserScript==

export const UserScriptMetadata = {
"name":        "DEMO.Alert-URL",
"description": "Demo user script alert URL.",
"author":      "Userscripts",
"version":     "1.0.0",
"match":       "*://*/*",
"grant":       "none",
"injectInto":  "content",
"runAt":       "document-start",
};

export const UserScriptMetadata = {
	name: "DEMO.Alert-URL",
	description: "Demo user script alert URL.",
	author: "Userscripts",
	version: "1.0.0",
	match: "*://*/*",
	grant: "none",
	injectInto: "content",
	runAt: "document-start",
};

(function () {
	"use strict";
	alert("DEBUG.Alert-URL:\n\n" + location);
})();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions