From 6d3c6807cd1492e4407f2c6a426a89f1df6ca16b Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Mon, 23 Sep 2019 15:39:25 +0200 Subject: [PATCH 1/5] Test bs-platform 5.2.2. --- .../typescript-react-example/bsconfig.json | 2 +- .../package-lock.json | 6 +- .../typescript-react-example/package.json | 2 +- .../src/AutoAnnotate.bs.js | 2 +- .../src/ExportWithRename.bs.js | 2 +- .../src/FirstClassModules.bs.js | 66 +++++++++++-------- .../src/FirstClassModules.gen.tsx | 12 +--- .../src/FirstClassModulesInterface.bs.js | 2 +- .../typescript-react-example/src/Hooks.bs.js | 28 ++++---- .../src/Hooks.gen.tsx | 27 +++----- .../src/IgnoreInterface.bs.js | 2 +- .../src/ImmutableArray.bs.js | 6 +- .../src/ImportHookDefault.bs.js | 2 +- .../src/ImportHooks.bs.js | 2 +- .../src/ImportJsValue.bs.js | 6 +- .../src/ImportMyBanner.bs.js | 2 +- .../src/ModuleAliases.bs.js | 26 ++++---- .../src/ModuleAliases2.bs.js | 8 ++- .../src/NestedModules.bs.js | 46 ++++++------- .../src/NestedModules.gen.tsx | 25 ++----- .../src/NestedModulesInSignature.bs.js | 6 +- .../src/NestedModulesInSignature.gen.tsx | 4 +- .../typescript-react-example/src/Opaque.bs.js | 2 +- .../src/ReasonComponent.bs.js | 2 +- .../src/Records.bs.js | 2 +- .../src/References.bs.js | 12 ++-- .../src/TestEmitInnerModules.bs.js | 22 ++++--- .../src/TestEmitInnerModules.gen.tsx | 10 +-- .../src/TestFirstClassModules.bs.js | 2 +- .../src/TestFirstClassModules.gen.tsx | 15 +---- .../src/TestImmutableArray.bs.js | 4 +- .../src/TestImport.bs.js | 2 +- .../src/TestModuleAliases.bs.js | 2 +- .../src/TestPromise.bs.js | 2 +- .../src/TransitiveType1.bs.js | 2 +- .../src/TransitiveType2.bs.js | 2 +- .../src/TransitiveType3.bs.js | 2 +- .../src/TypeParams1.bs.js | 2 +- .../src/TypeParams2.bs.js | 2 +- .../src/TypeParams3.bs.js | 2 +- .../src/Uncurried.bs.js | 2 +- .../src/UseImportJsValue.bs.js | 2 +- .../src/Variants.bs.js | 2 +- .../src/VariantsWithPayload.bs.js | 10 +-- .../src/components/ComponentAsProp.bs.js | 2 +- .../src/components/ManyComponents.bs.js | 20 +++--- .../src/components/ManyComponents.gen.tsx | 8 +-- .../src/location/location.bs.js | 2 +- .../src/nested/Tuples.bs.js | 2 +- .../src/nested/Types.bs.js | 2 +- 50 files changed, 211 insertions(+), 214 deletions(-) diff --git a/examples/typescript-react-example/bsconfig.json b/examples/typescript-react-example/bsconfig.json index b736acc64..73e6fd479 100644 --- a/examples/typescript-react-example/bsconfig.json +++ b/examples/typescript-react-example/bsconfig.json @@ -17,7 +17,7 @@ "path": "../../src/lib/bs/native/gentype.native.exe" }, "name": "sample-typescript-app", - "bsc-flags": ["-bs-super-errors"], + "bsc-flags": ["-bs-super-errors -verbose"], "reason": { "react-jsx": 3 }, "bs-dependencies": ["reason-react"], "sources": [ diff --git a/examples/typescript-react-example/package-lock.json b/examples/typescript-react-example/package-lock.json index c15d5da9f..2b8f6e8a5 100644 --- a/examples/typescript-react-example/package-lock.json +++ b/examples/typescript-react-example/package-lock.json @@ -2560,9 +2560,9 @@ } }, "bs-platform": { - "version": "5.0.6", - "resolved": "https://registry.npmjs.org/bs-platform/-/bs-platform-5.0.6.tgz", - "integrity": "sha512-6Boa2VEcWJp2WJr38L7bp3J929nYha7gDarjxb070jWzgfPJ/WbzjipmSfnu2eqqk1MfjEIpBipbPz6n1NISwA==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/bs-platform/-/bs-platform-5.2.0.tgz", + "integrity": "sha512-miyePsOF9VbuhT5QD5E/hb+l454Fo4MAcg5xV1GJhbWxmejuF/X7mCYUsNrK1UUAaYt8hnoyFdeLG22sxVta9A==", "dev": true }, "bser": { diff --git a/examples/typescript-react-example/package.json b/examples/typescript-react-example/package.json index 60a497646..82197eebc 100644 --- a/examples/typescript-react-example/package.json +++ b/examples/typescript-react-example/package.json @@ -23,7 +23,7 @@ "@types/node": "^10.5.5", "@types/react": "^16.4.7", "@types/react-dom": "^16.0.6", - "bs-platform": "^5.0.6", + "bs-platform": "^5.2.0", "typescript": "^3.5.1" }, "browserslist": [ diff --git a/examples/typescript-react-example/src/AutoAnnotate.bs.js b/examples/typescript-react-example/src/AutoAnnotate.bs.js index dfe965a00..40fed0f7b 100644 --- a/examples/typescript-react-example/src/AutoAnnotate.bs.js +++ b/examples/typescript-react-example/src/AutoAnnotate.bs.js @@ -1,2 +1,2 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE /* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */ diff --git a/examples/typescript-react-example/src/ExportWithRename.bs.js b/examples/typescript-react-example/src/ExportWithRename.bs.js index 11c32eb77..f5870ab06 100644 --- a/examples/typescript-react-example/src/ExportWithRename.bs.js +++ b/examples/typescript-react-example/src/ExportWithRename.bs.js @@ -1,4 +1,4 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE function ExportWithRename(Props) { diff --git a/examples/typescript-react-example/src/FirstClassModules.bs.js b/examples/typescript-react-example/src/FirstClassModules.bs.js index d56cffefa..e79bf2c6b 100644 --- a/examples/typescript-react-example/src/FirstClassModules.bs.js +++ b/examples/typescript-react-example/src/FirstClassModules.bs.js @@ -1,53 +1,63 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE var y = "abc"; -var EmptyInnerModule = /* module */[]; +var EmptyInnerModule = { }; -var InnerModule2 = /* module */[/* k */4242]; +var InnerModule2 = { + k: 4242 +}; function k3(x) { return x + 1 | 0; } -var InnerModule3 = /* module */[/* k3 */k3]; +var InnerModule3 = { + k3: k3 +}; -var Z = /* module */[/* u : tuple */[ +var Z = { + u: /* tuple */[ 0, 0 - ]]; - -var M = /* module */[ - /* y */y, - /* EmptyInnerModule */EmptyInnerModule, - /* InnerModule2 */InnerModule2, - /* InnerModule3 */InnerModule3, - /* Z */Z, - /* x */42 -]; - -var firstClassModule = [ - 42, - EmptyInnerModule, - InnerModule2, - InnerModule3, - Z, - y -]; + ] +}; + +var M = { + y: y, + EmptyInnerModule: EmptyInnerModule, + InnerModule2: InnerModule2, + InnerModule3: InnerModule3, + Z: Z, + x: 42 +}; + +var firstClassModule = { + x: 42, + EmptyInnerModule: EmptyInnerModule, + InnerModule2: InnerModule2, + InnerModule3: InnerModule3, + Z: Z, + y: y +}; function testConvert(m) { return m; } function SomeFunctor(X) { - var ww = X[/* y */5]; - return /* module */[/* ww */ww]; + var ww = X.y; + return { + ww: ww + }; } function someFunctorAsFunction(x) { - var ww = x[/* y */5]; - return /* module */[/* ww */ww]; + var ww = x.y; + return { + ww: ww + }; } export { diff --git a/examples/typescript-react-example/src/FirstClassModules.gen.tsx b/examples/typescript-react-example/src/FirstClassModules.gen.tsx index 4eb07b56a..e00cb4c97 100644 --- a/examples/typescript-react-example/src/FirstClassModules.gen.tsx +++ b/examples/typescript-react-example/src/FirstClassModules.gen.tsx @@ -26,7 +26,7 @@ export type firstClassModule = { readonly y: string }; -export const firstClassModule: firstClassModule = {x:FirstClassModulesBS.firstClassModule[0], EmptyInnerModule:{}, InnerModule2:{k:FirstClassModulesBS.firstClassModule[2][0]}, InnerModule3:{k3:FirstClassModulesBS.firstClassModule[3][0]}, Z:FirstClassModulesBS.firstClassModule[4], y:FirstClassModulesBS.firstClassModule[5]}; +export const firstClassModule: firstClassModule = FirstClassModulesBS.firstClassModule; export const testConvert: (_1:{ readonly x: number; @@ -52,10 +52,7 @@ export const testConvert: (_1:{ }; readonly Z: unknown; readonly y: string -} = function (Arg1: any) { - const result = FirstClassModulesBS.testConvert([Arg1.x, [], [Arg1.InnerModule2.k], [Arg1.InnerModule3.k3], Arg1.Z, Arg1.y]); - return {x:result[0], EmptyInnerModule:{}, InnerModule2:{k:result[2][0]}, InnerModule3:{k3:result[3][0]}, Z:result[4], y:result[5]} -}; +} = FirstClassModulesBS.testConvert; export const someFunctorAsFunction: (_1:{ readonly x: number; @@ -69,7 +66,4 @@ export const someFunctorAsFunction: (_1:{ }; readonly Z: unknown; readonly y: string -}) => { readonly ww: string } = function (Arg1: any) { - const result = FirstClassModulesBS.someFunctorAsFunction([Arg1.x, [], [Arg1.InnerModule2.k], [Arg1.InnerModule3.k3], Arg1.Z, Arg1.y]); - return {ww:result[0]} -}; +}) => { readonly ww: string } = FirstClassModulesBS.someFunctorAsFunction; diff --git a/examples/typescript-react-example/src/FirstClassModulesInterface.bs.js b/examples/typescript-react-example/src/FirstClassModulesInterface.bs.js index aebac5921..de47cc594 100644 --- a/examples/typescript-react-example/src/FirstClassModulesInterface.bs.js +++ b/examples/typescript-react-example/src/FirstClassModulesInterface.bs.js @@ -1,4 +1,4 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE var r = /* record */[ diff --git a/examples/typescript-react-example/src/Hooks.bs.js b/examples/typescript-react-example/src/Hooks.bs.js index 54d0b7471..bc0d716ae 100644 --- a/examples/typescript-react-example/src/Hooks.bs.js +++ b/examples/typescript-react-example/src/Hooks.bs.js @@ -1,4 +1,4 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE import * as Curry from "bs-platform/lib/es6/curry.js"; import * as React from "react"; @@ -66,22 +66,24 @@ function Hooks$Inner$Inner2$anotherComponent(Props) { return React.createElement("div", undefined, "Another Hook " + vehicle[/* name */0]); } -var Inner2 = /* module */[ - /* make */Hooks$Inner$Inner2, - /* anotherComponent */Hooks$Inner$Inner2$anotherComponent -]; +var Inner2 = { + make: Hooks$Inner$Inner2, + anotherComponent: Hooks$Inner$Inner2$anotherComponent +}; -var Inner = /* module */[ - /* make */Hooks$Inner, - /* anotherComponent */Hooks$Inner$anotherComponent, - /* Inner2 */Inner2 -]; +var Inner = { + make: Hooks$Inner, + anotherComponent: Hooks$Inner$anotherComponent, + Inner2: Inner2 +}; function Hooks$NoProps(Props) { return React.createElement("div", undefined, null); } -var NoProps = /* module */[/* make */Hooks$NoProps]; +var NoProps = { + make: Hooks$NoProps +}; function functionWithRenamedArgs(_to, _Type, cb) { Curry._1(cb, _to); @@ -135,7 +137,9 @@ function Hooks$RenderPropRequiresConversion(Props) { }); } -var RenderPropRequiresConversion = /* module */[/* make */Hooks$RenderPropRequiresConversion]; +var RenderPropRequiresConversion = { + make: Hooks$RenderPropRequiresConversion +}; function Hooks$aComponentWithChildren(Props) { var vehicle = Props.vehicle; diff --git a/examples/typescript-react-example/src/Hooks.gen.tsx b/examples/typescript-react-example/src/Hooks.gen.tsx index 8620d174e..6eaab57ad 100644 --- a/examples/typescript-react-example/src/Hooks.gen.tsx +++ b/examples/typescript-react-example/src/Hooks.gen.tsx @@ -53,7 +53,7 @@ export type Inner_make_Props = { readonly vehicle: vehicle }; export const Inner_make: React.ComponentType<{ readonly vehicle: vehicle }> = function Hooks_Inner(Arg1: any) { const $props = {vehicle:[Arg1.vehicle.name]}; - const result = React.createElement(HooksBS.Inner[0], $props); + const result = React.createElement(HooksBS.Inner.make, $props); return result }; @@ -62,7 +62,7 @@ export type Inner_anotherComponent_Props = { readonly vehicle: vehicle }; export const Inner_anotherComponent: React.ComponentType<{ readonly vehicle: vehicle }> = function Hooks_Inner_anotherComponent(Arg1: any) { const $props = {vehicle:[Arg1.vehicle.name]}; - const result = React.createElement(HooksBS.Inner[1], $props); + const result = React.createElement(HooksBS.Inner.anotherComponent, $props); return result }; @@ -71,7 +71,7 @@ export type Inner_Inner2_make_Props = { readonly vehicle: vehicle }; export const Inner_Inner2_make: React.ComponentType<{ readonly vehicle: vehicle }> = function Hooks_Inner_Inner2(Arg1: any) { const $props = {vehicle:[Arg1.vehicle.name]}; - const result = React.createElement(HooksBS.Inner[2][0], $props); + const result = React.createElement(HooksBS.Inner.Inner2.make, $props); return result }; @@ -80,14 +80,14 @@ export type Inner_Inner2_anotherComponent_Props = { readonly vehicle: vehicle }; export const Inner_Inner2_anotherComponent: React.ComponentType<{ readonly vehicle: vehicle }> = function Hooks_Inner_Inner2_anotherComponent(Arg1: any) { const $props = {vehicle:[Arg1.vehicle.name]}; - const result = React.createElement(HooksBS.Inner[2][1], $props); + const result = React.createElement(HooksBS.Inner.Inner2.anotherComponent, $props); return result }; // tslint:disable-next-line:interface-over-type-literal export type NoProps_make_Props = {}; -export const NoProps_make: React.ComponentType<{}> = HooksBS.NoProps[0]; +export const NoProps_make: React.ComponentType<{}> = HooksBS.NoProps.make; export const functionWithRenamedArgs: (_1:{ readonly to: vehicle; @@ -167,7 +167,7 @@ export const RenderPropRequiresConversion_make: React.ComponentType<{ readonly r const result1 = React.createElement(Arg1.renderVehicle, $props); return result1 }}; - const result = React.createElement(HooksBS.RenderPropRequiresConversion[0], $props1); + const result = React.createElement(HooksBS.RenderPropRequiresConversion.make, $props1); return result }; @@ -180,7 +180,7 @@ export const aComponentWithChildren: React.ComponentType<{ readonly children: Re return result }; -export const NoProps: { make: React.ComponentType<{}> } = { make: NoProps_make } +export const NoProps: { make: React.ComponentType<{}> } = HooksBS.NoProps export const Inner: { Inner2: { @@ -197,13 +197,6 @@ export const Inner: { make: React.ComponentType<{ readonly vehicle: vehicle }> -} = { - Inner2: { - anotherComponent: Inner_Inner2_anotherComponent, - make: Inner_Inner2_make - }, - anotherComponent: Inner_anotherComponent, - make: Inner_make -} - -export const RenderPropRequiresConversion: { make: React.ComponentType<{ readonly renderVehicle: React.ComponentType<{ readonly number: number; readonly vehicle: vehicle }> }> } = { make: RenderPropRequiresConversion_make } +} = HooksBS.Inner + +export const RenderPropRequiresConversion: { make: React.ComponentType<{ readonly renderVehicle: React.ComponentType<{ readonly number: number; readonly vehicle: vehicle }> }> } = HooksBS.RenderPropRequiresConversion diff --git a/examples/typescript-react-example/src/IgnoreInterface.bs.js b/examples/typescript-react-example/src/IgnoreInterface.bs.js index dfe965a00..40fed0f7b 100644 --- a/examples/typescript-react-example/src/IgnoreInterface.bs.js +++ b/examples/typescript-react-example/src/IgnoreInterface.bs.js @@ -1,2 +1,2 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE /* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */ diff --git a/examples/typescript-react-example/src/ImmutableArray.bs.js b/examples/typescript-react-example/src/ImmutableArray.bs.js index b887d405c..bb2e7f087 100644 --- a/examples/typescript-react-example/src/ImmutableArray.bs.js +++ b/examples/typescript-react-example/src/ImmutableArray.bs.js @@ -1,4 +1,4 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE import * as Belt_Array from "bs-platform/lib/es6/belt_Array.js"; @@ -140,7 +140,9 @@ var eqU = Belt_Array.eqU; var eq = Belt_Array.eq; -var $$Array$1 = [get]; +var $$Array$1 = { + get: get +}; export { $$Array$1 as $$Array, diff --git a/examples/typescript-react-example/src/ImportHookDefault.bs.js b/examples/typescript-react-example/src/ImportHookDefault.bs.js index 77c389b4d..b2cbe54f8 100644 --- a/examples/typescript-react-example/src/ImportHookDefault.bs.js +++ b/examples/typescript-react-example/src/ImportHookDefault.bs.js @@ -1,4 +1,4 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE import * as ImportHookDefaultGen from "./ImportHookDefault.gen"; diff --git a/examples/typescript-react-example/src/ImportHooks.bs.js b/examples/typescript-react-example/src/ImportHooks.bs.js index 8ef07a78d..eb49e2f6e 100644 --- a/examples/typescript-react-example/src/ImportHooks.bs.js +++ b/examples/typescript-react-example/src/ImportHooks.bs.js @@ -1,4 +1,4 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE import * as ImportHooksGen from "./ImportHooks.gen"; diff --git a/examples/typescript-react-example/src/ImportJsValue.bs.js b/examples/typescript-react-example/src/ImportJsValue.bs.js index ee200cbd9..c1b3cb699 100644 --- a/examples/typescript-react-example/src/ImportJsValue.bs.js +++ b/examples/typescript-react-example/src/ImportJsValue.bs.js @@ -1,4 +1,4 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE import * as ImportJsValueGen from "./ImportJsValue.gen"; @@ -21,7 +21,9 @@ function getAbs(x) { return x.getAbs(); } -var AbsoluteValue = /* module */[/* getAbs */getAbs]; +var AbsoluteValue = { + getAbs: getAbs +}; function useGetProp(x) { return x.getProp() + 1 | 0; diff --git a/examples/typescript-react-example/src/ImportMyBanner.bs.js b/examples/typescript-react-example/src/ImportMyBanner.bs.js index e39c734d6..f448c1bfe 100644 --- a/examples/typescript-react-example/src/ImportMyBanner.bs.js +++ b/examples/typescript-react-example/src/ImportMyBanner.bs.js @@ -1,4 +1,4 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE import * as Caml_option from "bs-platform/lib/es6/caml_option.js"; import * as ImportMyBannerGen from "./ImportMyBanner.gen"; diff --git a/examples/typescript-react-example/src/ModuleAliases.bs.js b/examples/typescript-react-example/src/ModuleAliases.bs.js index 1ab2a22de..62273d7ec 100644 --- a/examples/typescript-react-example/src/ModuleAliases.bs.js +++ b/examples/typescript-react-example/src/ModuleAliases.bs.js @@ -1,21 +1,23 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE -var Inner = /* module */[]; +var Inner = { }; -var Outer = /* module */[/* Inner */Inner]; +var Outer = { + Inner: Inner +}; -var InnerNested = /* module */[]; +var InnerNested = { }; -var Inner2 = /* module */[ - /* InnerNested */InnerNested, - /* OuterInnerAlias2 */0 -]; +var Inner2 = { + InnerNested: InnerNested, + OuterInnerAlias2: 0 +}; -var Outer2 = /* module */[ - /* OuterInnerAlias */0, - /* Inner2 */Inner2 -]; +var Outer2 = { + OuterInnerAlias: 0, + Inner2: Inner2 +}; function testNested(x) { return x; diff --git a/examples/typescript-react-example/src/ModuleAliases2.bs.js b/examples/typescript-react-example/src/ModuleAliases2.bs.js index 95d4502d0..4de172573 100644 --- a/examples/typescript-react-example/src/ModuleAliases2.bs.js +++ b/examples/typescript-react-example/src/ModuleAliases2.bs.js @@ -1,9 +1,11 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE -var Inner = /* module */[]; +var Inner = { }; -var Outer = /* module */[/* Inner */Inner]; +var Outer = { + Inner: Inner +}; var OuterAlias = 0; diff --git a/examples/typescript-react-example/src/NestedModules.bs.js b/examples/typescript-react-example/src/NestedModules.bs.js index 154b22ec8..ce234fd10 100644 --- a/examples/typescript-react-example/src/NestedModules.bs.js +++ b/examples/typescript-react-example/src/NestedModules.bs.js @@ -1,37 +1,37 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE function nested3Function(x) { return x; } -var Nested3 = /* module */[ - /* x */0, - /* y */1, - /* z */2, - /* w */3, - /* nested3Value */"nested3Value", - /* nested3Function */nested3Function -]; +var Nested3 = { + x: 0, + y: 1, + z: 2, + w: 3, + nested3Value: "nested3Value", + nested3Function: nested3Function +}; function nested2Function(x) { return x; } -var Nested2 = /* module */[ - /* x */0, - /* nested2Value */1, - /* y */2, - /* Nested3 */Nested3, - /* nested2Function */nested2Function -]; - -var Universe = /* module */[ - /* theAnswer */42, - /* notExported */33, - /* Nested2 */Nested2, - /* someString */"some exported string" -]; +var Nested2 = { + x: 0, + nested2Value: 1, + y: 2, + Nested3: Nested3, + nested2Function: nested2Function +}; + +var Universe = { + theAnswer: 42, + notExported: 33, + Nested2: Nested2, + someString: "some exported string" +}; var notNested = 1; diff --git a/examples/typescript-react-example/src/NestedModules.gen.tsx b/examples/typescript-react-example/src/NestedModules.gen.tsx index 6648158de..9b0ffcc23 100644 --- a/examples/typescript-react-example/src/NestedModules.gen.tsx +++ b/examples/typescript-react-example/src/NestedModules.gen.tsx @@ -19,17 +19,17 @@ export type Universe_variant = "A" | { tag: "B"; value: string }; export const notNested: number = NestedModulesBS.notNested; -export const Universe_theAnswer: number = NestedModulesBS.Universe[0]; +export const Universe_theAnswer: number = NestedModulesBS.Universe.theAnswer; -export const Universe_Nested2_nested2Value: number = NestedModulesBS.Universe[2][1]; +export const Universe_Nested2_nested2Value: number = NestedModulesBS.Universe.Nested2.nested2Value; -export const Universe_Nested2_Nested3_nested3Value: string = NestedModulesBS.Universe[2][3][4]; +export const Universe_Nested2_Nested3_nested3Value: string = NestedModulesBS.Universe.Nested2.Nested3.nested3Value; -export const Universe_Nested2_Nested3_nested3Function: (_1:Universe_Nested2_nested2Type) => Universe_Nested2_nested2Type = NestedModulesBS.Universe[2][3][5]; +export const Universe_Nested2_Nested3_nested3Function: (_1:Universe_Nested2_nested2Type) => Universe_Nested2_nested2Type = NestedModulesBS.Universe.Nested2.Nested3.nested3Function; -export const Universe_Nested2_nested2Function: (_1:Universe_Nested2_Nested3_nested3Type) => Universe_Nested2_Nested3_nested3Type = NestedModulesBS.Universe[2][4]; +export const Universe_Nested2_nested2Function: (_1:Universe_Nested2_Nested3_nested3Type) => Universe_Nested2_Nested3_nested3Type = NestedModulesBS.Universe.Nested2.nested2Function; -export const Universe_someString: string = NestedModulesBS.Universe[3]; +export const Universe_someString: string = NestedModulesBS.Universe.someString; export const Universe: { theAnswer: number; @@ -42,15 +42,4 @@ export const Universe: { } }; someString: string -} = { - theAnswer: Universe_theAnswer, - Nested2: { - nested2Function: Universe_Nested2_nested2Function, - nested2Value: Universe_Nested2_nested2Value, - Nested3: { - nested3Value: Universe_Nested2_Nested3_nested3Value, - nested3Function: Universe_Nested2_Nested3_nested3Function - } - }, - someString: Universe_someString -} +} = NestedModulesBS.Universe diff --git a/examples/typescript-react-example/src/NestedModulesInSignature.bs.js b/examples/typescript-react-example/src/NestedModulesInSignature.bs.js index c29d653f7..d7e249e90 100644 --- a/examples/typescript-react-example/src/NestedModulesInSignature.bs.js +++ b/examples/typescript-react-example/src/NestedModulesInSignature.bs.js @@ -1,7 +1,9 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE -var Universe = /* module */[/* theAnswer */42]; +var Universe = { + theAnswer: 42 +}; export { Universe , diff --git a/examples/typescript-react-example/src/NestedModulesInSignature.gen.tsx b/examples/typescript-react-example/src/NestedModulesInSignature.gen.tsx index adc960c42..6abca7fc1 100644 --- a/examples/typescript-react-example/src/NestedModulesInSignature.gen.tsx +++ b/examples/typescript-react-example/src/NestedModulesInSignature.gen.tsx @@ -5,6 +5,6 @@ // tslint:disable-next-line:no-var-requires const NestedModulesInSignatureBS = require('./NestedModulesInSignature.bs'); -export const Universe_theAnswer: number = NestedModulesInSignatureBS.Universe[0]; +export const Universe_theAnswer: number = NestedModulesInSignatureBS.Universe.theAnswer; -export const Universe: { theAnswer: number } = { theAnswer: Universe_theAnswer } +export const Universe: { theAnswer: number } = NestedModulesInSignatureBS.Universe diff --git a/examples/typescript-react-example/src/Opaque.bs.js b/examples/typescript-react-example/src/Opaque.bs.js index 14770c953..9a2017689 100644 --- a/examples/typescript-react-example/src/Opaque.bs.js +++ b/examples/typescript-react-example/src/Opaque.bs.js @@ -1,4 +1,4 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE function noConversion(x) { diff --git a/examples/typescript-react-example/src/ReasonComponent.bs.js b/examples/typescript-react-example/src/ReasonComponent.bs.js index 9a7fb9028..f1b6ce040 100644 --- a/examples/typescript-react-example/src/ReasonComponent.bs.js +++ b/examples/typescript-react-example/src/ReasonComponent.bs.js @@ -1,4 +1,4 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE import * as List from "bs-platform/lib/es6/list.js"; import * as React from "react"; diff --git a/examples/typescript-react-example/src/Records.bs.js b/examples/typescript-react-example/src/Records.bs.js index 509d8c0c1..a6b7e2df8 100644 --- a/examples/typescript-react-example/src/Records.bs.js +++ b/examples/typescript-react-example/src/Records.bs.js @@ -1,4 +1,4 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE import * as Belt_List from "bs-platform/lib/es6/belt_List.js"; import * as Belt_Array from "bs-platform/lib/es6/belt_Array.js"; diff --git a/examples/typescript-react-example/src/References.bs.js b/examples/typescript-react-example/src/References.bs.js index 0f27e582a..80b120acf 100644 --- a/examples/typescript-react-example/src/References.bs.js +++ b/examples/typescript-react-example/src/References.bs.js @@ -1,4 +1,4 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE function create(x) { @@ -27,11 +27,11 @@ function set(r, v) { return /* () */0; } -var R = /* module */[ - /* get */get, - /* make */make, - /* set */set -]; +var R = { + get: get, + make: make, + set: set +}; function destroysRefIdentity(x) { return x; diff --git a/examples/typescript-react-example/src/TestEmitInnerModules.bs.js b/examples/typescript-react-example/src/TestEmitInnerModules.bs.js index 009aaa677..0eb7e4694 100644 --- a/examples/typescript-react-example/src/TestEmitInnerModules.bs.js +++ b/examples/typescript-react-example/src/TestEmitInnerModules.bs.js @@ -1,16 +1,22 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE -var Inner = /* module */[ - /* x */34, - /* y */"hello" -]; +var Inner = { + x: 34, + y: "hello" +}; -var Inner$1 = /* module */[/* y */44]; +var Inner$1 = { + y: 44 +}; -var Medium = /* module */[/* Inner */Inner$1]; +var Medium = { + Inner: Inner$1 +}; -var Outer = /* module */[/* Medium */Medium]; +var Outer = { + Medium: Medium +}; export { Inner , diff --git a/examples/typescript-react-example/src/TestEmitInnerModules.gen.tsx b/examples/typescript-react-example/src/TestEmitInnerModules.gen.tsx index 8e30fddd4..3622ea097 100644 --- a/examples/typescript-react-example/src/TestEmitInnerModules.gen.tsx +++ b/examples/typescript-react-example/src/TestEmitInnerModules.gen.tsx @@ -5,12 +5,12 @@ // tslint:disable-next-line:no-var-requires const TestEmitInnerModulesBS = require('./TestEmitInnerModules.bs'); -export const Inner_x: number = TestEmitInnerModulesBS.Inner[0]; +export const Inner_x: number = TestEmitInnerModulesBS.Inner.x; -export const Inner_y: string = TestEmitInnerModulesBS.Inner[1]; +export const Inner_y: string = TestEmitInnerModulesBS.Inner.y; -export const Outer_Medium_Inner_y: number = TestEmitInnerModulesBS.Outer[0][0][0]; +export const Outer_Medium_Inner_y: number = TestEmitInnerModulesBS.Outer.Medium.Inner.y; -export const Inner: { x: number; y: string } = { x: Inner_x, y: Inner_y } +export const Inner: { x: number; y: string } = TestEmitInnerModulesBS.Inner -export const Outer: { Medium: { Inner: { y: number } } } = { Medium: { Inner: { y: Outer_Medium_Inner_y } } } +export const Outer: { Medium: { Inner: { y: number } } } = TestEmitInnerModulesBS.Outer diff --git a/examples/typescript-react-example/src/TestFirstClassModules.bs.js b/examples/typescript-react-example/src/TestFirstClassModules.bs.js index 7f204bd48..e07d661f0 100644 --- a/examples/typescript-react-example/src/TestFirstClassModules.bs.js +++ b/examples/typescript-react-example/src/TestFirstClassModules.bs.js @@ -1,4 +1,4 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE function convert(x) { diff --git a/examples/typescript-react-example/src/TestFirstClassModules.gen.tsx b/examples/typescript-react-example/src/TestFirstClassModules.gen.tsx index 49875b4bb..3381c691a 100644 --- a/examples/typescript-react-example/src/TestFirstClassModules.gen.tsx +++ b/examples/typescript-react-example/src/TestFirstClassModules.gen.tsx @@ -14,22 +14,13 @@ import {record as FirstClassModulesInterface_record} from './FirstClassModulesIn // tslint:disable-next-line:interface-over-type-literal export type firstClassModuleWithTypeEquations = { readonly out: (_1:o) => o; readonly Inner: { readonly inn: (_1:i) => i } }; -export const convert: (_1:FirstClassModules_firstClassModule) => FirstClassModules_firstClassModule = function (Arg1: any) { - const result = TestFirstClassModulesBS.convert([Arg1.x, [], [Arg1.InnerModule2.k], [Arg1.InnerModule3.k3], Arg1.Z, Arg1.y]); - return {x:result[0], EmptyInnerModule:{}, InnerModule2:{k:result[2][0]}, InnerModule3:{k3:result[3][0]}, Z:result[4], y:result[5]} -}; +export const convert: (_1:FirstClassModules_firstClassModule) => FirstClassModules_firstClassModule = TestFirstClassModulesBS.convert; -export const convertInterface: (_1:FirstClassModulesInterface_firstClassModule) => FirstClassModulesInterface_firstClassModule = function (Arg1: any) { - const result = TestFirstClassModulesBS.convertInterface([Arg1.x]); - return {x:result[0]} -}; +export const convertInterface: (_1:FirstClassModulesInterface_firstClassModule) => FirstClassModulesInterface_firstClassModule = TestFirstClassModulesBS.convertInterface; export const convertRecord: (_1:FirstClassModulesInterface_record) => FirstClassModulesInterface_record = function (Arg1: any) { const result = TestFirstClassModulesBS.convertRecord([Arg1.x, Arg1.y]); return {x:result[0], y:result[1]} }; -export const convertFirstClassModuleWithTypeEquations: (_1:{ readonly out: ((_1:T1) => T1); readonly Inner: { readonly inn: ((_1:T2) => T2) } }) => { readonly out: (_1:T1) => T1; readonly Inner: { readonly inn: (_1:T2) => T2 } } = function (Arg1: any) { - const result = TestFirstClassModulesBS.convertFirstClassModuleWithTypeEquations([Arg1.out, [Arg1.Inner.inn]]); - return {out:result[0], Inner:{inn:result[1][0]}} -}; +export const convertFirstClassModuleWithTypeEquations: (_1:{ readonly out: ((_1:T1) => T1); readonly Inner: { readonly inn: ((_1:T2) => T2) } }) => { readonly out: (_1:T1) => T1; readonly Inner: { readonly inn: (_1:T2) => T2 } } = TestFirstClassModulesBS.convertFirstClassModuleWithTypeEquations; diff --git a/examples/typescript-react-example/src/TestImmutableArray.bs.js b/examples/typescript-react-example/src/TestImmutableArray.bs.js index 57c46d577..2647f4acb 100644 --- a/examples/typescript-react-example/src/TestImmutableArray.bs.js +++ b/examples/typescript-react-example/src/TestImmutableArray.bs.js @@ -1,10 +1,10 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE import * as Belt_Array from "bs-platform/lib/es6/belt_Array.js"; import * as ImmutableArray from "./ImmutableArray.bs.js"; function testImmutableArrayGet(arr) { - return ImmutableArray.$$Array[/* get */0](arr, 3); + return ImmutableArray.$$Array.get(arr, 3); } function testBeltArrayGet(arr) { diff --git a/examples/typescript-react-example/src/TestImport.bs.js b/examples/typescript-react-example/src/TestImport.bs.js index e9d82ee72..fb83655a9 100644 --- a/examples/typescript-react-example/src/TestImport.bs.js +++ b/examples/typescript-react-example/src/TestImport.bs.js @@ -1,4 +1,4 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE import * as Caml_option from "bs-platform/lib/es6/caml_option.js"; import * as TestImportGen from "./TestImport.gen"; diff --git a/examples/typescript-react-example/src/TestModuleAliases.bs.js b/examples/typescript-react-example/src/TestModuleAliases.bs.js index 1d845647d..db1ff7b1b 100644 --- a/examples/typescript-react-example/src/TestModuleAliases.bs.js +++ b/examples/typescript-react-example/src/TestModuleAliases.bs.js @@ -1,4 +1,4 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE function testInner1(x) { diff --git a/examples/typescript-react-example/src/TestPromise.bs.js b/examples/typescript-react-example/src/TestPromise.bs.js index 9a0a0d0ba..935c8ad95 100644 --- a/examples/typescript-react-example/src/TestPromise.bs.js +++ b/examples/typescript-react-example/src/TestPromise.bs.js @@ -1,4 +1,4 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE function convert(param) { diff --git a/examples/typescript-react-example/src/TransitiveType1.bs.js b/examples/typescript-react-example/src/TransitiveType1.bs.js index 2c8c003cb..238a0d51c 100644 --- a/examples/typescript-react-example/src/TransitiveType1.bs.js +++ b/examples/typescript-react-example/src/TransitiveType1.bs.js @@ -1,4 +1,4 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE function convert(x) { diff --git a/examples/typescript-react-example/src/TransitiveType2.bs.js b/examples/typescript-react-example/src/TransitiveType2.bs.js index 9a5349c03..a7839dd49 100644 --- a/examples/typescript-react-example/src/TransitiveType2.bs.js +++ b/examples/typescript-react-example/src/TransitiveType2.bs.js @@ -1,4 +1,4 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE function convertT2(x) { diff --git a/examples/typescript-react-example/src/TransitiveType3.bs.js b/examples/typescript-react-example/src/TransitiveType3.bs.js index a62d34982..636147b1f 100644 --- a/examples/typescript-react-example/src/TransitiveType3.bs.js +++ b/examples/typescript-react-example/src/TransitiveType3.bs.js @@ -1,4 +1,4 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE function convertT3(x) { diff --git a/examples/typescript-react-example/src/TypeParams1.bs.js b/examples/typescript-react-example/src/TypeParams1.bs.js index 039f9dc0e..36ff00a7c 100644 --- a/examples/typescript-react-example/src/TypeParams1.bs.js +++ b/examples/typescript-react-example/src/TypeParams1.bs.js @@ -1,4 +1,4 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE var exportSomething = 10; diff --git a/examples/typescript-react-example/src/TypeParams2.bs.js b/examples/typescript-react-example/src/TypeParams2.bs.js index 039f9dc0e..36ff00a7c 100644 --- a/examples/typescript-react-example/src/TypeParams2.bs.js +++ b/examples/typescript-react-example/src/TypeParams2.bs.js @@ -1,4 +1,4 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE var exportSomething = 10; diff --git a/examples/typescript-react-example/src/TypeParams3.bs.js b/examples/typescript-react-example/src/TypeParams3.bs.js index dd0f8680b..1ae7ced27 100644 --- a/examples/typescript-react-example/src/TypeParams3.bs.js +++ b/examples/typescript-react-example/src/TypeParams3.bs.js @@ -1,4 +1,4 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE function test(x) { diff --git a/examples/typescript-react-example/src/Uncurried.bs.js b/examples/typescript-react-example/src/Uncurried.bs.js index ecbcd8967..aef57cd6b 100644 --- a/examples/typescript-react-example/src/Uncurried.bs.js +++ b/examples/typescript-react-example/src/Uncurried.bs.js @@ -1,4 +1,4 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE import * as Curry from "bs-platform/lib/es6/curry.js"; diff --git a/examples/typescript-react-example/src/UseImportJsValue.bs.js b/examples/typescript-react-example/src/UseImportJsValue.bs.js index 036bed4a7..ad8d5fd4a 100644 --- a/examples/typescript-react-example/src/UseImportJsValue.bs.js +++ b/examples/typescript-react-example/src/UseImportJsValue.bs.js @@ -1,4 +1,4 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE function useGetProp(x) { diff --git a/examples/typescript-react-example/src/Variants.bs.js b/examples/typescript-react-example/src/Variants.bs.js index 39c0f7925..f1ddf032b 100644 --- a/examples/typescript-react-example/src/Variants.bs.js +++ b/examples/typescript-react-example/src/Variants.bs.js @@ -1,4 +1,4 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE function isWeekend(x) { diff --git a/examples/typescript-react-example/src/VariantsWithPayload.bs.js b/examples/typescript-react-example/src/VariantsWithPayload.bs.js index 1878f4bf8..c96a52687 100644 --- a/examples/typescript-react-example/src/VariantsWithPayload.bs.js +++ b/examples/typescript-react-example/src/VariantsWithPayload.bs.js @@ -1,4 +1,4 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE function testWithPayload(x) { @@ -70,17 +70,17 @@ function printVariantWithPayloads(x) { return /* () */0; } else { switch (x.tag | 0) { - case 0 : + case /* B */0 : console.log("printVariantWithPayloads", "B(" + (String(x[0]) + ")")); return /* () */0; - case 1 : + case /* C */1 : console.log("printVariantWithPayloads", "C(" + (String(x[0]) + (", " + (String(x[1]) + ")")))); return /* () */0; - case 2 : + case /* D */2 : var match = x[0]; console.log("printVariantWithPayloads", "D((" + (String(match[0]) + (", " + (String(match[1]) + "))")))); return /* () */0; - case 3 : + case /* E */3 : console.log("printVariantWithPayloads", "E(" + (String(x[0]) + (", " + (x[1] + (", " + (String(x[2]) + ")")))))); return /* () */0; diff --git a/examples/typescript-react-example/src/components/ComponentAsProp.bs.js b/examples/typescript-react-example/src/components/ComponentAsProp.bs.js index c658c26b1..989e061e8 100644 --- a/examples/typescript-react-example/src/components/ComponentAsProp.bs.js +++ b/examples/typescript-react-example/src/components/ComponentAsProp.bs.js @@ -1,4 +1,4 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE import * as React from "react"; import * as Caml_option from "bs-platform/lib/es6/caml_option.js"; diff --git a/examples/typescript-react-example/src/components/ManyComponents.bs.js b/examples/typescript-react-example/src/components/ManyComponents.bs.js index 96a101ea0..02fb8aecb 100644 --- a/examples/typescript-react-example/src/components/ManyComponents.bs.js +++ b/examples/typescript-react-example/src/components/ManyComponents.bs.js @@ -1,4 +1,4 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE import * as React from "react"; import * as ReasonReact from "reason-react/src/ReasonReact.js"; @@ -26,11 +26,11 @@ function make(_children) { ]; } -var InnerComponent = /* module */[ - /* someValueSoModuleOffsetsAreShifted */77, - /* component */component, - /* make */make -]; +var InnerComponent = { + someValueSoModuleOffsetsAreShifted: 77, + component: component, + make: make +}; var component$1 = ReasonReact.statelessComponent("ManyProps"); @@ -55,10 +55,10 @@ function make$1(param, param$1, param$2, param$3, param$4, param$5, param$6, par ]; } -var ManyProps = /* module */[ - /* component */component$1, - /* make */make$1 -]; +var ManyProps = { + component: component$1, + make: make$1 +}; var component$2 = ReasonReact.statelessComponent("ManyComponents"); diff --git a/examples/typescript-react-example/src/components/ManyComponents.gen.tsx b/examples/typescript-react-example/src/components/ManyComponents.gen.tsx index 86e6794f7..ae95f647a 100644 --- a/examples/typescript-react-example/src/components/ManyComponents.gen.tsx +++ b/examples/typescript-react-example/src/components/ManyComponents.gen.tsx @@ -15,9 +15,9 @@ const ReasonReact = require('reason-react/src/ReasonReact.js'); export type InnerComponent_Props = { readonly children?: unknown }; export const InnerComponent: React.ComponentType = ReasonReact.wrapReasonForJs( - ManyComponentsBS.InnerComponent[1], + ManyComponentsBS.InnerComponent.component, (function _(jsProps: InnerComponent_Props) { - return ManyComponentsBS.InnerComponent[2](jsProps.children); + return ManyComponentsBS.InnerComponent.make(jsProps.children); })); // tslint:disable-next-line:interface-over-type-literal @@ -34,9 +34,9 @@ export type ManyProps_Props = { }; export const ManyProps: React.ComponentType = ReasonReact.wrapReasonForJs( - ManyComponentsBS.ManyProps[0], + ManyComponentsBS.ManyProps.component, (function _(jsProps: ManyProps_Props) { - return Curry.app(ManyComponentsBS.ManyProps[1], [jsProps.a, jsProps.b, jsProps.c, jsProps.d, jsProps.e, jsProps.f, jsProps.g, jsProps.h, jsProps.children]); + return Curry.app(ManyComponentsBS.ManyProps.make, [jsProps.a, jsProps.b, jsProps.c, jsProps.d, jsProps.e, jsProps.f, jsProps.g, jsProps.h, jsProps.children]); })); // tslint:disable-next-line:interface-over-type-literal diff --git a/examples/typescript-react-example/src/location/location.bs.js b/examples/typescript-react-example/src/location/location.bs.js index e572bcefb..90dbcd887 100644 --- a/examples/typescript-react-example/src/location/location.bs.js +++ b/examples/typescript-react-example/src/location/location.bs.js @@ -1,4 +1,4 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE var x = 42; diff --git a/examples/typescript-react-example/src/nested/Tuples.bs.js b/examples/typescript-react-example/src/nested/Tuples.bs.js index 102f9076f..639127aa3 100644 --- a/examples/typescript-react-example/src/nested/Tuples.bs.js +++ b/examples/typescript-react-example/src/nested/Tuples.bs.js @@ -1,4 +1,4 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE import * as Caml_int32 from "bs-platform/lib/es6/caml_int32.js"; import * as Belt_Option from "bs-platform/lib/es6/belt_Option.js"; diff --git a/examples/typescript-react-example/src/nested/Types.bs.js b/examples/typescript-react-example/src/nested/Types.bs.js index 5f5a5dbf9..fa9a0aabb 100644 --- a/examples/typescript-react-example/src/nested/Types.bs.js +++ b/examples/typescript-react-example/src/nested/Types.bs.js @@ -1,4 +1,4 @@ -// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE +// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE import * as List from "bs-platform/lib/es6/list.js"; import * as Curry from "bs-platform/lib/es6/curry.js"; From bc0252305421c7395dd2629e323ce946fb9ccdda Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Mon, 23 Sep 2019 17:14:12 +0200 Subject: [PATCH 2/5] Stdio on CI. --- scripts/run_integration_tests.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/run_integration_tests.js b/scripts/run_integration_tests.js index f1de6780b..e8b43ae5c 100644 --- a/scripts/run_integration_tests.js +++ b/scripts/run_integration_tests.js @@ -85,11 +85,13 @@ function cleanBuildExamples() { const shell = isWindows ? true : false; child_process.execFileSync("npm", ["run", "clean"], { cwd, - shell + shell, + stdio: [0,1,2] }); child_process.execFileSync("npm", ["run", "build"], { cwd, - shell + shell, + stdio: [0,1,2] }); } } From df6141d170a364eaa7d60c1d363cc9cfcffa8456 Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Mon, 23 Sep 2019 17:29:56 +0200 Subject: [PATCH 3/5] Change the way : is parset on the command-line. --- src/GenType.re | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/GenType.re b/src/GenType.re index 06e7eed7d..55f783b79 100644 --- a/src/GenType.re +++ b/src/GenType.re @@ -68,10 +68,14 @@ let cli = () => { let executeCliCommand = (~bsVersion, cliCommand) => switch (cliCommand) { | Add(s) => - let splitColon = Str.split(Str.regexp(":"), s) |> Array.of_list; - assert(Array.length(splitColon) === 2); - let cmt: string = splitColon[0]; - let mlast: string = splitColon[1]; + let splitColon = Str.split(Str.regexp(":"), s); + let (cmt, mlast) = + switch (splitColon) { + | [cmt, ...rest] => + let mlast = rest |> String.concat(""); + (cmt, mlast); + | _ => assert(false) + }; let config = Paths.readConfig(~bsVersion, ~namespace=cmt |> Paths.findNameSpace); if (Debug.basic^) { From 2ffef7bb484c63292711fbf1ee983d321e99c618 Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Mon, 23 Sep 2019 17:36:43 +0200 Subject: [PATCH 4/5] Remove -verbose. --- examples/typescript-react-example/bsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/typescript-react-example/bsconfig.json b/examples/typescript-react-example/bsconfig.json index 73e6fd479..b736acc64 100644 --- a/examples/typescript-react-example/bsconfig.json +++ b/examples/typescript-react-example/bsconfig.json @@ -17,7 +17,7 @@ "path": "../../src/lib/bs/native/gentype.native.exe" }, "name": "sample-typescript-app", - "bsc-flags": ["-bs-super-errors -verbose"], + "bsc-flags": ["-bs-super-errors"], "reason": { "react-jsx": 3 }, "bs-dependencies": ["reason-react"], "sources": [ From 3ccc185ac7205d9f0f416cd89246a3fe203c19c5 Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Mon, 23 Sep 2019 17:37:54 +0200 Subject: [PATCH 5/5] Update Changes.md --- Changes.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Changes.md b/Changes.md index 1142f6800..319f98dd8 100644 --- a/Changes.md +++ b/Changes.md @@ -1,3 +1,7 @@ +# master +- Work around an issue in which bucklescript passes the file names to genType. + See https://github.com/cristianoc/genType/pull/256. + # 2.40.0 - Export inner modules as objects (when at least one value in the module is exported). See: https://github.com/cristianoc/genType/issues/253.