@marko/translator-default 5.32.16 → 5.33.1
Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js
CHANGED
@@ -49,8 +49,8 @@ const analyze = exports.analyze = {
|
|
49
49
|
exit(program) {
|
50
50
|
const { file } = program.hub;
|
51
51
|
const meta = file.metadata.marko;
|
52
|
-
const
|
53
|
-
|
52
|
+
const componentFiles = (0, _getComponentFiles.default)(program);
|
53
|
+
const { styleFile, packageFile, componentBrowserFile } = componentFiles;
|
54
54
|
|
55
55
|
if (packageFile) {
|
56
56
|
meta.deps.unshift(`package: ${packageFile}`);
|
@@ -62,8 +62,16 @@ const analyze = exports.analyze = {
|
|
62
62
|
|
63
63
|
if (meta.hasComponentBrowser) {
|
64
64
|
meta.component = componentBrowserFile;
|
65
|
-
} else if (
|
65
|
+
} else if (
|
66
|
+
meta.hasComponent ||
|
67
|
+
meta.hasStatefulTagParams ||
|
68
|
+
meta.hasFunctionEventHandlers)
|
69
|
+
{
|
66
70
|
meta.component = file.opts.filename;
|
71
|
+
} else if (meta.hasStringEventHandlers) {
|
72
|
+
meta.component = componentFiles.componentBrowserFile =
|
73
|
+
"marko/src/runtime/helpers/empty-component.js";
|
74
|
+
meta.hasComponentBrowser = true;
|
67
75
|
}
|
68
76
|
|
69
77
|
meta.component =
|
@@ -114,6 +122,26 @@ const analyze = exports.analyze = {
|
|
114
122
|
}
|
115
123
|
}
|
116
124
|
|
125
|
+
if (!meta.hasFunctionEventHandlers || !meta.hasStringEventHandlers) {
|
126
|
+
for (const attr of tag.node.attributes) {
|
127
|
+
if (
|
128
|
+
_compiler.types.isMarkoAttribute(attr) &&
|
129
|
+
attr.arguments &&
|
130
|
+
/^on[-A-Z]/.test(attr.name))
|
131
|
+
{
|
132
|
+
if (
|
133
|
+
attr.arguments.length >= 1 &&
|
134
|
+
attr.arguments[0].type === "StringLiteral")
|
135
|
+
{
|
136
|
+
meta.hasStringEventHandlers = true;
|
137
|
+
} else {
|
138
|
+
meta.hasFunctionEventHandlers = true;
|
139
|
+
}
|
140
|
+
break;
|
141
|
+
}
|
142
|
+
}
|
143
|
+
}
|
144
|
+
|
117
145
|
if (
|
118
146
|
meta.hasStatefulTagParams ||
|
119
147
|
(0, _babelUtils.isNativeTag)(tag) ||
|
@@ -138,6 +166,7 @@ const analyze = exports.analyze = {
|
|
138
166
|
meta.hasStatefulTagParams =
|
139
167
|
childMeta && (
|
140
168
|
childMeta.hasStatefulTagParams ||
|
169
|
+
childMeta.hasFunctionEventHandlers ||
|
141
170
|
childMeta.hasComponent && !childMeta.hasComponentBrowser);
|
142
171
|
},
|
143
172
|
ImportDeclaration: {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.default = getComponentFiles;var _path = _interopRequireDefault(require("path"));
|
2
2
|
var _escapeRegexp = require("./escape-regexp");
|
3
3
|
|
4
|
-
const COMPONENT_FILES_KEY =
|
4
|
+
const COMPONENT_FILES_KEY = "___marko_component_files___";
|
5
5
|
|
6
6
|
function getComponentFiles({ hub: { file } }) {
|
7
7
|
const meta = file.metadata.marko;
|
@@ -40,6 +40,7 @@ const mergeStaticCreateVisitor = {
|
|
40
40
|
);
|
41
41
|
},
|
42
42
|
MarkoTag(path, state) {
|
43
|
+
(0, _keyManager.getKeyManager)(path).resolveKey(path);
|
43
44
|
state.currentRoot = _compiler.types.callExpression(
|
44
45
|
_compiler.types.memberExpression(state.currentRoot, _compiler.types.identifier("e")),
|
45
46
|
getConstElementArgs(path)
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@marko/translator-default",
|
3
|
-
"version": "5.
|
3
|
+
"version": "5.33.1",
|
4
4
|
"description": "Translates Marko templates to the default Marko runtime.",
|
5
5
|
"keywords": [
|
6
6
|
"babel",
|
@@ -34,8 +34,8 @@
|
|
34
34
|
"self-closing-tags": "^1.0.1"
|
35
35
|
},
|
36
36
|
"devDependencies": {
|
37
|
-
"@marko/compiler": "^5.
|
38
|
-
"marko": "^5.
|
37
|
+
"@marko/compiler": "^5.36.1",
|
38
|
+
"marko": "^5.34.1"
|
39
39
|
},
|
40
40
|
"peerDependencies": {
|
41
41
|
"@marko/compiler": "^5.16.1",
|