@mikrojs/quickjs 0.6.0 → 0.8.0-pr-85.g6768f8c

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.
@@ -29037,6 +29037,33 @@ static void js_free_module_def(JSContext *ctx, JSModuleDef *m)
29037
29037
  js_free(ctx, m);
29038
29038
  }
29039
29039
 
29040
+ /* mikrojs patch: public wrapper to free a single module (remove it from
29041
+ * the context's loaded-modules cache and release all its resources).
29042
+ * Callers must ensure the module is not mid-linking or mid-evaluating and
29043
+ * that no other modules hold live import bindings to its exports (or accept
29044
+ * that such bindings remain valid via refcounted JSVarRefs). */
29045
+ void JS_FreeModule(JSContext *ctx, JSModuleDef *m)
29046
+ {
29047
+ js_free_module_def(ctx, m);
29048
+ }
29049
+
29050
+ static JSModuleDef *js_find_loaded_module(JSContext *ctx, JSAtom name);
29051
+
29052
+ /* mikrojs patch: lookup a module in the context cache by name atom.
29053
+ * Returns NULL if no module with that name is loaded. */
29054
+ JSModuleDef *JS_FindLoadedModule(JSContext *ctx, JSAtom name)
29055
+ {
29056
+ return js_find_loaded_module(ctx, name);
29057
+ }
29058
+
29059
+ /* mikrojs patch: return the module's current status as an integer.
29060
+ * 0=UNLINKED, 1=LINKING, 2=LINKED, 3=EVALUATING, 4=EVALUATING_ASYNC, 5=EVALUATED. */
29061
+ int JS_GetModuleStatus(JSContext *ctx, JSModuleDef *m)
29062
+ {
29063
+ (void)ctx;
29064
+ return (int)m->status;
29065
+ }
29066
+
29040
29067
  #ifndef QJS_DISABLE_PARSER
29041
29068
 
29042
29069
  static int add_req_module_entry(JSContext *ctx, JSModuleDef *m,
@@ -1198,6 +1198,21 @@ JS_EXTERN JSValue JS_GetImportMeta(JSContext *ctx, JSModuleDef *m);
1198
1198
  JS_EXTERN JSAtom JS_GetModuleName(JSContext *ctx, JSModuleDef *m);
1199
1199
  JS_EXTERN JSValue JS_GetModuleNamespace(JSContext *ctx, JSModuleDef *m);
1200
1200
 
1201
+ /* mikrojs patch: evict a module from the context, releasing all its
1202
+ * resources. Caller is responsible for ensuring the module is in a safe
1203
+ * state (not linking, not evaluating). */
1204
+ JS_EXTERN void JS_FreeModule(JSContext *ctx, JSModuleDef *m);
1205
+
1206
+ /* mikrojs patch: lookup a module in the context cache by name atom.
1207
+ * Returns NULL if no module with that name is loaded. */
1208
+ JS_EXTERN JSModuleDef *JS_FindLoadedModule(JSContext *ctx, JSAtom name);
1209
+
1210
+ /* mikrojs patch: return the module's current status.
1211
+ * 0=UNLINKED, 1=LINKING, 2=LINKED, 3=EVALUATING, 4=EVALUATING_ASYNC, 5=EVALUATED.
1212
+ * Constants deliberately omitted here because the internal QuickJS enum
1213
+ * reuses the same symbol names; callers define their own mirrored names. */
1214
+ JS_EXTERN int JS_GetModuleStatus(JSContext *ctx, JSModuleDef *m);
1215
+
1201
1216
  /* associate a JSValue to a C module */
1202
1217
  JS_EXTERN int JS_SetModulePrivateValue(JSContext *ctx, JSModuleDef *m, JSValue val);
1203
1218
  JS_EXTERN JSValue JS_GetModulePrivateValue(JSContext *ctx, JSModuleDef *m);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikrojs/quickjs",
3
- "version": "0.6.0",
3
+ "version": "0.8.0-pr-85.g6768f8c",
4
4
  "description": "QuickJS-NG engine source, shared CMake module, and qjsc bytecode compiler",
5
5
  "keywords": [
6
6
  "bytecode",