spyret 0.1.0

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Siddhartha Prasad
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,81 @@
1
+ # Spyret
2
+
3
+ The interfaces between standard Pyret and Spytial. Spyret captures Pyret values
4
+ as portable relational data, reconstructs their structure, and emits Pyret source
5
+ where supported. It runs in Node or a browser without an IDE.
6
+
7
+ `spyret-ide` is one consumer. `spytial-core` owns generic graph data, queries,
8
+ layout and rendering. This package owns Pyret runtime adaptation, constructor
9
+ identity, exact numbers, collections, capture validation, reconstruction and the
10
+ tests of those contracts.
11
+
12
+ ```js
13
+ import { toDataInstance } from 'spyret';
14
+
15
+ const instance = toDataInstance(pyretValue, runtime);
16
+ // Pass instance directly to Spytial-Core's evaluator/layout APIs.
17
+ ```
18
+
19
+ `toDataInstance` accepts a value and the standard Pyret runtime that owns it.
20
+ Spyret handles capture, relationalization and validation and returns an
21
+ `IDataInstance`. Core handles queries, layout and rendering. No
22
+ `spytial-core/data` entry point or Core runtime is needed inside Spyret.
23
+
24
+ For transport between processes, use `capturePyret` with
25
+ `createPyretRuntimeAdapter(runtime)`, then `importPyretCapture` at the receiver.
26
+ The receiver needs neither Pyret nor an IDE. Collecting layout YAML alongside
27
+ values can be added to Spyret later; YAML interpretation stays in Core.
28
+
29
+ See [the capture contract](docs/PYRET_CAPTURE.md) for supported values and limits.
30
+ Closures are not serialized. Source preview is separate from structural capture.
31
+
32
+ ## Development
33
+
34
+ Requires Node 22 or later. The development dependency on released Core 6.3.1
35
+ provides its public interface types and tests layout/query compatibility.
36
+ Published Spyret builds include those type declarations and have no Core runtime
37
+ dependency.
38
+
39
+ ```sh
40
+ npm ci
41
+ npm run typecheck
42
+ npm run build
43
+ npm test
44
+ ```
45
+
46
+ To run against an unmodified `brownplt/pyret-lang` checkout, build its `lang/`
47
+ directory with `npm ci --ignore-scripts && make phaseA`, then run:
48
+
49
+ ```sh
50
+ npm run test:upstream -- /path/to/pyret-lang/lang
51
+ npm run test:program -- /path/to/pyret-lang/lang
52
+ REIFY_SEED=1 npm run test:pbt -- /path/to/pyret-lang/lang
53
+ REIFY_SEED=2 npm run test:pbt -- /path/to/pyret-lang/lang
54
+ ```
55
+
56
+ CI pins upstream revision `6e62dcda5298606aa0abe66a372c4eb17a38db85`.
57
+ The unit suite includes 2,000 generated graphs across two seeds. Each upstream
58
+ PBT job compiles actual Pyret programs: fixed value/constructor cases, 100
59
+ generated values and 20 generated datatype declarations. Producer and decoder
60
+ run in separate processes; reconstruction receives only JSON snapshots. Actual
61
+ Pyret check blocks compare inspection strings. No browser or IDE is involved.
62
+
63
+ CommonJS and ES modules import `spyret`. The browser bundle is
64
+ `dist/spyret.global.js`, which defines `Spyret`.
65
+
66
+ ## npm releases
67
+
68
+ Published builds contain Spyret's adapter and bundled interface declarations.
69
+ Hosts can use Core 6.3.1 for layout and rendering; Core 6.3.2 is not required.
70
+ `npm run test:package` verifies the actual tarball in an isolated consumer.
71
+ Version tags trigger the unit/package suite and both upstream PBT seeds before
72
+ publishing. See [release setup and commands](docs/RELEASING.md).
73
+
74
+ ## Migration and provenance
75
+
76
+ The adapters and structural tests were extracted from
77
+ [Spytial-Core](https://github.com/sidprasad/spytial-core), including the capture
78
+ work in PR #618. Runtime fixture generators came from
79
+ [Spyret-IDE](https://github.com/sidprasad/spyret-ide). Both are maintained by
80
+ Siddhartha Prasad. Core retains its existing Pyret exports temporarily for
81
+ compatibility; new Pyret functionality belongs here.
@@ -0,0 +1,84 @@
1
+ Spyret's adapter helpers and data contracts originate in Spytial-Core.
2
+ Author: Siddhartha Prasad
3
+ License: MIT (declared by the source package)
4
+ Source: https://github.com/sidprasad/spytial-core
5
+ Contracts verified against spytial-core 6.3.1.
6
+ No Core runtime or renderer is included.
7
+
8
+ ---
9
+
10
+ graphlib
11
+
12
+ Copyright (c) 2012-2014 Chris Pettitt
13
+
14
+ Permission is hereby granted, free of charge, to any person obtaining a copy
15
+ of this software and associated documentation files (the "Software"), to deal
16
+ in the Software without restriction, including without limitation the rights
17
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
+ copies of the Software, and to permit persons to whom the Software is
19
+ furnished to do so, subject to the following conditions:
20
+
21
+ The above copyright notice and this permission notice shall be included in
22
+ all copies or substantial portions of the Software.
23
+
24
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
30
+ THE SOFTWARE.
31
+
32
+
33
+ ---
34
+
35
+ lodash
36
+
37
+ Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
38
+
39
+ Based on Underscore.js, copyright Jeremy Ashkenas,
40
+ DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
41
+
42
+ This software consists of voluntary contributions made by many
43
+ individuals. For exact contribution history, see the revision history
44
+ available at https://github.com/lodash/lodash
45
+
46
+ The following license applies to all parts of this software except as
47
+ documented below:
48
+
49
+ ====
50
+
51
+ Permission is hereby granted, free of charge, to any person obtaining
52
+ a copy of this software and associated documentation files (the
53
+ "Software"), to deal in the Software without restriction, including
54
+ without limitation the rights to use, copy, modify, merge, publish,
55
+ distribute, sublicense, and/or sell copies of the Software, and to
56
+ permit persons to whom the Software is furnished to do so, subject to
57
+ the following conditions:
58
+
59
+ The above copyright notice and this permission notice shall be
60
+ included in all copies or substantial portions of the Software.
61
+
62
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
63
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
64
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
65
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
66
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
67
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
68
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
69
+
70
+ ====
71
+
72
+ Copyright and related rights for sample code are waived via CC0. Sample
73
+ code is defined as all source code displayed within the prose of the
74
+ documentation.
75
+
76
+ CC0: http://creativecommons.org/publicdomain/zero/1.0/
77
+
78
+ ====
79
+
80
+ Files located in the node_modules and vendor directories are externally
81
+ maintained libraries used by this software which have their own
82
+ licenses; we recommend you read them, as their terms may differ from the
83
+ terms above.
84
+