@chenglou/freerange 0.0.3 → 0.0.4
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/CHANGELOG.md +7 -1
- package/README.md +3 -1
- package/dist/fr.js +356 -359
- package/package.json +1 -1
- package/src/audit.ts +0 -2
- package/src/ir/program.ts +0 -3
- package/src/lower/context.ts +3 -0
- package/src/lower/expression.ts +45 -55
- package/src/lower/module.ts +8 -5
- package/src/lower/numeric-intersection.ts +15 -0
- package/src/lower/platform.ts +25 -12
- package/src/lower/program.ts +6 -9
- package/src/lower/statements.ts +2 -10
- package/src/project.ts +1 -1
- package/src/report/index.ts +0 -2
- package/src/typescript/check.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,12 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.0.4 - 2026-07-31
|
|
6
|
+
|
|
7
|
+
- Allow `Date.now()` to represent dates before the Unix epoch.
|
|
8
|
+
- Support numeric phantom types (#6).
|
|
9
|
+
- Only recognize `Math`, `Number`, `Infinity`, parser functions, and browser globals when they resolve to TypeScript's standard libraries.
|
|
10
|
+
|
|
5
11
|
## 0.0.3 - 2026-07-28
|
|
6
12
|
|
|
7
13
|
- Analyze arrow functions and function expressions assigned directly to top-level `const` names.
|
|
8
14
|
- Preserve type narrowing through `&&` and `||` expressions.
|
|
9
15
|
- Analyze each `Math.random()` call as a fresh number from zero up to, but not including, one.
|
|
10
|
-
- Avoid quadratic work when tracking values through deep chains of same-file function calls.
|
|
16
|
+
- Avoid quadratic work when tracking values through deep chains of same-file function calls (#3).
|
|
11
17
|
- Consolidate analysis limits and practical refactoring examples in the README.
|
|
12
18
|
|
|
13
19
|
## 0.0.2 - 2026-07-21
|
package/README.md
CHANGED
|
@@ -134,6 +134,8 @@ Before changing an input rule, decide what the application should do. If `column
|
|
|
134
134
|
|
|
135
135
|
For each `number`, Freerange remembers its lowest and highest possible values, whether it is an integer, whether it may be `NaN` or infinite, and at most one exact value that has been ruled out. It reasons about JavaScript floating-point numbers rather than ideal real numbers and does not use a general-purpose theorem prover.
|
|
136
136
|
|
|
137
|
+
Freerange also supports numeric phantom types, e.g. `type Pixels = number & {readonly __brand: 'pixels'}`.
|
|
138
|
+
|
|
137
139
|
#### No common-subexpression elimination
|
|
138
140
|
|
|
139
141
|
Freerange does not replace repeated calculations with one stored result, even when their source code is identical. This function checks one subtraction, then divides by a newly evaluated subtraction:
|
|
@@ -285,7 +287,7 @@ export function labelWidthFromMeasurement(measuredWidth: number): number {
|
|
|
285
287
|
}
|
|
286
288
|
```
|
|
287
289
|
|
|
288
|
-
An unsupported caller can pass `measureText(text)` into this helper, allowing Freerange to verify the rule but not the imported measurement. Imported constants work when their initializer resolves to a numeric literal such as `export const GAP = 24`.
|
|
290
|
+
An unsupported caller can pass `measureText(text)` into this helper, allowing Freerange to verify the rule but not the imported measurement. Imported constants work when their initializer resolves to a numeric literal such as `export const GAP = 24`. Runtime import cycles are outside Freerange's scope: an imported module must finish initializing before analyzed code reads its values. Type-only import cycles are fine.
|
|
289
291
|
|
|
290
292
|
#### No higher-order function analysis
|
|
291
293
|
|