@ms-cloudpack/common-types 0.24.10 → 0.24.11

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.
@@ -4,6 +4,7 @@ import type { PackageSettings } from './PackageSettings.js';
4
4
  import type { RemoteCacheConfig } from './RemoteCacheConfig.js';
5
5
  import type { ShorthandRoute } from './Route.js';
6
6
  import type { TelemetryConfig } from './TelemetryConfig.js';
7
+ import type { DefineFlags } from '@ms-cloudpack/common-types-browser';
7
8
  /**
8
9
  * Per-application user-provided configuration for Cloudpack.
9
10
  */
@@ -80,5 +81,9 @@ export interface AppConfig {
80
81
  * - Value is the import specifier (local path or package name) for the capability module.
81
82
  */
82
83
  bundlerCapabilitiesRegistry?: Record<string, string>;
84
+ /**
85
+ * Key value pairs that will be used to define global variables in the runtime.
86
+ */
87
+ define?: DefineFlags;
83
88
  }
84
89
  //# sourceMappingURL=AppConfig.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AppConfig.d.ts","sourceRoot":"","sources":["../src/AppConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE5B;;OAEG;IACH,SAAS,CAAC,EAAE,YAAY,CAAC;IAEzB;;OAEG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;IAEtB;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,CAAC;IAEzB;;OAEG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;IAEtB;;OAEG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC;IAE5B;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,eAAe,CAAC,EAAE,eAAe,EAAE,CAAC;IAEpC;;;OAGG;IACH,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IAEjC;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B;;;OAGG;IACH,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAEhC;;;OAGG;IACH,MAAM,CAAC,EAAE,cAAc,EAAE,CAAC;IAE1B;;;;;OAKG;IACH,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC;IAEpC;;;;OAIG;IACH,2BAA2B,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAErD;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB"}
