wative-core 2.2.0 → 2.3.9

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 (54) hide show
  1. package/CHANGELOG.md +493 -9
  2. package/LICENSE +114 -0
  3. package/README.md +228 -8
  4. package/dist/artifacts/evm/index.cjs +1 -1
  5. package/dist/artifacts/evm/index.d.cts +2 -2
  6. package/dist/artifacts/evm/index.d.ts +2 -2
  7. package/dist/artifacts/evm/index.js +1 -1
  8. package/dist/artifacts/svm/index.cjs +1 -1
  9. package/dist/artifacts/svm/index.d.cts +3 -3
  10. package/dist/artifacts/svm/index.d.ts +3 -3
  11. package/dist/artifacts/svm/index.js +1 -1
  12. package/dist/{container-provider-i614LDE1.d.cts → container-provider-CkKGyHis.d.cts} +10 -3
  13. package/dist/{container-provider-C59yqd5Z.d.ts → container-provider-D_557LVN.d.ts} +10 -3
  14. package/dist/{evm-BLml33LX.d.cts → evm-Xw4zBLUH.d.ts} +2 -2
  15. package/dist/{evm-DTzqGlL6.d.ts → evm-gsdoVj16.d.cts} +2 -2
  16. package/dist/{file-sink-LS4hyXXi.d.ts → file-sink-C_SlT9IC.d.cts} +8 -5
  17. package/dist/{file-sink-B73MuigK.d.cts → file-sink-D33jvque.d.ts} +8 -5
  18. package/dist/index.cjs +1 -1
  19. package/dist/index.d.cts +20 -7
  20. package/dist/index.d.ts +20 -7
  21. package/dist/index.js +1 -1
  22. package/dist/index.node.cjs +1 -1
  23. package/dist/index.node.d.cts +6 -6
  24. package/dist/index.node.d.ts +6 -6
  25. package/dist/index.node.js +1 -1
  26. package/dist/node/index.cjs +1 -1
  27. package/dist/node/index.d.cts +3 -3
  28. package/dist/node/index.d.ts +3 -3
  29. package/dist/node/index.js +1 -1
  30. package/dist/{svm-DieFbh9k.d.ts → svm-CTCJsYri.d.cts} +2 -2
  31. package/dist/{svm-CCzqNAWM.d.cts → svm-CUuqpl1h.d.ts} +2 -2
  32. package/dist/{workspace-CamTHxso.d.cts → workspace-Du_jy51u.d.cts} +19 -4
  33. package/dist/{workspace-CamTHxso.d.ts → workspace-Du_jy51u.d.ts} +19 -4
  34. package/{tests → examples}/11-subpath-imports.test.cjs +5 -2
  35. package/examples/15-package-resolution.test.cjs +262 -0
  36. package/examples/18-envelope-v3.test.cjs +106 -0
  37. package/package.json +6 -3
  38. package/tests/15-package-resolution.test.cjs +0 -76
  39. /package/{tests → examples}/01-quick-start.test.cjs +0 -0
  40. /package/{tests → examples}/02-hd-account.test.cjs +0 -0
  41. /package/{tests → examples}/03-pk-account.test.cjs +0 -0
  42. /package/{tests → examples}/04-network-management.test.cjs +0 -0
  43. /package/{tests → examples}/05-asset-management.test.cjs +0 -0
  44. /package/{tests → examples}/06-address-signing.test.cjs +0 -0
  45. /package/{tests → examples}/07-custom-provider.test.cjs +0 -0
  46. /package/{tests → examples}/08-persistence.test.cjs +0 -0
  47. /package/{tests → examples}/09-workspace-filter.test.cjs +0 -0
  48. /package/{tests → examples}/10-default-network.test.cjs +0 -0
  49. /package/{tests → examples}/12-logger.test.cjs +0 -0
  50. /package/{tests → examples}/13-workspace-config.test.cjs +0 -0
  51. /package/{tests → examples}/14-esm-runtime.test.mjs +0 -0
  52. /package/{tests → examples}/16-known-answer-vectors.test.cjs +0 -0
  53. /package/{tests → examples}/17-locked-state.test.cjs +0 -0
  54. /package/{tests → examples}/README.md +0 -0
