@ms-cloudpack/common-types 0.19.2 → 0.19.4

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,3 +1,6 @@
1
+ /**
2
+ * Expanded info about a source path, as used in processed route configs.
3
+ */
1
4
  export interface ExpandedSourcePath {
2
5
  /**
3
6
  * The relative path to the source file. (e.g. `./src/index.ts`)
@@ -1 +1 @@
1
- {"version":3,"file":"ExpandedSourcePath.d.ts","sourceRoot":"","sources":["../src/ExpandedSourcePath.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB"}
1
+ {"version":3,"file":"ExpandedSourcePath.d.ts","sourceRoot":"","sources":["../src/ExpandedSourcePath.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB"}
@@ -1 +1 @@
1
- {"version":3,"file":"ExpandedSourcePath.js","sourceRoot":"","sources":["../src/ExpandedSourcePath.ts"],"names":[],"mappings":"","sourcesContent":["export interface ExpandedSourcePath {\n /**\n * The relative path to the source file. (e.g. `./src/index.ts`)\n */\n sourcePath: string;\n\n /**\n * The path to import the resulting bundled output from. This would represent the key\n * in the import map entry to be imported. (e.g. `.` represents the default package export.)\n */\n importPath: string;\n\n /**\n * The path to be requested by the browser. This would present the value in the import map\n * entry to be requested. (e.g. `./lib/index.js`)\n */\n requestPath: string;\n}\n"]}
1
+ {"version":3,"file":"ExpandedSourcePath.js","sourceRoot":"","sources":["../src/ExpandedSourcePath.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Expanded info about a source path, as used in processed route configs.\n */\nexport interface ExpandedSourcePath {\n /**\n * The relative path to the source file. (e.g. `./src/index.ts`)\n */\n sourcePath: string;\n\n /**\n * The path to import the resulting bundled output from. This would represent the key\n * in the import map entry to be imported. (e.g. `.` represents the default package export.)\n */\n importPath: string;\n\n /**\n * The path to be requested by the browser. This would present the value in the import map\n * entry to be requested. (e.g. `./lib/index.js`)\n */\n requestPath: string;\n}\n"]}
@@ -1,7 +1,55 @@
1
- import type { RenderFunctionOptions } from './RenderFunctionOptions.js';
2
- import type { RenderFunctionResult } from './RenderFunctionResult.js';
1
+ import type { Request, Response } from 'express';
2
+ import type { ImportMap } from './ImportMap.js';
3
+ import type { PackageJson } from './PackageJson.js';
4
+ import type { RenderedRoute } from './Route.js';
5
+ import type { Session } from './Session.js';
3
6
  /**
4
7
  * A custom server render function that can be used to override the default HTML response.
5
8
  */
6
9
  export type RenderFunction = (options: RenderFunctionOptions) => Promise<RenderFunctionResult> | RenderFunctionResult;
10
+ /**
11
+ * The input options for a `renderScript` custom server render function.
12
+ */
13
+ export interface RenderFunctionOptions {
14
+ session: Session;
15
+ route: RenderedRoute;
16
+ baseUrl: string;
17
+ definition: PackageJson;
18
+ importMap: ImportMap;
19
+ overlayScript?: string;
20
+ entryScripts?: string[];
21
+ inlineScripts?: string[];
22
+ req: Request;
23
+ res: Response;
24
+ /** @deprecated use entryScripts. */
25
+ entryScript?: string;
26
+ }
27
+ /**
28
+ * The complete expected result of the `renderScript` custom server render function.
29
+ */
30
+ export interface ExpandedRenderFunctionResult {
31
+ /** Response body */
32
+ content: string;
33
+ /** Standard HTTP status code - https://developer.mozilla.org/en-US/docs/Web/HTTP/Status */
34
+ statusCode: number;
35
+ /** MIME type for the response - https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types */
36
+ contentType: string;
37
+ }
38
+ /**
39
+ * The expected result of the `renderScript` custom server render function.
40
+ *
41
+ * - If a string, it's assumed to be the HTML content.
42
+ * - If an object and the `content` is non-HTML, `contentType` must be set.
43
+ * - If null, this means the function fully handled the request (sent a response using
44
+ * `options.res.send('...')` or other methods).
45
+ */
46
+ export type RenderFunctionResult = string | null | ({
47
+ content: string;
48
+ } & Partial<ExpandedRenderFunctionResult>);
49
+ /**
50
+ * The expected shape of the `renderScript` custom server render function JS file.
51
+ */
52
+ export type RenderFunctionScript = {
53
+ default: RenderFunction;
54
+ };
7
55
  //# sourceMappingURL=RenderFunction.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RenderFunction.d.ts","sourceRoot":"","sources":["../src/RenderFunction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEtE;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,qBAAqB,KAAK,OAAO,CAAC,oBAAoB,CAAC,GAAG,oBAAoB,CAAC"}
