adaptive-extender 0.10.1 → 0.10.4

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.
Files changed (55) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/core/array.js +0 -1
  3. package/dist/core/bigint.js +0 -1
  4. package/dist/core/boolean.js +0 -1
  5. package/dist/core/color.js +0 -1
  6. package/dist/core/controller.js +1 -2
  7. package/dist/core/controller.js.map +1 -1
  8. package/dist/core/date.js +0 -1
  9. package/dist/core/engine.js +0 -1
  10. package/dist/core/environment.js +0 -1
  11. package/dist/core/error.js +0 -1
  12. package/dist/core/function.d.ts +9 -0
  13. package/dist/core/function.js +6 -0
  14. package/dist/core/function.js.map +1 -0
  15. package/dist/core/global.js +1 -1
  16. package/dist/core/index.d.ts +1 -0
  17. package/dist/core/index.js +1 -1
  18. package/dist/core/index.js.map +1 -1
  19. package/dist/core/map.js +0 -1
  20. package/dist/core/math.js +0 -1
  21. package/dist/core/number.js +0 -1
  22. package/dist/core/object.js +0 -1
  23. package/dist/core/portable.js +29 -24
  24. package/dist/core/primitives.js +0 -1
  25. package/dist/core/promise.js +0 -1
  26. package/dist/core/random.js +0 -1
  27. package/dist/core/reflect.js +0 -1
  28. package/dist/core/set.js +0 -1
  29. package/dist/core/string.js +0 -1
  30. package/dist/core/timespan.js +0 -1
  31. package/dist/core/vector-1.js +0 -1
  32. package/dist/core/vector-2.js +0 -1
  33. package/dist/core/vector-3.js +0 -1
  34. package/dist/core/vector.js +0 -1
  35. package/dist/core/version.js +0 -1
  36. package/dist/node/index.js +0 -1
  37. package/dist/web/archive.js +0 -1
  38. package/dist/web/element.js +0 -1
  39. package/dist/web/engine.js +0 -1
  40. package/dist/web/index.d.ts +2 -0
  41. package/dist/web/index.js +1 -1
  42. package/dist/web/index.js.map +1 -1
  43. package/dist/web/metadata-injector.d.ts +99 -0
  44. package/dist/web/metadata-injector.js +327 -0
  45. package/dist/web/metadata-injector.js.map +1 -0
  46. package/dist/web/parent-node.js +0 -1
  47. package/dist/web/promise.js +0 -1
  48. package/dist/web/url.d.ts +1 -0
  49. package/dist/web/url.js +17 -0
  50. package/dist/web/url.js.map +1 -0
  51. package/dist/worker/engine.js +0 -1
  52. package/dist/worker/index.js +0 -1
  53. package/dist/worker/promise.js +0 -1
  54. package/package.json +8 -25
  55. package/tsconfig.base.json +27 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.10.4 (13.06.2026)
2
+ - Added `Function.empty` constant — a shared no-op function available via `Function.empty`.
3
+ - Added [function](./src/core/function.ts) module to the core package.
4
+ - Added [metadata-injector](./src/web/metadata-injector.ts) module to the web package. Provides `MetadataInjector.inject()` for one-shot injection of structured JSON-LD metadata, Open Graph meta tags, and `rel=me` links into the document head. Supports `Person`, `Application`, and `Organization` entity types.
5
+ - `Controller.catch()` now re-throws the error by default instead of silently ignoring it.
6
+
1
7
  ## 0.10.1 (02.06.2026)
2
8
  - Vitest vulnerability fixed.
3
9
 
@@ -67,4 +67,3 @@ Array.prototype.remove = function (value) {
67
67
  this.splice(index, 1);
68
68
  return true;
69
69
  };
