@tsed/cli 6.1.10 → 6.1.11-rc.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/lib/esm/bin/tsed.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { register } from "node:module";
|
|
3
|
+
import { join } from "node:path";
|
|
3
4
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
4
5
|
const EXT = process.env.CLI_MODE === "ts" ? "ts" : "js";
|
|
5
|
-
register(pathToFileURL(
|
|
6
|
+
register(pathToFileURL(join(import.meta.dirname, `../loaders/alias.hook.${EXT}`)), {
|
|
6
7
|
parentURL: import.meta.dirname,
|
|
7
8
|
data: {
|
|
8
|
-
"@tsed/core":
|
|
9
|
-
"@tsed/di":
|
|
10
|
-
"@tsed/schema":
|
|
11
|
-
"@tsed/cli-core":
|
|
12
|
-
"@tsed/cli":
|
|
9
|
+
"@tsed/core": import.meta.resolve("@tsed/core"),
|
|
10
|
+
"@tsed/di": import.meta.resolve("@tsed/di"),
|
|
11
|
+
"@tsed/schema": import.meta.resolve("@tsed/schema"),
|
|
12
|
+
"@tsed/cli-core": import.meta.resolve("@tsed/cli-core"),
|
|
13
|
+
"@tsed/cli": import.meta.resolve("@tsed/cli")
|
|
13
14
|
},
|
|
14
15
|
transferList: []
|
|
15
16
|
});
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
function generateAliasesResolver(aliases, options) {
|
|
2
|
+
return (specifier, parentModuleURL, defaultResolve) => {
|
|
3
|
+
if (aliases[specifier]) {
|
|
4
|
+
return defaultResolve(aliases[specifier], parentModuleURL);
|
|
5
|
+
}
|
|
6
|
+
return defaultResolve(specifier, parentModuleURL);
|
|
7
|
+
};
|
|
8
|
+
}
|
|
2
9
|
let resolver = null;
|
|
3
10
|
export async function initialize(aliases) {
|
|
4
|
-
// Receives data from `register`.
|
|
5
11
|
resolver = generateAliasesResolver(aliases);
|
|
6
12
|
}
|
|
7
13
|
export function resolve(specifier, context, nextResolve) {
|