@ms-cloudpack/esm-stub-utilities 0.3.3 → 0.3.4
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.json +31 -1
- package/CHANGELOG.md +10 -2
- package/README.md +18 -6
- package/lib/tsdoc-metadata.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,37 @@
|
|
|
2
2
|
"name": "@ms-cloudpack/esm-stub-utilities",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Wed, 02 Nov 2022 08:10:59 GMT",
|
|
6
|
+
"tag": "@ms-cloudpack/esm-stub-utilities_v0.3.4",
|
|
7
|
+
"version": "0.3.4",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "dzearing@microsoft.com",
|
|
12
|
+
"package": "@ms-cloudpack/esm-stub-utilities",
|
|
13
|
+
"commit": "3439c51ff4eb7cb624cf84fb2881a781eabca83f",
|
|
14
|
+
"comment": "README updates."
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"date": "Tue, 01 Nov 2022 08:11:03 GMT",
|
|
21
|
+
"tag": "@ms-cloudpack/esm-stub-utilities_v0.3.3",
|
|
22
|
+
"version": "0.3.3",
|
|
23
|
+
"comments": {
|
|
24
|
+
"none": [
|
|
25
|
+
{
|
|
26
|
+
"author": "dzearing@microsoft.com",
|
|
27
|
+
"package": "@ms-cloudpack/esm-stub-utilities",
|
|
28
|
+
"commit": "264fdebf12d3c964f2520feef232af76425cdc4c",
|
|
29
|
+
"comment": "Updating readme notes."
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"date": "Tue, 18 Oct 2022 08:16:24 GMT",
|
|
6
36
|
"tag": "@ms-cloudpack/esm-stub-utilities_v0.3.3",
|
|
7
37
|
"version": "0.3.3",
|
|
8
38
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
# Change Log - @ms-cloudpack/esm-stub-utilities
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 02 Nov 2022 08:10:59 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 0.3.4
|
|
8
|
+
|
|
9
|
+
Wed, 02 Nov 2022 08:10:59 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- README updates. (dzearing@microsoft.com)
|
|
14
|
+
|
|
7
15
|
## 0.3.3
|
|
8
16
|
|
|
9
|
-
Tue, 18 Oct 2022 08:
|
|
17
|
+
Tue, 18 Oct 2022 08:16:24 GMT
|
|
10
18
|
|
|
11
19
|
### Patches
|
|
12
20
|
|
package/README.md
CHANGED
|
@@ -4,18 +4,29 @@ This library contains utilities for generating ESM stubs for CommonJS modules. S
|
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Call `createESMStub` to generate a stub for the cjs entry:
|
|
8
8
|
|
|
9
9
|
```js
|
|
10
10
|
import { createESMStub } from '@ms-cloudpack/esm-stub-utilities';
|
|
11
11
|
|
|
12
|
-
const esmStub = await createESMStub('/path/to/entry.js', '/path/to/stub.js');
|
|
12
|
+
const esmStub = await createESMStub('/path/to/cjs/entry.js', '/path/to/esm/stub.js');
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
This
|
|
15
|
+
This call returns an esm stub string, but does not write the file. The path in the second argument is needed to derive import paths.
|
|
16
|
+
|
|
17
|
+
Example cjs file `entry.js`:
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
module.exports = {
|
|
21
|
+
named1: 'named1',
|
|
22
|
+
named2: 'named2',
|
|
23
|
+
};
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Example output (`stub.js`):
|
|
16
27
|
|
|
17
28
|
```js
|
|
18
|
-
import content from '/
|
|
29
|
+
import content from '../cjs/entry.js';
|
|
19
30
|
|
|
20
31
|
export {
|
|
21
32
|
default: content,
|
|
@@ -24,12 +35,13 @@ export {
|
|
|
24
35
|
};
|
|
25
36
|
```
|
|
26
37
|
|
|
27
|
-
|
|
38
|
+
To write the file in the same call, the `writeESMStub` helper does this (which writes the stub to the node_modules/.cache folder in
|
|
39
|
+
the package):
|
|
28
40
|
|
|
29
41
|
```js
|
|
30
42
|
import { writeESMStub } from '@ms-cloudpack/esm-stub-utilities';
|
|
31
43
|
|
|
32
|
-
await writeESMStub('./path/to/entry.js'
|
|
44
|
+
const stubPath = await writeESMStub('./path/to/entry.js');
|
|
33
45
|
```
|
|
34
46
|
|
|
35
47
|
## Special considerations
|
package/lib/tsdoc-metadata.json
CHANGED