Skip to content

Commit

Permalink
2.0.1 Documentation updated, template literal in test to satisfy deep…
Browse files Browse the repository at this point in the history
…source
  • Loading branch information
nktnet committed Oct 20, 2023
1 parent 8fb9326 commit 632a17c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Synchronously import dynamic ECMAScript Modules similar to CommonJS [require](ht

Basic wrapper around [esm](https://github.com/standard-things/esm) for compatibility with both ES6 and CJS projects in NodeJS

Capable of importing pure-esm libraries such as node-fetch@3 in CJS projects
Capable of importing pure-esm libraries such as [node-fetch@3](https://github.com/node-fetch/node-fetch#commonjs) in CJS projects

[![Try with Replit](https://replit.com/badge?caption=Try%20with%20Replit)](https://replit.com/@nktnet1/import-sync-example#index.js)

Expand Down Expand Up @@ -154,15 +154,18 @@ Module name or relative path similar to CommonJS [require](https://nodejs.org/ap
<tr>
<td>basePath</td>
<td>
Absolute path to the module's directory. The basePath option will only take effect if the given <code>id</code> starts with <code>./</code> or <code>../</code>. For example,
Absolute path to the module's directory.
The basePath option will only take effect if the given <code>id</code> starts with <code>./</code> or <code>../</code>.
<br/>
For example,
<ul>
<li>✅ <code>./localModule</code></li>
<li>✅ <code>../src/localModule.mjs</code></li>
<li>✅ <code>./localLib</code></li>
<li>✅ <code>../src/localLib</code></li>
</ul>
and not
<ul>
<li>❌ <code>/home/user/localModule</code></li>
<li>❌ <code>localModule</code></li>
<li>❌ <code>/home/user/localLib</code></li>
<li>❌ <code>localLib.mjs</code></li>
<li>❌ <code>node-fetch</code></li>
</ul>
</td>
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "git",
"url": "https://github.com/nktnet1/import-sync"
},
"version": "2.0.0",
"version": "2.0.1",
"files": [
"dist"
],
Expand Down Expand Up @@ -42,7 +42,7 @@
"license": "MIT",
"description": "Synchronously import dynamic ECMAScript Modules similar to CommonJS require. Basic wrapper around esm for compatibility with both ES6 and CJS projects in NodeJS.",
"devDependencies": {
"@types/esm": "^3.2.0",
"@types/esm": "^3.2.1",
"@types/jest": "^29.5.6",
"@types/node": "^20.8.7",
"@typescript-eslint/eslint-plugin": "^6.8.0",
Expand Down
2 changes: 1 addition & 1 deletion tests/path/path.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ test('ESM import with default relative path', () => {
});

test('ESM import with absolute path', () => {
const exampleMjs = importSync(process.cwd() + '/tests/basic/basic');
const exampleMjs = importSync(`${process.cwd()}/tests/basic/basic`);
expect(exampleMjs.helloString).toStrictEqual('helloworld');
});

Expand Down

0 comments on commit 632a17c

Please sign in to comment.