Skip to content

Commit

Permalink
fix: path imports for typescript (#493)
Browse files Browse the repository at this point in the history
🎉 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`
  • Loading branch information
mrstork authored May 3, 2024
1 parent 4dcd0b5 commit aa417b7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
2 changes: 2 additions & 0 deletions internal.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// eslint-disable-next-line import/extensions
export * from './dist/internal.js'
24 changes: 18 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
{
"name": "@netlify/functions",
"main": "./dist/main.js",
"types": "./dist/main.d.ts",
"type": "commonjs",
"exports": {
".": {
"import": "./dist/main.mjs",
"require": "./dist/main.js"
"require": {
"types": "./dist/main.d.ts",
"default": "./dist/main.js"
},
"import": {
"types": "./dist/main.d.mts",
"default": "./dist/main.mjs"
}
},
"./internal": {
"import": "./dist/internal.mjs",
"require": "./dist/internal.js"
"require": {
"types": "./dist/internal.d.ts",
"default": "./dist/internal.js"
},
"import": {
"types": "./dist/internal.d.mts",
"default": "./dist/internal.mjs"
}
}
},
"version": "2.6.1",
Expand All @@ -19,7 +30,8 @@
"dist/**/*.js",
"dist/**/*.mjs",
"dist/**/*.d.ts",
"dist/**/*.d.mts"
"dist/**/*.d.mts",
"internal.d.ts"
],
"scripts": {
"build": "tsup src --format esm,cjs --dts --clean",
Expand Down

0 comments on commit aa417b7

Please sign in to comment.