@@ -224,7 +224,7 @@ in your project's `package.json`.
224224
225225## Package entry points
226226
227- In a package’ s ` package.json ` file, two fields can define entry points for a
227+ In a package' s ` package.json ` file, two fields can define entry points for a
228228package: [ ` "main" ` ] [ ] and [ ` "exports" ` ] [ ] . The [ ` "main" ` ] [ ] field is supported
229229in all versions of Node.js, but its capabilities are limited: it only defines
230230the main entry point of the package.
@@ -255,7 +255,7 @@ likely be a breaking change.**
255255
256256To make the introduction of [ ` "exports" ` ] [ ] non-breaking, ensure that every
257257previously supported entry point is exported. It is best to explicitly specify
258- entry points so that the package’ s public API is well-defined. For example,
258+ entry points so that the package' s public API is well-defined. For example,
259259a project that previous exported ` main ` , ` lib ` ,
260260` feature ` , and the ` package.json ` could use the following ` package.exports ` :
261261
@@ -303,7 +303,7 @@ path `import feature from 'my-mod/feature/index.js`.
303303### Main entry point export
304304
305305To set the main entry point for a package, it is advisable to define both
306- [ ` "exports" ` ] [ ] and [ ` "main" ` ] [ ] in the package’ s [ ` package.json ` ] [ ] file:
306+ [ ` "exports" ` ] [ ] and [ ` "main" ` ] [ ] in the package' s [ ` package.json ` ] [ ] file:
307307
308308``` json
309309{
@@ -700,8 +700,8 @@ changes:
700700 description: Unflag self-referencing a package using its name.
701701-->
702702
703- Within a package, the values defined in the package’ s
704- ` package.json ` [ ` "exports" ` ] [ ] field can be referenced via the package’ s name.
703+ Within a package, the values defined in the package' s
704+ ` package.json ` [ ` "exports" ` ] [ ] field can be referenced via the package' s name.
705705For example, assuming the ` package.json ` is:
706706
707707``` json
@@ -905,7 +905,7 @@ This approach is appropriate for any of the following use cases:
905905 install both this package and those other packages. For example a ` utilities `
906906 package is used directly in an application, and a ` utilities-plus ` package
907907 adds a few more functions to ` utilities ` . Because the wrapper exports
908- underlying CommonJS files, it doesn’ t matter if ` utilities-plus ` is written in
908+ underlying CommonJS files, it doesn' t matter if ` utilities-plus ` is written in
909909 CommonJS or ES module syntax; it will work either way.
910910* The package stores internal state, and the package author would prefer not to
911911 refactor the package to isolate its state management. See the next section.
@@ -915,7 +915,7 @@ be to add an export, e.g. `"./module"`, to point to an all-ES module-syntax
915915version of the package. This could be used via ` import 'pkg/module' ` by users
916916who are certain that the CommonJS version will not be loaded anywhere in the
917917application, such as by dependencies; or if the CommonJS version can be loaded
918- but doesn’ t affect the ES module version (for example, because the package is
918+ but doesn' t affect the ES module version (for example, because the package is
919919stateless):
920920
921921``` json
@@ -949,22 +949,22 @@ points directly:
949949
950950This can be done if both the CommonJS and ES module versions of the package are
951951equivalent, for example because one is the transpiled output of the other; and
952- the package’ s management of state is carefully isolated (or the package is
952+ the package' s management of state is carefully isolated (or the package is
953953stateless).
954954
955955The reason that state is an issue is because both the CommonJS and ES module
956956versions of the package might get used within an application; for example, the
957- user’ s application code could ` import ` the ES module version while a dependency
957+ user' s application code could ` import ` the ES module version while a dependency
958958` require ` s the CommonJS version. If that were to occur, two copies of the
959959package would be loaded in memory and therefore two separate states would be
960960present. This would likely cause hard-to-troubleshoot bugs.
961961
962- Aside from writing a stateless package (if JavaScript’ s ` Math ` were a package,
962+ Aside from writing a stateless package (if JavaScript' s ` Math ` were a package,
963963for example, it would be stateless as all of its methods are static), there are
964- some ways to isolate state so that it’ s shared between the potentially loaded
964+ some ways to isolate state so that it' s shared between the potentially loaded
965965CommonJS and ES module instances of the package:
966966
967- 1 . If possible, contain all state within an instantiated object. JavaScript’ s
967+ 1 . If possible, contain all state within an instantiated object. JavaScript' s
968968 ` Date ` , for example, needs to be instantiated to contain state; if it were a
969969 package, it would be used like this:
970970
@@ -974,7 +974,7 @@ CommonJS and ES module instances of the package:
974974 // someDate contains state; Date does not
975975 ```
976976
977- The ` new ` keyword isn’ t required; a package’ s function can return a new
977+ The ` new ` keyword isn' t required; a package' s function can return a new
978978 object, or modify a passed-in object, to keep the state external to the
979979 package.
980980
@@ -1001,7 +1001,7 @@ CommonJS and ES module instances of the package:
10011001 each reference of ` pkg ` will contain the same state; and modifying that
10021002 state from either module system will apply to both.
10031003
1004- Any plugins that attach to the package’ s singleton would need to separately
1004+ Any plugins that attach to the package' s singleton would need to separately
10051005attach to both the CommonJS and ES module singletons.
10061006
10071007This approach is appropriate for any of the following use cases:
@@ -1076,7 +1076,7 @@ changes:
10761076}
10771077```
10781078
1079- The ` "name" ` field defines your package’ s name. Publishing to the
1079+ The ` "name" ` field defines your package' s name. Publishing to the
10801080_ npm_ registry requires a name that satisfies
10811081[ certain requirements] ( https://docs.npmjs.com/files/package.json#name ) .
10821082
@@ -1159,7 +1159,7 @@ Files ending with `.js` are loaded as ES modules when the nearest parent
11591159` "module" ` .
11601160
11611161The nearest parent ` package.json ` is defined as the first ` package.json ` found
1162- when searching in the current folder, that folder’ s parent, and so on up
1162+ when searching in the current folder, that folder' s parent, and so on up
11631163until a node\_ modules folder or the volume root is reached.
11641164
11651165``` json
0 commit comments