@tsed/cli 7.5.0-rc.5 → 7.5.0-rc.6
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-dev.js +2 -2
- package/lib/esm/commands/init/InitCmd.js +6 -4
- package/lib/esm/commands/init/config/FeaturesPrompt.js +4 -0
- package/lib/esm/commands/init/config/InitSchema.js +6 -2
- package/lib/esm/commands/mcp/schema/ProjectPreferencesSchema.js +2 -2
- package/lib/esm/runtimes/RuntimesModule.js +3 -2
- package/lib/esm/runtimes/index.js +1 -0
- package/lib/esm/runtimes/supports/BunViteRuntime.js +30 -0
- package/lib/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/types/commands/mcp/schema/ProjectPreferencesSchema.d.ts +1 -1
- package/lib/types/interfaces/RenderDataContext.d.ts +1 -0
- package/lib/types/interfaces/RuntimeTypes.d.ts +1 -1
- package/lib/types/runtimes/index.d.ts +1 -0
- package/lib/types/runtimes/supports/BunViteRuntime.d.ts +11 -0
- package/package.json +6 -6
package/lib/esm/bin/tsed-dev.js
CHANGED
|
@@ -3,9 +3,9 @@ import { existsSync } from "node:fs";
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import process from "node:process";
|
|
5
5
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
6
|
-
const runnerFile = fileURLToPath(import.meta.url);
|
|
7
|
-
const configFile = path.resolve(path.dirname(runnerFile), "../../vite.config.ts");
|
|
8
6
|
const RUN_MODE = "TSED_VITE_RUN_MODE";
|
|
7
|
+
const runnerFile = fileURLToPath(import.meta.url);
|
|
8
|
+
const configFile = path.resolve(process.cwd(), "vite.config.ts");
|
|
9
9
|
function parseWatchValue(args) {
|
|
10
10
|
if (args.includes("--no-watch")) {
|
|
11
11
|
return false;
|
|
@@ -13,6 +13,7 @@ import { taskOutput } from "../../fn/taskOutput.js";
|
|
|
13
13
|
import { PlatformsModule } from "../../platforms/PlatformsModule.js";
|
|
14
14
|
import { RuntimesModule } from "../../runtimes/RuntimesModule.js";
|
|
15
15
|
import { BunRuntime } from "../../runtimes/supports/BunRuntime.js";
|
|
16
|
+
import { BunViteRuntime } from "../../runtimes/supports/BunViteRuntime.js";
|
|
16
17
|
import { NodeRuntime } from "../../runtimes/supports/NodeRuntime.js";
|
|
17
18
|
import { ViteRuntime } from "../../runtimes/supports/ViteRuntime.js";
|
|
18
19
|
import { CliProjectService } from "../../services/CliProjectService.js";
|
|
@@ -75,7 +76,7 @@ export class InitCmd {
|
|
|
75
76
|
this.resolveRootDir(ctx);
|
|
76
77
|
ctx = mapToContext(ctx);
|
|
77
78
|
if (this.isLaunchedWithBunx()) {
|
|
78
|
-
ctx.runtime
|
|
79
|
+
ctx.runtime ??= "bun";
|
|
79
80
|
ctx.packageManager = "bun";
|
|
80
81
|
}
|
|
81
82
|
this.runtimes.init(ctx);
|
|
@@ -95,7 +96,7 @@ export class InitCmd {
|
|
|
95
96
|
return Boolean(globalThis.Bun);
|
|
96
97
|
}
|
|
97
98
|
filterOnlyBun(values) {
|
|
98
|
-
const filtered = values.filter((value) =>
|
|
99
|
+
const filtered = values.filter((value) => ["bun", "bun-vite"].includes(value));
|
|
99
100
|
return filtered.length ? filtered : values;
|
|
100
101
|
}
|
|
101
102
|
async writeRcFiles(ctx) {
|
|
@@ -143,8 +144,9 @@ export class InitCmd {
|
|
|
143
144
|
ctx = {
|
|
144
145
|
...ctx,
|
|
145
146
|
node: runtime instanceof NodeRuntime,
|
|
146
|
-
bun: runtime instanceof BunRuntime,
|
|
147
|
-
|
|
147
|
+
bun: runtime instanceof BunRuntime || runtime instanceof BunViteRuntime,
|
|
148
|
+
bunVite: runtime instanceof BunViteRuntime,
|
|
149
|
+
vite: runtime instanceof ViteRuntime || runtime instanceof BunViteRuntime,
|
|
148
150
|
compiled: runtime.isCompiled()
|
|
149
151
|
};
|
|
150
152
|
return [
|
|
@@ -278,6 +278,10 @@ export const InitSchema = () => {
|
|
|
278
278
|
label: "Node.js + Vite",
|
|
279
279
|
value: "vite"
|
|
280
280
|
},
|
|
281
|
+
{
|
|
282
|
+
label: "Bun.js + Vite",
|
|
283
|
+
value: "bun-vite"
|
|
284
|
+
},
|
|
281
285
|
{
|
|
282
286
|
label: "Node.js + SWC",
|
|
283
287
|
value: "node"
|
|
@@ -291,7 +295,7 @@ export const InitSchema = () => {
|
|
|
291
295
|
value: "webpack"
|
|
292
296
|
},
|
|
293
297
|
{
|
|
294
|
-
label: "Bun",
|
|
298
|
+
label: "Bun.js",
|
|
295
299
|
value: "bun"
|
|
296
300
|
}
|
|
297
301
|
].filter((o) => availableRuntimes.includes(o.value)))
|
|
@@ -301,7 +305,7 @@ export const InitSchema = () => {
|
|
|
301
305
|
packageManager: s
|
|
302
306
|
.enums(availablePackageManagers)
|
|
303
307
|
.prompt("Choose the package manager:")
|
|
304
|
-
.when((answers) =>
|
|
308
|
+
.when((answers) => !["bun", "bun-vite"].includes(answers.runtime))
|
|
305
309
|
.default(PackageManager.NPM)
|
|
306
310
|
.choices([
|
|
307
311
|
{
|
|
@@ -8,8 +8,8 @@ export const ProjectPreferenceSchema = s
|
|
|
8
8
|
packageManager: s.string().enum(PackageManager).description("Used project manager to install dependencies"),
|
|
9
9
|
runtime: s
|
|
10
10
|
.string()
|
|
11
|
-
.enum("vite", "node", "babel", "swc", "webpack", "bun")
|
|
12
|
-
.description("The javascript runtime used to start application (node, node + webpack, node + swc, node + babel, bun
|
|
11
|
+
.enum("vite", "bun-vite", "node", "babel", "swc", "webpack", "bun")
|
|
12
|
+
.description("The javascript runtime used to start application (node + vite, bun + vite, node + webpack, node + swc, node + babel, bun)"),
|
|
13
13
|
platform: s.string().enum(PlatformType).description("Node.js framework used to run server (Express, Koa, Fastify)")
|
|
14
14
|
})
|
|
15
15
|
.optional()
|
|
@@ -3,6 +3,7 @@ import { inject, injectable, injectMany } from "@tsed/di";
|
|
|
3
3
|
import { BabelRuntime } from "./supports/BabelRuntime.js";
|
|
4
4
|
import { BaseRuntime } from "./supports/BaseRuntime.js";
|
|
5
5
|
import { BunRuntime } from "./supports/BunRuntime.js";
|
|
6
|
+
import { BunViteRuntime } from "./supports/BunViteRuntime.js";
|
|
6
7
|
import { NodeRuntime } from "./supports/NodeRuntime.js";
|
|
7
8
|
import { ViteRuntime } from "./supports/ViteRuntime.js";
|
|
8
9
|
import { WebpackRuntime } from "./supports/WebpackRuntime.js";
|
|
@@ -13,7 +14,7 @@ export class RuntimesModule {
|
|
|
13
14
|
}
|
|
14
15
|
init(ctx) {
|
|
15
16
|
ctx.runtime = ctx.runtime || this.get().name;
|
|
16
|
-
if (ctx.runtime
|
|
17
|
+
if (ctx.runtime.startsWith("bun")) {
|
|
17
18
|
ctx.packageManager = "bun";
|
|
18
19
|
}
|
|
19
20
|
}
|
|
@@ -42,4 +43,4 @@ export class RuntimesModule {
|
|
|
42
43
|
};
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
|
-
injectable(RuntimesModule).imports([ViteRuntime, NodeRuntime, BabelRuntime, WebpackRuntime, BunRuntime]);
|
|
46
|
+
injectable(RuntimesModule).imports([ViteRuntime, BunViteRuntime, NodeRuntime, BabelRuntime, WebpackRuntime, BunRuntime]);
|
|
@@ -2,6 +2,7 @@ export * from "./RuntimesModule.js";
|
|
|
2
2
|
export * from "./supports/BabelRuntime.js";
|
|
3
3
|
export * from "./supports/BaseRuntime.js";
|
|
4
4
|
export * from "./supports/BunRuntime.js";
|
|
5
|
+
export * from "./supports/BunViteRuntime.js";
|
|
5
6
|
export * from "./supports/NodeRuntime.js";
|
|
6
7
|
export * from "./supports/ViteRuntime.js";
|
|
7
8
|
export * from "./supports/WebpackRuntime.js";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { injectable } from "@tsed/di";
|
|
2
|
+
import { BaseRuntime } from "./BaseRuntime.js";
|
|
3
|
+
export class BunViteRuntime extends BaseRuntime {
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
this.name = "bun-vite";
|
|
7
|
+
this.cmd = "bun";
|
|
8
|
+
this.order = 1;
|
|
9
|
+
}
|
|
10
|
+
files() {
|
|
11
|
+
return ["vite.config.ts"];
|
|
12
|
+
}
|
|
13
|
+
compile() {
|
|
14
|
+
return "tsed build";
|
|
15
|
+
}
|
|
16
|
+
startDev() {
|
|
17
|
+
return "tsed dev";
|
|
18
|
+
}
|
|
19
|
+
startProd(args) {
|
|
20
|
+
return `bun ${args}`;
|
|
21
|
+
}
|
|
22
|
+
devDependencies() {
|
|
23
|
+
return {
|
|
24
|
+
"@tsed/cli": "{{cliVersion}}",
|
|
25
|
+
typescript: "latest",
|
|
26
|
+
vite: "latest"
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
injectable(BunViteRuntime).type("runtime");
|