marko 5.34.4 → 5.35.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/runtime/helpers/tags-compat/runtime-dom.js +12 -7
- package/dist/runtime/helpers/tags-compat/runtime-html.js +5 -14
- package/docs/compiler.md +7 -0
- package/docs/getting-started.md +17 -1
- package/docs/installing.md +2 -2
- package/package.json +3 -3
- package/src/runtime/helpers/tags-compat/runtime-dom.js +12 -7
- package/src/runtime/helpers/tags-compat/runtime-html.js +5 -14
@@ -81,13 +81,18 @@ exports.p = function (domCompat) {
|
|
81
81
|
|
82
82
|
domCompat.patchConditionals((conditional) => (...args) => {
|
83
83
|
const signal = conditional(...args);
|
84
|
-
const
|
85
|
-
return (scope,
|
86
|
-
return signal(
|
84
|
+
const skipAttrs = args.length <= 1;
|
85
|
+
return (scope, rendererOrOp) => {
|
86
|
+
return signal(
|
87
|
+
scope,
|
88
|
+
domCompat.isOp(rendererOrOp) ?
|
89
|
+
rendererOrOp :
|
90
|
+
create5to6Renderer(rendererOrOp, skipAttrs)
|
91
|
+
);
|
87
92
|
};
|
88
93
|
});
|
89
94
|
|
90
|
-
function create5to6Renderer(renderer,
|
95
|
+
function create5to6Renderer(renderer, skipAttrs) {
|
91
96
|
let newRenderer = renderer;
|
92
97
|
if (renderer && typeof renderer !== "string") {
|
93
98
|
const rendererFromAnywhere =
|
@@ -115,7 +120,7 @@ exports.p = function (domCompat) {
|
|
115
120
|
}
|
116
121
|
newRenderer = domCompat.createRenderer(
|
117
122
|
(scope) => {
|
118
|
-
if (
|
123
|
+
if (skipAttrs) {
|
119
124
|
renderAndMorph(scope, rendererFromAnywhere, renderer, {});
|
120
125
|
}
|
121
126
|
},
|
@@ -124,8 +129,8 @@ exports.p = function (domCompat) {
|
|
124
129
|
_j_(null, null, realFragment);
|
125
130
|
return realFragment;
|
126
131
|
},
|
127
|
-
(scope, input
|
128
|
-
if (
|
132
|
+
(scope, input) => {
|
133
|
+
if (domCompat.isOp(input)) return;
|
129
134
|
renderAndMorph(scope, rendererFromAnywhere, renderer, input);
|
130
135
|
}
|
131
136
|
);
|
@@ -12,8 +12,7 @@ exports.p = function (tagsAPI) {
|
|
12
12
|
createRenderFn,
|
13
13
|
fork,
|
14
14
|
write,
|
15
|
-
|
16
|
-
register,
|
15
|
+
serializerRegister,
|
17
16
|
writeScope,
|
18
17
|
nextScopeId,
|
19
18
|
getRegistryInfo
|
@@ -168,19 +167,11 @@ exports.p = function (tagsAPI) {
|
|
168
167
|
}
|
169
168
|
);
|
170
169
|
|
171
|
-
function dummyCreate5to6Renderer() {}
|
172
|
-
|
173
|
-
register(dummyCreate5to6Renderer, "@marko/tags-compat-5-to-6");
|
174
|
-
|
175
170
|
return function serialized5to6(renderer, id) {
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
value(dummyCreate5to6Renderer).
|
181
|
-
code("(").
|
182
|
-
value(dummyRenderer).
|
183
|
-
code(",!0)")
|
171
|
+
return serializerRegister(
|
172
|
+
"@marko/tags-compat-5-to-6",
|
173
|
+
renderer,
|
174
|
+
serializerRegister(id, () => {})
|
184
175
|
);
|
185
176
|
};
|
186
177
|
};
|
package/docs/compiler.md
CHANGED
@@ -206,6 +206,13 @@ Default: [environment based](https://github.com/marko-js/marko/blob/0f212897d2d3
|
|
206
206
|
|
207
207
|
Enables production mode optimizations.
|
208
208
|
|
209
|
+
#### `optimizedRegistryIds`
|
210
|
+
|
211
|
+
Type: `Map<string, string>`<br>
|
212
|
+
Default: `undefined`
|
213
|
+
|
214
|
+
If `optimize` is enabled you can provide a Map which the compiler will use to store shorter registry/template id's in. This can only be used if the same `optimizedRegistryIds` are used for both server and client compilations.
|
215
|
+
|
209
216
|
#### `resolveVirtualDependency`
|
210
217
|
|
211
218
|
Type:
|
package/docs/getting-started.md
CHANGED
@@ -1,6 +1,22 @@
|
|
1
1
|
# Getting started
|
2
2
|
|
3
|
-
|
3
|
+
## Setup
|
4
|
+
|
5
|
+
### Marko Run (Recommended)
|
6
|
+
|
7
|
+
[Marko Run](https://github.com/marko-js/run) makes it easy to get started with little to no config and is the recommended starting point for a new Marko project.
|
8
|
+
|
9
|
+
To set up your project:
|
10
|
+
|
11
|
+
1. `npm init marko -- -t basic`
|
12
|
+
2. `cd ./<PROJECT_NAME>`
|
13
|
+
3. `npm run dev`
|
14
|
+
|
15
|
+
Open `src/routes/_index/+page.marko` in your editor to change the index page. See the [routing documentation](https://github.com/marko-js/run#file-based-routing) to learn how to add additional pages to your project.
|
16
|
+
|
17
|
+
### Other setups
|
18
|
+
|
19
|
+
If you just want to test out Marko in your browser, use the [Try Online](https://markojs.com/try-online) feature. You can open it in another tab and follow along. For other setups, check out the [Installation](./installing.md) page.
|
4
20
|
|
5
21
|
## Hello world
|
6
22
|
|
package/docs/installing.md
CHANGED
@@ -9,10 +9,10 @@ If you just want to play around with Marko in the browser, head on over to our [
|
|
9
9
|
If you're starting from scratch, you can use Marko's [CLI](https://github.com/marko-js/cli) commands to quickly create a starter app:
|
10
10
|
|
11
11
|
```bash
|
12
|
-
|
12
|
+
npm init marko
|
13
13
|
```
|
14
14
|
|
15
|
-
This will use an interactive [CLI](https://github.com/marko-js/cli) to automatically create a project for you using the pre-made starter template of your choosing. The `basic` template is the most minimal and the easiest way to get started. It uses our
|
15
|
+
This will use an interactive [CLI](https://github.com/marko-js/cli) to automatically create a project for you using the pre-made starter template of your choosing. The `basic` template is the most minimal and the easiest way to get started. It uses our recommended app framework [Marko Run](https://github.com/marko-js/run) that handles building, bundling, and serving your web application. These projects are config-free with built-in file based routing and automatic code reloading.
|
16
16
|
|
17
17
|
## Custom Bundling
|
18
18
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "marko",
|
3
|
-
"version": "5.
|
3
|
+
"version": "5.35.0",
|
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,8 +64,8 @@
|
|
64
64
|
"build": "babel ./src --out-dir ./dist --extensions .js --copy-files --config-file ../../babel.config.js --env-name=production"
|
65
65
|
},
|
66
66
|
"dependencies": {
|
67
|
-
"@marko/compiler": "^5.
|
68
|
-
"@marko/translator-default": "^6.0.
|
67
|
+
"@marko/compiler": "^5.37.0",
|
68
|
+
"@marko/translator-default": "^6.0.1",
|
69
69
|
"app-module-path": "^2.2.0",
|
70
70
|
"argly": "^1.2.0",
|
71
71
|
"browser-refresh-client": "1.1.4",
|
@@ -81,13 +81,18 @@ exports.p = function (domCompat) {
|
|
81
81
|
|
82
82
|
domCompat.patchConditionals((conditional) => (...args) => {
|
83
83
|
const signal = conditional(...args);
|
84
|
-
const
|
85
|
-
return (scope,
|
86
|
-
return signal(
|
84
|
+
const skipAttrs = args.length <= 1;
|
85
|
+
return (scope, rendererOrOp) => {
|
86
|
+
return signal(
|
87
|
+
scope,
|
88
|
+
domCompat.isOp(rendererOrOp)
|
89
|
+
? rendererOrOp
|
90
|
+
: create5to6Renderer(rendererOrOp, skipAttrs),
|
91
|
+
);
|
87
92
|
};
|
88
93
|
});
|
89
94
|
|
90
|
-
function create5to6Renderer(renderer,
|
95
|
+
function create5to6Renderer(renderer, skipAttrs) {
|
91
96
|
let newRenderer = renderer;
|
92
97
|
if (renderer && typeof renderer !== "string") {
|
93
98
|
const rendererFromAnywhere =
|
@@ -115,7 +120,7 @@ exports.p = function (domCompat) {
|
|
115
120
|
}
|
116
121
|
newRenderer = domCompat.createRenderer(
|
117
122
|
(scope) => {
|
118
|
-
if (
|
123
|
+
if (skipAttrs) {
|
119
124
|
renderAndMorph(scope, rendererFromAnywhere, renderer, {});
|
120
125
|
}
|
121
126
|
},
|
@@ -124,8 +129,8 @@ exports.p = function (domCompat) {
|
|
124
129
|
___createFragmentNode(null, null, realFragment);
|
125
130
|
return realFragment;
|
126
131
|
},
|
127
|
-
(scope, input
|
128
|
-
if (
|
132
|
+
(scope, input) => {
|
133
|
+
if (domCompat.isOp(input)) return;
|
129
134
|
renderAndMorph(scope, rendererFromAnywhere, renderer, input);
|
130
135
|
},
|
131
136
|
);
|
@@ -12,8 +12,7 @@ exports.p = function (tagsAPI) {
|
|
12
12
|
createRenderFn,
|
13
13
|
fork,
|
14
14
|
write,
|
15
|
-
|
16
|
-
register,
|
15
|
+
serializerRegister,
|
17
16
|
writeScope,
|
18
17
|
nextScopeId,
|
19
18
|
getRegistryInfo,
|
@@ -168,19 +167,11 @@ exports.p = function (tagsAPI) {
|
|
168
167
|
},
|
169
168
|
);
|
170
169
|
|
171
|
-
function dummyCreate5to6Renderer() {}
|
172
|
-
|
173
|
-
register(dummyCreate5to6Renderer, "@marko/tags-compat-5-to-6");
|
174
|
-
|
175
170
|
return function serialized5to6(renderer, id) {
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
.value(dummyCreate5to6Renderer)
|
181
|
-
.code("(")
|
182
|
-
.value(dummyRenderer)
|
183
|
-
.code(",!0)"),
|
171
|
+
return serializerRegister(
|
172
|
+
"@marko/tags-compat-5-to-6",
|
173
|
+
renderer,
|
174
|
+
serializerRegister(id, () => {}),
|
184
175
|
);
|
185
176
|
};
|
186
177
|
};
|