From a8ef8252b825331ffb5684c5815322bb127a038b Mon Sep 17 00:00:00 2001 From: Mark McCulloh Date: Tue, 9 Apr 2024 14:15:07 -0400 Subject: [PATCH 01/17] wip --- examples/tests/invalid/extern_static.test.w | 2 +- examples/tests/invalid/lib/extern_above.w | 2 +- .../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 +++ libs/wingc/src/jsify.rs | 14 +- libs/wingcompiler/.npmignore | 3 - libs/wingcompiler/jest.config.js | 6 - libs/wingcompiler/package.json | 4 +- libs/wingcompiler/preflight.shim.js | 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 | 12 ++ 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 | 4 + .../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 + 159 files changed, 500 insertions(+), 108 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.js 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/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/libs/wingc/src/jsify.rs b/libs/wingc/src/jsify.rs index 0d1c84630ed..d0762657e5b 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/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..d4763d28b44 100644 --- a/libs/wingcompiler/package.json +++ b/libs/wingcompiler/package.json @@ -4,6 +4,7 @@ "description": "Wing Compiler", "files": [ "wingc.wasm", + "preflight.shim.js", "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.js b/libs/wingcompiler/preflight.shim.js new file mode 100644 index 00000000000..67f05f9862f --- /dev/null +++ b/libs/wingcompiler/preflight.shim.js @@ -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 26f0533f270..6f7d7eb8132 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.js"), { 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..b92ba0ff5d8 100644 --- a/libs/wingsdk/src/helpers.ts +++ b/libs/wingsdk/src/helpers.ts @@ -52,3 +52,15 @@ 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 jiti + const jiti: typeof import("jiti").default = eval("require('jiti')"); + const newRequire = jiti(dirname, { + sourceMaps: true, + interopDefault: true, + }); + return newRequire(externPath); + }; +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e51cf4d90b1..f7323806880 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1224,6 +1224,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) @@ -1341,6 +1344,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) @@ -12688,7 +12694,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 @@ -14191,7 +14197,7 @@ packages: dependencies: semver: 7.5.4 shelljs: 0.8.5 - typescript: 5.5.0-dev.20240404 + typescript: 5.5.0-dev.20240405 dev: true /dset@3.1.2: @@ -17448,8 +17454,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: @@ -22028,7 +22034,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 @@ -22800,8 +22806,8 @@ packages: engines: {node: '>=14.17'} hasBin: true - /typescript@5.5.0-dev.20240404: - resolution: {integrity: sha512-Knb9Yx0JJHc0mmqXLEPPKNSwOvPQrtYZEDLQY7Wns7LckkQl82AZ+OGTPG/ofwqx2QeDCHCtKjutZPy1UEiwKA==} + /typescript@5.5.0-dev.20240405: + resolution: {integrity: sha512-gMeTgpfC2KDhKDbOu7niDwLmSA+Jgbl5lGunCrVnmvoxh3FbTRjAzZ1IRrqB+cph3wWLeCdy8bxQoff1uHLXMg==} 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 1179a7fc74c..c4c45ba806e 100644 --- a/tools/hangar/__snapshots__/invalid.ts.snap +++ b/tools/hangar/__snapshots__/invalid.ts.snap @@ -1508,7 +1508,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) @@ -2518,11 +2518,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 3c45149e185..783f78a4070 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 b3f6694539d..88f0b3ac7a6 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 e055bf1470f..54fd9780467 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 50ba460d4b4..7b1dcd7827f 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 0989c50ebe9..9c0beebc82a 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 141b5012443..7d12bbe39c1 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 9c8e87c2191..b5d06b0ff06 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 85085324148..93feb5e5282 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 282e17be244..34e28da5da6 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 ce4c9899516..f5f1e50ffe3 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 46bfe35b984..acc17626493 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 518edf085a4..6c1e0c1e6af 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 08ff1b31970..3dc0c7fda6d 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 @@ -40,6 +40,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, ) { @@ -83,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 lib = require("./preflight.extendnonentrypoint-1.js"); class $Root extends $stdlib.std.Resource { 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 513d5aadfe2..927470d88bb 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 @@ -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); 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 574fb7d8459..304ef76f243 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 @@ -274,6 +274,7 @@ module.exports = function({ }) { const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); module.exports = { }; //# sourceMappingURL=preflight.empty-1.js.map ``` @@ -287,6 +288,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 file1 = require("./preflight.store-2.js"); const file2 = require("./preflight.subfile-3.js"); const file3 = require("./preflight.empty-1.js"); @@ -409,6 +411,7 @@ $APP.synth(); const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const file3 = require("./preflight.empty-1.js"); const math = $stdlib.math; const cloud = $stdlib.cloud; @@ -529,6 +532,7 @@ 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, ) { 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 4a2a3414346..cf174454661 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 @@ -81,6 +81,7 @@ module.exports = function({ }) { const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const blah = require("./preflight.inner-2.js"); const cloud = $stdlib.cloud; const util = $stdlib.util; @@ -128,6 +129,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, ) { @@ -199,6 +201,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.js"), }; @@ -214,6 +217,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.js"); const subdir = require("./preflight.subdir2-5.js"); class $Root extends $stdlib.std.Resource { @@ -242,6 +246,7 @@ $APP.synth(); 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.js") }, ...require("./preflight.file2-4.js"), @@ -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 586be4fe48b..e6e7a2b1db5 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); @@ -149,6 +151,7 @@ module.exports = { Baz }; const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const bar = require("./preflight.bar-1.js"); const baz = require("./preflight.baz-2.js"); class Foo extends $stdlib.std.Resource { @@ -201,6 +204,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.js"); const bar = require("./preflight.bar-1.js"); const baz = require("./preflight.baz-2.js"); 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 6ee0e548e8f..97df493a577 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 f84aa366922..8f0716b27c4 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 @@ -104,6 +104,7 @@ module.exports = function({ }) { 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"; @@ -124,6 +125,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.js"); const testfixture = require("./preflight.testfixture-5.js"); const testfixture2 = require("./preflight.testfixture-5.js"); @@ -185,6 +187,7 @@ $APP.synth(); 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.js"); 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.js"), }; @@ -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.js") }, ...require("./preflight.store-3.js"), @@ -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 dc33a561442..bc1cad45792 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 c9a524d9a49..519f2cc3851 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 8d4e6ae9b85..41dbe106dac 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 49b039a4526..253017b6ae2 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 beeffdfc53f..fe829a383e8 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 50b0ec169e5..fc8a5c17ec6 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 baa90f3a9c1..1a5269d347b 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 152dd93eff5..4a7bfdb4aef 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 ef1f417ba7e..a4fda1c4a17 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 8f5388582f8..dfb72393a0c 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 ef29ca8fa97..45f1200c297 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 879f332bb77..10632b6065e 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 cb8b7c271f9..98fafdb9396 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 4136e1c8fc7..49c150fd4df 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 d1ae57839b3..f7bd17e5b7f 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 886f42e466c..fbf62a2c2c6 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 6912cae53ed..7f6e2560a8d 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 f2eeb61c26a..87d34f27961 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 715c79ea602..03f63330eb9 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 140e80fc308..9e7901ef16a 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 cf1c82bb414..845eb33a4e8 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 d090b6259a2..f5e1b9e5196 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 276a41c4637..f639601158a 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 b7235cd308d..0aeb7fe7c27 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 de7ed1c4b16..30165a718f0 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 ea064e2eb81..46ed9f771b3 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 @@ -141,6 +141,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 950b717233b..45c663697f2 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 089e5a3ef51..fc8f56d9b69 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 fa775373223..b49e47a6a86 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 e9460d4823d..743517125e3 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 }) { ```js "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.js.map ``` +## inflight.$Closure3-1.js +```js +"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.js.map +``` + ## inflight.Foo-1.js ```js "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.js")({ - $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.js")({ + $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 d2365ae3fd4..24b7fa11aee 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 91828fb8d8b..3c409471342 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 67d74f497f3..90a2ce2a96f 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 ae2c1f846d1..400a01f0963 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 3c31262a04b..fa3067b4859 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 e5b63632d0d..cabb398348c 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 24272c467d1..c4492c6b45f 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 74925bc315e..97f47e9ed91 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 15e8916cec5..7810d6a061b 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 @@ -166,6 +166,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/implicit_std.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/implicit_std.test.w_compile_tf-aws.md index 71b69643752..09c76465354 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 29b2d9868ae..272ccfe882d 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 ab900fb8d18..e616ba9c929 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 f7698753a4c..39c4b873d2d 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 ea41653f375..3de9e9a583f 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 ca17af880a4..f199e50b72f 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 e69ef6e7be0..25ed6b10f43 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 3c75b317ca1..b2d2d22fc74 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 71380ec8e34..d36c0908b8a 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 e0c30639d30..4110c77b493 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 7e78f1baa6e..06cbcad83e3 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 dac4699fca0..04ec91d39d4 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 aba3f04abc0..c8c24c5106d 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 a16515b231f..bb87af8aa0a 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 22d2abcc789..802cce5fb77 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 7ecd87a04ea..9ef2ea84ff9 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 fbbb87d8c3a..4a35f7f5523 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 850fc6800c2..c5f37db1598 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 f11c5f4fe99..688c4fb7e88 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 49ccade7dad..397ae0adc52 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 2c95549d432..646b52a4bfa 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 8c1ad233fbb..b3ae0c30771 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 3c4ce05a66c..28714ed7541 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 74481765e37..fd76ae4345c 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 42294aa1f76..fc4be1492e5 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 1afaf41a4bd..d5df1426404 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 be6257f8154..c3bb646d12b 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 e9e68a40a80..463f3e219b1 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 ef2cb5efcd1..b023b618dbf 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 1626c6a2f5a..88b68db702a 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 e1e3e18c3c6..e24a23a9452 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 30912a910b7..b29afa41bab 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 a3e8fe3ac20..75d71a8bd4e 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 562aefdccc7..f50d4083aa5 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 f99ffd9cd64..9383b1b8573 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 25de3b0c976..645c4771087 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 63e73c682e5..39385e4d65e 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 38ef8c86c52..ebcb157e4e3 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 6d24606cee0..79952db7629 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 739396d51a6..b1a52f1bada 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 28fba970c01..abb02a93968 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 828ed031741..b4d2112d91a 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 77d0fb3e42e..97de642db6d 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 0c6462b05a9..c9defd4077b 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 9b2075ef2a2..b5a023365a1 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 29296103f08..424f0b987c3 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 00c2b52fc96..a5af9d76306 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 ba34e5a73bc..dfa825f9ddf 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 e8c58f3d390..e712048286d 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 14640a022b0..a11fc325acb 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 6ed099b6449..8b9c63cfeba 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 1a334bf1bfa..9fe1eebf673 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 regex = $stdlib.regex; 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 44a5562b8a8..ca22eb21bab 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 045aa903518..da0b88e00bc 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 01ccd4d1c48..b28630fbc8f 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 d9fb0566bf3..24a5e94a77f 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 290248da3d6..8442ee5a022 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 fb476c2c0b0..22f39de0bc7 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 d34d302e4e1..db00c8b126e 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 3b2d6e1a63a..dc7acae0854 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 76cb035a51d..1b22e69fb49 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 9cdb78e5446..c81a6ca5171 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 da30da84102..1b53c2b7ee9 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 7d3975d2570..f23f4746222 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 a82dc5a35c2..62377bd0179 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 5a76cbf0960..82682ec4e34 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 23948ed1beb..4c9e6683d9b 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 62af4b4f7d7..e209292ab76 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 d4cbd27ae3f..4e1ef1c8db4 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); module.exports = { }; //# sourceMappingURL=preflight.empty-1.js.map ``` @@ -68,6 +69,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.js"); const math = $stdlib.math; const cloud = $stdlib.cloud; 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 8b709681bf6..8aeacb0b7d3 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.js"); const otherExternalStructs = require("./preflight.structs2-2.js"); @@ -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 c2ba11d2063..8155c6b1e0a 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 85080f4a312..94282e4a3ee 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 7d83ecdc06f..c7804ea84e1 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 37141d7a0b7..5e03301702c 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 215fe5a92b3..39b1eafd949 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 a82168e1275..a681cbc9e0d 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 dab5d4ee854..87c7fce2154 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 eb75f394b9d..05640813d6f 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 50c8d6d9d97..53abb853fa4 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 98fe50ecdac..27a46058eba 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 3a9528ced1c..237beb6f7e1 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 7af2d401510..4b0ab00978d 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 69368e988ee..78199f9606a 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) { From 0626aea5c02c4d237e633bc2fa6798cd3c092b07 Mon Sep 17 00:00:00 2001 From: Mark McCulloh Date: Tue, 9 Apr 2024 14:37:20 -0400 Subject: [PATCH 02/17] not ideal, but gets it working --- apps/wingcli-v2/src/main.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/apps/wingcli-v2/src/main.rs b/apps/wingcli-v2/src/main.rs index 9302dc2cdc2..b29b68424eb 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()); From fd62dd7ee0452377f575a50732f15ace454f44e6 Mon Sep 17 00:00:00 2001 From: Mark McCulloh Date: Tue, 9 Apr 2024 14:49:39 -0400 Subject: [PATCH 03/17] use esbuild for transformer --- libs/wingsdk/src/helpers.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/libs/wingsdk/src/helpers.ts b/libs/wingsdk/src/helpers.ts index b92ba0ff5d8..220123e3ef1 100644 --- a/libs/wingsdk/src/helpers.ts +++ b/libs/wingsdk/src/helpers.ts @@ -55,11 +55,21 @@ export function unwrap(value: T): T | never { export function createExternRequire(dirname: string) { return (externPath: string) => { - // using eval to always avoid bundling jiti + // 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); }; From 536c613c61c1a2e038f51fd550adbcc61c674509 Mon Sep 17 00:00:00 2001 From: "monada-bot[bot]" Date: Tue, 9 Apr 2024 19:06:42 +0000 Subject: [PATCH 04/17] chore: self mutation (build.diff) Signed-off-by: monada-bot[bot] --- libs/wingc/src/dtsify/snapshots/declarations.snap | 2 ++ libs/wingc/src/dtsify/snapshots/optionals.snap | 2 ++ .../snapshots/access_methods_and_properties_on_collections.snap | 1 + .../wingc/src/jsify/snapshots/access_property_on_primitive.snap | 1 + .../access_property_on_value_returned_from_collection.snap | 1 + .../wingc/src/jsify/snapshots/base_class_captures_inflight.snap | 1 + .../src/jsify/snapshots/base_class_captures_preflight.snap | 1 + libs/wingc/src/jsify/snapshots/base_class_lift_indirect.snap | 1 + .../src/jsify/snapshots/base_class_with_fields_inflight.snap | 1 + .../src/jsify/snapshots/base_class_with_fields_preflight.snap | 1 + .../jsify/snapshots/base_class_with_lifted_field_object.snap | 1 + .../src/jsify/snapshots/base_class_with_lifted_fields.snap | 1 + libs/wingc/src/jsify/snapshots/builtins.snap | 1 + .../snapshots/call_static_inflight_from_static_inflight.snap | 1 + .../src/jsify/snapshots/calls_methods_on_preflight_object.snap | 1 + .../snapshots/capture_from_inside_an_inflight_closure.snap | 1 + .../capture_identifier_closure_from_preflight_scope.snap | 1 + .../snapshots/capture_identifier_from_preflight_scope.snap | 1 + ...apture_identifier_from_preflight_scope_with_method_call.snap | 1 + ...ture_identifier_from_preflight_scope_with_nested_object.snap | 1 + .../capture_identifier_from_preflight_scope_with_property.snap | 1 + libs/wingc/src/jsify/snapshots/capture_in_keyword_args.snap | 1 + .../src/jsify/snapshots/capture_object_with_this_in_name.snap | 1 + libs/wingc/src/jsify/snapshots/capture_token.snap | 1 + .../capture_type_inflight_class_sibling_from_init.snap | 1 + .../capture_type_inflight_class_sibling_from_method.snap | 1 + .../capture_type_new_inflight_class_inner_no_capture.snap | 1 + .../jsify/snapshots/capture_type_new_inflight_class_outer.snap | 1 + libs/wingc/src/jsify/snapshots/capture_type_static_method.snap | 1 + .../snapshots/capture_type_static_method_inflight_class.snap | 1 + .../src/jsify/snapshots/capture_var_from_method_inflight.snap | 1 + .../closed_inflight_class_extends_outer_inflight_class.snap | 1 + libs/wingc/src/jsify/snapshots/closure_field.snap | 1 + libs/wingc/src/jsify/snapshots/entrypoint_this.snap | 1 + libs/wingc/src/jsify/snapshots/enum_value.snap | 1 + .../src/jsify/snapshots/free_inflight_obj_from_inflight.snap | 1 + .../jsify/snapshots/free_preflight_object_from_preflight.snap | 1 + libs/wingc/src/jsify/snapshots/func_returns_func.snap | 1 + libs/wingc/src/jsify/snapshots/identify_field.snap | 1 + libs/wingc/src/jsify/snapshots/implicit_lift_inflight_init.snap | 1 + libs/wingc/src/jsify/snapshots/indirect_capture.snap | 1 + .../inflight_class_extends_both_inside_inflight_closure.snap | 1 + .../jsify/snapshots/inflight_class_extends_inflight_class.snap | 1 + libs/wingc/src/jsify/snapshots/inflight_constructor.snap | 1 + libs/wingc/src/jsify/snapshots/inflight_field.snap | 1 + .../wingc/src/jsify/snapshots/inflight_field_from_inflight.snap | 1 + .../src/jsify/snapshots/inflight_field_from_inflight_class.snap | 1 + libs/wingc/src/jsify/snapshots/inline_inflight_class.snap | 1 + libs/wingc/src/jsify/snapshots/json_object.snap | 1 + .../lift_binary_preflight_and_inflight_expression.snap | 1 + .../src/jsify/snapshots/lift_binary_preflight_expression.snap | 1 + .../jsify/snapshots/lift_element_from_collection_as_field.snap | 1 + .../snapshots/lift_element_from_collection_of_objects.snap | 1 + libs/wingc/src/jsify/snapshots/lift_inflight_closure.snap | 1 + .../wingc/src/jsify/snapshots/lift_inside_preflight_method.snap | 1 + libs/wingc/src/jsify/snapshots/lift_self_reference.snap | 1 + libs/wingc/src/jsify/snapshots/lift_string.snap | 1 + libs/wingc/src/jsify/snapshots/lift_this.snap | 1 + libs/wingc/src/jsify/snapshots/lift_var_with_this.snap | 1 + libs/wingc/src/jsify/snapshots/lift_via_closure.snap | 1 + .../src/jsify/snapshots/lift_via_closure_class_explicit.snap | 1 + .../src/jsify/snapshots/namespaced_static_from_inflight.snap | 1 + .../snapshots/nested_inflight_after_preflight_operation.snap | 1 + libs/wingc/src/jsify/snapshots/nested_preflight_operation.snap | 1 + libs/wingc/src/jsify/snapshots/new_inflight_object.snap | 1 + libs/wingc/src/jsify/snapshots/no_capture_inside_methods.snap | 1 + .../snapshots/no_capture_of_identifier_from_inner_scope.snap | 1 + .../snapshots/no_capture_of_identifier_from_same_scope.snap | 1 + .../jsify/snapshots/no_capture_shadow_inside_inner_scopes.snap | 1 + .../src/jsify/snapshots/no_lift_shadow_inside_inner_scopes.snap | 1 + .../snapshots/preflight_class_extends_preflight_class.snap | 1 + libs/wingc/src/jsify/snapshots/preflight_collection.snap | 1 + .../snapshots/preflight_collection_of_preflight_objects.snap | 1 + .../snapshots/preflight_nested_object_with_operations.snap | 1 + libs/wingc/src/jsify/snapshots/preflight_object.snap | 1 + .../src/jsify/snapshots/preflight_object_through_property.snap | 1 + .../src/jsify/snapshots/preflight_object_with_operations.snap | 1 + .../preflight_object_with_operations_multiple_methods.snap | 1 + libs/wingc/src/jsify/snapshots/preflight_value_field.snap | 1 + libs/wingc/src/jsify/snapshots/read_primitive_value.snap | 1 + libs/wingc/src/jsify/snapshots/reassign_captured_variable.snap | 1 + .../jsify/snapshots/reassigned_captured_variable_preflight.snap | 1 + libs/wingc/src/jsify/snapshots/ref_std_macro.snap | 1 + .../src/jsify/snapshots/reference_from_static_inflight.snap | 1 + libs/wingc/src/jsify/snapshots/reference_inflight_class.snap | 1 + libs/wingc/src/jsify/snapshots/reference_inflight_field.snap | 1 + .../src/jsify/snapshots/reference_inflight_from_inflight.snap | 1 + .../wingc/src/jsify/snapshots/reference_lift_of_collection.snap | 1 + libs/wingc/src/jsify/snapshots/reference_preflight_field.snap | 1 + .../reference_preflight_field_call_independent_method.snap | 1 + libs/wingc/src/jsify/snapshots/reference_preflight_fields.snap | 1 + ...nce_preflight_free_variable_with_this_in_the_expression.snap | 1 + .../reference_preflight_object_from_static_inflight.snap | 1 + libs/wingc/src/jsify/snapshots/reference_static_inflight.snap | 1 + ...rence_static_inflight_which_references_preflight_object.snap | 1 + .../src/jsify/snapshots/static_external_inflight_class.snap | 1 + .../src/jsify/snapshots/static_external_preflight_class.snap | 1 + libs/wingc/src/jsify/snapshots/static_inflight_operation.snap | 1 + libs/wingc/src/jsify/snapshots/static_local_inflight_class.snap | 1 + libs/wingc/src/jsify/snapshots/static_on_std_type.snap | 1 + libs/wingc/src/jsify/snapshots/transitive_reference.snap | 1 + .../snapshots/transitive_reference_via_inflight_class.snap | 1 + .../src/jsify/snapshots/transitive_reference_via_static.snap | 1 + libs/wingc/src/jsify/snapshots/two_identical_lifts.snap | 1 + libs/wingc/src/jsify/snapshots/use_util_functions.snap | 1 + .../src/jsify/snapshots/var_inflight_field_from_inflight.snap | 1 + libs/wingc/src/jsify/snapshots/wait_util.snap | 1 + 107 files changed, 109 insertions(+) diff --git a/libs/wingc/src/dtsify/snapshots/declarations.snap b/libs/wingc/src/dtsify/snapshots/declarations.snap index 3247ff6cde4..2e2361f16eb 100644 --- a/libs/wingc/src/dtsify/snapshots/declarations.snap +++ b/libs/wingc/src/dtsify/snapshots/declarations.snap @@ -85,6 +85,7 @@ export * from "./preflight.lib-1.js" const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); module.exports = { ...require("./preflight.lib-1.js"), }; @@ -149,6 +150,7 @@ export class Child$Inflight extends ParentClass$Inflight implements ClassInterfa 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 1ac05588fb8..b355ee27bc2 100644 --- a/libs/wingc/src/dtsify/snapshots/optionals.snap +++ b/libs/wingc/src/dtsify/snapshots/optionals.snap @@ -51,6 +51,7 @@ export * from "./preflight.lib-1.js" const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); module.exports = { ...require("./preflight.lib-1.js"), }; @@ -99,6 +100,7 @@ export class ParentClass$Inflight implements ClassInterface$Inflight 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/snapshots/access_methods_and_properties_on_collections.snap b/libs/wingc/src/jsify/snapshots/access_methods_and_properties_on_collections.snap index 8da36977f3e..ebed8098ba8 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 550ac55b8dc..ec598a880a1 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 8ea6b38c994..4e5b10d253d 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 9229ea5576a..2e2e6ee39c3 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 4cf773ae132..105337f8937 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 9b49bee71cb..90e8e78057d 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 171d5d6d82f..36d8cd831f9 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 2c6d951c046..a3d444c5908 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 d7ebc177c6c..29fc11daf48 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 12c4be1e2b5..4e83c844a18 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 cab0f3421a0..e0e6e56ce5d 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 5389d06a896..6154898e912 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 0f0f4e5b970..0d257866080 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 5c5ce862e03..e97c9bdc855 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 6e35d072b9c..0c89950d5c8 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 58f5cafce18..15f3f934217 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 86e9537cf2c..c857abca5bf 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 aa81640b27d..1b6cb4f130f 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 cd88ea97ffd..d4c8485fc58 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 6a1724cde4d..f2ccbab5a9b 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 f7db052f9b9..7d3652fc19c 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 29ea132fdc4..968d049b80a 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 624d75959af..39d3d7db485 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 698a4a7fa22..083e3ff90df 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 ff51acf7439..45a9e91406b 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 c033562be92..66b19962135 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 8f2604dfd2f..d91a9ef1830 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 37b020d05fb..4319f870269 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 80873fe3057..d3dd70ab9d1 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 044c9b3f4f4..92ceeeca3e7 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 33cb54eb787..29921e127d4 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 a237001d92d..a5d5e126069 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 e8e39f2798f..17d438e7ba2 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 ae4c495ca00..bc2c72a7cc8 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 e8d844e1070..f8ef6ef51b2 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 d2b0375feca..dd943189f80 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 abd10c04ccc..ba1b7d05dd8 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 b87e9d42683..efa4a08d9d7 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 1eee7ecb268..6687faede03 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 a6c75d44676..f393988ff3e 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 2c232deff47..3808b19ec6b 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 70767a6dde6..201303cefdc 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 ae331f19f9c..7265e85a9eb 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 401fab42a7c..bb067ed1b44 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 554f4fdb526..95ba384991b 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 8ba6c02c1f8..73ca0cf68b4 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 09a54556b70..3afe3208094 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 b45dfc61978..fac5b7cad3c 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 3b59c52373c..a80f695947f 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 87aa5717c2a..3654b846b73 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 cff66f9c6ec..e59e0240e99 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 250581b7492..945f98f1f6a 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 c4bba359d68..909a7cdcfba 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 1b1c73f888b..5774ebd5db0 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 724e251b029..2300930113f 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 c4aa147e758..66b51387cf7 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 43fce1624ac..73ef264c2f2 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 57b650951db..d985769435d 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 28db92b97cf..b8ef8f9e626 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 27bf7a8a335..59bdd792aa9 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 48a2aca0787..770f16a764e 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 deea62f439d..4f3ed539446 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 330edc5ce56..4dfb23189e2 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 fa86e156f2c..2921c92583a 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 abb0b8f2011..794e24c6efe 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 1eebc1493d3..60d83603e55 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 56a376f3e1c..a73132c02de 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 df086c10ff6..c5e08432bf3 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 f62df3b756e..6f8e3709e63 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 ba0cbf7109c..f360da9f1d3 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 ae2be21d423..1ec31e14a80 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 394c0eb17c1..e0986fe9a67 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 203f9e4fc28..97af53ca47d 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 47e41e41fa6..0048b8f5d8a 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 78cca399191..201f5724c98 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 dc66c3c19c9..e9c775d7d7b 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 185a9759082..e1744301daf 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 a4d21cebdaf..9a4600b8fa2 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 1ad988d011e..2cef95cc11e 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 ba80c4be7d3..234f95c9089 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 a8bf6c913b2..881c19fe5e8 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 7dc19272396..65bace5e989 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 be270c0c949..9db6aa2737a 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 3daa3bb974f..bed40d0dd2f 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 35dfbbd8da7..a232f9c59fe 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 f86cb42ca51..9457c89d67c 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 f48f324fd97..7d7d19578c1 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 ad50dc4c5f6..ed08c914228 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 f6356ca41fd..d7559b5ef67 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 4e0c6271f7f..b1c848923db 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 32c5abb62aa..3b31b9affcb 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 b6f208be0a7..7549e7b3b25 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 7564cb78703..9e26c9f0e95 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 24d7763fb3a..58aa6226e31 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 b1321f031fe..9844ccd1059 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 46f1fb8fd2a..dde2b9a4067 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 abe03668526..cbed7959bbb 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 73f7620608e..fafedf24272 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 9f015c038ca..1c0d65183be 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 9a2ab0825ff..4da87dd1fe0 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 270c246026b..00ae7f1a2fb 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 8c0bf845e5f..0c8d463465e 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 39f0bb5d65b..8f2df197731 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 ca2f01c78ba..21ee54e5898 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 dec99744c6f..6a0f1cdef69 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) { From 3c9f502da48814a10abe380cc3e9508f2e7f159d Mon Sep 17 00:00:00 2001 From: Mark McCulloh Date: Tue, 9 Apr 2024 15:10:23 -0400 Subject: [PATCH 05/17] avoid extra import in helper --- libs/wingsdk/src/helpers.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/wingsdk/src/helpers.ts b/libs/wingsdk/src/helpers.ts index 220123e3ef1..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); } From a8fb1561daa577e81b99a766c9baf0d47ca1ec1b Mon Sep 17 00:00:00 2001 From: Mark McCulloh Date: Wed, 10 Apr 2024 11:06:41 -0400 Subject: [PATCH 06/17] fix with cjs --- libs/wingcompiler/package.json | 2 +- libs/wingcompiler/{preflight.shim.js => preflight.shim.cjs} | 0 libs/wingcompiler/src/compile.ts | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename libs/wingcompiler/{preflight.shim.js => preflight.shim.cjs} (100%) diff --git a/libs/wingcompiler/package.json b/libs/wingcompiler/package.json index d4763d28b44..c428369bbcc 100644 --- a/libs/wingcompiler/package.json +++ b/libs/wingcompiler/package.json @@ -4,7 +4,7 @@ "description": "Wing Compiler", "files": [ "wingc.wasm", - "preflight.shim.js", + "preflight.shim.cjs", "dist/" ], "license": "MIT", diff --git a/libs/wingcompiler/preflight.shim.js b/libs/wingcompiler/preflight.shim.cjs similarity index 100% rename from libs/wingcompiler/preflight.shim.js rename to libs/wingcompiler/preflight.shim.cjs diff --git a/libs/wingcompiler/src/compile.ts b/libs/wingcompiler/src/compile.ts index 26c454628d6..803acae2a92 100644 --- a/libs/wingcompiler/src/compile.ts +++ b/libs/wingcompiler/src/compile.ts @@ -335,7 +335,7 @@ async function runPreflightCodeInWorkerThread( env.WING_PREFLIGHT_ENTRYPOINT = JSON.stringify(entrypoint); await new Promise((resolve, reject) => { - const worker = fork(join(__dirname, "..", "preflight.shim.js"), { + const worker = fork(join(__dirname, "..", "preflight.shim.cjs"), { env, stdio: "inherit", }); From 34cfbc6b64cf71636203eacadf44fe376a4f4365 Mon Sep 17 00:00:00 2001 From: Mark McCulloh Date: Wed, 10 Apr 2024 11:07:31 -0400 Subject: [PATCH 07/17] wingc snaps --- .../src/dtsify/snapshots/declarations.snap | 85 +------------------ .../wingc/src/dtsify/snapshots/optionals.snap | 46 +--------- 2 files changed, 2 insertions(+), 129 deletions(-) diff --git a/libs/wingc/src/dtsify/snapshots/declarations.snap b/libs/wingc/src/dtsify/snapshots/declarations.snap index d78ddee311d..1633a1efb69 100644 --- a/libs/wingc/src/dtsify/snapshots/declarations.snap +++ b/libs/wingc/src/dtsify/snapshots/declarations.snap @@ -99,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); @@ -223,87 +224,3 @@ export class Child$Inflight extends ParentClass$Inflight implements ClassInterfa } ``` -<<<<<<< HEAD -## preflight.lib-1.js - -```js -"use strict"; -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); - } - addHandler(handler) { - } - static _toInflightType() { - return ` - require("${$helpers.normalPath(__dirname)}/inflight.ParentClass-1.js")({ - }) - `; - } - _toInflight() { - return ` - (await (async () => { - const ParentClassClient = ${ParentClass._toInflightType()}; - const client = new ParentClassClient({ - }); - if (client.$inflight_init) { await client.$inflight_init(); } - return client; - })()) - `; - } - get _liftMap() { - return ({ - "foo": [ - ], - "bar": [ - ], - "$inflight_init": [ - ], - }); - } - static get _liftTypeMap() { - return ({ - "static_method": [ - ], - }); - } -} -class Child extends ParentClass { - constructor($scope, $id, ) { - super($scope, $id); - } - static _toInflightType() { - return ` - require("${$helpers.normalPath(__dirname)}/inflight.Child-1.js")({ - $ParentClass: ${$stdlib.core.liftObject(ParentClass)}, - }) - `; - } - _toInflight() { - return ` - (await (async () => { - const ChildClient = ${Child._toInflightType()}; - const client = new ChildClient({ - }); - if (client.$inflight_init) { await client.$inflight_init(); } - return client; - })()) - `; - } - get _liftMap() { - return $stdlib.core.mergeLiftDeps(super._liftMap, { - "$inflight_init": [ - ], - }); - } -} -module.exports = { ParentClass, Child }; -//# sourceMappingURL=preflight.lib-1.js.map -``` - -======= ->>>>>>> f0e2479d64ee2fc807ed12331edf77cd3d30276a diff --git a/libs/wingc/src/dtsify/snapshots/optionals.snap b/libs/wingc/src/dtsify/snapshots/optionals.snap index ec7a7231cdc..6d761424825 100644 --- a/libs/wingc/src/dtsify/snapshots/optionals.snap +++ b/libs/wingc/src/dtsify/snapshots/optionals.snap @@ -65,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); @@ -134,48 +135,3 @@ export class ParentClass$Inflight implements ClassInterface$Inflight } ``` -<<<<<<< HEAD -## preflight.lib-1.js - -```js -"use strict"; -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); - } - addHandler(handler, s) { - } - static _toInflightType() { - return ` - require("${$helpers.normalPath(__dirname)}/inflight.ParentClass-1.js")({ - }) - `; - } - _toInflight() { - return ` - (await (async () => { - const ParentClassClient = ${ParentClass._toInflightType()}; - const client = new ParentClassClient({ - }); - if (client.$inflight_init) { await client.$inflight_init(); } - return client; - })()) - `; - } - get _liftMap() { - return ({ - "$inflight_init": [ - ], - }); - } -} -module.exports = { ParentClass }; -//# sourceMappingURL=preflight.lib-1.js.map -``` - -======= ->>>>>>> f0e2479d64ee2fc807ed12331edf77cd3d30276a From bbbefb990a49a200a4b38a912125d97b1c2b6209 Mon Sep 17 00:00:00 2001 From: Mark McCulloh Date: Wed, 10 Apr 2024 11:10:52 -0400 Subject: [PATCH 08/17] hangar snaps --- ..._extend_non_entry.test.w_compile_tf-aws.md | 28 +------------ .../bring_local.test.w_compile_tf-aws.md | 27 +----------- .../bring_local_dir.test.w_compile_tf-aws.md | 42 +------------------ ...cal_normalization.test.w_compile_tf-aws.md | 39 +---------------- ...ring_wing_library.test.w_compile_tf-aws.md | 30 +------------ ...rn_implementation.test.w_compile_tf-aws.md | 21 +++------- .../valid/store.w_compile_tf-aws.md | 16 +------ 7 files changed, 12 insertions(+), 191 deletions(-) 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 a12263fb240..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) { @@ -94,33 +95,6 @@ class Foo extends (this?.node?.root?.typeForFqn("cdk8s.Chart") ?? cdk8s.Chart) { } } module.exports = { Foo }; -<<<<<<< HEAD -//# sourceMappingURL=preflight.extendnonentrypoint-1.js.map -``` - -## preflight.js -```js -"use strict"; -const $stdlib = require('@winglang/sdk'); -const $platforms = ((s) => !s ? [] : s.split(';'))(process.env.WING_PLATFORMS); -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.js"); -class $Root extends $stdlib.std.Resource { - constructor($scope, $id) { - super($scope, $id); - const f = new lib.Foo(this, "Foo"); - } -} -const $PlatformManager = new $stdlib.platform.PlatformManager({platformPaths: $platforms}); -const $APP = $PlatformManager.createApp({ outdir: $outdir, name: "bring_extend_non_entry.test", rootConstruct: $Root, isTestEnvironment: $wing_is_test, entrypointDir: process.env['WING_SOURCE_DIR'], rootId: process.env['WING_ROOT_ID'] }); -$APP.synth(); -//# sourceMappingURL=preflight.js.map -======= //# sourceMappingURL=preflight.extendnonentrypoint-1.cjs.map ->>>>>>> f0e2479d64ee2fc807ed12331edf77cd3d30276a ``` 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 00dfe6a69c0..df2f5a4e676 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 @@ -268,24 +268,8 @@ module.exports = function({ }) { } ``` -<<<<<<< HEAD -## preflight.empty-1.js -```js -"use strict"; -const $stdlib = require('@winglang/sdk'); -const std = $stdlib.std; -const $helpers = $stdlib.helpers; -const $extern = $helpers.createExternRequire(__dirname); -module.exports = { }; -//# sourceMappingURL=preflight.empty-1.js.map -``` - -## preflight.js -```js -======= ## preflight.cjs ```cjs ->>>>>>> f0e2479d64ee2fc807ed12331edf77cd3d30276a "use strict"; const $stdlib = require('@winglang/sdk'); const $platforms = ((s) => !s ? [] : s.split(';'))(process.env.WING_PLATFORMS); @@ -293,16 +277,10 @@ 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; -<<<<<<< HEAD const $extern = $helpers.createExternRequire(__dirname); -const file1 = require("./preflight.store-2.js"); -const file2 = require("./preflight.subfile-3.js"); -const file3 = require("./preflight.empty-1.js"); -======= const file1 = require("./preflight.store-2.cjs"); const file2 = require("./preflight.subfile-3.cjs"); const file3 = require("./preflight.empty-1.cjs"); ->>>>>>> f0e2479d64ee2fc807ed12331edf77cd3d30276a const math = $stdlib.math; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { @@ -422,10 +400,7 @@ $APP.synth(); const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; -<<<<<<< HEAD const $extern = $helpers.createExternRequire(__dirname); -const file3 = require("./preflight.empty-1.js"); -======= module.exports = { }; //# sourceMappingURL=preflight.empty-1.cjs.map ``` @@ -436,8 +411,8 @@ 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"); ->>>>>>> f0e2479d64ee2fc807ed12331edf77cd3d30276a const math = $stdlib.math; const cloud = $stdlib.cloud; const Color = 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 25537e1fcae..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,12 +113,8 @@ $APP.synth(); const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; -<<<<<<< HEAD const $extern = $helpers.createExternRequire(__dirname); -const blah = require("./preflight.inner-2.js"); -======= const blah = require("./preflight.inner-2.cjs"); ->>>>>>> f0e2479d64ee2fc807ed12331edf77cd3d30276a const cloud = $stdlib.cloud; const util = $stdlib.util; class Foo extends $stdlib.std.Resource { @@ -243,45 +240,8 @@ module.exports = { //# sourceMappingURL=preflight.inner-2.cjs.map ``` -<<<<<<< HEAD -## preflight.js -```js -"use strict"; -const $stdlib = require('@winglang/sdk'); -const $platforms = ((s) => !s ? [] : s.split(';'))(process.env.WING_PLATFORMS); -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.js"); -const subdir = require("./preflight.subdir2-5.js"); -class $Root extends $stdlib.std.Resource { - constructor($scope, $id) { - super($scope, $id); - const widget1 = new w.Widget(this, "widget1"); - $helpers.assert($helpers.eq((widget1.compute()), 42), "widget1.compute() == 42"); - const foo = new subdir.Foo(this, "Foo"); - $helpers.assert($helpers.eq((foo.foo()), "foo"), "foo.foo() == \"foo\""); - const bar = new subdir.Bar(this, "Bar"); - $helpers.assert($helpers.eq((bar.bar()), "bar"), "bar.bar() == \"bar\""); - const widget2 = new subdir.inner.Widget(this, "widget2"); - $helpers.assert($helpers.eq((widget2.compute()), 42), "widget2.compute() == 42"); - $helpers.assert($helpers.eq((foo.checkWidget(widget2)), 1379), "foo.checkWidget(widget2) == 1379"); - } -} -const $PlatformManager = new $stdlib.platform.PlatformManager({platformPaths: $platforms}); -const $APP = $PlatformManager.createApp({ outdir: $outdir, name: "bring_local_dir.test", rootConstruct: $Root, isTestEnvironment: $wing_is_test, entrypointDir: process.env['WING_SOURCE_DIR'], rootId: process.env['WING_ROOT_ID'] }); -$APP.synth(); -//# sourceMappingURL=preflight.js.map -``` - -## preflight.subdir2-5.js -```js -======= ## preflight.subdir2-5.cjs ```cjs ->>>>>>> f0e2479d64ee2fc807ed12331edf77cd3d30276a "use strict"; const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; 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 9238ecb94d9..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 @@ -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 foo = require("./preflight.foo-3.cjs"); const bar = require("./preflight.bar-1.cjs"); const baz = require("./preflight.baz-2.cjs"); @@ -179,14 +180,9 @@ $APP.synth(); const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; -<<<<<<< HEAD const $extern = $helpers.createExternRequire(__dirname); -const bar = require("./preflight.bar-1.js"); -const baz = require("./preflight.baz-2.js"); -======= const bar = require("./preflight.bar-1.cjs"); const baz = require("./preflight.baz-2.cjs"); ->>>>>>> f0e2479d64ee2fc807ed12331edf77cd3d30276a class Foo extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); @@ -225,39 +221,6 @@ class Foo extends $stdlib.std.Resource { } } module.exports = { Foo }; -<<<<<<< HEAD -//# sourceMappingURL=preflight.foo-3.js.map -``` - -## preflight.js -```js -"use strict"; -const $stdlib = require('@winglang/sdk'); -const $platforms = ((s) => !s ? [] : s.split(';'))(process.env.WING_PLATFORMS); -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.js"); -const bar = require("./preflight.bar-1.js"); -const baz = require("./preflight.baz-2.js"); -class $Root extends $stdlib.std.Resource { - constructor($scope, $id) { - super($scope, $id); - $helpers.assert($helpers.eq((foo.Foo.foo(this)), "foo"), "foo.Foo.foo() == \"foo\""); - $helpers.assert($helpers.eq((foo.Foo.bar(this)), "bar"), "foo.Foo.bar() == \"bar\""); - $helpers.assert($helpers.eq((foo.Foo.baz(this)), "baz"), "foo.Foo.baz() == \"baz\""); - $helpers.assert($helpers.eq((bar.Bar.bar(this)), "bar"), "bar.Bar.bar() == \"bar\""); - $helpers.assert($helpers.eq((baz.Baz.baz(this)), "baz"), "baz.Baz.baz() == \"baz\""); - } -} -const $PlatformManager = new $stdlib.platform.PlatformManager({platformPaths: $platforms}); -const $APP = $PlatformManager.createApp({ outdir: $outdir, name: "bring_local_normalization.test", rootConstruct: $Root, isTestEnvironment: $wing_is_test, entrypointDir: process.env['WING_SOURCE_DIR'], rootId: process.env['WING_ROOT_ID'] }); -$APP.synth(); -//# sourceMappingURL=preflight.js.map -======= //# sourceMappingURL=preflight.foo-3.cjs.map ->>>>>>> f0e2479d64ee2fc807ed12331edf77cd3d30276a ``` 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 bfa69836dac..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 @@ -98,31 +98,8 @@ module.exports = function({ }) { } ``` -<<<<<<< HEAD -## preflight.enums-1.js -```js -"use strict"; -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"; - tmp["FORTY_TWO"] = "FORTY_TWO"; - return tmp; - })({}) -; -module.exports = { FavoriteNumbers }; -//# sourceMappingURL=preflight.enums-1.js.map -``` - -## preflight.js -```js -======= ## preflight.cjs ```cjs ->>>>>>> f0e2479d64ee2fc807ed12331edf77cd3d30276a "use strict"; const $stdlib = require('@winglang/sdk'); const $platforms = ((s) => !s ? [] : s.split(';'))(process.env.WING_PLATFORMS); @@ -130,16 +107,10 @@ 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; -<<<<<<< HEAD const $extern = $helpers.createExternRequire(__dirname); -const fixture = require("./preflight.testfixture-5.js"); -const testfixture = require("./preflight.testfixture-5.js"); -const testfixture2 = require("./preflight.testfixture-5.js"); -======= const fixture = require("./preflight.testfixture-5.cjs"); const testfixture = require("./preflight.testfixture-5.cjs"); const testfixture2 = require("./preflight.testfixture-5.cjs"); ->>>>>>> f0e2479d64ee2fc807ed12331edf77cd3d30276a class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); @@ -198,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"; 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 6cf96f480ec..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 @@ -37,11 +37,11 @@ module.exports = function({ $func }) { } return $Closure2; } -//# sourceMappingURL=inflight.$Closure2-1.js.map +//# sourceMappingURL=inflight.$Closure2-1.cjs.map ``` -## inflight.$Closure3-1.js -```js +## inflight.$Closure3-1.cjs +```cjs "use strict"; const $helpers = require("@winglang/sdk/lib/helpers"); module.exports = function({ $Foo }) { @@ -57,11 +57,7 @@ module.exports = function({ $Foo }) { } return $Closure3; } -<<<<<<< HEAD -//# sourceMappingURL=inflight.$Closure3-1.js.map -======= -//# sourceMappingURL=inflight.$Closure2-1.cjs.map ->>>>>>> f0e2479d64ee2fc807ed12331edf77cd3d30276a +//# sourceMappingURL=inflight.$Closure3-1.cjs.map ``` ## inflight.Foo-1.cjs @@ -338,13 +334,8 @@ class $Root extends $stdlib.std.Resource { } static _toInflightType() { return ` -<<<<<<< HEAD - require("${$helpers.normalPath(__dirname)}/inflight.$Closure2-1.js")({ - $func: ${$stdlib.core.liftObject(func)}, -======= require("${$helpers.normalPath(__dirname)}/inflight.$Closure2-1.cjs")({ - $Foo: ${$stdlib.core.liftObject(Foo)}, ->>>>>>> f0e2479d64ee2fc807ed12331edf77cd3d30276a + $func: ${$stdlib.core.liftObject(func)}, }) `; } @@ -378,7 +369,7 @@ class $Root extends $stdlib.std.Resource { } static _toInflightType() { return ` - require("${$helpers.normalPath(__dirname)}/inflight.$Closure3-1.js")({ + require("${$helpers.normalPath(__dirname)}/inflight.$Closure3-1.cjs")({ $Foo: ${$stdlib.core.liftObject(Foo)}, }) `; 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 fc269a25186..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,23 +58,8 @@ module.exports = function({ }) { const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; -<<<<<<< HEAD const $extern = $helpers.createExternRequire(__dirname); -module.exports = { }; -//# sourceMappingURL=preflight.empty-1.js.map -``` - -## preflight.js -```js -"use strict"; -const $stdlib = require('@winglang/sdk'); -const std = $stdlib.std; -const $helpers = $stdlib.helpers; -const $extern = $helpers.createExternRequire(__dirname); -const file3 = require("./preflight.empty-1.js"); -======= const file3 = require("./preflight.empty-1.cjs"); ->>>>>>> f0e2479d64ee2fc807ed12331edf77cd3d30276a const math = $stdlib.math; const cloud = $stdlib.cloud; const Color = @@ -194,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 ``` From 6f39b2edf17ce0a5768f068fcc754e79bfc6031a Mon Sep 17 00:00:00 2001 From: "monada-bot[bot]" Date: Wed, 10 Apr 2024 15:29:54 +0000 Subject: [PATCH 09/17] chore: self mutation (e2e-1of2.diff) Signed-off-by: monada-bot[bot] --- .../test_corpus/valid/resource.test.w_test_sim.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/resource.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/resource.test.w_test_sim.md index 200862d0671..6ab996b5cae 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/resource.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/resource.test.w_test_sim.md @@ -1,5 +1,16 @@ # [resource.test.w](../../../../../examples/tests/valid/resource.test.w) | test | sim +## stderr.log +```log +Error: Resource "root/env1/BigPublisher/Queue" does not have permission to perform operation "hasAvailableWorkers" on resource "root/env1/BigPublisher/Queue/SetConsumer0". + at Proxy. (:LINE:COL) + at process.processTicksAndRejections (node:internal/process/task_queues:95:5) + at async Queue.processMessages (:LINE:COL) + at async loop (:LINE:COL) { + name: undefined +} +``` + ## stdout.log ```log pass ┌ resource.test.wsim » root/env0/test:test From e9f017737ba31d0b3513911979c4eccc17c48399 Mon Sep 17 00:00:00 2001 From: Mark McCulloh Date: Wed, 10 Apr 2024 13:38:00 -0400 Subject: [PATCH 10/17] update --- .../test_corpus/valid/resource.test.w_test_sim.md | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/resource.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/resource.test.w_test_sim.md index 6ab996b5cae..200862d0671 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/resource.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/resource.test.w_test_sim.md @@ -1,16 +1,5 @@ # [resource.test.w](../../../../../examples/tests/valid/resource.test.w) | test | sim -## stderr.log -```log -Error: Resource "root/env1/BigPublisher/Queue" does not have permission to perform operation "hasAvailableWorkers" on resource "root/env1/BigPublisher/Queue/SetConsumer0". - at Proxy. (:LINE:COL) - at process.processTicksAndRejections (node:internal/process/task_queues:95:5) - at async Queue.processMessages (:LINE:COL) - at async loop (:LINE:COL) { - name: undefined -} -``` - ## stdout.log ```log pass ┌ resource.test.wsim » root/env0/test:test From bfbe28dec8ba4cbd3da2b2b361af436657939e93 Mon Sep 17 00:00:00 2001 From: "monada-bot[bot]" Date: Wed, 10 Apr 2024 17:48:10 +0000 Subject: [PATCH 11/17] chore: self mutation (e2e-1of2.diff) Signed-off-by: monada-bot[bot] --- .../test_corpus/valid/resource.test.w_test_sim.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/resource.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/resource.test.w_test_sim.md index 200862d0671..6ab996b5cae 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/resource.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/resource.test.w_test_sim.md @@ -1,5 +1,16 @@ # [resource.test.w](../../../../../examples/tests/valid/resource.test.w) | test | sim +## stderr.log +```log +Error: Resource "root/env1/BigPublisher/Queue" does not have permission to perform operation "hasAvailableWorkers" on resource "root/env1/BigPublisher/Queue/SetConsumer0". + at Proxy. (:LINE:COL) + at process.processTicksAndRejections (node:internal/process/task_queues:95:5) + at async Queue.processMessages (:LINE:COL) + at async loop (:LINE:COL) { + name: undefined +} +``` + ## stdout.log ```log pass ┌ resource.test.wsim » root/env0/test:test From 42076827f8810dbe2accad606e1b23e6c86267eb Mon Sep 17 00:00:00 2001 From: Mark McCulloh Date: Wed, 10 Apr 2024 14:00:35 -0400 Subject: [PATCH 12/17] try again --- .../test_corpus/valid/resource.test.w_test_sim.md | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/resource.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/resource.test.w_test_sim.md index 6ab996b5cae..200862d0671 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/resource.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/resource.test.w_test_sim.md @@ -1,16 +1,5 @@ # [resource.test.w](../../../../../examples/tests/valid/resource.test.w) | test | sim -## stderr.log -```log -Error: Resource "root/env1/BigPublisher/Queue" does not have permission to perform operation "hasAvailableWorkers" on resource "root/env1/BigPublisher/Queue/SetConsumer0". - at Proxy. (:LINE:COL) - at process.processTicksAndRejections (node:internal/process/task_queues:95:5) - at async Queue.processMessages (:LINE:COL) - at async loop (:LINE:COL) { - name: undefined -} -``` - ## stdout.log ```log pass ┌ resource.test.wsim » root/env0/test:test From 49d674bba18cfbd66d7f55e1074427b6d73b4462 Mon Sep 17 00:00:00 2001 From: Mark McCulloh Date: Wed, 10 Apr 2024 14:34:29 -0400 Subject: [PATCH 13/17] fix test --- libs/wingsdk/src/target-sim/queue.ts | 29 ++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/libs/wingsdk/src/target-sim/queue.ts b/libs/wingsdk/src/target-sim/queue.ts index 44629ef679f..e8e1d239abf 100644 --- a/libs/wingsdk/src/target-sim/queue.ts +++ b/libs/wingsdk/src/target-sim/queue.ts @@ -6,9 +6,9 @@ import { Function, FunctionInflightMethods as SimFunctionInflightMethods, } from "./function"; -import { Policy } from "./policy"; import { ISimulatorResource } from "./resource"; import { QueueSchema } from "./schema-resources"; +import { simulatorHandleToken } from "./tokens"; import { bindSimulatorResource, makeSimulatorJsClient } from "./util"; import * as cloud from "../cloud"; import { NotImplementedError } from "../core/errors"; @@ -24,7 +24,8 @@ import { Duration, IInflightHost, Node, SDK_SOURCE_MODULE } from "../std"; export class Queue extends cloud.Queue implements ISimulatorResource { private readonly timeout: Duration; private readonly retentionPeriod: Duration; - private readonly policy: Policy; + private readonly consumers: Function[] = []; + constructor(scope: Construct, id: string, props: cloud.QueueProps = {}) { super(scope, id, props); @@ -47,8 +48,6 @@ export class Queue extends cloud.Queue implements ISimulatorResource { "Retention period must be greater than or equal to timeout" ); } - - this.policy = new Policy(this, "Policy", { principal: this }); } /** @internal */ @@ -99,8 +98,9 @@ export class Queue extends cloud.Queue implements ISimulatorResource { functionHandler, props ); - Node.of(fn).sourceModule = SDK_SOURCE_MODULE; - Node.of(fn).title = "setConsumer()"; + const fnNode = Node.of(fn); + fnNode.sourceModule = SDK_SOURCE_MODULE; + fnNode.title = "setConsumer()"; new EventMapping(this, App.of(this).makeId(this, "QueueEventMapping"), { subscriber: fn, @@ -116,12 +116,7 @@ export class Queue extends cloud.Queue implements ISimulatorResource { name: "setConsumer()", }); - this.policy.addStatement(fn, cloud.FunctionInflightMethods.INVOKE); - this.policy.addStatement( - fn, - SimFunctionInflightMethods.HAS_AVAILABLE_WORKERS - ); - + this.consumers.push(fn); return fn; } @@ -132,6 +127,16 @@ export class Queue extends cloud.Queue implements ISimulatorResource { }; return { type: cloud.QUEUE_FQN, + policy: this.consumers.flatMap((fn) => [ + { + operation: cloud.FunctionInflightMethods.INVOKE, + resourceHandle: simulatorHandleToken(fn), + }, + { + operation: SimFunctionInflightMethods.HAS_AVAILABLE_WORKERS, + resourceHandle: simulatorHandleToken(fn), + }, + ]), props, }; } From a10beac8ca2942b8d294103d60a9f79bd9a0bdff Mon Sep 17 00:00:00 2001 From: Mark McCulloh Date: Wed, 10 Apr 2024 16:56:45 -0400 Subject: [PATCH 14/17] fix test --- .../__snapshots__/file-counter.test.ts.snap | 41 ++--- .../__snapshots__/queue.test.ts.snap | 161 +++--------------- libs/wingsdk/test/target-sim/queue.test.ts | 2 +- 3 files changed, 34 insertions(+), 170 deletions(-) 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..c683968c654 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 @@ -104,30 +104,22 @@ bucket: (function() { "root/HelloWorld/Queue": { "addr": "c8de0494647ac0bdaec85a77e2a164cfbcfecc5ca1", "path": "root/HelloWorld/Queue", + "policy": [ + { + "operation": "invoke", + "resourceHandle": "\${wsim#root/HelloWorld/Queue/SetConsumer0#attrs.handle}", + }, + { + "operation": "hasAvailableWorkers", + "resourceHandle": "\${wsim#root/HelloWorld/Queue/SetConsumer0#attrs.handle}", + }, + ], "props": { "retentionPeriod": 3600, "timeout": 30, }, "type": "@winglang/sdk.cloud.Queue", }, - "root/HelloWorld/Queue/Policy": { - "addr": "c86b009930462795eeb90e647a56dbfc5356d9ea80", - "path": "root/HelloWorld/Queue/Policy", - "props": { - "principal": "\${wsim#root/HelloWorld/Queue#attrs.handle}", - "statements": [ - { - "operation": "invoke", - "resourceHandle": "\${wsim#root/HelloWorld/Queue/SetConsumer0#attrs.handle}", - }, - { - "operation": "hasAvailableWorkers", - "resourceHandle": "\${wsim#root/HelloWorld/Queue/SetConsumer0#attrs.handle}", - }, - ], - }, - "type": "@winglang/sdk.sim.Policy", - }, "root/HelloWorld/Queue/QueueEventMapping0": { "addr": "c80de7940bef4e6ad61443a5ed07362f300a117b29", "deps": [ @@ -304,19 +296,6 @@ bucket: (function() { }, "Queue": { "children": { - "Policy": { - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0", - }, - "display": { - "description": "A simulated resource policy", - "hidden": true, - "title": "Policy", - }, - "id": "Policy", - "path": "root/HelloWorld/Queue/Policy", - }, "QueueEventMapping0": { "constructInfo": { "fqn": "constructs.Construct", 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..93d72b1284a 100644 --- a/libs/wingsdk/test/target-sim/__snapshots__/queue.test.ts.snap +++ b/libs/wingsdk/test/target-sim/__snapshots__/queue.test.ts.snap @@ -11,21 +11,13 @@ exports[`create a queue 1`] = ` "root/my_queue": { "addr": "c8dee4ef24593d08aa22e8845be36d0ee754fcf4cd", "path": "root/my_queue", + "policy": [], "props": { "retentionPeriod": 3600, "timeout": 30, }, "type": "@winglang/sdk.cloud.Queue", }, - "root/my_queue/Policy": { - "addr": "c88a4c68047871c2d322479c886423828e8119d85c", - "path": "root/my_queue/Policy", - "props": { - "principal": "\${wsim#root/my_queue#attrs.handle}", - "statements": [], - }, - "type": "@winglang/sdk.sim.Policy", - }, }, "sdkVersion": "0.0.0", "types": { @@ -115,21 +107,6 @@ exports[`create a queue 1`] = ` "tree": { "children": { "my_queue": { - "children": { - "Policy": { - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0", - }, - "display": { - "description": "A simulated resource policy", - "hidden": true, - "title": "Policy", - }, - "id": "Policy", - "path": "root/my_queue/Policy", - }, - }, "constructInfo": { "fqn": "constructs.Construct", "version": "10.3.0", @@ -608,9 +585,7 @@ async handle(message) { exports[`push rejects empty message 1`] = ` [ "root/my_queue started", - "root/my_queue/Policy started", "Push (messages=).", - "root/my_queue/Policy stopped", "root/my_queue stopped", ] `; @@ -626,21 +601,13 @@ exports[`push rejects empty message 2`] = ` "root/my_queue": { "addr": "c8dee4ef24593d08aa22e8845be36d0ee754fcf4cd", "path": "root/my_queue", + "policy": [], "props": { "retentionPeriod": 3600, "timeout": 30, }, "type": "@winglang/sdk.cloud.Queue", }, - "root/my_queue/Policy": { - "addr": "c88a4c68047871c2d322479c886423828e8119d85c", - "path": "root/my_queue/Policy", - "props": { - "principal": "\${wsim#root/my_queue#attrs.handle}", - "statements": [], - }, - "type": "@winglang/sdk.sim.Policy", - }, }, "sdkVersion": "0.0.0", "types": { @@ -730,21 +697,6 @@ exports[`push rejects empty message 2`] = ` "tree": { "children": { "my_queue": { - "children": { - "Policy": { - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0", - }, - "display": { - "description": "A simulated resource policy", - "hidden": true, - "title": "Policy", - }, - "id": "Policy", - "path": "root/my_queue/Policy", - }, - }, "constructInfo": { "fqn": "constructs.Construct", "version": "10.3.0", @@ -772,13 +724,11 @@ exports[`push rejects empty message 2`] = ` exports[`queue batch size of 2, purge the queue 1`] = ` [ "root/my_queue started", - "root/my_queue/Policy started", "Push (messages=A).", "Push (messages=B).", "ApproxSize ().", "Purge ().", "ApproxSize ().", - "root/my_queue/Policy stopped", "root/my_queue stopped", ] `; @@ -794,21 +744,13 @@ exports[`queue batch size of 2, purge the queue 2`] = ` "root/my_queue": { "addr": "c8dee4ef24593d08aa22e8845be36d0ee754fcf4cd", "path": "root/my_queue", + "policy": [], "props": { "retentionPeriod": 3600, "timeout": 30, }, "type": "@winglang/sdk.cloud.Queue", }, - "root/my_queue/Policy": { - "addr": "c88a4c68047871c2d322479c886423828e8119d85c", - "path": "root/my_queue/Policy", - "props": { - "principal": "\${wsim#root/my_queue#attrs.handle}", - "statements": [], - }, - "type": "@winglang/sdk.sim.Policy", - }, }, "sdkVersion": "0.0.0", "types": { @@ -898,21 +840,6 @@ exports[`queue batch size of 2, purge the queue 2`] = ` "tree": { "children": { "my_queue": { - "children": { - "Policy": { - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0", - }, - "display": { - "description": "A simulated resource policy", - "hidden": true, - "title": "Policy", - }, - "id": "Policy", - "path": "root/my_queue/Policy", - }, - }, "constructInfo": { "fqn": "constructs.Construct", "version": "10.3.0", @@ -1019,30 +946,22 @@ async handle(message) { "root/my_queue": { "addr": "c8dee4ef24593d08aa22e8845be36d0ee754fcf4cd", "path": "root/my_queue", + "policy": [ + { + "operation": "invoke", + "resourceHandle": "\${wsim#root/my_queue/SetConsumer0#attrs.handle}", + }, + { + "operation": "hasAvailableWorkers", + "resourceHandle": "\${wsim#root/my_queue/SetConsumer0#attrs.handle}", + }, + ], "props": { "retentionPeriod": 3600, "timeout": 30, }, "type": "@winglang/sdk.cloud.Queue", }, - "root/my_queue/Policy": { - "addr": "c88a4c68047871c2d322479c886423828e8119d85c", - "path": "root/my_queue/Policy", - "props": { - "principal": "\${wsim#root/my_queue#attrs.handle}", - "statements": [ - { - "operation": "invoke", - "resourceHandle": "\${wsim#root/my_queue/SetConsumer0#attrs.handle}", - }, - { - "operation": "hasAvailableWorkers", - "resourceHandle": "\${wsim#root/my_queue/SetConsumer0#attrs.handle}", - }, - ], - }, - "type": "@winglang/sdk.sim.Policy", - }, "root/my_queue/QueueEventMapping0": { "addr": "c8f9f7d56097ba3d2e0e82988718175a5d841f855e", "deps": [ @@ -1196,19 +1115,6 @@ async handle(message) { "children": { "my_queue": { "children": { - "Policy": { - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0", - }, - "display": { - "description": "A simulated resource policy", - "hidden": true, - "title": "Policy", - }, - "id": "Policy", - "path": "root/my_queue/Policy", - }, "QueueEventMapping0": { "constructInfo": { "fqn": "constructs.Construct", @@ -1324,30 +1230,22 @@ async handle(message) { "root/my_queue": { "addr": "c8dee4ef24593d08aa22e8845be36d0ee754fcf4cd", "path": "root/my_queue", + "policy": [ + { + "operation": "invoke", + "resourceHandle": "\${wsim#root/my_queue/SetConsumer0#attrs.handle}", + }, + { + "operation": "hasAvailableWorkers", + "resourceHandle": "\${wsim#root/my_queue/SetConsumer0#attrs.handle}", + }, + ], "props": { "retentionPeriod": 3600, "timeout": 30, }, "type": "@winglang/sdk.cloud.Queue", }, - "root/my_queue/Policy": { - "addr": "c88a4c68047871c2d322479c886423828e8119d85c", - "path": "root/my_queue/Policy", - "props": { - "principal": "\${wsim#root/my_queue#attrs.handle}", - "statements": [ - { - "operation": "invoke", - "resourceHandle": "\${wsim#root/my_queue/SetConsumer0#attrs.handle}", - }, - { - "operation": "hasAvailableWorkers", - "resourceHandle": "\${wsim#root/my_queue/SetConsumer0#attrs.handle}", - }, - ], - }, - "type": "@winglang/sdk.sim.Policy", - }, "root/my_queue/QueueEventMapping0": { "addr": "c8f9f7d56097ba3d2e0e82988718175a5d841f855e", "deps": [ @@ -1467,19 +1365,6 @@ async handle(message) { "children": { "my_queue": { "children": { - "Policy": { - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0", - }, - "display": { - "description": "A simulated resource policy", - "hidden": true, - "title": "Policy", - }, - "id": "Policy", - "path": "root/my_queue/Policy", - }, "QueueEventMapping0": { "constructInfo": { "fqn": "constructs.Construct", diff --git a/libs/wingsdk/test/target-sim/queue.test.ts b/libs/wingsdk/test/target-sim/queue.test.ts index 1b6e7d0e4db..9bd1d7ca011 100644 --- a/libs/wingsdk/test/target-sim/queue.test.ts +++ b/libs/wingsdk/test/target-sim/queue.test.ts @@ -370,6 +370,6 @@ test("push rejects empty message", async () => { await s.stop(); expect(listMessages(s)).toMatchSnapshot(); - expect(s.listTraces()[2].data.status).toEqual("failure"); + expect(s.listTraces()[1].data.status).toEqual("failure"); expect(app.snapshot()).toMatchSnapshot(); }); From bb3aec2854d800e06e59e5eea37202fee7f8d834 Mon Sep 17 00:00:00 2001 From: Mark McCulloh Date: Wed, 10 Apr 2024 17:36:23 -0400 Subject: [PATCH 15/17] doc changes --- docs/docs/03-language-reference.md | 11 +++-------- docs/docs/07-examples/10-using-javascript.md | 4 ++-- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/docs/docs/03-language-reference.md b/docs/docs/03-language-reference.md index f4f26739a16..b5f23222a1e 100644 --- a/docs/docs/03-language-reference.md +++ b/docs/docs/03-language-reference.md @@ -1876,7 +1876,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`: @@ -1911,13 +1912,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` From d18857f26ccab050a45f463c0f34eb0568050202 Mon Sep 17 00:00:00 2001 From: Mark McCulloh Date: Wed, 10 Apr 2024 19:39:55 -0400 Subject: [PATCH 16/17] fix from chris' suggestion --- libs/wingsdk/src/target-sim/queue.inflight.ts | 6 +- libs/wingsdk/src/target-sim/queue.ts | 42 ++--- .../__snapshots__/file-counter.test.ts.snap | 42 +++-- .../__snapshots__/queue.test.ts.snap | 163 +++++++++++++++--- libs/wingsdk/test/target-sim/queue.test.ts | 2 +- 5 files changed, 200 insertions(+), 55 deletions(-) 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 e8e1d239abf..006482ad3ac 100644 --- a/libs/wingsdk/src/target-sim/queue.ts +++ b/libs/wingsdk/src/target-sim/queue.ts @@ -6,9 +6,9 @@ import { Function, FunctionInflightMethods as SimFunctionInflightMethods, } from "./function"; +import { Policy } from "./policy"; import { ISimulatorResource } from "./resource"; import { QueueSchema } from "./schema-resources"; -import { simulatorHandleToken } from "./tokens"; import { bindSimulatorResource, makeSimulatorJsClient } from "./util"; import * as cloud from "../cloud"; import { NotImplementedError } from "../core/errors"; @@ -24,7 +24,7 @@ import { Duration, IInflightHost, Node, SDK_SOURCE_MODULE } from "../std"; export class Queue extends cloud.Queue implements ISimulatorResource { private readonly timeout: Duration; private readonly retentionPeriod: Duration; - private readonly consumers: Function[] = []; + private readonly policy: Policy; constructor(scope: Construct, id: string, props: cloud.QueueProps = {}) { super(scope, id, props); @@ -48,6 +48,8 @@ export class Queue extends cloud.Queue implements ISimulatorResource { "Retention period must be greater than or equal to timeout" ); } + + this.policy = new Policy(this, "Policy", { principal: this }); } /** @internal */ @@ -102,13 +104,24 @@ export class Queue extends cloud.Queue implements ISimulatorResource { fnNode.sourceModule = SDK_SOURCE_MODULE; fnNode.title = "setConsumer()"; - new EventMapping(this, App.of(this).makeId(this, "QueueEventMapping"), { - subscriber: fn, - publisher: this, - subscriptionProps: { - batchSize: props.batchSize ?? 1, - }, - }); + 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, @@ -116,7 +129,6 @@ export class Queue extends cloud.Queue implements ISimulatorResource { name: "setConsumer()", }); - this.consumers.push(fn); return fn; } @@ -127,16 +139,6 @@ export class Queue extends cloud.Queue implements ISimulatorResource { }; return { type: cloud.QUEUE_FQN, - policy: this.consumers.flatMap((fn) => [ - { - operation: cloud.FunctionInflightMethods.INVOKE, - resourceHandle: simulatorHandleToken(fn), - }, - { - operation: SimFunctionInflightMethods.HAS_AVAILABLE_WORKERS, - resourceHandle: simulatorHandleToken(fn), - }, - ]), props, }; } 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 c683968c654..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 @@ -104,27 +104,36 @@ bucket: (function() { "root/HelloWorld/Queue": { "addr": "c8de0494647ac0bdaec85a77e2a164cfbcfecc5ca1", "path": "root/HelloWorld/Queue", - "policy": [ - { - "operation": "invoke", - "resourceHandle": "\${wsim#root/HelloWorld/Queue/SetConsumer0#attrs.handle}", - }, - { - "operation": "hasAvailableWorkers", - "resourceHandle": "\${wsim#root/HelloWorld/Queue/SetConsumer0#attrs.handle}", - }, - ], "props": { "retentionPeriod": 3600, "timeout": 30, }, "type": "@winglang/sdk.cloud.Queue", }, + "root/HelloWorld/Queue/Policy": { + "addr": "c86b009930462795eeb90e647a56dbfc5356d9ea80", + "path": "root/HelloWorld/Queue/Policy", + "props": { + "principal": "\${wsim#root/HelloWorld/Queue#attrs.handle}", + "statements": [ + { + "operation": "invoke", + "resourceHandle": "\${wsim#root/HelloWorld/Queue/SetConsumer0#attrs.handle}", + }, + { + "operation": "hasAvailableWorkers", + "resourceHandle": "\${wsim#root/HelloWorld/Queue/SetConsumer0#attrs.handle}", + }, + ], + }, + "type": "@winglang/sdk.sim.Policy", + }, "root/HelloWorld/Queue/QueueEventMapping0": { "addr": "c80de7940bef4e6ad61443a5ed07362f300a117b29", "deps": [ "root/HelloWorld/Queue/SetConsumer0", "root/HelloWorld/Queue", + "root/HelloWorld/Queue/Policy", ], "path": "root/HelloWorld/Queue/QueueEventMapping0", "props": { @@ -296,6 +305,19 @@ bucket: (function() { }, "Queue": { "children": { + "Policy": { + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0", + }, + "display": { + "description": "A simulated resource policy", + "hidden": true, + "title": "Policy", + }, + "id": "Policy", + "path": "root/HelloWorld/Queue/Policy", + }, "QueueEventMapping0": { "constructInfo": { "fqn": "constructs.Construct", 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 93d72b1284a..5f51f79992c 100644 --- a/libs/wingsdk/test/target-sim/__snapshots__/queue.test.ts.snap +++ b/libs/wingsdk/test/target-sim/__snapshots__/queue.test.ts.snap @@ -11,13 +11,21 @@ exports[`create a queue 1`] = ` "root/my_queue": { "addr": "c8dee4ef24593d08aa22e8845be36d0ee754fcf4cd", "path": "root/my_queue", - "policy": [], "props": { "retentionPeriod": 3600, "timeout": 30, }, "type": "@winglang/sdk.cloud.Queue", }, + "root/my_queue/Policy": { + "addr": "c88a4c68047871c2d322479c886423828e8119d85c", + "path": "root/my_queue/Policy", + "props": { + "principal": "\${wsim#root/my_queue#attrs.handle}", + "statements": [], + }, + "type": "@winglang/sdk.sim.Policy", + }, }, "sdkVersion": "0.0.0", "types": { @@ -107,6 +115,21 @@ exports[`create a queue 1`] = ` "tree": { "children": { "my_queue": { + "children": { + "Policy": { + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0", + }, + "display": { + "description": "A simulated resource policy", + "hidden": true, + "title": "Policy", + }, + "id": "Policy", + "path": "root/my_queue/Policy", + }, + }, "constructInfo": { "fqn": "constructs.Construct", "version": "10.3.0", @@ -585,7 +608,9 @@ async handle(message) { exports[`push rejects empty message 1`] = ` [ "root/my_queue started", + "root/my_queue/Policy started", "Push (messages=).", + "root/my_queue/Policy stopped", "root/my_queue stopped", ] `; @@ -601,13 +626,21 @@ exports[`push rejects empty message 2`] = ` "root/my_queue": { "addr": "c8dee4ef24593d08aa22e8845be36d0ee754fcf4cd", "path": "root/my_queue", - "policy": [], "props": { "retentionPeriod": 3600, "timeout": 30, }, "type": "@winglang/sdk.cloud.Queue", }, + "root/my_queue/Policy": { + "addr": "c88a4c68047871c2d322479c886423828e8119d85c", + "path": "root/my_queue/Policy", + "props": { + "principal": "\${wsim#root/my_queue#attrs.handle}", + "statements": [], + }, + "type": "@winglang/sdk.sim.Policy", + }, }, "sdkVersion": "0.0.0", "types": { @@ -697,6 +730,21 @@ exports[`push rejects empty message 2`] = ` "tree": { "children": { "my_queue": { + "children": { + "Policy": { + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0", + }, + "display": { + "description": "A simulated resource policy", + "hidden": true, + "title": "Policy", + }, + "id": "Policy", + "path": "root/my_queue/Policy", + }, + }, "constructInfo": { "fqn": "constructs.Construct", "version": "10.3.0", @@ -724,11 +772,13 @@ exports[`push rejects empty message 2`] = ` exports[`queue batch size of 2, purge the queue 1`] = ` [ "root/my_queue started", + "root/my_queue/Policy started", "Push (messages=A).", "Push (messages=B).", "ApproxSize ().", "Purge ().", "ApproxSize ().", + "root/my_queue/Policy stopped", "root/my_queue stopped", ] `; @@ -744,13 +794,21 @@ exports[`queue batch size of 2, purge the queue 2`] = ` "root/my_queue": { "addr": "c8dee4ef24593d08aa22e8845be36d0ee754fcf4cd", "path": "root/my_queue", - "policy": [], "props": { "retentionPeriod": 3600, "timeout": 30, }, "type": "@winglang/sdk.cloud.Queue", }, + "root/my_queue/Policy": { + "addr": "c88a4c68047871c2d322479c886423828e8119d85c", + "path": "root/my_queue/Policy", + "props": { + "principal": "\${wsim#root/my_queue#attrs.handle}", + "statements": [], + }, + "type": "@winglang/sdk.sim.Policy", + }, }, "sdkVersion": "0.0.0", "types": { @@ -840,6 +898,21 @@ exports[`queue batch size of 2, purge the queue 2`] = ` "tree": { "children": { "my_queue": { + "children": { + "Policy": { + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0", + }, + "display": { + "description": "A simulated resource policy", + "hidden": true, + "title": "Policy", + }, + "id": "Policy", + "path": "root/my_queue/Policy", + }, + }, "constructInfo": { "fqn": "constructs.Construct", "version": "10.3.0", @@ -946,27 +1019,36 @@ async handle(message) { "root/my_queue": { "addr": "c8dee4ef24593d08aa22e8845be36d0ee754fcf4cd", "path": "root/my_queue", - "policy": [ - { - "operation": "invoke", - "resourceHandle": "\${wsim#root/my_queue/SetConsumer0#attrs.handle}", - }, - { - "operation": "hasAvailableWorkers", - "resourceHandle": "\${wsim#root/my_queue/SetConsumer0#attrs.handle}", - }, - ], "props": { "retentionPeriod": 3600, "timeout": 30, }, "type": "@winglang/sdk.cloud.Queue", }, + "root/my_queue/Policy": { + "addr": "c88a4c68047871c2d322479c886423828e8119d85c", + "path": "root/my_queue/Policy", + "props": { + "principal": "\${wsim#root/my_queue#attrs.handle}", + "statements": [ + { + "operation": "invoke", + "resourceHandle": "\${wsim#root/my_queue/SetConsumer0#attrs.handle}", + }, + { + "operation": "hasAvailableWorkers", + "resourceHandle": "\${wsim#root/my_queue/SetConsumer0#attrs.handle}", + }, + ], + }, + "type": "@winglang/sdk.sim.Policy", + }, "root/my_queue/QueueEventMapping0": { "addr": "c8f9f7d56097ba3d2e0e82988718175a5d841f855e", "deps": [ "root/my_queue/SetConsumer0", "root/my_queue", + "root/my_queue/Policy", ], "path": "root/my_queue/QueueEventMapping0", "props": { @@ -1115,6 +1197,19 @@ async handle(message) { "children": { "my_queue": { "children": { + "Policy": { + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0", + }, + "display": { + "description": "A simulated resource policy", + "hidden": true, + "title": "Policy", + }, + "id": "Policy", + "path": "root/my_queue/Policy", + }, "QueueEventMapping0": { "constructInfo": { "fqn": "constructs.Construct", @@ -1230,27 +1325,36 @@ async handle(message) { "root/my_queue": { "addr": "c8dee4ef24593d08aa22e8845be36d0ee754fcf4cd", "path": "root/my_queue", - "policy": [ - { - "operation": "invoke", - "resourceHandle": "\${wsim#root/my_queue/SetConsumer0#attrs.handle}", - }, - { - "operation": "hasAvailableWorkers", - "resourceHandle": "\${wsim#root/my_queue/SetConsumer0#attrs.handle}", - }, - ], "props": { "retentionPeriod": 3600, "timeout": 30, }, "type": "@winglang/sdk.cloud.Queue", }, + "root/my_queue/Policy": { + "addr": "c88a4c68047871c2d322479c886423828e8119d85c", + "path": "root/my_queue/Policy", + "props": { + "principal": "\${wsim#root/my_queue#attrs.handle}", + "statements": [ + { + "operation": "invoke", + "resourceHandle": "\${wsim#root/my_queue/SetConsumer0#attrs.handle}", + }, + { + "operation": "hasAvailableWorkers", + "resourceHandle": "\${wsim#root/my_queue/SetConsumer0#attrs.handle}", + }, + ], + }, + "type": "@winglang/sdk.sim.Policy", + }, "root/my_queue/QueueEventMapping0": { "addr": "c8f9f7d56097ba3d2e0e82988718175a5d841f855e", "deps": [ "root/my_queue/SetConsumer0", "root/my_queue", + "root/my_queue/Policy", ], "path": "root/my_queue/QueueEventMapping0", "props": { @@ -1365,6 +1469,19 @@ async handle(message) { "children": { "my_queue": { "children": { + "Policy": { + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0", + }, + "display": { + "description": "A simulated resource policy", + "hidden": true, + "title": "Policy", + }, + "id": "Policy", + "path": "root/my_queue/Policy", + }, "QueueEventMapping0": { "constructInfo": { "fqn": "constructs.Construct", diff --git a/libs/wingsdk/test/target-sim/queue.test.ts b/libs/wingsdk/test/target-sim/queue.test.ts index 9bd1d7ca011..1b6e7d0e4db 100644 --- a/libs/wingsdk/test/target-sim/queue.test.ts +++ b/libs/wingsdk/test/target-sim/queue.test.ts @@ -370,6 +370,6 @@ test("push rejects empty message", async () => { await s.stop(); expect(listMessages(s)).toMatchSnapshot(); - expect(s.listTraces()[1].data.status).toEqual("failure"); + expect(s.listTraces()[2].data.status).toEqual("failure"); expect(app.snapshot()).toMatchSnapshot(); }); From 2941a4540a8f0c63eb52d2e76fb3e4d843884061 Mon Sep 17 00:00:00 2001 From: Mark McCulloh Date: Fri, 12 Apr 2024 09:41:28 -0400 Subject: [PATCH 17/17] add test and update snaps --- examples/tests/valid/bring_local.test.w | 6 ++ examples/tests/valid/subdir/subfile.w | 3 +- examples/tests/valid/subdir/util.extern.d.ts | 1 + examples/tests/valid/subdir/util.ts | 4 ++ .../bring_local.test.w_compile_tf-aws.md | 62 +++++++++++++++++++ .../valid/bring_local.test.w_test_sim.md | 3 +- 6 files changed, 77 insertions(+), 2 deletions(-) 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/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/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 df2f5a4e676..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"; @@ -282,6 +302,7 @@ 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); @@ -320,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); @@ -381,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"); @@ -538,6 +597,9 @@ 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