@fedify/vocab-runtime 2.3.0-dev.1069 → 2.3.0-dev.1099
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/deno.json +4 -3
- package/dist/{chunk-CKQMccvm.cjs → chunk-M78iaK0I.cjs} +1 -0
- package/dist/jsonld.cjs +3 -2
- package/dist/jsonld.d.cts +1 -0
- package/dist/jsonld.d.ts +1 -0
- package/dist/jsonld.js +1 -0
- package/dist/mod.cjs +4325 -4359
- package/dist/mod.d.cts +1 -0
- package/dist/mod.d.ts +1 -0
- package/dist/mod.js +4322 -4356
- package/dist/temporal.cjs +60 -0
- package/dist/temporal.d.cts +54 -0
- package/dist/temporal.d.ts +54 -0
- package/dist/temporal.js +58 -0
- package/dist/tests/{chunk-Do9eywBl.cjs → chunk-C2EiDwsr.cjs} +1 -1
- package/dist/tests/decimal.test.cjs +4 -4
- package/dist/tests/decimal.test.mjs +3 -3
- package/dist/tests/docloader-CjraMMLV.cjs +4543 -0
- package/dist/tests/docloader-svYZTdwU.mjs +4531 -0
- package/dist/tests/docloader.test.cjs +4 -4
- package/dist/tests/docloader.test.mjs +3 -3
- package/dist/tests/internal/multicodec.test.cjs +1 -1
- package/dist/tests/{key-BeTHFQJK.mjs → key-CrrK9mYh.mjs} +1 -1
- package/dist/tests/{key-DTTIntwb.cjs → key-pMmqUKuo.cjs} +2 -2
- package/dist/tests/key.test.cjs +3 -3
- package/dist/tests/key.test.mjs +2 -2
- package/dist/tests/langstr.test.cjs +2 -2
- package/dist/tests/link.test.cjs +1 -1
- package/dist/tests/multibase/multibase.test.cjs +2 -2
- package/dist/tests/multibase/multibase.test.mjs +1 -1
- package/dist/tests/{multibase-BgU9XRf7.mjs → multibase-B4bvakyA.mjs} +3 -0
- package/dist/tests/{multibase-F7LtMMsK.cjs → multibase-Bz_UUDtL.cjs} +5 -2
- package/dist/tests/{request-CARANH2d.mjs → request-Bpm2JArn.mjs} +1 -1
- package/dist/tests/{request-D3V3yzXZ.cjs → request-DzaqEN3w.cjs} +3 -3
- package/dist/tests/request.test.cjs +3 -3
- package/dist/tests/request.test.mjs +1 -1
- package/dist/tests/temporal.test.cjs +134 -0
- package/dist/tests/temporal.test.d.cts +1 -0
- package/dist/tests/temporal.test.d.mts +1 -0
- package/dist/tests/temporal.test.mjs +134 -0
- package/dist/tests/{url-Cj9-Ycue.cjs → url-CEmGms8t.cjs} +1 -1
- package/dist/tests/url.test.cjs +2 -2
- package/package.json +17 -6
- package/src/temporal.test.ts +121 -0
- package/src/temporal.ts +74 -0
- package/tsdown.config.ts +6 -3
- package/dist/tests/docloader-CJ2-f1JD.cjs +0 -4581
- package/dist/tests/docloader-CYy6F-CT.mjs +0 -4569
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
//#region src/temporal.ts
|
|
4
|
+
/**
|
|
5
|
+
* Type guards for `Temporal` namespace objects.
|
|
6
|
+
*
|
|
7
|
+
* Fedify accepts both runtime polyfills (e.g. `@js-temporal/polyfill`,
|
|
8
|
+
* `temporal-polyfill`) and the host's native `Temporal` implementation
|
|
9
|
+
* (Node.js 26+, Bun, Deno). The guards below rely on `Symbol.toStringTag`,
|
|
10
|
+
* which is mandated by the Temporal specification, so they accept any
|
|
11
|
+
* spec-conformant implementation regardless of which class produced the
|
|
12
|
+
* value.
|
|
13
|
+
*
|
|
14
|
+
* @module
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Checks whether the given value is a `Temporal.Instant` object, regardless
|
|
18
|
+
* of whether it came from a polyfill or the host's native implementation.
|
|
19
|
+
*
|
|
20
|
+
* The guard verifies the spec-mandated `Symbol.toStringTag`, that the
|
|
21
|
+
* `epochNanoseconds` accessor exposes a `bigint`, and that `toString` is
|
|
22
|
+
* not the default inherited from `Object.prototype`. Together they reject
|
|
23
|
+
* bare objects whose tag was set to `"Temporal.Instant"` without exposing
|
|
24
|
+
* the rest of the shape; the `toString` check in particular prevents a
|
|
25
|
+
* spoof from reaching the JSON-LD serializer (which calls `toString()`)
|
|
26
|
+
* and emitting `"[object Temporal.Instant]"` instead of an RFC 3339
|
|
27
|
+
* timestamp.
|
|
28
|
+
*
|
|
29
|
+
* @param value The value to test.
|
|
30
|
+
* @returns `true` if the value reports `Temporal.Instant` via
|
|
31
|
+
* `Symbol.toStringTag`, exposes a `bigint`-valued
|
|
32
|
+
* `epochNanoseconds`, and overrides `toString`; `false` otherwise.
|
|
33
|
+
*/
|
|
34
|
+
function isTemporalInstant(value) {
|
|
35
|
+
return typeof value === "object" && value !== null && Object.prototype.toString.call(value) === "[object Temporal.Instant]" && "epochNanoseconds" in value && typeof value.epochNanoseconds === "bigint" && "toString" in value && typeof value.toString === "function" && value.toString !== Object.prototype.toString;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Checks whether the given value is a `Temporal.Duration` object, regardless
|
|
39
|
+
* of whether it came from a polyfill or the host's native implementation.
|
|
40
|
+
*
|
|
41
|
+
* The guard verifies the spec-mandated `Symbol.toStringTag`, that the
|
|
42
|
+
* `sign` accessor returns one of the three spec-valid values (`-1`, `0`,
|
|
43
|
+
* or `1`), and that `toString` is not the default inherited from
|
|
44
|
+
* `Object.prototype`. Together they reject bare objects whose tag was set
|
|
45
|
+
* to `"Temporal.Duration"` without exposing the rest of the shape; the
|
|
46
|
+
* `toString` check in particular prevents a spoof from reaching the
|
|
47
|
+
* JSON-LD serializer (which calls `toString()`) and emitting
|
|
48
|
+
* `"[object Temporal.Duration]"` instead of an ISO 8601 duration.
|
|
49
|
+
*
|
|
50
|
+
* @param value The value to test.
|
|
51
|
+
* @returns `true` if the value reports `Temporal.Duration` via
|
|
52
|
+
* `Symbol.toStringTag`, exposes a `sign` of `-1`, `0`, or `1`,
|
|
53
|
+
* and overrides `toString`; `false` otherwise.
|
|
54
|
+
*/
|
|
55
|
+
function isTemporalDuration(value) {
|
|
56
|
+
return typeof value === "object" && value !== null && Object.prototype.toString.call(value) === "[object Temporal.Duration]" && "sign" in value && (value.sign === -1 || value.sign === 0 || value.sign === 1) && "toString" in value && typeof value.toString === "function" && value.toString !== Object.prototype.toString;
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
exports.isTemporalDuration = isTemporalDuration;
|
|
60
|
+
exports.isTemporalInstant = isTemporalInstant;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/// <reference lib="esnext.temporal" />
|
|
2
|
+
//#region src/temporal.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Type guards for `Temporal` namespace objects.
|
|
5
|
+
*
|
|
6
|
+
* Fedify accepts both runtime polyfills (e.g. `@js-temporal/polyfill`,
|
|
7
|
+
* `temporal-polyfill`) and the host's native `Temporal` implementation
|
|
8
|
+
* (Node.js 26+, Bun, Deno). The guards below rely on `Symbol.toStringTag`,
|
|
9
|
+
* which is mandated by the Temporal specification, so they accept any
|
|
10
|
+
* spec-conformant implementation regardless of which class produced the
|
|
11
|
+
* value.
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Checks whether the given value is a `Temporal.Instant` object, regardless
|
|
17
|
+
* of whether it came from a polyfill or the host's native implementation.
|
|
18
|
+
*
|
|
19
|
+
* The guard verifies the spec-mandated `Symbol.toStringTag`, that the
|
|
20
|
+
* `epochNanoseconds` accessor exposes a `bigint`, and that `toString` is
|
|
21
|
+
* not the default inherited from `Object.prototype`. Together they reject
|
|
22
|
+
* bare objects whose tag was set to `"Temporal.Instant"` without exposing
|
|
23
|
+
* the rest of the shape; the `toString` check in particular prevents a
|
|
24
|
+
* spoof from reaching the JSON-LD serializer (which calls `toString()`)
|
|
25
|
+
* and emitting `"[object Temporal.Instant]"` instead of an RFC 3339
|
|
26
|
+
* timestamp.
|
|
27
|
+
*
|
|
28
|
+
* @param value The value to test.
|
|
29
|
+
* @returns `true` if the value reports `Temporal.Instant` via
|
|
30
|
+
* `Symbol.toStringTag`, exposes a `bigint`-valued
|
|
31
|
+
* `epochNanoseconds`, and overrides `toString`; `false` otherwise.
|
|
32
|
+
*/
|
|
33
|
+
declare function isTemporalInstant(value: unknown): value is Temporal.Instant;
|
|
34
|
+
/**
|
|
35
|
+
* Checks whether the given value is a `Temporal.Duration` object, regardless
|
|
36
|
+
* of whether it came from a polyfill or the host's native implementation.
|
|
37
|
+
*
|
|
38
|
+
* The guard verifies the spec-mandated `Symbol.toStringTag`, that the
|
|
39
|
+
* `sign` accessor returns one of the three spec-valid values (`-1`, `0`,
|
|
40
|
+
* or `1`), and that `toString` is not the default inherited from
|
|
41
|
+
* `Object.prototype`. Together they reject bare objects whose tag was set
|
|
42
|
+
* to `"Temporal.Duration"` without exposing the rest of the shape; the
|
|
43
|
+
* `toString` check in particular prevents a spoof from reaching the
|
|
44
|
+
* JSON-LD serializer (which calls `toString()`) and emitting
|
|
45
|
+
* `"[object Temporal.Duration]"` instead of an ISO 8601 duration.
|
|
46
|
+
*
|
|
47
|
+
* @param value The value to test.
|
|
48
|
+
* @returns `true` if the value reports `Temporal.Duration` via
|
|
49
|
+
* `Symbol.toStringTag`, exposes a `sign` of `-1`, `0`, or `1`,
|
|
50
|
+
* and overrides `toString`; `false` otherwise.
|
|
51
|
+
*/
|
|
52
|
+
declare function isTemporalDuration(value: unknown): value is Temporal.Duration;
|
|
53
|
+
//#endregion
|
|
54
|
+
export { isTemporalDuration, isTemporalInstant };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/// <reference lib="esnext.temporal" />
|
|
2
|
+
//#region src/temporal.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Type guards for `Temporal` namespace objects.
|
|
5
|
+
*
|
|
6
|
+
* Fedify accepts both runtime polyfills (e.g. `@js-temporal/polyfill`,
|
|
7
|
+
* `temporal-polyfill`) and the host's native `Temporal` implementation
|
|
8
|
+
* (Node.js 26+, Bun, Deno). The guards below rely on `Symbol.toStringTag`,
|
|
9
|
+
* which is mandated by the Temporal specification, so they accept any
|
|
10
|
+
* spec-conformant implementation regardless of which class produced the
|
|
11
|
+
* value.
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Checks whether the given value is a `Temporal.Instant` object, regardless
|
|
17
|
+
* of whether it came from a polyfill or the host's native implementation.
|
|
18
|
+
*
|
|
19
|
+
* The guard verifies the spec-mandated `Symbol.toStringTag`, that the
|
|
20
|
+
* `epochNanoseconds` accessor exposes a `bigint`, and that `toString` is
|
|
21
|
+
* not the default inherited from `Object.prototype`. Together they reject
|
|
22
|
+
* bare objects whose tag was set to `"Temporal.Instant"` without exposing
|
|
23
|
+
* the rest of the shape; the `toString` check in particular prevents a
|
|
24
|
+
* spoof from reaching the JSON-LD serializer (which calls `toString()`)
|
|
25
|
+
* and emitting `"[object Temporal.Instant]"` instead of an RFC 3339
|
|
26
|
+
* timestamp.
|
|
27
|
+
*
|
|
28
|
+
* @param value The value to test.
|
|
29
|
+
* @returns `true` if the value reports `Temporal.Instant` via
|
|
30
|
+
* `Symbol.toStringTag`, exposes a `bigint`-valued
|
|
31
|
+
* `epochNanoseconds`, and overrides `toString`; `false` otherwise.
|
|
32
|
+
*/
|
|
33
|
+
declare function isTemporalInstant(value: unknown): value is Temporal.Instant;
|
|
34
|
+
/**
|
|
35
|
+
* Checks whether the given value is a `Temporal.Duration` object, regardless
|
|
36
|
+
* of whether it came from a polyfill or the host's native implementation.
|
|
37
|
+
*
|
|
38
|
+
* The guard verifies the spec-mandated `Symbol.toStringTag`, that the
|
|
39
|
+
* `sign` accessor returns one of the three spec-valid values (`-1`, `0`,
|
|
40
|
+
* or `1`), and that `toString` is not the default inherited from
|
|
41
|
+
* `Object.prototype`. Together they reject bare objects whose tag was set
|
|
42
|
+
* to `"Temporal.Duration"` without exposing the rest of the shape; the
|
|
43
|
+
* `toString` check in particular prevents a spoof from reaching the
|
|
44
|
+
* JSON-LD serializer (which calls `toString()`) and emitting
|
|
45
|
+
* `"[object Temporal.Duration]"` instead of an ISO 8601 duration.
|
|
46
|
+
*
|
|
47
|
+
* @param value The value to test.
|
|
48
|
+
* @returns `true` if the value reports `Temporal.Duration` via
|
|
49
|
+
* `Symbol.toStringTag`, exposes a `sign` of `-1`, `0`, or `1`,
|
|
50
|
+
* and overrides `toString`; `false` otherwise.
|
|
51
|
+
*/
|
|
52
|
+
declare function isTemporalDuration(value: unknown): value is Temporal.Duration;
|
|
53
|
+
//#endregion
|
|
54
|
+
export { isTemporalDuration, isTemporalInstant };
|
package/dist/temporal.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/temporal.ts
|
|
3
|
+
/**
|
|
4
|
+
* Type guards for `Temporal` namespace objects.
|
|
5
|
+
*
|
|
6
|
+
* Fedify accepts both runtime polyfills (e.g. `@js-temporal/polyfill`,
|
|
7
|
+
* `temporal-polyfill`) and the host's native `Temporal` implementation
|
|
8
|
+
* (Node.js 26+, Bun, Deno). The guards below rely on `Symbol.toStringTag`,
|
|
9
|
+
* which is mandated by the Temporal specification, so they accept any
|
|
10
|
+
* spec-conformant implementation regardless of which class produced the
|
|
11
|
+
* value.
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Checks whether the given value is a `Temporal.Instant` object, regardless
|
|
17
|
+
* of whether it came from a polyfill or the host's native implementation.
|
|
18
|
+
*
|
|
19
|
+
* The guard verifies the spec-mandated `Symbol.toStringTag`, that the
|
|
20
|
+
* `epochNanoseconds` accessor exposes a `bigint`, and that `toString` is
|
|
21
|
+
* not the default inherited from `Object.prototype`. Together they reject
|
|
22
|
+
* bare objects whose tag was set to `"Temporal.Instant"` without exposing
|
|
23
|
+
* the rest of the shape; the `toString` check in particular prevents a
|
|
24
|
+
* spoof from reaching the JSON-LD serializer (which calls `toString()`)
|
|
25
|
+
* and emitting `"[object Temporal.Instant]"` instead of an RFC 3339
|
|
26
|
+
* timestamp.
|
|
27
|
+
*
|
|
28
|
+
* @param value The value to test.
|
|
29
|
+
* @returns `true` if the value reports `Temporal.Instant` via
|
|
30
|
+
* `Symbol.toStringTag`, exposes a `bigint`-valued
|
|
31
|
+
* `epochNanoseconds`, and overrides `toString`; `false` otherwise.
|
|
32
|
+
*/
|
|
33
|
+
function isTemporalInstant(value) {
|
|
34
|
+
return typeof value === "object" && value !== null && Object.prototype.toString.call(value) === "[object Temporal.Instant]" && "epochNanoseconds" in value && typeof value.epochNanoseconds === "bigint" && "toString" in value && typeof value.toString === "function" && value.toString !== Object.prototype.toString;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Checks whether the given value is a `Temporal.Duration` object, regardless
|
|
38
|
+
* of whether it came from a polyfill or the host's native implementation.
|
|
39
|
+
*
|
|
40
|
+
* The guard verifies the spec-mandated `Symbol.toStringTag`, that the
|
|
41
|
+
* `sign` accessor returns one of the three spec-valid values (`-1`, `0`,
|
|
42
|
+
* or `1`), and that `toString` is not the default inherited from
|
|
43
|
+
* `Object.prototype`. Together they reject bare objects whose tag was set
|
|
44
|
+
* to `"Temporal.Duration"` without exposing the rest of the shape; the
|
|
45
|
+
* `toString` check in particular prevents a spoof from reaching the
|
|
46
|
+
* JSON-LD serializer (which calls `toString()`) and emitting
|
|
47
|
+
* `"[object Temporal.Duration]"` instead of an ISO 8601 duration.
|
|
48
|
+
*
|
|
49
|
+
* @param value The value to test.
|
|
50
|
+
* @returns `true` if the value reports `Temporal.Duration` via
|
|
51
|
+
* `Symbol.toStringTag`, exposes a `sign` of `-1`, `0`, or `1`,
|
|
52
|
+
* and overrides `toString`; `false` otherwise.
|
|
53
|
+
*/
|
|
54
|
+
function isTemporalDuration(value) {
|
|
55
|
+
return typeof value === "object" && value !== null && Object.prototype.toString.call(value) === "[object Temporal.Duration]" && "sign" in value && (value.sign === -1 || value.sign === 0 || value.sign === 1) && "toString" in value && typeof value.toString === "function" && value.toString !== Object.prototype.toString;
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
export { isTemporalDuration, isTemporalInstant };
|
|
@@ -5,7 +5,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
8
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
9
9
|
var __copyProps = (to, from, except, desc) => {
|
|
10
10
|
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
11
|
key = keys[i];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
require("./chunk-
|
|
2
|
-
require("./docloader-
|
|
3
|
-
require("./key-
|
|
4
|
-
require("./multibase-
|
|
1
|
+
require("./chunk-C2EiDwsr.cjs");
|
|
2
|
+
require("./docloader-CjraMMLV.cjs");
|
|
3
|
+
require("./key-pMmqUKuo.cjs");
|
|
4
|
+
require("./multibase-Bz_UUDtL.cjs");
|
|
5
5
|
require("./langstr-CbAxaeEZ.cjs");
|
|
6
6
|
let node_assert = require("node:assert");
|
|
7
7
|
let node_test = require("node:test");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./docloader-
|
|
2
|
-
import "./key-
|
|
3
|
-
import "./multibase-
|
|
1
|
+
import "./docloader-svYZTdwU.mjs";
|
|
2
|
+
import "./key-CrrK9mYh.mjs";
|
|
3
|
+
import "./multibase-B4bvakyA.mjs";
|
|
4
4
|
import "./langstr-Di5AvKpB.mjs";
|
|
5
5
|
import { deepStrictEqual, throws } from "node:assert";
|
|
6
6
|
import { test } from "node:test";
|