@exodus/stasis-core 1.0.0-beta.1 → 1.0.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/bundle.js CHANGED
@@ -1,65 +1,138 @@
1
1
  import {
2
- KNOWN_FORMATS,
3
2
  assert,
4
- fileMapToObject,
3
+ assertArtifactPath,
4
+ canonicalFileKey,
5
+ duplicateKeyError,
5
6
  fileSetToObject,
6
7
  fromEntries,
8
+ flatFileKeys,
9
+ groupModules,
10
+ hasNodeModulesSegment,
7
11
  isPlainObject,
12
+ mergeFormatMaps,
13
+ mergeImportMaps,
14
+ mergeExecutableSets,
15
+ mergeModuleMaps,
8
16
  moduleFileKey,
9
- objectToMaps,
17
+ normalizeBlock,
18
+ normalizeModule,
19
+ normalizeRepo,
20
+ PACKAGE_BLOCK,
21
+ parseEntries,
22
+ parseExecutable,
23
+ parseFormats,
24
+ parseImports,
25
+ serializeEntries,
26
+ serializeExecutable,
27
+ serializeFormats,
28
+ serializeImports,
10
29
  posixPathEscapes,
11
- sortPaths,
30
+ REPO_FIELDS,
31
+ sameGithub,
12
32
  splitNodeModulesPath,
13
- } from './util.js'
33
+ } from './artifact-util.js'
14
34
 
15
35
  const VERSION = 1
16
36
  const LEGACY_VERSION = 0
17
37
 
18
- const normalize = ({ name, version, ecosystem, files }) => {
19
- // `ecosystem` (when present) names the package ecosystem a dependency came from
20
- // (`npm`, `composer`, `soldeer`); the workspace/top-level buckets omit it.
21
- assert(ecosystem === undefined || typeof ecosystem === 'string')
22
- return { name, version, ...(ecosystem === undefined ? {} : { ecosystem }), files: fromEntries(Object.entries(files)) }
23
- }
38
+ const duplicateKey = duplicateKeyError('bundle', 'artifact (bundle=replace)')
24
39
 
40
+ // A v0 path's bucket split; '' and '.' both spell the root listing (rel '').
25
41
  const inferModuleDir = (path) =>
26
- splitNodeModulesPath(path) ?? { dir: '.', rel: path, name: null }
42
+ splitNodeModulesPath(path) ?? { dir: '.', rel: path === '.' ? '' : path, name: null }
43
+
44
+ function contentsLocked() {
45
+ throw new Error('bundle: file contents are not retained by this contents-free Bundle')
46
+ }
47
+
48
+ // Each file stays an own enumerable key, but reading its contents throws; each value must be a placeholder.
49
+ const lockModule = (dir, { files, ...info }) => {
50
+ const locked = Object.create(null)
51
+ for (const [rel, value] of Object.entries(files)) {
52
+ if (typeof value !== 'symbol') assert(false, `bundle: file '${moduleFileKey(dir, rel)}' is not a placeholder`)
53
+ Object.defineProperty(locked, rel, { get: contentsLocked, enumerable: true })
54
+ }
55
+ return { ...info, files: Object.freeze(locked) }
56
+ }
57
+
58
+ // Union of the informational `reason` maps in canonical form: consumers sorted, each file list
59
+ // deduped and path-sorted. Canonical even when only one side is given, so a fresh withReason()
60
+ // stamp or a parsed artifact can't leak discovery/record order into the map (state's
61
+ // #bundleReason sorts the same way). A non-array list (unvalidated -- informational) is dropped.
62
+ const mergeReason = (a, b) => {
63
+ if (a === undefined && b === undefined) return undefined
64
+ // Accumulated in a Map: on a plain object a '__proto__' consumer key would hit the prototype.
65
+ const merged = new Map()
66
+ for (const src of [a, b]) {
67
+ for (const [consumer, files] of Object.entries(src ?? {})) {
68
+ if (!Array.isArray(files)) continue
69
+ let set = merged.get(consumer)
70
+ if (set === undefined) merged.set(consumer, (set = new Set()))
71
+ for (const file of files) set.add(file)
72
+ }
73
+ }
74
+ return fromEntries([...merged.keys()].toSorted().map((c) => [c, fileSetToObject(merged.get(c))]))
75
+ }
76
+
77
+ // Validate one `repo` field without throwing.
78
+ export const isValidRepoField = (key, value) => Object.hasOwn(REPO_FIELDS, key) && REPO_FIELDS[key](value)
79
+
80
+ // `repo` of a bundle plus one added to it: only agreeing fields survive, and none if `github` differs.
81
+ export const mergeRepo = (a, b) => {
82
+ if (a?.github === undefined || !sameGithub(a.github, b?.github)) return undefined
83
+ const kept = Object.keys(REPO_FIELDS).filter((key) => a[key] !== undefined && (key === 'github' || a[key] === b[key]))
84
+ return fromEntries(kept.map((key) => [key, a[key]]))
85
+ }
86
+
87
+ // A parsed header `repo`, an older stasis's `root: true` read as unknown: it recorded one from a
88
+ // package.json's claim as well as from a git work tree.
89
+ const parsedRepo = (repo) => {
90
+ if (!isPlainObject(repo) || repo.root !== true || Object.hasOwn(repo, 'directory')) return repo
91
+ const { root: _root, ...rest } = repo
92
+ return rest
93
+ }
94
+
95
+ // One block per ecosystem, named as a module's `ecosystem` is.
96
+ const PACKAGE_FIELDS = { npm: PACKAGE_BLOCK, composer: PACKAGE_BLOCK, cargo: PACKAGE_BLOCK }
27
97
 
