@fedify/fedify 0.8.0-dev.162 → 0.8.0-dev.164
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.
Potentially problematic release.
This version of @fedify/fedify might be problematic. Click here for more details.
- package/CHANGES.md +3 -0
- package/README.md +15 -9
- package/esm/runtime/docloader.js +12 -2
- package/package.json +1 -1
- package/types/runtime/docloader.d.ts.map +1 -1
package/CHANGES.md
CHANGED
@@ -51,6 +51,9 @@ To be released.
|
|
51
51
|
- `["fedify", "httpsig", "verify"]`
|
52
52
|
- `["fedify", "runtime", "docloader"]`
|
53
53
|
|
54
|
+
- Fixed a bug where the authenticated document loader had thrown `InvalidUrl`
|
55
|
+
error when the URL redirection was involved in Bun.
|
56
|
+
|
54
57
|
[@fedify/cli]: https://jsr.io/@fedify/cli
|
55
58
|
[FEP-8fcf]: https://codeberg.org/fediverse/fep/src/branch/main/fep/8fcf/fep-8fcf.md
|
56
59
|
|
package/README.md
CHANGED
@@ -74,16 +74,10 @@ Installation
|
|
74
74
|
------------
|
75
75
|
|
76
76
|
Fedify is available on [JSR] for [Deno] and on [npm] for [Node.js] and [Bun].
|
77
|
-
Although Fedify can be used in Node.js and Bun, it's primarily designed for
|
78
|
-
Deno. We recommend using Deno for the best experience, but you can use Node.js
|
79
|
-
or Bun if you prefer.
|
80
77
|
|
81
78
|
> [!TIP]
|
82
|
-
>
|
83
|
-
>
|
84
|
-
> Dahl. Deno has a lot of improvements over Node.js, such as better security,
|
85
|
-
> better TypeScript support, better ES module support, and built-in key-value
|
86
|
-
> store and message queue.
|
79
|
+
> We recommend using Deno or Bun (which are TypeScript-first) for the best
|
80
|
+
> experience, but you can use Node.js if you prefer.
|
87
81
|
|
88
82
|
[JSR]: https://jsr.io/@fedify/fedify
|
89
83
|
[Deno]: https://deno.com/
|
@@ -102,7 +96,7 @@ deno add @fedify/fedify
|
|
102
96
|
~~~~
|
103
97
|
|
104
98
|
Since Fedify requires [`Temporal`] API, which is an unstable feature in Deno as
|
105
|
-
of
|
99
|
+
of May 2024, you need to add the `"temporal"` to the `"unstable"` field of
|
106
100
|
the *deno.json* file:
|
107
101
|
|
108
102
|
~~~~ json
|
@@ -126,6 +120,18 @@ the following command:
|
|
126
120
|
npm add @fedify/fedify
|
127
121
|
~~~~
|
128
122
|
|
123
|
+
Fedify is an ESM-only package, so you need to add `"type": "module"` to the
|
124
|
+
*package.json* file:
|
125
|
+
|
126
|
+
~~~~ json
|
127
|
+
{
|
128
|
+
"type": "module",
|
129
|
+
"dependencies": {
|
130
|
+
"@fedify/fedify": "^0.8.0"
|
131
|
+
}
|
132
|
+
}
|
133
|
+
~~~~
|
134
|
+
|
129
135
|
### Bun
|
130
136
|
|
131
137
|
Fedify can also be used in Bun. You can install it via the following
|
package/esm/runtime/docloader.js
CHANGED
@@ -67,7 +67,12 @@ async function getRemoteDocument(url, response) {
|
|
67
67
|
export async function fetchDocumentLoader(url) {
|
68
68
|
const request = createRequest(url);
|
69
69
|
logRequest(request);
|
70
|
-
const response = await fetch(request
|
70
|
+
const response = await fetch(request, {
|
71
|
+
// Since Bun has a bug that ignores the `Request.redirect` option,
|
72
|
+
// to work around it we specify `redirect: "manual"` here too:
|
73
|
+
// https://github.com/oven-sh/bun/issues/10754
|
74
|
+
redirect: "manual",
|
75
|
+
});
|
71
76
|
// Follow redirects manually to get the final URL:
|
72
77
|
if (response.status >= 300 && response.status < 400 &&
|
73
78
|
response.headers.has("Location")) {
|
@@ -91,7 +96,12 @@ export function getAuthenticatedDocumentLoader(identity) {
|
|
91
96
|
let request = createRequest(url);
|
92
97
|
request = await sign(request, identity.privateKey, identity.keyId);
|
93
98
|
logRequest(request);
|
94
|
-
const response = await fetch(request
|
99
|
+
const response = await fetch(request, {
|
100
|
+
// Since Bun has a bug that ignores the `Request.redirect` option,
|
101
|
+
// to work around it we specify `redirect: "manual"` here too:
|
102
|
+
// https://github.com/oven-sh/bun/issues/10754
|
103
|
+
redirect: "manual",
|
104
|
+
});
|
95
105
|
// Follow redirects manually to get the final URL:
|
96
106
|
if (response.status >= 300 && response.status < 400 &&
|
97
107
|
response.headers.has("Location")) {
|
package/package.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"docloader.d.ts","sourceRoot":"","sources":["../../src/runtime/docloader.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAE5C,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAM1D;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;AAEtE;;;;;;;;GAQG;AACH,MAAM,MAAM,kCAAkC,GAAG,CAC/C,QAAQ,EAAE;IAAE,KAAK,EAAE,GAAG,CAAC;IAAC,UAAU,EAAE,OAAO,CAAC,SAAS,CAAA;CAAE,KACpD,cAAc,CAAC;AAEpB;;GAEG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACnC;;OAEG;IACH,GAAG,EAAE,GAAG,CAAC;IAET;;;;;OAKG;gBACS,GAAG,EAAE,GAAG,GAAG,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM;CAKhD;AAwDD;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,cAAc,CAAC,
|
1
|
+
{"version":3,"file":"docloader.d.ts","sourceRoot":"","sources":["../../src/runtime/docloader.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAE5C,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAM1D;;;GAGG;AACH,MAA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