Skip to content

Commit

Permalink
Merge branch 'master' into release/5.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
j0k3r committed Nov 20, 2020
2 parents a7272f8 + 38135e4 commit 8a6bf7c
Show file tree
Hide file tree
Showing 29 changed files with 6,705 additions and 3,635 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

* 5.3.5
* Improve runtime validation [#629](https://github.com/serverless-heaven/serverless-webpack/pull/629)
* Move `ts-node` as optional dependency [#636](https://github.com/serverless-heaven/serverless-webpack/pull/636)
* Upgrade deps [#637](https://github.com/serverless-heaven/serverless-webpack/pull/637)

* 5.3.4
* Bump lodash from 4.17.15 to 4.17.19 [#597](https://github.com/serverless-heaven/serverless-webpack/pull/597)
* Bump lodash from 4.17.15 to 4.17.19 in /examples/typescript [#598](https://github.com/serverless-heaven/serverless-webpack/pull/598)
Expand Down
10 changes: 5 additions & 5 deletions examples/babel-multiple-statically-entries/first.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ export const hello = (event, context, cb) => {
const p = new Promise((resolve, reject) => {
resolve('success');
});
p
.then(r => cb(null, {
p.then(r =>
cb(null, {
message: 'Go Serverless Webpack (Babel) v1.0! First module!',
event,
}))
.catch(e => cb(e));
event
})
).catch(e => cb(e));
};
10 changes: 5 additions & 5 deletions examples/babel-multiple-statically-entries/second.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ export const hello = (event, context, cb) => {
const p = new Promise((resolve, reject) => {
resolve('success');
});
p
.then(r => cb(null, {
p.then(r =>
cb(null, {
message: 'Go Serverless Webpack (Babel) v1.0! Second module!',
event,
}))
.catch(e => cb(e));
event
})
).catch(e => cb(e));
};
4 changes: 2 additions & 2 deletions examples/babel-multiple-statically-entries/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
second: ['./second.js']
},
target: 'node',
mode: slsw.lib.webpack.isLocal ? 'development': 'production',
mode: slsw.lib.webpack.isLocal ? 'development' : 'production',
module: {
rules: [
{
Expand All @@ -18,7 +18,7 @@ module.exports = {
{
loader: 'babel-loader'
}
],
]
}
]
},
Expand Down
18 changes: 9 additions & 9 deletions examples/babel-webpack-4/handlers/first.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ export const hello = (event, context, cb) => {

// Do not return the promise as we use the callback
// This resolved promise would be be in the application library code in a real-world application and provide the results
App.handleFirst(event) // eslint-disable-line promise/catch-or-return
.then(result => ({
statusCode: 200,
headers: {
'Content-Type': 'application/json;charset=utf-8'
},
body: JSON.stringify(result)
}))
.asCallback(cb);
App.handleFirst(event) // eslint-disable-line promise/catch-or-return
.then(result => ({
statusCode: 200,
headers: {
'Content-Type': 'application/json;charset=utf-8'
},
body: JSON.stringify(result)
}))
.asCallback(cb);

return;
};
18 changes: 9 additions & 9 deletions examples/babel-webpack-4/handlers/second.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ export const hello = (event, context, cb) => {

// Do not return the promise as we use the callback
// This resolved promise would be be in the application library code in a real-world application and provide the results
App.handleSecond(event) // eslint-disable-line promise/catch-or-return
.then(result => ({
statusCode: 200,
headers: {
'Content-Type': 'application/json;charset=utf-8'
},
body: JSON.stringify(result)
}))
.asCallback(cb);
App.handleSecond(event) // eslint-disable-line promise/catch-or-return
.then(result => ({
statusCode: 200,
headers: {
'Content-Type': 'application/json;charset=utf-8'
},
body: JSON.stringify(result)
}))
.asCallback(cb);

return;
};
6 changes: 3 additions & 3 deletions examples/babel-webpack-4/lib/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class App {
from: 'First lambda ;-)',
event
};

return BbPromise.resolve(myDemoResult);
}

Expand All @@ -19,7 +19,7 @@ export class App {
from: 'Second lambda ;-)',
event
};

return BbPromise.resolve(myDemoResult);
}
}
}
4 changes: 2 additions & 2 deletions examples/babel-webpack-4/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const nodeExternals = require('webpack-node-externals');
module.exports = {
entry: slsw.lib.entries,
target: 'node',
mode: slsw.lib.webpack.isLocal ? 'development': 'production',
mode: slsw.lib.webpack.isLocal ? 'development' : 'production',
optimization: {
// We no not want to minimize our code.
minimize: false
Expand All @@ -25,7 +25,7 @@ module.exports = {
{
loader: 'babel-loader'
}
],
]
}
]
},
Expand Down
8 changes: 4 additions & 4 deletions examples/include-external-npm-packages/handler.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';

var AWS = require('aws-sdk');
var fbgraph = require('fbgraph');
const AWS = require('aws-sdk');
const fbgraph = require('fbgraph');

