libdeno 0.3.8__tar.gz

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.
Files changed (157) hide show
  1. libdeno-0.3.8/.cargo/audit.toml +32 -0
  2. libdeno-0.3.8/.cargo/config.toml +24 -0
  3. libdeno-0.3.8/.github/dependabot.yml +32 -0
  4. libdeno-0.3.8/.github/workflows/audit-with-temporary-exceptions.py +119 -0
  5. libdeno-0.3.8/.github/workflows/check-version-sync.py +227 -0
  6. libdeno-0.3.8/.github/workflows/ci.yml +117 -0
  7. libdeno-0.3.8/.github/workflows/compatibility.yml +120 -0
  8. libdeno-0.3.8/.github/workflows/published-smoke.yml +106 -0
  9. libdeno-0.3.8/.github/workflows/python-pr.yml +135 -0
  10. libdeno-0.3.8/.github/workflows/python.yml +761 -0
  11. libdeno-0.3.8/.github/workflows/release.yml +667 -0
  12. libdeno-0.3.8/.github/workflows/security.yml +76 -0
  13. libdeno-0.3.8/.github/workflows/snapshot-reuse.yml +168 -0
  14. libdeno-0.3.8/.github/workflows/test_audit_temporary_exceptions.py +106 -0
  15. libdeno-0.3.8/.gitignore +6 -0
  16. libdeno-0.3.8/.ignore +2 -0
  17. libdeno-0.3.8/CHANGELOG.md +663 -0
  18. libdeno-0.3.8/Cargo.lock +9572 -0
  19. libdeno-0.3.8/Cargo.toml +158 -0
  20. libdeno-0.3.8/LICENSE +21 -0
  21. libdeno-0.3.8/PKG-INFO +194 -0
  22. libdeno-0.3.8/README-pypi.md +169 -0
  23. libdeno-0.3.8/README.md +217 -0
  24. libdeno-0.3.8/README.zh-CN.md +190 -0
  25. libdeno-0.3.8/SECURITY.md +165 -0
  26. libdeno-0.3.8/benches/baseline.rs +978 -0
  27. libdeno-0.3.8/build.rs +509 -0
  28. libdeno-0.3.8/build_support/snapshot_arch.rs +23 -0
  29. libdeno-0.3.8/build_support/snapshot_bundle.rs +468 -0
  30. libdeno-0.3.8/build_support/snapshot_compat.rs +96 -0
  31. libdeno-0.3.8/build_support/snapshot_identity.rs +35 -0
  32. libdeno-0.3.8/build_support/snapshot_sources.rs +45 -0
  33. libdeno-0.3.8/docs/api.md +548 -0
  34. libdeno-0.3.8/docs/architecture.md +92 -0
  35. libdeno-0.3.8/docs/getting-started.md +126 -0
  36. libdeno-0.3.8/docs/musl.md +91 -0
  37. libdeno-0.3.8/docs/native-extensions.md +90 -0
  38. libdeno-0.3.8/docs/npm-support.md +83 -0
  39. libdeno-0.3.8/docs/permissions.md +114 -0
  40. libdeno-0.3.8/docs/prebuilt-snapshots.md +204 -0
  41. libdeno-0.3.8/docs/python.md +125 -0
  42. libdeno-0.3.8/examples/demo-app/index.js +10 -0
  43. libdeno-0.3.8/examples/demo-app/math.js +3 -0
  44. libdeno-0.3.8/examples/demo-app/package-lock.json +27 -0
  45. libdeno-0.3.8/examples/demo-app/package.json +9 -0
  46. libdeno-0.3.8/examples/demo-app/pkg.json +4 -0
  47. libdeno-0.3.8/examples/demo-app/tschalk_test.ts +2 -0
  48. libdeno-0.3.8/examples/demo.rs +87 -0
  49. libdeno-0.3.8/examples/native_extension/init.js +3 -0
  50. libdeno-0.3.8/examples/native_extension/main.js +1 -0
  51. libdeno-0.3.8/examples/native_extension.rs +23 -0
  52. libdeno-0.3.8/examples/npm-plugin.md +64 -0
  53. libdeno-0.3.8/libdeno/libdeno/__init__.py +41 -0
  54. libdeno-0.3.8/libdeno/libdeno/__init__.pyi +173 -0
  55. libdeno-0.3.8/libdeno/libdeno/py.typed +0 -0
  56. libdeno-0.3.8/patches/deno-musl-0.267.0-0.197.0.patch +36 -0
  57. libdeno-0.3.8/pyproject.toml +38 -0
  58. libdeno-0.3.8/python/Cargo.lock +9636 -0
  59. libdeno-0.3.8/python/Cargo.toml +25 -0
  60. libdeno-0.3.8/python/fixture.js +2 -0
  61. libdeno-0.3.8/python/libdeno/__init__.py +33 -0
  62. libdeno-0.3.8/python/src/lib.rs +336 -0
  63. libdeno-0.3.8/python/src/options.rs +135 -0
  64. libdeno-0.3.8/python/src/output.rs +51 -0
  65. libdeno-0.3.8/python/src/runtime.rs +232 -0
  66. libdeno-0.3.8/python/src/source.rs +71 -0
  67. libdeno-0.3.8/python/tests/test_api.py +448 -0
  68. libdeno-0.3.8/python/tests/test_capture.py +94 -0
  69. libdeno-0.3.8/python/tests/test_option_validation.py +50 -0
  70. libdeno-0.3.8/python/tests/test_runtime_state.py +207 -0
  71. libdeno-0.3.8/scripts/fetch-snapshot.sh +40 -0
  72. libdeno-0.3.8/scripts/snapshot_compat.py +390 -0
  73. libdeno-0.3.8/scripts/snapshot_compat_path_tests.py +101 -0
  74. libdeno-0.3.8/scripts/snapshot_compat_publication_tests.py +91 -0
  75. libdeno-0.3.8/scripts/test-fetch-snapshot.py +76 -0
  76. libdeno-0.3.8/scripts/test-musl-patch.py +37 -0
  77. libdeno-0.3.8/scripts/test-snapshot-compat.py +414 -0
  78. libdeno-0.3.8/scripts/test-snapshot-import.py +178 -0
  79. libdeno-0.3.8/scripts/test-validate-sdist.py +106 -0
  80. libdeno-0.3.8/scripts/validate_sdist.py +93 -0
  81. libdeno-0.3.8/src/analysis_cache.rs +295 -0
  82. libdeno-0.3.8/src/bin/broker_host.rs +15 -0
  83. libdeno-0.3.8/src/bin/child_host.rs +280 -0
  84. libdeno-0.3.8/src/bin/dummy_host.rs +11 -0
  85. libdeno-0.3.8/src/bin/hook_host.rs +14 -0
  86. libdeno-0.3.8/src/budget.rs +51 -0
  87. libdeno-0.3.8/src/deno_resolver_adapter.rs +169 -0
  88. libdeno-0.3.8/src/deno_runtime_adapter.rs +254 -0
  89. libdeno-0.3.8/src/executor.rs +3538 -0
  90. libdeno-0.3.8/src/graph.rs +349 -0
  91. libdeno-0.3.8/src/http/tests.rs +477 -0
  92. libdeno-0.3.8/src/http.rs +500 -0
  93. libdeno-0.3.8/src/lib.rs +1704 -0
  94. libdeno-0.3.8/src/limits.rs +1194 -0
  95. libdeno-0.3.8/src/module_loader.rs +1225 -0
  96. libdeno-0.3.8/src/node_loader.rs +298 -0
  97. libdeno-0.3.8/src/npm_cache.rs +2429 -0
  98. libdeno-0.3.8/src/output/tests/capture_tests.rs +100 -0
  99. libdeno-0.3.8/src/output.rs +1117 -0
  100. libdeno-0.3.8/src/permission_broker/tests.rs +479 -0
  101. libdeno-0.3.8/src/permission_broker.rs +454 -0
  102. libdeno-0.3.8/src/permissions.rs +601 -0
  103. libdeno-0.3.8/src/pipe_read.rs +119 -0
  104. libdeno-0.3.8/src/runtime.rs +649 -0
  105. libdeno-0.3.8/src/runtime_guards/init.js +39 -0
  106. libdeno-0.3.8/src/runtime_guards/require.rs +273 -0
  107. libdeno-0.3.8/src/runtime_guards/test_routes.js +28 -0
  108. libdeno-0.3.8/src/runtime_guards.rs +547 -0
  109. libdeno-0.3.8/src/services.rs +1197 -0
  110. libdeno-0.3.8/src/snapshot_identity.rs +21 -0
  111. libdeno-0.3.8/src/subprocess/tests/lifecycle_tests.rs +228 -0
  112. libdeno-0.3.8/src/subprocess.rs +4635 -0
  113. libdeno-0.3.8/src/supervisor/tests/read_tests.rs +46 -0
  114. libdeno-0.3.8/src/supervisor.rs +2943 -0
  115. libdeno-0.3.8/src/thread_messaging/tests.rs +65 -0
  116. libdeno-0.3.8/src/thread_messaging.rs +193 -0
  117. libdeno-0.3.8/src/timing.rs +352 -0
  118. libdeno-0.3.8/src/token.rs +54 -0
  119. libdeno-0.3.8/src/worker_factory.rs +305 -0
  120. libdeno-0.3.8/src/worker_lifecycle.rs +359 -0
  121. libdeno-0.3.8/tests/analysis_cache.rs +67 -0
  122. libdeno-0.3.8/tests/async_api.rs +281 -0
  123. libdeno-0.3.8/tests/blob_modules.rs +99 -0
  124. libdeno-0.3.8/tests/capture_windows.rs +97 -0
  125. libdeno-0.3.8/tests/cjs_analysis_modes.rs +73 -0
  126. libdeno-0.3.8/tests/common/mod.rs +76 -0
  127. libdeno-0.3.8/tests/concurrency.rs +170 -0
  128. libdeno-0.3.8/tests/executor.rs +1953 -0
  129. libdeno-0.3.8/tests/features.rs +83 -0
  130. libdeno-0.3.8/tests/fixtures/minimal_addon.c +95 -0
  131. libdeno-0.3.8/tests/fixtures/runtime-guard-localhost.crt +21 -0
  132. libdeno-0.3.8/tests/fixtures/runtime-guard-localhost.key +28 -0
  133. libdeno-0.3.8/tests/module_loader_regressions.rs +297 -0
  134. libdeno-0.3.8/tests/module_modes.rs +86 -0
  135. libdeno-0.3.8/tests/native_addon.rs +242 -0
  136. libdeno-0.3.8/tests/native_extension/init.js +3 -0
  137. libdeno-0.3.8/tests/native_extensions.rs +76 -0
  138. libdeno-0.3.8/tests/node_ipc.rs +271 -0
  139. libdeno-0.3.8/tests/npm_cache.rs +1144 -0
  140. libdeno-0.3.8/tests/output_capture.rs +294 -0
  141. libdeno-0.3.8/tests/permission_broker_install.rs +136 -0
  142. libdeno-0.3.8/tests/permission_broker_require.rs +446 -0
  143. libdeno-0.3.8/tests/permission_broker_require_probe/init.js +7 -0
  144. libdeno-0.3.8/tests/permission_install.rs +55 -0
  145. libdeno-0.3.8/tests/remote_lockfile.rs +479 -0
  146. libdeno-0.3.8/tests/resolver_regressions.rs +192 -0
  147. libdeno-0.3.8/tests/runtime.rs +616 -0
  148. libdeno-0.3.8/tests/runtime_guards.rs +192 -0
  149. libdeno-0.3.8/tests/runtime_regressions.rs +456 -0
  150. libdeno-0.3.8/tests/shared_array_buffer_transfer.rs +99 -0
  151. libdeno-0.3.8/tests/smoke.rs +2274 -0
  152. libdeno-0.3.8/tests/snapshot_architecture.rs +83 -0
  153. libdeno-0.3.8/tests/snapshot_bundle.rs +22 -0
  154. libdeno-0.3.8/tests/snapshot_sources.rs +18 -0
  155. libdeno-0.3.8/tests/supervisor.rs +366 -0
  156. libdeno-0.3.8/tests/thread_messaging.rs +118 -0
  157. libdeno-0.3.8/tests/worker_preload_cancellation.rs +155 -0
