Skip to content

Commit

Permalink
chore(deps): update dependency prismjs to ^1.29.0 for gatsby-remark-p…
Browse files Browse the repository at this point in the history
…rismjs (#37191)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: LekoArts <lekoarts@gmail.com>
  • Loading branch information
renovate[bot] and LekoArts authored Dec 9, 2022
1 parent 3457489 commit dc3d741
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 70 deletions.
2 changes: 1 addition & 1 deletion packages/gatsby-remark-prismjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"babel-preset-gatsby-package": "^3.4.0-next.0",
"cheerio": "^1.0.0-rc.10",
"cross-env": "^7.0.3",
"prismjs": "^1.21.0",
"prismjs": "^1.29.0",
"remark": "^13.0.0"
},
"peerDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ exports[`highlight code and lines with PrismJS for language jsx 1`] = `
<span class=\\"token keyword\\">class</span> <span class=\\"token class-name\\">Counter</span> <span class=\\"token keyword\\">extends</span> <span class=\\"token class-name\\">React<span class=\\"token punctuation\\">.</span>Component</span> <span class=\\"token punctuation\\">{</span>
<span class=\\"token function\\">constructor</span><span class=\\"token punctuation\\">(</span><span class=\\"token punctuation\\">)</span> <span class=\\"token punctuation\\">{</span>
<span class=\\"token keyword\\">super</span><span class=\\"token punctuation\\">(</span><span class=\\"token punctuation\\">)</span>
<span class=\\"token keyword\\">this</span><span class=\\"token punctuation\\">.</span>state <span class=\\"token operator\\">=</span> <span class=\\"token punctuation\\">{</span> count<span class=\\"token operator\\">:</span> <span class=\\"token number\\">0</span> <span class=\\"token punctuation\\">}</span>
<span class=\\"token keyword\\">this</span><span class=\\"token punctuation\\">.</span>state <span class=\\"token operator\\">=</span> <span class=\\"token punctuation\\">{</span> <span class=\\"token literal-property property\\">count</span><span class=\\"token operator\\">:</span> <span class=\\"token number\\">0</span> <span class=\\"token punctuation\\">}</span>
<span class=\\"token punctuation\\">}</span>
<span class=\\"token function\\">render</span><span class=\\"token punctuation\\">(</span><span class=\\"token punctuation\\">)</span> <span class=\\"token punctuation\\">{</span>
<span class=\\"token keyword\\">return</span> <span class=\\"token punctuation\\">(</span>
<span class=\\"gatsby-highlight-code-line\\"> <span class=\\"token tag\\"><span class=\\"token tag\\"><span class=\\"token punctuation\\">&lt;</span>div</span><span class=\\"token punctuation\\">></span></span><span class=\\"token plain-text\\"></span></span><span class=\\"gatsby-highlight-code-line\\"><span class=\\"token plain-text\\"> </span><span class=\\"token tag\\"><span class=\\"token tag\\"><span class=\\"token punctuation\\">&lt;</span>h1</span><span class=\\"token punctuation\\">></span></span><span class=\\"token plain-text\\">Counter</span><span class=\\"token tag\\"><span class=\\"token tag\\"><span class=\\"token punctuation\\">&lt;/</span>h1</span><span class=\\"token punctuation\\">></span></span><span class=\\"token plain-text\\"></span></span><span class=\\"token plain-text\\"> </span><span class=\\"token tag\\"><span class=\\"token tag\\"><span class=\\"token punctuation\\">&lt;</span>p</span><span class=\\"token punctuation\\">></span></span><span class=\\"token plain-text\\">current count: </span><span class=\\"token punctuation\\">{</span><span class=\\"token keyword\\">this</span><span class=\\"token punctuation\\">.</span>state<span class=\\"token punctuation\\">.</span>count<span class=\\"token punctuation\\">}</span><span class=\\"token tag\\"><span class=\\"token tag\\"><span class=\\"token punctuation\\">&lt;/</span>p</span><span class=\\"token punctuation\\">></span></span><span class=\\"token plain-text\\"></span>
<span class=\\"gatsby-highlight-code-line\\"><span class=\\"token plain-text\\"> </span><span class=\\"token tag\\"><span class=\\"token tag\\"><span class=\\"token punctuation\\">&lt;</span>button</span> <span class=\\"token attr-name\\">onClick</span><span class=\\"token script language-javascript\\"><span class=\\"token script-punctuation punctuation\\">=</span><span class=\\"token punctuation\\">{</span><span class=\\"token punctuation\\">(</span><span class=\\"token punctuation\\">)</span> <span class=\\"token operator\\">=></span> <span class=\\"token keyword\\">this</span><span class=\\"token punctuation\\">.</span><span class=\\"token function\\">setState</span><span class=\\"token punctuation\\">(</span><span class=\\"token punctuation\\">{</span> count<span class=\\"token operator\\">:</span> <span class=\\"token keyword\\">this</span><span class=\\"token punctuation\\">.</span>state<span class=\\"token punctuation\\">.</span>count <span class=\\"token operator\\">+</span> <span class=\\"token number\\">1</span> <span class=\\"token punctuation\\">}</span><span class=\\"token punctuation\\">)</span><span class=\\"token punctuation\\">}</span></span><span class=\\"token punctuation\\">></span></span><span class=\\"token plain-text\\"></span></span><span class=\\"token plain-text\\"> plus</span>
<span class=\\"gatsby-highlight-code-line\\"><span class=\\"token plain-text\\"> </span><span class=\\"token tag\\"><span class=\\"token tag\\"><span class=\\"token punctuation\\">&lt;</span>button</span> <span class=\\"token attr-name\\">onClick</span><span class=\\"token script language-javascript\\"><span class=\\"token script-punctuation punctuation\\">=</span><span class=\\"token punctuation\\">{</span><span class=\\"token punctuation\\">(</span><span class=\\"token punctuation\\">)</span> <span class=\\"token operator\\">=></span> <span class=\\"token keyword\\">this</span><span class=\\"token punctuation\\">.</span><span class=\\"token function\\">setState</span><span class=\\"token punctuation\\">(</span><span class=\\"token punctuation\\">{</span> <span class=\\"token literal-property property\\">count</span><span class=\\"token operator\\">:</span> <span class=\\"token keyword\\">this</span><span class=\\"token punctuation\\">.</span>state<span class=\\"token punctuation\\">.</span>count <span class=\\"token operator\\">+</span> <span class=\\"token number\\">1</span> <span class=\\"token punctuation\\">}</span><span class=\\"token punctuation\\">)</span><span class=\\"token punctuation\\">}</span></span><span class=\\"token punctuation\\">></span></span><span class=\\"token plain-text\\"></span></span><span class=\\"token plain-text\\"> plus</span>
<span class=\\"token plain-text\\"> </span><span class=\\"token tag\\"><span class=\\"token tag\\"><span class=\\"token punctuation\\">&lt;/</span>button</span><span class=\\"token punctuation\\">></span></span><span class=\\"token plain-text\\"></span>
<span class=\\"token plain-text\\"> </span><span class=\\"token tag\\"><span class=\\"token tag\\"><span class=\\"token punctuation\\">&lt;</span>button</span> <span class=\\"token attr-name\\">onClick</span><span class=\\"token script language-javascript\\"><span class=\\"token script-punctuation punctuation\\">=</span><span class=\\"token punctuation\\">{</span><span class=\\"token punctuation\\">(</span><span class=\\"token punctuation\\">)</span> <span class=\\"token operator\\">=></span> <span class=\\"token keyword\\">this</span><span class=\\"token punctuation\\">.</span><span class=\\"token function\\">setState</span><span class=\\"token punctuation\\">(</span><span class=\\"token punctuation\\">{</span> count<span class=\\"token operator\\">:</span> <span class=\\"token keyword\\">this</span><span class=\\"token punctuation\\">.</span>state<span class=\\"token punctuation\\">.</span>count <span class=\\"token operator\\">-</span> <span class=\\"token number\\">1</span> <span class=\\"token punctuation\\">}</span><span class=\\"token punctuation\\">)</span><span class=\\"token punctuation\\">}</span></span><span class=\\"token punctuation\\">></span></span><span class=\\"token plain-text\\"></span>
<span class=\\"token plain-text\\"> </span><span class=\\"token tag\\"><span class=\\"token tag\\"><span class=\\"token punctuation\\">&lt;</span>button</span> <span class=\\"token attr-name\\">onClick</span><span class=\\"token script language-javascript\\"><span class=\\"token script-punctuation punctuation\\">=</span><span class=\\"token punctuation\\">{</span><span class=\\"token punctuation\\">(</span><span class=\\"token punctuation\\">)</span> <span class=\\"token operator\\">=></span> <span class=\\"token keyword\\">this</span><span class=\\"token punctuation\\">.</span><span class=\\"token function\\">setState</span><span class=\\"token punctuation\\">(</span><span class=\\"token punctuation\\">{</span> <span class=\\"token literal-property property\\">count</span><span class=\\"token operator\\">:</span> <span class=\\"token keyword\\">this</span><span class=\\"token punctuation\\">.</span>state<span class=\\"token punctuation\\">.</span>count <span class=\\"token operator\\">-</span> <span class=\\"token number\\">1</span> <span class=\\"token punctuation\\">}</span><span class=\\"token punctuation\\">)</span><span class=\\"token punctuation\\">}</span></span><span class=\\"token punctuation\\">></span></span><span class=\\"token plain-text\\"></span>
<span class=\\"token plain-text\\"> minus</span>
<span class=\\"token plain-text\\"> </span><span class=\\"token tag\\"><span class=\\"token tag\\"><span class=\\"token punctuation\\">&lt;/</span>button</span><span class=\\"token punctuation\\">></span></span><span class=\\"token plain-text\\"></span>
<span class=\\"token plain-text\\"> </span><span class=\\"token tag\\"><span class=\\"token tag\\"><span class=\\"token punctuation\\">&lt;/</span>div</span><span class=\\"token punctuation\\">></span></span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ Object {
},
"type": "html",
"value": "<div class=\\"gatsby-highlight\\" data-language=\\"js\\"><pre style=\\"counter-reset: linenumber NaN\\" class=\\"language-js line-numbers\\"><code class=\\"language-js\\"><span class=\\"token comment\\">//.foo { </span>
color<span class=\\"token operator\\">:</span> red<span class=\\"token punctuation\\">;</span>
<span class=\\"token literal-property property\\">color</span><span class=\\"token operator\\">:</span> red<span class=\\"token punctuation\\">;</span>
<span class=\\"token punctuation\\">}</span>\`</code><span aria-hidden=\\"true\\" class=\\"line-numbers-rows\\" style=\\"white-space: normal; width: auto; left: 0;\\"><span></span><span></span><span></span></span></pre></div>",
},
],
Expand Down Expand Up @@ -573,7 +573,7 @@ Object {
},
"type": "html",
"value": "<div class=\\"gatsby-highlight\\" data-language=\\"js\\"><pre style=\\"counter-reset: linenumber 4\\" class=\\"language-js line-numbers\\"><code class=\\"language-js\\"><span class=\\"token comment\\">//.foo { </span>
color<span class=\\"token operator\\">:</span> red<span class=\\"token punctuation\\">;</span>
<span class=\\"token literal-property property\\">color</span><span class=\\"token operator\\">:</span> red<span class=\\"token punctuation\\">;</span>
<span class=\\"token punctuation\\">}</span>\`</code><span aria-hidden=\\"true\\" class=\\"line-numbers-rows\\" style=\\"white-space: normal; width: auto; left: 0;\\"><span></span><span></span><span></span></span></pre></div>",
},
],
Expand Down Expand Up @@ -613,7 +613,7 @@ Object {
},
"type": "html",
"value": "<div class=\\"gatsby-highlight\\" data-language=\\"js\\"><pre class=\\"language-js\\"><code class=\\"language-js\\"><span class=\\"token comment\\">//.foo { </span>
color<span class=\\"token operator\\">:</span> red<span class=\\"token punctuation\\">;</span>
<span class=\\"token literal-property property\\">color</span><span class=\\"token operator\\">:</span> red<span class=\\"token punctuation\\">;</span>
<span class=\\"token punctuation\\">}</span>\`</code></pre></div>",
},
],
Expand Down
19 changes: 3 additions & 16 deletions packages/gatsby-remark-prismjs/src/__tests__/highlight-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,7 @@ export default Counter
const language = `text`
const code = `<button />`
expect(highlightCode(language, code, {}, [], true)).toMatch(
`&lt;button /&gt;`
)
expect(console.warn).toHaveBeenCalledWith(
`code block language not specified in markdown.`,
`applying generic code block`
`&lt;button />`
)
})

Expand All @@ -102,11 +98,7 @@ export default Counter
const highlightCode = require(`../highlight-code`)
const language = `text`
const code = `<button />`
expect(highlightCode(language, code)).toMatch(`&lt;button /&gt;`)
expect(console.warn).toHaveBeenCalledWith(
`code block or inline code language not specified in markdown.`,
`applying generic code block`
)
expect(highlightCode(language, code)).toMatch(`&lt;button />`)
})

it(`warns once per language`, () => {
Expand All @@ -121,14 +113,9 @@ export default Counter
highlightCode(language1, code1)
highlightCode(language1, code2)
highlightCode(language2, code3)
expect(console.warn).toHaveBeenCalledTimes(2)
expect(console.warn).toHaveBeenCalledTimes(1)
expect(console.warn).toHaveBeenNthCalledWith(
1,
`code block or inline code language not specified in markdown.`,
`applying generic code block`
)
expect(console.warn).toHaveBeenNthCalledWith(
2,
`unable to find prism language 'raw' for highlighting.`,
`applying generic code block`
)
Expand Down
17 changes: 3 additions & 14 deletions packages/gatsby-remark-prismjs/src/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,24 +199,13 @@ describe(`remark prism plugin`, () => {
})

describe(`warnings`, () => {
it(`warns if the language is not specified for a code block`, () => {
it(`warns if the language doesn't exist`, () => {
jest.spyOn(console, `warn`)
const code = `\`\`\`\n// Fake\n\`\`\``
const code = `\`\`\`notexist\n// Fake\n\`\`\``
const markdownAST = remark.parse(code)
plugin({ markdownAST }, { noInlineHighlight: true })
expect(console.warn).toHaveBeenCalledWith(
`code block language not specified in markdown.`,
`applying generic code block`
)
})

