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

Separates web and node bundles #43

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kdiogenes
Copy link

No description provided.

@kdiogenes kdiogenes mentioned this pull request Jan 27, 2023
7 tasks
Copy link
Owner

@Mr0grog Mr0grog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I did not describe this adequately in #42; Webpack stuff is not what I was referring to by “separate entrypoints.” I don’t think anything about Webpack should be involved in publishing to NPM at all.

This was meant to be about package entrypoints, which are a package.json feature. You can define different code for browser-based packagers (e.g. Webpack, Rollup, etc.) and non-browsers (Node.js runtime, Bun, etc.) to pick up when importing/requiring the module, rather than different builds that have to be run before publishing. I don’t think we should need any kind of build step here for publishing on NPM and for library/CLI usage.

In general I’d also prefer to see rehype-parse used as well, rather than adding new steps to parsing by bringing in JSDOM (unless there’s a compelling reason not to).

Comment on lines +1 to +5
import { convertToMarkdown } from './lib/convert.js';
import jsdom from 'jsdom';

global.DOMParser = new jsdom.JSDOM().window.DOMParser;
global.convertToMarkdown = convertToMarkdown;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was there a reason not to use retype-parse here instead, which has the same interface as rehype-dom-parse, rather than adding extra steps and opportunities for problems (e.g. script injection issues)?

"path-browserify": "^1.0.1",
"rehype-dom-parse": "^4.0.2",
"rehype-remark": "^9.1.2",
"remark-stringify": "^7.0.4",
"unified": "^10.1.2",
"unist-util-visit": "^4.1.0",
"utf-8-validate": "^5.0.10",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this being used anywhere? What was it added for?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants