Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: FormidableLabs/prism-react-renderer
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.3.1
Choose a base ref
...
head repository: FormidableLabs/prism-react-renderer
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.3.3
Choose a head ref
  • 6 commits
  • 3 files changed
  • 1 contributor

Commits on May 16, 2022

  1. Copy the full SHA
    d488c19 View commit details
  2. Merge pull request #151 from FormidableLabs/jp-language-order

    account for optional dependencies in Prism vendor script
    jpdriver authored May 16, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    8698d3a View commit details
  3. v1.3.2

    jpdriver committed May 16, 2022
    Copy the full SHA
    098580a View commit details
  4. Copy the full SHA
    bfe86f3 View commit details
  5. Merge pull request #153 from FormidableLabs/jp-markup-templating

    add markup-templating to includedLangs
    jpdriver authored May 16, 2022
    Copy the full SHA
    656530c View commit details
  6. v1.3.3

    jpdriver committed May 16, 2022
    Copy the full SHA
    b30cd37 View commit details
Showing with 17 additions and 22 deletions.
  1. +1 −1 package.json
  2. +1 −0 src/vendor/prism/includeLangs.js
  3. +15 −21 src/vendor/prism/index.js
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "prism-react-renderer",
"version": "1.3.1",
"version": "1.3.3",
"description": "Renders highlighted Prism output using React",
"sideEffects": false,
"main": "dist/index.cjs.js",
1 change: 1 addition & 0 deletions src/vendor/prism/includeLangs.js
Original file line number Diff line number Diff line change
@@ -20,6 +20,7 @@ module.exports = {
git: true,
go: true,
graphql: true,
"markup-templating": true,
handlebars: true,
json: true,
less: true,
36 changes: 15 additions & 21 deletions src/vendor/prism/index.js
Original file line number Diff line number Diff line change
@@ -11,15 +11,10 @@ codegen`
const { languages } = require('prismjs/components')
const prismPath = dirname(require.resolve('prismjs'))
let output = '/* This content is auto-generated to include some prismjs language components: */\\n'
const toDependencies = arr => {
if (typeof arr === 'string') {
return [arr]
}
// This json defines which languages to include
const includedLangs = require('./includeLangs')
return arr;
};
let output = '/* This content is auto-generated to include some prismjs language components: */\\n'
const addLanguageToOutput = language => {
const pathToLanguage = 'components/prism-' + language
@@ -39,15 +34,17 @@ codegen`
visitedLanguages[language] = true
}
// Required dependencies come before the actual language
const required = toDependencies(langEntry.require)
if (Array.isArray(required)) {
required.forEach(x => {
if (languages[x]) {
visitLanguage(x, languages[x])
} else {
console.warn('[prismjs/components]: Language', x, 'does not exist!')
// Required + optional dependencies come before the actual language
const dependencies = [].concat(langEntry.require).concat(langEntry.optional).filter(f => f)
if (dependencies.length > 0) {
dependencies.forEach(x => {
if (includedLangs[x]) {
if (languages[x]) {
visitLanguage(x, languages[x])
} else {
console.warn('[prismjs/components]: Language', x, 'does not exist!')
}
}
})
}
@@ -56,7 +53,7 @@ codegen`
addLanguageToOutput(language)
// Peer dependencies come after the actual language
const peerDependencies = toDependencies(langEntry.peerDependencies)
const peerDependencies = [].concat(langEntry.peerDependencies).filter(f => f)
if (Array.isArray(peerDependencies)) {
peerDependencies.forEach(x => {
@@ -69,9 +66,6 @@ codegen`
}
};
// This json defines which languages to include
const includedLangs = require('./includeLangs')
Object.keys(includedLangs).forEach(language => {
visitLanguage(language, languages[language])
})