@vercel/container 0.0.5 → 0.1.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 +36 -6
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -31,23 +31,47 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  var src_exports = {};
32
32
  __export(src_exports, {
33
33
  build: () => build,
34
+ diagnostics: () => diagnostics,
34
35
  prepareCache: () => prepareCache,
35
36
  startDevServer: () => startDevServer,
36
37
  version: () => version
37
38
  });
38
39
  module.exports = __toCommonJS(src_exports);
39
- var import_build_utils3 = require("@vercel/build-utils");
40
+ var import_build_utils4 = require("@vercel/build-utils");
41
+
42
+ // src/diagnostics.ts
43
+ var import_build_utils = require("@vercel/build-utils");
44
+ async function generateProjectManifest({
45
+ workPath,
46
+ framework,
47
+ serviceType
48
+ }) {
49
+ try {
50
+ const manifest = {
51
+ version: import_build_utils.MANIFEST_VERSION,
52
+ runtime: "container",
53
+ ...framework ? { framework } : {},
54
+ ...serviceType ? { serviceType } : {},
55
+ dependencies: []
56
+ };
57
+ await (0, import_build_utils.writeProjectManifest)(manifest, workPath, "container");
58
+ } catch {
59
+ }
60
+ }
61
+ var diagnostics = (0, import_build_utils.createDiagnostics)("container");
62
+
63
+ // src/index.ts
40
64
  var import_node_fs6 = require("fs");
41
65
  var import_node_path6 = __toESM(require("path"));
42
66
 
43
67
  // src/util.ts
44
- var import_build_utils = require("@vercel/build-utils");
68
+ var import_build_utils2 = require("@vercel/build-utils");
45
69
  var import_node_child_process = require("child_process");
46
70
  var import_node_crypto = require("crypto");
47
71
  var import_node_fs = require("fs");
48
72
  var import_node_os = require("os");
49
73
  var import_node_path = require("path");
50
- var DEBUG = Boolean((0, import_build_utils.getPlatformEnv)("BUILDER_DEBUG"));
74
+ var DEBUG = Boolean((0, import_build_utils2.getPlatformEnv)("BUILDER_DEBUG"));
51
75
  function write(line) {
52
76
  process.stderr.write(`${line}
53
77
  `);
@@ -1454,7 +1478,7 @@ async function startContainer(options, reuseKey) {
1454
1478
  }
1455
1479
 
1456
1480
  // src/prepare-cache.ts
1457
- var import_build_utils2 = require("@vercel/build-utils");
1481
+ var import_build_utils3 = require("@vercel/build-utils");
1458
1482
  var import_node_fs5 = require("fs");
1459
1483
  var import_node_path5 = require("path");
1460
1484
  var CACHE_ROOT = "/vercel";
@@ -1473,7 +1497,7 @@ async function prepareCache(_options) {
1473
1497
  return {};
1474
1498
  }
1475
1499
  const start = Date.now();
1476
- const files = await (0, import_build_utils2.glob)(`${GRAPH_ROOT_REL}/**`, CACHE_ROOT);
1500
+ const files = await (0, import_build_utils3.glob)(`${GRAPH_ROOT_REL}/**`, CACHE_ROOT);
1477
1501
  const count = Object.keys(files).length;
1478
1502
  info(
1479
1503
  `cached container layer store: ${count} files from ${BUILDAH_GRAPH_ROOT} in ${Date.now() - start}ms`
@@ -1734,11 +1758,16 @@ async function build(options) {
1734
1758
  { "service.name": options.service?.name },
1735
1759
  (span) => resolveImageHandler(options, span)
1736
1760
  );
1737
- const lambdaOptions = await (0, import_build_utils3.getLambdaOptionsFromFunction)({
1761
+ const lambdaOptions = await (0, import_build_utils4.getLambdaOptionsFromFunction)({
1738
1762
  sourceFile: resolveFunctionSourceFile(options),
1739
1763
  config: options.config
1740
1764
  });
1741
1765
  const command = normalizeCommand2(options.config.command);
1766
+ await generateProjectManifest({
1767
+ workPath: options.workPath,
1768
+ framework: options.config.framework ?? void 0,
1769
+ serviceType: options.service ? (0, import_build_utils4.getReportedServiceType)(options.service) : void 0
1770
+ });
1742
1771
  const routes = [
1743
1772
  { handle: "filesystem" },
1744
1773
  { src: "/(.*)", dest: "/index" }
@@ -1764,6 +1793,7 @@ async function build(options) {
1764
1793
  // Annotate the CommonJS export names for ESM import in node:
1765
1794
  0 && (module.exports = {
1766
1795
  build,
1796
+ diagnostics,
1767
1797
  prepareCache,
1768
1798
  startDevServer,
1769
1799
  version
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/container",
3
- "version": "0.0.5",
3
+ "version": "0.1.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.js",
6
6
  "homepage": "https://vercel.com/docs",
@@ -15,7 +15,7 @@
15
15
  "devDependencies": {
16
16
  "@types/node": "20.11.0",
17
17
  "vitest": "2.0.3",
18
- "@vercel/build-utils": "13.32.3"
18
+ "@vercel/build-utils": "13.35.0"
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",
27
- "vitest-unit": "glob --absolute 'test/unit.test.ts'"
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'"
28
28
  }
29
29
  }