Skip to content

Commit 903fe9d

Browse files
authored
feat: Add @ocap/remote-iterables package (#600)
Extracts the `/vat` exports from `@metamask/streams` into a new package, `@ocap/remote-iterables`. This functionality doesn't belong in the streams package, which is intended to be generic and agnostic of kernel-specific functionality. Since the functionality is only used internally, we also keep the new package private for now.
1 parent c4af39a commit 903fe9d

26 files changed

Lines changed: 306 additions & 109 deletions

packages/kernel-test/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@
5858
"@metamask/ocap-kernel": "workspace:^",
5959
"@metamask/streams": "workspace:^",
6060
"@metamask/utils": "^11.4.2",
61-
"@ocap/nodejs": "workspace:^"
61+
"@ocap/nodejs": "workspace:^",
62+
"@ocap/remote-iterables": "workspace:^"
6263
},
6364
"devDependencies": {
6465
"@arethetypeswrong/cli": "^0.17.4",

packages/kernel-test/src/vats/async-generator-iterator-vat.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { E, Far } from '@endo/far';
22
// ESLint's import-x/no-unresolved rule with commonjs:false doesn't support subpath exports
33
// eslint-disable-next-line import-x/no-unresolved
4-
import { makeEventualIterator, makeFarGenerator } from '@metamask/streams/vat';
4+
import { makeEventualIterator, makeFarGenerator } from '@ocap/remote-iterables';
55

66
/**
77
* Build function for testing async generators.

packages/kernel-test/tsconfig.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88
"types": ["vitest"]
99
},
1010
"references": [
11-
{ "path": "../streams" },
12-
{ "path": "../test-utils" },
11+
{ "path": "../kernel-store" },
1312
{ "path": "../kernel-utils" },
1413
{ "path": "../nodejs" },
1514
{ "path": "../ocap-kernel" },
16-
{ "path": "../kernel-store" }
15+
{ "path": "../remote-iterables" },
16+
{ "path": "../streams" },
17+
{ "path": "../test-utils" }
1718
],
1819
"include": ["../../vitest.config.ts", "./src", "./vitest.config.ts"]
1920
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
[Unreleased]: https://github.com/MetaMask/ocap-kernel/
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# `@ocap/remote-iterables`
2+
3+
Remotable iterable objects, i.e. iterators and generators.
4+
5+
## Installation
6+
7+
`yarn add @ocap/remote-iterables`
8+
9+
or
10+
11+
`npm install @ocap/remote-iterables`
12+
13+
## Contributing
14+
15+
This package is part of a monorepo. Instructions for contributing can be found in the [monorepo README](https://github.com/MetaMask/ocap-kernel#readme).
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
{
2+
"name": "@ocap/remote-iterables",
3+
"version": "0.0.0",
4+
"private": true,
5+
"description": "Remotable iterable objects",
6+
"homepage": "https://github.com/MetaMask/ocap-kernel/tree/main/packages/remote-iterables#readme",
7+
"bugs": {
8+
"url": "https://github.com/MetaMask/ocap-kernel/issues"
9+
},
10+
"repository": {
11+
"type": "git",
12+
"url": "https://github.com/MetaMask/ocap-kernel.git"
13+
},
14+
"type": "module",
15+
"exports": {
16+
".": {
17+
"import": {
18+
"types": "./dist/index.d.mts",
19+
"default": "./dist/index.mjs"
20+
},
21+
"require": {
22+
"types": "./dist/index.d.cts",
23+
"default": "./dist/index.cjs"
24+
}
25+
},
26+
"./package.json": "./package.json"
27+
},
28+
"files": [
29+
"dist/"
30+
],
31+
"scripts": {
32+
"build": "ts-bridge --project tsconfig.build.json --clean",
33+
"build:docs": "typedoc",
34+
"changelog:validate": "../../scripts/validate-changelog.sh @ocap/remote-iterables",
35+
"clean": "rimraf --glob './*.tsbuildinfo' ./.eslintcache ./coverage ./dist",
36+
"lint": "yarn lint:eslint && yarn lint:misc --check && yarn constraints && yarn lint:dependencies",
37+
"lint:dependencies": "depcheck",
38+
"lint:eslint": "eslint . --cache",
39+
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write && yarn constraints --fix && yarn lint:dependencies",
40+
"lint:misc": "prettier --no-error-on-unmatched-pattern '**/*.json' '**/*.md' '**/*.html' '!**/CHANGELOG.old.md' '**/*.yml' '!.yarnrc.yml' '!merged-packages/**' --ignore-path ../../.gitignore",
41+
"publish:preview": "yarn npm publish --tag preview",
42+
"test": "vitest run --config vitest.config.ts",
43+
"test:clean": "yarn test --no-cache --coverage.clean",
44+
"test:dev": "yarn test --mode development",
45+
"test:verbose": "yarn test --reporter verbose",
46+
"test:watch": "vitest --config vitest.config.ts"
47+
},
48+
"dependencies": {
49+
"@endo/exo": "^1.5.12",
50+
"@endo/far": "^1.1.14",
51+
"@endo/patterns": "^1.7.0",
52+
"@endo/stream": "^1.2.13"
53+
},
54+
"devDependencies": {
55+
"@arethetypeswrong/cli": "^0.17.4",
56+
"@endo/promise-kit": "^1.1.13",
57+
"@metamask/auto-changelog": "^5.0.1",
58+
"@metamask/eslint-config": "^14.0.0",
59+
"@metamask/eslint-config-nodejs": "^14.0.0",
60+
"@metamask/eslint-config-typescript": "^14.0.0",
61+
"@ocap/test-utils": "workspace:^",
62+
"@ts-bridge/cli": "^0.6.3",
63+
"@ts-bridge/shims": "^0.1.1",
64+
"@typescript-eslint/eslint-plugin": "^8.29.0",
65+
"@typescript-eslint/parser": "^8.29.0",
66+
"@typescript-eslint/utils": "^8.29.0",
67+
"@vitest/eslint-plugin": "^1.3.4",
68+
"depcheck": "^1.4.7",
69+
"eslint": "^9.23.0",
70+
"eslint-config-prettier": "^10.1.1",
71+
"eslint-import-resolver-typescript": "^4.3.1",
72+
"eslint-plugin-import-x": "^4.10.0",
73+
"eslint-plugin-jsdoc": "^50.6.9",
74+
"eslint-plugin-n": "^17.17.0",
75+
"eslint-plugin-prettier": "^5.2.6",
76+
"eslint-plugin-promise": "^7.2.1",
77+
"prettier": "^3.5.3",
78+
"rimraf": "^6.0.1",
79+
"typedoc": "^0.28.1",
80+
"typescript": "~5.8.2",
81+
"typescript-eslint": "^8.29.0",
82+
"vite": "^7.1.2",
83+
"vitest": "^3.2.4"
84+
},
85+
"engines": {
86+
"node": "^20 || >=22"
87+
}
88+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)