You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a function in one file and use it in another
ProduceAPI.res
letmeh= (a: int) => {
true
}
Consume.res
letb=ProduceAPI.meh(1);
After bunx rescript I get:
// Generated by ReScript, PLEASE EDIT WITH CAREimport*asProduceAPI$PkmnAPIfrom"./ProduceAPI.re.js";letb=ProduceAPI$PkmnAPI.meh(1);export{b,}/* b Not a pure module */
with bunx rewatch:
// Generated by ReScript, PLEASE EDIT WITH CAREimport*asProduceAPI$PkmnApifrom"./ProduceAPI.re.js";
letb=ProduceAPI$PkmnApi.meh(1);
export {
b,
}
/* b Not a pure module */
ProduceAPI$PkmnAPI (rescript) versus ProduceAPI$PkmnApi (rewatch)
The text was updated successfully, but these errors were encountered:
while bsb doesn't actually convert to Pascal case but use a custom algorithm:
letnamespace_of_package_name (s: string) : string =let len =String.length s inlet buf =Ext_buffer.create len inletaddcapitalch=Ext_buffer.add_char buf (if capital thenChar.uppercase_ascii ch else ch)
inletrec auxcapitalofflen=if off >= len then()elselet ch =String.unsafe_get s off inmatch ch with|'a' .. 'z'|'A' .. 'Z'|'0' .. '9'|'_' ->
add capital ch;
aux false (off +1) len
|'/'|'-' -> aux true (off +1) len
|_ -> aux capital (off +1) len
in
aux true0 len;
Ext_buffer.contents buf
IMO it's a bit unfortunate that all this mangling happens for namespace, but if we don't want to introduce a breaking change we should likely make rewatch implement the same algorithm.
In https://github.com/rescript-lang/experimental-rescript-webapi I noticed that
bunx rewatch
has slightly different output thanbunx rescript
.Steps to reproduce:
[email protected]
"namespace": "PkmnAPI",
torescript.json
ProduceAPI.res
Consume.res
After
bunx rescript
I get:with
bunx rewatch
:ProduceAPI$PkmnAPI
(rescript) versusProduceAPI$PkmnApi
(rewatch)The text was updated successfully, but these errors were encountered: