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

build!: don't vendor dependencies #225

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gabemeola
Copy link
Member

Dependencies are referrenced from node_modules or Yarn Plug'n'Play instead of vendoring within this bundle.
This shaves 130KiB off the gzip tar or ~700KiB uncompressed tar.

This is better for the npm ecosystem but could break consumers which had malformed node_modules (or were doing something custom such as pnpm overrides)

Before

tree -l 1000 --base ./output/

/Users/gabriel.meola/WEBDEV/embedded-app-sdk/output
├── Constants.cjs
├── Constants.d.ts
├── Constants.mjs
├── Discord.cjs
├── Discord.d.ts
├── Discord.mjs
├── _virtual
|  ├── BigInteger.cjs
|  ├── BigInteger.mjs
|  ├── _commonjsHelpers.cjs
|  ├── _commonjsHelpers.mjs
|  ├── index.cjs
|  ├── index.mjs
|  ├── index2.cjs
|  └── index2.mjs
├── commands
|  ├── authenticate.cjs
|  ├── authenticate.d.ts
|  ├── authenticate.mjs
|  ├── authorize.cjs
|  ├── authorize.d.ts
|  ├── authorize.mjs
|  ├── captureLog.cjs
|  ├── captureLog.d.ts
|  ├── captureLog.mjs
|  ├── encourageHardwareAcceleration.cjs
|  ├── encourageHardwareAcceleration.d.ts
|  ├── encourageHardwareAcceleration.mjs
|  ├── getChannel.cjs
|  ├── getChannel.d.ts
|  ├── getChannel.mjs
|  ├── getChannelPermissions.cjs
|  ├── getChannelPermissions.d.ts
|  ├── getChannelPermissions.mjs
|  ├── getEntitlements.cjs
|  ├── getEntitlements.d.ts
|  ├── getEntitlements.mjs
|  ├── getInstanceConnectedParticipants.cjs
|  ├── getInstanceConnectedParticipants.d.ts
|  ├── getInstanceConnectedParticipants.mjs
|  ├── getPlatformBehaviors.cjs
|  ├── getPlatformBehaviors.d.ts
|  ├── getPlatformBehaviors.mjs
|  ├── getSkus.cjs
|  ├── getSkus.d.ts
|  ├── getSkus.mjs
|  ├── index.cjs
|  ├── index.d.ts
|  ├── index.mjs
|  ├── initiateImageUpload.cjs
|  ├── initiateImageUpload.d.ts
|  ├── initiateImageUpload.mjs
|  ├── openExternalLink.cjs
|  ├── openExternalLink.d.ts
|  ├── openExternalLink.mjs
|  ├── openInviteDialog.cjs
|  ├── openInviteDialog.d.ts
|  ├── openInviteDialog.mjs
|  ├── openShareMomentDialog.cjs
|  ├── openShareMomentDialog.d.ts
|  ├── openShareMomentDialog.mjs
|  ├── setActivity.cjs
|  ├── setActivity.d.ts
|  ├── setActivity.mjs
|  ├── setConfig.cjs
|  ├── setConfig.d.ts
|  ├── setConfig.mjs
|  ├── setOrientationLockState.cjs
|  ├── setOrientationLockState.d.ts
|  ├── setOrientationLockState.mjs
|  ├── startPurchase.cjs
|  ├── startPurchase.d.ts
|  ├── startPurchase.mjs
|  ├── userSettingsGetLocale.cjs
|  ├── userSettingsGetLocale.d.ts
|  └── userSettingsGetLocale.mjs
├── error.cjs
├── error.d.ts
├── error.mjs
├── generated
|  ├── schemas.cjs
|  ├── schemas.d.ts
|  └── schemas.mjs
├── index.cjs
├── index.d.ts
├── index.mjs
├── interface.d.ts
├── lib
|  ├── @rollup_plugin-typescript@11.1.6_rollup@4.16.4_tslib@2.6.2_typescript@5.5.2
|  |  └── lib
|  |     └── tslib
|  |        ├── tslib.es6.cjs
|  |        └── tslib.es6.mjs
|  ├── big-integer@1.6.52
|  |  └── lib
|  |     └── big-integer
|  |        ├── BigInteger.cjs
|  |        └── BigInteger.mjs
|  ├── decimal.js-light@2.5.1
|  |  └── lib
|  |     └── decimal.js-light
|  |        ├── decimal.cjs
|  |        └── decimal.mjs
|  ├── eventemitter3@5.0.1
|  |  └── lib
|  |     └── eventemitter3
|  |        ├── index.cjs
|  |        ├── index.mjs
|  |        ├── index2.cjs
|  |        └── index2.mjs
|  ├── lodash.transform@4.6.0
|  |  └── lib
|  |     └── lodash.transform
|  |        ├── index.cjs
|  |        └── index.mjs
|  ├── uuid@10.0.0
|  |  └── lib
|  |     └── uuid
|  |        └── dist
|  |           └── esm-browser
|  |              ├── native.cjs
|  |              ├── native.mjs
|  |              ├── rng.cjs
|  |              ├── rng.mjs
|  |              ├── stringify.cjs
|  |              ├── stringify.mjs
|  |              ├── v4.cjs
|  |              └── v4.mjs
|  └── zod@3.23.4
|     └── lib
|        └── zod
|           └── lib
|              ├── index.cjs
|              └── index.mjs
├── mock.cjs
├── mock.d.ts
├── mock.mjs
├── schema
|  ├── common.cjs
|  ├── common.d.ts
|  ├── common.mjs
|  ├── events.cjs
|  ├── events.d.ts
|  ├── events.mjs
|  ├── index.cjs
|  ├── index.d.ts
|  ├── index.mjs
|  ├── responses.cjs
|  ├── responses.d.ts
|  ├── responses.mjs
|  └── types.d.ts
└── utils
   ├── BigFlagUtils.cjs
   ├── BigFlagUtils.d.ts
   ├── BigFlagUtils.mjs
   ├── PermissionUtils.cjs
   ├── PermissionUtils.d.ts
   ├── PermissionUtils.mjs
   ├── PriceConstants.cjs
   ├── PriceConstants.d.ts
   ├── PriceConstants.mjs
   ├── PriceUtils.cjs
   ├── PriceUtils.d.ts
   ├── PriceUtils.mjs
   ├── assertUnreachable.cjs
   ├── assertUnreachable.d.ts
   ├── assertUnreachable.mjs
   ├── commandFactory.cjs
   ├── commandFactory.d.ts
   ├── commandFactory.mjs
   ├── compatCommandFactory.cjs
   ├── compatCommandFactory.d.ts
   ├── compatCommandFactory.mjs
   ├── console.cjs
   ├── console.d.ts
   ├── console.mjs
   ├── getDefaultSdkConfiguration.cjs
   ├── getDefaultSdkConfiguration.d.ts
   ├── getDefaultSdkConfiguration.mjs
   ├── patchUrlMappings.cjs
   ├── patchUrlMappings.d.ts
   ├── patchUrlMappings.mjs
   ├── url.cjs
   ├── url.d.ts
   ├── url.mjs
   ├── zodUtils.cjs
   ├── zodUtils.d.ts
   └── zodUtils.mjs

