@tsmodule/tsmodule 40.0.6 → 40.0.9

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.
Files changed (2) hide show
  1. package/README.md +34 -24
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -11,20 +11,21 @@ modules** that target any platform.
11
11
  <!-- toc -->
12
12
 
13
13
  - [Installation](#installation)
14
- + [Requirements](#requirements)
15
- + [Existing projects](#existing-projects)
16
- + [New projects](#new-projects)
14
+ * [Requirements (global)](#requirements-global)
15
+ * [Existing projects](#existing-projects)
16
+ * [New projects](#new-projects)
17
17
  - [Purpose](#purpose)
18
18
  * [Create ESM packages using TypeScript](#create-esm-packages-using-typescript)
19
19
  * [Develop projects in real-time](#develop-projects-in-real-time)
20
20
  * [Build to optimized ES modules](#build-to-optimized-es-modules)
21
- + [Optimizing NPM dependencies with `-b, --bundle`](#optimizing-npm-dependencies-with--b---bundle)
21
+ * [Optimize NPM dependencies with `-b, --bundle`](#optimize-npm-dependencies-with--b---bundle)
22
22
  * [Run TypeScript directly](#run-typescript-directly)
23
23
  - [Use Cases](#use-cases)
24
24
  * [Generic TypeScript library](#generic-typescript-library)
25
25
  * [React component library (using Next.js)](#react-component-library-using-nextjs)
26
26
  - [Footnotes](#footnotes)
27
27
  * [Module configuration](#module-configuration)
28
+ + [Index exports](#index-exports)
28
29
  + [Package.json export](#packagejson-export)
29
30
  - [License](#license)
30
31
 
@@ -77,8 +78,8 @@ Ready out of the box:
77
78
 
78
79
  Build in dev mode and watch for changes:
79
80
 
80
- ```shell
81
- $ tsmodule dev
81
+ ```
82
+ tsmodule dev
82
83
  ```
83
84
 
84
85
  ### Build to optimized ES modules
@@ -86,8 +87,8 @@ $ tsmodule dev
86
87
  Production builds are minified ESM, with support for `my-package/a/b/c` path
87
88
  resolution (see [Module configuration](#module-configuration) below).
88
89
 
89
- ```shell
90
- $ tsmodule build [--bundle]
90
+ ```
91
+ tsmodule build [--bundle]
91
92
  ```
92
93
 
93
94
  **All projects:**
@@ -116,8 +117,8 @@ is more appropriate.</sub>
116
117
 
117
118
  ### Run TypeScript directly
118
119
 
119
- ```shell
120
- $ tsmodule file.ts
120
+ ```
121
+ tsmodule file.ts
121
122
  ```
122
123
 
123
124
  - Uses Node module loader to resolve TS at runtime
@@ -200,23 +201,32 @@ type-check and declaration emit:
200
201
  }
201
202
  ```
202
203
 
203
- And conditional exports in package.json will be configured like so, such that
204
- "index modules" at e.g. `src/test/index.ts` will be available at
205
- `my-package/test`:
204
+ #### Index exports
205
+
206
+ Conditional exports in package.json are configured such that "index
207
+ exports" are available at a subpath. For example:
206
208
 
207
- ```json
208
- {
209
- "files": ["dist/"],
210
- "exports": {
211
- "./package.json": "./package.json",
212
- "./": "./dist/index.js",
213
- "./*": "./dist/*/index.js"
214
- },
215
- }
216
209
  ```
210
+ src/a/b/c/index.ts
211
+ ```
212
+
213
+ Will be available downstream via:
214
+
215
+ ```ts
216
+ import { c } from "your-package/a/b/c"
217
+ ```
218
+
219
+ **Notes:**
220
+
221
+ - Index exports are the only entry points available for import, are ones located
222
+ at `src/**/index.ts(x?)`.<sup>1</sup>
223
+
224
+ - The default package entry point for `your-package` is `src/index.ts`.
217
225
 
218
- This has no restriction on internal imports between files, only the default
219
- configuration for how downstream consumers can import from module subpaths.
226
+ <sub><sup>1</sup> This has no restriction on internal imports between files,
227
+ which can import from each other freely, including at runtime.
228
+ However, consumers of your package will only be able to import from index
229
+ exports as shown.<sub>
220
230
 
221
231
  #### Package.json export
222
232
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@tsmodule/tsmodule",
3
3
  "platform": "node",
4
4
  "type": "module",
5
- "version": "40.0.6",
5
+ "version": "40.0.9",
6
6
  "repository": "tsmodule/tsmodule",
7
7
  "description": "TypeScript Module loader and compiler",
8
8
  "license": "MIT",