@powerlines/deepkit 0.6.167 → 0.7.1
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/bin/deepkit-install.cjs +55 -90
- package/dist/capnp-BLx1WTBU.cjs +5175 -0
- package/dist/capnp-BiGNkOmV.mjs +4905 -0
- package/dist/capnp.cjs +47 -186
- package/dist/capnp.d.cts +78 -77
- package/dist/{capnp.d.ts → capnp.d.mts} +78 -77
- package/dist/capnp.mjs +3 -0
- package/dist/chunk-C0xms8kb.cjs +34 -0
- package/dist/esbuild-plugin.cjs +47 -11
- package/dist/esbuild-plugin.d.cts +20 -18
- package/dist/esbuild-plugin.d.mts +35 -0
- package/dist/esbuild-plugin.mjs +48 -0
- package/dist/index.cjs +69 -250
- package/dist/index.d.cts +10 -19
- package/dist/index.d.mts +10 -0
- package/dist/index.mjs +11 -0
- package/dist/reflect-type.cjs +24 -12
- package/dist/reflect-type.d.cts +7 -5
- package/dist/{reflect-type.d.ts → reflect-type.d.mts} +7 -5
- package/dist/reflect-type.mjs +24 -0
- package/dist/{reflection-9KUpjPqV.d.cts → reflection-BwdnCwaK.d.cts} +11 -17
- package/dist/{reflection-9KUpjPqV.d.ts → reflection-Chr4fE0i.d.mts} +11 -17
- package/dist/reflection-D9R8cdSo.d.mts +1561 -0
- package/dist/resolve-reflections.cjs +15 -9
- package/dist/resolve-reflections.d.cts +4 -2
- package/dist/{resolve-reflections.d.ts → resolve-reflections.d.mts} +4 -2
- package/dist/resolve-reflections.mjs +16 -0
- package/dist/rolldown-plugin.cjs +44 -11
- package/dist/rolldown-plugin.d.cts +5 -3
- package/dist/{rolldown-plugin.d.ts → rolldown-plugin.d.mts} +5 -3
- package/dist/rolldown-plugin.mjs +45 -0
- package/dist/transformer.cjs +52 -13
- package/dist/transformer.d.cts +6 -4
- package/dist/{transformer.d.ts → transformer.d.mts} +6 -4
- package/dist/transformer.mjs +51 -0
- package/dist/transpile.cjs +29 -10
- package/dist/transpile.d.cts +6 -4
- package/dist/{transpile.d.ts → transpile.d.mts} +6 -4
- package/dist/transpile.mjs +29 -0
- package/dist/types.cjs +0 -4
- package/dist/types.d.cts +9 -9
- package/dist/{types.d.ts → types.d.mts} +9 -9
- package/dist/types.mjs +1 -0
- package/dist/utilities.cjs +116 -33
- package/dist/utilities.d.cts +4 -2
- package/dist/{utilities.d.ts → utilities.d.mts} +4 -2
- package/dist/utilities.mjs +111 -0
- package/dist/vendor/core.cjs +1240 -513
- package/dist/vendor/core.mjs +1116 -0
- package/dist/vendor/string-BoXo0wS7.cjs +2983 -0
- package/dist/vendor/string-BuMgdahD.mjs +2467 -0
- package/dist/vendor/type-BMLjRtLY.cjs +202 -0
- package/dist/vendor/type-Dgeqs-rL.mjs +190 -0
- package/dist/vendor/type-compiler/compiler-BUrWMhGi.cjs +6792 -0
- package/dist/vendor/type-compiler/compiler-Bg8jX6qU.mjs +6739 -0
- package/dist/vendor/type-compiler/compiler-D1z5h1MK.d.cts +578 -0
- package/dist/vendor/type-compiler/compiler-Nkxc4PLJ.d.mts +578 -0
- package/dist/vendor/type-compiler/compiler.cjs +11 -43
- package/dist/vendor/type-compiler/compiler.d.cts +2 -3
- package/dist/vendor/type-compiler/compiler.d.mts +2 -0
- package/dist/vendor/type-compiler/compiler.mjs +3 -0
- package/dist/vendor/type-compiler/config-BEX924PC.cjs +3709 -0
- package/dist/vendor/type-compiler/config-B_cKkYZm.d.cts +116 -0
- package/dist/vendor/type-compiler/config-D9DM7Du_.d.mts +116 -0
- package/dist/vendor/type-compiler/config-y0HNkbCH.mjs +3640 -0
- package/dist/vendor/type-compiler/config.cjs +9 -34
- package/dist/vendor/type-compiler/config.d.cts +2 -1
- package/dist/vendor/type-compiler/config.d.mts +2 -0
- package/dist/vendor/type-compiler/config.mjs +3 -0
- package/dist/vendor/type-compiler/index.cjs +56 -129
- package/dist/vendor/type-compiler/index.d.cts +22 -3
- package/dist/vendor/type-compiler/index.d.mts +22 -0
- package/dist/vendor/type-compiler/index.mjs +50 -0
- package/dist/vendor/type-spec.cjs +11 -12
- package/dist/vendor/type-spec.mjs +3 -0
- package/dist/vendor/type.cjs +8407 -17892
- package/dist/vendor/type.d.cts +10 -196
- package/dist/vendor/{type.d.ts → type.d.mts} +10 -196
- package/dist/vendor/type.mjs +9109 -0
- package/package.json +43 -31
- package/schemas/reflection.cjs +4018 -4129
- package/schemas/reflection.d.cts +30 -38
- package/schemas/{reflection.d.ts → reflection.d.mts} +30 -38
- package/schemas/reflection.mjs +4036 -0
- package/dist/capnp.js +0 -2
- package/dist/chunk-23YNDVRG.js +0 -34
- package/dist/chunk-27RKMKSF.cjs +0 -50
- package/dist/chunk-2XDQUCXZ.js +0 -2392
- package/dist/chunk-34OFD7LS.cjs +0 -68
- package/dist/chunk-7FXYDYVQ.cjs +0 -5246
- package/dist/chunk-7QZGCBH7.cjs +0 -11
- package/dist/chunk-ALM6UMVU.js +0 -9
- package/dist/chunk-BLLXF42T.cjs +0 -41
- package/dist/chunk-H3Q3XL3D.js +0 -19
- package/dist/chunk-HPVJ6OV3.cjs +0 -31
- package/dist/chunk-JQUKKAFM.js +0 -48
- package/dist/chunk-KK7TQA7L.cjs +0 -25
- package/dist/chunk-NPV2346T.js +0 -25
- package/dist/chunk-ORA4UQMU.cjs +0 -2
- package/dist/chunk-OUGDFUKJ.cjs +0 -2400
- package/dist/chunk-OULCUN6I.js +0 -1
- package/dist/chunk-SHUYVCID.js +0 -4
- package/dist/chunk-TDYIUJGY.js +0 -5180
- package/dist/chunk-USNT2KNT.cjs +0 -6
- package/dist/chunk-WYEFKIRL.js +0 -66
- package/dist/esbuild-plugin.d.ts +0 -33
- package/dist/esbuild-plugin.js +0 -4
- package/dist/index.d.ts +0 -19
- package/dist/index.js +0 -10
- package/dist/reflect-type.js +0 -5
- package/dist/resolve-reflections.js +0 -2
- package/dist/rolldown-plugin.js +0 -4
- package/dist/transformer.js +0 -2
- package/dist/transpile.js +0 -3
- package/dist/types.js +0 -1
- package/dist/utilities.js +0 -2
- package/dist/vendor/chunk-5BKT4CS5.js +0 -28
- package/dist/vendor/chunk-BLN7QVCP.js +0 -3704
- package/dist/vendor/chunk-BR2FK5K7.js +0 -109
- package/dist/vendor/chunk-EPQZMVJO.cjs +0 -3859
- package/dist/vendor/chunk-IFK6AU6M.cjs +0 -42
- package/dist/vendor/chunk-SHDAXCXF.cjs +0 -115
- package/dist/vendor/core.js +0 -2
- package/dist/vendor/type-compiler/chunk-3LL3TSRJ.js +0 -3762
- package/dist/vendor/type-compiler/chunk-CUTGHVNY.js +0 -7100
- package/dist/vendor/type-compiler/chunk-IAWCLVUK.cjs +0 -3780
- package/dist/vendor/type-compiler/chunk-UIWPG352.cjs +0 -7114
- package/dist/vendor/type-compiler/compiler.d.ts +0 -3
- package/dist/vendor/type-compiler/compiler.js +0 -5
- package/dist/vendor/type-compiler/config.d.ts +0 -1
- package/dist/vendor/type-compiler/config.js +0 -5
- package/dist/vendor/type-compiler/index.d.ts +0 -3
- package/dist/vendor/type-compiler/index.js +0 -66
- package/dist/vendor/type-spec.js +0 -2
- package/dist/vendor/type.js +0 -18359
- package/schemas/reflection.js +0 -4153
- /package/dist/vendor/{core.d.ts → core.d.mts} +0 -0
- /package/dist/vendor/{type-spec.d.ts → type-spec.d.mts} +0 -0
package/bin/deepkit-install.cjs
CHANGED
|
@@ -1,26 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
let _storm_software_config_tools_logger = require("@storm-software/config-tools/logger");
|
|
3
|
+
let node_fs = require("node:fs");
|
|
4
|
+
let node_fs_promises = require("node:fs/promises");
|
|
5
|
+
let node_path = require("node:path");
|
|
3
6
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
12
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
13
|
-
}) : x)(function(x) {
|
|
14
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
15
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
16
|
-
});
|
|
17
|
-
var currentWorkingDir = process.argv[2] || process.cwd();
|
|
7
|
+
//#region scripts/deepkit-install.ts
|
|
8
|
+
/**
|
|
9
|
+
* This script installs the deepkit/type transformer (that extracts automatically types and adds the correct \@t decorator) to the typescript node_modules.
|
|
10
|
+
*
|
|
11
|
+
* The critical section that needs adjustment is in the `function getScriptTransformers` in `node_modules/typescript/lib/tsc.js`.
|
|
12
|
+
*/
|
|
13
|
+
const currentWorkingDir = process.argv[2] || process.cwd();
|
|
18
14
|
function getPatchId(id) {
|
|
19
|
-
|
|
15
|
+
return `deepkit_type_patch_${id}`;
|
|
20
16
|
}
|
|
21
|
-
__name(getPatchId, "getPatchId");
|
|
22
17
|
function getCode(deepkitDistPath, varName, id) {
|
|
23
|
-
|
|
18
|
+
return `
|
|
24
19
|
//${getPatchId(id)}
|
|
25
20
|
|
|
26
21
|
try {
|
|
@@ -69,86 +64,56 @@ function getCode(deepkitDistPath, varName, id) {
|
|
|
69
64
|
//${getPatchId(id)}-end
|
|
70
65
|
`;
|
|
71
66
|
}
|
|
72
|
-
__name(getCode, "getCode");
|
|
73
67
|
function isPatched(code, id) {
|
|
74
|
-
|
|
68
|
+
return code.includes(getPatchId(id));
|
|
75
69
|
}
|
|
76
|
-
__name(isPatched, "isPatched");
|
|
77
70
|
function patchGetTransformers(deepkitDistPath, code) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
code = code.replace(find, (substring) => {
|
|
87
|
-
return `${substring}
|
|
88
|
-
${getCode(deepkitDistPath, "customTransformers", id)}`;
|
|
89
|
-
});
|
|
90
|
-
return code;
|
|
71
|
+
const id = "patchGetTransformers";
|
|
72
|
+
if (isPatched(code, id)) return "";
|
|
73
|
+
const find = /function getTransformers\([^)]+\)\s*\{/;
|
|
74
|
+
if (!code.match(find)) return "";
|
|
75
|
+
code = code.replace(find, (substring) => {
|
|
76
|
+
return `${substring}\n ${getCode(deepkitDistPath, "customTransformers", id)}`;
|
|
77
|
+
});
|
|
78
|
+
return code;
|
|
91
79
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
logLevel: "all"
|
|
96
|
-
});
|
|
97
|
-
process.exit(0);
|
|
80
|
+
const deepkitInstallTimeout = setTimeout(() => {
|
|
81
|
+
(0, _storm_software_config_tools_logger.writeError)("powerlines@deepkit-install: Timeout reached.", { logLevel: "all" });
|
|
82
|
+
process.exit(0);
|
|
98
83
|
}, 3e4);
|
|
99
84
|
(async () => {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
await promises.writeFile(file, content);
|
|
126
|
-
logger.writeSuccess(`powerlines@deepkit-install: Injected Deepkit TypeScript transformer at ${file}`, {
|
|
127
|
-
logLevel: "all"
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
} catch (e) {
|
|
131
|
-
logger.writeError(`powerlines@deepkit-install: Exception occurred - ${e?.message}`, {
|
|
132
|
-
logLevel: "all"
|
|
133
|
-
});
|
|
134
|
-
} finally {
|
|
135
|
-
const end = /* @__PURE__ */ new Date();
|
|
136
|
-
logger.writeDebug(`powerlines@deepkit-install: Process took ${end.getTime() - start.getTime()}ms`, {
|
|
137
|
-
logLevel: "all"
|
|
138
|
-
});
|
|
139
|
-
clearTimeout(deepkitInstallTimeout);
|
|
140
|
-
process.exit(0);
|
|
141
|
-
}
|
|
85
|
+
const start = /* @__PURE__ */ new Date();
|
|
86
|
+
try {
|
|
87
|
+
(0, _storm_software_config_tools_logger.writeInfo)("powerlines@deepkit-install: Patching TypeScript package with Deepkit transformer", { logLevel: "all" });
|
|
88
|
+
const typeScriptPath = (0, node_path.dirname)(require.resolve("typescript", { paths: [(0, node_path.join)(currentWorkingDir, "..")] }));
|
|
89
|
+
const deepkitDistPath = (0, node_path.relative)(typeScriptPath, __dirname);
|
|
90
|
+
for (const fileName of [
|
|
91
|
+
"tsc.js",
|
|
92
|
+
"_tsc.js",
|
|
93
|
+
"typescript.js"
|
|
94
|
+
]) {
|
|
95
|
+
const file = (0, node_path.join)(typeScriptPath, fileName);
|
|
96
|
+
if (!(0, node_fs.existsSync)(file)) continue;
|
|
97
|
+
const content = patchGetTransformers(deepkitDistPath, await (0, node_fs_promises.readFile)(file, "utf8"));
|
|
98
|
+
if (!content) continue;
|
|
99
|
+
await (0, node_fs_promises.writeFile)(file, content);
|
|
100
|
+
(0, _storm_software_config_tools_logger.writeSuccess)(`powerlines@deepkit-install: Injected Deepkit TypeScript transformer at ${file}`, { logLevel: "all" });
|
|
101
|
+
}
|
|
102
|
+
} catch (e) {
|
|
103
|
+
(0, _storm_software_config_tools_logger.writeError)(`powerlines@deepkit-install: Exception occurred - ${e?.message}`, { logLevel: "all" });
|
|
104
|
+
} finally {
|
|
105
|
+
(0, _storm_software_config_tools_logger.writeDebug)(`powerlines@deepkit-install: Process took ${(/* @__PURE__ */ new Date()).getTime() - start.getTime()}ms`, { logLevel: "all" });
|
|
106
|
+
clearTimeout(deepkitInstallTimeout);
|
|
107
|
+
process.exit(0);
|
|
108
|
+
}
|
|
142
109
|
})();
|
|
143
110
|
process.on("uncaughtException", (e) => {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
});
|
|
147
|
-
process.exit(0);
|
|
111
|
+
(0, _storm_software_config_tools_logger.writeFatal)(`powerlines@deepkit-install: Uncaught Exception occurred - ${e.message}`, { logLevel: "all" });
|
|
112
|
+
process.exit(0);
|
|
148
113
|
});
|
|
149
114
|
process.on("unhandledRejection", (e) => {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
});
|
|
153
|
-
process.exit(0);
|
|
115
|
+
(0, _storm_software_config_tools_logger.writeFatal)(`powerlines@deepkit-install: Unhandled Rejection occurred - ${e?.message}`, { logLevel: "all" });
|
|
116
|
+
process.exit(0);
|
|
154
117
|
});
|
|
118
|
+
|
|
119
|
+
//#endregion
|