Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade development Node.js and dependent packages to the latest version #351

Merged
merged 9 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ jobs:
name: node
version: '14.21'
steps:
- prepare
- lint
- prepare:
force: true
- test

test-node16:
executor:
name: node
version: '16.19'
version: '16.20'
steps:
- prepare
- lint
Expand All @@ -125,7 +125,7 @@ jobs:
test-node18:
executor:
name: node
version: '18.16.0' # Specify LTS version for development
version: '18.17.0' # Specify LTS version for development
steps:
- prepare
- lint
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.16.0
18.17.0
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## [Unreleased]

### Changed

- Upgrade Node.js and dependent packages to the latest version ([#351](https://github.com/marp-team/marp-core/pull/351))

## v3.7.0 - 2023-06-09

### Changed
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ You can control details of behavior by passing `object`.
- **`slugifier`**: _`function`_ - Set the custom slugifier function.
- **`postSlugify`**: _`function`_ - Set the post-process function after generated a slug. The function takes 2 arguments, the string of generated slug and the index of the same slug, and must return a string for assigning to `id` attribute of the heading.

By default, Marp Core applies the post-process to avoid assigning duplicated `id`s in the document: `` (slug, index) => (index > 0 ? `${slug}-${index}` : slug) ``
By default, Marp Core applies the post-process to avoid assigning duplicated `id`s in the document: ``(slug, index) => (index > 0 ? `${slug}-${index}` : slug)``

Assigning the custom post-process function is also helpful to append the custom prefix and suffix to the generated slug: `` (slug, i) => `prefix:${slug}:${i}` ``

Expand Down
12 changes: 0 additions & 12 deletions marp.config.js

This file was deleted.

13 changes: 13 additions & 0 deletions marp.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import path from 'node:path'

const dirname = path.dirname(new URL(import.meta.url).pathname)

export default {
engine: path.join(dirname, './lib/marp.js'),
server: true,
inputDir: path.join(dirname, './sandbox'),
html: true,
options: {
minifyCSS: false,
},
}
49 changes: 24 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,66 +62,65 @@
},
"nodemonConfig": {
"watch": "./lib",
"exec": "./node_modules/.bin/marp"
"exec": "npx @marp-team/marp-cli@latest -y"
},
"devDependencies": {
"@marp-team/marp-cli": "^2.5.0",
"@rollup/plugin-alias": "^5.0.0",
"@rollup/plugin-commonjs": "^25.0.0",
"@rollup/plugin-commonjs": "^25.0.3",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.1.0",
"@rollup/plugin-replace": "^5.0.2",
"@rollup/plugin-terser": "^0.4.3",
"@rollup/plugin-typescript": "^11.1.1",
"@tsconfig/node12": "^1.0.11",
"@rollup/plugin-typescript": "^11.1.2",
"@tsconfig/node12": "^12.1.0",
"@twemoji/api": "^14.1.2",
"@types/jest": "^29.5.2",
"@typescript-eslint/eslint-plugin": "^5.59.9",
"@typescript-eslint/parser": "^5.59.9",
"@types/jest": "^29.5.3",
"@typescript-eslint/eslint-plugin": "^6.2.1",
"@typescript-eslint/parser": "^6.2.1",
"autoprefixer": "^10.4.14",
"cheerio": "^1.0.0-rc.12",
"cssnano": "^6.0.1",
"emoji-regex": "^10.2.1",
"eslint": "^8.42.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "^27.2.1",
"eslint": "^8.46.0",
"eslint-config-prettier": "^8.9.0",
"eslint-plugin-import": "^2.28.0",
"eslint-plugin-jest": "^27.2.3",
"github-markdown-css": "^5.2.0",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"jest": "^29.6.2",
"jest-environment-jsdom": "^29.6.2",
"jest-junit": "^16.0.0",
"jest-plugin-context": "^2.9.0",
"markdown-it": "^13.0.1",
"markdown-it-emoji": "^2.0.2",
"mkdirp": "^3.0.1",
"nodemon": "^2.0.22",
"nodemon": "^3.0.1",
"npm-run-all": "^4.1.5",
"postcss-minify-params": "^6.0.0",
"postcss-minify-selectors": "^6.0.0",
"postcss-normalize-whitespace": "^6.0.0",
"postcss-url": "^10.1.3",
"prettier": "^2.8.8",
"prettier": "^3.0.0",
"rimraf": "^5.0.1",
"rollup": "^3.24.0",
"rollup": "^3.27.0",
"rollup-plugin-postcss": "^4.0.2",
"rollup-plugin-string": "^3.0.0",
"sass": "^1.63.3",
"sass": "^1.64.2",
"sass-extended-importer": "^0.4.2",
"self-closing-tags": "^1.0.1",
"stylelint": "^15.7.0",
"stylelint": "^15.10.2",
"stylelint-config-prettier": "^9.0.5",
"stylelint-config-standard-scss": "^9.0.0",
"ts-jest": "29.1.0",
"tslib": "^2.5.3",
"typescript": "^5.1.3"
"stylelint-config-standard-scss": "^10.0.0",
"ts-jest": "29.1.1",
"tslib": "^2.6.1",
"typescript": "^5.1.6"
},
"dependencies": {
"@marp-team/marpit": "^2.5.0",
"@marp-team/marpit-svg-polyfill": "^2.1.0",
"highlight.js": "^11.8.0",
"katex": "^0.16.7",
"katex": "^0.16.8",
"mathjax-full": "^3.2.2",
"postcss": "^8.4.21",
"postcss": "^8.4.27",
"postcss-selector-parser": "^6.0.13",
"xss": "^1.0.14"
},
Expand Down
2 changes: 1 addition & 1 deletion rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const prebundlePlugins = () => [
find: 'browserslist',
replacement: path.resolve(
__dirname,
'src/prebundles/mocks/browserslist.ts'
'src/prebundles/mocks/browserslist.ts',
),
},
],
Expand Down
4 changes: 3 additions & 1 deletion scripts/postcss-optimize-default-theme.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ const plugin = () => {
if (normalizedTagName === 'section') {
tag.parent.insertAfter(
tag,
postcssSelectorParser.pseudo({ value: ':where(.invert)' })
postcssSelectorParser.pseudo({
value: ':where(.invert)',
}),
)
}
})
Expand Down
2 changes: 1 addition & 1 deletion src/auto-scaling/code-block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const codeBlockPlugin = marpitPlugin((md) => {
'<pre is="marp-pre" data-auto-scaling="downscale-only"' +
start.slice(4) +
content +
end
end,
)
}

