fix: Create separate CJS and UMD builds (#2281)

This commit is contained in:
Ben McCann 2021-11-12 13:38:04 -08:00 committed by GitHub
parent bc1027fd3e
commit 62faaf4c91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 5586 additions and 2652 deletions

View File

@ -9,11 +9,9 @@
* The code in this file is generated from files in ./src/
*/
(function (global, factory) {
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';
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
@ -2907,7 +2905,3 @@
exports.setOptions = setOptions;
exports.use = use;
exports.walkTokens = walkTokens;
Object.defineProperty(exports, '__esModule', { value: true });
}));

2913
lib/marked.umd.js Normal file

File diff suppressed because one or more lines are too long

2
marked.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -6,7 +6,7 @@
"type": "module",
"main": "./lib/marked.cjs",
"module": "./lib/marked.esm.js",
"browser": "./lib/marked.cjs",
"browser": "./lib/marked.umd.js",
"bin": {
"marked": "bin/marked.js"
},

View File

@ -2,10 +2,10 @@ const commonjs = require('@rollup/plugin-commonjs');
const babel = require('@rollup/plugin-babel').default;
const license = require('rollup-plugin-license');
module.exports = {
module.exports = [{
input: 'src/marked.js',
output: {
file: 'lib/marked.cjs',
file: 'lib/marked.umd.js',
format: 'umd',
name: 'marked'
},
@ -28,4 +28,31 @@ https://github.com/markedjs/marked
presets: [['@babel/preset-env', { loose: true }]]
})
]
};
},
{
input: 'src/marked.js',
output: {
file: 'lib/marked.cjs',
format: 'cjs',
name: 'marked'
},
plugins: [
license({
banner: `
DO NOT EDIT THIS FILE
The code in this file is generated from files in ./src/
`
}),
license({
banner: `
marked - a markdown parser
Copyright (c) 2011-${new Date().getFullYear()}, Christopher Jeffrey. (MIT Licensed)
https://github.com/markedjs/marked
`
}),
commonjs(),
babel({
presets: [['@babel/preset-env', { loose: true }]]
})
]
}];