@fedify/vocab-tools 2.4.0-dev.2247 → 2.4.0-dev.2253
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 +1 -1
- package/dist/mod.cjs +11 -5
- package/dist/mod.js +11 -5
- package/package.json +1 -1
- package/src/__snapshots__/class.test.ts.deno.snap +608 -602
- package/src/__snapshots__/class.test.ts.node.snap +608 -602
- package/src/__snapshots__/class.test.ts.snap +608 -602
- package/src/class.ts +6 -0
- package/src/inspector.ts +4 -4
package/deno.json
CHANGED
package/dist/mod.cjs
CHANGED
|
@@ -8,7 +8,7 @@ let yaml = require("yaml");
|
|
|
8
8
|
let es_toolkit = require("es-toolkit");
|
|
9
9
|
//#region deno.json
|
|
10
10
|
var name = "@fedify/vocab-tools";
|
|
11
|
-
var version = "2.4.0-dev.
|
|
11
|
+
var version = "2.4.0-dev.2253+f5212c33";
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/type.ts
|
|
14
14
|
const HEURISTICS_CONTEXTS = [
|
|
@@ -1542,12 +1542,12 @@ async function* generateInspector(typeUri, types) {
|
|
|
1542
1542
|
[Symbol.for("Deno.customInspect")]: (
|
|
1543
1543
|
inspect: typeof Deno.inspect,
|
|
1544
1544
|
options: Deno.InspectOptions,
|
|
1545
|
-
): string => "URL " + inspect(this.id
|
|
1545
|
+
): string => "URL " + inspect(inspectIri(this.id!), options),
|
|
1546
1546
|
[Symbol.for("nodejs.util.inspect.custom")]: (
|
|
1547
1547
|
_depth: number,
|
|
1548
1548
|
options: unknown,
|
|
1549
1549
|
inspect: (value: unknown, options: unknown) => string,
|
|
1550
|
-
): string => "URL " + inspect(this.id
|
|
1550
|
+
): string => "URL " + inspect(inspectIri(this.id!), options),
|
|
1551
1551
|
};
|
|
1552
1552
|
}
|
|
1553
1553
|
`;
|
|
@@ -1563,12 +1563,12 @@ async function* generateInspector(typeUri, types) {
|
|
|
1563
1563
|
[Symbol.for("Deno.customInspect")]: (
|
|
1564
1564
|
inspect: typeof Deno.inspect,
|
|
1565
1565
|
options: Deno.InspectOptions,
|
|
1566
|
-
): string => "URL " + inspect(v
|
|
1566
|
+
): string => "URL " + inspect(inspectIri(v), options),
|
|
1567
1567
|
[Symbol.for("nodejs.util.inspect.custom")]: (
|
|
1568
1568
|
_depth: number,
|
|
1569
1569
|
options: unknown,
|
|
1570
1570
|
inspect: (value: unknown, options: unknown) => string,
|
|
1571
|
-
): string => "URL " + inspect(v
|
|
1571
|
+
): string => "URL " + inspect(inspectIri(v), options),
|
|
1572
1572
|
}
|
|
1573
1573
|
: v);
|
|
1574
1574
|
`;
|
|
@@ -2527,6 +2527,12 @@ function decodeIri(iri: string): URL {
|
|
|
2527
2527
|
? new URL("at://" + encodeURIComponent(iri.substring(5)))
|
|
2528
2528
|
: parseIri(iri);
|
|
2529
2529
|
}
|
|
2530
|
+
|
|
2531
|
+
function inspectIri(iri: URL): string {
|
|
2532
|
+
// Inspecting an object must not throw, even for a URL that cannot be
|
|
2533
|
+
// formatted as an IRI, e.g., a malformed portable ID:
|
|
2534
|
+
try { return formatIri(iri); } catch { return iri.href; }
|
|
2535
|
+
}
|
|
2530
2536
|
`;
|
|
2531
2537
|
yield `
|
|
2532
2538
|
function isValidLanguageTag(language: string): boolean {
|
package/dist/mod.js
CHANGED
|
@@ -7,7 +7,7 @@ import { parse } from "yaml";
|
|
|
7
7
|
import { pascalCase } from "es-toolkit";
|
|
8
8
|
//#region deno.json
|
|
9
9
|
var name = "@fedify/vocab-tools";
|
|
10
|
-
var version = "2.4.0-dev.
|
|
10
|
+
var version = "2.4.0-dev.2253+f5212c33";
|
|
11
11
|
//#endregion
|
|
12
12
|
//#region src/type.ts
|
|
13
13
|
const HEURISTICS_CONTEXTS = [
|
|
@@ -1541,12 +1541,12 @@ async function* generateInspector(typeUri, types) {
|
|
|
1541
1541
|
[Symbol.for("Deno.customInspect")]: (
|
|
1542
1542
|
inspect: typeof Deno.inspect,
|
|
1543
1543
|
options: Deno.InspectOptions,
|
|
1544
|
-
): string => "URL " + inspect(this.id
|
|
1544
|
+
): string => "URL " + inspect(inspectIri(this.id!), options),
|
|
1545
1545
|
[Symbol.for("nodejs.util.inspect.custom")]: (
|
|
1546
1546
|
_depth: number,
|
|
1547
1547
|
options: unknown,
|
|
1548
1548
|
inspect: (value: unknown, options: unknown) => string,
|
|
1549
|
-
): string => "URL " + inspect(this.id
|
|
1549
|
+
): string => "URL " + inspect(inspectIri(this.id!), options),
|
|
1550
1550
|
};
|
|
1551
1551
|
}
|
|
1552
1552
|
`;
|
|
@@ -1562,12 +1562,12 @@ async function* generateInspector(typeUri, types) {
|
|
|
1562
1562
|
[Symbol.for("Deno.customInspect")]: (
|
|
1563
1563
|
inspect: typeof Deno.inspect,
|
|
1564
1564
|
options: Deno.InspectOptions,
|
|
1565
|
-
): string => "URL " + inspect(v
|
|
1565
|
+
): string => "URL " + inspect(inspectIri(v), options),
|
|
1566
1566
|
[Symbol.for("nodejs.util.inspect.custom")]: (
|
|
1567
1567
|
_depth: number,
|
|
1568
1568
|
options: unknown,
|
|
1569
1569
|
inspect: (value: unknown, options: unknown) => string,
|
|
1570
|
-
): string => "URL " + inspect(v
|
|
1570
|
+
): string => "URL " + inspect(inspectIri(v), options),
|
|
1571
1571
|
}
|
|
1572
1572
|
: v);
|
|
1573
1573
|
`;
|
|
@@ -2526,6 +2526,12 @@ function decodeIri(iri: string): URL {
|
|
|
2526
2526
|
? new URL("at://" + encodeURIComponent(iri.substring(5)))
|
|
2527
2527
|
: parseIri(iri);
|
|
2528
2528
|
}
|
|
2529
|
+
|
|
2530
|
+
function inspectIri(iri: URL): string {
|
|
2531
|
+
// Inspecting an object must not throw, even for a URL that cannot be
|
|
2532
|
+
// formatted as an IRI, e.g., a malformed portable ID:
|
|
2533
|
+
try { return formatIri(iri); } catch { return iri.href; }
|
|
2534
|
+
}
|
|
2529
2535
|
`;
|
|
2530
2536
|
yield `
|
|
2531
2537
|
function isValidLanguageTag(language: string): boolean {
|