Skip to content

Commit

Permalink
Restore top level main, types
Browse files Browse the repository at this point in the history
Trying the approach of "type:module, cjs main".

There are scenarios with TS 5.1 where this will result in incorrect
types being loaded, if `module` and `moduleResolution` do not match.

However, this is a smaller hazard than not being able to use the module
at all. And the only node versions which would potentially be confused
by the "type:module" and a cjs main are long out of support (as in, they
can't even load the code, because they also didn't support private class
members), so that's not a relevant consideration.

If this does work and resolve the issue without any negative
consequences arising for a while, I'll make it the default for tshy, so
that it does not require an additional opt-in configuration.

Fix: #557
  • Loading branch information
isaacs committed Sep 27, 2023
1 parent e57c2e1 commit 58a3b25
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@
"name": "glob",
"description": "the most correct and second fastest glob implementation in JavaScript",
"version": "10.3.9",
"bin": "./dist/esm/bin.mjs",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/node-glob.git"
"type": "module",
"tshy": {
"main": true,
"exports": {
"./package.json": "./package.json",
".": "./src/index.ts"
}
},
"bin": "./dist/esm/bin.mjs",
"main": "./dist/commonjs/index.js",
"types": "./dist/commonjs/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
Expand All @@ -21,6 +27,10 @@
}
}
},
"repository": {
"type": "git",
"url": "git://github.com/isaacs/node-glob.git"
},
"files": [
"dist"
],
Expand Down Expand Up @@ -83,12 +93,5 @@
},
"engines": {
"node": ">=16 || 14 >=14.17"
},
"type": "module",
"tshy": {
"exports": {
"./package.json": "./package.json",
".": "./src/index.ts"
}
}
}

0 comments on commit 58a3b25

Please sign in to comment.