@ms-cloudpack/esm-stub-utilities 0.15.15 → 0.15.17
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 +6 -6
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -4,12 +4,12 @@ This library contains utilities for generating ESM stubs for CommonJS modules. S
|
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
7
|
-
Call `
|
|
7
|
+
Call `writeESMStubsInWorker` to generate stubs for CJS entries of a package:
|
|
8
8
|
|
|
9
9
|
```js
|
|
10
|
-
import {
|
|
10
|
+
import { writeESMStubsInWorker } from '@ms-cloudpack/esm-stub-utilities';
|
|
11
11
|
|
|
12
|
-
const esmStub = await
|
|
12
|
+
const esmStub = await writeESMStubsInWorker({
|
|
13
13
|
inputPath: '/path/to/package',
|
|
14
14
|
entries: {
|
|
15
15
|
'./entry1': './cjsEntry1.js',
|
|
@@ -20,12 +20,12 @@ const esmStub = await writeESMStubs({
|
|
|
20
20
|
|
|
21
21
|
## Special considerations
|
|
22
22
|
|
|
23
|
-
When evaluating named entries in the `exports` of the cjs file, the library is loaded in the
|
|
23
|
+
When evaluating named entries in the `exports` of the cjs file, the library is loaded in the Node process. A few libraries are used to simulate the browser environment in order for the script to load. (e.g. some libraries will reference `window` on load, and therefore must be run in an environment that accommodates this.)
|
|
24
24
|
|
|
25
|
-
Libraries which
|
|
25
|
+
Libraries which include a `default` entry in their `exports` will have that value preserved as the `default` export in the stub. However, libraries which export an object that doesn't have a `default` key will have the entire object exported as the default.
|
|
26
26
|
|
|
27
27
|
Libraries which export a function or literal value as the `exports` result will have a default export for that entry.
|
|
28
28
|
|
|
29
29
|
Some libraries don't export anything. In this case, the stub will simply import the entry.
|
|
30
30
|
|
|
31
|
-
Exported members that are keywords will be ignored. (
|
|
31
|
+
Exported members that are keywords will be ignored. (e.g. `module.exports = { 'delete': "foo" };` would be considered an empty export.)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/esm-stub-utilities",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.17",
|
|
4
4
|
"description": "Generates ESM stubs for CommonJS entry files.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@happy-dom/global-registrator": "^18.0.0",
|
|
18
|
-
"@ms-cloudpack/common-types": "^0.
|
|
18
|
+
"@ms-cloudpack/common-types": "^0.28.1",
|
|
19
19
|
"@ms-cloudpack/environment": "^0.1.1",
|
|
20
20
|
"@ms-cloudpack/json-utilities": "^0.1.11",
|
|
21
|
-
"@ms-cloudpack/package-utilities": "^12.5.
|
|
21
|
+
"@ms-cloudpack/package-utilities": "^12.5.3",
|
|
22
22
|
"@ms-cloudpack/path-string-parsing": "^1.2.7",
|
|
23
23
|
"@ms-cloudpack/worker-pool": "^0.4.1",
|
|
24
24
|
"oxc-parser": "^0.73.0",
|