@reboot-dev/reboot 0.25.6 → 0.26.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.
@@ -67,7 +67,7 @@ constexpr bool is_alias(void *) {
67
67
  }
68
68
 
69
69
  // Constructs and returns a new object; if the given arguments don't map to a constructor, we fall
70
- // back to brace aggregate initiailization so that for aggregate initialization can be used with
70
+ // back to brace aggregate initialization so that for aggregate initialization can be used with
71
71
  // py::init, e.g. `py::init<int, int>` to initialize a `struct T { int a; int b; }`. For
72
72
  // non-aggregate types, we need to use an ordinary T(...) constructor (invoking as `T{...}` usually
73
73
  // works, but will not do the expected thing when `T` has an `initializer_list<T>` constructor).
package/index.d.ts CHANGED
@@ -19,6 +19,7 @@ export declare class Reboot {
19
19
  stop(): Promise<void>;
20
20
  up(application: Application, options?: {
21
21
  localEnvoy?: boolean;
22
+ localEnvoyPort?: number;
22
23
  }): Promise<ApplicationRevision>;
23
24
  down(): Promise<void>;
24
25
  url(): string;
package/index.js CHANGED
@@ -91,7 +91,7 @@ export class Reboot {
91
91
  async up(application, options) {
92
92
  // TODO(benh): determine module and file name so that we can
93
93
  // namespace if we have more than one implementation of servicers.
94
- return await reboot_native.Reboot_up(__classPrivateFieldGet(this, _Reboot_external, "f"), application.__external, options?.localEnvoy);
94
+ return await reboot_native.Reboot_up(__classPrivateFieldGet(this, _Reboot_external, "f"), application.__external, options?.localEnvoy, options?.localEnvoyPort);
95
95
  }
96
96
  async down() {
97
97
  await reboot_native.Reboot_down(__classPrivateFieldGet(this, _Reboot_external, "f"));
@@ -511,7 +511,7 @@ export class Application {
511
511
  // so that developers see a stack trace of what is going
512
512
  // on.
513
513
  const error = ensureError(e);
514
- // Write an empy message which includes a newline to make
514
+ // Write an empty message which includes a newline to make
515
515
  // it easier to identify the stack trace.
516
516
  console.error("");
517
517
  console.error(error);
@@ -568,7 +568,7 @@ _Application_servicers = new WeakMap(), _Application_tokenVerifier = new WeakMap
568
568
  methods[method](path, ...handlers.map((handler) => {
569
569
  // Express allows for three different kinds of handlers, a
570
570
  // "normal" handler that takes two args, `req` and `res`, a
571
- // "middlware" handler that takes three args, `req, `res`,
571
+ // "middleware" handler that takes three args, `req`, `res`,
572
572
  // and `next`, and an "error" handler that takes four args
573
573
  // `err`, `req`, `res`, and `next`. To the best of our
574
574
  // understanding they determine what arguments to pass to
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "@bufbuild/protobuf": "1.3.2",
4
4
  "@bufbuild/protoplugin": "1.3.2",
5
5
  "@bufbuild/protoc-gen-es": "1.3.2",
6
- "@reboot-dev/reboot-api": "0.25.6",
6
+ "@reboot-dev/reboot-api": "0.26.0",
7
7
  "chalk": "^4.1.2",
8
8
  "node-addon-api": "^7.0.0",
9
9
  "node-gyp": ">=10.2.0",
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "type": "module",
18
18
  "name": "@reboot-dev/reboot",
19
- "version": "0.25.6",
19
+ "version": "0.26.0",
20
20
  "description": "npm package for Reboot",
21
21
  "scripts": {
22
22
  "postinstall": "rbt || exit 0",
package/rbt.js CHANGED
@@ -22,18 +22,25 @@ function addExtensionlessToNodeOptions() {
22
22
  process.env.NODE_OPTIONS =
23
23
  (process.env.NODE_OPTIONS && process.env.NODE_OPTIONS + " ") || "";
24
24
  // The `module.register()` function was added to Node.js in 20.6.0
25
- // for the main release line and 18.19.0 for the LTS release line.
25
+ // for the main release line.
26
26
  //
27
27
  // If we have one of those two versions then we can pre import
28
28
  // `extensionless/register` to use the `module.register()` function,
29
29
  // otherwise we need to fall back to `--experimental-loader`.
30
- if (major >= 21 || (major == 20 && minor >= 6)) {
30
+ //
31
+ // We've seen some issues related to the 'unknown file extension'
32
+ // error on Node.js <= 20.9, so now we require at least 20.10
33
+ // to use the `extensionless` loader.
34
+ // https://github.com/reboot-dev/mono/issues/4068#issuecomment-2929571313
35
+ // TODO: Revisit this, probably we would be able to drop that option
36
+ // at all.
37
+ if (major > 20 || (major === 20 && minor >= 10)) {
31
38
  process.env.NODE_OPTIONS += "--import=extensionless/register";
32
39
  }
33
40
  else {
34
41
  throw new Error(`The current version of Node.js is not supported.
35
42
  Supported versions are:
36
- * greater than or equal to 20.6`);
43
+ * greater than or equal to 20.10`);
37
44
  }
38
45
  }
39
46
  async function main() {
package/reboot_native.cc CHANGED
@@ -292,7 +292,7 @@ void PythonNodeAdaptor::Initialize(
292
292
  //
293
293
  // Don't try and manipulate signals when running within Node!
294
294
  setenv("REBOOT_SIGNALS_AVAILABLE", "false", 1);
295
- // Specify that we are runing from within `node`.
295
+ // Specify that we are running from within `node`.
296
296
  setenv("REBOOT_NODEJS", "true", 1);
297
297
 
298
298
  py::initialize_interpreter();
@@ -1666,6 +1666,11 @@ Napi::Value Reboot_up(const Napi::CallbackInfo& info) {
1666
1666
  local_envoy = info[2].As<Napi::Boolean>();
1667
1667
  }
1668
1668
 
1669
+ int local_envoy_port = 0;
1670
+ if (!info[3].IsUndefined()) {
1671
+ local_envoy_port = info[3].As<Napi::Number>().Int32Value();
1672
+ }
1673
+
1669
1674
  return NodePromiseFromPythonTask(
1670
1675
  info.Env(),
1671
1676
  "Reboot.up(...) in nodejs",
@@ -1674,7 +1679,8 @@ Napi::Value Reboot_up(const Napi::CallbackInfo& info) {
1674
1679
  py_reboot,
1675
1680
  js_external_application, // Ensures `py_application` remains valid.
1676
1681
  py_application,
1677
- local_envoy]() {
1682
+ local_envoy,
1683
+ local_envoy_port]() {
1678
1684
  return py_reboot->attr("up")(
1679
1685
  py_application,
1680
1686
  // NOTE: while we support subprocess consensuses
@@ -1683,7 +1689,8 @@ Napi::Value Reboot_up(const Napi::CallbackInfo& info) {
1683
1689
  // clone a process like we do with multiprocessing
1684
1690
  // in Python.
1685
1691
  "in_process"_a = true,
1686
- "local_envoy"_a = local_envoy);
1692
+ "local_envoy"_a = local_envoy,
1693
+ "local_envoy_port"_a = local_envoy_port);
1687
1694
  },
1688
1695
  [](py::object py_revision) {
1689
1696
  py::str py_application_id =
@@ -2148,7 +2155,7 @@ Napi::Value Application_constructor(const Napi::CallbackInfo& info) {
2148
2155
  [
2149
2156
  // Need a copy, because we will
2150
2157
  // create the 'ExternalContext' more
2151
- // than once, which means we wiil
2158
+ // than once, which means we will
2152
2159
  // call this function more than once
2153
2160
  // as well.
2154
2161
  js_from_native_external](
package/reboot_native.cjs CHANGED
@@ -14,10 +14,10 @@ if (os.platform() === "win32") {
14
14
 
15
15
  const [major, minor, patch] = process.versions.node.split(".").map(Number);
16
16
 
17
- if (major < 20) {
17
+ if (major < 20 || (major == 20 && minor < 10)) {
18
18
  console.error(
19
19
  chalk.stderr.bold.red(
20
- `Reboot requires nodejs version >=20 (found ${major}.${minor}.${patch})`
20
+ `Reboot requires nodejs version >=20.10 (found ${major}.${minor}.${patch})`
21
21
  )
22
22
  );
23
23
  process.exit(-1);
package/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const REBOOT_VERSION = "0.25.6";
1
+ export declare const REBOOT_VERSION = "0.26.0";
package/version.js CHANGED
@@ -1 +1 @@
1
- export const REBOOT_VERSION = "0.25.6";
1
+ export const REBOOT_VERSION = "0.26.0";