marko 5.22.6 → 5.22.7

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.
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * @template T
3
3
  * @typedef {{
4
- * value?: readonly [T];
5
- * then?: { renderBody: Marko.Body<[Awaited<T>], void> };
6
- * catch?: { renderBody: Marko.Body<[unknown], void> };
7
- * placeholder?: { renderBody: Marko.Body<[], void> };
4
+ * value: readonly [T];
5
+ * then?: { renderBody: Marko.Body<[Awaited<T>]> };
6
+ * catch?: { renderBody: Marko.Body<[unknown]> };
7
+ * placeholder?: { renderBody: Marko.Body };
8
8
  * "client-reorder"?: boolean;
9
9
  * name?: string;
10
10
  * timeout?: number;
package/index.d.ts CHANGED
@@ -11,7 +11,14 @@ declare namespace NodeJS {
11
11
  declare namespace Marko {
12
12
  /** A mutable global object for the current render. */
13
13
  export interface Global {
14
+ /** A list of globals that should be serialized to the browser. */
14
15
  serializedGlobals?: Record<string, boolean>;
16
+ /** A CSP Nonce to add to each script output from Marko. */
17
+ cspNonce?: string;
18
+ /** Used to uniquely identify a instance of a Marko runtime. */
19
+ runtimeId?: string;
20
+ /** Used for rendering multiple Marko templates in a single hydrated page. */
21
+ componentIdPrefix?: string;
15
22
  [attr: PropertyKey]: unknown;
16
23
  }
17
24
 
@@ -211,7 +218,10 @@ declare namespace Marko {
211
218
  }
212
219
 
213
220
  /** The top level api for a Marko Template. */
214
- export abstract class Template {
221
+ export abstract class Template<
222
+ Input = { [attr: PropertyKey]: any },
223
+ Return = unknown
224
+ > {
215
225
  /** Creates a Marko compatible output stream. */
216
226
  createOut(): Out;
217
227
 
@@ -228,7 +238,7 @@ declare namespace Marko {
228
238
  /** @marko-overload-start */
229
239
  /** Asynchronously render the template. */
230
240
  abstract render(
231
- input: Marko.TemplateInput,
241
+ input: Marko.TemplateInput<Input>,
232
242
  stream?: {
233
243
  write: (chunk: string) => void;
234
244
  end: (chunk?: string) => void;
@@ -237,15 +247,15 @@ declare namespace Marko {
237
247
 
238
248
  /** Synchronously render the template. */
239
249
  abstract renderSync(
240
- input: Marko.TemplateInput
250
+ input: Marko.TemplateInput<Input>
241
251
  ): Marko.RenderResult<Marko.Component>;
242
252
 
243
253
  /** Synchronously render a template to a string. */
244
- abstract renderToString(input: Marko.TemplateInput): string;
254
+ abstract renderToString(input: Marko.TemplateInput<Input>): string;
245
255
 
246
256
  /** Render a template and return a stream.Readable in nodejs or a ReadableStream in a web worker environment. */
247
257
  abstract stream(
248
- input: Marko.TemplateInput
258
+ input: Marko.TemplateInput<Input>
249
259
  ): ReadableStream<string> & NodeJS.ReadableStream;
250
260
  /** @marko-overload-end */
251
261
  }
@@ -303,7 +313,6 @@ declare namespace Marko {
303
313
 
304
314
  export type Repeated<T> = [T, T, ...T[]];
305
315
  export type Repeatable<T> = T | Repeated<T>;
306
- export type MaybeRepeatable<T> = undefined | Repeatable<T>;
307
316
 
308
317
  export interface NativeTags {
309
318
  [name: string]: {
@@ -311,4 +320,9 @@ declare namespace Marko {
311
320
  return: unknown;
312
321
  };
313
322
  }
323
+
324
+ export type NativeTagInput<Name extends keyof NativeTags> =
325
+ NativeTags[Name]["input"];
326
+ export type NativeTagReturn<Name extends keyof NativeTags> =
327
+ NativeTags[Name]["return"];
314
328
  }
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "5.22.6",
3
+ "version": "5.22.7",
4
4
  "license": "MIT",
5
5
  "description": "UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.",
6
6
  "dependencies": {
7
- "@marko/compiler": "^5.23.5",
8
- "@marko/translator-default": "^5.22.5",
7
+ "@marko/compiler": "^5.23.6",
8
+ "@marko/translator-default": "^5.22.6",
9
9
  "app-module-path": "^2.2.0",
10
10
  "argly": "^1.2.0",
11
11
  "browser-refresh-client": "1.1.4",
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * @template T
3
3
  * @typedef {{
4
- * value?: readonly [T];
5
- * then?: { renderBody: Marko.Body<[Awaited<T>], void> };
6
- * catch?: { renderBody: Marko.Body<[unknown], void> };
7
- * placeholder?: { renderBody: Marko.Body<[], void> };
4
+ * value: readonly [T];
5
+ * then?: { renderBody: Marko.Body<[Awaited<T>]> };
6
+ * catch?: { renderBody: Marko.Body<[unknown]> };
7
+ * placeholder?: { renderBody: Marko.Body };
8
8
  * "client-reorder"?: boolean;
9
9
  * name?: string;
10
10
  * timeout?: number;