├── .envrc
├── .github
└── workflows
│ ├── ci.yml
│ └── scripts
│ ├── postinstall.js
│ ├── print-esy-cache.js
│ └── write-package-json.js
├── .gitignore
├── HISTORY.md
├── README.md
├── bin
├── Bin.re
└── dune
├── dune-project
├── dune-workspace
├── esy.json
├── esy.lock
├── .gitattributes
├── .gitignore
├── index.json
├── opam
│ ├── base-threads.base
│ │ └── opam
│ ├── base-unix.base
│ │ └── opam
│ ├── biniou.1.2.1
│ │ └── opam
│ ├── cppo.1.6.8
│ │ └── opam
│ ├── csexp.1.5.1
│ │ └── opam
│ ├── dot-merlin-reader.4.1
│ │ └── opam
│ ├── dune.2.9.2
│ │ └── opam
│ ├── easy-format.1.3.2
│ │ └── opam
│ ├── fix.20220121
│ │ └── opam
│ ├── menhir.20220210
│ │ └── opam
│ ├── menhirLib.20220210
│ │ └── opam
│ ├── menhirSdk.20220210
│ │ └── opam
│ ├── merlin-extend.0.6
│ │ └── opam
│ ├── merlin.4.4-412
│ │ └── opam
│ ├── ocaml-compiler-libs.v0.12.4
│ │ └── opam
│ ├── ocamlfind.1.9.3
│ │ └── opam
│ ├── ppx_derivers.1.2.1
│ │ └── opam
│ ├── ppxlib.0.24.0
│ │ └── opam
│ ├── reason.3.7.0
│ │ └── opam
│ ├── result.1.5
│ │ └── opam
│ ├── sexplib0.v0.14.0
│ │ └── opam
│ ├── stdlib-shims.0.3.0
│ │ └── opam
│ └── yojson.1.7.0
│ │ └── opam
└── overrides
│ └── opam__s__ocamlfind_opam__c__1.9.3_opam_override
│ ├── files
│ └── findlib.patch
│ └── package.json
├── examples
├── .babelrc
├── .envrc
├── bsconfig.json
├── package-lock.json
├── package.json
├── shell.nix
├── src
│ ├── App.res
│ ├── Color.res
│ ├── Font.res
│ ├── GlobalStyles.res
│ ├── Polished.res
│ ├── Screen.res
│ ├── Size.res
│ ├── index.html
│ └── index.res
└── webpack.config.js
├── linux.patch
├── package.json
├── ppx
├── Ppx.re
└── dune
├── release.sh
├── rescript-linaria-ppx.opam
└── shell.nix
/.envrc:
--------------------------------------------------------------------------------
1 | use_nix
2 |
--------------------------------------------------------------------------------
/.github/workflows/ci.yml:
--------------------------------------------------------------------------------
1 | name: CI
2 |
3 | on:
4 | pull_request:
5 | branches:
6 | - master
7 |
8 | jobs:
9 | build:
10 | name: Build on ${{ matrix.os }}
11 | runs-on: ${{ matrix.os }}
12 | strategy:
13 | matrix:
14 | node-version: [16.x]
15 | os: [macOS-latest, windows-latest]
16 |
17 | steps:
18 | - name: Checkout repo
19 | uses: actions/checkout@v2
20 |
21 | - name: Setup Node ${{ matrix.node-version }}
22 | uses: actions/setup-node@v1
23 | with:
24 | node-version: ${{ matrix.node-version }}
25 |
26 | - name: Install Esy
27 | run: npm install -g esy@0.6.12
28 |
29 | - name: Install Esy deps
30 | run: esy install
31 |
32 | - name: Print Esy cache
33 | id: print-esy-cache
34 | run: node .github/workflows/scripts/print-esy-cache.js
35 |
36 | - name: Restore Esy cache
37 | id: esy-cache
38 | uses: actions/cache@v1
39 | with:
40 | path: ${{ steps.print-esy-cache.outputs.esy-cache }}
41 | key: ${{ matrix.os }}-esy-${{ hashFiles('**/index.json') }}
42 |
43 | - name: Build ppx
44 | run: esy build
45 |
46 | - name: Upload artifacts
47 | uses: actions/upload-artifact@v1
48 | with:
49 | name: ${{ matrix.os }}
50 | path: _build/default/bin/bin.exe
51 |
52 | build_linux:
53 | name: Build on ${{ matrix.os }}
54 | runs-on: ${{ matrix.os }}
55 | strategy:
56 | matrix:
57 | os: [ubuntu-latest]
58 |
59 | container:
60 | image: alexfedoseev/alpine-node-yarn-esy:0.0.8
61 |
62 | steps:
63 | - name: Checkout repo
64 | uses: actions/checkout@v2
65 |
66 | - name: Apply static linking patch
67 | run: git apply linux.patch
68 |
69 | - name: Install Esy deps
70 | run: esy install
71 |
72 | - name: Print Esy cache
73 | id: print-esy-cache
74 | run: node .github/workflows/scripts/print-esy-cache.js
75 |
76 | - name: Restore Esy cache
77 | id: esy-cache
78 | uses: actions/cache@v1
79 | with:
80 | path: ${{ steps.print-esy-cache.outputs.esy-cache }}
81 | key: ${{ matrix.os }}-esy-${{ hashFiles('**/index.json') }}
82 |
83 | - name: Build ppx
84 | run: esy build
85 |
86 | - name: Upload artifacts
87 | uses: actions/upload-artifact@v1
88 | with:
89 | name: ${{ matrix.os }}
90 | path: _build/default/bin/bin.exe
91 |
92 | rc:
93 | needs:
94 | - build
95 | - build_linux
96 | name: Prepare RC
97 | runs-on: ubuntu-latest
98 |
99 | steps:
100 | - name: Checkout repo
101 | uses: actions/checkout@v2
102 |
103 | - name: Setup Node ${{ matrix.node-version }}
104 | uses: actions/setup-node@v1
105 | with:
106 | node-version: 12.x
107 |
108 | - name: Download Linux artifacts
109 | uses: actions/download-artifact@v1
110 | with:
111 | name: ubuntu-latest
112 | path: _bin/linux
113 |
114 | - name: Download macOS artifacts
115 | uses: actions/download-artifact@v1
116 | with:
117 | name: macOS-latest
118 | path: _bin/darwin
119 |
120 | - name: Download Windows artifacts
121 | uses: actions/download-artifact@v1
122 | with:
123 | name: windows-latest
124 | path: _bin/windows
125 |
126 | - name: Move artifacts
127 | run: |
128 | mkdir -p _release/bin
129 | mv _bin/darwin/bin.exe _release/bin/rescript-linaria-ppx-darwin-x64.exe
130 | mv _bin/windows/bin.exe _release/bin/rescript-linaria-ppx-win-x64.exe
131 | mv _bin/linux/bin.exe _release/bin/rescript-linaria-ppx-linux-x64.exe
132 | rm -rf _bin
133 |
134 | - name: Move lib files
135 | run: |
136 | mkdir -p _release/src
137 | cp README.md _release/README.md
138 | cp .github/workflows/scripts/postinstall.js _release/postinstall.js
139 | node .github/workflows/scripts/write-package-json.js
140 |
141 | - name: Upload release
142 | uses: actions/upload-artifact@v1
143 | with:
144 | name: release
145 | path: _release
146 |
--------------------------------------------------------------------------------
/.github/workflows/scripts/postinstall.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | const fs = require("fs");
4 |
5 | const PPX = "rescript-linaria-ppx";
6 |
7 | let arch = process.arch;
8 | let platform = process.platform;
9 |
10 | if (arch === "ia32") {
11 | arch = "x86";
12 | }
13 |
14 | if (platform === "win32") {
15 | platform = "win";
16 | }
17 |
18 | const filename = `bin/${PPX}-${platform}-${arch}.exe`;
19 |
20 | const supported = fs.existsSync(filename);
21 |
22 | if (!supported) {
23 | console.error(`${PPX} does not support this platform :(`);
24 | console.error("");
25 | console.error(`${PPX} comes prepacked as built binaries to avoid large`);
26 | console.error("dependencies at build-time.");
27 | console.error("");
28 | console.error(`If you want ${PPX} to support this platform natively,`);
29 | console.error("please open an issue at our repository, linked above. Please");
30 | console.error(`specify that you are on the ${platform} platform,`);
31 | console.error(`on the ${arch} architecture.`);
32 |
33 | }
34 |
35 | if (!fs.existsSync("ppx.exe")) {
36 | copyFileSync(filename, "ppx.exe");
37 | fs.chmodSync("ppx.exe", 0755);
38 | }
39 |
40 | if (!fs.existsSync("ppx")) {
41 | copyFileSync(filename, "ppx");
42 | fs.chmodSync("ppx", 0755);
43 | }
44 |
45 | function copyFileSync(source, dest) {
46 | if (typeof fs.copyFileSync === "function") {
47 | fs.copyFileSync(source, dest);
48 | } else {
49 | fs.writeFileSync(dest, fs.readFileSync(source));
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/.github/workflows/scripts/print-esy-cache.js:
--------------------------------------------------------------------------------
1 | const fs = require("fs");
2 | const os = require("os");
3 | const path = require("path");
4 |
5 | const ESY_FOLDER = process.env.ESY__PREFIX
6 | ? process.env.ESY__PREFIX
7 | : path.join(os.homedir(), ".esy");
8 |
9 | const esy3 = fs
10 | .readdirSync(ESY_FOLDER)
11 | .filter(name => name.length > 0 && name[0] === "3")
12 | .sort()
13 | .pop();
14 |
15 | console.log(`::set-output name=esy-cache::${path.join(ESY_FOLDER, esy3, "i")}`);
16 |
--------------------------------------------------------------------------------
/.github/workflows/scripts/write-package-json.js:
--------------------------------------------------------------------------------
1 | const fs = require("fs");
2 | const path = require("path");
3 |
4 | const {
5 | name,
6 | version,
7 | description,
8 | author,
9 | license,
10 | repository,
11 | keywords
12 | } = require("../../../package.json");
13 |
14 | const packageJson = JSON.stringify(
15 | {
16 | name,
17 | version,
18 | description,
19 | author,
20 | license,
21 | repository,
22 | keywords,
23 | scripts: {
24 | postinstall: "node ./postinstall.js"
25 | }
26 | },
27 | null,
28 | 2
29 | );
30 |
31 | fs.writeFileSync(
32 | path.join(__dirname, "..", "..", "..", "_release", "package.json"),
33 | packageJson,
34 | { encoding: "utf8" }
35 | );
36 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | lib/
3 | .merlin
4 | .bsb.lock
5 | *.bs.js
6 | .DS_Store
7 | _esy
8 | _build
9 | _release
10 | .linaria-cache
11 | rescript-linaria-ppx.install
12 |
--------------------------------------------------------------------------------
/HISTORY.md:
--------------------------------------------------------------------------------
1 | # History
2 |
3 | #### 0.3.0
4 | - Add native `arm64` binary
5 |
6 | #### 0.2.0
7 | - Handle module names that match names of JS globals (e.g. `Screen`, `Image` etc.)
8 |
9 | #### 0.1.0
10 | - Allow `%css` in submodules
11 |
12 | #### 0.0.1
13 | Initial release.
14 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # rescript-linaria
2 |
3 | [ReScript](https://rescript-lang.org) bindings to [Linaria](https://github.com/callstack/linaria).
4 |
5 | ## Should I use it?
6 | Most likely, no. After using it on my personal site, I wouldn't recommend it for something more or less critical. This PPX is a big fat hack and it shows.
7 |
8 | ## About
9 | These bindings are unsafe. It means you won't get typed CSS.
10 |
11 | What you'll get:
12 | - Type-safe and auto-completable classnames
13 | - Everything Linaria offers, such as:
14 | - Static extraction
15 | - Functions / variables sharing between ReScript and CSS
16 |
17 | It works only with ReScript syntax.
18 |
19 | ## Installation
20 | You need to install and configure Linaria. Please, refer to [their docs](https://github.com/callstack/linaria#installation).
21 |
22 | Install these bindings:
23 |
24 | ```sh
25 | # yarn
26 | yarn add rescript-linaria
27 | # or npm
28 | npm install --save rescript-linaria
29 | ```
30 |
31 | As it's implemented as PPX, you need to add this to your `bsconfig.json`:
32 |
33 | ```json
34 | "ppx-flags": [
35 | "rescript-linaria/ppx"
36 | ],
37 | ```
38 |
39 | See [example](./examples) of its usage with Webpack.
40 |
41 | ## Usage
42 |
43 | ### Basic
44 |
45 | ```rescript
46 | moodule Css = %css(
47 | let cn = css`
48 | display: flex;
49 | position: relative;
50 | `
51 | )
52 |
53 | @react.component
54 | let make = () =>
55 | ```
56 |
57 | ⚠️⚠️⚠️ Everything inside `css` tagged template **is unsound**, including interpolations. It is 100% unsafe territory. What you type inside this tag goes directly to JS without any background checks. You basically write `%raw` JS, which gets slightly modified by PPX so Linaria can pick it up.
58 |
59 |
60 | ### Interpolations
61 | ```rescript
62 | moodule Css = %css(
63 | let pad = 5
64 |
65 | let cn = css`
66 | padding: ${pad}px;
67 | color: ${Color.text};
68 | `
69 | )
70 | ```
71 |
72 | You can interpolate:
73 | - everything that Linaria accepts for interpolation:
74 | - primitives, such as strings, numbers, etc
75 | - applications of general functions
76 | - applications of functions with pipes are also supported
77 |
78 | You can't interpolate:
79 | - applications of functions with labeled/optional arguments
80 | - applications of functions with placeholder arguments
81 | - externals (you must bind external to a variable first)
82 | - other ReScript-only things, such as variants
83 |
84 | ### Placement
85 | It is required to have exactly 1 `%css` module within 1 ReScript file.
86 |
87 | You can place `%css` module either:
88 | - in `.res` module as a submodule, as shown in the examples above
89 | - or in its own file using `include`:
90 |
91 | ```rescript
92 | // AppStyles.res
93 | include %css(
94 | // your css...
95 | )
96 | ```
97 |
98 | ---
99 | You can find more examples [here](./examples).
100 |
--------------------------------------------------------------------------------
/bin/Bin.re:
--------------------------------------------------------------------------------
1 | Ppxlib.Driver.run_as_ppx_rewriter();
2 |
--------------------------------------------------------------------------------
/bin/dune:
--------------------------------------------------------------------------------
1 | (executable
2 | (name bin)
3 | (public_name rescript-linaria-ppx)
4 | (libraries rescript-linaria-ppx.lib)
5 | )
6 |
--------------------------------------------------------------------------------
/dune-project:
--------------------------------------------------------------------------------
1 | (lang dune 2.6)
2 | (name rescript-linaria-ppx)
3 |
--------------------------------------------------------------------------------
/dune-workspace:
--------------------------------------------------------------------------------
1 | (lang dune 1.11)
2 |
--------------------------------------------------------------------------------
/esy.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "rescript-linaria-ppx",
3 | "version": "0.3.0",
4 | "author": "Alex Fedoseev ",
5 | "license": "MIT",
6 | "esy": {
7 | "build": "dune build -p #{self.name}",
8 | "buildsInSource": "_build"
9 | },
10 | "dependencies": {
11 | "ocaml": "4.12.0",
12 | "@opam/reason": "3.7.0",
13 | "@opam/dune": "2.9.2",
14 | "@opam/ppxlib": "0.24.0",
15 | "@opam/ocamlfind": "1.8.1"
16 | },
17 | "devDependencies": {
18 | "@opam/merlin": "*"
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/esy.lock/.gitattributes:
--------------------------------------------------------------------------------
1 |
2 | # Set eol to LF so files aren't converted to CRLF-eol on Windows.
3 | * text eol=lf linguist-generated
4 |
--------------------------------------------------------------------------------
/esy.lock/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | # Reset any possible .gitignore, we want all esy.lock to be un-ignored.
3 | !*
4 |
--------------------------------------------------------------------------------
/esy.lock/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "checksum": "ddf4f98e06ae9b41955f524568238f05",
3 | "root": "rescript-linaria-ppx@link-dev:./esy.json",
4 | "node": {
5 | "rescript-linaria-ppx@link-dev:./esy.json": {
6 | "id": "rescript-linaria-ppx@link-dev:./esy.json",
7 | "name": "rescript-linaria-ppx",
8 | "version": "link-dev:./esy.json",
9 | "source": { "type": "link-dev", "path": ".", "manifest": "esy.json" },
10 | "overrides": [],
11 | "dependencies": [
12 | "ocaml@4.12.0@d41d8cd9", "@opam/reason@opam:3.7.0@5ea7a0b2",
13 | "@opam/ppxlib@opam:0.24.0@4c00d6db", "@opam/dune@opam:2.9.2@f48e8212"
14 | ],
15 | "devDependencies": [ "@opam/merlin@opam:4.4-412@c7695ce2" ]
16 | },
17 | "ocaml@4.12.0@d41d8cd9": {
18 | "id": "ocaml@4.12.0@d41d8cd9",
19 | "name": "ocaml",
20 | "version": "4.12.0",
21 | "source": {
22 | "type": "install",
23 | "source": [
24 | "archive:https://registry.npmjs.org/ocaml/-/ocaml-4.12.0.tgz#sha1:2a979f37535faaded8aa3fdf82b6f16f2c71e284"
25 | ]
26 | },
27 | "overrides": [],
28 | "dependencies": [],
29 | "devDependencies": []
30 | },
31 | "@opam/yojson@opam:1.7.0@69d87312": {
32 | "id": "@opam/yojson@opam:1.7.0@69d87312",
33 | "name": "@opam/yojson",
34 | "version": "opam:1.7.0",
35 | "source": {
36 | "type": "install",
37 | "source": [
38 | "archive:https://opam.ocaml.org/cache/md5/b8/b89d39ca3f8c532abe5f547ad3b8f84d#md5:b89d39ca3f8c532abe5f547ad3b8f84d",
39 | "archive:https://github.com/ocaml-community/yojson/releases/download/1.7.0/yojson-1.7.0.tbz#md5:b89d39ca3f8c532abe5f547ad3b8f84d"
40 | ],
41 | "opam": {
42 | "name": "yojson",
43 | "version": "1.7.0",
44 | "path": "esy.lock/opam/yojson.1.7.0"
45 | }
46 | },
47 | "overrides": [],
48 | "dependencies": [
49 | "ocaml@4.12.0@d41d8cd9", "@opam/easy-format@opam:1.3.2@1ea9f987",
50 | "@opam/dune@opam:2.9.2@f48e8212", "@opam/cppo@opam:1.6.8@7e48217d",
51 | "@opam/biniou@opam:1.2.1@420bda02",
52 | "@esy-ocaml/substs@0.0.1@d41d8cd9"
53 | ],
54 | "devDependencies": [
55 | "ocaml@4.12.0@d41d8cd9", "@opam/easy-format@opam:1.3.2@1ea9f987",
56 | "@opam/dune@opam:2.9.2@f48e8212", "@opam/biniou@opam:1.2.1@420bda02"
57 | ]
58 | },
59 | "@opam/stdlib-shims@opam:0.3.0@0d088929": {
60 | "id": "@opam/stdlib-shims@opam:0.3.0@0d088929",
61 | "name": "@opam/stdlib-shims",
62 | "version": "opam:0.3.0",
63 | "source": {
64 | "type": "install",
65 | "source": [
66 | "archive:https://opam.ocaml.org/cache/sha256/ba/babf72d3917b86f707885f0c5528e36c63fccb698f4b46cf2bab5c7ccdd6d84a#sha256:babf72d3917b86f707885f0c5528e36c63fccb698f4b46cf2bab5c7ccdd6d84a",
67 | "archive:https://github.com/ocaml/stdlib-shims/releases/download/0.3.0/stdlib-shims-0.3.0.tbz#sha256:babf72d3917b86f707885f0c5528e36c63fccb698f4b46cf2bab5c7ccdd6d84a"
68 | ],
69 | "opam": {
70 | "name": "stdlib-shims",
71 | "version": "0.3.0",
72 | "path": "esy.lock/opam/stdlib-shims.0.3.0"
73 | }
74 | },
75 | "overrides": [],
76 | "dependencies": [
77 | "ocaml@4.12.0@d41d8cd9", "@opam/dune@opam:2.9.2@f48e8212",
78 | "@esy-ocaml/substs@0.0.1@d41d8cd9"
79 | ],
80 | "devDependencies": [
81 | "ocaml@4.12.0@d41d8cd9", "@opam/dune@opam:2.9.2@f48e8212"
82 | ]
83 | },
84 | "@opam/sexplib0@opam:v0.14.0@155c136c": {
85 | "id": "@opam/sexplib0@opam:v0.14.0@155c136c",
86 | "name": "@opam/sexplib0",
87 | "version": "opam:v0.14.0",
88 | "source": {
89 | "type": "install",
90 | "source": [
91 | "archive:https://opam.ocaml.org/cache/md5/37/37aff0af8f8f6f759249475684aebdc4#md5:37aff0af8f8f6f759249475684aebdc4",
92 | "archive:https://ocaml.janestreet.com/ocaml-core/v0.14/files/sexplib0-v0.14.0.tar.gz#md5:37aff0af8f8f6f759249475684aebdc4"
93 | ],
94 | "opam": {
95 | "name": "sexplib0",
96 | "version": "v0.14.0",
97 | "path": "esy.lock/opam/sexplib0.v0.14.0"
98 | }
99 | },
100 | "overrides": [],
101 | "dependencies": [
102 | "ocaml@4.12.0@d41d8cd9", "@opam/dune@opam:2.9.2@f48e8212",
103 | "@esy-ocaml/substs@0.0.1@d41d8cd9"
104 | ],
105 | "devDependencies": [
106 | "ocaml@4.12.0@d41d8cd9", "@opam/dune@opam:2.9.2@f48e8212"
107 | ]
108 | },
109 | "@opam/result@opam:1.5@1c6a6533": {
110 | "id": "@opam/result@opam:1.5@1c6a6533",
111 | "name": "@opam/result",
112 | "version": "opam:1.5",
113 | "source": {
114 | "type": "install",
115 | "source": [
116 | "archive:https://opam.ocaml.org/cache/md5/1b/1b82dec78849680b49ae9a8a365b831b#md5:1b82dec78849680b49ae9a8a365b831b",
117 | "archive:https://github.com/janestreet/result/releases/download/1.5/result-1.5.tbz#md5:1b82dec78849680b49ae9a8a365b831b"
118 | ],
119 | "opam": {
120 | "name": "result",
121 | "version": "1.5",
122 | "path": "esy.lock/opam/result.1.5"
123 | }
124 | },
125 | "overrides": [],
126 | "dependencies": [
127 | "ocaml@4.12.0@d41d8cd9", "@opam/dune@opam:2.9.2@f48e8212",
128 | "@esy-ocaml/substs@0.0.1@d41d8cd9"
129 | ],
130 | "devDependencies": [
131 | "ocaml@4.12.0@d41d8cd9", "@opam/dune@opam:2.9.2@f48e8212"
132 | ]
133 | },
134 | "@opam/reason@opam:3.7.0@5ea7a0b2": {
135 | "id": "@opam/reason@opam:3.7.0@5ea7a0b2",
136 | "name": "@opam/reason",
137 | "version": "opam:3.7.0",
138 | "source": {
139 | "type": "install",
140 | "source": [
141 | "archive:https://opam.ocaml.org/cache/md5/7e/7eb8cbbff8565b93ebfabf4eca7254d4#md5:7eb8cbbff8565b93ebfabf4eca7254d4",
142 | "archive:https://registry.npmjs.org/@esy-ocaml/reason/-/reason-3.7.0.tgz#md5:7eb8cbbff8565b93ebfabf4eca7254d4"
143 | ],
144 | "opam": {
145 | "name": "reason",
146 | "version": "3.7.0",
147 | "path": "esy.lock/opam/reason.3.7.0"
148 | }
149 | },
150 | "overrides": [],
151 | "dependencies": [
152 | "ocaml@4.12.0@d41d8cd9", "@opam/result@opam:1.5@1c6a6533",
153 | "@opam/ppx_derivers@opam:1.2.1@e2cbad12",
154 | "@opam/ocamlfind@opam:1.9.3@5b691822",
155 | "@opam/merlin-extend@opam:0.6@88755c91",
156 | "@opam/menhir@opam:20220210@ff87a93b",
157 | "@opam/fix@opam:20220121@17b9a1a4", "@opam/dune@opam:2.9.2@f48e8212",
158 | "@esy-ocaml/substs@0.0.1@d41d8cd9"
159 | ],
160 | "devDependencies": [
161 | "ocaml@4.12.0@d41d8cd9", "@opam/result@opam:1.5@1c6a6533",
162 | "@opam/ppx_derivers@opam:1.2.1@e2cbad12",
163 | "@opam/merlin-extend@opam:0.6@88755c91",
164 | "@opam/menhir@opam:20220210@ff87a93b",
165 | "@opam/fix@opam:20220121@17b9a1a4", "@opam/dune@opam:2.9.2@f48e8212"
166 | ]
167 | },
168 | "@opam/ppxlib@opam:0.24.0@4c00d6db": {
169 | "id": "@opam/ppxlib@opam:0.24.0@4c00d6db",
170 | "name": "@opam/ppxlib",
171 | "version": "opam:0.24.0",
172 | "source": {
173 | "type": "install",
174 | "source": [
175 | "archive:https://opam.ocaml.org/cache/sha256/77/7766027c2ecd0f5b3b460e9212a70709c6744278113eb91f317c56c41e7a90c8#sha256:7766027c2ecd0f5b3b460e9212a70709c6744278113eb91f317c56c41e7a90c8",
176 | "archive:https://github.com/ocaml-ppx/ppxlib/releases/download/0.24.0/ppxlib-0.24.0.tbz#sha256:7766027c2ecd0f5b3b460e9212a70709c6744278113eb91f317c56c41e7a90c8"
177 | ],
178 | "opam": {
179 | "name": "ppxlib",
180 | "version": "0.24.0",
181 | "path": "esy.lock/opam/ppxlib.0.24.0"
182 | }
183 | },
184 | "overrides": [],
185 | "dependencies": [
186 | "ocaml@4.12.0@d41d8cd9", "@opam/stdlib-shims@opam:0.3.0@0d088929",
187 | "@opam/sexplib0@opam:v0.14.0@155c136c",
188 | "@opam/ppx_derivers@opam:1.2.1@e2cbad12",
189 | "@opam/ocaml-compiler-libs@opam:v0.12.4@41979882",
190 | "@opam/dune@opam:2.9.2@f48e8212", "@esy-ocaml/substs@0.0.1@d41d8cd9"
191 | ],
192 | "devDependencies": [
193 | "ocaml@4.12.0@d41d8cd9", "@opam/stdlib-shims@opam:0.3.0@0d088929",
194 | "@opam/sexplib0@opam:v0.14.0@155c136c",
195 | "@opam/ppx_derivers@opam:1.2.1@e2cbad12",
196 | "@opam/ocaml-compiler-libs@opam:v0.12.4@41979882",
197 | "@opam/dune@opam:2.9.2@f48e8212"
198 | ]
199 | },
200 | "@opam/ppx_derivers@opam:1.2.1@e2cbad12": {
201 | "id": "@opam/ppx_derivers@opam:1.2.1@e2cbad12",
202 | "name": "@opam/ppx_derivers",
203 | "version": "opam:1.2.1",
204 | "source": {
205 | "type": "install",
206 | "source": [
207 | "archive:https://opam.ocaml.org/cache/md5/5d/5dc2bf130c1db3c731fe0fffc5648b41#md5:5dc2bf130c1db3c731fe0fffc5648b41",
208 | "archive:https://github.com/ocaml-ppx/ppx_derivers/archive/1.2.1.tar.gz#md5:5dc2bf130c1db3c731fe0fffc5648b41"
209 | ],
210 | "opam": {
211 | "name": "ppx_derivers",
212 | "version": "1.2.1",
213 | "path": "esy.lock/opam/ppx_derivers.1.2.1"
214 | }
215 | },
216 | "overrides": [],
217 | "dependencies": [
218 | "ocaml@4.12.0@d41d8cd9", "@opam/dune@opam:2.9.2@f48e8212",
219 | "@esy-ocaml/substs@0.0.1@d41d8cd9"
220 | ],
221 | "devDependencies": [
222 | "ocaml@4.12.0@d41d8cd9", "@opam/dune@opam:2.9.2@f48e8212"
223 | ]
224 | },
225 | "@opam/ocamlfind@opam:1.9.3@5b691822": {
226 | "id": "@opam/ocamlfind@opam:1.9.3@5b691822",
227 | "name": "@opam/ocamlfind",
228 | "version": "opam:1.9.3",
229 | "source": {
230 | "type": "install",
231 | "source": [
232 | "archive:https://opam.ocaml.org/cache/md5/24/24047dd8a0da5322253de9b7aa254e42#md5:24047dd8a0da5322253de9b7aa254e42",
233 | "archive:http://download.camlcity.org/download/findlib-1.9.3.tar.gz#md5:24047dd8a0da5322253de9b7aa254e42"
234 | ],
235 | "opam": {
236 | "name": "ocamlfind",
237 | "version": "1.9.3",
238 | "path": "esy.lock/opam/ocamlfind.1.9.3"
239 | }
240 | },
241 | "overrides": [
242 | {
243 | "opamoverride":
244 | "esy.lock/overrides/opam__s__ocamlfind_opam__c__1.9.3_opam_override"
245 | }
246 | ],
247 | "dependencies": [
248 | "ocaml@4.12.0@d41d8cd9", "@esy-ocaml/substs@0.0.1@d41d8cd9"
249 | ],
250 | "devDependencies": [ "ocaml@4.12.0@d41d8cd9" ]
251 | },
252 | "@opam/ocaml-compiler-libs@opam:v0.12.4@41979882": {
253 | "id": "@opam/ocaml-compiler-libs@opam:v0.12.4@41979882",
254 | "name": "@opam/ocaml-compiler-libs",
255 | "version": "opam:v0.12.4",
256 | "source": {
257 | "type": "install",
258 | "source": [
259 | "archive:https://opam.ocaml.org/cache/sha256/4e/4ec9c9ec35cc45c18c7a143761154ef1d7663036a29297f80381f47981a07760#sha256:4ec9c9ec35cc45c18c7a143761154ef1d7663036a29297f80381f47981a07760",
260 | "archive:https://github.com/janestreet/ocaml-compiler-libs/releases/download/v0.12.4/ocaml-compiler-libs-v0.12.4.tbz#sha256:4ec9c9ec35cc45c18c7a143761154ef1d7663036a29297f80381f47981a07760"
261 | ],
262 | "opam": {
263 | "name": "ocaml-compiler-libs",
264 | "version": "v0.12.4",
265 | "path": "esy.lock/opam/ocaml-compiler-libs.v0.12.4"
266 | }
267 | },
268 | "overrides": [],
269 | "dependencies": [
270 | "ocaml@4.12.0@d41d8cd9", "@opam/dune@opam:2.9.2@f48e8212",
271 | "@esy-ocaml/substs@0.0.1@d41d8cd9"
272 | ],
273 | "devDependencies": [
274 | "ocaml@4.12.0@d41d8cd9", "@opam/dune@opam:2.9.2@f48e8212"
275 | ]
276 | },
277 | "@opam/merlin-extend@opam:0.6@88755c91": {
278 | "id": "@opam/merlin-extend@opam:0.6@88755c91",
279 | "name": "@opam/merlin-extend",
280 | "version": "opam:0.6",
281 | "source": {
282 | "type": "install",
283 | "source": [
284 | "archive:https://opam.ocaml.org/cache/sha256/c2/c2f236ae97feb6ba0bc90f33beb7b7343e42f9871b66de9ba07974917e256c43#sha256:c2f236ae97feb6ba0bc90f33beb7b7343e42f9871b66de9ba07974917e256c43",
285 | "archive:https://github.com/let-def/merlin-extend/releases/download/v0.6/merlin-extend-v0.6.tbz#sha256:c2f236ae97feb6ba0bc90f33beb7b7343e42f9871b66de9ba07974917e256c43"
286 | ],
287 | "opam": {
288 | "name": "merlin-extend",
289 | "version": "0.6",
290 | "path": "esy.lock/opam/merlin-extend.0.6"
291 | }
292 | },
293 | "overrides": [],
294 | "dependencies": [
295 | "ocaml@4.12.0@d41d8cd9", "@opam/dune@opam:2.9.2@f48e8212",
296 | "@opam/cppo@opam:1.6.8@7e48217d", "@esy-ocaml/substs@0.0.1@d41d8cd9"
297 | ],
298 | "devDependencies": [
299 | "ocaml@4.12.0@d41d8cd9", "@opam/dune@opam:2.9.2@f48e8212"
300 | ]
301 | },
302 | "@opam/merlin@opam:4.4-412@c7695ce2": {
303 | "id": "@opam/merlin@opam:4.4-412@c7695ce2",
304 | "name": "@opam/merlin",
305 | "version": "opam:4.4-412",
306 | "source": {
307 | "type": "install",
308 | "source": [
309 | "archive:https://opam.ocaml.org/cache/sha256/16/16d879496882d44ee0a5392e20b3824240e70f1585b9ae6d936ff5f3a3beb2a3#sha256:16d879496882d44ee0a5392e20b3824240e70f1585b9ae6d936ff5f3a3beb2a3",
310 | "archive:https://github.com/ocaml/merlin/releases/download/v4.4-412/merlin-4.4-412.tbz#sha256:16d879496882d44ee0a5392e20b3824240e70f1585b9ae6d936ff5f3a3beb2a3"
311 | ],
312 | "opam": {
313 | "name": "merlin",
314 | "version": "4.4-412",
315 | "path": "esy.lock/opam/merlin.4.4-412"
316 | }
317 | },
318 | "overrides": [],
319 | "dependencies": [
320 | "ocaml@4.12.0@d41d8cd9", "@opam/yojson@opam:1.7.0@69d87312",
321 | "@opam/result@opam:1.5@1c6a6533", "@opam/dune@opam:2.9.2@f48e8212",
322 | "@opam/dot-merlin-reader@opam:4.1@84436e1c",
323 | "@opam/csexp@opam:1.5.1@8a8fb3a7", "@esy-ocaml/substs@0.0.1@d41d8cd9"
324 | ],
325 | "devDependencies": [
326 | "ocaml@4.12.0@d41d8cd9", "@opam/yojson@opam:1.7.0@69d87312",
327 | "@opam/result@opam:1.5@1c6a6533", "@opam/dune@opam:2.9.2@f48e8212",
328 | "@opam/dot-merlin-reader@opam:4.1@84436e1c",
329 | "@opam/csexp@opam:1.5.1@8a8fb3a7"
330 | ]
331 | },
332 | "@opam/menhirSdk@opam:20220210@b8921e41": {
333 | "id": "@opam/menhirSdk@opam:20220210@b8921e41",
334 | "name": "@opam/menhirSdk",
335 | "version": "opam:20220210",
336 | "source": {
337 | "type": "install",
338 | "source": [
339 | "archive:https://opam.ocaml.org/cache/md5/e3/e3cef220f676c4b1c16cbccb174cefe3#md5:e3cef220f676c4b1c16cbccb174cefe3",
340 | "archive:https://gitlab.inria.fr/fpottier/menhir/-/archive/20220210/archive.tar.gz#md5:e3cef220f676c4b1c16cbccb174cefe3"
341 | ],
342 | "opam": {
343 | "name": "menhirSdk",
344 | "version": "20220210",
345 | "path": "esy.lock/opam/menhirSdk.20220210"
346 | }
347 | },
348 | "overrides": [],
349 | "dependencies": [
350 | "ocaml@4.12.0@d41d8cd9", "@opam/dune@opam:2.9.2@f48e8212",
351 | "@esy-ocaml/substs@0.0.1@d41d8cd9"
352 | ],
353 | "devDependencies": [
354 | "ocaml@4.12.0@d41d8cd9", "@opam/dune@opam:2.9.2@f48e8212"
355 | ]
356 | },
357 | "@opam/menhirLib@opam:20220210@e6562f4f": {
358 | "id": "@opam/menhirLib@opam:20220210@e6562f4f",
359 | "name": "@opam/menhirLib",
360 | "version": "opam:20220210",
361 | "source": {
362 | "type": "install",
363 | "source": [
364 | "archive:https://opam.ocaml.org/cache/md5/e3/e3cef220f676c4b1c16cbccb174cefe3#md5:e3cef220f676c4b1c16cbccb174cefe3",
365 | "archive:https://gitlab.inria.fr/fpottier/menhir/-/archive/20220210/archive.tar.gz#md5:e3cef220f676c4b1c16cbccb174cefe3"
366 | ],
367 | "opam": {
368 | "name": "menhirLib",
369 | "version": "20220210",
370 | "path": "esy.lock/opam/menhirLib.20220210"
371 | }
372 | },
373 | "overrides": [],
374 | "dependencies": [
375 | "ocaml@4.12.0@d41d8cd9", "@opam/dune@opam:2.9.2@f48e8212",
376 | "@esy-ocaml/substs@0.0.1@d41d8cd9"
377 | ],
378 | "devDependencies": [
379 | "ocaml@4.12.0@d41d8cd9", "@opam/dune@opam:2.9.2@f48e8212"
380 | ]
381 | },
382 | "@opam/menhir@opam:20220210@ff87a93b": {
383 | "id": "@opam/menhir@opam:20220210@ff87a93b",
384 | "name": "@opam/menhir",
385 | "version": "opam:20220210",
386 | "source": {
387 | "type": "install",
388 | "source": [
389 | "archive:https://opam.ocaml.org/cache/md5/e3/e3cef220f676c4b1c16cbccb174cefe3#md5:e3cef220f676c4b1c16cbccb174cefe3",
390 | "archive:https://gitlab.inria.fr/fpottier/menhir/-/archive/20220210/archive.tar.gz#md5:e3cef220f676c4b1c16cbccb174cefe3"
391 | ],
392 | "opam": {
393 | "name": "menhir",
394 | "version": "20220210",
395 | "path": "esy.lock/opam/menhir.20220210"
396 | }
397 | },
398 | "overrides": [],
399 | "dependencies": [
400 | "ocaml@4.12.0@d41d8cd9", "@opam/menhirSdk@opam:20220210@b8921e41",
401 | "@opam/menhirLib@opam:20220210@e6562f4f",
402 | "@opam/dune@opam:2.9.2@f48e8212", "@esy-ocaml/substs@0.0.1@d41d8cd9"
403 | ],
404 | "devDependencies": [
405 | "ocaml@4.12.0@d41d8cd9", "@opam/menhirSdk@opam:20220210@b8921e41",
406 | "@opam/menhirLib@opam:20220210@e6562f4f",
407 | "@opam/dune@opam:2.9.2@f48e8212"
408 | ]
409 | },
410 | "@opam/fix@opam:20220121@17b9a1a4": {
411 | "id": "@opam/fix@opam:20220121@17b9a1a4",
412 | "name": "@opam/fix",
413 | "version": "opam:20220121",
414 | "source": {
415 | "type": "install",
416 | "source": [
417 | "archive:https://opam.ocaml.org/cache/md5/48/48d8a5bdff23cf7fbf9288877df2b6aa#md5:48d8a5bdff23cf7fbf9288877df2b6aa",
418 | "archive:https://gitlab.inria.fr/fpottier/fix/-/archive/20220121/archive.tar.gz#md5:48d8a5bdff23cf7fbf9288877df2b6aa"
419 | ],
420 | "opam": {
421 | "name": "fix",
422 | "version": "20220121",
423 | "path": "esy.lock/opam/fix.20220121"
424 | }
425 | },
426 | "overrides": [],
427 | "dependencies": [
428 | "ocaml@4.12.0@d41d8cd9", "@opam/dune@opam:2.9.2@f48e8212",
429 | "@esy-ocaml/substs@0.0.1@d41d8cd9"
430 | ],
431 | "devDependencies": [
432 | "ocaml@4.12.0@d41d8cd9", "@opam/dune@opam:2.9.2@f48e8212"
433 | ]
434 | },
435 | "@opam/easy-format@opam:1.3.2@1ea9f987": {
436 | "id": "@opam/easy-format@opam:1.3.2@1ea9f987",
437 | "name": "@opam/easy-format",
438 | "version": "opam:1.3.2",
439 | "source": {
440 | "type": "install",
441 | "source": [
442 | "archive:https://opam.ocaml.org/cache/sha256/34/3440c2b882d537ae5e9011eb06abb53f5667e651ea4bb3b460ea8230fa8c1926#sha256:3440c2b882d537ae5e9011eb06abb53f5667e651ea4bb3b460ea8230fa8c1926",
443 | "archive:https://github.com/mjambon/easy-format/releases/download/1.3.2/easy-format-1.3.2.tbz#sha256:3440c2b882d537ae5e9011eb06abb53f5667e651ea4bb3b460ea8230fa8c1926"
444 | ],
445 | "opam": {
446 | "name": "easy-format",
447 | "version": "1.3.2",
448 | "path": "esy.lock/opam/easy-format.1.3.2"
449 | }
450 | },
451 | "overrides": [],
452 | "dependencies": [
453 | "ocaml@4.12.0@d41d8cd9", "@opam/dune@opam:2.9.2@f48e8212",
454 | "@esy-ocaml/substs@0.0.1@d41d8cd9"
455 | ],
456 | "devDependencies": [
457 | "ocaml@4.12.0@d41d8cd9", "@opam/dune@opam:2.9.2@f48e8212"
458 | ]
459 | },
460 | "@opam/dune@opam:2.9.2@f48e8212": {
461 | "id": "@opam/dune@opam:2.9.2@f48e8212",
462 | "name": "@opam/dune",
463 | "version": "opam:2.9.2",
464 | "source": {
465 | "type": "install",
466 | "source": [
467 | "archive:https://opam.ocaml.org/cache/sha256/b8/b8e7cc507fb978b45f6fdc839f2b3201d2c1e611e4a8e972c8c8cfd8522e7447#sha256:b8e7cc507fb978b45f6fdc839f2b3201d2c1e611e4a8e972c8c8cfd8522e7447",
468 | "archive:https://github.com/ocaml/dune/releases/download/2.9.2/dune-site-2.9.2.tbz#sha256:b8e7cc507fb978b45f6fdc839f2b3201d2c1e611e4a8e972c8c8cfd8522e7447"
469 | ],
470 | "opam": {
471 | "name": "dune",
472 | "version": "2.9.2",
473 | "path": "esy.lock/opam/dune.2.9.2"
474 | }
475 | },
476 | "overrides": [],
477 | "dependencies": [
478 | "ocaml@4.12.0@d41d8cd9", "@opam/base-unix@opam:base@87d0b2eb",
479 | "@opam/base-threads@opam:base@36803084",
480 | "@esy-ocaml/substs@0.0.1@d41d8cd9"
481 | ],
482 | "devDependencies": [
483 | "ocaml@4.12.0@d41d8cd9", "@opam/base-unix@opam:base@87d0b2eb",
484 | "@opam/base-threads@opam:base@36803084"
485 | ]
486 | },
487 | "@opam/dot-merlin-reader@opam:4.1@84436e1c": {
488 | "id": "@opam/dot-merlin-reader@opam:4.1@84436e1c",
489 | "name": "@opam/dot-merlin-reader",
490 | "version": "opam:4.1",
491 | "source": {
492 | "type": "install",
493 | "source": [
494 | "archive:https://opam.ocaml.org/cache/sha256/14/14a36d6fb8646a5df4530420a7861722f1a4ee04753717947305e3676031e7cd#sha256:14a36d6fb8646a5df4530420a7861722f1a4ee04753717947305e3676031e7cd",
495 | "archive:https://github.com/ocaml/merlin/releases/download/v4.1/dot-merlin-reader-v4.1.tbz#sha256:14a36d6fb8646a5df4530420a7861722f1a4ee04753717947305e3676031e7cd"
496 | ],
497 | "opam": {
498 | "name": "dot-merlin-reader",
499 | "version": "4.1",
500 | "path": "esy.lock/opam/dot-merlin-reader.4.1"
501 | }
502 | },
503 | "overrides": [],
504 | "dependencies": [
505 | "ocaml@4.12.0@d41d8cd9", "@opam/yojson@opam:1.7.0@69d87312",
506 | "@opam/result@opam:1.5@1c6a6533",
507 | "@opam/ocamlfind@opam:1.9.3@5b691822",
508 | "@opam/dune@opam:2.9.2@f48e8212", "@opam/csexp@opam:1.5.1@8a8fb3a7",
509 | "@esy-ocaml/substs@0.0.1@d41d8cd9"
510 | ],
511 | "devDependencies": [
512 | "ocaml@4.12.0@d41d8cd9", "@opam/yojson@opam:1.7.0@69d87312",
513 | "@opam/result@opam:1.5@1c6a6533",
514 | "@opam/ocamlfind@opam:1.9.3@5b691822",
515 | "@opam/dune@opam:2.9.2@f48e8212", "@opam/csexp@opam:1.5.1@8a8fb3a7"
516 | ]
517 | },
518 | "@opam/csexp@opam:1.5.1@8a8fb3a7": {
519 | "id": "@opam/csexp@opam:1.5.1@8a8fb3a7",
520 | "name": "@opam/csexp",
521 | "version": "opam:1.5.1",
522 | "source": {
523 | "type": "install",
524 | "source": [
525 | "archive:https://opam.ocaml.org/cache/sha256/d6/d605e4065fa90a58800440ef2f33a2d931398bf2c22061a8acb7df845c0aac02#sha256:d605e4065fa90a58800440ef2f33a2d931398bf2c22061a8acb7df845c0aac02",
526 | "archive:https://github.com/ocaml-dune/csexp/releases/download/1.5.1/csexp-1.5.1.tbz#sha256:d605e4065fa90a58800440ef2f33a2d931398bf2c22061a8acb7df845c0aac02"
527 | ],
528 | "opam": {
529 | "name": "csexp",
530 | "version": "1.5.1",
531 | "path": "esy.lock/opam/csexp.1.5.1"
532 | }
533 | },
534 | "overrides": [],
535 | "dependencies": [
536 | "ocaml@4.12.0@d41d8cd9", "@opam/dune@opam:2.9.2@f48e8212",
537 | "@esy-ocaml/substs@0.0.1@d41d8cd9"
538 | ],
539 | "devDependencies": [
540 | "ocaml@4.12.0@d41d8cd9", "@opam/dune@opam:2.9.2@f48e8212"
541 | ]
542 | },
543 | "@opam/cppo@opam:1.6.8@7e48217d": {
544 | "id": "@opam/cppo@opam:1.6.8@7e48217d",
545 | "name": "@opam/cppo",
546 | "version": "opam:1.6.8",
547 | "source": {
548 | "type": "install",
549 | "source": [
550 | "archive:https://opam.ocaml.org/cache/md5/fe/fed401197d86f9089e89f6cbdf1d660d#md5:fed401197d86f9089e89f6cbdf1d660d",
551 | "archive:https://github.com/ocaml-community/cppo/archive/v1.6.8.tar.gz#md5:fed401197d86f9089e89f6cbdf1d660d"
552 | ],
553 | "opam": {
554 | "name": "cppo",
555 | "version": "1.6.8",
556 | "path": "esy.lock/opam/cppo.1.6.8"
557 | }
558 | },
559 | "overrides": [],
560 | "dependencies": [
561 | "ocaml@4.12.0@d41d8cd9", "@opam/dune@opam:2.9.2@f48e8212",
562 | "@opam/base-unix@opam:base@87d0b2eb",
563 | "@esy-ocaml/substs@0.0.1@d41d8cd9"
564 | ],
565 | "devDependencies": [
566 | "ocaml@4.12.0@d41d8cd9", "@opam/dune@opam:2.9.2@f48e8212",
567 | "@opam/base-unix@opam:base@87d0b2eb"
568 | ]
569 | },
570 | "@opam/biniou@opam:1.2.1@420bda02": {
571 | "id": "@opam/biniou@opam:1.2.1@420bda02",
572 | "name": "@opam/biniou",
573 | "version": "opam:1.2.1",
574 | "source": {
575 | "type": "install",
576 | "source": [
577 | "archive:https://opam.ocaml.org/cache/sha256/35/35546c68b1929a8e6d27a3b39ecd17b38303a0d47e65eb9d1480c2061ea84335#sha256:35546c68b1929a8e6d27a3b39ecd17b38303a0d47e65eb9d1480c2061ea84335",
578 | "archive:https://github.com/mjambon/biniou/releases/download/1.2.1/biniou-1.2.1.tbz#sha256:35546c68b1929a8e6d27a3b39ecd17b38303a0d47e65eb9d1480c2061ea84335"
579 | ],
580 | "opam": {
581 | "name": "biniou",
582 | "version": "1.2.1",
583 | "path": "esy.lock/opam/biniou.1.2.1"
584 | }
585 | },
586 | "overrides": [],
587 | "dependencies": [
588 | "ocaml@4.12.0@d41d8cd9", "@opam/easy-format@opam:1.3.2@1ea9f987",
589 | "@opam/dune@opam:2.9.2@f48e8212", "@esy-ocaml/substs@0.0.1@d41d8cd9"
590 | ],
591 | "devDependencies": [
592 | "ocaml@4.12.0@d41d8cd9", "@opam/easy-format@opam:1.3.2@1ea9f987",
593 | "@opam/dune@opam:2.9.2@f48e8212"
594 | ]
595 | },
596 | "@opam/base-unix@opam:base@87d0b2eb": {
597 | "id": "@opam/base-unix@opam:base@87d0b2eb",
598 | "name": "@opam/base-unix",
599 | "version": "opam:base",
600 | "source": {
601 | "type": "install",
602 | "source": [ "no-source:" ],
603 | "opam": {
604 | "name": "base-unix",
605 | "version": "base",
606 | "path": "esy.lock/opam/base-unix.base"
607 | }
608 | },
609 | "overrides": [],
610 | "dependencies": [ "@esy-ocaml/substs@0.0.1@d41d8cd9" ],
611 | "devDependencies": []
612 | },
613 | "@opam/base-threads@opam:base@36803084": {
614 | "id": "@opam/base-threads@opam:base@36803084",
615 | "name": "@opam/base-threads",
616 | "version": "opam:base",
617 | "source": {
618 | "type": "install",
619 | "source": [ "no-source:" ],
620 | "opam": {
621 | "name": "base-threads",
622 | "version": "base",
623 | "path": "esy.lock/opam/base-threads.base"
624 | }
625 | },
626 | "overrides": [],
627 | "dependencies": [ "@esy-ocaml/substs@0.0.1@d41d8cd9" ],
628 | "devDependencies": []
629 | },
630 | "@esy-ocaml/substs@0.0.1@d41d8cd9": {
631 | "id": "@esy-ocaml/substs@0.0.1@d41d8cd9",
632 | "name": "@esy-ocaml/substs",
633 | "version": "0.0.1",
634 | "source": {
635 | "type": "install",
636 | "source": [
637 | "archive:https://registry.npmjs.org/@esy-ocaml/substs/-/substs-0.0.1.tgz#sha1:59ebdbbaedcda123fc7ed8fb2b302b7d819e9a46"
638 | ]
639 | },
640 | "overrides": [],
641 | "dependencies": [],
642 | "devDependencies": []
643 | }
644 | }
645 | }
--------------------------------------------------------------------------------
/esy.lock/opam/base-threads.base/opam:
--------------------------------------------------------------------------------
1 | opam-version: "2.0"
2 | maintainer: "https://github.com/ocaml/opam-repository/issues"
3 | description: """
4 | Threads library distributed with the OCaml compiler
5 | """
6 |
7 |
--------------------------------------------------------------------------------
/esy.lock/opam/base-unix.base/opam:
--------------------------------------------------------------------------------
1 | opam-version: "2.0"
2 | maintainer: "https://github.com/ocaml/opam-repository/issues"
3 | description: """
4 | Unix library distributed with the OCaml compiler
5 | """
6 |
7 |
--------------------------------------------------------------------------------
/esy.lock/opam/biniou.1.2.1/opam:
--------------------------------------------------------------------------------
1 | opam-version: "2.0"
2 | build: [
3 | ["dune" "subst"] {dev}
4 | ["dune" "build" "-p" name "-j" jobs]
5 | ["dune" "runtest" "-p" name "-j" jobs] {with-test}
6 | ["dune" "build" "-p" name "@doc"] {with-doc}
7 | ]
8 | maintainer: ["martin@mjambon.com"]
9 | authors: ["Martin Jambon"]
10 | bug-reports: "https://github.com/mjambon/biniou/issues"
11 | homepage: "https://github.com/mjambon/biniou"
12 | doc: "https://mjambon.github.io/biniou/"
13 | license: "BSD-3-Clause"
14 | dev-repo: "git+https://github.com/mjambon/biniou.git"
15 | synopsis:
16 | "Binary data format designed for speed, safety, ease of use and backward compatibility as protocols evolve"
17 | description: """
18 |
19 | Biniou (pronounced "be new") is a binary data format designed for speed, safety,
20 | ease of use and backward compatibility as protocols evolve. Biniou is vastly
21 | equivalent to JSON in terms of functionality but allows implementations several
22 | times faster (4 times faster than yojson), with 25-35% space savings.
23 |
24 | Biniou data can be decoded into human-readable form without knowledge of type
25 | definitions except for field and variant names which are represented by 31-bit
26 | hashes. A program named bdump is provided for routine visualization of biniou
27 | data files.
28 |
29 | The program atdgen is used to derive OCaml-Biniou serializers and deserializers
30 | from type definitions.
31 |
32 | Biniou format specification: mjambon.github.io/atdgen-doc/biniou-format.txt"""
33 | depends: [
34 | "easy-format"
35 | "dune" {>= "1.10"}
36 | "ocaml" {>= "4.02.3"}
37 | ]
38 | url {
39 | src:
40 | "https://github.com/mjambon/biniou/releases/download/1.2.1/biniou-1.2.1.tbz"
41 | checksum: [
42 | "sha256=35546c68b1929a8e6d27a3b39ecd17b38303a0d47e65eb9d1480c2061ea84335"
43 | "sha512=82670cc77bf3e869ee26e5fbe5a5affa45a22bc8b6c4bd7e85473912780e0111baca59b34a2c14feae3543ce6e239d7fddaeab24b686a65bfe642cdb91d27ebf"
44 | ]
45 | }
46 |
--------------------------------------------------------------------------------
/esy.lock/opam/cppo.1.6.8/opam:
--------------------------------------------------------------------------------
1 | opam-version: "2.0"
2 | maintainer: "martin@mjambon.com"
3 | authors: "Martin Jambon"
4 | license: "BSD-3-Clause"
5 | homepage: "https://github.com/ocaml-community/cppo"
6 | doc: "https://ocaml-community.github.io/cppo/"
7 | bug-reports: "https://github.com/ocaml-community/cppo/issues"
8 | depends: [
9 | "ocaml" {>= "4.02.3"}
10 | "dune" {>= "1.0"}
11 | "base-unix"
12 | ]
13 | build: [
14 | ["dune" "subst"] {dev}
15 | ["dune" "build" "-p" name "-j" jobs]
16 | ["dune" "runtest" "-p" name "-j" jobs] {with-test}
17 | ]
18 | dev-repo: "git+https://github.com/ocaml-community/cppo.git"
19 | synopsis: "Code preprocessor like cpp for OCaml"
20 | description: """
21 | Cppo is an equivalent of the C preprocessor for OCaml programs.
22 | It allows the definition of simple macros and file inclusion.
23 |
24 | Cppo is:
25 |
26 | * more OCaml-friendly than cpp
27 | * easy to learn without consulting a manual
28 | * reasonably fast
29 | * simple to install and to maintain
30 | """
31 | url {
32 | src: "https://github.com/ocaml-community/cppo/archive/v1.6.8.tar.gz"
33 | checksum: [
34 | "md5=fed401197d86f9089e89f6cbdf1d660d"
35 | "sha512=069bbe0ef09c03b0dc4b5795f909c3ef872fe99c6f1e6704a0fa97594b1570b3579226ec67fe11d696ccc349a4585055bbaf07c65eff423aa45af28abf38c858"
36 | ]
37 | }
38 |
--------------------------------------------------------------------------------
/esy.lock/opam/csexp.1.5.1/opam:
--------------------------------------------------------------------------------
1 | opam-version: "2.0"
2 | synopsis: "Parsing and printing of S-expressions in Canonical form"
3 | description: """
4 |
5 | This library provides minimal support for Canonical S-expressions
6 | [1]. Canonical S-expressions are a binary encoding of S-expressions
7 | that is super simple and well suited for communication between
8 | programs.
9 |
10 | This library only provides a few helpers for simple applications. If
11 | you need more advanced support, such as parsing from more fancy input
12 | sources, you should consider copying the code of this library given
13 | how simple parsing S-expressions in canonical form is.
14 |
15 | To avoid a dependency on a particular S-expression library, the only
16 | module of this library is parameterised by the type of S-expressions.
17 |
18 | [1] https://en.wikipedia.org/wiki/Canonical_S-expressions
19 | """
20 | maintainer: ["Jeremie Dimino "]
21 | authors: [
22 | "Quentin Hocquet "
23 | "Jane Street Group, LLC"
24 | "Jeremie Dimino "
25 | ]
26 | license: "MIT"
27 | homepage: "https://github.com/ocaml-dune/csexp"
28 | doc: "https://ocaml-dune.github.io/csexp/"
29 | bug-reports: "https://github.com/ocaml-dune/csexp/issues"
30 | depends: [
31 | "dune" {>= "1.11"}
32 | "ocaml" {>= "4.03.0"}
33 | # "ppx_expect" {with-test & >= "v0.14"}
34 | "odoc" {with-doc}
35 | ]
36 | dev-repo: "git+https://github.com/ocaml-dune/csexp.git"
37 | build: [
38 | ["dune" "subst"] {dev}
39 | [
40 | "dune"
41 | "build"
42 | "-p"
43 | name
44 | "-j"
45 | jobs
46 | "@install"
47 | # Tests disabled because of a cyclic dependency with csexp, dune-configurator and ppx_expect
48 | # "@runtest" {with-test}
49 | "@doc" {with-doc}
50 | ]
51 | ]
52 | x-commit-hash: "7eeb86206819d2b1782d6cde1be9d6cf8b5fc851"
53 | url {
54 | src:
55 | "https://github.com/ocaml-dune/csexp/releases/download/1.5.1/csexp-1.5.1.tbz"
56 | checksum: [
57 | "sha256=d605e4065fa90a58800440ef2f33a2d931398bf2c22061a8acb7df845c0aac02"
58 | "sha512=d785bbabaff9f6bf601399149ef0a42e5e99647b54e27f97ef1625907793dda22a45bf83e0e8a1eba2c63634c5484b54739ff0904ef556f5fc592efa38af7505"
59 | ]
60 | }
61 |
--------------------------------------------------------------------------------
/esy.lock/opam/dot-merlin-reader.4.1/opam:
--------------------------------------------------------------------------------
1 | opam-version: "2.0"
2 | maintainer: "defree@gmail.com"
3 | authors: "The Merlin team"
4 | synopsis: "Reads config files for merlin"
5 | homepage: "https://github.com/ocaml/merlin"
6 | bug-reports: "https://github.com/ocaml/merlin/issues"
7 | dev-repo: "git+https://github.com/ocaml/merlin.git"
8 | build: [
9 | ["dune" "subst"] {dev}
10 | ["dune" "build" "-p" name "-j" jobs]
11 | ]
12 | depends: [
13 | "ocaml" {>= "4.06.1" }
14 | "dune" {>= "2.7.0"}
15 | "yojson" {>= "1.6.0"}
16 | "ocamlfind" {>= "1.6.0"}
17 | "csexp" {>= "1.2.3"}
18 | "result" {>= "1.5"}
19 | ]
20 | description:
21 | "Helper process: reads .merlin files and gives the normalized content to merlin"
22 | x-commit-hash: "ab02f60994c81166820791b5f465f467d752b8dc"
23 | url {
24 | src:
25 | "https://github.com/ocaml/merlin/releases/download/v4.1/dot-merlin-reader-v4.1.tbz"
26 | checksum: [
27 | "sha256=14a36d6fb8646a5df4530420a7861722f1a4ee04753717947305e3676031e7cd"
28 | "sha512=65fd4ab08904c05651a7ef8971802ffaa428daa920765dbcf162e3c56e8047e4c9e4356daa45efccce7c73a586635c8f6cf8118fd3059789de9aff68579bd436"
29 | ]
30 | }
31 |
--------------------------------------------------------------------------------
/esy.lock/opam/dune.2.9.2/opam:
--------------------------------------------------------------------------------
1 | opam-version: "2.0"
2 | synopsis: "Fast, portable, and opinionated build system"
3 | description: """
4 |
5 | dune is a build system that was designed to simplify the release of
6 | Jane Street packages. It reads metadata from "dune" files following a
7 | very simple s-expression syntax.
8 |
9 | dune is fast, has very low-overhead, and supports parallel builds on
10 | all platforms. It has no system dependencies; all you need to build
11 | dune or packages using dune is OCaml. You don't need make or bash
12 | as long as the packages themselves don't use bash explicitly.
13 |
14 | dune supports multi-package development by simply dropping multiple
15 | repositories into the same directory.
16 |
17 | It also supports multi-context builds, such as building against
18 | several opam roots/switches simultaneously. This helps maintaining
19 | packages across several versions of OCaml and gives cross-compilation
20 | for free.
21 | """
22 | maintainer: ["Jane Street Group, LLC "]
23 | authors: ["Jane Street Group, LLC "]
24 | license: "MIT"
25 | homepage: "https://github.com/ocaml/dune"
26 | doc: "https://dune.readthedocs.io/"
27 | bug-reports: "https://github.com/ocaml/dune/issues"
28 | conflicts: [
29 | "merlin" {< "3.4.0"}
30 | "ocaml-lsp-server" {< "1.3.0"}
31 | "dune-configurator" {< "2.3.0"}
32 | "odoc" {< "1.3.0"}
33 | "dune-release" {< "1.3.0"}
34 | "js_of_ocaml-compiler" {< "3.6.0"}
35 | "jbuilder" {= "transition"}
36 | ]
37 | dev-repo: "git+https://github.com/ocaml/dune.git"
38 | build: [
39 | # opam 2 sets OPAM_SWITCH_PREFIX, so we don't need a hardcoded path
40 | ["ocaml" "configure.ml" "--libdir" lib] {opam-version < "2"}
41 | ["ocaml" "bootstrap.ml" "-j" jobs]
42 | ["./dune.exe" "build" "-p" name "--profile" "dune-bootstrap" "-j" jobs]
43 | ]
44 | depends: [
45 | # Please keep the lower bound in sync with .github/workflows/workflow.yml,
46 | # dune-project and min_ocaml_version in bootstrap.ml
47 | ("ocaml" {>= "4.08"} | ("ocaml" {>= "4.03" & < "4.08~~"} & "ocamlfind-secondary"))
48 | "base-unix"
49 | "base-threads"
50 | ]
51 | url {
52 | src:
53 | "https://github.com/ocaml/dune/releases/download/2.9.2/dune-site-2.9.2.tbz"
54 | checksum: [
55 | "sha256=b8e7cc507fb978b45f6fdc839f2b3201d2c1e611e4a8e972c8c8cfd8522e7447"
56 | "sha512=e45986afdce4a1a19671206bf9818463b398ee2658ca7203a00546b9b1079cde018bc435b4846c82281960fa3ca1cdca8aab670b15a1b7cac6cafac369de7b67"
57 | ]
58 | }
59 | x-commit-hash: "ee27573858f9ff7fe8e0b8bb1d785be8cabd3b23"
60 |
--------------------------------------------------------------------------------
/esy.lock/opam/easy-format.1.3.2/opam:
--------------------------------------------------------------------------------
1 | opam-version: "2.0"
2 | build: [
3 | ["dune" "subst"] {dev}
4 | ["dune" "build" "-p" name "-j" jobs]
5 | ["dune" "runtest" "-p" name "-j" jobs] {with-test}
6 | ["dune" "build" "-p" name "@doc"] {with-doc}
7 | ]
8 | maintainer: ["martin@mjambon.com" "rudi.grinberg@gmail.com"]
9 | authors: ["Martin Jambon"]
10 | bug-reports: "https://github.com/mjambon/easy-format/issues"
11 | homepage: "https://github.com/mjambon/easy-format"
12 | doc: "https://mjambon.github.io/easy-format/"
13 | license: "BSD-3-Clause"
14 | dev-repo: "git+https://github.com/mjambon/easy-format.git"
15 | synopsis:
16 | "High-level and functional interface to the Format module of the OCaml standard library"
17 | description: """
18 |
19 | This module offers a high-level and functional interface to the Format module of
20 | the OCaml standard library. It is a pretty-printing facility, i.e. it takes as
21 | input some code represented as a tree and formats this code into the most
22 | visually satisfying result, breaking and indenting lines of code where
23 | appropriate.
24 |
25 | Input data must be first modelled and converted into a tree using 3 kinds of
26 | nodes:
27 |
28 | * atoms
29 | * lists
30 | * labelled nodes
31 |
32 | Atoms represent any text that is guaranteed to be printed as-is. Lists can model
33 | any sequence of items such as arrays of data or lists of definitions that are
34 | labelled with something like "int main", "let x =" or "x:"."""
35 | depends: [
36 | "dune" {>= "1.10"}
37 | "ocaml" {>= "4.02.3"}
38 | ]
39 | url {
40 | src:
41 | "https://github.com/mjambon/easy-format/releases/download/1.3.2/easy-format-1.3.2.tbz"
42 | checksum: [
43 | "sha256=3440c2b882d537ae5e9011eb06abb53f5667e651ea4bb3b460ea8230fa8c1926"
44 | "sha512=e39377a2ff020ceb9ac29e8515a89d9bdbc91dfcfa871c4e3baafa56753fac2896768e5d9822a050dc1e2ade43c8967afb69391a386c0a8ecd4e1f774e236135"
45 | ]
46 | }
47 |
--------------------------------------------------------------------------------
/esy.lock/opam/fix.20220121/opam:
--------------------------------------------------------------------------------
1 |
2 | opam-version: "2.0"
3 | maintainer: "francois.pottier@inria.fr"
4 | authors: [
5 | "François Pottier "
6 | ]
7 | homepage: "https://gitlab.inria.fr/fpottier/fix"
8 | dev-repo: "git+https://gitlab.inria.fr/fpottier/fix.git"
9 | bug-reports: "francois.pottier@inria.fr"
10 | license: "LGPL-2.0-only"
11 | build: [
12 | ["dune" "build" "-p" name "-j" jobs]
13 | ]
14 | depends: [
15 | "ocaml" { >= "4.03" }
16 | "dune" { >= "1.3" }
17 | ]
18 | synopsis: "Algorithmic building blocks for memoization, recursion, and more"
19 | url {
20 | src:
21 | "https://gitlab.inria.fr/fpottier/fix/-/archive/20220121/archive.tar.gz"
22 | checksum: [
23 | "md5=48d8a5bdff23cf7fbf9288877df2b6aa"
24 | "sha512=a851d8783c0c519c6e55359a5c471af433058872409c29a1a7bdfd0076813341ad2c0ebd1ce9e28bff4d4c729dfbc808c41c084fe12a42b45a2b5e391e77ccd2"
25 | ]
26 | }
27 |
--------------------------------------------------------------------------------
/esy.lock/opam/menhir.20220210/opam:
--------------------------------------------------------------------------------
1 |
2 | opam-version: "2.0"
3 | maintainer: "francois.pottier@inria.fr"
4 | authors: [
5 | "François Pottier "
6 | "Yann Régis-Gianas "
7 | ]
8 | homepage: "http://gitlab.inria.fr/fpottier/menhir"
9 | dev-repo: "git+https://gitlab.inria.fr/fpottier/menhir.git"
10 | bug-reports: "https://gitlab.inria.fr/fpottier/menhir/-/issues"
11 | license: "LGPL-2.0-only with OCaml-LGPL-linking-exception"
12 | build: [
13 | ["dune" "build" "-p" name "-j" jobs]
14 | ]
15 | depends: [
16 | "ocaml" {>= "4.03.0"}
17 | "dune" {>= "2.8.0"}
18 | "menhirLib" {= version}
19 | "menhirSdk" {= version}
20 | ]
21 | synopsis: "An LR(1) parser generator"
22 | url {
23 | src:
24 | "https://gitlab.inria.fr/fpottier/menhir/-/archive/20220210/archive.tar.gz"
25 | checksum: [
26 | "md5=e3cef220f676c4b1c16cbccb174cefe3"
27 | "sha512=3063fec1d8b9fe092c8461b0689d426c7fe381a2bf3fd258dc42ceecca1719d32efbb8a18d94ada5555c38175ea352da3adbb239fdbcbcf52c3a5c85a4d9586f"
28 | ]
29 | }
30 |
--------------------------------------------------------------------------------
/esy.lock/opam/menhirLib.20220210/opam:
--------------------------------------------------------------------------------
1 |
2 | opam-version: "2.0"
3 | maintainer: "francois.pottier@inria.fr"
4 | authors: [
5 | "François Pottier "
6 | "Yann Régis-Gianas "
7 | ]
8 | homepage: "http://gitlab.inria.fr/fpottier/menhir"
9 | dev-repo: "git+https://gitlab.inria.fr/fpottier/menhir.git"
10 | bug-reports: "https://gitlab.inria.fr/fpottier/menhir/-/issues"
11 | license: "LGPL-2.0-only with OCaml-LGPL-linking-exception"
12 | build: [
13 | ["dune" "build" "-p" name "-j" jobs]
14 | ]
15 | depends: [
16 | "ocaml" { >= "4.03.0" }
17 | "dune" { >= "2.8.0" }
18 | ]
19 | conflicts: [
20 | "menhir" { != version }
21 | ]
22 | synopsis: "Runtime support library for parsers generated by Menhir"
23 | url {
24 | src:
25 | "https://gitlab.inria.fr/fpottier/menhir/-/archive/20220210/archive.tar.gz"
26 | checksum: [
27 | "md5=e3cef220f676c4b1c16cbccb174cefe3"
28 | "sha512=3063fec1d8b9fe092c8461b0689d426c7fe381a2bf3fd258dc42ceecca1719d32efbb8a18d94ada5555c38175ea352da3adbb239fdbcbcf52c3a5c85a4d9586f"
29 | ]
30 | }
31 |
--------------------------------------------------------------------------------
/esy.lock/opam/menhirSdk.20220210/opam:
--------------------------------------------------------------------------------
1 |
2 | opam-version: "2.0"
3 | maintainer: "francois.pottier@inria.fr"
4 | authors: [
5 | "François Pottier "
6 | "Yann Régis-Gianas "
7 | ]
8 | homepage: "http://gitlab.inria.fr/fpottier/menhir"
9 | dev-repo: "git+https://gitlab.inria.fr/fpottier/menhir.git"
10 | bug-reports: "https://gitlab.inria.fr/fpottier/menhir/-/issues"
11 | license: "LGPL-2.0-only with OCaml-LGPL-linking-exception"
12 | build: [
13 | ["dune" "build" "-p" name "-j" jobs]
14 | ]
15 | depends: [
16 | "ocaml" { >= "4.03.0" }
17 | "dune" { >= "2.8.0" }
18 | ]
19 | conflicts: [
20 | "menhir" { != version }
21 | ]
22 | synopsis: "Compile-time library for auxiliary tools related to Menhir"
23 | url {
24 | src:
25 | "https://gitlab.inria.fr/fpottier/menhir/-/archive/20220210/archive.tar.gz"
26 | checksum: [
27 | "md5=e3cef220f676c4b1c16cbccb174cefe3"
28 | "sha512=3063fec1d8b9fe092c8461b0689d426c7fe381a2bf3fd258dc42ceecca1719d32efbb8a18d94ada5555c38175ea352da3adbb239fdbcbcf52c3a5c85a4d9586f"
29 | ]
30 | }
31 |
--------------------------------------------------------------------------------
/esy.lock/opam/merlin-extend.0.6/opam:
--------------------------------------------------------------------------------
1 | opam-version: "2.0"
2 | maintainer: "Frederic Bour "
3 | authors: "Frederic Bour "
4 | homepage: "https://github.com/let-def/merlin-extend"
5 | bug-reports: "https://github.com/let-def/merlin-extend"
6 | license: "MIT"
7 | dev-repo: "git+https://github.com/let-def/merlin-extend.git"
8 | build: [
9 | ["dune" "subst"] {dev}
10 | ["dune" "build" "-p" name "-j" jobs]
11 | ]
12 | depends: [
13 | "dune" {>= "1.0"}
14 | "cppo" {build & >= "1.1.0"}
15 | "ocaml" {>= "4.02.3"}
16 | ]
17 | synopsis: "A protocol to provide custom frontend to Merlin"
18 | description: """
19 | This protocol allows to replace the OCaml frontend of Merlin.
20 | It extends what used to be done with the `-pp' flag to handle a few more cases."""
21 | doc: "https://let-def.github.io/merlin-extend"
22 | x-commit-hash: "640620568a5f5c7798239ecf7c707c813e3df3cf"
23 | url {
24 | src:
25 | "https://github.com/let-def/merlin-extend/releases/download/v0.6/merlin-extend-v0.6.tbz"
26 | checksum: [
27 | "sha256=c2f236ae97feb6ba0bc90f33beb7b7343e42f9871b66de9ba07974917e256c43"
28 | "sha512=4c64a490e2ece04fc89aef679c1d9202175df4fe045b5fdc7a37cd7cebe861226fddd9648c1bf4f06175ecfcd2ed7686c96bd6a8cae003a5096f6134c240f857"
29 | ]
30 | }
31 |
--------------------------------------------------------------------------------
/esy.lock/opam/merlin.4.4-412/opam:
--------------------------------------------------------------------------------
1 | opam-version: "2.0"
2 | maintainer: "defree@gmail.com"
3 | authors: "The Merlin team"
4 | homepage: "https://github.com/ocaml/merlin"
5 | bug-reports: "https://github.com/ocaml/merlin/issues"
6 | dev-repo: "git+https://github.com/ocaml/merlin.git"
7 | license: "MIT"
8 | build: [
9 | ["dune" "subst"] {dev}
10 | ["dune" "build" "-p" name "-j" jobs]
11 | ["dune" "runtest" "-p" "merlin,dot-merlin-reader" "-j" "1"] {with-test}
12 | ]
13 | depends: [
14 | "ocaml" {>= "4.12" & < "4.13"}
15 | "dune" {>= "2.9.0"}
16 | "dot-merlin-reader" {>= "4.0"}
17 | "yojson" {>= "1.6.0"}
18 | "conf-jq" {with-test}
19 | "csexp" {>= "1.2.3"}
20 | "result" {>= "1.5"}
21 | "menhir" {dev}
22 | "menhirLib" {dev}
23 | "menhirSdk" {dev}
24 | ]
25 | synopsis:
26 | "Editor helper, provides completion, typing and source browsing in Vim and Emacs"
27 | description:
28 | "Merlin is an assistant for editing OCaml code. It aims to provide the features available in modern IDEs: error reporting, auto completion, source browsing and much more."
29 | post-messages: [
30 | "merlin installed.
31 |
32 | Quick setup for VIM
33 | -------------------
34 | Append this to your .vimrc to add merlin to vim's runtime-path:
35 | let g:opamshare = substitute(system('opam var share'),'\\n$','','''')
36 | execute \"set rtp+=\" . g:opamshare . \"/merlin/vim\"
37 |
38 | Also run the following line in vim to index the documentation:
39 | :execute \"helptags \" . g:opamshare . \"/merlin/vim/doc\"
40 |
41 | Quick setup for EMACS
42 | -------------------
43 | Add opam emacs directory to your load-path by appending this to your .emacs:
44 | (let ((opam-share (ignore-errors (car (process-lines \"opam\" \"var\" \"share\")))))
45 | (when (and opam-share (file-directory-p opam-share))
46 | ;; Register Merlin
47 | (add-to-list 'load-path (expand-file-name \"emacs/site-lisp\" opam-share))
48 | (autoload 'merlin-mode \"merlin\" nil t nil)
49 | ;; Automatically start it in OCaml buffers
50 | (add-hook 'tuareg-mode-hook 'merlin-mode t)
51 | (add-hook 'caml-mode-hook 'merlin-mode t)
52 | ;; Use opam switch to lookup ocamlmerlin binary
53 | (setq merlin-command 'opam)))
54 |
55 | Take a look at https://github.com/ocaml/merlin for more information
56 |
57 | Quick setup with opam-user-setup
58 | --------------------------------
59 |
60 | Opam-user-setup support Merlin.
61 |
62 | $ opam user-setup install
63 |
64 | should take care of basic setup.
65 | See https://github.com/OCamlPro/opam-user-setup
66 | "
67 | {success & !user-setup:installed}
68 | ]
69 | url {
70 | src:
71 | "https://github.com/ocaml/merlin/releases/download/v4.4-412/merlin-4.4-412.tbz"
72 | checksum: [
73 | "sha256=16d879496882d44ee0a5392e20b3824240e70f1585b9ae6d936ff5f3a3beb2a3"
74 | "sha512=f51b2875b75215d0be378de86b9dca0957b5e62241ce625a46c6341c219582510d37af94dedf67e1d3db61ebacfef8fa764e4719fac16c0b4b99bb85d0b991d4"
75 | ]
76 | }
77 | x-commit-hash: "5497c563b06f868d72d4f74bd8026c1c1aeb6595"
78 |
--------------------------------------------------------------------------------
/esy.lock/opam/ocaml-compiler-libs.v0.12.4/opam:
--------------------------------------------------------------------------------
1 | opam-version: "2.0"
2 | synopsis: "OCaml compiler libraries repackaged"
3 | description: """
4 | This packages exposes the OCaml compiler libraries repackages under
5 | the toplevel names Ocaml_common, Ocaml_bytecomp, Ocaml_optcomp, ..."""
6 | maintainer: ["Jane Street developers"]
7 | authors: ["Jane Street Group, LLC"]
8 | license: "MIT"
9 | homepage: "https://github.com/janestreet/ocaml-compiler-libs"
10 | bug-reports: "https://github.com/janestreet/ocaml-compiler-libs/issues"
11 | depends: [
12 | "dune" {>= "2.8"}
13 | "ocaml" {>= "4.04.1"}
14 | "odoc" {with-doc}
15 | ]
16 | build: [
17 | ["dune" "subst"] {dev}
18 | [
19 | "dune"
20 | "build"
21 | "-p"
22 | name
23 | "-j"
24 | jobs
25 | "@install"
26 | "@runtest" {with-test}
27 | "@doc" {with-doc}
28 | ]
29 | ]
30 | dev-repo: "git+https://github.com/janestreet/ocaml-compiler-libs.git"
31 | url {
32 | src:
33 | "https://github.com/janestreet/ocaml-compiler-libs/releases/download/v0.12.4/ocaml-compiler-libs-v0.12.4.tbz"
34 | checksum: [
35 | "sha256=4ec9c9ec35cc45c18c7a143761154ef1d7663036a29297f80381f47981a07760"
36 | "sha512=978dba8dfa61f98fa24fda7a9c26c2e837081f37d1685fe636dc19cfc3278a940cf01a10293504b185c406706bc1008bc54313d50f023bcdea6d5ac6c0788b35"
37 | ]
38 | }
39 | x-commit-hash: "8cd12f18bb7171c2b67d661868c4271fae528d93"
40 |
--------------------------------------------------------------------------------
/esy.lock/opam/ocamlfind.1.9.3/opam:
--------------------------------------------------------------------------------
1 | opam-version: "2.0"
2 | synopsis: "A library manager for OCaml"
3 | description: """
4 | Findlib is a library manager for OCaml. It provides a convention how
5 | to store libraries, and a file format ("META") to describe the
6 | properties of libraries. There is also a tool (ocamlfind) for
7 | interpreting the META files, so that it is very easy to use libraries
8 | in programs and scripts.
9 | """
10 | license: "MIT"
11 | maintainer: "Thomas Gazagnaire "
12 | authors: "Gerd Stolpmann "
13 | homepage: "http://projects.camlcity.org/projects/findlib.html"
14 | bug-reports: "https://github.com/ocaml/ocamlfind/issues"
15 | depends: [
16 | "ocaml" {>= "4.00.0"}
17 | ]
18 | depopts: ["graphics"]
19 | build: [
20 | [
21 | "./configure"
22 | "-bindir" bin
23 | "-sitelib" lib
24 | "-mandir" man
25 | "-config" "%{lib}%/findlib.conf"
26 | "-no-custom"
27 | "-no-camlp4" {!ocaml:preinstalled & ocaml:version >= "4.02.0"}
28 | "-no-topfind" {ocaml:preinstalled}
29 | ]
30 | [make "all"]
31 | [make "opt"] {ocaml:native}
32 | ]
33 | install: [
34 | [make "install"]
35 | ["install" "-m" "0755" "ocaml-stub" "%{bin}%/ocaml"] {ocaml:preinstalled}
36 | ]
37 | dev-repo: "git+https://github.com/ocaml/ocamlfind.git"
38 | url {
39 | src: "http://download.camlcity.org/download/findlib-1.9.3.tar.gz"
40 | checksum: [
41 | "md5=24047dd8a0da5322253de9b7aa254e42"
42 | "sha512=27cc4ce141576bf477fb9d61a82ad65f55478740eed59fb43f43edb794140829fd2ff89ad27d8a890cfc336b54c073a06de05b31100fc7c01cacbd7d88e928ea"
43 | ]
44 | }
45 |
--------------------------------------------------------------------------------
/esy.lock/opam/ppx_derivers.1.2.1/opam:
--------------------------------------------------------------------------------
1 | opam-version: "2.0"
2 | maintainer: "jeremie@dimino.org"
3 | authors: ["Jérémie Dimino"]
4 | license: "BSD-3-Clause"
5 | homepage: "https://github.com/ocaml-ppx/ppx_derivers"
6 | bug-reports: "https://github.com/ocaml-ppx/ppx_derivers/issues"
7 | dev-repo: "git+https://github.com/ocaml-ppx/ppx_derivers.git"
8 | build: [
9 | ["dune" "build" "-p" name "-j" jobs]
10 | ]
11 | depends: [
12 | "ocaml"
13 | "dune"
14 | ]
15 | synopsis: "Shared [@@deriving] plugin registry"
16 | description: """
17 | Ppx_derivers is a tiny package whose sole purpose is to allow
18 | ppx_deriving and ppx_type_conv to inter-operate gracefully when linked
19 | as part of the same ocaml-migrate-parsetree driver."""
20 | url {
21 | src: "https://github.com/ocaml-ppx/ppx_derivers/archive/1.2.1.tar.gz"
22 | checksum: "md5=5dc2bf130c1db3c731fe0fffc5648b41"
23 | }
24 |
--------------------------------------------------------------------------------
/esy.lock/opam/ppxlib.0.24.0/opam:
--------------------------------------------------------------------------------
1 | opam-version: "2.0"
2 | synopsis: "Standard library for ppx rewriters"
3 | description: """
4 | Ppxlib is the standard library for ppx rewriters and other programs
5 | that manipulate the in-memory reprensation of OCaml programs, a.k.a
6 | the "Parsetree".
7 |
8 | It also comes bundled with two ppx rewriters that are commonly used to
9 | write tools that manipulate and/or generate Parsetree values;
10 | `ppxlib.metaquot` which allows to construct Parsetree values using the
11 | OCaml syntax directly and `ppxlib.traverse` which provides various
12 | ways of automatically traversing values of a given type, in particular
13 | allowing to inject a complex structured value into generated code.
14 | """
15 | maintainer: ["opensource@janestreet.com"]
16 | authors: ["Jane Street Group, LLC "]
17 | license: "MIT"
18 | homepage: "https://github.com/ocaml-ppx/ppxlib"
19 | doc: "https://ocaml-ppx.github.io/ppxlib/"
20 | bug-reports: "https://github.com/ocaml-ppx/ppxlib/issues"
21 | depends: [
22 | "dune" {>= "2.7"}
23 | "ocaml" {>= "4.04.1" & < "4.15"}
24 | "ocaml-compiler-libs" {>= "v0.11.0"}
25 | "ppx_derivers" {>= "1.0"}
26 | "sexplib0" {>= "v0.12"}
27 | "stdlib-shims"
28 | "ocamlfind" {with-test}
29 | "re" {with-test & >= "1.9.0"}
30 | "cinaps" {with-test & >= "v0.12.1"}
31 | "base" {with-test}
32 | "stdio" {with-test}
33 | "odoc" {with-doc}
34 | ]
35 | conflicts: [
36 | "ocaml-migrate-parsetree" {< "2.0.0"}
37 | "base-effects"
38 | ]
39 | build: [
40 | ["dune" "subst"] {dev}
41 | [
42 | "dune"
43 | "build"
44 | "-p"
45 | name
46 | "-j"
47 | jobs
48 | "@install"
49 | "@runtest" {with-test}
50 | "@doc" {with-doc}
51 | ]
52 | ]
53 | dev-repo: "git+https://github.com/ocaml-ppx/ppxlib.git"
54 | url {
55 | src:
56 | "https://github.com/ocaml-ppx/ppxlib/releases/download/0.24.0/ppxlib-0.24.0.tbz"
57 | checksum: [
58 | "sha256=7766027c2ecd0f5b3b460e9212a70709c6744278113eb91f317c56c41e7a90c8"
59 | "sha512=726e48899c43f8bee1935618827e68b2953753a62868e424a2dadf2e156cc60794abacea658686a8a160eccde0f75b95b98daacf2b9242b4f86a92798d47b597"
60 | ]
61 | }
62 | x-commit-hash: "3d858b04613833fec7e2b5f5be25d45bfd354649"
63 |
--------------------------------------------------------------------------------
/esy.lock/opam/reason.3.7.0/opam:
--------------------------------------------------------------------------------
1 | opam-version: "2.0"
2 | maintainer: "Jordan Walke "
3 | authors: [ "Jordan Walke " ]
4 | license: "MIT"
5 | homepage: "https://github.com/facebook/reason"
6 | doc: "http://reasonml.github.io/"
7 | bug-reports: "https://github.com/facebook/reason/issues"
8 | dev-repo: "git+https://github.com/facebook/reason.git"
9 | tags: [ "syntax" ]
10 | build: [
11 | ["dune" "build" "-p" name "-j" jobs]
12 | ]
13 | depends: [
14 | "ocaml" {>= "4.03" & < "4.13"}
15 | "dune" {>= "1.4"}
16 | "ocamlfind" {build}
17 | "menhir" {>= "20180523"}
18 | "merlin-extend" {>= "0.6"}
19 | "ppx_derivers" {< "2.0"}
20 | "fix"
21 | "result"
22 | ]
23 | synopsis: "Reason: Syntax & Toolchain for OCaml"
24 | description: """
25 | Reason gives OCaml a new syntax that is remniscient of languages like
26 | JavaScript. It's also the umbrella project for a set of tools for the OCaml &
27 | JavaScript ecosystem."""
28 | url {
29 | src: "https://registry.npmjs.org/@esy-ocaml/reason/-/reason-3.7.0.tgz"
30 | checksum: "md5=7eb8cbbff8565b93ebfabf4eca7254d4"
31 | }
32 |
--------------------------------------------------------------------------------
/esy.lock/opam/result.1.5/opam:
--------------------------------------------------------------------------------
1 | opam-version: "2.0"
2 | maintainer: "Jane Street developers"
3 | authors: ["Jane Street Group, LLC"]
4 | homepage: "https://github.com/janestreet/result"
5 | dev-repo: "git+https://github.com/janestreet/result.git"
6 | bug-reports: "https://github.com/janestreet/result/issues"
7 | license: "BSD-3-Clause"
8 | build: [["dune" "build" "-p" name "-j" jobs]]
9 | depends: [
10 | "ocaml"
11 | "dune" {>= "1.0"}
12 | ]
13 | synopsis: "Compatibility Result module"
14 | description: """
15 | Projects that want to use the new result type defined in OCaml >= 4.03
16 | while staying compatible with older version of OCaml should use the
17 | Result module defined in this library."""
18 | url {
19 | src:
20 | "https://github.com/janestreet/result/releases/download/1.5/result-1.5.tbz"
21 | checksum: "md5=1b82dec78849680b49ae9a8a365b831b"
22 | }
23 |
--------------------------------------------------------------------------------
/esy.lock/opam/sexplib0.v0.14.0/opam:
--------------------------------------------------------------------------------
1 | opam-version: "2.0"
2 | maintainer: "Jane Street developers"
3 | authors: ["Jane Street Group, LLC"]
4 | homepage: "https://github.com/janestreet/sexplib0"
5 | bug-reports: "https://github.com/janestreet/sexplib0/issues"
6 | dev-repo: "git+https://github.com/janestreet/sexplib0.git"
7 | doc: "https://ocaml.janestreet.com/ocaml-core/latest/doc/sexplib0/index.html"
8 | license: "MIT"
9 | build: [
10 | ["dune" "build" "-p" name "-j" jobs]
11 | ]
12 | depends: [
13 | "ocaml" {>= "4.04.2"}
14 | "dune" {>= "2.0.0"}
15 | ]
16 | synopsis: "Library containing the definition of S-expressions and some base converters"
17 | description: "
18 | Part of Jane Street's Core library
19 | The Core suite of libraries is an industrial strength alternative to
20 | OCaml's standard library that was developed by Jane Street, the
21 | largest industrial user of OCaml.
22 | "
23 | url {
24 | src: "https://ocaml.janestreet.com/ocaml-core/v0.14/files/sexplib0-v0.14.0.tar.gz"
25 | checksum: "md5=37aff0af8f8f6f759249475684aebdc4"
26 | }
27 |
--------------------------------------------------------------------------------
/esy.lock/opam/stdlib-shims.0.3.0/opam:
--------------------------------------------------------------------------------
1 | opam-version: "2.0"
2 | maintainer: "The stdlib-shims programmers"
3 | authors: "The stdlib-shims programmers"
4 | homepage: "https://github.com/ocaml/stdlib-shims"
5 | doc: "https://ocaml.github.io/stdlib-shims/"
6 | dev-repo: "git+https://github.com/ocaml/stdlib-shims.git"
7 | bug-reports: "https://github.com/ocaml/stdlib-shims/issues"
8 | tags: ["stdlib" "compatibility" "org:ocaml"]
9 | license: ["typeof OCaml system"]
10 | depends: [
11 | "dune"
12 | "ocaml" {>= "4.02.3"}
13 | ]
14 | build: [ "dune" "build" "-p" name "-j" jobs ]
15 | synopsis: "Backport some of the new stdlib features to older compiler"
16 | description: """
17 | Backport some of the new stdlib features to older compiler,
18 | such as the Stdlib module.
19 |
20 | This allows projects that require compatibility with older compiler to
21 | use these new features in their code.
22 | """
23 | x-commit-hash: "fb6815e5d745f07fd567c11671149de6ef2e74c8"
24 | url {
25 | src:
26 | "https://github.com/ocaml/stdlib-shims/releases/download/0.3.0/stdlib-shims-0.3.0.tbz"
27 | checksum: [
28 | "sha256=babf72d3917b86f707885f0c5528e36c63fccb698f4b46cf2bab5c7ccdd6d84a"
29 | "sha512=1151d7edc8923516e9a36995a3f8938d323aaade759ad349ed15d6d8501db61ffbe63277e97c4d86149cf371306ac23df0f581ec7e02611f58335126e1870980"
30 | ]
31 | }
32 |
--------------------------------------------------------------------------------
/esy.lock/opam/yojson.1.7.0/opam:
--------------------------------------------------------------------------------
1 | opam-version: "2.0"
2 | maintainer: "martin@mjambon.com"
3 | authors: ["Martin Jambon"]
4 | homepage: "https://github.com/ocaml-community/yojson"
5 | bug-reports: "https://github.com/ocaml-community/yojson/issues"
6 | dev-repo: "git+https://github.com/ocaml-community/yojson.git"
7 | doc: "https://ocaml-community.github.io/yojson/"
8 | build: [
9 | ["dune" "subst"] {dev}
10 | ["dune" "build" "-p" name "-j" jobs]
11 | ]
12 | run-test: [["dune" "runtest" "-p" name "-j" jobs]]
13 | depends: [
14 | "ocaml" {>= "4.02.3"}
15 | "dune"
16 | "cppo" {build}
17 | "easy-format"
18 | "biniou" {>= "1.2.0"}
19 | "alcotest" {with-test & >= "0.8.5"}
20 | ]
21 | synopsis:
22 | "Yojson is an optimized parsing and printing library for the JSON format"
23 | description: """
24 | Yojson is an optimized parsing and printing library for the JSON format.
25 |
26 | It addresses a few shortcomings of json-wheel including 2x speedup,
27 | polymorphic variants and optional syntax for tuples and variants.
28 |
29 | ydump is a pretty-printing command-line program provided with the
30 | yojson package.
31 |
32 | The program atdgen can be used to derive OCaml-JSON serializers and
33 | deserializers from type definitions."""
34 | url {
35 | src:
36 | "https://github.com/ocaml-community/yojson/releases/download/1.7.0/yojson-1.7.0.tbz"
37 | checksum: "md5=b89d39ca3f8c532abe5f547ad3b8f84d"
38 | }
39 |
--------------------------------------------------------------------------------
/esy.lock/overrides/opam__s__ocamlfind_opam__c__1.9.3_opam_override/files/findlib.patch:
--------------------------------------------------------------------------------
1 | --- ./Makefile
2 | +++ ./Makefile
3 | @@ -57,16 +57,16 @@
4 | cat findlib.conf.in | \
5 | $(SH) tools/patch '@SITELIB@' '$(OCAML_SITELIB)' >findlib.conf
6 | if ./tools/cmd_from_same_dir ocamlc; then \
7 | - echo 'ocamlc="ocamlc.opt"' >>findlib.conf; \
8 | + echo 'ocamlc="ocamlc.opt$(EXEC_SUFFIX)"' >>findlib.conf; \
9 | fi
10 | if ./tools/cmd_from_same_dir ocamlopt; then \
11 | - echo 'ocamlopt="ocamlopt.opt"' >>findlib.conf; \
12 | + echo 'ocamlopt="ocamlopt.opt$(EXEC_SUFFIX)"' >>findlib.conf; \
13 | fi
14 | if ./tools/cmd_from_same_dir ocamldep; then \
15 | - echo 'ocamldep="ocamldep.opt"' >>findlib.conf; \
16 | + echo 'ocamldep="ocamldep.opt$(EXEC_SUFFIX)"' >>findlib.conf; \
17 | fi
18 | if ./tools/cmd_from_same_dir ocamldoc; then \
19 | - echo 'ocamldoc="ocamldoc.opt"' >>findlib.conf; \
20 | + echo 'ocamldoc="ocamldoc.opt$(EXEC_SUFFIX)"' >>findlib.conf; \
21 | fi
22 |
23 | .PHONY: install-doc
24 | --- ./src/findlib/findlib_config.mlp
25 | +++ ./src/findlib/findlib_config.mlp
26 | @@ -24,3 +24,5 @@
27 | | "MacOS" -> "" (* don't know *)
28 | | _ -> failwith "Unknown Sys.os_type"
29 | ;;
30 | +
31 | +let exec_suffix = "@EXEC_SUFFIX@";;
32 | --- ./src/findlib/findlib.ml
33 | +++ ./src/findlib/findlib.ml
34 | @@ -28,15 +28,20 @@
35 | let conf_ldconf = ref "";;
36 | let conf_ignore_dups_in = ref ([] : string list);;
37 |
38 | -let ocamlc_default = "ocamlc";;
39 | -let ocamlopt_default = "ocamlopt";;
40 | -let ocamlcp_default = "ocamlcp";;
41 | -let ocamloptp_default = "ocamloptp";;
42 | -let ocamlmklib_default = "ocamlmklib";;
43 | -let ocamlmktop_default = "ocamlmktop";;
44 | -let ocamldep_default = "ocamldep";;
45 | -let ocamlbrowser_default = "ocamlbrowser";;
46 | -let ocamldoc_default = "ocamldoc";;
47 | +let add_exec str =
48 | + match Findlib_config.exec_suffix with
49 | + | "" -> str
50 | + | a -> str ^ a ;;
51 | +let ocamlc_default = add_exec "ocamlc";;
52 | +let ocamlopt_default = add_exec "ocamlopt";;
53 | +let ocamlcp_default = add_exec "ocamlcp";;
54 | +let ocamloptp_default = add_exec "ocamloptp";;
55 | +let ocamlmklib_default = add_exec "ocamlmklib";;
56 | +let ocamlmktop_default = add_exec "ocamlmktop";;
57 | +let ocamldep_default = add_exec "ocamldep";;
58 | +let ocamlbrowser_default = add_exec "ocamlbrowser";;
59 | +let ocamldoc_default = add_exec "ocamldoc";;
60 | +
61 |
62 |
63 | let init_manually
64 | --- ./src/findlib/fl_package_base.ml
65 | +++ ./src/findlib/fl_package_base.ml
66 | @@ -133,7 +133,15 @@
67 | List.find (fun def -> def.def_var = "exists_if") p.package_defs in
68 | let files = Fl_split.in_words def.def_value in
69 | List.exists
70 | - (fun file -> Sys.file_exists (Filename.concat d' file))
71 | + (fun file ->
72 | + let fln = Filename.concat d' file in
73 | + let e = Sys.file_exists fln in
74 | + (* necessary for ppx executables *)
75 | + if e || Sys.os_type <> "Win32" || Filename.check_suffix fln ".exe" then
76 | + e
77 | + else
78 | + Sys.file_exists (fln ^ ".exe")
79 | + )
80 | files
81 | with Not_found -> true in
82 |
83 | --- ./src/findlib/fl_split.ml
84 | +++ ./src/findlib/fl_split.ml
85 | @@ -126,10 +126,17 @@
86 | | '/' | '\\' -> true
87 | | _ -> false in
88 | let norm_dir_win() =
89 | - if l >= 1 && s.[0] = '/' then
90 | - Buffer.add_char b '\\' else Buffer.add_char b s.[0];
91 | - if l >= 2 && s.[1] = '/' then
92 | - Buffer.add_char b '\\' else Buffer.add_char b s.[1];
93 | + if l >= 1 then (
94 | + if s.[0] = '/' then
95 | + Buffer.add_char b '\\'
96 | + else
97 | + Buffer.add_char b s.[0] ;
98 | + if l >= 2 then
99 | + if s.[1] = '/' then
100 | + Buffer.add_char b '\\'
101 | + else
102 | + Buffer.add_char b s.[1];
103 | + );
104 | for k = 2 to l - 1 do
105 | let c = s.[k] in
106 | if is_slash c then (
107 | --- ./src/findlib/frontend.ml
108 | +++ ./src/findlib/frontend.ml
109 | @@ -31,10 +31,18 @@
110 | else
111 | Sys_error (arg ^ ": " ^ Unix.error_message code)
112 |
113 | +let is_win = Sys.os_type = "Win32"
114 | +
115 | +let () =
116 | + match Findlib_config.system with
117 | + | "win32" | "win64" | "mingw" | "cygwin" | "mingw64" | "cygwin64" ->
118 | + (try set_binary_mode_out stdout true with _ -> ());
119 | + (try set_binary_mode_out stderr true with _ -> ());
120 | + | _ -> ()
121 |
122 | let slashify s =
123 | match Findlib_config.system with
124 | - | "mingw" | "mingw64" | "cygwin" ->
125 | + | "win32" | "win64" | "mingw" | "cygwin" | "mingw64" | "cygwin64" ->
126 | let b = Buffer.create 80 in
127 | String.iter
128 | (function
129 | @@ -49,7 +57,7 @@
130 |
131 | let out_path ?(prefix="") s =
132 | match Findlib_config.system with
133 | - | "mingw" | "mingw64" | "cygwin" ->
134 | + | "win32" | "win64" | "mingw" | "mingw64" | "cygwin" ->
135 | let u = slashify s in
136 | prefix ^
137 | (if String.contains u ' ' then
138 | @@ -273,11 +281,9 @@
139 |
140 |
141 | let identify_dir d =
142 | - match Sys.os_type with
143 | - | "Win32" ->
144 | - failwith "identify_dir" (* not available *)
145 | - | _ ->
146 | - let s = Unix.stat d in
147 | + if is_win then
148 | + failwith "identify_dir"; (* not available *)
149 | + let s = Unix.stat d in
150 | (s.Unix.st_dev, s.Unix.st_ino)
151 | ;;
152 |
153 | @@ -459,6 +465,96 @@
154 | )
155 | packages
156 |
157 | +let rewrite_cmd s =
158 | + if s = "" || not is_win then
159 | + s
160 | + else
161 | + let s =
162 | + let l = String.length s in
163 | + let b = Buffer.create l in
164 | + for i = 0 to pred l do
165 | + match s.[i] with
166 | + | '/' -> Buffer.add_char b '\\'
167 | + | x -> Buffer.add_char b x
168 | + done;
169 | + Buffer.contents b
170 | + in
171 | + if (Filename.is_implicit s && String.contains s '\\' = false) ||
172 | + Filename.check_suffix (String.lowercase s) ".exe" then
173 | + s
174 | + else
175 | + let s' = s ^ ".exe" in
176 | + if Sys.file_exists s' then
177 | + s'
178 | + else
179 | + s
180 | +
181 | +let rewrite_cmd s =
182 | + if s = "" || not is_win then s else
183 | + let s =
184 | + let l = String.length s in
185 | + let b = Buffer.create l in
186 | + for i = 0 to pred l do
187 | + match s.[i] with
188 | + | '/' -> Buffer.add_char b '\\'
189 | + | x -> Buffer.add_char b x
190 | + done;
191 | + Buffer.contents b
192 | + in
193 | + if (Filename.is_implicit s && String.contains s '\\' = false) ||
194 | + Filename.check_suffix (String.lowercase s) ".exe" then
195 | + s
196 | + else
197 | + let s' = s ^ ".exe" in
198 | + if Sys.file_exists s' then
199 | + s'
200 | + else
201 | + s
202 | +
203 | +let rewrite_pp cmd =
204 | + if not is_win then cmd else
205 | + let module T = struct exception Keep end in
206 | + let is_whitespace = function
207 | + | ' ' | '\011' | '\012' | '\n' | '\r' | '\t' -> true
208 | + | _ -> false in
209 | + (* characters that triggers special behaviour (cmd.exe, not unix shell) *)
210 | + let is_unsafe_char = function
211 | + | '(' | ')' | '%' | '!' | '^' | '<' | '>' | '&' -> true
212 | + | _ -> false in
213 | + let len = String.length cmd in
214 | + let buf = Buffer.create (len + 4) in
215 | + let buf_cmd = Buffer.create len in
216 | + let rec iter_ws i =
217 | + if i >= len then () else
218 | + let cur = cmd.[i] in
219 | + if is_whitespace cur then (
220 | + Buffer.add_char buf cur;
221 | + iter_ws (succ i)
222 | + )
223 | + else
224 | + iter_cmd i
225 | + and iter_cmd i =
226 | + if i >= len then add_buf_cmd () else
227 | + let cur = cmd.[i] in
228 | + if is_unsafe_char cur || cur = '"' || cur = '\'' then
229 | + raise T.Keep;
230 | + if is_whitespace cur then (
231 | + add_buf_cmd ();
232 | + Buffer.add_substring buf cmd i (len - i)
233 | + )
234 | + else (
235 | + Buffer.add_char buf_cmd cur;
236 | + iter_cmd (succ i)
237 | + )
238 | + and add_buf_cmd () =
239 | + if Buffer.length buf_cmd > 0 then
240 | + Buffer.add_string buf (rewrite_cmd (Buffer.contents buf_cmd))
241 | + in
242 | + try
243 | + iter_ws 0;
244 | + Buffer.contents buf
245 | + with
246 | + | T.Keep -> cmd
247 |
248 | let process_pp_spec syntax_preds packages pp_opts =
249 | (* Returns: pp_command *)
250 | @@ -549,7 +645,7 @@
251 | None -> []
252 | | Some cmd ->
253 | ["-pp";
254 | - cmd ^ " " ^
255 | + (rewrite_cmd cmd) ^ " " ^
256 | String.concat " " (List.map Filename.quote pp_i_options) ^ " " ^
257 | String.concat " " (List.map Filename.quote pp_archives) ^ " " ^
258 | String.concat " " (List.map Filename.quote pp_opts)]
259 | @@ -625,9 +721,11 @@
260 | in
261 | try
262 | let preprocessor =
263 | + rewrite_cmd (
264 | resolve_path
265 | ~base ~explicit:true
266 | - (package_property predicates pname "ppx") in
267 | + (package_property predicates pname "ppx") )
268 | + in
269 | ["-ppx"; String.concat " " (preprocessor :: options)]
270 | with Not_found -> []
271 | )
272 | @@ -895,6 +993,14 @@
273 | switch (e.g. -L instead of -L )
274 | *)
275 |
276 | +(* We may need to remove files on which we do not have complete control.
277 | + On Windows, removing a read-only file fails so try to change the
278 | + mode of the file first. *)
279 | +let remove_file fname =
280 | + try Sys.remove fname
281 | + with Sys_error _ when is_win ->
282 | + (try Unix.chmod fname 0o666 with Unix.Unix_error _ -> ());
283 | + Sys.remove fname
284 |
285 | let ocamlc which () =
286 |
287 | @@ -1022,9 +1128,12 @@
288 |
289 | "-intf",
290 | Arg.String (fun s -> pass_files := !pass_files @ [ Intf(slashify s) ]);
291 | -
292 | +
293 | "-pp",
294 | - Arg.String (fun s -> pp_specified := true; add_spec_fn "-pp" s);
295 | + Arg.String (fun s -> pp_specified := true; add_spec_fn "-pp" (rewrite_pp s));
296 | +
297 | + "-ppx",
298 | + Arg.String (fun s -> add_spec_fn "-ppx" (rewrite_pp s));
299 |
300 | "-thread",
301 | Arg.Unit (fun _ -> threads := threads_default);
302 | @@ -1237,7 +1346,7 @@
303 | with
304 | any ->
305 | close_out initl;
306 | - Sys.remove initl_file_name;
307 | + remove_file initl_file_name;
308 | raise any
309 | end;
310 |
311 | @@ -1245,9 +1354,9 @@
312 | at_exit
313 | (fun () ->
314 | let tr f x = try f x with _ -> () in
315 | - tr Sys.remove initl_file_name;
316 | - tr Sys.remove (Filename.chop_extension initl_file_name ^ ".cmi");
317 | - tr Sys.remove (Filename.chop_extension initl_file_name ^ ".cmo");
318 | + tr remove_file initl_file_name;
319 | + tr remove_file (Filename.chop_extension initl_file_name ^ ".cmi");
320 | + tr remove_file (Filename.chop_extension initl_file_name ^ ".cmo");
321 | );
322 |
323 | let exclude_list = [ stdlibdir; threads_dir; vmthreads_dir ] in
324 | @@ -1493,7 +1602,9 @@
325 | [ "-v", Arg.Unit (fun () -> verbose := Verbose);
326 | "-pp", Arg.String (fun s ->
327 | pp_specified := true;
328 | - options := !options @ ["-pp"; s]);
329 | + options := !options @ ["-pp"; rewrite_pp s]);
330 | + "-ppx", Arg.String (fun s ->
331 | + options := !options @ ["-ppx"; rewrite_pp s]);
332 | ]
333 | )
334 | )
335 | @@ -1672,7 +1783,9 @@
336 | Arg.String (fun s -> add_spec_fn "-I" (slashify (resolve_path s)));
337 |
338 | "-pp", Arg.String (fun s -> pp_specified := true;
339 | - add_spec_fn "-pp" s);
340 | + add_spec_fn "-pp" (rewrite_pp s));
341 | + "-ppx", Arg.String (fun s -> add_spec_fn "-ppx" (rewrite_pp s));
342 | +
343 | ]
344 | )
345 | )
346 | @@ -1830,7 +1943,10 @@
347 | output_string ch_out append;
348 | close_out ch_out;
349 | close_in ch_in;
350 | - Unix.utimes outpath s.Unix.st_mtime s.Unix.st_mtime;
351 | + (try Unix.utimes outpath s.Unix.st_mtime s.Unix.st_mtime
352 | + with Unix.Unix_error(e,_,_) ->
353 | + prerr_endline("Warning: setting utimes for " ^ outpath
354 | + ^ ": " ^ Unix.error_message e));
355 |
356 | prerr_endline("Installed " ^ outpath);
357 | with
358 | @@ -1882,6 +1998,8 @@
359 | Unix.openfile (Filename.concat dir owner_file) [Unix.O_RDONLY] 0 in
360 | let f =
361 | Unix.in_channel_of_descr fd in
362 | + if is_win then
363 | + set_binary_mode_in f false;
364 | try
365 | let line = input_line f in
366 | let is_my_file = (line = pkg) in
367 | @@ -2208,7 +2326,7 @@
368 | let lines = read_ldconf !ldconf in
369 | let dlldir_norm = Fl_split.norm_dir dlldir in
370 | let dlldir_norm_lc = string_lowercase_ascii dlldir_norm in
371 | - let ci_filesys = (Sys.os_type = "Win32") in
372 | + let ci_filesys = is_win in
373 | let check_dir d =
374 | let d' = Fl_split.norm_dir d in
375 | (d' = dlldir_norm) ||
376 | @@ -2356,7 +2474,7 @@
377 | List.iter
378 | (fun file ->
379 | let absfile = Filename.concat dlldir file in
380 | - Sys.remove absfile;
381 | + remove_file absfile;
382 | prerr_endline ("Removed " ^ absfile)
383 | )
384 | dll_files
385 | @@ -2365,7 +2483,7 @@
386 | (* Remove the files from the package directory: *)
387 | if Sys.file_exists pkgdir then begin
388 | let files = Sys.readdir pkgdir in
389 | - Array.iter (fun f -> Sys.remove (Filename.concat pkgdir f)) files;
390 | + Array.iter (fun f -> remove_file (Filename.concat pkgdir f)) files;
391 | Unix.rmdir pkgdir;
392 | prerr_endline ("Removed " ^ pkgdir)
393 | end
394 | @@ -2415,7 +2533,9 @@
395 |
396 |
397 | let print_configuration() =
398 | + let sl = slashify in
399 | let dir s =
400 | + let s = sl s in
401 | if Sys.file_exists s then
402 | s
403 | else
404 | @@ -2453,27 +2573,27 @@
405 | if md = "" then "the corresponding package directories" else dir md
406 | );
407 | Printf.printf "The standard library is assumed to reside in:\n %s\n"
408 | - (Findlib.ocaml_stdlib());
409 | + (sl (Findlib.ocaml_stdlib()));
410 | Printf.printf "The ld.conf file can be found here:\n %s\n"
411 | - (Findlib.ocaml_ldconf());
412 | + (sl (Findlib.ocaml_ldconf()));
413 | flush stdout
414 | | Some "conf" ->
415 | - print_endline (Findlib.config_file())
416 | + print_endline (sl (Findlib.config_file()))
417 | | Some "path" ->
418 | - List.iter print_endline (Findlib.search_path())
419 | + List.iter ( fun x -> print_endline (sl x)) (Findlib.search_path())
420 | | Some "destdir" ->
421 | - print_endline (Findlib.default_location())
422 | + print_endline ( sl (Findlib.default_location()))
423 | | Some "metadir" ->
424 | - print_endline (Findlib.meta_directory())
425 | + print_endline ( sl (Findlib.meta_directory()))
426 | | Some "metapath" ->
427 | let mdir = Findlib.meta_directory() in
428 | let ddir = Findlib.default_location() in
429 | - print_endline
430 | - (if mdir <> "" then mdir ^ "/META.%s" else ddir ^ "/%s/META")
431 | + print_endline ( sl
432 | + (if mdir <> "" then mdir ^ "/META.%s" else ddir ^ "/%s/META"))
433 | | Some "stdlib" ->
434 | - print_endline (Findlib.ocaml_stdlib())
435 | + print_endline ( sl (Findlib.ocaml_stdlib()))
436 | | Some "ldconf" ->
437 | - print_endline (Findlib.ocaml_ldconf())
438 | + print_endline ( sl (Findlib.ocaml_ldconf()))
439 | | _ ->
440 | assert false
441 | ;;
442 | @@ -2481,7 +2601,7 @@
443 |
444 | let ocamlcall pkg cmd =
445 | let dir = package_directory pkg in
446 | - let path = Filename.concat dir cmd in
447 | + let path = rewrite_cmd (Filename.concat dir cmd) in
448 | begin
449 | try Unix.access path [ Unix.X_OK ]
450 | with
451 | @@ -2647,6 +2767,10 @@
452 | | Sys_error f ->
453 | prerr_endline ("ocamlfind: " ^ f);
454 | exit 2
455 | + | Unix.Unix_error (e, fn, f) ->
456 | + prerr_endline ("ocamlfind: " ^ fn ^ " " ^ f
457 | + ^ ": " ^ Unix.error_message e);
458 | + exit 2
459 | | Findlib.No_such_package(pkg,info) ->
460 | prerr_endline ("ocamlfind: Package `" ^ pkg ^ "' not found" ^
461 | (if info <> "" then " - " ^ info else ""));
462 | --- ./src/findlib/Makefile
463 | +++ ./src/findlib/Makefile
464 | @@ -90,6 +90,7 @@
465 | cat findlib_config.mlp | \
466 | $(SH) $(TOP)/tools/patch '@CONFIGFILE@' '$(OCAMLFIND_CONF)' | \
467 | $(SH) $(TOP)/tools/patch '@STDLIB@' '$(OCAML_CORE_STDLIB)' | \
468 | + $(SH) $(TOP)/tools/patch '@EXEC_SUFFIX@' '$(EXEC_SUFFIX)' | \
469 | sed -e 's;@AUTOLINK@;$(OCAML_AUTOLINK);g' \
470 | -e 's;@SYSTEM@;$(SYSTEM);g' \
471 | >findlib_config.ml
472 |
--------------------------------------------------------------------------------
/esy.lock/overrides/opam__s__ocamlfind_opam__c__1.9.3_opam_override/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "build": [
3 | [
4 | "bash",
5 | "-c",
6 | "#{os == 'windows' ? 'patch -p1 < findlib.patch' : 'true'}"
7 | ],
8 | [
9 | "./configure",
10 | "-bindir",
11 | "#{self.bin}",
12 | "-sitelib",
13 | "#{self.lib}",
14 | "-mandir",
15 | "#{self.man}",
16 | "-config",
17 | "#{self.lib}/findlib.conf",
18 | "-no-custom",
19 | "-no-topfind"
20 | ],
21 | [
22 | "make",
23 | "all"
24 | ],
25 | [
26 | "make",
27 | "opt"
28 | ]
29 | ],
30 | "install": [
31 | [
32 | "make",
33 | "install"
34 | ],
35 | [
36 | "install",
37 | "-m",
38 | "0755",
39 | "ocaml-stub",
40 | "#{self.bin}/ocaml"
41 | ],
42 | [
43 | "mkdir",
44 | "-p",
45 | "#{self.toplevel}"
46 | ],
47 | [
48 | "install",
49 | "-m",
50 | "0644",
51 | "src/findlib/topfind",
52 | "#{self.toplevel}/topfind"
53 | ]
54 | ],
55 | "exportedEnv": {
56 | "OCAML_TOPLEVEL_PATH": {
57 | "val": "#{self.toplevel}",
58 | "scope": "global"
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/examples/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | "@babel/preset-env"
4 | ]
5 | }
6 |
--------------------------------------------------------------------------------
/examples/.envrc:
--------------------------------------------------------------------------------
1 | use_nix
2 |
--------------------------------------------------------------------------------
/examples/bsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "rescript-linaria-examples",
3 | "sources": [
4 | "src"
5 | ],
6 | "bs-dependencies": [
7 | "@rescript/react",
8 | "rescript-classnames"
9 | ],
10 | "refmt": 3,
11 | "reason": {
12 | "react-jsx": 3
13 | },
14 | "bsc-flags": [
15 | "-open Belt",
16 | "-open Cx"
17 | ],
18 | "ppx-flags": [
19 | "../_build/default/bin/bin.exe"
20 | ],
21 | "suffix": ".bs.js",
22 | "package-specs": {
23 | "module": "es6",
24 | "in-source": true
25 | },
26 | "warnings": {
27 | "number": "+A-40-42-44"
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/examples/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "rescript-linaria-examples",
3 | "version": "0.0.0",
4 | "author": "Alex Fedoseev ",
5 | "private": true,
6 | "scripts": {
7 | "start": "webpack serve",
8 | "prestart": "rescript build",
9 | "watch": "rescript build -w"
10 | },
11 | "dependencies": {
12 | "rescript": "9.1.4",
13 | "polished": "4.0.4",
14 | "rescript-classnames": "6.0.0",
15 | "react": "17.0.1",
16 | "react-dom": "17.0.1",
17 | "@rescript/react": "0.10.3"
18 | },
19 | "devDependencies": {
20 | "@babel/core": "7.12.7",
21 | "@babel/preset-env": "7.12.7",
22 | "@linaria/babel": "3.0.0-beta.0",
23 | "@linaria/core": "3.0.0-beta.0",
24 | "@linaria/shaker": "3.0.0-beta.0",
25 | "@linaria/webpack4-loader": "3.0.0-beta.0",
26 | "babel-loader": "8.2.1",
27 | "css-loader": "5.0.1",
28 | "html-webpack-plugin": "4.5.0",
29 | "style-loader": "2.0.0",
30 | "webpack": "4.44.2",
31 | "webpack-cli": "4.2.0",
32 | "webpack-dev-server": "3.11.0"
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/examples/shell.nix:
--------------------------------------------------------------------------------
1 | with (import {});
2 |
3 | mkShell {
4 | buildInputs = [
5 | nodejs-16_x
6 | ];
7 |
8 | shellHook = ''
9 | export PATH="$PWD/node_modules/.bin/:$PATH";
10 | '';
11 | }
12 |
--------------------------------------------------------------------------------
/examples/src/App.res:
--------------------------------------------------------------------------------
1 | include GlobalStyles
2 |
3 | module Css = %css(
4 | let pad = 5
5 | let size = 200
6 | let ten = () => 10
7 | let ident = x => x
8 | let sum = (x, y) => x + y
9 |
10 | let flex = css`
11 | display: flex;
12 | position: relative;
13 | align-items: center;
14 | justify-content: center;
15 | `
16 |
17 | let box = css`
18 | margin: ${ten()}px;
19 | padding: ${pad}px;
20 | width: ${size->ident}px;
21 | height: ${size->ident}px;
22 | border: 6px solid ${Color.Border.bg->Polished.lighten(0.3)};
23 | background-color: ${Color.bg};
24 | border-radius: ${Size.md / 2}px;
25 |
26 | &:hover .${text} {
27 | background-color: blue;
28 | }
29 |
30 | @media ${Screen.small} {
31 | width: ${size - 20}px;
32 | height: ${size - 20}px;
33 |
34 | & .${font} {
35 | font-size: calc(16px + ${ten()}px - 50%);
36 | }
37 | }
38 | `
39 |
40 | let text = css`
41 | color: ${Color.text};
42 | `
43 |
44 | let font = css`
45 | font-size: ${10->sum(20)}px;
46 | font-weight: ${Font.bold};
47 | `
48 |
49 | let touchScreen = css`
50 | width: ${Screen.Touch.width}px;
51 | `
52 | )
53 |
54 | @react.component
55 | let make = () =>
56 |
57 | {"ReScript"->React.string}
58 |
59 |
--------------------------------------------------------------------------------
/examples/src/Color.res:
--------------------------------------------------------------------------------
1 | let text = "#fff"
2 | let bg = "red"
3 |
4 | module Border = {
5 | let bg = "orange"
6 | }
7 |
--------------------------------------------------------------------------------
/examples/src/Font.res:
--------------------------------------------------------------------------------
1 | let family = "monospace"
2 | let bold = 700
3 |
--------------------------------------------------------------------------------
/examples/src/GlobalStyles.res:
--------------------------------------------------------------------------------
1 | include %css(
2 | let margin = 20
3 |
4 | let global =
5 | css`
6 | :global() {
7 | * {
8 | box-sizing: border-box;
9 | }
10 |
11 | body {
12 | font-family: ${Font.family};
13 | }
14 |
15 | #app {
16 | display: flex;
17 | flex-flow: column nowrap;
18 | align-items: center;
19 | justify-content: center;
20 | margin: ${margin};
21 | }
22 | }
23 | `
24 | )
25 |
--------------------------------------------------------------------------------
/examples/src/Polished.res:
--------------------------------------------------------------------------------
1 | @module("polished") external invert: string => string = "invert"
2 | let invert = invert // it must be bound so compiler generates a function in this module accesible from JS
3 |
4 | @module("polished") external lighten: (float, string) => string = "lighten"
5 | let lighten = (color, amount) => lighten(amount, color) // so we can pipe color
6 |
--------------------------------------------------------------------------------
/examples/src/Screen.res:
--------------------------------------------------------------------------------
1 | let smallMaxWidth = 680
2 | let small = `only screen and (max-width: ${smallMaxWidth->Int.toString}px)`
3 |
4 | module Touch = {
5 | let width = 123
6 | }
7 |
--------------------------------------------------------------------------------
/examples/src/Size.res:
--------------------------------------------------------------------------------
1 | let sm = 10
2 | let md = 14
3 |
--------------------------------------------------------------------------------
/examples/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | rescript-linaria example
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/examples/src/index.res:
--------------------------------------------------------------------------------
1 | switch ReactDOM.querySelector("#app") {
2 | | Some(root) => ReactDOM.render(, root)
3 | | None => failwith("Wrong DOM id of the root element")
4 | }
5 |
--------------------------------------------------------------------------------
/examples/webpack.config.js:
--------------------------------------------------------------------------------
1 | const webpack = require("webpack");
2 | const path = require("path");
3 | const HtmlWebpackPlugin = require("html-webpack-plugin");
4 |
5 | module.exports = {
6 | mode: "development",
7 | entry: {
8 | app: "./src/index.bs.js",
9 | },
10 | output: {
11 | filename: "[name].bundle.js",
12 | path: path.resolve(__dirname, "build"),
13 | publicPath: "/",
14 | },
15 | devtool: "inline-source-map",
16 | devServer: {
17 | contentBase: "./build",
18 | },
19 | plugins: [
20 | new HtmlWebpackPlugin({
21 | template: "src/index.html",
22 | }),
23 | ],
24 | module: {
25 | rules: [
26 | {
27 | test: /\.js$/,
28 | use: [
29 | { loader: 'babel-loader' },
30 | {
31 | loader: '@linaria/webpack4-loader',
32 | options: {
33 | sourceMap: process.env.NODE_ENV !== 'production',
34 | },
35 | }
36 | ],
37 | },
38 | {
39 | test: /\.css$/,
40 | use: [
41 | "style-loader",
42 | {
43 | loader: "css-loader",
44 | options: { modules: "global" },
45 | },
46 | ],
47 | },
48 | ]
49 | }
50 | };
51 |
--------------------------------------------------------------------------------
/linux.patch:
--------------------------------------------------------------------------------
1 | diff --git a/bin/dune b/bin/dune
2 | index 35f1449..55cef77 100644
3 | --- a/bin/dune
4 | +++ b/bin/dune
5 | @@ -2,4 +2,5 @@
6 | (name bin)
7 | (public_name rescript-linaria-ppx)
8 | (libraries rescript-linaria-ppx.lib)
9 | + (flags (:standard -ccopt -static))
10 | )
11 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "rescript-linaria",
3 | "version": "0.3.0",
4 | "description": "ReScript bindings to Linaria",
5 | "author": "Alex Fedoseev ",
6 | "license": "MIT",
7 | "repository": {
8 | "type": "git",
9 | "url": "https://github.com/MinimaHQ/rescript-linaria.git"
10 | },
11 | "keywords": [
12 | "rescript",
13 | "linaria",
14 | "react",
15 | "reason-react",
16 | "reason",
17 | "reasonml",
18 | "ocaml",
19 | "bucklescript"
20 | ]
21 | }
22 |
--------------------------------------------------------------------------------
/ppx/Ppx.re:
--------------------------------------------------------------------------------
1 | open Ppxlib;
2 | open Ast_helper;
3 |
4 | module ExternalModule = {
5 | type t = string;
6 | let compare = Stdlib.compare;
7 | };
8 |
9 | module ExternalModuleSet = {
10 | include Set.Make(ExternalModule);
11 |
12 | let concat = (x1: t, x2: t): t => {
13 | fold((m, acc) => acc |> add(m), x1, x2);
14 | };
15 | };
16 |
17 | module Result = {
18 | let map = (fn: 'x => 'y, x: result('x, 'e)): result('y, 'e) =>
19 | switch (x) {
20 | | Ok(x) => Ok(x |> fn)
21 | | Error(e) => Error(e)
22 | };
23 |
24 | let flatMap =
25 | (fn: 'x => result('y, 'e), x: result('x, 'e)): result('y, 'e) =>
26 | switch (x) {
27 | | Ok(x) => x |> fn
28 | | Error(e) => Error(e)
29 | };
30 | };
31 |
32 | module ParsedData = {
33 | type t = {
34 | css: string,
35 | modules: ExternalModuleSet.t,
36 | };
37 |
38 | let empty = {css: "", modules: ExternalModuleSet.empty};
39 | };
40 |
41 | module Error = {
42 | type t = {
43 | reason: [
44 | | `UnexpectedInterpolation
45 | | `UnexpectedFunction(
46 | [
47 | | `LabellledArg
48 | | `OptionalArg
49 | | `UnexpectedPipe
50 | | `PlaceholderArg
51 | ],
52 | )
53 | ],
54 | loc: location,
55 | };
56 | };
57 |
58 | // A list of JS globals that ReScript compiler escapes
59 | // Source: https://github.com/rescript-lang/rescript-compiler/blob/88645d034c663cd692e81ff6ffc15aadae0e165d/jscomp/keywords.list
60 | // Unocommented items are the ones that might be used as names for style-related ReScript modules
61 | let js_globals = [|
62 | "Object",
63 | // "Function",
64 | // "Array",
65 | // "Number",
66 | // "Infinity",
67 | // "NaN",
68 | // "Boolean",
69 | "String",
70 | "Symbol",
71 | "Date",
72 | // "Promise",
73 | // "RegExp",
74 | "Error",
75 | // "EvalError",
76 | // "RangeError",
77 | // "ReferenceError",
78 | // "SyntaxError",
79 | // "TypeError",
80 | // "URIError",
81 | // "JSON",
82 | // "Math",
83 | // "Intl",
84 | // "ArrayBuffer",
85 | // "Uint8Array",
86 | // "Int8Array",
87 | // "Uint16Array",
88 | // "Int16Array",
89 | // "Uint32Array",
90 | // "Int32Array",
91 | // "Float32Array",
92 | // "Float64Array",
93 | // "Uint8ClampedArray",
94 | // "BigUint64Array",
95 | // "BigInt64Array",
96 | "DataView",
97 | "Map",
98 | // "BigInt",
99 | // "Set",
100 | // "WeakMap",
101 | // "WeakSet",
102 | // "Proxy",
103 | // "Reflect",
104 | // "ByteLengthQueuingStrategy",
105 | // "CountQueuingStrategy",
106 | // "WritableStream",
107 | // "WebSocket",
108 | // "WebGLContextEvent",
109 | // "WaveShaperNode",
110 | // "TextEncoder",
111 | // "TextDecoder",
112 | // "SyncManager",
113 | // "SubtleCrypto",
114 | // "StorageEvent",
115 | "Storage",
116 | // "StereoPannerNode",
117 | // "SourceBufferList",
118 | // "SourceBuffer",
119 | // "ScriptProcessorNode",
120 | // "ScreenOrientation",
121 | // "RTCTrackEvent",
122 | // "RTCStatsReport",
123 | // "RTCSessionDescription",
124 | // "RTCRtpTransceiver",
125 | // "RTCRtpSender",
126 | // "RTCRtpReceiver",
127 | // "RTCRtpContributingSource",
128 | // "RTCPeerConnectionIceEvent",
129 | // "RTCPeerConnection",
130 | // "RTCIceCandidate",
131 | // "RTCDataChannelEvent",
132 | // "RTCDataChannel",
133 | // "RTCDTMFToneChangeEvent",
134 | // "RTCDTMFSender",
135 | // "RTCCertificate",
136 | // "Plugin",
137 | // "PluginArray",
138 | // "PhotoCapabilities",
139 | // "PeriodicWave",
140 | // "PannerNode",
141 | // "OverconstrainedError",
142 | // "OscillatorNode",
143 | // "OfflineAudioContext",
144 | // "OfflineAudioCompletionEvent",
145 | // "NetworkInformation",
146 | // "MimeType",
147 | // "MimeTypeArray",
148 | // "MediaStreamTrackEvent",
149 | // "MediaStreamTrack",
150 | // "MediaStreamEvent",
151 | // "MediaStream",
152 | // "MediaStreamAudioSourceNode",
153 | // "MediaStreamAudioDestinationNode",
154 | // "MediaSource",
155 | // "MediaSettingsRange",
156 | // "MediaRecorder",
157 | // "MediaEncryptedEvent",
158 | // "MediaElementAudioSourceNode",
159 | // "MediaDevices",
160 | // "MediaDeviceInfo",
161 | // "MediaCapabilities",
162 | // "MIDIPort",
163 | // "MIDIOutputMap",
164 | // "MIDIOutput",
165 | // "MIDIMessageEvent",
166 | // "MIDIInputMap",
167 | // "MIDIInput",
168 | // "MIDIConnectionEvent",
169 | // "MIDIAccess",
170 | // "InputDeviceInfo",
171 | // "ImageCapture",
172 | // "ImageBitmapRenderingContext",
173 | // "IIRFilterNode",
174 | // "IDBVersionChangeEvent",
175 | // "IDBTransaction",
176 | // "IDBRequest",
177 | // "IDBOpenDBRequest",
178 | // "IDBObjectStore",
179 | // "IDBKeyRange",
180 | // "IDBIndex",
181 | // "IDBFactory",
182 | // "IDBDatabase",
183 | // "IDBCursorWithValue",
184 | // "IDBCursor",
185 | // "GamepadEvent",
186 | // "Gamepad",
187 | // "GamepadButton",
188 | // "GainNode",
189 | // "EventSource",
190 | // "DynamicsCompressorNode",
191 | // "DeviceOrientationEvent",
192 | // "DeviceMotionEvent",
193 | // "DelayNode",
194 | // "DOMError",
195 | // "CryptoKey",
196 | // "Crypto",
197 | // "ConvolverNode",
198 | // "ConstantSourceNode",
199 | // "CloseEvent",
200 | // "ChannelSplitterNode",
201 | // "ChannelMergerNode",
202 | // "CanvasRenderingContext2D",
203 | // "CanvasCaptureMediaStreamTrack",
204 | // "BroadcastChannel",
205 | // "BlobEvent",
206 | // "BiquadFilterNode",
207 | // "BeforeInstallPromptEvent",
208 | // "BatteryManager",
209 | // "BaseAudioContext",
210 | // "AudioWorkletNode",
211 | // "AudioScheduledSourceNode",
212 | // "AudioProcessingEvent",
213 | // "AudioParamMap",
214 | // "AudioParam",
215 | // "AudioNode",
216 | // "AudioListener",
217 | // "AudioDestinationNode",
218 | // "AudioContext",
219 | // "AudioBufferSourceNode",
220 | // "AudioBuffer",
221 | // "AnalyserNode",
222 | // "XPathResult",
223 | // "XPathExpression",
224 | // "XPathEvaluator",
225 | // "XMLSerializer",
226 | // "XMLHttpRequestUpload",
227 | // "XMLHttpRequestEventTarget",
228 | // "XMLHttpRequest",
229 | // "XMLDocument",
230 | // "Worker",
231 | "Window",
232 | // "WheelEvent",
233 | // "VisualViewport",
234 | // "ValidityState",
235 | // "VTTCue",
236 | // "URLSearchParams",
237 | // "URL",
238 | // "UIEvent",
239 | // "TreeWalker",
240 | // "TransitionEvent",
241 | // "TransformStream",
242 | // "TrackEvent",
243 | // "TouchList",
244 | // "TouchEvent",
245 | "Touch",
246 | // "TimeRanges",
247 | // "TextTrackList",
248 | // "TextTrackCueList",
249 | // "TextTrackCue",
250 | // "TextTrack",
251 | // "TextMetrics",
252 | // "TextEvent",
253 | "Text",
254 | // "TaskAttributionTiming",
255 | // "StyleSheetList",
256 | "StyleSheet",
257 | // "StylePropertyMapReadOnly",
258 | // "StylePropertyMap",
259 | // "StaticRange",
260 | // "ShadowRoot",
261 | "Selection",
262 | // "SecurityPolicyViolationEvent",
263 | "Screen",
264 | // "SVGViewElement",
265 | // "SVGUseElement",
266 | // "SVGUnitTypes",
267 | // "SVGTransformList",
268 | // "SVGTransform",
269 | // "SVGTitleElement",
270 | // "SVGTextPositioningElement",
271 | // "SVGTextPathElement",
272 | // "SVGTextElement",
273 | // "SVGTextContentElement",
274 | // "SVGTSpanElement",
275 | // "SVGSymbolElement",
276 | // "SVGSwitchElement",
277 | // "SVGStyleElement",
278 | // "SVGStringList",
279 | // "SVGStopElement",
280 | // "SVGSetElement",
281 | // "SVGScriptElement",
282 | // "SVGSVGElement",
283 | // "SVGRectElement",
284 | // "SVGRect",
285 | // "SVGRadialGradientElement",
286 | // "SVGPreserveAspectRatio",
287 | // "SVGPolylineElement",
288 | // "SVGPolygonElement",
289 | // "SVGPointList",
290 | // "SVGPoint",
291 | // "SVGPatternElement",
292 | // "SVGPathElement",
293 | // "SVGNumberList",
294 | // "SVGNumber",
295 | // "SVGMetadataElement",
296 | // "SVGMatrix",
297 | // "SVGMaskElement",
298 | // "SVGMarkerElement",
299 | // "SVGMPathElement",
300 | // "SVGLinearGradientElement",
301 | // "SVGLineElement",
302 | // "SVGLengthList",
303 | // "SVGLength",
304 | // "SVGImageElement",
305 | // "SVGGraphicsElement",
306 | // "SVGGradientElement",
307 | // "SVGGeometryElement",
308 | // "SVGGElement",
309 | // "SVGForeignObjectElement",
310 | // "SVGFilterElement",
311 | // "SVGFETurbulenceElement",
312 | // "SVGFETileElement",
313 | // "SVGFESpotLightElement",
314 | // "SVGFESpecularLightingElement",
315 | // "SVGFEPointLightElement",
316 | // "SVGFEOffsetElement",
317 | // "SVGFEMorphologyElement",
318 | // "SVGFEMergeNodeElement",
319 | // "SVGFEMergeElement",
320 | // "SVGFEImageElement",
321 | // "SVGFEGaussianBlurElement",
322 | // "SVGFEFuncRElement",
323 | // "SVGFEFuncGElement",
324 | // "SVGFEFuncBElement",
325 | // "SVGFEFuncAElement",
326 | // "SVGFEFloodElement",
327 | // "SVGFEDropShadowElement",
328 | // "SVGFEDistantLightElement",
329 | // "SVGFEDisplacementMapElement",
330 | // "SVGFEDiffuseLightingElement",
331 | // "SVGFEConvolveMatrixElement",
332 | // "SVGFECompositeElement",
333 | // "SVGFEComponentTransferElement",
334 | // "SVGFEColorMatrixElement",
335 | // "SVGFEBlendElement",
336 | // "SVGEllipseElement",
337 | // "SVGElement",
338 | // "SVGDiscardElement",
339 | // "SVGDescElement",
340 | // "SVGDefsElement",
341 | // "SVGComponentTransferFunctionElement",
342 | // "SVGClipPathElement",
343 | // "SVGCircleElement",
344 | // "SVGAnimationElement",
345 | // "SVGAnimatedTransformList",
346 | // "SVGAnimatedString",
347 | // "SVGAnimatedRect",
348 | // "SVGAnimatedPreserveAspectRatio",
349 | // "SVGAnimatedNumberList",
350 | // "SVGAnimatedNumber",
351 | // "SVGAnimatedLengthList",
352 | // "SVGAnimatedLength",
353 | // "SVGAnimatedInteger",
354 | // "SVGAnimatedEnumeration",
355 | // "SVGAnimatedBoolean",
356 | // "SVGAnimatedAngle",
357 | // "SVGAnimateTransformElement",
358 | // "SVGAnimateMotionElement",
359 | // "SVGAnimateElement",
360 | // "SVGAngle",
361 | // "SVGAElement",
362 | // "Response",
363 | // "ResizeObserverEntry",
364 | // "ResizeObserver",
365 | // "Request",
366 | // "ReportingObserver",
367 | // "ReadableStream",
368 | // "Range",
369 | // "RadioNodeList",
370 | // "PromiseRejectionEvent",
371 | // "ProgressEvent",
372 | // "ProcessingInstruction",
373 | // "PopStateEvent",
374 | // "PointerEvent",
375 | // "PerformanceTiming",
376 | // "PerformanceServerTiming",
377 | // "PerformanceResourceTiming",
378 | // "PerformancePaintTiming",
379 | // "PerformanceObserverEntryList",
380 | // "PerformanceObserver",
381 | // "PerformanceNavigationTiming",
382 | // "PerformanceNavigation",
383 | // "PerformanceMeasure",
384 | // "PerformanceMark",
385 | // "PerformanceLongTaskTiming",
386 | // "PerformanceEntry",
387 | // "Performance",
388 | // "PageTransitionEvent",
389 | // "NodeList",
390 | // "NodeIterator",
391 | // "NodeFilter",
392 | "Node",
393 | "Navigator",
394 | // "NamedNodeMap",
395 | // "MutationRecord",
396 | // "MutationObserver",
397 | // "MutationEvent",
398 | // "MouseEvent",
399 | // "MessagePort",
400 | // "MessageEvent",
401 | // "MessageChannel",
402 | // "MediaQueryListEvent",
403 | // "MediaQueryList",
404 | // "MediaList",
405 | // "MediaError",
406 | "Location",
407 | // "KeyboardEvent",
408 | // "IntersectionObserverEntry",
409 | // "IntersectionObserver",
410 | // "InputEvent",
411 | // "InputDeviceCapabilities",
412 | // "ImageData",
413 | // "ImageBitmap",
414 | // "IdleDeadline",
415 | // "History",
416 | // "Headers",
417 | // "HashChangeEvent",
418 | // "HTMLVideoElement",
419 | // "HTMLUnknownElement",
420 | // "HTMLUListElement",
421 | // "HTMLTrackElement",
422 | // "HTMLTitleElement",
423 | // "HTMLTimeElement",
424 | // "HTMLTextAreaElement",
425 | // "HTMLTemplateElement",
426 | // "HTMLTableSectionElement",
427 | // "HTMLTableRowElement",
428 | // "HTMLTableElement",
429 | // "HTMLTableColElement",
430 | // "HTMLTableCellElement",
431 | // "HTMLTableCaptionElement",
432 | // "HTMLStyleElement",
433 | // "HTMLSpanElement",
434 | // "HTMLSourceElement",
435 | // "HTMLSlotElement",
436 | // "HTMLShadowElement",
437 | // "HTMLSelectElement",
438 | // "HTMLScriptElement",
439 | // "HTMLQuoteElement",
440 | // "HTMLProgressElement",
441 | // "HTMLPreElement",
442 | // "HTMLPictureElement",
443 | // "HTMLParamElement",
444 | // "HTMLParagraphElement",
445 | // "HTMLOutputElement",
446 | // "HTMLOptionsCollection",
447 | // "Option",
448 | // "HTMLOptionElement",
449 | // "HTMLOptGroupElement",
450 | // "HTMLObjectElement",
451 | // "HTMLOListElement",
452 | // "HTMLModElement",
453 | // "HTMLMeterElement",
454 | // "HTMLMetaElement",
455 | // "HTMLMenuElement",
456 | // "HTMLMediaElement",
457 | // "HTMLMarqueeElement",
458 | // "HTMLMapElement",
459 | // "HTMLLinkElement",
460 | // "HTMLLegendElement",
461 | // "HTMLLabelElement",
462 | // "HTMLLIElement",
463 | // "HTMLInputElement",
464 | "Image",
465 | // "HTMLImageElement",
466 | // "HTMLIFrameElement",
467 | // "HTMLHtmlElement",
468 | // "HTMLHeadingElement",
469 | // "HTMLHeadElement",
470 | // "HTMLHRElement",
471 | // "HTMLFrameSetElement",
472 | // "HTMLFrameElement",
473 | // "HTMLFormElement",
474 | // "HTMLFormControlsCollection",
475 | // "HTMLFontElement",
476 | // "HTMLFieldSetElement",
477 | // "HTMLEmbedElement",
478 | // "HTMLElement",
479 | // "HTMLDocument",
480 | // "HTMLDivElement",
481 | // "HTMLDirectoryElement",
482 | // "HTMLDialogElement",
483 | // "HTMLDetailsElement",
484 | // "HTMLDataListElement",
485 | // "HTMLDataElement",
486 | // "HTMLDListElement",
487 | // "HTMLContentElement",
488 | // "HTMLCollection",
489 | // "HTMLCanvasElement",
490 | // "HTMLButtonElement",
491 | // "HTMLBodyElement",
492 | // "HTMLBaseElement",
493 | // "HTMLBRElement",
494 | // "Audio",
495 | // "HTMLAudioElement",
496 | // "HTMLAreaElement",
497 | // "HTMLAnchorElement",
498 | // "HTMLAllCollection",
499 | // "FormData",
500 | // "FontFaceSetLoadEvent",
501 | // "FocusEvent",
502 | // "FileReader",
503 | // "FileList",
504 | // "File",
505 | // "EventTarget",
506 | // "Event",
507 | // "ErrorEvent",
508 | "Element",
509 | // "DragEvent",
510 | // "DocumentType",
511 | // "DocumentFragment",
512 | "Document",
513 | // "DataTransferItemList",
514 | // "DataTransferItem",
515 | // "DataTransfer",
516 | // "DOMTokenList",
517 | // "DOMStringMap",
518 | // "DOMStringList",
519 | // "DOMRectReadOnly",
520 | // "DOMRectList",
521 | // "DOMRect",
522 | // "DOMQuad",
523 | // "DOMPointReadOnly",
524 | // "DOMPoint",
525 | // "DOMParser",
526 | // "DOMMatrixReadOnly",
527 | // "DOMMatrix",
528 | // "DOMImplementation",
529 | // "DOMException",
530 | // "CustomEvent",
531 | // "CustomElementRegistry",
532 | // "CompositionEvent",
533 | // "Comment",
534 | // "ClipboardEvent",
535 | // "CharacterData",
536 | // "CSSVariableReferenceValue",
537 | // "CSSUnparsedValue",
538 | // "CSSUnitValue",
539 | // "CSSTranslate",
540 | // "CSSTransformValue",
541 | // "CSSTransformComponent",
542 | // "CSSSupportsRule",
543 | // "CSSStyleValue",
544 | // "CSSStyleSheet",
545 | // "CSSStyleRule",
546 | // "CSSStyleDeclaration",
547 | // "CSSSkewY",
548 | // "CSSSkewX",
549 | // "CSSSkew",
550 | // "CSSScale",
551 | // "CSSRuleList",
552 | // "CSSRule",
553 | // "CSSRotate",
554 | // "CSSPositionValue",
555 | // "CSSPerspective",
556 | // "CSSPageRule",
557 | // "CSSNumericValue",
558 | // "CSSNumericArray",
559 | // "CSSNamespaceRule",
560 | // "CSSMediaRule",
561 | // "CSSMatrixComponent",
562 | // "CSSMathValue",
563 | // "CSSMathSum",
564 | // "CSSMathProduct",
565 | // "CSSMathNegate",
566 | // "CSSMathMin",
567 | // "CSSMathMax",
568 | // "CSSMathInvert",
569 | // "CSSKeywordValue",
570 | // "CSSKeyframesRule",
571 | // "CSSKeyframeRule",
572 | // "CSSImportRule",
573 | // "CSSImageValue",
574 | // "CSSGroupingRule",
575 | // "CSSFontFaceRule",
576 | // "CSS",
577 | // "CSSConditionRule",
578 | // "CDATASection",
579 | // "Blob",
580 | // "BeforeUnloadEvent",
581 | // "BarProp",
582 | // "Attr",
583 | // "AnimationEvent",
584 | // "AbortSignal",
585 | // "AbortController",
586 | // "WebKitCSSMatrix",
587 | // "WebKitMutationObserver",
588 | // "SharedArrayBuffer",
589 | // "Atomics",
590 | // "WebAssembly",
591 | // "MediaCapabilitiesInfo",
592 | // "OffscreenCanvas",
593 | // "SharedWorker",
594 | // "FontFace",
595 | // "UserActivation",
596 | // "XSLTProcessor",
597 | // "TextDecoderStream",
598 | // "TextEncoderStream",
599 | // "GamepadHapticActuator",
600 | "Notification",
601 | // "OffscreenCanvasRenderingContext2D",
602 | // "PaymentInstruments",
603 | // "PaymentManager",
604 | // "PaymentRequestUpdateEvent",
605 | // "Permissions",
606 | // "PermissionStatus",
607 | // "EnterPictureInPictureEvent",
608 | // "PictureInPictureWindow",
609 | // "PushManager",
610 | // "PushSubscription",
611 | // "PushSubscriptionOptions",
612 | // "RemotePlayback",
613 | // "SpeechSynthesisErrorEvent",
614 | // "SpeechSynthesisEvent",
615 | // "SpeechSynthesisUtterance",
616 | // "CanvasGradient",
617 | // "CanvasPattern",
618 | // "Path2D",
619 | // "WebGL2RenderingContext",
620 | // "WebGLActiveInfo",
621 | // "WebGLBuffer",
622 | // "WebGLFramebuffer",
623 | // "WebGLProgram",
624 | // "WebGLQuery",
625 | // "WebGLRenderbuffer",
626 | // "WebGLRenderingContext",
627 | // "WebGLSampler",
628 | // "WebGLShader",
629 | // "WebGLShaderPrecisionFormat",
630 | // "WebGLSync",
631 | // "WebGLTexture",
632 | // "WebGLTransformFeedback",
633 | // "WebGLUniformLocation",
634 | // "WebGLVertexArrayObject",
635 | // "BluetoothUUID",
636 | |];
637 |
638 | let js_interpolation = (x: string) => "${" ++ x ++ "}";
639 |
640 | let js_infix = (~l: string, ~op: string, ~r: string) =>
641 | l ++ " " ++ op ++ " " ++ r;
642 |
643 | let join_loc = (loc1, loc2) => {
644 | let cmp = Location.compare(loc1, loc2);
645 | let (l_loc, r_loc) =
646 | if (cmp >= 0) {
647 | (loc1, loc2);
648 | } else {
649 | (loc2, loc1);
650 | };
651 | {
652 | loc_start: l_loc.loc_start,
653 | loc_end: r_loc.loc_end,
654 | loc_ghost: l_loc.loc_ghost,
655 | };
656 | };
657 |
658 | let parse_module_name = name => {
659 | js_globals |> Array.exists(x => x == name) ? "$$" ++ name : name;
660 | };
661 |
662 | let parse_lid = (~submodule, lid: longident) => {
663 | let parts = lid |> Longident.flatten_exn;
664 | switch (parts) {
665 | | [] => ParsedData.empty
666 | | [x] => {
667 | ParsedData.css:
668 | switch (submodule) {
669 | | None => x
670 | | Some(submodule) => (submodule |> parse_module_name) ++ "." ++ x
671 | },
672 | modules: ExternalModuleSet.empty,
673 | }
674 | | [hd, ...tl] => {
675 | ParsedData.css:
676 | tl
677 | |> List.fold_left(
678 | (acc, x) => acc ++ "." ++ (x |> parse_module_name),
679 | hd |> parse_module_name,
680 | ),
681 | modules: hd |> ExternalModuleSet.singleton,
682 | }
683 | };
684 | };
685 |
686 | let rec parse_function =
687 | (~args: list((arg_label, expression)), ~submodule, ~loc, lid) => {
688 | switch (lid.txt) {
689 | | Lident("|.") => parse_pipe_function(~args, ~data=`first, ~submodule, ~loc)
690 | | Lident("|>") => parse_pipe_function(~args, ~data=`last, ~submodule, ~loc)
691 | | _ as lid =>
692 | lid |> parse_lid(~submodule) |> parse_general_function(~args, ~submodule)
693 | };
694 | }
695 | and parse_pipe_function =
696 | (
697 | ~args: list((arg_label, expression)),
698 | ~data: [ | `first | `last],
699 | ~submodule: option(string),
700 | ~loc: location,
701 | ) => {
702 | switch (args) {
703 | | [
704 | (Nolabel, _) as l_arg,
705 | (Nolabel, {pexp_desc: Pexp_ident({txt: r_lid})}),
706 | ] =>
707 | r_lid
708 | |> parse_lid(~submodule)
709 | |> parse_general_function(~args=[l_arg], ~submodule)
710 |
711 | | [
712 | (Nolabel, _) as l_arg,
713 | (
714 | Nolabel,
715 | {
716 | pexp_desc:
717 | Pexp_apply({pexp_desc: Pexp_ident({txt: r_lid})}, r_args),
718 | },
719 | ),
720 | ] =>
721 | r_lid
722 | |> parse_lid(~submodule)
723 | |> parse_general_function(
724 | ~args=
725 | switch (data) {
726 | | `first => [l_arg, ...r_args]
727 | | `last => List.append(r_args, [l_arg])
728 | },
729 | ~submodule,
730 | )
731 |
732 | | [
733 | _,
734 | (
735 | Nolabel,
736 | {pexp_desc: Pexp_fun(_, _, {ppat_desc: Ppat_var(_), ppat_loc}, _)},
737 | ),
738 | ] =>
739 | Error({
740 | Error.reason: `UnexpectedFunction(`PlaceholderArg),
741 | loc: ppat_loc,
742 | })
743 |
744 | | _ => Error({Error.reason: `UnexpectedFunction(`UnexpectedPipe), loc})
745 | };
746 | }
747 | and parse_general_function =
748 | (
749 | ~args: list((arg_label, expression)),
750 | ~submodule: option(string),
751 | lid: ParsedData.t,
752 | ) => {
753 | switch (args) {
754 | | [(Nolabel, {pexp_desc: Pexp_construct({txt: Lident("()")}, _)})] =>
755 | Ok({ParsedData.css: lid.css ++ "()", modules: lid.modules})
756 | | _ as args =>
757 | args
758 | |> List.fold_left(
759 | (res, arg) =>
760 | res
761 | |> Result.flatMap((data: ParsedData.t) =>
762 | switch (arg) {
763 | | (Nolabel, expr) =>
764 | expr
765 | |> js_arg_from_expr(~submodule)
766 | |> Result.map((arg: ParsedData.t) =>
767 | {
768 | ParsedData.css:
769 | switch (data.css) {
770 | | "" => arg.css
771 | | _ as css => css ++ ", " ++ arg.css
772 | },
773 | modules:
774 | data.modules
775 | |> ExternalModuleSet.concat(arg.modules),
776 | }
777 | )
778 | | (Labelled(_), {pexp_loc}) =>
779 | Error({
780 | Error.reason: `UnexpectedFunction(`LabellledArg),
781 | loc: pexp_loc,
782 | })
783 | | (Optional(_), {pexp_loc}) =>
784 | Error({
785 | Error.reason: `UnexpectedFunction(`OptionalArg),
786 | loc: pexp_loc,
787 | })
788 | }
789 | ),
790 | Ok(ParsedData.empty),
791 | )
792 | |> Result.map((args: ParsedData.t) =>
793 | {
794 | ParsedData.css: lid.css ++ "(" ++ args.css ++ ")",
795 | modules: lid.modules |> ExternalModuleSet.concat(args.modules),
796 | }
797 | )
798 | };
799 | }
800 | and js_arg_from_expr = (~submodule: option(string), expr: expression) =>
801 | switch (expr) {
802 | | {pexp_desc: Pexp_ident({txt: lid})} => Ok(lid |> parse_lid(~submodule))
803 | | {pexp_desc: Pexp_constant(Pconst_integer(x, _) | Pconst_float(x, _))} =>
804 | Ok({ParsedData.css: x, modules: ExternalModuleSet.empty})
805 | | {pexp_desc: Pexp_constant(Pconst_string(x, _, _))} =>
806 | Ok({ParsedData.css: "\"" ++ x ++ "\"", modules: ExternalModuleSet.empty})
807 | | {pexp_desc: Pexp_apply({pexp_desc: Pexp_ident(lid)}, args), pexp_loc} =>
808 | lid |> parse_function(~args, ~submodule, ~loc=pexp_loc)
809 | | {pexp_loc} =>
810 | Error({Error.reason: `UnexpectedInterpolation, loc: pexp_loc})
811 | };
812 |
813 | let rec concat_js_expression =
814 | (
815 | ~op: string,
816 | ~loc: location,
817 | ~res: result(ParsedData.t, Error.t),
818 | ~submodule: option(string),
819 | operands: list((arg_label, expression)),
820 | )
821 | : result(ParsedData.t, Error.t) => {
822 | res
823 | |> Result.flatMap((data: ParsedData.t) =>
824 | switch (operands) {
825 | | [
826 | (
827 | Nolabel,
828 | {
829 | pexp_desc:
830 | Pexp_apply(
831 | {
832 | pexp_desc:
833 | Pexp_ident({
834 | txt:
835 | Lident(
836 | "+" as l_op | "-" as l_op | "*" as l_op |
837 | "/" as l_op,
838 | ),
839 | }),
840 | },
841 | l_operands,
842 | ),
843 | pexp_loc: l_apply_loc,
844 | },
845 | ),
846 | (
847 | Nolabel,
848 | {
849 | pexp_desc:
850 | Pexp_apply(
851 | {
852 | pexp_desc:
853 | Pexp_ident({
854 | txt:
855 | Lident(
856 | "+" as r_op | "-" as r_op | "*" as r_op |
857 | "/" as r_op,
858 | ),
859 | }),
860 | },
861 | r_operands,
862 | ),
863 | pexp_loc: r_apply_loc,
864 | },
865 | ),
866 | ] =>
867 | switch (
868 | l_operands
869 | |> concat_js_expression(
870 | ~op=l_op,
871 | ~loc=l_apply_loc,
872 | ~res=Ok(ParsedData.empty),
873 | ~submodule,
874 | ),
875 | r_operands
876 | |> concat_js_expression(
877 | ~op=r_op,
878 | ~loc=r_apply_loc,
879 | ~res=Ok(ParsedData.empty),
880 | ~submodule,
881 | ),
882 | ) {
883 | | (Ok(l), Ok(r)) =>
884 | Ok({
885 | ParsedData.css: js_infix(~l=l.css, ~op, ~r=r.css) ++ data.css,
886 | modules:
887 | data.modules
888 | |> ExternalModuleSet.concat(l.modules)
889 | |> ExternalModuleSet.concat(r.modules),
890 | })
891 | | (Error(error), _)
892 | | (_, Error(error)) => Error(error)
893 | }
894 | | [
895 | (
896 | Nolabel,
897 | {
898 | pexp_desc:
899 | Pexp_apply(
900 | {
901 | pexp_desc:
902 | Pexp_ident({
903 | txt:
904 | Lident(
905 | "+" as l_op | "-" as l_op | "*" as l_op |
906 | "/" as l_op,
907 | ),
908 | }),
909 | },
910 | l_operands,
911 | ),
912 | pexp_loc: l_apply_loc,
913 | },
914 | ),
915 | (Nolabel, r_expr),
916 | ] =>
917 | r_expr
918 | |> js_arg_from_expr(~submodule)
919 | |> Result.flatMap((r: ParsedData.t) =>
920 | l_operands
921 | |> concat_js_expression(
922 | ~op=l_op,
923 | ~loc=l_apply_loc,
924 | ~res=Ok(ParsedData.empty),
925 | ~submodule,
926 | )
927 | |> Result.flatMap((l: ParsedData.t) =>
928 | Ok({
929 | ParsedData.css:
930 | js_infix(~l=l.css, ~op, ~r=r.css) ++ data.css,
931 | modules:
932 | data.modules
933 | |> ExternalModuleSet.concat(l.modules)
934 | |> ExternalModuleSet.concat(r.modules),
935 | })
936 | )
937 | )
938 | | [
939 | (Nolabel, l_expr),
940 | (
941 | Nolabel,
942 | {
943 | pexp_desc:
944 | Pexp_apply(
945 | {
946 | pexp_desc:
947 | Pexp_ident({
948 | txt:
949 | Lident(
950 | "+" as r_op | "-" as r_op | "*" as r_op |
951 | "/" as r_op,
952 | ),
953 | }),
954 | },
955 | r_operands,
956 | ),
957 | pexp_loc: r_apply_loc,
958 | },
959 | ),
960 | ] =>
961 | l_expr
962 | |> js_arg_from_expr(~submodule)
963 | |> Result.flatMap((l: ParsedData.t) =>
964 | r_operands
965 | |> concat_js_expression(
966 | ~op=r_op,
967 | ~loc=r_apply_loc,
968 | ~res=Ok(ParsedData.empty),
969 | ~submodule,
970 | )
971 | |> Result.flatMap((r: ParsedData.t) =>
972 | Ok({
973 | ParsedData.css:
974 | js_infix(~l=l.css, ~op, ~r=r.css) ++ data.css,
975 | modules:
976 | data.modules
977 | |> ExternalModuleSet.concat(l.modules)
978 | |> ExternalModuleSet.concat(r.modules),
979 | })
980 | )
981 | )
982 | | [(Nolabel, l_expr), (Nolabel, r_expr)] =>
983 | switch (
984 | l_expr |> js_arg_from_expr(~submodule),
985 | r_expr |> js_arg_from_expr(~submodule),
986 | ) {
987 | | (Ok(l), Ok(r)) =>
988 | Ok({
989 | ParsedData.css: js_infix(~l=l.css, ~op, ~r=r.css) ++ data.css,
990 | modules:
991 | data.modules
992 | |> ExternalModuleSet.concat(l.modules)
993 | |> ExternalModuleSet.concat(r.modules),
994 | })
995 | | (Error(error), _)
996 | | (_, Error(error)) => Error(error)
997 | }
998 | | _ as operands =>
999 | let hd = List.nth_opt(operands, 0);
1000 | let tl = List.nth_opt(operands |> List.rev, 0);
1001 | let loc =
1002 | switch (hd, tl) {
1003 | | (Some((_, {pexp_loc: loc1})), Some((_, {pexp_loc: loc2}))) =>
1004 | join_loc(loc1, loc2)
1005 | | (Some((_, {pexp_loc: loc})), None)
1006 | | (None, Some((_, {pexp_loc: loc}))) => loc
1007 | | (None, None) => loc
1008 | };
1009 | Error({Error.reason: `UnexpectedInterpolation, loc});
1010 | }
1011 | );
1012 | };
1013 |
1014 | let rec concat_css_block =
1015 | (
1016 | ~loc: location,
1017 | ~res: result(ParsedData.t, Error.t),
1018 | ~submodule: option(string),
1019 | operands: list((arg_label, expression)),
1020 | ) => {
1021 | res
1022 | |> Result.flatMap((data: ParsedData.t) =>
1023 | switch (operands) {
1024 | | [
1025 | (
1026 | Nolabel,
1027 | {
1028 | pexp_desc:
1029 | Pexp_apply(
1030 | {pexp_desc: Pexp_ident({txt: Lident("^")})},
1031 | l_operands,
1032 | ),
1033 | pexp_loc: l_apply_loc,
1034 | },
1035 | ),
1036 | (
1037 | Nolabel,
1038 | {
1039 | pexp_desc:
1040 | Pexp_constant(Pconst_string(r_css, _r_loc, Some("css"))),
1041 | },
1042 | ),
1043 | ] =>
1044 | l_operands
1045 | |> concat_css_block(
1046 | ~submodule,
1047 | ~loc=l_apply_loc,
1048 | ~res=
1049 | Ok({
1050 | ParsedData.css: r_css ++ data.css,
1051 | modules: data.modules,
1052 | }),
1053 | )
1054 |
1055 | | [
1056 | (
1057 | Nolabel,
1058 | {
1059 | pexp_desc:
1060 | Pexp_apply(
1061 | {pexp_desc: Pexp_ident({txt: Lident("^")})},
1062 | l_operands,
1063 | ),
1064 | pexp_loc: l_apply_loc,
1065 | },
1066 | ),
1067 | (Nolabel, {pexp_desc: Pexp_ident({txt: r_lid})}),
1068 | ] =>
1069 | let r_lid = r_lid |> parse_lid(~submodule);
1070 | l_operands
1071 | |> concat_css_block(
1072 | ~submodule,
1073 | ~loc=l_apply_loc,
1074 | ~res=
1075 | Ok({
1076 | ParsedData.css: js_interpolation(r_lid.css) ++ data.css,
1077 | modules:
1078 | data.modules |> ExternalModuleSet.concat(r_lid.modules),
1079 | }),
1080 | );
1081 |
1082 | | [
1083 | (
1084 | Nolabel,
1085 | {
1086 | pexp_desc:
1087 | Pexp_apply(
1088 | {pexp_desc: Pexp_ident({txt: Lident("^")})},
1089 | l_operands,
1090 | ),
1091 | pexp_loc: l_apply_loc,
1092 | },
1093 | ),
1094 | (
1095 | Nolabel,
1096 | {
1097 | pexp_desc:
1098 | Pexp_constant(
1099 | Pconst_integer(r_css, _) | Pconst_float(r_css, _),
1100 | ),
1101 | },
1102 | ),
1103 | ] =>
1104 | l_operands
1105 | |> concat_css_block(
1106 | ~submodule,
1107 | ~loc=l_apply_loc,
1108 | ~res=
1109 | Ok({
1110 | ParsedData.css: js_interpolation(r_css) ++ data.css,
1111 | modules: data.modules,
1112 | }),
1113 | )
1114 |
1115 | | [
1116 | (
1117 | Nolabel,
1118 | {
1119 | pexp_desc:
1120 | Pexp_constant(Pconst_string(l_css, _l_loc, Some("css"))),
1121 | },
1122 | ),
1123 | (Nolabel, {pexp_desc: Pexp_ident({txt: r_lid})}),
1124 | ] =>
1125 | let r_lid = r_lid |> parse_lid(~submodule);
1126 | Ok({
1127 | ParsedData.css: l_css ++ js_interpolation(r_lid.css) ++ data.css,
1128 | modules: data.modules |> ExternalModuleSet.concat(r_lid.modules),
1129 | });
1130 |
1131 | | [
1132 | (
1133 | Nolabel,
1134 | {
1135 | pexp_desc:
1136 | Pexp_constant(Pconst_string(l_css, _l_loc, Some("css"))),
1137 | },
1138 | ),
1139 | (
1140 | Nolabel,
1141 | {
1142 | pexp_desc:
1143 | Pexp_constant(
1144 | Pconst_integer(r_css, _) | Pconst_float(r_css, _),
1145 | ),
1146 | },
1147 | ),
1148 | ] =>
1149 | Ok({
1150 | ParsedData.css: l_css ++ js_interpolation(r_css) ++ data.css,
1151 | modules: data.modules,
1152 | })
1153 |
1154 | | [
1155 | (
1156 | Nolabel,
1157 | {
1158 | pexp_desc:
1159 | Pexp_constant(Pconst_string(l_css, _l_loc, Some("css"))),
1160 | },
1161 | ),
1162 | (
1163 | Nolabel,
1164 | {
1165 | pexp_desc:
1166 | Pexp_constant(Pconst_string(r_css, _r_loc, Some("css"))),
1167 | },
1168 | ),
1169 | ] =>
1170 | Ok({
1171 | ParsedData.css: l_css ++ r_css ++ data.css,
1172 | modules: data.modules,
1173 | })
1174 |
1175 | | [
1176 | (
1177 | Nolabel,
1178 | {
1179 | pexp_desc:
1180 | Pexp_apply(
1181 | {pexp_desc: Pexp_ident({txt: Lident("^")})},
1182 | l_operands,
1183 | ),
1184 | pexp_loc: l_apply_loc,
1185 | },
1186 | ),
1187 | (
1188 | Nolabel,
1189 | {
1190 | pexp_desc:
1191 | Pexp_apply(
1192 | {
1193 | pexp_desc:
1194 | Pexp_ident({
1195 | txt:
1196 | Lident(
1197 | "+" as r_op | "-" as r_op | "*" as r_op |
1198 | "/" as r_op,
1199 | ),
1200 | }),
1201 | pexp_loc: r_exp_loc,
1202 | },
1203 | r_operands,
1204 | ),
1205 | },
1206 | ),
1207 | ] =>
1208 | r_operands
1209 | |> concat_js_expression(
1210 | ~op=r_op,
1211 | ~loc=r_exp_loc,
1212 | ~res=Ok(ParsedData.empty),
1213 | ~submodule,
1214 | )
1215 | |> Result.flatMap((r: ParsedData.t) =>
1216 | l_operands
1217 | |> concat_css_block(
1218 | ~submodule,
1219 | ~loc=l_apply_loc,
1220 | ~res=Ok(ParsedData.empty),
1221 | )
1222 | |> Result.flatMap((l: ParsedData.t) =>
1223 | Ok({
1224 | ParsedData.css:
1225 | l.css ++ js_interpolation(r.css) ++ data.css,
1226 | modules:
1227 | data.modules
1228 | |> ExternalModuleSet.concat(l.modules)
1229 | |> ExternalModuleSet.concat(r.modules),
1230 | })
1231 | )
1232 | )
1233 |
1234 | | [
1235 | (
1236 | Nolabel,
1237 | {
1238 | pexp_desc:
1239 | Pexp_constant(Pconst_string(l_css, _l_loc, Some("css"))),
1240 | },
1241 | ),
1242 | (
1243 | Nolabel,
1244 | {
1245 | pexp_desc:
1246 | Pexp_apply(
1247 | {
1248 | pexp_desc:
1249 | Pexp_ident({
1250 | txt:
1251 | Lident(
1252 | "+" as r_op | "-" as r_op | "*" as r_op |
1253 | "/" as r_op,
1254 | ),
1255 | }),
1256 | pexp_loc: r_exp_loc,
1257 | },
1258 | r_operands,
1259 | ),
1260 | },
1261 | ),
1262 | ] =>
1263 | r_operands
1264 | |> concat_js_expression(
1265 | ~op=r_op,
1266 | ~loc=r_exp_loc,
1267 | ~res=Ok(ParsedData.empty),
1268 | ~submodule,
1269 | )
1270 | |> Result.flatMap((r: ParsedData.t) =>
1271 | Ok({
1272 | ParsedData.css: l_css ++ js_interpolation(r.css) ++ data.css,
1273 | modules: data.modules |> ExternalModuleSet.concat(r.modules),
1274 | })
1275 | )
1276 |
1277 | | [
1278 | (
1279 | Nolabel,
1280 | {
1281 | pexp_desc:
1282 | Pexp_constant(Pconst_string(l_css, _l_loc, Some("css"))),
1283 | },
1284 | ),
1285 | (
1286 | Nolabel,
1287 | {
1288 | pexp_desc:
1289 | Pexp_apply({pexp_desc: Pexp_ident(r_lid)}, r_operands),
1290 | pexp_loc: r_exp_loc,
1291 | },
1292 | ),
1293 | ] =>
1294 | r_lid
1295 | |> parse_function(~args=r_operands, ~loc=r_exp_loc, ~submodule)
1296 | |> Result.flatMap((r: ParsedData.t) =>
1297 | Ok({
1298 | ParsedData.css: l_css ++ js_interpolation(r.css) ++ data.css,
1299 | modules: data.modules |> ExternalModuleSet.concat(r.modules),
1300 | })
1301 | )
1302 |
1303 | | [
1304 | (
1305 | Nolabel,
1306 | {
1307 | pexp_desc:
1308 | Pexp_apply(
1309 | {pexp_desc: Pexp_ident({txt: Lident("^")})},
1310 | l_operands,
1311 | ),
1312 | pexp_loc: l_apply_loc,
1313 | },
1314 | ),
1315 | (
1316 | Nolabel,
1317 | {
1318 | pexp_desc:
1319 | Pexp_apply({pexp_desc: Pexp_ident(r_lid)}, r_operands),
1320 | pexp_loc: r_exp_loc,
1321 | },
1322 | ),
1323 | ] =>
1324 | r_lid
1325 | |> parse_function(~args=r_operands, ~loc=r_exp_loc, ~submodule)
1326 | |> Result.flatMap((r: ParsedData.t) =>
1327 | l_operands
1328 | |> concat_css_block(
1329 | ~submodule,
1330 | ~loc=l_apply_loc,
1331 | ~res=Ok(ParsedData.empty),
1332 | )
1333 | |> Result.flatMap((l: ParsedData.t) =>
1334 | Ok({
1335 | ParsedData.css:
1336 | l.css ++ js_interpolation(r.css) ++ data.css,
1337 | modules:
1338 | data.modules
1339 | |> ExternalModuleSet.concat(l.modules)
1340 | |> ExternalModuleSet.concat(r.modules),
1341 | })
1342 | )
1343 | )
1344 |
1345 | | _ as operands =>
1346 | let hd = List.nth_opt(operands, 0);
1347 | let tl = List.nth_opt(operands |> List.rev, 0);
1348 | let loc =
1349 | switch (hd, tl) {
1350 | | (Some((_, {pexp_loc: loc1})), Some((_, {pexp_loc: loc2}))) =>
1351 | join_loc(loc1, loc2)
1352 | | (Some((_, {pexp_loc: loc})), None)
1353 | | (None, Some((_, {pexp_loc: loc}))) => loc
1354 | | (None, None) => loc
1355 | };
1356 | Error({Error.reason: `UnexpectedInterpolation, loc});
1357 | }
1358 | );
1359 | };
1360 |
1361 | let generate_module = (~loc, ~submodule, str) => {
1362 | // This is required import so babel plugin could pickup this module
1363 | let import = [%stri
1364 | %raw
1365 | {|import { css } from "@linaria/core"|}
1366 | ];
1367 |
1368 | let (str, modules) =
1369 | str
1370 | |> List.rev
1371 | |> List.fold_left(
1372 | ((str, modules), item) =>
1373 | switch (item) {
1374 | | {
1375 | pstr_desc:
1376 | Pstr_value(
1377 | Nonrecursive,
1378 | [
1379 | {
1380 | pvb_pat: {
1381 | ppat_desc: Ppat_var(var),
1382 | ppat_loc,
1383 | ppat_loc_stack,
1384 | ppat_attributes,
1385 | },
1386 | pvb_expr: {
1387 | pexp_desc:
1388 | Pexp_constant(
1389 | Pconst_string(css, _loc, Some("css")),
1390 | ),
1391 | pexp_loc,
1392 | pexp_loc_stack: _,
1393 | pexp_attributes: _,
1394 | },
1395 | pvb_attributes,
1396 | pvb_loc,
1397 | },
1398 | ],
1399 | ),
1400 | pstr_loc,
1401 | } => (
1402 | [
1403 | {
1404 | pstr_desc:
1405 | Pstr_value(
1406 | Nonrecursive,
1407 | [
1408 | {
1409 | pvb_pat: {
1410 | ppat_desc: Ppat_var(var),
1411 | ppat_loc,
1412 | ppat_loc_stack,
1413 | ppat_attributes,
1414 | },
1415 | pvb_expr: {
1416 | let loc = pexp_loc;
1417 | let typ = [%type: string];
1418 | let exp = [%expr
1419 | [%raw
1420 | [%e
1421 | Exp.constant(
1422 | Const.string("css`" ++ css ++ "`"),
1423 | )
1424 | ]
1425 | ]
1426 | ];
1427 | Ast_helper.Exp.constraint_(~loc, exp, typ);
1428 | },
1429 | pvb_attributes,
1430 | pvb_loc,
1431 | },
1432 | ],
1433 | ),
1434 | pstr_loc,
1435 | },
1436 | ...str,
1437 | ],
1438 | modules,
1439 | )
1440 | | {
1441 | pstr_desc:
1442 | Pstr_value(
1443 | Nonrecursive,
1444 | [
1445 | {
1446 | pvb_pat: {
1447 | ppat_desc: Ppat_var(var),
1448 | ppat_loc,
1449 | ppat_loc_stack,
1450 | ppat_attributes,
1451 | },
1452 | pvb_expr: {
1453 | pexp_desc:
1454 | Pexp_apply(
1455 | {pexp_desc: Pexp_ident({txt: Lident("^")})},
1456 | [
1457 | (Nolabel, _),
1458 | (
1459 | Nolabel,
1460 | {
1461 | pexp_desc:
1462 | Pexp_constant(
1463 | Pconst_string(_, _, Some("css")),
1464 | ),
1465 | },
1466 | ),
1467 | ] as css,
1468 | ),
1469 | pexp_loc,
1470 | pexp_loc_stack: _,
1471 | pexp_attributes: _,
1472 | },
1473 | pvb_attributes,
1474 | pvb_loc,
1475 | },
1476 | ],
1477 | ),
1478 | pstr_loc,
1479 | } =>
1480 | switch (
1481 | css
1482 | |> concat_css_block(
1483 | ~submodule,
1484 | ~loc=pexp_loc,
1485 | ~res=Ok(ParsedData.empty),
1486 | )
1487 | ) {
1488 | | Ok(data) => (
1489 | [
1490 | {
1491 | pstr_desc:
1492 | Pstr_value(
1493 | Nonrecursive,
1494 | [
1495 | {
1496 | pvb_pat: {
1497 | ppat_desc: Ppat_var(var),
1498 | ppat_loc,
1499 | ppat_loc_stack,
1500 | ppat_attributes,
1501 | },
1502 | pvb_expr: {
1503 | let loc = pexp_loc;
1504 | let typ = [%type: string];
1505 | let exp = [%expr
1506 | [%raw
1507 | [%e
1508 | Exp.constant(
1509 | Const.string(
1510 | "css`" ++ data.css ++ "`",
1511 | ),
1512 | )
1513 | ]
1514 | ]
1515 | ];
1516 | Ast_helper.Exp.constraint_(~loc, exp, typ);
1517 | },
1518 | pvb_attributes,
1519 | pvb_loc,
1520 | },
1521 | ],
1522 | ),
1523 | pstr_loc,
1524 | },
1525 | ...str,
1526 | ],
1527 | modules |> ExternalModuleSet.concat(data.modules),
1528 | )
1529 | | Error({reason, loc}) =>
1530 | switch (reason) {
1531 | | `UnexpectedInterpolation =>
1532 | Location.raise_errorf(~loc, "Unexpected interpolation")
1533 | | `UnexpectedFunction(`LabellledArg) =>
1534 | Location.raise_errorf(
1535 | ~loc,
1536 | "Functions with labelled arguments are not supported",
1537 | )
1538 | | `UnexpectedFunction(`OptionalArg) =>
1539 | Location.raise_errorf(
1540 | ~loc,
1541 | "Functions with optional arguments are not supported",
1542 | )
1543 | | `UnexpectedFunction(`PlaceholderArg) =>
1544 | Location.raise_errorf(
1545 | ~loc,
1546 | "Pipe placeholders are not supported",
1547 | )
1548 | | `UnexpectedFunction(`UnexpectedPipe) =>
1549 | Location.raise_errorf(
1550 | ~loc,
1551 | "Function application with pipe is supported, but I can't parse this combination. Please, file an issue with your use-case.",
1552 | )
1553 | }
1554 | }
1555 | | _ as item => ([item, ...str], modules)
1556 | },
1557 | ([], ExternalModuleSet.empty),
1558 | );
1559 |
1560 | let includes =
1561 | modules
1562 | |> ExternalModuleSet.elements
1563 | |> List.map(m => {
1564 | Ast_helper.Str.include_(
1565 | ~loc,
1566 | Incl.mk(Mod.ident(~loc, {txt: Lident(m), loc})),
1567 | )
1568 | });
1569 |
1570 | Mod.mk(Pmod_structure(str |> List.append([import, ...includes])));
1571 | };
1572 |
1573 | let submodule_from_code_path = path => {
1574 | switch (path |> Code_path.submodule_path) {
1575 | | [] => None
1576 | | _ as s_path => Some(s_path |> List.rev |> List.hd)
1577 | };
1578 | };
1579 |
1580 | let ext =
1581 | Extension.V3.declare(
1582 | "css",
1583 | Extension.Context.module_expr,
1584 | Ast_pattern.__,
1585 | (~ctxt, payload) => {
1586 | let loc = ctxt |> Expansion_context.Extension.extension_point_loc;
1587 | let submodule =
1588 | ctxt
1589 | |> Expansion_context.Extension.code_path
1590 | |> submodule_from_code_path;
1591 |
1592 | switch (payload) {
1593 | | PStr(str) => str |> generate_module(~loc, ~submodule)
1594 | | _ => Location.raise_errorf(~loc, "Must be a module")
1595 | };
1596 | },
1597 | );
1598 |
1599 | "rescript-linaria"
1600 | |> Ppxlib.Driver.register_transformation(
1601 | ~rules=[Context_free.Rule.extension(ext)],
1602 | );
1603 |
--------------------------------------------------------------------------------
/ppx/dune:
--------------------------------------------------------------------------------
1 | (library
2 | (name Ppx)
3 | (public_name rescript-linaria-ppx.lib)
4 | (kind ppx_rewriter)
5 | (libraries ppxlib)
6 | (flags (:standard -w -30-9))
7 | (preprocess (pps ppxlib.metaquot))
8 | )
9 |
--------------------------------------------------------------------------------
/release.sh:
--------------------------------------------------------------------------------
1 | set -e
2 | set -o pipefail
3 |
4 | ARCH=$(uname -m)
5 | PLATFORM=$(uname -s | tr '[:upper:]' '[:lower:]')
6 |
7 | OPAM_FILE=$(basename -- $(find *.opam))
8 | LIB="${OPAM_FILE%.*}"
9 |
10 | SOURCE_BIN="_build/default/bin/bin.exe"
11 | RELEASE_DIR="_release"
12 | RELEASE_ZIP="$RELEASE_DIR/release.zip"
13 | RELEASE_BIN_DIR="$RELEASE_DIR/bin"
14 | RELEASE_BIN="$RELEASE_BIN_DIR/$LIB-$PLATFORM-$ARCH.exe"
15 |
16 | if [ ! -f "$RELEASE_ZIP" ]; then
17 | echo "$RELEASE_ZIP does not exist. Download it from Github and put in $RELEASE_DIR/ dir."
18 | exit 1
19 | fi
20 |
21 | echo "=== Releasing $LIB"
22 | echo "=== Unzipping release archive"
23 | unzip -d $RELEASE_DIR $RELEASE_ZIP
24 | rm $RELEASE_ZIP
25 | tree -a -L 2 $RELEASE_DIR
26 |
27 | echo ""
28 | echo "=== Preparing $PLATFORM $ARCH binary"
29 |
30 | CHMOD=$(stat -c %a "$RELEASE_BIN_DIR/$(ls $RELEASE_BIN_DIR | head -n 1)")
31 |
32 | dune build
33 | cp $SOURCE_BIN $RELEASE_BIN
34 | chmod $CHMOD $RELEASE_BIN
35 | tree -a -L 2 $RELEASE_DIR
36 |
37 | echo ""
38 | echo "=== Publishing to npm"
39 | cd $RELEASE_DIR
40 | rm .DS_Store >/dev/null 2>&1 || true
41 |
42 | echo "package.json:"
43 | cat package.json
44 | echo ""
45 |
46 | npm publish
47 | cd ..
48 |
49 | echo ""
50 | echo "=== Cleaning up"
51 | rm -rf $RELEASE_DIR/*
52 | tree -a -L 2 $RELEASE_DIR
53 |
--------------------------------------------------------------------------------
/rescript-linaria-ppx.opam:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MinimaHQ/rescript-linaria/f249c3f7b3cf3e760fcf027019c89ca1a661dbca/rescript-linaria-ppx.opam
--------------------------------------------------------------------------------
/shell.nix:
--------------------------------------------------------------------------------
1 | with import {};
2 | with pkgs.ocaml-ng.ocamlPackages_4_12;
3 |
4 | mkShell {
5 | buildInputs = [
6 | ocaml
7 | dune_2
8 | findlib
9 | ppxlib
10 | reason
11 | merlin
12 | ];
13 | }
14 |
--------------------------------------------------------------------------------