From 71e8fc75dd0a9da97b9d41fa5fccd213d5471acd Mon Sep 17 00:00:00 2001 From: Mark McCulloh Date: Fri, 12 Apr 2024 09:56:18 -0400 Subject: [PATCH] feat: typescript and esm in preflight (#6157) Fixes #3013 ~TODO~ - [x] Check benchmarks to make sure happy path perf isn't hurt - [x] Windows - [x] ~Add e2e test to verify fix for `"type": "module"`~ Doesn't fix that issue anymore - [x] Docs to officially sanction using ts in both preflight and inflight via extern *By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*. --- apps/wingcli-v2/src/main.rs | 17 +- docs/docs/03-language-reference.md | 11 +- docs/docs/07-examples/10-using-javascript.md | 4 +- examples/tests/invalid/extern_static.test.w | 2 +- examples/tests/invalid/lib/extern_above.w | 2 +- examples/tests/valid/bring_local.test.w | 6 + .../tests/valid/extern_implementation.test.w | 20 +- examples/tests/valid/external_js.js | 25 --- ...js.extern.d.ts => external_ts.extern.d.ts} | 2 +- examples/tests/valid/external_ts.ts | 31 +++ examples/tests/valid/subdir/subfile.w | 3 +- examples/tests/valid/subdir/util.extern.d.ts | 1 + examples/tests/valid/subdir/util.ts | 4 + .../src/dtsify/snapshots/declarations.snap | 2 + .../wingc/src/dtsify/snapshots/optionals.snap | 2 + libs/wingc/src/jsify.rs | 14 +- ...methods_and_properties_on_collections.snap | 1 + .../access_property_on_primitive.snap | 1 + ...rty_on_value_returned_from_collection.snap | 1 + .../base_class_captures_inflight.snap | 1 + .../base_class_captures_preflight.snap | 1 + .../snapshots/base_class_lift_indirect.snap | 1 + .../base_class_with_fields_inflight.snap | 1 + .../base_class_with_fields_preflight.snap | 1 + .../base_class_with_lifted_field_object.snap | 1 + .../base_class_with_lifted_fields.snap | 1 + libs/wingc/src/jsify/snapshots/builtins.snap | 1 + ..._static_inflight_from_static_inflight.snap | 1 + .../calls_methods_on_preflight_object.snap | 1 + ...pture_from_inside_an_inflight_closure.snap | 1 + ...entifier_closure_from_preflight_scope.snap | 1 + ...pture_identifier_from_preflight_scope.snap | 1 + ...from_preflight_scope_with_method_call.snap | 1 + ...om_preflight_scope_with_nested_object.snap | 1 + ...er_from_preflight_scope_with_property.snap | 1 + .../snapshots/capture_in_keyword_args.snap | 1 + .../capture_object_with_this_in_name.snap | 1 + .../src/jsify/snapshots/capture_token.snap | 1 + ...type_inflight_class_sibling_from_init.snap | 1 + ...pe_inflight_class_sibling_from_method.snap | 1 + ...e_new_inflight_class_inner_no_capture.snap | 1 + ...capture_type_new_inflight_class_outer.snap | 1 + .../snapshots/capture_type_static_method.snap | 1 + ...ure_type_static_method_inflight_class.snap | 1 + .../capture_var_from_method_inflight.snap | 1 + ...ht_class_extends_outer_inflight_class.snap | 1 + .../src/jsify/snapshots/closure_field.snap | 1 + .../src/jsify/snapshots/entrypoint_this.snap | 1 + .../wingc/src/jsify/snapshots/enum_value.snap | 1 + .../free_inflight_obj_from_inflight.snap | 1 + .../free_preflight_object_from_preflight.snap | 1 + .../jsify/snapshots/func_returns_func.snap | 1 + .../src/jsify/snapshots/identify_field.snap | 1 + .../implicit_lift_inflight_init.snap | 1 + .../src/jsify/snapshots/indirect_capture.snap | 1 + ..._extends_both_inside_inflight_closure.snap | 1 + ...inflight_class_extends_inflight_class.snap | 1 + .../jsify/snapshots/inflight_constructor.snap | 1 + .../src/jsify/snapshots/inflight_field.snap | 1 + .../inflight_field_from_inflight.snap | 1 + .../inflight_field_from_inflight_class.snap | 1 + .../snapshots/inline_inflight_class.snap | 1 + .../src/jsify/snapshots/json_object.snap | 1 + ...ary_preflight_and_inflight_expression.snap | 1 + .../lift_binary_preflight_expression.snap | 1 + ...lift_element_from_collection_as_field.snap | 1 + ...ft_element_from_collection_of_objects.snap | 1 + .../snapshots/lift_inflight_closure.snap | 1 + .../lift_inside_preflight_method.snap | 1 + .../jsify/snapshots/lift_self_reference.snap | 1 + .../src/jsify/snapshots/lift_string.snap | 1 + libs/wingc/src/jsify/snapshots/lift_this.snap | 1 + .../jsify/snapshots/lift_var_with_this.snap | 1 + .../src/jsify/snapshots/lift_via_closure.snap | 1 + .../lift_via_closure_class_explicit.snap | 1 + .../namespaced_static_from_inflight.snap | 1 + ...ed_inflight_after_preflight_operation.snap | 1 + .../snapshots/nested_preflight_operation.snap | 1 + .../jsify/snapshots/new_inflight_object.snap | 1 + .../snapshots/no_capture_inside_methods.snap | 1 + ...apture_of_identifier_from_inner_scope.snap | 1 + ...capture_of_identifier_from_same_scope.snap | 1 + ...no_capture_shadow_inside_inner_scopes.snap | 1 + .../no_lift_shadow_inside_inner_scopes.snap | 1 + ...eflight_class_extends_preflight_class.snap | 1 + .../jsify/snapshots/preflight_collection.snap | 1 + ...light_collection_of_preflight_objects.snap | 1 + ...eflight_nested_object_with_operations.snap | 1 + .../src/jsify/snapshots/preflight_object.snap | 1 + .../preflight_object_through_property.snap | 1 + .../preflight_object_with_operations.snap | 1 + ...ject_with_operations_multiple_methods.snap | 1 + .../snapshots/preflight_value_field.snap | 1 + .../jsify/snapshots/read_primitive_value.snap | 1 + .../snapshots/reassign_captured_variable.snap | 1 + ...eassigned_captured_variable_preflight.snap | 1 + .../src/jsify/snapshots/ref_std_macro.snap | 1 + .../reference_from_static_inflight.snap | 1 + .../snapshots/reference_inflight_class.snap | 1 + .../snapshots/reference_inflight_field.snap | 1 + .../reference_inflight_from_inflight.snap | 1 + .../reference_lift_of_collection.snap | 1 + .../snapshots/reference_preflight_field.snap | 1 + ...eflight_field_call_independent_method.snap | 1 + .../snapshots/reference_preflight_fields.snap | 1 + ..._variable_with_this_in_the_expression.snap | 1 + ...preflight_object_from_static_inflight.snap | 1 + .../snapshots/reference_static_inflight.snap | 1 + ...ght_which_references_preflight_object.snap | 1 + .../static_external_inflight_class.snap | 1 + .../static_external_preflight_class.snap | 1 + .../snapshots/static_inflight_operation.snap | 1 + .../static_local_inflight_class.snap | 1 + .../jsify/snapshots/static_on_std_type.snap | 1 + .../jsify/snapshots/transitive_reference.snap | 1 + ...ansitive_reference_via_inflight_class.snap | 1 + .../transitive_reference_via_static.snap | 1 + .../jsify/snapshots/two_identical_lifts.snap | 1 + .../jsify/snapshots/use_util_functions.snap | 1 + .../var_inflight_field_from_inflight.snap | 1 + libs/wingc/src/jsify/snapshots/wait_util.snap | 1 + libs/wingcompiler/.npmignore | 3 - libs/wingcompiler/jest.config.js | 6 - libs/wingcompiler/package.json | 4 +- libs/wingcompiler/preflight.shim.cjs | 51 +++++ libs/wingcompiler/src/compile.ts | 56 ++---- libs/wingsdk/.projen/deps.json | 4 + libs/wingsdk/.projenrc.ts | 1 + libs/wingsdk/package.json | 2 + libs/wingsdk/src/helpers.ts | 26 ++- libs/wingsdk/src/target-sim/queue.inflight.ts | 6 +- libs/wingsdk/src/target-sim/queue.ts | 37 ++-- .../__snapshots__/file-counter.test.ts.snap | 1 + .../__snapshots__/queue.test.ts.snap | 2 + pnpm-lock.yaml | 20 +- tools/hangar/__snapshots__/invalid.ts.snap | 8 +- .../anon_function.test.w_compile_tf-aws.md | 1 + .../valid/api.test.w_compile_tf-aws.md | 1 + .../api_cors_custom.test.w_compile_tf-aws.md | 1 + .../api_cors_default.test.w_compile_tf-aws.md | 1 + .../api_valid_path.test.w_compile_tf-aws.md | 1 + .../valid/assert.test.w_compile_tf-aws.md | 1 + ...wait_in_functions.test.w_compile_tf-aws.md | 1 + .../test_corpus/valid/baz.w_compile_tf-aws.md | 1 + .../bring_alias.test.w_compile_tf-aws.md | 1 + .../bring_awscdk.test.w_compile_tf-aws.md | 1 + .../bring_cdk8s.test.w_compile_tf-aws.md | 1 + .../bring_cdktf.test.w_compile_tf-aws.md | 1 + ..._extend_non_entry.test.w_compile_tf-aws.md | 2 + .../valid/bring_jsii.test.w_compile_tf-aws.md | 1 + .../bring_local.test.w_compile_tf-aws.md | 66 +++++++ .../valid/bring_local.test.w_test_sim.md | 3 +- .../bring_local_dir.test.w_compile_tf-aws.md | 6 + ...cal_normalization.test.w_compile_tf-aws.md | 4 + .../bring_projen.test.w_compile_tf-aws.md | 1 + ...ring_wing_library.test.w_compile_tf-aws.md | 8 +- .../bucket_keys.test.w_compile_tf-aws.md | 1 + .../bypass_return.test.w_compile_tf-aws.md | 1 + ..._static_of_myself.test.w_compile_tf-aws.md | 1 + ...inflight_variants.test.w_compile_tf-aws.md | 1 + ...apture_containers.test.w_compile_tf-aws.md | 1 + ...capture_in_binary.test.w_compile_tf-aws.md | 1 + .../capture_mutables.test.w_compile_tf-aws.md | 1 + ...apture_primitives.test.w_compile_tf-aws.md | 1 + ...gable_class_field.test.w_compile_tf-aws.md | 1 + ...ture_reassignable.test.w_compile_tf-aws.md | 1 + ...resource_and_data.test.w_compile_tf-aws.md | 1 + ..._with_no_inflight.test.w_compile_tf-aws.md | 1 + .../capture_tokens.test.w_compile_tf-aws.md | 1 + .../valid/captures.test.w_compile_tf-aws.md | 1 + .../valid/casting.test.w_compile_tf-aws.md | 1 + .../valid/class.test.w_compile_tf-aws.md | 1 + .../closure_class.test.w_compile_tf-aws.md | 1 + .../construct-base.test.w_compile_tf-aws.md | 1 + .../container_types.test.w_compile_tf-aws.md | 1 + .../custom_obj_id.test.w_compile_tf-aws.md | 1 + .../valid/debug_env.test.w_compile_tf-aws.md | 1 + .../deep_equality.test.w_compile_tf-aws.md | 1 + .../double_reference.test.w_compile_tf-aws.md | 1 + .../valid/doubler.test.w_compile_tf-aws.md | 1 + .../valid/enums.test.w_compile_tf-aws.md | 1 + ...ift_qualification.test.w_compile_tf-aws.md | 1 + ..._binary_operators.test.w_compile_tf-aws.md | 1 + ...ing_interpolation.test.w_compile_tf-aws.md | 1 + .../extend_non_entrypoint.w_compile_tf-aws.md | 1 + ...rn_implementation.test.w_compile_tf-aws.md | 183 ++++++++++++++++-- .../file_counter.test.w_compile_tf-aws.md | 1 + .../valid/for_loop.test.w_compile_tf-aws.md | 1 + .../forward_decl.test.w_compile_tf-aws.md | 1 + ..._returns_function.test.w_compile_tf-aws.md | 1 + .../function_type.test.w_compile_tf-aws.md | 1 + ...ariadic_arguments.test.w_compile_tf-aws.md | 1 + .../valid/hello.test.w_compile_tf-aws.md | 1 + ...entical_inflights.test.w_compile_tf-aws.md | 1 + .../impl_interface.test.w_compile_tf-aws.md | 1 + .../implicit_std.test.w_compile_tf-aws.md | 1 + ...n_scope_construct.test.w_compile_tf-aws.md | 1 + .../valid/inference.test.w_compile_tf-aws.md | 1 + ...light-subscribers.test.w_compile_tf-aws.md | 1 + ...ht_capture_static.test.w_compile_tf-aws.md | 1 + ...as_struct_members.test.w_compile_tf-aws.md | 1 + ...ass_capture_const.test.w_compile_tf-aws.md | 1 + ..._preflight_object.test.w_compile_tf-aws.md | 1 + ...class_definitions.test.w_compile_tf-aws.md | 1 + ...r_capture_mutable.test.w_compile_tf-aws.md | 1 + ..._inflight_closure.test.w_compile_tf-aws.md | 1 + ...t_class_modifiers.test.w_compile_tf-aws.md | 1 + ..._inflight_closure.test.w_compile_tf-aws.md | 1 + ..._interace_handler.test.w_compile_tf-aws.md | 1 + ...lass_without_init.test.w_compile_tf-aws.md | 1 + ...ht_closure_autoid.test.w_compile_tf-aws.md | 1 + ...preflight_closure.test.w_compile_tf-aws.md | 1 + .../inflight_concat.test.w_compile_tf-aws.md | 1 + ...handler_singleton.test.w_compile_tf-aws.md | 1 + .../inflight_init.test.w_compile_tf-aws.md | 1 + ...calling_inflights.test.w_compile_tf-aws.md | 1 + ...erit_stdlib_class.test.w_compile_tf-aws.md | 1 + ...ce_class_inflight.test.w_compile_tf-aws.md | 1 + ...e_class_preflight.test.w_compile_tf-aws.md | 1 + ...ritance_interface.test.w_compile_tf-aws.md | 1 + .../valid/interface.test.w_compile_tf-aws.md | 1 + .../valid/issue_2889.test.w_compile_tf-aws.md | 1 + .../valid/json.test.w_compile_tf-aws.md | 1 + .../json_bucket.test.w_compile_tf-aws.md | 1 + .../json_static.test.w_compile_tf-aws.md | 1 + ...ing_interpolation.test.w_compile_tf-aws.md | 1 + ...ft_expr_with_this.test.w_compile_tf-aws.md | 1 + ...losure_collection.test.w_compile_tf-aws.md | 1 + ...ift_parent_fields.test.w_compile_tf-aws.md | 1 + ...lift_redefinition.test.w_compile_tf-aws.md | 1 + ...t_shared_resource.test.w_compile_tf-aws.md | 1 + .../valid/lift_this.test.w_compile_tf-aws.md | 1 + .../lift_via_closure.test.w_compile_tf-aws.md | 1 + ..._closure_explicit.test.w_compile_tf-aws.md | 1 + .../lift_weird_order.test.w_compile_tf-aws.md | 1 + ...ft_with_phase_ind.test.w_compile_tf-aws.md | 1 + .../map_entries.test.w_compile_tf-aws.md | 1 + ...t_container_types.test.w_compile_tf-aws.md | 1 + ..._after_class_init.test.w_compile_tf-aws.md | 1 + .../new_in_static.test.w_compile_tf-aws.md | 1 + .../valid/new_jsii.test.w_compile_tf-aws.md | 1 + .../valid/nil.test.w_compile_tf-aws.md | 1 + .../valid/on_lift.test.w_compile_tf-aws.md | 1 + .../valid/optionals.test.w_compile_tf-aws.md | 1 + .../parameters.test.w_compile_tf-aws.md | 1 + .../parameters.test.w_compile_tf-aws.md | 1 + ..._method_on_string.test.w_compile_tf-aws.md | 1 + ...primitive_methods.test.w_compile_tf-aws.md | 1 + .../valid/print.test.w_compile_tf-aws.md | 1 + .../reassignment.test.w_compile_tf-aws.md | 1 + .../valid/redis.test.w_compile_tf-aws.md | 1 + .../valid/resource.test.w_compile_tf-aws.md | 1 + ..._inflight_literal.test.w_compile_tf-aws.md | 1 + ...ource_call_static.test.w_compile_tf-aws.md | 1 + ...resource_captures.test.w_compile_tf-aws.md | 1 + ..._captures_globals.test.w_compile_tf-aws.md | 1 + .../valid/service.test.w_compile_tf-aws.md | 1 + .../valid/shadowing.test.w_compile_tf-aws.md | 1 + .../statements_if.test.w_compile_tf-aws.md | 1 + ...able_declarations.test.w_compile_tf-aws.md | 1 + .../static_members.test.w_compile_tf-aws.md | 1 + .../std_containers.test.w_compile_tf-aws.md | 1 + .../valid/std_string.test.w_compile_tf-aws.md | 1 + .../valid/store.w_compile_tf-aws.md | 2 + .../struct_from_json.test.w_compile_tf-aws.md | 3 + .../valid/structs.test.w_compile_tf-aws.md | 1 + .../valid/super_call.test.w_compile_tf-aws.md | 1 + .../symbol_shadow.test.w_compile_tf-aws.md | 1 + .../valid/table.test.w_compile_tf-aws.md | 1 + .../test_bucket.test.w_compile_tf-aws.md | 1 + ...est_without_bring.test.w_compile_tf-aws.md | 1 + .../valid/this.test.w_compile_tf-aws.md | 1 + .../valid/try_catch.test.w_compile_tf-aws.md | 1 + .../unused_lift.test.w_compile_tf-aws.md | 1 + ...side_init_closure.test.w_compile_tf-aws.md | 1 + .../website_with_api.test.w_compile_tf-aws.md | 1 + .../valid/while.test.w_compile_tf-aws.md | 1 + .../while_loop_await.test.w_compile_tf-aws.md | 1 + 278 files changed, 745 insertions(+), 143 deletions(-) delete mode 100644 examples/tests/valid/external_js.js rename examples/tests/valid/{external_js.extern.d.ts => external_ts.extern.d.ts} (99%) create mode 100644 examples/tests/valid/external_ts.ts delete mode 100644 libs/wingcompiler/.npmignore delete mode 100644 libs/wingcompiler/jest.config.js create mode 100644 libs/wingcompiler/preflight.shim.cjs diff --git a/apps/wingcli-v2/src/main.rs b/apps/wingcli-v2/src/main.rs index e08beda3d53..2e2f21457ad 100644 --- a/apps/wingcli-v2/src/main.rs +++ b/apps/wingcli-v2/src/main.rs @@ -10,8 +10,6 @@ use lazy_static::lazy_static; use strum::{Display, EnumString}; use wingc::compile; -pub const VERSION: &str = env!("CARGO_PKG_VERSION"); - lazy_static! { static ref HOME_PATH: PathBuf = home_dir().expect("Could not find home directory"); pub static ref WING_CACHE_DIR: Utf8PathBuf = @@ -90,6 +88,10 @@ fn command_build(source_file: Utf8PathBuf, target: Option) -> Result<(), install_sdk()?; } else { // TODO: check that the SDK version matches the CLI version + if cfg!(test) { + // For now, always reinstall the SDK in tests + install_sdk()?; + } } tracing::info!("Using SDK at {}", sdk_root); @@ -117,10 +119,13 @@ fn install_sdk() -> Result<(), Box> { std::fs::create_dir_all(WING_CACHE_DIR.as_str())?; let mut install_command = std::process::Command::new("npm"); - install_command - .arg("install") - .arg(format!("@winglang/sdk@{VERSION}")) - .arg("esbuild"); // TODO: should this not be an optional dependency? + install_command.arg("install").arg("esbuild"); // TODO: should this not be an optional dependency? + if cfg!(test) { + install_command.arg(format!("file:{}/../../libs/wingsdk", env!("CARGO_MANIFEST_DIR"))); + } else { + install_command.arg(format!("@winglang/sdk@{}", env!("CARGO_PKG_VERSION"))); + } + install_command.current_dir(WING_CACHE_DIR.as_str()); install_command.stdout(std::process::Stdio::piped()); install_command.stderr(std::process::Stdio::piped()); diff --git a/docs/docs/03-language-reference.md b/docs/docs/03-language-reference.md index 1a4e9324d2e..f5f3c8a8b92 100644 --- a/docs/docs/03-language-reference.md +++ b/docs/docs/03-language-reference.md @@ -1885,7 +1885,8 @@ Mapping JSII types to Wing types: ## 5.2 JavaScript -The `extern ""` modifier can be used on method declarations in classes to indicate that a method is backed by an implementation imported from a JavaScript module. The module must be a relative path and will be loaded via [require()](https://nodejs.org/api/modules.html#requireid). +The `extern ""` modifier can be used on method declarations in classes to indicate that a method is backed by an implementation imported from a JavaScript module. The module must be a relative path and will be loaded via [require()](https://nodejs.org/api/modules.html#requireid). +This module can be either CJS or ESM and may be written in JavaScript or TypeScript. In the following example, the static inflight method `makeId` is implemented in `helper.js`: @@ -1920,13 +1921,7 @@ matching name (without any case conversion). Extern methods do not support access to class's members through `this`, so they must be declared `static`. -### 5.2.1 TypeScript - -It is possible to use TypeScript to write helpers, but at the moment this is not -directly supported by Wing. This means that you will need to setup the TypeScript toolchain -to compile your code to JavaScript and then use `extern` against the JavaScript file. - -### 5.2.2 Type model +### 5.2.1 Type model The table below shows the mapping between Wing types and JavaScript values, shown with TypeScript types. When calling **extern** function, the parameter and return types are **assumed** to be satisfied by the called function. diff --git a/docs/docs/07-examples/10-using-javascript.md b/docs/docs/07-examples/10-using-javascript.md index 4b7b6640e63..bc944c3d0b2 100644 --- a/docs/docs/07-examples/10-using-javascript.md +++ b/docs/docs/07-examples/10-using-javascript.md @@ -6,7 +6,7 @@ keywords: [example, javascript, extern, typescript, js, ts] Calling a Javascript function from Wing requires two steps. -1. Create a .js file that exports some functions +1. Create a .js/.ts file that exports some functions ```js // util.js @@ -16,7 +16,7 @@ exports.isValidUrl = function (url) { }; ``` -In preflight, this file must be a CommonJS module written in Javascript. Inflight, it may be CJS/ESM and either JavaScript or TypeScript. +It may be CJS/ESM written in either JavaScript or TypeScript. 2. Use the `extern` keyword in a class to expose the function to Wing. Note that this must be `static`. It may also be `inflight` diff --git a/examples/tests/invalid/extern_static.test.w b/examples/tests/invalid/extern_static.test.w index 8efcc58d8b2..6d055e48d46 100644 --- a/examples/tests/invalid/extern_static.test.w +++ b/examples/tests/invalid/extern_static.test.w @@ -1,4 +1,4 @@ class Foo { - extern "../valid/external_js.js" inflight getGreeting(name: str): str; + extern "../valid/external_ts.ts" inflight getGreeting(name: str): str; //^ Error: extern methods must be declared "static" } diff --git a/examples/tests/invalid/lib/extern_above.w b/examples/tests/invalid/lib/extern_above.w index ca7dde0c303..12cfea9af23 100644 --- a/examples/tests/invalid/lib/extern_above.w +++ b/examples/tests/invalid/lib/extern_above.w @@ -1,4 +1,4 @@ class Foo1 { - extern "../../valid/external_js.js" static getGreeting(name: str): str; + extern "../../valid/external_ts.ts" static getGreeting(name: str): str; //^ must be a sub directory of the entrypoint } diff --git a/examples/tests/valid/bring_local.test.w b/examples/tests/valid/bring_local.test.w index 1e6a6bb7443..6dd61c46cdd 100644 --- a/examples/tests/valid/bring_local.test.w +++ b/examples/tests/valid/bring_local.test.w @@ -5,15 +5,21 @@ bring "./store.w" as file1; bring "./subdir/subfile.w" as file2; bring "./subdir/empty.w" as file3; bring math; +bring expect; // classes from other files can be used let store = new file1.Store(); let q = new file2.Q(); +expect.equal(file2.Q.preflightGreet("foo"), "Hello foo"); test "add data to store" { store.store("foo"); } +test "greet" { + expect.equal(file2.Q.greet("bar"), "Hello bar"); +} + // structs from other files can be used let s = file1.Point { x: 1, diff --git a/examples/tests/valid/extern_implementation.test.w b/examples/tests/valid/extern_implementation.test.w index 10d7bdfa8a3..75c23452fe6 100644 --- a/examples/tests/valid/extern_implementation.test.w +++ b/examples/tests/valid/extern_implementation.test.w @@ -1,12 +1,12 @@ bring cloud; class Foo { - extern "./external_js.js" pub static getGreeting(name: str): str; - extern "./external_js.js" static inflight regexInflight(pattern: str, text: str): bool; - extern "./external_js.js" static inflight getUuid(): str; - extern "./external_js.js" static inflight getData(): str; - extern "./external_js.js" pub static inflight print(msg: str): void; - extern "./external_js.js" pub static preflightBucket(bucket: cloud.Bucket, id: str): Json; + extern "./external_ts.ts" pub static getGreeting(name: str): str; + extern "./external_ts.ts" static inflight regexInflight(pattern: str, text: str): bool; + extern "./external_ts.ts" static inflight getUuid(): str; + extern "./external_ts.ts" static inflight getData(): str; + extern "./external_ts.ts" pub static inflight print(msg: str): void; + extern "./external_ts.ts" pub static preflightBucket(bucket: cloud.Bucket, id: str): void; pub inflight call() { assert(Foo.regexInflight("[a-z]+-\\d+", "abc-123")); @@ -22,10 +22,14 @@ assert(Foo.getGreeting("Wingding") == "Hello, Wingding!"); let f = new Foo(); let bucket = new cloud.Bucket() as "my-bucket"; -let result = Foo.preflightBucket(bucket, "my-bucket"); +Foo.preflightBucket(bucket, "my-bucket"); -test "call" { +let func = new cloud.Function(inflight () => { f.call(); +}); + +test "call" { + func.invoke(); } test "console" { diff --git a/examples/tests/valid/external_js.js b/examples/tests/valid/external_js.js deleted file mode 100644 index 2c054a63d9c..00000000000 --- a/examples/tests/valid/external_js.js +++ /dev/null @@ -1,25 +0,0 @@ -const assert = require("node:assert"); - -/** @type {import("./external_js.extern").default} */ -module.exports = { - getGreeting(name) { - return `Hello, ${name}!`; - }, - preflightBucket(bucket, id) { - assert.strictEqual(bucket.node.id, id); - }, - async regexInflight(pattern, text) { - const regex = new RegExp(pattern); - return regex.test(text); - }, - async getUuid() { - let uuid = require("uuid"); - return uuid.v4(); - }, - async getData() { - return require("./exported_data.js"); - }, - async print(msg) { - console.log(`printing ${msg}`); - }, -}; diff --git a/examples/tests/valid/external_js.extern.d.ts b/examples/tests/valid/external_ts.extern.d.ts similarity index 99% rename from examples/tests/valid/external_js.extern.d.ts rename to examples/tests/valid/external_ts.extern.d.ts index 079bebe0c07..5d10ff6b79d 100644 --- a/examples/tests/valid/external_js.extern.d.ts +++ b/examples/tests/valid/external_ts.extern.d.ts @@ -2,7 +2,7 @@ export default interface extern { getData: () => Promise, getGreeting: (name: string) => string, getUuid: () => Promise, - preflightBucket: (bucket: Bucket, id: string) => Readonly, + preflightBucket: (bucket: Bucket, id: string) => void, print: (msg: string) => Promise, regexInflight: (pattern: string, text: string) => Promise, } diff --git a/examples/tests/valid/external_ts.ts b/examples/tests/valid/external_ts.ts new file mode 100644 index 00000000000..6c0189d6a22 --- /dev/null +++ b/examples/tests/valid/external_ts.ts @@ -0,0 +1,31 @@ +import assert from "assert"; +import extern from "./external_ts.extern"; + +export const getGreeting: extern["getGreeting"] = function (name) { + return `Hello, ${name}!`; +}; + +export const regexInflight: extern["regexInflight"] = async function ( + pattern, + text +) { + const regex = new RegExp(pattern); + return regex.test(text); +}; + +export const getUuid: extern["getUuid"] = async function () { + let uuid = require("uuid"); + return uuid.v4(); +}; + +export const getData: extern["getData"] = async function () { + return require("./exported_data.js"); +}; + +export const print: extern["print"] = async function (msg) { + console.log(`printing ${msg}`); +}; + +export const preflightBucket: extern["preflightBucket"] = (bucket, id) => { + assert.strictEqual(bucket.node.id, id); +}; diff --git a/examples/tests/valid/subdir/subfile.w b/examples/tests/valid/subdir/subfile.w index 0981074aee2..7c6556ebd2e 100644 --- a/examples/tests/valid/subdir/subfile.w +++ b/examples/tests/valid/subdir/subfile.w @@ -1,5 +1,6 @@ bring math; pub class Q { - extern "./util.ts" static inflight greet(name: str): str; + pub extern "./util.ts" static inflight greet(name: str): str; + pub extern "./util.ts" static preflightGreet(name: str): str; } diff --git a/examples/tests/valid/subdir/util.extern.d.ts b/examples/tests/valid/subdir/util.extern.d.ts index d941b3480e7..2f2cb7cf7c1 100644 --- a/examples/tests/valid/subdir/util.extern.d.ts +++ b/examples/tests/valid/subdir/util.extern.d.ts @@ -1,3 +1,4 @@ export default interface extern { greet: (name: string) => Promise, + preflightGreet: (name: string) => string, } diff --git a/examples/tests/valid/subdir/util.ts b/examples/tests/valid/subdir/util.ts index 833d6b144c2..325859f7d58 100644 --- a/examples/tests/valid/subdir/util.ts +++ b/examples/tests/valid/subdir/util.ts @@ -2,4 +2,8 @@ import type extern from "./util.extern"; export const greet: extern["greet"] = async (name) => { return "Hello " + name; +} + +export const preflightGreet: extern["preflightGreet"] = (name) => { + return "Hello " + name; } diff --git a/libs/wingc/src/dtsify/snapshots/declarations.snap b/libs/wingc/src/dtsify/snapshots/declarations.snap index f9e95917a17..1633a1efb69 100644 --- a/libs/wingc/src/dtsify/snapshots/declarations.snap +++ b/libs/wingc/src/dtsify/snapshots/declarations.snap @@ -79,6 +79,7 @@ module.exports = function({ }) { const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); module.exports = { ...require("./preflight.lib-1.cjs"), }; @@ -98,6 +99,7 @@ export * from "./preflight.lib-1.cjs" const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class ParentClass extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); diff --git a/libs/wingc/src/dtsify/snapshots/optionals.snap b/libs/wingc/src/dtsify/snapshots/optionals.snap index dbd16fdea9f..6d761424825 100644 --- a/libs/wingc/src/dtsify/snapshots/optionals.snap +++ b/libs/wingc/src/dtsify/snapshots/optionals.snap @@ -45,6 +45,7 @@ module.exports = function({ }) { const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); module.exports = { ...require("./preflight.lib-1.cjs"), }; @@ -64,6 +65,7 @@ export * from "./preflight.lib-1.cjs" const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class ParentClass extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); diff --git a/libs/wingc/src/jsify.rs b/libs/wingc/src/jsify.rs index 44837b81953..3537edd537b 100644 --- a/libs/wingc/src/jsify.rs +++ b/libs/wingc/src/jsify.rs @@ -48,6 +48,7 @@ const ENV_WING_IS_TEST: &str = "$wing_is_test"; const OUTDIR_VAR: &str = "$outdir"; const PLATFORMS_VAR: &str = "$platforms"; const HELPERS_VAR: &str = "$helpers"; +const EXTERN_VAR: &str = "$extern"; const ROOT_CLASS: &str = "$Root"; const JS_CONSTRUCTOR: &str = "constructor"; @@ -170,7 +171,7 @@ impl<'a> JSifier<'a> { output.line("\"use strict\";"); - output.line(format!("const {} = require('{}');", STDLIB, STDLIB_MODULE)); + output.line(format!("const {STDLIB} = require('{STDLIB_MODULE}');")); if is_entrypoint { output.line(format!( @@ -187,6 +188,9 @@ impl<'a> JSifier<'a> { // "std" is implicitly imported output.line(format!("const std = {STDLIB}.{WINGSDK_STD_MODULE};")); output.line(format!("const {HELPERS_VAR} = {STDLIB}.helpers;")); + output.line(format!( + "const {EXTERN_VAR} = {HELPERS_VAR}.createExternRequire(__dirname);" + )); output.add_code(imports); if is_entrypoint { @@ -1452,9 +1456,15 @@ impl<'a> JSifier<'a> { format!("{up_dirs}{rel_path}") }; + let require = if ctx.visit_ctx.current_phase() == Phase::Inflight { + "require" + } else { + EXTERN_VAR + }; + new_code!( &func_def.span, - format!("return (require(\"{require_path}\")[\"{name}\"])("), + format!("return ({require}(\"{require_path}\")[\"{name}\"])("), parameters.clone(), ")" ) diff --git a/libs/wingc/src/jsify/snapshots/access_methods_and_properties_on_collections.snap b/libs/wingc/src/jsify/snapshots/access_methods_and_properties_on_collections.snap index 48e01b1c661..86c170f8411 100644 --- a/libs/wingc/src/jsify/snapshots/access_methods_and_properties_on_collections.snap +++ b/libs/wingc/src/jsify/snapshots/access_methods_and_properties_on_collections.snap @@ -47,6 +47,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/access_property_on_primitive.snap b/libs/wingc/src/jsify/snapshots/access_property_on_primitive.snap index 1b1759f493c..b5771fcc0b9 100644 --- a/libs/wingc/src/jsify/snapshots/access_property_on_primitive.snap +++ b/libs/wingc/src/jsify/snapshots/access_property_on_primitive.snap @@ -44,6 +44,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/access_property_on_value_returned_from_collection.snap b/libs/wingc/src/jsify/snapshots/access_property_on_value_returned_from_collection.snap index 7c06ab7bda1..e793ccf4bc2 100644 --- a/libs/wingc/src/jsify/snapshots/access_property_on_value_returned_from_collection.snap +++ b/libs/wingc/src/jsify/snapshots/access_property_on_value_returned_from_collection.snap @@ -44,6 +44,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/base_class_captures_inflight.snap b/libs/wingc/src/jsify/snapshots/base_class_captures_inflight.snap index 211360110ec..c996859fb2d 100644 --- a/libs/wingc/src/jsify/snapshots/base_class_captures_inflight.snap +++ b/libs/wingc/src/jsify/snapshots/base_class_captures_inflight.snap @@ -68,6 +68,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/base_class_captures_preflight.snap b/libs/wingc/src/jsify/snapshots/base_class_captures_preflight.snap index cd1744305a9..989c402998a 100644 --- a/libs/wingc/src/jsify/snapshots/base_class_captures_preflight.snap +++ b/libs/wingc/src/jsify/snapshots/base_class_captures_preflight.snap @@ -62,6 +62,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/base_class_lift_indirect.snap b/libs/wingc/src/jsify/snapshots/base_class_lift_indirect.snap index 501044dc78c..a1098a4325a 100644 --- a/libs/wingc/src/jsify/snapshots/base_class_lift_indirect.snap +++ b/libs/wingc/src/jsify/snapshots/base_class_lift_indirect.snap @@ -76,6 +76,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/base_class_with_fields_inflight.snap b/libs/wingc/src/jsify/snapshots/base_class_with_fields_inflight.snap index bc9885dec9b..1bcabfc5528 100644 --- a/libs/wingc/src/jsify/snapshots/base_class_with_fields_inflight.snap +++ b/libs/wingc/src/jsify/snapshots/base_class_with_fields_inflight.snap @@ -77,6 +77,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/base_class_with_fields_preflight.snap b/libs/wingc/src/jsify/snapshots/base_class_with_fields_preflight.snap index eb56eb2de3b..c5faa235839 100644 --- a/libs/wingc/src/jsify/snapshots/base_class_with_fields_preflight.snap +++ b/libs/wingc/src/jsify/snapshots/base_class_with_fields_preflight.snap @@ -67,6 +67,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/base_class_with_lifted_field_object.snap b/libs/wingc/src/jsify/snapshots/base_class_with_lifted_field_object.snap index ab32066085e..e2a2891ef78 100644 --- a/libs/wingc/src/jsify/snapshots/base_class_with_lifted_field_object.snap +++ b/libs/wingc/src/jsify/snapshots/base_class_with_lifted_field_object.snap @@ -67,6 +67,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/base_class_with_lifted_fields.snap b/libs/wingc/src/jsify/snapshots/base_class_with_lifted_fields.snap index d4deff63c26..7793850313b 100644 --- a/libs/wingc/src/jsify/snapshots/base_class_with_lifted_fields.snap +++ b/libs/wingc/src/jsify/snapshots/base_class_with_lifted_fields.snap @@ -67,6 +67,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/builtins.snap b/libs/wingc/src/jsify/snapshots/builtins.snap index d535cefa321..53008dfdff0 100644 --- a/libs/wingc/src/jsify/snapshots/builtins.snap +++ b/libs/wingc/src/jsify/snapshots/builtins.snap @@ -42,6 +42,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/call_static_inflight_from_static_inflight.snap b/libs/wingc/src/jsify/snapshots/call_static_inflight_from_static_inflight.snap index 0952212b5dc..d131a1db629 100644 --- a/libs/wingc/src/jsify/snapshots/call_static_inflight_from_static_inflight.snap +++ b/libs/wingc/src/jsify/snapshots/call_static_inflight_from_static_inflight.snap @@ -61,6 +61,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/calls_methods_on_preflight_object.snap b/libs/wingc/src/jsify/snapshots/calls_methods_on_preflight_object.snap index 386875ba935..e34ef9d6acd 100644 --- a/libs/wingc/src/jsify/snapshots/calls_methods_on_preflight_object.snap +++ b/libs/wingc/src/jsify/snapshots/calls_methods_on_preflight_object.snap @@ -47,6 +47,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/capture_from_inside_an_inflight_closure.snap b/libs/wingc/src/jsify/snapshots/capture_from_inside_an_inflight_closure.snap index 7c8bc762826..09e9197b655 100644 --- a/libs/wingc/src/jsify/snapshots/capture_from_inside_an_inflight_closure.snap +++ b/libs/wingc/src/jsify/snapshots/capture_from_inside_an_inflight_closure.snap @@ -47,6 +47,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const util = $stdlib.util; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/capture_identifier_closure_from_preflight_scope.snap b/libs/wingc/src/jsify/snapshots/capture_identifier_closure_from_preflight_scope.snap index 50074825440..855df068e77 100644 --- a/libs/wingc/src/jsify/snapshots/capture_identifier_closure_from_preflight_scope.snap +++ b/libs/wingc/src/jsify/snapshots/capture_identifier_closure_from_preflight_scope.snap @@ -63,6 +63,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/capture_identifier_from_preflight_scope.snap b/libs/wingc/src/jsify/snapshots/capture_identifier_from_preflight_scope.snap index 419894a1a8c..7fc9b80532b 100644 --- a/libs/wingc/src/jsify/snapshots/capture_identifier_from_preflight_scope.snap +++ b/libs/wingc/src/jsify/snapshots/capture_identifier_from_preflight_scope.snap @@ -43,6 +43,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/capture_identifier_from_preflight_scope_with_method_call.snap b/libs/wingc/src/jsify/snapshots/capture_identifier_from_preflight_scope_with_method_call.snap index 78c6897c5f1..13cc38e59bb 100644 --- a/libs/wingc/src/jsify/snapshots/capture_identifier_from_preflight_scope_with_method_call.snap +++ b/libs/wingc/src/jsify/snapshots/capture_identifier_from_preflight_scope_with_method_call.snap @@ -64,6 +64,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/capture_identifier_from_preflight_scope_with_nested_object.snap b/libs/wingc/src/jsify/snapshots/capture_identifier_from_preflight_scope_with_nested_object.snap index 9477fbcadad..b5fbf73536b 100644 --- a/libs/wingc/src/jsify/snapshots/capture_identifier_from_preflight_scope_with_nested_object.snap +++ b/libs/wingc/src/jsify/snapshots/capture_identifier_from_preflight_scope_with_nested_object.snap @@ -67,6 +67,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/capture_identifier_from_preflight_scope_with_property.snap b/libs/wingc/src/jsify/snapshots/capture_identifier_from_preflight_scope_with_property.snap index c671c5626b5..a758b92f8cc 100644 --- a/libs/wingc/src/jsify/snapshots/capture_identifier_from_preflight_scope_with_property.snap +++ b/libs/wingc/src/jsify/snapshots/capture_identifier_from_preflight_scope_with_property.snap @@ -43,6 +43,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/capture_in_keyword_args.snap b/libs/wingc/src/jsify/snapshots/capture_in_keyword_args.snap index 9fd8c54c2b7..312283f1f43 100644 --- a/libs/wingc/src/jsify/snapshots/capture_in_keyword_args.snap +++ b/libs/wingc/src/jsify/snapshots/capture_in_keyword_args.snap @@ -48,6 +48,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const util = $stdlib.util; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/capture_object_with_this_in_name.snap b/libs/wingc/src/jsify/snapshots/capture_object_with_this_in_name.snap index e039d94bfb0..e08d93d3d5f 100644 --- a/libs/wingc/src/jsify/snapshots/capture_object_with_this_in_name.snap +++ b/libs/wingc/src/jsify/snapshots/capture_object_with_this_in_name.snap @@ -44,6 +44,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/capture_token.snap b/libs/wingc/src/jsify/snapshots/capture_token.snap index ccc4dd184ee..7d280541b37 100644 --- a/libs/wingc/src/jsify/snapshots/capture_token.snap +++ b/libs/wingc/src/jsify/snapshots/capture_token.snap @@ -43,6 +43,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/capture_type_inflight_class_sibling_from_init.snap b/libs/wingc/src/jsify/snapshots/capture_type_inflight_class_sibling_from_init.snap index 50fda4ff585..e33734b441e 100644 --- a/libs/wingc/src/jsify/snapshots/capture_type_inflight_class_sibling_from_init.snap +++ b/libs/wingc/src/jsify/snapshots/capture_type_inflight_class_sibling_from_init.snap @@ -67,6 +67,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/capture_type_inflight_class_sibling_from_method.snap b/libs/wingc/src/jsify/snapshots/capture_type_inflight_class_sibling_from_method.snap index bd27b367715..47fb417fa00 100644 --- a/libs/wingc/src/jsify/snapshots/capture_type_inflight_class_sibling_from_method.snap +++ b/libs/wingc/src/jsify/snapshots/capture_type_inflight_class_sibling_from_method.snap @@ -53,6 +53,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/capture_type_new_inflight_class_inner_no_capture.snap b/libs/wingc/src/jsify/snapshots/capture_type_new_inflight_class_inner_no_capture.snap index d518d3f9c5d..b0d4cbe8f02 100644 --- a/libs/wingc/src/jsify/snapshots/capture_type_new_inflight_class_inner_no_capture.snap +++ b/libs/wingc/src/jsify/snapshots/capture_type_new_inflight_class_inner_no_capture.snap @@ -45,6 +45,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/capture_type_new_inflight_class_outer.snap b/libs/wingc/src/jsify/snapshots/capture_type_new_inflight_class_outer.snap index 8d6c0887a44..8489eec5041 100644 --- a/libs/wingc/src/jsify/snapshots/capture_type_new_inflight_class_outer.snap +++ b/libs/wingc/src/jsify/snapshots/capture_type_new_inflight_class_outer.snap @@ -57,6 +57,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/capture_type_static_method.snap b/libs/wingc/src/jsify/snapshots/capture_type_static_method.snap index 7a82f971934..b6277673600 100644 --- a/libs/wingc/src/jsify/snapshots/capture_type_static_method.snap +++ b/libs/wingc/src/jsify/snapshots/capture_type_static_method.snap @@ -64,6 +64,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/capture_type_static_method_inflight_class.snap b/libs/wingc/src/jsify/snapshots/capture_type_static_method_inflight_class.snap index e59d297b94e..cd7cc8981dd 100644 --- a/libs/wingc/src/jsify/snapshots/capture_type_static_method_inflight_class.snap +++ b/libs/wingc/src/jsify/snapshots/capture_type_static_method_inflight_class.snap @@ -62,6 +62,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/capture_var_from_method_inflight.snap b/libs/wingc/src/jsify/snapshots/capture_var_from_method_inflight.snap index 6a5e3f202cf..9254bf82239 100644 --- a/libs/wingc/src/jsify/snapshots/capture_var_from_method_inflight.snap +++ b/libs/wingc/src/jsify/snapshots/capture_var_from_method_inflight.snap @@ -50,6 +50,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/closed_inflight_class_extends_outer_inflight_class.snap b/libs/wingc/src/jsify/snapshots/closed_inflight_class_extends_outer_inflight_class.snap index 681edf91351..ebda1fe8f15 100644 --- a/libs/wingc/src/jsify/snapshots/closed_inflight_class_extends_outer_inflight_class.snap +++ b/libs/wingc/src/jsify/snapshots/closed_inflight_class_extends_outer_inflight_class.snap @@ -60,6 +60,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/closure_field.snap b/libs/wingc/src/jsify/snapshots/closure_field.snap index c24a23f0ad0..38f066ba6c9 100644 --- a/libs/wingc/src/jsify/snapshots/closure_field.snap +++ b/libs/wingc/src/jsify/snapshots/closure_field.snap @@ -105,6 +105,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/entrypoint_this.snap b/libs/wingc/src/jsify/snapshots/entrypoint_this.snap index f8fe4a12964..b61f8369c14 100644 --- a/libs/wingc/src/jsify/snapshots/entrypoint_this.snap +++ b/libs/wingc/src/jsify/snapshots/entrypoint_this.snap @@ -19,6 +19,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/enum_value.snap b/libs/wingc/src/jsify/snapshots/enum_value.snap index 8f4a1c9d9da..e48c24d9f1e 100644 --- a/libs/wingc/src/jsify/snapshots/enum_value.snap +++ b/libs/wingc/src/jsify/snapshots/enum_value.snap @@ -47,6 +47,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/free_inflight_obj_from_inflight.snap b/libs/wingc/src/jsify/snapshots/free_inflight_obj_from_inflight.snap index b9a1b66705d..5257f8a3c70 100644 --- a/libs/wingc/src/jsify/snapshots/free_inflight_obj_from_inflight.snap +++ b/libs/wingc/src/jsify/snapshots/free_inflight_obj_from_inflight.snap @@ -55,6 +55,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/free_preflight_object_from_preflight.snap b/libs/wingc/src/jsify/snapshots/free_preflight_object_from_preflight.snap index f7b65b20fc2..15ebf279878 100644 --- a/libs/wingc/src/jsify/snapshots/free_preflight_object_from_preflight.snap +++ b/libs/wingc/src/jsify/snapshots/free_preflight_object_from_preflight.snap @@ -38,6 +38,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/func_returns_func.snap b/libs/wingc/src/jsify/snapshots/func_returns_func.snap index 3a73d77eac6..2b8e67d67c0 100644 --- a/libs/wingc/src/jsify/snapshots/func_returns_func.snap +++ b/libs/wingc/src/jsify/snapshots/func_returns_func.snap @@ -52,6 +52,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/identify_field.snap b/libs/wingc/src/jsify/snapshots/identify_field.snap index 43514e965b2..8cdc9ae7a00 100644 --- a/libs/wingc/src/jsify/snapshots/identify_field.snap +++ b/libs/wingc/src/jsify/snapshots/identify_field.snap @@ -47,6 +47,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/implicit_lift_inflight_init.snap b/libs/wingc/src/jsify/snapshots/implicit_lift_inflight_init.snap index 93bbef3650e..ede8b4806e1 100644 --- a/libs/wingc/src/jsify/snapshots/implicit_lift_inflight_init.snap +++ b/libs/wingc/src/jsify/snapshots/implicit_lift_inflight_init.snap @@ -65,6 +65,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/indirect_capture.snap b/libs/wingc/src/jsify/snapshots/indirect_capture.snap index e7498878bf6..15a89bd9a55 100644 --- a/libs/wingc/src/jsify/snapshots/indirect_capture.snap +++ b/libs/wingc/src/jsify/snapshots/indirect_capture.snap @@ -80,6 +80,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/inflight_class_extends_both_inside_inflight_closure.snap b/libs/wingc/src/jsify/snapshots/inflight_class_extends_both_inside_inflight_closure.snap index 43fb77ab454..c496a96fb04 100644 --- a/libs/wingc/src/jsify/snapshots/inflight_class_extends_both_inside_inflight_closure.snap +++ b/libs/wingc/src/jsify/snapshots/inflight_class_extends_both_inside_inflight_closure.snap @@ -46,6 +46,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/inflight_class_extends_inflight_class.snap b/libs/wingc/src/jsify/snapshots/inflight_class_extends_inflight_class.snap index 973756e9146..681b87585d6 100644 --- a/libs/wingc/src/jsify/snapshots/inflight_class_extends_inflight_class.snap +++ b/libs/wingc/src/jsify/snapshots/inflight_class_extends_inflight_class.snap @@ -46,6 +46,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/inflight_constructor.snap b/libs/wingc/src/jsify/snapshots/inflight_constructor.snap index 36a61985702..80faa3b1138 100644 --- a/libs/wingc/src/jsify/snapshots/inflight_constructor.snap +++ b/libs/wingc/src/jsify/snapshots/inflight_constructor.snap @@ -50,6 +50,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/inflight_field.snap b/libs/wingc/src/jsify/snapshots/inflight_field.snap index be9f77397a3..0cfde3b80c0 100644 --- a/libs/wingc/src/jsify/snapshots/inflight_field.snap +++ b/libs/wingc/src/jsify/snapshots/inflight_field.snap @@ -49,6 +49,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/inflight_field_from_inflight.snap b/libs/wingc/src/jsify/snapshots/inflight_field_from_inflight.snap index 9fb9f5c5dfb..f300ef416e6 100644 --- a/libs/wingc/src/jsify/snapshots/inflight_field_from_inflight.snap +++ b/libs/wingc/src/jsify/snapshots/inflight_field_from_inflight.snap @@ -48,6 +48,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/inflight_field_from_inflight_class.snap b/libs/wingc/src/jsify/snapshots/inflight_field_from_inflight_class.snap index 4fa3b1f9b1b..04d361bfed3 100644 --- a/libs/wingc/src/jsify/snapshots/inflight_field_from_inflight_class.snap +++ b/libs/wingc/src/jsify/snapshots/inflight_field_from_inflight_class.snap @@ -47,6 +47,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/inline_inflight_class.snap b/libs/wingc/src/jsify/snapshots/inline_inflight_class.snap index d10319ad40e..2a44a3b8b81 100644 --- a/libs/wingc/src/jsify/snapshots/inline_inflight_class.snap +++ b/libs/wingc/src/jsify/snapshots/inline_inflight_class.snap @@ -68,6 +68,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/json_object.snap b/libs/wingc/src/jsify/snapshots/json_object.snap index 66ac72a49cb..62036dd7fef 100644 --- a/libs/wingc/src/jsify/snapshots/json_object.snap +++ b/libs/wingc/src/jsify/snapshots/json_object.snap @@ -44,6 +44,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/lift_binary_preflight_and_inflight_expression.snap b/libs/wingc/src/jsify/snapshots/lift_binary_preflight_and_inflight_expression.snap index d5c71bbb447..b61054c3b05 100644 --- a/libs/wingc/src/jsify/snapshots/lift_binary_preflight_and_inflight_expression.snap +++ b/libs/wingc/src/jsify/snapshots/lift_binary_preflight_and_inflight_expression.snap @@ -45,6 +45,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/lift_binary_preflight_expression.snap b/libs/wingc/src/jsify/snapshots/lift_binary_preflight_expression.snap index 9c957fd8118..229498fdb1d 100644 --- a/libs/wingc/src/jsify/snapshots/lift_binary_preflight_expression.snap +++ b/libs/wingc/src/jsify/snapshots/lift_binary_preflight_expression.snap @@ -44,6 +44,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/lift_element_from_collection_as_field.snap b/libs/wingc/src/jsify/snapshots/lift_element_from_collection_as_field.snap index cbd1733bd1c..59d6f850c32 100644 --- a/libs/wingc/src/jsify/snapshots/lift_element_from_collection_as_field.snap +++ b/libs/wingc/src/jsify/snapshots/lift_element_from_collection_as_field.snap @@ -48,6 +48,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/lift_element_from_collection_of_objects.snap b/libs/wingc/src/jsify/snapshots/lift_element_from_collection_of_objects.snap index d797a0bbf83..37fe1a105b4 100644 --- a/libs/wingc/src/jsify/snapshots/lift_element_from_collection_of_objects.snap +++ b/libs/wingc/src/jsify/snapshots/lift_element_from_collection_of_objects.snap @@ -45,6 +45,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/lift_inflight_closure.snap b/libs/wingc/src/jsify/snapshots/lift_inflight_closure.snap index c375f852046..28b88a5ba27 100644 --- a/libs/wingc/src/jsify/snapshots/lift_inflight_closure.snap +++ b/libs/wingc/src/jsify/snapshots/lift_inflight_closure.snap @@ -64,6 +64,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/lift_inside_preflight_method.snap b/libs/wingc/src/jsify/snapshots/lift_inside_preflight_method.snap index 28408483766..c150b3628a6 100644 --- a/libs/wingc/src/jsify/snapshots/lift_inside_preflight_method.snap +++ b/libs/wingc/src/jsify/snapshots/lift_inside_preflight_method.snap @@ -69,6 +69,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/lift_self_reference.snap b/libs/wingc/src/jsify/snapshots/lift_self_reference.snap index 03f5e01ff46..a7b5c6332a4 100644 --- a/libs/wingc/src/jsify/snapshots/lift_self_reference.snap +++ b/libs/wingc/src/jsify/snapshots/lift_self_reference.snap @@ -45,6 +45,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/lift_string.snap b/libs/wingc/src/jsify/snapshots/lift_string.snap index 55c8fe32c2e..72b030f22ac 100644 --- a/libs/wingc/src/jsify/snapshots/lift_string.snap +++ b/libs/wingc/src/jsify/snapshots/lift_string.snap @@ -43,6 +43,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/lift_this.snap b/libs/wingc/src/jsify/snapshots/lift_this.snap index 4e8b9d0918e..6ab8730b88c 100644 --- a/libs/wingc/src/jsify/snapshots/lift_this.snap +++ b/libs/wingc/src/jsify/snapshots/lift_this.snap @@ -81,6 +81,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/lift_var_with_this.snap b/libs/wingc/src/jsify/snapshots/lift_var_with_this.snap index 991066e2c28..1274cd10e3a 100644 --- a/libs/wingc/src/jsify/snapshots/lift_var_with_this.snap +++ b/libs/wingc/src/jsify/snapshots/lift_var_with_this.snap @@ -64,6 +64,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/lift_via_closure.snap b/libs/wingc/src/jsify/snapshots/lift_via_closure.snap index 7769bb360b5..c2031ed3b27 100644 --- a/libs/wingc/src/jsify/snapshots/lift_via_closure.snap +++ b/libs/wingc/src/jsify/snapshots/lift_via_closure.snap @@ -71,6 +71,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/lift_via_closure_class_explicit.snap b/libs/wingc/src/jsify/snapshots/lift_via_closure_class_explicit.snap index e13d1a9134e..460441dd0a4 100644 --- a/libs/wingc/src/jsify/snapshots/lift_via_closure_class_explicit.snap +++ b/libs/wingc/src/jsify/snapshots/lift_via_closure_class_explicit.snap @@ -86,6 +86,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/namespaced_static_from_inflight.snap b/libs/wingc/src/jsify/snapshots/namespaced_static_from_inflight.snap index f4a4bcc8b0b..d7c67b36828 100644 --- a/libs/wingc/src/jsify/snapshots/namespaced_static_from_inflight.snap +++ b/libs/wingc/src/jsify/snapshots/namespaced_static_from_inflight.snap @@ -43,6 +43,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const util = $stdlib.util; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/nested_inflight_after_preflight_operation.snap b/libs/wingc/src/jsify/snapshots/nested_inflight_after_preflight_operation.snap index 2c116eabbad..2c771b0b1f7 100644 --- a/libs/wingc/src/jsify/snapshots/nested_inflight_after_preflight_operation.snap +++ b/libs/wingc/src/jsify/snapshots/nested_inflight_after_preflight_operation.snap @@ -70,6 +70,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/nested_preflight_operation.snap b/libs/wingc/src/jsify/snapshots/nested_preflight_operation.snap index 8930643a1b4..91257bfd431 100644 --- a/libs/wingc/src/jsify/snapshots/nested_preflight_operation.snap +++ b/libs/wingc/src/jsify/snapshots/nested_preflight_operation.snap @@ -88,6 +88,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/new_inflight_object.snap b/libs/wingc/src/jsify/snapshots/new_inflight_object.snap index 6f5f44da712..4c0fcdbb3da 100644 --- a/libs/wingc/src/jsify/snapshots/new_inflight_object.snap +++ b/libs/wingc/src/jsify/snapshots/new_inflight_object.snap @@ -57,6 +57,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/no_capture_inside_methods.snap b/libs/wingc/src/jsify/snapshots/no_capture_inside_methods.snap index 4863901fe1a..c053dcae157 100644 --- a/libs/wingc/src/jsify/snapshots/no_capture_inside_methods.snap +++ b/libs/wingc/src/jsify/snapshots/no_capture_inside_methods.snap @@ -48,6 +48,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/no_capture_of_identifier_from_inner_scope.snap b/libs/wingc/src/jsify/snapshots/no_capture_of_identifier_from_inner_scope.snap index a69231e3d13..d3992988748 100644 --- a/libs/wingc/src/jsify/snapshots/no_capture_of_identifier_from_inner_scope.snap +++ b/libs/wingc/src/jsify/snapshots/no_capture_of_identifier_from_inner_scope.snap @@ -48,6 +48,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/no_capture_of_identifier_from_same_scope.snap b/libs/wingc/src/jsify/snapshots/no_capture_of_identifier_from_same_scope.snap index 70387025e2a..8c96fb27ae5 100644 --- a/libs/wingc/src/jsify/snapshots/no_capture_of_identifier_from_same_scope.snap +++ b/libs/wingc/src/jsify/snapshots/no_capture_of_identifier_from_same_scope.snap @@ -44,6 +44,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/no_capture_shadow_inside_inner_scopes.snap b/libs/wingc/src/jsify/snapshots/no_capture_shadow_inside_inner_scopes.snap index b9149892590..54db26e1554 100644 --- a/libs/wingc/src/jsify/snapshots/no_capture_shadow_inside_inner_scopes.snap +++ b/libs/wingc/src/jsify/snapshots/no_capture_shadow_inside_inner_scopes.snap @@ -56,6 +56,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/no_lift_shadow_inside_inner_scopes.snap b/libs/wingc/src/jsify/snapshots/no_lift_shadow_inside_inner_scopes.snap index b9173e367f5..5b6c9f12da8 100644 --- a/libs/wingc/src/jsify/snapshots/no_lift_shadow_inside_inner_scopes.snap +++ b/libs/wingc/src/jsify/snapshots/no_lift_shadow_inside_inner_scopes.snap @@ -54,6 +54,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/preflight_class_extends_preflight_class.snap b/libs/wingc/src/jsify/snapshots/preflight_class_extends_preflight_class.snap index 19d49aa27c8..f8df6a1e343 100644 --- a/libs/wingc/src/jsify/snapshots/preflight_class_extends_preflight_class.snap +++ b/libs/wingc/src/jsify/snapshots/preflight_class_extends_preflight_class.snap @@ -51,6 +51,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/preflight_collection.snap b/libs/wingc/src/jsify/snapshots/preflight_collection.snap index f3eaa59f8d9..ed8aef1fd41 100644 --- a/libs/wingc/src/jsify/snapshots/preflight_collection.snap +++ b/libs/wingc/src/jsify/snapshots/preflight_collection.snap @@ -45,6 +45,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/preflight_collection_of_preflight_objects.snap b/libs/wingc/src/jsify/snapshots/preflight_collection_of_preflight_objects.snap index 6d17bf85a05..4a31a7a6eaa 100644 --- a/libs/wingc/src/jsify/snapshots/preflight_collection_of_preflight_objects.snap +++ b/libs/wingc/src/jsify/snapshots/preflight_collection_of_preflight_objects.snap @@ -49,6 +49,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/preflight_nested_object_with_operations.snap b/libs/wingc/src/jsify/snapshots/preflight_nested_object_with_operations.snap index ca082be10c9..d1f4f50769d 100644 --- a/libs/wingc/src/jsify/snapshots/preflight_nested_object_with_operations.snap +++ b/libs/wingc/src/jsify/snapshots/preflight_nested_object_with_operations.snap @@ -67,6 +67,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/preflight_object.snap b/libs/wingc/src/jsify/snapshots/preflight_object.snap index 26112755497..c7d6b9c02a2 100644 --- a/libs/wingc/src/jsify/snapshots/preflight_object.snap +++ b/libs/wingc/src/jsify/snapshots/preflight_object.snap @@ -68,6 +68,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/preflight_object_through_property.snap b/libs/wingc/src/jsify/snapshots/preflight_object_through_property.snap index 70e1030b575..73ae66c5d8a 100644 --- a/libs/wingc/src/jsify/snapshots/preflight_object_through_property.snap +++ b/libs/wingc/src/jsify/snapshots/preflight_object_through_property.snap @@ -68,6 +68,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/preflight_object_with_operations.snap b/libs/wingc/src/jsify/snapshots/preflight_object_with_operations.snap index cff84ad7b47..3118c933228 100644 --- a/libs/wingc/src/jsify/snapshots/preflight_object_with_operations.snap +++ b/libs/wingc/src/jsify/snapshots/preflight_object_with_operations.snap @@ -46,6 +46,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/preflight_object_with_operations_multiple_methods.snap b/libs/wingc/src/jsify/snapshots/preflight_object_with_operations_multiple_methods.snap index d5eb108c075..30684d0011d 100644 --- a/libs/wingc/src/jsify/snapshots/preflight_object_with_operations_multiple_methods.snap +++ b/libs/wingc/src/jsify/snapshots/preflight_object_with_operations_multiple_methods.snap @@ -51,6 +51,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/preflight_value_field.snap b/libs/wingc/src/jsify/snapshots/preflight_value_field.snap index bef89baaa21..9a150a8c71d 100644 --- a/libs/wingc/src/jsify/snapshots/preflight_value_field.snap +++ b/libs/wingc/src/jsify/snapshots/preflight_value_field.snap @@ -73,6 +73,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/read_primitive_value.snap b/libs/wingc/src/jsify/snapshots/read_primitive_value.snap index 52b554067d8..774da98ff7f 100644 --- a/libs/wingc/src/jsify/snapshots/read_primitive_value.snap +++ b/libs/wingc/src/jsify/snapshots/read_primitive_value.snap @@ -44,6 +44,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/reassign_captured_variable.snap b/libs/wingc/src/jsify/snapshots/reassign_captured_variable.snap index 74136f94211..cdab8211e67 100644 --- a/libs/wingc/src/jsify/snapshots/reassign_captured_variable.snap +++ b/libs/wingc/src/jsify/snapshots/reassign_captured_variable.snap @@ -53,6 +53,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/reassigned_captured_variable_preflight.snap b/libs/wingc/src/jsify/snapshots/reassigned_captured_variable_preflight.snap index 6d47722eefa..bbde03ffe57 100644 --- a/libs/wingc/src/jsify/snapshots/reassigned_captured_variable_preflight.snap +++ b/libs/wingc/src/jsify/snapshots/reassigned_captured_variable_preflight.snap @@ -22,6 +22,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/ref_std_macro.snap b/libs/wingc/src/jsify/snapshots/ref_std_macro.snap index dd566854678..a93b8f453cd 100644 --- a/libs/wingc/src/jsify/snapshots/ref_std_macro.snap +++ b/libs/wingc/src/jsify/snapshots/ref_std_macro.snap @@ -44,6 +44,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/reference_from_static_inflight.snap b/libs/wingc/src/jsify/snapshots/reference_from_static_inflight.snap index b30970ac942..b4e479c49bf 100644 --- a/libs/wingc/src/jsify/snapshots/reference_from_static_inflight.snap +++ b/libs/wingc/src/jsify/snapshots/reference_from_static_inflight.snap @@ -43,6 +43,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/reference_inflight_class.snap b/libs/wingc/src/jsify/snapshots/reference_inflight_class.snap index 394078aff8a..7037afed5fc 100644 --- a/libs/wingc/src/jsify/snapshots/reference_inflight_class.snap +++ b/libs/wingc/src/jsify/snapshots/reference_inflight_class.snap @@ -62,6 +62,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/reference_inflight_field.snap b/libs/wingc/src/jsify/snapshots/reference_inflight_field.snap index 85644fb5d70..28ee4f47cc6 100644 --- a/libs/wingc/src/jsify/snapshots/reference_inflight_field.snap +++ b/libs/wingc/src/jsify/snapshots/reference_inflight_field.snap @@ -50,6 +50,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/reference_inflight_from_inflight.snap b/libs/wingc/src/jsify/snapshots/reference_inflight_from_inflight.snap index 9c5046bb2a4..6ddf585201a 100644 --- a/libs/wingc/src/jsify/snapshots/reference_inflight_from_inflight.snap +++ b/libs/wingc/src/jsify/snapshots/reference_inflight_from_inflight.snap @@ -74,6 +74,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/reference_lift_of_collection.snap b/libs/wingc/src/jsify/snapshots/reference_lift_of_collection.snap index be6bd56a5d9..4baa0e5b574 100644 --- a/libs/wingc/src/jsify/snapshots/reference_lift_of_collection.snap +++ b/libs/wingc/src/jsify/snapshots/reference_lift_of_collection.snap @@ -44,6 +44,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/reference_preflight_field.snap b/libs/wingc/src/jsify/snapshots/reference_preflight_field.snap index 29e8e14fcd5..6d418fe4b67 100644 --- a/libs/wingc/src/jsify/snapshots/reference_preflight_field.snap +++ b/libs/wingc/src/jsify/snapshots/reference_preflight_field.snap @@ -48,6 +48,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/reference_preflight_field_call_independent_method.snap b/libs/wingc/src/jsify/snapshots/reference_preflight_field_call_independent_method.snap index 0f2a212a546..54249a94fc6 100644 --- a/libs/wingc/src/jsify/snapshots/reference_preflight_field_call_independent_method.snap +++ b/libs/wingc/src/jsify/snapshots/reference_preflight_field_call_independent_method.snap @@ -48,6 +48,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/reference_preflight_fields.snap b/libs/wingc/src/jsify/snapshots/reference_preflight_fields.snap index 26a0e5477ee..cabd4783e02 100644 --- a/libs/wingc/src/jsify/snapshots/reference_preflight_fields.snap +++ b/libs/wingc/src/jsify/snapshots/reference_preflight_fields.snap @@ -64,6 +64,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/reference_preflight_free_variable_with_this_in_the_expression.snap b/libs/wingc/src/jsify/snapshots/reference_preflight_free_variable_with_this_in_the_expression.snap index c9196b3504f..f7b74ca97e8 100644 --- a/libs/wingc/src/jsify/snapshots/reference_preflight_free_variable_with_this_in_the_expression.snap +++ b/libs/wingc/src/jsify/snapshots/reference_preflight_free_variable_with_this_in_the_expression.snap @@ -51,6 +51,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/reference_preflight_object_from_static_inflight.snap b/libs/wingc/src/jsify/snapshots/reference_preflight_object_from_static_inflight.snap index b2feda3091d..bee06339319 100644 --- a/libs/wingc/src/jsify/snapshots/reference_preflight_object_from_static_inflight.snap +++ b/libs/wingc/src/jsify/snapshots/reference_preflight_object_from_static_inflight.snap @@ -45,6 +45,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/reference_static_inflight.snap b/libs/wingc/src/jsify/snapshots/reference_static_inflight.snap index 5eb1c539cf5..39e5714deae 100644 --- a/libs/wingc/src/jsify/snapshots/reference_static_inflight.snap +++ b/libs/wingc/src/jsify/snapshots/reference_static_inflight.snap @@ -64,6 +64,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/reference_static_inflight_which_references_preflight_object.snap b/libs/wingc/src/jsify/snapshots/reference_static_inflight_which_references_preflight_object.snap index 5e87173a8ab..5fe4ab94cc7 100644 --- a/libs/wingc/src/jsify/snapshots/reference_static_inflight_which_references_preflight_object.snap +++ b/libs/wingc/src/jsify/snapshots/reference_static_inflight_which_references_preflight_object.snap @@ -72,6 +72,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/static_external_inflight_class.snap b/libs/wingc/src/jsify/snapshots/static_external_inflight_class.snap index f974c6dfd65..1478a64ae25 100644 --- a/libs/wingc/src/jsify/snapshots/static_external_inflight_class.snap +++ b/libs/wingc/src/jsify/snapshots/static_external_inflight_class.snap @@ -73,6 +73,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/static_external_preflight_class.snap b/libs/wingc/src/jsify/snapshots/static_external_preflight_class.snap index fe8ae847019..6bdecac309e 100644 --- a/libs/wingc/src/jsify/snapshots/static_external_preflight_class.snap +++ b/libs/wingc/src/jsify/snapshots/static_external_preflight_class.snap @@ -72,6 +72,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/static_inflight_operation.snap b/libs/wingc/src/jsify/snapshots/static_inflight_operation.snap index 5d911340906..a3afeeb210c 100644 --- a/libs/wingc/src/jsify/snapshots/static_inflight_operation.snap +++ b/libs/wingc/src/jsify/snapshots/static_inflight_operation.snap @@ -69,6 +69,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/static_local_inflight_class.snap b/libs/wingc/src/jsify/snapshots/static_local_inflight_class.snap index 2c94619be60..ddd7d0bbc12 100644 --- a/libs/wingc/src/jsify/snapshots/static_local_inflight_class.snap +++ b/libs/wingc/src/jsify/snapshots/static_local_inflight_class.snap @@ -64,6 +64,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/static_on_std_type.snap b/libs/wingc/src/jsify/snapshots/static_on_std_type.snap index 14ba099d752..cddb49b66f0 100644 --- a/libs/wingc/src/jsify/snapshots/static_on_std_type.snap +++ b/libs/wingc/src/jsify/snapshots/static_on_std_type.snap @@ -44,6 +44,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/transitive_reference.snap b/libs/wingc/src/jsify/snapshots/transitive_reference.snap index d21bb552d2f..847626e2f23 100644 --- a/libs/wingc/src/jsify/snapshots/transitive_reference.snap +++ b/libs/wingc/src/jsify/snapshots/transitive_reference.snap @@ -87,6 +87,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/transitive_reference_via_inflight_class.snap b/libs/wingc/src/jsify/snapshots/transitive_reference_via_inflight_class.snap index 288231de5d6..4d646d3361c 100644 --- a/libs/wingc/src/jsify/snapshots/transitive_reference_via_inflight_class.snap +++ b/libs/wingc/src/jsify/snapshots/transitive_reference_via_inflight_class.snap @@ -70,6 +70,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/transitive_reference_via_static.snap b/libs/wingc/src/jsify/snapshots/transitive_reference_via_static.snap index 8097888c573..6360ecad233 100644 --- a/libs/wingc/src/jsify/snapshots/transitive_reference_via_static.snap +++ b/libs/wingc/src/jsify/snapshots/transitive_reference_via_static.snap @@ -95,6 +95,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/two_identical_lifts.snap b/libs/wingc/src/jsify/snapshots/two_identical_lifts.snap index 5dba110e736..bc7e393332e 100644 --- a/libs/wingc/src/jsify/snapshots/two_identical_lifts.snap +++ b/libs/wingc/src/jsify/snapshots/two_identical_lifts.snap @@ -52,6 +52,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/use_util_functions.snap b/libs/wingc/src/jsify/snapshots/use_util_functions.snap index f88ba55e210..85f8f9563f2 100644 --- a/libs/wingc/src/jsify/snapshots/use_util_functions.snap +++ b/libs/wingc/src/jsify/snapshots/use_util_functions.snap @@ -42,6 +42,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const util = $stdlib.util; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/var_inflight_field_from_inflight.snap b/libs/wingc/src/jsify/snapshots/var_inflight_field_from_inflight.snap index 3213b63361b..d0e74b4002d 100644 --- a/libs/wingc/src/jsify/snapshots/var_inflight_field_from_inflight.snap +++ b/libs/wingc/src/jsify/snapshots/var_inflight_field_from_inflight.snap @@ -50,6 +50,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/wait_util.snap b/libs/wingc/src/jsify/snapshots/wait_util.snap index d2fc706d4f8..e2f23baff21 100644 --- a/libs/wingc/src/jsify/snapshots/wait_util.snap +++ b/libs/wingc/src/jsify/snapshots/wait_util.snap @@ -49,6 +49,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const util = $stdlib.util; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingcompiler/.npmignore b/libs/wingcompiler/.npmignore deleted file mode 100644 index dae619c8be8..00000000000 --- a/libs/wingcompiler/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -wasm/.gitkeep -scripts -*.tgz diff --git a/libs/wingcompiler/jest.config.js b/libs/wingcompiler/jest.config.js deleted file mode 100644 index 530ebab9e2c..00000000000 --- a/libs/wingcompiler/jest.config.js +++ /dev/null @@ -1,6 +0,0 @@ -/** @type {import('ts-jest').JestConfigWithTsJest} */ -module.exports = { - preset: "ts-jest", - testEnvironment: "node", - testMatch: ["**/*.test.ts"], -}; diff --git a/libs/wingcompiler/package.json b/libs/wingcompiler/package.json index d73d3ec731b..c428369bbcc 100644 --- a/libs/wingcompiler/package.json +++ b/libs/wingcompiler/package.json @@ -4,6 +4,7 @@ "description": "Wing Compiler", "files": [ "wingc.wasm", + "preflight.shim.cjs", "dist/" ], "license": "MIT", @@ -23,8 +24,9 @@ "package": "bump-pack -b" }, "dependencies": { - "@winglang/sdk": "workspace:^", "@wingcloud/framework": "workspace:^", + "@winglang/sdk": "workspace:^", + "jiti": "^1.21.0", "wasi-js": "^1.7.3" }, "bundledDependencies": [ diff --git a/libs/wingcompiler/preflight.shim.cjs b/libs/wingcompiler/preflight.shim.cjs new file mode 100644 index 00000000000..67f05f9862f --- /dev/null +++ b/libs/wingcompiler/preflight.shim.cjs @@ -0,0 +1,51 @@ +/// This serves as the preflight execution entrypoint to set up the following behaviors +/// 1. Override module resolution to force @winglang/sdk to always resolve to the same path +/// 2. Handle communication with parent process to handle errors and load the true entrypoint +/// +/// This file has the following expectations: +/// 1. The environment variable WING_PREFLIGHT_ENTRYPOINT is a JSON string of the entrypoint to load +/// 2. Runs in a child process with an IPC channel to the parent process + +process.setUncaughtExceptionCaptureCallback((reason) => { + if (reason instanceof Error) { + // The Error object does not serialize well over IPC (even with 'advanced' serialization) + // So we extract the properties we need to recreate most error objects + reason = { + message: reason.message, + stack: reason.stack, + name: reason.name, + code: reason.code, + }; + } + process.send(reason); +}); + +if (!process.send) { + throw new Error( + "process.send is undefined. This file should only be run in a child process with an IPC connection to the parent." + ); +} + +var Module = require("module"); +const { join } = require("path"); +const original_resolveFilename = Module._resolveFilename; +const WINGSDK = "@winglang/sdk"; +const WINGSDK_PATH = require.resolve(WINGSDK); +const WINGSDK_DIR = join(WINGSDK_PATH, "..", ".."); + +Module._resolveFilename = function () { + const path = arguments[0]; + if (path === WINGSDK) return WINGSDK_PATH; + if (path.startsWith(WINGSDK)) { + arguments[0] = path.replace(WINGSDK, WINGSDK_DIR); + } + return original_resolveFilename.apply(this, arguments); +}; + +if (!process.env.WING_PREFLIGHT_ENTRYPOINT) { + throw new Error("Missing environment variable WING_PREFLIGHT_ENTRYPOINT"); +} +const entrypoint = JSON.parse(process.env.WING_PREFLIGHT_ENTRYPOINT); +delete process.env.WING_PREFLIGHT_ENTRYPOINT; + +require(entrypoint); diff --git a/libs/wingcompiler/src/compile.ts b/libs/wingcompiler/src/compile.ts index 55be562faf0..803acae2a92 100644 --- a/libs/wingcompiler/src/compile.ts +++ b/libs/wingcompiler/src/compile.ts @@ -7,8 +7,8 @@ import { normalPath } from "./util"; import { existsSync } from "fs"; import { BuiltinPlatform } from "./constants"; import { CompileError, PreflightError } from "./errors"; -import { Worker } from "worker_threads"; import { readFile } from "fs/promises"; +import { fork } from "child_process"; // increase the stack trace limit to 50, useful for debugging Rust panics // (not setting the limit too high in case of infinite recursion) @@ -184,7 +184,8 @@ export async function compile(entrypoint: string, options: CompileOptions): Prom WING_VALUES: options.value?.length == 0 ? undefined : options.value, WING_VALUES_FILE: options.values ?? defaultValuesFile(), WING_NODE_MODULES: wingNodeModules, - WING_IMPORTED_NAMESPACES: compileForPreflightResult.compilerOutput?.imported_namespaces.join(";"), + WING_IMPORTED_NAMESPACES: + compileForPreflightResult.compilerOutput?.imported_namespaces.join(";"), }; if (options.rootId) { @@ -201,7 +202,10 @@ export async function compile(entrypoint: string, options: CompileOptions): Prom delete preflightEnv.Path; } } - await runPreflightCodeInWorkerThread(compileForPreflightResult.preflightEntrypoint, preflightEnv); + await runPreflightCodeInWorkerThread( + compileForPreflightResult.preflightEntrypoint, + preflightEnv + ); } return synthDir; } @@ -221,7 +225,7 @@ interface CompileForPreflightResult { readonly preflightEntrypoint: string; readonly compilerOutput?: { imported_namespaces: string[]; - } + }; } async function compileForPreflight(props: { @@ -248,8 +252,8 @@ npm i @wingcloud/framework preflightEntrypoint: await typescriptFramework.compile({ workDir: props.workDir, entrypoint: props.entrypointFile, - }) - } + }), + }; } else { let env: Record = { RUST_BACKTRACE: "full", @@ -301,22 +305,20 @@ npm i @wingcloud/framework return { preflightEntrypoint: join(props.workDir, WINGC_PREFLIGHT), - compilerOutput: JSON.parse( - compilerOutput as string - ), - } + compilerOutput: JSON.parse(compilerOutput as string), + }; } } /** * Check if in the current working directory there is a default values file - * only the first match is returned from the list of default values files - * + * only the first match is returned from the list of default values files + * * @returns default values file from the current working directory */ function defaultValuesFile() { - const defaultConfigs = [ "wing.toml", "wing.yaml", "wing.yml", "wing.json"] - + const defaultConfigs = ["wing.toml", "wing.yaml", "wing.yml", "wing.json"]; + for (const configFile of defaultConfigs) { if (existsSync(join(process.cwd(), configFile))) { return configFile; @@ -330,32 +332,14 @@ async function runPreflightCodeInWorkerThread( env: Record ): Promise { try { - // Create a shimmed entrypoint that ensures we always load the compiler's version of the SDK - const sdkEntrypoint = require.resolve("@winglang/sdk"); - const shim = `\ -var Module = require('module'); -var original_resolveFilename = Module._resolveFilename; -var WINGSDK = '@winglang/sdk'; -var WINGSDK_PATH = '${normalPath(sdkEntrypoint)}'; -var WINGSDK_DIR = '${normalPath(join(sdkEntrypoint, "..", ".."))}'; - -Module._resolveFilename = function () { - const path = arguments[0]; - if(path === WINGSDK) return WINGSDK_PATH; - if(path.startsWith(WINGSDK)){ - arguments[0] = path.replace(WINGSDK, WINGSDK_DIR); - } - return original_resolveFilename.apply(this, arguments); -}; - -require('${normalPath(entrypoint)}'); -`; + env.WING_PREFLIGHT_ENTRYPOINT = JSON.stringify(entrypoint); await new Promise((resolve, reject) => { - const worker = new Worker(shim, { + const worker = fork(join(__dirname, "..", "preflight.shim.cjs"), { env, - eval: true, + stdio: "inherit", }); + worker.on("message", reject); worker.on("error", reject); worker.on("exit", (code) => { if (code === 0) { diff --git a/libs/wingsdk/.projen/deps.json b/libs/wingsdk/.projen/deps.json index 564972961e0..0cc97fca607 100644 --- a/libs/wingsdk/.projen/deps.json +++ b/libs/wingsdk/.projen/deps.json @@ -295,6 +295,10 @@ "name": "ioredis", "type": "bundled" }, + { + "name": "jiti", + "type": "bundled" + }, { "name": "mime-types", "type": "bundled" diff --git a/libs/wingsdk/.projenrc.ts b/libs/wingsdk/.projenrc.ts index addde8d41b3..f3433a92daa 100644 --- a/libs/wingsdk/.projenrc.ts +++ b/libs/wingsdk/.projenrc.ts @@ -43,6 +43,7 @@ const project = new cdk.JsiiProject({ ...sideLoad, // preflight dependencies "safe-stable-stringify", + "jiti", // aws sdk client dependencies // change `AWS_SDK_VERSION` to update all deps at once "@aws-sdk/client-cloudwatch-logs", diff --git a/libs/wingsdk/package.json b/libs/wingsdk/package.json index 10afc75f260..989cba997b2 100644 --- a/libs/wingsdk/package.json +++ b/libs/wingsdk/package.json @@ -107,6 +107,7 @@ "glob": "^8.1.0", "google-auth-library": "^8.9.0", "ioredis": "^5.3.2", + "jiti": "^1.21.0", "mime": "^3.0.0", "mime-types": "^2.1.35", "nanoid": "^3.3.6", @@ -148,6 +149,7 @@ "glob", "google-auth-library", "ioredis", + "jiti", "mime", "mime-types", "nanoid", diff --git a/libs/wingsdk/src/helpers.ts b/libs/wingsdk/src/helpers.ts index a565c8d369e..294e5a69c45 100644 --- a/libs/wingsdk/src/helpers.ts +++ b/libs/wingsdk/src/helpers.ts @@ -2,7 +2,7 @@ // so avoid importing anything heavy here. import { deepStrictEqual, notDeepStrictEqual } from "node:assert"; import type { Construct } from "constructs"; -import { Node } from "./std/node"; +import type { Node } from "./std/node"; export function eq(a: any, b: any): boolean { try { @@ -39,6 +39,8 @@ export function range(start: number, end: number, inclusive: boolean) { } export function nodeof(construct: Construct): Node { + // Should only be used preflight, avoid bundling + const Node = eval("require('./std/node').Node"); return Node.of(construct); } @@ -52,3 +54,25 @@ export function unwrap(value: T): T | never { } throw new Error("Unexpected nil"); } + +export function createExternRequire(dirname: string) { + return (externPath: string) => { + // using eval to always avoid bundling + const jiti: typeof import("jiti").default = eval("require('jiti')"); + const esbuild: typeof import("esbuild") = eval("require('esbuild')"); + + const newRequire = jiti(dirname, { + sourceMaps: true, + interopDefault: true, + transform(opts) { + return esbuild.transformSync(opts.source, { + format: "cjs", + target: "node20", + sourcemap: "inline", + loader: opts.ts ? "ts" : "js", + }); + }, + }); + return newRequire(externPath); + }; +} diff --git a/libs/wingsdk/src/target-sim/queue.inflight.ts b/libs/wingsdk/src/target-sim/queue.inflight.ts index 1194565aac3..ade75198fb6 100644 --- a/libs/wingsdk/src/target-sim/queue.inflight.ts +++ b/libs/wingsdk/src/target-sim/queue.inflight.ts @@ -40,6 +40,7 @@ export class Queue public async init(context: ISimulatorContext): Promise { this._context = context; + await this.processLoop.start(); return {}; } @@ -274,6 +275,7 @@ class RandomArrayIterator implements Iterable { interface LoopController { stop(): Promise; + start(): Promise; } /** @@ -318,8 +320,10 @@ function runEvery(interval: number, fn: () => Promise): LoopController { await stopPromise; // wait for the loop to finish } }, + async start() { + void loop(); + }, }; - void loop(); // start the loop return controller; } diff --git a/libs/wingsdk/src/target-sim/queue.ts b/libs/wingsdk/src/target-sim/queue.ts index 44629ef679f..006482ad3ac 100644 --- a/libs/wingsdk/src/target-sim/queue.ts +++ b/libs/wingsdk/src/target-sim/queue.ts @@ -25,6 +25,7 @@ export class Queue extends cloud.Queue implements ISimulatorResource { private readonly timeout: Duration; private readonly retentionPeriod: Duration; private readonly policy: Policy; + constructor(scope: Construct, id: string, props: cloud.QueueProps = {}) { super(scope, id, props); @@ -99,28 +100,34 @@ export class Queue extends cloud.Queue implements ISimulatorResource { functionHandler, props ); - Node.of(fn).sourceModule = SDK_SOURCE_MODULE; - Node.of(fn).title = "setConsumer()"; - - new EventMapping(this, App.of(this).makeId(this, "QueueEventMapping"), { - subscriber: fn, - publisher: this, - subscriptionProps: { - batchSize: props.batchSize ?? 1, - }, - }); + const fnNode = Node.of(fn); + fnNode.sourceModule = SDK_SOURCE_MODULE; + fnNode.title = "setConsumer()"; - Node.of(this).addConnection({ - source: this, - target: fn, - name: "setConsumer()", - }); + const mapping = new EventMapping( + this, + App.of(this).makeId(this, "QueueEventMapping"), + { + subscriber: fn, + publisher: this, + subscriptionProps: { + batchSize: props.batchSize ?? 1, + }, + } + ); this.policy.addStatement(fn, cloud.FunctionInflightMethods.INVOKE); this.policy.addStatement( fn, SimFunctionInflightMethods.HAS_AVAILABLE_WORKERS ); + mapping.node.addDependency(this.policy); + + Node.of(this).addConnection({ + source: this, + target: fn, + name: "setConsumer()", + }); return fn; } diff --git a/libs/wingsdk/test/target-sim/__snapshots__/file-counter.test.ts.snap b/libs/wingsdk/test/target-sim/__snapshots__/file-counter.test.ts.snap index 1b2fbb977f8..93adf669b67 100644 --- a/libs/wingsdk/test/target-sim/__snapshots__/file-counter.test.ts.snap +++ b/libs/wingsdk/test/target-sim/__snapshots__/file-counter.test.ts.snap @@ -133,6 +133,7 @@ bucket: (function() { "deps": [ "root/HelloWorld/Queue/SetConsumer0", "root/HelloWorld/Queue", + "root/HelloWorld/Queue/Policy", ], "path": "root/HelloWorld/Queue/QueueEventMapping0", "props": { diff --git a/libs/wingsdk/test/target-sim/__snapshots__/queue.test.ts.snap b/libs/wingsdk/test/target-sim/__snapshots__/queue.test.ts.snap index 88bbb93bad7..5f51f79992c 100644 --- a/libs/wingsdk/test/target-sim/__snapshots__/queue.test.ts.snap +++ b/libs/wingsdk/test/target-sim/__snapshots__/queue.test.ts.snap @@ -1048,6 +1048,7 @@ async handle(message) { "deps": [ "root/my_queue/SetConsumer0", "root/my_queue", + "root/my_queue/Policy", ], "path": "root/my_queue/QueueEventMapping0", "props": { @@ -1353,6 +1354,7 @@ async handle(message) { "deps": [ "root/my_queue/SetConsumer0", "root/my_queue", + "root/my_queue/Policy", ], "path": "root/my_queue/QueueEventMapping0", "props": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2eb9ec79869..03e3aa655bd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1227,6 +1227,9 @@ importers: '@winglang/sdk': specifier: workspace:^ version: link:../wingsdk + jiti: + specifier: ^1.21.0 + version: 1.21.0 wasi-js: specifier: ^1.7.3 version: 1.7.3(patch_hash=rmwvp46j2ligfusbdx5dzh4a3q) @@ -1344,6 +1347,9 @@ importers: ioredis: specifier: ^5.3.2 version: 5.3.2 + jiti: + specifier: ^1.21.0 + version: 1.21.0 mime: specifier: ^3.0.0 version: 3.0.0(patch_hash=2he2uszztbibyal6zfzmv2a2oa) @@ -12691,7 +12697,7 @@ packages: defu: 6.1.2 dotenv: 16.3.1 giget: 1.1.3 - jiti: 1.20.0 + jiti: 1.21.0 mlly: 1.4.2 ohash: 1.1.3 pathe: 1.1.1 @@ -14194,7 +14200,7 @@ packages: dependencies: semver: 7.5.4 shelljs: 0.8.5 - typescript: 5.5.0-dev.20240410 + typescript: 5.5.0-dev.20240412 dev: true /dset@3.1.2: @@ -17451,8 +17457,8 @@ packages: supports-color: 8.1.1 dev: true - /jiti@1.20.0: - resolution: {integrity: sha512-3TV69ZbrvV6U5DfQimop50jE9Dl6J8O1ja1dvBbMba/sZ3YBEQqJ2VZRoQPVnhlzjNtU1vaXRZVrVjU4qtm8yA==} + /jiti@1.21.0: + resolution: {integrity: sha512-gFqAIbuKyyso/3G2qhiO2OM6shY6EPP/R0+mkDbyspxKazh8BXDC5FiFsUjlczgdNz/vfra0da2y+aHrusLG/Q==} hasBin: true /joycon@3.1.1: @@ -22031,7 +22037,7 @@ packages: fast-glob: 3.3.1 glob-parent: 6.0.2 is-glob: 4.0.3 - jiti: 1.20.0 + jiti: 1.21.0 lilconfig: 2.1.0 micromatch: 4.0.5 normalize-path: 3.0.0 @@ -22803,8 +22809,8 @@ packages: engines: {node: '>=14.17'} hasBin: true - /typescript@5.5.0-dev.20240410: - resolution: {integrity: sha512-OvGiFb8iPBHHqR8RuhIeCM+j2W1TtPbTZLuesCEi4gulAxzkOP2B3jDPTWmcOmxvUeJN5pNzlKoi/reRn1BZww==} + /typescript@5.5.0-dev.20240412: + resolution: {integrity: sha512-DfE8jAzZf9/FHHo0CMnIL6uFZ6Q1bJ4PCtpBd9Ytbfi0pRREKVJofJEHFbRXADT6Kq1twB4iiqvdc/rGbiBq7g==} engines: {node: '>=14.17'} hasBin: true dev: true diff --git a/tools/hangar/__snapshots__/invalid.ts.snap b/tools/hangar/__snapshots__/invalid.ts.snap index b4cbab9f1db..5062b1cd65b 100644 --- a/tools/hangar/__snapshots__/invalid.ts.snap +++ b/tools/hangar/__snapshots__/invalid.ts.snap @@ -1515,7 +1515,7 @@ exports[`extern_static.test.w 1`] = ` "error: Extern methods must be declared \\"static\\" (they cannot access instance members) --> ../../../examples/tests/invalid/extern_static.test.w:2:45 | -2 | extern \\"../valid/external_js.js\\" inflight getGreeting(name: str): str; +2 | extern \\"../valid/external_ts.ts\\" inflight getGreeting(name: str): str; | ^^^^^^^^^^^ Extern methods must be declared \\"static\\" (they cannot access instance members) @@ -2582,11 +2582,11 @@ Duration " `; exports[`invalid compile directory 1`] = ` -"error: /external_js.js must be a sub directory of /lib +"error: /external_ts.ts must be a sub directory of /lib --> ../../../examples/tests/invalid/lib/extern_above.w:2:3 | -2 | extern \\"../../valid/external_js.js\\" static getGreeting(name: str): str; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ /external_js.js must be a sub directory of /lib +2 | extern \\"../../valid/external_ts.ts\\" static getGreeting(name: str): str; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ /external_ts.ts must be a sub directory of /lib " `; diff --git a/tools/hangar/__snapshots__/test_corpus/valid/anon_function.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/anon_function.test.w_compile_tf-aws.md index 98f68030ff1..870b3b37f1d 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/anon_function.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/anon_function.test.w_compile_tf-aws.md @@ -51,6 +51,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/api.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/api.test.w_compile_tf-aws.md index ac5e26eaa48..5628045bad3 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/api.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/api.test.w_compile_tf-aws.md @@ -476,6 +476,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/api_cors_custom.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/api_cors_custom.test.w_compile_tf-aws.md index f25c0bc45fe..359500e3039 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/api_cors_custom.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/api_cors_custom.test.w_compile_tf-aws.md @@ -332,6 +332,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; const ex = $stdlib.ex; const http = $stdlib.http; diff --git a/tools/hangar/__snapshots__/test_corpus/valid/api_cors_default.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/api_cors_default.test.w_compile_tf-aws.md index fcc50ce2f5e..22bb3845ffe 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/api_cors_default.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/api_cors_default.test.w_compile_tf-aws.md @@ -307,6 +307,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; const ex = $stdlib.ex; const http = $stdlib.http; diff --git a/tools/hangar/__snapshots__/test_corpus/valid/api_valid_path.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/api_valid_path.test.w_compile_tf-aws.md index 4068dac57d4..4eaa4b959e1 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/api_valid_path.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/api_valid_path.test.w_compile_tf-aws.md @@ -409,6 +409,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/assert.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/assert.test.w_compile_tf-aws.md index db339eaddd8..a8b74bcff60 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/assert.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/assert.test.w_compile_tf-aws.md @@ -62,6 +62,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/asynchronous_model_implicit_await_in_functions.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/asynchronous_model_implicit_await_in_functions.test.w_compile_tf-aws.md index 95a374461d9..e0374f97b56 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/asynchronous_model_implicit_await_in_functions.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/asynchronous_model_implicit_await_in_functions.test.w_compile_tf-aws.md @@ -269,6 +269,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/baz.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/baz.w_compile_tf-aws.md index 245e92f3823..806f0755f05 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/baz.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/baz.w_compile_tf-aws.md @@ -20,6 +20,7 @@ module.exports = function({ }) { const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class Baz extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_alias.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_alias.test.w_compile_tf-aws.md index c49c9ec09cd..2ddcec22ea9 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_alias.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_alias.test.w_compile_tf-aws.md @@ -28,6 +28,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const stdFs = $stdlib.fs; const stdFs2 = $stdlib.fs; class $Root extends $stdlib.std.Resource { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_awscdk.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_awscdk.test.w_compile_tf-aws.md index 5eace841aec..131f41c9490 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_awscdk.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_awscdk.test.w_compile_tf-aws.md @@ -42,6 +42,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const awscdk = require("aws-cdk-lib"); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_cdk8s.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_cdk8s.test.w_compile_tf-aws.md index 8b57d07c894..fb60c5bbf3e 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_cdk8s.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_cdk8s.test.w_compile_tf-aws.md @@ -28,6 +28,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cdk8s = require("cdk8s"); const kplus = require("cdk8s-plus-27"); class $Root extends $stdlib.std.Resource { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_cdktf.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_cdktf.test.w_compile_tf-aws.md index 156eff2404f..dae379bedc7 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_cdktf.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_cdktf.test.w_compile_tf-aws.md @@ -59,6 +59,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const aws = require("@cdktf/provider-aws"); const cdktf = require("cdktf"); class $Root extends $stdlib.std.Resource { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_extend_non_entry.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_extend_non_entry.test.w_compile_tf-aws.md index 00ea2543f82..4c65ccbc197 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_extend_non_entry.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_extend_non_entry.test.w_compile_tf-aws.md @@ -43,6 +43,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const lib = require("./preflight.extendnonentrypoint-1.cjs"); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { @@ -62,6 +63,7 @@ $APP.synth(); const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cdk8s = require("cdk8s"); class Foo extends (this?.node?.root?.typeForFqn("cdk8s.Chart") ?? cdk8s.Chart) { constructor($scope, $id, ) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_jsii.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_jsii.test.w_compile_tf-aws.md index d9a3cc3aca0..bed8a1ec4ff 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_jsii.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_jsii.test.w_compile_tf-aws.md @@ -64,6 +64,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; const stuff = require("jsii-code-samples"); const jsii_fixture = require("jsii-fixture"); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_local.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_local.test.w_compile_tf-aws.md index ac9218d9459..57561d5972f 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_local.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_local.test.w_compile_tf-aws.md @@ -40,6 +40,26 @@ module.exports = function({ $store }) { //# sourceMappingURL=inflight.$Closure1-3.cjs.map ``` +## inflight.$Closure2-3.cjs +```cjs +"use strict"; +const $helpers = require("@winglang/sdk/lib/helpers"); +module.exports = function({ $expect_Util, $file2_Q }) { + class $Closure2 { + constructor({ }) { + const $obj = (...args) => this.handle(...args); + Object.setPrototypeOf($obj, this); + return $obj; + } + async handle() { + (await $expect_Util.equal((await $file2_Q.greet("bar")), "Hello bar")); + } + } + return $Closure2; +} +//# sourceMappingURL=inflight.$Closure2-3.cjs.map +``` + ## inflight.Q-2.cjs ```cjs "use strict"; @@ -277,10 +297,12 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const file1 = require("./preflight.store-2.cjs"); const file2 = require("./preflight.subfile-3.cjs"); const file3 = require("./preflight.empty-1.cjs"); const math = $stdlib.math; +const expect = $stdlib.expect; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); @@ -319,6 +341,42 @@ class $Root extends $stdlib.std.Resource { }); } } + class $Closure2 extends $stdlib.std.AutoIdResource { + _id = $stdlib.core.closureId(); + constructor($scope, $id, ) { + super($scope, $id); + $helpers.nodeof(this).hidden = true; + } + static _toInflightType() { + return ` + require("${$helpers.normalPath(__dirname)}/inflight.$Closure2-3.cjs")({ + $expect_Util: ${$stdlib.core.liftObject($stdlib.core.toLiftableModuleType(expect.Util, "@winglang/sdk/expect", "Util"))}, + $file2_Q: ${$stdlib.core.liftObject($stdlib.core.toLiftableModuleType(file2.Q, "", "Q"))}, + }) + `; + } + _toInflight() { + return ` + (await (async () => { + const $Closure2Client = ${$Closure2._toInflightType()}; + const client = new $Closure2Client({ + }); + if (client.$inflight_init) { await client.$inflight_init(); } + return client; + })()) + `; + } + get _liftMap() { + return ({ + "handle": [ + [$stdlib.core.toLiftableModuleType(file2.Q, "", "Q"), ["greet"]], + ], + "$inflight_init": [ + [$stdlib.core.toLiftableModuleType(file2.Q, "", "Q"), []], + ], + }); + } + } class Triangle extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); @@ -380,7 +438,9 @@ class $Root extends $stdlib.std.Resource { } const store = new file1.Store(this, "Store"); const q = new file2.Q(this, "Q"); + (expect.Util.equal((file2.Q.preflightGreet("foo")), "Hello foo")); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:add data to store", new $Closure1(this, "$Closure1")); + this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:greet", new $Closure2(this, "$Closure2")); const s = ({"x": 1, "y": 2}); const c = file1.Color.BLUE; $helpers.assert($helpers.neq(c, file1.Color.RED), "c != file1.Color.RED"); @@ -399,6 +459,7 @@ $APP.synth(); const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); module.exports = { }; //# sourceMappingURL=preflight.empty-1.cjs.map ``` @@ -409,6 +470,7 @@ module.exports = { }; const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const file3 = require("./preflight.empty-1.cjs"); const math = $stdlib.math; const cloud = $stdlib.cloud; @@ -529,11 +591,15 @@ module.exports = { Util, Store, Color }; const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const math = $stdlib.math; class Q extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); } + static preflightGreet(name) { + return ($extern("../../../subdir/util.ts")["preflightGreet"])(name) + } static _toInflightType() { return ` require("${$helpers.normalPath(__dirname)}/inflight.Q-2.cjs")({ diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_local.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_local.test.w_test_sim.md index 74749fa252a..5434f4a3efb 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_local.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_local.test.w_test_sim.md @@ -3,9 +3,10 @@ ## stdout.log ```log pass ─ bring_local.test.wsim » root/env0/test:add data to store +pass ─ bring_local.test.wsim » root/env1/test:greet -Tests 1 passed (1) +Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) Duration diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_local_dir.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_local_dir.test.w_compile_tf-aws.md index 55480c87763..60c18b17f6a 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_local_dir.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_local_dir.test.w_compile_tf-aws.md @@ -84,6 +84,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const w = require("./preflight.widget-1.cjs"); const subdir = require("./preflight.subdir2-5.cjs"); class $Root extends $stdlib.std.Resource { @@ -112,6 +113,7 @@ $APP.synth(); const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const blah = require("./preflight.inner-2.cjs"); const cloud = $stdlib.cloud; const util = $stdlib.util; @@ -159,6 +161,7 @@ module.exports = { Foo }; const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const util = $stdlib.util; class Bar extends $stdlib.std.Resource { constructor($scope, $id, ) { @@ -230,6 +233,7 @@ module.exports = { Bar }; const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); module.exports = { ...require("./preflight.widget-1.cjs"), }; @@ -242,6 +246,7 @@ module.exports = { const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); module.exports = { get inner() { return require("./preflight.inner-2.cjs") }, ...require("./preflight.file2-4.cjs"), @@ -256,6 +261,7 @@ module.exports = { const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class Widget extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_local_normalization.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_local_normalization.test.w_compile_tf-aws.md index 2339d2dda3e..938ae80d8ae 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_local_normalization.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_local_normalization.test.w_compile_tf-aws.md @@ -67,6 +67,7 @@ module.exports = function({ }) { const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class Bar extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); @@ -108,6 +109,7 @@ module.exports = { Bar }; const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class Baz extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); @@ -152,6 +154,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const foo = require("./preflight.foo-3.cjs"); const bar = require("./preflight.bar-1.cjs"); const baz = require("./preflight.baz-2.cjs"); @@ -177,6 +180,7 @@ $APP.synth(); const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const bar = require("./preflight.bar-1.cjs"); const baz = require("./preflight.baz-2.cjs"); class Foo extends $stdlib.std.Resource { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_projen.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_projen.test.w_compile_tf-aws.md index ad0e7d96c39..2ac6ea6ecac 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_projen.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_projen.test.w_compile_tf-aws.md @@ -28,6 +28,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const projen = require("projen"); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_wing_library.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_wing_library.test.w_compile_tf-aws.md index ae297c6f5fe..b7fc78e23b0 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_wing_library.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_wing_library.test.w_compile_tf-aws.md @@ -107,6 +107,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const fixture = require("./preflight.testfixture-5.cjs"); const testfixture = require("./preflight.testfixture-5.cjs"); const testfixture2 = require("./preflight.testfixture-5.cjs"); @@ -168,6 +169,7 @@ $APP.synth(); const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const FavoriteNumbers = (function (tmp) { tmp["SEVEN"] = "SEVEN"; @@ -185,6 +187,7 @@ module.exports = { FavoriteNumbers }; const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; const myutil = require("./preflight.util-2.cjs"); class Store extends $stdlib.std.Resource { @@ -194,7 +197,7 @@ class Store extends $stdlib.std.Resource { this.handlers = []; } static makeKey(name) { - return (require("@winglibs/testfixture/util.js")["makeKey"])(name) + return ($extern("@winglibs/testfixture/util.js")["makeKey"])(name) } onSet(handler) { this.handlers.push(handler); @@ -250,6 +253,7 @@ module.exports = { Store }; const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); module.exports = { ...require("./preflight.util-2.cjs"), }; @@ -262,6 +266,7 @@ module.exports = { const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); module.exports = { get subdir() { return require("./preflight.subdir-4.cjs") }, ...require("./preflight.store-3.cjs"), @@ -276,6 +281,7 @@ module.exports = { const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class Util extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bucket_keys.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/bucket_keys.test.w_compile_tf-aws.md index ed11d93d43d..78bf0995b95 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bucket_keys.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bucket_keys.test.w_compile_tf-aws.md @@ -72,6 +72,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bypass_return.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/bypass_return.test.w_compile_tf-aws.md index 5953de14da4..356c05c83b2 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bypass_return.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bypass_return.test.w_compile_tf-aws.md @@ -28,6 +28,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/call_static_of_myself.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/call_static_of_myself.test.w_compile_tf-aws.md index 659cff44284..bdda85c409b 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/call_static_of_myself.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/call_static_of_myself.test.w_compile_tf-aws.md @@ -99,6 +99,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/calling_inflight_variants.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/calling_inflight_variants.test.w_compile_tf-aws.md index 991fbae2cb4..6b4d8e03a2f 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/calling_inflight_variants.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/calling_inflight_variants.test.w_compile_tf-aws.md @@ -110,6 +110,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/capture_containers.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/capture_containers.test.w_compile_tf-aws.md index 70cbb8e6539..bf970b0acc2 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/capture_containers.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/capture_containers.test.w_compile_tf-aws.md @@ -56,6 +56,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/capture_in_binary.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/capture_in_binary.test.w_compile_tf-aws.md index 9dc228c6e0e..91071782782 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/capture_in_binary.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/capture_in_binary.test.w_compile_tf-aws.md @@ -64,6 +64,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/capture_mutables.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/capture_mutables.test.w_compile_tf-aws.md index 680db7411dd..1901fee0de9 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/capture_mutables.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/capture_mutables.test.w_compile_tf-aws.md @@ -71,6 +71,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/capture_primitives.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/capture_primitives.test.w_compile_tf-aws.md index 569a04b1704..acacaa3397b 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/capture_primitives.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/capture_primitives.test.w_compile_tf-aws.md @@ -168,6 +168,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/capture_reassigable_class_field.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/capture_reassigable_class_field.test.w_compile_tf-aws.md index 22172911bef..198c854fd75 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/capture_reassigable_class_field.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/capture_reassigable_class_field.test.w_compile_tf-aws.md @@ -153,6 +153,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; const util = $stdlib.util; class $Root extends $stdlib.std.Resource { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/capture_reassignable.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/capture_reassignable.test.w_compile_tf-aws.md index b8efa165d50..45dfc0c4221 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/capture_reassignable.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/capture_reassignable.test.w_compile_tf-aws.md @@ -68,6 +68,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/capture_resource_and_data.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/capture_resource_and_data.test.w_compile_tf-aws.md index 83ed04e3e84..8ef177657ac 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/capture_resource_and_data.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/capture_resource_and_data.test.w_compile_tf-aws.md @@ -78,6 +78,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/capture_resource_with_no_inflight.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/capture_resource_with_no_inflight.test.w_compile_tf-aws.md index 968f6015a23..d763246da9a 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/capture_resource_with_no_inflight.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/capture_resource_with_no_inflight.test.w_compile_tf-aws.md @@ -90,6 +90,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/capture_tokens.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/capture_tokens.test.w_compile_tf-aws.md index ffa892a8a9b..12ec3390d08 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/capture_tokens.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/capture_tokens.test.w_compile_tf-aws.md @@ -227,6 +227,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/captures.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/captures.test.w_compile_tf-aws.md index efa5cfd847f..746445c0c10 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/captures.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/captures.test.w_compile_tf-aws.md @@ -645,6 +645,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/casting.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/casting.test.w_compile_tf-aws.md index cdaced07e1d..b07df3480fe 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/casting.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/casting.test.w_compile_tf-aws.md @@ -47,6 +47,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; const util = $stdlib.util; const aws = require("@cdktf/provider-aws"); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/class.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/class.test.w_compile_tf-aws.md index e1156f0ed8f..a569a1ecdd6 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/class.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/class.test.w_compile_tf-aws.md @@ -361,6 +361,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/closure_class.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/closure_class.test.w_compile_tf-aws.md index 420cb39ddcb..a979018aad0 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/closure_class.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/closure_class.test.w_compile_tf-aws.md @@ -72,6 +72,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/construct-base.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/construct-base.test.w_compile_tf-aws.md index 249222a16c2..23a43eb2045 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/construct-base.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/construct-base.test.w_compile_tf-aws.md @@ -54,6 +54,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; const cx = require("constructs"); const aws = require("@cdktf/provider-aws"); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/container_types.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/container_types.test.w_compile_tf-aws.md index 53ce479fde8..34176ad7a2a 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/container_types.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/container_types.test.w_compile_tf-aws.md @@ -62,6 +62,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/custom_obj_id.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/custom_obj_id.test.w_compile_tf-aws.md index 971e1a367d5..20431cac6fb 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/custom_obj_id.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/custom_obj_id.test.w_compile_tf-aws.md @@ -42,6 +42,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/debug_env.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/debug_env.test.w_compile_tf-aws.md index 470d960c66b..25341c9e579 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/debug_env.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/debug_env.test.w_compile_tf-aws.md @@ -42,6 +42,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/deep_equality.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/deep_equality.test.w_compile_tf-aws.md index b2c6328825e..812670d01cf 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/deep_equality.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/deep_equality.test.w_compile_tf-aws.md @@ -303,6 +303,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/double_reference.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/double_reference.test.w_compile_tf-aws.md index efb8391b6cc..d6e7eeb4aac 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/double_reference.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/double_reference.test.w_compile_tf-aws.md @@ -108,6 +108,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/doubler.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/doubler.test.w_compile_tf-aws.md index 1eccd7c2554..59be8719310 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/doubler.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/doubler.test.w_compile_tf-aws.md @@ -252,6 +252,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/enums.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/enums.test.w_compile_tf-aws.md index 25c42004b07..243a4b95503 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/enums.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/enums.test.w_compile_tf-aws.md @@ -71,6 +71,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/explicit_lift_qualification.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/explicit_lift_qualification.test.w_compile_tf-aws.md index 792c230efb5..5040f766f00 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/explicit_lift_qualification.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/explicit_lift_qualification.test.w_compile_tf-aws.md @@ -180,6 +180,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/expressions_binary_operators.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/expressions_binary_operators.test.w_compile_tf-aws.md index 4dc478313cc..0ed26f1e9f0 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/expressions_binary_operators.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/expressions_binary_operators.test.w_compile_tf-aws.md @@ -28,6 +28,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/expressions_string_interpolation.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/expressions_string_interpolation.test.w_compile_tf-aws.md index 22963648b05..d4cb73d6f07 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/expressions_string_interpolation.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/expressions_string_interpolation.test.w_compile_tf-aws.md @@ -50,6 +50,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/extend_non_entrypoint.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/extend_non_entrypoint.w_compile_tf-aws.md index 1e2cd457184..794ec04a576 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/extend_non_entrypoint.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/extend_non_entrypoint.w_compile_tf-aws.md @@ -21,6 +21,7 @@ module.exports = function({ $cdk8s_Chart }) { const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cdk8s = require("cdk8s"); class Foo extends (this?.node?.root?.typeForFqn("cdk8s.Chart") ?? cdk8s.Chart) { constructor($scope, $id, ) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/extern_implementation.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/extern_implementation.test.w_compile_tf-aws.md index 79e47831120..8c7d821d3a8 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/extern_implementation.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/extern_implementation.test.w_compile_tf-aws.md @@ -24,7 +24,7 @@ module.exports = function({ $f }) { ```cjs "use strict"; const $helpers = require("@winglang/sdk/lib/helpers"); -module.exports = function({ $Foo }) { +module.exports = function({ $func }) { class $Closure2 { constructor({ }) { const $obj = (...args) => this.handle(...args); @@ -32,7 +32,7 @@ module.exports = function({ $Foo }) { return $obj; } async handle() { - (await $Foo.print("hey there")); + (await $func.invoke()); } } return $Closure2; @@ -40,6 +40,26 @@ module.exports = function({ $Foo }) { //# sourceMappingURL=inflight.$Closure2-1.cjs.map ``` +## inflight.$Closure3-1.cjs +```cjs +"use strict"; +const $helpers = require("@winglang/sdk/lib/helpers"); +module.exports = function({ $Foo }) { + class $Closure3 { + constructor({ }) { + const $obj = (...args) => this.handle(...args); + Object.setPrototypeOf($obj, this); + return $obj; + } + async handle() { + (await $Foo.print("hey there")); + } + } + return $Closure3; +} +//# sourceMappingURL=inflight.$Closure3-1.cjs.map +``` + ## inflight.Foo-1.cjs ```cjs "use strict"; @@ -49,16 +69,16 @@ module.exports = function({ }) { constructor({ }) { } static async regexInflight(pattern, text) { - return (require("../../../external_js.js")["regexInflight"])(pattern, text) + return (require("../../../external_ts.ts")["regexInflight"])(pattern, text) } static async getUuid() { - return (require("../../../external_js.js")["getUuid"])() + return (require("../../../external_ts.ts")["getUuid"])() } static async getData() { - return (require("../../../external_js.js")["getData"])() + return (require("../../../external_ts.ts")["getData"])() } static async print(msg) { - return (require("../../../external_js.js")["print"])(msg) + return (require("../../../external_ts.ts")["print"])(msg) } async call() { $helpers.assert((await Foo.regexInflight("[a-z]+-\\d+", "abc-123")), "Foo.regexInflight(\"[a-z]+-\\\\d+\", \"abc-123\")"); @@ -89,7 +109,96 @@ module.exports = function({ }) { ] }, "resource": { + "aws_cloudwatch_log_group": { + "Function_CloudwatchLogGroup_ABDCF4C4": { + "//": { + "metadata": { + "path": "root/Default/Default/Function/CloudwatchLogGroup", + "uniqueId": "Function_CloudwatchLogGroup_ABDCF4C4" + } + }, + "name": "/aws/lambda/Function-c852aba6", + "retention_in_days": 30 + } + }, + "aws_iam_role": { + "Function_IamRole_678BE84C": { + "//": { + "metadata": { + "path": "root/Default/Default/Function/IamRole", + "uniqueId": "Function_IamRole_678BE84C" + } + }, + "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" + } + }, + "aws_iam_role_policy": { + "Function_IamRolePolicy_E3B26607": { + "//": { + "metadata": { + "path": "root/Default/Default/Function/IamRolePolicy", + "uniqueId": "Function_IamRolePolicy_E3B26607" + } + }, + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", + "role": "${aws_iam_role.Function_IamRole_678BE84C.name}" + } + }, + "aws_iam_role_policy_attachment": { + "Function_IamRolePolicyAttachment_CACE1358": { + "//": { + "metadata": { + "path": "root/Default/Default/Function/IamRolePolicyAttachment", + "uniqueId": "Function_IamRolePolicyAttachment_CACE1358" + } + }, + "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", + "role": "${aws_iam_role.Function_IamRole_678BE84C.name}" + } + }, + "aws_lambda_function": { + "Function": { + "//": { + "metadata": { + "path": "root/Default/Default/Function/Default", + "uniqueId": "Function" + } + }, + "architectures": [ + "arm64" + ], + "environment": { + "variables": { + "NODE_OPTIONS": "--enable-source-maps", + "WING_FUNCTION_NAME": "Function-c852aba6", + "WING_TARGET": "tf-aws" + } + }, + "function_name": "Function-c852aba6", + "handler": "index.handler", + "memory_size": 1024, + "publish": true, + "role": "${aws_iam_role.Function_IamRole_678BE84C.arn}", + "runtime": "nodejs20.x", + "s3_bucket": "${aws_s3_bucket.Code.bucket}", + "s3_key": "${aws_s3_object.Function_S3Object_C62A0C2D.key}", + "timeout": 60, + "vpc_config": { + "security_group_ids": [], + "subnet_ids": [] + } + } + }, "aws_s3_bucket": { + "Code": { + "//": { + "metadata": { + "path": "root/Default/Code", + "uniqueId": "Code" + } + }, + "bucket_prefix": "code-c84a50b1-" + }, "my-bucket": { "//": { "metadata": { @@ -100,6 +209,19 @@ module.exports = function({ }) { "bucket_prefix": "my-bucket-c8fafcc6-", "force_destroy": false } + }, + "aws_s3_object": { + "Function_S3Object_C62A0C2D": { + "//": { + "metadata": { + "path": "root/Default/Default/Function/S3Object", + "uniqueId": "Function_S3Object_C62A0C2D" + } + }, + "bucket": "${aws_s3_bucket.Code.bucket}", + "key": "", + "source": "" + } } } } @@ -114,6 +236,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { @@ -123,10 +246,10 @@ class $Root extends $stdlib.std.Resource { super($scope, $id); } static getGreeting(name) { - return (require("../../../external_js.js")["getGreeting"])(name) + return ($extern("../../../external_ts.ts")["getGreeting"])(name) } static preflightBucket(bucket, id) { - return (require("../../../external_js.js")["preflightBucket"])(bucket, id) + return ($extern("../../../external_ts.ts")["preflightBucket"])(bucket, id) } static _toInflightType() { return ` @@ -212,7 +335,7 @@ class $Root extends $stdlib.std.Resource { static _toInflightType() { return ` require("${$helpers.normalPath(__dirname)}/inflight.$Closure2-1.cjs")({ - $Foo: ${$stdlib.core.liftObject(Foo)}, + $func: ${$stdlib.core.liftObject(func)}, }) `; } @@ -227,6 +350,41 @@ class $Root extends $stdlib.std.Resource { })()) `; } + get _liftMap() { + return ({ + "handle": [ + [func, ["invoke"]], + ], + "$inflight_init": [ + [func, []], + ], + }); + } + } + class $Closure3 extends $stdlib.std.AutoIdResource { + _id = $stdlib.core.closureId(); + constructor($scope, $id, ) { + super($scope, $id); + $helpers.nodeof(this).hidden = true; + } + static _toInflightType() { + return ` + require("${$helpers.normalPath(__dirname)}/inflight.$Closure3-1.cjs")({ + $Foo: ${$stdlib.core.liftObject(Foo)}, + }) + `; + } + _toInflight() { + return ` + (await (async () => { + const $Closure3Client = ${$Closure3._toInflightType()}; + const client = new $Closure3Client({ + }); + if (client.$inflight_init) { await client.$inflight_init(); } + return client; + })()) + `; + } get _liftMap() { return ({ "handle": [ @@ -241,9 +399,10 @@ class $Root extends $stdlib.std.Resource { $helpers.assert($helpers.eq((Foo.getGreeting("Wingding")), "Hello, Wingding!"), "Foo.getGreeting(\"Wingding\") == \"Hello, Wingding!\""); const f = new Foo(this, "Foo"); const bucket = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "my-bucket"); - const result = (Foo.preflightBucket(bucket, "my-bucket")); - this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:call", new $Closure1(this, "$Closure1")); - this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:console", new $Closure2(this, "$Closure2")); + (Foo.preflightBucket(bucket, "my-bucket")); + const func = this.node.root.new("@winglang/sdk.cloud.Function", cloud.Function, this, "Function", new $Closure1(this, "$Closure1")); + this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:call", new $Closure2(this, "$Closure2")); + this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:console", new $Closure3(this, "$Closure3")); } } const $PlatformManager = new $stdlib.platform.PlatformManager({platformPaths: $platforms}); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/file_counter.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/file_counter.test.w_compile_tf-aws.md index 29fdb38f65e..bd433ead881 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/file_counter.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/file_counter.test.w_compile_tf-aws.md @@ -213,6 +213,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/for_loop.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/for_loop.test.w_compile_tf-aws.md index bb43a222704..133f07c0354 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/for_loop.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/for_loop.test.w_compile_tf-aws.md @@ -177,6 +177,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/forward_decl.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/forward_decl.test.w_compile_tf-aws.md index 500019c0eae..f942377bb06 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/forward_decl.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/forward_decl.test.w_compile_tf-aws.md @@ -42,6 +42,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/function_returns_function.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/function_returns_function.test.w_compile_tf-aws.md index 3e2306fbbd0..9d84ab99e3f 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/function_returns_function.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/function_returns_function.test.w_compile_tf-aws.md @@ -56,6 +56,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/function_type.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/function_type.test.w_compile_tf-aws.md index 267ddb76160..ca5805b236a 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/function_type.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/function_type.test.w_compile_tf-aws.md @@ -103,6 +103,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/function_variadic_arguments.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/function_variadic_arguments.test.w_compile_tf-aws.md index 9aaf1509f1a..47d3ad814f2 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/function_variadic_arguments.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/function_variadic_arguments.test.w_compile_tf-aws.md @@ -91,6 +91,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/hello.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/hello.test.w_compile_tf-aws.md index 0315edef46e..a89822806fa 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/hello.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/hello.test.w_compile_tf-aws.md @@ -191,6 +191,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/identical_inflights.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/identical_inflights.test.w_compile_tf-aws.md index 500040fdc4a..a354c770c40 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/identical_inflights.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/identical_inflights.test.w_compile_tf-aws.md @@ -66,6 +66,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/impl_interface.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/impl_interface.test.w_compile_tf-aws.md index 2c211e4e854..caf2cd8e6aa 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/impl_interface.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/impl_interface.test.w_compile_tf-aws.md @@ -265,6 +265,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; const jsii_fixture = require("jsii-fixture"); class $Root extends $stdlib.std.Resource { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/implicit_std.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/implicit_std.test.w_compile_tf-aws.md index 6cdb034923f..3086f935883 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/implicit_std.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/implicit_std.test.w_compile_tf-aws.md @@ -28,6 +28,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/in_scope_construct.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/in_scope_construct.test.w_compile_tf-aws.md index f392bd18f75..8ae55982b3c 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/in_scope_construct.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/in_scope_construct.test.w_compile_tf-aws.md @@ -42,6 +42,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const c = require("constructs"); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inference.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inference.test.w_compile_tf-aws.md index ffab6c246c8..ed9ebd76926 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inference.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inference.test.w_compile_tf-aws.md @@ -253,6 +253,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight-subscribers.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight-subscribers.test.w_compile_tf-aws.md index 420cb3aa833..ae14796da53 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight-subscribers.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight-subscribers.test.w_compile_tf-aws.md @@ -319,6 +319,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_capture_static.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_capture_static.test.w_compile_tf-aws.md index 65450281d8e..7f67e80adcf 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_capture_static.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_capture_static.test.w_compile_tf-aws.md @@ -154,6 +154,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const util = $stdlib.util; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_as_struct_members.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_as_struct_members.test.w_compile_tf-aws.md index b3e6f489e9c..1b2a1dcf38c 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_as_struct_members.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_as_struct_members.test.w_compile_tf-aws.md @@ -84,6 +84,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_capture_const.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_capture_const.test.w_compile_tf-aws.md index 620f809761f..b8eb8f5eb65 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_capture_const.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_capture_const.test.w_compile_tf-aws.md @@ -64,6 +64,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_capture_preflight_object.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_capture_preflight_object.test.w_compile_tf-aws.md index 1bdeaa20062..570536b9cec 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_capture_preflight_object.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_capture_preflight_object.test.w_compile_tf-aws.md @@ -28,6 +28,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_definitions.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_definitions.test.w_compile_tf-aws.md index 1446bec80f0..7b4304c42d1 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_definitions.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_definitions.test.w_compile_tf-aws.md @@ -178,6 +178,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_inner_capture_mutable.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_inner_capture_mutable.test.w_compile_tf-aws.md index 16f9dba5970..f00e099cee6 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_inner_capture_mutable.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_inner_capture_mutable.test.w_compile_tf-aws.md @@ -59,6 +59,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_inside_inflight_closure.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_inside_inflight_closure.test.w_compile_tf-aws.md index 14e695052a5..a4590c97062 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_inside_inflight_closure.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_inside_inflight_closure.test.w_compile_tf-aws.md @@ -239,6 +239,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_modifiers.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_modifiers.test.w_compile_tf-aws.md index dc0720c8b16..d888f13496b 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_modifiers.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_modifiers.test.w_compile_tf-aws.md @@ -47,6 +47,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_outside_inflight_closure.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_outside_inflight_closure.test.w_compile_tf-aws.md index 6629876c060..0712ff6a4e8 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_outside_inflight_closure.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_outside_inflight_closure.test.w_compile_tf-aws.md @@ -70,6 +70,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_structural_interace_handler.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_structural_interace_handler.test.w_compile_tf-aws.md index 5b21dc65e14..2d2852e84dc 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_structural_interace_handler.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_structural_interace_handler.test.w_compile_tf-aws.md @@ -74,6 +74,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_without_init.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_without_init.test.w_compile_tf-aws.md index 87dc6167c42..c9a1079e75c 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_without_init.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_without_init.test.w_compile_tf-aws.md @@ -60,6 +60,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_closure_autoid.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_closure_autoid.test.w_compile_tf-aws.md index 684f88e2b7e..6e531964898 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_closure_autoid.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_closure_autoid.test.w_compile_tf-aws.md @@ -70,6 +70,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_closure_inside_preflight_closure.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_closure_inside_preflight_closure.test.w_compile_tf-aws.md index 92f4cb22069..17d06132069 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_closure_inside_preflight_closure.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_closure_inside_preflight_closure.test.w_compile_tf-aws.md @@ -61,6 +61,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_concat.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_concat.test.w_compile_tf-aws.md index ff29a2598d8..4432a818dc0 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_concat.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_concat.test.w_compile_tf-aws.md @@ -46,6 +46,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_handler_singleton.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_handler_singleton.test.w_compile_tf-aws.md index 71e3f61e8a6..e41ad83c914 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_handler_singleton.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_handler_singleton.test.w_compile_tf-aws.md @@ -434,6 +434,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; const expect = $stdlib.expect; const util = $stdlib.util; diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_init.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_init.test.w_compile_tf-aws.md index 9ddb1ef3f60..657d4d9293a 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_init.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_init.test.w_compile_tf-aws.md @@ -192,6 +192,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const jsii_fixture = require("jsii-fixture"); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflights_calling_inflights.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflights_calling_inflights.test.w_compile_tf-aws.md index d6ff6fe7fd3..8db5729b722 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflights_calling_inflights.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflights_calling_inflights.test.w_compile_tf-aws.md @@ -272,6 +272,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inherit_stdlib_class.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inherit_stdlib_class.test.w_compile_tf-aws.md index 72d6d7dc9f7..159a58075a1 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inherit_stdlib_class.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inherit_stdlib_class.test.w_compile_tf-aws.md @@ -289,6 +289,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; const http = $stdlib.http; class $Root extends $stdlib.std.Resource { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inheritance_class_inflight.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inheritance_class_inflight.test.w_compile_tf-aws.md index d8009b56461..3784a8a054c 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inheritance_class_inflight.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inheritance_class_inflight.test.w_compile_tf-aws.md @@ -91,6 +91,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const expect = $stdlib.expect; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inheritance_class_preflight.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inheritance_class_preflight.test.w_compile_tf-aws.md index ed76fba8d0e..fd16413a92a 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inheritance_class_preflight.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inheritance_class_preflight.test.w_compile_tf-aws.md @@ -57,6 +57,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const expect = $stdlib.expect; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inheritance_interface.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inheritance_interface.test.w_compile_tf-aws.md index a1959bfe361..7d55a61e604 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inheritance_interface.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inheritance_interface.test.w_compile_tf-aws.md @@ -42,6 +42,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const expect = $stdlib.expect; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/interface.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/interface.test.w_compile_tf-aws.md index f038dd9b801..2df8723afdf 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/interface.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/interface.test.w_compile_tf-aws.md @@ -56,6 +56,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/issue_2889.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/issue_2889.test.w_compile_tf-aws.md index bc05cecda53..72edd480440 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/issue_2889.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/issue_2889.test.w_compile_tf-aws.md @@ -277,6 +277,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; const http = $stdlib.http; class $Root extends $stdlib.std.Resource { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/json.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/json.test.w_compile_tf-aws.md index a117e1ad7c9..4190779ac7e 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/json.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/json.test.w_compile_tf-aws.md @@ -56,6 +56,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/json_bucket.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/json_bucket.test.w_compile_tf-aws.md index 5b12a5beb53..180a6a15dbe 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/json_bucket.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/json_bucket.test.w_compile_tf-aws.md @@ -187,6 +187,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/json_static.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/json_static.test.w_compile_tf-aws.md index fd31364e461..5001699ac15 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/json_static.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/json_static.test.w_compile_tf-aws.md @@ -71,6 +71,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/json_string_interpolation.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/json_string_interpolation.test.w_compile_tf-aws.md index 326a91482d1..7dfc3aa272d 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/json_string_interpolation.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/json_string_interpolation.test.w_compile_tf-aws.md @@ -28,6 +28,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/lift_expr_with_this.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/lift_expr_with_this.test.w_compile_tf-aws.md index bd967ec5f17..458c3ebe66e 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/lift_expr_with_this.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/lift_expr_with_this.test.w_compile_tf-aws.md @@ -63,6 +63,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/lift_inflight_closure_collection.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/lift_inflight_closure_collection.test.w_compile_tf-aws.md index 6e4dd1d335c..3201db9efeb 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/lift_inflight_closure_collection.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/lift_inflight_closure_collection.test.w_compile_tf-aws.md @@ -637,6 +637,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/lift_parent_fields.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/lift_parent_fields.test.w_compile_tf-aws.md index 4ae5ae803ab..9854460a01c 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/lift_parent_fields.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/lift_parent_fields.test.w_compile_tf-aws.md @@ -108,6 +108,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/lift_redefinition.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/lift_redefinition.test.w_compile_tf-aws.md index 5de1f8cb9ec..008fd5cb20d 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/lift_redefinition.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/lift_redefinition.test.w_compile_tf-aws.md @@ -50,6 +50,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/lift_shared_resource.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/lift_shared_resource.test.w_compile_tf-aws.md index 8762735b540..39d5e3d398f 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/lift_shared_resource.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/lift_shared_resource.test.w_compile_tf-aws.md @@ -305,6 +305,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; const http = $stdlib.http; class $Root extends $stdlib.std.Resource { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/lift_this.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/lift_this.test.w_compile_tf-aws.md index f658b4ea631..aead5f77bbb 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/lift_this.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/lift_this.test.w_compile_tf-aws.md @@ -72,6 +72,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const util = $stdlib.util; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/lift_via_closure.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/lift_via_closure.test.w_compile_tf-aws.md index 20fa0ce62c4..e36aa1d5837 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/lift_via_closure.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/lift_via_closure.test.w_compile_tf-aws.md @@ -145,6 +145,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/lift_via_closure_explicit.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/lift_via_closure_explicit.test.w_compile_tf-aws.md index d7e6d44dbb7..55c83d2f17b 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/lift_via_closure_explicit.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/lift_via_closure_explicit.test.w_compile_tf-aws.md @@ -84,6 +84,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/lift_weird_order.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/lift_weird_order.test.w_compile_tf-aws.md index 54b553654e0..38549ae6e98 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/lift_weird_order.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/lift_weird_order.test.w_compile_tf-aws.md @@ -83,6 +83,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/lift_with_phase_ind.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/lift_with_phase_ind.test.w_compile_tf-aws.md index 2d8f1cbed9e..31fe3da6020 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/lift_with_phase_ind.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/lift_with_phase_ind.test.w_compile_tf-aws.md @@ -53,6 +53,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const math = $stdlib.math; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/map_entries.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/map_entries.test.w_compile_tf-aws.md index e9a6f09b69d..823578753be 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/map_entries.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/map_entries.test.w_compile_tf-aws.md @@ -115,6 +115,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/mut_container_types.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/mut_container_types.test.w_compile_tf-aws.md index 65a3a7a082b..c62dfd7a085 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/mut_container_types.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/mut_container_types.test.w_compile_tf-aws.md @@ -62,6 +62,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/mutation_after_class_init.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/mutation_after_class_init.test.w_compile_tf-aws.md index 74c88fc513b..21f71ede962 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/mutation_after_class_init.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/mutation_after_class_init.test.w_compile_tf-aws.md @@ -339,6 +339,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; const util = $stdlib.util; class $Root extends $stdlib.std.Resource { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/new_in_static.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/new_in_static.test.w_compile_tf-aws.md index ff68847e29e..5561a7c89cd 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/new_in_static.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/new_in_static.test.w_compile_tf-aws.md @@ -146,6 +146,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; const c = require("constructs"); const jsii_fixture = require("jsii-fixture"); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/new_jsii.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/new_jsii.test.w_compile_tf-aws.md index 40f9a4a61b1..aeee02c5419 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/new_jsii.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/new_jsii.test.w_compile_tf-aws.md @@ -56,6 +56,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/nil.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/nil.test.w_compile_tf-aws.md index 67e12e044e4..7a58f2cd9c0 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/nil.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/nil.test.w_compile_tf-aws.md @@ -104,6 +104,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/on_lift.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/on_lift.test.w_compile_tf-aws.md index fe91d5db37b..167265a0c23 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/on_lift.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/on_lift.test.w_compile_tf-aws.md @@ -71,6 +71,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const util = $stdlib.util; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/optionals.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/optionals.test.w_compile_tf-aws.md index 576e04a36b6..0fe1fc6a2e6 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/optionals.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/optionals.test.w_compile_tf-aws.md @@ -123,6 +123,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/parameters/nested/parameters.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/parameters/nested/parameters.test.w_compile_tf-aws.md index f6318c7e6b9..811e2fa2337 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/parameters/nested/parameters.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/parameters/nested/parameters.test.w_compile_tf-aws.md @@ -28,6 +28,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/parameters/simple/parameters.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/parameters/simple/parameters.test.w_compile_tf-aws.md index 4e53afbbd88..3d38905013f 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/parameters/simple/parameters.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/parameters/simple/parameters.test.w_compile_tf-aws.md @@ -28,6 +28,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/phase_independent_method_on_string.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/phase_independent_method_on_string.test.w_compile_tf-aws.md index 9cb14faa247..b69e87e49f2 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/phase_independent_method_on_string.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/phase_independent_method_on_string.test.w_compile_tf-aws.md @@ -136,6 +136,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; const expect = $stdlib.expect; class $Root extends $stdlib.std.Resource { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/primitive_methods.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/primitive_methods.test.w_compile_tf-aws.md index f8d1da87713..441e37501dd 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/primitive_methods.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/primitive_methods.test.w_compile_tf-aws.md @@ -28,6 +28,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/print.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/print.test.w_compile_tf-aws.md index fac5b90b20a..562f60a538d 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/print.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/print.test.w_compile_tf-aws.md @@ -70,6 +70,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/reassignment.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/reassignment.test.w_compile_tf-aws.md index 3c9ddbb6bf7..e19b9812b63 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/reassignment.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/reassignment.test.w_compile_tf-aws.md @@ -42,6 +42,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/redis.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/redis.test.w_compile_tf-aws.md index b9fd159b90f..fdc84d01919 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/redis.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/redis.test.w_compile_tf-aws.md @@ -539,6 +539,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; const util = $stdlib.util; const ex = $stdlib.ex; diff --git a/tools/hangar/__snapshots__/test_corpus/valid/resource.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/resource.test.w_compile_tf-aws.md index e586d837e92..b032c7d1595 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/resource.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/resource.test.w_compile_tf-aws.md @@ -701,6 +701,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/resource_as_inflight_literal.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/resource_as_inflight_literal.test.w_compile_tf-aws.md index 389139afccd..f4c393d508d 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/resource_as_inflight_literal.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/resource_as_inflight_literal.test.w_compile_tf-aws.md @@ -174,6 +174,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/resource_call_static.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/resource_call_static.test.w_compile_tf-aws.md index 5b3c3636809..42248faa995 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/resource_call_static.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/resource_call_static.test.w_compile_tf-aws.md @@ -86,6 +86,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/resource_captures.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/resource_captures.test.w_compile_tf-aws.md index 00954de7d8e..3fcc2bb7378 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/resource_captures.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/resource_captures.test.w_compile_tf-aws.md @@ -245,6 +245,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/resource_captures_globals.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/resource_captures_globals.test.w_compile_tf-aws.md index 97696db6158..abcd3c26134 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/resource_captures_globals.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/resource_captures_globals.test.w_compile_tf-aws.md @@ -358,6 +358,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/service.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/service.test.w_compile_tf-aws.md index 355684a8996..1cbc516d9b3 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/service.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/service.test.w_compile_tf-aws.md @@ -28,6 +28,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/shadowing.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/shadowing.test.w_compile_tf-aws.md index b76e062df77..c1a060431ee 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/shadowing.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/shadowing.test.w_compile_tf-aws.md @@ -80,6 +80,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/statements_if.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/statements_if.test.w_compile_tf-aws.md index 23647a468c0..d4d62ba28dc 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/statements_if.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/statements_if.test.w_compile_tf-aws.md @@ -67,6 +67,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/statements_variable_declarations.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/statements_variable_declarations.test.w_compile_tf-aws.md index 4248eadd06b..78aaec16adc 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/statements_variable_declarations.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/statements_variable_declarations.test.w_compile_tf-aws.md @@ -28,6 +28,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/static_members.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/static_members.test.w_compile_tf-aws.md index f1ac644aa61..eb12cc98e9c 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/static_members.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/static_members.test.w_compile_tf-aws.md @@ -75,6 +75,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/std_containers.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/std_containers.test.w_compile_tf-aws.md index 23b6b267b8a..b7b54c36a69 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/std_containers.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/std_containers.test.w_compile_tf-aws.md @@ -72,6 +72,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/std_string.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/std_string.test.w_compile_tf-aws.md index c78ec23c0e5..a2d9f9663d6 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/std_string.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/std_string.test.w_compile_tf-aws.md @@ -50,6 +50,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/store.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/store.w_compile_tf-aws.md index e8985681532..5afb35fc2ee 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/store.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/store.w_compile_tf-aws.md @@ -58,6 +58,7 @@ module.exports = function({ }) { const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const file3 = require("./preflight.empty-1.cjs"); const math = $stdlib.math; const cloud = $stdlib.cloud; @@ -178,6 +179,7 @@ module.exports = { Util, Store, Color }; const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); module.exports = { }; //# sourceMappingURL=preflight.empty-1.cjs.map ``` diff --git a/tools/hangar/__snapshots__/test_corpus/valid/struct_from_json.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/struct_from_json.test.w_compile_tf-aws.md index f62d82a310d..771d6cedaa5 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/struct_from_json.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/struct_from_json.test.w_compile_tf-aws.md @@ -176,6 +176,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; const externalStructs = require("./preflight.structs-1.cjs"); const otherExternalStructs = require("./preflight.structs2-2.cjs"); @@ -511,6 +512,7 @@ $APP.synth(); const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const Bar = $stdlib.std.Struct._createJsonSchema({$id:"/Bar",type:"object",properties:{b:{type:"number"},f:{type:"string"},},required:["b","f",]}); const Foo = $stdlib.std.Struct._createJsonSchema({$id:"/Foo",type:"object",properties:{f:{type:"string"},},required:["f",]}); const Foosible = $stdlib.std.Struct._createJsonSchema({$id:"/Foosible",type:"object",properties:{f:{type:"string"},},required:[]}); @@ -529,6 +531,7 @@ module.exports = { }; const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const Bar = $stdlib.std.Struct._createJsonSchema({$id:"/Bar",type:"object",properties:{b:{type:"number"},f:{type:"string"},},required:["b","f",]}); const Foo = $stdlib.std.Struct._createJsonSchema({$id:"/Foo",type:"object",properties:{f:{type:"string"},},required:["f",]}); const Foosible = $stdlib.std.Struct._createJsonSchema({$id:"/Foosible",type:"object",properties:{f:{type:"string"},},required:[]}); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/structs.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/structs.test.w_compile_tf-aws.md index 2a8486ed100..ba53b64c40d 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/structs.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/structs.test.w_compile_tf-aws.md @@ -67,6 +67,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const expect = $stdlib.expect; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/super_call.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/super_call.test.w_compile_tf-aws.md index 76f297bab42..32581de0f4b 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/super_call.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/super_call.test.w_compile_tf-aws.md @@ -223,6 +223,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const expect = $stdlib.expect; const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/symbol_shadow.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/symbol_shadow.test.w_compile_tf-aws.md index 8872ecd56b1..f816810e030 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/symbol_shadow.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/symbol_shadow.test.w_compile_tf-aws.md @@ -123,6 +123,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/table.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/table.test.w_compile_tf-aws.md index ed8a83f5d4f..57b28e91c18 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/table.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/table.test.w_compile_tf-aws.md @@ -52,6 +52,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const ex = $stdlib.ex; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/test_bucket.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/test_bucket.test.w_compile_tf-aws.md index 8c6914333ed..036ebaba3e5 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/test_bucket.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/test_bucket.test.w_compile_tf-aws.md @@ -85,6 +85,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/test_without_bring.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/test_without_bring.test.w_compile_tf-aws.md index beafe24542d..48e551a1e6e 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/test_without_bring.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/test_without_bring.test.w_compile_tf-aws.md @@ -48,6 +48,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/this.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/this.test.w_compile_tf-aws.md index 71d7f06f0d8..283abc28bf8 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/this.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/this.test.w_compile_tf-aws.md @@ -28,6 +28,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const expect = $stdlib.expect; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/try_catch.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/try_catch.test.w_compile_tf-aws.md index 249b31e0200..95648e798ba 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/try_catch.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/try_catch.test.w_compile_tf-aws.md @@ -28,6 +28,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/unused_lift.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/unused_lift.test.w_compile_tf-aws.md index 5f118bb7927..b235736da4c 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/unused_lift.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/unused_lift.test.w_compile_tf-aws.md @@ -120,6 +120,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/use_inflight_method_inside_init_closure.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/use_inflight_method_inside_init_closure.test.w_compile_tf-aws.md index 0d8bf284ea7..f374ccee292 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/use_inflight_method_inside_init_closure.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/use_inflight_method_inside_init_closure.test.w_compile_tf-aws.md @@ -170,6 +170,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/website_with_api.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/website_with_api.test.w_compile_tf-aws.md index d17d00250d4..8cbcb5f95bd 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/website_with_api.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/website_with_api.test.w_compile_tf-aws.md @@ -628,6 +628,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; const ex = $stdlib.ex; const http = $stdlib.http; diff --git a/tools/hangar/__snapshots__/test_corpus/valid/while.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/while.test.w_compile_tf-aws.md index 96d8a12986b..da069f993dc 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/while.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/while.test.w_compile_tf-aws.md @@ -28,6 +28,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/while_loop_await.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/while_loop_await.test.w_compile_tf-aws.md index f9ec29df248..c73bf15bf1c 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/while_loop_await.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/while_loop_await.test.w_compile_tf-aws.md @@ -186,6 +186,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) {