-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Simplified ESM build #3704
base: v2
Are you sure you want to change the base?
Simplified ESM build #3704
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ module.exports = { | |
'eqeqeq': ['error', 'always', { 'null': 'ignore' }], | ||
|
||
// imports | ||
'import/extensions': ['warn', 'never'], | ||
'import/extensions': ['warn', 'always'], // "always" is most compatible with default vanilla ES Modules | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Having If we remove the |
||
'import/order': [ | ||
'warn', | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"Xrequire": "@babel/register", | ||
"Xexperimental-specifier-resolution=node": "", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
"node-option": [ | ||
"loader=ts-node/esm" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This makes |
||
] | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,14 +2,16 @@ | |
"name": "prismjs", | ||
"version": "1.29.0", | ||
"description": "Lightweight, robust, elegant syntax highlighting. A spin-off project from Dabblet.", | ||
"main": "prism.js", | ||
"type": "module", | ||
"main": "dist/core/prism.js", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Opt into the modern Node ESM standard, and point to the main file to get Prism from (there was no more |
||
"style": "themes/prism.css", | ||
"engines": { | ||
"node": ">=14" | ||
}, | ||
"scripts": { | ||
"benchmark": "ts-node benchmark/benchmark.ts", | ||
"build": "ts-node scripts/build.ts", | ||
"build": "ts-node-esm scripts/build.ts && npm run tsc", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Running with |
||
"prepare": "npm run build", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is from #3699 |
||
"lint": "eslint . --cache", | ||
"lint:fix": "npm run lint -- --fix", | ||
"lint:ci": "eslint . --max-warnings 0", | ||
|
@@ -23,7 +25,8 @@ | |
"test:plugins": "ts-mocha tests/plugins/**/*.ts", | ||
"test:runner": "ts-mocha tests/testrunner-tests.ts", | ||
"test": "npm-run-all test:*", | ||
"tsc": "tsc && tsc -p tests/tsconfig.json" | ||
"typecheck": "tsc --noEmit && tsc -p tests/tsconfig.json --noEmit", | ||
"tsc": "tsc" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We use a plain and simple We should probably cover the other TS files as well, currently this covers only src/ and tests/. |
||
}, | ||
"repository": { | ||
"type": "git", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is the only remnant of CommonJS in the repo (apart from the dependencies which I haven't updated yet).
In the upcoming ESLint v9, the new "flat config" format will also be in Node ESM format, and we'll have to move ESLint config to ESM at that point.