it(`gives a different warning if inline code can be highlighted`, () => {
jest.spyOn(console, `warn`)
const code = `\`foo bar\``
const markdownAST = remark.parse(code)
plugin({ markdownAST })
expect(console.warn).toHaveBeenCalledWith(
`code block or inline code language not specified in markdown.`,
`unable to find prism language 'notexist' for highlighting.`,
`applying generic code block`
)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ Object {
<li>
<p><a href=\\"/My%20Blog%20Post/#generating-tocs-with-code-classlanguage-textgatsby-transformer-remarkcode\\">Generating TOCs with <code class=\\"language-text\\">gatsby-transformer-remark</code></a></p>
<ul>
<li><a href=\\"/My%20Blog%20Post/#embedding-code-classlanguage-textltcodegtcode-tags\\">Embedding <code class=\\"language-text\\">&lt;code&gt;</code> Tags</a></li>
<li><a href=\\"/My%20Blog%20Post/#embedding-code-classlanguage-textltcodecode-tags\\">Embedding <code class=\\"language-text\\">&lt;code></code> Tags</a></li>
</ul>
</li>
</ul>
Expand Down
36 changes: 4 additions & 32 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7400,14 +7400,6 @@ clipanion@3.1.0:
dependencies:
typanion "^3.3.1"

clipboard@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/clipboard/-/clipboard-2.0.1.tgz#a12481e1c13d8a50f5f036b0560fe5d16d74e46a"
dependencies:
good-listener "^1.2.2"
select "^1.1.2"
tiny-emitter "^2.0.0"

clipboardy@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/clipboardy/-/clipboardy-2.3.0.tgz#3c2903650c68e46a91b388985bc2774287dba290"
Expand Down Expand Up @@ -9143,10 +9135,6 @@ delayed-stream@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619"

delegate@^3.1.2:
version "3.2.0"
resolved "https://registry.yarnpkg.com/delegate/-/delegate-3.2.0.tgz#b66b71c3158522e8ab5744f720d8ca0c2af59166"

delegates@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a"
Expand Down Expand Up @@ -11876,12 +11864,6 @@ globrex@^0.1.2:
resolved "https://registry.yarnpkg.com/globrex/-/globrex-0.1.2.tgz#dd5d9ec826232730cd6793a5e33a9302985e6098"
integrity sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==

good-listener@^1.2.2:
version "1.2.2"
resolved "https://registry.yarnpkg.com/good-listener/-/good-listener-1.2.2.tgz#d53b30cdf9313dffb7dc9a0d477096aa6d145c50"
dependencies:
delegate "^3.1.2"

gopd@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c"
Expand Down Expand Up @@ -19350,12 +19332,10 @@ printj@~1.3.0, printj@~1.3.1:
resolved "https://registry.yarnpkg.com/printj/-/printj-1.3.1.tgz#9af6b1d55647a1587ac44f4c1654a4b95b8e12cb"
integrity sha512-GA3TdL8szPK4AQ2YnOe/b+Y1jUFwmmGMMK/qbY7VcE3Z7FU8JstbKiKRzO6CIiAKPhTO8m01NoQ0V5f3jc4OGg==

prismjs@^1.21.0, prismjs@^1.23.0:
version "1.23.0"
resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.23.0.tgz#d3b3967f7d72440690497652a9d40ff046067f33"
integrity sha512-c29LVsqOaLbBHuIbsTxaKENh1N2EQBOHaWv7gkHN4dgRbxSREqDnDbtFJYdpPauS4YCplMSNCABQ6Eeor69bAA==
optionalDependencies:
clipboard "^2.0.0"
prismjs@^1.23.0, prismjs@^1.29.0:
version "1.29.0"
resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.29.0.tgz#f113555a8fa9b57c35e637bba27509dcf802dd12"
integrity sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q==

private@^0.1.8:
version "0.1.8"
Expand Down Expand Up @@ -21265,10 +21245,6 @@ section-matter@^1.0.0:
extend-shallow "^2.0.1"
kind-of "^6.0.0"

select@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/select/-/select-1.1.2.tgz#0e7350acdec80b1108528786ec1d4418d11b396d"

semver-compare@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/semver-compare/-/semver-compare-1.0.0.tgz#0dee216a1c941ab37e9efb1788f6afc5ff5537fc"
Expand Down Expand Up @@ -22911,10 +22887,6 @@ tiny-async-pool@^1.3.0:
dependencies:
semver "^5.5.0"

tiny-emitter@^2.0.0:
version "2.0.2"
resolved "https://registry.yarnpkg.com/tiny-emitter/-/tiny-emitter-2.0.2.tgz#82d27468aca5ade8e5fd1e6d22b57dd43ebdfb7c"

tiny-glob@^0.2.8:
version "0.2.8"
resolved "https://registry.yarnpkg.com/tiny-glob/-/tiny-glob-0.2.8.tgz#b2792c396cc62db891ffa161fe8b33e76123e531"
Expand Down

0 comments on commit dc3d741

Please sign in to comment.