@@ -13,29 +13,46 @@ import path from 'node:path'
1313 * Falls back to published versions in CI or when packages don't exist.
1414 *
1515 * @param {string } [rootDir] - The root directory of the current project. Defaults to inferring from caller location.
16- * @returns {Record<string, string> } Package aliases mapping (package root, not dist ).
16+ * @returns {Record<string, string> } Package aliases mapping (to dist folders for build tools ).
1717 */
1818export function getLocalPackageAliases ( rootDir ) {
1919 const aliases = { }
2020
2121 // If no rootDir provided, try to infer from stack trace or use process.cwd().
2222 const baseDir = rootDir || process . cwd ( )
2323
24- // Check for ../socket-registry/registry .
25- const registryPath = path . join ( baseDir , '..' , 'socket-registry ' , 'registry ' )
26- if ( existsSync ( path . join ( registryPath , 'package.json' ) ) ) {
27- aliases [ '@socketsecurity/registry ' ] = registryPath
24+ // Check for ../socket-lib/dist for @socketsecurity/lib .
25+ const libPath = path . join ( baseDir , '..' , 'socket-lib ' , 'dist ' )
26+ if ( existsSync ( path . join ( libPath , '../ package.json' ) ) ) {
27+ aliases [ '@socketsecurity/lib ' ] = libPath
2828 }
2929
30- // Check for ../socket-packageurl-js.
31- const packageurlPath = path . join ( baseDir , '..' , 'socket-packageurl-js' )
32- if ( existsSync ( path . join ( packageurlPath , 'package.json' ) ) ) {
30+ // Check for ../socket-packageurl-js/dist.
31+ const packageurlPath = path . join (
32+ baseDir ,
33+ '..' ,
34+ 'socket-packageurl-js' ,
35+ 'dist' ,
36+ )
37+ if ( existsSync ( path . join ( packageurlPath , '../package.json' ) ) ) {
3338 aliases [ '@socketregistry/packageurl-js' ] = packageurlPath
3439 }
3540
36- // Check for ../socket-sdk-js.
37- const sdkPath = path . join ( baseDir , '..' , 'socket-sdk-js' )
38- if ( existsSync ( path . join ( sdkPath , 'package.json' ) ) ) {
41+ // Check for ../socket-registry/registry/dist for @socketsecurity/registry.
42+ const registryPath = path . join (
43+ baseDir ,
44+ '..' ,
45+ 'socket-registry' ,
46+ 'registry' ,
47+ 'dist' ,
48+ )
49+ if ( existsSync ( path . join ( registryPath , '../package.json' ) ) ) {
50+ aliases [ '@socketsecurity/registry' ] = registryPath
51+ }
52+
53+ // Check for ../socket-sdk-js/dist.
54+ const sdkPath = path . join ( baseDir , '..' , 'socket-sdk-js' , 'dist' )
55+ if ( existsSync ( path . join ( sdkPath , '../package.json' ) ) ) {
3956 aliases [ '@socketsecurity/sdk' ] = sdkPath
4057 }
4158
0 commit comments