@adobe/helix-deploy 7.1.7 → 7.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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [7.2.0](https://github.com/adobe/helix-deploy/compare/v7.1.7...v7.2.0) (2022-11-03)
2
+
3
+
4
+ ### Features
5
+
6
+ * **cli:** add options `--edge-externals` and `--serverless-externals` to exclude dependencies depending on architecture ([1d68958](https://github.com/adobe/helix-deploy/commit/1d68958d540221590b2ca5ef2ecfe332b5ecdfb2))
7
+
1
8
  ## [7.1.7](https://github.com/adobe/helix-deploy/compare/v7.1.6...v7.1.7) (2022-10-29)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-deploy",
3
- "version": "7.1.7",
3
+ "version": "7.2.0",
4
4
  "description": "Library and Commandline Tools to build and deploy OpenWhisk Actions",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/adobe/helix-deploy#readme",
package/src/BaseConfig.js CHANGED
@@ -55,6 +55,8 @@ export default class BaseConfig {
55
55
  env: null,
56
56
  verbose: false,
57
57
  externals: [],
58
+ edgeExternals: [],
59
+ serverlessExternals: [],
58
60
  nodeVersion: null,
59
61
  deploy: false,
60
62
  test: null,
@@ -191,6 +193,8 @@ export default class BaseConfig {
191
193
  .withEntryFile(argv.entryFile)
192
194
  .withAdapterFile(argv.adapterFile)
193
195
  .withExternals(argv.externals)
196
+ .withEdgeExternals(argv.edgeExternals)
197
+ .withServerlessExternals(argv.serverlessExternals)
194
198
  .withModules(argv.modules)
195
199
  .withWebSecure(argv.webSecure)
196
200
  .withUpdatePackage(argv.updatePackage)
@@ -331,6 +335,26 @@ export default class BaseConfig {
331
335
  return this;
332
336
  }
333
337
 
338
+ withEdgeExternals(value) {
339
+ this.edgeExternals = (Array.isArray(value) ? value : [value]).map((e) => {
340
+ if (typeof e === 'string' && e.startsWith('/') && e.endsWith('/')) {
341
+ return new RegExp(e.substring(1, e.length - 1));
342
+ }
343
+ return e;
344
+ });
345
+ return this;
346
+ }
347
+
348
+ withServerlessExternals(value) {
349
+ this.serverlessExternals = (Array.isArray(value) ? value : [value]).map((e) => {
350
+ if (typeof e === 'string' && e.startsWith('/') && e.endsWith('/')) {
351
+ return new RegExp(e.substring(1, e.length - 1));
352
+ }
353
+ return e;
354
+ });
355
+ return this;
356
+ }
357
+
334
358
  withStatic(srcPath, dstRelPath) {
335
359
  if (!srcPath) {
336
360
  return this;
@@ -615,7 +639,7 @@ export default class BaseConfig {
615
639
  default: false,
616
640
  })
617
641
 
618
- .group(['minify', 'static', 'entryFile', 'externals', 'modules', 'adapterFile', 'esm', 'bundler'], 'Build Options')
642
+ .group(['minify', 'static', 'entryFile', 'externals', 'edge-externals', 'serverless-externals', 'modules', 'adapterFile', 'esm', 'bundler'], 'Build Options')
619
643
  .option('minify', {
620
644
  description: 'Minify the final bundle',
621
645
  type: 'boolean',
@@ -651,7 +675,17 @@ export default class BaseConfig {
651
675
  description: 'Specifies the adapter file (the exported module).',
652
676
  })
653
677
  .option('externals', {
654
- description: 'Defines the externals for the bundler.',
678
+ description: 'Defines the externals for the bundler (these dependencies will not be bundled).',
679
+ type: 'array',
680
+ default: [],
681
+ })
682
+ .option('edge-externals', {
683
+ description: 'Defines the externals for the edge bundler (these dependencies will not be bundled for Cloudflare or Fastly).',
684
+ type: 'array',
685
+ default: [],
686
+ })
687
+ .option('serverless-externals', {
688
+ description: 'Defines the externals for the serverless bundler (these dependencies will not be bundled for AWS Lambda or Google Cloud Functions).',
655
689
  type: 'array',
656
690
  default: [],
657
691
  })
@@ -37,7 +37,8 @@ export default class EdgeBundler extends WebpackBundler {
37
37
  },
38
38
  devtool: false,
39
39
  externals: [
40
- ...cfg.externals,
40
+ ...cfg.externals, // user defined externals for all platforms
41
+ ...cfg.edgeExternals, // user defined externals for edge compute
41
42
  // the following are imported by the universal adapter and are assumed to be available
42
43
  './params.json',
43
44
  'aws-sdk',
@@ -50,6 +50,7 @@ export default class Bundler extends BaseBundler {
50
50
  treeshake: false,
51
51
  external: [
52
52
  ...cfg.externals,
53
+ ...cfg.serverlessExternals,
53
54
  // the following are imported by the universal adapter and are assumed to be available
54
55
  './params.json',
55
56
  'aws-sdk',
@@ -104,7 +105,7 @@ export default class Bundler extends BaseBundler {
104
105
  await bundle.write(config.output);
105
106
  await bundle.close();
106
107
  cfg.log.info(chalk`{green ok:} created bundle {yellow ${config.output.file}}`);
107
- return { };
108
+ return {};
108
109
  }
109
110
 
110
111
  /**
@@ -47,6 +47,7 @@ export default class WebpackBundler extends BaseBundler {
47
47
  devtool: false,
48
48
  externals: [
49
49
  ...cfg.externals,
50
+ ...cfg.serverlessExternals,
50
51
  // the following are imported by the universal adapter and are assumed to be available
51
52
  './params.json',
52
53
  'aws-sdk',