@exodus/stasis-core 1.0.0-beta.16 → 1.0.0-beta.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/stasis-core",
3
- "version": "1.0.0-beta.16",
3
+ "version": "1.0.0-beta.17",
4
4
  "description": "Zero-dependency stasis runtime",
5
5
  "type": "module",
6
6
  "exports": {
@@ -153,7 +153,7 @@ const normalizeDirMetadata = (field, dir, { name, ecosystem, files, [field]: ent
153
153
  return carried
154
154
  }
155
155
 
156
- const RECORD_METADATA = { integrity: normalizeModuleIntegrity, repo: normalizeModuleRepo, patch: normalizeModulePatch }
156
+ const RECORD_METADATA = { integrity: normalizeModuleIntegrity, patch: normalizeModulePatch, repo: normalizeModuleRepo }
157
157
  const DIR_FIELDS = Object.keys(DIR_METADATA)
158
158
  const MODULE_METADATA = [...Object.keys(RECORD_METADATA), ...DIR_FIELDS]
159
159
  const OPTIONAL_KEYS = ['ecosystem', ...MODULE_METADATA]
package/src/bundle.js CHANGED
@@ -117,7 +117,8 @@ const mergePackage = (a, b) => fromEntries(Object.keys(PACKAGE_FIELDS).map((ecos
117
117
  export class Bundle {
118
118
  static VERSION = VERSION
119
119
 
120
- // Informational, not attested, never in a lockfile; validated on every assignment, and frozen.
120
+ // Informational, not attested; validated on every assignment, and frozen. In a lockfile of a GitHub build's alone
121
+ // (Lockfile#repo), never one of a bundle's.
121
122
  #repo
122
123
  get repo() {
123
124
  return this.#repo
package/src/lockfile.js CHANGED
@@ -1,4 +1,4 @@
1
- import { assert, assertScope, duplicateKeyError, flatFileKeys, isPlainObject, mergeExecutableSets, mergeFormatMaps, mergeImportMaps, mergeModuleMaps, moduleFileKey, moduleFileKeys, moduleInfo, parseBuckets, parseEntries, parseExecutable, parseFormats, parseImports, serializedParts } from './artifact-util.js'
1
+ import { assert, assertScope, duplicateKeyError, flatFileKeys, isPlainObject, mergeExecutableSets, mergeFormatMaps, mergeImportMaps, mergeModuleMaps, moduleFileKey, moduleFileKeys, moduleInfo, normalizeRepo, parseBuckets, parseEntries, parseExecutable, parseFormats, parseImports, serializedParts } from './artifact-util.js'
2
2
 
3
3
  const VERSION = 0
4
4
 
@@ -12,9 +12,21 @@ export class Lockfile {
12
12
 
13
13
  version = VERSION
14
14
 
15
- constructor({ config = { scope: 'full' }, entries, modules, imports, formats, executable } = {}) {
15
+ // Where a GitHub build's (`stasis github-bundle`'s) was built, as a bundle's `repo`; validated on every
16
+ // assignment, and frozen. Only github-bundle writes one, and holds a build to it; `stasis validate` reads own code
17
+ // of it. Neither `stasis bundle` nor `stasis run` reads one: a merge, or a lockfile of a bundle, carries none.
18
+ #repo
19
+ get repo() {
20
+ return this.#repo
21
+ }
22
+ set repo(repo) {
23
+ this.#repo = normalizeRepo(repo, 'lockfile repo')
24
+ }
25
+
26
+ constructor({ config = { scope: 'full' }, entries, modules, imports, formats, executable, repo } = {}) {
16
27
  assertScope(config.scope, 'lockfile')
17
28
  this.config = config
29
+ this.repo = repo
18
30
  this.entries = entries ?? new Set()
19
31
  this.modules = modules ?? new Map()
20
32
  // conditions -> parent -> specifier -> resolved file, and file -> format: null only on an in-memory construct.
@@ -50,13 +62,13 @@ export class Lockfile {
50
62
  const imports = parseImports(json.imports)
51
63
  const formats = parseFormats(json.formats)
52
64
  const executable = parseExecutable(json.executable, { what: 'lockfile', files: flatKeys, formats, scope: json.config.scope })
53
- return new Lockfile({ config: json.config, entries, modules, imports, formats, executable })
65
+ return new Lockfile({ config: json.config, entries, modules, imports, formats, executable, repo: json.repo })
54
66
  }
55
67
 
56
68
  serialize() {
57
69
  flatFileKeys(this.modules, 'lockfile', duplicateKey)
58
70
  const { entries, sources, modules, imports, formats, executable } = serializedParts(this, 'lockfile', { metadata: LOCK_METADATA })
59
- const store = { version: this.version, config: this.config, entries, sources, modules, imports, formats, executable }
71
+ const store = { version: this.version, config: this.config, repo: this.repo, entries, sources, modules, imports, formats, executable }
60
72
  return JSON.stringify(store, undefined, 2) + '\n'
61
73
  }
62
74