fast-equals 5.2.2 → 5.2.3-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/.yarn/install-state.gz +0 -0
- package/.yarnrc.yml +1 -0
- package/dist/cjs/types/{comparator.d.ts → comparator.d.cts} +1 -1
- package/dist/{esm/types/equals.d.ts → cjs/types/equals.d.cts} +2 -2
- package/dist/cjs/types/{index.d.ts → index.d.cts} +3 -3
- package/dist/{esm/types/utils.d.ts → cjs/types/utils.d.cts} +1 -1
- package/dist/esm/types/{comparator.d.ts → comparator.d.mts} +1 -1
- package/dist/{cjs/types/equals.d.ts → esm/types/equals.d.mts} +2 -2
- package/dist/esm/types/{index.d.ts → index.d.mts} +3 -3
- package/dist/{cjs/types/utils.d.ts → esm/types/utils.d.mts} +1 -1
- package/dist/min/types/equals.d.ts +1 -1
- package/dist/min/types/index.d.ts +1 -1
- package/dist/umd/types/equals.d.ts +1 -1
- package/dist/umd/types/index.d.ts +1 -1
- package/package.json +4 -4
- package/scripts/apply-type-file-extensions.mjs +32 -12
- /package/dist/cjs/types/{internalTypes.d.ts → internalTypes.d.cts} +0 -0
- /package/dist/esm/types/{internalTypes.d.ts → internalTypes.d.mts} +0 -0
|
Binary file
|
package/.yarnrc.yml
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
nodeLinker: node-modules
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComparatorConfig, CreateState, CustomEqualCreatorOptions, EqualityComparator, InternalEqualityComparator } from './internalTypes.d.
|
|
1
|
+
import type { ComparatorConfig, CreateState, CustomEqualCreatorOptions, EqualityComparator, InternalEqualityComparator } from './internalTypes.d.cts';
|
|
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.d.
|
|
1
|
+
import { sameValueZeroEqual } from './utils.d.cts';
|
|
2
|
+
import type { Dictionary, PrimitiveWrapper, State, TypedArray } from './internalTypes.d.cts';
|
|
3
3
|
/**
|
|
4
4
|
* Whether the arrays are equal in value.
|
|
5
5
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { CustomEqualCreatorOptions } from './internalTypes.d.
|
|
2
|
-
import { sameValueZeroEqual } from './utils.
|
|
1
|
+
import type { CustomEqualCreatorOptions } from './internalTypes.d.cts';
|
|
2
|
+
import { sameValueZeroEqual } from './utils.d.cts';
|
|
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.d.
|
|
4
|
+
export type { AnyEqualityComparator, Cache, CircularState, ComparatorConfig, CreateCustomComparatorConfig, CreateState, CustomEqualCreatorOptions, DefaultState, Dictionary, EqualityComparator, EqualityComparatorCreator, InternalEqualityComparator, PrimitiveWrapper, State, TypeEqualityComparator, TypedArray, } from './internalTypes.d.cts';
|
|
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.d.
|
|
1
|
+
import type { AnyEqualityComparator, Dictionary, State, TypeEqualityComparator } from './internalTypes.d.cts';
|
|
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.d.
|
|
1
|
+
import type { ComparatorConfig, CreateState, CustomEqualCreatorOptions, EqualityComparator, InternalEqualityComparator } from './internalTypes.d.mts';
|
|
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.d.
|
|
1
|
+
import { sameValueZeroEqual } from './utils.d.mts';
|
|
2
|
+
import type { Dictionary, PrimitiveWrapper, State, TypedArray } from './internalTypes.d.mts';
|
|
3
3
|
/**
|
|
4
4
|
* Whether the arrays are equal in value.
|
|
5
5
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { CustomEqualCreatorOptions } from './internalTypes.d.
|
|
2
|
-
import { sameValueZeroEqual } from './utils.
|
|
1
|
+
import type { CustomEqualCreatorOptions } from './internalTypes.d.mts';
|
|
2
|
+
import { sameValueZeroEqual } from './utils.d.mts';
|
|
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.d.
|
|
4
|
+
export type { AnyEqualityComparator, Cache, CircularState, ComparatorConfig, CreateCustomComparatorConfig, CreateState, CustomEqualCreatorOptions, DefaultState, Dictionary, EqualityComparator, EqualityComparatorCreator, InternalEqualityComparator, PrimitiveWrapper, State, TypeEqualityComparator, TypedArray, } from './internalTypes.d.mts';
|
|
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.d.
|
|
1
|
+
import type { AnyEqualityComparator, Dictionary, State, TypeEqualityComparator } from './internalTypes.d.mts';
|
|
2
2
|
/**
|
|
3
3
|
* Combine two comparators into a single comparators.
|
|
4
4
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CustomEqualCreatorOptions } from './internalTypes.d.ts';
|
|
2
|
-
import { sameValueZeroEqual } from './utils.ts';
|
|
2
|
+
import { sameValueZeroEqual } from './utils.d.ts';
|
|
3
3
|
export { sameValueZeroEqual };
|
|
4
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
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CustomEqualCreatorOptions } from './internalTypes.d.ts';
|
|
2
|
-
import { sameValueZeroEqual } from './utils.ts';
|
|
2
|
+
import { sameValueZeroEqual } from './utils.d.ts';
|
|
3
3
|
export { sameValueZeroEqual };
|
|
4
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
|
/**
|
package/package.json
CHANGED
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"underscore": "^1.13.4",
|
|
50
50
|
"webpack": "^5.76.2",
|
|
51
51
|
"webpack-cli": "^5.1.4",
|
|
52
|
-
"webpack-dev-server": "^
|
|
52
|
+
"webpack-dev-server": "^5.2.1"
|
|
53
53
|
},
|
|
54
54
|
"engines": {
|
|
55
55
|
"node": ">=6.0.0"
|
|
@@ -57,11 +57,11 @@
|
|
|
57
57
|
"exports": {
|
|
58
58
|
".": {
|
|
59
59
|
"import": {
|
|
60
|
-
"types": "./dist/esm/types/index.d.
|
|
60
|
+
"types": "./dist/esm/types/index.d.mts",
|
|
61
61
|
"default": "./dist/esm/index.mjs"
|
|
62
62
|
},
|
|
63
63
|
"require": {
|
|
64
|
-
"types": "./dist/cjs/types/index.d.
|
|
64
|
+
"types": "./dist/cjs/types/index.d.cts",
|
|
65
65
|
"default": "./dist/cjs/index.cjs"
|
|
66
66
|
},
|
|
67
67
|
"default": {
|
|
@@ -110,5 +110,5 @@
|
|
|
110
110
|
"sideEffects": false,
|
|
111
111
|
"type": "module",
|
|
112
112
|
"types": "./index.d.ts",
|
|
113
|
-
"version": "5.2.
|
|
113
|
+
"version": "5.2.3-beta.0"
|
|
114
114
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import glob from 'fast-glob';
|
|
2
|
-
import { readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
|
|
5
5
|
const IMPORT_STATEMENT_REGEXP =
|
|
@@ -8,26 +8,46 @@ const IMPORT_STATEMENT_REGEXP =
|
|
|
8
8
|
const EXPORT_STATEMENT_REGEXP =
|
|
9
9
|
/export([ \n\t]*(?:[^ \n\t\{\}]+[ \n\t]*,?)?(?:[ \n\t]*\{(?:[ \n\t]*[^ \n\t"'\{\}]+[ \n\t]*,?)+\})?[ \n\t]*)from[ \n\t]*(['"])([^'"\n]+)(?:['"])/g;
|
|
10
10
|
|
|
11
|
-
const
|
|
12
|
-
join(import.meta.dirname, '..', 'dist', '*', 'types', '*.d.ts'),
|
|
13
|
-
);
|
|
11
|
+
const BASE_FILEPATH = join(import.meta.dirname, '..', 'dist');
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
return function (line, dependencies, _quoteType, location) {
|
|
17
|
-
const extension = line.startsWith(`${type} type`) ? 'd.ts' : 'ts';
|
|
13
|
+
const files = glob.sync(join(BASE_FILEPATH, '*', 'types', '*.d.ts'));
|
|
18
14
|
|
|
19
|
-
|
|
15
|
+
function getReplacement(type, extensionPrefix) {
|
|
16
|
+
return function (_line, dependencies, _quoteType, location) {
|
|
17
|
+
return `${type}${dependencies}from '${location}.d.${extensionPrefix}ts'`;
|
|
20
18
|
};
|
|
21
19
|
}
|
|
22
20
|
|
|
23
|
-
function getReplacedContents(contents) {
|
|
21
|
+
function getReplacedContents(contents, extensionPrefix) {
|
|
24
22
|
return contents
|
|
25
|
-
.replaceAll(IMPORT_STATEMENT_REGEXP, getReplacement('import'))
|
|
26
|
-
.replaceAll(EXPORT_STATEMENT_REGEXP, getReplacement('export'));
|
|
23
|
+
.replaceAll(IMPORT_STATEMENT_REGEXP, getReplacement('import', extensionPrefix))
|
|
24
|
+
.replaceAll(EXPORT_STATEMENT_REGEXP, getReplacement('export', extensionPrefix));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function getTypeFilePrefix(file) {
|
|
28
|
+
const relativePath = file.replace(`${BASE_FILEPATH}/`, '');
|
|
29
|
+
const initialFolder = relativePath.split('/')[0];
|
|
30
|
+
|
|
31
|
+
switch (initialFolder) {
|
|
32
|
+
case 'esm':
|
|
33
|
+
return 'm';
|
|
34
|
+
|
|
35
|
+
case 'cjs':
|
|
36
|
+
return 'c';
|
|
37
|
+
|
|
38
|
+
default:
|
|
39
|
+
return '';
|
|
40
|
+
}
|
|
27
41
|
}
|
|
28
42
|
|
|
29
43
|
for (const file of files) {
|
|
30
44
|
const contents = readFileSync(file, 'utf-8');
|
|
45
|
+
const extensionPrefix = getTypeFilePrefix(file);
|
|
46
|
+
const outputFile = extensionPrefix ? file.replace(/\.d\.ts$/, `.d.${extensionPrefix}ts`) : file;
|
|
47
|
+
|
|
48
|
+
writeFileSync(outputFile, getReplacedContents(contents, extensionPrefix), 'utf-8');
|
|
31
49
|
|
|
32
|
-
|
|
50
|
+
if (outputFile !== file) {
|
|
51
|
+
rmSync(file, { force: true });
|
|
52
|
+
}
|
|
33
53
|
}
|
|
File without changes
|
|
File without changes
|