@adobe/helix-deploy 9.6.1 → 10.0.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,15 @@
1
+ # [10.0.0](https://github.com/adobe/helix-deploy/compare/v9.6.1...v10.0.0) (2024-01-09)
2
+
3
+
4
+ ### Features
5
+
6
+ * remove rollup bundler ([#638](https://github.com/adobe/helix-deploy/issues/638)) ([bc0baa5](https://github.com/adobe/helix-deploy/commit/bc0baa5ead03704ba06524be0b46be63090ab081))
7
+
8
+
9
+ ### BREAKING CHANGES
10
+
11
+ * --bundler is no longer supported
12
+
1
13
  ## [9.6.1](https://github.com/adobe/helix-deploy/compare/v9.6.0...v9.6.1) (2024-01-09)
2
14
 
3
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-deploy",
3
- "version": "9.6.1",
3
+ "version": "10.0.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",
@@ -63,7 +63,6 @@
63
63
  "fs-extra": "11.2.0",
64
64
  "isomorphic-git": "1.25.2",
65
65
  "openwhisk": "3.21.8",
66
- "rollup": "4.9.4",
67
66
  "semver": "7.5.4",
68
67
  "tar": "6.2.0",
69
68
  "webpack": "5.89.0",
@@ -18,13 +18,11 @@ import chalk from 'chalk-template';
18
18
  import git from 'isomorphic-git';
19
19
  import WebpackBundler from './bundler/WebpackBundler.js';
20
20
  import EdgeBundler from './bundler/EdgeBundler.js';
21
- import RollupBundler from './bundler/RollupBundler.js';
22
21
  import pkgJson from './package.cjs';
23
22
 
24
23
  const Bundlers = {
25
24
  node: {
26
25
  webpack: WebpackBundler,
27
- rollup: RollupBundler,
28
26
  },
29
27
  edge: {
30
28
  webpack: EdgeBundler,
package/src/BaseConfig.js CHANGED
@@ -172,7 +172,6 @@ export default class BaseConfig {
172
172
  .withBuild(argv.build)
173
173
  .withMinify(argv.minify)
174
174
  .withESM(argv.esm)
175
- .withBundler(argv.bundler)
176
175
  .withDelete(argv.delete)
177
176
  .withDeploy(argv.deploy)
178
177
  .withTest(argv.test)
@@ -265,11 +264,6 @@ export default class BaseConfig {
265
264
  return this;
266
265
  }
267
266
 
268
- withBundler(bundler) {
269
- this.bundler = bundler;
270
- return this;
271
- }
272
-
273
267
  withDelete(enable) {
274
268
  this.delete = enable;
275
269
  return this;
@@ -645,11 +639,6 @@ export default class BaseConfig {
645
639
  type: 'boolean',
646
640
  default: false,
647
641
  })
648
- .option('bundler', {
649
- description: 'Select bundler backend (webpack, rollup)',
650
- type: 'string',
651
- default: 'webpack',
652
- })
653
642
  .option('esm', {
654
643
  description: 'Produce EcmaScript Module (experimental, disables edge arch)',
655
644
  type: 'boolean',
@@ -1,171 +0,0 @@
1
- /*
2
- * Copyright 2019 Adobe. All rights reserved.
3
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License. You may obtain a copy
5
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
- *
7
- * Unless required by applicable law or agreed to in writing, software distributed under
8
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- * OF ANY KIND, either express or implied. See the License for the specific language
10
- * governing permissions and limitations under the License.
11
- */
12
-
13
- import path from 'path';
14
- import fse from 'fs-extra';
15
- import { fileURLToPath } from 'url';
16
- import { rollup } from 'rollup';
17
- import chalk from 'chalk-template';
18
- import { nodeResolve } from '@rollup/plugin-node-resolve';
19
- import commonjs from '@rollup/plugin-commonjs';
20
- import alias from '@rollup/plugin-alias';
21
- import pluginJson from '@rollup/plugin-json';
22
- import terser from '@rollup/plugin-terser';
23
-
24
- import BaseBundler from './BaseBundler.js';
25
-
26
- // eslint-disable-next-line no-underscore-dangle
27
- const __dirname = path.resolve(fileURLToPath(import.meta.url), '..');
28
-
29
- /**
30
- * Creates the action bundle using rollup
31
- */
32
- export default class Bundler extends BaseBundler {
33
- async getRollupConfig() {
34
- const { cfg } = this;
35
- /**
36
- * @type {import('rollup').RollupOptions}
37
- */
38
- const opts = {
39
- input: cfg.adapterFile || path.resolve(__dirname, '..', 'template', cfg.esm ? 'node-index.mjs' : 'node-index.js'),
40
- output: {
41
- file: cfg.bundle,
42
- name: 'main',
43
- format: cfg.esm ? 'es' : 'cjs',
44
- preferConst: true,
45
- externalLiveBindings: false,
46
- inlineDynamicImports: true,
47
- exports: 'default',
48
- },
49
- // shimMissingExports: false,
50
- treeshake: false,
51
- external: [
52
- ...cfg.externals,
53
- ...cfg.serverlessExternals,
54
- // the following are imported by the universal adapter and are assumed to be available
55
- './params.json',
56
- 'aws-sdk',
57
- 'fs/promises',
58
- '@google-cloud/secret-manager',
59
- '@google-cloud/storage',
60
- '@google-cloud/functions',
61
- ],
62
- plugins: [
63
- pluginJson({
64
- preferConst: true,
65
- }),
66
- nodeResolve({
67
- preferBuiltins: true,
68
- }),
69
- commonjs({
70
- ignoreTryCatch: (id) => id !== './main.js',
71
- }),
72
- alias({
73
- entries: [
74
- { find: './main.js', replacement: cfg.file },
75
- ],
76
- }),
77
- ],
78
- };
79
- if (cfg.minify) {
80
- opts.plugins.push(terser());
81
- }
82
-
83
- // if (cfg.modulePaths && cfg.modulePaths.length > 0) {
84
- // opts.resolve.modules = cfg.modulePaths;
85
- // }
86
-
87
- return opts;
88
- }
89
-
90
- async createBundle() {
91
- const { cfg } = this;
92
- if (!cfg.bundle) {
93
- throw Error('bundle path is undefined');
94
- }
95
- if (!cfg.depFile) {
96
- throw Error('dependencies info path is undefined');
97
- }
98
-
99
- cfg.log.info(`--: creating ${cfg.esm ? 'esm ' : ''}${cfg.minify ? 'minified ' : ''}bundle using rollup...`);
100
- const config = await this.getRollupConfig();
101
- const bundle = await rollup(config);
102
-
103
- const { output } = await bundle.generate(config.output);
104
- await this.resolveDependencyInfos(output);
105
- await bundle.write(config.output);
106
- await bundle.close();
107
- cfg.log.info(chalk`{green ok:} created bundle {yellow ${config.output.file}}`);
108
- return {};
109
- }
110
-
111
- /**
112
- * Resolves the dependencies by chunk. eg:
113
- *
114
- * {
115
- * 'src/idx_json.bundle.js': [{
116
- * id: '@adobe/helix-epsagon:1.2.0',
117
- * name: '@adobe/helix-epsagon',
118
- * version: '1.2.0' },
119
- * ],
120
- * ...
121
- * }
122
- */
123
- async resolveDependencyInfos(output) {
124
- const depsByFile = {};
125
- const resolved = {};
126
- await Promise.all(output.filter((chunkOrAsset) => chunkOrAsset.type !== 'asset').map(async (chunk) => {
127
- const deps = {};
128
- depsByFile[chunk.name] = deps;
129
- await Promise.all(Object.keys(chunk.modules).map(async (modulePath) => {
130
- const segs = modulePath.split('/');
131
- let idx = segs.lastIndexOf('node_modules');
132
- if (idx >= 0) {
133
- idx += 1;
134
- if (segs[idx].charAt(0) === '@') {
135
- idx += 1;
136
- }
137
- segs.splice(idx + 1);
138
- const dir = path.resolve('/', ...segs);
139
-
140
- try {
141
- if (!resolved[dir]) {
142
- const pkgJson = await fse.readJson(path.resolve(dir, 'package.json'));
143
- const id = `${pkgJson.name}:${pkgJson.version}`;
144
- resolved[dir] = {
145
- id,
146
- name: pkgJson.name,
147
- version: pkgJson.version,
148
- };
149
- }
150
- const dep = resolved[dir];
151
- deps[dep.id] = dep;
152
- } catch (e) {
153
- // ignore
154
- }
155
- }
156
- }));
157
- }));
158
-
159
- // sort the deps
160
- Object.entries(depsByFile)
161
- .forEach(([scriptFile, deps]) => {
162
- // map 'index' to 'main', in order to be compatible with rollup
163
- if (scriptFile === 'node-index') {
164
- // eslint-disable-next-line no-param-reassign
165
- scriptFile = 'main';
166
- }
167
- this.cfg.dependencies[scriptFile] = Object.values(deps)
168
- .sort((d0, d1) => d0.name.localeCompare(d1.name));
169
- });
170
- }
171
- }