@tsed/cli 7.5.0-rc.7 → 7.5.0-rc.8

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.
@@ -19,8 +19,13 @@ function runNode(cmd, args) {
19
19
  });
20
20
  });
21
21
  }
22
- export async function resolveViteBin(resolve = import.meta.resolve) {
23
- const packageJsonPath = fileURLToPath(await resolve("vite/package.json"));
22
+ function toPath(value) {
23
+ if (value.startsWith("file://")) {
24
+ return fileURLToPath(value);
25
+ }
26
+ return value;
27
+ }
28
+ export async function resolveViteBinFromPackageJsonPath(packageJsonPath) {
24
29
  const packageJson = JSON.parse(await readFile(packageJsonPath, "utf-8"));
25
30
  const binRelativePath = typeof packageJson.bin === "string" ? packageJson.bin : packageJson.bin?.vite;
26
31
  if (!binRelativePath) {
@@ -28,6 +33,10 @@ export async function resolveViteBin(resolve = import.meta.resolve) {
28
33
  }
29
34
  return path.resolve(path.dirname(packageJsonPath), binRelativePath);
30
35
  }
36
+ export async function resolveViteBin() {
37
+ const packageJsonPath = toPath(await import.meta.resolve("vite/package.json"));
38
+ return resolveViteBinFromPackageJsonPath(packageJsonPath);
39
+ }
31
40
  export async function build(rawArgs = process.argv.slice(2)) {
32
41
  const viteBin = await resolveViteBin();
33
42
  await runNode(process.execPath, [viteBin, "build", ...rawArgs]);