@amazon/vinyl-util 3.0.1 → 3.1.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.
Files changed (55) hide show
  1. package/dist/browserTestUtil/index.js.map +2 -2
  2. package/dist/browserTestUtil/types/current/mock/dom/lib.dom.d.ts.map +1 -1
  3. package/dist/browserTestUtil/types/current/tsconfig.tsbuildinfo +1 -1
  4. package/dist/index.cjs +165 -178
  5. package/dist/index.cjs.map +4 -4
  6. package/dist/index.js +165 -178
  7. package/dist/index.js.map +4 -4
  8. package/dist/polyfill/index.js +35 -32
  9. package/dist/polyfill/index.js.map +3 -3
  10. package/dist/polyfill/tsconfig.tsbuildinfo +1 -1
  11. package/dist/test/benchmark.js.map +2 -2
  12. package/dist/testUtil/index.js +0 -36
  13. package/dist/testUtil/index.js.map +3 -3
  14. package/dist/testUtil/types/current/index.d.ts +0 -1
  15. package/dist/testUtil/types/current/index.d.ts.map +1 -1
  16. package/dist/testUtil/types/current/index.js +0 -1
  17. package/dist/testUtil/types/current/tsconfig.tsbuildinfo +1 -1
  18. package/dist/testUtil/types/ts3.7/index.d.ts +0 -1
  19. package/dist/testUtil/types/ts4.1/index.d.ts +0 -1
  20. package/dist/testUtil/types/ts4.7/index.d.ts +0 -1
  21. package/dist/types/current/index.d.ts +1 -1
  22. package/dist/types/current/index.d.ts.map +1 -1
  23. package/dist/types/current/index.js +1 -1
  24. package/dist/types/current/network/responseUtil.d.ts +21 -0
  25. package/dist/types/current/network/responseUtil.d.ts.map +1 -1
  26. package/dist/types/current/network/responseUtil.js +30 -0
  27. package/dist/types/current/tsconfig.tsbuildinfo +1 -1
  28. package/dist/types/current/util/async/never.d.ts.map +1 -1
  29. package/dist/types/current/util/type.d.ts.map +1 -1
  30. package/dist/types/current/util/webm/parseWebm.d.ts +43 -0
  31. package/dist/types/current/util/webm/parseWebm.d.ts.map +1 -0
  32. package/dist/types/current/util/webm/parseWebm.js +166 -0
  33. package/dist/types/ts3.7/index.d.ts +1 -1
  34. package/dist/types/ts3.7/network/responseUtil.d.ts +21 -0
  35. package/dist/types/ts3.7/util/webm/parseWebm.d.ts +43 -0
  36. package/dist/types/ts4.1/index.d.ts +1 -1
  37. package/dist/types/ts4.1/network/responseUtil.d.ts +21 -0
  38. package/dist/types/ts4.1/util/webm/parseWebm.d.ts +43 -0
  39. package/dist/types/ts4.7/index.d.ts +1 -1
  40. package/dist/types/ts4.7/network/responseUtil.d.ts +21 -0
  41. package/dist/types/ts4.7/util/webm/parseWebm.d.ts +43 -0
  42. package/dist/unit/types/current/tsconfig.tsbuildinfo +1 -1
  43. package/package.json +4 -4
  44. package/dist/testUtil/types/current/patch/addPatchTests.d.ts +0 -35
  45. package/dist/testUtil/types/current/patch/addPatchTests.d.ts.map +0 -1
  46. package/dist/testUtil/types/current/patch/addPatchTests.js +0 -54
  47. package/dist/testUtil/types/ts3.7/patch/addPatchTests.d.ts +0 -35
  48. package/dist/testUtil/types/ts4.1/patch/addPatchTests.d.ts +0 -35
  49. package/dist/testUtil/types/ts4.7/patch/addPatchTests.d.ts +0 -35
  50. package/dist/types/current/patch/patchTarget.d.ts +0 -114
  51. package/dist/types/current/patch/patchTarget.d.ts.map +0 -1
  52. package/dist/types/current/patch/patchTarget.js +0 -219
  53. package/dist/types/ts3.7/patch/patchTarget.d.ts +0 -114
  54. package/dist/types/ts4.1/patch/patchTarget.d.ts +0 -114
  55. package/dist/types/ts4.7/patch/patchTarget.d.ts +0 -114