@@ -0,0 +1,32 @@
1
+ # cargo-audit ignore list (CI runs `cargo audit --deny warnings`).
2
+ #
3
+ # Every entry is upstream-tracked: the advisory lives in a crate pulled in by
4
+ # the deno stack and has no fixed version libdeno can adopt on its own. See
5
+ # SECURITY.md ("Known upstream-tracked advisories") for details and links.
6
+ # Remove an entry (and re-enable the check) once an upstream fix lands and
7
+ # flows into the tree via `cargo update`.
8
+ [advisories]
9
+ ignore = [
10
+ # hickory-proto 0.25.x (deno stack pin): NSEC3 DoS, patched = [].
11
+ # deno main has not moved off hickory-proto 0.25 yet.
12
+ "RUSTSEC-2026-0118",
13
+ # hickory-proto 0.25.x (deno stack pin): DoS, patched >= 0.26.1.
14
+ "RUSTSEC-2026-0119",
15
+ # rsa 0.9.x (CVE-2023-49092, Marvin timing attack): patched = [] — the
16
+ # RustCrypto/RSA project has shipped no stable fixed release.
17
+ "RUSTSEC-2023-0071",
18
+ # rustls 0.23.40 (deno_tls 0.244.0 exact-pins `rustls = "=0.23.40"`):
19
+ # TLS 1.3 handshake messages accepted across encryption-level boundaries,
20
+ # fixed >= 0.23.45. Cannot be bumped without a deno-stack update.
21
+ "RUSTSEC-2026-0285",
22
+ # Informational: bincode 1.x unmaintained (deno stack dependency).
23
+ "RUSTSEC-2025-0141",
24
+ # Informational: rustls-pemfile unmaintained (deno stack dependency).
25
+ "RUSTSEC-2025-0134",
26
+ # Informational: smartstring unmaintained (deno stack dependency).
27
+ "RUSTSEC-2026-0249",
28
+ # Informational: paste unmaintained (deno stack dependency).
29
+ "RUSTSEC-2024-0436",
30
+ # Informational (unsound, no fix): rand 0.8 in the deno stack.
31
+ "RUSTSEC-2026-0097",
32
+ ]
@@ -0,0 +1,24 @@
1
+ # The v8 crate's output rlib exceeds sccache's archive member limit
2
+ # ("Archive member size is too large"), so bypass any machine-global
3
+ # sccache wrapper configured in ~/.cargo/config.toml for this project.
4
+ # Note: this only beats the *config file* — a shell-level RUSTC_WRAPPER env
5
+ # var outranks it and would silently re-enable sccache.
6
+ [build]
7
+ rustc-wrapper = ""
8
+
9
+ # Development-only linker flags so the example host binary re-exports the
10
+ # napi_* symbols that dlopen'ed .node native addons resolve.
11
+ # Embedded hosts do this in their own build.rs instead, e.g.
12
+ # `deno_napi::print_linker_flags("<host-binary-name>")`.
13
+ [target.'cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))']
14
+ rustflags = ["-C", "link-arg=-Wl,--export-dynamic"]
15
+
16
+ [target.'cfg(target_os = "macos")']
17
+ rustflags = ["-C", "link-arg=-Wl,-export_dynamic"]
18
+
19
+ # No Windows block here: a global `/EXPORT:napi_register_module_v1` rustflag
20
+ # makes every dependency build script fail with LNK2001 (the symbol only
21
+ # exists in binaries that link deno_napi). Windows hosts that need the napi
22
+ # symbol exported for dlopen'ed .node addons must call
23
+ # `deno_napi::print_linker_flags("<host-binary-name>")` from their own
24
+ # build.rs, which scopes the flag to that host binary only.
@@ -0,0 +1,32 @@
1
+ # Dependabot configuration.
2
+ #
3
+ # github-actions is enabled so the commit-SHA pins in .github/workflows stay
4
+ # fresh (dependabot updates SHA + version comment together). Weekly is plenty
5
+ # for actions.
6
+ #
7
+ # cargo is intentionally NOT enabled: the deno stack publishes new releases
8
+ # weekly, so cargo dependabot would open a PR (and trigger a fresh V8 snapshot
9
+ # rebuild in CI) every week. Dependency bumps are instead driven by humans via
10
+ # `cargo update`, validated by CI's cargo audit + --locked and the offline
11
+ # Deno/TypeScript version ledger. This keeps PR noise down and V8 snapshot
12
+ # churn deliberate. Note: dtolnay/rust-toolchain has no version tags — its pin
13
+ # is a dated stable-branch SHA and updates manually.
14
+ version: 2
15
+ updates:
16
+ - package-ecosystem: github-actions
17
+ directory: /
18
+ schedule:
19
+ interval: weekly
20
+ groups:
21
+ # One PR for all action bumps per week, not one per action.
22
+ actions:
23
+ patterns: ["*"]
24
+ ignore:
25
+ # dtolnay/rust-toolchain is pinned by commit SHA on two branches
26
+ # (stable + 1.95.0, the MSRV job). Dependabot cannot tell the branches
27
+ # apart and would "upgrade" the 1.95.0 pin onto the stable SHA, silently
28
+ # turning the MSRV check into a stable-toolchain check. Both pins are
29
+ # updated manually (see the note above).
30
+ - dependency-name: "dtolnay/rust-toolchain"
31
+ commit-message:
32
+ prefix: "chore(ci)"
@@ -0,0 +1,119 @@
1
+ #!/usr/bin/env python3
2
+ """Run cargo-audit with time-limited exceptions for Deno-pinned crates."""
3
+
4
+ import argparse
5
+ from dataclasses import dataclass
6
+ from datetime import date, datetime, timezone
7
+ from pathlib import Path
8
+ import subprocess
9
+ import sys
10
+ import tomllib
11
+
12
+
13
+ @dataclass(frozen=True)
14
+ class Exception:
15
+ package: str
16
+ version: str
17
+ advisories: tuple[str, ...]
18
+ expires: date
19
+ reason: str
20
+
21
+
22
+ # Each entry covers a dependency the Deno stack pins. Drop the entry once the
23
+ # stack moves to a release that no longer carries the advisory.
24
+ EXCEPTIONS = (
25
+ Exception(
26
+ package="rustls",
27
+ version="0.23.40",
28
+ advisories=(
29
+ "RUSTSEC-2026-0346",
30
+ "RUSTSEC-2026-0348",
31
+ "RUSTSEC-2026-0349",
32
+ ),
33
+ expires=date(2026, 11, 17),
34
+ reason="deno_runtime 0.267.0 pins rustls 0.23.40",
35
+ ),
36
+ Exception(
37
+ package="crypto-bigint",
38
+ version="0.5.5",
39
+ advisories=("RUSTSEC-2026-0387",),
40
+ expires=date(2026, 12, 31),
41
+ reason=(
42
+ "elliptic-curve 0.13 in the Deno stack still depends on "
43
+ "crypto-bigint 0.5, while the advisory is fixed in 0.7.6"
44
+ ),
45
+ ),
46
+ Exception(
47
+ package="zstd",
48
+ version="0.13.2",
49
+ advisories=("RUSTSEC-2026-0391",),
50
+ expires=date(2026, 11, 26),
51
+ reason=(
52
+ "deno_node 0.197.0 pins zstd 0.13.2; 0.198.0 and upstream main "
53
+ "still do, and the fixed 0.14.3 chain is not yet available through Deno"
54
+ ),
55
+ ),
56
+ Exception(
57
+ package="zstd-safe",
58
+ version="7.2.4",
59
+ advisories=(
60
+ "RUSTSEC-2026-0403", "RUSTSEC-2026-0398", "RUSTSEC-2026-0395",
61
+ "RUSTSEC-2026-0402", "RUSTSEC-2026-0406", "RUSTSEC-2026-0404",
62
+ "RUSTSEC-2026-0400", "RUSTSEC-2026-0399", "RUSTSEC-2026-0401",
63
+ "RUSTSEC-2026-0405", "RUSTSEC-2026-0397", "RUSTSEC-2026-0396",
64
+ ),
65
+ expires=date(2026, 11, 26),
66
+ reason="Deno's zstd 0.13.2 pin selects zstd-safe 7.2.4; fixed 8.2.0 is not yet available through Deno",
67
+ ),
68
+ Exception(
69
+ package="zstd-sys",
70
+ version="2.0.16+zstd.1.5.7",
71
+ advisories=("RUSTSEC-2026-0410",),
72
+ expires=date(2026, 11, 26),
73
+ reason="Deno's zstd 0.13.2 pin selects zstd-sys 2.0.16; fixed 2.1.2 is not yet available through Deno",
74
+ ),
75
+ )
76
+
77
+
78
+ def audit(lockfile: Path, today: date | None = None) -> int:
79
+ packages = tomllib.loads(lockfile.read_text(encoding="utf-8")).get("package", [])
80
+ if today is None:
81
+ today = datetime.now(timezone.utc).date()
82
+
83
+ ignored: list[str] = []
84
+ for exception in EXCEPTIONS:
85
+ pinned = any(
86
+ package.get("name") == exception.package
87
+ and package.get("version") == exception.version
88
+ for package in packages
89
+ )
90
+ if not pinned:
91
+ continue
92
+ if today >= exception.expires:
93
+ print(
94
+ f"Temporary audit exception for {exception.package} "
95
+ f"{exception.version} expired {exception.expires}: "
96
+ f"{exception.reason}",
97
+ file=sys.stderr,
98
+ )
99
+ return 1
100
+ print(
101
+ f"WARNING: temporarily ignoring {', '.join(exception.advisories)} for "
102
+ f"{exception.package} {exception.version} until {exception.expires}."
103
+ )
104
+ ignored.extend(exception.advisories)
105
+
106
+ command = ["cargo", "audit", "--deny", "warnings", "--file", str(lockfile)]
107
+ for advisory in ignored:
108
+ command.extend(("--ignore", advisory))
109
+ return subprocess.run(command, check=False).returncode
110
+
111
+
112
+ def main() -> int:
113
+ parser = argparse.ArgumentParser()
114
+ parser.add_argument("lockfile", type=Path)
115
+ return audit(parser.parse_args().lockfile)
116
+
117
+
118
+ if __name__ == "__main__":
119
+ raise SystemExit(main())
@@ -0,0 +1,227 @@
1
+ #!/usr/bin/env python3
2
+ """Check checked-in Deno/TypeScript declarations without network access."""
3
+
4
+ import re
5
+ import json
6
+ import subprocess
7
+ import tomllib
8
+ from pathlib import Path
9
+
10
+
11
+ ROOT = Path(__file__).parents[2]
12
+
13
+
14
+ def exactly_one(pattern: str, text: str, label: str) -> str:
15
+ matches = re.findall(pattern, text, re.MULTILINE)
16
+ if len(matches) != 1:
17
+ raise SystemExit(
18
+ f"manual upstream check required: {label} has "
19
+ f"{len(matches)} local declarations"
20
+ )
21
+ return matches[0]
22
+
23
+
24
+ manifest = tomllib.loads((ROOT / "Cargo.toml").read_text(encoding="utf-8"))
25
+ upstream = (
26
+ manifest.get("package", {})
27
+ .get("metadata", {})
28
+ .get("libdeno", {})
29
+ .get("upstream")
30
+ )
31
+ required = {
32
+ "deno-version",
33
+ "typescript-version",
34
+ "deno-runtime-version",
35
+ "deno-core-version",
36
+ "deno-resolver-version",
37
+ "deno-graph-version",
38
+ "v8-version",
39
+ }
40
+ if not isinstance(upstream, dict) or not required <= upstream.keys():
41
+ raise SystemExit(
42
+ "manual upstream check required: Cargo.toml must contain the complete "
43
+ "[package.metadata.libdeno.upstream] ledger"
44
+ )
45
+ for key in required:
46
+ value = upstream[key]
47
+ if key == "v8-version":
48
+ if not isinstance(value, str) or not re.fullmatch(r"\d+\.\d+\.\d+\.\d+-rusty", value):
49
+ raise SystemExit(f"manual upstream check required: invalid {key} = {value!r}")
50
+ continue
51
+ if not isinstance(value, str) or not re.fullmatch(r"\d+\.\d+\.\d+", value):
52
+ raise SystemExit(f"manual upstream check required: invalid {key} = {value!r}")
53
+
54
+ deno = exactly_one(
55
+ r'^\s*const\s+DENO_VERSION\s*:\s*&str\s*=\s*"([^"]+)"\s*;',
56
+ (ROOT / "src/deno_runtime_adapter.rs").read_text(encoding="utf-8"),
57
+ "src/deno_runtime_adapter.rs DENO_VERSION",
58
+ )
59
+ ts = exactly_one(
60
+ r'^\s*const\s+TS_VERSION\s*:\s*&str\s*=\s*"([^"]+)"\s*;',
61
+ (ROOT / "build.rs").read_text(encoding="utf-8"),
62
+ "build.rs TS_VERSION",
63
+ )
64
+ if deno != upstream["deno-version"]:
65
+ raise SystemExit(
66
+ f"Deno version drift: source {deno!r}, ledger {upstream['deno-version']!r}"
67
+ )
68
+ if ts != upstream["typescript-version"]:
69
+ raise SystemExit(
70
+ f"TypeScript version drift: build.rs {ts!r}, "
71
+ f"ledger {upstream['typescript-version']!r}"
72
+ )
73
+
74
+
75
+ def declared(section: str, name: str):
76
+ value = manifest.get(section, {}).get(name)
77
+ if isinstance(value, str):
78
+ return value
79
+ if isinstance(value, dict):
80
+ return value.get("version")
81
+ return None
82
+
83
+
84
+ dependency_checks = {
85
+ "deno-runtime-version": [
86
+ ("dependencies", "deno_runtime"),
87
+ ("build-dependencies", "deno_runtime"),
88
+ ],
89
+ "deno-core-version": [
90
+ ("dependencies", "deno_core"),
91
+ ("build-dependencies", "deno_core"),
92
+ ],
93
+ "deno-resolver-version": [("dependencies", "deno_resolver")],
94
+ "deno-graph-version": [("dependencies", "deno_graph")],
95
+ }
96
+ for ledger_key, locations in dependency_checks.items():
97
+ for section, name in locations:
98
+ value = declared(section, name)
99
+ if value is None or value.lstrip("=") != upstream[ledger_key]:
100
+ raise SystemExit(
101
+ f"dependency version drift: {section}.{name} declares {value!r}, "
102
+ f"ledger requires {upstream[ledger_key]!r}"
103
+ )
104
+
105
+
106
+ def cargo_metadata(manifest_path: Path):
107
+ # --no-deps omits the resolve graph, so use the full graph without allowing
108
+ # Cargo to update or fetch anything.
109
+ try:
110
+ result = subprocess.run(
111
+ [
112
+ "cargo",
113
+ "metadata",
114
+ "--locked",
115
+ "--offline",
116
+ "--format-version",
117
+ "1",
118
+ "--manifest-path",
119
+ str(manifest_path),
120
+ ],
121
+ cwd=ROOT,
122
+ check=True,
123
+ capture_output=True,
124
+ text=True,
125
+ )
126
+ return json.loads(result.stdout)
127
+ except (OSError, subprocess.CalledProcessError, json.JSONDecodeError) as error:
128
+ raise SystemExit(f"cargo metadata check failed for {manifest_path}: {error}")
129
+
130
+
131
+ def metadata_root(metadata, manifest_path: Path):
132
+ matches = [
133
+ package
134
+ for package in metadata.get("packages", [])
135
+ if Path(package.get("manifest_path", "")).resolve() == manifest_path.resolve()
136
+ ]
137
+ if len(matches) != 1:
138
+ raise SystemExit(
139
+ f"cargo metadata check failed for {manifest_path}: "
140
+ f"found {len(matches)} root packages"
141
+ )
142
+ package = matches[0]
143
+ nodes = {node["id"]: node for node in metadata.get("resolve", {}).get("nodes", [])}
144
+ node = nodes.get(package.get("id"))
145
+ if node is None:
146
+ raise SystemExit(
147
+ f"cargo metadata check failed for {manifest_path}: root resolve node missing"
148
+ )
149
+ packages = {item["id"]: item for item in metadata.get("packages", [])}
150
+ return node, packages
151
+
152
+
153
+ def resolved_direct_package(metadata, manifest_path: Path, name: str):
154
+ node, packages = metadata_root(metadata, manifest_path)
155
+ edges = [edge for edge in node.get("deps", []) if edge.get("name") == name]
156
+ if len(edges) != 1:
157
+ raise SystemExit(
158
+ f"{manifest_path} metadata drift: root dependency {name} has "
159
+ f"{len(edges)} resolved edges"
160
+ )
161
+ package = packages.get(edges[0].get("pkg"))
162
+ if package is None:
163
+ raise SystemExit(
164
+ f"{manifest_path} metadata drift: root dependency {name} "
165
+ "points to an unknown package"
166
+ )
167
+ if package.get("name") != name:
168
+ raise SystemExit(
169
+ f"{manifest_path} metadata drift: root dependency {name} "
170
+ f"resolves to package {package.get('name')!r}"
171
+ )
172
+ return package
173
+
174
+
175
+ def resolved_direct_version(metadata, manifest_path: Path, name: str) -> str:
176
+ return resolved_direct_package(metadata, manifest_path, name)["version"]
177
+
178
+
179
+ root_manifest = ROOT / "Cargo.toml"
180
+ root_metadata = cargo_metadata(root_manifest)
181
+ root_node, _ = metadata_root(root_metadata, root_manifest)
182
+ for ledger_key, locations in dependency_checks.items():
183
+ name = locations[0][1]
184
+ resolved = resolved_direct_version(root_metadata, root_manifest, name)
185
+ if resolved != upstream[ledger_key]:
186
+ raise SystemExit(
187
+ f"Cargo metadata drift: root dependency {name} resolves to {resolved!r}, "
188
+ f"ledger requires {upstream[ledger_key]!r}"
189
+ )
190
+
191
+ python_manifest = ROOT / "python/Cargo.toml"
192
+ python_metadata = cargo_metadata(python_manifest)
193
+ python_package = resolved_direct_package(python_metadata, python_manifest, "libdeno")
194
+ if (
195
+ python_package["id"] != root_node["id"]
196
+ or python_package["version"] != manifest["package"]["version"]
197
+ ):
198
+ raise SystemExit(
199
+ f"Cargo metadata drift: {python_manifest} libdeno resolves to "
200
+ f"{python_package['id']}@{python_package['version']}, "
201
+ f"root package requires {root_node['id']}@{manifest['package']['version']}"
202
+ )
203
+
204
+ for lock_path in (ROOT / "Cargo.lock", ROOT / "python/Cargo.lock"):
205
+ lock = tomllib.loads(lock_path.read_text(encoding="utf-8"))
206
+ for name, ledger_key in (
207
+ ("deno_runtime", "deno-runtime-version"),
208
+ ("deno_core", "deno-core-version"),
209
+ ("deno_resolver", "deno-resolver-version"),
210
+ ("deno_graph", "deno-graph-version"),
211
+ ):
212
+ locked = {
213
+ package["version"]
214
+ for package in lock["package"]
215
+ if package["name"] == name
216
+ }
217
+ if upstream[ledger_key] not in locked:
218
+ raise SystemExit(
219
+ f"{lock_path} drift: {name} has {sorted(locked)!r}, "
220
+ f"ledger requires {upstream[ledger_key]!r}"
221
+ )
222
+
223
+ print(
224
+ "offline local version consistency passed; upstream Deno/TypeScript provenance "
225
+ "still requires manual inspection of the matching Deno tag "
226
+ "(no network lookup performed)"
227
+ )
@@ -0,0 +1,117 @@
1
+ name: Rust PR
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: [main]
7
+ workflow_dispatch:
8
+ merge_group:
9
+
10
+ permissions:
11
+ contents: read
12
+
13
+ concurrency:
14
+ group: rust-pr-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
15
+ cancel-in-progress: true
16
+
17
+ env:
18
+ CARGO_TERM_COLOR: always
19
+ RUST_BACKTRACE: 1
20
+
21
+ # Supply chain: every `uses:` is pinned to a full commit SHA; the trailing
22
+ # comment names the version/ref it corresponds to. Bump via dependabot
23
+ # (github-actions ecosystem) or `gh api repos/<owner>/<repo>/commits/<ref>`.
24
+
25
+ jobs:
26
+ fast:
27
+ name: Rust PR / fast
28
+ runs-on: ubuntu-latest
29
+ steps:
30
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
31
+ with:
32
+ persist-credentials: false
33
+
34
+ - uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable branch (2026-08-05)
35
+ with:
36
+ components: rustfmt, clippy
37
+
38
+ - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
39
+ with:
40
+ cache-on-failure: false
41
+
42
+ - name: Fetch pinned crate sources
43
+ run: cargo fetch --locked
44
+
45
+ - name: Test snapshot helpers and pinned musl patch
46
+ run: |
47
+ python3 scripts/test-fetch-snapshot.py
48
+ python3 scripts/test-snapshot-compat.py
49
+ python3 scripts/test-snapshot-import.py
50
+ python3 - <<'PY'
51
+ import os
52
+ from pathlib import Path
53
+ import subprocess
54
+
55
+ cargo_home = Path(os.environ.get("CARGO_HOME", Path.home() / ".cargo"))
56
+ registry = cargo_home / "registry/src"
57
+ runtime = next(registry.glob("*/deno_runtime-0.267.0"), None)
58
+ node = next(registry.glob("*/deno_node-0.197.0"), None)
59
+ if runtime is None or node is None:
60
+ raise SystemExit("cargo fetch did not provide the pinned musl patch sources")
61
+ subprocess.run(["python3", "scripts/test-musl-patch.py", str(runtime), str(node)], check=True)
62
+ PY
63
+
64
+ - name: Format
65
+ run: cargo fmt --check
66
+
67
+ - name: Lint
68
+ run: cargo clippy --all-targets -- -D warnings
69
+
70
+ - name: Lint execution-control feature
71
+ run: cargo clippy --all-targets --features execution-control,phase-diagnostics -- -D warnings
72
+
73
+ - name: Test
74
+ # --locked keeps CI in sync with the committed Cargo.lock (the release
75
+ # publish is --locked too, so lockfile drift fails here, not at tag).
76
+ run: cargo test --all-targets --locked
77
+
78
+ - name: Prepare execution-control feature test
79
+ run: |
80
+ df -h .
81
+ cargo clean -p libdeno
82
+ df -h .
83
+
84
+ - name: Test execution-control feature
85
+ run: cargo test --all-targets --features execution-control,phase-diagnostics --locked
86
+ env:
87
+ CARGO_BUILD_JOBS: 1
88
+
89
+ - name: Check docs.rs mode
90
+ run: DOCS_RS=1 cargo check --no-default-features --lib --locked
91
+
92
+ - name: Check npm-disabled feature set
93
+ run: cargo check --all-targets --no-default-features --features snapshot --locked
94
+
95
+ - name: Check npm-disabled + execution-control feature set
96
+ run: cargo check --all-targets --no-default-features --features snapshot,execution-control,phase-diagnostics --locked
97
+
98
+ - name: Check downstream native extension consumer
99
+ run: |
100
+ cp Cargo.lock tests/fixtures/native-extension-consumer/Cargo.lock
101
+ CARGO_TARGET_DIR="$GITHUB_WORKSPACE/target" cargo check --offline --manifest-path tests/fixtures/native-extension-consumer/Cargo.toml
102
+
103
+ # ponytail: reclaim this crate's accumulated feature artifacts and serialize
104
+ # large links to reduce cumulative artifact/concurrent-link pressure.
105
+ - name: Prepare npm-disabled feature test
106
+ run: |
107
+ df -h .
108
+ df -i .
109
+ free -h
110
+ cargo clean -p libdeno
111
+ df -h .
112
+ df -i .
113
+
114
+ - name: Test npm-disabled feature set
115
+ run: cargo test --no-default-features --features snapshot --lib --test smoke --test runtime --test async_api --locked
116
+ env:
117
+ CARGO_BUILD_JOBS: 1
@@ -0,0 +1,120 @@
1
+ name: Rust compatibility
2
+
3
+ on:
4
+ pull_request:
5
+ paths:
6
+ - "**/*.rs"
7
+ - build.rs
8
+ - Cargo.toml
9
+ - Cargo.lock
10
+ - python/Cargo.toml
11
+ - python/Cargo.lock
12
+ - python/pyproject.toml
13
+ - python/src/**
14
+ - ".cargo/**"
15
+ - ".github/workflows/**"
16
+ workflow_dispatch:
17
+ schedule:
18
+ - cron: "30 3 * * 0"
19
+
20
+ permissions:
21
+ contents: read
22
+
23
+ concurrency:
24
+ group: rust-compatibility-${{ github.workflow }}-${{ github.ref }}
25
+ cancel-in-progress: true
26
+
27
+ env:
28
+ CARGO_TERM_COLOR: always
29
+ RUST_BACKTRACE: 1
30
+
31
+ jobs:
32
+ test:
33
+ name: locked test (${{ matrix.os }})
34
+ runs-on: ${{ matrix.os }}
35
+ strategy:
36
+ fail-fast: false
37
+ matrix:
38
+ os: [macos-15, macos-15-intel, windows-latest]
39
+ steps:
40
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
41
+ with:
42
+ persist-credentials: false
43
+
44
+ - uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable branch (2026-08-05)
45
+
46
+ - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
47
+ with:
48
+ cache-on-failure: false
49
+
50
+ - name: Test
51
+ run: cargo test --all-targets --locked
52
+
53
+ - name: Test execution-control feature
54
+ run: cargo test --all-targets --features execution-control,phase-diagnostics --locked
55
+
56
+ msrv:
57
+ name: MSRV check (1.95.0)
58
+ runs-on: ubuntu-latest
59
+ steps:
60
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
61
+ with:
62
+ persist-credentials: false
63
+
64
+ - uses: dtolnay/rust-toolchain@a5f673d0ba8626c3977bb416a1612774bc82181b # 1.95.0 branch
65
+
66
+ - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
67
+ with:
68
+ cache-on-failure: false
69
+
70
+ - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
71
+ with:
72
+ python-version: "3.9"
73
+
74
+ - name: Check Python minimum and release metadata
75
+ shell: bash
76
+ run: |
77
+ set -euo pipefail
78
+ python - <<'PY'
79
+ import re
80
+ from pathlib import Path
81
+
82
+ pyproject = Path("python/pyproject.toml").read_text()
83
+ python_cargo = Path("python/Cargo.toml").read_text()
84
+ versions = []
85
+ for path in (Path("Cargo.toml"), Path("python/pyproject.toml"), Path("python/Cargo.toml")):
86
+ matches = re.findall(r'^version\s*=\s*"([^"]+)"', path.read_text(), re.MULTILINE)
87
+ if len(matches) != 1:
88
+ raise SystemExit(f"{path}: expected exactly one package version")
89
+ versions.append(matches[0])
90
+
91
+ if versions.count(versions[0]) != len(versions):
92
+ raise SystemExit(f"release target versions are inconsistent: {versions}")
93
+
94
+ requires = re.findall(
95
+ r'^requires-python\s*=\s*"([^"]+)"', pyproject, re.MULTILINE
96
+ )
97
+ if requires != [">=3.9"]:
98
+ raise SystemExit(
99
+ "python release target must declare requires-python = \">=3.9\"; "
100
+ f"found {requires!r}"
101
+ )
102
+ if "abi3-py39" not in python_cargo:
103
+ raise SystemExit("python/Cargo.toml must keep PyO3's abi3-py39 feature")
104
+ if not re.search(r'^crate-type\s*=\s*\[\s*"cdylib"\s*\]', python_cargo, re.MULTILINE):
105
+ raise SystemExit("python crate must retain its cdylib release target")
106
+ print(f"validated Rust/Python release version {versions[0]} and Python 3.9 floor")
107
+ PY
108
+
109
+ - name: Check (MSRV)
110
+ # --all-targets covers the build script plus lib/bin/example/test/bench targets.
111
+ run: cargo check --all-targets --locked
112
+
113
+ - name: Check docs.rs mode (MSRV)
114
+ run: DOCS_RS=1 cargo check --no-default-features --lib --locked
115
+
116
+ - name: Check execution-control feature (MSRV)
117
+ run: cargo check --all-targets --features execution-control,phase-diagnostics --locked
118
+
119
+ - name: Check Python crate (MSRV)
120
+ run: cargo check --manifest-path python/Cargo.toml --locked