winglang / winglang/wing

Capture static files from inflight closures

Open
#2,297 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

✨ enhancement 🎨 sdk
Dominant language
TypeScript
Stars
5.4k
Forks
215
Avg merge
2h 9m
Merged PRs (30d)
27

Description

Feature Spec

It is now possible to reference local files from inflight:

bring cloud;
bring fs;

let files = Map<fs.File>{};

for file in fs.read_dir("./my-files") {
  files[file.name] = new fs.File(file.path);
}

let bucket = new cloud.Bucket();

new cloud.Function(inflight () => {
  for k in files.keys() {
    bucket.put(k, files.get(k));
  }
}) as "populate";

Since we are capturing the map files which contains a bunch of fs.File objects, Wing will take care of bundling the contents of these files into the inflight bundle so they can be used at runtime.

Use Cases

Reference static data from files in inflight

Implementation Notes

No response

Component

No response

Community Notes
  • Please vote by adding a 👍 reaction to the issue to help us prioritize.
  • If you are interested to work on this issue, please leave a comment.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how inflight closures capture values and how fs.File objects are represented during bundling. Then inspect the existing cloud.Function and file-handling entry points to determine where static contents should be collected. Done means files referenced through captured maps are available at runtime in the inflight bundle, with coverage for the provided example.

Written by the indexing model from the issue text.

Assessment

Tech stack
cloud, typescript
Domain
build-system, cloud, compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.