Skip to content

Commit 1b5ddb2

Browse files
committed
feat: adding polyfills via banner
1 parent 7d524ab commit 1b5ddb2

File tree

12 files changed

+2359
-102
lines changed

12 files changed

+2359
-102
lines changed

.prettierrc.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

.prettierrc.mjs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/** @type {import("prettier").Options} */
2+
const config = {
3+
bracketSpacing: true,
4+
tabWidth: 2,
5+
semi: true,
6+
singleQuote: false,
7+
printWidth: 80,
8+
singleAttributePerLine: true,
9+
plugins: ["./node_modules/prettier-plugin-jsdoc/dist/index.js"],
10+
jsdocSingleLineComment: false,
11+
};
12+
13+
export default config;

__tests__/polyfills/url.test.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { describe, expect, it } from "@reactgjs/gest";
2+
import "../../src/polyfills/url";
3+
4+
export default describe("FormData", () => {
5+
it("should have the URL defined in global scope", () => {
6+
expect(URL).toBeDefined();
7+
expect(new URL("http://google.com")).toBeDefined();
8+
});
9+
10+
it("should correctly handle parameters", () => {
11+
const url = new URL("http://google.com?foo=bar");
12+
expect(url.toString()).toEqual("http://google.com/?foo=bar");
13+
14+
url.searchParams.append("baz", "2");
15+
expect(url.toString()).toEqual("http://google.com/?foo=bar&baz=2");
16+
17+
url.searchParams.delete("foo");
18+
expect(url.toString()).toEqual("http://google.com/?baz=2");
19+
20+
url.searchParams.append("baz", "3");
21+
expect(url.toString()).toEqual("http://google.com/?baz=2&baz=3");
22+
});
23+
24+
it("should allow to change the port", () => {
25+
const url = new URL("http://google.com:8080");
26+
expect(url.port).toEqual("8080");
27+
url.port = "8081";
28+
expect(url.port).toEqual("8081");
29+
expect(url.toString()).toEqual("http://google.com:8081/");
30+
});
31+
32+
it("should allow to change the username and password", () => {
33+
const url = new URL("https://google.com");
34+
expect(url.username).toEqual("");
35+
expect(url.password).toEqual("");
36+
url.username = "myname";
37+
url.password = "12345678";
38+
expect(url.username).toEqual("myname");
39+
expect(url.password).toEqual("12345678");
40+
expect(url.toString()).toEqual("https://myname:[email protected]/");
41+
});
42+
});

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@
6161
"git-hook-tasks": "ncpa0cpl/git-hook-tasks",
6262
"gjs-esm-types": "^0.0.4",
6363
"husky": "latest",
64-
"prettier": "latest",
65-
"prettier-plugin-jsdoc": "latest",
64+
"prettier": "^3.0.3",
65+
"prettier-plugin-jsdoc": "^1.0.2",
6666
"typescript": "latest",
6767
"ws": "^8.14.1"
6868
},
6969
"peerDependencies": {
7070
"ts-node": "^10.9.1"
7171
}
72-
}
72+
}

scripts/build.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ async function main() {
6666

6767
await fs.writeFile(
6868
p("dist/config-schema.json"),
69-
JSON.stringify(configJsonSchema, null, 2)
69+
JSON.stringify(configJsonSchema, null, 2),
7070
);
7171

7272
const configTsType = toTsType(ConfigSchema, {

0 commit comments

Comments
 (0)