silgi 0.19.24 → 0.19.26
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/dist/_chunks/index.mjs +1 -1
- package/dist/cli/prepare.mjs +13 -4
- package/dist/meta/index.d.mts +1 -1
- package/dist/meta/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/_chunks/index.mjs
CHANGED
package/dist/cli/prepare.mjs
CHANGED
|
@@ -199,28 +199,37 @@ const run = defineCommand({
|
|
|
199
199
|
if (cmd.handler.type === "command") {
|
|
200
200
|
execSync(cmd.handler.handler, { stdio: "inherit" });
|
|
201
201
|
}
|
|
202
|
+
console.log(data?.result.silgi.callHook);
|
|
202
203
|
if (cmd.handler.type === "function") {
|
|
203
204
|
const jiti = createJiti(import.meta.url, {
|
|
204
205
|
alias: silgiConfig.alias
|
|
205
206
|
});
|
|
206
207
|
let cleanHandler = cmd.handler.handler.replace(/\n/g, "");
|
|
208
|
+
global.__silgi_temp_obj = data?.result?.silgi;
|
|
207
209
|
cleanHandler = `import { silgiCLICtx } from 'silgi/core'
|
|
208
210
|
|
|
211
|
+
// Access from global scope
|
|
212
|
+
const silgiObj = global.__silgi_temp_obj;
|
|
209
213
|
if (silgiCLICtx.tryUse()) {
|
|
210
214
|
silgiCLICtx.unset()
|
|
211
|
-
silgiCLICtx.set(
|
|
215
|
+
silgiCLICtx.set(silgiObj)
|
|
212
216
|
}
|
|
213
217
|
else {
|
|
214
|
-
silgiCLICtx.set(
|
|
215
|
-
|
|
218
|
+
silgiCLICtx.set(silgiObj)
|
|
219
|
+
// Use the silgiObj directly
|
|
220
|
+
silgiObj.hook && silgiObj.hook('close', () => silgiCLICtx.unset())
|
|
216
221
|
}
|
|
217
|
-
${cleanHandler}
|
|
222
|
+
${cleanHandler}
|
|
223
|
+
|
|
224
|
+
// Clean up global scope
|
|
225
|
+
delete global.__silgi_temp_obj;`;
|
|
218
226
|
await jiti.evalModule(cleanHandler, {
|
|
219
227
|
filename: import.meta.url,
|
|
220
228
|
async: true,
|
|
221
229
|
conditions: silgiConfig.conditions,
|
|
222
230
|
forceTranspile: true
|
|
223
231
|
});
|
|
232
|
+
delete global.__silgi_temp_obj;
|
|
224
233
|
}
|
|
225
234
|
}
|
|
226
235
|
}
|
package/dist/meta/index.d.mts
CHANGED
package/dist/meta/index.d.ts
CHANGED