• Will Chen's avatar
    Support shared modules for supabase edge functions (#1964) · 91cf1e97
    Will Chen 提交于
    Credit: thanks @SlayTheDragons whose PR
    https://github.com/dyad-sh/dyad/pull/1665 paved the way for this
    implementation.
    
    <!-- CURSOR_SUMMARY -->
    > [!NOTE]
    > Adds _shared module support for Supabase edge functions with
    import-map packaging and automatic redeploys; updates deployment to
    include full function directories plus shared files, and adds path
    utilities and tests.
    > 
    > - **Supabase Edge Functions**
    > - **Shared Modules Support**: Detect `_shared` changes and redeploy
    all functions; regular function changes deploy only that function.
    > - **Deployment Overhaul**: `deploySupabaseFunctions` now uploads full
    function directories plus `_shared` files via multipart form-data, sets
    `entrypoint_path`, and writes `import_map.json` (`_shared/` →
    `../_shared/`).
    > - **Function Discovery & Packaging**: Add file collection helpers
    (`listFilesWithStats`, `loadZipEntries`) and path utilities
    (`toPosixPath`, `findFunctionDirectory`, `stripSupabaseFunctionsPrefix`)
    with signature-based caching for `_shared`.
    > - **APIs & Utils**: Introduce `isSharedServerModule`, refine
    `isServerFunction` (excludes `_shared`), add
    `extractFunctionNameFromPath`, and `buildSignature`.
    > - **IPC Changes**
    > - Update file edit/rename/delete flows to track shared module edits
    and trigger full redeploys; otherwise deploy per-function using
    extracted name and `appPath`.
    > - **Prompts**
    >   - Document `_shared` usage and import pattern in Supabase prompt.
    > - **Tests**
    > - Add tests for function/shared detection, name extraction, path
    handling, and signature building.
    > 
    > <sup>Written by [Cursor
    Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
    f35599ec0e708e2ef6b7e78ae7901b29953a6dff. This will update automatically
    on new commits. Configure
    [here](https://cursor.com/dashboard?tab=bugbot).</sup>
    <!-- /CURSOR_SUMMARY -->
    
    
    
    
    
    
    
    
    
    <!-- This is an auto-generated description by cubic. -->
    ---
    ## Summary by cubic
    Adds support for shared modules for Supabase edge functions. Shared code
    in supabase/functions/_shared is now bundled via an import map and
    triggers redeploys across all functions when changed.
    
    - **New Features**
    - Detects shared modules in supabase/functions/_shared and redeploys all
    functions when they change.
    - Deploys full function directories plus shared files, and writes an
    import_map.json that resolves "_shared/" imports.
    - Auto-deploys only the affected function on file changes; switches to
    redeploy-all when a shared module is touched.
    
    - **Refactors**
    - deploySupabaseFunction now uploads multiple files (function + shared)
    using multipart form-data and sets entrypoint/import map.
    - Added file collection, path utilities, and shared-file caching via
    content signatures to reduce redundant reads.
    - Updated deployAllSupabaseFunctions to skip non-function dirs (e.g.,
    _shared) and use functionPath.
    - Added tests for function/shared detection, path handling, and
    signature building.
    
    <sup>Written for commit 302d84625d9e61477db9ada052a027b29ff18cef.
    Summary will update automatically on new commits.</sup>
    
    <!-- End of auto-generated description by cubic. -->
    91cf1e97
名称
最后提交
最后更新
.cursor/rules 正在载入提交数据...
.devcontainer 正在载入提交数据...
.github 正在载入提交数据...
.husky 正在载入提交数据...
assets 正在载入提交数据...
docs 正在载入提交数据...
drizzle 正在载入提交数据...
e2e-tests 正在载入提交数据...
packages/@dyad-sh 正在载入提交数据...
scaffold 正在载入提交数据...
scripts 正在载入提交数据...
shared 正在载入提交数据...
src 正在载入提交数据...
testing 正在载入提交数据...
tools 正在载入提交数据...
worker 正在载入提交数据...
workers/tsc 正在载入提交数据...
.cursorignore 正在载入提交数据...
.env.example 正在载入提交数据...
.eslintrc.json 正在载入提交数据...
.gitattributes 正在载入提交数据...
.gitignore 正在载入提交数据...
.oxlintrc.json 正在载入提交数据...
.prettierignore 正在载入提交数据...
.prettierrc 正在载入提交数据...
AGENTS.md 正在载入提交数据...
CONTRIBUTING.md 正在载入提交数据...
LICENSE 正在载入提交数据...
README.md 正在载入提交数据...
SECURITY.md 正在载入提交数据...
biome.json 正在载入提交数据...
components.json 正在载入提交数据...
drizzle.config.ts 正在载入提交数据...
forge.config.ts 正在载入提交数据...
forge.env.d.ts 正在载入提交数据...
index.html 正在载入提交数据...
merge.config.ts 正在载入提交数据...
package-lock.json 正在载入提交数据...
package.json 正在载入提交数据...
playwright.config.ts 正在载入提交数据...
tsconfig.app.json 正在载入提交数据...
tsconfig.json 正在载入提交数据...
tsconfig.node.json 正在载入提交数据...
vite.main.config.mts 正在载入提交数据...
vite.preload.config.mts 正在载入提交数据...
vite.renderer.config.mts 正在载入提交数据...
vite.worker.config.mts 正在载入提交数据...
vitest.config.ts 正在载入提交数据...