From 4afb228d956a415624c4e5554bb8f25d047676fe Mon Sep 17 00:00:00 2001
From: Ben McCann <322311+benmccann@users.noreply.github.com>
Date: Tue, 2 Nov 2021 07:32:17 -0700
Subject: [PATCH] fix: Convert to ESM (#2227)
BREAKING CHANGE:
- Default export removed. Use `import { marked } from 'marked'` or `const { marked } = require('marked')` instead.
- `/lib/marked.js` removed. Use `/marked.min.js` in script tag instead.
- When using marked in a script tag use `marked.parse(...)` instead of `marked(...)`
---
Makefile | 6 +-
README.md | 2 +-
bin/{marked => marked.js} | 125 +-
bower.json | 2 +-
build-docs.js | 14 +-
component.json | 4 +-
docs/INDEX.md | 10 +-
docs/USING_ADVANCED.md | 23 +-
docs/USING_PRO.md | 18 +-
docs/demo/demo.js | 8 +-
index.js | 1 -
jasmine.json | 1 +
lib/marked.cjs | 2913 ++++++++++
lib/marked.esm.js | 465 +-
lib/marked.js | 320 +-
man/marked.1 | 29 +-
man/marked.1.txt | 52 +-
marked.min.js | 2 +-
package-lock.json | 5009 ++++++++---------
package.json | 22 +-
rollup.config.esm.js | 2 +-
rollup.config.js | 5 +-
src/Lexer.js | 12 +-
src/Parser.js | 16 +-
src/Renderer.js | 10 +-
src/Slugger.js | 4 +-
src/TextRenderer.js | 4 +-
src/Tokenizer.js | 10 +-
src/defaults.js | 14 +-
src/esm-entry.js | 18 -
src/helpers.js | 39 +-
src/marked.js | 38 +-
src/rules.js | 13 +-
test/bench.js | 85 +-
test/helpers/helpers.js | 18 +-
test/helpers/html-differ.js | 62 +-
test/helpers/load.js | 27 +-
test/rules.js | 2 +-
.../{quadratic_br.js => quadratic_br.cjs} | 0
...quadratic_email.js => quadratic_email.cjs} | 0
...ratic_heading.js => quadratic_heading.cjs} | 0
...derscores.js => quadratic_underscores.cjs} | 0
test/specs/run-spec.js | 11 +-
test/unit/Lexer-spec.js | 2 +-
test/unit/Parser-spec.js | 2 +-
test/unit/marked-spec.js | 102 +-
test/update-specs.js | 30 +-
test/vuln-regex.js | 10 +-
48 files changed, 5931 insertions(+), 3631 deletions(-)
rename bin/{marked => marked.js} (59%)
mode change 100755 => 100644
delete mode 100644 index.js
create mode 100644 lib/marked.cjs
delete mode 100644 src/esm-entry.js
rename test/specs/redos/{quadratic_br.js => quadratic_br.cjs} (100%)
rename test/specs/redos/{quadratic_email.js => quadratic_email.cjs} (100%)
rename test/specs/redos/{quadratic_heading.js => quadratic_heading.cjs} (100%)
rename test/specs/redos/{quadratic_underscores.js => quadratic_underscores.cjs} (100%)
diff --git a/Makefile b/Makefile
index 7deead54..2bd63016 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,9 @@
all:
- @cp lib/marked.js marked.js
- @uglifyjs --comments '/\*[^\0]+?Copyright[^\0]+?\*/' -o marked.min.js lib/marked.js
+ @cp lib/marked.cjs marked.cjs
+ @uglifyjs --comments '/\*[^\0]+?Copyright[^\0]+?\*/' -o marked.min.js lib/marked.cjs
clean:
- @rm marked.js
+ @rm marked.cjs
@rm marked.min.js
bench:
diff --git a/README.md b/README.md
index 53b120d3..18ec1700 100644
--- a/README.md
+++ b/README.md
@@ -69,7 +69,7 @@ $ cat hello.html