File tree Expand file tree Collapse file tree 5 files changed +18
-1
lines changed
npm-packages/node-executor Expand file tree Collapse file tree 5 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -304,6 +304,10 @@ async function processExternalPackageStream(
304304
305305type LocalSourcePackage = {
306306 dir : string ;
307+ /**
308+ * The modules included in the package and that could contain Convex functions.
309+ * This doesn’t include bundler chunks (files in /_deps/).
310+ */
307311 modules : Set < CanonicalizedModulePath > ;
308312 dynamicallyDownloaded : boolean ;
309313} ;
@@ -440,7 +444,10 @@ function modulesFromMetadataJson(
440444) : Set < CanonicalizedModulePath > {
441445 const modules : Set < string > = new Set ( ) ;
442446 for ( const path of metadataJson . modulePaths ) {
443- if ( path . endsWith ( ".js" ) ) {
447+ if ( path . startsWith ( "_deps/" ) ) {
448+ // Ignore bundler chunks since they don’t contain Convex function definitions.
449+ continue ;
450+ } else if ( path . endsWith ( ".js" ) ) {
444451 // Only load node files.
445452 const environment = metadataJson . moduleEnvironments . get ( path ) ;
446453 if ( ! environment ) {
Original file line number Diff line number Diff line change @@ -485,13 +485,19 @@ async function test_download() {
485485
486486 const local = await maybeDownloadAndLinkPackages ( sourcePackage ) ;
487487 const sourceDir = path . join ( os . tmpdir ( ) , `source/test_modules_key` ) ;
488+
488489 assert . equal ( local . dir , sourceDir ) ;
489490 assert . equal ( local . modules . has ( "a.js" ) , true ) ;
490491 assert . equal ( local . modules . has ( "someFolder/someFile.js" ) , true ) ;
492+
491493 // Non-node modules
492494 assert . equal ( local . modules . has ( "third_party.js" ) , false ) ;
493495 assert . equal ( local . modules . has ( "d.js" ) , false ) ;
494496
497+ // We don’t include _deps in `.modules` since they can’t contain Convex functions
498+ assert . equal ( local . modules . has ( "_deps/node/sample_node.js" ) , false ) ;
499+ assert . equal ( local . modules . has ( "_deps/sample_isolate.js" ) , false ) ;
500+
495501 // Assert external deps package exists after download
496502 const externalDepsDir = path . join (
497503 os . tmpdir ( ) ,
Original file line number Diff line number Diff line change 11{
22 "modulePaths" : [
3+ " _deps/node/sample_node.js" ,
4+ " _deps/sample_isolate.js" ,
35 " a.js" ,
46 " b.js" ,
57 " c.js" ,
1820 " transitive.js"
1921 ],
2022 "moduleEnvironments" : [
23+ [" _deps/node/sample_node.js" , " node" ],
24+ [" _deps/sample_isolate.js" , " isolate" ],
2125 [" a.js" , " node" ],
2226 [" b.js" , " isolate" ],
2327 [" c.js" , " isolate" ],
You can’t perform that action at this time.
0 commit comments