@portel/photon 1.28.0 → 1.28.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.
- package/dist/auto-ui/beam.d.ts.map +1 -1
- package/dist/auto-ui/beam.js +17 -4
- package/dist/auto-ui/beam.js.map +1 -1
- package/dist/daemon/server.js +39 -0
- package/dist/daemon/server.js.map +1 -1
- package/dist/deploy/cloudflare.d.ts.map +1 -1
- package/dist/deploy/cloudflare.js +17 -4
- package/dist/deploy/cloudflare.js.map +1 -1
- package/dist/loader.d.ts +1 -0
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +3 -9
- package/dist/loader.js.map +1 -1
- package/dist/shared/http-route-extractor.d.ts +23 -0
- package/dist/shared/http-route-extractor.d.ts.map +1 -0
- package/dist/shared/http-route-extractor.js +11 -0
- package/dist/shared/http-route-extractor.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Source-level extractor for `@get` and `@post` HTTP route declarations.
|
|
3
|
+
*
|
|
4
|
+
* Both the runtime loader and the Cloudflare deploy code-gen need to know
|
|
5
|
+
* which class methods are bound to HTTP routes. The photon-core
|
|
6
|
+
* `SchemaExtractor` does not return route metadata in every published
|
|
7
|
+
* version, so callers MUST NOT rely on it: this regex-based extractor
|
|
8
|
+
* runs against the raw source and always produces a stable shape.
|
|
9
|
+
*
|
|
10
|
+
* Why a separate module: prior to v1.28.1 the regex lived inside the
|
|
11
|
+
* loader as a private method, so the deploy path silently fell back to
|
|
12
|
+
* `metadata.httpRoutes ?? []` from photon-core. With photon-core 2.25.0,
|
|
13
|
+
* that field is always undefined — every Cloudflare deploy with @get/@post
|
|
14
|
+
* routes (other than `@get /`) shipped an empty subclass route table and
|
|
15
|
+
* 404'd in production. See tests/cf-deploy-codegen.test.ts.
|
|
16
|
+
*/
|
|
17
|
+
export interface HttpRouteDef {
|
|
18
|
+
method: string;
|
|
19
|
+
path: string;
|
|
20
|
+
handler: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function extractHttpRoutesFromSource(source: string): HttpRouteDef[];
|
|
23
|
+
//# sourceMappingURL=http-route-extractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-route-extractor.d.ts","sourceRoot":"","sources":["../../src/shared/http-route-extractor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAID,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,EAAE,CAQ1E"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const ROUTE_RE = /\/\*\*[\s\S]*?@(get|post)\s+(\/[^\s*]*)[\s\S]*?\*\/\s*(?:async\s+)?(\w+)\s*\(/gi;
|
|
2
|
+
export function extractHttpRoutesFromSource(source) {
|
|
3
|
+
const routes = [];
|
|
4
|
+
ROUTE_RE.lastIndex = 0;
|
|
5
|
+
let m;
|
|
6
|
+
while ((m = ROUTE_RE.exec(source)) !== null) {
|
|
7
|
+
routes.push({ method: m[1].toUpperCase(), path: m[2], handler: m[3] });
|
|
8
|
+
}
|
|
9
|
+
return routes;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=http-route-extractor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-route-extractor.js","sourceRoot":"","sources":["../../src/shared/http-route-extractor.ts"],"names":[],"mappings":"AAsBA,MAAM,QAAQ,GAAG,iFAAiF,CAAC;AAEnG,MAAM,UAAU,2BAA2B,CAAC,MAAc;IACxD,MAAM,MAAM,GAAmB,EAAE,CAAC;IAClC,QAAQ,CAAC,SAAS,GAAG,CAAC,CAAC;IACvB,IAAI,CAAyB,CAAC;IAC9B,OAAO,CAAC,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QAC5C,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACzE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
CHANGED