@exposify/next 0.0.6 → 0.0.7
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/README.md +3 -1
- package/dist/exposify-next.js +13 -5
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -187,7 +187,9 @@ why; `npx @exposify/next test-sign-in` signs in on your running app and checks
|
|
|
187
187
|
a protected page accepts the cookie. If your `proxy.ts` sends signed-out
|
|
188
188
|
visitors to the login page (Supabase's starter does), it would send AI
|
|
189
189
|
assistants there too, before they can sign in: `inspect` warns, and
|
|
190
|
-
`setup --apply` leaves `/mcp`
|
|
190
|
+
`setup --apply` leaves `/mcp` and `/.well-known/oauth-protected-resource` out
|
|
191
|
+
of its matcher (a matcher that already leaves out `/mcp` gets the second one
|
|
192
|
+
added). Your pages still go through
|
|
191
193
|
it on tool calls. `@supabase/auth-helpers-nextjs` (an
|
|
192
194
|
older cookie format) isn't supported, and apps on `@supabase/supabase-js`
|
|
193
195
|
alone keep their session in the browser, where the server never sees it.
|
package/dist/exposify-next.js
CHANGED
|
@@ -2649,6 +2649,7 @@ function scanActions(d, call, root, notes, suggestions = []) {
|
|
|
2649
2649
|
// bin/proxy.ts
|
|
2650
2650
|
import { existsSync as existsSync4, readFileSync as readFileSync9 } from "fs";
|
|
2651
2651
|
import { join as join9 } from "path";
|
|
2652
|
+
import { PRM_PATH } from "@exposify/core";
|
|
2652
2653
|
var FILES = ["", "src/"].flatMap((dir) => ["proxy", "middleware"].flatMap((name) => [".ts", ".js", ".mjs"].map((ext) => `${dir}${name}${ext}`)));
|
|
2653
2654
|
var REDIRECT = /\bredirect\s*\(/;
|
|
2654
2655
|
function matcherRegExp(pattern) {
|
|
@@ -2729,15 +2730,22 @@ function findProxyGate(root, mcpPath = "/mcp") {
|
|
|
2729
2730
|
if (matcher === null) return { file, mcpPath, matching: [] };
|
|
2730
2731
|
const entries = matcherEntries(matcher);
|
|
2731
2732
|
if (!entries) return void 0;
|
|
2732
|
-
const probes =
|
|
2733
|
+
const probes = exclusions(mcpPath).flatMap((x) => x.probes);
|
|
2733
2734
|
const matching = entries.filter((e) => probes.some((p) => matcherRegExp(e.pattern)?.test(p))).map((e) => e.pattern);
|
|
2734
2735
|
return matching.length > 0 ? { file, mcpPath, matching } : void 0;
|
|
2735
2736
|
}
|
|
2736
2737
|
function proxyGateHint(gate) {
|
|
2737
|
-
return `${gate.file} sends signed-out requests to another page and runs on ${gate.mcpPath}, so AI assistants get that page instead of a sign-in. Leave ${gate.mcpPath} out of its matcher (the MCP route checks its own callers): ` + (gate.matching.some((p) => p.startsWith("/((?!")) ? `add ${
|
|
2738
|
+
return `${gate.file} sends signed-out requests to another page and runs on ${gate.mcpPath}, so AI assistants get that page instead of a sign-in. Leave ${gate.mcpPath} and ${PRM_PATH} out of its matcher (the MCP route checks its own callers): ` + (gate.matching.some((p) => p.startsWith("/((?!")) ? `add ${inSource(gate.mcpPath)}| after "(?!" in config.matcher.` : `matcher: ["/((?!${inSource(gate.mcpPath)}).*)"].`);
|
|
2738
2739
|
}
|
|
2739
|
-
var
|
|
2740
|
-
|
|
2740
|
+
var exclusions = (mcpPath) => [
|
|
2741
|
+
{
|
|
2742
|
+
alt: `${mcpPath.replace(/^\/+|\/+$/g, "").replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}(?:/|$)`,
|
|
2743
|
+
probes: [mcpPath, `${mcpPath.replace(/\/$/, "")}/login`]
|
|
2744
|
+
},
|
|
2745
|
+
{ alt: String.raw`\.well-known/oauth-protected-resource(?:/|$)`, probes: [`${PRM_PATH}${mcpPath}`] }
|
|
2746
|
+
];
|
|
2747
|
+
var exclusion = (mcpPath, pattern) => exclusions(mcpPath).filter((x) => pattern === void 0 || x.probes.some((p) => matcherRegExp(pattern)?.test(p))).map((x) => x.alt).join("|");
|
|
2748
|
+
var inSource = (mcpPath, pattern) => exclusion(mcpPath, pattern).replace(/\\/g, "\\\\");
|
|
2741
2749
|
function excludeMcpFromProxy(root, gate) {
|
|
2742
2750
|
const file = join9(root, gate.file);
|
|
2743
2751
|
const before = readFileSync9(file, "utf8");
|
|
@@ -2762,7 +2770,7 @@ export const config = {
|
|
|
2762
2770
|
const at = raw.indexOf("/((?!");
|
|
2763
2771
|
if (at < 0) return { blocked: `${gate.file}'s matcher "${e.pattern}" has no "(?!" to add ${gate.mcpPath} to` };
|
|
2764
2772
|
const insert = e.node.start + at + "/((?!".length;
|
|
2765
|
-
after = `${after.slice(0, insert)}${inSource(gate.mcpPath)}|${after.slice(insert)}`;
|
|
2773
|
+
after = `${after.slice(0, insert)}${inSource(gate.mcpPath, e.pattern)}|${after.slice(insert)}`;
|
|
2766
2774
|
}
|
|
2767
2775
|
return { plan: { file, summary, before, after } };
|
|
2768
2776
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exposify/next",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/parser": "^8.0.0",
|
|
35
|
-
"@exposify/cli": "0.0.
|
|
35
|
+
"@exposify/cli": "0.0.6",
|
|
36
36
|
"@exposify/core": "0.3.16",
|
|
37
37
|
"tinyglobby": "^0.2.10",
|
|
38
38
|
"zod": "^3.24.0"
|