Skip to content

Commit aa417b7

Browse files
authored
fix: path imports for typescript (#493)
🎉 Thanks for sending this pull request! 🎉 Please make sure the title is clear and descriptive. If you are fixing a typo or documentation, please skip these instructions. Otherwise please fill in the sections below. **Which problem is this pull request solving?** See https://github.com/netlify/functions/actions/runs/8939586357/job/24555907790 **Describe the solution you've chosen** Remove export block to support node 10 and allow internal to be imported **Describe alternatives you've considered** Linking `internal.ts` in `main.ts`, however we look to want to keep these seperate **Checklist** Please add a `x` inside each checkbox: - [x] I have read the [contribution guidelines](../blob/master/CONTRIBUTING.md). - [x] The status checks are successful (continuous integration). Those can be seen below. - [x] Passed `npm run test:publish` - [x] Tested change with `npm link @netlify/functions`
1 parent 4dcd0b5 commit aa417b7

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

internal.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// eslint-disable-next-line import/extensions
2+
export * from './dist/internal.js'

package.json

+18-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
11
{
22
"name": "@netlify/functions",
33
"main": "./dist/main.js",
4-
"types": "./dist/main.d.ts",
54
"type": "commonjs",
65
"exports": {
76
".": {
8-
"import": "./dist/main.mjs",
9-
"require": "./dist/main.js"
7+
"require": {
8+
"types": "./dist/main.d.ts",
9+
"default": "./dist/main.js"
10+
},
11+
"import": {
12+
"types": "./dist/main.d.mts",
13+
"default": "./dist/main.mjs"
14+
}
1015
},
1116
"./internal": {
12-
"import": "./dist/internal.mjs",
13-
"require": "./dist/internal.js"
17+
"require": {
18+
"types": "./dist/internal.d.ts",
19+
"default": "./dist/internal.js"
20+
},
21+
"import": {
22+
"types": "./dist/internal.d.mts",
23+
"default": "./dist/internal.mjs"
24+
}
1425
}
1526
},
1627
"version": "2.6.1",
@@ -19,7 +30,8 @@
1930
"dist/**/*.js",
2031
"dist/**/*.mjs",
2132
"dist/**/*.d.ts",
22-
"dist/**/*.d.mts"
33+
"dist/**/*.d.mts",
34+
"internal.d.ts"
2335
],
2436
"scripts": {
2537
"build": "tsup src --format esm,cjs --dts --clean",

0 commit comments

Comments
 (0)