@ms-cloudpack/config 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/createPackageOverrideTransform.d.ts.map +1 -1
- package/lib/createPackageOverrideTransform.js +7 -9
- package/lib/createPackageOverrideTransform.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/lib/types/UserConfig.d.ts +5 -0
- package/lib/types/UserConfig.d.ts.map +1 -1
- package/lib/types/UserConfig.js.map +1 -1
- package/package.json +5 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPackageOverrideTransform.d.ts","sourceRoot":"","sources":["../src/createPackageOverrideTransform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,
|
|
1
|
+
{"version":3,"file":"createPackageOverrideTransform.d.ts","sourceRoot":"","sources":["../src/createPackageOverrideTransform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAwC,MAAM,6BAA6B,CAAC;AACpH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAIlE;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,eAAe,GAAG,0BAA0B,CAwDlG"}
|
|
@@ -1,25 +1,23 @@
|
|
|
1
1
|
import { getPackageSettings } from './getPackageSettings.js';
|
|
2
|
+
import { getExportsMap } from '@ms-cloudpack/package-utilities';
|
|
2
3
|
/**
|
|
3
4
|
* Creates a transform to be registered with a PackageDefinitions registry for applying overrides to from the config
|
|
4
5
|
* to package.json definitions.
|
|
5
6
|
*/
|
|
6
7
|
export function createPackageOverrideTransform(config) {
|
|
7
|
-
return (packageDefinition) => {
|
|
8
|
+
return async (packageDefinition, packagePath, packages) => {
|
|
8
9
|
const { name = '', version = '' } = packageDefinition;
|
|
9
10
|
const { userPackageSettings, generatedPackageSettings } = getPackageSettings({ name, version, config });
|
|
10
11
|
if (!userPackageSettings && !generatedPackageSettings) {
|
|
11
12
|
return undefined;
|
|
12
13
|
}
|
|
13
|
-
const result = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
14
|
+
const result = {
|
|
15
|
+
...packageDefinition,
|
|
16
|
+
exports: userPackageSettings?.exports || (await getExportsMap({ packagePath, disableTransforms: true }, { packages })),
|
|
17
|
+
};
|
|
18
18
|
// If we have generated overrides, apply them.
|
|
19
19
|
if (generatedPackageSettings?.exports) {
|
|
20
|
-
result.exports = result.exports
|
|
21
|
-
? [result.exports, generatedPackageSettings.exports]
|
|
22
|
-
: generatedPackageSettings.exports;
|
|
20
|
+
result.exports = [result.exports, generatedPackageSettings.exports];
|
|
23
21
|
}
|
|
24
22
|
// If we have included dependencies, add them.
|
|
25
23
|
const includedDependencies = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPackageOverrideTransform.js","sourceRoot":"","sources":["../src/createPackageOverrideTransform.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"createPackageOverrideTransform.js","sourceRoot":"","sources":["../src/createPackageOverrideTransform.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAEhE;;;GAGG;AACH,MAAM,UAAU,8BAA8B,CAAC,MAAuB;IACpE,OAAO,KAAK,EAAE,iBAA8B,EAAE,WAAmB,EAAE,QAAiC,EAAE,EAAE;QACtG,MAAM,EAAE,IAAI,GAAG,EAAE,EAAE,OAAO,GAAG,EAAE,EAAE,GAAG,iBAAiB,CAAC;QACtD,MAAM,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,GAAG,kBAAkB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;QAExG,IAAI,CAAC,mBAAmB,IAAI,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oB,EAAE,MAAM,EAAE;YAChC,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC,WAAW,CACtC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,oBAAoB,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAClG,CAAC;SACH;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { PackageDefinitionTransform, PackageDefinitionsCache, PackageJson } from '@ms-cloudpack/bundler-types';\nimport type { CloudpackConfig } from './types/CloudpackConfig.js';\nimport { getPackageSettings } from './getPackageSettings.js';\nimport { getExportsMap } from '@ms-cloudpack/package-utilities';\n\n/**\n * Creates a transform to be registered with a PackageDefinitions registry for applying overrides to from the config\n * to package.json definitions.\n */\nexport function createPackageOverrideTransform(config: CloudpackConfig): PackageDefinitionTransform {\n return async (packageDefinition: PackageJson, packagePath: string, packages: PackageDefinitionsCache) => {\n const { name = '', version = '' } = packageDefinition;\n const { userPackageSettings, generatedPackageSettings } = getPackageSettings({ name, version, config });\n\n if (!userPackageSettings && !generatedPackageSettings) {\n return undefined;\n }\n\n const result = {\n ...packageDefinition,\n exports:\n userPackageSettings?.exports || (await getExportsMap({ packagePath, disableTransforms: true }, { packages })),\n };\n\n // If we have generated overrides, apply them.\n if (generatedPackageSettings?.exports) {\n result.exports = [result.exports, generatedPackageSettings.exports];\n }\n\n // If we have included dependencies, add them.\n const includedDependencies = [\n ...(userPackageSettings?.includedDependencies || []),\n ...(generatedPackageSettings?.includedDependencies || []),\n ];\n\n if (includedDependencies.length) {\n for (const dep of includedDependencies) {\n if (!result.dependencies?.[dep]) {\n // Initialize dependencies map if it doesn't exist.\n result.dependencies ??= {};\n\n // Add the dependency from other sources, or use a wildcard.\n result.dependencies[dep] =\n result.devDependencies?.[dep] ||\n result.peerDependencies?.[dep] ||\n result.optionalDependencies?.[dep] ||\n '*';\n }\n }\n }\n\n // If we have excluded dependencies, remove them.\n const excludedDependencies = [\n ...(userPackageSettings?.excludedDependencies || []),\n ...(generatedPackageSettings?.excludedDependencies || []),\n ];\n\n if (excludedDependencies?.length) {\n result.dependencies = Object.fromEntries(\n Object.entries(result.dependencies || {}).filter(([dep]) => !excludedDependencies?.includes(dep)),\n );\n }\n\n return result;\n };\n}\n"]}
|
package/lib/tsdoc-metadata.json
CHANGED
|
@@ -27,5 +27,10 @@ export interface UserConfig {
|
|
|
27
27
|
* An array of PackageSettings objects, used to provide settings for how we bundle packages.
|
|
28
28
|
*/
|
|
29
29
|
packageSettings?: PackageSettings[];
|
|
30
|
+
/**
|
|
31
|
+
* An optional list of commands (followed by a string array of args for that command)
|
|
32
|
+
* to be executed prior to Cloudpack bundle
|
|
33
|
+
*/
|
|
34
|
+
dependsOn?: [string, string[]][];
|
|
30
35
|
}
|
|
31
36
|
//# sourceMappingURL=UserConfig.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserConfig.d.ts","sourceRoot":"","sources":["../../src/types/UserConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D;;GAEG;AAEH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB;;OAEG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC;IAE5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,eAAe,CAAC,EAAE,eAAe,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"UserConfig.d.ts","sourceRoot":"","sources":["../../src/types/UserConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D;;GAEG;AAEH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB;;OAEG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC;IAE5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,eAAe,CAAC,EAAE,eAAe,EAAE,CAAC;IAEpC;;;OAGG;IACH,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;CAClC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserConfig.js","sourceRoot":"","sources":["../../src/types/UserConfig.ts"],"names":[],"mappings":"","sourcesContent":["import type { DevServer } from './DevServer.js';\nimport type { Features } from './Features.js';\nimport type { PackageSettings } from './PackageSettings.js';\nimport type { TelemetryConfig } from './TelemetryConfig.js';\n\n/**\n * Per-application user-provided configuration for Cloudpack.\n */\n\nexport interface UserConfig {\n /**\n * A set of options for configuring how the dev server works.\n */\n devServer?: DevServer;\n\n /**\n * A set of options for configuring telemetry\n */\n telemetry?: TelemetryConfig;\n\n /**\n * A set of options for configuring the experience. Features can be set to true to change the default\n * behavior.\n */\n features?: Features;\n\n /**\n * Help message to display when Cloudpack starts up.\n */\n helpMessage?: string;\n\n /**\n * An array of PackageSettings objects, used to provide settings for how we bundle packages.\n */\n packageSettings?: PackageSettings[];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"UserConfig.js","sourceRoot":"","sources":["../../src/types/UserConfig.ts"],"names":[],"mappings":"","sourcesContent":["import type { DevServer } from './DevServer.js';\nimport type { Features } from './Features.js';\nimport type { PackageSettings } from './PackageSettings.js';\nimport type { TelemetryConfig } from './TelemetryConfig.js';\n\n/**\n * Per-application user-provided configuration for Cloudpack.\n */\n\nexport interface UserConfig {\n /**\n * A set of options for configuring how the dev server works.\n */\n devServer?: DevServer;\n\n /**\n * A set of options for configuring telemetry\n */\n telemetry?: TelemetryConfig;\n\n /**\n * A set of options for configuring the experience. Features can be set to true to change the default\n * behavior.\n */\n features?: Features;\n\n /**\n * Help message to display when Cloudpack starts up.\n */\n helpMessage?: string;\n\n /**\n * An array of PackageSettings objects, used to provide settings for how we bundle packages.\n */\n packageSettings?: PackageSettings[];\n\n /**\n * An optional list of commands (followed by a string array of args for that command)\n * to be executed prior to Cloudpack bundle\n */\n dependsOn?: [string, string[]][];\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Configuration handling for cloudpack.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -13,10 +13,11 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@ms-cloudpack/bundler-types": "^0.
|
|
17
|
-
"@ms-cloudpack/create-express-app": "^1.3.
|
|
16
|
+
"@ms-cloudpack/bundler-types": "^0.17.0",
|
|
17
|
+
"@ms-cloudpack/create-express-app": "^1.3.9",
|
|
18
18
|
"@ms-cloudpack/json-utilities": "^0.0.7",
|
|
19
|
-
"@ms-cloudpack/package-utilities": "^5.0
|
|
19
|
+
"@ms-cloudpack/package-utilities": "^5.1.0",
|
|
20
|
+
"semver": "^7.3.7"
|
|
20
21
|
},
|
|
21
22
|
"devDependencies": {
|
|
22
23
|
"@ms-cloudpack/eslint-plugin-internal": "*",
|