@fedify/vocab 2.1.11 → 2.1.13

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.
@@ -1,6 +1,6 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { _ as Place, a as Create, b as Source, c as Follow, d as Link, f as Note, g as Person, i as Collection, m as OrderedCollectionPage, n as Announce, o as CryptographicKey, p as Object$1, s as Endpoints, t as Activity, u as Hashtag, v as Question, x as vocab_exports } from "./vocab-D49sM6zf.mjs";
3
+ import { _ as Place, a as Create, b as Source, c as Follow, d as Link, f as Note, g as Person, i as Collection, m as OrderedCollectionPage, n as Announce, o as CryptographicKey, p as Object$1, s as Endpoints, t as Activity, u as Hashtag, v as Question, x as vocab_exports } from "./vocab-Ba6I5fpC.mjs";
4
4
  import { t as assertInstanceOf } from "./utils-CE8Dk5hm.mjs";
5
5
  import { mockDocumentLoader, test } from "@fedify/fixture";
6
6
  import { deepStrictEqual, notDeepStrictEqual, ok, rejects, throws } from "node:assert/strict";
@@ -25,6 +25,22 @@ test("new Object()", () => {
25
25
  throws(() => new Object$1({ names: "foo" }), TypeError);
26
26
  throws(() => new Object$1({ names: ["foo", 123] }), TypeError);
27
27
  });
28
+ test("new Object() accepts foreign Temporal.Instant (issue #767)", () => {
29
+ const foreignInstant = globalThis.Object.create(globalThis.Object.prototype, {
30
+ [Symbol.toStringTag]: { value: "Temporal.Instant" },
31
+ epochNanoseconds: { value: 0n },
32
+ toString: { value: () => "1970-01-01T00:00:00Z" }
33
+ });
34
+ ok(new Object$1({ published: foreignInstant }).published === foreignInstant);
35
+ });
36
+ test("Object.clone() accepts foreign Temporal.Instant (issue #767)", () => {
37
+ const foreignInstant = globalThis.Object.create(globalThis.Object.prototype, {
38
+ [Symbol.toStringTag]: { value: "Temporal.Instant" },
39
+ epochNanoseconds: { value: 0n },
40
+ toString: { value: () => "1970-01-01T00:00:00Z" }
41
+ });
42
+ ok(new Object$1({}).clone({ published: foreignInstant }).published === foreignInstant);
43
+ });
28
44
  test("Object.clone()", () => {
29
45
  const obj = new Object$1({
30
46
  id: new URL("https://example.com/"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/vocab",
3
- "version": "2.1.11",
3
+ "version": "2.1.13",
4
4
  "homepage": "https://fedify.dev/",
5
5
  "repository": {
6
6
  "type": "git",
@@ -46,16 +46,16 @@
46
46
  "es-toolkit": "1.43.0",
47
47
  "jsonld": "^9.0.0",
48
48
  "pkijs": "^3.3.3",
49
- "@fedify/vocab-tools": "2.1.11",
50
- "@fedify/vocab-runtime": "2.1.11",
51
- "@fedify/webfinger": "2.1.11"
49
+ "@fedify/vocab-tools": "2.1.13",
50
+ "@fedify/webfinger": "2.1.13",
51
+ "@fedify/vocab-runtime": "2.1.13"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/node": "^22.17.0",
55
55
  "fast-check": "^3.22.0",
56
56
  "fetch-mock": "^12.5.4",
57
57
  "tsdown": "^0.21.6",
58
- "typescript": "^5.9.2",
58
+ "typescript": "^6.0.0",
59
59
  "@fedify/fixture": "2.0.0"
60
60
  },
61
61
  "keywords": [
package/src/vocab.test.ts CHANGED
@@ -70,6 +70,43 @@ test("new Object()", () => {
70
70
  );
71
71
  });
72
72
 
73
+ test(
74
+ // Regression test for
75
+ // https://github.com/fedify-dev/fedify/issues/767:
76
+ // values produced by a `Temporal` implementation other than the one bundled
77
+ // with Fedify (e.g. Node.js 26+ native `Temporal`) must be accepted as
78
+ // long as they conform to the spec-mandated `Symbol.toStringTag`.
79
+ "new Object() accepts foreign Temporal.Instant (issue #767)",
80
+ () => {
81
+ const foreignInstant = globalThis.Object.create(
82
+ globalThis.Object.prototype,
83
+ {
84
+ [Symbol.toStringTag]: { value: "Temporal.Instant" },
85
+ epochNanoseconds: { value: 0n },
86
+ toString: { value: () => "1970-01-01T00:00:00Z" },
87
+ },
88
+ ) as Temporal.Instant;
89
+ const obj = new Object({ published: foreignInstant });
90
+ ok(obj.published === foreignInstant);
91
+ },
92
+ );
93
+
94
+ test(
95
+ "Object.clone() accepts foreign Temporal.Instant (issue #767)",
96
+ () => {
97
+ const foreignInstant = globalThis.Object.create(
98
+ globalThis.Object.prototype,
99
+ {
100
+ [Symbol.toStringTag]: { value: "Temporal.Instant" },
101
+ epochNanoseconds: { value: 0n },
102
+ toString: { value: () => "1970-01-01T00:00:00Z" },
103
+ },
104
+ ) as Temporal.Instant;
105
+ const obj = new Object({}).clone({ published: foreignInstant });
106
+ ok(obj.published === foreignInstant);
107
+ },
108
+ );
109
+
73
110
  test("Object.clone()", () => {
74
111
  const obj = new Object({
75
112
  id: new URL("https://example.com/"),
package/tsdown.config.ts CHANGED
@@ -19,17 +19,14 @@ export default [
19
19
  format: ["esm", "cjs"],
20
20
  platform: "neutral",
21
21
  external: [/^node:/],
22
- outputOptions(outputOptions, format) {
23
- if (format === "cjs") {
24
- outputOptions.intro = `
25
- const { Temporal } = require("@js-temporal/polyfill");
26
- `;
27
- } else {
28
- outputOptions.intro = `
29
- import { Temporal } from "@js-temporal/polyfill";
30
- `;
31
- }
32
- return outputOptions;
22
+ banner({ format }) {
23
+ const js = format === "cjs"
24
+ ? `const { Temporal } = require("@js-temporal/polyfill");`
25
+ : `import { Temporal } from "@js-temporal/polyfill";`;
26
+ return {
27
+ js,
28
+ dts: `/// <reference lib="esnext.temporal" />`,
29
+ };
33
30
  },
34
31
  }),
35
32
  defineConfig({