@neon-rs/manifest 0.0.6 → 0.1.0

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.
@@ -21,6 +21,15 @@ function assertIsLibraryCfg(json) {
21
21
  }
22
22
  }
23
23
  }
24
+ function isEmptyFamily(family) {
25
+ if (typeof family === 'string') {
26
+ return false;
27
+ }
28
+ if (Array.isArray(family)) {
29
+ return family.length === 0;
30
+ }
31
+ return Object.keys(family).length === 0;
32
+ }
24
33
  function assertHasLibraryCfg(json) {
25
34
  (0, neon_cjs_1.assertHasNeonCfg)(json);
26
35
  assertIsLibraryCfg(json.neon);
@@ -120,15 +129,15 @@ class LibraryManifest extends util_cjs_1.AbstractManifest {
120
129
  this.cfg().platforms = [platformsSrc, preset];
121
130
  await this.addPlatforms((0, platform_cjs_1.expandPlatformFamily)(preset));
122
131
  }
132
+ // Edge case: use the string shorthand source format for a single preset
133
+ else if (isEmptyFamily(platformsSrc)) {
134
+ this.cfg().platforms = preset;
135
+ await this.addPlatforms((0, platform_cjs_1.expandPlatformFamily)(preset));
136
+ }
123
137
  else if (Array.isArray(platformsSrc)) {
124
138
  platformsSrc.push(preset);
125
139
  await this.addPlatforms((0, platform_cjs_1.expandPlatformFamily)(preset));
126
140
  }
127
- // Edge case: an empty object can be treated like an empty array
128
- else if (Object.keys(platformsSrc).length === 0) {
129
- this.cfg().platforms = [];
130
- await this.addPlatformPreset(preset);
131
- }
132
141
  else {
133
142
  const added = await this.addPlatforms((0, platform_cjs_1.expandPlatformFamily)(preset));
134
143
  Object.assign(platformsSrc, added);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@neon-rs/manifest",
3
3
  "private": false,
4
- "version": "0.0.6",
4
+ "version": "0.1.0",
5
5
  "description": "Library for working with Neon package configuration.",
6
6
  "exports": {
7
7
  ".": {