70
- //# sourceMappingURL=array.js.map
@@ -8,4 +8,3 @@ BigInt.import = function (source, name) {
8
8
  BigInt.export = function (source) {
9
9
  return source.toString();
10
10
  };
11
- //# sourceMappingURL=bigint.js.map
@@ -8,4 +8,3 @@ Boolean.import = function (source, name) {
8
8
  Boolean.export = function (source) {
9
9
  return source.valueOf();
10
10
  };
11
- //# sourceMappingURL=boolean.js.map
@@ -518,4 +518,3 @@ export class Color {
518
518
  return this;
519
519
  }
520
520
  }
521
- //# sourceMappingURL=color.js.map
@@ -24,7 +24,7 @@ export class Controller {
24
24
  * When overridden in a derived class, handles an error that occurred during the controller's execution.
25
25
  */
26
26
  async catch(error) {
27
- void error;
27
+ throw error;
28
28
  }
29
29
  /**
30
30
  * When overridden in a derived class, runs unconditionally after {@link run} and {@link catch}.
@@ -50,4 +50,3 @@ export class Controller {
50
50
  }
51
51
  }
52
52
  }
53
- //# sourceMappingURL=controller.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"controller.js","sourceRoot":"","sources":["../../src/core/controller.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,YAAY,CAAC;AACpB,OAAO,EAAoB,MAAM,aAAa,CAAC;AAE/C,oBAAoB;AACpB;;GAEG;AACH,MAAM,OAAgB,UAAU;IAC/B;;OAEG;IACH;QACC,IAAI,GAAG,CAAC,MAAM,KAAK,UAAU;YAAE,MAAM,IAAI,SAAS,CAAC,mDAAmD,CAAC,CAAC;IACzG,CAAC;IACD;;;OAGG;IACH,KAAK,CAAC,GAAG,CAAC,GAAG,IAAO;QACnB,KAAK,IAAI,CAAC;IACX,CAAC;IACD;;OAEG;IACH,KAAK,CAAC,KAAK,CAAC,KAAY;QACvB,KAAK,KAAK,CAAC;IACZ,CAAC;IACD;;OAEG;IACH,KAAK,CAAC,OAAO;IACb,CAAC;IACD;;;OAGG;IACH,MAAM,CAAC,KAAK,CAAC,MAAM,CAA6D,GAAG,IAAO;QACzF,MAAM,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,CAAC,UAAU,YAAY,IAAI,CAAC;YAAE,MAAM,IAAI,SAAS,CAAC,sCAAsC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAC1G,IAAI,CAAC;YACJ,MAAM,UAAU,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;QAC/B,CAAC;QAAC,OAAO,MAAM,EAAE,CAAC;YACjB,MAAM,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QAC5C,CAAC;gBAAS,CAAC;YACV,MAAM,UAAU,CAAC,OAAO,EAAE,CAAC;QAC5B,CAAC;IACF,CAAC;CACD"}
1
+ {"version":3,"file":"controller.js","sourceRoot":"","sources":["../../src/core/controller.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,YAAY,CAAC;AACpB,OAAO,EAAoB,MAAM,aAAa,CAAC;AAE/C,oBAAoB;AACpB;;GAEG;AACH,MAAM,OAAgB,UAAU;IAC/B;;OAEG;IACH;QACC,IAAI,GAAG,CAAC,MAAM,KAAK,UAAU;YAAE,MAAM,IAAI,SAAS,CAAC,mDAAmD,CAAC,CAAC;IACzG,CAAC;IACD;;;OAGG;IACH,KAAK,CAAC,GAAG,CAAC,GAAG,IAAO;QACnB,KAAK,IAAI,CAAC;IACX,CAAC;IACD;;OAEG;IACH,KAAK,CAAC,KAAK,CAAC,KAAY;QACvB,MAAM,KAAK,CAAC;IACb,CAAC;IACD;;OAEG;IACH,KAAK,CAAC,OAAO;IACb,CAAC;IACD;;;OAGG;IACH,MAAM,CAAC,KAAK,CAAC,MAAM,CAA6D,GAAG,IAAO;QACzF,MAAM,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,CAAC,UAAU,YAAY,IAAI,CAAC;YAAE,MAAM,IAAI,SAAS,CAAC,sCAAsC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAC1G,IAAI,CAAC;YACJ,MAAM,UAAU,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;QAC/B,CAAC;QAAC,OAAO,MAAM,EAAE,CAAC;YACjB,MAAM,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QAC5C,CAAC;gBAAS,CAAC;YACV,MAAM,UAAU,CAAC,OAAO,EAAE,CAAC;QAC5B,CAAC;IACF,CAAC;CACD"}
package/dist/core/date.js CHANGED
@@ -18,4 +18,3 @@ Date.prototype.insteadInvalid = function (value) {
18
18
  return value;
19
19
  return this;
20
20
  };
21
- //# sourceMappingURL=date.js.map
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
2
  export {};
3
- //# sourceMappingURL=engine.js.map
@@ -22,4 +22,3 @@ export class EnvironmentProvider {
22
22
  }
23
23
  }
24
24
  }
25
- //# sourceMappingURL=environment.js.map
@@ -29,4 +29,3 @@ export class ImplementationError extends Error {
29
29
  this.name = "ImplementationError";
30
30
  }
31
31
  }
32
- //# sourceMappingURL=error.js.map
@@ -0,0 +1,9 @@
1
+ declare global {
2
+ export interface FunctionConstructor {
3
+ /**
4
+ * A constant empty function.
5
+ */
6
+ empty: () => void;
7
+ }
8
+ }
9
+ export {};
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(Function, "empty", {
3
+ value: () => { },
4
+ writable: false,
5
+ });
6
+ export {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"function.js","sourceRoot":"","sources":["../../src/core/function.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAYb,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE;IACxC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC;IAChB,QAAQ,EAAE,KAAK;CACf,CAAC,CAAC"}
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ Reflect.set(Symbol, "metadata", Reflect.get(Symbol, "metadata") ?? Symbol.for("Symbol.metadata"));
2
3
  globalThis.constructor = function (value) {
3
4
  return value.constructor;
4
5
  };
@@ -10,4 +11,3 @@ globalThis.typename = function (value) {
10
11
  }
11
12
  };
12
13
  export {};
13
- //# sourceMappingURL=global.js.map
@@ -24,4 +24,5 @@ export * from "./timespan.js";
24
24
  export * from "./version.js";
25
25
  export * from "./engine.js";
26
26
  export * from "./controller.js";
27
+ export * from "./function.js";
27
28
  export * from "./environment.js";
@@ -25,5 +25,5 @@ export * from "./timespan.js";
25
25
  export * from "./version.js";
26
26
  export * from "./engine.js";
27
27
  export * from "./controller.js";
28
+ export * from "./function.js";
28
29
  export * from "./environment.js";
29
- //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core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AC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC"}
package/dist/core/map.js CHANGED
@@ -6,4 +6,3 @@ Map.prototype.add = function (key, value) {
6
6
  return true;
7
7
  };
8
8
  export {};
9
- //# sourceMappingURL=map.js.map
package/dist/core/math.js CHANGED
@@ -70,4 +70,3 @@ Math.meanHarmonic = function (...values) {
70
70
  return values.length / summary;
71
71
  };
72
72
  export {};
73
- //# sourceMappingURL=math.js.map
@@ -26,4 +26,3 @@ Number.prototype.insteadZero = function (value) {
26
26
  return value;
27
27
  return current;
28
28
  };
29
- //# sourceMappingURL=number.js.map
@@ -8,4 +8,3 @@ Object.export = function (source) {
8
8
  return source;
9
9
  };
10
10
  export {};
11
- //# sourceMappingURL=object.js.map
@@ -4,7 +4,9 @@ import "./string.js";
4
4
  import "./boolean.js";
5
5
  import "./array.js";
6
6
  import "./object.js";
7
+ import "./map.js";
7
8
  import "./reflect.js";
9
+ import "./error.js";
8
10
  import {} from "./global.js";
9
11
  //#endregion
10
12
  //#region Field descriptor
