@@ -75,54 +75,31 @@ function writeJsonFile(targetPath, value) {
7575
7676function ensureOpenClawExtensionAlias ( params ) {
7777 const pluginSdkDir = path . join ( params . repoRoot , "dist" , "plugin-sdk" ) ;
78- const aliasDir = path . join ( params . distExtensionsRoot , "node_modules" , "openclaw" ) ;
79-
80- if ( fs . existsSync ( pluginSdkDir ) ) {
81- const pluginSdkAliasPath = path . join ( aliasDir , "plugin-sdk" ) ;
82- fs . mkdirSync ( aliasDir , { recursive : true } ) ;
83- writeJsonFile ( path . join ( aliasDir , "package.json" ) , {
84- name : "openclaw" ,
85- type : "module" ,
86- exports : {
87- "./plugin-sdk" : "./plugin-sdk/index.js" ,
88- "./plugin-sdk/*" : "./plugin-sdk/*.js" ,
89- } ,
90- } ) ;
91- removePathIfExists ( pluginSdkAliasPath ) ;
92- fs . mkdirSync ( pluginSdkAliasPath , { recursive : true } ) ;
93- for ( const dirent of fs . readdirSync ( pluginSdkDir , { withFileTypes : true } ) ) {
94- if ( ! dirent . isFile ( ) || path . extname ( dirent . name ) !== ".js" ) {
95- continue ;
96- }
97- writeRuntimeModuleWrapper (
98- path . join ( pluginSdkDir , dirent . name ) ,
99- path . join ( pluginSdkAliasPath , dirent . name ) ,
100- ) ;
101- }
78+ if ( ! fs . existsSync ( pluginSdkDir ) ) {
79+ return ;
10280 }
10381
104- const ocPathDir = path . join ( params . distExtensionsRoot , "oc-path " ) ;
105- const ocPathApiPath = path . join ( ocPathDir , "api.js " ) ;
106- if ( fs . existsSync ( ocPathApiPath ) ) {
107- const ocPathAliasDir = path . join (
108- params . distExtensionsRoot ,
109- "node_modules ",
110- "@openclaw" ,
111- "oc-path " ,
112- ) ;
113- writeJsonFile ( path . join ( ocPathAliasDir , "package.json" ) , {
114- name : "@openclaw/oc-path" ,
115- type : "module" ,
116- exports : {
117- "." : "./index.js" ,
118- "./api.js" : "./api. js",
119- } ,
120- } ) ;
82+ const aliasDir = path . join ( params . distExtensionsRoot , "node_modules" , "openclaw ") ;
83+ const pluginSdkAliasPath = path . join ( aliasDir , "plugin-sdk " ) ;
84+ fs . mkdirSync ( aliasDir , { recursive : true } ) ;
85+ writeJsonFile ( path . join ( aliasDir , "package.json" ) , {
86+ name : "openclaw" ,
87+ type : "module ",
88+ exports : {
89+ "./plugin-sdk" : "./plugin-sdk/index.js ",
90+ "./plugin-sdk/*" : "./plugin-sdk/*.js" ,
91+ } ,
92+ } ) ;
93+ removePathIfExists ( pluginSdkAliasPath ) ;
94+ fs . mkdirSync ( pluginSdkAliasPath , { recursive : true } ) ;
95+ for ( const dirent of fs . readdirSync ( pluginSdkDir , { withFileTypes : true } ) ) {
96+ if ( ! dirent . isFile ( ) || path . extname ( dirent . name ) !== ". js") {
97+ continue ;
98+ }
12199 writeRuntimeModuleWrapper (
122- path . join ( ocPathDir , "index.js" ) ,
123- path . join ( ocPathAliasDir , "index.js" ) ,
100+ path . join ( pluginSdkDir , dirent . name ) ,
101+ path . join ( pluginSdkAliasPath , dirent . name ) ,
124102 ) ;
125- writeRuntimeModuleWrapper ( ocPathApiPath , path . join ( ocPathAliasDir , "api.js" ) ) ;
126103 }
127104}
128105
0 commit comments