@ms-cloudpack/common-types 0.24.20 → 0.25.1

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.
@@ -60,13 +60,20 @@ export interface PackageSettings {
60
60
  exports?: PackageJsonExports;
61
61
  /**
62
62
  * If specified, Cloudpack will not attempt to auto-generate ESM stubs for the package, but will
63
- * instead use the array of named exports you provide (per exports key). Any keys not included
63
+ * instead use the array of named exports you provide (per entry key). Any keys not included
64
64
  * will have a default export, but no named exports (so `{}` means that all entries should have
65
65
  * only a default export).
66
+ * An entry key is the output file path, relative to `outputPath` (with forward slashes and leading `./`)
67
+ * and *without* the extension (unless it's non-JS).
68
+ *
69
+ * You can also use the special value `'types'` to generate stubs based on the TypeScript declaration file
70
+ * if it exists. This will generate named exports for all types in the declaration file and relative imported files.
71
+ *
72
+ * Note: This is an escape hatch and should be used with caution, as it can lead to unexpected behavior.
66
73
  */
67
74
  unsafeCjsExportNames?: {
68
- [exportsKey: string]: string[];
69
- };
75
+ [entryKey: string]: string[];
76
+ } | 'types';
70
77
  /**
71
78
  * Forces the package to be bundled using a specific bundler.
72
79
  */
