@fedify/vocab 2.4.0-dev.1581 → 2.4.0-dev.1599

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.
package/dist/mod.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Temporal } from "@js-temporal/polyfill";
1
+ import { Temporal } from "temporal-polyfill";
2
2
  import { lookupWebFinger } from "@fedify/webfinger";
3
3
  import { SpanStatusCode, trace } from "@opentelemetry/api";
4
4
  import { domainToASCII, domainToUnicode } from "node:url";
@@ -10,7 +10,7 @@ import { isTemporalDuration, isTemporalInstant } from "@fedify/vocab-runtime/tem
10
10
  import { delay } from "es-toolkit";
11
11
  //#region deno.json
12
12
  var name = "@fedify/vocab";
13
- var version = "2.4.0-dev.1581+2c99806d";
13
+ var version = "2.4.0-dev.1599+7b19967f";
14
14
  //#endregion
15
15
  //#region src/type.ts
16
16
  function getTypeId(object) {
@@ -1,7 +1,7 @@
1
- import "@js-temporal/polyfill";
1
+ import "temporal-polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { A as Person, G as __toESM, L as Service, U as __commonJSMin, a as Application, k as Organization, v as Group } from "./vocab-DOHLQ4UQ.mjs";
4
- import { t as getTypeId } from "./type-Cf-vxmre.mjs";
3
+ import { A as Person, G as __toESM, L as Service, U as __commonJSMin, a as Application, k as Organization, v as Group } from "./vocab-BQ8y6QS7.mjs";
4
+ import { t as getTypeId } from "./type-_BlsfT3S.mjs";
5
5
  import { lookupWebFinger } from "@fedify/webfinger";
6
6
  import { SpanStatusCode, trace } from "@opentelemetry/api";
7
7
  import { domainToASCII, domainToUnicode } from "node:url";
@@ -1206,7 +1206,7 @@ var esm_default = new class FetchMock {
1206
1206
  //#endregion
1207
1207
  //#region deno.json
1208
1208
  var name = "@fedify/vocab";
1209
- var version = "2.4.0-dev.1581+2c99806d";
1209
+ var version = "2.4.0-dev.1599+7b19967f";
1210
1210
  //#endregion
1211
1211
  //#region src/actor.ts
1212
1212
  const ACTOR_DISCOVERY_HISTOGRAM_BUCKETS = [
@@ -1,7 +1,7 @@
1
- import "@js-temporal/polyfill";
1
+ import "temporal-polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { A as Person, L as Service, W as __exportAll, a as Application, k as Organization, v as Group } from "./vocab-DOHLQ4UQ.mjs";
4
- import { a as normalizeActorHandle, c as esm_default, i as isActor, n as getActorHandle, r as getActorTypeName, t as getActorClassByTypeName } from "./actor-Cxls_bxz.mjs";
3
+ import { A as Person, L as Service, W as __exportAll, a as Application, k as Organization, v as Group } from "./vocab-BQ8y6QS7.mjs";
4
+ import { a as normalizeActorHandle, c as esm_default, i as isActor, n as getActorHandle, r as getActorTypeName, t as getActorClassByTypeName } from "./actor-NhcklZK0.mjs";
5
5
  import { createTestMeterProvider, test } from "@fedify/fixture";
6
6
  import { deepStrictEqual, ok, rejects, strictEqual, throws } from "node:assert/strict";
7
7
  //#region ../../node_modules/.pnpm/fast-check@3.23.2/node_modules/fast-check/lib/esm/check/precondition/PreconditionFailure.js
@@ -0,0 +1,28 @@
1
+ import "temporal-polyfill";
2
+ globalThis.addEventListener = () => {};
3
+ import { createRequire } from "node:module";
4
+ import { mockDocumentLoader, test } from "@fedify/fixture";
5
+ import { ok, strictEqual, throws } from "node:assert";
6
+ //#region src/cjs.test.ts
7
+ test("CommonJS entry bundles temporal-polyfill internally", { ignore: "Deno" in globalThis }, async () => {
8
+ const originalTemporal = globalThis.Temporal;
9
+ const require = createRequire(import.meta.url);
10
+ throws(() => require("temporal-polyfill"), (error) => {
11
+ if (error == null || typeof error !== "object") return false;
12
+ const { code } = error;
13
+ return code === "ERR_PACKAGE_PATH_NOT_EXPORTED" || code === "MODULE_NOT_FOUND";
14
+ });
15
+ const obj = await require("../dist/mod.cjs").Object.fromJsonLd({
16
+ "@context": "https://www.w3.org/ns/activitystreams",
17
+ type: "Object",
18
+ published: "2025-01-01T12:34:56Z"
19
+ }, {
20
+ documentLoader: mockDocumentLoader,
21
+ contextLoader: mockDocumentLoader
22
+ });
23
+ ok(obj.published != null);
24
+ strictEqual(obj.published.toString(), "2025-01-01T12:34:56Z");
25
+ strictEqual(globalThis.Temporal, originalTemporal);
26
+ });
27
+ //#endregion
28
+ export {};
@@ -1,9 +1,9 @@
1
- import { Temporal } from "@js-temporal/polyfill";
1
+ import { Temporal } from "temporal-polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { A as Person, E as Object$1, T as Note, o as Collection } from "./vocab-DOHLQ4UQ.mjs";
4
- import { c as esm_default, i as isActor, o as name, s as version } from "./actor-Cxls_bxz.mjs";
5
- import { t as getTypeId } from "./type-Cf-vxmre.mjs";
6
- import { t as assertInstanceOf } from "./utils-CE8Dk5hm.mjs";
3
+ import { A as Person, E as Object$1, T as Note, o as Collection } from "./vocab-BQ8y6QS7.mjs";
4
+ import { c as esm_default, i as isActor, o as name, s as version } from "./actor-NhcklZK0.mjs";
5
+ import { t as getTypeId } from "./type-_BlsfT3S.mjs";
6
+ import { t as assertInstanceOf } from "./utils-CQjrpUkt.mjs";
7
7
  import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
8
8
  import { deepStrictEqual, equal, ok, rejects } from "node:assert/strict";
9
9
  import { lookupWebFinger } from "@fedify/webfinger";
@@ -1,4 +1,4 @@
1
- import "@js-temporal/polyfill";
1
+ import "temporal-polyfill";
2
2
  globalThis.addEventListener = () => {};
3
3
  //#region src/type.ts
4
4
  function getTypeId(object) {
@@ -1,7 +1,7 @@
1
- import "@js-temporal/polyfill";
1
+ import "temporal-polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { A as Person, B as getEntityTypeById, C as Link, V as isEntityType } from "./vocab-DOHLQ4UQ.mjs";
4
- import { t as getTypeId } from "./type-Cf-vxmre.mjs";
3
+ import { A as Person, B as getEntityTypeById, C as Link, V as isEntityType } from "./vocab-BQ8y6QS7.mjs";
4
+ import { t as getTypeId } from "./type-_BlsfT3S.mjs";
5
5
  import { test } from "@fedify/fixture";
6
6
  import { deepStrictEqual } from "node:assert/strict";
7
7
  //#region src/type.test.ts
@@ -1,4 +1,4 @@
1
- import "@js-temporal/polyfill";
1
+ import "temporal-polyfill";
2
2
  globalThis.addEventListener = () => {};
3
3
  import { ok } from "node:assert";
4
4
  //#region src/utils.ts
@@ -1,5 +1,6 @@
1
- import { Temporal } from "@js-temporal/polyfill";
1
+ import { Temporal } from "temporal-polyfill";
2
2
  globalThis.addEventListener = () => {};
3
+ import "node:module";
3
4
  import { SpanStatusCode, trace } from "@opentelemetry/api";
4
5
  import jsonld from "@fedify/vocab-runtime/jsonld";
5
6
  import { getLogger } from "@logtape/logtape";
@@ -1,7 +1,7 @@
1
- import { Temporal } from "@js-temporal/polyfill";
1
+ import { Temporal } from "temporal-polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { A as Person, C as Link, D as Offer, E as Object$1, F as QuoteRequest, H as vocab_exports, I as Reject, M as Proposal, N as Question, O as OrderedCollectionPage, P as QuoteAuthorization, R as Source, S as InteractionRule, T as Note, _ as Follow, b as Intent, c as Create, d as Document, f as Endpoints, g as FeaturedItem, h as FeaturedCollection, i as Announce, j as Place, l as CryptographicKey, m as FeatureRequest, n as Activity, o as Collection, p as FeatureAuthorization, r as Agreement, s as Commitment, t as Accept, u as Delete, w as Measure, x as InteractionPolicy, y as Hashtag, z as Tombstone } from "./vocab-DOHLQ4UQ.mjs";
4
- import { t as assertInstanceOf } from "./utils-CE8Dk5hm.mjs";
3
+ import { A as Person, C as Link, D as Offer, E as Object$1, F as QuoteRequest, H as vocab_exports, I as Reject, M as Proposal, N as Question, O as OrderedCollectionPage, P as QuoteAuthorization, R as Source, S as InteractionRule, T as Note, _ as Follow, b as Intent, c as Create, d as Document, f as Endpoints, g as FeaturedItem, h as FeaturedCollection, i as Announce, j as Place, l as CryptographicKey, m as FeatureRequest, n as Activity, o as Collection, p as FeatureAuthorization, r as Agreement, s as Commitment, t as Accept, u as Delete, w as Measure, x as InteractionPolicy, y as Hashtag, z as Tombstone } from "./vocab-BQ8y6QS7.mjs";
4
+ import { t as assertInstanceOf } from "./utils-CQjrpUkt.mjs";
5
5
  import { mockDocumentLoader, test } from "@fedify/fixture";
6
6
  import { deepStrictEqual, notDeepStrictEqual, ok, rejects, throws } from "node:assert/strict";
7
7
  import { configure, reset } from "@logtape/logtape";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/vocab",
3
- "version": "2.4.0-dev.1581+2c99806d",
3
+ "version": "2.4.0-dev.1599+7b19967f",
4
4
  "homepage": "https://fedify.dev/",
5
5
  "repository": {
6
6
  "type": "git",
@@ -35,7 +35,6 @@
35
35
  "./package.json": "./package.json"
36
36
  },
37
37
  "dependencies": {
38
- "@js-temporal/polyfill": "^0.5.1",
39
38
  "@multiformats/base-x": "^4.0.1",
40
39
  "@logtape/logtape": "^2.2.0",
41
40
  "@opentelemetry/api": "^1.9.1",
@@ -43,9 +42,10 @@
43
42
  "es-toolkit": "1.46.1",
44
43
  "jsonld": "^9.0.0",
45
44
  "pkijs": "^3.3.3",
46
- "@fedify/vocab-tools": "2.4.0-dev.1581+2c99806d",
47
- "@fedify/webfinger": "2.4.0-dev.1581+2c99806d",
48
- "@fedify/vocab-runtime": "2.4.0-dev.1581+2c99806d"
45
+ "temporal-polyfill": "^1.0.1",
46
+ "@fedify/vocab-tools": "2.4.0-dev.1599+7b19967f",
47
+ "@fedify/vocab-runtime": "2.4.0-dev.1599+7b19967f",
48
+ "@fedify/webfinger": "2.4.0-dev.1599+7b19967f"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/node": "^22.17.0",
@@ -0,0 +1,31 @@
1
+ import { ok, strictEqual, throws } from "node:assert";
2
+ import { createRequire } from "node:module";
3
+ import { mockDocumentLoader, test } from "@fedify/fixture";
4
+
5
+ test("CommonJS entry bundles temporal-polyfill internally", {
6
+ ignore: "Deno" in globalThis,
7
+ }, async () => {
8
+ const originalTemporal = globalThis.Temporal;
9
+
10
+ const require = createRequire(import.meta.url);
11
+ throws(
12
+ () => require("temporal-polyfill"),
13
+ (error: unknown) => {
14
+ if (error == null || typeof error !== "object") return false;
15
+ const { code } = error as { code?: unknown };
16
+ return code === "ERR_PACKAGE_PATH_NOT_EXPORTED" ||
17
+ code === "MODULE_NOT_FOUND";
18
+ },
19
+ );
20
+
21
+ const vocab = require("../dist/mod.cjs");
22
+ const obj = await vocab.Object.fromJsonLd({
23
+ "@context": "https://www.w3.org/ns/activitystreams",
24
+ type: "Object",
25
+ published: "2025-01-01T12:34:56Z",
26
+ }, { documentLoader: mockDocumentLoader, contextLoader: mockDocumentLoader });
27
+
28
+ ok(obj.published != null);
29
+ strictEqual(obj.published.toString(), "2025-01-01T12:34:56Z");
30
+ strictEqual(globalThis.Temporal, originalTemporal);
31
+ });
package/tsdown.config.ts CHANGED
@@ -1,6 +1,13 @@
1
1
  import { glob, mkdir, readFile, writeFile } from "node:fs/promises";
2
2
  import { dirname, join, sep } from "node:path";
3
3
  import { defineConfig } from "tsdown";
4
+ import {
5
+ temporalPolyfillCjsBanner,
6
+ temporalPolyfillCjsDeps,
7
+ temporalPolyfillEsmBanner,
8
+ temporalPolyfillImportPlugin,
9
+ temporalPolyfillIntro,
10
+ } from "../../scripts/tsdown/temporal.mts";
4
11
 
5
12
  async function copyFileSafely(
6
13
  source: string,
@@ -16,17 +23,21 @@ export default [
16
23
  "./src/mod.ts",
17
24
  ],
18
25
  dts: { compilerOptions: { isolatedDeclarations: true, declaration: true } },
19
- format: ["esm", "cjs"],
26
+ format: {
27
+ esm: {
28
+ banner: temporalPolyfillEsmBanner(),
29
+ },
30
+ cjs: {
31
+ deps: temporalPolyfillCjsDeps({
32
+ neverBundle: [/^node:/],
33
+ }),
34
+ plugins: [temporalPolyfillImportPlugin],
35
+ banner: temporalPolyfillCjsBanner(),
36
+ },
37
+ },
20
38
  platform: "neutral",
21
- deps: { neverBundle: [/^node:/] },
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
- };
39
+ deps: {
40
+ neverBundle: [/^node:/],
30
41
  },
31
42
  }),
32
43
  defineConfig({
@@ -49,8 +60,7 @@ export default [
49
60
  },
50
61
  },
51
62
  outputOptions: {
52
- intro: `
53
- import { Temporal } from "@js-temporal/polyfill";
63
+ intro: `${temporalPolyfillIntro}
54
64
  globalThis.addEventListener = () => {};
55
65
  `,
56
66
  },