diff --git a/bin/download-compiler b/bin/download-compiler index 675404f..a8b9557 100755 --- a/bin/download-compiler +++ b/bin/download-compiler @@ -2,7 +2,7 @@ set -eu -VERSION="v0.34.1" +VERSION="v1.0.0" rm -fr wasm-compiler mkdir wasm-compiler diff --git a/src/content/chapter0_basics/lesson01_hello_world/text.html b/src/content/chapter0_basics/lesson01_hello_world/en.html similarity index 100% rename from src/content/chapter0_basics/lesson01_hello_world/text.html rename to src/content/chapter0_basics/lesson01_hello_world/en.html diff --git a/src/content/chapter0_basics/lesson02_unqualified_imports/text.html b/src/content/chapter0_basics/lesson02_unqualified_imports/en.html similarity index 100% rename from src/content/chapter0_basics/lesson02_unqualified_imports/text.html rename to src/content/chapter0_basics/lesson02_unqualified_imports/en.html diff --git a/src/content/chapter0_basics/lesson03_type_checking/text.html b/src/content/chapter0_basics/lesson03_type_checking/en.html similarity index 100% rename from src/content/chapter0_basics/lesson03_type_checking/text.html rename to src/content/chapter0_basics/lesson03_type_checking/en.html diff --git a/src/content/chapter0_basics/lesson04_ints/text.html b/src/content/chapter0_basics/lesson04_ints/en.html similarity index 100% rename from src/content/chapter0_basics/lesson04_ints/text.html rename to src/content/chapter0_basics/lesson04_ints/en.html diff --git a/src/content/chapter0_basics/lesson05_floats/text.html b/src/content/chapter0_basics/lesson05_floats/en.html similarity index 100% rename from src/content/chapter0_basics/lesson05_floats/text.html rename to src/content/chapter0_basics/lesson05_floats/en.html diff --git a/src/content/chapter0_basics/lesson06_number_formats/text.html b/src/content/chapter0_basics/lesson06_number_formats/en.html similarity index 100% rename from src/content/chapter0_basics/lesson06_number_formats/text.html rename to src/content/chapter0_basics/lesson06_number_formats/en.html diff --git a/src/content/chapter0_basics/lesson07_equality/text.html b/src/content/chapter0_basics/lesson07_equality/en.html similarity index 100% rename from src/content/chapter0_basics/lesson07_equality/text.html rename to src/content/chapter0_basics/lesson07_equality/en.html diff --git a/src/content/chapter0_basics/lesson08_strings/text.html b/src/content/chapter0_basics/lesson08_strings/en.html similarity index 100% rename from src/content/chapter0_basics/lesson08_strings/text.html rename to src/content/chapter0_basics/lesson08_strings/en.html diff --git a/src/content/chapter0_basics/lesson09_bools/text.html b/src/content/chapter0_basics/lesson09_bools/en.html similarity index 100% rename from src/content/chapter0_basics/lesson09_bools/text.html rename to src/content/chapter0_basics/lesson09_bools/en.html diff --git a/src/content/chapter0_basics/lesson10_assignments/text.html b/src/content/chapter0_basics/lesson10_assignments/en.html similarity index 100% rename from src/content/chapter0_basics/lesson10_assignments/text.html rename to src/content/chapter0_basics/lesson10_assignments/en.html diff --git a/src/content/chapter0_basics/lesson11_discard_patterns/text.html b/src/content/chapter0_basics/lesson11_discard_patterns/en.html similarity index 100% rename from src/content/chapter0_basics/lesson11_discard_patterns/text.html rename to src/content/chapter0_basics/lesson11_discard_patterns/en.html diff --git a/src/content/chapter0_basics/lesson12_type_annotations/text.html b/src/content/chapter0_basics/lesson12_type_annotations/en.html similarity index 100% rename from src/content/chapter0_basics/lesson12_type_annotations/text.html rename to src/content/chapter0_basics/lesson12_type_annotations/en.html diff --git a/src/content/chapter0_basics/lesson13_type_aliases/text.html b/src/content/chapter0_basics/lesson13_type_aliases/en.html similarity index 100% rename from src/content/chapter0_basics/lesson13_type_aliases/text.html rename to src/content/chapter0_basics/lesson13_type_aliases/en.html diff --git a/src/content/chapter0_basics/lesson14_blocks/text.html b/src/content/chapter0_basics/lesson14_blocks/en.html similarity index 100% rename from src/content/chapter0_basics/lesson14_blocks/text.html rename to src/content/chapter0_basics/lesson14_blocks/en.html diff --git a/src/content/chapter0_basics/lesson15_lists/text.html b/src/content/chapter0_basics/lesson15_lists/en.html similarity index 100% rename from src/content/chapter0_basics/lesson15_lists/text.html rename to src/content/chapter0_basics/lesson15_lists/en.html diff --git a/src/content/chapter0_basics/lesson16_constants/text.html b/src/content/chapter0_basics/lesson16_constants/en.html similarity index 100% rename from src/content/chapter0_basics/lesson16_constants/text.html rename to src/content/chapter0_basics/lesson16_constants/en.html diff --git a/src/content/chapter1_functions/lesson00_functions/text.html b/src/content/chapter1_functions/lesson00_functions/en.html similarity index 100% rename from src/content/chapter1_functions/lesson00_functions/text.html rename to src/content/chapter1_functions/lesson00_functions/en.html diff --git a/src/content/chapter1_functions/lesson03_higher_order_functions/text.html b/src/content/chapter1_functions/lesson03_higher_order_functions/en.html similarity index 100% rename from src/content/chapter1_functions/lesson03_higher_order_functions/text.html rename to src/content/chapter1_functions/lesson03_higher_order_functions/en.html diff --git a/src/content/chapter1_functions/lesson04_anonymous_functions/text.html b/src/content/chapter1_functions/lesson04_anonymous_functions/en.html similarity index 100% rename from src/content/chapter1_functions/lesson04_anonymous_functions/text.html rename to src/content/chapter1_functions/lesson04_anonymous_functions/en.html diff --git a/src/content/chapter1_functions/lesson05_function_captures/text.html b/src/content/chapter1_functions/lesson05_function_captures/en.html similarity index 100% rename from src/content/chapter1_functions/lesson05_function_captures/text.html rename to src/content/chapter1_functions/lesson05_function_captures/en.html diff --git a/src/content/chapter1_functions/lesson06_generic_functions/code.gleam b/src/content/chapter1_functions/lesson06_generic_functions/code.gleam index e232bf8..7b7c8db 100644 --- a/src/content/chapter1_functions/lesson06_generic_functions/code.gleam +++ b/src/content/chapter1_functions/lesson06_generic_functions/code.gleam @@ -14,6 +14,7 @@ pub fn main() { io.debug(twice("Hello", exclaim)) } +// The name `value` refers to the same type multiple times fn twice(argument: value, function: fn(value) -> value) -> value { function(function(argument)) } diff --git a/src/content/chapter1_functions/lesson06_generic_functions/text.html b/src/content/chapter1_functions/lesson06_generic_functions/en.html similarity index 100% rename from src/content/chapter1_functions/lesson06_generic_functions/text.html rename to src/content/chapter1_functions/lesson06_generic_functions/en.html diff --git a/src/content/chapter1_functions/lesson07_pipelines/text.html b/src/content/chapter1_functions/lesson07_pipelines/en.html similarity index 100% rename from src/content/chapter1_functions/lesson07_pipelines/text.html rename to src/content/chapter1_functions/lesson07_pipelines/en.html diff --git a/src/content/chapter1_functions/lesson08_labelled_arguments/text.html b/src/content/chapter1_functions/lesson08_labelled_arguments/en.html similarity index 100% rename from src/content/chapter1_functions/lesson08_labelled_arguments/text.html rename to src/content/chapter1_functions/lesson08_labelled_arguments/en.html diff --git a/src/content/chapter1_functions/lesson09_documentation_comments/text.html b/src/content/chapter1_functions/lesson09_documentation_comments/en.html similarity index 100% rename from src/content/chapter1_functions/lesson09_documentation_comments/text.html rename to src/content/chapter1_functions/lesson09_documentation_comments/en.html diff --git a/src/content/chapter1_functions/lesson10_deprecations/text.html b/src/content/chapter1_functions/lesson10_deprecations/en.html similarity index 72% rename from src/content/chapter1_functions/lesson10_deprecations/text.html rename to src/content/chapter1_functions/lesson10_deprecations/en.html index 8fe260f..b181597 100644 --- a/src/content/chapter1_functions/lesson10_deprecations/text.html +++ b/src/content/chapter1_functions/lesson10_deprecations/en.html @@ -4,11 +4,11 @@ attribute.
- If a deprecated function is reference the compiler will emit a warning, + If a deprecated function is referenced the compiler will emit a warning, letting the programmer know they ought to update their code.
The deprecation attribute takes a message and this will be displayed to the user in the warning. In the message explain to the user the new approach or - replacement function, or direct them on documentation on how to upgrade. + replacement function, or direct them to documentation on how to upgrade.
diff --git a/src/content/chapter2_flow_control/lesson01_case_expressions/text.html b/src/content/chapter2_flow_control/lesson01_case_expressions/en.html similarity index 100% rename from src/content/chapter2_flow_control/lesson01_case_expressions/text.html rename to src/content/chapter2_flow_control/lesson01_case_expressions/en.html diff --git a/src/content/chapter2_flow_control/lesson02_variable_patterns/text.html b/src/content/chapter2_flow_control/lesson02_variable_patterns/en.html similarity index 100% rename from src/content/chapter2_flow_control/lesson02_variable_patterns/text.html rename to src/content/chapter2_flow_control/lesson02_variable_patterns/en.html diff --git a/src/content/chapter2_flow_control/lesson03_string_patterns/text.html b/src/content/chapter2_flow_control/lesson03_string_patterns/en.html similarity index 100% rename from src/content/chapter2_flow_control/lesson03_string_patterns/text.html rename to src/content/chapter2_flow_control/lesson03_string_patterns/en.html diff --git a/src/content/chapter2_flow_control/lesson04_list_patterns/text.html b/src/content/chapter2_flow_control/lesson04_list_patterns/en.html similarity index 100% rename from src/content/chapter2_flow_control/lesson04_list_patterns/text.html rename to src/content/chapter2_flow_control/lesson04_list_patterns/en.html diff --git a/src/content/chapter2_flow_control/lesson05_recursion/text.html b/src/content/chapter2_flow_control/lesson05_recursion/en.html similarity index 100% rename from src/content/chapter2_flow_control/lesson05_recursion/text.html rename to src/content/chapter2_flow_control/lesson05_recursion/en.html diff --git a/src/content/chapter2_flow_control/lesson06_tail_calls/code.gleam b/src/content/chapter2_flow_control/lesson06_tail_calls/code.gleam index d823eec..f029627 100644 --- a/src/content/chapter2_flow_control/lesson06_tail_calls/code.gleam +++ b/src/content/chapter2_flow_control/lesson06_tail_calls/code.gleam @@ -15,7 +15,7 @@ fn factorial_loop(x: Int, accumulator: Int) -> Int { 1 -> accumulator // The last thing this function does is call itself - // In the previous lesson the last thing it did was multiple two ints + // In the previous lesson the last thing it did was multiply two ints _ -> factorial_loop(x - 1, accumulator * x) } } diff --git a/src/content/chapter2_flow_control/lesson06_tail_calls/text.html b/src/content/chapter2_flow_control/lesson06_tail_calls/en.html similarity index 100% rename from src/content/chapter2_flow_control/lesson06_tail_calls/text.html rename to src/content/chapter2_flow_control/lesson06_tail_calls/en.html diff --git a/src/content/chapter2_flow_control/lesson07_list_recursion/text.html b/src/content/chapter2_flow_control/lesson07_list_recursion/en.html similarity index 84% rename from src/content/chapter2_flow_control/lesson07_list_recursion/text.html rename to src/content/chapter2_flow_control/lesson07_list_recursion/en.html index 94e8152..d2194e3 100644 --- a/src/content/chapter2_flow_control/lesson07_list_recursion/text.html +++ b/src/content/chapter2_flow_control/lesson07_list_recursion/en.html @@ -1,9 +1,9 @@
- Most commonly functions in the
+ While it is more common to use functions in the
gleam/list
- module are used to iterate across a list, but at times you may prefer to work
+ module to iterate across a list, at times you may prefer to work
with the list directly.
diff --git a/src/content/chapter2_flow_control/lesson08_multiple_subjects/text.html b/src/content/chapter2_flow_control/lesson08_multiple_subjects/en.html
similarity index 100%
rename from src/content/chapter2_flow_control/lesson08_multiple_subjects/text.html
rename to src/content/chapter2_flow_control/lesson08_multiple_subjects/en.html
diff --git a/src/content/chapter2_flow_control/lesson09_alternative_patterns/text.html b/src/content/chapter2_flow_control/lesson09_alternative_patterns/en.html
similarity index 100%
rename from src/content/chapter2_flow_control/lesson09_alternative_patterns/text.html
rename to src/content/chapter2_flow_control/lesson09_alternative_patterns/en.html
diff --git a/src/content/chapter2_flow_control/lesson10_pattern_aliases/text.html b/src/content/chapter2_flow_control/lesson10_pattern_aliases/en.html
similarity index 100%
rename from src/content/chapter2_flow_control/lesson10_pattern_aliases/text.html
rename to src/content/chapter2_flow_control/lesson10_pattern_aliases/en.html
diff --git a/src/content/chapter2_flow_control/lesson11_guards/text.html b/src/content/chapter2_flow_control/lesson11_guards/en.html
similarity index 100%
rename from src/content/chapter2_flow_control/lesson11_guards/text.html
rename to src/content/chapter2_flow_control/lesson11_guards/en.html
diff --git a/src/content/chapter3_data_types/lesson00_tuples/text.html b/src/content/chapter3_data_types/lesson00_tuples/en.html
similarity index 85%
rename from src/content/chapter3_data_types/lesson00_tuples/text.html
rename to src/content/chapter3_data_types/lesson00_tuples/en.html
index f121a9d..a5c708e 100644
--- a/src/content/chapter3_data_types/lesson00_tuples/text.html
+++ b/src/content/chapter3_data_types/lesson00_tuples/en.html
@@ -14,7 +14,7 @@
and #(1.4, 10, 48)
has the type #(Float, Int, Int)
.
- Tuples are most commonly used to return 2 or 3 values from a function. Other - times it is often is clearer to use a custom type, which we will - cover next. + Tuples are most commonly used to return 2 or 3 values from a function. + Often it is clearer to use a custom type where a tuple could + be used, We will cover custom types next.
diff --git a/src/content/chapter3_data_types/lesson01_custom_types/text.html b/src/content/chapter3_data_types/lesson01_custom_types/en.html similarity index 100% rename from src/content/chapter3_data_types/lesson01_custom_types/text.html rename to src/content/chapter3_data_types/lesson01_custom_types/en.html diff --git a/src/content/chapter3_data_types/lesson02_records/text.html b/src/content/chapter3_data_types/lesson02_records/en.html similarity index 57% rename from src/content/chapter3_data_types/lesson02_records/text.html rename to src/content/chapter3_data_types/lesson02_records/en.html index f515ccd..ea46e4d 100644 --- a/src/content/chapter3_data_types/lesson02_records/text.html +++ b/src/content/chapter3_data_types/lesson02_records/en.html @@ -1,6 +1,9 @@ -Variants of a record can hold other data within them.
- These fields can be given labels, and like function argument labels they can + A variant of a custom type can hold other data within it. In this case + the variant is called a record. +
++ The fields of a record can be given labels, and like function argument labels they can be optionally used when calling the record constructor. Typically labels will be used for variants that define them.
diff --git a/src/content/chapter3_data_types/lesson03_record_accessors/text.html b/src/content/chapter3_data_types/lesson03_record_accessors/en.html similarity index 100% rename from src/content/chapter3_data_types/lesson03_record_accessors/text.html rename to src/content/chapter3_data_types/lesson03_record_accessors/en.html diff --git a/src/content/chapter3_data_types/lesson04_record_updates/text.html b/src/content/chapter3_data_types/lesson04_record_updates/en.html similarity index 100% rename from src/content/chapter3_data_types/lesson04_record_updates/text.html rename to src/content/chapter3_data_types/lesson04_record_updates/en.html diff --git a/src/content/chapter3_data_types/lesson05_nil/text.html b/src/content/chapter3_data_types/lesson05_nil/en.html similarity index 100% rename from src/content/chapter3_data_types/lesson05_nil/text.html rename to src/content/chapter3_data_types/lesson05_nil/en.html diff --git a/src/content/chapter3_data_types/lesson06_results/text.html b/src/content/chapter3_data_types/lesson06_results/en.html similarity index 94% rename from src/content/chapter3_data_types/lesson06_results/text.html rename to src/content/chapter3_data_types/lesson06_results/en.html index 2e1b16b..4e80208 100644 --- a/src/content/chapter3_data_types/lesson06_results/text.html +++ b/src/content/chapter3_data_types/lesson06_results/en.html @@ -18,7 +18,7 @@ failure.- Commonly Gleam programs and library will define custom types with a variant + Commonly a Gleam program or library will define a custom type with a variant for each possible problem that can arise, along with any error information that would be useful to the programmer.
diff --git a/src/content/chapter3_data_types/lesson07_bit_arrays/text.html b/src/content/chapter3_data_types/lesson07_bit_arrays/en.html similarity index 93% rename from src/content/chapter3_data_types/lesson07_bit_arrays/text.html rename to src/content/chapter3_data_types/lesson07_bit_arrays/en.html index 3214db1..cd6733a 100644 --- a/src/content/chapter3_data_types/lesson07_bit_arrays/text.html +++ b/src/content/chapter3_data_types/lesson07_bit_arrays/en.html @@ -22,5 +22,5 @@Bit arrays have limited support when compiling to JavaScript, not all options - can be used. Full bit array support will be implemented in future. + can be used. Full bit array support will be implemented in the future.
diff --git a/src/content/chapter4_standard_library/lesson00_standard_library_package/text.html b/src/content/chapter4_standard_library/lesson00_standard_library_package/en.html similarity index 100% rename from src/content/chapter4_standard_library/lesson00_standard_library_package/text.html rename to src/content/chapter4_standard_library/lesson00_standard_library_package/en.html diff --git a/src/content/chapter4_standard_library/lesson01_list_module/text.html b/src/content/chapter4_standard_library/lesson01_list_module/en.html similarity index 100% rename from src/content/chapter4_standard_library/lesson01_list_module/text.html rename to src/content/chapter4_standard_library/lesson01_list_module/en.html diff --git a/src/content/chapter4_standard_library/lesson02_result_module/text.html b/src/content/chapter4_standard_library/lesson02_result_module/en.html similarity index 100% rename from src/content/chapter4_standard_library/lesson02_result_module/text.html rename to src/content/chapter4_standard_library/lesson02_result_module/en.html diff --git a/src/content/chapter4_standard_library/lesson03_dict_module/text.html b/src/content/chapter4_standard_library/lesson03_dict_module/en.html similarity index 100% rename from src/content/chapter4_standard_library/lesson03_dict_module/text.html rename to src/content/chapter4_standard_library/lesson03_dict_module/en.html diff --git a/src/content/chapter4_standard_library/lesson04_option_module/text.html b/src/content/chapter4_standard_library/lesson04_option_module/en.html similarity index 100% rename from src/content/chapter4_standard_library/lesson04_option_module/text.html rename to src/content/chapter4_standard_library/lesson04_option_module/en.html diff --git a/src/content/chapter5_advanced_features/lesson00_use/text.html b/src/content/chapter5_advanced_features/lesson00_use/en.html similarity index 100% rename from src/content/chapter5_advanced_features/lesson00_use/text.html rename to src/content/chapter5_advanced_features/lesson00_use/en.html diff --git a/src/content/chapter5_advanced_features/lesson01_use_sugar/text.html b/src/content/chapter5_advanced_features/lesson01_use_sugar/en.html similarity index 100% rename from src/content/chapter5_advanced_features/lesson01_use_sugar/text.html rename to src/content/chapter5_advanced_features/lesson01_use_sugar/en.html diff --git a/src/content/chapter5_advanced_features/lesson02_todo/text.html b/src/content/chapter5_advanced_features/lesson02_todo/en.html similarity index 100% rename from src/content/chapter5_advanced_features/lesson02_todo/text.html rename to src/content/chapter5_advanced_features/lesson02_todo/en.html diff --git a/src/content/chapter5_advanced_features/lesson03_panic/text.html b/src/content/chapter5_advanced_features/lesson03_panic/en.html similarity index 100% rename from src/content/chapter5_advanced_features/lesson03_panic/text.html rename to src/content/chapter5_advanced_features/lesson03_panic/en.html diff --git a/src/content/chapter5_advanced_features/lesson04_let_assert/code.gleam b/src/content/chapter5_advanced_features/lesson04_let_assert/code.gleam new file mode 100644 index 0000000..2ba907a --- /dev/null +++ b/src/content/chapter5_advanced_features/lesson04_let_assert/code.gleam @@ -0,0 +1,16 @@ +import gleam/io + +pub fn main() { + let a = unsafely_get_first_element([123]) + io.debug(a) + + let b = unsafely_get_first_element([]) + io.debug(b) +} + +pub fn unsafely_get_first_element(items: List(a)) -> a { + // This will panic if the list is empty. + // A regular `let` would not permit this partial pattern + let assert [first, ..] = items + first +} diff --git a/src/content/chapter5_advanced_features/lesson04_let_assert/en.html b/src/content/chapter5_advanced_features/lesson04_let_assert/en.html new file mode 100644 index 0000000..29fd06c --- /dev/null +++ b/src/content/chapter5_advanced_features/lesson04_let_assert/en.html @@ -0,0 +1,15 @@ +
+ let assert
is the final way to intentionally crash your Gleam
+ program. It is similar to the panic
keyword in that it crashes
+ when the program has reached a point that should never be reached.
+
+ let assert
is similar to let
in that it is a way to
+ assign values to variables, but it is different in that the pattern can be
+ partial. The pattern does not need to match every possible value of the
+ type being assigned.
+
+ Like panic
this feature should be used sparingly, and likely not
+ at all in libraries.
+
- Read the Gleam getting started - documentation to learn more about the language and its tooling. + Read the Writing Gleam + guide to learn how to create and develop a Gleam project.
Join the the Gleam Discord server @@ -184,7 +184,7 @@ fn read_file(path: String) -> snag.Result(String) { fn load_lesson(chapter_path: String, names: FileNames) -> snag.Result(Lesson) { use code <- result.try(read_file(names.path <> "/code.gleam")) - use text <- result.try(read_file(names.path <> "/text.html")) + use text <- result.try(read_file(names.path <> "/en.html")) Ok(Lesson( name: names.name, @@ -540,7 +540,7 @@ fn lesson_html(page: Lesson) -> String { metaprop("twitter:title", title), metaprop("twitter:description", description), metaprop("twitter:image", "https://gleam.run/images/og-image.png"), - link("shortcut icon", "https://gleam.run/images/lucy-circle.svg"), + link("shortcut icon", "https://gleam.run/images/lucy/lucy.svg"), link("stylesheet", "/common.css"), link("stylesheet", "/style.css"), h( @@ -560,7 +560,17 @@ fn lesson_html(page: Lesson) -> String { ]), h("body", [], [ h("nav", [#("class", "navbar")], [ - h("a", [#("href", "/")], [text("Gleam Language Tour")]), + h("a", [#("href", "/"), #("class", "logo")], [ + h( + "img", + [ + #("src", "https://gleam.run/images/lucy/lucy.svg"), + #("alt", "Lucy the star, Gleam's mascot"), + ], + [], + ), + text("Gleam Language Tour"), + ]), h("div", [#("class", "nav-right")], [ h("div", [#("class", "theme-picker")], [ h( diff --git a/static/style.css b/static/style.css index 13bb1a8..1881ea5 100644 --- a/static/style.css +++ b/static/style.css @@ -112,6 +112,18 @@ a code { color: inherit; } +.navbar .logo { + display: flex; + align-items: center; +} + +.navbar .logo img { + display: inline-block; + height: 2em; + transform: rotate(-10deg); + margin-right: 0.5em; +} + .navbar a:visited, .navbar a { text-decoration: none; diff --git a/static/worker.js b/static/worker.js index a3c4a51..7a3db05 100644 --- a/static/worker.js +++ b/static/worker.js @@ -16,10 +16,6 @@ console.log = (...args) => { logged += args.map((e) => `${e}`).join(" ") + "\n"; }; -function resetLogCapture() { - logged = ""; -} - async function loadProgram(js) { const url = new URL(import.meta.url); url.pathname = ""; @@ -36,6 +32,7 @@ async function loadProgram(js) { } async function compileEval(code) { + logged = ""; const result = { log: null, error: null, @@ -47,7 +44,6 @@ async function compileEval(code) { project.compilePackage("javascript"); const js = project.readCompiledJavaScript("main"); const main = await loadProgram(js); - resetLogCapture(); if (main) main(); } catch (error) { console.error(error);