@@ -1 +1 @@
1
- {"version":3,"file":"AppConfig.js","sourceRoot":"","sources":["../src/AppConfig.ts"],"names":[],"mappings":"","sourcesContent":["import type { ServerConfig } from './ServerConfig.js';\nimport type { Features } from './Features.js';\nimport type { PackageSettings } from './PackageSettings.js';\nimport type { RemoteCacheConfig } from './RemoteCacheConfig.js';\nimport type { ShorthandRoute } from './Route.js';\nimport type { TelemetryConfig } from './TelemetryConfig.js';\n\n/**\n * Per-application user-provided configuration for Cloudpack.\n */\nexport interface AppConfig {\n /**\n * Extend the configuration from another file: either an import path or a relative path\n * (resolved from the config file's location).\n *\n * If an array, later files will take precedence when merging.\n * (The user config always takes precedence over any extended config.)\n *\n * Config merging approach:\n * - Objects will be deeply merged.\n * - Primitive values will be overwritten.\n * - Arrays will be overwritten, EXCEPT for `packageSettings`, which will be concatenated.\n */\n extends?: string | string[];\n\n /**\n * @deprecated - use \"server\" instead.\n */\n devServer?: ServerConfig;\n\n /**\n * Configuration for the dev server.\n */\n server?: ServerConfig;\n\n /**\n * Configuration for telemetry.\n */\n telemetry?: TelemetryConfig;\n\n /**\n * Enable additional Cloudpack features.\n */\n features?: Features;\n\n /**\n * Help message to display when Cloudpack starts up.\n */\n helpMessage?: string;\n\n /**\n * Settings to customize how packages are bundled.\n * Later settings in the array take precedence over earlier ones.\n */\n packageSettings?: PackageSettings[];\n\n /**\n * Commands to execute prior to Cloudpack bundling.\n * Each entry has a command and an array of arguments: `['command', ['arg1', 'arg2']]`.\n */\n dependsOn?: [string, string[]][];\n\n /**\n * Glob pattern to match `patch-package` patch files, relative to the project root\n * (usually the same as the repository root).\n * @default \"patches/*.patch\"\n */\n patchFilesGlobPattern?: string;\n\n /**\n * Azure Blob Storage configuration for remote cache - uploading and downloading packages\n * via `cloudpack sync`. If this is not provided, the remote cache will not be used.\n */\n remoteCache?: RemoteCacheConfig;\n\n /**\n * Defines what routes to support from the app server, and which scripts will be loaded\n * for each.\n */\n routes?: ShorthandRoute[];\n\n /**\n * Ignore these package names when calculating included and excluded dependencies.\n * This is mainly intended for helper packages such as `tslib`.\n *\n * Include `...` to merge with the default list (`tslib` and `@babel/runtime` as of writing).\n */\n neverExcludeDependencies?: string[];\n\n /**\n * 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.\n */\n bundlerCapabilitiesRegistry?: Record<string, string>;\n}\n"]}
1
+ {"version":3,"file":"AppConfig.js","sourceRoot":"","sources":["../src/AppConfig.ts"],"names":[],"mappings":"","sourcesContent":["import type { ServerConfig } from './ServerConfig.js';\nimport type { Features } from './Features.js';\nimport type { PackageSettings } from './PackageSettings.js';\nimport type { RemoteCacheConfig } from './RemoteCacheConfig.js';\nimport type { ShorthandRoute } from './Route.js';\nimport type { TelemetryConfig } from './TelemetryConfig.js';\nimport type { DefineFlags } from '@ms-cloudpack/common-types-browser';\n\n/**\n * Per-application user-provided configuration for Cloudpack.\n */\nexport interface AppConfig {\n /**\n * Extend the configuration from another file: either an import path or a relative path\n * (resolved from the config file's location).\n *\n * If an array, later files will take precedence when merging.\n * (The user config always takes precedence over any extended config.)\n *\n * Config merging approach:\n * - Objects will be deeply merged.\n * - Primitive values will be overwritten.\n * - Arrays will be overwritten, EXCEPT for `packageSettings`, which will be concatenated.\n */\n extends?: string | string[];\n\n /**\n * @deprecated - use \"server\" instead.\n */\n devServer?: ServerConfig;\n\n /**\n * Configuration for the dev server.\n */\n server?: ServerConfig;\n\n /**\n * Configuration for telemetry.\n */\n telemetry?: TelemetryConfig;\n\n /**\n * Enable additional Cloudpack features.\n */\n features?: Features;\n\n /**\n * Help message to display when Cloudpack starts up.\n */\n helpMessage?: string;\n\n /**\n * Settings to customize how packages are bundled.\n * Later settings in the array take precedence over earlier ones.\n */\n packageSettings?: PackageSettings[];\n\n /**\n * Commands to execute prior to Cloudpack bundling.\n * Each entry has a command and an array of arguments: `['command', ['arg1', 'arg2']]`.\n */\n dependsOn?: [string, string[]][];\n\n /**\n * Glob pattern to match `patch-package` patch files, relative to the project root\n * (usually the same as the repository root).\n * @default \"patches/*.patch\"\n */\n patchFilesGlobPattern?: string;\n\n /**\n * Azure Blob Storage configuration for remote cache - uploading and downloading packages\n * via `cloudpack sync`. If this is not provided, the remote cache will not be used.\n */\n remoteCache?: RemoteCacheConfig;\n\n /**\n * Defines what routes to support from the app server, and which scripts will be loaded\n * for each.\n */\n routes?: ShorthandRoute[];\n\n /**\n * Ignore these package names when calculating included and excluded dependencies.\n * This is mainly intended for helper packages such as `tslib`.\n *\n * Include `...` to merge with the default list (`tslib` and `@babel/runtime` as of writing).\n */\n neverExcludeDependencies?: string[];\n\n /**\n * 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.\n */\n bundlerCapabilitiesRegistry?: Record<string, string>;\n\n /**\n * Key value pairs that will be used to define global variables in the runtime.\n */\n define?: DefineFlags;\n}\n"]}
@@ -8,7 +8,7 @@ import type { Session } from './Session.js';
8
8
  */
9
9
  export type RenderFunction = (options: RenderFunctionOptions) => Promise<RenderFunctionResult> | RenderFunctionResult;
10
10
  /**
11
- * Input for a `renderScript` custom server render function.
11
+ * Input for a `serverEntry`/`renderScript` custom server render function.
12
12
  */
