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
Think of the `.cmi` file as a contract or a table of contents for your module. It describes what other modules can see and import from your module. It contains your type definitions and function signatures, but only the public ones.
124
124
125
-
Here's a concrete example:
125
+
Here's a concrete example with an explicit [interface file](/docs/manual/v12.0.0/module#signatures):
126
+
127
+
```rescript
128
+
// Button.resi
129
+
type size = Small | Medium | Large
130
+
let make: (~size: size, ~onClick: unit => unit) => Jsx.element
131
+
let defaultSize: size
132
+
```
126
133
127
134
```rescript
128
135
// Button.res
@@ -134,9 +141,10 @@ let make = (~size: size, ~onClick) => {
134
141
135
142
let defaultSize = Medium
136
143
137
-
%%private(let internalHelper = () => {
144
+
// Not in interface file - this is private
145
+
let internalHelper = () => {
138
146
// some internal logic
139
-
})
147
+
}
140
148
```
141
149
142
150
The `.cmi` file for this module will contain:
@@ -145,7 +153,7 @@ The `.cmi` file for this module will contain:
145
153
- The signature of `make`
146
154
- The type of `defaultSize`
147
155
148
-
But it won't contain `internalHelper` because it's marked as [`%%private`](https://rescript-lang.org/syntax-lookup#private-let), making it truly internal to the module.
156
+
But it won't contain `internalHelper` because it's not listed in the `.resi` file, making it truly internal to the module.
149
157
150
158
**This distinction is crucial for build performance.** If you change `internalHelper`, the `.cmi` file stays exactly the same because the public interface didn't change. But if you add a parameter to `make` or change the `size` type, the `.cmi` file changes because the public contract changed.
151
159
@@ -293,6 +301,34 @@ The build system was designed from the ground up with monorepos in mind. File wa
293
301
294
302
These aren't just nice-to-haves. For teams working with multiple packages, proper monorepo support means the build system finally works the way you'd expect.
295
303
304
+
## A Unified Developer Experience
305
+
306
+
Beyond the build performance improvements, ReScript 12 brings a completely redesigned command-line interface. The old toolchain was a collection of separate pieces: a JavaScript wrapper that called a build orchestrator (written in OCaml), which generated files for Ninja (written in C++), which finally invoked the compiler. Each layer had its own argument parsing, error handling, and conventions.
307
+
308
+
The new system consolidates everything into one cohesive tool with a consistent interface:
309
+
310
+
```bash
311
+
rescript # Defaults to build
312
+
rescript build # Explicit build
313
+
rescript watch # Build + watch mode
314
+
rescript clean # Clean artifacts
315
+
rescript format # Format code
316
+
```
317
+
318
+
### What This Means in Practice
319
+
320
+
**Smart defaults:** Running `rescript` without arguments does what you expect—it builds your project. No need to remember subcommands for the most common operation.
321
+
322
+
**Consistent experience:** All commands follow the same patterns, share the same help system, and use consistent flags. Gone are the days of wondering "which flags work with which command?"
323
+
324
+
**Better error messages:** Instead of cryptic multi-layer errors that could come from the JavaScript wrapper, the build system, Ninja, or the compiler, you now get clear, contextual error messages that tell you what went wrong and how to fix it.
325
+
326
+
**Reliable process handling:** Pressing Ctrl+C in watch mode always cleans up properly. No more zombie processes or stale lock files that require manual cleanup.
327
+
328
+
**Integrated formatting:** The formatter is now fully integrated into the main CLI. You can format your entire project, specific files, or use it in check mode for CI—all with parallel processing for speed.
329
+
330
+
The old toolchain was like carrying separate tools for different tasks. Each worked, but you had to remember which tool for which job, and they didn't always work well together. The new CLI is like a Swiss Army knife: one tool, everything you need, designed to work as a cohesive whole.
331
+
296
332
## What This Means for Your Workflow
297
333
298
334
The techniques described above work together to create a build system that feels fundamentally different in practice. The most common operations during development (refactoring internal logic, fixing bugs, tweaking implementations) typically result in sub-second rebuilds. Less common operations that truly do require cascade recompilations (API changes, type modifications) benefit from parallel compilation and better module resolution.
0 commit comments