Skip to content

Commit

Permalink
Merge pull request #229 from marp-team/upgrade-dependencies
Browse files Browse the repository at this point in the history
Upgrade dependent packages to the latest version
  • Loading branch information
yhatt authored Apr 18, 2020
2 parents b2623fe + 7fbe0f6 commit a263e1a
Show file tree
Hide file tree
Showing 69 changed files with 1,549 additions and 1,511 deletions.
3 changes: 0 additions & 3 deletions .prettierrc.yml

This file was deleted.

2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

### Changed

- Upgrade dependent packages to the latest version ([#225](https://github.com/marp-team/marpit/pull/225), [#226](https://github.com/marp-team/marpit/pull/226))
- Upgrade dependent packages to the latest version ([#225](https://github.com/marp-team/marpit/pull/225), [#226](https://github.com/marp-team/marpit/pull/226), [#229](https://github.com/marp-team/marpit/pull/229))

## v1.5.1 - 2020-03-15

Expand Down
33 changes: 17 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
"index.d.ts",
"plugin.js"
],
"prettier": {
"semi": false,
"singleQuote": true
},
"scripts": {
"build": "yarn -s clean && babel src --out-dir lib",
"check:audit": "yarn audit",
Expand All @@ -58,14 +62,14 @@
},
"devDependencies": {
"@babel/cli": "^7.8.4",
"@babel/core": "^7.8.7",
"@babel/core": "^7.9.0",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-proposal-object-rest-spread": "^7.8.3",
"@babel/plugin-proposal-object-rest-spread": "^7.9.5",
"@babel/plugin-proposal-private-methods": "^7.8.3",
"@babel/preset-env": "^7.8.7",
"autoprefixer": "^9.7.4",
"@babel/preset-env": "^7.9.5",
"autoprefixer": "^9.7.6",
"babel-eslint": "^10.1.0",
"babel-jest": "^25.1.0",
"babel-jest": "^25.3.0",
"browser-sync": "^2.26.7",
"cheerio": "^1.0.0-rc.3",
"codecov": "^3.6.5",
Expand All @@ -74,21 +78,21 @@
"docsify-themeable": "^0.8.0",
"eslint": "^6.8.0",
"eslint-config-airbnb-base": "14.1.0",
"eslint-config-prettier": "^6.10.0",
"eslint-plugin-import": "^2.20.1",
"jest": "^25.1.0",
"eslint-config-prettier": "^6.10.1",
"eslint-plugin-import": "^2.20.2",
"jest": "^25.3.0",
"jest-junit": "^10.0.0",
"jsdoc": "^3.6.3",
"jsdoc": "^3.6.4",
"minami": "^1.2.3",
"nodemon": "^2.0.2",
"nodemon": "^2.0.3",
"npm-run-all": "^4.1.5",
"prettier": "^1.19.1",
"prettier": "^2.0.4",
"rimraf": "^3.0.2",
"sass": "1.26.3",
"stylelint": "^13.2.1",
"stylelint": "^13.3.2",
"stylelint-config-prettier": "^8.0.1",
"stylelint-config-standard": "^20.0.0",
"stylelint-scss": "^3.15.0"
"stylelint-scss": "^3.17.0"
},
"dependencies": {
"color-string": "^1.5.3",
Expand All @@ -98,9 +102,6 @@
"markdown-it-front-matter": "^0.2.1",
"postcss": "^7.0.27"
},
"resolutions": {
"**/gonzales-pe/minimist": "^1.2.5"
},
"publishConfig": {
"access": "public"
}
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/inline_style.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default class InlineStyle {
) {
const root = postcss.parse(initialDecls.toString(), { from: undefined })

root.each(node => {
root.each((node) => {
if (node.type === 'decl') this.decls[node.prop] = node.value
})
} else {
Expand Down Expand Up @@ -78,7 +78,7 @@ export default class InlineStyle {
}

if (parsed) {
parsed.each(node => {
parsed.each((node) => {
if (node.type !== 'decl' || node.prop !== prop) node.remove()
})

Expand Down
2 changes: 1 addition & 1 deletion src/helpers/wrap_array.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @param {*} valOrArr
* @return {Array}
*/
const wrapArray = valOrArr => {
const wrapArray = (valOrArr) => {
if (valOrArr == null || valOrArr === false) return []
if (valOrArr instanceof Array) return valOrArr
return [valOrArr]
Expand Down
2 changes: 1 addition & 1 deletion src/markdown/background_image/advanced.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function advancedBackground(md) {
md.core.ruler.after(
'marpit_directives_apply',
'marpit_advanced_background',
state => {
(state) => {
let current
const newTokens = []

Expand Down
4 changes: 2 additions & 2 deletions src/markdown/collect.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import marpitPlugin from '../plugin'
function collect(md) {
const { marpit } = md

md.core.ruler.push('marpit_collect', state => {
md.core.ruler.push('marpit_collect', (state) => {
if (state.inlineMode) return

marpit.lastComments = []
Expand All @@ -24,7 +24,7 @@ function collect(md) {
let currentPage
let pageIdx = -1

const collectComment = token => {
const collectComment = (token) => {
if (
currentPage >= 0 &&
!(token.meta && token.meta.marpitCommentParsed !== undefined)
Expand Down
2 changes: 1 addition & 1 deletion src/markdown/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function container(md) {

const target = [...containers].reverse()

md.core.ruler.push('marpit_containers', state => {
md.core.ruler.push('marpit_containers', (state) => {
if (state.inlineMode) return

for (const cont of target)
Expand Down
2 changes: 1 addition & 1 deletion src/markdown/directives/apply.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function apply(md, opts = {}) {
md.core.ruler.after(
'marpit_directives_parse',
'marpit_directives_apply',
state => {
(state) => {
if (state.inlineMode) return

for (const token of state.tokens) {
Expand Down
28 changes: 14 additions & 14 deletions src/markdown/directives/directives.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@
* @prop {Directive} theme Specify theme of the slide deck.
*/
export const globals = Object.assign(Object.create(null), {
headingDivider: value => {
headingDivider: (value) => {
const headings = [1, 2, 3, 4, 5, 6]
const toInt = v =>
const toInt = (v) =>
Array.isArray(v) || Number.isNaN(v) ? v : Number.parseInt(v, 10)
const converted = toInt(value)

if (Array.isArray(converted)) {
const convertedArr = converted.map(toInt)
return {
headingDivider: headings.filter(v => convertedArr.includes(v)),
headingDivider: headings.filter((v) => convertedArr.includes(v)),
}
}

Expand All @@ -39,7 +39,7 @@ export const globals = Object.assign(Object.create(null), {

return {}
},
style: v => ({ style: v }),
style: (v) => ({ style: v }),
theme: (v, marpit) => (marpit.themeSet.has(v) ? { theme: v } : {}),
})

Expand Down Expand Up @@ -69,16 +69,16 @@ export const globals = Object.assign(Object.create(null), {
* @prop {Directive} paginate Show page number on the slide if you set `true`.
*/
export const locals = Object.assign(Object.create(null), {
backgroundColor: v => ({ backgroundColor: v }),
backgroundImage: v => ({ backgroundImage: v }),
backgroundPosition: v => ({ backgroundPosition: v }),
backgroundRepeat: v => ({ backgroundRepeat: v }),
backgroundSize: v => ({ backgroundSize: v }),
class: v => ({ class: Array.isArray(v) ? v.join(' ') : v }),
color: v => ({ color: v }),
footer: v => (typeof v === 'string' ? { footer: v } : {}),
header: v => (typeof v === 'string' ? { header: v } : {}),
paginate: v => ({ paginate: (v || '').toLowerCase() === 'true' }),
backgroundColor: (v) => ({ backgroundColor: v }),
backgroundImage: (v) => ({ backgroundImage: v }),
backgroundPosition: (v) => ({ backgroundPosition: v }),
backgroundRepeat: (v) => ({ backgroundRepeat: v }),
backgroundSize: (v) => ({ backgroundSize: v }),
class: (v) => ({ class: Array.isArray(v) ? v.join(' ') : v }),
color: (v) => ({ color: v }),
footer: (v) => (typeof v === 'string' ? { footer: v } : {}),
header: (v) => (typeof v === 'string' ? { header: v } : {}),
paginate: (v) => ({ paginate: (v || '').toLowerCase() === 'true' }),
})

export default [...Object.keys(globals), ...Object.keys(locals)]
14 changes: 7 additions & 7 deletions src/markdown/directives/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as directives from './directives'
import { markAsParsed } from '../comment'
import marpitPlugin from '../../plugin'

const isDirectiveComment = token =>
const isDirectiveComment = (token) =>
token.type === 'marpit_comment' && token.meta.marpitParsedDirectives

/**
Expand Down Expand Up @@ -43,11 +43,11 @@ function parse(md, opts = {}) {
let frontMatterObject = {}

if (frontMatter) {
md.core.ruler.before('block', 'marpit_directives_front_matter', state => {
md.core.ruler.before('block', 'marpit_directives_front_matter', (state) => {
frontMatterObject = {}
if (!state.inlineMode) marpit.lastGlobalDirectives = {}
})
md.use(MarkdownItFrontMatter, fm => {
md.use(MarkdownItFrontMatter, (fm) => {
frontMatterObject.text = fm

const parsed = yaml(
Expand All @@ -64,11 +64,11 @@ function parse(md, opts = {}) {
}

// Parse global directives
md.core.ruler.after('inline', 'marpit_directives_global_parse', state => {
md.core.ruler.after('inline', 'marpit_directives_global_parse', (state) => {
if (state.inlineMode) return

let globalDirectives = {}
const applyDirectives = obj => {
const applyDirectives = (obj) => {
let recognized = false

for (const key of Object.keys(obj)) {
Expand Down Expand Up @@ -116,13 +116,13 @@ function parse(md, opts = {}) {
})

// Parse local directives and apply meta to slide
md.core.ruler.after('marpit_slide', 'marpit_directives_parse', state => {
md.core.ruler.after('marpit_slide', 'marpit_directives_parse', (state) => {
if (state.inlineMode) return

const slides = []
const cursor = { slide: undefined, local: {}, spot: {} }

const applyDirectives = obj => {
const applyDirectives = (obj) => {
let recognized = false

for (const key of Object.keys(obj)) {
Expand Down
2 changes: 1 addition & 1 deletion src/markdown/directives/yaml.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import YAML, { FAILSAFE_SCHEMA } from 'js-yaml'
import directives from './directives'

const createPatterns = keys => {
const createPatterns = (keys) => {
const set = new Set()

for (const k of keys) {
Expand Down
4 changes: 2 additions & 2 deletions src/markdown/fragment.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const fragmentedListMarkups = ['*', ')']
*/
function fragment(md) {
// Fragmented list
md.core.ruler.after('marpit_directives_parse', 'marpit_fragment', state => {
md.core.ruler.after('marpit_directives_parse', 'marpit_fragment', (state) => {
if (state.inlineMode) return

for (const token of state.tokens) {
Expand All @@ -26,7 +26,7 @@ function fragment(md) {
})

// Add data-marpit-fragment(s) attributes to token
md.core.ruler.after('marpit_fragment', 'marpit_apply_fragment', state => {
md.core.ruler.after('marpit_fragment', 'marpit_apply_fragment', (state) => {
if (state.inlineMode) return

const fragments = { slide: undefined, count: 0 }
Expand Down
4 changes: 2 additions & 2 deletions src/markdown/header_and_footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ function headerAndFooter(md) {
md.core.ruler.after(
'marpit_directives_apply',
'marpit_header_and_footer',
state => {
(state) => {
if (state.inlineMode) return

const parsedInlines = new Map()
const getParsed = markdown => {
const getParsed = (markdown) => {
let parsed = parsedInlines.get(markdown)

if (!parsed) {
Expand Down
11 changes: 6 additions & 5 deletions src/markdown/heading_divider.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import split from '../helpers/split'
function headingDivider(md) {
const { marpit } = md

md.core.ruler.before('marpit_slide', 'marpit_heading_divider', state => {
md.core.ruler.before('marpit_slide', 'marpit_heading_divider', (state) => {
let target = marpit.options.headingDivider

if (
Expand All @@ -29,18 +29,19 @@ function headingDivider(md) {
if (state.inlineMode || target === false) return

if (Number.isInteger(target) && target >= 1 && target <= 6)
target = [...Array(target).keys()].map(i => i + 1)
target = [...Array(target).keys()].map((i) => i + 1)

if (!Array.isArray(target)) return

const splitTag = target.map(i => `h${i}`)
const splitFunc = t => t.type === 'heading_open' && splitTag.includes(t.tag)
const splitTag = target.map((i) => `h${i}`)
const splitFunc = (t) =>
t.type === 'heading_open' && splitTag.includes(t.tag)
const newTokens = []

for (const slideTokens of split(state.tokens, splitFunc, true)) {
const [token] = slideTokens

if (token && splitFunc(token) && newTokens.some(t => !t.hidden)) {
if (token && splitFunc(token) && newTokens.some((t) => !t.hidden)) {
const hr = new state.Token('hr', '', 0)
hr.hidden = true
hr.map = token.map
Expand Down
Loading

0 comments on commit a263e1a

Please sign in to comment.