@@ -90,7 +97,7 @@ export interface PackageSettings {
90
97
  bundlerOptions?: Record<string, unknown>;
91
98
  /**
92
99
  * Paths used for file monitoring and input hashing. Supports glob matching.
93
- * Defaults are under "@ms-cloudpack/path-utilities" in `sourceFilesGlobs`.
100
+ * Defaults are under `@ms-cloudpack/path-utilities` in `sourceFilesGlobs`.
94
101
  * Use `...` to include the default paths.
95
102
  */
96
103
  inputPaths?: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"PackageSettings.d.ts","sourceRoot":"","sources":["../src/PackageSettings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAA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EG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;;;;;OASG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEzC;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IAEtB;;;;;;OAMG;IACH,oBAAoB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAE1D;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAE1B;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,MAAM,EAAE,CAAC;IAElC;;OAEG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,0BAA0B,CAAC;CAClD;AAED;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG,IAAI,CACzC,eAAe,EACf,sBAAsB,GAAG,sBAAsB,GAAG,gBAAgB,CACnE,GAAG;IACF;;;OAGG;IACH,KAAK,EAAE,MAAM,GAAG,QAAQ,CAAC,0BAA0B,CAAC,CAAC;IAErD;;OAEG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"PackageSettings.js","sourceRoot":"","sources":["../src/PackageSettings.ts"],"names":[],"mappings":"","sourcesContent":["import type { LinkOptions } from './LinkOptions.js';\nimport type { BundlerCapabilitiesOptions } from './BundlerCapability.js';\nimport type { PackageJsonExports, GeneratedExports } from './PackageJson.js';\n\nexport interface PackageSettingsMatchObject {\n /**\n * Name of the package. Can use a trailing wildcard (e.g. `@scope/*`). `*` to match any name.\n *\n * To negate a match, use `!` as the first character (e.g. `!@scope/foo` or `!@scope/*`).\n */\n name: string;\n\n /**\n * Version of the package. Unspecified matches any version.\n *\n * Note that if the package version is a prerelease, it will only match `*` or ranges that\n * explicitly include prereleases. For example, `^1.0.0` will not match `1.0.1-beta.0`.\n */\n version?: string;\n}\n\n/**\n * Which package(s) the settings should be applied to.\n * A string is a shorthand for matching the name with any version (`*` to match any name).\n */\nexport type PackageSettingsMatch = string | PackageSettingsMatchObject;\n\n/**\n * Settings overrides for bundling a package (or multiple packages, depending on `match`).\n */\nexport interface PackageSettings {\n /**\n * Which package(s) the settings should be applied to.\n * A string is a shorthand for matching the name with any version (`*` to match any name).\n * An array allows multiple matches to be specified.\n */\n match: PackageSettingsMatch | PackageSettingsMatch[];\n\n /**\n * The dependencies which should be included when computing the import map. This is primarily used when\n * devDependencies are needed by the app. This often happens when a library has a demo app which relies\n * on devDependencies.\n *\n * Accepts `$devDependencies` as a special value to include all devDependencies.\n */\n includedDependencies?: string[];\n\n /**\n * The dependencies which should be ignored by Cloudpack verbs. For example, if \"react-native\" is a dependency\n * which should not be included in the import map or evaluated during `init`, it can be listed here to ignore it.\n *\n * Accepts `$peerDependencies` as a special value to exclude all peerDependencies.\n */\n excludedDependencies?: string[];\n\n /**\n * Dependencies which should be inlined in the library bundled by Cloudpack. This is useful for\n * libraries which are small and don't need to be loaded separately, have issues being resolved\n * by the browser, or provide reusable scss files.\n */\n inlinedDependencies?: string[];\n\n /**\n * Use this exports map instead of the original entry points from package.json. (Any Cloudpack-\n * generated exports will be merged.) This is useful if a library's exports map is missing\n * or broken, or to skip bundling entries which aren't needed at runtime.\n */\n exports?: PackageJsonExports;\n\n /**\n * If specified, Cloudpack will not attempt to auto-generate ESM stubs for the package, but will\n * instead use the array of named exports you provide (per exports key). Any keys not included\n * will have a default export, but no named exports (so `{}` means that all entries should have\n * only a default export).\n */\n unsafeCjsExportNames?: { [exportsKey: string]: string[] };\n\n /**\n * Forces the package to be bundled using a specific bundler.\n */\n bundler?: string;\n\n /**\n * @deprecated Use `bundler`.\n *\n * This should be removed once repo configs are updated to use `bundler`.\n */\n bundlerType?: string;\n\n /**\n * Any bundler-specific options to be merged with the calculated bundler options.\n * `bundler` is also required if this is specified.\n *\n * This is an escape hatch which is generally not recommended, since it locks the package to\n * a specific bundler implementation. It's better to use built-in or custom bundler capabilities.\n *\n * WARNING: When merging package settings, `bundlerOptions` will be **overwritten** with\n * the last specified value.\n */\n bundlerOptions?: Record<string, unknown>;\n\n /**\n * Paths used for file monitoring and input hashing. Supports glob matching.\n * Defaults are under \"@ms-cloudpack/path-utilities\" in `sourceFilesGlobs`.\n * Use `...` to include the default paths.\n */\n inputPaths?: string[];\n\n /**\n * Controls the behavior of the `verifyExports` feature when checking consumed exports from this package:\n * - If true, don't check this package's exports at all.\n * - If an object, this is a mapping from package import paths to export names to ignore. Examples:\n * - To ignore top-level exports: `{ \".\": [\"badName\"] }`\n * - To ignore exports from another path: `{ \"./lib/foo\": [\"badName\"] }`\n */\n ignoreMissingExports?: boolean | Record<string, string[]>;\n\n /**\n * Only relevant for packages bundled with rollup: globs of files that include dynamic (async)\n * imports with non-literal paths, to be processed by `@rollup/plugin-dynamic-import-vars` (subject to\n * that plugin's [limitations](https://www.npmjs.com/package/\\@rollup/plugin-dynamic-import-vars#limitations)).\n * Files matching `*.dynamic.*` are automatically included.\n *\n * This is not needed for ori/esbuild and webpack because they should handle these types of imports automatically.\n */\n dynamicImports?: string[];\n\n /**\n * Ignore these warning messages from the bundler (partial string matches).\n * This is intended for non-actionable messages from external dependencies which can't easily\n * be fixed, to avoid confusing users.\n */\n ignoredBundlerWarnings?: string[];\n\n /**\n * Settings to control how the package is linked in the resolve map.\n */\n link?: LinkOptions;\n\n /**\n * Setting to control the bundler capabilities for this package.\n * This is used to enable or disable specific bundler capabilities.\n */\n bundlerCapabilities?: BundlerCapabilitiesOptions;\n}\n\n/**\n * Subset of PackageSettings used in the generated config.\n */\nexport type GeneratedPackageSettings = Pick<\n PackageSettings,\n 'includedDependencies' | 'excludedDependencies' | 'dynamicImports'\n> & {\n /**\n * This will be a string (name) for internal packages, or match with name and version for external.\n * The match in this case will NOT contain wildcards in the name.\n */\n match: string | Required<PackageSettingsMatchObject>;\n\n /**\n * Generated exports. This will always be a simple object with import paths.\n */\n exports?: GeneratedExports;\n};\n"]}
1
+ {"version":3,"file":"PackageSettings.js","sourceRoot":"","sources":["../src/PackageSettings.ts"],"names":[],"mappings":"","sourcesContent":["import type { LinkOptions } from './LinkOptions.js';\nimport type { BundlerCapabilitiesOptions } from './BundlerCapability.js';\nimport type { PackageJsonExports, GeneratedExports } from './PackageJson.js';\n\nexport interface PackageSettingsMatchObject {\n /**\n * Name of the package. Can use a trailing wildcard (e.g. `@scope/*`). `*` to match any name.\n *\n * To negate a match, use `!` as the first character (e.g. `!@scope/foo` or `!@scope/*`).\n */\n name: string;\n\n /**\n * Version of the package. Unspecified matches any version.\n *\n * Note that if the package version is a prerelease, it will only match `*` or ranges that\n * explicitly include prereleases. For example, `^1.0.0` will not match `1.0.1-beta.0`.\n */\n version?: string;\n}\n\n/**\n * Which package(s) the settings should be applied to.\n * A string is a shorthand for matching the name with any version (`*` to match any name).\n */\nexport type PackageSettingsMatch = string | PackageSettingsMatchObject;\n\n/**\n * Settings overrides for bundling a package (or multiple packages, depending on `match`).\n */\nexport interface PackageSettings {\n /**\n * Which package(s) the settings should be applied to.\n * A string is a shorthand for matching the name with any version (`*` to match any name).\n * An array allows multiple matches to be specified.\n */\n match: PackageSettingsMatch | PackageSettingsMatch[];\n\n /**\n * The dependencies which should be included when computing the import map. This is primarily used when\n * devDependencies are needed by the app. This often happens when a library has a demo app which relies\n * on devDependencies.\n *\n * Accepts `$devDependencies` as a special value to include all devDependencies.\n */\n includedDependencies?: string[];\n\n /**\n * The dependencies which should be ignored by Cloudpack verbs. For example, if \"react-native\" is a dependency\n * which should not be included in the import map or evaluated during `init`, it can be listed here to ignore it.\n *\n * Accepts `$peerDependencies` as a special value to exclude all peerDependencies.\n */\n excludedDependencies?: string[];\n\n /**\n * Dependencies which should be inlined in the library bundled by Cloudpack. This is useful for\n * libraries which are small and don't need to be loaded separately, have issues being resolved\n * by the browser, or provide reusable scss files.\n */\n inlinedDependencies?: string[];\n\n /**\n * Use this exports map instead of the original entry points from package.json. (Any Cloudpack-\n * generated exports will be merged.) This is useful if a library's exports map is missing\n * or broken, or to skip bundling entries which aren't needed at runtime.\n */\n exports?: PackageJsonExports;\n\n /**\n * If specified, Cloudpack will not attempt to auto-generate ESM stubs for the package, but will\n * instead use the array of named exports you provide (per entry key). Any keys not included\n * will have a default export, but no named exports (so `{}` means that all entries should have\n * only a default export).\n * An entry key is the output file path, relative to `outputPath` (with forward slashes and leading `./`)\n * and *without* the extension (unless it's non-JS).\n *\n * You can also use the special value `'types'` to generate stubs based on the TypeScript declaration file\n * if it exists. This will generate named exports for all types in the declaration file and relative imported files.\n *\n * Note: This is an escape hatch and should be used with caution, as it can lead to unexpected behavior.\n */\n unsafeCjsExportNames?: { [entryKey: string]: string[] } | 'types';\n\n /**\n * Forces the package to be bundled using a specific bundler.\n */\n bundler?: string;\n\n /**\n * @deprecated Use `bundler`.\n *\n * This should be removed once repo configs are updated to use `bundler`.\n */\n bundlerType?: string;\n\n /**\n * Any bundler-specific options to be merged with the calculated bundler options.\n * `bundler` is also required if this is specified.\n *\n * This is an escape hatch which is generally not recommended, since it locks the package to\n * a specific bundler implementation. It's better to use built-in or custom bundler capabilities.\n *\n * WARNING: When merging package settings, `bundlerOptions` will be **overwritten** with\n * the last specified value.\n */\n bundlerOptions?: Record<string, unknown>;\n\n /**\n * Paths used for file monitoring and input hashing. Supports glob matching.\n * Defaults are under `@ms-cloudpack/path-utilities` in `sourceFilesGlobs`.\n * Use `...` to include the default paths.\n */\n inputPaths?: string[];\n\n /**\n * Controls the behavior of the `verifyExports` feature when checking consumed exports from this package:\n * - If true, don't check this package's exports at all.\n * - If an object, this is a mapping from package import paths to export names to ignore. Examples:\n * - To ignore top-level exports: `{ \".\": [\"badName\"] }`\n * - To ignore exports from another path: `{ \"./lib/foo\": [\"badName\"] }`\n */\n ignoreMissingExports?: boolean | Record<string, string[]>;\n\n /**\n * Only relevant for packages bundled with rollup: globs of files that include dynamic (async)\n * imports with non-literal paths, to be processed by `@rollup/plugin-dynamic-import-vars` (subject to\n * that plugin's [limitations](https://www.npmjs.com/package/\\@rollup/plugin-dynamic-import-vars#limitations)).\n * Files matching `*.dynamic.*` are automatically included.\n *\n * This is not needed for ori/esbuild and webpack because they should handle these types of imports automatically.\n */\n dynamicImports?: string[];\n\n /**\n * Ignore these warning messages from the bundler (partial string matches).\n * This is intended for non-actionable messages from external dependencies which can't easily\n * be fixed, to avoid confusing users.\n */\n ignoredBundlerWarnings?: string[];\n\n /**\n * Settings to control how the package is linked in the resolve map.\n */\n link?: LinkOptions;\n\n /**\n * Setting to control the bundler capabilities for this package.\n * This is used to enable or disable specific bundler capabilities.\n */\n bundlerCapabilities?: BundlerCapabilitiesOptions;\n}\n\n/**\n * Subset of PackageSettings used in the generated config.\n */\nexport type GeneratedPackageSettings = Pick<\n PackageSettings,\n 'includedDependencies' | 'excludedDependencies' | 'dynamicImports'\n> & {\n /**\n * This will be a string (name) for internal packages, or match with name and version for external.\n * The match in this case will NOT contain wildcards in the name.\n */\n match: string | Required<PackageSettingsMatchObject>;\n\n /**\n * Generated exports. This will always be a simple object with import paths.\n */\n exports?: GeneratedExports;\n};\n"]}
package/lib/Session.d.ts CHANGED
@@ -6,13 +6,14 @@ export interface Session {
6
6
  /**
7
7
  * UUID for the session.
8
8
  */
9
- id: string;
9
+ readonly id: string;
10
10
  /**
11
11
  * The config used by the session.
12
12
  */
13
13
  config: CloudpackConfig;
14
14
  /**
15
15
  * Used to resolve packages in the dependency graph.
16
+ * Setting this will clear the `importMap`.
16
17
  *
17
18
  * NOTE: If the session (or whole API context) was created with `skipResolveDependencies`,
18
19
  * this will only contain the entry point package(s).
@@ -20,6 +21,8 @@ export interface Session {
20
21
  resolveMap: ResolveMap;
21
22
  /**
22
23
  * Reload sequence to ensure that the client is always up to date with the latest changes.
24
+ * (This is initially sent to the client via `pageSessionContext.currentSequence` and is updated
25
+ * via the `reloadCountSource`. It's read directly, not used as a URL cache breaker.)
23
26
  */
24
27
  sequence: number;
25
28
  /**
@@ -36,29 +39,33 @@ export interface Session {
36
39
  };
37
40
  /**
38
41
  * Used to force a hard refresh on the client.
42
+ * (Update with `incrementSessionVersion`.)
39
43
  */
40
- sessionVersion: number;
44
+ readonly sessionVersion: number;
41
45
  /**
42
- * Used to increment the session version by 1.
46
+ * Increment the session version to force a hard refresh on the client.
43
47
  */
44
- incrementSessionVersion: () => void;
48
+ readonly incrementSessionVersion: () => void;
45
49
  /**
46
50
  * The name of the project folder.
47
51
  * Used to differentiate between multiple projects.
48
52
  */
49
- projectName: string;
53
+ readonly projectName: string;
50
54
  /**
51
- * The version of each target.
55
+ * Cache-breaker version of each target (input path).
52
56
  * Used to force a client cache refresh on a single target.
57
+ *
58
+ * Update with `incrementTargetVersion`. (This will be empty by default.)
53
59
  */
54
- targetVersions: Record<string, number>;
60
+ readonly targetVersions: Readonly<Record<string, number>>;
55
61
  /**
56
- * Increments the version for the given target.
62
+ * Increments the cache-breaker version for the given target (input path).
63
+ * Used to force a client cache refresh on a single target.
57
64
  */
58
- incrementTargetVersion: (inputPath: string) => void;
65
+ readonly incrementTargetVersion: (inputPath: string) => void;
59
66
  /**
60
- * The current import map. This will only be set in contexts where an import map is needed,
61
- * such as during `cloudpack start` or for SSR.
67
+ * The current import map **for the browser**.
68
+ * This will only be set in contexts where an import map is needed, such as during `start`.
62
69
  */
63
70
  importMap: ImportMap | undefined;
64
71
  /**
@@ -67,7 +74,7 @@ export interface Session {
67
74
  * (Caching the import paths is useful for performance, as calculating them can be expensive.)
68
75
  * @example '/path/to/foo': `['foo', 'foo/bar']`
69
76
  */
70
- packageImportPaths: Map<string, string[]>;
77
+ readonly packageImportPaths: Map<string, string[]>;
71
78
  /**
72
79
  * Linked paths that are used to resolve packages from other repos.
73
80
  */
@@ -75,20 +82,20 @@ export interface Session {
75
82
  /**
76
83
  * Add the linked path and regenerates the resolve map.
77
84
  */
78
- addLinkedPath: (linkedPath: LinkedPath) => Promise<{
85
+ readonly addLinkedPath: (linkedPath: LinkedPath) => Promise<{
79
86
  resolveMap: ResolveMap;
80
87
  linkedPaths: LinkedPath[];
81
88
  }>;
82
89
  /**
83
90
  * Remove the linked path and regenerates the resolve map.
84
91
  */
85
- removeLinkedPath: (linkedPath: LinkedPath) => Promise<{
92
+ readonly removeLinkedPath: (linkedPath: LinkedPath) => Promise<{
86
93
  resolveMap: ResolveMap;
87
94
  linkedPaths: LinkedPath[];
88
95
  }>;
89
96
  /**
90
97
  * The path to the cache folder for the session.
91
98
  */
92
- cachePath: string;
99
+ readonly cachePath: string;
93
100
  }
94
101
  //# sourceMappingURL=Session.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Session.d.ts","sourceRoot":"","sources":["../src/Session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,MAAM,WAAW,OAAO;IACtB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,MAAM,EAAE,eAAe,CAAC;IAExB;;;;;OAKG;IACH,UAAU,EAAE,UAAU,CAAC;IAEvB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,IAAI,EAAE;QACJ,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,+FAA+F;QAC/F,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,4CAA4C;QAC5C,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;KAC1B,CAAC;IAEF;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,uBAAu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ACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"Session.js","sourceRoot":"","sources":["../src/Session.ts"],"names":[],"mappings":"","sourcesContent":["import type { ImportMap } from './ImportMap.js';\nimport type { LinkedPath } from './LinkedPath.js';\nimport type { ResolveMap } from './ResolveMap.js';\nimport type { CloudpackConfig } from './CloudpackConfig.js';\n\nexport interface Session {\n /**\n * UUID for the session.\n */\n id: string;\n\n /**\n * The config used by the session.\n */\n config: CloudpackConfig;\n\n /**\n * Used to resolve packages in the dependency graph.\n *\n * NOTE: If the session (or whole API context) was created with `skipResolveDependencies`,\n * this will only contain the entry point package(s).\n */\n resolveMap: ResolveMap;\n\n /**\n * Reload sequence to ensure that the client is always up to date with the latest changes.\n */\n sequence: number;\n\n /**\n * URLs of the active servers hosting this session.\n * Each URL will only be set after the server is started.\n */\n urls: {\n appServer?: string;\n /** If `useSingleWebServer` is enabled, this will be a URL for bundles under the app server. */\n bundleServer?: string;\n apiServer?: string;\n /** Api server urls only used for linking */\n hostApiServer?: string[];\n };\n\n /**\n * Used to force a hard refresh on the client.\n */\n sessionVersion: number;\n\n /**\n * Used to increment the session version by 1.\n */\n incrementSessionVersion: () => void;\n\n /**\n * The name of the project folder.\n * Used to differentiate between multiple projects.\n */\n projectName: string;\n\n /**\n * The version of each target.\n * Used to force a client cache refresh on a single target.\n */\n targetVersions: Record<string, number>;\n\n /**\n * Increments the version for the given target.\n */\n incrementTargetVersion: (inputPath: string) => void;\n\n /**\n * The current import map. This will only be set in contexts where an import map is needed,\n * such as during `cloudpack start` or for SSR.\n */\n importMap: ImportMap | undefined;\n\n /**\n * Cached mapping from absolute package path to all import paths for that package, calculated by\n * `createImportMap`. This is used by `addImportMapHash` to update the import map after bundling.\n * (Caching the import paths is useful for performance, as calculating them can be expensive.)\n * @example '/path/to/foo': `['foo', 'foo/bar']`\n */\n packageImportPaths: Map<string, string[]>;\n\n /**\n * Linked paths that are used to resolve packages from other repos.\n */\n linkedPaths: LinkedPath[];\n\n /**\n * Add the linked path and regenerates the resolve map.\n */\n addLinkedPath: (linkedPath: LinkedPath) => Promise<{ resolveMap: ResolveMap; linkedPaths: LinkedPath[] }>;\n\n /**\n * Remove the linked path and regenerates the resolve map.\n */\n removeLinkedPath: (linkedPath: LinkedPath) => Promise<{ resolveMap: ResolveMap; linkedPaths: LinkedPath[] }>;\n\n /**\n * The path to the cache folder for the session.\n */\n cachePath: string;\n}\n"]}
1
+ {"version":3,"file":"Session.js","sourceRoot":"","sources":["../src/Session.ts"],"names":[],"mappings":"","sourcesContent":["import type { ImportMap } from './ImportMap.js';\nimport type { LinkedPath } from './LinkedPath.js';\nimport type { ResolveMap } from './ResolveMap.js';\nimport type { CloudpackConfig } from './CloudpackConfig.js';\n\nexport interface Session {\n /**\n * UUID for the session.\n */\n readonly id: string;\n\n /**\n * The config used by the session.\n */\n config: CloudpackConfig;\n\n /**\n * Used to resolve packages in the dependency graph.\n * Setting this will clear the `importMap`.\n *\n * NOTE: If the session (or whole API context) was created with `skipResolveDependencies`,\n * this will only contain the entry point package(s).\n */\n resolveMap: ResolveMap;\n\n /**\n * Reload sequence to ensure that the client is always up to date with the latest changes.\n * (This is initially sent to the client via `pageSessionContext.currentSequence` and is updated\n * via the `reloadCountSource`. It's read directly, not used as a URL cache breaker.)\n */\n sequence: number;\n\n /**\n * URLs of the active servers hosting this session.\n * Each URL will only be set after the server is started.\n */\n urls: {\n appServer?: string;\n /** If `useSingleWebServer` is enabled, this will be a URL for bundles under the app server. */\n bundleServer?: string;\n apiServer?: string;\n /** Api server urls only used for linking */\n hostApiServer?: string[];\n };\n\n /**\n * Used to force a hard refresh on the client.\n * (Update with `incrementSessionVersion`.)\n */\n readonly sessionVersion: number;\n\n /**\n * Increment the session version to force a hard refresh on the client.\n */\n readonly incrementSessionVersion: () => void;\n\n /**\n * The name of the project folder.\n * Used to differentiate between multiple projects.\n */\n readonly projectName: string;\n\n /**\n * Cache-breaker version of each target (input path).\n * Used to force a client cache refresh on a single target.\n *\n * Update with `incrementTargetVersion`. (This will be empty by default.)\n */\n readonly targetVersions: Readonly<Record<string, number>>;\n\n /**\n * Increments the cache-breaker version for the given target (input path).\n * Used to force a client cache refresh on a single target.\n */\n readonly incrementTargetVersion: (inputPath: string) => void;\n\n /**\n * The current import map **for the browser**.\n * This will only be set in contexts where an import map is needed, such as during `start`.\n */\n importMap: ImportMap | undefined;\n\n /**\n * Cached mapping from absolute package path to all import paths for that package, calculated by\n * `createImportMap`. This is used by `addImportMapHash` to update the import map after bundling.\n * (Caching the import paths is useful for performance, as calculating them can be expensive.)\n * @example '/path/to/foo': `['foo', 'foo/bar']`\n */\n readonly packageImportPaths: Map<string, string[]>;\n\n /**\n * Linked paths that are used to resolve packages from other repos.\n */\n linkedPaths: LinkedPath[];\n\n /**\n * Add the linked path and regenerates the resolve map.\n */\n readonly addLinkedPath: (linkedPath: LinkedPath) => Promise<{ resolveMap: ResolveMap; linkedPaths: LinkedPath[] }>;\n\n /**\n * Remove the linked path and regenerates the resolve map.\n */\n readonly removeLinkedPath: (linkedPath: LinkedPath) => Promise<{ resolveMap: ResolveMap; linkedPaths: LinkedPath[] }>;\n\n /**\n * The path to the cache folder for the session.\n */\n readonly cachePath: string;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/common-types",
3
- "version": "0.24.20",
3
+ "version": "0.25.1",
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.6.1",
17
+ "@ms-cloudpack/common-types-browser": "^0.6.2",
18
18
  "@types/express": "^4.17.16"
19
19
  },
20
20
  "devDependencies": {
@@ -175,6 +175,10 @@
175
175
  "not": {},
176
176
  "description": "If set, this will be called when a client opens a connection using the ALPN extension. One argument will be passed to the callback: an object containing `servername` and `protocols` fields, respectively containing the server name from the SNI extension (if any) and an array of ALPN protocol name strings. The callback must return either one of the strings listed in `protocols`, which will be returned to the client as the selected ALPN protocol, or `undefined`, to reject the connection with a fatal alert. If a string is returned that does not match one of the client's ALPN protocols, an error will be thrown. This option cannot be used with the `ALPNProtocols` option, and setting both options will throw an error."
177
177
  },
178
+ "allowPartialTrustChain": {
179
+ "type": "boolean",
180
+ "description": "Treat intermediate (non-self-signed) certificates in the trust CA certificate list as trusted."
181
+ },
178
182
  "ca": {
179
183
  "anyOf": [
180
184
  {
@@ -398,7 +402,7 @@
398
402
  "highWaterMark": {
399
403
  "type": "number",
400
404
  "description": "Optionally overrides all `net.Socket`s' `readableHighWaterMark` and `writableHighWaterMark`.",
401
- "default": "See [stream.getDefaultHighWaterMark()](https://nodejs.org/docs/latest-v18.x/api/stream.html#streamgetdefaulthighwatermarkobjectmode)."
405
+ "default": "See [stream.getDefaultHighWaterMark()](https://nodejs.org/docs/latest-v20.x/api/stream.html#streamgetdefaulthighwatermarkobjectmode)."
402
406
  },
403
407
  "requestTimeout": {
404
408
  "type": "number",
@@ -435,6 +439,11 @@
435
439
  "description": "Optionally overrides the value of `--max-http-header-size` for requests received by this server, i.e. the maximum length of request headers in bytes.",
436
440
  "default": 16384
437
441
  },
442
+ "requireHostHeader": {
443
+ "type": "boolean",
444
+ "description": "If set to `true`, it forces the server to respond with a 400 (Bad Request) status code to any HTTP/1.1 request message that lacks a Host header (as mandated by the specification).",
445
+ "default": true
446
+ },
438
447
  "uniqueHeaders": {
439
448
  "type": "array",
440
449
  "items": {
@@ -899,14 +908,22 @@
899
908
  "description": "Use this exports map instead of the original entry points from package.json. (Any Cloudpack- generated exports will be merged.) This is useful if a library's exports map is missing or broken, or to skip bundling entries which aren't needed at runtime."
900
909
  },
901
910
  "unsafeCjsExportNames": {
902
- "type": "object",
903
- "additionalProperties": {
904
- "type": "array",
905
- "items": {
906
- "type": "string"
911
+ "anyOf": [
912
+ {
913
+ "type": "object",
914
+ "additionalProperties": {
915
+ "type": "array",
916
+ "items": {
917
+ "type": "string"
918
+ }
919
+ }
920
+ },
921
+ {
922
+ "type": "string",
923
+ "const": "types"
907
924
  }
908
- },
909
- "description": "If specified, Cloudpack will not attempt to auto-generate ESM stubs for the package, but will instead use the array of named exports you provide (per exports key). Any keys not included will have a default export, but no named exports (so `{}` means that all entries should have only a default export)."
925
+ ],
926
+ "description": "If specified, Cloudpack will not attempt to auto-generate ESM stubs for the package, but will instead use the array of named exports you provide (per entry key). Any keys not included will have a default export, but no named exports (so `{}` means that all entries should have only a default export). An entry key is the output file path, relative to `outputPath` (with forward slashes and leading `./`) and *without* the extension (unless it's non-JS).\n\nYou can also use the special value `'types'` to generate stubs based on the TypeScript declaration file if it exists. This will generate named exports for all types in the declaration file and relative imported files.\n\nNote: This is an escape hatch and should be used with caution, as it can lead to unexpected behavior."
910
927
  },
911
928
  "bundler": {
912
929
  "type": "string",
@@ -926,7 +943,7 @@
926
943
  "items": {
927
944
  "type": "string"
928
945
  },
929
- "description": "Paths used for file monitoring and input hashing. Supports glob matching. Defaults are under \"@ms-cloudpack/path-utilities\" in `sourceFilesGlobs`. Use `...` to include the default paths."
946
+ "description": "Paths used for file monitoring and input hashing. Supports glob matching. Defaults are under `@ms-cloudpack/path-utilities` in `sourceFilesGlobs`. Use `...` to include the default paths."
930
947
  },
931
948
  "ignoreMissingExports": {
932
949
  "anyOf": [
@@ -176,6 +176,10 @@
176
176
  "not": {},
177
177
  "description": "If set, this will be called when a client opens a connection using the ALPN extension. One argument will be passed to the callback: an object containing `servername` and `protocols` fields, respectively containing the server name from the SNI extension (if any) and an array of ALPN protocol name strings. The callback must return either one of the strings listed in `protocols`, which will be returned to the client as the selected ALPN protocol, or `undefined`, to reject the connection with a fatal alert. If a string is returned that does not match one of the client's ALPN protocols, an error will be thrown. This option cannot be used with the `ALPNProtocols` option, and setting both options will throw an error."
178
178
  },
179
+ "allowPartialTrustChain": {
180
+ "type": "boolean",
181
+ "description": "Treat intermediate (non-self-signed) certificates in the trust CA certificate list as trusted."
182
+ },
179
183
  "ca": {
180
184
  "anyOf": [
181
185
  {
@@ -399,7 +403,7 @@
399
403
  "highWaterMark": {
400
404
  "type": "number",
401
405
  "description": "Optionally overrides all `net.Socket`s' `readableHighWaterMark` and `writableHighWaterMark`.",
402
- "default": "See [stream.getDefaultHighWaterMark()](https://nodejs.org/docs/latest-v18.x/api/stream.html#streamgetdefaulthighwatermarkobjectmode)."
406
+ "default": "See [stream.getDefaultHighWaterMark()](https://nodejs.org/docs/latest-v20.x/api/stream.html#streamgetdefaulthighwatermarkobjectmode)."
403
407
  },
404
408
  "requestTimeout": {
405
409
  "type": "number",
@@ -436,6 +440,11 @@
436
440
  "description": "Optionally overrides the value of `--max-http-header-size` for requests received by this server, i.e. the maximum length of request headers in bytes.",
437
441
  "default": 16384
438
442
  },
443
+ "requireHostHeader": {
444
+ "type": "boolean",
445
+ "description": "If set to `true`, it forces the server to respond with a 400 (Bad Request) status code to any HTTP/1.1 request message that lacks a Host header (as mandated by the specification).",
446
+ "default": true
447
+ },
439
448
  "uniqueHeaders": {
440
449
  "type": "array",
441
450
  "items": {
@@ -900,14 +909,22 @@
900
909
  "description": "Use this exports map instead of the original entry points from package.json. (Any Cloudpack- generated exports will be merged.) This is useful if a library's exports map is missing or broken, or to skip bundling entries which aren't needed at runtime."
901
910
  },
902
911
  "unsafeCjsExportNames": {
903
- "type": "object",
904
- "additionalProperties": {
905
- "type": "array",
906
- "items": {
907
- "type": "string"
912
+ "anyOf": [
913
+ {
914
+ "type": "object",
915
+ "additionalProperties": {
916
+ "type": "array",
917
+ "items": {
918
+ "type": "string"
919
+ }
920
+ }
921
+ },
922
+ {
923
+ "type": "string",
924
+ "const": "types"
908
925
  }
909
- },
910
- "description": "If specified, Cloudpack will not attempt to auto-generate ESM stubs for the package, but will instead use the array of named exports you provide (per exports key). Any keys not included will have a default export, but no named exports (so `{}` means that all entries should have only a default export)."
926
+ ],
927
+ "description": "If specified, Cloudpack will not attempt to auto-generate ESM stubs for the package, but will instead use the array of named exports you provide (per entry key). Any keys not included will have a default export, but no named exports (so `{}` means that all entries should have only a default export). An entry key is the output file path, relative to `outputPath` (with forward slashes and leading `./`) and *without* the extension (unless it's non-JS).\n\nYou can also use the special value `'types'` to generate stubs based on the TypeScript declaration file if it exists. This will generate named exports for all types in the declaration file and relative imported files.\n\nNote: This is an escape hatch and should be used with caution, as it can lead to unexpected behavior."
911
928
  },
912
929
  "bundler": {
913
930
  "type": "string",
@@ -927,7 +944,7 @@
927
944
  "items": {
928
945
  "type": "string"
929
946
  },
930
- "description": "Paths used for file monitoring and input hashing. Supports glob matching. Defaults are under \"@ms-cloudpack/path-utilities\" in `sourceFilesGlobs`. Use `...` to include the default paths."
947
+ "description": "Paths used for file monitoring and input hashing. Supports glob matching. Defaults are under `@ms-cloudpack/path-utilities` in `sourceFilesGlobs`. Use `...` to include the default paths."
931
948
  },
932
949
  "ignoreMissingExports": {
933
950
  "anyOf": [