From bf847b8c74cfdba3b590fefc49e86d444ae0e6f7 Mon Sep 17 00:00:00 2001 From: bbassie <17990055+bbassie@users.noreply.github.com> Date: Tue, 27 Oct 2026 23:01:12 +0000 Subject: [PATCH] Drop build tool names from the controller and static_url docs Controller.viteServer becomes devServer, matching the devMiddleware name it replaced. The static_url limitation is described as one of the web build rather than webpack. Co-Authored-By: Claude Opus 5.5 --- docs/configuration.md | 2 +- packages/controller/src/Controller.ts | 20 ++++++++++---------- packages/controller/src/routes.ts | 2 +- packages/lib/src/config/definitions.ts | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index a2ee116e..558ed344 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -103,7 +103,7 @@ Defaults to null meaning assume localhost. Used to override where static assets such as the web bundle is loaded from. This can be used if you want to put the static assets on a separate cdn url like `https://cdn.example.com/static/` while keeping the API hosted directly by clusterio. -Due to a limitation on how the webpack assets are built the pathname component of the url have to be `/static/`, values with any other path are rejected. +Due to a limitation on how the web assets are built the pathname component of the url have to be `/static/`, values with any other path are rejected. See also the `clusteriocontroller copy-static` command for how to obtain the static asset files that need to be hosted. diff --git a/packages/controller/src/Controller.ts b/packages/controller/src/Controller.ts index ff048d3b..bbd2286d 100644 --- a/packages/controller/src/Controller.ts +++ b/packages/controller/src/Controller.ts @@ -106,7 +106,7 @@ export default class Controller { _registeredEvents = new Map, lib.EventHandler>(); _snoopedEvents = new Map(); - viteServer: import("vite").ViteDevServer | null = null; + devServer: import("vite").ViteDevServer | null = null; startedAtMs = Date.now(); autosaveInterval?: ReturnType; @@ -416,8 +416,8 @@ export default class Controller { } Controller.addAppRoutes(this.app, this.pluginInfos); - if (this.viteServer) { - this.app.use(this.viteServer.middlewares); + if (this.devServer) { + this.app.use(this.devServer.middlewares); } if (!args.dev) { @@ -516,7 +516,7 @@ export default class Controller { this.app.locals.devPlugins = devPlugins; const controllerDir = path.join(import.meta.dirname, "..", "..", ".."); - this.viteServer = await vite.createServer({ + this.devServer = await vite.createServer({ configFile: path.join(controllerDir, "vite.config.js"), root: controllerDir, base: "/static/", @@ -529,13 +529,13 @@ export default class Controller { }); if (args.dev) { this.app.locals.webBundle = { - main: this.viteServer.config.plugins.find(p => p.name === "clusterio:app")!.api.entry, + main: this.devServer.config.plugins.find(p => p.name === "clusterio:app")!.api.entry, imports: Object.fromEntries(webUiVite.sharedModules.map( name => [name, webUiVite.devSharedUrl(name)] )), }; } - this.app.locals.viteServer = this.viteServer; + this.app.locals.devServer = this.devServer; } /** @@ -586,8 +586,8 @@ export default class Controller { await this.clusterLogIndex.save(); } - if (this.viteServer) { - await this.viteServer.close(); + if (this.devServer) { + await this.devServer.close(); } await this.hooks.shutdown.invoke(); @@ -1388,8 +1388,8 @@ export default class Controller { .replace(/__IMPORT_MAP__/g, () => importMap) .replace(/__MAIN_BUNDLE__/g, () => routes.stripStaticPrefix(main)) ; - if (res.app.locals.viteServer) { - content = await res.app.locals.viteServer.transformIndexHtml(req.originalUrl, content); + if (res.app.locals.devServer) { + content = await res.app.locals.devServer.transformIndexHtml(req.originalUrl, content); } res.type("text/html"); res.send(content); diff --git a/packages/controller/src/routes.ts b/packages/controller/src/routes.ts index ac262712..9b7f96fa 100644 --- a/packages/controller/src/routes.ts +++ b/packages/controller/src/routes.ts @@ -21,7 +21,7 @@ declare global { export interface Locals { controller: Controller, webBundle: { main: string, imports: Record }, - viteServer?: import("vite").ViteDevServer, + devServer?: import("vite").ViteDevServer, staticRoot: string | null, devPlugins?: Map, streams: Map, diff --git a/packages/lib/src/config/definitions.ts b/packages/lib/src/config/definitions.ts index 7a88b914..5d19897a 100644 --- a/packages/lib/src/config/definitions.ts +++ b/packages/lib/src/config/definitions.ts @@ -151,7 +151,7 @@ export class ControllerConfig extends classes.Config { optional: true, validator: (value) => { if (value) { - // This is unfortunately a limitiation of how the webpack build is set up right now. + // This is unfortunately a limitiation of how the web build is set up right now. const pathname = new URL(value, "http://localhost/").pathname; if (pathname !== "/static/") { throw new Error(`Path component of static_url must be /static/ not ${pathname}.`);