13
13
  export interface RenderFunctionOptions {
14
14
  /** Info about the current app session */
@@ -33,7 +33,7 @@ export interface RenderFunctionOptions {
33
33
  res: Response;
34
34
  }
35
35
  /**
36
- * The complete expected result of the `renderScript` custom server render function.
36
+ * The complete expected result of the `serverEntry`/`renderScript` custom server render function.
37
37
  */
38
38
  export interface ExpandedRenderFunctionResult {
39
39
  /** Response body */
@@ -44,7 +44,7 @@ export interface ExpandedRenderFunctionResult {
44
44
  contentType: string;
45
45
  }
46
46
  /**
47
- * The expected result of the `renderScript` custom server render function.
47
+ * The expected result of the `serverEntry`/`renderScript` custom server render function.
48
48
  *
49
49
  * - If a string, it's assumed to be the HTML content.
50
50
  * - If an object and the `content` is non-HTML, `contentType` must be set.
@@ -55,7 +55,7 @@ export type RenderFunctionResult = string | null | ({
55
55
  content: string;
56
56
  } & Partial<ExpandedRenderFunctionResult>);
57
57
  /**
58
- * The expected shape of the `renderScript` custom server render function JS file.
58
+ * The expected shape of the `serverEntry`/`renderScript` custom server render function JS file.
59
59
  */
60
60
  export type RenderFunctionScript = {
61
61
  default: RenderFunction;
@@ -1 +1 @@
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 * Input for a `renderScript` custom server render function.\n */\nexport interface RenderFunctionOptions {\n /** Info about the current app session */\n session: Session;\n /** Processed route being rendered */\n route: RenderedRoute;\n /** Base URL of the app server, including port */\n baseUrl: string;\n /** `package.json` for the app */\n definition: PackageJson;\n /** Import map that will be used by the app at runtime (will be injected into a returned HTML response) */\n importMap: ImportMap;\n /** URL for the Cloudpack overlay script bundle (will be injected into a returned HTML response) */\n overlayScript?: string;\n /** Additional script bundle URLs from `route.entry` (will be injected into a returned HTML response) */\n entryScripts?: string[];\n /** Inline script tag contents used for Cloudpack initialization (will be injected into a returned HTML response) */\n inlineScripts?: string[];\n /** Current request */\n req: Request;\n /** Current response */\n res: Response;\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"]}
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 * Input for a `serverEntry`/`renderScript` custom server render function.\n */\nexport interface RenderFunctionOptions {\n /** Info about the current app session */\n session: Session;\n /** Processed route being rendered */\n route: RenderedRoute;\n /** Base URL of the app server, including port */\n baseUrl: string;\n /** `package.json` for the app */\n definition: PackageJson;\n /** Import map that will be used by the app at runtime (will be injected into a returned HTML response) */\n importMap: ImportMap;\n /** URL for the Cloudpack overlay script bundle (will be injected into a returned HTML response) */\n overlayScript?: string;\n /** Additional script bundle URLs from `route.entry` (will be injected into a returned HTML response) */\n entryScripts?: string[];\n /** Inline script tag contents used for Cloudpack initialization (will be injected into a returned HTML response) */\n inlineScripts?: string[];\n /** Current request */\n req: Request;\n /** Current response */\n res: Response;\n}\n\n/**\n * The complete expected result of the `serverEntry`/`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 `serverEntry`/`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 `serverEntry`/`renderScript` custom server render function JS file.\n */\nexport type RenderFunctionScript = { default: RenderFunction };\n"]}
package/lib/Route.d.ts CHANGED
@@ -30,6 +30,8 @@ export interface ShorthandRenderedRoute extends SharedRouteOptions {
30
30
  * Path to a .js or .html file (relative to the app path) for rendering the route.
31
31
  *
32
32
  * If a .js file, it must export a default function implementing `RenderFunction` from `@ms-cloudpack/common-types`.
33
+ * @deprecated Use `serverEntry` instead. (Please talk to the team if you have a scenario where
34
+ * bundling the script causes a problem.)
33
35
  */
34
36
  renderScript?: string;
35
37
  /**
@@ -45,10 +47,11 @@ export interface ShorthandRenderedRoute extends SharedRouteOptions {
45
47
  */
46
48
  entry?: string | string[];
47
49
  /**
48
- * Path to the resource (.js, .ts, .tsx, etc) used to render the route from the server.
49
- * (Also supports export map keys.)
50
+ * Path to a TS, JS, or HTML file (relative to the app path) for rendering the route on the server.
51
+ * (Also supports export map keys.) If a JS or TS file, it will be bundled before rendering.
50
52
  *
51
- * It must export a default function implementing `RenderRouteFunction` defined in `@ms-cloudpack/app-server`.
53
+ * If JS or TS, it must export a default function implementing `RenderRouteFunction` defined in
54
+ * `@ms-cloudpack/app-server`.
52
55
  */
53
56
  serverEntry?: string;
54
57
  }
@@ -62,8 +65,11 @@ export type RenderedRoute = Omit<ShorthandRenderedRoute, 'exportEntry' | 'entry'
62
65
  */
63
66
  entry?: ExpandedSourcePath[];
64
67
  /**
65
- * Path to the resource (.js, .ts, .tsx, etc) used to render the route from the server.
66
- * It must export a default function implementing `RenderRouteFunction` defined in `@ms-cloudpack/app-server`.
68
+ * Path to a TS, JS, or HTML file (relative to the app path) for rendering the route on the server.
69
+ * If a JS or TS file, it will be bundled before rendering.
70
+ *
71
+ * If JS or TS, it must export a default function implementing `RenderRouteFunction` defined in
72
+ * `@ms-cloudpack/app-server`.
67
73
  */
68
74
  serverEntry?: ExpandedSourcePath;
69
75
  };
@@ -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;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpE,MAAM,W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OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC;AAED;;GAEG;AAEH,MAAM,MAAM,cAAc,GACtB,sBAAsB,GACtB,uBAAuB,GACvB,WAAW,GACX,aAAa,GACb,UAAU,CAAC;AAEf;;GAEG;AAEH,MAAM,MAAM,KAAK,GAAG,aAAa,GAAG,cAAc,GAAG,WAAW,GAAG,aAAa,GAAG,UAAU,CAAC;AAE9F;;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,CAOpE;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;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,cAAc,GAAG,KAAK,IAAI,UAAU,CAE/E"}
package/lib/Route.js CHANGED
@@ -22,6 +22,7 @@ export function isShorthandBootstrapRoute(route) {
22
22
  export function isRenderedRoute(route) {
23
23
  const maybeRenderedRoute = route;
24
24
  return (!isBootstrapRoute(route) &&
25
+ // eslint-disable-next-line etc/no-deprecated
25
26
  !!(maybeRenderedRoute.renderScript || maybeRenderedRoute.entry || maybeRenderedRoute.serverEntry));
26
27
  }
27
28
  /**
package/lib/Route.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Route.js","sourceRoot":"","sources":["../src/Route.ts"],"names":[],"mappings":"AAoJA;;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,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,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;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,KAA6B;IACxD,OAAO,SAAS,IAAI,KAAK,CAAC;AAC5B,CAAC","sourcesContent":["import type { ExpandedSourcePath } from './ExpandedSourcePath.js';\n\n/**\n * A route match can be a string path or an object with a path and domain.\n */\nexport type RouteMatch = string | { path: string; domain?: string };\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 * If you need a route to match on a specific domain, you can pass an object (path, domain) in where\n * the domain is a string which can have wildcards (`*`). e.g. `'word.*'` will match `word.com`, `word.net`, etc.\n *\n * Use an array to handle multiple paths with the same route handler.\n */\n match: RouteMatch | RouteMatch[];\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 (relative to the app path) for rendering the route.\n *\n * If a .js file, it must export a default function implementing `RenderFunction` from `@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 * @deprecated Use `entry` instead.\n */\n exportEntry?: string;\n\n /**\n * Additional source file path(s) to bundle and include in the HTML.\n * This **overwrites** any original exports map for the package.\n *\n * Usually this should be an actual source path, though it could also be an exports map key if necessary.\n */\n entry?: string | string[];\n\n /**\n * Path to the resource (.js, .ts, .tsx, etc) used to render the route from the server.\n * (Also supports export map keys.)\n *\n * It must export a default function implementing `RenderRouteFunction` defined in `@ms-cloudpack/app-server`.\n */\n serverEntry?: 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' | 'serverEntry'> & {\n /**\n * The source entry or entries to be included on the page for this route.\n */\n entry?: ExpandedSourcePath[];\n\n /**\n * Path to the resource (.js, .ts, .tsx, etc) used to render the route from the server.\n * It must export a default function implementing `RenderRouteFunction` defined in `@ms-cloudpack/app-server`.\n */\n serverEntry?: 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' | 'serverEntry' | 'exportEntry'> {\n type: 'bootstrap';\n}\n\n/**\n * A route that serves a bootstrap script.\n */\nexport interface BootstrapRoute\n extends Omit<ShorthandBootstrapRoute, 'entry' | 'serverEntry'>,\n Pick<RenderedRoute, 'entry' | 'serverEntry'> {}\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 * A route that proxies requests to another server.\n * This is handled by https://github.com/chimurai/http-proxy-middleware.\n */\nexport interface ProxyRoute extends SharedRouteOptions {\n /**\n * The target host to proxy to. (protocol + host).\n */\n proxyTo: string;\n\n /**\n * For virtual hosted sites.\n */\n changeOrigin?: boolean;\n /**\n * Rewrite target's url path. Object-keys will be used as RegExp to match paths.\n */\n pathRewrite?: Record<string, 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 =\n | ShorthandRenderedRoute\n | ShorthandBootstrapRoute\n | StaticRoute\n | RedirectRoute\n | ProxyRoute;\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 | ProxyRoute;\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 (\n !isBootstrapRoute(route) &&\n !!(maybeRenderedRoute.renderScript || maybeRenderedRoute.entry || maybeRenderedRoute.serverEntry)\n );\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\n/**\n * Type guard to check if a route is a proxy route.\n */\nexport function isProxyRoute(route: Route | ShorthandRoute): route is ProxyRoute {\n return 'proxyTo' in route;\n}\n"]}
1
+ {"version":3,"file":"Route.js","sourceRoot":"","sources":["../src/Route.ts"],"names":[],"mappings":"AA0JA;;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,CACL,CAAC,gBAAgB,CAAC,KAAK,CAAC;QACxB,6CAA6C;QAC7C,CAAC,CAAC,CAAC,kBAAkB,CAAC,YAAY,IAAI,kBAAkB,CAAC,KAAK,IAAI,kBAAkB,CAAC,WAAW,CAAC,CAClG,CAAC;AACJ,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;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,KAA6B;IACxD,OAAO,SAAS,IAAI,KAAK,CAAC;AAC5B,CAAC","sourcesContent":["import type { ExpandedSourcePath } from './ExpandedSourcePath.js';\n\n/**\n * A route match can be a string path or an object with a path and domain.\n */\nexport type RouteMatch = string | { path: string; domain?: string };\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 * If you need a route to match on a specific domain, you can pass an object (path, domain) in where\n * the domain is a string which can have wildcards (`*`). e.g. `'word.*'` will match `word.com`, `word.net`, etc.\n *\n * Use an array to handle multiple paths with the same route handler.\n */\n match: RouteMatch | RouteMatch[];\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 (relative to the app path) for rendering the route.\n *\n * If a .js file, it must export a default function implementing `RenderFunction` from `@ms-cloudpack/common-types`.\n * @deprecated Use `serverEntry` instead. (Please talk to the team if you have a scenario where\n * bundling the script causes a problem.)\n */\n renderScript?: string;\n\n /**\n * The key in the exports map which represents the entry point app script for this route.\n * @deprecated Use `entry` instead.\n */\n exportEntry?: string;\n\n /**\n * Additional source file path(s) to bundle and include in the HTML.\n * This **overwrites** any original exports map for the package.\n *\n * Usually this should be an actual source path, though it could also be an exports map key if necessary.\n */\n entry?: string | string[];\n\n /**\n * Path to a TS, JS, or HTML file (relative to the app path) for rendering the route on the server.\n * (Also supports export map keys.) If a JS or TS file, it will be bundled before rendering.\n *\n * If JS or TS, it must export a default function implementing `RenderRouteFunction` defined in\n * `@ms-cloudpack/app-server`.\n */\n serverEntry?: 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' | 'serverEntry'> & {\n /**\n * The source entry or entries to be included on the page for this route.\n */\n entry?: ExpandedSourcePath[];\n\n /**\n * Path to a TS, JS, or HTML file (relative to the app path) for rendering the route on the server.\n * If a JS or TS file, it will be bundled before rendering.\n *\n * If JS or TS, it must export a default function implementing `RenderRouteFunction` defined in\n * `@ms-cloudpack/app-server`.\n */\n serverEntry?: 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' | 'serverEntry' | 'exportEntry'> {\n type: 'bootstrap';\n}\n\n/**\n * A route that serves a bootstrap script.\n */\nexport interface BootstrapRoute\n extends Omit<ShorthandBootstrapRoute, 'entry' | 'serverEntry'>,\n Pick<RenderedRoute, 'entry' | 'serverEntry'> {}\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 * A route that proxies requests to another server.\n * This is handled by https://github.com/chimurai/http-proxy-middleware.\n */\nexport interface ProxyRoute extends SharedRouteOptions {\n /**\n * The target host to proxy to. (protocol + host).\n */\n proxyTo: string;\n\n /**\n * For virtual hosted sites.\n */\n changeOrigin?: boolean;\n /**\n * Rewrite target's url path. Object-keys will be used as RegExp to match paths.\n */\n pathRewrite?: Record<string, 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 =\n | ShorthandRenderedRoute\n | ShorthandBootstrapRoute\n | StaticRoute\n | RedirectRoute\n | ProxyRoute;\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 | ProxyRoute;\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 (\n !isBootstrapRoute(route) &&\n // eslint-disable-next-line etc/no-deprecated\n !!(maybeRenderedRoute.renderScript || maybeRenderedRoute.entry || maybeRenderedRoute.serverEntry)\n );\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\n/**\n * Type guard to check if a route is a proxy route.\n */\nexport function isProxyRoute(route: Route | ShorthandRoute): route is ProxyRoute {\n return 'proxyTo' in route;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/common-types",
3
- "version": "0.24.10",
3
+ "version": "0.24.11",
4
4
  "description": "Common types for Cloudpack.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -14,7 +14,7 @@
14
14
  }
15
15
  },
16
16
  "dependencies": {
17
- "@ms-cloudpack/common-types-browser": "^0.5.4",
17
+ "@ms-cloudpack/common-types-browser": "^0.5.5",
18
18
  "@types/express": "^4.17.16"
19
19
  },
20
20
  "devDependencies": {
@@ -93,6 +93,10 @@
93
93
  },
94
94
  "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."
95
95
  },
96
+ "define": {
97
+ "$ref": "#/definitions/DefineFlags",
98
+ "description": "Key value pairs that will be used to define global variables in the runtime."
99
+ },
96
100
  "$schema": {
97
101
  "type": "string"
98
102
  }
@@ -539,7 +543,8 @@
539
543
  },
540
544
  "renderScript": {
541
545
  "type": "string",
542
- "description": "Path to a .js or .html file (relative to the app path) for rendering the route.\n\nIf a .js file, it must export a default function implementing `RenderFunction` from `@ms-cloudpack/common-types`."
546
+ "description": "Path to a .js or .html file (relative to the app path) for rendering the route.\n\nIf a .js file, it must export a default function implementing `RenderFunction` from `@ms-cloudpack/common-types`.",
547
+ "deprecated": "Use `serverEntry` instead. (Please talk to the team if you have a scenario where\nbundling the script causes a problem.)"
543
548
  },
544
549
  "exportEntry": {
545
550
  "type": "string",
@@ -562,7 +567,7 @@
562
567
  },
563
568
  "serverEntry": {
564
569
  "type": "string",
565
- "description": "Path to the resource (.js, .ts, .tsx, etc) used to render the route from the server. (Also supports export map keys.)\n\nIt must export a default function implementing `RenderRouteFunction` defined in `@ms-cloudpack/app-server`."
570
+ "description": "Path to a TS, JS, or HTML file (relative to the app path) for rendering the route on the server. (Also supports export map keys.) If a JS or TS file, it will be bundled before rendering.\n\nIf JS or TS, it must export a default function implementing `RenderRouteFunction` defined in `@ms-cloudpack/app-server`."
566
571
  }
567
572
  },
568
573
  "additionalProperties": false,
@@ -613,7 +618,7 @@
613
618
  },
614
619
  "serverEntry": {
615
620
  "type": "string",
616
- "description": "Path to the resource (.js, .ts, .tsx, etc) used to render the route from the server. (Also supports export map keys.)\n\nIt must export a default function implementing `RenderRouteFunction` defined in `@ms-cloudpack/app-server`."
621
+ "description": "Path to a TS, JS, or HTML file (relative to the app path) for rendering the route on the server. (Also supports export map keys.) If a JS or TS file, it will be bundled before rendering.\n\nIf JS or TS, it must export a default function implementing `RenderRouteFunction` defined in `@ms-cloudpack/app-server`."
617
622
  },
618
623
  "exportEntry": {
619
624
  "type": "string",
@@ -1168,6 +1173,33 @@
1168
1173
  ],
1169
1174
  "additionalProperties": false,
1170
1175
  "description": "Azure Blob Storage configuration for remote cache - uploading and downloading packages via `cloudpack sync`."
1176
+ },
1177
+ "DefineFlags": {
1178
+ "type": "object",
1179
+ "additionalProperties": {
1180
+ "anyOf": [
1181
+ {
1182
+ "type": "string"
1183
+ },
1184
+ {
1185
+ "type": "number"
1186
+ },
1187
+ {
1188
+ "type": "boolean"
1189
+ },
1190
+ {
1191
+ "type": "array",
1192
+ "items": {
1193
+ "type": [
1194
+ "string",
1195
+ "number",
1196
+ "boolean"
1197
+ ]
1198
+ }
1199
+ }
1200
+ ]
1201
+ },
1202
+ "description": "DefineFlags is an interface that represents a collection of global variables that will be defined on the window object. Each define flag is represented by a key-value pair"
1171
1203
  }
1172
1204
  }
1173
1205
  }
@@ -96,6 +96,10 @@
96
96
  "type": "string"
97
97
  },
98
98
  "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."
99
+ },
100
+ "define": {
101
+ "$ref": "#/definitions/DefineFlags",
102
+ "description": "Key value pairs that will be used to define global variables in the runtime."
99
103
  }
100
104
  },
101
105
  "additionalProperties": false,
@@ -540,7 +544,8 @@
540
544
  },
541
545
  "renderScript": {
542
546
  "type": "string",
543
- "description": "Path to a .js or .html file (relative to the app path) for rendering the route.\n\nIf a .js file, it must export a default function implementing `RenderFunction` from `@ms-cloudpack/common-types`."
547
+ "description": "Path to a .js or .html file (relative to the app path) for rendering the route.\n\nIf a .js file, it must export a default function implementing `RenderFunction` from `@ms-cloudpack/common-types`.",
548
+ "deprecated": "Use `serverEntry` instead. (Please talk to the team if you have a scenario where\nbundling the script causes a problem.)"
544
549
  },
545
550
  "exportEntry": {
546
551
  "type": "string",
@@ -563,7 +568,7 @@
563
568
  },
564
569
  "serverEntry": {
565
570
  "type": "string",
566
- "description": "Path to the resource (.js, .ts, .tsx, etc) used to render the route from the server. (Also supports export map keys.)\n\nIt must export a default function implementing `RenderRouteFunction` defined in `@ms-cloudpack/app-server`."
571
+ "description": "Path to a TS, JS, or HTML file (relative to the app path) for rendering the route on the server. (Also supports export map keys.) If a JS or TS file, it will be bundled before rendering.\n\nIf JS or TS, it must export a default function implementing `RenderRouteFunction` defined in `@ms-cloudpack/app-server`."
567
572
  }
568
573
  },
569
574
  "additionalProperties": false,
@@ -614,7 +619,7 @@
614
619
  },
615
620
  "serverEntry": {
616
621
  "type": "string",
617
- "description": "Path to the resource (.js, .ts, .tsx, etc) used to render the route from the server. (Also supports export map keys.)\n\nIt must export a default function implementing `RenderRouteFunction` defined in `@ms-cloudpack/app-server`."
622
+ "description": "Path to a TS, JS, or HTML file (relative to the app path) for rendering the route on the server. (Also supports export map keys.) If a JS or TS file, it will be bundled before rendering.\n\nIf JS or TS, it must export a default function implementing `RenderRouteFunction` defined in `@ms-cloudpack/app-server`."
618
623
  },
619
624
  "exportEntry": {
620
625
  "type": "string",
@@ -1169,6 +1174,33 @@
1169
1174
  ],
1170
1175
  "additionalProperties": false,
1171
1176
  "description": "Azure Blob Storage configuration for remote cache - uploading and downloading packages via `cloudpack sync`."
1177
+ },
1178
+ "DefineFlags": {
1179
+ "type": "object",
1180
+ "additionalProperties": {
1181
+ "anyOf": [
1182
+ {
1183
+ "type": "string"
1184
+ },
1185
+ {
1186
+ "type": "number"
1187
+ },
1188
+ {
1189
+ "type": "boolean"
1190
+ },
1191
+ {
1192
+ "type": "array",
1193
+ "items": {
1194
+ "type": [
1195
+ "string",
1196
+ "number",
1197
+ "boolean"
1198
+ ]
1199
+ }
1200
+ }
1201
+ ]
1202
+ },
1203
+ "description": "DefineFlags is an interface that represents a collection of global variables that will be defined on the window object. Each define flag is represented by a key-value pair"
1172
1204
  }
1173
1205
  },
1174
1206
  "properties": {