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

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

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-24 20:32

@monadabot
Copy link
Contributor

monadabot commented Apr 23, 2024

Benchmarks

Comparison to Baseline ⬜⬜🟥⬜⬜⬜🟥⬜⬜⬜🟥⬜🟥
Benchmark Before After Change
version 58ms±1.52 61ms±1.16 +2ms (+3.66%)⬜
functions_1.test.w -t sim 400ms±18 401ms±3.19 +2ms (+0.45%)⬜
functions_1.test.w -t tf-aws 811ms±5.77 832ms±7.56 +21ms (+2.59%)🟥
jsii_big.test.w -t sim 2794ms±10.1 2796ms±21.21 +2ms (+0.07%)⬜
jsii_big.test.w -t tf-aws 3005ms±15.87 3010ms±22.16 +6ms (+0.18%)⬜
functions_10.test.w -t sim 486ms±6.28 494ms±8.33 +8ms (+1.56%)⬜
functions_10.test.w -t tf-aws 2015ms±10.11 2059ms±20.4 +44ms (+2.2%)🟥
jsii_small.test.w -t sim 367ms±4.52 375ms±3.43 +8ms (+2.12%)⬜
jsii_small.test.w -t tf-aws 616ms±5.65 609ms±8.02 -7ms (-1.1%)⬜
empty.test.w -t sim 363ms±7.21 369ms±3.85 +6ms (+1.75%)⬜
empty.test.w -t tf-aws 589ms±4.44 604ms±6.44 +15ms (+2.53%)🟥
hello_world.test.w -t sim 394ms±4.37 398ms±4.18 +4ms (+1.11%)⬜
hello_world.test.w -t tf-aws 1497ms±5.11 1540ms±16.67 +43ms (+2.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 61ms 59ms 64ms 1ms 2ms
functions_1.test.w -t sim 401ms 393ms 409ms 3ms 4ms
functions_1.test.w -t tf-aws 832ms 818ms 856ms 8ms 11ms
jsii_big.test.w -t sim 2796ms 2758ms 2854ms 21ms 30ms
jsii_big.test.w -t tf-aws 3010ms 2965ms 3071ms 22ms 31ms
functions_10.test.w -t sim 494ms 471ms 511ms 8ms 12ms
functions_10.test.w -t tf-aws 2059ms 2010ms 2098ms 20ms 29ms
jsii_small.test.w -t sim 375ms 368ms 382ms 3ms 5ms
jsii_small.test.w -t tf-aws 609ms 596ms 633ms 8ms 11ms
empty.test.w -t sim 369ms 362ms 377ms 4ms 5ms
empty.test.w -t tf-aws 604ms 592ms 620ms 6ms 9ms
hello_world.test.w -t sim 398ms 389ms 407ms 4ms 6ms
hello_world.test.w -t tf-aws 1540ms 1515ms 1598ms 17ms 23ms
Last Updated (UTC) 2024-04-24 21:05

@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

// @inflight

let counter = new cloud.Counter();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's an issue with the Wing Console watch. It gets into an infinite reload loop because the inflight.ts file gets recreated and invalidates the watch.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even when there's no change to the types? I specifically wanted to make sure the file isn't updated in that case so I'll look into it.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implicitly typed extern expression
4 participants