1
+ {"version":3,"file":"RenderFunction.d.ts","sourceRoot":"","sources":["../src/RenderFunction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,qBAAqB,KAAK,OAAO,CAAC,oBAAoB,CAAC,GAAG,oBAAoB,CAAC;AAEtH;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,aAAa,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,WAAW,CAAC;IACxB,SAAS,EAAE,SAAS,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,GAAG,EAAE,OAAO,CAAC;IACb,GAAG,EAAE,QAAQ,CAAC;IAEd,oCAAoC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,oBAAoB;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,2FAA2F;IAC3F,UAAU,EAAE,MAAM,CAAC;IACnB,4HAA4H;IAC5H,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,IAAI,GAAG,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC,CAAC;AAEjH;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IAAE,OAAO,EAAE,cAAc,CAAA;CAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"RenderFunction.js","sourceRoot":"","sources":["../src/RenderFunction.ts"],"names":[],"mappings":"","sourcesContent":["import type { RenderFunctionOptions } from './RenderFunctionOptions.js';\nimport type { RenderFunctionResult } from './RenderFunctionResult.js';\n\n/**\n * A custom server render function that can be used to override the default HTML response.\n */\nexport type RenderFunction = (options: RenderFunctionOptions) => Promise<RenderFunctionResult> | RenderFunctionResult;\n"]}
1
+ {"version":3,"file":"RenderFunction.js","sourceRoot":"","sources":["../src/RenderFunction.ts"],"names":[],"mappings":"","sourcesContent":["import type { Request, Response } from 'express';\nimport type { ImportMap } from './ImportMap.js';\nimport type { PackageJson } from './PackageJson.js';\nimport type { RenderedRoute } from './Route.js';\nimport type { Session } from './Session.js';\n\n/**\n * A custom server render function that can be used to override the default HTML response.\n */\nexport type RenderFunction = (options: RenderFunctionOptions) => Promise<RenderFunctionResult> | RenderFunctionResult;\n\n/**\n * The input options for a `renderScript` custom server render function.\n */\nexport interface RenderFunctionOptions {\n session: Session;\n route: RenderedRoute;\n baseUrl: string;\n definition: PackageJson;\n importMap: ImportMap;\n overlayScript?: string;\n entryScripts?: string[];\n inlineScripts?: string[];\n req: Request;\n res: Response;\n\n /** @deprecated use entryScripts. */\n entryScript?: string;\n}\n\n/**\n * The complete expected result of the `renderScript` custom server render function.\n */\nexport interface ExpandedRenderFunctionResult {\n /** Response body */\n content: string;\n /** Standard HTTP status code - https://developer.mozilla.org/en-US/docs/Web/HTTP/Status */\n statusCode: number;\n /** MIME type for the response - https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types */\n contentType: string;\n}\n\n/**\n * The expected result of the `renderScript` custom server render function.\n *\n * - If a string, it's assumed to be the HTML content.\n * - If an object and the `content` is non-HTML, `contentType` must be set.\n * - If null, this means the function fully handled the request (sent a response using\n * `options.res.send('...')` or other methods).\n */\nexport type RenderFunctionResult = string | null | ({ content: string } & Partial<ExpandedRenderFunctionResult>);\n\n/**\n * The expected shape of the `renderScript` custom server render function JS file.\n */\nexport type RenderFunctionScript = { default: RenderFunction };\n"]}
package/lib/Route.d.ts CHANGED
@@ -1,8 +1,11 @@
1
1
  import type { ExpandedSourcePath } from './ExpandedSourcePath.js';
2
2
  export interface SharedRouteOptions {
3
3
  /**
4
- * The url path part to match. Start paths with a leading slash, e.g. `'/my-route'`. You can also
5
- * use wildcards (`*`), e.g. `'/my-route/*'` to match all paths starting with `'/my-route'`.
4
+ * The URL path to match. Paths should usually start with a slash, e.g. `'/my-route'`.
5
+ * You can also use wildcards (`*`), e.g. `'/my-route/*'` to match all paths starting with `'/my-route'`.
6
+ *
7
+ * See the [Express docs](https://expressjs.com/en/guide/routing.html#route-paths) for the full
8
+ * supported routing syntax.
6
9
  *
7
10
  * Use an array to handle multiple paths with the same route handler.
8
11
  */
@@ -15,12 +18,13 @@ export interface SharedRouteOptions {
15
18
  export interface ShorthandRenderedRoute extends SharedRouteOptions {
16
19
  /**
17
20
  * Path to a .js or .html file used for rendering the route. If a script is provided, it must
18
- * export a default function implementing `RenderRouteFunction` defined in `@ms-cloudpack/app-server`.
21
+ * export a default function implementing `RenderRouteFunction` defined in `@ms-cloudpack/common-types`.
19
22
  */
20
23
  renderScript?: string;
21
24
  /**
22
- * @deprecated - The key in the exports map which represents the entry point app script for this route.
25
+ * The key in the exports map which represents the entry point app script for this route.
23
26
  * Default is '.', meaning the main package export key.
27
+ * @deprecated Use `entry` instead.
24
28
  */
25
29
  exportEntry?: string;
26
30
  /**
@@ -34,7 +38,7 @@ export interface ShorthandRenderedRoute extends SharedRouteOptions {
34
38
  */
35
39
  export type RenderedRoute = Omit<ShorthandRenderedRoute, 'exportEntry' | 'entry'> & {
36
40
  /**
37
- * To be implemented. The source entry or entries to be included on the page for this route.
41
+ * The source entry or entries to be included on the page for this route.
38
42
  */
39
43
  entry?: ExpandedSourcePath[];
40
44
  };
@@ -50,9 +54,14 @@ export interface StaticRoute extends SharedRouteOptions {
50
54
  /**
51
55
  * A route that serves a bootstrap script.
52
56
  */
53
- export interface BootstrapRoute extends SharedRouteOptions, Pick<RenderedRoute, 'entry'> {
57
+ export interface ShorthandBootstrapRoute extends SharedRouteOptions, Pick<ShorthandRenderedRoute, 'entry' | 'exportEntry'> {
54
58
  type: 'bootstrap';
55
59
  }
60
+ /**
61
+ * A route that serves a bootstrap script.
62
+ */
63
+ export interface BootstrapRoute extends Omit<ShorthandBootstrapRoute, 'entry'>, Pick<RenderedRoute, 'entry'> {
64
+ }
56
65
  /**
57
66
  * A route that redirects to another url.
58
67
  */
@@ -62,31 +71,33 @@ export interface RedirectRoute extends SharedRouteOptions {
62
71
  */
63
72
  redirectTo: string;
64
73
  }
65
- /**
66
- * Internal helper for all route types except `RenderedRoute`/`ShorthandRenderedRoute`
67
- * (to ensure any new route types are included in both `Route` and `ShorthandRoute`).
68
- */
69
- type OtherRoute = StaticRoute | BootstrapRoute | RedirectRoute;
70
74
  /**
71
75
  * Route as specified in `AppConfig` (`cloudpack.config.json`).
72
76
  */
73
- export type ShorthandRoute = ShorthandRenderedRoute | OtherRoute;
77
+ export type ShorthandRoute = ShorthandRenderedRoute | ShorthandBootstrapRoute | StaticRoute | RedirectRoute;
74
78
  /**
75
79
  * Processed route as used in the processed `CloudpackConfig`.
76
80
  */
77
- export type Route = RenderedRoute | OtherRoute;
81
+ export type Route = RenderedRoute | BootstrapRoute | StaticRoute | RedirectRoute;
78
82
  /**
79
83
  * Type guard to check if a route is a static route.
80
84
  */
81
- export declare function isStaticRoute(route: Route): route is StaticRoute;
85
+ export declare function isStaticRoute(route: Route | ShorthandRoute): route is StaticRoute;
82
86
  /**
83
87
  * Type guard to check if a route is a bootstrap route.
84
88
  */
85
89
  export declare function isBootstrapRoute(route: Route): route is BootstrapRoute;
90
+ /**
91
+ * Type guard to check if a route is a shorthand bootstrap route.
92
+ */
93
+ export declare function isShorthandBootstrapRoute(route: ShorthandRoute): route is ShorthandBootstrapRoute;
86
94
  export declare function isRenderedRoute(route: Route): route is RenderedRoute;
95
+ /**
96
+ * Type guard to check if a route is a shorthand rendered route.
97
+ */
98
+ export declare function isShorthandRenderedRoute(route: ShorthandRoute): route is ShorthandRenderedRoute;
87
99
  /**
88
100
  * Type guard to check if a route is a redirect route.
89
101
  */
90
- export declare function isRedirectRoute(route: Route): route is RedirectRoute;
91
- export {};
102
+ export declare function isRedirectRoute(route: Route | ShorthandRoute): route is RedirectRoute;
92
103
  //# sourceMappingURL=Route.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Route.d.ts","sourceRoot":"","sources":["../src/Route.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE,MAAM,WAAW,kBAAkB;IACjC;;;;;OAKG;IACH,KAA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AsB,GAAG,uBAAuB,GAAG,WAAW,GAAG,aAAa,CAAC;AAE5G;;GAEG;AAEH,MAAM,MAAM,KAAK,GAAG,aAAa,GAAG,cAAc,GAAG,WAAW,GAAG,aAAa,CAAC;AAEjF;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,cAAc,GAAG,KAAK,IAAI,WAAW,CAEjF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,IAAI,cAAc,CAEtE;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,cAAc,GAAG,KAAK,IAAI,uBAAuB,CAEjG;AAKD,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,IAAI,aAAa,CAGpE;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,cAAc,GAAG,KAAK,IAAI,sBAAsB,CAE/F;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,cAAc,GAAG,KAAK,IAAI,aAAa,CAErF"}
package/lib/Route.js CHANGED
@@ -10,6 +10,12 @@ export function isStaticRoute(route) {
10
10
  export function isBootstrapRoute(route) {
11
11
  return 'type' in route && route.type === 'bootstrap';
12
12
  }
13
+ /**
14
+ * Type guard to check if a route is a shorthand bootstrap route.
15
+ */
16
+ export function isShorthandBootstrapRoute(route) {
17
+ return isBootstrapRoute(route);
18
+ }
13
19
  /*
14
20
  * Type guard to check if a route is a rendered route.
15
21
  */
@@ -17,6 +23,12 @@ export function isRenderedRoute(route) {
17
23
  const maybeRenderedRoute = route;
18
24
  return !isBootstrapRoute(route) && !!(maybeRenderedRoute.renderScript || maybeRenderedRoute.entry);
19
25
  }
26
+ /**
27
+ * Type guard to check if a route is a shorthand rendered route.
28
+ */
29
+ export function isShorthandRenderedRoute(route) {
30
+ return isRenderedRoute(route) || 'exportEntry' in route;
31
+ }
20
32
  /**
21
33
  * Type guard to check if a route is a redirect route.
22
34
  */
package/lib/Route.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Route.js","sourceRoot":"","sources":["../src/Route.ts"],"names":[],"mappings":"AAyFA;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,KAAY;IACxC,OAAO,YAAY,IAAI,KAAK,CAAC;AAC/B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAY;IAC3C,OAAO,MAAM,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,CAAC;AACvD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,KAAY;IAC1C,MAAM,kBAAkB,GAAG,KAAsB,CAAC;IAClD,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,kBAAkB,CAAC,YAAY,IAAI,kBAAkB,CAAC,KAAK,CAAC,CAAC;AACrG,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,KAAY;IAC1C,OAAO,YAAY,IAAI,KAAK,CAAC;AAC/B,CAAC","sourcesContent":["import type { ExpandedSourcePath } from './ExpandedSourcePath.js';\n\nexport interface SharedRouteOptions {\n /**\n * The url path part to match. Start paths with a leading slash, e.g. `'/my-route'`. You can also\n * use wildcards (`*`), e.g. `'/my-route/*'` to match all paths starting with `'/my-route'`.\n *\n * Use an array to handle multiple paths with the same route handler.\n */\n match: string | string[];\n}\n\n/**\n * A server-rendered route with optional shorthand `entry` info (as specified in `AppConfig`/`cloudpack.config.json`).\n * The route is rendered by a custom server script in Cloudpack.\n */\nexport interface ShorthandRenderedRoute extends SharedRouteOptions {\n /**\n * Path to a .js or .html file used for rendering the route. If a script is provided, it must\n * export a default function implementing `RenderRouteFunction` defined in `@ms-cloudpack/app-server`.\n */\n renderScript?: string;\n\n /**\n * @deprecated - The key in the exports map which represents the entry point app script for this route.\n * Default is '.', meaning the main package export key.\n */\n exportEntry?: string;\n\n /**\n * The source entry or entries to be included on the page for this route.\n */\n entry?: string | string[];\n}\n\n/**\n * A server-rendered route with full `entry` info (used in the processed `CloudpackConfig`).\n * The route is rendered by a custom server script in Cloudpack.\n */\nexport type RenderedRoute = Omit<ShorthandRenderedRoute, 'exportEntry' | 'entry'> & {\n /**\n * To be implemented. The source entry or entries to be included on the page for this route.\n */\n entry?: ExpandedSourcePath[];\n};\n\n/**\n * A route with a staticPath property serves static files from the specified path.\n */\nexport interface StaticRoute extends SharedRouteOptions {\n /**\n * The path relative to the app root to static assets.\n */\n staticPath: string;\n}\n\n/**\n * A route that serves a bootstrap script.\n */\nexport interface BootstrapRoute extends SharedRouteOptions, Pick<RenderedRoute, 'entry'> {\n type: 'bootstrap';\n}\n\n/**\n * A route that redirects to another url.\n */\nexport interface RedirectRoute extends SharedRouteOptions {\n /**\n * The url to redirect to.\n */\n redirectTo: string;\n}\n\n/**\n * Internal helper for all route types except `RenderedRoute`/`ShorthandRenderedRoute`\n * (to ensure any new route types are included in both `Route` and `ShorthandRoute`).\n */\ntype OtherRoute = StaticRoute | BootstrapRoute | RedirectRoute;\n\n/**\n * Route as specified in `AppConfig` (`cloudpack.config.json`).\n */\nexport type ShorthandRoute = ShorthandRenderedRoute | OtherRoute;\n\n/**\n * Processed route as used in the processed `CloudpackConfig`.\n */\nexport type Route = RenderedRoute | OtherRoute;\n\n/**\n * Type guard to check if a route is a static route.\n */\nexport function isStaticRoute(route: Route): route is StaticRoute {\n return 'staticPath' in route;\n}\n\n/**\n * Type guard to check if a route is a bootstrap route.\n */\nexport function isBootstrapRoute(route: Route): route is BootstrapRoute {\n return 'type' in route && route.type === 'bootstrap';\n}\n\n/*\n * Type guard to check if a route is a rendered route.\n */\nexport function isRenderedRoute(route: Route): route is RenderedRoute {\n const maybeRenderedRoute = route as RenderedRoute;\n return !isBootstrapRoute(route) && !!(maybeRenderedRoute.renderScript || maybeRenderedRoute.entry);\n}\n\n/**\n * Type guard to check if a route is a redirect route.\n */\nexport function isRedirectRoute(route: Route): route is RedirectRoute {\n return 'redirectTo' in route;\n}\n"]}
1
+ {"version":3,"file":"Route.js","sourceRoot":"","sources":["../src/Route.ts"],"names":[],"mappings":"AAgGA;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,KAA6B;IACzD,OAAO,YAAY,IAAI,KAAK,CAAC;AAC/B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAY;IAC3C,OAAO,MAAM,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,CAAC;AACvD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,yBAAyB,CAAC,KAAqB;IAC7D,OAAO,gBAAgB,CAAC,KAAc,CAAC,CAAC;AAC1C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,KAAY;IAC1C,MAAM,kBAAkB,GAAG,KAAsB,CAAC;IAClD,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,kBAAkB,CAAC,YAAY,IAAI,kBAAkB,CAAC,KAAK,CAAC,CAAC;AACrG,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAqB;IAC5D,OAAO,eAAe,CAAC,KAAc,CAAC,IAAI,aAAa,IAAI,KAAK,CAAC;AACnE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,KAA6B;IAC3D,OAAO,YAAY,IAAI,KAAK,CAAC;AAC/B,CAAC","sourcesContent":["import type { ExpandedSourcePath } from './ExpandedSourcePath.js';\n\nexport interface SharedRouteOptions {\n /**\n * The URL path to match. Paths should usually start with a slash, e.g. `'/my-route'`.\n * You can also use wildcards (`*`), e.g. `'/my-route/*'` to match all paths starting with `'/my-route'`.\n *\n * See the [Express docs](https://expressjs.com/en/guide/routing.html#route-paths) for the full\n * supported routing syntax.\n *\n * Use an array to handle multiple paths with the same route handler.\n */\n match: string | string[];\n}\n\n/**\n * A server-rendered route with optional shorthand `entry` info (as specified in `AppConfig`/`cloudpack.config.json`).\n * The route is rendered by a custom server script in Cloudpack.\n */\nexport interface ShorthandRenderedRoute extends SharedRouteOptions {\n /**\n * Path to a .js or .html file used for rendering the route. If a script is provided, it must\n * export a default function implementing `RenderRouteFunction` defined in `@ms-cloudpack/common-types`.\n */\n renderScript?: string;\n\n /**\n * The key in the exports map which represents the entry point app script for this route.\n * Default is '.', meaning the main package export key.\n * @deprecated Use `entry` instead.\n */\n exportEntry?: string;\n\n /**\n * The source entry or entries to be included on the page for this route.\n */\n entry?: string | string[];\n}\n\n/**\n * A server-rendered route with full `entry` info (used in the processed `CloudpackConfig`).\n * The route is rendered by a custom server script in Cloudpack.\n */\nexport type RenderedRoute = Omit<ShorthandRenderedRoute, 'exportEntry' | 'entry'> & {\n /**\n * The source entry or entries to be included on the page for this route.\n */\n entry?: ExpandedSourcePath[];\n};\n\n/**\n * A route with a staticPath property serves static files from the specified path.\n */\nexport interface StaticRoute extends SharedRouteOptions {\n /**\n * The path relative to the app root to static assets.\n */\n staticPath: string;\n}\n\n/**\n * A route that serves a bootstrap script.\n */\nexport interface ShorthandBootstrapRoute\n extends SharedRouteOptions,\n Pick<ShorthandRenderedRoute, 'entry' | 'exportEntry'> {\n type: 'bootstrap';\n}\n\n/**\n * A route that serves a bootstrap script.\n */\nexport interface BootstrapRoute extends Omit<ShorthandBootstrapRoute, 'entry'>, Pick<RenderedRoute, 'entry'> {}\n\n/**\n * A route that redirects to another url.\n */\nexport interface RedirectRoute extends SharedRouteOptions {\n /**\n * The url to redirect to.\n */\n redirectTo: string;\n}\n\n/**\n * Route as specified in `AppConfig` (`cloudpack.config.json`).\n */\n// WARNING: Be sure to add new route types to Route as well!\nexport type ShorthandRoute = ShorthandRenderedRoute | ShorthandBootstrapRoute | StaticRoute | RedirectRoute;\n\n/**\n * Processed route as used in the processed `CloudpackConfig`.\n */\n// WARNING: Be sure to add new route types to ShorthandRoute as well!\nexport type Route = RenderedRoute | BootstrapRoute | StaticRoute | RedirectRoute;\n\n/**\n * Type guard to check if a route is a static route.\n */\nexport function isStaticRoute(route: Route | ShorthandRoute): route is StaticRoute {\n return 'staticPath' in route;\n}\n\n/**\n * Type guard to check if a route is a bootstrap route.\n */\nexport function isBootstrapRoute(route: Route): route is BootstrapRoute {\n return 'type' in route && route.type === 'bootstrap';\n}\n\n/**\n * Type guard to check if a route is a shorthand bootstrap route.\n */\nexport function isShorthandBootstrapRoute(route: ShorthandRoute): route is ShorthandBootstrapRoute {\n return isBootstrapRoute(route as Route);\n}\n\n/*\n * Type guard to check if a route is a rendered route.\n */\nexport function isRenderedRoute(route: Route): route is RenderedRoute {\n const maybeRenderedRoute = route as RenderedRoute;\n return !isBootstrapRoute(route) && !!(maybeRenderedRoute.renderScript || maybeRenderedRoute.entry);\n}\n\n/**\n * Type guard to check if a route is a shorthand rendered route.\n */\nexport function isShorthandRenderedRoute(route: ShorthandRoute): route is ShorthandRenderedRoute {\n return isRenderedRoute(route as Route) || 'exportEntry' in route;\n}\n\n/**\n * Type guard to check if a route is a redirect route.\n */\nexport function isRedirectRoute(route: Route | ShorthandRoute): route is RedirectRoute {\n return 'redirectTo' in route;\n}\n"]}
package/lib/index.d.ts CHANGED
@@ -13,21 +13,19 @@ export type { BundlerPluginResult } from './BundlerPluginResult.js';
13
13
  export type { BundlerPlugin } from './BundlerPlugin.js';
14
14
  export type { CloudpackConfig } from './CloudpackConfig.js';
15
15
  export type { DevServer } from './DevServer.js';
16
+ export type { ExpandedSourcePath } from './ExpandedSourcePath.js';
16
17
  export type { Feature } from './Feature.js';
17
18
  export type { Features } from './Features.js';
18
19
  export type { GeneratedConfig } from './GeneratedConfig.js';
19
20
  export type { HttpsConfig } from './HttpsConfig.js';
20
21
  export type { ModuleType } from './ModuleType.js';
21
22
  export type { PackageSettings, PackageSettingsMatch, GeneratedPackageSettings } from './PackageSettings.js';
22
- export type { BootstrapRoute, RedirectRoute, RenderedRoute, Route, SharedRouteOptions, ShorthandRenderedRoute, ShorthandRoute, StaticRoute, } from './Route.js';
23
- export { isBootstrapRoute, isRenderedRoute, isStaticRoute, isRedirectRoute } from './Route.js';
23
+ export type { BootstrapRoute, RedirectRoute, RenderedRoute, Route, SharedRouteOptions, ShorthandRenderedRoute, ShorthandBootstrapRoute, ShorthandRoute, StaticRoute, } from './Route.js';
24
+ export { isBootstrapRoute, isRenderedRoute, isStaticRoute, isRedirectRoute, isShorthandBootstrapRoute, isShorthandRenderedRoute, } from './Route.js';
24
25
  export type { TelemetryConfig } from './TelemetryConfig.js';
25
26
  export type { AppConfig } from './AppConfig.js';
26
27
  export type { InternalBundlerCapabilityImplementations, InternalBundlerCapabilitiesMetaData, BundlerCapabilitiesOptions, ExternalBundlerCapabilityModule, BundlerCapabilityFunction, } from './BundlerCapability.js';
27
- export type { RenderFunction } from './RenderFunction.js';
28
- export type { RenderFunctionOptions } from './RenderFunctionOptions.js';
29
- export type { RenderFunctionResult, ExpandedRenderFunctionResult } from './RenderFunctionResult.js';
30
- export type { RenderFunctionScript } from './RenderFunctionScript.js';
28
+ export type { RenderFunction, RenderFunctionOptions, RenderFunctionResult, ExpandedRenderFunctionResult, RenderFunctionScript, } from './RenderFunction.js';
31
29
  export type { Request, Response } from 'express';
32
30
  export type { Session } from './Session.js';
33
31
  export type { ResolveMap } from './ResolveMap.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EACV,2BAA2B,EAC3B,0BAA0B,EAC1B,iCAAiC,EACjC,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,8BAA8B,CAAC;AACtC,YAAY,EACV,eAAe,EACf,WAAW,EACX,uBAAuB,EACvB,0BAA0B,EAC1B,kBAAkB,EAClB,wBAAwB,EACxB,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,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EACxC,mCAAmC,EACnC,0BAA0B,EAC1B,+BAA+B,EAC/B,yBAAyB,GAC1B,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACV,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,4BAA4B,EAC5B,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACjD,YAAY,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
package/lib/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  export { allFeatures } from './allFeatures.js';
2
- export { isBootstrapRoute, isRenderedRoute, isStaticRoute, isRedirectRoute } from './Route.js';
2
+ export { isBootstrapRoute, isRenderedRoute, isStaticRoute, isRedirectRoute, isShorthandBootstrapRoute, isShorthandRenderedRoute, } from './Route.js';
3
3
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AA8C/C,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC","sourcesContent":["export { allFeatures } from './allFeatures.js';\nexport type {\n GetPackageDefinitionOptions,\n PackageDefinitionTransform,\n PackageDefinitionTransformFactory,\n PackageDefinitionsCache,\n PackageImporterContext,\n} from './PackageDefinitionsCache.js';\nexport type {\n LiteralOrString,\n PackageJson,\n PackageJsonDependencies,\n PackageJsonExportCondition,\n PackageJsonExports,\n PackageJsonExportsObject,\n PackageJsonExportsValue,\n PackageJsonImports,\n} from './PackageJson.js';\nexport type { BundleContext } from './BundleContext.js';\nexport type { BundleMessage } from './BundleMessage.js';\nexport type { BundleMessageLocation } from './BundleMessageLocation.js';\nexport type { BundleMessageNote } from './BundleMessageNote.js';\nexport type { BundleMode } from './BundleMode.js';\nexport type { BundleOptions } from './BundleOptions.js';\nexport type { BundleOutputFile } from './BundleOutputFile.js';\nexport type { BundleResult } from './BundleResult.js';\nexport type { BundlerPluginResult } from './BundlerPluginResult.js';\nexport type { BundlerPlugin } from './BundlerPlugin.js';\nexport type { CloudpackConfig } from './CloudpackConfig.js';\nexport type { DevServer } from './DevServer.js';\nexport type { Feature } from './Feature.js';\nexport type { Features } from './Features.js';\nexport type { GeneratedConfig } from './GeneratedConfig.js';\nexport type { HttpsConfig } from './HttpsConfig.js';\nexport type { ModuleType } from './ModuleType.js';\nexport type { PackageSettings, PackageSettingsMatch, GeneratedPackageSettings } from './PackageSettings.js';\nexport type {\n BootstrapRoute,\n RedirectRoute,\n RenderedRoute,\n Route,\n SharedRouteOptions,\n ShorthandRenderedRoute,\n ShorthandRoute,\n StaticRoute,\n} from './Route.js';\nexport { isBootstrapRoute, isRenderedRoute, isStaticRoute, isRedirectRoute } from './Route.js';\nexport type { TelemetryConfig } from './TelemetryConfig.js';\nexport type { AppConfig } from './AppConfig.js';\nexport type {\n InternalBundlerCapabilityImplementations,\n InternalBundlerCapabilitiesMetaData,\n BundlerCapabilitiesOptions,\n ExternalBundlerCapabilityModule,\n BundlerCapabilityFunction,\n} from './BundlerCapability.js';\nexport type { RenderFunction } from './RenderFunction.js';\nexport type { RenderFunctionOptions } from './RenderFunctionOptions.js';\nexport type { RenderFunctionResult, ExpandedRenderFunctionResult } from './RenderFunctionResult.js';\nexport type { RenderFunctionScript } from './RenderFunctionScript.js';\nexport type { Request, Response } from 'express';\nexport type { Session } from './Session.js';\nexport type { ResolveMap } from './ResolveMap.js';\nexport type { ResolveMapEntry } from './ResolveMapEntry.js';\nexport type { LinkedPath } from './LinkedPath.js';\nexport type { ImportMap } from './ImportMap.js';\nexport type { UserPreferences } from './UserPreferences.js';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAgD/C,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,eAAe,EACf,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,YAAY,CAAC","sourcesContent":["export { allFeatures } from './allFeatures.js';\nexport type {\n GetPackageDefinitionOptions,\n PackageDefinitionTransform,\n PackageDefinitionTransformFactory,\n PackageDefinitionsCache,\n PackageImporterContext,\n} from './PackageDefinitionsCache.js';\nexport type {\n LiteralOrString,\n PackageJson,\n PackageJsonDependencies,\n PackageJsonExportCondition,\n PackageJsonExports,\n PackageJsonExportsObject,\n PackageJsonExportsValue,\n PackageJsonImports,\n} from './PackageJson.js';\nexport type { BundleContext } from './BundleContext.js';\nexport type { BundleMessage } from './BundleMessage.js';\nexport type { BundleMessageLocation } from './BundleMessageLocation.js';\nexport type { BundleMessageNote } from './BundleMessageNote.js';\nexport type { BundleMode } from './BundleMode.js';\nexport type { BundleOptions } from './BundleOptions.js';\nexport type { BundleOutputFile } from './BundleOutputFile.js';\nexport type { BundleResult } from './BundleResult.js';\nexport type { BundlerPluginResult } from './BundlerPluginResult.js';\nexport type { BundlerPlugin } from './BundlerPlugin.js';\nexport type { CloudpackConfig } from './CloudpackConfig.js';\nexport type { DevServer } from './DevServer.js';\nexport type { ExpandedSourcePath } from './ExpandedSourcePath.js';\nexport type { Feature } from './Feature.js';\nexport type { Features } from './Features.js';\nexport type { GeneratedConfig } from './GeneratedConfig.js';\nexport type { HttpsConfig } from './HttpsConfig.js';\nexport type { ModuleType } from './ModuleType.js';\nexport type { PackageSettings, PackageSettingsMatch, GeneratedPackageSettings } from './PackageSettings.js';\nexport type {\n BootstrapRoute,\n RedirectRoute,\n RenderedRoute,\n Route,\n SharedRouteOptions,\n ShorthandRenderedRoute,\n ShorthandBootstrapRoute,\n ShorthandRoute,\n StaticRoute,\n} from './Route.js';\nexport {\n isBootstrapRoute,\n isRenderedRoute,\n isStaticRoute,\n isRedirectRoute,\n isShorthandBootstrapRoute,\n isShorthandRenderedRoute,\n} from './Route.js';\nexport type { TelemetryConfig } from './TelemetryConfig.js';\nexport type { AppConfig } from './AppConfig.js';\nexport type {\n InternalBundlerCapabilityImplementations,\n InternalBundlerCapabilitiesMetaData,\n BundlerCapabilitiesOptions,\n ExternalBundlerCapabilityModule,\n BundlerCapabilityFunction,\n} from './BundlerCapability.js';\nexport type {\n RenderFunction,\n RenderFunctionOptions,\n RenderFunctionResult,\n ExpandedRenderFunctionResult,\n RenderFunctionScript,\n} from './RenderFunction.js';\nexport type { Request, Response } from 'express';\nexport type { Session } from './Session.js';\nexport type { ResolveMap } from './ResolveMap.js';\nexport type { ResolveMapEntry } from './ResolveMapEntry.js';\nexport type { LinkedPath } from './LinkedPath.js';\nexport type { ImportMap } from './ImportMap.js';\nexport type { UserPreferences } from './UserPreferences.js';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/common-types",
3
- "version": "0.19.2",
3
+ "version": "0.19.4",
4
4
  "description": "Common types for Cloudpack.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -520,18 +520,13 @@
520
520
  "$ref": "#/definitions/ShorthandRenderedRoute"
521
521
  },
522
522
  {
523
- "anyOf": [
524
- {
525
- "$ref": "#/definitions/StaticRoute"
526
- },
527
- {
528
- "$ref": "#/definitions/BootstrapRoute"
529
- },
530
- {
531
- "$ref": "#/definitions/RedirectRoute"
532
- }
533
- ],
534
- "description": "Internal helper for all route types except `RenderedRoute`/`ShorthandRenderedRoute` (to ensure any new route types are included in both `Route` and `ShorthandRoute`)."
523
+ "$ref": "#/definitions/ShorthandBootstrapRoute"
524
+ },
525
+ {
526
+ "$ref": "#/definitions/StaticRoute"
527
+ },
528
+ {
529
+ "$ref": "#/definitions/RedirectRoute"
535
530
  }
536
531
  ],
537
532
  "description": "Route as specified in `AppConfig` (`cloudpack.config.json`)."
@@ -551,15 +546,16 @@
551
546
  }
552
547
  }
553
548
  ],
554
- "description": "The url path part to match. Start paths with a leading slash, e.g. `'/my-route'`. You can also use wildcards (`*`), e.g. `'/my-route/*'` to match all paths starting with `'/my-route'`.\n\nUse an array to handle multiple paths with the same route handler."
549
+ "description": "The URL path to match. Paths should usually start with a slash, e.g. `'/my-route'`. You can also use wildcards (`*`), e.g. `'/my-route/*'` to match all paths starting with `'/my-route'`.\n\nSee the [Express docs](https://expressjs.com/en/guide/routing.html#route-paths) for the full supported routing syntax.\n\nUse an array to handle multiple paths with the same route handler."
555
550
  },
556
551
  "renderScript": {
557
552
  "type": "string",
558
- "description": "Path to a .js or .html file used for rendering the route. If a script is provided, it must export a default function implementing `RenderRouteFunction` defined in `@ms-cloudpack/app-server`."
553
+ "description": "Path to a .js or .html file used for rendering the route. If a script is provided, it must export a default function implementing `RenderRouteFunction` defined in `@ms-cloudpack/common-types`."
559
554
  },
560
555
  "exportEntry": {
561
556
  "type": "string",
562
- "deprecated": "- The key in the exports map which represents the entry point app script for this route.\nDefault is '.', meaning the main package export key."
557
+ "description": "The key in the exports map which represents the entry point app script for this route. Default is '.', meaning the main package export key.",
558
+ "deprecated": "Use `entry` instead."
563
559
  },
564
560
  "entry": {
565
561
  "anyOf": [
@@ -582,10 +578,10 @@
582
578
  ],
583
579
  "description": "A server-rendered route with optional shorthand `entry` info (as specified in `AppConfig`/`cloudpack.config.json`). The route is rendered by a custom server script in Cloudpack."
584
580
  },
585
- "StaticRoute": {
581
+ "ShorthandBootstrapRoute": {
586
582
  "type": "object",
587
583
  "properties": {
588
- "match": {
584
+ "entry": {
589
585
  "anyOf": [
590
586
  {
591
587
  "type": "string"
@@ -597,29 +593,12 @@
597
593
  }
598
594
  }
599
595
  ],
600
- "description": "The url path part to match. Start paths with a leading slash, e.g. `'/my-route'`. You can also use wildcards (`*`), e.g. `'/my-route/*'` to match all paths starting with `'/my-route'`.\n\nUse an array to handle multiple paths with the same route handler."
596
+ "description": "The source entry or entries to be included on the page for this route."
601
597
  },
602
- "staticPath": {
598
+ "exportEntry": {
603
599
  "type": "string",
604
- "description": "The path relative to the app root to static assets."
605
- }
606
- },
607
- "required": [
608
- "match",
609
- "staticPath"
610
- ],
611
- "additionalProperties": false,
612
- "description": "A route with a staticPath property serves static files from the specified path."
613
- },
614
- "BootstrapRoute": {
615
- "type": "object",
616
- "properties": {
617
- "entry": {
618
- "type": "array",
619
- "items": {
620
- "$ref": "#/definitions/ExpandedSourcePath"
621
- },
622
- "description": "To be implemented. The source entry or entries to be included on the page for this route."
600
+ "description": "The key in the exports map which represents the entry point app script for this route. Default is '.', meaning the main package export key.",
601
+ "deprecated": "Use `entry` instead."
623
602
  },
624
603
  "match": {
625
604
  "anyOf": [
@@ -633,7 +612,7 @@
633
612
  }
634
613
  }
635
614
  ],
636
- "description": "The url path part to match. Start paths with a leading slash, e.g. `'/my-route'`. You can also use wildcards (`*`), e.g. `'/my-route/*'` to match all paths starting with `'/my-route'`.\n\nUse an array to handle multiple paths with the same route handler."
615
+ "description": "The URL path to match. Paths should usually start with a slash, e.g. `'/my-route'`. You can also use wildcards (`*`), e.g. `'/my-route/*'` to match all paths starting with `'/my-route'`.\n\nSee the [Express docs](https://expressjs.com/en/guide/routing.html#route-paths) for the full supported routing syntax.\n\nUse an array to handle multiple paths with the same route handler."
637
616
  },
638
617
  "type": {
639
618
  "type": "string",
@@ -647,28 +626,34 @@
647
626
  "additionalProperties": false,
648
627
  "description": "A route that serves a bootstrap script."
649
628
  },
650
- "ExpandedSourcePath": {
629
+ "StaticRoute": {
651
630
  "type": "object",
652
631
  "properties": {
653
- "sourcePath": {
654
- "type": "string",
655
- "description": "The relative path to the source file. (e.g. `./src/index.ts`)"
656
- },
657
- "importPath": {
658
- "type": "string",
659
- "description": "The path to import the resulting bundled output from. This would represent the key in the import map entry to be imported. (e.g. `.` represents the default package export.)"
632
+ "match": {
633
+ "anyOf": [
634
+ {
635
+ "type": "string"
636
+ },
637
+ {
638
+ "type": "array",
639
+ "items": {
640
+ "type": "string"
641
+ }
642
+ }
643
+ ],
644
+ "description": "The URL path to match. Paths should usually start with a slash, e.g. `'/my-route'`. You can also use wildcards (`*`), e.g. `'/my-route/*'` to match all paths starting with `'/my-route'`.\n\nSee the [Express docs](https://expressjs.com/en/guide/routing.html#route-paths) for the full supported routing syntax.\n\nUse an array to handle multiple paths with the same route handler."
660
645
  },
661
- "requestPath": {
646
+ "staticPath": {
662
647
  "type": "string",
663
- "description": "The path to be requested by the browser. This would present the value in the import map entry to be requested. (e.g. `./lib/index.js`)"
648
+ "description": "The path relative to the app root to static assets."
664
649
  }
665
650
  },
666
651
  "required": [
667
- "sourcePath",
668
- "importPath",
669
- "requestPath"
652
+ "match",
653
+ "staticPath"
670
654
  ],
671
- "additionalProperties": false
655
+ "additionalProperties": false,
656
+ "description": "A route with a staticPath property serves static files from the specified path."
672
657
  },
673
658
  "RedirectRoute": {
674
659
  "type": "object",
@@ -685,7 +670,7 @@
685
670
  }
686
671
  }
687
672
  ],
688
- "description": "The url path part to match. Start paths with a leading slash, e.g. `'/my-route'`. You can also use wildcards (`*`), e.g. `'/my-route/*'` to match all paths starting with `'/my-route'`.\n\nUse an array to handle multiple paths with the same route handler."
673
+ "description": "The URL path to match. Paths should usually start with a slash, e.g. `'/my-route'`. You can also use wildcards (`*`), e.g. `'/my-route/*'` to match all paths starting with `'/my-route'`.\n\nSee the [Express docs](https://expressjs.com/en/guide/routing.html#route-paths) for the full supported routing syntax.\n\nUse an array to handle multiple paths with the same route handler."
689
674
  },
690
675
  "redirectTo": {
691
676
  "type": "string",
@@ -521,18 +521,13 @@
521
521
  "$ref": "#/definitions/ShorthandRenderedRoute"
522
522
  },
523
523
  {
524
- "anyOf": [
525
- {
526
- "$ref": "#/definitions/StaticRoute"
527
- },
528
- {
529
- "$ref": "#/definitions/BootstrapRoute"
530
- },
531
- {
532
- "$ref": "#/definitions/RedirectRoute"
533
- }
534
- ],
535
- "description": "Internal helper for all route types except `RenderedRoute`/`ShorthandRenderedRoute` (to ensure any new route types are included in both `Route` and `ShorthandRoute`)."
524
+ "$ref": "#/definitions/ShorthandBootstrapRoute"
525
+ },
526
+ {
527
+ "$ref": "#/definitions/StaticRoute"
528
+ },
529
+ {
530
+ "$ref": "#/definitions/RedirectRoute"
536
531
  }
537
532
  ],
538
533
  "description": "Route as specified in `AppConfig` (`cloudpack.config.json`)."
@@ -552,15 +547,16 @@
552
547
  }
553
548
  }
554
549
  ],
