nf3 0.2.0 → 0.3.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.
Files changed (52) hide show
  1. package/README.md +23 -25
  2. package/dist/_chunks/libs/confbox.mjs +7 -0
  3. package/dist/_chunks/libs/exsolve.mjs +1 -0
  4. package/dist/_chunks/libs/pathe.mjs +1 -0
  5. package/dist/_chunks/libs/pkg-types.mjs +1 -0
  6. package/dist/_chunks/trace.mjs +251 -0
  7. package/dist/_chunks/trace2.mjs +3 -0
  8. package/dist/_chunks/types.d.mts +101 -0
  9. package/dist/index.d.mts +2 -96
  10. package/dist/index.mjs +2 -316
  11. package/dist/node_modules/@isaacs/balanced-match/dist/commonjs/index.js +1 -0
  12. package/dist/node_modules/@isaacs/balanced-match/dist/commonjs/package.json +3 -0
  13. package/dist/node_modules/@isaacs/balanced-match/package.json +19 -0
  14. package/dist/node_modules/@isaacs/brace-expansion/dist/commonjs/index.js +1 -0
  15. package/dist/node_modules/@isaacs/brace-expansion/dist/commonjs/package.json +3 -0
  16. package/dist/node_modules/@isaacs/brace-expansion/package.json +19 -0
  17. package/dist/node_modules/@mapbox/node-pre-gyp/lib/install.js +1 -1
  18. package/dist/node_modules/@mapbox/node-pre-gyp/lib/mock/http.js +2 -0
  19. package/dist/node_modules/@mapbox/node-pre-gyp/lib/mock/s3.js +1 -0
  20. package/dist/node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js +1 -1
  21. package/dist/node_modules/@mapbox/node-pre-gyp/lib/publish.js +1 -1
  22. package/dist/node_modules/@mapbox/node-pre-gyp/lib/util/abi_crosswalk.json +53 -1
  23. package/dist/node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js +1 -2
  24. package/dist/node_modules/@mapbox/node-pre-gyp/lib/util/versioning.js +1 -1
  25. package/dist/node_modules/@mapbox/node-pre-gyp/package.json +1 -1
  26. package/dist/node_modules/@vercel/nft/out/resolve-dependency.js +1 -1
  27. package/dist/node_modules/@vercel/nft/package.json +1 -1
  28. package/dist/node_modules/fsevents/fsevents.js +1 -0
  29. package/dist/node_modules/fsevents/fsevents.node +0 -0
  30. package/dist/node_modules/fsevents/package.json +5 -0
  31. package/dist/node_modules/glob/package.json +1 -1
  32. package/dist/node_modules/lru-cache/dist/commonjs/index.js +1 -1
  33. package/dist/node_modules/lru-cache/package.json +1 -1
  34. package/dist/node_modules/minimatch/dist/commonjs/ast.js +1 -1
  35. package/dist/node_modules/minimatch/dist/commonjs/escape.js +1 -1
  36. package/dist/node_modules/minimatch/dist/commonjs/index.js +3 -3
  37. package/dist/node_modules/minimatch/dist/commonjs/unescape.js +1 -1
  38. package/dist/node_modules/minimatch/package.json +1 -1
  39. package/dist/node_modules/path-scurry/dist/commonjs/index.js +1 -1
  40. package/dist/node_modules/path-scurry/package.json +1 -1
  41. package/dist/plugin.d.mts +7 -0
  42. package/dist/plugin.mjs +92 -0
  43. package/package.json +13 -13
  44. package/dist/_libs/confbox.mjs +0 -13
  45. package/dist/_libs/exsolve.mjs +0 -1
  46. package/dist/_libs/mlly.mjs +0 -1
  47. package/dist/_libs/pkg-types.mjs +0 -1
  48. package/dist/node_modules/acorn/dist/acorn.mjs +0 -9
  49. package/dist/node_modules/balanced-match/index.js +0 -1
  50. package/dist/node_modules/balanced-match/package.json +0 -5
  51. package/dist/node_modules/brace-expansion/index.js +0 -1
  52. package/dist/node_modules/brace-expansion/package.json +0 -5
package/dist/index.mjs CHANGED
@@ -1,317 +1,3 @@
1
- import { n as resolveModuleURL } from "./_libs/exsolve.mjs";
2
- import { a as basename, c as join, d as resolve, i as parseNodeModulePath, l as normalize, n as lookupNodeModuleSubpath, o as dirname, r as normalizeid, s as isAbsolute$1, t as isValidNodeImport, u as relative } from "./_libs/mlly.mjs";
3
- import "./_libs/confbox.mjs";
4
- import { n as writePackageJSON, t as readPackageJSON } from "./_libs/pkg-types.mjs";
5
- import { existsSync, promises } from "node:fs";
6
- import { fileURLToPath, pathToFileURL } from "node:url";
7
- import { stat } from "node:fs/promises";
8
- import { extname } from "node:path";
9
- import { platform } from "node:os";
10
- import { nodeFileTrace } from "@vercel/nft";
11
- import semver from "semver";
1
+ import { r as traceNodeModules } from "./_chunks/trace.mjs";
12
2
 
