serverless-offline 9.2.0 → 9.2.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.
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.0",
4
+ "version": "9.2.1",
5
5
  "description": "Emulate AWS λ and API Gateway locally when developing your Serverless project",
6
6
  "license": "MIT",
7
7
  "main": "./src/index.js",
@@ -195,7 +195,7 @@
195
195
  "@hapi/h2o2": "^9.1.0",
196
196
  "@hapi/hapi": "^20.2.2",
197
197
  "@serverless/utils": "^6.7.0",
198
- "aws-sdk": "^2.1187.0",
198
+ "aws-sdk": "^2.1194.0",
199
199
  "boxen": "^7.0.0",
200
200
  "chalk": "^5.0.1",
201
201
  "execa": "^6.1.0",
@@ -217,7 +217,7 @@
217
217
  },
218
218
  "devDependencies": {
219
219
  "archiver": "^5.3.1",
220
- "eslint": "^8.21.0",
220
+ "eslint": "^8.22.0",
221
221
  "eslint-config-airbnb-base": "^15.0.0",
222
222
  "eslint-config-prettier": "^8.5.0",
223
223
  "eslint-plugin-import": "^2.25.4",
@@ -245,9 +245,9 @@ export default class ServerlessOffline {
245
245
 
246
246
  log.notice()
247
247
  log.notice(
248
- `Starting Offline at stage ${provider.stage} ${chalk.gray(
249
- `(${provider.region})`,
250
- )}`,
248
+ `Starting Offline at stage ${
249
+ this.#options.stage || provider.stage
250
+ } ${chalk.gray(`(${this.#options.region || provider.region})`)}`,
251
251
  )
252
252
  log.notice()
253
253
  log.debug('options:', this.#options)
@@ -24,9 +24,7 @@ export default class HandlerRunner {
24
24
 
25
25
  async #loadRunner() {
26
26
  const { useChildProcesses, useDocker, useInProcess } = this.#options
27
-
28
- const { codeDir, functionKey, handler, runtime, servicePath, timeout } =
29
- this.#funOptions
27
+ const { handler, runtime } = this.#funOptions
30
28
 
31
29
  log.debug(`Loading handler... (${handler})`)
32
30
 
@@ -71,16 +69,7 @@ export default class HandlerRunner {
71
69
  './in-process-runner/index.js'
72
70
  )
73
71
 
74
- return new InProcessRunner(
75
- {
76
- codeDir,
77
- functionKey,
78
- handler,
79
- servicePath,
80
- timeout,
81
- },
82
- this.#env,
83
- )
72
+ return new InProcessRunner(this.#funOptions, this.#env)
84
73
  }
85
74
 
86
75
  const { default: WorkerThreadRunner } = await import(
@@ -17,6 +17,8 @@ export default class PythonRunner {
17
17
 
18
18
  #env = null
19
19
 
20
+ #handlerProcess = null
21
+
20
22
  #runtime = null
21
23
 
22
24
  constructor(funOptions, env) {
@@ -38,7 +40,7 @@ export default class PythonRunner {
38
40
 
39
41
  const [pythonExecutable] = this.#runtime.split('.')
40
42
 
41
- this.handlerProcess = spawn(
43
+ this.#handlerProcess = spawn(
42
44
  pythonExecutable,
43
45
  [
44
46
  '-u',
@@ -52,14 +54,14 @@ export default class PythonRunner {
52
54
  },
53
55
  )
54
56
 
55
- this.handlerProcess.stdout.readline = createInterface({
56
- input: this.handlerProcess.stdout,
57
+ this.#handlerProcess.stdout.readline = createInterface({
58
+ input: this.#handlerProcess.stdout,
57
59
  })
58
60
  }
59
61
 
60
62
  // () => void
61
63
  cleanup() {
62
- this.handlerProcess.kill()
64
+ this.#handlerProcess.kill()
63
65
  }
64
66
 
65
67
  #parsePayload(value) {
@@ -113,8 +115,8 @@ export default class PythonRunner {
113
115
  try {
114
116
  const parsed = this.#parsePayload(line.toString())
115
117
  if (parsed) {
116
- this.handlerProcess.stdout.readline.removeListener('line', onLine)
117
- this.handlerProcess.stderr.removeListener('data', onErr)
118
+ this.#handlerProcess.stdout.readline.removeListener('line', onLine)
119
+ this.#handlerProcess.stderr.removeListener('data', onErr)
118
120
  return accept(parsed)
119
121
  }
120
122
  return null
@@ -123,12 +125,12 @@ export default class PythonRunner {
123
125
  }
124
126
  }
125
127
 
126
- this.handlerProcess.stdout.readline.on('line', onLine)
127
- this.handlerProcess.stderr.on('data', onErr)
128
+ this.#handlerProcess.stdout.readline.on('line', onLine)
129
+ this.#handlerProcess.stderr.on('data', onErr)
128
130
 
129
131
  process.nextTick(() => {
130
- this.handlerProcess.stdin.write(input)
131
- this.handlerProcess.stdin.write('\n')
132
+ this.#handlerProcess.stdin.write(input)
133
+ this.#handlerProcess.stdin.write('\n')
132
134
  })
133
135
  })
134
136
  }