diff --git a/docs/api-reference-source/npm.xml b/docs/api-reference-source/npm.xml
index f55e43f..d705307 100644
--- a/docs/api-reference-source/npm.xml
+++ b/docs/api-reference-source/npm.xml
@@ -5,8 +5,12 @@
npm
object provides access to all npm packages.
-
npm
object provides access to all npm packages.+ You do not need to import or install the packages you use in any way; Tasklemon will automatically download and inject any package you access. +
]]>npm
's properties.
+ Modern npm packages usually expose their functionality as ESM modules.
+
+
+
+ To use such a package, access it through the npm
global:
+
npm.chalk
returns the default export of the chalk
package.
+ npm.telegram.TelegramClient
returns the TelegramClient
export of the telegram
package.
+
+ In rare cases, there can be collisions between injected named exports, and default export properties. See
+ You can use these packages in the same way as ESM-based packages, by accessing them directly on the npm
global.
- You do not need to import or install the packages you use in any way; Tasklemon will automatically install and inject any package you use. -
- To access a package with special characters in its name, use bracket notation. + If a package has conflicting ESM and CommonJS exports, Tasklemon will return the ESM export.
- -
- It's a good idea to do this, to ensure your script keeps the same behavior over time, even after new versions of the packages are released.
+ It's a good idea to do this, to ensure your script's behavior stays the same over time, even after new versions of the packages are released.
To have Tasklemon automatically add a tl:require
directive for all the packages used by your script, setting them to their latest available version, you can use the --pin-pkg
command-line action.
unmodifiedDefaultExport
property.
+
+
+ For example, consider a package named contrivedExample
. Its default export has an ambiguousLabel
property; and one of its named exports happens to be named ambiguousLabel
as well. In this situation:
+
npm.contrivedExample.ambiguousLabel
returns the ambiguousLabel
named export.
+ npm.contrivedExample.unmodifiedDefaultExport.ambiguousLabel
returns the ambiguousLabel
property of the default export.
+