This repository has been archived by the owner on May 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: include side files with NFT (#1614)
* feat: return `jsModuleFormat` property * feat: add bundled paths to `inputs` * feat: force bundler to NFT in V2 functions * chore: fix test * refactor: rename property * feat: add CJS shim * feat: include side files when NFT is the default bundler * chore: remove whitespace * chore: update test
- Loading branch information
1 parent
9f3dab8
commit bf7a4ac
Showing
12 changed files
with
100 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import type { Stats } from 'fs' | ||
import { basename } from 'path' | ||
|
||
import { isJunk } from 'junk' | ||
|
||
import { glob } from '../../../../utils/matching.js' | ||
|
||
/** | ||
* Takes a function path and, if it's a directory, returns a list of all the | ||
* nested files, recursively, except `node_modules` and junk files. | ||
*/ | ||
export const getSideFiles = async function (functionPath: string, stat: Stats): Promise<string[]> { | ||
if (!stat.isDirectory()) { | ||
return [] | ||
} | ||
|
||
const paths = await glob(`${functionPath}/**`, { | ||
absolute: true, | ||
cwd: functionPath, | ||
ignore: `**/node_modules/**`, | ||
nodir: true, | ||
}) | ||
|
||
return paths.filter((path) => !isJunk(basename(path))) | ||
} |
Empty file.
3 changes: 3 additions & 0 deletions
3
tests/fixtures/directory-side-files/function-v1/function-v1.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
exports.handler = () => ({ | ||
body: "Hello" | ||
}) |
3 changes: 3 additions & 0 deletions
3
tests/fixtures/directory-side-files/function-v1/node_modules/fake-module/package.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Robots are nice 🤖 |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default async () => new Response("Hello") |
3 changes: 3 additions & 0 deletions
3
tests/fixtures/directory-side-files/function-v2/node_modules/fake-module/package.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Robots are nice 🤖 |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bf7a4ac
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⏱ Benchmark results