Skip to content

Commit ef93be4

Browse files
committed
Fix build files from npm package rename
1 parent 94fa8f7 commit ef93be4

16 files changed

Lines changed: 83 additions & 21 deletions

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [1.0.2] - 2026-07-14
6+
7+
### Fixed
8+
- Published `observite-js/react` build files no longer import from the old `observite` package name at runtime; they now correctly import from `observite-js` (fixes module-resolution failures in consuming projects)
9+
- Type declarations for `observite-js/react` now import types from `observite-js`
10+
- `areEqual` no longer treats distinct `Date` or `RegExp` instances as equal (fix was previously in source but missing from the published build)
11+
512
## [1.0.1] - 2026-02-24
613

714
### Changed

lib/observite-react.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
'use strict';
99

1010
var react = require('react');
11-
var observite = require('observite');
11+
var observite = require('observite-js');
1212

1313
/**
1414
* Copyright (c) Meta Platforms, Inc. and affiliates.

lib/observite-react.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* Hand-written type declarations for observite/react.
8-
* This file imports types from 'observite' instead of bundling them,
7+
* Hand-written type declarations for observite-js/react.
8+
* This file imports types from 'observite-js' instead of bundling them,
99
* which ensures type compatibility when using both packages together.
1010
*/
1111

12-
import type { ComponentObserver } from 'observite';
12+
import type { ComponentObserver } from 'observite-js';
1313

1414
/**
1515
* Used in React components to create an observer for subscribing to

lib/observite-react.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
'use strict';
99

1010
var react = require('react');
11-
var observite = require('observite');
11+
var observite = require('observite-js');
1212

1313
/**
1414
* Copyright (c) Meta Platforms, Inc. and affiliates.

lib/observite-react.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
import { useRef, useReducer, useEffect } from 'react';
9-
import { ComponentObserver } from 'observite';
9+
import { ComponentObserver } from 'observite-js';
1010

1111
/**
1212
* Copyright (c) Meta Platforms, Inc. and affiliates.

lib/observite.cjs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,22 @@ function areEqual(a, b, method) {
8585
if (a == null || b == null) {
8686
return false;
8787
}
88+
// Compare Dates by their time value. Without this, two Date instances fall
89+
// through to the object branch below, where Object.keys() is empty for both,
90+
// so any two Dates would incorrectly be considered equal.
91+
if (a instanceof Date !== b instanceof Date) {
92+
return false;
93+
}
94+
if (a instanceof Date && b instanceof Date) {
95+
return a.getTime() === b.getTime();
96+
}
97+
// Compare RegExps by their source and flags, for the same reason as Dates.
98+
if (a instanceof RegExp !== b instanceof RegExp) {
99+
return false;
100+
}
101+
if (a instanceof RegExp && b instanceof RegExp) {
102+
return a.source === b.source && a.flags === b.flags;
103+
}
88104
// Compare Maps
89105
if (a instanceof Map !== b instanceof Map) {
90106
return false;

lib/observite.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,22 @@ function areEqual(a, b, method) {
8585
if (a == null || b == null) {
8686
return false;
8787
}
88+
// Compare Dates by their time value. Without this, two Date instances fall
89+
// through to the object branch below, where Object.keys() is empty for both,
90+
// so any two Dates would incorrectly be considered equal.
91+
if (a instanceof Date !== b instanceof Date) {
92+
return false;
93+
}
94+
if (a instanceof Date && b instanceof Date) {
95+
return a.getTime() === b.getTime();
96+
}
97+
// Compare RegExps by their source and flags, for the same reason as Dates.
98+
if (a instanceof RegExp !== b instanceof RegExp) {
99+
return false;
100+
}
101+
if (a instanceof RegExp && b instanceof RegExp) {
102+
return a.source === b.source && a.flags === b.flags;
103+
}
88104
// Compare Maps
89105
if (a instanceof Map !== b instanceof Map) {
90106
return false;

lib/observite.mjs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,22 @@ function areEqual(a, b, method) {
8383
if (a == null || b == null) {
8484
return false;
8585
}
86+
// Compare Dates by their time value. Without this, two Date instances fall
87+
// through to the object branch below, where Object.keys() is empty for both,
88+
// so any two Dates would incorrectly be considered equal.
89+
if (a instanceof Date !== b instanceof Date) {
90+
return false;
91+
}
92+
if (a instanceof Date && b instanceof Date) {
93+
return a.getTime() === b.getTime();
94+
}
95+
// Compare RegExps by their source and flags, for the same reason as Dates.
96+
if (a instanceof RegExp !== b instanceof RegExp) {
97+
return false;
98+
}
99+
if (a instanceof RegExp && b instanceof RegExp) {
100+
return a.source === b.source && a.flags === b.flags;
101+
}
86102
// Compare Maps
87103
if (a instanceof Map !== b instanceof Map) {
88104
return false;

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)