@equinor/fusion-framework-cli 11.0.0-next.17 → 11.0.0-next.18

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.
@@ -1,4 +1,20 @@
1
1
  import deepmerge from 'deepmerge';
2
+ /**
3
+ * Merges two arrays of objects by a specified key, ensuring that objects with the same key value
4
+ * are merged, with the `source` array taking precedence over the `target` array for duplicate keys.
5
+ *
6
+ * @template TType - The type of objects contained in the arrays, extending `Record<string, unknown>`.
7
+ * @param key - The property key used to identify and merge objects from both arrays.
8
+ * @param target - The target array of objects to merge.
9
+ * @param source - The source array of objects to merge, whose values take precedence on key conflicts.
10
+ * @returns A new array containing merged objects, with uniqueness determined by the specified key.
11
+ */
12
+ const keyedArrayMerger = (key, target, source) => {
13
+ const sourceRecords = source.reduce((acc, item) => Object.assign(acc, { [String(item[key])]: item }), {});
14
+ const targetRecords = target.reduce((acc, item) => Object.assign(acc, { [String(item[key])]: item }), {});
15
+ const mergedRecords = { ...targetRecords, ...sourceRecords };
16
+ return Object.values(mergedRecords);
17
+ };
2
18
  /**
3
19
  * Merges a base development server configuration with an overrides object.
4
20
  *
@@ -12,8 +28,17 @@ import deepmerge from 'deepmerge';
12
28
  * Inline comments are provided for maintainability and clarity.
13
29
  */
14
30
  export const mergeDevServerConfig = (base, overrides) => {
15
- // Use lodash.mergeWith to merge base and overrides, applying the customizer for arrays
16
- return deepmerge(base, overrides);
31
+ return deepmerge(base, overrides, {
32
+ arrayMerge: (target, source) => {
33
+ // extract the first entry from both arrays to determine the merge strategy
34
+ const entry = source[0] ?? target[0];
35
+ // merge routes by 'match' if the entry is a route object
36
+ if (typeof entry === 'object' && 'match' in entry && 'middleware' in entry) {
37
+ return keyedArrayMerger('match', target, source);
38
+ }
39
+ return [...new Set([...target, ...source])];
40
+ },
41
+ });
17
42
  };
18
43
  // Export as default for convenience in imports
19
44
  export default mergeDevServerConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"merge-dev-server-config.js","sourceRoot":"","sources":["../../../src/lib/merge-dev-server-config.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAC;AAKlC;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,IAAsB,EACtB,SAA6C,EAC3B,EAAE;IACpB,uFAAuF;IACvF,OAAO,SAAS,CAAC,IAAI,EAAE,SAAS,CAAqB,CAAC;AACxD,CAAC,CAAC;AAEF,+CAA+C;AAC/C,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"merge-dev-server-config.js","sourceRoot":"","sources":["../../../src/lib/merge-dev-server-config.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAC;AAKlC;;;;;;;;;GASG;AACH,MAAM,gBAAgB,GAAG,CACvB,GAAgB,EAChB,MAAoB,EACpB,MAAoB,EACN,EAAE;IAChB,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CACjC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAChE,EAAW,CACZ,CAAC;IACF,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CACjC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAChE,EAAW,CACZ,CAAC;IACF,MAAM,aAAa,GAAG,EAAE,GAAG,aAAa,EAAE,GAAG,aAAa,EAAE,CAAC;IAC7D,OAAO,MAAM,CAAC,MAAM,CAAC,aAAa,CAAiB,CAAC;AACtD,CAAC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,IAAsB,EACtB,SAA6C,EAC3B,EAAE;IACpB,OAAO,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE;QAChC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE;YAC7B,2EAA2E;YAC3E,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC;YAErC,yDAAyD;YACzD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,IAAI,KAAK,IAAI,YAAY,IAAI,KAAK,EAAE,CAAC;gBAC3E,OAAO,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;YACnD,CAAC;YACD,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QAC9C,CAAC;KACF,CAAqB,CAAC;AACzB,CAAC,CAAC;AAEF,+CAA+C;AAC/C,eAAe,oBAAoB,CAAC"}
@@ -1,3 +1,3 @@
1
1
  // Generated by genversion.
2
- export const version = '11.0.0-next.17';
2
+ export const version = '11.0.0-next.18';
3
3
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- export declare const version = "11.0.0-next.17";
1
+ export declare const version = "11.0.0-next.18";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/fusion-framework-cli",
3
- "version": "11.0.0-next.17",
3
+ "version": "11.0.0-next.18",
4
4
  "homepage": "https://github.com/equinor/fusion-framework",
5
5
  "keywords": [
6
6
  "Fusion",
@@ -123,9 +123,9 @@
123
123
  "type-fest": "^4.40.0",
124
124
  "typescript": "^5.8.2",
125
125
  "@equinor/fusion-framework-module": "^4.4.3-next.2",
126
- "@equinor/fusion-framework-module-app": "^6.1.17-next.0",
127
- "@equinor/fusion-framework-module-http": "^6.3.4-next.0",
128
126
  "@equinor/fusion-framework-module-msal-node": "^0.1.1-next.3",
127
+ "@equinor/fusion-framework-module-http": "^6.3.4-next.0",
128
+ "@equinor/fusion-framework-module-app": "^6.1.17-next.0",
129
129
  "@equinor/fusion-framework-module-service-discovery": "^8.0.18-next.0"
130
130
  },
131
131
  "peerDependenciesMeta": {