serverless-offline 9.2.3 → 9.2.4

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.
package/README.md CHANGED
@@ -137,7 +137,7 @@ All CLI options are optional:
137
137
  --printOutput Turns on logging of your lambda outputs in the terminal.
138
138
  --reloadHandler Reloads handler with each request.
139
139
  --resourceRoutes Turns on loading of your HTTP proxy settings from serverless.yml
140
- --useChildProcesses Run handlers in a child process
140
+ --useChildProcesses [This option is deprecated] Run handlers in a child process.
141
141
  --useDocker Run handlers in a docker container.
142
142
  --useInProcess Run handlers in the same process as 'serverless-offline'.
143
143
  --webSocketHardTimeout Set WebSocket hard timeout in seconds to reproduce AWS limits (https://docs.aws.amazon.com/apigateway/latest/developerguide/limits.html#apigateway-execution-service-websocket-limits-table). Default: 7200 (2 hours)
@@ -188,7 +188,7 @@ Lambda handlers for the `node.js` runtime can run in different execution modes w
188
188
  - global state is being shared across lambda handlers as well as with `serverless` and `serverless-offline`
189
189
  - easy debugging
190
190
 
191
- #### child-processes
191
+ #### child-processes (this option is deprecated, please use the default worker-threads instead)
192
192
 
193
193
  - handlers run in a separate node.js instance
194
194
  - memory is not being shared between handlers, memory consumption is therefore higher
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "dedicatedTo": "Blue, a great migrating bird.",
3
3
  "name": "serverless-offline",
4
- "version": "9.2.3",
4
+ "version": "9.2.4",
5
5
  "description": "Emulate AWS λ and API Gateway locally when developing your Serverless project",
6
6
  "license": "MIT",
7
7
  "main": "./src/index.js",
@@ -1,12 +1,12 @@
1
1
  import process, { exit } from 'node:process'
2
2
  import { log } from '@serverless/utils/log.js'
3
- import chalk from 'chalk'
4
3
  import {
5
4
  commandOptions,
6
5
  CUSTOM_OPTION,
7
6
  defaultOptions,
8
7
  SERVER_SHUTDOWN_TIMEOUT,
9
8
  } from './config/index.js'
9
+ import { gray, orange } from './config/colors.js'
10
10
 
11
11
  export default class ServerlessOffline {
12
12
  #cliOptions = null
@@ -225,6 +225,14 @@ export default class ServerlessOffline {
225
225
  ...this.#cliOptions,
226
226
  }
227
227
 
228
+ if (this.#options.useChildProcesses) {
229
+ log.notice()
230
+ log.warning(
231
+ orange(`'--useChildProcesses' is deprecated and will be removed in the next major version. Worker threads, the current default, should provide the same if not an even better developer experience.
232
+ If you are experiencing any issues please let us know: https://github.com/dherault/serverless-offline/issues`),
233
+ )
234
+ }
235
+
228
236
  // Parse CORS options
229
237
  this.#options.corsAllowHeaders = this.#options.corsAllowHeaders
230
238
  .replace(/\s/g, '')
@@ -247,7 +255,7 @@ export default class ServerlessOffline {
247
255
  log.notice(
248
256
  `Starting Offline at stage ${
249
257
  this.#options.stage || provider.stage
250
- } ${chalk.gray(`(${this.#options.region || provider.region})`)}`,
258
+ } ${gray(`(${this.#options.region || provider.region})`)}`,
251
259
  )
252
260
  log.notice()
253
261
  log.debug('options:', this.#options)
@@ -0,0 +1,10 @@
1
+ import chalk from 'chalk'
2
+
3
+ export const dodgerblue = chalk.hex('#1e90ff')
4
+ export const gray = chalk.hex('#808080')
5
+ export const lime = chalk.hex('#00ff00')
6
+ export const orange = chalk.hex('#ffa500')
7
+ export const peachpuff = chalk.hex('#ffdab9')
8
+ export const plum = chalk.hex('#dda0dd')
9
+ export const red = chalk.hex('#ff0000')
10
+ export const yellow = chalk.hex('#ffff00')
@@ -132,7 +132,8 @@ export default {
132
132
  },
133
133
  useChildProcesses: {
134
134
  type: 'boolean',
135
- usage: 'Use separate node process to run handlers',
135
+ usage:
136
+ '[This option is deprecated] Use separate node process to run handlers.',
136
137
  },
137
138
  useDocker: {
138
139
  type: 'boolean',
@@ -1,17 +1,17 @@
1
1
  import boxen from 'boxen'
2
- import chalk from 'chalk'
2
+ import {
3
+ dodgerblue,
4
+ gray,
5
+ lime,
6
+ orange,
7
+ peachpuff,
8
+ plum,
9
+ red,
10
+ yellow,
11
+ } from '../config/colors.js'
3
12
 
4
13
  const { max } = Math
5
14
 
6
- const dodgerblue = chalk.hex('#1e90ff')
7
- const grey = chalk.hex('#808080')
8
- const lime = chalk.hex('#00ff00')
9
- const orange = chalk.hex('#ffa500')
10
- const peachpuff = chalk.hex('#ffdab9')
11
- const plum = chalk.hex('#dda0dd')
12
- const red = chalk.hex('#ff0000')
13
- const yellow = chalk.hex('#ffff00')
14
-
15
15
  const colorMethodMapping = new Map([
16
16
  ['DELETE', red],
17
17
  ['GET', dodgerblue],
@@ -28,9 +28,9 @@ function logRoute(method, server, path, maxLength, dimPath = false) {
28
28
  const methodColor = colorMethodMapping.get(method) ?? peachpuff
29
29
  const methodFormatted = method.padEnd(maxLength, ' ')
30
30
 
31
- return `${methodColor(methodFormatted)} ${yellow.dim('|')} ${grey.dim(
31
+ return `${methodColor(methodFormatted)} ${yellow.dim('|')} ${gray.dim(
32
32
  server,
33
- )}${dimPath ? grey.dim(path) : lime(path)}`
33
+ )}${dimPath ? gray.dim(path) : lime(path)}`
34
34
  }
35
35
 
36
36
  function getMaxHttpMethodNameLength(routeInfo) {
@@ -51,7 +51,7 @@ export default function logRoutes(routeInfo) {
51
51
  boxen(
52
52
  routeInfo
53
53
  .map(
54
- ({ method, path, server, invokePath }) =>
54
+ ({ invokePath, method, path, server }) =>
55
55
  // eslint-disable-next-line prefer-template
56
56
  logRoute(method, server, path, maxLength) +
57
57
  '\n' +