Skip to content

Commit

Permalink
chore: restore the debug package in the dev bundle
Browse files Browse the repository at this point in the history
The debug package was not included anymore in the dev bundle since the
migration from webpack to rollup ([1]) in version 6.0.0.

[1]: 27de300

See also: 4683a95
  • Loading branch information
darrachequesne committed Jun 3, 2024
1 parent e105551 commit 2b9abbb
Show file tree
Hide file tree
Showing 5 changed files with 175 additions and 29 deletions.
122 changes: 122 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"@babel/preset-env": "^7.12.7",
"@fails-components/webtransport": "^0.1.7",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-commonjs": "^21.0.0",
"@rollup/plugin-node-resolve": "^13.0.5",
"@sinonjs/fake-timers": "^7.1.2",
"@types/debug": "^4.1.12",
Expand Down Expand Up @@ -96,7 +97,7 @@
"test:node": "mocha --bail --require test/support/hooks.js test/index.js test/webtransport.mjs",
"test:node-fetch": "USE_FETCH=1 npm run test:node",
"test:browser": "zuul test/index.js",
"build": "rollup -c support/rollup.config.umd.js && rollup -c support/rollup.config.esm.js",
"build": "rimraf ./dist && rollup -c support/rollup.config.umd.js && rollup -c support/rollup.config.esm.js",
"bundle-size": "node support/bundle-size.js",
"format:check": "prettier --check 'lib/**/*.ts' 'test/**/*.js' 'test/webtransport.mjs' 'support/**/*.js'",
"format:fix": "prettier --write 'lib/**/*.ts' 'test/**/*.js' 'test/webtransport.mjs' 'support/**/*.js'",
Expand Down
71 changes: 47 additions & 24 deletions support/rollup.config.umd.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const { nodeResolve } = require("@rollup/plugin-node-resolve");
const { babel } = require("@rollup/plugin-babel");
const { terser } = require("rollup-plugin-terser");
const commonjs = require("@rollup/plugin-commonjs");

const version = require("../package.json").version;
const banner = `/*!
Expand All @@ -9,41 +10,63 @@ const banner = `/*!
* Released under the MIT License.
*/`;

module.exports = {
input: "./build/esm/browser-entrypoint.js",
output: [
{
module.exports = [
{
input: "./build/esm-debug/browser-entrypoint.js",
output: {
file: "./dist/engine.io.js",
format: "umd",
name: "eio",
sourcemap: true,
banner,
},
{
plugins: [
nodeResolve({
browser: true,
}),
commonjs(),
babel({
babelHelpers: "bundled",
presets: [["@babel/env"]],
plugins: [
"@babel/plugin-transform-object-assign",
[
"@babel/plugin-transform-classes",
{
loose: true,
},
],
],
}),
],
},
{
input: "./build/esm/browser-entrypoint.js",
output: {
file: "./dist/engine.io.min.js",
format: "umd",
name: "eio",
sourcemap: true,
plugins: [terser()],
banner,
},
],
plugins: [
nodeResolve({
browser: true,
}),
babel({
babelHelpers: "bundled",
presets: [["@babel/env"]],
plugins: [
"@babel/plugin-transform-object-assign",
[
"@babel/plugin-transform-classes",
{
loose: true,
},
plugins: [
nodeResolve({
browser: true,
}),
babel({
babelHelpers: "bundled",
presets: [["@babel/env"]],
plugins: [
"@babel/plugin-transform-object-assign",
[
"@babel/plugin-transform-classes",
{
loose: true,
},
],
],
],
}),
],
};
}),
],
},
];
4 changes: 2 additions & 2 deletions test/support/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { createServer } = require("http");
const { attach } = require("engine.io");
const { rollup } = require("rollup");

const rollupConfig = require("../../support/rollup.config.umd.js");
const rollupConfig = require("../../support/rollup.config.umd.js")[1];
const { serialize } = require("cookie");

let httpServer, engine;
Expand All @@ -29,7 +29,7 @@ exports.mochaHooks = {

rollup(rollupConfig).then(async (bundle) => {
await bundle.write({
...rollupConfig.output[1],
...rollupConfig.output,
file: "./test/support/public/engine.io.min.js",
sourcemap: false,
});
Expand Down
4 changes: 2 additions & 2 deletions test/support/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ const server = require("engine.io").attach(http, {
});
const { rollup } = require("rollup");

const rollupConfig = require("../../support/rollup.config.umd.js");
const rollupConfig = require("../../support/rollup.config.umd.js")[1];

rollup(rollupConfig).then(async (bundle) => {
await bundle.write({
...rollupConfig.output[1],
...rollupConfig.output,
file: "./test/support/public/engine.io.min.js",
sourcemap: false,
});
Expand Down

0 comments on commit 2b9abbb

Please sign in to comment.