Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ To be released.
[[#206], [#797], [#798], [#799], [#803], [#806], [#812], [#923] by
ChanHaeng Lee]

- Fixed CommonJS distribution files that use Temporal so they no longer
require `@js-temporal/polyfill` at runtime. The CommonJS build now
bundles `temporal-polyfill`, while type declarations rely on the standard
`esnext.temporal` lib reference. [[#823], [#925]]

[FEP-8b32]: https://w3id.org/fep/8b32
[FEP-ef61]: https://w3id.org/fep/ef61
[Standard Schema]: https://standardschema.dev/
Expand All @@ -67,9 +72,11 @@ To be released.
[#803]: https://github.com/fedify-dev/fedify/pull/803
[#806]: https://github.com/fedify-dev/fedify/pull/806
[#812]: https://github.com/fedify-dev/fedify/pull/812
[#823]: https://github.com/fedify-dev/fedify/issues/823
[#827]: https://github.com/fedify-dev/fedify/issues/827
[#915]: https://github.com/fedify-dev/fedify/pull/915
[#923]: https://github.com/fedify-dev/fedify/pull/923
[#925]: https://github.com/fedify-dev/fedify/pull/925

### @fedify/vocab

Expand All @@ -84,6 +91,11 @@ To be released.
`FeatureAuthorization`, plus actor `featuredCollections` and
`InteractionPolicy.canFeature` properties. [[#810], [#914]]

- Fixed the CommonJS vocabulary build so it no longer requires
`@js-temporal/polyfill` at runtime. The build now bundles
`temporal-polyfill`, while type declarations rely on the standard
`esnext.temporal` lib reference. [[#823], [#925]]

[FEP-7aa9]: https://w3id.org/fep/7aa9
[#810]: https://github.com/fedify-dev/fedify/issues/810
[#826]: https://github.com/fedify-dev/fedify/issues/826
Expand Down Expand Up @@ -111,6 +123,60 @@ To be released.
[#912]: https://github.com/fedify-dev/fedify/issues/912
[#913]: https://github.com/fedify-dev/fedify/pull/913

### @fedify/cli

- Switched the CLI's Temporal runtime dependency from
`@js-temporal/polyfill` to `temporal-polyfill`. [[#823], [#925]]

### @fedify/debugger

- Fixed the CommonJS debugger build so it no longer requires
`@js-temporal/polyfill` at runtime. The build now bundles
`temporal-polyfill`, while type declarations rely on the standard
`esnext.temporal` lib reference. [[#823], [#925]]

### @fedify/mysql

- Fixed the CommonJS MySQL adapter build so it no longer requires
`@js-temporal/polyfill` at runtime. The build now bundles
`temporal-polyfill`, while type declarations rely on the standard
`esnext.temporal` lib reference. [[#823], [#925]]

### @fedify/postgres

- Fixed the CommonJS PostgreSQL adapter build so it no longer requires
`@js-temporal/polyfill` at runtime. The build now bundles
`temporal-polyfill`, while type declarations rely on the standard
`esnext.temporal` lib reference. [[#823], [#925]]

### @fedify/redis

- Fixed the CommonJS Redis adapter build so it no longer requires
`@js-temporal/polyfill` at runtime. The build now bundles
`temporal-polyfill`, while type declarations rely on the standard
`esnext.temporal` lib reference. [[#823], [#925]]

### @fedify/relay

- Fixed the CommonJS relay build so it no longer requires
`@js-temporal/polyfill` at runtime. The build now bundles
`temporal-polyfill`, while type declarations rely on the standard
`esnext.temporal` lib reference. [[#823], [#925]]

### @fedify/sqlite

- Fixed the CommonJS SQLite adapter build so it no longer requires
`@js-temporal/polyfill` at runtime. The build now bundles
`temporal-polyfill`, while type declarations rely on the standard
`esnext.temporal` lib reference. [[#823], [#925]]

### @fedify/testing

- Fixed the CommonJS testing utilities build so it no longer requires
`@js-temporal/polyfill` at runtime. The build now bundles
`temporal-polyfill`, while type declarations rely on the standard
`esnext.temporal` lib reference. [[#823], [#925]]


Version 2.3.1
-------------
Expand Down
1 change: 1 addition & 0 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
"mysql2/promise": "npm:mysql2@^3.22.3/promise",
"postgres": "npm:postgres@^3.4.7",
"preact": "npm:preact@10.19.6",
"temporal-polyfill": "npm:temporal-polyfill@^1.0.1",
"tsdown": "npm:tsdown@^0.22.0"
},
"unstable": [
Expand Down
19 changes: 17 additions & 2 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"@fontsource-variable/bricolage-grotesque": "^5.2.10",
"@hackmd/markdown-it-task-lists": "^2.1.4",
"@hono/node-server": "^1.13.7",
"@js-temporal/polyfill": "catalog:",
"@logtape/file": "catalog:",
"@logtape/logtape": "catalog:",
"@lucide/vue": "^1.20.0",
Expand Down Expand Up @@ -67,6 +66,7 @@
"postgres": "catalog:",
"srvx": "^0.11.15",
"stringify-entities": "^4.0.4",
"temporal-polyfill": "catalog:",
"typescript": "catalog:",
"vitepress": "^2.0.0-alpha.17",
"vitepress-plugin-group-icons": "^1.7.5",
Expand Down
10 changes: 5 additions & 5 deletions docs/tutorial/astro-blog.md
Original file line number Diff line number Diff line change
Expand Up @@ -1911,14 +1911,14 @@ as the HTML page URL since we'll share the path `/posts/{slug}` between Astro
and Fedify via content negotiation. `content_hash` is a SHA-256 digest of the
title and body, used to detect edits.

### Adding `@js-temporal/polyfill`
### Adding `temporal-polyfill`

The `Article` object uses `Temporal.Instant` from the [TC39 Temporal proposal]
polyfill. Although `@fedify/vocab` already depends on this package, you should
list it directly in your project so the version stays under your control:

~~~~ sh
bun add @js-temporal/polyfill
bun add temporal-polyfill
~~~~

[TC39 Temporal proposal]: https://tc39.es/proposal-temporal/
Expand Down Expand Up @@ -1967,7 +1967,7 @@ import {
Person,
Undo,
} from "@fedify/vocab";
import { Temporal } from "@js-temporal/polyfill";
import { Temporal } from "temporal-polyfill";
import { getLogger } from "@logtape/logtape";
import {
addFollower,
Expand Down Expand Up @@ -2114,7 +2114,7 @@ Create *src/lib/publish.ts*:
// @noErrors
import type { RequestContext } from "@fedify/fedify";
import { Article, Create, Delete, Update } from "@fedify/vocab";
import { Temporal } from "@js-temporal/polyfill";
import { Temporal } from "temporal-polyfill";
import { getCollection } from "astro:content";
import { BLOG_IDENTIFIER } from "../federation.ts";
import db from "./db.ts";
Expand Down Expand Up @@ -2519,7 +2519,7 @@ import {
Undo,
Update,
} from "@fedify/vocab";
import { Temporal } from "@js-temporal/polyfill";
import { Temporal } from "temporal-polyfill";
import { getLogger } from "@logtape/logtape";
import {
addComment,
Expand Down
6 changes: 3 additions & 3 deletions docs/tutorial/content-sharing.md
Original file line number Diff line number Diff line change
Expand Up @@ -3482,15 +3482,15 @@ import {
type Recipient,
Undo,
} from "@fedify/vocab";
import { Temporal } from "@js-temporal/polyfill";
import { Temporal } from "temporal-polyfill";
// ...
import { actorKeys, followers, posts, users } from "./db/schema";
~~~~

We also need the polyfill itself in *package.json*:

~~~~ sh
npm install @js-temporal/polyfill
npm install temporal-polyfill
~~~~

Node.js 22 does not yet ship `Temporal` natively, and Fedify
Expand Down Expand Up @@ -6528,7 +6528,7 @@ import {
Note,
PUBLIC_COLLECTION,
} from "@fedify/vocab";
import { Temporal } from "@js-temporal/polyfill";
import { Temporal } from "temporal-polyfill";
import { and, eq } from "drizzle-orm";
import {
createError,
Expand Down
8 changes: 4 additions & 4 deletions docs/tutorial/microblog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3137,16 +3137,16 @@ object.

Before implementation, we need to install a necessary library. Because
the [Temporal API] used by Fedify to represent time is not yet built into
Node.js, we need the *[@js-temporal/polyfill]* package to polyfill it:
Node.js, we need the *[temporal-polyfill]* package to polyfill it:

~~~~ sh
npm add @js-temporal/polyfill
npm add temporal-polyfill
~~~~

Open the *src/federation.ts* file and `import` the installed package:

~~~~ typescript [src/federation.ts]
import { Temporal } from "@js-temporal/polyfill";
import { Temporal } from "temporal-polyfill";
~~~~

Also `import` the `Post` type and the `PUBLIC_COLLECTION` constant provided by
Expand Down Expand Up @@ -3259,7 +3259,7 @@ temporary domain name) in the Mastodon search box again:
This time, our created post appears properly in the search results!

[Temporal API]: https://tc39.es/proposal-temporal/docs/
[@js-temporal/polyfill]: https://github.com/js-temporal/temporal-polyfill
[temporal-polyfill]: https://github.com/fullcalendar/temporal-polyfill

### Sending `Create(Note)` activity

Expand Down
7 changes: 6 additions & 1 deletion mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,12 @@ run = "pnpm run --recursive --parallel --filter '!{docs}' --config.enable-pre-po

[tasks.test]
description = "Run the test suite across all environments (Deno, Node.js, Bun)"
depends = ["check", "test:deno", "test:node", "test:bun"]
depends = ["check", "test:deno", "test:node", "test:bun", "test:temporal-polyfill"]

[tasks."test:temporal-polyfill"]
description = "Check Temporal polyfill packaging"
depends = ["build"]
run = "deno run --allow-read --allow-write --allow-run scripts/check_temporal_polyfill.ts"

[tasks.test-each]
description = "Run tests for a specific package across all environments"
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@
"@inquirer/prompts": "^7.8.4",
"@jimp/core": "^1.6.1",
"@jimp/wasm-webp": "^1.6.1",
"@js-temporal/polyfill": "catalog:",
"@logtape/file": "catalog:",
"@logtape/logtape": "catalog:",
"@poppanator/http-constants": "^1.1.1",
Expand All @@ -109,6 +108,7 @@
"shiki": "^1.6.4",
"smol-toml": "^1.6.1",
"srvx": "^0.8.7",
"temporal-polyfill": "catalog:",
"valibot": "^1.4.0",
"yaml": "^2.9.0"
},
Expand Down
5 changes: 2 additions & 3 deletions packages/cli/tsdown.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { defineConfig } from "tsdown";
import { temporalPolyfillIntro } from "../../scripts/tsdown/temporal.mts";

export default defineConfig({
entry: [
Expand All @@ -24,9 +25,7 @@ export default defineConfig({
},
},
outputOptions(outputOptions) {
outputOptions.intro = `
import { Temporal } from "@js-temporal/polyfill";
`;
outputOptions.intro = temporalPolyfillIntro;
return outputOptions;
},
});
4 changes: 2 additions & 2 deletions packages/debugger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
"@fedify/fedify": "workspace:^"
},
"dependencies": {
"@js-temporal/polyfill": "catalog:",
"@logtape/logtape": "catalog:",
"@opentelemetry/api": "catalog:",
"@opentelemetry/context-async-hooks": "catalog:",
"@opentelemetry/core": "catalog:",
"@opentelemetry/sdk-trace-base": "catalog:",
"hono": "catalog:"
"hono": "catalog:",
"temporal-polyfill": "catalog:"
},
"devDependencies": {
"tsdown": "catalog:",
Expand Down
37 changes: 27 additions & 10 deletions packages/debugger/tsdown.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,35 @@
import { defineConfig } from "tsdown";
import {
temporalPolyfillCjsBanner,
temporalPolyfillCjsDeps,
temporalPolyfillEsmBanner,
temporalPolyfillImportPlugin,
} from "../../scripts/tsdown/temporal.mts";

export default defineConfig({
entry: ["src/mod.tsx"],
dts: { compilerOptions: { isolatedDeclarations: true, declaration: true } },
format: ["esm", "cjs"],
format: {
esm: {
banner: temporalPolyfillEsmBanner(),
},
cjs: {
deps: temporalPolyfillCjsDeps({
neverBundle: [
"@fedify/fedify",
"@fedify/fedify/federation",
"@fedify/fedify/otel",
"@logtape/logtape",
/^@logtape\//,
/^@opentelemetry\//,
"hono",
/^hono\//,
],
}),
plugins: [temporalPolyfillImportPlugin],
banner: temporalPolyfillCjsBanner(),
},
},
platform: "node",
outExtensions({ format }) {
return {
Expand All @@ -23,13 +49,4 @@ export default defineConfig({
/^hono\//,
],
},
banner({ format }) {
const js = format === "cjs"
? `const { Temporal } = require("@js-temporal/polyfill");`
: `import { Temporal } from "@js-temporal/polyfill";`;
return {
js,
dts: `/// <reference lib="esnext.temporal" />`,
};
},
});
Loading
Loading