@bobfrankston/importgen 0.1.30 → 0.1.32

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 +26 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -137,6 +137,32 @@ For each dependency, `importgen` reads that package's `package.json` and picks t
137
137
  - **`file:` paths** (`file:../path/to/package`) -- resolved relative to `package.json`
138
138
  - **`workspace:` references** -- resolved from `node_modules/`
139
139
 
140
+ ## Monorepo / npm Workspaces
141
+
142
+ `importgen` works in npm workspaces (monorepos) without any configuration. When a dependency isn't in the local `node_modules/`, it walks up the directory tree checking each ancestor's `node_modules/` -- the same resolution strategy Node uses. The import map path is generated relative to the HTML file.
143
+
144
+ Example layout:
145
+
146
+ ```
147
+ my-monorepo/ ← root, has node_modules/quill/
148
+ packages/
149
+ client/ ← workspace, package.json lists quill
150
+ compose/
151
+ compose.html ← importgen target
152
+ ```
153
+
154
+ Running `importgen compose/compose.html` from `client/` finds `quill` in the root `node_modules/` and generates:
155
+
156
+ ```json
157
+ {
158
+ "imports": {
159
+ "quill": "../../node_modules/quill/dist/quill.js"
160
+ }
161
+ }
162
+ ```
163
+
164
+ If the dependency exists in the local `node_modules/` it is found there first (existing behavior preserved).
165
+
140
166
  ## `.dependencies` Override
141
167
 
142
168
  Add a `.dependencies` field to `package.json` to override resolution paths for specific packages without changing the real `dependencies`:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/importgen",
3
- "version": "0.1.30",
3
+ "version": "0.1.32",
4
4
  "description": "Generate ES Module import maps from package.json dependencies for native browser module loading",
5
5
  "main": "index.js",
6
6
  "exports": {