@marko/translator-default 5.22.0 → 5.22.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. package/dist/cdata/index.js +3 -3
  2. package/dist/class.js +3 -3
  3. package/dist/comment/index.js +3 -3
  4. package/dist/declaration/index.js +3 -3
  5. package/dist/document-type/index.js +3 -3
  6. package/dist/index.js +12 -12
  7. package/dist/placeholder/index.js +3 -3
  8. package/dist/placeholder/index[html].js +9 -9
  9. package/dist/tag/attribute/directives/class.js +4 -3
  10. package/dist/tag/attribute/directives/index.js +2 -1
  11. package/dist/tag/attribute/directives/no-update-body-if.js +4 -3
  12. package/dist/tag/attribute/directives/no-update-body.js +2 -1
  13. package/dist/tag/attribute/directives/no-update-if.js +2 -1
  14. package/dist/tag/attribute/directives/no-update.js +2 -1
  15. package/dist/tag/attribute/directives/style.js +4 -3
  16. package/dist/tag/attribute/index.js +6 -6
  17. package/dist/tag/attribute/modifiers/index.js +2 -1
  18. package/dist/tag/attribute/modifiers/no-update.js +4 -3
  19. package/dist/tag/attribute/modifiers/scoped.js +4 -3
  20. package/dist/tag/custom-tag.js +10 -10
  21. package/dist/tag/dynamic-tag.js +2 -2
  22. package/dist/tag/index.js +4 -4
  23. package/dist/tag/native-tag.js +2 -2
  24. package/dist/tag/native-tag[html]/attributes.js +4 -4
  25. package/dist/tag/native-tag[html]/index.js +4 -4
  26. package/dist/tag/native-tag[vdom]/index.js +8 -8
  27. package/dist/tag/util.js +4 -4
  28. package/dist/taglib/core/conditional/translate-else.js +2 -2
  29. package/dist/taglib/core/index.js +140 -138
  30. package/dist/taglib/core/parse-class.js +4 -4
  31. package/dist/taglib/core/parse-export.js +4 -4
  32. package/dist/taglib/core/parse-import.js +4 -4
  33. package/dist/taglib/core/parse-module-code.js +2 -2
  34. package/dist/taglib/core/parse-static.js +2 -2
  35. package/dist/taglib/core/transform-style.js +2 -2
  36. package/dist/taglib/core/translate-await.js +4 -4
  37. package/dist/taglib/core/translate-for.js +4 -4
  38. package/dist/taglib/core/translate-include-content.js +2 -2
  39. package/dist/taglib/migrate/all-templates.js +2 -1
  40. package/dist/taglib/migrate/index.js +2 -1
  41. package/dist/util/add-dependencies.js +4 -4
  42. package/dist/util/get-component-files.js +2 -2
  43. package/dist/util/key-manager.js +4 -4
  44. package/dist/util/optimize-html-writes.js +5 -5
  45. package/dist/util/optimize-vdom-create.js +9 -9
  46. package/package.json +4 -4
@@ -4,9 +4,9 @@ var _indexVdom = _interopRequireDefault(require("./index[vdom]"));
4
4
  function _default(path) {
5
5
  const {
6
6
  hub: {
7
- file: { markoOpts } } } =
8
-
9
- path;
7
+ file: { markoOpts }
8
+ }
9
+ } = path;
10
10
  if (markoOpts.output === "html") {
11
11
  (0, _indexHtml.default)(path);
12
12
  } else {
package/dist/class.js CHANGED
@@ -4,9 +4,9 @@ function _default(path) {
4
4
  const {
5
5
  hub: { file },
6
6
  node: {
7
- body: { body } } } =
8
-
9
- path;
7
+ body: { body }
8
+ }
9
+ } = path;
10
10
 
11
11
  const classProperties = [];
