Skip to content

Commit b5a499a

Browse files
committed
Fmt
1 parent 29e225b commit b5a499a

File tree

8 files changed

+52
-40
lines changed

8 files changed

+52
-40
lines changed

.dnt.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ await invokeDenoNodeJSTransformer({
1212
fixInjectedImports: true,
1313
generateDeclarationMap: true,
1414
mappings: {
15-
"https://raw.githubusercontent.com/hugoalh/is-string-singleline-es/v1.0.4/mod.ts": {
15+
"https://raw.githubusercontent.com/hugoalh/is-string-singleline-es/v1.0.5/mod.ts": {
1616
name: "@hugoalh/is-string-singleline",
17-
version: "^1.0.4"
17+
version: "^1.0.5"
1818
}
1919
},
2020
metadata: {
@@ -39,7 +39,6 @@ await invokeDenoNodeJSTransformer({
3939
scripts: {
4040
},
4141
engines: {
42-
node: ">=16.13.0"
4342
},
4443
private: false,
4544
publishConfig: {

.github/workflows/publish-deno-package.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ jobs:
1010
contents: "read"
1111
id-token: "write"
1212
runs-on: "ubuntu-latest"
13+
env:
14+
CDV_NPM_ROOT: "dist/npm"
1315
steps:
1416
- name: "Checkout Repository"
1517
uses: "actions/checkout@v4"
1618
- name: "Setup Deno"
1719
uses: "denoland/setup-deno@v2"
1820
with:
19-
deno-version: "^2.2.10"
21+
deno-version: "^2.3.3"
2022
- name: "Get Deno Cache Path"
2123
id: "deno-cache-path"
2224
shell: "pwsh"
@@ -44,7 +46,7 @@ jobs:
4446
Add-Content -LiteralPath $Env:GITHUB_OUTPUT -Value "jsr-publish=$(($Null -ine $Config.tasks.('jsr-publish')).ToString().ToLower())"
4547
Add-Content -LiteralPath $Env:GITHUB_OUTPUT -Value "jsr-publish-provenance=$(($Null -ine $Config.tasks.('jsr-publish-provenance')).ToString().ToLower())"
4648
Add-Content -LiteralPath $Env:GITHUB_OUTPUT -Value "npm-build=$(($Null -ine $Config.tasks.('npm-build')).ToString().ToLower())"
47-
Add-Content -LiteralPath $Env:GITHUB_OUTPUT -Value "npm-root=$(Join-Path -Path $Env:GITHUB_WORKSPACE -ChildPath ($Config._behaviour.npm.root ?? 'dist/npm'))"
49+
Add-Content -LiteralPath $Env:GITHUB_OUTPUT -Value "npm-root=$(Join-Path -Path $Env:GITHUB_WORKSPACE -ChildPath $Env:CDV_NPM_ROOT)"
4850
- name: "Build Repository"
4951
if: "${{steps.metadata.outputs.build == 'true'}}"
5052
run: |-

.github/workflows/review-deno-code.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,15 @@ jobs:
2828
fail-fast: false
2929
runs-on: "${{matrix.run_on}}"
3030
env:
31+
CDV_NPM_ROOT: "dist/npm"
3132
CDV_RUN_LITE: "${{matrix.run_on != 'ubuntu-latest'}}"
3233
steps:
3334
- name: "Checkout Repository"
3435
uses: "actions/checkout@v4"
3536
- name: "Setup Deno"
3637
uses: "denoland/setup-deno@v2"
3738
with:
38-
deno-version: "^2.2.10"
39+
deno-version: "^2.3.3"
3940
- name: "Get Deno Cache Path"
4041
id: "deno-cache-path"
4142
shell: "pwsh"
@@ -62,7 +63,7 @@ jobs:
6263
Add-Content -LiteralPath $Env:GITHUB_OUTPUT -Value "build=$(($Null -ine $Config.tasks.build).ToString().ToLower())"
6364
Add-Content -LiteralPath $Env:GITHUB_OUTPUT -Value "jsr-check=$(($Null -ine $Config.tasks.('jsr-check')).ToString().ToLower())"
6465
Add-Content -LiteralPath $Env:GITHUB_OUTPUT -Value "npm-build=$(($Null -ine $Config.tasks.('npm-build')).ToString().ToLower())"
65-
Add-Content -LiteralPath $Env:GITHUB_OUTPUT -Value "npm-root=$(Join-Path -Path $Env:GITHUB_WORKSPACE -ChildPath ($Config._behaviour.npm.root ?? 'dist/npm'))"
66+
Add-Content -LiteralPath $Env:GITHUB_OUTPUT -Value "npm-root=$(Join-Path -Path $Env:GITHUB_WORKSPACE -ChildPath $Env:CDV_NPM_ROOT)"
6667
- name: "Check Repository"
6768
if: "${{!cancelled() && steps.analyze.outcome == 'success' && env.CDV_RUN_LITE == 'false'}}"
6869
shell: "pwsh"
@@ -77,11 +78,11 @@ jobs:
7778
- name: "Check Code"
7879
if: "${{!cancelled() && steps.analyze.outcome == 'success'}}"
7980
run: |-
80-
deno check **/*
81+
deno check
8182
- name: "Lint Code"
8283
if: "${{!cancelled() && steps.analyze.outcome == 'success'}}"
8384
run: |-
84-
deno lint
85+
deno lint --permit-no-files
8586
- name: "Check Dependencies Update"
8687
if: "${{!cancelled() && steps.analyze.outcome == 'success' && env.CDV_RUN_LITE == 'false'}}"
8788
run: |-
@@ -103,7 +104,7 @@ jobs:
103104
id: "test"
104105
if: "${{!cancelled() && steps.analyze.outcome == 'success'}}"
105106
run: |-
106-
deno test --allow-all --coverage --no-prompt --permit-no-files --trace-leaks
107+
deno test --allow-all --coverage --coverage-raw-data-only --no-prompt --permit-no-files --trace-leaks
107108
- name: "List Test Code Coverage"
108109
if: "${{!cancelled() && steps.analyze.outcome == 'success'}}"
109110
shell: "pwsh"

.hugoalh.lint.ts

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
import { configureDenoLintPlugin } from "HUGOALH_DENO_LINT_RULES";
2-
export default configureDenoLintPlugin({
3-
"max-complexity": true,
4-
"max-file-size": true,
5-
"no-alert": true,
6-
"no-confirm": true,
7-
"no-iife": true,
8-
"no-import-dynamic": true,
9-
"no-import-npm": true,
10-
"no-prompt": true,
11-
"prefer-symbol-description": true
1+
import { configurePlugin } from "HUGOALH_DENO_LINT_RULES";
2+
export default configurePlugin({
3+
rules: {
4+
"max-complexity": true,
5+
"max-file-size": true,
6+
"no-alert": true,
7+
"no-character-ambiguous": true,
8+
"no-character-invisible": true,
9+
"no-confirm": true,
10+
"no-decorator": true,
11+
"no-iife": true,
12+
"no-import-dynamic": true,
13+
"no-import-npm": true,
14+
"no-prompt": true,
15+
"prefer-symbol-description": true
16+
}
1217
}) satisfies Deno.lint.Plugin as Deno.lint.Plugin;

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@ An ECMAScript (JavaScript & TypeScript) module to handle the [HTTP header `Link`
1212

1313
### 🎯 Targets
1414

15-
| | **Remote** | **JSR** | **NPM** |
16-
|:--|:--|:--|:--|
17-
| **[Bun](https://bun.sh/)** >= v1.1.0 ||| ✔️ |
18-
| **[Cloudflare Workers](https://workers.cloudflare.com/)** ||| ✔️ |
19-
| **[Deno](https://deno.land/)** >= v1.42.0 | ✔️ | ✔️ | ✔️ |
20-
| **[NodeJS](https://nodejs.org/)** >= v16.13.0 ||| ✔️ |
15+
| **Targets** | **Remote** | **JSR** | **NPM** |
16+
|:--|:-:|:-:|:-:|
17+
| **[Bun](https://bun.sh/)** >= v1.1.0 || ✔️ | ✔️ |
18+
| **[Deno](https://deno.land/)** >= v2.1.0 | ✔️ | ✔️ | ✔️ |
19+
| **[NodeJS](https://nodejs.org/)** >= v20.9.0 || ✔️ | ✔️ |
2120

2221
> [!NOTE]
2322
> - It is possible to use this module in other methods/ways which not listed in here, however those methods/ways are not officially supported, and should beware maybe cause security issues.

deno.jsonc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"useTabs": true
1010
},
1111
"imports": { // IMPORTANT: Only remap development dependencies!
12-
"DNT": "https://raw.githubusercontent.com/hugoalh/deno-nodejs-transformer/v0.7.1/mod.ts",
13-
"HUGOALH_DENO_LINT_RULES": "https://raw.githubusercontent.com/hugoalh/deno-lint-rules/v0.7.0/mod.ts"
12+
"DNT": "https://raw.githubusercontent.com/hugoalh/deno-nodejs-transformer/v0.7.3/mod.ts",
13+
"HUGOALH_DENO_LINT_RULES": "https://raw.githubusercontent.com/hugoalh/deno-lint-rules/v0.8.3/mod.ts"
1414
},
1515
"lint": {
1616
"plugins": [
@@ -28,6 +28,7 @@
2828
"no-eval",
2929
"no-non-null-asserted-optional-chain",
3030
"no-self-compare",
31+
"no-slow-types",
3132
"no-sparse-arrays",
3233
"no-sync-fn-in-async-fn",
3334
"no-throw-literal",

jsr.jsonc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"$schema": "https://deno.land/x/deno/cli/schemas/config-file.v1.json",
33
"name": "@hugoalh/http-header-link",
4-
"version": "1.0.3",
4+
"version": "1.0.4",
55
"exports": {
66
".": "./mod.ts"
77
},
88
"imports": {
9-
"https://raw.githubusercontent.com/hugoalh/is-string-singleline-es/v1.0.4/mod.ts": "jsr:@hugoalh/is-string-singleline@^1.0.4"
9+
"https://raw.githubusercontent.com/hugoalh/is-string-singleline-es/v1.0.5/mod.ts": "jsr:@hugoalh/is-string-singleline@^1.0.5"
1010
},
1111
"publish": {
1212
"exclude": [

mod.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { isStringSingleLine } from "https://raw.githubusercontent.com/hugoalh/is-string-singleline-es/v1.0.4/mod.ts";
1+
import { isStringSingleLine } from "https://raw.githubusercontent.com/hugoalh/is-string-singleline-es/v1.0.5/mod.ts";
22
const parametersNeedLowerCase: string[] = [
33
"rel",
44
"type"
@@ -139,7 +139,7 @@ export class HTTPHeaderLink {
139139
* Handle the HTTP header `Link` according to the specification RFC 8288.
140140
* @param {...(string | Headers | HTTPHeaderLink | HTTPHeaderLinkEntry[] | Response)} inputs Input.
141141
*/
142-
constructor(...inputs: (string | Headers | HTTPHeaderLink | HTTPHeaderLinkEntry[] | Response)[]) {
142+
constructor(...inputs: readonly (string | Headers | HTTPHeaderLink | HTTPHeaderLinkEntry[] | Response)[]) {
143143
if (inputs.length > 0) {
144144
this.add(...inputs);
145145
}
@@ -149,7 +149,7 @@ export class HTTPHeaderLink {
149149
* @param {...(string | Headers | HTTPHeaderLink | HTTPHeaderLinkEntry[] | Response)} inputs Input.
150150
* @returns {this}
151151
*/
152-
add(...inputs: (string | Headers | HTTPHeaderLink | HTTPHeaderLinkEntry[] | Response)[]): this {
152+
add(...inputs: readonly (string | Headers | HTTPHeaderLink | HTTPHeaderLinkEntry[] | Response)[]): this {
153153
for (const input of inputs) {
154154
if (input instanceof HTTPHeaderLink) {
155155
this.#entries.push(...structuredClone(input.#entries));
@@ -170,10 +170,15 @@ export class HTTPHeaderLink {
170170
return [uri, structuredClone(parameters)];
171171
}));
172172
} else {
173-
for (const entry of parseLinkFromString(((
174-
input instanceof Headers ||
175-
input instanceof Response
176-
) ? ((input instanceof Headers) ? input : input.headers).get("Link") : input) ?? "")) {
173+
let inputFmt: string;
174+
if (input instanceof Response) {
175+
inputFmt = input.headers.get("Link") ?? "";
176+
} else if (input instanceof Headers) {
177+
inputFmt = input.get("Link") ?? "";
178+
} else {
179+
inputFmt = input;
180+
}
181+
for (const entry of parseLinkFromString(inputFmt)) {
177182
this.#entries.push(entry);
178183
}
179184
}
@@ -245,15 +250,15 @@ export class HTTPHeaderLink {
245250
* @param {...(string | Headers | HTTPHeaderLink | HTTPHeaderLinkEntry[] | Response)} inputs Input.
246251
* @returns {HTTPHeaderLink}
247252
*/
248-
static parse(...inputs: (string | Headers | HTTPHeaderLink | HTTPHeaderLinkEntry[] | Response)[]): HTTPHeaderLink {
253+
static parse(...inputs: readonly (string | Headers | HTTPHeaderLink | HTTPHeaderLinkEntry[] | Response)[]): HTTPHeaderLink {
249254
return new this(...inputs);
250255
}
251256
/**
252257
* Stringify as the HTTP header `Link` according to the specification RFC 8288.
253258
* @param {...(string | Headers | HTTPHeaderLink | HTTPHeaderLinkEntry[] | Response)} inputs Input.
254259
* @returns {string}
255260
*/
256-
static stringify(...inputs: (string | Headers | HTTPHeaderLink | HTTPHeaderLinkEntry[] | Response)[]): string {
261+
static stringify(...inputs: readonly (string | Headers | HTTPHeaderLink | HTTPHeaderLinkEntry[] | Response)[]): string {
257262
return new this(...inputs).toString();
258263
}
259264
}

0 commit comments

Comments
 (0)