Registry / devops / bs-platform

bs-platform

JSON →
library9.0.2jsnpmunverified

ReScript (bs-platform) is a strongly typed language that compiles to efficient, readable JavaScript. This package provides the compiler, standard library (Stdlib, Belt), and build system (ninja-based). Current latest stable version is 12.2.0 (as of this entry), with v13 in alpha. Release cadence is roughly quarterly, with breaking changes in major versions. Key differentiators vs TypeScript: sound type system, no type errors at runtime, fast compilation, and seamless interop with JavaScript via special syntax and attributes. The package is primarily for tooling and compiler development; most users should use the `rescript` npm package or ReScript via the VSCode extension.

npm install bs-platform
INSTALL
IMPORT
SIG · BS-PLATFORM
B
bs-platform
devopsjavascriptv9.0.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Belt
✓ import Belt from 'rescript'
✗ const Belt = require('bs-platform').Belt
Since ReScript 9.0, the recommended way is via the 'rescript' package. The 'bs-platform' package is legacy and no longer updated for new ReScript versions.
Js
✓ open Js;
✗ import * as Js from 'bs-platform'
Js module is part of the standard library. Use `open Js;` in ReScript source files. For JavaScript consumers, the module is not exported as a package import.
Intl
✓ open Intl;
✗ import Intl from 'bs-platform'
Intl module is part of the standard library. Use `open Intl;` in ReScript source files. Breaking changes in v13: Intl.Collator.compare returns Ordering.t (float) instead of int.
rescript
✓ npm install rescript
✗ npm install bs-platform
bs-platform is the legacy package name. Since v9, the recommended package is 'rescript'. Install 'rescript' for new projects.

Create a minimal ReScript project, compile a simple script, and run the generated JavaScript.

// Create a new ReScript project mkdir my-project cd my-project npm init -y npm install rescript // Create rescript.json with minimal config cat > rescript.json << 'EOF' { "name": "my-project", "version": "0.1.0", "sources": { "dir": "src", "subdirs": true }, "package-specs": { "module": "commonjs", "in-source": true }, "suffix": ".bs.js", "bs-dependencies": [] } EOF mkdir src cat > src/Demo.res << 'EOF' let greeting = "Hello, ReScript!" let add = (a: int, b: int) => a + b let result = add(2, 3) Js.log(greeting) Js.log(result) EOF // Compile npx rescript build // Run the output (src/Demo.bs.js) node src/Demo.bs.js
Debug
Known issues
deprecatedThe 'bs-platform' package is deprecated. Use the 'rescript' package instead.
fix
Run 'npm install rescript' and update your imports and build config to use the 'rescript' package.
affects: >=9.0.0
breakingSince v13.0.0-alpha, 'bsconfig.json' is no longer supported. Use 'rescript.json'.
fix
Rename 'bsconfig.json' to 'rescript.json' and adjust the schema if needed.
affects: >=13.0.0-alpha
breakingSince v13.0.0-alpha, the legacy build system is removed. Only the modern build system is supported.
fix
Use 'npx rescript build' instead of 'npx rescript-legacy build'. Ensure your rescript.json is configured for the modern build system.
affects: >=13.0.0-alpha
breakingIn v13.0.0-alpha, 'Int.fromString' and 'Float.fromString' use stricter number parsing and no longer accept an explicit radix argument.
fix
Remove the radix argument from calls to Int.fromString and Float.fromString. Use parseInt for radix-based parsing.
affects: >=13.0.0-alpha
breakingIn v13.0.0-alpha, the deprecated '%external' extension has been removed.
fix
Replace '%external' with the appropriate ReScript binding syntax, e.g., using '@external' decorator.
affects: >=13.0.0-alpha
breakingIn v12.0.0, the build system changed fundamentally. The 'bsc' and 'bsb' commands are deprecated.
fix
Use 'npx rescript build' instead of 'bsc' or 'bsb'. Update your rescript.json to the new schema.
affects: >=12.0.0
Errors
Common errors & fixes
Fatal error: Parmatch.all_record_args
Pattern matching on empty dict/record patterns in older versions.
fix
Update to ReScript v12.2.0 or later. If you must stay on an older version, avoid matching empty dict/record patterns.
Cannot find module 'bs-platform'
Trying to require or import 'bs-platform' after it has been deprecated and possibly not installed.
fix
Install the 'rescript' package and use 'require('rescript')' or adjust your build pipeline to use the 'rescript' package instead.
exponential compilation blowup with large unboxed variants and dict pattern matching
A bug in ReScript v12.0.0 that caused exponential time/memory usage.
fix
Update to v12.0.1 or later where this is fixed. If you cannot update, refactor large unboxed variants.
Intl.Collator.compare: expected int, got float
Breaking change in v13.0.0-alpha: the return type changed from int to Ordering.t (float).
fix
Update your code to handle Ordering.t (float) or use the previous version if you depend on int.
Upgrade
Version history
9.0.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
8
Resources
bs-platform — npm install bs-platform · libregistry