ecklf-tmp-runtime-test
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -19,9 +19,8 @@ "use strict"; | ||
const install_rust_toolchain_1 = require("./bootstrap/install-rust-toolchain"); | ||
const execa_1 = __importDefault(require("execa")); | ||
exports.version = 3; | ||
const createZip = () => __awaiter(void 0, void 0, void 0, function* () { | ||
return Buffer.from("hello world"); | ||
}); | ||
function build(options) { | ||
var _a, _b; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
(0, build_utils_1.debug)(`files: ${JSON.stringify(options, null, 2)}`); | ||
(0, build_utils_1.debug)(`Files: ${JSON.stringify(options, null, 2)}`); | ||
const { files, entrypoint, workPath, config: _config, meta } = options; | ||
@@ -33,5 +32,33 @@ yield (0, install_rust_toolchain_1.installRustToolchain)(); | ||
const { PATH, HOME } = process.env; | ||
const rustEnv = Object.assign(Object.assign({}, process.env), { PATH: `${path_1.default.join(HOME, ".cargo/bin")}:${PATH}`, RUSTFLAGS: [process.env.RUSTFLAGS].filter(Boolean).join(" ") }); | ||
const rustEnv = { | ||
PATH: `${path_1.default.join(HOME, ".cargo/bin")}:${PATH}`, | ||
RUSTFLAGS: [process.env.RUSTFLAGS].filter(Boolean).join(" "), | ||
}; | ||
const env = Object.assign(Object.assign({}, process.env), rustEnv); | ||
const BUILDER_DEBUG = (_a = Boolean(process.env.VERCEL_BUILDER_DEBUG)) !== null && _a !== void 0 ? _a : false; | ||
const LOCAL_DEV = (_b = Boolean(process.env.LOCAL_DEV)) !== null && _b !== void 0 ? _b : false; | ||
const LAMBDA_NAME = "hello_world"; | ||
(0, build_utils_1.debug)("Running `cargo build`..."); | ||
try { | ||
if (LOCAL_DEV) { | ||
process.chdir(`${process.cwd()}/demo`); | ||
} | ||
yield (0, execa_1.default)("cargo", ["build", "--bin", LAMBDA_NAME].concat(BUILDER_DEBUG ? ["--verbose"] : ["--quiet", "--release"]), { | ||
cwd: process.cwd(), | ||
env: rustEnv, | ||
stdio: "inherit", | ||
}); | ||
} | ||
catch (err) { | ||
console.error("Failed to `cargo build`"); | ||
throw err; | ||
} | ||
const binExtension = process.platform === "win32" ? ".exe" : ""; | ||
const bootstrap = "bootstrap" + binExtension; | ||
const targetPath = `target/${BUILDER_DEBUG ? "debug" : "release"}`; | ||
const bin = path_1.default.join(process.cwd(), `${targetPath}/${LAMBDA_NAME}`); | ||
const lambda = new build_utils_1.Lambda({ | ||
files: {}, | ||
files: { | ||
[bootstrap]: new build_utils_1.FileFsRef({ mode: 0o755, fsPath: bin }), | ||
}, | ||
handler: "anything_works", | ||
@@ -38,0 +65,0 @@ runtime: "provided.al2", |
{ | ||
"name": "ecklf-tmp-runtime-test", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Vercel Lambda Runtime for Rust", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -7,41 +7,68 @@ ```sh | ||
``` | ||
workPath: /vercel/path0 | ||
entrypoint: api/user.rs | ||
files: { | ||
"api/Cargo.lock": { | ||
"type": "FileFsRef", | ||
"mode": 33188, | ||
"fsPath": "/vercel/path0/api/Cargo.lock" | ||
"files": { | ||
"api/Cargo.lock": { | ||
"type": "FileFsRef", | ||
"mode": 33188, | ||
"fsPath": "/vercel/path0/api/Cargo.lock" | ||
}, | ||
"api/Cargo.toml": { | ||
"type": "FileFsRef", | ||
"mode": 33188, | ||
"fsPath": "/vercel/path0/api/Cargo.toml" | ||
}, | ||
"api/user.rs": { | ||
"type": "FileFsRef", | ||
"mode": 33188, | ||
"fsPath": "/vercel/path0/api/user.rs" | ||
}, | ||
".vercelignore": { | ||
"type": "FileFsRef", | ||
"mode": 33188, | ||
"fsPath": "/vercel/path0/.vercelignore" | ||
}, | ||
"package.json": { | ||
"type": "FileFsRef", | ||
"mode": 33188, | ||
"fsPath": "/vercel/path0/package.json" | ||
}, | ||
"pnpm-lock.yaml": { | ||
"type": "FileFsRef", | ||
"mode": 33188, | ||
"fsPath": "/vercel/path0/pnpm-lock.yaml" | ||
}, | ||
"vercel.json": { | ||
"type": "FileFsRef", | ||
"mode": 33188, | ||
"fsPath": "/vercel/path0/vercel.json" | ||
} | ||
}, | ||
"api/Cargo.toml": { | ||
"type": "FileFsRef", | ||
"mode": 33188, | ||
"fsPath": "/vercel/path0/api/Cargo.toml" | ||
"entrypoint": "api/user.rs", | ||
"workPath": "/vercel/path0", | ||
"repoRootPath": "/vercel/path0", | ||
"config": { | ||
"zeroConfig": true, | ||
"functions": { | ||
"api/**/*.rs": { | ||
"runtime": "ecklf-tmp-runtime-test@1.0.4" | ||
} | ||
}, | ||
"projectSettings": { | ||
"createdAt": 1674047862614, | ||
"installCommand": null, | ||
"buildCommand": null, | ||
"devCommand": null, | ||
"outputDirectory": null, | ||
"rootDirectory": null, | ||
"framework": null, | ||
"nodeVersion": "18.x" | ||
}, | ||
"framework": null, | ||
"nodeVersion": "18.x" | ||
}, | ||
"api/user.rs": { | ||
"type": "FileFsRef", | ||
"mode": 33188, | ||
"fsPath": "/vercel/path0/api/user.rs" | ||
}, | ||
".vercelignore": { | ||
"type": "FileFsRef", | ||
"mode": 33188, | ||
"fsPath": "/vercel/path0/.vercelignore" | ||
}, | ||
"package.json": { | ||
"type": "FileFsRef", | ||
"mode": 33188, | ||
"fsPath": "/vercel/path0/package.json" | ||
}, | ||
"pnpm-lock.yaml": { | ||
"type": "FileFsRef", | ||
"mode": 33188, | ||
"fsPath": "/vercel/path0/pnpm-lock.yaml" | ||
}, | ||
"vercel.json": { | ||
"type": "FileFsRef", | ||
"mode": 33188, | ||
"fsPath": "/vercel/path0/vercel.json" | ||
"meta": { | ||
"skipDownload": true, | ||
"cliVersion": "28.12.7" | ||
} | ||
} | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10696
6
196
74
6