convex 1.46.0 → 1.48.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +58 -1
- package/dist/browser.bundle.js +7 -1
- package/dist/browser.bundle.js.map +2 -2
- package/dist/cjs/bundler/context.js +7 -5
- package/dist/cjs/bundler/context.js.map +2 -2
- package/dist/cjs/bundler/fs.js +47 -6
- package/dist/cjs/bundler/fs.js.map +2 -2
- package/dist/cjs/bundler/index.js +5 -4
- package/dist/cjs/bundler/index.js.map +2 -2
- package/dist/cjs/cli/account.js +237 -0
- package/dist/cjs/cli/account.js.map +7 -0
- package/dist/cjs/cli/codegen.js +0 -4
- package/dist/cjs/cli/codegen.js.map +2 -2
- package/dist/cjs/cli/configure.js +28 -6
- package/dist/cjs/cli/configure.js.map +2 -2
- package/dist/cjs/cli/deploy.js +27 -2
- package/dist/cjs/cli/deploy.js.map +2 -2
- package/dist/cjs/cli/deploymentSelect.js +2 -2
- package/dist/cjs/cli/deploymentSelect.js.map +2 -2
- package/dist/cjs/cli/dev.js +6 -0
- package/dist/cjs/cli/dev.js.map +2 -2
- package/dist/cjs/cli/env.js +10 -5
- package/dist/cjs/cli/env.js.map +2 -2
- package/dist/cjs/cli/envDefault.js +7 -2
- package/dist/cjs/cli/envDefault.js.map +2 -2
- package/dist/cjs/cli/generatedApi.js.map +1 -1
- package/dist/cjs/cli/lib/api.js +2 -0
- package/dist/cjs/cli/lib/api.js.map +2 -2
- package/dist/cjs/cli/lib/checkForLargeIndexBackfill.js +113 -0
- package/dist/cjs/cli/lib/checkForLargeIndexBackfill.js.map +7 -0
- package/dist/cjs/cli/lib/checkForLargeIndexDeletion.js +36 -47
- package/dist/cjs/cli/lib/checkForLargeIndexDeletion.js.map +2 -2
- package/dist/cjs/cli/lib/checkForSlowSchemaValidation.js +58 -39
- package/dist/cjs/cli/lib/checkForSlowSchemaValidation.js.map +2 -2
- package/dist/cjs/cli/lib/checkForStagedValidatorDeletion.js +90 -0
- package/dist/cjs/cli/lib/checkForStagedValidatorDeletion.js.map +7 -0
- package/dist/cjs/cli/lib/codegen.js.map +2 -2
- package/dist/cjs/cli/lib/command.js +2 -1
- package/dist/cjs/cli/lib/command.js.map +2 -2
- package/dist/cjs/cli/lib/components/definition/bundle.js +37 -11
- package/dist/cjs/cli/lib/components/definition/bundle.js.map +2 -2
- package/dist/cjs/cli/lib/components.js +48 -5
- package/dist/cjs/cli/lib/components.js.map +2 -2
- package/dist/cjs/cli/lib/config.js +56 -17
- package/dist/cjs/cli/lib/config.js.map +2 -2
- package/dist/cjs/cli/lib/deploy2.js +3 -1
- package/dist/cjs/cli/lib/deploy2.js.map +2 -2
- package/dist/cjs/cli/lib/deployApi/evaluateSchema.js +30 -2
- package/dist/cjs/cli/lib/deployApi/evaluateSchema.js.map +2 -2
- package/dist/cjs/cli/lib/deployKeyWarning.js +43 -0
- package/dist/cjs/cli/lib/deployKeyWarning.js.map +7 -0
- package/dist/cjs/cli/lib/deployment.js +2 -0
- package/dist/cjs/cli/lib/deployment.js.map +2 -2
- package/dist/cjs/cli/lib/deploymentSelection.js +27 -18
- package/dist/cjs/cli/lib/deploymentSelection.js.map +2 -2
- package/dist/cjs/cli/lib/dev.js +5 -0
- package/dist/cjs/cli/lib/dev.js.map +2 -2
- package/dist/cjs/cli/lib/envvars.js +32 -0
- package/dist/cjs/cli/lib/envvars.js.map +2 -2
- package/dist/cjs/cli/lib/formatValidationProgress.js +47 -0
- package/dist/cjs/cli/lib/formatValidationProgress.js.map +7 -0
- package/dist/cjs/cli/lib/fsUtils.js +1 -1
- package/dist/cjs/cli/lib/fsUtils.js.map +2 -2
- package/dist/cjs/cli/lib/generateDocs.js +1 -1
- package/dist/cjs/cli/lib/generateDocs.js.map +1 -1
- package/dist/cjs/cli/lib/indexes.js.map +1 -1
- package/dist/cjs/cli/lib/login.js +28 -4
- package/dist/cjs/cli/lib/login.js.map +2 -2
- package/dist/cjs/cli/lib/mcp/requestContext.js +5 -1
- package/dist/cjs/cli/lib/mcp/requestContext.js.map +2 -2
- package/dist/cjs/cli/lib/mcp/tools/env.js +10 -3
- package/dist/cjs/cli/lib/mcp/tools/env.js.map +2 -2
- package/dist/cjs/cli/lib/profileManagement.js +196 -0
- package/dist/cjs/cli/lib/profileManagement.js.map +7 -0
- package/dist/cjs/cli/lib/profiles.js +333 -0
- package/dist/cjs/cli/lib/profiles.js.map +7 -0
- package/dist/cjs/cli/lib/run.js +4 -0
- package/dist/cjs/cli/lib/run.js.map +2 -2
- package/dist/cjs/cli/lib/schemaEvaluation.js +62 -0
- package/dist/cjs/cli/lib/schemaEvaluation.js.map +7 -0
- package/dist/cjs/cli/lib/usageLimits.js +4 -2
- package/dist/cjs/cli/lib/usageLimits.js.map +2 -2
- package/dist/cjs/cli/lib/utils/mutex.js +9 -24
- package/dist/cjs/cli/lib/utils/mutex.js.map +2 -2
- package/dist/cjs/cli/lib/utils/utils.js +66 -27
- package/dist/cjs/cli/lib/utils/utils.js.map +2 -2
- package/dist/cjs/cli/login.js +213 -114
- package/dist/cjs/cli/login.js.map +3 -3
- package/dist/cjs/cli/logout.js +113 -12
- package/dist/cjs/cli/logout.js.map +3 -3
- package/dist/cjs/cli/mcp.js +43 -10
- package/dist/cjs/cli/mcp.js.map +3 -3
- package/dist/cjs/cli/program.js +2 -1
- package/dist/cjs/cli/program.js.map +2 -2
- package/dist/cjs/cli/projectCreate.js +1 -1
- package/dist/cjs/cli/projectCreate.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/server/impl/actions_impl.js +8 -3
- package/dist/cjs/server/impl/actions_impl.js.map +2 -2
- package/dist/cjs/server/impl/storage_impl.js +29 -0
- package/dist/cjs/server/impl/storage_impl.js.map +2 -2
- package/dist/cjs/server/index.js +1 -0
- package/dist/cjs/server/index.js.map +2 -2
- package/dist/cjs/server/meta.js.map +1 -1
- package/dist/cjs/server/registration.js.map +1 -1
- package/dist/cjs/server/schema.js +34 -12
- package/dist/cjs/server/schema.js.map +2 -2
- package/dist/cjs/server/storage.js.map +1 -1
- package/dist/cjs/values/validators.js +1 -1
- package/dist/cjs/values/validators.js.map +2 -2
- package/dist/cjs/values/value.js +6 -0
- package/dist/cjs/values/value.js.map +2 -2
- package/dist/cjs-types/bundler/context.d.ts +5 -0
- package/dist/cjs-types/bundler/context.d.ts.map +1 -1
- package/dist/cjs-types/bundler/fs.d.ts +7 -2
- package/dist/cjs-types/bundler/fs.d.ts.map +1 -1
- package/dist/cjs-types/bundler/index.d.ts +9 -2
- package/dist/cjs-types/bundler/index.d.ts.map +1 -1
- package/dist/cjs-types/cli/account.d.ts +6 -0
- package/dist/cjs-types/cli/account.d.ts.map +1 -0
- package/dist/cjs-types/cli/codegen.d.ts.map +1 -1
- package/dist/cjs-types/cli/configure.d.ts +6 -0
- package/dist/cjs-types/cli/configure.d.ts.map +1 -1
- package/dist/cjs-types/cli/deploy.d.ts +2 -0
- package/dist/cjs-types/cli/deploy.d.ts.map +1 -1
- package/dist/cjs-types/cli/deploymentCreate.d.ts +6 -6
- package/dist/cjs-types/cli/deploymentSelect.d.ts.map +1 -1
- package/dist/cjs-types/cli/dev.d.ts +1 -0
- package/dist/cjs-types/cli/dev.d.ts.map +1 -1
- package/dist/cjs-types/cli/env.d.ts.map +1 -1
- package/dist/cjs-types/cli/envDefault.d.ts.map +1 -1
- package/dist/cjs-types/cli/generatedApi.d.ts +1 -1
- package/dist/cjs-types/cli/generatedApi.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/api.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/checkForLargeIndexBackfill.d.ts +30 -0
- package/dist/cjs-types/cli/lib/checkForLargeIndexBackfill.d.ts.map +1 -0
- package/dist/cjs-types/cli/lib/checkForLargeIndexDeletion.d.ts +5 -7
- package/dist/cjs-types/cli/lib/checkForLargeIndexDeletion.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/checkForSlowSchemaValidation.d.ts +4 -10
- package/dist/cjs-types/cli/lib/checkForSlowSchemaValidation.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/checkForStagedValidatorDeletion.d.ts +17 -0
- package/dist/cjs-types/cli/lib/checkForStagedValidatorDeletion.d.ts.map +1 -0
- package/dist/cjs-types/cli/lib/codegen.d.ts +0 -3
- package/dist/cjs-types/cli/lib/codegen.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/command.d.ts +2 -0
- package/dist/cjs-types/cli/lib/command.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/components/definition/bundle.d.ts +13 -0
- package/dist/cjs-types/cli/lib/components/definition/bundle.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/components.d.ts +4 -0
- package/dist/cjs-types/cli/lib/components.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/config.d.ts +2 -1
- package/dist/cjs-types/cli/lib/config.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/deploy2.d.ts +2 -0
- package/dist/cjs-types/cli/lib/deploy2.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/deployApi/evaluateSchema.d.ts +460 -16
- package/dist/cjs-types/cli/lib/deployApi/evaluateSchema.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/deployKeyWarning.d.ts +3 -0
- package/dist/cjs-types/cli/lib/deployKeyWarning.d.ts.map +1 -0
- package/dist/cjs-types/cli/lib/deployment.d.ts +2 -0
- package/dist/cjs-types/cli/lib/deployment.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/deploymentSelection.d.ts +2 -1
- package/dist/cjs-types/cli/lib/deploymentSelection.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/dev.d.ts +1 -0
- package/dist/cjs-types/cli/lib/dev.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/envvars.d.ts +6 -0
- package/dist/cjs-types/cli/lib/envvars.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/formatValidationProgress.d.ts +8 -0
- package/dist/cjs-types/cli/lib/formatValidationProgress.d.ts.map +1 -0
- package/dist/cjs-types/cli/lib/fsUtils.d.ts +1 -0
- package/dist/cjs-types/cli/lib/fsUtils.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/login.d.ts +3 -1
- package/dist/cjs-types/cli/lib/login.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/mcp/requestContext.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/mcp/tools/env.d.ts +8 -5
- package/dist/cjs-types/cli/lib/mcp/tools/env.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/mcp/tools/insights.d.ts +2 -2
- package/dist/cjs-types/cli/lib/profileManagement.d.ts +10 -0
- package/dist/cjs-types/cli/lib/profileManagement.d.ts.map +1 -0
- package/dist/cjs-types/cli/lib/profiles.d.ts +59 -0
- package/dist/cjs-types/cli/lib/profiles.d.ts.map +1 -0
- package/dist/cjs-types/cli/lib/run.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/schemaEvaluation.d.ts +33 -0
- package/dist/cjs-types/cli/lib/schemaEvaluation.d.ts.map +1 -0
- package/dist/cjs-types/cli/lib/usageLimits.d.ts +1 -1
- package/dist/cjs-types/cli/lib/usageLimits.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/utils/mutex.d.ts +1 -3
- package/dist/cjs-types/cli/lib/utils/mutex.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/utils/utils.d.ts +15 -2
- package/dist/cjs-types/cli/lib/utils/utils.d.ts.map +1 -1
- package/dist/cjs-types/cli/login.d.ts +21 -0
- package/dist/cjs-types/cli/login.d.ts.map +1 -1
- package/dist/cjs-types/cli/logout.d.ts +8 -1
- package/dist/cjs-types/cli/logout.d.ts.map +1 -1
- package/dist/cjs-types/cli/mcp.d.ts.map +1 -1
- package/dist/cjs-types/cli/program.d.ts.map +1 -1
- package/dist/cjs-types/index.d.ts +1 -1
- package/dist/cjs-types/index.d.ts.map +1 -1
- package/dist/cjs-types/server/impl/actions_impl.d.ts +18 -3
- package/dist/cjs-types/server/impl/actions_impl.d.ts.map +1 -1
- package/dist/cjs-types/server/impl/storage_impl.d.ts.map +1 -1
- package/dist/cjs-types/server/index.d.ts +1 -1
- package/dist/cjs-types/server/index.d.ts.map +1 -1
- package/dist/cjs-types/server/meta.d.ts +63 -0
- package/dist/cjs-types/server/meta.d.ts.map +1 -1
- package/dist/cjs-types/server/registration.d.ts +10 -0
- package/dist/cjs-types/server/registration.d.ts.map +1 -1
- package/dist/cjs-types/server/schema.d.ts +33 -0
- package/dist/cjs-types/server/schema.d.ts.map +1 -1
- package/dist/cjs-types/server/storage.d.ts.map +1 -1
- package/dist/cjs-types/values/value.d.ts.map +1 -1
- package/dist/cli.bundle.cjs +4889 -2980
- package/dist/cli.bundle.cjs.map +4 -4
- package/dist/esm/bundler/context.js +7 -5
- package/dist/esm/bundler/context.js.map +2 -2
- package/dist/esm/bundler/fs.js +47 -6
- package/dist/esm/bundler/fs.js.map +2 -2
- package/dist/esm/bundler/index.js +5 -4
- package/dist/esm/bundler/index.js.map +2 -2
- package/dist/esm/cli/account.js +221 -0
- package/dist/esm/cli/account.js.map +7 -0
- package/dist/esm/cli/codegen.js +0 -4
- package/dist/esm/cli/codegen.js.map +2 -2
- package/dist/esm/cli/configure.js +27 -6
- package/dist/esm/cli/configure.js.map +2 -2
- package/dist/esm/cli/deploy.js +27 -2
- package/dist/esm/cli/deploy.js.map +2 -2
- package/dist/esm/cli/deploymentSelect.js +6 -3
- package/dist/esm/cli/deploymentSelect.js.map +2 -2
- package/dist/esm/cli/dev.js +6 -0
- package/dist/esm/cli/dev.js.map +2 -2
- package/dist/esm/cli/env.js +11 -6
- package/dist/esm/cli/env.js.map +2 -2
- package/dist/esm/cli/envDefault.js +7 -2
- package/dist/esm/cli/envDefault.js.map +2 -2
- package/dist/esm/cli/lib/api.js +2 -0
- package/dist/esm/cli/lib/api.js.map +2 -2
- package/dist/esm/cli/lib/checkForLargeIndexBackfill.js +95 -0
- package/dist/esm/cli/lib/checkForLargeIndexBackfill.js.map +7 -0
- package/dist/esm/cli/lib/checkForLargeIndexDeletion.js +37 -48
- package/dist/esm/cli/lib/checkForLargeIndexDeletion.js.map +2 -2
- package/dist/esm/cli/lib/checkForSlowSchemaValidation.js +63 -41
- package/dist/esm/cli/lib/checkForSlowSchemaValidation.js.map +2 -2
- package/dist/esm/cli/lib/checkForStagedValidatorDeletion.js +68 -0
- package/dist/esm/cli/lib/checkForStagedValidatorDeletion.js.map +7 -0
- package/dist/esm/cli/lib/codegen.js.map +2 -2
- package/dist/esm/cli/lib/command.js +2 -1
- package/dist/esm/cli/lib/command.js.map +2 -2
- package/dist/esm/cli/lib/components/definition/bundle.js +37 -11
- package/dist/esm/cli/lib/components/definition/bundle.js.map +2 -2
- package/dist/esm/cli/lib/components.js +55 -5
- package/dist/esm/cli/lib/components.js.map +2 -2
- package/dist/esm/cli/lib/config.js +55 -17
- package/dist/esm/cli/lib/config.js.map +2 -2
- package/dist/esm/cli/lib/deploy2.js +3 -1
- package/dist/esm/cli/lib/deploy2.js.map +2 -2
- package/dist/esm/cli/lib/deployApi/evaluateSchema.js +28 -2
- package/dist/esm/cli/lib/deployApi/evaluateSchema.js.map +2 -2
- package/dist/esm/cli/lib/deployKeyWarning.js +27 -0
- package/dist/esm/cli/lib/deployKeyWarning.js.map +7 -0
- package/dist/esm/cli/lib/deployment.js +2 -2
- package/dist/esm/cli/lib/deployment.js.map +2 -2
- package/dist/esm/cli/lib/deploymentSelection.js +35 -20
- package/dist/esm/cli/lib/deploymentSelection.js.map +2 -2
- package/dist/esm/cli/lib/dev.js +5 -0
- package/dist/esm/cli/lib/dev.js.map +2 -2
- package/dist/esm/cli/lib/envvars.js +35 -1
- package/dist/esm/cli/lib/envvars.js.map +2 -2
- package/dist/esm/cli/lib/formatValidationProgress.js +24 -0
- package/dist/esm/cli/lib/formatValidationProgress.js.map +7 -0
- package/dist/esm/cli/lib/fsUtils.js +1 -1
- package/dist/esm/cli/lib/fsUtils.js.map +2 -2
- package/dist/esm/cli/lib/generateDocs.js +1 -1
- package/dist/esm/cli/lib/generateDocs.js.map +1 -1
- package/dist/esm/cli/lib/indexes.js.map +1 -1
- package/dist/esm/cli/lib/login.js +36 -4
- package/dist/esm/cli/lib/login.js.map +2 -2
- package/dist/esm/cli/lib/mcp/requestContext.js +5 -1
- package/dist/esm/cli/lib/mcp/requestContext.js.map +2 -2
- package/dist/esm/cli/lib/mcp/tools/env.js +10 -3
- package/dist/esm/cli/lib/mcp/tools/env.js.map +2 -2
- package/dist/esm/cli/lib/profileManagement.js +179 -0
- package/dist/esm/cli/lib/profileManagement.js.map +7 -0
- package/dist/esm/cli/lib/profiles.js +288 -0
- package/dist/esm/cli/lib/profiles.js.map +7 -0
- package/dist/esm/cli/lib/run.js +4 -0
- package/dist/esm/cli/lib/run.js.map +2 -2
- package/dist/esm/cli/lib/schemaEvaluation.js +39 -0
- package/dist/esm/cli/lib/schemaEvaluation.js.map +7 -0
- package/dist/esm/cli/lib/usageLimits.js +4 -2
- package/dist/esm/cli/lib/usageLimits.js.map +2 -2
- package/dist/esm/cli/lib/utils/mutex.js +9 -24
- package/dist/esm/cli/lib/utils/mutex.js.map +2 -2
- package/dist/esm/cli/lib/utils/utils.js +63 -27
- package/dist/esm/cli/lib/utils/utils.js.map +2 -2
- package/dist/esm/cli/login.js +225 -112
- package/dist/esm/cli/login.js.map +3 -3
- package/dist/esm/cli/logout.js +110 -13
- package/dist/esm/cli/logout.js.map +2 -2
- package/dist/esm/cli/mcp.js +34 -10
- package/dist/esm/cli/mcp.js.map +2 -2
- package/dist/esm/cli/program.js +2 -1
- package/dist/esm/cli/program.js.map +2 -2
- package/dist/esm/cli/projectCreate.js +1 -1
- package/dist/esm/cli/projectCreate.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/server/impl/actions_impl.js +7 -3
- package/dist/esm/server/impl/actions_impl.js.map +2 -2
- package/dist/esm/server/impl/storage_impl.js +29 -0
- package/dist/esm/server/impl/storage_impl.js.map +2 -2
- package/dist/esm/server/index.js +4 -1
- package/dist/esm/server/index.js.map +2 -2
- package/dist/esm/server/schema.js +34 -12
- package/dist/esm/server/schema.js.map +2 -2
- package/dist/esm/values/validators.js +1 -1
- package/dist/esm/values/validators.js.map +2 -2
- package/dist/esm/values/value.js +6 -0
- package/dist/esm/values/value.js.map +2 -2
- package/dist/esm-types/bundler/context.d.ts +5 -0
- package/dist/esm-types/bundler/context.d.ts.map +1 -1
- package/dist/esm-types/bundler/fs.d.ts +7 -2
- package/dist/esm-types/bundler/fs.d.ts.map +1 -1
- package/dist/esm-types/bundler/index.d.ts +9 -2
- package/dist/esm-types/bundler/index.d.ts.map +1 -1
- package/dist/esm-types/cli/account.d.ts +6 -0
- package/dist/esm-types/cli/account.d.ts.map +1 -0
- package/dist/esm-types/cli/codegen.d.ts.map +1 -1
- package/dist/esm-types/cli/configure.d.ts +6 -0
- package/dist/esm-types/cli/configure.d.ts.map +1 -1
- package/dist/esm-types/cli/deploy.d.ts +2 -0
- package/dist/esm-types/cli/deploy.d.ts.map +1 -1
- package/dist/esm-types/cli/deploymentCreate.d.ts +6 -6
- package/dist/esm-types/cli/deploymentSelect.d.ts.map +1 -1
- package/dist/esm-types/cli/dev.d.ts +1 -0
- package/dist/esm-types/cli/dev.d.ts.map +1 -1
- package/dist/esm-types/cli/env.d.ts.map +1 -1
- package/dist/esm-types/cli/envDefault.d.ts.map +1 -1
- package/dist/esm-types/cli/generatedApi.d.ts +1 -1
- package/dist/esm-types/cli/generatedApi.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/api.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/checkForLargeIndexBackfill.d.ts +30 -0
- package/dist/esm-types/cli/lib/checkForLargeIndexBackfill.d.ts.map +1 -0
- package/dist/esm-types/cli/lib/checkForLargeIndexDeletion.d.ts +5 -7
- package/dist/esm-types/cli/lib/checkForLargeIndexDeletion.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/checkForSlowSchemaValidation.d.ts +4 -10
- package/dist/esm-types/cli/lib/checkForSlowSchemaValidation.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/checkForStagedValidatorDeletion.d.ts +17 -0
- package/dist/esm-types/cli/lib/checkForStagedValidatorDeletion.d.ts.map +1 -0
- package/dist/esm-types/cli/lib/codegen.d.ts +0 -3
- package/dist/esm-types/cli/lib/codegen.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/command.d.ts +2 -0
- package/dist/esm-types/cli/lib/command.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/components/definition/bundle.d.ts +13 -0
- package/dist/esm-types/cli/lib/components/definition/bundle.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/components.d.ts +4 -0
- package/dist/esm-types/cli/lib/components.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/config.d.ts +2 -1
- package/dist/esm-types/cli/lib/config.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/deploy2.d.ts +2 -0
- package/dist/esm-types/cli/lib/deploy2.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/deployApi/evaluateSchema.d.ts +460 -16
- package/dist/esm-types/cli/lib/deployApi/evaluateSchema.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/deployKeyWarning.d.ts +3 -0
- package/dist/esm-types/cli/lib/deployKeyWarning.d.ts.map +1 -0
- package/dist/esm-types/cli/lib/deployment.d.ts +2 -0
- package/dist/esm-types/cli/lib/deployment.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/deploymentSelection.d.ts +2 -1
- package/dist/esm-types/cli/lib/deploymentSelection.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/dev.d.ts +1 -0
- package/dist/esm-types/cli/lib/dev.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/envvars.d.ts +6 -0
- package/dist/esm-types/cli/lib/envvars.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/formatValidationProgress.d.ts +8 -0
- package/dist/esm-types/cli/lib/formatValidationProgress.d.ts.map +1 -0
- package/dist/esm-types/cli/lib/fsUtils.d.ts +1 -0
- package/dist/esm-types/cli/lib/fsUtils.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/login.d.ts +3 -1
- package/dist/esm-types/cli/lib/login.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/mcp/requestContext.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/mcp/tools/env.d.ts +8 -5
- package/dist/esm-types/cli/lib/mcp/tools/env.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/mcp/tools/insights.d.ts +2 -2
- package/dist/esm-types/cli/lib/profileManagement.d.ts +10 -0
- package/dist/esm-types/cli/lib/profileManagement.d.ts.map +1 -0
- package/dist/esm-types/cli/lib/profiles.d.ts +59 -0
- package/dist/esm-types/cli/lib/profiles.d.ts.map +1 -0
- package/dist/esm-types/cli/lib/run.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/schemaEvaluation.d.ts +33 -0
- package/dist/esm-types/cli/lib/schemaEvaluation.d.ts.map +1 -0
- package/dist/esm-types/cli/lib/usageLimits.d.ts +1 -1
- package/dist/esm-types/cli/lib/usageLimits.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/utils/mutex.d.ts +1 -3
- package/dist/esm-types/cli/lib/utils/mutex.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/utils/utils.d.ts +15 -2
- package/dist/esm-types/cli/lib/utils/utils.d.ts.map +1 -1
- package/dist/esm-types/cli/login.d.ts +21 -0
- package/dist/esm-types/cli/login.d.ts.map +1 -1
- package/dist/esm-types/cli/logout.d.ts +8 -1
- package/dist/esm-types/cli/logout.d.ts.map +1 -1
- package/dist/esm-types/cli/mcp.d.ts.map +1 -1
- package/dist/esm-types/cli/program.d.ts.map +1 -1
- package/dist/esm-types/index.d.ts +1 -1
- package/dist/esm-types/index.d.ts.map +1 -1
- package/dist/esm-types/server/impl/actions_impl.d.ts +18 -3
- package/dist/esm-types/server/impl/actions_impl.d.ts.map +1 -1
- package/dist/esm-types/server/impl/storage_impl.d.ts.map +1 -1
- package/dist/esm-types/server/index.d.ts +1 -1
- package/dist/esm-types/server/index.d.ts.map +1 -1
- package/dist/esm-types/server/meta.d.ts +63 -0
- package/dist/esm-types/server/meta.d.ts.map +1 -1
- package/dist/esm-types/server/registration.d.ts +10 -0
- package/dist/esm-types/server/registration.d.ts.map +1 -1
- package/dist/esm-types/server/schema.d.ts +33 -0
- package/dist/esm-types/server/schema.d.ts.map +1 -1
- package/dist/esm-types/server/storage.d.ts.map +1 -1
- package/dist/esm-types/values/value.d.ts.map +1 -1
- package/dist/react.bundle.js +7 -1
- package/dist/react.bundle.js.map +2 -2
- package/package.json +5 -5
- package/schemas/convex.schema.json +5 -5
- package/src/bundler/context.ts +9 -5
- package/src/bundler/fs.ts +54 -5
- package/src/bundler/index.ts +9 -4
- package/src/cli/account.ts +320 -0
- package/src/cli/codegen.ts +0 -2
- package/src/cli/configure.ts +45 -9
- package/src/cli/deploy.ts +36 -5
- package/src/cli/deploymentSelect.ts +7 -4
- package/src/cli/dev.ts +9 -0
- package/src/cli/env.ts +12 -6
- package/src/cli/envDefault.ts +8 -2
- package/src/cli/generatedApi.ts +1 -1
- package/src/cli/lib/api.ts +5 -1
- package/src/cli/lib/checkForLargeIndexBackfill.ts +173 -0
- package/src/cli/lib/checkForLargeIndexDeletion.ts +45 -58
- package/src/cli/lib/checkForSlowSchemaValidation.ts +76 -65
- package/src/cli/lib/checkForStagedValidatorDeletion.ts +104 -0
- package/src/cli/lib/codegen.ts +0 -3
- package/src/cli/lib/command.ts +3 -0
- package/src/cli/lib/components/definition/bundle.ts +68 -14
- package/src/cli/lib/components.ts +71 -4
- package/src/cli/lib/config.ts +85 -18
- package/src/cli/lib/deploy2.ts +10 -1
- package/src/cli/lib/deployApi/evaluateSchema.ts +35 -0
- package/src/cli/lib/deployKeyWarning.ts +43 -0
- package/src/cli/lib/deployment.ts +2 -2
- package/src/cli/lib/deploymentSelection.ts +37 -18
- package/src/cli/lib/dev.ts +14 -0
- package/src/cli/lib/envvars.ts +43 -1
- package/src/cli/lib/formatValidationProgress.ts +35 -0
- package/src/cli/lib/fsUtils.ts +5 -2
- package/src/cli/lib/generateDocs.ts +1 -1
- package/src/cli/lib/indexes.ts +1 -1
- package/src/cli/lib/login.ts +47 -3
- package/src/cli/lib/mcp/requestContext.ts +7 -1
- package/src/cli/lib/mcp/tools/env.ts +17 -3
- package/src/cli/lib/profileManagement.ts +262 -0
- package/src/cli/lib/profiles.ts +398 -0
- package/src/cli/lib/run.ts +2 -0
- package/src/cli/lib/schemaEvaluation.ts +88 -0
- package/src/cli/lib/usageLimits.ts +2 -0
- package/src/cli/lib/utils/mutex.ts +9 -27
- package/src/cli/lib/utils/utils.ts +83 -36
- package/src/cli/login.ts +293 -168
- package/src/cli/logout.ts +142 -17
- package/src/cli/mcp.ts +48 -11
- package/src/cli/program.ts +2 -0
- package/src/cli/projectCreate.ts +1 -1
- package/src/index.ts +1 -1
- package/src/server/impl/actions_impl.ts +26 -6
- package/src/server/impl/storage_impl.ts +30 -0
- package/src/server/index.ts +5 -1
- package/src/server/meta.ts +56 -2
- package/src/server/registration.ts +10 -0
- package/src/server/schema.ts +37 -15
- package/src/server/storage.ts +17 -0
- package/src/values/validators.ts +1 -1
- package/src/values/value.ts +9 -5
|
@@ -118,11 +118,13 @@ const oneoffContext = async (args) => {
|
|
|
118
118
|
ctx,
|
|
119
119
|
!!process.env.CONVEX_IGNORE_SUSPICIOUS_ENV_VARS
|
|
120
120
|
);
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
121
|
+
if (!args.skipAuth) {
|
|
122
|
+
await (0, import_deploymentSelection.initializeBigBrainAuth)(ctx, {
|
|
123
|
+
url: args.url,
|
|
124
|
+
adminKey: args.adminKey,
|
|
125
|
+
envFile: args.envFile
|
|
126
|
+
});
|
|
127
|
+
}
|
|
126
128
|
return ctx;
|
|
127
129
|
};
|
|
128
130
|
//# sourceMappingURL=context.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/bundler/context.ts"],
|
|
4
|
-
"sourcesContent": ["import * as Sentry from \"@sentry/node\";\nimport { Ora } from \"ora\";\nimport { Filesystem, nodeFs } from \"./fs.js\";\nimport { initializeBigBrainAuth } from \"../cli/lib/deploymentSelection.js\";\nimport { detectSuspiciousEnvironmentVariables } from \"../cli/lib/envvars.js\";\nimport { logFailure, logVerbose } from \"./log.js\";\n// How the error should be handled when running `npx convex dev`.\nexport type ErrorType =\n // The error was likely caused by the state of the developer's local\n // file system (e.g. `tsc` fails due to a syntax error). The `convex dev`\n // command will then print out the error and wait for the file to change before\n // retrying.\n | \"invalid filesystem data\"\n // The error was caused by either the local state (ie schema.ts content)\n // or the state of the db (ie documents not matching the new schema).\n // The `convex dev` command will wait for either file OR table data change\n // to retry (if a table name is specified as the value in this Object).\n | {\n \"invalid filesystem or db data\": {\n tableName: string;\n componentPath?: string;\n } | null;\n }\n // The error was caused by either the local state (ie schema.ts content)\n // or the state of the deployment environment variables.\n // The `convex dev` command will wait for either file OR env var change\n // before retrying.\n | \"invalid filesystem or env vars\"\n // The error was some transient issue (e.g. a network\n // error). This will then cause a retry after an exponential backoff.\n | \"transient\"\n // This error was caught, handled, and now all that needs to happen\n // is for the proces to restart. No error is logged or reported.\n | \"already handled\"\n // This error is truly permanent. Exit `npx convex dev` because the\n // developer will need to take a manual commandline action.\n | \"fatal\";\n\nexport type BigBrainAuth = {\n header: string;\n} & (\n | {\n kind: \"projectKey\";\n projectKey: string;\n }\n | {\n kind: \"deploymentKey\";\n deploymentKey: string;\n }\n | {\n kind: \"previewDeployKey\";\n previewDeployKey: string;\n }\n | {\n kind: \"accessToken\";\n accessToken: string;\n }\n);\n\nexport interface Context {\n fs: Filesystem;\n deprecationMessagePrinted: boolean;\n // Reports to Sentry and either throws FatalError or exits the process.\n // Prints the `printedMessage` if provided\n crash(args: {\n exitCode: number;\n errorType: ErrorType;\n errForSentry?: any;\n printedMessage: string | null;\n }): Promise<never>;\n registerCleanup(fn: (exitCode: number, err?: any) => Promise<void>): string;\n removeCleanup(\n handle: string,\n ): (exitCode: number, err?: any) => Promise<void> | null;\n bigBrainAuth(): BigBrainAuth | null;\n /**\n * Prefer using `updateBigBrainAuthAfterLogin` in `deploymentSelection.ts` instead\n */\n _updateBigBrainAuth(auth: BigBrainAuth | null): void;\n}\n\nasync function flushAndExit(exitCode: number, err?: any) {\n if (err) {\n Sentry.captureException(err);\n }\n await Sentry.close();\n return process.exit(exitCode);\n}\n\nexport type OneoffCtx = Context & {\n // Generally `ctx.crash` is better to use since it handles printing a message\n // for the user, and then calls this.\n //\n // This function reports to Sentry + exits the process, but does not handle\n // printing a message for the user.\n flushAndExit: (exitCode: number, err?: any) => Promise<never>;\n};\n\nclass OneoffContextImpl {\n private _cleanupFns: Record<\n string,\n (exitCode: number, err?: any) => Promise<void>\n > = {};\n public fs: Filesystem = nodeFs;\n public deprecationMessagePrinted: boolean = false;\n public spinner: Ora | undefined = undefined;\n private _bigBrainAuth: BigBrainAuth | null = null;\n\n crash = async (args: {\n exitCode: number;\n errorType?: ErrorType;\n errForSentry?: any;\n printedMessage: string | null;\n }) => {\n if (args.printedMessage !== null) {\n logFailure(args.printedMessage);\n }\n return await this.flushAndExit(args.exitCode, args.errForSentry);\n };\n flushAndExit = async (exitCode: number, err?: any) => {\n logVerbose(\"Flushing and exiting, error:\", err);\n if (err) {\n logVerbose(err.stack);\n }\n const cleanupFns = this._cleanupFns;\n // Clear the cleanup functions so that there's no risk of running them twice\n // if this somehow gets triggered twice.\n this._cleanupFns = {};\n const fns = Object.values(cleanupFns);\n logVerbose(`Running ${fns.length} cleanup functions`);\n for (const fn of fns) {\n await fn(exitCode, err);\n }\n logVerbose(\"All cleanup functions ran\");\n return flushAndExit(exitCode, err);\n };\n registerCleanup(fn: (exitCode: number, err?: any) => Promise<void>) {\n const handle = Math.random().toString(36).slice(2);\n this._cleanupFns[handle] = fn;\n return handle;\n }\n removeCleanup(handle: string) {\n const value = this._cleanupFns[handle];\n delete this._cleanupFns[handle];\n return value ?? null;\n }\n bigBrainAuth(): BigBrainAuth | null {\n return this._bigBrainAuth;\n }\n _updateBigBrainAuth(auth: BigBrainAuth | null): void {\n logVerbose(`Updating big brain auth to ${auth?.kind ?? \"null\"}`);\n this._bigBrainAuth = auth;\n }\n}\n\n/**\n * Install a SIGINT handler that gracefully exits via ctx.flushAndExit.\n *\n * `bun run` and `npm run` can deliver a duplicate SIGINT to the child\n * process immediately while the first handler is still starting cleanup:\n * bun: https://github.com/oven-sh/bun/issues/14799\n * https://github.com/oven-sh/bun/issues/11400\n * npm: https://github.com/npm/cli/issues/5021\n * https://github.com/npm/cli/issues/8164\n * https://github.com/npm/cli/issues/7693\n * We ignore a second signal within 500ms of the first to avoid\n * double-cleanup, but treat a later Ctrl+C as a force-exit escape hatch.\n */\nexport function installSigintHandler(ctx: OneoffCtx) {\n const DUPLICATE_GRACE_MS = 500;\n let cleanupStartTime: number | null = null;\n process.on(\"SIGINT\", async () => {\n if (cleanupStartTime !== null) {\n if (Date.now() - cleanupStartTime < DUPLICATE_GRACE_MS) {\n logVerbose(\n \"Received SIGINT during cleanup, ignoring duplicate signal...\",\n );\n return;\n }\n logVerbose(\"Received SIGINT during cleanup, exiting immediately...\");\n process.exit(130);\n }\n cleanupStartTime = Date.now();\n logVerbose(\"Received SIGINT, cleaning up...\");\n await ctx.flushAndExit(130);\n });\n}\n\nexport const oneoffContext: (args: {\n url?: string | undefined;\n adminKey?: string | undefined;\n envFile?: string | undefined;\n}) => Promise<OneoffCtx> = async (args) => {\n const ctx = new OneoffContextImpl();\n await detectSuspiciousEnvironmentVariables(\n ctx,\n !!process.env.CONVEX_IGNORE_SUSPICIOUS_ENV_VARS,\n );\n await initializeBigBrainAuth(ctx, {\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AAExB,gBAAmC;AACnC,iCAAuC;AACvC,qBAAqD;AACrD,iBAAuC;
|
|
4
|
+
"sourcesContent": ["import * as Sentry from \"@sentry/node\";\nimport { Ora } from \"ora\";\nimport { Filesystem, nodeFs } from \"./fs.js\";\nimport { initializeBigBrainAuth } from \"../cli/lib/deploymentSelection.js\";\nimport { detectSuspiciousEnvironmentVariables } from \"../cli/lib/envvars.js\";\nimport { logFailure, logVerbose } from \"./log.js\";\n// How the error should be handled when running `npx convex dev`.\nexport type ErrorType =\n // The error was likely caused by the state of the developer's local\n // file system (e.g. `tsc` fails due to a syntax error). The `convex dev`\n // command will then print out the error and wait for the file to change before\n // retrying.\n | \"invalid filesystem data\"\n // The error was caused by either the local state (ie schema.ts content)\n // or the state of the db (ie documents not matching the new schema).\n // The `convex dev` command will wait for either file OR table data change\n // to retry (if a table name is specified as the value in this Object).\n | {\n \"invalid filesystem or db data\": {\n tableName: string;\n componentPath?: string;\n } | null;\n }\n // The error was caused by either the local state (ie schema.ts content)\n // or the state of the deployment environment variables.\n // The `convex dev` command will wait for either file OR env var change\n // before retrying.\n | \"invalid filesystem or env vars\"\n // The error was some transient issue (e.g. a network\n // error). This will then cause a retry after an exponential backoff.\n | \"transient\"\n // This error was caught, handled, and now all that needs to happen\n // is for the proces to restart. No error is logged or reported.\n | \"already handled\"\n // This error is truly permanent. Exit `npx convex dev` because the\n // developer will need to take a manual commandline action.\n | \"fatal\";\n\nexport type BigBrainAuth = {\n header: string;\n} & (\n | {\n kind: \"projectKey\";\n projectKey: string;\n }\n | {\n kind: \"deploymentKey\";\n deploymentKey: string;\n }\n | {\n kind: \"previewDeployKey\";\n previewDeployKey: string;\n }\n | {\n kind: \"accessToken\";\n accessToken: string;\n profile?: { name: string; source: string } | null;\n }\n);\n\nexport interface Context {\n fs: Filesystem;\n deprecationMessagePrinted: boolean;\n // Reports to Sentry and either throws FatalError or exits the process.\n // Prints the `printedMessage` if provided\n crash(args: {\n exitCode: number;\n errorType: ErrorType;\n errForSentry?: any;\n printedMessage: string | null;\n }): Promise<never>;\n registerCleanup(fn: (exitCode: number, err?: any) => Promise<void>): string;\n removeCleanup(\n handle: string,\n ): (exitCode: number, err?: any) => Promise<void> | null;\n bigBrainAuth(): BigBrainAuth | null;\n /**\n * Prefer using `updateBigBrainAuthAfterLogin` in `deploymentSelection.ts` instead\n */\n _updateBigBrainAuth(auth: BigBrainAuth | null): void;\n}\n\nasync function flushAndExit(exitCode: number, err?: any) {\n if (err) {\n Sentry.captureException(err);\n }\n await Sentry.close();\n return process.exit(exitCode);\n}\n\nexport type OneoffCtx = Context & {\n // Generally `ctx.crash` is better to use since it handles printing a message\n // for the user, and then calls this.\n //\n // This function reports to Sentry + exits the process, but does not handle\n // printing a message for the user.\n flushAndExit: (exitCode: number, err?: any) => Promise<never>;\n};\n\nclass OneoffContextImpl {\n private _cleanupFns: Record<\n string,\n (exitCode: number, err?: any) => Promise<void>\n > = {};\n public fs: Filesystem = nodeFs;\n public deprecationMessagePrinted: boolean = false;\n public spinner: Ora | undefined = undefined;\n private _bigBrainAuth: BigBrainAuth | null = null;\n\n crash = async (args: {\n exitCode: number;\n errorType?: ErrorType;\n errForSentry?: any;\n printedMessage: string | null;\n }) => {\n if (args.printedMessage !== null) {\n logFailure(args.printedMessage);\n }\n return await this.flushAndExit(args.exitCode, args.errForSentry);\n };\n flushAndExit = async (exitCode: number, err?: any) => {\n logVerbose(\"Flushing and exiting, error:\", err);\n if (err) {\n logVerbose(err.stack);\n }\n const cleanupFns = this._cleanupFns;\n // Clear the cleanup functions so that there's no risk of running them twice\n // if this somehow gets triggered twice.\n this._cleanupFns = {};\n const fns = Object.values(cleanupFns);\n logVerbose(`Running ${fns.length} cleanup functions`);\n for (const fn of fns) {\n await fn(exitCode, err);\n }\n logVerbose(\"All cleanup functions ran\");\n return flushAndExit(exitCode, err);\n };\n registerCleanup(fn: (exitCode: number, err?: any) => Promise<void>) {\n const handle = Math.random().toString(36).slice(2);\n this._cleanupFns[handle] = fn;\n return handle;\n }\n removeCleanup(handle: string) {\n const value = this._cleanupFns[handle];\n delete this._cleanupFns[handle];\n return value ?? null;\n }\n bigBrainAuth(): BigBrainAuth | null {\n return this._bigBrainAuth;\n }\n _updateBigBrainAuth(auth: BigBrainAuth | null): void {\n logVerbose(`Updating big brain auth to ${auth?.kind ?? \"null\"}`);\n this._bigBrainAuth = auth;\n }\n}\n\n/**\n * Install a SIGINT handler that gracefully exits via ctx.flushAndExit.\n *\n * `bun run` and `npm run` can deliver a duplicate SIGINT to the child\n * process immediately while the first handler is still starting cleanup:\n * bun: https://github.com/oven-sh/bun/issues/14799\n * https://github.com/oven-sh/bun/issues/11400\n * npm: https://github.com/npm/cli/issues/5021\n * https://github.com/npm/cli/issues/8164\n * https://github.com/npm/cli/issues/7693\n * We ignore a second signal within 500ms of the first to avoid\n * double-cleanup, but treat a later Ctrl+C as a force-exit escape hatch.\n */\nexport function installSigintHandler(ctx: OneoffCtx) {\n const DUPLICATE_GRACE_MS = 500;\n let cleanupStartTime: number | null = null;\n process.on(\"SIGINT\", async () => {\n if (cleanupStartTime !== null) {\n if (Date.now() - cleanupStartTime < DUPLICATE_GRACE_MS) {\n logVerbose(\n \"Received SIGINT during cleanup, ignoring duplicate signal...\",\n );\n return;\n }\n logVerbose(\"Received SIGINT during cleanup, exiting immediately...\");\n process.exit(130);\n }\n cleanupStartTime = Date.now();\n logVerbose(\"Received SIGINT, cleaning up...\");\n await ctx.flushAndExit(130);\n });\n}\n\nexport const oneoffContext: (args: {\n url?: string | undefined;\n adminKey?: string | undefined;\n envFile?: string | undefined;\n skipAuth?: boolean;\n}) => Promise<OneoffCtx> = async (args) => {\n const ctx = new OneoffContextImpl();\n await detectSuspiciousEnvironmentVariables(\n ctx,\n !!process.env.CONVEX_IGNORE_SUSPICIOUS_ENV_VARS,\n );\n if (!args.skipAuth) {\n await initializeBigBrainAuth(ctx, {\n url: args.url,\n adminKey: args.adminKey,\n envFile: args.envFile,\n });\n }\n return ctx;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MAAM;AAC9B,WAAO,SAAS;AAAA,EAClB;AAAA,EACA,eAAoC;AAClC,WAAO,KAAK;AAAA,EACd;AAAA,EACA,oBAAoB,MAAiC;AACnD,+BAAW,8BAA8B,MAAM,QAAQ,MAAM,EAAE;AAC/D,SAAK,gBAAgB;AAAA,EACvB;AACF;AAeO,SAAS,qBAAqB,KAAgB;AACnD,QAAM,qBAAqB;AAC3B,MAAI,mBAAkC;AACtC,UAAQ,GAAG,UAAU,YAAY;AAC/B,QAAI,qBAAqB,MAAM;AAC7B,UAAI,KAAK,IAAI,IAAI,mBAAmB,oBAAoB;AACtD;AAAA,UACE;AAAA,QACF;AACA;AAAA,MACF;AACA,iCAAW,wDAAwD;AACnE,cAAQ,KAAK,GAAG;AAAA,IAClB;AACA,uBAAmB,KAAK,IAAI;AAC5B,+BAAW,iCAAiC;AAC5C,UAAM,IAAI,aAAa,GAAG;AAAA,EAC5B,CAAC;AACH;AAEO,MAAM,gBAKc,OAAO,SAAS;AACzC,QAAM,MAAM,IAAI,kBAAkB;AAClC,YAAM;AAAA,IACJ;AAAA,IACA,CAAC,CAAC,QAAQ,IAAI;AAAA,EAChB;AACA,MAAI,CAAC,KAAK,UAAU;AAClB,cAAM,mDAAuB,KAAK;AAAA,MAChC,KAAK,KAAK;AAAA,MACV,UAAU,KAAK;AAAA,MACf,SAAS,KAAK;AAAA,IAChB,CAAC;AAAA,EACH;AACA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/bundler/fs.js
CHANGED
|
@@ -117,6 +117,9 @@ class NodeFs {
|
|
|
117
117
|
stat(path2) {
|
|
118
118
|
return import_fs.default.statSync(path2);
|
|
119
119
|
}
|
|
120
|
+
lstat(path2) {
|
|
121
|
+
return import_fs.default.lstatSync(path2);
|
|
122
|
+
}
|
|
120
123
|
readUtf8File(path2) {
|
|
121
124
|
return import_fs.default.readFileSync(path2, { encoding: "utf-8" });
|
|
122
125
|
}
|
|
@@ -197,6 +200,8 @@ class RecordingFs {
|
|
|
197
200
|
__publicField(this, "observedDirectories", /* @__PURE__ */ new Map());
|
|
198
201
|
// Absolute path -> observed stat (or null if observed nonexistent)
|
|
199
202
|
__publicField(this, "observedFiles", /* @__PURE__ */ new Map());
|
|
203
|
+
// lstat observes the link itself, while stat observes its target.
|
|
204
|
+
__publicField(this, "observedLstats", /* @__PURE__ */ new Map());
|
|
200
205
|
// Have we noticed that files have changed while recording?
|
|
201
206
|
__publicField(this, "invalidated", false);
|
|
202
207
|
__publicField(this, "traceEvents");
|
|
@@ -229,6 +234,19 @@ class RecordingFs {
|
|
|
229
234
|
this.observedDirectories.set(absDirPath, observedNames);
|
|
230
235
|
return entries;
|
|
231
236
|
}
|
|
237
|
+
lstat(filePath) {
|
|
238
|
+
const absPath = import_path.default.resolve(filePath);
|
|
239
|
+
try {
|
|
240
|
+
const st = nodeFs.lstat(filePath);
|
|
241
|
+
this.registerNormalized(absPath, st, this.observedLstats);
|
|
242
|
+
return st;
|
|
243
|
+
} catch (err) {
|
|
244
|
+
if (err.code === "ENOENT") {
|
|
245
|
+
this.registerNormalized(absPath, null, this.observedLstats);
|
|
246
|
+
}
|
|
247
|
+
throw err;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
232
250
|
exists(path2) {
|
|
233
251
|
try {
|
|
234
252
|
const st = nodeFs.stat(path2);
|
|
@@ -327,6 +345,8 @@ class RecordingFs {
|
|
|
327
345
|
updateOnWrite(absPath) {
|
|
328
346
|
const newSt = nodeFs.stat(absPath);
|
|
329
347
|
this.observedFiles.set(absPath, newSt);
|
|
348
|
+
if (this.observedLstats.has(absPath))
|
|
349
|
+
this.observedLstats.set(absPath, nodeFs.lstat(absPath));
|
|
330
350
|
const parentPath = import_path.default.resolve(import_path.default.dirname(absPath));
|
|
331
351
|
const observedParent = this.observedDirectories.get(parentPath);
|
|
332
352
|
if (observedParent !== void 0) {
|
|
@@ -335,6 +355,8 @@ class RecordingFs {
|
|
|
335
355
|
}
|
|
336
356
|
updateOnDelete(absPath) {
|
|
337
357
|
this.observedFiles.set(absPath, null);
|
|
358
|
+
if (this.observedLstats.has(absPath))
|
|
359
|
+
this.observedLstats.set(absPath, null);
|
|
338
360
|
const parentPath = import_path.default.resolve(import_path.default.dirname(absPath));
|
|
339
361
|
const observedParent = this.observedDirectories.get(parentPath);
|
|
340
362
|
if (observedParent !== void 0) {
|
|
@@ -348,8 +370,8 @@ class RecordingFs {
|
|
|
348
370
|
invalidate() {
|
|
349
371
|
this.invalidated = true;
|
|
350
372
|
}
|
|
351
|
-
registerNormalized(absPath, observed) {
|
|
352
|
-
const existing =
|
|
373
|
+
registerNormalized(absPath, observed, observations = this.observedFiles) {
|
|
374
|
+
const existing = observations.get(absPath);
|
|
353
375
|
if (existing !== void 0) {
|
|
354
376
|
const stMatch = stMatches(observed, existing);
|
|
355
377
|
if (!stMatch.matches) {
|
|
@@ -365,17 +387,22 @@ class RecordingFs {
|
|
|
365
387
|
this.invalidated = true;
|
|
366
388
|
}
|
|
367
389
|
}
|
|
368
|
-
|
|
390
|
+
observations.set(absPath, observed);
|
|
369
391
|
}
|
|
370
392
|
finalize() {
|
|
371
393
|
if (this.invalidated) {
|
|
372
394
|
return "invalidated";
|
|
373
395
|
}
|
|
374
|
-
return new Observations(
|
|
396
|
+
return new Observations(
|
|
397
|
+
this.observedDirectories,
|
|
398
|
+
this.observedFiles,
|
|
399
|
+
this.observedLstats
|
|
400
|
+
);
|
|
375
401
|
}
|
|
376
402
|
}
|
|
377
403
|
class Observations {
|
|
378
|
-
constructor(directories, files) {
|
|
404
|
+
constructor(directories, files, lstats = /* @__PURE__ */ new Map()) {
|
|
405
|
+
this.lstats = lstats;
|
|
379
406
|
__publicField(this, "directories");
|
|
380
407
|
__publicField(this, "files");
|
|
381
408
|
this.directories = directories;
|
|
@@ -389,7 +416,8 @@ class Observations {
|
|
|
389
416
|
for (const path2 of this.files.keys()) {
|
|
390
417
|
out.push(path2);
|
|
391
418
|
}
|
|
392
|
-
|
|
419
|
+
for (const path2 of this.lstats.keys()) out.push(path2);
|
|
420
|
+
return [...new Set(out)];
|
|
393
421
|
}
|
|
394
422
|
overlaps({
|
|
395
423
|
absPath
|
|
@@ -412,6 +440,19 @@ class Observations {
|
|
|
412
440
|
return { overlaps: true, reason };
|
|
413
441
|
}
|
|
414
442
|
}
|
|
443
|
+
const observedLstat = this.lstats.get(absPath);
|
|
444
|
+
if (observedLstat !== void 0) {
|
|
445
|
+
let currentLstat;
|
|
446
|
+
try {
|
|
447
|
+
currentLstat = nodeFs.lstat(absPath);
|
|
448
|
+
} catch (err) {
|
|
449
|
+
if (err.code !== "ENOENT") throw err;
|
|
450
|
+
currentLstat = null;
|
|
451
|
+
}
|
|
452
|
+
const match = stMatches(observedLstat, currentLstat);
|
|
453
|
+
if (!match.matches)
|
|
454
|
+
return { overlaps: true, reason: `modified (${match.reason})` };
|
|
455
|
+
}
|
|
415
456
|
const parentPath = import_path.default.resolve(import_path.default.dirname(absPath));
|
|
416
457
|
const observedParent = this.directories.get(parentPath);
|
|
417
458
|
if (observedParent !== void 0) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/bundler/fs.ts"],
|
|
4
|
-
"sourcesContent": ["// Disable our restriction on `throw` because these aren't developer-facing\n// error messages.\n/* eslint-disable no-restricted-imports */\n/* eslint-disable no-restricted-syntax */\nimport { chalkStderr } from \"chalk\";\nimport stdFs, { Dirent, Mode, ReadStream, Stats } from \"fs\";\nimport * as fsPromises from \"fs/promises\";\nimport os from \"os\";\nimport path from \"path\";\nimport crypto from \"crypto\";\nimport { Readable } from \"stream\";\n\nexport type NormalizedPath = string;\n\nconst tmpDirOverrideVar = \"CONVEX_TMPDIR\";\nfunction tmpDirPath() {\n // Allow users to override the temporary directory path with an environment variable.\n // This override needs to (1) be project-specific, since the user may have projects\n // on different filesystems, but also (2) be device-specific and not checked in, since\n // it's dependent on where the user has checked out their project. So, we don't want\n // this state in the project-specific `convex.json`, which is shared across all\n // devices, or in the top-level `~/.convex` directory, which is shared across all\n // projects on the local machine.\n //\n // Therefore, just let advanced users configure this behavior with an environment\n // variable that they're responsible for managing themselves for now.\n const envTmpDir = process.env[tmpDirOverrideVar];\n return envTmpDir ?? os.tmpdir();\n}\nconst tmpDirRoot = tmpDirPath();\n\nlet warned = false;\nfunction warnCrossFilesystem(dstPath: string) {\n const dstDir = path.dirname(dstPath);\n if (!warned) {\n // It's hard for these to use `logMessage` without creating a circular dependency, so just log directly.\n // eslint-disable-next-line no-console\n console.warn(\n chalkStderr.yellow(\n `Temporary directory '${tmpDirRoot}' and project directory '${dstDir}' are on different filesystems.`,\n ),\n );\n // eslint-disable-next-line no-console\n console.warn(\n chalkStderr.gray(\n ` If you're running into errors with other tools watching the project directory, override the temporary directory location with the ${chalkStderr.bold(\n tmpDirOverrideVar,\n )} environment variable.`,\n ),\n );\n // eslint-disable-next-line no-console\n console.warn(\n chalkStderr.gray(\n ` Be sure to pick a temporary directory that's on the same filesystem as your project.`,\n ),\n );\n warned = true;\n }\n}\n\nexport interface Filesystem {\n listDir(dirPath: string): Dirent[];\n\n exists(path: string): boolean;\n stat(path: string): Stats;\n readUtf8File(path: string): string;\n // createReadStream returns a stream for which [Symbol.asyncIterator]\n // yields chunks of size highWaterMark (until the last one), or 64KB if\n // highWaterMark isn't specified.\n // https://nodejs.org/api/stream.html#readablesymbolasynciterator\n createReadStream(\n path: string,\n options: { highWaterMark?: number },\n ): ReadStream;\n access(path: string): void;\n\n writeUtf8File(path: string, contents: string, mode?: Mode): void;\n mkdir(\n dirPath: string,\n options?: { allowExisting?: boolean; recursive?: boolean },\n ): void;\n rmdir(path: string): void;\n unlink(path: string): void;\n swapTmpFile(fromPath: TempPath, toPath: string): void;\n\n registerPath(path: string, st: Stats | null): void;\n invalidate(): void;\n}\n\nexport type TempPath = string & { __tempPath: \"tempPath\" };\n\nexport interface TempDir {\n writeUtf8File(contents: string): TempPath;\n writeFileStream(\n path: TempPath,\n stream: Readable,\n onData?: (chunk: any) => void,\n ): Promise<void>;\n registerTempPath(st: Stats | null): TempPath;\n path: TempPath;\n}\n\nexport async function withTmpDir(\n callback: (tmpDir: TempDir) => Promise<void>,\n): Promise<void> {\n // Create temporary directories inside `tmpDirRoot` of the form `convex-<random>`.\n const tmpPath = stdFs.mkdtempSync(path.join(tmpDirRoot, \"convex\"));\n const tmpDir = {\n writeUtf8File(contents: string): TempPath {\n const filePath = path.join(tmpPath, crypto.randomUUID());\n nodeFs.writeUtf8File(filePath, contents);\n return filePath as TempPath;\n },\n registerTempPath(st: Stats | null): TempPath {\n const filePath = path.join(tmpPath, crypto.randomUUID());\n nodeFs.registerPath(filePath, st);\n return filePath as TempPath;\n },\n writeFileStream(\n path: TempPath,\n stream: Readable,\n onData?: (chunk: any) => void,\n ): Promise<void> {\n return nodeFs.writeFileStream(path, stream, onData);\n },\n path: tmpPath as TempPath,\n };\n try {\n await callback(tmpDir);\n } finally {\n stdFs.rmSync(tmpPath, { force: true, recursive: true });\n }\n}\n\n// Use `nodeFs` when you just want to read and write to the local filesystem\n// and don't care about collecting the paths touched. One-off commands\n// should use the singleton `nodeFs`.\nexport class NodeFs implements Filesystem {\n listDir(dirPath: string) {\n return stdFs.readdirSync(dirPath, { withFileTypes: true });\n }\n exists(path: string) {\n try {\n stdFs.statSync(path);\n return true;\n } catch (e: any) {\n if (e.code === \"ENOENT\") {\n return false;\n }\n throw e;\n }\n }\n stat(path: string) {\n return stdFs.statSync(path);\n }\n readUtf8File(path: string) {\n return stdFs.readFileSync(path, { encoding: \"utf-8\" });\n }\n createReadStream(\n path: string,\n options: { highWaterMark?: number },\n ): ReadStream {\n return stdFs.createReadStream(path, options);\n }\n // To avoid issues with filesystem events triggering for our own streamed file\n // writes, writeFileStream is intentionally not on the Filesystem interface\n // and not implemented by RecordingFs.\n async writeFileStream(\n path: string,\n stream: Readable,\n onData?: (chunk: any) => void,\n ): Promise<void> {\n // 'wx' means O_CREAT | O_EXCL | O_WRONLY\n // 0o644 means owner has readwrite access, everyone else has read access.\n const fileHandle = await fsPromises.open(path, \"wx\", 0o644);\n try {\n for await (const chunk of stream) {\n // For some reason, adding `stream.on(\"data\", onData)` causes issues with\n // the stream, but calling a callback here works.\n if (onData) {\n onData(chunk);\n }\n await fileHandle.write(chunk);\n }\n } finally {\n await fileHandle.close();\n }\n }\n access(path: string) {\n return stdFs.accessSync(path);\n }\n writeUtf8File(path: string, contents: string, mode?: Mode) {\n const fd = stdFs.openSync(path, \"w\", mode);\n try {\n stdFs.writeFileSync(fd, contents, { encoding: \"utf-8\" });\n try {\n stdFs.fsyncSync(fd);\n } catch (e: any) {\n // fsync(2) returns EINVAL on file descriptors that don't support\n // synchronization, e.g. FIFOs/pipes. Some integrations (such as\n // 1Password's Local Environment File) expose `.env.local` as a\n // FIFO so secrets can be streamed on demand; the write itself\n // succeeded, so treat the missing sync as best-effort.\n if (e?.code !== \"EINVAL\") {\n throw e;\n }\n }\n } finally {\n stdFs.closeSync(fd);\n }\n }\n mkdir(\n dirPath: string,\n options?: { allowExisting?: boolean; recursive?: boolean },\n ): void {\n try {\n stdFs.mkdirSync(dirPath, { recursive: options?.recursive });\n } catch (e: any) {\n if (options?.allowExisting && e.code === \"EEXIST\") {\n return;\n }\n throw e;\n }\n }\n rmdir(path: string) {\n stdFs.rmdirSync(path);\n }\n unlink(path: string) {\n return stdFs.unlinkSync(path);\n }\n swapTmpFile(fromPath: TempPath, toPath: string) {\n try {\n return stdFs.renameSync(fromPath, toPath);\n } catch (e: any) {\n // Fallback to copying the file if we're on different volumes.\n if (e.code === \"EXDEV\") {\n warnCrossFilesystem(toPath);\n stdFs.copyFileSync(fromPath, toPath);\n return;\n }\n throw e;\n }\n }\n registerPath(_path: string, _st: Stats | null) {\n // The node filesystem doesn't track reads, so we don't need to do anything here.\n }\n invalidate() {\n // We don't track invalidations for the node filesystem either.\n }\n}\nexport const nodeFs = new NodeFs();\n\n// Filesystem implementation that records all paths observed. This is useful\n// for implementing continuous watch commands that need to manage a filesystem\n// watcher and know when a command's inputs were invalidated.\nexport class RecordingFs implements Filesystem {\n // Absolute path -> Set of observed child names\n private observedDirectories: Map<string, Set<string>> = new Map();\n\n // Absolute path -> observed stat (or null if observed nonexistent)\n private observedFiles: Map<string, Stats | null> = new Map();\n\n // Have we noticed that files have changed while recording?\n private invalidated = false;\n\n private traceEvents: boolean;\n\n constructor(traceEvents: boolean) {\n this.traceEvents = traceEvents;\n }\n\n listDir(dirPath: string): Dirent[] {\n const absDirPath = path.resolve(dirPath);\n\n // Register observing the directory itself.\n const dirSt = nodeFs.stat(absDirPath);\n this.registerNormalized(absDirPath, dirSt);\n\n // List the directory and register observing all of its children.\n const entries = nodeFs.listDir(dirPath);\n for (const entry of entries) {\n const childPath = path.join(absDirPath, entry.name);\n const childSt = nodeFs.stat(childPath);\n this.registerPath(childPath, childSt);\n }\n\n // Register observing the directory's children.\n const observedNames = new Set(entries.map((e) => e.name));\n const existingNames = this.observedDirectories.get(absDirPath);\n if (existingNames) {\n if (!setsEqual(observedNames, existingNames)) {\n if (this.traceEvents) {\n // eslint-disable-next-line no-console\n console.log(\n \"Invalidating due to directory children mismatch\",\n observedNames,\n existingNames,\n );\n }\n this.invalidated = true;\n }\n }\n this.observedDirectories.set(absDirPath, observedNames);\n\n return entries;\n }\n\n exists(path: string): boolean {\n try {\n const st = nodeFs.stat(path);\n this.registerPath(path, st);\n return true;\n } catch (err: any) {\n if (err.code === \"ENOENT\") {\n this.registerPath(path, null);\n return false;\n }\n throw err;\n }\n }\n stat(path: string): Stats {\n try {\n const st = nodeFs.stat(path);\n this.registerPath(path, st);\n return st;\n } catch (err: any) {\n if (err.code === \"ENOENT\") {\n this.registerPath(path, null);\n }\n throw err;\n }\n }\n readUtf8File(path: string): string {\n try {\n const st = nodeFs.stat(path);\n this.registerPath(path, st);\n return nodeFs.readUtf8File(path);\n } catch (err: any) {\n if (err.code === \"ENOENT\") {\n this.registerPath(path, null);\n }\n throw err;\n }\n }\n createReadStream(\n path: string,\n options: { highWaterMark?: number },\n ): ReadStream {\n try {\n const st = nodeFs.stat(path);\n this.registerPath(path, st);\n return nodeFs.createReadStream(path, options);\n } catch (err: any) {\n if (err.code === \"ENOENT\") {\n this.registerPath(path, null);\n }\n throw err;\n }\n }\n access(path: string) {\n try {\n const st = nodeFs.stat(path);\n this.registerPath(path, st);\n return nodeFs.access(path);\n } catch (err: any) {\n if (err.code === \"ENOENT\") {\n this.registerPath(path, null);\n }\n throw err;\n }\n }\n\n writeUtf8File(filePath: string, contents: string, mode?: Mode) {\n const absPath = path.resolve(filePath);\n\n nodeFs.writeUtf8File(filePath, contents, mode);\n\n this.updateOnWrite(absPath);\n }\n\n mkdir(\n dirPath: string,\n options?: { allowExisting?: boolean; recursive?: boolean },\n ): void {\n const absPath = path.resolve(dirPath);\n try {\n stdFs.mkdirSync(absPath, { recursive: options?.recursive });\n } catch (e: any) {\n if (options?.allowExisting && e.code === \"EEXIST\") {\n const st = nodeFs.stat(absPath);\n this.registerNormalized(absPath, st);\n return;\n }\n throw e;\n }\n this.updateOnWrite(absPath);\n }\n\n rmdir(dirPath: string) {\n const absPath = path.resolve(dirPath);\n stdFs.rmdirSync(absPath);\n this.updateOnDelete(absPath);\n }\n unlink(filePath: string) {\n const absPath = path.resolve(filePath);\n stdFs.unlinkSync(absPath);\n this.updateOnDelete(absPath);\n }\n swapTmpFile(fromPath: TempPath, toPath: string) {\n const absToPath = path.resolve(toPath);\n nodeFs.swapTmpFile(fromPath, absToPath);\n this.updateOnWrite(absToPath);\n }\n\n private updateOnWrite(absPath: string) {\n // Stat the file or dir after writing and make it our expected observation. If we read the file after\n // writing it and it doesn't match this stat (implying a subsequent write), we'll invalidate\n // the current reader.\n const newSt = nodeFs.stat(absPath);\n // Skip invalidation checking since we don't want to conflict if we previously read this file.\n this.observedFiles.set(absPath, newSt);\n\n // If we observed the parent, add our newly created file.\n const parentPath = path.resolve(path.dirname(absPath));\n const observedParent = this.observedDirectories.get(parentPath);\n if (observedParent !== undefined) {\n observedParent.add(path.basename(absPath));\n }\n }\n private updateOnDelete(absPath: string) {\n // Expect this file to be gone.\n this.observedFiles.set(absPath, null);\n\n // Unlink it from our parent if observed.\n const parentPath = path.resolve(path.dirname(absPath));\n const observedParent = this.observedDirectories.get(parentPath);\n if (observedParent !== undefined) {\n observedParent.delete(path.basename(absPath));\n }\n }\n\n registerPath(p: string, st: Stats | null) {\n const absPath = path.resolve(p);\n this.registerNormalized(absPath, st);\n }\n\n invalidate() {\n this.invalidated = true;\n }\n\n registerNormalized(absPath: string, observed: Stats | null): void {\n const existing = this.observedFiles.get(absPath);\n if (existing !== undefined) {\n const stMatch = stMatches(observed, existing);\n if (!stMatch.matches) {\n if (this.traceEvents) {\n // eslint-disable-next-line no-console\n console.log(\n \"Invalidating due to st mismatch\",\n absPath,\n observed,\n existing,\n stMatch.reason,\n );\n }\n this.invalidated = true;\n }\n }\n this.observedFiles.set(absPath, observed);\n }\n\n finalize(): Observations | \"invalidated\" {\n if (this.invalidated) {\n return \"invalidated\";\n }\n return new Observations(this.observedDirectories, this.observedFiles);\n }\n}\n\nexport type WatchEvent = {\n name: \"add\" | \"addDir\" | \"change\" | \"unlink\" | \"unlinkDir\";\n absPath: string;\n};\n\nexport class Observations {\n directories: Map<string, Set<string>>;\n files: Map<string, Stats | null>;\n\n constructor(\n directories: Map<string, Set<string>>,\n files: Map<string, Stats | null>,\n ) {\n this.directories = directories;\n this.files = files;\n }\n\n paths(): string[] {\n const out = [];\n for (const path of this.directories.keys()) {\n out.push(path);\n }\n for (const path of this.files.keys()) {\n out.push(path);\n }\n return out;\n }\n\n overlaps({\n absPath,\n }: WatchEvent): { overlaps: false } | { overlaps: true; reason: string } {\n let currentSt: null | Stats;\n try {\n currentSt = nodeFs.stat(absPath);\n } catch (e: any) {\n if (e.code === \"ENOENT\") {\n currentSt = null;\n } else {\n throw e;\n }\n }\n\n // First, check to see if we observed `absPath` as a file.\n const observedSt = this.files.get(absPath);\n if (observedSt !== undefined) {\n const stMatch = stMatches(observedSt, currentSt);\n if (!stMatch.matches) {\n const reason = `modified (${stMatch.reason})`;\n return { overlaps: true, reason };\n }\n }\n\n // Second, check if we listed the directory this file is in.\n const parentPath = path.resolve(path.dirname(absPath));\n const observedParent = this.directories.get(parentPath);\n if (observedParent !== undefined) {\n const filename = path.basename(absPath);\n\n // If the file is gone now, but we observed it in its directory, then\n // it was deleted.\n if (currentSt === null && observedParent.has(filename)) {\n return { overlaps: true, reason: \"deleted\" };\n }\n\n // If the file exists now, but we didn't see it when listing its directory,\n // then it was added.\n if (currentSt !== null && !observedParent.has(filename)) {\n return { overlaps: true, reason: \"added\" };\n }\n }\n\n return { overlaps: false };\n }\n}\n\nfunction setsEqual<T>(a: Set<T>, b: Set<T>): boolean {\n if (a.size !== b.size) {\n return false;\n }\n for (const elem of a.keys()) {\n if (!b.has(elem)) {\n return false;\n }\n }\n return true;\n}\n\nexport function stMatches(\n a: Stats | null,\n b: Stats | null,\n): { matches: true } | { matches: false; reason: string } {\n if (a === null && b === null) {\n return { matches: true };\n }\n if (a !== null && b !== null) {\n if (a.dev !== b.dev) {\n return { matches: false, reason: \"device boundary\" };\n }\n if (a.isFile() || b.isFile()) {\n if (!a.isFile() || !b.isFile()) {\n return { matches: false, reason: \"file type\" };\n }\n if (a.ino !== b.ino) {\n return {\n matches: false,\n reason: `file inode (${a.ino} vs. ${b.ino})`,\n };\n }\n if (a.size !== b.size) {\n return {\n matches: false,\n reason: `file size (${a.size} vs. ${b.size})`,\n };\n }\n if (a.mtimeMs !== b.mtimeMs) {\n return {\n matches: false,\n reason: `file mtime (${a.mtimeMs} vs. ${b.mtimeMs})`,\n };\n }\n return { matches: true };\n }\n if (a.isDirectory() || b.isDirectory()) {\n if (!b.isDirectory() || !b.isDirectory()) {\n return { matches: false, reason: \"dir file type\" };\n }\n if (a.ino !== b.ino) {\n return {\n matches: false,\n reason: `dir inode (${a.ino} vs. ${b.ino})`,\n };\n }\n return { matches: true };\n }\n // If we have something other than a file or directory, just compare inodes.\n if (a.ino !== b.ino) {\n return {\n matches: false,\n reason: `special inode (${a.ino} vs. ${b.ino})`,\n };\n }\n return { matches: true };\n }\n return { matches: false, reason: \"deleted mismatch\" };\n}\n\n// Sort consistent with unix directory listings.\nexport function consistentPathSort(a: Dirent, b: Dirent) {\n for (let i = 0; i < Math.min(a.name.length, b.name.length); i++) {\n if (a.name.charCodeAt(i) !== b.name.charCodeAt(i)) {\n return a.name.charCodeAt(i) - b.name.charCodeAt(i);\n }\n }\n return a.name.length - b.name.length;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,mBAA4B;AAC5B,gBAAuD;AACvD,iBAA4B;AAC5B,gBAAe;AACf,kBAAiB;AACjB,oBAAmB;AAKnB,MAAM,oBAAoB;AAC1B,SAAS,aAAa;AAWpB,QAAM,YAAY,QAAQ,IAAI,iBAAiB;AAC/C,SAAO,aAAa,UAAAA,QAAG,OAAO;AAChC;AACA,MAAM,aAAa,WAAW;AAE9B,IAAI,SAAS;AACb,SAAS,oBAAoB,SAAiB;AAC5C,QAAM,SAAS,YAAAC,QAAK,QAAQ,OAAO;AACnC,MAAI,CAAC,QAAQ;AAGX,YAAQ;AAAA,MACN,yBAAY;AAAA,QACV,wBAAwB,UAAU,4BAA4B,MAAM;AAAA,MACtE;AAAA,IACF;AAEA,YAAQ;AAAA,MACN,yBAAY;AAAA,QACV,uIAAuI,yBAAY;AAAA,UACjJ;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAEA,YAAQ;AAAA,MACN,yBAAY;AAAA,QACV;AAAA,MACF;AAAA,IACF;AACA,aAAS;AAAA,EACX;AACF;AA4CA,eAAsB,WACpB,UACe;AAEf,QAAM,UAAU,UAAAC,QAAM,YAAY,YAAAD,QAAK,KAAK,YAAY,QAAQ,CAAC;AACjE,QAAM,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,QAAQ,kBAAkB,EAAE,GAAG,QAAQ,EAAE,GAAG;AAAA,MAC9C;AAAA,IACF;AACA,WAAO,EAAE,SAAS,KAAK;AAAA,EACzB;AACA,SAAO,EAAE,SAAS,OAAO,QAAQ,mBAAmB;AACtD;AAGO,SAAS,mBAAmB,GAAW,GAAW;AACvD,WAAS,IAAI,GAAG,IAAI,KAAK,IAAI,EAAE,KAAK,QAAQ,EAAE,KAAK,MAAM,GAAG,KAAK;AAC/D,QAAI,EAAE,KAAK,WAAW,CAAC,MAAM,EAAE,KAAK,WAAW,CAAC,GAAG;AACjD,aAAO,EAAE,KAAK,WAAW,CAAC,IAAI,EAAE,KAAK,WAAW,CAAC;AAAA,IACnD;AAAA,EACF;AACA,SAAO,EAAE,KAAK,SAAS,EAAE,KAAK;AAChC;",
|
|
4
|
+
"sourcesContent": ["// Disable our restriction on `throw` because these aren't developer-facing\n// error messages.\n/* eslint-disable no-restricted-imports */\n/* eslint-disable no-restricted-syntax */\nimport { chalkStderr } from \"chalk\";\nimport stdFs, { Dirent, Mode, ReadStream, Stats } from \"fs\";\nimport * as fsPromises from \"fs/promises\";\nimport os from \"os\";\nimport path from \"path\";\nimport crypto from \"crypto\";\nimport { Readable } from \"stream\";\n\nexport type NormalizedPath = string;\n\nconst tmpDirOverrideVar = \"CONVEX_TMPDIR\";\nfunction tmpDirPath() {\n // Allow users to override the temporary directory path with an environment variable.\n // This override needs to (1) be project-specific, since the user may have projects\n // on different filesystems, but also (2) be device-specific and not checked in, since\n // it's dependent on where the user has checked out their project. So, we don't want\n // this state in the project-specific `convex.json`, which is shared across all\n // devices, or in the top-level `~/.convex` directory, which is shared across all\n // projects on the local machine.\n //\n // Therefore, just let advanced users configure this behavior with an environment\n // variable that they're responsible for managing themselves for now.\n const envTmpDir = process.env[tmpDirOverrideVar];\n return envTmpDir ?? os.tmpdir();\n}\nconst tmpDirRoot = tmpDirPath();\n\nlet warned = false;\nfunction warnCrossFilesystem(dstPath: string) {\n const dstDir = path.dirname(dstPath);\n if (!warned) {\n // It's hard for these to use `logMessage` without creating a circular dependency, so just log directly.\n // eslint-disable-next-line no-console\n console.warn(\n chalkStderr.yellow(\n `Temporary directory '${tmpDirRoot}' and project directory '${dstDir}' are on different filesystems.`,\n ),\n );\n // eslint-disable-next-line no-console\n console.warn(\n chalkStderr.gray(\n ` If you're running into errors with other tools watching the project directory, override the temporary directory location with the ${chalkStderr.bold(\n tmpDirOverrideVar,\n )} environment variable.`,\n ),\n );\n // eslint-disable-next-line no-console\n console.warn(\n chalkStderr.gray(\n ` Be sure to pick a temporary directory that's on the same filesystem as your project.`,\n ),\n );\n warned = true;\n }\n}\n\nexport interface Filesystem {\n listDir(dirPath: string): Dirent[];\n\n exists(path: string): boolean;\n stat(path: string): Stats;\n lstat(path: string): Stats;\n readUtf8File(path: string): string;\n // createReadStream returns a stream for which [Symbol.asyncIterator]\n // yields chunks of size highWaterMark (until the last one), or 64KB if\n // highWaterMark isn't specified.\n // https://nodejs.org/api/stream.html#readablesymbolasynciterator\n createReadStream(\n path: string,\n options: { highWaterMark?: number },\n ): ReadStream;\n access(path: string): void;\n\n writeUtf8File(path: string, contents: string, mode?: Mode): void;\n mkdir(\n dirPath: string,\n options?: { allowExisting?: boolean; recursive?: boolean },\n ): void;\n rmdir(path: string): void;\n unlink(path: string): void;\n swapTmpFile(fromPath: TempPath, toPath: string): void;\n\n registerPath(path: string, st: Stats | null): void;\n invalidate(): void;\n}\n\nexport type TempPath = string & { __tempPath: \"tempPath\" };\n\nexport interface TempDir {\n writeUtf8File(contents: string): TempPath;\n writeFileStream(\n path: TempPath,\n stream: Readable,\n onData?: (chunk: any) => void,\n ): Promise<void>;\n registerTempPath(st: Stats | null): TempPath;\n path: TempPath;\n}\n\nexport async function withTmpDir(\n callback: (tmpDir: TempDir) => Promise<void>,\n): Promise<void> {\n // Create temporary directories inside `tmpDirRoot` of the form `convex-<random>`.\n const tmpPath = stdFs.mkdtempSync(path.join(tmpDirRoot, \"convex\"));\n const tmpDir = {\n writeUtf8File(contents: string): TempPath {\n const filePath = path.join(tmpPath, crypto.randomUUID());\n nodeFs.writeUtf8File(filePath, contents);\n return filePath as TempPath;\n },\n registerTempPath(st: Stats | null): TempPath {\n const filePath = path.join(tmpPath, crypto.randomUUID());\n nodeFs.registerPath(filePath, st);\n return filePath as TempPath;\n },\n writeFileStream(\n path: TempPath,\n stream: Readable,\n onData?: (chunk: any) => void,\n ): Promise<void> {\n return nodeFs.writeFileStream(path, stream, onData);\n },\n path: tmpPath as TempPath,\n };\n try {\n await callback(tmpDir);\n } finally {\n stdFs.rmSync(tmpPath, { force: true, recursive: true });\n }\n}\n\n// Use `nodeFs` when you just want to read and write to the local filesystem\n// and don't care about collecting the paths touched. One-off commands\n// should use the singleton `nodeFs`.\nexport class NodeFs implements Filesystem {\n listDir(dirPath: string) {\n return stdFs.readdirSync(dirPath, { withFileTypes: true });\n }\n exists(path: string) {\n try {\n stdFs.statSync(path);\n return true;\n } catch (e: any) {\n if (e.code === \"ENOENT\") {\n return false;\n }\n throw e;\n }\n }\n stat(path: string) {\n return stdFs.statSync(path);\n }\n lstat(path: string) {\n return stdFs.lstatSync(path);\n }\n readUtf8File(path: string) {\n return stdFs.readFileSync(path, { encoding: \"utf-8\" });\n }\n createReadStream(\n path: string,\n options: { highWaterMark?: number },\n ): ReadStream {\n return stdFs.createReadStream(path, options);\n }\n // To avoid issues with filesystem events triggering for our own streamed file\n // writes, writeFileStream is intentionally not on the Filesystem interface\n // and not implemented by RecordingFs.\n async writeFileStream(\n path: string,\n stream: Readable,\n onData?: (chunk: any) => void,\n ): Promise<void> {\n // 'wx' means O_CREAT | O_EXCL | O_WRONLY\n // 0o644 means owner has readwrite access, everyone else has read access.\n const fileHandle = await fsPromises.open(path, \"wx\", 0o644);\n try {\n for await (const chunk of stream) {\n // For some reason, adding `stream.on(\"data\", onData)` causes issues with\n // the stream, but calling a callback here works.\n if (onData) {\n onData(chunk);\n }\n await fileHandle.write(chunk);\n }\n } finally {\n await fileHandle.close();\n }\n }\n access(path: string) {\n return stdFs.accessSync(path);\n }\n writeUtf8File(path: string, contents: string, mode?: Mode) {\n const fd = stdFs.openSync(path, \"w\", mode);\n try {\n stdFs.writeFileSync(fd, contents, { encoding: \"utf-8\" });\n try {\n stdFs.fsyncSync(fd);\n } catch (e: any) {\n // fsync(2) returns EINVAL on file descriptors that don't support\n // synchronization, e.g. FIFOs/pipes. Some integrations (such as\n // 1Password's Local Environment File) expose `.env.local` as a\n // FIFO so secrets can be streamed on demand; the write itself\n // succeeded, so treat the missing sync as best-effort.\n if (e?.code !== \"EINVAL\") {\n throw e;\n }\n }\n } finally {\n stdFs.closeSync(fd);\n }\n }\n mkdir(\n dirPath: string,\n options?: { allowExisting?: boolean; recursive?: boolean },\n ): void {\n try {\n stdFs.mkdirSync(dirPath, { recursive: options?.recursive });\n } catch (e: any) {\n if (options?.allowExisting && e.code === \"EEXIST\") {\n return;\n }\n throw e;\n }\n }\n rmdir(path: string) {\n stdFs.rmdirSync(path);\n }\n unlink(path: string) {\n return stdFs.unlinkSync(path);\n }\n swapTmpFile(fromPath: TempPath, toPath: string) {\n try {\n return stdFs.renameSync(fromPath, toPath);\n } catch (e: any) {\n // Fallback to copying the file if we're on different volumes.\n if (e.code === \"EXDEV\") {\n warnCrossFilesystem(toPath);\n stdFs.copyFileSync(fromPath, toPath);\n return;\n }\n throw e;\n }\n }\n registerPath(_path: string, _st: Stats | null) {\n // The node filesystem doesn't track reads, so we don't need to do anything here.\n }\n invalidate() {\n // We don't track invalidations for the node filesystem either.\n }\n}\nexport const nodeFs = new NodeFs();\n\n// Filesystem implementation that records all paths observed. This is useful\n// for implementing continuous watch commands that need to manage a filesystem\n// watcher and know when a command's inputs were invalidated.\nexport class RecordingFs implements Filesystem {\n // Absolute path -> Set of observed child names\n private observedDirectories: Map<string, Set<string>> = new Map();\n\n // Absolute path -> observed stat (or null if observed nonexistent)\n private observedFiles: Map<string, Stats | null> = new Map();\n\n // lstat observes the link itself, while stat observes its target.\n private observedLstats: Map<string, Stats | null> = new Map();\n\n // Have we noticed that files have changed while recording?\n private invalidated = false;\n\n private traceEvents: boolean;\n\n constructor(traceEvents: boolean) {\n this.traceEvents = traceEvents;\n }\n\n listDir(dirPath: string): Dirent[] {\n const absDirPath = path.resolve(dirPath);\n\n // Register observing the directory itself.\n const dirSt = nodeFs.stat(absDirPath);\n this.registerNormalized(absDirPath, dirSt);\n\n // List the directory and register observing all of its children.\n const entries = nodeFs.listDir(dirPath);\n for (const entry of entries) {\n const childPath = path.join(absDirPath, entry.name);\n const childSt = nodeFs.stat(childPath);\n this.registerPath(childPath, childSt);\n }\n\n // Register observing the directory's children.\n const observedNames = new Set(entries.map((e) => e.name));\n const existingNames = this.observedDirectories.get(absDirPath);\n if (existingNames) {\n if (!setsEqual(observedNames, existingNames)) {\n if (this.traceEvents) {\n // eslint-disable-next-line no-console\n console.log(\n \"Invalidating due to directory children mismatch\",\n observedNames,\n existingNames,\n );\n }\n this.invalidated = true;\n }\n }\n this.observedDirectories.set(absDirPath, observedNames);\n\n return entries;\n }\n\n lstat(filePath: string): Stats {\n const absPath = path.resolve(filePath);\n try {\n const st = nodeFs.lstat(filePath);\n this.registerNormalized(absPath, st, this.observedLstats);\n return st;\n } catch (err: any) {\n if (err.code === \"ENOENT\") {\n this.registerNormalized(absPath, null, this.observedLstats);\n }\n throw err;\n }\n }\n\n exists(path: string): boolean {\n try {\n const st = nodeFs.stat(path);\n this.registerPath(path, st);\n return true;\n } catch (err: any) {\n if (err.code === \"ENOENT\") {\n this.registerPath(path, null);\n return false;\n }\n throw err;\n }\n }\n stat(path: string): Stats {\n try {\n const st = nodeFs.stat(path);\n this.registerPath(path, st);\n return st;\n } catch (err: any) {\n if (err.code === \"ENOENT\") {\n this.registerPath(path, null);\n }\n throw err;\n }\n }\n readUtf8File(path: string): string {\n try {\n const st = nodeFs.stat(path);\n this.registerPath(path, st);\n return nodeFs.readUtf8File(path);\n } catch (err: any) {\n if (err.code === \"ENOENT\") {\n this.registerPath(path, null);\n }\n throw err;\n }\n }\n createReadStream(\n path: string,\n options: { highWaterMark?: number },\n ): ReadStream {\n try {\n const st = nodeFs.stat(path);\n this.registerPath(path, st);\n return nodeFs.createReadStream(path, options);\n } catch (err: any) {\n if (err.code === \"ENOENT\") {\n this.registerPath(path, null);\n }\n throw err;\n }\n }\n access(path: string) {\n try {\n const st = nodeFs.stat(path);\n this.registerPath(path, st);\n return nodeFs.access(path);\n } catch (err: any) {\n if (err.code === \"ENOENT\") {\n this.registerPath(path, null);\n }\n throw err;\n }\n }\n\n writeUtf8File(filePath: string, contents: string, mode?: Mode) {\n const absPath = path.resolve(filePath);\n\n nodeFs.writeUtf8File(filePath, contents, mode);\n\n this.updateOnWrite(absPath);\n }\n\n mkdir(\n dirPath: string,\n options?: { allowExisting?: boolean; recursive?: boolean },\n ): void {\n const absPath = path.resolve(dirPath);\n try {\n stdFs.mkdirSync(absPath, { recursive: options?.recursive });\n } catch (e: any) {\n if (options?.allowExisting && e.code === \"EEXIST\") {\n const st = nodeFs.stat(absPath);\n this.registerNormalized(absPath, st);\n return;\n }\n throw e;\n }\n this.updateOnWrite(absPath);\n }\n\n rmdir(dirPath: string) {\n const absPath = path.resolve(dirPath);\n stdFs.rmdirSync(absPath);\n this.updateOnDelete(absPath);\n }\n unlink(filePath: string) {\n const absPath = path.resolve(filePath);\n stdFs.unlinkSync(absPath);\n this.updateOnDelete(absPath);\n }\n swapTmpFile(fromPath: TempPath, toPath: string) {\n const absToPath = path.resolve(toPath);\n nodeFs.swapTmpFile(fromPath, absToPath);\n this.updateOnWrite(absToPath);\n }\n\n private updateOnWrite(absPath: string) {\n // Stat the file or dir after writing and make it our expected observation. If we read the file after\n // writing it and it doesn't match this stat (implying a subsequent write), we'll invalidate\n // the current reader.\n const newSt = nodeFs.stat(absPath);\n // Skip invalidation checking since we don't want to conflict if we previously read this file.\n this.observedFiles.set(absPath, newSt);\n if (this.observedLstats.has(absPath))\n this.observedLstats.set(absPath, nodeFs.lstat(absPath));\n\n // If we observed the parent, add our newly created file.\n const parentPath = path.resolve(path.dirname(absPath));\n const observedParent = this.observedDirectories.get(parentPath);\n if (observedParent !== undefined) {\n observedParent.add(path.basename(absPath));\n }\n }\n private updateOnDelete(absPath: string) {\n // Expect this file to be gone.\n this.observedFiles.set(absPath, null);\n if (this.observedLstats.has(absPath))\n this.observedLstats.set(absPath, null);\n\n // Unlink it from our parent if observed.\n const parentPath = path.resolve(path.dirname(absPath));\n const observedParent = this.observedDirectories.get(parentPath);\n if (observedParent !== undefined) {\n observedParent.delete(path.basename(absPath));\n }\n }\n\n registerPath(p: string, st: Stats | null) {\n const absPath = path.resolve(p);\n this.registerNormalized(absPath, st);\n }\n\n invalidate() {\n this.invalidated = true;\n }\n\n registerNormalized(\n absPath: string,\n observed: Stats | null,\n observations = this.observedFiles,\n ): void {\n const existing = observations.get(absPath);\n if (existing !== undefined) {\n const stMatch = stMatches(observed, existing);\n if (!stMatch.matches) {\n if (this.traceEvents) {\n // eslint-disable-next-line no-console\n console.log(\n \"Invalidating due to st mismatch\",\n absPath,\n observed,\n existing,\n stMatch.reason,\n );\n }\n this.invalidated = true;\n }\n }\n observations.set(absPath, observed);\n }\n\n finalize(): Observations | \"invalidated\" {\n if (this.invalidated) {\n return \"invalidated\";\n }\n return new Observations(\n this.observedDirectories,\n this.observedFiles,\n this.observedLstats,\n );\n }\n}\n\nexport type WatchEvent = {\n name: \"add\" | \"addDir\" | \"change\" | \"unlink\" | \"unlinkDir\";\n absPath: string;\n};\n\nexport class Observations {\n directories: Map<string, Set<string>>;\n files: Map<string, Stats | null>;\n\n constructor(\n directories: Map<string, Set<string>>,\n files: Map<string, Stats | null>,\n private lstats: Map<string, Stats | null> = new Map(),\n ) {\n this.directories = directories;\n this.files = files;\n }\n\n paths(): string[] {\n const out = [];\n for (const path of this.directories.keys()) {\n out.push(path);\n }\n for (const path of this.files.keys()) {\n out.push(path);\n }\n for (const path of this.lstats.keys()) out.push(path);\n return [...new Set(out)];\n }\n\n overlaps({\n absPath,\n }: WatchEvent): { overlaps: false } | { overlaps: true; reason: string } {\n let currentSt: null | Stats;\n try {\n currentSt = nodeFs.stat(absPath);\n } catch (e: any) {\n if (e.code === \"ENOENT\") {\n currentSt = null;\n } else {\n throw e;\n }\n }\n\n // First, check to see if we observed `absPath` as a file.\n const observedSt = this.files.get(absPath);\n if (observedSt !== undefined) {\n const stMatch = stMatches(observedSt, currentSt);\n if (!stMatch.matches) {\n const reason = `modified (${stMatch.reason})`;\n return { overlaps: true, reason };\n }\n }\n\n const observedLstat = this.lstats.get(absPath);\n if (observedLstat !== undefined) {\n let currentLstat: Stats | null;\n try {\n currentLstat = nodeFs.lstat(absPath);\n } catch (err: any) {\n if (err.code !== \"ENOENT\") throw err;\n currentLstat = null;\n }\n const match = stMatches(observedLstat, currentLstat);\n if (!match.matches)\n return { overlaps: true, reason: `modified (${match.reason})` };\n }\n\n // Second, check if we listed the directory this file is in.\n const parentPath = path.resolve(path.dirname(absPath));\n const observedParent = this.directories.get(parentPath);\n if (observedParent !== undefined) {\n const filename = path.basename(absPath);\n\n // If the file is gone now, but we observed it in its directory, then\n // it was deleted.\n if (currentSt === null && observedParent.has(filename)) {\n return { overlaps: true, reason: \"deleted\" };\n }\n\n // If the file exists now, but we didn't see it when listing its directory,\n // then it was added.\n if (currentSt !== null && !observedParent.has(filename)) {\n return { overlaps: true, reason: \"added\" };\n }\n }\n\n return { overlaps: false };\n }\n}\n\nfunction setsEqual<T>(a: Set<T>, b: Set<T>): boolean {\n if (a.size !== b.size) {\n return false;\n }\n for (const elem of a.keys()) {\n if (!b.has(elem)) {\n return false;\n }\n }\n return true;\n}\n\nexport function stMatches(\n a: Stats | null,\n b: Stats | null,\n): { matches: true } | { matches: false; reason: string } {\n if (a === null && b === null) {\n return { matches: true };\n }\n if (a !== null && b !== null) {\n if (a.dev !== b.dev) {\n return { matches: false, reason: \"device boundary\" };\n }\n if (a.isFile() || b.isFile()) {\n if (!a.isFile() || !b.isFile()) {\n return { matches: false, reason: \"file type\" };\n }\n if (a.ino !== b.ino) {\n return {\n matches: false,\n reason: `file inode (${a.ino} vs. ${b.ino})`,\n };\n }\n if (a.size !== b.size) {\n return {\n matches: false,\n reason: `file size (${a.size} vs. ${b.size})`,\n };\n }\n if (a.mtimeMs !== b.mtimeMs) {\n return {\n matches: false,\n reason: `file mtime (${a.mtimeMs} vs. ${b.mtimeMs})`,\n };\n }\n return { matches: true };\n }\n if (a.isDirectory() || b.isDirectory()) {\n if (!b.isDirectory() || !b.isDirectory()) {\n return { matches: false, reason: \"dir file type\" };\n }\n if (a.ino !== b.ino) {\n return {\n matches: false,\n reason: `dir inode (${a.ino} vs. ${b.ino})`,\n };\n }\n return { matches: true };\n }\n // If we have something other than a file or directory, just compare inodes.\n if (a.ino !== b.ino) {\n return {\n matches: false,\n reason: `special inode (${a.ino} vs. ${b.ino})`,\n };\n }\n return { matches: true };\n }\n return { matches: false, reason: \"deleted mismatch\" };\n}\n\n// Sort consistent with unix directory listings.\nexport function consistentPathSort(a: Dirent, b: Dirent) {\n for (let i = 0; i < Math.min(a.name.length, b.name.length); i++) {\n if (a.name.charCodeAt(i) !== b.name.charCodeAt(i)) {\n return a.name.charCodeAt(i) - b.name.charCodeAt(i);\n }\n }\n return a.name.length - b.name.length;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,mBAA4B;AAC5B,gBAAuD;AACvD,iBAA4B;AAC5B,gBAAe;AACf,kBAAiB;AACjB,oBAAmB;AAKnB,MAAM,oBAAoB;AAC1B,SAAS,aAAa;AAWpB,QAAM,YAAY,QAAQ,IAAI,iBAAiB;AAC/C,SAAO,aAAa,UAAAA,QAAG,OAAO;AAChC;AACA,MAAM,aAAa,WAAW;AAE9B,IAAI,SAAS;AACb,SAAS,oBAAoB,SAAiB;AAC5C,QAAM,SAAS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,YAAY,GAAG;AACxC,eAAO,EAAE,SAAS,OAAO,QAAQ,gBAAgB;AAAA,MACnD;AACA,UAAI,EAAE,QAAQ,EAAE,KAAK;AACnB,eAAO;AAAA,UACL,SAAS;AAAA,UACT,QAAQ,cAAc,EAAE,GAAG,QAAQ,EAAE,GAAG;AAAA,QAC1C;AAAA,MACF;AACA,aAAO,EAAE,SAAS,KAAK;AAAA,IACzB;AAEA,QAAI,EAAE,QAAQ,EAAE,KAAK;AACnB,aAAO;AAAA,QACL,SAAS;AAAA,QACT,QAAQ,kBAAkB,EAAE,GAAG,QAAQ,EAAE,GAAG;AAAA,MAC9C;AAAA,IACF;AACA,WAAO,EAAE,SAAS,KAAK;AAAA,EACzB;AACA,SAAO,EAAE,SAAS,OAAO,QAAQ,mBAAmB;AACtD;AAGO,SAAS,mBAAmB,GAAW,GAAW;AACvD,WAAS,IAAI,GAAG,IAAI,KAAK,IAAI,EAAE,KAAK,QAAQ,EAAE,KAAK,MAAM,GAAG,KAAK;AAC/D,QAAI,EAAE,KAAK,WAAW,CAAC,MAAM,EAAE,KAAK,WAAW,CAAC,GAAG;AACjD,aAAO,EAAE,KAAK,WAAW,CAAC,IAAI,EAAE,KAAK,WAAW,CAAC;AAAA,IACnD;AAAA,EACF;AACA,SAAO,EAAE,KAAK,SAAS,EAAE,KAAK;AAChC;",
|
|
6
6
|
"names": ["os", "path", "stdFs", "crypto"]
|
|
7
7
|
}
|
|
@@ -214,7 +214,8 @@ async function bundle({
|
|
|
214
214
|
availableExternalPackages,
|
|
215
215
|
result.externalModuleNames
|
|
216
216
|
),
|
|
217
|
-
bundledModuleNames: result.bundledModuleNames
|
|
217
|
+
bundledModuleNames: result.bundledModuleNames,
|
|
218
|
+
metafile: result.metafile ?? null
|
|
218
219
|
};
|
|
219
220
|
}
|
|
220
221
|
async function externalPackageVersions(ctx, availableExternalPackages, referencedPackages) {
|
|
@@ -247,7 +248,7 @@ async function bundleSchema(ctx, dir, extraConditions) {
|
|
|
247
248
|
platform: "browser",
|
|
248
249
|
extraConditions
|
|
249
250
|
});
|
|
250
|
-
return result.modules;
|
|
251
|
+
return { modules: result.modules, metafile: result.metafile };
|
|
251
252
|
}
|
|
252
253
|
async function bundleAuthConfig(ctx, dir) {
|
|
253
254
|
const authConfigPath = import_path.default.resolve(dir, "auth.config.js");
|
|
@@ -266,7 +267,7 @@ async function bundleAuthConfig(ctx, dir) {
|
|
|
266
267
|
`Found no auth config file at ${authConfigTsPath} or ${authConfigPath} so there are no configured auth providers`
|
|
267
268
|
)
|
|
268
269
|
);
|
|
269
|
-
return [];
|
|
270
|
+
return { modules: [], metafile: null };
|
|
270
271
|
}
|
|
271
272
|
(0, import_log.logVerbose)(import_chalk.chalkStderr.yellow(`Bundling auth config found at ${chosenPath}`));
|
|
272
273
|
const result = await bundle({
|
|
@@ -278,7 +279,7 @@ async function bundleAuthConfig(ctx, dir) {
|
|
|
278
279
|
// The auth config must be one module
|
|
279
280
|
splitting: false
|
|
280
281
|
});
|
|
281
|
-
return result.modules;
|
|
282
|
+
return { modules: result.modules, metafile: result.metafile };
|
|
282
283
|
}
|
|
283
284
|
async function doesImportConvexHttpRouter(source) {
|
|
284
285
|
try {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/bundler/index.ts"],
|
|
4
|
-
"sourcesContent": ["import path from \"path\";\nimport { chalkStderr } from \"chalk\";\nimport esbuild from \"esbuild\";\nimport { parse as parseAST } from \"@babel/parser\";\nimport { Identifier, ImportSpecifier } from \"@babel/types\";\nimport * as Sentry from \"@sentry/node\";\nimport { Filesystem, consistentPathSort } from \"./fs.js\";\nimport { Context } from \"./context.js\";\nimport { logVerbose, logWarning } from \"./log.js\";\nimport { wasmPlugin } from \"./wasm.js\";\nimport { serverOnlyPlugin } from \"./serverOnly.js\";\nimport {\n ExternalPackage,\n computeExternalPackages,\n createExternalPlugin,\n findExactVersionAndDependencies,\n} from \"./external.js\";\nimport { innerEsbuild, isEsbuildBuildError } from \"./debugBundle.js\";\nexport { nodeFs, RecordingFs } from \"./fs.js\";\nexport type { Filesystem } from \"./fs.js\";\n\nexport const actionsDir = \"actions\";\n\n// Returns a generator of { isDir, path, depth } for all paths\n// within dirPath in some topological order (not including\n// dirPath itself).\nexport function* walkDir(\n fs: Filesystem,\n dirPath: string,\n shouldSkipDir?: (dirPath: string) => boolean,\n depth?: number,\n): Generator<{ isDir: boolean; path: string; depth: number }, void, void> {\n depth = depth ?? 0;\n for (const dirEntry of fs.listDir(dirPath).sort(consistentPathSort)) {\n const childPath = path.join(dirPath, dirEntry.name);\n if (dirEntry.isDirectory()) {\n if (shouldSkipDir && shouldSkipDir(childPath)) {\n continue;\n }\n yield { isDir: true, path: childPath, depth };\n yield* walkDir(fs, childPath, shouldSkipDir, depth + 1);\n } else if (dirEntry.isFile()) {\n yield { isDir: false, path: childPath, depth };\n }\n }\n}\n\n// Convex specific module environment.\ntype ModuleEnvironment = \"node\" | \"isolate\";\n\nexport interface Bundle {\n path: string;\n source: string;\n sourceMap?: string | undefined;\n environment: ModuleEnvironment;\n}\n\nexport interface BundleHash {\n path: string;\n hash: string;\n environment: ModuleEnvironment;\n}\n\ntype EsBuildResult = esbuild.BuildResult & {\n outputFiles: esbuild.OutputFile[];\n // Set of referenced external modules.\n externalModuleNames: Set<string>;\n // Set of bundled modules.\n bundledModuleNames: Set<string>;\n};\n\nasync function doEsbuild({\n ctx,\n dir,\n entryPoints,\n generateSourceMaps,\n platform,\n chunksFolder,\n externalPackages,\n extraConditions,\n includeSourcesContent,\n splitting,\n}: {\n ctx: Context;\n dir: string;\n entryPoints: string[];\n generateSourceMaps: boolean;\n platform: esbuild.Platform;\n chunksFolder: string;\n externalPackages: Map<string, ExternalPackage>;\n extraConditions: string[];\n includeSourcesContent: boolean;\n splitting?: boolean | undefined;\n}): Promise<EsBuildResult> {\n const external = createExternalPlugin(ctx, externalPackages);\n try {\n const result = await innerEsbuild({\n entryPoints,\n platform,\n generateSourceMaps,\n chunksFolder,\n extraConditions,\n dir,\n // serverOnlyPlugin runs first so `server-only` is always stubbed,\n // even if it appears in the external packages list.\n // wasmPlugin runs last so it doesn't run on external modules.\n plugins: [serverOnlyPlugin, external.plugin, wasmPlugin],\n includeSourcesContent,\n splitting,\n });\n\n for (const [relPath, input] of Object.entries(result.metafile!.inputs)) {\n // TODO: esbuild outputs paths prefixed with \"(disabled)\"\" when bundling our internal\n // udf-runtime package. The files do actually exist locally, though.\n if (\n relPath.indexOf(\"(disabled):\") !== -1 ||\n relPath.startsWith(\"wasm-binary:\") ||\n relPath.startsWith(\"wasm-stub:\") ||\n relPath.startsWith(\"server-only-stub:\") ||\n relPath.startsWith(\"async-hooks-shim:\")\n ) {\n continue;\n }\n const absPath = path.resolve(relPath);\n const st = ctx.fs.stat(absPath);\n if (st.size !== input.bytes) {\n logWarning(\n `Bundled file ${absPath} changed right after esbuild invocation`,\n );\n // Consider this a transient error so we'll try again and hopefully\n // no files change right after esbuild next time.\n return await ctx.crash({\n exitCode: 1,\n errorType: \"transient\",\n printedMessage: null,\n });\n }\n ctx.fs.registerPath(absPath, st);\n }\n return {\n ...result,\n externalModuleNames: external.externalModuleNames,\n bundledModuleNames: external.bundledModuleNames,\n };\n } catch (e: unknown) {\n // esbuild sometimes throws a build error instead of returning a result\n // containing an array of errors. Syntax errors are one of these cases.\n let recommendUseNode = false;\n if (isEsbuildBuildError(e)) {\n for (const error of e.errors) {\n if (error.location) {\n const absPath = path.resolve(error.location.file);\n const st = ctx.fs.stat(absPath);\n ctx.fs.registerPath(absPath, st);\n }\n if (\n platform !== \"node\" &&\n !recommendUseNode &&\n error.notes.some((note) =>\n note.text.includes(\"Are you trying to bundle for node?\"),\n )\n ) {\n recommendUseNode = true;\n }\n }\n }\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n // We don't print any error because esbuild already printed\n // all the relevant information.\n printedMessage: recommendUseNode\n ? `\\nIt looks like you are using Node APIs from a file without the \"use node\" directive.\\n` +\n `Split out actions using Node.js APIs like this into a new file only containing actions that uses \"use node\" ` +\n `so these actions will run in a Node.js environment.\\n` +\n `For more information see https://docs.convex.dev/functions/runtimes#nodejs-runtime\\n`\n : null,\n });\n }\n}\n\nexport async function bundle({\n ctx,\n dir,\n entryPoints,\n generateSourceMaps,\n platform,\n chunksFolder = \"_deps\",\n externalPackagesAllowList = [],\n extraConditions = [],\n includeSourcesContent = false,\n splitting,\n}: {\n ctx: Context;\n dir: string;\n entryPoints: string[];\n generateSourceMaps: boolean;\n platform: esbuild.Platform;\n chunksFolder?: string;\n externalPackagesAllowList?: string[];\n extraConditions?: string[];\n includeSourcesContent?: boolean;\n splitting?: boolean;\n}): Promise<{\n modules: Bundle[];\n externalDependencies: Map<string, string>;\n bundledModuleNames: Set<string>;\n}> {\n const availableExternalPackages = await computeExternalPackages(\n ctx,\n externalPackagesAllowList,\n );\n const result = await doEsbuild({\n ctx,\n dir,\n entryPoints,\n generateSourceMaps,\n platform,\n chunksFolder,\n externalPackages: availableExternalPackages,\n extraConditions,\n includeSourcesContent,\n splitting,\n });\n // Some ESBuild errors won't show up here, instead crashing in doEsbuild().\n if (result.errors.length) {\n const errorMessage = result.errors\n .map((e) => `esbuild error: ${e.text}`)\n .join(\"\\n\");\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: errorMessage,\n });\n }\n for (const warning of result.warnings) {\n logWarning(chalkStderr.yellow(`esbuild warning: ${warning.text}`));\n }\n const sourceMaps = new Map();\n const modules: Bundle[] = [];\n const environment = platform === \"node\" ? \"node\" : \"isolate\";\n for (const outputFile of result.outputFiles) {\n const relPath = path.relative(path.normalize(\"out\"), outputFile.path);\n if (path.extname(relPath) === \".map\") {\n sourceMaps.set(relPath, outputFile.text);\n continue;\n }\n const posixRelPath = relPath.split(path.sep).join(path.posix.sep);\n modules.push({ path: posixRelPath, source: outputFile.text, environment });\n }\n for (const module of modules) {\n const sourceMapPath = module.path + \".map\";\n const sourceMap = sourceMaps.get(sourceMapPath);\n if (sourceMap) {\n module.sourceMap = sourceMap;\n }\n }\n\n return {\n modules,\n externalDependencies: await externalPackageVersions(\n ctx,\n availableExternalPackages,\n result.externalModuleNames,\n ),\n bundledModuleNames: result.bundledModuleNames,\n };\n}\n\n// We could return the full list of availableExternalPackages, but this would be\n// installing more packages that we need. Instead, we collect all external\n// dependencies we found during bundling the /convex function, as well as their\n// respective peer and optional dependencies.\nasync function externalPackageVersions(\n ctx: Context,\n availableExternalPackages: Map<string, ExternalPackage>,\n referencedPackages: Set<string>,\n): Promise<Map<string, string>> {\n const versions = new Map<string, string>();\n const referencedPackagesQueue = Array.from(referencedPackages.keys());\n\n for (let i = 0; i < referencedPackagesQueue.length; i++) {\n const moduleName = referencedPackagesQueue[i];\n // This assertion is safe because referencedPackages can only contain\n // packages in availableExternalPackages.\n const modulePath = availableExternalPackages.get(moduleName)!.path;\n // Since we don't support lock files and different install commands yet, we\n // pick up the exact version installed on the local filesystem.\n const { version, peerAndOptionalDependencies } =\n await findExactVersionAndDependencies(ctx, moduleName, modulePath);\n versions.set(moduleName, version);\n\n for (const dependency of peerAndOptionalDependencies) {\n if (\n availableExternalPackages.has(dependency) &&\n !referencedPackages.has(dependency)\n ) {\n referencedPackagesQueue.push(dependency);\n referencedPackages.add(dependency);\n }\n }\n }\n\n return versions;\n}\n\nexport async function bundleSchema(\n ctx: Context,\n dir: string,\n extraConditions: string[],\n) {\n let target = path.resolve(dir, \"schema.ts\");\n if (!ctx.fs.exists(target)) {\n target = path.resolve(dir, \"schema.js\");\n }\n const result = await bundle({\n ctx,\n dir,\n entryPoints: [target],\n generateSourceMaps: true,\n platform: \"browser\",\n extraConditions,\n });\n return result.modules;\n}\n\nexport async function bundleAuthConfig(ctx: Context, dir: string) {\n const authConfigPath = path.resolve(dir, \"auth.config.js\");\n const authConfigTsPath = path.resolve(dir, \"auth.config.ts\");\n if (ctx.fs.exists(authConfigPath) && ctx.fs.exists(authConfigTsPath)) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: `Found both ${authConfigPath} and ${authConfigTsPath}, choose one.`,\n });\n }\n const chosenPath = ctx.fs.exists(authConfigTsPath)\n ? authConfigTsPath\n : authConfigPath;\n if (!ctx.fs.exists(chosenPath)) {\n logVerbose(\n chalkStderr.yellow(\n `Found no auth config file at ${authConfigTsPath} or ${authConfigPath} so there are no configured auth providers`,\n ),\n );\n return [];\n }\n logVerbose(chalkStderr.yellow(`Bundling auth config found at ${chosenPath}`));\n const result = await bundle({\n ctx,\n dir,\n entryPoints: [chosenPath],\n generateSourceMaps: true,\n platform: \"browser\",\n // The auth config must be one module\n splitting: false,\n });\n return result.modules;\n}\n\nexport async function doesImportConvexHttpRouter(source: string) {\n try {\n const ast = parseAST(source, {\n sourceType: \"module\",\n plugins: [\"typescript\"],\n });\n return ast.program.body.some((node) => {\n if (node.type !== \"ImportDeclaration\") return false;\n return node.specifiers.some((s) => {\n const specifier = s as ImportSpecifier;\n const imported = specifier.imported as Identifier;\n return imported.name === \"httpRouter\";\n });\n });\n } catch {\n return (\n source.match(\n /import\\s*\\{\\s*httpRouter.*\\}\\s*from\\s*\"\\s*convex\\/server\\s*\"/,\n ) !== null\n );\n }\n}\n\nconst ENTRY_POINT_EXTENSIONS = [\n // ESBuild js loader\n \".js\",\n \".mjs\",\n \".cjs\",\n // ESBuild ts loader\n \".ts\",\n \".tsx\",\n \".mts\",\n \".cts\",\n // ESBuild jsx loader\n \".jsx\",\n // ESBuild supports css, text, json, and more but these file types are not\n // allowed to define entry points.\n];\n\nexport async function entryPoints(\n ctx: Context,\n dir: string,\n): Promise<string[]> {\n const entryPoints = [];\n\n // Don't deploy directories in convex/ that define components\n // as this leads to double-deploying.\n const looksLikeNestedComponent = (dirPath: string): boolean => {\n const config = path.join(dirPath, \"convex.config.ts\");\n const isComponentDefinition = ctx.fs.exists(config);\n if (isComponentDefinition) {\n logVerbose(chalkStderr.yellow(`Skipping component directory ${dirPath}`));\n }\n return isComponentDefinition;\n };\n\n for (const { isDir, path: fpath, depth } of walkDir(\n ctx.fs,\n dir,\n looksLikeNestedComponent,\n )) {\n if (isDir) {\n continue;\n }\n const relPath = path.relative(dir, fpath);\n const parsedPath = path.parse(fpath);\n const base = parsedPath.base;\n const extension = parsedPath.ext.toLowerCase();\n\n if (relPath.startsWith(\"_deps\" + path.sep)) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: `The path \"${fpath}\" is within the \"_deps\" directory, which is reserved for dependencies. Please move your code to another directory.`,\n });\n }\n\n if (depth === 0 && base.toLowerCase().startsWith(\"https.\")) {\n const source = ctx.fs.readUtf8File(fpath);\n if (await doesImportConvexHttpRouter(source))\n logWarning(\n chalkStderr.yellow(\n `Found ${fpath}. HTTP action routes will not be imported from this file. Did you mean to include http${extension}?`,\n ),\n );\n Sentry.captureMessage(\n `User code top level directory contains file ${base} which imports httpRouter.`,\n \"warning\",\n );\n }\n\n // This should match isEntryPoint in the convex eslint plugin.\n if (!ENTRY_POINT_EXTENSIONS.some((ext) => relPath.endsWith(ext))) {\n logVerbose(chalkStderr.yellow(`Skipping non-JS file ${fpath}`));\n } else if (relPath.startsWith(\"_generated\" + path.sep)) {\n logVerbose(chalkStderr.yellow(`Skipping ${fpath}`));\n } else if (base.startsWith(\".\")) {\n logVerbose(chalkStderr.yellow(`Skipping dotfile ${fpath}`));\n } else if (base.startsWith(\"#\")) {\n logVerbose(chalkStderr.yellow(`Skipping likely emacs tempfile ${fpath}`));\n } else if (base === \"schema.ts\" || base === \"schema.js\") {\n logVerbose(chalkStderr.yellow(`Skipping ${fpath}`));\n } else if ((base.match(/\\./g) || []).length > 1) {\n // `auth.config.ts` and `convex.config.ts` are important not to bundle.\n // `*.test.ts` `*.spec.ts` are common in developer code.\n logVerbose(\n chalkStderr.yellow(`Skipping ${fpath} that contains multiple dots`),\n );\n } else if (relPath.includes(\" \")) {\n logVerbose(\n chalkStderr.yellow(`Skipping ${relPath} because it contains a space`),\n );\n } else {\n logVerbose(chalkStderr.green(`Preparing ${fpath}`));\n entryPoints.push(fpath);\n }\n }\n\n // If using TypeScript, require that at least one line starts with `export` or `import`,\n // a TypeScript requirement. This prevents confusing type errors from empty .ts files.\n const nonEmptyEntryPoints = entryPoints.filter((fpath) => {\n // This check only makes sense for TypeScript files\n if (!fpath.endsWith(\".ts\") && !fpath.endsWith(\".tsx\")) {\n return true;\n }\n const contents = ctx.fs.readUtf8File(fpath);\n if (/^\\s{0,100}(import|export)/m.test(contents)) {\n return true;\n }\n logVerbose(\n chalkStderr.yellow(\n `Skipping ${fpath} because it has no export or import to make it a valid TypeScript module`,\n ),\n );\n });\n\n return nonEmptyEntryPoints;\n}\n\n// A fallback regex in case we fail to parse the AST.\nexport const useNodeDirectiveRegex = /^\\s*(\"|')use node(\"|');?\\s*$/;\n\nfunction hasUseNodeDirective(ctx: Context, fpath: string): boolean {\n // Do a quick check for the exact string. If it doesn't exist, don't\n // bother parsing.\n const source = ctx.fs.readUtf8File(fpath);\n if (source.indexOf(\"use node\") === -1) {\n return false;\n }\n\n // We parse the AST here to extract the \"use node\" declaration. This is more\n // robust than doing a regex. We only use regex as a fallback.\n try {\n const ast = parseAST(source, {\n // parse in strict mode and allow module declarations\n sourceType: \"module\",\n\n // esbuild supports jsx and typescript by default. Allow the same plugins\n // here too.\n plugins: [\"jsx\", \"typescript\"],\n });\n return ast.program.directives\n .map((d) => d.value.value)\n .includes(\"use node\");\n } catch (error: any) {\n // Given that we have failed to parse, we are most likely going to fail in\n // the esbuild step, which seem to return better formatted error messages.\n // We don't throw here and fallback to regex.\n let lineMatches = false;\n for (const line of source.split(\"\\n\")) {\n if (line.match(useNodeDirectiveRegex)) {\n lineMatches = true;\n break;\n }\n }\n\n // Log that we failed to parse in verbose node if we need this for debugging.\n logVerbose(\n `Failed to parse ${fpath}. Use node is set to ${lineMatches} based on regex. Parse error: ${error.toString()}.`,\n );\n\n return lineMatches;\n }\n}\n\nexport function mustBeIsolate(relPath: string): boolean {\n // Check if the path without extension matches any of the static paths.\n return [\"http\", \"crons\", \"schema\", \"auth.config\"].includes(\n relPath.replace(/\\.[^/.]+$/, \"\"),\n );\n}\n\nasync function determineEnvironment(\n ctx: Context,\n dir: string,\n fpath: string,\n): Promise<ModuleEnvironment> {\n const relPath = path.relative(dir, fpath);\n\n const useNodeDirectiveFound = hasUseNodeDirective(ctx, fpath);\n if (useNodeDirectiveFound) {\n if (mustBeIsolate(relPath)) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: `\"use node\" directive is not allowed for ${relPath}.`,\n });\n }\n return \"node\";\n }\n\n const actionsPrefix = actionsDir + path.sep;\n if (relPath.startsWith(actionsPrefix)) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: `${relPath} is in /actions subfolder but has no \"use node\"; directive. You can now define actions in any folder and indicate they should run in node by adding \"use node\" directive. /actions is a deprecated way to choose Node.js environment, and we require \"use node\" for all files within that folder to avoid unexpected errors during the migration. See https://docs.convex.dev/functions/actions for more details`,\n });\n }\n\n return \"isolate\";\n}\n\nexport async function entryPointsByEnvironment(ctx: Context, dir: string) {\n const isolate = [];\n const node = [];\n for (const entryPoint of await entryPoints(ctx, dir)) {\n const environment = await determineEnvironment(ctx, dir, entryPoint);\n if (environment === \"node\") {\n node.push(entryPoint);\n } else {\n isolate.push(entryPoint);\n }\n }\n\n return { isolate, node };\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,mBAA4B;AAE5B,oBAAkC;AAElC,aAAwB;AACxB,gBAA+C;AAE/C,iBAAuC;AACvC,kBAA2B;AAC3B,wBAAiC;AACjC,sBAKO;AACP,yBAAkD;AAClD,IAAAA,aAA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AK,OAAO;AAC9B,UAAI,GAAG,SAAS,MAAM,OAAO;AAC3B;AAAA,UACE,gBAAgB,OAAO;AAAA,QACzB;AAGA,eAAO,MAAM,IAAI,MAAM;AAAA,UACrB,UAAU;AAAA,UACV,WAAW;AAAA,UACX,gBAAgB;AAAA,QAClB,CAAC;AAAA,MACH;AACA,UAAI,GAAG,aAAa,SAAS,EAAE;AAAA,IACjC;AACA,WAAO;AAAA,MACL,GAAG;AAAA,MACH,qBAAqB,SAAS;AAAA,MAC9B,oBAAoB,SAAS;AAAA,IAC/B;AAAA,EACF,SAAS,GAAY;AAGnB,QAAI,mBAAmB;AACvB,YAAI,wCAAoB,CAAC,GAAG;AAC1B,iBAAW,SAAS,EAAE,QAAQ;AAC5B,YAAI,MAAM,UAAU;AAClB,gBAAM,UAAU,YAAAA,QAAK,QAAQ,MAAM,SAAS,IAAI;AAChD,gBAAM,KAAK,IAAI,GAAG,KAAK,OAAO;AAC9B,cAAI,GAAG,aAAa,SAAS,EAAE;AAAA,QACjC;AACA,YACE,aAAa,UACb,CAAC,oBACD,MAAM,MAAM;AAAA,UAAK,CAAC,SAChB,KAAK,KAAK,SAAS,oCAAoC;AAAA,QACzD,GACA;AACA,6BAAmB;AAAA,QACrB;AAAA,MACF;AAAA,IACF;AACA,WAAO,MAAM,IAAI,MAAM;AAAA,MACrB,UAAU;AAAA,MACV,WAAW;AAAA;AAAA;AAAA,MAGX,gBAAgB,mBACZ;AAAA;AAAA;AAAA;AAAA,IAIA;AAAA,IACN,CAAC;AAAA,EACH;AACF;AAEA,eAAsB,OAAO;AAAA,EAC3B;AAAA,EACA;AAAA,EACA,aAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf,4BAA4B,CAAC;AAAA,EAC7B,kBAAkB,CAAC;AAAA,EACnB,wBAAwB;AAAA,EACxB;AACF,
|
|
4
|
+
"sourcesContent": ["import path from \"path\";\nimport { chalkStderr } from \"chalk\";\nimport esbuild from \"esbuild\";\nimport { parse as parseAST } from \"@babel/parser\";\nimport { Identifier, ImportSpecifier } from \"@babel/types\";\nimport * as Sentry from \"@sentry/node\";\nimport { Filesystem, consistentPathSort } from \"./fs.js\";\nimport { Context } from \"./context.js\";\nimport { logVerbose, logWarning } from \"./log.js\";\nimport { wasmPlugin } from \"./wasm.js\";\nimport { serverOnlyPlugin } from \"./serverOnly.js\";\nimport {\n ExternalPackage,\n computeExternalPackages,\n createExternalPlugin,\n findExactVersionAndDependencies,\n} from \"./external.js\";\nimport { innerEsbuild, isEsbuildBuildError } from \"./debugBundle.js\";\nexport { nodeFs, RecordingFs } from \"./fs.js\";\nexport type { Filesystem } from \"./fs.js\";\n\nexport const actionsDir = \"actions\";\n\n// Returns a generator of { isDir, path, depth } for all paths\n// within dirPath in some topological order (not including\n// dirPath itself).\nexport function* walkDir(\n fs: Filesystem,\n dirPath: string,\n shouldSkipDir?: (dirPath: string) => boolean,\n depth?: number,\n): Generator<{ isDir: boolean; path: string; depth: number }, void, void> {\n depth = depth ?? 0;\n for (const dirEntry of fs.listDir(dirPath).sort(consistentPathSort)) {\n const childPath = path.join(dirPath, dirEntry.name);\n if (dirEntry.isDirectory()) {\n if (shouldSkipDir && shouldSkipDir(childPath)) {\n continue;\n }\n yield { isDir: true, path: childPath, depth };\n yield* walkDir(fs, childPath, shouldSkipDir, depth + 1);\n } else if (dirEntry.isFile()) {\n yield { isDir: false, path: childPath, depth };\n }\n }\n}\n\n// Convex specific module environment.\ntype ModuleEnvironment = \"node\" | \"isolate\";\n\nexport interface Bundle {\n path: string;\n source: string;\n sourceMap?: string | undefined;\n environment: ModuleEnvironment;\n}\n\nexport interface BundleHash {\n path: string;\n hash: string;\n environment: ModuleEnvironment;\n}\n\ntype EsBuildResult = esbuild.BuildResult & {\n outputFiles: esbuild.OutputFile[];\n // Set of referenced external modules.\n externalModuleNames: Set<string>;\n // Set of bundled modules.\n bundledModuleNames: Set<string>;\n};\n\nasync function doEsbuild({\n ctx,\n dir,\n entryPoints,\n generateSourceMaps,\n platform,\n chunksFolder,\n externalPackages,\n extraConditions,\n includeSourcesContent,\n splitting,\n}: {\n ctx: Context;\n dir: string;\n entryPoints: string[];\n generateSourceMaps: boolean;\n platform: esbuild.Platform;\n chunksFolder: string;\n externalPackages: Map<string, ExternalPackage>;\n extraConditions: string[];\n includeSourcesContent: boolean;\n splitting?: boolean | undefined;\n}): Promise<EsBuildResult> {\n const external = createExternalPlugin(ctx, externalPackages);\n try {\n const result = await innerEsbuild({\n entryPoints,\n platform,\n generateSourceMaps,\n chunksFolder,\n extraConditions,\n dir,\n // serverOnlyPlugin runs first so `server-only` is always stubbed,\n // even if it appears in the external packages list.\n // wasmPlugin runs last so it doesn't run on external modules.\n plugins: [serverOnlyPlugin, external.plugin, wasmPlugin],\n includeSourcesContent,\n splitting,\n });\n\n for (const [relPath, input] of Object.entries(result.metafile!.inputs)) {\n // TODO: esbuild outputs paths prefixed with \"(disabled)\"\" when bundling our internal\n // udf-runtime package. The files do actually exist locally, though.\n if (\n relPath.indexOf(\"(disabled):\") !== -1 ||\n relPath.startsWith(\"wasm-binary:\") ||\n relPath.startsWith(\"wasm-stub:\") ||\n relPath.startsWith(\"server-only-stub:\") ||\n relPath.startsWith(\"async-hooks-shim:\")\n ) {\n continue;\n }\n const absPath = path.resolve(relPath);\n const st = ctx.fs.stat(absPath);\n if (st.size !== input.bytes) {\n logWarning(\n `Bundled file ${absPath} changed right after esbuild invocation`,\n );\n // Consider this a transient error so we'll try again and hopefully\n // no files change right after esbuild next time.\n return await ctx.crash({\n exitCode: 1,\n errorType: \"transient\",\n printedMessage: null,\n });\n }\n ctx.fs.registerPath(absPath, st);\n }\n return {\n ...result,\n externalModuleNames: external.externalModuleNames,\n bundledModuleNames: external.bundledModuleNames,\n };\n } catch (e: unknown) {\n // esbuild sometimes throws a build error instead of returning a result\n // containing an array of errors. Syntax errors are one of these cases.\n let recommendUseNode = false;\n if (isEsbuildBuildError(e)) {\n for (const error of e.errors) {\n if (error.location) {\n const absPath = path.resolve(error.location.file);\n const st = ctx.fs.stat(absPath);\n ctx.fs.registerPath(absPath, st);\n }\n if (\n platform !== \"node\" &&\n !recommendUseNode &&\n error.notes.some((note) =>\n note.text.includes(\"Are you trying to bundle for node?\"),\n )\n ) {\n recommendUseNode = true;\n }\n }\n }\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n // We don't print any error because esbuild already printed\n // all the relevant information.\n printedMessage: recommendUseNode\n ? `\\nIt looks like you are using Node APIs from a file without the \"use node\" directive.\\n` +\n `Split out actions using Node.js APIs like this into a new file only containing actions that uses \"use node\" ` +\n `so these actions will run in a Node.js environment.\\n` +\n `For more information see https://docs.convex.dev/functions/runtimes#nodejs-runtime\\n`\n : null,\n });\n }\n}\n\nexport async function bundle({\n ctx,\n dir,\n entryPoints,\n generateSourceMaps,\n platform,\n chunksFolder = \"_deps\",\n externalPackagesAllowList = [],\n extraConditions = [],\n includeSourcesContent = false,\n splitting,\n}: {\n ctx: Context;\n dir: string;\n entryPoints: string[];\n generateSourceMaps: boolean;\n platform: esbuild.Platform;\n chunksFolder?: string;\n externalPackagesAllowList?: string[];\n extraConditions?: string[];\n includeSourcesContent?: boolean;\n splitting?: boolean;\n}): Promise<{\n modules: Bundle[];\n externalDependencies: Map<string, string>;\n bundledModuleNames: Set<string>;\n metafile: esbuild.Metafile | null;\n}> {\n const availableExternalPackages = await computeExternalPackages(\n ctx,\n externalPackagesAllowList,\n );\n const result = await doEsbuild({\n ctx,\n dir,\n entryPoints,\n generateSourceMaps,\n platform,\n chunksFolder,\n externalPackages: availableExternalPackages,\n extraConditions,\n includeSourcesContent,\n splitting,\n });\n // Some ESBuild errors won't show up here, instead crashing in doEsbuild().\n if (result.errors.length) {\n const errorMessage = result.errors\n .map((e) => `esbuild error: ${e.text}`)\n .join(\"\\n\");\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: errorMessage,\n });\n }\n for (const warning of result.warnings) {\n logWarning(chalkStderr.yellow(`esbuild warning: ${warning.text}`));\n }\n const sourceMaps = new Map();\n const modules: Bundle[] = [];\n const environment = platform === \"node\" ? \"node\" : \"isolate\";\n for (const outputFile of result.outputFiles) {\n const relPath = path.relative(path.normalize(\"out\"), outputFile.path);\n if (path.extname(relPath) === \".map\") {\n sourceMaps.set(relPath, outputFile.text);\n continue;\n }\n const posixRelPath = relPath.split(path.sep).join(path.posix.sep);\n modules.push({ path: posixRelPath, source: outputFile.text, environment });\n }\n for (const module of modules) {\n const sourceMapPath = module.path + \".map\";\n const sourceMap = sourceMaps.get(sourceMapPath);\n if (sourceMap) {\n module.sourceMap = sourceMap;\n }\n }\n\n return {\n modules,\n externalDependencies: await externalPackageVersions(\n ctx,\n availableExternalPackages,\n result.externalModuleNames,\n ),\n bundledModuleNames: result.bundledModuleNames,\n metafile: result.metafile ?? null,\n };\n}\n\n// We could return the full list of availableExternalPackages, but this would be\n// installing more packages that we need. Instead, we collect all external\n// dependencies we found during bundling the /convex function, as well as their\n// respective peer and optional dependencies.\nasync function externalPackageVersions(\n ctx: Context,\n availableExternalPackages: Map<string, ExternalPackage>,\n referencedPackages: Set<string>,\n): Promise<Map<string, string>> {\n const versions = new Map<string, string>();\n const referencedPackagesQueue = Array.from(referencedPackages.keys());\n\n for (let i = 0; i < referencedPackagesQueue.length; i++) {\n const moduleName = referencedPackagesQueue[i];\n // This assertion is safe because referencedPackages can only contain\n // packages in availableExternalPackages.\n const modulePath = availableExternalPackages.get(moduleName)!.path;\n // Since we don't support lock files and different install commands yet, we\n // pick up the exact version installed on the local filesystem.\n const { version, peerAndOptionalDependencies } =\n await findExactVersionAndDependencies(ctx, moduleName, modulePath);\n versions.set(moduleName, version);\n\n for (const dependency of peerAndOptionalDependencies) {\n if (\n availableExternalPackages.has(dependency) &&\n !referencedPackages.has(dependency)\n ) {\n referencedPackagesQueue.push(dependency);\n referencedPackages.add(dependency);\n }\n }\n }\n\n return versions;\n}\n\nexport async function bundleSchema(\n ctx: Context,\n dir: string,\n extraConditions: string[],\n) {\n let target = path.resolve(dir, \"schema.ts\");\n if (!ctx.fs.exists(target)) {\n target = path.resolve(dir, \"schema.js\");\n }\n const result = await bundle({\n ctx,\n dir,\n entryPoints: [target],\n generateSourceMaps: true,\n platform: \"browser\",\n extraConditions,\n });\n return { modules: result.modules, metafile: result.metafile };\n}\n\nexport async function bundleAuthConfig(\n ctx: Context,\n dir: string,\n): Promise<{ modules: Bundle[]; metafile: esbuild.Metafile | null }> {\n const authConfigPath = path.resolve(dir, \"auth.config.js\");\n const authConfigTsPath = path.resolve(dir, \"auth.config.ts\");\n if (ctx.fs.exists(authConfigPath) && ctx.fs.exists(authConfigTsPath)) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: `Found both ${authConfigPath} and ${authConfigTsPath}, choose one.`,\n });\n }\n const chosenPath = ctx.fs.exists(authConfigTsPath)\n ? authConfigTsPath\n : authConfigPath;\n if (!ctx.fs.exists(chosenPath)) {\n logVerbose(\n chalkStderr.yellow(\n `Found no auth config file at ${authConfigTsPath} or ${authConfigPath} so there are no configured auth providers`,\n ),\n );\n return { modules: [], metafile: null };\n }\n logVerbose(chalkStderr.yellow(`Bundling auth config found at ${chosenPath}`));\n const result = await bundle({\n ctx,\n dir,\n entryPoints: [chosenPath],\n generateSourceMaps: true,\n platform: \"browser\",\n // The auth config must be one module\n splitting: false,\n });\n return { modules: result.modules, metafile: result.metafile };\n}\n\nexport async function doesImportConvexHttpRouter(source: string) {\n try {\n const ast = parseAST(source, {\n sourceType: \"module\",\n plugins: [\"typescript\"],\n });\n return ast.program.body.some((node) => {\n if (node.type !== \"ImportDeclaration\") return false;\n return node.specifiers.some((s) => {\n const specifier = s as ImportSpecifier;\n const imported = specifier.imported as Identifier;\n return imported.name === \"httpRouter\";\n });\n });\n } catch {\n return (\n source.match(\n /import\\s*\\{\\s*httpRouter.*\\}\\s*from\\s*\"\\s*convex\\/server\\s*\"/,\n ) !== null\n );\n }\n}\n\nconst ENTRY_POINT_EXTENSIONS = [\n // ESBuild js loader\n \".js\",\n \".mjs\",\n \".cjs\",\n // ESBuild ts loader\n \".ts\",\n \".tsx\",\n \".mts\",\n \".cts\",\n // ESBuild jsx loader\n \".jsx\",\n // ESBuild supports css, text, json, and more but these file types are not\n // allowed to define entry points.\n];\n\nexport async function entryPoints(\n ctx: Context,\n dir: string,\n): Promise<string[]> {\n const entryPoints = [];\n\n // Don't deploy directories in convex/ that define components\n // as this leads to double-deploying.\n const looksLikeNestedComponent = (dirPath: string): boolean => {\n const config = path.join(dirPath, \"convex.config.ts\");\n const isComponentDefinition = ctx.fs.exists(config);\n if (isComponentDefinition) {\n logVerbose(chalkStderr.yellow(`Skipping component directory ${dirPath}`));\n }\n return isComponentDefinition;\n };\n\n for (const { isDir, path: fpath, depth } of walkDir(\n ctx.fs,\n dir,\n looksLikeNestedComponent,\n )) {\n if (isDir) {\n continue;\n }\n const relPath = path.relative(dir, fpath);\n const parsedPath = path.parse(fpath);\n const base = parsedPath.base;\n const extension = parsedPath.ext.toLowerCase();\n\n if (relPath.startsWith(\"_deps\" + path.sep)) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: `The path \"${fpath}\" is within the \"_deps\" directory, which is reserved for dependencies. Please move your code to another directory.`,\n });\n }\n\n if (depth === 0 && base.toLowerCase().startsWith(\"https.\")) {\n const source = ctx.fs.readUtf8File(fpath);\n if (await doesImportConvexHttpRouter(source))\n logWarning(\n chalkStderr.yellow(\n `Found ${fpath}. HTTP action routes will not be imported from this file. Did you mean to include http${extension}?`,\n ),\n );\n Sentry.captureMessage(\n `User code top level directory contains file ${base} which imports httpRouter.`,\n \"warning\",\n );\n }\n\n // This should match isEntryPoint in the convex eslint plugin.\n if (!ENTRY_POINT_EXTENSIONS.some((ext) => relPath.endsWith(ext))) {\n logVerbose(chalkStderr.yellow(`Skipping non-JS file ${fpath}`));\n } else if (relPath.startsWith(\"_generated\" + path.sep)) {\n logVerbose(chalkStderr.yellow(`Skipping ${fpath}`));\n } else if (base.startsWith(\".\")) {\n logVerbose(chalkStderr.yellow(`Skipping dotfile ${fpath}`));\n } else if (base.startsWith(\"#\")) {\n logVerbose(chalkStderr.yellow(`Skipping likely emacs tempfile ${fpath}`));\n } else if (base === \"schema.ts\" || base === \"schema.js\") {\n logVerbose(chalkStderr.yellow(`Skipping ${fpath}`));\n } else if ((base.match(/\\./g) || []).length > 1) {\n // `auth.config.ts` and `convex.config.ts` are important not to bundle.\n // `*.test.ts` `*.spec.ts` are common in developer code.\n logVerbose(\n chalkStderr.yellow(`Skipping ${fpath} that contains multiple dots`),\n );\n } else if (relPath.includes(\" \")) {\n logVerbose(\n chalkStderr.yellow(`Skipping ${relPath} because it contains a space`),\n );\n } else {\n logVerbose(chalkStderr.green(`Preparing ${fpath}`));\n entryPoints.push(fpath);\n }\n }\n\n // If using TypeScript, require that at least one line starts with `export` or `import`,\n // a TypeScript requirement. This prevents confusing type errors from empty .ts files.\n const nonEmptyEntryPoints = entryPoints.filter((fpath) => {\n // This check only makes sense for TypeScript files\n if (!fpath.endsWith(\".ts\") && !fpath.endsWith(\".tsx\")) {\n return true;\n }\n const contents = ctx.fs.readUtf8File(fpath);\n if (/^\\s{0,100}(import|export)/m.test(contents)) {\n return true;\n }\n logVerbose(\n chalkStderr.yellow(\n `Skipping ${fpath} because it has no export or import to make it a valid TypeScript module`,\n ),\n );\n });\n\n return nonEmptyEntryPoints;\n}\n\n// A fallback regex in case we fail to parse the AST.\nexport const useNodeDirectiveRegex = /^\\s*(\"|')use node(\"|');?\\s*$/;\n\nfunction hasUseNodeDirective(ctx: Context, fpath: string): boolean {\n // Do a quick check for the exact string. If it doesn't exist, don't\n // bother parsing.\n const source = ctx.fs.readUtf8File(fpath);\n if (source.indexOf(\"use node\") === -1) {\n return false;\n }\n\n // We parse the AST here to extract the \"use node\" declaration. This is more\n // robust than doing a regex. We only use regex as a fallback.\n try {\n const ast = parseAST(source, {\n // parse in strict mode and allow module declarations\n sourceType: \"module\",\n\n // esbuild supports jsx and typescript by default. Allow the same plugins\n // here too.\n plugins: [\"jsx\", \"typescript\"],\n });\n return ast.program.directives\n .map((d) => d.value.value)\n .includes(\"use node\");\n } catch (error: any) {\n // Given that we have failed to parse, we are most likely going to fail in\n // the esbuild step, which seem to return better formatted error messages.\n // We don't throw here and fallback to regex.\n let lineMatches = false;\n for (const line of source.split(\"\\n\")) {\n if (line.match(useNodeDirectiveRegex)) {\n lineMatches = true;\n break;\n }\n }\n\n // Log that we failed to parse in verbose node if we need this for debugging.\n logVerbose(\n `Failed to parse ${fpath}. Use node is set to ${lineMatches} based on regex. Parse error: ${error.toString()}.`,\n );\n\n return lineMatches;\n }\n}\n\nexport function mustBeIsolate(relPath: string): boolean {\n // Check if the path without extension matches any of the static paths.\n return [\"http\", \"crons\", \"schema\", \"auth.config\"].includes(\n relPath.replace(/\\.[^/.]+$/, \"\"),\n );\n}\n\nasync function determineEnvironment(\n ctx: Context,\n dir: string,\n fpath: string,\n): Promise<ModuleEnvironment> {\n const relPath = path.relative(dir, fpath);\n\n const useNodeDirectiveFound = hasUseNodeDirective(ctx, fpath);\n if (useNodeDirectiveFound) {\n if (mustBeIsolate(relPath)) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: `\"use node\" directive is not allowed for ${relPath}.`,\n });\n }\n return \"node\";\n }\n\n const actionsPrefix = actionsDir + path.sep;\n if (relPath.startsWith(actionsPrefix)) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: `${relPath} is in /actions subfolder but has no \"use node\"; directive. You can now define actions in any folder and indicate they should run in node by adding \"use node\" directive. /actions is a deprecated way to choose Node.js environment, and we require \"use node\" for all files within that folder to avoid unexpected errors during the migration. See https://docs.convex.dev/functions/actions for more details`,\n });\n }\n\n return \"isolate\";\n}\n\nexport async function entryPointsByEnvironment(ctx: Context, dir: string) {\n const isolate = [];\n const node = [];\n for (const entryPoint of await entryPoints(ctx, dir)) {\n const environment = await determineEnvironment(ctx, dir, entryPoint);\n if (environment === \"node\") {\n node.push(entryPoint);\n } else {\n isolate.push(entryPoint);\n }\n }\n\n return { isolate, node };\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,mBAA4B;AAE5B,oBAAkC;AAElC,aAAwB;AACxB,gBAA+C;AAE/C,iBAAuC;AACvC,kBAA2B;AAC3B,wBAAiC;AACjC,sBAKO;AACP,yBAAkD;AAClD,IAAAA,aAAoC;AAG7B,MAAM,aAAa;AAKnB,UAAU,QACf,IACA,SACA,eACA,OACwE;AACxE,UAAQ,SAAS;AACjB,aAAW,YAAY,GAAG,QAAQ,OAAO,EAAE,KAAK,4BAAkB,GAAG;AACnE,UAAM,YAAY,YAAAC,QAAK,KAAK,SAAS,SAAS,IAAI;AAClD,QAAI,SAAS,YAAY,GAAG;AAC1B,UAAI,iBAAiB,cAAc,SAAS,GAAG;AAC7C;AAAA,MACF;AACA,YAAM,EAAE,OAAO,MAAM,MAAM,WAAW,MAAM;AAC5C,aAAO,QAAQ,IAAI,WAAW,eAAe,QAAQ,CAAC;AAAA,IACxD,WAAW,SAAS,OAAO,GAAG;AAC5B,YAAM,EAAE,OAAO,OAAO,MAAM,WAAW,MAAM;AAAA,IAC/C;AAAA,EACF;AACF;AA0BA,eAAe,UAAU;AAAA,EACvB;AAAA,EACA;AAAA,EACA,aAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAW2B;AACzB,QAAM,eAAW,sCAAqB,KAAK,gBAAgB;AAC3D,MAAI;AACF,UAAM,SAAS,UAAM,iCAAa;AAAA,MAChC,aAAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA;A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