Skip to content

Commit

Permalink
Merge pull request #3 from Giglium/main
Browse files Browse the repository at this point in the history
Add "@inject-into" meta key support for Violent Monkey users
  • Loading branch information
guansss authored Jun 19, 2024
2 parents 2df63ca + 024a0f6 commit e181535
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/shared/meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ export const META_FIELDS_STRING = [
"downloadURL",
"supportURL",
"unwrap",
// Only valid for Violent Monkey @see {@link https://violentmonkey.github.io/api/metadata-block/#inject-into}
"inject-into",
"injectInto"
] as const

export const META_FIELDS = [
Expand All @@ -89,4 +92,5 @@ export const META_FIELD_ALIAS: {
[K in keyof Meta]?: ConditionalKeys<Meta, Meta[K]>
} = {
runAt: "run-at",
injectInto: "inject-into",
}
11 changes: 6 additions & 5 deletions tests/cases/basic/__snapshots__/basic.test.ts/build-1.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// ==UserScript==
// @name Hello world
// @grant GM_log
// @match *://*/*
// @version 1.0.0
// @run-at document-end
// @name Hello world
// @grant GM_log
// @match *://*/*
// @version 1.0.0
// @run-at document-end
// @inject-into content
// ==/UserScript==

;(() => {
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/basic/meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ module.exports = {
name: "Hello world",
version: "1.0.0",
match: ["*://*/*"],
'run-at': "document-start",
runAt: "document-end",
'inject-into': "content"
}

0 comments on commit e181535

Please sign in to comment.