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
feat: include side files with NFT #1614
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
c52807a
feat: return `jsModuleFormat` property
eduardoboucas d1b747c
feat: add bundled paths to `inputs`
eduardoboucas c0be11c
feat: force bundler to NFT in V2 functions
eduardoboucas dab476c
chore: fix test
eduardoboucas 802e351
refactor: rename property
eduardoboucas 4d6cae3
feat: add CJS shim
eduardoboucas c418648
Merge branch 'main' into feat/nft-side-files
eduardoboucas d44555a
Merge branch 'main' into feat/nft-side-files
eduardoboucas 138f24b
feat: include side files when NFT is the default bundler
eduardoboucas 54858fb
chore: remove whitespace
eduardoboucas a8af287
chore: update test
eduardoboucas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
TIL about
junk
!