@siteimprove/alfa-lazy 0.89.5

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/CHANGELOG.md ADDED
@@ -0,0 +1,157 @@
1
+ # @siteimprove/alfa-lazy
2
+
3
+ ## 0.89.3
4
+
5
+ ## 0.89.2
6
+
7
+ ### Patch Changes
8
+
9
+ - **Changed:** Trying to fix a problem in generating provenance statements ([#1674](https://github.com/Siteimprove/alfa/pull/1674))
10
+
11
+ ## 0.89.1
12
+
13
+ ### Patch Changes
14
+
15
+ - **Added:** Trying to publish Alfa packages on the npm registry ([#1673](https://github.com/Siteimprove/alfa/pull/1673))
16
+
17
+ ## 0.89.0
18
+
19
+ ## 0.88.0
20
+
21
+ ### Minor Changes
22
+
23
+ - **Fixed:** The publish flow was updated to a new version. ([`a2f19cf9a6c7c72b8bf085597e4f1a95ac3e4eb2`](https://github.com/Siteimprove/alfa/commit/a2f19cf9a6c7c72b8bf085597e4f1a95ac3e4eb2))
24
+
25
+ Some 0.87.\* versions were generating uninstallable package. This should be fixed now.
26
+
27
+ ## 0.87.12
28
+
29
+ ## 0.87.11
30
+
31
+ ## 0.87.10
32
+
33
+ ## 0.87.7
34
+
35
+ ## 0.87.6
36
+
37
+ ## 0.87.5
38
+
39
+ ## 0.87.4
40
+
41
+ ## 0.87.3
42
+
43
+ ## 0.87.2
44
+
45
+ ## 0.87.1
46
+
47
+ ## 0.87.0
48
+
49
+ ### Minor Changes
50
+
51
+ - **Breaking:** Optional serialization type parameters have been removed. ([#1651](https://github.com/Siteimprove/alfa/pull/1651))
52
+
53
+ ## 0.86.2
54
+
55
+ ## 0.86.1
56
+
57
+ ## 0.86.0
58
+
59
+ ### Minor Changes
60
+
61
+ - **Breaking:** TS resolution has been changed to `Node16`, target to `es2022`. ([#1636](https://github.com/Siteimprove/alfa/pull/1636))
62
+
63
+ - **Breaking:** Alfa is now distributed as ESM rather than CJS modules; projects using it must be ESM or use dynamic `import()`. ([#1636](https://github.com/Siteimprove/alfa/pull/1636))
64
+
65
+ ⚠️ This is the last of a series of changes on the internal structure and build process of distributed packages that was started with v0.85.0.
66
+
67
+ ## 0.85.1
68
+
69
+ ## 0.85.0
70
+
71
+ ### Minor Changes
72
+
73
+ - **Breaking:** The .js files are now built in the `dist` folder rather than in `src`. ([#1628](https://github.com/Siteimprove/alfa/pull/1628))
74
+
75
+ ⚠️ This is the first of a series of changes on the internal structure and build process of distributed packages. It is probably better to not use this version and wait until more of these internal changes have been done to jump directly to the final result. We are internally releasing these changes for validation purpose only.
76
+
77
+ This should not impact consumers, the `package.json` files should be set correctly to consume these files.
78
+
79
+ ## 0.84.0
80
+
81
+ ## 0.83.1
82
+
83
+ ## 0.83.0
84
+
85
+ ## 0.82.0
86
+
87
+ ### Minor Changes
88
+
89
+ - **Added:** Serialization options are now accepted, and passed on, by `toJSON()` on these types. ([#1622](https://github.com/Siteimprove/alfa/pull/1622))
90
+
91
+ - **Breaking:** Node 18 is no longer supported. ([#1618](https://github.com/Siteimprove/alfa/pull/1618))
92
+
93
+ ## 0.81.0
94
+
95
+ ### Patch Changes
96
+
97
+ - **Added:** Each package now contains its internal dependency graph in its `docs` directory. ([#1610](https://github.com/Siteimprove/alfa/pull/1610))
98
+
99
+ ## 0.80.0
100
+
101
+ ## 0.79.1
102
+
103
+ ## 0.79.0
104
+
105
+ ## 0.78.2
106
+
107
+ ## 0.78.1
108
+
109
+ ## 0.78.0
110
+
111
+ ## 0.77.0
112
+
113
+ ## 0.76.0
114
+
115
+ ## 0.75.2
116
+
117
+ ## 0.75.1
118
+
119
+ ## 0.75.0
120
+
121
+ ## 0.74.0
122
+
123
+ ## 0.73.0
124
+
125
+ ## 0.72.0
126
+
127
+ ## 0.71.1
128
+
129
+ ## 0.71.0
130
+
131
+ ## 0.70.0
132
+
133
+ ## 0.69.0
134
+
135
+ ## 0.68.0
136
+
137
+ ## 0.67.0
138
+
139
+ ## 0.66.0
140
+
141
+ ## 0.65.1
142
+
143
+ ## 0.65.0
144
+
145
+ ## 0.64.0
146
+
147
+ ## 0.63.3
148
+
149
+ ## 0.63.2
150
+
151
+ ## 0.63.1
152
+
153
+ ## 0.63.0
154
+
155
+ ## 0.62.2
156
+
157
+ ## 0.62.1
@@ -0,0 +1,2 @@
1
+ export * from "./lazy.js";
2
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./lazy.js";
2
+ //# sourceMappingURL=index.js.map
package/dist/lazy.d.ts ADDED
@@ -0,0 +1,35 @@
1
+ import type { Applicative } from "@siteimprove/alfa-applicative";
2
+ import { Equatable } from "@siteimprove/alfa-equatable";
3
+ import type { Functor } from "@siteimprove/alfa-functor";
4
+ import { Serializable } from "@siteimprove/alfa-json";
5
+ import type { Mapper } from "@siteimprove/alfa-mapper";
6
+ import type { Monad } from "@siteimprove/alfa-monad";
7
+ import type { Thunk } from "@siteimprove/alfa-thunk";
8
+ /**
9
+ * @public
10
+ */
11
+ export declare class Lazy<T> implements Functor<T>, Applicative<T>, Monad<T>, Iterable<T>, Equatable, Serializable<Lazy.JSON<T>> {
12
+ static of<T>(thunk: Thunk<T>): Lazy<T>;
13
+ static force<T>(value: T): Lazy<T>;
14
+ private _value;
15
+ private constructor();
16
+ force(): T;
17
+ map<U>(mapper: Mapper<T, U>): Lazy<U>;
18
+ apply<U>(mapper: Lazy<Mapper<T, U>>): Lazy<U>;
19
+ flatMap<U>(mapper: Mapper<T, Lazy<U>>): Lazy<U>;
20
+ flatten<T>(this: Lazy<Lazy<T>>): Lazy<T>;
21
+ equals<T>(value: Lazy<T>): boolean;
22
+ equals(value: unknown): value is this;
23
+ iterator(): Iterator<T>;
24
+ [Symbol.iterator](): Iterator<T>;
25
+ toThunk(): Thunk<T>;
26
+ toJSON(options?: Serializable.Options): Lazy.JSON<T>;
27
+ toString(): string;
28
+ }
29
+ /**
30
+ * @public
31
+ */
32
+ export declare namespace Lazy {
33
+ type JSON<T> = Serializable.ToJSON<T>;
34
+ }
35
+ //# sourceMappingURL=lazy.d.ts.map
package/dist/lazy.js ADDED
@@ -0,0 +1,65 @@
1
+ import { Equatable } from "@siteimprove/alfa-equatable";
2
+ import { Serializable } from "@siteimprove/alfa-json";
3
+ import { Trampoline } from "@siteimprove/alfa-trampoline";
4
+ /**
5
+ * @public
6
+ */
7
+ export class Lazy {
8
+ static of(thunk) {
9
+ return new Lazy(Trampoline.delay(thunk));
10
+ }
11
+ static force(value) {
12
+ return new Lazy(Trampoline.done(value));
13
+ }
14
+ _value;
15
+ constructor(value) {
16
+ this._value = value;
17
+ }
18
+ force() {
19
+ if (this._value.isSuspended()) {
20
+ this._value = Trampoline.done(this._value.run());
21
+ }
22
+ return this._value.run();
23
+ }
24
+ map(mapper) {
25
+ return new Lazy(this._value.flatMap((value) => {
26
+ if (this._value.isSuspended()) {
27
+ this._value = Trampoline.done(value);
28
+ }
29
+ return Trampoline.done(mapper(value));
30
+ }));
31
+ }
32
+ apply(mapper) {
33
+ return mapper.map((mapper) => mapper(this.force()));
34
+ }
35
+ flatMap(mapper) {
36
+ return new Lazy(this._value.flatMap((value) => {
37
+ if (this._value.isSuspended()) {
38
+ this._value = Trampoline.done(value);
39
+ }
40
+ return mapper(value)._value;
41
+ }));
42
+ }
43
+ flatten() {
44
+ return this.flatMap((lazy) => lazy);
45
+ }
46
+ equals(value) {
47
+ return (value instanceof Lazy && Equatable.equals(value.force(), this.force()));
48
+ }
49
+ *iterator() {
50
+ yield this.force();
51
+ }
52
+ [Symbol.iterator]() {
53
+ return this.iterator();
54
+ }
55
+ toThunk() {
56
+ return () => this.force();
57
+ }
58
+ toJSON(options) {
59
+ return Serializable.toJSON(this.force(), options);
60
+ }
61
+ toString() {
62
+ return `Lazy { ${this.force()} }`;
63
+ }
64
+ }
65
+ //# sourceMappingURL=lazy.js.map
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "$schema": "http://json.schemastore.org/package",
3
+ "name": "@siteimprove/alfa-lazy",
4
+ "homepage": "https://alfa.siteimprove.com",
5
+ "version": "0.89.5",
6
+ "license": "MIT",
7
+ "description": "An implementation of lazy values, which are values whose initialization can be delayed until needed",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "github:Siteimprove/alfa",
11
+ "directory": "packages/alfa-lazy"
12
+ },
13
+ "bugs": "https://github.com/siteimprove/alfa/issues",
14
+ "engines": {
15
+ "node": ">=20.0.0"
16
+ },
17
+ "type": "module",
18
+ "main": "dist/index.js",
19
+ "types": "dist/index.d.ts",
20
+ "files": [
21
+ "dist/**/*.js",
22
+ "dist/**/*.d.ts"
23
+ ],
24
+ "dependencies": {
25
+ "@siteimprove/alfa-applicative": "^0.89.5",
26
+ "@siteimprove/alfa-equatable": "^0.89.5",
27
+ "@siteimprove/alfa-functor": "^0.89.5",
28
+ "@siteimprove/alfa-json": "^0.89.5",
29
+ "@siteimprove/alfa-mapper": "^0.89.5",
30
+ "@siteimprove/alfa-monad": "^0.89.5",
31
+ "@siteimprove/alfa-thunk": "^0.89.5",
32
+ "@siteimprove/alfa-trampoline": "^0.89.5"
33
+ },
34
+ "devDependencies": {
35
+ "@siteimprove/alfa-test": "^0.89.5"
36
+ },
37
+ "publishConfig": {
38
+ "access": "public",
39
+ "registry": "https://npm.pkg.github.com/"
40
+ }
41
+ }