Skip to content

Commit b437358

Browse files
jeffmoFacebook Github Bot 3
authored and
Facebook Github Bot 3
committed
flow-lib: JS interfaces for Flow APIs
Summary: This is a first-pass on an idea for an npm package, called `flow-lib`, that allows JS tooling consumers to interface easily with Flow APIs. Pending more experimentation, my hope is that this can become a stable way for JS tooling to integrate with Flow via a simple, well-versioned npm dependency. To start out I've added JS APIs for `flow check-contents`, `flow ast`, and Flow type definitions for the AST. I also intend to add `type-at-pos`-like APIs as well (all of the tooling needs I can imagine right now need this more than anything else) -- but before that I need to find a good way to represent types that isn't coupled too tightly with Flow implementation details. I'm still working on this and will update when I have something more here. **NOTE: This is only an RFC while I look into more concrete use cases. I am putting this out for discussion, but I don't necessarily expect to merge it until we see it prove useful or promising for some *specific* tooling needs** Closes facebook#1360 Reviewed By: samwgoldman Differential Revision: D3676384 Pulled By: jeffmo fbshipit-source-id: 96925ebcf12d0509fe49eaa1e17d7958edc20ada
1 parent 4ba70f4 commit b437358

File tree

9 files changed

+927
-0
lines changed

9 files changed

+927
-0
lines changed

npm-flow-lib/.babelrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"plugins": [
3+
"transform-flow-strip-types",
4+
"transform-regenerator",
5+
"syntax-async-functions",
6+
],
7+
"presets": ["es2015"]
8+
}

npm-flow-lib/.flowconfig

Whitespace-only changes.

npm-flow-lib/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
*.swp
3+
dist

npm-flow-lib/.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
src/

npm-flow-lib/package.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "flow-lib",
3+
"version": "0.0.0-pre",
4+
"main": "dist/index.js",
5+
"dependencies": {
6+
"babel-polyfill": "^6.13.0"
7+
},
8+
"devDependencies": {
9+
"babel-cli": "^6.11.4",
10+
"babel-plugin-syntax-async-functions": "^6.13.0",
11+
"babel-plugin-transform-flow-strip-types": "^6.8.0",
12+
"flow-bin": "^0.30.0"
13+
},
14+
"scripts": {
15+
"build": "mkdir -p dist; babel ./src --out-dir=./dist",
16+
"clean": "rm -rf dist",
17+
"flow": "flow; test $? -eq 0 -o $? -eq 2",
18+
"prepublish": "mkdir -p; npm run test",
19+
"test": "node dist/test_ast_types",
20+
"watch": "mkdir -p dist; babel --watch=./src --out-dir=./dist"
21+
}
22+
}

0 commit comments

Comments
 (0)