mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-26 00:33:12 +09:00
Replace node:assert in link with a local assert
The assert polyfill is 28 KB in the web interface bundle and link only uses it for plain truthiness checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4d7c1020b0
commit
6dc48b6732
3 files changed
+8
-2
No files matched your search
@@ -0,0 +1,6 @@
|
|||||||
|
/** Throws if condition is falsy, node:assert is not available in the browser. */
|
||||||
|
export function assert(condition: unknown): asserts condition {
|
||||||
|
if (!condition) {
|
||||||
|
throw new Error("Assertion failed");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
// Connection adapters for Links
|
// Connection adapters for Links
|
||||||
import { strict as assert } from "assert";
|
|
||||||
import events from "events";
|
import events from "events";
|
||||||
|
|
||||||
import { WebSocket } from "#WebSocket";
|
import { WebSocket } from "#WebSocket";
|
||||||
@@ -7,6 +6,7 @@ import * as libData from "../data/index.js";
|
|||||||
import * as libErrors from "../errors.js";
|
import * as libErrors from "../errors.js";
|
||||||
import { logger } from "../logging.js";
|
import { logger } from "../logging.js";
|
||||||
import ExponentialBackoff from "../ExponentialBackoff.js";
|
import ExponentialBackoff from "../ExponentialBackoff.js";
|
||||||
|
import { assert } from "./assert.js";
|
||||||
import type { Request, Event } from "./link.js";
|
import type { Request, Event } from "./link.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { logger } from "../logging.js";
|
|||||||
import * as libSchema from "../schema.js";
|
import * as libSchema from "../schema.js";
|
||||||
import { dataClasses, errorClasses } from "./messages.js";
|
import { dataClasses, errorClasses } from "./messages.js";
|
||||||
import { BaseConnector, WebSocketBaseConnector } from "./connectors.js";
|
import { BaseConnector, WebSocketBaseConnector } from "./connectors.js";
|
||||||
import { strict as assert } from "assert";
|
import { assert } from "./assert.js";
|
||||||
import type { PluginNodeEnvInfo, PluginWebEnvInfo } from "../plugin.js";
|
import type { PluginNodeEnvInfo, PluginWebEnvInfo } from "../plugin.js";
|
||||||
import type {
|
import type {
|
||||||
AddressType, JSONDeserialisable, MessageRoutable, MessageRequest, MessageEvent, IUser,
|
AddressType, JSONDeserialisable, MessageRoutable, MessageRequest, MessageEvent, IUser,
|
||||||
|
|||||||
Reference in new issue
Block a user