@@ -1,76 +0,0 @@
1
- // 15 — Package resolution. Every other example imports `../dist/index.cjs`
2
- // directly, which bypasses the `exports` map in package.json entirely. This
3
- // file is the only one that resolves the package the way a real consumer does:
4
- // by its bare name. It therefore covers the export conditions (`import` vs
5
- // `require`), the declared subpaths, and the parity between the two builds.
6
- //
7
- // It works without installing anything because Node resolves a package's own
8
- // name from inside that package ("self-reference"), which requires `name` and
9
- // `exports` to be present — so a broken exports map fails this file outright.
10
-
11
- const test = require("node:test");
12
- const assert = require("node:assert");
13
-
14
- const SUBPATHS = ["wative-core", "wative-core/artifacts/evm", "wative-core/artifacts/svm"];
15
-
16
- test("every declared subpath resolves by bare name under require(), to the CJS build", () => {
17
- for (const specifier of SUBPATHS) {
18
- const resolved = require.resolve(specifier);
19
- assert.ok(
20
- resolved.endsWith(".cjs"),
21
- `${specifier} should resolve to the CJS build via the "require" condition, got ${resolved}`,
22
- );
23
- const mod = require(specifier);
24
- assert.ok(mod && typeof mod === "object", `${specifier} exported nothing`);
25
- }
26
- });
27
-
28
- test("bare-name require() exposes the documented entry points", () => {
29
- const core = require("wative-core");
30
- for (const name of ["Workspace", "Network", "Asset", "Provider", "WativeError"]) {
31
- assert.ok(core[name], `wative-core should export ${name}`);
32
- }
33
- const evm = require("wative-core/artifacts/evm");
34
- assert.strictEqual(typeof evm.ERC20.encode, "function");
35
- const svm = require("wative-core/artifacts/svm");
36
- assert.strictEqual(typeof svm.TokenProgram.encodeInstruction, "function");
37
- });
38
-
39
- test("every declared subpath resolves by bare name under import(), to the ESM build", async () => {
40
- for (const specifier of SUBPATHS) {
41
- const mod = await import(specifier);
42
- assert.ok(mod && typeof mod === "object", `${specifier} exported nothing via import()`);
43
- }
44
- });
45
-
46
- test("the CJS and ESM builds expose an identical export surface", async () => {
47
- const cjs = require("wative-core");
48
- const esm = await import("wative-core");
49
-
50
- const cjsKeys = Object.keys(cjs).sort();
51
- // The ESM namespace carries a `default` interop key that the CJS object does not.
52
- const esmKeys = Object.keys(esm).filter((k) => k !== "default").sort();
53
-
54
- assert.deepStrictEqual(
55
- esmKeys,
56
- cjsKeys,
57
- "the two builds must expose the same named exports, or consumers get different APIs depending on how they import",
58
- );
59
- assert.ok(cjsKeys.length > 0, "expected a non-empty export surface");
60
- });
61
-
62
- test("the package advertises a Node version that the current runtime satisfies", () => {
63
- const { engines } = require("wative-core/package.json");
64
- assert.ok(engines && engines.node, "package.json should declare engines.node");
65
-
66
- const required = engines.node.replace(/^[^\d]*/, "").split(".").map(Number);
67
- const actual = process.versions.node.split(".").map(Number);
68
- const satisfies =
69
- actual[0] > required[0] ||
70
- (actual[0] === required[0] && (actual[1] ?? 0) >= (required[1] ?? 0));
71
-
72
- assert.ok(
73
- satisfies,
74
- `these examples are running on Node ${process.versions.node} but the package requires ${engines.node}`,
75
- );
76
- });
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes