mirror of
https://github.com/supabase/supabase.git
synced 2026-09-08 19:08:44 +08:00
Closes DOCS-1057 Contributes to DOCS-1052 ## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## Problem We have hundreds of MDX lint warnings in our docs going against style best practices. ## Solution Remove and replace in context the following: - PostgreSQL. There was only one. There was concern about exceptions, but I found none. - Just - Quickly - Actually ### What changed Edits follow the [Google developer documentation style guide](https://developers.google.com/style): concise, direct, active voice. The flagged words were removed when the sentence still read well, or replaced when meaning needed to be preserved. ### Common patterns | Flagged word | Approach | Example | |---|---|---| | **just** (filler) | Removed | "you just installed" → "you installed" | | **just** (limiting) | **only** | "just one row" → "only one row" | | **just like** | **like** / **the same as** | "function just like regular users" → "function like regular users" | | **not just** | **not only** | "not just errors" → "not only errors" | | **quickly** (performance) | **efficiently** or removed | "find rows quickly" → "find rows efficiently" | | **quickly** (time) | **soon** / **rapidly** / removed | "expires too quickly" → "expires too soon" | | **actually** (filler) | Removed | "actually execute" → "execute"; "is actually the most common" → "is the most common" | ## Tophatting 1. See the diff. 2. See that content continues to make sense in context. 3. Locally, `cd apps/docs` and run `pnpm run lint:mdx`. 4. Search for "just," "actually," "quickly", and "PostgreSQL" and see there are 0 warnings. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Updated wording across quickstarts, guides, and troubleshooting articles for grammar, clarity, and consistent step-by-step phrasing. * Clarified key concepts including Row Level Security policy evaluation across Supabase products, deferred foreign key constraint behavior, and when `EXPLAIN ANALYZE` executes queries (and related side effects). * Refined several troubleshooting instructions and added guidance to cap log payload size to reduce billed Logs Ingest volume. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Nik Richers <nrichers@gmail.com> Co-authored-by: Chris Chinchilla <chris.ward@supabase.io>
88 lines
2.8 KiB
Plaintext
88 lines
2.8 KiB
Plaintext
---
|
|
title = "Edge Function dependency analysis"
|
|
topics = [ "functions" ]
|
|
keywords = [ "dependencies", "npm", "deno", "imports", "bundle", "optimization", "edge function" ]
|
|
database_id = "e079a9d0-419a-4e31-b7ec-1206d9012d0b"
|
|
---
|
|
|
|
Optimize your Edge Function dependencies for better performance. Large or unnecessary dependencies can significantly impact bundle size, boot time, and memory usage.
|
|
|
|
## Analyzing Deno dependencies
|
|
|
|
Start by analyzing your dependency tree to understand what's being imported:
|
|
|
|
```bash
|
|
# Basic dependency analysis
|
|
deno info /path/to/function/index.ts
|
|
|
|
# With import map (if using one)
|
|
deno info --import-map=/path/to/import_map.json /path/to/function/index.ts
|
|
```
|
|
|
|
## What to look for
|
|
|
|
Review the output for:
|
|
|
|
- **Large dependencies:** Packages that contribute significantly to bundle size
|
|
- **Redundant imports:** Multiple packages providing similar functionality
|
|
- **Outdated versions:** Dependencies that can be updated to more efficient versions
|
|
- **Unused imports:** Dependencies imported but not used in your code
|
|
|
|
## Optimizing NPM dependencies
|
|
|
|
When using NPM modules, keep their impact on bundle size in mind. Many NPM packages are designed for Node.js and may include unnecessary polyfills or large dependency trees.
|
|
|
|
### Use selective imports
|
|
|
|
Import specific submodules to minimize overhead:
|
|
|
|
```tsx
|
|
// Good: Import specific submodules
|
|
import { Sheets } from 'npm:@googleapis/sheets'
|
|
import * as googleAuth from 'npm:google-auth-library'
|
|
import { JWT } from 'npm:google-auth-library/build/src/auth/jwtclient'
|
|
// Avoid: Import entire package
|
|
import * as googleapis from 'npm:googleapis'
|
|
```
|
|
|
|
## Best practices
|
|
|
|
### Tree-shake aggressively
|
|
|
|
Only import what you use. Avoid wildcard imports (`import *`) when possible.
|
|
|
|
### Choose lightweight alternatives
|
|
|
|
Research smaller packages that provide the same functionality. Consider:
|
|
|
|
- Native Deno APIs instead of NPM polyfills
|
|
- Focused single-purpose packages instead of large utility libraries
|
|
|
|
### Bundle analysis
|
|
|
|
Use `deno info` before and after changes to measure the impact of dependency modifications.
|
|
|
|
### Version pinning
|
|
|
|
Lock dependency versions to avoid unexpected size increases from automatic updates:
|
|
|
|
```tsx
|
|
// Pin to specific version
|
|
import { something } from 'npm:package@1.2.3'
|
|
```
|
|
|
|
## Common heavy dependencies
|
|
|
|
Watch out for these commonly heavy packages:
|
|
|
|
- Full AWS SDK (use individual service packages instead)
|
|
- Moment.js (consider [`date-fns`](https://date-fns.org/)) or native Date APIs)
|
|
- Lodash (import specific functions: `lodash/get`)
|
|
- Full Google APIs (use specific service packages)
|
|
|
|
## Additional resources
|
|
|
|
- [Bundle size issues](./edge-function-bundle-size-issues)
|
|
- [Edge Function takes too long to respond](./edge-function-takes-too-long-to-respond)
|
|
- [Edge Function limits](/docs/guides/functions/limits)
|