serverless-esbuild
Advanced tools
Comparing version 1.48.0 to 1.48.1
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -8,3 +31,2 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
const assert_1 = __importDefault(require("assert")); | ||
const esbuild_1 = require("esbuild"); | ||
const fs_extra_1 = __importDefault(require("fs-extra")); | ||
@@ -85,4 +107,11 @@ const p_map_1 = __importDefault(require("p-map")); | ||
}; | ||
let context; | ||
const result = await (0, esbuild_1.build)(options); | ||
const pkg = await Promise.resolve().then(() => __importStar(require('esbuild'))); | ||
const context = await pkg.context(options); | ||
let result; | ||
if (context) { | ||
result = await context.rebuild(); | ||
} | ||
else { | ||
result = await pkg.build(options); | ||
} | ||
if (config.metafile) { | ||
@@ -89,0 +118,0 @@ fs_extra_1.default.writeFileSync(path_1.default.join(buildDirPath, `${(0, utils_1.trimExtension)(entry)}-meta.json`), JSON.stringify(result.metafile, null, 2)); |
@@ -64,2 +64,3 @@ import type Serverless from 'serverless'; | ||
moveArtifacts(): Promise<void>; | ||
disposeContexts(): Promise<void>; | ||
cleanup(): Promise<void>; | ||
@@ -66,0 +67,0 @@ } |
@@ -98,2 +98,3 @@ "use strict"; | ||
this.log.verbose('after:package:createDeploymentArtifacts'); | ||
await this.disposeContexts(); | ||
await this.cleanup(); | ||
@@ -110,2 +111,3 @@ }, | ||
this.log.verbose('after:deploy:function:packageFunction'); | ||
await this.disposeContexts(); | ||
await this.cleanup(); | ||
@@ -120,2 +122,5 @@ }, | ||
}, | ||
'after:invoke:local:invoke': async () => { | ||
await this.disposeContexts(); | ||
}, | ||
}; | ||
@@ -371,2 +376,9 @@ } | ||
} | ||
async disposeContexts() { | ||
for (const { context } of Object.values(this.buildCache)) { | ||
if (context) { | ||
await context.dispose(); | ||
} | ||
} | ||
} | ||
async cleanup() { | ||
@@ -373,0 +385,0 @@ await this.moveArtifacts(); |
{ | ||
"name": "serverless-esbuild", | ||
"version": "1.48.0", | ||
"version": "1.48.1", | ||
"description": "Serverless plugin for zero-config JavaScript and TypeScript code bundling using extremely fast esbuild", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -367,2 +367,6 @@ # 💨 serverless-esbuild | ||
</tr> | ||
<tr> | ||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/fm-sz"><img src="https://avatars.githubusercontent.com/u/119663527?v=4?s=70" width="70px;" alt="Florian Mayer"/><br /><sub><b>Florian Mayer</b></sub></a><br /><a href="https://github.com/floydspace/serverless-esbuild/commits?author=fm-sz" title="Code">💻</a></td> | ||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ZachLeviPixel"><img src="https://avatars.githubusercontent.com/u/131263652?v=4?s=70" width="70px;" alt="Zach Levi"/><br /><sub><b>Zach Levi</b></sub></a><br /><a href="https://github.com/floydspace/serverless-esbuild/commits?author=ZachLeviPixel" title="Code">💻</a></td> | ||
</tr> | ||
</tbody> | ||
@@ -369,0 +373,0 @@ </table> |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
244709
2615
380