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

chore: add typescript build and sourcemaps #173

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added earcut-3.0.0.tgz
Binary file not shown.
7,852 changes: 5,046 additions & 2,806 deletions package-lock.json

Large diffs are not rendered by default.

20 changes: 12 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,35 @@
"name": "earcut",
"version": "3.0.0",
"description": "The fastest and smallest JavaScript polygon triangulation library for your WebGL apps",
"main": "src/earcut.js",
"main": "./dist/earcut.esm.js",
"type": "module",
"exports": "./src/earcut.js",
"types": "./dist/earcut.d.ts",
"files": [
"src/earcut.js",
"dist/earcut.min.js",
"dist/earcut.dev.js"
"dist"
],
"scripts": {
"pretest": "eslint src test/test.js bench/*.js viz/viz.js",
"test": "node --test",
"build": "rollup -c",
"test": "vitest",
"build": "rollup -c && tsc -p tsconfig.build.json",
"prepublishOnly": "npm run build",
"cov": "node --test --experimental-test-coverage"
"cov": "vitest run --coverage"
},
"author": "Vladimir Agafonkin",
"license": "ISC",
"devDependencies": {
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.6",
"@vitest/coverage-v8": "^2.0.2",
"benchmark": "^2.1.4",
"coveralls": "^3.1.1",
"esbuild": "^0.23.0",
"eslint": "^9.5.0",
"eslint-config-mourner": "^4.0.1",
"rollup": "^4.18.0",
"tslib": "^2.6.3",
"typescript": "^5.5.3",
"uglify-js": "^3.18.0",
"vitest": "^2.0.2",
"watchify": "^4.0.0"
},
"eslintConfig": {
Expand Down
18 changes: 12 additions & 6 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
import terser from '@rollup/plugin-terser';
import typescript from '@rollup/plugin-typescript';

const config = (file, plugins) => ({
input: 'src/earcut.js',
/**
* @returns {import('rollup').RollupOptions}
*/
const config = (file, plugins, format) => ({
input: 'src/earcut.ts',
output: {
name: 'earcut',
exports: 'named',
format: 'umd',
format: format,
indent: false,
file
file,
sourcemap: true
},
plugins
});

export default [
config('dist/earcut.dev.js', []),
config('dist/earcut.min.js', [terser()])
config('dist/earcut.dev.js', [typescript()], "umd"),
config('dist/earcut.min.js', [typescript(), terser()], "umd"),
config('dist/earcut.esm.js', [typescript()], "esm"),
];
Loading