@cspell/dynamic-import 6.26.0 → 6.26.2
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 +27 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -10,10 +10,34 @@ npm install -S @cspell/dynamic-import
|
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
### Example ESM Package
|
|
14
|
+
|
|
15
|
+
Example loading [chalk v5](https://www.npmjs.com/package/chalk) which is an ESM only module.
|
|
16
|
+
|
|
17
|
+
**TypeScript Common JS**
|
|
14
18
|
|
|
15
19
|
```ts
|
|
16
20
|
import { dynamicImport } from '@cspell/dynamic-import';
|
|
21
|
+
|
|
22
|
+
const pChalk = dynamicImport<typeof import('chalk')>('chalk', __dirname);
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**TypeScript ESM**
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import { dynamicImport } from '@cspell/dynamic-import';
|
|
29
|
+
|
|
30
|
+
const pChalk = dynamicImport<typeof import('chalk')>('chalk', import.meta.url);
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Example ESM files
|
|
34
|
+
|
|
35
|
+
**TypeScript Common JS**
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import { dynamicImport } from '@cspell/dynamic-import';
|
|
39
|
+
|
|
40
|
+
const pIndex = dynamicImport<typeof import('../esm/index.mjs')>('../esm/index.mjs', __dirname);
|
|
17
41
|
```
|
|
18
42
|
|
|
19
43
|
<!--- @@inject: ../../static/footer.md --->
|
|
@@ -29,3 +53,5 @@ Brought to you by <a href="https://streetsidesoftware.com" title="Street Side So
|
|
|
29
53
|
</p>
|
|
30
54
|
|
|
31
55
|
<!--- @@inject-end: ../../static/footer.md --->
|
|
56
|
+
|
|
57
|
+
<!--- cspell:dictionaries typescript --->
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "6.26.
|
|
6
|
+
"version": "6.26.2",
|
|
7
7
|
"description": "Dynamic Module Loader",
|
|
8
8
|
"keywords": [
|
|
9
9
|
"module",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"import-meta-resolve": "^2.2.1"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "9c983b5f96c3d7b089e49178ab0b437b5eada256"
|
|
60
60
|
}
|