@nestia/core 14.0.3 → 14.0.4
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/native/transform.cjs +28 -7
- package/package.json +3 -3
package/native/transform.cjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const crypto = require("node:crypto");
|
|
1
2
|
const fs = require("node:fs");
|
|
2
3
|
const path = require("node:path");
|
|
3
4
|
|
|
@@ -17,12 +18,19 @@ const path = require("node:path");
|
|
|
17
18
|
// never evaluated, so the SDK contributor is never linked either.
|
|
18
19
|
function createTtscPlugin(context) {
|
|
19
20
|
const typia = assertTypiaVersion(context);
|
|
21
|
+
const proven = typia.filter((manifest) => manifest.realpath !== null);
|
|
20
22
|
const plugin = {
|
|
21
23
|
name: "@nestia/core",
|
|
22
24
|
source: path.resolve(__dirname, "cmd", "ttsc-nestia"),
|
|
23
25
|
composes: ["typia/lib/transform"],
|
|
24
26
|
// a typia upgrade must evaluate the version check again
|
|
25
|
-
hostInputs: typia,
|
|
27
|
+
hostInputs: typia.map((manifest) => manifest.file),
|
|
28
|
+
hostInputHashes: Object.fromEntries(
|
|
29
|
+
proven.map((manifest) => [manifest.file, manifest.hash]),
|
|
30
|
+
),
|
|
31
|
+
hostInputRealpaths: Object.fromEntries(
|
|
32
|
+
proven.map((manifest) => [manifest.file, manifest.realpath]),
|
|
33
|
+
),
|
|
26
34
|
};
|
|
27
35
|
const sdk = resolveSdkContributorSource(context);
|
|
28
36
|
if (sdk !== null) plugin.contributors = [{ name: "sdk", source: sdk }];
|
|
@@ -37,7 +45,7 @@ function createTtscPlugin(context) {
|
|
|
37
45
|
// versions. The version nestia is built for is the typia @nestia/core itself
|
|
38
46
|
// resolves, which its exact dependency holds at the Go pin's release.
|
|
39
47
|
//
|
|
40
|
-
// Returns the typia manifests read, for ttsc
|
|
48
|
+
// Returns the typia manifests read, with their evaluation-time proofs for ttsc.
|
|
41
49
|
function assertTypiaVersion(context) {
|
|
42
50
|
const expected = resolveTypiaManifest([__dirname]);
|
|
43
51
|
const actual =
|
|
@@ -57,19 +65,32 @@ function assertTypiaVersion(context) {
|
|
|
57
65
|
].join(" "),
|
|
58
66
|
);
|
|
59
67
|
return [
|
|
60
|
-
...new
|
|
68
|
+
...new Map(
|
|
61
69
|
[expected, actual]
|
|
62
70
|
.filter((manifest) => manifest !== null)
|
|
63
|
-
.map((manifest) => manifest.file),
|
|
64
|
-
),
|
|
71
|
+
.map((manifest) => [manifest.file, manifest]),
|
|
72
|
+
).values(),
|
|
65
73
|
];
|
|
66
74
|
}
|
|
67
75
|
|
|
68
76
|
function resolveTypiaManifest(paths) {
|
|
69
77
|
try {
|
|
70
78
|
const file = require.resolve("typia/package.json", { paths });
|
|
71
|
-
const
|
|
72
|
-
|
|
79
|
+
const contents = fs.readFileSync(file);
|
|
80
|
+
const version = JSON.parse(contents.toString("utf8")).version;
|
|
81
|
+
if (typeof version !== "string") return null;
|
|
82
|
+
let realpath = null;
|
|
83
|
+
try {
|
|
84
|
+
realpath = fs.realpathSync.native(file);
|
|
85
|
+
} catch {
|
|
86
|
+
// Keep the version guard, but leave an unprovable input unhashed.
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
file,
|
|
90
|
+
version,
|
|
91
|
+
hash: crypto.createHash("sha256").update(contents).digest("hex"),
|
|
92
|
+
realpath,
|
|
93
|
+
};
|
|
73
94
|
} catch {
|
|
74
95
|
return null;
|
|
75
96
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestia/core",
|
|
3
|
-
"version": "14.0.
|
|
3
|
+
"version": "14.0.4",
|
|
4
4
|
"description": "Super-fast validation decorators of NestJS",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"tgrid": "^1.1.0",
|
|
54
54
|
"typia": "15.0.0",
|
|
55
55
|
"ws": "^7.5.3",
|
|
56
|
-
"@nestia/fetcher": "^14.0.
|
|
56
|
+
"@nestia/fetcher": "^14.0.4"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"@modelcontextprotocol/sdk": "^1.18.0",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"rxjs": ">=7.1.0",
|
|
64
64
|
"ttsc": ">=0.19.2",
|
|
65
65
|
"typia": "15.0.0",
|
|
66
|
-
"@nestia/fetcher": "^14.0.
|
|
66
|
+
"@nestia/fetcher": "^14.0.4"
|
|
67
67
|
},
|
|
68
68
|
"peerDependenciesMeta": {
|
|
69
69
|
"@modelcontextprotocol/sdk": {
|