12
12
  let onCreateMethod = body.find(
@@ -4,9 +4,9 @@ var _indexVdom = _interopRequireDefault(require("./index[vdom]"));
4
4
  function _default(path) {
5
5
  const {
6
6
  hub: {
7
- file: { markoOpts } } } =
8
-
9
- path;
7
+ file: { markoOpts }
8
+ }
9
+ } = path;
10
10
  if (markoOpts.output === "html") {
11
11
  (0, _indexHtml.default)(path);
12
12
  } else {
@@ -4,9 +4,9 @@ var _indexVdom = _interopRequireDefault(require("./index[vdom]"));
4
4
  function _default(path) {
5
5
  const {
6
6
  hub: {
7
- file: { markoOpts } } } =
8
-
9
- path;
7
+ file: { markoOpts }
8
+ }
9
+ } = path;
10
10
  if (markoOpts.output === "html") {
11
11
  (0, _indexHtml.default)(path);
12
12
  } else {
@@ -4,9 +4,9 @@ var _indexVdom = _interopRequireDefault(require("./index[vdom]"));
4
4
  function _default(path) {
5
5
  const {
6
6
  hub: {
7
- file: { markoOpts } } } =
8
-
9
- path;
7
+ file: { markoOpts }
8
+ }
9
+ } = path;
10
10
  if (markoOpts.output === "html") {
11
11
  (0, _indexHtml.default)(path);
12
12
  } else {
package/dist/index.js CHANGED
@@ -76,8 +76,8 @@ const analyze = {
76
76
  meta.imports = program.node.body.
77
77
  filter((child) => _compiler.types.isImportDeclaration(child)).
78
78
  map((child) => child.source.value);
79
- } },
80
-
79
+ }
80
+ },
81
81
  MarkoTag(tag) {
82
82
  const { file } = tag.hub;
83
83
  const tagDef = (0, _babelUtils.getTagDef)(tag);
@@ -156,9 +156,9 @@ const analyze = {
156
156
  meta.tags.push(tagEntry);
157
157
  }
158
158
  }
159
- } } };exports.analyze = analyze;
160
-
161
-
159
+ }
160
+ }
161
+ };exports.analyze = analyze;
162
162
 
163
163
  const translate = {
164
164
  MarkoDocumentType: _documentType.default,
@@ -178,8 +178,8 @@ const translate = {
178
178
  Program: {
179
179
  enter(path) {
180
180
  const {
181
- hub: { file } } =
182
- path;
181
+ hub: { file }
182
+ } = path;
183
183
 
184
184
  if (file.markoOpts.output === "hydrate") {
185
185
  (0, _addDependencies.default)(file, true);
@@ -222,8 +222,8 @@ const translate = {
222
222
  },
223
223
  exit(path) {
224
224
  const {
225
- hub: { file } } =
226
- path;
225
+ hub: { file }
226
+ } = path;
227
227
  const { markoOpts, _inlineComponentClass } = file;
228
228
  const includeMetaInSource = markoOpts.meta !== false;
229
229
  const meta = file.metadata.marko;
@@ -449,9 +449,9 @@ const translate = {
449
449
  }
450
450
 
451
451
  (0, _optimizeHtmlWrites.optimizeHTMLWrites)(path);
452
- } } };exports.translate = translate;
453
-
454
-
452
+ }
453
+ }
454
+ };exports.translate = translate;
455
455
 
456
456
  function getRuntimeEntryFiles(output, optimize) {
457
457
  const base = `marko/${optimize ? "dist" : "src"}/`;
@@ -4,9 +4,9 @@ var _indexVdom = _interopRequireDefault(require("./index[vdom]"));
4
4
  function _default(path) {
5
5
  const {
6
6
  hub: {
7
- file: { markoOpts } } } =
8
-
9
- path;
7
+ file: { markoOpts }
8
+ }
9
+ } = path;
10
10
  if (markoOpts.output === "html") {
11
11
  (0, _indexHtml.default)(path);
12
12
  } else {
@@ -12,25 +12,25 @@ const ESCAPE_TYPES = {
12
12
  name: "x",
13
13
  module: "marko/src/runtime/html/helpers/escape-xml.js",
14
14
  alias: "marko_escapeXml",
15
- fn: _escapeXml.x },
16
-
15
+ fn: _escapeXml.x
16
+ },
17
17
  script: {
18
18
  module: "marko/src/runtime/html/helpers/escape-script-placeholder.js",
19
19
  alias: "marko_escapeScript",
20
- fn: _escapeScriptPlaceholder.default },
21
-
20
+ fn: _escapeScriptPlaceholder.default
21
+ },
22
22
  style: {
23
23
  module: "marko/src/runtime/html/helpers/escape-style-placeholder.js",
24
24
  alias: "marko_escapeStyle",
25
- fn: _escapeStylePlaceholder.default } };
26
-
27
-
25
+ fn: _escapeStylePlaceholder.default
26
+ }
27
+ };
28
28
 
29
29
  function _default(path) {
30
30
  const {
31
31
  node,
32
- hub: { file } } =
33
- path;
32
+ hub: { file }
33
+ } = path;
34
34
  const { confident, value: computed } = path.get("value").evaluate();
