@ms-cloudpack/common-types
Advanced tools
Comparing version 0.23.2 to 0.23.3
@@ -46,2 +46,3 @@ import type { ServerConfig } from './ServerConfig.js'; | ||
* Settings to customize how packages are bundled. | ||
* Later settings in the array take precedence over earlier ones. | ||
*/ | ||
@@ -79,6 +80,4 @@ packageSettings?: PackageSettings[]; | ||
* Key value pairs of external bundler capabilities that can be enabled in the package settings. | ||
* Key is the name of the capability, which will be used in the package settings to enable the capability. | ||
* Value is the import identifier for the capability module. | ||
* | ||
* (Within Cloudpack code, `readAppConfig` resolves the values to absolute file URLs.) | ||
* - Key is the name of the capability, which will be used in `PackageSettings.bundlerCapabilities`. | ||
* - Value is the import specifier (local path or package name) for the capability module. | ||
*/ | ||
@@ -85,0 +84,0 @@ bundlerCapabilitiesRegistry?: Record<string, string>; |
@@ -17,2 +17,3 @@ /** | ||
export type BundlerCapability<TOptions extends object> = { | ||
name: string; | ||
description: string; | ||
@@ -24,11 +25,2 @@ implementations: { | ||
/** | ||
* The metadata for a bundler capability. | ||
* It's the same as the `BundlerCapability` but without the implementations. | ||
* This is used to split the definition and the bundler-specific implementations. | ||
* | ||
* `TOptions` is the type of the options object that's passed to the capability. (ie: `{ banner: string }` | ||
* or any other type that the capability needs when enabled) | ||
*/ | ||
export type BundlerCapabilityMetaData<TOptions extends object> = Omit<BundlerCapability<TOptions>, 'implementations'>; | ||
/** | ||
* This is the list of the bundler capabilities that cloudpack provides. | ||
@@ -55,4 +47,4 @@ * - key: The name of the capability which will be used in the cloudpack config to enable the capability | ||
* This is the type that's being used `PackageSettings` to enable/disable bundler capabilities. | ||
* It's a partial of the `InternalBundlerCapabilities` with the value being the options object or false. | ||
* If the value is false, the capability will be disabled for the package. | ||
* - Key: internal capability name | ||
* - Value: options object to configure the capability, or false to disable it | ||
*/ | ||
@@ -64,15 +56,15 @@ export type InternalBundlerCapabilitiesOptions = { | ||
/** | ||
* This is the type that's being used `PackageSettings` to enable/disable bundler capabilities. | ||
* It's a partial of the `InternalBundlerCapabilities` with the value being the options object or false. | ||
* If the value is false, the capability will be disabled for the package. | ||
* Options used in `PackageSettings` to configure or disable bundler capabilities. | ||
* - Key: capability name, either internal (Cloudpack-provided) or external (as specified in | ||
* `AppConfig.bundlerCapabilitiesRegistry`) | ||
* - Value: options object to configure the capability, or false to disable it. | ||
*/ | ||
export type BundlerCapabilitiesOptions = InternalBundlerCapabilitiesOptions & ExternalBundlerCapabilitiesOptions; | ||
/** | ||
* This is the metadata for the bundler capabilities that cloudpack provides. | ||
* It's a mapping from the capability name to the metadata object. | ||
* The metadata object contains the description of the capability and the list of implementations for each bundler. | ||
* This is used to generate the documentation for the bundler capabilities. | ||
* Metadata for the bundler capabilities that cloudpack provides. | ||
* - Key: capability name | ||
* - Value: metadata object with description | ||
*/ | ||
export type InternalBundlerCapabilitiesMetaData = { | ||
[key in keyof InternalBundlerCapabilities]: BundlerCapabilityMetaData<InternalBundlerCapabilities[key]>; | ||
[key in keyof InternalBundlerCapabilities]: Pick<BundlerCapability<object>, 'description'>; | ||
}; | ||
@@ -94,7 +86,5 @@ /** | ||
export type ExternalBundlerCapabilityModule<TConfig extends object> = { | ||
default: BundlerCapability<TConfig> & { | ||
name: string; | ||
}; | ||
default: BundlerCapability<TConfig>; | ||
}; | ||
export {}; | ||
//# sourceMappingURL=BundlerCapability.d.ts.map |
@@ -9,3 +9,3 @@ import type { GeneratedConfig } from './GeneratedConfig.js'; | ||
*/ | ||
export type CloudpackConfig = Omit<AppConfig, 'routes' | 'server'> & { | ||
export type CloudpackConfig = Omit<AppConfig, 'routes' | 'server' | 'bundlerCapabilitiesRegistry'> & { | ||
/** | ||
@@ -35,3 +35,9 @@ * The path to the app's package. | ||
routes?: Route[]; | ||
/** | ||
* Key value pairs of external bundler capabilities that can be enabled in the package settings. | ||
* - Key is the name of the capability, which will be used in `PackageSettings.bundlerCapabilities`. | ||
* - Value is the absolute file URL of the capability implementation (resolved by `readAppConfig`). | ||
*/ | ||
bundlerCapabilitiesRegistry?: Record<string, string>; | ||
}; | ||
//# sourceMappingURL=CloudpackConfig.d.ts.map |
@@ -25,7 +25,7 @@ export { allFeatures } from './allFeatures.js'; | ||
export type { PackageSettings, PackageSettingsMatch, PackageSettingsMatchObject, GeneratedPackageSettings, } from './PackageSettings.js'; | ||
export type { BootstrapRoute, RedirectRoute, RenderedRoute, Route, RouteMatch, SharedRouteOptions, ShorthandRenderedRoute, ShorthandBootstrapRoute, ShorthandRoute, StaticRoute, } from './Route.js'; | ||
export { isBootstrapRoute, isRenderedRoute, isStaticRoute, isRedirectRoute, isShorthandBootstrapRoute, isShorthandRenderedRoute, } from './Route.js'; | ||
export type { BootstrapRoute, ProxyRoute, RedirectRoute, RenderedRoute, Route, RouteMatch, SharedRouteOptions, ShorthandRenderedRoute, ShorthandBootstrapRoute, ShorthandRoute, StaticRoute, } from './Route.js'; | ||
export { isBootstrapRoute, isProxyRoute, isRenderedRoute, isStaticRoute, isRedirectRoute, isShorthandBootstrapRoute, isShorthandRenderedRoute, } from './Route.js'; | ||
export type { TelemetryConfig } from './TelemetryConfig.js'; | ||
export type { AppConfig } from './AppConfig.js'; | ||
export type { InternalBundlerCapabilityImplementations, InternalBundlerCapabilitiesMetaData, BundlerCapabilitiesOptions, ExternalBundlerCapabilityModule, BundlerCapabilityFunction, } from './BundlerCapability.js'; | ||
export type { BundlerCapability, InternalBundlerCapabilityImplementations, InternalBundlerCapabilitiesMetaData, BundlerCapabilitiesOptions, ExternalBundlerCapabilityModule, BundlerCapabilityFunction, } from './BundlerCapability.js'; | ||
export type { RemoteCacheConfig } from './RemoteCacheConfig.js'; | ||
@@ -32,0 +32,0 @@ export type { RenderFunction, RenderFunctionOptions, RenderFunctionResult, ExpandedRenderFunctionResult, RenderFunctionScript, } from './RenderFunction.js'; |
export { allFeatures } from './allFeatures.js'; | ||
export { isBootstrapRoute, isRenderedRoute, isStaticRoute, isRedirectRoute, isShorthandBootstrapRoute, isShorthandRenderedRoute, } from './Route.js'; | ||
export { isBootstrapRoute, isProxyRoute, isRenderedRoute, isStaticRoute, isRedirectRoute, isShorthandBootstrapRoute, isShorthandRenderedRoute, } from './Route.js'; | ||
//# sourceMappingURL=index.js.map |
@@ -88,9 +88,27 @@ import type { ExpandedSourcePath } from './ExpandedSourcePath.js'; | ||
/** | ||
* A route that proxies requests to another server. | ||
* This is handled by https://github.com/chimurai/http-proxy-middleware. | ||
*/ | ||
export interface ProxyRoute extends SharedRouteOptions { | ||
/** | ||
* The target host to proxy to. (protocol + host). | ||
*/ | ||
proxyTo: string; | ||
/** | ||
* For virtual hosted sites. | ||
*/ | ||
changeOrigin?: boolean; | ||
/** | ||
* Rewrite target's url path. Object-keys will be used as RegExp to match paths. | ||
*/ | ||
pathRewrite?: Record<string, string>; | ||
} | ||
/** | ||
* Route as specified in `AppConfig` (`cloudpack.config.json`). | ||
*/ | ||
export type ShorthandRoute = ShorthandRenderedRoute | ShorthandBootstrapRoute | StaticRoute | RedirectRoute; | ||
export type ShorthandRoute = ShorthandRenderedRoute | ShorthandBootstrapRoute | StaticRoute | RedirectRoute | ProxyRoute; | ||
/** | ||
* Processed route as used in the processed `CloudpackConfig`. | ||
*/ | ||
export type Route = RenderedRoute | BootstrapRoute | StaticRoute | RedirectRoute; | ||
export type Route = RenderedRoute | BootstrapRoute | StaticRoute | RedirectRoute | ProxyRoute; | ||
/** | ||
@@ -117,2 +135,6 @@ * Type guard to check if a route is a static route. | ||
export declare function isRedirectRoute(route: Route | ShorthandRoute): route is RedirectRoute; | ||
/** | ||
* Type guard to check if a route is a proxy route. | ||
*/ | ||
export declare function isProxyRoute(route: Route | ShorthandRoute): route is ProxyRoute; | ||
//# sourceMappingURL=Route.d.ts.map |
@@ -38,2 +38,8 @@ /** | ||
} | ||
/** | ||
* Type guard to check if a route is a proxy route. | ||
*/ | ||
export function isProxyRoute(route) { | ||
return 'proxyTo' in route; | ||
} | ||
//# sourceMappingURL=Route.js.map |
{ | ||
"name": "@ms-cloudpack/common-types", | ||
"version": "0.23.2", | ||
"version": "0.23.3", | ||
"description": "Common types for Cloudpack.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -44,3 +44,3 @@ { | ||
}, | ||
"description": "Settings to customize how packages are bundled." | ||
"description": "Settings to customize how packages are bundled. Later settings in the array take precedence over earlier ones." | ||
}, | ||
@@ -95,3 +95,3 @@ "dependsOn": { | ||
}, | ||
"description": "Key value pairs of external bundler capabilities that can be enabled in the package settings. Key is the name of the capability, which will be used in the package settings to enable the capability. Value is the import identifier for the capability module.\n\n(Within Cloudpack code, `readAppConfig` resolves the values to absolute file URLs.)" | ||
"description": "Key value pairs of external bundler capabilities that can be enabled in the package settings.\n- Key is the name of the capability, which will be used in `PackageSettings.bundlerCapabilities`.\n- Value is the import specifier (local path or package name) for the capability module." | ||
}, | ||
@@ -518,2 +518,5 @@ "$schema": { | ||
"$ref": "#/definitions/RedirectRoute" | ||
}, | ||
{ | ||
"$ref": "#/definitions/ProxyRoute" | ||
} | ||
@@ -699,2 +702,42 @@ ], | ||
}, | ||
"ProxyRoute": { | ||
"type": "object", | ||
"properties": { | ||
"match": { | ||
"anyOf": [ | ||
{ | ||
"$ref": "#/definitions/RouteMatch" | ||
}, | ||
{ | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/RouteMatch" | ||
} | ||
} | ||
], | ||
"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\nIf you need a route to match on a specific domain, you can pass an object (path, domain) in where the domain is a string which can have wildcards (`*`). e.g. `'word.*'` will match `word.com`, `word.net`, etc.\n\nUse an array to handle multiple paths with the same route handler." | ||
}, | ||
"proxyTo": { | ||
"type": "string", | ||
"description": "The target host to proxy to. (protocol + host)." | ||
}, | ||
"changeOrigin": { | ||
"type": "boolean", | ||
"description": "For virtual hosted sites." | ||
}, | ||
"pathRewrite": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"type": "string" | ||
}, | ||
"description": "Rewrite target's url path. Object-keys will be used as RegExp to match paths." | ||
} | ||
}, | ||
"required": [ | ||
"match", | ||
"proxyTo" | ||
], | ||
"additionalProperties": false, | ||
"description": "A route that proxies requests to another server. This is handled by https://github.com/chimurai/http-proxy-middleware." | ||
}, | ||
"TelemetryConfig": { | ||
@@ -1040,3 +1083,3 @@ "type": "object", | ||
}, | ||
"description": "This is the type that's being used `PackageSettings` to enable/disable bundler capabilities. It's a partial of the `InternalBundlerCapabilities` with the value being the options object or false. If the value is false, the capability will be disabled for the package." | ||
"description": "Options used in `PackageSettings` to configure or disable bundler capabilities.\n- Key: capability name, either internal (Cloudpack-provided) or external (as specified in `AppConfig.bundlerCapabilitiesRegistry`)\n- Value: options object to configure the capability, or false to disable it." | ||
}, | ||
@@ -1043,0 +1086,0 @@ "RemoteCacheConfig": { |
@@ -48,3 +48,3 @@ { | ||
}, | ||
"description": "Settings to customize how packages are bundled." | ||
"description": "Settings to customize how packages are bundled. Later settings in the array take precedence over earlier ones." | ||
}, | ||
@@ -99,3 +99,3 @@ "dependsOn": { | ||
}, | ||
"description": "Key value pairs of external bundler capabilities that can be enabled in the package settings. Key is the name of the capability, which will be used in the package settings to enable the capability. Value is the import identifier for the capability module.\n\n(Within Cloudpack code, `readAppConfig` resolves the values to absolute file URLs.)" | ||
"description": "Key value pairs of external bundler capabilities that can be enabled in the package settings.\n- Key is the name of the capability, which will be used in `PackageSettings.bundlerCapabilities`.\n- Value is the import specifier (local path or package name) for the capability module." | ||
} | ||
@@ -519,2 +519,5 @@ }, | ||
"$ref": "#/definitions/RedirectRoute" | ||
}, | ||
{ | ||
"$ref": "#/definitions/ProxyRoute" | ||
} | ||
@@ -700,2 +703,42 @@ ], | ||
}, | ||
"ProxyRoute": { | ||
"type": "object", | ||
"properties": { | ||
"match": { | ||
"anyOf": [ | ||
{ | ||
"$ref": "#/definitions/RouteMatch" | ||
}, | ||
{ | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/RouteMatch" | ||
} | ||
} | ||
], | ||
"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\nIf you need a route to match on a specific domain, you can pass an object (path, domain) in where the domain is a string which can have wildcards (`*`). e.g. `'word.*'` will match `word.com`, `word.net`, etc.\n\nUse an array to handle multiple paths with the same route handler." | ||
}, | ||
"proxyTo": { | ||
"type": "string", | ||
"description": "The target host to proxy to. (protocol + host)." | ||
}, | ||
"changeOrigin": { | ||
"type": "boolean", | ||
"description": "For virtual hosted sites." | ||
}, | ||
"pathRewrite": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"type": "string" | ||
}, | ||
"description": "Rewrite target's url path. Object-keys will be used as RegExp to match paths." | ||
} | ||
}, | ||
"required": [ | ||
"match", | ||
"proxyTo" | ||
], | ||
"additionalProperties": false, | ||
"description": "A route that proxies requests to another server. This is handled by https://github.com/chimurai/http-proxy-middleware." | ||
}, | ||
"TelemetryConfig": { | ||
@@ -1041,3 +1084,3 @@ "type": "object", | ||
}, | ||
"description": "This is the type that's being used `PackageSettings` to enable/disable bundler capabilities. It's a partial of the `InternalBundlerCapabilities` with the value being the options object or false. If the value is false, the capability will be disabled for the package." | ||
"description": "Options used in `PackageSettings` to configure or disable bundler capabilities.\n- Key: capability name, either internal (Cloudpack-provided) or external (as specified in `AppConfig.bundlerCapabilitiesRegistry`)\n- Value: options object to configure the capability, or false to disable it." | ||
}, | ||
@@ -1044,0 +1087,0 @@ "RemoteCacheConfig": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
260622
3947