Skip to content

Commit

Permalink
simplify the TS build: output a simpler structure based on the source…
Browse files Browse the repository at this point in the history
… structure, with type definitions and source maps, in a way that is as compatible with vanilla ES Modules as possible
  • Loading branch information
trusktr committed Jul 5, 2023
1 parent f78f1e8 commit 7052543
Show file tree
Hide file tree
Showing 193 changed files with 676 additions and 814 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js → .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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
'import/order': [
'warn',
{
Expand Down
7 changes: 7 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"Xrequire": "@babel/register",
"Xexperimental-specifier-resolution=node": "",
"node-option": [
"loader=ts-node/esm"
]
}
1 change: 0 additions & 1 deletion .mocharc.yml

This file was deleted.

8 changes: 4 additions & 4 deletions benchmark/benchmark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import fs from 'fs';
import path from 'path';
import { gitP } from 'simple-git';
import { argv } from 'yargs';
import { parseLanguageNames } from '../tests/helper/test-case';
import { config as baseConfig } from './config';
import type { Prism } from '../src/core';
import type { Config, ConfigOptions } from './config';
import { parseLanguageNames } from '../tests/helper/test-case.js';
import { config as baseConfig } from './config.js';
import type { Prism } from '../src/core.js';
import type { Config, ConfigOptions } from './config.js';
import type { Options, Stats } from 'benchmark';


Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
"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",
"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",
"prepare": "npm run build",
"lint": "eslint . --cache",
"lint:fix": "npm run lint -- --fix",
Expand All @@ -24,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"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit 7052543

Please sign in to comment.