@vercel/python 6.5.1 → 6.6.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 -36
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -2822,10 +2822,17 @@ var UvRunner = class {
2822
2822
  `Failed to parse 'uv python list' output: ${err instanceof Error ? err.message : String(err)}`
2823
2823
  );
2824
2824
  }
2825
- return new Set(
2826
- pyList.filter(
2825
+ if (process.env.VERCEL_BUILD_IMAGE) {
2826
+ pyList = pyList.filter(
2827
2827
  (entry) => entry.path !== null && entry.path.startsWith(UV_PYTHON_PATH_PREFIX) && entry.implementation === "cpython"
2828
- ).map(
2828
+ );
2829
+ } else {
2830
+ pyList = pyList.filter(
2831
+ (entry) => entry.path !== null && entry.implementation === "cpython"
2832
+ );
2833
+ }
2834
+ return new Set(
2835
+ pyList.map(
2829
2836
  (entry) => `${entry.version_parts.major}.${entry.version_parts.minor}`
2830
2837
  )
2831
2838
  );
@@ -3977,6 +3984,20 @@ var ANSI_ESCAPE_RE = new RegExp(ANSI_PATTERN, "g");
3977
3984
  var stripAnsi = (s) => s.replace(ANSI_ESCAPE_RE, "");
3978
3985
  var ASGI_SHIM_MODULE = "vc_init_dev_asgi";
3979
3986
  var WSGI_SHIM_MODULE = "vc_init_dev_wsgi";
3987
+ function createLogListener(callback, stream) {
3988
+ return (buf) => {
3989
+ if (callback) {
3990
+ callback(buf);
3991
+ } else {
3992
+ const s = buf.toString();
3993
+ for (const line of s.split(/\r?\n/)) {
3994
+ if (line) {
3995
+ stream.write(line.endsWith("\n") ? line : line + "\n");
3996
+ }
3997
+ }
3998
+ }
3999
+ };
4000
+ }
3980
4001
  var PERSISTENT_SERVERS = /* @__PURE__ */ new Map();
3981
4002
  var PENDING_STARTS = /* @__PURE__ */ new Map();
3982
4003
  var restoreWarnings = null;
@@ -4053,7 +4074,14 @@ function createDevWsgiShim(workPath, modulePath) {
4053
4074
  }
4054
4075
  }
4055
4076
  var startDevServer = async (opts) => {
4056
- const { entrypoint: rawEntrypoint, workPath, meta = {}, config } = opts;
4077
+ const {
4078
+ entrypoint: rawEntrypoint,
4079
+ workPath,
4080
+ meta = {},
4081
+ config,
4082
+ onStdout,
4083
+ onStderr
4084
+ } = opts;
4057
4085
  const framework = config?.framework;
4058
4086
  if (framework !== "fastapi" && framework !== "flask") {
4059
4087
  return null;
@@ -4161,22 +4189,8 @@ If you are using a virtual environment, activate it before running "vercel dev",
4161
4189
  stdio: ["inherit", "pipe", "pipe"]
4162
4190
  });
4163
4191
  childProcess = child;
4164
- stdoutLogListener = (buf) => {
4165
- const s = buf.toString();
4166
- for (const line of s.split(/\r?\n/)) {
4167
- if (line) {
4168
- process.stdout.write(line.endsWith("\n") ? line : line + "\n");
4169
- }
4170
- }
4171
- };
4172
- stderrLogListener = (buf) => {
4173
- const s = buf.toString();
4174
- for (const line of s.split(/\r?\n/)) {
4175
- if (line) {
4176
- process.stderr.write(line.endsWith("\n") ? line : line + "\n");
4177
- }
4178
- }
4179
- };
4192
+ stdoutLogListener = createLogListener(onStdout, process.stdout);
4193
+ stderrLogListener = createLogListener(onStderr, process.stderr);
4180
4194
  child.stdout?.on("data", stdoutLogListener);
4181
4195
  child.stderr?.on("data", stderrLogListener);
4182
4196
  const readinessRegexes = [
@@ -4239,22 +4253,8 @@ If you are using a virtual environment, activate it before running "vercel dev",
4239
4253
  stdio: ["inherit", "pipe", "pipe"]
4240
4254
  });
4241
4255
  childProcess = child;
4242
- stdoutLogListener = (buf) => {
4243
- const s = buf.toString();
4244
- for (const line of s.split(/\r?\n/)) {
4245
- if (line) {
4246
- process.stdout.write(line.endsWith("\n") ? line : line + "\n");
4247
- }
4248
- }
4249
- };
4250
- stderrLogListener = (buf) => {
4251
- const s = buf.toString();
4252
- for (const line of s.split(/\r?\n/)) {
4253
- if (line) {
4254
- process.stderr.write(line.endsWith("\n") ? line : line + "\n");
4255
- }
4256
- }
4257
- };
4256
+ stdoutLogListener = createLogListener(onStdout, process.stdout);
4257
+ stderrLogListener = createLogListener(onStderr, process.stderr);
4258
4258
  child.stdout?.on("data", stdoutLogListener);
4259
4259
  child.stderr?.on("data", stderrLogListener);
4260
4260
  const readinessRegexes = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/python",
3
- "version": "6.5.1",
3
+ "version": "6.6.0",
4
4
  "main": "./dist/index.js",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/python",
@@ -31,7 +31,7 @@
31
31
  "smol-toml": "1.5.2",
32
32
  "vitest": "2.1.4",
33
33
  "which": "3.0.0",
34
- "@vercel/build-utils": "13.2.17",
34
+ "@vercel/build-utils": "13.3.0",
35
35
  "@vercel/error-utils": "2.0.3"
36
36
  },
37
37
  "scripts": {