From 1b71ae3a79e7d591c86507bc0ddb33e1514e9095 Mon Sep 17 00:00:00 2001 From: Ainvoner <2538825+ainvoner@users.noreply.github.com> Date: Thu, 11 Apr 2024 15:31:52 +0300 Subject: [PATCH 01/15] fix(console): node title ignores the user defined resource name (#6211) resolves: https://github.com/winglang/wing/issues/5994 for the following code: ``` bring cloud; class A { new() { nodeof(this).title = "MyTitle"; nodeof(this).color = "violet"; } } class B { new() { } } new A(); new cloud.Bucket() as "MyBucket"; new cloud.Bucket(); new B(); ``` the console will display the following: ![Screenshot 2024-04-11 at 12 54 26](https://github.com/winglang/wing/assets/2538825/3272018e-695a-4c6e-80c9-f8f54751ea45) ## Checklist - [ ] Title matches [Winglang's style guide](https://www.winglang.io/contributing/start-here/pull_requests#how-are-pull-request-titles-formatted) - [ ] Description explains motivation and solution - [ ] Tests added (always) - [ ] Docs updated (only required for features) - [ ] Added `pr/e2e-full` label if this feature requires end-to-end testing *By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*. --- .../console/ui/src/ui/elk-map-nodes.tsx | 8 ++++++-- .../console/ui/src/ui/resource-metadata.tsx | 13 +++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/apps/wing-console/console/ui/src/ui/elk-map-nodes.tsx b/apps/wing-console/console/ui/src/ui/elk-map-nodes.tsx index bfe0789b023..0668219502f 100644 --- a/apps/wing-console/console/ui/src/ui/elk-map-nodes.tsx +++ b/apps/wing-console/console/ui/src/ui/elk-map-nodes.tsx @@ -100,8 +100,12 @@ export const ContainerNode = memo( ); const compilerNamed = useMemo(() => { - return !!display?.title; - }, [display]); + // sdk cloud resource type has a fixed convention: @winglang/sdk.cloud.* + const cloudResourceType = resourceType + ? resourceType.split(".").at(-1) + : ""; + return !!display?.title && display?.title !== cloudResourceType; + }, [display, resourceType]); return ( // TODO: Fix a11y diff --git a/apps/wing-console/console/ui/src/ui/resource-metadata.tsx b/apps/wing-console/console/ui/src/ui/resource-metadata.tsx index 1e23720d3d0..d141eab1082 100644 --- a/apps/wing-console/console/ui/src/ui/resource-metadata.tsx +++ b/apps/wing-console/console/ui/src/ui/resource-metadata.tsx @@ -283,6 +283,13 @@ export const ResourceMetadata = memo( }; }, [node, inbound, outbound]); + const nodeLabel = useMemo(() => { + const cloudResourceTypeName = node.type.split(".").at(-1) || ""; + const compilerNamed = + !!node.display?.title && node.display?.title !== cloudResourceTypeName; + return compilerNamed ? node.display?.title : node.id; + }, [node]); + const toggleInspectorSection = useCallback((section: string) => { setOpenInspectorSections(([...sections]) => { const index = sections.indexOf(section); @@ -317,9 +324,7 @@ export const ResourceMetadata = memo(
-
- {node?.display?.title ?? node.id} -
+
{nodeLabel}
{node.type}
@@ -328,7 +333,7 @@ export const ResourceMetadata = memo( {resourceUI.data && resourceUI.data.length > 0 && ( toggleInspectorSection("resourceUI")} headingClassName="pl-2" From 4e5335ae03cbf7f3914eab5bf6ffae533c2acb1d Mon Sep 17 00:00:00 2001 From: yoav-steinberg Date: Fri, 12 Apr 2024 09:33:50 +0300 Subject: [PATCH 02/15] fix(compiler)!: no way to detect if an interface implements a preflight class (#6197) Fixes #5872 Add a phase modifier `inflight` support to `interface` definitions. Now all preflight interfaces implicitly implement `std.IResouce` the same way that prefligth classes implicitly implement `std.Resource`. We can now explicitly qualify these interfaces with the `lift()` builtin and we can get qualification errors if an inflight variable is being used to access such an object (same as classes). Note that inflight interfaces can be defined preflight with the keywork and all their methods will be implicitly `inflight`. Interfaces defined inflight are always inflight interfaces. Preflight interfaces may extend inflight interfaces, but not the other way around. JSII imported interfaces are, at least for now, always preflight interfaces. **Breaking change**: Since inflight interfaces are new, code using interfaces in inflight that were defined in preflight scope will need to add the `inflight` modifier to those interfaces or the compiler will complain that you're trying to access an unknown preflight object: ```wing inflight IMyIface { // Explicitly mark this interface as inflight so it can be used in inflight code without worrying about lifting do(): void; // No need to specify `do` is an inflight method, it's implicit from the interface type. } inflight () => { x: IMyIface = ....; x.do(); // This would be a qualification error without the above fix. } ``` **Other fixes** * Fixed span in diagnostic of wrongly typed methods implementing an interface, previously the span pointed to the implementing class instead of the specific method inside that class that mismatches the interface definition. * Cleaned up some dead code. ## Checklist - [x] Title matches [Winglang's style guide](https://www.winglang.io/contributing/start-here/pull_requests#how-are-pull-request-titles-formatted) - [x] Description explains motivation and solution - [x] Tests added (always) - [x] Docs updated (only required for features) - [ ] Added `pr/e2e-full` label if this feature requires end-to-end testing *By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*. --- docs/docs/03-language-reference.md | 19 +- examples/jsii-fixture/src/index.ts | 6 +- .../explicit_lift_qualification.test.w | 12 + ...t_class_interface_structural_typing.test.w | 4 +- examples/tests/invalid/interface.test.w | 25 ++ examples/tests/invalid/package.json | 3 +- .../tests/invalid/resource_captures.test.w | 2 +- .../sdk_tests/service/http-server.test.w | 6 +- .../valid/explicit_lift_qualification.test.w | 19 ++ examples/tests/valid/impl_interface.test.w | 59 +++++ ...t_class_structural_interace_handler.test.w | 2 +- libs/tree-sitter-wing/grammar.js | 10 +- libs/tree-sitter-wing/src/grammar.json | 23 +- .../corpus/statements/class_and_resource.txt | 5 +- libs/wingc/src/ast.rs | 1 + libs/wingc/src/fold.rs | 1 + libs/wingc/src/lib.rs | 1 + libs/wingc/src/lifting.rs | 2 +- .../src/lsp/snapshots/completions/empty.snap | 4 +- .../hide_parent_symbols_defined_later.snap | 4 +- libs/wingc/src/parser.rs | 14 +- libs/wingc/src/type_check.rs | 137 +++++----- libs/wingc/src/type_check/jsii_importer.rs | 2 + pnpm-lock.yaml | 9 +- tools/hangar/__snapshots__/invalid.ts.snap | 158 ++++++++---- .../valid/debug_env.test.w_test_sim.md | 2 +- ...ift_qualification.test.w_compile_tf-aws.md | 106 ++++++++ ...icit_lift_qualification.test.w_test_sim.md | 7 +- .../impl_interface.test.w_compile_tf-aws.md | 237 ++++++++++++++++++ 29 files changed, 737 insertions(+), 143 deletions(-) diff --git a/docs/docs/03-language-reference.md b/docs/docs/03-language-reference.md index f4f26739a16..1a4e9324d2e 100644 --- a/docs/docs/03-language-reference.md +++ b/docs/docs/03-language-reference.md @@ -1441,10 +1441,14 @@ class Boo extends Foo { ``` Classes can inherit and extend other classes using the `extends` keyword. -Classes can implement interfaces iff the interfaces do not contain `inflight`. +Classes can implement multiple interfaces using the `impl` keyword. +Inflight classes may only implement inflight interfaces. ```TS -class Foo { +interface IFoo { + method(): void; +} +class Foo impl IFoo { x: num; new() { this.x = 0; } pub method() { } @@ -1577,7 +1581,12 @@ of methods with different phases is not allowed as well. Interfaces represent a contract that a class must fulfill. Interfaces are defined with the `interface` keyword. -Currently, preflight interfaces are allowed, while inflight interfaces are not supported yet (see https://github.com/winglang/wing/issues/1961). +Interfaces may be either preflight interfaces or inflight interfaces. +Preflight interfaces are defined in preflight scope and can contain both preflight and inflight methods. +Only preflight classes may implement preflight interfaces. +Inflight interfaces are either defined with the `inflight` modifier in preflight scope or simply defined in inflight scope. +All methods of inflight interfaces are implicitly inflight (no need to use the `inflight` keyword). +Since both preflight and inflight classes can have inflight methods defined inside them, they are both capable of implementing inflight interfaces. `impl` keyword is used to implement an interface or multiple interfaces that are separated with commas. @@ -1594,7 +1603,7 @@ Interface fields are not supported. > inflight method3(): void; > } > -> interface IMyInterface2 { +> inflight interface IMyInterface2 { > method2(): str; > } > @@ -1610,7 +1619,7 @@ Interface fields are not supported. > return "sample: {x}"; > } > inflight method3(): void { } -> method2(): str { +> inflight method2(): str { > return this.field2; > } > } diff --git a/examples/jsii-fixture/src/index.ts b/examples/jsii-fixture/src/index.ts index 0102b31171a..99a662512a3 100644 --- a/examples/jsii-fixture/src/index.ts +++ b/examples/jsii-fixture/src/index.ts @@ -25,7 +25,7 @@ export class JsiiClass { public static staticMethod(arg: string) { return `Got ${arg}`; } - + public methodWithStructParam(s: SomeStruct): string { return s.field; } @@ -43,4 +43,8 @@ export interface IFakeClosure { export interface SomeStruct { readonly field: string; +} + +export interface ISomeInterface { + method(): void; } \ No newline at end of file diff --git a/examples/tests/invalid/explicit_lift_qualification.test.w b/examples/tests/invalid/explicit_lift_qualification.test.w index e7f1a44d383..9c6a405004c 100644 --- a/examples/tests/invalid/explicit_lift_qualification.test.w +++ b/examples/tests/invalid/explicit_lift_qualification.test.w @@ -1,8 +1,16 @@ bring cloud; +interface IPreflightInterface { + inflight method(): void; +} +class PreflightClass impl IPreflightInterface { + pub inflight method(): void {} +} + let bucket = new cloud.Bucket(); let prelight_string = "hi"; +let preflight_class = new PreflightClass(); class Foo { pub inflight mehtod1() { @@ -36,5 +44,9 @@ class Foo { let b = bucket; b.put("k", "v"); // With no explicit qualification this should be an error //^ Expression of type "Bucket" references an unknown preflight object + + let i: IPreflightInterface = preflight_class; + i.method(); // With no explicit qualification this should be an error + //^ Expression of type "IPreflightInterface" references an unknown preflight object } } diff --git a/examples/tests/invalid/inflight_class_interface_structural_typing.test.w b/examples/tests/invalid/inflight_class_interface_structural_typing.test.w index d5c3d5dba9d..b5247675078 100644 --- a/examples/tests/invalid/inflight_class_interface_structural_typing.test.w +++ b/examples/tests/invalid/inflight_class_interface_structural_typing.test.w @@ -1,7 +1,7 @@ bring cloud; -interface IGoo { - inflight notHandle(): void; +inflight interface IGoo { + notHandle(): void; } inflight class NotGoo { diff --git a/examples/tests/invalid/interface.test.w b/examples/tests/invalid/interface.test.w index 83eb7565d75..611f5172955 100644 --- a/examples/tests/invalid/interface.test.w +++ b/examples/tests/invalid/interface.test.w @@ -1,3 +1,5 @@ +bring "jsii-fixture" as jsii_fixture; + // interface extend loop interface IA extends IB { // ^^ Unknown symbol "IB" @@ -42,3 +44,26 @@ interface IMissingParamTypes { method1(a, b): void; //^ Expected type annotation } + +// Can't implement preflight interface on inflight class +interface IPreflight { + method1(): void; +} +inflight class CImplPreflightIface impl IPreflight { + pub method1(): void {} +} + +// Can't extend preflight interface on inflight interface +inflight interface IInflightExtendsPreflight extends IPreflight { + method2(): void; +} + +// Inflight interfaces can't extend JSII interfaces +inflight interface IInflightExtendsJsii extends jsii_fixture.ISomeInterface { + method(): void; +} + +// Inflight classes can't implement JSII interfaces +inflight class CInflightImplJsii impl jsii_fixture.ISomeInterface { + pub method(): void {} +} \ No newline at end of file diff --git a/examples/tests/invalid/package.json b/examples/tests/invalid/package.json index c6d2f2ebb56..b5877f9cfc8 100644 --- a/examples/tests/invalid/package.json +++ b/examples/tests/invalid/package.json @@ -3,7 +3,8 @@ "dependencies": { "cdktf": "0.20.3", "constructs": "^10.3", - "jsii-code-samples": "1.7.0" + "jsii-code-samples": "1.7.0", + "jsii-fixture": "workspace:^" }, "volta": { "extends": "../../../package.json" diff --git a/examples/tests/invalid/resource_captures.test.w b/examples/tests/invalid/resource_captures.test.w index 84c0a41c66a..bf9dec893f0 100644 --- a/examples/tests/invalid/resource_captures.test.w +++ b/examples/tests/invalid/resource_captures.test.w @@ -11,8 +11,8 @@ class Foo { inflight test() { let b = this.bucket; -// ^^^^^^^^^^^ Unable to qualify which operations are performed on 'this.bucket' of type 'Bucket'. This is not supported yet. b.put("hello", "world"); +// ^ Expression of type "Bucket" references an unknown preflight object this.collectionOfResources.at(0).put("hello", "world"); // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Capturing collection of resources is not supported yet (type is 'Array') diff --git a/examples/tests/sdk_tests/service/http-server.test.w b/examples/tests/sdk_tests/service/http-server.test.w index 9e2153be8a3..52486f3ae8b 100644 --- a/examples/tests/sdk_tests/service/http-server.test.w +++ b/examples/tests/sdk_tests/service/http-server.test.w @@ -6,9 +6,9 @@ struct Address { port: num; } -interface IHttpServer { - inflight address(): Address; - inflight close(): void; +inflight interface IHttpServer { + address(): Address; + close(): void; } diff --git a/examples/tests/valid/explicit_lift_qualification.test.w b/examples/tests/valid/explicit_lift_qualification.test.w index 4089d6b6953..976c36ebc55 100644 --- a/examples/tests/valid/explicit_lift_qualification.test.w +++ b/examples/tests/valid/explicit_lift_qualification.test.w @@ -41,3 +41,22 @@ let inflight_closure = inflight () => { test "explicit closure lift qualification" { inflight_closure(); } + +// Explicit qualification of preflight interface type +interface PreflightInterface { + inflight method(): str; +} + +class PreflightClass impl PreflightInterface { + pub inflight method(): str { + return "ahoy there"; + } +} + +let bar = new PreflightClass(); + +test "explicit interface lift qualification" { + lift(bar, ["method"]); + let x: PreflightInterface = bar; + assert(x.method() == "ahoy there"); +} \ No newline at end of file diff --git a/examples/tests/valid/impl_interface.test.w b/examples/tests/valid/impl_interface.test.w index 9785c011910..10c8e09912b 100644 --- a/examples/tests/valid/impl_interface.test.w +++ b/examples/tests/valid/impl_interface.test.w @@ -1,4 +1,5 @@ bring cloud; +bring "jsii-fixture" as jsii_fixture; class A impl cloud.IQueueSetConsumerHandler { pub inflight handle(msg: str) { @@ -82,3 +83,61 @@ let f = inflight () => { let dog = new MyDog(); dog.bark(); }; + +// This should work: extend a JSII interface in a preflight interface +// Commented out because of: https://github.com/winglang/wing/issues/6209 +// +// interface ExtendJsiiIface extends jsii_fixture.ISomeInterface { +// inflight inflight_method(): void; +// } +// +// class ImplementJsiiIface impl ExtendJsiiIface { +// pub method() { +// return; +// } +// pub inflight inflight_method() { +// return; +// } +// } + +// Implement an inflight interface in a preflight class +inflight interface IInflight { + inflight_method(): void; +} +class ImplementInflightIfaceInPreflightClass impl IInflight { + pub inflight inflight_method() { + return; + } +} + +// Extend inflight interface in an inflight interface defined inflight +inflight () => { + interface InflightIfaceDefinedInflight extends IInflight {} +}; + +// Extend inflight interface in an inflight interface defined preflight +interface InflightIfaceDefinedPreflight extends IInflight {} + +// Implement an inflight interface in an inflight class +inflight class ImplInflightIfaceInInflightClass impl IInflight { + pub inflight_method() { + return; + } +} + +// Implement an inflight interface in a preflight class +class ImplInflightIfaceInPreflightClass impl IInflight { + pub inflight inflight_method() { + return; + } +} + +// Implement preflight interface in an preflight class +interface IPreflight { + method(): void; +} +class ImplPreflightIfaceInPreflightClass impl IPreflight { + pub method() { + return; + } +} \ No newline at end of file diff --git a/examples/tests/valid/inflight_class_structural_interace_handler.test.w b/examples/tests/valid/inflight_class_structural_interace_handler.test.w index e32ea32e6d6..dcc52cedc17 100644 --- a/examples/tests/valid/inflight_class_structural_interace_handler.test.w +++ b/examples/tests/valid/inflight_class_structural_interace_handler.test.w @@ -1,6 +1,6 @@ bring cloud; -interface IGoo { +inflight interface IGoo { inflight handle(): num; } diff --git a/libs/tree-sitter-wing/grammar.js b/libs/tree-sitter-wing/grammar.js index 4d48990e565..3e5bd088cb8 100644 --- a/libs/tree-sitter-wing/grammar.js +++ b/libs/tree-sitter-wing/grammar.js @@ -40,7 +40,7 @@ module.exports = grammar({ // These modifier conflicts should be solved through GLR parsing [$.field_modifiers, $.method_modifiers], - [$.class_modifiers, $.closure_modifiers], + [$.class_modifiers, $.closure_modifiers, $.interface_modifiers], [$.inflight_method_signature, $.field_modifiers], ], @@ -225,14 +225,20 @@ module.exports = grammar({ $._semicolon ), + /// Interfaces + + interface_modifiers: ($) => + repeat1(choice($.access_modifier, $.inflight_specifier)), + interface_definition: ($) => seq( - optional(field("access_modifier", $.access_modifier)), + optional(field("modifiers", $.interface_modifiers)), "interface", field("name", $.identifier), optional(seq("extends", field("extends", commaSep1($.custom_type)))), field("implementation", $.interface_implementation) ), + interface_implementation: ($) => braced( repeat( diff --git a/libs/tree-sitter-wing/src/grammar.json b/libs/tree-sitter-wing/src/grammar.json index 220290be776..238b1f6a0a8 100644 --- a/libs/tree-sitter-wing/src/grammar.json +++ b/libs/tree-sitter-wing/src/grammar.json @@ -1125,6 +1125,22 @@ } ] }, + "interface_modifiers": { + "type": "REPEAT1", + "content": { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "access_modifier" + }, + { + "type": "SYMBOL", + "name": "inflight_specifier" + } + ] + } + }, "interface_definition": { "type": "SEQ", "members": [ @@ -1133,10 +1149,10 @@ "members": [ { "type": "FIELD", - "name": "access_modifier", + "name": "modifiers", "content": { "type": "SYMBOL", - "name": "access_modifier" + "name": "interface_modifiers" } }, { @@ -4515,7 +4531,8 @@ ], [ "class_modifiers", - "closure_modifiers" + "closure_modifiers", + "interface_modifiers" ], [ "inflight_method_signature", diff --git a/libs/tree-sitter-wing/test/corpus/statements/class_and_resource.txt b/libs/tree-sitter-wing/test/corpus/statements/class_and_resource.txt index 8b3c3955ece..36a7110ffb0 100644 --- a/libs/tree-sitter-wing/test/corpus/statements/class_and_resource.txt +++ b/libs/tree-sitter-wing/test/corpus/statements/class_and_resource.txt @@ -202,7 +202,7 @@ class A extends B impl C, D {} Interface definition ================================================================================ -interface A extends B, C { +pub inflight interface A extends B, C { do_something(); inflight do_something_else(x: str): num; some_field: num; @@ -212,6 +212,9 @@ interface A extends B, C { (source (interface_definition + modifiers: (interface_modifiers + (access_modifier) + (inflight_specifier)) name: (identifier) extends: (custom_type object: (type_identifier)) diff --git a/libs/wingc/src/ast.rs b/libs/wingc/src/ast.rs index 8487093d516..caeeac57716 100644 --- a/libs/wingc/src/ast.rs +++ b/libs/wingc/src/ast.rs @@ -393,6 +393,7 @@ pub struct Interface { pub methods: Vec<(Symbol, FunctionSignature)>, pub extends: Vec, pub access: AccessModifier, + pub phase: Phase, } #[derive(Debug)] diff --git a/libs/wingc/src/fold.rs b/libs/wingc/src/fold.rs index 8bb7fe84932..fc991c7d8e0 100644 --- a/libs/wingc/src/fold.rs +++ b/libs/wingc/src/fold.rs @@ -279,6 +279,7 @@ where .map(|interface| f.fold_user_defined_type(interface)) .collect(), access: node.access, + phase: node.phase, } } diff --git a/libs/wingc/src/lib.rs b/libs/wingc/src/lib.rs index e61a502a928..e072a231403 100644 --- a/libs/wingc/src/lib.rs +++ b/libs/wingc/src/lib.rs @@ -112,6 +112,7 @@ const WINGSDK_STRING: &'static str = "std.String"; const WINGSDK_JSON: &'static str = "std.Json"; const WINGSDK_MUT_JSON: &'static str = "std.MutJson"; const WINGSDK_RESOURCE: &'static str = "std.Resource"; +const WINGSDK_IRESOURCE: &'static str = "std.IResource"; const WINGSDK_AUTOID_RESOURCE: &'static str = "std.AutoIdResource"; const WINGSDK_STRUCT: &'static str = "std.Struct"; const WINGSDK_TEST_CLASS_NAME: &'static str = "Test"; diff --git a/libs/wingc/src/lifting.rs b/libs/wingc/src/lifting.rs index 69af9b1f7ca..34f40f1f0da 100644 --- a/libs/wingc/src/lifting.rs +++ b/libs/wingc/src/lifting.rs @@ -212,7 +212,7 @@ impl<'a> Visit<'a> for LiftVisitor<'a> { // Inflight expressions that evaluate to a preflight type are currently unsupported because // we can't determine exactly which preflight object is being accessed and therefore can't // qualify the original lift expression. - if expr_phase == Phase::Inflight && expr_type.is_preflight_class() && v.ctx.current_property().is_some() && !v.ignore_unknown_preflight_object_error() { + if expr_phase == Phase::Inflight && expr_type.is_preflight_object_type() && v.ctx.current_property().is_some() && !v.ignore_unknown_preflight_object_error() { report_diagnostic(Diagnostic { message: format!( "Expression of type \"{expr_type}\" references an unknown preflight object, can't qualify its capabilities. Use `lift()` to explicitly qualify the preflight object to disable this error." diff --git a/libs/wingc/src/lsp/snapshots/completions/empty.snap b/libs/wingc/src/lsp/snapshots/completions/empty.snap index c19f3c23441..dc42d2b12af 100644 --- a/libs/wingc/src/lsp/snapshots/completions/empty.snap +++ b/libs/wingc/src/lsp/snapshots/completions/empty.snap @@ -22,10 +22,10 @@ source: libs/wingc/src/lsp/completions.rs command: editor.action.triggerParameterHints - label: lift kind: 3 - detail: "inflight (preflightObject: Resource, qualifications: Array): void" + detail: "inflight (preflightObject: IResource, qualifications: Array): void" documentation: kind: markdown - value: "```wing\nlift: inflight (preflightObject: Resource, qualifications: Array): void\n```\n---\nExplicitly apply qualifications to a preflight object used in the current method/function\n### Parameters\n- `preflightObject` — `Resource` — The preflight object to qualify\n- `qualifications` — `Array` — \n\t\t\t\t\t\t\tThe qualifications to apply to the preflight object.\n\n\t\t\t\t\t\t\tThis is an array of strings denoting members of the object that are accessed in the current method/function.\n\n\t\t\t\t\t\t\tFor example, if the method accesses the `push` and `pop` members of a `cloud.Queue` object, the qualifications should be `[\"push\", \"pop\"]`." + value: "```wing\nlift: inflight (preflightObject: IResource, qualifications: Array): void\n```\n---\nExplicitly apply qualifications to a preflight object used in the current method/function\n### Parameters\n- `preflightObject` — `IResource` — The preflight object to qualify\n- `qualifications` — `Array` — \n\t\t\t\t\t\t\tThe qualifications to apply to the preflight object.\n\n\t\t\t\t\t\t\tThis is an array of strings denoting members of the object that are accessed in the current method/function.\n\n\t\t\t\t\t\t\tFor example, if the method accesses the `push` and `pop` members of a `cloud.Queue` object, the qualifications should be `[\"push\", \"pop\"]`." sortText: cc|lift insertText: lift($1) insertTextFormat: 2 diff --git a/libs/wingc/src/lsp/snapshots/completions/hide_parent_symbols_defined_later.snap b/libs/wingc/src/lsp/snapshots/completions/hide_parent_symbols_defined_later.snap index 390c0896205..51c1d5f5334 100644 --- a/libs/wingc/src/lsp/snapshots/completions/hide_parent_symbols_defined_later.snap +++ b/libs/wingc/src/lsp/snapshots/completions/hide_parent_symbols_defined_later.snap @@ -29,10 +29,10 @@ source: libs/wingc/src/lsp/completions.rs command: editor.action.triggerParameterHints - label: lift kind: 3 - detail: "inflight (preflightObject: Resource, qualifications: Array): void" + detail: "inflight (preflightObject: IResource, qualifications: Array): void" documentation: kind: markdown - value: "```wing\nlift: inflight (preflightObject: Resource, qualifications: Array): void\n```\n---\nExplicitly apply qualifications to a preflight object used in the current method/function\n### Parameters\n- `preflightObject` — `Resource` — The preflight object to qualify\n- `qualifications` — `Array` — \n\t\t\t\t\t\t\tThe qualifications to apply to the preflight object.\n\n\t\t\t\t\t\t\tThis is an array of strings denoting members of the object that are accessed in the current method/function.\n\n\t\t\t\t\t\t\tFor example, if the method accesses the `push` and `pop` members of a `cloud.Queue` object, the qualifications should be `[\"push\", \"pop\"]`." + value: "```wing\nlift: inflight (preflightObject: IResource, qualifications: Array): void\n```\n---\nExplicitly apply qualifications to a preflight object used in the current method/function\n### Parameters\n- `preflightObject` — `IResource` — The preflight object to qualify\n- `qualifications` — `Array` — \n\t\t\t\t\t\t\tThe qualifications to apply to the preflight object.\n\n\t\t\t\t\t\t\tThis is an array of strings denoting members of the object that are accessed in the current method/function.\n\n\t\t\t\t\t\t\tFor example, if the method accesses the `push` and `pop` members of a `cloud.Queue` object, the qualifications should be `[\"push\", \"pop\"]`." sortText: cc|lift insertText: lift($1) insertTextFormat: 2 diff --git a/libs/wingc/src/parser.rs b/libs/wingc/src/parser.rs index ecafcbf3c32..1f74a88453b 100644 --- a/libs/wingc/src/parser.rs +++ b/libs/wingc/src/parser.rs @@ -1445,6 +1445,14 @@ impl<'s> Parser<'s> { let mut cursor = statement_node.walk(); let mut extends = vec![]; let mut methods = vec![]; + + let interface_modifiers = statement_node.child_by_field_name("modifiers"); + let phase = if self.get_modifier("inflight_specifier", &interface_modifiers)?.is_some() { + Phase::Inflight + } else { + phase + }; + let name = self.check_reserved_symbol(&statement_node.child_by_field_name("name").unwrap())?; for interface_element in statement_node @@ -1514,12 +1522,11 @@ impl<'s> Parser<'s> { } } - let access_modifier_node = statement_node.child_by_field_name("access_modifier"); - let access = self.build_access_modifier(&access_modifier_node); + let access = self.get_access_modifier(&interface_modifiers)?; if access == AccessModifier::Protected { self.with_error::( "Interfaces must be public (\"pub\") or private", - &access_modifier_node.expect("access modifier node"), + &interface_modifiers.expect("access modifier node"), )?; } @@ -1528,6 +1535,7 @@ impl<'s> Parser<'s> { methods, extends, access, + phase, })) } diff --git a/libs/wingc/src/type_check.rs b/libs/wingc/src/type_check.rs index c3471558bc6..0ddc20970be 100644 --- a/libs/wingc/src/type_check.rs +++ b/libs/wingc/src/type_check.rs @@ -26,9 +26,9 @@ use crate::visit_context::{VisitContext, VisitorWithContext}; use crate::visit_types::{VisitType, VisitTypeMut}; use crate::{ dbg_panic, debug, CONSTRUCT_BASE_CLASS, CONSTRUCT_BASE_INTERFACE, UTIL_CLASS_NAME, WINGSDK_ARRAY, - WINGSDK_ASSEMBLY_NAME, WINGSDK_BRINGABLE_MODULES, WINGSDK_DURATION, WINGSDK_GENERIC, WINGSDK_JSON, WINGSDK_MAP, - WINGSDK_MUT_ARRAY, WINGSDK_MUT_JSON, WINGSDK_MUT_MAP, WINGSDK_MUT_SET, WINGSDK_NODE, WINGSDK_RESOURCE, WINGSDK_SET, - WINGSDK_STD_MODULE, WINGSDK_STRING, WINGSDK_STRUCT, + WINGSDK_ASSEMBLY_NAME, WINGSDK_BRINGABLE_MODULES, WINGSDK_DURATION, WINGSDK_GENERIC, WINGSDK_IRESOURCE, WINGSDK_JSON, + WINGSDK_MAP, WINGSDK_MUT_ARRAY, WINGSDK_MUT_JSON, WINGSDK_MUT_MAP, WINGSDK_MUT_SET, WINGSDK_NODE, WINGSDK_RESOURCE, + WINGSDK_SET, WINGSDK_STD_MODULE, WINGSDK_STRING, WINGSDK_STRUCT, }; use camino::{Utf8Path, Utf8PathBuf}; use derivative::Derivative; @@ -356,25 +356,11 @@ pub struct Interface { pub fqn: Option, pub docs: Docs, pub extends: Vec, // Must be a Type::Interface type + pub phase: Phase, #[derivative(Debug = "ignore")] pub env: SymbolEnv, } -impl Interface { - fn is_resource(&self) -> bool { - // TODO: This should check that the interface extends `IResource` from - // the SDK, not just any interface with the name `IResource` - // https://github.com/winglang/wing/issues/2098 - self.name.name == "IResource" - || self.extends.iter().any(|i| { - i.as_interface() - .expect("Interface extends a type that isn't an interface") - .name - .name == "IResource" - }) - } -} - impl Display for Interface { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { if let LookupResult::Found(method, _) = self.get_env().lookup_ext(&CLOSURE_CLASS_HANDLE_METHOD.into(), None) { @@ -1084,6 +1070,18 @@ impl TypeRef { return false; } + pub fn is_preflight_object_type(&self) -> bool { + if let Type::Class(ref class) = **self { + return class.phase == Phase::Preflight; + } + + if let Type::Interface(ref iface) = **self { + return iface.phase == Phase::Preflight; + } + + false + } + /// Returns whether type represents a closure (either a function or a closure class). pub fn is_closure(&self) -> bool { if self.as_function_sig().is_some() { @@ -1180,36 +1178,6 @@ impl TypeRef { ) } - pub fn is_capturable(&self) -> bool { - match &**self { - Type::Interface(iface) => iface.is_resource(), - Type::Enum(_) => true, - Type::Number => true, - Type::String => true, - Type::Duration => true, - Type::Boolean => true, - Type::Json(_) => true, - Type::Nil => true, - Type::Array(v) => v.is_capturable(), - Type::Map(v) => v.is_capturable(), - Type::Set(v) => v.is_capturable(), - Type::Struct(_) => true, - Type::Optional(v) => v.is_capturable(), - Type::Anything => false, - Type::Unresolved => false, - Type::Inferred(..) => false, - Type::Void => false, - Type::MutJson => true, - Type::MutArray(v) => v.is_capturable(), - Type::MutMap(v) => v.is_capturable(), - Type::MutSet(v) => v.is_capturable(), - Type::Function(sig) => sig.phase == Phase::Inflight, - - // only preflight classes can be captured - Type::Class(c) => c.phase == Phase::Preflight, - } - } - // returns true if mutable type or if immutable container type contains a mutable type pub fn is_mutable(&self) -> bool { match &**self { @@ -1605,6 +1573,17 @@ impl Types { .expect("Resouce base class to be a type") } + pub fn resource_base_interface(&self) -> TypeRef { + let resource_fqn = format!("{}.{}", WINGSDK_ASSEMBLY_NAME, WINGSDK_IRESOURCE); + self + .libraries + .lookup_nested_str(&resource_fqn, None) + .expect("Resouce base interface to be loaded") + .0 + .as_type() + .expect("Resouce base interface to be a type") + } + pub fn construct_base_type(&self) -> TypeRef { self .libraries @@ -2059,7 +2038,7 @@ impl<'a> TypeChecker<'a> { parameters: vec![ FunctionParameter { name: "preflightObject".into(), - typeref: self.types.resource_base_type(), + typeref: self.types.resource_base_interface(), docs: Docs::with_summary("The preflight object to qualify"), variadic: false, }, @@ -3713,6 +3692,7 @@ impl<'a> TypeChecker<'a> { docs: Docs::default(), env: dummy_env, extends: extend_interfaces.clone(), + phase: iface.phase, }; let interface_type = self.types.add_type(Type::Interface(interface_spec)); @@ -4108,20 +4088,13 @@ impl<'a> TypeChecker<'a> { } fn type_check_interface(&mut self, ast_iface: &AstInterface, env: &mut SymbolEnv) { - let AstInterface { - name, - extends: _, - methods, - access: _, - } = ast_iface; - // Note: to support mutually recursive type definitions (types that refer to each other), interface types // are initialized during `type_check_scope`. The interface type is created with a dummy environment and // then replaced with the real environment after the interface's fields are type checked. // In this method, we are filling in the interface's environment with its members // and updating the interface's Type with the new environment. let mut interface_type = env - .lookup(name, Some(self.ctx.current_stmt_idx())) + .lookup(&ast_iface.name, Some(self.ctx.current_stmt_idx())) .expect("interface type should have been defined in the environment") .as_type() .unwrap(); @@ -4135,7 +4108,7 @@ impl<'a> TypeChecker<'a> { ); // Add methods to the interface env - for (method_name, sig) in methods.iter() { + for (method_name, sig) in ast_iface.methods.iter() { let mut method_type = self.resolve_type_annotation(&sig.to_type_annotation(), env); // use the interface type as the function's "this" type if let Type::Function(ref mut f) = *method_type { @@ -4165,14 +4138,42 @@ impl<'a> TypeChecker<'a> { }; } - // add methods from all extended interfaces to the interface env let extend_interfaces = &interface_type.as_interface().unwrap().extends; - if let Err(e) = add_parent_members_to_iface_env(extend_interfaces, name, &mut interface_env) { + + // If this is a preflight interface and it doesn't extend any other preflight interfaces then implicitly make it extend + // the base resource interface. This is so there's some expression in the type system that this is an + // interface that can only be implemented on a preflight class. This is safe because all preflight classes implement + // `std.Resource` which itself implements `std.IResource`. + let need_to_add_base_iresource = ast_iface.phase == Phase::Preflight + && !extend_interfaces + .iter() + .any(|i| i.as_interface().unwrap().phase == Phase::Preflight); + + // Verify extended interfaces are of valid phase for this interface + for interface in extend_interfaces.iter().map(|t| t.as_interface().unwrap()) { + if ast_iface.phase == Phase::Inflight && interface.phase == Phase::Preflight { + self.spanned_error( + &ast_iface.name, + format!( + "Inflight interface {} cannot extend a preflight interface {}", + ast_iface.name, interface.name + ), + ); + } + } + + // add methods from all extended interfaces to the interface env + if let Err(e) = add_parent_members_to_iface_env(extend_interfaces, &ast_iface.name, &mut interface_env) { self.type_error(e); } // Replace the dummy interface environment with the real one interface_type.as_mut_interface().unwrap().env = interface_env; + + if need_to_add_base_iresource { + let base_resource = self.types.resource_base_interface(); + interface_type.as_mut_interface().unwrap().extends.push(base_resource); + } } fn type_check_class(&mut self, stmt: &Stmt, ast_class: &AstClass, env: &mut SymbolEnv) { @@ -4209,6 +4210,19 @@ impl<'a> TypeChecker<'a> { }) .collect::>(); + // Verify implemented interfaces are of valid phase for this class + for interface in impl_interfaces.iter().map(|t| t.as_interface().unwrap()) { + if ast_class.phase == Phase::Inflight && interface.phase == Phase::Preflight { + self.spanned_error( + stmt, + format!( + "Inflight class {} cannot implement a preflight interface {}", + ast_class.name, interface.name + ), + ); + } + } + // Create the resource/class type and add it to the current environment (so class implementation can reference itself) let class_spec = Class { name: ast_class.name.clone(), @@ -4380,7 +4394,7 @@ impl<'a> TypeChecker<'a> { { let class_method_var = symbol.as_variable().expect("Expected method to be a variable"); let class_method_type = class_method_var.type_; - self.validate_type(class_method_type, method_type, &ast_class.name); + self.validate_type(class_method_type, method_type, &class_method_var.name); // Make sure the method is public (interface methods must be public) if class_method_var.access != AccessModifier::Public { self.spanned_error( @@ -5253,6 +5267,7 @@ impl<'a> TypeChecker<'a> { fqn: iface.fqn.clone(), docs: iface.docs.clone(), extends: iface.extends.clone(), + phase: iface.phase, }), Type::Struct(s) => Type::Struct(Struct { name: s.name.clone(), diff --git a/libs/wingc/src/type_check/jsii_importer.rs b/libs/wingc/src/type_check/jsii_importer.rs index 44d52a28f19..907114fbdce 100644 --- a/libs/wingc/src/type_check/jsii_importer.rs +++ b/libs/wingc/src/type_check/jsii_importer.rs @@ -393,6 +393,7 @@ impl<'a> JsiiImporter<'a> { let phase = if is_struct { Phase::Independent } else { + // All JSII imported interfaces are considered preflight interfaces Phase::Preflight }; @@ -425,6 +426,7 @@ impl<'a> JsiiImporter<'a> { phase, self.jsii_spec.import_statement_idx, ), + phase, })), }; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e51cf4d90b1..2eb9ec79869 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1036,6 +1036,9 @@ importers: jsii-code-samples: specifier: 1.7.0 version: 1.7.0 + jsii-fixture: + specifier: workspace:^ + version: link:../../jsii-fixture examples/tests/sdk_tests: dependencies: @@ -14191,7 +14194,7 @@ packages: dependencies: semver: 7.5.4 shelljs: 0.8.5 - typescript: 5.5.0-dev.20240404 + typescript: 5.5.0-dev.20240410 dev: true /dset@3.1.2: @@ -22800,8 +22803,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.20240410: + resolution: {integrity: sha512-OvGiFb8iPBHHqR8RuhIeCM+j2W1TtPbTZLuesCEi4gulAxzkOP2B3jDPTWmcOmxvUeJN5pNzlKoi/reRn1BZww==} 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..b4cbab9f1db 100644 --- a/tools/hangar/__snapshots__/invalid.ts.snap +++ b/tools/hangar/__snapshots__/invalid.ts.snap @@ -1417,69 +1417,76 @@ Duration " `; exports[`explicit_lift_qualification.test.w 1`] = ` -"error: Expected type to be \\"Resource\\", but got \\"str\\" instead - --> ../../../examples/tests/invalid/explicit_lift_qualification.test.w:14:10 +"error: Expected type to be \\"IResource\\", but got \\"str\\" instead + --> ../../../examples/tests/invalid/explicit_lift_qualification.test.w:22:10 | -14 | lift(prelight_string, [\\"contains\\"]); // Explicit qualification on preflight non-class - | ^^^^^^^^^^^^^^^ Expected type to be \\"Resource\\", but got \\"str\\" instead +22 | lift(prelight_string, [\\"contains\\"]); // Explicit qualification on preflight non-class + | ^^^^^^^^^^^^^^^ Expected type to be \\"IResource\\", but got \\"str\\" instead error: lift() calls must be at the top of the method - --> ../../../examples/tests/invalid/explicit_lift_qualification.test.w:10:5 + --> ../../../examples/tests/invalid/explicit_lift_qualification.test.w:18:5 | -10 | lift(b, [\\"put\\"]); // Explicit qualification with inflight object, lift call as non first statement +18 | lift(b, [\\"put\\"]); // Explicit qualification with inflight object, lift call as non first statement | ^^^^^^^^^^^^^^^^^ lift() calls must be at the top of the method error: lift() calls must be at the top of the method - --> ../../../examples/tests/invalid/explicit_lift_qualification.test.w:14:5 + --> ../../../examples/tests/invalid/explicit_lift_qualification.test.w:22:5 | -14 | lift(prelight_string, [\\"contains\\"]); // Explicit qualification on preflight non-class +22 | lift(prelight_string, [\\"contains\\"]); // Explicit qualification on preflight non-class | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lift() calls must be at the top of the method error: lift() calls must be at the top of the method - --> ../../../examples/tests/invalid/explicit_lift_qualification.test.w:19:5 + --> ../../../examples/tests/invalid/explicit_lift_qualification.test.w:27:5 | -19 | lift(bucket, [inflight_qualifier]); // Explicit qualification with inflight qualifiers, lift call as non first statement +27 | lift(bucket, [inflight_qualifier]); // Explicit qualification with inflight qualifiers, lift call as non first statement | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lift() calls must be at the top of the method error: Expected a preflight object as first argument to \`lift\` builtin, found inflight expression instead - --> ../../../examples/tests/invalid/explicit_lift_qualification.test.w:10:10 + --> ../../../examples/tests/invalid/explicit_lift_qualification.test.w:18:10 | -10 | lift(b, [\\"put\\"]); // Explicit qualification with inflight object, lift call as non first statement +18 | lift(b, [\\"put\\"]); // Explicit qualification with inflight object, lift call as non first statement | ^ Expected a preflight object as first argument to \`lift\` builtin, found inflight expression instead error: Qualification list must not contain any inflight elements - --> ../../../examples/tests/invalid/explicit_lift_qualification.test.w:19:18 + --> ../../../examples/tests/invalid/explicit_lift_qualification.test.w:27:18 | -19 | lift(bucket, [inflight_qualifier]); // Explicit qualification with inflight qualifiers, lift call as non first statement +27 | lift(bucket, [inflight_qualifier]); // Explicit qualification with inflight qualifiers, lift call as non first statement | ^^^^^^^^^^^^^^^^^^^^ Qualification list must not contain any inflight elements error: lift() calls are only allowed in inflight methods and closures defined in preflight - --> ../../../examples/tests/invalid/explicit_lift_qualification.test.w:24:7 + --> ../../../examples/tests/invalid/explicit_lift_qualification.test.w:32:7 | -24 | lift(bucket, [\\"get\\"]); // lift() call in inner closure +32 | lift(bucket, [\\"get\\"]); // lift() call in inner closure | ^^^^^^^^^^^^^^^^^^^^^^ lift() calls are only allowed in inflight methods and closures defined in preflight error: lift() calls are only allowed in inflight methods and closures defined in preflight - --> ../../../examples/tests/invalid/explicit_lift_qualification.test.w:29:9 + --> ../../../examples/tests/invalid/explicit_lift_qualification.test.w:37:9 | -29 | lift(bucket, [\\"get\\"]); // lift() call in inner class +37 | lift(bucket, [\\"get\\"]); // lift() call in inner class | ^^^^^^^^^^^^^^^^^^^^^^ lift() calls are only allowed in inflight methods and closures defined in preflight error: Expression of type \\"Bucket\\" references an unknown preflight object, can't qualify its capabilities. Use \`lift()\` to explicitly qualify the preflight object to disable this error. - --> ../../../examples/tests/invalid/explicit_lift_qualification.test.w:37:5 + --> ../../../examples/tests/invalid/explicit_lift_qualification.test.w:45:5 | -37 | b.put(\\"k\\", \\"v\\"); // With no explicit qualification this should be an error +45 | b.put(\\"k\\", \\"v\\"); // With no explicit qualification this should be an error | ^ Expression of type \\"Bucket\\" references an unknown preflight object, can't qualify its capabilities. Use \`lift()\` to explicitly qualify the preflight object to disable this error. +error: Expression of type \\"IPreflightInterface\\" references an unknown preflight object, can't qualify its capabilities. Use \`lift()\` to explicitly qualify the preflight object to disable this error. + --> ../../../examples/tests/invalid/explicit_lift_qualification.test.w:49:5 + | +49 | i.method(); // With no explicit qualification this should be an error + | ^ Expression of type \\"IPreflightInterface\\" references an unknown preflight object, can't qualify its capabilities. Use \`lift()\` to explicitly qualify the preflight object to disable this error. + + Tests 1 failed (1) @@ -2000,10 +2007,10 @@ exports[`impl_interface.test.w 1`] = ` error: Expected type to be \\"inflight (message: str): void\\", but got \\"inflight (x: num): void\\" instead - --> ../../../examples/tests/invalid/impl_interface.test.w:7:7 + --> ../../../examples/tests/invalid/impl_interface.test.w:8:16 | -7 | class B impl cloud.IQueueSetConsumerHandler { - | ^ Expected type to be \\"inflight (message: str): void\\", but got \\"inflight (x: num): void\\" instead +8 | pub inflight handle(x: num) { + | ^^^^^^ Expected type to be \\"inflight (message: str): void\\", but got \\"inflight (x: num): void\\" instead error: Expected an interface, instead found type \\"Bucket\\" @@ -2435,80 +2442,137 @@ Duration " exports[`interface.test.w 1`] = ` "error: Properties are not supported in interfaces - --> ../../../examples/tests/invalid/interface.test.w:30:3 + --> ../../../examples/tests/invalid/interface.test.w:32:3 | -30 | bar: str; +32 | bar: str; | ^^^^^^^^^ Properties are not supported in interfaces error: Access modifiers are not allowed in interfaces - --> ../../../examples/tests/invalid/interface.test.w:36:3 + --> ../../../examples/tests/invalid/interface.test.w:38:3 | -36 | pub method2(): str; +38 | pub method2(): str; | ^^^^^^^^^^^^^^^^^^^ Access modifiers are not allowed in interfaces error: Expected type annotation - --> ../../../examples/tests/invalid/interface.test.w:42:11 + --> ../../../examples/tests/invalid/interface.test.w:44:11 | -42 | method1(a, b): void; +44 | method1(a, b): void; | ^ Expected type annotation error: Expected type annotation - --> ../../../examples/tests/invalid/interface.test.w:42:14 + --> ../../../examples/tests/invalid/interface.test.w:44:14 | -42 | method1(a, b): void; +44 | method1(a, b): void; | ^ Expected type annotation error: Unknown parser error - --> ../../../examples/tests/invalid/interface.test.w:36:14 + --> ../../../examples/tests/invalid/interface.test.w:38:14 | -36 | pub method2(): str; +38 | pub method2(): str; | ^^ Unknown parser error error: Unknown symbol \\"IB\\" - --> ../../../examples/tests/invalid/interface.test.w:2:22 + --> ../../../examples/tests/invalid/interface.test.w:4:22 | -2 | interface IA extends IB { +4 | interface IA extends IB { | ^^ Unknown symbol \\"IB\\" error: Unknown symbol \\"IDontExist\\" - --> ../../../examples/tests/invalid/interface.test.w:10:26 + --> ../../../examples/tests/invalid/interface.test.w:12:26 | -10 | interface IExist extends IDontExist { +12 | interface IExist extends IDontExist { | ^^^^^^^^^^ Unknown symbol \\"IDontExist\\" error: Unknown symbol \\"ISomeClass\\" - --> ../../../examples/tests/invalid/interface.test.w:16:34 + --> ../../../examples/tests/invalid/interface.test.w:18:34 | -16 | interface ISomeInterface extends ISomeClass { +18 | interface ISomeInterface extends ISomeClass { | ^^^^^^^^^^ Unknown symbol \\"ISomeClass\\" error: Symbol \\"foo\\" already defined in this scope - --> ../../../examples/tests/invalid/interface.test.w:23:5 + --> ../../../examples/tests/invalid/interface.test.w:25:5 | -22 | foo(): void; +24 | foo(): void; | --- previous definition -23 | foo(): void; +25 | foo(): void; | ^^^ Symbol \\"foo\\" already defined in this scope error: Symbol \\"foo\\" already defined in this scope - --> ../../../examples/tests/invalid/interface.test.w:25:5 + --> ../../../examples/tests/invalid/interface.test.w:27:5 | -22 | foo(): void; +24 | foo(): void; | --- previous definition . -25 | foo(): num; +27 | foo(): num; | ^^^ Symbol \\"foo\\" already defined in this scope +error: Inflight class CImplPreflightIface cannot implement a preflight interface IPreflight + --> ../../../examples/tests/invalid/interface.test.w:52:1 + | +52 | / inflight class CImplPreflightIface impl IPreflight { +53 | | pub method1(): void {} +54 | | } + | \\\\-^ Inflight class CImplPreflightIface cannot implement a preflight interface IPreflight + + +error: Expected type to be \\"preflight (): void\\", but got \\"inflight (): void\\" instead + --> ../../../examples/tests/invalid/interface.test.w:53:7 + | +53 | pub method1(): void {} + | ^^^^^^^ Expected type to be \\"preflight (): void\\", but got \\"inflight (): void\\" instead + | + = hint: expected phase to be preflight, but got inflight instead + + +error: Inflight interface IInflightExtendsPreflight cannot extend a preflight interface IPreflight + --> ../../../examples/tests/invalid/interface.test.w:57:20 + | +57 | inflight interface IInflightExtendsPreflight extends IPreflight { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ Inflight interface IInflightExtendsPreflight cannot extend a preflight interface IPreflight + + +error: Inflight interface IInflightExtendsJsii cannot extend a preflight interface ISomeInterface + --> ../../../examples/tests/invalid/interface.test.w:62:20 + | +62 | inflight interface IInflightExtendsJsii extends jsii_fixture.ISomeInterface { + | ^^^^^^^^^^^^^^^^^^^^ Inflight interface IInflightExtendsJsii cannot extend a preflight interface ISomeInterface + + +error: Interface \\"IInflightExtendsJsii\\" extends \\"ISomeInterface\\" but has a conflicting member \\"method\\" (preflight (): void != inflight (): void) + --> ../../../examples/tests/invalid/interface.test.w:62:20 + | +62 | inflight interface IInflightExtendsJsii extends jsii_fixture.ISomeInterface { + | ^^^^^^^^^^^^^^^^^^^^ Interface \\"IInflightExtendsJsii\\" extends \\"ISomeInterface\\" but has a conflicting member \\"method\\" (preflight (): void != inflight (): void) + + +error: Inflight class CInflightImplJsii cannot implement a preflight interface ISomeInterface + --> ../../../examples/tests/invalid/interface.test.w:67:1 + | +67 | / inflight class CInflightImplJsii impl jsii_fixture.ISomeInterface { +68 | | pub method(): void {} +69 | | } + | \\\\-^ Inflight class CInflightImplJsii cannot implement a preflight interface ISomeInterface + + +error: Expected type to be \\"preflight (): void\\", but got \\"inflight (): void\\" instead + --> ../../../examples/tests/invalid/interface.test.w:68:7 + | +68 | pub method(): void {} + | ^^^^^^ Expected type to be \\"preflight (): void\\", but got \\"inflight (): void\\" instead + | + = hint: expected phase to be preflight, but got inflight instead + + Tests 1 failed (1) @@ -3486,9 +3550,9 @@ Duration " exports[`resource_captures.test.w 1`] = ` "error: Expression of type \\"Bucket\\" references an unknown preflight object, can't qualify its capabilities. Use \`lift()\` to explicitly qualify the preflight object to disable this error. - --> ../../../examples/tests/invalid/resource_captures.test.w:15:5 + --> ../../../examples/tests/invalid/resource_captures.test.w:14:5 | -15 | b.put(\\"hello\\", \\"world\\"); +14 | b.put(\\"hello\\", \\"world\\"); | ^ Expression of type \\"Bucket\\" references an unknown preflight object, can't qualify its capabilities. Use \`lift()\` to explicitly qualify the preflight object to disable this error. diff --git a/tools/hangar/__snapshots__/test_corpus/valid/debug_env.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/debug_env.test.w_test_sim.md index ea336485f09..042298c2c50 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/debug_env.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/debug_env.test.w_test_sim.md @@ -4,7 +4,7 @@ ```log [symbol environment at debug_env.test.w:7:5] level 0: { this => A } -level 1: { A => A [type], assert => (condition: bool, message: str?): void, cloud => cloud [namespace], lift => inflight (preflightObject: Resource, qualifications: Array): void, log => (message: str): void, nodeof => preflight (construct: IConstruct): Node, std => std [namespace], this => Construct, unsafeCast => (value: any): any } +level 1: { A => A [type], assert => (condition: bool, message: str?): void, cloud => cloud [namespace], lift => inflight (preflightObject: IResource, qualifications: Array): void, log => (message: str): void, nodeof => preflight (construct: IConstruct): Node, std => std [namespace], this => Construct, unsafeCast => (value: any): any } ``` ## stdout.log 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 4276905271a..792c230efb5 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 @@ -63,6 +63,28 @@ module.exports = function({ $inflight_closure }) { //# sourceMappingURL=inflight.$Closure3-1.cjs.map ``` +## inflight.$Closure4-1.cjs +```cjs +"use strict"; +const $helpers = require("@winglang/sdk/lib/helpers"); +module.exports = function({ $bar }) { + class $Closure4 { + constructor({ }) { + const $obj = (...args) => this.handle(...args); + Object.setPrototypeOf($obj, this); + return $obj; + } + async handle() { + ; + const x = $bar; + $helpers.assert($helpers.eq((await x.method()), "ahoy there"), "x.method() == \"ahoy there\""); + } + } + return $Closure4; +} +//# sourceMappingURL=inflight.$Closure4-1.cjs.map +``` + ## inflight.Foo-1.cjs ```cjs "use strict"; @@ -86,6 +108,23 @@ module.exports = function({ $bucket, $put_and_list }) { //# sourceMappingURL=inflight.Foo-1.cjs.map ``` +## inflight.PreflightClass-1.cjs +```cjs +"use strict"; +const $helpers = require("@winglang/sdk/lib/helpers"); +module.exports = function({ }) { + class PreflightClass { + constructor({ }) { + } + async method() { + return "ahoy there"; + } + } + return PreflightClass; +} +//# sourceMappingURL=inflight.PreflightClass-1.cjs.map +``` + ## main.tf.json ```json { @@ -286,6 +325,71 @@ class $Root extends $stdlib.std.Resource { }); } } + class PreflightClass extends $stdlib.std.Resource { + constructor($scope, $id, ) { + super($scope, $id); + } + static _toInflightType() { + return ` + require("${$helpers.normalPath(__dirname)}/inflight.PreflightClass-1.cjs")({ + }) + `; + } + _toInflight() { + return ` + (await (async () => { + const PreflightClassClient = ${PreflightClass._toInflightType()}; + const client = new PreflightClassClient({ + }); + if (client.$inflight_init) { await client.$inflight_init(); } + return client; + })()) + `; + } + get _liftMap() { + return ({ + "method": [ + ], + "$inflight_init": [ + ], + }); + } + } + class $Closure4 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.$Closure4-1.cjs")({ + $bar: ${$stdlib.core.liftObject(bar)}, + }) + `; + } + _toInflight() { + return ` + (await (async () => { + const $Closure4Client = ${$Closure4._toInflightType()}; + const client = new $Closure4Client({ + }); + if (client.$inflight_init) { await client.$inflight_init(); } + return client; + })()) + `; + } + get _liftMap() { + return ({ + "handle": [ + [bar, ["method"]], + ], + "$inflight_init": [ + [bar, []], + ], + }); + } + } const bucket = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); (bucket.addObject("k", "value")); const put_and_list = ["put", "list"]; @@ -293,6 +397,8 @@ class $Root extends $stdlib.std.Resource { this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:explicit method lift qualification", new $Closure1(this, "$Closure1")); const inflight_closure = new $Closure2(this, "$Closure2"); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:explicit closure lift qualification", new $Closure3(this, "$Closure3")); + const bar = new PreflightClass(this, "PreflightClass"); + this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:explicit interface lift qualification", new $Closure4(this, "$Closure4")); } } const $PlatformManager = new $stdlib.platform.PlatformManager({platformPaths: $platforms}); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/explicit_lift_qualification.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/explicit_lift_qualification.test.w_test_sim.md index 1367e42c393..b1ab613e11b 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/explicit_lift_qualification.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/explicit_lift_qualification.test.w_test_sim.md @@ -2,11 +2,12 @@ ## stdout.log ```log -pass ─ explicit_lift_qualification.test.wsim » root/env0/test:explicit method lift qualification -pass ─ explicit_lift_qualification.test.wsim » root/env1/test:explicit closure lift qualification +pass ─ explicit_lift_qualification.test.wsim » root/env0/test:explicit method lift qualification +pass ─ explicit_lift_qualification.test.wsim » root/env1/test:explicit closure lift qualification +pass ─ explicit_lift_qualification.test.wsim » root/env2/test:explicit interface lift qualification -Tests 2 passed (2) +Tests 3 passed (3) Snapshots 1 skipped Test Files 1 passed (1) Duration 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 dcd5037adf2..4b9c3f8a628 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 @@ -66,6 +66,25 @@ module.exports = function({ }) { //# sourceMappingURL=inflight.$Closure3-1.cjs.map ``` +## inflight.$Closure4-1.cjs +```cjs +"use strict"; +const $helpers = require("@winglang/sdk/lib/helpers"); +module.exports = function({ }) { + class $Closure4 { + constructor({ }) { + const $obj = (...args) => this.handle(...args); + Object.setPrototypeOf($obj, this); + return $obj; + } + async handle() { + } + } + return $Closure4; +} +//# sourceMappingURL=inflight.$Closure4-1.cjs.map +``` + ## inflight.A-1.cjs ```cjs "use strict"; @@ -103,6 +122,69 @@ module.exports = function({ }) { //# sourceMappingURL=inflight.Dog-1.cjs.map ``` +## inflight.ImplInflightIfaceInInflightClass-1.cjs +```cjs +"use strict"; +const $helpers = require("@winglang/sdk/lib/helpers"); +module.exports = function({ }) { + class ImplInflightIfaceInInflightClass { + async inflight_method() { + return; + } + } + return ImplInflightIfaceInInflightClass; +} +//# sourceMappingURL=inflight.ImplInflightIfaceInInflightClass-1.cjs.map +``` + +## inflight.ImplInflightIfaceInPreflightClass-1.cjs +```cjs +"use strict"; +const $helpers = require("@winglang/sdk/lib/helpers"); +module.exports = function({ }) { + class ImplInflightIfaceInPreflightClass { + constructor({ }) { + } + async inflight_method() { + return; + } + } + return ImplInflightIfaceInPreflightClass; +} +//# sourceMappingURL=inflight.ImplInflightIfaceInPreflightClass-1.cjs.map +``` + +## inflight.ImplPreflightIfaceInPreflightClass-1.cjs +```cjs +"use strict"; +const $helpers = require("@winglang/sdk/lib/helpers"); +module.exports = function({ }) { + class ImplPreflightIfaceInPreflightClass { + constructor({ }) { + } + } + return ImplPreflightIfaceInPreflightClass; +} +//# sourceMappingURL=inflight.ImplPreflightIfaceInPreflightClass-1.cjs.map +``` + +## inflight.ImplementInflightIfaceInPreflightClass-1.cjs +```cjs +"use strict"; +const $helpers = require("@winglang/sdk/lib/helpers"); +module.exports = function({ }) { + class ImplementInflightIfaceInPreflightClass { + constructor({ }) { + } + async inflight_method() { + return; + } + } + return ImplementInflightIfaceInPreflightClass; +} +//# sourceMappingURL=inflight.ImplementInflightIfaceInPreflightClass-1.cjs.map +``` + ## inflight.Terrier-1.cjs ```cjs "use strict"; @@ -167,6 +249,7 @@ const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; const cloud = $stdlib.cloud; +const jsii_fixture = require("jsii-fixture"); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); @@ -400,6 +483,159 @@ class $Root extends $stdlib.std.Resource { }); } } + class ImplementInflightIfaceInPreflightClass extends $stdlib.std.Resource { + constructor($scope, $id, ) { + super($scope, $id); + } + static _toInflightType() { + return ` + require("${$helpers.normalPath(__dirname)}/inflight.ImplementInflightIfaceInPreflightClass-1.cjs")({ + }) + `; + } + _toInflight() { + return ` + (await (async () => { + const ImplementInflightIfaceInPreflightClassClient = ${ImplementInflightIfaceInPreflightClass._toInflightType()}; + const client = new ImplementInflightIfaceInPreflightClassClient({ + }); + if (client.$inflight_init) { await client.$inflight_init(); } + return client; + })()) + `; + } + get _liftMap() { + return ({ + "inflight_method": [ + ], + "$inflight_init": [ + ], + }); + } + } + class $Closure4 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.$Closure4-1.cjs")({ + }) + `; + } + _toInflight() { + return ` + (await (async () => { + const $Closure4Client = ${$Closure4._toInflightType()}; + const client = new $Closure4Client({ + }); + if (client.$inflight_init) { await client.$inflight_init(); } + return client; + })()) + `; + } + get _liftMap() { + return ({ + "handle": [ + ], + "$inflight_init": [ + ], + }); + } + } + class ImplInflightIfaceInInflightClass extends $stdlib.std.Resource { + constructor($scope, $id, ) { + super($scope, $id); + } + static _toInflightType() { + return ` + require("${$helpers.normalPath(__dirname)}/inflight.ImplInflightIfaceInInflightClass-1.cjs")({ + }) + `; + } + _toInflight() { + return ` + (await (async () => { + const ImplInflightIfaceInInflightClassClient = ${ImplInflightIfaceInInflightClass._toInflightType()}; + const client = new ImplInflightIfaceInInflightClassClient({ + }); + if (client.$inflight_init) { await client.$inflight_init(); } + return client; + })()) + `; + } + get _liftMap() { + return ({ + "inflight_method": [ + ], + "$inflight_init": [ + ], + }); + } + } + class ImplInflightIfaceInPreflightClass extends $stdlib.std.Resource { + constructor($scope, $id, ) { + super($scope, $id); + } + static _toInflightType() { + return ` + require("${$helpers.normalPath(__dirname)}/inflight.ImplInflightIfaceInPreflightClass-1.cjs")({ + }) + `; + } + _toInflight() { + return ` + (await (async () => { + const ImplInflightIfaceInPreflightClassClient = ${ImplInflightIfaceInPreflightClass._toInflightType()}; + const client = new ImplInflightIfaceInPreflightClassClient({ + }); + if (client.$inflight_init) { await client.$inflight_init(); } + return client; + })()) + `; + } + get _liftMap() { + return ({ + "inflight_method": [ + ], + "$inflight_init": [ + ], + }); + } + } + class ImplPreflightIfaceInPreflightClass extends $stdlib.std.Resource { + constructor($scope, $id, ) { + super($scope, $id); + } + method() { + return; + } + static _toInflightType() { + return ` + require("${$helpers.normalPath(__dirname)}/inflight.ImplPreflightIfaceInPreflightClass-1.cjs")({ + }) + `; + } + _toInflight() { + return ` + (await (async () => { + const ImplPreflightIfaceInPreflightClassClient = ${ImplPreflightIfaceInPreflightClass._toInflightType()}; + const client = new ImplPreflightIfaceInPreflightClassClient({ + }); + if (client.$inflight_init) { await client.$inflight_init(); } + return client; + })()) + `; + } + get _liftMap() { + return ({ + "$inflight_init": [ + ], + }); + } + } const x = new A(this, "A"); const y = new $Closure1(this, "$Closure1"); const i3 = ((() => { @@ -411,6 +647,7 @@ class $Root extends $stdlib.std.Resource { const z = new Dog(this, "Dog"); const w = new Terrier(this, "Terrier"); const f = new $Closure3(this, "$Closure3"); + new $Closure4(this, "$Closure4"); } } const $PlatformManager = new $stdlib.platform.PlatformManager({platformPaths: $platforms}); From e7eca556d632c334b549c1834fdedba93510491b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Pallar=C3=A9s?= Date: Fri, 12 Apr 2024 09:31:38 +0100 Subject: [PATCH 03/15] chore(console): use .mjs for the dev scripts (#6220) This is a workaround to make the dev scripts for the Console work again. The issue was related to using `tsx` as the dev script executor. --- apps/wing-console/console/app/package.json | 4 ++-- .../console/app/scripts/{config.mts => config.mjs} | 4 ++-- apps/wing-console/console/app/scripts/{dev.mts => dev.mjs} | 4 +--- .../console/app/scripts/{preview.mts => preview.mjs} | 0 4 files changed, 5 insertions(+), 7 deletions(-) rename apps/wing-console/console/app/scripts/{config.mts => config.mjs} (76%) rename apps/wing-console/console/app/scripts/{dev.mts => dev.mjs} (96%) rename apps/wing-console/console/app/scripts/{preview.mts => preview.mjs} (100%) diff --git a/apps/wing-console/console/app/package.json b/apps/wing-console/console/app/package.json index c47bd4b7008..3043051d208 100644 --- a/apps/wing-console/console/app/package.json +++ b/apps/wing-console/console/app/package.json @@ -11,8 +11,8 @@ "dist" ], "scripts": { - "preview": "tsx scripts/preview.mts", - "dev": "tsx watch scripts/dev.mts", + "preview": "node scripts/preview.mjs", + "dev": "node scripts/dev.mjs", "compile": "tsup", "eslint": "eslint --ext .js,.cjs,.ts,.cts,.mts,.tsx --no-error-on-unmatched-pattern . --fix", "test:playwright": "playwright test --update-snapshots", diff --git a/apps/wing-console/console/app/scripts/config.mts b/apps/wing-console/console/app/scripts/config.mjs similarity index 76% rename from apps/wing-console/console/app/scripts/config.mts rename to apps/wing-console/console/app/scripts/config.mjs index 1e1faf890a6..fa01fd0913e 100644 --- a/apps/wing-console/console/app/scripts/config.mts +++ b/apps/wing-console/console/app/scripts/config.mjs @@ -1,9 +1,9 @@ import { fileURLToPath } from "node:url"; import react from "@vitejs/plugin-react"; -import { type InlineConfig } from "vite"; -export const viteConfig: InlineConfig = { +/** @type {import("vite".InlineConfig)} */ +export const viteConfig = { configFile: false, root: fileURLToPath(new URL("../web", import.meta.url)), plugins: [react()], diff --git a/apps/wing-console/console/app/scripts/dev.mts b/apps/wing-console/console/app/scripts/dev.mjs similarity index 96% rename from apps/wing-console/console/app/scripts/dev.mts rename to apps/wing-console/console/app/scripts/dev.mjs index c8083c32fd0..5979b6aae9a 100644 --- a/apps/wing-console/console/app/scripts/dev.mts +++ b/apps/wing-console/console/app/scripts/dev.mjs @@ -31,9 +31,7 @@ const options = parseArgs({ config: { addEventListener(event, listener) {}, removeEventListener(event, listener) {}, - get(key: any) { - return undefined as any; - }, + get(key) {}, set(key, value) {}, }, hostUtils: { diff --git a/apps/wing-console/console/app/scripts/preview.mts b/apps/wing-console/console/app/scripts/preview.mjs similarity index 100% rename from apps/wing-console/console/app/scripts/preview.mts rename to apps/wing-console/console/app/scripts/preview.mjs From 5befc2c96c482fc0a183526df3c35053e152184f Mon Sep 17 00:00:00 2001 From: yoav-steinberg Date: Fri, 12 Apr 2024 16:14:25 +0300 Subject: [PATCH 04/15] fix(compiler): imported JSII types are considered defined after other types (and can't be referenced by them) (#6221) Fixes #6209 Related to #5683 Removed the statement index from JSII import spec so everything imported from a JSII module is considered define at the top level of the file. This makes types imported from JSII behave the same way as other types since #5683. **Note** there's still a difference between how imported JSII types and other types behave in regards to whether they can be used before being defined: classes. In #5683 we avoided hoisting class types to the "top of the file" so you can't do something like: ``` new X(); // Error `X` not defined class X {} ``` But this PR makes JSII classes hoisted to the top so for them this will work: ``` new jsii_module.X(); bring jsii_module; ``` I think in the long run the desired behavior is to hoist all class types. So I'm fine with this currently only working for JSII. ## Checklist - [x] Title matches [Winglang's style guide](https://www.winglang.io/contributing/start-here/pull_requests#how-are-pull-request-titles-formatted) - [x] Description explains motivation and solution - [x] Tests added (always) - [ ] Docs updated (only required for features) - [ ] Added `pr/e2e-full` label if this feature requires end-to-end testing *By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*. --- examples/tests/valid/bring_jsii.test.w | 5 ++ examples/tests/valid/impl_interface.test.w | 28 +++++------ libs/wingc/src/type_check.rs | 14 ++---- libs/wingc/src/type_check/jsii_importer.rs | 23 ++------- .../valid/bring_jsii.test.w_compile_tf-aws.md | 44 ++++++++++++++++ .../impl_interface.test.w_compile_tf-aws.md | 50 +++++++++++++++++++ 6 files changed, 121 insertions(+), 43 deletions(-) diff --git a/examples/tests/valid/bring_jsii.test.w b/examples/tests/valid/bring_jsii.test.w index fb13641782a..02aa7f66d65 100644 --- a/examples/tests/valid/bring_jsii.test.w +++ b/examples/tests/valid/bring_jsii.test.w @@ -16,3 +16,8 @@ assert(jsiiClass.applyClosure(5, (x) => { return x * 2; }) == 10); let jsiiStruct = jsii_fixture.SomeStruct { field: "struct field" }; assert(jsiiClass.methodWithStructParam(jsiiStruct) == "struct field"); + +// Use a JSII interface +class X impl jsii_fixture.ISomeInterface { + pub method() {} +} diff --git a/examples/tests/valid/impl_interface.test.w b/examples/tests/valid/impl_interface.test.w index 10c8e09912b..30273d119a4 100644 --- a/examples/tests/valid/impl_interface.test.w +++ b/examples/tests/valid/impl_interface.test.w @@ -84,21 +84,19 @@ let f = inflight () => { dog.bark(); }; -// This should work: extend a JSII interface in a preflight interface -// Commented out because of: https://github.com/winglang/wing/issues/6209 -// -// interface ExtendJsiiIface extends jsii_fixture.ISomeInterface { -// inflight inflight_method(): void; -// } -// -// class ImplementJsiiIface impl ExtendJsiiIface { -// pub method() { -// return; -// } -// pub inflight inflight_method() { -// return; -// } -// } +// Extend a JSII interface in a preflight interface +interface ExtendJsiiIface extends jsii_fixture.ISomeInterface { + inflight inflight_method(): void; +} + +class ImplementJsiiIface impl ExtendJsiiIface { + pub method() { + return; + } + pub inflight inflight_method() { + return; + } +} // Implement an inflight interface in a preflight class inflight interface IInflight { diff --git a/libs/wingc/src/type_check.rs b/libs/wingc/src/type_check.rs index 0ddc20970be..871b81f7582 100644 --- a/libs/wingc/src/type_check.rs +++ b/libs/wingc/src/type_check.rs @@ -1567,10 +1567,10 @@ impl Types { self .libraries .lookup_nested_str(&resource_fqn, None) - .expect("Resouce base class to be loaded") + .expect("Resource base class to be loaded") .0 .as_type() - .expect("Resouce base class to be a type") + .expect("Resource base class to be a type") } pub fn resource_base_interface(&self) -> TypeRef { @@ -1578,10 +1578,10 @@ impl Types { self .libraries .lookup_nested_str(&resource_fqn, None) - .expect("Resouce base interface to be loaded") + .expect("Resource base interface to be loaded") .0 .as_type() - .expect("Resouce base interface to be a type") + .expect("Resource base interface to be a type") } pub fn construct_base_type(&self) -> TypeRef { @@ -5146,7 +5146,6 @@ impl<'a> TypeChecker<'a> { assembly_name: assembly_name.to_string(), namespace_filter, alias: alias.clone(), - import_statement_idx: stmt.map(|s| s.idx).unwrap_or(0), }); self @@ -5157,10 +5156,7 @@ impl<'a> TypeChecker<'a> { }; // check if we've already defined the given alias in the current scope - if env - .lookup(&jsii.alias.name.as_str().into(), Some(jsii.import_statement_idx)) - .is_some() - { + if env.lookup(&jsii.alias.name.as_str().into(), None).is_some() { self.spanned_error(alias, format!("\"{}\" is already defined", alias.name)); } else { let mut importer = JsiiImporter::new(&jsii, self.types, self.jsii_types); diff --git a/libs/wingc/src/type_check/jsii_importer.rs b/libs/wingc/src/type_check/jsii_importer.rs index 907114fbdce..fa9cee7d7c9 100644 --- a/libs/wingc/src/type_check/jsii_importer.rs +++ b/libs/wingc/src/type_check/jsii_importer.rs @@ -61,11 +61,6 @@ pub struct JsiiImportSpec { pub namespace_filter: Vec, /// The name to assign to the module in the Wing type system. pub alias: Symbol, - /// The index of the import statement that triggered this import. This is required so we'll know - /// later on if types defined by this import come before or after other statements in the code. - /// If type definitions in wing are always location agnostic this doesn't really matter and we - /// might be able to remove this. - pub import_statement_idx: usize, } pub struct JsiiImporter<'a> { @@ -410,7 +405,7 @@ impl<'a> JsiiImporter<'a> { None, SymbolEnvKind::Type(self.wing_types.void()), Phase::Independent, // structs are phase-independent - self.jsii_spec.import_statement_idx, + 0, ), })), false => self.wing_types.add_type(Type::Interface(Interface { @@ -420,12 +415,7 @@ impl<'a> JsiiImporter<'a> { extends: vec![], docs: Docs::from(&jsii_interface.docs), // Will be replaced below - env: SymbolEnv::new( - None, - SymbolEnvKind::Type(self.wing_types.void()), - phase, - self.jsii_spec.import_statement_idx, - ), + env: SymbolEnv::new(None, SymbolEnvKind::Type(self.wing_types.void()), phase, 0), phase, })), }; @@ -443,12 +433,7 @@ impl<'a> JsiiImporter<'a> { } }; - let mut iface_env = SymbolEnv::new( - None, - SymbolEnvKind::Type(wing_type), - phase, - self.jsii_spec.import_statement_idx, - ); + let mut iface_env = SymbolEnv::new(None, SymbolEnvKind::Type(wing_type), phase, 0); iface_env.type_parameters = self.type_param_from_docs(&jsii_interface_fqn, &jsii_interface.docs); self.add_members_to_class_env( @@ -1078,7 +1063,7 @@ impl<'a> JsiiImporter<'a> { &self.jsii_spec.alias, SymbolKind::Namespace(ns), AccessModifier::Private, - StatementIdx::Index(self.jsii_spec.import_statement_idx), + StatementIdx::Top, ) .unwrap(); } 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 27cb6937583..d9a3cc3aca0 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 @@ -22,6 +22,20 @@ module.exports = function({ $greeting, $stuff_HelloWorld }) { //# sourceMappingURL=inflight.$Closure1-1.cjs.map ``` +## inflight.X-1.cjs +```cjs +"use strict"; +const $helpers = require("@winglang/sdk/lib/helpers"); +module.exports = function({ }) { + class X { + constructor({ }) { + } + } + return X; +} +//# sourceMappingURL=inflight.X-1.cjs.map +``` + ## main.tf.json ```json { @@ -92,6 +106,36 @@ class $Root extends $stdlib.std.Resource { }); } } + class X extends $stdlib.std.Resource { + constructor($scope, $id, ) { + super($scope, $id); + } + method() { + } + static _toInflightType() { + return ` + require("${$helpers.normalPath(__dirname)}/inflight.X-1.cjs")({ + }) + `; + } + _toInflight() { + return ` + (await (async () => { + const XClient = ${X._toInflightType()}; + const client = new XClient({ + }); + if (client.$inflight_init) { await client.$inflight_init(); } + return client; + })()) + `; + } + get _liftMap() { + return ({ + "$inflight_init": [ + ], + }); + } + } const hello = new stuff.HelloWorld(); const greeting = (hello.sayHello("wingnuts")); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:sayHello", new $Closure1(this, "$Closure1")); 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 4b9c3f8a628..2c211e4e854 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 @@ -185,6 +185,23 @@ module.exports = function({ }) { //# sourceMappingURL=inflight.ImplementInflightIfaceInPreflightClass-1.cjs.map ``` +## inflight.ImplementJsiiIface-1.cjs +```cjs +"use strict"; +const $helpers = require("@winglang/sdk/lib/helpers"); +module.exports = function({ }) { + class ImplementJsiiIface { + constructor({ }) { + } + async inflight_method() { + return; + } + } + return ImplementJsiiIface; +} +//# sourceMappingURL=inflight.ImplementJsiiIface-1.cjs.map +``` + ## inflight.Terrier-1.cjs ```cjs "use strict"; @@ -483,6 +500,39 @@ class $Root extends $stdlib.std.Resource { }); } } + class ImplementJsiiIface extends $stdlib.std.Resource { + constructor($scope, $id, ) { + super($scope, $id); + } + method() { + return; + } + static _toInflightType() { + return ` + require("${$helpers.normalPath(__dirname)}/inflight.ImplementJsiiIface-1.cjs")({ + }) + `; + } + _toInflight() { + return ` + (await (async () => { + const ImplementJsiiIfaceClient = ${ImplementJsiiIface._toInflightType()}; + const client = new ImplementJsiiIfaceClient({ + }); + if (client.$inflight_init) { await client.$inflight_init(); } + return client; + })()) + `; + } + get _liftMap() { + return ({ + "inflight_method": [ + ], + "$inflight_init": [ + ], + }); + } + } class ImplementInflightIfaceInPreflightClass extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); From 71e8fc75dd0a9da97b9d41fa5fccd213d5471acd Mon Sep 17 00:00:00 2001 From: Mark McCulloh Date: Fri, 12 Apr 2024 09:56:18 -0400 Subject: [PATCH 05/15] feat: typescript and esm in preflight (#6157) Fixes #3013 ~TODO~ - [x] Check benchmarks to make sure happy path perf isn't hurt - [x] Windows - [x] ~Add e2e test to verify fix for `"type": "module"`~ Doesn't fix that issue anymore - [x] Docs to officially sanction using ts in both preflight and inflight via extern *By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*. --- apps/wingcli-v2/src/main.rs | 17 +- docs/docs/03-language-reference.md | 11 +- docs/docs/07-examples/10-using-javascript.md | 4 +- examples/tests/invalid/extern_static.test.w | 2 +- examples/tests/invalid/lib/extern_above.w | 2 +- examples/tests/valid/bring_local.test.w | 6 + .../tests/valid/extern_implementation.test.w | 20 +- examples/tests/valid/external_js.js | 25 --- ...js.extern.d.ts => external_ts.extern.d.ts} | 2 +- examples/tests/valid/external_ts.ts | 31 +++ examples/tests/valid/subdir/subfile.w | 3 +- examples/tests/valid/subdir/util.extern.d.ts | 1 + examples/tests/valid/subdir/util.ts | 4 + .../src/dtsify/snapshots/declarations.snap | 2 + .../wingc/src/dtsify/snapshots/optionals.snap | 2 + libs/wingc/src/jsify.rs | 14 +- ...methods_and_properties_on_collections.snap | 1 + .../access_property_on_primitive.snap | 1 + ...rty_on_value_returned_from_collection.snap | 1 + .../base_class_captures_inflight.snap | 1 + .../base_class_captures_preflight.snap | 1 + .../snapshots/base_class_lift_indirect.snap | 1 + .../base_class_with_fields_inflight.snap | 1 + .../base_class_with_fields_preflight.snap | 1 + .../base_class_with_lifted_field_object.snap | 1 + .../base_class_with_lifted_fields.snap | 1 + libs/wingc/src/jsify/snapshots/builtins.snap | 1 + ..._static_inflight_from_static_inflight.snap | 1 + .../calls_methods_on_preflight_object.snap | 1 + ...pture_from_inside_an_inflight_closure.snap | 1 + ...entifier_closure_from_preflight_scope.snap | 1 + ...pture_identifier_from_preflight_scope.snap | 1 + ...from_preflight_scope_with_method_call.snap | 1 + ...om_preflight_scope_with_nested_object.snap | 1 + ...er_from_preflight_scope_with_property.snap | 1 + .../snapshots/capture_in_keyword_args.snap | 1 + .../capture_object_with_this_in_name.snap | 1 + .../src/jsify/snapshots/capture_token.snap | 1 + ...type_inflight_class_sibling_from_init.snap | 1 + ...pe_inflight_class_sibling_from_method.snap | 1 + ...e_new_inflight_class_inner_no_capture.snap | 1 + ...capture_type_new_inflight_class_outer.snap | 1 + .../snapshots/capture_type_static_method.snap | 1 + ...ure_type_static_method_inflight_class.snap | 1 + .../capture_var_from_method_inflight.snap | 1 + ...ht_class_extends_outer_inflight_class.snap | 1 + .../src/jsify/snapshots/closure_field.snap | 1 + .../src/jsify/snapshots/entrypoint_this.snap | 1 + .../wingc/src/jsify/snapshots/enum_value.snap | 1 + .../free_inflight_obj_from_inflight.snap | 1 + .../free_preflight_object_from_preflight.snap | 1 + .../jsify/snapshots/func_returns_func.snap | 1 + .../src/jsify/snapshots/identify_field.snap | 1 + .../implicit_lift_inflight_init.snap | 1 + .../src/jsify/snapshots/indirect_capture.snap | 1 + ..._extends_both_inside_inflight_closure.snap | 1 + ...inflight_class_extends_inflight_class.snap | 1 + .../jsify/snapshots/inflight_constructor.snap | 1 + .../src/jsify/snapshots/inflight_field.snap | 1 + .../inflight_field_from_inflight.snap | 1 + .../inflight_field_from_inflight_class.snap | 1 + .../snapshots/inline_inflight_class.snap | 1 + .../src/jsify/snapshots/json_object.snap | 1 + ...ary_preflight_and_inflight_expression.snap | 1 + .../lift_binary_preflight_expression.snap | 1 + ...lift_element_from_collection_as_field.snap | 1 + ...ft_element_from_collection_of_objects.snap | 1 + .../snapshots/lift_inflight_closure.snap | 1 + .../lift_inside_preflight_method.snap | 1 + .../jsify/snapshots/lift_self_reference.snap | 1 + .../src/jsify/snapshots/lift_string.snap | 1 + libs/wingc/src/jsify/snapshots/lift_this.snap | 1 + .../jsify/snapshots/lift_var_with_this.snap | 1 + .../src/jsify/snapshots/lift_via_closure.snap | 1 + .../lift_via_closure_class_explicit.snap | 1 + .../namespaced_static_from_inflight.snap | 1 + ...ed_inflight_after_preflight_operation.snap | 1 + .../snapshots/nested_preflight_operation.snap | 1 + .../jsify/snapshots/new_inflight_object.snap | 1 + .../snapshots/no_capture_inside_methods.snap | 1 + ...apture_of_identifier_from_inner_scope.snap | 1 + ...capture_of_identifier_from_same_scope.snap | 1 + ...no_capture_shadow_inside_inner_scopes.snap | 1 + .../no_lift_shadow_inside_inner_scopes.snap | 1 + ...eflight_class_extends_preflight_class.snap | 1 + .../jsify/snapshots/preflight_collection.snap | 1 + ...light_collection_of_preflight_objects.snap | 1 + ...eflight_nested_object_with_operations.snap | 1 + .../src/jsify/snapshots/preflight_object.snap | 1 + .../preflight_object_through_property.snap | 1 + .../preflight_object_with_operations.snap | 1 + ...ject_with_operations_multiple_methods.snap | 1 + .../snapshots/preflight_value_field.snap | 1 + .../jsify/snapshots/read_primitive_value.snap | 1 + .../snapshots/reassign_captured_variable.snap | 1 + ...eassigned_captured_variable_preflight.snap | 1 + .../src/jsify/snapshots/ref_std_macro.snap | 1 + .../reference_from_static_inflight.snap | 1 + .../snapshots/reference_inflight_class.snap | 1 + .../snapshots/reference_inflight_field.snap | 1 + .../reference_inflight_from_inflight.snap | 1 + .../reference_lift_of_collection.snap | 1 + .../snapshots/reference_preflight_field.snap | 1 + ...eflight_field_call_independent_method.snap | 1 + .../snapshots/reference_preflight_fields.snap | 1 + ..._variable_with_this_in_the_expression.snap | 1 + ...preflight_object_from_static_inflight.snap | 1 + .../snapshots/reference_static_inflight.snap | 1 + ...ght_which_references_preflight_object.snap | 1 + .../static_external_inflight_class.snap | 1 + .../static_external_preflight_class.snap | 1 + .../snapshots/static_inflight_operation.snap | 1 + .../static_local_inflight_class.snap | 1 + .../jsify/snapshots/static_on_std_type.snap | 1 + .../jsify/snapshots/transitive_reference.snap | 1 + ...ansitive_reference_via_inflight_class.snap | 1 + .../transitive_reference_via_static.snap | 1 + .../jsify/snapshots/two_identical_lifts.snap | 1 + .../jsify/snapshots/use_util_functions.snap | 1 + .../var_inflight_field_from_inflight.snap | 1 + libs/wingc/src/jsify/snapshots/wait_util.snap | 1 + libs/wingcompiler/.npmignore | 3 - libs/wingcompiler/jest.config.js | 6 - libs/wingcompiler/package.json | 4 +- libs/wingcompiler/preflight.shim.cjs | 51 +++++ libs/wingcompiler/src/compile.ts | 56 ++---- libs/wingsdk/.projen/deps.json | 4 + libs/wingsdk/.projenrc.ts | 1 + libs/wingsdk/package.json | 2 + libs/wingsdk/src/helpers.ts | 26 ++- libs/wingsdk/src/target-sim/queue.inflight.ts | 6 +- libs/wingsdk/src/target-sim/queue.ts | 37 ++-- .../__snapshots__/file-counter.test.ts.snap | 1 + .../__snapshots__/queue.test.ts.snap | 2 + pnpm-lock.yaml | 20 +- tools/hangar/__snapshots__/invalid.ts.snap | 8 +- .../anon_function.test.w_compile_tf-aws.md | 1 + .../valid/api.test.w_compile_tf-aws.md | 1 + .../api_cors_custom.test.w_compile_tf-aws.md | 1 + .../api_cors_default.test.w_compile_tf-aws.md | 1 + .../api_valid_path.test.w_compile_tf-aws.md | 1 + .../valid/assert.test.w_compile_tf-aws.md | 1 + ...wait_in_functions.test.w_compile_tf-aws.md | 1 + .../test_corpus/valid/baz.w_compile_tf-aws.md | 1 + .../bring_alias.test.w_compile_tf-aws.md | 1 + .../bring_awscdk.test.w_compile_tf-aws.md | 1 + .../bring_cdk8s.test.w_compile_tf-aws.md | 1 + .../bring_cdktf.test.w_compile_tf-aws.md | 1 + ..._extend_non_entry.test.w_compile_tf-aws.md | 2 + .../valid/bring_jsii.test.w_compile_tf-aws.md | 1 + .../bring_local.test.w_compile_tf-aws.md | 66 +++++++ .../valid/bring_local.test.w_test_sim.md | 3 +- .../bring_local_dir.test.w_compile_tf-aws.md | 6 + ...cal_normalization.test.w_compile_tf-aws.md | 4 + .../bring_projen.test.w_compile_tf-aws.md | 1 + ...ring_wing_library.test.w_compile_tf-aws.md | 8 +- .../bucket_keys.test.w_compile_tf-aws.md | 1 + .../bypass_return.test.w_compile_tf-aws.md | 1 + ..._static_of_myself.test.w_compile_tf-aws.md | 1 + ...inflight_variants.test.w_compile_tf-aws.md | 1 + ...apture_containers.test.w_compile_tf-aws.md | 1 + ...capture_in_binary.test.w_compile_tf-aws.md | 1 + .../capture_mutables.test.w_compile_tf-aws.md | 1 + ...apture_primitives.test.w_compile_tf-aws.md | 1 + ...gable_class_field.test.w_compile_tf-aws.md | 1 + ...ture_reassignable.test.w_compile_tf-aws.md | 1 + ...resource_and_data.test.w_compile_tf-aws.md | 1 + ..._with_no_inflight.test.w_compile_tf-aws.md | 1 + .../capture_tokens.test.w_compile_tf-aws.md | 1 + .../valid/captures.test.w_compile_tf-aws.md | 1 + .../valid/casting.test.w_compile_tf-aws.md | 1 + .../valid/class.test.w_compile_tf-aws.md | 1 + .../closure_class.test.w_compile_tf-aws.md | 1 + .../construct-base.test.w_compile_tf-aws.md | 1 + .../container_types.test.w_compile_tf-aws.md | 1 + .../custom_obj_id.test.w_compile_tf-aws.md | 1 + .../valid/debug_env.test.w_compile_tf-aws.md | 1 + .../deep_equality.test.w_compile_tf-aws.md | 1 + .../double_reference.test.w_compile_tf-aws.md | 1 + .../valid/doubler.test.w_compile_tf-aws.md | 1 + .../valid/enums.test.w_compile_tf-aws.md | 1 + ...ift_qualification.test.w_compile_tf-aws.md | 1 + ..._binary_operators.test.w_compile_tf-aws.md | 1 + ...ing_interpolation.test.w_compile_tf-aws.md | 1 + .../extend_non_entrypoint.w_compile_tf-aws.md | 1 + ...rn_implementation.test.w_compile_tf-aws.md | 183 ++++++++++++++++-- .../file_counter.test.w_compile_tf-aws.md | 1 + .../valid/for_loop.test.w_compile_tf-aws.md | 1 + .../forward_decl.test.w_compile_tf-aws.md | 1 + ..._returns_function.test.w_compile_tf-aws.md | 1 + .../function_type.test.w_compile_tf-aws.md | 1 + ...ariadic_arguments.test.w_compile_tf-aws.md | 1 + .../valid/hello.test.w_compile_tf-aws.md | 1 + ...entical_inflights.test.w_compile_tf-aws.md | 1 + .../impl_interface.test.w_compile_tf-aws.md | 1 + .../implicit_std.test.w_compile_tf-aws.md | 1 + ...n_scope_construct.test.w_compile_tf-aws.md | 1 + .../valid/inference.test.w_compile_tf-aws.md | 1 + ...light-subscribers.test.w_compile_tf-aws.md | 1 + ...ht_capture_static.test.w_compile_tf-aws.md | 1 + ...as_struct_members.test.w_compile_tf-aws.md | 1 + ...ass_capture_const.test.w_compile_tf-aws.md | 1 + ..._preflight_object.test.w_compile_tf-aws.md | 1 + ...class_definitions.test.w_compile_tf-aws.md | 1 + ...r_capture_mutable.test.w_compile_tf-aws.md | 1 + ..._inflight_closure.test.w_compile_tf-aws.md | 1 + ...t_class_modifiers.test.w_compile_tf-aws.md | 1 + ..._inflight_closure.test.w_compile_tf-aws.md | 1 + ..._interace_handler.test.w_compile_tf-aws.md | 1 + ...lass_without_init.test.w_compile_tf-aws.md | 1 + ...ht_closure_autoid.test.w_compile_tf-aws.md | 1 + ...preflight_closure.test.w_compile_tf-aws.md | 1 + .../inflight_concat.test.w_compile_tf-aws.md | 1 + ...handler_singleton.test.w_compile_tf-aws.md | 1 + .../inflight_init.test.w_compile_tf-aws.md | 1 + ...calling_inflights.test.w_compile_tf-aws.md | 1 + ...erit_stdlib_class.test.w_compile_tf-aws.md | 1 + ...ce_class_inflight.test.w_compile_tf-aws.md | 1 + ...e_class_preflight.test.w_compile_tf-aws.md | 1 + ...ritance_interface.test.w_compile_tf-aws.md | 1 + .../valid/interface.test.w_compile_tf-aws.md | 1 + .../valid/issue_2889.test.w_compile_tf-aws.md | 1 + .../valid/json.test.w_compile_tf-aws.md | 1 + .../json_bucket.test.w_compile_tf-aws.md | 1 + .../json_static.test.w_compile_tf-aws.md | 1 + ...ing_interpolation.test.w_compile_tf-aws.md | 1 + ...ft_expr_with_this.test.w_compile_tf-aws.md | 1 + ...losure_collection.test.w_compile_tf-aws.md | 1 + ...ift_parent_fields.test.w_compile_tf-aws.md | 1 + ...lift_redefinition.test.w_compile_tf-aws.md | 1 + ...t_shared_resource.test.w_compile_tf-aws.md | 1 + .../valid/lift_this.test.w_compile_tf-aws.md | 1 + .../lift_via_closure.test.w_compile_tf-aws.md | 1 + ..._closure_explicit.test.w_compile_tf-aws.md | 1 + .../lift_weird_order.test.w_compile_tf-aws.md | 1 + ...ft_with_phase_ind.test.w_compile_tf-aws.md | 1 + .../map_entries.test.w_compile_tf-aws.md | 1 + ...t_container_types.test.w_compile_tf-aws.md | 1 + ..._after_class_init.test.w_compile_tf-aws.md | 1 + .../new_in_static.test.w_compile_tf-aws.md | 1 + .../valid/new_jsii.test.w_compile_tf-aws.md | 1 + .../valid/nil.test.w_compile_tf-aws.md | 1 + .../valid/on_lift.test.w_compile_tf-aws.md | 1 + .../valid/optionals.test.w_compile_tf-aws.md | 1 + .../parameters.test.w_compile_tf-aws.md | 1 + .../parameters.test.w_compile_tf-aws.md | 1 + ..._method_on_string.test.w_compile_tf-aws.md | 1 + ...primitive_methods.test.w_compile_tf-aws.md | 1 + .../valid/print.test.w_compile_tf-aws.md | 1 + .../reassignment.test.w_compile_tf-aws.md | 1 + .../valid/redis.test.w_compile_tf-aws.md | 1 + .../valid/resource.test.w_compile_tf-aws.md | 1 + ..._inflight_literal.test.w_compile_tf-aws.md | 1 + ...ource_call_static.test.w_compile_tf-aws.md | 1 + ...resource_captures.test.w_compile_tf-aws.md | 1 + ..._captures_globals.test.w_compile_tf-aws.md | 1 + .../valid/service.test.w_compile_tf-aws.md | 1 + .../valid/shadowing.test.w_compile_tf-aws.md | 1 + .../statements_if.test.w_compile_tf-aws.md | 1 + ...able_declarations.test.w_compile_tf-aws.md | 1 + .../static_members.test.w_compile_tf-aws.md | 1 + .../std_containers.test.w_compile_tf-aws.md | 1 + .../valid/std_string.test.w_compile_tf-aws.md | 1 + .../valid/store.w_compile_tf-aws.md | 2 + .../struct_from_json.test.w_compile_tf-aws.md | 3 + .../valid/structs.test.w_compile_tf-aws.md | 1 + .../valid/super_call.test.w_compile_tf-aws.md | 1 + .../symbol_shadow.test.w_compile_tf-aws.md | 1 + .../valid/table.test.w_compile_tf-aws.md | 1 + .../test_bucket.test.w_compile_tf-aws.md | 1 + ...est_without_bring.test.w_compile_tf-aws.md | 1 + .../valid/this.test.w_compile_tf-aws.md | 1 + .../valid/try_catch.test.w_compile_tf-aws.md | 1 + .../unused_lift.test.w_compile_tf-aws.md | 1 + ...side_init_closure.test.w_compile_tf-aws.md | 1 + .../website_with_api.test.w_compile_tf-aws.md | 1 + .../valid/while.test.w_compile_tf-aws.md | 1 + .../while_loop_await.test.w_compile_tf-aws.md | 1 + 278 files changed, 745 insertions(+), 143 deletions(-) delete mode 100644 examples/tests/valid/external_js.js rename examples/tests/valid/{external_js.extern.d.ts => external_ts.extern.d.ts} (99%) create mode 100644 examples/tests/valid/external_ts.ts delete mode 100644 libs/wingcompiler/.npmignore delete mode 100644 libs/wingcompiler/jest.config.js create mode 100644 libs/wingcompiler/preflight.shim.cjs diff --git a/apps/wingcli-v2/src/main.rs b/apps/wingcli-v2/src/main.rs index e08beda3d53..2e2f21457ad 100644 --- a/apps/wingcli-v2/src/main.rs +++ b/apps/wingcli-v2/src/main.rs @@ -10,8 +10,6 @@ use lazy_static::lazy_static; use strum::{Display, EnumString}; use wingc::compile; -pub const VERSION: &str = env!("CARGO_PKG_VERSION"); - lazy_static! { static ref HOME_PATH: PathBuf = home_dir().expect("Could not find home directory"); pub static ref WING_CACHE_DIR: Utf8PathBuf = @@ -90,6 +88,10 @@ fn command_build(source_file: Utf8PathBuf, target: Option) -> Result<(), install_sdk()?; } else { // TODO: check that the SDK version matches the CLI version + if cfg!(test) { + // For now, always reinstall the SDK in tests + install_sdk()?; + } } tracing::info!("Using SDK at {}", sdk_root); @@ -117,10 +119,13 @@ fn install_sdk() -> Result<(), Box> { std::fs::create_dir_all(WING_CACHE_DIR.as_str())?; let mut install_command = std::process::Command::new("npm"); - install_command - .arg("install") - .arg(format!("@winglang/sdk@{VERSION}")) - .arg("esbuild"); // TODO: should this not be an optional dependency? + install_command.arg("install").arg("esbuild"); // TODO: should this not be an optional dependency? + if cfg!(test) { + install_command.arg(format!("file:{}/../../libs/wingsdk", env!("CARGO_MANIFEST_DIR"))); + } else { + install_command.arg(format!("@winglang/sdk@{}", env!("CARGO_PKG_VERSION"))); + } + install_command.current_dir(WING_CACHE_DIR.as_str()); install_command.stdout(std::process::Stdio::piped()); install_command.stderr(std::process::Stdio::piped()); diff --git a/docs/docs/03-language-reference.md b/docs/docs/03-language-reference.md index 1a4e9324d2e..f5f3c8a8b92 100644 --- a/docs/docs/03-language-reference.md +++ b/docs/docs/03-language-reference.md @@ -1885,7 +1885,8 @@ Mapping JSII types to Wing types: ## 5.2 JavaScript -The `extern ""` modifier can be used on method declarations in classes to indicate that a method is backed by an implementation imported from a JavaScript module. The module must be a relative path and will be loaded via [require()](https://nodejs.org/api/modules.html#requireid). +The `extern ""` modifier can be used on method declarations in classes to indicate that a method is backed by an implementation imported from a JavaScript module. The module must be a relative path and will be loaded via [require()](https://nodejs.org/api/modules.html#requireid). +This module can be either CJS or ESM and may be written in JavaScript or TypeScript. In the following example, the static inflight method `makeId` is implemented in `helper.js`: @@ -1920,13 +1921,7 @@ matching name (without any case conversion). Extern methods do not support access to class's members through `this`, so they must be declared `static`. -### 5.2.1 TypeScript - -It is possible to use TypeScript to write helpers, but at the moment this is not -directly supported by Wing. This means that you will need to setup the TypeScript toolchain -to compile your code to JavaScript and then use `extern` against the JavaScript file. - -### 5.2.2 Type model +### 5.2.1 Type model The table below shows the mapping between Wing types and JavaScript values, shown with TypeScript types. When calling **extern** function, the parameter and return types are **assumed** to be satisfied by the called function. diff --git a/docs/docs/07-examples/10-using-javascript.md b/docs/docs/07-examples/10-using-javascript.md index 4b7b6640e63..bc944c3d0b2 100644 --- a/docs/docs/07-examples/10-using-javascript.md +++ b/docs/docs/07-examples/10-using-javascript.md @@ -6,7 +6,7 @@ keywords: [example, javascript, extern, typescript, js, ts] Calling a Javascript function from Wing requires two steps. -1. Create a .js file that exports some functions +1. Create a .js/.ts file that exports some functions ```js // util.js @@ -16,7 +16,7 @@ exports.isValidUrl = function (url) { }; ``` -In preflight, this file must be a CommonJS module written in Javascript. Inflight, it may be CJS/ESM and either JavaScript or TypeScript. +It may be CJS/ESM written in either JavaScript or TypeScript. 2. Use the `extern` keyword in a class to expose the function to Wing. Note that this must be `static`. It may also be `inflight` diff --git a/examples/tests/invalid/extern_static.test.w b/examples/tests/invalid/extern_static.test.w index 8efcc58d8b2..6d055e48d46 100644 --- a/examples/tests/invalid/extern_static.test.w +++ b/examples/tests/invalid/extern_static.test.w @@ -1,4 +1,4 @@ class Foo { - extern "../valid/external_js.js" inflight getGreeting(name: str): str; + extern "../valid/external_ts.ts" inflight getGreeting(name: str): str; //^ Error: extern methods must be declared "static" } diff --git a/examples/tests/invalid/lib/extern_above.w b/examples/tests/invalid/lib/extern_above.w index ca7dde0c303..12cfea9af23 100644 --- a/examples/tests/invalid/lib/extern_above.w +++ b/examples/tests/invalid/lib/extern_above.w @@ -1,4 +1,4 @@ class Foo1 { - extern "../../valid/external_js.js" static getGreeting(name: str): str; + extern "../../valid/external_ts.ts" static getGreeting(name: str): str; //^ must be a sub directory of the entrypoint } diff --git a/examples/tests/valid/bring_local.test.w b/examples/tests/valid/bring_local.test.w index 1e6a6bb7443..6dd61c46cdd 100644 --- a/examples/tests/valid/bring_local.test.w +++ b/examples/tests/valid/bring_local.test.w @@ -5,15 +5,21 @@ bring "./store.w" as file1; bring "./subdir/subfile.w" as file2; bring "./subdir/empty.w" as file3; bring math; +bring expect; // classes from other files can be used let store = new file1.Store(); let q = new file2.Q(); +expect.equal(file2.Q.preflightGreet("foo"), "Hello foo"); test "add data to store" { store.store("foo"); } +test "greet" { + expect.equal(file2.Q.greet("bar"), "Hello bar"); +} + // structs from other files can be used let s = file1.Point { x: 1, diff --git a/examples/tests/valid/extern_implementation.test.w b/examples/tests/valid/extern_implementation.test.w index 10d7bdfa8a3..75c23452fe6 100644 --- a/examples/tests/valid/extern_implementation.test.w +++ b/examples/tests/valid/extern_implementation.test.w @@ -1,12 +1,12 @@ bring cloud; class Foo { - extern "./external_js.js" pub static getGreeting(name: str): str; - extern "./external_js.js" static inflight regexInflight(pattern: str, text: str): bool; - extern "./external_js.js" static inflight getUuid(): str; - extern "./external_js.js" static inflight getData(): str; - extern "./external_js.js" pub static inflight print(msg: str): void; - extern "./external_js.js" pub static preflightBucket(bucket: cloud.Bucket, id: str): Json; + extern "./external_ts.ts" pub static getGreeting(name: str): str; + extern "./external_ts.ts" static inflight regexInflight(pattern: str, text: str): bool; + extern "./external_ts.ts" static inflight getUuid(): str; + extern "./external_ts.ts" static inflight getData(): str; + extern "./external_ts.ts" pub static inflight print(msg: str): void; + extern "./external_ts.ts" pub static preflightBucket(bucket: cloud.Bucket, id: str): void; pub inflight call() { assert(Foo.regexInflight("[a-z]+-\\d+", "abc-123")); @@ -22,10 +22,14 @@ assert(Foo.getGreeting("Wingding") == "Hello, Wingding!"); let f = new Foo(); let bucket = new cloud.Bucket() as "my-bucket"; -let result = Foo.preflightBucket(bucket, "my-bucket"); +Foo.preflightBucket(bucket, "my-bucket"); -test "call" { +let func = new cloud.Function(inflight () => { f.call(); +}); + +test "call" { + func.invoke(); } test "console" { diff --git a/examples/tests/valid/external_js.js b/examples/tests/valid/external_js.js deleted file mode 100644 index 2c054a63d9c..00000000000 --- a/examples/tests/valid/external_js.js +++ /dev/null @@ -1,25 +0,0 @@ -const assert = require("node:assert"); - -/** @type {import("./external_js.extern").default} */ -module.exports = { - getGreeting(name) { - return `Hello, ${name}!`; - }, - preflightBucket(bucket, id) { - assert.strictEqual(bucket.node.id, id); - }, - async regexInflight(pattern, text) { - const regex = new RegExp(pattern); - return regex.test(text); - }, - async getUuid() { - let uuid = require("uuid"); - return uuid.v4(); - }, - async getData() { - return require("./exported_data.js"); - }, - async print(msg) { - console.log(`printing ${msg}`); - }, -}; diff --git a/examples/tests/valid/external_js.extern.d.ts b/examples/tests/valid/external_ts.extern.d.ts similarity index 99% rename from examples/tests/valid/external_js.extern.d.ts rename to examples/tests/valid/external_ts.extern.d.ts index 079bebe0c07..5d10ff6b79d 100644 --- a/examples/tests/valid/external_js.extern.d.ts +++ b/examples/tests/valid/external_ts.extern.d.ts @@ -2,7 +2,7 @@ export default interface extern { getData: () => Promise, getGreeting: (name: string) => string, getUuid: () => Promise, - preflightBucket: (bucket: Bucket, id: string) => Readonly, + preflightBucket: (bucket: Bucket, id: string) => void, print: (msg: string) => Promise, regexInflight: (pattern: string, text: string) => Promise, } diff --git a/examples/tests/valid/external_ts.ts b/examples/tests/valid/external_ts.ts new file mode 100644 index 00000000000..6c0189d6a22 --- /dev/null +++ b/examples/tests/valid/external_ts.ts @@ -0,0 +1,31 @@ +import assert from "assert"; +import extern from "./external_ts.extern"; + +export const getGreeting: extern["getGreeting"] = function (name) { + return `Hello, ${name}!`; +}; + +export const regexInflight: extern["regexInflight"] = async function ( + pattern, + text +) { + const regex = new RegExp(pattern); + return regex.test(text); +}; + +export const getUuid: extern["getUuid"] = async function () { + let uuid = require("uuid"); + return uuid.v4(); +}; + +export const getData: extern["getData"] = async function () { + return require("./exported_data.js"); +}; + +export const print: extern["print"] = async function (msg) { + console.log(`printing ${msg}`); +}; + +export const preflightBucket: extern["preflightBucket"] = (bucket, id) => { + assert.strictEqual(bucket.node.id, id); +}; diff --git a/examples/tests/valid/subdir/subfile.w b/examples/tests/valid/subdir/subfile.w index 0981074aee2..7c6556ebd2e 100644 --- a/examples/tests/valid/subdir/subfile.w +++ b/examples/tests/valid/subdir/subfile.w @@ -1,5 +1,6 @@ bring math; pub class Q { - extern "./util.ts" static inflight greet(name: str): str; + pub extern "./util.ts" static inflight greet(name: str): str; + pub extern "./util.ts" static preflightGreet(name: str): str; } diff --git a/examples/tests/valid/subdir/util.extern.d.ts b/examples/tests/valid/subdir/util.extern.d.ts index d941b3480e7..2f2cb7cf7c1 100644 --- a/examples/tests/valid/subdir/util.extern.d.ts +++ b/examples/tests/valid/subdir/util.extern.d.ts @@ -1,3 +1,4 @@ export default interface extern { greet: (name: string) => Promise, + preflightGreet: (name: string) => string, } diff --git a/examples/tests/valid/subdir/util.ts b/examples/tests/valid/subdir/util.ts index 833d6b144c2..325859f7d58 100644 --- a/examples/tests/valid/subdir/util.ts +++ b/examples/tests/valid/subdir/util.ts @@ -2,4 +2,8 @@ import type extern from "./util.extern"; export const greet: extern["greet"] = async (name) => { return "Hello " + name; +} + +export const preflightGreet: extern["preflightGreet"] = (name) => { + return "Hello " + name; } diff --git a/libs/wingc/src/dtsify/snapshots/declarations.snap b/libs/wingc/src/dtsify/snapshots/declarations.snap index f9e95917a17..1633a1efb69 100644 --- a/libs/wingc/src/dtsify/snapshots/declarations.snap +++ b/libs/wingc/src/dtsify/snapshots/declarations.snap @@ -79,6 +79,7 @@ module.exports = function({ }) { const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); module.exports = { ...require("./preflight.lib-1.cjs"), }; @@ -98,6 +99,7 @@ export * from "./preflight.lib-1.cjs" const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class ParentClass extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); diff --git a/libs/wingc/src/dtsify/snapshots/optionals.snap b/libs/wingc/src/dtsify/snapshots/optionals.snap index dbd16fdea9f..6d761424825 100644 --- a/libs/wingc/src/dtsify/snapshots/optionals.snap +++ b/libs/wingc/src/dtsify/snapshots/optionals.snap @@ -45,6 +45,7 @@ module.exports = function({ }) { const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); module.exports = { ...require("./preflight.lib-1.cjs"), }; @@ -64,6 +65,7 @@ export * from "./preflight.lib-1.cjs" const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class ParentClass extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); diff --git a/libs/wingc/src/jsify.rs b/libs/wingc/src/jsify.rs index 44837b81953..3537edd537b 100644 --- a/libs/wingc/src/jsify.rs +++ b/libs/wingc/src/jsify.rs @@ -48,6 +48,7 @@ const ENV_WING_IS_TEST: &str = "$wing_is_test"; const OUTDIR_VAR: &str = "$outdir"; const PLATFORMS_VAR: &str = "$platforms"; const HELPERS_VAR: &str = "$helpers"; +const EXTERN_VAR: &str = "$extern"; const ROOT_CLASS: &str = "$Root"; const JS_CONSTRUCTOR: &str = "constructor"; @@ -170,7 +171,7 @@ impl<'a> JSifier<'a> { output.line("\"use strict\";"); - output.line(format!("const {} = require('{}');", STDLIB, STDLIB_MODULE)); + output.line(format!("const {STDLIB} = require('{STDLIB_MODULE}');")); if is_entrypoint { output.line(format!( @@ -187,6 +188,9 @@ impl<'a> JSifier<'a> { // "std" is implicitly imported output.line(format!("const std = {STDLIB}.{WINGSDK_STD_MODULE};")); output.line(format!("const {HELPERS_VAR} = {STDLIB}.helpers;")); + output.line(format!( + "const {EXTERN_VAR} = {HELPERS_VAR}.createExternRequire(__dirname);" + )); output.add_code(imports); if is_entrypoint { @@ -1452,9 +1456,15 @@ impl<'a> JSifier<'a> { format!("{up_dirs}{rel_path}") }; + let require = if ctx.visit_ctx.current_phase() == Phase::Inflight { + "require" + } else { + EXTERN_VAR + }; + new_code!( &func_def.span, - format!("return (require(\"{require_path}\")[\"{name}\"])("), + format!("return ({require}(\"{require_path}\")[\"{name}\"])("), parameters.clone(), ")" ) diff --git a/libs/wingc/src/jsify/snapshots/access_methods_and_properties_on_collections.snap b/libs/wingc/src/jsify/snapshots/access_methods_and_properties_on_collections.snap index 48e01b1c661..86c170f8411 100644 --- a/libs/wingc/src/jsify/snapshots/access_methods_and_properties_on_collections.snap +++ b/libs/wingc/src/jsify/snapshots/access_methods_and_properties_on_collections.snap @@ -47,6 +47,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/access_property_on_primitive.snap b/libs/wingc/src/jsify/snapshots/access_property_on_primitive.snap index 1b1759f493c..b5771fcc0b9 100644 --- a/libs/wingc/src/jsify/snapshots/access_property_on_primitive.snap +++ b/libs/wingc/src/jsify/snapshots/access_property_on_primitive.snap @@ -44,6 +44,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/access_property_on_value_returned_from_collection.snap b/libs/wingc/src/jsify/snapshots/access_property_on_value_returned_from_collection.snap index 7c06ab7bda1..e793ccf4bc2 100644 --- a/libs/wingc/src/jsify/snapshots/access_property_on_value_returned_from_collection.snap +++ b/libs/wingc/src/jsify/snapshots/access_property_on_value_returned_from_collection.snap @@ -44,6 +44,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/base_class_captures_inflight.snap b/libs/wingc/src/jsify/snapshots/base_class_captures_inflight.snap index 211360110ec..c996859fb2d 100644 --- a/libs/wingc/src/jsify/snapshots/base_class_captures_inflight.snap +++ b/libs/wingc/src/jsify/snapshots/base_class_captures_inflight.snap @@ -68,6 +68,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/base_class_captures_preflight.snap b/libs/wingc/src/jsify/snapshots/base_class_captures_preflight.snap index cd1744305a9..989c402998a 100644 --- a/libs/wingc/src/jsify/snapshots/base_class_captures_preflight.snap +++ b/libs/wingc/src/jsify/snapshots/base_class_captures_preflight.snap @@ -62,6 +62,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/base_class_lift_indirect.snap b/libs/wingc/src/jsify/snapshots/base_class_lift_indirect.snap index 501044dc78c..a1098a4325a 100644 --- a/libs/wingc/src/jsify/snapshots/base_class_lift_indirect.snap +++ b/libs/wingc/src/jsify/snapshots/base_class_lift_indirect.snap @@ -76,6 +76,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/base_class_with_fields_inflight.snap b/libs/wingc/src/jsify/snapshots/base_class_with_fields_inflight.snap index bc9885dec9b..1bcabfc5528 100644 --- a/libs/wingc/src/jsify/snapshots/base_class_with_fields_inflight.snap +++ b/libs/wingc/src/jsify/snapshots/base_class_with_fields_inflight.snap @@ -77,6 +77,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/base_class_with_fields_preflight.snap b/libs/wingc/src/jsify/snapshots/base_class_with_fields_preflight.snap index eb56eb2de3b..c5faa235839 100644 --- a/libs/wingc/src/jsify/snapshots/base_class_with_fields_preflight.snap +++ b/libs/wingc/src/jsify/snapshots/base_class_with_fields_preflight.snap @@ -67,6 +67,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/base_class_with_lifted_field_object.snap b/libs/wingc/src/jsify/snapshots/base_class_with_lifted_field_object.snap index ab32066085e..e2a2891ef78 100644 --- a/libs/wingc/src/jsify/snapshots/base_class_with_lifted_field_object.snap +++ b/libs/wingc/src/jsify/snapshots/base_class_with_lifted_field_object.snap @@ -67,6 +67,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/base_class_with_lifted_fields.snap b/libs/wingc/src/jsify/snapshots/base_class_with_lifted_fields.snap index d4deff63c26..7793850313b 100644 --- a/libs/wingc/src/jsify/snapshots/base_class_with_lifted_fields.snap +++ b/libs/wingc/src/jsify/snapshots/base_class_with_lifted_fields.snap @@ -67,6 +67,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/builtins.snap b/libs/wingc/src/jsify/snapshots/builtins.snap index d535cefa321..53008dfdff0 100644 --- a/libs/wingc/src/jsify/snapshots/builtins.snap +++ b/libs/wingc/src/jsify/snapshots/builtins.snap @@ -42,6 +42,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/call_static_inflight_from_static_inflight.snap b/libs/wingc/src/jsify/snapshots/call_static_inflight_from_static_inflight.snap index 0952212b5dc..d131a1db629 100644 --- a/libs/wingc/src/jsify/snapshots/call_static_inflight_from_static_inflight.snap +++ b/libs/wingc/src/jsify/snapshots/call_static_inflight_from_static_inflight.snap @@ -61,6 +61,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/calls_methods_on_preflight_object.snap b/libs/wingc/src/jsify/snapshots/calls_methods_on_preflight_object.snap index 386875ba935..e34ef9d6acd 100644 --- a/libs/wingc/src/jsify/snapshots/calls_methods_on_preflight_object.snap +++ b/libs/wingc/src/jsify/snapshots/calls_methods_on_preflight_object.snap @@ -47,6 +47,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/capture_from_inside_an_inflight_closure.snap b/libs/wingc/src/jsify/snapshots/capture_from_inside_an_inflight_closure.snap index 7c8bc762826..09e9197b655 100644 --- a/libs/wingc/src/jsify/snapshots/capture_from_inside_an_inflight_closure.snap +++ b/libs/wingc/src/jsify/snapshots/capture_from_inside_an_inflight_closure.snap @@ -47,6 +47,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const util = $stdlib.util; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/capture_identifier_closure_from_preflight_scope.snap b/libs/wingc/src/jsify/snapshots/capture_identifier_closure_from_preflight_scope.snap index 50074825440..855df068e77 100644 --- a/libs/wingc/src/jsify/snapshots/capture_identifier_closure_from_preflight_scope.snap +++ b/libs/wingc/src/jsify/snapshots/capture_identifier_closure_from_preflight_scope.snap @@ -63,6 +63,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/capture_identifier_from_preflight_scope.snap b/libs/wingc/src/jsify/snapshots/capture_identifier_from_preflight_scope.snap index 419894a1a8c..7fc9b80532b 100644 --- a/libs/wingc/src/jsify/snapshots/capture_identifier_from_preflight_scope.snap +++ b/libs/wingc/src/jsify/snapshots/capture_identifier_from_preflight_scope.snap @@ -43,6 +43,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/capture_identifier_from_preflight_scope_with_method_call.snap b/libs/wingc/src/jsify/snapshots/capture_identifier_from_preflight_scope_with_method_call.snap index 78c6897c5f1..13cc38e59bb 100644 --- a/libs/wingc/src/jsify/snapshots/capture_identifier_from_preflight_scope_with_method_call.snap +++ b/libs/wingc/src/jsify/snapshots/capture_identifier_from_preflight_scope_with_method_call.snap @@ -64,6 +64,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/capture_identifier_from_preflight_scope_with_nested_object.snap b/libs/wingc/src/jsify/snapshots/capture_identifier_from_preflight_scope_with_nested_object.snap index 9477fbcadad..b5fbf73536b 100644 --- a/libs/wingc/src/jsify/snapshots/capture_identifier_from_preflight_scope_with_nested_object.snap +++ b/libs/wingc/src/jsify/snapshots/capture_identifier_from_preflight_scope_with_nested_object.snap @@ -67,6 +67,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/capture_identifier_from_preflight_scope_with_property.snap b/libs/wingc/src/jsify/snapshots/capture_identifier_from_preflight_scope_with_property.snap index c671c5626b5..a758b92f8cc 100644 --- a/libs/wingc/src/jsify/snapshots/capture_identifier_from_preflight_scope_with_property.snap +++ b/libs/wingc/src/jsify/snapshots/capture_identifier_from_preflight_scope_with_property.snap @@ -43,6 +43,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/capture_in_keyword_args.snap b/libs/wingc/src/jsify/snapshots/capture_in_keyword_args.snap index 9fd8c54c2b7..312283f1f43 100644 --- a/libs/wingc/src/jsify/snapshots/capture_in_keyword_args.snap +++ b/libs/wingc/src/jsify/snapshots/capture_in_keyword_args.snap @@ -48,6 +48,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const util = $stdlib.util; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/capture_object_with_this_in_name.snap b/libs/wingc/src/jsify/snapshots/capture_object_with_this_in_name.snap index e039d94bfb0..e08d93d3d5f 100644 --- a/libs/wingc/src/jsify/snapshots/capture_object_with_this_in_name.snap +++ b/libs/wingc/src/jsify/snapshots/capture_object_with_this_in_name.snap @@ -44,6 +44,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/capture_token.snap b/libs/wingc/src/jsify/snapshots/capture_token.snap index ccc4dd184ee..7d280541b37 100644 --- a/libs/wingc/src/jsify/snapshots/capture_token.snap +++ b/libs/wingc/src/jsify/snapshots/capture_token.snap @@ -43,6 +43,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/capture_type_inflight_class_sibling_from_init.snap b/libs/wingc/src/jsify/snapshots/capture_type_inflight_class_sibling_from_init.snap index 50fda4ff585..e33734b441e 100644 --- a/libs/wingc/src/jsify/snapshots/capture_type_inflight_class_sibling_from_init.snap +++ b/libs/wingc/src/jsify/snapshots/capture_type_inflight_class_sibling_from_init.snap @@ -67,6 +67,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/capture_type_inflight_class_sibling_from_method.snap b/libs/wingc/src/jsify/snapshots/capture_type_inflight_class_sibling_from_method.snap index bd27b367715..47fb417fa00 100644 --- a/libs/wingc/src/jsify/snapshots/capture_type_inflight_class_sibling_from_method.snap +++ b/libs/wingc/src/jsify/snapshots/capture_type_inflight_class_sibling_from_method.snap @@ -53,6 +53,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/capture_type_new_inflight_class_inner_no_capture.snap b/libs/wingc/src/jsify/snapshots/capture_type_new_inflight_class_inner_no_capture.snap index d518d3f9c5d..b0d4cbe8f02 100644 --- a/libs/wingc/src/jsify/snapshots/capture_type_new_inflight_class_inner_no_capture.snap +++ b/libs/wingc/src/jsify/snapshots/capture_type_new_inflight_class_inner_no_capture.snap @@ -45,6 +45,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/capture_type_new_inflight_class_outer.snap b/libs/wingc/src/jsify/snapshots/capture_type_new_inflight_class_outer.snap index 8d6c0887a44..8489eec5041 100644 --- a/libs/wingc/src/jsify/snapshots/capture_type_new_inflight_class_outer.snap +++ b/libs/wingc/src/jsify/snapshots/capture_type_new_inflight_class_outer.snap @@ -57,6 +57,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/capture_type_static_method.snap b/libs/wingc/src/jsify/snapshots/capture_type_static_method.snap index 7a82f971934..b6277673600 100644 --- a/libs/wingc/src/jsify/snapshots/capture_type_static_method.snap +++ b/libs/wingc/src/jsify/snapshots/capture_type_static_method.snap @@ -64,6 +64,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/capture_type_static_method_inflight_class.snap b/libs/wingc/src/jsify/snapshots/capture_type_static_method_inflight_class.snap index e59d297b94e..cd7cc8981dd 100644 --- a/libs/wingc/src/jsify/snapshots/capture_type_static_method_inflight_class.snap +++ b/libs/wingc/src/jsify/snapshots/capture_type_static_method_inflight_class.snap @@ -62,6 +62,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/capture_var_from_method_inflight.snap b/libs/wingc/src/jsify/snapshots/capture_var_from_method_inflight.snap index 6a5e3f202cf..9254bf82239 100644 --- a/libs/wingc/src/jsify/snapshots/capture_var_from_method_inflight.snap +++ b/libs/wingc/src/jsify/snapshots/capture_var_from_method_inflight.snap @@ -50,6 +50,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/closed_inflight_class_extends_outer_inflight_class.snap b/libs/wingc/src/jsify/snapshots/closed_inflight_class_extends_outer_inflight_class.snap index 681edf91351..ebda1fe8f15 100644 --- a/libs/wingc/src/jsify/snapshots/closed_inflight_class_extends_outer_inflight_class.snap +++ b/libs/wingc/src/jsify/snapshots/closed_inflight_class_extends_outer_inflight_class.snap @@ -60,6 +60,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/closure_field.snap b/libs/wingc/src/jsify/snapshots/closure_field.snap index c24a23f0ad0..38f066ba6c9 100644 --- a/libs/wingc/src/jsify/snapshots/closure_field.snap +++ b/libs/wingc/src/jsify/snapshots/closure_field.snap @@ -105,6 +105,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/entrypoint_this.snap b/libs/wingc/src/jsify/snapshots/entrypoint_this.snap index f8fe4a12964..b61f8369c14 100644 --- a/libs/wingc/src/jsify/snapshots/entrypoint_this.snap +++ b/libs/wingc/src/jsify/snapshots/entrypoint_this.snap @@ -19,6 +19,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/enum_value.snap b/libs/wingc/src/jsify/snapshots/enum_value.snap index 8f4a1c9d9da..e48c24d9f1e 100644 --- a/libs/wingc/src/jsify/snapshots/enum_value.snap +++ b/libs/wingc/src/jsify/snapshots/enum_value.snap @@ -47,6 +47,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/free_inflight_obj_from_inflight.snap b/libs/wingc/src/jsify/snapshots/free_inflight_obj_from_inflight.snap index b9a1b66705d..5257f8a3c70 100644 --- a/libs/wingc/src/jsify/snapshots/free_inflight_obj_from_inflight.snap +++ b/libs/wingc/src/jsify/snapshots/free_inflight_obj_from_inflight.snap @@ -55,6 +55,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/free_preflight_object_from_preflight.snap b/libs/wingc/src/jsify/snapshots/free_preflight_object_from_preflight.snap index f7b65b20fc2..15ebf279878 100644 --- a/libs/wingc/src/jsify/snapshots/free_preflight_object_from_preflight.snap +++ b/libs/wingc/src/jsify/snapshots/free_preflight_object_from_preflight.snap @@ -38,6 +38,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/func_returns_func.snap b/libs/wingc/src/jsify/snapshots/func_returns_func.snap index 3a73d77eac6..2b8e67d67c0 100644 --- a/libs/wingc/src/jsify/snapshots/func_returns_func.snap +++ b/libs/wingc/src/jsify/snapshots/func_returns_func.snap @@ -52,6 +52,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/identify_field.snap b/libs/wingc/src/jsify/snapshots/identify_field.snap index 43514e965b2..8cdc9ae7a00 100644 --- a/libs/wingc/src/jsify/snapshots/identify_field.snap +++ b/libs/wingc/src/jsify/snapshots/identify_field.snap @@ -47,6 +47,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/implicit_lift_inflight_init.snap b/libs/wingc/src/jsify/snapshots/implicit_lift_inflight_init.snap index 93bbef3650e..ede8b4806e1 100644 --- a/libs/wingc/src/jsify/snapshots/implicit_lift_inflight_init.snap +++ b/libs/wingc/src/jsify/snapshots/implicit_lift_inflight_init.snap @@ -65,6 +65,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/indirect_capture.snap b/libs/wingc/src/jsify/snapshots/indirect_capture.snap index e7498878bf6..15a89bd9a55 100644 --- a/libs/wingc/src/jsify/snapshots/indirect_capture.snap +++ b/libs/wingc/src/jsify/snapshots/indirect_capture.snap @@ -80,6 +80,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/inflight_class_extends_both_inside_inflight_closure.snap b/libs/wingc/src/jsify/snapshots/inflight_class_extends_both_inside_inflight_closure.snap index 43fb77ab454..c496a96fb04 100644 --- a/libs/wingc/src/jsify/snapshots/inflight_class_extends_both_inside_inflight_closure.snap +++ b/libs/wingc/src/jsify/snapshots/inflight_class_extends_both_inside_inflight_closure.snap @@ -46,6 +46,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/inflight_class_extends_inflight_class.snap b/libs/wingc/src/jsify/snapshots/inflight_class_extends_inflight_class.snap index 973756e9146..681b87585d6 100644 --- a/libs/wingc/src/jsify/snapshots/inflight_class_extends_inflight_class.snap +++ b/libs/wingc/src/jsify/snapshots/inflight_class_extends_inflight_class.snap @@ -46,6 +46,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/inflight_constructor.snap b/libs/wingc/src/jsify/snapshots/inflight_constructor.snap index 36a61985702..80faa3b1138 100644 --- a/libs/wingc/src/jsify/snapshots/inflight_constructor.snap +++ b/libs/wingc/src/jsify/snapshots/inflight_constructor.snap @@ -50,6 +50,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/inflight_field.snap b/libs/wingc/src/jsify/snapshots/inflight_field.snap index be9f77397a3..0cfde3b80c0 100644 --- a/libs/wingc/src/jsify/snapshots/inflight_field.snap +++ b/libs/wingc/src/jsify/snapshots/inflight_field.snap @@ -49,6 +49,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/inflight_field_from_inflight.snap b/libs/wingc/src/jsify/snapshots/inflight_field_from_inflight.snap index 9fb9f5c5dfb..f300ef416e6 100644 --- a/libs/wingc/src/jsify/snapshots/inflight_field_from_inflight.snap +++ b/libs/wingc/src/jsify/snapshots/inflight_field_from_inflight.snap @@ -48,6 +48,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/inflight_field_from_inflight_class.snap b/libs/wingc/src/jsify/snapshots/inflight_field_from_inflight_class.snap index 4fa3b1f9b1b..04d361bfed3 100644 --- a/libs/wingc/src/jsify/snapshots/inflight_field_from_inflight_class.snap +++ b/libs/wingc/src/jsify/snapshots/inflight_field_from_inflight_class.snap @@ -47,6 +47,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/inline_inflight_class.snap b/libs/wingc/src/jsify/snapshots/inline_inflight_class.snap index d10319ad40e..2a44a3b8b81 100644 --- a/libs/wingc/src/jsify/snapshots/inline_inflight_class.snap +++ b/libs/wingc/src/jsify/snapshots/inline_inflight_class.snap @@ -68,6 +68,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/json_object.snap b/libs/wingc/src/jsify/snapshots/json_object.snap index 66ac72a49cb..62036dd7fef 100644 --- a/libs/wingc/src/jsify/snapshots/json_object.snap +++ b/libs/wingc/src/jsify/snapshots/json_object.snap @@ -44,6 +44,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/lift_binary_preflight_and_inflight_expression.snap b/libs/wingc/src/jsify/snapshots/lift_binary_preflight_and_inflight_expression.snap index d5c71bbb447..b61054c3b05 100644 --- a/libs/wingc/src/jsify/snapshots/lift_binary_preflight_and_inflight_expression.snap +++ b/libs/wingc/src/jsify/snapshots/lift_binary_preflight_and_inflight_expression.snap @@ -45,6 +45,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/lift_binary_preflight_expression.snap b/libs/wingc/src/jsify/snapshots/lift_binary_preflight_expression.snap index 9c957fd8118..229498fdb1d 100644 --- a/libs/wingc/src/jsify/snapshots/lift_binary_preflight_expression.snap +++ b/libs/wingc/src/jsify/snapshots/lift_binary_preflight_expression.snap @@ -44,6 +44,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/lift_element_from_collection_as_field.snap b/libs/wingc/src/jsify/snapshots/lift_element_from_collection_as_field.snap index cbd1733bd1c..59d6f850c32 100644 --- a/libs/wingc/src/jsify/snapshots/lift_element_from_collection_as_field.snap +++ b/libs/wingc/src/jsify/snapshots/lift_element_from_collection_as_field.snap @@ -48,6 +48,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/lift_element_from_collection_of_objects.snap b/libs/wingc/src/jsify/snapshots/lift_element_from_collection_of_objects.snap index d797a0bbf83..37fe1a105b4 100644 --- a/libs/wingc/src/jsify/snapshots/lift_element_from_collection_of_objects.snap +++ b/libs/wingc/src/jsify/snapshots/lift_element_from_collection_of_objects.snap @@ -45,6 +45,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/lift_inflight_closure.snap b/libs/wingc/src/jsify/snapshots/lift_inflight_closure.snap index c375f852046..28b88a5ba27 100644 --- a/libs/wingc/src/jsify/snapshots/lift_inflight_closure.snap +++ b/libs/wingc/src/jsify/snapshots/lift_inflight_closure.snap @@ -64,6 +64,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/lift_inside_preflight_method.snap b/libs/wingc/src/jsify/snapshots/lift_inside_preflight_method.snap index 28408483766..c150b3628a6 100644 --- a/libs/wingc/src/jsify/snapshots/lift_inside_preflight_method.snap +++ b/libs/wingc/src/jsify/snapshots/lift_inside_preflight_method.snap @@ -69,6 +69,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/lift_self_reference.snap b/libs/wingc/src/jsify/snapshots/lift_self_reference.snap index 03f5e01ff46..a7b5c6332a4 100644 --- a/libs/wingc/src/jsify/snapshots/lift_self_reference.snap +++ b/libs/wingc/src/jsify/snapshots/lift_self_reference.snap @@ -45,6 +45,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/lift_string.snap b/libs/wingc/src/jsify/snapshots/lift_string.snap index 55c8fe32c2e..72b030f22ac 100644 --- a/libs/wingc/src/jsify/snapshots/lift_string.snap +++ b/libs/wingc/src/jsify/snapshots/lift_string.snap @@ -43,6 +43,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/lift_this.snap b/libs/wingc/src/jsify/snapshots/lift_this.snap index 4e8b9d0918e..6ab8730b88c 100644 --- a/libs/wingc/src/jsify/snapshots/lift_this.snap +++ b/libs/wingc/src/jsify/snapshots/lift_this.snap @@ -81,6 +81,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/lift_var_with_this.snap b/libs/wingc/src/jsify/snapshots/lift_var_with_this.snap index 991066e2c28..1274cd10e3a 100644 --- a/libs/wingc/src/jsify/snapshots/lift_var_with_this.snap +++ b/libs/wingc/src/jsify/snapshots/lift_var_with_this.snap @@ -64,6 +64,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/lift_via_closure.snap b/libs/wingc/src/jsify/snapshots/lift_via_closure.snap index 7769bb360b5..c2031ed3b27 100644 --- a/libs/wingc/src/jsify/snapshots/lift_via_closure.snap +++ b/libs/wingc/src/jsify/snapshots/lift_via_closure.snap @@ -71,6 +71,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/lift_via_closure_class_explicit.snap b/libs/wingc/src/jsify/snapshots/lift_via_closure_class_explicit.snap index e13d1a9134e..460441dd0a4 100644 --- a/libs/wingc/src/jsify/snapshots/lift_via_closure_class_explicit.snap +++ b/libs/wingc/src/jsify/snapshots/lift_via_closure_class_explicit.snap @@ -86,6 +86,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/namespaced_static_from_inflight.snap b/libs/wingc/src/jsify/snapshots/namespaced_static_from_inflight.snap index f4a4bcc8b0b..d7c67b36828 100644 --- a/libs/wingc/src/jsify/snapshots/namespaced_static_from_inflight.snap +++ b/libs/wingc/src/jsify/snapshots/namespaced_static_from_inflight.snap @@ -43,6 +43,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const util = $stdlib.util; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/nested_inflight_after_preflight_operation.snap b/libs/wingc/src/jsify/snapshots/nested_inflight_after_preflight_operation.snap index 2c116eabbad..2c771b0b1f7 100644 --- a/libs/wingc/src/jsify/snapshots/nested_inflight_after_preflight_operation.snap +++ b/libs/wingc/src/jsify/snapshots/nested_inflight_after_preflight_operation.snap @@ -70,6 +70,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/nested_preflight_operation.snap b/libs/wingc/src/jsify/snapshots/nested_preflight_operation.snap index 8930643a1b4..91257bfd431 100644 --- a/libs/wingc/src/jsify/snapshots/nested_preflight_operation.snap +++ b/libs/wingc/src/jsify/snapshots/nested_preflight_operation.snap @@ -88,6 +88,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/new_inflight_object.snap b/libs/wingc/src/jsify/snapshots/new_inflight_object.snap index 6f5f44da712..4c0fcdbb3da 100644 --- a/libs/wingc/src/jsify/snapshots/new_inflight_object.snap +++ b/libs/wingc/src/jsify/snapshots/new_inflight_object.snap @@ -57,6 +57,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/no_capture_inside_methods.snap b/libs/wingc/src/jsify/snapshots/no_capture_inside_methods.snap index 4863901fe1a..c053dcae157 100644 --- a/libs/wingc/src/jsify/snapshots/no_capture_inside_methods.snap +++ b/libs/wingc/src/jsify/snapshots/no_capture_inside_methods.snap @@ -48,6 +48,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/no_capture_of_identifier_from_inner_scope.snap b/libs/wingc/src/jsify/snapshots/no_capture_of_identifier_from_inner_scope.snap index a69231e3d13..d3992988748 100644 --- a/libs/wingc/src/jsify/snapshots/no_capture_of_identifier_from_inner_scope.snap +++ b/libs/wingc/src/jsify/snapshots/no_capture_of_identifier_from_inner_scope.snap @@ -48,6 +48,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/no_capture_of_identifier_from_same_scope.snap b/libs/wingc/src/jsify/snapshots/no_capture_of_identifier_from_same_scope.snap index 70387025e2a..8c96fb27ae5 100644 --- a/libs/wingc/src/jsify/snapshots/no_capture_of_identifier_from_same_scope.snap +++ b/libs/wingc/src/jsify/snapshots/no_capture_of_identifier_from_same_scope.snap @@ -44,6 +44,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/no_capture_shadow_inside_inner_scopes.snap b/libs/wingc/src/jsify/snapshots/no_capture_shadow_inside_inner_scopes.snap index b9149892590..54db26e1554 100644 --- a/libs/wingc/src/jsify/snapshots/no_capture_shadow_inside_inner_scopes.snap +++ b/libs/wingc/src/jsify/snapshots/no_capture_shadow_inside_inner_scopes.snap @@ -56,6 +56,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/no_lift_shadow_inside_inner_scopes.snap b/libs/wingc/src/jsify/snapshots/no_lift_shadow_inside_inner_scopes.snap index b9173e367f5..5b6c9f12da8 100644 --- a/libs/wingc/src/jsify/snapshots/no_lift_shadow_inside_inner_scopes.snap +++ b/libs/wingc/src/jsify/snapshots/no_lift_shadow_inside_inner_scopes.snap @@ -54,6 +54,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/preflight_class_extends_preflight_class.snap b/libs/wingc/src/jsify/snapshots/preflight_class_extends_preflight_class.snap index 19d49aa27c8..f8df6a1e343 100644 --- a/libs/wingc/src/jsify/snapshots/preflight_class_extends_preflight_class.snap +++ b/libs/wingc/src/jsify/snapshots/preflight_class_extends_preflight_class.snap @@ -51,6 +51,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/preflight_collection.snap b/libs/wingc/src/jsify/snapshots/preflight_collection.snap index f3eaa59f8d9..ed8aef1fd41 100644 --- a/libs/wingc/src/jsify/snapshots/preflight_collection.snap +++ b/libs/wingc/src/jsify/snapshots/preflight_collection.snap @@ -45,6 +45,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/preflight_collection_of_preflight_objects.snap b/libs/wingc/src/jsify/snapshots/preflight_collection_of_preflight_objects.snap index 6d17bf85a05..4a31a7a6eaa 100644 --- a/libs/wingc/src/jsify/snapshots/preflight_collection_of_preflight_objects.snap +++ b/libs/wingc/src/jsify/snapshots/preflight_collection_of_preflight_objects.snap @@ -49,6 +49,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/preflight_nested_object_with_operations.snap b/libs/wingc/src/jsify/snapshots/preflight_nested_object_with_operations.snap index ca082be10c9..d1f4f50769d 100644 --- a/libs/wingc/src/jsify/snapshots/preflight_nested_object_with_operations.snap +++ b/libs/wingc/src/jsify/snapshots/preflight_nested_object_with_operations.snap @@ -67,6 +67,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/preflight_object.snap b/libs/wingc/src/jsify/snapshots/preflight_object.snap index 26112755497..c7d6b9c02a2 100644 --- a/libs/wingc/src/jsify/snapshots/preflight_object.snap +++ b/libs/wingc/src/jsify/snapshots/preflight_object.snap @@ -68,6 +68,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/preflight_object_through_property.snap b/libs/wingc/src/jsify/snapshots/preflight_object_through_property.snap index 70e1030b575..73ae66c5d8a 100644 --- a/libs/wingc/src/jsify/snapshots/preflight_object_through_property.snap +++ b/libs/wingc/src/jsify/snapshots/preflight_object_through_property.snap @@ -68,6 +68,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/preflight_object_with_operations.snap b/libs/wingc/src/jsify/snapshots/preflight_object_with_operations.snap index cff84ad7b47..3118c933228 100644 --- a/libs/wingc/src/jsify/snapshots/preflight_object_with_operations.snap +++ b/libs/wingc/src/jsify/snapshots/preflight_object_with_operations.snap @@ -46,6 +46,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/preflight_object_with_operations_multiple_methods.snap b/libs/wingc/src/jsify/snapshots/preflight_object_with_operations_multiple_methods.snap index d5eb108c075..30684d0011d 100644 --- a/libs/wingc/src/jsify/snapshots/preflight_object_with_operations_multiple_methods.snap +++ b/libs/wingc/src/jsify/snapshots/preflight_object_with_operations_multiple_methods.snap @@ -51,6 +51,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/preflight_value_field.snap b/libs/wingc/src/jsify/snapshots/preflight_value_field.snap index bef89baaa21..9a150a8c71d 100644 --- a/libs/wingc/src/jsify/snapshots/preflight_value_field.snap +++ b/libs/wingc/src/jsify/snapshots/preflight_value_field.snap @@ -73,6 +73,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/read_primitive_value.snap b/libs/wingc/src/jsify/snapshots/read_primitive_value.snap index 52b554067d8..774da98ff7f 100644 --- a/libs/wingc/src/jsify/snapshots/read_primitive_value.snap +++ b/libs/wingc/src/jsify/snapshots/read_primitive_value.snap @@ -44,6 +44,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/reassign_captured_variable.snap b/libs/wingc/src/jsify/snapshots/reassign_captured_variable.snap index 74136f94211..cdab8211e67 100644 --- a/libs/wingc/src/jsify/snapshots/reassign_captured_variable.snap +++ b/libs/wingc/src/jsify/snapshots/reassign_captured_variable.snap @@ -53,6 +53,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/reassigned_captured_variable_preflight.snap b/libs/wingc/src/jsify/snapshots/reassigned_captured_variable_preflight.snap index 6d47722eefa..bbde03ffe57 100644 --- a/libs/wingc/src/jsify/snapshots/reassigned_captured_variable_preflight.snap +++ b/libs/wingc/src/jsify/snapshots/reassigned_captured_variable_preflight.snap @@ -22,6 +22,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/ref_std_macro.snap b/libs/wingc/src/jsify/snapshots/ref_std_macro.snap index dd566854678..a93b8f453cd 100644 --- a/libs/wingc/src/jsify/snapshots/ref_std_macro.snap +++ b/libs/wingc/src/jsify/snapshots/ref_std_macro.snap @@ -44,6 +44,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/reference_from_static_inflight.snap b/libs/wingc/src/jsify/snapshots/reference_from_static_inflight.snap index b30970ac942..b4e479c49bf 100644 --- a/libs/wingc/src/jsify/snapshots/reference_from_static_inflight.snap +++ b/libs/wingc/src/jsify/snapshots/reference_from_static_inflight.snap @@ -43,6 +43,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/reference_inflight_class.snap b/libs/wingc/src/jsify/snapshots/reference_inflight_class.snap index 394078aff8a..7037afed5fc 100644 --- a/libs/wingc/src/jsify/snapshots/reference_inflight_class.snap +++ b/libs/wingc/src/jsify/snapshots/reference_inflight_class.snap @@ -62,6 +62,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/reference_inflight_field.snap b/libs/wingc/src/jsify/snapshots/reference_inflight_field.snap index 85644fb5d70..28ee4f47cc6 100644 --- a/libs/wingc/src/jsify/snapshots/reference_inflight_field.snap +++ b/libs/wingc/src/jsify/snapshots/reference_inflight_field.snap @@ -50,6 +50,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/reference_inflight_from_inflight.snap b/libs/wingc/src/jsify/snapshots/reference_inflight_from_inflight.snap index 9c5046bb2a4..6ddf585201a 100644 --- a/libs/wingc/src/jsify/snapshots/reference_inflight_from_inflight.snap +++ b/libs/wingc/src/jsify/snapshots/reference_inflight_from_inflight.snap @@ -74,6 +74,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/reference_lift_of_collection.snap b/libs/wingc/src/jsify/snapshots/reference_lift_of_collection.snap index be6bd56a5d9..4baa0e5b574 100644 --- a/libs/wingc/src/jsify/snapshots/reference_lift_of_collection.snap +++ b/libs/wingc/src/jsify/snapshots/reference_lift_of_collection.snap @@ -44,6 +44,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/reference_preflight_field.snap b/libs/wingc/src/jsify/snapshots/reference_preflight_field.snap index 29e8e14fcd5..6d418fe4b67 100644 --- a/libs/wingc/src/jsify/snapshots/reference_preflight_field.snap +++ b/libs/wingc/src/jsify/snapshots/reference_preflight_field.snap @@ -48,6 +48,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/reference_preflight_field_call_independent_method.snap b/libs/wingc/src/jsify/snapshots/reference_preflight_field_call_independent_method.snap index 0f2a212a546..54249a94fc6 100644 --- a/libs/wingc/src/jsify/snapshots/reference_preflight_field_call_independent_method.snap +++ b/libs/wingc/src/jsify/snapshots/reference_preflight_field_call_independent_method.snap @@ -48,6 +48,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/reference_preflight_fields.snap b/libs/wingc/src/jsify/snapshots/reference_preflight_fields.snap index 26a0e5477ee..cabd4783e02 100644 --- a/libs/wingc/src/jsify/snapshots/reference_preflight_fields.snap +++ b/libs/wingc/src/jsify/snapshots/reference_preflight_fields.snap @@ -64,6 +64,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/reference_preflight_free_variable_with_this_in_the_expression.snap b/libs/wingc/src/jsify/snapshots/reference_preflight_free_variable_with_this_in_the_expression.snap index c9196b3504f..f7b74ca97e8 100644 --- a/libs/wingc/src/jsify/snapshots/reference_preflight_free_variable_with_this_in_the_expression.snap +++ b/libs/wingc/src/jsify/snapshots/reference_preflight_free_variable_with_this_in_the_expression.snap @@ -51,6 +51,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/reference_preflight_object_from_static_inflight.snap b/libs/wingc/src/jsify/snapshots/reference_preflight_object_from_static_inflight.snap index b2feda3091d..bee06339319 100644 --- a/libs/wingc/src/jsify/snapshots/reference_preflight_object_from_static_inflight.snap +++ b/libs/wingc/src/jsify/snapshots/reference_preflight_object_from_static_inflight.snap @@ -45,6 +45,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/reference_static_inflight.snap b/libs/wingc/src/jsify/snapshots/reference_static_inflight.snap index 5eb1c539cf5..39e5714deae 100644 --- a/libs/wingc/src/jsify/snapshots/reference_static_inflight.snap +++ b/libs/wingc/src/jsify/snapshots/reference_static_inflight.snap @@ -64,6 +64,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/reference_static_inflight_which_references_preflight_object.snap b/libs/wingc/src/jsify/snapshots/reference_static_inflight_which_references_preflight_object.snap index 5e87173a8ab..5fe4ab94cc7 100644 --- a/libs/wingc/src/jsify/snapshots/reference_static_inflight_which_references_preflight_object.snap +++ b/libs/wingc/src/jsify/snapshots/reference_static_inflight_which_references_preflight_object.snap @@ -72,6 +72,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/static_external_inflight_class.snap b/libs/wingc/src/jsify/snapshots/static_external_inflight_class.snap index f974c6dfd65..1478a64ae25 100644 --- a/libs/wingc/src/jsify/snapshots/static_external_inflight_class.snap +++ b/libs/wingc/src/jsify/snapshots/static_external_inflight_class.snap @@ -73,6 +73,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/static_external_preflight_class.snap b/libs/wingc/src/jsify/snapshots/static_external_preflight_class.snap index fe8ae847019..6bdecac309e 100644 --- a/libs/wingc/src/jsify/snapshots/static_external_preflight_class.snap +++ b/libs/wingc/src/jsify/snapshots/static_external_preflight_class.snap @@ -72,6 +72,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/static_inflight_operation.snap b/libs/wingc/src/jsify/snapshots/static_inflight_operation.snap index 5d911340906..a3afeeb210c 100644 --- a/libs/wingc/src/jsify/snapshots/static_inflight_operation.snap +++ b/libs/wingc/src/jsify/snapshots/static_inflight_operation.snap @@ -69,6 +69,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/static_local_inflight_class.snap b/libs/wingc/src/jsify/snapshots/static_local_inflight_class.snap index 2c94619be60..ddd7d0bbc12 100644 --- a/libs/wingc/src/jsify/snapshots/static_local_inflight_class.snap +++ b/libs/wingc/src/jsify/snapshots/static_local_inflight_class.snap @@ -64,6 +64,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/static_on_std_type.snap b/libs/wingc/src/jsify/snapshots/static_on_std_type.snap index 14ba099d752..cddb49b66f0 100644 --- a/libs/wingc/src/jsify/snapshots/static_on_std_type.snap +++ b/libs/wingc/src/jsify/snapshots/static_on_std_type.snap @@ -44,6 +44,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/transitive_reference.snap b/libs/wingc/src/jsify/snapshots/transitive_reference.snap index d21bb552d2f..847626e2f23 100644 --- a/libs/wingc/src/jsify/snapshots/transitive_reference.snap +++ b/libs/wingc/src/jsify/snapshots/transitive_reference.snap @@ -87,6 +87,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/transitive_reference_via_inflight_class.snap b/libs/wingc/src/jsify/snapshots/transitive_reference_via_inflight_class.snap index 288231de5d6..4d646d3361c 100644 --- a/libs/wingc/src/jsify/snapshots/transitive_reference_via_inflight_class.snap +++ b/libs/wingc/src/jsify/snapshots/transitive_reference_via_inflight_class.snap @@ -70,6 +70,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/transitive_reference_via_static.snap b/libs/wingc/src/jsify/snapshots/transitive_reference_via_static.snap index 8097888c573..6360ecad233 100644 --- a/libs/wingc/src/jsify/snapshots/transitive_reference_via_static.snap +++ b/libs/wingc/src/jsify/snapshots/transitive_reference_via_static.snap @@ -95,6 +95,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/two_identical_lifts.snap b/libs/wingc/src/jsify/snapshots/two_identical_lifts.snap index 5dba110e736..bc7e393332e 100644 --- a/libs/wingc/src/jsify/snapshots/two_identical_lifts.snap +++ b/libs/wingc/src/jsify/snapshots/two_identical_lifts.snap @@ -52,6 +52,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/use_util_functions.snap b/libs/wingc/src/jsify/snapshots/use_util_functions.snap index f88ba55e210..85f8f9563f2 100644 --- a/libs/wingc/src/jsify/snapshots/use_util_functions.snap +++ b/libs/wingc/src/jsify/snapshots/use_util_functions.snap @@ -42,6 +42,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const util = $stdlib.util; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingc/src/jsify/snapshots/var_inflight_field_from_inflight.snap b/libs/wingc/src/jsify/snapshots/var_inflight_field_from_inflight.snap index 3213b63361b..d0e74b4002d 100644 --- a/libs/wingc/src/jsify/snapshots/var_inflight_field_from_inflight.snap +++ b/libs/wingc/src/jsify/snapshots/var_inflight_field_from_inflight.snap @@ -50,6 +50,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/libs/wingc/src/jsify/snapshots/wait_util.snap b/libs/wingc/src/jsify/snapshots/wait_util.snap index d2fc706d4f8..e2f23baff21 100644 --- a/libs/wingc/src/jsify/snapshots/wait_util.snap +++ b/libs/wingc/src/jsify/snapshots/wait_util.snap @@ -49,6 +49,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const util = $stdlib.util; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/libs/wingcompiler/.npmignore b/libs/wingcompiler/.npmignore deleted file mode 100644 index dae619c8be8..00000000000 --- a/libs/wingcompiler/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -wasm/.gitkeep -scripts -*.tgz diff --git a/libs/wingcompiler/jest.config.js b/libs/wingcompiler/jest.config.js deleted file mode 100644 index 530ebab9e2c..00000000000 --- a/libs/wingcompiler/jest.config.js +++ /dev/null @@ -1,6 +0,0 @@ -/** @type {import('ts-jest').JestConfigWithTsJest} */ -module.exports = { - preset: "ts-jest", - testEnvironment: "node", - testMatch: ["**/*.test.ts"], -}; diff --git a/libs/wingcompiler/package.json b/libs/wingcompiler/package.json index d73d3ec731b..c428369bbcc 100644 --- a/libs/wingcompiler/package.json +++ b/libs/wingcompiler/package.json @@ -4,6 +4,7 @@ "description": "Wing Compiler", "files": [ "wingc.wasm", + "preflight.shim.cjs", "dist/" ], "license": "MIT", @@ -23,8 +24,9 @@ "package": "bump-pack -b" }, "dependencies": { - "@winglang/sdk": "workspace:^", "@wingcloud/framework": "workspace:^", + "@winglang/sdk": "workspace:^", + "jiti": "^1.21.0", "wasi-js": "^1.7.3" }, "bundledDependencies": [ diff --git a/libs/wingcompiler/preflight.shim.cjs b/libs/wingcompiler/preflight.shim.cjs new file mode 100644 index 00000000000..67f05f9862f --- /dev/null +++ b/libs/wingcompiler/preflight.shim.cjs @@ -0,0 +1,51 @@ +/// This serves as the preflight execution entrypoint to set up the following behaviors +/// 1. Override module resolution to force @winglang/sdk to always resolve to the same path +/// 2. Handle communication with parent process to handle errors and load the true entrypoint +/// +/// This file has the following expectations: +/// 1. The environment variable WING_PREFLIGHT_ENTRYPOINT is a JSON string of the entrypoint to load +/// 2. Runs in a child process with an IPC channel to the parent process + +process.setUncaughtExceptionCaptureCallback((reason) => { + if (reason instanceof Error) { + // The Error object does not serialize well over IPC (even with 'advanced' serialization) + // So we extract the properties we need to recreate most error objects + reason = { + message: reason.message, + stack: reason.stack, + name: reason.name, + code: reason.code, + }; + } + process.send(reason); +}); + +if (!process.send) { + throw new Error( + "process.send is undefined. This file should only be run in a child process with an IPC connection to the parent." + ); +} + +var Module = require("module"); +const { join } = require("path"); +const original_resolveFilename = Module._resolveFilename; +const WINGSDK = "@winglang/sdk"; +const WINGSDK_PATH = require.resolve(WINGSDK); +const WINGSDK_DIR = join(WINGSDK_PATH, "..", ".."); + +Module._resolveFilename = function () { + const path = arguments[0]; + if (path === WINGSDK) return WINGSDK_PATH; + if (path.startsWith(WINGSDK)) { + arguments[0] = path.replace(WINGSDK, WINGSDK_DIR); + } + return original_resolveFilename.apply(this, arguments); +}; + +if (!process.env.WING_PREFLIGHT_ENTRYPOINT) { + throw new Error("Missing environment variable WING_PREFLIGHT_ENTRYPOINT"); +} +const entrypoint = JSON.parse(process.env.WING_PREFLIGHT_ENTRYPOINT); +delete process.env.WING_PREFLIGHT_ENTRYPOINT; + +require(entrypoint); diff --git a/libs/wingcompiler/src/compile.ts b/libs/wingcompiler/src/compile.ts index 55be562faf0..803acae2a92 100644 --- a/libs/wingcompiler/src/compile.ts +++ b/libs/wingcompiler/src/compile.ts @@ -7,8 +7,8 @@ import { normalPath } from "./util"; import { existsSync } from "fs"; import { BuiltinPlatform } from "./constants"; import { CompileError, PreflightError } from "./errors"; -import { Worker } from "worker_threads"; import { readFile } from "fs/promises"; +import { fork } from "child_process"; // increase the stack trace limit to 50, useful for debugging Rust panics // (not setting the limit too high in case of infinite recursion) @@ -184,7 +184,8 @@ export async function compile(entrypoint: string, options: CompileOptions): Prom WING_VALUES: options.value?.length == 0 ? undefined : options.value, WING_VALUES_FILE: options.values ?? defaultValuesFile(), WING_NODE_MODULES: wingNodeModules, - WING_IMPORTED_NAMESPACES: compileForPreflightResult.compilerOutput?.imported_namespaces.join(";"), + WING_IMPORTED_NAMESPACES: + compileForPreflightResult.compilerOutput?.imported_namespaces.join(";"), }; if (options.rootId) { @@ -201,7 +202,10 @@ export async function compile(entrypoint: string, options: CompileOptions): Prom delete preflightEnv.Path; } } - await runPreflightCodeInWorkerThread(compileForPreflightResult.preflightEntrypoint, preflightEnv); + await runPreflightCodeInWorkerThread( + compileForPreflightResult.preflightEntrypoint, + preflightEnv + ); } return synthDir; } @@ -221,7 +225,7 @@ interface CompileForPreflightResult { readonly preflightEntrypoint: string; readonly compilerOutput?: { imported_namespaces: string[]; - } + }; } async function compileForPreflight(props: { @@ -248,8 +252,8 @@ npm i @wingcloud/framework preflightEntrypoint: await typescriptFramework.compile({ workDir: props.workDir, entrypoint: props.entrypointFile, - }) - } + }), + }; } else { let env: Record = { RUST_BACKTRACE: "full", @@ -301,22 +305,20 @@ npm i @wingcloud/framework return { preflightEntrypoint: join(props.workDir, WINGC_PREFLIGHT), - compilerOutput: JSON.parse( - compilerOutput as string - ), - } + compilerOutput: JSON.parse(compilerOutput as string), + }; } } /** * Check if in the current working directory there is a default values file - * only the first match is returned from the list of default values files - * + * only the first match is returned from the list of default values files + * * @returns default values file from the current working directory */ function defaultValuesFile() { - const defaultConfigs = [ "wing.toml", "wing.yaml", "wing.yml", "wing.json"] - + const defaultConfigs = ["wing.toml", "wing.yaml", "wing.yml", "wing.json"]; + for (const configFile of defaultConfigs) { if (existsSync(join(process.cwd(), configFile))) { return configFile; @@ -330,32 +332,14 @@ async function runPreflightCodeInWorkerThread( env: Record ): Promise { try { - // Create a shimmed entrypoint that ensures we always load the compiler's version of the SDK - const sdkEntrypoint = require.resolve("@winglang/sdk"); - const shim = `\ -var Module = require('module'); -var original_resolveFilename = Module._resolveFilename; -var WINGSDK = '@winglang/sdk'; -var WINGSDK_PATH = '${normalPath(sdkEntrypoint)}'; -var WINGSDK_DIR = '${normalPath(join(sdkEntrypoint, "..", ".."))}'; - -Module._resolveFilename = function () { - const path = arguments[0]; - if(path === WINGSDK) return WINGSDK_PATH; - if(path.startsWith(WINGSDK)){ - arguments[0] = path.replace(WINGSDK, WINGSDK_DIR); - } - return original_resolveFilename.apply(this, arguments); -}; - -require('${normalPath(entrypoint)}'); -`; + env.WING_PREFLIGHT_ENTRYPOINT = JSON.stringify(entrypoint); await new Promise((resolve, reject) => { - const worker = new Worker(shim, { + const worker = fork(join(__dirname, "..", "preflight.shim.cjs"), { env, - eval: true, + stdio: "inherit", }); + worker.on("message", reject); worker.on("error", reject); worker.on("exit", (code) => { if (code === 0) { diff --git a/libs/wingsdk/.projen/deps.json b/libs/wingsdk/.projen/deps.json index 564972961e0..0cc97fca607 100644 --- a/libs/wingsdk/.projen/deps.json +++ b/libs/wingsdk/.projen/deps.json @@ -295,6 +295,10 @@ "name": "ioredis", "type": "bundled" }, + { + "name": "jiti", + "type": "bundled" + }, { "name": "mime-types", "type": "bundled" diff --git a/libs/wingsdk/.projenrc.ts b/libs/wingsdk/.projenrc.ts index addde8d41b3..f3433a92daa 100644 --- a/libs/wingsdk/.projenrc.ts +++ b/libs/wingsdk/.projenrc.ts @@ -43,6 +43,7 @@ const project = new cdk.JsiiProject({ ...sideLoad, // preflight dependencies "safe-stable-stringify", + "jiti", // aws sdk client dependencies // change `AWS_SDK_VERSION` to update all deps at once "@aws-sdk/client-cloudwatch-logs", diff --git a/libs/wingsdk/package.json b/libs/wingsdk/package.json index 10afc75f260..989cba997b2 100644 --- a/libs/wingsdk/package.json +++ b/libs/wingsdk/package.json @@ -107,6 +107,7 @@ "glob": "^8.1.0", "google-auth-library": "^8.9.0", "ioredis": "^5.3.2", + "jiti": "^1.21.0", "mime": "^3.0.0", "mime-types": "^2.1.35", "nanoid": "^3.3.6", @@ -148,6 +149,7 @@ "glob", "google-auth-library", "ioredis", + "jiti", "mime", "mime-types", "nanoid", diff --git a/libs/wingsdk/src/helpers.ts b/libs/wingsdk/src/helpers.ts index a565c8d369e..294e5a69c45 100644 --- a/libs/wingsdk/src/helpers.ts +++ b/libs/wingsdk/src/helpers.ts @@ -2,7 +2,7 @@ // so avoid importing anything heavy here. import { deepStrictEqual, notDeepStrictEqual } from "node:assert"; import type { Construct } from "constructs"; -import { Node } from "./std/node"; +import type { Node } from "./std/node"; export function eq(a: any, b: any): boolean { try { @@ -39,6 +39,8 @@ export function range(start: number, end: number, inclusive: boolean) { } export function nodeof(construct: Construct): Node { + // Should only be used preflight, avoid bundling + const Node = eval("require('./std/node').Node"); return Node.of(construct); } @@ -52,3 +54,25 @@ export function unwrap(value: T): T | never { } throw new Error("Unexpected nil"); } + +export function createExternRequire(dirname: string) { + return (externPath: string) => { + // using eval to always avoid bundling + const jiti: typeof import("jiti").default = eval("require('jiti')"); + const esbuild: typeof import("esbuild") = eval("require('esbuild')"); + + const newRequire = jiti(dirname, { + sourceMaps: true, + interopDefault: true, + transform(opts) { + return esbuild.transformSync(opts.source, { + format: "cjs", + target: "node20", + sourcemap: "inline", + loader: opts.ts ? "ts" : "js", + }); + }, + }); + return newRequire(externPath); + }; +} diff --git a/libs/wingsdk/src/target-sim/queue.inflight.ts b/libs/wingsdk/src/target-sim/queue.inflight.ts index 1194565aac3..ade75198fb6 100644 --- a/libs/wingsdk/src/target-sim/queue.inflight.ts +++ b/libs/wingsdk/src/target-sim/queue.inflight.ts @@ -40,6 +40,7 @@ export class Queue public async init(context: ISimulatorContext): Promise { this._context = context; + await this.processLoop.start(); return {}; } @@ -274,6 +275,7 @@ class RandomArrayIterator implements Iterable { interface LoopController { stop(): Promise; + start(): Promise; } /** @@ -318,8 +320,10 @@ function runEvery(interval: number, fn: () => Promise): LoopController { await stopPromise; // wait for the loop to finish } }, + async start() { + void loop(); + }, }; - void loop(); // start the loop return controller; } diff --git a/libs/wingsdk/src/target-sim/queue.ts b/libs/wingsdk/src/target-sim/queue.ts index 44629ef679f..006482ad3ac 100644 --- a/libs/wingsdk/src/target-sim/queue.ts +++ b/libs/wingsdk/src/target-sim/queue.ts @@ -25,6 +25,7 @@ export class Queue extends cloud.Queue implements ISimulatorResource { private readonly timeout: Duration; private readonly retentionPeriod: Duration; private readonly policy: Policy; + constructor(scope: Construct, id: string, props: cloud.QueueProps = {}) { super(scope, id, props); @@ -99,28 +100,34 @@ export class Queue extends cloud.Queue implements ISimulatorResource { functionHandler, props ); - Node.of(fn).sourceModule = SDK_SOURCE_MODULE; - Node.of(fn).title = "setConsumer()"; - - new EventMapping(this, App.of(this).makeId(this, "QueueEventMapping"), { - subscriber: fn, - publisher: this, - subscriptionProps: { - batchSize: props.batchSize ?? 1, - }, - }); + const fnNode = Node.of(fn); + fnNode.sourceModule = SDK_SOURCE_MODULE; + fnNode.title = "setConsumer()"; - Node.of(this).addConnection({ - source: this, - target: fn, - name: "setConsumer()", - }); + const mapping = new EventMapping( + this, + App.of(this).makeId(this, "QueueEventMapping"), + { + subscriber: fn, + publisher: this, + subscriptionProps: { + batchSize: props.batchSize ?? 1, + }, + } + ); this.policy.addStatement(fn, cloud.FunctionInflightMethods.INVOKE); this.policy.addStatement( fn, SimFunctionInflightMethods.HAS_AVAILABLE_WORKERS ); + mapping.node.addDependency(this.policy); + + Node.of(this).addConnection({ + source: this, + target: fn, + name: "setConsumer()", + }); return fn; } diff --git a/libs/wingsdk/test/target-sim/__snapshots__/file-counter.test.ts.snap b/libs/wingsdk/test/target-sim/__snapshots__/file-counter.test.ts.snap index 1b2fbb977f8..93adf669b67 100644 --- a/libs/wingsdk/test/target-sim/__snapshots__/file-counter.test.ts.snap +++ b/libs/wingsdk/test/target-sim/__snapshots__/file-counter.test.ts.snap @@ -133,6 +133,7 @@ bucket: (function() { "deps": [ "root/HelloWorld/Queue/SetConsumer0", "root/HelloWorld/Queue", + "root/HelloWorld/Queue/Policy", ], "path": "root/HelloWorld/Queue/QueueEventMapping0", "props": { diff --git a/libs/wingsdk/test/target-sim/__snapshots__/queue.test.ts.snap b/libs/wingsdk/test/target-sim/__snapshots__/queue.test.ts.snap index 88bbb93bad7..5f51f79992c 100644 --- a/libs/wingsdk/test/target-sim/__snapshots__/queue.test.ts.snap +++ b/libs/wingsdk/test/target-sim/__snapshots__/queue.test.ts.snap @@ -1048,6 +1048,7 @@ async handle(message) { "deps": [ "root/my_queue/SetConsumer0", "root/my_queue", + "root/my_queue/Policy", ], "path": "root/my_queue/QueueEventMapping0", "props": { @@ -1353,6 +1354,7 @@ async handle(message) { "deps": [ "root/my_queue/SetConsumer0", "root/my_queue", + "root/my_queue/Policy", ], "path": "root/my_queue/QueueEventMapping0", "props": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2eb9ec79869..03e3aa655bd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1227,6 +1227,9 @@ importers: '@winglang/sdk': specifier: workspace:^ version: link:../wingsdk + jiti: + specifier: ^1.21.0 + version: 1.21.0 wasi-js: specifier: ^1.7.3 version: 1.7.3(patch_hash=rmwvp46j2ligfusbdx5dzh4a3q) @@ -1344,6 +1347,9 @@ importers: ioredis: specifier: ^5.3.2 version: 5.3.2 + jiti: + specifier: ^1.21.0 + version: 1.21.0 mime: specifier: ^3.0.0 version: 3.0.0(patch_hash=2he2uszztbibyal6zfzmv2a2oa) @@ -12691,7 +12697,7 @@ packages: defu: 6.1.2 dotenv: 16.3.1 giget: 1.1.3 - jiti: 1.20.0 + jiti: 1.21.0 mlly: 1.4.2 ohash: 1.1.3 pathe: 1.1.1 @@ -14194,7 +14200,7 @@ packages: dependencies: semver: 7.5.4 shelljs: 0.8.5 - typescript: 5.5.0-dev.20240410 + typescript: 5.5.0-dev.20240412 dev: true /dset@3.1.2: @@ -17451,8 +17457,8 @@ packages: supports-color: 8.1.1 dev: true - /jiti@1.20.0: - resolution: {integrity: sha512-3TV69ZbrvV6U5DfQimop50jE9Dl6J8O1ja1dvBbMba/sZ3YBEQqJ2VZRoQPVnhlzjNtU1vaXRZVrVjU4qtm8yA==} + /jiti@1.21.0: + resolution: {integrity: sha512-gFqAIbuKyyso/3G2qhiO2OM6shY6EPP/R0+mkDbyspxKazh8BXDC5FiFsUjlczgdNz/vfra0da2y+aHrusLG/Q==} hasBin: true /joycon@3.1.1: @@ -22031,7 +22037,7 @@ packages: fast-glob: 3.3.1 glob-parent: 6.0.2 is-glob: 4.0.3 - jiti: 1.20.0 + jiti: 1.21.0 lilconfig: 2.1.0 micromatch: 4.0.5 normalize-path: 3.0.0 @@ -22803,8 +22809,8 @@ packages: engines: {node: '>=14.17'} hasBin: true - /typescript@5.5.0-dev.20240410: - resolution: {integrity: sha512-OvGiFb8iPBHHqR8RuhIeCM+j2W1TtPbTZLuesCEi4gulAxzkOP2B3jDPTWmcOmxvUeJN5pNzlKoi/reRn1BZww==} + /typescript@5.5.0-dev.20240412: + resolution: {integrity: sha512-DfE8jAzZf9/FHHo0CMnIL6uFZ6Q1bJ4PCtpBd9Ytbfi0pRREKVJofJEHFbRXADT6Kq1twB4iiqvdc/rGbiBq7g==} engines: {node: '>=14.17'} hasBin: true dev: true diff --git a/tools/hangar/__snapshots__/invalid.ts.snap b/tools/hangar/__snapshots__/invalid.ts.snap index b4cbab9f1db..5062b1cd65b 100644 --- a/tools/hangar/__snapshots__/invalid.ts.snap +++ b/tools/hangar/__snapshots__/invalid.ts.snap @@ -1515,7 +1515,7 @@ exports[`extern_static.test.w 1`] = ` "error: Extern methods must be declared \\"static\\" (they cannot access instance members) --> ../../../examples/tests/invalid/extern_static.test.w:2:45 | -2 | extern \\"../valid/external_js.js\\" inflight getGreeting(name: str): str; +2 | extern \\"../valid/external_ts.ts\\" inflight getGreeting(name: str): str; | ^^^^^^^^^^^ Extern methods must be declared \\"static\\" (they cannot access instance members) @@ -2582,11 +2582,11 @@ Duration " `; exports[`invalid compile directory 1`] = ` -"error: /external_js.js must be a sub directory of /lib +"error: /external_ts.ts must be a sub directory of /lib --> ../../../examples/tests/invalid/lib/extern_above.w:2:3 | -2 | extern \\"../../valid/external_js.js\\" static getGreeting(name: str): str; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ /external_js.js must be a sub directory of /lib +2 | extern \\"../../valid/external_ts.ts\\" static getGreeting(name: str): str; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ /external_ts.ts must be a sub directory of /lib " `; diff --git a/tools/hangar/__snapshots__/test_corpus/valid/anon_function.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/anon_function.test.w_compile_tf-aws.md index 98f68030ff1..870b3b37f1d 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/anon_function.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/anon_function.test.w_compile_tf-aws.md @@ -51,6 +51,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/api.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/api.test.w_compile_tf-aws.md index ac5e26eaa48..5628045bad3 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/api.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/api.test.w_compile_tf-aws.md @@ -476,6 +476,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/api_cors_custom.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/api_cors_custom.test.w_compile_tf-aws.md index f25c0bc45fe..359500e3039 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/api_cors_custom.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/api_cors_custom.test.w_compile_tf-aws.md @@ -332,6 +332,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; const ex = $stdlib.ex; const http = $stdlib.http; diff --git a/tools/hangar/__snapshots__/test_corpus/valid/api_cors_default.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/api_cors_default.test.w_compile_tf-aws.md index fcc50ce2f5e..22bb3845ffe 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/api_cors_default.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/api_cors_default.test.w_compile_tf-aws.md @@ -307,6 +307,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; const ex = $stdlib.ex; const http = $stdlib.http; diff --git a/tools/hangar/__snapshots__/test_corpus/valid/api_valid_path.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/api_valid_path.test.w_compile_tf-aws.md index 4068dac57d4..4eaa4b959e1 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/api_valid_path.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/api_valid_path.test.w_compile_tf-aws.md @@ -409,6 +409,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/assert.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/assert.test.w_compile_tf-aws.md index db339eaddd8..a8b74bcff60 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/assert.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/assert.test.w_compile_tf-aws.md @@ -62,6 +62,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/asynchronous_model_implicit_await_in_functions.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/asynchronous_model_implicit_await_in_functions.test.w_compile_tf-aws.md index 95a374461d9..e0374f97b56 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/asynchronous_model_implicit_await_in_functions.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/asynchronous_model_implicit_await_in_functions.test.w_compile_tf-aws.md @@ -269,6 +269,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/baz.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/baz.w_compile_tf-aws.md index 245e92f3823..806f0755f05 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/baz.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/baz.w_compile_tf-aws.md @@ -20,6 +20,7 @@ module.exports = function({ }) { const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class Baz extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_alias.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_alias.test.w_compile_tf-aws.md index c49c9ec09cd..2ddcec22ea9 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_alias.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_alias.test.w_compile_tf-aws.md @@ -28,6 +28,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const stdFs = $stdlib.fs; const stdFs2 = $stdlib.fs; class $Root extends $stdlib.std.Resource { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_awscdk.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_awscdk.test.w_compile_tf-aws.md index 5eace841aec..131f41c9490 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_awscdk.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_awscdk.test.w_compile_tf-aws.md @@ -42,6 +42,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const awscdk = require("aws-cdk-lib"); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_cdk8s.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_cdk8s.test.w_compile_tf-aws.md index 8b57d07c894..fb60c5bbf3e 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_cdk8s.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_cdk8s.test.w_compile_tf-aws.md @@ -28,6 +28,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cdk8s = require("cdk8s"); const kplus = require("cdk8s-plus-27"); class $Root extends $stdlib.std.Resource { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_cdktf.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_cdktf.test.w_compile_tf-aws.md index 156eff2404f..dae379bedc7 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_cdktf.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_cdktf.test.w_compile_tf-aws.md @@ -59,6 +59,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const aws = require("@cdktf/provider-aws"); const cdktf = require("cdktf"); class $Root extends $stdlib.std.Resource { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_extend_non_entry.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_extend_non_entry.test.w_compile_tf-aws.md index 00ea2543f82..4c65ccbc197 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_extend_non_entry.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_extend_non_entry.test.w_compile_tf-aws.md @@ -43,6 +43,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const lib = require("./preflight.extendnonentrypoint-1.cjs"); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { @@ -62,6 +63,7 @@ $APP.synth(); const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cdk8s = require("cdk8s"); class Foo extends (this?.node?.root?.typeForFqn("cdk8s.Chart") ?? cdk8s.Chart) { constructor($scope, $id, ) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_jsii.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_jsii.test.w_compile_tf-aws.md index d9a3cc3aca0..bed8a1ec4ff 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_jsii.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_jsii.test.w_compile_tf-aws.md @@ -64,6 +64,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; const stuff = require("jsii-code-samples"); const jsii_fixture = require("jsii-fixture"); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_local.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_local.test.w_compile_tf-aws.md index ac9218d9459..57561d5972f 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_local.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_local.test.w_compile_tf-aws.md @@ -40,6 +40,26 @@ module.exports = function({ $store }) { //# sourceMappingURL=inflight.$Closure1-3.cjs.map ``` +## inflight.$Closure2-3.cjs +```cjs +"use strict"; +const $helpers = require("@winglang/sdk/lib/helpers"); +module.exports = function({ $expect_Util, $file2_Q }) { + class $Closure2 { + constructor({ }) { + const $obj = (...args) => this.handle(...args); + Object.setPrototypeOf($obj, this); + return $obj; + } + async handle() { + (await $expect_Util.equal((await $file2_Q.greet("bar")), "Hello bar")); + } + } + return $Closure2; +} +//# sourceMappingURL=inflight.$Closure2-3.cjs.map +``` + ## inflight.Q-2.cjs ```cjs "use strict"; @@ -277,10 +297,12 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const file1 = require("./preflight.store-2.cjs"); const file2 = require("./preflight.subfile-3.cjs"); const file3 = require("./preflight.empty-1.cjs"); const math = $stdlib.math; +const expect = $stdlib.expect; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); @@ -319,6 +341,42 @@ class $Root extends $stdlib.std.Resource { }); } } + class $Closure2 extends $stdlib.std.AutoIdResource { + _id = $stdlib.core.closureId(); + constructor($scope, $id, ) { + super($scope, $id); + $helpers.nodeof(this).hidden = true; + } + static _toInflightType() { + return ` + require("${$helpers.normalPath(__dirname)}/inflight.$Closure2-3.cjs")({ + $expect_Util: ${$stdlib.core.liftObject($stdlib.core.toLiftableModuleType(expect.Util, "@winglang/sdk/expect", "Util"))}, + $file2_Q: ${$stdlib.core.liftObject($stdlib.core.toLiftableModuleType(file2.Q, "", "Q"))}, + }) + `; + } + _toInflight() { + return ` + (await (async () => { + const $Closure2Client = ${$Closure2._toInflightType()}; + const client = new $Closure2Client({ + }); + if (client.$inflight_init) { await client.$inflight_init(); } + return client; + })()) + `; + } + get _liftMap() { + return ({ + "handle": [ + [$stdlib.core.toLiftableModuleType(file2.Q, "", "Q"), ["greet"]], + ], + "$inflight_init": [ + [$stdlib.core.toLiftableModuleType(file2.Q, "", "Q"), []], + ], + }); + } + } class Triangle extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); @@ -380,7 +438,9 @@ class $Root extends $stdlib.std.Resource { } const store = new file1.Store(this, "Store"); const q = new file2.Q(this, "Q"); + (expect.Util.equal((file2.Q.preflightGreet("foo")), "Hello foo")); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:add data to store", new $Closure1(this, "$Closure1")); + this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:greet", new $Closure2(this, "$Closure2")); const s = ({"x": 1, "y": 2}); const c = file1.Color.BLUE; $helpers.assert($helpers.neq(c, file1.Color.RED), "c != file1.Color.RED"); @@ -399,6 +459,7 @@ $APP.synth(); const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); module.exports = { }; //# sourceMappingURL=preflight.empty-1.cjs.map ``` @@ -409,6 +470,7 @@ module.exports = { }; const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const file3 = require("./preflight.empty-1.cjs"); const math = $stdlib.math; const cloud = $stdlib.cloud; @@ -529,11 +591,15 @@ module.exports = { Util, Store, Color }; const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const math = $stdlib.math; class Q extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); } + static preflightGreet(name) { + return ($extern("../../../subdir/util.ts")["preflightGreet"])(name) + } static _toInflightType() { return ` require("${$helpers.normalPath(__dirname)}/inflight.Q-2.cjs")({ diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_local.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_local.test.w_test_sim.md index 74749fa252a..5434f4a3efb 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_local.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_local.test.w_test_sim.md @@ -3,9 +3,10 @@ ## stdout.log ```log pass ─ bring_local.test.wsim » root/env0/test:add data to store +pass ─ bring_local.test.wsim » root/env1/test:greet -Tests 1 passed (1) +Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) Duration diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_local_dir.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_local_dir.test.w_compile_tf-aws.md index 55480c87763..60c18b17f6a 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_local_dir.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_local_dir.test.w_compile_tf-aws.md @@ -84,6 +84,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const w = require("./preflight.widget-1.cjs"); const subdir = require("./preflight.subdir2-5.cjs"); class $Root extends $stdlib.std.Resource { @@ -112,6 +113,7 @@ $APP.synth(); const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const blah = require("./preflight.inner-2.cjs"); const cloud = $stdlib.cloud; const util = $stdlib.util; @@ -159,6 +161,7 @@ module.exports = { Foo }; const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const util = $stdlib.util; class Bar extends $stdlib.std.Resource { constructor($scope, $id, ) { @@ -230,6 +233,7 @@ module.exports = { Bar }; const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); module.exports = { ...require("./preflight.widget-1.cjs"), }; @@ -242,6 +246,7 @@ module.exports = { const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); module.exports = { get inner() { return require("./preflight.inner-2.cjs") }, ...require("./preflight.file2-4.cjs"), @@ -256,6 +261,7 @@ module.exports = { const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class Widget extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_local_normalization.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_local_normalization.test.w_compile_tf-aws.md index 2339d2dda3e..938ae80d8ae 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_local_normalization.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_local_normalization.test.w_compile_tf-aws.md @@ -67,6 +67,7 @@ module.exports = function({ }) { const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class Bar extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); @@ -108,6 +109,7 @@ module.exports = { Bar }; const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class Baz extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); @@ -152,6 +154,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const foo = require("./preflight.foo-3.cjs"); const bar = require("./preflight.bar-1.cjs"); const baz = require("./preflight.baz-2.cjs"); @@ -177,6 +180,7 @@ $APP.synth(); const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const bar = require("./preflight.bar-1.cjs"); const baz = require("./preflight.baz-2.cjs"); class Foo extends $stdlib.std.Resource { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_projen.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_projen.test.w_compile_tf-aws.md index ad0e7d96c39..2ac6ea6ecac 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_projen.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_projen.test.w_compile_tf-aws.md @@ -28,6 +28,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const projen = require("projen"); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_wing_library.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_wing_library.test.w_compile_tf-aws.md index ae297c6f5fe..b7fc78e23b0 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_wing_library.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_wing_library.test.w_compile_tf-aws.md @@ -107,6 +107,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const fixture = require("./preflight.testfixture-5.cjs"); const testfixture = require("./preflight.testfixture-5.cjs"); const testfixture2 = require("./preflight.testfixture-5.cjs"); @@ -168,6 +169,7 @@ $APP.synth(); const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const FavoriteNumbers = (function (tmp) { tmp["SEVEN"] = "SEVEN"; @@ -185,6 +187,7 @@ module.exports = { FavoriteNumbers }; const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; const myutil = require("./preflight.util-2.cjs"); class Store extends $stdlib.std.Resource { @@ -194,7 +197,7 @@ class Store extends $stdlib.std.Resource { this.handlers = []; } static makeKey(name) { - return (require("@winglibs/testfixture/util.js")["makeKey"])(name) + return ($extern("@winglibs/testfixture/util.js")["makeKey"])(name) } onSet(handler) { this.handlers.push(handler); @@ -250,6 +253,7 @@ module.exports = { Store }; const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); module.exports = { ...require("./preflight.util-2.cjs"), }; @@ -262,6 +266,7 @@ module.exports = { const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); module.exports = { get subdir() { return require("./preflight.subdir-4.cjs") }, ...require("./preflight.store-3.cjs"), @@ -276,6 +281,7 @@ module.exports = { const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class Util extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bucket_keys.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/bucket_keys.test.w_compile_tf-aws.md index ed11d93d43d..78bf0995b95 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bucket_keys.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bucket_keys.test.w_compile_tf-aws.md @@ -72,6 +72,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bypass_return.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/bypass_return.test.w_compile_tf-aws.md index 5953de14da4..356c05c83b2 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bypass_return.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bypass_return.test.w_compile_tf-aws.md @@ -28,6 +28,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/call_static_of_myself.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/call_static_of_myself.test.w_compile_tf-aws.md index 659cff44284..bdda85c409b 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/call_static_of_myself.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/call_static_of_myself.test.w_compile_tf-aws.md @@ -99,6 +99,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/calling_inflight_variants.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/calling_inflight_variants.test.w_compile_tf-aws.md index 991fbae2cb4..6b4d8e03a2f 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/calling_inflight_variants.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/calling_inflight_variants.test.w_compile_tf-aws.md @@ -110,6 +110,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/capture_containers.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/capture_containers.test.w_compile_tf-aws.md index 70cbb8e6539..bf970b0acc2 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/capture_containers.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/capture_containers.test.w_compile_tf-aws.md @@ -56,6 +56,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/capture_in_binary.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/capture_in_binary.test.w_compile_tf-aws.md index 9dc228c6e0e..91071782782 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/capture_in_binary.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/capture_in_binary.test.w_compile_tf-aws.md @@ -64,6 +64,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/capture_mutables.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/capture_mutables.test.w_compile_tf-aws.md index 680db7411dd..1901fee0de9 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/capture_mutables.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/capture_mutables.test.w_compile_tf-aws.md @@ -71,6 +71,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/capture_primitives.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/capture_primitives.test.w_compile_tf-aws.md index 569a04b1704..acacaa3397b 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/capture_primitives.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/capture_primitives.test.w_compile_tf-aws.md @@ -168,6 +168,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/capture_reassigable_class_field.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/capture_reassigable_class_field.test.w_compile_tf-aws.md index 22172911bef..198c854fd75 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/capture_reassigable_class_field.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/capture_reassigable_class_field.test.w_compile_tf-aws.md @@ -153,6 +153,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; const util = $stdlib.util; class $Root extends $stdlib.std.Resource { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/capture_reassignable.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/capture_reassignable.test.w_compile_tf-aws.md index b8efa165d50..45dfc0c4221 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/capture_reassignable.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/capture_reassignable.test.w_compile_tf-aws.md @@ -68,6 +68,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/capture_resource_and_data.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/capture_resource_and_data.test.w_compile_tf-aws.md index 83ed04e3e84..8ef177657ac 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/capture_resource_and_data.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/capture_resource_and_data.test.w_compile_tf-aws.md @@ -78,6 +78,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/capture_resource_with_no_inflight.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/capture_resource_with_no_inflight.test.w_compile_tf-aws.md index 968f6015a23..d763246da9a 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/capture_resource_with_no_inflight.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/capture_resource_with_no_inflight.test.w_compile_tf-aws.md @@ -90,6 +90,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/capture_tokens.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/capture_tokens.test.w_compile_tf-aws.md index ffa892a8a9b..12ec3390d08 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/capture_tokens.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/capture_tokens.test.w_compile_tf-aws.md @@ -227,6 +227,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/captures.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/captures.test.w_compile_tf-aws.md index efa5cfd847f..746445c0c10 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/captures.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/captures.test.w_compile_tf-aws.md @@ -645,6 +645,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/casting.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/casting.test.w_compile_tf-aws.md index cdaced07e1d..b07df3480fe 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/casting.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/casting.test.w_compile_tf-aws.md @@ -47,6 +47,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; const util = $stdlib.util; const aws = require("@cdktf/provider-aws"); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/class.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/class.test.w_compile_tf-aws.md index e1156f0ed8f..a569a1ecdd6 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/class.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/class.test.w_compile_tf-aws.md @@ -361,6 +361,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/closure_class.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/closure_class.test.w_compile_tf-aws.md index 420cb39ddcb..a979018aad0 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/closure_class.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/closure_class.test.w_compile_tf-aws.md @@ -72,6 +72,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/construct-base.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/construct-base.test.w_compile_tf-aws.md index 249222a16c2..23a43eb2045 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/construct-base.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/construct-base.test.w_compile_tf-aws.md @@ -54,6 +54,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; const cx = require("constructs"); const aws = require("@cdktf/provider-aws"); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/container_types.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/container_types.test.w_compile_tf-aws.md index 53ce479fde8..34176ad7a2a 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/container_types.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/container_types.test.w_compile_tf-aws.md @@ -62,6 +62,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/custom_obj_id.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/custom_obj_id.test.w_compile_tf-aws.md index 971e1a367d5..20431cac6fb 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/custom_obj_id.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/custom_obj_id.test.w_compile_tf-aws.md @@ -42,6 +42,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/debug_env.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/debug_env.test.w_compile_tf-aws.md index 470d960c66b..25341c9e579 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/debug_env.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/debug_env.test.w_compile_tf-aws.md @@ -42,6 +42,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/deep_equality.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/deep_equality.test.w_compile_tf-aws.md index b2c6328825e..812670d01cf 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/deep_equality.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/deep_equality.test.w_compile_tf-aws.md @@ -303,6 +303,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/double_reference.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/double_reference.test.w_compile_tf-aws.md index efb8391b6cc..d6e7eeb4aac 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/double_reference.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/double_reference.test.w_compile_tf-aws.md @@ -108,6 +108,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/doubler.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/doubler.test.w_compile_tf-aws.md index 1eccd7c2554..59be8719310 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/doubler.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/doubler.test.w_compile_tf-aws.md @@ -252,6 +252,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/enums.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/enums.test.w_compile_tf-aws.md index 25c42004b07..243a4b95503 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/enums.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/enums.test.w_compile_tf-aws.md @@ -71,6 +71,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/explicit_lift_qualification.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/explicit_lift_qualification.test.w_compile_tf-aws.md index 792c230efb5..5040f766f00 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/explicit_lift_qualification.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/explicit_lift_qualification.test.w_compile_tf-aws.md @@ -180,6 +180,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/expressions_binary_operators.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/expressions_binary_operators.test.w_compile_tf-aws.md index 4dc478313cc..0ed26f1e9f0 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/expressions_binary_operators.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/expressions_binary_operators.test.w_compile_tf-aws.md @@ -28,6 +28,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/expressions_string_interpolation.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/expressions_string_interpolation.test.w_compile_tf-aws.md index 22963648b05..d4cb73d6f07 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/expressions_string_interpolation.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/expressions_string_interpolation.test.w_compile_tf-aws.md @@ -50,6 +50,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/extend_non_entrypoint.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/extend_non_entrypoint.w_compile_tf-aws.md index 1e2cd457184..794ec04a576 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/extend_non_entrypoint.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/extend_non_entrypoint.w_compile_tf-aws.md @@ -21,6 +21,7 @@ module.exports = function({ $cdk8s_Chart }) { const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cdk8s = require("cdk8s"); class Foo extends (this?.node?.root?.typeForFqn("cdk8s.Chart") ?? cdk8s.Chart) { constructor($scope, $id, ) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/extern_implementation.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/extern_implementation.test.w_compile_tf-aws.md index 79e47831120..8c7d821d3a8 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/extern_implementation.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/extern_implementation.test.w_compile_tf-aws.md @@ -24,7 +24,7 @@ module.exports = function({ $f }) { ```cjs "use strict"; const $helpers = require("@winglang/sdk/lib/helpers"); -module.exports = function({ $Foo }) { +module.exports = function({ $func }) { class $Closure2 { constructor({ }) { const $obj = (...args) => this.handle(...args); @@ -32,7 +32,7 @@ module.exports = function({ $Foo }) { return $obj; } async handle() { - (await $Foo.print("hey there")); + (await $func.invoke()); } } return $Closure2; @@ -40,6 +40,26 @@ module.exports = function({ $Foo }) { //# sourceMappingURL=inflight.$Closure2-1.cjs.map ``` +## inflight.$Closure3-1.cjs +```cjs +"use strict"; +const $helpers = require("@winglang/sdk/lib/helpers"); +module.exports = function({ $Foo }) { + class $Closure3 { + constructor({ }) { + const $obj = (...args) => this.handle(...args); + Object.setPrototypeOf($obj, this); + return $obj; + } + async handle() { + (await $Foo.print("hey there")); + } + } + return $Closure3; +} +//# sourceMappingURL=inflight.$Closure3-1.cjs.map +``` + ## inflight.Foo-1.cjs ```cjs "use strict"; @@ -49,16 +69,16 @@ module.exports = function({ }) { constructor({ }) { } static async regexInflight(pattern, text) { - return (require("../../../external_js.js")["regexInflight"])(pattern, text) + return (require("../../../external_ts.ts")["regexInflight"])(pattern, text) } static async getUuid() { - return (require("../../../external_js.js")["getUuid"])() + return (require("../../../external_ts.ts")["getUuid"])() } static async getData() { - return (require("../../../external_js.js")["getData"])() + return (require("../../../external_ts.ts")["getData"])() } static async print(msg) { - return (require("../../../external_js.js")["print"])(msg) + return (require("../../../external_ts.ts")["print"])(msg) } async call() { $helpers.assert((await Foo.regexInflight("[a-z]+-\\d+", "abc-123")), "Foo.regexInflight(\"[a-z]+-\\\\d+\", \"abc-123\")"); @@ -89,7 +109,96 @@ module.exports = function({ }) { ] }, "resource": { + "aws_cloudwatch_log_group": { + "Function_CloudwatchLogGroup_ABDCF4C4": { + "//": { + "metadata": { + "path": "root/Default/Default/Function/CloudwatchLogGroup", + "uniqueId": "Function_CloudwatchLogGroup_ABDCF4C4" + } + }, + "name": "/aws/lambda/Function-c852aba6", + "retention_in_days": 30 + } + }, + "aws_iam_role": { + "Function_IamRole_678BE84C": { + "//": { + "metadata": { + "path": "root/Default/Default/Function/IamRole", + "uniqueId": "Function_IamRole_678BE84C" + } + }, + "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" + } + }, + "aws_iam_role_policy": { + "Function_IamRolePolicy_E3B26607": { + "//": { + "metadata": { + "path": "root/Default/Default/Function/IamRolePolicy", + "uniqueId": "Function_IamRolePolicy_E3B26607" + } + }, + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", + "role": "${aws_iam_role.Function_IamRole_678BE84C.name}" + } + }, + "aws_iam_role_policy_attachment": { + "Function_IamRolePolicyAttachment_CACE1358": { + "//": { + "metadata": { + "path": "root/Default/Default/Function/IamRolePolicyAttachment", + "uniqueId": "Function_IamRolePolicyAttachment_CACE1358" + } + }, + "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", + "role": "${aws_iam_role.Function_IamRole_678BE84C.name}" + } + }, + "aws_lambda_function": { + "Function": { + "//": { + "metadata": { + "path": "root/Default/Default/Function/Default", + "uniqueId": "Function" + } + }, + "architectures": [ + "arm64" + ], + "environment": { + "variables": { + "NODE_OPTIONS": "--enable-source-maps", + "WING_FUNCTION_NAME": "Function-c852aba6", + "WING_TARGET": "tf-aws" + } + }, + "function_name": "Function-c852aba6", + "handler": "index.handler", + "memory_size": 1024, + "publish": true, + "role": "${aws_iam_role.Function_IamRole_678BE84C.arn}", + "runtime": "nodejs20.x", + "s3_bucket": "${aws_s3_bucket.Code.bucket}", + "s3_key": "${aws_s3_object.Function_S3Object_C62A0C2D.key}", + "timeout": 60, + "vpc_config": { + "security_group_ids": [], + "subnet_ids": [] + } + } + }, "aws_s3_bucket": { + "Code": { + "//": { + "metadata": { + "path": "root/Default/Code", + "uniqueId": "Code" + } + }, + "bucket_prefix": "code-c84a50b1-" + }, "my-bucket": { "//": { "metadata": { @@ -100,6 +209,19 @@ module.exports = function({ }) { "bucket_prefix": "my-bucket-c8fafcc6-", "force_destroy": false } + }, + "aws_s3_object": { + "Function_S3Object_C62A0C2D": { + "//": { + "metadata": { + "path": "root/Default/Default/Function/S3Object", + "uniqueId": "Function_S3Object_C62A0C2D" + } + }, + "bucket": "${aws_s3_bucket.Code.bucket}", + "key": "", + "source": "" + } } } } @@ -114,6 +236,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { @@ -123,10 +246,10 @@ class $Root extends $stdlib.std.Resource { super($scope, $id); } static getGreeting(name) { - return (require("../../../external_js.js")["getGreeting"])(name) + return ($extern("../../../external_ts.ts")["getGreeting"])(name) } static preflightBucket(bucket, id) { - return (require("../../../external_js.js")["preflightBucket"])(bucket, id) + return ($extern("../../../external_ts.ts")["preflightBucket"])(bucket, id) } static _toInflightType() { return ` @@ -212,7 +335,7 @@ class $Root extends $stdlib.std.Resource { static _toInflightType() { return ` require("${$helpers.normalPath(__dirname)}/inflight.$Closure2-1.cjs")({ - $Foo: ${$stdlib.core.liftObject(Foo)}, + $func: ${$stdlib.core.liftObject(func)}, }) `; } @@ -227,6 +350,41 @@ class $Root extends $stdlib.std.Resource { })()) `; } + get _liftMap() { + return ({ + "handle": [ + [func, ["invoke"]], + ], + "$inflight_init": [ + [func, []], + ], + }); + } + } + class $Closure3 extends $stdlib.std.AutoIdResource { + _id = $stdlib.core.closureId(); + constructor($scope, $id, ) { + super($scope, $id); + $helpers.nodeof(this).hidden = true; + } + static _toInflightType() { + return ` + require("${$helpers.normalPath(__dirname)}/inflight.$Closure3-1.cjs")({ + $Foo: ${$stdlib.core.liftObject(Foo)}, + }) + `; + } + _toInflight() { + return ` + (await (async () => { + const $Closure3Client = ${$Closure3._toInflightType()}; + const client = new $Closure3Client({ + }); + if (client.$inflight_init) { await client.$inflight_init(); } + return client; + })()) + `; + } get _liftMap() { return ({ "handle": [ @@ -241,9 +399,10 @@ class $Root extends $stdlib.std.Resource { $helpers.assert($helpers.eq((Foo.getGreeting("Wingding")), "Hello, Wingding!"), "Foo.getGreeting(\"Wingding\") == \"Hello, Wingding!\""); const f = new Foo(this, "Foo"); const bucket = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "my-bucket"); - const result = (Foo.preflightBucket(bucket, "my-bucket")); - this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:call", new $Closure1(this, "$Closure1")); - this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:console", new $Closure2(this, "$Closure2")); + (Foo.preflightBucket(bucket, "my-bucket")); + const func = this.node.root.new("@winglang/sdk.cloud.Function", cloud.Function, this, "Function", new $Closure1(this, "$Closure1")); + this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:call", new $Closure2(this, "$Closure2")); + this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:console", new $Closure3(this, "$Closure3")); } } const $PlatformManager = new $stdlib.platform.PlatformManager({platformPaths: $platforms}); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/file_counter.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/file_counter.test.w_compile_tf-aws.md index 29fdb38f65e..bd433ead881 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/file_counter.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/file_counter.test.w_compile_tf-aws.md @@ -213,6 +213,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/for_loop.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/for_loop.test.w_compile_tf-aws.md index bb43a222704..133f07c0354 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/for_loop.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/for_loop.test.w_compile_tf-aws.md @@ -177,6 +177,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/forward_decl.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/forward_decl.test.w_compile_tf-aws.md index 500019c0eae..f942377bb06 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/forward_decl.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/forward_decl.test.w_compile_tf-aws.md @@ -42,6 +42,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/function_returns_function.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/function_returns_function.test.w_compile_tf-aws.md index 3e2306fbbd0..9d84ab99e3f 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/function_returns_function.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/function_returns_function.test.w_compile_tf-aws.md @@ -56,6 +56,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/function_type.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/function_type.test.w_compile_tf-aws.md index 267ddb76160..ca5805b236a 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/function_type.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/function_type.test.w_compile_tf-aws.md @@ -103,6 +103,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/function_variadic_arguments.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/function_variadic_arguments.test.w_compile_tf-aws.md index 9aaf1509f1a..47d3ad814f2 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/function_variadic_arguments.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/function_variadic_arguments.test.w_compile_tf-aws.md @@ -91,6 +91,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/hello.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/hello.test.w_compile_tf-aws.md index 0315edef46e..a89822806fa 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/hello.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/hello.test.w_compile_tf-aws.md @@ -191,6 +191,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/identical_inflights.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/identical_inflights.test.w_compile_tf-aws.md index 500040fdc4a..a354c770c40 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/identical_inflights.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/identical_inflights.test.w_compile_tf-aws.md @@ -66,6 +66,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/impl_interface.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/impl_interface.test.w_compile_tf-aws.md index 2c211e4e854..caf2cd8e6aa 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/impl_interface.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/impl_interface.test.w_compile_tf-aws.md @@ -265,6 +265,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; const jsii_fixture = require("jsii-fixture"); class $Root extends $stdlib.std.Resource { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/implicit_std.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/implicit_std.test.w_compile_tf-aws.md index 6cdb034923f..3086f935883 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/implicit_std.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/implicit_std.test.w_compile_tf-aws.md @@ -28,6 +28,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/in_scope_construct.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/in_scope_construct.test.w_compile_tf-aws.md index f392bd18f75..8ae55982b3c 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/in_scope_construct.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/in_scope_construct.test.w_compile_tf-aws.md @@ -42,6 +42,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const c = require("constructs"); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inference.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inference.test.w_compile_tf-aws.md index ffab6c246c8..ed9ebd76926 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inference.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inference.test.w_compile_tf-aws.md @@ -253,6 +253,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight-subscribers.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight-subscribers.test.w_compile_tf-aws.md index 420cb3aa833..ae14796da53 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight-subscribers.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight-subscribers.test.w_compile_tf-aws.md @@ -319,6 +319,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_capture_static.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_capture_static.test.w_compile_tf-aws.md index 65450281d8e..7f67e80adcf 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_capture_static.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_capture_static.test.w_compile_tf-aws.md @@ -154,6 +154,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const util = $stdlib.util; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_as_struct_members.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_as_struct_members.test.w_compile_tf-aws.md index b3e6f489e9c..1b2a1dcf38c 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_as_struct_members.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_as_struct_members.test.w_compile_tf-aws.md @@ -84,6 +84,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_capture_const.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_capture_const.test.w_compile_tf-aws.md index 620f809761f..b8eb8f5eb65 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_capture_const.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_capture_const.test.w_compile_tf-aws.md @@ -64,6 +64,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_capture_preflight_object.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_capture_preflight_object.test.w_compile_tf-aws.md index 1bdeaa20062..570536b9cec 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_capture_preflight_object.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_capture_preflight_object.test.w_compile_tf-aws.md @@ -28,6 +28,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_definitions.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_definitions.test.w_compile_tf-aws.md index 1446bec80f0..7b4304c42d1 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_definitions.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_definitions.test.w_compile_tf-aws.md @@ -178,6 +178,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_inner_capture_mutable.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_inner_capture_mutable.test.w_compile_tf-aws.md index 16f9dba5970..f00e099cee6 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_inner_capture_mutable.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_inner_capture_mutable.test.w_compile_tf-aws.md @@ -59,6 +59,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_inside_inflight_closure.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_inside_inflight_closure.test.w_compile_tf-aws.md index 14e695052a5..a4590c97062 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_inside_inflight_closure.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_inside_inflight_closure.test.w_compile_tf-aws.md @@ -239,6 +239,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_modifiers.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_modifiers.test.w_compile_tf-aws.md index dc0720c8b16..d888f13496b 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_modifiers.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_modifiers.test.w_compile_tf-aws.md @@ -47,6 +47,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_outside_inflight_closure.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_outside_inflight_closure.test.w_compile_tf-aws.md index 6629876c060..0712ff6a4e8 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_outside_inflight_closure.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_outside_inflight_closure.test.w_compile_tf-aws.md @@ -70,6 +70,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_structural_interace_handler.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_structural_interace_handler.test.w_compile_tf-aws.md index 5b21dc65e14..2d2852e84dc 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_structural_interace_handler.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_structural_interace_handler.test.w_compile_tf-aws.md @@ -74,6 +74,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_without_init.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_without_init.test.w_compile_tf-aws.md index 87dc6167c42..c9a1079e75c 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_without_init.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_without_init.test.w_compile_tf-aws.md @@ -60,6 +60,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_closure_autoid.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_closure_autoid.test.w_compile_tf-aws.md index 684f88e2b7e..6e531964898 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_closure_autoid.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_closure_autoid.test.w_compile_tf-aws.md @@ -70,6 +70,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_closure_inside_preflight_closure.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_closure_inside_preflight_closure.test.w_compile_tf-aws.md index 92f4cb22069..17d06132069 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_closure_inside_preflight_closure.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_closure_inside_preflight_closure.test.w_compile_tf-aws.md @@ -61,6 +61,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_concat.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_concat.test.w_compile_tf-aws.md index ff29a2598d8..4432a818dc0 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_concat.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_concat.test.w_compile_tf-aws.md @@ -46,6 +46,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_handler_singleton.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_handler_singleton.test.w_compile_tf-aws.md index 71e3f61e8a6..e41ad83c914 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_handler_singleton.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_handler_singleton.test.w_compile_tf-aws.md @@ -434,6 +434,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; const expect = $stdlib.expect; const util = $stdlib.util; diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_init.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_init.test.w_compile_tf-aws.md index 9ddb1ef3f60..657d4d9293a 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_init.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_init.test.w_compile_tf-aws.md @@ -192,6 +192,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const jsii_fixture = require("jsii-fixture"); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflights_calling_inflights.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflights_calling_inflights.test.w_compile_tf-aws.md index d6ff6fe7fd3..8db5729b722 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflights_calling_inflights.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflights_calling_inflights.test.w_compile_tf-aws.md @@ -272,6 +272,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inherit_stdlib_class.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inherit_stdlib_class.test.w_compile_tf-aws.md index 72d6d7dc9f7..159a58075a1 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inherit_stdlib_class.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inherit_stdlib_class.test.w_compile_tf-aws.md @@ -289,6 +289,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; const http = $stdlib.http; class $Root extends $stdlib.std.Resource { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inheritance_class_inflight.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inheritance_class_inflight.test.w_compile_tf-aws.md index d8009b56461..3784a8a054c 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inheritance_class_inflight.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inheritance_class_inflight.test.w_compile_tf-aws.md @@ -91,6 +91,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const expect = $stdlib.expect; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inheritance_class_preflight.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inheritance_class_preflight.test.w_compile_tf-aws.md index ed76fba8d0e..fd16413a92a 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inheritance_class_preflight.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inheritance_class_preflight.test.w_compile_tf-aws.md @@ -57,6 +57,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const expect = $stdlib.expect; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inheritance_interface.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inheritance_interface.test.w_compile_tf-aws.md index a1959bfe361..7d55a61e604 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inheritance_interface.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inheritance_interface.test.w_compile_tf-aws.md @@ -42,6 +42,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const expect = $stdlib.expect; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/interface.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/interface.test.w_compile_tf-aws.md index f038dd9b801..2df8723afdf 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/interface.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/interface.test.w_compile_tf-aws.md @@ -56,6 +56,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/issue_2889.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/issue_2889.test.w_compile_tf-aws.md index bc05cecda53..72edd480440 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/issue_2889.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/issue_2889.test.w_compile_tf-aws.md @@ -277,6 +277,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; const http = $stdlib.http; class $Root extends $stdlib.std.Resource { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/json.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/json.test.w_compile_tf-aws.md index a117e1ad7c9..4190779ac7e 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/json.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/json.test.w_compile_tf-aws.md @@ -56,6 +56,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/json_bucket.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/json_bucket.test.w_compile_tf-aws.md index 5b12a5beb53..180a6a15dbe 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/json_bucket.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/json_bucket.test.w_compile_tf-aws.md @@ -187,6 +187,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/json_static.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/json_static.test.w_compile_tf-aws.md index fd31364e461..5001699ac15 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/json_static.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/json_static.test.w_compile_tf-aws.md @@ -71,6 +71,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/json_string_interpolation.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/json_string_interpolation.test.w_compile_tf-aws.md index 326a91482d1..7dfc3aa272d 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/json_string_interpolation.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/json_string_interpolation.test.w_compile_tf-aws.md @@ -28,6 +28,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/lift_expr_with_this.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/lift_expr_with_this.test.w_compile_tf-aws.md index bd967ec5f17..458c3ebe66e 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/lift_expr_with_this.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/lift_expr_with_this.test.w_compile_tf-aws.md @@ -63,6 +63,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/lift_inflight_closure_collection.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/lift_inflight_closure_collection.test.w_compile_tf-aws.md index 6e4dd1d335c..3201db9efeb 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/lift_inflight_closure_collection.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/lift_inflight_closure_collection.test.w_compile_tf-aws.md @@ -637,6 +637,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/lift_parent_fields.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/lift_parent_fields.test.w_compile_tf-aws.md index 4ae5ae803ab..9854460a01c 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/lift_parent_fields.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/lift_parent_fields.test.w_compile_tf-aws.md @@ -108,6 +108,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/lift_redefinition.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/lift_redefinition.test.w_compile_tf-aws.md index 5de1f8cb9ec..008fd5cb20d 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/lift_redefinition.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/lift_redefinition.test.w_compile_tf-aws.md @@ -50,6 +50,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/lift_shared_resource.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/lift_shared_resource.test.w_compile_tf-aws.md index 8762735b540..39d5e3d398f 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/lift_shared_resource.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/lift_shared_resource.test.w_compile_tf-aws.md @@ -305,6 +305,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; const http = $stdlib.http; class $Root extends $stdlib.std.Resource { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/lift_this.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/lift_this.test.w_compile_tf-aws.md index f658b4ea631..aead5f77bbb 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/lift_this.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/lift_this.test.w_compile_tf-aws.md @@ -72,6 +72,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const util = $stdlib.util; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/lift_via_closure.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/lift_via_closure.test.w_compile_tf-aws.md index 20fa0ce62c4..e36aa1d5837 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/lift_via_closure.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/lift_via_closure.test.w_compile_tf-aws.md @@ -145,6 +145,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/lift_via_closure_explicit.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/lift_via_closure_explicit.test.w_compile_tf-aws.md index d7e6d44dbb7..55c83d2f17b 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/lift_via_closure_explicit.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/lift_via_closure_explicit.test.w_compile_tf-aws.md @@ -84,6 +84,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/lift_weird_order.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/lift_weird_order.test.w_compile_tf-aws.md index 54b553654e0..38549ae6e98 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/lift_weird_order.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/lift_weird_order.test.w_compile_tf-aws.md @@ -83,6 +83,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/lift_with_phase_ind.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/lift_with_phase_ind.test.w_compile_tf-aws.md index 2d8f1cbed9e..31fe3da6020 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/lift_with_phase_ind.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/lift_with_phase_ind.test.w_compile_tf-aws.md @@ -53,6 +53,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const math = $stdlib.math; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/map_entries.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/map_entries.test.w_compile_tf-aws.md index e9a6f09b69d..823578753be 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/map_entries.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/map_entries.test.w_compile_tf-aws.md @@ -115,6 +115,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/mut_container_types.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/mut_container_types.test.w_compile_tf-aws.md index 65a3a7a082b..c62dfd7a085 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/mut_container_types.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/mut_container_types.test.w_compile_tf-aws.md @@ -62,6 +62,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/mutation_after_class_init.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/mutation_after_class_init.test.w_compile_tf-aws.md index 74c88fc513b..21f71ede962 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/mutation_after_class_init.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/mutation_after_class_init.test.w_compile_tf-aws.md @@ -339,6 +339,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; const util = $stdlib.util; class $Root extends $stdlib.std.Resource { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/new_in_static.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/new_in_static.test.w_compile_tf-aws.md index ff68847e29e..5561a7c89cd 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/new_in_static.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/new_in_static.test.w_compile_tf-aws.md @@ -146,6 +146,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; const c = require("constructs"); const jsii_fixture = require("jsii-fixture"); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/new_jsii.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/new_jsii.test.w_compile_tf-aws.md index 40f9a4a61b1..aeee02c5419 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/new_jsii.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/new_jsii.test.w_compile_tf-aws.md @@ -56,6 +56,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/nil.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/nil.test.w_compile_tf-aws.md index 67e12e044e4..7a58f2cd9c0 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/nil.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/nil.test.w_compile_tf-aws.md @@ -104,6 +104,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/on_lift.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/on_lift.test.w_compile_tf-aws.md index fe91d5db37b..167265a0c23 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/on_lift.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/on_lift.test.w_compile_tf-aws.md @@ -71,6 +71,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const util = $stdlib.util; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/optionals.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/optionals.test.w_compile_tf-aws.md index 576e04a36b6..0fe1fc6a2e6 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/optionals.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/optionals.test.w_compile_tf-aws.md @@ -123,6 +123,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/parameters/nested/parameters.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/parameters/nested/parameters.test.w_compile_tf-aws.md index f6318c7e6b9..811e2fa2337 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/parameters/nested/parameters.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/parameters/nested/parameters.test.w_compile_tf-aws.md @@ -28,6 +28,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/parameters/simple/parameters.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/parameters/simple/parameters.test.w_compile_tf-aws.md index 4e53afbbd88..3d38905013f 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/parameters/simple/parameters.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/parameters/simple/parameters.test.w_compile_tf-aws.md @@ -28,6 +28,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/phase_independent_method_on_string.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/phase_independent_method_on_string.test.w_compile_tf-aws.md index 9cb14faa247..b69e87e49f2 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/phase_independent_method_on_string.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/phase_independent_method_on_string.test.w_compile_tf-aws.md @@ -136,6 +136,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; const expect = $stdlib.expect; class $Root extends $stdlib.std.Resource { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/primitive_methods.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/primitive_methods.test.w_compile_tf-aws.md index f8d1da87713..441e37501dd 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/primitive_methods.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/primitive_methods.test.w_compile_tf-aws.md @@ -28,6 +28,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/print.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/print.test.w_compile_tf-aws.md index fac5b90b20a..562f60a538d 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/print.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/print.test.w_compile_tf-aws.md @@ -70,6 +70,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/reassignment.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/reassignment.test.w_compile_tf-aws.md index 3c9ddbb6bf7..e19b9812b63 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/reassignment.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/reassignment.test.w_compile_tf-aws.md @@ -42,6 +42,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/redis.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/redis.test.w_compile_tf-aws.md index b9fd159b90f..fdc84d01919 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/redis.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/redis.test.w_compile_tf-aws.md @@ -539,6 +539,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; const util = $stdlib.util; const ex = $stdlib.ex; diff --git a/tools/hangar/__snapshots__/test_corpus/valid/resource.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/resource.test.w_compile_tf-aws.md index e586d837e92..b032c7d1595 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/resource.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/resource.test.w_compile_tf-aws.md @@ -701,6 +701,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/resource_as_inflight_literal.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/resource_as_inflight_literal.test.w_compile_tf-aws.md index 389139afccd..f4c393d508d 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/resource_as_inflight_literal.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/resource_as_inflight_literal.test.w_compile_tf-aws.md @@ -174,6 +174,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/resource_call_static.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/resource_call_static.test.w_compile_tf-aws.md index 5b3c3636809..42248faa995 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/resource_call_static.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/resource_call_static.test.w_compile_tf-aws.md @@ -86,6 +86,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/resource_captures.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/resource_captures.test.w_compile_tf-aws.md index 00954de7d8e..3fcc2bb7378 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/resource_captures.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/resource_captures.test.w_compile_tf-aws.md @@ -245,6 +245,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/resource_captures_globals.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/resource_captures_globals.test.w_compile_tf-aws.md index 97696db6158..abcd3c26134 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/resource_captures_globals.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/resource_captures_globals.test.w_compile_tf-aws.md @@ -358,6 +358,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/service.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/service.test.w_compile_tf-aws.md index 355684a8996..1cbc516d9b3 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/service.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/service.test.w_compile_tf-aws.md @@ -28,6 +28,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/shadowing.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/shadowing.test.w_compile_tf-aws.md index b76e062df77..c1a060431ee 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/shadowing.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/shadowing.test.w_compile_tf-aws.md @@ -80,6 +80,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/statements_if.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/statements_if.test.w_compile_tf-aws.md index 23647a468c0..d4d62ba28dc 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/statements_if.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/statements_if.test.w_compile_tf-aws.md @@ -67,6 +67,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/statements_variable_declarations.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/statements_variable_declarations.test.w_compile_tf-aws.md index 4248eadd06b..78aaec16adc 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/statements_variable_declarations.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/statements_variable_declarations.test.w_compile_tf-aws.md @@ -28,6 +28,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/static_members.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/static_members.test.w_compile_tf-aws.md index f1ac644aa61..eb12cc98e9c 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/static_members.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/static_members.test.w_compile_tf-aws.md @@ -75,6 +75,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/std_containers.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/std_containers.test.w_compile_tf-aws.md index 23b6b267b8a..b7b54c36a69 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/std_containers.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/std_containers.test.w_compile_tf-aws.md @@ -72,6 +72,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/std_string.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/std_string.test.w_compile_tf-aws.md index c78ec23c0e5..a2d9f9663d6 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/std_string.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/std_string.test.w_compile_tf-aws.md @@ -50,6 +50,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/store.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/store.w_compile_tf-aws.md index e8985681532..5afb35fc2ee 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/store.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/store.w_compile_tf-aws.md @@ -58,6 +58,7 @@ module.exports = function({ }) { const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const file3 = require("./preflight.empty-1.cjs"); const math = $stdlib.math; const cloud = $stdlib.cloud; @@ -178,6 +179,7 @@ module.exports = { Util, Store, Color }; const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); module.exports = { }; //# sourceMappingURL=preflight.empty-1.cjs.map ``` diff --git a/tools/hangar/__snapshots__/test_corpus/valid/struct_from_json.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/struct_from_json.test.w_compile_tf-aws.md index f62d82a310d..771d6cedaa5 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/struct_from_json.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/struct_from_json.test.w_compile_tf-aws.md @@ -176,6 +176,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; const externalStructs = require("./preflight.structs-1.cjs"); const otherExternalStructs = require("./preflight.structs2-2.cjs"); @@ -511,6 +512,7 @@ $APP.synth(); const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const Bar = $stdlib.std.Struct._createJsonSchema({$id:"/Bar",type:"object",properties:{b:{type:"number"},f:{type:"string"},},required:["b","f",]}); const Foo = $stdlib.std.Struct._createJsonSchema({$id:"/Foo",type:"object",properties:{f:{type:"string"},},required:["f",]}); const Foosible = $stdlib.std.Struct._createJsonSchema({$id:"/Foosible",type:"object",properties:{f:{type:"string"},},required:[]}); @@ -529,6 +531,7 @@ module.exports = { }; const $stdlib = require('@winglang/sdk'); const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const Bar = $stdlib.std.Struct._createJsonSchema({$id:"/Bar",type:"object",properties:{b:{type:"number"},f:{type:"string"},},required:["b","f",]}); const Foo = $stdlib.std.Struct._createJsonSchema({$id:"/Foo",type:"object",properties:{f:{type:"string"},},required:["f",]}); const Foosible = $stdlib.std.Struct._createJsonSchema({$id:"/Foosible",type:"object",properties:{f:{type:"string"},},required:[]}); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/structs.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/structs.test.w_compile_tf-aws.md index 2a8486ed100..ba53b64c40d 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/structs.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/structs.test.w_compile_tf-aws.md @@ -67,6 +67,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const expect = $stdlib.expect; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/super_call.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/super_call.test.w_compile_tf-aws.md index 76f297bab42..32581de0f4b 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/super_call.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/super_call.test.w_compile_tf-aws.md @@ -223,6 +223,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const expect = $stdlib.expect; const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/symbol_shadow.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/symbol_shadow.test.w_compile_tf-aws.md index 8872ecd56b1..f816810e030 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/symbol_shadow.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/symbol_shadow.test.w_compile_tf-aws.md @@ -123,6 +123,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/table.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/table.test.w_compile_tf-aws.md index ed8a83f5d4f..57b28e91c18 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/table.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/table.test.w_compile_tf-aws.md @@ -52,6 +52,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const ex = $stdlib.ex; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/test_bucket.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/test_bucket.test.w_compile_tf-aws.md index 8c6914333ed..036ebaba3e5 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/test_bucket.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/test_bucket.test.w_compile_tf-aws.md @@ -85,6 +85,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/test_without_bring.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/test_without_bring.test.w_compile_tf-aws.md index beafe24542d..48e551a1e6e 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/test_without_bring.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/test_without_bring.test.w_compile_tf-aws.md @@ -48,6 +48,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/this.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/this.test.w_compile_tf-aws.md index 71d7f06f0d8..283abc28bf8 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/this.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/this.test.w_compile_tf-aws.md @@ -28,6 +28,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const expect = $stdlib.expect; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/try_catch.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/try_catch.test.w_compile_tf-aws.md index 249b31e0200..95648e798ba 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/try_catch.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/try_catch.test.w_compile_tf-aws.md @@ -28,6 +28,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/unused_lift.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/unused_lift.test.w_compile_tf-aws.md index 5f118bb7927..b235736da4c 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/unused_lift.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/unused_lift.test.w_compile_tf-aws.md @@ -120,6 +120,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/use_inflight_method_inside_init_closure.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/use_inflight_method_inside_init_closure.test.w_compile_tf-aws.md index 0d8bf284ea7..f374ccee292 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/use_inflight_method_inside_init_closure.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/use_inflight_method_inside_init_closure.test.w_compile_tf-aws.md @@ -170,6 +170,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/website_with_api.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/website_with_api.test.w_compile_tf-aws.md index d17d00250d4..8cbcb5f95bd 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/website_with_api.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/website_with_api.test.w_compile_tf-aws.md @@ -628,6 +628,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; const ex = $stdlib.ex; const http = $stdlib.http; diff --git a/tools/hangar/__snapshots__/test_corpus/valid/while.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/while.test.w_compile_tf-aws.md index 96d8a12986b..da069f993dc 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/while.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/while.test.w_compile_tf-aws.md @@ -28,6 +28,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/while_loop_await.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/while_loop_await.test.w_compile_tf-aws.md index f9ec29df248..c73bf15bf1c 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/while_loop_await.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/while_loop_await.test.w_compile_tf-aws.md @@ -186,6 +186,7 @@ const $outdir = process.env.WING_SYNTH_DIR ?? "."; const $wing_is_test = process.env.WING_IS_TEST === "true"; const std = $stdlib.std; const $helpers = $stdlib.helpers; +const $extern = $helpers.createExternRequire(__dirname); const cloud = $stdlib.cloud; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { From 39569f064ff6b1018cfdf715fb63757b8bdde250 Mon Sep 17 00:00:00 2001 From: Gary Sassano <10464497+garysassano@users.noreply.github.com> Date: Fri, 12 Apr 2024 19:57:17 +0200 Subject: [PATCH 06/15] fix(cli): `wing pack` does not enforce using `peerDependencies` (#6218) Closes #5470 ## Checklist - [x] Title matches [Winglang's style guide](https://www.winglang.io/contributing/start-here/pull_requests#how-are-pull-request-titles-formatted) - [x] Description explains motivation and solution - [x] Tests added (always) - [ ] Docs updated (only required for features) - [ ] Added `pr/e2e-full` label if this feature requires end-to-end testing *By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*. --- apps/wing/fixtures/invalid6/lib.w | 0 apps/wing/fixtures/invalid6/package.json | 13 +++++++++ apps/wing/fixtures/invalid6/util.ts | 3 ++ apps/wing/fixtures/valid1/package.json | 3 +- apps/wing/src/commands/pack.test.ts | 35 ++++++++++++++++++++++++ apps/wing/src/commands/pack.ts | 7 +++++ 6 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 apps/wing/fixtures/invalid6/lib.w create mode 100644 apps/wing/fixtures/invalid6/package.json create mode 100644 apps/wing/fixtures/invalid6/util.ts diff --git a/apps/wing/fixtures/invalid6/lib.w b/apps/wing/fixtures/invalid6/lib.w new file mode 100644 index 00000000000..e69de29bb2d diff --git a/apps/wing/fixtures/invalid6/package.json b/apps/wing/fixtures/invalid6/package.json new file mode 100644 index 00000000000..8ce3fa12dca --- /dev/null +++ b/apps/wing/fixtures/invalid6/package.json @@ -0,0 +1,13 @@ +{ + "name": "invalid6", + "version": "0.0.0", + "description": "description", + "author": "author", + "license": "MIT", + "files": [ + "**/*.ts" + ], + "dependencies": { + "some-dependency": "^1.0.0" + } +} diff --git a/apps/wing/fixtures/invalid6/util.ts b/apps/wing/fixtures/invalid6/util.ts new file mode 100644 index 00000000000..11dd2c2f1d5 --- /dev/null +++ b/apps/wing/fixtures/invalid6/util.ts @@ -0,0 +1,3 @@ +export function add(x: number, y: number): number { + return x + y; +} diff --git a/apps/wing/fixtures/valid1/package.json b/apps/wing/fixtures/valid1/package.json index f9ac31ccc0d..f5beb574ad2 100644 --- a/apps/wing/fixtures/valid1/package.json +++ b/apps/wing/fixtures/valid1/package.json @@ -6,5 +6,6 @@ "license": "MIT", "files": [ "**/*.ts" - ] + ], + "dependencies": {} } diff --git a/apps/wing/src/commands/pack.test.ts b/apps/wing/src/commands/pack.test.ts index 189a5081522..2b658d27ae7 100644 --- a/apps/wing/src/commands/pack.test.ts +++ b/apps/wing/src/commands/pack.test.ts @@ -69,6 +69,41 @@ describe("wing pack", () => { await expectNoTarball(outdir); }); + it("throws an error if package.json uses dependencies instead of peerDependencies", async () => { + // GIVEN + const projectDir = join(fixturesDir, "invalid6"); + const outdir = await generateTmpDir(); + process.chdir(projectDir); + + // WHEN + await expect(pack({ outFile: join(outdir, "tarball.tgz") })).rejects.toThrow( + /Cannot create package with "dependencies" in package.json. Use "peerDependencies" instead./ + ); + + // THEN + await expectNoTarball(outdir); + }); + + it("includes empty dependencies in package.json", async () => { + // valid1's package.json contains this: + // { + // ... + // "dependencies": {} + // } + + // GIVEN + const projectDir = join(fixturesDir, "valid1"); + const outdir = await generateTmpDir(); + process.chdir(projectDir); + + // WHEN + await expect(pack({ outFile: join(outdir, "tarball.tgz") })).resolves.not.toThrow(); + + // THEN + const tarballContents = await extractTarball(join(outdir, "tarball.tgz"), outdir); + expect(tarballContents).toBeDefined(); + }); + it("includes extra files specified by package.json", async () => { // valid1's package.json contains this: // { diff --git a/apps/wing/src/commands/pack.ts b/apps/wing/src/commands/pack.ts index 72193eb6b22..3929a82e17b 100644 --- a/apps/wing/src/commands/pack.ts +++ b/apps/wing/src/commands/pack.ts @@ -120,6 +120,13 @@ export async function pack(options: PackageOptions = {}): Promise { } } + // Check if package.json has non-empty "dependencies" + if (pkgJson.dependencies && Object.keys(pkgJson.dependencies).length > 0) { + throw new Error( + `Cannot create package with "dependencies" in package.json. Use "peerDependencies" instead.` + ); + } + // move compiler output await fs.rename(compilerOutputDir, path.join(workdir, compilerOutputFolder)); From 60bc255a430b7381bfd34cc4b0b552c5d625fd3a Mon Sep 17 00:00:00 2001 From: Mark McCulloh Date: Fri, 12 Apr 2024 16:15:58 -0400 Subject: [PATCH 07/15] fix: keywords are highlighted incorrectly in objects/structs (#6223) Fixes #6208 Fixes #2595 Before: image After: image *By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*. --- .../vscode-wing/syntaxes/wing.tmLanguage.json | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/apps/vscode-wing/syntaxes/wing.tmLanguage.json b/apps/vscode-wing/syntaxes/wing.tmLanguage.json index 119c5e26e6f..f3bc85b1d2a 100644 --- a/apps/vscode-wing/syntaxes/wing.tmLanguage.json +++ b/apps/vscode-wing/syntaxes/wing.tmLanguage.json @@ -6,6 +6,12 @@ { "include": "#template-string" }, + { + "include": "#object-keys" + }, + { + "include": "#members" + }, { "include": "#keywords" }, @@ -23,9 +29,6 @@ }, { "include": "#identifiers" - }, - { - "include": "#members" } ], "repository": { @@ -188,6 +191,18 @@ } } ] + }, + "object-keys": { + "patterns": [ + { + "match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*:", + "captures": { + "1": { + "name": "variable.wing" + } + } + } + ] } } } From 6a66400bde9f4269aceb0dfeb437cee4bf766c25 Mon Sep 17 00:00:00 2001 From: Mark McCulloh Date: Fri, 12 Apr 2024 16:24:10 -0400 Subject: [PATCH 08/15] chore: update rust and wasi toolchain (#6222) *By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*. --- .cargo/config.toml | 6 +++--- libs/wingc/package.json | 2 +- libs/wingc/src/type_check/lifts.rs | 7 +------ rust-toolchain.toml | 2 +- scripts/setup_wasi.sh | 4 ++-- 5 files changed, 8 insertions(+), 13 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 4e6f4107a70..11ecc1fe7d7 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,5 +1,5 @@ [env] -WASI_SDK = { value = ".cargo/wasi-sdk-20.0", relative = true } +WASI_SDK = { value = ".cargo/wasi-sdk-21.0", relative = true } # tree-sitter build fails with newer version of clang unless implicit-function-declaration is ignored -CC_wasm32_wasi = { value = ".cargo/wasi-sdk-20.0/bin/clang -Wno-error=implicit-function-declaration", relative = true } -AR_wasm32_wasi = { value = ".cargo/wasi-sdk-20.0/bin/ar", relative = true } +CC_wasm32_wasi = { value = ".cargo/wasi-sdk-21.0/bin/clang -Wno-error=implicit-function-declaration", relative = true } +AR_wasm32_wasi = { value = ".cargo/wasi-sdk-21.0/bin/ar", relative = true } diff --git a/libs/wingc/package.json b/libs/wingc/package.json index cad6ae5e78a..c451384f799 100644 --- a/libs/wingc/package.json +++ b/libs/wingc/package.json @@ -2,7 +2,7 @@ "name": "@winglang/wingc", "private": true, "scripts": { - "compile": "cargo build --target wasm32-wasi --release && ../../.cargo/binaryen-version_116/bin/wasm-opt --enable-bulk-memory --strip-debug --strip-producers -O3 -o wingc.wasm ../../target/wasm32-wasi/release/wingc.wasm", + "compile": "cargo build --target wasm32-wasi --release && ../../.cargo/binaryen-version_117/bin/wasm-opt --enable-bulk-memory --strip-debug --strip-producers -O3 -o wingc.wasm ../../target/wasm32-wasi/release/wingc.wasm", "dev": "cargo run --example compile --release", "test": "cargo test", "lint": "cargo fmt && cargo clippy --fix --no-deps --allow-dirty --target wasm32-wasi --release" diff --git a/libs/wingc/src/type_check/lifts.rs b/libs/wingc/src/type_check/lifts.rs index 0fb34892c25..21fec97820c 100644 --- a/libs/wingc/src/type_check/lifts.rs +++ b/libs/wingc/src/type_check/lifts.rs @@ -62,12 +62,7 @@ impl Lifts { /// Adds a lift for an expression. pub fn lift(&mut self, method: Symbol, qualification: Option, code: &str, explicit: bool) { - self.add_lift( - method.to_string(), - code, - qualification.as_ref().map(|s| s.clone()), - explicit, - ); + self.add_lift(method.to_string(), code, qualification.clone(), explicit); // Add a lift to the inflight initializer to signify this class requires access to that preflight object. // "this" is a special case since it's already in scope and doesn't need to be lifted. diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 3a72757fff3..c95f6616b11 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] profile = "default" -channel = "1.76.0" +channel = "1.77.2" targets = ["wasm32-wasi"] \ No newline at end of file diff --git a/scripts/setup_wasi.sh b/scripts/setup_wasi.sh index cc1279c8485..1016c8beb7f 100755 --- a/scripts/setup_wasi.sh +++ b/scripts/setup_wasi.sh @@ -3,8 +3,8 @@ set -eo pipefail TOOL_INSTALL_DIR="./.cargo" -BINARYEN_VERSION="version_116" -WASI_SDK_VERSION="20" +BINARYEN_VERSION="version_117" +WASI_SDK_VERSION="21" WASI_SDK_VERSION_FULL="$WASI_SDK_VERSION.0" SYS_OS=$OSTYPE From d3184b9ba745f472193565aba3fb2cd7f6a3cde4 Mon Sep 17 00:00:00 2001 From: Chris Rybicki Date: Fri, 12 Apr 2024 18:57:37 -0400 Subject: [PATCH 09/15] feat(sdk): stream logs in `wing test` (#6205) This PR introduces log streaming for the `wing test` command is used with the simulator. By default, any `log` statements printed by the user will be automatically streamed while the tests are running. (The first line of each log includes a string identifying which test it's associated with). More granular trace events from the individual resources can be displayed with the `--debug` flag. The order of logs can vary and they each include timestamps, so the `--no-stream` flag can be passed to fall back to the old output style. This is used within the monorepo in places where we're snapshotting CLI output for catching regressions. https://github.com/winglang/wing/assets/5008987/02c9e769-f6b6-4b17-8e5f-2418fcee7531 Closes #2096 ## Checklist - [x] Title matches [Winglang's style guide](https://www.winglang.io/contributing/start-here/pull_requests#how-are-pull-request-titles-formatted) - [x] Description explains motivation and solution - [x] Tests added (always) - [ ] Docs updated (only required for features) - [ ] Added `pr/e2e-full` label if this feature requires end-to-end testing *By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*. --- apps/wing/src/cli.ts | 1 + apps/wing/src/commands/spinner-stream.ts | 67 ++++ apps/wing/src/commands/test/results.ts | 8 +- apps/wing/src/commands/test/test.ts | 219 ++++++++++++- examples/tests/sdk_tests/api/post.test.w | 20 +- examples/tests/valid/resource.test.w | 9 +- .../valid/resource_captures_globals.test.w | 5 +- libs/wingsdk/src/shared/log.ts | 9 - libs/wingsdk/src/std/resource.ts | 14 +- .../src/target-sim/function.inflight.ts | 8 +- .../src/target-sim/service.inflight.ts | 23 +- tools/hangar/__snapshots__/error.ts.snap | 86 +++-- tools/hangar/__snapshots__/esm.ts.snap | 3 +- tools/hangar/__snapshots__/invalid.ts.snap | 294 +++++++----------- .../sdk_tests/api/404.test.w_test_sim.md | 3 +- .../sdk_tests/api/aws-api.test.w_test_sim.md | 3 +- .../sdk_tests/api/cors.test.w_test_sim.md | 3 +- .../sdk_tests/api/cycle.test.w_test_sim.md | 3 +- .../sdk_tests/api/delete.test.w_test_sim.md | 3 +- .../sdk_tests/api/get.test.w_test_sim.md | 11 +- .../sdk_tests/api/options.test.w_test_sim.md | 3 +- .../sdk_tests/api/patch.test.w_test_sim.md | 3 +- .../api/path_vars.test.w_test_sim.md | 3 +- .../sdk_tests/api/post.test.w_test_sim.md | 3 +- .../sdk_tests/api/put.test.w_test_sim.md | 3 +- .../bucket/add_file.test.w_test_sim.md | 3 +- .../bucket/add_object.test.w_test_sim.md | 3 +- .../bucket/aws-bucket.test.w_test_sim.md | 3 +- .../bucket/bucket_list.test.w_test_sim.md | 3 +- .../sdk_tests/bucket/copy.test.w_test_sim.md | 4 +- .../bucket/delete.test.w_test_sim.md | 4 +- .../bucket/events.test.w_test_sim.md | 3 +- .../bucket/exists.test.w_test_sim.md | 3 +- .../sdk_tests/bucket/get.test.w_test_sim.md | 7 +- .../bucket/load_test.test.w_test_sim.md | 3 +- .../bucket/metadata.test.w_test_sim.md | 4 +- .../bucket/public_url.test.w_test_sim.md | 3 +- .../sdk_tests/bucket/put.test.w_test_sim.md | 3 +- .../bucket/put_json.test.w_test_sim.md | 3 +- .../bucket/rename.test.w_test_sim.md | 4 +- .../bucket/signed_url.test.w_test_sim.md | 3 +- .../bucket/try_delete.test.w_test_sim.md | 3 +- .../bucket/try_get.test.w_test_sim.md | 3 +- .../bucket/try_get_json.test.w_test_sim.md | 3 +- .../container/container.test.w_test_sim.md | 15 +- .../counter/aws-counter.test.w_test_sim.md | 3 +- .../sdk_tests/counter/dec.test.w_test_sim.md | 3 +- .../sdk_tests/counter/inc.test.w_test_sim.md | 3 +- .../counter/initial.test.w_test_sim.md | 3 +- .../sdk_tests/counter/peek.test.w_test_sim.md | 3 +- .../sdk_tests/counter/set.test.w_test_sim.md | 3 +- .../sdk_tests/endpoint/url.test.w_test_sim.md | 3 +- .../expect/assert.test.w_test_sim.md | 3 +- .../sdk_tests/fs/basic.test.w_test_sim.md | 3 +- .../sdk_tests/fs/directory.test.w_test_sim.md | 3 +- .../sdk_tests/fs/json.test.w_test_sim.md | 3 +- .../sdk_tests/fs/options.test.w_test_sim.md | 3 +- .../sdk_tests/fs/path.test.w_test_sim.md | 3 +- .../sdk_tests/fs/stat.test.w_test_sim.md | 3 +- .../sdk_tests/fs/temp_dir.test.w_test_sim.md | 3 +- .../sdk_tests/fs/yaml.test.w_test_sim.md | 3 +- .../function/aws-function.test.w_test_sim.md | 3 +- .../function/concurrency.test.w_test_sim.md | 8 +- .../sdk_tests/function/env.test.w_test_sim.md | 3 +- .../function/function-ref.test.w_test_sim.md | 3 +- .../function/invoke.test.w_test_sim.md | 20 +- .../function/invoke_async.test.w_test_sim.md | 12 +- .../function/logging.test.w_test_sim.md | 21 +- .../memory_and_env.test.w_test_sim.md | 3 +- .../sdk_tests/http/fetch.test.w_test_sim.md | 10 +- .../sdk_tests/http/url.test.w_test_sim.md | 3 +- .../sdk_tests/math/abs.test.w_test_sim.md | 3 +- .../sdk_tests/math/acos.test.w_test_sim.md | 3 +- .../sdk_tests/math/acot.test.w_test_sim.md | 3 +- .../sdk_tests/math/acsc.test.w_test_sim.md | 3 +- .../angular_conversion.test.w_test_sim.md | 3 +- .../sdk_tests/math/asec.test.w_test_sim.md | 3 +- .../sdk_tests/math/asin.test.w_test_sim.md | 3 +- .../sdk_tests/math/atan.test.w_test_sim.md | 3 +- .../sdk_tests/math/atan2.test.w_test_sim.md | 3 +- .../math/combinations.test.w_test_sim.md | 3 +- .../sdk_tests/math/cos.test.w_test_sim.md | 3 +- .../sdk_tests/math/cot.test.w_test_sim.md | 3 +- .../sdk_tests/math/csc.test.w_test_sim.md | 3 +- .../sdk_tests/math/euler.test.w_test_sim.md | 3 +- .../math/factorial.test.w_test_sim.md | 3 +- .../math/fibonacci.test.w_test_sim.md | 3 +- .../math/floor_ceil_round.test.w_test_sim.md | 3 +- .../sdk_tests/math/hypot.test.w_test_sim.md | 3 +- .../sdk_tests/math/log.test.w_test_sim.md | 3 +- .../sdk_tests/math/log10.test.w_test_sim.md | 3 +- .../sdk_tests/math/log2.test.w_test_sim.md | 3 +- .../math/median_mode_mean.test.w_test_sim.md | 3 +- .../sdk_tests/math/min_max.test.w_test_sim.md | 3 +- .../sdk_tests/math/pi.test.w_test_sim.md | 3 +- .../sdk_tests/math/prime.test.w_test_sim.md | 3 +- .../sdk_tests/math/random.test.w_test_sim.md | 3 +- .../sdk_tests/math/sec.test.w_test_sim.md | 3 +- .../sdk_tests/math/sign.test.w_test_sim.md | 3 +- .../sdk_tests/math/sin.test.w_test_sim.md | 3 +- .../sdk_tests/math/sqrt.test.w_test_sim.md | 3 +- .../sdk_tests/math/tan.test.w_test_sim.md | 3 +- .../sdk_tests/math/tau.test.w_test_sim.md | 3 +- .../sdk_tests/math/toradix.test.w_test_sim.md | 3 +- .../misc/empty-actions.test.w_test_sim.md | 3 +- .../execute_after.test.w_test_sim.md | 3 +- .../queue/aws-queue.test.w_test_sim.md | 3 +- .../sdk_tests/queue/pop.test.w_test_sim.md | 3 +- .../sdk_tests/queue/purge.test.w_test_sim.md | 3 +- .../sdk_tests/queue/push.test.w_test_sim.md | 3 +- .../queue/queue-ref.test.w_test_sim.md | 3 +- .../queue/retention_period.main.w_test_sim.md | 3 +- .../queue/set_consumer.test.w_test_sim.md | 3 +- .../schedule/on_tick.test.w_test_sim.md | 3 +- .../service/callbacks.test.w_test_sim.md | 3 +- .../service/http-server.test.w_test_sim.md | 25 +- .../service/minimal.test.w_test_sim.md | 9 +- .../service/stateful.test.w_test_sim.md | 9 +- .../service/tokens.test.w_test_sim.md | 3 +- .../sdk_tests/state/get.test.w_test_sim.md | 3 +- .../sdk_tests/state/set.test.w_test_sim.md | 7 +- .../sdk_tests/std/array.test.w_test_sim.md | 3 +- .../sdk_tests/std/bool.test.w_test_sim.md | 3 +- .../sdk_tests/std/datetime.test.w_test_sim.md | 3 +- .../sdk_tests/std/duration.test.w_test_sim.md | 3 +- .../sdk_tests/std/json.test.w_test_sim.md | 3 +- .../sdk_tests/std/map.test.w_test_sim.md | 3 +- .../sdk_tests/std/node.test.w_test_sim.md | 3 +- .../sdk_tests/std/number.test.w_test_sim.md | 3 +- .../sdk_tests/std/range.test.w_test_sim.md | 3 +- .../sdk_tests/std/regex.test.w_test_sim.md | 3 +- .../sdk_tests/std/set.test.w_test_sim.md | 3 +- .../sdk_tests/std/string.test.w_test_sim.md | 3 +- .../sdk_tests/std/struct.test.w_test_sim.md | 3 +- .../table/add_row.test.w_test_sim.md | 3 +- .../table/aws-table.test.w_test_sim.md | 3 +- .../sdk_tests/table/get.test.w_test_sim.md | 4 +- .../sdk_tests/table/list.test.w_test_sim.md | 3 +- .../table/try_get.test.w_test_sim.md | 3 +- .../sdk_tests/table/upsert.test.w_test_sim.md | 3 +- .../topic/aws-topic.test.w_test_sim.md | 3 +- .../topic/no_blocking.test.w_test_sim.md | 3 +- .../topic/on_message.test.w_test_sim.md | 3 +- .../topic/subscribe-queue.test.w_test_sim.md | 3 +- .../sdk_tests/ui/section.test.w_test_sim.md | 3 +- .../sdk_tests/util/base64.test.w_test_sim.md | 3 +- .../sdk_tests/util/env.test.w_test_sim.md | 3 +- .../sdk_tests/util/exec.test.w_test_sim.md | 3 +- .../sdk_tests/util/nanoid.test.w_test_sim.md | 3 +- .../sdk_tests/util/os.test.w_test_sim.md | 3 +- .../sdk_tests/util/sha256.test.w_test_sim.md | 3 +- .../sdk_tests/util/shell.test.w_test_sim.md | 3 +- .../sdk_tests/util/sleep.test.w_test_sim.md | 3 +- .../sdk_tests/util/uuidv4.test.w_test_sim.md | 3 +- .../util/wait-until.test.w_test_sim.md | 3 +- .../website/aws-react-app.test.w_test_sim.md | 3 +- .../website/aws-website.test.w_test_sim.md | 3 +- .../website/react-app.test.w_test_sim.md | 3 +- .../website/two_websites.test.w_test_sim.md | 3 +- .../website/website.test.w_test_sim.md | 3 +- .../valid/anon_function.test.w_test_sim.md | 3 +- .../test_corpus/valid/api.test.w_test_sim.md | 3 +- .../valid/api_cors_custom.test.w_test_sim.md | 3 +- .../valid/api_cors_default.test.w_test_sim.md | 3 +- .../valid/api_valid_path.test.w_test_sim.md | 3 +- .../valid/assert.test.w_test_sim.md | 3 +- ...icit_await_in_functions.test.w_test_sim.md | 3 +- .../valid/bring_alias.test.w_test_sim.md | 3 +- .../valid/bring_awscdk.test.w_test_sim.md | 3 +- .../valid/bring_cdk8s.test.w_test_sim.md | 3 +- .../valid/bring_cdktf.test.w_test_sim.md | 3 +- .../bring_extend_non_entry.test.w_test_sim.md | 3 +- .../valid/bring_jsii.test.w_test_sim.md | 3 +- .../valid/bring_local.test.w_test_sim.md | 3 +- .../valid/bring_local_dir.test.w_test_sim.md | 3 +- ...ing_local_normalization.test.w_test_sim.md | 3 +- .../valid/bring_projen.test.w_test_sim.md | 3 +- .../bring_wing_library.test.w_test_sim.md | 3 +- .../valid/bucket_keys.test.w_test_sim.md | 3 +- .../valid/bypass_return.test.w_test_sim.md | 3 +- .../call_static_of_myself.test.w_test_sim.md | 3 +- ...lling_inflight_variants.test.w_test_sim.md | 3 +- .../capture_containers.test.w_test_sim.md | 3 +- .../capture_in_binary.test.w_test_sim.md | 3 +- .../valid/capture_mutables.test.w_test_sim.md | 3 +- .../capture_primitives.test.w_test_sim.md | 3 +- ...reassigable_class_field.test.w_test_sim.md | 3 +- .../capture_reassignable.test.w_test_sim.md | 3 +- ...pture_resource_and_data.test.w_test_sim.md | 3 +- ...source_with_no_inflight.test.w_test_sim.md | 3 +- .../valid/capture_tokens.test.w_test_sim.md | 3 +- .../valid/captures.test.w_test_sim.md | 3 +- .../valid/casting.test.w_test_sim.md | 3 +- .../valid/class.test.w_test_sim.md | 3 +- .../valid/closure_class.test.w_test_sim.md | 3 +- .../valid/construct-base.test.w_test_sim.md | 3 +- .../valid/container_types.test.w_test_sim.md | 3 +- .../valid/custom_obj_id.test.w_test_sim.md | 3 +- .../valid/debug_env.test.w_test_sim.md | 3 +- .../valid/deep_equality.test.w_test_sim.md | 3 +- .../valid/double_reference.test.w_test_sim.md | 3 +- .../valid/doubler.test.w_test_sim.md | 3 +- .../valid/enums.test.w_test_sim.md | 3 +- ...icit_lift_qualification.test.w_test_sim.md | 3 +- ...ssions_binary_operators.test.w_test_sim.md | 3 +- ...ns_string_interpolation.test.w_test_sim.md | 3 +- .../extern_implementation.test.w_test_sim.md | 7 +- .../valid/file_counter.test.w_test_sim.md | 3 +- .../valid/for_loop.test.w_test_sim.md | 3 +- .../valid/forward_decl.test.w_test_sim.md | 3 +- ...nction_returns_function.test.w_test_sim.md | 3 +- .../valid/function_type.test.w_test_sim.md | 3 +- ...tion_variadic_arguments.test.w_test_sim.md | 3 +- .../valid/hello.test.w_test_sim.md | 3 +- .../identical_inflights.test.w_test_sim.md | 3 +- .../valid/impl_interface.test.w_test_sim.md | 3 +- .../valid/implicit_std.test.w_test_sim.md | 3 +- .../in_scope_construct.test.w_test_sim.md | 3 +- .../valid/inference.test.w_test_sim.md | 3 +- .../inflight-subscribers.test.w_test_sim.md | 3 +- ...inflight_capture_static.test.w_test_sim.md | 7 +- ...class_as_struct_members.test.w_test_sim.md | 3 +- ...ght_class_capture_const.test.w_test_sim.md | 3 +- ...apture_preflight_object.test.w_test_sim.md | 3 +- ...light_class_definitions.test.w_test_sim.md | 3 +- ...s_inner_capture_mutable.test.w_test_sim.md | 3 +- ...inside_inflight_closure.test.w_test_sim.md | 3 +- ...nflight_class_modifiers.test.w_test_sim.md | 3 +- ...utside_inflight_closure.test.w_test_sim.md | 3 +- ...ctural_interace_handler.test.w_test_sim.md | 3 +- ...ight_class_without_init.test.w_test_sim.md | 3 +- ...inflight_closure_autoid.test.w_test_sim.md | 3 +- ...nside_preflight_closure.test.w_test_sim.md | 3 +- .../valid/inflight_concat.test.w_test_sim.md | 3 +- ...light_handler_singleton.test.w_test_sim.md | 10 +- .../valid/inflight_init.test.w_test_sim.md | 3 +- ...ights_calling_inflights.test.w_test_sim.md | 3 +- .../inherit_stdlib_class.test.w_test_sim.md | 3 +- ...eritance_class_inflight.test.w_test_sim.md | 3 +- ...ritance_class_preflight.test.w_test_sim.md | 3 +- .../inheritance_interface.test.w_test_sim.md | 3 +- .../valid/interface.test.w_test_sim.md | 3 +- .../valid/issue_2889.test.w_test_sim.md | 3 +- .../test_corpus/valid/json.test.w_test_sim.md | 3 +- .../valid/json_bucket.test.w_test_sim.md | 3 +- .../valid/json_static.test.w_test_sim.md | 3 +- ...on_string_interpolation.test.w_test_sim.md | 3 +- .../lift_expr_with_this.test.w_test_sim.md | 3 +- ...ight_closure_collection.test.w_test_sim.md | 3 +- .../lift_parent_fields.test.w_test_sim.md | 3 +- .../lift_redefinition.test.w_test_sim.md | 3 +- .../lift_shared_resource.test.w_test_sim.md | 3 +- .../valid/lift_this.test.w_test_sim.md | 3 +- .../valid/lift_via_closure.test.w_test_sim.md | 9 +- ...ft_via_closure_explicit.test.w_test_sim.md | 3 +- .../valid/lift_weird_order.test.w_test_sim.md | 3 +- .../lift_with_phase_ind.test.w_test_sim.md | 3 +- .../valid/map_entries.test.w_test_sim.md | 3 +- .../mut_container_types.test.w_test_sim.md | 3 +- ...tation_after_class_init.test.w_test_sim.md | 7 +- .../valid/new_in_static.test.w_test_sim.md | 3 +- .../valid/new_jsii.test.w_test_sim.md | 3 +- .../test_corpus/valid/nil.test.w_test_sim.md | 3 +- .../valid/on_lift.test.w_test_sim.md | 9 +- .../valid/optionals.test.w_test_sim.md | 3 +- .../nested/parameters.test.w_test_sim.md | 3 +- .../simple/parameters.test.w_test_sim.md | 3 +- ...endent_method_on_string.test.w_test_sim.md | 3 +- .../primitive_methods.test.w_test_sim.md | 3 +- .../valid/print.test.w_test_sim.md | 17 +- .../valid/reassignment.test.w_test_sim.md | 3 +- .../valid/redis.test.w_test_sim.md | 3 +- .../valid/resource.test.w_compile_tf-aws.md | 10 +- .../valid/resource.test.w_test_sim.md | 10 +- ...rce_as_inflight_literal.test.w_test_sim.md | 3 +- .../resource_call_static.test.w_test_sim.md | 3 +- .../resource_captures.test.w_test_sim.md | 11 +- ..._captures_globals.test.w_compile_tf-aws.md | 13 +- ...source_captures_globals.test.w_test_sim.md | 3 +- .../valid/service.test.w_test_sim.md | 3 +- .../valid/shadowing.test.w_test_sim.md | 3 +- .../valid/statements_if.test.w_test_sim.md | 3 +- ...s_variable_declarations.test.w_test_sim.md | 3 +- .../valid/static_members.test.w_test_sim.md | 3 +- .../valid/std_containers.test.w_test_sim.md | 3 +- .../valid/std_string.test.w_test_sim.md | 11 +- .../valid/struct_from_json.test.w_test_sim.md | 3 +- .../valid/structs.test.w_test_sim.md | 3 +- .../valid/super_call.test.w_test_sim.md | 3 +- .../valid/symbol_shadow.test.w_test_sim.md | 3 +- .../valid/table.test.w_test_sim.md | 3 +- .../valid/test_bucket.test.w_test_sim.md | 3 +- .../test_without_bring.test.w_test_sim.md | 3 +- .../test_corpus/valid/this.test.w_test_sim.md | 3 +- .../valid/try_catch.test.w_test_sim.md | 3 +- .../valid/unused_lift.test.w_test_sim.md | 3 +- ...hod_inside_init_closure.test.w_test_sim.md | 3 +- .../valid/website_with_api.test.w_test_sim.md | 3 +- .../valid/while.test.w_test_sim.md | 3 +- .../valid/while_loop_await.test.w_test_sim.md | 3 +- tools/hangar/src/generated_test_targets.ts | 7 +- tools/hangar/src/invalid.test.ts | 2 +- 302 files changed, 896 insertions(+), 945 deletions(-) create mode 100644 apps/wing/src/commands/spinner-stream.ts delete mode 100644 libs/wingsdk/src/shared/log.ts diff --git a/apps/wing/src/cli.ts b/apps/wing/src/cli.ts index 92673b6e327..0807e3aa7ae 100644 --- a/apps/wing/src/cli.ts +++ b/apps/wing/src/cli.ts @@ -205,6 +205,7 @@ async function main() { "Run tests that match the provided regex pattern within the selected entrypoint files" ) .option("--no-clean", "Keep build output") + .option("--no-stream", "Do not stream logs") .option( "-o, --output-file ", "File name to write test results to (file extension is required, supports only .json at the moment)" diff --git a/apps/wing/src/commands/spinner-stream.ts b/apps/wing/src/commands/spinner-stream.ts new file mode 100644 index 00000000000..84c20e21868 --- /dev/null +++ b/apps/wing/src/commands/spinner-stream.ts @@ -0,0 +1,67 @@ +import { WriteStream } from "tty"; +import ora from "ora"; + +/** + * A stream that can write logs and print a spinner to the terminal without + * interfering with each other. + */ +export class SpinnerStream { + private stream: WriteStream; + private spinner: ora.Ora; + private buffer: string[] = []; + private interval: NodeJS.Timeout | undefined; + private isTty: boolean; + + constructor(stream: WriteStream, text: string) { + this.stream = stream; + this.isTty = stream.isTTY; + this.spinner = ora({ stream: this.stream, text, isEnabled: false }); + if (this.isTty) { + this.interval = setInterval(() => { + this.updateSpinner(); + }, 80); + } + } + + public write(log: string): void { + if (this.isTty) { + this.buffer.push(log); + } else { + // If not a TTY, write logs directly to the stream since the spinner + // won't be displayed + this.stream.write(log); + } + } + + private updateSpinner(): void { + // Clear the spinner + this.stream.cursorTo(0); + this.stream.clearLine(1); + + // Print any logs + for (const log of this.buffer) { + this.stream.write(log); + } + this.buffer = []; + + // Redraw spinner + this.spinner.render(); + } + + public stopSpinner(): void { + if (this.isTty) { + // Stop looping + clearInterval(this.interval); + + // Clear the spinner + this.stream.cursorTo(0); + this.stream.clearLine(1); + + // Print any remaining logs + for (const log of this.buffer) { + this.stream.write(log); + } + this.buffer = []; + } + } +} diff --git a/apps/wing/src/commands/test/results.ts b/apps/wing/src/commands/test/results.ts index b0772ca1186..989c5b094d2 100644 --- a/apps/wing/src/commands/test/results.ts +++ b/apps/wing/src/commands/test/results.ts @@ -28,7 +28,6 @@ export function printResults(testResults: SingleTestResult[], duration: number) (acc, { results }) => acc + results.filter(({ pass }) => !!pass).length, 0 ); - console.log(" "); // for getting a new line- \n does't seem to work :( const areErrors = failing.length + unsupportedFiles.length > 0 && totalSum > 1; const showTitle = totalSum > 1; @@ -36,6 +35,7 @@ export function printResults(testResults: SingleTestResult[], duration: number) if (showTitle) { // prints a list of the tests names with an icon + res.push(""); res.push(`Results:`); res.push(...passing.map(({ testName }) => ` ${chalk.green("✓")} ${testName}`)); res.push(...failing.map(({ testName }) => ` ${chalk.red("×")} ${testName}`)); @@ -44,7 +44,7 @@ export function printResults(testResults: SingleTestResult[], duration: number) if (areErrors) { // prints error messages form failed tests - res.push(" "); + res.push(""); res.push("Errors:"); res.push( ...[...failing, ...unsupportedFiles].map(({ testName, results }) => @@ -61,7 +61,7 @@ export function printResults(testResults: SingleTestResult[], duration: number) } // prints a summary of how many tests passed and failed - res.push(" "); + res.push(""); const testCount = [ failingTestsNumber && chalk.red(` ${failingTestsNumber} failed`), passingTestsNumber && chalk.green(` ${passingTestsNumber} passed`), @@ -99,7 +99,7 @@ export function printResults(testResults: SingleTestResult[], duration: number) ).toFixed(2)}s` ); - console.log(res.filter((value) => !!value).join("\n")); + console.log(res.join("\n")); } export interface TestResultsJson { diff --git a/apps/wing/src/commands/test/test.ts b/apps/wing/src/commands/test/test.ts index 1a8bbc07dd3..6818c853341 100644 --- a/apps/wing/src/commands/test/test.ts +++ b/apps/wing/src/commands/test/test.ts @@ -17,6 +17,7 @@ import { SNAPSHOT_ERROR_PREFIX } from "./snapshots-help"; import { renderTestName } from "./util"; import { withSpinner } from "../../util"; import { compile, CompileOptions } from "../compile"; +import { SpinnerStream } from "../spinner-stream"; const log = debug("wing:test"); @@ -43,6 +44,10 @@ export interface TestOptions extends CompileOptions { * How many times failed tests should be retried. */ readonly retry?: number; + /** + * Whether to stream the logs of the test run. + */ + readonly stream?: boolean; /** * Determine snapshot behavior. @@ -220,7 +225,8 @@ async function executeTest( */ export async function renderTestReport( entrypoint: string, - results: std.TestResult[] + results: std.TestResult[], + includeLogs: boolean = true ): Promise { const out = new Array(); @@ -245,14 +251,15 @@ export async function renderTestReport( const details = new Array(); - // add any log messages that were emitted during the test - for (const trace of result.traces) { - // only show detailed traces if we are in debug mode - if (trace.type === TraceType.RESOURCE && process.env.DEBUG) { - details.push(chalk.gray("[trace] " + trace.data.message)); - } - if (trace.type === TraceType.LOG) { - details.push(chalk.gray(trace.data.message)); + if (includeLogs) { + for (const trace of result.traces) { + // only show detailed traces if we are in debug mode + if (trace.type === TraceType.RESOURCE && process.env.DEBUG) { + details.push(chalk.gray("[trace] " + trace.data.message)); + } + if (trace.type === TraceType.LOG) { + details.push(chalk.gray(trace.data.message)); + } } } @@ -357,9 +364,141 @@ async function runTestsWithRetry( return results; } +type TraceSeverity = "error" | "warn" | "info" | "debug" | "verbose"; + +// TODO: can we share this logic with the Wing Console? +function inferSeverityOfEvent(trace: std.Trace): TraceSeverity { + if (trace.data.status === "failure") { + return "error"; + } + if (trace.type === TraceType.LOG) { + return "info"; + } + if (trace.type === TraceType.RESOURCE) { + return "debug"; + } + if (trace.type === TraceType.SIMULATOR) { + return "verbose"; + } + return "verbose"; +} + +const SEVERITY_STRING = { + error: "[ERROR]", + warn: "[WARNING]", + info: "[INFO]", + debug: "[DEBUG]", + verbose: "[VERBOSE]", +}; + +const LOG_STREAM_COLORS = { + error: chalk.red, + warn: chalk.yellow, + info: chalk.green, + debug: chalk.blue, + verbose: chalk.gray, +}; + +async function formatTrace( + trace: std.Trace, + testName: string, + mode: "short" | "full" +): Promise { + const severity = inferSeverityOfEvent(trace); + // const pathSuffix = trace.sourcePath.split("/").slice(2).join("/"); + const date = new Date(trace.timestamp); + const hours = date.getHours().toString().padStart(2, "0"); + const minutes = date.getMinutes().toString().padStart(2, "0"); + const seconds = date.getSeconds().toString().padStart(2, "0"); + const milliseconds = date.getMilliseconds().toString().padStart(3, "0"); + const timestamp = `${hours}:${minutes}:${seconds}.${milliseconds}`; + + let msg = ""; + if (mode === "full") { + msg += chalk.dim(`[${timestamp}]`); + msg += LOG_STREAM_COLORS[severity](` ${SEVERITY_STRING[severity]}`); + msg += chalk.dim(` ${testName} » ${trace.sourcePath}`); + msg += "\n"; + if (severity === "error") { + msg += chalk.dim(" │ "); + msg += trace.data.message; + msg += "\n"; + msg += chalk.dim(" └ "); + msg += await prettyPrintError(trace.data.error, { chalk }); + } else { + msg += chalk.dim(" └ "); + msg += trace.data.message; + } + msg += "\n"; + return msg; + } else if (mode === "short") { + msg += LOG_STREAM_COLORS[severity](`${SEVERITY_STRING[severity]}`); + msg += chalk.dim(` ${testName} | `); + if (severity === "error") { + msg += trace.data.message; + msg += " "; + msg += await prettyPrintError(trace.data.error, { chalk }); + } else { + msg += trace.data.message; + } + msg += "\n"; + return msg; + } else { + throw new Error(`Unknown mode: ${mode}`); + } +} + async function testSimulator(synthDir: string, options: TestOptions) { const s = new simulator.Simulator({ simfile: synthDir }); const { clean, testFilter, retry } = options; + + let outputStream: SpinnerStream | undefined; + if (options.stream) { + outputStream = new SpinnerStream(process.stdout, "Running tests..."); + + // As of this comment, each Wing test is associated with an isolated environment. + // (All resources for test #0 are in root/env0/..., etc.) + // This means we can use the environment number to map each environment # to a test name, + // so when we receive a trace from the simulator, we can infer which test it's associated with. + const testMappings = extractTestMappings(s.listResources()); + + const printEvent = async (event: std.Trace) => { + const env = extractTestEnvFromPath(event.sourcePath); + if (env === undefined) { + // This event is not associated with any test environment, so skip it. + return; + } + const testName = testMappings[env]; + if (testName === undefined) { + // This event is not associated with any test environment, so skip it. + return; + } + if (testFilter && !testName.includes(testFilter)) { + // This test does not match the filter, so skip it. + return; + } + + const severity = inferSeverityOfEvent(event); + + // Skip debug events if DEBUG isn't set + if ((severity === "debug" || severity === "verbose") && !process.env.DEBUG) { + return; + } + + // Skip verbose events if DEBUG=verbose isn't set + if (severity === "verbose" && process.env.DEBUG !== "verbose") { + return; + } + + const formatStyle = process.env.DEBUG ? "full" : "short"; + const formatted = await formatTrace(event, testName, formatStyle); + outputStream!.write(formatted); + }; + + // TODO: support async callbacks with onTrace? + s.onTrace({ callback: (event) => void printEvent(event) }); + } + await s.start(); const testRunner = s.getResource("root/cloud.TestRunner") as std.ITestRunnerClient; @@ -370,7 +509,11 @@ async function testSimulator(synthDir: string, options: TestOptions) { await s.stop(); - const testReport = await renderTestReport(synthDir, results); + if (options.stream) { + outputStream!.stopSpinner(); + } + + const testReport = await renderTestReport(synthDir, results, !options.stream); if (testReport.length > 0) { console.log(testReport); } @@ -581,6 +724,62 @@ function sortTests(a: std.TestResult, b: std.TestResult) { return a.path.localeCompare(b.path); } +/** + * Take a path like "root/env123/foo/bar" and return the environment number (123). + */ +function extractTestEnvFromPath(path: string): number | undefined { + const parts = path.split("/"); + const envPart = parts[1]; + if (!envPart.startsWith("env")) { + return undefined; + } + return parseInt(envPart.substring(3)); +} + +/* + * Take a path like "root/env123/foo/test:first test/bar" and return "first test". + */ +function extractTestNameFromPath(path: string): string | undefined { + const parts = path.split("/"); + for (const part of parts) { + if (part.startsWith("test:")) { + return part.substring(5); + } + } + return undefined; +} + +/* + * Take a list of paths like: + * + * root/env0/foo + * root/env0/test:first test <-- this is a test + * root/env1/bar/test:second test <-- this is a test + * root/env1/bar + * + * and extract the mapping from environment indices to test names: + * + * { 0: "first test", 1: "second test" } + */ +function extractTestMappings(paths: string[]): Record { + const mappings: Record = {}; + for (const path of paths) { + const parts = path.split("/"); + if (parts.some((p) => p.startsWith("test:"))) { + const env = extractTestEnvFromPath(path); + if (env === undefined) { + continue; + } + const testName = extractTestNameFromPath(path); + if (testName === undefined) { + continue; + } + mappings[env] = testName; + } + } + return mappings; +} + const MAX_BUFFER = 10 * 1024 * 1024; /** diff --git a/examples/tests/sdk_tests/api/post.test.w b/examples/tests/sdk_tests/api/post.test.w index ab2d6c6ca7c..a1a7a95406b 100644 --- a/examples/tests/sdk_tests/api/post.test.w +++ b/examples/tests/sdk_tests/api/post.test.w @@ -19,15 +19,15 @@ api.post("/path", inflight (req: cloud.ApiRequest): cloud.ApiResponse => { test "http.post and http.fetch can preform a call to an api" { - let url = api.url + "/path"; - let response: http.Response = http.post(url, headers: { "content-type" => "application/json" }, body: Json.stringify(body)); - let fetchResponse: http.Response = http.post(url, method: http.HttpMethod.POST, headers: { "content-type" => "application/json" }, body: Json.stringify(body)); + let url = api.url + "/path"; + let response: http.Response = http.post(url, headers: { "content-type" => "application/json" }, body: Json.stringify(body)); + let fetchResponse: http.Response = http.post(url, method: http.HttpMethod.POST, headers: { "content-type" => "application/json" }, body: Json.stringify(body)); - assert(response.body == Json.stringify(body)); - assert(response.status == 200); - assert(response.url == url); + assert(response.body == Json.stringify(body)); + assert(response.status == 200); + assert(response.url == url); - assert(fetchResponse.body == Json.stringify(body)); - assert(fetchResponse.status == 200); - assert(fetchResponse.url == url); -} \ No newline at end of file + assert(fetchResponse.body == Json.stringify(body)); + assert(fetchResponse.status == 200); + assert(fetchResponse.url == url); +} diff --git a/examples/tests/valid/resource.test.w b/examples/tests/valid/resource.test.w index f72314d27a2..b450342f131 100644 --- a/examples/tests/valid/resource.test.w +++ b/examples/tests/valid/resource.test.w @@ -1,4 +1,5 @@ bring cloud; +bring util; // User defined resource class Foo { @@ -139,8 +140,12 @@ let bigOlPublisher = new BigPublisher(); test "dependency cycles" { bigOlPublisher.publish("foo"); - let count = bigOlPublisher.getObjectCount(); - // assert(count == 2); // TODO: This fails due to issue: https://github.com/winglang/wing/issues/2082 + + util.waitUntil(inflight () => { + let count = bigOlPublisher.getObjectCount(); + return count == 2; + }); + assert(bigOlPublisher.getObjectCount() == 2); } // Scope and ID tests diff --git a/examples/tests/valid/resource_captures_globals.test.w b/examples/tests/valid/resource_captures_globals.test.w index d15a6f00acb..765903ac005 100644 --- a/examples/tests/valid/resource_captures_globals.test.w +++ b/examples/tests/valid/resource_captures_globals.test.w @@ -1,4 +1,5 @@ bring cloud; +bring util; let globalBucket = new cloud.Bucket(); let globalCounter = new cloud.Counter(); @@ -72,7 +73,9 @@ class MyResource { globalAnother.first.myResource.put("key", "value"); assert(globalAnother.myMethod() > 0); assert(Another.myStaticMethod() > 0); - //assert(this.localCounter.peek() > 0); // TODO: this fails, why? + util.waitUntil(inflight () => { + return this.localCounter.peek() > 0; + }); } } diff --git a/libs/wingsdk/src/shared/log.ts b/libs/wingsdk/src/shared/log.ts deleted file mode 100644 index 330ee679bc3..00000000000 --- a/libs/wingsdk/src/shared/log.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Emits a log message to the console if the DEBUG environment variable is set. - * @param args Arguments to pass to console.error. - */ -export function log(...args: any[]) { - if (process.env.DEBUG) { - console.error(...args); - } -} diff --git a/libs/wingsdk/src/std/resource.ts b/libs/wingsdk/src/std/resource.ts index 5df01e17178..f8bfe10f039 100644 --- a/libs/wingsdk/src/std/resource.ts +++ b/libs/wingsdk/src/std/resource.ts @@ -1,7 +1,6 @@ import { Construct, IConstruct } from "constructs"; import { App, LiftDepsMatrixRaw } from "../core"; import { AbstractMemberError } from "../core/errors"; -import { log } from "../shared/log"; import { Node } from "../std"; /** @@ -138,11 +137,8 @@ export abstract class Resource extends Construct implements IResource { * other capabilities to the inflight host. */ public static onLiftType(host: IInflightHost, ops: string[]): void { - log( - `onLiftType called on a resource type (${ - this.constructor.name - }) with a host (${host.node.path}) and ops: ${JSON.stringify(ops)}` - ); + host; + ops; } /** @@ -198,12 +194,6 @@ export abstract class Resource extends Construct implements IResource { * actually bound. */ public onLift(host: IInflightHost, ops: string[]): void { - log( - `onLift called on a resource (${this.node.path}) with a host (${ - host.node.path - }) and ops: ${JSON.stringify(ops)}` - ); - for (const op of ops) { // Add connection metadata Node.of(this).addConnection({ diff --git a/libs/wingsdk/src/target-sim/function.inflight.ts b/libs/wingsdk/src/target-sim/function.inflight.ts index 27c74bb9295..f78d71f51be 100644 --- a/libs/wingsdk/src/target-sim/function.inflight.ts +++ b/libs/wingsdk/src/target-sim/function.inflight.ts @@ -115,7 +115,7 @@ export class Function implements IFunctionClient, ISimulatorResourceInstance { private async createBundle(): Promise { this.bundle = await Sandbox.createBundle(this.originalFile, (msg) => { - this.addTrace(msg); + this.addTrace(msg, TraceType.SIMULATOR); }); } @@ -158,15 +158,15 @@ export class Function implements IFunctionClient, ISimulatorResourceInstance { }, timeout: this.timeout, log: (internal, _level, message) => { - this.addTrace(message, internal); + this.addTrace(message, internal ? TraceType.SIMULATOR : TraceType.LOG); }, }); } - private addTrace(message: string, internal: boolean = true) { + private addTrace(message: string, type: TraceType) { this.context.addTrace({ data: { message }, - type: internal ? TraceType.RESOURCE : TraceType.LOG, + type, sourcePath: this.context.resourcePath, sourceType: FUNCTION_FQN, timestamp: new Date().toISOString(), diff --git a/libs/wingsdk/src/target-sim/service.inflight.ts b/libs/wingsdk/src/target-sim/service.inflight.ts index 908a4b5172c..5531e34a23f 100644 --- a/libs/wingsdk/src/target-sim/service.inflight.ts +++ b/libs/wingsdk/src/target-sim/service.inflight.ts @@ -38,7 +38,7 @@ export class Service implements IServiceClient, ISimulatorResourceInstance { this.bundle = await Sandbox.createBundle( this.resolvedSourceCodeFile, (msg) => { - this.addTrace(msg); + this.addTrace(msg, TraceType.SIMULATOR); } ); } @@ -75,7 +75,10 @@ export class Service implements IServiceClient, ISimulatorResourceInstance { await this.createBundlePromise; if (!this.bundle) { - this.addTrace("Failed to start service: bundle is not created"); + this.addTrace( + "Failed to start service: bundle is not created", + TraceType.RESOURCE + ); return; } @@ -86,7 +89,7 @@ export class Service implements IServiceClient, ISimulatorResourceInstance { WING_SIMULATOR_CALLER: this.context.resourceHandle, }, log: (internal, _level, message) => { - this.addTrace(message, internal); + this.addTrace(message, internal ? TraceType.SIMULATOR : TraceType.LOG); }, }); @@ -94,7 +97,10 @@ export class Service implements IServiceClient, ISimulatorResourceInstance { await this.sandbox.call("start"); this.running = true; } catch (e: any) { - this.addTrace(`Failed to start service: ${e.message}`); + this.addTrace( + `Failed to start service: ${e.message}`, + TraceType.RESOURCE + ); } } @@ -110,7 +116,10 @@ export class Service implements IServiceClient, ISimulatorResourceInstance { await this.sandbox.call("stop"); await this.sandbox.cleanup(); } catch (e: any) { - this.addTrace(`Failed to stop service: ${e.message} ${e.stack}`); + this.addTrace( + `Failed to stop service: ${e.message} ${e.stack}`, + TraceType.RESOURCE + ); } } @@ -118,10 +127,10 @@ export class Service implements IServiceClient, ISimulatorResourceInstance { return this.running; } - private addTrace(message: string, internal: boolean = true) { + private addTrace(message: string, type: TraceType) { this.context.addTrace({ data: { message }, - type: internal ? TraceType.RESOURCE : TraceType.LOG, + type, sourcePath: this.context.resourcePath, sourceType: SERVICE_FQN, timestamp: new Date().toISOString(), diff --git a/tools/hangar/__snapshots__/error.ts.snap b/tools/hangar/__snapshots__/error.ts.snap index b7eb0d6b4f2..93b2022a29f 100644 --- a/tools/hangar/__snapshots__/error.ts.snap +++ b/tools/hangar/__snapshots__/error.ts.snap @@ -10,8 +10,7 @@ exports[`bool_from_json.test.w 1`] = ` 5 | let a: bool = bool.fromJson(j.get(\\"a\\")); | ^ at /bool_from_json.test.w:5:15 - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -19,7 +18,52 @@ Duration " `; exports[`inflight_stacktraces.test.w 1`] = ` -"fail ┌ inflight_stacktraces.test.wsim » root/env0/test:assert +"[ERROR] assert | Invoke (payload=undefined). Error: assertion failed: false + --> ../../../examples/tests/error/inflight_stacktraces.test.w:7:3 + | let bucket = new cloud.Bucket(); + | + | test \\"assert\\" { +7 | assert(false); + | ^ +at /inflight_stacktraces.test.w:7:3 +[ERROR] expect.equal | Invoke (payload=undefined). Error: Expected values to be strictly deep-equal: + +1 !== 2 + + --> ../../../examples/tests/error/inflight_stacktraces.test.w:11:3 + | } + | + | test \\"expect.equal\\" { +11 | expect.equal(1,2 ); + | ^ +at /inflight_stacktraces.test.w:11:3 +[ERROR] bucket failed get | Get (key=doesn't exist). Error: Object does not exist (key=doesn't exist): Error: ENOENT: no such file or directory, open '../../../examples/tests/error/target/test/inflight_stacktraces.test.wsim/.state/' +[ERROR] bucket failed get | Invoke (payload=undefined). Error: Object does not exist (key=doesn't exist): Error: ENOENT: no such file or directory, open '../../../examples/tests/error/target/test/inflight_stacktraces.test.wsim/.state/' + --> ../../../examples/tests/error/inflight_stacktraces.test.w:15:3 + | } + | + | test \\"bucket failed get\\" { +15 | bucket.get(\\"doesn't exist\\"); + | ^ +at /inflight_stacktraces.test.w:15:3 +[ERROR] throw from closure | Invoke (payload=undefined). Error: ouch + --> ../../../examples/tests/error/inflight_stacktraces.test.w:20:5 + | + | test \\"throw from closure\\" { + | let closure = inflight () => { +20 | throw \\"ouch\\"; + | ^ +at closure /inflight_stacktraces.test.w:20:5 +at /inflight_stacktraces.test.w:22:3 +[ERROR] assert with message | Invoke (payload=undefined). Error: assertion failed: x is false + --> ../../../examples/tests/error/inflight_stacktraces.test.w:27:3 + | + | test \\"assert with message\\" { + | let x = false; +27 | assert(x, \\"x is false\\"); + | ^ +at /inflight_stacktraces.test.w:27:3 +fail ┌ inflight_stacktraces.test.wsim » root/env0/test:assert │ Error: assertion failed: false │ --> ../../../examples/tests/error/inflight_stacktraces.test.w:7:3 │ | let bucket = new cloud.Bucket(); @@ -68,8 +112,7 @@ fail ┌ inflight_stacktraces.test.wsim » root/env4/test:assert with message │ 27 | assert(x, \\"x is false\\"); │ | ^ └ at /inflight_stacktraces.test.w:27:3 - - + Tests 5 failed (5) Snapshots 1 skipped Test Files 1 failed (1) @@ -84,8 +127,7 @@ exports[`num_from_str.test.w 1`] = ` 3 | let a: num = num.fromStr(\\"123a\\"); | ^ at /num_from_str.test.w:3:14 - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -102,8 +144,7 @@ exports[`number_from_json.test.w 1`] = ` 5 | let a: num = num.fromJson(j.get(\\"a\\")); | ^ at /number_from_json.test.w:5:14 - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -125,8 +166,7 @@ For more information, see https://www.winglang.io/docs/concepts/application-tree 4 | let bucket2 = new cloud.Bucket(); | ^ at /repeat_construct_id.test.w:4:15 - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -148,8 +188,7 @@ For more information, see https://www.winglang.io/docs/concepts/application-tree 8 | let bucket2 = new cloud.Bucket() as \\"{make_name()}\\"; | ^ at /repeat_construct_id2.test.w:8:15 - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -166,8 +205,7 @@ exports[`string_from_json.test.w 1`] = ` 5 | let a: str = str.fromJson(j.get(\\"a\\")); | ^ at /string_from_json.test.w:5:14 - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -184,8 +222,7 @@ exports[`struct_from_json_1.test.w 1`] = ` 11 | Person.fromJson(j); | ^ at /struct_from_json_1.test.w:11:1 - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -203,8 +240,7 @@ exports[`struct_from_json_2.test.w 1`] = ` 22 | Student.fromJson(missingAdvisor); | ^ at /struct_from_json_2.test.w:22:1 - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -222,8 +258,7 @@ exports[`struct_from_json_3.test.w 1`] = ` 26 | Student.fromJson(invalidAdvisorInArray); | ^ at /struct_from_json_3.test.w:26:1 - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -240,8 +275,7 @@ exports[`struct_from_json_4.test.w 1`] = ` 27 | Student.fromJson(invalidAdvisorInArray); | ^ at /struct_from_json_4.test.w:27:1 - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -258,8 +292,7 @@ exports[`struct_from_json_5.test.w 1`] = ` 16 | Foo.fromJson(jFoo); | ^ at /struct_from_json_5.test.w:16:1 - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -272,8 +305,7 @@ exports[`utilities.test.w 1`] = ` 1 | assert(false); | ^ at /utilities.test.w:1:1 - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) diff --git a/tools/hangar/__snapshots__/esm.ts.snap b/tools/hangar/__snapshots__/esm.ts.snap index f6b91a26c34..f0e50ebf2c2 100644 --- a/tools/hangar/__snapshots__/esm.ts.snap +++ b/tools/hangar/__snapshots__/esm.ts.snap @@ -2,8 +2,7 @@ exports[`tests module package type 1`] = ` "pass ─ module_type.test.wsim » root/env0/test:run extern - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/invalid.ts.snap b/tools/hangar/__snapshots__/invalid.ts.snap index 5062b1cd65b..c6e91e56f28 100644 --- a/tools/hangar/__snapshots__/invalid.ts.snap +++ b/tools/hangar/__snapshots__/invalid.ts.snap @@ -8,8 +8,7 @@ exports[`access_hidden_namespace.test.w 1`] = ` | ^^^^ Unknown symbol \\"core\\" - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -291,8 +290,7 @@ error: Cannot access private member \\"private_static_method\\" of \\"Foo\\" = hint: the definition of \\"private_static_method\\" needs a broader access modifier like \\"pub\\" or \\"protected\\" to be used outside of \\"Foo\\" - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -362,8 +360,7 @@ error: Expected identifier \\"subdir2\\" to be a variable, but it's a namespace | ^^^^^^^ Expected identifier \\"subdir2\\" to be a variable, but it's a namespace - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -406,8 +403,7 @@ error: Member \\"f\\" doesn't exist in \\"Construct\\" | ^ Member \\"f\\" doesn't exist in \\"Construct\\" - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -423,8 +419,7 @@ exports[`ambiguous_api_paths.test.w 1`] = ` 12 | api.get(\\"/:variable\\", handler); | ^ at /ambiguous_api_paths.test.w:12:1 - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -460,8 +455,7 @@ error: \\"cloud\\" is already defined | ^^^^^ \\"cloud\\" is already defined - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -478,8 +472,7 @@ error: Cannot bring Wing directories that contain invalid characters: \\"in.vali error: Cannot bring Wing directories that contain invalid characters: \\"not-valid\\" - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -501,8 +494,7 @@ error: Unable to load \\"foobar\\": Module not found in \\"/bring_jsii | ^^^^^^^^^^^^^^^^^^^^^^ Unable to load \\"foobar\\": Module not found in \\"/bring_jsii.test.w\\" - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -531,8 +523,7 @@ error: Symbol \\"Foo\\" has multiple definitions in \\"/inner\\" | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Symbol \\"Foo\\" has multiple definitions in \\"/inner\\" - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -568,8 +559,7 @@ error: Cannot bring module \\"./bring_local_dir.test.w\\" since it is an entrypo | ^^^^^^^^^^^^^^^^^^^^^^^^^^ Cannot bring module \\"./bring_local_dir.test.w\\" since it is an entrypoint file - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -605,8 +595,7 @@ error: Preflight field \\"x\\" is not initialized | ^ Preflight field \\"x\\" is not initialized - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -635,8 +624,7 @@ error: Cannot set scope of non-standard preflight class \\"S3Backend\\" using \` | ^^^^ Cannot set scope of non-standard preflight class \\"S3Backend\\" using \`in\` - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -672,8 +660,7 @@ error: Expected type to be \\"num\\", but got \\"str\\" instead | ^^^ Expected type to be \\"num\\", but got \\"str\\" instead - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -695,8 +682,7 @@ error: Cannot call into inflight phase while preflight | ^^^^^^^^ Cannot call into inflight phase while preflight - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -725,8 +711,7 @@ error: Cannot access \\"x\\" because it is shadowed by another symbol with the s | ^ Cannot access \\"x\\" because it is shadowed by another symbol with the same name - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -1059,8 +1044,7 @@ error: Expected type to be \\"str\\", but got \\"num\\" instead | ^ Expected type to be \\"str\\", but got \\"num\\" instead - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -1091,8 +1075,7 @@ error: Expected type to be \\"inflight (message: str): void\\", but got \\"infli | \\\\-^ Expected type to be \\"inflight (message: str): void\\", but got \\"inflight (x: num): unknown\\" instead - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -1282,8 +1265,7 @@ error: Member \\"copyMut\\" doesn't exist in \\"MutSet\\" | ^^^^^^^ Member \\"copyMut\\" doesn't exist in \\"MutSet\\" - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -1311,8 +1293,7 @@ error: Could not type check \\"/cyclic_bring3.w\\" due to cyclic bring | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Could not type check \\"/cyclic_bring3.w\\" due to cyclic bring statements - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -1340,8 +1321,7 @@ error: Could not type check \\"/cyclic_bring1.w\\" due to cyclic bring | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Could not type check \\"/cyclic_bring1.w\\" due to cyclic bring statements - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -1369,8 +1349,7 @@ error: Could not type check \\"/cyclic_bring2.w\\" due to cyclic bring | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Could not type check \\"/cyclic_bring2.w\\" due to cyclic bring statements - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -1385,8 +1364,7 @@ exports[`diags_with_multibyte_chars.test.w 1`] = ` | ^^^^ Unknown symbol \\"asdf\\" - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -1408,8 +1386,7 @@ error: Property not found | ^^^ Property not found - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -1487,8 +1464,7 @@ error: Expression of type \\"IPreflightInterface\\" references an unknown prefli | ^ Expression of type \\"IPreflightInterface\\" references an unknown preflight object, can't qualify its capabilities. Use \`lift()\` to explicitly qualify the preflight object to disable this error. - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -1503,8 +1479,7 @@ exports[`extern.test.w 1`] = ` | ^^^^^^^^^^^^^^^^^ File not found: \\"./sad.js\\" - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -1519,8 +1494,7 @@ exports[`extern_static.test.w 1`] = ` | ^^^^^^^^^^^ Extern methods must be declared \\"static\\" (they cannot access instance members) - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -1556,8 +1530,7 @@ error: Preflight field \\"x\\" is not initialized | ^ Preflight field \\"x\\" is not initialized - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -1579,8 +1552,7 @@ error: Unable to iterate over \\"Bucket\\" | ^^^^^^ Unable to iterate over \\"Bucket\\" - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -1672,8 +1644,7 @@ error: Expected type to be \\"bool\\", but got \\"num\\" instead | ^ Expected type to be \\"bool\\", but got \\"num\\" instead - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -1709,8 +1680,7 @@ error: Expected type to be \\"str\\", but got \\"Array\\" instead | ^^^^^^^^^^^^^^^ Expected type to be \\"str\\", but got \\"Array\\" instead - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -1739,8 +1709,7 @@ error: Optional parameters must always be after all non-optional parameters. | ^ Optional parameters must always be after all non-optional parameters. - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -1797,8 +1766,7 @@ error: Expected type to be \\"Bucket\\", but got \\"bool\\" instead | ^^^^ Expected type to be \\"Bucket\\", but got \\"bool\\" instead - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -1890,8 +1858,7 @@ error: Expected type to be \\"preflight (construct: IConstruct): Node\\", but go | ^^^ Expected type to be \\"preflight (construct: IConstruct): Node\\", but got \\"str\\" instead - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -1990,8 +1957,7 @@ error: Expected type to be \\"bool\\", but got \\"Array\\" instead | ^^^ Expected type to be \\"bool\\", but got \\"Array\\" instead - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -2041,8 +2007,7 @@ error: Class \\"r\\" does not implement method \\"method3\\" of interface \\"I3\ | ^ Class \\"r\\" does not implement method \\"method3\\" of interface \\"I3\\" - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -2236,8 +2201,7 @@ error: Unable to infer type | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Unable to infer type - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -2280,8 +2244,7 @@ error: Cannot qualify access to a lifted type \\"PreflightClass\\" (see https:// | ^^^^^^^^^^^^^^ Cannot qualify access to a lifted type \\"PreflightClass\\" (see https://github.com/winglang/wing/issues/76 for more details) - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -2298,8 +2261,7 @@ exports[`inflight_class_dup_init.test.w 1`] = ` | \\\\---^ Multiple inflight initializers defined in class Foo - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -2314,8 +2276,7 @@ exports[`inflight_class_in_preflight.test.w 1`] = ` | ^^^^^^^^^ Cannot create inflight class \\"Foo\\" in preflight phase - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -2330,8 +2291,7 @@ exports[`inflight_class_interface_structural_typing.test.w 1`] = ` | ^^^^^^^^^^^^ Expected type to be \\"IGoo\\", but got \\"NotGoo\\" instead - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -2356,8 +2316,7 @@ error: Variable is not reassignable | ^^^^ Variable is not reassignable - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -2386,8 +2345,7 @@ error: Expression of type \\"Bucket\\" references an unknown preflight object, c | ^ Expression of type \\"Bucket\\" references an unknown preflight object, can't qualify its capabilities. Use \`lift()\` to explicitly qualify the preflight object to disable this error. - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -2409,8 +2367,7 @@ error: Expression of type \\"Queue\\" references an unknown preflight object, ca | ^^ Expression of type \\"Queue\\" references an unknown preflight object, can't qualify its capabilities. Use \`lift()\` to explicitly qualify the preflight object to disable this error. - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -2432,8 +2389,7 @@ error: Expression of type \\"Bucket\\" references an unknown preflight object, c | ^ Expression of type \\"Bucket\\" references an unknown preflight object, can't qualify its capabilities. Use \`lift()\` to explicitly qualify the preflight object to disable this error. - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -2573,8 +2529,7 @@ error: Expected type to be \\"preflight (): void\\", but got \\"inflight (): voi = hint: expected phase to be preflight, but got inflight instead - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -2599,8 +2554,7 @@ exports[`issue_2767.test.w 1`] = ` | ^^^^^^^^^^^^^^^^^^ Expected type to be \\"MutJson\\", but got \\"Bucket\\" instead - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -2617,8 +2571,7 @@ exports[`jsii_access_modifiers.test.w 1`] = ` = hint: the definition of \\"createTopic\\" needs a broader access modifier like \\"pub\\" to be used outside of \\"Bucket\\" - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -2775,8 +2728,7 @@ error: \\"Bucket\\" is not a legal JSON value | ^^^^^^^^^^^^^^^^^^ \\"Bucket\\" is not a legal JSON value - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -2791,8 +2743,7 @@ exports[`json_static.test.w 1`] = ` | ^^^ Member \\"set\\" doesn't exist in \\"Json\\" - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -2807,8 +2758,7 @@ exports[`map_entries.test.w 1`] = ` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Expected type to be \\"str\\", but got \\"num\\" instead - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -2852,8 +2802,7 @@ error: A function whose return type is \\"str\\" must return a value. | \\\\-^ A function whose return type is \\"str\\" must return a value. - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -2882,8 +2831,7 @@ error: Expected '}' | ^ Expected '}' - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -2975,8 +2923,7 @@ error: Expected type to be \\"MutMap\\", but got \\"MutMap\\" instead | ^^ Expected type to be \\"MutMap\\", but got \\"MutMap\\" instead - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -3023,8 +2970,7 @@ error: Expected type to be \\"num\\", but got \\"nil\\" instead = hint: to allow \\"nil\\" assignment use optional type: \\"num?\\" - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -3161,8 +3107,7 @@ error: Variable is not reassignable | ^^ Variable is not reassignable - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -3179,8 +3124,7 @@ User invoked panic'), please report at https://www.winglang.io/contributing/star User invoked panic'), please report at https://www.winglang.io/contributing/start-here/bugs - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -3195,8 +3139,7 @@ exports[`parameters.test.w 1`] = ` (hint: make sure to use --values to provide the required parameters file) - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -3247,8 +3190,7 @@ error: Expected type to be \\"preflight (inflight (str): str): void\\", but got | ^^^^^^^^ Expected type to be \\"preflight (inflight (str): str): void\\", but got \\"preflight (inner_fn: preflight (preflight (str): str): void): void\\" instead - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -3263,8 +3205,7 @@ exports[`preflight_from_inflight.test.w 1`] = ` | ^^^^^^^^^^^^^^^^^^^^ Cannot call into preflight phase while inflight - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -3300,8 +3241,7 @@ error: Expected type to be \\"str\\", but got \\"num\\" instead | ^^^^^^^^^ Expected type to be \\"str\\", but got \\"num\\" instead - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -3337,8 +3277,7 @@ error: Enums must be public (\\"pub\\") or private | ^^^^^^^^^ Enums must be public (\\"pub\\") or private - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -3394,8 +3333,7 @@ error: Variable is not reassignable | ^^^ Variable is not reassignable - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -3524,8 +3462,7 @@ error: Multiple or ambiguous modifiers found | possible redundant modifier - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -3540,8 +3477,7 @@ exports[`resource_access_field_as_method.test.w 1`] = ` | ^^^^^^ Expected a function or method, found \\"str\\" - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -3556,8 +3492,7 @@ exports[`resource_captures.test.w 1`] = ` | ^ Expression of type \\"Bucket\\" references an unknown preflight object, can't qualify its capabilities. Use \`lift()\` to explicitly qualify the preflight object to disable this error. - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -3579,8 +3514,7 @@ error: Cannot qualify access to a lifted type \\"Bucket\\" (see https://github.c | ^^^^^^^^^^^^ Cannot qualify access to a lifted type \\"Bucket\\" (see https://github.com/winglang/wing/issues/76 for more details) - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -3616,8 +3550,7 @@ error: Inflight initializers cannot have parameters | ^^^^^^^^ Inflight initializers cannot have parameters - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -3660,8 +3593,7 @@ error: Unexpected return value from void function. Return type annotations are r | ^^^^^^^^^ Unexpected return value from void function. Return type annotations are required for methods. - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -3697,8 +3629,7 @@ error: Inflight classes cannot have a scope | ^^ Inflight classes cannot have a scope - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -3706,7 +3637,23 @@ Duration " `; exports[`simulator_permissions.test.w 1`] = ` -"fail ┌ simulator_permissions.test.wsim » root/env0/test:incorrect resource permission +"[ERROR] incorrect resource permission | Invoke (payload=undefined). Error: Resource \\"root/env0/test:incorrect resource permission/Handler\\" does not have permission to perform operation \\"put\\" on resource \\"root/env0/b1\\". + --> ../../../examples/tests/invalid/simulator_permissions.test.w:15:3 + | while i > 0 { + | i -= 1; + | } +15 | buckets.at(i).put(\\"key\\", \\"value\\"); + | ^ +at /simulator_permissions.test.w:15:3 +[ERROR] incorrect permission operation | Invoke (payload=undefined). Error: Resource \\"root/env1/test:incorrect permission operation/Handler\\" does not have permission to perform operation \\"put\\" on resource \\"root/env1/b1\\". + --> ../../../examples/tests/invalid/simulator_permissions.test.w:25:3 + | while i > 0 { + | i -= 1; + | } +25 | buckets.at(i).put(\\"key\\", \\"value\\"); + | ^ +at /simulator_permissions.test.w:25:3 +fail ┌ simulator_permissions.test.wsim » root/env0/test:incorrect resource permission │ Error: Resource \\"root/env0/test:incorrect resource permission/Handler\\" does not have permission to perform operation \\"put\\" on resource \\"root/env0/b1\\". │ --> ../../../examples/tests/invalid/simulator_permissions.test.w:15:3 │ | while i > 0 { @@ -3724,8 +3671,7 @@ fail ┌ simulator_permissions.test.wsim » root/env1/test:incorrect permission │ 25 | buckets.at(i).put(\\"key\\", \\"value\\"); │ | ^ └ at /simulator_permissions.test.w:25:3 - - + Tests 2 failed (2) Snapshots 1 skipped Test Files 1 failed (1) @@ -3761,8 +3707,7 @@ error: Expected \\"b\\" to be a type but it's a variable | ^ Expected \\"b\\" to be a type but it's a variable - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -3798,8 +3743,7 @@ error: Expected continue statement to be inside of a loop (while/for) | ^^^^^^^^^ Expected continue statement to be inside of a loop (while/for) - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -3828,8 +3772,7 @@ error: Expected type to be \\"bool\\", but got \\"num\\" instead | ^ Expected type to be \\"bool\\", but got \\"num\\" instead - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -3844,8 +3787,7 @@ exports[`std_containers.test.w 1`] = ` | ^ Expected type to be \\"Array\\", but got \\"Array\\" instead - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -3871,8 +3813,7 @@ error: Expected type to be stringable, but got \\"str?\\" instead = hint: str? is an optional, try unwrapping it with 'x ?? \\"nil\\"' or 'x!' - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -3934,8 +3875,7 @@ error: Expected between 2 and 3 positional arguments or named arguments for the | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Expected between 2 and 3 positional arguments or named arguments for the last parameter but got 1 - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -3954,8 +3894,7 @@ exports[`struct_from_parameter.test.w 1`] = ` 14 | MyParams.fromJson(app.parameters.read()); | ^ at /struct_from_parameter.test.w:14:1 - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -3984,8 +3923,7 @@ error: Struct \\"C\\" contains field \\"b\\" which cannot be represented in Json | ^^^^^^^^ Struct \\"C\\" contains field \\"b\\" which cannot be represented in Json - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -4056,8 +3994,7 @@ error: struct \\"InflightStruct\\" must be declared at the top-level of a file | ^^^^^^^^^^^^^^ struct \\"InflightStruct\\" must be declared at the top-level of a file - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -4121,8 +4058,7 @@ error: \`super\` calls inside inflight closures not supported yet, see: https:// | ^^ \`super\` calls inside inflight closures not supported yet, see: https://github.com/winglang/wing/issues/3474 - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -4137,8 +4073,7 @@ exports[`this.w 1`] = ` | ^^^^ Unknown symbol \\"this\\" - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -4153,8 +4088,7 @@ exports[`throw_non_string.test.w 1`] = ` | ^^ Expected type to be \\"str\\", but got \\"num\\" instead - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -4171,8 +4105,7 @@ exports[`try_no_catch_or_finally.test.w 1`] = ` | \\\\-^ Missing \`catch\` or \`finally\` blocks for this try statement - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -4208,8 +4141,7 @@ error: Expected type to be \\"num\\", but got \\"str\\" instead | ^ Expected type to be \\"num\\", but got \\"str\\" instead - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -4252,8 +4184,7 @@ error: Unable to infer type | ^^^^^^^^^^^ Unable to infer type - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -4268,8 +4199,7 @@ exports[`unknown_field.test.w 1`] = ` | ^ Member \\"a\\" doesn't exist in \\"String\\" - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -4284,8 +4214,7 @@ exports[`unknown_submodule.test.w 1`] = ` | ^^^ Expected identifier \\"std\\" to be a variable, but it's a namespace - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -4363,8 +4292,7 @@ error: Member \\"methodWhichIsNotPartOfBucketApi\\" doesn't exist in \\"Bucket\\ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Member \\"methodWhichIsNotPartOfBucketApi\\" doesn't exist in \\"Bucket\\" - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -4373,8 +4301,7 @@ Duration " exports[`unresolved_state.test.w 1`] = ` "Could not start resource after 10 attempts: Unable to resolve attribute 'my_unresolved_token' for resource: root/env0/State - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -4399,8 +4326,7 @@ error: Symbol \\"x\\" used before being defined | - defined later here - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -4415,8 +4341,7 @@ exports[`variable_scoping.test.w 1`] = ` | ^ Unknown symbol \\"x\\" - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) @@ -4468,8 +4393,7 @@ error: Expected type to be \\"str?\\", but got \\"void\\" instead | ^^^^^^^^^^^^^^^^^ Expected type to be \\"str?\\", but got \\"void\\" instead - - + Tests 1 failed (1) Snapshots 1 skipped Test Files 1 failed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/404.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/404.test.w_test_sim.md index 616ff538951..5f3d48000e7 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/404.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/404.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ 404.test.wsim » root/env0/test:it responds with 404 - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/aws-api.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/aws-api.test.w_test_sim.md index c03741d898b..5e2d2d2be43 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/aws-api.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/aws-api.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ aws-api.test.wsim » root/env0/test:validates the AWS Api - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/cors.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/cors.test.w_test_sim.md index 4ef6b7a7ab7..d355026ca61 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/cors.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/cors.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ cors.test.wsim » root/env0/test:http.get and http.fetch can preform a call to an api - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/cycle.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/cycle.test.w_test_sim.md index efd9d9e677d..1d76cde28be 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/cycle.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/cycle.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ cycle.test.wsim » root/env0/test:GET --my_url - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/delete.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/delete.test.w_test_sim.md index 4bb9523e177..9cd456c6c19 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/delete.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/delete.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ delete.test.wsim » root/env0/test:http.delete and http.fetch can preform a call to an api - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/get.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/get.test.w_test_sim.md index 92007ebd13f..6f39028d26f 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/get.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/get.test.w_test_sim.md @@ -2,12 +2,11 @@ ## stdout.log ```log -pass ┌ get.test.wsim » root/env0/test:http.get and http.fetch can preform a call to an api - │ 200 ok - │ - └ ok - - +[INFO] http.get and http.fetch can preform a call to an api | 200 ok +[INFO] http.get and http.fetch can preform a call to an api | +[INFO] http.get and http.fetch can preform a call to an api | ok +pass ─ get.test.wsim » root/env0/test:http.get and http.fetch can preform a call to an api + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/options.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/options.test.w_test_sim.md index 1a4e9733a1c..ec3e7ff1394 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/options.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/options.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ options.test.wsim » root/env0/test:http.fetch can preform a call to an api to CONNECT, HEAD and OPTIONS - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/patch.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/patch.test.w_test_sim.md index ac78893d0ea..a16d6faf817 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/patch.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/patch.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ patch.test.wsim » root/env0/test:http.patch and http.fetch can preform a call to an api - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/path_vars.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/path_vars.test.w_test_sim.md index 94f395c227d..dea00da1a3e 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/path_vars.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/path_vars.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ path_vars.test.wsim » root/env0/test:path vars are valid - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/post.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/post.test.w_test_sim.md index 967e70e3730..8aa8d6a84b8 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/post.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/post.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ post.test.wsim » root/env0/test:http.post and http.fetch can preform a call to an api - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/put.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/put.test.w_test_sim.md index 1f8b51d3d3b..2fdc87a96c8 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/put.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/put.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ put.test.wsim » root/env0/test:http.put and http.fetch can preform a call to an api - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/add_file.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/add_file.test.w_test_sim.md index ab2f9109807..2375c7ad548 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/add_file.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/add_file.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ add_file.test.wsim » root/env0/test:addObject - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/add_object.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/add_object.test.w_test_sim.md index dee71d164df..7a60dbc2dcc 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/add_object.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/add_object.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ add_object.test.wsim » root/env0/test:addObject - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/aws-bucket.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/aws-bucket.test.w_test_sim.md index 8b000521dc6..8500e065401 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/aws-bucket.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/aws-bucket.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ aws-bucket.test.wsim » root/env0/test:validates the AWS Bucket - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/bucket_list.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/bucket_list.test.w_test_sim.md index 34a292d1430..c2444330d8d 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/bucket_list.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/bucket_list.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ bucket_list.test.wsim » root/env0/test:list - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/copy.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/copy.test.w_test_sim.md index 5979a33ee12..9062f1b81fa 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/copy.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/copy.test.w_test_sim.md @@ -2,9 +2,9 @@ ## stdout.log ```log +[ERROR] copy() | Copy (srcKey=no-such-file.txt to dstKey=file1.main.w). Error: Source object does not exist (srcKey=no-such-file.txt). pass ─ copy.test.wsim » root/env0/test:copy() - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/delete.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/delete.test.w_test_sim.md index 98e101c0172..98a38099c03 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/delete.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/delete.test.w_test_sim.md @@ -2,9 +2,9 @@ ## stdout.log ```log +[ERROR] delete | Delete (key=file1.json). Error: Object does not exist (key=file1.json). pass ─ delete.test.wsim » root/env0/test:delete - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/events.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/events.test.w_test_sim.md index adf3d747eff..09f4ba4baf2 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/events.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/events.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ events.test.wsim » root/env0/hitCount is incremented according to the bucket event - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/exists.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/exists.test.w_test_sim.md index 28d7c734023..d5fa94ef344 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/exists.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/exists.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ exists.test.wsim » root/env0/test:exists - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/get.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/get.test.w_test_sim.md index 2e0e032e093..a6316ecdb09 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/get.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/get.test.w_test_sim.md @@ -2,10 +2,13 @@ ## stdout.log ```log +[ERROR] get range of an object | Get (key=test2.txt). Error: Object does not exist (key=test2.txt): TypeError: The encoded data was not valid for encoding utf-8 + at TextDecoder.decode (node:internal/encoding:449:16) + at Object.activity (:LINE:COL) + at async Object.withTrace (:LINE:COL) pass ─ get.test.wsim » root/env0/test:get range of an object pass ─ get.test.wsim » root/env1/test:get empty object - - + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/load_test.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/load_test.test.w_test_sim.md index 0a937a33686..9b0c839d9c5 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/load_test.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/load_test.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ load_test.test.wsim » root/env0/test:uploading many objects - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/metadata.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/metadata.test.w_test_sim.md index 4d09417a2f6..77cd6361ef1 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/metadata.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/metadata.test.w_test_sim.md @@ -2,9 +2,9 @@ ## stdout.log ```log +[ERROR] metadata() | Metadata (key=no-such-file.txt). Error: Object does not exist (key=no-such-file.txt). pass ─ metadata.test.wsim » root/env0/test:metadata() - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/public_url.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/public_url.test.w_test_sim.md index 97b5325f770..108760bead3 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/public_url.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/public_url.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ public_url.test.wsim » root/env0/test:publicUrl - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/put.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/put.test.w_test_sim.md index 4b93029e470..796824167ad 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/put.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/put.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ put.test.wsim » root/env0/test:put - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/put_json.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/put_json.test.w_test_sim.md index f0ad509bc90..7023148ab35 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/put_json.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/put_json.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ put_json.test.wsim » root/env0/test:putJson - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/rename.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/rename.test.w_test_sim.md index dc966d64f3c..6c98c31febe 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/rename.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/rename.test.w_test_sim.md @@ -2,9 +2,9 @@ ## stdout.log ```log +[ERROR] rename() | Copy (srcKey=no-such-obj.txt to dstKey=new-name.txt). Error: Source object does not exist (srcKey=no-such-obj.txt). pass ─ rename.test.wsim » root/env0/test:rename() - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/signed_url.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/signed_url.test.w_test_sim.md index 4e0555f1b53..ff67856cb45 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/signed_url.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/signed_url.test.w_test_sim.md @@ -4,8 +4,7 @@ ```log Error: Resource root/env0/Bucket does not support inflight operation signedUrl. It might not be implemented yet. - - + Tests 1 unsupported (1) Snapshots 1 skipped Test Files 1 unsupported (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/try_delete.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/try_delete.test.w_test_sim.md index 2604f6d076f..4c6b19c9da8 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/try_delete.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/try_delete.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ try_delete.test.wsim » root/env0/test:tryDelete - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/try_get.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/try_get.test.w_test_sim.md index 4bb29c5401d..9b3351c0005 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/try_get.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/try_get.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ try_get.test.wsim » root/env0/test:tryGet - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/try_get_json.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/try_get_json.test.w_test_sim.md index 9f1a198979b..152b9096bc7 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/try_get_json.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/try_get_json.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ try_get_json.test.wsim » root/env0/test:tryGetJson - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/container/container.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/container/container.test.w_test_sim.md index f1dc1c4f867..a80626a598b 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/container/container.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/container/container.test.w_test_sim.md @@ -2,15 +2,12 @@ ## stdout.log ```log -pass ┌ container.test.wsim » root/env0/test:get echo - │ bang - └ -pass ┌ container.test.wsim » root/env1/test:get app - │ bang - │ - └ Hello, Wingnuts! - - +[INFO] get echo | bang +[INFO] get echo | +[INFO] get app | Hello, Wingnuts! +pass ─ container.test.wsim » root/env0/test:get echo +pass ─ container.test.wsim » root/env1/test:get app + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/counter/aws-counter.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/counter/aws-counter.test.w_test_sim.md index 502647b1cb7..328dec56c09 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/counter/aws-counter.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/counter/aws-counter.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ aws-counter.test.wsim » root/env0/test:validates the AWS counter name - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/counter/dec.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/counter/dec.test.w_test_sim.md index 35c1d9a224e..ca48f10747e 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/counter/dec.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/counter/dec.test.w_test_sim.md @@ -4,8 +4,7 @@ ```log pass ─ dec.test.wsim » root/env0/test:dec() pass ─ dec.test.wsim » root/env1/test:dec() with custom key - - + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/counter/inc.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/counter/inc.test.w_test_sim.md index 6b40a004515..3b6a09bdcb6 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/counter/inc.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/counter/inc.test.w_test_sim.md @@ -4,8 +4,7 @@ ```log pass ─ inc.test.wsim » root/env0/test:inc() pass ─ inc.test.wsim » root/env1/test:inc() with custom key - - + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/counter/initial.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/counter/initial.test.w_test_sim.md index d14e003b753..aefebe99f6d 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/counter/initial.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/counter/initial.test.w_test_sim.md @@ -5,8 +5,7 @@ pass ─ initial.test.wsim » root/env0/test:initial:default pass ─ initial.test.wsim » root/env1/test:initial:positive-value pass ─ initial.test.wsim » root/env2/test:initial:negative-value - - + Tests 3 passed (3) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/counter/peek.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/counter/peek.test.w_test_sim.md index 5b17d14bac6..1ce4d81080a 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/counter/peek.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/counter/peek.test.w_test_sim.md @@ -4,8 +4,7 @@ ```log pass ─ peek.test.wsim » root/env0/test:peek pass ─ peek.test.wsim » root/env1/test:key peek - - + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/counter/set.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/counter/set.test.w_test_sim.md index d92e8b59044..842f84d095e 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/counter/set.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/counter/set.test.w_test_sim.md @@ -4,8 +4,7 @@ ```log pass ─ set.test.wsim » root/env0/test:set() pass ─ set.test.wsim » root/env1/test:set() with custom key - - + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/endpoint/url.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/endpoint/url.test.w_test_sim.md index 06ca92a64f1..57a8d35b146 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/endpoint/url.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/endpoint/url.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ url.test.wsim » root/env0/test:access endpoint url - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/expect/assert.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/expect/assert.test.w_test_sim.md index e9ced5c1316..5f76a5996bc 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/expect/assert.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/expect/assert.test.w_test_sim.md @@ -11,8 +11,7 @@ pass ─ assert.test.wsim » root/env5/test:equal objects pass ─ assert.test.wsim » root/env6/test:equal maps pass ─ assert.test.wsim » root/env7/test:equal sets pass ─ assert.test.wsim » root/env8/test:equal durations - - + Tests 9 passed (9) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/fs/basic.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/fs/basic.test.w_test_sim.md index 2e9cd90f969..5eadfc1810b 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/fs/basic.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/fs/basic.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ basic.test.wsim » root/env0/test:inflight file basic operations - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/fs/directory.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/fs/directory.test.w_test_sim.md index 1d1e6ac4237..26172ca2310 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/fs/directory.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/fs/directory.test.w_test_sim.md @@ -5,8 +5,7 @@ pass ─ directory.test.wsim » root/env0/test:inflight create normal directory pass ─ directory.test.wsim » root/env1/test:cannot overwrite directory with a file pass ─ directory.test.wsim » root/env2/test:isDir() - - + Tests 3 passed (3) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/fs/json.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/fs/json.test.w_test_sim.md index 265189733be..96173bcc060 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/fs/json.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/fs/json.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ json.test.wsim » root/env0/test:inflight json operations - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/fs/options.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/fs/options.test.w_test_sim.md index ebcee74a39a..6b480b364bf 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/fs/options.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/fs/options.test.w_test_sim.md @@ -6,8 +6,7 @@ pass ─ options.test.wsim » root/env0/test:write and read file with `encoding` pass ─ options.test.wsim » root/env1/test:write file with `flag` option pass ─ options.test.wsim » root/env2/test:removing non-existent file with `force: false` raises error pass ─ options.test.wsim » root/env3/test:removing directory with `recursive: false` raises error - - + Tests 4 passed (4) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/fs/path.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/fs/path.test.w_test_sim.md index e910b20d93f..d1b9c57b79e 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/fs/path.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/fs/path.test.w_test_sim.md @@ -4,8 +4,7 @@ ```log pass ─ path.test.wsim » root/env0/test:inflight path conversion pass ─ path.test.wsim » root/env1/test:extension() - - + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/fs/stat.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/fs/stat.test.w_test_sim.md index cf3de9bfb7e..0bc5a8bdaaf 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/fs/stat.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/fs/stat.test.w_test_sim.md @@ -5,8 +5,7 @@ pass ─ stat.test.wsim » root/env0/test:metadata() pass ─ stat.test.wsim » root/env1/test:symlinkMetadata() pass ─ stat.test.wsim » root/env2/test:setPermissions() - - + Tests 3 passed (3) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/fs/temp_dir.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/fs/temp_dir.test.w_test_sim.md index 76556aa6613..d257751fc1d 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/fs/temp_dir.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/fs/temp_dir.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ temp_dir.test.wsim » root/env0/test:inflight create temporary directory - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/fs/yaml.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/fs/yaml.test.w_test_sim.md index 3820895cede..aca42dabbd2 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/fs/yaml.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/fs/yaml.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ yaml.test.wsim » root/env0/test:inflight yaml operations - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/aws-function.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/aws-function.test.w_test_sim.md index fa765d7cb30..093449a157a 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/aws-function.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/aws-function.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ aws-function.test.wsim » root/env0/test:validates the AWS Function - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/concurrency.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/concurrency.test.w_test_sim.md index b63ebac205c..c3165a0948d 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/concurrency.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/concurrency.test.w_test_sim.md @@ -2,11 +2,11 @@ ## stdout.log ```log +[ERROR] f1 concurrency limit reached | Invoke (payload=undefined). Error: Too many requests, the function has reached its concurrency limit. +[INFO] queue applies backpressure to functions with limited concurrency | c: 3 pass ─ concurrency.test.wsim » root/env0/test:f1 concurrency limit reached -pass ┌ concurrency.test.wsim » root/env1/test:queue applies backpressure to functions with limited concurrency - └ c: 3 - - +pass ─ concurrency.test.wsim » root/env1/test:queue applies backpressure to functions with limited concurrency + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/env.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/env.test.w_test_sim.md index 79f7f51c009..3700c1d6b57 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/env.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/env.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ env.test.wsim » root/env0/test:addEnvironment - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/function-ref.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/function-ref.test.w_test_sim.md index 7508618e1e8..62d1e9da70c 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/function-ref.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/function-ref.test.w_test_sim.md @@ -4,8 +4,7 @@ ```log pass ─ function-ref.test.wsim » root/env0/test:functionArn returns the arn pass ─ function-ref.test.wsim » root/env1/test:invoke() sends a request to aws, fails because we are using a dummy function - - + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/invoke.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/invoke.test.w_test_sim.md index 29cad2316f4..8f07e0f0b6f 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/invoke.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/invoke.test.w_test_sim.md @@ -4,18 +4,14 @@ ```log log preflight log preflight -pass ┌ invoke.test.wsim » root/env0/test:invoke - │ log inside test - │ log inside function - └ contains 2 lines -pass ┌ invoke.test.wsim » root/env1/test:invoke without inputs and outputs - │ log inside test - │ log inside function - │ contains 2 lines - │ no event, no return! - └ bang! - - +[INFO] invoke | log inside test +[INFO] invoke | log inside function +[INFO] invoke | contains 2 lines +[INFO] invoke without inputs and outputs | no event, no return! +[INFO] invoke without inputs and outputs | bang! +pass ─ invoke.test.wsim » root/env0/test:invoke +pass ─ invoke.test.wsim » root/env1/test:invoke without inputs and outputs + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/invoke_async.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/invoke_async.test.w_test_sim.md index 5530dccf08e..99727d13e3b 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/invoke_async.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/invoke_async.test.w_test_sim.md @@ -2,13 +2,11 @@ ## stdout.log ```log -pass ┌ invoke_async.test.wsim » root/env0/test:invoke() waits for function to finish - └ log inside fn -pass ┌ invoke_async.test.wsim » root/env1/test:invokeAsync() returns without waiting for the function finishes - │ log inside fn - └ log inside fn - - +[INFO] invoke() waits for function to finish | log inside fn +[INFO] invokeAsync() returns without waiting for the function finishes | log inside fn +pass ─ invoke_async.test.wsim » root/env0/test:invoke() waits for function to finish +pass ─ invoke_async.test.wsim » root/env1/test:invokeAsync() returns without waiting for the function finishes + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/logging.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/logging.test.w_test_sim.md index 8d97f879b44..092d7fe53cd 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/logging.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/logging.test.w_test_sim.md @@ -2,17 +2,16 @@ ## stdout.log ```log -pass ┌ logging.test.wsim » root/env0/test:logging - │ hello world - │ log inside f1 - │ log inside f2 - │ log inside f1 - │ hello world - │ log inside f1 - │ log inside f2 - └ log inside f1 - - +[INFO] logging | hello world +[INFO] logging | log inside f1 +[INFO] logging | log inside f2 +[INFO] logging | log inside f1 +[INFO] logging | hello world +[INFO] logging | log inside f1 +[INFO] logging | log inside f2 +[INFO] logging | log inside f1 +pass ─ logging.test.wsim » root/env0/test:logging + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/memory_and_env.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/memory_and_env.test.w_test_sim.md index 66557922b74..10fd7d58c5d 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/memory_and_env.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/memory_and_env.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ memory_and_env.test.wsim » root/env0/test:function with memory and function with env can be invoked - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/http/fetch.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/http/fetch.test.w_test_sim.md index 8ed7e27d76a..5e16d23acf2 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/http/fetch.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/http/fetch.test.w_test_sim.md @@ -2,12 +2,10 @@ ## stdout.log ```log -pass ┌ fetch.test.wsim » root/env0/test:redirect is 'follow' by default - └ I am the target -pass ┌ fetch.test.wsim » root/env1/test:redirect 'manual' - └ I am the target - - +[INFO] redirect is 'follow' by default | I am the target +pass ─ fetch.test.wsim » root/env0/test:redirect is 'follow' by default +pass ─ fetch.test.wsim » root/env1/test:redirect 'manual' + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/http/url.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/http/url.test.w_test_sim.md index a3040d4bf48..255e3dca832 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/http/url.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/http/url.test.w_test_sim.md @@ -4,8 +4,7 @@ ```log pass ─ url.test.wsim » root/env0/test:parseUrl() pass ─ url.test.wsim » root/env1/test:formatUrl() - - + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/abs.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/abs.test.w_test_sim.md index ae2dfa46319..39a77b10a31 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/abs.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/abs.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ abs.test.wsim » root/env0/test:inflight absolute - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/acos.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/acos.test.w_test_sim.md index 9146c818bb3..eb854c6d277 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/acos.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/acos.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ acos.test.wsim » root/env0/test:inflight arc cosine - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/acot.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/acot.test.w_test_sim.md index f5535c0f6eb..c39d5ac5a01 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/acot.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/acot.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ acot.test.wsim » root/env0/test:inflight arc cotgent - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/acsc.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/acsc.test.w_test_sim.md index 1b4435b423e..9f2626e3591 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/acsc.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/acsc.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ acsc.test.wsim » root/env0/test:inflight arc cosecant - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/angular_conversion.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/angular_conversion.test.w_test_sim.md index 8807e689ff7..4043d378a27 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/angular_conversion.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/angular_conversion.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ angular_conversion.test.wsim » root/env0/test:inflight angular conversions - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/asec.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/asec.test.w_test_sim.md index bddc77d0120..8503781463c 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/asec.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/asec.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ asec.test.wsim » root/env0/test:inflight arc cosecant - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/asin.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/asin.test.w_test_sim.md index afeba9aa215..c67a5b5dfda 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/asin.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/asin.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ asin.test.wsim » root/env0/test:inflight arc sine - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/atan.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/atan.test.w_test_sim.md index ff455f26c58..e6931e93cc2 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/atan.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/atan.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ atan.test.wsim » root/env0/test:inflight arc tangent - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/atan2.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/atan2.test.w_test_sim.md index 9f4e1d11441..98849718f7d 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/atan2.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/atan2.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ atan2.test.wsim » root/env0/test:inflight arc tangent 2 - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/combinations.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/combinations.test.w_test_sim.md index a6a99ffc907..1cade9f29fa 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/combinations.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/combinations.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ combinations.test.wsim » root/env0/test:inflight combinations - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/cos.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/cos.test.w_test_sim.md index abcdbb580a8..6b2bafea071 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/cos.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/cos.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ cos.test.wsim » root/env0/test:inflight cosine - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/cot.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/cot.test.w_test_sim.md index e82e119d93d..205cdb201a9 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/cot.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/cot.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ cot.test.wsim » root/env0/test:inflight cotangent - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/csc.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/csc.test.w_test_sim.md index a62663dd05c..a062fb39834 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/csc.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/csc.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ csc.test.wsim » root/env0/test:inflight cosecant - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/euler.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/euler.test.w_test_sim.md index f40da31f7b2..2165b841a18 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/euler.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/euler.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ euler.test.wsim » root/env0/test:EULER - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/factorial.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/factorial.test.w_test_sim.md index e2b61351afb..e4c54089171 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/factorial.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/factorial.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ factorial.test.wsim » root/env0/test:inflight factorial - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/fibonacci.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/fibonacci.test.w_test_sim.md index 6e2628335b4..53971f4e298 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/fibonacci.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/fibonacci.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ fibonacci.test.wsim » root/env0/test:inflight fibonacci - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/floor_ceil_round.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/floor_ceil_round.test.w_test_sim.md index 983cf6fada2..c0dfae7bd44 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/floor_ceil_round.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/floor_ceil_round.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ floor_ceil_round.test.wsim » root/env0/test:inflight floor--ceil--round - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/hypot.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/hypot.test.w_test_sim.md index 6ffbf635124..866e340beed 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/hypot.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/hypot.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ hypot.test.wsim » root/env0/test:inflight hypot - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/log.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/log.test.w_test_sim.md index 0700b79e2c0..7f31dabaeb5 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/log.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/log.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ log.test.wsim » root/env0/test:inflight absolute - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/log10.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/log10.test.w_test_sim.md index 22cbc8d8dd4..515e9542ccc 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/log10.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/log10.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ log10.test.wsim » root/env0/test:inflight absolute - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/log2.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/log2.test.w_test_sim.md index cbb4e90f31f..4288a05af55 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/log2.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/log2.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ log2.test.wsim » root/env0/test:inflight absolute - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/median_mode_mean.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/median_mode_mean.test.w_test_sim.md index 92f19ec35dc..d015ad84c24 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/median_mode_mean.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/median_mode_mean.test.w_test_sim.md @@ -5,8 +5,7 @@ pass ─ median_mode_mean.test.wsim » root/env0/test:inflight median pass ─ median_mode_mean.test.wsim » root/env1/test:inflight mode pass ─ median_mode_mean.test.wsim » root/env2/test:inflight mean - - + Tests 3 passed (3) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/min_max.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/min_max.test.w_test_sim.md index 72afb42b614..fab067b49d5 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/min_max.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/min_max.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ min_max.test.wsim » root/env0/test:inflight min--max - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/pi.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/pi.test.w_test_sim.md index 68111a6726e..812a43883dc 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/pi.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/pi.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ pi.test.wsim » root/env0/test:PI - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/prime.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/prime.test.w_test_sim.md index fe2ac077d0c..99ab6f35608 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/prime.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/prime.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ prime.test.wsim » root/env0/test:inflight prime numbers - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/random.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/random.test.w_test_sim.md index b116f17b085..229940cad54 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/random.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/random.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ random.test.wsim » root/env0/test:inflight absolute - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/sec.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/sec.test.w_test_sim.md index 28ff7b90b13..3b53e9172c1 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/sec.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/sec.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ sec.test.wsim » root/env0/test:inflight secant - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/sign.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/sign.test.w_test_sim.md index c4b20501f4c..839ec24bbec 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/sign.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/sign.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ sign.test.wsim » root/env0/test:inflight absolute - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/sin.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/sin.test.w_test_sim.md index 4758297d25a..cbf8ea7a85d 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/sin.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/sin.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ sin.test.wsim » root/env0/test:inflight sine - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/sqrt.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/sqrt.test.w_test_sim.md index dcffe2df728..9662e2dfc4a 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/sqrt.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/sqrt.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ sqrt.test.wsim » root/env0/test:inflight square root - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/tan.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/tan.test.w_test_sim.md index ecbd14b2ab9..42e909cad81 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/tan.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/tan.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ tan.test.wsim » root/env0/test:inflight tangent - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/tau.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/tau.test.w_test_sim.md index 1f942876ff7..60c28d1004c 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/tau.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/tau.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ tau.test.wsim » root/env0/test:TAU - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/toradix.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/toradix.test.w_test_sim.md index 4434d2bfb64..aa56c639954 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/toradix.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/math/toradix.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ toradix.test.wsim » root/env0/test:inflight base - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/misc/empty-actions.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/misc/empty-actions.test.w_test_sim.md index c959348c24e..b265668d818 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/misc/empty-actions.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/misc/empty-actions.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ empty-actions.test.wsim » root/env0/test:main - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/on_deploy/execute_after.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/on_deploy/execute_after.test.w_test_sim.md index 16cfc4798c3..bce6d44bb57 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/on_deploy/execute_after.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/on_deploy/execute_after.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ execute_after.test.wsim » root/env0/test:counter - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/aws-queue.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/aws-queue.test.w_test_sim.md index ebd5af0580f..5423eeb77f3 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/aws-queue.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/aws-queue.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ aws-queue.test.wsim » root/env0/test:validates the AWS queue name - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/pop.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/pop.test.w_test_sim.md index ac551e04bf5..4ea249092bf 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/pop.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/pop.test.w_test_sim.md @@ -12,8 +12,7 @@ Contributions welcome ❤️ 5 | let q = new cloud.Queue(timeout: timeout); | ^ at /pop.test.w:5:9 - - + Tests 1 unsupported (1) Snapshots 1 skipped Test Files 1 unsupported (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/purge.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/purge.test.w_test_sim.md index 4a84a2462af..c7d1d49879a 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/purge.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/purge.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ purge.test.wsim » root/env0/test:purge - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/push.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/push.test.w_test_sim.md index 80440b32e75..a4bd738a6a5 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/push.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/push.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ push.test.wsim » root/env0/push - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/queue-ref.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/queue-ref.test.w_test_sim.md index 8f3a40540a3..28b24b86032 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/queue-ref.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/queue-ref.test.w_test_sim.md @@ -4,8 +4,7 @@ ```log pass ─ queue-ref.test.wsim » root/env0/test:queueArn returns the arn pass ─ queue-ref.test.wsim » root/env1/test:push() sends a request to aws, fails because we are using a dummy queue - - + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/retention_period.main.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/retention_period.main.w_test_sim.md index 3a1a4323753..78a60b30a19 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/retention_period.main.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/retention_period.main.w_test_sim.md @@ -12,8 +12,7 @@ Contributions welcome ❤️ 7 | let q = new cloud.Queue(timeout: timeout, retentionPeriod: retentionPeriod); | ^ at /retention_period.main.w:7:9 - - + Tests 1 unsupported (1) Snapshots 1 skipped Test Files 1 unsupported (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/set_consumer.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/set_consumer.test.w_test_sim.md index 846cf4da639..e437d3573fb 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/set_consumer.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/set_consumer.test.w_test_sim.md @@ -4,8 +4,7 @@ ```log pass ─ set_consumer.test.wsim » root/env0/test:setConsumer pass ─ set_consumer.test.wsim » root/env1/test:function can push back to the queue - - + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/schedule/on_tick.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/schedule/on_tick.test.w_test_sim.md index d1f2600cbd7..cc47226d05e 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/schedule/on_tick.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/schedule/on_tick.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ on_tick.test.wsim » root/env0/on tick is called both for rate and cron schedules - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/service/callbacks.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/service/callbacks.test.w_test_sim.md index bbde853ee86..bc1fdec32b6 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/service/callbacks.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/service/callbacks.test.w_test_sim.md @@ -5,8 +5,7 @@ pass ─ callbacks.test.wsim » root/env0/test:does not start automatically if autoStart is false pass ─ callbacks.test.wsim » root/env1/test:start() calls onStart() idempotently pass ─ callbacks.test.wsim » root/env2/test:stop() calls onStop() - - + Tests 3 passed (3) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/service/http-server.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/service/http-server.test.w_test_sim.md index cd2980f5651..2948dff3702 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/service/http-server.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/service/http-server.test.w_test_sim.md @@ -2,21 +2,16 @@ ## stdout.log ```log -pass ┌ http-server.test.wsim » root/env0/test:http server is started with the service - │ starting service - │ listening on port - │ starting service - │ listening on port - └ bang bang! -pass ┌ http-server.test.wsim » root/env1/test:service.stop() closes the http server - │ starting service - │ listening on port - │ starting service - │ listening on port - │ bang bang! - └ closing server... - - +[INFO] service.stop() closes the http server | starting service +[INFO] service.stop() closes the http server | listening on port +[INFO] http server is started with the service | starting service +[INFO] http server is started with the service | listening on port +[INFO] http server is started with the service | bang bang! +[INFO] service.stop() closes the http server | closing server... +[INFO] http server is started with the service | closing server... +pass ─ http-server.test.wsim » root/env0/test:http server is started with the service +pass ─ http-server.test.wsim » root/env1/test:service.stop() closes the http server + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/service/minimal.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/service/minimal.test.w_test_sim.md index e55f7d7231b..d443f4cc92f 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/service/minimal.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/service/minimal.test.w_test_sim.md @@ -2,11 +2,10 @@ ## stdout.log ```log -pass ┌ minimal.test.wsim » root/env0/test:start and stop - │ hello, service! - └ stopping! - - +[INFO] start and stop | hello, service! +[INFO] start and stop | stopping! +pass ─ minimal.test.wsim » root/env0/test:start and stop + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/service/stateful.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/service/stateful.test.w_test_sim.md index 49efa80ff39..bb3609460d9 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/service/stateful.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/service/stateful.test.w_test_sim.md @@ -2,10 +2,11 @@ ## stdout.log ```log -pass ┌ stateful.test.wsim » root/env0/test:service is ready only after onStart finishes - └ starting service - - +[INFO] service is ready only after onStart finishes | starting service +[INFO] service is ready only after onStart finishes | stopping service +[INFO] service is ready only after onStart finishes | state is: 456 +pass ─ stateful.test.wsim » root/env0/test:service is ready only after onStart finishes + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/service/tokens.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/service/tokens.test.w_test_sim.md index b6a3e76a79d..307cfc1e7d9 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/service/tokens.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/service/tokens.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ tokens.test.wsim » root/env0/test:will bind and use tokens - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/state/get.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/state/get.test.w_test_sim.md index b393bff2d73..e7ee106144f 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/state/get.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/state/get.test.w_test_sim.md @@ -4,8 +4,7 @@ ```log pass ─ get.test.wsim » root/env0/test:state.get() returns the runtime value pass ─ get.test.wsim » root/env1/test:state.tryGet() return nil if there is no value - - + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/state/set.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/state/set.test.w_test_sim.md index c99230b0f9d..77559acfd28 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/state/set.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/state/set.test.w_test_sim.md @@ -2,10 +2,9 @@ ## stdout.log ```log -pass ┌ set.test.wsim » root/env0/test:token resolved at runtime - └ 2023-10-16T20:47:39.511Z - - +[INFO] token resolved at runtime | 2023-10-16T20:47:39.511Z +pass ─ set.test.wsim » root/env0/test:token resolved at runtime + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/array.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/array.test.w_test_sim.md index cf395bb39dd..4ca4b3fe745 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/array.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/array.test.w_test_sim.md @@ -20,8 +20,7 @@ pass ─ array.test.wsim » root/env6/test:contains() pass ─ array.test.wsim » root/env7/test:indexOf() pass ─ array.test.wsim » root/env8/test:indexOfArray() pass ─ array.test.wsim » root/env9/test:join() - - + Tests 18 passed (18) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/bool.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/bool.test.w_test_sim.md index d3424e75352..e687f9a4465 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/bool.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/bool.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ bool.test.wsim » root/env0/test:fromJson() - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/datetime.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/datetime.test.w_test_sim.md index 7992a33a6dc..fe785e9c28d 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/datetime.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/datetime.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ datetime.test.wsim » root/env0/test:inflight datetime - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/duration.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/duration.test.w_test_sim.md index fdad9f02edb..98968c3f14a 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/duration.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/duration.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ duration.test.wsim » root/env0/test:duration - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/json.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/json.test.w_test_sim.md index 274dc89df2b..42f62dffa96 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/json.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/json.test.w_test_sim.md @@ -12,8 +12,7 @@ pass ─ json.test.wsim » root/env6/test:keys(), values(), entries() pass ─ json.test.wsim » root/env7/test:parse() pass ─ json.test.wsim » root/env8/test:tryParse() pass ─ json.test.wsim » root/env9/test:deepCopy(), deepCopyMut() - - + Tests 10 passed (10) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/map.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/map.test.w_test_sim.md index 5579f7af881..76793879ce9 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/map.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/map.test.w_test_sim.md @@ -15,8 +15,7 @@ pass ─ map.test.wsim » root/env6/test:keys() pass ─ map.test.wsim » root/env7/test:copyMut() pass ─ map.test.wsim » root/env8/test:copy() pass ─ map.test.wsim » root/env9/test:set() - - + Tests 13 passed (13) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/node.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/node.test.w_test_sim.md index 603840366f9..5da5c20b7fe 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/node.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/node.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ node.test.wsim » root/env0/test:singleton - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/number.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/number.test.w_test_sim.md index 1579d1d77d2..48a9fc032c7 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/number.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/number.test.w_test_sim.md @@ -4,8 +4,7 @@ ```log pass ─ number.test.wsim » root/env0/test:fromJson pass ─ number.test.wsim » root/env1/test:fromStr - - + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/range.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/range.test.w_test_sim.md index b4aebd0a187..86701394e5b 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/range.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/range.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ range.test.wsim » root/env0/test:ranges work - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/regex.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/regex.test.w_test_sim.md index df379a6fddd..f84a8cc172b 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/regex.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/regex.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ regex.test.wsim » root/env0/test:regex - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/set.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/set.test.w_test_sim.md index 3718040ce47..e1cc15fbc44 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/set.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/set.test.w_test_sim.md @@ -12,8 +12,7 @@ pass ─ set.test.wsim » root/env6/test:add() pass ─ set.test.wsim » root/env7/test:delete() pass ─ set.test.wsim » root/env8/test:clear() pass ─ set.test.wsim » root/env9/test:copy() - - + Tests 10 passed (10) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/string.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/string.test.w_test_sim.md index 70fdcbb8786..f7284323c79 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/string.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/string.test.w_test_sim.md @@ -17,8 +17,7 @@ pass ─ string.test.wsim » root/env6/test:lowercase() pass ─ string.test.wsim » root/env7/test:uppercase() pass ─ string.test.wsim » root/env8/test:split() pass ─ string.test.wsim » root/env9/test:startsWith() - - + Tests 15 passed (15) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/struct.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/struct.test.w_test_sim.md index d59aec115e7..c424fe82e04 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/struct.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/struct.test.w_test_sim.md @@ -7,8 +7,7 @@ pass ─ struct.test.wsim » root/env1/test:tryParseJson() pass ─ struct.test.wsim » root/env2/test:invalid parseJson() pass ─ struct.test.wsim » root/env3/test:invalid tryParseJson() pass ─ struct.test.wsim » root/env4/test:valid Json types - - + Tests 5 passed (5) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/add_row.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/add_row.test.w_test_sim.md index 419b50f9135..247c7d22251 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/add_row.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/add_row.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ add_row.test.wsim » root/env0/test:addRow - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/aws-table.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/aws-table.test.w_test_sim.md index 540840f5522..8f7e6cf61ff 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/aws-table.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/aws-table.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ aws-table.test.wsim » root/env0/test:validates the AWS topic name - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/get.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/get.test.w_test_sim.md index 3c4fc5fb23b..99997d53bd9 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/get.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/get.test.w_test_sim.md @@ -2,9 +2,9 @@ ## stdout.log ```log +[ERROR] get | get row bar from table users. Error: Row does not exist (key=bar) pass ─ get.test.wsim » root/env0/test:get - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/list.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/list.test.w_test_sim.md index 8b4ea63c4c9..7963d94dfe2 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/list.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/list.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ list.test.wsim » root/env0/test:list - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/try_get.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/try_get.test.w_test_sim.md index d1e7cf5a34d..de3ded219eb 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/try_get.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/try_get.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ try_get.test.wsim » root/env0/test:tryGet - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/upsert.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/upsert.test.w_test_sim.md index f0f35d6fbb9..ec15cfb24df 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/upsert.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/upsert.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ upsert.test.wsim » root/env0/test:upsert - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/topic/aws-topic.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/topic/aws-topic.test.w_test_sim.md index 73562fa8842..3f667d3fa01 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/topic/aws-topic.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/topic/aws-topic.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ aws-topic.test.wsim » root/env0/test:validates the AWS topic name - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/topic/no_blocking.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/topic/no_blocking.test.w_test_sim.md index 32b2193d8c3..857ae398c05 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/topic/no_blocking.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/topic/no_blocking.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ no_blocking.test.wsim » root/env0/test:topic subscribers are invoked without blocking - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/topic/on_message.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/topic/on_message.test.w_test_sim.md index bb51bdabad0..4d51d9ee652 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/topic/on_message.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/topic/on_message.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ on_message.test.wsim » root/env0/test:onMessage - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/topic/subscribe-queue.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/topic/subscribe-queue.test.w_test_sim.md index b7122752285..a7e449bf4e4 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/topic/subscribe-queue.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/topic/subscribe-queue.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ subscribe-queue.test.wsim » root/env0/test:functions and queues receiving messages from the topic - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/ui/section.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/ui/section.test.w_test_sim.md index 892f21fb4c0..7419abe7d29 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/ui/section.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/ui/section.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ section.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/base64.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/base64.test.w_test_sim.md index cd47a4de02f..0cb5fecc777 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/base64.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/base64.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ base64.test.wsim » root/env0/test:inflight base64 - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/env.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/env.test.w_test_sim.md index 3e9d273d56d..5e7129688f2 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/env.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/env.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ env.test.wsim » root/env0/test:use util from inflight - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/exec.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/exec.test.w_test_sim.md index 052f53f2d89..265cd497b4c 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/exec.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/exec.test.w_test_sim.md @@ -8,8 +8,7 @@ pass ─ exec.test.wsim » root/env2/test:exec() with explicit non-zero exit sta pass ─ exec.test.wsim » root/env3/test:exec() with env option pass ─ exec.test.wsim » root/env4/test:exec() with inheritEnv option pass ─ exec.test.wsim » root/env5/test:exec() with cwd option - - + Tests 6 passed (6) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/nanoid.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/nanoid.test.w_test_sim.md index 49c51e1b72f..c60dbd918c3 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/nanoid.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/nanoid.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ nanoid.test.wsim » root/env0/test:inflight nanoid - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/os.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/os.test.w_test_sim.md index 7c16f93bcd2..1ce32caca53 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/os.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/os.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ os.test.wsim » root/env0/test:util.os() inflight - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/sha256.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/sha256.test.w_test_sim.md index d09d944e9b4..4711e4825dc 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/sha256.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/sha256.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ sha256.test.wsim » root/env0/test:inflight sha256 - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/shell.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/shell.test.w_test_sim.md index b55d47c3ef1..3879bc10fef 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/shell.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/shell.test.w_test_sim.md @@ -9,8 +9,7 @@ pass ─ shell.test.wsim » root/env3/test:shell() with env option pass ─ shell.test.wsim » root/env4/test:shell() with inheritEnv option pass ─ shell.test.wsim » root/env5/test:shell() with cwd option pass ─ shell.test.wsim » root/env6/test:shell() with throw option - - + Tests 7 passed (7) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/sleep.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/sleep.test.w_test_sim.md index acd05658b1f..17841ee318c 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/sleep.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/sleep.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ sleep.test.wsim » root/env0/test:sleep 100 mili seconds - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/uuidv4.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/uuidv4.test.w_test_sim.md index e40d60da092..b92a9292ed0 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/uuidv4.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/uuidv4.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ uuidv4.test.wsim » root/env0/test:inflight uuidv4 - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/wait-until.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/wait-until.test.w_test_sim.md index 7c45da86b29..a040889a3b1 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/wait-until.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/wait-until.test.w_test_sim.md @@ -8,8 +8,7 @@ pass ─ wait-until.test.wsim » root/env2/test:waitUntil returns false if the p pass ─ wait-until.test.wsim » root/env3/test:waitUntil returns true if the predicate is met after some time waiting pass ─ wait-until.test.wsim » root/env4/test:waitUntil with custom props pass ─ wait-until.test.wsim » root/env5/test:throwing exception from predicate should throw immediately - - + Tests 6 passed (6) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/website/aws-react-app.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/website/aws-react-app.test.w_test_sim.md index 794ee39e628..1c5b0139f0c 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/website/aws-react-app.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/website/aws-react-app.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ aws-react-app.test.wsim » root/env0/test:validates the AWS bucket name - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/website/aws-website.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/website/aws-website.test.w_test_sim.md index 566bcbedc6a..d2697ca30d5 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/website/aws-website.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/website/aws-website.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ aws-website.test.wsim » root/env0/test:validates the AWS bucket name - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/website/react-app.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/website/react-app.test.w_test_sim.md index c9b05289390..96c1e2c1e65 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/website/react-app.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/website/react-app.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ react-app.test.wsim » root/env0/test:website is working - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/website/two_websites.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/website/two_websites.test.w_test_sim.md index 444bef62358..ef5ef6f7afb 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/website/two_websites.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/website/two_websites.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ two_websites.test.wsim » root/env0/test:deploying two websites - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/website/website.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/website/website.test.w_test_sim.md index cf9759c07fc..d36b122b094 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/website/website.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/website/website.test.w_test_sim.md @@ -4,8 +4,7 @@ ```log pass ─ website.test.wsim » root/env0/test:access files on the website pass ─ website.test.wsim » root/env1/test:page not found - - + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/anon_function.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/anon_function.test.w_test_sim.md index 59ce4acd260..f5dcf36dcb0 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/anon_function.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/anon_function.test.w_test_sim.md @@ -6,8 +6,7 @@ 2 3 pass ─ anon_function.test.wsim » root/env0/test: - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/api.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/api.test.w_test_sim.md index 3271ea8b235..20c82a954e2 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/api.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/api.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ api.test.wsim » root/env0/test:api url - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/api_cors_custom.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/api_cors_custom.test.w_test_sim.md index 77eca639e00..610f10d07de 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/api_cors_custom.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/api_cors_custom.test.w_test_sim.md @@ -5,8 +5,7 @@ pass ─ api_cors_custom.test.wsim » root/env0/test:GET --users has cors headers pass ─ api_cors_custom.test.wsim » root/env1/test:OPTIONS --users has cors headers pass ─ api_cors_custom.test.wsim » root/env2/test:OPTIONS --users responds with proper headers for requested - - + Tests 3 passed (3) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/api_cors_default.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/api_cors_default.test.w_test_sim.md index eac537cb188..0fb2c4b733c 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/api_cors_default.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/api_cors_default.test.w_test_sim.md @@ -4,8 +4,7 @@ ```log pass ─ api_cors_default.test.wsim » root/env0/test:GET --users has default cors headers pass ─ api_cors_default.test.wsim » root/env1/test:OPTIONS --users has default cors headers - - + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/api_valid_path.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/api_valid_path.test.w_test_sim.md index 603fbe37baf..ae9bb006ff3 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/api_valid_path.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/api_valid_path.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ api_valid_path.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/assert.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/assert.test.w_test_sim.md index 8079376604b..b89d691f0b6 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/assert.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/assert.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ assert.test.wsim » root/env0/test:assert works inflight - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/asynchronous_model_implicit_await_in_functions.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/asynchronous_model_implicit_await_in_functions.test.w_test_sim.md index 64c4c1a1272..c106f02803d 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/asynchronous_model_implicit_await_in_functions.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/asynchronous_model_implicit_await_in_functions.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ asynchronous_model_implicit_await_in_functions.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_alias.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_alias.test.w_test_sim.md index 9b62680ef45..98da28351ec 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_alias.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_alias.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ bring_alias.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_awscdk.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_awscdk.test.w_test_sim.md index d45c5cbd4e3..c90650f9e03 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_awscdk.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_awscdk.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ bring_awscdk.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_cdk8s.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_cdk8s.test.w_test_sim.md index 3d4e25bad21..6be76f88276 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_cdk8s.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_cdk8s.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ bring_cdk8s.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_cdktf.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_cdktf.test.w_test_sim.md index ff0e5905b53..dcf8f077bb6 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_cdktf.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_cdktf.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ bring_cdktf.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_extend_non_entry.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_extend_non_entry.test.w_test_sim.md index 9e3c173c60f..54a2c19f245 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_extend_non_entry.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_extend_non_entry.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ bring_extend_non_entry.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_jsii.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_jsii.test.w_test_sim.md index fe2a180c373..fc829d60e28 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_jsii.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_jsii.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ bring_jsii.test.wsim » root/env0/test:sayHello - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) 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 5434f4a3efb..7dd17b1936c 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 @@ -4,8 +4,7 @@ ```log pass ─ bring_local.test.wsim » root/env0/test:add data to store pass ─ bring_local.test.wsim » root/env1/test:greet - - + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_local_dir.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_local_dir.test.w_test_sim.md index 489359c3648..7080be68df0 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_local_dir.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_local_dir.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ bring_local_dir.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_local_normalization.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_local_normalization.test.w_test_sim.md index 1e2a8ce2f9e..58ecf7058e6 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_local_normalization.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_local_normalization.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ bring_local_normalization.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_projen.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_projen.test.w_test_sim.md index 082ee6ca6bd..2f57d3c8675 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_projen.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_projen.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ bring_projen.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_wing_library.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_wing_library.test.w_test_sim.md index d711364752e..9e39299d8b0 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_wing_library.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_wing_library.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ bring_wing_library.test.wsim » root/env0/test:makeKeyInflight - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bucket_keys.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/bucket_keys.test.w_test_sim.md index b69e763d33c..f2eb3f45b72 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bucket_keys.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bucket_keys.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ bucket_keys.test.wsim » root/env0/test:test - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bypass_return.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/bypass_return.test.w_test_sim.md index 80129f559eb..e4ff9e78f7d 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bypass_return.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bypass_return.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ bypass_return.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/call_static_of_myself.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/call_static_of_myself.test.w_test_sim.md index 75593cc4b15..fcda50b6432 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/call_static_of_myself.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/call_static_of_myself.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ call_static_of_myself.test.wsim » root/env0/test:test - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/calling_inflight_variants.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/calling_inflight_variants.test.w_test_sim.md index d25d643b91e..92c558b5f51 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/calling_inflight_variants.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/calling_inflight_variants.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ calling_inflight_variants.test.wsim » root/env0/test:calling different types of inflights - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/capture_containers.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/capture_containers.test.w_test_sim.md index 5655336fef9..1a6c1aceab0 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/capture_containers.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/capture_containers.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ capture_containers.test.wsim » root/env0/test:capture_containers - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/capture_in_binary.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/capture_in_binary.test.w_test_sim.md index 0d5eceb09f2..647d95c01d0 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/capture_in_binary.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/capture_in_binary.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ capture_in_binary.test.wsim » root/env0/test:binary expressions - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/capture_mutables.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/capture_mutables.test.w_test_sim.md index 905b0dc0fc8..c119551a667 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/capture_mutables.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/capture_mutables.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ capture_mutables.test.wsim » root/env0/test:main - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/capture_primitives.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/capture_primitives.test.w_test_sim.md index 4eeb5e2fec6..92a88064e0e 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/capture_primitives.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/capture_primitives.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ capture_primitives.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/capture_reassigable_class_field.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/capture_reassigable_class_field.test.w_test_sim.md index f9bcaeebf4e..0314ae38c62 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/capture_reassigable_class_field.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/capture_reassigable_class_field.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ capture_reassigable_class_field.test.wsim » root/env0/test:main - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/capture_reassignable.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/capture_reassignable.test.w_test_sim.md index 7163330e182..5bc9e343cb0 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/capture_reassignable.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/capture_reassignable.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ capture_reassignable.test.wsim » root/env0/test:main - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/capture_resource_and_data.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/capture_resource_and_data.test.w_test_sim.md index f3e0c150289..f48985d7293 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/capture_resource_and_data.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/capture_resource_and_data.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ capture_resource_and_data.test.wsim » root/env0/test:resource and data - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/capture_resource_with_no_inflight.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/capture_resource_with_no_inflight.test.w_test_sim.md index 50282a187ae..49fb7c629b7 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/capture_resource_with_no_inflight.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/capture_resource_with_no_inflight.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ capture_resource_with_no_inflight.test.wsim » root/env0/test:test - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/capture_tokens.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/capture_tokens.test.w_test_sim.md index f1d863a47a6..0d22745ac8b 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/capture_tokens.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/capture_tokens.test.w_test_sim.md @@ -4,8 +4,7 @@ ```log pass ─ capture_tokens.test.wsim » root/env0/test:inflight class pass ─ capture_tokens.test.wsim » root/env1/test:inflight globals - - + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/captures.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/captures.test.w_test_sim.md index af1ea47afe8..b87b6f0a7c7 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/captures.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/captures.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ captures.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/casting.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/casting.test.w_test_sim.md index 53d31e02d82..d8b526adb96 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/casting.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/casting.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ casting.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/class.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/class.test.w_test_sim.md index 44df41021b0..07e6a85bd9f 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/class.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/class.test.w_test_sim.md @@ -6,8 +6,7 @@ pass ─ class.test.wsim » root/env0/test:access inflight field pass ─ class.test.wsim » root/env1/test:check derived class instance variables pass ─ class.test.wsim » root/env2/test:devived class init body happens after super pass ─ class.test.wsim » root/env3/test:inflight super constructor - - + Tests 4 passed (4) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/closure_class.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/closure_class.test.w_test_sim.md index a066db52967..6dbc1097b61 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/closure_class.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/closure_class.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ closure_class.test.wsim » root/env0/test:test - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/construct-base.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/construct-base.test.w_test_sim.md index 786bb76614e..f0b1be26547 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/construct-base.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/construct-base.test.w_test_sim.md @@ -7,8 +7,7 @@ path of sqs.queue: root/env0/SqsQueue path of wing resource: root/env0/WingResource display name of wing resource: no display name pass ─ construct-base.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/container_types.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/container_types.test.w_test_sim.md index 62918b07392..782c73d1ef4 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/container_types.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/container_types.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ container_types.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/custom_obj_id.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/custom_obj_id.test.w_test_sim.md index b652b8a94bc..72647da0401 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/custom_obj_id.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/custom_obj_id.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ custom_obj_id.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/debug_env.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/debug_env.test.w_test_sim.md index 042298c2c50..b6cc1e39da5 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/debug_env.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/debug_env.test.w_test_sim.md @@ -10,8 +10,7 @@ level 1: { A => A [type], assert => (condition: bool, message: str?): void, clou ## stdout.log ```log pass ─ debug_env.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/deep_equality.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/deep_equality.test.w_test_sim.md index 75971863ffb..8e36bc18d3e 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/deep_equality.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/deep_equality.test.w_test_sim.md @@ -15,8 +15,7 @@ pass ─ deep_equality.test.wsim » root/env6/test:Set types with different valu pass ─ deep_equality.test.wsim » root/env7/test:Map with the same value pass ─ deep_equality.test.wsim » root/env8/test:Map with different values pass ─ deep_equality.test.wsim » root/env9/test:Array with the same value - - + Tests 13 passed (13) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/double_reference.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/double_reference.test.w_test_sim.md index ddf25a934e5..c32554d087a 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/double_reference.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/double_reference.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ double_reference.test.wsim » root/env0/test:hello - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/doubler.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/doubler.test.w_test_sim.md index 33df7ffebb8..e70f843f090 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/doubler.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/doubler.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ doubler.test.wsim » root/env0/test:f(2) == 8 - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/enums.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/enums.test.w_test_sim.md index 0350d240243..acf4b2e4fc7 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/enums.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/enums.test.w_test_sim.md @@ -4,8 +4,7 @@ ```log pass ─ enums.test.wsim » root/env0/test:inflight pass ─ enums.test.wsim » root/env1/test:toStr inflight - - + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/explicit_lift_qualification.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/explicit_lift_qualification.test.w_test_sim.md index b1ab613e11b..fae9212b66f 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/explicit_lift_qualification.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/explicit_lift_qualification.test.w_test_sim.md @@ -5,8 +5,7 @@ pass ─ explicit_lift_qualification.test.wsim » root/env0/test:explicit method lift qualification pass ─ explicit_lift_qualification.test.wsim » root/env1/test:explicit closure lift qualification pass ─ explicit_lift_qualification.test.wsim » root/env2/test:explicit interface lift qualification - - + Tests 3 passed (3) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/expressions_binary_operators.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/expressions_binary_operators.test.w_test_sim.md index 872e72763c8..882687c2b30 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/expressions_binary_operators.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/expressions_binary_operators.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ expressions_binary_operators.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/expressions_string_interpolation.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/expressions_string_interpolation.test.w_test_sim.md index a2c6cbe919f..c399c1e2833 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/expressions_string_interpolation.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/expressions_string_interpolation.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ expressions_string_interpolation.test.wsim » root/env0/test:str interpolation with lifted expr - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/extern_implementation.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/extern_implementation.test.w_test_sim.md index d48ad52a4e4..dbabcbf6d8e 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/extern_implementation.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/extern_implementation.test.w_test_sim.md @@ -2,11 +2,10 @@ ## stdout.log ```log +[INFO] console | printing hey there pass ─ extern_implementation.test.wsim » root/env0/test:call -pass ┌ extern_implementation.test.wsim » root/env1/test:console - └ printing hey there - - +pass ─ extern_implementation.test.wsim » root/env1/test:console + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/file_counter.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/file_counter.test.w_test_sim.md index 87b47691b96..eff36861c73 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/file_counter.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/file_counter.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ file_counter.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/for_loop.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/for_loop.test.w_test_sim.md index 66c8755cfa8..6ec8c0920cd 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/for_loop.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/for_loop.test.w_test_sim.md @@ -101,8 +101,7 @@ for x in (z*2)..0 { ... } <=> x = 2 2 1 pass ─ for_loop.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/forward_decl.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/forward_decl.test.w_test_sim.md index d58a2c8500a..4239f8ba5c7 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/forward_decl.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/forward_decl.test.w_test_sim.md @@ -4,8 +4,7 @@ ```log hi pass ─ forward_decl.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/function_returns_function.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/function_returns_function.test.w_test_sim.md index 6d347f66fc0..0b202809661 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/function_returns_function.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/function_returns_function.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ function_returns_function.test.wsim » root/env0/test:inflight functions can return other inflight functions - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/function_type.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/function_type.test.w_test_sim.md index 8fffa59ec0b..8f0fcc4309c 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/function_type.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/function_type.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ function_type.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/function_variadic_arguments.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/function_variadic_arguments.test.w_test_sim.md index 6115f2cc354..870b89d2f8a 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/function_variadic_arguments.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/function_variadic_arguments.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ function_variadic_arguments.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/hello.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/hello.test.w_test_sim.md index f616f68e3c9..c5f72aebd01 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/hello.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/hello.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ hello.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/identical_inflights.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/identical_inflights.test.w_test_sim.md index 054328217c3..e1370c281f2 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/identical_inflights.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/identical_inflights.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ identical_inflights.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/impl_interface.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/impl_interface.test.w_test_sim.md index 234e805b994..b71e90a3214 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/impl_interface.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/impl_interface.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ impl_interface.test.wsim » root/env0/test:can call inherited inflight interface method - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/implicit_std.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/implicit_std.test.w_test_sim.md index bbb0682bcfc..cab24f5f239 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/implicit_std.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/implicit_std.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ implicit_std.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/in_scope_construct.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/in_scope_construct.test.w_test_sim.md index c823f61755a..fcf9c56575d 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/in_scope_construct.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/in_scope_construct.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ in_scope_construct.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inference.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/inference.test.w_test_sim.md index c220f9c2a25..059ceacafcd 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inference.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inference.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ inference.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight-subscribers.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight-subscribers.test.w_test_sim.md index 051449a044d..7f60a15a652 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight-subscribers.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight-subscribers.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ inflight-subscribers.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_capture_static.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_capture_static.test.w_test_sim.md index 818b2ab2d58..a5a855d700f 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_capture_static.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_capture_static.test.w_test_sim.md @@ -2,13 +2,12 @@ ## stdout.log ```log +[INFO] call static method of a namespaced type | WING_TARGET=sim pass ─ inflight_capture_static.test.wsim » root/env0/test:call static method of preflight pass ─ inflight_capture_static.test.wsim » root/env1/test:call static method of an outer inflight class pass ─ inflight_capture_static.test.wsim » root/env2/test:call static method of an inner inflight class -pass ┌ inflight_capture_static.test.wsim » root/env3/test:call static method of a namespaced type - └ WING_TARGET=sim - - +pass ─ inflight_capture_static.test.wsim » root/env3/test:call static method of a namespaced type + Tests 4 passed (4) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_as_struct_members.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_as_struct_members.test.w_test_sim.md index b1537c9b31b..f871a46688c 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_as_struct_members.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_as_struct_members.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ inflight_class_as_struct_members.test.wsim » root/env0/test:test - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_capture_const.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_capture_const.test.w_test_sim.md index 5936f63487e..19f28bbfc1b 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_capture_const.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_capture_const.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ inflight_class_capture_const.test.wsim » root/env0/test:inflight class captures const - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_capture_preflight_object.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_capture_preflight_object.test.w_test_sim.md index f4163ea98ae..e9aae34f065 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_capture_preflight_object.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_capture_preflight_object.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ inflight_class_capture_preflight_object.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_definitions.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_definitions.test.w_test_sim.md index 09fe56e3c23..ad602343b8b 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_definitions.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_definitions.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ inflight_class_definitions.test.wsim » root/env0/test:test - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_inner_capture_mutable.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_inner_capture_mutable.test.w_test_sim.md index 9d6c352e01e..8ccb923a446 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_inner_capture_mutable.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_inner_capture_mutable.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ inflight_class_inner_capture_mutable.test.wsim » root/env0/test:inner inflight class capture immutable - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_inside_inflight_closure.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_inside_inflight_closure.test.w_test_sim.md index 53e178610c9..ca111c882f6 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_inside_inflight_closure.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_inside_inflight_closure.test.w_test_sim.md @@ -4,8 +4,7 @@ ```log pass ─ inflight_class_inside_inflight_closure.test.wsim » root/env0/test:it works pass ─ inflight_class_inside_inflight_closure.test.wsim » root/env1/test:inflight class inside closure captures from closure - - + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_modifiers.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_modifiers.test.w_test_sim.md index 0b2118d1a45..13f69179dc3 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_modifiers.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_modifiers.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ inflight_class_modifiers.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_outside_inflight_closure.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_outside_inflight_closure.test.w_test_sim.md index 101ba8b528f..2ce3bcd566e 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_outside_inflight_closure.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_outside_inflight_closure.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ inflight_class_outside_inflight_closure.test.wsim » root/env0/test:inflight class outside inflight closure - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_structural_interace_handler.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_structural_interace_handler.test.w_test_sim.md index dbbcedff80f..916e37f5c55 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_structural_interace_handler.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_structural_interace_handler.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ inflight_class_structural_interace_handler.test.wsim » root/env0/test:structure interface types for 'handle' - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_without_init.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_without_init.test.w_test_sim.md index c070c300cd3..77ccf8e19df 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_without_init.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_without_init.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ inflight_class_without_init.test.wsim » root/env0/test:inflight class without init - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_closure_autoid.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_closure_autoid.test.w_test_sim.md index 32c003421cb..f7efd24dd97 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_closure_autoid.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_closure_autoid.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ inflight_closure_autoid.test.wsim » root/env0/test:inflight closure auto id - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_closure_inside_preflight_closure.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_closure_inside_preflight_closure.test.w_test_sim.md index ec2badde2ec..a3062a3462d 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_closure_inside_preflight_closure.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_closure_inside_preflight_closure.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ inflight_closure_inside_preflight_closure.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_concat.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_concat.test.w_test_sim.md index eda65604e98..ed4c1457dfe 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_concat.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_concat.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ inflight_concat.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_handler_singleton.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_handler_singleton.test.w_test_sim.md index 471cbb16304..ed5a765c34e 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_handler_singleton.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_handler_singleton.test.w_test_sim.md @@ -2,12 +2,10 @@ ## stdout.log ```log -pass ┌ inflight_handler_singleton.test.wsim » root/env0/test:single instance of Foo - └ client has been reused -pass ┌ inflight_handler_singleton.test.wsim » root/env1/test:Foo state is not shared between function invocations - └ client has been reused - - +[INFO] single instance of Foo | client has been reused +pass ─ inflight_handler_singleton.test.wsim » root/env0/test:single instance of Foo +pass ─ inflight_handler_singleton.test.wsim » root/env1/test:Foo state is not shared between function invocations + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_init.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_init.test.w_test_sim.md index 1cf063e0c8e..ae07d39cff1 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_init.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_init.test.w_test_sim.md @@ -6,8 +6,7 @@ pass ─ inflight_init.test.wsim » root/env0/test:inflight class init pass ─ inflight_init.test.wsim » root/env1/test:inflight calls parent's init pass ─ inflight_init.test.wsim » root/env2/test:inflight calls parent's init when non exists pass ─ inflight_init.test.wsim » root/env3/test:inflight class inherits form JSII class - - + Tests 4 passed (4) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflights_calling_inflights.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/inflights_calling_inflights.test.w_test_sim.md index f50bc62331d..5e802771ac0 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflights_calling_inflights.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflights_calling_inflights.test.w_test_sim.md @@ -4,8 +4,7 @@ ```log pass ─ inflights_calling_inflights.test.wsim » root/env0/test:inflights can call other inflights pass ─ inflights_calling_inflights.test.wsim » root/env1/test:variable can be an inflight closure - - + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inherit_stdlib_class.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/inherit_stdlib_class.test.w_test_sim.md index 2a3273ed1ad..377ace841f2 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inherit_stdlib_class.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inherit_stdlib_class.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ inherit_stdlib_class.test.wsim » root/env0/test:can inherit std lib preflight class - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inheritance_class_inflight.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/inheritance_class_inflight.test.w_test_sim.md index 6a58f51c2e4..73fc2965a51 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inheritance_class_inflight.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inheritance_class_inflight.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ inheritance_class_inflight.test.wsim » root/env0/test:class inheritence - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inheritance_class_preflight.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/inheritance_class_preflight.test.w_test_sim.md index bcc65964e7f..fc9f5edd6d3 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inheritance_class_preflight.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inheritance_class_preflight.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ inheritance_class_preflight.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inheritance_interface.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/inheritance_interface.test.w_test_sim.md index 35cbfd81fbe..73618ce0585 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inheritance_interface.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inheritance_interface.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ inheritance_interface.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/interface.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/interface.test.w_test_sim.md index 1c8073d7e09..886084dad2a 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/interface.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/interface.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ interface.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/issue_2889.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/issue_2889.test.w_test_sim.md index 9b20342e689..8bdd9f6e875 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/issue_2889.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/issue_2889.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ issue_2889.test.wsim » root/env0/test:api should return a valid stringified json - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/json.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/json.test.w_test_sim.md index bd9900798ec..d4a50f443e8 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/json.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/json.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ json.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/json_bucket.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/json_bucket.test.w_test_sim.md index 13578bd2b85..75aa22c20bc 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/json_bucket.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/json_bucket.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ json_bucket.test.wsim » root/env0/test:put - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/json_static.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/json_static.test.w_test_sim.md index 95b3dd37bf0..6817855e73c 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/json_static.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/json_static.test.w_test_sim.md @@ -4,8 +4,7 @@ ```log pass ─ json_static.test.wsim » root/env0/test:Access Json static inflight pass ─ json_static.test.wsim » root/env1/test:has key or not - - + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/json_string_interpolation.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/json_string_interpolation.test.w_test_sim.md index 38c7675dbe2..976a50ed310 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/json_string_interpolation.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/json_string_interpolation.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ json_string_interpolation.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/lift_expr_with_this.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/lift_expr_with_this.test.w_test_sim.md index a282edf4058..9df490183f6 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/lift_expr_with_this.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/lift_expr_with_this.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ lift_expr_with_this.test.wsim » root/env0/test:test - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/lift_inflight_closure_collection.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/lift_inflight_closure_collection.test.w_test_sim.md index 0c84ca8d479..7f3b19aee57 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/lift_inflight_closure_collection.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/lift_inflight_closure_collection.test.w_test_sim.md @@ -6,8 +6,7 @@ pass ─ lift_inflight_closure_collection.test.wsim » root/env0/test:lift closu pass ─ lift_inflight_closure_collection.test.wsim » root/env1/test:lift closure map pass ─ lift_inflight_closure_collection.test.wsim » root/env2/test:lift closure set pass ─ lift_inflight_closure_collection.test.wsim » root/env3/test:lift closure in complex collection - - + Tests 4 passed (4) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/lift_parent_fields.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/lift_parent_fields.test.w_test_sim.md index 1a98e5f39c9..5dfbba30923 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/lift_parent_fields.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/lift_parent_fields.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ lift_parent_fields.test.wsim » root/env0/test:test - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/lift_redefinition.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/lift_redefinition.test.w_test_sim.md index 6ef909a77b3..8b9912958b7 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/lift_redefinition.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/lift_redefinition.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ lift_redefinition.test.wsim » root/env0/test:test - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/lift_shared_resource.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/lift_shared_resource.test.w_test_sim.md index 9856cb0e1cc..4ba3201c7a0 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/lift_shared_resource.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/lift_shared_resource.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ lift_shared_resource.test.wsim » root/env0/test:call endpoint - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/lift_this.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/lift_this.test.w_test_sim.md index ffa3023b67f..45293518b57 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/lift_this.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/lift_this.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ lift_this.test.wsim » root/env0/test:test - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/lift_via_closure.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/lift_via_closure.test.w_test_sim.md index 3653a40e42a..fb9d3ab8cde 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/lift_via_closure.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/lift_via_closure.test.w_test_sim.md @@ -2,12 +2,11 @@ ## stdout.log ```log +[INFO] call non-synthetic closure as a function | handle called +[INFO] call non-synthetic closure as a function | putFile called pass ─ lift_via_closure.test.wsim » root/env0/test:call synthetic closure class as a function -pass ┌ lift_via_closure.test.wsim » root/env1/test:call non-synthetic closure as a function - │ handle called - └ putFile called - - +pass ─ lift_via_closure.test.wsim » root/env1/test:call non-synthetic closure as a function + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/lift_via_closure_explicit.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/lift_via_closure_explicit.test.w_test_sim.md index 6539f3705d7..342e666f018 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/lift_via_closure_explicit.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/lift_via_closure_explicit.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ lift_via_closure_explicit.test.wsim » root/env0/test:test - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/lift_weird_order.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/lift_weird_order.test.w_test_sim.md index 7162ef73ad8..823fe122e5f 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/lift_weird_order.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/lift_weird_order.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ lift_weird_order.test.wsim » root/env0/test:something - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/lift_with_phase_ind.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/lift_with_phase_ind.test.w_test_sim.md index fa3efb1e736..36565f668af 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/lift_with_phase_ind.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/lift_with_phase_ind.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ lift_with_phase_ind.test.wsim » root/env0/test:Use phase independent methods on lifted object - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/map_entries.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/map_entries.test.w_test_sim.md index c3815cbf349..43d97bb3ef1 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/map_entries.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/map_entries.test.w_test_sim.md @@ -6,8 +6,7 @@ pass ─ map_entries.test.wsim » root/env0/test:check if map has entries pass ─ map_entries.test.wsim » root/env1/test:get value from map pass ─ map_entries.test.wsim » root/env2/test:iterate map using entries() method pass ─ map_entries.test.wsim » root/env3/test:check entries() when map has multiple entries - - + Tests 4 passed (4) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/mut_container_types.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/mut_container_types.test.w_test_sim.md index e4374d541d7..f2065cd47de 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/mut_container_types.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/mut_container_types.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ mut_container_types.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/mutation_after_class_init.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/mutation_after_class_init.test.w_test_sim.md index b933f038c2d..51c14388605 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/mutation_after_class_init.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/mutation_after_class_init.test.w_test_sim.md @@ -2,10 +2,9 @@ ## stdout.log ```log -pass ┌ mutation_after_class_init.test.wsim » root/env0/test:hi - └ received message1 - - +[INFO] hi | received message1 +pass ─ mutation_after_class_init.test.wsim » root/env0/test:hi + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/new_in_static.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/new_in_static.test.w_test_sim.md index 3d178f9347c..9e0aba51e6b 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/new_in_static.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/new_in_static.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ new_in_static.test.wsim » root/env0/test:play with buckets - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/new_jsii.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/new_jsii.test.w_test_sim.md index 0c6acbe5c6a..63647112800 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/new_jsii.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/new_jsii.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ new_jsii.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/nil.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/nil.test.w_test_sim.md index 4bedac0fe33..3488992d6b3 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/nil.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/nil.test.w_test_sim.md @@ -4,8 +4,7 @@ ```log pass ─ nil.test.wsim » root/env0/test:nil return pass ─ nil.test.wsim » root/env1/test:optional instance variable - - + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/on_lift.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/on_lift.test.w_test_sim.md index f3a73b46a63..8aebecebc89 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/on_lift.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/on_lift.test.w_test_sim.md @@ -2,11 +2,10 @@ ## stdout.log ```log -pass ┌ on_lift.test.wsim » root/env0/test:onLift and onLiftType allow capabilities to be granted to inflight hosts - │ I'm expecting ABC to be set - └ I'm expecting XYZ to be set - - +[INFO] onLift and onLiftType allow capabilities to be granted to inflight hosts | I'm expecting ABC to be set +[INFO] onLift and onLiftType allow capabilities to be granted to inflight hosts | I'm expecting XYZ to be set +pass ─ on_lift.test.wsim » root/env0/test:onLift and onLiftType allow capabilities to be granted to inflight hosts + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/optionals.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/optionals.test.w_test_sim.md index 6576a7661c5..b834cd3b8cc 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/optionals.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/optionals.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ optionals.test.wsim » root/env0/test:t - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/parameters/nested/parameters.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/parameters/nested/parameters.test.w_test_sim.md index cfe82d35b23..f02f4dc461b 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/parameters/nested/parameters.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/parameters/nested/parameters.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ parameters.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/parameters/simple/parameters.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/parameters/simple/parameters.test.w_test_sim.md index 95fadf6c0ee..689cc2c78d9 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/parameters/simple/parameters.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/parameters/simple/parameters.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ parameters.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/phase_independent_method_on_string.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/phase_independent_method_on_string.test.w_test_sim.md index dcf88a9bd5a..44582d5dfaf 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/phase_independent_method_on_string.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/phase_independent_method_on_string.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ phase_independent_method_on_string.test.wsim » root/env0/test:phase independent method on string evaluated inflight - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/primitive_methods.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/primitive_methods.test.w_test_sim.md index aab599c0bde..5da46d1dd84 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/primitive_methods.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/primitive_methods.test.w_test_sim.md @@ -4,8 +4,7 @@ ```log 1:60 pass ─ primitive_methods.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/print.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/print.test.w_test_sim.md index e93bab50ee3..0e44a128cde 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/print.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/print.test.w_test_sim.md @@ -4,16 +4,13 @@ ```log preflight log preflight log -pass ┌ print.test.wsim » root/env0/test:log1 - │ inflight log 1.1 - └ inflight log 1.2 -pass ┌ print.test.wsim » root/env1/test:log2 - │ inflight log 1.1 - │ inflight log 1.2 - │ inflight log 2.1 - └ inflight log 2.2 - - +[INFO] log1 | inflight log 1.1 +[INFO] log1 | inflight log 1.2 +[INFO] log2 | inflight log 2.1 +[INFO] log2 | inflight log 2.2 +pass ─ print.test.wsim » root/env0/test:log1 +pass ─ print.test.wsim » root/env1/test:log2 + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/reassignment.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/reassignment.test.w_test_sim.md index 5f27c41c368..0aaa0052c92 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/reassignment.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/reassignment.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ reassignment.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/redis.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/redis.test.w_test_sim.md index bacf5d04793..5a56e97045d 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/redis.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/redis.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ redis.test.wsim » root/env0/test:testing Redis - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) 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 b032c7d1595..f87bdd61606 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 @@ -89,7 +89,7 @@ module.exports = function({ $__parent_this_4_q }) { ```cjs "use strict"; const $helpers = require("@winglang/sdk/lib/helpers"); -module.exports = function({ $bigOlPublisher }) { +module.exports = function({ $bigOlPublisher, $util_Util }) { class $Closure5 { constructor({ }) { const $obj = (...args) => this.handle(...args); @@ -98,7 +98,11 @@ module.exports = function({ $bigOlPublisher }) { } async handle() { (await $bigOlPublisher.publish("foo")); - const count = (await $bigOlPublisher.getObjectCount()); + (await $util_Util.waitUntil((async () => { + const count = (await $bigOlPublisher.getObjectCount()); + return $helpers.eq(count, 2); + }))); + $helpers.assert($helpers.eq((await $bigOlPublisher.getObjectCount()), 2), "bigOlPublisher.getObjectCount() == 2"); } } return $Closure5; @@ -703,6 +707,7 @@ 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 { constructor($scope, $id) { super($scope, $id); @@ -1027,6 +1032,7 @@ class $Root extends $stdlib.std.Resource { return ` require("${$helpers.normalPath(__dirname)}/inflight.$Closure5-1.cjs")({ $bigOlPublisher: ${$stdlib.core.liftObject(bigOlPublisher)}, + $util_Util: ${$stdlib.core.liftObject($stdlib.core.toLiftableModuleType(util.Util, "@winglang/sdk/util", "Util"))}, }) `; } 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..18104bec687 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 @@ -2,12 +2,10 @@ ## stdout.log ```log -pass ┌ resource.test.wsim » root/env0/test:test - └ counter is: 201 -pass ┌ resource.test.wsim » root/env1/test:dependency cycles - └ counter is: 201 - - +[INFO] test | counter is: 201 +pass ─ resource.test.wsim » root/env0/test:test +pass ─ resource.test.wsim » root/env1/test:dependency cycles + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/resource_as_inflight_literal.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/resource_as_inflight_literal.test.w_test_sim.md index 6b554e44adc..89e58c8e77c 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/resource_as_inflight_literal.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/resource_as_inflight_literal.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ resource_as_inflight_literal.test.wsim » root/env0/test:test - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/resource_call_static.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/resource_call_static.test.w_test_sim.md index ca20203a18e..0a9ec8d0fc2 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/resource_call_static.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/resource_call_static.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ resource_call_static.test.wsim » root/env0/test:access cloud resource through static methods only - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/resource_captures.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/resource_captures.test.w_test_sim.md index 433815cce86..56369191ec2 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/resource_captures.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/resource_captures.test.w_test_sim.md @@ -2,12 +2,11 @@ ## stdout.log ```log -pass ┌ resource_captures.test.wsim » root/env0/test:test - │ array.len=3 - │ field=hello! - └ this.another.first.myResource:myString - - +[INFO] test | array.len=3 +[INFO] test | field=hello! +[INFO] test | this.another.first.myResource:myString +pass ─ resource_captures.test.wsim » root/env0/test:test + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) 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 abcd3c26134..b5bb104f05a 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 @@ -82,9 +82,10 @@ module.exports = function({ }) { ```cjs "use strict"; const $helpers = require("@winglang/sdk/lib/helpers"); -module.exports = function({ $Another, $__arr__index_______if__index___0____index____arr_length__throw_new_Error__Index_out_of_bounds____return_arr_index______globalArrayOfStr__0_, $__obj__key_______if____key_in_obj___throw_new_Error__Map_does_not_contain_key_____key______return_obj_key______globalMapOfNum___a__, $_globalSetOfStr_has__a___, $globalAnother, $globalAnother_first_myResource, $globalAnother_myField, $globalBool, $globalBucket, $globalNum, $globalStr }) { +module.exports = function({ $Another, $__arr__index_______if__index___0____index____arr_length__throw_new_Error__Index_out_of_bounds____return_arr_index______globalArrayOfStr__0_, $__obj__key_______if____key_in_obj___throw_new_Error__Map_does_not_contain_key_____key______return_obj_key______globalMapOfNum___a__, $_globalSetOfStr_has__a___, $globalAnother, $globalAnother_first_myResource, $globalAnother_myField, $globalBool, $globalBucket, $globalNum, $globalStr, $util_Util }) { class MyResource { - constructor({ $this_localTopic }) { + constructor({ $this_localCounter, $this_localTopic }) { + this.$this_localCounter = $this_localCounter; this.$this_localTopic = $this_localTopic; } async myPut() { @@ -100,6 +101,9 @@ module.exports = function({ $Another, $__arr__index_______if__index___0____index (await $globalAnother_first_myResource.put("key", "value")); $helpers.assert(((await $globalAnother.myMethod()) > 0), "globalAnother.myMethod() > 0"); $helpers.assert(((await $Another.myStaticMethod()) > 0), "Another.myStaticMethod() > 0"); + (await $util_Util.waitUntil((async () => { + return ((await this.$this_localCounter.peek()) > 0); + }))); } } return MyResource; @@ -360,6 +364,7 @@ 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 { constructor($scope, $id) { super($scope, $id); @@ -493,6 +498,7 @@ class $Root extends $stdlib.std.Resource { $globalBucket: ${$stdlib.core.liftObject(globalBucket)}, $globalNum: ${$stdlib.core.liftObject(globalNum)}, $globalStr: ${$stdlib.core.liftObject(globalStr)}, + $util_Util: ${$stdlib.core.liftObject($stdlib.core.toLiftableModuleType(util.Util, "@winglang/sdk/util", "Util"))}, }) `; } @@ -501,6 +507,7 @@ class $Root extends $stdlib.std.Resource { (await (async () => { const MyResourceClient = ${MyResource._toInflightType()}; const client = new MyResourceClient({ + $this_localCounter: ${$stdlib.core.liftObject(this.localCounter)}, $this_localTopic: ${$stdlib.core.liftObject(this.localTopic)}, }); if (client.$inflight_init) { await client.$inflight_init(); } @@ -522,6 +529,7 @@ class $Root extends $stdlib.std.Resource { [globalBucket, ["put"]], [globalNum, []], [globalStr, []], + [this.localCounter, ["peek"]], [this.localTopic, ["publish"]], ], "$inflight_init": [ @@ -536,6 +544,7 @@ class $Root extends $stdlib.std.Resource { [globalBucket, []], [globalNum, []], [globalStr, []], + [this.localCounter, []], [this.localTopic, []], ], }); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/resource_captures_globals.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/resource_captures_globals.test.w_test_sim.md index 6d7af3ad91d..64ed0d891a8 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/resource_captures_globals.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/resource_captures_globals.test.w_test_sim.md @@ -4,8 +4,7 @@ ```log pass ─ resource_captures_globals.test.wsim » root/env0/test:test pass ─ resource_captures_globals.test.wsim » root/env1/test:access cloud resource through static methods only - - + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/service.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/service.test.w_test_sim.md index 8f870359639..a61ab18a8fa 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/service.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/service.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ service.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/shadowing.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/shadowing.test.w_test_sim.md index cc0c9e20c30..3120eb6a40a 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/shadowing.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/shadowing.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ shadowing.test.wsim » root/env0/test:capture shadow interaction - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/statements_if.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/statements_if.test.w_test_sim.md index 7b347593cdf..bcbffd2255f 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/statements_if.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/statements_if.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ statements_if.test.wsim » root/env0/test:test - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/statements_variable_declarations.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/statements_variable_declarations.test.w_test_sim.md index c903097e2ba..ae42407cd49 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/statements_variable_declarations.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/statements_variable_declarations.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ statements_variable_declarations.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/static_members.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/static_members.test.w_test_sim.md index 4e0e6195a3b..dfd4a07d794 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/static_members.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/static_members.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ static_members.test.wsim » root/env0/test:test - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/std_containers.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/std_containers.test.w_test_sim.md index 64a42204ddf..92cabdbe567 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/std_containers.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/std_containers.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ std_containers.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/std_string.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/std_string.test.w_test_sim.md index f722f716b8d..ecf64aece0e 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/std_string.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/std_string.test.w_test_sim.md @@ -2,12 +2,11 @@ ## stdout.log ```log -pass ┌ std_string.test.wsim » root/env0/test:string - │ index of "s" in s1 is 0 - │ string - └ some strings are immutable - - +[INFO] string | index of "s" in s1 is 0 +[INFO] string | string +[INFO] string | some strings are immutable +pass ─ std_string.test.wsim » root/env0/test:string + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/struct_from_json.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/struct_from_json.test.w_test_sim.md index f3607c9b288..f00330424d9 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/struct_from_json.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/struct_from_json.test.w_test_sim.md @@ -7,8 +7,7 @@ pass ─ struct_from_json.test.wsim » root/env1/test:flight school student :) pass ─ struct_from_json.test.wsim » root/env2/test:lifting a student pass ─ struct_from_json.test.wsim » root/env3/test:inflight schema usage pass ─ struct_from_json.test.wsim » root/env4/test:unsafe flight - - + Tests 5 passed (5) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/structs.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/structs.test.w_test_sim.md index 14c25d6a818..02ca8cffbb9 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/structs.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/structs.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ structs.test.wsim » root/env0/test:struct definitions are phase independant - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/super_call.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/super_call.test.w_test_sim.md index 6bd65a802ef..0c804d97d9d 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/super_call.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/super_call.test.w_test_sim.md @@ -4,8 +4,7 @@ ```log pass ─ super_call.test.wsim » root/env0/test:super call inflight pass ─ super_call.test.wsim » root/env1/test:super call sets binding permissions - - + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/symbol_shadow.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/symbol_shadow.test.w_test_sim.md index 4ecebc7c1e7..a4846ce4cef 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/symbol_shadow.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/symbol_shadow.test.w_test_sim.md @@ -6,8 +6,7 @@ pass ─ symbol_shadow.test.wsim » root/env0/test:inflight nested should not ca pass ─ symbol_shadow.test.wsim » root/env1/A/test:inflight in resource should capture the right scoped var pass ─ symbol_shadow.test.wsim » root/env2/test:inflight on top should capture top pass ─ symbol_shadow.test.wsim » root/env3/test:insideInflight should capture the right scope - - + Tests 4 passed (4) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/table.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/table.test.w_test_sim.md index 6ea9afdca01..4d87d3440bd 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/table.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/table.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ table.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/test_bucket.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/test_bucket.test.w_test_sim.md index a884c6b30b0..4a38902caec 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/test_bucket.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/test_bucket.test.w_test_sim.md @@ -4,8 +4,7 @@ ```log pass ─ test_bucket.test.wsim » root/env0/test:put pass ─ test_bucket.test.wsim » root/env1/test:get - - + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/test_without_bring.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/test_without_bring.test.w_test_sim.md index 3ea67240590..7f219b6764e 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/test_without_bring.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/test_without_bring.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ test_without_bring.test.wsim » root/env0/test:hello test - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/this.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/this.test.w_test_sim.md index 79d042faf4e..de768938614 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/this.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/this.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ this.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/try_catch.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/try_catch.test.w_test_sim.md index 46ea8178dae..d67d81d2f34 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/try_catch.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/try_catch.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ try_catch.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/unused_lift.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/unused_lift.test.w_test_sim.md index 6dc18fb1083..cf23512dbfe 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/unused_lift.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/unused_lift.test.w_test_sim.md @@ -4,8 +4,7 @@ ```log pass ─ unused_lift.test.wsim » root/env0/test:Use class but not method that access lifted object pass ─ unused_lift.test.wsim » root/env1/test:Use class but not static method that access lifted object - - + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/use_inflight_method_inside_init_closure.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/use_inflight_method_inside_init_closure.test.w_test_sim.md index 575ab275c42..35210f5c8d4 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/use_inflight_method_inside_init_closure.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/use_inflight_method_inside_init_closure.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ use_inflight_method_inside_init_closure.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/website_with_api.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/website_with_api.test.w_test_sim.md index 3e22c360dcf..c2b1f1f0b0a 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/website_with_api.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/website_with_api.test.w_test_sim.md @@ -4,8 +4,7 @@ ```log pass ─ website_with_api.test.wsim » root/env0/test:GET --users pass ─ website_with_api.test.wsim » root/env1/test:OPTIONS --users - - + Tests 2 passed (2) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/while.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/while.test.w_test_sim.md index 149bd246cf6..3b57ebab756 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/while.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/while.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ while.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/while_loop_await.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/while_loop_await.test.w_test_sim.md index 15f3a123a20..e86209acc21 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/while_loop_await.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/while_loop_await.test.w_test_sim.md @@ -3,8 +3,7 @@ ## stdout.log ```log pass ─ while_loop_await.test.wsim (no tests) - - + Tests 1 passed (1) Snapshots 1 skipped Test Files 1 passed (1) diff --git a/tools/hangar/src/generated_test_targets.ts b/tools/hangar/src/generated_test_targets.ts index 2953f8d5782..030d3491681 100644 --- a/tools/hangar/src/generated_test_targets.ts +++ b/tools/hangar/src/generated_test_targets.ts @@ -55,13 +55,16 @@ export async function compileTest( if (!include.find((f) => subpath.includes(f))) { continue; } - if ((subpath.endsWith(".js") || subpath.endsWith(".cjs")) && !includeJavaScriptInSnapshots) { + if ( + (subpath.endsWith(".js") || subpath.endsWith(".cjs")) && + !includeJavaScriptInSnapshots + ) { continue; } let fileContents = await fs.readFile(dotFile, "utf8"); // ensure no absolute requires are included in the snapshot - if(/require\("(\/|\w:).*\/(.+)"\)/g.test(fileContents)) { + if (/require\("(\/|\w:).*\/(.+)"\)/g.test(fileContents)) { throw new Error(`Found absolute path in ${dotFile}`); } diff --git a/tools/hangar/src/invalid.test.ts b/tools/hangar/src/invalid.test.ts index b69d9414a10..ccb1764d77d 100644 --- a/tools/hangar/src/invalid.test.ts +++ b/tools/hangar/src/invalid.test.ts @@ -47,4 +47,4 @@ test("invalid compile directory", async ({ expect }) => { }); expect(out.stderr).toMatchSnapshot(); -}) \ No newline at end of file +}); From 65d7da7211ef5d40d22aa9dcfb59aa7a757fcdeb Mon Sep 17 00:00:00 2001 From: Mark McCulloh Date: Sun, 14 Apr 2024 01:13:48 -0400 Subject: [PATCH 10/15] fix(vscode): missing completions in empty implicit struct literal (#6232) Fixes #6215 *By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*. --- libs/wingc/src/lsp/completions.rs | 18 ++++++++++++++++++ .../struct_literal_empty_nospace.snap | 16 ++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 libs/wingc/src/lsp/snapshots/completions/struct_literal_empty_nospace.snap diff --git a/libs/wingc/src/lsp/completions.rs b/libs/wingc/src/lsp/completions.rs index c1d4c1541a0..fe08eec9a34 100644 --- a/libs/wingc/src/lsp/completions.rs +++ b/libs/wingc/src/lsp/completions.rs @@ -410,6 +410,12 @@ pub fn on_completion(params: lsp_types::CompletionParams) -> CompletionResponse return vec![]; }; + (fields, *structy) + } else if let ExprKind::JsonMapLiteral { fields } = &expr.kind { + let Some(structy) = types.get_type_from_json_cast(expr.id) else { + return vec![]; + }; + (fields, *structy) } else { return vec![]; @@ -1620,6 +1626,18 @@ Foo { x: "hi", } "# ); + test_completion_list!( + struct_literal_empty_nospace, + r#" +struct Foo { + x: str; +} + +let x: Foo = {} + //^ +"# + ); + test_completion_list!( struct_literal_all, r#" diff --git a/libs/wingc/src/lsp/snapshots/completions/struct_literal_empty_nospace.snap b/libs/wingc/src/lsp/snapshots/completions/struct_literal_empty_nospace.snap new file mode 100644 index 00000000000..2e4a08ccf60 --- /dev/null +++ b/libs/wingc/src/lsp/snapshots/completions/struct_literal_empty_nospace.snap @@ -0,0 +1,16 @@ +--- +source: libs/wingc/src/lsp/completions.rs +--- +- label: "x:" + kind: 5 + detail: str + documentation: + kind: markdown + value: "```wing\nx: str\n```" + sortText: "ab|a|x:" + insertText: "x: $1" + insertTextFormat: 2 + command: + title: triggerCompletion + command: editor.action.triggerSuggest + From ab4e6bb1298526d349ce855a87cf3d04d68f78e2 Mon Sep 17 00:00:00 2001 From: Mark McCulloh Date: Sun, 14 Apr 2024 10:28:20 -0400 Subject: [PATCH 11/15] fix: update tree-sitter to latest (#6231) The primary goal of this PR is to update tree-sitter to the latest version. This resulted in: - Pinned tree-sitter to a git commit dependency until https://github.com/tree-sitter/tree-sitter/commit/a7a47d561d4e64eaf226f93c4d68076afa67fdda is released. tree-sitter's release schedule is unpredictable and we don't publish any rust crates so this should be fine for now - The `tree-sitter-traversal` dependency is removed since it doesn't support newer versions of tree-sitter, so I just added some code for the equivalent functionality - Re-generated language bindings for tree-sitter. Due to a slight change in how tree-sitter builds it's hard to fully opt out of these (we do use the rust one). Luckily they should not require changing for a while - Added some additional ts queries and query tests, taken from the neovim tree-sitter repo - Changes to the scanner and rust parser to match the previous behavior of AUTOMATIC_SEMICOLON which had been broken - Changes to the scanner and rust parser to match the previous behavior of named and positional arguments. I didn't get an exact match but I think most cases actually look a little better now Most of the new files here are a result of the binding regeneration and can kinda be ignored. Side note: Also noticed that the automatic semicolon insertion hasn't been working for a while so I added a fix for that (see `lsp.ts`) *By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*. --- Cargo.lock | 602 ++---------------- apps/wing/src/commands/lsp.ts | 7 +- libs/tree-sitter-wing/.editorconfig | 39 ++ libs/tree-sitter-wing/Cargo.toml | 27 +- libs/tree-sitter-wing/Makefile | 112 ++++ libs/tree-sitter-wing/Package.swift | 47 ++ libs/tree-sitter-wing/README.md | 18 +- libs/tree-sitter-wing/binding.gyp | 23 +- .../bindings/c/tree-sitter-wing.h | 16 + .../bindings/c/tree-sitter-wing.pc.in | 11 + libs/tree-sitter-wing/bindings/go/binding.go | 13 + .../bindings/go/binding_test.go | 15 + libs/tree-sitter-wing/bindings/go/go.mod | 5 + .../tree-sitter-wing/bindings/node/binding.cc | 36 +- .../tree-sitter-wing/bindings/node/index.d.ts | 28 + libs/tree-sitter-wing/bindings/node/index.js | 18 +- .../python/tree_sitter_wing/__init__.py | 5 + .../python/tree_sitter_wing/__init__.pyi | 1 + .../python/tree_sitter_wing/binding.c | 27 + .../bindings/python/tree_sitter_wing/py.typed | 0 libs/tree-sitter-wing/bindings/rust/build.rs | 31 +- libs/tree-sitter-wing/bindings/rust/lib.rs | 31 +- .../bindings/swift/TreeSitterWing/wing.h | 16 + libs/tree-sitter-wing/grammar.js | 26 +- libs/tree-sitter-wing/package.json | 29 +- libs/tree-sitter-wing/pyproject.toml | 29 + libs/tree-sitter-wing/queries/folds.scm | 15 + libs/tree-sitter-wing/queries/highlights.scm | 85 +-- libs/tree-sitter-wing/queries/locals.scm | 4 +- libs/tree-sitter-wing/setup.py | 60 ++ libs/tree-sitter-wing/src/grammar.json | 178 +----- libs/tree-sitter-wing/src/scanner.c | 13 +- libs/tree-sitter-wing/test/highlight/class.w | 19 + .../test/highlight/nested_method.w | 4 +- libs/tree-sitter-wing/tree-sitter-dsl.d.ts | 64 +- libs/wingc/Cargo.toml | 4 +- libs/wingc/src/lib.rs | 1 + libs/wingc/src/parser.rs | 68 +- libs/wingc/src/ts_traversal.rs | 59 ++ pnpm-lock.yaml | 205 +++--- tools/hangar/__snapshots__/invalid.ts.snap | 44 +- 41 files changed, 995 insertions(+), 1040 deletions(-) create mode 100644 libs/tree-sitter-wing/.editorconfig create mode 100644 libs/tree-sitter-wing/Makefile create mode 100644 libs/tree-sitter-wing/Package.swift create mode 100644 libs/tree-sitter-wing/bindings/c/tree-sitter-wing.h create mode 100644 libs/tree-sitter-wing/bindings/c/tree-sitter-wing.pc.in create mode 100644 libs/tree-sitter-wing/bindings/go/binding.go create mode 100644 libs/tree-sitter-wing/bindings/go/binding_test.go create mode 100644 libs/tree-sitter-wing/bindings/go/go.mod create mode 100644 libs/tree-sitter-wing/bindings/node/index.d.ts create mode 100644 libs/tree-sitter-wing/bindings/python/tree_sitter_wing/__init__.py create mode 100644 libs/tree-sitter-wing/bindings/python/tree_sitter_wing/__init__.pyi create mode 100644 libs/tree-sitter-wing/bindings/python/tree_sitter_wing/binding.c create mode 100644 libs/tree-sitter-wing/bindings/python/tree_sitter_wing/py.typed create mode 100644 libs/tree-sitter-wing/bindings/swift/TreeSitterWing/wing.h create mode 100644 libs/tree-sitter-wing/pyproject.toml create mode 100644 libs/tree-sitter-wing/queries/folds.scm create mode 100644 libs/tree-sitter-wing/setup.py create mode 100644 libs/tree-sitter-wing/test/highlight/class.w create mode 100644 libs/wingc/src/ts_traversal.rs diff --git a/Cargo.lock b/Cargo.lock index c06f6fc19d2..19f5ad9e0b9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -28,15 +28,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "ansi_term" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -dependencies = [ - "winapi", -] - [[package]] name = "anstream" version = "0.6.13" @@ -85,12 +76,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "anyhow" -version = "1.0.80" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ad32ce52e4161730f7098c077cd2ed6229b5804ccf99e5366be1ab72a98b4e1" - [[package]] name = "arrayref" version = "0.3.7" @@ -103,12 +88,6 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" -[[package]] -name = "ascii" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16" - [[package]] name = "atty" version = "0.2.14" @@ -182,12 +161,6 @@ dependencies = [ "serde", ] -[[package]] -name = "bumpalo" -version = "3.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" - [[package]] name = "bytecheck" version = "0.6.11" @@ -210,12 +183,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "bytes" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" - [[package]] name = "camino" version = "1.1.6" @@ -224,18 +191,9 @@ checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" [[package]] name = "cc" -version = "1.0.83" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] - -[[package]] -name = "cesu8" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" +checksum = "17f6e324229dc011159fcc089755d1e2e216a90d43a7dea6853ca740b84f35e7" [[package]] name = "cfg-if" @@ -243,32 +201,11 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "chunked_transfer" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cca491388666e04d7248af3f60f0c40cfb0991c72205595d7c396e3510207d1a" - -[[package]] -name = "clap" -version = "2.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" -dependencies = [ - "ansi_term", - "atty", - "bitflags 1.3.2", - "strsim 0.8.0", - "textwrap", - "unicode-width", - "vec_map", -] - [[package]] name = "clap" -version = "4.5.1" +version = "4.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c918d541ef2913577a0f9566e9ce27cb35b6df072075769e0b26cb5a554520da" +checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" dependencies = [ "clap_builder", "clap_derive", @@ -276,23 +213,23 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.1" +version = "4.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f3e7391dad68afb0c2ede1bf619f579a3dc9c2ec67f089baa397123a2f3d1eb" +checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" dependencies = [ "anstream", "anstyle", "clap_lex", - "strsim 0.11.0", + "strsim", ] [[package]] name = "clap_derive" -version = "4.5.0" +version = "4.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "307bc0538d5f0f83b8248db3087aa92fe504e4691294d0c96c0eabc33f47ba47" +checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" dependencies = [ - "heck", + "heck 0.5.0", "proc-macro2", "quote", "syn 2.0.51", @@ -321,16 +258,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "combine" -version = "4.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" -dependencies = [ - "bytes", - "memchr", -] - [[package]] name = "console" version = "0.15.7" @@ -369,22 +296,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" -[[package]] -name = "core-foundation" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" - [[package]] name = "cpufeatures" version = "0.2.9" @@ -424,12 +335,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "difference" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" - [[package]] name = "digest" version = "0.10.7" @@ -440,33 +345,13 @@ dependencies = [ "crypto-common", ] -[[package]] -name = "dirs" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30baa043103c9d0c2a57cf537cc2f35623889dc0d405e6c3cccfadbc81c71309" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs-sys" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - [[package]] name = "duplicate" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de78e66ac9061e030587b2a2e75cc88f22304913c907b11307bca737141230cb" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro-error", ] @@ -506,14 +391,14 @@ checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "filetime" -version = "0.2.22" +version = "0.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0" +checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.3.5", - "windows-sys 0.48.0", + "redox_syscall", + "windows-sys 0.52.0", ] [[package]] @@ -574,12 +459,6 @@ dependencies = [ "wasi", ] -[[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - [[package]] name = "globset" version = "0.4.12" @@ -614,6 +493,12 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -638,21 +523,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "html-escape" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d1ad449764d627e22bfd7cd5e8868264fc9236e07c752972b4080cd351cb476" -dependencies = [ - "utf8-width", -] - -[[package]] -name = "httpdate" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" - [[package]] name = "idna" version = "0.4.0" @@ -675,9 +545,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.3" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -686,9 +556,9 @@ dependencies = [ [[package]] name = "indoc" -version = "2.0.4" +version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8" +checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" [[package]] name = "insta" @@ -732,37 +602,6 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" -[[package]] -name = "jni" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" -dependencies = [ - "cesu8", - "cfg-if", - "combine", - "jni-sys", - "log", - "thiserror", - "walkdir", - "windows-sys 0.45.0", -] - -[[package]] -name = "jni-sys" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" - -[[package]] -name = "js-sys" -version = "0.3.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" -dependencies = [ - "wasm-bindgen", -] - [[package]] name = "lazy_static" version = "1.4.0" @@ -775,16 +614,6 @@ version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" -[[package]] -name = "libloading" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" -dependencies = [ - "cfg-if", - "winapi", -] - [[package]] name = "linked-hash-map" version = "0.5.6" @@ -799,9 +628,9 @@ checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "log" -version = "0.4.20" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "lsp-types" @@ -816,20 +645,11 @@ dependencies = [ "url", ] -[[package]] -name = "malloc_buf" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" -dependencies = [ - "libc", -] - [[package]] name = "memchr" -version = "2.7.1" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "memoffset" @@ -849,12 +669,6 @@ dependencies = [ "adler", ] -[[package]] -name = "ndk-context" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" - [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -865,15 +679,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "objc" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" -dependencies = [ - "malloc_buf", -] - [[package]] name = "once_cell" version = "1.19.0" @@ -1109,51 +914,25 @@ dependencies = [ "getrandom", ] -[[package]] -name = "raw-window-handle" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" - -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "redox_syscall" -version = "0.3.5" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ "bitflags 1.3.2", ] -[[package]] -name = "redox_users" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" -dependencies = [ - "getrandom", - "redox_syscall 0.2.16", - "thiserror", -] - [[package]] name = "regex" -version = "1.10.3" +version = "1.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ "aho-corasick", "memchr", "regex-automata", - "regex-syntax 0.8.2", + "regex-syntax", ] [[package]] @@ -1164,20 +943,14 @@ checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.2", + "regex-syntax", ] [[package]] name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - -[[package]] -name = "regex-syntax" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "rend" @@ -1216,12 +989,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - [[package]] name = "rustix" version = "0.38.31" @@ -1247,27 +1014,12 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - [[package]] name = "seahash" version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" -[[package]] -name = "semver" -version = "1.0.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" - [[package]] name = "serde" version = "1.0.197" @@ -1290,11 +1042,10 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.114" +version = "1.0.115" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" +checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd" dependencies = [ - "indexmap 2.2.3", "itoa", "ryu", "serde", @@ -1349,12 +1100,6 @@ version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" -[[package]] -name = "smallbitvec" -version = "2.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75ce4f9dc4a41b4c3476cc925f1efb11b66df373a8fde5d4b8915fa91b5d995e" - [[package]] name = "smallvec" version = "1.13.1" @@ -1382,12 +1127,6 @@ dependencies = [ "syn 2.0.51", ] -[[package]] -name = "strsim" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" - [[package]] name = "strsim" version = "0.11.0" @@ -1409,7 +1148,7 @@ version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a3417fc93d76740d974a01654a09777cb500428cc874ca9f45edfe0c4d4cd18" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", "rustversion", @@ -1465,15 +1204,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "textwrap" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -dependencies = [ - "unicode-width", -] - [[package]] name = "thiserror" version = "1.0.57" @@ -1504,18 +1234,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "tiny_http" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "389915df6413a2e74fb181895f933386023c71110878cd0825588928e64cdc82" -dependencies = [ - "ascii", - "chunked_transfer", - "httpdate", - "log", -] - [[package]] name = "tinyvec" version = "1.6.0" @@ -1531,15 +1249,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" -[[package]] -name = "toml" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" -dependencies = [ - "serde", -] - [[package]] name = "tracing" version = "0.1.40" @@ -1599,120 +1308,19 @@ dependencies = [ [[package]] name = "tree-sitter" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e747b1f9b7b931ed39a548c1fae149101497de3c1fc8d9e18c62c1a66c683d3d" +version = "0.22.4" +source = "git+https://github.com/tree-sitter/tree-sitter.git?rev=a7a47d561d4e64eaf226f93c4d68076afa67fdda#a7a47d561d4e64eaf226f93c4d68076afa67fdda" dependencies = [ "cc", "regex", ] -[[package]] -name = "tree-sitter-cli" -version = "0.20.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae7e9d844d4d38e511a7b93fe8ced79f2a364c32fdea10d04546f1c8317d5a0c" -dependencies = [ - "ansi_term", - "anyhow", - "atty", - "clap 2.34.0", - "difference", - "dirs", - "glob", - "html-escape", - "indexmap 1.9.3", - "lazy_static", - "log", - "regex", - "regex-syntax 0.6.29", - "rustc-hash", - "semver", - "serde", - "serde_json", - "smallbitvec", - "tiny_http", - "toml", - "tree-sitter", - "tree-sitter-config", - "tree-sitter-highlight", - "tree-sitter-loader", - "tree-sitter-tags", - "walkdir", - "webbrowser", - "which", -] - -[[package]] -name = "tree-sitter-config" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5fec4cb27f052ead2246631b332dba0cb6af9a54ce012badee59c4b0ded5e03" -dependencies = [ - "anyhow", - "dirs", - "serde", - "serde_json", -] - -[[package]] -name = "tree-sitter-highlight" -version = "0.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "042342584c5a7a0b833d9fc4e2bdab3f9868ddc6c4b339a1e01451c6720868bc" -dependencies = [ - "regex", - "thiserror", - "tree-sitter", -] - -[[package]] -name = "tree-sitter-loader" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0b17eef4833c7c139abed66d562dfa23228e97e647597baf246fd56c21bbfaf" -dependencies = [ - "anyhow", - "cc", - "dirs", - "libloading", - "once_cell", - "regex", - "serde", - "serde_json", - "tree-sitter", - "tree-sitter-highlight", - "tree-sitter-tags", -] - -[[package]] -name = "tree-sitter-tags" -version = "0.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccb3f1376219530a37a809751ecf65aa35fd8b9c1c4ab6d4faf5f6a9eeda2c05" -dependencies = [ - "memchr", - "regex", - "thiserror", - "tree-sitter", -] - -[[package]] -name = "tree-sitter-traversal" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df8a158225e4a4d8505f071340bba9edd109b23f01b70540dccb7c799868f307" -dependencies = [ - "tree-sitter", -] - [[package]] name = "tree-sitter-wing" version = "0.0.0" dependencies = [ "cc", "tree-sitter", - "tree-sitter-cli", ] [[package]] @@ -1748,12 +1356,6 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "unicode-width" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" - [[package]] name = "unicode-xid" version = "0.2.4" @@ -1772,12 +1374,6 @@ dependencies = [ "serde", ] -[[package]] -name = "utf8-width" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5190c9442dcdaf0ddd50f37420417d219ae5261bbf5db120d0f9bab996c9cba1" - [[package]] name = "utf8parse" version = "0.2.1" @@ -1800,12 +1396,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - [[package]] name = "version_check" version = "0.9.4" @@ -1818,115 +1408,12 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65dd7eed29412da847b0f78bcec0ac98588165988a8cfe41d4ea1d429f8ccfff" -[[package]] -name = "walkdir" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" -dependencies = [ - "same-file", - "winapi-util", -] - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" -[[package]] -name = "wasm-bindgen" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn 2.0.51", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.51", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" - -[[package]] -name = "web-sys" -version = "0.3.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "webbrowser" -version = "0.8.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82b2391658b02c27719fc5a0a73d6e696285138e8b12fba9d4baa70451023c71" -dependencies = [ - "core-foundation", - "home", - "jni", - "log", - "ndk-context", - "objc", - "raw-window-handle", - "url", - "web-sys", -] - -[[package]] -name = "which" -version = "4.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" -dependencies = [ - "either", - "home", - "once_cell", - "rustix", -] - [[package]] name = "winapi" version = "0.3.9" @@ -2167,7 +1654,7 @@ dependencies = [ "derivative", "duplicate", "globset", - "indexmap 2.2.3", + "indexmap 2.2.6", "indoc", "insta", "itertools", @@ -2182,7 +1669,6 @@ dependencies = [ "strum", "tempfile", "tree-sitter", - "tree-sitter-traversal", "tree-sitter-wing", "uuid", "wingii", @@ -2195,7 +1681,7 @@ dependencies = [ "anstyle", "atty", "camino", - "clap 4.5.1", + "clap", "home", "lazy_static", "strum", diff --git a/apps/wing/src/commands/lsp.ts b/apps/wing/src/commands/lsp.ts index b3894b4711b..bf64d40c0fb 100644 --- a/apps/wing/src/commands/lsp.ts +++ b/apps/wing/src/commands/lsp.ts @@ -136,9 +136,14 @@ export async function lsp() { for (const rd of raw_diagnostics) { if (rd.span) { const diagnosticUri = "file://" + rd.span.file_id; + let message = rd.message; + if (rd.hints.length > 0) { + message += `\n${rd.hints.map((hint) => `hint: ${hint}`).join("\n")}`; + } + const diag = Diagnostic.create( Range.create(rd.span.start.line, rd.span.start.col, rd.span.end.line, rd.span.end.col), - `${rd.message}\n${rd.hints.map((hint) => `hint: ${hint}`).join("\n")}`, + message, undefined, undefined, undefined, diff --git a/libs/tree-sitter-wing/.editorconfig b/libs/tree-sitter-wing/.editorconfig new file mode 100644 index 00000000000..d3a8b5b697f --- /dev/null +++ b/libs/tree-sitter-wing/.editorconfig @@ -0,0 +1,39 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.{json,toml,yml,gyp}] +indent_style = space +indent_size = 2 + +[*.js] +indent_style = space +indent_size = 2 + +[*.rs] +indent_style = space +indent_size = 4 + +[*.{c,cc,h}] +indent_style = space +indent_size = 4 + +[*.{py,pyi}] +indent_style = space +indent_size = 4 + +[*.swift] +indent_style = space +indent_size = 4 + +[*.go] +indent_style = tab +indent_size = 8 + +[Makefile] +indent_style = tab +indent_size = 8 diff --git a/libs/tree-sitter-wing/Cargo.toml b/libs/tree-sitter-wing/Cargo.toml index 48d45c0adf4..dc898aa1e58 100644 --- a/libs/tree-sitter-wing/Cargo.toml +++ b/libs/tree-sitter-wing/Cargo.toml @@ -1,31 +1,24 @@ [package] name = "tree-sitter-wing" -description = "winglang grammar for the tree-sitter parsing library" +description = "Wing grammar for tree-sitter" version = "0.0.0" -keywords = ["incremental", "parsing", "wing"] +license = "MIT" +readme = "README.md" +keywords = ["incremental", "parsing", "tree-sitter", "wing"] categories = ["parsing", "text-editors"] -repository = "https://github.com/winglang/wing/tree/main/libs/tree-sitter-wing" +repository = "https://github.com/winglang/tree-sitter-wing" edition = "2021" -license = "MIT" +autoexamples = false build = "bindings/rust/build.rs" -include = [ - "bindings/rust/*", - "grammar.js", - "queries/*", - "src/*", -] +include = ["bindings/rust/*", "grammar.js", "queries/*", "src/*"] [lib] path = "bindings/rust/lib.rs" [dependencies] -tree-sitter = "0.20.10" - -[dev-dependencies] -tree-sitter-cli = "0.20.8" +# Waiting for https://github.com/tree-sitter/tree-sitter/pull/3293 to be released +tree-sitter = { git = "https://github.com/tree-sitter/tree-sitter.git", rev = "a7a47d561d4e64eaf226f93c4d68076afa67fdda" } [build-dependencies] -cc = "1.0" -tree-sitter-cli = "0.20.8" -tree-sitter = "0.20.10" +cc = "1.0.87" diff --git a/libs/tree-sitter-wing/Makefile b/libs/tree-sitter-wing/Makefile new file mode 100644 index 00000000000..34378005408 --- /dev/null +++ b/libs/tree-sitter-wing/Makefile @@ -0,0 +1,112 @@ +VERSION := 0.0.0 + +LANGUAGE_NAME := tree-sitter-wing + +# repository +SRC_DIR := src + +PARSER_REPO_URL := $(shell git -C $(SRC_DIR) remote get-url origin 2>/dev/null) + +ifeq ($(PARSER_URL),) + PARSER_URL := $(subst .git,,$(PARSER_REPO_URL)) +ifeq ($(shell echo $(PARSER_URL) | grep '^[a-z][-+.0-9a-z]*://'),) + PARSER_URL := $(subst :,/,$(PARSER_URL)) + PARSER_URL := $(subst git@,https://,$(PARSER_URL)) +endif +endif + +TS ?= tree-sitter + +# ABI versioning +SONAME_MAJOR := $(word 1,$(subst ., ,$(VERSION))) +SONAME_MINOR := $(word 2,$(subst ., ,$(VERSION))) + +# install directory layout +PREFIX ?= /usr/local +INCLUDEDIR ?= $(PREFIX)/include +LIBDIR ?= $(PREFIX)/lib +PCLIBDIR ?= $(LIBDIR)/pkgconfig + +# source/object files +PARSER := $(SRC_DIR)/parser.c +EXTRAS := $(filter-out $(PARSER),$(wildcard $(SRC_DIR)/*.c)) +OBJS := $(patsubst %.c,%.o,$(PARSER) $(EXTRAS)) + +# flags +ARFLAGS ?= rcs +override CFLAGS += -I$(SRC_DIR) -std=c11 -fPIC + +# OS-specific bits +ifeq ($(OS),Windows_NT) + $(error "Windows is not supported") +else ifeq ($(shell uname),Darwin) + SOEXT = dylib + SOEXTVER_MAJOR = $(SONAME_MAJOR).dylib + SOEXTVER = $(SONAME_MAJOR).$(SONAME_MINOR).dylib + LINKSHARED := $(LINKSHARED)-dynamiclib -Wl, + ifneq ($(ADDITIONAL_LIBS),) + LINKSHARED := $(LINKSHARED)$(ADDITIONAL_LIBS), + endif + LINKSHARED := $(LINKSHARED)-install_name,$(LIBDIR)/lib$(LANGUAGE_NAME).$(SONAME_MAJOR).dylib,-rpath,@executable_path/../Frameworks +else + SOEXT = so + SOEXTVER_MAJOR = so.$(SONAME_MAJOR) + SOEXTVER = so.$(SONAME_MAJOR).$(SONAME_MINOR) + LINKSHARED := $(LINKSHARED)-shared -Wl, + ifneq ($(ADDITIONAL_LIBS),) + LINKSHARED := $(LINKSHARED)$(ADDITIONAL_LIBS) + endif + LINKSHARED := $(LINKSHARED)-soname,lib$(LANGUAGE_NAME).so.$(SONAME_MAJOR) +endif +ifneq ($(filter $(shell uname),FreeBSD NetBSD DragonFly),) + PCLIBDIR := $(PREFIX)/libdata/pkgconfig +endif + +all: lib$(LANGUAGE_NAME).a lib$(LANGUAGE_NAME).$(SOEXT) $(LANGUAGE_NAME).pc + +lib$(LANGUAGE_NAME).a: $(OBJS) + $(AR) $(ARFLAGS) $@ $^ + +lib$(LANGUAGE_NAME).$(SOEXT): $(OBJS) + $(CC) $(LDFLAGS) $(LINKSHARED) $^ $(LDLIBS) -o $@ +ifneq ($(STRIP),) + $(STRIP) $@ +endif + +$(LANGUAGE_NAME).pc: bindings/c/$(LANGUAGE_NAME).pc.in + sed -e 's|@URL@|$(PARSER_URL)|' \ + -e 's|@VERSION@|$(VERSION)|' \ + -e 's|@LIBDIR@|$(LIBDIR)|' \ + -e 's|@INCLUDEDIR@|$(INCLUDEDIR)|' \ + -e 's|@REQUIRES@|$(REQUIRES)|' \ + -e 's|@ADDITIONAL_LIBS@|$(ADDITIONAL_LIBS)|' \ + -e 's|=$(PREFIX)|=$${prefix}|' \ + -e 's|@PREFIX@|$(PREFIX)|' $< > $@ + +$(PARSER): $(SRC_DIR)/grammar.json + $(TS) generate --no-bindings $^ + +install: all + install -d '$(DESTDIR)$(INCLUDEDIR)'/tree_sitter '$(DESTDIR)$(PCLIBDIR)' '$(DESTDIR)$(LIBDIR)' + install -m644 bindings/c/$(LANGUAGE_NAME).h '$(DESTDIR)$(INCLUDEDIR)'/tree_sitter/$(LANGUAGE_NAME).h + install -m644 $(LANGUAGE_NAME).pc '$(DESTDIR)$(PCLIBDIR)'/$(LANGUAGE_NAME).pc + install -m644 lib$(LANGUAGE_NAME).a '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).a + install -m755 lib$(LANGUAGE_NAME).$(SOEXT) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXTVER) + ln -sf lib$(LANGUAGE_NAME).$(SOEXTVER) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXTVER_MAJOR) + ln -sf lib$(LANGUAGE_NAME).$(SOEXTVER_MAJOR) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXT) + +uninstall: + $(RM) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).a \ + '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXTVER) \ + '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXTVER_MAJOR) \ + '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXT) \ + '$(DESTDIR)$(INCLUDEDIR)'/tree_sitter/$(LANGUAGE_NAME).h \ + '$(DESTDIR)$(PCLIBDIR)'/$(LANGUAGE_NAME).pc + +clean: + $(RM) $(OBJS) $(LANGUAGE_NAME).pc lib$(LANGUAGE_NAME).a lib$(LANGUAGE_NAME).$(SOEXT) + +test: + $(TS) test + +.PHONY: all install uninstall clean test diff --git a/libs/tree-sitter-wing/Package.swift b/libs/tree-sitter-wing/Package.swift new file mode 100644 index 00000000000..26b11f39028 --- /dev/null +++ b/libs/tree-sitter-wing/Package.swift @@ -0,0 +1,47 @@ +// swift-tools-version:5.3 +import PackageDescription + +let package = Package( + name: "TreeSitterWing", + products: [ + .library(name: "TreeSitterWing", targets: ["TreeSitterWing"]), + ], + dependencies: [], + targets: [ + .target(name: "TreeSitterWing", + path: ".", + exclude: [ + "Cargo.toml", + "Makefile", + "binding.gyp", + "bindings/c", + "bindings/go", + "bindings/node", + "bindings/python", + "bindings/rust", + "prebuilds", + "grammar.js", + "package.json", + "package-lock.json", + "pyproject.toml", + "setup.py", + "test", + "examples", + ".editorconfig", + ".github", + ".gitignore", + ".gitattributes", + ".gitmodules", + ], + sources: [ + "src/parser.c", + "src/scanner.c", + ], + resources: [ + .copy("queries") + ], + publicHeadersPath: "bindings/swift", + cSettings: [.headerSearchPath("src")]) + ], + cLanguageStandard: .c11 +) diff --git a/libs/tree-sitter-wing/README.md b/libs/tree-sitter-wing/README.md index 032334ea2ed..b263c5a704f 100644 --- a/libs/tree-sitter-wing/README.md +++ b/libs/tree-sitter-wing/README.md @@ -1,19 +1,9 @@ # tree-sitter-wing -TODO +A tree-sitter parser for the Wing language. -## Build +Wing is still heavily in development and this grammar/parser is experimental. It is used directly in the Wing compiler and is not considered a public API. It is available here for use but may have breaking changes at any time and no bindings are published or guaranteed to be work. -```sh -cargo build -``` +## Contributing -## Test - -```sh -cargo test -``` - -## License - -Licensed under the MIT license. +Issues are tracked as part of the [Wing](https://github.com/winglang/wing) repository. diff --git a/libs/tree-sitter-wing/binding.gyp b/libs/tree-sitter-wing/binding.gyp index d60fd6cc2c6..fad37c76a4a 100644 --- a/libs/tree-sitter-wing/binding.gyp +++ b/libs/tree-sitter-wing/binding.gyp @@ -2,18 +2,29 @@ "targets": [ { "target_name": "tree_sitter_wing_binding", + "dependencies": [ + " -#include "nan.h" +#include -using namespace v8; +typedef struct TSLanguage TSLanguage; -extern "C" TSLanguage * tree_sitter_wing(); +extern "C" TSLanguage *tree_sitter_wing(); -namespace { +// "tree-sitter", "language" hashed with BLAKE2 +const napi_type_tag LANGUAGE_TYPE_TAG = { + 0x8AF2E5212AD58ABF, 0xD5006CAD83ABBA16 +}; -NAN_METHOD(New) {} - -void Init(Local exports, Local module) { - Local tpl = Nan::New(New); - tpl->SetClassName(Nan::New("Language").ToLocalChecked()); - tpl->InstanceTemplate()->SetInternalFieldCount(1); - - Local constructor = Nan::GetFunction(tpl).ToLocalChecked(); - Local instance = constructor->NewInstance(Nan::GetCurrentContext()).ToLocalChecked(); - Nan::SetInternalFieldPointer(instance, 0, tree_sitter_wing()); - - Nan::Set(instance, Nan::New("name").ToLocalChecked(), Nan::New("wing").ToLocalChecked()); - Nan::Set(module, Nan::New("exports").ToLocalChecked(), instance); +Napi::Object Init(Napi::Env env, Napi::Object exports) { + exports["name"] = Napi::String::New(env, "wing"); + auto language = Napi::External::New(env, tree_sitter_wing()); + language.TypeTag(&LANGUAGE_TYPE_TAG); + exports["language"] = language; + return exports; } -NODE_MODULE(tree_sitter_wing_binding, Init) - -} // namespace +NODE_API_MODULE(tree_sitter_wing_binding, Init) diff --git a/libs/tree-sitter-wing/bindings/node/index.d.ts b/libs/tree-sitter-wing/bindings/node/index.d.ts new file mode 100644 index 00000000000..efe259eed03 --- /dev/null +++ b/libs/tree-sitter-wing/bindings/node/index.d.ts @@ -0,0 +1,28 @@ +type BaseNode = { + type: string; + named: boolean; +}; + +type ChildNode = { + multiple: boolean; + required: boolean; + types: BaseNode[]; +}; + +type NodeInfo = + | (BaseNode & { + subtypes: BaseNode[]; + }) + | (BaseNode & { + fields: { [name: string]: ChildNode }; + children: ChildNode[]; + }); + +type Language = { + name: string; + language: unknown; + nodeTypeInfo: NodeInfo[]; +}; + +declare const language: Language; +export = language; diff --git a/libs/tree-sitter-wing/bindings/node/index.js b/libs/tree-sitter-wing/bindings/node/index.js index e61b689515a..6657bcf42de 100644 --- a/libs/tree-sitter-wing/bindings/node/index.js +++ b/libs/tree-sitter-wing/bindings/node/index.js @@ -1,18 +1,6 @@ -try { - module.exports = require("../../build/Release/tree_sitter_wing_binding"); -} catch (error1) { - if (error1.code !== 'MODULE_NOT_FOUND') { - throw error1; - } - try { - module.exports = require("../../build/Debug/tree_sitter_wing_binding"); - } catch (error2) { - if (error2.code !== 'MODULE_NOT_FOUND') { - throw error2; - } - throw error1 - } -} +const root = require("path").join(__dirname, "..", ".."); + +module.exports = require("node-gyp-build")(root); try { module.exports.nodeTypeInfo = require("../../src/node-types.json"); diff --git a/libs/tree-sitter-wing/bindings/python/tree_sitter_wing/__init__.py b/libs/tree-sitter-wing/bindings/python/tree_sitter_wing/__init__.py new file mode 100644 index 00000000000..d1756f267c9 --- /dev/null +++ b/libs/tree-sitter-wing/bindings/python/tree_sitter_wing/__init__.py @@ -0,0 +1,5 @@ +"Wing grammar for tree-sitter" + +from ._binding import language + +__all__ = ["language"] diff --git a/libs/tree-sitter-wing/bindings/python/tree_sitter_wing/__init__.pyi b/libs/tree-sitter-wing/bindings/python/tree_sitter_wing/__init__.pyi new file mode 100644 index 00000000000..5416666fc30 --- /dev/null +++ b/libs/tree-sitter-wing/bindings/python/tree_sitter_wing/__init__.pyi @@ -0,0 +1 @@ +def language() -> int: ... diff --git a/libs/tree-sitter-wing/bindings/python/tree_sitter_wing/binding.c b/libs/tree-sitter-wing/bindings/python/tree_sitter_wing/binding.c new file mode 100644 index 00000000000..edc7a07bbc8 --- /dev/null +++ b/libs/tree-sitter-wing/bindings/python/tree_sitter_wing/binding.c @@ -0,0 +1,27 @@ +#include + +typedef struct TSLanguage TSLanguage; + +TSLanguage *tree_sitter_wing(void); + +static PyObject* _binding_language(PyObject *self, PyObject *args) { + return PyLong_FromVoidPtr(tree_sitter_wing()); +} + +static PyMethodDef methods[] = { + {"language", _binding_language, METH_NOARGS, + "Get the tree-sitter language for this grammar."}, + {NULL, NULL, 0, NULL} +}; + +static struct PyModuleDef module = { + .m_base = PyModuleDef_HEAD_INIT, + .m_name = "_binding", + .m_doc = NULL, + .m_size = -1, + .m_methods = methods +}; + +PyMODINIT_FUNC PyInit__binding(void) { + return PyModule_Create(&module); +} diff --git a/libs/tree-sitter-wing/bindings/python/tree_sitter_wing/py.typed b/libs/tree-sitter-wing/bindings/python/tree_sitter_wing/py.typed new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libs/tree-sitter-wing/bindings/rust/build.rs b/libs/tree-sitter-wing/bindings/rust/build.rs index ed5313fc8a1..3884b3f9d73 100644 --- a/libs/tree-sitter-wing/bindings/rust/build.rs +++ b/libs/tree-sitter-wing/bindings/rust/build.rs @@ -1,20 +1,20 @@ -use std::path::PathBuf; -use tree_sitter_cli::generate::generate_parser_in_directory; - fn main() { let src_dir = std::path::Path::new("src"); - generate_parser_in_directory(&PathBuf::from("."), None, tree_sitter::LANGUAGE_VERSION, false, None) - .expect("Generating parser"); - let mut c_config = cc::Build::new(); - c_config - .include(src_dir) - .flag("-Wno-unused-parameter") - .flag("-Wno-unused-but-set-variable") - .flag("-Wno-trigraphs") - .file(&src_dir.join("parser.c")) - .file(&src_dir.join("scanner.c")); + c_config.std("c11").include(src_dir).flag("-Wno-unused-parameter"); + + #[cfg(target_env = "msvc")] + c_config.flag("-utf-8"); + + let parser_path = src_dir.join("parser.c"); + c_config.file(&parser_path); + println!("cargo:rerun-if-changed={}", parser_path.to_str().unwrap()); + + // External scanner + let scanner_path = src_dir.join("scanner.c"); + c_config.file(&scanner_path); + println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap()); if cfg!(target_arch = "wasm32") { // This parser is used in a WASI context, so it needs to be compiled with @@ -28,8 +28,5 @@ fn main() { ); } - c_config.compile("parser"); - - println!("cargo:rerun-if-changed=grammar.js"); - println!("cargo:rerun-if-changed=src/scanner.c"); + c_config.compile("tree-sitter-wing"); } diff --git a/libs/tree-sitter-wing/bindings/rust/lib.rs b/libs/tree-sitter-wing/bindings/rust/lib.rs index f82ee198f44..1e1fa5a6fb2 100644 --- a/libs/tree-sitter-wing/bindings/rust/lib.rs +++ b/libs/tree-sitter-wing/bindings/rust/lib.rs @@ -1,13 +1,15 @@ -//! This crate provides wing language support for the [tree-sitter][] parsing library. +//! This crate provides Wing language support for the [tree-sitter][] parsing library. //! //! Typically, you will use the [language][language func] function to add this language to a //! tree-sitter [Parser][], and then use the parser to parse some code: //! //! ``` -//! let code = ""; +//! let code = r#" +//! "#; //! let mut parser = tree_sitter::Parser::new(); -//! parser.set_language(tree_sitter_wing::language()).expect("Error loading wing grammar"); +//! parser.set_language(&tree_sitter_wing::language()).expect("Error loading Wing grammar"); //! let tree = parser.parse(code, None).unwrap(); +//! assert!(!tree.root_node().has_error()); //! ``` //! //! [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html @@ -18,14 +20,14 @@ use tree_sitter::Language; extern "C" { - fn tree_sitter_wing() -> Language; + fn tree_sitter_wing() -> Language; } /// Get the tree-sitter [Language][] for this grammar. /// /// [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html pub fn language() -> Language { - unsafe { tree_sitter_wing() } + unsafe { tree_sitter_wing() } } /// The content of the [`node-types.json`][] file for this grammar. @@ -35,7 +37,18 @@ pub const NODE_TYPES: &str = include_str!("../../src/node-types.json"); // Uncomment these to include any queries that this grammar contains -pub const HIGHLIGHTS_QUERY: &str = include_str!("../../queries/highlights.scm"); -// pub const INJECTIONS_QUERY: &'static str = include_str!("../../queries/injections.scm"); -pub const LOCALS_QUERY: &str = include_str!("../../queries/locals.scm"); -// pub const TAGS_QUERY: &'static str = include_str!("../../queries/tags.scm"); +// pub const HIGHLIGHTS_QUERY: &str = include_str!("../../queries/highlights.scm"); +// pub const INJECTIONS_QUERY: &str = include_str!("../../queries/injections.scm"); +// pub const LOCALS_QUERY: &str = include_str!("../../queries/locals.scm"); +// pub const TAGS_QUERY: &str = include_str!("../../queries/tags.scm"); + +#[cfg(test)] +mod tests { + #[test] + fn test_can_load_grammar() { + let mut parser = tree_sitter::Parser::new(); + parser + .set_language(&super::language()) + .expect("Error loading Wing grammar"); + } +} diff --git a/libs/tree-sitter-wing/bindings/swift/TreeSitterWing/wing.h b/libs/tree-sitter-wing/bindings/swift/TreeSitterWing/wing.h new file mode 100644 index 00000000000..643f4db955c --- /dev/null +++ b/libs/tree-sitter-wing/bindings/swift/TreeSitterWing/wing.h @@ -0,0 +1,16 @@ +#ifndef TREE_SITTER_WING_H_ +#define TREE_SITTER_WING_H_ + +typedef struct TSLanguage TSLanguage; + +#ifdef __cplusplus +extern "C" { +#endif + +const TSLanguage *tree_sitter_wing(void); + +#ifdef __cplusplus +} +#endif + +#endif // TREE_SITTER_WING_H_ diff --git a/libs/tree-sitter-wing/grammar.js b/libs/tree-sitter-wing/grammar.js index 3e5bd088cb8..fbadd02cd80 100644 --- a/libs/tree-sitter-wing/grammar.js +++ b/libs/tree-sitter-wing/grammar.js @@ -428,15 +428,7 @@ module.exports = grammar({ argument_list: ($) => seq( "(", - choice( - commaSep($.positional_argument), - commaSep($.keyword_argument), - seq( - commaSep($.positional_argument), - ",", - commaSep($.keyword_argument) - ) - ), + commaSep(choice($.positional_argument, $.keyword_argument)), ")" ), @@ -575,13 +567,15 @@ module.exports = grammar({ _container_value_type: ($) => seq("<", field("type_parameter", $._type), ">"), - unwrap_or: ($) => prec.right(PREC.UNWRAP_OR, - seq( - field("left", $.expression), - field("op", "??"), - field("right", $.expression) - ) - ), + unwrap_or: ($) => + prec.right( + PREC.UNWRAP_OR, + seq( + field("left", $.expression), + field("op", "??"), + field("right", $.expression) + ) + ), optional_unwrap: ($) => prec.right(PREC.OPTIONAL_UNWRAP, seq($.expression, "!")), diff --git a/libs/tree-sitter-wing/package.json b/libs/tree-sitter-wing/package.json index 1f490e41e01..1ba95143f83 100644 --- a/libs/tree-sitter-wing/package.json +++ b/libs/tree-sitter-wing/package.json @@ -3,27 +3,44 @@ "version": "0.0.0", "description": "winglang grammar for tree-sitter", "main": "bindings/node", + "types": "bindings/node", "keywords": [ "parsing", "incremental" ], + "files": [ + "grammar.js", + "binding.gyp", + "prebuilds/**", + "bindings/node/*", + "queries/**", + "src/**" + ], "tree-sitter": [ { "scope": "source.wing", + "highlights": "queries/highlights.scm", "file-types": [ "w" ] } ], "dependencies": { - "nan": "^2.17.0" + "node-addon-api": "^7.1.0" + }, + "peerDependencies": { + "tree-sitter": "^0.21.0" + }, + "peerDependenciesMeta": { + "tree_sitter": { + "optional": true + } }, "scripts": { - "test": "tree-sitter test", + "test": "tree-sitter test --update", "parse": "tree-sitter parse", - "test:update": "tree-sitter test --update", "test:watch": "nodemon --watch grammar.js --watch src/scanner.c --exec \"turbo test\"", - "build:generate": "tree-sitter generate", + "build:generate": "tree-sitter generate --no-bindings", "build:wasm": "tree-sitter build-wasm --docker", "build:watch": "nodemon --watch grammar.js --watch src/scanner.c --exec \"turbo compile\"", "playground": "tree-sitter playground", @@ -34,7 +51,7 @@ "extends": "../../package.json" }, "devDependencies": { - "nodemon": "^3.0.1", - "tree-sitter-cli": "0.20.6" + "nodemon": "^3.1.0", + "tree-sitter-cli": "0.22.4" } } diff --git a/libs/tree-sitter-wing/pyproject.toml b/libs/tree-sitter-wing/pyproject.toml new file mode 100644 index 00000000000..7f3a4722ec0 --- /dev/null +++ b/libs/tree-sitter-wing/pyproject.toml @@ -0,0 +1,29 @@ +[build-system] +requires = ["setuptools>=42", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "tree-sitter-wing" +description = "Wing grammar for tree-sitter" +version = "0.0.0" +keywords = ["incremental", "parsing", "tree-sitter", "wing"] +classifiers = [ + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Topic :: Software Development :: Compilers", + "Topic :: Text Processing :: Linguistic", + "Typing :: Typed" +] +requires-python = ">=3.8" +license.text = "MIT" +readme = "README.md" + +[project.urls] +Homepage = "https://github.com/winglang/tree-sitter-wing" + +[project.optional-dependencies] +core = ["tree-sitter~=0.21"] + +[tool.cibuildwheel] +build = "cp38-*" +build-frontend = "build" diff --git a/libs/tree-sitter-wing/queries/folds.scm b/libs/tree-sitter-wing/queries/folds.scm new file mode 100644 index 00000000000..60de6116dac --- /dev/null +++ b/libs/tree-sitter-wing/queries/folds.scm @@ -0,0 +1,15 @@ +[ + (class_definition) + (class_implementation) + (interface_definition) + (interface_implementation) + (for_in_loop) + (while_statement) + (if_statement) + (if_let_statement) + (elif_block) + (struct_definition) + (enum_definition) + (try_catch_statement) + (method_definition) +] @fold diff --git a/libs/tree-sitter-wing/queries/highlights.scm b/libs/tree-sitter-wing/queries/highlights.scm index 65f097d67e9..0171e09dec2 100644 --- a/libs/tree-sitter-wing/queries/highlights.scm +++ b/libs/tree-sitter-wing/queries/highlights.scm @@ -1,50 +1,55 @@ -; Classes +(identifier) @variable + +(reference_identifier) @variable + +(member_identifier) @variable.member +; Classes (custom_type) @type -(class_field - name: (identifier) @member -) -(class_definition - name: (identifier) @type -) + +(class_field + name: (identifier) @variable.member) + +(class_definition + name: (identifier) @type) + (method_definition - name: (identifier) @function -) + name: (identifier) @function.method) ; Functions - (keyword_argument_key) @variable.parameter -(call - caller: (reference - (nested_identifier - property: (member_identifier) @function.method)) -) -(call - caller: (reference - (reference_identifier) @function.method) -) + +(call + caller: (reference + (nested_identifier + property: (member_identifier) @function.method.call))) + +(call + caller: (reference + (reference_identifier) @function.method.call)) ; Primitives +(number) @number + +(duration) @constant -[ - (number) - (duration) -] @constant.builtin (string) @string -(bool) @constant.builtin + +(bool) @boolean + (builtin_type) @type.builtin + (json_container_type) @type.builtin ; Special - -(comment) @comment +(comment) @comment @spell [ "(" ")" "{" "}" -] @punctuation.bracket +] @punctuation.bracket [ "-" @@ -75,17 +80,25 @@ "as" "bring" "class" - "else" - "for" - "if" - "in" - "new" "let" "new" - "return" (inflight_specifier) ] @keyword -(identifier) @variable -(reference_identifier) @variable -(member_identifier) @property \ No newline at end of file +[ + "for" + "in" +] @keyword.repeat + +[ + "if" + "else" +] @keyword.conditional + +[ + "pub" + "protected" + "internal" +] @keyword.modifier + +"return" @keyword.return diff --git a/libs/tree-sitter-wing/queries/locals.scm b/libs/tree-sitter-wing/queries/locals.scm index b8350eeee76..9a860c5f2dc 100644 --- a/libs/tree-sitter-wing/queries/locals.scm +++ b/libs/tree-sitter-wing/queries/locals.scm @@ -1,6 +1,6 @@ (block) @local.scope + (variable_definition_statement - name: (identifier) @local.definition -) + name: (identifier) @local.definition) ; TODO: Missing "@local.reference" usage tuned for each relevant identifier location diff --git a/libs/tree-sitter-wing/setup.py b/libs/tree-sitter-wing/setup.py new file mode 100644 index 00000000000..0bbee214828 --- /dev/null +++ b/libs/tree-sitter-wing/setup.py @@ -0,0 +1,60 @@ +from os.path import isdir, join +from platform import system + +from setuptools import Extension, find_packages, setup +from setuptools.command.build import build +from wheel.bdist_wheel import bdist_wheel + + +class Build(build): + def run(self): + if isdir("queries"): + dest = join(self.build_lib, "tree_sitter_wing", "queries") + self.copy_tree("queries", dest) + super().run() + + +class BdistWheel(bdist_wheel): + def get_tag(self): + python, abi, platform = super().get_tag() + if python.startswith("cp"): + python, abi = "cp38", "abi3" + return python, abi, platform + + +setup( + packages=find_packages("bindings/python"), + package_dir={"": "bindings/python"}, + package_data={ + "tree_sitter_wing": ["*.pyi", "py.typed"], + "tree_sitter_wing.queries": ["*.scm"], + }, + ext_package="tree_sitter_wing", + ext_modules=[ + Extension( + name="_binding", + sources=[ + "bindings/python/tree_sitter_wing/binding.c", + "src/parser.c", + "src/scanner.c", + ], + extra_compile_args=[ + "-std=c11", + ] if system() != "Windows" else [ + "/std:c11", + "/utf-8", + ], + define_macros=[ + ("Py_LIMITED_API", "0x03080000"), + ("PY_SSIZE_T_CLEAN", None) + ], + include_dirs=["src"], + py_limited_api=True, + ) + ], + cmdclass={ + "build": Build, + "bdist_wheel": BdistWheel + }, + zip_safe=False +) diff --git a/libs/tree-sitter-wing/src/grammar.json b/libs/tree-sitter-wing/src/grammar.json index 238b1f6a0a8..18ac32e2e77 100644 --- a/libs/tree-sitter-wing/src/grammar.json +++ b/libs/tree-sitter-wing/src/grammar.json @@ -2270,68 +2270,36 @@ "type": "CHOICE", "members": [ { - "type": "CHOICE", + "type": "SEQ", "members": [ { - "type": "SEQ", + "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "positional_argument" }, { - "type": "REPEAT", - "content": { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "," - }, - { - "type": "SYMBOL", - "name": "positional_argument" - } - ] - } - }, - { - "type": "CHOICE", - "members": [ - { - "type": "STRING", - "value": "," - }, - { - "type": "BLANK" - } - ] + "type": "SYMBOL", + "name": "keyword_argument" } ] }, { - "type": "BLANK" - } - ] - }, - { - "type": "CHOICE", - "members": [ - { - "type": "SEQ", - "members": [ - { - "type": "SYMBOL", - "name": "keyword_argument" - }, - { - "type": "REPEAT", - "content": { - "type": "SEQ", + "type": "REPEAT", + "content": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "," + }, + { + "type": "CHOICE", "members": [ { - "type": "STRING", - "value": "," + "type": "SYMBOL", + "name": "positional_argument" }, { "type": "SYMBOL", @@ -2339,117 +2307,15 @@ } ] } - }, - { - "type": "CHOICE", - "members": [ - { - "type": "STRING", - "value": "," - }, - { - "type": "BLANK" - } - ] - } - ] - }, - { - "type": "BLANK" - } - ] - }, - { - "type": "SEQ", - "members": [ - { - "type": "CHOICE", - "members": [ - { - "type": "SEQ", - "members": [ - { - "type": "SYMBOL", - "name": "positional_argument" - }, - { - "type": "REPEAT", - "content": { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "," - }, - { - "type": "SYMBOL", - "name": "positional_argument" - } - ] - } - }, - { - "type": "CHOICE", - "members": [ - { - "type": "STRING", - "value": "," - }, - { - "type": "BLANK" - } - ] - } - ] - }, - { - "type": "BLANK" - } - ] - }, - { - "type": "STRING", - "value": "," + ] + } }, { "type": "CHOICE", "members": [ { - "type": "SEQ", - "members": [ - { - "type": "SYMBOL", - "name": "keyword_argument" - }, - { - "type": "REPEAT", - "content": { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "," - }, - { - "type": "SYMBOL", - "name": "keyword_argument" - } - ] - } - }, - { - "type": "CHOICE", - "members": [ - { - "type": "STRING", - "value": "," - }, - { - "type": "BLANK" - } - ] - } - ] + "type": "STRING", + "value": "," }, { "type": "BLANK" @@ -2457,6 +2323,9 @@ ] } ] + }, + { + "type": "BLANK" } ] }, @@ -4581,4 +4450,3 @@ "_literal" ] } - diff --git a/libs/tree-sitter-wing/src/scanner.c b/libs/tree-sitter-wing/src/scanner.c index c4446cd20d8..0ebcccc0337 100644 --- a/libs/tree-sitter-wing/src/scanner.c +++ b/libs/tree-sitter-wing/src/scanner.c @@ -105,8 +105,9 @@ static bool scan_automatic_semicolon(TSLexer * lexer) { skip(lexer); - if (!scan_whitespace_and_comments(lexer)) - return false; + while (iswspace(lexer -> lookahead)) { + skip(lexer); + } switch (lexer -> lookahead) { case ',': @@ -124,9 +125,13 @@ static bool scan_automatic_semicolon(TSLexer * lexer) { case '^': case '|': case '&': - case '/': return false; + // Insert a semicolon before `//` and `/*` + case '/': + skip(lexer); + return lexer -> lookahead == '/' || lexer -> lookahead == '*'; + // Insert a semicolon before `--` and `++`, but not before binary `+` or `-`. case '+': skip(lexer); @@ -212,4 +217,4 @@ bool tree_sitter_wing_external_scanner_scan(void * payload, TSLexer * lexer, } return false; -} \ No newline at end of file +} diff --git a/libs/tree-sitter-wing/test/highlight/class.w b/libs/tree-sitter-wing/test/highlight/class.w new file mode 100644 index 00000000000..602b2f749a2 --- /dev/null +++ b/libs/tree-sitter-wing/test/highlight/class.w @@ -0,0 +1,19 @@ +bring cloud; +// <- @keyword + +class Foo { +// <- @keyword +// ^ @type +// ^ @punctuation.bracket + name: str; +//^ @variable.member +// ^ @type.builtin +// ^ @punctuation.delimiter + new(name: str) { +//^ @keyword +// ^ @variable + this.name = name; +// ^ @punctuation.delimiter +// ^ @operator + } +} diff --git a/libs/tree-sitter-wing/test/highlight/nested_method.w b/libs/tree-sitter-wing/test/highlight/nested_method.w index 8cb5a4be2e1..cb46f7d7f9f 100644 --- a/libs/tree-sitter-wing/test/highlight/nested_method.w +++ b/libs/tree-sitter-wing/test/highlight/nested_method.w @@ -1,4 +1,4 @@ test1.test2.test3(); // <- variable -// ^ property -// ^ function.method +// ^ variable.member +// ^ function.method.call diff --git a/libs/tree-sitter-wing/tree-sitter-dsl.d.ts b/libs/tree-sitter-wing/tree-sitter-dsl.d.ts index 049a56ec927..63f9ed493d9 100644 --- a/libs/tree-sitter-wing/tree-sitter-dsl.d.ts +++ b/libs/tree-sitter-wing/tree-sitter-dsl.d.ts @@ -1,21 +1,19 @@ -// Taken from https://www.npmjs.com/package/tree-sitter-cli - -type AliasRule = {type: 'ALIAS'; named: boolean; content: Rule; value: string}; -type BlankRule = {type: 'BLANK'}; -type ChoiceRule = {type: 'CHOICE'; members: Rule[]}; -type FieldRule = {type: 'FIELD'; name: string; content: Rule}; -type ImmediateTokenRule = {type: 'IMMEDIATE_TOKEN'; content: Rule}; -type PatternRule = {type: 'PATTERN'; value: string}; -type PrecDynamicRule = {type: 'PREC_DYNAMIC'; content: Rule; value: number}; -type PrecLeftRule = {type: 'PREC_LEFT'; content: Rule; value: number}; -type PrecRightRule = {type: 'PREC_RIGHT'; content: Rule; value: number}; -type PrecRule = {type: 'PREC'; content: Rule; value: number}; -type Repeat1Rule = {type: 'REPEAT1'; content: Rule}; -type RepeatRule = {type: 'REPEAT'; content: Rule}; -type SeqRule = {type: 'SEQ'; members: Rule[]}; -type StringRule = {type: 'STRING'; value: string}; -type SymbolRule = {type: 'SYMBOL'; name: Name}; -type TokenRule = {type: 'TOKEN'; content: Rule}; +type AliasRule = { type: 'ALIAS'; named: boolean; content: Rule; value: string }; +type BlankRule = { type: 'BLANK' }; +type ChoiceRule = { type: 'CHOICE'; members: Rule[] }; +type FieldRule = { type: 'FIELD'; name: string; content: Rule }; +type ImmediateTokenRule = { type: 'IMMEDIATE_TOKEN'; content: Rule }; +type PatternRule = { type: 'PATTERN'; value: string }; +type PrecDynamicRule = { type: 'PREC_DYNAMIC'; content: Rule; value: number }; +type PrecLeftRule = { type: 'PREC_LEFT'; content: Rule; value: number }; +type PrecRightRule = { type: 'PREC_RIGHT'; content: Rule; value: number }; +type PrecRule = { type: 'PREC'; content: Rule; value: number }; +type Repeat1Rule = { type: 'REPEAT1'; content: Rule }; +type RepeatRule = { type: 'REPEAT'; content: Rule }; +type SeqRule = { type: 'SEQ'; members: Rule[] }; +type StringRule = { type: 'STRING'; value: string }; +type SymbolRule = { type: 'SYMBOL'; name: Name }; +type TokenRule = { type: 'TOKEN'; content: Rule }; type Rule = | AliasRule @@ -44,14 +42,15 @@ type GrammarSymbols = { type RuleBuilder = ( $: GrammarSymbols, + previous: Rule, ) => RuleOrLiteral; type RuleBuilders< RuleName extends string, BaseGrammarRuleName extends string > = { - [name in RuleName]: RuleBuilder; -}; + [name in RuleName]: RuleBuilder; + }; interface Grammar< RuleName extends string, @@ -70,11 +69,17 @@ interface Grammar< rules: Rules; /** - * An array of arrays of precedence names. Each inner array represents - * a *descending* ordering. Names listed earlier in one of these arrays - * have higher precedence than any names listed later in the same array. + * An array of arrays of precedence names or rules. Each inner array represents + * a *descending* ordering. Names/rules listed earlier in one of these arrays + * have higher precedence than any names/rules listed later in the same array. + * + * Using rules is just a shorthand way for using a name then calling prec() + * with that name. It is just a convenience. */ - precedences?: () => String[][], + precedences?: ( + $: GrammarSymbols, + previous: Rule[][], + ) => RuleOrLiteral[][], /** * An array of arrays of rule names. Each inner array represents a set of @@ -88,6 +93,7 @@ interface Grammar< */ conflicts?: ( $: GrammarSymbols, + previous: Rule[][], ) => RuleOrLiteral[][]; /** @@ -104,7 +110,7 @@ interface Grammar< externals?: ( $: Record>, previous: Rule[], - ) => SymbolRule[]; + ) => RuleOrLiteral[]; /** * An array of tokens that may appear anywhere in the language. This @@ -128,6 +134,7 @@ interface Grammar< */ inline?: ( $: GrammarSymbols, + previous: Rule[], ) => RuleOrLiteral[]; /** @@ -140,6 +147,7 @@ interface Grammar< */ supertypes?: ( $: GrammarSymbols, + previous: Rule[], ) => RuleOrLiteral[]; /** @@ -155,8 +163,8 @@ interface Grammar< type GrammarSchema = { [K in keyof Grammar]: K extends 'rules' - ? Record - : Grammar[K]; + ? Record + : Grammar[K]; }; /** @@ -368,4 +376,4 @@ declare function grammar< >( baseGrammar: GrammarSchema, options: Grammar, -): GrammarSchema; \ No newline at end of file +): GrammarSchema; diff --git a/libs/wingc/Cargo.toml b/libs/wingc/Cargo.toml index fbb69190ff5..792442005c0 100644 --- a/libs/wingc/Cargo.toml +++ b/libs/wingc/Cargo.toml @@ -4,8 +4,8 @@ version = "0.0.0" edition = "2021" [dependencies] -tree-sitter = "0.20.10" -tree-sitter-traversal = "0.1" +# Waiting for https://github.com/tree-sitter/tree-sitter/pull/3293 to be released +tree-sitter = { git = "https://github.com/tree-sitter/tree-sitter.git", rev = "a7a47d561d4e64eaf226f93c4d68076afa67fdda" } derivative = "2.2" tree-sitter-wing = { path = "../tree-sitter-wing" } wingii = { path = "../wingii" } diff --git a/libs/wingc/src/lib.rs b/libs/wingc/src/lib.rs index e072a231403..a78b37bca66 100644 --- a/libs/wingc/src/lib.rs +++ b/libs/wingc/src/lib.rs @@ -61,6 +61,7 @@ mod lifting; pub mod lsp; pub mod parser; pub mod struct_schema; +mod ts_traversal; pub mod type_check; mod type_check_assert; mod valid_json_visitor; diff --git a/libs/wingc/src/parser.rs b/libs/wingc/src/parser.rs index 1f74a88453b..7e8a6f88771 100644 --- a/libs/wingc/src/parser.rs +++ b/libs/wingc/src/parser.rs @@ -7,7 +7,6 @@ use std::cell::RefCell; use std::collections::HashSet; use std::{fs, str, vec}; use tree_sitter::Node; -use tree_sitter_traversal::{traverse, Order}; use crate::ast::{ AccessModifier, ArgList, AssignmentKind, BinaryOperator, BringSource, CalleeKind, CatchBlock, Class, ClassField, @@ -17,7 +16,9 @@ use crate::ast::{ UserDefinedType, }; use crate::comp_ctx::{CompilationContext, CompilationPhase}; -use crate::diagnostic::{report_diagnostic, Diagnostic, DiagnosticResult, WingSpan, ERR_EXPECTED_SEMICOLON}; +use crate::diagnostic::{ + report_diagnostic, Diagnostic, DiagnosticResult, WingLocation, WingSpan, ERR_EXPECTED_SEMICOLON, +}; use crate::file_graph::FileGraph; use crate::files::Files; use crate::type_check::{CLASS_INFLIGHT_INIT_NAME, CLASS_INIT_NAME}; @@ -239,7 +240,7 @@ fn parse_wing_file( let language = tree_sitter_wing::language(); let mut tree_sitter_parser = tree_sitter::Parser::new(); - tree_sitter_parser.set_language(language).unwrap(); + tree_sitter_parser.set_language(&language).unwrap(); let tree_sitter_tree = match tree_sitter_parser.parse(&source_text.as_bytes(), None) { Some(tree) => tree, @@ -346,7 +347,7 @@ fn parse_wing_directory( // Create a fake AST (since the directory doesn't have any source code to parse) let mut tree_sitter_parser = tree_sitter::Parser::new(); - tree_sitter_parser.set_language(tree_sitter_wing::language()).unwrap(); + tree_sitter_parser.set_language(&tree_sitter_wing::language()).unwrap(); let tree_sitter_tree = tree_sitter_parser.parse("", None).unwrap(); let scope = Scope::empty(); let dependent_wing_paths = files_and_dirs; @@ -2418,41 +2419,56 @@ impl<'s> Parser<'s> { } /// Given a node, returns the last non-extra node before it. fn last_non_extra(node: Node) -> Node { - let parent = node.parent(); - if let Some(parent) = parent { - if parent.is_extra() { - return Self::last_non_extra(parent); + let mut sibling = node.prev_sibling(); + while let Some(s) = sibling { + if !s.is_extra() { + break; } + sibling = s.prev_sibling(); } - if node.is_extra() { - let mut sibling = node.prev_sibling(); - while let Some(s) = sibling { - if !s.is_extra() { - break; - } - sibling = s.prev_sibling(); - } - return sibling.unwrap_or(node); - } else { - return node; - } + return sibling.unwrap_or(node); } fn report_unhandled_errors(&self, root: &Node) { - let iter = traverse(root.walk(), Order::Pre); - for node in iter { + let iterator = crate::ts_traversal::PostOrderIter::new(root); + for node in iterator { if node.kind() == "AUTOMATIC_SEMICOLON" { - let target_node = Self::last_non_extra(node); + let target_node = Self::last_non_extra(node).range(); + let end_byte = target_node.end_byte; + let end_point: WingLocation = target_node.end_point.into(); + let diag = Diagnostic { message: ERR_EXPECTED_SEMICOLON.to_string(), - span: Some(self.node_span(&target_node)), + span: Some(WingSpan { + start: end_point, + end: end_point, + end_offset: end_byte, + start_offset: end_byte, + file_id: self.source_name.to_string(), + }), annotations: vec![], hints: vec![], }; report_diagnostic(diag); } else if node.kind() == "AUTOMATIC_BLOCK" { - self.add_error("Expected block".to_string(), &Self::last_non_extra(node)); + let target_node = Self::last_non_extra(node).range(); + let end_byte = target_node.end_byte; + let end_point: WingLocation = target_node.end_point.into(); + + let diag = Diagnostic { + message: "Expected block".to_string(), + span: Some(WingSpan { + start: end_point, + end: end_point, + end_offset: end_byte, + start_offset: end_byte, + file_id: self.source_name.to_string(), + }), + annotations: vec![], + hints: vec![], + }; + report_diagnostic(diag); } else if !self.error_nodes.borrow().contains(&node.id()) { if node.is_error() { if node.named_child_count() == 0 { @@ -2738,7 +2754,7 @@ mod tests { // Test get_actual_children_by_field_name let language = tree_sitter_wing::language(); let mut tree_sitter_parser = tree_sitter::Parser::new(); - tree_sitter_parser.set_language(language).unwrap(); + tree_sitter_parser.set_language(&language).unwrap(); let tree_sitter_tree = tree_sitter_parser .parse("let x: ((num)) = 1;".as_bytes(), None) diff --git a/libs/wingc/src/ts_traversal.rs b/libs/wingc/src/ts_traversal.rs new file mode 100644 index 00000000000..e12eefc6815 --- /dev/null +++ b/libs/wingc/src/ts_traversal.rs @@ -0,0 +1,59 @@ +use tree_sitter::Node; + +/// Create a post-order tree iterator for a tree-sitter node. +pub struct PostOrderIter<'a> { + stack: Vec>, +} + +impl<'a> PostOrderIter<'a> { + pub fn new(root: &'a Node) -> Self { + let mut stack = Vec::new(); + stack.push(*root); + PostOrderIter { stack } + } +} + +impl<'a> Iterator for PostOrderIter<'a> { + type Item = Node<'a>; + + fn next(&mut self) -> Option { + if let Some(node) = self.stack.pop() { + for i in (0..node.child_count()).rev() { + self.stack.push(node.child(i).unwrap()); + } + return Some(node); + } else { + None + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + use tree_sitter::Parser; + use tree_sitter_wing::language; + + #[test] + fn test_post_order_iter() { + let code = r#" + a; + if true { + b; + } + c; + "#; + let mut parser = Parser::new(); + parser.set_language(&language()).unwrap(); + let tree = parser.parse(code, None).unwrap(); + let root = tree.root_node(); + let nodes: Vec = PostOrderIter::new(&root).collect(); + let reference_nodes = nodes + .iter() + .filter(|n| n.kind() == "reference_identifier") + .map(|n| n.utf8_text(&code.as_bytes()).unwrap().to_string()) + .collect::>(); + + assert_eq!(reference_nodes, vec!["a", "b", "c"]); + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 03e3aa655bd..b761ae9d925 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -274,7 +274,7 @@ importers: version: 5.0.3 debug: specifier: ^4.3.4 - version: 4.3.4 + version: 4.3.4(supports-color@5.5.0) dotenv: specifier: ^16.3.1 version: 16.3.1 @@ -647,7 +647,7 @@ importers: version: 0.4.0 debug: specifier: ^4.3.4 - version: 4.3.4 + version: 4.3.4(supports-color@5.5.0) launch-editor: specifier: ^2.6.0 version: 2.6.1 @@ -1196,16 +1196,19 @@ importers: libs/tree-sitter-wing: dependencies: - nan: - specifier: ^2.17.0 - version: 2.18.0 + node-addon-api: + specifier: ^7.1.0 + version: 7.1.0 + tree-sitter: + specifier: ^0.21.0 + version: 0.21.1 devDependencies: nodemon: - specifier: ^3.0.1 - version: 3.0.1 + specifier: ^3.1.0 + version: 3.1.0 tree-sitter-cli: - specifier: 0.20.6 - version: 0.20.6 + specifier: 0.22.4 + version: 0.22.4 libs/wingc: devDependencies: @@ -1501,7 +1504,7 @@ importers: version: 8.5.10 debug: specifier: ^4.3.4 - version: 4.3.4 + version: 4.3.4(supports-color@5.5.0) ws: specifier: ^8.14.2 version: 8.14.2 @@ -3585,7 +3588,7 @@ packages: '@babel/traverse': 7.23.9 '@babel/types': 7.23.9 convert-source-map: 2.0.0 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) gensync: 1.0.0-beta.2 json5: 2.2.3 semver: 6.3.1 @@ -3676,7 +3679,7 @@ packages: '@babel/core': 7.23.9 '@babel/helper-compilation-targets': 7.23.6 '@babel/helper-plugin-utils': 7.22.5 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) lodash.debounce: 4.0.8 resolve: 1.22.6 transitivePeerDependencies: @@ -4910,7 +4913,7 @@ packages: '@babel/helper-split-export-declaration': 7.22.6 '@babel/parser': 7.23.9 '@babel/types': 7.23.9 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) globals: 11.12.0 transitivePeerDependencies: - supports-color @@ -5078,7 +5081,7 @@ packages: resolution: {integrity: sha512-qvga/nzEtdCJMu/6jJfDqpzbRejvXtNhWFnbubfuYyN5nMNORNXX+POT4j+mQSDQar5bIQ1a812szw/zr47cfw==} requiresBuild: true dependencies: - nan: 2.18.0 + nan: 2.19.0 prebuild-install: 7.1.1 dev: true @@ -5813,7 +5816,7 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: ajv: 6.12.6 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) espree: 9.6.1 globals: 13.23.0 ignore: 5.2.4 @@ -5829,7 +5832,7 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: ajv: 6.12.6 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) espree: 9.6.1 globals: 13.23.0 ignore: 5.2.4 @@ -6002,7 +6005,7 @@ packages: engines: {node: '>=10.10.0'} dependencies: '@humanwhocodes/object-schema': 1.2.1 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) minimatch: 3.1.2 transitivePeerDependencies: - supports-color @@ -6012,7 +6015,7 @@ packages: engines: {node: '>=10.10.0'} dependencies: '@humanwhocodes/object-schema': 2.0.2 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) minimatch: 3.1.2 transitivePeerDependencies: - supports-color @@ -10894,7 +10897,7 @@ packages: '@typescript-eslint/scope-manager': 5.62.0 '@typescript-eslint/type-utils': 5.62.0(eslint@8.51.0)(typescript@5.2.2) '@typescript-eslint/utils': 5.62.0(eslint@8.51.0)(typescript@5.2.2) - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) eslint: 8.51.0 graphemer: 1.4.0 ignore: 5.2.4 @@ -10922,7 +10925,7 @@ packages: '@typescript-eslint/scope-manager': 5.62.0 '@typescript-eslint/type-utils': 5.62.0(eslint@8.51.0)(typescript@5.3.3) '@typescript-eslint/utils': 5.62.0(eslint@8.51.0)(typescript@5.3.3) - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) eslint: 8.51.0 graphemer: 1.4.0 ignore: 5.2.4 @@ -10951,7 +10954,7 @@ packages: '@typescript-eslint/type-utils': 6.7.4(eslint@8.51.0)(typescript@5.3.3) '@typescript-eslint/utils': 6.7.4(eslint@8.51.0)(typescript@5.3.3) '@typescript-eslint/visitor-keys': 6.7.4 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) eslint: 8.51.0 graphemer: 1.4.0 ignore: 5.2.4 @@ -10980,7 +10983,7 @@ packages: '@typescript-eslint/type-utils': 7.0.2(eslint@8.56.0)(typescript@5.3.3) '@typescript-eslint/utils': 7.0.2(eslint@8.56.0)(typescript@5.3.3) '@typescript-eslint/visitor-keys': 7.0.2 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) eslint: 8.56.0 graphemer: 1.4.0 ignore: 5.2.4 @@ -11005,7 +11008,7 @@ packages: '@typescript-eslint/scope-manager': 5.62.0 '@typescript-eslint/types': 5.62.0 '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.2.2) - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) eslint: 8.51.0 typescript: 5.2.2 transitivePeerDependencies: @@ -11025,7 +11028,7 @@ packages: '@typescript-eslint/scope-manager': 5.62.0 '@typescript-eslint/types': 5.62.0 '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.3.3) - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) eslint: 8.51.0 typescript: 5.3.3 transitivePeerDependencies: @@ -11045,7 +11048,7 @@ packages: '@typescript-eslint/types': 6.7.4 '@typescript-eslint/typescript-estree': 6.7.4(typescript@5.3.3) '@typescript-eslint/visitor-keys': 6.7.4 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) eslint: 8.51.0 typescript: 5.3.3 transitivePeerDependencies: @@ -11066,7 +11069,7 @@ packages: '@typescript-eslint/types': 7.0.2 '@typescript-eslint/typescript-estree': 7.0.2(typescript@5.3.3) '@typescript-eslint/visitor-keys': 7.0.2 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) eslint: 8.56.0 typescript: 5.3.3 transitivePeerDependencies: @@ -11108,7 +11111,7 @@ packages: dependencies: '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.2.2) '@typescript-eslint/utils': 5.62.0(eslint@8.51.0)(typescript@5.2.2) - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) eslint: 8.51.0 tsutils: 3.21.0(typescript@5.2.2) typescript: 5.2.2 @@ -11128,7 +11131,7 @@ packages: dependencies: '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.3.3) '@typescript-eslint/utils': 5.62.0(eslint@8.51.0)(typescript@5.3.3) - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) eslint: 8.51.0 tsutils: 3.21.0(typescript@5.3.3) typescript: 5.3.3 @@ -11148,7 +11151,7 @@ packages: dependencies: '@typescript-eslint/typescript-estree': 6.7.4(typescript@5.3.3) '@typescript-eslint/utils': 6.7.4(eslint@8.51.0)(typescript@5.3.3) - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) eslint: 8.51.0 ts-api-utils: 1.0.3(typescript@5.3.3) typescript: 5.3.3 @@ -11168,7 +11171,7 @@ packages: dependencies: '@typescript-eslint/typescript-estree': 7.0.2(typescript@5.3.3) '@typescript-eslint/utils': 7.0.2(eslint@8.56.0)(typescript@5.3.3) - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) eslint: 8.56.0 ts-api-utils: 1.0.3(typescript@5.3.3) typescript: 5.3.3 @@ -11201,7 +11204,7 @@ packages: dependencies: '@typescript-eslint/types': 5.62.0 '@typescript-eslint/visitor-keys': 5.62.0 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) globby: 11.1.0 is-glob: 4.0.3 semver: 7.5.4 @@ -11222,7 +11225,7 @@ packages: dependencies: '@typescript-eslint/types': 5.62.0 '@typescript-eslint/visitor-keys': 5.62.0 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) globby: 11.1.0 is-glob: 4.0.3 semver: 7.5.4 @@ -11242,7 +11245,7 @@ packages: dependencies: '@typescript-eslint/types': 6.7.4 '@typescript-eslint/visitor-keys': 6.7.4 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) globby: 11.1.0 is-glob: 4.0.3 semver: 7.5.4 @@ -11263,7 +11266,7 @@ packages: dependencies: '@typescript-eslint/types': 7.0.2 '@typescript-eslint/visitor-keys': 7.0.2 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) globby: 11.1.0 is-glob: 4.0.3 minimatch: 9.0.3 @@ -11829,7 +11832,7 @@ packages: resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} engines: {node: '>= 6.0.0'} dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) transitivePeerDependencies: - supports-color @@ -11837,7 +11840,7 @@ packages: resolution: {integrity: sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==} engines: {node: '>= 14'} dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) transitivePeerDependencies: - supports-color @@ -13220,7 +13223,7 @@ packages: /codespan-wasm@0.4.0: resolution: {integrity: sha512-TVS9MyHIeTV1Zm/wBpgjY1Lyx49Ikj7mccrBrCwWc0/oM7MoeHtVPWwM+Q9CBKWJTZLwp7D1s8PT6NnCqvQrhA==} dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: false @@ -13812,7 +13815,7 @@ packages: dependencies: ms: 2.0.0 - /debug@3.2.7(supports-color@5.5.0): + /debug@3.2.7: resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==} peerDependencies: supports-color: '*' @@ -13821,9 +13824,8 @@ packages: optional: true dependencies: ms: 2.1.3 - supports-color: 5.5.0 - /debug@4.3.4: + /debug@4.3.4(supports-color@5.5.0): resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} engines: {node: '>=6.0'} peerDependencies: @@ -13833,6 +13835,7 @@ packages: optional: true dependencies: ms: 2.1.2 + supports-color: 5.5.0 /decamelize-keys@1.1.1: resolution: {integrity: sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg==} @@ -14083,7 +14086,7 @@ packages: hasBin: true dependencies: address: 1.2.2 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: true @@ -14200,7 +14203,7 @@ packages: dependencies: semver: 7.5.4 shelljs: 0.8.5 - typescript: 5.5.0-dev.20240412 + typescript: 5.5.0-dev.20240413 dev: true /dset@3.1.2: @@ -14620,7 +14623,7 @@ packages: peerDependencies: esbuild: '>=0.12 <1' dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) esbuild: 0.18.20 transitivePeerDependencies: - supports-color @@ -14834,7 +14837,7 @@ packages: /eslint-import-resolver-node@0.3.9: resolution: {integrity: sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==} dependencies: - debug: 3.2.7(supports-color@5.5.0) + debug: 3.2.7 is-core-module: 2.13.0 resolve: 1.22.6 transitivePeerDependencies: @@ -14847,7 +14850,7 @@ packages: eslint: '*' eslint-plugin-import: '*' dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) enhanced-resolve: 5.15.0 eslint: 8.51.0 eslint-module-utils: 2.8.0(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.51.0) @@ -14869,7 +14872,7 @@ packages: eslint: '*' eslint-plugin-import: '*' dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) enhanced-resolve: 5.15.0 eslint: 8.51.0 eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.7.4)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.51.0) @@ -14892,7 +14895,7 @@ packages: eslint: '*' eslint-plugin-import: '*' dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) enhanced-resolve: 5.15.0 eslint: 8.56.0 eslint-module-utils: 2.8.0(@typescript-eslint/parser@7.0.2)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.56.0) @@ -14930,7 +14933,7 @@ packages: optional: true dependencies: '@typescript-eslint/parser': 5.62.0(eslint@8.51.0)(typescript@5.3.3) - debug: 3.2.7(supports-color@5.5.0) + debug: 3.2.7 eslint: 8.51.0 eslint-import-resolver-node: 0.3.9 eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.28.1)(eslint@8.51.0) @@ -14959,7 +14962,7 @@ packages: optional: true dependencies: '@typescript-eslint/parser': 6.7.4(eslint@8.51.0)(typescript@5.3.3) - debug: 3.2.7(supports-color@5.5.0) + debug: 3.2.7 eslint: 8.51.0 eslint-import-resolver-node: 0.3.9 eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/parser@6.7.4)(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.28.1)(eslint@8.51.0) @@ -14989,7 +14992,7 @@ packages: optional: true dependencies: '@typescript-eslint/parser': 7.0.2(eslint@8.56.0)(typescript@5.3.3) - debug: 3.2.7(supports-color@5.5.0) + debug: 3.2.7 eslint: 8.56.0 eslint-import-resolver-node: 0.3.9 eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/parser@7.0.2)(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.28.1)(eslint@8.56.0) @@ -15012,7 +15015,7 @@ packages: array.prototype.findlastindex: 1.2.3 array.prototype.flat: 1.3.2 array.prototype.flatmap: 1.3.2 - debug: 3.2.7(supports-color@5.5.0) + debug: 3.2.7 doctrine: 2.1.0 eslint: 8.51.0 eslint-import-resolver-node: 0.3.9 @@ -15046,7 +15049,7 @@ packages: array.prototype.findlastindex: 1.2.3 array.prototype.flat: 1.3.2 array.prototype.flatmap: 1.3.2 - debug: 3.2.7(supports-color@5.5.0) + debug: 3.2.7 doctrine: 2.1.0 eslint: 8.51.0 eslint-import-resolver-node: 0.3.9 @@ -15081,7 +15084,7 @@ packages: array.prototype.findlastindex: 1.2.3 array.prototype.flat: 1.3.2 array.prototype.flatmap: 1.3.2 - debug: 3.2.7(supports-color@5.5.0) + debug: 3.2.7 doctrine: 2.1.0 eslint: 8.56.0 eslint-import-resolver-node: 0.3.9 @@ -15259,7 +15262,7 @@ packages: ajv: 6.12.6 chalk: 4.1.2 cross-spawn: 7.0.3 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) doctrine: 3.0.0 escape-string-regexp: 4.0.0 eslint-scope: 7.2.2 @@ -15305,7 +15308,7 @@ packages: ajv: 6.12.6 chalk: 4.1.2 cross-spawn: 7.0.3 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) doctrine: 3.0.0 escape-string-regexp: 4.0.0 eslint-scope: 7.2.2 @@ -15536,7 +15539,7 @@ packages: engines: {node: '>= 10.17.0'} hasBin: true dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) get-stream: 5.2.0 yauzl: 2.10.0 optionalDependencies: @@ -16619,7 +16622,7 @@ packages: dependencies: '@tootallnate/once': 2.0.0 agent-base: 6.0.2 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: false @@ -16629,7 +16632,7 @@ packages: engines: {node: '>= 14'} dependencies: agent-base: 7.1.0 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: false @@ -16639,7 +16642,7 @@ packages: engines: {node: '>= 6.0.0'} dependencies: agent-base: 5.1.1 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: true @@ -16649,7 +16652,7 @@ packages: engines: {node: '>= 6'} dependencies: agent-base: 6.0.2 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) transitivePeerDependencies: - supports-color @@ -16658,7 +16661,7 @@ packages: engines: {node: '>= 14'} dependencies: agent-base: 7.1.0 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) transitivePeerDependencies: - supports-color @@ -16930,7 +16933,7 @@ packages: dependencies: '@ioredis/commands': 1.2.0 cluster-key-slot: 1.1.2 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) denque: 2.1.0 lodash.defaults: 4.2.0 lodash.isarguments: 3.1.0 @@ -18231,7 +18234,7 @@ packages: engines: {node: '>=8.0'} dependencies: date-format: 4.0.14 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) flatted: 3.2.9 rfdc: 1.3.0 streamroller: 3.1.5 @@ -18700,7 +18703,7 @@ packages: resolution: {integrity: sha512-o/sd0nMof8kYff+TqcDx3VSrgBTcZpSvYcAHIfHhv5VAuNmisCxjhx6YmxS8PFEpb9z5WKWKPdzf0jM23ro3RQ==} dependencies: '@types/debug': 4.1.12 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) decode-named-character-reference: 1.0.2 devlop: 1.1.0 micromark-core-commonmark: 2.0.0 @@ -18948,8 +18951,9 @@ packages: object-assign: 4.1.1 thenify-all: 1.6.0 - /nan@2.18.0: - resolution: {integrity: sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w==} + /nan@2.19.0: + resolution: {integrity: sha512-nO1xXxfh/RWNxfd/XPfbIfFk5vgLsAxUR9y5O0cHMJu/AW9U95JLXqthYHjEp+8gQ5p96K9jUp8nbVOxCdRbtw==} + dev: true /nano-css@5.6.1(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-T2Mhc//CepkTa3X4pUhKgbEheJHYAxD0VptuqFhDbGMUWVV2m+lkNiW/Ieuj35wrfC8Zm0l7HvssQh7zcEttSw==} @@ -19045,6 +19049,16 @@ packages: dev: true optional: true + /node-addon-api@7.1.0: + resolution: {integrity: sha512-mNcltoe1R8o7STTegSOHdnJNN7s5EUvhoS7ShnTHDyOSd+8H+UdWODq6qSv67PjC8Zc5JRT8+oLAMCr0SIXw7g==} + engines: {node: ^16 || ^18 || >= 20} + dev: false + + /node-addon-api@8.0.0: + resolution: {integrity: sha512-ipO7rsHEBqa9STO5C5T10fj732ml+5kLN1cAG8/jdHd56ldQeGj3Q7+scUS+VHK/qy1zLEwC4wMK5+yM0btPvw==} + engines: {node: ^18 || ^20 || >= 21} + dev: false + /node-dir@0.1.17: resolution: {integrity: sha512-tmPX422rYgofd4epzrNoOXiE8XFZYOcCq1vD7MAXCDO+O+zndlA2ztdKKMa+EeuBG5tHETpr4ml4RGgpqDCCAg==} engines: {node: '>= 0.10.5'} @@ -19097,6 +19111,11 @@ packages: engines: {node: '>= 6.13.0'} dev: false + /node-gyp-build@4.8.0: + resolution: {integrity: sha512-u6fs2AEUljNho3EYTJNBfImO5QTo/J/1Etd+NVdCj7qWKUSN/bSLkZwhDv7I+w/MSC6qJ4cknepkAYykDdK8og==} + hasBin: true + dev: false + /node-gyp@9.4.0: resolution: {integrity: sha512-dMXsYP6gc9rRbejLXmTbVRYjAHw7ppswsKyMxuxJxxOHzluIO1rGp9TOQgjFJ+2MCqcOcQTOPB/8Xwhr+7s4Eg==} engines: {node: ^12.13 || ^14.13 || >=16} @@ -19129,13 +19148,13 @@ packages: resolution: {integrity: sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==} dev: true - /nodemon@3.0.1: - resolution: {integrity: sha512-g9AZ7HmkhQkqXkRc20w+ZfQ73cHLbE8hnPbtaFbFtCumZsjyMhKk9LajQ07U5Ux28lvFjZ5X7HvWR1xzU8jHVw==} + /nodemon@3.1.0: + resolution: {integrity: sha512-xqlktYlDMCepBJd43ZQhjWwMw2obW/JRvkrLxq5RCNcuDDX1DbcPT+qT1IlIIdf+DhnWs90JpTMe+Y5KxOchvA==} engines: {node: '>=10'} hasBin: true dependencies: chokidar: 3.5.3 - debug: 3.2.7(supports-color@5.5.0) + debug: 4.3.4(supports-color@5.5.0) ignore-by-default: 1.0.1 minimatch: 3.1.2 pstree.remy: 1.1.8 @@ -20380,7 +20399,7 @@ packages: engines: {node: '>=8.16.0'} dependencies: '@types/mime-types': 2.1.2 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) extract-zip: 1.7.0 https-proxy-agent: 4.0.0 mime: 3.0.0(patch_hash=2he2uszztbibyal6zfzmv2a2oa) @@ -21088,7 +21107,7 @@ packages: resolution: {integrity: sha512-wfI3pk7EE80lCIXprqh7ym48IHYdwmAAzESdbU8Q9l7pnRCk9LEhpbOTNKjz6FARLm/Bl5m+4F0ABxOkYUujSQ==} engines: {node: '>=12'} dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) extend: 3.0.2 transitivePeerDependencies: - supports-color @@ -21099,7 +21118,7 @@ packages: engines: {node: '>=14'} dependencies: '@types/request': 2.48.11 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) extend: 3.0.2 teeny-request: 9.0.0 transitivePeerDependencies: @@ -21527,7 +21546,7 @@ packages: engines: {node: '>= 10'} dependencies: agent-base: 6.0.2 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) socks: 2.7.1 transitivePeerDependencies: - supports-color @@ -21538,7 +21557,7 @@ packages: engines: {node: '>= 14'} dependencies: agent-base: 7.1.0 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) socks: 2.7.1 transitivePeerDependencies: - supports-color @@ -21800,7 +21819,7 @@ packages: engines: {node: '>=8.0'} dependencies: date-format: 4.0.14 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) fs-extra: 8.1.0 transitivePeerDependencies: - supports-color @@ -22359,12 +22378,20 @@ packages: hasBin: true dev: true - /tree-sitter-cli@0.20.6: - resolution: {integrity: sha512-tjbAeuGSMhco/EnsThjWkQbDIYMDmdkWsTPsa/NJAW7bjaki9P7oM9TkLxfdlnm4LXd1wR5wVSM2/RTLtZbm6A==} + /tree-sitter-cli@0.22.4: + resolution: {integrity: sha512-Zli7yeD+ocVWm+au5YLJKLyxzvUirenomOgwapNZU8bpYt/CZMpEeya9eK/tEQAd7NDOQSvAnvhJXbPbwUdgMQ==} hasBin: true requiresBuild: true dev: true + /tree-sitter@0.21.1: + resolution: {integrity: sha512-7dxoA6kYvtgWw80265MyqJlkRl4yawIjO7S5MigytjELkX43fV2WsAXzsNfO7sBpPPCF5Gp0+XzHk0DwLCq3xQ==} + requiresBuild: true + dependencies: + node-addon-api: 8.0.0 + node-gyp-build: 4.8.0 + dev: false + /treeverse@3.0.0: resolution: {integrity: sha512-gcANaAnd2QDZFmHFEOF4k7uc1J/6a6z3DJMd/QwEyxLoKGiptJRwid582r7QIsFlFMIZ3SnxfS52S4hm2DHkuQ==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} @@ -22444,7 +22471,7 @@ packages: bundle-require: 4.0.2(esbuild@0.17.19) cac: 6.7.14 chokidar: 3.5.3 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) esbuild: 0.17.19 execa: 5.1.1 globby: 11.1.0 @@ -22483,7 +22510,7 @@ packages: bundle-require: 4.0.2(esbuild@0.19.12) cac: 6.7.14 chokidar: 3.5.3 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) esbuild: 0.19.12 execa: 5.1.1 globby: 11.1.0 @@ -22523,7 +22550,7 @@ packages: bundle-require: 4.0.2(esbuild@0.19.12) cac: 6.7.14 chokidar: 3.5.3 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) esbuild: 0.19.12 execa: 5.1.1 globby: 11.1.0 @@ -22563,7 +22590,7 @@ packages: bundle-require: 4.0.2(esbuild@0.19.12) cac: 6.7.14 chokidar: 3.5.3 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) esbuild: 0.19.12 execa: 5.1.1 globby: 11.1.0 @@ -22614,7 +22641,7 @@ packages: engines: {node: ^16.14.0 || >=18.0.0} dependencies: '@tufjs/models': 2.0.0 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) make-fetch-happen: 13.0.0 transitivePeerDependencies: - supports-color @@ -22809,8 +22836,8 @@ packages: engines: {node: '>=14.17'} hasBin: true - /typescript@5.5.0-dev.20240412: - resolution: {integrity: sha512-DfE8jAzZf9/FHHo0CMnIL6uFZ6Q1bJ4PCtpBd9Ytbfi0pRREKVJofJEHFbRXADT6Kq1twB4iiqvdc/rGbiBq7g==} + /typescript@5.5.0-dev.20240413: + resolution: {integrity: sha512-9Xha/54eUa9rMSYHTmP37pxf7NoWEWR/URl9TjZy2Fd7931boHHrE7k0QrtXFs2uXaIyC9v7I/Se8pGsQ7V14A==} engines: {node: '>=14.17'} hasBin: true dev: true @@ -23171,7 +23198,7 @@ packages: hasBin: true dependencies: cac: 6.7.14 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) mlly: 1.4.2 pathe: 1.1.1 picocolors: 1.0.0 @@ -23193,7 +23220,7 @@ packages: hasBin: true dependencies: cac: 6.7.14 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) pathe: 1.1.1 picocolors: 1.0.0 vite: 5.1.4(@types/node@20.11.0) @@ -23323,7 +23350,7 @@ packages: acorn-walk: 8.2.0 cac: 6.7.14 chai: 4.3.10 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) happy-dom: 9.20.3 local-pkg: 0.4.3 magic-string: 0.30.4 @@ -23379,7 +23406,7 @@ packages: '@vitest/utils': 1.3.1 acorn-walk: 8.3.2 chai: 4.3.10 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) execa: 8.0.1 local-pkg: 0.5.0 magic-string: 0.30.7 @@ -23454,7 +23481,7 @@ packages: dependencies: '@cowasm/memfs': 3.5.1 '@wapython/unionfs': 4.5.7 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) fflate: 0.7.4 path-browserify: 1.0.1 randomfill: 1.0.4 diff --git a/tools/hangar/__snapshots__/invalid.ts.snap b/tools/hangar/__snapshots__/invalid.ts.snap index c6e91e56f28..8ca836460cf 100644 --- a/tools/hangar/__snapshots__/invalid.ts.snap +++ b/tools/hangar/__snapshots__/invalid.ts.snap @@ -1560,18 +1560,18 @@ Duration " `; exports[`function_call_arity.test.w 1`] = ` -"error: Unexpected 'identifier' - --> ../../../examples/tests/invalid/function_call_arity.test.w:31:62 +"error: Positional arguments must come before named arguments + --> ../../../examples/tests/invalid/function_call_arity.test.w:31:61 | 31 | invalidCombinationFunc2(1, 2, prefix: \\"debug\\", priority: 0, \\"hello\\", \\"world\\"); - | ^^^^^ Unexpected 'identifier' + | ^^^^^^^ Positional arguments must come before named arguments -error: Unexpected 'identifier' - --> ../../../examples/tests/invalid/function_call_arity.test.w:31:71 +error: Positional arguments must come before named arguments + --> ../../../examples/tests/invalid/function_call_arity.test.w:31:70 | 31 | invalidCombinationFunc2(1, 2, prefix: \\"debug\\", priority: 0, \\"hello\\", \\"world\\"); - | ^^^^^ Unexpected 'identifier' + | ^^^^^^^ Positional arguments must come before named arguments error: Expected 2 positional argument(s) but got 0 @@ -1644,6 +1644,13 @@ error: Expected type to be \\"bool\\", but got \\"num\\" instead | ^ Expected type to be \\"bool\\", but got \\"num\\" instead +error: Expected type to be \\"Options\\", but got \\"str\\" instead + --> ../../../examples/tests/invalid/function_call_arity.test.w:31:61 + | +31 | invalidCombinationFunc2(1, 2, prefix: \\"debug\\", priority: 0, \\"hello\\", \\"world\\"); + | ^^^^^^^ Expected type to be \\"Options\\", but got \\"str\\" instead + + Tests 1 failed (1) Snapshots 1 skipped @@ -1717,11 +1724,11 @@ Duration " `; exports[`function_variadic_definition.test.w 1`] = ` -"error: Unknown parser error +"error: Positional arguments must come before named arguments --> ../../../examples/tests/invalid/function_variadic_definition.test.w:15:13 | 15 | f5(args: 1, 2); - | ^ Unknown parser error + | ^ Positional arguments must come before named arguments error: Variadic parameters must always be the last parameter in a function. @@ -2818,10 +2825,10 @@ exports[`missing_semicolon.test.w 1`] = ` error: Expected ';' - --> ../../../examples/tests/invalid/missing_semicolon.test.w:16:9 + --> ../../../examples/tests/invalid/missing_semicolon.test.w:16:10 | 16 | let x = 5 // - | ^ Expected ';' + | ^ Expected ';' error: Expected '}' @@ -3821,11 +3828,11 @@ Duration " `; exports[`struct_expansion.test.w 1`] = ` -"error: Unexpected 'keyword_argument' - --> ../../../examples/tests/invalid/struct_expansion.test.w:11:15 +"error: Positional arguments must come before named arguments + --> ../../../examples/tests/invalid/struct_expansion.test.w:11:33 | 11 | bucket1.put(file: \\"file.txt\\", \\"data\\"); - | ^^^^^^^^^^^^^^^^ Unexpected 'keyword_argument' + | ^^^^^^ Positional arguments must come before named arguments error: \\"bublic\\" is not a field of \\"BucketProps\\" @@ -3868,11 +3875,18 @@ error: Expected type to be \\"inflight (event: str?): str?\\", but got \\"inflig | ^^^^^^^ Expected type to be \\"inflight (event: str?): str?\\", but got \\"inflight (event: str): unknown\\" instead -error: Expected between 2 and 3 positional arguments or named arguments for the last parameter but got 1 +error: \\"file\\" is not a field of \\"BucketPutOptions\\" + --> ../../../examples/tests/invalid/struct_expansion.test.w:11:3 + | +11 | bucket1.put(file: \\"file.txt\\", \\"data\\"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \\"file\\" is not a field of \\"BucketPutOptions\\" + + +error: Missing required field \\"contentType\\" from \\"BucketPutOptions\\" --> ../../../examples/tests/invalid/struct_expansion.test.w:11:3 | 11 | bucket1.put(file: \\"file.txt\\", \\"data\\"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Expected between 2 and 3 positional arguments or named arguments for the last parameter but got 1 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Missing required field \\"contentType\\" from \\"BucketPutOptions\\" From 952327caedb40c762a8bd2e881801f0b5e3f763d Mon Sep 17 00:00:00 2001 From: Hasan <45375125+hasanaburayyan@users.noreply.github.com> Date: Sun, 14 Apr 2024 11:13:23 -0400 Subject: [PATCH 12/15] rfc: wing secrets through cli (#6107) RFC for creating application secrets via the Wing CLI Demo of POC https://www.loom.com/share/967b0047ae834442a32226cc3794fb84 ## Checklist - [ ] Title matches [Winglang's style guide](https://www.winglang.io/contributing/start-here/pull_requests#how-are-pull-request-titles-formatted) - [ ] Description explains motivation and solution - [ ] Tests added (always) - [ ] Docs updated (only required for features) - [ ] Added `pr/e2e-full` label if this feature requires end-to-end testing *By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*. --- .../999-rfcs/2024-03-31-wing-secrets-cli.md | 116 ++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 docs/contributing/999-rfcs/2024-03-31-wing-secrets-cli.md diff --git a/docs/contributing/999-rfcs/2024-03-31-wing-secrets-cli.md b/docs/contributing/999-rfcs/2024-03-31-wing-secrets-cli.md new file mode 100644 index 00000000000..8f970cc7320 --- /dev/null +++ b/docs/contributing/999-rfcs/2024-03-31-wing-secrets-cli.md @@ -0,0 +1,116 @@ +--- +title: "#6105 Wing Secrets CLI" +description: Creating Wing secrets from the CLI +--- + +# Wing Secrets CLI +- **Author(s)**: @hasanaburayyan +- **Submission Date**: 2024-03-31 +- **Stage**: Draft + +Creating secrets through the Wing CLI. + +## Background + +Wing applications often require secrets to be retrieved during runtime. These secrets are stored in platform specific secret stores, such as AWS Secrets Manager for `tf-aws` or a local `.env` file for the `sim` platform. + +Secrets must be configured before the application is run, and now the Wing CLI along with Wing platforms make it easy to configure secrets. + +### Out of Scope + +In this RFC a few things are out of scope: +- Checking if the secrets exist in the platform's secret store when running `wing compile` +- Reading secret values, for now we will only focus on creating secrets + +## Platform Hook + +Since secrets creation is platform specific, platforms can now implement a new hook `configureSecrets(secrets: { [key: string]: string }): string` which will be called by the Wing CLI to configure the secrets. + +For example the `sim` platform implementation which needs to store secrets in a `.env` file, would look something like this: + +```js +public async configureSecrets(secrets: { [key: string]: string }): Promise { + let existingSecretsContent = ""; + try { + existingSecretsContent = fs.readFileSync('./.env', 'utf8'); + } catch (error) {} + + const existingSecrets = existingSecretsContent.split('\n') + .filter(line => line.trim() !== '') + .reduce((s, line) => { + const [key, value] = line.split('=', 2); + s[key] = value; + return s; + }, {} as { [key: string]: string }); + + for (const key in secrets) { + existingSecrets[key] = secrets[key]; + } + + const updatedContent = Object.entries(existingSecrets) + .map(([key, value]) => `${key}=${value}`) + .join('\n'); + + fs.writeFileSync('./.env', updatedContent); + + return "Secrets saved to .env file"; +} +``` + +## CLI Command + +Introducing a new Wing CLI command `secrets` which will be used for managing secrets in the Wing applications. + +Given the following Wing application: + +```js +bring cloud; + +let slackSigningSecret = new cloud.Secret(name: "SLACK_SIGNING_SECRET"); +let slackBotToken = new cloud.Secret(name: "SLACK_BOT_TOKEN"); +``` + +### Creating Secrets + +Running `wing secrets main.w` will result in an interactive experience where the user is prompted to enter the values for the secrets: + +```bash +wing secrets main.w + +2 secrets found in main.w + +Enter the value for SLACK_SIGNING_SECRET: ******** +Enter the value for SLACK_BOT_TOKEN: ******** + +Secrets saved to .env file +``` + +This results in a `.env` file being created with the secrets stored in it. + +### specifying the platform + +You can specify the platform using the `-t` flag, for example to configure the secrets for the `tf-aws` platform: + +```bash +wing secrets main.w -t tf-aws + +2 secrets found in main.w + +Enter the value for SLACK_SIGNING_SECRET: ******** +Enter the value for SLACK_BOT_TOKEN: ******** + +Secrets saved to AWS Secrets Manager +``` + +### Listing Secrets + +If the user prefers to ignore the interactive experience of creating secrets in favor of creating the secrets themselves, there is an option to list the secrets in the Wing application: + +```bash +wing secrets main.w --list + +2 secrets found in main.w + +- SLACK_SIGNING_SECRET +- SLACK_BOT_TOKEN +``` From c6fccec536c63fc0296a604c21bd5a40ab530be4 Mon Sep 17 00:00:00 2001 From: Mark McCulloh Date: Sun, 14 Apr 2024 16:21:19 -0400 Subject: [PATCH 13/15] chore: update tree-sitter to official version (#6237) Turns out tree-sitter is releasing stuff much faster nowadays! While doing this, I noticed we no longer need to hack the C build as much. Removed that the whole sysroot thing. I could remove the locked CC and AR but it has actually been pretty nice having that locked to not worry about what contributors have installed. I'd be nice to one day use zig instead. This new tree-sitter version also seems to compile a litter faster, so that's a nice bonus. *By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*. --- .cargo/config.toml | 1 - Cargo.lock | 5 +++-- libs/tree-sitter-wing/Cargo.toml | 3 +-- libs/tree-sitter-wing/bindings/rust/build.rs | 12 ------------ libs/tree-sitter-wing/package.json | 2 +- libs/tree-sitter-wing/turbo.json | 2 +- libs/wingc/Cargo.toml | 3 +-- pnpm-lock.yaml | 14 +++++++------- 8 files changed, 14 insertions(+), 28 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 11ecc1fe7d7..791fa36685c 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,5 +1,4 @@ [env] -WASI_SDK = { value = ".cargo/wasi-sdk-21.0", relative = true } # tree-sitter build fails with newer version of clang unless implicit-function-declaration is ignored CC_wasm32_wasi = { value = ".cargo/wasi-sdk-21.0/bin/clang -Wno-error=implicit-function-declaration", relative = true } AR_wasm32_wasi = { value = ".cargo/wasi-sdk-21.0/bin/ar", relative = true } diff --git a/Cargo.lock b/Cargo.lock index 19f5ad9e0b9..f6d5e63828b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1308,8 +1308,9 @@ dependencies = [ [[package]] name = "tree-sitter" -version = "0.22.4" -source = "git+https://github.com/tree-sitter/tree-sitter.git?rev=a7a47d561d4e64eaf226f93c4d68076afa67fdda#a7a47d561d4e64eaf226f93c4d68076afa67fdda" +version = "0.22.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "688200d842c76dd88f9a7719ecb0483f79f5a766fb1c100756d5d8a059abc71b" dependencies = [ "cc", "regex", diff --git a/libs/tree-sitter-wing/Cargo.toml b/libs/tree-sitter-wing/Cargo.toml index dc898aa1e58..a02a668dc0f 100644 --- a/libs/tree-sitter-wing/Cargo.toml +++ b/libs/tree-sitter-wing/Cargo.toml @@ -17,8 +17,7 @@ include = ["bindings/rust/*", "grammar.js", "queries/*", "src/*"] path = "bindings/rust/lib.rs" [dependencies] -# Waiting for https://github.com/tree-sitter/tree-sitter/pull/3293 to be released -tree-sitter = { git = "https://github.com/tree-sitter/tree-sitter.git", rev = "a7a47d561d4e64eaf226f93c4d68076afa67fdda" } +tree-sitter = "0.22.5" [build-dependencies] cc = "1.0.87" diff --git a/libs/tree-sitter-wing/bindings/rust/build.rs b/libs/tree-sitter-wing/bindings/rust/build.rs index 3884b3f9d73..4ee87687059 100644 --- a/libs/tree-sitter-wing/bindings/rust/build.rs +++ b/libs/tree-sitter-wing/bindings/rust/build.rs @@ -16,17 +16,5 @@ fn main() { c_config.file(&scanner_path); println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap()); - if cfg!(target_arch = "wasm32") { - // This parser is used in a WASI context, so it needs to be compiled with - // the sysroot and other tools needed for WASI-compatible C - c_config.flag( - format!( - "--sysroot={}/share/wasi-sysroot", - env!("WASI_SDK", "WASI_SDK env not set") - ) - .as_str(), - ); - } - c_config.compile("tree-sitter-wing"); } diff --git a/libs/tree-sitter-wing/package.json b/libs/tree-sitter-wing/package.json index 1ba95143f83..9ca9f834105 100644 --- a/libs/tree-sitter-wing/package.json +++ b/libs/tree-sitter-wing/package.json @@ -52,6 +52,6 @@ }, "devDependencies": { "nodemon": "^3.1.0", - "tree-sitter-cli": "0.22.4" + "tree-sitter-cli": "0.22.5" } } diff --git a/libs/tree-sitter-wing/turbo.json b/libs/tree-sitter-wing/turbo.json index a25f0ff3470..68d8b846c2c 100644 --- a/libs/tree-sitter-wing/turbo.json +++ b/libs/tree-sitter-wing/turbo.json @@ -4,7 +4,7 @@ "pipeline": { "build:generate": { "inputs": ["!*.wasm", "*", "grammar.js", "src/scanner.c"], - "outputs": ["src/**", "!src/scanner.c", "bindings/**", "binding.gyp"] + "outputs": ["src/**", "!src/scanner.c"] }, "build:wasm": { "dependsOn": ["build:generate"], diff --git a/libs/wingc/Cargo.toml b/libs/wingc/Cargo.toml index 792442005c0..2dd9045afeb 100644 --- a/libs/wingc/Cargo.toml +++ b/libs/wingc/Cargo.toml @@ -4,8 +4,7 @@ version = "0.0.0" edition = "2021" [dependencies] -# Waiting for https://github.com/tree-sitter/tree-sitter/pull/3293 to be released -tree-sitter = { git = "https://github.com/tree-sitter/tree-sitter.git", rev = "a7a47d561d4e64eaf226f93c4d68076afa67fdda" } +tree-sitter = "0.22.5" derivative = "2.2" tree-sitter-wing = { path = "../tree-sitter-wing" } wingii = { path = "../wingii" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b761ae9d925..c4f1c1bcc81 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1207,8 +1207,8 @@ importers: specifier: ^3.1.0 version: 3.1.0 tree-sitter-cli: - specifier: 0.22.4 - version: 0.22.4 + specifier: 0.22.5 + version: 0.22.5 libs/wingc: devDependencies: @@ -14203,7 +14203,7 @@ packages: dependencies: semver: 7.5.4 shelljs: 0.8.5 - typescript: 5.5.0-dev.20240413 + typescript: 5.5.0-dev.20240414 dev: true /dset@3.1.2: @@ -22378,8 +22378,8 @@ packages: hasBin: true dev: true - /tree-sitter-cli@0.22.4: - resolution: {integrity: sha512-Zli7yeD+ocVWm+au5YLJKLyxzvUirenomOgwapNZU8bpYt/CZMpEeya9eK/tEQAd7NDOQSvAnvhJXbPbwUdgMQ==} + /tree-sitter-cli@0.22.5: + resolution: {integrity: sha512-c3VT46Bc3a6pEd0JAwufbqEw9Q2FRLDp5E230hGvnr+Hivw+Y6jyeP+3T89KDptvn48MOPVmbgaLm69xYgLVTw==} hasBin: true requiresBuild: true dev: true @@ -22836,8 +22836,8 @@ packages: engines: {node: '>=14.17'} hasBin: true - /typescript@5.5.0-dev.20240413: - resolution: {integrity: sha512-9Xha/54eUa9rMSYHTmP37pxf7NoWEWR/URl9TjZy2Fd7931boHHrE7k0QrtXFs2uXaIyC9v7I/Se8pGsQ7V14A==} + /typescript@5.5.0-dev.20240414: + resolution: {integrity: sha512-VEXaVJweoalMohUIdPBNAI0OzBuzR6caL8w3XW+R8jewwxn6iD9t2zAO1DkqYmYDDYlu2kp8L61Vk9SDsvv4Hw==} engines: {node: '>=14.17'} hasBin: true dev: true From ba06ad3e2d4170516a01f304e200d35f184ab2d6 Mon Sep 17 00:00:00 2001 From: Mark McCulloh Date: Sun, 14 Apr 2024 17:46:39 -0400 Subject: [PATCH 14/15] fix: unable to hit most inflight breakpoints while debugging (#6217) Fixes #5988 Fixes #2546 Fixes #6036 Fixes #5986 #5988 was a symptom of a deeper issue. In `wing it` or any other command, breakpoints would only work sometimes and depended on the order of inflights in a file and how many there were. The underlying issue is that the sourcemaps are too slow and may not finish loading in time to help the debugger attach breakpoints. At first I made a change in this PR to fix a problem with how esbuild bundles our sourcemaps. On it's own this change made many scenarios work that previously didn't. That wasn't enough though, so I went through many other options. As part of this, I actually added debugger settings to vscode. In the end I needed to add a hack where we simply have a small sleep before running inflight code. TODO: - [x] Check Windows sourcemaps aren't borked - [x] Ensure minimal benchmark regression (might skip this process if debugger is not needed) - [x] A few tests for the remapping logic - [x] Test locally with a winglib - [ ] Try to figure out better options than a sleep *By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*. --- apps/vscode-wing/.projenrc.ts | 45 +++++++- apps/vscode-wing/package.json | 46 +++++++- apps/vscode-wing/src/extension.ts | 67 +++++++++++- apps/vscode-wing/src/project/vscode_types.ts | 6 ++ docs/docs/06-tools/03-debugging.md | 10 +- libs/wingsdk/.projen/deps.json | 4 + libs/wingsdk/.projenrc.ts | 1 + libs/wingsdk/package.json | 2 + libs/wingsdk/src/shared/bundling.ts | 108 +++++++++++++++++-- libs/wingsdk/src/shared/sandbox.ts | 14 ++- libs/wingsdk/test/shared/bundling.test.ts | 72 +++++++++++++ pnpm-lock.yaml | 7 ++ 12 files changed, 361 insertions(+), 21 deletions(-) create mode 100644 libs/wingsdk/test/shared/bundling.test.ts diff --git a/apps/vscode-wing/.projenrc.ts b/apps/vscode-wing/.projenrc.ts index bfa1bc0a95f..49cf8f0e4e7 100644 --- a/apps/vscode-wing/.projenrc.ts +++ b/apps/vscode-wing/.projenrc.ts @@ -108,6 +108,49 @@ const contributes: VSCodeExtensionContributions = { }, }, ], + debuggers: [ + { + type: "wing", + label: "Wing Debug", + program: "", + configurationAttributes: { + launch: { + entrypoint: { + type: "string", + description: "The entrypoint to run", + default: "${file}", + }, + arguments: { + type: "string", + description: "Wing CLI arguments", + default: "test", + }, + }, + }, + initialConfigurations: [ + { + label: "Wing Debug: Launch", + description: "Launch a Wing program", + body: { + type: "wing", + request: "launch", + name: "Launch", + }, + }, + ], + configurationSnippets: [ + { + label: "Wing Debug: Launch", + description: "Launch a Wing program", + body: { + type: "wing", + request: "launch", + name: "Launch", + }, + }, + ], + }, + ], grammars: [ { language: "wing", @@ -167,7 +210,7 @@ project.addFields({ vscode: `^${VSCODE_BASE_VERSION}`, }, categories: ["Programming Languages"], - activationEvents: ["onLanguage:wing"], + activationEvents: ["onLanguage:wing", "onDebug"], contributes, }); diff --git a/apps/vscode-wing/package.json b/apps/vscode-wing/package.json index 6b051d72b71..5dfb9ff9ca9 100644 --- a/apps/vscode-wing/package.json +++ b/apps/vscode-wing/package.json @@ -84,7 +84,8 @@ "Programming Languages" ], "activationEvents": [ - "onLanguage:wing" + "onLanguage:wing", + "onDebug" ], "contributes": { "breakpoints": [ @@ -110,6 +111,49 @@ } } ], + "debuggers": [ + { + "type": "wing", + "label": "Wing Debug", + "program": "", + "configurationAttributes": { + "launch": { + "entrypoint": { + "type": "string", + "description": "The entrypoint to run", + "default": "${file}" + }, + "arguments": { + "type": "string", + "description": "Wing CLI arguments", + "default": "test" + } + } + }, + "initialConfigurations": [ + { + "label": "Wing Debug: Launch", + "description": "Launch a Wing program", + "body": { + "type": "wing", + "request": "launch", + "name": "Launch" + } + } + ], + "configurationSnippets": [ + { + "label": "Wing Debug: Launch", + "description": "Launch a Wing program", + "body": { + "type": "wing", + "request": "launch", + "name": "Launch" + } + } + ] + } + ], "grammars": [ { "language": "wing", diff --git a/apps/vscode-wing/src/extension.ts b/apps/vscode-wing/src/extension.ts index aa5bb410eb1..3a4e002bd07 100644 --- a/apps/vscode-wing/src/extension.ts +++ b/apps/vscode-wing/src/extension.ts @@ -5,6 +5,8 @@ import { languages, workspace, window, + debug, + DebugConfiguration, } from "vscode"; import { getWingBin, updateStatusBar } from "./bin-helper"; import { CFG_WING, CFG_WING_BIN, COMMAND_OPEN_CONSOLE } from "./constants"; @@ -17,7 +19,6 @@ let languageServerManager: LanguageServerManager | undefined; export async function deactivate() { wingBinWatcher?.close(); await languageServerManager?.stop(); - await wingConsoleContext?.stop(); } export async function activate(context: ExtensionContext) { @@ -29,6 +30,70 @@ export async function activate(context: ExtensionContext) { languageServerManager = new LanguageServerManager(); + debug.registerDebugConfigurationProvider("wing", { + async resolveDebugConfiguration(_, _config: DebugConfiguration) { + Loggers.default.appendLine( + `Resolving debug configuration... ${JSON.stringify(_config)}` + ); + const editor = window.activeTextEditor; + + const currentFilename = editor?.document.fileName; + let chosenFile; + if ( + currentFilename?.endsWith("main.w") || + currentFilename?.endsWith(".test.w") + ) { + chosenFile = currentFilename; + } else { + let uriOptions = await workspace.findFiles( + `**/*.{main,test}.w`, + "**/{node_modules,target}/**" + ); + uriOptions.concat( + await workspace.findFiles(`**/main.w`, "**/{node_modules,target}/**") + ); + + const entrypoint = await window.showQuickPick( + uriOptions.map((f) => f.fsPath), + { + placeHolder: "Choose entrypoint to debug", + } + ); + + if (!entrypoint) { + return; + } + + chosenFile = entrypoint; + } + + const command = await window.showInputBox({ + title: `Debugging ${chosenFile}`, + prompt: "Wing CLI arguments", + value: "test", + }); + + if (!command) { + return; + } + + const currentWingBin = await getWingBin(); + + // Use builtin node debugger + return { + name: `Debug ${chosenFile}`, + request: "launch", + type: "node", + args: [currentWingBin, command, chosenFile], + runtimeSourcemapPausePatterns: [ + "${workspaceFolder}/**/target/**/*.cjs", + ], + autoAttachChildProcesses: true, + pauseForSourceMap: true, + }; + }, + }); + const wingBinChanged = async () => { Loggers.default.appendLine(`Setting up wing bin...`); const currentWingBin = await getWingBin(); diff --git a/apps/vscode-wing/src/project/vscode_types.ts b/apps/vscode-wing/src/project/vscode_types.ts index e62ee2b0e27..d85f170dad4 100644 --- a/apps/vscode-wing/src/project/vscode_types.ts +++ b/apps/vscode-wing/src/project/vscode_types.ts @@ -52,6 +52,12 @@ export interface VSCodeDebugger { readonly label?: string; readonly type: string; readonly runtime?: string; + readonly program?: string; + readonly request?: string; + readonly variables?: string; + readonly configurationAttributes?: any; + readonly initialConfigurations?: any[]; + readonly configurationSnippets?: any[]; } export interface VSCodeGrammar { diff --git a/docs/docs/06-tools/03-debugging.md b/docs/docs/06-tools/03-debugging.md index 631aa9f2133..5e7d9714601 100644 --- a/docs/docs/06-tools/03-debugging.md +++ b/docs/docs/06-tools/03-debugging.md @@ -11,13 +11,9 @@ Internally Wing uses JavaScript to execute preflight and inflight code, so stand ### Local/Simulator Debugging -To start, open your .w file in VS Code and set a breakpoint by clicking in the gutter to the left of the line number. Breakpoints can also be set in extern files. There are several ways to start the debugger, but let's use the "JavaScript Debug Terminal". -Open the command palette and type "Debug: Open JavaScript Debug Terminal". This works for any wing commands like `wing test` and `wing it`, although keep in mind that `wing compile` will only debug preflight code. - -### Limitations - -- ([Issue](https://github.com/winglang/wing/issues/5988)) When using the Wing Console (`wing it`) and attempting to debug inflight code in a `test` or Function, the first execution of the test will not hit a breakpoint and will need to be run again -- ([Issue](https://github.com/winglang/wing/issues/5986)) inflight code by default has a timeout that continues during debugging, so if execution is paused for too long the program is terminate +To start, open your .w file in VS Code and set breakpoints by clicking in the gutter to the left of the line number. Breakpoints can also be set in extern files. +Once set, press F5 or use the "Run and Debug" button in the sidebar to start the debugger. This will use the current file if it's an entrypoint or it will prompt you to select one. Different CLI arguments can be provided as well. +By default, `wing test` will be run with an attached debugger. #### Non-VSCode Support diff --git a/libs/wingsdk/.projen/deps.json b/libs/wingsdk/.projen/deps.json index 0cc97fca607..13a0ec341d8 100644 --- a/libs/wingsdk/.projen/deps.json +++ b/libs/wingsdk/.projen/deps.json @@ -338,6 +338,10 @@ "name": "uuid", "type": "bundled" }, + { + "name": "vlq", + "type": "bundled" + }, { "name": "yaml", "type": "bundled" diff --git a/libs/wingsdk/.projenrc.ts b/libs/wingsdk/.projenrc.ts index f3433a92daa..b66ff083697 100644 --- a/libs/wingsdk/.projenrc.ts +++ b/libs/wingsdk/.projenrc.ts @@ -89,6 +89,7 @@ const project = new cdk.JsiiProject({ // enhanced diagnostics "stacktracey", "ulid", + "vlq", // tunnels "@winglang/wingtunnels@workspace:^", "glob", diff --git a/libs/wingsdk/package.json b/libs/wingsdk/package.json index 989cba997b2..29217b20a2a 100644 --- a/libs/wingsdk/package.json +++ b/libs/wingsdk/package.json @@ -117,6 +117,7 @@ "toml": "^3.0.0", "ulid": "^2.3.0", "uuid": "^8.3.2", + "vlq": "^2.0.4", "yaml": "^2.3.2" }, "bundledDependencies": [ @@ -159,6 +160,7 @@ "toml", "ulid", "uuid", + "vlq", "yaml" ], "engines": { diff --git a/libs/wingsdk/src/shared/bundling.ts b/libs/wingsdk/src/shared/bundling.ts index 20cc47c6203..0d38bc855e8 100644 --- a/libs/wingsdk/src/shared/bundling.ts +++ b/libs/wingsdk/src/shared/bundling.ts @@ -1,6 +1,7 @@ import * as crypto from "crypto"; import { mkdirSync, realpathSync, writeFileSync } from "fs"; import { posix, resolve } from "path"; +import { decode, encode } from "vlq"; import { normalPath } from "./misc"; const SDK_PATH = normalPath(resolve(__dirname, "..", "..")); @@ -74,15 +75,7 @@ export function createBundle( const sourcemapData = JSON.parse( new TextDecoder().decode(esbuild.outputFiles[0].contents) ); - if (sourcemapData.sourceRoot) { - sourcemapData.sourceRoot = normalPath(sourcemapData.sourceRoot); - } - - for (const [idx, source] of Object.entries( - sourcemapData.sources as string[] - )) { - sourcemapData.sources[idx] = normalPath(source); - } + fixSourcemaps(sourcemapData); writeFileSync(outfile, bundleOutput.contents); writeFileSync(outfileMap, JSON.stringify(sourcemapData)); @@ -101,3 +94,100 @@ export function createBundle( sourcemapPath: outfileMap, }; } + +export interface SourceMap { + sourceRoot?: string; + sources: string[]; + sourcesContent: string[]; + mappings: string; +} + +/** + * Takes a bundled sourcemap and does the following fixes: + * - Normalizes paths in sources and sourceRoot + * - Removes duplicate sources and sourcesContent + * - Updates mappings to reflect the new source indices + * + * The duplicate sources come from esbuild's strange handling of multiple files being bundled that point to the same source (e.g. inflights that point to one .w file) + * See https://github.com/evanw/esbuild/issues/933 + */ +export function fixSourcemaps(sourcemapData: SourceMap): void { + // normalize sourceRoot + if (sourcemapData.sourceRoot) { + sourcemapData.sourceRoot = normalPath(sourcemapData.sourceRoot); + } + + // normalize sources and remove duplicates + const sourceSet: string[] = []; + const newSourceContents: string[] = []; + const sourceIndexMap: Record = {}; + let hasSourceDupes = false; + sourcemapData.sources.forEach((source, idx) => { + const newPath = normalPath(source); + sourcemapData.sources[idx] = newPath; + + const existingIndex = sourceSet.indexOf(newPath); + if (existingIndex === -1) { + sourceSet.push(newPath); + newSourceContents.push(sourcemapData.sourcesContent[idx]); + sourceIndexMap[idx] = sourceSet.length - 1; + } else { + hasSourceDupes = true; + sourceIndexMap[idx] = existingIndex; + } + }); + + sourcemapData.sources = sourceSet; + sourcemapData.sourcesContent = newSourceContents; + + // fast path: No source duplicates so no need to update mappings + if (!hasSourceDupes) { + return; + } + + // update mappings + let newMapping = ""; + let characterIndex = 0; + let lastFile = 0; + let lastTrueFile = 0; + while (characterIndex < sourcemapData.mappings.length) { + const char = sourcemapData.mappings[characterIndex]; + // `;` and `,` are separators between the segments of interest + if (char === ";" || char === ",") { + newMapping += char; + characterIndex++; + continue; + } + + // get next slice of segment data + let segment = ""; + let nextChar = char; + while (nextChar !== undefined && nextChar !== "," && nextChar !== ";") { + segment += nextChar; + nextChar = sourcemapData.mappings[++characterIndex]; + } + const decoded = decode(segment); + if (decoded.length === 1) { + newMapping += segment; + continue; + } + + const sourceRelative = decoded[1]; + const originalSource = lastTrueFile + sourceRelative; + const newSourceIndex = sourceIndexMap[originalSource]; + lastTrueFile = originalSource; + + const newRelativeValue = newSourceIndex - lastFile; + lastFile = newSourceIndex; + + if (newRelativeValue === decoded[1]) { + // no change was made, avoid re-encoding + newMapping += segment; + } else { + decoded[1] = newRelativeValue; + newMapping += encode(decoded); + } + } + + sourcemapData.mappings = newMapping; +} diff --git a/libs/wingsdk/src/shared/sandbox.ts b/libs/wingsdk/src/shared/sandbox.ts index 5d82610307b..4500e57e87b 100644 --- a/libs/wingsdk/src/shared/sandbox.ts +++ b/libs/wingsdk/src/shared/sandbox.ts @@ -47,6 +47,15 @@ export class Sandbox { ); } + let debugShim = ""; + if (inspectorUrl?.()) { + // If we're debugging, we need to make sure the debugger has enough time to attach + // to the child process. This gives enough time for the debugger load sourcemaps and set breakpoints. + // See https://github.com/microsoft/vscode-js-debug/issues/1510 + debugShim = + "\n await new Promise((resolve) => setTimeout(resolve, 25));"; + } + // wrap contents with a shim that handles the communication with the parent process // we insert this shim before bundling to ensure source maps are generated correctly contents += ` @@ -54,12 +63,13 @@ process.setUncaughtExceptionCaptureCallback((reason) => { process.send({ type: "reject", reason }); }); -process.on("message", async (message) => { +process.on("message", async (message) => {${debugShim} const { fn, args } = message; const value = await exports[fn](...args); process.send({ type: "resolve", value }); }); `; + const wrappedPath = entrypoint.replace(/\.cjs$/, ".sandbox.cjs"); writeFileSync(wrappedPath, contents); // async fsPromises.writeFile "flush" option is not available in Node 20 const bundle = createBundle(wrappedPath); @@ -232,7 +242,7 @@ process.on("message", async (message) => { reject(new Error(`Process exited with code ${code}, signal ${signal}`)); }; - if (this.options.timeout) { + if (this.options.timeout && !inspectorUrl?.()) { this.timeout = setTimeout(() => { this.debugLog("Killing process after timeout."); this.child?.kill("SIGTERM"); diff --git a/libs/wingsdk/test/shared/bundling.test.ts b/libs/wingsdk/test/shared/bundling.test.ts new file mode 100644 index 00000000000..41e5f18b0ed --- /dev/null +++ b/libs/wingsdk/test/shared/bundling.test.ts @@ -0,0 +1,72 @@ +import { describe, it, expect } from "vitest"; +import { encode, decode } from "vlq"; +import { fixSourcemaps } from "../../src/shared/bundling"; + +describe("fixSourcemaps", () => { + it("should fix sourcemaps", () => { + // THEN + const mappings = [ + [0, 0, 0, 0], + [0, 1, 1, 0], + [0, 2, 2, 0], + [0, -1, 3, 0], + [0, -1, 4, 0], + ]; + const originalMapping = mappings.map((m) => encode(m)).join(";"); + + const sourcemapData = { + sources: ["a/aa", "b", "a/aa", "c"], + sourcesContent: ["1", "2", "1", "3"], + mappings: originalMapping, + }; + + // WHEN + fixSourcemaps(sourcemapData); + + // THEN + expect(sourcemapData.sources).toHaveLength(3); + expect(sourcemapData.sourcesContent).toHaveLength(3); + expect(sourcemapData.mappings).not.toEqual(originalMapping); + + expect(sourcemapData.sources).toMatchInlineSnapshot(` + [ + "a/aa", + "b", + "c", + ] + `); + expect(sourcemapData.sourcesContent).toMatchInlineSnapshot(` + [ + "1", + "2", + "3", + ] + `); + + const decoded = sourcemapData.mappings.split(";").map(decode); + expect(decoded).toHaveLength(5); + // first 2 mappings are unchanged + expect(decoded[0]).toEqual(mappings[0]); + expect(decoded[1]).toEqual(mappings[1]); + // This mapping pointed to [3] which is now at [2], so now it needs to point to [2] + // AKA Shifted by 1 + expect(decoded[2]).toEqual([ + mappings[2][0], + mappings[2][1] - 1, + mappings[2][2], + mappings[2][3], + ]); + expect(decoded[3]).toEqual([ + mappings[3][0], + mappings[3][1] - 1, + mappings[3][2], + mappings[3][3], + ]); + expect(decoded[4]).toEqual([ + mappings[4][0], + mappings[4][1] + 2, + mappings[4][2], + mappings[4][3], + ]); + }); +}); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c4f1c1bcc81..815dd742ec9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1380,6 +1380,9 @@ importers: uuid: specifier: ^8.3.2 version: 8.3.2 + vlq: + specifier: ^2.0.4 + version: 2.0.4 yaml: specifier: ^2.3.2 version: 2.3.2 @@ -23429,6 +23432,10 @@ packages: - terser dev: true + /vlq@2.0.4: + resolution: {integrity: sha512-aodjPa2wPQFkra1G8CzJBTHXhgk3EVSwxSWXNPr1fgdFLUb8kvLV1iEb6rFgasIsjP82HWI6dsb5Io26DDnasA==} + dev: false + /vscode-jsonrpc@8.1.0: resolution: {integrity: sha512-6TDy/abTQk+zDGYazgbIPc+4JoXdwC8NHU9Pbn4UJP1fehUyZmM4RHp5IthX7A6L5KS30PRui+j+tbbMMMafdw==} engines: {node: '>=14.0.0'} From f0b6b11709eb2ed56e5ef76a9b6fcc98615683b8 Mon Sep 17 00:00:00 2001 From: Mark McCulloh Date: Mon, 15 Apr 2024 02:16:09 -0400 Subject: [PATCH 15/15] fix(vscode): wing debugger is not a default choice for .w files (#6238) Missed this change in https://github.com/winglang/wing/pull/6217 Now vscode will automatically use the builtin debugger when you have a wing file open instead of asking you to pick one *By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*. --- apps/vscode-wing/.projenrc.ts | 1 + apps/vscode-wing/package.json | 3 +++ apps/vscode-wing/src/project/vscode_types.ts | 1 + 3 files changed, 5 insertions(+) diff --git a/apps/vscode-wing/.projenrc.ts b/apps/vscode-wing/.projenrc.ts index 49cf8f0e4e7..4c3bd1faad5 100644 --- a/apps/vscode-wing/.projenrc.ts +++ b/apps/vscode-wing/.projenrc.ts @@ -113,6 +113,7 @@ const contributes: VSCodeExtensionContributions = { type: "wing", label: "Wing Debug", program: "", + languages: ["wing"], configurationAttributes: { launch: { entrypoint: { diff --git a/apps/vscode-wing/package.json b/apps/vscode-wing/package.json index 5dfb9ff9ca9..cae5403b40b 100644 --- a/apps/vscode-wing/package.json +++ b/apps/vscode-wing/package.json @@ -116,6 +116,9 @@ "type": "wing", "label": "Wing Debug", "program": "", + "languages": [ + "wing" + ], "configurationAttributes": { "launch": { "entrypoint": { diff --git a/apps/vscode-wing/src/project/vscode_types.ts b/apps/vscode-wing/src/project/vscode_types.ts index d85f170dad4..25c8648fcef 100644 --- a/apps/vscode-wing/src/project/vscode_types.ts +++ b/apps/vscode-wing/src/project/vscode_types.ts @@ -53,6 +53,7 @@ export interface VSCodeDebugger { readonly type: string; readonly runtime?: string; readonly program?: string; + readonly languages: string[]; readonly request?: string; readonly variables?: string; readonly configurationAttributes?: any;