13
- //#region src/trace.ts
14
- async function traceNodeModules(input, opts) {
15
- await opts?.hooks?.traceStart?.(input);
16
- const traceResult = await nodeFileTrace([...input], {
17
- conditions: (opts.exportConditions || [
18
- "node",
19
- "import",
20
- "default"
21
- ]).filter((c) => ![
22
- "require",
23
- "import",
24
- "default"
25
- ].includes(c)),
26
- ...opts.traceOptions
27
- });
28
- await opts?.hooks?.traceResult?.(traceResult);
29
- const _resolveTracedPath = (p) => promises.realpath(resolve(opts.traceOptions?.base || ".", p));
30
- const tracedFiles = Object.fromEntries(await Promise.all([...traceResult.reasons.entries()].map(async ([_path, reasons]) => {
31
- if (reasons.ignored) return;
32
- const path$1 = await _resolveTracedPath(_path);
33
- if (!path$1.includes("node_modules")) return;
34
- if (!await isFile(path$1)) return;
35
- const { dir: baseDir, name: pkgName, subpath } = parseNodeModulePath(path$1);
36
- if (!baseDir || !pkgName) return;
37
- const pkgPath = join(baseDir, pkgName);
38
- return [path$1, {
39
- path: path$1,
40
- parents: await Promise.all([...reasons.parents].map((p) => _resolveTracedPath(p))),
41
- subpath,
42
- pkgName,
43
- pkgPath
44
- }];
45
- })).then((r) => r.filter(Boolean)));
46
- await opts?.hooks?.tracedFiles?.(tracedFiles);
47
- const tracedPackages = {};
48
- for (const tracedFile of Object.values(tracedFiles)) {
49
- const pkgName = tracedFile.pkgName;
50
- let tracedPackage = tracedPackages[pkgName];
51
- let pkgJSON = await readPackageJSON(tracedFile.pkgPath, { cache: true }).catch(() => {});
52
- if (!pkgJSON) pkgJSON = {
53
- name: pkgName,
54
- version: "0.0.0"
55
- };
56
- if (!tracedPackage) {
57
- tracedPackage = {
58
- name: pkgName,
59
- versions: {}
60
- };
61
- tracedPackages[pkgName] = tracedPackage;
62
- }
63
- let tracedPackageVersion = tracedPackage.versions[pkgJSON.version || "0.0.0"];
64
- if (!tracedPackageVersion) {
65
- tracedPackageVersion = {
66
- path: tracedFile.pkgPath,
67
- files: [],
68
- pkgJSON
69
- };
70
- tracedPackage.versions[pkgJSON.version || "0.0.0"] = tracedPackageVersion;
71
- }
72
- tracedPackageVersion.files.push(tracedFile.path);
73
- tracedFile.pkgName = pkgName;
74
- if (pkgJSON.version) tracedFile.pkgVersion = pkgJSON.version;
75
- }
76
- await opts?.hooks?.tracedPackages?.(tracedPackages);
77
- const usedAliases = {};
78
- const outDir = resolve(opts.rootDir || ".", opts.outDir || "dist", "node_modules");
79
- const writePackage = async (name, version, _pkgPath) => {
80
- const pkg = tracedPackages[name];
81
- const pkgPath = _pkgPath || pkg.name;
82
- for (const src of pkg.versions[version].files) {
83
- const { subpath } = parseNodeModulePath(src);
84
- if (!subpath) continue;
85
- const dst = resolve(outDir, pkgPath, subpath);
86
- await promises.mkdir(dirname(dst), { recursive: true });
87
- const transformers = (opts.transform || []).filter((t) => t?.filter?.(src) && t.handler);
88
- if (transformers.length > 0) {
89
- let content = await promises.readFile(src, "utf8");
90
- for (const transformer of transformers) content = await transformer.handler(content, src) ?? content;
91
- await promises.writeFile(dst, content, "utf8");
92
- } else await promises.copyFile(src, dst);
93
- if (opts.chmod) await promises.chmod(dst, opts.chmod === true ? 420 : opts.chmod);
94
- }
95
- const pkgJSON = pkg.versions[version].pkgJSON;
96
- applyProductionCondition(pkgJSON.exports);
97
- const pkgJSONPath = join(outDir, pkgPath, "package.json");
98
- await promises.mkdir(dirname(pkgJSONPath), { recursive: true });
99
- await promises.writeFile(pkgJSONPath, JSON.stringify(pkgJSON, null, 2), "utf8");
100
- if (opts.traceAlias && opts.traceAlias[pkgPath]) {
101
- usedAliases[opts.traceAlias[pkgPath]] = version;
102
- await linkPackage(pkgPath, opts.traceAlias[pkgPath]);
103
- }
104
- };
105
- const isWindows = platform() === "win32";
106
- const linkPackage = async (from, to) => {
107
- const src = join(outDir, from);
108
- const dst = join(outDir, to);
109
- if ((await promises.lstat(dst).catch(() => null))?.isSymbolicLink()) return;
110
- await promises.mkdir(dirname(dst), { recursive: true });
111
- await promises.symlink(relative(dirname(dst), src), dst, isWindows ? "junction" : "dir").catch((error) => {
112
- if (error.code !== "EEXIST") console.error("Cannot link", from, "to", to, error);
113
- });
114
- };
115
- const findPackageParents = (pkg, version) => {
116
- const versionFiles = pkg.versions[version].files.map((path$1) => tracedFiles[path$1]);
117
- return [...new Set(versionFiles.flatMap((file) => file.parents.map((parentPath) => {
118
- const parentFile = tracedFiles[parentPath];
119
- if (!parentFile || parentFile.pkgName === pkg.name) return null;
120
- return `${parentFile.pkgName}@${parentFile.pkgVersion}`;
121
- }).filter(Boolean)))];
122
- };
123
- const multiVersionPkgs = {};
124
- const singleVersionPackages = [];
125
- for (const tracedPackage of Object.values(tracedPackages)) {
126
- const versions = Object.keys(tracedPackage.versions);
127
- if (versions.length === 1) {
128
- singleVersionPackages.push(tracedPackage.name);
129
- continue;
130
- }
131
- multiVersionPkgs[tracedPackage.name] = {};
132
- for (const version of versions) multiVersionPkgs[tracedPackage.name][version] = findPackageParents(tracedPackage, version);
133
- }
134
- await Promise.all(singleVersionPackages.map((pkgName) => {
135
- const pkg = tracedPackages[pkgName];
136
- const version = Object.keys(pkg.versions)[0];
137
- return writePackage(pkgName, version);
138
- }));
139
- for (const [pkgName, pkgVersions] of Object.entries(multiVersionPkgs)) {
140
- const versionEntries = Object.entries(pkgVersions).sort(([v1, p1], [v2, p2]) => {
141
- if (p1.length === 0) return -1;
142
- if (p2.length === 0) return 1;
143
- return compareVersions(v1, v2);
144
- });
145
- for (const [version, parentPkgs] of versionEntries) {
146
- await writePackage(pkgName, version, `.nf3/${pkgName}@${version}`);
147
- await linkPackage(`.nf3/${pkgName}@${version}`, `${pkgName}`);
148
- for (const parentPkg of parentPkgs) {
149
- const parentPkgName = parentPkg.replace(/@[^@]+$/, "");
150
- await (multiVersionPkgs[parentPkgName] ? linkPackage(`.nf3/${pkgName}@${version}`, `.nf3/${parentPkg}/node_modules/${pkgName}`) : linkPackage(`.nf3/${pkgName}@${version}`, `${parentPkgName}/node_modules/${pkgName}`));
151
- }
152
- }
153
- }
154
- if (opts.writePackageJson) await writePackageJSON(resolve(outDir, "../package.json"), {
155
- name: "traced-node-modules",
156
- version: "1.0.0",
157
- type: "module",
158
- private: true,
159
- dependencies: Object.fromEntries([...Object.values(tracedPackages).map((pkg) => [pkg.name, Object.keys(pkg.versions)[0]]), ...Object.entries(usedAliases)].sort(([a], [b]) => a.localeCompare(b)))
160
- });
161
- }
162
- function compareVersions(v1 = "0.0.0", v2 = "0.0.0") {
163
- try {
164
- return semver.lt(v1, v2, { loose: true }) ? 1 : -1;
165
- } catch {
166
- return v1.localeCompare(v2);
167
- }
168
- }
169
- function applyProductionCondition(exports) {
170
- if (!exports || typeof exports === "string" || Array.isArray(exports)) return;
171
- if ("production" in exports) if (typeof exports.production === "string") exports.default = exports.production;
172
- else Object.assign(exports, exports.production);
173
- for (const key in exports) applyProductionCondition(exports[key]);
174
- }
175
- async function isFile(file) {
176
- try {
177
- return (await promises.stat(file)).isFile();
178
- } catch (error) {
179
- if (error?.code === "ENOENT") return false;
180
- throw error;
181
- }
182
- }
183
-
184
- //#endregion
185
- //#region src/plugin.ts
186
- function rollupNodeFileTrace(opts = {}) {
187
- const trackedExternals = /* @__PURE__ */ new Set();
188
- const moduleDirectories = opts.moduleDirectories || [resolve(opts.rootDir || ".", "node_modules") + "/"];
189
- const tryResolve = (id, importer) => {
190
- if (id.startsWith("\0")) return id;
191
- const from = importer ? [isAbsolute$1(importer) ? pathToFileURL(importer) : importer] : moduleDirectories;
192
- const extensions = extname(id) ? [] : [
193
- ".mjs",
194
- ".cjs",
195
- ".js",
196
- ".mts",
197
- ".cts",
198
- ".ts",
199
- ".json"
200
- ];
201
- for (const dir of from) {
202
- const res = resolveModuleURL(id, {
203
- try: true,
204
- from: dir,
205
- extensions,
206
- suffixes: ["", "/index"],
207
- conditions: opts.exportConditions
208
- });
209
- if (res) return res.startsWith("file://") ? fileURLToPath(res) : res;
210
- }
211
- };
212
- const inlineMatchers = (opts.inline || []).map((p) => normalizeMatcher(p)).sort((a, b) => (b.score || 0) - (a.score || 0));
213
- const externalMatchers = (opts.external || []).map((p) => normalizeMatcher(p)).sort((a, b) => (b.score || 0) - (a.score || 0));
214
- const isExplicitInline = (id, importer) => {
215
- if (id.startsWith("\0")) return true;
216
- const inlineMatch = inlineMatchers.find((m) => m(id, importer));
217
- const externalMatch = externalMatchers.find((m) => m(id, importer));
218
- if (inlineMatch && (!externalMatch || externalMatch && (inlineMatch.score || 0) > (externalMatch.score || 0))) return true;
219
- };
220
- return {
221
- name: "nf3",
222
- resolveId: {
223
- order: "pre",
224
- async handler(originalId, importer, options) {
225
- if (!originalId || originalId.startsWith("\0") || originalId.includes("?") || originalId.startsWith("#")) return null;
226
- if (originalId.startsWith(".")) return null;
227
- if (/^[a-z0-9]{2,}:/i.test(originalId)) return null;
228
- if (importer && /\.d\.[mc]?[jt]s$/.test(basename(importer))) return null;
229
- const id = normalize(originalId);
230
- if (isExplicitInline(id, importer)) return null;
231
- const resolved = await this.resolve(originalId, importer, options) || { id };
232
- if (isExplicitInline(resolved.id, importer)) return null;
233
- if (!isAbsolute$1(resolved.id) || !existsSync(resolved.id) || await isDirectory(resolved.id)) resolved.id = tryResolve(resolved.id, importer) || resolved.id;
234
- if (!await isValidNodeImport(resolved.id).catch(() => false)) return null;
235
- if (opts.noTrace) return {
236
- ...resolved,
237
- id: isAbsolute$1(resolved.id) ? normalizeid(resolved.id) : resolved.id,
238
- external: true
239
- };
240
- const { name: pkgName } = parseNodeModulePath(resolved.id);
241
- if (!pkgName) return null;
242
- if (pkgName !== originalId) {
243
- if (!isAbsolute$1(originalId)) {
244
- const fullPath = tryResolve(originalId, importer);
245
- if (fullPath) {
246
- trackedExternals.add(fullPath);
247
- return {
248
- id: originalId,
249
- external: true
250
- };
251
- }
252
- }
253
- if (tryResolve(pkgName, importer) !== id) {
254
- const guessedSubpath = await lookupNodeModuleSubpath(id).catch(() => null);
255
- const resolvedGuess = guessedSubpath && tryResolve(join(pkgName, guessedSubpath), importer);
256
- if (resolvedGuess === id) {
257
- trackedExternals.add(resolvedGuess);
258
- return {
259
- id: join(pkgName, guessedSubpath),
260
- external: true
261
- };
262
- }
263
- return null;
264
- }
265
- }
266
- trackedExternals.add(resolved.id);
267
- return {
268
- id: pkgName,
269
- external: true
270
- };
271
- }
272
- },
273
- buildEnd: {
274
- order: "post",
275
- async handler() {
276
- if (opts.noTrace) return;
277
- for (const pkgName of opts.traceInclude || []) {
278
- const path$1 = await this.resolve(pkgName);
279
- if (path$1?.id) trackedExternals.add(path$1.id.replace(/\?.+/, ""));
280
- }
281
- await traceNodeModules([...trackedExternals], opts);
282
- }
283
- }
284
- };
285
- }
286
- function normalizeMatcher(input) {
287
- if (typeof input === "function") {
288
- input.score = 3e4 + input.toString().length;
289
- return input;
290
- }
291
- if (typeof input === "string") {
292
- const pattern = normalize(input);
293
- const matcher = ((id) => {
294
- return id.startsWith(pattern) || id.split("node_modules/").pop()?.startsWith(pattern);
295
- });
296
- matcher.score = 2e4 + input.length;
297
- Object.defineProperty(matcher, "name", { value: `match(${pattern})` });
298
- return matcher;
299
- }
300
- if (input instanceof RegExp) {
301
- const matcher = ((id) => input.test(id));
302
- matcher.score = 1e4 + input.toString().length;
303
- Object.defineProperty(matcher, "name", { value: `match(${input})` });
304
- return matcher;
305
- }
306
- throw new Error(`Invalid matcher or pattern: ${input}`);
307
- }
308
- async function isDirectory(path$1) {
309
- try {
310
- return (await stat(path$1)).isDirectory();
311
- } catch {
312
- return false;
313
- }
314
- }
315
-
316
- //#endregion
317
- export { rollupNodeFileTrace, traceNodeModules };
3
+ export { traceNodeModules };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,`__esModule`,{value:!0}),exports.range=exports.balanced=void 0;const balanced=(e,n,r)=>{let i=e instanceof RegExp?maybeMatch(e,r):e,a=n instanceof RegExp?maybeMatch(n,r):n,o=i!==null&&a!=null&&(0,exports.range)(i,a,r);return o&&{start:o[0],end:o[1],pre:r.slice(0,o[0]),body:r.slice(o[0]+i.length,o[1]),post:r.slice(o[1]+a.length)}};exports.balanced=balanced;const maybeMatch=(e,t)=>{let n=t.match(e);return n?n[0]:null},range=(e,t,n)=>{let r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(r=[],a=n.length;u>=0&&!s;){if(u===c)r.push(u),c=n.indexOf(e,u+1);else if(r.length===1){let e=r.pop();e!==void 0&&(s=[e,l])}else i=r.pop(),i!==void 0&&i<a&&(a=i,o=l),l=n.indexOf(t,u+1);u=c<l&&c>=0?c:l}r.length&&o!==void 0&&(s=[a,o])}return s};exports.range=range;
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "@isaacs/balanced-match",
3
+ "version": "4.0.1",
4
+ "exports": {
5
+ "./package.json": "./package.json",
6
+ ".": {
7
+ "import": {
8
+ "types": "./dist/esm/index.d.ts",
9
+ "default": "./dist/esm/index.js"
10
+ },
11
+ "require": {
12
+ "types": "./dist/commonjs/index.d.ts",
13
+ "default": "./dist/commonjs/index.js"
14
+ }
15
+ }
16
+ },
17
+ "type": "module",
18
+ "main": "./dist/commonjs/index.js"
19
+ }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,`__esModule`,{value:!0}),exports.expand=expand;const balanced_match_1=require(`@isaacs/balanced-match`),escSlash=`\0SLASH`+Math.random()+`\0`,escOpen=`\0OPEN`+Math.random()+`\0`,escClose=`\0CLOSE`+Math.random()+`\0`,escComma=`\0COMMA`+Math.random()+`\0`,escPeriod=`\0PERIOD`+Math.random()+`\0`,escSlashPattern=new RegExp(escSlash,`g`),escOpenPattern=new RegExp(escOpen,`g`),escClosePattern=new RegExp(escClose,`g`),escCommaPattern=new RegExp(escComma,`g`),escPeriodPattern=new RegExp(escPeriod,`g`),slashPattern=/\\\\/g,openPattern=/\\{/g,closePattern=/\\}/g,commaPattern=/\\,/g,periodPattern=/\\./g;function numeric(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function escapeBraces(e){return e.replace(slashPattern,escSlash).replace(openPattern,escOpen).replace(closePattern,escClose).replace(commaPattern,escComma).replace(periodPattern,escPeriod)}function unescapeBraces(e){return e.replace(escSlashPattern,`\\`).replace(escOpenPattern,`{`).replace(escClosePattern,`}`).replace(escCommaPattern,`,`).replace(escPeriodPattern,`.`)}function parseCommaParts(m){if(!m)return[``];let h=[],g=(0,balanced_match_1.balanced)(`{`,`}`,m);if(!g)return m.split(`,`);let{pre:_,body:v,post:y}=g,b=_.split(`,`);b[b.length-1]+=`{`+v+`}`;let x=parseCommaParts(y);return y.length&&(b[b.length-1]+=x.shift(),b.push.apply(b,x)),h.push.apply(h,b),h}function expand(e){return e?(e.slice(0,2)===`{}`&&(e=`\\{\\}`+e.slice(2)),expand_(escapeBraces(e),!0).map(unescapeBraces)):[]}function embrace(e){return`{`+e+`}`}function isPadded(e){return/^-?0\d/.test(e)}function lte(e,m){return e<=m}function gte(e,m){return e>=m}function expand_(m,h){let _=[],v=(0,balanced_match_1.balanced)(`{`,`}`,m);if(!v)return[m];let y=v.pre,b=v.post.length?expand_(v.post,!1):[``];if(/\$$/.test(v.pre))for(let e=0;e<b.length;e++){let m=y+`{`+v.body+`}`+b[e];_.push(m)}else{let e=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(v.body),x=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(v.body),S=e||x,C=v.body.indexOf(`,`)>=0;if(!S&&!C)return v.post.match(/,(?!,).*\}/)?(m=v.pre+`{`+v.body+escClose+v.post,expand_(m)):[m];let w;if(S)w=v.body.split(/\.\./);else if(w=parseCommaParts(v.body),w.length===1&&w[0]!==void 0&&(w=expand_(w[0],!1).map(embrace),w.length===1))return b.map(e=>v.pre+w[0]+e);let T;if(S&&w[0]!==void 0&&w[1]!==void 0){let e=numeric(w[0]),m=numeric(w[1]),h=Math.max(w[0].length,w[1].length),g=w.length===3&&w[2]!==void 0?Math.abs(numeric(w[2])):1,_=lte;m<e&&(g*=-1,_=gte);let v=w.some(isPadded);T=[];for(let y=e;_(y,m);y+=g){let e;if(x)e=String.fromCharCode(y),e===`\\`&&(e=``);else if(e=String(y),v){let m=h-e.length;if(m>0){let h=Array(m+1).join(`0`);e=y<0?`-`+h+e.slice(1):h+e}}T.push(e)}}else{T=[];for(let e=0;e<w.length;e++)T.push.apply(T,expand_(w[e],!1))}for(let e=0;e<T.length;e++)for(let m=0;m<b.length;m++){let g=y+T[e]+b[m];(!h||S||g)&&_.push(g)}}return _}
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "@isaacs/brace-expansion",
3
+ "version": "5.0.0",
4
+ "exports": {
5
+ "./package.json": "./package.json",
6
+ ".": {
7
+ "import": {
8
+ "types": "./dist/esm/index.d.ts",
9
+ "default": "./dist/esm/index.js"
10
+ },
11
+ "require": {
12
+ "types": "./dist/commonjs/index.d.ts",
13
+ "default": "./dist/commonjs/index.js"
14
+ }
15
+ }
16
+ },
17
+ "type": "module",
18
+ "main": "./dist/commonjs/index.js"
19
+ }
@@ -1 +1 @@
1
- "use strict";module.exports=exports=install,exports.usage=`Attempts to install pre-built binary for module`;const fs=require(`fs`),path=require(`path`),log=require(`./util/log.js`),existsAsync=fs.exists||path.exists,versioning=require(`./util/versioning.js`),napi=require(`./util/napi.js`),fetch=require(`node-fetch`),tar=require(`tar`);let npgVersion=`unknown`;try{let n=fs.readFileSync(path.join(__dirname,`..`,`package.json`),`utf8`);npgVersion=JSON.parse(n).version}catch{}function place_binary(t,r,i,a){log.log(`GET`,t);let s=process.env.npm_config_user_agent||`node `+process.version,l=t.replace(`+`,`%2B`),d={uri:l,headers:{"User-Agent":`node-pre-gyp (v`+npgVersion+`, `+s+`)`},follow_max:10};if(i.cafile)try{d.ca=fs.readFileSync(i.cafile)}catch(e){return a(e)}else i.ca&&(d.ca=i.ca);let f=i.proxy||process.env.http_proxy||process.env.HTTP_PROXY||process.env.npm_config_proxy,p;if(f){let{HttpsProxyAgent:e}=require(`https-proxy-agent`);p=new e(f),log.log(`download`,`proxy agent configured using: "${f}"`)}fetch(l,{agent:p}).then(e=>{if(!e.ok)throw Error(`response status ${e.status} ${e.statusText} on ${l}`);let t=e.body;return new Promise((e,i)=>{let a=0;t.pipe(extract(r,e=>{a+=1,log.info(`install`,`unpacking ${e.path}`)})).on(`error`,e=>{i(e)}),t.on(`end`,()=>{e(`extracted file count: ${a}`)}),t.on(`error`,e=>{i(e)})})}).then(e=>{log.info(e),a()}).catch(e=>{log.error(`install ${e.message}`),a(e)})}function extract(e,t){return tar.extract({cwd:e,strip:1,onentry:t})}function extract_from_local(t,r,i){if(!fs.existsSync(t))return i(Error(`Cannot find file `+t));log.info(`Found local file to extract from `+t);let a=0;function o(e){a+=1,log.info(`install`,`unpacking `+e.path)}function s(e){if(e)return i(e);if(a===0)return i(Error(`There was a fatal problem while extracting the tarball`));log.info(`tarball`,`done parsing tarball`),i()}fs.createReadStream(t).pipe(extract(r,o)).on(`close`,s).on(`error`,s)}function do_build(e,t,n){let r=[`rebuild`].concat(t);e.todo.push({name:`build`,args:r}),process.nextTick(n)}function print_fallback_error(e,t,r){let i=` (falling back to source compile with node-gyp)`,a=``;e.statusCode===void 0?(a=`Pre-built binaries not installable for `+r.name+`@`+r.version,a+=` and `+t.runtime+`@`+(t.target||process.versions.node)+` (`+t.node_abi+` ABI, `+t.libc+`)`,a+=i,log.warn(a),log.warn(`Hit error `+e.message)):(a=`Pre-built binaries not found for `+r.name+`@`+r.version,a+=` and `+t.runtime+`@`+(t.target||process.versions.node)+` (`+t.node_abi+` ABI, `+t.libc+`)`,a+=i,log.warn(`Tried to download(`+e.statusCode+`): `+t.hosted_tarball),log.warn(a),log.error(e.message))}function install(o,s,c){let u=o.package_json,m=napi.get_napi_build_version_from_command_args(s),h=o.opts[`build-from-source`]||o.opts.build_from_source,g=o.opts[`update-binary`]||o.opts.update_binary;if(h===u.name||h===!0||h===`true`)return log.info(`build`,`requesting source compile`),do_build(o,s,c);{let a=o.opts[`fallback-to-build`]||o.opts.fallback_to_build,h=a===u.name||a===!0||a===`true`;if(process.env.npm_config_argv){let e=JSON.parse(process.env.npm_config_argv).cooked,t=e.indexOf(`--fallback-to-build`);t>-1&&e.length>t&&e[t+1]===`false`&&(h=!1,log.info(`install`,`Build fallback disabled via npm flag: --fallback-to-build=false`))}let _;try{_=versioning.evaluate(u,o.opts,m)}catch(e){return c(e)}_.ca=o.opts.ca,_.cafile=o.opts.cafile;let v=_.hosted_tarball,y=_.module_path,b=path.join(y,_.module_name+`.node`);existsAsync(b,t=>{if(!g){if(t)return console.log(`[`+u.name+`] Success: "`+b+`" already installed`),console.log(`Pass --update-binary to reinstall or --build-from-source to recompile`),c();log.info(`check`,`checked for "`+b+`" (not found)`)}fs.promises.mkdir(y,{recursive:!0}).then(()=>{let e=v.startsWith(`file://`)&&v.slice(7);e?extract_from_local(e,y,r):place_binary(v,y,_,r)}).catch(e=>{r(e)});function r(e){return e&&h?(print_fallback_error(e,_,u),do_build(o,s,c)):e?c(e):(console.log(`[`+u.name+`] Success: "`+b+`" is installed via remote`),c())}})}}
1
+ "use strict";module.exports=exports=install,exports.usage=`Attempts to install pre-built binary for module`;const fs=require(`fs`),path=require(`path`),log=require(`./util/log.js`),existsAsync=fs.exists||path.exists,versioning=require(`./util/versioning.js`),napi=require(`./util/napi.js`),s3_setup=require(`./util/s3_setup.js`),url=require(`url`),fetch=require(`node-fetch`),tar=require(`tar`);let npgVersion=`unknown`;try{let i=fs.readFileSync(path.join(__dirname,`..`,`package.json`),`utf8`);npgVersion=JSON.parse(i).version}catch{}function place_binary_authenticated(e,r,a){if(log.info(`install`,`Attempting authenticated S3 download`),!process.env.AWS_ACCESS_KEY_ID||!process.env.AWS_SECRET_ACCESS_KEY){let e=Error(`Binary is private but AWS credentials not found. Please configure AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables, or use --fallback-to-build to compile from source.`);return e.statusCode=403,a(e)}try{let o=s3_setup.detect(e),s=s3_setup.get_s3(o),u=url.resolve(o.prefix,e.package_name);log.info(`install`,`Downloading from S3:`,o.bucket,u);let d={Bucket:o.bucket,Key:u};s.getObject(d,(e,o)=>{if(e)return log.error(`install`,`Authenticated S3 download failed:`,e.message),a(e);log.info(`install`,`Authenticated download successful, extracting...`);let{Readable:s}=require(`stream`),c=s.from(o.Body),l=0;c.pipe(extract(r,e=>{l+=1,log.info(`install`,`unpacking ${e.path}`)})).on(`error`,e=>{a(e)}).on(`close`,()=>{log.info(`install`,`extracted file count: ${l}`),a()})})}catch(e){if(e.code===`MODULE_NOT_FOUND`&&e.message.includes(`aws-sdk`)){let e=Error(`Binary is private and requires aws-sdk for authenticated download. Please run: npm install aws-sdk`);return e.statusCode=403,a(e)}log.error(`install`,`Error setting up authenticated download:`,e.message),a(e)}}function place_binary(r,a,o,s){log.log(`GET`,r);let c=process.env.npm_config_user_agent||`node `+process.version,l=r.replace(`+`,`%2B`),d={uri:l,headers:{"User-Agent":`node-pre-gyp (v`+npgVersion+`, `+c+`)`},follow_max:10};if(o.cafile)try{d.ca=fs.readFileSync(o.cafile)}catch(e){return s(e)}else o.ca&&(d.ca=o.ca);let m=o.proxy||process.env.http_proxy||process.env.HTTP_PROXY||process.env.npm_config_proxy,g;if(m){let{HttpsProxyAgent:e}=require(`https-proxy-agent`);g=new e(m),log.log(`download`,`proxy agent configured using: "${m}"`)}fetch(l,{agent:g}).then(e=>{if(!e.ok){if(e.status===403)return log.info(`install`,`Received 403 Forbidden - attempting authenticated download`),place_binary_authenticated(o,a,s),{authenticated:!0};throw Error(`response status ${e.status} ${e.statusText} on ${l}`)}let r=e.body;return new Promise((e,o)=>{let s=0;r.pipe(extract(a,e=>{s+=1,log.info(`install`,`unpacking ${e.path}`)})).on(`error`,e=>{o(e)}),r.on(`end`,()=>{e(`extracted file count: ${s}`)}),r.on(`error`,e=>{o(e)})})}).then(e=>{e&&e.authenticated||(log.info(e),s())}).catch(e=>{log.error(`install ${e.message}`),s(e)})}function extract(e,r){return tar.extract({cwd:e,strip:1,onentry:r})}function extract_from_local(r,a,o){if(!fs.existsSync(r))return o(Error(`Cannot find file `+r));log.info(`Found local file to extract from `+r);let s=0;function c(e){s+=1,log.info(`install`,`unpacking `+e.path)}function l(e){if(e)return o(e);if(s===0)return o(Error(`There was a fatal problem while extracting the tarball`));log.info(`tarball`,`done parsing tarball`),o()}fs.createReadStream(r).pipe(extract(a,c)).on(`close`,l).on(`error`,l)}function do_build(e,r,i){let a=[`rebuild`].concat(r);e.todo.push({name:`build`,args:a}),process.nextTick(i)}function print_fallback_error(e,r,a){let o=` (falling back to source compile with node-gyp)`,s=``;e.statusCode===void 0?(s=`Pre-built binaries not installable for `+a.name+`@`+a.version,s+=` and `+r.runtime+`@`+(r.target||process.versions.node)+` (`+r.node_abi+` ABI, `+r.libc+`)`,s+=o,log.warn(s),log.warn(`Hit error `+e.message)):(s=`Pre-built binaries not found for `+a.name+`@`+a.version,s+=` and `+r.runtime+`@`+(r.target||process.versions.node)+` (`+r.node_abi+` ABI, `+r.libc+`)`,s+=o,log.warn(`Tried to download(`+e.statusCode+`): `+r.hosted_tarball),log.warn(s),log.error(e.message))}function install(c,l,u){let d=c.package_json,f=napi.get_napi_build_version_from_command_args(l),p=c.opts[`build-from-source`]||c.opts.build_from_source,h=c.opts[`update-binary`]||c.opts.update_binary;if(p===d.name||p===!0||p===`true`)return log.info(`build`,`requesting source compile`),do_build(c,l,u);{let s=c.opts[`fallback-to-build`]||c.opts.fallback_to_build,p=s===d.name||s===!0||s===`true`;if(process.env.npm_config_argv){let e=JSON.parse(process.env.npm_config_argv).cooked,r=e.indexOf(`--fallback-to-build`);r>-1&&e.length>r&&e[r+1]===`false`&&(p=!1,log.info(`install`,`Build fallback disabled via npm flag: --fallback-to-build=false`))}let _;try{_=versioning.evaluate(d,c.opts,f)}catch(e){return u(e)}_.ca=c.opts.ca,_.cafile=c.opts.cafile;let v=_.hosted_tarball,y=_.module_path,b=path.join(y,_.module_name+`.node`);existsAsync(b,r=>{if(!h){if(r)return console.log(`[`+d.name+`] Success: "`+b+`" already installed`),console.log(`Pass --update-binary to reinstall or --build-from-source to recompile`),u();log.info(`check`,`checked for "`+b+`" (not found)`)}fs.promises.mkdir(y,{recursive:!0}).then(()=>{let e=v.startsWith(`file://`)&&v.slice(7);e?extract_from_local(e,y,a):place_binary(v,y,_,a)}).catch(e=>{a(e)});function a(e){return e&&p?(print_fallback_error(e,_,d),do_build(c,l,u)):e?u(e):(console.log(`[`+d.name+`] Success: "`+b+`" is installed via remote`),u())}})}}process.env.node_pre_gyp_mock_s3&&require(`./mock/http`)();
@@ -0,0 +1,2 @@
1
+ "use strict";module.exports=exports=http_mock;const fs=require(`fs`),path=require(`path`),nock=require(`nock`),os=require(`os`),log=require(`../util/log.js`);log.heading=`node-pre-gyp`;function http_mock(){log.warn(`mocking http requests to s3`);let a=`${os.tmpdir()}/mock`;nock(RegExp(`([a-z0-9]+[.])*s3[.]us-east-1[.]amazonaws[.]com`)).persist().get(()=>!0).reply(n=>{let r=`npg-mock-bucket`,i=n.indexOf(r)===-1?`${a}/${r}`:a,o=path.join(i,n.replace(RegExp(`%2B`,`g`),`+`));try{fs.accessSync(o,fs.constants.R_OK)}catch{return[404,`not found
2
+ `]}return[200,fs.createReadStream(o)]})}
@@ -0,0 +1 @@
1
+ "use strict";module.exports=exports=s3_mock;const AWSMock=require(`mock-aws-s3`),os=require(`os`),log=require(`../util/log.js`);log.heading=`node-pre-gyp`;function s3_mock(){log.warn(`mocking s3 operations`),AWSMock.config.basePath=`${os.tmpdir()}/mock`;let r=AWSMock.S3(),i=e=>(t,...n)=>(t&&t.code===`ENOENT`&&(t.code=`NotFound`),e(t,...n));return{listObjects(e,t){return r.listObjects(e,i(t))},headObject(e,t){return r.headObject(e,i(t))},deleteObject(e,t){return r.deleteObject(e,i(t))},putObject(e,t){return r.putObject(e,i(t))},getObject(e,t){return r.getObject(e,i(t))}}}
@@ -1,3 +1,3 @@
1
- "use strict";module.exports=exports,exports.mockS3Http=require(`./util/s3_setup`).get_mockS3Http(),exports.mockS3Http(`on`);const mocking=exports.mockS3Http(`get`),fs=require(`fs`),path=require(`path`),nopt=require(`nopt`),log=require(`./util/log.js`),napi=require(`./util/napi.js`),EE=require(`events`).EventEmitter,inherits=require(`util`).inherits,cli_commands=[`clean`,`install`,`reinstall`,`build`,`rebuild`,`package`,`testpackage`,`publish`,`unpublish`,`info`,`testbinary`,`reveal`,`configure`],aliases={};mocking&&log.warn(`mocking s3 to ${process.env.node_pre_gyp_mock_s3}`),Object.defineProperty(exports,`find`,{get:function(){return require(`./pre-binding`).find},enumerable:!0});function Run({package_json_path:e=`./package.json`,argv:o}){this.package_json_path=e,this.commands={};let s=this;cli_commands.forEach(e=>{s.commands[e]=function(o,c){return log.verbose(`command`,e,o),require(`./`+e)(s,o,c)}}),this.parseArgv(o),this.binaryHostSet=!1}inherits(Run,EE),exports.Run=Run;const proto=Run.prototype;proto.package=require(`../package.json`),proto.configDefs={help:Boolean,arch:String,debug:Boolean,directory:String,proxy:String,loglevel:String},proto.shorthands={release:`--no-debug`,C:`--directory`,debug:`--debug`,j:`--jobs`,silent:`--loglevel=silent`,silly:`--loglevel=silly`,verbose:`--loglevel=verbose`},proto.aliases=aliases,proto.parseArgv=function(e){this.opts=nopt(this.configDefs,this.shorthands,e),this.argv=this.opts.argv.remain.slice();let l=this.todo=[];e=this.argv.map(e=>(e in this.aliases&&(e=this.aliases[e]),e)),e.slice().forEach(o=>{if(o in this.commands){let s=e.splice(0,e.indexOf(o));e.shift(),l.length>0&&(l[l.length-1].args=s),l.push({name:o,args:[]})}}),l.length>0&&(l[l.length-1].args=e.splice(0));let u=this.package_json_path;this.opts.directory&&(u=path.join(this.opts.directory,u)),this.package_json=JSON.parse(fs.readFileSync(u)),this.todo=napi.expand_commands(this.package_json,this.opts,l);let d=`npm_config_`;Object.keys(process.env).forEach(e=>{if(e.indexOf(d)!==0)return;let o=process.env[e];e===d+`loglevel`?log.level=o:(e=e.substring(11),e===`argv`&&this.opts.argv&&this.opts.argv.remain&&this.opts.argv.remain.length||(this.opts[e]=o))}),this.opts.loglevel&&(log.level=this.opts.loglevel),log.resume()},proto.setBinaryHostProperty=function(e){if(this.binaryHostSet)return this.package_json.binary.host;let o=this.package_json;if(!o||!o.binary||o.binary.host||!o.binary.staging_host||!o.binary.production_host)return``;let s=`production_host`;(e===`publish`||e===`unpublish`)&&(s=`staging_host`);let c=process.env.node_pre_gyp_s3_host;if(c===`staging`||c===`production`)s=`${c}_host`;else if(this.opts.s3_host===`staging`||this.opts.s3_host===`production`)s=`${this.opts.s3_host}_host`;else if(this.opts.s3_host||c)throw Error(`invalid s3_host ${this.opts.s3_host||c}`);return o.binary.host=o.binary[s],this.binaryHostSet=!0,o.binary.host},proto.usage=function(){return[``,` Usage: node-pre-gyp <command> [options]`,``,` where <command> is one of:`,cli_commands.map(e=>` - `+e+` - `+require(`./`+e).usage).join(`
1
+ "use strict";module.exports=exports;const fs=require(`fs`),path=require(`path`),nopt=require(`nopt`),log=require(`./util/log.js`),napi=require(`./util/napi.js`),EE=require(`events`).EventEmitter,inherits=require(`util`).inherits,cli_commands=[`clean`,`install`,`reinstall`,`build`,`rebuild`,`package`,`testpackage`,`publish`,`unpublish`,`info`,`testbinary`,`reveal`,`configure`],aliases={};Object.defineProperty(exports,`find`,{get:function(){return require(`./pre-binding`).find},enumerable:!0});function Run({package_json_path:e=`./package.json`,argv:r}){this.package_json_path=e,this.commands={};let i=this;cli_commands.forEach(e=>{i.commands[e]=function(r,o){return log.verbose(`command`,e,r),require(`./`+e)(i,r,o)}}),this.parseArgv(r),this.binaryHostSet=!1}inherits(Run,EE),exports.Run=Run;const proto=Run.prototype;proto.package=require(`../package.json`),proto.configDefs={help:Boolean,arch:String,debug:Boolean,directory:String,proxy:String,loglevel:String,acl:String},proto.shorthands={release:`--no-debug`,C:`--directory`,debug:`--debug`,j:`--jobs`,silent:`--loglevel=silent`,silly:`--loglevel=silly`,verbose:`--loglevel=verbose`},proto.aliases=aliases,proto.parseArgv=function(s){this.opts=nopt(this.configDefs,this.shorthands,s),this.argv=this.opts.argv.remain.slice();let c=this.todo=[];s=this.argv.map(e=>(e in this.aliases&&(e=this.aliases[e]),e)),s.slice().forEach(e=>{if(e in this.commands){let r=s.splice(0,s.indexOf(e));s.shift(),c.length>0&&(c[c.length-1].args=r),c.push({name:e,args:[]})}}),c.length>0&&(c[c.length-1].args=s.splice(0));let l=this.package_json_path;this.opts.directory&&(l=path.join(this.opts.directory,l)),this.package_json=JSON.parse(fs.readFileSync(l)),this.todo=napi.expand_commands(this.package_json,this.opts,c);let u=`npm_config_`;Object.keys(process.env).forEach(e=>{if(e.indexOf(u)!==0)return;let r=process.env[e];e===u+`loglevel`?log.level=r:(e=e.substring(11),e===`argv`&&this.opts.argv&&this.opts.argv.remain&&this.opts.argv.remain.length||(this.opts[e]=r))}),this.opts.loglevel&&(log.level=this.opts.loglevel),log.resume()},proto.setBinaryHostProperty=function(e){if(this.binaryHostSet)return this.package_json.binary.host;let r=this.package_json;if(!r||!r.binary||r.binary.host||!r.binary.staging_host||!r.binary.production_host)return``;let i=`production_host`;(e===`publish`||e===`unpublish`)&&(i=`staging_host`);let a=process.env.node_pre_gyp_s3_host;if(a===`staging`||a===`production`)i=`${a}_host`;else if(this.opts.s3_host===`staging`||this.opts.s3_host===`production`)i=`${this.opts.s3_host}_host`;else if(this.opts.s3_host||a)throw Error(`invalid s3_host ${this.opts.s3_host||a}`);return r.binary.host=r.binary[i],this.binaryHostSet=!0,r.binary.host},proto.usage=function(){return[``,` Usage: node-pre-gyp <command> [options]`,``,` where <command> is one of:`,cli_commands.map(e=>` - `+e+` - `+require(`./`+e).usage).join(`
2
2
  `),``,`node-pre-gyp@`+this.version+` `+path.resolve(__dirname,`..`),`node@`+process.versions.node].join(`
3
3
  `)},Object.defineProperty(proto,`version`,{get:function(){return this.package.version},enumerable:!0});
@@ -1 +1 @@
1
- "use strict";module.exports=exports=publish,exports.usage=`Publishes pre-built binary (requires aws-sdk)`;const fs=require(`fs`),path=require(`path`),log=require(`./util/log.js`),versioning=require(`./util/versioning.js`),napi=require(`./util/napi.js`),s3_setup=require(`./util/s3_setup.js`),existsAsync=fs.exists||path.exists,url=require(`url`);function publish(r,c,l){let u=r.package_json,d=napi.get_napi_build_version_from_command_args(c),f=versioning.evaluate(u,r.opts,d),p=f.staged_tarball;existsAsync(p,r=>{if(!r)return l(Error(`Cannot publish because `+p+" missing: run `node-pre-gyp package` first"));log.info(`publish`,`Detecting s3 credentials`);let i=s3_setup.detect(f),a=s3_setup.get_s3(i),s=url.resolve(i.prefix,f.package_name),c={Bucket:i.bucket,Key:s};log.info(`publish`,`Authenticating with s3`),log.info(`publish`,i),log.info(`publish`,`Checking for existing binary at `+f.hosted_path),a.headObject(c,(r,o)=>{if(o&&log.info(`publish`,JSON.stringify(o)),r&&r.code===`NotFound`){log.info(`publish`,`Preparing to put object`);let r={ACL:`public-read`,Body:fs.createReadStream(p),Key:s,Bucket:i.bucket};log.info(`publish`,`Putting object`,r.ACL,r.Bucket,r.Key);try{a.putObject(r,(e,r)=>(log.info(`publish`,`returned from putting object`),e?(log.info(`publish`,`s3 putObject error: "`+e+`"`),l(e)):(r&&log.info(`publish`,`s3 putObject response: "`+JSON.stringify(r)+`"`),log.info(`publish`,`successfully put object`),console.log(`[`+u.name+`] Success: published to `+f.hosted_path),l())))}catch(e){return log.info(`publish`,`s3 putObject error: "`+e+`"`),l(e)}}else if(r)return log.info(`publish`,`s3 headObject error: "`+r+`"`),l(r);else return log.error(`publish`,`Cannot publish over existing version`),log.error(`publish`,`Update the 'version' field in package.json and try again`),log.error(`publish`,`If the previous version was published in error see:`),log.error(`publish`,` node-pre-gyp unpublish`),l(Error(`Failed publishing to `+f.hosted_path))})})}
1
+ "use strict";module.exports=exports=publish,exports.usage=`Publishes pre-built binary (requires aws-sdk)`;const fs=require(`fs`),path=require(`path`),log=require(`./util/log.js`),versioning=require(`./util/versioning.js`),napi=require(`./util/napi.js`),s3_setup=require(`./util/s3_setup.js`),existsAsync=fs.exists||path.exists,url=require(`url`);function publish(r,c,l){let u=r.package_json,d=napi.get_napi_build_version_from_command_args(c),f=versioning.evaluate(u,r.opts,d),p=f.staged_tarball;existsAsync(p,r=>{if(!r)return l(Error(`Cannot publish because `+p+" missing: run `node-pre-gyp package` first"));log.info(`publish`,`Detecting s3 credentials`);let i=s3_setup.detect(f),a=s3_setup.get_s3(i),s=url.resolve(i.prefix,f.package_name),c={Bucket:i.bucket,Key:s};log.info(`publish`,`Authenticating with s3`),log.info(`publish`,i),log.info(`publish`,`Checking for existing binary at `+f.hosted_path),a.headObject(c,(r,o)=>{if(o&&log.info(`publish`,JSON.stringify(o)),r&&r.code===`NotFound`){log.info(`publish`,`Preparing to put object`);let r={ACL:f.acl,Body:fs.createReadStream(p),Key:s,Bucket:i.bucket};log.info(`publish`,`Putting object with ACL:`,r.ACL),log.info(`publish`,`Bucket:`,r.Bucket,`Key:`,r.Key);try{a.putObject(r,(e,r)=>(log.info(`publish`,`returned from putting object`),e?(log.info(`publish`,`s3 putObject error: "`+e+`"`),l(e)):(r&&log.info(`publish`,`s3 putObject response: "`+JSON.stringify(r)+`"`),log.info(`publish`,`successfully put object`),console.log(`[`+u.name+`] Success: published to `+f.hosted_path),l())))}catch(e){return log.info(`publish`,`s3 putObject error: "`+e+`"`),l(e)}}else if(r)return log.info(`publish`,`s3 headObject error: "`+r+`"`),l(r);else return log.error(`publish`,`Cannot publish over existing version`),log.error(`publish`,`Update the 'version' field in package.json and try again`),log.error(`publish`,`If the previous version was published in error see:`),log.error(`publish`,` node-pre-gyp unpublish`),l(Error(`Failed publishing to `+f.hosted_path))})})}
@@ -2927,6 +2927,14 @@
2927
2927
  "node_abi": 108,
2928
2928
  "v8": "10.2"
2929
2929
  },
2930
+ "18.20.7": {
2931
+ "node_abi": 108,
2932
+ "v8": "10.2"
2933
+ },
2934
+ "18.20.8": {
2935
+ "node_abi": 108,
2936
+ "v8": "10.2"
2937
+ },
2930
2938
  "19.0.0": {
2931
2939
  "node_abi": 111,
2932
2940
  "v8": "10.7"
@@ -3099,6 +3107,18 @@
3099
3107
  "node_abi": 115,
3100
3108
  "v8": "11.3"
3101
3109
  },
3110
+ "20.18.3": {
3111
+ "node_abi": 115,
3112
+ "v8": "11.3"
3113
+ },
3114
+ "20.19.0": {
3115
+ "node_abi": 115,
3116
+ "v8": "11.3"
3117
+ },
3118
+ "20.19.1": {
3119
+ "node_abi": 115,
3120
+ "v8": "11.3"
3121
+ },
3102
3122
  "21.0.0": {
3103
3123
  "node_abi": 120,
3104
3124
  "v8": "11.8"
@@ -3219,6 +3239,14 @@
3219
3239
  "node_abi": 127,
3220
3240
  "v8": "12.4"
3221
3241
  },
3242
+ "22.14.0": {
3243
+ "node_abi": 127,
3244
+ "v8": "12.4"
3245
+ },
3246
+ "22.15.0": {
3247
+ "node_abi": 127,
3248
+ "v8": "12.4"
3249
+ },
3222
3250
  "23.0.0": {
3223
3251
  "node_abi": 131,
3224
3252
  "v8": "12.9"
@@ -3250,5 +3278,29 @@
3250
3278
  "23.6.1": {
3251
3279
  "node_abi": 131,
3252
3280
  "v8": "12.9"
3281
+ },
3282
+ "23.7.0": {
3283
+ "node_abi": 131,
3284
+ "v8": "12.9"
3285
+ },
3286
+ "23.8.0": {
3287
+ "node_abi": 131,
3288
+ "v8": "12.9"
3289
+ },
3290
+ "23.9.0": {
3291
+ "node_abi": 131,
3292
+ "v8": "12.9"
3293
+ },
3294
+ "23.10.0": {
3295
+ "node_abi": 131,
3296
+ "v8": "12.9"
3297
+ },
3298
+ "23.11.0": {
3299
+ "node_abi": 131,
3300
+ "v8": "12.9"
3301
+ },
3302
+ "24.0.0": {
3303
+ "node_abi": 137,
3304
+ "v8": "13.6"
3253
3305
  }
3254
- }
3306
+ }
@@ -1,2 +1 @@
1
- "use strict";module.exports=exports;const url=require(`url`),fs=require(`fs`),path=require(`path`);module.exports.detect=function(t){let n={},r=t.hosted_path,i=url.parse(r);if(t.bucket&&t.region){n.endpoint=t.host,n.bucket=t.bucket,n.region=t.region,n.s3ForcePathStyle=t.s3ForcePathStyle;let e=n.s3ForcePathStyle?`/${n.bucket}/`:`/`;n.prefix=!i.pathname||i.pathname===e?``:i.pathname.replace(e,``)}else{let e=i.hostname.split(`.s3`);if(e.length===1)throw Error(`Could not parse s3 bucket name from virtual host url.`);n.bucket=e[0];let t=e[1].slice(1).split(`.`)[0];t===`amazonaws`?n.region=`us-east-1`:n.region=t,n.prefix=!i.pathname||i.pathname===`/`?``:i.pathname.replace(`/`,``)}return n},module.exports.get_s3=function(e){if(process.env.node_pre_gyp_mock_s3){let e=require(`mock-aws-s3`),t=require(`os`);e.config.basePath=`${t.tmpdir()}/mock`;let n=e.S3(),r=e=>(t,...n)=>(t&&t.code===`ENOENT`&&(t.code=`NotFound`),e(t,...n));return{listObjects(e,t){return n.listObjects(e,r(t))},headObject(e,t){return n.headObject(e,r(t))},deleteObject(e,t){return n.deleteObject(e,r(t))},putObject(e,t){return n.putObject(e,r(t))}}}let t=require(`aws-sdk`);t.config.update(e);let n=new t.S3;return{listObjects(e,t){return n.listObjects(e,t)},headObject(e,t){return n.headObject(e,t)},deleteObject(e,t){return n.deleteObject(e,t)},putObject(e,t){return n.putObject(e,t)}}},module.exports.get_mockS3Http=function(){let e=!1;if(!process.env.node_pre_gyp_mock_s3)return()=>e;let r=require(`nock`),i=`https://mapbox-node-pre-gyp-public-testing-bucket.s3.us-east-1.amazonaws.com`,a=process.env.node_pre_gyp_mock_s3+`/mapbox-node-pre-gyp-public-testing-bucket`;return(()=>{function o(e,r){let i=path.join(a,e.replace(`%2B`,`+`));try{fs.accessSync(i,fs.constants.R_OK)}catch{return[404,`not found
2
- `]}return[200,fs.createReadStream(i)]}return r(i).persist().get(()=>e).reply(o)})(r,i,a),t=>{let n=e;if(t===`off`)e=!1;else if(t===`on`)e=!0;else if(t!==`get`)throw Error(`illegal action for setMockHttp ${t}`);return n}};
1
+ "use strict";module.exports=exports;const url=require(`url`);module.exports.detect=function(t){let n={},r=t.hosted_path,i=url.parse(r);if(t.bucket&&t.region){n.endpoint=t.host,n.bucket=t.bucket,n.region=t.region,n.s3ForcePathStyle=t.s3ForcePathStyle;let e=n.s3ForcePathStyle?`/${n.bucket}/`:`/`;n.prefix=!i.pathname||i.pathname===e?``:i.pathname.replace(e,``)}else{let e=i.hostname.split(`.s3`);if(e.length===1)throw Error(`Could not parse s3 bucket name from virtual host url.`);n.bucket=e[0];let t=e[1].slice(1).split(`.`)[0];t===`amazonaws`?n.region=`us-east-1`:n.region=t,n.prefix=!i.pathname||i.pathname===`/`?``:i.pathname.replace(`/`,``)}return n},module.exports.get_s3=function(e){if(process.env.node_pre_gyp_mock_s3)return require(`../mock/s3`)();let t=require(`aws-sdk`);t.config.update(e);let n=new t.S3;return{listObjects(e,t){return n.listObjects(e,t)},headObject(e,t){return n.headObject(e,t)},deleteObject(e,t){return n.deleteObject(e,t)},putObject(e,t){return n.putObject(e,t)},getObject(e,t){return n.getObject(e,t)}}};
@@ -1,4 +1,4 @@
1
1
  "use strict";module.exports=exports;const path=require(`path`),semver=require(`semver`),url=require(`url`),detect_libc=require(`detect-libc`),napi=require(`./napi.js`);let abi_crosswalk;abi_crosswalk=process.env.NODE_PRE_GYP_ABI_CROSSWALK?require(process.env.NODE_PRE_GYP_ABI_CROSSWALK):require(`./abi_crosswalk.json`);const major_versions={};Object.keys(abi_crosswalk).forEach(e=>{let s=e.split(`.`)[0];major_versions[s]||(major_versions[s]=e)});function get_electron_abi(e,c){if(!e)throw Error(`get_electron_abi requires valid runtime arg`);if(c===void 0)throw Error(`Empty target version is not supported if electron is the target.`);let l=semver.parse(c);return e+`-v`+l.major+`.`+l.minor}module.exports.get_electron_abi=get_electron_abi;function get_node_webkit_abi(e,s){if(!e)throw Error(`get_node_webkit_abi requires valid runtime arg`);if(s===void 0)throw Error(`Empty target version is not supported if node-webkit is the target.`);return e+`-v`+s}module.exports.get_node_webkit_abi=get_node_webkit_abi;function get_node_abi(e,c){if(!e)throw Error(`get_node_abi requires valid runtime arg`);if(!c)throw Error(`get_node_abi requires valid process.versions object`);let l=semver.parse(c.node);return l.major===0&&l.minor%2?e+`-v`+c.node:c.modules?e+`-v`+ +c.modules:`v8-`+c.v8.split(`.`).slice(0,2).join(`.`)}module.exports.get_node_abi=get_node_abi;function get_runtime_abi(e,s){if(!e)throw Error(`get_runtime_abi requires valid runtime arg`);if(e===`node-webkit`)return get_node_webkit_abi(e,s||process.versions[`node-webkit`]);if(e===`electron`)return get_electron_abi(e,s||process.versions.electron);if(e!==`node`)throw Error(`Unknown Runtime: '`+e+`'`);if(s){let c;if(abi_crosswalk[s])c=abi_crosswalk[s];else{let e=s.split(`.`).map(e=>+e);if(e.length!==3)throw Error(`Unknown target version: `+s);let l=e[0],u=e[1],p=e[2];if(l===1)for(;;){u>0&&--u,p>0&&--p;let e=``+l+`.`+u+`.`+p;if(abi_crosswalk[e]){c=abi_crosswalk[e],console.log(`Warning: node-pre-gyp could not find exact match for `+s),console.log(`Warning: but node-pre-gyp successfully choose `+e+` as ABI compatible target`);break}if(u===0&&p===0)break}else if(l>=2)major_versions[l]&&(c=abi_crosswalk[major_versions[l]],console.log(`Warning: node-pre-gyp could not find exact match for `+s),console.log(`Warning: but node-pre-gyp successfully choose `+major_versions[l]+` as ABI compatible target`));else if(l===0&&e[1]%2==0)for(;--p>0;){let e=``+l+`.`+u+`.`+p;if(abi_crosswalk[e]){c=abi_crosswalk[e],console.log(`Warning: node-pre-gyp could not find exact match for `+s),console.log(`Warning: but node-pre-gyp successfully choose `+e+` as ABI compatible target`);break}}}if(!c)throw Error(`Unsupported target version: `+s);return get_node_abi(e,{node:s,v8:c.v8+`.0`,modules:c.node_abi>1?c.node_abi:void 0})}else return get_node_abi(e,process.versions)}module.exports.get_runtime_abi=get_runtime_abi;const required_parameters=[`module_name`,`module_path`,`host`];function validate_config(e,s){let l=e.name+` package.json is not node-pre-gyp ready:
2
2
  `,d=[];e.main||d.push(`main`),e.version||d.push(`version`),e.name||d.push(`name`),e.binary||d.push(`binary`);let f=e.binary;if(f&&required_parameters.forEach(e=>{(!f[e]||typeof f[e]!=`string`)&&d.push(`binary.`+e)}),d.length>=1)throw Error(l+`package.json must declare these properties:
3
3
  `+d.join(`
4
- `));if(f){let e=url.parse(f.host).protocol;if(e===`http:`)throw Error(`'host' protocol (`+e+`) is invalid - only 'https:' is accepted`)}napi.validate_package_json(e,s)}module.exports.validate_config=validate_config;function eval_template(e,s){return Object.keys(s).forEach(c=>{let l=`{`+c+`}`;for(;e.indexOf(l)>-1;)e=e.replace(l,s[c])}),e}function fix_slashes(e){return e.slice(-1)===`/`?e:e+`/`}function drop_double_slashes(e){return e.replace(/\/\//g,`/`)}function get_process_runtime(e){let s=`node`;return e[`node-webkit`]?s=`node-webkit`:e.electron&&(s=`electron`),s}module.exports.get_process_runtime=get_process_runtime;const default_package_name=`{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz`,default_remote_path=``;module.exports.evaluate=function(d,f,p){f||={},validate_config(d,f);let m=d.version,h=semver.parse(m),g=f.runtime||get_process_runtime(process.versions),_={name:d.name,configuration:f.debug?`Debug`:`Release`,debug:f.debug,module_name:d.binary.module_name,version:h.version,prerelease:h.prerelease.length?h.prerelease.join(`.`):``,build:h.build.length?h.build.join(`.`):``,major:h.major,minor:h.minor,patch:h.patch,runtime:g,node_abi:get_runtime_abi(g,f.target),node_abi_napi:napi.get_napi_version(f.target)?`napi`:get_runtime_abi(g,f.target),napi_version:napi.get_napi_version(f.target),napi_build_version:p||``,node_napi_label:p?`napi-v`+p:get_runtime_abi(g,f.target),target:f.target||``,platform:f.target_platform||process.platform,target_platform:f.target_platform||process.platform,arch:f.target_arch||process.arch,target_arch:f.target_arch||process.arch,libc:f.target_libc||detect_libc.familySync()||`unknown`,module_main:d.main,toolset:f.toolset||``,bucket:d.binary.bucket,region:d.binary.region,s3ForcePathStyle:d.binary.s3ForcePathStyle||!1},v=_.module_name.replace(`-`,`_`);return _.host=fix_slashes(eval_template(process.env[`npm_config_`+v+`_binary_host_mirror`]||d.binary.host,_)),_.module_path=eval_template(d.binary.module_path,_),f.module_root?_.module_path=path.join(f.module_root,_.module_path):_.module_path=path.resolve(_.module_path),_.module=path.join(_.module_path,_.module_name+`.node`),_.remote_path=d.binary.remote_path?drop_double_slashes(fix_slashes(eval_template(d.binary.remote_path,_))):``,_.package_name=eval_template(d.binary.package_name?d.binary.package_name:`{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz`,_),_.staged_tarball=path.join(`build/stage`,_.remote_path,_.package_name),_.s3ForcePathStyle?_.hosted_path=url.resolve(_.host,drop_double_slashes(`${_.bucket}/${_.remote_path}`)):_.hosted_path=url.resolve(_.host,_.remote_path),_.hosted_tarball=url.resolve(_.hosted_path,_.package_name),_};
4
+ `));if(f){let e=url.parse(f.host).protocol;if(e===`http:`)throw Error(`'host' protocol (`+e+`) is invalid - only 'https:' is accepted`)}napi.validate_package_json(e,s)}module.exports.validate_config=validate_config;function eval_template(e,s){return Object.keys(s).forEach(c=>{let l=`{`+c+`}`;for(;e.indexOf(l)>-1;)e=e.replace(l,s[c])}),e}function fix_slashes(e){return e.slice(-1)===`/`?e:e+`/`}function drop_double_slashes(e){return e.replace(/\/\//g,`/`)}function get_process_runtime(e){let s=`node`;return e[`node-webkit`]?s=`node-webkit`:e.electron&&(s=`electron`),s}module.exports.get_process_runtime=get_process_runtime;const default_package_name=`{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz`,default_remote_path=``;module.exports.evaluate=function(d,f,p){f||={},validate_config(d,f);let m=d.version,h=semver.parse(m),g=f.runtime||get_process_runtime(process.versions),_={name:d.name,configuration:f.debug?`Debug`:`Release`,debug:f.debug,module_name:d.binary.module_name,version:h.version,prerelease:h.prerelease.length?h.prerelease.join(`.`):``,build:h.build.length?h.build.join(`.`):``,major:h.major,minor:h.minor,patch:h.patch,runtime:g,node_abi:get_runtime_abi(g,f.target),node_abi_napi:napi.get_napi_version(f.target)?`napi`:get_runtime_abi(g,f.target),napi_version:napi.get_napi_version(f.target),napi_build_version:p||``,node_napi_label:p?`napi-v`+p:get_runtime_abi(g,f.target),target:f.target||``,platform:f.target_platform||process.platform,target_platform:f.target_platform||process.platform,arch:f.target_arch||process.arch,target_arch:f.target_arch||process.arch,libc:f.target_libc||detect_libc.familySync()||`unknown`,module_main:d.main,toolset:f.toolset||``,bucket:d.binary.bucket,region:d.binary.region,s3ForcePathStyle:d.binary.s3ForcePathStyle||!1,acl:f.acl||d.binary.acl||`public-read`},v=_.module_name.replace(`-`,`_`);return _.host=fix_slashes(eval_template(process.env[`npm_config_`+v+`_binary_host_mirror`]||d.binary.host,_)),_.module_path=eval_template(d.binary.module_path,_),f.module_root?_.module_path=path.join(f.module_root,_.module_path):_.module_path=path.resolve(_.module_path),_.module=path.join(_.module_path,_.module_name+`.node`),_.remote_path=d.binary.remote_path?drop_double_slashes(fix_slashes(eval_template(d.binary.remote_path,_))):``,_.package_name=eval_template(d.binary.package_name?d.binary.package_name:`{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz`,_),_.staged_tarball=path.join(`build/stage`,_.remote_path,_.package_name),_.s3ForcePathStyle?_.hosted_path=url.resolve(_.host,drop_double_slashes(`${_.bucket}/${_.remote_path}`)):_.hosted_path=url.resolve(_.host,_.remote_path),_.hosted_tarball=url.resolve(_.hosted_path,_.package_name),_};
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@mapbox/node-pre-gyp",
3
- "version": "2.0.0",
3
+ "version": "2.0.3",
4
4
  "main": "./lib/node-pre-gyp.js"
5
5
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,`__esModule`,{value:!0}),exports.NotFoundError=void 0,exports.default=resolveDependency;const path_1=require(`path`),module_1=require(`module`),node_version_1=require(`./utils/node-version`);async function resolveDependency(r,i,a,s=!0){let c;if((0,path_1.isAbsolute)(r)||r===`.`||r===`..`||r.startsWith(`./`)||r.startsWith(`../`)){let s=r.endsWith(`/`);c=await resolvePath((0,path_1.resolve)(i,`..`,r)+(s?`/`:``),i,a)}else c=r[0]===`#`?await packageImportsResolve(r,i,a,s):await resolvePackage(r,i,a,s);return Array.isArray(c)?Promise.all(c.map(e=>a.realpath(e,i))):c.startsWith(`node:`)?c:a.realpath(c,i)}async function resolvePath(e,r,i){let a=await resolveFile(e,r,i)||await resolveDir(e,r,i);if(!a)throw new NotFoundError(e,r);return a}async function resolveFile(r,i,a){if(!r.endsWith(`/`)){if(r=await a.realpath(r,i),await a.isFile(r))return r;if(a.ts&&r.startsWith(a.base)&&r.slice(a.base.length).indexOf(path_1.sep+`node_modules`+path_1.sep)===-1&&await a.isFile(r+`.ts`))return r+`.ts`;if(a.ts&&r.startsWith(a.base)&&r.slice(a.base.length).indexOf(path_1.sep+`node_modules`+path_1.sep)===-1&&await a.isFile(r+`.tsx`))return r+`.tsx`;if(await a.isFile(r+`.js`))return r+`.js`;if(await a.isFile(r+`.json`))return r+`.json`;if(await a.isFile(r+`.node`))return r+`.node`}}async function resolveDir(r,i,a){if(r.endsWith(`/`)&&(r=r.slice(0,-1)),!await a.isDir(r))return;let o=await getPkgCfg(r,a);if(o&&typeof o.main==`string`){let c=await resolveFile((0,path_1.resolve)(r,o.main),i,a)||await resolveFile((0,path_1.resolve)(r,o.main,`index`),i,a);if(c)return await a.emitFile(r+path_1.sep+`package.json`,`resolve`,i),c}return resolveFile((0,path_1.resolve)(r,`index`),i,a)}class NotFoundError extends Error{code;constructor(e,r){super(`Cannot find module '`+e+`' loaded from `+r),this.code=`MODULE_NOT_FOUND`}}exports.NotFoundError=NotFoundError;const nodeBuiltins=new Set(module_1.builtinModules);function getPkgName(e){let r=e.split(`/`);return e[0]===`@`&&r.length>1?r.length>1?r.slice(0,2).join(`/`):null:r.length?r[0]:null}async function getPkgCfg(r,i){let a=await i.readFile(r+path_1.sep+`package.json`);if(a)try{return JSON.parse(a.toString())}catch{}}function getExportsTarget(e,r,a){if(typeof e==`string`||e===null)return e;if(Array.isArray(e))for(let i of e){let e=getExportsTarget(i,r,a);if(e===null||typeof e==`string`&&e.startsWith(`./`))return e}else if(typeof e==`object`){for(let o of Object.keys(e))if(o===`default`||o===`require`&&a||o===`import`&&!a||o===`module-sync`&&(0,node_version_1.getNodeMajorVersion)()>=22||r.includes(o)){let i=getExportsTarget(e[o],r,a);if(i!==void 0)return i}}}function resolveExportsImports(e,r,i,a,o,s){let c;if(o){if(!(typeof r==`object`&&!Array.isArray(r)&&r!==null))return;c=r}else c=typeof r==`string`||Array.isArray(r)||r===null||typeof r==`object`&&Object.keys(r).length&&Object.keys(r)[0][0]!==`.`?{".":r}:r;if(i in c){let r=getExportsTarget(c[i],a.conditions,s);if(typeof r==`string`&&r.startsWith(`./`))return e+r.slice(1)}for(let r of Object.keys(c).sort((e,r)=>r.length-e.length)){if(r.endsWith(`*`)&&i.startsWith(r.slice(0,-1))){let o=getExportsTarget(c[r],a.conditions,s);if(typeof o==`string`&&o.startsWith(`./`))return e+o.slice(1).replace(/\*/g,i.slice(r.length-1))}if(r.endsWith(`/`)&&i.startsWith(r)){let o=getExportsTarget(c[r],a.conditions,s);if(typeof o==`string`&&o.endsWith(`/`)&&o.startsWith(`./`))return e+o.slice(1)+i.slice(r.length)}}}async function resolveRemappings(r,i,a,o){if(o.conditions?.includes(`browser`)){let{browser:c}=i;if(!c)return;if(typeof c==`object`)for(let[i,l]of Object.entries(c)){if(typeof l!=`string`||!i.startsWith(`./`)||!l.startsWith(`./`))continue;let c=await resolveFile(r+path_1.sep+i,a,o),u=await resolveFile(r+path_1.sep+l,a,o);c&&u&&o.addRemapping(c,u)}}}async function packageImportsResolve(r,i,a,o){if(r!==`#`&&!r.startsWith(`#/`)&&a.conditions){let u=await a.getPjsonBoundary(i);if(u){let d=await getPkgCfg(u,a),{imports:p}=d||{};if(d&&p!=null){let d=resolveExportsImports(u,p,r,a,!0,o);if(d){if(o)d=await resolveFile(d,i,a)||await resolveDir(d,i,a);else if(!await a.isFile(d))throw new NotFoundError(d,i);if(d)return await a.emitFile(u+path_1.sep+`package.json`,`resolve`,i),d}}}}throw new NotFoundError(r,i)}async function resolvePackage(r,i,a,o){let p=i;if(nodeBuiltins.has(r))return`node:`+r;if(r.startsWith(`node:`))return r;let m=getPkgName(r)||``,h;if(a.conditions){let u=await a.getPjsonBoundary(i);if(u){let d=await getPkgCfg(u,a),{exports:p}=d||{};if(d&&d.name&&d.name===m&&p!=null){if(h=resolveExportsImports(u,p,`.`+r.slice(m.length),a,!1,o),h){if(o)h=await resolveFile(h,i,a)||await resolveDir(h,i,a);else if(!await a.isFile(h))throw new NotFoundError(h,i)}h&&await a.emitFile(u+path_1.sep+`package.json`,`resolve`,i)}}}let g,_=p.indexOf(path_1.sep);for(;(g=p.lastIndexOf(path_1.sep))>_;){p=p.slice(0,g);let u=p+path_1.sep+`node_modules`,d=await a.stat(u);if(!d||!d.isDirectory())continue;let _=await getPkgCfg(u+path_1.sep+m,a),{exports:v}=_||{};if(_&&await resolveRemappings(u+path_1.sep+m,_,i,a),a.conditions&&v!=null&&!h){let d;a.exportsOnly||(d=await resolveFile(u+path_1.sep+r,i,a)||await resolveDir(u+path_1.sep+r,i,a));let f=resolveExportsImports(u+path_1.sep+m,v,`.`+r.slice(m.length),a,!1,o);if(f){if(o)f=await resolveFile(f,i,a)||await resolveDir(f,i,a);else if(!await a.isFile(f))throw new NotFoundError(f,i)}if(f)return await a.emitFile(u+path_1.sep+m+path_1.sep+`package.json`,`resolve`,i),d&&d!==f?[f,d]:f;if(d)return d}else{let o=await resolveFile(u+path_1.sep+r,i,a)||await resolveDir(u+path_1.sep+r,i,a);if(o)return h&&h!==o?[o,h]:o}}if(h)return h;if(Object.hasOwnProperty.call(a.paths,r))return a.paths[r];for(let e of Object.keys(a.paths))if(e.endsWith(`/`)&&r.startsWith(e)){let o=a.paths[e]+r.slice(e.length),u=await resolveFile(o,i,a)||await resolveDir(o,i,a);if(!u)throw new NotFoundError(r,i);return u}throw new NotFoundError(r,i)}
1
+ "use strict";Object.defineProperty(exports,`__esModule`,{value:!0}),exports.NotFoundError=void 0,exports.default=resolveDependency;const path_1=require(`path`),module_1=require(`module`),node_version_1=require(`./utils/node-version`);async function resolveDependency(r,i,a,s=!0){let c;if((0,path_1.isAbsolute)(r)||r===`.`||r===`..`||r.startsWith(`./`)||r.startsWith(`../`)){let s=r.endsWith(`/`);c=await resolvePath((0,path_1.resolve)(i,`..`,r)+(s?`/`:``),i,a)}else c=r[0]===`#`?await packageImportsResolve(r,i,a,s):await resolvePackage(r,i,a,s);return Array.isArray(c)?Promise.all(c.map(e=>a.realpath(e,i))):c.startsWith(`node:`)?c:a.realpath(c,i)}async function resolvePath(e,r,i){let a=await resolveFile(e,r,i)||await resolveDir(e,r,i);if(!a)throw new NotFoundError(e,r);return a}async function resolveFile(r,i,a){if(!r.endsWith(`/`)){if(r=await a.realpath(r,i),await a.isFile(r))return r;if(a.ts&&r.startsWith(a.base)&&r.slice(a.base.length).indexOf(path_1.sep+`node_modules`+path_1.sep)===-1&&await a.isFile(r+`.ts`))return r+`.ts`;if(a.ts&&r.startsWith(a.base)&&r.slice(a.base.length).indexOf(path_1.sep+`node_modules`+path_1.sep)===-1&&await a.isFile(r+`.tsx`))return r+`.tsx`;if(await a.isFile(r+`.js`))return r+`.js`;if(await a.isFile(r+`.json`))return r+`.json`;if(await a.isFile(r+`.node`))return r+`.node`}}async function resolveDir(r,i,a){if(r.endsWith(`/`)&&(r=r.slice(0,-1)),!await a.isDir(r))return;let o=await getPkgCfg(r,a);if(o&&typeof o.main==`string`){let c=await resolveFile((0,path_1.resolve)(r,o.main),i,a)||await resolveFile((0,path_1.resolve)(r,o.main,`index`),i,a);if(c)return await a.emitFile(r+path_1.sep+`package.json`,`resolve`,i),c}return resolveFile((0,path_1.resolve)(r,`index`),i,a)}class NotFoundError extends Error{code;constructor(e,r){super(`Cannot find module '`+e+`' loaded from `+r),this.code=`MODULE_NOT_FOUND`}}exports.NotFoundError=NotFoundError;const nodeBuiltins=new Set(module_1.builtinModules);function getPkgName(e){let r=e.split(`/`);return e[0]===`@`&&r.length>1?r.length>1?r.slice(0,2).join(`/`):null:r.length?r[0]:null}async function getPkgCfg(r,i){let a=await i.readFile(r+path_1.sep+`package.json`);if(a)try{return JSON.parse(a.toString())}catch{}}function getExportsTarget(e,r,a){if(typeof e==`string`||e===null)return e;if(Array.isArray(e))for(let i of e){let e=getExportsTarget(i,r,a);if(e===null||typeof e==`string`&&e.startsWith(`./`))return e}else if(typeof e==`object`){for(let o of Object.keys(e))if(o===`default`||o===`require`&&a||o===`import`&&!a||o===`module-sync`&&(0,node_version_1.getNodeMajorVersion)()>=22||r.includes(o)){let i=getExportsTarget(e[o],r,a);if(i!==void 0)return i}}}async function validateAndResolvePaths(e,r,i,a){let o=[];for(let u of e)if(a){let e=await resolveFile(u,r,i)||await resolveDir(u,r,i);if(!e)throw new NotFoundError(u,r);o.push(e)}else{if(!await i.isFile(u))throw new NotFoundError(u,r);o.push(u)}return o}async function resolveExportsImports(e,r,a,o,s,c,l){let u;if(s){if(!(typeof r==`object`&&!Array.isArray(r)&&r!==null))return;u=r}else u=typeof r==`string`||Array.isArray(r)||r===null||typeof r==`object`&&Object.keys(r).length&&Object.keys(r)[0][0]!==`.`?{".":r}:r;if(a in u){let r=getExportsTarget(u[a],o.conditions,c);if(typeof r==`string`&&r.startsWith(`./`)){let s=e+r.slice(1),d=[s],f=u[a];if(typeof f==`object`&&f&&!Array.isArray(f)&&`module-sync`in f&&(0,node_version_1.getNodeMajorVersion)()>=22){let r=getExportsTarget(f[`require`in f?`require`:`default`],o.conditions,c);if(typeof r==`string`&&r.startsWith(`./`)){let i=e+r.slice(1);i!==s&&d.push(i)}}return await validateAndResolvePaths(d,l,o,c)}}for(let r of Object.keys(u).sort((e,r)=>r.length-e.length)){if(r.endsWith(`*`)&&a.startsWith(r.slice(0,-1))){let i=getExportsTarget(u[r],o.conditions,c);if(typeof i==`string`&&i.startsWith(`./`))return await validateAndResolvePaths([e+i.slice(1).replace(/\*/g,a.slice(r.length-1))],l,o,c)}if(r.endsWith(`/`)&&a.startsWith(r)){let i=getExportsTarget(u[r],o.conditions,c);if(typeof i==`string`&&i.endsWith(`/`)&&i.startsWith(`./`))return await validateAndResolvePaths([e+i.slice(1)+a.slice(r.length)],l,o,c)}}}async function resolveRemappings(r,i,a,o){if(o.conditions?.includes(`browser`)){let{browser:c}=i;if(!c)return;if(typeof c==`object`)for(let[i,l]of Object.entries(c)){if(typeof l!=`string`||!i.startsWith(`./`)||!l.startsWith(`./`))continue;let c=await resolveFile(r+path_1.sep+i,a,o),u=await resolveFile(r+path_1.sep+l,a,o);c&&u&&o.addRemapping(c,u)}}}async function packageImportsResolve(r,i,a,o){if(r!==`#`&&!r.startsWith(`#/`)&&a.conditions){let s=await a.getPjsonBoundary(i);if(s){let c=await getPkgCfg(s,a),{imports:l}=c||{};if(c&&l!=null){let c=await resolveExportsImports(s,l,r,a,!0,o,i);if(c)return await a.emitFile(s+path_1.sep+`package.json`,`resolve`,i),c}}}throw new NotFoundError(r,i)}async function resolvePackage(r,i,a,o){let p=i;if(nodeBuiltins.has(r))return`node:`+r;if(r.startsWith(`node:`))return r;let m=getPkgName(r)||``,h;if(a.conditions){let s=await a.getPjsonBoundary(i);if(s){let c=await getPkgCfg(s,a),{exports:l}=c||{};c&&c.name&&c.name===m&&l!=null&&(h=await resolveExportsImports(s,l,`.`+r.slice(m.length),a,!1,o,i),h&&await a.emitFile(s+path_1.sep+`package.json`,`resolve`,i))}}let g,_=p.indexOf(path_1.sep);for(;(g=p.lastIndexOf(path_1.sep))>_;){p=p.slice(0,g);let l=p+path_1.sep+`node_modules`,u=await a.stat(l);if(!u||!u.isDirectory())continue;let d=await getPkgCfg(l+path_1.sep+m,a),{exports:_}=d||{};if(d&&await resolveRemappings(l+path_1.sep+m,d,i,a),a.conditions&&_!=null&&!h){let u;a.exportsOnly||(u=await resolveFile(l+path_1.sep+r,i,a)||await resolveDir(l+path_1.sep+r,i,a));let d=await resolveExportsImports(l+path_1.sep+m,_,`.`+r.slice(m.length),a,!1,o,i);if(d)return await a.emitFile(l+path_1.sep+m+path_1.sep+`package.json`,`resolve`,i),u&&!d.includes(u)?[...d,u]:d;if(u)return u}else{let o=await resolveFile(l+path_1.sep+r,i,a)||await resolveDir(l+path_1.sep+r,i,a);if(o){if(h){if(Array.isArray(h))return h.includes(o)?h:[o,...h];if(h!==o)return[o,h]}return o}}}if(h)return h;if(Object.hasOwnProperty.call(a.paths,r))return a.paths[r];for(let e of Object.keys(a.paths))if(e.endsWith(`/`)&&r.startsWith(e)){let o=a.paths[e]+r.slice(e.length),u=await resolveFile(o,i,a)||await resolveDir(o,i,a);if(!u)throw new NotFoundError(r,i);return u}throw new NotFoundError(r,i)}
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@vercel/nft",
3
- "version": "0.30.3",
3
+ "version": "1.1.1",
4
4
  "main": "./out/index.js"
5
5
  }
@@ -0,0 +1 @@
1
+ "use strict";if(process.platform!==`darwin`)throw Error(`Module 'fsevents' is not compatible with platform '${process.platform}'`);const Native=require(`./fsevents.node`),events=Native.constants;function watch(i,a,o){if(typeof i!=`string`)throw TypeError(`fsevents argument 1 must be a string and not a ${typeof i}`);if(typeof a==`function`&&o===void 0&&(o=a,a=Native.flags.SinceNow),typeof a!=`number`)throw TypeError(`fsevents argument 2 must be a number and not a ${typeof a}`);if(typeof o!=`function`)throw TypeError(`fsevents argument 3 must be a function and not a ${typeof o}`);let s=Native.start(Native.global,i,a,o);if(!s)throw Error(`could not watch: ${i}`);return()=>{let i=s?Promise.resolve(s).then(Native.stop):Promise.resolve(void 0);return s=void 0,i}}function getInfo(e,i){return{path:e,flags:i,event:getEventType(i),type:getFileType(i),changes:getFileChanges(i)}}function getFileType(e){if(events.ItemIsFile&e)return`file`;if(events.ItemIsDir&e||events.MustScanSubDirs&e)return`directory`;if(events.ItemIsSymlink&e)return`symlink`}function anyIsTrue(e){for(let i in e)if(e[i])return!0;return!1}function getEventType(e){return events.ItemRemoved&e?`deleted`:events.ItemRenamed&e?`moved`:events.ItemCreated&e?`created`:events.ItemModified&e?`modified`:events.RootChanged&e?`root-changed`:events.ItemCloned&e?`cloned`:anyIsTrue(e)?`modified`:`unknown`}function getFileChanges(e){return{inode:!!(events.ItemInodeMetaMod&e),finder:!!(events.ItemFinderInfoMod&e),access:!!(events.ItemChangeOwner&e),xattrs:!!(events.ItemXattrMod&e)}}exports.watch=watch,exports.getInfo=getInfo,exports.constants=events;
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "fsevents",
3
+ "version": "2.3.3",
4
+ "main": "fsevents.js"
5
+ }