@c9up/atom 0.1.4 → 0.1.6

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/dist/math.d.ts CHANGED
@@ -11,9 +11,9 @@ export declare function divTs(a: string, b: string, precision: number): string;
11
11
  export declare function cmpTs(a: string, b: string): -1 | 0 | 1;
12
12
  /**
13
13
  * Align two parsed decimals to the same scale by multiplying the less-precise
14
- * one by `10^(scaleDelta)`. Exported so `Decimal.ts` can reuse it — previously
15
- * both files had their own copy under different names (`alignScale` vs
16
- * `alignScaleParts`), which is a maintenance hazard.
14
+ * one by `10^(scaleDelta)`. Used by the TS arithmetic helpers below
15
+ * (add/sub/cmp/mod). NOTE: `Decimal.ts` does NOT import this it aligns scales
16
+ * inline via `pow10BigInt`, so this is not a shared-dedup point.
17
17
  */
18
18
  export declare function alignScale(a: ParsedDecimal, b: ParsedDecimal): [bigint, bigint, number];
19
19
  /** Exact `10^exp` as a `bigint`. Exported — single definition for the whole TS side. */
package/dist/math.js CHANGED
@@ -82,9 +82,9 @@ export function cmpTs(a, b) {
82
82
  }
83
83
  /**
84
84
  * Align two parsed decimals to the same scale by multiplying the less-precise
85
- * one by `10^(scaleDelta)`. Exported so `Decimal.ts` can reuse it — previously
86
- * both files had their own copy under different names (`alignScale` vs
87
- * `alignScaleParts`), which is a maintenance hazard.
85
+ * one by `10^(scaleDelta)`. Used by the TS arithmetic helpers below
86
+ * (add/sub/cmp/mod). NOTE: `Decimal.ts` does NOT import this it aligns scales
87
+ * inline via `pow10BigInt`, so this is not a shared-dedup point.
88
88
  */
89
89
  export function alignScale(a, b) {
90
90
  if (a.scale === b.scale)
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c9up/atom",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Atom — exact decimal arithmetic for the Ream ecosystem (TypeScript + Rust N-API)",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -21,13 +21,12 @@
21
21
  "README.md",
22
22
  "dist",
23
23
  "index.*.node",
24
- "index.d.ts",
25
- "index.js",
26
24
  "scripts",
27
25
  "src",
28
26
  "wasm"
29
27
  ],
30
28
  "devDependencies": {
29
+ "@biomejs/biome": "^2.4.10",
31
30
  "@types/node": "^22.19.15",
32
31
  "typescript": "^6.0.2",
33
32
  "vitest": "^4.1.2"
@@ -0,0 +1,27 @@
1
+ import { existsSync, statSync } from 'node:fs'
2
+ import { dirname, join } from 'node:path'
3
+ import { fileURLToPath } from 'node:url'
4
+
5
+ // Publish-time gate: the `wasm-pack build --target web` output (JS glue + the
6
+ // binary) MUST be in the package. Without it the browser loader
7
+ // (src/native.ts) throws ATOM_ENGINE_NOT_FOUND at runtime — exactly the
8
+ // "stub-only tarball" failure this gate exists to prevent. Only the hand-written
9
+ // `atom_engine_wasm.d.ts` typecheck stub is committed; the .js/.wasm are built.
10
+
11
+ const here = dirname(fileURLToPath(import.meta.url))
12
+ const wasmDir = join(here, '..', 'wasm')
13
+
14
+ const required = ['atom_engine_wasm.js', 'atom_engine_wasm_bg.wasm']
15
+ for (const name of required) {
16
+ const p = join(wasmDir, name)
17
+ if (!existsSync(p)) {
18
+ throw new Error(
19
+ `[atom:wasm] missing build artifact: wasm/${name} — run \`pnpm build:wasm\` (wasm-pack) before publishing`,
20
+ )
21
+ }
22
+ if (statSync(p).size === 0) {
23
+ throw new Error(`[atom:wasm] empty build artifact: wasm/${name}`)
24
+ }
25
+ }
26
+
27
+ console.log('[atom:wasm] browser artifacts present')
package/src/math.ts CHANGED
@@ -95,9 +95,9 @@ export function cmpTs(a: string, b: string): -1 | 0 | 1 {
95
95
 
96
96
  /**
97
97
  * Align two parsed decimals to the same scale by multiplying the less-precise
98
- * one by `10^(scaleDelta)`. Exported so `Decimal.ts` can reuse it — previously
99
- * both files had their own copy under different names (`alignScale` vs
100
- * `alignScaleParts`), which is a maintenance hazard.
98
+ * one by `10^(scaleDelta)`. Used by the TS arithmetic helpers below
99
+ * (add/sub/cmp/mod). NOTE: `Decimal.ts` does NOT import this it aligns scales
100
+ * inline via `pow10BigInt`, so this is not a shared-dedup point.
101
101
  */
102
102
  export function alignScale(
103
103
  a: ParsedDecimal,
@@ -1,19 +0,0 @@
1
- // Hand-written stub for the wasm-pack-generated glue file. Lets `tsc --noEmit`
2
- // pass on a fresh checkout before `pnpm build:wasm` has been run. wasm-pack
3
- // will overwrite this file with its real generated declarations on the next
4
- // `build:wasm`; the runtime shape stays compatible.
5
- //
6
- // Story 52.1 review patch (2026-05-09): typecheck was broken on a fresh
7
- // checkout because src/native.ts:60 imports this glue file, and `tsc` could
8
- // not find it without first running `build:wasm`.
9
-
10
- export default function init(): Promise<unknown>;
11
-
12
- export function add(a: string, b: string): string;
13
- export function sub(a: string, b: string): string;
14
- export function mul(a: string, b: string): string;
15
- export function div(a: string, b: string, precision: number): string;
16
- export function rem(a: string, b: string): string;
17
- export function pow(a: string, exp: number, precision: number): string;
18
- export function sqrt(a: string, precision: number): string;
19
- export function cmp(a: string, b: string): number;