aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/api/demo/schema.d.ts1
-rw-r--r--src/api/demo/schema.js4
-rw-r--r--src/api/demo/schema.peechy1
-rw-r--r--src/api/demo/schema.zig10
-rw-r--r--src/api/schema.d.ts1
-rw-r--r--src/api/schema.js10
-rw-r--r--src/api/schema.peechy1
-rw-r--r--src/api/schema.zig10
-rw-r--r--src/bunfig.zig6
-rw-r--r--src/install/install.zig13
10 files changed, 57 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();
}
};
diff --git a/src/bunfig.zig b/src/bunfig.zig
index 9df2978b0..597fb0985 100644
--- a/src/bunfig.zig
+++ b/src/bunfig.zig
@@ -322,6 +322,12 @@ pub const Bunfig = struct {
}
}
+ if (_bun.get("frozenLockfile")) |frozen_lockfile| {
+ if (frozen_lockfile.asBool()) |value| {
+ install.frozen_lockfile = value;
+ }
+ }
+
if (_bun.get("lockfile")) |lockfile_expr| {
if (lockfile_expr.get("print")) |lockfile| {
try this.expect(lockfile, .e_string);
diff --git a/src/install/install.zig b/src/install/install.zig
index 32c24548c..81e2a7bb8 100644
--- a/src/install/install.zig
+++ b/src/install/install.zig
@@ -4443,6 +4443,12 @@ pub const PackageManager = struct {
}
}
+ if (bun_install.frozen_lockfile) |frozen_lockfile| {
+ if (frozen_lockfile) {
+ this.enable.frozen_lockfile = true;
+ }
+ }
+
if (bun_install.save_optional) |save| {
this.remote_package_features.optional_dependencies = save;
this.local_package_features.optional_dependencies = save;
@@ -4676,6 +4682,10 @@ pub const PackageManager = struct {
this.enable.frozen_lockfile = true;
}
+ if (cli.frozen_lockfile) {
+ this.enable.frozen_lockfile = true;
+ }
+
if (cli.force) {
this.enable.manifest_cache_control = false;
this.enable.force_install = true;
@@ -5649,6 +5659,7 @@ pub const PackageManager = struct {
clap.parseParam("--save Save to package.json") catch unreachable,
clap.parseParam("--dry-run Don't install anything") catch unreachable,
clap.parseParam("--lockfile <PATH> Store & load a lockfile at a specific filepath") catch unreachable,
+ clap.parseParam("--frozen-lockfile Disallow changes to lockfile") catch unreachable,
clap.parseParam("-f, --force Always request the latest versions from the registry & reinstall all dependencies") catch unreachable,
clap.parseParam("--cache-dir <PATH> Store & load cached data from a specific directory path") catch unreachable,
clap.parseParam("--no-cache Ignore manifest cache entirely") catch unreachable,
@@ -5709,6 +5720,7 @@ pub const PackageManager = struct {
yarn: bool = false,
production: bool = false,
+ frozen_lockfile: bool = false,
no_save: bool = false,
dry_run: bool = false,
force: bool = false,
@@ -5777,6 +5789,7 @@ pub const PackageManager = struct {
var cli = CommandLineArguments{};
cli.yarn = args.flag("--yarn");
cli.production = args.flag("--production");
+ cli.frozen_lockfile = args.flag("--frozen-lockfile");
cli.no_progress = args.flag("--no-progress");
cli.dry_run = args.flag("--dry-run");
cli.global = args.flag("--global");