You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* @param allow Whether to allow loading extensions.
295
303
*/
296
304
enableLoadExtension(allow: boolean): void;
305
+
/**
306
+
* Enables or disables the defensive flag. When the defensive flag is active,
307
+
* language features that allow ordinary SQL to deliberately corrupt the database file are disabled.
308
+
* See [`SQLITE_DBCONFIG_DEFENSIVE`](https://www.sqlite.org/c3ref/c_dbconfig_defensive.html#sqlitedbconfigdefensive) in the SQLite documentation for details.
309
+
* @since v25.1.0
310
+
* @param active Whether to set the defensive flag.
311
+
*/
312
+
enableDefensive(active: boolean): void;
297
313
/**
298
314
* This method is a wrapper around [`sqlite3_db_filename()`](https://sqlite.org/c3ref/db_filename.html)
Copy file name to clipboardExpand all lines: types/node/vm.d.ts
+42-14Lines changed: 42 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -749,7 +749,7 @@ declare module "node:vm" {
749
749
* // "contextifiedObject" when creating the context.
750
750
* export default secret;
751
751
* `, { context: referencingModule.context });
752
-
* moduleMap.set(specifier, linkedModule);
752
+
* moduleMap.set(specifier, requestedModule);
753
753
* // Resolve the dependencies of the new module as well.
754
754
* resolveAndLinkDependencies(requestedModule);
755
755
* }
@@ -819,19 +819,47 @@ declare module "node:vm" {
819
819
*/
820
820
status: ModuleStatus;
821
821
/**
822
-
* Evaluate the module.
823
-
*
824
-
* This must be called after the module has been linked; otherwise it will reject.
825
-
* It could be called also when the module has already been evaluated, in which
826
-
* case it will either do nothing if the initial evaluation ended in success
827
-
* (`module.status` is `'evaluated'`) or it will re-throw the exception that the
828
-
* initial evaluation resulted in (`module.status` is `'errored'`).
829
-
*
830
-
* This method cannot be called while the module is being evaluated
831
-
* (`module.status` is `'evaluating'`).
832
-
*
833
-
* Corresponds to the [Evaluate() concrete method](https://tc39.es/ecma262/#sec-moduleevaluation) field of [Cyclic Module Record](https://tc39.es/ecma262/#sec-cyclic-module-records) s in the
834
-
* ECMAScript specification.
822
+
* Evaluate the module and its depenendencies. Corresponds to the [Evaluate() concrete method](https://tc39.es/ecma262/#sec-moduleevaluation) field of
823
+
* [Cyclic Module Record](https://tc39.es/ecma262/#sec-cyclic-module-records)s in the ECMAScript specification.
824
+
*
825
+
* If the module is a `vm.SourceTextModule`, `evaluate()` must be called after the module has been instantiated;
826
+
* otherwise `evaluate()` will return a rejected promise.
827
+
*
828
+
* For a `vm.SourceTextModule`, the promise returned by `evaluate()` may be fulfilled either
829
+
* synchronously or asynchronously:
830
+
*
831
+
* 1. If the `vm.SourceTextModule` has no top-level `await` in itself or any of its dependencies, the promise will be
832
+
* fulfilled _synchronously_ after the module and all its dependencies have been evaluated.
833
+
* 1. If the evaluation succeeds, the promise will be _synchronously_ resolved to `undefined`.
834
+
* 2. If the evaluation results in an exception, the promise will be _synchronously_ rejected with the exception
835
+
* that causes the evaluation to fail, which is the same as `module.error`.
836
+
* 2. If the `vm.SourceTextModule` has top-level `await` in itself or any of its dependencies, the promise will be
837
+
* fulfilled _asynchronously_ after the module and all its dependencies have been evaluated.
838
+
* 1. If the evaluation succeeds, the promise will be _asynchronously_ resolved to `undefined`.
839
+
* 2. If the evaluation results in an exception, the promise will be _asynchronously_ rejected with the exception
840
+
* that causes the evaluation to fail.
841
+
*
842
+
* If the module is a `vm.SyntheticModule`, `evaluate()` always returns a promise that fulfills synchronously, see
843
+
* the specification of [Evaluate() of a Synthetic Module Record](https://tc39.es/ecma262/#sec-smr-Evaluate):
844
+
*
845
+
* 1. If the `evaluateCallback` passed to its constructor throws an exception synchronously, `evaluate()` returns
846
+
* a promise that will be synchronously rejected with that exception.
847
+
* 2. If the `evaluateCallback` does not throw an exception, `evaluate()` returns a promise that will be
848
+
* synchronously resolved to `undefined`.
849
+
*
850
+
* The `evaluateCallback` of a `vm.SyntheticModule` is executed synchronously within the `evaluate()` call, and its
851
+
* return value is discarded. This means if `evaluateCallback` is an asynchronous function, the promise returned by
852
+
* `evaluate()` will not reflect its asynchronous behavior, and any rejections from an asynchronous
853
+
* `evaluateCallback` will be lost.
854
+
*
855
+
* `evaluate()` could also be called again after the module has already been evaluated, in which case:
856
+
*
857
+
* 1. If the initial evaluation ended in success (`module.status` is `'evaluated'`), it will do nothing
858
+
* and return a promise that resolves to `undefined`.
859
+
* 2. If the initial evaluation resulted in an exception (`module.status` is `'errored'`), it will re-reject
860
+
* the exception that the initial evaluation resulted in.
861
+
*
862
+
* This method cannot be called while the module is being evaluated (`module.status` is `'evaluating'`).
0 commit comments