serverless-offline 13.1.2 → 13.2.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.
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": "13.
|
|
4
|
+
"version": "13.2.0",
|
|
5
5
|
"description": "Emulate AWS λ and API Gateway locally when developing your Serverless project",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"exports": {
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
]
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
|
-
"@aws-sdk/client-lambda": "^3.
|
|
82
|
+
"@aws-sdk/client-lambda": "^3.423.0",
|
|
83
83
|
"@hapi/boom": "^10.0.1",
|
|
84
84
|
"@hapi/h2o2": "^10.0.4",
|
|
85
85
|
"@hapi/hapi": "^21.3.2",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"fs-extra": "^11.1.1",
|
|
93
93
|
"is-wsl": "^3.1.0",
|
|
94
94
|
"java-invoke-local": "0.0.6",
|
|
95
|
-
"jose": "^4.
|
|
95
|
+
"jose": "^4.15.1",
|
|
96
96
|
"js-string-escape": "^1.0.1",
|
|
97
97
|
"jsonpath-plus": "^7.2.0",
|
|
98
98
|
"jsonschema": "^1.4.1",
|
|
@@ -2,7 +2,7 @@ import { readFile, writeFile } from 'node:fs/promises'
|
|
|
2
2
|
import { dirname, join, resolve } from 'node:path'
|
|
3
3
|
import process from 'node:process'
|
|
4
4
|
import { performance } from 'node:perf_hooks'
|
|
5
|
-
import {
|
|
5
|
+
import { setTimeout } from 'node:timers/promises'
|
|
6
6
|
import { log } from '@serverless/utils/log.js'
|
|
7
7
|
import { emptyDir, ensureDir, remove } from 'fs-extra'
|
|
8
8
|
import jszip from 'jszip'
|
|
@@ -20,8 +20,6 @@ import { createUniqueId } from '../utils/index.js'
|
|
|
20
20
|
const { ceil } = Math
|
|
21
21
|
const { entries, fromEntries } = Object
|
|
22
22
|
|
|
23
|
-
const setTimeoutPromise = promisify(setTimeout)
|
|
24
|
-
|
|
25
23
|
export default class LambdaFunction {
|
|
26
24
|
#artifact = null
|
|
27
25
|
|
|
@@ -278,7 +276,7 @@ export default class LambdaFunction {
|
|
|
278
276
|
}
|
|
279
277
|
|
|
280
278
|
async #timeoutAndTerminate() {
|
|
281
|
-
await
|
|
279
|
+
await setTimeout(this.#timeout)
|
|
282
280
|
|
|
283
281
|
throw new LambdaTimeoutError('[504] - Lambda timeout.')
|
|
284
282
|
}
|
|
@@ -37,6 +37,22 @@ export default class GoRunner {
|
|
|
37
37
|
// refresh go.mod
|
|
38
38
|
await rm(this.#tmpFile)
|
|
39
39
|
await execa('go', ['mod', 'tidy'])
|
|
40
|
+
|
|
41
|
+
if (this.workspace && this.#tmpPath) {
|
|
42
|
+
const workPath = `${this.#codeDir}/go.work`
|
|
43
|
+
const workFile = await readFile(workPath, 'utf8')
|
|
44
|
+
|
|
45
|
+
const out = workFile.replace(this.#tmpPath, '')
|
|
46
|
+
|
|
47
|
+
try {
|
|
48
|
+
await writeFile(workPath, out, 'utf8')
|
|
49
|
+
} catch {
|
|
50
|
+
// @ignore
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
await execa('go', ['work', 'sync'])
|
|
54
|
+
}
|
|
55
|
+
|
|
40
56
|
await rmdir(this.#tmpPath, {
|
|
41
57
|
recursive: true,
|
|
42
58
|
})
|
|
@@ -125,6 +141,14 @@ export default class GoRunner {
|
|
|
125
141
|
try {
|
|
126
142
|
chdir(cwdPath.substring(0, cwdPath.indexOf('main.go')))
|
|
127
143
|
|
|
144
|
+
if (this.workspace) {
|
|
145
|
+
/**
|
|
146
|
+
* We need to initialize the module, as in the case of a workspace it will not already exist
|
|
147
|
+
*/
|
|
148
|
+
await execa('go', ['mod', 'init', 'tmp'])
|
|
149
|
+
await execa('go', ['work', 'use', this.#tmpPath])
|
|
150
|
+
}
|
|
151
|
+
|
|
128
152
|
// Make sure we have the mock-lambda runner
|
|
129
153
|
await execa('go', [
|
|
130
154
|
'get',
|
|
@@ -171,4 +195,8 @@ export default class GoRunner {
|
|
|
171
195
|
|
|
172
196
|
return this.#parsePayload(stdout)
|
|
173
197
|
}
|
|
198
|
+
|
|
199
|
+
get workspace() {
|
|
200
|
+
return this.#goEnv.GOWORK && this.#goEnv.GOWORK.length > 0
|
|
201
|
+
}
|
|
174
202
|
}
|