mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
fix invalid pointer
This commit is contained in:
committed by
Meghan Denny
parent
0b11991811
commit
d2ff2cc1dc
@@ -9548,16 +9548,19 @@ pub const PackageManager = struct {
|
||||
.auto,
|
||||
);
|
||||
|
||||
// might need to read scripts from disk if we are migrating from package-lock.json
|
||||
const buf = this.lockfile.buffers.string_bytes.items;
|
||||
// need to clone because this is a copy before Lockfile.cleanWithLogger
|
||||
const name = this.allocator.dupe(u8, root_package.name.slice(buf)) catch bun.outOfMemory();
|
||||
const top_level_dir_without_trailing_slash = strings.withoutTrailingSlash(FileSystem.instance.top_level_dir);
|
||||
|
||||
if (root_package.scripts.hasAny()) {
|
||||
const add_node_gyp_rebuild_script = root_package.scripts.install.isEmpty() and root_package.scripts.preinstall.isEmpty() and Syscall.exists(binding_dot_gyp_path);
|
||||
|
||||
this.root_lifecycle_scripts = root_package.scripts.createList(
|
||||
this.lockfile,
|
||||
this.lockfile.buffers.string_bytes.items,
|
||||
strings.withoutTrailingSlash(FileSystem.instance.top_level_dir),
|
||||
root_package.name.slice(this.lockfile.buffers.string_bytes.items),
|
||||
buf,
|
||||
top_level_dir_without_trailing_slash,
|
||||
name,
|
||||
.root,
|
||||
add_node_gyp_rebuild_script,
|
||||
);
|
||||
@@ -9566,9 +9569,9 @@ pub const PackageManager = struct {
|
||||
// no scripts exist but auto node gyp script needs to be added
|
||||
this.root_lifecycle_scripts = root_package.scripts.createList(
|
||||
this.lockfile,
|
||||
this.lockfile.buffers.string_bytes.items,
|
||||
strings.withoutTrailingSlash(FileSystem.instance.top_level_dir),
|
||||
root_package.name.slice(this.lockfile.buffers.string_bytes.items),
|
||||
buf,
|
||||
top_level_dir_without_trailing_slash,
|
||||
name,
|
||||
.root,
|
||||
true,
|
||||
);
|
||||
@@ -9942,14 +9945,18 @@ pub const PackageManager = struct {
|
||||
manager.lockfile.verifyResolutions(manager.options.local_package_features, manager.options.remote_package_features, log_level);
|
||||
}
|
||||
|
||||
{
|
||||
// append scripts to lockfile before generating new metahash
|
||||
manager.loadRootLifecycleScripts(root);
|
||||
|
||||
// append scripts to lockfile before generating new metahash
|
||||
manager.loadRootLifecycleScripts(root);
|
||||
defer {
|
||||
if (manager.root_lifecycle_scripts) |root_scripts| {
|
||||
root_scripts.appendToLockfile(manager.lockfile);
|
||||
manager.allocator.free(root_scripts.package_name);
|
||||
}
|
||||
}
|
||||
|
||||
if (manager.root_lifecycle_scripts) |root_scripts| {
|
||||
root_scripts.appendToLockfile(manager.lockfile);
|
||||
}
|
||||
{
|
||||
const packages = manager.lockfile.packages.slice();
|
||||
for (packages.items(.resolution), packages.items(.meta), packages.items(.scripts)) |resolution, meta, scripts| {
|
||||
if (resolution.tag == .workspace) {
|
||||
|
||||
Reference in New Issue
Block a user