555
- "description": "The url path part to match. Start paths with a leading slash, e.g. `'/my-route'`. You can also use wildcards (`*`), e.g. `'/my-route/*'` to match all paths starting with `'/my-route'`.\n\nUse an array to handle multiple paths with the same route handler."
550
+ "description": "The URL path to match. Paths should usually start with a slash, e.g. `'/my-route'`. You can also use wildcards (`*`), e.g. `'/my-route/*'` to match all paths starting with `'/my-route'`.\n\nSee the [Express docs](https://expressjs.com/en/guide/routing.html#route-paths) for the full supported routing syntax.\n\nUse an array to handle multiple paths with the same route handler."
556
551
  },
557
552
  "renderScript": {
558
553
  "type": "string",
559
- "description": "Path to a .js or .html file used for rendering the route. If a script is provided, it must export a default function implementing `RenderRouteFunction` defined in `@ms-cloudpack/app-server`."
554
+ "description": "Path to a .js or .html file used for rendering the route. If a script is provided, it must export a default function implementing `RenderRouteFunction` defined in `@ms-cloudpack/common-types`."
560
555
  },
561
556
  "exportEntry": {
562
557
  "type": "string",
563
- "deprecated": "- The key in the exports map which represents the entry point app script for this route.\nDefault is '.', meaning the main package export key."
558
+ "description": "The key in the exports map which represents the entry point app script for this route. Default is '.', meaning the main package export key.",
559
+ "deprecated": "Use `entry` instead."
564
560
  },
