@paramour-js/next 0.2.0 → 0.3.0
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.
- package/dist/doctor/checks.js +29 -10
- package/dist/index.d.ts +0 -6
- package/dist/index.js +0 -6
- package/dist/pages.js +7 -1
- package/package.json +4 -3
package/dist/doctor/checks.js
CHANGED
|
@@ -188,14 +188,13 @@ async function discoveryCheck(projectRoot, config, routes) {
|
|
|
188
188
|
};
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
|
-
function
|
|
191
|
+
function readManifest(projectRoot, name) {
|
|
192
192
|
// Walks upward like Node resolution: workspaces hoist dependencies to a
|
|
193
193
|
// parent node_modules, so a single project-root read hard-fails healthy
|
|
194
194
|
// monorepo setups.
|
|
195
195
|
for (let dir = projectRoot;; dir = dirname(dir)) {
|
|
196
196
|
try {
|
|
197
|
-
|
|
198
|
-
return typeof parsed.version === "string" ? parsed.version : undefined;
|
|
197
|
+
return JSON.parse(readFileSync(join(dir, "node_modules", ...name.split("/"), "package.json"), "utf8"));
|
|
199
198
|
}
|
|
200
199
|
catch {
|
|
201
200
|
if (dirname(dir) === dir)
|
|
@@ -203,29 +202,49 @@ function readVersion(projectRoot, name) {
|
|
|
203
202
|
}
|
|
204
203
|
}
|
|
205
204
|
}
|
|
205
|
+
/** `1.2.3` / `1.2.3-beta.1` — the shape a published `workspace:*` pin takes. */
|
|
206
|
+
const EXACT_VERSION = /^\d+\.\d+\.\d+(?:-[\w.-]+)?$/;
|
|
206
207
|
function versionCheck(projectRoot) {
|
|
207
|
-
const
|
|
208
|
-
const
|
|
208
|
+
const coreManifest = readManifest(projectRoot, "paramour");
|
|
209
|
+
const nextManifest = readManifest(projectRoot, "@paramour-js/next");
|
|
210
|
+
const core = typeof coreManifest?.version === "string"
|
|
211
|
+
? coreManifest.version
|
|
212
|
+
: undefined;
|
|
213
|
+
const next = typeof nextManifest?.version === "string"
|
|
214
|
+
? nextManifest.version
|
|
215
|
+
: undefined;
|
|
209
216
|
const missing = [
|
|
210
217
|
...(next === undefined ? ["@paramour-js/next"] : []),
|
|
211
218
|
...(core === undefined ? ["paramour"] : []),
|
|
212
219
|
];
|
|
213
|
-
if (missing.length > 0) {
|
|
220
|
+
if (missing.length > 0 || core === undefined || next === undefined) {
|
|
214
221
|
return {
|
|
215
222
|
detail: ["install dependencies and re-run"],
|
|
216
223
|
label: `versions: ${missing.join(", ")} not resolvable in node_modules`,
|
|
217
224
|
status: "fail",
|
|
218
225
|
};
|
|
219
226
|
}
|
|
220
|
-
|
|
227
|
+
// The packages version INDEPENDENTLY (changesets); comparing the two
|
|
228
|
+
// installed versions against each other warns on every correct install.
|
|
229
|
+
// The real invariant is that the installed core is the one the installed
|
|
230
|
+
// @paramour-js/next declares — `workspace:*` publishes as an exact pin, so
|
|
231
|
+
// when the declaration is exact this is string equality. A non-exact
|
|
232
|
+
// declaration (a range, or `workspace:*` inside this monorepo itself) is
|
|
233
|
+
// the package manager's to enforce; no claim to check.
|
|
234
|
+
const declared = nextManifest?.dependencies?.paramour;
|
|
235
|
+
if (declared !== undefined &&
|
|
236
|
+
EXACT_VERSION.test(declared) &&
|
|
237
|
+
core !== declared) {
|
|
221
238
|
return {
|
|
222
|
-
detail: [
|
|
223
|
-
|
|
239
|
+
detail: [
|
|
240
|
+
"your package manager should have matched these — check for overrides/resolutions or a stale lockfile, then reinstall",
|
|
241
|
+
],
|
|
242
|
+
label: `versions: installed paramour ${core} != ${declared}, the version @paramour-js/next ${next} depends on`,
|
|
224
243
|
status: "warn",
|
|
225
244
|
};
|
|
226
245
|
}
|
|
227
246
|
return {
|
|
228
|
-
label: `versions: paramour
|
|
247
|
+
label: `versions: paramour ${core} satisfies @paramour-js/next ${next}'s declared dependency`,
|
|
229
248
|
status: "pass",
|
|
230
249
|
};
|
|
231
250
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
1
|
export { RouteCollisionError } from "./collisions.js";
|
|
2
2
|
export { type ParamourConfig } from "./config.js";
|
|
3
|
-
export { emitArtifact, type EmitRoutes, writeIfChanged, type WriteIfChangedResult, } from "./emit.js";
|
|
4
|
-
export { type AcquireLockResult, acquireWatcherLock } from "./lock.js";
|
|
5
|
-
export { DEFAULT_PAGE_EXTENSIONS, scanAppRoutes } from "./scan-app.js";
|
|
6
|
-
export { scanPagesRoutes } from "./scan-pages.js";
|
|
7
|
-
export { resolveRouteDirs, type RouteDirs, scanRoutes, type ScanRoutesResult, } from "./scan.js";
|
|
8
|
-
export { DEFAULT_DEBOUNCE_MS, type RouteDirsWatcher, watchRouteDirs, type WatchRouteDirsOptions, } from "./watch.js";
|
|
9
3
|
export { withTypedRoutes, type WithTypedRoutesOptions, } from "./with-typed-routes.js";
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
1
|
export { RouteCollisionError } from "./collisions.js";
|
|
2
2
|
export {} from "./config.js";
|
|
3
|
-
export { emitArtifact, writeIfChanged, } from "./emit.js";
|
|
4
|
-
export { acquireWatcherLock } from "./lock.js";
|
|
5
|
-
export { DEFAULT_PAGE_EXTENSIONS, scanAppRoutes } from "./scan-app.js";
|
|
6
|
-
export { scanPagesRoutes } from "./scan-pages.js";
|
|
7
|
-
export { resolveRouteDirs, scanRoutes, } from "./scan.js";
|
|
8
|
-
export { DEFAULT_DEBOUNCE_MS, watchRouteDirs, } from "./watch.js";
|
|
9
3
|
export { withTypedRoutes, } from "./with-typed-routes.js";
|
package/dist/pages.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
// Extensionful on purpose: `next` ships no `exports` map, so when this
|
|
2
|
+
// package is loaded as an external (Node ESM resolution during Next 15's
|
|
3
|
+
// "Collecting page data") the bare `next/router` specifier dies with
|
|
4
|
+
// ERR_MODULE_NOT_FOUND — only the physical root stub `next/router.js`
|
|
5
|
+
// resolves, and it is the exact module the bare specifier aliases to under
|
|
6
|
+
// every bundler. Guarded by the examples/next-compat build-app.
|
|
7
|
+
import { useRouter } from "next/router.js";
|
|
2
8
|
import { ParamourError, safeDecodeParams, safeDecodeSearch, } from "paramour";
|
|
3
9
|
import { recordWireSnapshot } from "./devtools-seam.js";
|
|
4
10
|
import { makePagesNavigate, useDevtoolsEmitter, } from "./observe.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paramour-js/next",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
"paramour": "./bin/paramour.js"
|
|
25
25
|
},
|
|
26
26
|
"engines": {
|
|
27
|
-
"node": ">=
|
|
27
|
+
"node": ">=22.13.0"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"jiti": "^2.7.0",
|
|
31
31
|
"magicast": "^0.3.5",
|
|
32
32
|
"tinyglobby": "^0.2.15",
|
|
33
|
-
"paramour": "0.
|
|
33
|
+
"paramour": "0.5.0"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"next": ">=15",
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
},
|
|
71
71
|
"scripts": {
|
|
72
72
|
"build": "tsc -p tsconfig.build.json",
|
|
73
|
+
"check:publish": "publint --strict && attw --pack . --profile esm-only",
|
|
73
74
|
"typecheck": "tsc --noEmit"
|
|
74
75
|
}
|
|
75
76
|
}
|