module.exports.hello = function (event, context, cb) {
cb(null, { message: 'hello fb & aws', event });
}
cb(null, { message: 'hello fb & aws', event });
};
2 changes: 1 addition & 1 deletion examples/include-external-npm-packages/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const nodeExternals = require('webpack-node-externals');

module.exports = {
entry: slsw.lib.entries,
mode: slsw.lib.webpack.isLocal ? 'development': 'production',
mode: slsw.lib.webpack.isLocal ? 'development' : 'production',
target: 'node',
externals: [nodeExternals()] // exclude external modules
};
33 changes: 13 additions & 20 deletions examples/include-external-npm-packages/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -725,9 +725,9 @@ bindings@^1.5.0:
file-uri-to-path "1.0.0"

bl@^4.0.1:
version "4.0.2"
resolved "https://registry.yarnpkg.com/bl/-/bl-4.0.2.tgz#52b71e9088515d0606d9dd9cc7aa48dc1f98e73a"
integrity sha512-j4OH8f6Qg2bGuWfRiltT2HYGx0e1QcBTrK9KAHNMwMZdQnDZFk0ZSYIpADjYCB3U12nicC5tVJwSIhwOWjb4RQ==
version "4.0.3"
resolved "https://registry.yarnpkg.com/bl/-/bl-4.0.3.tgz#12d6287adc29080e22a705e5764b2a9522cdc489"
integrity sha512-fs4G6/Hu4/EE+F75J8DuN/0IpQqNjAdC7aEQv7Qt8MHGUH7Ckv2MwTEEeN9QehD0pfIDkMI1bkHYkKy7xHyKIg==
dependencies:
buffer "^5.5.0"
inherits "^2.0.4"
Expand Down Expand Up @@ -1999,10 +1999,6 @@ [email protected]:
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=

inherits@^2.0.4:
version "2.0.4"
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"

ini@^1.3.5, ini@~1.3.0:
version "1.3.5"
resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927"
Expand Down Expand Up @@ -2504,10 +2500,6 @@ lodash.union@^4.6.0:
resolved "https://registry.yarnpkg.com/lodash.union/-/lodash.union-4.6.0.tgz#48bb5088409f16f1821666641c44dd1aaae3cd88"
integrity sha1-SLtQiECfFvGCFmZkHETdGqrjzYg=

lodash@^4.0.0, lodash@^4.14.0, lodash@^4.17.14, lodash@^4.17.15:
version "4.17.19"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b"

lodash@^4.17.14, lodash@^4.17.19:
version "4.17.19"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b"
Expand Down Expand Up @@ -2786,9 +2778,9 @@ neo-async@^2.5.0, neo-async@^2.6.1:
integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==

node-fetch@^2.6.0:
version "2.6.0"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd"
integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==
version "2.6.1"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052"
integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==

node-libs-browser@^2.2.1:
version "2.2.1"
Expand Down Expand Up @@ -3508,7 +3500,7 @@ serverless-offline@^6.5.0:
ws "^7.2.1"

"serverless-webpack@file:../..":
version "5.3.3"
version "5.3.4"
dependencies:
archiver "^3.0.3"
bluebird "^3.5.5"
Expand All @@ -3517,7 +3509,8 @@ serverless-offline@^6.5.0:
is-builtin-module "^3.0.0"
lodash "^4.17.19"
semver "^6.2.0"
ts-node "^8.3.0"
optionalDependencies:
ts-node ">= 8.3.0"

set-immediate-shim@~1.0.1:
version "1.0.1"
Expand Down Expand Up @@ -3896,10 +3889,10 @@ tough-cookie@~2.5.0:
psl "^1.1.28"
punycode "^2.1.1"

ts-node@^8.3.0:
version "8.10.2"
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.10.2.tgz#eee03764633b1234ddd37f8db9ec10b75ec7fb8d"
integrity sha512-ISJJGgkIpDdBhWVu3jufsWpK3Rzo7bdiIXJjQc0ynKxVOVcg2oIrf2H2cejminGrptVc6q6/uynAHNCuWGbpVA==
"ts-node@>= 8.3.0":
version "9.0.0"
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-9.0.0.tgz#e7699d2a110cc8c0d3b831715e417688683460b3"
integrity sha512-/TqB4SnererCDR/vb4S/QvSZvzQMJN8daAslg7MeaiHvD8rDZsSfXmNeNumyZZzMned72Xoq/isQljYSt8Ynfg==
dependencies:
arg "^4.1.0"
diff "^4.0.1"
Expand Down
4 changes: 2 additions & 2 deletions examples/multiple-statically-entries/first.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';

module.exports.hello = function (event, context, cb) {
cb(null, { message: 'First module', event });
}
cb(null, { message: 'First module', event });
};
4 changes: 2 additions & 2 deletions examples/multiple-statically-entries/second.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';

