Skip to content

Commit dbf4d70

Browse files
authored
Install the ZMQ prebuilt binaries and verify ZMQ works on startup (#10551)
* Npm package * Add ZMQ to the extension * Fix functional failure * Make verification happen at server launch * Fix native dependencies. Make sure error sticks around * Fix functional tests * Fix linter
1 parent 83d1ede commit dbf4d70

File tree

20 files changed

+454
-33
lines changed

20 files changed

+454
-33
lines changed

build/webpack/common.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ exports.nodeModulesToExternalize = [
3535
'@koa/cors',
3636
'koa',
3737
'koa-compress',
38-
'koa-logger'
38+
'koa-logger',
39+
'zeromq'
3940
];
4041
exports.nodeModulesToReplacePaths = [...exports.nodeModulesToExternalize];
4142
function getDefaultPlugins(name) {

build/webpack/webpack.extension.config.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// Licensed under the MIT License.
33
'use strict';
44

5+
const copyWebpackPlugin = require('copy-webpack-plugin');
6+
const removeFilesWebpackPlugin = require('remove-files-webpack-plugin');
57
const path = require('path');
68
const tsconfig_paths_webpack_plugin = require('tsconfig-paths-webpack-plugin');
79
const constants = require('../constants');
@@ -76,7 +78,15 @@ const config = {
7678
]
7779
}
7880
]
79-
})
81+
}),
82+
// ZMQ requires prebuilds to be in our node_modules directory. So recreate the ZMQ structure.
83+
// However we don't webpack to manage this, so it was part of the excluded modules. Delete it from there
84+
// so at runtime we pick up the original structure.
85+
new removeFilesWebpackPlugin({ after: { include: ['./out/client/node_modules/zeromq.js'] } }),
86+
new copyWebpackPlugin([{ from: './node_modules/zeromq/**/*.js' }]),
87+
new copyWebpackPlugin([{ from: './node_modules/zeromq/**/*.node' }]),
88+
new copyWebpackPlugin([{ from: './node_modules/zeromq/**/*.json' }]),
89+
new copyWebpackPlugin([{ from: './node_modules/node-gyp-build/**/*' }])
8090
],
8191
resolve: {
8292
alias: {

gulpfile.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,7 @@ function hasNativeDependencies() {
709709
path.dirname(item.substring(item.indexOf('node_modules') + 'node_modules'.length)).split(path.sep)
710710
)
711711
.filter(item => item.length > 0)
712+
.filter(item => !item.includes('zeromq')) // This is a known native. Allow this one for now
712713
.filter(
713714
item =>
714715
jsonProperties.findIndex(flattenedDependency =>

news/3 Code Health/10483.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add ZMQ library to extension

0 commit comments

Comments
 (0)