directory: 30 file: 158

npm pack

npm notice === Tarball Details === 
npm notice name:          @discord/embedded-app-sdk               
npm notice version:       1.3.0                                   
npm notice filename:      discord-embedded-app-sdk-1.3.0.tgz      
npm notice package size:  239.7 kB                                
npm notice unpacked size: 1.9 MB                                  
npm notice shasum:        2408c953e62cc066c5b45cd970f9a8707302edb1
npm notice integrity:     sha512-oW8Nh4WlpEN61[...]WPlithxQ0TL0g==
npm notice total files:   161                                     

After

tree -l 1000 --base ./output/

/Users/gabriel.meola/WEBDEV/embedded-app-sdk/output
├── Constants.cjs
├── Constants.d.ts
├── Constants.mjs
├── Discord.cjs
├── Discord.d.ts
├── Discord.mjs
├── commands
|  ├── authenticate.cjs
|  ├── authenticate.d.ts
|  ├── authenticate.mjs
|  ├── authorize.cjs
|  ├── authorize.d.ts
|  ├── authorize.mjs
|  ├── captureLog.cjs
|  ├── captureLog.d.ts
|  ├── captureLog.mjs
|  ├── encourageHardwareAcceleration.cjs
|  ├── encourageHardwareAcceleration.d.ts
|  ├── encourageHardwareAcceleration.mjs
|  ├── getChannel.cjs
|  ├── getChannel.d.ts
|  ├── getChannel.mjs
|  ├── getChannelPermissions.cjs
|  ├── getChannelPermissions.d.ts
|  ├── getChannelPermissions.mjs
|  ├── getEntitlements.cjs
|  ├── getEntitlements.d.ts
|  ├── getEntitlements.mjs
|  ├── getInstanceConnectedParticipants.cjs
|  ├── getInstanceConnectedParticipants.d.ts
|  ├── getInstanceConnectedParticipants.mjs
|  ├── getPlatformBehaviors.cjs
|  ├── getPlatformBehaviors.d.ts
|  ├── getPlatformBehaviors.mjs
|  ├── getSkus.cjs
|  ├── getSkus.d.ts
|  ├── getSkus.mjs
|  ├── index.cjs
|  ├── index.d.ts
|  ├── index.mjs
|  ├── initiateImageUpload.cjs
|  ├── initiateImageUpload.d.ts
|  ├── initiateImageUpload.mjs
|  ├── openExternalLink.cjs
|  ├── openExternalLink.d.ts
|  ├── openExternalLink.mjs
|  ├── openInviteDialog.cjs
|  ├── openInviteDialog.d.ts
|  ├── openInviteDialog.mjs
|  ├── openShareMomentDialog.cjs
|  ├── openShareMomentDialog.d.ts
|  ├── openShareMomentDialog.mjs
|  ├── setActivity.cjs
|  ├── setActivity.d.ts
|  ├── setActivity.mjs
|  ├── setConfig.cjs
|  ├── setConfig.d.ts
|  ├── setConfig.mjs
|  ├── setOrientationLockState.cjs
|  ├── setOrientationLockState.d.ts
|  ├── setOrientationLockState.mjs
|  ├── startPurchase.cjs
|  ├── startPurchase.d.ts
|  ├── startPurchase.mjs
|  ├── userSettingsGetLocale.cjs
|  ├── userSettingsGetLocale.d.ts
|  └── userSettingsGetLocale.mjs
├── error.cjs
├── error.d.ts
├── error.mjs
├── generated
|  ├── schemas.cjs
|  ├── schemas.d.ts
|  └── schemas.mjs
├── index.cjs
├── index.d.ts
├── index.mjs
├── interface.d.ts
├── lib
|  └── @rollup_plugin-typescript@11.1.6_rollup@4.16.4_tslib@2.6.2_typescript@5.5.2
|     └── lib
|        └── tslib
|           ├── tslib.es6.cjs
|           └── tslib.es6.mjs
├── mock.cjs
├── mock.d.ts
├── mock.mjs
├── schema
|  ├── common.cjs
|  ├── common.d.ts
|  ├── common.mjs
|  ├── events.cjs
|  ├── events.d.ts
|  ├── events.mjs
|  ├── index.cjs
|  ├── index.d.ts
|  ├── index.mjs
|  ├── responses.cjs
|  ├── responses.d.ts
|  ├── responses.mjs
|  └── types.d.ts
└── utils
   ├── BigFlagUtils.cjs
   ├── BigFlagUtils.d.ts
   ├── BigFlagUtils.mjs
   ├── PermissionUtils.cjs
   ├── PermissionUtils.d.ts
   ├── PermissionUtils.mjs
   ├── PriceConstants.cjs
   ├── PriceConstants.d.ts
   ├── PriceConstants.mjs
   ├── PriceUtils.cjs
   ├── PriceUtils.d.ts
   ├── PriceUtils.mjs
   ├── assertUnreachable.cjs
   ├── assertUnreachable.d.ts
   ├── assertUnreachable.mjs
   ├── commandFactory.cjs
   ├── commandFactory.d.ts
   ├── commandFactory.mjs
   ├── compatCommandFactory.cjs
   ├── compatCommandFactory.d.ts
   ├── compatCommandFactory.mjs
   ├── console.cjs
   ├── console.d.ts
   ├── console.mjs
   ├── getDefaultSdkConfiguration.cjs
   ├── getDefaultSdkConfiguration.d.ts
   ├── getDefaultSdkConfiguration.mjs
   ├── patchUrlMappings.cjs
   ├── patchUrlMappings.d.ts
   ├── patchUrlMappings.mjs
   ├── url.cjs
   ├── url.d.ts
   ├── url.mjs
   ├── zodUtils.cjs
   ├── zodUtils.d.ts
   └── zodUtils.mjs

directory: 8 file: 130

npm pack

npm notice === Tarball Details === 
npm notice name:          @discord/embedded-app-sdk               
npm notice version:       1.3.0                                   
npm notice filename:      discord-embedded-app-sdk-1.3.0.tgz      
npm notice package size:  109.9 kB                                
npm notice unpacked size: 1.2 MB                                  
npm notice shasum:        ee4e65f074a5f1544b0174440c66a10d54b9564e
npm notice integrity:     sha512-qveU0Rf99n+ok[...]1eGIz9zHa03wQ==
npm notice total files:   133                                     

@gabemeola gabemeola changed the title Don't vendor dependencies build!: don't vendor dependencies Jun 27, 2024
@matthova
Copy link
Collaborator

matthova commented Jul 3, 2024

This is great! Thanks for the breakdown. I'm curious when would be the best time to land this. Possibly makes sense as a part of any 2.0-related work

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.

2 participants