@ms-cloudpack/config 0.22.1 → 0.23.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.
@@ -4,4 +4,8 @@ import type { AppConfig } from '@ms-cloudpack/common-types';
4
4
  * For a full merged representation of config, use `readConfig` instead.
5
5
  */
6
6
  export declare function readAppConfig(appPath: string): Promise<AppConfig>;
7
+ /**
8
+ * An internal function for processing a config object after reading the json values.
9
+ */
10
+ export declare function processDeprecatedValues(config: AppConfig): AppConfig;
7
11
  //# sourceMappingURL=readAppConfig.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"readAppConfig.d.ts","sourceRoot":"","sources":["../src/readAppConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAoC5D;;;GAGG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAIvE"}
1
+ {"version":3,"file":"readAppConfig.d.ts","sourceRoot":"","sources":["../src/readAppConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAM5D;;;GAGG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAIvE;AAgCD;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,aAgBxD"}
@@ -2,6 +2,14 @@ import { readJson } from '@ms-cloudpack/json-utilities';
2
2
  import { getConfigPath } from './getConfigPath.js';
3
3
  import { mergeParentConfig } from './mergeParentConfig.js';
4
4
  import { resolveParentConfig } from './resolveParentConfig.js';
5
+ /**
6
+ * Reads the user config file and merges with any parent configs asynchronously. Note this is only useful for making modifications to the user config.
7
+ * For a full merged representation of config, use `readConfig` instead.
8
+ */
9
+ export async function readAppConfig(appPath) {
10
+ const { appConfigPath } = getConfigPath(appPath);
11
+ return (await readAppConfigInternal(appConfigPath)) || {};
12
+ }
5
13
  /**
6
14
  * Reads the user config, with any `extends` parent configs merged in.
7
15
  */
@@ -26,14 +34,22 @@ async function readAppConfigInternal(configPath) {
26
34
  }
27
35
  }
28
36
  }
29
- return mergeParentConfig({ AppConfig, parentConfigs });
37
+ return processDeprecatedValues(mergeParentConfig({ AppConfig, parentConfigs }));
30
38
  }
31
39
  /**
32
- * Reads the user config file and merges with any parent configs asynchronously. Note this is only useful for making modifications to the user config.
33
- * For a full merged representation of config, use `readConfig` instead.
40
+ * An internal function for processing a config object after reading the json values.
34
41
  */
