@ms-cloudpack/common-types 0.12.0 → 0.13.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.
@@ -52,7 +52,7 @@ export type InternalBundlerCapabilitiesMetaData = {
52
52
  * This is a bundler specific implementation of the internal bundler capabilities.
53
53
  * It's a mapping from the capability name to the capability function.
54
54
  */
55
- export type InternalBundlerCapabilitiesBundlerSpecificImplementations<TConfig> = {
55
+ export type InternalBundlerCapabilityImplementations<TConfig> = {
56
56
  [key in keyof InternalBundlerCapabilities]: BundlerCapabilityFn<TConfig, InternalBundlerCapabilities[key]>;
57
57
  };
58
58
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"BundlerCapability.d.ts","sourceRoot":"","sources":["../src/BundlerCapability.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,KAAK,mBAAmB,CAAC,OAAO,EAAE,QAAQ,SAAS,MAAM,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC;AAE7G;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAAC,QAAQ,SAAS,MAAM,IAAI;IACvD,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE;QACf,CAAC,OAAO,EAAE,MAAM,GAAG,mBAAmB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;KAC3D,CAAC;CACH,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,yBAAyB,CAAC,QAAQ,SAAS,MAAM,IAAI,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,EAAE,iBAAiB,CAAC,CAAC;AAEtH;;;;GAIG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC;;;OAGG;IACH,cAAc,EAAE;QAAE,UAAU,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CAC1C,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,0BAA0B,GAAG;KACtC,GAAG,IAAI,MAAM,2BAA2B,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AAC,GAAG,KAAK;CACtF,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,mCAAmC,GAAG;KAC/C,GAAG,IAAI,MAAM,2BAA2B,GAAG,yBAAyB,CAAC,2BAA2B,CAAC,GAAG,CAAC,CAAC;CACxG,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,wCAAwC,CAAC,OAAO,IAAI;KAC7D,GAAG,IAAI,MAAM,2BAA2B,GAAG,mBAAmB,CAAC,OAAO,EAAE,2BAA2B,CAAC,GAAG,CAAC,CAAC;CAC3G,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"BundlerCapability.js","sourceRoot":"","sources":["../src/BundlerCapability.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A function that takes a config object and options object and returns a new config object.\n * This is used to implement a bundler capability.\n */\ntype BundlerCapabilityFn<TConfig, TOptions extends object> = (config: TConfig, options: TOptions) => TConfig;\n\n/**\n * A bundler capability is a feature that can be enabled for a package to modify the bundling process.\n */\nexport type BundlerCapability<TOptions extends object> = {\n description: string;\n implementations: {\n [bundler: string]: BundlerCapabilityFn<unknown, TOptions>;\n };\n};\n\n/**\n * The metadata for a bundler capability.\n * It's the same as the BundlerCapability but without the implementations. This is used to split the definition and the bundler specific implementations.\n */\nexport type BundlerCapabilityMetaData<TOptions extends object> = Omit<BundlerCapability<TOptions>, 'implementations'>;\n\n/**\n * This is the list of the bundler capabilities that cloudpack provides.\n * key: The name of the capability which will be used in the cloudpack config to enable the capability\n * value: Options object which will be passed to the capability function\n */\nexport type InternalBundlerCapabilities = {\n /**\n * Inlines assets into the bundle.\n * Options: List of file extensions to inline. Do not include the leading dot.\n */\n 'asset-inline': { extensions: string[] };\n};\n\n/**\n * This is the type that's being used PackageSettings to enable/disable bundler capabilities.\n * It's a partial of the InternalBundlerCapabilities with the value being the options object or false.\n * If the value is false, the capability will be disabled for the package.\n */\nexport type BundlerCapabilitiesOptions = {\n [key in keyof InternalBundlerCapabilities]?: InternalBundlerCapabilities[key] | false;\n};\n\n/**\n * This is the metadata for the bundler capabilities that cloudpack provides.\n * It's a mapping from the capability name to the metadata object.\n * The metadata object contains the description of the capability and the list of implementations for each bundler.\n * This is used to generate the documentation for the bundler capabilities.\n */\nexport type InternalBundlerCapabilitiesMetaData = {\n [key in keyof InternalBundlerCapabilities]: BundlerCapabilityMetaData<InternalBundlerCapabilities[key]>;\n};\n\n/**\n * This is a bundler specific implementation of the internal bundler capabilities.\n * It's a mapping from the capability name to the capability function.\n */\nexport type InternalBundlerCapabilitiesBundlerSpecificImplementations<TConfig> = {\n [key in keyof InternalBundlerCapabilities]: BundlerCapabilityFn<TConfig, InternalBundlerCapabilities[key]>;\n};\n"]}
1
+ {"version":3,"file":"BundlerCapability.js","sourceRoot":"","sources":["../src/BundlerCapability.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A function that takes a config object and options object and returns a new config object.\n * This is used to implement a bundler capability.\n */\ntype BundlerCapabilityFn<TConfig, TOptions extends object> = (config: TConfig, options: TOptions) => TConfig;\n\n/**\n * A bundler capability is a feature that can be enabled for a package to modify the bundling process.\n */\nexport type BundlerCapability<TOptions extends object> = {\n description: string;\n implementations: {\n [bundler: string]: BundlerCapabilityFn<unknown, TOptions>;\n };\n};\n\n/**\n * The metadata for a bundler capability.\n * It's the same as the BundlerCapability but without the implementations. This is used to split the definition and the bundler specific implementations.\n */\nexport type BundlerCapabilityMetaData<TOptions extends object> = Omit<BundlerCapability<TOptions>, 'implementations'>;\n\n/**\n * This is the list of the bundler capabilities that cloudpack provides.\n * key: The name of the capability which will be used in the cloudpack config to enable the capability\n * value: Options object which will be passed to the capability function\n */\nexport type InternalBundlerCapabilities = {\n /**\n * Inlines assets into the bundle.\n * Options: List of file extensions to inline. Do not include the leading dot.\n */\n 'asset-inline': { extensions: string[] };\n};\n\n/**\n * This is the type that's being used PackageSettings to enable/disable bundler capabilities.\n * It's a partial of the InternalBundlerCapabilities with the value being the options object or false.\n * If the value is false, the capability will be disabled for the package.\n */\nexport type BundlerCapabilitiesOptions = {\n [key in keyof InternalBundlerCapabilities]?: InternalBundlerCapabilities[key] | false;\n};\n\n/**\n * This is the metadata for the bundler capabilities that cloudpack provides.\n * It's a mapping from the capability name to the metadata object.\n * The metadata object contains the description of the capability and the list of implementations for each bundler.\n * This is used to generate the documentation for the bundler capabilities.\n */\nexport type InternalBundlerCapabilitiesMetaData = {\n [key in keyof InternalBundlerCapabilities]: BundlerCapabilityMetaData<InternalBundlerCapabilities[key]>;\n};\n\n/**\n * This is a bundler specific implementation of the internal bundler capabilities.\n * It's a mapping from the capability name to the capability function.\n */\nexport type InternalBundlerCapabilityImplementations<TConfig> = {\n [key in keyof InternalBundlerCapabilities]: BundlerCapabilityFn<TConfig, InternalBundlerCapabilities[key]>;\n};\n"]}
@@ -31,7 +31,7 @@ export interface DevServer {
31
31
  */
32
32
  https?: HttpsConfig;
33
33
  /**
34
- * @deprecated - Routes has moved to the root of the config.
34
+ * @deprecated Moved to the root of the config.
35
35
  */
36
36
  routes?: ShorthandRoute[];
37
37
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DevServer.js","sourceRoot":"","sources":["../src/DevServer.ts"],"names":[],"mappings":"","sourcesContent":["import type { HttpsConfig } from './HttpsConfig.js';\nimport type { ShorthandRoute } from './Route.js';\n\nexport interface DevServer {\n /**\n * The domain name of the server.\n */\n domain?: string;\n\n /**\n * An optional dictionary of header key/value pairs to be use with the server.\n * NOTE: The following header values from Cloudpack will \"win\" against by a user's config:\n * 'Cache-Control': 'no-cache'\n * 'Access-Control-Allow-Origin': '*'\n */\n requestHeaders?: Record<string, string>;\n\n /**\n * The ports to be used by the server.\n * It can be a number or an array of numbers.\n * If ports are provided, an error will be thrown if none are available.\n * If no ports are provided, the server will attempt to find an available port.\n */\n port?: number | number[];\n\n /**\n * The default path to use when opening the browser.\n */\n defaultPath?: string;\n\n /**\n * The config settings for the https server.\n * Paths to files are accepted for 'ca', 'cert', 'key', and 'pfx' settings.\n * Everything else is passed directly to the https.createServer() method.\n * If not provided, the server will use http.\n */\n https?: HttpsConfig;\n\n /**\n * @deprecated - Routes has moved to the root of the config.\n */\n routes?: ShorthandRoute[];\n}\n"]}
1
+ {"version":3,"file":"DevServer.js","sourceRoot":"","sources":["../src/DevServer.ts"],"names":[],"mappings":"","sourcesContent":["import type { HttpsConfig } from './HttpsConfig.js';\nimport type { ShorthandRoute } from './Route.js';\n\nexport interface DevServer {\n /**\n * The domain name of the server.\n */\n domain?: string;\n\n /**\n * An optional dictionary of header key/value pairs to be use with the server.\n * NOTE: The following header values from Cloudpack will \"win\" against by a user's config:\n * 'Cache-Control': 'no-cache'\n * 'Access-Control-Allow-Origin': '*'\n */\n requestHeaders?: Record<string, string>;\n\n /**\n * The ports to be used by the server.\n * It can be a number or an array of numbers.\n * If ports are provided, an error will be thrown if none are available.\n * If no ports are provided, the server will attempt to find an available port.\n */\n port?: number | number[];\n\n /**\n * The default path to use when opening the browser.\n */\n defaultPath?: string;\n\n /**\n * The config settings for the https server.\n * Paths to files are accepted for 'ca', 'cert', 'key', and 'pfx' settings.\n * Everything else is passed directly to the https.createServer() method.\n * If not provided, the server will use http.\n */\n https?: HttpsConfig;\n\n /**\n * @deprecated Moved to the root of the config.\n */\n routes?: ShorthandRoute[];\n}\n"]}
package/lib/Route.d.ts CHANGED
@@ -9,7 +9,8 @@ export interface SharedRouteOptions {
9
9
  match: string | string[];
10
10
  }
11
11
  /**
12
- * A server-rendered route. The route is rendered by a custom server script in Cloudpack.
12
+ * A server-rendered route with optional shorthand `entry` info (as specified in `AppConfig`/`cloudpack.config.json`).
13
+ * The route is rendered by a custom server script in Cloudpack.
13
14
  */
14
15
  export interface ShorthandRenderedRoute extends SharedRouteOptions {
15
16
  /**
@@ -27,7 +28,14 @@ export interface ShorthandRenderedRoute extends SharedRouteOptions {
27
28
  */
28
29
  entry?: (string | ExpandedSourcePath)[];
29
30
  }
31
+ /**
32
+ * A server-rendered route with full `entry` info (used in the processed `CloudpackConfig`).
33
+ * The route is rendered by a custom server script in Cloudpack.
34
+ */
30
35
  export type RenderedRoute = Omit<ShorthandRenderedRoute, 'entry'> & {
36
+ /**
37
+ * To be implemented. The source entry or entries to be included on the page for this route.
38
+ */
31
39
  entry?: ExpandedSourcePath[];
32
40
  };
33
41
  /**
@@ -42,22 +50,31 @@ export interface StaticRoute extends SharedRouteOptions {
42
50
  /**
43
51
  * A route that serves a bootstrap script.
44
52
  */
45
- export interface BootstrapRoute extends SharedRouteOptions {
53
+ export interface BootstrapRoute extends SharedRouteOptions, Pick<ShorthandRenderedRoute, 'exportEntry'> {
46
54
  type: 'bootstrap';
47
- /**
48
- * The key in the exports map which represents the entry point app script for this route.
49
- * Default is '.', meaning the main package export key.
50
- */
51
- exportEntry?: string;
52
55
  }
56
+ /**
57
+ * A route that redirects to another url.
58
+ */
53
59
  export interface RedirectRoute extends SharedRouteOptions {
54
60
  /**
55
61
  * The url to redirect to.
56
62
  */
57
63
  redirectTo: string;
58
64
  }
59
- export type ShorthandRoute = ShorthandRenderedRoute | StaticRoute | BootstrapRoute;
60
- export type Route = RenderedRoute | StaticRoute | BootstrapRoute | RedirectRoute;
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
+ /**
71
+ * Route as specified in `AppConfig` (`cloudpack.config.json`).
72
+ */
73
+ export type ShorthandRoute = ShorthandRenderedRoute | OtherRoute;
74
+ /**
75
+ * Processed route as used in the processed `CloudpackConfig`.
76
+ */
77
+ export type Route = RenderedRoute | OtherRoute;
61
78
  /**
62
79
  * Type guard to check if a route is a static route.
63
80
  */
@@ -71,4 +88,5 @@ export declare function isRenderedRoute(route: Route): route is RenderedRoute;
71
88
  * Type guard to check if a route is a redirect route.
72
89
  */
73
90
  export declare function isRedirectRoute(route: Route): route is RedirectRoute;
91
+ export {};
74
92
  //# sourceMappingURL=Route.d.ts.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MAAM,MAAM,cAAc,GAAG,sBAAsB,GAAG,UAAU,CAAC;AAEjE;;GAEG;AACH,MAAM,MAAM,KAAK,GAAG,aAAa,GAAG,UAAU,CAAC;AAE/C;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,IAAI,WAAW,CAEhE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,IAAI,cAAc,CAEtE;AAKD,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,IAAI,aAAa,CAMpE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,IAAI,aAAa,CAEpE"}
package/lib/Route.js CHANGED
@@ -14,7 +14,9 @@ export function isBootstrapRoute(route) {
14
14
  * Type guard to check if a route is a rendered route.
15
15
  */
16
16
  export function isRenderedRoute(route) {
17
- return !isStaticRoute(route) && !isBootstrapRoute(route);
17
+ const maybeRenderedRoute = route;
18
+ return (!isBootstrapRoute(route) &&
19
+ !!(maybeRenderedRoute.renderScript || maybeRenderedRoute.entry || maybeRenderedRoute.exportEntry));
18
20
  }
19
21
  /**
20
22
  * Type guard to check if a route is a redirect route.
package/lib/Route.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Route.js","sourceRoot":"","sources":["../src/Route.ts"],"names":[],"mappings":"AAuEA;;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,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;AAC3D,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. 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 * 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 * To be implemented. The source entry or entries to be included on the page for this route.\n */\n entry?: (string | ExpandedSourcePath)[];\n}\n\nexport type RenderedRoute = Omit<ShorthandRenderedRoute, 'entry'> & {\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 {\n type: 'bootstrap';\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 */\n exportEntry?: string;\n}\n\nexport interface RedirectRoute extends SharedRouteOptions {\n /**\n * The url to redirect to.\n */\n redirectTo: string;\n}\n\nexport type ShorthandRoute = ShorthandRenderedRoute | StaticRoute | BootstrapRoute;\n\nexport type Route = RenderedRoute | StaticRoute | BootstrapRoute | RedirectRoute;\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 return !isStaticRoute(route) && !isBootstrapRoute(route);\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":"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,CACL,CAAC,gBAAgB,CAAC,KAAK,CAAC;QACxB,CAAC,CAAC,CAAC,kBAAkB,CAAC,YAAY,IAAI,kBAAkB,CAAC,KAAK,IAAI,kBAAkB,CAAC,WAAW,CAAC,CAClG,CAAC;AACJ,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 * 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 * To be implemented. The source entry or entries to be included on the page for this route.\n */\n entry?: (string | ExpandedSourcePath)[];\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, '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<ShorthandRenderedRoute, 'exportEntry'> {\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 (\n !isBootstrapRoute(route) &&\n !!(maybeRenderedRoute.renderScript || maybeRenderedRoute.entry || maybeRenderedRoute.exportEntry)\n );\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"]}
package/lib/index.d.ts CHANGED
@@ -24,5 +24,5 @@ export type { Route, RenderedRoute, BootstrapRoute, StaticRoute, RedirectRoute }
24
24
  export { isBootstrapRoute, isRenderedRoute, isStaticRoute, isRedirectRoute } from './Route.js';
25
25
  export type { TelemetryConfig } from './TelemetryConfig.js';
26
26
  export type { AppConfig } from './AppConfig.js';
27
- export type { InternalBundlerCapabilitiesBundlerSpecificImplementations, InternalBundlerCapabilitiesMetaData, BundlerCapabilitiesOptions, } from './BundlerCapability.js';
27
+ export type { InternalBundlerCapabilityImplementations, InternalBundlerCapabilitiesMetaData, BundlerCapabilitiesOptions, } from './BundlerCapability.js';
28
28
  //# sourceMappingURL=index.d.ts.map
@@ -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,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,M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WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,YAAY,EAAE,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACnG,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC/F,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,YAAY,EACV,wCAAwC,EACxC,mCAAmC,EACnC,0BAA0B,GAC3B,MAAM,wBAAwB,CAAC"}
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;AAqC/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 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 { PackageOverride } from './PackageOverride.js';\nexport type { PackageSettings } from './PackageSettings.js';\nexport type { Route, RenderedRoute, BootstrapRoute, StaticRoute, RedirectRoute } 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 InternalBundlerCapabilitiesBundlerSpecificImplementations,\n InternalBundlerCapabilitiesMetaData,\n BundlerCapabilitiesOptions,\n} from './BundlerCapability.js';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAqC/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 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 { PackageOverride } from './PackageOverride.js';\nexport type { PackageSettings } from './PackageSettings.js';\nexport type { Route, RenderedRoute, BootstrapRoute, StaticRoute, RedirectRoute } 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} from './BundlerCapability.js';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/common-types",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "Common types for Cloudpack.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -149,7 +149,7 @@
149
149
  "items": {
150
150
  "$ref": "#/definitions/ShorthandRoute"
151
151
  },
152
- "deprecated": "- Routes has moved to the root of the config."
152
+ "deprecated": "Moved to the root of the config."
153
153
  }
154
154
  },
155
155
  "additionalProperties": false
@@ -443,12 +443,21 @@
443
443
  "$ref": "#/definitions/ShorthandRenderedRoute"
444
444
  },
445
445
  {
446
- "$ref": "#/definitions/StaticRoute"
447
- },
448
- {
449
- "$ref": "#/definitions/BootstrapRoute"
446
+ "anyOf": [
447
+ {
448
+ "$ref": "#/definitions/StaticRoute"
449
+ },
450
+ {
451
+ "$ref": "#/definitions/BootstrapRoute"
452
+ },
453
+ {
454
+ "$ref": "#/definitions/RedirectRoute"
455
+ }
456
+ ],
457
+ "description": "Internal helper for all route types except `RenderedRoute`/`ShorthandRenderedRoute` (to ensure any new route types are included in both `Route` and `ShorthandRoute`)."
450
458
  }
451
- ]
459
+ ],
460
+ "description": "Route as specified in `AppConfig` (`cloudpack.config.json`)."
452
461
  },
