@@ -8,7 +8,7 @@ import type { FunctionInfo, Manifest } from '../types';
88 * Build all manifests for a single function:
99 * - per-template files (placeholders applied, package.json/tsconfig.json processed)
1010 * - shared template files (same processing)
11- * - symlinks for handler.{ts,py}, *.d.ts, and any other *.py
11+ * - symlinks for handler.{ts,py} and supporting TypeScript/Python sources
1212 *
1313 * `templateDir` is the resolved type-specific dir (`templates/node-graphql/` etc.).
1414 */
@@ -56,17 +56,40 @@ export const buildPackageManifests = (
5656 out . push ( { kind : 'symlink' , path : path . join ( args . genDir , 'handler.py' ) , target : handlerPy } ) ;
5757 }
5858
59- // 4. Auxiliary symlinks: all *.d.ts and *.py (except handler.py already linked above)
60- const files = fs . readdirSync ( args . fnDir ) ;
61- for ( const file of files ) {
62- if ( file . endsWith ( '.d.ts' ) || ( file . endsWith ( '.py' ) && file !== 'handler.py' ) ) {
59+ // 4. Supporting source symlinks. Richer functions may split implementation
60+ // across nested TypeScript/Python files; mirror scripts/generate.ts exactly.
61+ const addSupportSymlinks = ( base = '' ) : void => {
62+ const entries = fs . readdirSync ( path . join ( args . fnDir , base ) ) ;
63+ for ( const entry of entries ) {
64+ if ( entry === '__tests__' ) continue ;
65+
66+ const relPath = path . join ( base , entry ) ;
67+ const sourcePath = path . join ( args . fnDir , relPath ) ;
68+ const stat = fs . statSync ( sourcePath ) ;
69+
70+ if ( stat . isDirectory ( ) ) {
71+ addSupportSymlinks ( relPath ) ;
72+ continue ;
73+ }
74+
75+ if (
76+ relPath === 'handler.ts' ||
77+ relPath === 'handler.py' ||
78+ ! ( / \. ( t s | d \. t s | p y ) $ / . test ( entry ) ) ||
79+ entry . endsWith ( '.test.ts' )
80+ ) {
81+ continue ;
82+ }
83+
6384 out . push ( {
6485 kind : 'symlink' ,
65- path : path . join ( args . genDir , file ) ,
66- target : path . join ( args . fnDir , file ) ,
86+ path : path . join ( args . genDir , relPath ) ,
87+ target : sourcePath ,
6788 } ) ;
6889 }
69- }
90+ } ;
91+
92+ addSupportSymlinks ( ) ;
7093
7194 return out ;
7295} ;
0 commit comments