diff options
author | 2023-06-26 01:43:39 +0200 | |
---|---|---|
committer | 2023-06-25 16:43:39 -0700 | |
commit | d8817c2d32a237440a7677622ba351aa95f47c22 (patch) | |
tree | 7dd24039b7c56f0e59b14e3b3f2a6debc2ed8985 /src/api | |
parent | 15ac08474ef0b18b94bbf4863b2497e18e968379 (diff) | |
download | bun-d8817c2d32a237440a7677622ba351aa95f47c22.tar.gz bun-d8817c2d32a237440a7677622ba351aa95f47c22.tar.zst bun-d8817c2d32a237440a7677622ba351aa95f47c22.zip |
Add support for install with --frozen-lockfile (#3365)
* Add support for install with --frozen-lockfile
* Add test
* Add test for frozenLockfile in config file
Diffstat (limited to 'src/api')
-rw-r--r-- | src/api/demo/schema.d.ts | 1 | ||||
-rw-r--r-- | src/api/demo/schema.js | 4 | ||||
-rw-r--r-- | src/api/demo/schema.peechy | 1 | ||||
-rw-r--r-- | src/api/demo/schema.zig | 10 | ||||
-rw-r--r-- | src/api/schema.d.ts | 1 | ||||
-rw-r--r-- | src/api/schema.js | 10 | ||||
-rw-r--r-- | src/api/schema.peechy | 1 | ||||
-rw-r--r-- | src/api/schema.zig | 10 |
8 files changed, 38 insertions, 0 deletions
diff --git a/src/api/demo/schema.d.ts b/src/api/demo/schema.d.ts index 6f3949c77..e8a6994e7 100644 --- a/src/api/demo/schema.d.ts +++ b/src/api/demo/schema.d.ts @@ -681,6 +681,7 @@ export interface BunInstall { disable_manifest_cache?: boolean; global_dir?: string; global_bin_dir?: string; + frozen_lockfile?: boolean; } export declare function encodeStackFrame(message: StackFrame, bb: ByteBuffer): void; diff --git a/src/api/demo/schema.js b/src/api/demo/schema.js index 7bdd13b65..d23d64a14 100644 --- a/src/api/demo/schema.js +++ b/src/api/demo/schema.js @@ -2992,6 +2992,10 @@ function decodeBunInstall(bb) { result["global_bin_dir"] = bb.readString(); break; + case 19: + result["frozen-lockfile"] = !!bb.readByte(); + break; + default: throw new Error("Attempted to parse invalid message"); } diff --git a/src/api/demo/schema.peechy b/src/api/demo/schema.peechy index 09d3c1fac..e495bb9c0 100644 --- a/src/api/demo/schema.peechy +++ b/src/api/demo/schema.peechy @@ -550,4 +550,5 @@ message BunInstall { bool disable_manifest_cache = 16; string global_dir = 17; string global_bin_dir = 18; + string frozen_lockfile = 19; } diff --git a/src/api/demo/schema.zig b/src/api/demo/schema.zig index d57a5c725..a6de100de 100644 --- a/src/api/demo/schema.zig +++ b/src/api/demo/schema.zig @@ -2728,6 +2728,9 @@ pub const Api = struct { /// global_bin_dir global_bin_dir: ?[]const u8 = null, + /// frozen_lockfile + frozen_lockfile: ?bool = null, + pub fn decode(reader: anytype) anyerror!BunInstall { var this = std.mem.zeroes(BunInstall); @@ -2791,6 +2794,9 @@ pub const Api = struct { 18 => { this.global_bin_dir = try reader.readValue([]const u8); }, + 19 => { + this.frozen_lockfile = try reader.readValue(bool); + }, else => { return error.InvalidMessage; }, @@ -2872,6 +2878,10 @@ pub const Api = struct { try writer.writeFieldID(18); try writer.writeValue(@TypeOf(global_bin_dir), global_bin_dir); } + if (this.frozen_lockfile) |frozen_lockfile| { + try writer.writeFieldID(19); + try writer.writeInt(@as(u8, @boolToInt(frozen_lockfile))); + } try writer.endMessage(); } }; diff --git a/src/api/schema.d.ts b/src/api/schema.d.ts index 4114d951d..ac6183878 100644 --- a/src/api/schema.d.ts +++ b/src/api/schema.d.ts @@ -709,6 +709,7 @@ export interface BunInstall { disable_manifest_cache?: boolean; global_dir?: string; global_bin_dir?: string; + frozen_lockfile?: boolean; } export interface ClientServerModule { diff --git a/src/api/schema.js b/src/api/schema.js index c4f2400ed..270eb9a62 100644 --- a/src/api/schema.js +++ b/src/api/schema.js @@ -3044,6 +3044,10 @@ function decodeBunInstall(bb) { result["global_bin_dir"] = bb.readString(); break; + case 19: + result["frozen_lockfile"] = !!bb.readByte(); + break; + default: throw new Error("Attempted to parse invalid message"); } @@ -3164,6 +3168,12 @@ function encodeBunInstall(message, bb) { bb.writeByte(18); bb.writeString(value); } + + var value = message["frozen_lockfile"]; + if (value != null) { + bb.writeByte(19); + bb.writeByte(value); + } bb.writeByte(0); } diff --git a/src/api/schema.peechy b/src/api/schema.peechy index 71e85d68e..6d28381c4 100644 --- a/src/api/schema.peechy +++ b/src/api/schema.peechy @@ -590,6 +590,7 @@ message BunInstall { bool disable_manifest_cache = 16; string global_dir = 17; string global_bin_dir = 18; + bool frozen_lockfile = 19; } struct ClientServerModule { diff --git a/src/api/schema.zig b/src/api/schema.zig index 1012e6051..708d32ca0 100644 --- a/src/api/schema.zig +++ b/src/api/schema.zig @@ -2901,6 +2901,9 @@ pub const Api = struct { /// global_bin_dir global_bin_dir: ?[]const u8 = null, + /// frozen_lockfile + frozen_lockfile: ?bool = null, + pub fn decode(reader: anytype) anyerror!BunInstall { var this = std.mem.zeroes(BunInstall); @@ -2964,6 +2967,9 @@ pub const Api = struct { 18 => { this.global_bin_dir = try reader.readValue([]const u8); }, + 19 => { + this.frozen_lockfile = try reader.readValue(bool); + }, else => { return error.InvalidMessage; }, @@ -3045,6 +3051,10 @@ pub const Api = struct { try writer.writeFieldID(18); try writer.writeValue(@TypeOf(global_bin_dir), global_bin_dir); } + if (this.frozen_lockfile) |frozen_lockfile| { + try writer.writeFieldID(19); + try writer.writeInt(@as(u8, @boolToInt(frozen_lockfile))); + } try writer.endMessage(); } }; |