565
561
  "entry": {
566
562
  "anyOf": [
@@ -583,10 +579,10 @@
583
579
  ],
584
580
  "description": "A server-rendered route with optional shorthand `entry` info (as specified in `AppConfig`/`cloudpack.config.json`). The route is rendered by a custom server script in Cloudpack."
585
581
  },
586
- "StaticRoute": {
582
+ "ShorthandBootstrapRoute": {
587
583
  "type": "object",
588
584
  "properties": {
589
- "match": {
585
+ "entry": {
590
586
  "anyOf": [
591
587
  {
592
588
  "type": "string"
@@ -598,29 +594,12 @@
598
594
  }
599
595
  }
600
596
  ],
601
- "description": "The url path part to match. Start paths with a leading slash, e.g. `'/my-route'`. You can also use wildcards (`*`), e.g. `'/my-route/*'` to match all paths starting with `'/my-route'`.\n\nUse an array to handle multiple paths with the same route handler."
597
+ "description": "The source entry or entries to be included on the page for this route."
602
598
  },
603
- "staticPath": {
599
+ "exportEntry": {
604
600
  "type": "string",
605
- "description": "The path relative to the app root to static assets."
606
- }
607
- },
608
- "required": [
609
- "match",
610
- "staticPath"
611
- ],
612
- "additionalProperties": false,
613
- "description": "A route with a staticPath property serves static files from the specified path."
614
- },
615
- "BootstrapRoute": {
616
- "type": "object",
617
- "properties": {
618
- "entry": {
619
- "type": "array",
620
- "items": {
621
- "$ref": "#/definitions/ExpandedSourcePath"
622
- },
623
- "description": "To be implemented. The source entry or entries to be included on the page for this route."
601
+ "description": "The key in the exports map which represents the entry point app script for this route. Default is '.', meaning the main package export key.",
602
+ "deprecated": "Use `entry` instead."
624
603
  },
625
604
  "match": {
626
605
  "anyOf": [
@@ -634,7 +613,7 @@
634
613
  }
635
614
  }
636
615
  ],
637
- "description": "The url path part to match. Start paths with a leading slash, e.g. `'/my-route'`. You can also use wildcards (`*`), e.g. `'/my-route/*'` to match all paths starting with `'/my-route'`.\n\nUse an array to handle multiple paths with the same route handler."
616
+ "description": "The URL path to match. Paths should usually start with a slash, e.g. `'/my-route'`. You can also use wildcards (`*`), e.g. `'/my-route/*'` to match all paths starting with `'/my-route'`.\n\nSee the [Express docs](https://expressjs.com/en/guide/routing.html#route-paths) for the full supported routing syntax.\n\nUse an array to handle multiple paths with the same route handler."
638
617
  },
639
618
  "type": {
640
619
  "type": "string",
@@ -648,28 +627,34 @@
648
627
  "additionalProperties": false,
649
628
  "description": "A route that serves a bootstrap script."
650
629
  },
651
- "ExpandedSourcePath": {
630
+ "StaticRoute": {
652
631
  "type": "object",
653
632
  "properties": {
654
- "sourcePath": {
655
- "type": "string",
656
- "description": "The relative path to the source file. (e.g. `./src/index.ts`)"
657
- },
658
- "importPath": {
659
- "type": "string",
660
- "description": "The path to import the resulting bundled output from. This would represent the key in the import map entry to be imported. (e.g. `.` represents the default package export.)"
633
+ "match": {
634
+ "anyOf": [
635
+ {
636
+ "type": "string"
637
+ },
638
+ {
639
+ "type": "array",
640
+ "items": {
641
+ "type": "string"
642
+ }
643
+ }
644
+ ],
645
+ "description": "The URL path to match. Paths should usually start with a slash, e.g. `'/my-route'`. You can also use wildcards (`*`), e.g. `'/my-route/*'` to match all paths starting with `'/my-route'`.\n\nSee the [Express docs](https://expressjs.com/en/guide/routing.html#route-paths) for the full supported routing syntax.\n\nUse an array to handle multiple paths with the same route handler."
661
646
  },
662
- "requestPath": {
647
+ "staticPath": {
663
648
  "type": "string",
664
- "description": "The path to be requested by the browser. This would present the value in the import map entry to be requested. (e.g. `./lib/index.js`)"
649
+ "description": "The path relative to the app root to static assets."
665
650
  }
666
651
  },
667
652
  "required": [
668
- "sourcePath",
669
- "importPath",
670
- "requestPath"
653
+ "match",
654
+ "staticPath"
671
655
  ],
672
- "additionalProperties": false
656
+ "additionalProperties": false,
657
+ "description": "A route with a staticPath property serves static files from the specified path."
673
658
  },
674
659
  "RedirectRoute": {
675
660
  "type": "object",
@@ -686,7 +671,7 @@
686
671
  }
687
672
  }
688
673
  ],
689
- "description": "The url path part to match. Start paths with a leading slash, e.g. `'/my-route'`. You can also use wildcards (`*`), e.g. `'/my-route/*'` to match all paths starting with `'/my-route'`.\n\nUse an array to handle multiple paths with the same route handler."
674
+ "description": "The URL path to match. Paths should usually start with a slash, e.g. `'/my-route'`. You can also use wildcards (`*`), e.g. `'/my-route/*'` to match all paths starting with `'/my-route'`.\n\nSee the [Express docs](https://expressjs.com/en/guide/routing.html#route-paths) for the full supported routing syntax.\n\nUse an array to handle multiple paths with the same route handler."
690
675
  },
691
676
  "redirectTo": {
692
677
  "type": "string",
@@ -1,23 +0,0 @@
1
- import type { Request, Response } from 'express';
2
- import type { ImportMap } from './ImportMap.js';
3
- import type { PackageJson } from './PackageJson.js';
4
- import type { RenderedRoute } from './Route.js';
5
- import type { Session } from './Session.js';
6
- /**
7
- * The input options for a `renderScript` custom server render function.
8
- */
9
- export interface RenderFunctionOptions {
10
- session: Session;
11
- route: RenderedRoute;
12
- baseUrl: string;
13
- definition: PackageJson;
14
- importMap: ImportMap;
15
- overlayScript?: string;
16
- entryScripts?: string[];
17
- inlineScripts?: string[];
18
- req: Request;
19
- res: Response;
20
- /** @deprecated - use entryScripts. */
21
- entryScript?: string;
22
- }
23
- //# sourceMappingURL=RenderFunctionOptions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RenderFunctionOptions.d.ts","sourceRoot":"","sources":["../src/RenderFunctionOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,aAAa,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,WAAW,CAAC;IACxB,SAAS,EAAE,SAAS,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,GAAG,EAAE,OAAO,CAAC;IACb,GAAG,EAAE,QAAQ,CAAC;IAEd,sCAAsC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=RenderFunctionOptions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RenderFunctionOptions.js","sourceRoot":"","sources":["../src/RenderFunctionOptions.ts"],"names":[],"mappings":"","sourcesContent":["import type { Request, Response } from 'express';\nimport type { ImportMap } from './ImportMap.js';\nimport type { PackageJson } from './PackageJson.js';\nimport type { RenderedRoute } from './Route.js';\nimport type { Session } from './Session.js';\n\n/**\n * The input options for a `renderScript` custom server render function.\n */\nexport interface RenderFunctionOptions {\n session: Session;\n route: RenderedRoute;\n baseUrl: string;\n definition: PackageJson;\n importMap: ImportMap;\n overlayScript?: string;\n entryScripts?: string[];\n inlineScripts?: string[];\n req: Request;\n res: Response;\n\n /** @deprecated - use entryScripts. */\n entryScript?: string;\n}\n"]}
@@ -1,22 +0,0 @@
1
- /**
2
- * The complete expected result of the `renderScript` custom server render function.
3
- */
4
- export interface ExpandedRenderFunctionResult {
5
- /** Response body */
6
- content: string;
7
- /** Standard HTTP status code - https://developer.mozilla.org/en-US/docs/Web/HTTP/Status */
8
- statusCode: number;
9
- /** MIME type for the response - https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types */
10
- contentType: string;
11
- }
12
- /**
13
- * The expected result of the `renderScript` custom server render function.
14
- *
15
- * If the result is a string, it's assumed to be the HTML content.
16
- *
17
- * If an object and the `content` is non-HTML, `contentType` must be set.
18
- */
19
- export type RenderFunctionResult = string | ({
20
- content: string;
21
- } & Partial<ExpandedRenderFunctionResult>);
22
- //# sourceMappingURL=RenderFunctionResult.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RenderFunctionResult.d.ts","sourceRoot":"","sources":["../src/RenderFunctionResult.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,oBAAoB;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,2FAA2F;IAC3F,UAAU,EAAE,MAAM,CAAC;IACnB,4HAA4H;IAC5H,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=RenderFunctionResult.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RenderFunctionResult.js","sourceRoot":"","sources":["../src/RenderFunctionResult.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * The complete expected result of the `renderScript` custom server render function.\n */\nexport interface ExpandedRenderFunctionResult {\n /** Response body */\n content: string;\n /** Standard HTTP status code - https://developer.mozilla.org/en-US/docs/Web/HTTP/Status */\n statusCode: number;\n /** MIME type for the response - https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types */\n contentType: string;\n}\n\n/**\n * The expected result of the `renderScript` custom server render function.\n *\n * If the result is a string, it's assumed to be the HTML content.\n *\n * If an object and the `content` is non-HTML, `contentType` must be set.\n */\nexport type RenderFunctionResult = string | ({ content: string } & Partial<ExpandedRenderFunctionResult>);\n"]}
@@ -1,8 +0,0 @@
1
- import type { RenderFunction } from './RenderFunction.js';
2
- /**
3
- * The expected shape of the `renderScript` custom server render function script.
4
- */
5
- export type RenderFunctionScript = {
6
- default: RenderFunction;
7
- };
8
- //# sourceMappingURL=RenderFunctionScript.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RenderFunctionScript.d.ts","sourceRoot":"","sources":["../src/RenderFunctionScript.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IAAE,OAAO,EAAE,cAAc,CAAA;CAAE,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=RenderFunctionScript.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RenderFunctionScript.js","sourceRoot":"","sources":["../src/RenderFunctionScript.ts"],"names":[],"mappings":"","sourcesContent":["import type { RenderFunction } from './RenderFunction.js';\n\n/**\n * The expected shape of the `renderScript` custom server render function script.\n */\nexport type RenderFunctionScript = { default: RenderFunction };\n"]}