aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/api/demo/lib/api.ts18
-rw-r--r--src/api/demo/pages/index.tsx12
-rw-r--r--src/api/demo/pages/scan.tsx14
-rw-r--r--src/api/demo/schema.d.ts319
-rw-r--r--src/api/demo/schema.js137
-rw-r--r--src/bun.js/api/server.zig2
-rw-r--r--src/bun.js/node-dns.exports.js43
-rw-r--r--src/bun.js/node-tls.exports.js1
-rw-r--r--src/bun.js/wasi-runner.js11
-rw-r--r--src/darwin_c.zig40
-rw-r--r--src/deps/uws.zig4
-rw-r--r--src/fallback.ts9
-rw-r--r--src/http_client_async.zig14
-rw-r--r--src/linux_c.zig3
-rw-r--r--src/node-fallbacks/@vercel_fetch.js8
-rw-r--r--src/node-fallbacks/crypto.js15
-rw-r--r--src/node-fallbacks/events.js71
-rw-r--r--src/node-fallbacks/url.js81
-rw-r--r--src/runtime.footer.bun.js6
-rw-r--r--src/runtime.footer.js6
-rw-r--r--src/runtime.footer.node.js3
-rw-r--r--src/runtime.footer.with-refresh.js6
-rw-r--r--src/runtime.js43
-rw-r--r--src/runtime/errors.ts6
-rw-r--r--src/runtime/hmr.ts314
-rw-r--r--src/runtime/regenerator.ts41
-rw-r--r--src/string_immutable.zig2
-rw-r--r--src/test/fixtures/double-export-default-bug.jsx12
-rw-r--r--src/test/fixtures/simple-150x.jsx42
-rw-r--r--src/test/fixtures/simple.jsx30
30 files changed, 320 insertions, 993 deletions
diff --git a/src/api/demo/lib/api.ts b/src/api/demo/lib/api.ts
index d06bfd35b..88dd71001 100644
--- a/src/api/demo/lib/api.ts
+++ b/src/api/demo/lib/api.ts
@@ -13,9 +13,7 @@ export interface WebAssemblyModule {
}
const wasm_imports_sym: symbol | string =
- process.env.NODE_ENV === "development"
- ? "wasm_imports"
- : Symbol("wasm_imports");
+ process.env.NODE_ENV === "development" ? "wasm_imports" : Symbol("wasm_imports");
const ptr_converter = new ArrayBuffer(16);
const ptr_float = new BigUint64Array(ptr_converter);
@@ -150,10 +148,10 @@ export class Bun {
return;
}
- Bun.wasm_source = await globalThis.WebAssembly.instantiateStreaming(
- fetch(url),
- { env: Bun[wasm_imports_sym], wasi_snapshot_preview1: Wasi },
- );
+ Bun.wasm_source = await globalThis.WebAssembly.instantiateStreaming(fetch(url), {
+ env: Bun[wasm_imports_sym],
+ wasi_snapshot_preview1: Wasi,
+ });
const res = Bun.wasm_exports.init();
if (res < 0) {
@@ -225,11 +223,7 @@ export class Bun {
return response;
}
- static scan(
- content: Uint8Array | string,
- file_name: string,
- loader?: Loader,
- ) {
+ static scan(content: Uint8Array | string, file_name: string, loader?: Loader) {
if (!Bun.has_initialized) {
throw "Please run await Bun.init(wasm_url) before using this.";
}
diff --git a/src/api/demo/pages/index.tsx b/src/api/demo/pages/index.tsx
index 24577acb3..1f6e4bb82 100644
--- a/src/api/demo/pages/index.tsx
+++ b/src/api/demo/pages/index.tsx
@@ -14,10 +14,7 @@ export async function getStaticProps(ctx) {
return {
props: {
// not tested
- code: readFile(
- "/Users/jarred/Build/es-module-lexer/test/samples/magic-string.js",
- { encoding: "utf-8" },
- ),
+ code: readFile("/Users/jarred/Build/es-module-lexer/test/samples/magic-string.js", { encoding: "utf-8" }),
},
};
}
@@ -33,11 +30,8 @@ export default function Home({ code }) {
}, []);
const runBuild = React.useCallback(
- (event) => {
- globalThis.Run.transform(
- event.target.value,
- fileNameRef?.current?.value,
- ).then((result) => {
+ event => {
+ globalThis.Run.transform(event.target.value, fileNameRef?.current?.value).then(result => {
setEsbuildResult(result.esbuild.code);
setBunResult(textDecoder.decode(result.bun.files[0].data));
setSWCResult(result.swc.code);
diff --git a/src/api/demo/pages/scan.tsx b/src/api/demo/pages/scan.tsx
index 87cebd64d..656629dda 100644
--- a/src/api/demo/pages/scan.tsx
+++ b/src/api/demo/pages/scan.tsx
@@ -13,10 +13,7 @@ export async function getStaticProps(ctx) {
return {
props: {
// not tested
- code: readFile(
- "/Users/jarred/Build/es-module-lexer/test/samples/magic-string.js",
- { encoding: "utf-8" },
- ),
+ code: readFile("/Users/jarred/Build/es-module-lexer/test/samples/magic-string.js", { encoding: "utf-8" }),
defaultFile: "magic-string.js",
},
};
@@ -33,11 +30,8 @@ export default function Home({ code, defaultFile }) {
}, []);
const runBuild = React.useCallback(
- (event) => {
- globalThis.Scan.transform(
- event.target.value,
- fileNameRef?.current?.value,
- ).then((result) => {
+ event => {
+ globalThis.Scan.transform(event.target.value, fileNameRef?.current?.value).then(result => {
setLexer(JSON.stringify(result.lexer, null, 2));
setBunResult(JSON.stringify(result.bun, null, 2));
}, console.error);
@@ -59,7 +53,7 @@ export default function Home({ code, defaultFile }) {
type="text"
placeholder="filename"
value={file}
- onChange={(event) => setFile(event.target.value)}
+ onChange={event => setFile(event.target.value)}
ref={fileNameRef}
/>
<textarea onChange={runBuild} defaultValue={code}></textarea>
diff --git a/src/api/demo/schema.d.ts b/src/api/demo/schema.d.ts
index ae4551128..6f3949c77 100644
--- a/src/api/demo/schema.d.ts
+++ b/src/api/demo/schema.d.ts
@@ -683,228 +683,90 @@ export interface BunInstall {
global_bin_dir?: string;
}
-export declare function encodeStackFrame(
- message: StackFrame,
- bb: ByteBuffer,
-): void;
+export declare function encodeStackFrame(message: StackFrame, bb: ByteBuffer): void;
export declare function decodeStackFrame(buffer: ByteBuffer): StackFrame;
-export declare function encodeStackFramePosition(
- message: StackFramePosition,
- bb: ByteBuffer,
-): void;
-export declare function decodeStackFramePosition(
- buffer: ByteBuffer,
-): StackFramePosition;
-export declare function encodeSourceLine(
- message: SourceLine,
- bb: ByteBuffer,
-): void;
+export declare function encodeStackFramePosition(message: StackFramePosition, bb: ByteBuffer): void;
+export declare function decodeStackFramePosition(buffer: ByteBuffer): StackFramePosition;
+export declare function encodeSourceLine(message: SourceLine, bb: ByteBuffer): void;
export declare function decodeSourceLine(buffer: ByteBuffer): SourceLine;
-export declare function encodeStackTrace(
- message: StackTrace,
- bb: ByteBuffer,
-): void;
+export declare function encodeStackTrace(message: StackTrace, bb: ByteBuffer): void;
export declare function decodeStackTrace(buffer: ByteBuffer): StackTrace;
-export declare function encodeJSException(
- message: JSException,
- bb: ByteBuffer,
-): void;
+export declare function encodeJSException(message: JSException, bb: ByteBuffer): void;
export declare function decodeJSException(buffer: ByteBuffer): JSException;
export declare function encodeProblems(message: Problems, bb: ByteBuffer): void;
export declare function decodeProblems(buffer: ByteBuffer): Problems;
export declare function encodeRouter(message: Router, bb: ByteBuffer): void;
export declare function decodeRouter(buffer: ByteBuffer): Router;
-export declare function encodeFallbackMessageContainer(
- message: FallbackMessageContainer,
- bb: ByteBuffer,
-): void;
-export declare function decodeFallbackMessageContainer(
- buffer: ByteBuffer,
-): FallbackMessageContainer;
+export declare function encodeFallbackMessageContainer(message: FallbackMessageContainer, bb: ByteBuffer): void;
+export declare function decodeFallbackMessageContainer(buffer: ByteBuffer): FallbackMessageContainer;
export declare function encodeJSX(message: JSX, bb: ByteBuffer): void;
export declare function decodeJSX(buffer: ByteBuffer): JSX;
-export declare function encodeStringPointer(
- message: StringPointer,
- bb: ByteBuffer,
-): void;
+export declare function encodeStringPointer(message: StringPointer, bb: ByteBuffer): void;
export declare function decodeStringPointer(buffer: ByteBuffer): StringPointer;
-export declare function encodeJavascriptBundledModule(
- message: JavascriptBundledModule,
- bb: ByteBuffer,
-): void;
-export declare function decodeJavascriptBundledModule(
- buffer: ByteBuffer,
-): JavascriptBundledModule;
-export declare function encodeJavascriptBundledPackage(
- message: JavascriptBundledPackage,
- bb: ByteBuffer,
-): void;
-export declare function decodeJavascriptBundledPackage(
- buffer: ByteBuffer,
-): JavascriptBundledPackage;
-export declare function encodeJavascriptBundle(
- message: JavascriptBundle,
- bb: ByteBuffer,
-): void;
-export declare function decodeJavascriptBundle(
- buffer: ByteBuffer,
-): JavascriptBundle;
-export declare function encodeJavascriptBundleContainer(
- message: JavascriptBundleContainer,
- bb: ByteBuffer,
-): void;
-export declare function decodeJavascriptBundleContainer(
- buffer: ByteBuffer,
-): JavascriptBundleContainer;
-export declare function encodeModuleImportRecord(
- message: ModuleImportRecord,
- bb: ByteBuffer,
-): void;
-export declare function decodeModuleImportRecord(
- buffer: ByteBuffer,
-): ModuleImportRecord;
+export declare function encodeJavascriptBundledModule(message: JavascriptBundledModule, bb: ByteBuffer): void;
+export declare function decodeJavascriptBundledModule(buffer: ByteBuffer): JavascriptBundledModule;
+export declare function encodeJavascriptBundledPackage(message: JavascriptBundledPackage, bb: ByteBuffer): void;
+export declare function decodeJavascriptBundledPackage(buffer: ByteBuffer): JavascriptBundledPackage;
+export declare function encodeJavascriptBundle(message: JavascriptBundle, bb: ByteBuffer): void;
+export declare function decodeJavascriptBundle(buffer: ByteBuffer): JavascriptBundle;
+export declare function encodeJavascriptBundleContainer(message: JavascriptBundleContainer, bb: ByteBuffer): void;
+export declare function decodeJavascriptBundleContainer(buffer: ByteBuffer): JavascriptBundleContainer;
+export declare function encodeModuleImportRecord(message: ModuleImportRecord, bb: ByteBuffer): void;
+export declare function decodeModuleImportRecord(buffer: ByteBuffer): ModuleImportRecord;
export declare function encodeModule(message: Module, bb: ByteBuffer): void;
export declare function decodeModule(buffer: ByteBuffer): Module;
-export declare function encodeStringMap(
- message: StringMap,
- bb: ByteBuffer,
-): void;
+export declare function encodeStringMap(message: StringMap, bb: ByteBuffer): void;
export declare function decodeStringMap(buffer: ByteBuffer): StringMap;
-export declare function encodeLoaderMap(
- message: LoaderMap,
- bb: ByteBuffer,
-): void;
+export declare function encodeLoaderMap(message: LoaderMap, bb: ByteBuffer): void;
export declare function decodeLoaderMap(buffer: ByteBuffer): LoaderMap;
-export declare function encodeEnvConfig(
- message: EnvConfig,
- bb: ByteBuffer,
-): void;
+export declare function encodeEnvConfig(message: EnvConfig, bb: ByteBuffer): void;
export declare function decodeEnvConfig(buffer: ByteBuffer): EnvConfig;
-export declare function encodeLoadedEnvConfig(
- message: LoadedEnvConfig,
- bb: ByteBuffer,
-): void;
-export declare function decodeLoadedEnvConfig(
- buffer: ByteBuffer,
-): LoadedEnvConfig;
-export declare function encodeFrameworkConfig(
- message: FrameworkConfig,
- bb: ByteBuffer,
-): void;
-export declare function decodeFrameworkConfig(
- buffer: ByteBuffer,
-): FrameworkConfig;
-export declare function encodeFrameworkEntryPoint(
- message: FrameworkEntryPoint,
- bb: ByteBuffer,
-): void;
-export declare function decodeFrameworkEntryPoint(
- buffer: ByteBuffer,
-): FrameworkEntryPoint;
-export declare function encodeFrameworkEntryPointMap(
- message: FrameworkEntryPointMap,
- bb: ByteBuffer,
-): void;
-export declare function decodeFrameworkEntryPointMap(
- buffer: ByteBuffer,
-): FrameworkEntryPointMap;
-export declare function encodeFrameworkEntryPointMessage(
- message: FrameworkEntryPointMessage,
- bb: ByteBuffer,
-): void;
-export declare function decodeFrameworkEntryPointMessage(
- buffer: ByteBuffer,
-): FrameworkEntryPointMessage;
-export declare function encodeLoadedFramework(
- message: LoadedFramework,
- bb: ByteBuffer,
-): void;
-export declare function decodeLoadedFramework(
- buffer: ByteBuffer,
-): LoadedFramework;
-export declare function encodeLoadedRouteConfig(
- message: LoadedRouteConfig,
- bb: ByteBuffer,
-): void;
-export declare function decodeLoadedRouteConfig(
- buffer: ByteBuffer,
-): LoadedRouteConfig;
-export declare function encodeRouteConfig(
- message: RouteConfig,
- bb: ByteBuffer,
-): void;
+export declare function encodeLoadedEnvConfig(message: LoadedEnvConfig, bb: ByteBuffer): void;
+export declare function decodeLoadedEnvConfig(buffer: ByteBuffer): LoadedEnvConfig;
+export declare function encodeFrameworkConfig(message: FrameworkConfig, bb: ByteBuffer): void;
+export declare function decodeFrameworkConfig(buffer: ByteBuffer): FrameworkConfig;
+export declare function encodeFrameworkEntryPoint(message: FrameworkEntryPoint, bb: ByteBuffer): void;
+export declare function decodeFrameworkEntryPoint(buffer: ByteBuffer): FrameworkEntryPoint;
+export declare function encodeFrameworkEntryPointMap(message: FrameworkEntryPointMap, bb: ByteBuffer): void;
+export declare function decodeFrameworkEntryPointMap(buffer: ByteBuffer): FrameworkEntryPointMap;
+export declare function encodeFrameworkEntryPointMessage(message: FrameworkEntryPointMessage, bb: ByteBuffer): void;
+export declare function decodeFrameworkEntryPointMessage(buffer: ByteBuffer): FrameworkEntryPointMessage;
+export declare function encodeLoadedFramework(message: LoadedFramework, bb: ByteBuffer): void;
+export declare function decodeLoadedFramework(buffer: ByteBuffer): LoadedFramework;
+export declare function encodeLoadedRouteConfig(message: LoadedRouteConfig, bb: ByteBuffer): void;
+export declare function decodeLoadedRouteConfig(buffer: ByteBuffer): LoadedRouteConfig;
+export declare function encodeRouteConfig(message: RouteConfig, bb: ByteBuffer): void;
export declare function decodeRouteConfig(buffer: ByteBuffer): RouteConfig;
-export declare function encodeTransformOptions(
- message: TransformOptions,
- bb: ByteBuffer,
-): void;
-export declare function decodeTransformOptions(
- buffer: ByteBuffer,
-): TransformOptions;
-export declare function encodeFileHandle(
- message: FileHandle,
- bb: ByteBuffer,
-): void;
+export declare function encodeTransformOptions(message: TransformOptions, bb: ByteBuffer): void;
+export declare function decodeTransformOptions(buffer: ByteBuffer): TransformOptions;
+export declare function encodeFileHandle(message: FileHandle, bb: ByteBuffer): void;
export declare function decodeFileHandle(buffer: ByteBuffer): FileHandle;
-export declare function encodeTransform(
- message: Transform,
- bb: ByteBuffer,
-): void;
+export declare function encodeTransform(message: Transform, bb: ByteBuffer): void;
export declare function decodeTransform(buffer: ByteBuffer): Transform;
export declare function encodeScan(message: Scan, bb: ByteBuffer): void;
export declare function decodeScan(buffer: ByteBuffer): Scan;
-export declare function encodeScanResult(
- message: ScanResult,
- bb: ByteBuffer,
-): void;
+export declare function encodeScanResult(message: ScanResult, bb: ByteBuffer): void;
export declare function decodeScanResult(buffer: ByteBuffer): ScanResult;
-export declare function encodeScannedImport(
- message: ScannedImport,
- bb: ByteBuffer,
-): void;
+export declare function encodeScannedImport(message: ScannedImport, bb: ByteBuffer): void;
export declare function decodeScannedImport(buffer: ByteBuffer): ScannedImport;
-export declare function encodeOutputFile(
- message: OutputFile,
- bb: ByteBuffer,
-): void;
+export declare function encodeOutputFile(message: OutputFile, bb: ByteBuffer): void;
export declare function decodeOutputFile(buffer: ByteBuffer): OutputFile;
-export declare function encodeTransformResponse(
- message: TransformResponse,
- bb: ByteBuffer,
-): void;
-export declare function decodeTransformResponse(
- buffer: ByteBuffer,
-): TransformResponse;
+export declare function encodeTransformResponse(message: TransformResponse, bb: ByteBuffer): void;
+export declare function decodeTransformResponse(buffer: ByteBuffer): TransformResponse;
export declare function encodeLocation(message: Location, bb: ByteBuffer): void;
export declare function decodeLocation(buffer: ByteBuffer): Location;
-export declare function encodeMessageData(
- message: MessageData,
- bb: ByteBuffer,
-): void;
+export declare function encodeMessageData(message: MessageData, bb: ByteBuffer): void;
export declare function decodeMessageData(buffer: ByteBuffer): MessageData;
-export declare function encodeMessageMeta(
- message: MessageMeta,
- bb: ByteBuffer,
-): void;
+export declare function encodeMessageMeta(message: MessageMeta, bb: ByteBuffer): void;
export declare function decodeMessageMeta(buffer: ByteBuffer): MessageMeta;
export declare function encodeMessage(message: Message, bb: ByteBuffer): void;
export declare function decodeMessage(buffer: ByteBuffer): Message;
export declare function encodeLog(message: Log, bb: ByteBuffer): void;
export declare function decodeLog(buffer: ByteBuffer): Log;
-export declare function encodeWebsocketMessage(
- message: WebsocketMessage,
- bb: ByteBuffer,
-): void;
-export declare function decodeWebsocketMessage(
- buffer: ByteBuffer,
-): WebsocketMessage;
-export declare function encodeWebsocketMessageWelcome(
- message: WebsocketMessageWelcome,
- bb: ByteBuffer,
-): void;
-export declare function decodeWebsocketMessageWelcome(
- buffer: ByteBuffer,
-): WebsocketMessageWelcome;
+export declare function encodeWebsocketMessage(message: WebsocketMessage, bb: ByteBuffer): void;
+export declare function decodeWebsocketMessage(buffer: ByteBuffer): WebsocketMessage;
+export declare function encodeWebsocketMessageWelcome(message: WebsocketMessageWelcome, bb: ByteBuffer): void;
+export declare function decodeWebsocketMessageWelcome(buffer: ByteBuffer): WebsocketMessageWelcome;
export declare function encodeWebsocketMessageFileChangeNotification(
message: WebsocketMessageFileChangeNotification,
bb: ByteBuffer,
@@ -912,69 +774,26 @@ export declare function encodeWebsocketMessageFileChangeNotification(
export declare function decodeWebsocketMessageFileChangeNotification(
buffer: ByteBuffer,
): WebsocketMessageFileChangeNotification;
-export declare function encodeWebsocketCommand(
- message: WebsocketCommand,
- bb: ByteBuffer,
-): void;
-export declare function decodeWebsocketCommand(
- buffer: ByteBuffer,
-): WebsocketCommand;
-export declare function encodeWebsocketCommandBuild(
- message: WebsocketCommandBuild,
- bb: ByteBuffer,
-): void;
-export declare function decodeWebsocketCommandBuild(
- buffer: ByteBuffer,
-): WebsocketCommandBuild;
-export declare function encodeWebsocketCommandManifest(
- message: WebsocketCommandManifest,
- bb: ByteBuffer,
-): void;
-export declare function decodeWebsocketCommandManifest(
- buffer: ByteBuffer,
-): WebsocketCommandManifest;
-export declare function encodeWebsocketMessageBuildSuccess(
- message: WebsocketMessageBuildSuccess,
- bb: ByteBuffer,
-): void;
-export declare function decodeWebsocketMessageBuildSuccess(
- buffer: ByteBuffer,
-): WebsocketMessageBuildSuccess;
-export declare function encodeWebsocketMessageBuildFailure(
- message: WebsocketMessageBuildFailure,
- bb: ByteBuffer,
-): void;
-export declare function decodeWebsocketMessageBuildFailure(
- buffer: ByteBuffer,
-): WebsocketMessageBuildFailure;
+export declare function encodeWebsocketCommand(message: WebsocketCommand, bb: ByteBuffer): void;
+export declare function decodeWebsocketCommand(buffer: ByteBuffer): WebsocketCommand;
+export declare function encodeWebsocketCommandBuild(message: WebsocketCommandBuild, bb: ByteBuffer): void;
+export declare function decodeWebsocketCommandBuild(buffer: ByteBuffer): WebsocketCommandBuild;
+export declare function encodeWebsocketCommandManifest(message: WebsocketCommandManifest, bb: ByteBuffer): void;
+export declare function decodeWebsocketCommandManifest(buffer: ByteBuffer): WebsocketCommandManifest;
+export declare function encodeWebsocketMessageBuildSuccess(message: WebsocketMessageBuildSuccess, bb: ByteBuffer): void;
+export declare function decodeWebsocketMessageBuildSuccess(buffer: ByteBuffer): WebsocketMessageBuildSuccess;
+export declare function encodeWebsocketMessageBuildFailure(message: WebsocketMessageBuildFailure, bb: ByteBuffer): void;
+export declare function decodeWebsocketMessageBuildFailure(buffer: ByteBuffer): WebsocketMessageBuildFailure;
export declare function encodeWebsocketCommandBuildWithFilePath(
message: WebsocketCommandBuildWithFilePath,
bb: ByteBuffer,
): void;
-export declare function decodeWebsocketCommandBuildWithFilePath(
- buffer: ByteBuffer,
-): WebsocketCommandBuildWithFilePath;
-export declare function encodeWebsocketMessageResolveID(
- message: WebsocketMessageResolveID,
- bb: ByteBuffer,
-): void;
-export declare function decodeWebsocketMessageResolveID(
- buffer: ByteBuffer,
-): WebsocketMessageResolveID;
-export declare function encodeNPMRegistry(
- message: NPMRegistry,
- bb: ByteBuffer,
-): void;
+export declare function decodeWebsocketCommandBuildWithFilePath(buffer: ByteBuffer): WebsocketCommandBuildWithFilePath;
+export declare function encodeWebsocketMessageResolveID(message: WebsocketMessageResolveID, bb: ByteBuffer): void;
+export declare function decodeWebsocketMessageResolveID(buffer: ByteBuffer): WebsocketMessageResolveID;
+export declare function encodeNPMRegistry(message: NPMRegistry, bb: ByteBuffer): void;
export declare function decodeNPMRegistry(buffer: ByteBuffer): NPMRegistry;
-export declare function encodeNPMRegistryMap(
- message: NPMRegistryMap,
- bb: ByteBuffer,
-): void;
-export declare function decodeNPMRegistryMap(
- buffer: ByteBuffer,
-): NPMRegistryMap;
-export declare function encodeBunInstall(
- message: BunInstall,
- bb: ByteBuffer,
-): void;
+export declare function encodeNPMRegistryMap(message: NPMRegistryMap, bb: ByteBuffer): void;
+export declare function decodeNPMRegistryMap(buffer: ByteBuffer): NPMRegistryMap;
+export declare function encodeBunInstall(message: BunInstall, bb: ByteBuffer): void;
export declare function decodeBunInstall(buffer: ByteBuffer): BunInstall;
diff --git a/src/api/demo/schema.js b/src/api/demo/schema.js
index 2c31d9512..7bdd13b65 100644
--- a/src/api/demo/schema.js
+++ b/src/api/demo/schema.js
@@ -118,12 +118,7 @@ function encodeStackFrame(message, bb) {
var value = message["scope"];
if (value != null) {
var encoded = StackFrameScope[value];
- if (encoded === void 0)
- throw new Error(
- "Invalid value " +
- JSON.stringify(value) +
- ' for enum "StackFrameScope"',
- );
+ if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "StackFrameScope"');
bb.writeByte(encoded);
} else {
throw new Error('Missing required field "scope"');
@@ -500,10 +495,7 @@ function encodeFallbackMessageContainer(message, bb) {
if (value != null) {
bb.writeByte(3);
var encoded = FallbackStep[value];
- if (encoded === void 0)
- throw new Error(
- "Invalid value " + JSON.stringify(value) + ' for enum "FallbackStep"',
- );
+ if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "FallbackStep"');
bb.writeByte(encoded);
}
@@ -612,10 +604,7 @@ function encodeJSX(message, bb) {
var value = message["runtime"];
if (value != null) {
var encoded = JSXRuntime[value];
- if (encoded === void 0)
- throw new Error(
- "Invalid value " + JSON.stringify(value) + ' for enum "JSXRuntime"',
- );
+ if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "JSXRuntime"');
bb.writeByte(encoded);
} else {
throw new Error('Missing required field "runtime"');
@@ -775,12 +764,10 @@ function decodeJavascriptBundle(bb) {
var length = bb.readVarUint();
var values = (result["modules"] = Array(length));
- for (var i = 0; i < length; i++)
- values[i] = decodeJavascriptBundledModule(bb);
+ for (var i = 0; i < length; i++) values[i] = decodeJavascriptBundledModule(bb);
var length = bb.readVarUint();
var values = (result["packages"] = Array(length));
- for (var i = 0; i < length; i++)
- values[i] = decodeJavascriptBundledPackage(bb);
+ for (var i = 0; i < length; i++) values[i] = decodeJavascriptBundledPackage(bb);
result["etag"] = bb.readByteArray();
result["generated_at"] = bb.readUint32();
result["app_package_json_dependencies_hash"] = bb.readByteArray();
@@ -834,9 +821,7 @@ function encodeJavascriptBundle(message, bb) {
if (value != null) {
bb.writeByteArray(value);
} else {
- throw new Error(
- 'Missing required field "app_package_json_dependencies_hash"',
- );
+ throw new Error('Missing required field "app_package_json_dependencies_hash"');
}
var value = message["import_from_name"];
@@ -958,12 +943,7 @@ function encodeModuleImportRecord(message, bb) {
var value = message["kind"];
if (value != null) {
var encoded = ModuleImportType[value];
- if (encoded === void 0)
- throw new Error(
- "Invalid value " +
- JSON.stringify(value) +
- ' for enum "ModuleImportType"',
- );
+ if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "ModuleImportType"');
bb.writeByte(encoded);
} else {
throw new Error('Missing required field "kind"');
@@ -1090,10 +1070,7 @@ function encodeLoaderMap(message, bb) {
for (var i = 0; i < n; i++) {
value = values[i];
var encoded = Loader[value];
- if (encoded === void 0)
- throw new Error(
- "Invalid value " + JSON.stringify(value) + ' for enum "Loader"',
- );
+ if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "Loader"');
bb.writeByte(encoded);
}
} else {
@@ -1167,10 +1144,7 @@ function encodeLoadedEnvConfig(message, bb) {
var value = message["dotenv"];
if (value != null) {
var encoded = DotEnvBehavior[value];
- if (encoded === void 0)
- throw new Error(
- "Invalid value " + JSON.stringify(value) + ' for enum "DotEnvBehavior"',
- );
+ if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "DotEnvBehavior"');
bb.writeVarUint(encoded);
} else {
throw new Error('Missing required field "dotenv"');
@@ -1272,12 +1246,7 @@ function encodeFrameworkConfig(message, bb) {
if (value != null) {
bb.writeByte(6);
var encoded = CSSInJSBehavior[value];
- if (encoded === void 0)
- throw new Error(
- "Invalid value " +
- JSON.stringify(value) +
- ' for enum "CSSInJSBehavior"',
- );
+ if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "CSSInJSBehavior"');
bb.writeByte(encoded);
}
@@ -1309,11 +1278,7 @@ function encodeFrameworkEntryPoint(message, bb) {
if (value != null) {
var encoded = FrameworkEntryPointType[value];
if (encoded === void 0)
- throw new Error(
- "Invalid value " +
- JSON.stringify(value) +
- ' for enum "FrameworkEntryPointType"',
- );
+ throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "FrameworkEntryPointType"');
bb.writeByte(encoded);
} else {
throw new Error('Missing required field "kind"');
@@ -1462,12 +1427,7 @@ function encodeLoadedFramework(message, bb) {
var value = message["client_css_in_js"];
if (value != null) {
var encoded = CSSInJSBehavior[value];
- if (encoded === void 0)
- throw new Error(
- "Invalid value " +
- JSON.stringify(value) +
- ' for enum "CSSInJSBehavior"',
- );
+ if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "CSSInJSBehavior"');
bb.writeByte(encoded);
} else {
throw new Error('Missing required field "client_css_in_js"');
@@ -1747,10 +1707,7 @@ function encodeTransformOptions(message, bb) {
if (value != null) {
bb.writeByte(3);
var encoded = ResolveMode[value];
- if (encoded === void 0)
- throw new Error(
- "Invalid value " + JSON.stringify(value) + ' for enum "ResolveMode"',
- );
+ if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "ResolveMode"');
bb.writeByte(encoded);
}
@@ -1848,10 +1805,7 @@ function encodeTransformOptions(message, bb) {
if (value != null) {
bb.writeByte(15);
var encoded = Platform[value];
- if (encoded === void 0)
- throw new Error(
- "Invalid value " + JSON.stringify(value) + ' for enum "Platform"',
- );
+ if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "Platform"');
bb.writeByte(encoded);
}
@@ -1925,10 +1879,7 @@ function encodeTransformOptions(message, bb) {
if (value != null) {
bb.writeByte(26);
var encoded = MessageLevel[value];
- if (encoded === void 0)
- throw new Error(
- "Invalid value " + JSON.stringify(value) + ' for enum "MessageLevel"',
- );
+ if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "MessageLevel"');
bb.writeVarUint(encoded);
}
bb.writeByte(0);
@@ -2023,10 +1974,7 @@ function encodeTransform(message, bb) {
if (value != null) {
bb.writeByte(4);
var encoded = Loader[value];
- if (encoded === void 0)
- throw new Error(
- "Invalid value " + JSON.stringify(value) + ' for enum "Loader"',
- );
+ if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "Loader"');
bb.writeByte(encoded);
}
@@ -2081,10 +2029,7 @@ function encodeScan(message, bb) {
if (value != null) {
bb.writeByte(3);
var encoded = Loader[value];
- if (encoded === void 0)
- throw new Error(
- "Invalid value " + JSON.stringify(value) + ' for enum "Loader"',
- );
+ if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "Loader"');
bb.writeByte(encoded);
}
bb.writeByte(0);
@@ -2149,10 +2094,7 @@ function encodeScannedImport(message, bb) {
var value = message["kind"];
if (value != null) {
var encoded = ImportKind[value];
- if (encoded === void 0)
- throw new Error(
- "Invalid value " + JSON.stringify(value) + ' for enum "ImportKind"',
- );
+ if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "ImportKind"');
bb.writeByte(encoded);
} else {
throw new Error('Missing required field "kind"');
@@ -2249,11 +2191,7 @@ function encodeTransformResponse(message, bb) {
if (value != null) {
var encoded = TransformResponseStatus[value];
if (encoded === void 0)
- throw new Error(
- "Invalid value " +
- JSON.stringify(value) +
- ' for enum "TransformResponseStatus"',
- );
+ throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "TransformResponseStatus"');
bb.writeVarUint(encoded);
} else {
throw new Error('Missing required field "status"');
@@ -2464,10 +2402,7 @@ function encodeMessage(message, bb) {
var value = message["level"];
if (value != null) {
var encoded = MessageLevel[value];
- if (encoded === void 0)
- throw new Error(
- "Invalid value " + JSON.stringify(value) + ' for enum "MessageLevel"',
- );
+ if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "MessageLevel"');
bb.writeVarUint(encoded);
} else {
throw new Error('Missing required field "level"');
@@ -2629,11 +2564,7 @@ function encodeWebsocketMessage(message, bb) {
if (value != null) {
var encoded = WebsocketMessageKind[value];
if (encoded === void 0)
- throw new Error(
- "Invalid value " +
- JSON.stringify(value) +
- ' for enum "WebsocketMessageKind"',
- );
+ throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "WebsocketMessageKind"');
bb.writeByte(encoded);
} else {
throw new Error('Missing required field "kind"');
@@ -2660,10 +2591,7 @@ function encodeWebsocketMessageWelcome(message, bb) {
var value = message["javascriptReloader"];
if (value != null) {
var encoded = Reloader[value];
- if (encoded === void 0)
- throw new Error(
- "Invalid value " + JSON.stringify(value) + ' for enum "Reloader"',
- );
+ if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "Reloader"');
bb.writeByte(encoded);
} else {
throw new Error('Missing required field "javascriptReloader"');
@@ -2696,10 +2624,7 @@ function encodeWebsocketMessageFileChangeNotification(message, bb) {
var value = message["loader"];
if (value != null) {
var encoded = Loader[value];
- if (encoded === void 0)
- throw new Error(
- "Invalid value " + JSON.stringify(value) + ' for enum "Loader"',
- );
+ if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "Loader"');
bb.writeByte(encoded);
} else {
throw new Error('Missing required field "loader"');
@@ -2719,11 +2644,7 @@ function encodeWebsocketCommand(message, bb) {
if (value != null) {
var encoded = WebsocketCommandKind[value];
if (encoded === void 0)
- throw new Error(
- "Invalid value " +
- JSON.stringify(value) +
- ' for enum "WebsocketCommandKind"',
- );
+ throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "WebsocketCommandKind"');
bb.writeByte(encoded);
} else {
throw new Error('Missing required field "kind"');
@@ -2798,10 +2719,7 @@ function encodeWebsocketMessageBuildSuccess(message, bb) {
var value = message["loader"];
if (value != null) {
var encoded = Loader[value];
- if (encoded === void 0)
- throw new Error(
- "Invalid value " + JSON.stringify(value) + ' for enum "Loader"',
- );
+ if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "Loader"');
bb.writeByte(encoded);
} else {
throw new Error('Missing required field "loader"');
@@ -2851,10 +2769,7 @@ function encodeWebsocketMessageBuildFailure(message, bb) {
var value = message["loader"];
if (value != null) {
var encoded = Loader[value];
- if (encoded === void 0)
- throw new Error(
- "Invalid value " + JSON.stringify(value) + ' for enum "Loader"',
- );
+ if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "Loader"');
bb.writeByte(encoded);
} else {
throw new Error('Missing required field "loader"');
diff --git a/src/bun.js/api/server.zig b/src/bun.js/api/server.zig
index 0ecd684bd..bb2f251a2 100644
--- a/src/bun.js/api/server.zig
+++ b/src/bun.js/api/server.zig
@@ -1877,7 +1877,7 @@ fn NewRequestContext(comptime ssl_enabled: bool, comptime debug_mode: bool, comp
resp.body.value = .{ .Used = {} };
}
}
-
+
streamLog("onResolve({any})", .{wrote_anything});
//aborted so call finalizeForAbort
diff --git a/src/bun.js/node-dns.exports.js b/src/bun.js/node-dns.exports.js
index 025728eb6..f7516923a 100644
--- a/src/bun.js/node-dns.exports.js
+++ b/src/bun.js/node-dns.exports.js
@@ -169,9 +169,9 @@ function lookupService(address, port, callback) {
}
var InternalResolver = class Resolver {
- constructor(options) { }
+ constructor(options) {}
- cancel() { }
+ cancel() {}
getServers() {
return [];
@@ -192,11 +192,7 @@ var InternalResolver = class Resolver {
switch (rrtype?.toLowerCase()) {
case "a":
case "aaaa":
- callback(
- null,
- hostname,
- results.map(mapResolveX),
- );
+ callback(null, hostname, results.map(mapResolveX));
break;
default:
callback(null, results);
@@ -221,10 +217,7 @@ var InternalResolver = class Resolver {
dns.lookup(hostname, { family: 4 }).then(
addresses => {
- callback(
- null,
- options?.ttl ? addresses : addresses.map(mapResolveX),
- );
+ callback(null, options?.ttl ? addresses : addresses.map(mapResolveX));
},
error => {
callback(error);
@@ -244,10 +237,7 @@ var InternalResolver = class Resolver {
dns.lookup(hostname, { family: 6 }).then(
addresses => {
- callback(
- null,
- options?.ttl ? addresses : addresses.map(({ address }) => address),
- );
+ callback(null, options?.ttl ? addresses : addresses.map(({ address }) => address));
},
error => {
callback(error);
@@ -397,7 +387,7 @@ var InternalResolver = class Resolver {
callback(null, []);
}
- setServers(servers) { }
+ setServers(servers) {}
};
function resolve(hostname, rrtype, callback) {
@@ -454,8 +444,8 @@ export var {
resolveTxt,
} = InternalResolver.prototype;
-function setDefaultResultOrder() { }
-function setServers() { }
+function setDefaultResultOrder() {}
+function setServers() {}
const promisifyLookup = res => {
res.sort((a, b) => a.family - b.family);
@@ -467,8 +457,7 @@ const mapResolveX = a => a.address;
const promisifyResolveX = res => {
return res?.map(mapResolveX);
-}
-
+};
// promisified versions
export const promises = {
@@ -497,14 +486,14 @@ export const promises = {
if (options?.ttl) {
return dns.lookup(hostname, { family: 4 });
}
- return dns.lookup(hostname, { family: 4 }).then(promisifyResolveX)
+ return dns.lookup(hostname, { family: 4 }).then(promisifyResolveX);
},
resolve6(hostname, options) {
if (options?.ttl) {
return dns.lookup(hostname, { family: 6 });
}
- return dns.lookup(hostname, { family: 6 }).then(promisifyResolveX)
+ return dns.lookup(hostname, { family: 6 }).then(promisifyResolveX);
},
resolveSrv(hostname) {
@@ -537,9 +526,9 @@ export const promises = {
},
Resolver: class Resolver {
- constructor(options) { }
+ constructor(options) {}
- cancel() { }
+ cancel() {}
getServers() {
return [];
@@ -562,14 +551,14 @@ export const promises = {
if (options?.ttl) {
return dns.lookup(hostname, { family: 4 });
}
- return dns.lookup(hostname, { family: 4 }).then(promisifyResolveX)
+ return dns.lookup(hostname, { family: 4 }).then(promisifyResolveX);
}
resolve6(hostname, options) {
if (options?.ttl) {
return dns.lookup(hostname, { family: 6 });
}
- return dns.lookup(hostname, { family: 6 }).then(promisifyResolveX)
+ return dns.lookup(hostname, { family: 6 }).then(promisifyResolveX);
}
resolveAny(hostname) {
@@ -616,7 +605,7 @@ export const promises = {
return Promise.resolve([]);
}
- setServers(servers) { }
+ setServers(servers) {}
},
};
for (const key of ["resolveAny", "reverse"]) {
diff --git a/src/bun.js/node-tls.exports.js b/src/bun.js/node-tls.exports.js
index 74a64cca4..46301ae77 100644
--- a/src/bun.js/node-tls.exports.js
+++ b/src/bun.js/node-tls.exports.js
@@ -154,4 +154,5 @@ var exports = {
};
export default exports;
+
export { createSecureContext, parseCertString, TLSSocket, SecureContext };
diff --git a/src/bun.js/wasi-runner.js b/src/bun.js/wasi-runner.js
index 24ff0a678..6a89510b1 100644
--- a/src/bun.js/wasi-runner.js
+++ b/src/bun.js/wasi-runner.js
@@ -3,21 +3,14 @@
const filePath = process.argv.at(1);
if (!filePath) {
- var err = new Error(
- "To run a wasm file with Bun, the first argument must be a path to a .wasm file",
- );
+ var err = new Error("To run a wasm file with Bun, the first argument must be a path to a .wasm file");
err.name = "WasmFileNotFound";
throw err;
}
// The module specifier is the resolved path to the wasm file
-var {
- WASM_CWD = process.cwd(),
- WASM_ROOT_DIR = "/",
- WASM_ENV_STR = undefined,
- WASM_USE_ASYNC_INIT = "",
-} = process.env;
+var { WASM_CWD = process.cwd(), WASM_ROOT_DIR = "/", WASM_ENV_STR = undefined, WASM_USE_ASYNC_INIT = "" } = process.env;
var env = process.env;
if (WASM_ENV_STR?.length) {
diff --git a/src/darwin_c.zig b/src/darwin_c.zig
index d62e665b9..313ecc368 100644
--- a/src/darwin_c.zig
+++ b/src/darwin_c.zig
@@ -559,13 +559,11 @@ pub const CPU_STATE_MAX = 4;
pub const processor_cpu_load_info = extern struct {
cpu_ticks: [CPU_STATE_MAX]c_uint,
};
-pub const PROCESSOR_CPU_LOAD_INFO_COUNT = @as(std.c.mach_msg_type_number_t,
- @sizeOf(processor_cpu_load_info)/@sizeOf(std.c.natural_t));
+pub const PROCESSOR_CPU_LOAD_INFO_COUNT = @as(std.c.mach_msg_type_number_t, @sizeOf(processor_cpu_load_info) / @sizeOf(std.c.natural_t));
pub const processor_info_array_t = [*]c_int;
pub const PROCESSOR_INFO_MAX = 1024;
-pub extern fn host_processor_info(host: std.c.host_t , flavor: processor_flavor_t , out_processor_count: *std.c.natural_t , out_processor_info: *processor_info_array_t, out_processor_infoCnt: *std.c.mach_msg_type_number_t) std.c.E;
-
+pub extern fn host_processor_info(host: std.c.host_t, flavor: processor_flavor_t, out_processor_count: *std.c.natural_t, out_processor_info: *processor_info_array_t, out_processor_infoCnt: *std.c.mach_msg_type_number_t) std.c.E;
pub extern fn getuid(...) std.os.uid_t;
pub extern fn getgid(...) std.os.gid_t;
@@ -754,30 +752,32 @@ pub extern fn removefileat(fd: c_int, path: [*c]const u8, state: ?*removefile_st
// As of Zig v0.11.0-dev.1393+38eebf3c4, ifaddrs.h is not included in the headers
pub const ifaddrs = extern struct {
- ifa_next: ?*ifaddrs,
- ifa_name: [*:0]u8,
- ifa_flags: c_uint,
- ifa_addr: ?*std.os.sockaddr,
- ifa_netmask: ?*std.os.sockaddr,
- ifa_dstaddr: ?*std.os.sockaddr,
- ifa_data: *anyopaque,
+ ifa_next: ?*ifaddrs,
+ ifa_name: [*:0]u8,
+ ifa_flags: c_uint,
+ ifa_addr: ?*std.os.sockaddr,
+ ifa_netmask: ?*std.os.sockaddr,
+ ifa_dstaddr: ?*std.os.sockaddr,
+ ifa_data: *anyopaque,
};
pub extern fn getifaddrs(*?*ifaddrs) c_int;
pub extern fn freeifaddrs(?*ifaddrs) void;
-const net_if_h = @cImport({ @cInclude("net/if.h"); });
+const net_if_h = @cImport({
+ @cInclude("net/if.h");
+});
pub const IFF_RUNNING = net_if_h.IFF_RUNNING;
pub const IFF_UP = net_if_h.IFF_UP;
pub const IFF_LOOPBACK = net_if_h.IFF_LOOPBACK;
pub const sockaddr_dl = extern struct {
- sdl_len: u8, // Total length of sockaddr */
- sdl_family: u8, // AF_LINK */
- sdl_index: u16, // if != 0, system given index for interface */
- sdl_type: u8, // interface type */
- sdl_nlen: u8, // interface name length, no trailing 0 reqd. */
- sdl_alen: u8, // link level address length */
- sdl_slen: u8, // link layer selector length */
- sdl_data: [12]u8, // minimum work area, can be larger; contains both if name and ll address */
+ sdl_len: u8, // Total length of sockaddr */
+ sdl_family: u8, // AF_LINK */
+ sdl_index: u16, // if != 0, system given index for interface */
+ sdl_type: u8, // interface type */
+ sdl_nlen: u8, // interface name length, no trailing 0 reqd. */
+ sdl_alen: u8, // link level address length */
+ sdl_slen: u8, // link layer selector length */
+ sdl_data: [12]u8, // minimum work area, can be larger; contains both if name and ll address */
//#ifndef __APPLE__
// /* For TokenRing */
// u_short sdl_rcf; /* source routing control */
diff --git a/src/deps/uws.zig b/src/deps/uws.zig
index 58a5b1b93..5ebbfcc51 100644
--- a/src/deps/uws.zig
+++ b/src/deps/uws.zig
@@ -319,9 +319,7 @@ pub fn NewSocketHandler(comptime ssl: bool) type {
}
pub fn from(socket: *Socket) ThisSocket {
- return ThisSocket {
- .socket = socket
- };
+ return ThisSocket{ .socket = socket };
}
pub fn adopt(
diff --git a/src/fallback.ts b/src/fallback.ts
index 964ed4e92..1893fde36 100644
--- a/src/fallback.ts
+++ b/src/fallback.ts
@@ -1,15 +1,10 @@
declare var document: any;
import { ByteBuffer } from "peechy";
import { FallbackStep } from "./api/schema";
-import {
- decodeFallbackMessageContainer,
- FallbackMessageContainer,
-} from "./api/schema";
+import { decodeFallbackMessageContainer, FallbackMessageContainer } from "./api/schema";
function getFallbackInfo(): FallbackMessageContainer {
- const binary_string = globalThis.atob(
- document.getElementById("__bunfallback").textContent.trim(),
- );
+ const binary_string = globalThis.atob(document.getElementById("__bunfallback").textContent.trim());
var len = binary_string.length;
var bytes = new Uint8Array(len);
diff --git a/src/http_client_async.zig b/src/http_client_async.zig
index 0f6045bbb..945406448 100644
--- a/src/http_client_async.zig
+++ b/src/http_client_async.zig
@@ -1029,13 +1029,13 @@ aborted: ?*std.atomic.Atomic(bool) = null,
async_http_id: u32 = 0,
pub fn init(allocator: std.mem.Allocator, method: Method, url: URL, header_entries: Headers.Entries, header_buf: string, signal: ?*std.atomic.Atomic(bool)) HTTPClient {
- return HTTPClient {
- .allocator = allocator,
- .method = method,
- .url = url,
- .header_entries = header_entries,
- .header_buf = header_buf,
- .aborted = signal,
+ return HTTPClient{
+ .allocator = allocator,
+ .method = method,
+ .url = url,
+ .header_entries = header_entries,
+ .header_buf = header_buf,
+ .aborted = signal,
};
}
diff --git a/src/linux_c.zig b/src/linux_c.zig
index ae9300477..129161579 100644
--- a/src/linux_c.zig
+++ b/src/linux_c.zig
@@ -481,10 +481,9 @@ pub fn posix_spawn_file_actions_addchdir_np(actions: *posix_spawn_file_actions_t
pub extern fn vmsplice(fd: c_int, iovec: [*]const std.os.iovec, iovec_count: usize, flags: u32) isize;
-
const net_c = @cImport({
@cInclude("ifaddrs.h"); // getifaddrs, freeifaddrs
- @cInclude("net/if.h"); // IFF_RUNNING, IFF_UP
+ @cInclude("net/if.h"); // IFF_RUNNING, IFF_UP
});
pub const ifaddrs = net_c.ifaddrs;
pub const getifaddrs = net_c.getifaddrs;
diff --git a/src/node-fallbacks/@vercel_fetch.js b/src/node-fallbacks/@vercel_fetch.js
index f75604b2b..a8de45222 100644
--- a/src/node-fallbacks/@vercel_fetch.js
+++ b/src/node-fallbacks/@vercel_fetch.js
@@ -1,15 +1,11 @@
// This is just a no-op. Intent is to prevent importing a bunch of stuff that isn't relevant.
-module.exports = (
- wrapper = "Bun" in globalThis ? Bun.fetch : globalThis.fetch,
-) => {
+module.exports = (wrapper = "Bun" in globalThis ? Bun.fetch : globalThis.fetch) => {
async function vercelFetch(url, opts = {}) {
// Convert Object bodies to JSON if they are JS objects
if (
opts.body &&
typeof opts.body === "object" &&
- (!("buffer" in opts.body) ||
- typeof opts.body.buffer !== "object" ||
- !(opts.body.buffer instanceof ArrayBuffer))
+ (!("buffer" in opts.body) || typeof opts.body.buffer !== "object" || !(opts.body.buffer instanceof ArrayBuffer))
) {
opts.body = JSON.stringify(opts.body);
// Content length will automatically be set
diff --git a/src/node-fallbacks/crypto.js b/src/node-fallbacks/crypto.js
index 4a0e4c735..8c83b6c87 100644
--- a/src/node-fallbacks/crypto.js
+++ b/src/node-fallbacks/crypto.js
@@ -3,7 +3,7 @@ export * from "crypto-browserify";
export var DEFAULT_ENCODING = "buffer";
// we deliberately reference crypto. directly here because we want to preserve the This binding
-export const getRandomValues = (array) => {
+export const getRandomValues = array => {
return crypto.getRandomValues(array);
};
@@ -16,10 +16,7 @@ export const timingSafeEqual =
? (a, b) => {
const { byteLength: byteLengthA } = a;
const { byteLength: byteLengthB } = b;
- if (
- typeof byteLengthA !== "number" ||
- typeof byteLengthB !== "number"
- ) {
+ if (typeof byteLengthA !== "number" || typeof byteLengthB !== "number") {
throw new TypeError("Input must be an array buffer view");
}
@@ -37,9 +34,7 @@ export const scryptSync =
"scryptSync" in crypto
? (password, salt, keylen, options) => {
const res = crypto.scryptSync(password, salt, keylen, options);
- return DEFAULT_ENCODING !== "buffer"
- ? new Buffer(res).toString(DEFAULT_ENCODING)
- : new Buffer(res);
+ return DEFAULT_ENCODING !== "buffer" ? new Buffer(res).toString(DEFAULT_ENCODING) : new Buffer(res);
}
: undefined;
@@ -62,9 +57,7 @@ export const scrypt =
process.nextTick(
callback,
null,
- DEFAULT_ENCODING !== "buffer"
- ? new Buffer(result).toString(DEFAULT_ENCODING)
- : new Buffer(result),
+ DEFAULT_ENCODING !== "buffer" ? new Buffer(result).toString(DEFAULT_ENCODING) : new Buffer(result),
);
} catch (err) {
throw err;
diff --git a/src/node-fallbacks/events.js b/src/node-fallbacks/events.js
index 738bf1f15..70f47eb53 100644
--- a/src/node-fallbacks/events.js
+++ b/src/node-fallbacks/events.js
@@ -34,9 +34,7 @@ if (R && typeof R.ownKeys === "function") {
ReflectOwnKeys = R.ownKeys;
} else if (Object.getOwnPropertySymbols) {
ReflectOwnKeys = function ReflectOwnKeys(target) {
- return Object.getOwnPropertyNames(target).concat(
- Object.getOwnPropertySymbols(target),
- );
+ return Object.getOwnPropertyNames(target).concat(Object.getOwnPropertySymbols(target));
};
} else {
ReflectOwnKeys = function ReflectOwnKeys(target) {
@@ -71,10 +69,7 @@ var defaultMaxListeners = 10;
function checkListener(listener) {
if (typeof listener !== "function") {
- throw new TypeError(
- 'The "listener" argument must be of type Function. Received type ' +
- typeof listener,
- );
+ throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
}
}
@@ -86,9 +81,7 @@ Object.defineProperty(EventEmitter, "defaultMaxListeners", {
set: function (arg) {
if (typeof arg !== "number" || arg < 0 || NumberIsNaN(arg)) {
throw new RangeError(
- 'The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' +
- arg +
- ".",
+ 'The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + ".",
);
}
defaultMaxListeners = arg;
@@ -96,10 +89,7 @@ Object.defineProperty(EventEmitter, "defaultMaxListeners", {
});
EventEmitter.init = function () {
- if (
- this._events === undefined ||
- this._events === Object.getPrototypeOf(this)._events
- ) {
+ if (this._events === undefined || this._events === Object.getPrototypeOf(this)._events) {
this._events = Object.create(null);
this._eventsCount = 0;
}
@@ -111,11 +101,7 @@ EventEmitter.init = function () {
// that to be increased. Set to zero for unlimited.
EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
if (typeof n !== "number" || n < 0 || NumberIsNaN(n)) {
- throw new RangeError(
- 'The value of "n" is out of range. It must be a non-negative number. Received ' +
- n +
- ".",
- );
+ throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + ".");
}
this._maxListeners = n;
return this;
@@ -149,9 +135,7 @@ EventEmitter.prototype.emit = function emit(type) {
throw er; // Unhandled 'error' event
}
// At least give some kind of context to the user
- var err = new Error(
- "Unhandled error." + (er ? " (" + er.message + ")" : ""),
- );
+ var err = new Error("Unhandled error." + (er ? " (" + er.message + ")" : ""));
err.context = er;
throw err; // Unhandled 'error' event
}
@@ -186,11 +170,7 @@ function _addListener(target, type, listener, prepend) {
// To avoid recursion in the case that type === "newListener"! Before
// adding it to the listeners, first emit "newListener".
if (events.newListener !== undefined) {
- target.emit(
- "newListener",
- type,
- listener.listener ? listener.listener : listener,
- );
+ target.emit("newListener", type, listener.listener ? listener.listener : listener);
// Re-assign `events` because a newListener handler could have caused the
// this._events to be assigned to a new object
@@ -206,9 +186,7 @@ function _addListener(target, type, listener, prepend) {
} else {
if (typeof existing === "function") {
// Adding the second element, need to change to array.
- existing = events[type] = prepend
- ? [listener, existing]
- : [existing, listener];
+ existing = events[type] = prepend ? [listener, existing] : [existing, listener];
// If we've already got an array, just append.
} else if (prepend) {
existing.unshift(listener);
@@ -248,10 +226,7 @@ EventEmitter.prototype.addListener = function addListener(type, listener) {
EventEmitter.prototype.on = EventEmitter.prototype.addListener;
-EventEmitter.prototype.prependListener = function prependListener(
- type,
- listener,
-) {
+EventEmitter.prototype.prependListener = function prependListener(type, listener) {
return _addListener(this, type, listener, true);
};
@@ -284,20 +259,14 @@ EventEmitter.prototype.once = function once(type, listener) {
return this;
};
-EventEmitter.prototype.prependOnceListener = function prependOnceListener(
- type,
- listener,
-) {
+EventEmitter.prototype.prependOnceListener = function prependOnceListener(type, listener) {
checkListener(listener);
this.prependListener(type, _onceWrap(this, type, listener));
return this;
};
// Emits a 'removeListener' event if and only if the listener was removed.
-EventEmitter.prototype.removeListener = function removeListener(
- type,
- listener,
-) {
+EventEmitter.prototype.removeListener = function removeListener(type, listener) {
var list, events, position, i, originalListener;
checkListener(listener);
@@ -312,8 +281,7 @@ EventEmitter.prototype.removeListener = function removeListener(
if (--this._eventsCount === 0) this._events = Object.create(null);
else {
delete events[type];
- if (events.removeListener)
- this.emit("removeListener", type, list.listener || listener);
+ if (events.removeListener) this.emit("removeListener", type, list.listener || listener);
}
} else if (typeof list !== "function") {
position = -1;
@@ -335,8 +303,7 @@ EventEmitter.prototype.removeListener = function removeListener(
if (list.length === 1) events[type] = list[0];
- if (events.removeListener !== undefined)
- this.emit("removeListener", type, originalListener || listener);
+ if (events.removeListener !== undefined) this.emit("removeListener", type, originalListener || listener);
}
return this;
@@ -399,12 +366,9 @@ function _listeners(target, type, unwrap) {
var evlistener = events[type];
if (evlistener === undefined) return [];
- if (typeof evlistener === "function")
- return unwrap ? [evlistener.listener || evlistener] : [evlistener];
+ if (typeof evlistener === "function") return unwrap ? [evlistener.listener || evlistener] : [evlistener];
- return unwrap
- ? unwrapListeners(evlistener)
- : arrayClone(evlistener, evlistener.length);
+ return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
}
EventEmitter.prototype.listeners = function listeners(type) {
@@ -509,10 +473,7 @@ function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
listener(arg);
});
} else {
- throw new TypeError(
- 'The "emitter" argument must be of type EventEmitter. Received type ' +
- typeof emitter,
- );
+ throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter);
}
}
diff --git a/src/node-fallbacks/url.js b/src/node-fallbacks/url.js
index 10f1b889a..81c78001d 100644
--- a/src/node-fallbacks/url.js
+++ b/src/node-fallbacks/url.js
@@ -203,10 +203,7 @@ Url.prototype.parse = function (url, parseQueryString, slashesDenoteHost) {
}
}
- if (
- !hostlessProtocol[proto] &&
- (slashes || (proto && !slashedProtocol[proto]))
- ) {
+ if (!hostlessProtocol[proto] && (slashes || (proto && !slashedProtocol[proto]))) {
// there's a hostname.
// the first instance of /, ?, ;, or # ends the host.
//
@@ -270,9 +267,7 @@ Url.prototype.parse = function (url, parseQueryString, slashesDenoteHost) {
// if hostname begins with [ and ends with ]
// assume that it's an IPv6 address.
- var ipv6Hostname =
- this.hostname[0] === "[" &&
- this.hostname[this.hostname.length - 1] === "]";
+ var ipv6Hostname = this.hostname[0] === "[" && this.hostname[this.hostname.length - 1] === "]";
// validate a little.
if (!ipv6Hostname) {
@@ -423,21 +418,13 @@ Url.prototype.format = function () {
if (this.host) {
host = auth + this.host;
} else if (this.hostname) {
- host =
- auth +
- (this.hostname.indexOf(":") === -1
- ? this.hostname
- : "[" + this.hostname + "]");
+ host = auth + (this.hostname.indexOf(":") === -1 ? this.hostname : "[" + this.hostname + "]");
if (this.port) {
host += ":" + this.port;
}
}
- if (
- this.query &&
- util_isObject(this.query) &&
- Object.keys(this.query).length
- ) {
+ if (this.query && util_isObject(this.query) && Object.keys(this.query).length) {
query = querystring.stringify(this.query);
}
@@ -447,10 +434,7 @@ Url.prototype.format = function () {
// only the slashedProtocols get the //. Not mailto:, xmpp:, etc.
// unless they had them to begin with.
- if (
- this.slashes ||
- ((!protocol || slashedProtocol[protocol]) && host !== false)
- ) {
+ if (this.slashes || ((!protocol || slashedProtocol[protocol]) && host !== false)) {
host = "//" + (host || "");
if (pathname && pathname.charAt(0) !== "/") pathname = "/" + pathname;
} else if (!host) {
@@ -515,11 +499,7 @@ Url.prototype.resolveObject = function (relative) {
}
//urlParse appends trailing / to urls like http://www.example.com
- if (
- slashedProtocol[result.protocol] &&
- result.hostname &&
- !result.pathname
- ) {
+ if (slashedProtocol[result.protocol] && result.hostname && !result.pathname) {
result.path = result.pathname = "/";
}
@@ -576,9 +556,7 @@ Url.prototype.resolveObject = function (relative) {
}
var isSourceAbs = result.pathname && result.pathname.charAt(0) === "/",
- isRelAbs =
- relative.host ||
- (relative.pathname && relative.pathname.charAt(0) === "/"),
+ isRelAbs = relative.host || (relative.pathname && relative.pathname.charAt(0) === "/"),
mustEndAbs = isRelAbs || isSourceAbs || (result.host && relative.pathname),
removeAllDots = mustEndAbs,
srcPath = (result.pathname && result.pathname.split("/")) || [],
@@ -612,12 +590,8 @@ Url.prototype.resolveObject = function (relative) {
if (isRelAbs) {
// it's absolute.
- result.host =
- relative.host || relative.host === "" ? relative.host : result.host;
- result.hostname =
- relative.hostname || relative.hostname === ""
- ? relative.hostname
- : result.hostname;
+ result.host = relative.host || relative.host === "" ? relative.host : result.host;
+ result.hostname = relative.hostname || relative.hostname === "" ? relative.hostname : result.hostname;
result.search = relative.search;
result.query = relative.query;
srcPath = relPath;
@@ -639,10 +613,7 @@ Url.prototype.resolveObject = function (relative) {
//occationaly the auth can get stuck only in host
//this especially happens in cases like
//url.resolveObject('mailto:local1@domain1', 'local2@domain2')
- var authInHost =
- result.host && result.host.indexOf("@") > 0
- ? result.host.split("@")
- : false;
+ var authInHost = result.host && result.host.indexOf("@") > 0 ? result.host.split("@") : false;
if (authInHost) {
result.auth = authInHost.shift();
result.host = result.hostname = authInHost.shift();
@@ -652,9 +623,7 @@ Url.prototype.resolveObject = function (relative) {
result.query = relative.query;
//to support http.request
if (!util_isNull(result.pathname) || !util_isNull(result.search)) {
- result.path =
- (result.pathname ? result.pathname : "") +
- (result.search ? result.search : "");
+ result.path = (result.pathname ? result.pathname : "") + (result.search ? result.search : "");
}
result.href = result.format();
return result;
@@ -679,9 +648,7 @@ Url.prototype.resolveObject = function (relative) {
// then it must NOT get a trailing slash.
var last = srcPath.slice(-1)[0];
var hasTrailingSlash =
- ((result.host || relative.host || srcPath.length > 1) &&
- (last === "." || last === "..")) ||
- last === "";
+ ((result.host || relative.host || srcPath.length > 1) && (last === "." || last === "..")) || last === "";
// strip single dots, resolve double dots to parent dir
// if the path tries to go above the root, `up` ends up > 0
@@ -706,11 +673,7 @@ Url.prototype.resolveObject = function (relative) {
}
}
- if (
- mustEndAbs &&
- srcPath[0] !== "" &&
- (!srcPath[0] || srcPath[0].charAt(0) !== "/")
- ) {
+ if (mustEndAbs && srcPath[0] !== "" && (!srcPath[0] || srcPath[0].charAt(0) !== "/")) {
srcPath.unshift("");
}
@@ -718,23 +681,15 @@ Url.prototype.resolveObject = function (relative) {
srcPath.push("");
}
- var isAbsolute =
- srcPath[0] === "" || (srcPath[0] && srcPath[0].charAt(0) === "/");
+ var isAbsolute = srcPath[0] === "" || (srcPath[0] && srcPath[0].charAt(0) === "/");
// put the host back
if (psychotic) {
- result.hostname = result.host = isAbsolute
- ? ""
- : srcPath.length
- ? srcPath.shift()
- : "";
+ result.hostname = result.host = isAbsolute ? "" : srcPath.length ? srcPath.shift() : "";
//occationaly the auth can get stuck only in host
//this especially happens in cases like
//url.resolveObject('mailto:local1@domain1', 'local2@domain2')
- var authInHost =
- result.host && result.host.indexOf("@") > 0
- ? result.host.split("@")
- : false;
+ var authInHost = result.host && result.host.indexOf("@") > 0 ? result.host.split("@") : false;
if (authInHost) {
result.auth = authInHost.shift();
result.host = result.hostname = authInHost.shift();
@@ -756,9 +711,7 @@ Url.prototype.resolveObject = function (relative) {
//to support request.http
if (!util_isNull(result.pathname) || !util_isNull(result.search)) {
- result.path =
- (result.pathname ? result.pathname : "") +
- (result.search ? result.search : "");
+ result.path = (result.pathname ? result.pathname : "") + (result.search ? result.search : "");
}
result.auth = relative.auth || result.auth;
result.slashes = result.slashes || relative.slashes;
diff --git a/src/runtime.footer.bun.js b/src/runtime.footer.bun.js
index 0c83ebc49..56da601b4 100644
--- a/src/runtime.footer.bun.js
+++ b/src/runtime.footer.bun.js
@@ -14,8 +14,7 @@ export var __merge = BUN_RUNTIME.__merge;
export var __decorateClass = BUN_RUNTIME.__decorateClass;
export var __decorateParam = BUN_RUNTIME.__decorateParam;
export var $$bun_runtime_json_parse = JSON.parse;
-export var __internalIsCommonJSNamespace =
- BUN_RUNTIME.__internalIsCommonJSNamespace;
+export var __internalIsCommonJSNamespace = BUN_RUNTIME.__internalIsCommonJSNamespace;
export var __require = (globalThis.require ||= function (moduleId) {
if (typeof moduleId === "string") {
@@ -25,5 +24,4 @@ export var __require = (globalThis.require ||= function (moduleId) {
return BUN_RUNTIME.__require(moduleId);
});
__require.d ||= BUN_RUNTIME.__require.d;
-globalThis.__internalIsCommonJSNamespace ||=
- BUN_RUNTIME.__internalIsCommonJSNamespace;
+globalThis.__internalIsCommonJSNamespace ||= BUN_RUNTIME.__internalIsCommonJSNamespace;
diff --git a/src/runtime.footer.js b/src/runtime.footer.js
index 062961b1f..ceeab055d 100644
--- a/src/runtime.footer.js
+++ b/src/runtime.footer.js
@@ -1,8 +1,7 @@
// ---
// Public exports from runtime
// Compatible with bun's Runtime Environment and web browsers.
-export var $$m =
- "$primordials" in globalThis ? $primordials.require : BUN_RUNTIME.$$m;
+export var $$m = "$primordials" in globalThis ? $primordials.require : BUN_RUNTIME.$$m;
export var __HMRModule = BUN_RUNTIME.__HMRModule;
export var __FastRefreshModule = BUN_RUNTIME.__FastRefreshModule;
export var __HMRClient = BUN_RUNTIME.__HMRClient;
@@ -22,8 +21,7 @@ export var __merge = BUN_RUNTIME.__merge;
export var __decorateClass = BUN_RUNTIME.__decorateClass;
export var __decorateParam = BUN_RUNTIME.__decorateParam;
export var $$bun_runtime_json_parse = JSON.parse;
-export var __internalIsCommonJSNamespace =
- BUN_RUNTIME.__internalIsCommonJSNamespace;
+export var __internalIsCommonJSNamespace = BUN_RUNTIME.__internalIsCommonJSNamespace;
globalThis.__internalIsCommonJSNamespace ||= __internalIsCommonJSNamespace;
globalThis.require ||= BUN_RUNTIME.__require;
diff --git a/src/runtime.footer.node.js b/src/runtime.footer.node.js
index b32dc78fa..ef28d3b31 100644
--- a/src/runtime.footer.node.js
+++ b/src/runtime.footer.node.js
@@ -15,8 +15,7 @@ export var __exportDefault = BUN_RUNTIME.__exportDefault;
export var __decorateClass = BUN_RUNTIME.__decorateClass;
export var __decorateParam = BUN_RUNTIME.__decorateParam;
export var $$bun_runtime_json_parse = JSON.parse;
-export var __internalIsCommonJSNamespace =
- BUN_RUNTIME.__internalIsCommonJSNamespace;
+export var __internalIsCommonJSNamespace = BUN_RUNTIME.__internalIsCommonJSNamespace;
var require = __$module.createRequire(import.meta.url);
var process =
globalThis.process ||
diff --git a/src/runtime.footer.with-refresh.js b/src/runtime.footer.with-refresh.js
index a5b5a3b79..784f5f8fa 100644
--- a/src/runtime.footer.with-refresh.js
+++ b/src/runtime.footer.with-refresh.js
@@ -1,8 +1,7 @@
// ---
// Public exports from runtime
// Compatible with bun's Runtime Environment and web browsers.
-export var $$m =
- "$primordials" in globalThis ? $primordials.require : BUN_RUNTIME.$$m;
+export var $$m = "$primordials" in globalThis ? $primordials.require : BUN_RUNTIME.$$m;
export var __HMRModule = BUN_RUNTIME.__HMRModule;
export var __FastRefreshModule = BUN_RUNTIME.__FastRefreshModule;
export var __HMRClient = BUN_RUNTIME.__HMRClient;
@@ -22,8 +21,7 @@ export var __decorateClass = BUN_RUNTIME.__decorateClass;
export var __decorateParam = BUN_RUNTIME.__decorateParam;
export var $$bun_runtime_json_parse = JSON.parse;
export var __FastRefreshRuntime = BUN_RUNTIME.__FastRefreshRuntime;
-export var __internalIsCommonJSNamespace =
- BUN_RUNTIME.__internalIsCommonJSNamespace;
+export var __internalIsCommonJSNamespace = BUN_RUNTIME.__internalIsCommonJSNamespace;
globalThis.__internalIsCommonJSNamespace ||= __internalIsCommonJSNamespace;
globalThis.require ||= BUN_RUNTIME.__require;
diff --git a/src/runtime.js b/src/runtime.js
index b39eaed9d..537ea9eed 100644
--- a/src/runtime.js
+++ b/src/runtime.js
@@ -21,8 +21,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
// return __objectFreezePolyfill.has(obj);
// };
-export var __markAsModule = (target) =>
- __defProp(target, "__esModule", { value: true, configurable: true });
+export var __markAsModule = target => __defProp(target, "__esModule", { value: true, configurable: true });
// lazy require to prevent loading one icon from a design system
export var $$lzy = (target, module, props) => {
@@ -37,7 +36,7 @@ export var $$lzy = (target, module, props) => {
return target;
};
-export var __toModule = (module) => {
+export var __toModule = module => {
return __reExport(
__markAsModule(
__defProp(
@@ -81,15 +80,9 @@ export var __commonJS = (cb, name) => {
return origExports.apply(this, arguments);
};
Object.setPrototypeOf(mod_exports, __getProtoOf(origExports));
- Object.defineProperties(
- mod_exports,
- Object.getOwnPropertyDescriptors(origExports),
- );
+ Object.defineProperties(mod_exports, Object.getOwnPropertyDescriptors(origExports));
} else {
- mod_exports = __create(
- __getProtoOf(mod_exports),
- Object.getOwnPropertyDescriptors(mod_exports),
- );
+ mod_exports = __create(__getProtoOf(mod_exports), Object.getOwnPropertyDescriptors(mod_exports));
}
}
@@ -134,14 +127,13 @@ export var __commonJS = (cb, name) => {
export var __cJS2eSM = __commonJS;
-export var __internalIsCommonJSNamespace = (namespace) =>
+export var __internalIsCommonJSNamespace = namespace =>
namespace != null &&
typeof namespace === "object" &&
- ((namespace.default && namespace.default[cjsRequireSymbol]) ||
- namespace[cjsRequireSymbol]);
+ ((namespace.default && namespace.default[cjsRequireSymbol]) || namespace[cjsRequireSymbol]);
// require()
-export var __require = (namespace) => {
+export var __require = namespace => {
if (__internalIsCommonJSNamespace(namespace)) {
return namespace.default();
}
@@ -152,7 +144,7 @@ export var __require = (namespace) => {
// require().default
// this currently does nothing
// get rid of this wrapper once we're more confident we do not need special handling for default
-__require.d = (namespace) => {
+__require.d = namespace => {
return namespace;
};
@@ -176,7 +168,7 @@ export var __export = (target, all) => {
get: all[name],
enumerable: true,
configurable: true,
- set: (newValue) => (all[name] = () => newValue),
+ set: newValue => (all[name] = () => newValue),
});
};
@@ -184,7 +176,7 @@ export var __exportValue = (target, all) => {
for (var name in all) {
__defProp(target, name, {
get: () => all[name],
- set: (newValue) => (all[name] = newValue),
+ set: newValue => (all[name] = newValue),
enumerable: true,
configurable: true,
});
@@ -194,7 +186,7 @@ export var __exportValue = (target, all) => {
export var __exportDefault = (target, value) => {
__defProp(target, "default", {
get: () => value,
- set: (newValue) => (value = newValue),
+ set: newValue => (value = newValue),
enumerable: true,
configurable: true,
});
@@ -207,8 +199,7 @@ export var __reExport = (target, module, desc) => {
__defProp(target, key, {
get: () => module[key],
configurable: true,
- enumerable:
- !(desc = __getOwnPropDesc(module, key)) || desc.enumerable,
+ enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable,
});
return target;
};
@@ -237,15 +228,11 @@ export var __merge = (props, defaultProps) => {
};
export var __decorateClass = (decorators, target, key, kind) => {
- var result =
- kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
for (var i = decorators.length - 1, decorator; i >= 0; i--)
- if ((decorator = decorators[i]))
- result =
- (kind ? decorator(target, key, result) : decorator(result)) || result;
+ if ((decorator = decorators[i])) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
if (kind && result) __defProp(target, key, result);
return result;
};
-export var __decorateParam = (index, decorator) => (target, key) =>
- decorator(target, key, index);
+export var __decorateParam = (index, decorator) => (target, key) => decorator(target, key, index);
diff --git a/src/runtime/errors.ts b/src/runtime/errors.ts
index 5affd14f1..e2973db91 100644
--- a/src/runtime/errors.ts
+++ b/src/runtime/errors.ts
@@ -76,8 +76,4 @@ var __ImportKind;
__ImportKind = ImportKind;
}
-export {
- __ResolveError as ResolveError,
- __BuildError as BuildError,
- __ImportKind as ImportKind,
-};
+export { __ResolveError as ResolveError, __BuildError as BuildError, __ImportKind as ImportKind };
diff --git a/src/runtime/hmr.ts b/src/runtime/hmr.ts
index 96122feba..5aff4389d 100644
--- a/src/runtime/hmr.ts
+++ b/src/runtime/hmr.ts
@@ -79,8 +79,7 @@ if (typeof window !== "undefined") {
// if they set a CSP header, that could cause this to fail
try {
let linkTag = document.querySelector("link[rel='icon']");
- BunError.previousFavicon =
- (linkTag && linkTag.getAttribute("href")) || "/favicon.ico";
+ BunError.previousFavicon = (linkTag && linkTag.getAttribute("href")) || "/favicon.ico";
if (!linkTag) {
linkTag = document.createElement("link");
linkTag.setAttribute("rel", "icon");
@@ -119,19 +118,15 @@ if (typeof window !== "undefined") {
if (!BunError.module) {
if (BunError.prom) return;
- BunError.prom = import("/bun:error.js").then((mod) => {
+ BunError.prom = import("/bun:error.js").then(mod => {
BunError.module = mod;
- !BunError.cancel &&
- BunError.render(BunError.lastError[0], BunError.lastError[1]);
+ !BunError.cancel && BunError.render(BunError.lastError[0], BunError.lastError[1]);
});
return;
}
const { renderBuildFailure, renderRuntimeError } = BunError.module;
- if (
- typeof BunError.lastError[0] === "string" ||
- BunError.lastError[0] instanceof Error
- ) {
+ if (typeof BunError.lastError[0] === "string" || BunError.lastError[0] instanceof Error) {
renderRuntimeError(BunError.lastError[0], BunError.lastError[1]);
} else {
renderBuildFailure(BunError.lastError[0], BunError.lastError[1]);
@@ -192,26 +187,17 @@ if (typeof window !== "undefined") {
const endIDRegion = rule.conditionText.indexOf(")", startIndex);
if (endIDRegion === -1) return null;
- const int = parseInt(
- rule.conditionText.substring(startIndex, endIDRegion),
- 10,
- );
+ const int = parseInt(rule.conditionText.substring(startIndex, endIDRegion), 10);
if (int !== id) {
return null;
}
- let startFileRegion = rule.conditionText.indexOf(
- '(hmr-file:"',
- endIDRegion,
- );
+ let startFileRegion = rule.conditionText.indexOf('(hmr-file:"', endIDRegion);
if (startFileRegion === -1) return null;
startFileRegion += '(hmr-file:"'.length + 1;
- const endFileRegion = rule.conditionText.indexOf(
- '"',
- startFileRegion,
- );
+ const endFileRegion = rule.conditionText.indexOf('"', startFileRegion);
if (endFileRegion === -1) return null;
// Empty file strings are invalid
if (endFileRegion - startFileRegion <= 0) return null;
@@ -219,10 +205,7 @@ if (typeof window !== "undefined") {
CSSLoader.cssLoadId.id = int;
CSSLoader.cssLoadId.node = sheet.ownerNode as HTMLStylableElement;
CSSLoader.cssLoadId.sheet = sheet;
- CSSLoader.cssLoadId.file = rule.conditionText.substring(
- startFileRegion - 1,
- endFileRegion,
- );
+ CSSLoader.cssLoadId.file = rule.conditionText.substring(startFileRegion - 1, endFileRegion);
return CSSLoader.cssLoadId;
}
@@ -265,33 +248,20 @@ if (typeof window !== "undefined") {
}
const bundleIdRule = cssRules[0] as CSSSupportsRule;
- if (
- bundleIdRule.type !== 12 ||
- !bundleIdRule.conditionText.startsWith("(hmr-bid:")
- ) {
+ if (bundleIdRule.type !== 12 || !bundleIdRule.conditionText.startsWith("(hmr-bid:")) {
continue;
}
- const bundleIdEnd = bundleIdRule.conditionText.indexOf(
- ")",
- "(hmr-bid:".length + 1,
- );
+ const bundleIdEnd = bundleIdRule.conditionText.indexOf(")", "(hmr-bid:".length + 1);
if (bundleIdEnd === -1) continue;
CSSLoader.cssLoadId.bundle_id = parseInt(
- bundleIdRule.conditionText.substring(
- "(hmr-bid:".length,
- bundleIdEnd,
- ),
+ bundleIdRule.conditionText.substring("(hmr-bid:".length, bundleIdEnd),
10,
);
for (let j = 1; j < ruleCount && match === null; j++) {
- match = this.findMatchingSupportsRule(
- cssRules[j] as CSSSupportsRule,
- id,
- sheet,
- );
+ match = this.findMatchingSupportsRule(cssRules[j] as CSSSupportsRule, id, sheet);
}
}
}
@@ -318,17 +288,11 @@ if (typeof window !== "undefined") {
}
const bundleIdRule = cssRules[0] as CSSSupportsRule;
- if (
- bundleIdRule.type !== 12 ||
- !bundleIdRule.conditionText.startsWith("(hmr-bid:")
- ) {
+ if (bundleIdRule.type !== 12 || !bundleIdRule.conditionText.startsWith("(hmr-bid:")) {
continue;
}
- const bundleIdEnd = bundleIdRule.conditionText.indexOf(
- ")",
- "(hmr-bid:".length + 1,
- );
+ const bundleIdEnd = bundleIdRule.conditionText.indexOf(")", "(hmr-bid:".length + 1);
if (bundleIdEnd === -1) continue;
CSSLoader.cssLoadId.bundle_id = parseInt(
@@ -337,11 +301,7 @@ if (typeof window !== "undefined") {
);
for (let j = 1; j < ruleCount && match === null; j++) {
- match = this.findMatchingSupportsRule(
- cssRules[j] as CSSSupportsRule,
- id,
- sheet,
- );
+ match = this.findMatchingSupportsRule(cssRules[j] as CSSSupportsRule, id, sheet);
}
}
@@ -356,11 +316,7 @@ if (typeof window !== "undefined") {
return match;
}
- handleBuildSuccess(
- bytes: Uint8Array,
- build: API.WebsocketMessageBuildSuccess,
- timestamp: number,
- ) {
+ handleBuildSuccess(bytes: Uint8Array, build: API.WebsocketMessageBuildSuccess, timestamp: number) {
const start = performance.now();
var update = this.findCSSLinkTag(build.id);
// The last 4 bytes of the build message are the hash of the module
@@ -386,12 +342,7 @@ if (typeof window !== "undefined") {
function onLoadHandler() {
const localDuration = formatDuration(performance.now() - start);
const fsDuration = _timestamp - from_timestamp;
- __hmrlog.log(
- "Reloaded in",
- `${localDuration + fsDuration}ms`,
- "-",
- filepath,
- );
+ __hmrlog.log("Reloaded in", `${localDuration + fsDuration}ms`, "-", filepath);
update = null;
filepath = null;
@@ -421,10 +372,7 @@ if (typeof window !== "undefined") {
// This is an adoptedStyleSheet, call replaceSync and be done with it.
if (!update.node || update.node.tagName === "HTML") {
update.sheet.replaceSync(this.decoder.decode(bytes));
- } else if (
- update.node.tagName === "LINK" ||
- update.node.tagName === "STYLE"
- ) {
+ } else if (update.node.tagName === "LINK" || update.node.tagName === "STYLE") {
// This might cause CSS specifity issues....
// I'm not 100% sure this is a safe operation
const sheet = new CSSStyleSheet();
@@ -433,10 +381,7 @@ if (typeof window !== "undefined") {
sheet.replaceSync(decoded);
update.node.remove();
- document.adoptedStyleSheets = [
- ...document.adoptedStyleSheets,
- sheet,
- ];
+ document.adoptedStyleSheets = [...document.adoptedStyleSheets, sheet];
}
break;
}
@@ -445,9 +390,7 @@ if (typeof window !== "undefined") {
bytes = null;
}
- filePath(
- file_change_notification: API.WebsocketMessageFileChangeNotification,
- ): string | null {
+ filePath(file_change_notification: API.WebsocketMessageFileChangeNotification): string | null {
if (file_change_notification.loader !== API.Loader.css) return null;
const tag = this.findCSSLinkTag(file_change_notification.id);
@@ -481,9 +424,7 @@ if (typeof window !== "undefined") {
start() {
if (runOnce) {
- __hmrlog.warn(
- "Attempted to start HMR client multiple times. This may be a bug.",
- );
+ __hmrlog.warn("Attempted to start HMR client multiple times. This may be a bug.");
return;
}
@@ -508,23 +449,18 @@ if (typeof window !== "undefined") {
debouncedReconnect = () => {
if (
this.socket &&
- (this.socket.readyState == this.socket.OPEN ||
- this.socket.readyState == this.socket.CONNECTING)
+ (this.socket.readyState == this.socket.OPEN || this.socket.readyState == this.socket.CONNECTING)
)
return;
- this.nextReconnectAttempt = setTimeout(
- this.attemptReconnect,
- this.reconnectDelay,
- );
+ this.nextReconnectAttempt = setTimeout(this.attemptReconnect, this.reconnectDelay);
};
attemptReconnect = () => {
globalThis.clearTimeout(this.nextReconnectAttempt);
if (
this.socket &&
- (this.socket.readyState == this.socket.OPEN ||
- this.socket.readyState == this.socket.CONNECTING)
+ (this.socket.readyState == this.socket.OPEN || this.socket.readyState == this.socket.CONNECTING)
)
return;
this.connect();
@@ -534,8 +470,7 @@ if (typeof window !== "undefined") {
connect() {
if (
this.socket &&
- (this.socket.readyState == this.socket.OPEN ||
- this.socket.readyState == this.socket.CONNECTING)
+ (this.socket.readyState == this.socket.OPEN || this.socket.readyState == this.socket.CONNECTING)
)
return;
@@ -583,10 +518,7 @@ if (typeof window !== "undefined") {
case CSSImportState.Pending: {
this.cssState = CSSImportState.Loading;
// This means we can import without risk of FOUC
- if (
- document.documentElement.innerText === "" &&
- !HMRClient.cssAutoFOUC
- ) {
+ if (document.documentElement.innerText === "" && !HMRClient.cssAutoFOUC) {
if (document.body) document.body.style.visibility = "hidden";
HMRClient.cssAutoFOUC = true;
}
@@ -670,11 +602,8 @@ if (typeof window !== "undefined") {
resolve();
};
- link.onerror = (evt) => {
- console.error(
- `[CSS Importer] Error loading CSS file: ${urlString}\n`,
- evt.toString(),
- );
+ link.onerror = evt => {
+ console.error(`[CSS Importer] Error loading CSS file: ${urlString}\n`, evt.toString());
reject();
};
document.head.appendChild(link);
@@ -683,21 +612,14 @@ if (typeof window !== "undefined") {
}
static onError(event: ErrorEvent) {
if ("error" in event && !!event.error) {
- BunError.render(
- event.error,
- HMRClient.client ? HMRClient.client.cwd : "",
- );
+ BunError.render(event.error, HMRClient.client ? HMRClient.client.cwd : "");
}
}
static activate(verboseOrFastRefresh: boolean = false) {
// Support browser-like envirnments where location and WebSocket exist
// Maybe it'll work in Deno! Who knows.
- if (
- this.client ||
- !("location" in globalThis) ||
- !("WebSocket" in globalThis)
- ) {
+ if (this.client || !("location" in globalThis) || !("WebSocket" in globalThis)) {
return;
}
@@ -757,9 +679,7 @@ if (typeof window !== "undefined") {
reportBuildFailure(failure: API.WebsocketMessageBuildFailure) {
BunError.render(failure, this.cwd);
- console.group(
- `Build failed: ${failure.module_path} (${failure.log.errors} errors)`,
- );
+ console.group(`Build failed: ${failure.module_path} (${failure.log.errors} errors)`);
this.needsConsoleClear = true;
for (let msg of failure.log.msgs) {
var logFunction;
@@ -830,13 +750,8 @@ if (typeof window !== "undefined") {
return;
}
var bytes =
- buffer.data.byteOffset + buffer.index + build.blob_length <=
- buffer.data.buffer.byteLength
- ? new Uint8Array(
- buffer.data.buffer,
- buffer.data.byteOffset + buffer.index,
- build.blob_length,
- )
+ buffer.data.byteOffset + buffer.index + build.blob_length <= buffer.data.buffer.byteLength
+ ? new Uint8Array(buffer.data.buffer, buffer.data.byteOffset + buffer.index, build.blob_length)
: (empty ||= new Uint8Array(0));
if (build.loader === API.Loader.css) {
@@ -876,22 +791,13 @@ if (typeof window !== "undefined") {
}
if (end > 4 && buffer.data.length >= end + 4) {
- new Uint8Array(this.hashBuffer.buffer).set(
- buffer.data.subarray(end, end + 4),
- );
+ new Uint8Array(this.hashBuffer.buffer).set(buffer.data.subarray(end, end + 4));
hash = this.hashBuffer[0];
}
// These are the bytes!!
- var reload = new HotReload(
- build.id,
- index,
- build,
- bytes,
- ReloadBehavior.hotReload,
- hash || 0,
- );
+ var reload = new HotReload(build.id, index, build, bytes, ReloadBehavior.hotReload, hash || 0);
bytes = null;
reload.timings.notify = timestamp - build.from_timestamp;
@@ -910,17 +816,10 @@ if (typeof window !== "undefined") {
this.needsConsoleClear = false;
}
- __hmrlog.log(
- `[${formatDuration(timings.total)}ms] Reloaded`,
- filepath,
- );
+ __hmrlog.log(`[${formatDuration(timings.total)}ms] Reloaded`, filepath);
},
- (err) => {
- if (
- typeof err === "object" &&
- err &&
- err instanceof ThrottleModuleUpdateError
- ) {
+ err => {
+ if (typeof err === "object" && err && err instanceof ThrottleModuleUpdateError) {
return;
}
__hmrlog.error("Hot Module Reload failed!", err);
@@ -940,13 +839,8 @@ if (typeof window !== "undefined") {
}
}
- handleFileChangeNotification(
- buffer: ByteBuffer,
- timestamp: number,
- copy_file_path: boolean,
- ) {
- const notification =
- API.decodeWebsocketMessageFileChangeNotification(buffer);
+ handleFileChangeNotification(buffer: ByteBuffer, timestamp: number, copy_file_path: boolean) {
+ const notification = API.decodeWebsocketMessageFileChangeNotification(buffer);
let file_path = "";
switch (notification.loader) {
case API.Loader.css: {
@@ -974,12 +868,7 @@ if (typeof window !== "undefined") {
}
}
- return this.handleFileChangeNotificationBase(
- timestamp,
- notification,
- file_path,
- copy_file_path,
- );
+ return this.handleFileChangeNotificationBase(timestamp, notification, file_path, copy_file_path);
}
private handleFileChangeNotificationBase(
@@ -1052,9 +941,7 @@ if (typeof window !== "undefined") {
this.buildCommandBufWithFilePath = new Uint8Array(4096 + 256);
}
- const writeBuffer = !copy_file_path
- ? this.buildCommandBuf
- : this.buildCommandBufWithFilePath;
+ const writeBuffer = !copy_file_path ? this.buildCommandBuf : this.buildCommandBufWithFilePath;
writeBuffer[0] = !copy_file_path
? API.WebsocketCommandKind.build
: API.WebsocketCommandKind.build_with_file_path;
@@ -1071,13 +958,8 @@ if (typeof window !== "undefined") {
this.buildCommandUArray[0] = file_path.length;
writeBuffer.set(this.buildCommandUArrayEight, 9);
- const out = textEncoder.encodeInto(
- file_path,
- writeBuffer.subarray(13),
- );
- this.socket.send(
- this.buildCommandBufWithFilePath.subarray(0, 13 + out.written),
- );
+ const out = textEncoder.encodeInto(file_path, writeBuffer.subarray(13));
+ this.socket.send(this.buildCommandBufWithFilePath.subarray(0, 13 + out.written));
} else {
this.socket.send(this.buildCommandBuf);
}
@@ -1118,9 +1000,7 @@ if (typeof window !== "undefined") {
const data = new Uint8Array(event.data);
const message_header_byte_buffer = new ByteBuffer(data);
const header = API.decodeWebsocketMessage(message_header_byte_buffer);
- const buffer = new ByteBuffer(
- data.subarray(message_header_byte_buffer.index),
- );
+ const buffer = new ByteBuffer(data.subarray(message_header_byte_buffer.index));
switch (header.kind) {
case API.WebsocketMessageKind.build_fail: {
@@ -1141,9 +1021,7 @@ if (typeof window !== "undefined") {
return;
}
- const index = HMRModule.dependencies.graph
- .subarray(0, HMRModule.dependencies.graph_used)
- .indexOf(id);
+ const index = HMRModule.dependencies.graph.subarray(0, HMRModule.dependencies.graph_used).indexOf(id);
var file_path: string = "";
var loader = API.Loader.js;
if (index > -1) {
@@ -1203,12 +1081,7 @@ if (typeof window !== "undefined") {
}
}
- this.handleFileChangeNotificationBase(
- timestamp,
- { id, loader },
- file_path,
- true,
- );
+ this.handleFileChangeNotificationBase(timestamp, { id, loader }, file_path, true);
break;
}
case API.WebsocketMessageKind.file_change_notification: {
@@ -1231,27 +1104,15 @@ if (typeof window !== "undefined") {
switch (this.javascriptReloader) {
case API.Reloader.fast_refresh: {
- __hmrlog.log(
- "HMR connected in",
- formatDuration(now - clientStartTime),
- "ms",
- );
+ __hmrlog.log("HMR connected in", formatDuration(now - clientStartTime), "ms");
break;
}
case API.Reloader.live: {
- __hmrlog.log(
- "Live reload connected in",
- formatDuration(now - clientStartTime),
- "ms",
- );
+ __hmrlog.log("Live reload connected in", formatDuration(now - clientStartTime), "ms");
break;
}
default: {
- __hmrlog.log(
- "Bun connected in",
- formatDuration(now - clientStartTime),
- "ms",
- );
+ __hmrlog.log("Bun connected in", formatDuration(now - clientStartTime), "ms");
break;
}
}
@@ -1339,8 +1200,7 @@ if (typeof window !== "undefined") {
const oldGraphUsed = HMRModule.dependencies.graph_used;
var oldModule =
- HMRModule.dependencies.modules.length > this.module_index &&
- HMRModule.dependencies.modules[this.module_index];
+ HMRModule.dependencies.modules.length > this.module_index && HMRModule.dependencies.modules[this.module_index];
HMRModule.dependencies = orig_deps.fork(this.module_index);
var blobURL = "";
@@ -1361,10 +1221,9 @@ if (typeof window !== "undefined") {
: "";
try {
- const blob = new Blob(
- sourceMapURL.length > 0 ? [this.bytes, sourceMapURL] : [this.bytes],
- { type: "text/javascript" },
- );
+ const blob = new Blob(sourceMapURL.length > 0 ? [this.bytes, sourceMapURL] : [this.bytes], {
+ type: "text/javascript",
+ });
blobURL = URL.createObjectURL(blob);
HMRModule.dependencies.blobToID.set(blobURL, this.module_id);
await import(blobURL);
@@ -1378,11 +1237,7 @@ if (typeof window !== "undefined") {
this.bytes = null;
if ("__BunRenderHMRError" in globalThis) {
- globalThis.__BunRenderHMRError(
- exception,
- oldModule.file_path,
- oldModule.id,
- );
+ globalThis.__BunRenderHMRError(exception, oldModule.file_path, oldModule.id);
}
oldModule = null;
@@ -1436,26 +1291,18 @@ if (typeof window !== "undefined") {
if (!isOldModuleDead) {
oldModule.boundUpdate ||= oldModule.update.bind(oldModule);
- if (thisMod.additional_updaters)
- thisMod.additional_updaters.add(oldModule.boundUpdate);
- else
- thisMod.additional_updaters = new Set([
- oldModule.boundUpdate,
- ]);
+ if (thisMod.additional_updaters) thisMod.additional_updaters.add(oldModule.boundUpdate);
+ else thisMod.additional_updaters = new Set([oldModule.boundUpdate]);
thisMod.previousVersion = oldModule;
} else {
- if (oldModule.previousVersion)
- thisMod.previousVersion = oldModule.previousVersion;
+ if (oldModule.previousVersion) thisMod.previousVersion = oldModule.previousVersion;
thisMod.additional_updaters = origUpdaters;
}
}
- const end = Math.min(
- this.module_index + 1,
- HMRModule.dependencies.graph_used,
- );
+ const end = Math.min(this.module_index + 1, HMRModule.dependencies.graph_used);
// -- For generic hot reloading --
// ES Modules delay execution until all imports are parsed
// They execute depth-first
@@ -1505,10 +1352,7 @@ if (typeof window !== "undefined") {
// By the time we get here, it's entirely possible that another update is waiting
// Instead of scheduling it, we are going to just ignore this update.
// But we still need to re-initialize modules regardless because otherwise a dependency may not reload properly
- if (
- pendingUpdateCount === currentPendingUpdateCount &&
- foundBoundary
- ) {
+ if (pendingUpdateCount === currentPendingUpdateCount && foundBoundary) {
FastRefreshLoader.RefreshRuntime.performReactRefresh();
// Remove potential memory leak
if (isOldModuleDead) oldModule.previousVersion = null;
@@ -1527,8 +1371,7 @@ if (typeof window !== "undefined") {
}
} catch (exception) {
HMRModule.dependencies = orig_deps;
- HMRModule.dependencies.modules[this.module_index].additional_updaters =
- origUpdaters;
+ HMRModule.dependencies.modules[this.module_index].additional_updaters = origUpdaters;
throw exception;
}
this.timings.callbacks = performance.now() - callbacksStart;
@@ -1544,12 +1387,8 @@ if (typeof window !== "undefined") {
}
orig_deps = null;
- this.timings.total =
- this.timings.import + this.timings.callbacks + this.timings.notify;
- return Promise.resolve([
- HMRModule.dependencies.modules[this.module_index],
- this.timings,
- ]);
+ this.timings.total = this.timings.import + this.timings.callbacks + this.timings.notify;
+ return Promise.resolve([HMRModule.dependencies.modules[this.module_index], this.timings]);
}
}
@@ -1625,9 +1464,7 @@ if (typeof window !== "undefined") {
// Grow the dependencies graph
if (HMRModule.dependencies.graph.length <= this.graph_index) {
- const new_graph = new Uint32Array(
- HMRModule.dependencies.graph.length * 4,
- );
+ const new_graph = new Uint32Array(HMRModule.dependencies.graph.length * 4);
new_graph.set(HMRModule.dependencies.graph);
HMRModule.dependencies.graph = new_graph;
@@ -1712,11 +1549,8 @@ if (typeof window !== "undefined") {
// 4,000,000,000 in base36 occupies 7 characters
// file path is probably longer
// small strings are better strings
- this.refreshRuntimeBaseID =
- (this.file_path.length > 7 ? this.id.toString(36) : this.file_path) +
- "/";
- FastRefreshLoader.RefreshRuntime =
- FastRefreshLoader.RefreshRuntime || RefreshRuntime;
+ this.refreshRuntimeBaseID = (this.file_path.length > 7 ? this.id.toString(36) : this.file_path) + "/";
+ FastRefreshLoader.RefreshRuntime = FastRefreshLoader.RefreshRuntime || RefreshRuntime;
if (!FastRefreshLoader.hasInjectedFastRefresh) {
RefreshRuntime.injectIntoGlobalHook(globalThis);
@@ -1729,10 +1563,7 @@ if (typeof window !== "undefined") {
// $RefreshReg$
$r_(Component: any, id: string) {
- FastRefreshLoader.RefreshRuntime.register(
- Component,
- this.refreshRuntimeBaseID + id,
- );
+ FastRefreshLoader.RefreshRuntime.register(Component, this.refreshRuntimeBaseID + id);
}
// $RefreshReg$(Component, Component.name || Component.displayName)
$r(Component: any) {
@@ -1767,12 +1598,7 @@ if (typeof window !== "undefined") {
// Ensure exported React components always have names
// This is for simpler debugging
- if (
- Component &&
- typeof Component === "function" &&
- !("name" in Component) &&
- Object.isExtensible(Component)
- ) {
+ if (Component && typeof Component === "function" && !("name" in Component) && Object.isExtensible(Component)) {
const named = {
get() {
return key;
@@ -1791,9 +1617,7 @@ if (typeof window !== "undefined") {
} catch (exception) {}
}
- if (
- !FastRefreshLoader.RefreshRuntime.isLikelyComponentType(Component)
- ) {
+ if (!FastRefreshLoader.RefreshRuntime.isLikelyComponentType(Component)) {
onlyExportsComponents = false;
// We can't stop here because we may have other exports which are components that need to be registered.
continue;
diff --git a/src/runtime/regenerator.ts b/src/runtime/regenerator.ts
index 0940fb9f1..a3a7ba75e 100644
--- a/src/runtime/regenerator.ts
+++ b/src/runtime/regenerator.ts
@@ -37,8 +37,7 @@ var runtime = (function (exports) {
function wrap(innerFn, outerFn, self, tryLocsList) {
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
- var protoGenerator =
- outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
+ var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
var generator = Object.create(protoGenerator.prototype);
var context = new Context(tryLocsList || []);
@@ -104,18 +103,11 @@ var runtime = (function (exports) {
IteratorPrototype = NativeIteratorPrototype;
}
- var Gp =
- (GeneratorFunctionPrototype.prototype =
- Generator.prototype =
- Object.create(IteratorPrototype));
+ var Gp = (GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype));
GeneratorFunction.prototype = GeneratorFunctionPrototype;
define(Gp, "constructor", GeneratorFunctionPrototype);
define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
- GeneratorFunction.displayName = define(
- GeneratorFunctionPrototype,
- toStringTagSymbol,
- "GeneratorFunction",
- );
+ GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
// Helper for defining the .next, .throw, and .return methods of the
// Iterator interface in terms of a single ._invoke method.
@@ -164,11 +156,7 @@ var runtime = (function (exports) {
} else {
var result = record.arg;
var value = result.value;
- if (
- value &&
- typeof value === "object" &&
- hasOwn.call(value, "__await")
- ) {
+ if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
return PromiseImpl.resolve(value.__await).then(
function (value) {
invoke("next", value, resolve, reject);
@@ -245,10 +233,7 @@ var runtime = (function (exports) {
exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
if (PromiseImpl === void 0) PromiseImpl = Promise;
- var iter = new AsyncIterator(
- wrap(innerFn, outerFn, self, tryLocsList),
- PromiseImpl,
- );
+ var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
return exports.isGeneratorFunction(outerFn)
? iter // If outerFn is a generator, return the full iterator.
@@ -358,9 +343,7 @@ var runtime = (function (exports) {
}
context.method = "throw";
- context.arg = new TypeError(
- "The iterator does not provide a 'throw' method",
- );
+ context.arg = new TypeError("The iterator does not provide a 'throw' method");
}
return ContinueSentinel;
@@ -551,11 +534,7 @@ var runtime = (function (exports) {
if (!skipTempReset) {
for (var name in this) {
// Not sure about the optimal order of these conditions:
- if (
- name.charAt(0) === "t" &&
- hasOwn.call(this, name) &&
- !isNaN(+name.slice(1))
- ) {
+ if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
this[name] = undefined;
}
}
@@ -634,11 +613,7 @@ var runtime = (function (exports) {
abrupt: function (type, arg) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
- if (
- entry.tryLoc <= this.prev &&
- hasOwn.call(entry, "finallyLoc") &&
- this.prev < entry.finallyLoc
- ) {
+ if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
var finallyEntry = entry;
break;
}
diff --git a/src/string_immutable.zig b/src/string_immutable.zig
index e5a37006a..e85fc4ef8 100644
--- a/src/string_immutable.zig
+++ b/src/string_immutable.zig
@@ -588,7 +588,7 @@ pub inline fn endsWithChar(self: string, char: u8) bool {
pub fn withoutTrailingSlash(this: string) []const u8 {
var href = this;
while (href.len > 1 and href[href.len - 1] == '/') {
- href = href[0 .. href.len - 1];
+ href.len -= 1;
}
return href;
diff --git a/src/test/fixtures/double-export-default-bug.jsx b/src/test/fixtures/double-export-default-bug.jsx
index 3db411bb0..18f5165f9 100644
--- a/src/test/fixtures/double-export-default-bug.jsx
+++ b/src/test/fixtures/double-export-default-bug.jsx
@@ -20,8 +20,7 @@ export default function Home() {
</h1>
<p className={styles.description}>
- Get started by editing{" "}
- <code className={styles.code}>pages/index.js</code>
+ Get started by editing <code className={styles.code}>pages/index.js</code>
</p>
<div className={styles.grid}>
@@ -35,10 +34,7 @@ export default function Home() {
<p>Learn about Next.js in an interactive course with quizzes!</p>
</a>
- <a
- href="https://github.com/vercel/next.js/tree/master/examples"
- className={styles.card}
- >
+ <a href="https://github.com/vercel/next.js/tree/master/examples" className={styles.card}>
<h2>Examples &rarr;</h2>
<p>Discover and deploy boilerplate example Next.js projects.</p>
</a>
@@ -48,9 +44,7 @@ export default function Home() {
className={styles.card}
>
<h2>Deploy &rarr;</h2>
- <p>
- Instantly deploy your Next.js site to a public URL with Vercel.
- </p>
+ <p>Instantly deploy your Next.js site to a public URL with Vercel.</p>
</a>
</div>
</main>
diff --git a/src/test/fixtures/simple-150x.jsx b/src/test/fixtures/simple-150x.jsx
index 64cb88b1b..3ec65431c 100644
--- a/src/test/fixtures/simple-150x.jsx
+++ b/src/test/fixtures/simple-150x.jsx
@@ -27,19 +27,10 @@ import { SPACING } from "../helpers/styles";
return (
<Link route={buildProfileURL(profile.id)}>
<a className="Profile">
- <img
- src={_.first(profile.photos)}
- srcSet={buildImgSrcSet(_.first(profile.photos), 250)}
- />
+ <img src={_.first(profile.photos)} srcSet={buildImgSrcSet(_.first(profile.photos), 250)} />
<div className="Text">
<div className="Title">
- <Text
- font="sans-serif"
- lineHeight="20px"
- weight="semiBold"
- size="18px"
- color="#000"
- >
+ <Text font="sans-serif" lineHeight="20px" weight="semiBold" size="18px" color="#000">
{profile.name}
</Text>
</div>
@@ -111,18 +102,16 @@ import { SPACING } from "../helpers/styles";
};
}
- setEmail = (evt) => this.setState({ email: evt.target.value });
+ setEmail = evt => this.setState({ email: evt.target.value });
componentDidMount() {
Router.prefetchRoute(`/sign-up/verify`);
}
- handleSubmit = (evt) => {
+ handleSubmit = evt => {
evt.preventDefault();
- Router.pushRoute(
- `/sign-up/verify?${qs.stringify({ email: this.state.email })}`,
- );
+ Router.pushRoute(`/sign-up/verify?${qs.stringify({ email: this.state.email })}`);
};
render() {
@@ -223,24 +212,15 @@ import { SPACING } from "../helpers/styles";
<article>
<main>
<div className="Copy">
- <img
- className="Logo Logo-Home"
- src="/static/animatedlogo.gif"
- />
+ <img className="Logo Logo-Home" src="/static/animatedlogo.gif" />
<div className="Copy-title">
- <Text
- font="serif"
- size="36px"
- lineHeight="44px"
- weight="bold"
- >
+ <Text font="serif" size="36px" lineHeight="44px" weight="bold">
Your own game of The Bachelor(ette)
</Text>
</div>
<div className="Copy-body">
<Text size="16px" lineHeight="24px" font="sans-serif">
- Create a page where people apply to go on a date with you.
- You pick the winners.
+ Create a page where people apply to go on a date with you. You pick the winners.
</Text>
</div>
@@ -282,9 +262,7 @@ import { SPACING } from "../helpers/styles";
{this.state.isLoadingProfiles && <div className="Spinner" />}
<div className="FeaturedProfiles">
{!_.isEmpty(this.state.profiles) &&
- this.state.profiles.map((profile) => (
- <FeaturedProfile key={profile.id} profile={profile} />
- ))}
+ this.state.profiles.map(profile => <FeaturedProfile key={profile.id} profile={profile} />)}
</div>
</div>
</footer>
@@ -438,7 +416,7 @@ import { SPACING } from "../helpers/styles";
}
}
- const HomepageWithStore = withRedux(initStore, null, (dispatch) =>
+ const HomepageWithStore = withRedux(initStore, null, dispatch =>
bindActionCreators({ updateEntities, setCurrentUser }, dispatch),
)(LoginGate(Homepage));
})();
diff --git a/src/test/fixtures/simple.jsx b/src/test/fixtures/simple.jsx
index 63873fe8d..98d01235b 100644
--- a/src/test/fixtures/simple.jsx
+++ b/src/test/fixtures/simple.jsx
@@ -25,19 +25,10 @@ const FeaturedProfile = ({ profile }) => {
return (
<Link route={buildProfileURL(profile.id)}>
<a className="Profile">
- <img
- src={_.first(profile.photos)}
- srcSet={buildImgSrcSet(_.first(profile.photos), 250)}
- />
+ <img src={_.first(profile.photos)} srcSet={buildImgSrcSet(_.first(profile.photos), 250)} />
<div className="Text">
<div className="Title">
- <Text
- font="sans-serif"
- lineHeight="20px"
- weight="semiBold"
- size="18px"
- color="#000"
- >
+ <Text font="sans-serif" lineHeight="20px" weight="semiBold" size="18px" color="#000">
{profile.name}
</Text>
</div>
@@ -109,18 +100,16 @@ class SignupForm extends React.Component {
};
}
- setEmail = (evt) => this.setState({ email: evt.target.value });
+ setEmail = evt => this.setState({ email: evt.target.value });
componentDidMount() {
Router.prefetchRoute(`/sign-up/verify`);
}
- handleSubmit = (evt) => {
+ handleSubmit = evt => {
evt.preventDefault();
- Router.pushRoute(
- `/sign-up/verify?${qs.stringify({ email: this.state.email })}`,
- );
+ Router.pushRoute(`/sign-up/verify?${qs.stringify({ email: this.state.email })}`);
};
render() {
@@ -229,8 +218,7 @@ class Homepage extends React.Component {
</div>
<div className="Copy-body">
<Text size="16px" lineHeight="24px" font="sans-serif">
- Create a page where people apply to go on a date with you. You
- pick the winners.
+ Create a page where people apply to go on a date with you. You pick the winners.
</Text>
</div>
@@ -272,9 +260,7 @@ class Homepage extends React.Component {
{this.state.isLoadingProfiles && <div className="Spinner" />}
<div className="FeaturedProfiles">
{!_.isEmpty(this.state.profiles) &&
- this.state.profiles.map((profile) => (
- <FeaturedProfile key={profile.id} profile={profile} />
- ))}
+ this.state.profiles.map(profile => <FeaturedProfile key={profile.id} profile={profile} />)}
</div>
</div>
</footer>
@@ -428,7 +414,7 @@ class Homepage extends React.Component {
}
}
-const HomepageWithStore = withRedux(initStore, null, (dispatch) =>
+const HomepageWithStore = withRedux(initStore, null, dispatch =>
bindActionCreators({ updateEntities, setCurrentUser }, dispatch),
)(LoginGate(Homepage));