@marko/translator-default 5.30.1 → 5.31.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,10 +1,37 @@
|
|
1
1
|
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.default = void 0;var _compiler = require("@marko/compiler");
|
2
2
|
var _withPreviousLocation = _interopRequireDefault(require("../../util/with-previous-location"));
|
3
|
-
var _babelUtils = require("@marko/babel-utils");
|
3
|
+
var _babelUtils = require("@marko/babel-utils");
|
4
|
+
const kHadAssignment = Symbol();var _default =
|
4
5
|
|
5
6
|
{
|
6
|
-
|
7
|
-
if (
|
7
|
+
AssignmentExpression(path, state) {
|
8
|
+
if (
|
9
|
+
!state[kHadAssignment] &&
|
10
|
+
path.node.left.type === "Identifier" &&
|
11
|
+
path.node.left.name === "data")
|
12
|
+
{
|
13
|
+
state[kHadAssignment] = true;
|
14
|
+
|
15
|
+
let root = path.parentPath;
|
16
|
+
while (root.parentPath.type !== "Program") {
|
17
|
+
root = root.parentPath;
|
18
|
+
}
|
19
|
+
|
20
|
+
root.insertBefore(
|
21
|
+
_compiler.types.markoScriptlet([
|
22
|
+
_compiler.types.variableDeclaration("var", [
|
23
|
+
_compiler.types.variableDeclarator(_compiler.types.identifier("data"))])]));
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
}
|
28
|
+
},
|
29
|
+
ReferencedIdentifier(path, state) {
|
30
|
+
if (
|
31
|
+
!state[kHadAssignment] &&
|
32
|
+
path.node.name === "data" &&
|
33
|
+
!path.scope.hasBinding("data"))
|
34
|
+
{
|
8
35
|
(0, _babelUtils.diagnosticDeprecate)(path, {
|
9
36
|
label: "The 'data' variable is deprecated. Use 'input' instead.",
|
10
37
|
fix() {
|
@@ -9,7 +9,7 @@ var _babelUtils = require("@marko/babel-utils");var _default =
|
|
9
9
|
|
10
10
|
|
11
11
|
(entryFile, isHydrate) => {
|
12
|
-
const { resolveVirtualDependency, hydrateIncludeImports } =
|
12
|
+
const { resolveVirtualDependency, hydrateIncludeImports, hydrateInit } =
|
13
13
|
entryFile.markoOpts;
|
14
14
|
const hydratedFiles = new Set();
|
15
15
|
const program = entryFile.path;
|
@@ -39,19 +39,26 @@ var _babelUtils = require("@marko/babel-utils");var _default =
|
|
39
39
|
_compiler.types.importSpecifier(_compiler.types.identifier("register"), _compiler.types.identifier("register")));
|
40
40
|
|
41
41
|
}
|
42
|
-
|
42
|
+
|
43
|
+
if (hydrateInit) {
|
44
|
+
markoComponentsImport.specifiers.push(_compiler.types.importSpecifier(initId, initId));
|
45
|
+
}
|
46
|
+
|
43
47
|
program.unshiftContainer("body", markoComponentsImport);
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
48
|
+
|
49
|
+
if (hydrateInit) {
|
50
|
+
program.pushContainer(
|
51
|
+
"body",
|
52
|
+
_compiler.types.expressionStatement(
|
53
|
+
_compiler.types.callExpression(
|
54
|
+
initId,
|
55
|
+
entryFile.markoOpts.runtimeId ?
|
56
|
+
[_compiler.types.stringLiteral(entryFile.markoOpts.runtimeId)] :
|
57
|
+
[])));
|
52
58
|
|
53
59
|
|
54
60
|
|
61
|
+
}
|
55
62
|
}
|
56
63
|
|
57
64
|
function addHydrateDeps(file) {
|
@@ -159,6 +166,10 @@ var _babelUtils = require("@marko/babel-utils");var _default =
|
|
159
166
|
code,
|
160
167
|
virtualPath
|
161
168
|
});
|
169
|
+
|
170
|
+
if (!dep) {
|
171
|
+
continue;
|
172
|
+
}
|
162
173
|
} else if (dep.startsWith("package:")) {
|
163
174
|
continue;
|
164
175
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@marko/translator-default",
|
3
|
-
"version": "5.
|
3
|
+
"version": "5.31.0",
|
4
4
|
"description": "Translates Marko templates to the default Marko runtime.",
|
5
5
|
"keywords": [
|
6
6
|
"babel",
|
@@ -35,8 +35,8 @@
|
|
35
35
|
"self-closing-tags": "^1.0.1"
|
36
36
|
},
|
37
37
|
"devDependencies": {
|
38
|
-
"@marko/compiler": "^5.
|
39
|
-
"marko": "^5.
|
38
|
+
"@marko/compiler": "^5.33.0",
|
39
|
+
"marko": "^5.31.0"
|
40
40
|
},
|
41
41
|
"peerDependencies": {
|
42
42
|
"@marko/compiler": "^5.16.1",
|