@murky-web/typebuddy 1.5.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/parse.js CHANGED
@@ -69,7 +69,7 @@ function parseDomainName(url, defaultValue) {
69
69
  let urlCandidate = normalizedValue;
70
70
  if (!normalizedValue.includes("://")) urlCandidate = `https://${normalizedValue}`;
71
71
  try {
72
- const { hostname } = new URL(urlCandidate);
72
+ const { hostname } = new globalThis.URL(urlCandidate);
73
73
  const [domainName] = hostname.replace(/^www\d?\./i, "").split(".");
74
74
  if (domainName === void 0 || domainName === "") return defaultValue;
75
75
  return domainName;
package/jsr.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "$schema": "https://jsr.io/schema/config-file.v1.json",
3
3
  "name": "@murky-web/typebuddy",
4
- "version": "1.5.0",
4
+ "version": "2.0.0",
5
5
  "license": "ISC",
6
6
  "exports": {
7
7
  ".": "./src/index.ts",
8
- "./biome": "./biome/index.ts",
9
8
  "./oxlint": "./oxlint/index.ts"
10
9
  },
11
10
  "publish": {
@@ -13,10 +12,7 @@
13
12
  "README.md",
14
13
  "src/**/*.ts",
15
14
  "oxlint/**/*.ts",
16
- "rules/**/*.ts",
17
- "biome/**/*.ts",
18
- "biome/*.grit",
19
- "biome/*.gritt"
15
+ "rules/**/*.ts"
20
16
  ],
21
17
  "exclude": [
22
18
  "tests/**",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@murky-web/typebuddy",
3
- "version": "1.5.0",
3
+ "version": "2.0.0",
4
4
  "description": "Your new best friend for simple typescript guards every project needs.",
5
5
  "private": false,
6
6
  "main": "./dist/index.js",
@@ -50,22 +50,17 @@
50
50
  "import": "./dist/oxlint.js",
51
51
  "default": "./dist/oxlint.js"
52
52
  },
53
- "./biome": {
54
- "types": "./biome/index.ts",
55
- "import": "./dist/biome.js",
56
- "default": "./dist/biome.js"
57
- },
58
53
  "./package.json": "./package.json"
59
54
  },
60
55
  "scripts": {
61
56
  "test": "vitest run",
62
57
  "build:local": "bun run build",
63
- "build": "bun run clean && tsdown && cp ./biome/*.grit ./dist/ && cp ./biome/*.gritt ./dist/",
58
+ "build": "bun run clean && tsdown",
64
59
  "clean": "rm -rf dist",
65
- "lint": "oxlint -c ./.oxlintrc.jsonc --tsconfig ./tsconfig.lint.json --type-aware src biome tsdown.config.ts vitest.config.ts",
66
- "lint:fix": "oxlint -c ./.oxlintrc.jsonc --tsconfig ./tsconfig.lint.json --type-aware --fix src biome tsdown.config.ts vitest.config.ts",
67
- "format": "oxfmt -c ../config/oxc/.oxfmtrc.jsonc src rules biome tests tsdown.config.ts vitest.config.ts",
68
- "format:check": "oxfmt -c ../config/oxc/.oxfmtrc.jsonc --check src rules biome tests tsdown.config.ts vitest.config.ts",
60
+ "lint": "oxlint -c ./.oxlintrc.jsonc --tsconfig ./tsconfig.lint.json --type-aware src tsdown.config.ts vitest.config.ts",
61
+ "lint:fix": "oxlint -c ./.oxlintrc.jsonc --tsconfig ./tsconfig.lint.json --type-aware --fix src tsdown.config.ts vitest.config.ts",
62
+ "format": "oxfmt -c ../../config/oxc/.oxfmtrc.jsonc src rules tests tsdown.config.ts vitest.config.ts",
63
+ "format:check": "oxfmt -c ../../config/oxc/.oxfmtrc.jsonc --check src rules tests tsdown.config.ts vitest.config.ts",
69
64
  "smoke:globals": "bun run build && tsc --project ./smoke/globals/tsconfig.json --noEmit && mkdir -p ./smoke/globals/node_modules/@murky-web && ln -sfn ../../../.. ./smoke/globals/node_modules/@murky-web/typebuddy && tsc --project ./smoke/globals/tsconfig.types.json --noEmit",
70
65
  "smoke:oxlint": "bun run build && bun ./smoke/oxlint/run-smoke.ts",
71
66
  "smoke:oxlint:fix": "bun run build && bun ./smoke/oxlint/run-fix-smoke.ts",
@@ -74,7 +69,6 @@
74
69
  "typecheck": "tsc --project ./tsconfig.json --noEmit && tsc --project ./tsconfig.vitest.json --noEmit"
75
70
  },
76
71
  "files": [
77
- "biome",
78
72
  "dist",
79
73
  "globals.d.ts",
80
74
  "jsr.json",
@@ -99,7 +93,6 @@
99
93
  "provenance": true
100
94
  },
101
95
  "devDependencies": {
102
- "@murky-web/config": "workspace:*",
103
96
  "@types/node": "^25.5.0"
104
97
  }
105
98
  }