@@ -1,114 +0,0 @@
1
- import type { Disposable } from '../core/disposable';
2
- import type { Unsubscribe } from '../core/Unsubscribe';
3
- import type { Signal } from '../event/Signal';
4
- import type { AnyRecord } from '../util/type';
5
- import type { LogTarget } from '../logging/LogTarget';
6
- export interface Patch<T, EventMap = AnyRecord> extends Disposable {
7
- /**
8
- * A signal that emits synthetic events.
9
- * These events will be dispatched on the proxy, not on the original event target.
10
- * If undefined, no events are fabricated.
11
- */
12
- readonly eventFabricated?: Signal<Event>;
13
- /**
14
- * Overridden properties.
15
- */
16
- readonly properties?: PropertyPatches<T>;
17
- /**
18
- * Overridden events.
19
- * Event patches may provide an alternate event to emit, or null to prevent an event from
20
- * dispatching on the proxy.
21
- *
22
- * Note:
23
- * Patched events have divergent behavior when using Event.stopImmediatePropagation.
24
- * All handlers added to the patched Proxy will still be called after stopImmediatePropagation.
25
- * It is the author's opinion that using stopImmediatePropagation is an anti-pattern, and one
26
- * handler should not be allowed to influence the behavior of neighboring handlers.
27
- */
28
- readonly events?: EventPatches<EventMap>;
29
- }
30
- /**
31
- * A record of property key to property patch.
32
- */
33
- export type PropertyPatches<T> = {
34
- readonly [P in keyof T]?: PropertyPatch<T, P>;
35
- };
36
- /**
37
- * An override to a patched property.
38
- */
39
- export interface PropertyPatch<T, K extends keyof T> {
40
- /**
41
- * @return Returns the value to return on the proxy.
42
- */
43
- get?(): T[K];
44
- /**
45
- * @param newValue The property value attempting to be set.
46
- */
47
- set?(newValue: T[K]): void;
48
- }
49
- /**
50
- * Handles an event emitted from the event target. The returned event will be emitted in its
51
- * place on the proxy.
52
- *
53
- * Fabricated events from `eventFabricated` will not be passed to this handler and cannot be
54
- * squelched.
55
- *
56
- * @param event The original event from the event target. This should not be modified
57
- * directly, but may be cloned and a modified clone may be returned.
58
- *
59
- * @return Returns the event to emit on the proxy or null to squelch the event.
60
- */
61
- export type EventPatch<T> = (event: T) => T | null;
62
- /**
63
- * A record of event type to an event patch.
64
- */
65
- export type EventPatches<EventMap> = {
66
- readonly [P in keyof EventMap]?: EventPatch<EventMap[P]>;
67
- };
68
- export type PatchFactory<T, EventMap> = (target: T) => Patch<T, EventMap>;
69
- export interface PatchedRef<T> extends Disposable {
70
- /**
71
- * The patched target.
72
- */
73
- readonly patched: T;
74
- /**
75
- * A signal for when a synthetic event was fabricated.
76
- */
77
- eventFabricated: Signal<Event>;
78
- /**
79
- * A signal for when an event was squelched.
80
- */
81
- eventSquelched: Signal<Event>;
82
- }
83
- /**
84
- * Creates a Proxy for patched event and properties on the target. All patches from the provided
85
- * factory list will be used in creating a proxy chain. Each patch is applied in order, and
86
- * patches can rely on their target having been patched with all previous patches.
87
- *
88
- * @param target
89
- * @param patchFactories A list of factories that each produce a new patch for the target.
90
- * @return Returns a disposable object with a Proxy reference with overridden event and property
91
- * behavior. When disposed, the event listeners are removed.
92
- */
93
- export declare function patchTarget<T extends object, EventMap = AnyRecord>(target: T, ...patchFactories: PatchFactory<T, EventMap>[]): PatchedRef<T>;
94
- /**
95
- * Logs debug messages when an event was squelched or fabricated.
96
- *
97
- * @param pathTarget
98
- * @param patched
99
- * @return Returns a function that when invoked, removes the logging.
100
- */
101
- export declare function logPatchedEvents(pathTarget: LogTarget, patched: PatchedRef<any>): Unsubscribe;
102
- /**
103
- * A tuple of `[flag, factory]`.
104
- * Patches will be applied when flag is true.
105
- */
106
- export type FlagAndPatchEntry<T extends object, EventMap, Key> = readonly [
107
- flagKey: Key,
108
- factory: PatchFactory<T, EventMap>
109
- ];
110
- /**
111
- * Given a list of [flagKey, patchFactory] tuples, patches the target with patches where flag is true.
112
- */
113
- export declare function patchTargetFromFlags<T extends object, EventMap, Flags>(target: T, flags: Flags, ...patchEntries: readonly FlagAndPatchEntry<T, EventMap, keyof Flags>[]): PatchedRef<T>;
114
- //# sourceMappingURL=patchTarget.d.ts.map
@@ -1,114 +0,0 @@
1
- import { type Disposable } from '../core/disposable';
2
- import type { Unsubscribe } from '../core/Unsubscribe';
3
- import { type Signal } from '../event/Signal';
4
- import type { AnyRecord } from '../util/type';
5
- import { type LogTarget } from '../logging/LogTarget';
6
- export interface Patch<in T, in EventMap = AnyRecord> extends Disposable {
7
- /**
8
- * A signal that emits synthetic events.
9
- * These events will be dispatched on the proxy, not on the original event target.
10
- * If undefined, no events are fabricated.
11
- */
12
- readonly eventFabricated?: Signal<Event>;
13
- /**
14
- * Overridden properties.
15
- */
16
- readonly properties?: PropertyPatches<T>;
17
- /**
18
- * Overridden events.
19
- * Event patches may provide an alternate event to emit, or null to prevent an event from
20
- * dispatching on the proxy.
21
- *
22
- * Note:
23
- * Patched events have divergent behavior when using Event.stopImmediatePropagation.
24
- * All handlers added to the patched Proxy will still be called after stopImmediatePropagation.
25
- * It is the author's opinion that using stopImmediatePropagation is an anti-pattern, and one
26
- * handler should not be allowed to influence the behavior of neighboring handlers.
27
- */
28
- readonly events?: EventPatches<EventMap>;
29
- }
30
- /**
31
- * A record of property key to property patch.
32
- */
33
- export type PropertyPatches<in T> = {
34
- readonly [P in keyof T]?: PropertyPatch<T, P>;
35
- };
36
- /**
37
- * An override to a patched property.
38
- */
39
- export interface PropertyPatch<T, K extends keyof T> {
40
- /**
41
- * @return Returns the value to return on the proxy.
42
- */
43
- get?(): T[K];
44
- /**
45
- * @param newValue The property value attempting to be set.
46
- */
47
- set?(newValue: T[K]): void;
48
- }
49
- /**
50
- * Handles an event emitted from the event target. The returned event will be emitted in its
51
- * place on the proxy.
52
- *
53
- * Fabricated events from `eventFabricated` will not be passed to this handler and cannot be
54
- * squelched.
55
- *
56
- * @param event The original event from the event target. This should not be modified
57
- * directly, but may be cloned and a modified clone may be returned.
58
- *
59
- * @return Returns the event to emit on the proxy or null to squelch the event.
60
- */
61
- export type EventPatch<T> = (event: T) => T | null;
62
- /**
63
- * A record of event type to an event patch.
64
- */
65
- export type EventPatches<in EventMap> = {
66
- readonly [P in keyof EventMap]?: EventPatch<EventMap[P]>;
67
- };
68
- export type PatchFactory<T, EventMap> = (target: T) => Patch<T, EventMap>;
69
- export interface PatchedRef<T> extends Disposable {
70
- /**
71
- * The patched target.
72
- */
73
- readonly patched: T;
74
- /**
75
- * A signal for when a synthetic event was fabricated.
76
- */
77
- eventFabricated: Signal<Event>;
78
- /**
79
- * A signal for when an event was squelched.
80
- */
81
- eventSquelched: Signal<Event>;
82
- }
83
- /**
84
- * Creates a Proxy for patched event and properties on the target. All patches from the provided
85
- * factory list will be used in creating a proxy chain. Each patch is applied in order, and
86
- * patches can rely on their target having been patched with all previous patches.
87
- *
88
- * @param target
89
- * @param patchFactories A list of factories that each produce a new patch for the target.
90
- * @return Returns a disposable object with a Proxy reference with overridden event and property
91
- * behavior. When disposed, the event listeners are removed.
92
- */
93
- export declare function patchTarget<T extends object, EventMap = AnyRecord>(target: T, ...patchFactories: PatchFactory<T, EventMap>[]): PatchedRef<T>;
94
- /**
95
- * Logs debug messages when an event was squelched or fabricated.
96
- *
97
- * @param pathTarget
98
- * @param patched
99
- * @return Returns a function that when invoked, removes the logging.
100
- */
101
- export declare function logPatchedEvents(pathTarget: LogTarget, patched: PatchedRef<any>): Unsubscribe;
102
- /**
103
- * A tuple of `[flag, factory]`.
104
- * Patches will be applied when flag is true.
105
- */
106
- export type FlagAndPatchEntry<T extends object, EventMap, Key> = readonly [
107
- flagKey: Key,
108
- factory: PatchFactory<T, EventMap>
109
- ];
110
- /**
111
- * Given a list of [flagKey, patchFactory] tuples, patches the target with patches where flag is true.
112
- */
113
- export declare function patchTargetFromFlags<T extends object, EventMap, Flags>(target: T, flags: Flags, ...patchEntries: readonly FlagAndPatchEntry<T, EventMap, keyof Flags>[]): PatchedRef<T>;
114
- //# sourceMappingURL=patchTarget.d.ts.map