New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

serverless-esbuild

Package Overview
Dependencies
Maintainers
1
Versions
131
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serverless-esbuild - npm Package Compare versions

Comparing version

to
1.19.0

dist/packagers/pnpm.js

20

dist/index.js

@@ -17,2 +17,3 @@ "use strict";

const path = require("path");
const pMap = require("p-map");
const ramda_1 = require("ramda");

@@ -171,11 +172,16 @@ const chokidar = require("chokidar");

bundle(incremental = false) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
this.prepare();
this.serverless.cli.log(`Compiling to ${this.buildOptions.target} bundle with esbuild...`);
return Promise.all(this.rootFileNames.map(({ entry, func, functionAlias }) => __awaiter(this, void 0, void 0, function* () {
const bundleMapper = (bundleInfo) => __awaiter(this, void 0, void 0, function* () {
const { entry, func, functionAlias } = bundleInfo;
const config = Object.assign(Object.assign({}, this.buildOptions), { external: [
...this.buildOptions.external,
...(this.buildOptions.exclude === '*' || this.buildOptions.exclude.includes('*') ? [] : this.buildOptions.exclude)
...(this.buildOptions.exclude === '*' || this.buildOptions.exclude.includes('*')
? []
: this.buildOptions.exclude),
], entryPoints: [entry], outdir: path.join(this.buildDirPath, path.dirname(entry)), platform: 'node', incremental, plugins: this.plugins });
// esbuild v0.7.0 introduced config options validation, so I have to delete plugin specific options from esbuild config.
delete config['concurrency'];
delete config['exclude'];

@@ -199,7 +205,9 @@ delete config['nativeZip'];

return { result, bundlePath, func, functionAlias };
}))).then((results) => {
this.serverless.cli.log('Compiling completed.');
this.buildResults = results;
return results.map((r) => r.result);
});
this.serverless.cli.log(`Compiling with concurrency: ${(_a = this.buildOptions.concurrency) !== null && _a !== void 0 ? _a : 'Infinity'}`);
this.buildResults = yield pMap(this.rootFileNames, bundleMapper, {
concurrency: this.buildOptions.concurrency,
});
this.serverless.cli.log('Compiling completed.');
return this.buildResults.map((r) => r.result);
});

@@ -206,0 +214,0 @@ }

@@ -47,3 +47,3 @@ "use strict";

}
const excludedFilesDefault = ['package-lock.json', 'yarn.lock', 'package.json'];
const excludedFilesDefault = ['package-lock.json', 'pnpm-lock.yaml', 'yarn.lock', 'package.json'];
function pack() {

@@ -50,0 +50,0 @@ var _a, _b, _c, _d, _e, _f, _g, _h, _j;

@@ -23,6 +23,8 @@ "use strict";

const npm_1 = require("./npm");
const pnpm_1 = require("./pnpm");
const yarn_1 = require("./yarn");
const registeredPackagers = {
npm: new npm_1.NPM(),
yarn: new yarn_1.Yarn()
pnpm: new pnpm_1.Pnpm(),
yarn: new yarn_1.Yarn(),
};

@@ -29,0 +31,0 @@ /**

{
"name": "serverless-esbuild",
"description": "Serverless plugin for zero-config JavaScript and TypeScript code bundling using extremely fast esbuild",
"version": "1.18.3",
"version": "1.19.0",
"license": "MIT",

@@ -20,3 +20,4 @@ "author": "Victor Korzunin",

"test": "jest --passWithNoTests",
"lint": "eslint ."
"lint": "eslint .",
"prepare": "husky install"
},

@@ -44,4 +45,4 @@ "repository": {

"devDependencies": {
"@commitlint/cli": "^9.1.1",
"@commitlint/config-conventional": "^9.1.1",
"@commitlint/cli": "^13.2.0",
"@commitlint/config-conventional": "^13.2.0",
"@types/archiver": "^5.1.1",

@@ -56,3 +57,3 @@ "@types/fs-extra": "^9.0.1",

"eslint": "^7.9.0",
"husky": "^4.2.5",
"husky": "^7.0.2",
"jest": "^26.4.2",

@@ -73,2 +74,3 @@ "lint-staged": "^11.1.2",

"globby": "^11.0.1",
"p-map": "^4.0.0",
"ramda": "^0.27.0",

@@ -75,0 +77,0 @@ "string.prototype.matchall": "^4.0.4"

@@ -27,2 +27,4 @@ # 💨 serverless-esbuild

npm install -D serverless-esbuild
# or
pnpm install -D serverless-esbuild
```

@@ -66,5 +68,5 @@

esbuild:
packager: yarn # optional - npm or yarn, default is npm
packager: yarn # optional - npm, pnpm or yarn, default is npm
packagePath: absolute/path/to/package.json # optional - by default it looks for a package.json in the working directory
packagerOptions: # optional - packager related options, currently supports only 'scripts' for both npm and yarn
packagerOptions: # optional - packager related options, currently supports only 'scripts' for both npm, pnpm and yarn
scripts: # scripts to be executed, can be a string or array of strings

@@ -132,2 +134,14 @@ - echo 'Hello World!'

### Concurrency
If you wish to limit the concurrency of the bundling process (can be very expensive on memory), set the `concurrency` option:
```yml
custom:
esbuild:
concurrency: 10
```
**NOTE:*** This will produce slower builds.
## Usage

@@ -214,6 +228,6 @@

- `packager`: Package to use (npm or yarn - npm is default)
- `packager`: Package to use (npm, pnpm or yarn - npm is default)
- `packagePath`: Path to the `package.json` file (`./package.json` is default)
- `packagerOptions`:
- `scripts`: A string or array of scripts to be executed, currently only supports 'scripts' for npm and yarn
- `scripts`: A string or array of scripts to be executed, currently only supports 'scripts' for npm, pnpm and yarn
- `exclude`: An array of dependencies to exclude (declares it as an external as well as excludes it from Lambda ZIP file)

@@ -220,0 +234,0 @@