453
462
  "ShorthandRenderedRoute": {
454
463
  "type": "object",
@@ -494,7 +503,7 @@
494
503
  "required": [
495
504
  "match"
496
505
  ],
497
- "description": "A server-rendered route. The route is rendered by a custom server script in Cloudpack."
506
+ "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."
498
507
  },
499
508
  "ExpandedSourcePath": {
500
509
  "type": "object",
@@ -551,6 +560,10 @@
551
560
  "BootstrapRoute": {
552
561
  "type": "object",
553
562
  "properties": {
563
+ "exportEntry": {
564
+ "type": "string",
565
+ "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."
566
+ },
554
567
  "match": {
555
568
  "anyOf": [
556
569
  {
@@ -568,10 +581,6 @@
568
581
  "type": {
569
582
  "type": "string",
570
583
  "const": "bootstrap"
571
- },
572
- "exportEntry": {
573
- "type": "string",
574
- "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."
575
584
  }
576
585
  },
577
586
  "required": [
@@ -581,6 +590,35 @@
581
590
  "additionalProperties": false,
582
591
  "description": "A route that serves a bootstrap script."
583
592
  },
593
+ "RedirectRoute": {
594
+ "type": "object",
595
+ "properties": {
596
+ "match": {
597
+ "anyOf": [
598
+ {
599
+ "type": "string"
600
+ },
601
+ {
602
+ "type": "array",
603
+ "items": {
604
+ "type": "string"
605
+ }
606
+ }
607
+ ],
608
+ "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."
609
+ },
610
+ "redirectTo": {
611
+ "type": "string",
612
+ "description": "The url to redirect to."
613
+ }
614
+ },
615
+ "required": [
616
+ "match",
617
+ "redirectTo"
618
+ ],
619
+ "additionalProperties": false,
620
+ "description": "A route that redirects to another url."
621
+ },
584
622
  "TelemetryConfig": {
585
623
  "type": "object",
586
624
  "properties": {
@@ -150,7 +150,7 @@
150
150
  "items": {
151
151
  "$ref": "#/definitions/ShorthandRoute"
152
152
  },
153
- "deprecated": "- Routes has moved to the root of the config."
153
+ "deprecated": "Moved to the root of the config."
154
154
  }
155
155
  },
156
156
  "additionalProperties": false
@@ -444,12 +444,21 @@
444
444
  "$ref": "#/definitions/ShorthandRenderedRoute"
445
445
  },
446
446
  {
447
- "$ref": "#/definitions/StaticRoute"
448
- },
449
- {
450
- "$ref": "#/definitions/BootstrapRoute"
447
+ "anyOf": [
448
+ {
449
+ "$ref": "#/definitions/StaticRoute"
450
+ },
451
+ {
452
+ "$ref": "#/definitions/BootstrapRoute"
453
+ },
454
+ {
455
+ "$ref": "#/definitions/RedirectRoute"
456
+ }
457
+ ],
458
+ "description": "Internal helper for all route types except `RenderedRoute`/`ShorthandRenderedRoute` (to ensure any new route types are included in both `Route` and `ShorthandRoute`)."
451
459
  }
452
- ]
460
+ ],
461
+ "description": "Route as specified in `AppConfig` (`cloudpack.config.json`)."
453
462
  },
454
463
  "ShorthandRenderedRoute": {
455
464
  "type": "object",
@@ -495,7 +504,7 @@
495
504
  "required": [
496
505
  "match"
497
506
  ],
498
- "description": "A server-rendered route. The route is rendered by a custom server script in Cloudpack."
507
+ "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."
499
508
  },
500
509
  "ExpandedSourcePath": {
501
510
  "type": "object",
@@ -552,6 +561,10 @@
552
561
  "BootstrapRoute": {
553
562
  "type": "object",
554
563
  "properties": {
564
+ "exportEntry": {
565
+ "type": "string",
566
+ "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."
567
+ },
555
568
  "match": {
556
569
  "anyOf": [
557
570
  {
@@ -569,10 +582,6 @@
569
582
  "type": {
570
583
  "type": "string",
571
584
  "const": "bootstrap"
572
- },
573
- "exportEntry": {
574
- "type": "string",
575
- "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."
576
585
  }
577
586
  },
578
587
  "required": [
@@ -582,6 +591,35 @@
582
591
  "additionalProperties": false,
583
592
  "description": "A route that serves a bootstrap script."
584
593
  },
594
+ "RedirectRoute": {
595
+ "type": "object",
596
+ "properties": {
597
+ "match": {
598
+ "anyOf": [
599
+ {
600
+ "type": "string"
601
+ },
602
+ {
603
+ "type": "array",
604
+ "items": {
605
+ "type": "string"
606
+ }
607
+ }
608
+ ],
609
+ "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."
610
+ },
611
+ "redirectTo": {
612
+ "type": "string",
613
+ "description": "The url to redirect to."
614
+ }
615
+ },
616
+ "required": [
617
+ "match",
618
+ "redirectTo"
619
+ ],
620
+ "additionalProperties": false,
621
+ "description": "A route that redirects to another url."
622
+ },
585
623
  "TelemetryConfig": {
586
624
  "type": "object",
587
625
  "properties": {