@gjsify/npm-registry 0.3.21 → 0.4.3

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.
@@ -0,0 +1 @@
1
+ var e=Object.defineProperty,__name=(t,n)=>e(t,`name`,{value:n,configurable:!0});export{__name};
package/lib/esm/index.js CHANGED
@@ -1 +1 @@
1
- const e=`https://registry.npmjs.org/`;function assertPackument(e,t){if(!t||typeof t!=`object`)throw TypeError(`registry: ${e} packument is not an object`);let n=t;if(typeof n.name!=`string`)throw TypeError(`registry: ${e} packument missing string name`);if(!n.versions||typeof n.versions!=`object`)throw TypeError(`registry: ${e} packument missing versions map`)}function registryFor(t,n){if(n&&t.startsWith(`@`)){let e=t.slice(0,t.indexOf(`/`)),r=n.scopes[e];if(r)return ensureTrailingSlash(r)}return n?.registry?ensureTrailingSlash(n.registry):e}function packumentUrl(e,t){let n=ensureTrailingSlash(t);if(e.startsWith(`@`)){let t=e.indexOf(`/`);if(t<0)throw TypeError(`Invalid scoped package name: ${e}`);let r=e.slice(0,t),i=e.slice(t+1);return`${n}${encodeURIComponent(r)}/${encodeURIComponent(i)}`}return`${n}${encodeURIComponent(e)}`}async function fetchPackument(e,t={}){let n=packumentUrl(e,t.registry??registryFor(e,t.npmrc)),r=buildHeaders(n,t);r.accept??=`application/vnd.npm.install-v1+json`;let i=t.fetch??globalThis.fetch;if(!i)throw Error(`@gjsify/npm-registry: globalThis.fetch is missing`);let a=await i(n,{headers:r,signal:t.signal});if(!a.ok)throw a.status===404?new PackageNotFoundError(e,n):Error(`registry GET ${n} -> ${a.status} ${a.statusText}`);let o=await a.json();return assertPackument(e,o),o}async function fetchTarball(e,t={}){let n=buildHeaders(e,t);n.accept??=`application/octet-stream`;let r=t.fetch??globalThis.fetch;if(!r)throw Error(`@gjsify/npm-registry: globalThis.fetch is missing`);let i=await r(e,{headers:n,signal:t.signal});if(!i.ok)throw Error(`tarball GET ${e} -> ${i.status} ${i.statusText}`);let a=new Uint8Array(await i.arrayBuffer());if(t.integrity&&!await verifyIntegrity(a,t.integrity))throw new IntegrityError(e,t.integrity);return a}async function verifyIntegrity(e,t){let n=t.trim().split(/\s+/);for(let t of n){let n=t.indexOf(`-`);if(n<0)continue;let r=t.slice(0,n).toLowerCase(),i=t.slice(n+1),a=globalThis.crypto?.subtle;if(!a)throw Error(`@gjsify/npm-registry: globalThis.crypto.subtle is missing`);let o=subriToWebCryptoAlgo(r);if(!o)continue;let s=await a.digest(o,dataAsArrayBuffer(e));if(bytesToBase64(new Uint8Array(s))===i)return!0}return!1}function subriToWebCryptoAlgo(e){switch(e){case`sha1`:return`SHA-1`;case`sha256`:return`SHA-256`;case`sha384`:return`SHA-384`;case`sha512`:return`SHA-512`;default:return null}}function dataAsArrayBuffer(e){if(e.byteOffset===0&&e.byteLength===e.buffer.byteLength)return e.buffer;let t=new Uint8Array(e.byteLength);return t.set(e),t.buffer}function bytesToBase64(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function parseNpmrc(t){let n={registry:e,scopes:{},authTokens:{},basicAuth:{}},r=t.split(/\r?\n/),i={};for(let e of r){let t=e.replace(/^\s+|\s+$/g,``);if(!t||t.startsWith(`#`)||t.startsWith(`;`))continue;let r=t.indexOf(`=`);if(r<0)continue;let a=t.slice(0,r).trim(),o=expandEnv(stripQuotes(t.slice(r+1).trim()));if(a===`registry`){n.registry=ensureTrailingSlash(o);continue}let s=a.match(/^(@[^:]+):registry$/);if(s){n.scopes[s[1]]=ensureTrailingSlash(o);continue}let c=a.match(/^\/\/(.+):_authToken$/);if(c){n.authTokens[normalizeAuthHost(c[1])]=o;continue}let l=a.match(/^\/\/(.+):username$/);if(l){(i[normalizeAuthHost(l[1])]??={}).user=o;continue}let u=a.match(/^\/\/(.+):_password$/);if(u){let e=base64Decode(o);(i[normalizeAuthHost(u[1])]??={}).pass=e;continue}}for(let[e,t]of Object.entries(i))t.user&&t.pass!==void 0&&(n.basicAuth[e]={username:t.user,password:t.pass});return n}function buildHeaders(e,t){let n={"user-agent":`gjsify-install/0.3.7`};if(t.npmrc){let r=resolveAuthForUrl(e,t.npmrc);r&&(n.authorization=r)}if(t.headers)for(let[e,r]of Object.entries(t.headers))n[e.toLowerCase()]=r;return n}function resolveAuthForUrl(e,t){let n=pathPrefixes(new URL(e));for(let e of n){let n=t.authTokens[e];if(n)return`Bearer ${n}`;let r=t.basicAuth[e];if(r)return`Basic ${btoa(`${r.username}:${r.password}`)}`}return null}function pathPrefixes(e){let t=e.pathname.split(`/`).filter(Boolean),n=[];for(let r=t.length;r>=0;r--){let i=t.slice(0,r).join(`/`);n.push(i?`//${e.host}/${i}`:`//${e.host}`)}return n}function normalizeAuthHost(e){return`//${e.replace(/\/+$/,``)}`}function ensureTrailingSlash(e){return e.endsWith(`/`)?e:e+`/`}function stripQuotes(e){return e.startsWith(`"`)&&e.endsWith(`"`)||e.startsWith(`'`)&&e.endsWith(`'`)?e.slice(1,-1):e}function expandEnv(e){return e.replace(/\$\{([A-Z0-9_]+)\}/gi,(e,t)=>globalThis.process?.env?.[t]??``)}function base64Decode(e){return atob(e)}var PackageNotFoundError=class extends Error{name;url;constructor(e,t){super(`Package not found in registry: ${e} (${t})`),this.name=e,this.url=t,this.name=`PackageNotFoundError`}},IntegrityError=class extends Error{url;integrity;constructor(e,t){super(`Tarball integrity mismatch for ${e} (expected ${t})`),this.url=e,this.integrity=t,this.name=`IntegrityError`}};export{e as DEFAULT_REGISTRY,IntegrityError,PackageNotFoundError,assertPackument,buildHeaders,fetchPackument,fetchTarball,packumentUrl,parseNpmrc,registryFor,resolveAuthForUrl,verifyIntegrity};
1
+ import"./_virtual/_rolldown/runtime.js";const e=`https://registry.npmjs.org/`;function assertPackument(e,t){if(!t||typeof t!=`object`)throw TypeError(`registry: ${e} packument is not an object`);let n=t;if(typeof n.name!=`string`)throw TypeError(`registry: ${e} packument missing string name`);if(!n.versions||typeof n.versions!=`object`)throw TypeError(`registry: ${e} packument missing versions map`)}function registryFor(t,n){if(n&&t.startsWith(`@`)){let e=t.slice(0,t.indexOf(`/`)),r=n.scopes[e];if(r)return ensureTrailingSlash(r)}return n?.registry?ensureTrailingSlash(n.registry):e}function packumentUrl(e,t){let n=ensureTrailingSlash(t);if(e.startsWith(`@`)){let t=e.indexOf(`/`);if(t<0)throw TypeError(`Invalid scoped package name: ${e}`);let r=e.slice(0,t),i=e.slice(t+1);return`${n}${encodeURIComponent(r)}/${encodeURIComponent(i)}`}return`${n}${encodeURIComponent(e)}`}async function fetchPackument(e,t={}){let n=packumentUrl(e,t.registry??registryFor(e,t.npmrc)),r=buildHeaders(n,t);r.accept??=`application/vnd.npm.install-v1+json`;let i=t.fetch??globalThis.fetch;if(!i)throw Error(`@gjsify/npm-registry: globalThis.fetch is missing`);let a=await i(n,{headers:r,signal:t.signal});if(!a.ok)throw a.status===404?new PackageNotFoundError(e,n):Error(`registry GET ${n} -> ${a.status} ${a.statusText}`);let o=await a.json();return assertPackument(e,o),o}async function fetchTarball(e,t={}){let n=buildHeaders(e,t);n.accept??=`application/octet-stream`;let r=t.fetch??globalThis.fetch;if(!r)throw Error(`@gjsify/npm-registry: globalThis.fetch is missing`);let i=await r(e,{headers:n,signal:t.signal});if(!i.ok)throw Error(`tarball GET ${e} -> ${i.status} ${i.statusText}`);let a=new Uint8Array(await i.arrayBuffer());if(t.integrity&&!await verifyIntegrity(a,t.integrity))throw new IntegrityError(e,t.integrity);return a}async function verifyIntegrity(e,t){let n=t.trim().split(/\s+/);for(let t of n){let n=t.indexOf(`-`);if(n<0)continue;let r=t.slice(0,n).toLowerCase(),i=t.slice(n+1),a=globalThis.crypto?.subtle;if(!a)throw Error(`@gjsify/npm-registry: globalThis.crypto.subtle is missing`);let o=subriToWebCryptoAlgo(r);if(!o)continue;let s=await a.digest(o,dataAsArrayBuffer(e));if(bytesToBase64(new Uint8Array(s))===i)return!0}return!1}function subriToWebCryptoAlgo(e){switch(e){case`sha1`:return`SHA-1`;case`sha256`:return`SHA-256`;case`sha384`:return`SHA-384`;case`sha512`:return`SHA-512`;default:return null}}function dataAsArrayBuffer(e){if(e.byteOffset===0&&e.byteLength===e.buffer.byteLength)return e.buffer;let t=new Uint8Array(e.byteLength);return t.set(e),t.buffer}function bytesToBase64(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function parseNpmrc(t){let n={registry:e,scopes:{},authTokens:{},basicAuth:{}},r=t.split(/\r?\n/),i={};for(let e of r){let t=e.replace(/^\s+|\s+$/g,``);if(!t||t.startsWith(`#`)||t.startsWith(`;`))continue;let r=t.indexOf(`=`);if(r<0)continue;let a=t.slice(0,r).trim(),o=expandEnv(stripQuotes(t.slice(r+1).trim()));if(a===`registry`){n.registry=ensureTrailingSlash(o);continue}let s=a.match(/^(@[^:]+):registry$/);if(s){n.scopes[s[1]]=ensureTrailingSlash(o);continue}let c=a.match(/^\/\/(.+):_authToken$/);if(c){n.authTokens[normalizeAuthHost(c[1])]=o;continue}let l=a.match(/^\/\/(.+):username$/);if(l){(i[normalizeAuthHost(l[1])]??={}).user=o;continue}let u=a.match(/^\/\/(.+):_password$/);if(u){let e=base64Decode(o);(i[normalizeAuthHost(u[1])]??={}).pass=e;continue}}for(let[e,t]of Object.entries(i))t.user&&t.pass!==void 0&&(n.basicAuth[e]={username:t.user,password:t.pass});return n}function buildHeaders(e,t){let n={"user-agent":`gjsify-install/0.3.7`};if(t.npmrc){let r=resolveAuthForUrl(e,t.npmrc);r&&(n.authorization=r)}if(t.headers)for(let[e,r]of Object.entries(t.headers))n[e.toLowerCase()]=r;return n}function resolveAuthForUrl(e,t){let n=pathPrefixes(new URL(e));for(let e of n){let n=t.authTokens[e];if(n)return`Bearer ${n}`;let r=t.basicAuth[e];if(r)return`Basic ${btoa(`${r.username}:${r.password}`)}`}return null}function pathPrefixes(e){let t=e.pathname.split(`/`).filter(Boolean),n=[];for(let r=t.length;r>=0;r--){let i=t.slice(0,r).join(`/`);n.push(i?`//${e.host}/${i}`:`//${e.host}`)}return n}function normalizeAuthHost(e){return`//${e.replace(/\/+$/,``)}`}function ensureTrailingSlash(e){return e.endsWith(`/`)?e:e+`/`}function stripQuotes(e){return e.startsWith(`"`)&&e.endsWith(`"`)||e.startsWith(`'`)&&e.endsWith(`'`)?e.slice(1,-1):e}function expandEnv(e){return e.replace(/\$\{([A-Z0-9_]+)\}/gi,(e,t)=>globalThis.process?.env?.[t]??``)}function base64Decode(e){return atob(e)}var PackageNotFoundError=class extends Error{name;url;constructor(e,t){super(`Package not found in registry: ${e} (${t})`),this.name=e,this.url=t,this.name=`PackageNotFoundError`}},IntegrityError=class extends Error{url;integrity;constructor(e,t){super(`Tarball integrity mismatch for ${e} (expected ${t})`),this.url=e,this.integrity=t,this.name=`IntegrityError`}};export{e as DEFAULT_REGISTRY,IntegrityError,PackageNotFoundError,assertPackument,buildHeaders,fetchPackument,fetchTarball,packumentUrl,parseNpmrc,registryFor,resolveAuthForUrl,verifyIntegrity};
@@ -1 +1 @@
1
- {"fileNames":["../../../../node_modules/typescript/lib/lib.es5.d.ts","../../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../../node_modules/typescript/lib/lib.es2021.d.ts","../../../../node_modules/typescript/lib/lib.es2022.d.ts","../../../../node_modules/typescript/lib/lib.es2023.d.ts","../../../../node_modules/typescript/lib/lib.es2024.d.ts","../../../../node_modules/typescript/lib/lib.es2025.d.ts","../../../../node_modules/typescript/lib/lib.esnext.d.ts","../../../../node_modules/typescript/lib/lib.dom.d.ts","../../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../../node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../../node_modules/typescript/lib/lib.es2017.date.d.ts","../../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../../node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2022.array.d.ts","../../../../node_modules/typescript/lib/lib.es2022.error.d.ts","../../../../node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2022.object.d.ts","../../../../node_modules/typescript/lib/lib.es2022.string.d.ts","../../../../node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../../node_modules/typescript/lib/lib.es2023.array.d.ts","../../../../node_modules/typescript/lib/lib.es2023.collection.d.ts","../../../../node_modules/typescript/lib/lib.es2023.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts","../../../../node_modules/typescript/lib/lib.es2024.collection.d.ts","../../../../node_modules/typescript/lib/lib.es2024.object.d.ts","../../../../node_modules/typescript/lib/lib.es2024.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2024.regexp.d.ts","../../../../node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts","../../../../node_modules/typescript/lib/lib.es2024.string.d.ts","../../../../node_modules/typescript/lib/lib.es2025.collection.d.ts","../../../../node_modules/typescript/lib/lib.es2025.float16.d.ts","../../../../node_modules/typescript/lib/lib.es2025.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2025.iterator.d.ts","../../../../node_modules/typescript/lib/lib.es2025.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2025.regexp.d.ts","../../../../node_modules/typescript/lib/lib.esnext.array.d.ts","../../../../node_modules/typescript/lib/lib.esnext.collection.d.ts","../../../../node_modules/typescript/lib/lib.esnext.date.d.ts","../../../../node_modules/typescript/lib/lib.esnext.decorators.d.ts","../../../../node_modules/typescript/lib/lib.esnext.disposable.d.ts","../../../../node_modules/typescript/lib/lib.esnext.error.d.ts","../../../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../../node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts","../../../../node_modules/typescript/lib/lib.esnext.temporal.d.ts","../../../../node_modules/typescript/lib/lib.esnext.typedarrays.d.ts","../../../../node_modules/typescript/lib/lib.decorators.d.ts","../../../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../src/index.ts"],"fileInfos":[{"version":"bcd24271a113971ba9eb71ff8cb01bc6b0f872a85c23fdbe5d93065b375933cd","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f88bedbeb09c6f5a6645cb24c7c55f1aa22d19ae96c8e6959cbd8b85a707bc6","impliedFormat":1},{"version":"7fe93b39b810eadd916be8db880dd7f0f7012a5cc6ffb62de8f62a2117fa6f1f","impliedFormat":1},{"version":"bb0074cc08b84a2374af33d8bf044b80851ccc9e719a5e202eacf40db2c31600","impliedFormat":1},{"version":"1a7daebe4f45fb03d9ec53d60008fbf9ac45a697fdc89e4ce218bc94b94f94d6","impliedFormat":1},{"version":"f94b133a3cb14a288803be545ac2683e0d0ff6661bcd37e31aaaec54fc382aed","impliedFormat":1},{"version":"f59d0650799f8782fd74cf73c19223730c6d1b9198671b1c5b3a38e1188b5953","impliedFormat":1},{"version":"8a15b4607d9a499e2dbeed9ec0d3c0d7372c850b2d5f1fb259e8f6d41d468a84","impliedFormat":1},{"version":"26e0fe14baee4e127f4365d1ae0b276f400562e45e19e35fd2d4c296684715e6","impliedFormat":1},{"version":"1e9332c23e9a907175e0ffc6a49e236f97b48838cc8aec9ce7e4cec21e544b65","impliedFormat":1},{"version":"3753fbc1113dc511214802a2342280a8b284ab9094f6420e7aa171e868679f91","impliedFormat":1},{"version":"999ca32883495a866aa5737fe1babc764a469e4cde6ee6b136a4b9ae68853e4b","impliedFormat":1},{"version":"17f13ecb98cbc39243f2eee1f16d45cd8ec4706b03ee314f1915f1a8b42f6984","impliedFormat":1},{"version":"d6b1eba8496bdd0eed6fc8a685768fe01b2da4a0388b5fe7df558290bffcf32f","affectsGlobalScope":true,"impliedFormat":1},{"version":"eadcffda2aa84802c73938e589b9e58248d74c59cb7fcbca6474e3435ac15504","affectsGlobalScope":true,"impliedFormat":1},{"version":"105ba8ff7ba746404fe1a2e189d1d3d2e0eb29a08c18dded791af02f29fb4711","affectsGlobalScope":true,"impliedFormat":1},{"version":"00343ca5b2e3d48fa5df1db6e32ea2a59afab09590274a6cccb1dbae82e60c7c","affectsGlobalScope":true,"impliedFormat":1},{"version":"ebd9f816d4002697cb2864bea1f0b70a103124e18a8cd9645eeccc09bdf80ab4","affectsGlobalScope":true,"impliedFormat":1},{"version":"2c1afac30a01772cd2a9a298a7ce7706b5892e447bb46bdbeef720f7b5da77ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"7b0225f483e4fa685625ebe43dd584bb7973bbd84e66a6ba7bbe175ee1048b4f","affectsGlobalScope":true,"impliedFormat":1},{"version":"c0a4b8ac6ce74679c1da2b3795296f5896e31c38e888469a8e0f99dc3305de60","affectsGlobalScope":true,"impliedFormat":1},{"version":"3084a7b5f569088e0146533a00830e206565de65cae2239509168b11434cd84f","affectsGlobalScope":true,"impliedFormat":1},{"version":"c5079c53f0f141a0698faa903e76cb41cd664e3efb01cc17a5c46ec2eb0bef42","affectsGlobalScope":true,"impliedFormat":1},{"version":"32cafbc484dea6b0ab62cf8473182bbcb23020d70845b406f80b7526f38ae862","affectsGlobalScope":true,"impliedFormat":1},{"version":"fca4cdcb6d6c5ef18a869003d02c9f0fd95df8cfaf6eb431cd3376bc034cad36","affectsGlobalScope":true,"impliedFormat":1},{"version":"b93ec88115de9a9dc1b602291b85baf825c85666bf25985cc5f698073892b467","affectsGlobalScope":true,"impliedFormat":1},{"version":"f5c06dcc3fe849fcb297c247865a161f995cc29de7aa823afdd75aaaddc1419b","affectsGlobalScope":true,"impliedFormat":1},{"version":"b77e16112127a4b169ef0b8c3a4d730edf459c5f25fe52d5e436a6919206c4d7","affectsGlobalScope":true,"impliedFormat":1},{"version":"fbffd9337146eff822c7c00acbb78b01ea7ea23987f6c961eba689349e744f8c","affectsGlobalScope":true,"impliedFormat":1},{"version":"a995c0e49b721312f74fdfb89e4ba29bd9824c770bbb4021d74d2bf560e4c6bd","affectsGlobalScope":true,"impliedFormat":1},{"version":"c7b3542146734342e440a84b213384bfa188835537ddbda50d30766f0593aff9","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce6180fa19b1cccd07ee7f7dbb9a367ac19c0ed160573e4686425060b6df7f57","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f02e2476bccb9dbe21280d6090f0df17d2f66b74711489415a8aa4df73c9675","affectsGlobalScope":true,"impliedFormat":1},{"version":"45e3ab34c1c013c8ab2dc1ba4c80c780744b13b5676800ae2e3be27ae862c40c","affectsGlobalScope":true,"impliedFormat":1},{"version":"805c86f6cca8d7702a62a844856dbaa2a3fd2abef0536e65d48732441dde5b5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"e42e397f1a5a77994f0185fd1466520691456c772d06bf843e5084ceb879a0ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"f4c2b41f90c95b1c532ecc874bd3c111865793b23aebcc1c3cbbabcd5d76ffb0","affectsGlobalScope":true,"impliedFormat":1},{"version":"ab26191cfad5b66afa11b8bf935ef1cd88fabfcb28d30b2dfa6fad877d050332","affectsGlobalScope":true,"impliedFormat":1},{"version":"2088bc26531e38fb05eedac2951480db5309f6be3fa4a08d2221abb0f5b4200d","affectsGlobalScope":true,"impliedFormat":1},{"version":"cb9d366c425fea79716a8fb3af0d78e6b22ebbab3bd64d25063b42dc9f531c1e","affectsGlobalScope":true,"impliedFormat":1},{"version":"500934a8089c26d57ebdb688fc9757389bb6207a3c8f0674d68efa900d2abb34","affectsGlobalScope":true,"impliedFormat":1},{"version":"689da16f46e647cef0d64b0def88910e818a5877ca5379ede156ca3afb780ac3","affectsGlobalScope":true,"impliedFormat":1},{"version":"bc21cc8b6fee4f4c2440d08035b7ea3c06b3511314c8bab6bef7a92de58a2593","affectsGlobalScope":true,"impliedFormat":1},{"version":"7ca53d13d2957003abb47922a71866ba7cb2068f8d154877c596d63c359fed25","affectsGlobalScope":true,"impliedFormat":1},{"version":"54725f8c4df3d900cb4dac84b64689ce29548da0b4e9b7c2de61d41c79293611","affectsGlobalScope":true,"impliedFormat":1},{"version":"e5594bc3076ac29e6c1ebda77939bc4c8833de72f654b6e376862c0473199323","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f3eb332c2d73e729f3364fcc0c2b375e72a121e8157d25a82d67a138c83a95c","affectsGlobalScope":true,"impliedFormat":1},{"version":"6f4427f9642ce8d500970e4e69d1397f64072ab73b97e476b4002a646ac743b1","affectsGlobalScope":true,"impliedFormat":1},{"version":"48915f327cd1dea4d7bd358d9dc7732f58f9e1626a29cc0c05c8c692419d9bb7","affectsGlobalScope":true,"impliedFormat":1},{"version":"b7bf9377723203b5a6a4b920164df22d56a43f593269ba6ae1fdc97774b68855","affectsGlobalScope":true,"impliedFormat":1},{"version":"db9709688f82c9e5f65a119c64d835f906efe5f559d08b11642d56eb85b79357","affectsGlobalScope":true,"impliedFormat":1},{"version":"4b25b8c874acd1a4cf8444c3617e037d444d19080ac9f634b405583fd10ce1f7","affectsGlobalScope":true,"impliedFormat":1},{"version":"37be57d7c90cf1f8112ee2636a068d8fd181289f82b744160ec56a7dc158a9f5","affectsGlobalScope":true,"impliedFormat":1},{"version":"a917a49ac94cd26b754ab84e113369a75d1a47a710661d7cd25e961cc797065f","affectsGlobalScope":true,"impliedFormat":1},{"version":"6d3261badeb7843d157ef3e6f5d1427d0eeb0af0cf9df84a62cfd29fd47ac86e","affectsGlobalScope":true,"impliedFormat":1},{"version":"195daca651dde22f2167ac0d0a05e215308119a3100f5e6268e8317d05a92526","affectsGlobalScope":true,"impliedFormat":1},{"version":"8b11e4285cd2bb164a4dc09248bdec69e9842517db4ca47c1ba913011e44ff2f","affectsGlobalScope":true,"impliedFormat":1},{"version":"0508571a52475e245b02bc50fa1394065a0a3d05277fbf5120c3784b85651799","affectsGlobalScope":true,"impliedFormat":1},{"version":"8f9af488f510c3015af3cc8c267a9e9d96c4dd38a1fdff0e11dc5a544711415b","affectsGlobalScope":true,"impliedFormat":1},{"version":"fc611fea8d30ea72c6bbfb599c9b4d393ce22e2f5bfef2172534781e7d138104","affectsGlobalScope":true,"impliedFormat":1},{"version":"0bd714129fca875f7d4c477a1a392200b0bcd13fb2e80928cd334b63830ea047","affectsGlobalScope":true,"impliedFormat":1},{"version":"e2c9037ae6cd2c52d80ceef0b3c5ffdb488627d71529cf4f63776daf11161c9a","affectsGlobalScope":true,"impliedFormat":1},{"version":"135d5cf4d345f59f1a9caadfafcd858d3d9cc68290db616cc85797224448cccc","affectsGlobalScope":true,"impliedFormat":1},{"version":"bc238c3f81c2984751932b6aab223cd5b830e0ac6cad76389e5e9d2ffc03287d","affectsGlobalScope":true,"impliedFormat":1},{"version":"4a07f9b76d361f572620927e5735b77d6d2101c23cdd94383eb5b706e7b36357","affectsGlobalScope":true,"impliedFormat":1},{"version":"7c4e8dc6ab834cc6baa0227e030606d29e3e8449a9f67cdf5605ea5493c4db29","affectsGlobalScope":true,"impliedFormat":1},{"version":"de7ba0fd02e06cd9a5bd4ab441ed0e122735786e67dde1e849cced1cd8b46b78","affectsGlobalScope":true,"impliedFormat":1},{"version":"6148e4e88d720a06855071c3db02069434142a8332cf9c182cda551adedf3156","affectsGlobalScope":true,"impliedFormat":1},{"version":"d63dba625b108316a40c95a4425f8d4294e0deeccfd6c7e59d819efa19e23409","affectsGlobalScope":true,"impliedFormat":1},{"version":"0568d6befee03dd435bed4fc25c4e46865b24bdcb8c563fdc21f580a2c301904","affectsGlobalScope":true,"impliedFormat":1},{"version":"30d62269b05b584741f19a5369852d5d34895aa2ac4fd948956f886d15f9cc0d","affectsGlobalScope":true,"impliedFormat":1},{"version":"f128dae7c44d8f35ee42e0a437000a57c9f06cc04f8b4fb42eebf44954d53dc8","affectsGlobalScope":true,"impliedFormat":1},{"version":"ffbe6d7b295306b2ba88030f65b74c107d8d99bdcf596ea99c62a02f606108b0","affectsGlobalScope":true,"impliedFormat":1},{"version":"996fb27b15277369c68a4ba46ed138b4e9e839a02fb4ec756f7997629242fd9f","affectsGlobalScope":true,"impliedFormat":1},{"version":"79b712591b270d4778c89706ca2cfc56ddb8c3f895840e477388f1710dc5eda9","affectsGlobalScope":true,"impliedFormat":1},{"version":"20884846cef428b992b9bd032e70a4ef88e349263f63aeddf04dda837a7dba26","affectsGlobalScope":true,"impliedFormat":1},{"version":"5fcab789c73a97cd43828ee3cc94a61264cf24d4c44472ce64ced0e0f148bdb2","affectsGlobalScope":true,"impliedFormat":1},{"version":"db59a81f070c1880ad645b2c0275022baa6a0c4f0acdc58d29d349c6efcf0903","affectsGlobalScope":true,"impliedFormat":1},{"version":"673294292640f5722b700e7d814e17aaf7d93f83a48a2c9b38f33cbc940ad8b0","affectsGlobalScope":true,"impliedFormat":1},{"version":"d786b48f934cbca483b3c6d0a798cb43bbb4ada283e76fb22c28e53ae05b9e69","affectsGlobalScope":true,"impliedFormat":1},{"version":"1ecb8e347cb6b2a8927c09b86263663289418df375f5e68e11a0ae683776978f","affectsGlobalScope":true,"impliedFormat":1},{"version":"142efd4ce210576f777dc34df121777be89eda476942d6d6663b03dcb53be3ff","affectsGlobalScope":true,"impliedFormat":1},{"version":"379bc41580c2d774f82e828c70308f24a005b490c25ba34d679d84bcf05c3d9d","affectsGlobalScope":true,"impliedFormat":1},{"version":"ed484fb2aa8a1a23d0277056ec3336e0a0b52f9b8d6a961f338a642faf43235d","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ffedae1d1c2d53fdbca1c96d3c7dda544281f7d262f99b6880634f8fd8d9820","affectsGlobalScope":true,"impliedFormat":1},{"version":"83a730b125d477dd264df8ba479afab27a3dae7152b005c214ab94dc7ee44fd3","affectsGlobalScope":true,"impliedFormat":1},{"version":"1ce14b81c5cc821994aa8ec1d42b220dd41b27fcc06373bce3958af7421b77d4","affectsGlobalScope":true,"impliedFormat":1},{"version":"b3a048b3e9302ef9a34ef4ebb9aecfb28b66abb3bce577206a79fee559c230da","affectsGlobalScope":true,"impliedFormat":1},{"version":"250466c86fa93f25e6eafb66b033c28338f5181914a6f7e55497c2013b0396b5","signature":"b2d40a67ce4cbf8b4911941e42ecf6ff80841a525cd7cab134e050c7e5429f11"}],"root":[89],"options":{"allowImportingTsExtensions":false,"composite":true,"declaration":true,"declarationDir":"./types","experimentalDecorators":true,"module":99,"outDir":"./esm","rootDir":"../src","skipLibCheck":true,"strict":true,"target":99},"latestChangedDtsFile":"./types/index.d.ts","version":"6.0.3"}
1
+ {"fileNames":["../../../../node_modules/typescript/lib/lib.es5.d.ts","../../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../../node_modules/typescript/lib/lib.es2021.d.ts","../../../../node_modules/typescript/lib/lib.es2022.d.ts","../../../../node_modules/typescript/lib/lib.es2023.d.ts","../../../../node_modules/typescript/lib/lib.es2024.d.ts","../../../../node_modules/typescript/lib/lib.esnext.d.ts","../../../../node_modules/typescript/lib/lib.dom.d.ts","../../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../../node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../../node_modules/typescript/lib/lib.es2017.date.d.ts","../../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../../node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2022.array.d.ts","../../../../node_modules/typescript/lib/lib.es2022.error.d.ts","../../../../node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2022.object.d.ts","../../../../node_modules/typescript/lib/lib.es2022.string.d.ts","../../../../node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../../node_modules/typescript/lib/lib.es2023.array.d.ts","../../../../node_modules/typescript/lib/lib.es2023.collection.d.ts","../../../../node_modules/typescript/lib/lib.es2023.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts","../../../../node_modules/typescript/lib/lib.es2024.collection.d.ts","../../../../node_modules/typescript/lib/lib.es2024.object.d.ts","../../../../node_modules/typescript/lib/lib.es2024.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2024.regexp.d.ts","../../../../node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts","../../../../node_modules/typescript/lib/lib.es2024.string.d.ts","../../../../node_modules/typescript/lib/lib.esnext.array.d.ts","../../../../node_modules/typescript/lib/lib.esnext.collection.d.ts","../../../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../../node_modules/typescript/lib/lib.esnext.disposable.d.ts","../../../../node_modules/typescript/lib/lib.esnext.promise.d.ts","../../../../node_modules/typescript/lib/lib.esnext.decorators.d.ts","../../../../node_modules/typescript/lib/lib.esnext.iterator.d.ts","../../../../node_modules/typescript/lib/lib.esnext.float16.d.ts","../../../../node_modules/typescript/lib/lib.esnext.error.d.ts","../../../../node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts","../../../../node_modules/typescript/lib/lib.decorators.d.ts","../../../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../src/index.ts"],"fileInfos":[{"version":"c430d44666289dae81f30fa7b2edebf186ecc91a2d4c71266ea6ae76388792e1","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","impliedFormat":1},{"version":"ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","impliedFormat":1},{"version":"27bdc30a0e32783366a5abeda841bc22757c1797de8681bbe81fbc735eeb1c10","impliedFormat":1},{"version":"8fd575e12870e9944c7e1d62e1f5a73fcf23dd8d3a321f2a2c74c20d022283fe","impliedFormat":1},{"version":"2ab096661c711e4a81cc464fa1e6feb929a54f5340b46b0a07ac6bbf857471f0","impliedFormat":1},{"version":"080941d9f9ff9307f7e27a83bcd888b7c8270716c39af943532438932ec1d0b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"fb0f136d372979348d59b3f5020b4cdb81b5504192b1cacff5d1fbba29378aa1","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"a680117f487a4d2f30ea46f1b4b7f58bef1480456e18ba53ee85c2746eeca012","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedFormat":1},{"version":"8cdf8847677ac7d20486e54dd3fcf09eda95812ac8ace44b4418da1bbbab6eb8","affectsGlobalScope":true,"impliedFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"df83c2a6c73228b625b0beb6669c7ee2a09c914637e2d35170723ad49c0f5cd4","affectsGlobalScope":true,"impliedFormat":1},{"version":"436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d","affectsGlobalScope":true,"impliedFormat":1},{"version":"87dc0f382502f5bbce5129bdc0aea21e19a3abbc19259e0b43ae038a9fc4e326","affectsGlobalScope":true,"impliedFormat":1},{"version":"b1cb28af0c891c8c96b2d6b7be76bd394fddcfdb4709a20ba05a7c1605eea0f9","affectsGlobalScope":true,"impliedFormat":1},{"version":"2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6","affectsGlobalScope":true,"impliedFormat":1},{"version":"56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ece9f17b3866cc077099c73f4983bddbcb1dc7ddb943227f1ec070f529dedd1","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c","affectsGlobalScope":true,"impliedFormat":1},{"version":"1c9319a09485199c1f7b0498f2988d6d2249793ef67edda49d1e584746be9032","affectsGlobalScope":true,"impliedFormat":1},{"version":"e3a2a0cee0f03ffdde24d89660eba2685bfbdeae955a6c67e8c4c9fd28928eeb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4","affectsGlobalScope":true,"impliedFormat":1},{"version":"51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa","affectsGlobalScope":true,"impliedFormat":1},{"version":"60037901da1a425516449b9a20073aa03386cce92f7a1fd902d7602be3a7c2e9","affectsGlobalScope":true,"impliedFormat":1},{"version":"d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f","affectsGlobalScope":true,"impliedFormat":1},{"version":"22adec94ef7047a6c9d1af3cb96be87a335908bf9ef386ae9fd50eeb37f44c47","affectsGlobalScope":true,"impliedFormat":1},{"version":"196cb558a13d4533a5163286f30b0509ce0210e4b316c56c38d4c0fd2fb38405","affectsGlobalScope":true,"impliedFormat":1},{"version":"73f78680d4c08509933daf80947902f6ff41b6230f94dd002ae372620adb0f60","affectsGlobalScope":true,"impliedFormat":1},{"version":"c5239f5c01bcfa9cd32f37c496cf19c61d69d37e48be9de612b541aac915805b","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"250466c86fa93f25e6eafb66b033c28338f5181914a6f7e55497c2013b0396b5","signature":"b2d40a67ce4cbf8b4911941e42ecf6ff80841a525cd7cab134e050c7e5429f11"}],"root":[82],"options":{"allowImportingTsExtensions":false,"composite":true,"declaration":true,"declarationDir":"./types","experimentalDecorators":true,"module":99,"outDir":"./esm","rootDir":"../src","skipLibCheck":true,"strict":true,"target":99},"latestChangedDtsFile":"./types/index.d.ts","version":"5.9.3"}
package/package.json CHANGED
@@ -1,41 +1,44 @@
1
1
  {
2
- "name": "@gjsify/npm-registry",
3
- "version": "0.3.21",
4
- "description": "npm registry client for the gjsify install backend — packuments, tarballs, .npmrc auth (Node + GJS)",
5
- "type": "module",
6
- "module": "lib/esm/index.js",
7
- "main": "lib/esm/index.js",
8
- "types": "lib/types/index.d.ts",
9
- "exports": {
10
- ".": {
11
- "types": "./lib/types/index.d.ts",
12
- "default": "./lib/esm/index.js"
2
+ "name": "@gjsify/npm-registry",
3
+ "version": "0.4.3",
4
+ "description": "npm registry client for the gjsify install backend — packuments, tarballs, .npmrc auth (Node + GJS)",
5
+ "type": "module",
6
+ "module": "lib/esm/index.js",
7
+ "main": "lib/esm/index.js",
8
+ "types": "lib/types/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./lib/types/index.d.ts",
12
+ "default": "./lib/esm/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "lib"
17
+ ],
18
+ "scripts": {
19
+ "clear": "rm -rf lib tsconfig.tsbuildinfo test.gjs.mjs test.node.mjs || exit 0",
20
+ "check": "tsc --noEmit",
21
+ "build": "gjsify run build:gjsify && gjsify run build:types",
22
+ "build:gjsify": "gjsify build --library 'src/**/*.{ts,js}' --exclude 'src/**/*.spec.{mts,ts}' 'src/test.mts'",
23
+ "build:types": "tsc -p tsconfig.build.json",
24
+ "build:test": "gjsify run build:test:gjs && gjsify run build:test:node",
25
+ "build:test:gjs": "gjsify build src/test.mts --app gjs --outfile test.gjs.mjs",
26
+ "build:test:node": "gjsify build src/test.mts --app node --outfile test.node.mjs",
27
+ "test": "gjsify run build:gjsify && gjsify run build:test && gjsify run test:node && gjsify run test:gjs",
28
+ "test:gjs": "gjsify run test.gjs.mjs",
29
+ "test:node": "node test.node.mjs"
30
+ },
31
+ "keywords": [
32
+ "gjs",
33
+ "node",
34
+ "npm",
35
+ "registry",
36
+ "install"
37
+ ],
38
+ "license": "MIT",
39
+ "devDependencies": {
40
+ "@gjsify/cli": "workspace:^",
41
+ "@gjsify/unit": "workspace:^",
42
+ "typescript": "^6.0.3"
13
43
  }
14
- },
15
- "scripts": {
16
- "clear": "rm -rf lib tsconfig.tsbuildinfo test.gjs.mjs test.node.mjs || exit 0",
17
- "check": "tsc --noEmit",
18
- "build": "yarn build:gjsify && yarn build:types",
19
- "build:gjsify": "gjsify build --library 'src/**/*.{ts,js}' --exclude 'src/**/*.spec.{mts,ts}' 'src/test.mts'",
20
- "build:types": "tsc -p tsconfig.build.json",
21
- "build:test": "yarn build:test:gjs && yarn build:test:node",
22
- "build:test:gjs": "gjsify build src/test.mts --app gjs --outfile test.gjs.mjs",
23
- "build:test:node": "gjsify build src/test.mts --app node --outfile test.node.mjs",
24
- "test": "yarn build:gjsify && yarn build:test && yarn test:node && yarn test:gjs",
25
- "test:gjs": "gjsify run test.gjs.mjs",
26
- "test:node": "node test.node.mjs"
27
- },
28
- "keywords": [
29
- "gjs",
30
- "node",
31
- "npm",
32
- "registry",
33
- "install"
34
- ],
35
- "license": "MIT",
36
- "devDependencies": {
37
- "@gjsify/cli": "^0.3.21",
38
- "@gjsify/unit": "^0.3.21",
39
- "typescript": "^6.0.3"
40
- }
41
- }
44
+ }
package/src/index.spec.ts DELETED
@@ -1,276 +0,0 @@
1
- import { describe, it, expect } from "@gjsify/unit";
2
- import {
3
- DEFAULT_REGISTRY,
4
- parseNpmrc,
5
- packumentUrl,
6
- registryFor,
7
- resolveAuthForUrl,
8
- buildHeaders,
9
- verifyIntegrity,
10
- fetchPackument,
11
- fetchTarball,
12
- PackageNotFoundError,
13
- IntegrityError,
14
- type NpmrcConfig,
15
- } from "./index.js";
16
-
17
- const sampleNpmrc = `
18
- # default registry override
19
- registry = https://registry.example.com/
20
-
21
- # scoped registry
22
- @gjsify:registry = https://registry.npmjs.org/
23
- @private:registry = "https://artifacts.example.com/api/npm/"
24
-
25
- # token auth
26
- //registry.npmjs.org/:_authToken = npm_FAKETOKEN_abc123
27
- //artifacts.example.com/api/npm/:_authToken = \${NPM_TOKEN_BASIC}
28
-
29
- # basic auth
30
- //mirror.example.com/:username = alice
31
- //mirror.example.com/:_password = c2VjcmV0
32
- `;
33
-
34
- function makeMockFetch(handler: (url: string, init?: RequestInit) => Promise<Response>): typeof fetch {
35
- return ((url: string | URL | Request, init?: RequestInit) => {
36
- const u = typeof url === "string" ? url : url.toString();
37
- return handler(u, init);
38
- }) as typeof fetch;
39
- }
40
-
41
- export default async () => {
42
- await describe("@gjsify/npm-registry — packumentUrl + registryFor", async () => {
43
- await it("plain name", async () => {
44
- expect(packumentUrl("lodash", DEFAULT_REGISTRY)).toBe(
45
- "https://registry.npmjs.org/lodash",
46
- );
47
- });
48
-
49
- await it("scoped name encodes slash", async () => {
50
- expect(packumentUrl("@gjsify/path", DEFAULT_REGISTRY)).toBe(
51
- "https://registry.npmjs.org/%40gjsify/path",
52
- );
53
- });
54
-
55
- await it("registryFor picks scope override", async () => {
56
- const npmrc: NpmrcConfig = {
57
- registry: "https://default/",
58
- scopes: { "@gjsify": "https://gjsify-registry/" },
59
- authTokens: {},
60
- basicAuth: {},
61
- };
62
- expect(registryFor("@gjsify/cli", npmrc)).toBe("https://gjsify-registry/");
63
- expect(registryFor("lodash", npmrc)).toBe("https://default/");
64
- expect(registryFor("lodash", undefined)).toBe(DEFAULT_REGISTRY);
65
- });
66
- });
67
-
68
- await describe("@gjsify/npm-registry — parseNpmrc", async () => {
69
- await it("parses registry + scopes + tokens + basic", async () => {
70
- const cfg = parseNpmrc(sampleNpmrc);
71
- expect(cfg.registry).toBe("https://registry.example.com/");
72
- expect(cfg.scopes["@gjsify"]).toBe("https://registry.npmjs.org/");
73
- expect(cfg.scopes["@private"]).toBe("https://artifacts.example.com/api/npm/");
74
- expect(cfg.authTokens["//registry.npmjs.org"]).toBe("npm_FAKETOKEN_abc123");
75
- expect(cfg.basicAuth["//mirror.example.com"].username).toBe("alice");
76
- expect(cfg.basicAuth["//mirror.example.com"].password).toBe("secret");
77
- });
78
-
79
- await it("expands ${ENV_VAR} from process.env when present", async () => {
80
- const proc = (globalThis as { process?: { env?: Record<string, string> } }).process;
81
- const original = proc?.env?.NPM_TOKEN_BASIC;
82
- if (proc?.env) proc.env.NPM_TOKEN_BASIC = "from-env-token";
83
- try {
84
- const cfg = parseNpmrc(sampleNpmrc);
85
- expect(cfg.authTokens["//artifacts.example.com/api/npm"]).toBe("from-env-token");
86
- } finally {
87
- if (proc?.env) {
88
- if (original === undefined) delete proc.env.NPM_TOKEN_BASIC;
89
- else proc.env.NPM_TOKEN_BASIC = original;
90
- }
91
- }
92
- });
93
-
94
- await it("ignores comments + blank lines", async () => {
95
- const cfg = parseNpmrc("\n# comment\n;another\n \nregistry=https://x/\n");
96
- expect(cfg.registry).toBe("https://x/");
97
- });
98
- });
99
-
100
- await describe("@gjsify/npm-registry — auth resolution", async () => {
101
- await it("longest path-prefix wins", async () => {
102
- const cfg: NpmrcConfig = {
103
- registry: DEFAULT_REGISTRY,
104
- scopes: {},
105
- authTokens: {
106
- "//artifacts.example.com": "wide-token",
107
- "//artifacts.example.com/api/npm": "narrow-token",
108
- },
109
- basicAuth: {},
110
- };
111
- expect(
112
- resolveAuthForUrl("https://artifacts.example.com/api/npm/lodash", cfg),
113
- ).toBe("Bearer narrow-token");
114
- });
115
-
116
- await it("host-only token applies to root URLs", async () => {
117
- const cfg: NpmrcConfig = {
118
- registry: DEFAULT_REGISTRY,
119
- scopes: {},
120
- authTokens: { "//registry.npmjs.org": "tok-1" },
121
- basicAuth: {},
122
- };
123
- expect(resolveAuthForUrl("https://registry.npmjs.org/lodash", cfg)).toBe(
124
- "Bearer tok-1",
125
- );
126
- });
127
-
128
- await it("buildHeaders attaches token + UA", async () => {
129
- const cfg: NpmrcConfig = {
130
- registry: DEFAULT_REGISTRY,
131
- scopes: {},
132
- authTokens: { "//registry.npmjs.org": "tok-x" },
133
- basicAuth: {},
134
- };
135
- const h = buildHeaders("https://registry.npmjs.org/lodash", { npmrc: cfg });
136
- expect(h["authorization"]).toBe("Bearer tok-x");
137
- expect(typeof h["user-agent"]).toBe("string");
138
- });
139
- });
140
-
141
- await describe("@gjsify/npm-registry — verifyIntegrity", async () => {
142
- await it("verifies sha256 of known bytes", async () => {
143
- const data = new TextEncoder().encode("hello world");
144
- // sha256("hello world") = uU0nuZNNPgilLlLX2n2r+sSE7+N6U4DukIj3rOLvzek=
145
- const expected = "sha256-uU0nuZNNPgilLlLX2n2r+sSE7+N6U4DukIj3rOLvzek=";
146
- expect(await verifyIntegrity(data, expected)).toBe(true);
147
- });
148
-
149
- await it("rejects bad digest", async () => {
150
- const data = new TextEncoder().encode("hello world");
151
- expect(await verifyIntegrity(data, "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=")).toBe(false);
152
- });
153
-
154
- await it("accepts any of multiple digests", async () => {
155
- const data = new TextEncoder().encode("hello world");
156
- const composite =
157
- "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= " +
158
- "sha256-uU0nuZNNPgilLlLX2n2r+sSE7+N6U4DukIj3rOLvzek=";
159
- expect(await verifyIntegrity(data, composite)).toBe(true);
160
- });
161
- });
162
-
163
- await describe("@gjsify/npm-registry — fetchPackument (mocked)", async () => {
164
- await it("parses a happy-path packument", async () => {
165
- const mock = makeMockFetch(async (url) => {
166
- if (url === "https://registry.npmjs.org/lodash") {
167
- return new Response(
168
- JSON.stringify({
169
- name: "lodash",
170
- "dist-tags": { latest: "4.17.21" },
171
- versions: {
172
- "4.17.21": {
173
- name: "lodash",
174
- version: "4.17.21",
175
- dist: { tarball: "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz" },
176
- },
177
- },
178
- }),
179
- { status: 200, headers: { "content-type": "application/json" } },
180
- );
181
- }
182
- return new Response("nope", { status: 404 });
183
- });
184
- const p = await fetchPackument("lodash", { fetch: mock });
185
- expect(p.name).toBe("lodash");
186
- expect(p["dist-tags"].latest).toBe("4.17.21");
187
- expect(p.versions["4.17.21"].dist.tarball).toMatch(/lodash-4\.17\.21\.tgz$/);
188
- });
189
-
190
- await it("rejects on schema mismatch", async () => {
191
- const mock = makeMockFetch(async () =>
192
- new Response(JSON.stringify({ name: "lodash" }), { status: 200 }),
193
- );
194
- let threw = false;
195
- try {
196
- await fetchPackument("lodash", { fetch: mock });
197
- } catch (e) {
198
- threw = true;
199
- expect(String((e as Error).message)).toMatch(/missing versions map/);
200
- }
201
- expect(threw).toBe(true);
202
- });
203
-
204
- await it("404 → PackageNotFoundError", async () => {
205
- const mock = makeMockFetch(async () =>
206
- new Response("not found", { status: 404, statusText: "Not Found" }),
207
- );
208
- let caught: Error | null = null;
209
- try {
210
- await fetchPackument("definitely-not-real-pkg", { fetch: mock });
211
- } catch (e) {
212
- caught = e as Error;
213
- }
214
- expect(caught).toBeTruthy();
215
- expect(caught instanceof PackageNotFoundError).toBe(true);
216
- });
217
-
218
- await it("includes auth header when npmrc provides a token", async () => {
219
- let seenAuth: string | null = null;
220
- const mock = makeMockFetch(async (url, init) => {
221
- seenAuth =
222
- (init?.headers as Record<string, string> | undefined)?.["authorization"] ?? null;
223
- return new Response(
224
- JSON.stringify({
225
- name: "lodash",
226
- "dist-tags": {},
227
- versions: {},
228
- }),
229
- { status: 200 },
230
- );
231
- });
232
- await fetchPackument("lodash", {
233
- fetch: mock,
234
- npmrc: {
235
- registry: DEFAULT_REGISTRY,
236
- scopes: {},
237
- authTokens: { "//registry.npmjs.org": "secret-tok" },
238
- basicAuth: {},
239
- },
240
- });
241
- expect(seenAuth).toBe("Bearer secret-tok");
242
- });
243
- });
244
-
245
- await describe("@gjsify/npm-registry — fetchTarball (mocked)", async () => {
246
- await it("returns Uint8Array bytes", async () => {
247
- const bytes = new Uint8Array([0x1f, 0x8b, 0x08, 0x00]); // gzip magic
248
- const mock = makeMockFetch(async () => new Response(bytes, { status: 200 }));
249
- const got = await fetchTarball("https://r/x.tgz", { fetch: mock });
250
- expect(got.length).toBe(4);
251
- expect(got[0]).toBe(0x1f);
252
- expect(got[1]).toBe(0x8b);
253
- });
254
-
255
- await it("verifies integrity when supplied", async () => {
256
- const data = new TextEncoder().encode("hello world");
257
- const ok = "sha256-uU0nuZNNPgilLlLX2n2r+sSE7+N6U4DukIj3rOLvzek=";
258
- const mock = makeMockFetch(async () => new Response(data, { status: 200 }));
259
- const got = await fetchTarball("https://r/x.tgz", { fetch: mock, integrity: ok });
260
- expect(got.length).toBe(11);
261
- });
262
-
263
- await it("integrity mismatch → IntegrityError", async () => {
264
- const data = new TextEncoder().encode("hello world");
265
- const bad = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
266
- const mock = makeMockFetch(async () => new Response(data, { status: 200 }));
267
- let caught: Error | null = null;
268
- try {
269
- await fetchTarball("https://r/x.tgz", { fetch: mock, integrity: bad });
270
- } catch (e) {
271
- caught = e as Error;
272
- }
273
- expect(caught instanceof IntegrityError).toBe(true);
274
- });
275
- });
276
- };
package/src/index.ts DELETED
@@ -1,333 +0,0 @@
1
- // npm registry client for the gjsify install backend.
2
- // Cross-platform (Node + GJS) - uses globalThis.fetch + SubtleCrypto only.
3
- // Reference: refs/npm-cli/workspaces/libnpmfetch + refs/bun/src/install/npm.zig.
4
-
5
- export const DEFAULT_REGISTRY = "https://registry.npmjs.org/";
6
-
7
- export interface NpmrcConfig {
8
- /** Default registry URL (trailing slash kept as written). */
9
- registry: string;
10
- /** Registry overrides per scope: `{"@scope": "https://registry/"}`. */
11
- scopes: Record<string, string>;
12
- /** Auth tokens keyed by `//host/path/:` prefix (npm convention). */
13
- authTokens: Record<string, string>;
14
- /** Basic-auth credentials keyed by host prefix. */
15
- basicAuth: Record<string, { username: string; password: string }>;
16
- }
17
-
18
- /** Distribution metadata for a single version. */
19
- export interface PackumentDist {
20
- tarball: string;
21
- integrity?: string;
22
- shasum?: string;
23
- }
24
-
25
- /** Single version record inside a packument. */
26
- export interface PackumentVersion {
27
- name: string;
28
- version: string;
29
- dist: PackumentDist;
30
- dependencies?: Record<string, string>;
31
- optionalDependencies?: Record<string, string>;
32
- bin?: string | Record<string, string>;
33
- deprecated?: string;
34
- [key: string]: unknown;
35
- }
36
-
37
- /** Top-level packument shape returned by `GET /<pkg>`. */
38
- export interface Packument {
39
- name: string;
40
- "dist-tags": Record<string, string>;
41
- versions: Record<string, PackumentVersion>;
42
- time?: Record<string, string>;
43
- [key: string]: unknown;
44
- }
45
-
46
- export interface FetchOptions {
47
- /** Override registry URL. Default: $npm_config_registry || DEFAULT_REGISTRY. */
48
- registry?: string;
49
- /** Pre-parsed .npmrc; if omitted, no auth is sent. */
50
- npmrc?: NpmrcConfig;
51
- /** Pre-built header map (overrides anything else). */
52
- headers?: Record<string, string>;
53
- /** AbortSignal forwarded to fetch. */
54
- signal?: AbortSignal;
55
- /** Custom fetch implementation; default = globalThis.fetch. */
56
- fetch?: typeof fetch;
57
- }
58
-
59
- /** Strict-validate a packument shape. Throws on schema mismatch. */
60
- export function assertPackument(name: string, body: unknown): asserts body is Packument {
61
- if (!body || typeof body !== "object") {
62
- throw new TypeError(`registry: ${name} packument is not an object`);
63
- }
64
- const p = body as Record<string, unknown>;
65
- if (typeof p.name !== "string") {
66
- throw new TypeError(`registry: ${name} packument missing string name`);
67
- }
68
- if (!p.versions || typeof p.versions !== "object") {
69
- throw new TypeError(`registry: ${name} packument missing versions map`);
70
- }
71
- }
72
-
73
- /** Pick the right registry URL for a package name (scoped overrides win). */
74
- export function registryFor(name: string, npmrc: NpmrcConfig | undefined): string {
75
- if (npmrc && name.startsWith("@")) {
76
- const scope = name.slice(0, name.indexOf("/"));
77
- const override = npmrc.scopes[scope];
78
- if (override) return ensureTrailingSlash(override);
79
- }
80
- if (npmrc?.registry) return ensureTrailingSlash(npmrc.registry);
81
- return DEFAULT_REGISTRY;
82
- }
83
-
84
- /** Build the GET URL for a packument. Handles `@scope/name` URL-encoding. */
85
- export function packumentUrl(name: string, registry: string): string {
86
- const base = ensureTrailingSlash(registry);
87
- if (name.startsWith("@")) {
88
- const slash = name.indexOf("/");
89
- if (slash < 0) throw new TypeError(`Invalid scoped package name: ${name}`);
90
- const scope = name.slice(0, slash);
91
- const rest = name.slice(slash + 1);
92
- return `${base}${encodeURIComponent(scope)}/${encodeURIComponent(rest)}`;
93
- }
94
- return `${base}${encodeURIComponent(name)}`;
95
- }
96
-
97
- /** Fetch + parse a packument. */
98
- export async function fetchPackument(name: string, opts: FetchOptions = {}): Promise<Packument> {
99
- const registry = opts.registry ?? registryFor(name, opts.npmrc);
100
- const url = packumentUrl(name, registry);
101
- const headers = buildHeaders(url, opts);
102
- headers["accept"] ??= "application/vnd.npm.install-v1+json";
103
-
104
- const fetchImpl = opts.fetch ?? globalThis.fetch;
105
- if (!fetchImpl) throw new Error("@gjsify/npm-registry: globalThis.fetch is missing");
106
-
107
- const res = await fetchImpl(url, { headers, signal: opts.signal });
108
- if (!res.ok) {
109
- if (res.status === 404) throw new PackageNotFoundError(name, url);
110
- throw new Error(`registry GET ${url} -> ${res.status} ${res.statusText}`);
111
- }
112
- const body = (await res.json()) as unknown;
113
- assertPackument(name, body);
114
- return body;
115
- }
116
-
117
- /** Download a tarball as bytes. Verifies SRI `integrity` when supplied. */
118
- export async function fetchTarball(
119
- url: string,
120
- opts: FetchOptions & { integrity?: string } = {},
121
- ): Promise<Uint8Array> {
122
- const headers = buildHeaders(url, opts);
123
- headers["accept"] ??= "application/octet-stream";
124
-
125
- const fetchImpl = opts.fetch ?? globalThis.fetch;
126
- if (!fetchImpl) throw new Error("@gjsify/npm-registry: globalThis.fetch is missing");
127
-
128
- const res = await fetchImpl(url, { headers, signal: opts.signal });
129
- if (!res.ok) throw new Error(`tarball GET ${url} -> ${res.status} ${res.statusText}`);
130
- const buf = new Uint8Array(await res.arrayBuffer());
131
- if (opts.integrity) {
132
- const ok = await verifyIntegrity(buf, opts.integrity);
133
- if (!ok) throw new IntegrityError(url, opts.integrity);
134
- }
135
- return buf;
136
- }
137
-
138
- /**
139
- * Verify an SRI string (e.g. `sha512-base64==`) against bytes.
140
- * Multiple hashes (space-separated) accepted; any match passes.
141
- */
142
- export async function verifyIntegrity(data: Uint8Array, integrity: string): Promise<boolean> {
143
- const parts = integrity.trim().split(/\s+/);
144
- for (const part of parts) {
145
- const dash = part.indexOf("-");
146
- if (dash < 0) continue;
147
- const algo = part.slice(0, dash).toLowerCase();
148
- const expected = part.slice(dash + 1);
149
- const subtle = (globalThis as { crypto?: { subtle?: SubtleCrypto } }).crypto?.subtle;
150
- if (!subtle) throw new Error("@gjsify/npm-registry: globalThis.crypto.subtle is missing");
151
- const algoName = subriToWebCryptoAlgo(algo);
152
- if (!algoName) continue;
153
- const digest = await subtle.digest(algoName, dataAsArrayBuffer(data));
154
- const got = bytesToBase64(new Uint8Array(digest));
155
- if (got === expected) return true;
156
- }
157
- return false;
158
- }
159
-
160
- function subriToWebCryptoAlgo(sri: string): "SHA-1" | "SHA-256" | "SHA-384" | "SHA-512" | null {
161
- switch (sri) {
162
- case "sha1":
163
- return "SHA-1";
164
- case "sha256":
165
- return "SHA-256";
166
- case "sha384":
167
- return "SHA-384";
168
- case "sha512":
169
- return "SHA-512";
170
- default:
171
- return null;
172
- }
173
- }
174
-
175
- function dataAsArrayBuffer(data: Uint8Array): ArrayBuffer {
176
- if (data.byteOffset === 0 && data.byteLength === data.buffer.byteLength) {
177
- return data.buffer as ArrayBuffer;
178
- }
179
- const copy = new Uint8Array(data.byteLength);
180
- copy.set(data);
181
- return copy.buffer;
182
- }
183
-
184
- function bytesToBase64(bytes: Uint8Array): string {
185
- // Standard base64 — no URL-safe variant. Cross-platform: btoa exists in
186
- // both Node and GJS (the latter via @gjsify/web-globals).
187
- let bin = "";
188
- for (let i = 0; i < bytes.length; i++) {
189
- bin += String.fromCharCode(bytes[i]);
190
- }
191
- return btoa(bin);
192
- }
193
-
194
- /** Parse a `.npmrc` text body. Unknown keys are kept on the result for callers. */
195
- export function parseNpmrc(text: string): NpmrcConfig {
196
- const out: NpmrcConfig & { [k: string]: unknown } = {
197
- registry: DEFAULT_REGISTRY,
198
- scopes: {},
199
- authTokens: {},
200
- basicAuth: {},
201
- };
202
- const lines = text.split(/\r?\n/);
203
- const basic: Record<string, { user?: string; pass?: string }> = {};
204
- for (const raw of lines) {
205
- const line = raw.replace(/^\s+|\s+$/g, "");
206
- if (!line || line.startsWith("#") || line.startsWith(";")) continue;
207
- const eq = line.indexOf("=");
208
- if (eq < 0) continue;
209
- const key = line.slice(0, eq).trim();
210
- const value = expandEnv(stripQuotes(line.slice(eq + 1).trim()));
211
- if (key === "registry") {
212
- out.registry = ensureTrailingSlash(value);
213
- continue;
214
- }
215
- const scopeRegistry = key.match(/^(@[^:]+):registry$/);
216
- if (scopeRegistry) {
217
- out.scopes[scopeRegistry[1]] = ensureTrailingSlash(value);
218
- continue;
219
- }
220
- const tokenMatch = key.match(/^\/\/(.+):_authToken$/);
221
- if (tokenMatch) {
222
- out.authTokens[normalizeAuthHost(tokenMatch[1])] = value;
223
- continue;
224
- }
225
- const userMatch = key.match(/^\/\/(.+):username$/);
226
- if (userMatch) {
227
- (basic[normalizeAuthHost(userMatch[1])] ??= {}).user = value;
228
- continue;
229
- }
230
- const passMatch = key.match(/^\/\/(.+):_password$/);
231
- if (passMatch) {
232
- const decoded = base64Decode(value);
233
- (basic[normalizeAuthHost(passMatch[1])] ??= {}).pass = decoded;
234
- continue;
235
- }
236
- }
237
- for (const [host, creds] of Object.entries(basic)) {
238
- if (creds.user && creds.pass !== undefined) {
239
- out.basicAuth[host] = { username: creds.user, password: creds.pass };
240
- }
241
- }
242
- return out;
243
- }
244
-
245
- /** Build auth + UA headers for a request URL. Pure (no I/O). */
246
- export function buildHeaders(url: string, opts: FetchOptions): Record<string, string> {
247
- const headers: Record<string, string> = { "user-agent": "gjsify-install/0.3.7" };
248
- if (opts.npmrc) {
249
- const auth = resolveAuthForUrl(url, opts.npmrc);
250
- if (auth) headers["authorization"] = auth;
251
- }
252
- if (opts.headers) {
253
- for (const [k, v] of Object.entries(opts.headers)) headers[k.toLowerCase()] = v;
254
- }
255
- return headers;
256
- }
257
-
258
- /** Resolve an `Authorization` header for a URL given a parsed .npmrc. */
259
- export function resolveAuthForUrl(url: string, npmrc: NpmrcConfig): string | null {
260
- const u = new URL(url);
261
- // npm matches keys against the URL by walking from the deepest path back to
262
- // the host root, picking the longest prefix match.
263
- const candidates = pathPrefixes(u);
264
- for (const prefix of candidates) {
265
- const token = npmrc.authTokens[prefix];
266
- if (token) return `Bearer ${token}`;
267
- const basic = npmrc.basicAuth[prefix];
268
- if (basic) {
269
- const enc = btoa(`${basic.username}:${basic.password}`);
270
- return `Basic ${enc}`;
271
- }
272
- }
273
- return null;
274
- }
275
-
276
- function pathPrefixes(u: URL): string[] {
277
- // Walk the URL path from deepest to shallowest. Match npm's nerf-dart
278
- // convention of NO trailing slash on stored keys: `//host`, `//host/api`,
279
- // `//host/api/npm`. Keys with trailing slashes are normalized in
280
- // parseNpmrc so a longest-prefix scan compares apples to apples.
281
- const segments = u.pathname.split("/").filter(Boolean);
282
- const prefixes: string[] = [];
283
- for (let i = segments.length; i >= 0; i--) {
284
- const tail = segments.slice(0, i).join("/");
285
- prefixes.push(tail ? `//${u.host}/${tail}` : `//${u.host}`);
286
- }
287
- return prefixes;
288
- }
289
-
290
- function normalizeAuthHost(captured: string): string {
291
- // npm strips the trailing slash from `//host/path/:_authToken` keys so the
292
- // path-prefix matcher can compare host-rooted ("//host") and nested
293
- // ("//host/path") entries on the same axis.
294
- const trimmed = captured.replace(/\/+$/, "");
295
- return `//${trimmed}`;
296
- }
297
-
298
- function ensureTrailingSlash(s: string): string {
299
- return s.endsWith("/") ? s : s + "/";
300
- }
301
-
302
- function stripQuotes(s: string): string {
303
- if ((s.startsWith('"') && s.endsWith('"')) || (s.startsWith("'") && s.endsWith("'"))) {
304
- return s.slice(1, -1);
305
- }
306
- return s;
307
- }
308
-
309
- function expandEnv(s: string): string {
310
- // Handles `${VAR}` only — npm config does not support `$VAR`.
311
- return s.replace(/\$\{([A-Z0-9_]+)\}/gi, (_m, name: string) => {
312
- const env = (globalThis as { process?: { env?: Record<string, string> } }).process?.env;
313
- return env?.[name] ?? "";
314
- });
315
- }
316
-
317
- function base64Decode(s: string): string {
318
- return atob(s);
319
- }
320
-
321
- export class PackageNotFoundError extends Error {
322
- constructor(public readonly name: string, public readonly url: string) {
323
- super(`Package not found in registry: ${name} (${url})`);
324
- this.name = "PackageNotFoundError";
325
- }
326
- }
327
-
328
- export class IntegrityError extends Error {
329
- constructor(public readonly url: string, public readonly integrity: string) {
330
- super(`Tarball integrity mismatch for ${url} (expected ${integrity})`);
331
- this.name = "IntegrityError";
332
- }
333
- }
package/src/test.mts DELETED
@@ -1,5 +0,0 @@
1
- import { run } from "@gjsify/unit";
2
-
3
- import npmRegistryTestSuite from "./index.spec.js";
4
-
5
- run({ npmRegistryTestSuite });
@@ -1,8 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "exclude": [
4
- "src/test.mts",
5
- "src/**/*.spec.ts",
6
- "src/**/*.spec.mts"
7
- ]
8
- }
package/tsconfig.json DELETED
@@ -1,23 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "module": "ESNext",
4
- "target": "ESNext",
5
- "moduleResolution": "bundler",
6
- "experimentalDecorators": true,
7
- "declaration": true,
8
- "allowImportingTsExtensions": false,
9
- "outDir": "lib/esm",
10
- "rootDir": "src",
11
- "declarationDir": "lib/types",
12
- "composite": true,
13
- "skipLibCheck": true,
14
- "strict": true,
15
- "lib": ["ESNext", "DOM"]
16
- },
17
- "include": [
18
- "src/**/*.ts"
19
- ],
20
- "exclude": [
21
- "src/test.mts"
22
- ]
23
- }