module.exports.hello = function (event, context, cb) {
cb(null, { message: 'Second module', event });
}
cb(null, { message: 'Second module', event });
};
4 changes: 2 additions & 2 deletions examples/multiple-statically-entries/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ module.exports = {
second: './second.js'
},
target: 'node',
mode: slsw.lib.webpack.isLocal ? 'development': 'production',
mode: slsw.lib.webpack.isLocal ? 'development' : 'production',
output: {
libraryTarget: 'commonjs',
path: path.join(__dirname, '.webpack'),
filename: '[name].js'
},
}
};
35 changes: 13 additions & 22 deletions examples/multiple-statically-entries/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -676,9 +676,9 @@ bindings@^1.5.0:
file-uri-to-path "1.0.0"

bl@^4.0.1:
version "4.0.2"
resolved "https://registry.yarnpkg.com/bl/-/bl-4.0.2.tgz#52b71e9088515d0606d9dd9cc7aa48dc1f98e73a"
integrity sha512-j4OH8f6Qg2bGuWfRiltT2HYGx0e1QcBTrK9KAHNMwMZdQnDZFk0ZSYIpADjYCB3U12nicC5tVJwSIhwOWjb4RQ==
version "4.0.3"
resolved "https://registry.yarnpkg.com/bl/-/bl-4.0.3.tgz#12d6287adc29080e22a705e5764b2a9522cdc489"
integrity sha512-fs4G6/Hu4/EE+F75J8DuN/0IpQqNjAdC7aEQv7Qt8MHGUH7Ckv2MwTEEeN9QehD0pfIDkMI1bkHYkKy7xHyKIg==
dependencies:
buffer "^5.5.0"
inherits "^2.0.4"
Expand Down Expand Up @@ -820,11 +820,6 @@ [email protected]:
resolved "https://registry.yarnpkg.com/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz#f8e71132f7ffe6e01a5c9697a4c6f3e48d5cc819"
integrity sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=

buffer-from@^1.0.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef"
integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==

buffer-from@^1.0.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef"
Expand All @@ -851,11 +846,6 @@ buffer@^5.1.0, buffer@^5.5.0:
base64-js "^1.0.2"
ieee754 "^1.1.4"

builtin-modules@^3.0.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.1.0.tgz#aad97c15131eb76b65b50ef208e7584cd76a7484"
integrity sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw==

builtin-modules@^3.0.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.1.0.tgz#aad97c15131eb76b65b50ef208e7584cd76a7484"
Expand Down Expand Up @@ -2597,9 +2587,9 @@ neo-async@^2.5.0, neo-async@^2.6.1:
integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==

node-fetch@^2.6.0:
version "2.6.0"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd"
integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==
version "2.6.1"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052"
integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==

node-libs-browser@^2.2.1:
version "2.2.1"
Expand Down Expand Up @@ -3253,7 +3243,7 @@ serverless-offline@^6.5.0:
ws "^7.2.1"

"serverless-webpack@file:../..":
version "5.3.3"
version "5.3.4"
dependencies:
archiver "^3.0.3"
bluebird "^3.5.5"
Expand All @@ -3262,7 +3252,8 @@ serverless-offline@^6.5.0:
is-builtin-module "^3.0.0"
lodash "^4.17.19"
semver "^6.2.0"
ts-node "^8.3.0"
optionalDependencies:
ts-node ">= 8.3.0"

set-immediate-shim@~1.0.1:
version "1.0.1"
Expand Down Expand Up @@ -3618,10 +3609,10 @@ to-regex@^3.0.1, to-regex@^3.0.2:
regex-not "^1.0.2"
safe-regex "^1.1.0"

ts-node@^8.3.0:
version "8.10.2"
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.10.2.tgz#eee03764633b1234ddd37f8db9ec10b75ec7fb8d"
integrity sha512-ISJJGgkIpDdBhWVu3jufsWpK3Rzo7bdiIXJjQc0ynKxVOVcg2oIrf2H2cejminGrptVc6q6/uynAHNCuWGbpVA==
"ts-node@>= 8.3.0":
version "9.0.0"
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-9.0.0.tgz#e7699d2a110cc8c0d3b831715e417688683460b3"
integrity sha512-/TqB4SnererCDR/vb4S/QvSZvzQMJN8daAslg7MeaiHvD8rDZsSfXmNeNumyZZzMned72Xoq/isQljYSt8Ynfg==
dependencies:
arg "^4.1.0"
diff "^4.0.1"
Expand Down
6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ class ServerlessWebpack {
(_.has(this.serverless, 'service.custom.webpack.webpackConfig') &&
_.endsWith(this.serverless.service.custom.webpack.webpackConfig, '.ts'))
) {
require('ts-node/register');
try {
require('ts-node/register');
} catch (e) {
throw new Error('If you want to use TypeScript with serverless-webpack, please add "ts-node" as dependency.');
}
}

_.assign(
Expand Down
Loading

0 comments on commit 8a6bf7c

Please sign in to comment.