Skip to content

Commit

Permalink
Merge pull request #202 from remarkablemark/feat/es-module
Browse files Browse the repository at this point in the history
feat: add ES Module support
  • Loading branch information
remarkablemark committed Feb 5, 2022
2 parents 996b5c9 + 4b84404 commit f782440
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ jobs:
- name: Run server test
run: npm run test:server

- name: Run ES modules tests
run: npm run test:module

- name: Run server test
run: npm run test:server

- name: Run client test
uses: GabrielBB/xvfb-action@v1
with:
Expand Down
3 changes: 3 additions & 0 deletions index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import HTMLDOMParser from './index.js';

export default HTMLDOMParser;
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
"description": "HTML to DOM parser.",
"author": "Mark <mark@remarkablemark.org>",
"main": "index.js",
"module": "index.mjs",
"exports": {
"import": "./index.mjs",
"require": "./index.js"
},
"scripts": {
"build": "rollup --config",
"clean": "rm -rf dist",
Expand All @@ -18,6 +23,7 @@
"test:client": "npm run test:client:watch -- --single-run",
"test:client:build": "webpack --config webpack.test.config.js",
"test:client:watch": "npm run test:client:build && karma start",
"test:module": "node --experimental-modules test/module/index.mjs",
"test:server": "nyc mocha test/server"
},
"repository": {
Expand Down Expand Up @@ -76,6 +82,8 @@
"files": [
"/dist",
"/index.d.ts",
"/index.js",
"/index.mjs",
"/lib"
],
"browser": {
Expand Down
4 changes: 4 additions & 0 deletions test/module/index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import assert from 'assert';
import HTMLDOMParser from '../../index.mjs';

assert.strictEqual(typeof HTMLDOMParser, 'function');

0 comments on commit f782440

Please sign in to comment.