• Home
  • Raw
  • Download

Lines Matching +full:before +full:- +full:script

3 <!--introduced_in=v0.10.0-->
5 > Stability: 2 - Stable
7 <!--name=vm-->
9 <!-- source_link=lib/vm.js -->
45 ## Class: `vm.Script`
46 <!-- YAML
48 -->
50 Instances of the `vm.Script` class contain precompiled scripts that can be
53 ### `new vm.Script(code[, options])` argument
54 <!-- YAML
57 - version: v10.6.0
58 pr-url: https://github.com/nodejs/node/pull/20300
60 `script.createCachedData()`.
61 - version: v5.7.0
62 pr-url: https://github.com/nodejs/node/pull/4777
65 -->
70 by this script. **Default:** `'evalmachine.<anonymous>'`.
72 in stack traces produced by this script. **Default:** `0`.
73 * `columnOffset` {number} Specifies the first-line column number offset that
74 is displayed in stack traces produced by this script. **Default:** `0`.
82 `cachedData` property of the returned `vm.Script` instance.
85 This option is **deprecated** in favor of `script.createCachedData()`.
93 * `script` {vm.Script}
100 Creating a new `vm.Script` object compiles `code` but does not run it. The
101 compiled `vm.Script` can be run later multiple times. The `code` is not bound to
102 any global object; rather, it is bound before each run, just for that run.
104 ### `script.createCachedData()`
105 <!-- YAML
107 -->
111 Creates a code cache that can be used with the `Script` constructor's
116 const script = new vm.Script(`
124 const cacheWithoutX = script.createCachedData();
126 script.runInThisContext();
128 const cacheWithX = script.createCachedData();
131 ### `script.runInContext(contextifiedObject[, options])`
132 <!-- YAML
135 - version: v6.3.0
136 pr-url: https://github.com/nodejs/node/pull/6635
138 -->
147 before terminating execution. If execution is terminated, an [`Error`][]
152 `process.on('SIGINT')` are disabled during script execution, but continue to
154 * Returns: {any} the result of the very last statement executed in the script.
156 Runs the compiled code contained by the `vm.Script` object within the given
172 const script = new vm.Script('count += 1; name = "kitty";');
176 script.runInContext(context);
184 and corresponding threads being started, which have a non-zero performance
187 ### `script.runInNewContext([contextObject[, options]])`
188 <!-- YAML
191 - version: v14.6.0
192 pr-url: https://github.com/nodejs/node/pull/34023
194 - version: v10.0.0
195 pr-url: https://github.com/nodejs/node/pull/19016
197 - version: v6.3.0
198 pr-url: https://github.com/nodejs/node/pull/6635
200 -->
209 before terminating execution. If execution is terminated, an [`Error`][]
214 `process.on('SIGINT')` are disabled during script execution, but continue to
216 * `contextName` {string} Human-readable name of the newly created context.
233 after the script has run. They are included in the `timeout` and
235 * Returns: {any} the result of the very last statement executed in the script.
238 by the `vm.Script` object within the created context, and returns the result.
248 const script = new vm.Script('globalVar = "set"');
252 script.runInNewContext(context);
259 ### `script.runInThisContext([options])`
260 <!-- YAML
263 - version: v6.3.0
264 pr-url: https://github.com/nodejs/node/pull/6635
266 -->
273 before terminating execution. If execution is terminated, an [`Error`][]
278 `process.on('SIGINT')` are disabled during script execution, but continue to
280 * Returns: {any} the result of the very last statement executed in the script.
282 Runs the compiled code contained by the `vm.Script` within the context of the
294 const script = new vm.Script('globalVar += 1', { filename: 'myfile.vm' });
297 script.runInThisContext();
306 <!-- YAML
308 - v13.0.0
309 - v12.16.0
310 -->
312 > Stability: 1 - Experimental
314 This feature is only available with the `--experimental-vm-modules` command
317 The `vm.Module` class provides a low-level interface for using
318 ECMAScript modules in VM contexts. It is the counterpart of the `vm.Script`
322 Unlike `vm.Script` however, every `vm.Module` object is bound to a context from
324 in contrast with the synchronous nature of `vm.Script` objects. The use of
372 // Even top-level Modules without dependencies must be explicitly linked. The
379 // "foo" module every time it is called. In a full-fledged module system, a
444 // Even top-level Modules without dependencies must be explicitly linked. The
451 // "foo" module every time it is called. In a full-fledged module system, a
507 before terminating execution. If execution is interrupted, an [`Error`][]
512 `process.on('SIGINT')` are disabled during script execution, but continue to
521 (`module.status` is `'evaluated'`) or it will re-throw the exception that the
549 Link module dependencies. This method must be called before evaluation, and
567 The linker function roughly corresponds to the implementation-defined
620 <!-- YAML
622 -->
624 > Stability: 1 - Experimental
626 This feature is only available with the `--experimental-vm-modules` command
639 **Default:** `'vm:module(i)'` where `i` is a context-specific ascending
649 * `columnOffset` {integer} Specifies the first-line column number offset that
726 <!-- YAML
728 -->
734 of times before the module has been evaluated.
748 <!-- YAML
750 - v13.0.0
751 - v12.16.0
752 -->
754 > Stability: 1 - Experimental
756 This feature is only available with the `--experimental-vm-modules` command
763 provide a generic interface for exposing non-JavaScript sources to ECMAScript
779 <!-- YAML
781 - v13.0.0
782 - v12.16.0
783 -->
789 **Default:** `'vm:module(i)'` where `i` is a context-specific ascending
801 <!-- YAML
803 - v13.0.0
804 - v12.16.0
805 -->
811 it is called before the module is linked, an [`ERR_VM_MODULE_STATUS`][] error
840 <!-- YAML
843 - version: v14.3.0
844 pr-url: https://github.com/nodejs/node/pull/33364
847 - version:
848 - v14.1.0
849 - v13.14.0
850 pr-url: https://github.com/nodejs/node/pull/32985
852 -->
859 by this script. **Default:** `''`.
861 in stack traces produced by this script. **Default:** `0`.
862 * `columnOffset` {number} Specifies the first-line column number offset that
863 is displayed in stack traces produced by this script. **Default:** `0`.
881 <!-- YAML
884 - version: v14.6.0
885 pr-url: https://github.com/nodejs/node/pull/34023
887 - version: v10.0.0
888 pr-url: https://github.com/nodejs/node/pull/19398
890 - version: v10.0.0
891 pr-url: https://github.com/nodejs/node/pull/19016
893 -->
897 * `name` {string} Human-readable name of the newly created context.
914 after a script has run through [`script.runInContext()`][].
920 [`vm.runInContext()`][] or [`script.runInContext()`][]. Inside such scripts,
922 properties but also having the built-in objects and functions any standard
949 window's global object, then run all `<script>` tags together within that
956 <!-- YAML
958 -->
968 <!-- YAML
970 -->
972 > Stability: 1 - Experimental
986 exits before the next GC). With eager execution, the GC will be started
1043 <!-- YAML
1046 - version: v6.3.0
1047 pr-url: https://github.com/nodejs/node/pull/6635
1049 -->
1056 by this script. **Default:** `'evalmachine.<anonymous>'`.
1058 in stack traces produced by this script. **Default:** `0`.
1059 * `columnOffset` {number} Specifies the first-line column number offset that
1060 is displayed in stack traces produced by this script. **Default:** `0`.
1065 before terminating execution. If execution is terminated, an [`Error`][]
1070 `process.on('SIGINT')` are disabled during script execution, but continue to
1079 `cachedData` property of the returned `vm.Script` instance.
1082 This option is **deprecated** in favor of `script.createCachedData()`.
1090 * `script` {vm.Script}
1094 * Returns: {any} the result of the very last statement executed in the script.
1120 <!-- YAML
1123 - version: v14.6.0
1124 pr-url: https://github.com/nodejs/node/pull/34023
1126 - version: v10.0.0
1127 pr-url: https://github.com/nodejs/node/pull/19016
1129 - version: v6.3.0
1130 pr-url: https://github.com/nodejs/node/pull/6635
1132 -->
1139 by this script. **Default:** `'evalmachine.<anonymous>'`.
1141 in stack traces produced by this script. **Default:** `0`.
1142 * `columnOffset` {number} Specifies the first-line column number offset that
1143 is displayed in stack traces produced by this script. **Default:** `0`.
1148 before terminating execution. If execution is terminated, an [`Error`][]
1153 `process.on('SIGINT')` are disabled during script execution, but continue to
1155 * `contextName` {string} Human-readable name of the newly created context.
1177 `cachedData` property of the returned `vm.Script` instance.
1180 This option is **deprecated** in favor of `script.createCachedData()`.
1188 * `script` {vm.Script}
1194 after the script has run. They are included in the `timeout` and
1196 * Returns: {any} the result of the very last statement executed in the script.
1222 <!-- YAML
1225 - version: v6.3.0
1226 pr-url: https://github.com/nodejs/node/pull/6635
1228 -->
1233 by this script. **Default:** `'evalmachine.<anonymous>'`.
1235 in stack traces produced by this script. **Default:** `0`.
1236 * `columnOffset` {number} Specifies the first-line column number offset that
1237 is displayed in stack traces produced by this script. **Default:** `0`.
1242 before terminating execution. If execution is terminated, an [`Error`][]
1247 `process.on('SIGINT')` are disabled during script execution, but continue to
1256 `cachedData` property of the returned `vm.Script` instance.
1259 This option is **deprecated** in favor of `script.createCachedData()`.
1267 * `script` {vm.Script}
1271 * Returns: {any} the result of the very last statement executed in the script.
1282 <!-- eslint-disable prefer-const -->
1304 When using either [`script.runInThisContext()`][] or
1321 response.writeHead(200, { 'Content-Type': 'text/plain' });
1345 (or a newly-created object if `contextObject` is `undefined`) is associated
1377 // This is printed *before* 'entering loop' (!)
1399 before returning from `vm.runInNewContext()`, and will be interrupted
1415 [Cyclic Module Record]: https://tc39.es/ecma262/#sec-cyclic-module-records
1417 [Evaluate() concrete method]: https://tc39.es/ecma262/#sec-moduleevaluation
1418 [GetModuleNamespace]: https://tc39.es/ecma262/#sec-getmodulenamespace
1419 [HostResolveImportedModule]: https://tc39.es/ecma262/#sec-hostresolveimportedmodule
1420 [Link() concrete method]: https://tc39.es/ecma262/#sec-moduledeclarationlinking
1421 [Module Record]: https://www.ecma-international.org/ecma-262/#sec-abstract-module-records
1422 [Source Text Module Record]: https://tc39.es/ecma262/#sec-source-text-module-records
1423 [Synthetic Module Record]: https://heycam.github.io/webidl/#synthetic-module-records
1429 [`eval()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval
1430 [`script.runInContext()`]: #vm_script_runincontext_contextifiedobject_options
1431 [`script.runInThisContext()`]: #vm_script_runinthiscontext_options
1439 [origin]: https://developer.mozilla.org/en-US/docs/Glossary/Origin