@vercel/container
Advanced tools
+19
-11
@@ -39,3 +39,2 @@ "use strict"; | ||
| module.exports = __toCommonJS(src_exports); | ||
| var import_build_utils3 = require("@vercel/build-utils"); | ||
| var import_node_fs6 = require("fs"); | ||
@@ -1407,4 +1406,12 @@ var import_node_path6 = __toESM(require("path")); | ||
| const base = import_node_path6.default.basename(ref).toLowerCase(); | ||
| return base === "dockerfile" || base === "containerfile" || base.endsWith(".dockerfile"); | ||
| return base === "dockerfile" || base === "containerfile" || base.endsWith(".dockerfile") || // Vercel-specific container opt-in markers, used to deploy a project as a | ||
| // container even when another framework (e.g. Next.js) is also present. | ||
| base === "dockerfile.vercel" || base === "containerfile.vercel"; | ||
| } | ||
| var DOCKERFILE_CANDIDATES = ["Dockerfile.vercel", "Containerfile.vercel"]; | ||
| function findDockerfile(workPath) { | ||
| return DOCKERFILE_CANDIDATES.find( | ||
| (name) => (0, import_node_fs6.existsSync)(import_node_path6.default.join(workPath, name)) | ||
| ); | ||
| } | ||
| function sanitizeRepository(name) { | ||
@@ -1573,3 +1580,3 @@ const sanitized = name.toLowerCase().replace(/[^a-z0-9-_./]/g, "-").replace(/-+/g, "-").replace(/(^[-/.]+)|([-/.]+$)/g, ""); | ||
| const entrypointRef = readString(entrypoint); | ||
| const dockerfileConfigured = entrypointRef && isDockerfileRef2(entrypointRef) ? entrypointRef : void 0; | ||
| const dockerfileConfigured = entrypointRef && isDockerfileRef2(entrypointRef) ? entrypointRef : findDockerfile(workPath); | ||
| const dockerfileRel = dockerfileConfigured ?? "Dockerfile"; | ||
@@ -1609,8 +1616,5 @@ const dockerfilePath = import_node_path6.default.join(workPath, dockerfileRel); | ||
| const serviceName = options.service?.name; | ||
| if (!serviceName) { | ||
| throw new Error( | ||
| "Container service is missing a name; cannot derive the registry repository." | ||
| ); | ||
| } | ||
| const repository = sanitizeRepository(serviceName); | ||
| const repository = sanitizeRepository( | ||
| serviceName ?? import_node_path6.default.basename(dockerfileRel).split(".")[0] | ||
| ); | ||
| const tag = resolveImageTag(); | ||
@@ -1653,6 +1657,10 @@ const contextDir = import_node_path6.default.dirname(dockerfilePath); | ||
| const command = normalizeCommand2(options.config.command); | ||
| const outputPath = options.service?.name ? (0, import_build_utils3.getInternalServiceFunctionPath)(options.service.name).replace(/^\//, "") : "index"; | ||
| const routes = [ | ||
| { handle: "filesystem" }, | ||
| { src: "/(.*)", dest: "/index" } | ||
| ]; | ||
| return { | ||
| routes, | ||
| output: { | ||
| [outputPath]: { | ||
| index: { | ||
| type: "Lambda", | ||
@@ -1659,0 +1667,0 @@ files: {}, |
+2
-2
| { | ||
| "name": "@vercel/container", | ||
| "version": "0.0.1", | ||
| "version": "0.0.2", | ||
| "license": "Apache-2.0", | ||
@@ -18,3 +18,3 @@ "main": "./dist/index.js", | ||
| "vitest": "2.0.3", | ||
| "@vercel/build-utils": "13.32.0" | ||
| "@vercel/build-utils": "13.32.1" | ||
| }, | ||
@@ -21,0 +21,0 @@ "publishConfig": { |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
67657
0.46%1667
0.48%5
-16.67%