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

Expose named exports for ESM build #2223

Merged
merged 1 commit into from
Oct 6, 2021
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
54 changes: 31 additions & 23 deletions lib/marked.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
* The code in this file is generated from files in ./src/
*/

var marked$1 = {exports: {}};

var defaults$5 = {exports: {}};

function getDefaults$1() {
Expand Down Expand Up @@ -378,7 +380,7 @@ function indentCodeCompensation(raw, text) {
/**
* Tokenizer
*/
var Tokenizer_1 = class Tokenizer {
var Tokenizer_1$1 = class Tokenizer {
constructor(options) {
this.options = options || defaults$4;
}
Expand Down Expand Up @@ -1358,7 +1360,7 @@ var rules = {
inline: inline$1
};

const Tokenizer$1 = Tokenizer_1;
const Tokenizer$1 = Tokenizer_1$1;
const { defaults: defaults$3 } = defaults$5.exports;
const { block, inline } = rules;
const { repeatString } = helpers;
Expand Down Expand Up @@ -1407,7 +1409,7 @@ function mangle(text) {
/**
* Block Lexer
*/
var Lexer_1 = class Lexer {
var Lexer_1$1 = class Lexer {
constructor(options) {
this.tokens = [];
this.tokens.links = Object.create(null);
Expand Down Expand Up @@ -1859,7 +1861,7 @@ const {
/**
* Renderer
*/
var Renderer_1 = class Renderer {
var Renderer_1$1 = class Renderer {
constructor(options) {
this.options = options || defaults$2;
}
Expand Down Expand Up @@ -2022,7 +2024,7 @@ var Renderer_1 = class Renderer {
* returns only the textual part of the token
*/

var TextRenderer_1 = class TextRenderer {
var TextRenderer_1$1 = class TextRenderer {
// no need for block level renderers
strong(text) {
return text;
Expand Down Expand Up @@ -2065,7 +2067,7 @@ var TextRenderer_1 = class TextRenderer {
* Slugger generates header id
*/

var Slugger_1 = class Slugger {
var Slugger_1$1 = class Slugger {
constructor() {
this.seen = {};
}
Expand Down Expand Up @@ -2112,9 +2114,9 @@ var Slugger_1 = class Slugger {
}
};

const Renderer$1 = Renderer_1;
const TextRenderer$1 = TextRenderer_1;
const Slugger$1 = Slugger_1;
const Renderer$1 = Renderer_1$1;
const TextRenderer$1 = TextRenderer_1$1;
const Slugger$1 = Slugger_1$1;
const { defaults: defaults$1 } = defaults$5.exports;
const {
unescape
Expand All @@ -2123,7 +2125,7 @@ const {
/**
* Parsing & Compiling
*/
var Parser_1 = class Parser {
var Parser_1$1 = class Parser {
constructor(options) {
this.options = options || defaults$1;
this.options.renderer = this.options.renderer || new Renderer$1();
Expand Down Expand Up @@ -2399,12 +2401,12 @@ var Parser_1 = class Parser {
}
};

const Lexer = Lexer_1;
const Parser = Parser_1;
const Tokenizer = Tokenizer_1;
const Renderer = Renderer_1;
const TextRenderer = TextRenderer_1;
const Slugger = Slugger_1;
const Lexer = Lexer_1$1;
const Parser = Parser_1$1;
const Tokenizer = Tokenizer_1$1;
const Renderer = Renderer_1$1;
const TextRenderer = TextRenderer_1$1;
const Slugger = Slugger_1$1;
const {
merge,
checkSanitizeDeprecation,
Expand Down Expand Up @@ -2727,19 +2729,25 @@ marked.parseInline = function(src, opt) {

marked.Parser = Parser;
marked.parser = Parser.parse;

marked.Renderer = Renderer;
marked.TextRenderer = TextRenderer;

marked.Lexer = Lexer;
marked.lexer = Lexer.lex;

marked.Tokenizer = Tokenizer;

marked.Slugger = Slugger;

marked.parse = marked;

var marked_1 = marked;
marked$1.exports = marked;
var parse = marked$1.exports.parse = marked;
var Parser_1 = marked$1.exports.Parser = Parser;
var parser = marked$1.exports.parser = Parser.parse;
var Renderer_1 = marked$1.exports.Renderer = Renderer;
var TextRenderer_1 = marked$1.exports.TextRenderer = TextRenderer;
var Lexer_1 = marked$1.exports.Lexer = Lexer;
var lexer = marked$1.exports.lexer = Lexer.lex;
var Tokenizer_1 = marked$1.exports.Tokenizer = Tokenizer;
var Slugger_1 = marked$1.exports.Slugger = Slugger;

var marked_1 = marked$1.exports;

export { marked_1 as default };
export { Lexer_1 as Lexer, Parser_1 as Parser, Renderer_1 as Renderer, Slugger_1 as Slugger, TextRenderer_1 as TextRenderer, Tokenizer_1 as Tokenizer, marked_1 as default, lexer, parse, parser };
73 changes: 48 additions & 25 deletions lib/marked.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
*/

(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.marked = factory());
}(this, (function () { 'use strict';
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.marked = {}));
})(this, (function (exports) { 'use strict';

function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
Expand Down Expand Up @@ -69,6 +69,8 @@
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

var marked$1 = {exports: {}};

var defaults$5 = {exports: {}};

function getDefaults$1() {
Expand Down Expand Up @@ -468,7 +470,7 @@
*/


var Tokenizer_1 = /*#__PURE__*/function () {
var Tokenizer_1$1 = /*#__PURE__*/function () {
function Tokenizer(options) {
this.options = options || defaults$4;
}
Expand Down Expand Up @@ -1393,7 +1395,7 @@
inline: inline$1
};

var Tokenizer$1 = Tokenizer_1;
var Tokenizer$1 = Tokenizer_1$1;
var defaults$3 = defaults$5.exports.defaults;
var block = rules.block,
inline = rules.inline;
Expand Down Expand Up @@ -1440,7 +1442,7 @@
*/


var Lexer_1 = /*#__PURE__*/function () {
var Lexer_1$1 = /*#__PURE__*/function () {
function Lexer(options) {
this.tokens = [];
this.tokens.links = Object.create(null);
Expand Down Expand Up @@ -1960,7 +1962,7 @@
* Renderer
*/

var Renderer_1 = /*#__PURE__*/function () {
var Renderer_1$1 = /*#__PURE__*/function () {
function Renderer(options) {
this.options = options || defaults$2;
}
Expand Down Expand Up @@ -2109,7 +2111,7 @@
* returns only the textual part of the token
*/

var TextRenderer_1 = /*#__PURE__*/function () {
var TextRenderer_1$1 = /*#__PURE__*/function () {
function TextRenderer() {}

var _proto = TextRenderer.prototype;
Expand Down Expand Up @@ -2158,7 +2160,7 @@
* Slugger generates header id
*/

var Slugger_1 = /*#__PURE__*/function () {
var Slugger_1$1 = /*#__PURE__*/function () {
function Slugger() {
this.seen = {};
}
Expand Down Expand Up @@ -2214,16 +2216,16 @@
return Slugger;
}();

var Renderer$1 = Renderer_1;
var TextRenderer$1 = TextRenderer_1;
var Slugger$1 = Slugger_1;
var Renderer$1 = Renderer_1$1;
var TextRenderer$1 = TextRenderer_1$1;
var Slugger$1 = Slugger_1$1;
var defaults$1 = defaults$5.exports.defaults;
var unescape = helpers.unescape;
/**
* Parsing & Compiling
*/

var Parser_1 = /*#__PURE__*/function () {
var Parser_1$1 = /*#__PURE__*/function () {
function Parser(options) {
this.options = options || defaults$1;
this.options.renderer = this.options.renderer || new Renderer$1();
Expand Down Expand Up @@ -2559,12 +2561,12 @@
return Parser;
}();

var Lexer = Lexer_1;
var Parser = Parser_1;
var Tokenizer = Tokenizer_1;
var Renderer = Renderer_1;
var TextRenderer = TextRenderer_1;
var Slugger = Slugger_1;
var Lexer = Lexer_1$1;
var Parser = Parser_1$1;
var Tokenizer = Tokenizer_1$1;
var Renderer = Renderer_1$1;
var TextRenderer = TextRenderer_1$1;
var Slugger = Slugger_1$1;
var merge = helpers.merge,
checkSanitizeDeprecation = helpers.checkSanitizeDeprecation,
escape = helpers.escape;
Expand Down Expand Up @@ -2963,8 +2965,29 @@
marked.Tokenizer = Tokenizer;
marked.Slugger = Slugger;
marked.parse = marked;
var marked_1 = marked;

return marked_1;

})));
marked$1.exports = marked;
var parse = marked$1.exports.parse = marked;
var Parser_1 = marked$1.exports.Parser = Parser;
var parser = marked$1.exports.parser = Parser.parse;
var Renderer_1 = marked$1.exports.Renderer = Renderer;
var TextRenderer_1 = marked$1.exports.TextRenderer = TextRenderer;
var Lexer_1 = marked$1.exports.Lexer = Lexer;
var lexer = marked$1.exports.lexer = Lexer.lex;
var Tokenizer_1 = marked$1.exports.Tokenizer = Tokenizer;
var Slugger_1 = marked$1.exports.Slugger = Slugger;
var marked_1 = marked$1.exports;

exports.Lexer = Lexer_1;
exports.Parser = Parser_1;
exports.Renderer = Renderer_1;
exports.Slugger = Slugger_1;
exports.TextRenderer = TextRenderer_1;
exports.Tokenizer = Tokenizer_1;
exports["default"] = marked_1;
exports.lexer = lexer;
exports.parse = parse;
exports.parser = parser;

Object.defineProperty(exports, '__esModule', { value: true });

}));
2 changes: 1 addition & 1 deletion marked.min.js

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions src/marked.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,17 +326,21 @@ marked.parseInline = function(src, opt) {

marked.Parser = Parser;
marked.parser = Parser.parse;

marked.Renderer = Renderer;
marked.TextRenderer = TextRenderer;

marked.Lexer = Lexer;
marked.lexer = Lexer.lex;

marked.Tokenizer = Tokenizer;

marked.Slugger = Slugger;

marked.parse = marked;

module.exports = marked;
module.exports.parse = marked;
module.exports.Parser = Parser;
module.exports.parser = Parser.parse;
module.exports.Renderer = Renderer;
module.exports.TextRenderer = TextRenderer;
module.exports.Lexer = Lexer;
module.exports.lexer = Lexer.lex;
module.exports.Tokenizer = Tokenizer;
module.exports.Slugger = Slugger;