Skip to content
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

feat: external inflight typescript files #6305

Merged
merged 26 commits into from May 27, 2024
Merged

Conversation

MarkMcCulloh
Copy link
Contributor

@MarkMcCulloh MarkMcCulloh commented Apr 23, 2024

Fixes #6045

This PR introduces a new utility function @inflight. This allows you to create an inflight closure from an external file with specific lifts:

// main.w
bring cloud;
let bucket = new cloud.Bucket();
let queue = new cloud.Queue();

bucket.onCreate(@inflight("./bucket_create.ts",
  export: "default",
//        ^ Optional named export from the file, default is the default export
  lifts:[{ obj: queue, alias: "myQueue", ops: ["push"] }],
//       ^ object to lift, can be any preflight expression
//                     ^ Optional alias, by default, this will be the variable name passed to obj
//                                     ^ methods to lift, if not provided then all methods will be granted
));
// bucket_create.ts
import inflight from "./.bucket_create.inflight";

export default inflight(async ({ myQueue }, file) => {
//                               ^ inflight interface to your preflight queue
  await myQueue.push(file);
});

By submitting this pull request, I confirm that my contribution is made under the terms of the Wing Cloud Contribution License.

Copy link

github-actions bot commented Apr 23, 2024

Thanks for opening this pull request! 🎉
Please consult the contributing guidelines for details on how to contribute to this project.
If you need any assistence, don't hesitate to ping the relevant owner over Discord.

Topic Owner
Wing SDK and utility APIs @chriscbr
Wing Console @ainvoner, @skyrpex, @polamoros
JSON, structs, primitives and collections @hasanaburayyan
Platforms and plugins @hasanaburayyan
Frontend resources (website, react, etc) @tsuf239
Language design @chriscbr
VSCode extension and language server @markmcculloh
Compiler architecture, inflights, lifting @yoav-steinberg
Wing Testing Framework @tsuf239
Wing CLI @markmcculloh
Build system, dev environment, releases @markmcculloh
Library Ecosystem @chriscbr
Documentation @hasanaburayyan
SDK test suite @tsuf239
Examples @hasanaburayyan
Wing Playground @eladcon

@monadabot
Copy link
Contributor

monadabot commented Apr 23, 2024

Console preview environment is available at https://wing-console-pr-6305.fly.dev 🚀

Last Updated (UTC) 2024-05-27 01:19

@monadabot
Copy link
Contributor

monadabot commented Apr 23, 2024

Benchmarks

Comparison to Baseline 🟥⬜⬜🟥⬜⬜⬜⬜⬜⬜⬜⬜⬜
Benchmark Before After Change
version 56ms±0.58 58ms±0.66 +3ms (+4.65%)🟥
functions_10.test.w -t sim 495ms±7.74 510ms±8.05 +15ms (+2.94%)⬜
functions_10.test.w -t tf-aws 2025ms±25.31 2079ms±18.42 +54ms (+2.68%)⬜
hello_world.test.w -t sim 399ms±3.7 411ms±5.69 +12ms (+3.01%)🟥
hello_world.test.w -t tf-aws 1441ms±9.86 1445ms±9.28 +3ms (+0.24%)⬜
functions_1.test.w -t sim 395ms±6.09 399ms±3.17 +3ms (+0.78%)⬜
functions_1.test.w -t tf-aws 817ms±4.91 829ms±8.33 +12ms (+1.5%)⬜
jsii_big.test.w -t sim 2793ms±16.04 2801ms±9.01 +8ms (+0.29%)⬜
jsii_big.test.w -t tf-aws 2996ms±12.38 2995ms±13.44 -1ms (-0.04%)⬜
empty.test.w -t sim 360ms±5.07 364ms±4.48 +4ms (+1.15%)⬜
empty.test.w -t tf-aws 593ms±4.03 594ms±3.85 +1ms (+0.23%)⬜
jsii_small.test.w -t sim 373ms±2.63 372ms±5.13 -1ms (-0.17%)⬜
jsii_small.test.w -t tf-aws 612ms±4.93 607ms±5.1 -5ms (-0.85%)⬜

⬜ Within 1.5 standard deviations
🟩 Faster, Above 1.5 standard deviations
🟥 Slower, Above 1.5 standard deviations

Benchmarks may vary outside of normal expectations, especially when running in GitHub Actions CI.

Results
name mean min max moe sd
version 58ms 57ms 60ms 1ms 1ms
functions_10.test.w -t sim 510ms 488ms 521ms 8ms 11ms
functions_10.test.w -t tf-aws 2079ms 2035ms 2121ms 18ms 26ms
hello_world.test.w -t sim 411ms 404ms 426ms 6ms 8ms
hello_world.test.w -t tf-aws 1445ms 1426ms 1477ms 9ms 13ms
functions_1.test.w -t sim 399ms 395ms 409ms 3ms 4ms
functions_1.test.w -t tf-aws 829ms 811ms 849ms 8ms 12ms
jsii_big.test.w -t sim 2801ms 2783ms 2824ms 9ms 13ms
jsii_big.test.w -t tf-aws 2995ms 2966ms 3025ms 13ms 19ms
empty.test.w -t sim 364ms 354ms 374ms 4ms 6ms
empty.test.w -t tf-aws 594ms 585ms 602ms 4ms 5ms
jsii_small.test.w -t sim 372ms 363ms 384ms 5ms 7ms
jsii_small.test.w -t tf-aws 607ms 596ms 618ms 5ms 7ms
Last Updated (UTC) 2024-05-26 22:47

@monadabot monadabot added the ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! label Apr 24, 2024
@MarkMcCulloh MarkMcCulloh removed the ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! label Apr 24, 2024
@winglang winglang deleted a comment from mergify bot May 17, 2024
libs/wingc/src/ast.rs Outdated Show resolved Hide resolved
examples/tests/valid/intrinsics.test.w Show resolved Hide resolved
libs/wingc/src/dtsify/extern_dtsify.rs Show resolved Hide resolved
libs/wingc/src/jsify.rs Show resolved Hide resolved
libs/wingc/src/type_check.rs Outdated Show resolved Hide resolved
libs/wingc/src/jsify.rs Show resolved Hide resolved
libs/wingc/src/jsify.rs Outdated Show resolved Hide resolved
libs/wingc/src/jsify.rs Outdated Show resolved Hide resolved
examples/tests/valid/intrinsics.test.w Outdated Show resolved Hide resolved
examples/tests/valid/intrinsics.test.w Outdated Show resolved Hide resolved
@MarkMcCulloh MarkMcCulloh marked this pull request as ready for review May 24, 2024 20:20
@MarkMcCulloh MarkMcCulloh requested a review from a team as a code owner May 24, 2024 20:20
@monadabot monadabot added the ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! label May 26, 2024
@MarkMcCulloh MarkMcCulloh removed the ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! label May 27, 2024
Copy link
Contributor

mergify bot commented May 27, 2024

Thanks for contributing, @MarkMcCulloh! This PR will now be added to the merge queue, or immediately merged if mark/intrinsic-inflight is up-to-date with main and the queue is empty.

@mergify mergify bot merged commit 72f7128 into main May 27, 2024
25 checks passed
@mergify mergify bot deleted the mark/intrinsic-inflight branch May 27, 2024 01:30
@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.74.17.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implicitly typed extern expression
5 participants