35
35
  let { escape, value } = node;
36
36
 
@@ -6,8 +6,8 @@ var _withPreviousLocation = _interopRequireDefault(require("../../../util/with-p
6
6
  {
7
7
  exit(tag, _, value) {
8
8
  const {
9
- hub: { file } } =
10
- tag;
9
+ hub: { file }
10
+ } = tag;
11
11
  if (!(0, _babelUtils.isNativeTag)(tag)) return;
12
12
  if (value.isStringLiteral()) return;
13
13
 
@@ -31,4 +31,5 @@ var _withPreviousLocation = _interopRequireDefault(require("../../../util/with-p
31
31
  value.node));
32
32
 
33
33
 
34
- } };exports.default = _default;
34
+ }
35
+ };exports.default = _default;
@@ -11,4 +11,5 @@ var _noUpdateBodyIf = _interopRequireDefault(require("./no-update-body-if"));var
11
11
  "no-update": _noUpdate.default,
12
12
  "no-update-if": _noUpdateIf.default,
13
13
  "no-update-body": _noUpdateBody.default,
14
- "no-update-body-if": _noUpdateBodyIf.default };exports.default = _default;
14
+ "no-update-body-if": _noUpdateBodyIf.default
15
+ };exports.default = _default;
@@ -5,6 +5,7 @@ var _babelUtils = require("@marko/babel-utils");var _default =
5
5
  exit(tag, attr, value) {
6
6
  _noUpdate.default.exit(tag, attr, value, {
7
7
  if: (0, _babelUtils.getArgOrSequence)(attr),
8
- bodyOnly: true });
9
-
10
- } };exports.default = _default;
8
+ bodyOnly: true
9
+ });
10
+ }
11
+ };exports.default = _default;
@@ -3,4 +3,5 @@
3
3
  {
4
4
  exit(tag, attr, value) {
5
5
  _noUpdate.default.exit(tag, attr, value, { bodyOnly: true });
6
- } };exports.default = _default;
6
+ }
7
+ };exports.default = _default;
@@ -4,4 +4,5 @@ var _babelUtils = require("@marko/babel-utils");var _default =
4
4
  {
5
5
  exit(tag, attr, value) {
6
6
  _noUpdate.default.exit(tag, attr, value, { if: (0, _babelUtils.getArgOrSequence)(attr) });
7
- } };exports.default = _default;
7
+ }
8
+ };exports.default = _default;
@@ -38,4 +38,5 @@ const EMPTY_OBJECT = {};var _default =
38
38
  } else {
39
39
  tag.replaceWith(replacement);
40
40
  }
41
- } };exports.default = _default;
41
+ }
42
+ };exports.default = _default;
@@ -6,8 +6,8 @@ var _withPreviousLocation = _interopRequireDefault(require("../../../util/with-p
6
6
  {
7
7
  exit(tag, _, value) {
8
8
  const {
9
- hub: { file } } =
10
- tag;
9
+ hub: { file }
10
+ } = tag;
11
11
  if (value.isStringLiteral()) return;
12
12
  if (!(0, _babelUtils.isNativeTag)(tag)) return;
13
13
 
@@ -27,4 +27,5 @@ var _withPreviousLocation = _interopRequireDefault(require("../../../util/with-p
27
27
  value.node));
28
28
 
29
29
 
30
- } };exports.default = _default;
30
+ }
31
+ };exports.default = _default;
@@ -9,8 +9,8 @@ const attachedDetachedLoaded = new WeakSet();var _default =
9
9
  {
10
10
  enter(attr) {
11
11
  const {
12
- hub: { file } } =
13
- attr;
12
+ hub: { file }
13
+ } = attr;
14
14
  const tag = attr.parentPath;
15
15
  const value = attr.get("value");
16
16
  const { name, arguments: args } = attr.node;
@@ -57,8 +57,8 @@ const attachedDetachedLoaded = new WeakSet();var _default =
57
57
 
58
58
  handlers[eventName] = {
59
59
  arguments: args,
60
- once: eventType === "once" };
61
-
60
+ once: eventType === "once"
61
+ };
62
62
 
63
63
  if (isVDOM) {
64
64
  if (eventName === "attach" || eventName === "detach") {
@@ -109,8 +109,8 @@ const attachedDetachedLoaded = new WeakSet();var _default =
109
109
  `The binding syntax (:=) is only supported when using the "Tags API".`);
110
110
 
111
111
  }
