diff --git a/package-lock.json b/package-lock.json index 408dcbe..259275f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,17 +6,16 @@ "packages": { "": { "name": "@rescript/react", - "version": "0.10.2", + "version": "0.10.3", "license": "MIT", "devDependencies": { - "bs-platform": "8.3.0", "jest": "^26.0.1", "react": "^16.8.1", "react-dom": "^16.8.1", - "reason-test-framework": "^0.3.2" + "reason-test-framework": "^0.3.2", + "rescript": "rescript-lang/rescript-compiler" }, "peerDependencies": { - "bs-platform": ">=8.3.0", "react": ">=16.8.1", "react-dom": ">=16.8.1" } @@ -554,7 +553,6 @@ "jest-resolve": "^26.6.2", "jest-util": "^26.6.2", "jest-worker": "^26.6.2", - "node-notifier": "^8.0.0", "slash": "^3.0.0", "source-map": "^0.6.0", "string-length": "^4.0.1", @@ -1090,12 +1088,6 @@ "integrity": "sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==", "dev": true }, - "node_modules/bs-platform": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/bs-platform/-/bs-platform-8.3.0.tgz", - "integrity": "sha512-E/Yj3mbEnALkFKrHX4vU+GkLe2eIG7/bVWgNJZxO6/EqRkIimIoClPTG6MN30gwxVBRARLyHEJDXcQQ71MaUSQ==", - "peer": true - }, "node_modules/bser": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", @@ -2502,7 +2494,6 @@ "@types/node": "*", "anymatch": "^3.0.3", "fb-watchman": "^2.0.0", - "fsevents": "^2.1.2", "graceful-fs": "^4.2.4", "jest-regex-util": "^26.0.0", "jest-serializer": "^26.6.2", @@ -2820,7 +2811,8 @@ "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true }, "node_modules/js-yaml": { "version": "3.14.1", @@ -2982,7 +2974,7 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "peer": true, + "dev": true, "dependencies": { "js-tokens": "^3.0.0 || ^4.0.0" } @@ -3233,7 +3225,7 @@ "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "peer": true + "dev": true }, "node_modules/object-copy": { "version": "0.1.0", @@ -3466,7 +3458,7 @@ "version": "15.7.2", "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz", "integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==", - "peer": true, + "dev": true, "dependencies": { "loose-envify": "^1.4.0", "object-assign": "^4.1.1", @@ -3477,7 +3469,7 @@ "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", - "peer": true + "dev": true }, "node_modules/psl": { "version": "1.8.0", @@ -3511,7 +3503,7 @@ "version": "16.14.0", "resolved": "https://registry.npmjs.org/react/-/react-16.14.0.tgz", "integrity": "sha512-0X2CImDkJGApiAlcf0ODKIneSwBPhqJawOa5wCtKbu7ZECrmS26NvtSILynQ66cgkT/RJ4LidJOc3bUESwmU8g==", - "peer": true, + "dev": true, "dependencies": { "loose-envify": "^1.1.0", "object-assign": "^4.1.1", @@ -3522,7 +3514,7 @@ "version": "16.14.0", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.14.0.tgz", "integrity": "sha512-1gCeQXDLoIqMgqD3IO2Ah9bnf0w9kzhwN5q4FGnHZ67hBm9yePzB5JJAIQCc8x3pFnNlwFq4RidZggNAAkzWWw==", - "peer": true, + "dev": true, "dependencies": { "loose-envify": "^1.1.0", "object-assign": "^4.1.1", @@ -3685,6 +3677,19 @@ "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", "dev": true }, + "node_modules/rescript": { + "version": "10.0.0", + "resolved": "git+ssh://git@github.com/rescript-lang/rescript-compiler.git#cf8ff3b4fdbfff7093251130c9b9bd1cff52a2a3", + "dev": true, + "hasInstallScript": true, + "license": "SEE LICENSE IN LICENSE", + "bin": { + "bsc": "bsc", + "bsrefmt": "bsrefmt", + "bstracing": "lib/bstracing", + "rescript": "rescript" + } + }, "node_modules/resolve": { "version": "1.19.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz", @@ -3904,7 +3909,7 @@ "version": "0.19.1", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.19.1.tgz", "integrity": "sha512-n/zwRWRYSUj0/3g/otKDRPMh6qv2SYMWNq85IEa8iZyAv8od9zDYpGSnpBEjNgcMNq6Scbu5KfIPxNF72R/2EA==", - "peer": true, + "dev": true, "dependencies": { "loose-envify": "^1.1.0", "object-assign": "^4.1.1" @@ -5820,12 +5825,6 @@ "integrity": "sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==", "dev": true }, - "bs-platform": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/bs-platform/-/bs-platform-8.3.0.tgz", - "integrity": "sha512-E/Yj3mbEnALkFKrHX4vU+GkLe2eIG7/bVWgNJZxO6/EqRkIimIoClPTG6MN30gwxVBRARLyHEJDXcQQ71MaUSQ==", - "peer": true - }, "bser": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", @@ -7581,7 +7580,8 @@ "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true }, "js-yaml": { "version": "3.14.1", @@ -7743,7 +7743,7 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "peer": true, + "dev": true, "requires": { "js-tokens": "^3.0.0 || ^4.0.0" } @@ -8000,7 +8000,7 @@ "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "peer": true + "dev": true }, "object-copy": { "version": "0.1.0", @@ -8235,7 +8235,7 @@ "version": "15.7.2", "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz", "integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==", - "peer": true, + "dev": true, "requires": { "loose-envify": "^1.4.0", "object-assign": "^4.1.1", @@ -8246,7 +8246,7 @@ "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", - "peer": true + "dev": true } } }, @@ -8282,7 +8282,7 @@ "version": "16.14.0", "resolved": "https://registry.npmjs.org/react/-/react-16.14.0.tgz", "integrity": "sha512-0X2CImDkJGApiAlcf0ODKIneSwBPhqJawOa5wCtKbu7ZECrmS26NvtSILynQ66cgkT/RJ4LidJOc3bUESwmU8g==", - "peer": true, + "dev": true, "requires": { "loose-envify": "^1.1.0", "object-assign": "^4.1.1", @@ -8293,7 +8293,7 @@ "version": "16.14.0", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.14.0.tgz", "integrity": "sha512-1gCeQXDLoIqMgqD3IO2Ah9bnf0w9kzhwN5q4FGnHZ67hBm9yePzB5JJAIQCc8x3pFnNlwFq4RidZggNAAkzWWw==", - "peer": true, + "dev": true, "requires": { "loose-envify": "^1.1.0", "object-assign": "^4.1.1", @@ -8462,6 +8462,11 @@ "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", "dev": true }, + "rescript": { + "version": "git+ssh://git@github.com/rescript-lang/rescript-compiler.git#cf8ff3b4fdbfff7093251130c9b9bd1cff52a2a3", + "dev": true, + "from": "rescript@rescript-lang/rescript-compiler" + }, "resolve": { "version": "1.19.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz", @@ -8689,7 +8694,7 @@ "version": "0.19.1", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.19.1.tgz", "integrity": "sha512-n/zwRWRYSUj0/3g/otKDRPMh6qv2SYMWNq85IEa8iZyAv8od9zDYpGSnpBEjNgcMNq6Scbu5KfIPxNF72R/2EA==", - "peer": true, + "dev": true, "requires": { "loose-envify": "^1.1.0", "object-assign": "^4.1.1" diff --git a/package.json b/package.json index 870e37b..abd5b62 100644 --- a/package.json +++ b/package.json @@ -11,9 +11,9 @@ "src/**/*.resi" ], "scripts": { - "build": "bsb -make-world", - "start": "bsb -make-world -w", - "clean": "bsb -clean-world", + "build": "rescript", + "start": "rescript build -w", + "clean": "rescript clean -with-deps", "test": "echo 'tests disabled for now'" }, "keywords": [ @@ -28,11 +28,11 @@ }, "homepage": "https://rescript-lang.org/docs/react/latest/introduction", "devDependencies": { - "bs-platform": "8.3.0", "jest": "^26.0.1", "react": "^16.8.1", "react-dom": "^16.8.1", - "reason-test-framework": "^0.3.2" + "reason-test-framework": "^0.3.2", + "rescript": "rescript-lang/rescript-compiler" }, "peerDependencies": { "react": ">=16.8.1", diff --git a/src/RescriptReactRouter.res b/src/RescriptReactRouter.res index 73d0149..c65440c 100644 --- a/src/RescriptReactRouter.res +++ b/src/RescriptReactRouter.res @@ -17,11 +17,11 @@ external dispatchEvent: (Dom.window, Dom.event) => unit = "dispatchEvent" @get external search: Dom.location => string = "search" @send -external pushState: (Dom.history, @as(json`null`) _, @as("") _, ~href: string) => unit = +external pushState: (Dom.history, @as(json`null`) _, @as(json`""`) _, ~href: string) => unit = "pushState" @send -external replaceState: (Dom.history, @as(json`null`) _, @as("") _, ~href: string) => unit = +external replaceState: (Dom.history, @as(json`null`) _, @as(json`""`) _, ~href: string) => unit = "replaceState" @val external event: 'a = "Event" diff --git a/src/RescriptReactRouter.resi b/src/RescriptReactRouter.resi index 654235e..c1ee055 100644 --- a/src/RescriptReactRouter.resi +++ b/src/RescriptReactRouter.resi @@ -1,11 +1,11 @@ -@ocaml.doc( - "update the url with the string path. Example: `push(\"/book/1\")`, `push(\"/books#title\")` " -) +// @ocaml.doc( +// "update the url with the string path. Example: `push(\"/book/1\")`, `push(\"/books#title\")` " +// ) let push: string => unit -@ocaml.doc( - "update the url with the string path. modifies the current history entry instead of creating a new one. Example: `replace(\"/book/1\")`, `replace(\"/books#title\")` " -) +// @ocaml.doc( +// "update the url with the string path. modifies the current history entry instead of creating a new one. Example: `replace(\"/book/1\")`, `replace(\"/books#title\")` " +// ) let replace: string => unit type watcherID type url = { @@ -17,30 +17,30 @@ type url = { search: string, } -@ocaml.doc( - "start watching for URL changes. Returns a subscription token. Upon url change, calls the callback and passes it the url record " -) +// @ocaml.doc( +// "start watching for URL changes. Returns a subscription token. Upon url change, calls the callback and passes it the url record " +// ) let watchUrl: (url => unit) => watcherID -@ocaml.doc(" stop watching for URL changes ") +// @ocaml.doc(" stop watching for URL changes ") let unwatchUrl: watcherID => unit -@ocaml.doc("this is marked as \"dangerous\" because you technically shouldn't - be accessing the URL outside of watchUrl's callback; you'd read a potentially - stale url, instead of the fresh one inside watchUrl. +// @ocaml.doc("this is marked as \"dangerous\" because you technically shouldn't +// be accessing the URL outside of watchUrl's callback; you'd read a potentially +// stale url, instead of the fresh one inside watchUrl. - But this helper is sometimes needed, if you'd like to initialize a page - whose display/state depends on the URL, instead of reading from it in - watchUrl's callback, which you'd probably have put inside didMount (aka - too late, the page's already rendered). +// But this helper is sometimes needed, if you'd like to initialize a page +// whose display/state depends on the URL, instead of reading from it in +// watchUrl's callback, which you'd probably have put inside didMount (aka +// too late, the page's already rendered). - So, the correct (and idiomatic) usage of this helper is to only use it in - a component that's also subscribed to watchUrl. Please see - https://github.com/reasonml-community/reason-react-example/blob/master/src/todomvc/TodoItem.re - for an example.") +// So, the correct (and idiomatic) usage of this helper is to only use it in +// a component that's also subscribed to watchUrl. Please see +// https://github.com/reasonml-community/reason-react-example/blob/master/src/todomvc/TodoItem.re +// for an example.") let dangerouslyGetInitialUrl: (~serverUrlString: string=?, unit) => url -@ocaml.doc("hook for watching url changes. - * serverUrl is used for ssr. it allows you to specify the url without relying on browser apis existing/working as expected - ") +// @ocaml.doc("hook for watching url changes. +// * serverUrl is used for ssr. it allows you to specify the url without relying on browser apis existing/working as expected +// ") let useUrl: (~serverUrl: url=?, unit) => url