@@ -47,25 +49,32 @@ class DescendantDescriptor {
47
49
  //#region Portability metadata
48
50
  class PortabilityMetadata {
49
51
  static #registry = new WeakMap();
50
- #model;
51
52
  #fields = new Map();
52
53
  #descendants = [];
53
54
  #discriminator = "$type";
54
- constructor(model) {
55
- this.#model = model;
55
+ static for(metadata) {
56
+ const registry = PortabilityMetadata.#registry;
57
+ let entry = registry.get(metadata);
58
+ if (entry !== undefined)
59
+ return entry;
60
+ entry = new PortabilityMetadata();
61
+ registry.set(metadata, entry);
62
+ return entry;
56
63
  }
57
64
  static read(model) {
58
- const registry = PortabilityMetadata.#registry;
59
- let metadata = registry.get(model);
60
- if (metadata !== undefined)
61
- return metadata;
62
- metadata = new PortabilityMetadata(model);
63
- registry.set(model, metadata);
65
+ const object = ReferenceError.suppress(model[Symbol.metadata], `Required an implementation of Symbol.metadata in '${model.name}' to use portability`);
66
+ const metadata = PortabilityMetadata.for(object);
67
+ const fields = metadata.#fields;
68
+ let current = object;
69
+ while (true) {
70
+ if (current === null)
71
+ break;
72
+ for (const [key, descriptor] of PortabilityMetadata.for(current).#fields)
73
+ fields.add(key, descriptor);
74
+ current = Object.getPrototypeOf(current);
75
+ }
64
76
  return metadata;
65
77
  }
66
- get model() {
67
- return this.#model;
68
- }
69
78
  get fields() {
70
79
  return this.#fields;
71
80
  }
@@ -150,18 +159,15 @@ export function Field(type, name) {
150
159
  if (typeof (key) === "symbol")
151
160
  throw new TypeError("Symbols are not supported as portable keys");
152
161
  const association = name ?? key;
153
- context.addInitializer(function () {
154
- const model = constructor(this);
155
- const { fields } = PortabilityMetadata.read(model);
156
- if (fields.has(key))
157
- return;
162
+ const { fields } = PortabilityMetadata.for(context.metadata);
163
+ if (!fields.has(key))
158
164
  fields.set(key, new FieldDescriptor(key, association, type));
159
- });
160
165
  };
161
166
  }
162
167
  export function Descendant(descendant, discriminator) {
163
- return function (model) {
164
- const { descendants } = PortabilityMetadata.read(model);
168
+ return function (model, context) {
169
+ void model;
170
+ const { descendants } = PortabilityMetadata.for(context.metadata);
165
171
  descendants.push(new DescendantDescriptor(descendant, discriminator));
166
172
  };
167
173
  }
@@ -170,9 +176,9 @@ export function Descendant(descendant, discriminator) {
170
176
  * @param key The property key to use for the discriminator.
171
177
  */
172
178
  export function DiscriminatorKey(key) {
173
- return function (model) {
174
- const metadata = PortabilityMetadata.read(model);
175
- metadata.discriminator = key;
179
+ return function (model, context) {
180
+ void model;
181
+ PortabilityMetadata.for(context.metadata).discriminator = key;
176
182
  };
177
183
  }
178
184
  //#endregion
@@ -418,4 +424,3 @@ export const Any = {
418
424
  return source;
419
425
  },
420
426
  };
421
- //# sourceMappingURL=portable.js.map
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
2
  export {};
3
- //# sourceMappingURL=primitives.js.map
@@ -55,4 +55,3 @@ Object.defineProperty(Promise.prototype, "reason", {
55
55
  }
56
56
  });
57
57
  export {};
58
- //# sourceMappingURL=promise.js.map
@@ -108,4 +108,3 @@ export class Random {
108
108
  }
109
109
  ;
110
110
  }
111
- //# sourceMappingURL=random.js.map
@@ -15,4 +15,3 @@ Reflect.mapNullable = function (value, callback) {
15
15
  return callback(value);
16
16
  };
17
17
  export {};
18
- //# sourceMappingURL=reflect.js.map
package/dist/core/set.js CHANGED
@@ -16,4 +16,3 @@ Set.prototype.toggle = function (value, force) {
16
16
  return false;
17
17
  };
18
18
  export {};
19
- //# sourceMappingURL=set.js.map
@@ -37,4 +37,3 @@ String.prototype.toTitleCase = function () {
37
37
  String.prototype.toLocalTitleCase = function (locales) {
38
38
  return this.toLocaleLowerCase(locales).replace(patternWordsFirstLetter, char => char.toLocaleUpperCase(locales));
39
39
  };
40
- //# sourceMappingURL=string.js.map
@@ -264,4 +264,3 @@ export class Timespan {
264
264
  return Timespan.fromValue(-this.#value);
265
265
  }
266
266
  }
267
- //# sourceMappingURL=timespan.js.map
@@ -97,4 +97,3 @@ export class Vector1D extends Vector {
97
97
  */
98
98
  static get newUnit() { return Vector1D.fromScalar(1); }
99
99
  }
100
- //# sourceMappingURL=vector-1.js.map
@@ -107,4 +107,3 @@ export class Vector2D extends Vector1D {
107
107
  */
108
108
  static get newUnit() { return Vector2D.fromScalar(1); }
109
109
  }
110
- //# sourceMappingURL=vector-2.js.map
@@ -116,4 +116,3 @@ export class Vector3D extends Vector2D {
116
116
  */
117
117
  static get newUnit() { return Vector3D.fromScalar(1); }
118
118
  }
119
- //# sourceMappingURL=vector-3.js.map
@@ -228,4 +228,3 @@ export class Vector {
228
228
  return result;
229
229
  }
230
230
  }
231
- //# sourceMappingURL=vector.js.map
@@ -72,4 +72,3 @@ export class Version {
72
72
  return version;
73
73
  }
74
74
  }
75
- //# sourceMappingURL=version.js.map
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
2
  export * from "../core/index.js";
3
- //# sourceMappingURL=index.js.map
@@ -228,4 +228,3 @@ export class ArchiveRepository {
228
228
  this.#content = manager.content;
229
229
  }
230
230
  }
231
- //# sourceMappingURL=archive.js.map
@@ -9,4 +9,3 @@ Element.prototype.getClosest = function (type, selectors) {
9
9
  Element.prototype.getClosestAsync = async function (type, selectors) {
10
10
  return this.getClosest(type, selectors);
11
11
  };
12
- //# sourceMappingURL=element.js.map
@@ -175,4 +175,3 @@ export class StaticEngine extends WebEngine {
175
175
  setTimeout(this.#callback);
176
176
  };
177
177
  }
178
- //# sourceMappingURL=engine.js.map
@@ -1,6 +1,8 @@
1
1
  export * from "../core/index.js";
2
2
  export * from "./promise.js";
3
+ export * from "./url.js";
3
4
  export * from "./engine.js";
4
5
  export * from "./parent-node.js";
5
6
  export * from "./element.js";
6
7
  export * from "./archive.js";
8
+ export * from "./metadata-injector.js";
package/dist/web/index.js CHANGED
@@ -5,4 +5,4 @@ export * from "./engine.js";
5
5
  export * from "./parent-node.js";
6
6
  export * from "./element.js";
7
7
  export * from "./archive.js";
8
- //# sourceMappingURL=index.js.map
8
+ export * from "./metadata-injector.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/web/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/web/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC"}
@@ -0,0 +1,99 @@
1
+ import "adaptive-extender/web";
2
+ export interface MetadataDiscriminator extends PersonMetadataDiscriminator, ApplicationMetadataDiscriminator, OrganizationMetadataDiscriminator {
3
+ }
4
+ /**
5
+ * Base configuration for the entity metadata.
6
+ */
7
+ export interface MetadataConfiguration {
8
+ type: keyof MetadataDiscriminator;
9
+ /**
10
+ * The display name of the entity or the page title.
11
+ */
12
+ name: string;
13
+ /**
14
+ * The canonical public URL of the resource.
15
+ */
16
+ webpage: URL;
17
+ /**
18
+ * The absolute URL to the representative image (Open Graph).
19
+ */
20
+ preview?: URL;
21
+ /**
22
+ * A short summary of the content.
23
+ */
24
+ description?: string;
25
+ /**
26
+ * A set of keywords relevant to the content.
27
+ */
28
+ keywords?: string[];
29
+ }
30
+ export interface PersonMetadataDiscriminator {
31
+ "Person": "Person";
32
+ }
33
+ /**
34
+ * Configuration for a personal profile.
35
+ */
36
+ export interface PersonMetadataConfiguration extends MetadataConfiguration {
37
+ type: keyof PersonMetadataDiscriminator;
38
+ /**
39
+ * A list of related social profiles or websites.
40
+ */
41
+ associations?: URL[];
42
+ /**
43
+ * The professional job title or role.
44
+ */
45
+ job?: string;
46
+ /**
47
+ * A list of known skills or expertise.
48
+ */
49
+ knowledge?: string[];
50
+ }
51
+ export interface ApplicationMetadataDiscriminator {
52
+ "Application": "SoftwareApplication";
53
+ }
54
+ /**
55
+ * Configuration for a software application.
56
+ */
57
+ export interface ApplicationMetadataConfiguration extends MetadataConfiguration {
58
+ type: keyof ApplicationMetadataDiscriminator;
59
+ /**
60
+ * The general category of the application.
61
+ */
62
+ category: string;
63
+ /**
64
+ * The required operating system.
65
+ */
66
+ os: string;
67
+ /**
68
+ * The current version identifier.
69
+ */
70
+ version?: string;
71
+ }
72
+ export interface OrganizationMetadataDiscriminator {
73
+ "Organization": "Organization";
74
+ }
75
+ /**
76
+ * Configuration for an organization.
77
+ */
78
+ export interface OrganizationMetadataConfiguration extends MetadataConfiguration {
79
+ type: keyof OrganizationMetadataDiscriminator;
80
+ /**
81
+ * The URL to the organization's logo image.
82
+ */
83
+ logo?: URL;
84
+ /**
85
+ * The primary contact email.
86
+ */
87
+ email?: string;
88
+ /**
89
+ * The date the organization was established.
90
+ */
91
+ foundation?: Date;
92
+ }
93
+ export declare class MetadataInjector {
94
+ #private;
95
+ constructor();
96
+ static inject(configuration: PersonMetadataConfiguration): void;
97
+ static inject(configuration: ApplicationMetadataConfiguration): void;
98
+ static inject(configuration: OrganizationMetadataConfiguration): void;
99
+ }
@@ -0,0 +1,327 @@
1
+ "use strict";
2
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
5
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
6
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
7
+ var _, done = false;
8
+ for (var i = decorators.length - 1; i >= 0; i--) {
9
+ var context = {};
10
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
11
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
12
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
14
+ if (kind === "accessor") {
15
+ if (result === void 0) continue;
16
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
17
+ if (_ = accept(result.get)) descriptor.get = _;
18
+ if (_ = accept(result.set)) descriptor.set = _;
19
+ if (_ = accept(result.init)) initializers.unshift(_);
20
+ }
21
+ else if (_ = accept(result)) {
22
+ if (kind === "field") initializers.unshift(_);
23
+ else descriptor[key] = _;
24
+ }
25
+ }
26
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
27
+ done = true;
28
+ };
29
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
30
+ var useValue = arguments.length > 2;
31
+ for (var i = 0; i < initializers.length; i++) {
32
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
33
+ }
34
+ return useValue ? value : void 0;
35
+ };
36
+ import "adaptive-extender/web";
37
+ import { Model, Field, Optional, ArrayOf, DiscriminatorKey, Descendant, Deferred } from "adaptive-extender/web";
38
+ //#region URL adapter
39
+ const URLAdapter = {
40
+ [Symbol.hasInstance](instance) {
41
+ return URL[Symbol.hasInstance](instance);
42
+ },
43
+ get name() {
44
+ return "URL";
45
+ },
46
+ import(source, name) {
47
+ if (typeof source !== "string")
48
+ throw new TypeError(`Unable to import URL from ${name} due its ${typename(source)} type`);
49
+ return new URL(source);
50
+ },
51
+ export(source) {
52
+ return source.toString();
53
+ },
54
+ };
55
+ let Metadata = (() => {
56
+ let _classDecorators = [DiscriminatorKey("@type"), Descendant(Deferred(_ => PersonMetadata), "Person"), Descendant(Deferred(_ => ApplicationMetadata), "SoftwareApplication"), Descendant(Deferred(_ => OrganizationMetadata), "Organization")];
57
+ let _classDescriptor;
58
+ let _classExtraInitializers = [];
59
+ let _classThis;
60
+ let _classSuper = Model;
61
+ let _context_decorators;
62
+ let _context_initializers = [];
63
+ let _context_extraInitializers = [];
64
+ let _name_decorators;
65
+ let _name_initializers = [];
66
+ let _name_extraInitializers = [];
67
+ let _webpage_decorators;
68
+ let _webpage_initializers = [];
69
+ let _webpage_extraInitializers = [];
70
+ let _preview_decorators;
71
+ let _preview_initializers = [];
72
+ let _preview_extraInitializers = [];
73
+ let _description_decorators;
74
+ let _description_initializers = [];
75
+ let _description_extraInitializers = [];
76
+ let _keywords_decorators;
77
+ let _keywords_initializers = [];
78
+ let _keywords_extraInitializers = [];
79
+ var Metadata = class extends _classSuper {
80
+ static { _classThis = this; }
81
+ static {
82
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
83
+ _context_decorators = [Field(String, "@context")];
84
+ _name_decorators = [Field(String, "name")];
85
+ _webpage_decorators = [Field(URLAdapter, "url")];
86
+ _preview_decorators = [Field(Optional(URLAdapter), "image")];
87
+ _description_decorators = [Field(Optional(String), "description")];
88
+ _keywords_decorators = [Field(Optional(ArrayOf(String)), "keywords")];
89
+ __esDecorate(null, null, _context_decorators, { kind: "field", name: "context", static: false, private: false, access: { has: obj => "context" in obj, get: obj => obj.context, set: (obj, value) => { obj.context = value; } }, metadata: _metadata }, _context_initializers, _context_extraInitializers);
90
+ __esDecorate(null, null, _name_decorators, { kind: "field", name: "name", static: false, private: false, access: { has: obj => "name" in obj, get: obj => obj.name, set: (obj, value) => { obj.name = value; } }, metadata: _metadata }, _name_initializers, _name_extraInitializers);
91
+ __esDecorate(null, null, _webpage_decorators, { kind: "field", name: "webpage", static: false, private: false, access: { has: obj => "webpage" in obj, get: obj => obj.webpage, set: (obj, value) => { obj.webpage = value; } }, metadata: _metadata }, _webpage_initializers, _webpage_extraInitializers);
92
+ __esDecorate(null, null, _preview_decorators, { kind: "field", name: "preview", static: false, private: false, access: { has: obj => "preview" in obj, get: obj => obj.preview, set: (obj, value) => { obj.preview = value; } }, metadata: _metadata }, _preview_initializers, _preview_extraInitializers);
93
+ __esDecorate(null, null, _description_decorators, { kind: "field", name: "description", static: false, private: false, access: { has: obj => "description" in obj, get: obj => obj.description, set: (obj, value) => { obj.description = value; } }, metadata: _metadata }, _description_initializers, _description_extraInitializers);
94
+ __esDecorate(null, null, _keywords_decorators, { kind: "field", name: "keywords", static: false, private: false, access: { has: obj => "keywords" in obj, get: obj => obj.keywords, set: (obj, value) => { obj.keywords = value; } }, metadata: _metadata }, _keywords_initializers, _keywords_extraInitializers);
95
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
96
+ Metadata = _classThis = _classDescriptor.value;
97
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
98
+ __runInitializers(_classThis, _classExtraInitializers);
99
+ }
100
+ context = __runInitializers(this, _context_initializers, "https://schema.org");
101
+ name = (__runInitializers(this, _context_extraInitializers), __runInitializers(this, _name_initializers, void 0));
102
+ webpage = (__runInitializers(this, _name_extraInitializers), __runInitializers(this, _webpage_initializers, void 0));
103
+ preview = (__runInitializers(this, _webpage_extraInitializers), __runInitializers(this, _preview_initializers, void 0));
104
+ description = (__runInitializers(this, _preview_extraInitializers), __runInitializers(this, _description_initializers, void 0));
105
+ keywords = (__runInitializers(this, _description_extraInitializers), __runInitializers(this, _keywords_initializers, void 0));
106
+ constructor(configuration) {
107
+ if (new.target === Metadata)
108
+ throw new TypeError("Unable to create an instance of an abstract class");
109
+ if (configuration === undefined) {
110
+ super();
111
+ return;
112
+ }
113
+ super();
114
+ __runInitializers(this, _keywords_extraInitializers);
115
+ this.name = configuration.name;
116
+ this.webpage = configuration.webpage;
117
+ this.preview = configuration.preview;
118
+ this.description = configuration.description;
119
+ this.keywords = configuration.keywords;
120
+ }
121
+ };
122
+ return Metadata = _classThis;
123
+ })();
124
+ let PersonMetadata = (() => {
125
+ let _classSuper = Metadata;
126
+ let _associations_decorators;
127
+ let _associations_initializers = [];
128
+ let _associations_extraInitializers = [];
129
+ let _job_decorators;
130
+ let _job_initializers = [];
131
+ let _job_extraInitializers = [];
132
+ let _knowledge_decorators;
133
+ let _knowledge_initializers = [];
134
+ let _knowledge_extraInitializers = [];
135
+ return class PersonMetadata extends _classSuper {
136
+ static {
137
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
138
+ _associations_decorators = [Field(Optional(ArrayOf(URLAdapter)), "sameAs")];
139
+ _job_decorators = [Field(Optional(String), "jobTitle")];
140
+ _knowledge_decorators = [Field(Optional(ArrayOf(String)), "knowsAbout")];
141
+ __esDecorate(null, null, _associations_decorators, { kind: "field", name: "associations", static: false, private: false, access: { has: obj => "associations" in obj, get: obj => obj.associations, set: (obj, value) => { obj.associations = value; } }, metadata: _metadata }, _associations_initializers, _associations_extraInitializers);
142
+ __esDecorate(null, null, _job_decorators, { kind: "field", name: "job", static: false, private: false, access: { has: obj => "job" in obj, get: obj => obj.job, set: (obj, value) => { obj.job = value; } }, metadata: _metadata }, _job_initializers, _job_extraInitializers);
143
+ __esDecorate(null, null, _knowledge_decorators, { kind: "field", name: "knowledge", static: false, private: false, access: { has: obj => "knowledge" in obj, get: obj => obj.knowledge, set: (obj, value) => { obj.knowledge = value; } }, metadata: _metadata }, _knowledge_initializers, _knowledge_extraInitializers);
144
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
145
+ }
146
+ associations = __runInitializers(this, _associations_initializers, void 0);
147
+ job = (__runInitializers(this, _associations_extraInitializers), __runInitializers(this, _job_initializers, void 0));
148
+ knowledge = (__runInitializers(this, _job_extraInitializers), __runInitializers(this, _knowledge_initializers, void 0));
149
+ constructor(configuration) {
150
+ if (configuration === undefined) {
151
+ super();
152
+ return;
153
+ }
154
+ super(configuration);
155
+ __runInitializers(this, _knowledge_extraInitializers);
156
+ this.associations = configuration.associations;
157
+ this.job = configuration.job;
158
+ this.knowledge = configuration.knowledge;
159
+ }
160
+ };
161
+ })();
162
+ let ApplicationMetadata = (() => {
163
+ let _classSuper = Metadata;
164
+ let _category_decorators;
165
+ let _category_initializers = [];
166
+ let _category_extraInitializers = [];
167
+ let _os_decorators;
168
+ let _os_initializers = [];
169
+ let _os_extraInitializers = [];
170
+ let _version_decorators;
171
+ let _version_initializers = [];
172
+ let _version_extraInitializers = [];
173
+ return class ApplicationMetadata extends _classSuper {
174
+ static {
175
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
176
+ _category_decorators = [Field(String, "applicationCategory")];
177
+ _os_decorators = [Field(String, "operatingSystem")];
178
+ _version_decorators = [Field(Optional(String), "softwareVersion")];
179
+ __esDecorate(null, null, _category_decorators, { kind: "field", name: "category", static: false, private: false, access: { has: obj => "category" in obj, get: obj => obj.category, set: (obj, value) => { obj.category = value; } }, metadata: _metadata }, _category_initializers, _category_extraInitializers);
180
+ __esDecorate(null, null, _os_decorators, { kind: "field", name: "os", static: false, private: false, access: { has: obj => "os" in obj, get: obj => obj.os, set: (obj, value) => { obj.os = value; } }, metadata: _metadata }, _os_initializers, _os_extraInitializers);
181
+ __esDecorate(null, null, _version_decorators, { kind: "field", name: "version", static: false, private: false, access: { has: obj => "version" in obj, get: obj => obj.version, set: (obj, value) => { obj.version = value; } }, metadata: _metadata }, _version_initializers, _version_extraInitializers);
182
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
183
+ }
184
+ category = __runInitializers(this, _category_initializers, void 0);
185
+ os = (__runInitializers(this, _category_extraInitializers), __runInitializers(this, _os_initializers, void 0));
186
+ version = (__runInitializers(this, _os_extraInitializers), __runInitializers(this, _version_initializers, void 0));
187
+ constructor(configuration) {
188
+ if (configuration === undefined) {
189
+ super();
190
+ return;
191
+ }
192
+ super(configuration);
193
+ __runInitializers(this, _version_extraInitializers);
194
+ this.category = configuration.category;
195
+ this.os = configuration.os;
196
+ this.version = configuration.version;
197
+ }
198
+ };
199
+ })();
200
+ let OrganizationMetadata = (() => {
201
+ let _classSuper = Metadata;
202
+ let _logo_decorators;
203
+ let _logo_initializers = [];
204
+ let _logo_extraInitializers = [];
205
+ let _email_decorators;
206
+ let _email_initializers = [];
207
+ let _email_extraInitializers = [];
208
+ let _foundation_decorators;
209
+ let _foundation_initializers = [];
210
+ let _foundation_extraInitializers = [];
211
+ return class OrganizationMetadata extends _classSuper {
212
+ static {
213
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
214
+ _logo_decorators = [Field(Optional(URLAdapter), "logo")];
215
+ _email_decorators = [Field(Optional(String), "email")];
216
+ _foundation_decorators = [Field(Optional(Date), "foundingDate")];
217
+ __esDecorate(null, null, _logo_decorators, { kind: "field", name: "logo", static: false, private: false, access: { has: obj => "logo" in obj, get: obj => obj.logo, set: (obj, value) => { obj.logo = value; } }, metadata: _metadata }, _logo_initializers, _logo_extraInitializers);
218
+ __esDecorate(null, null, _email_decorators, { kind: "field", name: "email", static: false, private: false, access: { has: obj => "email" in obj, get: obj => obj.email, set: (obj, value) => { obj.email = value; } }, metadata: _metadata }, _email_initializers, _email_extraInitializers);
219
+ __esDecorate(null, null, _foundation_decorators, { kind: "field", name: "foundation", static: false, private: false, access: { has: obj => "foundation" in obj, get: obj => obj.foundation, set: (obj, value) => { obj.foundation = value; } }, metadata: _metadata }, _foundation_initializers, _foundation_extraInitializers);
220
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
221
+ }
222
+ logo = __runInitializers(this, _logo_initializers, void 0);
223
+ email = (__runInitializers(this, _logo_extraInitializers), __runInitializers(this, _email_initializers, void 0));
224
+ foundation = (__runInitializers(this, _email_extraInitializers), __runInitializers(this, _foundation_initializers, void 0));
225
+ constructor(configuration) {
226
+ if (configuration === undefined) {
227
+ super();
228
+ return;
229
+ }
230
+ super(configuration);
231
+ __runInitializers(this, _foundation_extraInitializers);
232
+ this.logo = configuration.logo;
233
+ this.email = configuration.email;
234
+ this.foundation = configuration.foundation;
235
+ }
236
+ };
237
+ })();
238
+ //#endregion
239
+ //#region Metadata injector
240
+ export class MetadataInjector {
241
+ static #lock = true;
242
+ static #instance = null;
243
+ constructor() {
244
+ if (MetadataInjector.#lock)
245
+ throw new TypeError("Illegal constructor");
246
+ }
247
+ #compose(configuration) {
248
+ switch (configuration.type) {
249
+ case "Person": return new PersonMetadata(configuration);
250
+ case "Application": return new ApplicationMetadata(configuration);
251
+ case "Organization": return new OrganizationMetadata(configuration);
252
+ default: throw new TypeError(`Invalid '${typename(configuration)}' type for configuration`);
253
+ }
254
+ }
255
+ #embedMetadataScript(metadata) {
256
+ const scheme = Metadata.export(metadata);
257
+ const script = document.createElement("script");
258
+ script.type = "application/ld+json";
259
+ script.textContent = JSON.stringify(scheme, undefined, "\t");
260
+ const { head } = document;
261
+ const child = document.querySelector("script") ??
262
+ head.lastElementChild;
263
+ head.insertBefore(script, child);
264
+ }
265
+ #embedRelLinks(metadata) {
266
+ if (!(metadata instanceof PersonMetadata))
267
+ return;
268
+ if (metadata.associations === undefined)
269
+ return;
270
+ const { head } = document;
271
+ for (const association of metadata.associations) {
272
+ const link = document.createElement("link");
273
+ link.rel = "me";
274
+ link.href = String(association);
275
+ head.appendChild(link);
276
+ }
277
+ }
278
+ #setMetadata(name, content) {
279
+ const meta = document.querySelector(`meta[name="${name}"]`) ??
280
+ document.querySelector(`meta[property="${name}"]`) ??
281
+ document.createElement("meta");
282
+ meta.setAttribute(name.startsWith("og:") ? "property" : "name", name);
283
+ meta.setAttribute("content", content);
284
+ const { head } = document;
285
+ const child = document.querySelector("title") ??
286
+ document.querySelector("meta:last-of-type + *") ??
287
+ head.firstElementChild;
288
+ head.insertBefore(meta, child);
289
+ }
290
+ #embedMetatags(metadata) {
291
+ if (metadata.description !== undefined)
292
+ this.#setMetadata("description", metadata.description);
293
+ if (metadata instanceof PersonMetadata)
294
+ this.#setMetadata("author", metadata.name);
295
+ this.#setMetadata("generator", "MetadataInjector/1.0.0");
296
+ if (metadata instanceof ApplicationMetadata)
297
+ this.#setMetadata("application-name", metadata.name);
298
+ this.#setMetadata("og:title", metadata.name);
299
+ if (metadata.description !== undefined)
300
+ this.#setMetadata("og:description", metadata.description);
301
+ this.#setMetadata("og:url", String(metadata.webpage));
302
+ if (metadata.preview !== undefined)
303
+ this.#setMetadata("og:image", String(metadata.preview));
304
+ this.#setMetadata("og:type", metadata instanceof PersonMetadata ? "profile" : "website");
305
+ const keywords = [];
306
+ if (metadata.keywords !== undefined)
307
+ keywords.push(...metadata.keywords);
308
+ if (metadata instanceof PersonMetadata && metadata.knowledge !== undefined)
309
+ keywords.push(...metadata.knowledge);
310
+ if (keywords.length > 0)
311
+ this.#setMetadata("keywords", Array.from(new Set(keywords)).join(","));
312
+ }
313
+ #embed(configuration) {
314
+ const metadata = this.#compose(configuration);
315
+ this.#embedMetadataScript(metadata);
316
+ this.#embedRelLinks(metadata);
317
+ this.#embedMetatags(metadata);
318
+ }
319
+ static inject(configuration) {
320
+ if (MetadataInjector.#instance !== null)
321
+ return;
322
+ MetadataInjector.#lock = false;
323
+ const instance = MetadataInjector.#instance = new MetadataInjector();
324
+ MetadataInjector.#lock = true;
325
+ instance.#embed(configuration);
326
+ }
327
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metadata-injector.js","sourceRoot":"","sources":["../../src/web/metadata-injector.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEb,OAAO,uBAAuB,CAAC;AAE/B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAA4B,gBAAgB,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;IAqD3H,QAAQ;4BAJtB,gBAAgB,CAAC,OAAO,CAAC,EACzB,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,cAAc,CAAC,EAAE,QAAQ,CAAC,EACnD,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,mBAAmB,CAAC,EAAE,qBAAqB,CAAC,EACrE,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,oBAAoB,CAAC,EAAE,cAAc,CAAC;;;;sBAChC,KAAK;;;;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C,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACjG,CAAC;IAED,MAAM,CAAC,aAAiH;QACvH,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;QAC9C,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;QACpC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;QAC9B,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC/B,CAAC;IAKD,MAAM,CAAC,MAAM,CAAC,aAAiH;QAC9H,IAAI,gBAAgB,CAAC,SAAS,KAAK,IAAI;YAAE,OAAO;QAChD,gBAAgB,CAAC,KAAK,GAAG,KAAK,CAAC;QAC/B,MAAM,QAAQ,GAAG,gBAAgB,CAAC,SAAS,GAAG,IAAI,gBAAgB,EAAE,CAAC;QACrE,gBAAgB,CAAC,KAAK,GAAG,IAAI,CAAC;QAC9B,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAChC,CAAC"}
@@ -51,4 +51,3 @@ DocumentFragment.prototype.getElements = function (type, selectors) {
51
51
  DocumentFragment.prototype.getElementsAsync = async function (type, selectors) {
52
52
  return getElements(this, type, selectors);
53
53
  };
54
- //# sourceMappingURL=parent-node.js.map
@@ -21,4 +21,3 @@ Promise.withSignal = async function (callback) {
21
21
  controller.abort();
22
22
  }
23
23
  };
24
- //# sourceMappingURL=promise.js.map
@@ -0,0 +1 @@
1
+ import "../core/global.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ import "../core/global.js";
3
+ //#region URL
4
+ Object.defineProperty(URL, "import", {
5
+ value: function (source, name) {
6
+ if (typeof source !== "string")
7
+ throw new TypeError(`Unable to import URL from ${name} due its ${typename(source)} type`);
8
+ return new URL(source);
9
+ },
10
+ writable: false,
11
+ });
12
+ Object.defineProperty(URL, "export", {
13
+ value: function (source) {
14
+ return source.toString();
15
+ },
16
+ writable: false,
17
+ });
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.js","sourceRoot":"","sources":["../../src/web/url.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,mBAAmB,CAAC;AAE3B,aAAa;AACb,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,QAAQ,EAAE;IACpC,KAAK,EAAE,UAAU,MAAW,EAAE,IAAY;QACzC,IAAI,OAAO,MAAM,KAAK,QAAQ;YAAE,MAAM,IAAI,SAAS,CAAC,6BAA6B,IAAI,YAAY,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC1H,OAAO,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;IACxB,CAAC;IACD,QAAQ,EAAE,KAAK;CACf,CAAC,CAAC;AAEH,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,QAAQ,EAAE;IACpC,KAAK,EAAE,UAAU,MAAW;QAC3B,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC;IACD,QAAQ,EAAE,KAAK;CACf,CAAC,CAAC"}
@@ -141,4 +141,3 @@ export class StaticEngine extends WebWorkersEngine {
141
141
  setTimeout(this.#callback);
142
142
  };
143
143
  }
144
- //# sourceMappingURL=engine.js.map
@@ -2,4 +2,3 @@
2
2
  export * from "../core/index.js";
3
3
  export * from "./promise.js";
4
4
  export * from "./engine.js";
5
- //# sourceMappingURL=index.js.map
@@ -21,4 +21,3 @@ Promise.withSignal = async function (callback) {
21
21
  controller.abort();
22
22
  }
23
23
  };
