Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@observablehq/runtime

Package Overview
Dependencies
Maintainers
0
Versions
134
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@observablehq/runtime - npm Package Compare versions

Comparing version 6.0.0-rc.1 to 6.0.0

2

package.json
{
"name": "@observablehq/runtime",
"version": "6.0.0-rc.1",
"version": "6.0.0",
"author": {

@@ -5,0 +5,0 @@ "name": "Observable, Inc.",

@@ -9,3 +9,3 @@ # @observablehq/runtime

#### new Runtime(builtins, global)
#### new Runtime(*builtins*, *global*)

@@ -34,3 +34,3 @@ [Source](https://github.com/observablehq/runtime/blob/main/src/runtime.js) · Returns a new [runtime](#runtimes). If *builtins* is specified, each property on the *builtins* object defines a builtin variable for the runtime. These builtins are available as named inputs to any [defined variables](#variable_define) on any [module](#modules) associated with this runtime. If a *global* function is specified, it will be invoked with the name of any unresolved reference, and must return the corresponding value or undefined (to trigger a ReferenceError); if *global* is not specified, unresolved values will be resolved from the global window.

#### runtime.module(define, observer)
#### *runtime*.module(*define*, *observer*)

@@ -43,3 +43,3 @@ [Source](https://github.com/observablehq/runtime/blob/main/src/runtime.js) · Returns a new [module](#modules) for this [runtime](#runtimes).

#### runtime.dispose()
#### *runtime*.dispose()

@@ -52,3 +52,3 @@ [Source](https://github.com/observablehq/runtime/blob/main/src/runtime.js) · Disposes this runtime, invalidating all active variables and disabling future computation.

#### module.variable(observer)
#### *module*.variable(*observer*)

@@ -61,3 +61,3 @@ [Source](https://github.com/observablehq/runtime/blob/main/src/module.js) · Returns a new [variable](#variables) for this [module](#modules). The variable is initially undefined.

#### module.derive(specifiers, source)
#### *module*.derive(*specifiers*, *source*)

@@ -89,3 +89,3 @@ [Source](https://github.com/observablehq/runtime/blob/main/src/module.js) · Returns a derived copy of this [module](#modules), where each variable in *specifiers* is replaced by an [import](#variable_import) from the specified *source* module. The *specifiers* are specified as an array of objects with the following properties:

#### module.define(name, inputs, definition)
#### *module*.define(*name*, *inputs*, *definition*)

@@ -98,3 +98,3 @@ [Source](https://github.com/observablehq/runtime/blob/main/src/module.js) · A convenience method for [*variable*.define](#variable_define); equivalent to:

#### module.import(name, alias, from)
#### *module*.import(*name*, *alias*, *from*)

@@ -107,3 +107,3 @@ [Source](https://github.com/observablehq/runtime/blob/main/src/module.js) · A convenience method for [*variable*.import](#variable_import); equivalent to:

#### module.builtin(name, value)
#### *module*.builtin(*name*, *value*)

@@ -116,7 +116,7 @@ [Source](https://github.com/observablehq/runtime/blob/main/src/module.js) · Defines a built-in constant that is visible to all variables in this module. _Caution: any built-ins must be defined before variables are defined, and must not be redefined after._ For example, to define a `FileAttachment` function:

#### module.redefine(name, inputs, definition)
#### *module*.redefine(*name*, *inputs*, *definition*)
[Source](https://github.com/observablehq/runtime/blob/main/src/module.js) · Redefines the *variable* with the specified *name* on this module. If no such variable exists, or if more than one variable has the specified *name*, throws a runtime error.
#### module.value(name)
#### *module*.value(*name*)

@@ -129,3 +129,3 @@ [Source](https://github.com/observablehq/runtime/blob/main/src/module.js) · Returns a promise to the next value of the *variable* with the specified *name* on this module. If no such variable exists, or if more than one variable has the specified *name*, throws a runtime error.

#### variable.define(name, inputs, definition)
#### *variable*.define(*name*, *inputs*, *definition*)

@@ -140,5 +140,3 @@ [Source](https://github.com/observablehq/runtime/blob/main/src/variable.js) · Redefines this variable to have the specified *name*, taking the variables with the names specified in *inputs* as arguments to the specified *definition* function. If *name* is null or not specified, this variable is anonymous and may not be referred to by other variables. The named *inputs* refer to other variables (possibly [imported](#variable_import)) in this variable’s module. Circular inputs are not allowed; the variable will throw a ReferenceError upon evaluation. If *inputs* is not specified, it defaults to the empty array. If *definition* is not a function, the variable is defined to have the constant value of *definition*.

const runtime = new Runtime(builtins);
const module = runtime.module();
const a = module.variable();

@@ -191,3 +189,3 @@ ```

#### variable.import(name, alias, module)
#### *variable*.import(*name*, *alias*, *module*)

@@ -198,5 +196,3 @@ [Source](https://github.com/observablehq/runtime/blob/main/src/variable.js) · Redefines this variable as an alias of the variable with the specified *name* in the specified [*module*](#modules). The subsequent name of this variable is the specified *name*, or if specified, the given *alias*. The order of arguments corresponds to the standard import statement: `import {name as alias} from "module"`. For example, consider a module which defines a variable named `foo`:

const runtime = new Runtime(builtins);
const module0 = runtime.module();
module0.variable().define("foo", 42);

@@ -209,3 +205,2 @@ ```

const module1 = runtime.module();
module1.variable().import("foo", module0);

@@ -230,3 +225,3 @@ ```

#### variable.delete()
#### *variable*.delete()

@@ -239,12 +234,12 @@ [Source](https://github.com/observablehq/runtime/blob/main/src/variable.js) · Deletes this variable’s current definition and name, if any. Any variable in this module that references this variable as an input will subsequently throw a ReferenceError. If exactly one other variable defined this variable’s previous name, such that that variable throws a ReferenceError due to its duplicate definition, that variable’s original definition is restored.

#### observer.pending()
#### *observer*.pending()
Called shortly before the variable is computed. For a generator variable, this occurs before the generator is constructed, but not before each subsequent value is pulled from the generator.
#### observer.fulfilled(value)
#### *observer*.fulfilled(*value*)
Called shortly after the variable is fulfilled with a new *value*.
#### observer.rejected(error)
#### *observer*.rejected(*error*)
Called shortly after the variable is rejected with the given *error*.

@@ -12,2 +12,3 @@ import {map} from "./array.js";

export const no_observer = Symbol("no-observer");
export const no_value = Promise.resolve();

@@ -27,3 +28,3 @@ export function Variable(type, module, observer, options) {

_outputs: {value: new Set, writable: true},
_promise: {value: Promise.resolve(undefined), writable: true},
_promise: {value: no_value, writable: true},
_reachable: {value: observer !== no_observer, writable: true}, // Is this variable transitively visible?

@@ -30,0 +31,0 @@ _rejector: {value: variable_rejector(this)},

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc