From e3c09c87d8eea787ede940c874ee57df31258efe Mon Sep 17 00:00:00 2001 From: Yuki Hattori Date: Sat, 31 Aug 2024 20:11:07 +0900 Subject: [PATCH 1/3] Use `@csstools/postcss-minify` for minify CSS --- package-lock.json | 30 +++++++- package.json | 4 +- src/marp.ts | 4 +- test/__snapshots__/marp.ts.snap | 120 ++++++++++++++++---------------- test/marp.ts | 9 ++- 5 files changed, 94 insertions(+), 73 deletions(-) diff --git a/package-lock.json b/package-lock.json index a7de277f..ee335c9e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,6 +19,7 @@ "xss": "^1.0.15" }, "devDependencies": { + "@csstools/postcss-minify": "^2.0.1", "@rollup/plugin-alias": "^5.1.0", "@rollup/plugin-commonjs": "^26.0.1", "@rollup/plugin-json": "^6.1.0", @@ -52,9 +53,6 @@ "nodemon": "^3.1.4", "npm-check-updates": "^17.1.0", "npm-run-all2": "^6.2.2", - "postcss-minify-params": "^7.0.2", - "postcss-minify-selectors": "^7.0.3", - "postcss-normalize-whitespace": "^7.0.0", "postcss-url": "^10.1.3", "prettier": "^3.3.3", "rimraf": "^6.0.1", @@ -805,6 +803,32 @@ "postcss": "^8.4" } }, + "node_modules/@csstools/postcss-minify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@csstools/postcss-minify/-/postcss-minify-2.0.1.tgz", + "integrity": "sha512-LcVHjHhI0DjMRzW73EHxICIgp1JNQV7H2ucTRZzxWOdWP+ODRz+bzcwo2HdtG7jvqMYKSpkxXhikhnYGFWMUxg==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT-0", + "dependencies": { + "@csstools/css-tokenizer": "^3.0.1" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "postcss": "^8.4" + } + }, "node_modules/@csstools/selector-resolve-nested": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@csstools/selector-resolve-nested/-/selector-resolve-nested-2.0.0.tgz", diff --git a/package.json b/package.json index 264f02d8..cf0cac8b 100644 --- a/package.json +++ b/package.json @@ -65,6 +65,7 @@ "exec": "npx @marp-team/marp-cli@latest -y" }, "devDependencies": { + "@csstools/postcss-minify": "^2.0.1", "@rollup/plugin-alias": "^5.1.0", "@rollup/plugin-commonjs": "^26.0.1", "@rollup/plugin-json": "^6.1.0", @@ -98,9 +99,6 @@ "nodemon": "^3.1.4", "npm-check-updates": "^17.1.0", "npm-run-all2": "^6.2.2", - "postcss-minify-params": "^7.0.2", - "postcss-minify-selectors": "^7.0.3", - "postcss-normalize-whitespace": "^7.0.0", "postcss-url": "^10.1.3", "prettier": "^3.3.3", "rimraf": "^6.0.1", diff --git a/src/marp.ts b/src/marp.ts index 4f72835b..f10b7871 100644 --- a/src/marp.ts +++ b/src/marp.ts @@ -1,3 +1,4 @@ +import postcssMinify from '@csstools/postcss-minify' import { Marpit, Options, ThemeSetPackOptions } from '@marp-team/marpit' import type { HLJSApi } from 'highlight.js' import postcss, { AcceptedPlugin } from 'postcss' @@ -10,7 +11,6 @@ import * as emojiPlugin from './emoji/emoji' import { generateHighlightJSInstance } from './highlightjs' import * as htmlPlugin from './html/html' import * as mathPlugin from './math/math' -import minifyPlugins from './prebundles/postcss-minify-plugins' import * as scriptPlugin from './script/script' import * as sizePlugin from './size/size' import * as slugPlugin from './slug/slug' @@ -116,7 +116,7 @@ export class Marp extends Marpit { const original = super.renderStyle(theme) const postprocessorPlugins: AcceptedPlugin[] = [ customElements.css, - ...(this.options.minifyCSS ? minifyPlugins : []), + ...(this.options.minifyCSS ? [postcssMinify()] : []), ] const postprocessor = postcss(postprocessorPlugins) diff --git a/test/__snapshots__/marp.ts.snap b/test/__snapshots__/marp.ts.snap index 46fbc863..b7453c8d 100644 --- a/test/__snapshots__/marp.ts.snap +++ b/test/__snapshots__/marp.ts.snap @@ -2,75 +2,75 @@ exports[`Marp math option with KaTeX injects KaTeX css with replacing web font URL to CDN: katex-css-cdn 1`] = ` [ - "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_AMS-Regular.woff2') format("woff2"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_AMS-Regular.woff') format("woff"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_AMS-Regular.ttf') format("truetype")", - "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Caligraphic-Bold.woff2') format("woff2"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Caligraphic-Bold.woff') format("woff"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Caligraphic-Bold.ttf') format("truetype")", - "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Caligraphic-Regular.woff2') format("woff2"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Caligraphic-Regular.woff') format("woff"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Caligraphic-Regular.ttf') format("truetype")", - "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Fraktur-Bold.woff2') format("woff2"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Fraktur-Bold.woff') format("woff"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Fraktur-Bold.ttf') format("truetype")", - "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Fraktur-Regular.woff2') format("woff2"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Fraktur-Regular.woff') format("woff"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Fraktur-Regular.ttf') format("truetype")", - "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Main-Bold.woff2') format("woff2"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Main-Bold.woff') format("woff"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Main-Bold.ttf') format("truetype")", - "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Main-BoldItalic.woff2') format("woff2"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Main-BoldItalic.woff') format("woff"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Main-BoldItalic.ttf') format("truetype")", - "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Main-Italic.woff2') format("woff2"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Main-Italic.woff') format("woff"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Main-Italic.ttf') format("truetype")", - "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Main-Regular.woff2') format("woff2"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Main-Regular.woff') format("woff"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Main-Regular.ttf') format("truetype")", - "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Math-BoldItalic.woff2') format("woff2"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Math-BoldItalic.woff') format("woff"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Math-BoldItalic.ttf') format("truetype")", - "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Math-Italic.woff2') format("woff2"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Math-Italic.woff') format("woff"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Math-Italic.ttf') format("truetype")", - "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_SansSerif-Bold.woff2') format("woff2"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_SansSerif-Bold.woff') format("woff"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_SansSerif-Bold.ttf') format("truetype")", - "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_SansSerif-Italic.woff2') format("woff2"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_SansSerif-Italic.woff') format("woff"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_SansSerif-Italic.ttf') format("truetype")", - "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_SansSerif-Regular.woff2') format("woff2"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_SansSerif-Regular.woff') format("woff"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_SansSerif-Regular.ttf') format("truetype")", - "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Script-Regular.woff2') format("woff2"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Script-Regular.woff') format("woff"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Script-Regular.ttf') format("truetype")", - "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Size1-Regular.woff2') format("woff2"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Size1-Regular.woff') format("woff"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Size1-Regular.ttf') format("truetype")", - "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Size2-Regular.woff2') format("woff2"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Size2-Regular.woff') format("woff"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Size2-Regular.ttf') format("truetype")", - "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Size3-Regular.woff2') format("woff2"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Size3-Regular.woff') format("woff"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Size3-Regular.ttf') format("truetype")", - "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Size4-Regular.woff2') format("woff2"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Size4-Regular.woff') format("woff"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Size4-Regular.ttf') format("truetype")", - "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Typewriter-Regular.woff2') format("woff2"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Typewriter-Regular.woff') format("woff"),url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Typewriter-Regular.ttf') format("truetype")", + "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_AMS-Regular.woff2') format("woff2"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_AMS-Regular.woff') format("woff"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_AMS-Regular.ttf') format("truetype")", + "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Caligraphic-Bold.woff2') format("woff2"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Caligraphic-Bold.woff') format("woff"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Caligraphic-Bold.ttf') format("truetype")", + "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Caligraphic-Regular.woff2') format("woff2"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Caligraphic-Regular.woff') format("woff"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Caligraphic-Regular.ttf') format("truetype")", + "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Fraktur-Bold.woff2') format("woff2"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Fraktur-Bold.woff') format("woff"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Fraktur-Bold.ttf') format("truetype")", + "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Fraktur-Regular.woff2') format("woff2"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Fraktur-Regular.woff') format("woff"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Fraktur-Regular.ttf') format("truetype")", + "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Main-Bold.woff2') format("woff2"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Main-Bold.woff') format("woff"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Main-Bold.ttf') format("truetype")", + "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Main-BoldItalic.woff2') format("woff2"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Main-BoldItalic.woff') format("woff"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Main-BoldItalic.ttf') format("truetype")", + "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Main-Italic.woff2') format("woff2"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Main-Italic.woff') format("woff"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Main-Italic.ttf') format("truetype")", + "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Main-Regular.woff2') format("woff2"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Main-Regular.woff') format("woff"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Main-Regular.ttf') format("truetype")", + "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Math-BoldItalic.woff2') format("woff2"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Math-BoldItalic.woff') format("woff"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Math-BoldItalic.ttf') format("truetype")", + "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Math-Italic.woff2') format("woff2"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Math-Italic.woff') format("woff"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Math-Italic.ttf') format("truetype")", + "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_SansSerif-Bold.woff2') format("woff2"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_SansSerif-Bold.woff') format("woff"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_SansSerif-Bold.ttf') format("truetype")", + "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_SansSerif-Italic.woff2') format("woff2"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_SansSerif-Italic.woff') format("woff"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_SansSerif-Italic.ttf') format("truetype")", + "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_SansSerif-Regular.woff2') format("woff2"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_SansSerif-Regular.woff') format("woff"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_SansSerif-Regular.ttf') format("truetype")", + "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Script-Regular.woff2') format("woff2"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Script-Regular.woff') format("woff"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Script-Regular.ttf') format("truetype")", + "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Size1-Regular.woff2') format("woff2"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Size1-Regular.woff') format("woff"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Size1-Regular.ttf') format("truetype")", + "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Size2-Regular.woff2') format("woff2"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Size2-Regular.woff') format("woff"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Size2-Regular.ttf') format("truetype")", + "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Size3-Regular.woff2') format("woff2"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Size3-Regular.woff') format("woff"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Size3-Regular.ttf') format("truetype")", + "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Size4-Regular.woff2') format("woff2"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Size4-Regular.woff') format("woff"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Size4-Regular.ttf') format("truetype")", + "url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Typewriter-Regular.woff2') format("woff2"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Typewriter-Regular.woff') format("woff"), url('https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/fonts/KaTeX_Typewriter-Regular.ttf') format("truetype")", ] `; exports[`Marp math option with KaTeX with katexFontPath as false does not replace KaTeX web font URL: katex-css-noops 1`] = ` [ - "url(fonts/KaTeX_AMS-Regular.woff2) format("woff2"),url(fonts/KaTeX_AMS-Regular.woff) format("woff"),url(fonts/KaTeX_AMS-Regular.ttf) format("truetype")", - "url(fonts/KaTeX_Caligraphic-Bold.woff2) format("woff2"),url(fonts/KaTeX_Caligraphic-Bold.woff) format("woff"),url(fonts/KaTeX_Caligraphic-Bold.ttf) format("truetype")", - "url(fonts/KaTeX_Caligraphic-Regular.woff2) format("woff2"),url(fonts/KaTeX_Caligraphic-Regular.woff) format("woff"),url(fonts/KaTeX_Caligraphic-Regular.ttf) format("truetype")", - "url(fonts/KaTeX_Fraktur-Bold.woff2) format("woff2"),url(fonts/KaTeX_Fraktur-Bold.woff) format("woff"),url(fonts/KaTeX_Fraktur-Bold.ttf) format("truetype")", - "url(fonts/KaTeX_Fraktur-Regular.woff2) format("woff2"),url(fonts/KaTeX_Fraktur-Regular.woff) format("woff"),url(fonts/KaTeX_Fraktur-Regular.ttf) format("truetype")", - "url(fonts/KaTeX_Main-Bold.woff2) format("woff2"),url(fonts/KaTeX_Main-Bold.woff) format("woff"),url(fonts/KaTeX_Main-Bold.ttf) format("truetype")", - "url(fonts/KaTeX_Main-BoldItalic.woff2) format("woff2"),url(fonts/KaTeX_Main-BoldItalic.woff) format("woff"),url(fonts/KaTeX_Main-BoldItalic.ttf) format("truetype")", - "url(fonts/KaTeX_Main-Italic.woff2) format("woff2"),url(fonts/KaTeX_Main-Italic.woff) format("woff"),url(fonts/KaTeX_Main-Italic.ttf) format("truetype")", - "url(fonts/KaTeX_Main-Regular.woff2) format("woff2"),url(fonts/KaTeX_Main-Regular.woff) format("woff"),url(fonts/KaTeX_Main-Regular.ttf) format("truetype")", - "url(fonts/KaTeX_Math-BoldItalic.woff2) format("woff2"),url(fonts/KaTeX_Math-BoldItalic.woff) format("woff"),url(fonts/KaTeX_Math-BoldItalic.ttf) format("truetype")", - "url(fonts/KaTeX_Math-Italic.woff2) format("woff2"),url(fonts/KaTeX_Math-Italic.woff) format("woff"),url(fonts/KaTeX_Math-Italic.ttf) format("truetype")", - "url(fonts/KaTeX_SansSerif-Bold.woff2) format("woff2"),url(fonts/KaTeX_SansSerif-Bold.woff) format("woff"),url(fonts/KaTeX_SansSerif-Bold.ttf) format("truetype")", - "url(fonts/KaTeX_SansSerif-Italic.woff2) format("woff2"),url(fonts/KaTeX_SansSerif-Italic.woff) format("woff"),url(fonts/KaTeX_SansSerif-Italic.ttf) format("truetype")", - "url(fonts/KaTeX_SansSerif-Regular.woff2) format("woff2"),url(fonts/KaTeX_SansSerif-Regular.woff) format("woff"),url(fonts/KaTeX_SansSerif-Regular.ttf) format("truetype")", - "url(fonts/KaTeX_Script-Regular.woff2) format("woff2"),url(fonts/KaTeX_Script-Regular.woff) format("woff"),url(fonts/KaTeX_Script-Regular.ttf) format("truetype")", - "url(fonts/KaTeX_Size1-Regular.woff2) format("woff2"),url(fonts/KaTeX_Size1-Regular.woff) format("woff"),url(fonts/KaTeX_Size1-Regular.ttf) format("truetype")", - "url(fonts/KaTeX_Size2-Regular.woff2) format("woff2"),url(fonts/KaTeX_Size2-Regular.woff) format("woff"),url(fonts/KaTeX_Size2-Regular.ttf) format("truetype")", - "url(fonts/KaTeX_Size3-Regular.woff2) format("woff2"),url(fonts/KaTeX_Size3-Regular.woff) format("woff"),url(fonts/KaTeX_Size3-Regular.ttf) format("truetype")", - "url(fonts/KaTeX_Size4-Regular.woff2) format("woff2"),url(fonts/KaTeX_Size4-Regular.woff) format("woff"),url(fonts/KaTeX_Size4-Regular.ttf) format("truetype")", - "url(fonts/KaTeX_Typewriter-Regular.woff2) format("woff2"),url(fonts/KaTeX_Typewriter-Regular.woff) format("woff"),url(fonts/KaTeX_Typewriter-Regular.ttf) format("truetype")", + "url(fonts/KaTeX_AMS-Regular.woff2) format("woff2"), url(fonts/KaTeX_AMS-Regular.woff) format("woff"), url(fonts/KaTeX_AMS-Regular.ttf) format("truetype")", + "url(fonts/KaTeX_Caligraphic-Bold.woff2) format("woff2"), url(fonts/KaTeX_Caligraphic-Bold.woff) format("woff"), url(fonts/KaTeX_Caligraphic-Bold.ttf) format("truetype")", + "url(fonts/KaTeX_Caligraphic-Regular.woff2) format("woff2"), url(fonts/KaTeX_Caligraphic-Regular.woff) format("woff"), url(fonts/KaTeX_Caligraphic-Regular.ttf) format("truetype")", + "url(fonts/KaTeX_Fraktur-Bold.woff2) format("woff2"), url(fonts/KaTeX_Fraktur-Bold.woff) format("woff"), url(fonts/KaTeX_Fraktur-Bold.ttf) format("truetype")", + "url(fonts/KaTeX_Fraktur-Regular.woff2) format("woff2"), url(fonts/KaTeX_Fraktur-Regular.woff) format("woff"), url(fonts/KaTeX_Fraktur-Regular.ttf) format("truetype")", + "url(fonts/KaTeX_Main-Bold.woff2) format("woff2"), url(fonts/KaTeX_Main-Bold.woff) format("woff"), url(fonts/KaTeX_Main-Bold.ttf) format("truetype")", + "url(fonts/KaTeX_Main-BoldItalic.woff2) format("woff2"), url(fonts/KaTeX_Main-BoldItalic.woff) format("woff"), url(fonts/KaTeX_Main-BoldItalic.ttf) format("truetype")", + "url(fonts/KaTeX_Main-Italic.woff2) format("woff2"), url(fonts/KaTeX_Main-Italic.woff) format("woff"), url(fonts/KaTeX_Main-Italic.ttf) format("truetype")", + "url(fonts/KaTeX_Main-Regular.woff2) format("woff2"), url(fonts/KaTeX_Main-Regular.woff) format("woff"), url(fonts/KaTeX_Main-Regular.ttf) format("truetype")", + "url(fonts/KaTeX_Math-BoldItalic.woff2) format("woff2"), url(fonts/KaTeX_Math-BoldItalic.woff) format("woff"), url(fonts/KaTeX_Math-BoldItalic.ttf) format("truetype")", + "url(fonts/KaTeX_Math-Italic.woff2) format("woff2"), url(fonts/KaTeX_Math-Italic.woff) format("woff"), url(fonts/KaTeX_Math-Italic.ttf) format("truetype")", + "url(fonts/KaTeX_SansSerif-Bold.woff2) format("woff2"), url(fonts/KaTeX_SansSerif-Bold.woff) format("woff"), url(fonts/KaTeX_SansSerif-Bold.ttf) format("truetype")", + "url(fonts/KaTeX_SansSerif-Italic.woff2) format("woff2"), url(fonts/KaTeX_SansSerif-Italic.woff) format("woff"), url(fonts/KaTeX_SansSerif-Italic.ttf) format("truetype")", + "url(fonts/KaTeX_SansSerif-Regular.woff2) format("woff2"), url(fonts/KaTeX_SansSerif-Regular.woff) format("woff"), url(fonts/KaTeX_SansSerif-Regular.ttf) format("truetype")", + "url(fonts/KaTeX_Script-Regular.woff2) format("woff2"), url(fonts/KaTeX_Script-Regular.woff) format("woff"), url(fonts/KaTeX_Script-Regular.ttf) format("truetype")", + "url(fonts/KaTeX_Size1-Regular.woff2) format("woff2"), url(fonts/KaTeX_Size1-Regular.woff) format("woff"), url(fonts/KaTeX_Size1-Regular.ttf) format("truetype")", + "url(fonts/KaTeX_Size2-Regular.woff2) format("woff2"), url(fonts/KaTeX_Size2-Regular.woff) format("woff"), url(fonts/KaTeX_Size2-Regular.ttf) format("truetype")", + "url(fonts/KaTeX_Size3-Regular.woff2) format("woff2"), url(fonts/KaTeX_Size3-Regular.woff) format("woff"), url(fonts/KaTeX_Size3-Regular.ttf) format("truetype")", + "url(fonts/KaTeX_Size4-Regular.woff2) format("woff2"), url(fonts/KaTeX_Size4-Regular.woff) format("woff"), url(fonts/KaTeX_Size4-Regular.ttf) format("truetype")", + "url(fonts/KaTeX_Typewriter-Regular.woff2) format("woff2"), url(fonts/KaTeX_Typewriter-Regular.woff) format("woff"), url(fonts/KaTeX_Typewriter-Regular.ttf) format("truetype")", ] `; exports[`Marp math option with KaTeX with katexFontPath replaces KaTeX web font URL with specified path: katex-css-replace 1`] = ` [ - "url('/resources/fonts/KaTeX_AMS-Regular.woff2') format("woff2"),url('/resources/fonts/KaTeX_AMS-Regular.woff') format("woff"),url('/resources/fonts/KaTeX_AMS-Regular.ttf') format("truetype")", - "url('/resources/fonts/KaTeX_Caligraphic-Bold.woff2') format("woff2"),url('/resources/fonts/KaTeX_Caligraphic-Bold.woff') format("woff"),url('/resources/fonts/KaTeX_Caligraphic-Bold.ttf') format("truetype")", - "url('/resources/fonts/KaTeX_Caligraphic-Regular.woff2') format("woff2"),url('/resources/fonts/KaTeX_Caligraphic-Regular.woff') format("woff"),url('/resources/fonts/KaTeX_Caligraphic-Regular.ttf') format("truetype")", - "url('/resources/fonts/KaTeX_Fraktur-Bold.woff2') format("woff2"),url('/resources/fonts/KaTeX_Fraktur-Bold.woff') format("woff"),url('/resources/fonts/KaTeX_Fraktur-Bold.ttf') format("truetype")", - "url('/resources/fonts/KaTeX_Fraktur-Regular.woff2') format("woff2"),url('/resources/fonts/KaTeX_Fraktur-Regular.woff') format("woff"),url('/resources/fonts/KaTeX_Fraktur-Regular.ttf') format("truetype")", - "url('/resources/fonts/KaTeX_Main-Bold.woff2') format("woff2"),url('/resources/fonts/KaTeX_Main-Bold.woff') format("woff"),url('/resources/fonts/KaTeX_Main-Bold.ttf') format("truetype")", - "url('/resources/fonts/KaTeX_Main-BoldItalic.woff2') format("woff2"),url('/resources/fonts/KaTeX_Main-BoldItalic.woff') format("woff"),url('/resources/fonts/KaTeX_Main-BoldItalic.ttf') format("truetype")", - "url('/resources/fonts/KaTeX_Main-Italic.woff2') format("woff2"),url('/resources/fonts/KaTeX_Main-Italic.woff') format("woff"),url('/resources/fonts/KaTeX_Main-Italic.ttf') format("truetype")", - "url('/resources/fonts/KaTeX_Main-Regular.woff2') format("woff2"),url('/resources/fonts/KaTeX_Main-Regular.woff') format("woff"),url('/resources/fonts/KaTeX_Main-Regular.ttf') format("truetype")", - "url('/resources/fonts/KaTeX_Math-BoldItalic.woff2') format("woff2"),url('/resources/fonts/KaTeX_Math-BoldItalic.woff') format("woff"),url('/resources/fonts/KaTeX_Math-BoldItalic.ttf') format("truetype")", - "url('/resources/fonts/KaTeX_Math-Italic.woff2') format("woff2"),url('/resources/fonts/KaTeX_Math-Italic.woff') format("woff"),url('/resources/fonts/KaTeX_Math-Italic.ttf') format("truetype")", - "url('/resources/fonts/KaTeX_SansSerif-Bold.woff2') format("woff2"),url('/resources/fonts/KaTeX_SansSerif-Bold.woff') format("woff"),url('/resources/fonts/KaTeX_SansSerif-Bold.ttf') format("truetype")", - "url('/resources/fonts/KaTeX_SansSerif-Italic.woff2') format("woff2"),url('/resources/fonts/KaTeX_SansSerif-Italic.woff') format("woff"),url('/resources/fonts/KaTeX_SansSerif-Italic.ttf') format("truetype")", - "url('/resources/fonts/KaTeX_SansSerif-Regular.woff2') format("woff2"),url('/resources/fonts/KaTeX_SansSerif-Regular.woff') format("woff"),url('/resources/fonts/KaTeX_SansSerif-Regular.ttf') format("truetype")", - "url('/resources/fonts/KaTeX_Script-Regular.woff2') format("woff2"),url('/resources/fonts/KaTeX_Script-Regular.woff') format("woff"),url('/resources/fonts/KaTeX_Script-Regular.ttf') format("truetype")", - "url('/resources/fonts/KaTeX_Size1-Regular.woff2') format("woff2"),url('/resources/fonts/KaTeX_Size1-Regular.woff') format("woff"),url('/resources/fonts/KaTeX_Size1-Regular.ttf') format("truetype")", - "url('/resources/fonts/KaTeX_Size2-Regular.woff2') format("woff2"),url('/resources/fonts/KaTeX_Size2-Regular.woff') format("woff"),url('/resources/fonts/KaTeX_Size2-Regular.ttf') format("truetype")", - "url('/resources/fonts/KaTeX_Size3-Regular.woff2') format("woff2"),url('/resources/fonts/KaTeX_Size3-Regular.woff') format("woff"),url('/resources/fonts/KaTeX_Size3-Regular.ttf') format("truetype")", - "url('/resources/fonts/KaTeX_Size4-Regular.woff2') format("woff2"),url('/resources/fonts/KaTeX_Size4-Regular.woff') format("woff"),url('/resources/fonts/KaTeX_Size4-Regular.ttf') format("truetype")", - "url('/resources/fonts/KaTeX_Typewriter-Regular.woff2') format("woff2"),url('/resources/fonts/KaTeX_Typewriter-Regular.woff') format("woff"),url('/resources/fonts/KaTeX_Typewriter-Regular.ttf') format("truetype")", + "url('/resources/fonts/KaTeX_AMS-Regular.woff2') format("woff2"), url('/resources/fonts/KaTeX_AMS-Regular.woff') format("woff"), url('/resources/fonts/KaTeX_AMS-Regular.ttf') format("truetype")", + "url('/resources/fonts/KaTeX_Caligraphic-Bold.woff2') format("woff2"), url('/resources/fonts/KaTeX_Caligraphic-Bold.woff') format("woff"), url('/resources/fonts/KaTeX_Caligraphic-Bold.ttf') format("truetype")", + "url('/resources/fonts/KaTeX_Caligraphic-Regular.woff2') format("woff2"), url('/resources/fonts/KaTeX_Caligraphic-Regular.woff') format("woff"), url('/resources/fonts/KaTeX_Caligraphic-Regular.ttf') format("truetype")", + "url('/resources/fonts/KaTeX_Fraktur-Bold.woff2') format("woff2"), url('/resources/fonts/KaTeX_Fraktur-Bold.woff') format("woff"), url('/resources/fonts/KaTeX_Fraktur-Bold.ttf') format("truetype")", + "url('/resources/fonts/KaTeX_Fraktur-Regular.woff2') format("woff2"), url('/resources/fonts/KaTeX_Fraktur-Regular.woff') format("woff"), url('/resources/fonts/KaTeX_Fraktur-Regular.ttf') format("truetype")", + "url('/resources/fonts/KaTeX_Main-Bold.woff2') format("woff2"), url('/resources/fonts/KaTeX_Main-Bold.woff') format("woff"), url('/resources/fonts/KaTeX_Main-Bold.ttf') format("truetype")", + "url('/resources/fonts/KaTeX_Main-BoldItalic.woff2') format("woff2"), url('/resources/fonts/KaTeX_Main-BoldItalic.woff') format("woff"), url('/resources/fonts/KaTeX_Main-BoldItalic.ttf') format("truetype")", + "url('/resources/fonts/KaTeX_Main-Italic.woff2') format("woff2"), url('/resources/fonts/KaTeX_Main-Italic.woff') format("woff"), url('/resources/fonts/KaTeX_Main-Italic.ttf') format("truetype")", + "url('/resources/fonts/KaTeX_Main-Regular.woff2') format("woff2"), url('/resources/fonts/KaTeX_Main-Regular.woff') format("woff"), url('/resources/fonts/KaTeX_Main-Regular.ttf') format("truetype")", + "url('/resources/fonts/KaTeX_Math-BoldItalic.woff2') format("woff2"), url('/resources/fonts/KaTeX_Math-BoldItalic.woff') format("woff"), url('/resources/fonts/KaTeX_Math-BoldItalic.ttf') format("truetype")", + "url('/resources/fonts/KaTeX_Math-Italic.woff2') format("woff2"), url('/resources/fonts/KaTeX_Math-Italic.woff') format("woff"), url('/resources/fonts/KaTeX_Math-Italic.ttf') format("truetype")", + "url('/resources/fonts/KaTeX_SansSerif-Bold.woff2') format("woff2"), url('/resources/fonts/KaTeX_SansSerif-Bold.woff') format("woff"), url('/resources/fonts/KaTeX_SansSerif-Bold.ttf') format("truetype")", + "url('/resources/fonts/KaTeX_SansSerif-Italic.woff2') format("woff2"), url('/resources/fonts/KaTeX_SansSerif-Italic.woff') format("woff"), url('/resources/fonts/KaTeX_SansSerif-Italic.ttf') format("truetype")", + "url('/resources/fonts/KaTeX_SansSerif-Regular.woff2') format("woff2"), url('/resources/fonts/KaTeX_SansSerif-Regular.woff') format("woff"), url('/resources/fonts/KaTeX_SansSerif-Regular.ttf') format("truetype")", + "url('/resources/fonts/KaTeX_Script-Regular.woff2') format("woff2"), url('/resources/fonts/KaTeX_Script-Regular.woff') format("woff"), url('/resources/fonts/KaTeX_Script-Regular.ttf') format("truetype")", + "url('/resources/fonts/KaTeX_Size1-Regular.woff2') format("woff2"), url('/resources/fonts/KaTeX_Size1-Regular.woff') format("woff"), url('/resources/fonts/KaTeX_Size1-Regular.ttf') format("truetype")", + "url('/resources/fonts/KaTeX_Size2-Regular.woff2') format("woff2"), url('/resources/fonts/KaTeX_Size2-Regular.woff') format("woff"), url('/resources/fonts/KaTeX_Size2-Regular.ttf') format("truetype")", + "url('/resources/fonts/KaTeX_Size3-Regular.woff2') format("woff2"), url('/resources/fonts/KaTeX_Size3-Regular.woff') format("woff"), url('/resources/fonts/KaTeX_Size3-Regular.ttf') format("truetype")", + "url('/resources/fonts/KaTeX_Size4-Regular.woff2') format("woff2"), url('/resources/fonts/KaTeX_Size4-Regular.woff') format("woff"), url('/resources/fonts/KaTeX_Size4-Regular.ttf') format("truetype")", + "url('/resources/fonts/KaTeX_Typewriter-Regular.woff2') format("woff2"), url('/resources/fonts/KaTeX_Typewriter-Regular.woff') format("woff"), url('/resources/fonts/KaTeX_Typewriter-Regular.ttf') format("truetype")", ] `; diff --git a/test/marp.ts b/test/marp.ts index 215f7bc7..bfeb7128 100644 --- a/test/marp.ts +++ b/test/marp.ts @@ -1085,7 +1085,7 @@ function matchwo(a,b) // Custom theme const customTheme = - '/* @theme a */ @media screen \t and ( min-width : 768px ) { div { color: #f00; } }' + '/* @theme a */\n@media screen and (min-width : 768px) { div { color: #f00; } }' enabled.themeSet.add(customTheme) disabled.themeSet.add(customTheme) @@ -1093,12 +1093,11 @@ function matchwo(a,b) const enabledCss = enabled.render('').css const disabledCss = disabled.render('').css - expect(disabledCss).toContain( - '@media screen \t and ( min-width : 768px )', - ) expect(disabledCss).toContain('div { color: #f00; }') - expect(enabledCss).toContain('@media screen and (min-width:768px)') expect(enabledCss).toContain('div{color:#f00}') + expect(enabledCss.split('\n').length).toBeLessThan( + disabledCss.split('\n').length, + ) }) it('applies minifier by default', () => { From 778a3e5c5702d8d0403fc6fb758d3ebecc9de18e Mon Sep 17 00:00:00 2001 From: Yuki Hattori Date: Sat, 31 Aug 2024 20:18:37 +0900 Subject: [PATCH 2/3] Remove complex prebundling process --- package-lock.json | 233 ----------------------- package.json | 1 - rollup.config.mjs | 36 +--- src/prebundles/mocks/browserslist.ts | 6 - src/prebundles/postcss-minify-plugins.ts | 9 - 5 files changed, 1 insertion(+), 284 deletions(-) delete mode 100644 src/prebundles/mocks/browserslist.ts delete mode 100644 src/prebundles/postcss-minify-plugins.ts diff --git a/package-lock.json b/package-lock.json index ee335c9e..9c85e483 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,7 +24,6 @@ "@rollup/plugin-commonjs": "^26.0.1", "@rollup/plugin-json": "^6.1.0", "@rollup/plugin-node-resolve": "^15.2.3", - "@rollup/plugin-replace": "^5.0.7", "@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-typescript": "^11.1.6", "@tsconfig/node20": "^20.1.4", @@ -1906,28 +1905,6 @@ } } }, - "node_modules/@rollup/plugin-replace": { - "version": "5.0.7", - "resolved": "https://registry.npmjs.org/@rollup/plugin-replace/-/plugin-replace-5.0.7.tgz", - "integrity": "sha512-PqxSfuorkHz/SPpyngLyg5GCEkOcee9M1bkxiVDr41Pd61mqP1PLOoDPbpl44SB2mQGKwV/In74gqQmGITOhEQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@rollup/pluginutils": "^5.0.1", - "magic-string": "^0.30.3" - }, - "engines": { - "node": ">=14.0.0" - }, - "peerDependencies": { - "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" - }, - "peerDependenciesMeta": { - "rollup": { - "optional": true - } - } - }, "node_modules/@rollup/plugin-terser": { "version": "0.4.4", "resolved": "https://registry.npmjs.org/@rollup/plugin-terser/-/plugin-terser-0.4.4.tgz", @@ -2001,34 +1978,6 @@ } } }, - "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.21.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.21.2.tgz", - "integrity": "sha512-fSuPrt0ZO8uXeS+xP3b+yYTCBUd05MoSp2N/MFOgjhhUhMmchXlpTQrTpI8T+YAwAQuK7MafsCOxW7VrPMrJcg==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-android-arm64": { - "version": "4.21.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.21.2.tgz", - "integrity": "sha512-xGU5ZQmPlsjQS6tzTTGwMsnKUtu0WVbl0hYpTPauvbRAnmIvpInhJtgjj3mcuJpEiuUw4v1s4BimkdfDWlh7gA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ] - }, "node_modules/@rollup/rollup-darwin-arm64": { "version": "4.21.2", "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.21.2.tgz", @@ -2043,188 +1992,6 @@ "darwin" ] }, - "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.21.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.21.2.tgz", - "integrity": "sha512-ZbRaUvw2iN/y37x6dY50D8m2BnDbBjlnMPotDi/qITMJ4sIxNY33HArjikDyakhSv0+ybdUxhWxE6kTI4oX26w==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.21.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.21.2.tgz", - "integrity": "sha512-ztRJJMiE8nnU1YFcdbd9BcH6bGWG1z+jP+IPW2oDUAPxPjo9dverIOyXz76m6IPA6udEL12reYeLojzW2cYL7w==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.21.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.21.2.tgz", - "integrity": "sha512-flOcGHDZajGKYpLV0JNc0VFH361M7rnV1ee+NTeC/BQQ1/0pllYcFmxpagltANYt8FYf9+kL6RSk80Ziwyhr7w==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.21.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.21.2.tgz", - "integrity": "sha512-69CF19Kp3TdMopyteO/LJbWufOzqqXzkrv4L2sP8kfMaAQ6iwky7NoXTp7bD6/irKgknDKM0P9E/1l5XxVQAhw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.21.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.21.2.tgz", - "integrity": "sha512-48pD/fJkTiHAZTnZwR0VzHrao70/4MlzJrq0ZsILjLW/Ab/1XlVUStYyGt7tdyIiVSlGZbnliqmult/QGA2O2w==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.21.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.21.2.tgz", - "integrity": "sha512-cZdyuInj0ofc7mAQpKcPR2a2iu4YM4FQfuUzCVA2u4HI95lCwzjoPtdWjdpDKyHxI0UO82bLDoOaLfpZ/wviyQ==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.21.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.21.2.tgz", - "integrity": "sha512-RL56JMT6NwQ0lXIQmMIWr1SW28z4E4pOhRRNqwWZeXpRlykRIlEpSWdsgNWJbYBEWD84eocjSGDu/XxbYeCmwg==", - "cpu": [ - "riscv64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.21.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.21.2.tgz", - "integrity": "sha512-PMxkrWS9z38bCr3rWvDFVGD6sFeZJw4iQlhrup7ReGmfn7Oukrr/zweLhYX6v2/8J6Cep9IEA/SmjXjCmSbrMQ==", - "cpu": [ - "s390x" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.21.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.21.2.tgz", - "integrity": "sha512-B90tYAUoLhU22olrafY3JQCFLnT3NglazdwkHyxNDYF/zAxJt5fJUB/yBoWFoIQ7SQj+KLe3iL4BhOMa9fzgpw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.21.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.21.2.tgz", - "integrity": "sha512-7twFizNXudESmC9oneLGIUmoHiiLppz/Xs5uJQ4ShvE6234K0VB1/aJYU3f/4g7PhssLGKBVCC37uRkkOi8wjg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.21.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.21.2.tgz", - "integrity": "sha512-9rRero0E7qTeYf6+rFh3AErTNU1VCQg2mn7CQcI44vNUWM9Ze7MSRS/9RFuSsox+vstRt97+x3sOhEey024FRQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.21.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.21.2.tgz", - "integrity": "sha512-5rA4vjlqgrpbFVVHX3qkrCo/fZTj1q0Xxpg+Z7yIo3J2AilW7t2+n6Q8Jrx+4MrYpAnjttTYF8rr7bP46BPzRw==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.21.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.21.2.tgz", - "integrity": "sha512-6UUxd0+SKomjdzuAcp+HAmxw1FlGBnl1v2yEPSabtx4lBfdXHDVsW7+lQkgz9cNFJGY3AWR7+V8P5BqkD9L9nA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, "node_modules/@sinclair/typebox": { "version": "0.27.8", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", diff --git a/package.json b/package.json index cf0cac8b..4a5a73b1 100644 --- a/package.json +++ b/package.json @@ -70,7 +70,6 @@ "@rollup/plugin-commonjs": "^26.0.1", "@rollup/plugin-json": "^6.1.0", "@rollup/plugin-node-resolve": "^15.2.3", - "@rollup/plugin-replace": "^5.0.7", "@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-typescript": "^11.1.6", "@tsconfig/node20": "^20.1.4", diff --git a/rollup.config.mjs b/rollup.config.mjs index d51c02aa..ab951ea5 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -5,7 +5,6 @@ import alias from '@rollup/plugin-alias' import commonjs from '@rollup/plugin-commonjs' import json from '@rollup/plugin-json' import { nodeResolve } from '@rollup/plugin-node-resolve' -import replace from '@rollup/plugin-replace' import terser from '@rollup/plugin-terser' import typescript from '@rollup/plugin-typescript' import autoprefixer from 'autoprefixer' @@ -27,10 +26,6 @@ const plugins = ({ browser = false } = {}) => [ find: /^.+browser-script$/, replacement: path.resolve(__dirname, 'lib/browser.js'), }, - { - find: /^.*prebundles[\\/]postcss-minify-plugins$/, - replacement: path.resolve(__dirname, 'tmp/postcss-minify-plugins.mjs'), - }, ], }), string({ include: ['lib/*.js'] }), @@ -51,9 +46,7 @@ const plugins = ({ browser = false } = {}) => [ preset: [ 'default', { - // Some minifers will apply on runtime to make debug easily. - minifyParams: false, - minifySelectors: false, + // Whitespace normalizer will apply on runtime to make debug easily (minifyCSS option) normalizeWhitespace: false, }, ], @@ -63,22 +56,6 @@ const plugins = ({ browser = false } = {}) => [ !process.env.ROLLUP_WATCH && terser(), ] -const prebundlePlugins = () => [ - alias({ - entries: [ - { - find: 'browserslist', - replacement: path.resolve( - __dirname, - 'src/prebundles/mocks/browserslist.ts', - ), - }, - ], - }), - ...plugins(), - replace({ preventAssignment: true, __dirname: '""' }), -] - const external = (deps) => (id) => deps.some((dep) => dep === id || id.startsWith(`${dep}/`)) @@ -95,17 +72,6 @@ export default [ plugins: plugins({ browser: true }), }, - // Prebundles - { - input: `src/prebundles/postcss-minify-plugins.ts`, - output: { - exports: 'named', - file: 'tmp/postcss-minify-plugins.mjs', - format: 'es', - }, - plugins: prebundlePlugins(), - }, - // Main bundle { external: external(Object.keys(pkg.dependencies)), diff --git a/src/prebundles/mocks/browserslist.ts b/src/prebundles/mocks/browserslist.ts deleted file mode 100644 index 8e7c43e9..00000000 --- a/src/prebundles/mocks/browserslist.ts +++ /dev/null @@ -1,6 +0,0 @@ -// postcss-minify-params is depending on browserslist to detect whether using -// IE. Marp does never use this detection so we will mock the module and return -// empty array. You can see the setting for pre-bundling in rollup.config.js. - -/* istanbul ignore next */ -export default () => [] diff --git a/src/prebundles/postcss-minify-plugins.ts b/src/prebundles/postcss-minify-plugins.ts deleted file mode 100644 index 520b6f8b..00000000 --- a/src/prebundles/postcss-minify-plugins.ts +++ /dev/null @@ -1,9 +0,0 @@ -import postcssMinifyParams from 'postcss-minify-params' -import postcssMinifySelectors from 'postcss-minify-selectors' -import postcssNormalizeWhitespace from 'postcss-normalize-whitespace' - -export default [ - postcssNormalizeWhitespace, - postcssMinifyParams, - postcssMinifySelectors, -] From 35d6e0428bd43f9b293a0b17fbba4228c1dd7345 Mon Sep 17 00:00:00 2001 From: Yuki Hattori Date: Sat, 31 Aug 2024 20:53:26 +0900 Subject: [PATCH 3/3] [ci skip] Update CHANGELOG.md --- CHANGELOG.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87e4b9df..b5721333 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,12 +12,14 @@ ### Changed -- Upgrade development Node.js to v18 LTS ([#359](https://github.com/marp-team/marp-core/pull/359)) - Upgrade Marpit to [v3.1.1](https://github.com/marp-team/marpit/releases/v3.1.1) ([#378](https://github.com/marp-team/marp-core/pull/378)) - Bump markdown-it to [v14.1.0](https://github.com/markdown-it/markdown-it/blob/master/CHANGELOG.md#1410---2024-03-19), and follow the latest spec of [CommonMark 0.31.2](https://spec.commonmark.org/0.31.2/) - Support for CSS nesting (`cssNesting` constructor option) -- Switch package manager from yarn to npm ([#379](https://github.com/marp-team/marp-core/pull/379)) -- Upgrade dependent packages to the latest version ([#380](https://github.com/marp-team/marp-core/pull/380)) +- Use simpler CSS minification when `minifyCSS` option is enabled ([#381](https://github.com/marp-team/marp-core/pull/381)) + +* Upgrade development Node.js to v18 LTS ([#359](https://github.com/marp-team/marp-core/pull/359)) +* Upgrade dependent packages to the latest version ([#380](https://github.com/marp-team/marp-core/pull/380)) +* Switch package manager from yarn to npm ([#379](https://github.com/marp-team/marp-core/pull/379)) ## v3.9.0 - 2023-10-15