fast-equals 5.2.1-beta.0 → 5.2.2-beta.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/CHANGELOG.md +6 -0
- package/dist/cjs/types/comparator.d.ts +1 -1
- package/dist/cjs/types/equals.d.ts +2 -2
- package/dist/cjs/types/index.d.ts +3 -3
- package/dist/cjs/types/utils.d.ts +1 -1
- package/dist/esm/types/comparator.d.ts +1 -1
- package/dist/esm/types/equals.d.ts +2 -2
- package/dist/esm/types/index.d.ts +3 -3
- package/dist/esm/types/utils.d.ts +1 -1
- package/dist/min/types/comparator.d.ts +1 -1
- package/dist/min/types/equals.d.ts +2 -2
- package/dist/min/types/index.d.ts +3 -3
- package/dist/min/types/utils.d.ts +1 -1
- package/dist/umd/types/comparator.d.ts +1 -1
- package/dist/umd/types/equals.d.ts +2 -2
- package/dist/umd/types/index.d.ts +3 -3
- package/dist/umd/types/utils.d.ts +1 -1
- package/package.json +3 -2
- package/scripts/apply-type-file-extensions.mjs +33 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComparatorConfig, CreateState, CustomEqualCreatorOptions, EqualityComparator, InternalEqualityComparator } from './internalTypes';
|
|
1
|
+
import type { ComparatorConfig, CreateState, CustomEqualCreatorOptions, EqualityComparator, InternalEqualityComparator } from './internalTypes.d.ts';
|
|
2
2
|
interface CreateIsEqualOptions<Meta> {
|
|
3
3
|
circular: boolean;
|
|
4
4
|
comparator: EqualityComparator<Meta>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { sameValueZeroEqual } from './utils';
|
|
2
|
-
import type { Dictionary, PrimitiveWrapper, State, TypedArray } from './internalTypes';
|
|
1
|
+
import { sameValueZeroEqual } from './utils.ts';
|
|
2
|
+
import type { Dictionary, PrimitiveWrapper, State, TypedArray } from './internalTypes.d.ts';
|
|
3
3
|
/**
|
|
4
4
|
* Whether the arrays are equal in value.
|
|
5
5
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { CustomEqualCreatorOptions } from './internalTypes';
|
|
2
|
-
import { sameValueZeroEqual } from './utils';
|
|
1
|
+
import type { CustomEqualCreatorOptions } from './internalTypes.d.ts';
|
|
2
|
+
import { sameValueZeroEqual } from './utils.ts';
|
|
3
3
|
export { sameValueZeroEqual };
|
|
4
|
-
export type { AnyEqualityComparator, Cache, CircularState, ComparatorConfig, CreateCustomComparatorConfig, CreateState, CustomEqualCreatorOptions, DefaultState, Dictionary, EqualityComparator, EqualityComparatorCreator, InternalEqualityComparator, PrimitiveWrapper, State, TypeEqualityComparator, TypedArray, } from './internalTypes';
|
|
4
|
+
export type { AnyEqualityComparator, Cache, CircularState, ComparatorConfig, CreateCustomComparatorConfig, CreateState, CustomEqualCreatorOptions, DefaultState, Dictionary, EqualityComparator, EqualityComparatorCreator, InternalEqualityComparator, PrimitiveWrapper, State, TypeEqualityComparator, TypedArray, } from './internalTypes.d.ts';
|
|
5
5
|
/**
|
|
6
6
|
* Whether the items passed are deeply-equal in value.
|
|
7
7
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AnyEqualityComparator, Dictionary, State, TypeEqualityComparator } from './internalTypes';
|
|
1
|
+
import type { AnyEqualityComparator, Dictionary, State, TypeEqualityComparator } from './internalTypes.d.ts';
|
|
2
2
|
/**
|
|
3
3
|
* Combine two comparators into a single comparators.
|
|
4
4
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComparatorConfig, CreateState, CustomEqualCreatorOptions, EqualityComparator, InternalEqualityComparator } from './internalTypes';
|
|
1
|
+
import type { ComparatorConfig, CreateState, CustomEqualCreatorOptions, EqualityComparator, InternalEqualityComparator } from './internalTypes.d.ts';
|
|
2
2
|
interface CreateIsEqualOptions<Meta> {
|
|
3
3
|
circular: boolean;
|
|
4
4
|
comparator: EqualityComparator<Meta>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { sameValueZeroEqual } from './utils';
|
|
2
|
-
import type { Dictionary, PrimitiveWrapper, State, TypedArray } from './internalTypes';
|
|
1
|
+
import { sameValueZeroEqual } from './utils.ts';
|
|
2
|
+
import type { Dictionary, PrimitiveWrapper, State, TypedArray } from './internalTypes.d.ts';
|
|
3
3
|
/**
|
|
4
4
|
* Whether the arrays are equal in value.
|
|
5
5
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { CustomEqualCreatorOptions } from './internalTypes';
|
|
2
|
-
import { sameValueZeroEqual } from './utils';
|
|
1
|
+
import type { CustomEqualCreatorOptions } from './internalTypes.d.ts';
|
|
2
|
+
import { sameValueZeroEqual } from './utils.ts';
|
|
3
3
|
export { sameValueZeroEqual };
|
|
4
|
-
export type { AnyEqualityComparator, Cache, CircularState, ComparatorConfig, CreateCustomComparatorConfig, CreateState, CustomEqualCreatorOptions, DefaultState, Dictionary, EqualityComparator, EqualityComparatorCreator, InternalEqualityComparator, PrimitiveWrapper, State, TypeEqualityComparator, TypedArray, } from './internalTypes';
|
|
4
|
+
export type { AnyEqualityComparator, Cache, CircularState, ComparatorConfig, CreateCustomComparatorConfig, CreateState, CustomEqualCreatorOptions, DefaultState, Dictionary, EqualityComparator, EqualityComparatorCreator, InternalEqualityComparator, PrimitiveWrapper, State, TypeEqualityComparator, TypedArray, } from './internalTypes.d.ts';
|
|
5
5
|
/**
|
|
6
6
|
* Whether the items passed are deeply-equal in value.
|
|
7
7
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AnyEqualityComparator, Dictionary, State, TypeEqualityComparator } from './internalTypes';
|
|
1
|
+
import type { AnyEqualityComparator, Dictionary, State, TypeEqualityComparator } from './internalTypes.d.ts';
|
|
2
2
|
/**
|
|
3
3
|
* Combine two comparators into a single comparators.
|
|
4
4
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComparatorConfig, CreateState, CustomEqualCreatorOptions, EqualityComparator, InternalEqualityComparator } from './internalTypes';
|
|
1
|
+
import type { ComparatorConfig, CreateState, CustomEqualCreatorOptions, EqualityComparator, InternalEqualityComparator } from './internalTypes.d.ts';
|
|
2
2
|
interface CreateIsEqualOptions<Meta> {
|
|
3
3
|
circular: boolean;
|
|
4
4
|
comparator: EqualityComparator<Meta>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { sameValueZeroEqual } from './utils';
|
|
2
|
-
import type { Dictionary, PrimitiveWrapper, State, TypedArray } from './internalTypes';
|
|
1
|
+
import { sameValueZeroEqual } from './utils.ts';
|
|
2
|
+
import type { Dictionary, PrimitiveWrapper, State, TypedArray } from './internalTypes.d.ts';
|
|
3
3
|
/**
|
|
4
4
|
* Whether the arrays are equal in value.
|
|
5
5
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { CustomEqualCreatorOptions } from './internalTypes';
|
|
2
|
-
import { sameValueZeroEqual } from './utils';
|
|
1
|
+
import type { CustomEqualCreatorOptions } from './internalTypes.d.ts';
|
|
2
|
+
import { sameValueZeroEqual } from './utils.ts';
|
|
3
3
|
export { sameValueZeroEqual };
|
|
4
|
-
export type { AnyEqualityComparator, Cache, CircularState, ComparatorConfig, CreateCustomComparatorConfig, CreateState, CustomEqualCreatorOptions, DefaultState, Dictionary, EqualityComparator, EqualityComparatorCreator, InternalEqualityComparator, PrimitiveWrapper, State, TypeEqualityComparator, TypedArray, } from './internalTypes';
|
|
4
|
+
export type { AnyEqualityComparator, Cache, CircularState, ComparatorConfig, CreateCustomComparatorConfig, CreateState, CustomEqualCreatorOptions, DefaultState, Dictionary, EqualityComparator, EqualityComparatorCreator, InternalEqualityComparator, PrimitiveWrapper, State, TypeEqualityComparator, TypedArray, } from './internalTypes.d.ts';
|
|
5
5
|
/**
|
|
6
6
|
* Whether the items passed are deeply-equal in value.
|
|
7
7
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AnyEqualityComparator, Dictionary, State, TypeEqualityComparator } from './internalTypes';
|
|
1
|
+
import type { AnyEqualityComparator, Dictionary, State, TypeEqualityComparator } from './internalTypes.d.ts';
|
|
2
2
|
/**
|
|
3
3
|
* Combine two comparators into a single comparators.
|
|
4
4
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComparatorConfig, CreateState, CustomEqualCreatorOptions, EqualityComparator, InternalEqualityComparator } from './internalTypes';
|
|
1
|
+
import type { ComparatorConfig, CreateState, CustomEqualCreatorOptions, EqualityComparator, InternalEqualityComparator } from './internalTypes.d.ts';
|
|
2
2
|
interface CreateIsEqualOptions<Meta> {
|
|
3
3
|
circular: boolean;
|
|
4
4
|
comparator: EqualityComparator<Meta>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { sameValueZeroEqual } from './utils';
|
|
2
|
-
import type { Dictionary, PrimitiveWrapper, State, TypedArray } from './internalTypes';
|
|
1
|
+
import { sameValueZeroEqual } from './utils.ts';
|
|
2
|
+
import type { Dictionary, PrimitiveWrapper, State, TypedArray } from './internalTypes.d.ts';
|
|
3
3
|
/**
|
|
4
4
|
* Whether the arrays are equal in value.
|
|
5
5
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { CustomEqualCreatorOptions } from './internalTypes';
|
|
2
|
-
import { sameValueZeroEqual } from './utils';
|
|
1
|
+
import type { CustomEqualCreatorOptions } from './internalTypes.d.ts';
|
|
2
|
+
import { sameValueZeroEqual } from './utils.ts';
|
|
3
3
|
export { sameValueZeroEqual };
|
|
4
|
-
export type { AnyEqualityComparator, Cache, CircularState, ComparatorConfig, CreateCustomComparatorConfig, CreateState, CustomEqualCreatorOptions, DefaultState, Dictionary, EqualityComparator, EqualityComparatorCreator, InternalEqualityComparator, PrimitiveWrapper, State, TypeEqualityComparator, TypedArray, } from './internalTypes';
|
|
4
|
+
export type { AnyEqualityComparator, Cache, CircularState, ComparatorConfig, CreateCustomComparatorConfig, CreateState, CustomEqualCreatorOptions, DefaultState, Dictionary, EqualityComparator, EqualityComparatorCreator, InternalEqualityComparator, PrimitiveWrapper, State, TypeEqualityComparator, TypedArray, } from './internalTypes.d.ts';
|
|
5
5
|
/**
|
|
6
6
|
* Whether the items passed are deeply-equal in value.
|
|
7
7
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AnyEqualityComparator, Dictionary, State, TypeEqualityComparator } from './internalTypes';
|
|
1
|
+
import type { AnyEqualityComparator, Dictionary, State, TypeEqualityComparator } from './internalTypes.d.ts';
|
|
2
2
|
/**
|
|
3
3
|
* Combine two comparators into a single comparators.
|
|
4
4
|
*/
|
package/package.json
CHANGED
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"eslint-friendly-formatter": "^4.0.1",
|
|
28
28
|
"eslint-webpack-plugin": "^4.0.0",
|
|
29
29
|
"fast-deep-equal": "^3.1.3",
|
|
30
|
+
"fast-glob": "^3.3.3",
|
|
30
31
|
"html-webpack-plugin": "^5.5.0",
|
|
31
32
|
"in-publish": "^2.0.0",
|
|
32
33
|
"jest": "^29.5.0",
|
|
@@ -91,7 +92,7 @@
|
|
|
91
92
|
"build:cjs": "rm -rf dist/cjs && NODE_ENV=production rollup -c config/rollup/config.cjs.js && tsc -p ./config/tsconfig/cjs.json",
|
|
92
93
|
"build:esm": "rm -rf dist/esm && NODE_ENV=production rollup -c config/rollup/config.esm.js && tsc -p ./config/tsconfig/esm.json",
|
|
93
94
|
"build:min": "rm -rf dist/min && NODE_ENV=production rollup -c config/rollup/config.min.js && tsc -p ./config/tsconfig/min.json",
|
|
94
|
-
"build:types": "node scripts/fallback-types.mjs",
|
|
95
|
+
"build:types": "node scripts/fallback-types.mjs && node scripts/apply-type-file-extensions.mjs",
|
|
95
96
|
"build:umd": "rm -rf dist/umd && NODE_ENV=production rollup -c config/rollup/config.umd.js && tsc -p ./config/tsconfig/umd.json",
|
|
96
97
|
"dev": "NODE_ENV=development webpack serve --progress --config=config/webpack.config.js",
|
|
97
98
|
"format": "prettier **/*.ts --write",
|
|
@@ -109,5 +110,5 @@
|
|
|
109
110
|
"sideEffects": false,
|
|
110
111
|
"type": "module",
|
|
111
112
|
"types": "./index.d.ts",
|
|
112
|
-
"version": "5.2.
|
|
113
|
+
"version": "5.2.2-beta.0"
|
|
113
114
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import glob from 'fast-glob';
|
|
2
|
+
import { readFileSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
|
|
5
|
+
const IMPORT_STATEMENT_REGEXP =
|
|
6
|
+
/import([ \n\t]*(?:[^ \n\t\{\}]+[ \n\t]*,?)?(?:[ \n\t]*\{(?:[ \n\t]*[^ \n\t"'\{\}]+[ \n\t]*,?)+\})?[ \n\t]*)from[ \n\t]*(['"])([^'"\n]+)(?:['"])/g;
|
|
7
|
+
|
|
8
|
+
const EXPORT_STATEMENT_REGEXP =
|
|
9
|
+
/export([ \n\t]*(?:[^ \n\t\{\}]+[ \n\t]*,?)?(?:[ \n\t]*\{(?:[ \n\t]*[^ \n\t"'\{\}]+[ \n\t]*,?)+\})?[ \n\t]*)from[ \n\t]*(['"])([^'"\n]+)(?:['"])/g;
|
|
10
|
+
|
|
11
|
+
const files = glob.sync(
|
|
12
|
+
join(import.meta.dirname, '..', 'dist', '*', 'types', '*.d.ts'),
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
function getReplacement(type) {
|
|
16
|
+
return function (line, dependencies, _quoteType, location) {
|
|
17
|
+
const extension = line.startsWith(`${type} type`) ? 'd.ts' : 'ts';
|
|
18
|
+
|
|
19
|
+
return `${type}${dependencies}from '${location}.${extension}'`;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function getReplacedContents(contents) {
|
|
24
|
+
return contents
|
|
25
|
+
.replaceAll(IMPORT_STATEMENT_REGEXP, getReplacement('import'))
|
|
26
|
+
.replaceAll(EXPORT_STATEMENT_REGEXP, getReplacement('export'));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
for (const file of files) {
|
|
30
|
+
const contents = readFileSync(file, 'utf-8');
|
|
31
|
+
|
|
32
|
+
writeFileSync(file, getReplacedContents(contents), 'utf-8');
|
|
33
|
+
}
|