From 63550bb8ec6ebdfd5dea88be4f71edd08298d751 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Raiti?= <46955459+Secreto31126@users.noreply.github.com> Date: Thu, 25 May 2023 20:12:29 -0300 Subject: [PATCH 1/9] Removed comments They looked ugly --- tsconfig.json | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index 2c9bea3f..5a3b1ccb 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,15 +1,15 @@ { "include": ["src/**/*"], "compilerOptions": { - "lib": ["ESNext"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ - "types": ["node", "undici"], /* Specify type package names to be included without being referenced in a source file. */ - "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ - "declarationMap": true, /* Create sourcemaps for d.ts files. */ - "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ - "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ - "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ - "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ - "strict": true, /* Enable all strict type-checking options. */ - "skipLibCheck": true /* Skip type checking all .d.ts files. */ + "lib": ["ESNext"], + "types": ["node", "undici"], + "declaration": true, + "declarationMap": true, + "emitDeclarationOnly": true, + "isolatedModules": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true } } From 7bb5bf52c0ed8496285a9c197ce465022033bab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Raiti?= <46955459+Secreto31126@users.noreply.github.com> Date: Thu, 25 May 2023 20:13:57 -0300 Subject: [PATCH 2/9] Removed * I think this might be the reason why the main import is broken --- package.json | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 086835e0..26c7bd0f 100644 --- a/package.json +++ b/package.json @@ -23,9 +23,17 @@ "import": "./lib/esm/messages/index.js", "require": "./lib/cjs/messages/index.js" }, - "./*": { - "import": "./lib/esm/*.js", - "require": "./lib/cjs/*.js" + "./setup/*": { + "import": "./lib/esm/setup/*.js", + "require": "./lib/cjs/setup/*.js" + }, + "./emitters": { + "import": "./lib/esm/emitters.d.ts", + "require": "./lib/cjs/emitters.d.ts" + }, + "./types": { + "import": "./lib/esm/types.js", + "require": "./lib/cjs/types.js" } }, "scripts": { From 7e2afe66eb20b6533692ca376bdcfc56f3ebfd3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Raiti?= <46955459+Secreto31126@users.noreply.github.com> Date: Thu, 25 May 2023 20:21:05 -0300 Subject: [PATCH 3/9] Trying again with the types folder --- package.json | 13 +++++++------ tsconfig.json | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 26c7bd0f..39456c1f 100644 --- a/package.json +++ b/package.json @@ -11,27 +11,30 @@ "files": [ "lib/**/*" ], - "types": "lib/esm/index.d.ts", + "types": "lib/types/index.d.ts", "module": "lib/esm/index.js", "main": "lib/cjs/index.js", "exports": { ".": { + "types": "./lib/types/index.d.ts", "import": "./lib/esm/index.js", "require": "./lib/cjs/index.js" }, "./messages": { + "types": "./lib/types/messages/index.d.ts", "import": "./lib/esm/messages/index.js", "require": "./lib/cjs/messages/index.js" }, "./setup/*": { + "types": "./lib/types/setup/*.d.ts", "import": "./lib/esm/setup/*.js", "require": "./lib/cjs/setup/*.js" }, "./emitters": { - "import": "./lib/esm/emitters.d.ts", - "require": "./lib/cjs/emitters.d.ts" + "types": "./lib/types/emitters.d.ts" }, "./types": { + "types": "./lib/types/types.d.ts", "import": "./lib/esm/types.js", "require": "./lib/cjs/types.js" } @@ -39,9 +42,7 @@ "scripts": { "build": "npm run build:code && npm run build:types", "build:code": "node -r dotenv/config build.js", - "build:types": "npm run build:types:esm && npm run build:types:cjs", - "build:types:esm": "tsc --outDir ./lib/esm && cp ./src/*.d.ts ./lib/esm", - "build:types:cjs": "tsc --outDir ./lib/cjs && cp ./src/*.d.ts ./lib/cjs", + "build:types": "tsc && cp ./src/*.d.ts ./lib/types", "test": "mocha", "test:build": "npm run build && npm run test", "test:watch": "mocha --reporter min --watch", diff --git a/tsconfig.json b/tsconfig.json index 5a3b1ccb..3cdfb1be 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,6 +2,7 @@ "include": ["src/**/*"], "compilerOptions": { "lib": ["ESNext"], + "outDir": "lib/types", "types": ["node", "undici"], "declaration": true, "declarationMap": true, From 881cecbe9d2eb75770a4ff7174f185ef2690010f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Raiti?= <46955459+Secreto31126@users.noreply.github.com> Date: Thu, 25 May 2023 23:21:45 -0300 Subject: [PATCH 4/9] Revert "Trying again with the types folder" This reverts commit 7e2afe66eb20b6533692ca376bdcfc56f3ebfd3a. --- package.json | 13 ++++++------- tsconfig.json | 1 - 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 39456c1f..26c7bd0f 100644 --- a/package.json +++ b/package.json @@ -11,30 +11,27 @@ "files": [ "lib/**/*" ], - "types": "lib/types/index.d.ts", + "types": "lib/esm/index.d.ts", "module": "lib/esm/index.js", "main": "lib/cjs/index.js", "exports": { ".": { - "types": "./lib/types/index.d.ts", "import": "./lib/esm/index.js", "require": "./lib/cjs/index.js" }, "./messages": { - "types": "./lib/types/messages/index.d.ts", "import": "./lib/esm/messages/index.js", "require": "./lib/cjs/messages/index.js" }, "./setup/*": { - "types": "./lib/types/setup/*.d.ts", "import": "./lib/esm/setup/*.js", "require": "./lib/cjs/setup/*.js" }, "./emitters": { - "types": "./lib/types/emitters.d.ts" + "import": "./lib/esm/emitters.d.ts", + "require": "./lib/cjs/emitters.d.ts" }, "./types": { - "types": "./lib/types/types.d.ts", "import": "./lib/esm/types.js", "require": "./lib/cjs/types.js" } @@ -42,7 +39,9 @@ "scripts": { "build": "npm run build:code && npm run build:types", "build:code": "node -r dotenv/config build.js", - "build:types": "tsc && cp ./src/*.d.ts ./lib/types", + "build:types": "npm run build:types:esm && npm run build:types:cjs", + "build:types:esm": "tsc --outDir ./lib/esm && cp ./src/*.d.ts ./lib/esm", + "build:types:cjs": "tsc --outDir ./lib/cjs && cp ./src/*.d.ts ./lib/cjs", "test": "mocha", "test:build": "npm run build && npm run test", "test:watch": "mocha --reporter min --watch", diff --git a/tsconfig.json b/tsconfig.json index 3cdfb1be..5a3b1ccb 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,7 +2,6 @@ "include": ["src/**/*"], "compilerOptions": { "lib": ["ESNext"], - "outDir": "lib/types", "types": ["node", "undici"], "declaration": true, "declarationMap": true, From 53c579a78b5c3627272ff0210aef2e9cca756aec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Raiti?= <46955459+Secreto31126@users.noreply.github.com> Date: Fri, 26 May 2023 03:35:02 -0300 Subject: [PATCH 5/9] If this was the issue, I will be really mad Or cry, both are possible --- build.js | 1 + 1 file changed, 1 insertion(+) diff --git a/build.js b/build.js index d3d37d53..27914e80 100644 --- a/build.js +++ b/build.js @@ -19,6 +19,7 @@ const sharedConfig = { // ESM await build({ ...sharedConfig, + format: "esm", outdir: "lib/esm" }); From 989eaee8ac77b392ea667cfc3833d9bd951c9878 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Raiti?= <46955459+Secreto31126@users.noreply.github.com> Date: Fri, 26 May 2023 03:41:18 -0300 Subject: [PATCH 6/9] Revert "Revert "Trying again with the types folder"" This reverts commit 881cecbe9d2eb75770a4ff7174f185ef2690010f. --- package.json | 13 +++++++------ tsconfig.json | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 26c7bd0f..39456c1f 100644 --- a/package.json +++ b/package.json @@ -11,27 +11,30 @@ "files": [ "lib/**/*" ], - "types": "lib/esm/index.d.ts", + "types": "lib/types/index.d.ts", "module": "lib/esm/index.js", "main": "lib/cjs/index.js", "exports": { ".": { + "types": "./lib/types/index.d.ts", "import": "./lib/esm/index.js", "require": "./lib/cjs/index.js" }, "./messages": { + "types": "./lib/types/messages/index.d.ts", "import": "./lib/esm/messages/index.js", "require": "./lib/cjs/messages/index.js" }, "./setup/*": { + "types": "./lib/types/setup/*.d.ts", "import": "./lib/esm/setup/*.js", "require": "./lib/cjs/setup/*.js" }, "./emitters": { - "import": "./lib/esm/emitters.d.ts", - "require": "./lib/cjs/emitters.d.ts" + "types": "./lib/types/emitters.d.ts" }, "./types": { + "types": "./lib/types/types.d.ts", "import": "./lib/esm/types.js", "require": "./lib/cjs/types.js" } @@ -39,9 +42,7 @@ "scripts": { "build": "npm run build:code && npm run build:types", "build:code": "node -r dotenv/config build.js", - "build:types": "npm run build:types:esm && npm run build:types:cjs", - "build:types:esm": "tsc --outDir ./lib/esm && cp ./src/*.d.ts ./lib/esm", - "build:types:cjs": "tsc --outDir ./lib/cjs && cp ./src/*.d.ts ./lib/cjs", + "build:types": "tsc && cp ./src/*.d.ts ./lib/types", "test": "mocha", "test:build": "npm run build && npm run test", "test:watch": "mocha --reporter min --watch", diff --git a/tsconfig.json b/tsconfig.json index 5a3b1ccb..3cdfb1be 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,6 +2,7 @@ "include": ["src/**/*"], "compilerOptions": { "lib": ["ESNext"], + "outDir": "lib/types", "types": ["node", "undici"], "declaration": true, "declarationMap": true, From d7750b780b80b1ab99dfc142c13aa3d3b1b0e155 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Raiti?= <46955459+Secreto31126@users.noreply.github.com> Date: Fri, 26 May 2023 05:31:52 -0300 Subject: [PATCH 7/9] Update package.json --- package.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/package.json b/package.json index 39456c1f..494c2485 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,12 @@ "import": "./lib/esm/messages/index.js", "require": "./lib/cjs/messages/index.js" }, + "./messages/*": { + "types": "./lib/types/messages/*.d.ts", + "import": "./lib/esm/messages/*.js", + "require": "./lib/cjs/messages/*.js" + }, + "./setup": null, "./setup/*": { "types": "./lib/types/setup/*.d.ts", "import": "./lib/esm/setup/*.js", From 8ae77eb3d7e1f273a479a29f0dd2f4d8384d3fce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Raiti?= <46955459+Secreto31126@users.noreply.github.com> Date: Fri, 26 May 2023 05:55:28 -0300 Subject: [PATCH 8/9] Crawling back to you Do I wanna know? --- package.json | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/package.json b/package.json index 494c2485..4cafc189 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,31 @@ "require": "./lib/cjs/types.js" } }, + "//": "https://github.com/andrewbranch/example-subpath-exports-ts-compat/blob/main/examples/node_modules/types-versions-wildcards/package.json", + "//": "Without this, IntelliSense will throw an error when importing subpaths ONLY on JS files, although it does run fine with Node.", + "//": "Even more stunishing: if included, IntelliSense works even BETTER than with TS.", + "typesVersions": { + "*": { + ".": [ + "lib/types/index.d.ts" + ], + "messages": [ + "lib/types/messages/index.d.ts" + ], + "messages/*": [ + "lib/types/messages/*.d.ts" + ], + "setup/*": [ + "lib/types/setup/*.d.ts" + ], + "emitters": [ + "lib/types/emitters.d.ts" + ], + "types": [ + "lib/types/types.d.ts" + ] + } + }, "scripts": { "build": "npm run build:code && npm run build:types", "build:code": "node -r dotenv/config build.js", From 8336305246628fe6b0bfd847e70d6dcb1c700502 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Raiti?= <46955459+Secreto31126@users.noreply.github.com> Date: Fri, 26 May 2023 06:17:11 -0300 Subject: [PATCH 9/9] Extra meassures --- package.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package.json b/package.json index 4cafc189..6c18c4cb 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "require": "./lib/cjs/messages/*.js" }, "./setup": null, + "./setup/index": null, "./setup/*": { "types": "./lib/types/setup/*.d.ts", "import": "./lib/esm/setup/*.js", @@ -59,6 +60,7 @@ "messages/*": [ "lib/types/messages/*.d.ts" ], + "setup/index": [], "setup/*": [ "lib/types/setup/*.d.ts" ],