marko 5.35.1 → 5.35.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/node-require/index.js +6 -1
- package/docs/compiler.md +3 -3
- package/docs/marko-5-upgrade.md +36 -88
- package/package.json +4 -3
- package/src/node-require/index.js +5 -0
@@ -7,7 +7,12 @@ const requiredCompilerOptions = { modules: "cjs" };
|
|
7
7
|
const defaultCompilerOptions = {
|
8
8
|
// eslint-disable-next-line no-constant-condition
|
9
9
|
sourceMaps: false,
|
10
|
-
meta: true
|
10
|
+
meta: true,
|
11
|
+
babelConfig: {
|
12
|
+
babelrc: false,
|
13
|
+
configFile: false,
|
14
|
+
browserslistConfigFile: false
|
15
|
+
}
|
11
16
|
};
|
12
17
|
const MARKO_EXTENSIONS = Symbol("MARKO_EXTENSIONS");
|
13
18
|
|
package/docs/compiler.md
CHANGED
@@ -206,12 +206,12 @@ Default: [environment based](https://github.com/marko-js/marko/blob/0f212897d2d3
|
|
206
206
|
|
207
207
|
Enables production mode optimizations.
|
208
208
|
|
209
|
-
#### `
|
209
|
+
#### `optimizeKnownTemplates`
|
210
210
|
|
211
|
-
Type: `
|
211
|
+
Type: `string[]`<br>
|
212
212
|
Default: `undefined`
|
213
213
|
|
214
|
-
If `optimize` is enabled you can provide
|
214
|
+
If `optimize` is enabled you can provide an array of template paths which the compiler will use to generate shorter registry/template ids using incrementing ids. This can only be used if the same `optimizeKnownTemplates` are used for both server and client compilations.
|
215
215
|
|
216
216
|
#### `resolveVirtualDependency`
|
217
217
|
|
package/docs/marko-5-upgrade.md
CHANGED
@@ -1,111 +1,59 @@
|
|
1
1
|
# Upgrading to Marko 5
|
2
2
|
|
3
|
-
The following guide will help you get through the upgrade process quickly and smoothly. This guide covers upgrading from Marko 4. If you are upgrading to Marko 5 from a previous version follow those docs first. After any given step you should have a working application.
|
4
|
-
|
5
|
-
This means you should complete a step and get it merged back into master fairly quickly. You shouldn't need to have a `marko-5-upgrade` branch for your project that lives in limbo for a couple of weeks falling behind the other changes that are being merged into master.
|
6
|
-
|
7
|
-
If you do decide to pause and later jump in where you left off, be sure to repeat Step 0 first 😉.
|
8
|
-
|
9
3
|
## Step 0 - Ensure you're in a working state on the latest version of Marko 4
|
10
4
|
|
11
5
|
Before we start, you'll want to make sure that you are already on the latest `4.x` release of `marko`.
|
12
6
|
|
13
7
|
```bash
|
14
|
-
# Upgrade using
|
15
|
-
npm install marko@^4
|
16
|
-
|
17
|
-
# Or with yarn
|
8
|
+
# Upgrade using yarn
|
18
9
|
yarn upgrade marko@^4
|
19
10
|
```
|
20
11
|
|
21
|
-
> **Warning**
|
22
|
-
> Do _not_ run `npm install marko` (without the `@^4`). This will put you on Marko 5 and we're not quite there yet.
|
23
|
-
|
24
|
-
Run your application and tests to ensure your project is in a working state. There's little worse than finding an issue after you've started the upgrade process only to figure out the issue existed beforehand.
|
25
|
-
|
26
|
-
## Step 1 - Upgrade dependencies
|
27
|
-
|
28
|
-
Before upgrading to Marko 5, it is recommended to make sure that your Marko-related dependencies are up-to-date. Many packages have versions that support both Marko 4 and Marko 5. If one of your dependencies doesn't have a version that supports both, you'll need to wait to upgrade it until you're upgrading Marko.
|
29
|
-
|
30
|
-
After upgrading, run your application and tests to ensure that everything is still working as intended. If there are any issues, please refer to the changelogs of the modules you just upgraded to see if you need to make any changes within your app to accommodate the new versions.
|
31
|
-
|
32
|
-
## Step 2 - Upgrade Marko
|
33
|
-
|
34
|
-
Phew! With all the prep out of the way we're finally ready to upgrade `marko`!
|
35
|
-
|
36
|
-
### Install Modules
|
37
|
-
|
38
|
-
Note that some features removed in Marko 4 do not log deprecations since they do not need to be resolved to get up and running with Marko 5. However for Marko 5 to support some of the features removed after Marko 4 you need to install a `compat` module.
|
39
|
-
|
40
|
-
There are currently two `compat` modules you can install, one which supports the `marko-widget`'s api from Marko@3 and one with just the compat needed for Marko@4 components.
|
41
|
-
|
42
|
-
**For apps with `marko-widgets` installed, add the following modules:**
|
43
|
-
|
44
12
|
```bash
|
45
13
|
# Upgrade using npm
|
46
|
-
npm install marko@^
|
47
|
-
|
48
|
-
# Or with yarn
|
49
|
-
yarn install marko@^5 @marko/compiler marko-widgets@^8
|
50
|
-
```
|
51
|
-
|
52
|
-
**For apps which were not using the Marko@3 compat layer, add the following modules:**
|
53
|
-
|
54
|
-
```bash
|
55
|
-
# Upgrade using npm
|
56
|
-
npm install marko@^5 @marko/compiler @marko/compat-v4
|
57
|
-
|
58
|
-
# Or with yarn
|
59
|
-
yarn install marko@^5 @marko/compiler @marko/compat-v4
|
14
|
+
npm install marko@^4
|
60
15
|
```
|
61
16
|
|
62
|
-
|
63
|
-
|
64
|
-
If you're bundling your server code (common with `webpack` setups), your entry will be your bundler config.
|
65
|
-
Otherwise it's probably something like `index.js` or `server.js` near your project root.
|
66
|
-
|
67
|
-
- Register your compat module globally so that any dependencies also run through the compat layer:
|
68
|
-
|
69
|
-
```js
|
70
|
-
require("@marko/compiler").taglib.register("marko-widgets");
|
71
|
-
```
|
72
|
-
|
73
|
-
> **Note**
|
74
|
-
> if using `webpack` or `rollup` this line should also be added you your bundler config file
|
17
|
+
> [!Warning]
|
18
|
+
> Do _not_ run `npm install marko` (without the `@^4`). This will put you on Marko 5 and we're not quite there yet.
|
75
19
|
|
76
|
-
|
77
|
-
|
20
|
+
> [!Tip]
|
21
|
+
> If upgrading from Marko 3 you may want to reference [this guide](https://marko-v4.github.io/docs/marko-4-upgrade/).
|
78
22
|
|
79
|
-
|
80
|
-
```js
|
81
|
-
require("@marko/compiler").configure({
|
82
|
-
babelConfig: {
|
83
|
-
babelrc: false,
|
84
|
-
configFile: false,
|
85
|
-
},
|
86
|
-
});
|
87
|
-
```
|
88
|
-
If you do this, you'll also want also want to pass the `babelConfig` option to your bundler plugin (`lasso-marko`, `@marko/webpack`, `@marko/rollup`)
|
23
|
+
Run your application and tests to ensure your project is in a working state. There's little worse than finding an issue after you've started the upgrade process only to figure out the issue existed beforehand.
|
89
24
|
|
90
|
-
|
25
|
+
## Step 1 - Upgrade Marko & Dependencies
|
91
26
|
|
92
|
-
|
27
|
+
**TL;DR**: Paste & run this random shell script. It's safe. Trust us.
|
93
28
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
-
|
102
|
-
|
29
|
+
```bash
|
30
|
+
# Update Marko, and related ecosystem dependencies
|
31
|
+
npx -y ncu -u \
|
32
|
+
marko \
|
33
|
+
`# for webpack projects` \
|
34
|
+
@marko/webpack \
|
35
|
+
`# for lasso projects` \
|
36
|
+
lasso lasso-marko @lasso/marko-taglib \
|
37
|
+
`# for jest test runner` \
|
38
|
+
@marko/jest \
|
39
|
+
`# for projects with v3 widgets` \
|
40
|
+
marko-widgets
|
41
|
+
|
42
|
+
# Install @marko/compat-v4 unless `marko-widgets` is already installed
|
43
|
+
grep -q "marko-widgets" package.json || { [[ -f yarn.lock ]] && yarn add @marko/compat-v4 || npm install @marko/compat-v4; }
|
44
|
+
[[ -f yarn.lock ]] && npx -y yarn-deduplicate && yarn
|
45
|
+
[[ -f yarn.lock ]] || npm i
|
46
|
+
```
|
103
47
|
|
104
|
-
|
48
|
+
This script automates the following steps for you:
|
105
49
|
|
106
|
-
|
50
|
+
- Install the compat package
|
51
|
+
- `marko-widgets` if using Marko 3's Widgets
|
52
|
+
- `@marko/compat-v4` if not using Widgets
|
53
|
+
- Update `marko` to 5.x
|
54
|
+
- Update any ecosystem packages used by your app (lasso, webpack, jest, etc)
|
107
55
|
|
108
|
-
|
56
|
+
> [!Note]
|
57
|
+
> Check your `package.json`. If you have other third-party Marko packages not covered by the script, you may need to update them as well.
|
109
58
|
|
110
|
-
|
111
|
-
> The [TagsAPI](https://dev.to/ryansolid/introducing-the-marko-tags-api-preview-37o4) is becoming stable soon. Deprecations related to `marko-widgets`, might be worth holding off on rather than migrating these widgets to the Class Components API.
|
59
|
+
Your application should continue to work. Run your tests to ensure everything is working. Congratulations! You've upgraded to Marko 5.
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "marko",
|
3
|
-
"version": "5.35.
|
3
|
+
"version": "5.35.2",
|
4
4
|
"description": "UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.",
|
5
5
|
"keywords": [
|
6
6
|
"front-end",
|
@@ -47,6 +47,7 @@
|
|
47
47
|
"dist",
|
48
48
|
"docs",
|
49
49
|
"src",
|
50
|
+
"browser-refresh.js",
|
50
51
|
"compiler-browser.marko",
|
51
52
|
"compiler.js",
|
52
53
|
"components-browser.marko",
|
@@ -64,8 +65,8 @@
|
|
64
65
|
"build": "babel ./src --out-dir ./dist --extensions .js --copy-files --config-file ../../babel.config.js --env-name=production"
|
65
66
|
},
|
66
67
|
"dependencies": {
|
67
|
-
"@marko/compiler": "^5.37.
|
68
|
-
"@marko/translator-default": "^6.0.
|
68
|
+
"@marko/compiler": "^5.37.2",
|
69
|
+
"@marko/translator-default": "^6.0.3",
|
69
70
|
"app-module-path": "^2.2.0",
|
70
71
|
"argly": "^1.2.0",
|
71
72
|
"browser-refresh-client": "1.1.4",
|
@@ -8,6 +8,11 @@ const defaultCompilerOptions = {
|
|
8
8
|
// eslint-disable-next-line no-constant-condition
|
9
9
|
sourceMaps: "MARKO_DEBUG" ? "inline" : false,
|
10
10
|
meta: true,
|
11
|
+
babelConfig: {
|
12
|
+
babelrc: false,
|
13
|
+
configFile: false,
|
14
|
+
browserslistConfigFile: false,
|
15
|
+
},
|
11
16
|
};
|
12
17
|
const MARKO_EXTENSIONS = Symbol("MARKO_EXTENSIONS");
|
13
18
|
|