@vercel/container 0.1.0 → 0.2.0

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 +18 -2
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var src_exports = {};
32
32
  __export(src_exports, {
33
+ CONTAINER_OUTPUT_PATH: () => CONTAINER_OUTPUT_PATH,
33
34
  build: () => build,
34
35
  diagnostics: () => diagnostics,
35
36
  prepareCache: () => prepareCache,
@@ -1507,6 +1508,7 @@ async function prepareCache(_options) {
1507
1508
 
1508
1509
  // src/index.ts
1509
1510
  var version = 2;
1511
+ var CONTAINER_OUTPUT_PATH = "container";
1510
1512
  function resolveFunctionSourceFile(options) {
1511
1513
  const entrypoint = readString(options.entrypoint) ?? "";
1512
1514
  if (entrypoint === "<detect>") {
@@ -1770,12 +1772,25 @@ async function build(options) {
1770
1772
  });
1771
1773
  const routes = [
1772
1774
  { handle: "filesystem" },
1773
- { src: "/(.*)", dest: "/index" }
1775
+ // This route matches the resolved destination after rewrites. Copy that
1776
+ // path into the runtime request before dispatching the container so its
1777
+ // application routing observes the rewrite.
1778
+ {
1779
+ src: "/(.*)",
1780
+ dest: `/${CONTAINER_OUTPUT_PATH}`,
1781
+ transforms: [
1782
+ {
1783
+ type: "request.path",
1784
+ op: "set",
1785
+ args: "/$1"
1786
+ }
1787
+ ]
1788
+ }
1774
1789
  ];
1775
1790
  return {
1776
1791
  routes,
1777
1792
  output: {
1778
- index: {
1793
+ [CONTAINER_OUTPUT_PATH]: {
1779
1794
  type: "Lambda",
1780
1795
  files: {},
1781
1796
  // For `runtime: 'container'` the OCI image reference is carried in
@@ -1792,6 +1807,7 @@ async function build(options) {
1792
1807
  }
1793
1808
  // Annotate the CommonJS export names for ESM import in node:
1794
1809
  0 && (module.exports = {
1810
+ CONTAINER_OUTPUT_PATH,
1795
1811
  build,
1796
1812
  diagnostics,
1797
1813
  prepareCache,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/container",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.js",
6
6
  "homepage": "https://vercel.com/docs",
@@ -14,8 +14,8 @@
14
14
  ],
15
15
  "devDependencies": {
16
16
  "@types/node": "20.11.0",
17
- "vitest": "2.0.3",
18
- "@vercel/build-utils": "13.35.0"
17
+ "vitest": "4.1.10",
18
+ "@vercel/build-utils": "14.0.5"
19
19
  },
20
20
  "publishConfig": {
21
21
  "access": "public"
@@ -23,7 +23,7 @@
23
23
  "scripts": {
24
24
  "build": "node ../../utils/build-builder.mjs",
25
25
  "type-check": "tsc --noEmit",
26
- "test-unit": "vitest run --config ../../vitest.config.mts test/unit.test.ts test/diagnostics.test.ts",
27
- "vitest-unit": "glob --absolute 'test/*.test.ts'"
26
+ "test": "vitest run --config ../../vitest.config.mts",
27
+ "test-unit": "vitest run --config ../../vitest.config.mts test/unit.test.ts test/diagnostics.test.ts"
28
28
  }
29
29
  }