35
- export async function readAppConfig(appPath) {
36
- const { appConfigPath } = getConfigPath(appPath);
37
- return (await readAppConfigInternal(appConfigPath)) || {};
42
+ export function processDeprecatedValues(config) {
43
+ const { devServer } = config;
44
+ if (devServer) {
45
+ // eslint-disable-next-line etc/no-deprecated
46
+ const { routes } = devServer;
47
+ if (routes) {
48
+ config.routes = routes;
49
+ // eslint-disable-next-line etc/no-deprecated
50
+ delete config.devServer?.routes;
51
+ }
52
+ }
53
+ return config;
38
54
  }
39
55
  //# sourceMappingURL=readAppConfig.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"readAppConfig.js","sourceRoot":"","sources":["../src/readAppConfig.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D;;GAEG;AACH,KAAK,UAAU,qBAAqB,CAAC,UAAkB;IACrD,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAY,UAAU,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;IAC/F,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,YAAY,GAAG,SAAS,CAAC,OAAO;QACpC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC;YAChC,CAAC,CAAC,SAAS,CAAC,OAAO;YACnB,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC;QACvB,CAAC,CAAC,EAAE,CAAC;IAEP,2CAA2C;IAC3C,MAAM,aAAa,GAAgB,EAAE,CAAC;IACtC,KAAK,MAAM,eAAe,IAAI,YAAY,EAAE,CAAC;QAC3C,MAAM,YAAY,GAAG,mBAAmB,CAAC,EAAE,UAAU,EAAE,eAAe,EAAE,CAAC,CAAC;QAC1E,IAAI,YAAY,EAAE,CAAC;YACjB,MAAM,YAAY,GAAG,MAAM,qBAAqB,CAAC,YAAY,CAAC,CAAC;YAC/D,IAAI,YAAY,EAAE,CAAC;gBACjB,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACnC,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,iBAAiB,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC,CAAC;AACzD,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAAe;IACjD,MAAM,EAAE,aAAa,EAAE,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IAEjD,OAAO,CAAC,MAAM,qBAAqB,CAAC,aAAa,CAAC,CAAC,IAAI,EAAE,CAAC;AAC5D,CAAC","sourcesContent":["import type { AppConfig } from '@ms-cloudpack/common-types';\nimport { readJson } from '@ms-cloudpack/json-utilities';\nimport { getConfigPath } from './getConfigPath.js';\nimport { mergeParentConfig } from './mergeParentConfig.js';\nimport { resolveParentConfig } from './resolveParentConfig.js';\n\n/**\n * Reads the user config, with any `extends` parent configs merged in.\n */\nasync function readAppConfigInternal(configPath: string): Promise<AppConfig | undefined> {\n const AppConfig = await readJson<AppConfig>(configPath, { verbose: true, mode: 'permissive' });\n if (!AppConfig) {\n return undefined;\n }\n\n const extendsArray = AppConfig.extends\n ? Array.isArray(AppConfig.extends)\n ? AppConfig.extends\n : [AppConfig.extends]\n : [];\n\n // Recursively read any parent config files\n const parentConfigs: AppConfig[] = [];\n for (const importSpecifier of extendsArray) {\n const resolvedPath = resolveParentConfig({ configPath, importSpecifier });\n if (resolvedPath) {\n const parentConfig = await readAppConfigInternal(resolvedPath);\n if (parentConfig) {\n parentConfigs.push(parentConfig);\n }\n }\n }\n\n return mergeParentConfig({ AppConfig, parentConfigs });\n}\n\n/**\n * Reads the user config file and merges with any parent configs asynchronously. Note this is only useful for making modifications to the user config.\n * For a full merged representation of config, use `readConfig` instead.\n */\nexport async function readAppConfig(appPath: string): Promise<AppConfig> {\n const { appConfigPath } = getConfigPath(appPath);\n\n return (await readAppConfigInternal(appConfigPath)) || {};\n}\n"]}
1
+ {"version":3,"file":"readAppConfig.js","sourceRoot":"","sources":["../src/readAppConfig.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAAe;IACjD,MAAM,EAAE,aAAa,EAAE,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IAEjD,OAAO,CAAC,MAAM,qBAAqB,CAAC,aAAa,CAAC,CAAC,IAAI,EAAE,CAAC;AAC5D,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,qBAAqB,CAAC,UAAkB;IACrD,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAY,UAAU,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;IAC/F,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,YAAY,GAAG,SAAS,CAAC,OAAO;QACpC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC;YAChC,CAAC,CAAC,SAAS,CAAC,OAAO;YACnB,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC;QACvB,CAAC,CAAC,EAAE,CAAC;IAEP,2CAA2C;IAC3C,MAAM,aAAa,GAAgB,EAAE,CAAC;IACtC,KAAK,MAAM,eAAe,IAAI,YAAY,EAAE,CAAC;QAC3C,MAAM,YAAY,GAAG,mBAAmB,CAAC,EAAE,UAAU,EAAE,eAAe,EAAE,CAAC,CAAC;QAC1E,IAAI,YAAY,EAAE,CAAC;YACjB,MAAM,YAAY,GAAG,MAAM,qBAAqB,CAAC,YAAY,CAAC,CAAC;YAC/D,IAAI,YAAY,EAAE,CAAC;gBACjB,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACnC,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,uBAAuB,CAAC,iBAAiB,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC;AAClF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAAiB;IACvD,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;IAE7B,IAAI,SAAS,EAAE,CAAC;QACd,6CAA6C;QAC7C,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;QAE7B,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;YAEvB,6CAA6C;YAC7C,OAAO,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC;QAClC,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { AppConfig } from '@ms-cloudpack/common-types';\nimport { readJson } from '@ms-cloudpack/json-utilities';\nimport { getConfigPath } from './getConfigPath.js';\nimport { mergeParentConfig } from './mergeParentConfig.js';\nimport { resolveParentConfig } from './resolveParentConfig.js';\n\n/**\n * Reads the user config file and merges with any parent configs asynchronously. Note this is only useful for making modifications to the user config.\n * For a full merged representation of config, use `readConfig` instead.\n */\nexport async function readAppConfig(appPath: string): Promise<AppConfig> {\n const { appConfigPath } = getConfigPath(appPath);\n\n return (await readAppConfigInternal(appConfigPath)) || {};\n}\n\n/**\n * Reads the user config, with any `extends` parent configs merged in.\n */\nasync function readAppConfigInternal(configPath: string): Promise<AppConfig | undefined> {\n const AppConfig = await readJson<AppConfig>(configPath, { verbose: true, mode: 'permissive' });\n if (!AppConfig) {\n return undefined;\n }\n\n const extendsArray = AppConfig.extends\n ? Array.isArray(AppConfig.extends)\n ? AppConfig.extends\n : [AppConfig.extends]\n : [];\n\n // Recursively read any parent config files\n const parentConfigs: AppConfig[] = [];\n for (const importSpecifier of extendsArray) {\n const resolvedPath = resolveParentConfig({ configPath, importSpecifier });\n if (resolvedPath) {\n const parentConfig = await readAppConfigInternal(resolvedPath);\n if (parentConfig) {\n parentConfigs.push(parentConfig);\n }\n }\n }\n\n return processDeprecatedValues(mergeParentConfig({ AppConfig, parentConfigs }));\n}\n\n/**\n * An internal function for processing a config object after reading the json values.\n */\nexport function processDeprecatedValues(config: AppConfig) {\n const { devServer } = config;\n\n if (devServer) {\n // eslint-disable-next-line etc/no-deprecated\n const { routes } = devServer;\n\n if (routes) {\n config.routes = routes;\n\n // eslint-disable-next-line etc/no-deprecated\n delete config.devServer?.routes;\n }\n }\n\n return config;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"readConfig.d.ts","sourceRoot":"","sources":["../src/readConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAK9E;;GAEG;AACH,wBAAsB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,UAAsB,GAAG,OAAO,CAAC,eAAe,CAAC,CAYxG"}
1
+ {"version":3,"file":"readConfig.d.ts","sourceRoot":"","sources":["../src/readConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAI9E;;GAEG;AACH,wBAAsB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,UAAsB,GAAG,OAAO,CAAC,eAAe,CAAC,CAcxG"}
package/lib/readConfig.js CHANGED
@@ -1,18 +1,34 @@
1
- import { processConfig } from './processConfig.js';
2
1
  import { readAppConfig } from './readAppConfig.js';
3
2
  import { readGeneratedConfig } from './readGeneratedConfig.js';
4
3
  /**
5
4
  * Reads the config file asynchronously (and merges generated config into the result.)
6
5
  */
7
6
  export async function readConfig(appPath, mode = 'library') {
8
- const [AppConfig, generatedConfig] = await Promise.all([readAppConfig(appPath), readGeneratedConfig(appPath)]);
7
+ const [appConfig, generatedConfig] = await Promise.all([readAppConfig(appPath), readGeneratedConfig(appPath)]);
9
8
  const config = {
9
+ ...appConfig,
10
10
  appPath,
11
11
  mode,
12
12
  generated: generatedConfig,
13
- ...AppConfig,
14
13
  };
15
- processConfig(config.generated);
14
+ // Expands all routes which refer to source files into fully transformed route objects.
15
+ expandRouteShorthandEntries(config);
16
16
  return config;
17
17
  }
18
+ /**
19
+ *
20
+ * @param config
21
+ */
22
+ function expandRouteShorthandEntries(config) {
23
+ const { routes } = config;
24
+ if (routes) {
25
+ for (let i = 0; i < routes.length; i++) {
26
+ const route = routes[i];
27
+ if (typeof route === 'string') {
28
+ routes[i] = { match: route, entry: route };
29
+ break;
30
+ }
31
+ }
32
+ }
33
+ }
18
34
  //# sourceMappingURL=readConfig.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"readConfig.js","sourceRoot":"","sources":["../src/readConfig.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,OAAe,EAAE,OAAmB,SAAS;IAC5E,MAAM,CAAC,SAAS,EAAE,eAAe,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC/G,MAAM,MAAM,GAAoB;QAC9B,OAAO;QACP,IAAI;QACJ,SAAS,EAAE,eAAe;QAC1B,GAAG,SAAS;KACb,CAAC;IAEF,aAAa,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAEhC,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { BundleMode, CloudpackConfig } from '@ms-cloudpack/common-types';\nimport { processConfig } from './processConfig.js';\nimport { readAppConfig } from './readAppConfig.js';\nimport { readGeneratedConfig } from './readGeneratedConfig.js';\n\n/**\n * Reads the config file asynchronously (and merges generated config into the result.)\n */\nexport async function readConfig(appPath: string, mode: BundleMode = 'library'): Promise<CloudpackConfig> {\n const [AppConfig, generatedConfig] = await Promise.all([readAppConfig(appPath), readGeneratedConfig(appPath)]);\n const config: CloudpackConfig = {\n appPath,\n mode,\n generated: generatedConfig,\n ...AppConfig,\n };\n\n processConfig(config.generated);\n\n return config;\n}\n"]}
1
+ {"version":3,"file":"readConfig.js","sourceRoot":"","sources":["../src/readConfig.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,OAAe,EAAE,OAAmB,SAAS;IAC5E,MAAM,CAAC,SAAS,EAAE,eAAe,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAE/G,MAAM,MAAM,GAAG;QACb,GAAG,SAAS;QACZ,OAAO;QACP,IAAI;QACJ,SAAS,EAAE,eAAe;KACR,CAAC;IAErB,uFAAuF;IACvF,2BAA2B,CAAC,MAAM,CAAC,CAAC;IAEpC,OAAO,MAAM,CAAC;AAChB,CAAC;AACD;;;GAGG;AACH,SAAS,2BAA2B,CAAC,MAAuB;IAC1D,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAE1B,IAAI,MAAM,EAAE,CAAC;QACX,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACvC,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;YAExB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC9B,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;gBAC3C,MAAM;YACR,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import type { BundleMode, CloudpackConfig } from '@ms-cloudpack/common-types';\nimport { readAppConfig } from './readAppConfig.js';\nimport { readGeneratedConfig } from './readGeneratedConfig.js';\n\n/**\n * Reads the config file asynchronously (and merges generated config into the result.)\n */\nexport async function readConfig(appPath: string, mode: BundleMode = 'library'): Promise<CloudpackConfig> {\n const [appConfig, generatedConfig] = await Promise.all([readAppConfig(appPath), readGeneratedConfig(appPath)]);\n\n const config = {\n ...appConfig,\n appPath,\n mode,\n generated: generatedConfig,\n } as CloudpackConfig;\n\n // Expands all routes which refer to source files into fully transformed route objects.\n expandRouteShorthandEntries(config);\n\n return config;\n}\n/**\n *\n * @param config\n */\nfunction expandRouteShorthandEntries(config: CloudpackConfig) {\n const { routes } = config;\n\n if (routes) {\n for (let i = 0; i < routes.length; i++) {\n const route = routes[i];\n\n if (typeof route === 'string') {\n routes[i] = { match: route, entry: route };\n break;\n }\n }\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"readGeneratedConfig.d.ts","sourceRoot":"","sources":["../src/readGeneratedConfig.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAElE;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAInF"}
1
+ {"version":3,"file":"readGeneratedConfig.d.ts","sourceRoot":"","sources":["../src/readGeneratedConfig.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,4BAA4B,CAAC;AAEnF;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAInF"}
@@ -6,6 +6,28 @@ import { getConfigPath } from './getConfigPath.js';
6
6
  */
7
7
  export async function readGeneratedConfig(appPath) {
8
8
  const { generatedConfigPath } = getConfigPath(appPath);
9
- return (await readJson(generatedConfigPath, { verbose: true, mode: 'permissive' })) || {};
9
+ return processDeprecatedValues((await readJson(generatedConfigPath, { verbose: true, mode: 'permissive' })) || {});
10
+ }
11
+ /**
12
+ * Delete deprecated values and convert them to the new format. Note that this function
13
+ * mutates the passed-in config object to avoid reallocation.
14
+ */
15
+ function processDeprecatedValues(config) {
16
+ // eslint-disable-next-line etc/no-deprecated
17
+ const { packageOverrides } = config;
18
+ // Convert package overrides into settings to preserve the deprecated support.
19
+ if (packageOverrides) {
20
+ config.packageSettings = config.packageSettings || [];
21
+ for (const override of packageOverrides) {
22
+ const settings = {
23
+ match: { name: override.name, version: override.versionRequirement },
24
+ exports: override.overrides.exports,
25
+ };
26
+ config.packageSettings.push(settings);
27
+ }
28
+ // eslint-disable-next-line etc/no-deprecated
29
+ delete config.packageOverrides;
30
+ }
31
+ return config;
10
32
  }
11
33
  //# sourceMappingURL=readGeneratedConfig.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"readGeneratedConfig.js","sourceRoot":"","sources":["../src/readGeneratedConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,OAAe;IACvD,MAAM,EAAE,mBAAmB,EAAE,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IAEvD,OAAO,CAAC,MAAM,QAAQ,CAAC,mBAAmB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;AAC5F,CAAC","sourcesContent":["import { readJson } from '@ms-cloudpack/json-utilities';\nimport { getConfigPath } from './getConfigPath.js';\nimport type { GeneratedConfig } from '@ms-cloudpack/common-types';\n\n/**\n * Reads the generated config file asynchronously. This is only useful for the `init` verb generating or updated\n * the generated overrides. For a full merged representation of config, use `readConfig` instead.\n */\nexport async function readGeneratedConfig(appPath: string): Promise<GeneratedConfig> {\n const { generatedConfigPath } = getConfigPath(appPath);\n\n return (await readJson(generatedConfigPath, { verbose: true, mode: 'permissive' })) || {};\n}\n"]}
1
+ {"version":3,"file":"readGeneratedConfig.js","sourceRoot":"","sources":["../src/readGeneratedConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,OAAe;IACvD,MAAM,EAAE,mBAAmB,EAAE,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IAEvD,OAAO,uBAAuB,CAAC,CAAC,MAAM,QAAQ,CAAC,mBAAmB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;AACrH,CAAC;AAED;;;GAGG;AACH,SAAS,uBAAuB,CAAC,MAAuB;IACtD,6CAA6C;IAC7C,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAAC;IAEpC,8EAA8E;IAC9E,IAAI,gBAAgB,EAAE,CAAC;QACrB,MAAM,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,IAAI,EAAE,CAAC;QAEtD,KAAK,MAAM,QAAQ,IAAI,gBAAgB,EAAE,CAAC;YACxC,MAAM,QAAQ,GAAoB;gBAChC,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,kBAAkB,EAAE;gBACpE,OAAO,EAAE,QAAQ,CAAC,SAAS,CAAC,OAAO;aACpC,CAAC;YACF,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACxC,CAAC;QAED,6CAA6C;QAC7C,OAAO,MAAM,CAAC,gBAAgB,CAAC;IACjC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { readJson } from '@ms-cloudpack/json-utilities';\nimport { getConfigPath } from './getConfigPath.js';\nimport type { GeneratedConfig, PackageSettings } from '@ms-cloudpack/common-types';\n\n/**\n * Reads the generated config file asynchronously. This is only useful for the `init` verb generating or updated\n * the generated overrides. For a full merged representation of config, use `readConfig` instead.\n */\nexport async function readGeneratedConfig(appPath: string): Promise<GeneratedConfig> {\n const { generatedConfigPath } = getConfigPath(appPath);\n\n return processDeprecatedValues((await readJson(generatedConfigPath, { verbose: true, mode: 'permissive' })) || {});\n}\n\n/**\n * Delete deprecated values and convert them to the new format. Note that this function\n * mutates the passed-in config object to avoid reallocation.\n */\nfunction processDeprecatedValues(config: GeneratedConfig) {\n // eslint-disable-next-line etc/no-deprecated\n const { packageOverrides } = config;\n\n // Convert package overrides into settings to preserve the deprecated support.\n if (packageOverrides) {\n config.packageSettings = config.packageSettings || [];\n\n for (const override of packageOverrides) {\n const settings: PackageSettings = {\n match: { name: override.name, version: override.versionRequirement },\n exports: override.overrides.exports,\n };\n config.packageSettings.push(settings);\n }\n\n // eslint-disable-next-line etc/no-deprecated\n delete config.packageOverrides;\n }\n\n return config;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/config",
3
- "version": "0.22.1",
3
+ "version": "0.23.1",
4
4
  "description": "Configuration handling for cloudpack.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -14,9 +14,9 @@
14
14
  }
15
15
  },
16
16
  "dependencies": {
17
- "@ms-cloudpack/common-types": "^0.9.0",
17
+ "@ms-cloudpack/common-types": "^0.11.0",
18
18
  "@ms-cloudpack/json-utilities": "^0.1.4",
19
- "@ms-cloudpack/package-utilities": "^7.8.0",
19
+ "@ms-cloudpack/package-utilities": "^7.8.2",
20
20
  "import-meta-resolve": "^4.0.0",
21
21
  "semver": "^7.6.0"
22
22
  },
@@ -1,6 +0,0 @@
1
- import type { GeneratedConfig } from '@ms-cloudpack/common-types';
2
- /**
3
- * An internal function for processing a config object after reading the json values.
4
- */
5
- export declare function processConfig(config?: GeneratedConfig): void;
6
- //# sourceMappingURL=processConfig.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"processConfig.d.ts","sourceRoot":"","sources":["../src/processConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,4BAA4B,CAAC;AAEnF;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,CAAC,EAAE,eAAe,QAmBrD"}
@@ -1,21 +0,0 @@
1
- /**
2
- * An internal function for processing a config object after reading the json values.
3
- */
4
- export function processConfig(config) {
5
- // eslint-disable-next-line etc/no-deprecated
6
- const packageOverrides = config?.packageOverrides;
7
- // Convert package overrides into settings to preserve the deprecated support.
8
- if (packageOverrides) {
9
- config.packageSettings = config.packageSettings || [];
10
- for (const override of packageOverrides) {
11
- const settings = {
12
- match: { name: override.name, version: override.versionRequirement },
13
- exports: override.overrides.exports,
14
- };
15
- config.packageSettings.push(settings);
16
- }
17
- // eslint-disable-next-line etc/no-deprecated
18
- delete config.packageOverrides;
19
- }
20
- }
21
- //# sourceMappingURL=processConfig.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"processConfig.js","sourceRoot":"","sources":["../src/processConfig.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,MAAwB;IACpD,6CAA6C;IAC7C,MAAM,gBAAgB,GAAG,MAAM,EAAE,gBAAgB,CAAC;IAElD,8EAA8E;IAC9E,IAAI,gBAAgB,EAAE,CAAC;QACrB,MAAM,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,IAAI,EAAE,CAAC;QAEtD,KAAK,MAAM,QAAQ,IAAI,gBAAgB,EAAE,CAAC;YACxC,MAAM,QAAQ,GAAoB;gBAChC,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,kBAAkB,EAAE;gBACpE,OAAO,EAAE,QAAQ,CAAC,SAAS,CAAC,OAAO;aACpC,CAAC;YACF,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACxC,CAAC;QAED,6CAA6C;QAC7C,OAAO,MAAM,CAAC,gBAAgB,CAAC;IACjC,CAAC;AACH,CAAC","sourcesContent":["import type { GeneratedConfig, PackageSettings } from '@ms-cloudpack/common-types';\n\n/**\n * An internal function for processing a config object after reading the json values.\n */\nexport function processConfig(config?: GeneratedConfig) {\n // eslint-disable-next-line etc/no-deprecated\n const packageOverrides = config?.packageOverrides;\n\n // Convert package overrides into settings to preserve the deprecated support.\n if (packageOverrides) {\n config.packageSettings = config.packageSettings || [];\n\n for (const override of packageOverrides) {\n const settings: PackageSettings = {\n match: { name: override.name, version: override.versionRequirement },\n exports: override.overrides.exports,\n };\n config.packageSettings.push(settings);\n }\n\n // eslint-disable-next-line etc/no-deprecated\n delete config.packageOverrides;\n }\n}\n"]}