From 58a3b2568e1be84313f18621e4445813b8b9f332 Mon Sep 17 00:00:00 2001 From: isaacs Date: Tue, 26 Sep 2023 22:46:42 -0700 Subject: [PATCH] Restore top level main, types 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: https://github.com/isaacs/node-glob/issues/557 --- package.json | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index dbdb154f..73b8fe19 100644 --- a/package.json +++ b/package.json @@ -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", ".": { @@ -21,6 +27,10 @@ } } }, + "repository": { + "type": "git", + "url": "git://github.com/isaacs/node-glob.git" + }, "files": [ "dist" ], @@ -83,12 +93,5 @@ }, "engines": { "node": ">=16 || 14 >=14.17" - }, - "type": "module", - "tshy": { - "exports": { - "./package.json": "./package.json", - ".": "./src/index.ts" - } } }