Unverified Commit 0f08fd72 authored by Hong Minhee's avatar Hong Minhee
Browse files

Use built-in Temporal API in Deno

parent 0d511416
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -36,6 +36,10 @@ To be released.
        parameter became `CollectionDispatcher<Recipient, TContextData, URL>`
        (was `CollectionDispatcher<Actor | URL, TContextData>`).

 -  Removed the dependency on *@js-temporal/polyfill* on Deno, and Fedify now
    requires `--unstable-temporal` flag.  On other runtime, it still depends
    on *@js-temporal/polyfill*.

[FEP-8fcf]: https://codeberg.org/fediverse/fep/src/branch/main/fep/8fcf/fep-8fcf.md


+12 −15
Original line number Diff line number Diff line
@@ -105,15 +105,20 @@ via the following command:
deno add @fedify/fedify
~~~~

~~~~ typescript
import { Federation } from "@fedify/fedify";
Since Fedify requires [`Temporal`] API, which is an unstable feature in Deno as
of April 2024, you need to add the `"temporal"` to the `"unstable"` field of
the *deno.json* file:

~~~~ json
{
  "imports": {
    "@fedify/fedify": "jsr:@fedify/fedify"
  },
  "unstable": ["temporal"]
}
~~~~

Or you can directly import it in your code using `jsr:` specifier:

~~~~ typescript
import { Federation } from "jsr:@fedify/fedify";
~~~~
[`Temporal`]: https://tc39.es/proposal-temporal/docs/

### Node.js

@@ -125,10 +130,6 @@ the following command:
npm add @fedify/fedify
~~~~

~~~~ typescript
import { Federation } from "@fedify/fedify";
~~~~

### Bun

Fedify can also be used in Bun.  You can install it via the following
@@ -137,7 +138,3 @@ command:
~~~~ sh
bun add @fedify/fedify
~~~~

~~~~ typescript
import { Federation } from "@fedify/fedify";
~~~~
+0 −1
Original line number Diff line number Diff line
@@ -2,7 +2,6 @@ export const snapshot = {};
snapshot[`generateClasses() 1`] = `
"// deno-lint-ignore-file ban-unused-ignore
import { Temporal } from \\"@js-temporal/polyfill\\";
// @ts-ignore TS7016
import jsonld from \\"jsonld\\";
import { type LanguageTag, parseLanguageTag }
+0 −1
Original line number Diff line number Diff line
@@ -84,7 +84,6 @@ export async function* generateClasses(
): AsyncIterable<string> {
  runtimePath = runtimePath.replace(/\/+$/, "");
  yield "// deno-lint-ignore-file ban-unused-ignore\n";
  yield 'import { Temporal } from "@js-temporal/polyfill";\n';
  yield "// @ts-ignore TS7016\n";
  yield 'import jsonld from "jsonld";\n';
  yield `import { type LanguageTag, parseLanguageTag }
+3 −2
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@
    "@fedify/fedify/x/fresh": "./x/fresh.ts",
    "@fedify/fedify/x/hono": "./x/hono.ts",
    "@hongminhee/aitertools": "jsr:@hongminhee/aitertools@^0.6.0",
    "@js-temporal/polyfill": "npm:@js-temporal/polyfill@^0.4.4",
    "@logtape/logtape": "jsr:@logtape/logtape@^0.2.2",
    "@phensley/language-tag": "npm:@phensley/language-tag@^1.8.0",
    "@std/assert": "jsr:@std/assert@^0.220.1",
@@ -37,6 +36,7 @@
    "@std/collections": "jsr:@std/collections@^0.220.1",
    "@std/encoding": "jsr:@std/encoding@^0.220.1",
    "@std/encoding/base64": "jsr:@std/encoding@^0.220.1/base64",
    "@std/encoding/hex": "jsr:@std/encoding@^0.220.1/hex",
    "@std/fs": "jsr:@std/fs@^0.220.1",
    "@std/http/negotiation": "jsr:@std/http@^0.220.1/negotiation",
    "@std/json/common": "jsr:@std/json@^0.220.1/common",
@@ -76,7 +76,8 @@
    "hooks:pre-commit": "deno task check"
  },
  "unstable": [
    "kv"
    "kv",
    "temporal"
  ],
  "lock": false
}
Loading