@indiciaosint/sdk 0.0.1 → 1.0.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 (159) hide show
  1. package/README.md +5 -9
  2. package/esm/lib/config.d.ts +2 -2
  3. package/esm/lib/config.js +2 -2
  4. package/jsr.json +1 -1
  5. package/package.json +14 -7
  6. package/src/lib/config.ts +2 -2
  7. package/.devcontainer/README.md +0 -30
  8. package/docs/sdks/indicia/README.md +0 -3053
  9. package/examples/README.md +0 -31
  10. package/examples/node_modules/@esbuild/darwin-arm64/README.md +0 -3
  11. package/examples/node_modules/@types/node/LICENSE +0 -21
  12. package/examples/node_modules/@types/node/README.md +0 -15
  13. package/examples/node_modules/@types/node/assert/strict.d.ts +0 -8
  14. package/examples/node_modules/@types/node/assert.d.ts +0 -1062
  15. package/examples/node_modules/@types/node/async_hooks.d.ts +0 -605
  16. package/examples/node_modules/@types/node/buffer.buffer.d.ts +0 -471
  17. package/examples/node_modules/@types/node/buffer.d.ts +0 -1936
  18. package/examples/node_modules/@types/node/child_process.d.ts +0 -1475
  19. package/examples/node_modules/@types/node/cluster.d.ts +0 -577
  20. package/examples/node_modules/@types/node/compatibility/disposable.d.ts +0 -16
  21. package/examples/node_modules/@types/node/compatibility/index.d.ts +0 -9
  22. package/examples/node_modules/@types/node/compatibility/indexable.d.ts +0 -20
  23. package/examples/node_modules/@types/node/compatibility/iterators.d.ts +0 -21
  24. package/examples/node_modules/@types/node/console.d.ts +0 -452
  25. package/examples/node_modules/@types/node/constants.d.ts +0 -21
  26. package/examples/node_modules/@types/node/crypto.d.ts +0 -4590
  27. package/examples/node_modules/@types/node/dgram.d.ts +0 -597
  28. package/examples/node_modules/@types/node/diagnostics_channel.d.ts +0 -578
  29. package/examples/node_modules/@types/node/dns/promises.d.ts +0 -479
  30. package/examples/node_modules/@types/node/dns.d.ts +0 -871
  31. package/examples/node_modules/@types/node/domain.d.ts +0 -170
  32. package/examples/node_modules/@types/node/events.d.ts +0 -977
  33. package/examples/node_modules/@types/node/fs/promises.d.ts +0 -1270
  34. package/examples/node_modules/@types/node/fs.d.ts +0 -4375
  35. package/examples/node_modules/@types/node/globals.d.ts +0 -172
  36. package/examples/node_modules/@types/node/globals.typedarray.d.ts +0 -38
  37. package/examples/node_modules/@types/node/http.d.ts +0 -2049
  38. package/examples/node_modules/@types/node/http2.d.ts +0 -2712
  39. package/examples/node_modules/@types/node/https.d.ts +0 -578
  40. package/examples/node_modules/@types/node/index.d.ts +0 -93
  41. package/examples/node_modules/@types/node/inspector.generated.d.ts +0 -3966
  42. package/examples/node_modules/@types/node/module.d.ts +0 -539
  43. package/examples/node_modules/@types/node/net.d.ts +0 -1031
  44. package/examples/node_modules/@types/node/os.d.ts +0 -506
  45. package/examples/node_modules/@types/node/path.d.ts +0 -200
  46. package/examples/node_modules/@types/node/perf_hooks.d.ts +0 -961
  47. package/examples/node_modules/@types/node/process.d.ts +0 -1961
  48. package/examples/node_modules/@types/node/punycode.d.ts +0 -117
  49. package/examples/node_modules/@types/node/querystring.d.ts +0 -152
  50. package/examples/node_modules/@types/node/readline/promises.d.ts +0 -162
  51. package/examples/node_modules/@types/node/readline.d.ts +0 -589
  52. package/examples/node_modules/@types/node/repl.d.ts +0 -430
  53. package/examples/node_modules/@types/node/sea.d.ts +0 -153
  54. package/examples/node_modules/@types/node/stream/consumers.d.ts +0 -38
  55. package/examples/node_modules/@types/node/stream/promises.d.ts +0 -90
  56. package/examples/node_modules/@types/node/stream/web.d.ts +0 -533
  57. package/examples/node_modules/@types/node/stream.d.ts +0 -1698
  58. package/examples/node_modules/@types/node/string_decoder.d.ts +0 -67
  59. package/examples/node_modules/@types/node/test.d.ts +0 -1787
  60. package/examples/node_modules/@types/node/timers/promises.d.ts +0 -108
  61. package/examples/node_modules/@types/node/timers.d.ts +0 -286
  62. package/examples/node_modules/@types/node/tls.d.ts +0 -1259
  63. package/examples/node_modules/@types/node/trace_events.d.ts +0 -197
  64. package/examples/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +0 -468
  65. package/examples/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +0 -34
  66. package/examples/node_modules/@types/node/ts5.6/index.d.ts +0 -93
  67. package/examples/node_modules/@types/node/tty.d.ts +0 -208
  68. package/examples/node_modules/@types/node/url.d.ts +0 -964
  69. package/examples/node_modules/@types/node/util.d.ts +0 -2331
  70. package/examples/node_modules/@types/node/v8.d.ts +0 -809
  71. package/examples/node_modules/@types/node/vm.d.ts +0 -1001
  72. package/examples/node_modules/@types/node/wasi.d.ts +0 -181
  73. package/examples/node_modules/@types/node/web-globals/abortcontroller.d.ts +0 -34
  74. package/examples/node_modules/@types/node/web-globals/domexception.d.ts +0 -68
  75. package/examples/node_modules/@types/node/web-globals/events.d.ts +0 -97
  76. package/examples/node_modules/@types/node/web-globals/fetch.d.ts +0 -55
  77. package/examples/node_modules/@types/node/worker_threads.d.ts +0 -715
  78. package/examples/node_modules/@types/node/zlib.d.ts +0 -598
  79. package/examples/node_modules/dotenv/LICENSE +0 -23
  80. package/examples/node_modules/dotenv/README.md +0 -645
  81. package/examples/node_modules/dotenv/config.d.ts +0 -1
  82. package/examples/node_modules/dotenv/config.js +0 -9
  83. package/examples/node_modules/dotenv/lib/cli-options.js +0 -17
  84. package/examples/node_modules/dotenv/lib/env-options.js +0 -28
  85. package/examples/node_modules/dotenv/lib/main.d.ts +0 -162
  86. package/examples/node_modules/dotenv/lib/main.js +0 -386
  87. package/examples/node_modules/esbuild/LICENSE.md +0 -21
  88. package/examples/node_modules/esbuild/README.md +0 -3
  89. package/examples/node_modules/esbuild/install.js +0 -300
  90. package/examples/node_modules/esbuild/lib/main.d.ts +0 -716
  91. package/examples/node_modules/esbuild/lib/main.js +0 -2532
  92. package/examples/node_modules/fsevents/LICENSE +0 -22
  93. package/examples/node_modules/fsevents/README.md +0 -89
  94. package/examples/node_modules/fsevents/fsevents.d.ts +0 -46
  95. package/examples/node_modules/fsevents/fsevents.js +0 -83
  96. package/examples/node_modules/tsx/LICENSE +0 -21
  97. package/examples/node_modules/tsx/README.md +0 -32
  98. package/examples/node_modules/tsx/dist/cjs/api/index.mjs +0 -1
  99. package/examples/node_modules/tsx/dist/cjs/index.mjs +0 -1
  100. package/examples/node_modules/tsx/dist/cli.mjs +0 -55
  101. package/examples/node_modules/tsx/dist/client-D_mPDF5S.mjs +0 -1
  102. package/examples/node_modules/tsx/dist/esm/api/index.mjs +0 -1
  103. package/examples/node_modules/tsx/dist/esm/index.mjs +0 -1
  104. package/examples/node_modules/tsx/dist/get-pipe-path-_tAJyU_v.mjs +0 -1
  105. package/examples/node_modules/tsx/dist/index-XurvG3JN.mjs +0 -14
  106. package/examples/node_modules/tsx/dist/index-gbaejti9.mjs +0 -1
  107. package/examples/node_modules/tsx/dist/lexer-DQCqS3nf.mjs +0 -3
  108. package/examples/node_modules/tsx/dist/loader.mjs +0 -1
  109. package/examples/node_modules/tsx/dist/node-features-B9BBLzwu.mjs +0 -1
  110. package/examples/node_modules/tsx/dist/package-Bj47PlGH.mjs +0 -1
  111. package/examples/node_modules/tsx/dist/patch-repl.mjs +0 -1
  112. package/examples/node_modules/tsx/dist/preflight.mjs +0 -1
  113. package/examples/node_modules/tsx/dist/register-BnTWPeIB.mjs +0 -10
  114. package/examples/node_modules/tsx/dist/register-CqMfTiWi.mjs +0 -2
  115. package/examples/node_modules/tsx/dist/repl.mjs +0 -3
  116. package/examples/node_modules/tsx/dist/require-DzmC1hVr.mjs +0 -1
  117. package/examples/node_modules/tsx/dist/suppress-warnings.mjs +0 -1
  118. package/examples/node_modules/tsx/dist/temporary-directory-BDDVQOvU.mjs +0 -1
  119. package/examples/node_modules/tsx/dist/types-Cxp8y2TL.d.ts +0 -5
  120. package/examples/node_modules/undici-types/LICENSE +0 -21
  121. package/examples/node_modules/undici-types/README.md +0 -6
  122. package/examples/node_modules/undici-types/agent.d.ts +0 -31
  123. package/examples/node_modules/undici-types/api.d.ts +0 -43
  124. package/examples/node_modules/undici-types/balanced-pool.d.ts +0 -29
  125. package/examples/node_modules/undici-types/cache.d.ts +0 -36
  126. package/examples/node_modules/undici-types/client.d.ts +0 -108
  127. package/examples/node_modules/undici-types/connector.d.ts +0 -34
  128. package/examples/node_modules/undici-types/content-type.d.ts +0 -21
  129. package/examples/node_modules/undici-types/cookies.d.ts +0 -28
  130. package/examples/node_modules/undici-types/diagnostics-channel.d.ts +0 -66
  131. package/examples/node_modules/undici-types/dispatcher.d.ts +0 -256
  132. package/examples/node_modules/undici-types/env-http-proxy-agent.d.ts +0 -21
  133. package/examples/node_modules/undici-types/errors.d.ts +0 -149
  134. package/examples/node_modules/undici-types/eventsource.d.ts +0 -61
  135. package/examples/node_modules/undici-types/fetch.d.ts +0 -209
  136. package/examples/node_modules/undici-types/file.d.ts +0 -39
  137. package/examples/node_modules/undici-types/filereader.d.ts +0 -54
  138. package/examples/node_modules/undici-types/formdata.d.ts +0 -108
  139. package/examples/node_modules/undici-types/global-dispatcher.d.ts +0 -9
  140. package/examples/node_modules/undici-types/global-origin.d.ts +0 -7
  141. package/examples/node_modules/undici-types/handlers.d.ts +0 -15
  142. package/examples/node_modules/undici-types/header.d.ts +0 -4
  143. package/examples/node_modules/undici-types/index.d.ts +0 -71
  144. package/examples/node_modules/undici-types/interceptors.d.ts +0 -17
  145. package/examples/node_modules/undici-types/mock-agent.d.ts +0 -50
  146. package/examples/node_modules/undici-types/mock-client.d.ts +0 -25
  147. package/examples/node_modules/undici-types/mock-errors.d.ts +0 -12
  148. package/examples/node_modules/undici-types/mock-interceptor.d.ts +0 -93
  149. package/examples/node_modules/undici-types/mock-pool.d.ts +0 -25
  150. package/examples/node_modules/undici-types/patch.d.ts +0 -33
  151. package/examples/node_modules/undici-types/pool-stats.d.ts +0 -19
  152. package/examples/node_modules/undici-types/pool.d.ts +0 -39
  153. package/examples/node_modules/undici-types/proxy-agent.d.ts +0 -28
  154. package/examples/node_modules/undici-types/readable.d.ts +0 -65
  155. package/examples/node_modules/undici-types/retry-agent.d.ts +0 -8
  156. package/examples/node_modules/undici-types/retry-handler.d.ts +0 -116
  157. package/examples/node_modules/undici-types/util.d.ts +0 -18
  158. package/examples/node_modules/undici-types/webidl.d.ts +0 -228
  159. package/examples/node_modules/undici-types/websocket.d.ts +0 -150
