implement pnpm migration (#22262)

### What does this PR do?

fixes #7157, fixes #14662

migrates pnpm-workspace.yaml data to package.json & converts
pnpm-lock.yml to bun.lock

---

### How did you verify your code works?

manually, tests and real world examples

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
This commit is contained in:
Michael H
2025-09-27 17:45:29 +10:00
committed by GitHub
parent 8c9c7894d6
commit ba20670da3
53 changed files with 5864 additions and 396 deletions

View File

@@ -752,7 +752,7 @@ pub const Object = struct {
pub fn hasProperty(obj: *const Object, name: string) bool {
for (obj.properties.slice()) |prop| {
const key = prop.key orelse continue;
if (std.meta.activeTag(key.data) != .e_string) continue;
if (key.data != .e_string) continue;
if (key.data.e_string.eql(string, name)) return true;
}
return false;
@@ -762,7 +762,7 @@ pub const Object = struct {
for (obj.properties.slice(), 0..) |prop, i| {
const value = prop.value orelse continue;
const key = prop.key orelse continue;
if (std.meta.activeTag(key.data) != .e_string) continue;
if (key.data != .e_string) continue;
const key_str = key.data.e_string;
if (key_str.eql(string, name)) {
return Expr.Query{

View File

@@ -132,14 +132,14 @@ pub fn isEmpty(expr: Expr) bool {
pub const Query = struct { expr: Expr, loc: logger.Loc, i: u32 = 0 };
pub fn hasAnyPropertyNamed(expr: *const Expr, comptime names: []const string) bool {
if (std.meta.activeTag(expr.data) != .e_object) return false;
if (expr.data != .e_object) return false;
const obj = expr.data.e_object;
if (obj.properties.len == 0) return false;
for (obj.properties.slice()) |prop| {
if (prop.value == null) continue;
const key = prop.key orelse continue;
if (std.meta.activeTag(key.data) != .e_string) continue;
if (key.data != .e_string) continue;
const key_str = key.data.e_string;
if (strings.eqlAnyComptime(key_str.data, names)) return true;
}
@@ -266,7 +266,7 @@ pub fn set(expr: *Expr, allocator: std.mem.Allocator, name: string, value: Expr)
for (0..expr.data.e_object.properties.len) |i| {
const prop = &expr.data.e_object.properties.ptr[i];
const key = prop.key orelse continue;
if (std.meta.activeTag(key.data) != .e_string) continue;
if (key.data != .e_string) continue;
if (key.data.e_string.eql(string, name)) {
prop.value = value;
return;
@@ -288,7 +288,7 @@ pub fn setString(expr: *Expr, allocator: std.mem.Allocator, name: string, value:
for (0..expr.data.e_object.properties.len) |i| {
const prop = &expr.data.e_object.properties.ptr[i];
const key = prop.key orelse continue;
if (std.meta.activeTag(key.data) != .e_string) continue;
if (key.data != .e_string) continue;
if (key.data.e_string.eql(string, name)) {
prop.value = Expr.init(E.String, .{ .data = value }, logger.Loc.Empty);
return;
@@ -310,6 +310,15 @@ pub fn getObject(expr: *const Expr, name: string) ?Expr {
return null;
}
pub fn getBoolean(expr: *const Expr, name: string) ?bool {
if (expr.asProperty(name)) |query| {
if (query.expr.data == .e_boolean) {
return query.expr.data.e_boolean.value;
}
}
return null;
}
pub fn getString(expr: *const Expr, allocator: std.mem.Allocator, name: string) OOM!?struct { string, logger.Loc } {
if (asProperty(expr, name)) |q| {
if (q.expr.asString(allocator)) |str| {
@@ -385,7 +394,7 @@ pub fn getRope(self: *const Expr, rope: *const E.Object.Rope) ?E.Object.RopeQuer
// Making this comptime bloats the binary and doesn't seem to impact runtime performance.
pub fn asProperty(expr: *const Expr, name: string) ?Query {
if (std.meta.activeTag(expr.data) != .e_object) return null;
if (expr.data != .e_object) return null;
const obj = expr.data.e_object;
if (obj.properties.len == 0) return null;
@@ -393,7 +402,7 @@ pub fn asProperty(expr: *const Expr, name: string) ?Query {
}
pub fn asPropertyStringMap(expr: *const Expr, name: string, allocator: std.mem.Allocator) ?*bun.StringArrayHashMap(string) {
if (std.meta.activeTag(expr.data) != .e_object) return null;
if (expr.data != .e_object) return null;
const obj_ = expr.data.e_object;
if (obj_.properties.len == 0) return null;
const query = obj_.asProperty(name) orelse return null;
@@ -439,7 +448,7 @@ pub const ArrayIterator = struct {
};
pub fn asArray(expr: *const Expr) ?ArrayIterator {
if (std.meta.activeTag(expr.data) != .e_array) return null;
if (expr.data != .e_array) return null;
const array = expr.data.e_array;
if (array.items.len == 0) return null;
@@ -455,7 +464,7 @@ pub inline fn asUtf8StringLiteral(expr: *const Expr) ?string {
}
pub inline fn asStringLiteral(expr: *const Expr, allocator: std.mem.Allocator) ?string {
if (std.meta.activeTag(expr.data) != .e_string) return null;
if (expr.data != .e_string) return null;
return expr.data.e_string.string(allocator) catch null;
}
@@ -501,7 +510,7 @@ pub inline fn asStringZ(expr: *const Expr, allocator: std.mem.Allocator) OOM!?st
pub fn asBool(
expr: *const Expr,
) ?bool {
if (std.meta.activeTag(expr.data) != .e_boolean) return null;
if (expr.data != .e_boolean) return null;
return expr.data.e_boolean.value;
}
@@ -522,7 +531,7 @@ const Serializable = struct {
};
pub fn isMissing(a: *const Expr) bool {
return std.meta.activeTag(a.data) == Expr.Tag.e_missing;
return a.data == Expr.Tag.e_missing;
}
// The goal of this function is to "rotate" the AST if it's possible to use the

View File

@@ -954,7 +954,7 @@ pub fn NewParser_(
switch (call.target.data) {
.e_identifier => |ident| {
// is this a require("something")
if (strings.eqlComptime(p.loadNameFromRef(ident.ref), "require") and call.args.len == 1 and std.meta.activeTag(call.args.ptr[0].data) == .e_string) {
if (strings.eqlComptime(p.loadNameFromRef(ident.ref), "require") and call.args.len == 1 and call.args.ptr[0].data == .e_string) {
_ = p.addImportRecord(.require, loc, call.args.at(0).data.e_string.string(p.allocator) catch unreachable);
}
},
@@ -970,7 +970,7 @@ pub fn NewParser_(
switch (call.target.data) {
.e_identifier => |ident| {
// is this a require("something")
if (strings.eqlComptime(p.loadNameFromRef(ident.ref), "require") and call.args.len == 1 and std.meta.activeTag(call.args.ptr[0].data) == .e_string) {
if (strings.eqlComptime(p.loadNameFromRef(ident.ref), "require") and call.args.len == 1 and call.args.ptr[0].data == .e_string) {
_ = p.addImportRecord(.require, loc, call.args.at(0).data.e_string.string(p.allocator) catch unreachable);
}
},

View File

@@ -64,7 +64,7 @@ pub fn VisitExpr(
}
pub fn e_import_meta(p: *P, expr: Expr, in: ExprIn) Expr {
// TODO: delete import.meta might not work
const is_delete_target = std.meta.activeTag(p.delete_target) == .e_import_meta;
const is_delete_target = p.delete_target == .e_import_meta;
if (p.define.dots.get("meta")) |meta| {
for (meta) |define| {