marko 5.39.42 → 5.39.44
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/translator/taglib/core/parse-client.js +6 -4
- package/dist/translator/taglib/core/parse-server.js +6 -4
- package/dist/translator/taglib/core/parse-static.js +6 -4
- package/docs/compiler.md +8 -5
- package/package.json +4 -4
- package/src/translator/taglib/core/parse-client.js +7 -5
- package/src/translator/taglib/core/parse-server.js +7 -5
- package/src/translator/taglib/core/parse-static.js +7 -5
- package/tags-html.d.ts +7 -0
|
@@ -9,10 +9,12 @@ function _default(path) {
|
|
|
9
9
|
const { rawValue, end } = node;
|
|
10
10
|
const code = rawValue.replace(/^client\s*/, "");
|
|
11
11
|
const start = node.start + (rawValue.length - code.length);
|
|
12
|
-
let
|
|
13
|
-
if (body.length === 1 && _compiler.types.isBlockStatement(body[0])) {
|
|
14
|
-
|
|
12
|
+
let block = (0, _babelUtils.parseBlock)(file, code, start, end);
|
|
13
|
+
if (block.body.length === 1 && _compiler.types.isBlockStatement(block.body[0])) {
|
|
14
|
+
block = block.body[0];
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
const scriptlet = _compiler.types.markoScriptlet(block.body, true, "client");
|
|
18
|
+
scriptlet.innerComments = block.innerComments;
|
|
19
|
+
path.replaceWith(scriptlet);
|
|
18
20
|
}
|
|
@@ -9,10 +9,12 @@ function _default(path) {
|
|
|
9
9
|
const { rawValue, end } = node;
|
|
10
10
|
const code = rawValue.replace(/^server\s*/, "");
|
|
11
11
|
const start = node.start + (rawValue.length - code.length);
|
|
12
|
-
let
|
|
13
|
-
if (body.length === 1 && _compiler.types.isBlockStatement(body[0])) {
|
|
14
|
-
|
|
12
|
+
let block = (0, _babelUtils.parseBlock)(file, code, start, end);
|
|
13
|
+
if (block.body.length === 1 && _compiler.types.isBlockStatement(block.body[0])) {
|
|
14
|
+
block = block.body[0];
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
const scriptlet = _compiler.types.markoScriptlet(block.body, true, "server");
|
|
18
|
+
scriptlet.innerComments = block.innerComments;
|
|
19
|
+
path.replaceWith(scriptlet);
|
|
18
20
|
}
|
|
@@ -9,10 +9,12 @@ function _default(path) {
|
|
|
9
9
|
const { rawValue, end } = node;
|
|
10
10
|
const code = rawValue.replace(/^static\s*/, "");
|
|
11
11
|
const start = node.start + (rawValue.length - code.length);
|
|
12
|
-
let
|
|
13
|
-
if (body.length === 1 && _compiler.types.isBlockStatement(body[0])) {
|
|
14
|
-
|
|
12
|
+
let block = (0, _babelUtils.parseBlock)(file, code, start, end);
|
|
13
|
+
if (block.body.length === 1 && _compiler.types.isBlockStatement(block.body[0])) {
|
|
14
|
+
block = block.body[0];
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
const scriptlet = _compiler.types.markoScriptlet(block.body, true);
|
|
18
|
+
scriptlet.innerComments = block.innerComments;
|
|
19
|
+
path.replaceWith(scriptlet);
|
|
18
20
|
}
|
package/docs/compiler.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# Compiler
|
|
2
2
|
|
|
3
|
+
> **Note**:
|
|
4
|
+
> This page documents the compiler for Marko 5. The [Compiler API reference](https://markojs.com/docs/reference/compiler) covers the current compiler, including the options Marko 6 adds.
|
|
5
|
+
|
|
3
6
|
> **Warning**:
|
|
4
7
|
> The compiler API and hooks are not terribly stable. They’re intended for advanced integrations or userland experimentation with new language features.
|
|
5
8
|
>
|
|
@@ -165,7 +168,7 @@ Default: `false`
|
|
|
165
168
|
Whether unrecognized tags should be silently ignored or throw a compile error. Ignored tags will be output as native elements.
|
|
166
169
|
|
|
167
170
|
> **ProTip**:
|
|
168
|
-
> Some test setups use this alongside
|
|
171
|
+
> Some test setups use this alongside `taglib.excludeDir` and `taglib.excludePackage` from `@marko/compiler` to simulate "shallow" rendering.
|
|
169
172
|
|
|
170
173
|
#### `sourceMaps`
|
|
171
174
|
|
|
@@ -265,14 +268,14 @@ export default function markoLoader(source) {
|
|
|
265
268
|
// If the resource has a ?virtual query param, we should
|
|
266
269
|
// find it in the lookup and then return the virtual code
|
|
267
270
|
// rather than performing the normal compilation
|
|
268
|
-
{ code, map } = virtualSources.get(this.resource);
|
|
271
|
+
({ code, map } = virtualSources.get(this.resource));
|
|
269
272
|
virtualSources.delete(this.resource);
|
|
270
273
|
} else {
|
|
271
274
|
// The default behavior is to compile the template in dom output mode
|
|
272
|
-
{ code, map } = markoCompiler.compileSync(source, this.resourcePath, {
|
|
275
|
+
({ code, map } = markoCompiler.compileSync(source, this.resourcePath, {
|
|
273
276
|
output: "dom",
|
|
274
|
-
resolveVirtualDependency
|
|
275
|
-
});
|
|
277
|
+
resolveVirtualDependency,
|
|
278
|
+
}));
|
|
276
279
|
}
|
|
277
280
|
|
|
278
281
|
return this.callback(null, code, map);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "marko",
|
|
3
|
-
"version": "5.39.
|
|
3
|
+
"version": "5.39.44",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.",
|
|
6
6
|
"keywords": [
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
},
|
|
68
68
|
"types": "index.d.ts",
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@marko/compiler": "^5.42.
|
|
71
|
-
"@marko/runtime-tags": "^6.3.
|
|
70
|
+
"@marko/compiler": "^5.42.8",
|
|
71
|
+
"@marko/runtime-tags": "^6.3.55",
|
|
72
72
|
"app-module-path": "^2.2.0",
|
|
73
73
|
"argly": "^1.2.0",
|
|
74
74
|
"browser-refresh-client": "1.1.4",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"warp10": "^2.1.0"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
87
|
-
"marko": "5.39.
|
|
87
|
+
"marko": "5.39.44"
|
|
88
88
|
},
|
|
89
89
|
"engines": {
|
|
90
90
|
"node": ">=22"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
|
2
|
-
import {
|
|
2
|
+
import { parseBlock } from "@marko/compiler/babel-utils";
|
|
3
3
|
|
|
4
4
|
export default function (path) {
|
|
5
5
|
const {
|
|
@@ -9,10 +9,12 @@ export default function (path) {
|
|
|
9
9
|
const { rawValue, end } = node;
|
|
10
10
|
const code = rawValue.replace(/^client\s*/, "");
|
|
11
11
|
const start = node.start + (rawValue.length - code.length);
|
|
12
|
-
let
|
|
13
|
-
if (body.length === 1 && t.isBlockStatement(body[0])) {
|
|
14
|
-
|
|
12
|
+
let block = parseBlock(file, code, start, end);
|
|
13
|
+
if (block.body.length === 1 && t.isBlockStatement(block.body[0])) {
|
|
14
|
+
block = block.body[0];
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
const scriptlet = t.markoScriptlet(block.body, true, "client");
|
|
18
|
+
scriptlet.innerComments = block.innerComments;
|
|
19
|
+
path.replaceWith(scriptlet);
|
|
18
20
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
|
2
|
-
import {
|
|
2
|
+
import { parseBlock } from "@marko/compiler/babel-utils";
|
|
3
3
|
|
|
4
4
|
export default function (path) {
|
|
5
5
|
const {
|
|
@@ -9,10 +9,12 @@ export default function (path) {
|
|
|
9
9
|
const { rawValue, end } = node;
|
|
10
10
|
const code = rawValue.replace(/^server\s*/, "");
|
|
11
11
|
const start = node.start + (rawValue.length - code.length);
|
|
12
|
-
let
|
|
13
|
-
if (body.length === 1 && t.isBlockStatement(body[0])) {
|
|
14
|
-
|
|
12
|
+
let block = parseBlock(file, code, start, end);
|
|
13
|
+
if (block.body.length === 1 && t.isBlockStatement(block.body[0])) {
|
|
14
|
+
block = block.body[0];
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
const scriptlet = t.markoScriptlet(block.body, true, "server");
|
|
18
|
+
scriptlet.innerComments = block.innerComments;
|
|
19
|
+
path.replaceWith(scriptlet);
|
|
18
20
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
|
2
|
-
import {
|
|
2
|
+
import { parseBlock } from "@marko/compiler/babel-utils";
|
|
3
3
|
|
|
4
4
|
export default function (path) {
|
|
5
5
|
const {
|
|
@@ -9,10 +9,12 @@ export default function (path) {
|
|
|
9
9
|
const { rawValue, end } = node;
|
|
10
10
|
const code = rawValue.replace(/^static\s*/, "");
|
|
11
11
|
const start = node.start + (rawValue.length - code.length);
|
|
12
|
-
let
|
|
13
|
-
if (body.length === 1 && t.isBlockStatement(body[0])) {
|
|
14
|
-
|
|
12
|
+
let block = parseBlock(file, code, start, end);
|
|
13
|
+
if (block.body.length === 1 && t.isBlockStatement(block.body[0])) {
|
|
14
|
+
block = block.body[0];
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
const scriptlet = t.markoScriptlet(block.body, true);
|
|
18
|
+
scriptlet.innerComments = block.innerComments;
|
|
19
|
+
path.replaceWith(scriptlet);
|
|
18
20
|
}
|
package/tags-html.d.ts
CHANGED
|
@@ -208,6 +208,13 @@ declare global {
|
|
|
208
208
|
onVolumechange?: this["onVolumeChange"];
|
|
209
209
|
}
|
|
210
210
|
|
|
211
|
+
// Marko 6 types SVG tags from a base shared with HTML tags, so they need their
|
|
212
|
+
// own `renderBody`; the deprecated lowercase event aliases stay HTML-only.
|
|
213
|
+
interface SVGAttributes<T extends Element = Element> {
|
|
214
|
+
/** Marko 5 class-API components render their body via `renderBody`. */
|
|
215
|
+
renderBody?: Marko.Body<[], void>;
|
|
216
|
+
}
|
|
217
|
+
|
|
211
218
|
interface Directives {
|
|
212
219
|
/**
|
|
213
220
|
* Used to uniquely identify a tag within a template in order
|