wyvrnpm 2.0.2 → 2.0.4

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/resolve.js +24 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wyvrnpm",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "description": "A simple, static-hosting-compatible C++ package manager",
5
5
  "keywords": [
6
6
  "c++",
package/src/resolve.js CHANGED
@@ -121,6 +121,30 @@ async function fetchPackageManifest(name, version, packageSources, platform, htt
121
121
 
122
122
  for (const source of packageSources) {
123
123
  const base = source.replace(/\/$/, '');
124
+
125
+ // v2: look up any available profile hash from versions.json, then fetch that manifest
126
+ try {
127
+ const idxResp = await httpClient(`${base}/v2/${name}/versions.json`);
128
+ if (idxResp.ok) {
129
+ const idx = await idxResp.json();
130
+ const profiles = idx?.versions?.[version]?.profiles;
131
+ if (profiles) {
132
+ const profileHash = Object.keys(profiles)[0];
133
+ if (profileHash) {
134
+ const mResp = await httpClient(`${base}/v2/${name}/${version}/${profileHash}/wyvrn.json`);
135
+ if (mResp.ok) {
136
+ const data = await mResp.json();
137
+ cache.set(cacheKey, data);
138
+ return data;
139
+ }
140
+ }
141
+ }
142
+ }
143
+ } catch {
144
+ // fall through to v1
145
+ }
146
+
147
+ // v1 legacy paths
124
148
  const candidates = [
125
149
  `${base}/${platform}/${name}/${version}/wyvrn.json`,
126
150
  `${base}/${platform}/${name}/${version}/razer.json`,