@vercel/rust 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +22 -12
  2. package/package.json +5 -9
package/dist/index.js CHANGED
@@ -337,22 +337,29 @@ 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);
344
- (0, import_build_utils6.debug)(`Running \`cargo build\` for \`${binaryName}\``);
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 ?? "";
345
349
  try {
346
350
  const args = crossCompilationEnabled ? [
347
351
  "zigbuild",
348
352
  "--target",
349
- "x86_64-unknown-linux-gnu",
353
+ architecture === "x86_64" ? "x86_64-unknown-linux-gnu" : "aarch64-unknown-linux-gnu",
350
354
  "--bin",
351
355
  binaryName
352
356
  ].concat(BUILDER_DEBUG ? ["--verbose"] : ["--quiet"], ["--release"]) : ["build", "--bin", binaryName].concat(
353
357
  BUILDER_DEBUG ? ["--verbose"] : ["--quiet"],
354
358
  meta?.isDev ? [] : ["--release"]
355
359
  );
360
+ (0, import_build_utils6.debug)(
361
+ `Running \`cargo build\` for \`${binaryName}\` (\`${architecture}\`)`
362
+ );
356
363
  await (0, import_execa4.default)("cargo", args, {
357
364
  cwd: workPath,
358
365
  env: rustEnv
@@ -361,13 +368,18 @@ async function buildHandler(options) {
361
368
  (0, import_build_utils6.debug)(`Running \`cargo build\` for \`${binaryName}\` failed`);
362
369
  throw err;
363
370
  }
364
- (0, import_build_utils6.debug)(`Building \`${binaryName}\` for \`${process.platform}\` completed`);
371
+ (0, import_build_utils6.debug)(
372
+ `Building \`${binaryName}\` for \`${process.platform}\` (\`${architecture}\`) completed`
373
+ );
365
374
  let { target_directory: targetDirectory } = await getCargoMetadata({
366
375
  cwd: workPath,
367
376
  env: rustEnv
368
377
  });
369
378
  if (crossCompilationEnabled) {
370
- targetDirectory = import_node_path4.default.join(targetDirectory, "x86_64-unknown-linux-gnu");
379
+ targetDirectory = import_node_path4.default.join(
380
+ targetDirectory,
381
+ architecture === "x86_64" ? "x86_64-unknown-linux-gnu" : "aarch64-unknown-linux-gnu"
382
+ );
371
383
  }
372
384
  targetDirectory = import_node_path4.default.join(targetDirectory, buildTarget);
373
385
  const bin = import_node_path4.default.join(
@@ -375,21 +387,19 @@ async function buildHandler(options) {
375
387
  buildVariant,
376
388
  getExecutableName(binaryName)
377
389
  );
378
- const lambdaOptions = await (0, import_build_utils6.getLambdaOptionsFromFunction)({
379
- sourceFile: entrypoint,
380
- config
381
- });
382
390
  const handler = getExecutableName("executable");
383
391
  const executableFile = new import_build_utils6.FileFsRef({ mode: 493, fsPath: bin });
384
392
  const lambda = new import_build_utils6.Lambda({
393
+ ...lambdaOptions,
385
394
  files: {
386
395
  ...extraFiles,
387
396
  [handler]: executableFile
388
397
  },
389
398
  handler,
390
- runtime: "executable",
391
399
  supportsResponseStreaming: true,
392
- ...lambdaOptions
400
+ architecture,
401
+ runtime: "executable",
402
+ runtimeLanguage: "rust"
393
403
  });
394
404
  lambda.zipBuffer = await lambda.createZip();
395
405
  (0, import_build_utils6.debug)(`generating function for \`${entrypoint}\``);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/rust",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/rust",
@@ -14,27 +14,23 @@
14
14
  ],
15
15
  "dependencies": {
16
16
  "@iarna/toml": "^2.2.5",
17
- "lodash": "^4.17.21",
18
17
  "execa": "5"
19
18
  },
20
19
  "devDependencies": {
21
- "typescript": "^4.9.4",
22
20
  "@types/jest": "^29.4.0",
23
- "@types/lodash": "^4.14.191",
24
21
  "@types/ms": "^0.7.31",
25
22
  "@types/node": "^18.11.18",
26
- "@types/node-fetch": "^2.6.2",
27
- "@vercel/build-utils": "13.1.0",
28
- "@vercel/routing-utils": "5.2.2",
23
+ "@vercel/build-utils": "13.2.0",
24
+ "@vercel/routing-utils": "5.3.0",
29
25
  "@vercel/style-guide": "^4.0.2",
30
26
  "eslint": "^8.35.0",
31
27
  "husky": "^8.0.3",
32
28
  "jest": "^29.5.0",
33
29
  "ms": "^2.1.3",
34
- "node-fetch": "2.6.0",
35
30
  "prettier": "^2.8.4",
36
31
  "rimraf": "^4.1.1",
37
- "ts-jest": "^29.0.5"
32
+ "ts-jest": "^29.0.5",
33
+ "typescript": "^4.9.4"
38
34
  },
39
35
  "scripts": {
40
36
  "build": "node ../../utils/build-builder.mjs",