@danielsimonjr/mathts-units 0.4.0 → 0.6.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/README.md CHANGED
@@ -20,6 +20,7 @@ npm install @danielsimonjr/mathts-units
20
20
  - Registry: `BASE_UNITS`, `DERIVED_UNITS`, `ALL_UNITS`, `UNIT_ALIASES`, `getUnitDef`.
21
21
  - Prefixes: `SI_PREFIXES`, `BEST_PREFIXES`, `getPrefix`.
22
22
  - `DIMENSIONLESS`, `dim`, and the `Dimensions` / `UnitDef` types.
23
+ - `toSiDimensionVector` / `fromSiDimensionVector` — `SiDimensionVector` exponents are core `Fraction`s (`SiDimensionExponent` is `number | Fraction` on the way in); `Unit.dimensions` remains `number[]`. Import `Fraction` from `@danielsimonjr/mathts-core` when comparing components.
23
24
 
24
25
  ```ts
25
26
  import { Unit } from '@danielsimonjr/mathts-units';
package/dist/index.d.ts CHANGED
@@ -10,5 +10,5 @@
10
10
  * @packageDocumentation
11
11
  */
12
12
  export { Unit, isUnit, isUnitValue, DimensionMismatchError, UnitParseError, DIMENSIONLESS, dim, UNIT_DIMENSION_LENGTH, SI_DIMENSION_LENGTH, toSiDimensions, toSiDimensionVector, fromSiDimensions, fromSiDimensionVector, BASE_UNITS, DERIVED_UNITS, ALL_UNITS, UNIT_ALIASES, getUnitDef, SI_PREFIXES, BEST_PREFIXES, getPrefix, UNIT_EXACT_SCALE, PI_EXACT_SCALE, LN2_EXACT_SCALE, NAMED_IRRATIONALS, namedIrrationalScale, irrationalPower, isRationalScale, decimalExactScale, exactScaleOf, binaryExactScale, ratioExactScale, multiplyExactScales, divideExactScales, powerExactScale, addExactScales, exactScalesEqual, exactScaleToNumber, clearExactScaleNumberCache, exactScaleNumberCacheSize, formatExactScale, readScaleExpression, NAMED_SCALES, UNIT_ROWS, UNIT_ROW_ALIASES, namedExactScale, readUnitScale, getUnitRow, unitRowExactScale, unitRowValue, unitRowExactOffset, UNIT_PREFIX_SETS, unitPrefixExactScale, getUnitPrefix, } from '@danielsimonjr/mathts-core';
13
- export type { Dimensions, UnitDef, SiDimensionVector, SiDimensionOptions, ExactScale, IrrationalName, IrrationalPowers, UnitRow, UnitBaseKey, UnitPrefixSetKey, UnitPrefix, } from '@danielsimonjr/mathts-core';
13
+ export type { Dimensions, UnitDef, SiDimensionVector, SiDimensionOptions, SiDimensionExponent, ExactScale, IrrationalName, IrrationalPowers, UnitRow, UnitBaseKey, UnitPrefixSetKey, UnitPrefix, } from '@danielsimonjr/mathts-core';
14
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,IAAI,EACJ,MAAM,EACN,WAAW,EACX,sBAAsB,EACtB,cAAc,EACd,aAAa,EACb,GAAG,EACH,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,qBAAqB,EACrB,UAAU,EACV,aAAa,EACb,SAAS,EACT,YAAY,EACZ,UAAU,EACV,WAAW,EACX,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,0BAA0B,EAC1B,yBAAyB,EACzB,gBAAgB,EAChB,mBAAmB,EACnB,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,GACd,MAAM,4BAA4B,CAAC;AAEpC,YAAY,EACV,UAAU,EACV,OAAO,EACP,iBAAiB,EACjB,kBAAkB,EAClB,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,OAAO,EACP,WAAW,EACX,gBAAgB,EAChB,UAAU,GACX,MAAM,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,IAAI,EACJ,MAAM,EACN,WAAW,EACX,sBAAsB,EACtB,cAAc,EACd,aAAa,EACb,GAAG,EACH,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,qBAAqB,EACrB,UAAU,EACV,aAAa,EACb,SAAS,EACT,YAAY,EACZ,UAAU,EACV,WAAW,EACX,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,0BAA0B,EAC1B,yBAAyB,EACzB,gBAAgB,EAChB,mBAAmB,EACnB,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,GACd,MAAM,4BAA4B,CAAC;AAEpC,YAAY,EACV,UAAU,EACV,OAAO,EACP,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,OAAO,EACP,WAAW,EACX,gBAAgB,EAChB,UAAU,GACX,MAAM,4BAA4B,CAAC"}
package/dist/index.js CHANGED
@@ -1,113 +1 @@
1
- // src/index.ts
2
- import {
3
- Unit,
4
- isUnit,
5
- isUnitValue,
6
- DimensionMismatchError,
7
- UnitParseError,
8
- DIMENSIONLESS,
9
- dim,
10
- UNIT_DIMENSION_LENGTH,
11
- SI_DIMENSION_LENGTH,
12
- toSiDimensions,
13
- toSiDimensionVector,
14
- fromSiDimensions,
15
- fromSiDimensionVector,
16
- BASE_UNITS,
17
- DERIVED_UNITS,
18
- ALL_UNITS,
19
- UNIT_ALIASES,
20
- getUnitDef,
21
- SI_PREFIXES,
22
- BEST_PREFIXES,
23
- getPrefix,
24
- UNIT_EXACT_SCALE,
25
- PI_EXACT_SCALE,
26
- LN2_EXACT_SCALE,
27
- NAMED_IRRATIONALS,
28
- namedIrrationalScale,
29
- irrationalPower,
30
- isRationalScale,
31
- decimalExactScale,
32
- exactScaleOf,
33
- binaryExactScale,
34
- ratioExactScale,
35
- multiplyExactScales,
36
- divideExactScales,
37
- powerExactScale,
38
- addExactScales,
39
- exactScalesEqual,
40
- exactScaleToNumber,
41
- clearExactScaleNumberCache,
42
- exactScaleNumberCacheSize,
43
- formatExactScale,
44
- readScaleExpression,
45
- NAMED_SCALES,
46
- UNIT_ROWS,
47
- UNIT_ROW_ALIASES,
48
- namedExactScale,
49
- readUnitScale,
50
- getUnitRow,
51
- unitRowExactScale,
52
- unitRowValue,
53
- unitRowExactOffset,
54
- UNIT_PREFIX_SETS,
55
- unitPrefixExactScale,
56
- getUnitPrefix
57
- } from "@danielsimonjr/mathts-core";
58
- export {
59
- ALL_UNITS,
60
- BASE_UNITS,
61
- BEST_PREFIXES,
62
- DERIVED_UNITS,
63
- DIMENSIONLESS,
64
- DimensionMismatchError,
65
- LN2_EXACT_SCALE,
66
- NAMED_IRRATIONALS,
67
- NAMED_SCALES,
68
- PI_EXACT_SCALE,
69
- SI_DIMENSION_LENGTH,
70
- SI_PREFIXES,
71
- UNIT_ALIASES,
72
- UNIT_DIMENSION_LENGTH,
73
- UNIT_EXACT_SCALE,
74
- UNIT_PREFIX_SETS,
75
- UNIT_ROWS,
76
- UNIT_ROW_ALIASES,
77
- Unit,
78
- UnitParseError,
79
- addExactScales,
80
- binaryExactScale,
81
- clearExactScaleNumberCache,
82
- decimalExactScale,
83
- dim,
84
- divideExactScales,
85
- exactScaleNumberCacheSize,
86
- exactScaleOf,
87
- exactScaleToNumber,
88
- exactScalesEqual,
89
- formatExactScale,
90
- fromSiDimensionVector,
91
- fromSiDimensions,
92
- getPrefix,
93
- getUnitDef,
94
- getUnitPrefix,
95
- getUnitRow,
96
- irrationalPower,
97
- isRationalScale,
98
- isUnit,
99
- isUnitValue,
100
- multiplyExactScales,
101
- namedExactScale,
102
- namedIrrationalScale,
103
- powerExactScale,
104
- ratioExactScale,
105
- readScaleExpression,
106
- readUnitScale,
107
- toSiDimensionVector,
108
- toSiDimensions,
109
- unitPrefixExactScale,
110
- unitRowExactOffset,
111
- unitRowExactScale,
112
- unitRowValue
113
- };
1
+ export { ALL_UNITS, BASE_UNITS, BEST_PREFIXES, DERIVED_UNITS, DIMENSIONLESS, DimensionMismatchError, LN2_EXACT_SCALE, NAMED_IRRATIONALS, NAMED_SCALES, PI_EXACT_SCALE, SI_DIMENSION_LENGTH, SI_PREFIXES, UNIT_ALIASES, UNIT_DIMENSION_LENGTH, UNIT_EXACT_SCALE, UNIT_PREFIX_SETS, UNIT_ROWS, UNIT_ROW_ALIASES, Unit, UnitParseError, addExactScales, binaryExactScale, clearExactScaleNumberCache, decimalExactScale, dim, divideExactScales, exactScaleNumberCacheSize, exactScaleOf, exactScaleToNumber, exactScalesEqual, formatExactScale, fromSiDimensionVector, fromSiDimensions, getPrefix, getUnitDef, getUnitPrefix, getUnitRow, irrationalPower, isRationalScale, isUnit, isUnitValue, multiplyExactScales, namedExactScale, namedIrrationalScale, powerExactScale, ratioExactScale, readScaleExpression, readUnitScale, toSiDimensionVector, toSiDimensions, unitPrefixExactScale, unitRowExactOffset, unitRowExactScale, unitRowValue } from "@danielsimonjr/mathts-core";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danielsimonjr/mathts-units",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "Standalone units & dimensional-analysis for MathTS -- the Unit class, unit registry, and SI prefixes, re-exported as a focused package",
5
5
  "author": "Daniel Simon Jr.",
6
6
  "license": "MIT",
@@ -19,8 +19,8 @@
19
19
  "README.md"
20
20
  ],
21
21
  "scripts": {
22
- "build": "tsup src/index.ts --format esm --clean && tsc -p tsconfig.dts.json",
23
- "dev": "tsup src/index.ts --format esm --watch --onSuccess \"tsc -p tsconfig.dts.json\"",
22
+ "build": "tsdown src/index.ts --format esm && tsc -p tsconfig.dts.json",
23
+ "dev": "tsdown src/index.ts --format esm --watch --on-success \"tsc -p tsconfig.dts.json\"",
24
24
  "test": "bun test",
25
25
  "test:watch": "vitest",
26
26
  "test:coverage": "bun test --coverage",
@@ -28,15 +28,25 @@
28
28
  "lint": "oxlint src",
29
29
  "lint:fix": "oxlint src --fix",
30
30
  "clean": "rm -rf dist",
31
- "build:prod": "tsup src/index.ts --format esm --clean --minify --treeshake && tsc -p tsconfig.dts.json"
31
+ "build:prod": "tsdown src/index.ts --format esm --minify && tsc -p tsconfig.dts.json"
32
+ },
33
+ "tsdown": {
34
+ "fixedExtension": false,
35
+ "dts": false,
36
+ "outputOptions": {
37
+ "comments": {
38
+ "legal": true,
39
+ "annotation": true,
40
+ "jsdoc": false
41
+ }
42
+ }
32
43
  },
33
44
  "dependencies": {
34
- "@danielsimonjr/mathts-core": "^0.18.0",
35
- "typed-function": "^4.0.0"
45
+ "@danielsimonjr/mathts-core": "^0.20.0"
36
46
  },
37
47
  "devDependencies": {
38
48
  "@types/node": "^26.4.0",
39
- "tsup": "^8.0.0",
49
+ "tsdown": "^0.23.0",
40
50
  "typescript": "^7.0.2",
41
51
  "vitest": "^5.0.0"
42
52
  },