Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Simple, fast & type safe code that leverages the JavaScript & OCaml ecosystems
Go to https://github.com/reasonml/reasonml.github.io to contribute to the Reason documentation.
See the src folder's README.
If you're not using Reason programmatically, disregard this section and see the Getting Started guide above. This is for using Reason's refmt
as a third-party library.
We expose a refmt.js
for you to use on the web. Again, for local development, please use the native refmt
that comes with the installation here. It's an order of magnitude faster than the JS version. Don't use the JS version unless you know what you're doing. Let's keep our ecosystem fast please.
Aaaanyways, to install refmt.js
: npm install reason
. Here's the API:
parseRE(codeString)
: returns an AST + comments info that you'd use for printingparseREI(codeString)
: same, but for interfaceprintRE(astAndComments)
: receives the data structure returned by parseRE
and othersprintREI(astAndComments)
: same, but for interfaceparseML(codeString)
, parseMLI(codeString)
, printML(astAndComments)
, printMLI(astAndComments)
: the OCaml syntax counterparts.The parse*
functions potentially throw an error of this shape:
{
message: string,
// location can be undefined
location: {
// all 1-indexed
startLine: number, // inclusive
startLineStartChar: number, // inclusive
endLine: number, // inclusive
endLineEndChar: number, // **exclusive**
}
}
Example usage:
const refmt = require('refmt')
// convert the ocaml syntax to reason syntax
console.log(refmt.printRE(refmt.parseML('let f a = 1')))
refmt.js
is minified for you through Closure Compiler, with an accompanying refmt.map
. The size is 2.3MB but don't get fooled; it gzips down to just 345KB. This way, you can carry it around in your own blog and use it to create interactive refmt playground, without worrying about imposing bandwidth overhead to your readers. Again, keep our ecosystem fast and lean.
We're spoiled with more APIs on the native side. To use Reason from OPAM as a native library, you have these functions. So:
Reason_toolchain.RE.implementation_with_comments
Reason_toolchain.RE.interface_with_comments
Reason_toolchain.RE.print_interface_with_comments
Reason_toolchain.ML.implementation_with_comments
The RE
parsing functions might throw this (docs on Location.t
here). The ML
parsing functions might throw Syntaxerr.Error error
.
Example usage:
let ast_and_comments =
Lexing.from_string "let f a => 1"
|> Reason_toolchain.RE.implementation_with_comments
(* Convert Reason back to OCaml syntax. That'll show these Reason users! *)
let ocaml_syntax =
Reason_toolchain.ML.print_implementation_with_comments
Format.str_formatter
ast_and_comments;
Format.flush_str_formatter ()
See Reason license in LICENSE.txt.
Works that are forked from other projects are under their original licenses.
The general structure of refmt
repo was copied from whitequark's m17n project, including parts of the README
that instruct how to use this with the OPAM toolchain. Thank you OCaml!
3.0.0
Our biggest release! Please see our blog post on https://reasonml.github.io/blog/2017/10/27/reason3.html.
Summary: this is, practically speaking, a non-breaking change. You can mix and match two projects with different syntax versions in BuckleScript 2 (which just got release too! Go check), and they'll Just Work (tm).
To upgrade your own project, we've released a script, https://github.com/reasonml/upgradeSyntaxFrom2To3
Improvements:
==
, &&
, >
and the rest (1380, 1386, etc.).Js.t {. foo: bar}
now formats to {. "foo": bar}
, just like its value counterpart ([%bs.obj {foo: 1}]
to {"foo": bar}
.[@foo]
, [@@foo]
and [@@@foo]
are now unified into [@foo]
and placed in front instead of at the back.!
is now the logical negation. It was not
previously.!
. Now it's a postfix ^
.++
instead of the old ^
.{M.x, y}
is {M.x: x, y: y}
.{}
like in JS.==
, match
, method
).::foo
back to ~foo
, just like for OCaml.refmt.js
, with public API. See README.md
.refmt
native public API too.Breaking Changes:
--use-stdin
and --is-interface-pp
option from refmt; they've been deprecated for a long time nowreup
, etc.reactjs_jsx_ppx.ml
. You've all been on reactjs_jsx_ppx_2.ml
for a long time now.external
declaration's labels.Deprecated:
--add-printers
option from refmt; we'll have a better strategy soon.FAQs
Simple, fast & type safe code that leverages the JavaScript & OCaml ecosystems
The npm package reason receives a total of 409 weekly downloads. As such, reason popularity was classified as not popular.
We found that reason demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.