@vercel/rust 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +13 -8
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -337,16 +337,21 @@ async function buildHandler(options) {
337
337
  });
338
338
  const binaryName = findBinaryName(cargoWorkspace, entryPath);
339
339
  const cargoBuildConfiguration = await findCargoBuildConfiguration(cargoWorkspace);
340
- const buildVariant = BUILDER_DEBUG || meta?.isDev ? "debug" : "release";
341
- const buildTarget = cargoBuildConfiguration?.build.target ?? "";
342
340
  await runUserScripts(workPath);
343
341
  const extraFiles = await gatherExtraFiles(config.includeFiles, workPath);
342
+ const lambdaOptions = await (0, import_build_utils6.getLambdaOptionsFromFunction)({
343
+ sourceFile: entrypoint,
344
+ config
345
+ });
346
+ const architecture = lambdaOptions?.architecture || "x86_64";
347
+ const buildVariant = meta?.isDev ? "debug" : "release";
348
+ const buildTarget = cargoBuildConfiguration?.build.target ?? "";
344
349
  (0, import_build_utils6.debug)(`Running \`cargo build\` for \`${binaryName}\``);
345
350
  try {
346
351
  const args = crossCompilationEnabled ? [
347
352
  "zigbuild",
348
353
  "--target",
349
- "x86_64-unknown-linux-gnu",
354
+ architecture === "x86_64" ? "x86_64-unknown-linux-gnu" : "aarch64-unknown-linux-gnu",
350
355
  "--bin",
351
356
  binaryName
352
357
  ].concat(BUILDER_DEBUG ? ["--verbose"] : ["--quiet"], ["--release"]) : ["build", "--bin", binaryName].concat(
@@ -367,7 +372,10 @@ async function buildHandler(options) {
367
372
  env: rustEnv
368
373
  });
369
374
  if (crossCompilationEnabled) {
370
- targetDirectory = import_node_path4.default.join(targetDirectory, "x86_64-unknown-linux-gnu");
375
+ targetDirectory = import_node_path4.default.join(
376
+ targetDirectory,
377
+ architecture === "x86_64" ? "x86_64-unknown-linux-gnu" : "aarch64-unknown-linux-gnu"
378
+ );
371
379
  }
372
380
  targetDirectory = import_node_path4.default.join(targetDirectory, buildTarget);
373
381
  const bin = import_node_path4.default.join(
@@ -375,10 +383,6 @@ async function buildHandler(options) {
375
383
  buildVariant,
376
384
  getExecutableName(binaryName)
377
385
  );
378
- const lambdaOptions = await (0, import_build_utils6.getLambdaOptionsFromFunction)({
379
- sourceFile: entrypoint,
380
- config
381
- });
382
386
  const handler = getExecutableName("executable");
383
387
  const executableFile = new import_build_utils6.FileFsRef({ mode: 493, fsPath: bin });
384
388
  const lambda = new import_build_utils6.Lambda({
@@ -387,6 +391,7 @@ async function buildHandler(options) {
387
391
  [handler]: executableFile
388
392
  },
389
393
  handler,
394
+ architecture,
390
395
  runtime: "executable",
391
396
  supportsResponseStreaming: true,
392
397
  ...lambdaOptions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/rust",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/rust",
@@ -25,7 +25,7 @@
25
25
  "@types/node": "^18.11.18",
26
26
  "@types/node-fetch": "^2.6.2",
27
27
  "@vercel/build-utils": "13.1.0",
28
- "@vercel/routing-utils": "5.2.2",
28
+ "@vercel/routing-utils": "5.3.0",
29
29
  "@vercel/style-guide": "^4.0.2",
30
30
  "eslint": "^8.35.0",
31
31
  "husky": "^8.0.3",