Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update build system #1468

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

Conversation

arnautov-anton
Copy link
Contributor

Description of the changes, What, Why and How?

Copy link
Contributor

github-actions bot commented Feb 14, 2025

Size Change: -225 kB (-42.97%) 🎉

Total Size: 299 kB

Filename Size Change
dist/browser.es.js 0 B -115 kB (removed) 🏆
dist/browser.full-bundle.min.js 0 B -62.7 kB (removed) 🏆
dist/browser.js 0 B -116 kB (removed) 🏆
dist/index.es.js 0 B -115 kB (removed) 🏆
dist/index.js 246 B -116 kB (-99.79%) 🏆
dist/base64.js 788 B +788 B (new file) 🆕
dist/campaign.js 650 B +650 B (new file) 🆕
dist/channel_manager.js 3.33 kB +3.33 kB (new file) 🆕
dist/channel_state.js 5.94 kB +5.94 kB (new file) 🆕
dist/channel.js 12.1 kB +12.1 kB (new file) 🆕
dist/client_state.js 393 B +393 B (new file) 🆕
dist/client.js 23.7 kB +23.7 kB (new file) 🆕
dist/connection_fallback.js 1.94 kB +1.94 kB (new file) 🆕
dist/connection.js 5.87 kB +5.87 kB (new file) 🆕
dist/constants.js 138 B +138 B (new file) 🆕
dist/errors.js 739 B +739 B (new file) 🆕
dist/events.js 456 B +456 B (new file) 🆕
dist/index.browser.cjs 85.1 kB +85.1 kB (new file) 🆕
dist/index.node.cjs 129 kB +129 kB (new file) 🆕
dist/insights.js 899 B +899 B (new file) 🆕
dist/moderation.js 1.72 kB +1.72 kB (new file) 🆕
dist/permissions.js 696 B +696 B (new file) 🆕
dist/poll_manager.js 1.35 kB +1.35 kB (new file) 🆕
dist/poll.js 2.27 kB +2.27 kB (new file) 🆕
dist/search_controller.js 2.33 kB +2.33 kB (new file) 🆕
dist/segment.js 624 B +624 B (new file) 🆕
dist/signing.js 1.17 kB +1.17 kB (new file) 🆕
dist/store.js 816 B +816 B (new file) 🆕
dist/thread_manager.js 2.21 kB +2.21 kB (new file) 🆕
dist/thread.js 4.26 kB +4.26 kB (new file) 🆕
dist/token_manager.js 1.32 kB +1.32 kB (new file) 🆕
dist/types.js 154 B +154 B (new file) 🆕
dist/utils.js 8.33 kB +8.33 kB (new file) 🆕

compressed-size-action

@arnautov-anton arnautov-anton force-pushed the chore/update-build-system branch 2 times, most recently from 7517db1 to bedeada Compare February 14, 2025 17:15
@arnautov-anton arnautov-anton force-pushed the chore/update-build-system branch from bedeada to 48f659b Compare February 14, 2025 17:20
@arnautov-anton arnautov-anton force-pushed the chore/update-build-system branch from 48f659b to 529fdf6 Compare February 14, 2025 17:22
Comment on lines 41 to 50
const browserPlugin = {
name: 'ignoreBrowser',
setup: (build) => {
const options = build.initialOptions;

if (options.platform !== 'browser') return;

build.onResolve({ filter: /(node:.+)|(jsonwebtoken)/ }, async ({ path }) => ({ path, external: true }));
},
};
Copy link
Contributor Author

@arnautov-anton arnautov-anton Feb 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure this isn't the right approach, I'm going to have to find a similar way of doing what they did in Rollup:

const browserIgnore = {
name: 'browser-remapper',
resolveId: (importee) => (['jsonwebtoken', 'https', 'crypto'].includes(importee) ? importee : null),
load: (id) => (['jsonwebtoken', 'https', 'crypto'].includes(id) ? 'export default null;' : null),
};

(dropping imports for crypto, jsonwebtoken and https altogether from browser version)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind, this seems to work just as well. :)

@arnautov-anton arnautov-anton force-pushed the chore/update-build-system branch 4 times, most recently from 4249c89 to d05514f Compare February 15, 2025 09:16
@arnautov-anton arnautov-anton force-pushed the chore/update-build-system branch 4 times, most recently from 3a561a8 to c3a267d Compare February 15, 2025 10:31
@arnautov-anton arnautov-anton force-pushed the chore/update-build-system branch from c3a267d to 0665ec1 Compare February 15, 2025 10:39
"/src",
"readme.md",
"license"
"/dist"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From npm documentation:

Certain files are always included, regardless of settings:

  • package.json
  • README
  • LICENSE / LICENCE
  • The file in the "main" field
  • The file(s) in the "bin" field

Not sure why we were releasing sourcefiles as well though.

Comment on lines +55 to +61
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
"@babel/plugin-transform-object-assign": "^7.25.9",
"@babel/plugin-transform-runtime": "^7.26.9",
"@babel/preset-env": "^7.26.9",
"@babel/preset-typescript": "^7.26.0",
"@babel/register": "^7.25.9",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately these are still needed for the Mocha to run properly, using different loader generated a TON of other issues I wasn't comfortable dealing with within this PR, updates should suffice for now.

"declarationDir": "./dist/types",
"module": "commonjs",
"target": "ES5"
"module": "ES2020",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note - important change here, the default output is now ESM.

"module": "commonjs",
"target": "ES5"
"module": "ES2020",
"target": "ES6",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably review the target too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant