silgi 0.19.25 → 0.19.27
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 +12 -8
- 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,32 +199,36 @@ 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);
|
|
203
202
|
if (cmd.handler.type === "function") {
|
|
204
203
|
const jiti = createJiti(import.meta.url, {
|
|
205
204
|
alias: silgiConfig.alias
|
|
206
205
|
});
|
|
207
206
|
let cleanHandler = cmd.handler.handler.replace(/\n/g, "");
|
|
208
|
-
|
|
209
|
-
return typeof value === "bigint" ? `${value.toString()}n` : value;
|
|
210
|
-
};
|
|
207
|
+
global.__silgi_temp_obj = data?.result?.silgi;
|
|
211
208
|
cleanHandler = `import { silgiCLICtx } from 'silgi/core'
|
|
212
209
|
|
|
210
|
+
// Access from global scope
|
|
211
|
+
const silgiObj = global.__silgi_temp_obj;
|
|
213
212
|
if (silgiCLICtx.tryUse()) {
|
|
214
213
|
silgiCLICtx.unset()
|
|
215
|
-
silgiCLICtx.set(
|
|
214
|
+
silgiCLICtx.set(silgiObj)
|
|
216
215
|
}
|
|
217
216
|
else {
|
|
218
|
-
silgiCLICtx.set(
|
|
219
|
-
|
|
217
|
+
silgiCLICtx.set(silgiObj)
|
|
218
|
+
// Use the silgiObj directly
|
|
219
|
+
silgiObj.hook && silgiObj.hook('close', () => silgiCLICtx.unset())
|
|
220
220
|
}
|
|
221
|
-
${cleanHandler}
|
|
221
|
+
${cleanHandler}
|
|
222
|
+
|
|
223
|
+
// Clean up global scope
|
|
224
|
+
delete global.__silgi_temp_obj;`;
|
|
222
225
|
await jiti.evalModule(cleanHandler, {
|
|
223
226
|
filename: import.meta.url,
|
|
224
227
|
async: true,
|
|
225
228
|
conditions: silgiConfig.conditions,
|
|
226
229
|
forceTranspile: true
|
|
227
230
|
});
|
|
231
|
+
delete global.__silgi_temp_obj;
|
|
228
232
|
}
|
|
229
233
|
}
|
|
230
234
|
}
|
package/dist/meta/index.d.mts
CHANGED
package/dist/meta/index.d.ts
CHANGED