112
- } };exports.default = _default;
113
-
112
+ }
113
+ };exports.default = _default;
114
114
 
115
115
  function execModifiersAndDirectives(type, tag, attr, value) {
116
116
  const { node } = attr;
@@ -3,4 +3,5 @@ var _noUpdate = _interopRequireDefault(require("./no-update"));var _default =
3
3
 
4
4
  {
5
5
  scoped: _scoped.default,
6
- "no-update": _noUpdate.default };exports.default = _default;
6
+ "no-update": _noUpdate.default
7
+ };exports.default = _default;
@@ -9,8 +9,8 @@ const hasMonkeyPatch = new WeakSet();
9
9
  exit(tag, attr) {
10
10
  const {
11
11
  node,
12
- hub: { file } } =
13
- tag;
12
+ hub: { file }
13
+ } = tag;
14
14
  const isVDOM = file.markoOpts.output !== "html";
15
15
 
16
16
  if (!node.preserveAttrs) {
@@ -23,4 +23,5 @@ const hasMonkeyPatch = new WeakSet();
23
23
  }
24
24
 
25
25
  node.preserveAttrs.push(attr.node.name);
26
- } };exports.default = _default;
26
+ }
27
+ };exports.default = _default;
@@ -4,8 +4,8 @@ var _withPreviousLocation = _interopRequireDefault(require("../../../util/with-p
4
4
  {
5
5
  exit(tag, _, value) {
6
6
  const {
7
- hub: { file } } =
8
- tag;
7
+ hub: { file }
8
+ } = tag;
9
9
  value.replaceWith(
10
10
  (0, _withPreviousLocation.default)(
11
11
  _compiler.types.callExpression(
@@ -18,4 +18,5 @@ var _withPreviousLocation = _interopRequireDefault(require("../../../util/with-p
18
18
  value.node));
19
19
 
20
20
 
21
- } };exports.default = _default;
21
+ }
22
+ };exports.default = _default;
@@ -13,8 +13,8 @@ var _withPreviousLocation = _interopRequireDefault(require("../util/with-previou
13
13
  function _default(path, isNullable) {
14
14
  const {
15
15
  hub: { file },
16
- node } =
17
- path;
16
+ node
17
+ } = path;
18
18
  const { markoOpts } = file;
19
19
  const { name, key } = node;
20
20
 
@@ -45,6 +45,13 @@ function _default(path, isNullable) {
45
45
 
46
46
  if (relativePath) {
47
47
  if (binding) {
48
+
49
+
50
+
51
+
52
+
53
+
54
+
48
55
  // TODO: implement auto migration for conflicts here
49
56
  // and log below warning
50
57
  // console.warn(
@@ -52,14 +59,7 @@ function _default(path, isNullable) {
52
59
  // `The <${tagName}> tag has been resolved from the filesystem, however a local variable with the same name exists. In the next major version of Marko the local variable will tag precedence.`
53
60
  // )
54
61
  // );
55
- }
56
-
57
- tagIdentifier = (0, _babelUtils.importDefault)(file, relativePath, tagName);
58
- } else if (binding) {
59
- path.set("name", _compiler.types.identifier(tagName));
60
- return (0, _dynamicTag.default)(path);
61
- } else if (markoOpts.ignoreUnrecognizedTags) {
62
- return (0, _nativeTag.default)(path);
62
+ }tagIdentifier = (0, _babelUtils.importDefault)(file, relativePath, tagName);} else if (binding) {path.set("name", _compiler.types.identifier(tagName));return (0, _dynamicTag.default)(path);} else if (markoOpts.ignoreUnrecognizedTags) {return (0, _nativeTag.default)(path);
63
63
  } else {
64
64
  throw path.
65
65
  get("name").
@@ -6,8 +6,8 @@ var _withPreviousLocation = _interopRequireDefault(require("../util/with-previou
6
6
  function _default(path) {
7
7
  const {
8
8
  node,
9
- hub: { file } } =
10
- path;
9
+ hub: { file }
10
+ } = path;
11
11
  const tagProperties = path.node.extra && path.node.extra.properties || [];
12
12
  const { key, arguments: args } = node;
13
13
  const foundAttrs = (0, _util.getAttrs)(path, true);
package/dist/tag/index.js CHANGED
@@ -124,8 +124,8 @@ var _optimizeVdomCreate = require("../util/optimize-vdom-create");var _default =
124
124
  } else {
125
125
  return (0, _customTag.default)(path, isDynamicNullable);
126
126
  }
127
- } };exports.default = _default;
128
-
127
+ }
128
+ };exports.default = _default;
129
129
 
130
130
  const HANDLE_BINDINGS = ["module", "var", "let", "const"];
131
131
  function findDynamicTagTypes(root) {
@@ -133,8 +133,8 @@ function findDynamicTagTypes(root) {
133
133
  const types = {
134
134
  string: false,
135
135
  empty: false,
136
- component: false };
137
-
136
+ component: false
137
+ };
138
138
 
139
139
  let path;
140
140
  while (path = pending.pop()) {
@@ -8,8 +8,8 @@ var _babelUtils = require("@marko/babel-utils");
8
8
 
9
9
  function _default(path, isNullable) {
10
10
  const {
11
- hub: { file } } =
12
- path;
11
+ hub: { file }
12
+ } = path;
13
13
  const { markoOpts } = file;
14
14
 
15
15
  if (!markoOpts.ignoreUnrecognizedTags) {
@@ -13,8 +13,8 @@ function _default(path, attrs) {
13
13
  const attrsObject = _compiler.types.objectExpression([]);
14
14
  for (let i = 0; i < len; i++) {
15
15
  const {
16
- node: { name, value } } =
17
- attrs[i];
16
+ node: { name, value }
17
+ } = attrs[i];
18
18
 
19
19
  if (name) {
20
20
  attrsObject.properties.push(
@@ -54,8 +54,8 @@ function _default(path, attrs) {
54
54
  attrValues.set(name, {
55
55
  confident,
56
56
  computed,
57
- value });
58
-
57
+ value
58
+ });
59
59
  }
60
60
 
61
61
  for (const [name, { confident, computed, value }] of [
@@ -19,14 +19,14 @@ const EMPTY_OBJECT = {};
19
19
  function _default(path, isNullable) {
20
20
  const {
21
21
  hub: { file },
22
- node } =
23
- path;
22
+ node
23
+ } = path;
24
24
  const {
25
25
  key,
26
26
  name,
27
27
  body: { body },
28
- handlers } =
29
- node;
28
+ handlers
29
+ } = node;
30
30
  const tagProperties = path.node.extra && path.node.extra.properties || [];
31
31
  const tagDef = (0, _babelUtils.getTagDef)(path);
32
32
  const meta = file.metadata.marko;
@@ -14,21 +14,21 @@ const MAYBE_SVG = {
14
14
  a: true,
15
15
  script: true,
16
16
  style: true,
17
- title: true };
18
-
17
+ title: true
18
+ };
19
19
 
20
20
  function tagArguments(path, isStatic) {
21
21
  const {
22
22
  hub: { file },
23
23
  node,
24
- parent } =
25
- path;
24
+ parent
25
+ } = path;
26
26
  const {
27
27
  name,
28
28
  key,
29
29
  body: { body },
30
- handlers } =
31
- node;
30
+ handlers
31
+ } = node;
32
32
  const tagProperties = path.node.extra && path.node.extra.properties || [];
33
33
  const attrs = path.get("attributes");
34
34
  const seen = new Set();
@@ -167,8 +167,8 @@ function _default(path, isNullable) {
167
167
  const {
168
168
  name,
169
169
  key,
170
- body: { body } } =
171
- node;
170
+ body: { body }
171
+ } = node;
172
172
 
173
173
  const isEmpty = !body.length;
174
174
  const writeArgs = tagArguments(path, false);
package/dist/tag/util.js CHANGED
@@ -6,8 +6,8 @@ function getAttrs(path, preserveNames, skipRenderBody) {
6
6
  const {
7
7
  attributes,
8
8
  body: { body, params },
9
- hasDynamicAttrTags } =
10
- node;
9
+ hasDynamicAttrTags
10
+ } = node;
11
11
  const attrsLen = attributes.length;
12
12
  const childLen = body.length;
13
13
  const properties = [];
@@ -179,8 +179,8 @@ function evaluateAttr(attr) {
179
179
 
180
180
  return {
181
181
  confident,
182
- computed };
183
-
182
+ computed
183
+ };
184
184
  }
185
185
 
186
186
  function camelCase(string) {
@@ -7,8 +7,8 @@ function exit(path) {
7
7
 
8
8
  const {
9
9
  ifStatement,
10
- body: { body } } =
11
- path.node;
10
+ body: { body }
11
+ } = path.node;
12
12
 
13
13
  if (!ifStatement) {
14
14
  throw path.