Skip to content

Commit

Permalink
refactor: code and support files cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Septh committed Jan 30, 2024
1 parent 27bf5b7 commit cffc835
Show file tree
Hide file tree
Showing 10 changed files with 209 additions and 202 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules/
/lib
zz*
*.tgz
169 changes: 103 additions & 66 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 14 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,43 +30,42 @@
"url": "https://paypal.me/septh07"
}
],
"engines": {
"node": ">=21 || ^20.6.0 || ^18.19.0"
},
"type": "module",
"bin": {
"ts-run": "lib/index.js"
"ts-run": "./lib/index.js"
},
"engines": {
"node": ">= 21 || ^20.6.0 || ^18.19.0"
},
"engineStrict": true,
"exports": {
"./register": "./lib/index.js"
},
"files": [
"./lib",
"!*.map"
],
"publishConfig": {
"access": "public"
},
"scripts": {
"prebuild": "rimraf lib",
"build": "rollup --config",
"watch": "npm run build -- --watch",
"test": "ts-run test/check-node-21.ts && node --import=@septh/ts-run/register --test test/**/*.test.*"
"test": "ts-run test/check-node-21.ts && node --import=@septh/ts-run/register --test test/**/*.test.{ts,mts,cts}"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.6",
"@types/node": "^20.10.7",
"@types/node": "^20.11.10",
"rimraf": "^5.0.5",
"rollup": "^4.9.6",
"rollup-plugin-node-externals": "^6.1.2",
"rollup-plugin-node-externals": "^7.0.1",
"sucrase": "^3.35.0",
"tslib": "^2.6.2",
"typescript": "^5.3.3"
},
"files": [
"./lib",
"!*.map"
],
"publishConfig": {
"access": "public"
},
"np": {
"yarn": false,
"cleanup": false
Expand Down
13 changes: 7 additions & 6 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ export default defineConfig([
exports: 'named',
generatedCode: 'es2015',
sourcemap: true,
sourcemapExcludeSources: true,
minifyInternalExports: false
sourcemapExcludeSources: true
},
plugins: [
nodeExternals(),
Expand All @@ -35,19 +34,21 @@ export default defineConfig([
{
input: 'source/cjs-transform.cts',
output: {
dir: 'lib',
file: 'lib/cjs-transform.cjs',
format: 'commonjs',
exports: 'named',
generatedCode: 'es2015',
esModule: 'if-default-prop',
esModule: false,
sourcemap: true,
sourcemapExcludeSources: true,
minifyInternalExports: false
sourcemapExcludeSources: true
},
plugins: [
nodeExternals(),
nodeResolve(),
commonsJS(),
// Not sure why but this is the only way I've found
// to have @rollup/plugin-typescript compile this file
// the way I wanted.
typescript({
include: './source/cjs-transform.cts',
exclude: './node-modules',
Expand Down
9 changes: 9 additions & 0 deletions source/module.d.ts → source/ambient.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ declare global {
interface Module {
_compile(code: string, filename: string): string
}

interface NodeError {
code: string
}

type ModuleType = 'commonjs' | 'module'
interface PkgType {
type?: ModuleType
}
}
}

Expand Down
Loading

0 comments on commit cffc835

Please sign in to comment.