marko 5.37.43 → 5.37.45
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/dist/core-tags/core/await/renderer.js +2 -1
- package/dist/node_modules/@internal/components-entry/index.js +2 -1
- package/dist/node_modules/@internal/components-registry/index-browser.js +1 -0
- package/dist/node_modules/@internal/components-util/index.js +4 -12
- package/dist/runtime/helpers/tags-compat/runtime-html.js +1 -1
- package/dist/runtime/html/get-render-id.js +20 -0
- package/index.d.ts +23 -13
- package/package.json +2 -2
- package/src/core-tags/core/await/renderer.js +2 -1
- package/src/node_modules/@internal/components-entry/index.js +2 -1
- package/src/node_modules/@internal/components-registry/index-browser.js +1 -0
- package/src/node_modules/@internal/components-util/index.js +3 -11
- package/src/runtime/helpers/tags-compat/runtime-html.js +1 -1
- package/src/runtime/html/get-render-id.js +20 -0
- package/tags-html.d.ts +9 -0
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
// eslint-disable-next-line no-constant-binary-expression
|
3
3
|
|
4
|
+
var getRenderId = require("../../../runtime/html/get-render-id");
|
4
5
|
var AsyncValue = require("./AsyncValue");
|
5
6
|
|
6
7
|
function safeRenderBody(renderBody, targetOut, data) {
|
@@ -124,7 +125,7 @@ module.exports = function awaitTag(input, out) {
|
|
124
125
|
|
125
126
|
var id = awaitInfo.id =
|
126
127
|
input.name ||
|
127
|
-
(out.global
|
128
|
+
(getRenderId(out.global) || 0) + clientReorderContext.nextId++;
|
128
129
|
var placeholderIdAttrValue = reorderFunctionId + "ph" + id;
|
129
130
|
|
130
131
|
if (placeholderRenderer) {
|
@@ -3,6 +3,7 @@ require("../../../runtime/html/marko-namespace");
|
|
3
3
|
|
4
4
|
var warp10 = require("warp10");
|
5
5
|
var w10ToJSON = require("../../../runtime/helpers/serialize-noop").V_;
|
6
|
+
var getRenderId = require("../../../runtime/html/get-render-id");
|
6
7
|
var safeJSONRegExp = /<\/|\u2028|\u2029/g;
|
7
8
|
var IGNORE_GLOBAL_TYPES = new Set(["undefined", "function", "symbol"]);
|
8
9
|
var DEFAULT_RUNTIME_ID = "M";
|
@@ -187,7 +188,7 @@ function getInitComponentsData(out, componentDefs) {
|
|
187
188
|
const $global = out.global;
|
188
189
|
const isLast = $global.d_;
|
189
190
|
const didSerializeComponents = $global._e_;
|
190
|
-
const prefix = $global
|
191
|
+
const prefix = getRenderId($global);
|
191
192
|
|
192
193
|
if (len === 0) {
|
193
194
|
if (isLast && didSerializeComponents) {
|
@@ -1,20 +1,12 @@
|
|
1
|
-
"use strict";var
|
1
|
+
"use strict";var getRenderId = require("../../../runtime/html/get-render-id");
|
2
|
+
|
3
|
+
var FLAG_WILL_RERENDER_IN_BROWSER = 1;
|
2
4
|
// var FLAG_HAS_RENDER_BODY = 2;
|
3
5
|
|
4
6
|
function nextComponentIdProvider(out) {
|
5
|
-
var prefix = out.global
|
7
|
+
var prefix = getRenderId(out.global) || "s"; // "s" is for server (we use "b" for the browser)
|
6
8
|
var nextId = 0;
|
7
9
|
|
8
|
-
// eslint-disable-next-line no-constant-condition
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
10
|
return function nextComponentId() {
|
19
11
|
return prefix + nextId++;
|
20
12
|
};
|
@@ -0,0 +1,20 @@
|
|
1
|
+
"use strict";module.exports = function getRenderId($global) {
|
2
|
+
if (!("renderId" in $global)) {
|
3
|
+
$global.renderId =
|
4
|
+
$global.componentIdPrefix || $global.widgetIdPrefix || "s";
|
5
|
+
|
6
|
+
// eslint-disable-next-line no-constant-condition
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
}
|
16
|
+
|
17
|
+
if ($global.renderId !== "s") {
|
18
|
+
return $global.renderId;
|
19
|
+
}
|
20
|
+
};
|
package/index.d.ts
CHANGED
@@ -13,15 +13,21 @@ declare global {
|
|
13
13
|
namespace Marko {
|
14
14
|
/** A mutable global object for the current render. */
|
15
15
|
export interface Global {
|
16
|
-
|
17
|
-
|
16
|
+
[x: PropertyKey]: unknown;
|
17
|
+
/** An AbortSignal instance that, when aborted, stops further streamed content. */
|
18
|
+
signal?: AbortSignal;
|
18
19
|
/** A CSP Nonce to add to each script output from Marko. */
|
19
20
|
cspNonce?: string;
|
21
|
+
/** Used for rendering multiple Marko templates in a single hydrated page. */
|
22
|
+
renderId?: string;
|
20
23
|
/** Used to uniquely identify a instance of a Marko runtime. */
|
21
24
|
runtimeId?: string;
|
22
|
-
/**
|
25
|
+
/** A list of globals that should be serialized to the browser. */
|
26
|
+
serializedGlobals?: Record<string, boolean>;
|
27
|
+
/** @deprecated prefer `renderId` */
|
28
|
+
widgetIdPrefix?: string;
|
29
|
+
/** @deprecated prefer `renderId` */
|
23
30
|
componentIdPrefix?: string;
|
24
|
-
[attr: PropertyKey]: unknown;
|
25
31
|
}
|
26
32
|
|
27
33
|
export type TemplateInput<Input> = Input & {
|
@@ -29,9 +35,9 @@ declare global {
|
|
29
35
|
};
|
30
36
|
|
31
37
|
/** The result of calling `template.render`. */
|
32
|
-
export type RenderedTemplate<
|
33
|
-
Component extends Marko.Component
|
34
|
-
>
|
38
|
+
export type RenderedTemplate<Component = unknown> = Promise<
|
39
|
+
Component extends Marko.Component ? RenderResult<Component> : string
|
40
|
+
> &
|
35
41
|
AsyncIterable<string> & {
|
36
42
|
toReadable(): ReadableStream<Uint8Array<ArrayBufferLike>>;
|
37
43
|
pipe(stream: {
|
@@ -44,11 +50,17 @@ declare global {
|
|
44
50
|
|
45
51
|
/** The result of calling `template.mount`. */
|
46
52
|
export type MountedTemplate<Input = unknown, Return = unknown> = {
|
53
|
+
get value(): Return extends { value: infer Value } ? Value : void;
|
54
|
+
set value(
|
55
|
+
next: Return extends { valueChange?(next: infer Next): any }
|
56
|
+
? Next
|
57
|
+
: never,
|
58
|
+
): void;
|
47
59
|
update(input: Marko.TemplateInput<Input>): void;
|
48
60
|
destroy(): void;
|
49
61
|
};
|
50
62
|
|
51
|
-
export interface Out<Component
|
63
|
+
export interface Out<Component = unknown>
|
52
64
|
extends Marko.RenderedTemplate<Component> {
|
53
65
|
/** The underlying ReadableStream Marko is writing into. */
|
54
66
|
stream: unknown;
|
@@ -337,11 +349,6 @@ declare global {
|
|
337
349
|
[Symbol.iterator](): Iterator<T>;
|
338
350
|
};
|
339
351
|
|
340
|
-
/**
|
341
|
-
* @deprecated Prefer to use AttrTag
|
342
|
-
*/
|
343
|
-
export type RepeatableAttrTag<T> = AttrTag<T>;
|
344
|
-
|
345
352
|
export interface NativeTag<
|
346
353
|
Input extends Record<string, any>,
|
347
354
|
Return extends Element,
|
@@ -388,6 +395,9 @@ declare global {
|
|
388
395
|
? Return
|
389
396
|
: never;
|
390
397
|
|
398
|
+
/** @deprecated @see {@link Marko.AttrTag} */
|
399
|
+
export type RepeatableAttrTag<T> = AttrTag<T>;
|
400
|
+
|
391
401
|
/** @deprecated @see {@link Marko.Input} */
|
392
402
|
export type NativeTagInput<Name extends keyof NativeTags> =
|
393
403
|
NativeTags[Name]["input"];
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "marko",
|
3
|
-
"version": "5.37.
|
3
|
+
"version": "5.37.45",
|
4
4
|
"description": "UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.",
|
5
5
|
"keywords": [
|
6
6
|
"front-end",
|
@@ -70,7 +70,7 @@
|
|
70
70
|
},
|
71
71
|
"dependencies": {
|
72
72
|
"@babel/runtime": "^7.28.2",
|
73
|
-
"@marko/compiler": "^5.39.
|
73
|
+
"@marko/compiler": "^5.39.33",
|
74
74
|
"app-module-path": "^2.2.0",
|
75
75
|
"argly": "^1.2.0",
|
76
76
|
"browser-refresh-client": "1.1.4",
|
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
// eslint-disable-next-line no-constant-binary-expression
|
3
3
|
var complain = "MARKO_DEBUG" && require("complain");
|
4
|
+
var getRenderId = require("../../../runtime/html/get-render-id");
|
4
5
|
var AsyncValue = require("./AsyncValue");
|
5
6
|
|
6
7
|
function safeRenderBody(renderBody, targetOut, data) {
|
@@ -124,7 +125,7 @@ module.exports = function awaitTag(input, out) {
|
|
124
125
|
|
125
126
|
var id = (awaitInfo.id =
|
126
127
|
input.name ||
|
127
|
-
(out.global
|
128
|
+
(getRenderId(out.global) || 0) + clientReorderContext.nextId++);
|
128
129
|
var placeholderIdAttrValue = reorderFunctionId + "ph" + id;
|
129
130
|
|
130
131
|
if (placeholderRenderer) {
|
@@ -3,6 +3,7 @@ require("../../../runtime/html/marko-namespace");
|
|
3
3
|
|
4
4
|
var warp10 = require("warp10");
|
5
5
|
var w10ToJSON = require("../../../runtime/helpers/serialize-noop").___toJSON;
|
6
|
+
var getRenderId = require("../../../runtime/html/get-render-id");
|
6
7
|
var safeJSONRegExp = /<\/|\u2028|\u2029/g;
|
7
8
|
var IGNORE_GLOBAL_TYPES = new Set(["undefined", "function", "symbol"]);
|
8
9
|
var DEFAULT_RUNTIME_ID = "M";
|
@@ -187,7 +188,7 @@ function getInitComponentsData(out, componentDefs) {
|
|
187
188
|
const $global = out.global;
|
188
189
|
const isLast = $global.___isLastFlush;
|
189
190
|
const didSerializeComponents = $global.___didSerializeComponents;
|
190
|
-
const prefix = $global
|
191
|
+
const prefix = getRenderId($global);
|
191
192
|
|
192
193
|
if (len === 0) {
|
193
194
|
if (isLast && didSerializeComponents) {
|
@@ -1,20 +1,12 @@
|
|
1
|
+
var getRenderId = require("../../../runtime/html/get-render-id");
|
2
|
+
|
1
3
|
var FLAG_WILL_RERENDER_IN_BROWSER = 1;
|
2
4
|
// var FLAG_HAS_RENDER_BODY = 2;
|
3
5
|
|
4
6
|
function nextComponentIdProvider(out) {
|
5
|
-
var prefix = out.global
|
7
|
+
var prefix = getRenderId(out.global) || "s"; // "s" is for server (we use "b" for the browser)
|
6
8
|
var nextId = 0;
|
7
9
|
|
8
|
-
// eslint-disable-next-line no-constant-condition
|
9
|
-
if ("MARKO_DEBUG") {
|
10
|
-
if (out.global.widgetIdPrefix) {
|
11
|
-
require("complain")(
|
12
|
-
"$global.widgetIdPrefix is deprecated. use $global.componentIdPrefix instead.",
|
13
|
-
{ location: false }
|
14
|
-
);
|
15
|
-
}
|
16
|
-
}
|
17
|
-
|
18
10
|
return function nextComponentId() {
|
19
11
|
return prefix + nextId++;
|
20
12
|
};
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module.exports = function getRenderId($global) {
|
2
|
+
if (!("renderId" in $global)) {
|
3
|
+
$global.renderId =
|
4
|
+
$global.componentIdPrefix || $global.widgetIdPrefix || "s";
|
5
|
+
|
6
|
+
// eslint-disable-next-line no-constant-condition
|
7
|
+
if ("MARKO_DEBUG") {
|
8
|
+
if ($global.renderId !== "s") {
|
9
|
+
require("complain")(
|
10
|
+
"$global.componentIdPrefix and $global.widgetIdPrefix are deprecated. Use $global.renderId instead.",
|
11
|
+
{ location: false },
|
12
|
+
);
|
13
|
+
}
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
if ($global.renderId !== "s") {
|
18
|
+
return $global.renderId;
|
19
|
+
}
|
20
|
+
};
|
package/tags-html.d.ts
CHANGED
@@ -2571,6 +2571,15 @@ declare global {
|
|
2571
2571
|
*/
|
2572
2572
|
renderBody?: Marko.Body<[], void>;
|
2573
2573
|
|
2574
|
+
/**
|
2575
|
+
* Provide body content for the tag as a Marko.Body.
|
2576
|
+
* @see Marko.Body
|
2577
|
+
*/
|
2578
|
+
content?:
|
2579
|
+
| AttrMissing
|
2580
|
+
| Marko.Body<[], void>
|
2581
|
+
| Marko.Template<Record<any, never>, void>;
|
2582
|
+
|
2574
2583
|
/**
|
2575
2584
|
* Fired when resource was not fully loaded, but not as the result of an error.
|
2576
2585
|
* @see https://html.spec.whatwg.org/multipage/media.html#event-media-abort
|