diff --git a/playground/examples/HTMLRewriter.E1.FindAllLinks.js b/playground/examples/HTMLRewriter.E1.FindAllLinks.js index 12e3fef..39581a6 100644 --- a/playground/examples/HTMLRewriter.E1.FindAllLinks.js +++ b/playground/examples/HTMLRewriter.E1.FindAllLinks.js @@ -15,11 +15,11 @@ function findInternalLinks(html) { } }) - }).transform(new Response(html, undefined)); + }).transform(new Response(html)); return internalLinks; } -var content = await fetch("https://bun.sh", undefined); +var content = await fetch("https://bun.sh"); var html = await content.text(); diff --git a/playground/examples/HTMLRewriter.E2.RewriteDivs.js b/playground/examples/HTMLRewriter.E2.RewriteDivs.js index 139fcfd..1166727 100644 --- a/playground/examples/HTMLRewriter.E2.RewriteDivs.js +++ b/playground/examples/HTMLRewriter.E2.RewriteDivs.js @@ -11,7 +11,7 @@ var rewriter = new HTMLRewriter().on("*", { }) }); -var response = await fetch("https://bun.sh", undefined); +var response = await fetch("https://bun.sh"); var transformedResponse = rewriter.transform(response); diff --git a/playground/examples/HTTP.E1.SimpleServer.js b/playground/examples/HTTP.E1.SimpleServer.js index 219d440..47cf6d7 100644 --- a/playground/examples/HTTP.E1.SimpleServer.js +++ b/playground/examples/HTTP.E1.SimpleServer.js @@ -3,8 +3,16 @@ var server = Bun.serve({ port: 3000, - fetch: (async function (_request, _server) { - return new Response("Welcome to Bun!", undefined); + fetch: (async function (request, _server) { + var url = new URL(request.url); + var match = url.pathname; + if (match === "/") { + return Response.json({ + test: 1 + }); + } else { + return new Response("404!"); + } }) }); @@ -13,14 +21,14 @@ console.log("Listening on localhost: " + server.port.toString()); var tlsServer = Bun.serve({ tls: { ca: [ - Bun.file("ca1.pem", undefined), - Bun.file("ca2.pem", undefined) + Bun.file("ca1.pem"), + Bun.file("ca2.pem") ], - cert: [Bun.file("cert.pem", undefined)], - key: [Bun.file("key.pem", undefined)] + cert: [Bun.file("cert.pem")], + key: [Bun.file("key.pem")] }, fetch: (async function (_request, _server) { - return new Response("Welcome to Bun!", undefined); + return new Response("Welcome to Bun!"); }) }); diff --git a/playground/examples/HTTP.E2.Fetch.js b/playground/examples/HTTP.E2.Fetch.js index cedad01..ef37571 100644 --- a/playground/examples/HTTP.E2.Fetch.js +++ b/playground/examples/HTTP.E2.Fetch.js @@ -2,7 +2,7 @@ import * as Core__Option from "@rescript/core/src/Core__Option.js"; -var response = await fetch("https://bun.sh", undefined); +var response = await fetch("https://bun.sh"); var html = await response.text(); diff --git a/playground/examples/HTTP.E3.StreamFile.js b/playground/examples/HTTP.E3.StreamFile.js index 99355b7..db535da 100644 --- a/playground/examples/HTTP.E3.StreamFile.js +++ b/playground/examples/HTTP.E3.StreamFile.js @@ -5,7 +5,7 @@ import * as Caml_option from "rescript/lib/es6/caml_option.js"; var path = Nodepath.resolve(import.meta.dir, "test.txt"); -var file = Bun.file(path, undefined); +var file = Bun.file(path); var resp = new Response(file); @@ -13,7 +13,7 @@ console.log(Caml_option.nullable_to_opt(resp.headers.get("Content-Type"))); var _server = Bun.serve({ fetch: (async function (req, _server) { - return new Response(Bun.file(new URL(req.url).pathname, undefined)); + return new Response(Bun.file(new URL(req.url).pathname)); }) }); diff --git a/playground/examples/HTTP.E4.FileUploads.js b/playground/examples/HTTP.E4.FileUploads.js index fb53b55..c8470b7 100644 --- a/playground/examples/HTTP.E4.FileUploads.js +++ b/playground/examples/HTTP.E4.FileUploads.js @@ -9,7 +9,7 @@ var server = Bun.serve({ var match = url.pathname; switch (match) { case "/" : - return new Response(Bun.file("index.html", undefined)); + return new Response(Bun.file("index.html")); case "/action" : var formData = await req.formData(); formData.get("name"); @@ -20,8 +20,8 @@ var server = Bun.serve({ if (typeof profilePicture === "string") { return RescriptCore.panic("Must upload a profile picture"); } - await Bun.write("profilePicture.png", Bun.file(profilePicture, undefined)); - return new Response("Success", undefined); + await Bun.write("profilePicture.png", Bun.file(profilePicture)); + return new Response("Success"); default: return new Response("Not Found", { status: 404 diff --git a/playground/examples/Utils.E1.HashPassword.js b/playground/examples/Utils.E1.HashPassword.js index 8e36b35..816639d 100644 --- a/playground/examples/Utils.E1.HashPassword.js +++ b/playground/examples/Utils.E1.HashPassword.js @@ -3,7 +3,7 @@ var password = "super-secure-pa$$word"; -var hash = await Bun.password.hash(password, undefined); +var hash = await Bun.password.hash(password); console.log(hash); @@ -22,7 +22,7 @@ var bcryptHash = await Bun.password.hash(password, { console.log(bcryptHash); -var isMatch = await Bun.password.verify(password, hash, undefined); +var isMatch = await Bun.password.verify(password, hash); console.log(isMatch); diff --git a/playground/examples/Utils.E5.DeepEquals.js b/playground/examples/Utils.E5.DeepEquals.js index e733f49..36a6a6a 100644 --- a/playground/examples/Utils.E5.DeepEquals.js +++ b/playground/examples/Utils.E5.DeepEquals.js @@ -17,7 +17,7 @@ var b = { } }; -var equals = Bun.deepEquals(a, b, undefined); +var equals = Bun.deepEquals(a, b); console.log(equals); diff --git a/playground/package-lock.json b/playground/package-lock.json index d064bb5..50ecdc8 100644 --- a/playground/package-lock.json +++ b/playground/package-lock.json @@ -9,21 +9,21 @@ "version": "0.1.0", "license": "ISC", "dependencies": { - "@rescript/core": "1.0.0", - "rescript": "11.1.0-rc.2", + "@rescript/core": "1.3.0", + "rescript": "11.1.1", "rescript-bun": "../" } }, "..": { - "version": "0.3.1", + "version": "0.5.0", "license": "MIT", "devDependencies": { - "@rescript/core": "1.0.0", - "rescript": "11.1.0-rc.2" + "@rescript/core": "1.3.0", + "rescript": "11.1.1" }, "peerDependencies": { - "@rescript/core": ">=1.0.0", - "rescript": ">=11.0.0 || ^11.1.0-rc.2" + "@rescript/core": ">=1.3.0", + "rescript": ">=11.1.0" } }, "../node_modules/@rescript/core": { @@ -49,16 +49,18 @@ } }, "node_modules/@rescript/core": { - "version": "1.0.0", - "license": "MIT", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@rescript/core/-/core-1.3.0.tgz", + "integrity": "sha512-wNZOZ63sYcaIYZCmTZeIPCeLa3HCGgPbIOR8zjyNkoBYUlxNV8Nb2ZyqlXR5Mb9ttvv8fTV56JbKhyVEZEYo8g==", "peerDependencies": { - "rescript": ">=11.0.0 || ^11.1.0-rc.2" + "rescript": "^11.1.0-rc.7" } }, "node_modules/rescript": { - "version": "11.1.0-rc.2", + "version": "11.1.1", + "resolved": "https://registry.npmjs.org/rescript/-/rescript-11.1.1.tgz", + "integrity": "sha512-FMELeoiR1n3LzBdBt+k7U4l0vsz5Xh0HBSHf+0NhyhzZkMRLkEKEDNrcqZc6RIux9bxmxoO+zEa9qFM01VOXAw==", "hasInstallScript": true, - "license": "SEE LICENSE IN LICENSE", "bin": { "bsc": "bsc", "bstracing": "lib/bstracing", diff --git a/playground/package.json b/playground/package.json index b863bee..e6ed3e9 100644 --- a/playground/package.json +++ b/playground/package.json @@ -11,8 +11,8 @@ "author": "", "license": "ISC", "dependencies": { - "@rescript/core": "1.0.0", - "rescript": "11.1.0-rc.2", + "@rescript/core": "1.3.0", + "rescript": "11.1.1", "rescript-bun": "../" } } diff --git a/playground/rescript.json b/playground/rescript.json index 1337af6..0cfa3f2 100644 --- a/playground/rescript.json +++ b/playground/rescript.json @@ -13,7 +13,7 @@ } ], "package-specs": { - "module": "es6", + "module": "esmodule", "in-source": true }, "suffix": ".js", diff --git a/playground/src/Playground.js b/playground/src/Playground.js index 90a9d2e..8b89edb 100644 --- a/playground/src/Playground.js +++ b/playground/src/Playground.js @@ -9,7 +9,7 @@ rewriter.on("*", { }) }); -var transformedResponse = rewriter.transform(new Response("
hellO!
", undefined)); +var transformedResponse = rewriter.transform(new Response("
hellO!
")); var html = await transformedResponse.text(); diff --git a/playground/tests/TestingPlayground.test.js b/playground/tests/TestingPlayground.test.js index 5dd113c..b923f7b 100644 --- a/playground/tests/TestingPlayground.test.js +++ b/playground/tests/TestingPlayground.test.js @@ -5,7 +5,7 @@ import * as Buntest from "bun:test"; Buntest.describe("Playing around with tests", (function () { Buntest.test("addition works", (function () { Buntest.expect(2).toBe(2); - }), undefined); + })); })); export { diff --git a/test/Shell.test.js b/test/Shell.test.js deleted file mode 100644 index ef4f7ae..0000000 --- a/test/Shell.test.js +++ /dev/null @@ -1,16 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE - -import * as $$Bun from "bun"; -import * as Buntest from "bun:test"; - -Buntest.describe("shell", (function () { - Buntest.test("basic commands work", (async function () { - var res = await $$Bun.$`echo "HELLO"`; - Buntest.expect(res.stdout.toString()).toBe("HELLO\n"); - })); - })); - -export { - -} -/* Not a pure module */