package/src/parse.ts CHANGED
@@ -192,7 +192,7 @@ function parseDomainName(url: string, defaultValue?: string): Optional<string> {
192
192
  // Everything that depends on a parseable URL stays inside the `try`, so
193
193
  // there is no binding that has to be declared before it can be assigned.
194
194
  try {
195
- const { hostname } = new URL(urlCandidate);
195
+ const { hostname } = new globalThis.URL(urlCandidate);
196
196
  const normalizedHostname = hostname.replace(/^www\d?\./i, "");
197
197
  const [domainName] = normalizedHostname.split(".");
198
198
  if (domainName === undefined || domainName === "") {
package/biome/index.ts DELETED
@@ -1,6 +0,0 @@
1
- const resolveAsset = (asset: string): string =>
2
- decodeURIComponent(new URL(asset, import.meta.url).pathname);
3
-
4
- export const MaybePromiseRule: string = resolveAsset("./maybe_promise_rule.grit");
5
- export const OptionalRule: string = resolveAsset("./optional_rule.gritt");
6
- export const TryCatchAsyncRule: string = resolveAsset("./require-try-catch-async.grit");
@@ -1,15 +0,0 @@
1
- or {
2
- // 1. Replace Promise with MaybePromise in return types
3
- `: Promise<$type>` => `: MaybePromise<$type>`,
4
-
5
- // 2. Wrap return values in try blocks with { value, isError: false }
6
- `try { $tryBody } catch ($err) { $catchBody }` where {
7
- $tryBody <: contains `return $value` and {
8
- $value <: not contains `{ isError: $isErrorValue }`
9
- }
10
- } => `try { $tryBody <: replace `return $value` => `return { value: $value, isError: false }` } catch ($err) { $catchBody }`,
11
-
12
- // 3. Handle empty return statements in try blocks
13
- `try { $tryBody } catch ($err) { $catchBody }` where {
14
- $tryBody <: contains `return;`
15
- } => `try { $tryBody <: replace `return;` => `return { value: undefined, isError: false };` } catch ($err) { $catchBody }`,
@@ -1,11 +0,0 @@
1
- or {
2
- // T | null -> Maybe<T>
3
- `$type | null` where {
4
- $type <: not contains `null | undefined`
5
- } => `Maybe<$type>`,
6
-
7
- // T | null | undefined -> Nullable<T>
8
- `$type | null | undefined` where {
9
- $type <: not contains `null | undefined`
10
- } => `Nullable<$type>`
11
- }
@@ -1,3 +0,0 @@
1
- `$type | null | undefined` where {
2
- $type <: not contains `null | undefined`
3
- } => `Nullable<$type>`
@@ -1,8 +0,0 @@
1
- or {
2
- // T | null -> Maybe<T>
3
- `$type | null` where { $type <: not contains `null | undefined` } => `Maybe<$type>`,
4
- // T | null | undefined -> Nullable<T>
5
- `$type | null | undefined` where { $type <: not contains `null | undefined` } => `Nullable<$type>`,
6
- // T | undefined -> Optional<T>
7
- `$type | undefined` where { $type <: not contains `undefined` } => `Optional<$type>`
8
- }
@@ -1,5 +0,0 @@
1
- or {
2
- `async function $name($params) { $body }` where { $body <: not contains `try { $tryBody } catch ($err) { $catchBody }` } => `async function $name($params) { try { $body } catch (err) { // handle error } }`,
3
- `(async function($params) { $body })` where { $body <: not contains `try { $tryBody } catch ($err) { $catchBody }` } => `(async function($params) { try { $body } catch (err) { // handle error } })`,
4
- `(async ($params) => { $body })` where { $body <: not contains `try { $tryBody } catch ($err) { $catchBody }` } => `(async ($params) => { try { $body } catch (err) { // handle error } })`
5
- }
package/dist/biome.js DELETED
@@ -1,7 +0,0 @@
1
- //#region biome/index.ts
2
- const resolveAsset = (asset) => decodeURIComponent(new URL(asset, import.meta.url).pathname);
3
- const MaybePromiseRule = resolveAsset("./maybe_promise_rule.grit");
4
- const OptionalRule = resolveAsset("./optional_rule.gritt");
5
- const TryCatchAsyncRule = resolveAsset("./require-try-catch-async.grit");
6
- //#endregion
7
- export { MaybePromiseRule, OptionalRule, TryCatchAsyncRule };
@@ -1,15 +0,0 @@
1
- or {
2
- // 1. Replace Promise with MaybePromise in return types
3
- `: Promise<$type>` => `: MaybePromise<$type>`,
4
-
5
- // 2. Wrap return values in try blocks with { value, isError: false }
6
- `try { $tryBody } catch ($err) { $catchBody }` where {
7
- $tryBody <: contains `return $value` and {
8
- $value <: not contains `{ isError: $isErrorValue }`
9
- }
10
- } => `try { $tryBody <: replace `return $value` => `return { value: $value, isError: false }` } catch ($err) { $catchBody }`,
11
-
12
- // 3. Handle empty return statements in try blocks
13
- `try { $tryBody } catch ($err) { $catchBody }` where {
14
- $tryBody <: contains `return;`
15
- } => `try { $tryBody <: replace `return;` => `return { value: undefined, isError: false };` } catch ($err) { $catchBody }`,
@@ -1,11 +0,0 @@
1
- or {
2
- // T | null -> Maybe<T>
3
- `$type | null` where {
4
- $type <: not contains `null | undefined`
5
- } => `Maybe<$type>`,
6
-
7
- // T | null | undefined -> Nullable<T>
8
- `$type | null | undefined` where {
9
- $type <: not contains `null | undefined`
10
- } => `Nullable<$type>`
11
- }
@@ -1,3 +0,0 @@
1
- `$type | null | undefined` where {
2
- $type <: not contains `null | undefined`
3
- } => `Nullable<$type>`
@@ -1,8 +0,0 @@
1
- or {
2
- // T | null -> Maybe<T>
3
- `$type | null` where { $type <: not contains `null | undefined` } => `Maybe<$type>`,
4
- // T | null | undefined -> Nullable<T>
5
- `$type | null | undefined` where { $type <: not contains `null | undefined` } => `Nullable<$type>`,
6
- // T | undefined -> Optional<T>
7
- `$type | undefined` where { $type <: not contains `undefined` } => `Optional<$type>`
8
- }
@@ -1,5 +0,0 @@
1
- or {
2
- `async function $name($params) { $body }` where { $body <: not contains `try { $tryBody } catch ($err) { $catchBody }` } => `async function $name($params) { try { $body } catch (err) { // handle error } }`,
3
- `(async function($params) { $body })` where { $body <: not contains `try { $tryBody } catch ($err) { $catchBody }` } => `(async function($params) { try { $body } catch (err) { // handle error } })`,
4
- `(async ($params) => { $body })` where { $body <: not contains `try { $tryBody } catch ($err) { $catchBody }` } => `(async ($params) => { try { $body } catch (err) { // handle error } })`
5
- }