@ms-cloudpack/common-types 0.24.11 → 0.24.13
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.
- package/lib/AppConfig.d.ts +3 -0
- package/lib/AppConfig.d.ts.map +1 -1
- package/lib/AppConfig.js.map +1 -1
- package/lib/PackageDefinitionsCache.d.ts +12 -2
- package/lib/PackageDefinitionsCache.d.ts.map +1 -1
- package/lib/PackageDefinitionsCache.js.map +1 -1
- package/lib/PackageHashesCache.d.ts +15 -6
- package/lib/PackageHashesCache.d.ts.map +1 -1
- package/lib/PackageHashesCache.js.map +1 -1
- package/lib/PackageJson.d.ts +5 -0
- package/lib/PackageJson.d.ts.map +1 -1
- package/lib/PackageJson.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/schema/AppConfig.json +1 -1
- package/schema/UserConfig.json +1 -1
package/lib/AppConfig.d.ts
CHANGED
|
@@ -55,6 +55,9 @@ export interface AppConfig {
|
|
|
55
55
|
/**
|
|
56
56
|
* Glob pattern to match `patch-package` patch files, relative to the project root
|
|
57
57
|
* (usually the same as the repository root).
|
|
58
|
+
*
|
|
59
|
+
* Note that if you're using `yarn patch` (v2+), those patches will be handled automatically
|
|
60
|
+
* (not by this glob pattern).
|
|
58
61
|
* @default "patches/*.patch"
|
|
59
62
|
*/
|
|
60
63
|
patchFilesGlobPattern?: string;
|
package/lib/AppConfig.d.ts.map
CHANGED
|
@@ -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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W,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;;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;;;;;;;OAOG;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"}
|
package/lib/AppConfig.js.map
CHANGED
|
@@ -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';\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"]}
|
|
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 *\n * Note that if you're using `yarn patch` (v2+), those patches will be handled automatically\n * (not by this glob pattern).\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"]}
|
|
@@ -31,6 +31,11 @@ export interface GetPackageDefinitionOptions {
|
|
|
31
31
|
/** Info about the package that is importing this package, if known. */
|
|
32
32
|
importerContext?: PackageImporterContext;
|
|
33
33
|
}
|
|
34
|
+
/** Serializable representation of the package definitions cache. */
|
|
35
|
+
export interface SerializablePackageDefinitionsCache {
|
|
36
|
+
definitions: Record<string, PackageJson | undefined>;
|
|
37
|
+
transformedDefinitions: Record<string, PackageJson | undefined>;
|
|
38
|
+
}
|
|
34
39
|
/**
|
|
35
40
|
* Utility class for reading and caching package definition (`package.json`) objects,
|
|
36
41
|
* and optionally applying transforms.
|
|
@@ -63,8 +68,13 @@ export interface PackageDefinitionsCache {
|
|
|
63
68
|
newConfig?: CloudpackConfig;
|
|
64
69
|
}): void;
|
|
65
70
|
/**
|
|
66
|
-
*
|
|
71
|
+
* Extends the cache with a serializable representation of the cache.
|
|
72
|
+
* This is useful for merging caches from different sources (e.g. link).
|
|
73
|
+
*/
|
|
74
|
+
extend(input: SerializablePackageDefinitionsCache): void;
|
|
75
|
+
/**
|
|
76
|
+
* Creates a serializable representation of the cache.
|
|
67
77
|
*/
|
|
68
|
-
|
|
78
|
+
toSerializable(): SerializablePackageDefinitionsCache;
|
|
69
79
|
}
|
|
70
80
|
//# sourceMappingURL=PackageDefinitionsCache.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PackageDefinitionsCache.d.ts","sourceRoot":"","sources":["../src/PackageDefinitionsCache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,sFAAsF;AACtF,MAAM,WAAW,sBAAsB;IACrC,8DAA8D;IAC9D,UAAU,EAAE,MAAM,CAAC;IACnB,iEAAiE;IACjE,aAAa,EAAE,MAAM,CAAC;IACtB,+DAA+D;IAC/D,YAAY,EAAE,MAAM,CAAC;IACrB,0DAA0D;IAC1D,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED;;;;GAIG;AACH,MAAM,MAAM,0BAA0B,GAAG,CAAC,MAAM,EAAE;IAChD,UAAU,EAAE,WAAW,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,uBAAuB,CAAC;IAClC,eAAe,CAAC,EAAE,sBAAsB,CAAC;CAC1C,KAAK,WAAW,GAAG,SAAS,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CAAC;AAEjE,MAAM,MAAM,iCAAiC,GAAG,CAAC,MAAM,CAAC,EAAE,eAAe,KAAK,0BAA0B,CAAC;AAEzG,MAAM,WAAW,2BAA2B;IAC1C,iEAAiE;IACjE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,+CAA+C;IAC/C,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,uEAAuE;IACvE,eAAe,CAAC,EAAE,sBAAsB,CAAC;CAC1C;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,2BAA2B,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAEtF;;;OAGG;IAC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OAAO,CAAC;IAC5B,uEAAuE;IACvE,eAAe,CAAC,EAAE,sBAAsB,CAAC;CAC1C;AAED,oEAAoE;AACpE,MAAM,WAAW,mCAAmC;IAClD,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC,CAAC;IACrD,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC,CAAC;CACjE;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,2BAA2B,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAEtF;;;OAGG;IACH,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,2BAA2B,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CAAC;IAErG;;;;;OAKG;IACH,iBAAiB,CAAC,OAAO,EAAE,iCAAiC,GAAG,IAAI,CAAC;IAEpE;;;;OAIG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,eAAe,CAAA;KAAE,GAAG,IAAI,CAAC;IAEvD;;;OAGG;IACH,MAAM,CAAC,KAAK,EAAE,mCAAmC,GAAG,IAAI,CAAC;IAEzD;;OAEG;IACH,cAAc,IAAI,mCAAmC,CAAC;CACvD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PackageDefinitionsCache.js","sourceRoot":"","sources":["../src/PackageDefinitionsCache.ts"],"names":[],"mappings":"","sourcesContent":["import type { CloudpackConfig } from './CloudpackConfig.js';\nimport type { PackageJson } from './PackageJson.js';\n\n/** Provides context about how a parent package imports/depends on another package. */\nexport interface PackageImporterContext {\n /** Actual name of the package that requested this package. */\n parentName: string;\n /** Actual version of the package that requested this package. */\n parentVersion: string;\n /** Name under which this package is imported by the parent. */\n importedName: string;\n /** Version spec the parent requested for this package. */\n versionRequirement: string;\n}\n\n/**\n * Transform applied to a `package.json` file after it's read.\n * `PackageDefinitions` clones the original object, so it's okay for transforms to mutate properties.\n * @returns The transformed definition, or undefined if there were no changes.\n */\nexport type PackageDefinitionTransform = (params: {\n definition: PackageJson;\n packagePath: string;\n packages: PackageDefinitionsCache;\n importerContext?: PackageImporterContext;\n}) => PackageJson | undefined | Promise<PackageJson | undefined>;\n\nexport type PackageDefinitionTransformFactory = (config?: CloudpackConfig) => PackageDefinitionTransform;\n\nexport interface GetPackageDefinitionOptions {\n /** If true, the package definition will be re-read from disk. */\n refresh?: boolean;\n /** If true, transforms will not be applied. */\n disableTransforms?: boolean;\n /** Info about the package that is importing this package, if known. */\n importerContext?: PackageImporterContext;\n}\n\n/**\n * Utility class for reading and caching package definition (`package.json`) objects,\n * and optionally applying transforms.\n */\nexport interface PackageDefinitionsCache {\n /**\n * Get a `package.json` (either from cache or disk) and apply transforms.\n * Throws an error if the file isn't found or there's an error parsing it.\n * (Use `tryGet` to avoid throwing.)\n */\n get(packagePath: string, options?: GetPackageDefinitionOptions): Promise<PackageJson>;\n\n /**\n * Get a `package.json` (either from cache or disk) and apply transforms.\n * Returns undefined if the file isn't found or there's an error parsing it.\n */\n tryGet(packagePath: string, options?: GetPackageDefinitionOptions): Promise<PackageJson | undefined>;\n\n /**\n * Registers a transform factory function, which will be called on initialization, and when reset,\n * to re-generate the transform function. Transform functions are called only when the package\n * definition hasn't been loaded before, and the result will be cached.\n * Calling `reset` will reset the cache.\n */\n registerTransform(factory: PackageDefinitionTransformFactory): void;\n\n /**\n * Resets the cache. If a `newConfig` value is provided, the transform factories will be called with the new value\n * to give them an opportunity to reflect changes to the config. It is `unknown` because the config type is\n * application-specific.\n */\n reset(options?: { newConfig?: CloudpackConfig }): void;\n\n /**\n *
|
|
1
|
+
{"version":3,"file":"PackageDefinitionsCache.js","sourceRoot":"","sources":["../src/PackageDefinitionsCache.ts"],"names":[],"mappings":"","sourcesContent":["import type { CloudpackConfig } from './CloudpackConfig.js';\nimport type { PackageJson } from './PackageJson.js';\n\n/** Provides context about how a parent package imports/depends on another package. */\nexport interface PackageImporterContext {\n /** Actual name of the package that requested this package. */\n parentName: string;\n /** Actual version of the package that requested this package. */\n parentVersion: string;\n /** Name under which this package is imported by the parent. */\n importedName: string;\n /** Version spec the parent requested for this package. */\n versionRequirement: string;\n}\n\n/**\n * Transform applied to a `package.json` file after it's read.\n * `PackageDefinitions` clones the original object, so it's okay for transforms to mutate properties.\n * @returns The transformed definition, or undefined if there were no changes.\n */\nexport type PackageDefinitionTransform = (params: {\n definition: PackageJson;\n packagePath: string;\n packages: PackageDefinitionsCache;\n importerContext?: PackageImporterContext;\n}) => PackageJson | undefined | Promise<PackageJson | undefined>;\n\nexport type PackageDefinitionTransformFactory = (config?: CloudpackConfig) => PackageDefinitionTransform;\n\nexport interface GetPackageDefinitionOptions {\n /** If true, the package definition will be re-read from disk. */\n refresh?: boolean;\n /** If true, transforms will not be applied. */\n disableTransforms?: boolean;\n /** Info about the package that is importing this package, if known. */\n importerContext?: PackageImporterContext;\n}\n\n/** Serializable representation of the package definitions cache. */\nexport interface SerializablePackageDefinitionsCache {\n definitions: Record<string, PackageJson | undefined>;\n transformedDefinitions: Record<string, PackageJson | undefined>;\n}\n\n/**\n * Utility class for reading and caching package definition (`package.json`) objects,\n * and optionally applying transforms.\n */\nexport interface PackageDefinitionsCache {\n /**\n * Get a `package.json` (either from cache or disk) and apply transforms.\n * Throws an error if the file isn't found or there's an error parsing it.\n * (Use `tryGet` to avoid throwing.)\n */\n get(packagePath: string, options?: GetPackageDefinitionOptions): Promise<PackageJson>;\n\n /**\n * Get a `package.json` (either from cache or disk) and apply transforms.\n * Returns undefined if the file isn't found or there's an error parsing it.\n */\n tryGet(packagePath: string, options?: GetPackageDefinitionOptions): Promise<PackageJson | undefined>;\n\n /**\n * Registers a transform factory function, which will be called on initialization, and when reset,\n * to re-generate the transform function. Transform functions are called only when the package\n * definition hasn't been loaded before, and the result will be cached.\n * Calling `reset` will reset the cache.\n */\n registerTransform(factory: PackageDefinitionTransformFactory): void;\n\n /**\n * Resets the cache. If a `newConfig` value is provided, the transform factories will be called with the new value\n * to give them an opportunity to reflect changes to the config. It is `unknown` because the config type is\n * application-specific.\n */\n reset(options?: { newConfig?: CloudpackConfig }): void;\n\n /**\n * Extends the cache with a serializable representation of the cache.\n * This is useful for merging caches from different sources (e.g. link).\n */\n extend(input: SerializablePackageDefinitionsCache): void;\n\n /**\n * Creates a serializable representation of the cache.\n */\n toSerializable(): SerializablePackageDefinitionsCache;\n}\n"]}
|
|
@@ -3,13 +3,13 @@ import type { TargetEnvironment } from './TargetEnvironment.js';
|
|
|
3
3
|
* Serializable representation of the package hashes cache.
|
|
4
4
|
*/
|
|
5
5
|
export interface SerializablePackageHashesCache {
|
|
6
|
-
hashesWithSource
|
|
7
|
-
browser
|
|
8
|
-
node
|
|
6
|
+
hashesWithSource: {
|
|
7
|
+
browser: Record<string, string>;
|
|
8
|
+
node: Record<string, string>;
|
|
9
9
|
};
|
|
10
|
-
hashesWithNoSource
|
|
11
|
-
browser
|
|
12
|
-
node
|
|
10
|
+
hashesWithNoSource: {
|
|
11
|
+
browser: Record<string, string>;
|
|
12
|
+
node: Record<string, string>;
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
@@ -26,6 +26,15 @@ export interface PackageHashesCache {
|
|
|
26
26
|
* Creates a serializable representation of the cache.
|
|
27
27
|
*/
|
|
28
28
|
toSerializable(): SerializablePackageHashesCache;
|
|
29
|
+
/**
|
|
30
|
+
* Sets the hash for a given package path. This is useful when the hash needs to be set manually (e.g. link).
|
|
31
|
+
*/
|
|
32
|
+
set(input: Omit<PackageHashOptions, 'shouldRecalculate'>, hash: string): void;
|
|
33
|
+
/**
|
|
34
|
+
* Extends the cache with a serializable representation of the cache.
|
|
35
|
+
* This is useful for merging caches from different sources (e.g. link).
|
|
36
|
+
*/
|
|
37
|
+
extend(input: SerializablePackageHashesCache): void;
|
|
29
38
|
}
|
|
30
39
|
/**
|
|
31
40
|
* Options for hashing a package (`PackageHashes.get`).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PackageHashesCache.d.ts","sourceRoot":"","sources":["../src/PackageHashesCache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C,gBAAgB,
|
|
1
|
+
{"version":3,"file":"PackageHashesCache.d.ts","sourceRoot":"","sources":["../src/PackageHashesCache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C,gBAAgB,EAAE;QAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAChC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC9B,CAAC;IACF,kBAAkB,EAAE;QAClB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAChC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC9B,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,GAAG,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEhD;;OAEG;IACH,cAAc,IAAI,8BAA8B,CAAC;IAEjD;;OAEG;IACH,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,kBAAkB,EAAE,mBAAmB,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAE9E;;;OAGG;IACH,MAAM,CAAC,KAAK,EAAE,8BAA8B,GAAG,IAAI,CAAC;CACrD;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,4CAA4C;IAC5C,WAAW,EAAE,MAAM,CAAC;IAEpB,0CAA0C;IAC1C,iBAAiB,EAAE,iBAAiB,CAAC;IAErC,+CAA+C;IAC/C,sBAAsB,EAAE,OAAO,CAAC;IAEhC,qDAAqD;IACrD,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PackageHashesCache.js","sourceRoot":"","sources":["../src/PackageHashesCache.ts"],"names":[],"mappings":"","sourcesContent":["import type { TargetEnvironment } from './TargetEnvironment.js';\n\n/**\n * Serializable representation of the package hashes cache.\n */\nexport interface SerializablePackageHashesCache {\n hashesWithSource
|
|
1
|
+
{"version":3,"file":"PackageHashesCache.js","sourceRoot":"","sources":["../src/PackageHashesCache.ts"],"names":[],"mappings":"","sourcesContent":["import type { TargetEnvironment } from './TargetEnvironment.js';\n\n/**\n * Serializable representation of the package hashes cache.\n */\nexport interface SerializablePackageHashesCache {\n hashesWithSource: {\n browser: Record<string, string>;\n node: Record<string, string>;\n };\n hashesWithNoSource: {\n browser: Record<string, string>;\n node: Record<string, string>;\n };\n}\n\n/**\n * Utility class for hashing packages and caching the results.\n */\nexport interface PackageHashesCache {\n /**\n * Gets the hash for a given package path. This is useful for caching, to determine if the package has changed.\n * If the package definition has not been read, it will be read and cached.\n * @returns The hash for the package.\n */\n get(input: PackageHashOptions): Promise<string>;\n\n /**\n * Creates a serializable representation of the cache.\n */\n toSerializable(): SerializablePackageHashesCache;\n\n /**\n * Sets the hash for a given package path. This is useful when the hash needs to be set manually (e.g. link).\n */\n set(input: Omit<PackageHashOptions, 'shouldRecalculate'>, hash: string): void;\n\n /**\n * Extends the cache with a serializable representation of the cache.\n * This is useful for merging caches from different sources (e.g. link).\n */\n extend(input: SerializablePackageHashesCache): void;\n}\n\n/**\n * Options for hashing a package (`PackageHashes.get`).\n */\nexport interface PackageHashOptions {\n /** The package path to get the hash for. */\n packagePath: string;\n\n /** The target environment to hash for. */\n targetEnvironment: TargetEnvironment;\n\n /** Whether or not to hash the source files. */\n isSourceHashingEnabled: boolean;\n\n /** Whether to force a re-calculation of the hash. */\n shouldRecalculate?: boolean;\n}\n"]}
|
package/lib/PackageJson.d.ts
CHANGED
|
@@ -66,6 +66,11 @@ export type PackageJson = {
|
|
|
66
66
|
export interface PackageJsonCloudpackMeta extends Omit<PackageSettings, 'match' | 'exports' | 'includedDependencies' | 'excludedDependencies' | 'bundlerType'> {
|
|
67
67
|
/** Controls how the package is bundled. */
|
|
68
68
|
mode: BundleMode;
|
|
69
|
+
/**
|
|
70
|
+
* If the package manager is yarn berry (v2+) and the package has been patched with `yarn patch`,
|
|
71
|
+
* this is the path to the patch file relative to the project root (set by `getNonSemverTransform`).
|
|
72
|
+
*/
|
|
73
|
+
patchFilePath?: string;
|
|
69
74
|
}
|
|
70
75
|
/**
|
|
71
76
|
* Union type which has intellisense for specific keys but also allows arbitrary strings.
|
package/lib/PackageJson.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PackageJson.d.ts","sourceRoot":"","sources":["../src/PackageJson.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D;;;;;GAKG;AAOH,MAAM,MAAM,WAAW,GAAG;IACxB;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb,oCAAoC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAYhB,2IAA2I;IAC3I,IAAI,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IAE7B,oEAAoE;IACpE,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,8EAA8E;IAC9E,MAAM,CAAC,EAAE,MAAM,CAAC;IAchB,mGAAmG;IACnG,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GA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,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;AAExG,gGAAgG;AAChG,MAAM,MAAM,0BAA0B,GAAG,eAAe,CACpD,SAAS,GACT,SAAS,GACT,MAAM,GACN,UAAU,GACV,QAAQ,GACR,QAAQ,GACR,aAAa,GACb,MAAM,GACN,cAAc,GACd,SAAS,CACZ,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAC/B,IAAI,GACJ,MAAM,GACN;KAAG,SAAS,IAAI,0BAA0B,CAAC,CAAC,EAAE,uBAAuB;CAAE,GACvE,KAAK,CAAC,uBAAuB,CAAC,CAAC;AAEnC;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,CAAC,eAAe,EAAE,MAAM,GAAG,uBAAuB,CAAC;CACpD,CAAC;AAEF,gHAAgH;AAChH,MAAM,MAAM,kBAAkB,GAAG,uBAAuB,GAAG,wBAAwB,GAAG,kBAAkB,EAAE,CAAC;AAE3G;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,CAAC,IAAI,EAAE,MAAM,GACT,MAAM,GACN,IAAI,GACJ;QACE,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG;YAAE,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,CAAC;KAChE,CAAC;CACP,CAAC;AAOF,mDAAmD;AACnD,MAAM,MAAM,uBAAuB,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC"}
|
package/lib/PackageJson.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PackageJson.js","sourceRoot":"","sources":["../src/PackageJson.ts"],"names":[],"mappings":"","sourcesContent":["import type { BundleMode } from './BundleMode.js';\nimport type { PackageSettings } from './PackageSettings.js';\n\n/**\n * Types for the `package.json` file, derived from [`type-fest`](https://github.com/sindresorhus/type-fest/blob/main/source/package-json.d.ts).\n *\n * This version intentionally does not permit arbitrary keys, and only includes properties that are\n * used by Cloudpack. Additional properties can be added as needed.\n */\n//\n// NOTE: Some of the known properties not currently used by Cloudpack are commented out, but\n// preserved in the file for future typing reference.\n//\n// If adding or uncommenting a property, you'll also need to update PackageDefinitions copyPackageJsonKeys.\n//\nexport type PackageJson = {\n /**\n * The name of the package. This is always set when reading via `PackageDefinitions`, but might be\n * missing if reading package.json directly.\n */\n name: string;\n\n /** A description of the package. */\n description?: string;\n\n /**\n * Package semantic version. This is always set when reading via `PackageDefinitions`, but might be\n * missing if reading package.json directly.\n */\n version: string;\n\n // /** The files included in the package. */\n // files?: string[];\n\n // /** Indicates the structure of the package. https://docs.npmjs.com/cli/v9/configuring-npm/package-json#directories */\n // directories?: {\n // [directoryType: string]: string | undefined;\n // bin?: string;\n // lib?: string;\n // };\n\n /** Resolution algorithm for importing \".js\" files from the package's scope. https://nodejs.org/api/esm.html#esm_package_json_type_field */\n type?: 'module' | 'commonjs';\n\n /** The module ID that is the primary entry point to the package. */\n main?: string;\n\n /** An ECMAScript module ID that is the primary entry point to the package. */\n module?: string;\n\n // /** The executable file(s) for this package. */\n // bin?: string | Partial<Record<string, string>>;\n\n // /** A module ID with untranspiled code that is the primary entry point to the package. */\n // esnext?:\n // | string\n // | {\n // [moduleName: string]: string | undefined;\n // main?: string;\n // browser?: string;\n // };\n\n /** A hint to JavaScript bundlers or component tools when packaging modules for client side use. */\n browser?: string | Partial<Record<string, string | false>>;\n\n // /**\n // * Denote which files in the package have side effects and may not be pruned by bundlers, even if unused.\n // * If a boolean, applies to all files in the package. `false` indicates there are no side effects.\n // * https://webpack.js.org/guides/tree-shaking/\n // */\n // sideEffects?: boolean | string[];\n\n // /** Location of the bundled TypeScript declaration file. */\n // types?: string;\n\n // /** Location of the bundled TypeScript declaration file. Alias of `types`. */\n // typings?: string;\n\n // /** Location of TypeScript declaration files for different TypeScript versions. */\n // typesVersions?: Partial<Record<string, Partial<Record<string, string[]>>>>;\n\n /** Subpath exports to define entry points of the package. https://nodejs.org/api/packages.html#subpath-exports */\n exports?: PackageJsonExports;\n\n // /**\n // * Subpath imports to define internal package import maps that only apply to import specifiers from\n // * within the package itself. https://nodejs.org/api/packages.html#subpath-imports\n // */\n // imports?: PackageJsonImports;\n\n /** Dependencies that will be installed when the package is consumed. */\n dependencies?: PackageJsonDependencies;\n\n /** Dependencies for local development only. */\n devDependencies?: PackageJsonDependencies;\n\n /** Dependencies that must be installed alongside this package when consumed. */\n peerDependencies?: PackageJsonDependencies;\n\n /** Indicates which peer dependencies are optional. */\n peerDependenciesMeta?: Partial<Record<string, { optional: true }>>;\n\n optionalDependencies?: PackageJsonDependencies;\n bundledDependencies?: PackageJsonDependencies | string[];\n bundleDependencies?: PackageJsonDependencies | string[];\n\n resolutions?: PackageJsonDependencies;\n\n // /** Required engine versions for running this package. */\n // engines?: {\n // [engine in LiteralOrString<'npm' | 'node'>]?: string;\n // };\n\n // /** If `true`, this package cannot be published. */\n // private?: boolean;\n\n // /** Configuration for npm or yarn workspaces. */\n // workspaces?:\n // | string[]\n // | {\n // /** An array of workspace pattern strings which contain the workspace packages. */\n // packages?: string[];\n // /** Prevent hoisting of these dependencies within the workspace (yarn only). https://classic.yarnpkg.com/blog/2018/02/15/nohoist/) */\n // nohoist?: string[];\n // };\n\n /**\n * Cached result of calling `getPackageSettings` for this package (excluding properties that are\n * fully handled by `createPackageSettingsTransform`), plus other info.\n *\n * This can be used while bundling for cached access to package settings.\n * It's also used for calculating the hash in `getPackageHashEntries`.\n *\n * This should NOT be used during init's analysis of the bundle result, since it might be\n * out of date due to pending generated settings updates. (If a package is re-enqueued after\n * analysis due to generated settings updates, we refresh the definition, which updates these\n * cached setting. So it's safe to use again on the next bundle attempt.)\n */\n cloudpack?: PackageJsonCloudpackMeta;\n};\n\n/**\n * Cached merged package settings (user and generated) for this package (excluding properties\n * that are fully handled by `createPackageSettingsTransform`), plus other info.\n *\n * See `PackageJson.cloudpack` for details of when this can be used.\n */\nexport interface PackageJsonCloudpackMeta\n extends Omit<\n PackageSettings,\n | 'match'\n | 'exports'\n | 'includedDependencies'\n | 'excludedDependencies'\n // this is deprecated\n | 'bundlerType'\n > {\n /** Controls how the package is bundled. */\n mode: BundleMode;\n}\n\n/**\n * Union type which has intellisense for specific keys but also allows arbitrary strings.\n * This is a workaround for a [TypeScript issue](https://github.com/Microsoft/TypeScript/issues/29729)\n */\nexport type LiteralOrString<LiteralType extends string> = LiteralType | (string & Record<never, never>);\n\n/** Conditions which provide a way to resolve a package entry point based on the environment. */\nexport type PackageJsonExportCondition = LiteralOrString<\n | 'browser'\n | 'default'\n | 'deno'\n | 'electron'\n | 'import'\n | 'module'\n | 'node-addons'\n | 'node'\n | 'react-native'\n | 'require'\n>;\n\n/**\n * The value of an `PackageJson.exports` object key. Note at the root of the object, keys can be represented\n * either by a condition, or a `string` to provide import paths (such as \"./foo\"). At subsequent levels\n * within the object, only conditions (string which don't start with \".\") can be used as keys.\n */\nexport type PackageJsonExportsValue =\n | null\n | string\n | { [condition in PackageJsonExportCondition]?: PackageJsonExportsValue }\n | Array<PackageJsonExportsValue>;\n\n/**\n * Definition of the root exports object. Keys can be either conditions or import paths.\n */\nexport type PackageJsonExportsObject = {\n [pathOrCondition: string]: PackageJsonExportsValue;\n};\n\n/** Entry points of a package, optionally with conditions and subpath exports. Used as `PackageJson.exports`. */\nexport type PackageJsonExports = PackageJsonExportsValue | PackageJsonExportsObject | PackageJsonExports[];\n\n/**\n * Mapping from import path to either file path, or a nested object of conditions to file paths\n * (occasionally with two levels of conditions). This is the format used for generated exports maps.\n */\nexport type GeneratedExports = {\n [path: string]:\n | string\n | null\n | {\n [condition: string]: string | { [condition2: string]: string };\n };\n};\n\n// /** Import map entries of a module, optionally with conditions. */\n// export type PackageJsonImports = {\n// [key: `#${string}`]: string | { [key in PackageJsonExportCondition]: PackageJsonExports };\n// };\n\n/** Mapping from dependency name to semver spec. */\nexport type PackageJsonDependencies = Partial<Record<string, string>>;\n"]}
|
|
1
|
+
{"version":3,"file":"PackageJson.js","sourceRoot":"","sources":["../src/PackageJson.ts"],"names":[],"mappings":"","sourcesContent":["import type { BundleMode } from './BundleMode.js';\nimport type { PackageSettings } from './PackageSettings.js';\n\n/**\n * Types for the `package.json` file, derived from [`type-fest`](https://github.com/sindresorhus/type-fest/blob/main/source/package-json.d.ts).\n *\n * This version intentionally does not permit arbitrary keys, and only includes properties that are\n * used by Cloudpack. Additional properties can be added as needed.\n */\n//\n// NOTE: Some of the known properties not currently used by Cloudpack are commented out, but\n// preserved in the file for future typing reference.\n//\n// If adding or uncommenting a property, you'll also need to update PackageDefinitions copyPackageJsonKeys.\n//\nexport type PackageJson = {\n /**\n * The name of the package. This is always set when reading via `PackageDefinitions`, but might be\n * missing if reading package.json directly.\n */\n name: string;\n\n /** A description of the package. */\n description?: string;\n\n /**\n * Package semantic version. This is always set when reading via `PackageDefinitions`, but might be\n * missing if reading package.json directly.\n */\n version: string;\n\n // /** The files included in the package. */\n // files?: string[];\n\n // /** Indicates the structure of the package. https://docs.npmjs.com/cli/v9/configuring-npm/package-json#directories */\n // directories?: {\n // [directoryType: string]: string | undefined;\n // bin?: string;\n // lib?: string;\n // };\n\n /** Resolution algorithm for importing \".js\" files from the package's scope. https://nodejs.org/api/esm.html#esm_package_json_type_field */\n type?: 'module' | 'commonjs';\n\n /** The module ID that is the primary entry point to the package. */\n main?: string;\n\n /** An ECMAScript module ID that is the primary entry point to the package. */\n module?: string;\n\n // /** The executable file(s) for this package. */\n // bin?: string | Partial<Record<string, string>>;\n\n // /** A module ID with untranspiled code that is the primary entry point to the package. */\n // esnext?:\n // | string\n // | {\n // [moduleName: string]: string | undefined;\n // main?: string;\n // browser?: string;\n // };\n\n /** A hint to JavaScript bundlers or component tools when packaging modules for client side use. */\n browser?: string | Partial<Record<string, string | false>>;\n\n // /**\n // * Denote which files in the package have side effects and may not be pruned by bundlers, even if unused.\n // * If a boolean, applies to all files in the package. `false` indicates there are no side effects.\n // * https://webpack.js.org/guides/tree-shaking/\n // */\n // sideEffects?: boolean | string[];\n\n // /** Location of the bundled TypeScript declaration file. */\n // types?: string;\n\n // /** Location of the bundled TypeScript declaration file. Alias of `types`. */\n // typings?: string;\n\n // /** Location of TypeScript declaration files for different TypeScript versions. */\n // typesVersions?: Partial<Record<string, Partial<Record<string, string[]>>>>;\n\n /** Subpath exports to define entry points of the package. https://nodejs.org/api/packages.html#subpath-exports */\n exports?: PackageJsonExports;\n\n // /**\n // * Subpath imports to define internal package import maps that only apply to import specifiers from\n // * within the package itself. https://nodejs.org/api/packages.html#subpath-imports\n // */\n // imports?: PackageJsonImports;\n\n /** Dependencies that will be installed when the package is consumed. */\n dependencies?: PackageJsonDependencies;\n\n /** Dependencies for local development only. */\n devDependencies?: PackageJsonDependencies;\n\n /** Dependencies that must be installed alongside this package when consumed. */\n peerDependencies?: PackageJsonDependencies;\n\n /** Indicates which peer dependencies are optional. */\n peerDependenciesMeta?: Partial<Record<string, { optional: true }>>;\n\n optionalDependencies?: PackageJsonDependencies;\n bundledDependencies?: PackageJsonDependencies | string[];\n bundleDependencies?: PackageJsonDependencies | string[];\n\n resolutions?: PackageJsonDependencies;\n\n // /** Required engine versions for running this package. */\n // engines?: {\n // [engine in LiteralOrString<'npm' | 'node'>]?: string;\n // };\n\n // /** If `true`, this package cannot be published. */\n // private?: boolean;\n\n // /** Configuration for npm or yarn workspaces. */\n // workspaces?:\n // | string[]\n // | {\n // /** An array of workspace pattern strings which contain the workspace packages. */\n // packages?: string[];\n // /** Prevent hoisting of these dependencies within the workspace (yarn only). https://classic.yarnpkg.com/blog/2018/02/15/nohoist/) */\n // nohoist?: string[];\n // };\n\n /**\n * Cached result of calling `getPackageSettings` for this package (excluding properties that are\n * fully handled by `createPackageSettingsTransform`), plus other info.\n *\n * This can be used while bundling for cached access to package settings.\n * It's also used for calculating the hash in `getPackageHashEntries`.\n *\n * This should NOT be used during init's analysis of the bundle result, since it might be\n * out of date due to pending generated settings updates. (If a package is re-enqueued after\n * analysis due to generated settings updates, we refresh the definition, which updates these\n * cached setting. So it's safe to use again on the next bundle attempt.)\n */\n cloudpack?: PackageJsonCloudpackMeta;\n};\n\n/**\n * Cached merged package settings (user and generated) for this package (excluding properties\n * that are fully handled by `createPackageSettingsTransform`), plus other info.\n *\n * See `PackageJson.cloudpack` for details of when this can be used.\n */\nexport interface PackageJsonCloudpackMeta\n extends Omit<\n PackageSettings,\n | 'match'\n | 'exports'\n | 'includedDependencies'\n | 'excludedDependencies'\n // this is deprecated\n | 'bundlerType'\n > {\n /** Controls how the package is bundled. */\n mode: BundleMode;\n\n /**\n * If the package manager is yarn berry (v2+) and the package has been patched with `yarn patch`,\n * this is the path to the patch file relative to the project root (set by `getNonSemverTransform`).\n */\n patchFilePath?: string;\n}\n\n/**\n * Union type which has intellisense for specific keys but also allows arbitrary strings.\n * This is a workaround for a [TypeScript issue](https://github.com/Microsoft/TypeScript/issues/29729)\n */\nexport type LiteralOrString<LiteralType extends string> = LiteralType | (string & Record<never, never>);\n\n/** Conditions which provide a way to resolve a package entry point based on the environment. */\nexport type PackageJsonExportCondition = LiteralOrString<\n | 'browser'\n | 'default'\n | 'deno'\n | 'electron'\n | 'import'\n | 'module'\n | 'node-addons'\n | 'node'\n | 'react-native'\n | 'require'\n>;\n\n/**\n * The value of an `PackageJson.exports` object key. Note at the root of the object, keys can be represented\n * either by a condition, or a `string` to provide import paths (such as \"./foo\"). At subsequent levels\n * within the object, only conditions (string which don't start with \".\") can be used as keys.\n */\nexport type PackageJsonExportsValue =\n | null\n | string\n | { [condition in PackageJsonExportCondition]?: PackageJsonExportsValue }\n | Array<PackageJsonExportsValue>;\n\n/**\n * Definition of the root exports object. Keys can be either conditions or import paths.\n */\nexport type PackageJsonExportsObject = {\n [pathOrCondition: string]: PackageJsonExportsValue;\n};\n\n/** Entry points of a package, optionally with conditions and subpath exports. Used as `PackageJson.exports`. */\nexport type PackageJsonExports = PackageJsonExportsValue | PackageJsonExportsObject | PackageJsonExports[];\n\n/**\n * Mapping from import path to either file path, or a nested object of conditions to file paths\n * (occasionally with two levels of conditions). This is the format used for generated exports maps.\n */\nexport type GeneratedExports = {\n [path: string]:\n | string\n | null\n | {\n [condition: string]: string | { [condition2: string]: string };\n };\n};\n\n// /** Import map entries of a module, optionally with conditions. */\n// export type PackageJsonImports = {\n// [key: `#${string}`]: string | { [key in PackageJsonExportCondition]: PackageJsonExports };\n// };\n\n/** Mapping from dependency name to semver spec. */\nexport type PackageJsonDependencies = Partial<Record<string, string>>;\n"]}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { allFeatures } from './allFeatures.js';
|
|
2
|
-
export type { GetPackageDefinitionOptions, PackageDefinitionTransform, PackageDefinitionTransformFactory, PackageDefinitionsCache, PackageImporterContext, } from './PackageDefinitionsCache.js';
|
|
2
|
+
export type { GetPackageDefinitionOptions, PackageDefinitionTransform, PackageDefinitionTransformFactory, PackageDefinitionsCache, PackageImporterContext, SerializablePackageDefinitionsCache, } from './PackageDefinitionsCache.js';
|
|
3
3
|
export type { LiteralOrString, PackageJson, PackageJsonCloudpackMeta, PackageJsonDependencies, PackageJsonExportCondition, PackageJsonExports, PackageJsonExportsObject, GeneratedExports, PackageJsonExportsValue, } from './PackageJson.js';
|
|
4
4
|
export type { BundleContext } from './BundleContext.js';
|
|
5
5
|
export type { BundleMessage } from './BundleMessage.js';
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EACV,2BAA2B,EAC3B,0BAA0B,EAC1B,iCAAiC,EACjC,uBAAuB,EACvB,sBAAsB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YA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AAM,sBAAsB,CAAC;AAC5D,YAAY,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AA2D/C,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,aAAa,EACb,eAAe,EACf,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,YAAY,CAAC","sourcesContent":["export { allFeatures } from './allFeatures.js';\nexport type {\n GetPackageDefinitionOptions,\n PackageDefinitionTransform,\n PackageDefinitionTransformFactory,\n PackageDefinitionsCache,\n PackageImporterContext,\n SerializablePackageDefinitionsCache,\n} from './PackageDefinitionsCache.js';\nexport type {\n LiteralOrString,\n PackageJson,\n PackageJsonCloudpackMeta,\n PackageJsonDependencies,\n PackageJsonExportCondition,\n PackageJsonExports,\n PackageJsonExportsObject,\n GeneratedExports,\n PackageJsonExportsValue,\n} from './PackageJson.js';\nexport type { BundleContext } from './BundleContext.js';\nexport type { BundleMessage } from './BundleMessage.js';\nexport type { BundleMessageLocation } from './BundleMessageLocation.js';\nexport type { BundleMessageNote } from './BundleMessageNote.js';\nexport type { BundleMode } from './BundleMode.js';\nexport type { BundleOptions } from './BundleOptions.js';\nexport type { BundleOutputFile } from './BundleOutputFile.js';\nexport type { BundleResult } from './BundleResult.js';\nexport type { BundlerResult } from './BundlerResult.js';\nexport type { Bundler } from './Bundler.js';\nexport type { CloudpackConfig } from './CloudpackConfig.js';\nexport type { ServerConfig } from './ServerConfig.js';\nexport type { ExpandedSourcePath } from './ExpandedSourcePath.js';\nexport type { Feature } from './Feature.js';\nexport type { Features } from './Features.js';\nexport type { GeneratedConfig } from './GeneratedConfig.js';\nexport type { HttpsConfig } from './HttpsConfig.js';\nexport type { LinkOptions } from './LinkOptions.js';\nexport type { ModuleType } from './ModuleType.js';\nexport type { PackageHashesCache, PackageHashOptions, SerializablePackageHashesCache } from './PackageHashesCache.js';\nexport type {\n PackageSettings,\n PackageSettingsMatch,\n PackageSettingsMatchObject,\n GeneratedPackageSettings,\n} from './PackageSettings.js';\nexport type {\n BootstrapRoute,\n ProxyRoute,\n RedirectRoute,\n RenderedRoute,\n Route,\n RouteMatch,\n SharedRouteOptions,\n ShorthandRenderedRoute,\n ShorthandBootstrapRoute,\n ShorthandRoute,\n StaticRoute,\n} from './Route.js';\nexport {\n isBootstrapRoute,\n isProxyRoute,\n isRenderedRoute,\n isStaticRoute,\n isRedirectRoute,\n isShorthandBootstrapRoute,\n isShorthandRenderedRoute,\n} from './Route.js';\nexport type { TelemetryConfig } from './TelemetryConfig.js';\nexport type { AppConfig } from './AppConfig.js';\nexport type {\n BundlerCapability,\n InternalBundlerCapabilityImplementations,\n InternalBundlerCapabilitiesMetaData,\n BundlerCapabilitiesOptions,\n ExternalBundlerCapabilityModule,\n BundlerCapabilityFunction,\n} from './BundlerCapability.js';\nexport type { RemoteCacheConfig } from './RemoteCacheConfig.js';\nexport type {\n RenderFunction,\n RenderFunctionOptions,\n RenderFunctionResult,\n ExpandedRenderFunctionResult,\n RenderFunctionScript,\n} from './RenderFunction.js';\nexport type { Request, Response, RequestHandler } from 'express';\nexport type { Session } from './Session.js';\nexport type { ResolveMap } from './ResolveMap.js';\nexport type { ResolveMapEntry } from './ResolveMapEntry.js';\nexport type { LinkedPath } from './LinkedPath.js';\nexport type { ImportMap } from './ImportMap.js';\nexport type { UserPreferences } from './UserPreferences.js';\nexport type { TargetEnvironment } from './TargetEnvironment.js';\nexport type { NestedPartial } from './NestedPartial.js';\nexport type { WithOptional } from './WithOptional.js';\nexport type { WithRequired } from './WithRequired.js';\n"]}
|
package/package.json
CHANGED
package/schema/AppConfig.json
CHANGED
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
},
|
|
66
66
|
"patchFilesGlobPattern": {
|
|
67
67
|
"type": "string",
|
|
68
|
-
"description": "Glob pattern to match `patch-package` patch files, relative to the project root (usually the same as the repository root).",
|
|
68
|
+
"description": "Glob pattern to match `patch-package` patch files, relative to the project root (usually the same as the repository root).\n\nNote that if you're using `yarn patch` (v2+), those patches will be handled automatically (not by this glob pattern).",
|
|
69
69
|
"default": "patches/*.patch"
|
|
70
70
|
},
|
|
71
71
|
"remoteCache": {
|
package/schema/UserConfig.json
CHANGED
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
},
|
|
70
70
|
"patchFilesGlobPattern": {
|
|
71
71
|
"type": "string",
|
|
72
|
-
"description": "Glob pattern to match `patch-package` patch files, relative to the project root (usually the same as the repository root).",
|
|
72
|
+
"description": "Glob pattern to match `patch-package` patch files, relative to the project root (usually the same as the repository root).\n\nNote that if you're using `yarn patch` (v2+), those patches will be handled automatically (not by this glob pattern).",
|
|
73
73
|
"default": "patches/*.patch"
|
|
74
74
|
},
|
|
75
75
|
"remoteCache": {
|