@vercel/go 3.7.0 → 3.7.1

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.
@@ -0,0 +1,3 @@
1
+ module vc-init
2
+
3
+ go 1.23
package/dist/index.js CHANGED
@@ -3566,8 +3566,8 @@ var require_graceful_fs = __commonJS({
3566
3566
  }
3567
3567
  }
3568
3568
  var fs$writeFile = fs3.writeFile;
3569
- fs3.writeFile = writeFile3;
3570
- function writeFile3(path, data, options, cb) {
3569
+ fs3.writeFile = writeFile2;
3570
+ function writeFile2(path, data, options, cb) {
3571
3571
  if (typeof options === "function")
3572
3572
  cb = options, options = null;
3573
3573
  return go$writeFile(path, data, options, cb);
@@ -5343,7 +5343,7 @@ var require_jsonfile = __commonJS({
5343
5343
  var str = JSON.stringify(obj, options ? options.replacer : null, spaces);
5344
5344
  return str.replace(/\n/g, EOL) + EOL;
5345
5345
  }
5346
- function writeFile3(file, obj, options, callback) {
5346
+ function writeFile2(file, obj, options, callback) {
5347
5347
  if (callback == null) {
5348
5348
  callback = options;
5349
5349
  options = {};
@@ -5375,7 +5375,7 @@ var require_jsonfile = __commonJS({
5375
5375
  var jsonfile = {
5376
5376
  readFile: readFile4,
5377
5377
  readFileSync,
5378
- writeFile: writeFile3,
5378
+ writeFile: writeFile2,
5379
5379
  writeFileSync
5380
5380
  };
5381
5381
  module2.exports = jsonfile;
@@ -14273,6 +14273,7 @@ var GoWrapper = class {
14273
14273
  const subprocess = (0, import_execa.default)("go", args, {
14274
14274
  ...opts,
14275
14275
  env,
14276
+ extendEnv: false,
14276
14277
  stdio: captureAndForwardOutput ? "pipe" : opts.stdio
14277
14278
  });
14278
14279
  if (captureAndForwardOutput) {
@@ -14326,7 +14327,7 @@ async function createGo({
14326
14327
  goPreferredVersion = await parseGoModVersionFromModule(modulePath);
14327
14328
  }
14328
14329
  const goSelectedVersion = goPreferredVersion ? goPreferredVersion.toolchain || goPreferredVersion.go : Array.from(versionMap.values())[0];
14329
- const env = (0, import_build_utils.cloneEnv)(process.env, opts.env);
14330
+ const env = opts.env ? (0, import_build_utils.cloneEnv)(opts.env) : (0, import_build_utils.cloneEnv)(process.env);
14330
14331
  const { PATH } = env;
14331
14332
  const { platform } = process;
14332
14333
  const goGlobalCacheDir = (0, import_path4.join)(
@@ -14395,7 +14396,10 @@ async function createGo({
14395
14396
  }
14396
14397
  env.GOROOT = goDir || void 0;
14397
14398
  env.PATH = goBinDir || PATH;
14398
- const { stdout } = await (0, import_execa.default)("go", ["version"], { env });
14399
+ const { stdout } = await (0, import_execa.default)("go", ["version"], {
14400
+ env,
14401
+ extendEnv: false
14402
+ });
14399
14403
  const { major, minor, short, version: version2 } = parseGoVersionString(stdout);
14400
14404
  if (major < GO_MIN_MAJOR_VERSION || major === GO_MIN_MAJOR_VERSION && minor < GO_MIN_MINOR_VERSION) {
14401
14405
  (0, import_build_utils.debug)(`Found go ${version2} in ${label}, but version is unsupported`);
@@ -14626,19 +14630,28 @@ async function buildStandaloneServer({
14626
14630
  console.error(`Failed to build standalone Go server: ${buildTarget}`);
14627
14631
  throw err;
14628
14632
  }
14629
- const bootstrapSrc = (0, import_path6.join)(__dirname, "../vc-init.go");
14630
- const utilsSrc = (0, import_path6.join)(__dirname, "../vc-utils.go");
14633
+ const bootstrapDir = (0, import_path6.join)(__dirname, "../bootstrap");
14634
+ const bootstrapSrc = (0, import_path6.join)(bootstrapDir, "vc-init.go");
14635
+ const utilsSrc = (0, import_path6.join)(bootstrapDir, "vc-utils.go");
14636
+ const bootstrapGoModSrc = (0, import_path6.join)(bootstrapDir, "go.mod");
14631
14637
  (0, import_build_utils3.debug)(`Building bootstrap wrapper: ${bootstrapSrc} -> ${bootstrapPath}`);
14632
14638
  try {
14633
14639
  const bootstrapBuildDir = await (0, import_build_utils3.getWriteableDirectory)();
14634
14640
  const bootstrapGoFile = (0, import_path6.join)(bootstrapBuildDir, "main.go");
14635
14641
  await (0, import_fs_extra3.copy)(bootstrapSrc, bootstrapGoFile);
14636
14642
  await (0, import_fs_extra3.copy)(utilsSrc, (0, import_path6.join)(bootstrapBuildDir, "vc-utils.go"));
14637
- const bootstrapGoMod = (0, import_path6.join)(bootstrapBuildDir, "go.mod");
14638
- await (0, import_fs_extra3.writeFile)(bootstrapGoMod, "module vc-init\n\ngo 1.21\n");
14643
+ await (0, import_fs_extra3.copy)(bootstrapGoModSrc, (0, import_path6.join)(bootstrapBuildDir, "go.mod"));
14644
+ const bootstrapEnv = {
14645
+ PATH: process.env.PATH || "",
14646
+ HOME: process.env.HOME || "",
14647
+ TMPDIR: process.env.TMPDIR || "",
14648
+ GOARCH: architecture === "arm64" ? "arm64" : "amd64",
14649
+ GOOS: "linux",
14650
+ CGO_ENABLED: "0"
14651
+ };
14639
14652
  const bootstrapGo = await createGo({
14640
14653
  modulePath: bootstrapBuildDir,
14641
- opts: { cwd: bootstrapBuildDir, env },
14654
+ opts: { cwd: bootstrapBuildDir, env: bootstrapEnv },
14642
14655
  workPath: bootstrapBuildDir
14643
14656
  });
14644
14657
  await bootstrapGo.build(".", bootstrapPath);
@@ -14684,8 +14697,8 @@ async function startStandaloneDevServer(opts, resolvedEntrypoint) {
14684
14697
  PORT: String(port)
14685
14698
  });
14686
14699
  const runTarget = resolvedEntrypoint === "main.go" ? "." : "./" + (0, import_path6.dirname)(resolvedEntrypoint);
14687
- const devWrapper = (0, import_path6.join)(__dirname, "../vc-init-dev.go");
14688
- const devUtils = (0, import_path6.join)(__dirname, "../vc-utils.go");
14700
+ const devWrapper = (0, import_path6.join)(__dirname, "../bootstrap/vc-init-dev.go");
14701
+ const devUtils = (0, import_path6.join)(__dirname, "../bootstrap/vc-utils.go");
14689
14702
  (0, import_build_utils3.debug)(
14690
14703
  `Starting standalone Go dev server wrapper: go run ${devWrapper} (target ${runTarget}, port ${port})`
14691
14704
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/go",
3
- "version": "3.7.0",
3
+ "version": "3.7.1",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/go",
@@ -11,7 +11,8 @@
11
11
  },
12
12
  "files": [
13
13
  "dist",
14
- "*.go"
14
+ "*.go",
15
+ "bootstrap"
15
16
  ],
16
17
  "devDependencies": {
17
18
  "@tootallnate/once": "1.1.2",
@@ -30,7 +31,7 @@
30
31
  "vitest": "2.0.3",
31
32
  "xdg-app-paths": "5.1.0",
32
33
  "yauzl-promise": "2.1.3",
33
- "@vercel/build-utils": "13.25.0"
34
+ "@vercel/build-utils": "13.26.0"
34
35
  },
35
36
  "scripts": {
36
37
  "build": "node ../../utils/build-builder.mjs",
File without changes
File without changes
File without changes