28
- // Bundle handles the JSON shape of stasis.code.br; callers (State) are responsible
29
- // for the brotli wrapper around the JSON text. One unified shape carries both code
30
- // and resources, distinguished per file by `formats[file]` ('resource' = raw UTF-8
31
- // payload, 'resource:base64' = base64-encoded; everything else is code). On-disk
32
- // version:
33
- // v0 — legacy flat layout: top-level `sources` keyed by project-relative path.
34
- // No entries / modules / formats / imports.
35
- // v1 — current layout, mirrors stasis.lock.json: per-package buckets under
36
- // `sources` (workspace) and `modules` (node_modules) with name+version+files,
37
- // plus `entries`, `formats`, and `imports`.
38
- // `Bundle.parse` accepts both; offline tooling (stasis extract / diff / audit /
39
- // sbom) reads v0 -- paths are regrouped by package dir via `inferModuleDir`
40
- // (best-effort, last-wins); name/version stay null since v0 records neither,
41
- // which State uses as a marker to skip metadata cross-checks. `stasis run`
42
- // refuses v0 -- see State's load path. We always serialize v1.
98
+ // `package` of a bundle plus one added to it: per ecosystem, only agreeing fields survive, and none unless `name` does.
99
+ const mergePackage = (a, b) => fromEntries(Object.keys(PACKAGE_FIELDS).map((ecosystem) => {
100
+ const [x, y] = [a?.[ecosystem], b?.[ecosystem]]
101
+ return [ecosystem, x?.name !== undefined && x.name === y?.name ? fromEntries(Object.entries(x).filter(([key, value]) => value === y[key])) : undefined]
102
+ }))
103
+
104
+ // JSON shape of stasis.code.br; callers own the brotli wrap. parse accepts legacy v0 and v1, serialize always writes v1.
43
105
  export class Bundle {
44
106
  static VERSION = VERSION
45
107
 
46
- // The on-disk version this instance represents. Defaults to VERSION; parse*
47
- // sets it to whatever the file declared (LEGACY_VERSION for v0 input).
48
- // Serialization always writes the current VERSION regardless — loading v0 and
49
- // re-saving promotes the bundle to v1.
50
108
  version = VERSION
51
109
  config
52
110
  entries
53
111
  modules
54
112
  formats
55
113
  imports
56
- // Informational only (NOT attested): maps each consumer that recorded a bundled file --
57
- // 'run' (the loader/CLI), 'StasisWebpack', 'StasisMetro', etc. -- to the files it contributed.
58
- // Present only when a single bundle had MORE THAN ONE consumer (e.g. `run` plus a plugin sharing
59
- // the same bundleFile); a single-consumer bundle omits it. Never consulted for verification.
114
+ // Project-relative paths of bundled files carrying a POSIX execute bit, for `stasis extract`. Files only, never a `directory`.
115
+ executable
116
+ // Informational only, NOT attested -- never consulted for verification.
60
117
  reason
118
+ // Informational, not attested, never in a lockfile; validated on every assignment, and frozen.
119
+ #repo
120
+ get repo() {
121
+ return this.#repo
122
+ }
123
+ set repo(repo) {
124
+ this.#repo = normalizeRepo(repo)
125
+ }
126
+ // `{ npm | composer | cargo: { name, version } }`: the package this bundle is; as `repo`, but never set by a build.
127
+ #package
128
+ get package() {
129
+ return this.#package
130
+ }
131
+ set package(pkg) {
132
+ this.#package = normalizeBlock(pkg, PACKAGE_FIELDS, 'bundle package')
133
+ }
61
134
 
62
- constructor({ config = { scope: 'full' }, entries, modules, formats, imports, reason, version = VERSION } = {}) {
135
+ constructor({ config = { scope: 'full' }, entries, modules, formats, imports, executable, reason, repo, package: pkg, version = VERSION } = {}) {
63
136
  assert([LEGACY_VERSION, VERSION].includes(version))
64
137
  assert(['node_modules', 'full'].includes(config.scope))
65
138
  this.version = version
@@ -68,53 +141,61 @@ export class Bundle {
68
141
  this.modules = modules ?? new Map()
69
142
  this.formats = formats ?? new Map()
70
143
  this.imports = imports ?? new Map()
144
+ this.executable = executable ?? new Set()
71
145
  this.reason = reason
146
+ this.repo = normalizeRepo(repo)
147
+ this.package = pkg
72
148
  }
73
149
 
74
- // Flat project-relative view of file contents collected from this.modules.
75
- // Per-file encoding is signalled by `formats[file]`: 'resource:base64' is a
76
- // base64 string, everything else (including 'resource' and 'directory') is a
77
- // raw UTF-8 string.
150
+ // Flat project-relative view of the raw stored file contents (resources stay base64).
78
151
  get sources() {
79
152
  const m = new Map()
80
153
  for (const [dir, { files }] of this.modules) {
81
- for (const [rel, content] of Object.entries(files)) {
82
- m.set(moduleFileKey(dir, rel), content)
83
- }
154
+ for (const [rel, content] of Object.entries(files)) m.set(moduleFileKey(dir, rel), content)
84
155
  }
85
156
  return m
86
157
  }
87
158
 
88
- // True for the resource-like, non-executable payload formats. Their bundle
89
- // content is a raw UTF-8 string ('resource', and 'directory' — a JSON-serialized
90
- // `fs.readdirSync` listing) or a base64 blob ('resource:base64'). State stores
91
- // all three in `this.resources` (vs `this.sources` for code) and the loader's
92
- // executable allowlist rejects them, so this is the single "is this a code file?"
93
- // discriminator. Only 'resource:base64' is base64-decoded; the others are raw.
94
159
  static isResourceFormat(format) {
95
160
  return format === 'resource' || format === 'resource:base64' || format === 'directory'
96
161
  }
97
162
 
98
- // One parser for the unified shape (and legacy v0 code bundles). Resources are just
99
- // files tagged 'resource'/'resource:base64' in `formats`; State splits them back out
100
- // by consulting the formats map.
163
+ // True if any bundled file is non-resource; a full-scope code bundle must declare an entry to be runnable (State#absorbCodeBundle).
164
+ get hasCode() {
165
+ for (const [dir, { files }] of this.modules) {
166
+ for (const rel of Object.keys(files)) {
167
+ if (!Bundle.isResourceFormat(this.formats.get(moduleFileKey(dir, rel)))) return true
168
+ }
169
+ }
170
+ return false
171
+ }
172
+
101
173
  static parse(text) {
102
- const json = JSON.parse(text)
103
- assert(json.version === VERSION || json.version === LEGACY_VERSION)
104
- assert(['node_modules', 'full'].includes(json.config?.scope))
105
- assert(isPlainObject(json.formats))
106
- assert(isPlainObject(json.imports))
174
+ return Bundle.fromJSON(JSON.parse(text))
175
+ }
107
176
 
108
- // Validate `formats` early so downstream branches (hasCode, etc.) can consult
109
- // the typed Map instead of the raw `json.formats` object -- a missing key like
110
- // `__proto__` would otherwise short-circuit on the prototype, and an unknown
111
- // tag would only surface late at a string compare.
112
- const formats = new Map()
113
- for (const [file, format] of Object.entries(json.formats)) {
114
- assert(!posixPathEscapes(file))
115
- assert(KNOWN_FORMATS.has(format), `unknown format '${format}' for ${file}`)
116
- formats.set(file, format)
177
+ // The `sources` key of the file whose contents sit at JSON key path `path`, else undefined; throws if non-canonical.
178
+ static fileKeyAt(path) {
179
+ const [top, dir, files, rel] = path
180
+ if (typeof dir !== 'string') return undefined
181
+ // v0 `sources.<path>`
182
+ if (path.length === 2 && top === 'sources') {
183
+ const split = inferModuleDir(dir)
184
+ return canonicalFileKey(split.dir, split.rel, 'bundle')
117
185
  }
186
+ // v1 `sources|modules.<dir>.files.<rel>`
187
+ if (path.length === 4 && (top === 'sources' || top === 'modules') && files === 'files' && typeof rel === 'string') {
188
+ return canonicalFileKey(dir, rel, 'bundle')
189
+ }
190
+ return undefined
191
+ }
192
+
193
+ // parse() on an already-parsed value; `contents: false` takes a symbol placeholder per file and locks contents out.
194
+ static fromJSON(json, { contents = true } = {}) {
195
+ assert(json.version === VERSION || json.version === LEGACY_VERSION)
196
+ assert(['node_modules', 'full'].includes(json.config?.scope))
197
+ // Validated into a typed Map early: a raw-object lookup like `__proto__` would hit the prototype.
198
+ const formats = parseFormats(json.formats)
118
199
 
119
200
  const modules = new Map()
120
201
  let entries = new Set()
@@ -124,94 +205,45 @@ export class Bundle {
124
205
  if (json.modules !== undefined) {
125
206
  assert(typeof json.modules === 'object' && json.modules !== null)
126
207
  for (const [dir, info] of Object.entries(json.modules)) {
127
- assert(dir.includes('node_modules'))
128
- assert(!posixPathEscapes(dir))
208
+ assert(hasNodeModulesSegment(dir))
209
+ assertArtifactPath(dir, 'bundle')
129
210
  assert(info?.name && info.version && info.files)
130
- modules.set(dir, normalize(info))
211
+ modules.set(dir, normalizeModule(info, dir, 'bundle'))
131
212
  }
132
213
  }
133
214
  if (full) {
134
215
  assert(json.sources && typeof json.sources === 'object')
135
216
  for (const [dir, info] of Object.entries(json.sources)) {
136
- assert(!dir.includes('node_modules'))
137
- assert(!posixPathEscapes(dir))
138
- assert(info?.name && info.version && info.files)
139
- modules.set(dir, normalize(info))
140
- }
141
- // A bundle that carries code in full scope must declare at least one entry:
142
- // empty entries would let `state.assertEntry` skip its check (it short-circuits
143
- // on entries.size === 0 for v0+no-lockfile compatibility), which a tampered
144
- // bundle could exploit. A resources-only bundle has no code files and thus no
145
- // entries -- allowed, since there is nothing for assertEntry to guard.
146
- let hasCode = false
147
- for (const [dir, { files }] of modules) {
148
- for (const rel of Object.keys(files)) {
149
- // moduleFileKey (not `${dir}/${rel}`): a `directory` capture at a module
150
- // root keys at rel === '', whose trailing-slash join would miss its
151
- // resource-format lookup and miscount the listing as code here.
152
- const fp = moduleFileKey(dir, rel)
153
- if (!Bundle.isResourceFormat(formats.get(fp))) { hasCode = true; break }
154
- }
155
- if (hasCode) break
156
- }
157
- if (hasCode) {
158
- assert(Array.isArray(json.entries) && json.entries.length > 0,
159
- 'bundle carrying code in scope=full must have at least one entry')
160
- entries = new Set(json.entries)
161
- } else {
162
- assert(json.entries === undefined || (Array.isArray(json.entries) && json.entries.length === 0))
217
+ assert(!hasNodeModulesSegment(dir))
218
+ assertArtifactPath(dir, 'bundle')
219
+ // A workspace bucket may omit version (a private/unpublished package.json can lack one).
220
+ assert(info?.name && info.files)
221
+ modules.set(dir, normalizeModule(info, dir, 'bundle'))
163
222
  }
223
+ // Empty entries are valid (`stasis add` attests files without making them entry points); state.assertEntry fails closed on an empty set.
224
+ if (json.entries !== undefined) entries = parseEntries(json.entries, 'bundle')
164
225
  } else {
165
226
  assert(json.entries === undefined)
166
227
  assert(json.sources === undefined)
167
228
  }
168
- for (const [, { files }] of modules) {
169
- // posixPathEscapes (not a '..' prefix check) so a mid-path escape or an
170
- // absolute path fails too, matching Lockfile.parse. rel === '' (a
171
- // `directory` capture keyed at a module root) normalizes to '.' and passes.
172
- for (const rel of Object.keys(files)) assert(!posixPathEscapes(rel))
173
- }
174
229
  } else {
175
- // v0 legacy: flat sources at top level, regrouped by inferred module dir.
176
230
  assert(json.sources)
177
231
  for (const [path, content] of Object.entries(json.sources)) {
178
- assert(!posixPathEscapes(path))
232
+ assertArtifactPath(path, 'bundle')
179
233
  const { dir, rel, name } = inferModuleDir(path)
180
234
  assert(!posixPathEscapes(dir) && !posixPathEscapes(rel))
181
235
  if (!modules.has(dir)) modules.set(dir, { name, version: null, files: Object.create(null) })
182
- modules.get(dir).files[rel] = content
236
+ const { files } = modules.get(dir)
237
+ assert(!Object.hasOwn(files, rel), `bundle: duplicate file key '.' (v0 '' and '.')`)
238
+ files[rel] = content
183
239
  }
184
240
  }
185
241
 
186
- // Resolution edges name project-relative files on both sides; getImport
187
- // resolves the target against the project root, so a path that escapes the
188
- // root (including a mid-path `a/../../x`) must be rejected here rather than
189
- // pulling an out-of-tree file in at load time.
190
- const imports = objectToMaps(json.imports)
191
- // An edge target is normally a file string. A `stasis bundle --metro` edge that
192
- // resolves differently per platform is instead a { platform: file } map (which
193
- // objectToMaps has turned into a Map). Validate both shapes; reject anything else
194
- // (e.g. a deeper nesting) so a tampered artifact fails closed at the schema edge.
195
- const assertTarget = (target) => {
196
- if (typeof target === 'string') {
197
- assert(!posixPathEscapes(target))
198
- return
199
- }
200
- assert(target instanceof Map && target.size > 0, 'import target must be a file or a non-empty {platform: file} map')
201
- for (const [platform, file] of target) {
202
- assert(typeof platform === 'string' && platform.length > 0 && !platform.includes('/'), `invalid platform key '${platform}'`)
203
- assert(typeof file === 'string')
204
- assert(!posixPathEscapes(file))
205
- }
206
- }
207
- for (const [, byParent] of imports) {
208
- assert(byParent instanceof Map)
209
- for (const [parent, specifiers] of byParent) {
210
- assert(!posixPathEscapes(parent))
211
- assert(specifiers instanceof Map)
212
- for (const [, target] of specifiers) assertTarget(target)
213
- }
214
- }
242
+ // Flat keys must be unique across buckets: two different bucket splits can flatten to one path, and the `sources` getter would serve either payload.
243
+ const flatKeys = flatFileKeys(modules, 'bundle', duplicateKey)
244
+ const imports = parseImports(json.imports)
245
+
246
+ if (!contents) for (const [dir, info] of modules) modules.set(dir, lockModule(dir, info))
215
247
 
216
248
  return new Bundle({
217
249
  version: json.version,
@@ -220,40 +252,61 @@ export class Bundle {
220
252
  modules,
221
253
  formats,
222
254
  imports,
223
- reason: isPlainObject(json.reason) ? json.reason : undefined, // informational, preserved for round-trip
255
+ // Every executable must be a file this bundle carries. A v0 `executable` is ignored: with no per-file `formats` it could point `extract` at any path to chmod +x.
256
+ executable: json.version === VERSION
257
+ ? parseExecutable(json.executable, { what: 'bundle', files: flatKeys, formats, scope: json.config.scope })
258
+ : new Set(),
259
+ reason: isPlainObject(json.reason) ? json.reason : undefined,
260
+ repo: parsedRepo(json.repo),
261
+ package: json.package,
224
262
  })
225
263
  }
226
264
 
227
- #groupedFromModules() {
228
- const moduleEntries = []
229
- const sourceEntries = []
230
- for (const [dir, { name, version, ecosystem, files }] of this.modules) {
231
- if (Object.keys(files).length === 0) continue
232
- const inNodeModules = dir.includes('node_modules')
233
- if (inNodeModules) assert(name && version && files)
234
- const sorted = fromEntries(Object.entries(files).toSorted((a, b) => sortPaths(a[0], b[0])))
235
- const target = inNodeModules ? moduleEntries : sourceEntries
236
- target.push([dir, { name, version, ...(ecosystem === undefined ? {} : { ecosystem }), files: sorted }])
237
- }
238
- moduleEntries.sort((a, b) => sortPaths(a[0], b[0]))
239
- sourceEntries.sort((a, b) => sortPaths(a[0], b[0]))
240
- return { modules: fromEntries(moduleEntries), sources: fromEntries(sourceEntries) }
241
- }
242
-
243
- // One unified on-disk shape for code AND resources. A file is a resource when its
244
- // `formats` entry is 'resource' (raw UTF-8 content) or 'resource:base64' (binary,
245
- // base64-encoded); every other format is code carrying a raw UTF-8 source string.
246
- // A single bundle can therefore hold both; readers split by consulting `formats`.
247
265
  serialize() {
248
- const entries = fileSetToObject(this.entries)
249
- const { modules, sources } = this.#groupedFromModules()
250
- const formats = fileMapToObject(this.formats)
251
- const imports = fileMapToObject(this.imports)
266
+ // Never write an artifact that parse would reject.
267
+ flatFileKeys(this.modules, 'bundle', duplicateKey)
268
+ const { modules, sources } = groupModules(this.modules, { skipEmpty: true, what: 'bundle' })
269
+ const full = this.config.scope === 'full'
252
270
  const data = { version: VERSION, config: this.config }
253
- if (this.config.scope === 'full') Object.assign(data, { entries, sources })
254
- Object.assign(data, { modules, formats, imports })
255
- // Informational provenance, last: only present when set (more than one consumer).
256
- if (this.reason !== undefined) data.reason = this.reason
271
+ if (this.repo !== undefined) data.repo = this.repo
272
+ if (this.package !== undefined) data.package = this.package
273
+ if (full) data.entries = serializeEntries(this.entries, 'bundle')
274
+ data.formats = serializeFormats(this.formats)
275
+ data.imports = serializeImports(this.imports)
276
+ const executable = serializeExecutable(this.executable, {
277
+ what: 'bundle', modules: this.modules, formats: this.formats, scope: this.config.scope,
278
+ })
279
+ if (executable !== undefined) data.executable = executable
280
+ // Canonicalized like every other sorted field, so a parsed artifact's order can't leak into the bytes.
281
+ if (this.reason !== undefined) data.reason = mergeReason(this.reason, undefined)
282
+ // File contents are written last, after every other key: sources, then modules.
283
+ if (full) data.sources = sources
284
+ data.modules = modules
257
285
  return JSON.stringify(data, undefined, 2)
258
286
  }
287
+
288
+ // Stamp `consumer` onto every carried file in the informational `reason` map.
289
+ withReason(consumer) {
290
+ const { version, config, entries, modules, formats, imports, executable, repo, package: pkg } = this
291
+ const reason = mergeReason(this.reason, { [consumer]: [...this.sources.keys()] })
292
+ return new Bundle({ version, config, entries, modules, formats, imports, executable, reason, repo, package: pkg })
293
+ }
294
+
295
+ // Strict union of two Bundles (returns a NEW one): any genuine conflict throws -- a bundle is an attestation.
296
+ merge(other) {
297
+ assert(this.config.scope === other.config.scope,
298
+ `bundle merge: scope mismatch ('${this.config.scope}' vs '${other.config.scope}')`)
299
+ return new Bundle({
300
+ config: { scope: this.config.scope },
301
+ entries: new Set([...this.entries, ...other.entries]),
302
+ modules: mergeModuleMaps(this.modules, other.modules, 'bundle merge'),
303
+ formats: mergeFormatMaps(this.formats, other.formats, 'bundle merge'),
304
+ imports: mergeImportMaps(this.imports, other.imports, 'bundle merge'),
305
+ // `other` (the incoming, newer build) wins for the files it carries -- see mergeExecutableSets.
306
+ executable: mergeExecutableSets(this.executable, other.executable, other.modules, this.config.scope),
307
+ reason: mergeReason(this.reason, other.reason),
308
+ repo: mergeRepo(this.repo, other.repo),
309
+ package: mergePackage(this.package, other.package),
310
+ })
311
+ }
259
312
  }