npm-pkgbuild 10.19.10 → 10.20.1

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": "npm-pkgbuild",
3
- "version": "10.19.10",
3
+ "version": "10.20.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -113,25 +113,32 @@ export async function* extractFromPackage(options = {}, env = {}) {
113
113
  ? [packageContent.pkgbuild]
114
114
  : []) {
115
115
  const requires = pkgbuild.requires;
116
+ delete pkgbuild.requires;
117
+
118
+ let priority = 1;
119
+
116
120
  if (requires) {
121
+ let fullfilled = true;
122
+
117
123
  if (requires.properties) {
118
- let fullfilled = true;
119
124
  for (const [k, v] of Object.entries(requires.properties)) {
120
125
  if (root.properties[k] !== v) {
121
126
  fullfilled = false;
122
127
  break;
123
128
  }
124
129
  }
125
- if (!fullfilled) {
126
- continue;
127
- }
128
- delete pkgbuild.requires;
129
130
  }
130
131
 
131
132
  if (requires.environment) {
132
133
  if (env[requires.environment.has] === undefined) {
133
- continue;
134
+ fullfilled = false;
134
135
  }
136
+ priority++;
137
+ }
138
+
139
+ if (!fullfilled) {
140
+ console.log("requirement not fullfilled", requires);
141
+ continue;
135
142
  }
136
143
  }
137
144
 
@@ -139,7 +146,8 @@ export async function* extractFromPackage(options = {}, env = {}) {
139
146
  name: `${packageContent.name}[${i++}]`,
140
147
  depends: packageContent.engines || {},
141
148
  arch: new Set(),
142
- restrictArch: new Set()
149
+ restrictArch: new Set(),
150
+ priority
143
151
  };
144
152
 
145
153
  if (packageContent.cpu) {
@@ -221,7 +229,6 @@ export async function* extractFromPackage(options = {}, env = {}) {
221
229
  fragments[fragment.name] = fragment;
222
230
 
223
231
  if (pkgbuild.variant) {
224
- fragment.priority = 1;
225
232
  variants[pkgbuild.variant] = fragment;
226
233
  }
227
234
 
@@ -241,7 +248,9 @@ export async function* extractFromPackage(options = {}, env = {}) {
241
248
  //console.log("FRAGMENTS", Object.keys(fragments));
242
249
  //console.log("VARIANTS", variants);
243
250
 
244
- for (const [name, variant] of Object.entries(variants)) {
251
+ for (const [name, variant] of Object.entries(variants).sort(
252
+ ([ua, a], [ub, b]) => a.priority - b.priority
253
+ )) {
245
254
  let arch = variant.arch;
246
255
  const properties = {};
247
256
  const depends = {};