marko 5.32.4 → 5.32.6
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/bin/markoc.js +34 -37
- package/dist/compiler/index.js +3 -3
- package/dist/runtime/components/Component.js +14 -15
- package/dist/runtime/components/ComponentDef.js +1 -1
- package/dist/runtime/components/defineComponent.js +2 -2
- package/dist/runtime/components/legacy/defineRenderer-legacy.js +2 -2
- package/dist/runtime/components/legacy/dependencies/html.js +2 -2
- package/dist/runtime/components/legacy/dependencies/vdom.js +2 -2
- package/dist/runtime/components/legacy/renderer-legacy.js +5 -5
- package/dist/runtime/components/renderer.js +5 -5
- package/dist/runtime/helpers/dynamic-tag.js +3 -3
- package/dist/runtime/html/AsyncStream.js +4 -4
- package/dist/runtime/html/helpers/class-attr.js +1 -1
- package/dist/runtime/html/helpers/style-attr.js +1 -1
- package/dist/runtime/renderable.js +2 -2
- package/dist/runtime/vdom/AsyncVDOMBuilder.js +3 -3
- package/dist/runtime/vdom/VComponent.js +2 -2
- package/dist/runtime/vdom/VDocumentFragment.js +2 -2
- package/dist/runtime/vdom/VElement.js +2 -2
- package/dist/runtime/vdom/VFragment.js +3 -3
- package/dist/runtime/vdom/VText.js +2 -2
- package/dist/runtime/vdom/hot-reload.js +3 -3
- package/dist/runtime/vdom/morphdom/index.js +6 -6
- package/dist/runtime/vdom/vdom.js +4 -4
- package/docs/10-awesome-marko-features.md +1 -1
- package/docs/class-components.md +1 -1
- package/docs/compiler.md +2 -2
- package/docs/http.md +1 -1
- package/docs/lasso.md +1 -1
- package/docs/marko-vs-react.md +1 -1
- package/docs/rendering.md +1 -1
- package/docs/rollup.md +4 -4
- package/docs/why-is-marko-fast.md +1 -1
- package/index.d.ts +46 -46
- package/package.json +6 -6
- package/src/compiler/index.js +6 -6
- package/src/core-tags/core/await/AsyncValue.js +1 -1
- package/src/core-tags/core/await/client-reorder-runtime.js +1 -1
- package/src/core-tags/core/await/renderer.js +1 -1
- package/src/core-tags/core/await/reorderer-renderer.js +4 -4
- package/src/node-require/browser-refresh.js +1 -1
- package/src/node-require/hot-reload.js +2 -2
- package/src/node-require/index.js +3 -3
- package/src/runtime/RenderResult.js +3 -3
- package/src/runtime/components/Component.js +21 -22
- package/src/runtime/components/ComponentDef.js +1 -1
- package/src/runtime/components/State.js +2 -2
- package/src/runtime/components/defineComponent.js +2 -2
- package/src/runtime/components/event-delegation.js +1 -1
- package/src/runtime/components/legacy/defineRenderer-legacy.js +3 -3
- package/src/runtime/components/legacy/dependencies/html.js +1 -1
- package/src/runtime/components/legacy/dependencies/index.js +2 -2
- package/src/runtime/components/legacy/dependencies/vdom.js +1 -1
- package/src/runtime/components/legacy/renderer-legacy.js +14 -14
- package/src/runtime/components/renderer.js +10 -10
- package/src/runtime/helpers/_change-case.js +1 -1
- package/src/runtime/helpers/dynamic-tag.js +11 -11
- package/src/runtime/helpers/render-tag.js +2 -2
- package/src/runtime/html/AsyncStream.js +8 -8
- package/src/runtime/html/BufferedWriter.js +1 -1
- package/src/runtime/html/helpers/attr.js +1 -1
- package/src/runtime/html/helpers/attrs.js +1 -1
- package/src/runtime/html/helpers/class-attr.js +1 -1
- package/src/runtime/html/helpers/data-marko.js +1 -1
- package/src/runtime/html/helpers/merge-attrs.js +2 -2
- package/src/runtime/html/helpers/style-attr.js +1 -1
- package/src/runtime/html/index.js +2 -2
- package/src/runtime/queueMicrotask.js +4 -4
- package/src/runtime/renderable.js +3 -3
- package/src/runtime/vdom/AsyncVDOMBuilder.js +9 -9
- package/src/runtime/vdom/VComponent.js +1 -1
- package/src/runtime/vdom/VDocumentFragment.js +2 -2
- package/src/runtime/vdom/VElement.js +11 -11
- package/src/runtime/vdom/VFragment.js +2 -2
- package/src/runtime/vdom/VText.js +1 -1
- package/src/runtime/vdom/helpers/attrs.js +1 -1
- package/src/runtime/vdom/helpers/v-element.js +1 -1
- package/src/runtime/vdom/hot-reload.js +2 -2
- package/src/runtime/vdom/index.js +2 -2
- package/src/runtime/vdom/morphdom/fragment.js +2 -2
- package/src/runtime/vdom/morphdom/helpers.js +2 -2
- package/src/runtime/vdom/morphdom/index.js +27 -27
- package/src/runtime/vdom/morphdom/specialElHandlers.js +1 -1
- package/src/runtime/vdom/vdom.js +4 -4
- package/src/taglib/index.js +2 -2
package/index.d.ts
CHANGED
|
@@ -58,11 +58,11 @@ declare global {
|
|
|
58
58
|
once(eventName: PropertyKey, listener: (...args: any[]) => any): this;
|
|
59
59
|
prependListener(
|
|
60
60
|
eventName: PropertyKey,
|
|
61
|
-
listener: (...args: any[]) => any
|
|
61
|
+
listener: (...args: any[]) => any,
|
|
62
62
|
): this;
|
|
63
63
|
removeListener(
|
|
64
64
|
eventName: PropertyKey,
|
|
65
|
-
listener: (...args: any[]) => any
|
|
65
|
+
listener: (...args: any[]) => any,
|
|
66
66
|
): this;
|
|
67
67
|
/** Register a callback executed when the last async out has completed. */
|
|
68
68
|
onLast(listener: (next: () => void) => unknown): this;
|
|
@@ -84,7 +84,7 @@ declare global {
|
|
|
84
84
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
85
85
|
in Params extends readonly any[] = [],
|
|
86
86
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
87
|
-
out Return = void
|
|
87
|
+
out Return = void,
|
|
88
88
|
> {}
|
|
89
89
|
|
|
90
90
|
/** Valid data types which can be passed in as a <${dynamic}/> tag name. */
|
|
@@ -125,7 +125,7 @@ declare global {
|
|
|
125
125
|
* cleaned up once this component is destroyed
|
|
126
126
|
* */
|
|
127
127
|
subscribeTo(
|
|
128
|
-
emitter: unknown
|
|
128
|
+
emitter: unknown,
|
|
129
129
|
): Omit<Emitter, "listenerCount" | "prependListener" | "emit">;
|
|
130
130
|
/** Emits an event on the component instance. */
|
|
131
131
|
emit(eventName: PropertyKey, ...args: any[]): boolean;
|
|
@@ -136,12 +136,12 @@ declare global {
|
|
|
136
136
|
/** Listen to an event on the component instance before all other listeners. */
|
|
137
137
|
prependListener(
|
|
138
138
|
eventName: PropertyKey,
|
|
139
|
-
listener: (...args: any[]) => any
|
|
139
|
+
listener: (...args: any[]) => any,
|
|
140
140
|
): this;
|
|
141
141
|
/** Remove a listener from the component instance. */
|
|
142
142
|
removeListener(
|
|
143
143
|
eventName: PropertyKey,
|
|
144
|
-
listener: (...args: any[]) => any
|
|
144
|
+
listener: (...args: any[]) => any,
|
|
145
145
|
): this;
|
|
146
146
|
/** Remove all listeners from the component instance. */
|
|
147
147
|
removeAllListeners(eventName?: PropertyKey): this;
|
|
@@ -156,14 +156,14 @@ declare global {
|
|
|
156
156
|
/** Gets an element reference by its `key` attribute in the template. */
|
|
157
157
|
getEl<T extends Element | void = Element | void>(
|
|
158
158
|
key?: string,
|
|
159
|
-
index?: number
|
|
159
|
+
index?: number,
|
|
160
160
|
): T;
|
|
161
161
|
/** Gets all element references by their `key` attribute in the template. */
|
|
162
162
|
getEls<T extends Element[] = Element[]>(key: string): T;
|
|
163
163
|
/** Gets a component reference by its `key` attribute in the template. */
|
|
164
164
|
getComponent<T extends Component | void = Component | void>(
|
|
165
165
|
key: string,
|
|
166
|
-
index?: number
|
|
166
|
+
index?: number,
|
|
167
167
|
): T;
|
|
168
168
|
/** Gets all component references by their `key` attribute in the template. */
|
|
169
169
|
getComponents<T extends Component[] = Component[]>(key: string): T;
|
|
@@ -178,14 +178,14 @@ declare global {
|
|
|
178
178
|
*/
|
|
179
179
|
setState<Key extends PropertyKey>(
|
|
180
180
|
name: Key & keyof this["state"],
|
|
181
|
-
value: (this["state"] & Record<PropertyKey, unknown>)[Key]
|
|
181
|
+
value: (this["state"] & Record<PropertyKey, unknown>)[Key],
|
|
182
182
|
): void;
|
|
183
183
|
setState(value: Partial<this["state"]>): void;
|
|
184
184
|
|
|
185
185
|
/** Schedules an update related to a specific state property and optionally updates the value. */
|
|
186
186
|
setStateDirty<Key extends PropertyKey>(
|
|
187
187
|
name: Key & keyof this["state"],
|
|
188
|
-
value?: (this["state"] & Record<PropertyKey, unknown>)[Key]
|
|
188
|
+
value?: (this["state"] & Record<PropertyKey, unknown>)[Key],
|
|
189
189
|
): void;
|
|
190
190
|
/** Synchronously flush any scheduled updates. */
|
|
191
191
|
update(): void;
|
|
@@ -238,7 +238,7 @@ declare global {
|
|
|
238
238
|
stream?: {
|
|
239
239
|
write: (chunk: string) => void;
|
|
240
240
|
end: (chunk?: string) => void;
|
|
241
|
-
}
|
|
241
|
+
},
|
|
242
242
|
): Marko.Out<Marko.Component>;
|
|
243
243
|
|
|
244
244
|
/** Asynchronously render the template in buffered mode. */
|
|
@@ -246,13 +246,13 @@ declare global {
|
|
|
246
246
|
input: Marko.TemplateInput<Input>,
|
|
247
247
|
cb?: (
|
|
248
248
|
err: Error | null,
|
|
249
|
-
result: Marko.RenderResult<Marko.Component
|
|
250
|
-
) => void
|
|
249
|
+
result: Marko.RenderResult<Marko.Component>,
|
|
250
|
+
) => void,
|
|
251
251
|
): Marko.Out<Marko.Component>;
|
|
252
252
|
|
|
253
253
|
/** Synchronously render the template. */
|
|
254
254
|
abstract renderSync(
|
|
255
|
-
input: Marko.TemplateInput<Input
|
|
255
|
+
input: Marko.TemplateInput<Input>,
|
|
256
256
|
): Marko.RenderResult<Marko.Component>;
|
|
257
257
|
|
|
258
258
|
/** Synchronously render a template to a string. */
|
|
@@ -260,13 +260,13 @@ declare global {
|
|
|
260
260
|
|
|
261
261
|
/** Render a template and return a stream.Readable in nodejs or a ReadableStream in a web worker environment. */
|
|
262
262
|
abstract stream(
|
|
263
|
-
input: Marko.TemplateInput<Input
|
|
263
|
+
input: Marko.TemplateInput<Input>,
|
|
264
264
|
): ReadableStream<string> & NodeJS.ReadableStream;
|
|
265
265
|
/** @marko-overload-end */
|
|
266
266
|
}
|
|
267
267
|
|
|
268
268
|
export interface RenderResult<
|
|
269
|
-
out Component extends Marko.Component = Marko.Component
|
|
269
|
+
out Component extends Marko.Component = Marko.Component,
|
|
270
270
|
> {
|
|
271
271
|
/** Returns the component created as a result of rendering the template. */
|
|
272
272
|
getComponent(): Component;
|
|
@@ -307,11 +307,11 @@ declare global {
|
|
|
307
307
|
once(eventName: PropertyKey, listener: (...args: any[]) => any): this;
|
|
308
308
|
prependListener(
|
|
309
309
|
eventName: PropertyKey,
|
|
310
|
-
listener: (...args: any[]) => any
|
|
310
|
+
listener: (...args: any[]) => any,
|
|
311
311
|
): this;
|
|
312
312
|
removeListener(
|
|
313
313
|
eventName: PropertyKey,
|
|
314
|
-
listener: (...args: any[]) => any
|
|
314
|
+
listener: (...args: any[]) => any,
|
|
315
315
|
): this;
|
|
316
316
|
removeAllListeners(eventName?: PropertyKey): this;
|
|
317
317
|
}
|
|
@@ -323,7 +323,7 @@ declare global {
|
|
|
323
323
|
|
|
324
324
|
export interface NativeTag<
|
|
325
325
|
Input extends Record<string, any>,
|
|
326
|
-
Return extends Element
|
|
326
|
+
Return extends Element,
|
|
327
327
|
> {
|
|
328
328
|
input: Input;
|
|
329
329
|
return: () => Return;
|
|
@@ -335,37 +335,37 @@ declare global {
|
|
|
335
335
|
export type Input<Name> = 0 extends 1 & Name
|
|
336
336
|
? any
|
|
337
337
|
: Name extends string
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
338
|
+
? Name extends keyof NativeTags
|
|
339
|
+
? NativeTags[Name]["input"]
|
|
340
|
+
: Record<string, unknown>
|
|
341
|
+
: Name extends
|
|
342
|
+
| Template<infer Input, any>
|
|
343
|
+
| { _(): () => (input: infer Input) => any }
|
|
344
|
+
? Input
|
|
345
|
+
: Name extends Body<infer Args, any>
|
|
346
|
+
? Args extends {
|
|
347
|
+
length: infer Length;
|
|
348
|
+
}
|
|
349
|
+
? number extends Length
|
|
350
|
+
? { value?: Args }
|
|
351
|
+
: 0 extends Length
|
|
352
|
+
? { value?: [] }
|
|
353
|
+
: { value: Args }
|
|
354
|
+
: never
|
|
355
|
+
: never;
|
|
356
356
|
|
|
357
357
|
export type Return<Name> = 0 extends 1 & Name
|
|
358
358
|
? any
|
|
359
359
|
: Name extends string
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
360
|
+
? Name extends keyof NativeTags
|
|
361
|
+
? NativeTags[Name]["return"]
|
|
362
|
+
: () => Element
|
|
363
|
+
: Name extends
|
|
364
|
+
| { _(): () => (input: any) => { return: infer Return } }
|
|
365
|
+
| Template<any, infer Return>
|
|
366
|
+
| Body<any, infer Return>
|
|
367
|
+
? Return
|
|
368
|
+
: never;
|
|
369
369
|
|
|
370
370
|
/** @deprecated @see {@link Marko.Input} */
|
|
371
371
|
export type NativeTagInput<Name extends keyof NativeTags> =
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "marko",
|
|
3
|
-
"version": "5.32.
|
|
3
|
+
"version": "5.32.6",
|
|
4
4
|
"description": "UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"front-end",
|
|
@@ -64,20 +64,20 @@
|
|
|
64
64
|
"build": "babel ./src --out-dir ./dist --delete-dir-on-start --copy-files --config-file ../../babel.config.js --env-name=production"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@marko/compiler": "^5.34.
|
|
68
|
-
"@marko/translator-default": "^5.31.
|
|
67
|
+
"@marko/compiler": "^5.34.5",
|
|
68
|
+
"@marko/translator-default": "^5.31.12",
|
|
69
69
|
"app-module-path": "^2.2.0",
|
|
70
70
|
"argly": "^1.2.0",
|
|
71
71
|
"browser-refresh-client": "1.1.4",
|
|
72
72
|
"complain": "^1.6.0",
|
|
73
|
-
"csstype": "^3.1.
|
|
73
|
+
"csstype": "^3.1.3",
|
|
74
74
|
"events-light": "^1.0.5",
|
|
75
75
|
"listener-tracker": "^2.0.0",
|
|
76
|
-
"minimatch": "^
|
|
76
|
+
"minimatch": "^9.0.3",
|
|
77
77
|
"raptor-util": "^3.2.0",
|
|
78
78
|
"resolve-from": "^5.0.0",
|
|
79
79
|
"self-closing-tags": "^1.0.1",
|
|
80
|
-
"warp10": "^2.0
|
|
80
|
+
"warp10": "^2.1.0"
|
|
81
81
|
},
|
|
82
82
|
"logo": {
|
|
83
83
|
"url": "https://raw.githubusercontent.com/marko-js/branding/master/marko-logo-small.png"
|
package/src/compiler/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var ok = require("assert").ok;
|
|
4
|
+
var fs = require("fs");
|
|
3
5
|
var complain = "MARKO_DEBUG" && require("complain");
|
|
4
6
|
var compiler = require("@marko/compiler");
|
|
5
7
|
var extend = require("raptor-util/extend");
|
|
6
|
-
var globalConfig = require("./config");
|
|
7
|
-
var ok = require("assert").ok;
|
|
8
|
-
var fs = require("fs");
|
|
9
8
|
var taglib = require("../taglib");
|
|
9
|
+
var globalConfig = require("./config");
|
|
10
10
|
var defaults = extend({}, globalConfig);
|
|
11
11
|
|
|
12
12
|
// eslint-disable-next-line no-constant-condition
|
|
@@ -16,7 +16,7 @@ if ("MARKO_DEBUG") {
|
|
|
16
16
|
require.main.filename !== require.resolve("../../bin/markoc")
|
|
17
17
|
) {
|
|
18
18
|
complain(
|
|
19
|
-
"Using `marko/compiler` has been deprecated, please upgrade to the `@marko/compiler` module."
|
|
19
|
+
"Using `marko/compiler` has been deprecated, please upgrade to the `@marko/compiler` module.",
|
|
20
20
|
);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -67,7 +67,7 @@ function _compile(src, filename, userConfig, callback) {
|
|
|
67
67
|
if (callback) {
|
|
68
68
|
compiler.compile(src, filename, options).then(
|
|
69
69
|
(result) => callback(null, resultCompat(result, options)),
|
|
70
|
-
(error) => callback(error)
|
|
70
|
+
(error) => callback(error),
|
|
71
71
|
);
|
|
72
72
|
} else {
|
|
73
73
|
return resultCompat(compiler.compileSync(src, filename, options), options);
|
|
@@ -98,7 +98,7 @@ function compileForBrowser(src, filename, options, callback) {
|
|
|
98
98
|
meta: false,
|
|
99
99
|
sourceOnly: false,
|
|
100
100
|
},
|
|
101
|
-
options
|
|
101
|
+
options,
|
|
102
102
|
);
|
|
103
103
|
|
|
104
104
|
return compile(src, filename, options, callback);
|
|
@@ -18,7 +18,7 @@ function requestData(provider, timeout) {
|
|
|
18
18
|
if ("MARKO_DEBUG") {
|
|
19
19
|
complain(
|
|
20
20
|
"Passing a callback function to the <await> tag has been deprecated, please use a promise instead.",
|
|
21
|
-
{ level: 1, locationIndex: 3 }
|
|
21
|
+
{ level: 1, locationIndex: 3 },
|
|
22
22
|
);
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -52,7 +52,7 @@ module.exports = function (input, out) {
|
|
|
52
52
|
if (!global._afRuntime) {
|
|
53
53
|
// Minified version of ./client-reorder-runtime.js
|
|
54
54
|
asyncOut.script(
|
|
55
|
-
`function $af(d,a,e,l,g,h,k,b,f,c){c=$af;if(a&&!c[a])(c[a+="$"]||(c[a]=[])).push(d);else{e=document;l=e.getElementById("af"+d);g=e.getElementById("afph"+d);h=e.createDocumentFragment();k=l.childNodes;b=0;for(f=k.length;b<f;b++)h.appendChild(k.item(0));g&&g.parentNode.replaceChild(h,g);c[d]=1;if(a=c[d+"$"])for(b=0,f=a.length;b<f;b++)c(a[b])}}
|
|
55
|
+
`function $af(d,a,e,l,g,h,k,b,f,c){c=$af;if(a&&!c[a])(c[a+="$"]||(c[a]=[])).push(d);else{e=document;l=e.getElementById("af"+d);g=e.getElementById("afph"+d);h=e.createDocumentFragment();k=l.childNodes;b=0;for(f=k.length;b<f;b++)h.appendChild(k.item(0));g&&g.parentNode.replaceChild(h,g);c[d]=1;if(a=c[d+"$"])for(b=0,f=a.length;b<f;b++)c(a[b])}}`,
|
|
56
56
|
);
|
|
57
57
|
global._afRuntime = true;
|
|
58
58
|
}
|
|
@@ -70,7 +70,7 @@ module.exports = function (input, out) {
|
|
|
70
70
|
awaitInfo.id +
|
|
71
71
|
'">' +
|
|
72
72
|
result.toString() +
|
|
73
|
-
"</div>"
|
|
73
|
+
"</div>",
|
|
74
74
|
);
|
|
75
75
|
} else {
|
|
76
76
|
asyncOut.write(
|
|
@@ -78,7 +78,7 @@ module.exports = function (input, out) {
|
|
|
78
78
|
awaitInfo.id +
|
|
79
79
|
'" style="display:none">' +
|
|
80
80
|
result.toString() +
|
|
81
|
-
"</div>"
|
|
81
|
+
"</div>",
|
|
82
82
|
);
|
|
83
83
|
}
|
|
84
84
|
|
|
@@ -88,7 +88,7 @@ module.exports = function (input, out) {
|
|
|
88
88
|
? awaitInfo.id
|
|
89
89
|
: '"' + awaitInfo.id + '"') +
|
|
90
90
|
(awaitInfo.after ? ',"' + awaitInfo.after + '"' : "") +
|
|
91
|
-
")"
|
|
91
|
+
")",
|
|
92
92
|
);
|
|
93
93
|
|
|
94
94
|
awaitInfo.out.writer = asyncOut.writer;
|
|
@@ -9,7 +9,7 @@ exports.handleFileModified = function (filename) {
|
|
|
9
9
|
if (!fs.existsSync(filename)) {
|
|
10
10
|
console.log(
|
|
11
11
|
"[marko/hot-reload] WARNING cannot resolve template path: ",
|
|
12
|
-
filename
|
|
12
|
+
filename,
|
|
13
13
|
);
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
@@ -35,7 +35,7 @@ function tryReload(filename) {
|
|
|
35
35
|
delete require.cache[filename];
|
|
36
36
|
require(filename);
|
|
37
37
|
console.log(
|
|
38
|
-
`[marko] Template successfully reloaded: ${cwdRelative(filename)}
|
|
38
|
+
`[marko] Template successfully reloaded: ${cwdRelative(filename)}`,
|
|
39
39
|
);
|
|
40
40
|
} catch (e) {
|
|
41
41
|
console.error(e);
|
|
@@ -14,7 +14,7 @@ const MARKO_EXTENSIONS = Symbol("MARKO_EXTENSIONS");
|
|
|
14
14
|
// eslint-disable-next-line no-constant-condition
|
|
15
15
|
if ("MARKO_DEBUG") {
|
|
16
16
|
complain(
|
|
17
|
-
'Using "marko/node-require" has been replaced with "@marko/compiler/register".'
|
|
17
|
+
'Using "marko/node-require" has been replaced with "@marko/compiler/register".',
|
|
18
18
|
);
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -32,8 +32,8 @@ function compile(templatePath, markoCompiler, userCompilerOptions) {
|
|
|
32
32
|
{},
|
|
33
33
|
defaultCompilerOptions,
|
|
34
34
|
userCompilerOptions,
|
|
35
|
-
requiredCompilerOptions
|
|
36
|
-
)
|
|
35
|
+
requiredCompilerOptions,
|
|
36
|
+
),
|
|
37
37
|
).code;
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -74,7 +74,7 @@ Object.defineProperty(proto, "html", {
|
|
|
74
74
|
// eslint-disable-next-line no-constant-condition
|
|
75
75
|
if ("MARKO_DEBUG") {
|
|
76
76
|
complain(
|
|
77
|
-
'The "html" property is deprecated. Please use "toString" instead.'
|
|
77
|
+
'The "html" property is deprecated. Please use "toString" instead.',
|
|
78
78
|
);
|
|
79
79
|
}
|
|
80
80
|
return this.toString();
|
|
@@ -86,7 +86,7 @@ Object.defineProperty(proto, "context", {
|
|
|
86
86
|
// eslint-disable-next-line no-constant-condition
|
|
87
87
|
if ("MARKO_DEBUG") {
|
|
88
88
|
complain(
|
|
89
|
-
'The "context" property is deprecated. Please use "out" instead.'
|
|
89
|
+
'The "context" property is deprecated. Please use "out" instead.',
|
|
90
90
|
);
|
|
91
91
|
}
|
|
92
92
|
return this.___out;
|
|
@@ -107,5 +107,5 @@ domInsert(
|
|
|
107
107
|
},
|
|
108
108
|
function afterInsert(renderResult, referenceEl) {
|
|
109
109
|
return renderResult.afterInsert(getRootNode(referenceEl));
|
|
110
|
-
}
|
|
110
|
+
},
|
|
111
111
|
);
|
|
@@ -2,22 +2,21 @@
|
|
|
2
2
|
/* jshint newcap:false */
|
|
3
3
|
|
|
4
4
|
var complain = "MARKO_DEBUG" && require("complain");
|
|
5
|
-
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var getComponentsContext =
|
|
9
|
-
require("./ComponentsContext").___getComponentsContext;
|
|
5
|
+
var EventEmitter = require("events-light");
|
|
6
|
+
var SubscriptionTracker = require("listener-tracker");
|
|
7
|
+
var inherit = require("raptor-util/inherit");
|
|
10
8
|
var componentsUtil = require("@internal/components-util");
|
|
11
9
|
var componentLookup = componentsUtil.___componentLookup;
|
|
12
10
|
var destroyNodeRecursive = componentsUtil.___destroyNodeRecursive;
|
|
13
|
-
var
|
|
11
|
+
var defaultCreateOut = require("../createOut");
|
|
12
|
+
var domInsert = require("../dom-insert");
|
|
14
13
|
var RenderResult = require("../RenderResult");
|
|
15
|
-
var SubscriptionTracker = require("listener-tracker");
|
|
16
|
-
var inherit = require("raptor-util/inherit");
|
|
17
|
-
var updateManager = require("./update-manager");
|
|
18
14
|
var morphdom = require("../vdom/morphdom");
|
|
19
|
-
var
|
|
15
|
+
var getComponentsContext =
|
|
16
|
+
require("./ComponentsContext").___getComponentsContext;
|
|
20
17
|
var domData = require("./dom-data");
|
|
18
|
+
var eventDelegation = require("./event-delegation");
|
|
19
|
+
var updateManager = require("./update-manager");
|
|
21
20
|
var componentsByDOMNode = domData.___componentByDOMNode;
|
|
22
21
|
var keyedElementsByComponentId = domData.___ssrKeyedElementsByComponentId;
|
|
23
22
|
var CONTEXT_KEY = "__subtree_context__";
|
|
@@ -57,7 +56,7 @@ function handleCustomEventWithMethodListener(
|
|
|
57
56
|
component,
|
|
58
57
|
targetMethodName,
|
|
59
58
|
args,
|
|
60
|
-
extraArgs
|
|
59
|
+
extraArgs,
|
|
61
60
|
) {
|
|
62
61
|
// Remove the "eventType" argument
|
|
63
62
|
args.push(component);
|
|
@@ -229,7 +228,7 @@ Component.prototype = componentProto = {
|
|
|
229
228
|
this,
|
|
230
229
|
targetMethodName,
|
|
231
230
|
args,
|
|
232
|
-
extraArgs
|
|
231
|
+
extraArgs,
|
|
233
232
|
);
|
|
234
233
|
|
|
235
234
|
if (isOnce) {
|
|
@@ -253,7 +252,7 @@ Component.prototype = componentProto = {
|
|
|
253
252
|
// eslint-disable-next-line no-constant-condition
|
|
254
253
|
if ("MARKO_DEBUG") {
|
|
255
254
|
complain(
|
|
256
|
-
"Accessing the elements of a child component using 'component.getEl' is deprecated."
|
|
255
|
+
"Accessing the elements of a child component using 'component.getEl' is deprecated.",
|
|
257
256
|
);
|
|
258
257
|
}
|
|
259
258
|
|
|
@@ -283,7 +282,7 @@ Component.prototype = componentProto = {
|
|
|
283
282
|
// eslint-disable-next-line no-constant-condition
|
|
284
283
|
if ("MARKO_DEBUG") {
|
|
285
284
|
complain(
|
|
286
|
-
"A repeated key[] was passed to getComponent. Use a non-repeating key if there is only one of these components."
|
|
285
|
+
"A repeated key[] was passed to getComponent. Use a non-repeating key if there is only one of these components.",
|
|
287
286
|
);
|
|
288
287
|
}
|
|
289
288
|
rootNode = rootNode && rootNode[Object.keys(rootNode)[0]];
|
|
@@ -403,7 +402,7 @@ Component.prototype = componentProto = {
|
|
|
403
402
|
name,
|
|
404
403
|
value,
|
|
405
404
|
true /* ensure:true */,
|
|
406
|
-
true /* forceDirty:true
|
|
405
|
+
true /* forceDirty:true */,
|
|
407
406
|
);
|
|
408
407
|
},
|
|
409
408
|
|
|
@@ -600,14 +599,14 @@ Component.prototype = componentProto = {
|
|
|
600
599
|
// eslint-disable-next-line no-constant-condition
|
|
601
600
|
if ("MARKO_DEBUG") {
|
|
602
601
|
complain(
|
|
603
|
-
'The "this.els" attribute is deprecated. Please use "this.getEls(key)" instead.'
|
|
602
|
+
'The "this.els" attribute is deprecated. Please use "this.getEls(key)" instead.',
|
|
604
603
|
);
|
|
605
604
|
}
|
|
606
|
-
return (this.___rootNode ? this.___rootNode.nodes : []).filter(
|
|
607
|
-
el
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
605
|
+
return (this.___rootNode ? this.___rootNode.nodes : []).filter(
|
|
606
|
+
function (el) {
|
|
607
|
+
return el.nodeType === ELEMENT_NODE;
|
|
608
|
+
},
|
|
609
|
+
);
|
|
611
610
|
},
|
|
612
611
|
|
|
613
612
|
___emit: emit,
|
|
@@ -655,7 +654,7 @@ domInsert(
|
|
|
655
654
|
},
|
|
656
655
|
function afterInsert(component) {
|
|
657
656
|
return component;
|
|
658
|
-
}
|
|
657
|
+
},
|
|
659
658
|
);
|
|
660
659
|
|
|
661
660
|
inherit(Component, EventEmitter);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var complain = "MARKO_DEBUG" && require("complain");
|
|
3
|
+
var extend = require("raptor-util/extend");
|
|
3
4
|
var w10Noop = require("warp10/constants").NOOP;
|
|
4
5
|
var componentUtil = require("@internal/components-util");
|
|
5
6
|
var attachBubblingEvent = componentUtil.___attachBubblingEvent;
|
|
6
7
|
var addDelegatedEventHandler =
|
|
7
8
|
require("./event-delegation").___addDelegatedEventHandler;
|
|
8
|
-
var extend = require("raptor-util/extend");
|
|
9
9
|
var KeySequence = require("./KeySequence");
|
|
10
10
|
var EMPTY_OBJECT = {};
|
|
11
11
|
|
|
@@ -48,7 +48,7 @@ State.prototype = {
|
|
|
48
48
|
key,
|
|
49
49
|
undefined,
|
|
50
50
|
false /* ensure:false */,
|
|
51
|
-
false /* forceDirty:false
|
|
51
|
+
false /* forceDirty:false */,
|
|
52
52
|
);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -58,7 +58,7 @@ State.prototype = {
|
|
|
58
58
|
key,
|
|
59
59
|
newState[key],
|
|
60
60
|
true /* ensure:true */,
|
|
61
|
-
false /* forceDirty:false
|
|
61
|
+
false /* forceDirty:false */,
|
|
62
62
|
);
|
|
63
63
|
}
|
|
64
64
|
},
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* jshint newcap:false */
|
|
3
3
|
|
|
4
|
-
var BaseState = require("./State");
|
|
5
|
-
var BaseComponent = require("./Component");
|
|
6
4
|
var inherit = require("raptor-util/inherit");
|
|
5
|
+
var BaseComponent = require("./Component");
|
|
6
|
+
var BaseState = require("./State");
|
|
7
7
|
|
|
8
8
|
module.exports = function defineComponent(def, renderer) {
|
|
9
9
|
if (def.___isComponent) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
var complain = "MARKO_DEBUG" && require("complain");
|
|
2
|
+
var componentLookup = require("@internal/components-util").___componentLookup;
|
|
3
|
+
var req = require("@internal/require");
|
|
2
4
|
var makeRenderable = require("../../renderable");
|
|
3
5
|
var getComponentsContext =
|
|
4
6
|
require("../ComponentsContext").___getComponentsContext;
|
|
5
|
-
var componentLookup = require("@internal/components-util").___componentLookup;
|
|
6
7
|
var modernRenderer = require("../renderer");
|
|
7
|
-
var req = require("@internal/require");
|
|
8
8
|
var resolveComponentKey = modernRenderer.___resolveComponentKey;
|
|
9
9
|
|
|
10
10
|
module.exports = function defineRenderer(renderingLogic) {
|
|
@@ -117,7 +117,7 @@ module.exports = function defineRenderer(renderingLogic) {
|
|
|
117
117
|
var templateData = clone(
|
|
118
118
|
getTemplateData
|
|
119
119
|
? getTemplateData(widgetState, newProps, out)
|
|
120
|
-
: widgetState || newProps
|
|
120
|
+
: widgetState || newProps,
|
|
121
121
|
);
|
|
122
122
|
|
|
123
123
|
if (isReceivingNewInput && getWidgetConfig) {
|
|
@@ -11,7 +11,7 @@ function getRootDeps(template, context) {
|
|
|
11
11
|
attachDepsAndComponentsToTemplate(template, context);
|
|
12
12
|
|
|
13
13
|
var deps = (template.___depsArray = Object.keys(template.___deps).map(
|
|
14
|
-
(key) => template.___deps[key]
|
|
14
|
+
(key) => template.___deps[key],
|
|
15
15
|
));
|
|
16
16
|
var initModule = getInitModule(template.path, template.___components);
|
|
17
17
|
|
|
@@ -103,7 +103,7 @@ function getInitModule(path, components) {
|
|
|
103
103
|
(component) =>
|
|
104
104
|
`components.register('${component.id}', require('.${
|
|
105
105
|
nodePath.sep
|
|
106
|
-
}${nodePath.relative(root, component.path)}'))
|
|
106
|
+
}${nodePath.relative(root, component.path)}'));`,
|
|
107
107
|
);
|
|
108
108
|
var code = `
|
|
109
109
|
var components = require('marko/components');
|