-
-
Notifications
You must be signed in to change notification settings - Fork 49
(JS) Expose handler function type to allow manual exporting of Lambda handler #248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
hugo-vrijswijk
wants to merge
11
commits into
typelevel:main
Choose a base branch
from
hugo-vrijswijk:expose-handler-fn
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
e175631
(JS) Expose handler function type to allow manual exporting of Lambda…
hugo-vrijswijk ce19f01
make handlerFn final
hugo-vrijswijk 8face8d
add scripted test
hugo-vrijswijk b110099
update docs
hugo-vrijswijk afe6f14
update scripted test to use esm like in readme
hugo-vrijswijk eca166f
Update sbt-npm-package
hugo-vrijswijk ffd412a
Set tlBaseVersion to 0.2
hugo-vrijswijk d012d73
Remove main and handlerName for JS lambda
hugo-vrijswijk acdfc25
Update readme
hugo-vrijswijk 9d4173d
Merge remote-tracking branch 'origin/main' into expose-handler-fn
hugo-vrijswijk 6e9bee9
update scripted tests
hugo-vrijswijk 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
5 changes: 5 additions & 0 deletions
5
sbt-lambda/src/sbt-test/lambda-js-plugin/iolambda-es/build.sbt
This file contains hidden or 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,5 @@ | ||
| import _root_.io.circe.syntax._ | ||
|
|
||
| scalaVersion := "2.13.8" | ||
| enablePlugins(LambdaJSPlugin) | ||
| scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.ESModule)) |
1 change: 1 addition & 0 deletions
1
sbt-lambda/src/sbt-test/lambda-js-plugin/iolambda-es/project/build.properties
This file contains hidden or 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 @@ | ||
| sbt.version=1.7.1 |
1 change: 1 addition & 0 deletions
1
sbt-lambda/src/sbt-test/lambda-js-plugin/iolambda-es/project/plugins.sbt
This file contains hidden or 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 @@ | ||
| addSbtPlugin("org.typelevel" % "sbt-feral-lambda" % sys.props("plugin.version")) |
10 changes: 10 additions & 0 deletions
10
sbt-lambda/src/sbt-test/lambda-js-plugin/iolambda-es/src/main/scala/mySimpleHandler.scala
This file contains hidden or 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,10 @@ | ||
| import cats.effect._ | ||
| import feral.lambda._ | ||
| import scala.scalajs.js.annotation._ | ||
|
|
||
| object mySimpleHandler extends IOLambda.Simple[Unit, INothing] { | ||
| def apply(event: Unit, context: Context[IO], init: Init): IO[Option[INothing]] = IO.none | ||
|
|
||
| @JSExportTopLevel("mySimpleHandler") | ||
| val impl: HandlerFn = handlerFn | ||
| } |
This file contains hidden or 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,4 @@ | ||
| > npmPackage | ||
| $ exists target/scala-2.13/npm-package/index.js | ||
| $ exists target/scala-2.13/npm-package/package.json | ||
| $ exec node test-export.mjs |
5 changes: 5 additions & 0 deletions
5
sbt-lambda/src/sbt-test/lambda-js-plugin/iolambda-es/test-export.mjs
This file contains hidden or 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,5 @@ | ||
| if (typeof (await import('./target/scala-2.13/npm-package/index.js')).mySimpleHandler === 'function') { | ||
| process.exit(0); | ||
| } else { | ||
| process.exit(1); | ||
| } |
4 changes: 4 additions & 0 deletions
4
...lambda/src/sbt-test/lambda-js-plugin/iolambda-simple/src/main/scala/mySimpleHandler.scala
This file contains hidden or 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 |
|---|---|---|
| @@ -1,6 +1,10 @@ | ||
| import cats.effect._ | ||
| import feral.lambda._ | ||
| import scala.scalajs.js.annotation._ | ||
|
|
||
| object mySimpleHandler extends IOLambda.Simple[Unit, INothing] { | ||
| def apply(event: Unit, context: Context[IO], init: Init): IO[Option[INothing]] = IO.none | ||
|
|
||
| @JSExportTopLevel("mySimpleHandler") | ||
| val impl: HandlerFn = handlerFn | ||
| } |
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.
Uh oh!
There was an error while loading. Please reload this page.