@static-pages/core 3.0.0 → 3.0.1
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/README.md +3 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -66,25 +66,20 @@ staticPages([{
|
|
|
66
66
|
}]).catch(console.error);
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
-
##
|
|
69
|
+
## `staticPages(options: Options)`
|
|
70
70
|
The `staticPages()` function expects one parameter which must be an array.
|
|
71
71
|
Each item should contain `from`, `to` and optionally a `controller` property matching the definition below.
|
|
72
72
|
|
|
73
73
|
```ts
|
|
74
|
+
type Data = Record<string, unknown>;
|
|
74
75
|
type Options = {
|
|
75
76
|
from: Iterable<Data> | AsyncIterable<Data>;
|
|
76
77
|
to: (data: Data) => void | Promise<void>;
|
|
77
78
|
controller?: (data: Data) => undefined | Data | Data[] | Promise<undefined | Data | Data[]>;
|
|
78
|
-
variables?: Record<string, unknown>;
|
|
79
79
|
}[];
|
|
80
|
-
|
|
81
|
-
// Where `Data` is:
|
|
82
|
-
type Data = Record<string, unknown>;
|
|
83
|
-
// Or the same definition in a more known form:
|
|
84
|
-
type Data = { [k: string]: unknown };
|
|
85
80
|
```
|
|
86
81
|
|
|
87
|
-
>
|
|
82
|
+
> Additionally, when `Options` is not passed as an array, it is wrapped into an array.
|
|
88
83
|
|
|
89
84
|
## Missing a feature?
|
|
90
85
|
Create an issue describing your needs. If it fits the scope of the project I will implement it or you can implement it your own and submit a pull request.
|