@fedify/vocab-tools 2.1.0-dev.405 → 2.1.0-dev.406
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 +25 -8
- package/dist/mod.d.cts +100 -100
- package/dist/mod.d.ts +100 -100
- package/dist/mod.js +25 -8
- package/package.json +1 -1
- package/src/__snapshots__/class.test.ts.deno.snap +858 -594
- package/src/__snapshots__/class.test.ts.node.snap +858 -594
- package/src/__snapshots__/class.test.ts.snap +858 -594
- package/src/class.ts +4 -1
- package/src/generate.ts +1 -1
- package/src/inspector.ts +26 -6
- package/tsdown.config.ts +1 -1
package/dist/mod.js
CHANGED
|
@@ -8,7 +8,7 @@ import { pascalCase } from "es-toolkit";
|
|
|
8
8
|
|
|
9
9
|
//#region deno.json
|
|
10
10
|
var name = "@fedify/vocab-tools";
|
|
11
|
-
var version = "2.1.0-dev.
|
|
11
|
+
var version = "2.1.0-dev.406+61a21e4e";
|
|
12
12
|
var license = "MIT";
|
|
13
13
|
var exports = { ".": "./src/mod.ts" };
|
|
14
14
|
var author = {
|
|
@@ -1390,25 +1390,41 @@ async function* generateInspector(typeUri, types) {
|
|
|
1390
1390
|
yield `
|
|
1391
1391
|
return proxy;
|
|
1392
1392
|
}
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1393
|
+
`;
|
|
1394
|
+
}
|
|
1395
|
+
/**
|
|
1396
|
+
* Generates code that must appear *after* the class closing brace: prototype
|
|
1397
|
+
* assignments for the Deno and Node.js custom-inspect hooks.
|
|
1398
|
+
*
|
|
1399
|
+
* These are emitted outside the class body because computed property names
|
|
1400
|
+
* using `Symbol.for()` are incompatible with `isolatedDeclarations` mode.
|
|
1401
|
+
*/
|
|
1402
|
+
async function* generateInspectorPostClass(typeUri, types) {
|
|
1403
|
+
const type = types[typeUri];
|
|
1404
|
+
const className = type.name;
|
|
1405
|
+
yield `
|
|
1406
|
+
// deno-lint-ignore no-explicit-any
|
|
1407
|
+
(${className}.prototype as any)[Symbol.for("Deno.customInspect")] =
|
|
1408
|
+
function (
|
|
1409
|
+
this: ${className},
|
|
1396
1410
|
inspect: typeof Deno.inspect,
|
|
1397
1411
|
options: Deno.InspectOptions,
|
|
1398
1412
|
): string {
|
|
1399
1413
|
const proxy = this._getCustomInspectProxy();
|
|
1400
1414
|
return ${JSON.stringify(type.name + " ")} + inspect(proxy, options);
|
|
1401
|
-
}
|
|
1415
|
+
};
|
|
1402
1416
|
|
|
1403
|
-
|
|
1404
|
-
|
|
1417
|
+
// deno-lint-ignore no-explicit-any
|
|
1418
|
+
(${className}.prototype as any)[Symbol.for("nodejs.util.inspect.custom")] =
|
|
1419
|
+
function (
|
|
1420
|
+
this: ${className},
|
|
1405
1421
|
_depth: number,
|
|
1406
1422
|
options: unknown,
|
|
1407
1423
|
inspect: (value: unknown, options: unknown) => string,
|
|
1408
1424
|
): string {
|
|
1409
1425
|
const proxy = this._getCustomInspectProxy();
|
|
1410
1426
|
return ${JSON.stringify(type.name + " ")} + inspect(proxy, options);
|
|
1411
|
-
}
|
|
1427
|
+
};
|
|
1412
1428
|
`;
|
|
1413
1429
|
}
|
|
1414
1430
|
|
|
@@ -1867,6 +1883,7 @@ async function* generateClass(typeUri, types) {
|
|
|
1867
1883
|
for await (const code of generateDecoder(typeUri, types)) yield code;
|
|
1868
1884
|
for await (const code of generateInspector(typeUri, types)) yield code;
|
|
1869
1885
|
yield "}\n\n";
|
|
1886
|
+
for await (const code of generateInspectorPostClass(typeUri, types)) yield code;
|
|
1870
1887
|
}
|
|
1871
1888
|
/**
|
|
1872
1889
|
* Generates the TypeScript classes from the given types.
|