diff --git a/src/__tests__/__snapshots__/script-with-type.expected/auto.marko b/src/__tests__/__snapshots__/script-with-type.expected/auto.marko index dc82cd2..14ad8ae 100644 --- a/src/__tests__/__snapshots__/script-with-type.expected/auto.marko +++ b/src/__tests__/__snapshots__/script-with-type.expected/auto.marko @@ -8,3 +8,19 @@ ] } + + + + + diff --git a/src/__tests__/__snapshots__/script-with-type.expected/concise.marko b/src/__tests__/__snapshots__/script-with-type.expected/concise.marko index 077b6d7..4b0bce0 100644 --- a/src/__tests__/__snapshots__/script-with-type.expected/concise.marko +++ b/src/__tests__/__snapshots__/script-with-type.expected/concise.marko @@ -9,3 +9,20 @@ script nonce=$global.cspNonce type="speculationrules" ] } -- + +script type="application/json" + -- + { "hello": ${JSON.stringify( + world, + )}, "and-a-lot-more": "stuff-in-here-to-line-break" } + -- +script type="application/json" + -- + { + "hello": 345873495873985893, + "and-a-lot-more": "stuff-in-here-to-line-break" + } + -- + +script type="unknown" + -- ${foo} diff --git a/src/__tests__/__snapshots__/script-with-type.expected/html.marko b/src/__tests__/__snapshots__/script-with-type.expected/html.marko index dc82cd2..14ad8ae 100644 --- a/src/__tests__/__snapshots__/script-with-type.expected/html.marko +++ b/src/__tests__/__snapshots__/script-with-type.expected/html.marko @@ -8,3 +8,19 @@ ] } + + + + + diff --git a/src/__tests__/__snapshots__/script-with-type.expected/with-parens.marko b/src/__tests__/__snapshots__/script-with-type.expected/with-parens.marko index dc82cd2..14ad8ae 100644 --- a/src/__tests__/__snapshots__/script-with-type.expected/with-parens.marko +++ b/src/__tests__/__snapshots__/script-with-type.expected/with-parens.marko @@ -8,3 +8,19 @@ ] } + + + + + diff --git a/src/__tests__/fixtures/script-with-type.marko b/src/__tests__/fixtures/script-with-type.marko index 92dcfc9..2c90b0b 100644 --- a/src/__tests__/fixtures/script-with-type.marko +++ b/src/__tests__/fixtures/script-with-type.marko @@ -6,3 +6,8 @@ }] } + + + + + diff --git a/src/index.ts b/src/index.ts index a008d01..b91c0da 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1274,6 +1274,7 @@ function getScriptParser(tag: types.MarkoTag) { return scriptParser; case "importmap": case "speculationrules": + case "application/json": return "json"; default: return false;