Expand Down
4 changes: 2 additions & 2 deletions src/auto-scaling/fitting-header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const fittingHeaderPlugin = marpitPlugin((md) => {
idx: any,
options: any,
env: any,
self: any
self: any,
) {
const rendered = heading_open
? heading_open.call(this, tokens, idx, options, env, self)
Expand All @@ -55,7 +55,7 @@ export const fittingHeaderPlugin = marpitPlugin((md) => {
) {
return rendered.replace(
new RegExp(`<${tag}`, 'i'),
`<${tag} is="marp-${tag}" data-auto-scaling`
`<${tag} is="marp-${tag}" data-auto-scaling`,
)
}

Expand Down
2 changes: 1 addition & 1 deletion src/auto-scaling/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import { codeBlockPlugin } from './code-block'
import { fittingHeaderPlugin } from './fitting-header'

export const markdown = marpitPlugin((md) =>
md.use(fittingHeaderPlugin).use(codeBlockPlugin)
md.use(fittingHeaderPlugin).use(codeBlockPlugin),
)
2 changes: 1 addition & 1 deletion src/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export interface MarpCoreBrowser {
export const browser = (target: ParentNode = document): MarpCoreBrowser => {
if (typeof window === 'undefined') {
throw new Error(
"Marp Core's browser script is valid only in browser context."
"Marp Core's browser script is valid only in browser context.",
)
}

Expand Down
4 changes: 2 additions & 2 deletions src/custom-elements/browser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const applyCustomElements = (target: ParentNode = document) => {
if (!defined) {
customElements.define(
marpCustomElement,
createMarpCustomElement(HTMLElement, elements[tag])
createMarpCustomElement(HTMLElement, elements[tag]),
)
}

Expand All @@ -43,7 +43,7 @@ export const applyCustomElements = (target: ParentNode = document) => {
customElements.define(
marpCustomElement,
createMarpCustomElement(proto, { style: elements[tag].style }),
{ extends: tag }
{ extends: tag },
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/custom-elements/browser/marp-auto-scaling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class MarpAutoScaling extends HTMLElement {

this.attachShadow({ mode: 'open' })
this.containerObserver = new ResizeObserver(
generateObserverCallback('containerSize')
generateObserverCallback('containerSize'),
)
this.wrapperObserver = new ResizeObserver((...args) => {
generateObserverCallback('wrapperSize')(...args)
Expand Down
2 changes: 1 addition & 1 deletion src/custom-elements/browser/marp-custom-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ type Constructor<T = {}> = new (...args: any[]) => T // eslint-disable-line @typ

export const createMarpCustomElement = <T extends Constructor<HTMLElement>>(
Base: T,
{ attrs = {}, style }: { attrs?: Record<string, string>; style?: string }
{ attrs = {}, style }: { attrs?: Record<string, string>; style?: string },
) =>
class MarpCustomElement extends Base {
shadowRoot!: ShadowRoot
Expand Down
4 changes: 2 additions & 2 deletions src/custom-elements/postcss-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { elements } from './definitions'

const findClosest = (
container: Container | undefined,
finder: (container: Container) => boolean
finder: (container: Container) => boolean,
) => {
let current: Container | undefined = container

Expand All @@ -28,7 +28,7 @@ export const customElementsPostCSSPlugin = (root: Root) => {
// Check if there is inside of a valid pseudo element
const closestPseudo = findClosest(
tag.parent,
({ type }) => type === 'pseudo'
({ type }) => type === 'pseudo',
)
if (closestPseudo?.value === '::part') return

Expand Down
14 changes: 7 additions & 7 deletions src/emoji/emoji.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ export const markdown = marpitPlugin((md) => {
after: (_, __, rule) => (picker.rule = rule), // for markdown-it-emoji >= v2.0.1
},
},
renderer: { rules: { emoji: () => {} } }, // eslint-disable-line @typescript-eslint/no-empty-function
rule: (() => {}) as (...args: any[]) => void, // eslint-disable-line @typescript-eslint/no-empty-function
renderer: { rules: { emoji: () => {} } },
rule: (() => {}) as (...args: any[]) => void,
utils: md.utils,
}

Expand Down Expand Up @@ -96,8 +96,8 @@ export const markdown = marpitPlugin((md) => {
type: idx % 2 ? 'marp_unicode_emoji' : 'text',
}),
],
[]
)
[],
),
)
} else {
newChildren.push(t)
Expand All @@ -111,7 +111,7 @@ export const markdown = marpitPlugin((md) => {

md.renderer.rules.marp_unicode_emoji = (
token: any[],
idx: number
idx: number,
): string => token[idx].content

const { code_block, code_inline, fence } = md.renderer.rules
Expand All @@ -126,10 +126,10 @@ export const markdown = marpitPlugin((md) => {
idx % 2
? part
: part.replace(regexForSplit, ([emoji]) =>
twemojiParse(emoji)
twemojiParse(emoji),
)
}`,
''
'',
)

md.renderer.rules.marp_unicode_emoji = twemojiRenderer
Expand Down
2 changes: 1 addition & 1 deletion src/html/html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export function markdown(md): void {
allowList[tag] = attrs
} else if (typeof attrs === 'object') {
allowList[tag] = Object.keys(attrs).filter(
(attr) => attrs[attr] !== false
(attr) => attrs[attr] !== false,
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/math/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const contextSymbol = Symbol('marp-math-context')

export const setMathContext = (
target: any,
setter: (current: MathContext) => MathContext
setter: (current: MathContext) => MathContext,
) => {
if (!Object.prototype.hasOwnProperty.call(target, contextSymbol)) {
Object.defineProperty(target, contextSymbol, { writable: true })
Expand Down
4 changes: 2 additions & 2 deletions src/math/katex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const block = (marpit: any) => (tokens, idx) => {
if (marpit.options.inlineSVG) {
rendered = rendered.replace(
/^<span/i,
'<span is="marp-span" data-auto-scaling="downscale-only"'
'<span is="marp-span" data-auto-scaling="downscale-only"',
)
}

Expand All @@ -65,6 +65,6 @@ export const css = (path?: string | false): string => {
convertedCSS[fontPath] ||
katexScss.replace(
katexMatcher,
(_, matched) => `url('${fontPath}${matched}')`
(_, matched) => `url('${fontPath}${matched}')`,
))
}
6 changes: 3 additions & 3 deletions src/math/math.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const markdown = marpitPlugin((md) => {
}

const parseWithMath = <F extends (this: any, ...args: any[]) => any>(
func: F
func: F,
) => {
return function (this: ThisType<F>, ...args: Parameters<F>) {
const initialized = initializeMathContext()
Expand Down Expand Up @@ -95,7 +95,7 @@ export const markdown = marpitPlugin((md) => {

return ret
},
{ alt: ['paragraph', 'reference', 'blockquote', 'list'] }
{ alt: ['paragraph', 'reference', 'blockquote', 'list'] },
)

// Renderer
Expand All @@ -116,7 +116,7 @@ export const markdown = marpitPlugin((md) => {
lib: preffered ?? parsedOpts.lib ?? defaultLibrary,
},
}))
}
},
)

const getPreferredLibrary = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/math/mathjax.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const block = (marpit: any) =>
return `<p>${content}</p>`
}
},
{ scaled: true }
{ scaled: true },
)

export const css = (marpit: any) => context(marpit).css + '\n' + mathjaxScss
Loading