@adobe/helix-deploy 12.4.39 → 13.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 +15 -0
- package/index.js +1 -1
- package/package.json +3 -4
- package/src/BaseConfig.js +3 -3
- package/src/bundler/BaseBundler.js +0 -1
- package/src/bundler/ESBuildBundler.js +1 -1
- package/src/cli.js +0 -2
- package/src/bundler/WebpackBundler.js +0 -241
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
# [13.0.0](https://github.com/adobe/helix-deploy/compare/v12.4.39...v13.0.0) (2025-05-15)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* move webpack bundler to plugin ([#809](https://github.com/adobe/helix-deploy/issues/809)) ([4c783a8](https://github.com/adobe/helix-deploy/commit/4c783a816767dd867af44b8bfbbdf3bf8aeebc9c))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### BREAKING CHANGES
|
|
10
|
+
|
|
11
|
+
* bundles will be ESM built with esbuild
|
|
12
|
+
|
|
13
|
+
* fix: move webpack bundler to plugin
|
|
14
|
+
* fix: use simple-esm as template for deployment
|
|
15
|
+
|
|
1
16
|
## [12.4.39](https://github.com/adobe/helix-deploy/compare/v12.4.38...v12.4.39) (2025-05-13)
|
|
2
17
|
|
|
3
18
|
|
package/index.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
export { default as ActionBuilder } from './src/ActionBuilder.js';
|
|
13
|
-
export { default as
|
|
13
|
+
export { default as BaseBundler } from './src/bundler/BaseBundler.js';
|
|
14
14
|
export { default as BaseConfig } from './src/BaseConfig.js';
|
|
15
15
|
export { default as BaseDeployer } from './src/deploy/BaseDeployer.js';
|
|
16
16
|
export { default as CLI } from './src/cli.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-deploy",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "13.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",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"require": "test/setup-env.js"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@adobe/helix-universal": ">=
|
|
37
|
+
"@adobe/helix-universal": ">=5.2.1"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@adobe/fetch": "4.2.1",
|
|
@@ -57,7 +57,6 @@
|
|
|
57
57
|
"isomorphic-git": "1.30.1",
|
|
58
58
|
"openwhisk": "3.21.8",
|
|
59
59
|
"semver": "7.7.2",
|
|
60
|
-
"webpack": "5.99.8",
|
|
61
60
|
"yargs": "17.7.2"
|
|
62
61
|
},
|
|
63
62
|
"devDependencies": {
|
|
@@ -69,7 +68,7 @@
|
|
|
69
68
|
"c8": "10.1.3",
|
|
70
69
|
"eslint": "8.57.1",
|
|
71
70
|
"husky": "9.1.7",
|
|
72
|
-
"lint-staged": "
|
|
71
|
+
"lint-staged": "16.0.0",
|
|
73
72
|
"mocha": "11.2.2",
|
|
74
73
|
"mocha-junit-reporter": "2.2.1",
|
|
75
74
|
"mocha-multi-reporters": "1.5.1",
|
package/src/BaseConfig.js
CHANGED
|
@@ -90,9 +90,9 @@ export default class BaseConfig {
|
|
|
90
90
|
updatedBy: null,
|
|
91
91
|
targets: [],
|
|
92
92
|
functionURL: '',
|
|
93
|
-
esm:
|
|
93
|
+
esm: true,
|
|
94
94
|
archs: ['node', 'edge'],
|
|
95
|
-
bundler: '
|
|
95
|
+
bundler: 'esbuild',
|
|
96
96
|
format: {
|
|
97
97
|
aws: DEFAULT_ACTION_FORMAT,
|
|
98
98
|
},
|
|
@@ -658,7 +658,7 @@ export default class BaseConfig {
|
|
|
658
658
|
.option('esm', {
|
|
659
659
|
description: 'Produce EcmaScript Module (experimental, disables edge arch)',
|
|
660
660
|
type: 'boolean',
|
|
661
|
-
default:
|
|
661
|
+
default: true,
|
|
662
662
|
})
|
|
663
663
|
.option('modules', {
|
|
664
664
|
alias: 'm',
|
|
@@ -176,7 +176,6 @@ export default class BaseBundler {
|
|
|
176
176
|
|
|
177
177
|
archive.append(JSON.stringify(packageJson, null, ' '), { name: 'package.json' });
|
|
178
178
|
|
|
179
|
-
// this allows to use a cjs loader for the esm modules. but it still doesn't work on AWS
|
|
180
179
|
if (cfg.esm) {
|
|
181
180
|
archive.directory('esm-adapter');
|
|
182
181
|
archive.append('{}', { name: 'esm-adapter/package.json' });
|
package/src/cli.js
CHANGED
|
@@ -21,14 +21,12 @@ import OpenWhiskDeployer from './deploy/OpenWhiskDeployer.js';
|
|
|
21
21
|
import AWSDeployer from './deploy/AWSDeployer.js';
|
|
22
22
|
import GoogleDeployer from './deploy/GoogleDeployer.js';
|
|
23
23
|
import ActionBuilder from './ActionBuilder.js';
|
|
24
|
-
import WebpackBundler from './bundler/WebpackBundler.js';
|
|
25
24
|
import ESBuildBundler from './bundler/ESBuildBundler.js';
|
|
26
25
|
|
|
27
26
|
const PLUGINS = [
|
|
28
27
|
OpenWhiskDeployer,
|
|
29
28
|
AWSDeployer,
|
|
30
29
|
GoogleDeployer,
|
|
31
|
-
WebpackBundler,
|
|
32
30
|
ESBuildBundler,
|
|
33
31
|
];
|
|
34
32
|
|
|
@@ -1,241 +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
|
-
import { fileURLToPath } from 'url';
|
|
13
|
-
import path from 'path';
|
|
14
|
-
import fse from 'fs-extra';
|
|
15
|
-
import webpack from 'webpack';
|
|
16
|
-
import chalk from 'chalk-template';
|
|
17
|
-
import BaseBundler from './BaseBundler.js';
|
|
18
|
-
|
|
19
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
20
|
-
const __dirname = path.resolve(fileURLToPath(import.meta.url), '..');
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Webpack based bundler
|
|
24
|
-
*/
|
|
25
|
-
export default class WebpackBundler extends BaseBundler {
|
|
26
|
-
constructor(cfg) {
|
|
27
|
-
super(cfg);
|
|
28
|
-
this.arch = 'node';
|
|
29
|
-
this.type = 'webpack';
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
async init() {
|
|
33
|
-
if (this.cfg.esm) {
|
|
34
|
-
throw new Error('Webpack bundler does not support ESM builds.');
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
async getWebpackConfig() {
|
|
39
|
-
const { cfg } = this;
|
|
40
|
-
const opts = {
|
|
41
|
-
target: 'node',
|
|
42
|
-
mode: 'production',
|
|
43
|
-
// the universal adapter is the entry point
|
|
44
|
-
entry: cfg.adapterFile || path.resolve(__dirname, '..', 'template', 'node-index.js'),
|
|
45
|
-
context: cfg.cwd,
|
|
46
|
-
output: {
|
|
47
|
-
path: cfg.cwd,
|
|
48
|
-
filename: path.relative(cfg.cwd, cfg.bundle),
|
|
49
|
-
library: 'main',
|
|
50
|
-
libraryTarget: 'umd',
|
|
51
|
-
globalObject: 'globalThis',
|
|
52
|
-
asyncChunks: false,
|
|
53
|
-
},
|
|
54
|
-
devtool: false,
|
|
55
|
-
externals: [
|
|
56
|
-
/^@aws-sdk\/.*$/,
|
|
57
|
-
[
|
|
58
|
-
...cfg.externals,
|
|
59
|
-
...cfg.serverlessExternals,
|
|
60
|
-
// the following are imported by the universal adapter and are assumed to be available
|
|
61
|
-
'./params.json',
|
|
62
|
-
'aws-sdk',
|
|
63
|
-
'@google-cloud/secret-manager',
|
|
64
|
-
'@google-cloud/storage',
|
|
65
|
-
].reduce((obj, ext) => {
|
|
66
|
-
// this makes webpack to ignore the module and just leave it as normal require.
|
|
67
|
-
// eslint-disable-next-line no-param-reassign
|
|
68
|
-
obj[ext] = `commonjs2 ${ext}`;
|
|
69
|
-
return obj;
|
|
70
|
-
}, {}),
|
|
71
|
-
],
|
|
72
|
-
module: {
|
|
73
|
-
rules: [{
|
|
74
|
-
test: /\.js$/,
|
|
75
|
-
type: 'javascript/auto',
|
|
76
|
-
}, {
|
|
77
|
-
test: /\.mjs$/,
|
|
78
|
-
type: 'javascript/esm',
|
|
79
|
-
}],
|
|
80
|
-
},
|
|
81
|
-
resolve: {
|
|
82
|
-
mainFields: ['main', 'module'],
|
|
83
|
-
extensions: ['.wasm', '.js', '.mjs', '.json'],
|
|
84
|
-
alias: {
|
|
85
|
-
// the main.js is imported in the universal adapter and is _the_ action entry point
|
|
86
|
-
'./main.js': cfg.file,
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
optimization: {
|
|
90
|
-
// we enable production mode in order to get the correct imports (eg micromark has special
|
|
91
|
-
// export condition for 'development'). but we disable minimize and keep named modules
|
|
92
|
-
// in order to easier match log errors to the bundle
|
|
93
|
-
minimize: false,
|
|
94
|
-
concatenateModules: false,
|
|
95
|
-
mangleExports: false,
|
|
96
|
-
moduleIds: 'named',
|
|
97
|
-
},
|
|
98
|
-
node: {
|
|
99
|
-
__dirname: true,
|
|
100
|
-
__filename: false,
|
|
101
|
-
},
|
|
102
|
-
plugins: [],
|
|
103
|
-
};
|
|
104
|
-
if (cfg.minify) {
|
|
105
|
-
opts.optimization = {
|
|
106
|
-
minimize: cfg.minify,
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
if (cfg.modulePaths && cfg.modulePaths.length > 0) {
|
|
110
|
-
opts.resolve.modules = cfg.modulePaths;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (cfg.progressHandler) {
|
|
114
|
-
this.initProgressHandler(opts, cfg);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
const customizePath = path.join(cfg.cwd, 'hlx.webpack.customize.js');
|
|
118
|
-
if (await fse.pathExists(customizePath)) {
|
|
119
|
-
cfg.log.info(`--: Using custom webpack config from ${customizePath}`);
|
|
120
|
-
const customize = await import(customizePath);
|
|
121
|
-
if (customize.extraPlugins && typeof customize.extraPlugins === 'function') {
|
|
122
|
-
opts.plugins.push(...customize.extraPlugins(cfg, opts));
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
return opts;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// eslint-disable-next-line class-methods-use-this
|
|
129
|
-
initProgressHandler(opts, cfg) {
|
|
130
|
-
opts.plugins.push(new webpack.ProgressPlugin(cfg.progressHandler));
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
async createWebpackBundle(arch) {
|
|
134
|
-
const { cfg } = this;
|
|
135
|
-
if (!cfg.depFile) {
|
|
136
|
-
throw Error('dependencies info path is undefined');
|
|
137
|
-
}
|
|
138
|
-
const m = cfg.minify ? 'minified ' : '';
|
|
139
|
-
if (!cfg.progressHandler) {
|
|
140
|
-
cfg.log.info(`--: creating ${arch} ${m}bundle using webpack ...`);
|
|
141
|
-
}
|
|
142
|
-
const config = await this.getWebpackConfig();
|
|
143
|
-
const compiler = webpack(config);
|
|
144
|
-
const stats = await new Promise((resolve, reject) => {
|
|
145
|
-
compiler.run((err, s) => {
|
|
146
|
-
if (err) {
|
|
147
|
-
reject(err);
|
|
148
|
-
} else {
|
|
149
|
-
resolve(s);
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
});
|
|
153
|
-
cfg.log.debug(stats.toString({
|
|
154
|
-
chunks: false,
|
|
155
|
-
colors: true,
|
|
156
|
-
}));
|
|
157
|
-
|
|
158
|
-
await this.resolveDependencyInfos(stats);
|
|
159
|
-
// write dependencies info file
|
|
160
|
-
await fse.writeJson(cfg.depFile, cfg.dependencies, { spaces: 2 });
|
|
161
|
-
if (!cfg.progressHandler) {
|
|
162
|
-
cfg.log.info(chalk`{green ok:} created ${arch} bundle {yellow ${config.output.filename}}`);
|
|
163
|
-
}
|
|
164
|
-
return stats;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
async createBundle() {
|
|
168
|
-
if (!this.cfg.bundle) {
|
|
169
|
-
throw Error('bundle path is undefined');
|
|
170
|
-
}
|
|
171
|
-
return this.createWebpackBundle('node');
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Resolves the dependencies by chunk. eg:
|
|
176
|
-
*
|
|
177
|
-
* {
|
|
178
|
-
* 'src/idx_json.bundle.js': [{
|
|
179
|
-
* id: '@adobe/helix-epsagon:1.2.0',
|
|
180
|
-
* name: '@adobe/helix-epsagon',
|
|
181
|
-
* version: '1.2.0' },
|
|
182
|
-
* ],
|
|
183
|
-
* ...
|
|
184
|
-
* }
|
|
185
|
-
*/
|
|
186
|
-
async resolveDependencyInfos(stats) {
|
|
187
|
-
const { cfg } = this;
|
|
188
|
-
|
|
189
|
-
// get list of dependencies
|
|
190
|
-
const depsByFile = {};
|
|
191
|
-
const resolved = {};
|
|
192
|
-
|
|
193
|
-
const jsonStats = stats.toJson({
|
|
194
|
-
chunks: true,
|
|
195
|
-
chunkModules: true,
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
await Promise.all(jsonStats.chunks
|
|
199
|
-
.map(async (chunk) => {
|
|
200
|
-
const chunkName = chunk.names[0];
|
|
201
|
-
const deps = {};
|
|
202
|
-
depsByFile[chunkName] = deps;
|
|
203
|
-
|
|
204
|
-
await Promise.all(chunk.modules.map(async (mod) => {
|
|
205
|
-
const segs = mod.identifier.split('/');
|
|
206
|
-
let idx = segs.lastIndexOf('node_modules');
|
|
207
|
-
if (idx >= 0) {
|
|
208
|
-
idx += 1;
|
|
209
|
-
if (segs[idx].charAt(0) === '@') {
|
|
210
|
-
idx += 1;
|
|
211
|
-
}
|
|
212
|
-
segs.splice(idx + 1);
|
|
213
|
-
const dir = path.resolve('/', ...segs);
|
|
214
|
-
|
|
215
|
-
try {
|
|
216
|
-
if (!resolved[dir]) {
|
|
217
|
-
const pkgJson = await fse.readJson(path.resolve(dir, 'package.json'));
|
|
218
|
-
const id = `${pkgJson.name}:${pkgJson.version}`;
|
|
219
|
-
resolved[dir] = {
|
|
220
|
-
id,
|
|
221
|
-
name: pkgJson.name,
|
|
222
|
-
version: pkgJson.version,
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
|
-
const dep = resolved[dir];
|
|
226
|
-
deps[dep.id] = dep;
|
|
227
|
-
} catch (e) {
|
|
228
|
-
// ignore
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}));
|
|
232
|
-
}));
|
|
233
|
-
|
|
234
|
-
// sort the deps
|
|
235
|
-
Object.entries(depsByFile)
|
|
236
|
-
.forEach(([scriptFile, deps]) => {
|
|
237
|
-
cfg.dependencies[scriptFile] = Object.values(deps)
|
|
238
|
-
.sort((d0, d1) => d0.name.localeCompare(d1.name));
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
}
|