drizzle-team / drizzle-kit-mirror

Docs and issues repository for drizzle-kit
289 stars 17 forks source link

[e18e] Module graph optimization #485

Closed kravetsone closed 1 day ago

kravetsone commented 4 months ago

The downloaded dependencies contain quite a lot of polyfills and unnecessary dependencies. For example fs.realpath required only for Node.js@<6 Maybe we can optimize it?

instead of glob i recommend fdir (dotenvx replace glob to it too - https://github.com/dotenvx/dotenvx/pull/278/)

json-diff@0.9.0 - many dependencies were removed in the latest version, but the library contains a bunch of useless files image

zod - really slow validator (runtime-type-benchmarks or typescript-runtime-type-benchmarks) and not tree-shakable (comparison with valibot)

@hono/zod-validator - @hono/valibot-validator

node-fetch - with native node.js fetch (released at Node.js@18.0.0 - 2022-04-19)

and about database drivers, maybe there is a way to reuse what the user downloaded?

├─┬ drizzle-kit@0.21.4
│ ├─┬ @esbuild-kit/esm-loader@2.6.5
│ │ ├─┬ @esbuild-kit/core-utils@3.3.2
│ │ │ ├─┬ esbuild@0.18.20
│ │ │ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/android-arm@0.18.20
│ │ │ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/android-arm64@0.18.20
│ │ │ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/android-x64@0.18.20
│ │ │ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/darwin-arm64@0.18.20
│ │ │ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/darwin-x64@0.18.20
│ │ │ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/freebsd-arm64@0.18.20
│ │ │ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/freebsd-x64@0.18.20
│ │ │ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/linux-arm@0.18.20
│ │ │ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/linux-arm64@0.18.20
│ │ │ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/linux-ia32@0.18.20
│ │ │ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/linux-loong64@0.18.20
│ │ │ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/linux-mips64el@0.18.20
│ │ │ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/linux-ppc64@0.18.20
│ │ │ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/linux-riscv64@0.18.20
│ │ │ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/linux-s390x@0.18.20
│ │ │ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/linux-x64@0.18.20
│ │ │ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/netbsd-x64@0.18.20
│ │ │ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/openbsd-x64@0.18.20
│ │ │ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/sunos-x64@0.18.20
│ │ │ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/win32-arm64@0.18.20
│ │ │ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/win32-ia32@0.18.20
│ │ │ │ └── @esbuild/win32-x64@0.18.20
│ │ │ └─┬ source-map-support@0.5.21
│ │ │   ├── buffer-from@1.1.2
│ │ │   └── source-map@0.6.1
│ │ └─┬ get-tsconfig@4.7.5
│ │   └── resolve-pkg-maps@1.0.0
│ ├── commander@9.5.0
│ ├── env-paths@3.0.0
│ ├─┬ esbuild-register@3.5.0
│ │ ├─┬ debug@4.3.5
│ │ │ └── ms@2.1.2
│ │ └── esbuild@0.19.12 deduped
│ ├─┬ esbuild@0.19.12
│ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/aix-ppc64@0.19.12
│ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/android-arm@0.19.12
│ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/android-arm64@0.19.12
│ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/android-x64@0.19.12
│ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/darwin-arm64@0.19.12
│ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/darwin-x64@0.19.12
│ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/freebsd-arm64@0.19.12
│ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/freebsd-x64@0.19.12
│ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/linux-arm@0.19.12
│ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/linux-arm64@0.19.12
│ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/linux-ia32@0.19.12
│ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/linux-loong64@0.19.12
│ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/linux-mips64el@0.19.12
│ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/linux-ppc64@0.19.12
│ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/linux-riscv64@0.19.12
│ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/linux-s390x@0.19.12
│ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/linux-x64@0.19.12
│ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/netbsd-x64@0.19.12
│ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/openbsd-x64@0.19.12
│ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/sunos-x64@0.19.12
│ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/win32-arm64@0.19.12
│ │ ├── UNMET OPTIONAL DEPENDENCY @esbuild/win32-ia32@0.19.12
│ │ └── @esbuild/win32-x64@0.19.12
│ ├─┬ glob@8.1.0
│ │ ├── fs.realpath@1.0.0
│ │ ├─┬ inflight@1.0.6
│ │ │ ├── once@1.4.0 deduped
│ │ │ └── wrappy@1.0.2
│ │ ├── inherits@2.0.4
│ │ ├─┬ minimatch@5.1.6
│ │ │ └─┬ brace-expansion@2.0.1
│ │ │   └── balanced-match@1.0.2
│ │ └─┬ once@1.4.0
│ │   └── wrappy@1.0.2 deduped
│ ├─┬ hanji@0.0.5
│ │ ├── lodash.throttle@4.1.1
│ │ └── sisteransi@1.0.5
│ ├─┬ json-diff@0.9.0
│ │ ├─┬ cli-color@2.0.4
│ │ │ ├─┬ d@1.0.2
│ │ │ │ ├── es5-ext@0.10.64 deduped
│ │ │ │ └── type@2.7.3
│ │ │ ├─┬ es5-ext@0.10.64
│ │ │ │ ├── es6-iterator@2.0.3 deduped
│ │ │ │ ├─┬ es6-symbol@3.1.4
│ │ │ │ │ ├── d@1.0.2 deduped
│ │ │ │ │ └─┬ ext@1.7.0
│ │ │ │ │   └── type@2.7.3 deduped
│ │ │ │ ├─┬ esniff@2.0.1
│ │ │ │ │ ├── d@1.0.2 deduped
│ │ │ │ │ ├── es5-ext@0.10.64 deduped
│ │ │ │ │ ├── event-emitter@0.3.5 deduped
│ │ │ │ │ └── type@2.7.3 deduped
│ │ │ │ └── next-tick@1.1.0
│ │ │ ├─┬ es6-iterator@2.0.3
│ │ │ │ ├── d@1.0.2 deduped
│ │ │ │ ├── es5-ext@0.10.64 deduped
│ │ │ │ └── es6-symbol@3.1.4 deduped
│ │ │ ├─┬ memoizee@0.4.17
│ │ │ │ ├── d@1.0.2 deduped
│ │ │ │ ├── es5-ext@0.10.64 deduped
│ │ │ │ ├─┬ es6-weak-map@2.0.3
│ │ │ │ │ ├── d@1.0.2 deduped
│ │ │ │ │ ├── es5-ext@0.10.64 deduped
│ │ │ │ │ ├── es6-iterator@2.0.3 deduped
│ │ │ │ │ └── es6-symbol@3.1.4 deduped
│ │ │ │ ├─┬ event-emitter@0.3.5
│ │ │ │ │ ├── d@1.0.2 deduped
│ │ │ │ │ └── es5-ext@0.10.64 deduped
│ │ │ │ ├── is-promise@2.2.2
│ │ │ │ ├─┬ lru-queue@0.1.0
│ │ │ │ │ └── es5-ext@0.10.64 deduped
│ │ │ │ ├── next-tick@1.1.0 deduped
│ │ │ │ └── timers-ext@0.1.8 deduped
│ │ │ └─┬ timers-ext@0.1.8
│ │ │   ├── es5-ext@0.10.64 deduped
│ │ │   └── next-tick@1.1.0 deduped
│ │ ├─┬ difflib@0.2.4
│ │ │ └── heap@0.2.7
│ │ └─┬ dreamopt@0.8.0
│ │   └── wordwrap@1.0.0
│ └── zod@3.23.8

https://npmgraph.js.org/?q=drizzle-kit#zoom=h&deps=devDependencies

image

for now unpacked size is too much - 8.41 MB

By reducing dependencies and their weight, we will put ourselves on the path to the future of JS, as well as increase the performance of the CLI

e18e

L-Mario564 commented 1 day ago

@kravetsone I'll be closing this issue to migrating everything from this repo onto the main one. Feel free to repost what you posted here onto the issue you made on the main repo.