Skip to content

Commit

Permalink
Fix cjs build and package entries
Browse files Browse the repository at this point in the history
  • Loading branch information
puzrin committed Nov 22, 2023
1 parent b8d1bf4 commit 5347c2d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
2 changes: 0 additions & 2 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ ignorePatterns:
- demo/
- dist/
- node_modules
- support/demo_template/sample.js
- benchmark/extra/
- rollup.config.js

rules:
accessor-pairs: 2
Expand Down
14 changes: 13 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@
],
"repository": "markdown-it/markdown-it",
"license": "MIT",
"main": "dist/markdown-it.js",
"module": "index.mjs",
"exports": {
".": {
"import": "./index.mjs",
"require": "./dist/markdown-it.js"
},
"./*": {
"require": "./*",
"import": "./*"
}
},
"bin": {
"markdown-it": "bin/markdown-it.mjs"
},
Expand All @@ -23,7 +35,7 @@
"gh-doc": "npm run doc && gh-pages -d apidoc -f",
"demo": "npm run lint && node support/build_demo.mjs",
"gh-demo": "npm run demo && gh-pages -d demo -f -b master -r git@github.com:markdown-it/markdown-it.github.io.git",
"browserify": "rollup -c support/rollup.config.js",
"browserify": "rollup -c support/rollup.config.mjs",
"benchmark-deps": "npm install --prefix benchmark/extra/ -g marked@0.3.6 commonmark@0.26.0 markdown-it/markdown-it.git#2.2.1",
"specsplit": "support/specsplit.mjs good -o test/fixtures/commonmark/good.txt && support/specsplit.mjs bad -o test/fixtures/commonmark/bad.txt && support/specsplit.mjs",
"todo": "grep 'TODO' -n -r ./lib 2>/dev/null",
Expand Down
10 changes: 5 additions & 5 deletions support/rollup.config.js → support/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import nodeResolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
import pkg from '../package.json';
import terser from '@rollup/plugin-terser';
import { readFileSync } from 'fs';

const pkg = JSON.parse(readFileSync(new URL('../package.json', import.meta.url)));

export default {
input: 'index.js',
input: 'index.mjs',
output: [
{
file: 'dist/markdown-it.js',
Expand All @@ -32,7 +33,7 @@ export default {
plugins: [
terser({
format: {
ascii_only: true,
ascii_only: true
}
})
]
Expand All @@ -41,7 +42,6 @@ export default {
plugins: [
nodeResolve({ preferBuiltins: true }),
commonjs(),
json({ namedExports: false }),
{
banner() {
return `/*! ${pkg.name} ${pkg.version} https://github.com/${pkg.repository} @license ${pkg.license} */`;
Expand Down

0 comments on commit 5347c2d

Please sign in to comment.