@hover-dev/cli 0.3.1 → 0.3.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.
@@ -1 +1 @@
1
- {"version":3,"file":"frameworks.d.ts","sourceRoot":"","sources":["../src/frameworks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;AAEzE,MAAM,WAAW,SAAS;IACxB,4EAA4E;IAC5E,EAAE,EAAE,WAAW,CAAC;IAChB,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,YAAY,EAAE,MAAM,CAAC;IACrB;yDACqD;IACrD,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,4EAA4E;IAC5E,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,UAAU,EAAE,SAAS,EA4CjC,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,WAAW,GAAG,SAAS,GAAG,SAAS,CAExE"}
1
+ {"version":3,"file":"frameworks.d.ts","sourceRoot":"","sources":["../src/frameworks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;AAEzE,MAAM,WAAW,SAAS;IACxB,4EAA4E;IAC5E,EAAE,EAAE,WAAW,CAAC;IAChB,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,YAAY,EAAE,MAAM,CAAC;IACrB;yDACqD;IACrD,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,4EAA4E;IAC5E,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,UAAU,EAAE,SAAS,EAiDjC,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,WAAW,GAAG,SAAS,GAAG,SAAS,CAExE"}
@@ -31,7 +31,12 @@ export const FRAMEWORKS = [
31
31
  // Next project's `next` dep should land on `@hover-dev/next`, not the
32
32
  // webpack plugin (which only covers `next dev --webpack`).
33
33
  detectDeps: ['next'],
34
- configCandidates: ['next.config.ts', 'next.config.mjs', 'next.config.js'],
34
+ // `.mjs` and `.js` first because Next loads them via native `import()`
35
+ // and our `mutateNext` can magicast them in place. `.ts` is checked
36
+ // last and triggers a `manual` result that tells the user to rename to
37
+ // `.mjs` first — Next loads `.ts` configs through a CJS require step
38
+ // that can't resolve `@hover-dev/next`'s ESM-only `exports` map.
39
+ configCandidates: ['next.config.mjs', 'next.config.js', 'next.config.ts'],
35
40
  },
36
41
  {
37
42
  id: 'webpack',
@@ -1 +1 @@
1
- {"version":3,"file":"mutate.d.ts","sourceRoot":"","sources":["../src/mutate.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9D;;;;;;;GAOG;AACH,MAAM,MAAM,YAAY,GACpB;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,OAAO,CAAA;CAAE,GACzD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GACxD;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5D;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,CAiC/F;AAyOD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,WAAW,GAAG,MAAM,CAmD1D"}
1
+ {"version":3,"file":"mutate.d.ts","sourceRoot":"","sources":["../src/mutate.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9D;;;;;;;GAOG;AACH,MAAM,MAAM,YAAY,GACpB;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,OAAO,CAAA;CAAE,GACzD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GACxD;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5D;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,CAiC/F;AAuRD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,WAAW,GAAG,MAAM,CAmD1D"}
package/dist/mutate.js CHANGED
@@ -107,6 +107,20 @@ async function mutateNuxt(configPath) {
107
107
  * one-liner for that step instead of touching the file.
108
108
  */
109
109
  async function mutateNext(configPath, rootDir) {
110
+ // Next 16 loads `.ts` configs through a CJS `transpile-config` step that
111
+ // does `require()` on the compiled output. That path does NOT honour
112
+ // the `"import"` condition in ESM-only `exports`, so it cannot load
113
+ // `@hover-dev/next` (which is ESM). The user has to rename to `.mjs`
114
+ // (or `.js` with `"type": "module"` in package.json) — `.mjs` goes
115
+ // through Node's native `import()` which resolves ESM correctly.
116
+ // Spike + verification in CLAUDE.md "Edge runtime isolation" section.
117
+ if (configPath.endsWith('.ts')) {
118
+ return {
119
+ kind: 'manual',
120
+ reason: 'next.config.ts cannot load @hover-dev/next (Next loads .ts configs via CJS require, which does not honour ESM exports)',
121
+ instructions: tsConfigManualInstructions(configPath),
122
+ };
123
+ }
110
124
  const mod = await loadFile(configPath);
111
125
  // Step 1: wrap next.config export in withHover(...) — idempotent.
112
126
  let configAlreadyWired = false;
@@ -129,6 +143,36 @@ async function mutateNext(configPath, rootDir) {
129
143
  const alreadyWired = configAlreadyWired && instrumentationAlreadyWired;
130
144
  return { kind: 'ok', configPath, alreadyWired };
131
145
  }
146
+ /**
147
+ * Tailored manual-instructions message for the "you have a next.config.ts"
148
+ * case. Tells the user exactly what to rename and what to paste, with the
149
+ * same shape as if the CLI had mutated successfully — so a `mv && paste`
150
+ * leaves them in the same end state as the auto-magicast path.
151
+ */
152
+ function tsConfigManualInstructions(configPath) {
153
+ const tsName = configPath.split('/').pop() ?? 'next.config.ts';
154
+ const mjsName = tsName.replace(/\.ts$/, '.mjs');
155
+ return [
156
+ `Next 16 can't load @hover-dev/next from a ${tsName}.`,
157
+ `(Next loads .ts configs via a CJS \`require()\` step that can't resolve`,
158
+ `the ESM-only \`exports\` map @hover-dev/next ships.) Rename to ${mjsName}`,
159
+ `and paste this:`,
160
+ ``,
161
+ ` // ${mjsName}`,
162
+ ` import { withHover } from '@hover-dev/next';`,
163
+ ``,
164
+ ` /** @type {import('next').NextConfig} */`,
165
+ ` const nextConfig = {`,
166
+ ` // your existing config`,
167
+ ` };`,
168
+ ``,
169
+ ` export default withHover(nextConfig);`,
170
+ ``,
171
+ `Then continue with steps 2 and 3 below.`,
172
+ ``,
173
+ manualInstructions('next'),
174
+ ].join('\n');
175
+ }
132
176
  /**
133
177
  * Locate the user's existing instrumentation file, or pick a default path
134
178
  * to create one at. Next looks for `instrumentation.{ts,js}` at the project
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hover-dev/cli",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "CLI for Hover. Detects your bundler, installs the right Hover integration package, and wires it into your config — one command.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Hyperyond",