@@ -95238,6 +95238,14 @@ const { isUint8Array, isArrayBuffer } = __nccwpck_require__(84978)
95238
95238
const { File: UndiciFile } = __nccwpck_require__(78511)
95239
95239
const { parseMIMEType, serializeAMimeType } = __nccwpck_require__(685)
95240
95240
95241
+ let random
95242
+ try {
95243
+ const crypto = __nccwpck_require__(6005)
95244
+ random = (max) => crypto.randomInt(0, max)
95245
+ } catch {
95246
+ random = (max) => Math.floor(Math.random(max))
95247
+ }
95248
+
95241
95249
let ReadableStream = globalThis.ReadableStream
95242
95250
95243
95251
/** @type {globalThis['File']} */
@@ -95323,7 +95331,7 @@ function extractBody (object, keepalive = false) {
95323
95331
// Set source to a copy of the bytes held by object.
95324
95332
source = new Uint8Array(object.buffer.slice(object.byteOffset, object.byteOffset + object.byteLength))
95325
95333
} else if (util.isFormDataLike(object)) {
95326
- const boundary = `----formdata-undici-0${`${Math.floor(Math. random() * 1e11)}`.padStart(11, '0')}`
95334
+ const boundary = `----formdata-undici-0${`${random(1e11)}`.padStart(11, '0')}`
95327
95335
const prefix = `--${boundary}\r\nContent-Disposition: form-data`
95328
95336
95329
95337
/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
@@ -113212,6 +113220,14 @@ module.exports = require("net");
113212
113220
113213
113221
/***/ }),
113214
113222
113223
+ /***/ 6005:
113224
+ /***/ ((module) => {
113225
+
113226
+ "use strict";
113227
+ module.exports = require("node:crypto");
113228
+
113229
+ /***/ }),
113230
+
113215
113231
/***/ 15673:
113216
113232
/***/ ((module) => {
113217
113233
@@ -137462,8 +137478,8 @@ const create = makeCommand(createFileSync, createFile, createSync, createAsync,
137462
137478
//# sourceMappingURL=create.js.map
137463
137479
;// CONCATENATED MODULE: external "node:assert"
137464
137480
const external_node_assert_namespaceObject = require("node:assert");
137465
- ; // CONCATENATED MODULE: external "node:crypto"
137466
- const external_node_crypto_namespaceObject = require("node:crypto" );
137481
+ // EXTERNAL MODULE: external "node:crypto"
137482
+ var external_node_crypto_ = __nccwpck_require__(6005 );
137467
137483
;// CONCATENATED MODULE: ./node_modules/tar/dist/esm/get-write-flag.js
137468
137484
// Get the appropriate flag to use for creating files
137469
137485
// We use fmap on Windows platforms for files less than
@@ -138329,7 +138345,7 @@ const unlinkFile = (path, cb) => {
138329
138345
if (!unpack_isWindows) {
138330
138346
return external_node_fs_.unlink(path, cb);
138331
138347
}
138332
- const name = path + '.DELETE.' + (0,external_node_crypto_namespaceObject .randomBytes)(16).toString('hex');
138348
+ const name = path + '.DELETE.' + (0,external_node_crypto_ .randomBytes)(16).toString('hex');
138333
138349
external_node_fs_.rename(path, name, er => {
138334
138350
if (er) {
138335
138351
return cb(er);
@@ -138343,7 +138359,7 @@ const unlinkFileSync = (path) => {
138343
138359
if (!unpack_isWindows) {
138344
138360
return external_node_fs_.unlinkSync(path);
138345
138361
}
138346
- const name = path + '.DELETE.' + (0,external_node_crypto_namespaceObject .randomBytes)(16).toString('hex');
138362
+ const name = path + '.DELETE.' + (0,external_node_crypto_ .randomBytes)(16).toString('hex');
138347
138363
external_node_fs_.renameSync(path, name);
138348
138364
external_node_fs_.unlinkSync(name);
138349
138365
};
@@ -139820,6 +139836,32 @@ function bundleNPMArtifacts() {
139820
139836
return external_child_process_.execSync(cmd).toString().trim();
139821
139837
}
139822
139838
const version = exec("git describe --tags --always");
139839
+ function getCompilerVersion(sandbox) {
139840
+ let lockFileFolder;
139841
+ if (sandbox) {
139842
+ lockFileFolder = "esy.lock";
139843
+ }
139844
+ else {
139845
+ lockFileFolder = `${sandbox}.esy.lock`;
139846
+ }
139847
+ console.log(`Looking up ${lockFileFolder} for compiler version`);
139848
+ const lockFile = JSON.parse(external_fs_.readFileSync(external_path_.join(process.cwd(), lockFileFolder, "index.json"))
139849
+ .toString());
139850
+ const ocamlPackages = Object.keys(lockFile.node).filter((k) => k.startsWith("ocaml@"));
139851
+ if (ocamlPackages.length === 0) {
139852
+ throw new Error("Couldn't figure ocaml compiler version from lock file because no ocaml-like packages were found");
139853
+ }
139854
+ const ocamlPackageID = ocamlPackages[0];
139855
+ const ocamlPackageIDParts = ocamlPackageID.split("@");
139856
+ if (ocamlPackageIDParts.length !== 3) {
139857
+ throw new Error(`Couldn't figure ocaml compiler version from lock file because PackageId wasn't in expected format: ${ocamlPackageID}`);
139858
+ }
139859
+ return ocamlPackageIDParts[1];
139860
+ }
139861
+ const compilerVersion = getCompilerVersion();
139862
+ console.log("Found compiler version", compilerVersion);
139863
+ const staticCompilerVersion = getCompilerVersion("static.esy");
139864
+ console.log("Found static compiler version", staticCompilerVersion);
139823
139865
const packageJson = JSON.stringify({
139824
139866
name: mainPackageJson.name,
139825
139867
version,
@@ -139828,8 +139870,8 @@ function bundleNPMArtifacts() {
139828
139870
repository: mainPackageJson.repository,
139829
139871
scripts: {
139830
139872
postinstall: rewritePrefix
139831
- ? " node -e \"process.env['OCAML_VERSION'] = process.platform == 'linux' ? '4.12.0 -musl.static.flambda': '4.12.0 '; process.env['OCAML_PKG_NAME'] = 'ocaml'; process.env['ESY_RELEASE_REWRITE_PREFIX']=true; require('./postinstall.js')\""
139832
- : "node -e \"process.env['OCAML_VERSION'] = process.platform == 'linux' ? '4.12.0-musl.static.flambda': '4.12.0'; process.env['OCAML_PKG_NAME'] = 'ocaml'; require('./postinstall.js')\"",
139873
+ ? ` node -e \"process.env['OCAML_VERSION'] = process.platform == 'linux' ? '${staticCompilerVersion} -musl.static.flambda': '${compilerVersion} '; process.env['OCAML_PKG_NAME'] = 'ocaml'; process.env['ESY_RELEASE_REWRITE_PREFIX']=true; require('./postinstall.js')\"`
139874
+ : "require('./postinstall.js')\"",
139833
139875
},
139834
139876
bin: bins,
139835
139877
files: [
0 commit comments