24
- //# sourceMappingURL=promise.js.map
package/package.json CHANGED
@@ -1,24 +1,16 @@
1
1
  {
2
2
  "name": "adaptive-extender",
3
- "version": "0.10.1",
3
+ "version": "0.10.4",
4
4
  "description": "Adaptive library for JS/TS development environments",
5
5
  "type": "module",
6
6
  "main": "./dist/core/index.js",
7
7
  "types": "./dist/core/index.d.ts",
8
8
  "typesVersions": {
9
9
  "*": {
10
- "core": [
11
- "dist/core/index.d.ts"
12
- ],
13
- "node": [
14
- "dist/node/index.d.ts"
15
- ],
16
- "web": [
17
- "dist/web/index.d.ts"
18
- ],
19
- "worker": [
20
- "dist/worker/index.d.ts"
21
- ]
10
+ "core": [ "dist/core/index.d.ts" ],
11
+ "node": [ "dist/node/index.d.ts" ],
12
+ "web": [ "dist/web/index.d.ts" ],
13
+ "worker": [ "dist/worker/index.d.ts" ]
22
14
  }
23
15
  },
24
16
  "exports": {
@@ -52,14 +44,7 @@
52
44
  "type": "git",
53
45
  "url": "git+https://github.com/eccs0103/adaptive-extender.git"
54
46
  },
55
- "keywords": [
56
- "javascript",
57
- "typescript",
58
- "extensions",
59
- "core",
60
- "dom",
61
- "node"
62
- ],
47
+ "keywords": [ "javascript", "typescript", "extensions", "core", "dom", "node" ],
63
48
  "author": "eccs0103",
64
49
  "license": "Apache-2.0",
65
50
  "bugs": {
@@ -76,12 +61,10 @@
76
61
  "coverage": "vitest run --coverage"
77
62
  },
78
63
  "devDependencies": {
79
- "@babel/plugin-proposal-decorators": "^7.29.7",
80
- "@rolldown/plugin-babel": "^0.2.3",
81
64
  "@types/jsdom": "^21.1.7",
82
65
  "esbuild": "^0.28.0",
83
66
  "jsdom": "^27.0.0",
84
- "typescript": "^6.0.3",
85
- "vitest": "^4.1.8"
67
+ "typescript": "^5.9.3",
68
+ "vitest": "^4.0.10"
86
69
  }
87
70
  }
@@ -0,0 +1,27 @@
1
+ {
2
+ "compilerOptions": {
3
+ /* Language & Environment */
4
+ "target": "ES2022",
5
+ "module": "ESNext",
6
+ "useDefineForClassFields": true,
7
+
8
+ /* Module Resolution / Bundler */
9
+ "moduleResolution": "bundler",
10
+ "moduleDetection": "force",
11
+ "verbatimModuleSyntax": true,
12
+
13
+ /* Interop & Compatibility */
14
+ "esModuleInterop": true,
15
+ "allowJs": true,
16
+ "skipLibCheck": false,
17
+
18
+ /* Type Checking & Linting */
19
+ "strict": true,
20
+ "strictPropertyInitialization": false,
21
+ "noUnusedLocals": false,
22
+ "noUnusedParameters": false,
23
+
24
+ /* Miscellaneous */
25
+ "forceConsistentCasingInFileNames": true,
26
+ }
27
+ }