module-replacements 2.1.0 → 2.2.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
@@ -1,17 +1,37 @@
1
1
  # module-replacements
2
2
 
3
- This project provides two things:
3
+ As part of the community [e18e](https://e18e.dev) effort, this project
4
+ provides a collection of module replacements (i.e. possible alternative
5
+ packages).
4
6
 
5
- - A JS package containing manifests of suggested module replacements
6
- - Documentation for replacements which are not entirely replaced by native
7
- functionality
7
+ We provide two things:
8
+ - Manifests (mappings of modules to their possible replacements)
9
+ - Documentation for more complex replacements
8
10
 
9
- ## Replacements documentation
11
+ ## List of replacements
10
12
 
11
- You can read more about module replacements and browse the list
12
- [by clicking here](./docs/modules/README.md).
13
+ You can find a list of replacements in the
14
+ [modules readme](./docs/modules/README.md).
13
15
 
14
- ## `module-replacements` package
16
+ ## Tools
17
+
18
+ Some tools consume the lists of modules in this repository:
19
+
20
+ | Name | Description |
21
+ | -- | -- |
22
+ | [eslint-plugin-depend](https://github.com/es-tooling/eslint-plugin-depend) | ESLint plugin to detect possible replacements |
23
+
24
+
25
+ ## Manifests
26
+
27
+ The manifests can be used via the `module-replacements` NPM package.
28
+
29
+ We provide three manifests:
30
+
31
+ - All (includes every manifest)
32
+ - Native replacements
33
+ - Micro utility replacements
34
+ - Preferred replacements
15
35
 
16
36
  ### Usage
17
37
 
@@ -24,19 +44,13 @@ npm i -S module-replacements
24
44
  You can then import the manifest of your choice:
25
45
 
26
46
  ```ts
27
- import {NativeReplacements} from 'module-replacements';
47
+ import {nativeReplacements} from 'module-replacements';
28
48
  ```
29
49
 
30
- ### Manifests
31
-
32
- We provide three manifests:
33
-
34
- - All (includes every manifest)
35
- - Native replacements
36
- - Micro utility replacements
37
- - Preferred replacements
50
+ The manifests are also available directly in the `manifests/` directory
51
+ of the package (e.g. `node_modules/module-replacements/manifests/native.json`).
38
52
 
39
- #### Native replacements
53
+ ### Native replacements (`nativeReplacements`, `native.json`)
40
54
 
41
55
  These are modules which can now be replaced by native functionality.
42
56
 
@@ -46,13 +60,13 @@ platform features can be replaced by their platform equivalents.
46
60
  Similarly, features which did not exist at the time but have now existed in
47
61
  the platform for many years, so no longer need a dependency.
48
62
 
49
- #### Micro utility replacements
63
+ ### Micro utility replacements (`microUtilsReplacements`, `micro-utilities.json`)
50
64
 
51
65
  This is a more opinionated list of modules considered to be 'micro utilities' -
52
66
  very small utilities which could possibly be replaced with native equivalents
53
67
  or removed entirely.
54
68
 
55
- #### Preferred replacements
69
+ ### Preferred replacements (`preferredReplacements`, `preferred.json`)
56
70
 
57
71
  This is a very opinionated list of modules with preferred replacements. Often
58
72
  these replacements are much lighter or more modern than the modules they are
@@ -1,9 +1,57 @@
1
1
  {
2
2
  "moduleReplacements": [
3
+ {
4
+ "type": "simple",
5
+ "moduleName": "call-bind",
6
+ "replacement": "Use Function.call.bind(v)",
7
+ "category": "micro-utilities"
8
+ },
9
+ {
10
+ "type": "simple",
11
+ "moduleName": "es-get-iterator",
12
+ "replacement": "Use v[Symbol.iterator]?.()",
13
+ "category": "micro-utilities"
14
+ },
15
+ {
16
+ "type": "simple",
17
+ "moduleName": "es-set-tostringtag",
18
+ "replacement": "Use Object.defineProperty(target, Symbol.toStringTag, { value, configurable: true })",
19
+ "category": "micro-utilities"
20
+ },
21
+ {
22
+ "type": "simple",
23
+ "moduleName": "is-array-buffer",
24
+ "replacement": "Use v instanceof ArrayBuffer, or if cross-realm, use Object.prototype.toString.call(v) === \"[object ArrayBuffer]\"",
25
+ "category": "micro-utilities"
26
+ },
27
+ {
28
+ "type": "simple",
29
+ "moduleName": "is-boolean-object",
30
+ "replacement": "Use Object.prototype.toString.call(v) === \"[object Boolean]\"",
31
+ "category": "micro-utilities"
32
+ },
33
+ {
34
+ "type": "simple",
35
+ "moduleName": "is-date-object",
36
+ "replacement": "Use v instanceof Date, or if cross-realm, use Object.prototype.toString.call(v) === \"[object Date]\"",
37
+ "category": "micro-utilities"
38
+ },
39
+ {
40
+ "type": "simple",
41
+ "moduleName": "is-negative-zero",
42
+ "replacement": "Use Object.is(v, -0)",
43
+ "category": "micro-utilities"
44
+ },
3
45
  {
4
46
  "type": "simple",
5
47
  "moduleName": "is-number",
6
- "replacement": "Use typeof v === \"number\"",
48
+ "replacement": "Use typeof v === \"number\" || (typeof v === \"string\" && Number.isFinite(+v))",
49
+ "category": "micro-utilities"
50
+ },
51
+ {
52
+ "type": "simple",
53
+ "moduleName": "is-number-object",
54
+ "replacement": "Use Object.prototype.toString.call(v) === \"[object Number]\"",
7
55
  "category": "micro-utilities"
8
56
  },
9
57
  {
@@ -24,6 +72,12 @@
24
72
  "replacement": "Use v instanceof RegExp, or if cross-realm, use Object.prototype.toString.call(v) === \"[object RegExp]\"",
25
73
  "category": "micro-utilities"
26
74
  },
75
+ {
76
+ "type": "simple",
77
+ "moduleName": "is-string",
78
+ "replacement": "Use Object.prototype.toString.call(v) === \"[object String]\"",
79
+ "category": "micro-utilities"
80
+ },
27
81
  {
28
82
  "type": "simple",
29
83
  "moduleName": "is-travis",