@evjs/bundler-utoopack 0.1.1 → 0.1.2

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/esm/index.d.ts CHANGED
@@ -5,5 +5,6 @@
5
5
  * for zero-config server function handling.
6
6
  */
7
7
  export { utoopackAdapter } from "./adapter/index.js";
8
- export { utoopack } from "./plugin-helper.js";
8
+ export type { ConfigPatch } from "./plugin-helper.js";
9
+ export { merge, utoopack } from "./plugin-helper.js";
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC"}
package/esm/index.js CHANGED
@@ -5,5 +5,5 @@
5
5
  * for zero-config server function handling.
6
6
  */
7
7
  export { utoopackAdapter } from "./adapter/index.js";
8
- export { utoopack } from "./plugin-helper.js";
8
+ export { merge, utoopack } from "./plugin-helper.js";
9
9
  //# sourceMappingURL=index.js.map
package/esm/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC"}
@@ -1,5 +1,10 @@
1
1
  import type { EvBundlerCtx } from "@evjs/ev";
2
2
  import type { ConfigComplete } from "@utoo/pack";
3
+ type Primitive = string | number | boolean | bigint | symbol | null | undefined;
4
+ type Builtin = Primitive | RegExp | ((...args: never[]) => unknown);
5
+ export type ConfigPatch<T> = T extends Builtin ? T : T extends readonly unknown[] ? T : T extends object ? {
6
+ [K in keyof T]?: ConfigPatch<T[K]>;
7
+ } : T;
3
8
  /**
4
9
  * Typed wrapper for utoopack configuration in plugin bundler hooks.
5
10
  *
@@ -23,4 +28,6 @@ import type { ConfigComplete } from "@utoo/pack";
23
28
  * ```
24
29
  */
25
30
  export declare function utoopack<T = unknown>(fn: (config: ConfigComplete, ctx: EvBundlerCtx<ConfigComplete>) => void): (config: T, ctx: EvBundlerCtx<T>) => void;
31
+ export declare function merge(config: ConfigComplete, patch: ConfigPatch<ConfigComplete>): void;
32
+ export {};
26
33
  //# sourceMappingURL=plugin-helper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-helper.d.ts","sourceRoot":"","sources":["../src/plugin-helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,QAAQ,CAAC,CAAC,GAAG,OAAO,EAClC,EAAE,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,EAAE,YAAY,CAAC,cAAc,CAAC,KAAK,IAAI,GACtE,CAAC,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,YAAY,CAAC,CAAC,CAAC,KAAK,IAAI,CAS3C"}
1
+ {"version":3,"file":"plugin-helper.d.ts","sourceRoot":"","sources":["../src/plugin-helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,KAAK,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAChF,KAAK,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,OAAO,CAAC,CAAC;AAEpE,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,OAAO,GAC1C,CAAC,GACD,CAAC,SAAS,SAAS,OAAO,EAAE,GAC1B,CAAC,GACD,CAAC,SAAS,MAAM,GACd;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GACtC,CAAC,CAAC;AAEV;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,QAAQ,CAAC,CAAC,GAAG,OAAO,EAClC,EAAE,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,EAAE,YAAY,CAAC,cAAc,CAAC,KAAK,IAAI,GACtE,CAAC,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,YAAY,CAAC,CAAC,CAAC,KAAK,IAAI,CAS3C;AAED,wBAAgB,KAAK,CACnB,MAAM,EAAE,cAAc,EACtB,KAAK,EAAE,WAAW,CAAC,cAAc,CAAC,GACjC,IAAI,CAKN"}
@@ -27,4 +27,24 @@ export function utoopack(fn) {
27
27
  }
28
28
  };
29
29
  }
30
+ export function merge(config, patch) {
31
+ mergeObject(config, patch);
32
+ }
33
+ function mergeObject(target, patch) {
34
+ for (const [key, value] of Object.entries(patch)) {
35
+ const current = target[key];
36
+ if (isPlainObject(current) && isPlainObject(value)) {
37
+ mergeObject(current, value);
38
+ continue;
39
+ }
40
+ target[key] = value;
41
+ }
42
+ }
43
+ function isPlainObject(value) {
44
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
45
+ return false;
46
+ }
47
+ const prototype = Object.getPrototypeOf(value);
48
+ return prototype === Object.prototype || prototype === null;
49
+ }
30
50
  //# sourceMappingURL=plugin-helper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-helper.js","sourceRoot":"","sources":["../src/plugin-helper.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,QAAQ,CACtB,EAAuE;IAEvE,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE;QACrB,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,KAAK,UAAU,EAAE,CAAC;YAC5C,EAAE,CACA,MAAmC,EACnC,GAA8C,CAC/C,CAAC;QACJ,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"plugin-helper.js","sourceRoot":"","sources":["../src/plugin-helper.ts"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,QAAQ,CACtB,EAAuE;IAEvE,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE;QACrB,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,KAAK,UAAU,EAAE,CAAC;YAC5C,EAAE,CACA,MAAmC,EACnC,GAA8C,CAC/C,CAAC;QACJ,CAAC;IACH,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,KAAK,CACnB,MAAsB,EACtB,KAAkC;IAElC,WAAW,CACT,MAA4C,EAC5C,KAAgC,CACjC,CAAC;AACJ,CAAC;AAED,SAAS,WAAW,CAClB,MAA+B,EAC/B,KAA8B;IAE9B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACjD,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAE5B,IAAI,aAAa,CAAC,OAAO,CAAC,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;YACnD,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YAC5B,SAAS;QACX,CAAC;QAED,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACtB,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,KAAc;IACnC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACxE,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC/C,OAAO,SAAS,KAAK,MAAM,CAAC,SAAS,IAAI,SAAS,KAAK,IAAI,CAAC;AAC9D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evjs/bundler-utoopack",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Utoopack bundler adapter for the evjs framework",
5
5
  "type": "module",
6
6
  "publishConfig": {