From 72e44a2bb05753facd2fef16513e7a87963da4a8 Mon Sep 17 00:00:00 2001 From: JP Date: Fri, 4 Feb 2022 16:57:15 -0800 Subject: [PATCH] swap duplicate prism-core for patch-package --- package.json | 5 +- patches/prismjs+1.26.0.patch | 1097 ++++++++++++++++++++++++++++++++ src/vendor/prism/index.js | 2 +- src/vendor/prism/prism-core.js | 432 ------------- yarn.lock | 142 +++-- 5 files changed, 1207 insertions(+), 471 deletions(-) create mode 100644 patches/prismjs+1.26.0.patch delete mode 100755 src/vendor/prism/prism-core.js diff --git a/package.json b/package.json index 99c19dc..6d01f6c 100755 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "test": "jest", "flow": "flow check", "format": "prettier --write 'src/**/*.js'", + "postinstall": "patch-package", "prepublishOnly": "run-p flow build" }, "babel": { @@ -80,8 +81,10 @@ "jest": "^26.6.3", "lint-staged": "^10.5.4", "npm-run-all": "^4.1.5", + "patch-package": "^6.4.7", + "postinstall-postinstall": "^2.1.0", "prettier": "^2.2.1", - "prismjs": "^1.23.0", + "prismjs": "^1.26.0", "react": "^17.0.1", "react-dom": "^17.0.1", "rollup": "^2.39.0" diff --git a/patches/prismjs+1.26.0.patch b/patches/prismjs+1.26.0.patch new file mode 100644 index 0000000..92ec81c --- /dev/null +++ b/patches/prismjs+1.26.0.patch @@ -0,0 +1,1097 @@ +diff --git a/node_modules/prismjs/prism.js b/node_modules/prismjs/prism.js +index 7d2bc60..dd4fc04 100644 +--- a/node_modules/prismjs/prism.js ++++ b/node_modules/prismjs/prism.js +@@ -1,18 +1,3 @@ +- +-/* ********************************************** +- Begin prism-core.js +-********************************************** */ +- +-/// +- +-var _self = (typeof window !== 'undefined') +- ? window // if in browser +- : ( +- (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) +- ? self // if in worker +- : {} // if in node js +- ); +- + /** + * Prism: Lightweight, robust, elegant syntax highlighting + * +@@ -21,7 +6,19 @@ var _self = (typeof window !== 'undefined') + * @namespace + * @public + */ +-var Prism = (function (_self) { ++ ++/** ++ * prism-react-renderer: ++ * This file has been modified to remove: ++ * - globals and window dependency ++ * - worker support ++ * - highlightAll and other element dependent methods ++ * - _.hooks helpers ++ * - UMD/node-specific hacks ++ * It has also been run through prettier ++ */ ++ ++ var Prism = (function () { + + // Private helper vars + var lang = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i; +@@ -32,51 +29,6 @@ var Prism = (function (_self) { + + + var _ = { +- /** +- * By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the +- * current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load +- * additional languages or plugins yourself. +- * +- * By setting this value to `true`, Prism will not automatically highlight all code elements on the page. +- * +- * You obviously have to change this value before the automatic highlighting started. To do this, you can add an +- * empty Prism object into the global scope before loading the Prism script like this: +- * +- * ```js +- * window.Prism = window.Prism || {}; +- * Prism.manual = true; +- * // add a new