@@ -1,300 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (let key of __getOwnPropNames(from))
11
- if (!__hasOwnProp.call(to, key) && key !== except)
12
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- }
14
- return to;
15
- };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
- // If the importer is in node compatibility mode or this is not an ESM
18
- // file that has been converted to a CommonJS file using a Babel-
19
- // compatible transform (i.e. "__esModule" has not been set), then set
20
- // "default" to the CommonJS "module.exports" for node compatibility.
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
24
-
25
- // lib/npm/node-platform.ts
26
- var fs = require("fs");
27
- var os = require("os");
28
- var path = require("path");
29
- var ESBUILD_BINARY_PATH = process.env.ESBUILD_BINARY_PATH || ESBUILD_BINARY_PATH;
30
- var isValidBinaryPath = (x) => !!x && x !== "/usr/bin/esbuild";
31
- var knownWindowsPackages = {
32
- "win32 arm64 LE": "@esbuild/win32-arm64",
33
- "win32 ia32 LE": "@esbuild/win32-ia32",
34
- "win32 x64 LE": "@esbuild/win32-x64"
35
- };
36
- var knownUnixlikePackages = {
37
- "aix ppc64 BE": "@esbuild/aix-ppc64",
38
- "android arm64 LE": "@esbuild/android-arm64",
39
- "darwin arm64 LE": "@esbuild/darwin-arm64",
40
- "darwin x64 LE": "@esbuild/darwin-x64",
41
- "freebsd arm64 LE": "@esbuild/freebsd-arm64",
42
- "freebsd x64 LE": "@esbuild/freebsd-x64",
43
- "linux arm LE": "@esbuild/linux-arm",
44
- "linux arm64 LE": "@esbuild/linux-arm64",
45
- "linux ia32 LE": "@esbuild/linux-ia32",
46
- "linux mips64el LE": "@esbuild/linux-mips64el",
47
- "linux ppc64 LE": "@esbuild/linux-ppc64",
48
- "linux riscv64 LE": "@esbuild/linux-riscv64",
49
- "linux s390x BE": "@esbuild/linux-s390x",
50
- "linux x64 LE": "@esbuild/linux-x64",
51
- "linux loong64 LE": "@esbuild/linux-loong64",
52
- "netbsd arm64 LE": "@esbuild/netbsd-arm64",
53
- "netbsd x64 LE": "@esbuild/netbsd-x64",
54
- "openbsd arm64 LE": "@esbuild/openbsd-arm64",
55
- "openbsd x64 LE": "@esbuild/openbsd-x64",
56
- "sunos x64 LE": "@esbuild/sunos-x64"
57
- };
58
- var knownWebAssemblyFallbackPackages = {
59
- "android arm LE": "@esbuild/android-arm",
60
- "android x64 LE": "@esbuild/android-x64",
61
- "openharmony arm64 LE": "@esbuild/openharmony-arm64"
62
- };
63
- function pkgAndSubpathForCurrentPlatform() {
64
- let pkg;
65
- let subpath;
66
- let isWASM = false;
67
- let platformKey = `${process.platform} ${os.arch()} ${os.endianness()}`;
68
- if (platformKey in knownWindowsPackages) {
69
- pkg = knownWindowsPackages[platformKey];
70
- subpath = "esbuild.exe";
71
- } else if (platformKey in knownUnixlikePackages) {
72
- pkg = knownUnixlikePackages[platformKey];
73
- subpath = "bin/esbuild";
74
- } else if (platformKey in knownWebAssemblyFallbackPackages) {
75
- pkg = knownWebAssemblyFallbackPackages[platformKey];
76
- subpath = "bin/esbuild";
77
- isWASM = true;
78
- } else {
79
- throw new Error(`Unsupported platform: ${platformKey}`);
80
- }
81
- return { pkg, subpath, isWASM };
82
- }
83
- function downloadedBinPath(pkg, subpath) {
84
- const esbuildLibDir = path.dirname(require.resolve("esbuild"));
85
- return path.join(esbuildLibDir, `downloaded-${pkg.replace("/", "-")}-${path.basename(subpath)}`);
86
- }
87
-
88
- // lib/npm/node-install.ts
89
- var fs2 = require("fs");
90
- var os2 = require("os");
91
- var path2 = require("path");
92
- var zlib = require("zlib");
93
- var https = require("https");
94
- var crypto = require("crypto");
95
- var child_process = require("child_process");
96
- var packageJSON = require(path2.join(__dirname, "package.json"));
97
- var toPath = path2.join(__dirname, "bin", "esbuild");
98
- var isToPathJS = true;
99
- function validateBinaryVersion(...command) {
100
- command.push("--version");
101
- let stdout;
102
- try {
103
- stdout = child_process.execFileSync(command.shift(), command, {
104
- // Without this, this install script strangely crashes with the error
105
- // "EACCES: permission denied, write" but only on Ubuntu Linux when node is
106
- // installed from the Snap Store. This is not a problem when you download
107
- // the official version of node. The problem appears to be that stderr
108
- // (i.e. file descriptor 2) isn't writable?
109
- //
110
- // More info:
111
- // - https://snapcraft.io/ (what the Snap Store is)
112
- // - https://nodejs.org/dist/ (download the official version of node)
113
- // - https://github.com/evanw/esbuild/issues/1711#issuecomment-1027554035
114
- //
115
- stdio: "pipe"
116
- }).toString().trim();
117
- } catch (err) {
118
- if (os2.platform() === "darwin" && /_SecTrustEvaluateWithError/.test(err + "")) {
119
- let os3 = "this version of macOS";
120
- try {
121
- os3 = "macOS " + child_process.execFileSync("sw_vers", ["-productVersion"]).toString().trim();
122
- } catch {
123
- }
124
- throw new Error(`The "esbuild" package cannot be installed because ${os3} is too outdated.
125
-
126
- The Go compiler (which esbuild relies on) no longer supports ${os3},
127
- which means the "esbuild" binary executable can't be run. You can either:
128
-
129
- * Update your version of macOS to one that the Go compiler supports
130
- * Use the "esbuild-wasm" package instead of the "esbuild" package
131
- * Build esbuild yourself using an older version of the Go compiler
132
- `);
133
- }
134
- throw err;
135
- }
136
- if (stdout !== packageJSON.version) {
137
- throw new Error(`Expected ${JSON.stringify(packageJSON.version)} but got ${JSON.stringify(stdout)}`);
138
- }
139
- }
140
- function isYarn() {
141
- const { npm_config_user_agent } = process.env;
142
- if (npm_config_user_agent) {
143
- return /\byarn\//.test(npm_config_user_agent);
144
- }
145
- return false;
146
- }
147
- function fetch(url) {
148
- return new Promise((resolve, reject) => {
149
- https.get(url, (res) => {
150
- if ((res.statusCode === 301 || res.statusCode === 302) && res.headers.location)
151
- return fetch(res.headers.location).then(resolve, reject);
152
- if (res.statusCode !== 200)
153
- return reject(new Error(`Server responded with ${res.statusCode}`));
154
- let chunks = [];
155
- res.on("data", (chunk) => chunks.push(chunk));
156
- res.on("end", () => resolve(Buffer.concat(chunks)));
157
- }).on("error", reject);
158
- });
159
- }
160
- function extractFileFromTarGzip(buffer, subpath) {
161
- try {
162
- buffer = zlib.unzipSync(buffer);
163
- } catch (err) {
164
- throw new Error(`Invalid gzip data in archive: ${err && err.message || err}`);
165
- }
166
- let str = (i, n) => String.fromCharCode(...buffer.subarray(i, i + n)).replace(/\0.*$/, "");
167
- let offset = 0;
168
- subpath = `package/${subpath}`;
169
- while (offset < buffer.length) {
170
- let name = str(offset, 100);
171
- let size = parseInt(str(offset + 124, 12), 8);
172
- offset += 512;
173
- if (!isNaN(size) && size >= 0) {
174
- if (name === subpath) return buffer.subarray(offset, offset + size);
175
- offset += size + 511 & ~511;
176
- }
177
- }
178
- throw new Error(`Could not find ${JSON.stringify(subpath)} in archive`);
179
- }
180
- function installUsingNPM(pkg, subpath, binPath) {
181
- const env = { ...process.env, npm_config_global: void 0 };
182
- const esbuildLibDir = path2.dirname(require.resolve("esbuild"));
183
- const installDir = path2.join(esbuildLibDir, "npm-install");
184
- fs2.mkdirSync(installDir);
185
- try {
186
- fs2.writeFileSync(path2.join(installDir, "package.json"), "{}");
187
- child_process.execSync(
188
- `npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${packageJSON.version}`,
189
- { cwd: installDir, stdio: "pipe", env }
190
- );
191
- const installedBinPath = path2.join(installDir, "node_modules", pkg, subpath);
192
- binaryIntegrityCheck(pkg, subpath, fs2.readFileSync(installedBinPath));
193
- fs2.renameSync(installedBinPath, binPath);
194
- } finally {
195
- try {
196
- removeRecursive(installDir);
197
- } catch {
198
- }
199
- }
200
- }
201
- function removeRecursive(dir) {
202
- for (const entry of fs2.readdirSync(dir)) {
203
- const entryPath = path2.join(dir, entry);
204
- let stats;
205
- try {
206
- stats = fs2.lstatSync(entryPath);
207
- } catch {
208
- continue;
209
- }
210
- if (stats.isDirectory()) removeRecursive(entryPath);
211
- else fs2.unlinkSync(entryPath);
212
- }
213
- fs2.rmdirSync(dir);
214
- }
215
- function applyManualBinaryPathOverride(overridePath) {
216
- const pathString = JSON.stringify(overridePath);
217
- fs2.writeFileSync(toPath, `#!/usr/bin/env node
218
- require('child_process').execFileSync(${pathString}, process.argv.slice(2), { stdio: 'inherit' });
219
- `);
220
- const libMain = path2.join(__dirname, "lib", "main.js");
221
- const code = fs2.readFileSync(libMain, "utf8");
222
- fs2.writeFileSync(libMain, `var ESBUILD_BINARY_PATH = ${pathString};
223
- ${code}`);
224
- }
225
- function maybeOptimizePackage(binPath, isWASM) {
226
- if (os2.platform() !== "win32" && !isYarn() && !isWASM) {
227
- const tempPath = path2.join(__dirname, "bin-esbuild");
228
- try {
229
- fs2.linkSync(binPath, tempPath);
230
- fs2.renameSync(tempPath, toPath);
231
- isToPathJS = false;
232
- fs2.unlinkSync(tempPath);
233
- } catch {
234
- }
235
- }
236
- }
237
- function binaryIntegrityCheck(pkg, subpath, bytes) {
238
- const hash = crypto.createHash("sha256").update(bytes).digest("hex");
239
- const key = `${pkg}/${subpath}`;
240
- const expected = packageJSON["esbuild.binaryHashes"][key];
241
- if (!expected) throw new Error(`Missing hash for "${key}"`);
242
- if (hash !== expected) throw new Error(`"${hash.slice(0, 8)}..." doesn't match "${expected.slice(0, 8)}..." for "${pkg}"`);
243
- }
244
- async function downloadDirectlyFromNPM(pkg, subpath, binPath) {
245
- const url = `https://registry.npmjs.org/${pkg}/-/${pkg.replace("@esbuild/", "")}-${packageJSON.version}.tgz`;
246
- console.error(`[esbuild] Trying to download ${JSON.stringify(url)}`);
247
- try {
248
- const bytes = extractFileFromTarGzip(await fetch(url), subpath);
249
- binaryIntegrityCheck(pkg, subpath, bytes);
250
- fs2.writeFileSync(binPath, bytes);
251
- fs2.chmodSync(binPath, 493);
252
- } catch (e) {
253
- console.error(`[esbuild] Failed to download ${JSON.stringify(url)}: ${e && e.message || e}`);
254
- throw e;
255
- }
256
- }
257
- async function checkAndPreparePackage() {
258
- if (isValidBinaryPath(ESBUILD_BINARY_PATH)) {
259
- if (!fs2.existsSync(ESBUILD_BINARY_PATH)) {
260
- console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${ESBUILD_BINARY_PATH}`);
261
- } else {
262
- applyManualBinaryPathOverride(ESBUILD_BINARY_PATH);
263
- return;
264
- }
265
- }
266
- const { pkg, subpath, isWASM } = pkgAndSubpathForCurrentPlatform();
267
- let binPath;
268
- try {
269
- binPath = require.resolve(`${pkg}/${subpath}`);
270
- } catch (e) {
271
- console.error(`[esbuild] Failed to find package "${pkg}" on the file system
272
-
273
- This can happen if you use the "--no-optional" flag. The "optionalDependencies"
274
- package.json feature is used by esbuild to install the correct binary executable
275
- for your current platform. This install script will now attempt to work around
276
- this. If that fails, you need to remove the "--no-optional" flag to use esbuild.
277
- `);
278
- if (isWASM) throw new Error(`Failed to install package "${pkg}"`);
279
- binPath = downloadedBinPath(pkg, subpath);
280
- try {
281
- console.error(`[esbuild] Trying to install package "${pkg}" using npm`);
282
- installUsingNPM(pkg, subpath, binPath);
283
- } catch (e2) {
284
- console.error(`[esbuild] Failed to install package "${pkg}" using npm: ${e2 && e2.message || e2}`);
285
- try {
286
- await downloadDirectlyFromNPM(pkg, subpath, binPath);
287
- } catch (e3) {
288
- throw new Error(`Failed to install package "${pkg}"`);
289
- }
290
- }
291
- }
292
- maybeOptimizePackage(binPath, isWASM);
293
- }
294
- checkAndPreparePackage().then(() => {
295
- if (isToPathJS) {
296
- validateBinaryVersion(process.execPath, toPath);
297
- } else {
298
- validateBinaryVersion(toPath);
299
- }
300
- });